cloudflare / vinext

fix: replace glob npm package with native node:fs/promises glob (#52)
* fix: replace glob npm package with native node:fs/promises glob Migrate pagesRouter, apiRouter, and appRouter from the third-party 'glob' package to Node.js built-in glob (node:fs/promises), available since Node 22. This removes a dependency and fixes path handling issues on Windows where dynamic route segments (e.g. [slug]) were incorrectly parsed due to premature path separator normalization. Changes: - Use for-await with glob() from node:fs/promises - Use exclude callbacks instead of post-filtering - Normalize pagePath/routePath with replaceAll('\\', '/') in output - Remove glob dependency from package.json * fix: address review feedback on native glob migration - Fix excludePrivate over-exclusion: the native glob exclude callback fires at every directory depth, not just the root. Replace with post-filtering on the first path segment to match the old glob package's root-relative ignore behavior. - Remove redundant .replaceAll('\\', '/') normalization from pagePath/routePath in app-router.ts — consumers already normalize backslashes, and this was inconsistent with pages-router.ts. - Add engines field (node >= 22) since fs.glob requires Node 22+. * refactor: use glob pattern arrays instead of callbacks for exclude - app-router: replace hasSlotSegment callback with ['**/@*'] pattern - pages-router: replace excludePrivate callback with ['api', '**/_*'] patterns - Simplify iteration: process glob results directly instead of collecting into intermediate arrays --------- Co-authored-by: Steve Faulkner <sfaulkner@cloudflare.com>
Ivan Torres Ivan Torres committed on Feb 25, 2026, 06:31 PM
Showing 4 changed files +20 additions -169 deletions
Browse files at this commit →