Commit Graph

33 Commits

Author SHA1 Message Date
Boshen baf022d74d refactor(ast)!: remove old AstBuilder methods (#24563)
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.
2026-07-21 15:22:46 +00:00
overlookmotel 85a6853e0b fix(tasks): enable disable_old_builder Cargo feature for oxc_ast crate for all tasks (#23885)
Part of #23043.

We don't enable `oxc_ast`'s `disable_old_builder` Cargo feature in any of our published crates, or crates that are depended on by published crates.

Tasks are private to the repo, so enable this feature on them, to ensure no usage of legacy `AstBuilder` methods sneak in during the transition period before we delete these methods.
2026-06-28 12:13:17 +00:00
Boshen 423c27e260 test(rust): reenable lib tests that only run for code coverage 2026-01-01 11:12:14 +08:00
Boshen e031056b2f feat(codegen): add sourcemap feature flag (#17305)
Oxlint uses `oxc_codegen` for fixes, but do not require sourcemap.
2025-12-23 10:28:49 +00:00
Boshen cd90549955 feat(tasks/minsize): generate a quick diff for inspection (#12238) 2025-07-12 10:05:04 +00:00
Boshen 1962bc67d4 feat(transformer_plugins): split out oxc_transformer_plugins crate (#10617) 2025-04-25 08:39:56 +00:00
翠 / green 9d62284202 chore(tasks): print diff for minify idempotency assertion (#8161)
Made the assertion error output more easier to understand.

Example output:

![image](https://github.com/user-attachments/assets/445910fb-b389-4884-b4c5-70a095bc523f)

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-12-29 00:55:45 +08:00
Boshen e594c3988d refactor(minifier): clean up peephole_substitute_alternate_syntax.rs (#8111) 2024-12-25 13:54:51 +00:00
camchenry 02d5637dbc perf(ast-tools): use FxHashMap over std::collections::HashMap (#5997) 2024-09-23 18:28:54 +00:00
Boshen 63a830e08c chore(dprint): format toml files (#5599)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-09-08 14:26:16 +08:00
Boshen 83bd40db4e chore: turn off doctest for all [[bin]] 2024-07-14 16:55:19 +08:00
Boshen f3a21a28d7 chore: do not compile test crates that have no tests 2024-06-24 00:20:04 +08:00
Boshen f366d9bd7c chore(minsize): remove brotlic because it takes too long to compile (#2954) 2024-04-13 13:24:25 +08:00
Boshen 95fc28168c chore: apply cargo autoinherit (#2826)
See https://github.com/mainmatter/cargo-autoinherit
2024-03-26 23:57:50 +08:00
Boshen 70a0076eed refactor: remove global allocator from non-user facing apps (#2401)
The runtime performance gains does not out weight the compilation speed from
building the custom allocators, which takes about a minute to build on
slower machines.
2024-02-12 14:09:05 +08:00
renovate[bot] 4b83d97c3b chore(deps): update cargo (#2191) 2024-01-29 11:38:47 +08:00
Boshen 1a576f60a8 refactor(rust): move to workspace lint table (#1444) 2023-11-20 14:38:10 +08:00
Boshen 73d6d40778 rust: do not compile libs and bins that do not have tests (#1342) 2023-11-16 13:35:24 +08:00
Boshen 801d78a3c6 refactor(minifier): make the minifier api only accept an ast (#990) 2023-10-14 00:51:29 +08:00
Boshen 8c12dff8a3 perf: speed tasks run by using a global allocator 2023-10-11 20:30:30 +08:00
Boshen 817f8c295e ci: turn off doc tests because they are slow to compile and run (#961) 2023-10-07 17:01:23 +08:00
Boshen a31c7ac77a refactor(index): use static_assertions 2023-05-24 22:53:11 +08:00
Yoni Feng c1d1846714 Add Brotli size to minsize task output (#377) 2023-05-23 17:00:49 +08:00
Boshen 827cef3311 chore(minsize): use default version of flate2 (removes 2 extra dependencies) 2023-05-23 00:32:00 +08:00
Boshen 14720e7c69 refactor: move SourceType from oxc_ast to oxc_span (#351)
related #350
2023-05-12 23:16:14 +08:00
Boshen 8161ac2800 refactor: clean up Cargo.toml (put features table on top) 2023-05-09 21:53:47 +08:00
Boshen 86c01c7fb8 feat(minifier): use hir (#335) 2023-05-07 17:23:00 +08:00
Boshen 1004a1d197 chore: clean up workspace dependencies (#320) 2023-04-27 11:38:39 +08:00
Boshen 7aca953635 ci: add cargo deny 2023-04-22 22:35:19 +08:00
Boshen 080baaa2db chore: use taplo to reformat toml files 2023-04-22 15:58:59 +08:00
Boshen cfe3dd0869 chore: rust taplo format 2023-04-15 14:14:11 +08:00
Boshen 4c5ece9386 chore(tasks): remove minsize from unit tests as it is too slow 2023-04-15 13:41:52 +08:00
Boshen a7cd845fff feat: add cargo minsize task for tracking minification size (#276)
* feat: add `cargo minsize` task for tracking minification size

* add gzip
2023-04-14 13:07:37 +08:00