@nudojs/core 1.9.4 → 1.10.1

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.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { d as AstEnv, A as Abs, b as Phi, T as Term, Q as HofCollectCtx, C as Confidence, S as Shape, a as Pred, R as RelSource, U as HofSite, c as AbsModuleExports, V as RunTranspiledOptions } from './run-WZKUu1y1.js';
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-WZKUu1y1.js';
1
+ import { d as AstEnv, A as Abs, b as Phi, T as Term, Q as HofCollectCtx, C as Confidence, S as Shape, a as Pred, R as RelSource, U as HofSite, c as AbsModuleExports, V as RunTranspiledOptions } from './run-Bgj2tCrv.js';
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 EvalPosRecord, a9 as ImplicationOracle, aa as LitValueResult, L as LiteralValue, ab as MAX_EVAL_CALL_DEPTH, ac as MAX_EVAL_TOTAL_CALLS, P as PrimName, ad as RUNTIME_IMPORT_RE, ae as TYPEOF_NAMES, af as TranspiledCallResult, ag as TypeofName, ah as abs, ai as absFunction, aj as absOnly, ak as absToString, al as and, am as anyAbs, an as anyVar, ao as app, ap as assumeFinite, aq as attachFnImpl, ar as bigintLit, as as bindImports, at as bindingsOf, au as bool, av as boolLit, aw as callTranspiledExport, ax as callTranspiledExportApply, ay as callTranspiledExportFull, az as collectAbsExports, aA as confJoin, aB as emptyPhi, aC as eq, aD as evalExprAbs, aE as ge, aF as geNum, aG as getEvalCallCollector, aH as getFnImpl, aI as getImplicationOracle, aJ as gt, aK as gtNum, aL as hostFnCtorFacet, aM as implies, aN as isAbsApplyResult, aO as isAbsVal, aP as isBigPrim, aQ as isCjsMainRun, aR as isExactLit, aS as isNumPrim, aT as isStrPrim, aU as le, aV as leNum, aW as lit, aX as litValue, aY as lt, aZ as ltNum, a_ as makeAbsApplyResult, a$ as markPureFn, b0 as namespaceAbsOf, b1 as ne, b2 as negatePred, b3 as never, b4 as not, b5 as noteEvalCallRecord, b6 as noteEvalFallback, b7 as num, b8 as numLit, b9 as numVar, ba as obj, bb as or, bc as pFalse, bd as pTrue, be as phiAnd, bf as predEquals, bg as predToString, bh as predVars, bi as primToTypeof, bj as ptypeof, bk as pureFnNameOf, bl as relationFingerprint, bm as relationFn, bn as resetEvalCallBudget, bo as runTranspiled, bp as runTranspiledOptionsMemoKey, bq as setEvalAssignCollector, br as setEvalBindingSink, bs as setEvalCallCollector, bt as setEvalFallbackCollector, bu as setImplicationOracle, bv as setPosCollector, bw as shapeOfTerm, bx as shapeOnlyFn, by as shapeToString, bz as simplifyTerm, bA as str, bB as strLit, bC as substPred, bD as termEquals, bE as termToString, bF as tryRunTranspiled, bG as unknown, bH as v } from './run-Bgj2tCrv.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-Dm1YWZ1U.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 INTERFACE_SOURCE_ABBR, K as InterfaceDiag, I as InterfaceSource, O as InterfaceTierInfo, a as InterfaceTierOpts, Q as NamedImport, R as NudoField, S as NudoFnConstraint, T as NudoSidecarError, U as NudoSig, V as RefineDiag, W as RefineEntry, X as RefineResolveOpts, Y as SELF, Z as actionsForIssue, _ as andC, $ as any, a0 as array, a1 as boolean, a2 as checkArg, a3 as checkCall, a4 as constraintAdmitsNullish, a5 as constraintToEntryAbs, a6 as derefConstraint, a7 as drainPromiseMicros, a8 as effectiveInterface, a9 as enterPromiseExecutorScope, aa as evalPromiseCtor, ab as evalPromiseMethod, ac as evalPromiseStatic, ad as execNudoModule, ae as extractDeclaredThrows, af as extractFnBudget, ag as extractNudoImports, ah as extractRefineReturnFromSource, ai as extractRefinesFromSource, aj as fn, ak as fnConstraintToEntryReqs, al as formatCheckReport, am as formatConstraint, an as formatDiagnostics, ao as formatEffectiveInterfaceDisplay, ap as formatGithubAnnotations, aq as formatGitlabCodeQuality, ar as formatInterfaceTierLine, as as generatedExportNames, at as getParseSourceCacheSize, au as getTerm, av as instantiateConstraint, aw as interfaceDiagCount, ax as interfaceSourceOf, ay as interfaceTierOf, az as isIntFlag, aA as isNodeModulesPath, aB as isNudoConstraint, aC as lazy, aD as leavePromiseExecutorScope, aE as lenTerm, aF as litC, aG as localNamedExports, aH as notePromiseExecutorFork, aI as nullable, aJ as number, aK as omit, aL as partial, aM as pick, aN as queuePromiseMicro, aO as refineDiagCount, aP as refineToIndexedFull, aQ as resetNudoModuleExecCache, aR as resetParseSourceCache, aS as resetSidecarLoadFailureCache, aT as serializeCheckJson, aU as serializeCheckJsonMulti, aV as setInterfaceDiagCollector, aW as setRefineDiagCollector, aX as shape, aY as sidecarClosureFingerprint, aZ as sidecarPathOf, a_ as string, a$ as takeInterfaceDiags, b0 as takeInterfaceDiagsSince, b1 as takeRefineDiags, b2 as takeRefineDiagsSince, b3 as throwConstraintToKinds, b4 as union } from './projection-budget-Dm1YWZ1U.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-Dey0IUJa.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 INTERFACE_SOURCE_ABBR, K as InterfaceDiag, I as InterfaceSource, O as InterfaceTierInfo, a as InterfaceTierOpts, Q as NamedImport, R as NudoField, S as NudoFnConstraint, T as NudoSidecarError, U as NudoSig, V as RefineDiag, W as RefineEntry, X as RefineResolveOpts, Y as SELF, Z as actionsForIssue, _ as andC, $ as any, a0 as array, a1 as boolean, a2 as checkArg, a3 as checkCall, a4 as constraintAdmitsNullish, a5 as constraintToEntryAbs, a6 as derefConstraint, a7 as drainPromiseMicros, a8 as effectiveInterface, a9 as enterPromiseExecutorScope, aa as evalPromiseCtor, ab as evalPromiseMethod, ac as evalPromiseStatic, ad as execNudoModule, ae as extractDeclaredThrows, af as extractFnBudget, ag as extractNudoImports, ah as extractRefineReturnFromSource, ai as extractRefinesFromSource, aj as fn, ak as fnConstraintToEntryReqs, al as formatCheckReport, am as formatConstraint, an as formatDiagnostics, ao as formatEffectiveInterfaceDisplay, ap as formatGithubAnnotations, aq as formatGitlabCodeQuality, ar as formatInterfaceTierLine, as as generatedExportNames, at as getParseSourceCacheSize, au as getTerm, av as instantiateConstraint, aw as interfaceDiagCount, ax as interfaceSourceOf, ay as interfaceTierOf, az as isIntFlag, aA as isNodeModulesPath, aB as isNudoConstraint, aC as lazy, aD as leavePromiseExecutorScope, aE as lenTerm, aF as litC, aG as localNamedExports, aH as notePromiseExecutorFork, aI as nullable, aJ as number, aK as omit, aL as partial, aM as pick, aN as queuePromiseMicro, aO as refineDiagCount, aP as refineToIndexedFull, aQ as resetNudoModuleExecCache, aR as resetParseSourceCache, aS as resetSidecarLoadFailureCache, aT as serializeCheckJson, aU as serializeCheckJsonMulti, aV as setInterfaceDiagCollector, aW as setRefineDiagCollector, aX as shape, aY as sidecarClosureFingerprint, aZ as sidecarPathOf, a_ as string, a$ as takeInterfaceDiags, b0 as takeInterfaceDiagsSince, b1 as takeRefineDiags, b2 as takeRefineDiagsSince, b3 as throwConstraintToKinds, b4 as union } from './projection-budget-Dey0IUJa.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
  /**
@@ -689,13 +689,20 @@ declare function isMapAbs(a: Abs | undefined): boolean;
689
689
  declare function isSetAbs(a: Abs | undefined): boolean;
690
690
  /**
691
691
  * 构造器实参**确定**非法(原生 TypeError 域):
692
- * - 非可迭代字面量(number/boolean/symbol/bigint、闭对象字面量)→ 四个集合构造器都抛
693
- * - Map/WeakMap 条目必须是对象:外层 iterable 出现 lit prim 条目(含字符串实参的
694
- * 每个字符、tuple/Set 元素)→ TypeError(空串例外:零条目合法);
695
- * WeakMap 键还必须可弱持有——tuple 条目首元素(键)为 prim → TypeError
696
- * (Map 键可以是 prim,仅 WeakMap 抛 "Invalid value used as weak map key")
697
- * - WeakSet 元素必须可弱持有:prim 元素(含字符串字符)→ TypeError
698
- * 抽象形态不确定 → false(保守)。
692
+ * - 非可迭代字面量(number/boolean/symbol/bigint、闭对象字面量、symbol
693
+ * 字面量)→ 四个集合构造器都抛
694
+ * - Map/WeakMap 条目必须是对象(IsObject):prim 条目(含字符串实参的
695
+ * 每个字符、tuple/Set 元素)与 nullish 字面量条目 → TypeError
696
+ * (Bug 8:null/undefined/symbol 字面量挂 shape unknown + lit term,
697
+ * 旧 primEntry 只查 prim 形态 → 漏抛)
698
+ * - WeakMap 键 = Get(entry, "0") 须可弱持有(classifyCanBeHeldWeakly 同
699
+ * 口径):零/一元组、闭对象/fn/无 0 槽 brand 条目键 undefined、prim/
700
+ * nullish 键 → TypeError(Bug 8:旧口径只查 ≥2 元组首元素 prim)
701
+ * - WeakSet 元素须可弱持有:prim/nullish 字面量元素(含字符串字符)→
702
+ * TypeError;symbol 元素合法(node 实测 new WeakSet([Symbol()]) 不抛)
703
+ * - Bug 8 gate 面:抽象外层 iterable(any/unknown/开放 obj/fn/其它 brand)
704
+ * 可能非可迭代、抽象元素(含抽象字符串实参的字符臂)可能非 entry/
705
+ * 非弱键 → recordMayThrow(三个分派点共用本判定,集中记录)
699
706
  */
