Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0eb231e

Browse files
committed
drop g from the set of arguments destructured from the __turbopack_context__
This goes back to the earliest version of the runtime and appears to be unnecessary
1 parent 99eaa0d commit 0eb231e

File tree

162 files changed

+236
-446
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+236
-446
lines changed

turbopack/crates/turbopack-ecmascript/src/chunk/item.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl EcmascriptChunkItemContent {
8787

8888
#[turbo_tasks::function]
8989
pub async fn module_factory(&self) -> Result<Vc<Code>> {
90-
let mut args = vec!["g: global"];
90+
let mut args = Vec::new();
9191
if self.options.async_module.is_some() {
9292
args.push("a: __turbopack_async_module__");
9393
}
@@ -105,7 +105,6 @@ impl EcmascriptChunkItemContent {
105105
args.push("u: __turbopack_wasm_module__");
106106
}
107107
let mut code = CodeBuilder::default();
108-
let args = FormatIter(|| args.iter().copied().intersperse(", "));
109108
if self.options.this {
110109
code += "(function(__turbopack_context__) {\n";
111110
} else {
@@ -116,7 +115,10 @@ impl EcmascriptChunkItemContent {
116115
} else {
117116
code += "\n";
118117
}
119-
writeln!(code, "var {{ {} }} = __turbopack_context__;", args)?;
118+
if !args.is_empty() {
119+
let args = FormatIter(|| args.iter().copied().intersperse(", "));
120+
writeln!(code, "var {{ {} }} = __turbopack_context__;", args)?;
121+
}
120122

121123
if self.options.async_module.is_some() {
122124
code += "__turbopack_async_module__(async (__turbopack_handle_async_dependencies__, \

turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/output/4c35f_tests_snapshot_basic-tree-shake_dynamic-import_input_index_92a5f455.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/output/4c35f_tests_snapshot_basic-tree-shake_dynamic-import_input_lib_b2d8c81e.js

-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/output/4c35f_tests_snapshot_basic-tree-shake_dynamic-import_input_lib_b2d8c81e.js.map

+11-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/output/4c35f_tests_snapshot_basic-tree-shake_dynamic-import_input_lib_f6ff4167.js

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/input/lib.js [test] (ecmascript, async loader)": ((__turbopack_context__) => {
44

5-
var { g: global } = __turbopack_context__;
65
{
76
__turbopack_context__.v((parentImport) => {
87
return Promise.all([

0 commit comments

Comments
 (0)