fix(javascript): preserve source facts across graph projections

This commit is contained in:
morluto committed 2026-10-24 03:00:10 +08:00
1 parent dac544be20
commit c8f8ec656c
14 files changed
+369 -60

No files matched your search

@@ -1,6 +1,18 @@
import { z } from "zod";
import { digestSchema } from "../digests.js";
import type { JavaScriptSourceSelection } from "./javascriptSourceSelection.js";
import type { ArtifactOccurrence } from "../artifactGraph.js";
/** One physical file occurrence, independent of its graph representations. */
export const javaScriptFileOccurrenceSchema = z.strictObject({
container_sha256: digestSchema,
path: z.string().min(1),
sha256: digestSchema,
});
export type JavaScriptFileOccurrence = z.infer<
typeof javaScriptFileOccurrenceSchema
>;
/** Whether an inventoried path has a source extension read by the analyzer. */
export const isJavaScriptSourcePath = (path: string): boolean =>
/\.(?:cjs|cts|mjs|mts|js|jsx|ts|tsx)$/iu.test(path);