Skip to content

refactor(es/parser): remove legacy lexer crate#12014

Draft
kdy1 wants to merge 3 commits into
swc-project:mainfrom
kdy1:kdy1/remove-ecma-lexer
Draft

refactor(es/parser): remove legacy lexer crate#12014
kdy1 wants to merge 3 commits into
swc-project:mainfrom
kdy1:kdy1/remove-ecma-lexer

Conversation

@kdy1

@kdy1 kdy1 commented Jul 11, 2026

Copy link
Copy Markdown
Member

Description:

Remove the unmaintained swc_ecma_lexer compatibility crate now that swc_ecma_parser contains the maintained lexer and parser implementation.

  • Delete the swc_ecma_lexer crate and its lockfile entry.
  • Remove the legacy token compatibility API from swc_ecma_parser.
  • Remove the parser's now-unused phf dependency.
  • Update the unstable lexer documentation and the remaining JSX source reference.
  • Add a changeset for the affected published crates.

BREAKING CHANGE:

The swc_ecma_lexer crate and the legacy swc_ecma_parser::token API are removed. Consumers that need direct lexer token access should use swc_ecma_parser with its unstable feature.

Validation:

  • cargo metadata --no-deps
  • cargo test -p swc_ecma_parser
  • cargo test -p swc_ecma_transforms_react
  • cargo fmt --all
  • cargo clippy --all --all-targets -- -D warnings

Related issue (if exists):

N/A

@kdy1 kdy1 requested review from a team as code owners July 11, 2026 04:05
@changeset-bot

changeset-bot Bot commented Jul 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0e11994

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

kodiakhq[bot]
kodiakhq Bot previously approved these changes Jul 11, 2026
@kdy1 kdy1 requested a review from CPunisher July 11, 2026 04:09

@kdy1 kdy1 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think it's now good to go, as the main user of this crate was Deno

@codspeed-hq

codspeed-hq Bot commented Jul 11, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 189 untouched benchmarks
⏩ 61 skipped benchmarks1


Comparing kdy1:kdy1/remove-ecma-lexer (0e11994) with main (d6833cc)

Open in CodSpeed

Footnotes

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

@kdy1 kdy1 enabled auto-merge (squash) July 11, 2026 04:26
@kdy1 kdy1 disabled auto-merge July 11, 2026 04:26
kodiakhq[bot]
kodiakhq Bot previously approved these changes Jul 11, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d9a6de10d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/swc_ecma_lexer/Cargo.toml
Comment thread crates/swc_ecma_parser/Cargo.toml

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0e11994d5d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@@ -34,7 +34,6 @@ bitflags = { workspace = true }
compact_str = { workspace = true }
either = { workspace = true }
num-bigint = { workspace = true }
phf = { workspace = true, features = ["macros"] }
rustc-hash = { workspace = true }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Regenerate all nested parser lockfiles

The prior swc_core fixture lockfiles are fixed, but the same phf removal still leaves other committed nested lockfiles with swc_ecma_parser depending on phf (crates/swc_plugin_backend_tests/tests/fixture/{swc_noop_plugin,swc_internal_plugin,issue_6404}/Cargo.lock, packages/core/e2e/fixtures/plugin_analyze/Cargo.lock, packages/core/e2e/fixtures/plugin_transform_schema_vtest/Cargo.lock, and crates/swc_ecma_minifier/fuzz/Cargo.lock). These fixture crates are built by the plugin backend tests and package e2e plugin builders, so this change only partially updates the locked dependency graph and the next fixture build/lock refresh will carry unrelated lockfile diffs or keep testing the old graph with phf still present.

Useful? React with 👍 / 👎.

@kdy1 kdy1 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I was wrong - Deno is still using SWC, so I'll postpone this PR

@kdy1 kdy1 marked this pull request as draft July 11, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant