@nudojs/core 1.7.9 → 1.8.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/exec.d.ts CHANGED
@@ -466,6 +466,16 @@ declare function $removeNull(a: Abs): Abs;
466
466
  * null,`u.v` 对 null 仍原生抛 TypeError,不得剪)。
467
467
  */
468
468
  declare function $removeUndefined(a: Abs): Abs;
469
+ /**
470
+ * 成员真值守卫臂剪影(issue #118):`if (o.p)` 真值臂 / `if (!o.p)` 假值臂 /
471
+ * `o?.p` 真值守卫里,槽 p 的值必为真值 ⇒ 非 nullish 且槽必在场——重建 obj
472
+ * slots:槽值过与 $removeNullish 同款成员剥离,并摘除 optional 标记
473
+ * (真值 ⇒ 在场;$get 的 join(value, undef) 随之消失)。槽值剥空(纯
474
+ * nullish)→ 保守原样(臂不可达近似,与 $removeNullish 空集口径一致);
475
+ * 键缺席 / 非 obj / 裸宿主值 → 透传(同 $removeNullish 契约)。真值 ⇒ 非
476
+ * nullish 是 sound 下界:0/''/false 等 falsy-but-not-nullish 成员保留。
477
+ */
478
+ declare function $removeMemberNullish(a: Abs, key: string): Abs;
469
479
  /**
470
480
  * typeof 类型守卫臂剪影(Bug 23):`typeof v === "string"` 真臂把 v 重绑为
471
481
  * union 中 typeof 匹配的成员(keep=true)/ 假臂绑补集(keep=false)——臂内
@@ -744,4 +754,4 @@ declare class NudoUnsupportedError extends Error {
744
754
  detail?: string);
745
755
  }
746
756
 
747
- export { $absVal, $add, $arguments, $arr, $arrMutContainer, $arrRest, $arrWithHoles, $async, $asyncReturn, $await, $bitand, $bitnot, $bitor, $bitxor, $catchVal, $class, $classExpr, $collectionForEach, $concat, $copy, $del, $delRes, $div, $dynamicImport, $elems, $eq, $eqLoose, $fnVal, $for, $forInKeys, $forIter, $forOf, $fork, $ge, $gen, $get, $getSuper, $getSuperObj, $gt, $idx, $idxSet, $importMeta, $in, $instanceof, $instanceofNonIdent, $invoke, $invokeSuper, $invokeSuperKey, $invokeSuperObj, $isBreakTo, $isForkExit, $iterCheck, $join, $le, $len, $lit, $loopBreak, $loopContinue, $loopReturn, $lt, $mod, $mul, $narrowTypeOf, $ne, $neLoose, $neg, $new, $newTarget, $not, $nullishTest, $obj, $objAccessor, $objAccessorKey, $objRest, $optionalGet, $optionalInvoke, $orDefault, $pow, $pushLoopExit, $rawThis, $reStateCall, $regex, $removeNull, $removeNullish, $removeUndefined, $rethrowIfNudoReturn, $set, $setKey, $setProto, $shl, $shr, $spread, $staticInit, $staticInvoke, $sub, $super, $switch, $thisGet, $thisSet, $throw, $toNumber, $toNumeric, $tpl, $tryCurrentMark, $tryDetachSoftCatch, $tryDigestSoftCatch, $tryDiscardSoft, $tryMark, $tryOrphanSoft, $tryPopMark, $tryReleaseSoftCatch, $tryReleaseSoftOut, $tryTakeSince, $typeof, $unknown, $updateAdd, $updateSub, $ushr, $while, $whileSeq, $yield, $yieldStar, DEFAULT_MAX_LOOP_ITERS, type EvalClassSpec, NudoLoopSignal, NudoReturn, NudoThrow, NudoUnsupportedError, type TranspileOptions, asAbsVal, callAtFunctionBoundary, clearBClasses, clearStaleTermPred, currentExecPhi, fillTuple, foldRequireSpecArg, foldStaticStringExpr, getEvalClass, isArrMutator, isDefinitelyFalse, isDefinitelyTrue, isNudoBreak, isNudoContinue, isNudoReturn, isNudoThrow, litTruth, lookupObjAccessor, namespaceNameOf, pushLoopExit, pushThrowExit, registerEvalClass, runWithLoopExits, runtimeImportOf, takeLoopExits, takeThrowExits, transpile, transpileBodyNode, transpileExpression, transpileFile, transpileSource, withExecPhi };
757
+ export { $absVal, $add, $arguments, $arr, $arrMutContainer, $arrRest, $arrWithHoles, $async, $asyncReturn, $await, $bitand, $bitnot, $bitor, $bitxor, $catchVal, $class, $classExpr, $collectionForEach, $concat, $copy, $del, $delRes, $div, $dynamicImport, $elems, $eq, $eqLoose, $fnVal, $for, $forInKeys, $forIter, $forOf, $fork, $ge, $gen, $get, $getSuper, $getSuperObj, $gt, $idx, $idxSet, $importMeta, $in, $instanceof, $instanceofNonIdent, $invoke, $invokeSuper, $invokeSuperKey, $invokeSuperObj, $isBreakTo, $isForkExit, $iterCheck, $join, $le, $len, $lit, $loopBreak, $loopContinue, $loopReturn, $lt, $mod, $mul, $narrowTypeOf, $ne, $neLoose, $neg, $new, $newTarget, $not, $nullishTest, $obj, $objAccessor, $objAccessorKey, $objRest, $optionalGet, $optionalInvoke, $orDefault, $pow, $pushLoopExit, $rawThis, $reStateCall, $regex, $removeMemberNullish, $removeNull, $removeNullish, $removeUndefined, $rethrowIfNudoReturn, $set, $setKey, $setProto, $shl, $shr, $spread, $staticInit, $staticInvoke, $sub, $super, $switch, $thisGet, $thisSet, $throw, $toNumber, $toNumeric, $tpl, $tryCurrentMark, $tryDetachSoftCatch, $tryDigestSoftCatch, $tryDiscardSoft, $tryMark, $tryOrphanSoft, $tryPopMark, $tryReleaseSoftCatch, $tryReleaseSoftOut, $tryTakeSince, $typeof, $unknown, $updateAdd, $updateSub, $ushr, $while, $whileSeq, $yield, $yieldStar, DEFAULT_MAX_LOOP_ITERS, type EvalClassSpec, NudoLoopSignal, NudoReturn, NudoThrow, NudoUnsupportedError, type TranspileOptions, asAbsVal, callAtFunctionBoundary, clearBClasses, clearStaleTermPred, currentExecPhi, fillTuple, foldRequireSpecArg, foldStaticStringExpr, getEvalClass, isArrMutator, isDefinitelyFalse, isDefinitelyTrue, isNudoBreak, isNudoContinue, isNudoReturn, isNudoThrow, litTruth, lookupObjAccessor, namespaceNameOf, pushLoopExit, pushThrowExit, registerEvalClass, runWithLoopExits, runtimeImportOf, takeLoopExits, takeThrowExits, transpile, transpileBodyNode, transpileExpression, transpileFile, transpileSource, withExecPhi };
package/dist/exec.js CHANGED
@@ -86,6 +86,7 @@ import {
86
86
  $reStateCall,
87
87
  $recordBinding,
88
88
  $regex,
89
+ $removeMemberNullish,
89
90
  $removeNull,
90
91
  $removeNullish,
91
92
  $removeUndefined,
@@ -192,7 +193,7 @@ import {
192
193
  tryRunTranspiled,
193
194
  withEvalBudgetOverride,
194
195
  withExecPhi
195
- } from "./chunk-YQIRU637.js";
196
+ } from "./chunk-P6O5BXOA.js";
196
197
  export {
197
198
  $absVal,
198
199
  $add,
@@ -280,6 +281,7 @@ export {
280
281
  $reStateCall,
281
282
  $recordBinding,
282
283
  $regex,
284
+ $removeMemberNullish,
283
285
  $removeNull,
284
286
  $removeNullish,
285
287
  $removeUndefined,
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { c as AstEnv, A as Abs, b as Phi, T as Term, O as HofCollectCtx, C as Confidence, S as Shape, a as Pred, R as RelSource, Q as HofSite, U as AbsModuleExports, V as RunTranspiledOptions } from './run-DbDRo5z6.js';
2
2
  export { W as $assignRecord, X as $call, Y as $callNamed, Z as $recordBinding, _ as AbsApplyNoThrow, a0 as AbsApplyNoThrowFn, a1 as AbsApplyResult, a2 as AbsApplyReturn, a3 as AbsFnImpl, a4 as AbsSigImpl, a5 as EvalAbsAssignRecord, a6 as EvalCallRecord, a7 as EvalFallback, a8 as ImplicationOracle, a9 as LitValueResult, L as LiteralValue, aa as MAX_EVAL_CALL_DEPTH, ab as MAX_EVAL_TOTAL_CALLS, P as PrimName, ac as RUNTIME_IMPORT_RE, ad as TYPEOF_NAMES, ae as TranspiledCallResult, af as TypeofName, ag as abs, ah as absFunction, ai as absOnly, aj as absToString, ak as and, al as anyAbs, am as anyVar, an as app, ao as assumeFinite, ap as attachFnImpl, aq as bigintLit, ar as bindImports, as as bindingsOf, at as bool, au as boolLit, av as callTranspiledExport, aw as callTranspiledExportApply, ax as callTranspiledExportFull, ay as collectAbsExports, az as confJoin, aA as emptyPhi, aB as eq, aC as evalExprAbs, aD as ge, aE as geNum, aF as getEvalCallCollector, aG as getFnImpl, aH as getImplicationOracle, aI as gt, aJ as gtNum, aK as hostFnCtorFacet, aL as implies, aM as isAbsApplyResult, aN as isAbsVal, aO as isBigPrim, aP as isExactLit, aQ as isNumPrim, aR as isStrPrim, aS as le, aT as leNum, aU as lit, aV as litValue, aW as lt, aX as ltNum, aY as makeAbsApplyResult, aZ as markPureFn, a_ as namespaceAbsOf, a$ as ne, b0 as negatePred, b1 as never, b2 as not, b3 as noteEvalCallRecord, b4 as noteEvalFallback, b5 as num, b6 as numLit, b7 as numVar, b8 as obj, b9 as or, ba as pFalse, bb as pTrue, bc as phiAnd, bd as predEquals, be as predToString, bf as predVars, bg as primToTypeof, bh as ptypeof, bi as pureFnNameOf, bj as relationFingerprint, bk as relationFn, bl as resetEvalCallBudget, bm as runTranspiled, bn as runTranspiledOptionsMemoKey, bo as setEvalAssignCollector, bp as setEvalBindingSink, bq as setEvalCallCollector, br as setEvalFallbackCollector, bs as setImplicationOracle, bt as shapeOfTerm, bu as shapeOnlyFn, bv as shapeToString, bw as simplifyTerm, bx as str, by as strLit, bz as substPred, bA as termEquals, bB as termToString, bC as tryRunTranspiled, bD as unknown, bE as v } from './run-DbDRo5z6.js';
3
3
  import { Node, File } from '@babel/types';
4
- import { p as parseSource, L as LeakBudget, E as EffectiveInterfaceOpts, b as LoadDepsFingerprint, v as CheckReport, N as NudoConstraint, c as ProjectionBudget } from './projection-budget-CtwnzYLG.js';
5
- export { w as CONSTRAINT_BUILDERS, x as CONSTRAINT_BUILDER_NAMES, y as CONSTRAINT_EXPR_RE, z as CheckAction, C as CheckIssue, A as CheckJson, B as CheckJsonMulti, D as ConstraintBuilder, F as Diagnostic, G as EffectiveInterface, H as GitlabCodeQualityIssue, J as InterfaceDiag, I as InterfaceSource, K as InterfaceTierInfo, a as InterfaceTierOpts, O as NamedImport, Q as NudoField, R as NudoFnConstraint, S as NudoSidecarError, T as NudoSig, U as RefineDiag, V as RefineEntry, W as RefineResolveOpts, X as SELF, Y as actionsForIssue, Z as andC, _ as any, $ as array, a0 as boolean, a1 as checkArg, a2 as checkCall, a3 as constraintAdmitsNullish, a4 as constraintToEntryAbs, a5 as drainPromiseMicros, a6 as effectiveInterface, a7 as enterPromiseExecutorScope, a8 as evalPromiseCtor, a9 as evalPromiseMethod, aa as evalPromiseStatic, ab as execNudoModule, ac as extractDeclaredThrows, ad as extractFnBudget, ae as extractNudoImports, af as extractRefineReturnFromSource, ag as extractRefinesFromSource, ah as fn, ai as fnConstraintToEntryReqs, aj as formatCheckReport, ak as formatConstraint, al as formatDiagnostics, am as formatEffectiveInterfaceDisplay, an as formatGithubAnnotations, ao as formatGitlabCodeQuality, ap as formatInterfaceTierLine, aq as generatedExportNames, ar as getParseSourceCacheSize, as as getTerm, at as instantiateConstraint, au as interfaceDiagCount, av as interfaceSourceOf, aw as interfaceTierOf, ax as isIntFlag, ay as isNodeModulesPath, az as isNudoConstraint, aA as leavePromiseExecutorScope, aB as lenTerm, aC as litC, aD as localNamedExports, aE as notePromiseExecutorFork, aF as nullable, aG as number, aH as omit, aI as partial, aJ as pick, aK as queuePromiseMicro, aL as refineDiagCount, aM as refineToIndexedFull, aN as resetNudoModuleExecCache, aO as resetParseSourceCache, aP as resetSidecarLoadFailureCache, aQ as serializeCheckJson, aR as serializeCheckJsonMulti, aS as setInterfaceDiagCollector, aT as setRefineDiagCollector, aU as shape, aV as sidecarClosureFingerprint, aW as sidecarPathOf, aX as string, aY as takeInterfaceDiags, aZ as takeInterfaceDiagsSince, a_ as takeRefineDiags, a$ as takeRefineDiagsSince, b0 as throwConstraintToKinds, b1 as union } from './projection-budget-CtwnzYLG.js';
4
+ import { p as parseSource, L as LeakBudget, E as EffectiveInterfaceOpts, b as LoadDepsFingerprint, v as CheckReport, N as NudoConstraint, c as ProjectionBudget } from './projection-budget-vi5Ssjdr.js';
5
+ export { w as CONSTRAINT_BUILDERS, x as CONSTRAINT_BUILDER_NAMES, y as CONSTRAINT_EXPR_RE, z as CheckAction, C as CheckIssue, A as CheckJson, B as CheckJsonMulti, D as ConstraintBuilder, F as Diagnostic, G as EffectiveInterface, H as GitlabCodeQualityIssue, J as InterfaceDiag, I as InterfaceSource, K as InterfaceTierInfo, a as InterfaceTierOpts, O as NamedImport, Q as NudoField, R as NudoFnConstraint, S as NudoSidecarError, T as NudoSig, U as RefineDiag, V as RefineEntry, W as RefineResolveOpts, X as SELF, Y as actionsForIssue, Z as andC, _ as any, $ as array, a0 as boolean, a1 as checkArg, a2 as checkCall, a3 as constraintAdmitsNullish, a4 as constraintToEntryAbs, a5 as derefConstraint, a6 as drainPromiseMicros, a7 as effectiveInterface, a8 as enterPromiseExecutorScope, a9 as evalPromiseCtor, aa as evalPromiseMethod, ab as evalPromiseStatic, ac as execNudoModule, ad as extractDeclaredThrows, ae as extractFnBudget, af as extractNudoImports, ag as extractRefineReturnFromSource, ah as extractRefinesFromSource, ai as fn, aj as fnConstraintToEntryReqs, ak as formatCheckReport, al as formatConstraint, am as formatDiagnostics, an as formatEffectiveInterfaceDisplay, ao as formatGithubAnnotations, ap as formatGitlabCodeQuality, aq as formatInterfaceTierLine, ar as generatedExportNames, as as getParseSourceCacheSize, at as getTerm, au as instantiateConstraint, av as interfaceDiagCount, aw as interfaceSourceOf, ax as interfaceTierOf, ay as isIntFlag, az as isNodeModulesPath, aA as isNudoConstraint, aB as lazy, aC as leavePromiseExecutorScope, aD as lenTerm, aE as litC, aF as localNamedExports, aG as notePromiseExecutorFork, aH as nullable, aI as number, aJ as omit, aK as partial, aL as pick, aM as queuePromiseMicro, aN as refineDiagCount, aO as refineToIndexedFull, aP as resetNudoModuleExecCache, aQ as resetParseSourceCache, aR as resetSidecarLoadFailureCache, aS as serializeCheckJson, aT as serializeCheckJsonMulti, aU as setInterfaceDiagCollector, aV as setRefineDiagCollector, aW as shape, aX as sidecarClosureFingerprint, aY as sidecarPathOf, aZ as string, a_ as takeInterfaceDiags, a$ as takeInterfaceDiagsSince, b0 as takeRefineDiags, b1 as takeRefineDiagsSince, b2 as throwConstraintToKinds, b3 as union } from './projection-budget-vi5Ssjdr.js';
6
6
  export { $add, $arguments, $arr, $arrMutContainer, $arrRest, $arrWithHoles, $async, $asyncReturn, $await, $bitand, $bitnot, $bitor, $bitxor, $catchVal, $class, $classExpr, $collectionForEach, $concat, $copy, $del, $delRes, $div, $dynamicImport, $elems, $eq, $eqLoose, $fnVal, $for, $forInKeys, $forIter, $forOf, $fork, $ge, $gen, $get, $gt, $idx, $idxSet, $importMeta, $in, $instanceof, $instanceofNonIdent, $invoke, $invokeSuper, $isBreakTo, $isForkExit, $join, $le, $len, $lit, $loopBreak, $loopContinue, $loopReturn, $lt, $mod, $mul, $ne, $neLoose, $neg, $new, $not, $nullishTest, $obj, $objAccessor, $objRest, $optionalGet, $optionalInvoke, $orDefault, $pow, $pushLoopExit, $rawThis, $reStateCall, $regex, $rethrowIfNudoReturn, $set, $setKey, $shl, $shr, $spread, $staticInvoke, $sub, $super, $switch, $thisGet, $thisSet, $throw, $toNumber, $toNumeric, $tryCurrentMark, $tryDetachSoftCatch, $tryDigestSoftCatch, $tryDiscardSoft, $tryMark, $tryOrphanSoft, $tryPopMark, $tryReleaseSoftCatch, $tryReleaseSoftOut, $tryTakeSince, $typeof, $unknown, $updateAdd, $updateSub, $ushr, $while, $whileSeq, $yield, DEFAULT_MAX_LOOP_ITERS, EvalClassSpec, NudoLoopSignal, NudoReturn, NudoThrow, NudoUnsupportedError, TranspileOptions, asAbsVal, callAtFunctionBoundary, clearBClasses, clearStaleTermPred, currentExecPhi, fillTuple, foldRequireSpecArg, foldStaticStringExpr, getEvalClass, isArrMutator, isDefinitelyFalse, isDefinitelyTrue, isNudoBreak, isNudoContinue, isNudoReturn, isNudoThrow, litTruth, lookupObjAccessor, namespaceNameOf, pushLoopExit, pushThrowExit, registerEvalClass, runWithLoopExits, runtimeImportOf, takeLoopExits, takeThrowExits, transpile, transpileBodyNode, transpileExpression, transpileFile, transpileSource, withExecPhi } from './exec.js';
7
7
 
8
8
  /**
@@ -1201,7 +1201,7 @@ declare function scanBudgetDecl(lines: string[]): {
1201
1201
  */
