Files
DongHyeonkaandClaude Opus 5.5 331ec84037 feat(supply-chain): list the packages the bundle ships and state what each proof covers (13-12)
The module inventory named dependency modules external:<file>, so no artifact
said which package versions reach the public bundle. It now records
npm:<name>@<version> ids and a packages list. supply-chain.md states what the
SBOM, bundle list and provenance prove, and one SBOM scope mismatch (scheduler).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 23:19:41 +09:00

32 lines
1.4 KiB
TypeScript

import { readFileSync, realpathSync } from "node:fs";
import path from "node:path";
import { describe, expect, it } from "vitest";
import { bundledPackages, normalizeModuleId } from "../../scripts/lib/vite-module-inventory.ts";
// 13-12. The inventory recorded dependency modules as `external:<file name>`,
// so nothing listed which package versions ship in the public bundle.
describe("vite module inventory", () => {
const root = process.cwd();
const zodCore = realpathSync(path.join(root, "node_modules/zod/v4/core/core.js"));
const zodVersion = (
JSON.parse(readFileSync(path.join(root, "node_modules/zod/package.json"), "utf8")) as { version: string }
).version;
it("names a dependency module by package and version", () => {
expect(normalizeModuleId(zodCore, root)).toBe(`npm:zod@${zodVersion}/v4/core/core.js`);
expect(normalizeModuleId(path.join(root, "src/bootstrap/main.tsx"), root)).toBe("src/bootstrap/main.tsx");
expect(normalizeModuleId("\0vite/preload-helper.js", root)).toBe("vite/preload-helper.js");
});
it("lists each bundled package once", () => {
expect(
bundledPackages([
{ fileName: "a.js", modules: ["npm:zod@4.4.3/v4/core/core.js", "src/a.ts"] },
{ fileName: "b.js", modules: ["npm:@tanstack/query-core@5.0.0/build/a.js", "npm:zod@4.4.3/index.js"] },
]),
).toEqual(["@tanstack/query-core@5.0.0", "zod@4.4.3"]);
});
});