test: prove TechLog UI migration parity
This commit is contained in:
+13
-10
@@ -28,6 +28,10 @@ import {
|
||||
} from "./lib/build-manifest-outputs.ts";
|
||||
import { verifyReleaseRuntimeCoherence } from "./lib/release-runtime-coherence.ts";
|
||||
import { writeValidatedJsonArtifact } from "./lib/validated-json-artifact.ts";
|
||||
import {
|
||||
findViteDynamicRouteChunk,
|
||||
type ViteManifestRouteEntry,
|
||||
} from "./lib/vite-route-chunks.ts";
|
||||
import { releaseVerificationArtifactSchema } from "./contracts/release-artifacts.ts";
|
||||
|
||||
type CoherenceFixture = Readonly<{
|
||||
@@ -38,11 +42,6 @@ type CoherenceFixture = Readonly<{
|
||||
}>;
|
||||
type RuntimeConfigDocument = RuntimeConfigArtifact &
|
||||
Readonly<{ BUILD_ID: string; RELEASE_ID: string }>;
|
||||
type ViteManifestEntry = Readonly<{
|
||||
file: string;
|
||||
name?: string;
|
||||
isDynamicEntry?: boolean;
|
||||
}>;
|
||||
|
||||
export type ReleaseArtifactReader = (path: string) => Promise<unknown>;
|
||||
|
||||
@@ -170,9 +169,9 @@ const runtimeContracts: Readonly<Record<string, { moduleId: string }>> =
|
||||
ROUTE_RUNTIME_CONTRACT;
|
||||
for (const definition of Object.values(ROUTE_REGISTRY)) {
|
||||
const runtime = runtimeContracts[definition.routeId];
|
||||
const viteEntry = Object.values(viteManifestObject).find(
|
||||
(entry) => entry.name === runtime?.moduleId && entry.isDynamicEntry,
|
||||
);
|
||||
const viteEntry = runtime
|
||||
? findViteDynamicRouteChunk(viteManifestObject, runtime.moduleId)
|
||||
: undefined;
|
||||
const routeAsset = release.routeChunks[definition.chunkId];
|
||||
if (!runtime || !viteEntry || routeAsset !== viteEntry.file) {
|
||||
artifactMismatches.push(`routeChunk:mismatch:${definition.chunkId}`);
|
||||
@@ -315,9 +314,9 @@ function parseCompatibilityTuple(value: unknown, label: string): CompatibilityTu
|
||||
|
||||
function parseViteManifest(
|
||||
value: unknown,
|
||||
): Readonly<Record<string, ViteManifestEntry>> {
|
||||
): Readonly<Record<string, ViteManifestRouteEntry>> {
|
||||
const document = requireRecord(value, "Vite manifest");
|
||||
const entries: Record<string, ViteManifestEntry> = {};
|
||||
const entries: Record<string, ViteManifestRouteEntry> = {};
|
||||
for (const [key, candidate] of Object.entries(document)) {
|
||||
const entry = requireRecord(candidate, `Vite manifest entry ${key}`);
|
||||
entries[key] = {
|
||||
@@ -326,6 +325,10 @@ function parseViteManifest(
|
||||
...(typeof entry.isDynamicEntry === "boolean"
|
||||
? { isDynamicEntry: entry.isDynamicEntry }
|
||||
: {}),
|
||||
...(Array.isArray(entry.dynamicImports) &&
|
||||
entry.dynamicImports.every((item) => typeof item === "string")
|
||||
? { dynamicImports: entry.dynamicImports as string[] }
|
||||
: {}),
|
||||
};
|
||||
}
|
||||
return entries;
|
||||
|
||||
Reference in New Issue
Block a user