mirror of
https://github.com/oxc-project/oxc.git
synced 2026-09-14 19:36:11 +08:00
baf022d74d
Closes the migration tracked in #23043. The new builder API (methods on the AST types themselves) has been in place for a while, all Oxc crates are migrated, and every crate which uses `AstBuilder` already enables `disable_old_builder` in its tests. The module docs said "after a few weeks, we will remove `AstBuilder`'s own methods entirely" — this does that. ## What's removed - `crates/oxc_ast/src/generated/ast_builder.rs` and `builder/methods.rs` — `AstBuilder`'s own node and primitive constructors. - `AstBuilderGenerator`, which produced the former. - The `disable_old_builder` Cargo feature, plus the dev-dependency hacks it required across 33 manifests. Eight crates depended on `oxc_ast` *purely* to turn the feature on; those deps and their `cargo-shear` ignore entries are gone too. ## One thing worth reviewing `AstBuilderGenerator` owned the `#[builder(default)]` / `#[builder(skip)]` attr registration that `BuilderMethodsGenerator` only *reads* — its doc comment said as much. Deleting it naively would have silently dropped `skip`/`default` handling for the 12 AST types using those attrs, so `attrs()` and `parse_attr()` move to `BuilderMethodsGenerator`. The evidence this was faithful: after regenerating, `builder_methods.rs` and every other generated file are **byte-identical**. The only generated change in the diff is the deletion. ## Breaking changes - `AstBuilder`'s own methods are gone. Use the AST type methods: `Statement::new_expression_statement(span, expr, &builder)` instead of `builder.statement_expression(span, expr)`. - `AstBuilder` is no longer `Copy`/`Clone`, and its `allocator` field is private — use the `allocator` method from `GetAllocator`. - `AstBuilder` and `NONE` are no longer re-exported from the crate root; import them from `oxc_ast::builder`. (The `disable_old_builder` feature already gated these off, so nothing in-tree used the root path.) - The `disable_old_builder` feature no longer exists — remove it from any manifest that sets it. A migration note covering all of the above is in `crates/oxc_ast/src/builder/mod.rs`. --- Implemented with AI assistance (Claude Code); design, review, and verification driven by the author per the repo AI-usage policy.
171 lines
3.8 KiB
TOML
171 lines
3.8 KiB
TOML
[package]
|
|
name = "oxc_benchmark"
|
|
version = "0.0.0"
|
|
authors.workspace = true
|
|
edition.workspace = true
|
|
homepage.workspace = true
|
|
keywords.workspace = true
|
|
license.workspace = true
|
|
publish = false
|
|
repository.workspace = true
|
|
description.workspace = true
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[lib]
|
|
test = false
|
|
bench = false
|
|
doctest = false
|
|
|
|
[[bench]]
|
|
name = "lexer"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "parser"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "transformer"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "semantic"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "linter"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "codegen"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "formatter"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "minifier"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "pipeline"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "react_compiler"
|
|
harness = false
|
|
required-features = ["react_compiler"]
|
|
|
|
# Only run in CI
|
|
[[bench]]
|
|
name = "parser_napi"
|
|
harness = false
|
|
bench = false
|
|
|
|
# All `oxc_*` dependencies optional as on CI we build each benchmark separately
|
|
# with only the crates it needs, to speed up the builds
|
|
[dependencies]
|
|
oxc = { workspace = true, optional = true, features = ["full"] }
|
|
oxc_allocator = { workspace = true, optional = true }
|
|
oxc_ast = { workspace = true, optional = true, features = ["serialize"] }
|
|
oxc_ast_visit = { workspace = true, optional = true, features = ["serialize"] }
|
|
oxc_codegen = { workspace = true, optional = true, features = ["sourcemap"] }
|
|
oxc_estree_tokens = { workspace = true, optional = true }
|
|
oxc_formatter = { workspace = true, optional = true }
|
|
oxc_isolated_declarations = { workspace = true, optional = true }
|
|
oxc_linter = { workspace = true, optional = true }
|
|
oxc_mangler = { workspace = true, optional = true }
|
|
oxc_minifier = { workspace = true, optional = true }
|
|
oxc_parser = { workspace = true, features = [
|
|
"benchmarking",
|
|
"regular_expression",
|
|
], optional = true }
|
|
oxc_react_compiler = { workspace = true, optional = true }
|
|
oxc_semantic = { workspace = true, optional = true }
|
|
oxc_span = { workspace = true, optional = true, features = ["schemars", "serialize"] }
|
|
oxc_tasks_common = { workspace = true, optional = true }
|
|
oxc_transformer = { workspace = true, optional = true }
|
|
|
|
criterion2 = { workspace = true }
|
|
|
|
# Only for lexer benchmark
|
|
cow-utils = { workspace = true, optional = true }
|
|
|
|
# Only for NAPI benchmark
|
|
serde = { workspace = true, optional = true }
|
|
serde_json = { workspace = true, optional = true }
|
|
|
|
[features]
|
|
default = ["compiler", "linter"]
|
|
codspeed = ["criterion2/codspeed"]
|
|
codspeed_napi = ["criterion2/codspeed", "dep:serde", "dep:serde_json"]
|
|
|
|
# Features for running benchmarks with minimum dependencies.
|
|
# "compiler" feature includes: lexer, parser, transformer, semantic, minifier, codegen, formatter
|
|
# "linter" feature includes: linter
|
|
compiler = [
|
|
"dep:oxc",
|
|
"dep:oxc_allocator",
|
|
"dep:oxc_ast",
|
|
"dep:oxc_ast_visit",
|
|
"dep:oxc_codegen",
|
|
"dep:oxc_estree_tokens",
|
|
"dep:oxc_formatter",
|
|
"dep:oxc_isolated_declarations",
|
|
"dep:oxc_mangler",
|
|
"dep:oxc_minifier",
|
|
"dep:oxc_parser",
|
|
"dep:oxc_semantic",
|
|
"dep:oxc_span",
|
|
"dep:oxc_tasks_common",
|
|
"dep:oxc_transformer",
|
|
"dep:cow-utils",
|
|
]
|
|
linter = [
|
|
"dep:oxc_allocator",
|
|
"dep:oxc_linter",
|
|
"dep:oxc_parser",
|
|
"dep:oxc_semantic",
|
|
"dep:oxc_span",
|
|
"dep:oxc_tasks_common",
|
|
"oxc_semantic/cfg",
|
|
]
|
|
react_compiler = [
|
|
"dep:oxc_allocator",
|
|
"dep:oxc_parser",
|
|
"dep:oxc_react_compiler",
|
|
"dep:oxc_semantic",
|
|
"dep:oxc_span",
|
|
"dep:oxc_tasks_common",
|
|
]
|
|
|
|
[dev-dependencies]
|
|
rustc-hash = { workspace = true }
|
|
|
|
[package.metadata.cargo-shear]
|
|
ignored = [
|
|
"oxc",
|
|
"oxc_allocator",
|
|
"oxc_ast",
|
|
"oxc_ast_visit",
|
|
"oxc_codegen",
|
|
"oxc_estree_tokens",
|
|
"oxc_formatter",
|
|
"oxc_isolated_declarations",
|
|
"oxc_linter",
|
|
"oxc_mangler",
|
|
"oxc_minifier",
|
|
"oxc_parser",
|
|
"oxc_react_compiler",
|
|
"oxc_semantic",
|
|
"oxc_span",
|
|
"oxc_tasks_common",
|
|
"oxc_transformer",
|
|
"serde",
|
|
"serde_json",
|
|
"cow-utils",
|
|
]
|