mirror of
https://github.com/morluto/rea.git
synced 2026-10-19 04:19:54 -05:00
Track module writes and escapes at their owner, preserve capture and reassignment ordering, and share CommonJS/default namespace identity without erasing parent-slot changes. Carry write sites into ambient alias resolution and use parsed write targets across consumers. Deduplicate returned-reference work with cycle context; retain unchanged temporal selection identity so provenance memoization stays effective. Reviewed fixes include #2041, #2465, #2830, #2881, and #2948. Remove superseded mutation representations and the ineffective per-markValue dedup layer. Validation: 380 focused JavaScript tests passed under a 384 MiB heap cap, including the previously aborting 30-level/128-call alias regression. Six public CLI/MCP builtin tests passed. Exact pdf.js completed-workflow performance remains unmeasured.
44 lines
1.5 KiB
TypeScript
44 lines
1.5 KiB
TypeScript
import { buildJavaScriptSemanticGraph } from "../../src/application/javascript/JavaScriptSemanticGraphBuilder.js";
|
|
import type { JavaScriptArtifactAnalysis } from "../../src/application/javascript/JavaScriptArtifactAnalysisTypes.js";
|
|
import type { JavaScriptArtifactFile } from "../../src/domain/javascript/javascriptArtifactFiles.js";
|
|
import type { JavaScriptSemanticIr } from "../../src/domain/javascript/javascriptSemanticIr.js";
|
|
import { analyzeJavaScriptSemantics } from "../../src/domain/javascript/javascriptSemanticAnalysis.js";
|
|
|
|
const SHA256 = "a".repeat(64);
|
|
|
|
/** Build a semantic graph from one source file for application-level tests. */
|
|
export const graphForJavaScript = (
|
|
source: string,
|
|
ir: JavaScriptSemanticIr = analyzeJavaScriptSemantics(source),
|
|
) => {
|
|
const file: JavaScriptArtifactFile = {
|
|
path: "app.js",
|
|
container_sha256: SHA256,
|
|
sha256: SHA256,
|
|
bytes: Buffer.byteLength(source),
|
|
inventory_artifact_id: `art_${SHA256}`,
|
|
kind: "javascript",
|
|
unpacked: false,
|
|
text: { included: true, value: source },
|
|
};
|
|
const analysis: JavaScriptArtifactAnalysis = {
|
|
files: [{ file, javascript: null, semantic: { ir } }],
|
|
packages: [],
|
|
json_modules: [],
|
|
html_scripts: [],
|
|
html_inline_scripts: [],
|
|
source_maps: [],
|
|
visited_ast_nodes: 0,
|
|
findings: 0,
|
|
modules: 0,
|
|
parse_failures: 0,
|
|
limitations: [],
|
|
};
|
|
|
|
return buildJavaScriptSemanticGraph({
|
|
rootArtifactSha256: SHA256,
|
|
applicationGraph: { graph_id: `jag_${"b".repeat(64)}`, nodes: [] },
|
|
analysis,
|
|
});
|
|
};
|