Repository navigation
Conversation
Replace `tinyglobby` and `glob-parent` with a small `#utils/glob.mjs` built on Node.js's `fs.globSync`, stable since 22.17 and 24.0 (doc-kit targets Node.js 24, per `.nvmrc`). It returns the same POSIX, cwd-relative paths as tinyglobby, including for absolute patterns, and leaves out directories. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1180 +/- ##
==========================================
+ Coverage 93.44% 93.47% +0.02%
==========================================
Files 278 280 +2
Lines 27820 27947 +127
Branches 2790 2811 +21
==========================================
+ Hits 25997 26124 +127
Misses 1801 1801
Partials 22 22 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
| File | Main | PR | Change |
|---|---|---|---|
orama-db.json |
29.24 MB | 29.24 MB | +98.00 B (+0.0%) |
Performance estimate (single CI run)
- Generation time: 4.6% faster (7.35 s → 7.01 s)
- Peak memory: 5.2% lower (1.28 GB → 1.21 GB)
web Generator
Performance estimate (single CI run)
- Generation time: 10.4% slower (22.42 s → 24.76 s)
- Peak memory: 2.2% higher (1.90 GB → 1.94 GB)
🚀 Deploying Preview to Cloudflare 🚀Preview Deployments by commit
|
| import { fileURLToPath } from 'node:url'; | ||
|
|
||
| // A path segment holding any glob syntax (wildcards, classes, braces or extglobs) | ||
| const GLOB_SEGMENT = /[*?[{]|[!+@]\(/; |
There was a problem hiding this comment.
Yup, I checked it against Node's own fs.globSync on real files (Node 24 and 26): it catches everything that's glob syntax there, */**, ?, [...] classes, {a,b}/{1..3} and all five extglobs. It's actually a bit closer than glob-parent was, a?c is a glob for fs.globSync (glob-parent missed it) and (a|b) is matched literally (glob-parent treated it as one). The only over-match is an unmatched { like a{b, which just makes the parent one level higher, same as glob-parent did.
While at it, I noticed fs.globSync reads \ as a path separator (no escapes), so doc\api\*.md gave . as the parent. Fixed in fe73cbd, with tests for these cases :)
`fs.globSync` reads backslashes as path separators, never as escapes, on every platform, so `doc\api\*.md` finds `doc/api`'s files, but `globParent` only split on `/` and returned `.` for it. glob-parent converted backslashes on Windows, so this matches it again. Also covers `?` (glob syntax, which glob-parent missed) and `(b|c)` (matched literally by `fs.globSync`, which glob-parent treated as glob). Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Description
This PR replaces
tinyglobbyandglob-parentin@doc-kit/corewith a small#utils/glob.mjson Node.js's built-infs.globSync(stable since 22.17 and 24.0; doc-kit targets Node.js 24, per.nvmrc):findFiles(patterns, { cwd, ignore })returns the same POSIX,cwd-relative paths as tinyglobby, absolute patterns included, and leaves out directories.globParent(pattern)returns the directory before the first glob segment.The
astandast-jsgenerators and two tests use them, andtinyglobbyalso leavespackages/node's devDependencies. Both packages stay in the lockfile, since Vite and our dev tooling use them, so this drops two direct runtime dependencies of@doc-kit/corerather than lockfile entries.Validation
node --run test(754/754),node --run lintandnode --run format:checkare clean, and the frozen-lockfile install passes. The newglob.test.mjscovers matching files without directories,ignore, absolute patterns, aURLascwd, andglobParentfor glob patterns, plain paths and the.//fallbacks.Compared against tinyglobby 0.2.17 and glob-parent 6.0.2 on nodejs/node's own files, both find the same files and the same parent for every pattern:
doc/api/*.md(ignoringquic.md)lib/*.jslib/**/*.js(ignoringlib/internal/**)<checkout>/doc/api/*.mddoc/api/{fs,path}.mdRelated Issues
Came out of the dependency audit in #1178.
Check List
node --run testand all tests passed.node --run format:check&node --run lint.