@nudojs/core 1.2.2 → 1.4.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/{check-report-0B9Z66n0.d.ts → check-report-Ci1dDysO.d.ts} +102 -25
- package/dist/{chunk-TOURNNEA.js → chunk-7QUVTEYZ.js} +1154 -254
- package/dist/{chunk-4V3CRVSD.js → chunk-LFCF6BLE.js} +3486 -2107
- package/dist/exec.d.ts +590 -3
- package/dist/exec.js +21 -1
- package/dist/index.d.ts +127 -132
- package/dist/index.js +417 -269
- package/dist/internal.d.ts +111 -7
- package/dist/internal.js +102 -28
- package/dist/run-WJfj477N.d.ts +769 -0
- package/package.json +1 -1
- package/dist/hof-types-DqDpAxfh.d.ts +0 -382
- package/dist/index-BNiZvVHw.d.ts +0 -739
package/dist/exec.js
CHANGED
|
@@ -123,16 +123,23 @@ import {
|
|
|
123
123
|
bindingsOf,
|
|
124
124
|
callAtFunctionBoundary,
|
|
125
125
|
callTranspiledExport,
|
|
126
|
+
callTranspiledExportApply,
|
|
126
127
|
callTranspiledExportFull,
|
|
127
128
|
clearBClasses,
|
|
129
|
+
clearPureCallMemo,
|
|
130
|
+
clearPureMemo,
|
|
128
131
|
clearStaleTermPred,
|
|
129
132
|
currentExecPhi,
|
|
133
|
+
enterEvalCallBudgetSession,
|
|
130
134
|
evalExprAbs,
|
|
135
|
+
exitEvalCallBudgetSession,
|
|
131
136
|
fillTuple,
|
|
132
137
|
foldRequireSpecArg,
|
|
133
138
|
foldStaticStringExpr,
|
|
139
|
+
getEvalCallBudgetState,
|
|
134
140
|
getEvalCallCollector,
|
|
135
141
|
getEvalClass,
|
|
142
|
+
getEvalFallbackStats,
|
|
136
143
|
isArrMutator,
|
|
137
144
|
isDefinitelyFalse,
|
|
138
145
|
isDefinitelyTrue,
|
|
@@ -149,6 +156,8 @@ import {
|
|
|
149
156
|
pushThrowExit,
|
|
150
157
|
registerEvalClass,
|
|
151
158
|
resetEvalCallBudget,
|
|
159
|
+
resetEvalFallbackStats,
|
|
160
|
+
routeApplyThrows,
|
|
152
161
|
runTranspiled,
|
|
153
162
|
runTranspiledOptionsMemoKey,
|
|
154
163
|
runWithLoopExits,
|
|
@@ -165,8 +174,9 @@ import {
|
|
|
165
174
|
transpileFile,
|
|
166
175
|
transpileSource,
|
|
167
176
|
tryRunTranspiled,
|
|
177
|
+
withEvalBudgetOverride,
|
|
168
178
|
withExecPhi
|
|
169
|
-
} from "./chunk-
|
|
179
|
+
} from "./chunk-LFCF6BLE.js";
|
|
170
180
|
export {
|
|
171
181
|
$add,
|
|
172
182
|
$arguments,
|
|
@@ -291,16 +301,23 @@ export {
|
|
|
291
301
|
bindingsOf,
|
|
292
302
|
callAtFunctionBoundary,
|
|
293
303
|
callTranspiledExport,
|
|
304
|
+
callTranspiledExportApply,
|
|
294
305
|
callTranspiledExportFull,
|
|
295
306
|
clearBClasses,
|
|
307
|
+
clearPureCallMemo,
|
|
308
|
+
clearPureMemo,
|
|
296
309
|
clearStaleTermPred,
|
|
297
310
|
currentExecPhi,
|
|
311
|
+
enterEvalCallBudgetSession,
|
|
298
312
|
evalExprAbs,
|
|
313
|
+
exitEvalCallBudgetSession,
|
|
299
314
|
fillTuple,
|
|
300
315
|
foldRequireSpecArg,
|
|
301
316
|
foldStaticStringExpr,
|
|
317
|
+
getEvalCallBudgetState,
|
|
302
318
|
getEvalCallCollector,
|
|
303
319
|
getEvalClass,
|
|
320
|
+
getEvalFallbackStats,
|
|
304
321
|
isArrMutator,
|
|
305
322
|
isDefinitelyFalse,
|
|
306
323
|
isDefinitelyTrue,
|
|
@@ -317,6 +334,8 @@ export {
|
|
|
317
334
|
pushThrowExit,
|
|
318
335
|
registerEvalClass,
|
|
319
336
|
resetEvalCallBudget,
|
|
337
|
+
resetEvalFallbackStats,
|
|
338
|
+
routeApplyThrows,
|
|
320
339
|
runTranspiled,
|
|
321
340
|
runTranspiledOptionsMemoKey,
|
|
322
341
|
runWithLoopExits,
|
|
@@ -333,5 +352,6 @@ export {
|
|
|
333
352
|
transpileFile,
|
|
334
353
|
transpileSource,
|
|
335
354
|
tryRunTranspiled,
|
|
355
|
+
withEvalBudgetOverride,
|
|
336
356
|
withExecPhi
|
|
337
357
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { c as AstEnv, A as Abs, b as Phi,
|
|
2
|
-
export {
|
|
3
|
-
import { Node } from '@babel/types';
|
|
4
|
-
import { p as parseSource, L as LeakBudget, E as EffectiveInterfaceOpts, b as LoadDepsFingerprint,
|
|
5
|
-
export {
|
|
6
|
-
|
|
7
|
-
export { $ as $add, a as $arguments, b as $arr, c as $arrMutContainer, d as $arrRest, e as $arrWithHoles, f as $assignRecord, g as $async, h as $asyncReturn, i as $await, j as $bitand, k as $bitnot, l as $bitor, m as $bitxor, n as $call, o as $callNamed, p as $catchVal, q as $class, r as $classExpr, s as $collectionForEach, t as $concat, u as $copy, v as $del, w as $delRes, x as $div, y as $dynamicImport, z as $elems, B as $eq, C as $eqLoose, D as $fnVal, E as $for, F as $forInKeys, G as $forIter, H as $forOf, I as $fork, J as $ge, K as $gen, L as $get, M as $gt, N as $idx, O as $idxSet, P as $importMeta, Q as $in, S as $instanceof, T as $instanceofNonIdent, U as $invoke, V as $invokeSuper, W as $isBreakTo, X as $isForkExit, Y as $join, Z as $le, _ as $len, a0 as $lit, a1 as $loopBreak, a2 as $loopContinue, a3 as $loopReturn, a4 as $lt, a5 as $mod, a6 as $mul, a7 as $ne, a8 as $neLoose, a9 as $neg, aa as $new, ab as $not, ac as $nullishTest, ad as $obj, ae as $objAccessor, af as $objRest, ag as $optionalGet, ah as $optionalInvoke, ai as $orDefault, aj as $pow, ak as $pushLoopExit, al as $rawThis, am as $reStateCall, an as $recordBinding, ao as $regex, ap as $rethrowIfNudoReturn, aq as $set, ar as $setKey, as as $shl, at as $shr, au as $spread, av as $staticInvoke, aw as $sub, ax as $super, ay as $switch, az as $thisGet, aA as $thisSet, aB as $throw, aC as $toNumber, aD as $toNumeric, aE as $tryCurrentMark, aF as $tryDetachSoftCatch, aG as $tryDigestSoftCatch, aH as $tryDiscardSoft, aI as $tryMark, aJ as $tryOrphanSoft, aK as $tryPopMark, aL as $tryReleaseSoftCatch, aM as $tryReleaseSoftOut, aN as $tryTakeSince, aO as $typeof, aP as $unknown, aQ as $updateAdd, aR as $updateSub, aS as $ushr, aT as $while, aU as $whileSeq, aV as $yield, aW as DEFAULT_MAX_LOOP_ITERS, aX as EvalAbsAssignRecord, aY as EvalCallRecord, aZ as EvalClassSpec, a_ as EvalFallback, a$ as MAX_EVAL_CALL_DEPTH, b0 as MAX_EVAL_TOTAL_CALLS, b1 as NudoLoopSignal, b2 as NudoReturn, b3 as NudoThrow, b4 as NudoUnsupportedError, b5 as RUNTIME_IMPORT_RE, b6 as TranspileOptions, b7 as TranspiledCallResult, b8 as asAbsVal, b9 as bindImports, ba as bindingsOf, bb as callAtFunctionBoundary, bc as callTranspiledExport, bd as callTranspiledExportFull, be as clearBClasses, bf as clearStaleTermPred, bg as collectAbsExports, bh as currentExecPhi, bi as evalExprAbs, bj as fillTuple, bk as foldRequireSpecArg, bl as foldStaticStringExpr, bm as getEvalCallCollector, bn as getEvalClass, bo as isArrMutator, bp as isDefinitelyFalse, bq as isDefinitelyTrue, br as isNudoBreak, bs as isNudoContinue, bt as isNudoReturn, bu as isNudoThrow, bv as litTruth, bw as lookupObjAccessor, bx as namespaceNameOf, by as noteEvalCallRecord, bz as noteEvalFallback, bA as pushLoopExit, bB as pushThrowExit, bC as registerEvalClass, bD as resetEvalCallBudget, bE as runTranspiled, bF as runTranspiledOptionsMemoKey, bG as runWithLoopExits, bH as runtimeImportOf, bI as setEvalAssignCollector, bJ as setEvalBindingSink, bK as setEvalCallCollector, bL as setEvalFallbackCollector, bM as takeLoopExits, bN as takeThrowExits, bO as transpile, bP as transpileBodyNode, bQ as transpileExpression, bR as transpileFile, bS as transpileSource, bT as tryRunTranspiled, bU as withExecPhi } from './index-BNiZvVHw.js';
|
|
1
|
+
import { c as AstEnv, A as Abs, b as Phi, T as Term, I as HofCollectCtx, C as Confidence, S as Shape, a as Pred, R as RelSource, J as HofSite, K as AbsModuleExports, N as RunTranspiledOptions } from './run-WJfj477N.js';
|
|
2
|
+
export { O as $assignRecord, Q as $call, U as $callNamed, V as $recordBinding, W as AbsApplyNoThrow, X as AbsApplyNoThrowFn, Y as AbsApplyResult, Z as AbsApplyReturn, _ as AbsFnImpl, a0 as AbsSigImpl, a1 as EvalAbsAssignRecord, a2 as EvalCallRecord, a3 as EvalFallback, a4 as ImplicationOracle, a5 as LitValueResult, L as LiteralValue, a6 as MAX_EVAL_CALL_DEPTH, a7 as MAX_EVAL_TOTAL_CALLS, P as PrimName, a8 as RUNTIME_IMPORT_RE, a9 as TYPEOF_NAMES, aa as TranspiledCallResult, ab as TypeofName, ac as abs, ad as absFunction, ae as absOnly, af as absToString, ag as and, ah as anyAbs, ai as anyVar, aj as app, ak as assumeFinite, al as attachFnImpl, am as bigintLit, an as bindImports, ao as bindingsOf, ap as bool, aq as boolLit, ar as callTranspiledExport, as as callTranspiledExportApply, at as callTranspiledExportFull, au as collectAbsExports, av as confJoin, aw as emptyPhi, ax as eq, ay as evalExprAbs, az as ge, aA as geNum, aB as getEvalCallCollector, aC as getFnImpl, aD as getImplicationOracle, aE as gt, aF as gtNum, aG as implies, aH as isAbsApplyResult, aI as isBigPrim, aJ as isExactLit, aK as isNumPrim, aL as isStrPrim, aM as le, aN as leNum, aO as lit, aP as litValue, aQ as lt, aR as ltNum, aS as makeAbsApplyResult, aT as markPureFn, aU as namespaceAbsOf, aV as ne, aW as negatePred, aX as never, aY as not, aZ as noteEvalCallRecord, a_ as noteEvalFallback, a$ as num, b0 as numLit, b1 as numVar, b2 as obj, b3 as or, b4 as pFalse, b5 as pTrue, b6 as phiAnd, b7 as predEquals, b8 as predToString, b9 as predVars, ba as primToTypeof, bb as ptypeof, bc as pureFnNameOf, bd as relationFingerprint, be as relationFn, bf as resetEvalCallBudget, bg as runTranspiled, bh as runTranspiledOptionsMemoKey, bi as setEvalAssignCollector, bj as setEvalBindingSink, bk as setEvalCallCollector, bl as setEvalFallbackCollector, bm as setImplicationOracle, bn as shapeOfTerm, bo as shapeOnlyFn, bp as shapeToString, bq as simplifyTerm, br as str, bs as strLit, bt as substPred, bu as termEquals, bv as termToString, bw as tryRunTranspiled, bx as unknown, by as v } from './run-WJfj477N.js';
|
|
3
|
+
import { Node, File } from '@babel/types';
|
|
4
|
+
import { p as parseSource, L as LeakBudget, E as EffectiveInterfaceOpts, b as LoadDepsFingerprint, o as CheckReport, N as NudoConstraint } from './check-report-Ci1dDysO.js';
|
|
5
|
+
export { q as CONSTRAINT_BUILDERS, u as CONSTRAINT_BUILDER_NAMES, v as CONSTRAINT_EXPR_RE, w as CheckAction, C as CheckIssue, x as CheckJson, y as CheckJsonMulti, z as ConstraintBuilder, D as Diagnostic, A as EffectiveInterface, G as GitlabCodeQualityIssue, B as InterfaceDiag, I as InterfaceSource, F as InterfaceTierInfo, a as InterfaceTierOpts, H as NamedImport, J as NudoField, K as NudoFnConstraint, O as NudoSidecarError, P as NudoSig, R as RefineDiag, Q as RefineEntry, S as RefineResolveOpts, T as SELF, U as actionsForIssue, V as andC, W as any, X as array, Y as boolean, Z as checkArg, _ as checkCall, $ as constraintAdmitsNullish, a0 as constraintToEntryAbs, a1 as drainPromiseMicros, a2 as effectiveInterface, a3 as enterPromiseExecutorScope, a4 as evalPromiseCtor, a5 as evalPromiseMethod, a6 as evalPromiseStatic, a7 as execNudoModule, a8 as extractDeclaredThrows, a9 as extractFnBudget, aa as extractNudoImports, ab as extractRefineReturnFromSource, ac as extractRefinesFromSource, ad as fn, ae as fnConstraintToEntryReqs, af as formatCheckReport, ag as formatConstraint, ah as formatDiagnostics, ai as formatEffectiveInterfaceDisplay, aj as formatGithubAnnotations, ak as formatGitlabCodeQuality, al as formatInterfaceTierLine, am as generatedExportNames, an as getParseSourceCacheSize, ao as getTerm, ap as instantiateConstraint, aq as interfaceDiagCount, ar as interfaceSourceOf, as as interfaceTierOf, at as isIntFlag, au as isNodeModulesPath, av as isNudoConstraint, aw as leavePromiseExecutorScope, ax as lenTerm, ay as litC, az as localNamedExports, aA as notePromiseExecutorFork, aB as nullable, aC as number, aD as omit, aE as partial, aF as pick, aG as queuePromiseMicro, aH as refineDiagCount, aI as refineToIndexedFull, aJ as resetNudoModuleExecCache, aK as resetParseSourceCache, aL as resetSidecarLoadFailureCache, aM as serializeCheckJson, aN as serializeCheckJsonMulti, aO as setInterfaceDiagCollector, aP as setRefineDiagCollector, aQ as shape, aR as sidecarClosureFingerprint, aS as sidecarPathOf, aT as string, aU as takeInterfaceDiags, aV as takeInterfaceDiagsSince, aW as takeRefineDiags, aX as takeRefineDiagsSince, aY as throwConstraintToKinds, aZ as union } from './check-report-Ci1dDysO.js';
|
|
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';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* AstEnv:抽象求值环境类型面(ast-eval 删除后保留)。
|
|
@@ -108,104 +107,6 @@ declare function resetPhi(): void;
|
|
|
108
107
|
declare function withPhiConstraint(extra: Phi, body: () => void): void;
|
|
109
108
|
declare function describePhi(): string;
|
|
110
109
|
|
|
111
|
-
/**
|
|
112
|
-
* Abs 上的一等函数:shape 是 fn,实现在旁路(不污染 Shape)。
|
|
113
|
-
* 与 term-registry 同一纪律:不给共享单例挂 impl。
|
|
114
|
-
*/
|
|
115
|
-
|
|
116
|
-
/** Abs 原生 env/builtin 实现(evaluator 优先) */
|
|
117
|
-
type AbsSigImpl = (args: Abs[], thisVal?: Abs) => Abs | undefined;
|
|
118
|
-
type AbsFnImpl = {
|
|
119
|
-
params: string[];
|
|
120
|
-
/** 可选:无 body 时走 relation(纯关系 fn) */
|
|
121
|
-
body?: Node;
|
|
122
|
-
async?: boolean;
|
|
123
|
-
/** 声明时捕获的环境(闭包) */
|
|
124
|
-
env?: AstEnv;
|
|
125
|
-
kind?: string;
|
|
126
|
-
/** 调用时直接派发(mock withArgs 等),优先于 body */
|
|
127
|
-
apply?: (args: Abs[], thisVal?: Abs) => Abs;
|
|
128
|
-
/**
|
|
129
|
-
* 对象方法(ObjectMethod / 方法型 FunctionExpression):$invoke 时把
|
|
130
|
-
* receiver 作为 apply 的**首参**注入。shape.params 仍是用户可见形参
|
|
131
|
-
* (不含 receiver),自由调用不注入 → this 为 unbound(JS 语义)。
|
|
132
|
-
*/
|
|
133
|
-
bindThis?: boolean;
|
|
134
|
-
/**
|
|
135
|
-
* Optional content key for cache fingerprints. formatAbs cannot see
|
|
136
|
-
* WeakMap-side mock semantics (returns/withArgs/callsFake), so hosts that
|
|
137
|
-
* build mocks should stamp a stable fingerprint here.
|
|
138
|
-
* relation-only 必填(未传时 relationFn 自动生成)。
|
|
139
|
-
*/
|
|
140
|
-
fingerprint?: string;
|
|
141
|
-
/** 无 body 时,按 paramTypes 做 α 替换得到返回 */
|
|
142
|
-
relation?: {
|
|
143
|
-
paramTypes: Abs[];
|
|
144
|
-
returnType: Abs;
|
|
145
|
-
/**
|
|
146
|
-
* 条件类型 infer:绑定 fromVar 后从 via 投出 inferVar
|
|
147
|
-
* (`T extends (infer E)[]` → via: "arr";`T extends Promise<infer U>` → "promise")。
|
|
148
|
-
*/
|
|
149
|
-
inferFrom?: {
|
|
150
|
-
fromVar: string;
|
|
151
|
-
via: "arr" | "promise";
|
|
152
|
-
inferVar: string;
|
|
153
|
-
};
|
|
154
|
-
/** extends 不成立时的假分支(如 never) */
|
|
155
|
-
condFallback?: Abs;
|
|
156
|
-
};
|
|
157
|
-
/** `@nudo:pure`:调用结果按实参记忆化(无副作用契约) */
|
|
158
|
-
pureName?: string;
|
|
159
|
-
};
|
|
160
|
-
declare function attachFnImpl(a: Abs, impl: AbsFnImpl): void;
|
|
161
|
-
declare function getFnImpl(a: Abs): AbsFnImpl | undefined;
|
|
162
|
-
/** 标记纯函数(@nudo:pure):调用结果可按实参记忆化 */
|
|
163
|
-
declare function markPureFn(target: object, name: string): void;
|
|
164
|
-
/** 读纯函数标记(Abs impl 或对象属性 `_memoize`) */
|
|
165
|
-
declare function pureFnNameOf(fn: unknown): string | undefined;
|
|
166
|
-
/** 造一个带实现的 Abs 函数值 */
|
|
167
|
-
declare function absFunction(params: string[], impl: Omit<AbsFnImpl, "params">, opts?: {
|
|
168
|
-
name?: string;
|
|
169
|
-
paramTypes?: Abs[];
|
|
170
|
-
returnType?: Abs;
|
|
171
|
-
slots?: Record<string, {
|
|
172
|
-
value: Abs;
|
|
173
|
-
optional?: boolean;
|
|
174
|
-
readonly?: boolean;
|
|
175
|
-
}>;
|
|
176
|
-
conf?: Confidence;
|
|
177
|
-
}): Abs;
|
|
178
|
-
/** relationFn 稳定 fingerprint(同签名共享,见 §3.3 已知限制) */
|
|
179
|
-
declare function relationFingerprint(paramTypes: Abs[], returnType: Abs): string;
|
|
180
|
-
/**
|
|
181
|
-
* 无 body、纯关系的 fn Abs。params 仅记 arity。
|
|
182
|
-
*
|
|
183
|
-
* **双写纪律:** 同一份关系数据必须同时写到——
|
|
184
|
-
* 1. `shape.paramTypes` / `shape.returnType` —— format / leq / 展示读这里
|
|
185
|
-
* 2. `impl.relation` —— D 路径应用读这里
|
|
186
|
-
* 两槽共享同一数组/对象引用(防内容分叉);构造后请勿原地 mutate。
|
|
187
|
-
*
|
|
188
|
-
* 默认 conf="path"(与提升产物一致)。禁止静默对齐 absFunction 的 "exact"。
|
|
189
|
-
* fingerprint 必填(call-budget);未传时由 paramTypes+returnType 稳定序列化生成。
|
|
190
|
-
* 同签名 relationFn 共享 fingerprint → 共享 budget 键(见 design §3.3 已知限制)。
|
|
191
|
-
*/
|
|
192
|
-
declare function relationFn(paramTypes: Abs[], returnType: Abs, opts?: {
|
|
193
|
-
params?: string[];
|
|
194
|
-
conf?: Confidence;
|
|
195
|
-
fingerprint?: string;
|
|
196
|
-
inferFrom?: {
|
|
197
|
-
fromVar: string;
|
|
198
|
-
via: "arr" | "promise";
|
|
199
|
-
inferVar: string;
|
|
200
|
-
};
|
|
201
|
-
condFallback?: Abs;
|
|
202
|
-
}): Abs;
|
|
203
|
-
/** 仅写 shape 槽(E 路径 / §5.2 提升产物);禁止 attachFnImpl */
|
|
204
|
-
declare function shapeOnlyFn(paramTypes: Abs[], returnType: Abs, opts?: {
|
|
205
|
-
params?: string[];
|
|
206
|
-
conf?: Confidence;
|
|
207
|
-
}): Abs;
|
|
208
|
-
|
|
209
110
|
/**
|
|
210
111
|
* HOF 关系 Abs:无 body 的外延关系(paramTypes → returnType)的判定、
|
|
211
112
|
* α 替换与应用。类型变量仍是 term var;关系仍是 fn 形状上的外延槽。
|
|
@@ -494,7 +395,8 @@ declare function evalJsonMethod(name: string, args: Abs[]): Abs | undefined;
|
|
|
494
395
|
declare function evalNumberStatic(name: string, args: Abs[]): Abs | undefined;
|
|
495
396
|
|
|
496
397
|
/**
|
|
497
|
-
* 全局转换函数(parseInt / Number / String / Boolean / Object / Array / Symbol …)
|
|
398
|
+
* 全局转换函数(parseInt / Number / String / Boolean / Object / Array / Symbol / BigInt …)
|
|
399
|
+
* 以及无 `new` 的原生构造器调用(Error 家族 / Map / Set / Promise …)。
|
|
498
400
|
*/
|
|
499
401
|
|
|
500
402
|
declare function evalGlobalFn(name: string, args: Abs[]): Abs | undefined;
|
|
@@ -560,27 +462,6 @@ declare const OBJECT_PROTO_METHOD_NAMES: Set<string>;
|
|
|
560
462
|
declare function objectProtoBrand(): Abs;
|
|
561
463
|
declare function isObjectProtoBrand(a: Abs | undefined): boolean;
|
|
562
464
|
|
|
563
|
-
/**
|
|
564
|
-
* Promise 构造 / then 链 / 静态方法 + micro 队列
|
|
565
|
-
*/
|
|
566
|
-
|
|
567
|
-
declare function enterPromiseExecutorScope(): void;
|
|
568
|
-
declare function leavePromiseExecutorScope(): number;
|
|
569
|
-
/** $fork 在 executor 内发生时打点(多臂 resolve 需 join,不得 first-wins 假精确) */
|
|
570
|
-
declare function notePromiseExecutorFork(): void;
|
|
571
|
-
declare function queuePromiseMicro(task: () => void): void;
|
|
572
|
-
declare function drainPromiseMicros(): void;
|
|
573
|
-
/**
|
|
574
|
-
* new Promise(executor):调用 executor(resolve, reject),收集 resolve 实参作为
|
|
575
|
-
* promise inner。原生只认第一次 settle——顺序双 resolve 取第一次;执行器内
|
|
576
|
-
* $fork 分叉时各臂 settle 值 join(路径敏感,不得 first-wins 假精确)。
|
|
577
|
-
* reject 不填 resolved 通道;永不 settle / 抽象 fn / 执行抛 → promise<unknown>。
|
|
578
|
-
*/
|
|
579
|
-
declare function evalPromiseCtor(args: Abs[]): Abs;
|
|
580
|
-
/** then/catch/finally:可映射回调 → 新 inner;做不到诚实 promise<unknown> */
|
|
581
|
-
declare function evalPromiseMethod(name: string, recv: Abs, args: Abs[]): Abs | undefined;
|
|
582
|
-
declare function evalPromiseStatic(name: string, args: Abs[]): Abs | undefined;
|
|
583
|
-
|
|
584
465
|
/**
|
|
585
466
|
* Error 家族 + evalBuiltinNew / evalBuiltinInstanceMethod + namespace 分派
|
|
586
467
|
*/
|
|
@@ -968,6 +849,12 @@ type AstParam = {
|
|
|
968
849
|
declare function formalParamsFromNodes(params: AstParam[] | undefined | null): FormalParam[];
|
|
969
850
|
/** 求值/签名用形参名(与 analyzer extractParamNames / dts 对齐) */
|
|
970
851
|
declare function formalParamDisplayNames(formals: FormalParam[]): string[];
|
|
852
|
+
/**
|
|
853
|
+
* 签名展示名(C4.1 #64):解构形参渲染为 `{ grade, findings }`,
|
|
854
|
+
* 不落回求值占位 `_p0`——否则读签名的人以为没有契约。
|
|
855
|
+
* 求值/内部键仍用 formalParamDisplayNames(`_p0`)。
|
|
856
|
+
*/
|
|
857
|
+
declare function formalParamSignatureNames(formals: FormalParam[]): string[];
|
|
971
858
|
/** 侧车契约可绑定的参数名全集 */
|
|
972
859
|
declare function contractParamNameSet(formals: FormalParam[]): Set<string>;
|
|
973
860
|
/**
|
|
@@ -994,7 +881,7 @@ declare function resetGeneralizeMemo(): void;
|
|
|
994
881
|
declare function getGeneralizeMemoSize(): number;
|
|
995
882
|
/**
|
|
996
883
|
* LSP/宿主:`*.nudo.js` 变更后按路径定向逐出依赖它的 L0 条目。
|
|
997
|
-
*
|
|
884
|
+
* 返回删除的条目数。查找与索引同走 stablePathKey——跨 Windows 盘符形态命中。
|
|
998
885
|
*/
|
|
999
886
|
declare function evictGeneralizeMemoForPaths(paths: string[]): number;
|
|
1000
887
|
|
|
@@ -1134,7 +1021,7 @@ type CheckOptions = {
|
|
|
1134
1021
|
*/
|
|
1135
1022
|
|
|
1136
1023
|
declare function resetCheckSourceMemo(): void;
|
|
1137
|
-
/** `*.nudo.js` 变更后定向逐出依赖它的整文件 check
|
|
1024
|
+
/** `*.nudo.js` 变更后定向逐出依赖它的整文件 check 缓存。查找与索引同走 stablePathKey */
|
|
1138
1025
|
declare function evictCheckSourceMemoForPaths(paths: string[]): number;
|
|
1139
1026
|
|
|
1140
1027
|
/**
|
|
@@ -1157,6 +1044,114 @@ declare function evictCheckSourceMemoForPaths(paths: string[]): number;
|
|
|
1157
1044
|
*/
|
|
1158
1045
|
declare function checkSource(filePath: string, source: string, phi?: Phi, opts?: CheckOptions): CheckReport;
|
|
1159
1046
|
|
|
1047
|
+
/**
|
|
1048
|
+
* 单源 `@nudo:` 指令文法 + G2 作用域绑定(D5=F1, D6=G2)。
|
|
1049
|
+
*
|
|
1050
|
+
* 作用域契约(G2):函数级指令绑定 **AST 最近 Function** —— FunctionDeclaration /
|
|
1051
|
+
* VariableDeclarator 函数初始化 / FunctionExpression / ArrowFunctionExpression /
|
|
1052
|
+
* ClassMethod / ObjectMethod,含 nested function 与 class method。
|
|
1053
|
+
* 同一函数的 `@nudo:case` 与 `@nudo:contract` 必须同时可见(共用本模块的 scope 绑定)。
|
|
1054
|
+
*
|
|
1055
|
+
* 文法契约(前缀):`//` 与 `///` 等价;只认行注释与 JSDoc 块注释;
|
|
1056
|
+
* 字符串/模板/块注释正文里的同形文本不是指令。文件级(env / mock-module / import)
|
|
1057
|
+
* 不绑函数;其余标签绑最近 Function。
|
|
1058
|
+
*
|
|
1059
|
+
* 抽取单源:实现住在 core(parser 依赖 core,反向会成包环);`@nudojs/parser`
|
|
1060
|
+
* re-export 本模块的文本级 API 作为产品面。core refine / load-deps / check-case-scan
|
|
1061
|
+
* 与 nudojs CLI 只消费,不得再自带正则文法。
|
|
1062
|
+
*/
|
|
1063
|
+
|
|
1064
|
+
type FnDirectiveScope = {
|
|
1065
|
+
/** 绑定名:`f` / `C.m` / `default` / `<anonymous>` */
|
|
1066
|
+
name: string;
|
|
1067
|
+
node: Node;
|
|
1068
|
+
/** 该函数的前导注释块(comment.value 原文,文档序) */
|
|
1069
|
+
commentTexts: string[];
|
|
1070
|
+
/** commentTexts 清洗后的行 */
|
|
1071
|
+
commentLines: string[];
|
|
1072
|
+
/** 与 commentTexts 对齐的注释起始行号 */
|
|
1073
|
+
commentStartLines: number[];
|
|
1074
|
+
startLine: number;
|
|
1075
|
+
};
|
|
1076
|
+
/**
|
|
1077
|
+
* 全量 Function 站点:nested function、class method、object method 均可见。
|
|
1078
|
+
* 函数级指令绑「其前导注释块」;注释若带在非函数语句上则不绑(不留孤儿指令)。
|
|
1079
|
+
*/
|
|
1080
|
+
declare function listFnDirectiveScopes(file: File): FnDirectiveScope[];
|
|
1081
|
+
/** 按绑定名找函数 scope(文档序第一个命中) */
|
|
1082
|
+
declare function findFnDirectiveScope(file: File, fnName: string): FnDirectiveScope | undefined;
|
|
1083
|
+
/**
|
|
1084
|
+
* 源文本级函数前导指令行(refine / throws / budget 的消费口)。
|
|
1085
|
+
* 与 case 扫描共用同一 scope 绑定,保证 case+contract 同时可见。
|
|
1086
|
+
*/
|
|
1087
|
+
declare function fnDirectiveCommentLines(source: string, fnName: string): string[];
|
|
1088
|
+
/**
|
|
1089
|
+
* `@nudo:env` 载荷 → 命名 env token。只收 `\w+` 或 path-like
|
|
1090
|
+
* (拒绝 `node";` 这类截断捕获)。
|
|
1091
|
+
*/
|
|
1092
|
+
declare function parseEnvPayload(payload: string): string[];
|
|
1093
|
+
type MockModuleRecord = {
|
|
1094
|
+
source: string;
|
|
1095
|
+
names?: string[];
|
|
1096
|
+
fromPath: string;
|
|
1097
|
+
};
|
|
1098
|
+
/**
|
|
1099
|
+
* `@nudo:mock-module "src" [ { a, b } ] from "path"` 载荷解析。
|
|
1100
|
+
* 名表 `{ … }` 可选;单源文法(parser / load-deps 共用)。
|
|
1101
|
+
*/
|
|
1102
|
+
declare function parseMockModulePayload(payload: string): MockModuleRecord | undefined;
|
|
1103
|
+
type NudoImportRecord = {
|
|
1104
|
+
names: string[];
|
|
1105
|
+
spec: string;
|
|
1106
|
+
};
|
|
1107
|
+
/**
|
|
1108
|
+
* `@nudo:import` 载荷:named `{ a, b as c }` / namespace `* as ns`。
|
|
1109
|
+
* default 等未识别形态返回 `malformed`(由消费方发诊断)。
|
|
1110
|
+
*/
|
|
1111
|
+
declare function parseNudoImportPayload(payload: string): NudoImportRecord | "malformed-default" | "malformed" | undefined;
|
|
1112
|
+
declare function extractFileEnvNames(source: string): string[];
|
|
1113
|
+
declare function extractMockModuleRecords(source: string): MockModuleRecord[];
|
|
1114
|
+
/** `@nudo:import` 命名/namespace 记录(refine 与 load-deps 共用单源) */
|
|
1115
|
+
declare function extractNudoImportRecords(source: string): NudoImportRecord[];
|
|
1116
|
+
/**
|
|
1117
|
+
* 平衡括号摘取(字符串感知;`\` 不是转义——与 case 实参原样 slice 一致)。
|
|
1118
|
+
* 返回括号内文本;无平衡括号 → null。
|
|
1119
|
+
*/
|
|
1120
|
+
declare function extractBalancedParens(text: string, startIdx: number): string | null;
|
|
1121
|
+
type CaseTag = {
|
|
1122
|
+
name: string;
|
|
1123
|
+
/** 括号内实参原文(未清洗续行 `*`) */
|
|
1124
|
+
argsText: string;
|
|
1125
|
+
/** `=> expected` 表达式原文(同行/续行 `=>`) */
|
|
1126
|
+
expectedText?: string;
|
|
1127
|
+
/** 标签在 comment.value 中的下标 */
|
|
1128
|
+
tagOffset: number;
|
|
1129
|
+
};
|
|
1130
|
+
/**
|
|
1131
|
+
* `@nudo:case` 标签扫描(单源):多行实参、实参区间遮罩、`=> expected`。
|
|
1132
|
+
* 供 parser(Abs 解释)与 check-case-scan(见证检查)共用。
|
|
1133
|
+
* 非法名形态由消费方用 `scanMalformedCaseTagRests` 诊断。
|
|
1134
|
+
*/
|
|
1135
|
+
declare function scanCaseTags(text: string): CaseTag[];
|
|
1136
|
+
/** case 实参区间(供其它标签做遮罩) */
|
|
1137
|
+
declare function scanCaseArgSpans(text: string): [number, number][];
|
|
1138
|
+
/**
|
|
1139
|
+
* `@nudo:contract <param> <name>` / `@nudo:contract return <name>` 行。
|
|
1140
|
+
* 支持 `&&` / 逗号连接的多段;返回原始段文本。
|
|
1141
|
+
*/
|
|
1142
|
+
declare function scanContractSegments(lines: string[]): string[];
|
|
1143
|
+
/**
|
|
1144
|
+
* `@nudo:throws …` / case 行 `!! throws …`。
|
|
1145
|
+
* 返回 `*` = 申报任意;字符串 = 逗号/空白分隔的 kind 列表;undefined = 无申报。
|
|
1146
|
+
*/
|
|
1147
|
+
declare function scanThrowsDecl(lines: string[]): string | undefined;
|
|
1148
|
+
/** `@nudo:budget forks=… calls=… depth=…` → 声明的维度 */
|
|
1149
|
+
declare function scanBudgetDecl(lines: string[]): {
|
|
1150
|
+
forks?: number;
|
|
1151
|
+
calls?: number;
|
|
1152
|
+
depth?: number;
|
|
1153
|
+
} | undefined;
|
|
1154
|
+
|
|
1160
1155
|
/**
|
|
1161
1156
|
* 字面量域隶属判定(Phase 1)。
|
|
1162
1157
|
*
|
|
@@ -1164,7 +1159,7 @@ declare function checkSource(filePath: string, source: string, phi?: Phi, opts?:
|
|
|
1164
1159
|
* NudoConstraint 表达的域内。只覆盖可判定的标量子集:
|
|
1165
1160
|
*
|
|
1166
1161
|
* - prim 门(prim 缺失或不匹配字面量类型 → false)
|
|
1167
|
-
* - eq(self, lit v) 字面量等值(
|
|
1162
|
+
* - eq(self, lit v) 字面量等值(SameValue:含 undefined/NaN;与 leq 同口径)
|
|
1168
1163
|
* - gt/ge/lt/le 数值常数界(self op n)
|
|
1169
1164
|
* - 字符串长度界(length(self) op n,即 min/max/length 链)
|
|
1170
1165
|
* - int(整数性)
|
|
@@ -1175,7 +1170,7 @@ declare function checkSource(filePath: string, source: string, phi?: Phi, opts?:
|
|
|
1175
1170
|
*/
|
|
1176
1171
|
|
|
1177
1172
|
/** 字面量 lv 是否落在约束 c 表达的域内(保守:判不了 → false)。 */
|
|
1178
|
-
declare function literalMeetsConstraint(lv: number | string | boolean | null, c: NudoConstraint): boolean;
|
|
1173
|
+
declare function literalMeetsConstraint(lv: number | string | boolean | null | undefined, c: NudoConstraint): boolean;
|
|
1179
1174
|
|
|
1180
1175
|
/**
|
|
1181
1176
|
* Abs → NudoConstraint 投影(Phase 1,interface 分层推导的生成侧半边)。
|
|
@@ -1215,4 +1210,4 @@ declare function absToConstraint(a: Abs): NudoConstraint | undefined;
|
|
|
1215
1210
|
*/
|
|
1216
1211
|
declare function joinThenProject(absList: Abs[]): NudoConstraint | undefined;
|
|
1217
1212
|
|
|
1218
|
-
export { Abs, type AbsAssignRecord, type AbsCallRecord,
|
|
1213
|
+
export { Abs, type AbsAssignRecord, type AbsCallRecord, AbsModuleExports, AstEnv, type CaseTag, type CheckOptions, CheckReport, Confidence, EffectiveInterfaceOpts, type Environment, type ExtState, type FnAbs, type FnDirectiveScope, type FormalParam, type FormatOptions, HofCollectCtx, HofSite, type LeqResult, type MockHelper, type MockModuleRecord, NudoConstraint, type NudoImportRecord, OBJECT_PROTO_METHOD_NAMES, type ObjShape, Phi, type PolyFn, Pred, type PropFlags, RelSource, RunTranspiledOptions, Shape, type Slot, Term, type TypeParam, absShapeKey, absToConstraint, add, alphaOf, applyCallbackAbs, applyCallbackValue, asAbs, assignSourceSlots, beginCollectionFork, betaOf, bitandAbs, bitnotAbs, bitorAbs, bitxorAbs, buildArgsFromAssume, builtinCtorAbs, builtinCtorNameOf, callAbsMethod, canonicalArrayIndex, checkSource, clearCollectionTables, cmp, collectAbsFreeVars, collectionElementJoin, collectionExactLen, contractParamNameSet, createEnvironment, createHofCollectCtx, ctorArgDefinitelyInvalid, ctorNameOfRecv, currentPhi, definitelyNotNullishShape, describePhi, div, emptyEnv, endCollectionFork, errorBrandAbs, evalArrayStatic, evalBuiltinInstanceMethod, evalBuiltinNew, evalDateCtor, evalDateMethod, evalDateStatic, evalGlobalFn, evalJsonMethod, evalMathMethod, evalNamespaceCall, evalNumberStatic, evalObjectMethod, evalObjectProtoMethod, evalRegExpCtor, evalRegExpMethod, evalStringStatic, evalSymbolCtor, evictCheckSourceMemoForPaths, evictGeneralizeMemoForPaths, extStateOf, extractBalancedParens, extractFileEnvNames, extractFn, extractMockModuleRecords, extractNudoImportRecords, falseConstraint, findFnDirectiveScope, fnDirectiveCommentLines, fnOf, formalParamDisplayNames, formalParamSignatureNames, formalParamsFromNodes, formatAbs, formatAbsMultiline, formatShape, formatShapeSlot, generalizeAll, generalizeFromAst, getAbsProperty, getGeneralizeMemoSize, getPropFlags, getSlot, hostBuiltinCtorName, instantiateReturn, isErrorCtorName, isMapAbs, isNullProtoObj, isNullishLitAbs, isObj, isObjectProtoBrand, isRelFn, isSetAbs, isSymbolAbs, joinAbs, joinFunctions, joinObjects, joinThenProject, joinValues, leqAbs, listFnDirectiveScopes, listFunctionNames, literalMeetsConstraint, locateContractParam, looseEqAbs, makeArrayCtorAbs, makeMapAbs, makeSetAbs, makeSum, makeSymbolAbs, mapClearEntries, mapDeleteEntry, mapElementFallback, mapEntriesAbs, mapGetEntry, mapHasEntry, mapSetEntry, mapSizeAbs, mapValuesAbs, markExtState, markNullProtoObj, matchRelIdentLit, mergeCollectionArms, migrateInvariants, migrateNullProto, mock, mod, mul, negAbs, notAbs, noteCollectionWrite, objOf, objectProtoBrand, objectProtoMethodAbs, parseEnvPayload, parseMockModulePayload, parseNudoImportPayload, parseSource, popCollectionArm, popPhi, powAbs, projectFlatMapResult, promoteParamShape, propertyKeyOf, protoBrandAbs, protoOfRecv, pushCollectionArm, pushPhi, refineAbsForRelTrue, regexBrandAbsFrom, requiredFnArity, resetCheckSourceMemo, resetGeneralizeMemo, resetPhi, scanBudgetDecl, scanCaseArgSpans, scanCaseTags, scanContractSegments, scanThrowsDecl, setAddEntry, setApplyCallbackHost, setClearEntries, setDeleteEntry, setElementsAbs, setHasEntry, setPropFlags, setSizeAbs, shlAbs, shrAbs, snapshotAbs, spread, spy, strictEqAbs, stringOfSymbol, stripTypes, stub, sub, substAbs, substPredAbs, symbolDescriptionAbs, symbolIdOf, toNumberAbs, trueConstraint, tryMakeRegexAbs, tryPromoteDirectCall, tryPromoteForOfIteratee, tryPromoteHofCallback, tryPromoteReceiverAsArr, typeofAbs, undefAbs, ushrAbs, withPhiConstraint, withVar };
|