Skip to content

Support Node.js 22.12 and newer and match globs with picomatch - #24

Merged
Huldoser merged 3 commits into
mainfrom
chore/node-22-support
Dec 2, 2026
Merged

Huldoser merged 3 commits into
mainfrom
chore/node-22-support

Conversation

@Huldoser

@Huldoser Huldoser commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

What changed

The package now supports Node.js 22.12 and newer instead of 26 and newer, and matches globs with picomatch instead of Node's path.matchesGlob, so neither the CLI nor the library prints an ExperimentalWarning on Node.js versions before 22.20 and 24.8.

Node.js 22.12

  • engines.node is >=22.12, and @types/node is 22.12.0 (exact, like the other pins) so that type checking catches Node.js APIs newer than the oldest supported version. .node-version (26.13.1) stays the development version, used by the full npm run check job and the release workflow.
  • CI adds a test job for the latest Node.js 22, 24 and 26 (typecheck, build, tests) and an oldest-node job that builds and packs with the development version, then runs the test suite and the packed CLI and library on Node.js 22.12.0, failing if either writes anything to stderr. The library step now passes glob options, so it would catch the warning. ESLint 10 needs Node.js 22.13+, so lint stays in the development-version job. The ci job now needs the new jobs; the ruleset's required check is unchanged.

picomatch instead of path.matchesGlob

  • picomatch 4.0.7 is a new runtime dependency (MIT, no dependencies of its own), pinned exactly, with @types/picomatch 4.0.3 as a dev dependency. Both are listed in THIRD_PARTY.md. The CLI's filter for the experimental-glob warning is removed.
  • Glob options (--exclude, --test, --tooling, --production, --entry-glob and the library's exclude, scopes and entryGlobs) go through one matcher, src/globs.ts, that keeps their syntax: * and ** skip dot files and folders unless the pattern names them, braces, extglobs and character classes work, a backslash separates segments like a slash, ./.. segments and repeated slashes are normalized, a leading ! is part of the name, and parentheses, | and " are literal outside extglobs (picomatch would otherwise read app/(marketing)/** as a regex group and miss Next.js route groups).
  • Workspace patterns (--workspace-entries, workspaceEntries()) now select member folders the way npm does in @npmcli/map-workspaces: an odd number of leading ! makes an exclusion, a later including pattern cancels earlier exclusions that match its text, other exclusions apply wherever they are listed, including patterns skip dot folders unless they name them, and exclusions also cover dot folders (npm's glob ignore list matches with dot: true). The previous last-match-wins reading differed from npm for patterns such as ['!packages/b', 'packages/*'] or ['packages/**', '!packages/b/**'].
  • The reference page describes the glob syntax and the workspace selection. A separate minor changeset, .changeset/picomatch-globs.md, lists the differences users can see: npm's workspace selection; case-sensitive matching on every platform (on macOS and Windows, path.matchesGlob ignored case in segments with wildcards); a leading ./ now accepted by --exclude and the scope options; a pattern also matching a path spelled exactly like it and dir/** matching dir; and picomatch's reading of !(…) extglobs. The Node.js changeset now only states the new minimum.

.changeset/config.json and CONTRIBUTING.md arrive with #23; merge that first so these changesets are picked up. #23's CONTRIBUTING.md and AGENTS.md say that the TypeScript compiler is the only runtime dependency; after #23 is merged, this branch needs those lines updated to mention picomatch.

Verification:

  • New tests in test/globs.test.ts and test/entry-discovery.test.ts cover dot files and folders, **, braces, extglobs, character classes, literal parentheses, backslashes, a leading !, empty patterns, scopes, entry globs, npm workspace exclusions, and an empty stderr from the library and the CLI. Against the previous implementation, they pass except for the intended changes: the workspace exclusions, the leading ./ and, on macOS, case sensitivity. On Node.js 22.12.0 the stderr test also fails there, on the ExperimentalWarning.
  • Workspace selection was compared with npm 12.2.3's own @npmcli/map-workspaces 6.0.0 on 34 pattern lists. All match, except that npm on macOS ignores case.
  • Node.js 26.14.0: npm ci --ignore-scripts --no-audit, npm run check (58 tests), npm pack --dry-run and npm audit (0 vulnerabilities) pass.
  • Node.js 22.12.0 and 24.23.0: typecheck, build and all 58 tests pass.
  • The oldest-node steps, run by hand on Node.js 22.12.0 against the packed tarball, report a complete scan with one direct call, and neither the CLI nor the library writes to stderr.
  • actionlint 1.7.12 reports no findings. zizmor was not rerun for this change, which adds one shell line to an existing step.

Checklist

  • npm run check passes, and tests cover the change.
  • The docs describe the change: the README, or the guide or reference pages in docs/.
  • No docs change is needed.
  • A changeset describes the change for users (npx changeset), or the change does not affect them.

Lower engines.node from >=26 to >=22.12 and type the Node.js APIs of
the oldest supported version with @types/node 22.12.0. Development and
the full check keep the version in .node-version.

CI tests the latest Node.js 22, 24 and 26, and runs the tests and the
packed CLI and library on Node.js 22.12.0. The CLI hides the one
warning that path.matchesGlob prints on Node.js before 22.20 and 24.8,
where it is still experimental.
path.matchesGlob is experimental before Node.js 22.20 and 24.8 and
prints a warning there, from the library as well as the CLI. Match
glob options and npm workspace patterns with picomatch 4.0.7 instead,
and remove the CLI's warning filter.

Glob options keep their syntax: case-sensitive matching, dot files
skipped unless named, a backslash as a separator, literal parentheses
and pipes outside extglobs, and a leading ! as part of the name.
Workspace patterns now follow npm's own selection: exclusions apply
regardless of order unless a later pattern that they match cancels
them, and they also exclude dot folders.

The oldest-node CI job now also checks that the packed library prints
nothing on stderr when it uses glob options.
@Huldoser Huldoser changed the title Support Node.js 22.12 and newer Support Node.js 22.12 and newer and match globs with picomatch Dec 2, 2026
# Conflicts:
#	package-lock.json
#	package.json
@Huldoser
Huldoser merged commit 878940f into main Dec 2, 2026
10 checks passed
@Huldoser
Huldoser deleted the chore/node-22-support branch December 2, 2026 21:07
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