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.
This commit is contained in:
Classic298
2026-07-02 22:42:53 +02:00
parent aa0ffb4513
commit b937806130
+1 -1
View File
@@ -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, "\\$&")}`
),
""
)