Skip to content

Require Node.js 22 and update dependencies - #1365

Draft
Christof Marti (chrmarti) wants to merge 6 commits into
mainfrom
chrmarti/node22-dependency-updates
Draft

Christof Marti (chrmarti) wants to merge 6 commits into
mainfrom
chrmarti/node22-dependency-updates

Conversation

@chrmarti

@chrmarti Christof Marti (chrmarti) commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Node.js 20 is end-of-life, and the security fixes for tar (7 high-severity alerts) are only in tar 8, which requires Node.js 22. This moves the CLI to Node.js 22 and updates all held-back dependencies except TypeScript 7.

It fixes all 11 open Dependabot alerts: tar (136-142), follow-redirects (132), basic-ftp (131), minimatch (134) and glob (135). It supersedes #1360, which fails CI because chalk 6 requires Node.js 22.

Changes

  • Node.js 22: engines is >=22.12.0 (the minimum of yargs 18 and mocha 12). CI, the install.sh default, the dev container and the contributing docs move from 20 to 22.
  • Runtime dependencies: tar 7.5.21 → 8.1.0, proxy-agent 6.5.0 → 8.0.3, yargs 17.7.2 → 18.2.0, chalk 5.6.2 → 6.0.1, js-yaml 4.3.2 → 5.5.0, follow-redirects 1.16.1 → 1.16.3, node-pty 1.0.0 → 1.2.0-beta.19, plus minor updates of semver, shell-quote and vscode-uri.
  • Development dependencies: TypeScript 5.9 → 6.0, mocha 11 → 12, chai 4 → 6, @types/node 20 → 22, ESLint 10.16, typescript-eslint 8.74, Stylistic 6. @types/js-yaml is removed because js-yaml 5 ships its own types.
  • Resolutions: mocha/glob ^14.0.7 and mocha/minimatch ^11.0.10, because mocha 12.0.3 still declares glob ^13 and minimatch ^10 (fixes pending in fix(deps): update dependency glob to v14 [security] mochajs/mocha#6500 and fix(deps): update dependency minimatch to v11 [security] mochajs/mocha#6480). The basic-ftp override is removed; proxy-agent 8 brings basic-ftp ^6.2.4.
  • Dependabot: removes the chai, @types/chai, yargs and node-pty holds, keeps @types/node on Node 22, and holds TypeScript 7.
  • Compose YAML: js-yaml 5 loads YAML 1.2 without merge keys (<<) by default. Compose YAML is now loaded with merge keys enabled, so a project name supplied through a merge is found again.
  • exec arguments: yargs converted numeric exec arguments to numbers (1.0 became 1, 0x10 became 16). node-pty 1.0.0 converted them back to strings, but node-pty 1.2's N-API spawn corrupts memory with a number, which crashed exec in a terminal for [ -t 1 ] (exit code 139). Positional number parsing is now off for exec, so arguments are passed on verbatim.

Notes for reviewers

  • tsconfig.base.json: "module": "node20" lets TypeScript resolve the require types of ESM-only packages (tar 8, proxy-agent 8). "types": ["node"] is needed because TypeScript 6 defaults types to [].
  • esbuild.js:
    • The CommonJS bundle now defines import.meta.url and import.meta.resolve, which yargs 18 and pac-proxy-agent 9 use. This replaces the yargs 17 shim.
    • pac-proxy-agent reads quickjs.wasm through import.meta.resolve. It is patched to use the wasm inlined into the bundle as base64, so the CLI is still a single file. The build fails if the patch no longer matches.
    • The npm package grows from about 618 kB to 714 kB. proxy-agent 6 already inlined a smaller QuickJS wasm, and base64 compresses worse than the raw file, but a single file is easier for consumers that copy the bundle.
  • tar 8: the filter callback always receives a ReadEntry now, so getBlob uses entry.type directly. The zlib-zstd.d.ts stubs, added for tar 7's minizlib types under @types/node 20, are removed because @types/node 22 has these types.
  • node-pty: the published package.json has no dependencies, and VS Code supplies its own node-pty (1.2.0-beta.19), so this only affects development and CI. 1.1.0, the latest stable, has broken spawn-helper permissions (fix: ensure spawn-helper is executable for macos prebuilds microsoft/node-pty#866). beta.19 ships prebuilt binaries for all platforms.
  • TypeScript 7: stays held because typescript-eslint, ts-node and typescript-formatter need the TypeScript JS API, which 7.0 doesn't have yet.

Validation

Locally on Windows with Node.js 22.23.5: type-check, lint, yarn package and 210 Docker-free unit tests, including the Feature download and extraction tests. From the unpacked npm package without node_modules: --help, --version, unknown-option errors, features info, templates apply with omitted paths (tar extract filter), features package (tar create), PAC proxy to a dead proxy and to DIRECT, and a plain HTTPS_PROXY. The Docker test suites, Linux, macOS and install.sh are covered by CI.

Node.js 20 is end-of-life, and the security fixes for tar are only
available in tar 8, which requires Node.js 22.

- Update tar to 8, proxy-agent to 8, yargs to 18, chalk to 6, js-yaml
  to 5 and node-pty to the 1.2.0 beta that VS Code uses.
- Update chai to 6, mocha to 12 and TypeScript to 6, and override
  mocha's glob and minimatch with patched versions.
- Map import.meta in the CommonJS bundle and ship pac-proxy-agent's
  quickjs.wasm next to it.
- Remove Dependabot holds that are no longer needed and hold
  TypeScript 7, which has no JS API yet.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The js-yaml upgrade disables merge keys by default, causing merged Compose project names to be missed and potentially selecting or creating containers under the wrong project.

1 open issue
What changed in this PR

Moves the Dev Containers CLI to Node.js 22.12+ to enable dependency upgrades and security fixes.

Changes:

  • Updates runtime and development dependencies, overrides, and Dependabot policies.
  • Adapts CommonJS bundling and archive handling to upgraded libraries.
  • Aligns CI, installer defaults, development containers, and documentation with Node.js 22.
File Description
yarn.lock Locks upgraded dependencies.
tsconfig.base.json Updates module resolution and Node types.
src/​spec-node/​typings/​zlib-zstd.d.ts Removes obsolete Zstd stubs.
src/​spec-configuration/​typings/​zlib-zstd.d.ts Removes obsolete Zstd stubs.
src/​spec-configuration/​containerCollectionsOCI.ts Adapts extraction filtering to tar 8.
scripts/​install.sh Defaults installations to Node.js 22.
package.json Raises Node minimum, upgrades dependencies, and ships WASM.
esbuild.js Supports bundled import metadata and PAC proxy WASM.
docs/​contributing-code.md Updates Node.js prerequisites.
CHANGELOG.md Documents runtime and dependency upgrades.
.github/​workflows/​test-windows.yml Runs Windows tests on Node.js 22.
.github/​workflows/​test-docker-v29.yml Uses Node.js 22 for Docker 29 tests.
.github/​workflows/​test-docker-v20.yml Uses Node.js 22 for Docker 20 tests.
.github/​workflows/​dev-containers.yml Moves CI jobs to Node.js 22.
.github/​dependabot.yml Revises dependency upgrade holds.
.devcontainer/​Dockerfile Defaults the development image to Node.js 22.
.devcontainer/​devcontainer.json Selects the Node.js 22 image variant.

Review effort: Balanced

Comment thread package.json Resolved
js-yaml 5 loads YAML 1.2 without merge keys by default, so a project
name supplied through a merge was missed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
yargs converted numeric exec arguments to numbers, so `1.0` became 1.
node-pty 1.2 expects strings when spawning and corrupted memory with a
number, crashing `exec` in a terminal for `[ -t 1 ]` (exit code 139).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The tar rewrite, beta node-pty upgrade, and external WASM packaging require Linux/macOS integration CI and packaged PAC proxy confirmation beyond the documented Windows-only runtime validation.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Ship a single bundle file again, so consumers that copy the bundle don't
need to copy quickjs.wasm along with it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the Node.js 22 migration and dependency updates.

No open issues 🎉

Review effort: Balanced

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.

2 participants