fix!: align directive rendering with esbuild#4557
Merged
IWANABETHATGUY merged 2 commits intomainfrom May 15, 2025
Merged
Conversation
✅ Deploy Preview for rolldown-rs canceled.
|
29a65c5 to
0a493da
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR aligns the direct rendering behavior with esbuild by removing the redundant insertion and tracking of the "use strict" directive.
- Removed "use strict" from test snapshots and source outputs in various module formats (UMD, IIFE, CJS, etc.).
- Eliminated internal flags and functions related to handling the "use strict" directive to simplify the code generation process.
- Updated related test snapshots to reflect these changes and maintain consistency with esbuild’s behavior.
Reviewed Changes
Copilot reviewed 191 out of 191 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/rolldown/tests/esbuild/default/import_namespace_this_value/artifacts.snap | Removed unnecessary "use strict" directive from the snapshot. |
| crates/rolldown/tests/esbuild/default/import_fs_node_common_js/bypass.md | Removed "use strict" directive from the inline code sample. |
| crates/rolldown/tests/esbuild/default/import_fs_node_common_js/artifacts.snap | Removed "use strict" directive from the snapshot. |
| crates/rolldown/tests/esbuild/default/hashbang_banner_use_strict_order/bypass.md | Adjusted the placement and format of the "use strict" directive in the banner section. |
| crates/rolldown/tests/esbuild/default/hashbang_banner_use_strict_order/artifacts.snap | Updated snapshot to reflect the new banner order with "use strict". |
| crates/rolldown/tests/esbuild/default/export_wildcard_fs_node_common_js/bypass.md | Removed "use strict" from the inline JavaScript. |
| crates/rolldown/tests/esbuild/default/export_wildcard_fs_node_common_js/artifacts.snap | Removed "use strict" from the snapshot. |
| crates/rolldown/tests/esbuild/default/export_forms_iife/bypass.md | Removed the "use strict" directive from the IIFE wrapper. |
| crates/rolldown/tests/esbuild/default/export_forms_iife/artifacts.snap | Removed "use strict" from the snapshot. |
| crates/rolldown/tests/esbuild/dce/preserve_directives_minify_bundle/bypass.md | Removed "use strict" directive from the code sample. |
| crates/rolldown/tests/esbuild/dce/preserve_directives_minify_bundle/artifacts.snap | Removed "use strict" from the snapshot. |
| crates/rolldown/src/utils/tweak_ast_for_scanning.rs | Removed internal tracking for "use strict" in the preprocessor. |
| crates/rolldown/src/utils/pre_process_ecma_ast.rs | Removed the assignment of the "contains_use_strict" flag. |
| crates/rolldown/src/module_loader/runtime_module_task.rs | Removed updating of the "contains_use_strict" flag on the AST. |
| crates/rolldown/src/ecmascript/format/umd.rs | Removed insertion of "use strict" during UMD generation. |
| crates/rolldown/src/ecmascript/format/iife.rs | Removed insertion of "use strict" during IIFE generation. |
| crates/rolldown/src/ecmascript/format/esm.rs | Filtered out the "use strict" directive from rendered directives. |
| crates/rolldown/src/ecmascript/format/cjs.rs | Removed the logic to conditionally append "use strict" during CJS rendering. |
| crates/rolldown/src/types/generator.rs | Removed the unused method that referenced "use strict". |
crates/rolldown/tests/esbuild/default/hashbang_banner_use_strict_order/bypass.md
Outdated
Show resolved
Hide resolved
6a7a2fb to
9b202bd
Compare
Contributor
Benchmarks Rust |
55287da to
c7c48ff
Compare
hyf0
approved these changes
May 15, 2025
c7c48ff to
bf0d574
Compare
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.

Description