fix(javascript): separate erased types from runtime semantics

Record erasure during definition indexing and reuse it across runtime references, captures, effects, module links, routes, Electron and Vite. Preserve source type links and emitted decorator and computed-key effects; keep actual runtime reads and escapes conservative.

Validation: 1,647 focused tests and 9 documentation tests passed, with build, static and documentation gates. The inherited reference-lifetimes stress file exhausts a 512 MiB worker on both unmodified 18451e479 and this change; that file remains unverified. TypeScript 7.0.2 emit was inspected for ES2022 and ES2018 without executing emitted code.
This commit is contained in:
morluto
2026-10-24 18:00:41 +08:00
parent cab78de506
commit 89006609f1
32 changed files with 756 additions and 328 deletions
@@ -113,7 +113,10 @@ export function* analyzeParsedJavaScriptStaticSourceSteps(
isElectronRendererLoad(callee, site, findings, index),
source,
accumulator,
vitePreloadDependencyTable: indexVitePreloadDependencyTable(file.program),
vitePreloadDependencyTable: indexVitePreloadDependencyTable(
file.program,
bindings.erasedSyntaxNodes,
),
openReceiverFacts: receivers.openReceivers,
electronBindings: electronIdentity.bindings,
electronExportIntact: electronIdentity.intactExport,
@@ -167,7 +170,8 @@ function* traverseStaticSourceSteps(
enter: (node, parent) => {
findings.accumulator.visitedNodes += 1;
routeScan.inspect(node, parent);
inspectNode(node, findings, bindings);
if (!bindings.erasedSyntaxNodes.has(node))
inspectNode(node, findings, bindings);
return undefined;
},
});