Sync the complete published `@babel/runtime@8.0.8` helper tree so future updates have a recorded upstream baseline. Import all 95 CommonJS/ESM helper pairs, the MIT license, conditional exports, and `sideEffects: false`. Preserve 26 legacy Babel helper pairs, three TypeScript decorator helper pairs, and existing import paths. 189 of the 191 upstream files are byte-identical. The two `setFunctionName` implementations retain Oxc's existing behavior and match main. Add a hash manifest, a repeatable sync script, CJS/ESM tests in CI, and an async-generator execution regression. No new helper optimizations or correctness patches are included. Validation: upstream hashes, compatibility preservation, sync idempotence and drift refusal, formatting, lint, syntax, and whitespace checks passed. Runtime tests were not rerun after restoring this tree because automatic approval blocked helper execution; the newer Babel fixture revision pinned by main was not run locally. AI assistance: Claude.
2.3 KiB
Oxc's modular runtime helpers
Vendored from the complete published @babel/runtime@8.0.8 package, including all 95 CommonJS/ESM helper pairs and Babel's MIT license. All credits to the Babel team.
upstream.json records the upstream version, SHA-256 of every upstream helper file, and the local patches. The tests check these hashes so unrecorded edits cannot silently diverge from Babel.
Differences from Babel
setFunctionName.jsandesm/setFunctionName.jspreserve"[]"forSymbol(""), matching native computed method names. Babel 8.0.8 returns an empty name. These files are unchanged from Oxc's existing helpers and are the only patches to the upstream helper tree.- Oxc retains its three TypeScript legacy decorator helpers:
decorate,decorateParam, anddecorateMetadata. They are adapted from TypeScript and are absent from Babel 8. - The 26 older Babel helpers removed in Babel 8 remain available for compatibility with previously generated code. Their names are listed in
upstream.json; they are outside the Babel 8 source snapshot. - Package identity, Oxc's version and Node.js requirements, and the
src/layout remain Oxc-specific. Babel's export targets andsideEffects: falseare synchronized while preserving Oxc's existing conditional-export precedence; explicithelpers/esm/*and older package exports remain supported.
Updating
Download and extract a specific published version of @babel/runtime, then run from this directory:
node scripts/sync.mjs /path/to/extracted/babel-runtime
The script copies every unpatched upstream helper and the license, updates exports and the hash manifest, and preserves compatibility helpers and recorded local patches. Before writing, it checks that each patched helper still matches its recorded local hash and that its upstream source is unchanged. If upstream changes a patched helper, the script stops so its local changes can be reviewed against the new version.
The manifest uses the script's generated JSON formatting and is excluded from repository formatting. Repeating the command with the recorded upstream version leaves the runtime tree unchanged. Tests reconstruct that upstream tree offline, using the vendored helpers and the original sources of the two patched helpers.
Run the import, integrity, and runtime behavior tests with:
node --run test