refactor(rust): remove inline_dynamic_imports, introduce code_splitting instead#7871
Conversation
How to use the Graphite Merge QueueAdd the label graphite: merge-when-ready to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Pull request overview
This PR refactors the codebase to replace the boolean inlineDynamicImports option with a new codeSplitting enum option that accepts 'auto' (default) or 'none' values. This provides a more extensible API design for future code splitting modes while maintaining backward compatibility through a deprecated inlineDynamicImports option.
Changes:
- Introduced
CodeSplittingModeenum withAutoandNonevariants - Replaced
inline_dynamic_imports: boolwithcode_splitting: CodeSplittingModethroughout the Rust codebase - Added TypeScript backward compatibility layer that maps deprecated
inlineDynamicImportsto newcodeSplittingoption - Updated error messages to reference the new
codeSplittingoption while keeping old variant names for compatibility
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
crates/rolldown_common/src/inner_bundler_options/types/code_splitting_mode.rs |
New enum definition for CodeSplittingMode with Auto and None variants |
crates/rolldown_common/src/lib.rs |
Exports the new CodeSplittingMode type |
crates/rolldown_common/src/inner_bundler_options/types/mod.rs |
Adds module for code_splitting_mode |
crates/rolldown_common/src/inner_bundler_options/types/normalized_bundler_options.rs |
Replaces inline_dynamic_imports: bool with code_splitting: CodeSplittingMode |
crates/rolldown_common/src/inner_bundler_options/mod.rs |
Updates BundlerOptions to use code_splitting field |
crates/rolldown_binding/src/types/binding_normalized_options.rs |
Changes getter to return string representation of code_splitting |
crates/rolldown_binding/src/utils/normalize_binding_options.rs |
Maps inline_dynamic_imports option to code_splitting mode |
crates/rolldown/src/utils/prepare_build_context.rs |
Updates option validation and normalization logic |
crates/rolldown/src/stages/link_stage/tree_shaking/include_statements.rs |
Changes condition from inline_dynamic_imports to code_splitting.is_none() |
crates/rolldown/src/stages/link_stage/sort_modules.rs |
Changes condition from inline_dynamic_imports to code_splitting.is_none() |
crates/rolldown/src/stages/link_stage/reference_needed_symbols.rs |
Changes condition from inline_dynamic_imports to code_splitting.is_none() |
crates/rolldown/src/stages/link_stage/determine_module_exports_kind.rs |
Changes condition from inline_dynamic_imports to code_splitting.is_none() |
crates/rolldown/src/stages/generate_stage/on_demand_wrapping.rs |
Updates comment to reference code_splitting |
crates/rolldown/src/module_finalizers/mod.rs |
Changes condition from inline_dynamic_imports to code_splitting.is_none() |
crates/rolldown_plugin_vite_reporter/src/lib.rs |
Changes condition from inline_dynamic_imports to code_splitting.is_none() |
crates/rolldown_error/src/build_diagnostic/events/invalid_option.rs |
Adds new error variants for CodeSplittingNone* options |
crates/rolldown_testing_config/src/config_variant.rs |
Maps deprecated inline_dynamic_imports config to new code_splitting |
crates/rolldown_testing/_config.schema.json |
Updates schema to use CodeSplittingMode type |
packages/rolldown/src/binding.d.cts |
Updates binding type from boolean to string |
packages/rolldown/src/options/normalized-output-options.ts |
Adds codeSplitting field and deprecates inlineDynamicImports |
Comments suppressed due to low confidence (2)
crates/rolldown_error/src/build_diagnostic/events/invalid_option.rs:40
- This error message still references the deprecated
output.inlineDynamicImportsoption. Update it to recommendoutput.codeSplitting: 'none'instead for consistency with the new API.
format!("Invalid value \"{format}\" for option \"output.format\" - UMD and IIFE are not supported for code-splitting builds. You may set `output.inlineDynamicImports` to `true` when using dynamic imports.")
crates/rolldown_error/src/build_diagnostic/events/invalid_option.rs:45
- This error message still references the deprecated
output.inlineDynamicImportsoption. Update it to recommendoutput.codeSplitting: 'none'instead for consistency with the new API.
InvalidOptionType::InvalidOutputFile => "Invalid value for option \"output.file\" - When building multiple chunks, the \"output.dir\" option must be used, not \"output.file\". You may set `output.inlineDynamicImports` to `true` when using dynamic imports.".to_string(),
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
crates/rolldown_common/src/inner_bundler_options/types/code_splitting_mode.rs
Show resolved
Hide resolved
Benchmarks Rust
|
a051552 to
abf4654
Compare
07bc8bf to
5e07689
Compare
5e07689 to
93fcada
Compare
abf4654 to
fa37dc5
Compare
93fcada to
280586c
Compare
fa37dc5 to
e3433f3
Compare
crates/rolldown/src/stages/generate_stage/on_demand_wrapping.rs
Outdated
Show resolved
Hide resolved
280586c to
5e8d52b
Compare
e3433f3 to
9c26984
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 37 out of 37 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
crates/rolldown_error/src/build_diagnostic/events/invalid_option.rs:6
- The
UnsupportedInlineDynamicFormaterror variant is no longer used in the codebase (replaced byUnsupportedCodeSplittingFormat), but is still defined. Since the PR introduces new error variants (CodeSplittingNoneWithMultipleInputs, etc.) that handle the new cases, this old variant should be removed to avoid confusion and maintain consistency with the refactoring goal.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
crates/rolldown_error/src/build_diagnostic/events/invalid_option.rs
Outdated
Show resolved
Hide resolved
crates/rolldown/tests/rolldown/errors/invalid_option/invalid-output-file/artifacts.snap
Show resolved
Hide resolved
...down/tests/rolldown/warnings/invalid_option/unsupported_inline_dynamic_format/artifacts.snap
Outdated
Show resolved
Hide resolved
5e8d52b to
f929d88
Compare
9c26984 to
554d323
Compare
Merge activity
|
sapphi-red
left a comment
There was a problem hiding this comment.
LGTM after the CI is fixed
…on.rs Co-authored-by: 翠 <[email protected]> Signed-off-by: Yunfei He <[email protected]>
dc32466 to
7d15a92
Compare
|
Watch tests is killing me. |
0931062
into
01-13-feat_add_codesplitting_auto_none_and_deprecate_inlinedynamicimports_
…tting` instead (#7871) Signed-off-by: Yunfei He <[email protected]> Co-authored-by: 翠 <[email protected]>

No description provided.