1202
1202
 
1203
1203
  /** 字面量 lv 是否落在约束 c 表达的域内(保守:判不了 → false)。 */
1204
- declare function literalMeetsConstraint(lv: number | string | boolean | null | undefined, c: NudoConstraint): boolean;
1204
+ declare function literalMeetsConstraint(lv: number | string | boolean | null | undefined, c: NudoConstraint, seen?: Set<object>): boolean;
1205
1205
 
1206
1206
  /**
1207
1207
  * Abs → NudoConstraint 投影(Phase 1,interface 分层推导的生成侧半边)。
package/dist/index.js CHANGED
@@ -1,19 +1,9 @@
1
1
  import "./chunk-US532PZA.js";
2
2
  import {
3
- CONSTRAINT_BUILDERS,
4
- CONSTRAINT_BUILDER_NAMES,
5
- CONSTRAINT_EXPR_RE,
6
3
  NudoSidecarError,
7
- SELF,
8
- andC,
9
- any,
10
- array,
11
- boolean,
12
4
  buildArgsFromAssume,
13
5
  canSkipLiteralCallScan,
14
6
  collectAbsFreeVars,
15
- constraintAdmitsNullish,
16
- constraintToEntryAbs,
17
7
  effectiveInterface,
18
8
  evictGeneralizeMemoForPaths,
19
9
  execNudoModule,
@@ -28,8 +18,6 @@ import {
28
18
  extractRefineReturnFromSource,
29
19
  extractRefinesFromSource,
30
20
  findFnDirectiveScope,
31
- fn,
32
- fnConstraintToEntryReqs,
33
21
  fnDirectiveCommentLines,
34
22
  formatConstraint,
35
23
  formatEffectiveInterfaceDisplay,
@@ -38,39 +26,27 @@ import {
38
26
  generalizeFromAst,
39
27
  generatedExportNames,
40
28
  getGeneralizeMemoSize,
41
- getTerm,
42
29
  hashSource,
43
- instantiateConstraint,
44
- instantiateOnTerm,
45
30
  interfaceDiagCount,
46
31
  interfaceSourceOf,
47
32
  interfaceTierOf,
48
- isIntFlag,
49
33
  isNodeModulesPath,
50
- isNudoConstraint,
51
- lenTerm,
52
34
  listFnDirectiveScopes,
53
35
  listFunctionNames,
54
36
  listTopFunctions,
55
- litC,
56
- literalMeetsConstraint,
57
37
  loadModuleDepsFingerprint,
58
38
  localNamedExports,
59
39
  normPath,
60
- nullable,
61
- number,
62
- omit,
63
40
  parseEnvPayload,
64
41
  parseMockModulePayload,
65
42
  parseNudoImportPayload,
66
- partial,
67
- pick,
68
43
  refineDiagCount,
69
44
  refineToIndexedFull,
70
45
  resetGeneralizeMemo,
71
46
  resetHashSourceCache,
72
47
  resetNudoModuleExecCache,
73
48
  resetSidecarLoadFailureCache,
49
+ resolveDepPath,
74
50
  scanBudgetDecl,
75
51
  scanCaseArgSpans,
76
52
  scanCaseTags,
@@ -79,19 +55,15 @@ import {
79
55
  scanThrowsDecl,
80
56
  setInterfaceDiagCollector,
81
57
  setRefineDiagCollector,
82
- shape,
83
58
  sidecarClosureFingerprint,
84
59
  sidecarPathOf,
85
60
  stableAnalyzeKeySource,
86
61
  stablePathKey,
87
- string,
88
62
  takeInterfaceDiags,
89
63
  takeInterfaceDiagsSince,
90
64
  takeRefineDiags,
91
- takeRefineDiagsSince,
92
- throwConstraintToKinds,
93
- union
94
- } from "./chunk-5SAMWKI6.js";
65
+ takeRefineDiagsSince
66
+ } from "./chunk-WT5J6QTZ.js";
95
67
  import {
96
68
  $add,
97
69
  $arguments,
@@ -203,6 +175,9 @@ import {
203
175
  $while,
204
176
  $whileSeq,
205
177
  $yield,
178
+ CONSTRAINT_BUILDERS,
179
+ CONSTRAINT_BUILDER_NAMES,
180
+ CONSTRAINT_EXPR_RE,
206
181
  DEFAULT_MAX_LOOP_ITERS,
207
182
  FORK_TRUNCATION_LABEL,
208
183
  HOST_EFFECT_LABEL_PREFIX,
@@ -218,6 +193,7 @@ import {
218
193
  PROMISE_MICRO_OVERFLOW_LABEL,
219
194
  ProjectionBudget,
220
195
  RUNTIME_IMPORT_RE,
196
+ SELF,
221
197
  TYPEOF_NAMES,
222
198
  abs,
223
199
  absFunction,
@@ -227,15 +203,19 @@ import {
227
203
  add,
228
204
  alphaOf,
229
205
  and,
206
+ andC,
207
+ any,
230
208
  anyAbs,
231
209
  anyVar,
232
210
  app,
233
211
  applyCallbackAbs,
234
212
  applyCallbackValue,
213
+ array,
235
214
  asAbs,
236
215
  asAbsVal,
237
216
  assignSourceSlots,
238
217
  assumeFinite,
218
+ attachContractFaces,
239
219
  attachFnImpl,
240
220
  beginCollectionFork,
241
221
  betaOf,
@@ -248,6 +228,7 @@ import {
248
228
  bitxorAbs,
249
229
  bool,
250
230
  boolLit,
231
+ boolean,
251
232
  builtinCtorAbs,
252
233
  builtinCtorNameOf,
253
234
  callAbsMethod,
@@ -264,12 +245,16 @@ import {
264
245
  collectionElementJoin,
265
246
  collectionExactLen,
266
247
  confJoin,
248
+ constraintAdmitsNullish,
249
+ constraintToEntryAbs,
250
+ contractFacesFromEffectiveInterface,
267
251
  contractParamNameSet,
268
252
  createHofCollectCtx,
269
253
  ctorArgDefinitelyInvalid,
270
254
  ctorNameOfRecv,
271
255
  currentExecPhi,
272
256
  definitelyNotNullishShape,
257
+ derefConstraint,
273
258
  div,
274
259
  drainPromiseMicros,
275
260
  emptyEnv,
@@ -304,6 +289,8 @@ import {
304
289
  falseConstraint,
305
290
  fillTuple,
306
291
  filterGateThrows,
292
+ fn,
293
+ fnConstraintToEntryReqs,
307
294
  fnOf,
308
295
  foldRequireSpecArg,
309
296
  foldStaticStringExpr,
@@ -326,12 +313,15 @@ import {
326
313
  getParseSourceCacheSize,
327
314
  getPropFlags,
328
315
  getSlot,
316
+ getTerm,
329
317
  gt,
330
318
  gtNum,
331
319
  hostBuiltinCtorName,
332
320
  hostFnCtorFacet,
333
321
  identBoundaryRegex,
334
322
  implies,
323
+ instantiateConstraint,
324
+ instantiateOnTerm,
335
325
  instantiateReturn,
336
326
  isAbsApplyResult,
337
327
  isAbsVal,
@@ -341,8 +331,10 @@ import {
341
331
  isDefinitelyTrue,
342
332
  isErrorCtorName,
343
333
  isExactLit,
334
+ isIntFlag,
344
335
  isMapAbs,
345
336
  isNudoBreak,
337
+ isNudoConstraint,
346
338
  isNudoContinue,
347
339
  isNudoReturn,
348
340
  isNudoThrow,
@@ -360,13 +352,17 @@ import {
360
352
  joinFunctions,
361
353
  joinObjects,
362
354
  joinValues,
355
+ lazy,
363
356
  le,
364
357
  leNum,
365
358
  leavePromiseExecutorScope,
359
+ lenTerm,
366
360
  leqAbs,
367
361
  lit,
362
+ litC,
368
363
  litTruth,
369
364
  litValue,
365
+ literalMeetsConstraint,
370
366
  locateContractParam,
371
367
  lookupObjAccessor,
372
368
  looseEqAbs,
@@ -409,18 +405,23 @@ import {
409
405
  noteEvalCallRecord,
410
406
  noteEvalFallback,
411
407
  notePromiseExecutorFork,
408
+ nullable,
412
409
  num,
413
410
  numLit,
414
411
  numVar,
412
+ number,
415
413
  obj,
416
414
  objOf,
417
415
  objectProtoBrand,
418
416
  objectProtoMethodAbs,
417
+ omit,
419
418
  or,
420
419
  pFalse,
421
420
  pTrue,
422
421
  parseSource,
422
+ partial,
423
423
  phiAnd,
424
+ pick,
424
425
  popCollectionArm,
425
426
  powAbs,
426
427
  predEquals,
@@ -457,6 +458,7 @@ import {
457
458
  setAddEntry,
458
459
  setApplyCallbackHost,
459
460
  setClearEntries,
461
+ setContractFaceResolver,
460
462
  setDeleteEntry,
461
463
  setElementsAbs,
462
464
  setEvalAssignCollector,
@@ -468,6 +470,7 @@ import {
468
470
  setMayThrowCollector,
469
471
  setPropFlags,
470
472
  setSizeAbs,
473
+ shape,
471
474
  shapeOfTerm,
472
475
  shapeOnlyFn,
473
476
  shapeToString,
@@ -479,6 +482,7 @@ import {
479
482
  str,
480
483
  strLit,
481
484
  strictEqAbs,
485
+ string,
482
486
  stringOfSymbol,
483
487
  stripStringsKeepComments,
484
488
  stripTypes,
@@ -493,6 +497,7 @@ import {
493
497
  termEquals,
494
498
  termToString,
495
499
  throwAbsToKinds,
500
+ throwConstraintToKinds,
496
501
  toNumberAbs,
497
502
  transpile,
498
503
  transpileBodyNode,
@@ -508,12 +513,13 @@ import {
508
513
  tryRunTranspiled,
509
514
  typeofAbs,
510
515
  undefAbs,
516
+ union,
511
517
  unknown,
512
518
  ushrAbs,
513
519
  v,
514
520
  withExecPhi,
515
521
  withVar
516
- } from "./chunk-YQIRU637.js";
522
+ } from "./chunk-P6O5BXOA.js";
517
523
 
518
524
  // src/environment.ts
519
525
  function createEnvironment(parent, bindings = /* @__PURE__ */ new Map()) {
@@ -796,6 +802,15 @@ function provesBarePrimDomain(arm, constraint) {
796
802
  return arm.shape.k === "prim" && arm.shape.type === constraint.prim;
797
803
  }
798
804
  function assertImplies(ret, constraint, opts) {
805
+ if (constraint.lazy) {
806
+ const seen = opts?.seen;
807
+ if (seen?.has(constraint.lazy)) {
808
+ return unprovable("lazy constraint cycle");
809
+ }
810
+ const next = seen ? new Set(seen) : /* @__PURE__ */ new Set();
811
+ next.add(constraint.lazy);
812
+ return assertImplies(ret, derefConstraint(constraint), { ...opts, seen: next });
813
+ }
799
814
  const phi = opts?.phi ?? pTrue;
800
815
  if (ret.shape.k === "never") return proved();
801
816
  if (isAnyConstraint(constraint)) return proved();
@@ -881,7 +896,7 @@ function assertImpliesSingle(arm, constraint, opts, phi) {
881
896
  return assertScalar(arm, constraint, phi);
882
897
  }
883
898
  function isAnyConstraint(c) {
884
- return !c.prim && c.preds.length === 0 && !c.fields && !c.element && !c.members && !c.fn && !isIntFlag(c);
899
+ return !c.prim && c.preds.length === 0 && !c.fields && !c.element && !c.members && !c.fn && !c.lazy && !isIntFlag(c);
885
900
  }
886
901
  function assertShapeFields(ret, constraint, opts) {
887
902
  let slots;
@@ -2142,43 +2157,142 @@ function checkSourceInScope(filePath, source, phi, opts) {
2142
2157
  resetAbsCallBudget();
2143
2158
  const prevTrunc = setAbsTruncationCollector((label) => truncated.add(label));
2144
2159
  try {
2145
- const report = checkSourceInner(
2146
- filePath,
2147
- source,
2148
- file,
2149
- phi,
2150
- callOpts,
2151
- issues,
2152
- signatures,
2153
- names,
2154
- truncated,
2155
- opts,
2156
- depsFp,
2157
- sidecarFp
2160
+ const prevFaceResolver = setContractFaceResolver(
2161
+ makeSameFileFaceResolver(callOpts, filePath, source, file)
2158
2162
  );
2159
- const diagIssues = sidecarDiagIssues([
2160
- ...takeRefineDiagsSince(refineSince),
2161
- ...takeInterfaceDiagsSince(ifaceSince)
2162
- ]);
2163
- if (diagIssues.length > 0) {
2164
- report.issues.push(...diagIssues);
2165
- const errors = report.issues.filter((i) => i.severity === "error").length;
2166
- const warnings = report.issues.filter((i) => i.severity === "warning").length;
2167
- const infos = report.issues.filter((i) => i.severity === "info").length;
2168
- report.ok = errors === 0;
2169
- report.summary = {
2170
- errors,
2171
- warnings,
2172
- infos,
2173
- functions: report.summary.functions
2174
- };
2163
+ try {
2164
+ attachCrossModuleContractFaces(callOpts, filePath);
2165
+ const report = checkSourceInner(
2166
+ filePath,
2167
+ source,
2168
+ file,
2169
+ phi,
2170
+ callOpts,
2171
+ issues,
2172
+ signatures,
2173
+ names,
2174
+ truncated,
2175
+ opts,
2176
+ depsFp,
2177
+ sidecarFp
2178
+ );
2179
+ const diagIssues = sidecarDiagIssues([
2180
+ ...takeRefineDiagsSince(refineSince),
2181
+ ...takeInterfaceDiagsSince(ifaceSince)
2182
+ ]);
2183
+ if (diagIssues.length > 0) {
2184
+ report.issues.push(...diagIssues);
2185
+ const errors = report.issues.filter((i) => i.severity === "error").length;
2186
+ const warnings = report.issues.filter((i) => i.severity === "warning").length;
2187
+ const infos = report.issues.filter((i) => i.severity === "info").length;
2188
+ report.ok = errors === 0;
2189
+ report.summary = {
2190
+ errors,
2191
+ warnings,
2192
+ infos,
2193
+ functions: report.summary.functions
2194
+ };
2195
+ }
2196
+ if (memoKey) checkMemoSet(memoKey, report, memoPaths);
2197
+ return cloneCheckReport(report);
2198
+ } finally {
2199
+ setContractFaceResolver(prevFaceResolver);
2175
2200
  }
2176
- if (memoKey) checkMemoSet(memoKey, report, memoPaths);
2177
- return cloneCheckReport(report);
2178
2201
  } finally {
2179
2202
  setAbsTruncationCollector(prevTrunc);
2180
2203
  }
2181
2204
  }
2205
+ function makeSameFileFaceResolver(opts, filePath, source, file) {
2206
+ const loadModule = opts.loadModule;
2207
+ const fromFile = opts.fromFile ?? filePath;
2208
+ const autoBind = opts.autoBind;
2209
+ const projectDir = opts.projectDir;
2210
+ const memo = /* @__PURE__ */ new Map();
2211
+ return (fnName) => {
2212
+ if (memo.has(fnName)) return memo.get(fnName);
2213
+ let faces;
2214
+ try {
2215
+ const eff = effectiveInterface(source, fnName, {
2216
+ ...loadModule ? { loadModule } : {},
2217
+ fromFile,
2218
+ ...autoBind !== void 0 ? { autoBind } : {},
2219
+ ...projectDir !== void 0 ? { projectDir } : {}
2220
+ });
2221
+ if (eff) {
2222
+ const params = extractFn(source, fnName, file)?.params ?? [];
2223
+ faces = contractFacesFromEffectiveInterface(eff, params);
2224
+ }
2225
+ } catch {
2226
+ faces = void 0;
2227
+ }
2228
+ memo.set(fnName, faces);
2229
+ return faces;
2230
+ };
2231
+ }
2232
+ function attachCrossModuleContractFaces(opts, filePath) {
2233
+ const loadModule = opts.loadModule;
2234
+ const fromFile = opts.fromFile ?? filePath;
2235
+ if (!loadModule) return;
2236
+ const tables = [];
2237
+ for (const t of [opts.modules, opts.inject?.modules]) {
2238
+ if (t && typeof t === "object" && !tables.includes(t)) tables.push(t);
2239
+ }
2240
+ if (tables.length === 0) return;
2241
+ const autoBind = opts.autoBind;
2242
+ const projectDir = opts.projectDir;
2243
+ const facesCache = /* @__PURE__ */ new Map();
2244
+ const facesFor = (depSource, depPath, name, paramNames) => {
2245
+ const key = `${depPath}\0${name}`;
2246
+ if (facesCache.has(key)) return facesCache.get(key);
2247
+ let faces;
2248
+ try {
2249
+ const eff = effectiveInterface(depSource, name, {
2250
+ loadModule,
2251
+ fromFile: depPath,
2252
+ ...autoBind !== void 0 ? { autoBind } : {},
2253
+ ...projectDir !== void 0 ? { projectDir } : {}
2254
+ });
2255
+ if (eff) faces = contractFacesFromEffectiveInterface(eff, paramNames);
2256
+ } catch {
2257
+ faces = void 0;
2258
+ }
2259
+ facesCache.set(key, faces);
2260
+ return faces;
2261
+ };
2262
+ const attachFnAbs = (v2, depSource, depPath, name) => {
2263
+ if (!v2 || typeof v2 !== "object" || !("shape" in v2)) return;
2264
+ const shape2 = v2.shape;
2265
+ if (shape2.k !== "fn") return;
2266
+ let paramNames;
2267
+ try {
2268
+ paramNames = extractFn(depSource, name)?.params ?? [];
2269
+ } catch {
2270
+ paramNames = [];
2271
+ }
2272
+ const faces = facesFor(depSource, depPath, name, paramNames);
2273
+ if (faces) attachContractFaces(v2, faces);
2274
+ };
2275
+ for (const table of tables) {
2276
+ for (const [spec, mod2] of Object.entries(table)) {
2277
+ if (!mod2 || typeof mod2 !== "object") continue;
2278
+ const named = mod2.named;
2279
+ if (!named) continue;
2280
+ let depSource;
2281
+ try {
2282
+ depSource = loadModule(spec, fromFile);
2283
+ } catch {
2284
+ depSource = void 0;
2285
+ }
2286
+ if (!depSource) continue;
2287
+ const depPath = resolveDepPath(fromFile, spec);
2288
+ for (const [name, v2] of Object.entries(named)) {
2289
+ attachFnAbs(v2, depSource, depPath, name);
2290
+ }
2291
+ const def = mod2.default;
2292
+ if (def !== void 0) attachFnAbs(def, depSource, depPath, "default");
2293
+ }
2294
+ }
2295
+ }
2182
2296
  function sidecarDiagIssues(diags) {
2183
2297
  const seen = /* @__PURE__ */ new Set();
2184
2298
  const out = [];
@@ -3188,6 +3302,7 @@ export {
3188
3302
  currentExecPhi,
3189
3303
  currentPhi,
3190
3304
  definitelyNotNullishShape,
3305
+ derefConstraint,
3191
3306
  describePhi,
3192
3307
  div,
3193
3308
  drainPromiseMicros,
@@ -3311,6 +3426,7 @@ export {
3311
3426
  joinObjects,
3312
3427
  joinThenProject,
3313
3428
  joinValues,
3429
+ lazy,
3314
3430
  le,
3315
3431
  leNum,
3316
3432
  leavePromiseExecutorScope,
@@ -1,5 +1,5 @@
1
- import { I as InterfaceSource, a as InterfaceTierOpts, p as parseSource, C as CheckIssue } from './projection-budget-CtwnzYLG.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 defaultLeakBudget, f as exceedsBudget, g as exportedNameOfLocal, h as extractAllLoadSpecs, i as getPromiseMicrosLength, l as leakIfNeeded, j as loadModuleDepsFingerprint, m as maybeLeak, n as normPath, r as resetLeakCounter, k as resolveDepPath, s as sidecarSpecsOf, o as stablePathKey, q as stablePathKeyGraph, t as termDepth, u as termNodes } from './projection-budget-CtwnzYLG.js';
1
+ import { I as InterfaceSource, a as InterfaceTierOpts, p as parseSource, C as CheckIssue } from './projection-budget-vi5Ssjdr.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 defaultLeakBudget, f as exceedsBudget, g as exportedNameOfLocal, h as extractAllLoadSpecs, i as getPromiseMicrosLength, l as leakIfNeeded, j as loadModuleDepsFingerprint, m as maybeLeak, n as normPath, r as resetLeakCounter, k as resolveDepPath, s as sidecarSpecsOf, o as stablePathKey, q as stablePathKeyGraph, t as termDepth, u as termNodes } from './projection-budget-vi5Ssjdr.js';
3
3
  import { A as Abs, T as Term, c as AstEnv } from './run-DbDRo5z6.js';
4
4
  export { $ as $tryDigestSoft, d as $tryMarkSoft, e as $tryReleaseSoft, E as ERROR_FAMILY, f as EvalFallbackStats, M as MayThrowEffect, g as absLit, h as absNumLit, i as absStrLit, j as allAbsStr, k as clearPureCallMemo, l as clearPureMemo, m as enterEvalCallBudgetSession, n as errorTypeAbs, o as exitEvalCallBudgetSession, p as filterDeclaredThrows, q as filterGateThrows, r as filterIgnoredThrows, s as flushMayThrowEffects, t as formatThrowsAbs, u as getEvalCallBudgetState, v as getEvalFallbackStats, w as getMayThrowCollector, x as isThrowsIgnored, y as mayThrowEffectsToAbs, z as orphanMayThrowEffects, B as popMayThrowFrame, D as pushMayThrowFrame, F as recordMayThrow, G as resetEvalFallbackStats, H as runWithMayThrowSession, I as setMayThrowCollector, J as throwAbsToKinds, K as throwsKindCovered, N as withEvalBudgetOverride } from './run-DbDRo5z6.js';
5
5
  import { File, Node } from '@babel/types';
package/dist/internal.js CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  stableAnalyzeKeySource,
22
22
  stablePathKey,
23
23
  stablePathKeyGraph
24
- } from "./chunk-5SAMWKI6.js";
24
+ } from "./chunk-WT5J6QTZ.js";
25
25
  import {
26
26
  $tryDigestSoft,
27
27
  $tryMarkSoft,
@@ -169,7 +169,7 @@ import {
169
169
  withEvalBudgetOverride,
170
170
  withFnBudgetOverride,
171
171
  wrapPromise
172
- } from "./chunk-YQIRU637.js";
172
+ } from "./chunk-P6O5BXOA.js";
173
173
 
174
174
  // src/algebra/inlay.ts
175
175
  function listFunctions(source) {