From f004a9e03e0a22cc64ce647a5294d9f51a69c566 Mon Sep 17 00:00:00 2001 From: Nawid Salehie <102778966+Nawid3333@users.noreply.github.com> Date: Sun, 6 Sep 2026 21:51:39 +0200 Subject: [PATCH] Fix build on Windows: parameter shadowed volumeNameLen in cleanGlobPath cleanGlobPath's second parameter was named volumeNameLen, shadowing the module-level volumeNameLen() function. The Windows branch then called it as a function, but the caller passes a number: let volumeLen = volumeNameLen(pattern); ;[volumeLen, dir] = cleanGlobPath(dir, volumeLen); so `node build.mjs` died immediately on Windows with "volumeNameLen is not a function". The POSIX branch treated the same parameter correctly as a number, which is why this only ever showed up on Windows. Renamed the parameter to vollen in both branches and dropped the redundant call, matching what the caller already computes. Verified: `npm run build` now completes on Windows and produces the same three packages it produces on Linux. Co-Authored-By: Claude Opus 5 --- miniglob.mjs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/miniglob.mjs b/miniglob.mjs index fdc561f1..00347d88 100644 --- a/miniglob.mjs +++ b/miniglob.mjs @@ -65,8 +65,7 @@ const volumeNameLen = WIN32 ? (path) => { // cleanGlobPath(path :string) : [prefixLen int, cleaned string] // const cleanGlobPath = ( - WIN32 ? (path, volumeNameLen) => { // (prefixLen int, cleaned string) - let vollen = volumeNameLen(path); + WIN32 ? (path, vollen) => { // (prefixLen int, cleaned string) if (path == '') { return [0, '.']; } @@ -81,15 +80,15 @@ const cleanGlobPath = ( vollen = path.length - 1; } return [vollen, path.substr(0, path.length-1)]; // chop off trailing separator - } : (path, volumeNameLen) => { + } : (path, vollen) => { if (path == '') { - return [volumeNameLen, '.']; + return [vollen, '.']; } if (path == DIRSEP) { // do nothing to the path - return [volumeNameLen, path]; + return [vollen, path]; } - return [volumeNameLen, path.substr(0, path.length-1)]; // chop off trailing separator + return [vollen, path.substr(0, path.length-1)]; // chop off trailing separator } );