Skip to content

Comments

refactor: simplify module_namespace construction#5939

Merged
graphite-app[bot] merged 1 commit intomainfrom
08-27-refactor_simplify_module_namespace_construction
Sep 10, 2025
Merged

refactor: simplify module_namespace construction#5939
graphite-app[bot] merged 1 commit intomainfrom
08-27-refactor_simplify_module_namespace_construction

Conversation

@IWANABETHATGUY
Copy link
Member

@IWANABETHATGUY IWANABETHATGUY commented Aug 27, 2025

related to #5923

Now use the suggestion from @sapphi-red #5926 (comment) to construct module_namespace.

note: It is safe to merge module_namespace declaration and the __export statement, since we always append __export statement before __reexport statements https://github.com/rolldown/rolldown/pull/5939/files#diff-869ccc2e55fee0609d8452d49a68b9df851a71c9f34bdd0324cbd5dfdfe8d1bfL458-L459

@IWANABETHATGUY IWANABETHATGUY marked this pull request as ready for review August 27, 2025 11:08
Copy link
Member Author

IWANABETHATGUY commented Aug 27, 2025


How to use the Graphite Merge Queue

Add the label graphite: merge 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.

@netlify
Copy link

netlify bot commented Aug 27, 2025

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit 7866a60
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/68c1074e3cf18900084b961a

@IWANABETHATGUY IWANABETHATGUY force-pushed the 08-27-refactor_simplify_module_namespace_construction branch from 598dcab to 8d3a951 Compare August 27, 2025 11:10
@IWANABETHATGUY IWANABETHATGUY requested review from hyf0, sapphi-red and shulaoda and removed request for hyf0 August 27, 2025 11:11
@IWANABETHATGUY IWANABETHATGUY marked this pull request as draft August 27, 2025 11:21
@github-actions
Copy link
Contributor

github-actions bot commented Aug 27, 2025

Benchmarks Rust

  • target: main(cf4ad6a)
  • pr: 08-27-refactor_simplify_module_namespace_construction(7866a60)
group                                                        pr                                     target
-----                                                        --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol              1.00     87.7±4.21ms        ? ?/sec    1.07     93.7±2.65ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap    1.02    101.0±4.15ms        ? ?/sec    1.00     98.7±2.79ms        ? ?/sec
bundle/bundle@rome_ts                                        1.00    125.5±2.44ms        ? ?/sec    1.03    128.7±3.60ms        ? ?/sec
bundle/bundle@rome_ts-sourcemap                              1.00    147.6±3.90ms        ? ?/sec    1.02    150.7±3.12ms        ? ?/sec
bundle/bundle@threejs                                        1.04     49.2±3.58ms        ? ?/sec    1.00     47.3±1.98ms        ? ?/sec
bundle/bundle@threejs-sourcemap                              1.02     57.0±1.72ms        ? ?/sec    1.00     56.1±1.41ms        ? ?/sec
bundle/bundle@threejs10x                                     1.02   501.2±10.88ms        ? ?/sec    1.00   490.7±10.34ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                           1.01   590.3±12.08ms        ? ?/sec    1.00   581.7±12.85ms        ? ?/sec
scan/scan@rome_ts                                            1.00    100.5±2.59ms        ? ?/sec    1.02    102.6±1.86ms        ? ?/sec
scan/scan@threejs                                            1.00     35.0±0.50ms        ? ?/sec    1.04     36.4±0.97ms        ? ?/sec
scan/scan@threejs10x                                         1.01    371.3±8.06ms        ? ?/sec    1.00    368.6±4.77ms        ? ?/sec

@IWANABETHATGUY
Copy link
Member Author

It seems rolldown-dts-plugin relies on the current module_namespace generation pattern, rolldown-vite dts generation failed after this pr

@IWANABETHATGUY
Copy link
Member Author

IWANABETHATGUY commented Aug 27, 2025

cc @sxzz https://github.com/sxzz/rolldown-plugin-dts/blob/main/src/fake-js.ts#L590, It seems current rolldown-dts-plugin rely on the current pattern var module_ns = {}; __export(module_ns, {...}), would you like to support new pattern, so that we can merge this pr?

@graphite-app
Copy link
Contributor

graphite-app bot commented Aug 29, 2025

Merge activity

  • Aug 29, 2:49 PM UTC: This pull request can not be added to the Graphite merge queue. Please try rebasing and resubmitting to merge when ready.
  • Aug 29, 2:49 PM UTC: Graphite disabled "merge when ready" on this PR due to: a merge conflict with the target branch; resolve the conflict and try again..
  • Sep 10, 5:05 AM UTC: IWANABETHATGUY added this pull request to the Graphite merge queue.
  • Sep 10, 5:14 AM UTC: Merged by the Graphite merge queue.

