From ee24bfc32d110ee978c9db2add9703276c38a7c0 Mon Sep 17 00:00:00 2001 From: shlim Date: Fri, 26 Jun 2026 01:27:54 +0900 Subject: [PATCH] fix(build): escape literal braces in bun:sqlite stub regex The Node server bundle post-processing in build-node-server.sh uses a Perl substitution with an unescaped literal `{` in the pattern `import { Database } from "bun:sqlite";`. Perl treats an unescaped `{` that is not part of a valid quantifier as an error ("Unescaped left brace in regex is illegal here in regex"), hard-failing the build with exit code 255 and breaking `./setup`. Reproduced on Windows Git Bash (msys Perl 5.26.2); also affects modern Perl 5.32+ on Linux. Escaping the braces (`\{ \}`) matches them literally and is backward compatible; verified the substitution still produces the expected `const Database = null` stub and `node --check` passes on the resulting server-node.mjs. Co-Authored-By: Claude Opus 4.8 (1M context) --- browse/scripts/build-node-server.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browse/scripts/build-node-server.sh b/browse/scripts/build-node-server.sh index 3ab652ac0..5ee2dd4d0 100755 --- a/browse/scripts/build-node-server.sh +++ b/browse/scripts/build-node-server.sh @@ -32,7 +32,7 @@ bun build "$SRC_DIR/server.ts" \ # Replace import.meta.dir with a resolvable reference perl -pi -e 's/import\.meta\.dir/__browseNodeSrcDir/g' "$DIST_DIR/server-node.mjs" # Stub out bun:sqlite (macOS-only cookie import, not needed on Windows) -perl -pi -e 's|import { Database } from "bun:sqlite";|const Database = null; // bun:sqlite stubbed on Node|g' "$DIST_DIR/server-node.mjs" +perl -pi -e 's|import \{ Database \} from "bun:sqlite";|const Database = null; // bun:sqlite stubbed on Node|g' "$DIST_DIR/server-node.mjs" # Step 3: Create the final file with polyfill header injected after the first line {