Skip to content

refactor(str)!: rename Atom to Str#20835

Open
overlookmotel wants to merge 1 commit intomainfrom
om/03-29-refactor_str_rename_atom_to_str_
Open

refactor(str)!: rename Atom to Str#20835
overlookmotel wants to merge 1 commit intomainfrom
om/03-29-refactor_str_rename_atom_to_str_

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Mar 29, 2026

Pure refactor.

Rename Atom to Str. The name "Atom" is a leftover from when we used to intern strings (years ago), and is misleading now.

Just call it Str. This follows the naming convention we have for arena-allocated versions of other types e.g. Box, Vec, HashMap - which we name the same as the native equivalents but with a lifetime (Box<'a> not ArenaBox<'a>, so Str<'a> not ArenaStr<'a>).

Rename all variables that contained "atom", and methods which relate to Strs to match the new type name.

Rename as_atom methods to as_arena_str. The longer name is required here to disambiguate from as_str methods which return a &str.

Some variables called "atom" still exist in oxc_regular_expression crate - that's a different meaning of "atom" - the meaning defined in regexp spec.

The diff of this PR is large but it's 100% renaming. No substantive or unrelated changes whatsoever.

Copy link
Copy Markdown
Member Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of 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.

@github-actions github-actions bot added A-linter Area - Linter A-parser Area - Parser A-semantic Area - Semantic A-minifier Area - Minifier A-ast Area - AST A-transformer Area - Transformer / Transpiler A-codegen Area - Code Generation A-isolated-declarations Isolated Declarations A-ast-tools Area - AST tools A-formatter Area - Formatter C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Mar 29, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 29, 2026

Merging this PR will not alter performance

✅ 48 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing om/03-29-refactor_str_rename_atom_to_str_ (771dc8c) with main (868448e)

Open in CodSpeed

Footnotes

  1. 8 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.

@overlookmotel
Copy link
Copy Markdown
Member Author

@Boshen I'm keen to get this into tomorrow's release, so I can make the corresponding changes to Rolldown this week. It'd be too much in one go if had to update Rolldown for introduction of Wtf8Str in the same cycle.

If you're OK with this, please can you merge?

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR performs a workspace-wide refactor to rename the arena-backed string type from Atom<'a> to Str<'a> (and associated helpers/macros), aligning terminology with current behavior (no interning) and existing arena-allocated type naming patterns.

Changes:

  • Rename Atom<'a> to Str<'a> across crates, including container types and method signatures.
  • Rename related helpers/macros (e.g. format_atom!format_str!, as_atomas_arena_str, atom* builder helpers → str*).
  • Update generators, serializers/deserializers, and documentation/comments to use the new naming.

Reviewed changes

