refactor(reference): share graph index projections

This commit is contained in:
morluto committed 2026-09-29 19:12:15 +08:00
1 parent a6d9e49ab4
commit 6ee87fbf2d
2 files changed
+10 -30

No files matched your search

+6 -4
View File
@@ -255,7 +255,8 @@ const checkSortedUnique = (
}
};
const expectedLanguages = (
/** Derive the canonical language index from inventoried source files. */
export const historicalSourceLanguages = (
entries: readonly z.infer<typeof sourceEntrySchema>[],
): string[] =>
[
@@ -268,7 +269,8 @@ const expectedLanguages = (
),
].sort(compareUnicodeCodePoints);
const expectedManifests = (
/** Derive the canonical manifest path index from inventoried source files. */
export const historicalSourceManifests = (
entries: readonly z.infer<typeof sourceEntrySchema>[],
): string[] =>
entries
@@ -408,7 +410,7 @@ function checkGraphInvariants(
if (
canonicalJson(graph.languages) !==
canonicalJson(expectedLanguages(graph.entries))
canonicalJson(historicalSourceLanguages(graph.entries))
)
context.addIssue({
code: "custom",
@@ -417,7 +419,7 @@ function checkGraphInvariants(
});
if (
canonicalJson(graph.manifests) !==
canonicalJson(expectedManifests(graph.entries))
canonicalJson(historicalSourceManifests(graph.entries))
)
context.addIssue({
code: "custom",