700
707
  declare function ctorArgDefinitelyInvalid(name: "Map" | "Set" | "WeakMap" | "WeakSet", iterable: Abs | undefined): boolean;
701
708
  declare function makeMapAbs(iterable?: Abs): Abs;
@@ -807,7 +814,11 @@ type FormatOptions = {
807
814
  declare function formatAbs(a: Abs, opts?: FormatOptions): string;
808
815
  /** fn/arr 槽位:shape + 非 lit term(禁止在 format 里内联复制 term 逻辑) */
809
816
  declare function formatShapeSlot(a: Abs): string;
810
- declare function formatShape(a: Abs): string;
817
+ declare function formatShape(a: Abs, opts?: {
818
+ maxDepth?: number;
819
+ showLits?: boolean;
820
+ pretty?: boolean;
821
+ }): string;
811
822
  /** 多行展示,CLI 用 */
812
823
  declare function formatAbsMultiline(a: Abs, label?: string): string;
813
824
 
@@ -926,6 +937,7 @@ type PolyFn = {
926
937
  entryReqs?: Array<{
927
938
  param: string;
928
939
  pred: Pred;
940
+ display?: string;
929
941
  }>;
930
942
  /**
931
943
  * 形参表面(C4.1):默认/rest/解构的契约可绑定名。
package/dist/index.js CHANGED
@@ -64,7 +64,7 @@ import {
64
64
  takeInterfaceDiagsSince,
65
65
  takeRefineDiags,
66
66
  takeRefineDiagsSince
67
- } from "./chunk-S7HJL5GW.js";
67
+ } from "./chunk-PKVKQB5S.js";
68
68
  import {
69
69
  $add,
70
70
  $arguments,
@@ -328,6 +328,7 @@ import {
328
328
  isAbsVal,
329
329
  isArrMutator,
330
330
  isBigPrim,
331
+ isCjsMainRun,
331
332
  isDefinitelyFalse,
332
333
  isDefinitelyTrue,
333
334
  isErrorCtorName,
@@ -469,6 +470,7 @@ import {
469
470
  setHasEntry,
470
471
  setImplicationOracle,
471
472
  setMayThrowCollector,
473
+ setPosCollector,
472
474
  setPropFlags,
473
475
  setSizeAbs,
474
476
  shape,
@@ -520,7 +522,7 @@ import {
520
522
  v,
521
523
  withExecPhi,
522
524
  withVar
523
- } from "./chunk-PGTNSUTE.js";
525
+ } from "./chunk-2ZIOQGW3.js";
524
526
 
525
527
  // src/environment.ts
526
528
  function createEnvironment(parent, bindings = /* @__PURE__ */ new Map()) {
@@ -3434,6 +3436,7 @@ export {
3434
3436
  isAbsVal,
3435
3437
  isArrMutator,
3436
3438
  isBigPrim,
3439
+ isCjsMainRun,
3437
3440
  isDefinitelyFalse,
3438
3441
  isDefinitelyTrue,
3439
3442
  isErrorCtorName,
@@ -3593,6 +3596,7 @@ export {
3593
3596
  setHasEntry,
3594
3597
  setImplicationOracle,
3595
3598
  setInterfaceDiagCollector,
3599
+ setPosCollector,
3596
3600
  setPropFlags,
3597
3601
  setRefineDiagCollector,
3598
3602
  setSizeAbs,
@@ -1,7 +1,7 @@
1
- import { I as InterfaceSource, a as InterfaceTierOpts, p as parseSource, C as CheckIssue } from './projection-budget-Dm1YWZ1U.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-Dm1YWZ1U.js';
3
- import { A as Abs, T as Term, c as AbsModuleExports, d as AstEnv } from './run-WZKUu1y1.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-WZKUu1y1.js';
1
+ import { I as InterfaceSource, a as InterfaceTierOpts, p as parseSource, C as CheckIssue } from './projection-budget-Dey0IUJa.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-Dey0IUJa.js';
3
+ import { A as Abs, T as Term, c as AbsModuleExports, d as AstEnv } from './run-Bgj2tCrv.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-Bgj2tCrv.js';
5
5
  import { File, Node } from '@babel/types';
6
6
 
7
7
  /**
@@ -385,6 +385,8 @@ type AbsInlay = {
385
385
  interfaceSource?: InterfaceSource;
386
386
  /** true = 隐式推导展示(非义务契约),label 已带 `· derived` */
387
387
  derived?: boolean;
388
+ /** 折叠展示时的完整 pred 文本(hover tooltip;display 缺席时无) */
389
+ tooltip?: string;
388
390
  };
389
391
  type CollectAbsInlaysOpts = InterfaceTierOpts & {
390
392
  loadModule?: (spec: string, fromFile: string) => string | undefined;
package/dist/internal.js CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  stableAnalyzeKeySource,
22
22
  stablePathKey,
23
23
  stablePathKeyGraph
24
- } from "./chunk-S7HJL5GW.js";
24
+ } from "./chunk-PKVKQB5S.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-PGTNSUTE.js";
172
+ } from "./chunk-2ZIOQGW3.js";
173
173
 
174
174
  // src/algebra/inlay.ts
175
175
  function listFunctions(source) {
@@ -282,7 +282,9 @@ function collectAbsInlays(source, opts) {
282
282
  const predsByName = /* @__PURE__ */ new Map();
283
283
  if (g.entryReqs) {
284
284
  for (const r of g.entryReqs) {
285
- predsByName.set(r.param, [r.pred]);
285
+ predsByName.set(r.param, [
286
+ { pred: r.pred, ...r.display !== void 0 ? { display: r.display } : {} }
287
+ ]);
286
288
  }
287
289
  }
288
290
  const fnNode = node;
@@ -293,12 +295,15 @@ function collectAbsInlays(source, opts) {
293
295
  if (!p?.loc || !pname) continue;
294
296
  const preds = predsByName.get(pname);
295
297
  if (preds && preds.length > 0) {
296
- const text = preds.map(predToString).join(" \u2227 ");
298
+ const text = preds.map((p2) => predToString(p2.pred)).join(" \u2227 ");
299
+ const displays = preds.map((p2) => p2.display);
300
+ const display = displays.every((d) => d !== void 0) ? displays.map((d) => d).join(" \u2227 ") : void 0;
297
301
  inlays.push({
298
302
  line: p.loc.end.line,
299
303
  character: p.loc.end.column,
300
- label: ` where ${text}`,
304
+ label: display !== void 0 ? ` where ${display}` : ` where ${text}`,
301
305
  kind: "parameter",
306
+ ...display !== void 0 ? { tooltip: text } : {},
302
307
  ...tierSrc ? { interfaceSource: tierSrc } : {}
303
308
  });
304
309
  }
@@ -1,5 +1,5 @@
1
1
  import { File } from '@babel/types';
2
- import { A as Abs, T as Term, P as PrimName, a as Pred, L as LiteralValue, b as Phi, C as Confidence } from './run-WZKUu1y1.js';
2
+ import { A as Abs, T as Term, P as PrimName, a as Pred, L as LiteralValue, b as Phi, C as Confidence } from './run-Bgj2tCrv.js';
3
3
 
4
4
  declare function resetParseSourceCache(): void;
5
5
  declare function getParseSourceCacheSize(): number;
@@ -338,14 +338,15 @@ type RefineResolveOpts = {
338
338
  };
339
339
  declare function resetNudoModuleExecCache(): void;
340
340
  /**
341
- * 解析 `ms delay` / `n percent` → [param, Pred]
342
- * 多条用 && 或换行连接。
341
+ * @nudo:contract 提取条目(pred 相对 param 项)。
343
342
  * 同时保留原始 NudoConstraint(shape 字段检查用)。
344
343
  */
345
344
  type RefineEntry = {
346
345
  param: string;
347
346
  pred: Pred;
348
347
  constraint: NudoConstraint;
348
+ /** 指令引用的约束名(`@nudo:contract x positive` 的 `positive`);display 折叠用 */
349
+ name?: string;
349
350
  };
350
351
  declare function extractRefinesFromSource(source: string, fnName: string, opts?: RefineResolveOpts): RefineEntry[];
351
352
  /** refine 参数 → 带约束模板的下标表(shape 检查用) */
@@ -485,9 +486,11 @@ type EffectiveInterfaceOpts = RefineResolveOpts & {
485
486
  };
486
487
  type EffectiveInterface = {
487
488
  fnName: string;
489
+ /** display = 表达式原文/约束名折叠形(运行时标志);缺席 = 消费端回落 pred 全展 */
488
490
  params: Array<{
489
491
  param: string;
490
492
  constraint: NudoConstraint;
493
+ display?: string;
491
494
  }>;
492
495
  returns?: {
493
496
  constraint: NudoConstraint;
@@ -496,6 +499,10 @@ type EffectiveInterface = {
496
499
  throws?: {
497
500
  kinds: string[] | "*";
498
501
  };
502
+ /** 契约来源侧车 canonical 路径(侧车绑定时);契约原文链接跳转用 */
503
+ sidecarPath?: string;
504
+ /** 侧车绑定声明行(1-based;契约原文链接 `#L<n>` 跳转目标) */
505
+ sidecarLine?: number;
499
506
  source: InterfaceSource;
500
507
  /**
501
508
  * 合取不可满足标记:params = 常数界交叉矛盾(或 prim 矛盾等 and() 不可
@@ -537,6 +544,10 @@ type InterfaceTierInfo = {
537
544
  source: InterfaceSource;
538
545
  /** handwritten/generated 时的契约展示;implicit 为 undefined */
539
546
  display?: string;
547
+ /** 契约来源侧车 canonical 路径(侧车绑定时);契约原文链接跳转用 */
548
+ sidecarPath?: string;
549
+ /** 侧车绑定声明行(1-based;契约原文链接 `#L<n>` 跳转目标) */
550
+ sidecarLine?: number;
540
551
  };
541
552
  type InterfaceTierOpts = EffectiveInterfaceOpts;
542
553
  /**
@@ -832,6 +843,14 @@ declare class ProjectionBudget {
832
843
  #private;
833
844
  /** 粘性:本次投影是否发生过截断("cycle" / "depth"),供台账记录 */
834
845
  truncated: ProjectionStopReason | undefined;
846
+ /** 展示口径:eq(self, lit(v)) pred 渲染为 lit(v)(lit 判别值
847
+ * 可见——hover 求值态面);默认 false(纯 shape 外延渲染,
848
+ * 与既有全部展示面同口径) */
849
+ showLits: boolean;
850
+ /** 展示口径:多行缩进渲染(hover 弹窗面)——obj 槽位每槽一行 +
851
+ * 尾逗号 + 2 空格缩进递增,复合臂 union 按臂断行;默认 false
852
+ * (单行——check 签名 / dts / inlay 等既有面字节不变) */
853
+ pretty: boolean;
835
854
  constructor(maxDepth?: number);
836
855
  /**
837
856
  * 进入一个 Abs(或 Shape)子树。返回 null → 继续递归,之后必须配对
@@ -400,6 +400,9 @@ type EvalCallRecord = {
400
400
  * (resultAbs=payload、throwsAbs=never,isLeakedCallRecord
401
401
  * 的 never+never 拦不住)。5 处 emitter 均已显式设置。 */
402
402
  threw: boolean;
403
+ /** 调用方帧深度(0 = 最外层求值帧;递归内层帧 ≥1)。
404
+ * 局部量投影按帧过滤重入记录(与 $nodoPos 同口径)。 */
405
+ depth?: number;
403
406
  };
404
407
  /** 清空 pureCallMemo(宿主入口 / 会话缓存失效) */
405
408
  declare function clearPureCallMemo(): void;
@@ -411,11 +414,36 @@ type EvalAbsAssignRecord = {
411
414
  line?: number;
412
415
  column?: number;
413
416
  conditional?: boolean;
417
+ /** 调用方帧深度(0 = 最外层求值帧;与 EvalCallRecord.depth 同口径) */
418
+ depth?: number;
414
419
  };
415
420
  /** 返回先前 collector,便于嵌套调用 save/restore(禁止 finally 置 null 砸外层) */
416
421
  declare function setEvalAssignCollector(collector: ((r: EvalAbsAssignRecord) => void) | null): ((r: EvalAbsAssignRecord) => void) | null;
417
422
  /** 结构赋值记录(transpile 插桩调用;无收集器时 no-op) */
418
423
  declare function $assignRecord(name: string, prev: Abs | undefined, next: Abs, line: number, column: number, conditional: boolean): void;
424
+ /** 位置级 Abs 记录(hover 重放插桩 `$nodoPos` 消费):
425
+ * (1-based 行, 0-based 列) → 该位置表达式求值态 Abs */
426
+ type EvalPosRecord = {
427
+ line: number;
428
+ column: number;
429
+ abs: Abs;
430
+ };
431
+ /** 返回先前 collector,便于嵌套调用 save/restore(禁止 finally 置 null 砸外层) */
432
+ declare function setPosCollector(collector: ((r: EvalPosRecord) => void) | null): ((r: EvalPosRecord) => void) | null;
433
+ declare function getPosCollector(): ((r: EvalPosRecord) => void) | null;
434
+ /**
435
+ * 位置级 Abs 记录(transpile 插桩调用——`recordPositions` 时
436
+ * Identifier 值读 / 静态成员读包此调用):把 (行, 列) → Abs
437
+ * 记入活跃 collector 并**原样返回**(语义恒等);无收集器时
438
+ * 直通(热路径零开销——仅重放开插桩)。
439
+ *
440
+ * 仅记最外层求值帧(evalCallDepth === 0):递归函数的内层帧
441
+ * ($callNamed/$new 预算帧)会以重入态重执行同一源码位置——
442
+ * 自递归类型(lazy 自引用契约)下内层帧携带 cycle 截断的
443
+ * opaque unknown,first-wins 记录会以外层正确值被污染为序;
444
+ * 编辑器位置的语义以最外层调用帧(hover 重放的单次入口)为准。
445
+ */
446
+ declare function $nodoPos(v: Abs, line: number, column: number): Abs;
419
447
  declare function setEvalBindingSink(sink: Map<string, unknown> | null): void;
420
448
  /** 顶层绑定记录(transpile 插桩调用) */
421
449
  declare function $recordBinding(name: string, value: unknown): void;
@@ -701,6 +729,12 @@ type AbsModuleExports = {
701
729
  * 成功求值的表报(zero-FP,避免与 module-missing 叠报)。
702
730
  */
703
731
  evaluated?: boolean;
732
+ /**
733
+ * CJS `module.exports = X` 重赋值形态(Bug 10 回归修复):原生 require
734
+ * 返回 X 本身(常为可调用函数),而非命名空间对象。requireFromModules
735
+ * 据此返回 default(= module.exports 值);缺省按命名空间对象口径。
736
+ */
737
+ cjsMain?: boolean;
704
738
  };
705
739
  /**
706
740
  * 命名空间 Abs(`import * as ns` / `export * as ns` / CJS require 绑定):
@@ -746,6 +780,9 @@ type RunTranspiledOptions = {
746
780
  envGlobals?: Record<string, Abs>;
747
781
  /** @nudo:mock 注入值:name → Abs(mockDirectivesToAbsSeeds 产物) */
748
782
  mocks?: Record<string, Abs>;
783
+ /** 节点级 Abs 记录插桩(hover 重放用——透传 transpile 的
784
+ * recordPositions:Identifier 值读 / 静态成员读包 $nodoPos) */
785
+ recordPositions?: boolean;
749
786
  /** 宽松全局(调用点发现 exec 采集:未声明全局调用保守 unknown 不中断) */
750
787
  lenientGlobals?: boolean;
751
788
  };
@@ -792,6 +829,8 @@ declare function noteEvalFallback(e: unknown): void;
792
829
  * unsupported:*(能力边界)/ internal(B 缺陷)都记录到收集器;
793
830
  * 返回 undefined 表示调用方应走解释路径。
794
831
  */
832
+ /** run 表是否来自 CJS `module.exports = X` 重赋值形态(供桥接层标 cjsMain)。 */
833
+ declare function isCjsMainRun(run: Record<string, unknown>): boolean;
795
834
  declare function tryRunTranspiled(source: string, opts?: RunTranspiledOptions): Record<string, unknown> | undefined;
796
835
  type TranspiledCallResult = {
797
836
  result: Abs;
@@ -817,4 +856,4 @@ declare function callTranspiledExport(exports: Record<string, unknown>, name: st
817
856
  */
818
857
  declare function callTranspiledExportApply(exports: Record<string, unknown> | (() => Record<string, unknown>), name: string): (args: Abs[], thisVal?: Abs) => AbsApplyResult;
819
858
 
820
- export { $tryDigestSoft as $, type Abs as A, orphanMayThrowEffects as B, type Confidence as C, popMayThrowFrame as D, ERROR_FAMILY as E, pushMayThrowFrame as F, recordMayThrow as G, resetEvalFallbackStats as H, runWithMayThrowSession as I, setMayThrowCollector as J, throwAbsToKinds as K, type LiteralValue as L, type MayThrowEffect as M, throwsKindCovered as N, withEvalBudgetOverride as O, type PrimName as P, type HofCollectCtx as Q, type RelSource as R, type Shape as S, type Term as T, type HofSite as U, type RunTranspiledOptions as V, $assignRecord as W, $call as X, $callNamed as Y, $recordBinding as Z, type AbsApplyNoThrow as _, type Pred as a, ne as a$, type AbsApplyNoThrowFn as a0, type AbsApplyResult as a1, type AbsApplyReturn as a2, type AbsFnImpl as a3, type AbsSigImpl as a4, type EvalAbsAssignRecord as a5, type EvalCallRecord as a6, type EvalFallback as a7, type ImplicationOracle as a8, type LitValueResult as a9, emptyPhi as aA, eq as aB, evalExprAbs as aC, ge as aD, geNum as aE, getEvalCallCollector as aF, getFnImpl as aG, getImplicationOracle as aH, gt as aI, gtNum as aJ, hostFnCtorFacet as aK, implies as aL, isAbsApplyResult as aM, isAbsVal as aN, isBigPrim as aO, isExactLit as aP, isNumPrim as aQ, isStrPrim as aR, le as aS, leNum as aT, lit as aU, litValue as aV, lt as aW, ltNum as aX, makeAbsApplyResult as aY, markPureFn as aZ, namespaceAbsOf as a_, MAX_EVAL_CALL_DEPTH as aa, MAX_EVAL_TOTAL_CALLS as ab, RUNTIME_IMPORT_RE as ac, TYPEOF_NAMES as ad, type TranspiledCallResult as ae, type TypeofName as af, abs as ag, absFunction as ah, absOnly as ai, absToString as aj, and as ak, anyAbs as al, anyVar as am, app as an, assumeFinite as ao, attachFnImpl as ap, bigintLit as aq, bindImports as ar, bindingsOf as as, bool as at, boolLit as au, callTranspiledExport as av, callTranspiledExportApply as aw, callTranspiledExportFull as ax, collectAbsExports as ay, confJoin as az, type Phi as b, negatePred as b0, never as b1, not as b2, noteEvalCallRecord as b3, noteEvalFallback as b4, num as b5, numLit as b6, numVar as b7, obj as b8, or as b9, termEquals as bA, termToString as bB, tryRunTranspiled as bC, unknown as bD, v as bE, routeApplyThrows as bF, pFalse as ba, pTrue as bb, phiAnd as bc, predEquals as bd, predToString as be, predVars as bf, primToTypeof as bg, ptypeof as bh, pureFnNameOf as bi, relationFingerprint as bj, relationFn as bk, resetEvalCallBudget as bl, runTranspiled as bm, runTranspiledOptionsMemoKey as bn, setEvalAssignCollector as bo, setEvalBindingSink as bp, setEvalCallCollector as bq, setEvalFallbackCollector as br, setImplicationOracle as bs, shapeOfTerm as bt, shapeOnlyFn as bu, shapeToString as bv, simplifyTerm as bw, str as bx, strLit as by, substPred as bz, type AbsModuleExports as c, type AstEnv as d, $tryMarkSoft as e, $tryReleaseSoft as f, type EvalFallbackStats as g, absLit as h, absNumLit as i, absStrLit as j, allAbsStr as k, clearPureCallMemo as l, clearPureMemo as m, enterEvalCallBudgetSession as n, errorTypeAbs as o, exitEvalCallBudgetSession as p, filterDeclaredThrows as q, filterGateThrows as r, filterIgnoredThrows as s, flushMayThrowEffects as t, formatThrowsAbs as u, getEvalCallBudgetState as v, getEvalFallbackStats as w, getMayThrowCollector as x, isThrowsIgnored as y, mayThrowEffectsToAbs as z };
859
+ export { $tryDigestSoft as $, type Abs as A, orphanMayThrowEffects as B, type Confidence as C, popMayThrowFrame as D, ERROR_FAMILY as E, pushMayThrowFrame as F, recordMayThrow as G, resetEvalFallbackStats as H, runWithMayThrowSession as I, setMayThrowCollector as J, throwAbsToKinds as K, type LiteralValue as L, type MayThrowEffect as M, throwsKindCovered as N, withEvalBudgetOverride as O, type PrimName as P, type HofCollectCtx as Q, type RelSource as R, type Shape as S, type Term as T, type HofSite as U, type RunTranspiledOptions as V, $assignRecord as W, $call as X, $callNamed as Y, $recordBinding as Z, type AbsApplyNoThrow as _, type Pred as a, markPureFn as a$, type AbsApplyNoThrowFn as a0, type AbsApplyResult as a1, type AbsApplyReturn as a2, type AbsFnImpl as a3, type AbsSigImpl as a4, type EvalAbsAssignRecord as a5, type EvalCallRecord as a6, type EvalFallback as a7, type EvalPosRecord as a8, type ImplicationOracle as a9, confJoin as aA, emptyPhi as aB, eq as aC, evalExprAbs as aD, ge as aE, geNum as aF, getEvalCallCollector as aG, getFnImpl as aH, getImplicationOracle as aI, gt as aJ, gtNum as aK, hostFnCtorFacet as aL, implies as aM, isAbsApplyResult as aN, isAbsVal as aO, isBigPrim as aP, isCjsMainRun as aQ, isExactLit as aR, isNumPrim as aS, isStrPrim as aT, le as aU, leNum as aV, lit as aW, litValue as aX, lt as aY, ltNum as aZ, makeAbsApplyResult as a_, type LitValueResult as aa, MAX_EVAL_CALL_DEPTH as ab, MAX_EVAL_TOTAL_CALLS as ac, RUNTIME_IMPORT_RE as ad, TYPEOF_NAMES as ae, type TranspiledCallResult as af, type TypeofName as ag, abs as ah, absFunction as ai, absOnly as aj, absToString as ak, and as al, anyAbs as am, anyVar as an, app as ao, assumeFinite as ap, attachFnImpl as aq, bigintLit as ar, bindImports as as, bindingsOf as at, bool as au, boolLit as av, callTranspiledExport as aw, callTranspiledExportApply as ax, callTranspiledExportFull as ay, collectAbsExports as az, type Phi as b, namespaceAbsOf as b0, ne as b1, negatePred as b2, never as b3, not as b4, noteEvalCallRecord as b5, noteEvalFallback as b6, num as b7, numLit as b8, numVar as b9, str as bA, strLit as bB, substPred as bC, termEquals as bD, termToString as bE, tryRunTranspiled as bF, unknown as bG, v as bH, $nodoPos as bI, getPosCollector as bJ, routeApplyThrows as bK, obj as ba, or as bb, pFalse as bc, pTrue as bd, phiAnd as be, predEquals as bf, predToString as bg, predVars as bh, primToTypeof as bi, ptypeof as bj, pureFnNameOf as bk, relationFingerprint as bl, relationFn as bm, resetEvalCallBudget as bn, runTranspiled as bo, runTranspiledOptionsMemoKey as bp, setEvalAssignCollector as bq, setEvalBindingSink as br, setEvalCallCollector as bs, setEvalFallbackCollector as bt, setImplicationOracle as bu, setPosCollector as bv, shapeOfTerm as bw, shapeOnlyFn as bx, shapeToString as by, simplifyTerm as bz, type AbsModuleExports as c, type AstEnv as d, $tryMarkSoft as e, $tryReleaseSoft as f, type EvalFallbackStats as g, absLit as h, absNumLit as i, absStrLit as j, allAbsStr as k, clearPureCallMemo as l, clearPureMemo as m, enterEvalCallBudgetSession as n, errorTypeAbs as o, exitEvalCallBudgetSession as p, filterDeclaredThrows as q, filterGateThrows as r, filterIgnoredThrows as s, flushMayThrowEffects as t, formatThrowsAbs as u, getEvalCallBudgetState as v, getEvalFallbackStats as w, getMayThrowCollector as x, isThrowsIgnored as y, mayThrowEffectsToAbs as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nudojs/core",
3
- "version": "1.9.4",
3
+ "version": "1.10.1",
4
4
  "engines": {
5
5
  "node": ">=20"
6
6
  },
@@ -46,10 +46,11 @@
46
46
  "registry": "https://registry.npmjs.org"
47
47
  },
48
48
  "dependencies": {
49
- "@babel/parser": "^8.0.6",
49
+ "@babel/parser": "^8.0.7",
50
50
  "@babel/types": "^8.0.6"
51
51
  },
52
52
  "devDependencies": {
53
+ "@types/node": "^26.6.5",
53
54
  "commander": "^15.0.0",
54
55
  "debug": "^4.4.3",
55
56
  "escape-string-regexp": "^5.0.0",
@@ -59,8 +60,7 @@
59
60
  "lodash": "^4.18.1",
60
61
  "ms": "^2.1.3",
61
62
  "p-limit": "^7.3.3",
62
- "yocto-queue": "^1.2.2",
63
- "@types/node": "^26.6.3"
63
+ "yocto-queue": "^1.2.2"
64
64
  },
65
65
  "scripts": {
66
66
  "build": "tsup"