fix(javascript): preserve per-field publication and provenance coverage

This commit is contained in:
morluto committed 2026-10-24 03:10:43 +08:00
1 parent 2206822109
commit f1a9d85de5
8 files changed
+185 -56

No files matched your search

@@ -40,6 +40,7 @@ import {
} from "./javascriptModuleDeclaration.js";
import {
commonJsRuntimeExportValues,
commonJsExportApplicability,
type CommonJsExportReceiverEffect,
type CommonJsExportSite,
} from "./javascriptCommonJsExportReceivers.js";
@@ -468,17 +469,21 @@ const collectCommonJsExport = (
state: JavaScriptSemanticAnalysisState,
receiverEffect: CommonJsExportReceiverEffect | undefined,
): void => {
if (receiverEffect === "detached") return;
// Compound and logical writes also depend on the previous value, so remain
// unknown.
for (const exported of commonJsRuntimeExportValues(node, state))
// Compound and logical writes also depend on the previous value, so remain unknown.
for (const exported of commonJsRuntimeExportValues(node, state)) {
const applicability = commonJsExportApplicability(
receiverEffect,
exported.exportedName,
);
if (applicability === "detached") continue;
addCommonJsExport(
node,
state,
exported.exportedName,
receiverEffect === "uncertain" ? null : exported.value,
applicability === "uncertain" ? null : exported.value,
exported.projection,
);
}
};
const addCommonJsExport = (