Skip to content

chore(core): find input files with node:fs globSync - #1180

Open
ovflowd wants to merge 2 commits into
mainfrom
chore/node-glob
Open

ovflowd wants to merge 2 commits into
mainfrom
chore/node-glob

Conversation

@ovflowd

@ovflowd ovflowd commented Oct 26, 2026

Copy link
Copy Markdown
Member

Description

This PR replaces tinyglobby and glob-parent in @doc-kit/core with a small #utils/glob.mjs on Node.js's built-in fs.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 ast and ast-js generators and two tests use them, and tinyglobby also leaves packages/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/core rather than lockfile entries.

Validation

node --run test (754/754), node --run lint and node --run format:check are clean, and the frozen-lockfile install passes. The new glob.test.mjs covers matching files without directories, ignore, absolute patterns, a URL as cwd, and globParent for 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:

Pattern Files
doc/api/*.md (ignoring quic.md) 69
lib/*.js 56
lib/**/*.js (ignoring lib/internal/**) 73
an absolute <checkout>/doc/api/*.md 70
doc/api/{fs,path}.md 2

Related Issues

Came out of the dependency audit in #1178.

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run node --run test and all tests passed.
  • I have check code formatting with node --run format:check & node --run lint.
  • I've covered new added functionality with unit tests if necessary.

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>
@ovflowd
ovflowd requested a review from a team as a code owner October 26, 2026 13:09
@vercel

vercel Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
api-docs-tooling Ready Ready Preview Oct 26, 2026 6:08pm UTC

Request Review

@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.26471% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 93.47%. Comparing base (ec7751f) to head (fe73cbd).

Files with missing lines Patch % Lines
packages/core/src/generators/ast/generate.mjs 50.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

api-links Generator

Performance estimate (single CI run)

  • Generation time: 5.6% slower (1.07 s → 1.13 s)
  • Peak memory: 0.3% lower (289.13 MB → 288.23 MB)

json Generator

Performance estimate (single CI run)

  • Generation time: 13.3% faster (7.46 s → 6.47 s)
  • Peak memory: 9.0% higher (1.18 GB → 1.29 GB)

legacy-html Generator

Performance estimate (single CI run)

  • Generation time: 68.9% slower (10.58 s → 17.87 s)
  • Peak memory: 1.1% lower (1.79 GB → 1.77 GB)

legacy-json Generator

Performance estimate (single CI run)

  • Generation time: 25.7% faster (9.04 s → 6.72 s)
  • Peak memory: 3.2% higher (1.15 GB → 1.19 GB)

llms-txt Generator

Performance estimate (single CI run)

  • Generation time: 5.2% slower (8.10 s → 8.52 s)
  • Peak memory: 6.5% lower (1.19 GB → 1.11 GB)

orama-db Generator

Output size: 1 file changed · net +98.00 B

File size details
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)

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ fe73cbd 2026-10-26T18:09:30.118Z View logs ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ fd5420a 2026-10-26T13:08:59.869Z View logs ↗

Comment thread packages/core/src/utils/glob.mjs
`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>

This branch was successfully deployed

1 active deployment
Preview – api-docs-tooling — fe73cbd1 Deployed Oct 26, 2026 by vercel[bot]
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