Skip to content

fix: follow Rollup for module meta and moduleSideEffects set by plugins - #11792

Merged
h-a-n-a merged 10 commits into
mainfrom
align-module-options-with-rollup
Nov 23, 2026
Merged

h-a-n-a merged 10 commits into
mainfrom
align-module-options-with-rollup

Conversation

@h-a-n-a

@h-a-n-a h-a-n-a commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

This PR makes Rolldown follow Rollup's rules for the meta and moduleSideEffects that plugins set on a module. The rules are in internal-docs/module-meta-and-side-effects/design.md, so please start the review there. The persistent scan cache in #11671 depends on them (rolldown/cache 0003).

The rules

  1. Creation. The first resolution of an id that reaches the module loader creates the module and sets its first meta (a top-level copy) and moduleSideEffects. Later resolutions, this.resolve, and this.load options for an existing module do not change it.
  2. Hook results. Each object result of the module's own load and transform replaces moduleSideEffects when it is not null or undefined, and merges meta at the top level.
  3. Writes. Any hook can change the values through this.getModuleInfo(id). Writing null to moduleSideEffects clears it. Writes up to the end of buildEnd reach tree shaking. Rolldown ignores a moduleSideEffects write after buildEnd, so a later read and the next build do not see it, and warns about the first one in a build (MODULE_SIDE_EFFECTS_WRITE_AFTER_BUILD_END).
  4. Reading moduleSideEffects. A read returns the decided value, or else a default value. The order of the defaults is in the design doc. From the time the module is created, a read never returns null.
  5. Lifetime. A full build starts every module fresh. A partial scan (HMR, incremental rebuild, lazy compile) starts each changed module again from the resolution that created it.
a.js: resolveId('./x.css') → meta { from: 'a.js' }   first → creates x.css
b.js: resolveId('./x.css') → meta { from: 'b.js' }   x.css exists → not used (before: merged)

What changes for plugins

Case Before After
A second importer resolves the same id Merged into the module Ignored
this.resolve Changed the target module and returned its live meta Returns only its own resolution: its meta, and its hook value or the default moduleSideEffects
this.load options for an existing module Merged Ignored
meta that a hook returns Kept as the plugin's object Kept as a top-level copy
getModuleInfo(id).moduleSideEffects before the module is parsed, or after a write of null null The default value
A write in buildEnd, or to an external Changed only JS, or skipped Reaches tree shaking
A moduleSideEffects write after buildEnd No warning Ignored, with one warning per build
HMR and incremental rebuild A changed module could lose its values Starts again from its creating resolution
Lazy compilation A lazy virtual module could get an empty chunk Resolves the original import again

moduleSideEffects now lives only in Rust. deferSyncScanData and invalidate are removed.

The default values for an external module and for treeshake: false come from #11422, which is on main.

Differences from Rollup

  • The importer whose module task ends first creates the module (Rollup: the resolution that ends first).
  • When the option and package.json both give a value, the option wins. In Rollup, @rollup/plugin-node-resolve returns the package.json value as a hook value, so it wins.
  • An external Node.js built-in, such as node:fs, reads false (Rollup: true).
  • A read can return the package.json sideEffects value.
  • Writing null clears the value (Rollup stores null and treats it as false).
  • Writes after buildEnd are ignored, and Rolldown warns about the first one. In Rollup, a later read shows the written value.

Impact

Performance

Release builds, 10 runs each, M4 Pro (noise about 2%). The output was byte-identical.

Build Change
Plain builds of 6 benchmark apps None
Vite with @vitejs/plugin-react, 5,000 modules None
Stress case, 10,000 modules 3–5% slower (+45–55 ms of 1.1 s)

The stress case is not a usual build. Every relative import is resolved by a JS resolveId that returns meta, and moduleSideEffects of every module is read in moduleParsed, renderChunk and a codeSplitting.groups name function. The cost comes from:

  1. One call into JS per module that a JS resolveId creates, so JS can set the first meta (TaskContext::create_js_module_options): about 2 µs per module.
  2. A call into Rust per read of moduleSideEffects in the chunking context: about 0.6 µs per read.

