[turbopack] Create a chunk_group_bootstrap_params() function#94631
Open
sampoder wants to merge 1 commit into
Open
[turbopack] Create a chunk_group_bootstrap_params() function#94631sampoder wants to merge 1 commit into
chunk_group_bootstrap_params() function#94631sampoder wants to merge 1 commit into
Conversation
Contributor
Stats cancelledCommit: da06b98 |
Contributor
Tests PassedCommit: da06b98 |
registration_code() function
registration_code() functionregistration_code() method
58512bf to
0ce9422
Compare
registration_code() methodchunk_group_bootstrap_code() function
0ce9422 to
da06b98
Compare
chunk_group_bootstrap_code() functionchunk_group_bootstrap_params() function
bgw
approved these changes
Jun 11, 2026
Comment on lines
+153
to
+169
| let statement = formatdoc! { | ||
| r#" | ||
| (globalThis[{chunk_loading_global}] || (globalThis[{chunk_loading_global}] = [])).push([ | ||
| {script_or_path}, | ||
| {params} | ||
| ]); | ||
| "#, | ||
| chunk_loading_global = StringifyJs(&chunk_loading_global), | ||
| params = StringifyJs(¶ms), | ||
| )?; | ||
| script_or_path = script_or_path, | ||
| params = &**params, | ||
| }; | ||
|
|
||
| let mut code = CodeBuilder::new( | ||
| source_maps, | ||
| *this.chunking_context.debug_ids_enabled().await?, | ||
| ); | ||
| write!(code, "{}", statement)?; |
Member
There was a problem hiding this comment.
Not sure why this got changed from writedoc! to formatdoc!+write!?
Suggested change
| let statement = formatdoc! { | |
| r#" | |
| (globalThis[{chunk_loading_global}] || (globalThis[{chunk_loading_global}] = [])).push([ | |
| {script_or_path}, | |
| {params} | |
| ]); | |
| "#, | |
| chunk_loading_global = StringifyJs(&chunk_loading_global), | |
| params = StringifyJs(¶ms), | |
| )?; | |
| script_or_path = script_or_path, | |
| params = &**params, | |
| }; | |
| let mut code = CodeBuilder::new( | |
| source_maps, | |
| *this.chunking_context.debug_ids_enabled().await?, | |
| ); | |
| write!(code, "{}", statement)?; | |
| let mut code = CodeBuilder::new( | |
| source_maps, | |
| *this.chunking_context.debug_ids_enabled().await?, | |
| ); | |
| writedoc! { | |
| code, | |
| r#" | |
| (globalThis[{chunk_loading_global}] || (globalThis[{chunk_loading_global}] = [])).push([ | |
| {script_or_path}, | |
| {params} | |
| ]); | |
| "#, | |
| chunk_loading_global = StringifyJs(&chunk_loading_global), | |
| script_or_path = script_or_path, | |
| params = &**params, | |
| }?; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This method generates the params for this code (random example for reference):
This is a pretty small change on its own (no functionality change), it makes it a separate method so that it can be called in future PRs. I will flag that the shape for inline-d bootstrap code will be slightly different (further up the stack). Because it isn't a chunk itself it does not have the first item in the array (
output/1ece_tests_snapshot_basic-tree-shake_export-namespace_input_index_0tbr8qy.js):This item only has
otherChunksandruntimeModuleIds. New code is added in #94664 to handle this different shape.