diff --git a/CHANGELOG.md b/CHANGELOG.md index 554665a..a9eb7ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,52 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [8.0.0](https://github.com/moxystudio/node-cross-spawn/compare/v7.1.0...v8.0.0) (2026-11-29) + +### ⚠ BREAKING CHANGES + +* cross-spawn now requires Node.js 22.13 or later, the first release that can `require()` an ES module without a warning. Node.js 8 to 22.12 can keep using cross-spawn 7. +* cross-spawn is now an ES module with named exports only: there's no default export anymore, and `spawn.sync()` is now `spawnSync()`. Use `import { spawn, spawnSync } from 'cross-spawn'` or `const { spawn, spawnSync } = require('cross-spawn')`. Only the package itself can be imported, not its internal files, such as `cross-spawn/lib/parse`, and the private `_parse` and `_enoent` exports were removed. +* `spawnSync()` results no longer have `error: null` when there's no error, like Node.js's. Check `result.error` for truthiness, or compare it with `undefined`. +* On Windows, as on other platforms, the command must be the name or path of a single program, with its arguments passed separately: `spawn('npm install')` now fails with ENOENT. +* On Windows, commands that can't be run safely through cmd.exe now throw a `TypeError`: commands containing double quotes, e.g. `spawn('"C:\\Program Files\\tool.exe"')`, `^` or `%`, commands ending with a dot or whitespace, e.g. `spawn('tool.bat ')`, and commands that resolve to a file whose path contains `^` or `%`, e.g. a program found in a PATH entry such as `C:\tools\100%`. +* On Windows, the ENOENT error for a command that doesn't exist now comes from Node.js, with a numeric `errno`, and an exit code of 1 is never reported as ENOENT, including with `shell: true`. Shell built-ins such as `dir` or `echo` need `shell: true`, like with Node.js's own `spawn`. +* On Windows, batch files are run by their resolved path, which they see in `%0` instead of the command as written, and they no longer print the commands they run, even if they turn echo on with `@echo on`. + +### Features + +* rewrite as ES modules ([0977245](https://github.com/moxystudio/node-cross-spawn/commit/097724511bd8fb25a204756a25565797ead97166)) +* ship TypeScript types ([4b27af5](https://github.com/moxystudio/node-cross-spawn/commit/4b27af5ecbdea8da64bb5f5a02b010934c3b784d)) +* use the `ERR_INVALID_ARG_VALUE` code for values that can't be escaped ([807cc2f](https://github.com/moxystudio/node-cross-spawn/commit/807cc2fb08150b8713966333f6b67f248a3e3879)) + +### Bug Fixes + +* always quote commands run through cmd.exe ([ea02faf](https://github.com/moxystudio/node-cross-spawn/commit/ea02faf986f07a7a913b9fac5a2d39a5df864b8e)), closes [#150](https://github.com/moxystudio/node-cross-spawn/issues/150) +* don't report ENOENT for commands run with `shell: true` ([bf607dc](https://github.com/moxystudio/node-cross-spawn/commit/bf607dc56f5dc5e9195fc5c024d0b55fc4ef50b2)) +* leave `error` unset in `spawnSync()` results when there is no error ([d2b3b92](https://github.com/moxystudio/node-cross-spawn/commit/d2b3b9228acb858302d647f76c995550947864c0)), closes [#151](https://github.com/moxystudio/node-cross-spawn/issues/151) +* let Node.js report ENOENT for commands that don't exist ([4d7b621](https://github.com/moxystudio/node-cross-spawn/commit/4d7b6213101413579328d653fe94b5b177d49418)), closes [#104](https://github.com/moxystudio/node-cross-spawn/issues/104) +* look up commands without `which` or changing the process cwd ([8a6c8c4](https://github.com/moxystudio/node-cross-spawn/commit/8a6c8c49c4c73798d9ff9ce284387b0c9e48d38b)) +* read shebangs of short files without a trailing newline ([2adf5ce](https://github.com/moxystudio/node-cross-spawn/commit/2adf5ce187585a8554dd60bec141844a3c8e3647)) +* reject `^` and `%` in all commands and the files they resolve to ([c27e742](https://github.com/moxystudio/node-cross-spawn/commit/c27e7428966ef9cfc00d6cbf038f854c07b47fe3)) +* reject commands ending with a dot or whitespace on Windows ([561245f](https://github.com/moxystudio/node-cross-spawn/commit/561245f8201a55852a403bcbe0aa49a2e4228067)) +* resolve relative shebangs in worker threads ([d60bb95](https://github.com/moxystudio/node-cross-spawn/commit/d60bb95bd3786f12cfb887a1eba61d14249959f7)) +* run batch files by their resolved path, and reject `^` and `%` in it ([6577a1b](https://github.com/moxystudio/node-cross-spawn/commit/6577a1b72ecdce28f87a3ac3bba6bded0570b296)) +* turn echo off when running commands through cmd.exe ([cfb63a8](https://github.com/moxystudio/node-cross-spawn/commit/cfb63a892d62d2ff7efaa9ea1a7f3b66d462b265)), closes [#135](https://github.com/moxystudio/node-cross-spawn/issues/135) + +### [7.1.2](https://github.com/moxystudio/node-cross-spawn/compare/v7.1.1...v7.1.2) (2026-11-29) + + +### Bug Fixes + +* run batch files by their resolved path on Windows ([fe027b8](https://github.com/moxystudio/node-cross-spawn/commit/fe027b8a594c1260c45b1d1d3e5c543f2d9e8c57)), closes [#203](https://github.com/moxystudio/node-cross-spawn/issues/203) + +### [7.1.1](https://github.com/moxystudio/node-cross-spawn/compare/v7.1.0...v7.1.1) (2026-11-28) + + +### Bug Fixes + +* always quote commands run through cmd.exe ([d0ead35](https://github.com/moxystudio/node-cross-spawn/commit/d0ead352a7380492cbb0f6548fa86f19448323c9)) + ## [7.1.0](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.6...v7.1.0) (2026-11-28) diff --git a/SECURITY.md b/SECURITY.md index 40fa06f..1eb5ec9 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -4,11 +4,12 @@ | Version | Supported | | ------- | --------- | -| 7.x | Yes | +| 8.x | Yes | +| 7.x | Security fixes | | 6.x | Critical security fixes only, case by case | | < 6 | No | -Please upgrade to the latest 7.x release to get all fixes. +Please upgrade to the latest 8.x release to get all fixes. ## Reporting a vulnerability diff --git a/package.json b/package.json index 8823be6..fa8285d 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "homepage": "https://github.com/moxystudio/node-cross-spawn", "repository": { "type": "git", - "url": "git@github.com:moxystudio/node-cross-spawn.git" + "url": "git+https://github.com/moxystudio/node-cross-spawn.git" }, "license": "MIT", "type": "module",