mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 04:12:10 +03:00
fix(build): ship app/peer-stamp.mjs in npm pack (server-ws.mjs hard-dep)
server-ws.mjs imports ./peer-stamp.mjs but the npm-pack path didn't include it: prepublish.ts didn't copy it and pack-artifact-policy pruned it (not in the app/ allowlist). Without it the WS wrapper throws ERR_MODULE_NOT_FOUND on boot and the peer-IP stamp (authz LOCAL_ONLY locality) never runs. Copy it in prepublish + allowlist + mark required so a regression fails the pack.
This commit is contained in:
@@ -32,6 +32,7 @@ export const APP_STAGING_ALLOWED_EXACT_PATHS: string[] = [
|
||||
"docs/reference/openapi.yaml",
|
||||
"open-sse/mcp-server/server.js",
|
||||
"package.json",
|
||||
"peer-stamp.mjs",
|
||||
"responses-ws-proxy.mjs",
|
||||
"scripts/dev/sync-env.mjs",
|
||||
"server.js",
|
||||
@@ -104,6 +105,7 @@ export const PACK_ARTIFACT_REQUIRED_PATHS: string[] = [
|
||||
"app/server.js",
|
||||
"app/server-ws.mjs",
|
||||
"app/responses-ws-proxy.mjs",
|
||||
"app/peer-stamp.mjs",
|
||||
"bin/cli/program.mjs",
|
||||
"bin/mcp-server.mjs",
|
||||
"bin/nodeRuntimeSupport.mjs",
|
||||
|
||||
@@ -202,13 +202,19 @@ cpSync(standaloneDir, APP_DIR, { recursive: true });
|
||||
|
||||
const standaloneWsSrc = join(ROOT, "scripts", "dev", "standalone-server-ws.mjs");
|
||||
const responsesWsProxySrc = join(ROOT, "scripts", "dev", "responses-ws-proxy.mjs");
|
||||
if (existsSync(standaloneWsSrc) && existsSync(responsesWsProxySrc)) {
|
||||
const peerStampSrc = join(ROOT, "scripts", "dev", "peer-stamp.mjs");
|
||||
if (existsSync(standaloneWsSrc) && existsSync(responsesWsProxySrc) && existsSync(peerStampSrc)) {
|
||||
console.log(" 📋 Adding Responses WebSocket standalone wrapper...");
|
||||
cpSync(standaloneWsSrc, join(APP_DIR, "server-ws.mjs"));
|
||||
writeFileSync(
|
||||
join(APP_DIR, "responses-ws-proxy.mjs"),
|
||||
'export * from "../scripts/dev/responses-ws-proxy.mjs";\n'
|
||||
);
|
||||
// server-ws.mjs imports ./peer-stamp.mjs (the trusted peer-IP stamp helper
|
||||
// the authz middleware relies on). It is self-contained (node builtins only),
|
||||
// so copy it directly alongside server-ws.mjs. Without this the wrapper throws
|
||||
// ERR_MODULE_NOT_FOUND on boot and the server falls back to no peer stamp.
|
||||
cpSync(peerStampSrc, join(APP_DIR, "peer-stamp.mjs"));
|
||||
}
|
||||
|
||||
// ── Next.js Turbopack Standalone Tracer Fix ───────────────
|
||||
|
||||
Reference in New Issue
Block a user