Skip to content

build: migrate to Babel 7 and restore the broken module build - #2088

Open
aron-intframe wants to merge 1 commit into
caolan:masterfrom
aron-intframe:build/babel-7
Open

aron-intframe wants to merge 1 commit into
caolan:masterfrom
aron-intframe:build/babel-7

Conversation

@aron-intframe

Copy link
Copy Markdown

Description

make build has failed since #2046 bumped yargs to 18: support/build/compile-module.js reads the removed yargs.argv singleton and dies with Cannot destructure property 'file' of 'options' as it is undefined, so no CJS module is ever compiled. CI never runs the build.

It also moves the toolchain to Babel 7 (#1992). @babel/register replaces babel-register, the last thing pulling in the Babel 6 tree (npm audit 68 → 44, critical 24 → 2); babel-core was required directly while never declared. Deprecated rollup-plugin-node-resolve → @rollup/plugin-node-resolve, unused rollup-plugin-npm dropped.

User-Facing Changes

None. Rebuilt from v3.2.6, the new toolchain reproduces the published async@3.2.6 dist/async.{js,mjs,min.js} byte for byte, and all 129 CJS modules keep the same exported names and types. On boilerplate: the CJS modules total 322,478 bytes vs 320,200, +0.7%.

Tests

npm test 703 passing, make test-build 10 passing, lint clean. CI now runs make test-build on Linux (the Windows leg has no make), and support/build.test.js gained an export-parity check between the Babel-built CJS index and the Babel-free UMD bundle; dropping one re-export turns it red.

Known limits: one of four full runs flaked on retryable ("duration should have been greater than 80, but was 79"; 3 reruns and 6 isolated runs pass); perf/benchmark.js is broken by the same yargs 18 removal and left alone; I only ran Node 24 locally.

`make build` has been failing since yargs was bumped to 18 (caolan#2046):
support/build/compile-module.js reads the removed `yargs.argv`
singleton, so every CJS module compile dies before it starts. CI never
runs the build, so nothing caught it.

- compile-module.js, generate-index.js, .babelrc and test/mocha.opts move
  from babel-core 6 / babel-register to @babel/core and @babel/register.
  Dropping babel-register removes the last Babel 6 dependency (caolan#1992).
- babel-core was required directly by compile-module.js while never being
  declared; @babel/core is a declared devDependency.
- syntax-async-generators is gone: @babel/parser handles async generators
  natively.
- rollup-plugin-node-resolve (deprecated) becomes
  @rollup/plugin-node-resolve; the unused rollup-plugin-npm is dropped.
- pass yargs(hideBin(process.argv)) so the compiler CLI parses again.
- CI runs `make test-build` on Linux, and support/build.test.js gains an
  export-parity check between the Babel-built CJS modules and the
  Babel-free UMD bundle.
- .eslintignore skips the generated build/, build-es/ and tmp/ dirs, which
  are already gitignored.

Rebuilding v3.2.6 with the new toolchain reproduces the published
async@3.2.6 dist/async.js, dist/async.mjs and dist/async.min.js byte for
byte, and all 129 CJS modules keep the same exported names and types.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant