From 0eea54f11c2c8d45ec3dfaa40522030539ab28f1 Mon Sep 17 00:00:00 2001 From: "robopipi[bot]" <336283572+robopipi[bot]@users.noreply.github.com> Date: Sun, 25 Oct 2026 08:54:24 +0100 Subject: [PATCH] fix: normalize path separators in check-entry-graphs on Windows (#11399) `scripts/check-entry-graphs.mjs` built the list of files each export reaches with `path.relative()`, which returns paths with `\` separators on Windows. The allow and forbid patterns are written with `/`, which caused two problems on Windows: - The allow entry `packages/telemetry/src/index.ts` never matched, so the bare `index.ts` forbid pattern flagged it and the check failed even though nothing was wrong. - Forbid patterns that contain a `/` (`providers/`, `runtime/host.ts`, ...) never matched, so real violations went unreported. The fix converts the relative paths to `/` before any comparison. On Linux and macOS nothing changes. Testing: - The scripts have no unit tests, so no test was added. - `node scripts/check-entry-graphs.mjs` and `npm run check` pass on Linux. - I simulated Windows path handling with `path.win32`, without running Windows itself: - Before the fix: `relative(...)` gives `packages\telemetry\src\index.ts`, and `endsWith("packages/telemetry/src/index.ts")` is false. - After the fix: the path becomes `packages/telemetry/src/index.ts`, and the suffix check is true. Fixes #11333 Requested by @badlogic Co-authored-by: triagent --- scripts/check-entry-graphs.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/check-entry-graphs.mjs b/scripts/check-entry-graphs.mjs index a26291094..b3b033a73 100644 --- a/scripts/check-entry-graphs.mjs +++ b/scripts/check-entry-graphs.mjs @@ -12,7 +12,7 @@ */ import { existsSync, readdirSync, readFileSync, statSync } from "node:fs"; -import { dirname, relative, resolve } from "node:path"; +import { dirname, relative, resolve, sep } from "node:path"; import { fileURLToPath } from "node:url"; const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), ".."); @@ -153,7 +153,7 @@ for (const [pkgDir, budgets] of Object.entries(BUDGETS)) { failures += 1; continue; } - const graph = [...walk(source)].map((file) => relative(ROOT, file)); + const graph = [...walk(source)].map((file) => relative(ROOT, file).split(sep).join("/")); if (graph.length > budget.maxFiles) { console.error( `${pkgDir} export "${name}" reaches ${graph.length} files, budget ${budget.maxFiles}\n` +