fix(cli): honor externalHelpers=false in rust binary#11693
Conversation
🦋 Changeset detectedLatest commit: aa93151 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub. |
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
Fixes the Rust swc CLI binary so that jsc.externalHelpers: false is honored by enabling inline helper emission, aligning behavior with @swc/cli / @swc/core and preventing unwanted @swc/helpers requires.
Changes:
- Enable inline ECMA helpers in the Rust CLI build by adding the
swc_core/ecma_helpers_inlinefeature. - Add a regression test covering issue #11643, asserting no
@swc/helpersreference and presence of an inline_export_starhelper.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/swc_cli_impl/Cargo.toml | Enables inline helper support in the CLI build via ecma_helpers_inline. |
| crates/swc_cli_impl/tests/issues.rs | Adds a regression test ensuring externalHelpers: false no longer emits @swc/helpers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| "Expected inline _export_star helper when externalHelpers is false. Got: {output}", | ||
| ); | ||
| assert!( | ||
| output.contains("_export_star(require(\"./my-file\"), exports);"), |
Binary Sizes
Commit: f8b1bee |
PR Review: fix(cli): honor externalHelpers=false in rust binarySummaryClean, minimal fix. The root cause is that Code QualityLooks good. The fix is a single feature flag addition in The test is well-structured and follows the existing patterns in
The three assertions cover the important invariants:
Minor Observations
VerdictLGTM. Minimal, correct fix with good regression test coverage. The changeset is properly included. |
Summary
swc_core/ecma_helpers_inlinetoswc_cli_impl.jsc.externalHelpers: falsewas ignored and@swc/helperswas still emitted.externalHelpersbroken in published rust binary #11643.Changes
crates/swc_cli_impl/Cargo.tomlecma_helpers_inlineto theswc_corefeature list.crates/swc_cli_impl/tests/issues.rsissue_11643_external_helpers_false_respected.@swc/helpers._export_starhelper is emitted.Verification
git submodule update --init --recursivecargo test -p swc_cli_impl issue_11643cargo test -p swc_cli_implcargo fmt --allcargo clippy --all --all-targets -- -D warningsCloses #11643