Heimdall/package.json
Meta Vens c931775ad1 Bundle the service; ship one executable instead of a dependency tree
Idunn refuses to seal a release containing a symlink with parent traversal,
and pnpm's node_modules is exactly that -- a forest of relative links into
.pnpm. Negotiating with that layout failed twice: --node-linker=hoisted was
silently ignored (staging trees still had .pnpm), and pnpm 10's
--config.node-linker=hoisted did not resolve it either.

Bundling removes the question. `pnpm bundle` runs esbuild over src/index.ts
into a single 2.5 MB dist/heimdall with a shebang and a createRequire shim
for the CJS dependencies, pg-native left external as the optional native
binding it is. node_modules is now a build input rather than an artifact.

That also fixes a defect the seal had not reached yet: launch_command does
`ensure!(executable.is_file())` and execs the artifact directly, so the old
recipe -- executable_artifact pointing at the dist *directory*, with
"dist/src/index.js" as the first argument -- would have failed there too.
The service is now one file that is genuinely executable, and its only
arguments are the state root Idunn assigns.

Shipping a dependency tree to run a service was the larger liability
anyway; this deletes it rather than making it sealable.

Recipe validates; 54 pass, 1 skipped, tsc clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-06 16:51:59 +02:00

44 lines
1.5 KiB
JSON

{
"name": "heimdall",
"private": true,
"type": "module",
"packageManager": "pnpm@10.33.0",
"engines": {
"node": ">=24.0.0"
},
"scripts": {
"build": "tsc -p tsconfig.json",
"dev": "tsx watch src/index.ts",
"start": "node dist/index.js",
"test": "vitest run --config vitest.config.ts",
"typecheck": "tsc -p tsconfig.json --noEmit",
"export:provider-health-public-key": "tsx src/export-provider-health-public-key.ts",
"export:provider-advertisement": "tsx src/export-provider-advertisement.ts --pretty",
"bundle": "esbuild src/index.ts --bundle --platform=node --format=esm --target=node24 --outfile=dist/heimdall --external:pg-native --banner:js=\"#!/usr/bin/env node\nimport{createRequire}from'node:module';const require=createRequire(import.meta.url);\""
},
"dependencies": {
"@fastify/cors": "^11.2.0",
"@msgpack/msgpack": "^3.1.3",
"cultcache-ts": "file:vendor/CultLib/packages/cultcache-ts",
"cultmesh-ts": "file:vendor/CultLib/packages/cultmesh-ts",
"cultnet-ts": "file:vendor/CultLib/packages/cultnet-ts",
"fastify": "^5.8.5",
"pg": "^8.20.0",
"zod": "^3.25.76"
},
"devDependencies": {
"@types/node": "^25.6.0",
"@types/pg": "^8.20.0",
"pg-mem": "^3.0.14",
"tsx": "^4.21.0",
"typescript": "^6.0.3",
"vitest": "^4.1.5",
"esbuild": "^0.27.7"
},
"pnpm": {
"overrides": {
"cultcache-ts": "file:vendor/CultLib/packages/cultcache-ts",
"cultnet-ts": "file:vendor/CultLib/packages/cultnet-ts"
}
}
}