Skip to content

Commit 2780deb

Browse files
shulaodaclaude
andauthored
chore(deps): upgrade oxc to 0.123.0 (#8967)
close #8963 ## Summary - Upgrade oxc Rust crates from 0.122.0 to 0.123.0 - Upgrade `@oxc-project/runtime` and `@oxc-project/types` from 0.122.0 to 0.123.0 - Adapt to breaking changes: `Atom` → `Str`, `AstBuilder::atom()` → `AstBuilder::str()`, constants renamed accordingly ## Breaking changes adapted - `oxc::span::Atom<'a>` renamed to `oxc::span::Str<'a>` — updated all imports and type usages (11 source files) - `AstBuilder::atom()` renamed to `AstBuilder::str()` — updated all call sites (10 source files) - `CJS_*_REF_ATOM` constants renamed to `CJS_*_REF_STR` ## Note `oxc-minify`, `oxc-parser`, `oxc-transform` npm packages remain at 0.121.0 (no 0.123.0 published yet). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
1 parent 29d3990 commit 2780deb

File tree

22 files changed

+218
-199
lines changed

22 files changed

+218
-199
lines changed

Cargo.lock

Lines changed: 103 additions & 89 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ napi-build = { version = "2.2.2" }
234234
napi-derive = { version = "3.0.0", default-features = false, features = ["type-def", "tracing"] }
235235

236236
# oxc crates with the same version
237-
oxc = { version = "0.122.0", features = [
237+
oxc = { version = "0.123.0", features = [
238238
"ast_visit",
239239
"transformer",
240240
"minifier",
@@ -246,13 +246,13 @@ oxc = { version = "0.122.0", features = [
246246
"regular_expression",
247247
"cfg",
248248
] }
249-
oxc_allocator = { version = "0.122.0", features = ["pool"] }
250-
oxc_ecmascript = { version = "0.122.0" }
251-
oxc_napi = { version = "0.122.0" }
252-
oxc_minify_napi = { version = "0.122.0" }
253-
oxc_parser_napi = { version = "0.122.0" }
254-
oxc_transform_napi = { version = "0.122.0" }
255-
oxc_traverse = { version = "0.122.0" }
249+
oxc_allocator = { version = "0.123.0", features = ["pool"] }
250+
oxc_ecmascript = { version = "0.123.0" }
251+
oxc_napi = { version = "0.123.0" }
252+
oxc_minify_napi = { version = "0.123.0" }
253+
oxc_parser_napi = { version = "0.123.0" }
254+
oxc_transform_napi = { version = "0.123.0" }
255+
oxc_traverse = { version = "0.123.0" }
256256

257257
# oxc crates in their own repos
258258
# Versions must be relaxed for usage in oxc.

crates/rolldown/src/ast_scanner/impl_visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ impl<'me, 'ast: 'me> Visit<'ast> for AstScanner<'me, 'ast> {
339339
let should_warn = parent
340340
.as_member_expression_kind()
341341
.map(|member_expr| {
342-
let static_name = member_expr.static_property_name().unwrap_or(ast::Atom::from(""));
342+
let static_name = member_expr.static_property_name().unwrap_or(ast::Str::from(""));
343343
let is_special_property =
344344
static_name == "url" || static_name == "dirname" || static_name == "filename";
345345
let format = &self.immutable_ctx.options.format;

crates/rolldown/src/hmr/hmr_ast_finalizer.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ use oxc::{
55
ast::{self, ExportDefaultDeclarationKind, Expression, ObjectPropertyKind, Statement},
66
},
77
semantic::{IsGlobalReference, Scoping, SymbolId},
8-
span::{Atom, SPAN, Span},
8+
span::{SPAN, Span, Str},
99
};
1010

1111
use rolldown_common::{
1212
ExternalModule, ImportRecordIdx, IndexModules, Module, ModuleIdx, NormalModule,
1313
};
14-
use rolldown_ecmascript::CJS_REQUIRE_REF_ATOM;
14+
use rolldown_ecmascript::CJS_REQUIRE_REF_STR;
1515
use rolldown_ecmascript_utils::{AstSnippet, ExpressionExt};
1616
use rolldown_utils::{
1717
ecmascript::is_validate_identifier_name,
@@ -59,7 +59,7 @@ pub struct HmrAstFinalizer<'me, 'ast> {
5959
pub generated_static_import_infos: FxHashMap<ModuleIdx, String>,
6060
// We need to store the static import statements for external separately, so we could put them outside of the `try` block.
6161
pub generated_static_import_stmts_from_external: FxIndexMap<ModuleIdx, ast::Statement<'ast>>,
62-
pub named_exports: FxHashMap<Atom<'ast>, NamedExport>,
62+
pub named_exports: FxHashMap<Str<'ast>, NamedExport>,
6363
}
6464

6565
impl<'ast> HmrAstFinalizer<'_, 'ast> {
@@ -390,7 +390,7 @@ impl<'ast> HmrAstFinalizer<'_, 'ast> {
390390
// let arguments = self.snippet.builder.vec_from_array([
391391
// ast::Argument::StringLiteral(self.snippet.builder.alloc_string_literal(
392392
// SPAN,
393-
// self.snippet.builder.atom(&self.module.stable_id),
393+
// self.snippet.builder.str(&self.module.stable_id),
394394
// None,
395395
// )),
396396
// module_exports,
@@ -432,7 +432,7 @@ impl<'ast> HmrAstFinalizer<'_, 'ast> {
432432
[self.module.hmr_info.module_request_to_import_record_idx[string_literal.value.as_str()]];
433433
let Some(module_idx) = import_record.resolved_module else { return };
434434
// Use stable module ID for consistent runtime lookup
435-
string_literal.value = self.snippet.builder.atom(self.modules[module_idx].stable_id());
435+
string_literal.value = self.snippet.builder.str(self.modules[module_idx].stable_id());
436436
}
437437
ast::Argument::ArrayExpression(array_expression) => {
438438
// `import.meta.hot.accept(['./dep1.js', './dep2.js'], ...)`
@@ -443,7 +443,7 @@ impl<'ast> HmrAstFinalizer<'_, 'ast> {
443443
[string_literal.value.as_str()]];
444444
let Some(module_idx) = import_record.resolved_module else { return };
445445
// Use stable module ID for consistent runtime lookup
446-
string_literal.value = self.snippet.builder.atom(self.modules[module_idx].stable_id());
446+
string_literal.value = self.snippet.builder.str(self.modules[module_idx].stable_id());
447447
}
448448
});
449449
}
@@ -605,7 +605,7 @@ impl<'ast> HmrAstFinalizer<'_, 'ast> {
605605
NONE,
606606
self.builder.vec1(ast::Argument::StringLiteral(self.builder.alloc_string_literal(
607607
SPAN,
608-
self.builder.atom(&importee.id),
608+
self.builder.str(&importee.id),
609609
None,
610610
))),
611611
false,
@@ -616,19 +616,19 @@ impl<'ast> HmrAstFinalizer<'_, 'ast> {
616616
let quasis = self.builder.vec_from_iter([
617617
self.builder.template_element(
618618
SPAN,
619-
ast::TemplateElementValue { raw: self.builder.atom("/@vite/lazy?id="), cooked: None },
619+
ast::TemplateElementValue { raw: self.builder.str("/@vite/lazy?id="), cooked: None },
620620
false,
621621
false,
622622
),
623623
self.builder.template_element(
624624
SPAN,
625-
ast::TemplateElementValue { raw: self.builder.atom("&clientId="), cooked: None },
625+
ast::TemplateElementValue { raw: self.builder.str("&clientId="), cooked: None },
626626
false,
627627
false,
628628
),
629629
self.builder.template_element(
630630
SPAN,
631-
ast::TemplateElementValue { raw: self.builder.atom(""), cooked: None },
631+
ast::TemplateElementValue { raw: self.builder.str(""), cooked: None },
632632
true,
633633
false,
634634
),
@@ -657,7 +657,7 @@ impl<'ast> HmrAstFinalizer<'_, 'ast> {
657657
self.snippet.builder.vec1(ast::Argument::StringLiteral(
658658
self.snippet.builder.alloc_string_literal(
659659
SPAN,
660-
self.snippet.builder.atom(&importee.stable_id),
660+
self.snippet.builder.str(&importee.stable_id),
661661
None,
662662
),
663663
)),
@@ -731,7 +731,7 @@ impl<'ast> HmrAstFinalizer<'_, 'ast> {
731731

732732
// Rewrite standalone `require` to `__rolldown_runtime__.loadExports`
733733
if let Some(id_ref) = it.as_identifier()
734-
&& id_ref.name == CJS_REQUIRE_REF_ATOM
734+
&& id_ref.name == CJS_REQUIRE_REF_STR
735735
&& id_ref.is_global_reference(scoping)
736736
&& !ctx.parent().is_call_expression()
737737
{
@@ -747,7 +747,7 @@ impl<'ast> HmrAstFinalizer<'_, 'ast> {
747747
if !call_expr
748748
.callee
749749
.as_identifier()
750-
.is_some_and(|id| id.name == CJS_REQUIRE_REF_ATOM && id.is_global_reference(scoping))
750+
.is_some_and(|id| id.name == CJS_REQUIRE_REF_STR && id.is_global_reference(scoping))
751751
{
752752
return;
753753
}

crates/rolldown/src/hmr/impl_traverse_for_hmr_ast_finalizer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use oxc::{
55
};
66
use oxc_traverse::Traverse;
77
use rolldown_ecmascript::{
8-
CJS_EXPORTS_REF_ATOM, CJS_MODULE_REF_ATOM, CJS_ROLLDOWN_EXPORTS_REF,
8+
CJS_EXPORTS_REF_STR, CJS_MODULE_REF_STR, CJS_ROLLDOWN_EXPORTS_REF,
99
CJS_ROLLDOWN_EXPORTS_REF_IDENT, CJS_ROLLDOWN_MODULE_REF_IDENT,
1010
};
1111
use rolldown_ecmascript_utils::ExpressionExt;
@@ -162,7 +162,7 @@ impl<'ast> Traverse<'ast, ()> for HmrAstFinalizer<'_, 'ast> {
162162
self
163163
.snippet
164164
.builder
165-
.binding_pattern_binding_identifier(SPAN, self.snippet.builder.atom(init_fn_name)),
165+
.binding_pattern_binding_identifier(SPAN, self.snippet.builder.str(init_fn_name)),
166166
NONE,
167167
Some(ast::Expression::CallExpression(initializer_call)),
168168
false,
@@ -206,10 +206,10 @@ impl<'ast> Traverse<'ast, ()> for HmrAstFinalizer<'_, 'ast> {
206206
*node = self.snippet.id_ref_expr(binding_name.as_str(), ident.span);
207207
return;
208208
}
209-
} else if ident.name == CJS_EXPORTS_REF_ATOM {
209+
} else if ident.name == CJS_EXPORTS_REF_STR {
210210
// Rewrite `exports` to `__rolldown_exports__`
211211
ident.name = CJS_ROLLDOWN_EXPORTS_REF_IDENT;
212-
} else if ident.name == CJS_MODULE_REF_ATOM {
212+
} else if ident.name == CJS_MODULE_REF_STR {
213213
// Rewrite `module` to `__rolldown_module__`
214214
ident.name = CJS_ROLLDOWN_MODULE_REF_IDENT;
215215
}

crates/rolldown/src/hmr/utils.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ pub trait HmrAstBuilder<'any, 'ast> {
1515
fn module(&self) -> &NormalModule;
1616

1717
// `${ns_name}` in `var ${ns_name} = ...`
18-
fn binding_name_for_namespace_object_ref_atom(&self) -> ast::Atom<'ast>;
18+
fn binding_name_for_namespace_object_ref_atom(&self) -> ast::Str<'ast>;
1919

2020
// `$hot_name` in var `$hot_name = __rolldown_runtime__.createModuleHotContext($stable_id);`
21-
fn alias_name_for_import_meta_hot(&self) -> ast::Atom<'ast>;
21+
fn alias_name_for_import_meta_hot(&self) -> ast::Str<'ast>;
2222

2323
fn cjs_module_name() -> &'static str;
2424

@@ -67,7 +67,7 @@ pub trait HmrAstBuilder<'any, 'ast> {
6767
let arguments = self.builder().vec_from_array([
6868
ast::Argument::StringLiteral(self.builder().alloc_string_literal(
6969
SPAN,
70-
self.builder().atom(&self.module().stable_id),
70+
self.builder().str(&self.module().stable_id),
7171
None,
7272
)),
7373
module_exports,
@@ -122,7 +122,7 @@ pub trait HmrAstBuilder<'any, 'ast> {
122122
self.builder().vec1(ast::Argument::StringLiteral(
123123
self.builder().alloc_string_literal(
124124
SPAN,
125-
self.builder().atom(&self.module().stable_id),
125+
self.builder().str(&self.module().stable_id),
126126
None,
127127
),
128128
)),
@@ -147,12 +147,12 @@ impl<'any, 'ast> HmrAstBuilder<'any, 'ast> for HmrAstFinalizer<'any, 'ast> {
147147
self.module
148148
}
149149

150-
fn binding_name_for_namespace_object_ref_atom(&self) -> ast::Atom<'ast> {
151-
self.builder().atom(MODULE_EXPORTS_NAME_FOR_ESM)
150+
fn binding_name_for_namespace_object_ref_atom(&self) -> ast::Str<'ast> {
151+
self.builder().str(MODULE_EXPORTS_NAME_FOR_ESM)
152152
}
153153

154-
fn alias_name_for_import_meta_hot(&self) -> ast::Atom<'ast> {
155-
self.builder().atom(&format!("hot_{}", self.module.repr_name))
154+
fn alias_name_for_import_meta_hot(&self) -> ast::Str<'ast> {
155+
self.builder().str(&format!("hot_{}", self.module.repr_name))
156156
}
157157

158158
fn cjs_module_name() -> &'static str {
@@ -169,15 +169,15 @@ impl<'any, 'ast> HmrAstBuilder<'any, 'ast> for ScopeHoistingFinalizer<'any, 'ast
169169
self.ctx.module
170170
}
171171

172-
fn binding_name_for_namespace_object_ref_atom(&self) -> ast::Atom<'ast> {
172+
fn binding_name_for_namespace_object_ref_atom(&self) -> ast::Str<'ast> {
173173
let name = self.canonical_name_for(self.ctx.module.namespace_object_ref);
174-
self.builder().atom(name)
174+
self.builder().str(name)
175175
}
176176

177-
fn alias_name_for_import_meta_hot(&self) -> ast::Atom<'ast> {
177+
fn alias_name_for_import_meta_hot(&self) -> ast::Str<'ast> {
178178
let name =
179179
self.canonical_name_for(self.ctx.module.hmr_hot_ref.expect("HMR hot ref should be set"));
180-
self.builder().atom(name)
180+
self.builder().str(name)
181181
}
182182

183183
fn cjs_module_name() -> &'static str {

crates/rolldown/src/module_finalizers/hmr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl<'ast> ScopeHoistingFinalizer<'_, 'ast> {
5959
string_literal.value = self
6060
.snippet
6161
.builder
62-
.atom(self.ctx.modules[import_record.into_resolved_module()].stable_id());
62+
.str(self.ctx.modules[import_record.into_resolved_module()].stable_id());
6363
}
6464
ast::Argument::ArrayExpression(array_expression) => {
6565
// `import.meta.hot.accept(['./dep1.js', './dep2.js'], ...)`
@@ -74,7 +74,7 @@ impl<'ast> ScopeHoistingFinalizer<'_, 'ast> {
7474
string_literal.value = self
7575
.snippet
7676
.builder
77-
.atom(self.ctx.modules[import_record.into_resolved_module()].stable_id());
77+
.str(self.ctx.modules[import_record.into_resolved_module()].stable_id());
7878
}
7979
});
8080
}

crates/rolldown/src/module_finalizers/impl_visit_mut.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use itertools::Itertools;
22
use oxc::allocator::FromIn;
33
use oxc::ast::AstType;
44
use oxc::ast::ast::{AssignmentTarget, JSXMemberExpression};
5-
use oxc::span::{Atom, CompactStr};
5+
use oxc::span::{CompactStr, Str};
66
use oxc::{
77
allocator::{self, Dummy as _, IntoIn, TakeIn},
88
ast::{
@@ -469,7 +469,7 @@ impl<'ast> VisitMut<'ast> for ScopeHoistingFinalizer<'_, 'ast> {
469469
ThisExprReplaceKind::Context => {
470470
*expr = self.snippet.builder.expression_identifier(
471471
SPAN,
472-
Atom::from_in(self.ctx.options.context.as_str(), self.alloc),
472+
Str::from_in(self.ctx.options.context.as_str(), self.alloc),
473473
);
474474
}
475475
}

crates/rolldown/src/module_finalizers/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ impl<'me, 'ast> ScopeHoistingFinalizer<'me, 'ast> {
768768
self.snippet.builder.vec_from_array([
769769
ast::Argument::StringLiteral(self.snippet.builder.alloc_string_literal(
770770
SPAN,
771-
self.snippet.builder.atom(relative_asset_path),
771+
self.snippet.builder.str(relative_asset_path),
772772
None,
773773
)),
774774
ast::Argument::StaticMemberExpression(
@@ -1230,7 +1230,7 @@ impl<'me, 'ast> ScopeHoistingFinalizer<'me, 'ast> {
12301230
self
12311231
.snippet
12321232
.builder
1233-
.expression_identifier(SPAN, self.snippet.builder.atom(to_esm_fn_name)),
1233+
.expression_identifier(SPAN, self.snippet.builder.str(to_esm_fn_name)),
12341234
self.snippet.call_expr_expr(importee_wrapper_ref_name),
12351235
self.ctx.module.should_consider_node_esm_spec_for_dynamic_import(),
12361236
),
@@ -1695,7 +1695,7 @@ impl<'me, 'ast> ScopeHoistingFinalizer<'me, 'ast> {
16951695
let name_ref = self.canonical_ref_for_runtime("__name");
16961696
let (finalized_callee, _) = self.finalized_expr_for_symbol_ref(name_ref, false, false);
16971697
let target =
1698-
self.snippet.builder.expression_identifier(SPAN, self.snippet.builder.atom(new_name));
1698+
self.snippet.builder.expression_identifier(SPAN, self.snippet.builder.str(new_name));
16991699
statements.insert(
17001700
*stmt_index,
17011701
self.snippet.builder.statement_expression(
@@ -2063,7 +2063,7 @@ impl<'me, 'ast> ScopeHoistingFinalizer<'me, 'ast> {
20632063
self
20642064
.snippet
20652065
.builder
2066-
.binding_pattern_binding_identifier(SPAN, self.snippet.builder.atom("m")),
2066+
.binding_pattern_binding_identifier(SPAN, self.snippet.builder.str("m")),
20672067
NONE,
20682068
NONE,
20692069
false,

crates/rolldown/src/stages/link_stage/generate_lazy_export.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ fn json_object_expr_to_esm(link_staged: &mut LinkStage, module_idx: ModuleIdx) -
164164
&mut property.value,
165165
snippet
166166
.builder
167-
.expression_identifier(SPAN, snippet.builder.atom(legitimized_ident.as_str())),
167+
.expression_identifier(SPAN, snippet.builder.str(legitimized_ident.as_str())),
168168
);
169169
// TODO(shulaoda): Waiting for oxc transform to support the ES feature `ShorthandProperties`.
170170
if key == "__proto__" {
@@ -174,7 +174,7 @@ fn json_object_expr_to_esm(link_staged: &mut LinkStage, module_idx: ModuleIdx) -
174174
property.key = ast::PropertyKey::StaticIdentifier(
175175
snippet
176176
.builder
177-
.alloc_identifier_name(SPAN, snippet.builder.atom(legitimized_ident.as_ref())),
177+
.alloc_identifier_name(SPAN, snippet.builder.str(legitimized_ident.as_ref())),
178178
);
179179
}
180180
match index_map.entry(legitimized_ident) {

0 commit comments

Comments
 (0)