Parsing Behavior Changes (thanks to @TooTallNate via PR #24)
- Rewrote the parser as a character-by-character state machine instead of the previous regex, so adjacent quoted and unquoted segments are treated as a single argument, matching bash word-splitting
- Quote characters are now always stripped, including word-internal and
key=valuepositions:--foo="bar"'baz'->--foo=barbaza" b"->a b"a"b->abrun:silent["echo 1"]["echo 2"]->run:silent[echo 1][echo 2]--name='Phil Taylor'->--name=Phil Taylor
- Fixes #20 (word-internal quotes were not stripped)
- Fixes #23 (unquoted tail after a quoted section was split into a separate argument)
- Known differences from bash, unchanged by this release: backslash escapes are not processed,
$variables/globs are left literal, and an unclosed quote consumes the rest of the input instead of raising an error - Security dependency bumps: minimatch 3.1.5 via #25, brace-expansion 1.1.16 via #27
Build / Breaking Changes
- Update TypeScript to 7.0.2 (requires Node.js >=16.20)
- Drop CommonJS support: the package is now ESM-only (
importonly). Thecommonjs/build, therequireexport condition, and themodule/mainCJS entry points have been removed —mainandexportsnow point to the single ESM build (./index.js) - Consolidate to a single build: removed
tsconfig.base.jsonandtsconfig.commonjs.json;tsconfig.jsonis now self-contained (targetES2022,moduleESNext,strict,declaration) andnpm run buildruns a singletsc -p .. Note: TypeScript 7 no longer accepts the oldtargetES3 (hence the ES2022 baseline) - Minimum Node.js version is now
>=16.20.0(enginesupdated accordingly) - Tests: removed the CJS
require()spec (test/Index.spec.cjs);test/config.jsonnow runs*[sS]pec.jsonly
Requires Node.js >=16.20.0. ESM-only — use import, not require().