Copilot reviewed 103 out of 107 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tasks/transform_checker/src/lib.rs Updates collected reference name storage from Atom to Str.
tasks/ast_tools/src/schema/extensions/estree.rs Updates ESTree schema docs to reference Str.
tasks/ast_tools/src/schema/defs/primitive.rs Updates primitive type handling/signatures for Str.
tasks/ast_tools/src/parse/parse.rs Updates parser special-casing from Atom to Str.
tasks/ast_tools/src/parse/mod.rs Updates module docs listing special cases to Str.
tasks/ast_tools/src/main.rs Updates ast_tools docs to reference Str.
tasks/ast_tools/src/generators/typescript.rs Maps Str primitives to TS string.
tasks/ast_tools/src/generators/raw_transfer_lazy.rs Updates raw-transfer generator logic for Str primitives.
tasks/ast_tools/src/generators/raw_transfer.rs Updates raw-transfer generator logic for Str primitives.
tasks/ast_tools/src/generators/ast_builder.rs Updates generated builder helper usage from atom to str.
tasks/ast_tools/src/generators/assert_layouts.rs Updates layout assumptions/docs and matching for Str.
tasks/ast_tools/src/derives/estree.rs Updates ESTree derive codegen for json-safe Str fields.
napi/parser/src/raw_transfer_types.rs Switches NAPI raw-transfer diagnostic strings to Str + format_str!.
crates/oxc_traverse/src/generated/ancestor.rs Updates generated ancestor accessors returning Str.
crates/oxc_transformer_plugins/src/replace_global_defines.rs Updates cached/property-name handling to Str/as_arena_str.
crates/oxc_transformer_plugins/src/module_runner_transform.rs Updates import binding key/value string handling to Str.
crates/oxc_transformer_plugins/src/inject_global_variables.rs Updates dot-define caching and AST string creation to Str.
crates/oxc_transformer/src/utils/ast_builder.rs Updates AST builder helpers to use Str.
crates/oxc_transformer/src/typescript/rewrite_extensions.rs Updates rewritten-specifier return type and helper calls to Str.
crates/oxc_transformer/src/typescript/enum.rs Updates enum member maps and constant string values to Str.
crates/oxc_transformer/src/typescript/annotations.rs Updates assignment name storage to Str.
crates/oxc_transformer/src/regexp/mod.rs Updates regexp flags string creation to Str.
crates/oxc_transformer/src/plugins/styled_components.rs Updates derived names/ids/template literal raw updates to Str.
crates/oxc_transformer/src/jsx/refresh.rs Updates JSX refresh identifier handling and stored names to Str.
crates/oxc_transformer/src/jsx/jsx_source.rs Updates filename/source path literal creation to Str.
crates/oxc_transformer/src/jsx/jsx_impl.rs Updates JSX implementation string plumbing (pragma parts, literals) to Str.
crates/oxc_transformer/src/jsx/display_name.rs Updates display name computation/addition to Str.
crates/oxc_transformer/src/es2022/class_static_block.rs Updates unique key generation to Str.
crates/oxc_transformer/src/es2022/class_properties/utils.rs Updates underscore ident construction to Str.
crates/oxc_transformer/src/es2022/class_properties/prop_decl.rs Updates property key construction to Str.
crates/oxc_transformer/src/es2022/class_properties/private_field.rs Updates helper message/property names to Str.
crates/oxc_transformer/src/es2022/class_properties/constructor.rs Updates .call property creation to Str.
crates/oxc_transformer/src/es2018/object_rest_spread.rs Updates literal-to-string conversion helper to str_from_cow.
crates/oxc_transformer/src/decorator/legacy/mod.rs Updates generated storage names/bindings to Str.
crates/oxc_transformer/src/common/module_imports.rs Updates module import store key types/docs and APIs to Str.
crates/oxc_transformer/src/common/helper_loader.rs Updates helper runtime source string construction to Str.
crates/oxc_syntax/src/module_record.rs Updates module record map keys and name carriers to Str.
crates/oxc_str/src/str.rs Introduces Str<'a> type (renamed from Atom) and format_str! macro.
crates/oxc_str/src/lib.rs Re-exports Str and updates crate docs/module structure.
crates/oxc_str/src/ident.rs Renames Ident::as_atomas_arena_str and related conversions to Str.
crates/oxc_str/src/compact_str.rs Updates docs to refer to Str as the lifetimed counterpart.
crates/oxc_span/src/lib.rs Switches re-exports/traits from Atom to Str and exports format_str.
crates/oxc_semantic/src/lib.rs Updates tests/imports using Str instead of Atom.
crates/oxc_semantic/src/checker/typescript.rs Updates duplicate bound-name tracking map key type to Str.
crates/oxc_semantic/src/checker/javascript.rs Updates numeric literal helper signature from Atom to Str.
crates/oxc_regular_expression/src/parser/reader/reader_impl.rs Renames reader slice helper atomstr and returns Str.
crates/oxc_regular_expression/src/parser/reader/mod.rs Updates reader tests to use reader.str(...).
crates/oxc_regular_expression/src/parser/pattern_parser/state.rs Updates capturing-group name sets/types to Str.
crates/oxc_regular_expression/src/parser/pattern_parser/pattern_parser_impl.rs Updates regexp parser string plumbing/types to Str.
crates/oxc_regular_expression/src/parser/flags_parser.rs Updates diagnostics to use reader.str(...).
crates/oxc_regular_expression/src/ast.rs Updates regexp AST node string fields to Str.
crates/oxc_parser/src/module_record.rs Updates module record builder APIs to use Str keys.
crates/oxc_parser/src/lexer/number.rs Updates BigInt parsing return type and formatting macro to Str/format_str!.
crates/oxc_parser/src/jsx/mod.rs Updates JSX token text/raw storage to Str.
crates/oxc_parser/src/js/statement.rs Updates hashbang/directive raw directive storage to Str.
crates/oxc_parser/src/js/module.rs Updates import-attribute key access to as_arena_str.
crates/oxc_parser/src/js/expression.rs Updates literal raw/value fields and regexp pattern text to Str.
crates/oxc_minifier/tests/ecmascript/to_string.rs Updates test literal raw type to Str.
crates/oxc_minifier/tests/ecmascript/array_join.rs Updates test literal raw type to Str.
crates/oxc_minifier/src/traverse_context/ecma_context.rs Updates formatting and string literal creation helpers to format_str!/str_from_cow.
crates/oxc_minifier/src/state.rs Updates class-private symbol tracking to Str.
crates/oxc_minifier/src/peephole/substitute_alternate_syntax.rs Updates string literal construction to Str.
crates/oxc_minifier/src/peephole/replace_known_methods.rs Updates template/string literal construction to Str.
crates/oxc_minifier/src/peephole/remove_unused_private_members.rs Updates private-name tracking variables/types to Str.
crates/oxc_minifier/src/peephole/fold_constants.rs Updates concatenation/template raw/cooked string building to Str.
crates/oxc_minifier/src/keep_var.rs Updates tracked var names to Str.
crates/oxc_minifier/src/generated/ancestor.rs Updates generated ancestor accessors returning Str.
crates/oxc_mangler/src/lib.rs Updates exported name tracking to Str and as_arena_str.
crates/oxc_linter/src/utils/express.rs Updates endpoint extraction return type to Str.
crates/oxc_linter/src/rules/unicorn/prefer_string_starts_ends_with.rs Updates fixer-created string literal to Str.
crates/oxc_linter/src/rules/unicorn/prefer_string_replace_all.rs Updates fixer-created string literal to Str.
crates/oxc_linter/src/rules/unicorn/prefer_keyboard_event_key.rs Updates fixer-created string literal to Str.
crates/oxc_linter/src/rules/unicorn/prefer_dom_node_dataset.rs Updates fixer-created string literal to Str.
crates/oxc_linter/src/rules/typescript/parameter_properties.rs Updates property-name maps/returns to Str.
crates/oxc_linter/src/rules/typescript/no_unnecessary_parameter_property_assignment.rs Updates assigned-name sets and property-name extraction to Str.
crates/oxc_linter/src/rules/typescript/class_literal_property_style.rs Updates excluded property sets and as_arena_str conversions.
crates/oxc_linter/src/rules/react/jsx_props_no_spread_multi.rs Updates identifier key tracking to Str.
crates/oxc_linter/src/rules/react/jsx_no_duplicate_props.rs Updates props key tracking to Str.
crates/oxc_linter/src/rules/react/exhaustive_deps.rs Updates dependency chain/name storage to Str and stringification mapping.
crates/oxc_linter/src/rules/oxc/no_async_endpoint_handlers.rs Updates endpoint string passing types to Str.
crates/oxc_linter/src/rules/jest/prefer_mock_promise_shorthand.rs Updates diagnostic string passing to Str.
crates/oxc_linter/src/rules/eslint/no_useless_computed_key.rs Updates raw key type and empty fallback to Str.
crates/oxc_linter/src/rules/eslint/no_unused_vars/ignored.rs Updates tests to use Str.
crates/oxc_isolated_declarations/src/scope.rs Updates scope binding/reference maps to Str.
crates/oxc_isolated_declarations/src/return_type.rs Updates collected binding names to Str.
crates/oxc_isolated_declarations/src/module.rs Updates unique-name generation to use Str builder helpers.
crates/oxc_isolated_declarations/src/lib.rs Updates overload tracking and property sets to Str.
crates/oxc_isolated_declarations/src/enum.rs Updates enum evaluation maps and literal string creation to Str.
crates/oxc_formatter/src/print/import_declaration.rs Updates import-attribute key access to as_arena_str.
crates/oxc_formatter/src/ast_nodes/generated/ast_nodes.rs Updates generated formatter AST accessors to return Str.
crates/oxc_ecmascript/src/constant_evaluation/call_expr.rs Updates constant-folded string creation to Str.
crates/oxc_codegen/tests/integration/js.rs Updates template literal construction test to Str.
crates/oxc_ast/src/serialize/ts.rs Updates TS serialization helper identifier name to Str.
crates/oxc_ast/src/serialize/literal.rs Updates raw transfer JS deserialization snippets to Str.
crates/oxc_ast/src/serialize/jsx.rs Updates JSX this serialization helper to Str.
crates/oxc_ast/src/generated/ast_builder.rs Updates generated builder APIs to accept/return Str.
crates/oxc_ast/src/ast_kind_impl.rs Updates member-expression static name helper return type to Str.
crates/oxc_ast/src/ast_impl/ts.rs Updates TS name helper return types to Str.
crates/oxc_ast/src/ast_impl/jsx.rs Updates JSX identifier-name helper return type/docs to Str.
crates/oxc_ast/src/ast_impl/js.rs Updates template/member-expression helpers and import-attribute key conversion to Str.
crates/oxc_ast/src/ast_builder_impl.rs Renames arena string helpers from atom* to str* and returns Str.
crates/oxc_ast/src/ast/ts.rs Updates TS AST node string fields to Str.
crates/oxc_ast/src/ast/mod.rs Updates AST re-exports from Atom to Str.
crates/oxc_ast/src/ast/literal.rs Updates literal AST node string fields to Str.
crates/oxc_ast/src/ast/jsx.rs Updates JSX AST node string fields to Str.
crates/oxc_ast/src/ast/js.rs Updates JS AST node string fields (template raw/cooked, directive, hashbang) to Str.
crates/oxc_allocator/src/string_builder.rs Updates docs to reference Str instead of Atom.

@overlookmotel overlookmotel force-pushed the om/03-29-refactor_str_rename_atom_to_str_ branch from 269d684 to 771dc8c Compare March 29, 2026 12:56
@overlookmotel overlookmotel requested a review from Copilot March 29, 2026 12:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 103 out of 107 changed files in this pull request and generated 2 comments.

Copy link
Copy Markdown
Contributor

@camc314 camc314 left a comment

Choose a reason for hiding this comment

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

i've changed the title to mark this as breaking - please revert back if i'm not right!

@camc314 camc314 changed the title refactor(str): rename Atom to Str refactor(str)!: rename Atom to Str Mar 29, 2026
@overlookmotel
Copy link
Copy Markdown
Member Author

Oh yes, definitely breaking! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST A-ast-tools Area - AST tools A-codegen Area - Code Generation A-formatter Area - Formatter A-isolated-declarations Isolated Declarations A-linter Area - Linter A-minifier Area - Minifier A-parser Area - Parser A-semantic Area - Semantic A-transformer Area - Transformer / Transpiler C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants