mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-31 07:23:06 +08:00
Add the @scriptc/libnode-<platform> packs (linux-x64-gnu, linux-arm64-gnu, darwin-arm64, darwin-x64): the pinned Node.js 24.22.0 built as a stripped shared library with full ICU and its startup snapshot, the scriptc bridge compiled against that release's headers, Node's LICENSE and a manifest with the Node version, NODE_MODULE_VERSION, bridge ABI and file hashes. packages/libnode-common holds the pin, the build (fetch and verify the source tarball, configure --shared, build only the libnode target, strip, stage with headers in a cache keyed by release, flags, platform and toolchain; the bridge rebuilds in seconds against the cached headers), a verifier, and a smoke test: a C program that loads a pack the way the runtime does, starts Node from the snapshot and evaluates expressions synchronously, asynchronously and throwing. The libnode-packs workflow builds the packs on native runners, Linux in the manylinux_2_28 images for a glibc 2.28 floor, caches each libnode build, smoke-tests and uploads every pack. It never runs in the ordinary build or test path. The compiler gains the pack lookup (SCRIPTC_LIBNODE, then the installed package), validation, the nodeIslands.libnode placements and the license notices for the Node island loader to use. The bridge source and its C ABI header are the NI-1 bridge agent's, included here so the packs build; the packs stay private until the in-process island runtime ships. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
1.1 KiB
JavaScript
30 lines
1.1 KiB
JavaScript
#!/usr/bin/env node
|
|
// Prints the CI cache identity of one platform's libnode build as
|
|
// GitHub Actions outputs: `key` (Node release, configure flags, platform,
|
|
// toolchain), `path` (the staged build directory under the cache root,
|
|
// relative to it) and `bridge` (the bridge source hash, which is not part
|
|
// of the key: a bridge change reuses the cached libnode).
|
|
//
|
|
// node packages/libnode-common/scripts/cache-key.mjs --platform <p> [--toolchain <t>]
|
|
import { parseArgs } from "node:util";
|
|
import { bridgeHash, libnodeCacheKey, readPin } from "./pin.mjs";
|
|
|
|
const { values } = parseArgs({
|
|
options: { platform: { type: "string" }, toolchain: { type: "string" } },
|
|
});
|
|
if (!values.platform) {
|
|
console.error("usage: cache-key.mjs --platform <platform> [--toolchain <name>]");
|
|
process.exit(2);
|
|
}
|
|
const pin = readPin();
|
|
const key = libnodeCacheKey(values.platform, values.toolchain);
|
|
process.stdout.write(
|
|
[
|
|
`key=libnode-${values.platform}-${pin.nodeVersion}-${key}`,
|
|
`path=${values.platform}-${pin.nodeVersion}-${key.slice(0, 16)}`,
|
|
`bridge=${bridgeHash()}`,
|
|
`node=${pin.nodeVersion}`,
|
|
"",
|
|
].join("\n"),
|
|
);
|