Skip to main content
← Back to list
01Issue
FeatureOpenSwamp CLIPublic
AssigneesNone

Relationships

#4882 Investigate replacing @babel/parser with oxc for parsing extension source

Opened by zack · 11/18/2026

Why

Every reader of extension source parses it with @babel/parser through parseExtensionModule in packages/extension-scoring/source/parse.ts: the shared import scan, the safety rules, the quality-ignore directive reader, the CLI's push and quality gates, and swamp-club's scorecard analysis. Babel parsing is now the dominant cost of the scan.

On @swamp/aws/ec2@2026.11.18.1 (253 code files, 142M characters, mostly esbuild bundles), swamp-club#4874 brings the scorecard import scan from 15.1s to 6.5s by parsing each module once and pruning the AST walk. Almost all of the remaining 6.5s is Babel parse time. A sound text pre-check cannot skip parses on this archive: every bundle contains .md text (runtimeConfig.md5) and regex escapes, so the parse cannot be avoided, only made faster.

What to investigate

Whether oxc (oxc-parser, Rust with Node/WASM bindings) can replace Babel as the extension source parser, and what it would cost.

  1. Speed. Benchmark oxc against Babel on the ec2 archive and a few typical extensions: parse alone, and parse plus the import scan. Compare the native binding with the WASM build. The compiled swamp binary and swamp-club's server need whichever one runs under Deno (npm: specifiers, deno compile).
  2. Syntax parity. parseExtensionModule sets a specific configuration: legacy decorators with a TC39 retry, explicitResourceManagement, decoratorAutoAccessors, import attributes, source and defer phase imports, JSX by extension, CommonJS (.cjs, .cts) parsed as a sloppy script, error recovery for bundles, and the allow-everywhere flags. Check that oxc accepts and refuses the same modules. A module one parser refuses and the other accepts changes the source-syntax gate and the dependency audit's unreadable-module handling.
  3. AST shape. oxc produces ESTree/TS-ESTree, not Babel's AST: ImportExpression against CallExpression(Import), TSImportType shape, StringLiteral against Literal, and UTF-8 against UTF-16 offsets. List every consumer of SyntaxNode (import scan, safety rules, directive reader, extension_source_ast.ts, the bare-import rewrite plan) and estimate the port.
  4. Result parity. All shared vectors under packages/extension-scoring/vectors/, the import property tests and swamp-club's tests/integration/extension_scoring_vectors_test.ts must give identical results. Any difference moves scores, so it needs a RUBRIC_VERSION decision.
  5. Supply chain. A native binding is a new kind of dependency for the CLI and the registry (prebuilt binaries per platform, deps audit). Weigh that against the speedup.

Outcome

A recommendation, with benchmark numbers and a parity report, to adopt oxc, adopt it only for the import scan, or stay on Babel.

02Bog Flow
◉OPEN○TRIAGED○IN PROGRESS○SHIPPED

Open

11/18/2026, 8:37:39 PM

No activity in this phase yet.

03Sludge Pulse

Sign in to post a ripple.