Possible fixes, not in this PR, are listed in internal-docs/cache/implementation.md.

Where to look

  • JS: createModuleOptions, saveResolutionOptions, resetModuleOptions in packages/rolldown/src/plugin/plugin-context-data.ts.
  • Rust: crates/rolldown_common/src/types/module_side_effects_overrides.rs, declared_side_effects_without_hook in crates/rolldown/src/ecmascript/ecma_module_view_factory.rs, try_spawn_new_task in crates/rolldown/src/module_loader/module_loader.rs.
  • Machinery: the JS side cache section of internal-docs/cache/implementation.md.

Tests

New fixtures under packages/rolldown/tests/fixtures/plugin/{context,resolve-id,transform}. Rollup's empty-module-no-treeshake and module-side-effects@resolve-id-external tests now pass.

Known gaps

  • The synchronous Rust chunking getter cannot call a JS treeshake.moduleSideEffects function.
  • A JS treeshake.moduleSideEffects function can run two times for one module; the first result is kept.

🤖 Generated with Claude Code

h-a-n-a commented Nov 18, 2026 •

Copy link
Copy Markdown
Member Author

How to use the Graphite Merge Queue

Add 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.

@netlify

netlify Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for rolldown-rs ready!

Name Link
🔨 Latest commit e2c7624
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/6b03e16c457f622dbe143704
😎 Deploy Preview https://deploy-preview-11792--rolldown-rs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@h-a-n-a
h-a-n-a force-pushed the align-module-options-with-rollup branch from 3fe094d to 180920f Compare November 18, 2026 15:35
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://align-module-options-with-rollup-rolldown-rs.voidzero-docs.workers.dev (commit e2c7624)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://74f593f5-rolldown-rs.voidzero-docs.workers.dev e2c7624 2026-11-23T06:49:11.321Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://c6289ff4-rolldown-rs.voidzero-docs.workers.dev 91ffe01 2026-11-20T11:33:53.116Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://5d99fb12-rolldown-rs.voidzero-docs.workers.dev ee75a3d 2026-11-20T10:27:49.633Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://4dfe6a0d-rolldown-rs.voidzero-docs.workers.dev 3b9ebbf 2026-11-20T10:16:41.640Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://2362da67-rolldown-rs.voidzero-docs.workers.dev 3d2d11f 2026-11-20T08:24:19.718Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://604136ad-rolldown-rs.voidzero-docs.workers.dev 482cd08 2026-11-20T08:09:11.001Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://d2637fa4-rolldown-rs.voidzero-docs.workers.dev 05fc40e 2026-11-20T06:34:50.704Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://c9051f88-rolldown-rs.voidzero-docs.workers.dev 19f3813 2026-11-20T06:07:17.989Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://e8766ef3-rolldown-rs.voidzero-docs.workers.dev 6f7dd7d 2026-11-19T19:15:10.971Z Visit the dashboard ↗
  • Build: In progress 🔵

View logs ↗
a9a7eaa 2026-11-19T18:59:30.785Z View logs ↗

View all previews: View all previews ↗

Base automatically changed from remove-parallel-plugin to main November 19, 2026 07:48
@h-a-n-a
h-a-n-a force-pushed the align-module-options-with-rollup branch from 180920f to e031f19 Compare November 19, 2026 09:09
@@ -1,61 +0,0 @@
use rolldown_common::ModuleId;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been removed as Rust and JS now have to interact with each other to ensure that sideEffects is in sync.


- the `resolveId` call of an entry: at the start of the build, after the
`resolveId` calls of all entries return and before any import;
- the `resolveId` call of a chunk that a hook emits: when the call returns;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This causes a new add entry job to be created. So it will still be counted as a resolveId result.

Comment on lines +355 to +362
**`this.resolve` when no hook decided `moduleSideEffects`.** Rolldown returns
`null`. Rollup returns the value of the `treeshake.moduleSideEffects` option
for the id, which is `true` by default. For example,
`this.resolve('./x.css', '/src/a.js')` returns `moduleSideEffects: null` in
Rolldown, and `true` in Rollup. Rolldown reads `package.json` `sideEffects`
only when the value is `null`. Some plugins return a `this.resolve` result
as their own `resolveId` result. If `this.resolve` returned `true`, these
plugins would turn the `package.json` check off.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is expected as on the main branch, we use null for a not decided value and let the following workflows decide.

