Skip to content

chore(deps): bump oxc + oxc_sourcemap to git refs; migrate to OwnedSourceMap#9567

Draft
Boshen wants to merge 4 commits into
mainfrom
chore/bump-oxc-sourcemap-to-main
Draft

chore(deps): bump oxc + oxc_sourcemap to git refs; migrate to OwnedSourceMap#9567
Boshen wants to merge 4 commits into
mainfrom
chore/bump-oxc-sourcemap-to-main

Conversation

@Boshen
Copy link
Copy Markdown
Member

@Boshen Boshen commented May 26, 2026

Summary

Pin oxc_sourcemap to https://github.com/oxc-project/oxc-sourcemap rev abae0f7 (current main) to pick up:

  • the SourceMap<'a> / OwnedSourceMap lifetime API — zero-copy borrow-parsed sourcemaps plus a lifetime-free owned wrapper for downstream struct fields
  • the visualizer perf/correctness fix in oxc-sourcemap#344 — O(n²) chars().nth() scan that also misread CRLF after multi-byte UTF-8

And bump oxc (+ sibling crates) to the matching PR branch in oxc#22742, which migrates oxc_codegen::CodegenReturn::map to the new API. Both pins revert to crates.io versions once oxc-sourcemap cuts the next release and oxc cuts a release containing #22742.

Draft because it depends on those two upstream landings.

Rolldown migration

  • rolldown_sourcemap re-exports OwnedSourceMap as SourceMap so downstream users get the lifetime-free wrapper transparently.
  • adjust_sourcemap_dst_lines uses into_parts() / from_parts(), moving names/sources/sourcesContent out of the input instead of re-allocating per string.
  • collapse_sourcemaps borrows names/sources/sourcesContent from the first input via Cow::Borrowed, then detaches with into_owned_sourcemap() — no per-string allocations on the hot path.
  • string_wizard::SourcemapBuilder::into_source_map and MagicString::source_map return OwnedSourceMap.
  • rolldown_ecmascript::EcmaCompiler::dce_or_minify returns Option<OwnedSourceMap> via the bumped oxc::codegen::CodegenReturn.
  • binding_magic_string drops the Arc-based SourceMap::new round-trip that was used to attach file and just calls OwnedSourceMap::set_file in place.

Drive-by oxc 0.133-dev API-drift fixes

Required to compile against the bumped oxc, orthogonal to the sourcemap change:

  • DecoratorOptions::from adds ..Default::default() for the new strict_null_checks field.
  • oxc_minify_napi::CodegenOptions initializer adds ..Default::default() for the new legal_comments field.

🤖 Generated with Claude Code

…urceMap

Pin `oxc_sourcemap` to https://github.com/oxc-project/oxc-sourcemap rev
`abae0f7` (current main) to pick up:

* the `SourceMap<'a>` / `OwnedSourceMap` lifetime API — zero-copy
  borrow-parsed sourcemaps + a lifetime-free owned wrapper for
  downstream struct fields
* the visualizer perf/correctness fix
  (oxc-project/oxc-sourcemap#344) — O(n²)
  `chars().nth()` scan that also misread CRLF after multi-byte UTF-8

And bump `oxc` (+ sibling crates) to the matching PR branch
(oxc-project/oxc#22742), which migrates `oxc_codegen::CodegenReturn`
to the new API. Restore both deps to crates.io pins once oxc cuts a
release containing #22742.

Migration:

* `rolldown_sourcemap` re-exports `OwnedSourceMap as SourceMap` so
  downstream users get the lifetime-free wrapper unchanged.
* `adjust_sourcemap_dst_lines` now uses `into_parts()` / `from_parts()`,
  moving names/sources/sourcesContent out of the input rather than
  re-allocating them.
* `collapse_sourcemaps` borrows names/sources/sourcesContent from the
  first input via `Cow::Borrowed`, then detaches with
  `into_owned_sourcemap()` — no per-string allocation on the hot path.
* `string_wizard::SourcemapBuilder::into_source_map` and
  `MagicString::source_map` return `OwnedSourceMap`.
* `rolldown_ecmascript::EcmaCompiler::dce_or_minify` returns
  `Option<OwnedSourceMap>` via the bumped `oxc::codegen::CodegenReturn`.
* `binding_magic_string` drops the `Arc`-based `SourceMap::new` round-trip
  used to attach `file` and just calls `OwnedSourceMap::set_file` in place.

Drive-by API-drift fixes against oxc 0.133-dev (orthogonal to the
sourcemap change but required to compile against the bumped `oxc`):

* `DecoratorOptions::from` adds `..Default::default()` for the new
  `strict_null_checks` field.
* `oxc_minify_napi::CodegenOptions` initializer adds
  `..Default::default()` for the new `legal_comments` field.
@netlify
Copy link
Copy Markdown

netlify Bot commented May 26, 2026

Deploy Preview for rolldown-rs failed.

Name Link
🔨 Latest commit cf7afd8
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/6a15b25efc987b0008902ebd

Boshen added 3 commits May 26, 2026 18:42
* `rolldown_plugin::build_hooks::transform_with_chain` —
  `|s| s.is_empty()` resolves to `str::is_empty` now that
  `SourceMap::get_source` / `get_source_content` return `Option<&str>`
  instead of `Option<&Arc<str>>`. Replace the two closures with method
  references to satisfy `-D clippy::redundant_closure_for_method_calls`.

* `packages/rolldown/src/binding*` — regenerated by `just build-rolldown`
  so the napi-generated bindings expose the new `LegalCommentsMode`
  enum and `LegalCommentsLinked` interface introduced in
  `oxc_minify_napi` 0.133. The `Check no diff` step of the native build
  workflow rejected the previous bindings against the bumped oxc.
Regenerate insta snapshots for 30 integration tests whose output
changed between `oxc` 0.132.0 (the previous workspace pin) and the
0.133-dev rev this PR bumps to. The diffs come from oxc's DCE / minifier
/ class-field transformer — not from `oxc_sourcemap` or anything else in
this PR — but they have to be accepted for `cargo test` to go green
against the bumped dependency.

Captured by running `INSTA_UPDATE=new cargo test -p rolldown --test
integration` followed by `cargo insta accept`. Reviewer should audit
the snapshot diff — if any of the new outputs look like minifier
regressions vs improvements, they should be raised against oxc rather
than reverted here, since this PR can't avoid the bump.
oxc-sourcemap 7.0.0 has been released. Replace the temporary
`[patch.crates-io] oxc_sourcemap = { git, rev = "abae0f7" }` with a
normal `version = "7"` workspace-dependency pin and refresh the
lockfile. The oxc git refs stay until oxc-project/oxc#22742 lands and
oxc cuts a release containing the matching codegen migration.
@socket-security
Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedcargo/​oxc_sourcemap@​6.1.1 ⏵ 7.0.08210093100100

View full report

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.

1 participant