@nudojs/core 0.4.0 → 1.0.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/{chunk-N7E2A7IK.js → chunk-P3G2TODS.js} +760 -296
- package/dist/exec.d.ts +1 -1
- package/dist/exec.js +1 -1
- package/dist/{index-DgyudAkw.d.ts → index-FITqyJ8v.d.ts} +22 -172
- package/dist/index.d.ts +727 -236
- package/dist/index.js +3788 -2676
- package/package.json +14 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,193 +1,44 @@
|
|
|
1
|
+
import { A as Abs, P as Phi, a as AstEnv, C as Confidence, b as Pred, S as Shape, T as Term, c as AbsModuleExports, d as PrimName, R as RelSource, H as HofSite } from './index-FITqyJ8v.js';
|
|
2
|
+
export { $ as $add, e as $arr, f as $async, g as $asyncReturn, h as $await, i as $call, j as $callNamed, k as $catchVal, l as $class, m as $concat, n as $div, o as $elems, p as $eq, q as $fnVal, r as $for, s as $forIter, t as $forOf, u as $fork, v as $ge, w as $gen, x as $get, y as $gt, z as $idx, B as $idxSet, D as $invoke, E as $invokeSuper, F as $join, G as $le, I as $len, J as $lit, K as $lt, L as $mod, M as $mul, N as $ne, O as $neg, Q as $new, U as $not, V as $obj, W as $optionalGet, X as $optionalInvoke, Y as $orDefault, Z as $regex, _ as $set, a0 as $setKey, a1 as $spread, a2 as $staticInvoke, a3 as $sub, a4 as $super, a5 as $switch, a6 as $thisGet, a7 as $thisSet, a8 as $throw, a9 as $typeof, aa as $while, ab as $whileSeq, ac as $yield, ad as BCallRecord, ae as BClassSpec, af as BMemberDiag, ag as DEFAULT_MAX_LOOP_ITERS, ah as HofCollectCtx, ai as LiteralValue, aj as NudoThrow, ak as RunTranspiledOptions, al as TranspileOptions, am as TranspiledCallResult, an as abs, ao as absToString, ap as alphaOf, aq as and, ar as anyVar, as as app, at as applyCallbackAbs, au as asAbs, av as asAbsVal, aw as betaOf, ax as bindImports, ay as bool, az as boolLit, aA as callTranspiledExport, aB as callTranspiledExportFull, aC as clearBClasses, aD as collectAbsExports, aE as confJoin, aF as createHofCollectCtx, aG as currentExecPhi, aH as emptyPhi, aI as eq, aJ as ge, aK as geNum, aL as getAbsOrigin, aM as getBCallCollector, aN as getBClass, aO as gt, aP as gtNum, aQ as implies, aR as instantiateReturn, aS as isDefinitelyFalse, aT as isDefinitelyTrue, aU as isExactLit, aV as isNudoThrow, aW as isNumPrim, aX as isRelFn, aY as isStrPrim, aZ as le, a_ as leNum, a$ as lit, b0 as litTruth, b1 as litValue, b2 as lt, b3 as ltNum, b4 as mapElementFallback, b5 as namespaceNameOf, b6 as ne, b7 as never, b8 as not, b9 as noteMemberDispatchMiss, ba as notePrimMemberMissing, bb as noteUnknownMemberMissing, bc as num, bd as numLit, be as numVar, bf as obj, bg as or, bh as pFalse, bi as pTrue, bj as phiAnd, bk as predEquals, bl as predToString, bm as predVars, bn as projectFlatMapResult, bo as promoteParamShape, bp as ptypeof, bq as recordMemberDiag, br as registerBClass, bs as runTranspiled, bt as setApplyCallbackHost, bu as setBCallCollector, bv as setMemberDiagCollector, bw as shapeOfTerm, bx as shapeToString, by as simplifyTerm, bz as snapshotAbs, bA as str, bB as strLit, bC as substAbs, bD as substPred, bE as substPredAbs, bF as tagAbsOrigin, bG as termEquals, bH as termToString, bI as transpile, bJ as transpileExpression, bK as transpileFile, bL as transpileSource, bM as tryPromoteDirectCall, bN as tryPromoteForOfIteratee, bO as tryPromoteHofCallback, bP as tryPromoteReceiverAsArr, bQ as undefAbs, bR as unknown, bS as v, bT as withExecPhi } from './index-FITqyJ8v.js';
|
|
1
3
|
import { Node, File } from '@babel/types';
|
|
2
|
-
import { P as Phi, A as AstEnv, a as Abs, C as Confidence, b as Pred, S as Shape, c as PrimName, T as Term, R as RelSource, H as HofSite, L as LeakBudget } from './index-DgyudAkw.js';
|
|
3
|
-
export { $ as $add, d as $arr, e as $async, f as $asyncReturn, g as $await, h as $call, i as $callNamed, j as $catchVal, k as $class, l as $concat, m as $div, n as $elems, o as $eq, p as $fnVal, q as $for, r as $forIter, s as $forOf, t as $fork, u as $ge, v as $gen, w as $get, x as $gt, y as $idx, z as $idxSet, B as $invoke, D as $invokeSuper, E as $join, F as $le, G as $len, I as $lit, J as $lt, K as $mod, M as $mul, N as $ne, O as $neg, Q as $new, U as $not, V as $obj, W as $optionalGet, X as $optionalInvoke, Y as $orDefault, Z as $regex, _ as $set, a0 as $setKey, a1 as $spread, a2 as $staticInvoke, a3 as $sub, a4 as $super, a5 as $switch, a6 as $thisGet, a7 as $thisSet, a8 as $throw, a9 as $typeof, aa as $while, ab as $whileSeq, ac as $yield, ad as AbsAssignRecord, ae as AbsCallRecord, af as AbsModuleExports, ag as BCallRecord, ah as BClassSpec, ai as BMemberDiag, aj as DEFAULT_MAX_LOOP_ITERS, ak as EvalOptions, al as EvalResult, am as HofCollectCtx, an as MAX_CALL_DEPTH, ao as MAX_TOTAL_CALLS, ap as NudoThrow, aq as RunTranspiledOptions, ar as TranspileOptions, as as TranspiledCallResult, at as abs, au as absToString, av as alphaOf, aw as analyzeFn, ax as and, ay as anyVar, az as app, aA as applyAbsFn, aB as applyCallbackAbs, aC as asAbs, aD as asAbsVal, aE as betaOf, aF as bindImports, aG as bool, aH as boolLit, aI as callFunction, aJ as callTranspiledExport, aK as callTranspiledExportFull, aL as clearBClasses, aM as collectAbsExports, aN as collectAbsNodeTypes, aO as confJoin, aP as createHofCollectCtx, aQ as currentExecPhi, aR as defaultLeakBudget, aS as emptyEnv, aT as emptyPhi, aU as eq, aV as evalMethodBody, aW as evalNode, aX as evalProgramAbs, aY as evalSource, aZ as exceedsBudget, a_ as findAbsAtPosition, a$ as ge, b0 as geNum, b1 as getAbsOrigin, b2 as getBCallCollector, b3 as getBClass, b4 as gt, b5 as gtNum, b6 as implies, b7 as instantiateReturn, b8 as isDefinitelyFalse, b9 as isDefinitelyTrue, ba as isExactLit, bb as isNudoThrow, bc as isNumPrim, bd as isRelFn, be as isStrPrim, bf as le, bg as leNum, bh as leakIfNeeded, bi as lit, bj as litTruth, bk as litValue, bl as lt, bm as ltNum, bn as mapElementFallback, bo as maybeLeak, bp as namespaceNameOf, bq as ne, br as never, bs as not, bt as noteMemberDispatchMiss, bu as notePrimMemberMissing, bv as noteUnknownMemberMissing, bw as num, bx as numLit, by as numVar, bz as obj, bA as or, bB as pFalse, bC as pTrue, bD as phiAnd, bE as predEquals, bF as predToString, bG as predVars, bH as projectFlatMapResult, bI as promoteParamShape, bJ as ptypeof, bK as recordMemberDiag, bL as registerBClass, bM as resetAbsCallBudget, bN as resetLeakCounter, bO as runTranspiled, bP as setAbsAssignCollector, bQ as setAbsCallCollector, bR as setAbsNodeCollector, bS as setAbsTruncationCollector, bT as setApplyCallbackHost, bU as setBCallCollector, bV as setMemberDiagCollector, bW as shapeOfTerm, bX as shapeToString, bY as simplifyTerm, bZ as snapshotAbs, b_ as str, b$ as strLit, c0 as substAbs, c1 as substPred, c2 as substPredAbs, c3 as tagAbsOrigin, c4 as termDepth, c5 as termEquals, c6 as termNodes, c7 as termToString, c8 as transpile, c9 as transpileExpression, ca as transpileFile, cb as transpileSource, cc as tryPromoteDirectCall, cd as tryPromoteForOfIteratee, ce as tryPromoteHofCallback, cf as tryPromoteReceiverAsArr, cg as undefAbs, ch as unknown, ci as v, cj as withExecPhi, ck as withVar } from './index-DgyudAkw.js';
|
|
4
4
|
|
|
5
5
|
type Environment = {
|
|
6
|
-
lookup(name: string):
|
|
7
|
-
bind(name: string, value:
|
|
8
|
-
update(name: string, value:
|
|
9
|
-
extend(bindings: Record<string,
|
|
6
|
+
lookup(name: string): Abs;
|
|
7
|
+
bind(name: string, value: Abs): Environment;
|
|
8
|
+
update(name: string, value: Abs): boolean;
|
|
9
|
+
extend(bindings: Record<string, Abs>): Environment;
|
|
10
10
|
fork(): Environment;
|
|
11
11
|
has(name: string): boolean;
|
|
12
12
|
snapshot(): Environment;
|
|
13
|
-
getOwnBindings(): Record<string,
|
|
13
|
+
getOwnBindings(): Record<string, Abs>;
|
|
14
14
|
};
|
|
15
|
-
declare function createEnvironment(parent?: Environment, bindings?: Map<string,
|
|
16
|
-
|
|
17
|
-
type LiteralValue = string | number | boolean | bigint | null | undefined;
|
|
18
|
-
type SigImpl = (args: TypeValue[], thisVal?: TypeValue) => TypeValue | undefined;
|
|
19
|
-
type FunctionSignature = {
|
|
20
|
-
paramTypes: TypeValue[];
|
|
21
|
-
returnType: TypeValue;
|
|
22
|
-
throwsType: TypeValue;
|
|
23
|
-
impl?: SigImpl;
|
|
24
|
-
};
|
|
25
|
-
type Refinement = {
|
|
26
|
-
name: string;
|
|
27
|
-
meta: Record<string, unknown>;
|
|
28
|
-
check?: (value: unknown) => boolean;
|
|
29
|
-
ops?: Record<string, (self: TypeValue, other: TypeValue) => TypeValue | undefined>;
|
|
30
|
-
methods?: Record<string, (self: TypeValue, args: TypeValue[]) => TypeValue | undefined>;
|
|
31
|
-
properties?: Record<string, (self: TypeValue) => TypeValue | undefined>;
|
|
32
|
-
};
|
|
33
|
-
type TypeValue = {
|
|
34
|
-
kind: "literal";
|
|
35
|
-
value: LiteralValue;
|
|
36
|
-
} | {
|
|
37
|
-
kind: "primitive";
|
|
38
|
-
type: "number" | "string" | "boolean" | "bigint" | "symbol";
|
|
39
|
-
} | {
|
|
40
|
-
kind: "refined";
|
|
41
|
-
base: TypeValue;
|
|
42
|
-
refinement: Refinement;
|
|
43
|
-
} | {
|
|
44
|
-
kind: "object";
|
|
45
|
-
properties: Record<string, TypeValue>;
|
|
46
|
-
id: symbol;
|
|
47
|
-
} | {
|
|
48
|
-
kind: "array";
|
|
49
|
-
element: TypeValue;
|
|
50
|
-
} | {
|
|
51
|
-
kind: "tuple";
|
|
52
|
-
elements: TypeValue[];
|
|
53
|
-
} | {
|
|
54
|
-
kind: "function";
|
|
55
|
-
params: string[];
|
|
56
|
-
body: Node;
|
|
57
|
-
closure: Environment;
|
|
58
|
-
} | {
|
|
59
|
-
kind: "promise";
|
|
60
|
-
value: TypeValue;
|
|
61
|
-
} | {
|
|
62
|
-
kind: "instance";
|
|
63
|
-
className: string;
|
|
64
|
-
properties: Record<string, TypeValue>;
|
|
65
|
-
} | {
|
|
66
|
-
kind: "union";
|
|
67
|
-
members: TypeValue[];
|
|
68
|
-
} | {
|
|
69
|
-
kind: "never";
|
|
70
|
-
} | {
|
|
71
|
-
kind: "unknown";
|
|
72
|
-
};
|
|
73
|
-
declare function createUnion(...members: TypeValue[]): TypeValue;
|
|
74
|
-
declare const T: {
|
|
75
|
-
readonly literal: (value: LiteralValue) => TypeValue;
|
|
76
|
-
readonly number: TypeValue;
|
|
77
|
-
readonly string: TypeValue;
|
|
78
|
-
readonly boolean: TypeValue;
|
|
79
|
-
readonly bigint: TypeValue;
|
|
80
|
-
readonly symbol: TypeValue;
|
|
81
|
-
readonly null: TypeValue;
|
|
82
|
-
readonly undefined: TypeValue;
|
|
83
|
-
readonly unknown: TypeValue;
|
|
84
|
-
readonly never: TypeValue;
|
|
85
|
-
readonly object: (properties: Record<string, TypeValue>) => TypeValue;
|
|
86
|
-
readonly array: (element: TypeValue) => TypeValue;
|
|
87
|
-
readonly tuple: (elements: TypeValue[]) => TypeValue;
|
|
88
|
-
readonly promise: (value: TypeValue) => TypeValue;
|
|
89
|
-
readonly instanceOf: (className: string, properties?: Record<string, TypeValue>) => TypeValue;
|
|
90
|
-
readonly union: typeof createUnion;
|
|
91
|
-
readonly fn: (params: string[], body: Node, closure: Environment) => TypeValue;
|
|
92
|
-
readonly refine: (base: TypeValue, refinement: Refinement) => TypeValue;
|
|
93
|
-
readonly fnSig: (paramTypes: TypeValue[], returnType: TypeValue, throwsType?: TypeValue, impl?: SigImpl) => TypeValue;
|
|
94
|
-
};
|
|
95
|
-
declare function typeValueEquals(a: TypeValue, b: TypeValue): boolean;
|
|
96
|
-
declare function simplifyUnion(members: TypeValue[]): TypeValue;
|
|
97
|
-
declare function widenLiteral(tv: TypeValue): TypeValue;
|
|
98
|
-
/**
|
|
99
|
-
* union 成员全部为同原语基底的字面量且数量 > maxLiterals 时塌缩为该基类型;
|
|
100
|
-
* 非 union、混合类型、或数量不超限的原样返回。
|
|
101
|
-
*
|
|
102
|
-
* 复用 simplifyUnion(内含吸收律与去重):先让「基类型已在场」的字面量被吸收
|
|
103
|
-
* (3 | number → number),再对剩余的纯字面量联合做阈值坍缩(1|2|…|20 → number)。
|
|
104
|
-
* 两步不冲突也不重复:吸收只删基类型已在场的字面量,阈值坍缩只处理无基类型
|
|
105
|
-
* 在场的纯字面量联合。
|
|
106
|
-
*/
|
|
107
|
-
declare function collapseLiteralUnion(tv: TypeValue, maxLiterals: number): TypeValue;
|
|
108
|
-
declare function isSubtypeOf(a: TypeValue, b: TypeValue): boolean;
|
|
109
|
-
declare function deepCloneTypeValue(tv: TypeValue, idMap?: Map<symbol, symbol>): TypeValue;
|
|
110
|
-
declare function mergeObjectProperties(a: TypeValue & {
|
|
111
|
-
kind: "object";
|
|
112
|
-
}, b: TypeValue & {
|
|
113
|
-
kind: "object";
|
|
114
|
-
}): TypeValue;
|
|
115
|
-
declare function typeValueToString(tv: TypeValue): string;
|
|
116
|
-
declare function narrowType(tv: TypeValue, predicate: (member: TypeValue) => boolean): TypeValue;
|
|
117
|
-
declare function subtractType(tv: TypeValue, predicate: (member: TypeValue) => boolean): TypeValue;
|
|
118
|
-
declare function getPrimitiveTypeOf(tv: TypeValue): string | undefined;
|
|
119
|
-
declare function getRefinedBase(tv: TypeValue): TypeValue;
|
|
120
|
-
declare function isFnSig(tv: TypeValue): boolean;
|
|
121
|
-
declare function getFnSig(tv: TypeValue): FunctionSignature | undefined;
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* 残差 IR 兜底(不是类型运算真理源)。
|
|
125
|
-
*
|
|
126
|
-
* 真理在 algebra:算术/比较/相等/typeof/!/−/字符串词法序/nullish 均走 Abs。
|
|
127
|
-
* 这里只保留:
|
|
128
|
-
* - add:代数拒绝时的混合 `+`
|
|
129
|
-
* - 比较/相等:代数无法判定时的保守 boolean / 字面量折叠
|
|
130
|
-
* - dispatchMethod/Property:宿主 refined 扩展(startsWith、length…)
|
|
131
|
-
*/
|
|
132
|
-
|
|
133
|
-
declare const Ops: {
|
|
134
|
-
readonly add: (left: TypeValue, right: TypeValue) => TypeValue;
|
|
135
|
-
readonly strictEq: (left: TypeValue, right: TypeValue) => TypeValue;
|
|
136
|
-
readonly strictNeq: (left: TypeValue, right: TypeValue) => TypeValue;
|
|
137
|
-
readonly gt: (left: TypeValue, right: TypeValue) => TypeValue;
|
|
138
|
-
readonly lt: (left: TypeValue, right: TypeValue) => TypeValue;
|
|
139
|
-
readonly gte: (left: TypeValue, right: TypeValue) => TypeValue;
|
|
140
|
-
readonly lte: (left: TypeValue, right: TypeValue) => TypeValue;
|
|
141
|
-
readonly not: (operand: TypeValue) => TypeValue;
|
|
142
|
-
};
|
|
143
|
-
declare function applyBinaryOp(op: string, left: TypeValue, right: TypeValue): TypeValue;
|
|
144
|
-
declare function dispatchBinaryOp(op: string, left: TypeValue, right: TypeValue): TypeValue;
|
|
145
|
-
declare function dispatchMethod(receiver: TypeValue, name: string, args: TypeValue[]): TypeValue | undefined;
|
|
146
|
-
declare function dispatchProperty(receiver: TypeValue, name: string): TypeValue | undefined;
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* 模板字面量谓词,独立于 template.ts 以断开运行时循环引用:
|
|
150
|
-
* type-value.ts(联合吸收律)与 template.ts 都依赖本模块,而本模块对
|
|
151
|
-
* type-value.ts 只有 `import type` 边(编译后消失),运行时依赖保持单向
|
|
152
|
-
* type-value.ts / template.ts -> template-predicates.ts。
|
|
153
|
-
*/
|
|
154
|
-
declare function isTemplate(tv: TypeValue): boolean;
|
|
155
|
-
|
|
156
|
-
declare function getKnownPrefix(parts: TypeValue[]): string;
|
|
157
|
-
declare function getKnownSuffix(parts: TypeValue[]): string;
|
|
158
|
-
declare function createTemplate(parts: TypeValue[]): TypeValue;
|
|
159
|
-
|
|
160
|
-
declare function getTemplateParts(tv: TypeValue): TypeValue[] | undefined;
|
|
161
|
-
declare function concatTemplates(left: TypeValue, right: TypeValue): TypeValue;
|
|
162
|
-
|
|
163
|
-
type RangeMeta = {
|
|
164
|
-
min?: number;
|
|
165
|
-
max?: number;
|
|
166
|
-
integer?: boolean;
|
|
167
|
-
};
|
|
168
|
-
declare function createRange(meta: RangeMeta): TypeValue;
|
|
169
|
-
declare function isRange(tv: TypeValue): boolean;
|
|
170
|
-
declare function getRangeMeta(tv: TypeValue): RangeMeta | undefined;
|
|
15
|
+
declare function createEnvironment(parent?: Environment, bindings?: Map<string, Abs>): Environment;
|
|
171
16
|
|
|
172
17
|
/**
|
|
173
18
|
* Nudo Mock 帮助函数
|
|
174
19
|
*
|
|
175
|
-
* 提供类型安全的 mock 创建,替代 sinon
|
|
20
|
+
* 提供类型安全的 mock 创建,替代 sinon 表达式。
|
|
21
|
+
* 值字段为 Abs(类型系统真理源)。
|
|
22
|
+
* Abs 路径经 mock-abs.ts / mockDirectivesToAbsSeeds 消费。
|
|
176
23
|
*/
|
|
177
24
|
|
|
178
25
|
type MockHelper = {
|
|
179
26
|
kind: "mock-helper";
|
|
180
|
-
returnValue?:
|
|
181
|
-
resolvedValue?:
|
|
182
|
-
rejectedValue?:
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
onSecondCallValue?: TypeValue;
|
|
27
|
+
returnValue?: Abs;
|
|
28
|
+
resolvedValue?: Abs;
|
|
29
|
+
rejectedValue?: Abs;
|
|
30
|
+
onFirstCallValue?: Abs;
|
|
31
|
+
onSecondCallValue?: Abs;
|
|
186
32
|
withArgsCases?: {
|
|
187
|
-
args:
|
|
188
|
-
returnValue:
|
|
33
|
+
args: Abs[];
|
|
34
|
+
returnValue: Abs;
|
|
189
35
|
}[];
|
|
190
|
-
|
|
36
|
+
/** callsFake 的函数体(AST);params 同步存下供 Abs absFunction */
|
|
37
|
+
callsFakeImpl?: {
|
|
38
|
+
params: string[];
|
|
39
|
+
body: Node;
|
|
40
|
+
async?: boolean;
|
|
41
|
+
};
|
|
191
42
|
};
|
|
192
43
|
/**
|
|
193
44
|
* 创建一个 stub mock
|
|
@@ -195,13 +46,17 @@ type MockHelper = {
|
|
|
195
46
|
*/
|
|
196
47
|
declare function stub(): MockHelper;
|
|
197
48
|
declare namespace stub {
|
|
198
|
-
var returns: (value:
|
|
199
|
-
var resolves: (value:
|
|
200
|
-
var rejects: (value:
|
|
201
|
-
var onFirstCall: (value:
|
|
202
|
-
var onSecondCall: (value:
|
|
203
|
-
var withArgs: (...args:
|
|
204
|
-
var callsFake: (fn:
|
|
49
|
+
var returns: (value: Abs) => MockHelper;
|
|
50
|
+
var resolves: (value: Abs) => MockHelper;
|
|
51
|
+
var rejects: (value: Abs) => MockHelper;
|
|
52
|
+
var onFirstCall: (value: Abs) => MockHelper;
|
|
53
|
+
var onSecondCall: (value: Abs) => MockHelper;
|
|
54
|
+
var withArgs: (...args: Abs[]) => MockHelper;
|
|
55
|
+
var callsFake: (fn: {
|
|
56
|
+
params: string[];
|
|
57
|
+
body: Node;
|
|
58
|
+
async?: boolean;
|
|
59
|
+
}) => MockHelper;
|
|
205
60
|
}
|
|
206
61
|
/**
|
|
207
62
|
* 创建一个 spy mock
|
|
@@ -209,17 +64,13 @@ declare namespace stub {
|
|
|
209
64
|
*/
|
|
210
65
|
declare function spy(): MockHelper;
|
|
211
66
|
declare namespace spy {
|
|
212
|
-
var returns: (value:
|
|
67
|
+
var returns: (value: Abs) => MockHelper;
|
|
213
68
|
}
|
|
214
69
|
/**
|
|
215
70
|
* 创建一个 mock
|
|
216
71
|
* 用法: @nudo:mock service = mock()
|
|
217
72
|
*/
|
|
218
73
|
declare function mock(): MockHelper;
|
|
219
|
-
/**
|
|
220
|
-
* 将 MockHelper 转换为 TypeValue
|
|
221
|
-
*/
|
|
222
|
-
declare function mockHelperToTypeValue(helper: MockHelper, env: Environment): TypeValue;
|
|
223
74
|
|
|
224
75
|
/**
|
|
225
76
|
* 原地剥除 AST 中的 TS-only 语法节点/字段,返回同一棵 AST(便于链式使用)。
|
|
@@ -231,6 +82,7 @@ declare function resetParseSourceCache(): void;
|
|
|
231
82
|
declare function getParseSourceCacheSize(): number;
|
|
232
83
|
declare function parseSource(source: string, opts?: {
|
|
233
84
|
errorRecovery?: boolean;
|
|
85
|
+
keepTs?: boolean;
|
|
234
86
|
}): File;
|
|
235
87
|
|
|
236
88
|
/**
|
|
@@ -253,6 +105,8 @@ declare function describePhi(): string;
|
|
|
253
105
|
* 与 term-registry 同一纪律:不给共享单例挂 impl。
|
|
254
106
|
*/
|
|
255
107
|
|
|
108
|
+
/** Abs 原生 env/builtin 实现(B-path 优先) */
|
|
109
|
+
type AbsSigImpl = (args: Abs[], thisVal?: Abs) => Abs | undefined;
|
|
256
110
|
type AbsFnImpl = {
|
|
257
111
|
params: string[];
|
|
258
112
|
/** 可选:无 body 时走 relation(纯关系 fn) */
|
|
@@ -321,21 +175,6 @@ declare function shapeOnlyFn(paramTypes: Abs[], returnType: Abs, opts?: {
|
|
|
321
175
|
* 无契约的 score(x){return x+1}:score("x") 合法,不得钉成 number。
|
|
322
176
|
*/
|
|
323
177
|
declare function add(a: Abs, b: Abs, phi?: Phi): Abs;
|
|
324
|
-
type NumBounds = {
|
|
325
|
-
lo?: {
|
|
326
|
-
value: number;
|
|
327
|
-
strict: boolean;
|
|
328
|
-
};
|
|
329
|
-
hi?: {
|
|
330
|
-
value: number;
|
|
331
|
-
strict: boolean;
|
|
332
|
-
};
|
|
333
|
-
};
|
|
334
|
-
/**
|
|
335
|
-
* 提取 Abs 上相对 term 的数值界。
|
|
336
|
-
* 优先用自身 pred;否则查 Φ(针对 var id)。
|
|
337
|
-
*/
|
|
338
|
-
declare function numericBounds(a: Abs, phi?: Phi): NumBounds | undefined;
|
|
339
178
|
/** 减法:a - b = a + (-b),数值上做单调性 */
|
|
340
179
|
declare function sub(a: Abs, b: Abs, phi?: Phi): Abs;
|
|
341
180
|
/** 乘法:字面量直接求值;×正数同向缩放;×负数翻转不等式;×0 归零 */
|
|
@@ -354,6 +193,21 @@ declare function mod(a: Abs, b: Abs, phi?: Phi): Abs;
|
|
|
354
193
|
declare function cmp(op: "lt" | "le" | "gt" | "ge" | "eq" | "ne", a: Abs, b: Abs, phi?: Phi): Abs;
|
|
355
194
|
/** 从比较结果 Abs 提取「若为真」的额外约束(供 if 使用) */
|
|
356
195
|
declare function trueConstraint(c: Abs): Pred | undefined;
|
|
196
|
+
/**
|
|
197
|
+
* 关系比较为真时收窄操作数 shape。
|
|
198
|
+
* `x > k` 对 any:JS 只允许 number(n>k)或数字字符串(ToNumber(s)>k)。
|
|
199
|
+
* 粗化展示为 `number>… | string`;string 臂不挂 ToNumber pred(Pred 无该构造)。
|
|
200
|
+
*/
|
|
201
|
+
declare function refineAbsForRelTrue(a: Abs, op: "gt" | "ge" | "lt" | "le", k: number): Abs;
|
|
202
|
+
/**
|
|
203
|
+
* 从 Identifier 在比较中的位置解析「对哪个变量、用哪个关系」。
|
|
204
|
+
* 支持 `x > 3` 与 `3 < x`(后者关系翻转)。
|
|
205
|
+
*/
|
|
206
|
+
declare function matchRelIdentLit(test: unknown): {
|
|
207
|
+
name: string;
|
|
208
|
+
op: "gt" | "ge" | "lt" | "le";
|
|
209
|
+
k: number;
|
|
210
|
+
} | undefined;
|
|
357
211
|
declare function falseConstraint(c: Abs): Pred | undefined;
|
|
358
212
|
|
|
359
213
|
/**
|
|
@@ -414,6 +268,7 @@ declare function evalBuiltinInstanceMethod(brandName: string, method: string, re
|
|
|
414
268
|
* Abs 方法表:模板字符串 / 结构值上的方法与属性。
|
|
415
269
|
* 类型即计算——方法结果仍是 Abs,可继续参与约束推理。
|
|
416
270
|
* 宿主 TypeValue 的 dispatchMethod 只服务 IR 兜底,不是真理源。
|
|
271
|
+
* 模板语义(前缀/后缀/固定文本/长度/谓词判定)统一在 template.ts。
|
|
417
272
|
*/
|
|
418
273
|
|
|
419
274
|
/**
|
|
@@ -423,6 +278,29 @@ declare function callAbsMethod(recv: Abs, name: string, args: Abs[]): Abs | unde
|
|
|
423
278
|
/** 属性读取:template/string.length 等 */
|
|
424
279
|
declare function getAbsProperty(recv: Abs, name: string): Abs | undefined;
|
|
425
280
|
|
|
281
|
+
/**
|
|
282
|
+
* 项(Term)防爆炸:深度/宽度阈值 → leak 为新鲜 var + 等式约束。
|
|
283
|
+
*/
|
|
284
|
+
|
|
285
|
+
type LeakBudget = {
|
|
286
|
+
maxDepth: number;
|
|
287
|
+
maxNodes: number;
|
|
288
|
+
};
|
|
289
|
+
declare const defaultLeakBudget: LeakBudget;
|
|
290
|
+
declare function termDepth(t: Term): number;
|
|
291
|
+
declare function termNodes(t: Term): number;
|
|
292
|
+
declare function exceedsBudget(t: Term, budget?: LeakBudget): boolean;
|
|
293
|
+
declare function resetLeakCounter(): void;
|
|
294
|
+
/**
|
|
295
|
+
* 若项超预算,替换为新鲜变量,并返回附加等式 pred:fresh = originalTerm。
|
|
296
|
+
* 未超预算则原样返回。
|
|
297
|
+
*/
|
|
298
|
+
declare function maybeLeak(a: Abs, budget?: LeakBudget, label?: string): Abs;
|
|
299
|
+
/**
|
|
300
|
+
* 批量:在算术结果上应用 leak。
|
|
301
|
+
*/
|
|
302
|
+
declare function leakIfNeeded(a: Abs, budget?: LeakBudget, label?: string): Abs;
|
|
303
|
+
|
|
426
304
|
/**
|
|
427
305
|
* 结构层:对象槽位、spread、函数重载并。
|
|
428
306
|
* 纪律:积之和默认;optional 塌缩是显式损失;函数并保输入→输出相关性。
|
|
@@ -452,6 +330,15 @@ declare function objOf(slots: Record<string, Slot>, opts?: {
|
|
|
452
330
|
declare function isObj(a: Abs): a is Abs & {
|
|
453
331
|
shape: ObjShape;
|
|
454
332
|
};
|
|
333
|
+
/**
|
|
334
|
+
* 自有槽位读取。slots 是普通对象,直接 `slots[key]` 会让 `__proto__` /
|
|
335
|
+
* `toString` / `valueOf` 等键命中 Object.prototype 原型链,得到既非 slot
|
|
336
|
+
* 又 truthy 的原生值(历史 bug 模式,已两次复发)。所有跨来源 key 的槽位
|
|
337
|
+
* 读取必须走这里。
|
|
338
|
+
*/
|
|
339
|
+
declare function getSlot<S extends {
|
|
340
|
+
value: Abs;
|
|
341
|
+
}>(slots: Record<string, S>, key: string): S | undefined;
|
|
455
342
|
/**
|
|
456
343
|
* spread:base ⊕ over(右侧覆盖,不是 join)
|
|
457
344
|
* 未出现在 over 的 key 保留 base;over 的 key 覆盖。
|
|
@@ -465,11 +352,7 @@ declare function joinObjects(a: Abs, b: Abs): Abs;
|
|
|
465
352
|
/** 值级 join:字面量保留为… Phase A 对 prim 做 term 保留策略 */
|
|
466
353
|
declare function joinValues(a: Abs, b: Abs): Abs;
|
|
467
354
|
declare function makeSum(a: Abs, b: Abs): Abs;
|
|
468
|
-
|
|
469
|
-
* 显式损失:sum-of-products → optional 槽(仅 emit/阈值)。
|
|
470
|
-
* 强制 #widened。
|
|
471
|
-
*/
|
|
472
|
-
declare function collapseToOptional(sum: Abs): Abs;
|
|
355
|
+
declare function absShapeKey(a: Abs, seen?: Set<object>): string;
|
|
473
356
|
type FnAbs = Abs & {
|
|
474
357
|
shape: {
|
|
475
358
|
k: "fn";
|
|
@@ -514,6 +397,180 @@ declare function leqAbs(src: Abs, tgt: Abs, opts?: {
|
|
|
514
397
|
env?: AstEnv;
|
|
515
398
|
}): LeqResult;
|
|
516
399
|
|
|
400
|
+
/**
|
|
401
|
+
* Babel AST 抽象求值:把「类型即计算」接到真实 JS 源码。
|
|
402
|
+
* 支持表达式、函数声明/箭头、return、if、const/let、块作用域、类、循环。
|
|
403
|
+
*/
|
|
404
|
+
|
|
405
|
+
declare function emptyEnv(): AstEnv;
|
|
406
|
+
declare function withVar(env: AstEnv, name: string, value: Abs): AstEnv;
|
|
407
|
+
type EvalOptions = {
|
|
408
|
+
phi?: Phi;
|
|
409
|
+
budget?: LeakBudget;
|
|
410
|
+
/** 预解析 AST(check 等批量场景避免重复 parse) */
|
|
411
|
+
file?: File;
|
|
412
|
+
/** host 已求值的相对依赖导出表 */
|
|
413
|
+
modules?: Record<string, AbsModuleExports>;
|
|
414
|
+
/** host 注入(@nudo:mock 等)在求值前绑定(evalSource 也认) */
|
|
415
|
+
seedVars?: Record<string, Abs>;
|
|
416
|
+
seedFns?: Record<string, {
|
|
417
|
+
params: string[];
|
|
418
|
+
body: Node;
|
|
419
|
+
async?: boolean;
|
|
420
|
+
}>;
|
|
421
|
+
};
|
|
422
|
+
declare const MAX_CALL_DEPTH = 64;
|
|
423
|
+
declare const MAX_TOTAL_CALLS = 200000;
|
|
424
|
+
/** 宿主入口(evalProgramAbs / analyzeFn / check)前重置 */
|
|
425
|
+
declare function resetAbsCallBudget(): void;
|
|
426
|
+
/** 记录被截断的递归(service 可映射为 nudo:recursion-truncated) */
|
|
427
|
+
declare function setAbsTruncationCollector(collector: ((fnLabel: string) => void) | null): void;
|
|
428
|
+
/** Abs 域调用记录(自包含程序可不经 TypeValue evaluator) */
|
|
429
|
+
type AbsCallRecord = {
|
|
430
|
+
fnName: string;
|
|
431
|
+
args: Abs[];
|
|
432
|
+
result: Abs;
|
|
433
|
+
callLoc?: {
|
|
434
|
+
line: number;
|
|
435
|
+
column: number;
|
|
436
|
+
};
|
|
437
|
+
threw?: boolean;
|
|
438
|
+
};
|
|
439
|
+
/** 设置收集器并返回先前值(嵌套/并发宿主须 restore,勿直接置 null) */
|
|
440
|
+
declare function setAbsCallCollector(collector: ((r: AbsCallRecord) => void) | null): ((r: AbsCallRecord) => void) | null;
|
|
441
|
+
declare function setAbsNodeCollector(collector: ((node: Node, value: Abs) => void) | null): void;
|
|
442
|
+
/** 赋值记录:结构可赋值检查用 */
|
|
443
|
+
type AbsAssignRecord = {
|
|
444
|
+
name: string;
|
|
445
|
+
prev?: Abs;
|
|
446
|
+
next: Abs;
|
|
447
|
+
line?: number;
|
|
448
|
+
column?: number;
|
|
449
|
+
/** 分支/循环体内发生:可变绑定在路径上取并集是合法 JS,不参与结构检查 */
|
|
450
|
+
conditional?: boolean;
|
|
451
|
+
};
|
|
452
|
+
declare function setAbsAssignCollector(collector: ((r: AbsAssignRecord) => void) | null): void;
|
|
453
|
+
type EvalResult = {
|
|
454
|
+
value: Abs;
|
|
455
|
+
phi: Phi;
|
|
456
|
+
env: AstEnv;
|
|
457
|
+
/** 函数已通过 return 跳出,块内后续语句不可达 */
|
|
458
|
+
returned?: boolean;
|
|
459
|
+
/** break 跳出最近循环 */
|
|
460
|
+
brk?: boolean;
|
|
461
|
+
/** continue 进入下一轮 */
|
|
462
|
+
cont?: boolean;
|
|
463
|
+
/** throw 了 value(未捕获时向上传播) */
|
|
464
|
+
threw?: boolean;
|
|
465
|
+
/** throw 语句源位置(1-based line,0-based column;Babel loc 口径) */
|
|
466
|
+
throwLoc?: {
|
|
467
|
+
line: number;
|
|
468
|
+
column: number;
|
|
469
|
+
};
|
|
470
|
+
/**
|
|
471
|
+
* if 无 else 且 consequent 已 return/throw:真分支已产出 value,
|
|
472
|
+
* 假分支 fall-through 仍可能走后续语句。evalBlock 需与后续结果 join。
|
|
473
|
+
*/
|
|
474
|
+
partialReturn?: boolean;
|
|
475
|
+
};
|
|
476
|
+
/**
|
|
477
|
+
* 分析一段 JS 源码。
|
|
478
|
+
* 若含多个顶层函数声明,先注册全部,再对 `main` 或最后一个有调用的函数求值。
|
|
479
|
+
* 更简单:提供 `analyzeFunction(source, fnName, args)`。
|
|
480
|
+
*/
|
|
481
|
+
declare function evalSource(source: string, entry: {
|
|
482
|
+
fn: string;
|
|
483
|
+
args: Abs[];
|
|
484
|
+
}, opts?: EvalOptions): EvalResult;
|
|
485
|
+
/**
|
|
486
|
+
* 调用具名函数并返回 throws/loc(T20)。
|
|
487
|
+
* threw 时 result=never、throws=抛出值、throwLoc=throw 语句位置。
|
|
488
|
+
*/
|
|
489
|
+
declare function callFunctionFull(env: AstEnv, name: string, args: Abs[], phi?: Phi, budget?: LeakBudget): {
|
|
490
|
+
result: Abs;
|
|
491
|
+
throws: Abs;
|
|
492
|
+
throwLoc?: {
|
|
493
|
+
line: number;
|
|
494
|
+
column: number;
|
|
495
|
+
};
|
|
496
|
+
};
|
|
497
|
+
declare function callFunction(env: AstEnv, name: string, args: Abs[], phi?: Phi, budget?: LeakBudget): Abs;
|
|
498
|
+
/**
|
|
499
|
+
* 在 this=receiver 下求值方法体。
|
|
500
|
+
* constructor 无显式 return 时返回更新后的 this(字段写入已并入 env)。
|
|
501
|
+
*/
|
|
502
|
+
declare function evalMethodBody(method: {
|
|
503
|
+
params: string[];
|
|
504
|
+
body: Node;
|
|
505
|
+
async?: boolean;
|
|
506
|
+
kind?: string;
|
|
507
|
+
}, args: Abs[], thisVal: Abs, env: AstEnv, phi?: Phi, budget?: LeakBudget,
|
|
508
|
+
/** 方法定义所在类名(用于 super 派发) */
|
|
509
|
+
ownerClass?: string): Abs;
|
|
510
|
+
/** 对外入口:求值并记入节点表(Map<Node, Abs> 由 collector 消费) */
|
|
511
|
+
declare function evalNode(node: Node, env: AstEnv, phi: Phi, budget: LeakBudget): EvalResult;
|
|
512
|
+
/**
|
|
513
|
+
* 应用 Abs 一等函数。统一顺序:apply → body → relation → isRelFn。
|
|
514
|
+
* 调用门须扩为 `getFnImpl || isRelFn`,否则 E 路径永远进不来。
|
|
515
|
+
*/
|
|
516
|
+
declare function applyAbsFn(fnVal: Abs, args: Abs[], env: AstEnv, phi: Phi, budget: LeakBudget): Abs;
|
|
517
|
+
/**
|
|
518
|
+
* 从源码分析指定函数在给定实参下的抽象结果。
|
|
519
|
+
*
|
|
520
|
+
* @example
|
|
521
|
+
* analyzeFn(`
|
|
522
|
+
* const add = (a, b) => a + b;
|
|
523
|
+
* function scale(x) { return add(x, 1); }
|
|
524
|
+
* `, "scale", [numVar("x", gtNum(v("x"), 0))], gtNum(v("x"), 0))
|
|
525
|
+
*/
|
|
526
|
+
declare function analyzeFn(source: string, fnName: string, args: Abs[], phi?: Phi, budget?: LeakBudget, file?: File, modules?: Record<string, AbsModuleExports>): Abs;
|
|
527
|
+
/**
|
|
528
|
+
* analyzeFn 的 throws/loc 感知版(T19/T20):threw 时 result=never、throws=抛出值。
|
|
529
|
+
* 供 case 兜底在 B-path 失败时仍可无损拿 throws+loc,不经 TypeValue evaluateFunctionFull。
|
|
530
|
+
*/
|
|
531
|
+
declare function analyzeFnFull(source: string, fnName: string, args: Abs[], opts?: EvalOptions): {
|
|
532
|
+
result: Abs;
|
|
533
|
+
throws: Abs;
|
|
534
|
+
throwLoc?: {
|
|
535
|
+
line: number;
|
|
536
|
+
column: number;
|
|
537
|
+
};
|
|
538
|
+
};
|
|
539
|
+
/**
|
|
540
|
+
* 程序级 Abs 求值:注册全部顶层函数/class,再顺序执行语句。
|
|
541
|
+
* 返回最终 env(vars 含导出绑定)。TypeValue 仅在调用方 bridge 时出现。
|
|
542
|
+
*
|
|
543
|
+
* seedVars / seedFns:host 注入(@nudo:mock 等)在求值前绑定。
|
|
544
|
+
* modules:host 已求值的依赖导出表(specifier → AbsModuleExports)。
|
|
545
|
+
*/
|
|
546
|
+
declare function evalProgramAbs(source: string, opts?: EvalOptions & {
|
|
547
|
+
seedVars?: Record<string, Abs>;
|
|
548
|
+
seedFns?: Record<string, {
|
|
549
|
+
params: string[];
|
|
550
|
+
body: Node;
|
|
551
|
+
async?: boolean;
|
|
552
|
+
}>;
|
|
553
|
+
modules?: Record<string, AbsModuleExports>;
|
|
554
|
+
}): {
|
|
555
|
+
env: AstEnv;
|
|
556
|
+
last: Abs;
|
|
557
|
+
phi: Phi;
|
|
558
|
+
};
|
|
559
|
+
/**
|
|
560
|
+
* 收集整文件的节点 → Abs 表(LSP 无损信息源)。
|
|
561
|
+
* 自包含源码上一次 evalProgramAbs 即可;失败返回空表。
|
|
562
|
+
*/
|
|
563
|
+
declare function collectAbsNodeTypes(source: string, opts?: EvalOptions & {
|
|
564
|
+
seedVars?: Record<string, Abs>;
|
|
565
|
+
seedFns?: Record<string, {
|
|
566
|
+
params: string[];
|
|
567
|
+
body: Node;
|
|
568
|
+
async?: boolean;
|
|
569
|
+
}>;
|
|
570
|
+
}): Map<Node, Abs>;
|
|
571
|
+
/** 按 loc 找最紧的节点 Abs(hover 用) */
|
|
572
|
+
declare function findAbsAtPosition(nodeTypes: Map<Node, Abs>, line: number, column: number): Abs | undefined;
|
|
573
|
+
|
|
517
574
|
/**
|
|
518
575
|
* 格式化:把 Abs 渲染成人类可读 / CLI 友好的字符串。
|
|
519
576
|
*/
|
|
@@ -532,6 +589,26 @@ declare function formatShape(a: Abs): string;
|
|
|
532
589
|
/** 多行展示,CLI 用 */
|
|
533
590
|
declare function formatAbsMultiline(a: Abs, label?: string): string;
|
|
534
591
|
|
|
592
|
+
/**
|
|
593
|
+
* 侧车/依赖路径纯函数(leaf 模块:零依赖,供 load-deps-fp / interface /
|
|
594
|
+
* refine / LSP 共享单一定义——历史上三份内联拷贝已各自漂移过)。
|
|
595
|
+
*/
|
|
596
|
+
declare function normPath(p: string): string;
|
|
597
|
+
/** core 不引 path:相对 spec 纯字符串拼接(与 LSP resolve 对齐时双方 norm) */
|
|
598
|
+
declare function resolveDepPath(fromFile: string, spec: string): string;
|
|
599
|
+
/**
|
|
600
|
+
* 是否落在 node_modules 下(相对/绝对/盘符形态统一)。
|
|
601
|
+
* autoBind 永不 ambient 加载 node_modules 侧车(§2.2)——必须在 normPath
|
|
602
|
+
* 之后判定,否则 `node_modules/pkg/x.js`(无前导 `/`)会绕过守卫。
|
|
603
|
+
*/
|
|
604
|
+
declare function isNodeModulesPath(p: string): boolean;
|
|
605
|
+
/**
|
|
606
|
+
* 源文件的旁路侧车路径:.js/.mjs → 同名 .nudo.js;.ts/.mts → 同名 .nudo.ts。
|
|
607
|
+
* 其他扩展名(.cjs/.jsx/无扩展名…)不做替换,直接追加 .nudo.js——侧车约定
|
|
608
|
+
* 只覆盖四类入口;host loadModule 对不存在的路径返回 miss,自然无侧车来源。
|
|
609
|
+
*/
|
|
610
|
+
declare function sidecarPathOf(file: string): string;
|
|
611
|
+
|
|
535
612
|
/**
|
|
536
613
|
* 约束模板构建器(参数无关)。
|
|
537
614
|
*
|
|
@@ -540,10 +617,16 @@ declare function formatAbsMultiline(a: Abs, label?: string): string;
|
|
|
540
617
|
* string().min(1) → 非空串(长度)
|
|
541
618
|
* array(number().gt(0)) → 元素约束
|
|
542
619
|
* shape({ id: number().gt(0) }) → object 形状约束
|
|
620
|
+
* lit(42) → 字面量(prim + eq(self, 42))
|
|
621
|
+
* union(number().gt(0), lit(0)) → 成员析取(or / joinAbs)
|
|
622
|
+
* fn({ x: number().gt(0) }, number()) → 一等函数约束
|
|
623
|
+
* number().gt(0).shift(1) → 界平移(x>0 ⇒ x+n>1)
|
|
543
624
|
* instantiate("ms") → Pred ms > 0 / u.id > 0 ∧ …
|
|
544
625
|
*
|
|
545
626
|
* 在 *.nudo.js 里执行;不是 zod 绑定,是我们自己的运行时 API。
|
|
546
627
|
* 不需要 interface/type 语法——契约用 JS 表达式声明。
|
|
628
|
+
* 注意:本文件的 lit/and 构建器与 term/pred 同名导出在桶导出处冲突,
|
|
629
|
+
* 消费方从 "./constraint.ts" 直接路径导入。
|
|
547
630
|
*/
|
|
548
631
|
|
|
549
632
|
/** 模板占位项;instantiate 时换成真实参数名 */
|
|
@@ -568,6 +651,16 @@ type NudoConstraint = {
|
|
|
568
651
|
readonly int?: boolean;
|
|
569
652
|
/** 该约束整体可选(shape 字段用;不用 optional 以免与链式方法撞名) */
|
|
570
653
|
readonly isOptional?: boolean;
|
|
654
|
+
/** union 成员(析取):instantiate 为 or(...),entry Abs 为成员 join */
|
|
655
|
+
readonly members?: NudoConstraint[];
|
|
656
|
+
/** 一等函数约束(fn() 构建器产出) */
|
|
657
|
+
readonly fn?: NudoFnConstraint;
|
|
658
|
+
};
|
|
659
|
+
/** fn(params, returns?, { throws? }) 的一等函数约束形态 */
|
|
660
|
+
type NudoFnConstraint = {
|
|
661
|
+
params: Record<string, NudoConstraint>;
|
|
662
|
+
returns?: NudoConstraint;
|
|
663
|
+
throws?: NudoConstraint;
|
|
571
664
|
};
|
|
572
665
|
declare function isNudoConstraint(x: unknown): x is NudoConstraint;
|
|
573
666
|
/** 链式约束:不可变,每次 .gt() 返回新对象 */
|
|
@@ -584,9 +677,19 @@ type ConstraintBuilder = NudoConstraint & {
|
|
|
584
677
|
max(n: number): ConstraintBuilder;
|
|
585
678
|
/** string:精确长度 */
|
|
586
679
|
length(n: number): ConstraintBuilder;
|
|
680
|
+
/**
|
|
681
|
+
* 界平移:term 平移 n 后重写常数界(x>0 ⇒ x+n>n)。
|
|
682
|
+
* 仅数值标量界链合法;length 界 / shape / array / union / fn → throw。
|
|
683
|
+
*/
|
|
684
|
+
shift(n: number): ConstraintBuilder;
|
|
587
685
|
/** 字段可选(仅在 shape 内有意义) */
|
|
588
686
|
optional(): ConstraintBuilder;
|
|
589
687
|
};
|
|
688
|
+
/**
|
|
689
|
+
* builder 与纯数据形态统一的 int 标志读取:纯数据看 `int === true`,
|
|
690
|
+
* builder(int 是链式方法)查 WeakSet。toPlainConstraint 归一化后只剩前者。
|
|
691
|
+
*/
|
|
692
|
+
declare function isIntFlag(c: NudoConstraint): boolean;
|
|
590
693
|
/** number() —— 约束 number 原语 + 后续链式界 */
|
|
591
694
|
declare function number(): ConstraintBuilder;
|
|
592
695
|
declare function string(): ConstraintBuilder;
|
|
@@ -599,13 +702,38 @@ declare function array(item: NudoConstraint | ConstraintBuilder): ConstraintBuil
|
|
|
599
702
|
* shape({ id: number().gt(0), name: string() })
|
|
600
703
|
*/
|
|
601
704
|
declare function shape(fields: Record<string, NudoConstraint | ConstraintBuilder>): ConstraintBuilder;
|
|
705
|
+
/** union(...cs):成员析取;instantiate 为 or(...),entry Abs 为成员 joinAbs。空参 throw */
|
|
706
|
+
declare function union(...cs: (NudoConstraint | ConstraintBuilder)[]): ConstraintBuilder;
|
|
707
|
+
/**
|
|
708
|
+
* fn(params, returns?, { throws? }):一等函数约束。
|
|
709
|
+
* Phase 1 只展示不执法:参数位 instantiate 恒真(pTrue),
|
|
710
|
+
* 逐参约束经 fnConstraintToEntryReqs 消费。
|
|
711
|
+
*/
|
|
712
|
+
declare function fn(params: Record<string, NudoConstraint | ConstraintBuilder>, returns?: NudoConstraint | ConstraintBuilder, opts?: {
|
|
713
|
+
throws?: NudoConstraint | ConstraintBuilder;
|
|
714
|
+
}): ConstraintBuilder;
|
|
715
|
+
/** partial(c):shape 全字段变可选;非 shape throw */
|
|
716
|
+
declare function partial(c: NudoConstraint | ConstraintBuilder): ConstraintBuilder;
|
|
717
|
+
/** pick(c, keys):shape 子形状(不存在的 key 忽略);非 shape throw */
|
|
718
|
+
declare function pick(c: NudoConstraint | ConstraintBuilder, keys: string[]): ConstraintBuilder;
|
|
719
|
+
/** omit(c, keys):shape 去字段;非 shape throw */
|
|
720
|
+
declare function omit(c: NudoConstraint | ConstraintBuilder, keys: string[]): ConstraintBuilder;
|
|
602
721
|
/** 把模板绑定到参数名:self → paramName;shape 展开为字段访问 Pred */
|
|
603
722
|
declare function instantiateConstraint(c: NudoConstraint, paramName: string): Pred;
|
|
604
723
|
/**
|
|
605
724
|
* 契约 → 函数入口 param Abs(infer/hover 用)。
|
|
606
|
-
* 标量:prim + pred;shape:obj slots
|
|
725
|
+
* 标量:prim + pred;shape:obj slots 递归;union:成员 joinAbs;
|
|
726
|
+
* fn 形态:退化 unknown(不是参数位标量值),逐参约束由 fnConstraintToEntryReqs 消费。
|
|
607
727
|
*/
|
|
608
728
|
declare function constraintToEntryAbs(c: NudoConstraint, paramName: string): Abs;
|
|
729
|
+
/**
|
|
730
|
+
* fn 约束 → 逐参约束表(interface 推导 / 入口签名消费)。
|
|
731
|
+
* 非 fn() 形态 throw——调用方应先判 c.fn。
|
|
732
|
+
*/
|
|
733
|
+
declare function fnConstraintToEntryReqs(c: NudoConstraint): Array<{
|
|
734
|
+
param: string;
|
|
735
|
+
constraint: NudoConstraint;
|
|
736
|
+
}>;
|
|
609
737
|
|
|
610
738
|
/**
|
|
611
739
|
* 精化契约解析:唯一形态
|
|
@@ -621,6 +749,11 @@ declare function constraintToEntryAbs(c: NudoConstraint, paramName: string): Abs
|
|
|
621
749
|
* 由 /// @nudo:import { delay } from "./delay.nudo.js" 引入。
|
|
622
750
|
* 不支持写 `x > 0`(绑死参数名)。
|
|
623
751
|
* 不用 JSDoc @param/@return:那是类型注解语法。
|
|
752
|
+
*
|
|
753
|
+
* `@nudo:interface` 是 `@nudo:refine` 的等价别名(渐进迁移,§design-refine-derivation)。
|
|
754
|
+
* 侧车加载:Babel 语句级改写(多行 import / 注释与字符串里的同形文本不误伤)、
|
|
755
|
+
* 相对 .nudo.js/.nudo.ts 经 loadModule 递归求值、环检测、执行失败改诊断
|
|
756
|
+
* (nudo:interface-load / nudo:interface-cycle,不再静默吞错)。
|
|
624
757
|
*/
|
|
625
758
|
|
|
626
759
|
/** `/// @nudo:import { delay, percent } from "./delay.nudo.js"` */
|
|
@@ -629,13 +762,34 @@ type NamedImport = {
|
|
|
629
762
|
spec: string;
|
|
630
763
|
};
|
|
631
764
|
declare function extractNudoImports(source: string): NamedImport[];
|
|
765
|
+
/** refine 侧车加载诊断(severity 由消费方按 code 定档,形状对齐 Issue 子集) */
|
|
766
|
+
type RefineDiag = {
|
|
767
|
+
code: string;
|
|
768
|
+
message: string;
|
|
769
|
+
file?: string;
|
|
770
|
+
};
|
|
771
|
+
/** 设置诊断观察者(null 清除);缓冲照常累积,takeRefineDiags 取走 */
|
|
772
|
+
declare function setRefineDiagCollector(fn: ((d: RefineDiag) => void) | null): void;
|
|
773
|
+
/** 当前诊断累计序号(since 锚) */
|
|
774
|
+
declare function refineDiagCount(): number;
|
|
775
|
+
/** 取走已收集的诊断(收集即清空) */
|
|
776
|
+
declare function takeRefineDiags(): RefineDiag[];
|
|
777
|
+
/** 只取走 seq > since 的增量(工具面防窃取在途诊断;全量 take 的 since 版) */
|
|
778
|
+
declare function takeRefineDiagsSince(since: number): RefineDiag[];
|
|
779
|
+
/** 侧车模块错误:code ∈ nudo:interface-cycle | nudo:interface-load */
|
|
780
|
+
declare class NudoSidecarError extends Error {
|
|
781
|
+
readonly code: string;
|
|
782
|
+
constructor(code: string, message: string);
|
|
783
|
+
}
|
|
632
784
|
/**
|
|
633
|
-
* 执行 *.nudo.js(真实 JS + 我们的构建器)。
|
|
634
|
-
*
|
|
785
|
+
* 执行 *.nudo.js(真实 JS + 我们的构建器)。import/export 由 Babel 语句级
|
|
786
|
+
* 改写:多行 named import、注释/字符串里的同形文本不误伤;相对 .nudo 递归
|
|
787
|
+
* 求值;环 → throw NudoSidecarError。结果进 exec 缓存(依赖闭包内容指纹键)。
|
|
635
788
|
*/
|
|
636
|
-
declare function execNudoModule(src: string): Record<string, unknown>;
|
|
789
|
+
declare function execNudoModule(src: string, opts?: RefineResolveOpts): Record<string, unknown>;
|
|
637
790
|
type RefineResolveOpts = {
|
|
638
791
|
loadModule?: (spec: string, fromFile: string) => string | undefined;
|
|
792
|
+
/** 侧车自身的路径(相对 spec 解析基准 + 环检测链起点) */
|
|
639
793
|
fromFile?: string;
|
|
640
794
|
};
|
|
641
795
|
declare function resetNudoModuleExecCache(): void;
|
|
@@ -661,24 +815,139 @@ declare function extractRefineReturnFromSource(source: string, fnName: string, o
|
|
|
661
815
|
constraint: NudoConstraint;
|
|
662
816
|
} | undefined;
|
|
663
817
|
|
|
818
|
+
/**
|
|
819
|
+
* Interface 分层推导(design-refine-derivation §2.1/§2.2/§11 第 0 步):
|
|
820
|
+
*
|
|
821
|
+
* effectiveInterface(source, fnName) —— 手写 ∪ 侧车同名绑定 ∪ 生成段的
|
|
822
|
+
* 唯一读取口,来源标注(handwritten / generated / implicit)随值返回。
|
|
823
|
+
*
|
|
824
|
+
* 来源三层(合并序 handwritten > generated > implicit,§4/§11):
|
|
825
|
+
* - handwritten:源码 `@nudo:refine`/`@nudo:interface` 行(复用 refine.ts 的
|
|
826
|
+
* extractRefinesFromSource / extractRefineReturnFromSource)∪ 侧车同名**手写**
|
|
827
|
+
* fn() 绑定。同名同参取合取 and()(§2.1:侧车 x>0 + 源码 x>1 → 有效契约
|
|
828
|
+
* 取合取);常数界交叉矛盾(x>0 ∧ x<0)→ conflict 标记,由调用方报
|
|
829
|
+
* nudo:interface-conflict——本函数不 throw。
|
|
830
|
+
* - generated:侧车同名导出且声明上方注释块含 @generated 标记(emit 产物)。
|
|
831
|
+
* 与手写并存时整体降级忽略(手写为准;混排由 nudo:interface-name-clash /
|
|
832
|
+
* drift 在 emit/check 侧处理)。
|
|
833
|
+
* - implicit:无任何契约 → 返回 undefined(隐式推断是调用方的事)。
|
|
834
|
+
*
|
|
835
|
+
* 自动绑定边界(§2.2):只绑源文件**本地 named export**(re-export /
|
|
836
|
+
* export default / 私有名不绑);opts.autoBind === false 或侧车路径含
|
|
837
|
+
* /node_modules/ → 不 ambient 加载(只看源码 refine)。「项目根内」检查属
|
|
838
|
+
* 宿主层(core 无 projectDir 概念),Phase 1 不在此实现。
|
|
839
|
+
*
|
|
840
|
+
* 侧车绑定 Phase 1 只承诺 fn() 形态:非 fn 的标量/shape 绑定不消费,收集
|
|
841
|
+
* nudo:interface-load 诊断(后续 Phase 再放开单参形态)。
|
|
842
|
+
*
|
|
843
|
+
* 诊断走本文件独立 side-channel(先例 refine.ts 的 setRefineDiagCollector):
|
|
844
|
+
* 侧车加载/执行失败 → nudo:interface-cycle / nudo:interface-load。
|
|
845
|
+
*/
|
|
846
|
+
|
|
847
|
+
/** interface 推导诊断(severity 由消费方按 code 定档,形状对齐 Issue 子集) */
|
|
848
|
+
type InterfaceDiag = {
|
|
849
|
+
code: string;
|
|
850
|
+
message: string;
|
|
851
|
+
file?: string;
|
|
852
|
+
};
|
|
853
|
+
/** 设置诊断观察者(null 清除);缓冲照常累积,takeInterfaceDiags 取走 */
|
|
854
|
+
declare function setInterfaceDiagCollector(fn: ((d: InterfaceDiag) => void) | null): void;
|
|
855
|
+
/** 当前诊断累计序号(since 锚:工具面只排干自身探测产生的增量) */
|
|
856
|
+
declare function interfaceDiagCount(): number;
|
|
857
|
+
/** 取走已收集的诊断(收集即清空) */
|
|
858
|
+
declare function takeInterfaceDiags(): InterfaceDiag[];
|
|
859
|
+
/**
|
|
860
|
+
* 只取走 seq > since 的诊断(清空仅限增量)——LSP 长驻进程里 lens/打印/
|
|
861
|
+
* emit 工具用它排干**自身探测**产生的诊断,不窃取在途 validateText 待消费
|
|
862
|
+
* 的接口诊断(全量 take 曾在 await 窗口偷走 checkSource 的待收诊断)。
|
|
863
|
+
*/
|
|
864
|
+
declare function takeInterfaceDiagsSince(since: number): InterfaceDiag[];
|
|
865
|
+
/** 有效契约来源:手写(源码 refine ∪ 侧车手写绑定)> 生成段 > 隐式 */
|
|
866
|
+
type InterfaceSource = "handwritten" | "generated" | "implicit";
|
|
867
|
+
/**
|
|
868
|
+
* 源文件本地 named export 表:收集本文件声明并导出的名字——
|
|
869
|
+
* `export function/const/let/var/class` 声明形式,以及本地列表
|
|
870
|
+
* `export { x }` / `export { local as exported }`(按**导出名**绑定,
|
|
871
|
+
* 与侧车同名自动绑定口径一致)。
|
|
872
|
+
* 排除 re-export(`export {x} from` / `export *`)与 `export default`。
|
|
873
|
+
*/
|
|
874
|
+
declare function localNamedExports(source: string): Set<string>;
|
|
875
|
+
/**
|
|
876
|
+
* 侧车源码的生成段导出名:export 之前(跳过紧邻的 import/const 链)的注释
|
|
877
|
+
* 行含 `@generated` → 该名为 generated。组合式下行段(§5.3)形态为
|
|
878
|
+
* `import` + `@generated 头` + prelude + export;callsite 段则是头紧贴
|
|
879
|
+
* export。隔了其他代码行 / 无标记 / re-export 列表均不算。
|
|
880
|
+
*/
|
|
881
|
+
declare function generatedExportNames(sidecarSrc: string): Set<string>;
|
|
882
|
+
type EffectiveInterfaceOpts = RefineResolveOpts & {
|
|
883
|
+
/** false(或谓词返回 false)→ 不 ambient 加载侧车;默认 true */
|
|
884
|
+
autoBind?: boolean | ((sidecarPath: string) => boolean);
|
|
885
|
+
};
|
|
886
|
+
type EffectiveInterface = {
|
|
887
|
+
fnName: string;
|
|
888
|
+
params: Array<{
|
|
889
|
+
param: string;
|
|
890
|
+
constraint: NudoConstraint;
|
|
891
|
+
}>;
|
|
892
|
+
returns?: {
|
|
893
|
+
constraint: NudoConstraint;
|
|
894
|
+
};
|
|
895
|
+
source: InterfaceSource;
|
|
896
|
+
/**
|
|
897
|
+
* 合取不可满足标记:params = 常数界交叉矛盾(或 prim 矛盾等 and() 不可
|
|
898
|
+
* 合取形态)的参数名;returns = 返回位同样不可满足。调用方报
|
|
899
|
+
* nudo:interface-conflict 并跳过对应位执法。
|
|
900
|
+
*/
|
|
901
|
+
conflict?: {
|
|
902
|
+
params: string[];
|
|
903
|
+
returns?: boolean;
|
|
904
|
+
};
|
|
905
|
+
};
|
|
906
|
+
/**
|
|
907
|
+
* 单点读取口:手写 ∪ 侧车同名 ∪ 生成段 → 有效契约(含来源标注)。
|
|
908
|
+
* 无任何契约 → undefined(implicit 由调用方处理)。
|
|
909
|
+
*/
|
|
910
|
+
declare function effectiveInterface(source: string, fnName: string, opts?: EffectiveInterfaceOpts): EffectiveInterface | undefined;
|
|
911
|
+
/**
|
|
912
|
+
* 侧车及递归 .nudo 依赖闭包的内容指纹:`${hashSource(侧车)}|路径=hash,…`。
|
|
913
|
+
* 无 loadModule / autoBind 关闭 / node_modules / loadModule miss → undefined
|
|
914
|
+
* (无侧车影响即无需指纹)。闭包截断 → `trunc:` 前缀,键不可信,调用方
|
|
915
|
+
* fail-open(参照 loadModuleDepsFingerprint 的 truncated 契约)。
|
|
916
|
+
*/
|
|
917
|
+
declare function sidecarClosureFingerprint(fromFile: string, opts: EffectiveInterfaceOpts): string | undefined;
|
|
918
|
+
/** 组合式显示:重建构建器调用形态(number().gt(0) / union(…) / fn(…)) */
|
|
919
|
+
declare function formatConstraint(c: NudoConstraint): string;
|
|
920
|
+
|
|
664
921
|
type LoadDepsFingerprint = {
|
|
665
922
|
fp: string;
|
|
666
923
|
paths: string[];
|
|
667
924
|
/** BFS 撞到节点上限:剩余 dep 未进指纹,键不可信 */
|
|
668
925
|
truncated: boolean;
|
|
669
926
|
};
|
|
670
|
-
declare function normPath(p: string): string;
|
|
671
|
-
/** core 不引 path:相对 spec 纯字符串拼接(与 LSP resolve 对齐时双方 norm) */
|
|
672
|
-
declare function resolveDepPath(fromFile: string, spec: string): string;
|
|
673
927
|
/**
|
|
674
928
|
* All string module specs that analysis may resolve through loadModule.
|
|
675
929
|
* Regex over-approximates (may hit comments) — extra dep fingerprint is safe
|
|
676
930
|
* (more misses, never a stale hit).
|
|
677
931
|
*/
|
|
678
932
|
declare function extractAllLoadSpecs(source: string): string[];
|
|
933
|
+
/**
|
|
934
|
+
* 源里指向其他侧车的相对 spec(`.nudo.js`/`.nudo.ts`)。regex 过近似安全:
|
|
935
|
+
* 多算的 dep 只带来额外 miss,绝不产生陈旧命中。LSP 隐式依赖登记共用。
|
|
936
|
+
*/
|
|
937
|
+
declare function sidecarSpecsOf(source: string): string[];
|
|
679
938
|
/**
|
|
680
939
|
* Fingerprint every loadModule-reachable dep (not only `*.nudo.js`), including
|
|
681
|
-
* one hop of transitive specs from each dep source
|
|
940
|
+
* one hop of transitive specs from each dep source — plus the autoBind 侧车
|
|
941
|
+
* 闭包(`sidecar:` 前缀条目)。
|
|
942
|
+
*
|
|
943
|
+
* 侧车吸收范围 = fromFile 自身 **与每一个成功加载的依赖文件**的旁路侧车及其
|
|
944
|
+
* 递归 .nudo 依赖:跨文件被调(scan.ts checkExternalCall)会按定义文件路径
|
|
945
|
+
* ambient 绑定其侧车,依赖侧车内容影响调用方报告——不进指纹则编辑后 memo
|
|
946
|
+
* 陈旧命中(错诊断)。侧车 loadModule miss(无侧车文件)→ 不加任何条目。
|
|
947
|
+
*
|
|
948
|
+
* 注意:本扩展对 autoBind=false 与 /node_modules/ 均**不** gate(刻意过近似,
|
|
949
|
+
* 只过度失效、绝不陈旧命中——安全方向);ambient 生效边界由
|
|
950
|
+
* interface.ts 的 sidecarClosureFingerprint 负责,两者职责不同。
|
|
682
951
|
*/
|
|
683
952
|
declare function loadModuleDepsFingerprint(source: string, loadModule: (spec: string, fromFile: string) => string | undefined, fromFile: string): LoadDepsFingerprint;
|
|
684
953
|
|
|
@@ -732,11 +1001,13 @@ declare function generalizeFromAst(fnName: string, source: string, opts?: {
|
|
|
732
1001
|
budget?: LeakBudget;
|
|
733
1002
|
label?: string;
|
|
734
1003
|
/** 传入则把 @nudo:refine 挂到入口 param Abs */
|
|
735
|
-
refine?:
|
|
1004
|
+
refine?: EffectiveInterfaceOpts;
|
|
736
1005
|
/** 预解析 AST,避免 check 批量场景重复 parse */
|
|
737
1006
|
file?: ReturnType<typeof parseSource>;
|
|
738
1007
|
/** 预计算 load-deps 指纹(checkSource 整文件一次,避免 per-fn 重读) */
|
|
739
1008
|
depsFp?: LoadDepsFingerprint;
|
|
1009
|
+
/** 预计算 ambient 侧车闭包指纹(checkSource 整文件一次) */
|
|
1010
|
+
sidecarFp?: string;
|
|
740
1011
|
}): PolyFn | undefined;
|
|
741
1012
|
declare function generalizeAll(source: string, opts?: {
|
|
742
1013
|
budget?: LeakBudget;
|
|
@@ -777,11 +1048,50 @@ declare function formatDiagnostics(diags: Diagnostic[]): string;
|
|
|
777
1048
|
* Template string 拼接(代数侧)。
|
|
778
1049
|
* 表示:prim(string) + refinement.meta.templateParts = Abs[]
|
|
779
1050
|
* 与 core 的 createTemplate 对齐,使 `"x" + string + "!"` 得到 template refined。
|
|
1051
|
+
*
|
|
1052
|
+
* 本模块是模板语义的唯一真理源:前缀/后缀/固定文本/长度/匹配/名称渲染/
|
|
1053
|
+
* 相邻合并/谓词判定等纯计算以「中性 part 视图」(TemplatePartView)暴露;
|
|
1054
|
+
* Abs 方法表(methods.ts)只做薄适配。
|
|
780
1055
|
*/
|
|
781
1056
|
|
|
782
1057
|
type TemplateMeta = {
|
|
783
1058
|
templateParts: Abs[];
|
|
784
1059
|
};
|
|
1060
|
+
/** 单个 part 的分类:固定文本,或抽象 part(携带展示文本) */
|
|
1061
|
+
type TemplatePartDesc = {
|
|
1062
|
+
fixed: string;
|
|
1063
|
+
} | {
|
|
1064
|
+
render: string;
|
|
1065
|
+
};
|
|
1066
|
+
/** 带原始 part 回引的视图:既喂语义计算,也用于重建合并结果 */
|
|
1067
|
+
type TemplatePartView<P = unknown> = {
|
|
1068
|
+
/** 固定文本;undefined = 抽象 part */
|
|
1069
|
+
fixed: string | undefined;
|
|
1070
|
+
/** 抽象 part 的展示文本(渲染 `${...}` 名时使用) */
|
|
1071
|
+
render: string;
|
|
1072
|
+
part: P;
|
|
1073
|
+
};
|
|
1074
|
+
declare function viewTemplateParts<P>(parts: P[], describe: (p: P) => TemplatePartDesc): TemplatePartView<P>[];
|
|
1075
|
+
/** 前导固定文本(遇到首个抽象 part 停止) */
|
|
1076
|
+
declare function knownPrefixOfViews(views: TemplatePartView[]): string;
|
|
1077
|
+
/** 尾部固定文本(从末尾遇到首个抽象 part 停止) */
|
|
1078
|
+
declare function knownSuffixOfViews(views: TemplatePartView[]): string;
|
|
1079
|
+
/** 全部固定文本按序拼接(跨抽象 part) */
|
|
1080
|
+
declare function allFixedTextOfViews(views: TemplatePartView[]): string;
|
|
1081
|
+
/** 全部 part 均为固定文本时的精确总长;含抽象 part 则 undefined */
|
|
1082
|
+
declare function fixedLengthOfViews(views: TemplatePartView[]): number | undefined;
|
|
1083
|
+
/** 渲染 `` `lit${render}` `` 形态的模板名 */
|
|
1084
|
+
declare function formatTemplateNameViews(views: TemplatePartView[]): string;
|
|
1085
|
+
/** 相邻固定文本合并;rebuildFixed 以合并文本重建视图(含原始 part) */
|
|
1086
|
+
declare function mergeAdjacentFixedViews<P>(views: TemplatePartView<P>[], rebuildFixed: (text: string) => TemplatePartView<P>): TemplatePartView<P>[];
|
|
1087
|
+
/** 具体字符串是否匹配模板(Refinement.check 的判定语义) */
|
|
1088
|
+
declare function templateMatchesValue(value: string, views: TemplatePartView[]): boolean;
|
|
1089
|
+
/** 三值判定;Abs 方法表把 "unknown" 适配为 boolPrim */
|
|
1090
|
+
type TemplatePredicateDecision = boolean | "unknown";
|
|
1091
|
+
declare function decideStartsWith(prefix: string, search: string): TemplatePredicateDecision;
|
|
1092
|
+
declare function decideEndsWith(suffix: string, search: string): TemplatePredicateDecision;
|
|
1093
|
+
declare function decideIncludes(fixedText: string, search: string): TemplatePredicateDecision;
|
|
1094
|
+
declare function absTemplateViews(parts: Abs[]): TemplatePartView<Abs>[];
|
|
785
1095
|
/** 从 Abs 提取 template parts(已是 template 则展开,否则 [self]) */
|
|
786
1096
|
declare function templatePartsOf(a: Abs): Abs[];
|
|
787
1097
|
/**
|
|
@@ -993,7 +1303,6 @@ declare function formatCheckReport(r: CheckReport, opts?: {
|
|
|
993
1303
|
*/
|
|
994
1304
|
|
|
995
1305
|
declare function resetCheckSourceMemo(): void;
|
|
996
|
-
declare function getCheckSourceMemoSize(): number;
|
|
997
1306
|
/** `*.nudo.js` 变更后定向逐出依赖它的整文件 check 缓存 */
|
|
998
1307
|
declare function evictCheckSourceMemoForPaths(paths: string[]): number;
|
|
999
1308
|
/**
|
|
@@ -1004,6 +1313,12 @@ type CheckOptions = {
|
|
|
1004
1313
|
loadModule?: (spec: string, fromFile: string) => string | undefined;
|
|
1005
1314
|
/** 当前文件路径(供 loadModule 解析相对 spec) */
|
|
1006
1315
|
fromFile?: string;
|
|
1316
|
+
/**
|
|
1317
|
+
* 侧车 ambient 绑定开关(host 从 package.json#nudo.interface.autoBind
|
|
1318
|
+
* 解析后下传;默认 true)。false = check/LSP 执法路径不自动加载侧车
|
|
1319
|
+
* (§2.2「整体关闭」承诺覆盖 CI 门禁,不只是打印路径)。
|
|
1320
|
+
*/
|
|
1321
|
+
autoBind?: boolean;
|
|
1007
1322
|
};
|
|
1008
1323
|
/**
|
|
1009
1324
|
* 检查一个文件:
|
|
@@ -1015,9 +1330,32 @@ type CheckOptions = {
|
|
|
1015
1330
|
*/
|
|
1016
1331
|
declare function checkSource(filePath: string, source: string, phi?: Phi, opts?: CheckOptions): CheckReport;
|
|
1017
1332
|
|
|
1333
|
+
/**
|
|
1334
|
+
* 字面量域隶属判定(Phase 1)。
|
|
1335
|
+
*
|
|
1336
|
+
* 手写契约(*.nudo.js)与调用点域证据对账用:判断字面量值是否落在
|
|
1337
|
+
* NudoConstraint 表达的域内。只覆盖可判定的标量子集:
|
|
1338
|
+
*
|
|
1339
|
+
* - prim 门(prim 缺失或不匹配字面量类型 → false)
|
|
1340
|
+
* - eq(self, lit v) 字面量等值(number/string/boolean/null)
|
|
1341
|
+
* - gt/ge/lt/le 数值常数界(self op n)
|
|
1342
|
+
* - 字符串长度界(length(self) op n,即 min/max/length 链)
|
|
1343
|
+
* - int(整数性)
|
|
1344
|
+
* - members(union):任一成员满足即满足
|
|
1345
|
+
*
|
|
1346
|
+
* 对象 / 数组 / 函数域与不可判定的 pred 形态一律 false——保守不满足,
|
|
1347
|
+
* 对账侧宁可多报 domain-exceeds 也不放过。
|
|
1348
|
+
*/
|
|
1349
|
+
|
|
1350
|
+
/** 字面量 lv 是否落在约束 c 表达的域内(保守:判不了 → false)。 */
|
|
1351
|
+
declare function literalMeetsConstraint(lv: number | string | boolean | null, c: NudoConstraint): boolean;
|
|
1352
|
+
|
|
1018
1353
|
/**
|
|
1019
1354
|
* Abs inlay hint:把无损约束内联到源码位置。
|
|
1020
1355
|
* 不是 TS 风格 type annotation 复读,而是 term/pred/conf 的计算结果。
|
|
1356
|
+
*
|
|
1357
|
+
* 参数侧只展示显式 `@nudo:refine` 契约(entryReqs)——
|
|
1358
|
+
* 不从函数体 `if` 反推前置条件(那是控制流,不是对外契约)。
|
|
1021
1359
|
*/
|
|
1022
1360
|
type AbsInlay = {
|
|
1023
1361
|
/** 1-based 行号 */
|
|
@@ -1029,8 +1367,8 @@ type AbsInlay = {
|
|
|
1029
1367
|
};
|
|
1030
1368
|
/**
|
|
1031
1369
|
* 收集源码中函数签名的 Abs inlay:
|
|
1032
|
-
* -
|
|
1033
|
-
* - `
|
|
1370
|
+
* - 参数后:仅 `@nudo:refine` 声明的前置契约
|
|
1371
|
+
* - `{` 前:返回计算形(`x | x * 2`),无 term 时退回 shape
|
|
1034
1372
|
*/
|
|
1035
1373
|
declare function collectAbsInlays(source: string, refineOpts?: {
|
|
1036
1374
|
loadModule?: (spec: string, fromFile: string) => string | undefined;
|
|
@@ -1048,33 +1386,186 @@ declare function collectAbsInlays(source: string, refineOpts?: {
|
|
|
1048
1386
|
declare function denoteGuard(a: Abs, v: string): string;
|
|
1049
1387
|
|
|
1050
1388
|
/**
|
|
1051
|
-
* Abs
|
|
1389
|
+
* Abs → NudoConstraint 投影(Phase 1,interface 分层推导的生成侧半边)。
|
|
1390
|
+
*
|
|
1391
|
+
* 只投影可表达子集,其余一律 undefined——诚实缺口,不产垃圾约束
|
|
1392
|
+
* (调用方据此标 partial/skip,见设计文档 §4.2):
|
|
1393
|
+
*
|
|
1394
|
+
* numLit(42) / strLit("a") / boolLit(true) → lit(v)
|
|
1395
|
+
* prim number + 常数界(gt/ge/lt/le 于 self 项)→ number().gt(…) 链
|
|
1396
|
+
* prim string + 长度界(length(self) 与常数比较)→ string().min/max
|
|
1397
|
+
* prim + eq(self, lit v) → lit(v)
|
|
1398
|
+
* sum 形态 / or-pred 字面量集 → union(lit…)(全员字面量才投影)
|
|
1399
|
+
* obj slots → shape({ 字段递归 })(任一字段
|
|
1400
|
+
* 不可投影 → 整体 undefined;空对象 → shape({}))
|
|
1401
|
+
* arr → array(item)(元素可投影);
|
|
1402
|
+
* 元素不可投影但 prim 均匀无 preds → array(number()) 之类退化
|
|
1052
1403
|
*
|
|
1053
|
-
*
|
|
1054
|
-
*
|
|
1055
|
-
*
|
|
1056
|
-
* -
|
|
1404
|
+
* conf ∈ {exact, path} 才投影;widened/partial/opaque/mock → undefined。
|
|
1405
|
+
* preds 中含不可表达形态(length 于 number、ne、未锚定 self 的项、
|
|
1406
|
+
* 嵌套 or/not)→ undefined。bigint/symbol、tuple、fn、eff、brand、
|
|
1407
|
+
* any(无 or-pred)、never、unknown → undefined。
|
|
1408
|
+
*
|
|
1409
|
+
* 注意:本模块从 "./constraint.ts" 直接路径 import(桶导出消歧为
|
|
1410
|
+
* term.ts 的 lit / pred.ts 的 and,见 constraint.ts 头注释)。
|
|
1057
1411
|
*/
|
|
1058
1412
|
|
|
1059
|
-
|
|
1060
|
-
declare function
|
|
1413
|
+
/** Abs → 契约;不可表达 → undefined */
|
|
1414
|
+
declare function absToConstraint(a: Abs): NudoConstraint | undefined;
|
|
1061
1415
|
/**
|
|
1062
|
-
* Abs
|
|
1063
|
-
*
|
|
1416
|
+
* 工件聚合投影(设计 §4.2:先 Abs join 折叠再投影)。
|
|
1417
|
+
* 空列表 → undefined(无证据不产约束)。
|
|
1418
|
+
*
|
|
1419
|
+
* 全员可投影字面量时走**字面量快路径**(直接 union 去重):joinValues 对
|
|
1420
|
+
* 两个同 prim 字面量的相遇会急切塌缩为裸 prim(term/pred 丢失),reduce
|
|
1421
|
+
* 左折叠因此对证据**顺序敏感**——{42,"a",7} 一序产出 union 三字面量、
|
|
1422
|
+
* 另一序 not-projectable。快路径绕过 join,聚合结果顺序无关。
|
|
1423
|
+
*/
|
|
1424
|
+
declare function joinThenProject(absList: Abs[]): NudoConstraint | undefined;
|
|
1425
|
+
|
|
1426
|
+
/**
|
|
1427
|
+
* 推导图(derivation trace)side-channel(design-refine-derivation §14.3#6 / §11 Phase 2)。
|
|
1428
|
+
*
|
|
1429
|
+
* 不叫 provenance:`setProvenanceTracking` 已被 evaluator 的 TypeValue origin map
|
|
1430
|
+
* 占用。机制对齐 `setCallCollector` / `setAbsTruncationCollector` 先例——
|
|
1431
|
+
* **不进 Abs payload**;ast-eval 与 B-path 共用 core ops(`add` / `joinAbs`),
|
|
1432
|
+
* 两条路径天然都覆盖。
|
|
1433
|
+
*
|
|
1434
|
+
* 设计原则:emit 打印的是推导图的投影,**禁止**事后从最终 Abs 反编译 shift 链。
|
|
1435
|
+
* 本模块在 ops 层打点:数值常量加法 → shift 边;joinAbs → join 边。
|
|
1436
|
+
* 根约束(手写契约参数)由宿主在入口 Abs 上打 root 标签。
|
|
1064
1437
|
*/
|
|
1065
|
-
|
|
1438
|
+
|
|
1439
|
+
/** 推导节点:边带调用位点 / +k / join;root 携带可打印的约束源表达式 */
|
|
1440
|
+
type DerivationNode = {
|
|
1441
|
+
id: number;
|
|
1442
|
+
kind: "root" | "shift" | "join" | "opaque";
|
|
1443
|
+
/** root:宿主给的可读约束表达式(`positive` / `number().gt(0)`) */
|
|
1444
|
+
expr?: string;
|
|
1445
|
+
/** root:跨文件 import 源(相对 specifier,相对 root 侧车目录) */
|
|
1446
|
+
importFrom?: string;
|
|
1447
|
+
/** root:import 绑定名(与 expr 一致时省略) */
|
|
1448
|
+
importName?: string;
|
|
1449
|
+
/** shift:数值偏移 */
|
|
1450
|
+
offset?: number;
|
|
1451
|
+
/** 父节点 id(root 无父) */
|
|
1452
|
+
parents: number[];
|
|
1453
|
+
};
|
|
1454
|
+
/** 调用位点上的实参推导(供 emit 投影组合式) */
|
|
1455
|
+
type ArgDerivation = {
|
|
1456
|
+
node: DerivationNode;
|
|
1457
|
+
/** 从该节点回溯到 root 的路径(含自身,root 在末尾) */
|
|
1458
|
+
chain: DerivationNode[];
|
|
1459
|
+
};
|
|
1460
|
+
type Collector = (node: DerivationNode) => void;
|
|
1461
|
+
/** 设置观察者(null 清除);缓冲照常累积 */
|
|
1462
|
+
declare function setDerivationCollector(fn: Collector | null): void;
|
|
1463
|
+
declare function hasDerivationSession(): boolean;
|
|
1464
|
+
/** 开始一次推导会话(root 驱动下行求值前调用);与 end/abort 成对 */
|
|
1465
|
+
declare function beginDerivationSession(): void;
|
|
1466
|
+
/** 结束会话并取走全部节点(顺序 = 创建序) */
|
|
1467
|
+
declare function endDerivationSession(): DerivationNode[];
|
|
1468
|
+
/** 丢弃当前会话(求值失败时) */
|
|
1469
|
+
declare function abortDerivationSession(): void;
|
|
1470
|
+
/**
|
|
1471
|
+
* 在入口 Abs 上打 root 标签:该值来自手写契约参数约束。
|
|
1472
|
+
* expr 是可打印源(`positive`);importFrom 指向共享模板侧车。
|
|
1473
|
+
*/
|
|
1474
|
+
declare function tagDerivationRoot(abs: Abs, meta: {
|
|
1475
|
+
expr: string;
|
|
1476
|
+
importFrom?: string;
|
|
1477
|
+
importName?: string;
|
|
1478
|
+
}): DerivationNode;
|
|
1479
|
+
/** 读取 Abs 上的推导节点(无标签 → undefined) */
|
|
1480
|
+
declare function getDerivation(abs: Abs): DerivationNode | undefined;
|
|
1481
|
+
/** 手动把推导挂到结果 Abs(宿主在 analyzeFn 返回值上补标签时用) */
|
|
1482
|
+
declare function setDerivation(abs: Abs, node: DerivationNode): void;
|
|
1483
|
+
/** 从节点回溯 root 路径(含自身;环/缺失截断) */
|
|
1484
|
+
declare function derivationChain(node: DerivationNode): DerivationNode[];
|
|
1485
|
+
/**
|
|
1486
|
+
* ops 层打点:`a + k`(k 为有限数值字面量)且 a 带推导 → 结果挂 shift 节点。
|
|
1487
|
+
* 由 arithmetic.add 在返回前调用;无会话/无父标签时 no-op。
|
|
1488
|
+
*/
|
|
1489
|
+
declare function noteDerivationAdd(a: Abs, b: Abs, result: Abs): void;
|
|
1490
|
+
/**
|
|
1491
|
+
* ops 层打点:join 结果挂 join 节点(任一侧有推导即可)。
|
|
1492
|
+
* 工件聚合路径会经 join;check 分轨不依赖 join 节点。
|
|
1493
|
+
*/
|
|
1494
|
+
declare function noteDerivationJoin(inputs: Abs[], result: Abs): void;
|
|
1495
|
+
/**
|
|
1496
|
+
* 把推导链投影为组合式(§2.4:写组合式,不展开)。
|
|
1497
|
+
*
|
|
1498
|
+
* 返回 prelude(`const x = positive.shift(1);`)+ expr(`x` / `x.shift(2)`)
|
|
1499
|
+
* + 需要的 import。无 root 锚或链上出现 join/opaque → undefined(调用方
|
|
1500
|
+
* 退回展开式投影或 not-projectable)。
|
|
1501
|
+
*/
|
|
1502
|
+
declare function projectDerivationDsl(node: DerivationNode, localName: string): {
|
|
1503
|
+
prelude: string[];
|
|
1504
|
+
expr: string;
|
|
1505
|
+
imports: Array<{
|
|
1506
|
+
name: string;
|
|
1507
|
+
from: string;
|
|
1508
|
+
}>;
|
|
1509
|
+
} | undefined;
|
|
1510
|
+
/** 项结构调试用(测试断言) */
|
|
1511
|
+
declare function termKey(t: Term | undefined): string;
|
|
1512
|
+
|
|
1066
1513
|
/**
|
|
1067
|
-
*
|
|
1068
|
-
*
|
|
1514
|
+
* 源码级调用图侦察:从 check 门禁拆出的 AST 扫描层。
|
|
1515
|
+
*
|
|
1516
|
+
* 职责:不做代数求值结论,只回答「谁在调用谁、实参长什么样」——
|
|
1517
|
+
* - listTopFunctions:顶层函数清单
|
|
1518
|
+
* - collectCallResolvers / resolveCalleeFn / collectForwarders:别名 / 对象属性 /
|
|
1519
|
+
* require / 动态 import / 无条件转发 的调用解析
|
|
1520
|
+
* - scanLiteralCalls:字面量调用点实参 vs 前置约束的违例收集
|
|
1069
1521
|
*/
|
|
1070
|
-
|
|
1522
|
+
|
|
1071
1523
|
/**
|
|
1072
|
-
*
|
|
1073
|
-
* 用于金标与调试。
|
|
1524
|
+
* 注入记录的最小结构面。Abs 为唯一真理源。
|
|
1074
1525
|
*/
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1526
|
+
type InjectedDomainRecord = {
|
|
1527
|
+
/** 无损参数 Abs(必填;domain 证据唯一来源) */
|
|
1528
|
+
argAbs?: Abs[];
|
|
1529
|
+
resultAbs?: Abs;
|
|
1530
|
+
throwsAbs?: Abs;
|
|
1078
1531
|
};
|
|
1532
|
+
type InjectedDomainEvidenceOpts = {
|
|
1533
|
+
/** 被调函数形参名(位置序);契约按参数名对齐证据位 */
|
|
1534
|
+
paramNames: string[];
|
|
1535
|
+
loadModule?: (spec: string, fromFile: string) => string | undefined;
|
|
1536
|
+
fromFile?: string;
|
|
1537
|
+
/** 侧车 ambient 绑定开关(host 配置下传;默认 true) */
|
|
1538
|
+
autoBind?: boolean;
|
|
1539
|
+
/** 报告定位:被调函数声明处。注入证据的 loc 在使用现场文件,不属于本文件 */
|
|
1540
|
+
loc?: {
|
|
1541
|
+
line: number;
|
|
1542
|
+
column: number;
|
|
1543
|
+
};
|
|
1544
|
+
};
|
|
1545
|
+
/**
|
|
1546
|
+
* 跨文件注入的调用点域证据 vs 手写契约(设计稿 §3.3/§6 对账矩阵第一行)。
|
|
1547
|
+
*
|
|
1548
|
+
* 来源分流铁律:写在被分析文件里的调用点违例(含 scanLiteralCalls 的
|
|
1549
|
+
* checkExternalCall 跨文件被调路径)维持 `nudo:constraint-violated` 原码
|
|
1550
|
+
* 原语义——本函数**只**消费经 externalCallRecords 注入的跨文件记录(analyzer
|
|
1551
|
+
* 消费区已做归属守卫),该路径此前不查契约,是纯增量。
|
|
1552
|
+
*
|
|
1553
|
+
* 证据门槛(§6):
|
|
1554
|
+
* - 只有 plain literal 实参构成证据:union/unknown/primitive/refined 形态
|
|
1555
|
+
* 无法归因到确定值,不参与。Abs 路径直接读 `litValue` + conf
|
|
1556
|
+
* ∈ {exact, path}。
|
|
1557
|
+
* - null 证据预过滤(T4 caveat:lit(null) 编码 prim undefined + eq(self,
|
|
1558
|
+
* null),对任何约束恒不满足,不过滤必 FP);undefined/bigint/symbol
|
|
1559
|
+
* 不在字面量证据域内,一并跳过;
|
|
1560
|
+
* - resultType=never ∧ throws=never 是求值中断泄漏(analyzer 注入消费区
|
|
1561
|
+
* 同款过滤;有 resultAbs/throwsAbs 时同口径)。CallRecord 上没有截断字段
|
|
1562
|
+
* (查证于 evaluator.ts CallRecord 声明)——递归截断走
|
|
1563
|
+
* nudo:recursion-truncated 诊断通道且只 widen 结果,不产生新字面量证据;
|
|
1564
|
+
* - fn/shape/array 参数位 Phase 1 不执法(§3.3 HOF 豁免:
|
|
1565
|
+
* literalMeetsConstraint 对这些形态恒 false,直接查必 FP)。
|
|
1566
|
+
*
|
|
1567
|
+
* 每函数每参数位最多一条 issue(多证据并列在 actual 里,去重)。
|
|
1568
|
+
*/
|
|
1569
|
+
declare function checkInjectedDomainEvidence(fnName: string, source: string, records: InjectedDomainRecord[], opts: InjectedDomainEvidenceOpts): CheckIssue[];
|
|
1079
1570
|
|
|
1080
|
-
export { Abs, type AbsFnImpl, type AbsInlay, AstEnv, type CheckIssue, type CheckJson, type CheckOptions, type CheckReport, type ClassDef, Confidence, type ConstraintBuilder, type Diagnostic, type Environment, type FnAbs, type FnFp, type FormatOptions, type
|
|
1571
|
+
export { Abs, type AbsAssignRecord, type AbsCallRecord, type AbsFnImpl, type AbsInlay, AbsModuleExports, type AbsSigImpl, type ArgDerivation, AstEnv, type CheckIssue, type CheckJson, type CheckOptions, type CheckReport, type ClassDef, Confidence, type ConstraintBuilder, type DerivationNode, type Diagnostic, type EffectiveInterface, type EffectiveInterfaceOpts, type Environment, type EvalOptions, type EvalResult, type FnAbs, type FnFp, type FormatOptions, HofSite, type InjectedDomainRecord, type InterfaceDiag, type InterfaceSource, type LeakBudget, type LeqResult, type LoadDepsFingerprint, MAX_CALL_DEPTH, MAX_TOTAL_CALLS, type MethodDef, type MockHelper, type NamedImport, type NudoConstraint, type NudoField, type NudoFnConstraint, NudoSidecarError, type NudoSig, type ObjShape, Phi, type PolyFn, Pred, PrimName, type RefineDiag, type RefineEntry, type RefineResolveOpts, RelSource, SELF, Shape, type Slot, type TemplateMeta, type TemplatePartDesc, type TemplatePartView, type TemplatePredicateDecision, Term, type TypeParam, abortDerivationSession, absFunction, absShapeKey, absTemplateViews, absToConstraint, add, allFixedTextOfViews, analyzeFn, analyzeFnFull, applyAbsFn, array, attachFnImpl, awaitAbs, beginDerivationSession, boolean, buildArgsFromAssume, callAbsMethod, callFunction, callFunctionFull, canSkipLiteralCallScan, checkArg, checkCall, checkInjectedDomainEvidence, checkSource, classFromMethods, cmp, coerceAsyncReturn, collectAbsInlays, collectAbsNodeTypes, concatString, constraintToEntryAbs, createEnvironment, createTemplateAbs, currentPhi, decideEndsWith, decideIncludes, decideStartsWith, defaultLeakBudget, defineClass, definitelyNotNullishShape, denoteGuard, derivationChain, describePhi, div, effectiveInterface, emptyEnv, endDerivationSession, evalArrayStatic, evalBuiltinInstanceMethod, evalBuiltinNew, evalDateCtor, evalDateMethod, evalDateStatic, evalGlobalFn, evalJsonMethod, evalMathMethod, evalMethodBody, evalNamespaceCall, evalNode, evalNumberStatic, evalObjectMethod, evalProgramAbs, evalPromiseCtor, evalPromiseStatic, evalRegExpCtor, evalRegExpMethod, evalSource, evictCheckSourceMemoForPaths, evictGeneralizeMemoForPaths, exceedsBudget, execNudoModule, extractAllLoadSpecs, extractFn, extractNudoImports, extractRefineReturnFromSource, extractRefinesFromSource, falseConstraint, findAbsAtPosition, fixedLengthOfViews, fn, fnConstraintToEntryReqs, fnFingerprints, fnOf, formatAbs, formatAbsMultiline, formatCheckReport, formatConstraint, formatDiagnostics, formatShape, formatShapeSlot, formatTemplateNameViews, generalizeAll, generalizeFromAst, generalizeSourceKeyPart, generatedExportNames, getAbsProperty, getClass, getClassChain, getDerivation, getFnImpl, getFnNameAndBodies, getGeneralizeMemoSize, getParseSourceCacheSize, getSlot, getTerm, hasDerivationSession, hashSource, instanceOf, instantiateClass, instantiateConstraint, interfaceDiagCount, isIntFlag, isNodeModulesPath, isNudoConstraint, isNullishLitAbs, isObj, isTemplateLike, joinAbs, joinFunctions, joinObjects, joinThenProject, joinValues, knownPrefixOfViews, knownSuffixOfViews, leakIfNeeded, lenTerm, leqAbs, listFunctionNames, literalMeetsConstraint, loadModuleDepsFingerprint, localNamedExports, lookupMethod, lookupMethodWithOwner, lookupSuperMethod, makeSum, matchRelIdentLit, maybeLeak, mergeAdjacentFixedViews, mock, mod, mul, negAbs, normPath, notAbs, noteDerivationAdd, noteDerivationJoin, number, objOf, omit, parseSource, partial, pick, popPhi, projectBrand, projectDerivationDsl, pushPhi, refineAbsForRelTrue, refineDiagCount, refineToIndexedFull, relationFingerprint, relationFn, resetAbsCallBudget, resetCheckSourceMemo, resetFnFpCache, resetGeneralizeMemo, resetHashSourceCache, resetLeakCounter, resetNudoModuleExecCache, resetParseSourceCache, resetPhi, resolveDepPath, serializeCheckJson, setAbsAssignCollector, setAbsCallCollector, setAbsNodeCollector, setAbsTruncationCollector, setDerivation, setDerivationCollector, setInterfaceDiagCollector, setRefineDiagCollector, shape, shapeOnlyFn, sidecarClosureFingerprint, sidecarPathOf, sidecarSpecsOf, spread, spy, stableAnalyzeKeySource, strictEqAbs, string, stripTypes, stub, sub, superNameOf, tagDerivationRoot, takeInterfaceDiags, takeInterfaceDiagsSince, takeRefineDiags, takeRefineDiagsSince, templateMatchesValue, templatePartsOf, termDepth, termKey, termNodes, trueConstraint, typeofAbs, union, viewTemplateParts, withPhiConstraint, withVar, wrapPromise };
|