From 72f4094287ff90beadaaf06aca133785aecfd5e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Tue, 30 Jul 2024 19:51:55 +0900 Subject: [PATCH] fix: Fix tree shaking even more (vercel/turbo#8864) ### Description Fix server action and rename the injected variable. The previous code fails if the name of the top-level variable is `v`. This was not a problem for almost all modules, but some packages like [`@firebase/webchannel-wrapper`](https://unpkg.com/@firebase/webchannel-wrapper@0.2.41/dist/index.esm.js) is published after mangling, so it can be a problem ### Testing Instructions See https://github.com/vercel/next.js/pull/66689 --- .../src/references/esm/export.rs | 8 +++++--- .../turbopack-ecmascript/src/tree_shake/asset.rs | 2 +- ...tree-shake_dynamic-import_input_lib_f28c6f.js | 14 +++++++------- ...sic-tree-shake_export-named_input_35ea42._.js | 8 ++++---- ...tree-shake_export-namespace_input_c0eca6._.js | 16 ++++++++-------- ...tree-shake_import-named-all_input_71b07f._.js | 6 +++--- ...sic-tree-shake_import-named_input_ed0d99._.js | 6 +++--- ...tree-shake_import-namespace_input_351ad1._.js | 14 +++++++------- ...ee-shake_import-side-effect_input_cdc49f._.js | 2 +- ...e-shake_require-side-effect_input_6b5862._.js | 14 +++++++------- ...shake_tree-shake-test-1_input_index_87c735.js | 14 +++++++------- 11 files changed, 53 insertions(+), 51 deletions(-) diff --git a/crates/turbopack-ecmascript/src/references/esm/export.rs b/crates/turbopack-ecmascript/src/references/esm/export.rs index 221e0de763c22..87ea3350d113a 100644 --- a/crates/turbopack-ecmascript/src/references/esm/export.rs +++ b/crates/turbopack-ecmascript/src/references/esm/export.rs @@ -442,8 +442,9 @@ impl CodeGenerateable for EsmExports { EsmExport::LocalBinding(name, mutable) => { if *mutable { Some(quote!( - "([() => $local, (v) => $local = v])" as Expr, - local = Ident::new((name as &str).into(), DUMMY_SP) + "([() => $local, ($new) => $local = $new])" as Expr, + local = Ident::new((name as &str).into(), DUMMY_SP), + new = Ident::new(format!("{name}_new_value").into(), DUMMY_SP), )) } else { Some(quote!( @@ -470,8 +471,9 @@ impl CodeGenerateable for EsmExports { }); if *mutable { quote!( - "([() => $expr, (v) => $expr = v])" as Expr, + "([() => $expr, ($new) => $expr = $new])" as Expr, expr: Expr = expr, + new = Ident::new(format!("{name}_new_value").into(), DUMMY_SP), ) } else { quote!( diff --git a/crates/turbopack-ecmascript/src/tree_shake/asset.rs b/crates/turbopack-ecmascript/src/tree_shake/asset.rs index a3dca90851ee6..4b0eb40b5a8c6 100644 --- a/crates/turbopack-ecmascript/src/tree_shake/asset.rs +++ b/crates/turbopack-ecmascript/src/tree_shake/asset.rs @@ -175,7 +175,7 @@ impl Module for EcmascriptModulePartAsset { impl Asset for EcmascriptModulePartAsset { #[turbo_tasks::function] fn content(&self) -> Vc { - todo!() + self.full_module.content() } } diff --git a/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_dynamic-import_input_lib_f28c6f.js b/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_dynamic-import_input_lib_f28c6f.js index 8823e0a199229..c81f03d76650e 100644 --- a/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_dynamic-import_input_lib_f28c6f.js +++ b/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_dynamic-import_input_lib_f28c6f.js @@ -6,7 +6,7 @@ __turbopack_esm__({ "dog": [ ()=>dog, - (v)=>dog = v + (dog_new_value)=>dog = dog_new_value ] }); let dog = "dog"; @@ -114,7 +114,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "cat": [ ()=>cat, - (v)=>cat = v + (cat_new_value)=>cat = cat_new_value ] }); let cat = "cat"; @@ -140,7 +140,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "getDog": [ ()=>getDog, - (v)=>getDog = v + (getDog_new_value)=>getDog = getDog_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__8$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/input/lib.js [test] (ecmascript) "); @@ -161,7 +161,7 @@ function getDog() { __turbopack_esm__({ "setDog": [ ()=>setDog, - (v)=>setDog = v + (setDog_new_value)=>setDog = setDog_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__4$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/input/lib.js [test] (ecmascript) "); @@ -180,7 +180,7 @@ function setDog(newDog) { __turbopack_esm__({ "dogRef": [ ()=>dogRef, - (v)=>dogRef = v + (dogRef_new_value)=>dogRef = dogRef_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__8$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/input/lib.js [test] (ecmascript) "); @@ -222,7 +222,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "getChimera": [ ()=>getChimera, - (v)=>getChimera = v + (getChimera_new_value)=>getChimera = getChimera_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__4$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/input/lib.js [test] (ecmascript) "); @@ -259,7 +259,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "initialCat": [ ()=>initialCat, - (v)=>initialCat = v + (initialCat_new_value)=>initialCat = initialCat_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__0$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/input/lib.js [test] (ecmascript) "); diff --git a/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-named/output/crates_turbopack-tests_tests_snapshot_basic-tree-shake_export-named_input_35ea42._.js b/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-named/output/crates_turbopack-tests_tests_snapshot_basic-tree-shake_export-named_input_35ea42._.js index 6a1dbbb6d5274..80ebbce6b14e4 100644 --- a/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-named/output/crates_turbopack-tests_tests_snapshot_basic-tree-shake_export-named_input_35ea42._.js +++ b/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-named/output/crates_turbopack-tests_tests_snapshot_basic-tree-shake_export-named_input_35ea42._.js @@ -6,7 +6,7 @@ __turbopack_esm__({ "dog": [ ()=>dog, - (v)=>dog = v + (dog_new_value)=>dog = dog_new_value ] }); let dog = "dog"; @@ -139,7 +139,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "cat": [ ()=>cat, - (v)=>cat = v + (cat_new_value)=>cat = cat_new_value ] }); let cat = "cat"; @@ -165,7 +165,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "__TURBOPACK__reexport__cat__": [ ()=>__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$named$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$export__cat$3e$__["cat"], - (v)=>$expr = v + (cat_new_value)=>$expr = cat_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$named$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$module__evaluation$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-named/input/lib.js [test] (ecmascript) "); @@ -194,7 +194,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "fakeCat": [ ()=>__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$named$2f$input$2f$module$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$export__fakeCat$3e$__["fakeCat"], - (v)=>$expr = v + (fakeCat_new_value)=>$expr = fakeCat_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$named$2f$input$2f$module$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$module__evaluation$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-named/input/module.js [test] (ecmascript) "); diff --git a/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_export-namespace_input_c0eca6._.js b/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_export-namespace_input_c0eca6._.js index 594727e08542f..19f9688109e65 100644 --- a/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_export-namespace_input_c0eca6._.js +++ b/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_export-namespace_input_c0eca6._.js @@ -6,7 +6,7 @@ __turbopack_esm__({ "dog": [ ()=>dog, - (v)=>dog = v + (dog_new_value)=>dog = dog_new_value ] }); let dog = "dog"; @@ -139,7 +139,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "cat": [ ()=>cat, - (v)=>cat = v + (cat_new_value)=>cat = cat_new_value ] }); let cat = "cat"; @@ -165,7 +165,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "getDog": [ ()=>getDog, - (v)=>getDog = v + (getDog_new_value)=>getDog = getDog_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__8$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/input/lib.js [test] (ecmascript) "); @@ -186,7 +186,7 @@ function getDog() { __turbopack_esm__({ "setDog": [ ()=>setDog, - (v)=>setDog = v + (setDog_new_value)=>setDog = setDog_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__4$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/input/lib.js [test] (ecmascript) "); @@ -205,7 +205,7 @@ function setDog(newDog) { __turbopack_esm__({ "dogRef": [ ()=>dogRef, - (v)=>dogRef = v + (dogRef_new_value)=>dogRef = dogRef_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__8$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/input/lib.js [test] (ecmascript) "); @@ -247,7 +247,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "getChimera": [ ()=>getChimera, - (v)=>getChimera = v + (getChimera_new_value)=>getChimera = getChimera_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__4$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/input/lib.js [test] (ecmascript) "); @@ -284,7 +284,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "initialCat": [ ()=>initialCat, - (v)=>initialCat = v + (initialCat_new_value)=>initialCat = initialCat_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__0$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/input/lib.js [test] (ecmascript) "); @@ -361,7 +361,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "lib": [ ()=>__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$module$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$export__lib$3e$__["lib"], - (v)=>$expr = v + (lib_new_value)=>$expr = lib_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$module$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$module__evaluation$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/input/module.js [test] (ecmascript) "); diff --git a/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named-all/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_import-named-all_input_71b07f._.js b/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named-all/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_import-named-all_input_71b07f._.js index e9109a2fa526e..e248c10921f67 100644 --- a/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named-all/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_import-named-all_input_71b07f._.js +++ b/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named-all/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_import-named-all_input_71b07f._.js @@ -6,7 +6,7 @@ __turbopack_esm__({ "dog": [ ()=>dog, - (v)=>dog = v + (dog_new_value)=>dog = dog_new_value ] }); let dog = "dog"; @@ -122,7 +122,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "cat": [ ()=>cat, - (v)=>cat = v + (cat_new_value)=>cat = cat_new_value ] }); let cat = "cat"; @@ -148,7 +148,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "c": [ ()=>__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$named$2d$all$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$export__cat$3e$__["cat"], - (v)=>$expr = v + (cat_new_value)=>$expr = cat_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$named$2d$all$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$module__evaluation$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named-all/input/lib.js [test] (ecmascript) "); diff --git a/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named/output/crates_turbopack-tests_tests_snapshot_basic-tree-shake_import-named_input_ed0d99._.js b/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named/output/crates_turbopack-tests_tests_snapshot_basic-tree-shake_import-named_input_ed0d99._.js index 20403fef71608..e4fa5f41d9e04 100644 --- a/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named/output/crates_turbopack-tests_tests_snapshot_basic-tree-shake_import-named_input_ed0d99._.js +++ b/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named/output/crates_turbopack-tests_tests_snapshot_basic-tree-shake_import-named_input_ed0d99._.js @@ -6,7 +6,7 @@ __turbopack_esm__({ "dog": [ ()=>dog, - (v)=>dog = v + (dog_new_value)=>dog = dog_new_value ] }); let dog = "dog"; @@ -122,7 +122,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "cat": [ ()=>cat, - (v)=>cat = v + (cat_new_value)=>cat = cat_new_value ] }); let cat = "cat"; @@ -148,7 +148,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "c": [ ()=>__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$named$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$export__cat$3e$__["cat"], - (v)=>$expr = v + (cat_new_value)=>$expr = cat_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$named$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$module__evaluation$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named/input/lib.js [test] (ecmascript) "); diff --git a/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_import-namespace_input_351ad1._.js b/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_import-namespace_input_351ad1._.js index 36d4578916199..0c9e388f95b4a 100644 --- a/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_import-namespace_input_351ad1._.js +++ b/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_import-namespace_input_351ad1._.js @@ -6,7 +6,7 @@ __turbopack_esm__({ "dog": [ ()=>dog, - (v)=>dog = v + (dog_new_value)=>dog = dog_new_value ] }); let dog = "dog"; @@ -122,7 +122,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "cat": [ ()=>cat, - (v)=>cat = v + (cat_new_value)=>cat = cat_new_value ] }); let cat = "cat"; @@ -148,7 +148,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "getDog": [ ()=>getDog, - (v)=>getDog = v + (getDog_new_value)=>getDog = getDog_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__8$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/input/lib.js [test] (ecmascript) "); @@ -169,7 +169,7 @@ function getDog() { __turbopack_esm__({ "setDog": [ ()=>setDog, - (v)=>setDog = v + (setDog_new_value)=>setDog = setDog_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__4$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/input/lib.js [test] (ecmascript) "); @@ -188,7 +188,7 @@ function setDog(newDog) { __turbopack_esm__({ "dogRef": [ ()=>dogRef, - (v)=>dogRef = v + (dogRef_new_value)=>dogRef = dogRef_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__8$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/input/lib.js [test] (ecmascript) "); @@ -230,7 +230,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "getChimera": [ ()=>getChimera, - (v)=>getChimera = v + (getChimera_new_value)=>getChimera = getChimera_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__4$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/input/lib.js [test] (ecmascript) "); @@ -267,7 +267,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "initialCat": [ ()=>initialCat, - (v)=>initialCat = v + (initialCat_new_value)=>initialCat = initialCat_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__0$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/input/lib.js [test] (ecmascript) "); diff --git a/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-side-effect/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_import-side-effect_input_cdc49f._.js b/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-side-effect/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_import-side-effect_input_cdc49f._.js index b7576d6613cb1..4520c00b83746 100644 --- a/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-side-effect/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_import-side-effect_input_cdc49f._.js +++ b/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-side-effect/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_import-side-effect_input_cdc49f._.js @@ -6,7 +6,7 @@ __turbopack_esm__({ "dog": [ ()=>dog, - (v)=>dog = v + (dog_new_value)=>dog = dog_new_value ] }); let dog = "dog"; diff --git a/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/output/a587c_tests_snapshot_basic-tree-shake_require-side-effect_input_6b5862._.js b/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/output/a587c_tests_snapshot_basic-tree-shake_require-side-effect_input_6b5862._.js index 0907b252734b2..4906936d78fff 100644 --- a/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/output/a587c_tests_snapshot_basic-tree-shake_require-side-effect_input_6b5862._.js +++ b/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/output/a587c_tests_snapshot_basic-tree-shake_require-side-effect_input_6b5862._.js @@ -6,7 +6,7 @@ __turbopack_esm__({ "dog": [ ()=>dog, - (v)=>dog = v + (dog_new_value)=>dog = dog_new_value ] }); let dog = "dog"; @@ -114,7 +114,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "cat": [ ()=>cat, - (v)=>cat = v + (cat_new_value)=>cat = cat_new_value ] }); let cat = "cat"; @@ -140,7 +140,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "getDog": [ ()=>getDog, - (v)=>getDog = v + (getDog_new_value)=>getDog = getDog_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__8$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js [test] (ecmascript) "); @@ -161,7 +161,7 @@ function getDog() { __turbopack_esm__({ "setDog": [ ()=>setDog, - (v)=>setDog = v + (setDog_new_value)=>setDog = setDog_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__4$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js [test] (ecmascript) "); @@ -180,7 +180,7 @@ function setDog(newDog) { __turbopack_esm__({ "dogRef": [ ()=>dogRef, - (v)=>dogRef = v + (dogRef_new_value)=>dogRef = dogRef_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__8$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js [test] (ecmascript) "); @@ -222,7 +222,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "getChimera": [ ()=>getChimera, - (v)=>getChimera = v + (getChimera_new_value)=>getChimera = getChimera_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__4$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js [test] (ecmascript) "); @@ -259,7 +259,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "initialCat": [ ()=>initialCat, - (v)=>initialCat = v + (initialCat_new_value)=>initialCat = initialCat_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__0$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js [test] (ecmascript) "); diff --git a/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/output/a587c_tests_snapshot_basic-tree-shake_tree-shake-test-1_input_index_87c735.js b/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/output/a587c_tests_snapshot_basic-tree-shake_tree-shake-test-1_input_index_87c735.js index 9744f84fd5537..321980f900c42 100644 --- a/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/output/a587c_tests_snapshot_basic-tree-shake_tree-shake-test-1_input_index_87c735.js +++ b/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/output/a587c_tests_snapshot_basic-tree-shake_tree-shake-test-1_input_index_87c735.js @@ -6,7 +6,7 @@ __turbopack_esm__({ "dog": [ ()=>dog, - (v)=>dog = v + (dog_new_value)=>dog = dog_new_value ] }); let dog = "dog"; @@ -114,7 +114,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "cat": [ ()=>cat, - (v)=>cat = v + (cat_new_value)=>cat = cat_new_value ] }); let cat = "cat"; @@ -140,7 +140,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "getDog": [ ()=>getDog, - (v)=>getDog = v + (getDog_new_value)=>getDog = getDog_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__8$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/input/index.js [test] (ecmascript) "); @@ -161,7 +161,7 @@ function getDog() { __turbopack_esm__({ "setDog": [ ()=>setDog, - (v)=>setDog = v + (setDog_new_value)=>setDog = setDog_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__4$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/input/index.js [test] (ecmascript) "); @@ -180,7 +180,7 @@ function setDog(newDog) { __turbopack_esm__({ "dogRef": [ ()=>dogRef, - (v)=>dogRef = v + (dogRef_new_value)=>dogRef = dogRef_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__8$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/input/index.js [test] (ecmascript) "); @@ -222,7 +222,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "getChimera": [ ()=>getChimera, - (v)=>getChimera = v + (getChimera_new_value)=>getChimera = getChimera_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__4$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/input/index.js [test] (ecmascript) "); @@ -259,7 +259,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests __turbopack_esm__({ "initialCat": [ ()=>initialCat, - (v)=>initialCat = v + (initialCat_new_value)=>initialCat = initialCat_new_value ] }); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__0$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/input/index.js [test] (ecmascript) ");