feat(es/parser): rewrite parser with OXC architecture#12016
Conversation
🦋 Changeset detectedLatest commit: a99b530 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 |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
|
Closing as the |
Description:
Replace SWC's legacy lexer/parser with an independent OXC-style, source-oriented engine and make the new API the only parser entry point:
The parser constructs the owned SWC AST directly. It does not depend on OXC crates, an OXC AST, or an intermediate arena AST. The source cursor, checkpoint, packed-token, cold-error, re-lexing, and recursive-descent organization are derived from
oxc_parsercommitb6d2a29e47358a288dbfb2a635550243511ec497.This PR:
PackedToken(u128)and statically separatesNoTokensfromWithTokens;swc_ecma_lexercrate;Performance is evaluated through CodSpeed CI. Local benchmark timing is intentionally not reported; local runs only validate benchmark harnesses with
--test.Validation completed locally:
cargo test -p swc_ecma_parserand release-only prefix-consumption regression coverage;cargo clippy --all --all-targets -- -D warningsandcargo fmt --all;packages/core: 40 test files and 117 tests passed;--testmode.BREAKING CHANGE:
The parser API is now
Parser::new(&str, SourceType).parse() -> ParserReturn. Parser diagnostics, exact spans, comment attachment, and lexer/parser token APIs are not compatibility guarantees. The legacy parser andswc_ecma_lexercrate are removed. Seecrates/swc_ecma_parser/MIGRATION.mdfor migration details.