@sxzz
Copy link
Member

sxzz commented Aug 29, 2025

@IWANABETHATGUY Yes, but unfortunately, there is currently no way to increase the minimum required Rolldown version via package.json, as we are still in the pre-release stage.

@IWANABETHATGUY
Copy link
Member Author

@IWANABETHATGUY Yes, but unfortunately, there is currently no way to increase the minimum required Rolldown version via package.json, as we are still in the pre-release stage.

Could we support two patterns at the same time? and make the two patterns coexist for a short term, after rolldown is stable, then we drop the old __export pattern recognition.

@sxzz
Copy link
Member

sxzz commented Aug 29, 2025

Sure, once pkg.pr.new is ready, I will work on making it compatible and then release Rolldown.

@IWANABETHATGUY
Copy link
Member Author

Sure, once pkg.pr.new is ready, I will work on making it compatible and then release Rolldown.

Thanks

@pkg-pr-new
Copy link

pkg-pr-new bot commented Sep 4, 2025

Open in StackBlitz

@rolldown/browser

npm i https://pkg.pr.new/@rolldown/browser@5939

@rolldown/debug

npm i https://pkg.pr.new/@rolldown/debug@5939

@rolldown/pluginutils

npm i https://pkg.pr.new/@rolldown/pluginutils@5939

rolldown

npm i https://pkg.pr.new/rolldown@5939

@rolldown/binding-android-arm64

npm i https://pkg.pr.new/@rolldown/binding-android-arm64@5939

@rolldown/binding-darwin-arm64

npm i https://pkg.pr.new/@rolldown/binding-darwin-arm64@5939

@rolldown/binding-darwin-x64

npm i https://pkg.pr.new/@rolldown/binding-darwin-x64@5939

@rolldown/binding-freebsd-x64

npm i https://pkg.pr.new/@rolldown/binding-freebsd-x64@5939

@rolldown/binding-linux-arm-gnueabihf

npm i https://pkg.pr.new/@rolldown/binding-linux-arm-gnueabihf@5939

@rolldown/binding-linux-arm64-gnu

npm i https://pkg.pr.new/@rolldown/binding-linux-arm64-gnu@5939

@rolldown/binding-linux-arm64-musl

npm i https://pkg.pr.new/@rolldown/binding-linux-arm64-musl@5939

@rolldown/binding-linux-x64-gnu

npm i https://pkg.pr.new/@rolldown/binding-linux-x64-gnu@5939

@rolldown/binding-linux-x64-musl

npm i https://pkg.pr.new/@rolldown/binding-linux-x64-musl@5939

@rolldown/binding-openharmony-arm64

npm i https://pkg.pr.new/@rolldown/binding-openharmony-arm64@5939

@rolldown/binding-wasm32-wasi

npm i https://pkg.pr.new/@rolldown/binding-wasm32-wasi@5939

@rolldown/binding-win32-arm64-msvc

npm i https://pkg.pr.new/@rolldown/binding-win32-arm64-msvc@5939

@rolldown/binding-win32-ia32-msvc

npm i https://pkg.pr.new/@rolldown/binding-win32-ia32-msvc@5939

@rolldown/binding-win32-x64-msvc

npm i https://pkg.pr.new/@rolldown/binding-win32-x64-msvc@5939

commit: 8d3a951

@IWANABETHATGUY IWANABETHATGUY force-pushed the 08-27-refactor_simplify_module_namespace_construction branch 3 times, most recently from c09eff0 to 8fabb26 Compare September 10, 2025 04:57
@IWANABETHATGUY IWANABETHATGUY marked this pull request as ready for review September 10, 2025 05:05
related to #5923

Now use the suggestion from @sapphi-red #5926 (comment) to construct module_namespace.

note: It is safe to merge `module_namespace` declaration and the `__export` statement, since we always append `__export` statement before `__reexport` statements https://github.com/rolldown/rolldown/pull/5939/files#diff-869ccc2e55fee0609d8452d49a68b9df851a71c9f34bdd0324cbd5dfdfe8d1bfL458-L459
@graphite-app graphite-app bot force-pushed the 08-27-refactor_simplify_module_namespace_construction branch from 8fabb26 to 7866a60 Compare September 10, 2025 05:06
@graphite-app graphite-app bot merged commit 7866a60 into main Sep 10, 2025
25 checks passed
@graphite-app graphite-app bot deleted the 08-27-refactor_simplify_module_namespace_construction branch September 10, 2025 05:14
@IWANABETHATGUY IWANABETHATGUY restored the 08-27-refactor_simplify_module_namespace_construction branch September 10, 2025 06:22
IWANABETHATGUY added a commit that referenced this pull request Sep 10, 2025
IWANABETHATGUY added a commit that referenced this pull request Sep 10, 2025
…" (#6117)

This reverts commit 7866a60.
Since the `rolldown-plugin-dts` relys on the pattern to generate `d.ts`

```js
const module_ns = {}
__export({}, {...})
```

See log
https://github.com/rolldown/rolldown/actions/runs/17603918809/job/50010934316
IWANABETHATGUY added a commit that referenced this pull request Sep 10, 2025
IWANABETHATGUY added a commit that referenced this pull request Sep 10, 2025
IWANABETHATGUY added a commit that referenced this pull request Sep 10, 2025
Boshen added a commit that referenced this pull request Sep 10, 2025
## [1.0.0-beta.37] - 2025-09-10

### 🚀 Features

- partial align with const inline strategy with oxc in smart mode
(#6126) by @IWANABETHATGUY
- dev: use PathsMut for non-debounced RecommendedWatcher (#6120) by
@sapphi-red
- dev: return whether the build is already scheduled from
`scheduleBuildIfStale` method (#6116) by @sapphi-red
- handle errors from `BundlerBuilder#build` (#6104) by @shulaoda
- add debounceTickRate option for debounced watchers (#6113) by @hyf0
- support full build in `incrementalBuild` mode (#6098) by
@IWANABETHATGUY
- add compare_contents_for_polling option to dev watcher (#6108) by
@hyf0
- dev: add `scheduleBuildIfStale` method to DevEngine (#6087) by
@sapphi-red
- dev: return changed files in onHmrUpdates callback (#6086) by
@sapphi-red
- support function config with custom CLI arguments (#6076) by
@IWANABETHATGUY
- improve `MISSING_EXPORT` warning to suggest `type` modifier (#6085) by
@sapphi-red
- crates/rolldown_watcher: introduce `PathsMut` to batch watch/unwatch
behaviors (#6075) by @hyf0
- enable `treeshake.commonjs` by default (#6072) by @IWANABETHATGUY
- dev: add debounce control and PollWatcher support to DevWatchOptions
(#6070) by @hyf0

### 🐛 Bug Fixes

- use kqueue for file watch on mac (#6124) by @sapphi-red
- use patched notify for better file change event debouncing (#6125) by
@sapphi-red
- support passing all js primitive value for `alias` plugin (#6123) by
@IWANABETHATGUY
- track spans in member expression properties for accurate sourcemaps
(#6100) by @IWANABETHATGUY
- correctly handle inlined CommonJS exports in member expressions
(#6090) by @IWANABETHATGUY
- dev: ensure patch file names to be unique (#6096) by @sapphi-red
- dev: normalize slash on Windows before comparing paths (#6095) by
@sapphi-red
- dev/watch: debounce duration should default to 10 (#6078) by @hyf0

### 🚜 Refactor

- simplify `__export` runtime helper to create target object internally
(#6114) by @IWANABETHATGUY
- simplify module_namespace construction second try (#6118) by
@IWANABETHATGUY
- simplify module_namespace construction (#5939) by @IWANABETHATGUY
- optimize member expression creation in AstSnippet (#6091) by
@IWANABETHATGUY
- test-dev-server: sensible watcher configuration for CI env (#6077) by
@hyf0

### 🧪 Testing

- dev: apply HMR edits on Windows (#6094) by @sapphi-red

### ⚙️ Miscellaneous Tasks

- Revert "chore: adjust breaking change template of cliff (#6069)"
(#6130) by @IWANABETHATGUY
- test-dev-server: improve hmr test configuration (#6115) by @hyf0
- deps: update dependency rolldown-plugin-dts to v0.16.2 (#6128) by
@renovate[bot]
- Revert "refactor: simplify module_namespace construction (#5939)"
(#6117) by @IWANABETHATGUY
- test-dev-server: optimize test log output (#6107) by @hyf0
- enable compare_contents_for_polling and update poll interval for CI
test-dev-server (#6110) by @hyf0
- deps: update dependency vite to v7.1.5 [security] (#6111) by
@renovate[bot]
- fix warnings reported by `just lint` (#6105) by @shulaoda
- deps: update dependency tsdown to v0.15.0 (#6102) by @renovate[bot]
- use debug builds for browser tests in CI (#6092) by @hyf0
- test-dev-server: update polling interval and add retry logic for CI
tests (#6088) by @hyf0
- adjust breaking change template of cliff (#6069) by @IWANABETHATGUY

### ◀️ Revert

- "fix: replace_plugin does not work as expected with .ts config
(#5920)" (#6074) by @IWANABETHATGUY

Co-authored-by: Boshen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants