fix(javascript): trace wrapped Electron IPC paths in large bundles (#1874)

Co-authored-by: David <17119984+fengdwx@users.noreply.github.com>
This commit is contained in:
DavidandDavid authored and GitHub committed 2026-10-12 09:28:59 +08:00
1 parent d93fbda390
commit 87b9793c53
46 files changed
+3213 -355

No files matched your search

@@ -718,6 +718,9 @@ const referencedValues = (
type MutationObservableOrigin =
| t.ObjectExpression
| t.ArrayExpression
| t.ClassDeclaration
| t.ClassExpression
| t.NewExpression
| "ambient"
| "array"
| "array-prototype"
@@ -808,11 +811,6 @@ const observableMutationPaths = (
const observer = bindingNodes.get(binding.bindingId);
if (observer === undefined) continue;
for (const initializer of binding.initializers) {
const expression = unwrapJavaScriptExpression(initializer.node).node;
// Preserve member paths through class values and local instances so
// getter-result aliases can be resolved at the accessor boundary.
if (t.isClass(expression) || t.isNewExpression(expression))
(observer.origins ??= new Set()).add("opaque");
link(
project(expressionNode(initializer.node), initializer.projection),
observer,
@@ -837,7 +835,14 @@ const observableMutationPaths = (
const selected = pendingExpressions.pop();
if (selected === undefined) break;
const { expression, observer } = selected;
if (t.isObjectExpression(expression) || t.isArrayExpression(expression))
// Keep class/getter projections distinct so cycle pruning does not
// discard observable escapes through a shared getter result.
if (
t.isObjectExpression(expression) ||
t.isArrayExpression(expression) ||
t.isClass(expression) ||
t.isNewExpression(expression)
)
(observer.origins ??= new Set()).add(expression);
else if (t.isIdentifier(expression)) {
const binding = resolveSemanticBindingState(