@@ -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
1111use 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 ;
1515use rolldown_ecmascript_utils:: { AstSnippet , ExpressionExt } ;
1616use 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
6565impl < ' 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 }
0 commit comments