From b937806130bb4c4bbfaa55156f9a80815ca900ce Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Thu, 2 Jul 2026 22:42:53 +0200 Subject: [PATCH] Fix generate-raw-docs regex on Windows routeForDoc built its strip-prefix regex as `^${escaped DOCS_DIR}${path.sep}`, appending path.sep unescaped. On Windows path.sep is a backslash, so the pattern ended in a lone backslash and threw "Invalid regular expression: \ at end of pattern", breaking the postbuild step of every local Windows build (CI on Linux was unaffected). Fold path.sep into the escaped expression so the separator is escaped on every platform. --- scripts/generate-raw-docs.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/generate-raw-docs.mjs b/scripts/generate-raw-docs.mjs index 4fd0cf25..fbaaa988 100644 --- a/scripts/generate-raw-docs.mjs +++ b/scripts/generate-raw-docs.mjs @@ -65,7 +65,7 @@ function routeForDoc(filePath) { let route = filePath .replace( new RegExp( - `^${DOCS_DIR.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}${path.sep}` + `^${(DOCS_DIR + path.sep).replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}` ), "" )