ADR-0012: oxc_parser and oxc_resolver for TypeScript and JavaScript
- Status: Accepted
- Date: 2026-09-20
- Derives from: design.md § The five stages (stage 2), § What each extractor has to get right (TypeScript), § Language decision; dependency-cruiser coverage § Extraction and resolution, § Options (
parser,enhancedResolveOptions,tsConfig) - Constrains: architecture.md § Extractors
- Implemented by: Wave 0 plan, Wave 1 plan
Context
dependency-cruiser resolves with enhanced-resolve and parses with acorn, swc or tsc. oxc_resolver is the Rust port of enhanced-resolve, so exportsFields, conditionNames, mainFields, aliasFields, tsconfig paths / baseUrl / extends / references, symlinks and Yarn PnP carry over by construction. oxc_parser handles JS, TS, JSX, TSX, decorators and stage-3 syntax in well under a millisecond per file.
Decision
rb-extract-tsparses withoxc_parserand resolves withoxc_resolver. Both are MIT.- The
parseroption (acorn/swc/tsc) is accepted, satisfied byoxc, and recorded inoptionsUsedfor the report. - Every dependency form dependency-cruiser knows is extracted: ES imports and re-exports,
import type,import(),require, AMDdefineandrequire, exotic require names,import =, triple-slash directives, JSDoc imports (read from the comment table, not by switching parser),process.getBuiltinModule. - Vue and Svelte single-file components are split to their
<script>blocks and then parsed byoxc(wave 2). - Babel syntax needs no Babel:
oxcparses it; onlybabel-plugin-module-resolveraliases are read from the Babel config. webpack configs are evaluated in the sandbox (ADR-0006) and theirresolveblock read. enhancedResolveOptions.cachedInputFileSystem.cacheDurationis accepted and ignored; the resolver caches per run.- CoffeeScript and LiveScript are not parsed natively (ADR-0017).
Consequences
- Parity is measured against dependency-cruiser's 546 extraction fixtures (ADR-0009); the extractor is done when they produce the same edges.
oxcandoxc_resolverare pinned inCargo.tomland bumped through a pull request that re-runs gate 1.
Alternatives considered
- swc. A larger dependency, and its resolver is not enhanced-resolve's.
- tree-sitter. No resolver; would leave the whole of enhanced-resolve to reimplement.