mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #52] [MERGED] fix: replace glob npm package with native node:fs/promises glob #273
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#273
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/52
Author: @torresgol10
Created: 2/25/2026
Status: ✅ Merged
Merged: 2/25/2026
Merged by: @southpolesteve
Base:
main← Head:fix/native-glob-routing📝 Commits (5)
e2850bafix: replace glob npm package with native node:fs/promises glob66b17a2fix: address review feedback on native glob migrationafd247crefactor: use glob pattern arrays instead of callbacks for exclude4b0515eMerge branch 'cloudflare:main' into fix/native-glob-routing3861a01merge: resolve conflict keeping glob pattern exclude📊 Changes
4 files changed (+20 additions, -169 deletions)
View changed files
📝
packages/vinext/package.json(+3 -1)📝
packages/vinext/src/routing/app-router.ts(+5 -14)📝
packages/vinext/src/routing/pages-router.ts(+12 -13)📝
pnpm-lock.yaml(+0 -141)📄 Description
Summary
Migrate
pagesRouter,apiRouter, andappRouterfrom the third-partyglobpackage to Node.js built-inglobfromnode:fs/promises(available since Node 22).Changes
pages-router.ts: Usefor awaitwith nativeglob(). Replaceignoreoption withexcludecallback for filteringapi/and_-prefixed files.app-router.ts: Usefor awaitwith nativeglob(). Replace post-filtering of@-prefixed slot segments withexcludecallback. NormalizepagePath/routePathoutput with.replaceAll("\\", "/")for cross-platform consistency.package.json: Removeglobdependency (no longer needed).Motivation
globnpm package is no longer needed since Node.js 22+ provides native glob support.globpackage returned paths with forward slashes on all platforms, which masked a bug where dynamic route segments (e.g.,[slug]) were incorrectly parsed due to premature path separator normalization. The native glob returns OS-native separators, and normalization is now done only on the final output metadata.Testing
All 50 routing tests pass (
pnpm test -- tests/routing.test.ts).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.