This reverts commit411c9338c6. 문제: #55(b4895894)가 main run 376의 FE-GATE-030(browser file/storage 제거 드릴)을 깨서 411c9338(#64)로 통째로 되돌렸다. #55의 검사기 진단과 시험 빈틈 고침 12커밋이 main에 없다. 고른 방법: 되돌림을 되돌려 #55를 그대로 다시 넣고, 드릴을 깬 원인은 다음 커밋에서 따로 고친다. 리뷰어가 이 커밋이 #55와 같은지 트리로 볼 수 있다. 이 커밋의 트리는b4895894트리에 그 뒤 main에 들어온 #63·#65만 더한 것이다(git diffb4895894<이 커밋>: docs/ledger 두 파일, cross-context-invalidation adapter 한 파일과 시험 두 파일). 버린 대안: #55 커밋 12개 cherry-pick.71606ff1merge의 충돌 해소분을 다시 풀어야 하고 결과 트리를 b4895894와 대조하기 어렵다. 위험·한계: 이 커밋만으로는 main 단계의 FE-GATE-030이 run 376처럼 실패한다(같은 트리 내용). PR 단계 게이트는 돈다. 검증: 다음 커밋 본문에 적는다. 그 커밋의 새 단언을 이 커밋의 검사기에 돌리면 실패한다(RED). Refs: #55, #64
75 lines
3.1 KiB
TypeScript
75 lines
3.1 KiB
TypeScript
import { readFile } from "node:fs/promises";
|
|
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
import { findRouteChunk } from "../../scripts/lib/build-manifest-outputs.ts";
|
|
|
|
// 0929/13-03. The route chunk was found by the chunk's `name`, so naming route
|
|
// chunks in vite.config.ts (the way tech-log did) stopped the build with
|
|
// `Missing built route chunk: APP_HOME` and no reason. It is found by the
|
|
// page's source file now, which is what the route runtime's moduleId names.
|
|
describe("route chunk lookup (0929/13-03)", () => {
|
|
const manifest = {
|
|
"index.html": { file: "assets/index-a.js", isEntry: true },
|
|
"src/presentation/pages/home-page.tsx": {
|
|
file: "assets/route-home-page-b.js",
|
|
name: "route-home-page",
|
|
src: "src/presentation/pages/home-page.tsx",
|
|
isDynamicEntry: true,
|
|
},
|
|
"src/features/order-feature/presentation/order-feature-list-page.tsx": {
|
|
file: "assets/order-feature-list-page-c.js",
|
|
name: "order-feature-list-page",
|
|
isDynamicEntry: true,
|
|
},
|
|
"_home-page-shared.js": { file: "assets/home-page-d.js", name: "home-page" },
|
|
};
|
|
|
|
it("finds the chunk by the page's source file even when the chunk has another name", () => {
|
|
expect(findRouteChunk(manifest, "APP_HOME", "home-page")).toEqual({ file: "assets/route-home-page-b.js" });
|
|
expect(findRouteChunk(manifest, "ORDER_FEATURE_LIST", "order-feature-list-page")).toEqual({
|
|
file: "assets/order-feature-list-page-c.js",
|
|
});
|
|
});
|
|
|
|
it("names the reason and the rule when no lazily imported page has that file name", () => {
|
|
const lookup = findRouteChunk(manifest, "NOT_FOUND", "not-found-page");
|
|
expect(lookup).toEqual({
|
|
error:
|
|
"Missing built route chunk: NOT_FOUND: no lazily imported module in the Vite manifest has the source " +
|
|
"file not-found-page.tsx (or .ts). A route runtime's moduleId must be the file name of the page it imports.",
|
|
});
|
|
});
|
|
|
|
it("refuses two lazily imported pages with the same file name", () => {
|
|
const lookup = findRouteChunk(
|
|
{ ...manifest, "src/other/home-page.tsx": { file: "assets/home-page-e.js", isDynamicEntry: true } },
|
|
"APP_HOME",
|
|
"home-page",
|
|
);
|
|
expect(lookup).toEqual({
|
|
error:
|
|
"Ambiguous built route chunk: APP_HOME: the lazily imported modules " +
|
|
"src/presentation/pages/home-page.tsx, src/other/home-page.tsx are all named home-page.",
|
|
});
|
|
});
|
|
|
|
it("names a route without a runtime contract", () => {
|
|
expect(findRouteChunk(manifest, "GHOST", undefined)).toEqual({
|
|
error: "Missing built route chunk: GHOST has no route runtime contract (ROUTE_RUNTIME_CONTRACT)",
|
|
});
|
|
});
|
|
|
|
it("is the one lookup the manifest writer and both release checks use", async () => {
|
|
for (const file of [
|
|
"scripts/generate-build-manifest.ts",
|
|
"scripts/verify-release.ts",
|
|
"scripts/lib/local-release-evidence.ts",
|
|
]) {
|
|
const source = await readFile(file, "utf8");
|
|
expect(source, file).toContain("findRouteChunk(");
|
|
expect(source, file).not.toMatch(/\.name === runtime\?\.moduleId/u);
|
|
}
|
|
});
|
|
});
|