Comment on lines +372 to +376
**A write of `null`.** In Rolldown, a write of `null` clears the value, and
tree shaking uses the value from items 1 to 3. Rollup stores `null`, a read
returns `null`, and tree shaking treats it as `false`. In the example, if
`buildEnd` wrote `null`, a read would return `true` in Rolldown and `null`
in Rollup.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

@h-a-n-a
h-a-n-a marked this pull request as ready for review November 19, 2026 09:56
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T09:58:35.972094Z e031f19 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@h-a-n-a

h-a-n-a commented Nov 19, 2026

Copy link
Copy Markdown
Member Author

Check out the cache design based on this at: rolldown/cache#16

@codspeed

codspeed Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 4 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 7 untouched benchmarks
⏩ 10 skipped benchmarks1


Comparing align-module-options-with-rollup (e2c7624) with main (b0e59ab)2

Open in CodSpeed

Footnotes

  1. 10 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on main (98607c5) during the generation of this report, so b0e59ab was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@shulaoda shulaoda self-assigned this Nov 19, 2026
@h-a-n-a
h-a-n-a force-pushed the align-module-options-with-rollup branch from e031f19 to a9a7eaa Compare November 19, 2026 18:59
@h-a-n-a
h-a-n-a force-pushed the align-module-options-with-rollup branch from a9a7eaa to 92a2c41 Compare November 19, 2026 19:04
@h-a-n-a
h-a-n-a force-pushed the align-module-options-with-rollup branch from 92a2c41 to 6f7dd7d Compare November 19, 2026 19:11
…with-rollup

