mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-07 08:33:50 +08:00
- Add owned helper and runtime-pack contracts for macOS x64, Linux glibc/musl, Windows x64, and WASI. - Generalize LLVM target selection, package validation, linker plans, and release/CI matrices. - Document linker boundaries and add focused native-output and runtime-pack coverage.
18 lines
1.3 KiB
JavaScript
18 lines
1.3 KiB
JavaScript
#!/usr/bin/env node
|
|
import { createHash } from "node:crypto";
|
|
import { access, readFile } from "node:fs/promises";
|
|
import { join } from "node:path";
|
|
|
|
const root = process.env.SCRIPTC_RUNTIME_PACK_ROOT;
|
|
if (!root) throw new Error("runtime-pack verification requires package wrapper configuration");
|
|
const manifest = JSON.parse(await readFile(join(root, "runtime-pack.json"), "utf8"));
|
|
const packageManifest = JSON.parse(await readFile(join(root, "package.json"), "utf8"));
|
|
if (manifest.schema !== "scriptc.runtime-pack.v1" || manifest.format !== 1 || manifest.package !== packageManifest.name || manifest.version !== packageManifest.version) throw new Error("runtime pack identity does not match package.json");
|
|
const artifacts = [...Object.values(manifest.flavors).flatMap((flavor) => flavor.runtime_units.flatMap((unit) => unit.variants)), ...manifest.archives];
|
|
for (const artifact of artifacts) {
|
|
const bytes = await readFile(join(root, artifact.path));
|
|
if (bytes.length !== artifact.size || createHash("sha256").update(bytes).digest("hex") !== artifact.sha256) throw new Error(`runtime pack hash mismatch: ${artifact.path}`);
|
|
}
|
|
for (const license of manifest.licenses) await access(join(root, license.path));
|
|
process.stdout.write(`verified ${manifest.package}@${manifest.version}: ${artifacts.length} artifacts\n`);
|