fix: narrow a2ui bundle hash inputs

This commit is contained in:
Peter Steinberger
2026-04-15 00:44:03 +01:00
parent 778ac4330a
commit 5ed9016914
3 changed files with 74 additions and 12 deletions

View File

@@ -2,7 +2,10 @@ import path from "node:path";
import { describe, expect, it } from "vitest";
import {
compareNormalizedPaths,
getBundleHashInputPaths,
getBundleHashRepoInputPaths,
getLocalRolldownCliCandidates,
getResolvedBundleDependencyPackageJsonPaths,
isBundleHashInputPath,
} from "../../scripts/bundle-a2ui.mjs";
@@ -48,4 +51,31 @@ describe("scripts/bundle-a2ui.mjs", () => {
"repo/ä.ts",
]);
});
it("keeps repo-root package churn out of bundle hash inputs", () => {
const repoRoot = path.resolve("repo-root");
const inputPaths = getBundleHashRepoInputPaths(repoRoot);
expect(inputPaths).toContain(path.join(repoRoot, "ui", "package.json"));
expect(inputPaths).not.toContain(path.join(repoRoot, "package.json"));
expect(inputPaths).not.toContain(path.join(repoRoot, "pnpm-lock.yaml"));
});
it("tracks only the resolved bundle dependency manifests from node_modules", () => {
const repoRoot = process.cwd();
const dependencyPaths = getResolvedBundleDependencyPackageJsonPaths(repoRoot);
expect(dependencyPaths).toContain(path.join(repoRoot, "node_modules", "lit", "package.json"));
expect(dependencyPaths).toContain(
path.join(repoRoot, "node_modules", "@lit/context", "package.json"),
);
expect(dependencyPaths).toContain(
path.join(repoRoot, "node_modules", "@lit-labs/signals", "package.json"),
);
expect(dependencyPaths).toContain(
path.join(repoRoot, "node_modules", "signal-utils", "package.json"),
);
expect(getBundleHashInputPaths(repoRoot)).not.toContain(path.join(repoRoot, "package.json"));
expect(getBundleHashInputPaths(repoRoot)).not.toContain(path.join(repoRoot, "pnpm-lock.yaml"));
});
});