# Conflicts:
#	crates/rolldown/src/module_loader/module_task.rs
#	crates/rolldown/src/module_loader/task_context.rs
#	crates/rolldown/src/stages/scan_stage.rs
#	crates/rolldown/tests/rolldown/errors/external_module_conflict/partial_scan.rs
#	crates/rolldown/tests/rolldown/errors/external_module_conflict/plugin_load/mod.rs
#	crates/rolldown/tests/rolldown/errors/plugin_error/mod.rs
#	crates/rolldown_binding/src/options/plugin/binding_plugin_context.rs
#	crates/rolldown_plugin/src/plugin_context/native_plugin_context.rs
#	crates/rolldown_plugin/src/plugin_context/plugin_context.rs
#	crates/rolldown_plugin_isolated_declaration/src/lib.rs
#	packages/rolldown/src/binding.d.cts
#	packages/rolldown/src/plugin/bindingify-build-hooks.ts
#	packages/rolldown/src/plugin/plugin-context.ts
#	packages/rolldown/src/rolldown-binding.wasi.d.cts
#	packages/rollup-tests/src/status.json
#	packages/rollup-tests/src/status.md
Comment on lines +104 to +106
pub fn set(&self, module_id: &str, value: Option<HookSideEffects>) {
self.values.insert(self.key(module_id).into(), WrittenSideEffects(value));
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A moduleSideEffects write after buildEnd (for example in renderStart) stays in values and is applied in the next partial scan, so an unchanged module can be tree-shaken differently than in a full build. Plugins normally don't write it after buildEnd, and Rollup's docs also say such writes are only picked up before buildEnd, so maybe we can just document this case.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Should not store any data after buildEnd.

@shulaoda shulaoda left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had AI review this PR and it found no blocking issues. The change is quite large, so I only went through the core logic roughly, and I didn't find any other problems.

…with-rollup

# Conflicts:
#	crates/rolldown/src/module_loader/module_loader.rs
#	crates/rolldown_plugin/src/plugin_context/native_plugin_context.rs
#	docs/in-depth/dead-code-elimination.md
#	packages/rolldown/src/plugin/index.ts
@h-a-n-a

h-a-n-a commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

Merging this as the remaining issues are non-blocking.

@h-a-n-a
h-a-n-a merged commit 7b3111b into main Nov 23, 2026
38 checks passed
@h-a-n-a
h-a-n-a deleted the align-module-options-with-rollup branch November 23, 2026 06:56
h-a-n-a added a commit to rolldown/cache that referenced this pull request Nov 23, 2026
h-a-n-a added a commit to rolldown/cache that referenced this pull request Nov 23, 2026
… moduleSideEffects (#16)

- **0003 (new):** how the persistent scan cache saves and reuses module
`meta` and `moduleSideEffects`. It builds on the rules without the cache
in Rolldown's
[`internal-docs/module-meta-and-side-effects/design.md`](https://github.com/rolldown/rolldown/blob/main/internal-docs/module-meta-and-side-effects/design.md)
(rolldown/rolldown#11792).
- **0002 (updated):** changes from the M1 implementation
(rolldown/rolldown#11671). The rules for `meta` and `moduleSideEffects`
moved to 0003.
- **meta-frameworks/vite.md (new):** how Vite works with the cache.
- **glossary.md and milestones.md:** new terms, and the known untracked
inputs under M2.

**AI disclosure:** These documents and this description were written
with Claude Code (Claude Opus 5.5).

🤖 Generated with [Claude Code](https://claude.com/claude-code)
h-a-n-a added a commit that referenced this pull request Nov 24, 2026
shulaoda added a commit that referenced this pull request Nov 25, 2026
…fects` (#11926)

Follow-up to #11792.

Since #11792, the `moduleSideEffects` value reported to plugins comes
from `module_side_effects_decision`, and the old conversion from the
inclusion verdict is only called by its own unit test. This removes the
conversion and that test, so the reported value is decided in one place.
hyfdev added a commit that referenced this pull request Nov 25, 2026
…p contexts (#11914)

Since #11792, plugin hook contexts and code splitting group contexts have extra keys.

In plugin hooks, `Object.keys(this)` includes `warnWriteAfterBuildEnd`.

In code splitting group callbacks, `Object.keys(ctx)` includes `onLog` and `warnWriteAfterBuildEnd`.

#11792 is not released yet.

This PR removes these keys, so both contexts have the same keys as in v1.3.3.

The warning for writes to `moduleSideEffects` after `buildEnd` now comes from `PluginContextData`, which already holds the logger.

Its text and when it fires are unchanged.
h-a-n-a added a commit that referenced this pull request Nov 25, 2026
…tal rebuilds (#11837)

An incremental rebuild now fetches each changed module again from the
resolution that created it (`originative_resolved_id`), as the HMR stage
already does. It no longer calls `resolveId` for the changed module.
This came up in the review of #11792
([comment](#11792 (comment))).

## Problem

For each changed file, the partial scan called `resolveId` with the file
path as the specifier, no importer, and `isEntry: true`
(`resolve_absolute_path` in `scan_stage.rs`). Then it fetched the module
from that new resolution.

- **It resolves an id, not a specifier.** This works only because an
absolute path resolves to itself. A `resolveId` hook usually resolves
only its own specifiers, so the id of a virtual module resolves to
nothing:

  ```js
  resolveId(source) {
    if (source === 'virtual') return '\0virtual'
  },
  ```

A partial scan for `\0virtual` failed: the hook returned nothing, and
Rolldown's resolver found no file. Lazy compilation passes module ids to
the partial scan, not only file paths.

- **A file that is not a module was loaded as one.** A file that a
plugin added with `addWatchFile` was resolved as an entry and loaded as
a new module. It stayed in the module graph, and a watched file whose
content is not valid for its module type, such as a JSON file with a
syntax error, failed the rebuild.

- **Plugins saw an extra call.** Each rebuild called `resolveId(path,
undefined, { isEntry: true })` for every changed module, also for a
module that is not an entry.

## Changes

- `changed_resolved_ids` in `scan_stage.rs` looks up each changed path
or id in the snapshot (`module_id_to_idx`, then
`module_idx_by_abs_path`):
- A normal module, also a virtual one, is fetched again with its
`originative_resolved_id`.
- An external module is not fetched, because it has no hooks to run. It
is marked as invalidated, so the first resolution of its id in this scan
sets its kind again. A changed file that was external can still become a
normal module (invariant 7 in `internal-docs/cache/implementation.md`).
  - A changed file that is not a module is skipped.
- The reused resolution keeps the `package.json` that it found, but the
file can change after it. `ModuleLoader::fetch_modules` reads it again
from the same path before it fetches a changed module
(`refresh_package_json` in `resolve_utils.rs`), and infers the module
format again from its `type` field, the way the resolution did. The
rebuild, the HMR stage and lazy compilation all fetch through it, so an
HMR patch also gets the new module format and `sideEffects`. This
follows the persistent cache design ([rolldown/cache
0002](https://github.com/rolldown/cache/blob/main/design-docs/0002-persistent-scan-cache.md),
"Resolve results").
- The check that the file exists uses `fs.metadata`, so a `package.json`
in a Yarn PnP zip archive is found.
  - A `package.json` that no longer exists gives no `package.json` data.
- A `package.json` that cannot be read or parsed keeps the data of the
last read, and the module is fetched as usual. The refresh runs before
the scan knows which modules are still imported, and the same change can
remove the last import of the module. A fresh build then succeeds, and
so does the scan. The HMR stage also needs every changed module of a
successful scan to be fetched again.
  - The modules in `pending_rescans` are refreshed too.
- `ScanStage::reset_changed_modules` resets the changed modules to the
module options of the resolution that created them before `buildStart`.
So `getModuleInfo` in `buildStart` shows these values, not the ones that
the HMR stage of the same change set. `fetch_modules` resets them again
after `buildStart`.
- A partial scan in which only files that are not modules changed starts
no module task. Before it stops, the loop in `fetch_modules` now reads
the messages that are already queued, so a chunk that `buildStart` emits
is loaded.
- In `try_spawn_new_task`, the `moduleSideEffects` of the creating
resolution no longer replace the value of a new resolution, because the
changed module now starts from the creating resolution itself.
- `internal-docs/module-meta-and-side-effects/design.md` (Lifetime),
`internal-docs/cache/implementation.md` and
`internal-docs/import-attributes/design.md` describe the new behavior.
The design doc also says that the reset restores only the top-level keys
of `meta`: a hook that changes a nested object of `meta` in place keeps
that change, as before.

## Not in this PR

- With `rebuildStrategy: 'always'`, the dev engine runs the HMR stage
and then the rebuild for one change. Both fetch the changed module, so
it is still loaded two times.
- A `package.json` is read again only when its module changes, and only
after the resolver cache was cleared. The dev engine clears it when a
watched `package.json` changes, and core does not watch `package.json`.
A `package.json` that a user adds nearer to the module, or adds again
after it was missing, is not found, because the path is the one that the
resolution found. These cases need the files that a resolution depends
on, also the ones that it looked for and did not find. Rolldown does not
track them yet.
- While a `package.json` cannot be parsed, a fresh build fails to
resolve a module under it, but an incremental scan of that module keeps
the last data.
- When the whole id and the id without `?query` both give the old module
format, the format is inferred again from the whole id. So an id with a
query from Rolldown's resolver that started as `Unknown` stays `Unknown`
after a `type` field is added.
- A file imported with import attributes has a module id that is not its
path, so the partial scan still does not find its module. This was also
the case before.

## Tests

Rust (`partial_scan_reuses_resolved_id`):

- A partial scan for a virtual module loads it again without a
`resolveId` call.
- A changed file that is not a module is skipped.
- A `package.json` that cannot be parsed does not fail the partial scan.
The changed module keeps the data of the last read, and the read after
the fix gives the new data.
- A partial scan reads the `package.json` of a module in a Yarn PnP zip
archive again. The test writes the archive itself.

Dev engine (`dev-watch.test.ts`):

- `a rebuild fetches a changed module again without calling resolveId
for it`: the virtual module loads again after its watched file changes,
the watched file is not loaded as a module, and no `resolveId` call
happens for a changed module.
- `an incremental rebuild fetches a changed module again with its start
options`: checks the values that `transform` sees in the rebuild.
- `a rebuild loads a chunk that buildStart emits when only a watched
file changed`
- `a rebuild reads the sideEffects field of package.json again for a
changed module`
- `a rebuild reads the type field of package.json again for a changed
module`
- `an HMR patch reads the type field of package.json again for a changed
module`: uses the default rebuild strategy and a registered client, and
checks that the patch treats `dep.js` as CommonJS.
- `a package.json that cannot be parsed does not fail an update of a
module under it`: edits the module, then removes its only import, and
checks the HMR update and the rebuild after each step.
- `buildStart of a rebuild sees the start options of a changed module`

Each new test fails without the matching change in this PR. The browser
HMR tests of `test-dev-server` need the Vite checkout, so I did not run
them locally.

**AI disclosure:** The code, the tests and this description were written
with Claude Code (Claude Opus 5.5).
@rolldown-guard rolldown-guard Bot mentioned this pull request Nov 26, 2026
shulaoda added a commit that referenced this pull request Nov 26, 2026
## [1.3.4] - 2026-11-26

### 🚀 Features

- add builtin `injectPlugin` with `include`/`exclude` (#11290) by @onmax
- magic-string: support explicit sourcemap locations (#11884) by @IWANABETHATGUY
- introduce `declaredModuleSize` to allow plugins to declare a module's real size (#11844) by @hyfdev
- binding: add dropInner() to 12 binding classes and extract release_arc helper (#11855) by @Brooooooklyn
- inline-common-chunks: add `maxDuplicatedSize` to keep widely copied chunks as files (#11845) by @mattlewis92
- cli: report when a watch round finishes (#11820) by @hyfdev
- rolldown_plugin_vite_build_import_analysis: avoid stripping import attributes when `experimental.importAttributes` is enabled (#11802) by @sapphi-red
- import-attributes: warn when a non-ESM output drops the import attributes of an external (#11797) by @shulaoda
- warn when the `watch` option is passed to `build()` (#11781) by @shulaoda

### 🐛 Bug Fixes

- keep_names: restore hoisted function names before the chunk's modules run (#11962) by @hyfdev
- external: don't drop `_/` from relative external imports (#11968) by @hyfdev
- external: don't panic on empty output filename with relative externals (#11963) by @hyfdev
- use the same path as direct imports for externals re-exported with `export *` (#11964) by @hyfdev
- sourcemap: don't panic on empty output filename (#11966) by @hyfdev
- sourcemap: treat empty `sourcemapFileNames` as unset (#11967) by @hyfdev
- rename clashing names in execution order with `chunkModulesOrder: 'module-id'` (#11943) by @hyfdev
- code-splitting: stop counting JSON modules as 0 bytes (#11939) by @hyfdev
- fetch changed modules from their creating resolution in incremental rebuilds (#11837) by @h-a-n-a
- code-splitting: keep import order through entry re-exports (#11906) by @hyfdev
- cjs: keep CommonJS named exports in `export *` of a dynamically imported module (#11835) by @hyfdev
- plugin: remove internal keys from plugin and code splitting group contexts (#11914) by @hyfdev
- remove the leftover `watch.notify` from the option validator (#11918) by @shulaoda
- return the group chunk file from `getFileName()` for a merged emitted entry (#11858) by @IWANABETHATGUY
- dev: let `this.load` of an unchanged module finish during a rebuild (#11911) by @hyfdev
- code-splitting: avoid an extra shared chunk when an entry only re-exports another entry (#11847) by @hyfdev
- treeshake: remove unused objects containing identity function calls (#11852) by @hyfdev
- cjs: avoid `ReferenceError` when re-exporting from an external `export *` in another chunk (#11848) by @hyfdev
- binding: remove stale WASI workaround in to_binding_error (#11890) by @Brooooooklyn
- inline-const: respect `inlineConst` options for default exports (#11851) by @hyfdev
- magic-string: keep trailing lines in decoded maps (#11882) by @IWANABETHATGUY
- magic-string: preserve column mappings through trim (#11881) by @IWANABETHATGUY
- magic-string: map each line of multiline replacements (#11880) by @IWANABETHATGUY
- follow Rollup for module meta and moduleSideEffects set by plugins (#11792) by @h-a-n-a
- code-splitting: import the bindings a CommonJS entry re-exports from an ES module (#11839) by @hyfdev
- cjs: stop overwriting `module.exports` of a CommonJS entry that re-exports an ES module (#11846) by @hyfdev
- sourcemap: accept undefined source entries from plugins (#11850) by @fengmk2
- code-splitting: unblock top-level awaited dynamic imports in manual groups (#11819) by @hyfdev
- runtime: resolve `require()` from the calling chunk in Node ESM output (#11834) by @hyfdev
- plugin: throw instead of panicking when a saved transform context calls `getCombinedSourcemap` (#11838) by @hyfdev
- code-splitting: only code-less entries keep side-effect-free static import edges (#11199) by @mattlewis92
- make `getCombinedSourcemap` work with `experimental.nativeMagicString` (#11107) by @IWANABETHATGUY
- plugin: avoid hangs when resolveId awaits this.load() (#11824) by @shulaoda
- keep template chunk names from overwriting explicit file names (#11831) by @hyfdev
- code-splitting: skip redundant re-export chunks (#11817) by @hyfdev
- preserve build errors when `buildEnd` fails (#11828) by @sapphi-red
- preserve top-level using with topLevelVar (#11804) by @akshathayadav378-boop
- treeshake: keep array destructuring that calls an unknown iterator (#11812) by @IWANABETHATGUY
- preserve `export` names starting with `*` in ModuleInfo.exports (#11825) by @sapphi-red
- treeshake: keep calls to functions that direct `eval` can replace (#11811) by @IWANABETHATGUY
- keep each source's content in a multi-source transform sourcemap (#11246) by @IWANABETHATGUY
- treeshake: keep calls to empty functions with a rest parameter default (#11810) by @IWANABETHATGUY
- plugin: allow this.load() while resolving entries (#11816) by @hyfdev
- cli: avoid a WASI hang when watch mode exits normally (#11815) by @shulaoda
- report effective moduleSideEffects in getModuleInfo and this.resolve (#11422) by @cestercian
- code-splitting: avoid an import cycle through an entry's re-exports (#11803) by @hyfdev
- treeshake: apply @__NO_SIDE_EFFECTS__ to functions exported after declaration (#11222) by @araishi
- code-splitting: keep unused entry re-exports from loading lazy chunks (#11753) by @hyfdev
- code-splitting: keep re-exported bindings out of dynamic import namespaces (#11799) by @hyfdev
- perf-kit: Node mode times out under the inspector with `--ready exit` or an anchored `stdout:` pattern (#11416) by @IWANABETHATGUY
- treeshaking: drop dead dynamic imports that form a cycle (#11768) by @hyfdev
- binding: release the WASI runtime when a callable builtin plugin hook rejects (#11786) by @shulaoda
- perf-kit: print real imports in the why chain (#11500) by @IWANABETHATGUY
- chunk: name emitted chunks before shared chunks (#11790) by @hyfdev
- cjs: forward exports from duplicate CommonJS entries (#11756) by @hyfdev
- code-splitting: keep chained emitted entries from becoming empty facades (#11090) by @Huzaifa-Asif

### 💼 Other

- wasi: bundle self-contained WASI loaders, staging script, and reactor checks (#11843) by @Brooooooklyn

### 🚜 Refactor

- scan: remove an unreachable branch when collecting dynamic import entries (#11919) by @shulaoda
- cli: replace the unreachable prototype pollution guard with a test (#11925) by @shulaoda
- remove the unused `DeterminedSideEffects::to_module_side_effects` (#11926) by @shulaoda
- remove more unused types, functions and re-exports (#11922) by @shulaoda
- link_stage: handle required modules only in the pre-pass (#11920) by @shulaoda
- cli: remove the leftover `inject` from the CLI options type (#11924) by @shulaoda
- rolldown_plugin_vite_build_import_analysis: remove the unused `optimizeModulePreloadRelativePaths` option (#11923) by @shulaoda
- remove experimental `freeExternalMemory` (#11886) by @shulaoda
- rust: drop direct tokio dependencies from core library crates (#11841) by @Brooooooklyn
- rolldown_plugin: move `normalize_transform_sourcemap` to utils (#11247) by @IWANABETHATGUY
- remove the unused `plugins_are_slow` method (#11800) by @shulaoda
- remove parallel plugin support (#11789) by @h-a-n-a
- remove the unused `is_css` sourcemap flag (#11782) by @shulaoda

### 📚 Documentation

- rename javascript to JavaScript (#11958) by @mdong1909
- say that resolveId fails the build when the same id is external and not external (#11910) by @h-a-n-a
- explain which resolution sets meta and moduleSideEffects in resolveId (#11907) by @h-a-n-a
- resolve the import in the `moduleSideEffects` plugin example (#11860) by @hyfdev
- clarify side-effect-free module behavior (#11856) by @IWANABETHATGUY
- clarify the behavior when `buildEnd` / `renderError` itself errors (#11829) by @sapphi-red
- add docs for `code` / `plugin` / `pluginCode` of `RolldownLog` (#11827) by @sapphi-red
- explain that a module in an entry chunk runs after the common chunks it imports (#11822) by @hyfdev
- magic-string: document `generateDecodedMap` and the segments of `hires: false` maps (#11791) by @IWANABETHATGUY

### ⚡ Performance

- binding: return memory to the OS once rolldown is idle (#11655) by @shulaoda
- scan: reserve symbol capacity for each module's facade symbols (#11854) by @magurotuna
- runtime: stop using bound functions as `__copyProps` getters (#11826) by @magurotuna
- replace `IndexVec<ModuleIdx, bool>` with `IndexBitSet` (#11805) by @IWANABETHATGUY
- rolldown_plugin_vite_manifest: look up chunk names by file name once per build (#11697) by @Boshen
- drop module sourcemaps after the chunk is joined (#11773) by @shulaoda

### 🧪 Testing

- magic-string: re-enable two passing compatibility tests (#11879) by @IWANABETHATGUY
- node: add standalone runtime/proxy/retained-context tests and vitest binding staging (#11842) by @Brooooooklyn
- cli: stop watch CLI tests from hanging on Windows (#11821) by @shulaoda

### ⚙️ Miscellaneous Tasks

- delete cancelled pkg.pr.new runs on main and debounce for 15 mins (#11928) by @shulaoda
- remove the unused `serde` features of rolldown, rolldown_plugin and rolldown_common (#11927) by @shulaoda
- deps: update vite-plus to v1.8.0 in the workspace and CI (#11896) by @camc314
- deps: update rollup submodule for tests to v4.68.8 (#11901) by @rolldown-guard[bot]
- deps: update test262 submodule for tests (#11902) by @rolldown-guard[bot]
- remove the graphite merge-when-ready label check (#11904) by @shulaoda
- deps: pin walkdir to 2.5.0 (#11897) by @hyfdev
- deps: remove remove-unused-vars (#11895) by @camc314
- deps: update rust crate testing_macros to v3 (#11876) by @renovate[bot]
- deps: update rust crates (#11873) by @renovate[bot]
- deps: update npm packages (#11872) by @renovate[bot]
- deps: upgrade oxc to 0.160.0 (#11885) by @camc314
- deps: update github actions (#11874) by @renovate[bot]
- rust: standalone runtime prep (devtools sync writer, TestDir, 1ms debounce, Wasm sourcemap inline, parking_lot_core patch) (#11840) by @Brooooooklyn
- run setup steps one by one on Windows (#11849) by @shulaoda

### ◀️ Revert

- "feat(binding): add dropInner() to 12 binding classes and extract release_arc helper (#11855)" (#11898) by @shulaoda
- "fix(code-splitting): keep chained emitted entries from becoming empty facades (#11090)" (#11891) by @hyfdev

### ❤️ New Contributors

* @fengmk2 made their first contribution in [#11850](#11850)
* @akshathayadav378-boop made their first contribution in [#11804](#11804)
* @araishi made their first contribution in [#11222](#11222)
* @Huzaifa-Asif made their first contribution in [#11090](#11090)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants