@nudojs/core 1.16.0 → 1.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
- import "./chunk-US532PZA.js";
1
+ import "./chunk-II73GZOY.js";
2
2
  import {
3
+ DependencyMemo,
3
4
  INTERFACE_SOURCE_ABBR,
4
5
  NudoSidecarError,
5
6
  absWithStableTermIds,
@@ -38,12 +39,12 @@ import {
38
39
  formatGithubAnnotations,
39
40
  formatGitlabCodeQuality,
40
41
  formatInterfaceTierLine,
41
- generalizeAll,
42
42
  generalizeFromAst,
43
43
  generatedExportNames,
44
44
  getGeneralizeMemoSize,
45
45
  guardLoadModule,
46
46
  hashSource,
47
+ instanceForMethodBridge,
47
48
  interfaceDiagCount,
48
49
  interfaceSourceOf,
49
50
  interfaceTierOf,
@@ -53,12 +54,15 @@ import {
53
54
  listFunctionNames,
54
55
  listTopFunctions,
55
56
  loadModuleDepsFingerprint,
57
+ loadModuleId,
56
58
  localNamedExports,
59
+ moduleMapId,
57
60
  nodeSpan,
58
61
  normPath,
59
62
  parseEnvPayload,
60
63
  parseMockModulePayload,
61
64
  parseNudoImportPayload,
65
+ projectAbsPath,
62
66
  reachableTopBindings,
63
67
  refineDiagCount,
64
68
  refineToIndexedFull,
@@ -87,7 +91,7 @@ import {
87
91
  takeInterfaceDiagsSince,
88
92
  takeRefineDiags,
89
93
  takeRefineDiagsSince
90
- } from "./chunk-POGFCYV2.js";
94
+ } from "./chunk-4MRLOJMI.js";
91
95
  import {
92
96
  $add,
93
97
  $arguments,
@@ -97,7 +101,6 @@ import {
97
101
  $arrWithHoles,
98
102
  $assignRecord,
99
103
  $async,
100
- $asyncReturn,
101
104
  $await,
102
105
  $bitand,
103
106
  $bitnot,
@@ -121,7 +124,6 @@ import {
121
124
  $fnVal,
122
125
  $for,
123
126
  $forInKeys,
124
- $forIter,
125
127
  $forOf,
126
128
  $fork,
127
129
  $ge,
@@ -176,8 +178,6 @@ import {
176
178
  $sub,
177
179
  $super,
178
180
  $switch,
179
- $thisGet,
180
- $thisSet,
181
181
  $throw,
182
182
  $toNumber,
183
183
  $toNumeric,
@@ -196,7 +196,6 @@ import {
196
196
  $updateAdd,
197
197
  $updateSub,
198
198
  $ushr,
199
- $while,
200
199
  $whileSeq,
201
200
  $yield,
202
201
  CONSTRAINT_BUILDERS,
@@ -229,7 +228,6 @@ import {
229
228
  absToString,
230
229
  accessorReadDomain,
231
230
  add,
232
- alphaOf,
233
231
  and,
234
232
  andC,
235
233
  any,
@@ -247,7 +245,6 @@ import {
247
245
  attachContractFaces,
248
246
  attachFnImpl,
249
247
  beginCollectionFork,
250
- betaOf,
251
248
  bigintLit,
252
249
  bindImports,
253
250
  bindingsOf,
@@ -278,7 +275,6 @@ import {
278
275
  constraintToEntryAbs,
279
276
  contractFacesFromEffectiveInterface,
280
277
  contractParamNameSet,
281
- createHofCollectCtx,
282
278
  ctorArgDefinitelyInvalid,
283
279
  ctorNameOfRecv,
284
280
  currentExecPhi,
@@ -361,6 +357,7 @@ import {
361
357
  isDefinitelyTrue,
362
358
  isErrorCtorName,
363
359
  isExactLit,
360
+ isHiddenInternalSlot,
364
361
  isIntFlag,
365
362
  isMapAbs,
366
363
  isNudoBreak,
@@ -442,6 +439,7 @@ import {
442
439
  numLit,
443
440
  numVar,
444
441
  number,
442
+ numericBoundsImply,
445
443
  obj,
446
444
  objOf,
447
445
  objectProtoBrand,
@@ -461,7 +459,6 @@ import {
461
459
  predVars,
462
460
  primToTypeof,
463
461
  projectFlatMapResult,
464
- promoteParamShape,
465
462
  propertyKeyOf,
466
463
  protoBrandAbs,
467
464
  protoOfRecv,
@@ -540,10 +537,6 @@ import {
540
537
  transpileSource,
541
538
  trueConstraint,
542
539
  tryMakeRegexAbs,
543
- tryPromoteDirectCall,
544
- tryPromoteForOfIteratee,
545
- tryPromoteHofCallback,
546
- tryPromoteReceiverAsArr,
547
540
  tryRunTranspiled,
548
541
  tryRunTranspiledDetailed,
549
542
  typeofAbs,
@@ -556,7 +549,7 @@ import {
556
549
  withExecPhi,
557
550
  withInvariantSpecs,
558
551
  withVar
559
- } from "./chunk-OM6SAY2M.js";
552
+ } from "./chunk-ARIQO5XX.js";
560
553
 
561
554
  // src/environment.ts
562
555
  function createEnvironment(parent, bindings = /* @__PURE__ */ new Map()) {
@@ -645,33 +638,6 @@ function mock() {
645
638
  return { kind: "mock-helper" };
646
639
  }
647
640
 
648
- // src/algebra/phi.ts
649
- var phiStack = [pTrue];
650
- function currentPhi() {
651
- return phiStack[phiStack.length - 1] ?? pTrue;
652
- }
653
- function pushPhi(p) {
654
- phiStack.push(p);
655
- }
656
- function popPhi() {
657
- if (phiStack.length > 1) phiStack.pop();
658
- }
659
- function resetPhi() {
660
- phiStack = [pTrue];
661
- }
662
- function withPhiConstraint(extra, body) {
663
- pushPhi(extra);
664
- try {
665
- body();
666
- } finally {
667
- popPhi();
668
- }
669
- }
670
- function describePhi() {
671
- const p = currentPhi();
672
- return p.op === "true" ? "\u22A4" : "(phi)";
673
- }
674
-
675
641
  // src/algebra/check.ts
676
642
  import { isBuiltin } from "module";
677
643
 
@@ -963,7 +929,7 @@ function assertScalar(ret, constraint, phi) {
963
929
  if (phi.op !== "true" && ret.pred && ret.pred.op !== "true" && implies(ret.pred, constraintPred)) {
964
930
  return proved();
965
931
  }
966
- if (ret.pred && ret.pred.op !== "true" && numericBoundsImplyLocal(ret.pred, constraintPred)) {
932
+ if (ret.pred && ret.pred.op !== "true" && numericBoundsImply(ret.pred, constraintPred)) {
967
933
  return proved();
968
934
  }
969
935
  if (phiSuppliesConstraint(phi, constraint, ret)) return proved();
@@ -997,36 +963,6 @@ function assertScalar(ret, constraint, phi) {
997
963
  }
998
964
  return proved();
999
965
  }
1000
- function numericBoundsImplyLocal(src, tgt) {
1001
- const one = (p) => p.op === "gt" || p.op === "ge" || p.op === "lt" || p.op === "le";
1002
- if (!one(src) || !one(tgt)) return false;
1003
- if (src.op !== tgt.op) {
1004
- if (src.op === "gt" && tgt.op === "ge") {
1005
- return sameTermSide(src, tgt) && litGE(src.b, tgt.b);
1006
- }
1007
- if (src.op === "lt" && tgt.op === "le") {
1008
- return sameTermSide(src, tgt) && litLE(src.b, tgt.b);
1009
- }
1010
- return false;
1011
- }
1012
- if (!sameTermSide(src, tgt)) return false;
1013
- const sb = src.b.op === "lit" ? src.b.value : void 0;
1014
- const tb = tgt.b.op === "lit" ? tgt.b.value : void 0;
1015
- if (typeof sb !== "number" || typeof tb !== "number") return false;
1016
- if (src.op === "gt" || src.op === "ge") return sb >= tb;
1017
- return sb <= tb;
1018
- }
1019
- function sameTermSide(a, b) {
1020
- return a.a.op === b.a.op && termEquals(a.a, b.a);
1021
- }
1022
- function litGE(a, b) {
1023
- if (a.op !== "lit" || b.op !== "lit") return false;
1024
- return typeof a.value === "number" && typeof b.value === "number" && a.value >= b.value;
1025
- }
1026
- function litLE(a, b) {
1027
- if (a.op !== "lit" || b.op !== "lit") return false;
1028
- return typeof a.value === "number" && typeof b.value === "number" && a.value <= b.value;
1029
- }
1030
966
  function primOfAbs(a) {
1031
967
  if (a.shape.k === "prim") return a.shape.type;
1032
968
  const lvR = litValue(a);
@@ -1174,9 +1110,6 @@ var ARR_FALLBACK_CONF = /* @__PURE__ */ new Set([
1174
1110
  "path",
1175
1111
  "widened"
1176
1112
  ]);
1177
- function isHiddenInternalSlot(k, slot) {
1178
- return slot.internal === true && canonicalArrayIndex(k) === void 0;
1179
- }
1180
1113
  function absToConstraint(a, budget = new ProjectionBudget()) {
1181
1114
  if (!PROJECTABLE_CONF.has(a.conf)) return void 0;
1182
1115
  const stop = budget.enter(a);
@@ -1710,52 +1643,15 @@ function formatSigCached(absVal, name) {
1710
1643
  }
1711
1644
 
1712
1645
  // src/algebra/check-memo.ts
1713
- var checkReportMemo = /* @__PURE__ */ new Map();
1714
- var checkKeyDeps = /* @__PURE__ */ new Map();
1715
- var checkDepIndex = /* @__PURE__ */ new Map();
1716
- var loadModuleIds = /* @__PURE__ */ new WeakMap();
1717
- var nextLoadModuleId = 1;
1718
1646
  var MAX_CHECK_MEMO = 256;
1647
+ var checkReportMemo = new DependencyMemo(MAX_CHECK_MEMO);
1719
1648
  function resetCheckSourceMemo() {
1720
- checkReportMemo.clear();
1721
- checkKeyDeps.clear();
1722
- checkDepIndex.clear();
1649
+ checkReportMemo.reset();
1723
1650
  resetHashSourceCache();
1724
1651
  resetSidecarLoadFailureCache();
1725
1652
  }
1726
- function loadModuleId(fn2) {
1727
- if (!fn2) return 0;
1728
- let id = loadModuleIds.get(fn2);
1729
- if (id === void 0) {
1730
- id = nextLoadModuleId++;
1731
- loadModuleIds.set(fn2, id);
1732
- }
1733
- return id;
1734
- }
1735
- function unindexCheckKey(key) {
1736
- const deps = checkKeyDeps.get(key);
1737
- if (!deps) return;
1738
- for (const p of deps) {
1739
- const set = checkDepIndex.get(p);
1740
- if (!set) continue;
1741
- set.delete(key);
1742
- if (set.size === 0) checkDepIndex.delete(p);
1743
- }
1744
- checkKeyDeps.delete(key);
1745
- }
1746
1653
  function evictCheckSourceMemoForPaths(paths) {
1747
- let n = 0;
1748
- for (const raw of paths) {
1749
- const p = stablePathKey(raw);
1750
- const keys = checkDepIndex.get(p);
1751
- if (!keys) continue;
1752
- for (const key of [...keys]) {
1753
- checkReportMemo.delete(key);
1754
- unindexCheckKey(key);
1755
- n++;
1756
- }
1757
- }
1758
- return n;
1654
+ return checkReportMemo.evictForPaths(paths);
1759
1655
  }
1760
1656
  function cloneCheckReport(r) {
1761
1657
  return {
@@ -1771,17 +1667,6 @@ function cloneCheckReport(r) {
1771
1667
  ...r.budget ? { budget: { ...r.budget } } : {}
1772
1668
  };
1773
1669
  }
1774
- var moduleMapIds = /* @__PURE__ */ new WeakMap();
1775
- var moduleMapIdSeq = 0;
1776
- function moduleMapId(m) {
1777
- if (!m) return "-";
1778
- let id = moduleMapIds.get(m);
1779
- if (id === void 0) {
1780
- id = ++moduleMapIdSeq;
1781
- moduleMapIds.set(m, id);
1782
- }
1783
- return `m${id}`;
1784
- }
1785
1670
  function checkMemoKey(filePath, source, identityOpts, deps, sidecarFp) {
1786
1671
  return [
1787
1672
  hashSource(source),
@@ -1818,33 +1703,11 @@ function fromKey(from) {
1818
1703
  ).sort().join(";");
1819
1704
  }
1820
1705
  function checkMemoGet(key) {
1821
- if (!checkReportMemo.has(key)) return null;
1822
- const v2 = checkReportMemo.get(key);
1823
- checkReportMemo.delete(key);
1824
- checkReportMemo.set(key, v2);
1825
- return v2;
1706
+ const hit = checkReportMemo.lookup(key);
1707
+ return hit.hit ? hit.value : null;
1826
1708
  }
1827
1709
  function checkMemoSet(key, value, depPaths) {
1828
- if (checkReportMemo.size >= MAX_CHECK_MEMO) {
1829
- const oldest = checkReportMemo.keys().next().value;
1830
- if (oldest !== void 0) {
1831
- checkReportMemo.delete(oldest);
1832
- unindexCheckKey(oldest);
1833
- }
1834
- }
1835
- checkReportMemo.set(key, value);
1836
- if (depPaths.length > 0) {
1837
- const normDeps = [...new Set(depPaths.map(stablePathKey))];
1838
- checkKeyDeps.set(key, normDeps);
1839
- for (const p of normDeps) {
1840
- let set = checkDepIndex.get(p);
1841
- if (!set) {
1842
- set = /* @__PURE__ */ new Set();
1843
- checkDepIndex.set(p, set);
1844
- }
1845
- set.add(key);
1846
- }
1847
- }
1710
+ checkReportMemo.set(key, value, depPaths);
1848
1711
  }
1849
1712
 
1850
1713
  // src/algebra/check-may-throw.ts
@@ -1965,7 +1828,8 @@ function evalThrowsOutcome(source, fnName, args, opts = {}, phi = pTrue, file) {
1965
1828
  const inst = instanceForMethodBridge(
1966
1829
  clsAbs,
1967
1830
  clsName ?? "",
1968
- ctorAnyArgs(file, clsName ?? "")
1831
+ ctorAnyArgs(file, clsName ?? ""),
1832
+ runWithMayThrowSession
1969
1833
  );
1970
1834
  return $invoke(inst, methodName ?? "", args);
1971
1835
  }, phi)
@@ -2041,26 +1905,6 @@ function ctorAnyArgs(file, clsName) {
2041
1905
  const n = file ? ctorParamCountOf(file, clsName) : 0;
2042
1906
  return Array.from({ length: n }, () => abs({ k: "any" }, void 0, pTrue, "path"));
2043
1907
  }
2044
- function instanceForMethodBridge(clsAbs, clsName, ctorArgs) {
2045
- try {
2046
- return runWithMayThrowSession(() => $new(clsAbs, ctorArgs));
2047
- } catch {
2048
- return bareInstanceOf(clsAbs, clsName);
2049
- }
2050
- }
2051
- function bareInstanceOf(clsAbs, clsName) {
2052
- const name = clsAbs.shape.k === "brand" && clsAbs.shape.name.length > 0 ? clsAbs.shape.name : clsName;
2053
- return abs(
2054
- {
2055
- k: "brand",
2056
- name,
2057
- shape: abs({ k: "unknown" }, void 0, void 0, "partial")
2058
- },
2059
- void 0,
2060
- void 0,
2061
- "path"
2062
- );
2063
- }
2064
1908
  function classMemberName(m) {
2065
1909
  const key = m.key;
2066
1910
  if (!key) return void 0;
@@ -2720,18 +2564,6 @@ function witnessViolations(c, w, path, depth) {
2720
2564
  }
2721
2565
  return [];
2722
2566
  }
2723
- function projectCaseArgField(arg, fieldPath) {
2724
- let cur = arg;
2725
- for (const seg of fieldPath) {
2726
- if (!cur) return void 0;
2727
- if (cur.shape.k === "brand") {
2728
- cur = cur.shape.shape;
2729
- }
2730
- if (cur.shape.k !== "obj") return void 0;
2731
- cur = getSlot(cur.shape.slots, seg)?.value;
2732
- }
2733
- return cur;
2734
- }
2735
2567
  function scanCaseInconsistency(source, knownFns, opts) {
2736
2568
  const out = [];
2737
2569
  const directiveSrc = stripStringsKeepComments(source);
@@ -2815,7 +2647,7 @@ function scanCaseInconsistency(source, knownFns, opts) {
2815
2647
  }
2816
2648
  let arg = absArgs[idx];
2817
2649
  if (fieldPath) {
2818
- const projected = projectCaseArgField(arg, fieldPath);
2650
+ const projected = projectAbsPath(arg, fieldPath);
2819
2651
  if (!projected) {
2820
2652
  const k = arg.shape.k;
2821
2653
  if (k !== "unknown" && k !== "any") {
@@ -3873,7 +3705,9 @@ function checkSourceInner(filePath, source, file, phi, opts, issues, signatures,
3873
3705
  driftInit = true;
3874
3706
  }
3875
3707
  if (!driftRun || !(fnName in driftRun)) return void 0;
3876
- return callTranspiledExportFull(driftRun, fnName, args).result;
3708
+ return callTranspiledExportFull(driftRun, fnName, args, {
3709
+ preferLocal: true
3710
+ }).result;
3877
3711
  } catch {
3878
3712
  return void 0;
3879
3713
  }
@@ -3925,7 +3759,6 @@ export {
3925
3759
  $arrWithHoles,
3926
3760
  $assignRecord,
3927
3761
  $async,
3928
- $asyncReturn,
3929
3762
  $await,
3930
3763
  $bitand,
3931
3764
  $bitnot,
@@ -3949,7 +3782,6 @@ export {
3949
3782
  $fnVal,
3950
3783
  $for,
3951
3784
  $forInKeys,
3952
- $forIter,
3953
3785
  $forOf,
3954
3786
  $fork,
3955
3787
  $ge,
@@ -4000,12 +3832,9 @@ export {
4000
3832
  $shl,
4001
3833
  $shr,
4002
3834
  $spread,
4003
- $staticInvoke,
4004
3835
  $sub,
4005
3836
  $super,
4006
3837
  $switch,
4007
- $thisGet,
4008
- $thisSet,
4009
3838
  $throw,
4010
3839
  $toNumber,
4011
3840
  $toNumeric,
@@ -4024,7 +3853,6 @@ export {
4024
3853
  $updateAdd,
4025
3854
  $updateSub,
4026
3855
  $ushr,
4027
- $while,
4028
3856
  $whileSeq,
4029
3857
  $yield,
4030
3858
  CONSTRAINT_BUILDERS,
@@ -4051,7 +3879,6 @@ export {
4051
3879
  absToString,
4052
3880
  actionsForIssue,
4053
3881
  add,
4054
- alphaOf,
4055
3882
  and,
4056
3883
  andC,
4057
3884
  any,
@@ -4067,7 +3894,6 @@ export {
4067
3894
  assumeFinite,
4068
3895
  attachFnImpl,
4069
3896
  beginCollectionFork,
4070
- betaOf,
4071
3897
  bigintLit,
4072
3898
  bindImports,
4073
3899
  bindingsOf,
@@ -4103,14 +3929,11 @@ export {
4103
3929
  constraintToEntryAbs,
4104
3930
  contractParamNameSet,
4105
3931
  createEnvironment,
4106
- createHofCollectCtx,
4107
3932
  ctorArgDefinitelyInvalid,
4108
3933
  ctorNameOfRecv,
4109
3934
  currentExecPhi,
4110
- currentPhi,
4111
3935
  definitelyNotNullishShape,
4112
3936
  derefConstraint,
4113
- describePhi,
4114
3937
  div,
4115
3938
  drainPromiseMicros,
4116
3939
  effectiveInterface,
@@ -4180,7 +4003,6 @@ export {
4180
4003
  formatShapeSlot,
4181
4004
  ge,
4182
4005
  geNum,
4183
- generalizeAll,
4184
4006
  generalizeFromAst,
4185
4007
  generatedExportNames,
4186
4008
  getAbsProperty,
@@ -4311,14 +4133,12 @@ export {
4311
4133
  phiAnd,
4312
4134
  pick,
4313
4135
  popCollectionArm,
4314
- popPhi,
4315
4136
  powAbs,
4316
4137
  predEquals,
4317
4138
  predToString,
4318
4139
  predVars,
4319
4140
  primToTypeof,
4320
4141
  projectFlatMapResult,
4321
- promoteParamShape,
4322
4142
  propertyKeyOf,
4323
4143
  protoBrandAbs,
4324
4144
  protoOfRecv,
@@ -4326,7 +4146,6 @@ export {
4326
4146
  pureFnNameOf,
4327
4147
  pushCollectionArm,
4328
4148
  pushLoopExit,
4329
- pushPhi,
4330
4149
  pushThrowExit,
4331
4150
  queuePromiseMicro,
4332
4151
  refineAbsForRelTrue,
@@ -4342,7 +4161,6 @@ export {
4342
4161
  resetGeneralizeMemo,
4343
4162
  resetNudoModuleExecCache,
4344
4163
  resetParseSourceCache,
4345
- resetPhi,
4346
4164
  resetSidecarLoadFailureCache,
4347
4165
  runTranspiled,
4348
4166
  runTranspiledOptionsMemoKey,
@@ -4413,10 +4231,6 @@ export {
4413
4231
  transpileSource,
4414
4232
  trueConstraint,
4415
4233
  tryMakeRegexAbs,
4416
- tryPromoteDirectCall,
4417
- tryPromoteForOfIteratee,
4418
- tryPromoteHofCallback,
4419
- tryPromoteReceiverAsArr,
4420
4234
  tryRunTranspiled,
4421
4235
  typeofAbs,
4422
4236
  undefAbs,
@@ -4425,6 +4239,5 @@ export {
4425
4239
  ushrAbs,
4426
4240
  v,
4427
4241
  withExecPhi,
4428
- withPhiConstraint,
4429
4242
  withVar
4430
4243
  };
@@ -1,7 +1,7 @@
1
- import { I as InterfaceSource, a as InterfaceTierOpts, p as parseSource, C as CheckIssue } from './projection-budget-DW-svmIf.js';
2
- export { L as LeakBudget, b as LoadDepsFingerprint, M as MAX_PROMISE_MICROS, P as PROJECTION_MAX_DEPTH, c as ProjectionBudget, d as ProjectionStopReason, e as budgetAttributionSegs, f as defaultLeakBudget, g as exceedsBudget, h as exportedNameOfLocal, i as extractAllLoadSpecs, j as getPromiseMicrosLength, l as leakIfNeeded, k as loadModuleDepsFingerprint, m as maybeLeak, n as normPath, r as resetLeakCounter, o as resolveDepPath, s as sidecarSpecsOf, q as stablePathKey, t as stablePathKeyGraph, u as termDepth, v as termNodes } from './projection-budget-DW-svmIf.js';
3
- import { A as Abs, T as Term, c as AbsModuleExports, R as RunTranspiledOptions, d as AstEnv } from './run-T9HWTziZ.js';
4
- export { $ as $tryDigestSoft, e as $tryMarkSoft, f as $tryReleaseSoft, E as ERROR_FAMILY, g as EvalFallbackStats, M as MayThrowEffect, h as absLit, i as absNumLit, j as absStrLit, k as allAbsStr, l as clearPureCallMemo, m as clearPureMemo, n as enterEvalCallBudgetSession, o as errorTypeAbs, p as exitEvalCallBudgetSession, q as filterDeclaredThrows, r as filterGateThrows, s as filterIgnoredThrows, t as flushMayThrowEffects, u as formatThrowsAbs, v as getEvalCallBudgetState, w as getEvalFallbackStats, x as getMayThrowCollector, y as isThrowsIgnored, z as mayThrowEffectsToAbs, B as orphanMayThrowEffects, D as popMayThrowFrame, F as pushMayThrowFrame, G as recordMayThrow, H as resetEvalFallbackStats, I as runWithMayThrowSession, J as setMayThrowCollector, K as throwAbsToKinds, N as throwsKindCovered, O as withEvalBudgetOverride } from './run-T9HWTziZ.js';
1
+ import { I as InterfaceSource, a as InterfaceTierOpts, p as parseSource, C as CheckIssue } from './projection-budget-BkFV9pcs.js';
2
+ export { L as LeakBudget, b as LoadDepsFingerprint, M as MAX_PROMISE_MICROS, P as PROJECTION_MAX_DEPTH, c as ProjectionBudget, d as ProjectionStopReason, e as budgetAttributionSegs, f as defaultLeakBudget, g as exceedsBudget, h as exportedNameOfLocal, i as extractAllLoadSpecs, j as getPromiseMicrosLength, l as leakIfNeeded, k as loadModuleDepsFingerprint, m as maybeLeak, n as normPath, r as resetLeakCounter, o as resolveDepPath, s as sidecarSpecsOf, q as stablePathKey, t as stablePathKeyGraph, u as termDepth, v as termNodes } from './projection-budget-BkFV9pcs.js';
3
+ import { A as Abs, T as Term, c as AbsModuleExports, R as RunTranspiledOptions, d as AstEnv } from './run-tV2J7PNI.js';
4
+ export { $ as $tryDigestSoft, e as $tryMarkSoft, f as $tryReleaseSoft, E as ERROR_FAMILY, g as EvalFallbackStats, M as MayThrowEffect, h as absLit, i as absNumLit, j as absStrLit, k as allAbsStr, l as clearPureCallMemo, m as clearPureMemo, n as enterEvalCallBudgetSession, o as errorTypeAbs, p as exitEvalCallBudgetSession, q as filterDeclaredThrows, r as filterGateThrows, s as filterIgnoredThrows, t as flushMayThrowEffects, u as formatThrowsAbs, v as getEvalCallBudgetState, w as getEvalFallbackStats, x as getMayThrowCollector, y as isThrowsIgnored, z as mayThrowEffectsToAbs, B as orphanMayThrowEffects, D as popMayThrowFrame, F as pushMayThrowFrame, G as recordMayThrow, H as resetEvalFallbackStats, I as runWithMayThrowSession, J as setMayThrowCollector, K as throwAbsToKinds, N as throwsKindCovered, O as withEvalBudgetOverride } from './run-tV2J7PNI.js';
5
5
  import { File, Node } from '@babel/types';
6
6
 
7
7
  /**
@@ -128,6 +128,7 @@ type DiagCode = (typeof DIAG)[keyof typeof DIAG];
128
128
  * - 已知限制:`if (x) /re/` 这类 `)` 后紧跟 regex 的极端写法会当除法;
129
129
  * 目标是探测器正确,不做完整 JS 词法。
130
130
  */
131
+
131
132
  type StringLiteralSpan = {
132
133
  /** 引号内原文(转义未折叠;模块 specifier 无需折叠) */
133
134
  value: string;
@@ -238,11 +239,12 @@ declare function truncatedAbs(): Abs;
238
239
  * - pureValueKey = **值**键(形状内容 + 字面量值)⇒ 服务 **@nudo:pure
239
240
  * 记忆化**:按**值**承诺 ⇒ 同值必须同键(变量身份不同但值相同 ⇒ 同键)。
240
241
  *
241
- * @nudo:pure 记忆化通道(kind = "pure" 且 id 为空 —— 两个 pure memo 站点
242
- * 「$call 路径」与「$callNamed 宿主路径」的唯一调用形态)在此**分流**到值
242
+ * @nudo:pure 记忆化通道(kind = "pure" 且 id 为空)在此**分流**到值
243
243
  * 基键:记忆化键若带**变量身份**,同一变量重绑定为不同值后仍命中旧缓存
244
244
  * ⇒ **陈旧结果**(Bug 281)。预算/环检测通道(kind = absfn / absbody /
245
245
  * coerce-hook / 命名调用名,且 id 非空)**口径不变**。
246
+ * pure memo 本体(exec/pure-memo.ts)直接调用 pureValueKey;本分支保留为
247
+ * callBudgetKey 的既有对外语义(同一值基承诺),不改调用方行为。
246
248
  */
247
249
  declare function callBudgetKey(kind: string, id: string, args: unknown[]): string;
248
250
  /** 记录被截断的递归(service 可映射为 nudo:recursion-truncated)。
@@ -250,8 +252,8 @@ declare function callBudgetKey(kind: string, id: string, args: unknown[]): strin
250
252
  declare function setAbsTruncationCollector(collector: ((fnLabel: string, reason?: AbsTruncationReason) => void) | null): ((fnLabel: string, reason?: AbsTruncationReason) => void) | null;
251
253
  declare function noteAbsTruncation(label: string, reason?: AbsTruncationReason): void;
252
254
  /** 进入调用:cycle/超限则不执行 body,返回 opaque。
253
- * 归因顺序 = 守卫顺序(cycle 先于 depth 先于 calls):同指纹调用已在栈上
254
- * 时无论预算多深都会立即截断——报 cycle 而不是预算(#158)。 */
255
+ * 归因顺序 = 守卫顺序(本状态机内):同指纹调用已在栈上时无论预算多深
256
+ * 都会立即截断——报 cycle 而不是预算(#158)。 */
255
257
  declare function enterCall(key: string, label: string): boolean;
256
258
  declare function exitCall(): void;
257
259
  /**
@@ -713,10 +715,12 @@ declare function escapeTemplateTypeFixed(text: string): string;
713
715
  declare function sanitizeCommentText(text: string): string;
714
716
 
715
717
  /**
716
- * 语言覆盖:class / new / instanceof / this / async await。
717
- * brand 表示名义类;eff("promise") 表示异步效应。
718
+ * 语言覆盖(保留面):class 继承链查询 + Promise 效应包装。
718
719
  *
719
- * 方法体:ClassDef.methods 存 AST body,调用时在 this=receiver 下求值。
720
+ * class / new / instanceof / async 的求值语义已由 exec 内核(class-registry /
721
+ * `$call`)承载;本文件只保留两个仍有跨包消费者的叶子:
722
+ * - `getClassChain`:leq 的 brand 继承链判定(`leq.ts`)
723
+ * - `wrapPromise`:契约面把同步返回值包成 promise 效应(nudojs 导出面)
720
724
  */
721
725
 
722
726
  type MethodDef = {
@@ -733,38 +737,9 @@ type ClassDef = {
733
737
  methods: Map<string, MethodDef>;
734
738
  superClass?: string;
735
739
  };
736
- declare function defineClass(env: AstEnv, def: ClassDef): void;
737
- declare function getClass(env: AstEnv, name: string): ClassDef | undefined;
738
740
  /** 沿继承链找类 */
739
741
  declare function getClassChain(env: AstEnv, name: string): ClassDef[];
740
- /** new C(...) → brand 实例;并跑 constructor 以写入字段 */
741
- declare function instantiateClass(env: AstEnv, className: string, args: Abs[], evalBody?: (fn: {
742
- params: string[];
743
- body: Node;
744
- }, args: Abs[], thisVal: Abs, env: AstEnv) => Abs): Abs;
745
- /** 读取当前 this 所属类的父类名 */
746
- declare function superNameOf(env: AstEnv, className: string): string | undefined;
747
- /** 品牌沿注册/内建层级上溯的父名序列(含自身;限深防环) */
748
- declare function classChainNames(name: string, env?: AstEnv): string[];
749
- declare function instanceOf(left: Abs, rightClassName: string, env?: AstEnv): Abs;
750
- declare function projectBrand(self: Abs, key: string): Abs;
751
- /** 在 brand 上查找方法定义(含继承) */
752
- declare function lookupMethod(env: AstEnv, receiver: Abs, methodName: string): MethodDef | undefined;
753
- /** 沿继承链查找方法,返回定义与所在类名 */
754
- declare function lookupMethodWithOwner(env: AstEnv, receiver: Abs, methodName: string): {
755
- def: MethodDef;
756
- owner: string;
757
- } | undefined;
758
- /** super.method():从父类开始找(跳过当前类) */
759
- declare function lookupSuperMethod(env: AstEnv, receiver: Abs, fromClass: string, methodName: string): {
760
- def: MethodDef;
761
- owner: string;
762
- } | undefined;
763
742
  declare function wrapPromise(inner: Abs): Abs;
764
- declare function awaitAbs(v: Abs): Abs;
765
- declare function coerceAsyncReturn(value: Abs): Abs;
766
- /** 从 ClassMethod 列表构造 methods map + instance shape */
767
- declare function classFromMethods(name: string, methods: MethodDef[], superClass?: string, superShape?: Abs): ClassDef;
768
743
 
769
744
  /**
770
745
  * 顶层函数清单:function 声明 + const 箭头/函数表达式(含 export 包装)
@@ -934,4 +909,4 @@ declare function runWithEvalMissingSlot<T>(enabled: boolean, body: () => T): T;
934
909
  */
935
910
  declare function noteObjSlotMissing(recv: Abs | undefined, name: string, loc?: [number, number]): boolean;
936
911
 
937
- export { type AbsBudgetStats, type AbsInlay, type ArgDerivation, type ClassDef, type CollectAbsInlaysOpts, type CollectorScopeParticipant, DIAG, type DerivationNode, type DiagChannel, type DiagCode, type EvalMemberDiag, FORK_TRUNCATION_LABEL, type FnFp, HOST_EFFECT_LABEL_PREFIX, type InjectedDomainEvidenceOpts, type InjectedDomainRecord, MAX_CALL_DEPTH, MAX_EVAL_TOTAL_FORKS, MAX_TOTAL_CALLS, type MethodDef, OBJECT_PROTO_NAMES, PROMISE_MICRO_ERROR_LABEL, PROMISE_MICRO_OVERFLOW_LABEL, type ScopedDiagChannel, type ScopedSlot, type StringLiteralSpan, type TemplateMeta, type TemplatePartDesc, type TemplatePartView, type TemplatePredicateDecision, abortDerivationSession, absTemplateViews, allFixedTextOfViews, anyMemberResult, awaitAbs, beginDerivationSession, bumpEvalForkBudget, callBudgetKey, canSkipLiteralCallScan, checkInjectedDomainEvidence, classChainNames, classFromMethods, clearLiveImportRefreshers, coerceAsyncReturn, collectAbsInlays, concatString, createDiagChannel, createScopedDiagChannel, createScopedSlot, createTemplateAbs, decideEndsWith, decideIncludes, decideStartsWith, defineClass, definitelyUncallableMember, denoteGuard, derivationChain, endDerivationSession, enterCall, escapeTemplateTypeFixed, exitCall, fixedLengthOfViews, fnFingerprints, formatObjectKey, formatTemplateNameViews, generalizeSourceKeyPart, getAbsCallBudgetStats, getAbsOrigin, getClass, getClassChain, getDerivation, getEvalForkBudgetLimit, getEvalForkCount, getFnNameAndBodies, hasDerivationSession, hashSource, instanceOf, instantiateClass, isEvalMissingSlotEnabled, isJsBindingIdent, isJsIdent, isNullishAbs, isTemplateLike, knownPrefixOfViews, knownSuffixOfViews, listTopFunctions, lookupMethod, lookupMethodWithOwner, lookupSuperMethod, maskCommentsAndStrings, mergeAdjacentFixedViews, noteAbsTruncation, noteAnyMemberMayThrow, noteDerivationAdd, noteDerivationJoin, noteEvalForkTruncation, noteHostEffectBlocked, noteMemberDispatchMiss, noteNullishMemberThrows, noteObjSlotMissing, notePrimMemberMissing, noteUnknownMemberMissing, popCallLoc, projectBrand, projectDerivationDsl, pushCallLoc, recordMemberDiag, registerCollectorScopeParticipant, resetAbsCallBudget, resetEvalForkBudget, resetFnFpCache, resetHashSourceCache, runWithCollectorScope, runWithEvalMissingSlot, safeMemberAccess, sanitizeCommentText, scanStringLiterals, setAbsTruncationCollector, setDerivation, setDerivationCollector, setEvalForkBudgetLimit, setEvalMissingSlotEnabled, setMemberDiagCollector, sourceHasCjsExports, sourceHasModuleDependency, sourceHasRequireCall, stableAnalyzeKeySource, stableCallId, stripCommentsAndStrings, stripStringsKeepComments, superNameOf, tagAbsOrigin, tagDerivationRoot, templateMatchesValue, templatePartsOf, termKey, toJsBindingIdent, truncatedAbs, viewTemplateParts, withFnBudgetOverride, wrapPromise };
912
+ export { type AbsBudgetStats, type AbsInlay, type ArgDerivation, type ClassDef, type CollectAbsInlaysOpts, type CollectorScopeParticipant, DIAG, type DerivationNode, type DiagChannel, type DiagCode, type EvalMemberDiag, FORK_TRUNCATION_LABEL, type FnFp, HOST_EFFECT_LABEL_PREFIX, type InjectedDomainEvidenceOpts, type InjectedDomainRecord, MAX_CALL_DEPTH, MAX_EVAL_TOTAL_FORKS, MAX_TOTAL_CALLS, type MethodDef, OBJECT_PROTO_NAMES, PROMISE_MICRO_ERROR_LABEL, PROMISE_MICRO_OVERFLOW_LABEL, type ScopedDiagChannel, type ScopedSlot, type StringLiteralSpan, type TemplateMeta, type TemplatePartDesc, type TemplatePartView, type TemplatePredicateDecision, abortDerivationSession, absTemplateViews, allFixedTextOfViews, anyMemberResult, beginDerivationSession, bumpEvalForkBudget, callBudgetKey, canSkipLiteralCallScan, checkInjectedDomainEvidence, clearLiveImportRefreshers, collectAbsInlays, concatString, createDiagChannel, createScopedDiagChannel, createScopedSlot, createTemplateAbs, decideEndsWith, decideIncludes, decideStartsWith, definitelyUncallableMember, denoteGuard, derivationChain, endDerivationSession, enterCall, escapeTemplateTypeFixed, exitCall, fixedLengthOfViews, fnFingerprints, formatObjectKey, formatTemplateNameViews, generalizeSourceKeyPart, getAbsCallBudgetStats, getAbsOrigin, getClassChain, getDerivation, getEvalForkBudgetLimit, getEvalForkCount, getFnNameAndBodies, hasDerivationSession, hashSource, isEvalMissingSlotEnabled, isJsBindingIdent, isJsIdent, isNullishAbs, isTemplateLike, knownPrefixOfViews, knownSuffixOfViews, listTopFunctions, maskCommentsAndStrings, mergeAdjacentFixedViews, noteAbsTruncation, noteAnyMemberMayThrow, noteDerivationAdd, noteDerivationJoin, noteEvalForkTruncation, noteHostEffectBlocked, noteMemberDispatchMiss, noteNullishMemberThrows, noteObjSlotMissing, notePrimMemberMissing, noteUnknownMemberMissing, popCallLoc, projectDerivationDsl, pushCallLoc, recordMemberDiag, registerCollectorScopeParticipant, resetAbsCallBudget, resetEvalForkBudget, resetFnFpCache, resetHashSourceCache, runWithCollectorScope, runWithEvalMissingSlot, safeMemberAccess, sanitizeCommentText, scanStringLiterals, setAbsTruncationCollector, setDerivation, setDerivationCollector, setEvalForkBudgetLimit, setEvalMissingSlotEnabled, setMemberDiagCollector, sourceHasCjsExports, sourceHasModuleDependency, sourceHasRequireCall, stableAnalyzeKeySource, stableCallId, stripCommentsAndStrings, stripStringsKeepComments, tagAbsOrigin, tagDerivationRoot, templateMatchesValue, templatePartsOf, termKey, toJsBindingIdent, truncatedAbs, viewTemplateParts, withFnBudgetOverride, wrapPromise };