feat: support opt-in topLevelVar#5188
Merged
IWANABETHATGUY merged 4 commits intorolldown:mainfrom Jul 7, 2025
Merged
Conversation
packages/rolldown/tests/fixtures/function/top-level-var/_config.ts
Outdated
Show resolved
Hide resolved
packages/rolldown/tests/fixtures/function/top-level-var/_config.ts
Outdated
Show resolved
Hide resolved
Contributor
Author
|
It appears that I forgot to handle the blocked (but not in function or other scopes) sections. |
Member
You could refer to this method to check if current block is in the top level scope rolldown/crates/rolldown/src/ast_scanner/mod.rs Lines 227 to 232 in c142a18 |
Contributor
Author
It seems that esbuild doesn't handle blocked declarations due to scope differences, so there may be no need to hold the scenario I demonstrated above. |
IWANABETHATGUY
approved these changes
Jul 7, 2025
IWANABETHATGUY
pushed a commit
that referenced
this pull request
Jul 10, 2025
## [1.0.0-beta.25] - 2025-07-10 ### 🚀 Features - hmr: should initialize cjs with correct initializer (#5234) by @hyf0 - hmr: handle `import(..)` on cjs modules (#5225) by @hyf0 - support `chunkModulesOrder` (#5227) by @IWANABETHATGUY - add `export`s to `rolldown:runtime` (#5224) by @hyf0 - hmr: support `import(..)` (#5223) by @hyf0 - add analyzed source code side effects field in ecmaMeta (#5226) by @IWANABETHATGUY - hmr: return `undefined` from `generateHmrPatch` when there is no patch (#5218) by @sapphi-red - pass `isEntry` to resolveId hook of CallableBuiltinPlugin (#5215) by @sapphi-red - pass `isEntry` from `this.resolve` (#5214) by @sapphi-red - node: support `OutputOptions#minifyInternalExports` (#5210) by @hyf0 - rolldown: oxc v0.76.0 (#5212) by @Boshen - rust: support `minify_internal_exports` (#5208) by @hyf0 - support opt-in `topLevelVar` (#5188) by @7086cmd - rolldown: oxc-resolver v11.5.0 (yarn pnp) (#5147) by @Boshen ### 🐛 Bug Fixes - do not optimize interop code for `mod.default` if mod bind from default import (#5232) by @IWANABETHATGUY - return `moduleSideEffects` instead of `sideEffects` from callable plugins (#5206) by @sapphi-red - return `moduleSideEffects` set by native plugins from `this.resolve` (#5205) by @sapphi-red - incorrect output when importing CJS package (#5201) by @IWANABETHATGUY - use resolved id instead of module_request when analysis if a module is a json module (#5200) by @IWANABETHATGUY ### 🚜 Refactor - use `sort_unstable_by_key` for simple property access (#5233) by @IWANABETHATGUY - add Deref impl for TransformPluginContext to access PluginContext (#5221) by @sapphi-red - use `BindingHookSideEffects` in CallableBuiltinPlugin (#5204) by @sapphi-red - move side effects type bindings logic to rust side (#5203) by @sapphi-red - test: improve experience of writing manual integration test (#5186) by @hyf0 - rust: unify logic of `IntegrationTest` (#5185) by @hyf0 ### 🧪 Testing - rust: automatically run extented test for `minify_internal_exports: true` (#5213) by @hyf0 - rust: add basic tests for minifying internal exports (#5211) by @hyf0 ### ⚙️ Miscellaneous Tasks - deps: oxc-browserslist v2.0.10 and oxc-resolver v11.5.2 (#5222) by @Boshen - use jsonc schema for knip config (#5207) by @sapphi-red - rust: remove unused code related to `safe_cjs_to_eliminate_interop_default` (#5202) by @shulaoda - inject test variant name to rust unit test script (#5195) by @IWANABETHATGUY - change CC => TARGET_CC (#5194) by @Brooooooklyn - deps: lock file maintenance npm packages (#5191) by @renovate[bot] - deps: lock file maintenance (#5193) by @renovate[bot] - deps: lock file maintenance rust crates (#5192) by @renovate[bot] - deps: update github-actions (#5190) by @renovate[bot] - test: remove unnecessary test snapshots (#5183) by @shulaoda - rolldown: upgrade to NAPI-RS 3.0.0-beta.12 (#5184) by @Brooooooklyn Co-authored-by: shulaoda <[email protected]>
sapphi-red
added a commit
that referenced
this pull request
Aug 19, 2025
This is allowed by the types, but was not allowed by the validator. refs #5188
sapphi-red
added a commit
that referenced
this pull request
Aug 19, 2025
This is allowed by the types, but was not allowed by the validator. refs #5188
github-merge-queue bot
pushed a commit
that referenced
this pull request
Aug 19, 2025
This is allowed by the types, but was not allowed by the validator. refs #5188
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.
resolves #5116
I'm unsure if my implementation and the result are correct. Please check if the behavior output in the test is accurate.