@nudojs/core 0.3.1 → 0.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/{chunk-BU4A6XJ3.js → chunk-N7E2A7IK.js} +1027 -667
- package/dist/exec.d.ts +1 -1
- package/dist/exec.js +7 -1
- package/dist/{index-CVYjXnwU.d.ts → index-DgyudAkw.d.ts} +13 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +13 -2
- package/package.json +1 -1
package/dist/exec.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
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 $
|
|
1
|
+
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, ag as BCallRecord, ah as BClassSpec, ai as BMemberDiag, aj as DEFAULT_MAX_LOOP_ITERS, ap as NudoThrow, aq as RunTranspiledOptions, ar as TranspileOptions, as as TranspiledCallResult, aD as asAbsVal, aJ as callTranspiledExport, aK as callTranspiledExportFull, aL as clearBClasses, aQ as currentExecPhi, b1 as getAbsOrigin, b2 as getBCallCollector, b3 as getBClass, b8 as isDefinitelyFalse, b9 as isDefinitelyTrue, bb as isNudoThrow, bj as litTruth, bp as namespaceNameOf, bt as noteMemberDispatchMiss, bu as notePrimMemberMissing, bv as noteUnknownMemberMissing, bK as recordMemberDiag, bL as registerBClass, bO as runTranspiled, bU as setBCallCollector, bV as setMemberDiagCollector, c3 as tagAbsOrigin, c8 as transpile, c9 as transpileExpression, ca as transpileFile, cb as transpileSource, cj as withExecPhi } from './index-DgyudAkw.js';
|
|
2
2
|
import '@babel/types';
|
package/dist/exec.js
CHANGED
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
$optionalGet,
|
|
41
41
|
$optionalInvoke,
|
|
42
42
|
$orDefault,
|
|
43
|
+
$regex,
|
|
43
44
|
$set,
|
|
44
45
|
$setKey,
|
|
45
46
|
$spread,
|
|
@@ -67,6 +68,8 @@ import {
|
|
|
67
68
|
isDefinitelyFalse,
|
|
68
69
|
isDefinitelyTrue,
|
|
69
70
|
isNudoThrow,
|
|
71
|
+
litTruth,
|
|
72
|
+
namespaceNameOf,
|
|
70
73
|
noteMemberDispatchMiss,
|
|
71
74
|
notePrimMemberMissing,
|
|
72
75
|
noteUnknownMemberMissing,
|
|
@@ -81,7 +84,7 @@ import {
|
|
|
81
84
|
transpileFile,
|
|
82
85
|
transpileSource,
|
|
83
86
|
withExecPhi
|
|
84
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-N7E2A7IK.js";
|
|
85
88
|
export {
|
|
86
89
|
$add,
|
|
87
90
|
$arr,
|
|
@@ -124,6 +127,7 @@ export {
|
|
|
124
127
|
$optionalGet,
|
|
125
128
|
$optionalInvoke,
|
|
126
129
|
$orDefault,
|
|
130
|
+
$regex,
|
|
127
131
|
$set,
|
|
128
132
|
$setKey,
|
|
129
133
|
$spread,
|
|
@@ -151,6 +155,8 @@ export {
|
|
|
151
155
|
isDefinitelyFalse,
|
|
152
156
|
isDefinitelyTrue,
|
|
153
157
|
isNudoThrow,
|
|
158
|
+
litTruth,
|
|
159
|
+
namespaceNameOf,
|
|
154
160
|
noteMemberDispatchMiss,
|
|
155
161
|
notePrimMemberMissing,
|
|
156
162
|
noteUnknownMemberMissing,
|
|
@@ -593,6 +593,8 @@ declare function asAbsVal(v: unknown): Abs;
|
|
|
593
593
|
declare function $fnVal(params: string[], impl: (...args: Abs[]) => Abs): Abs;
|
|
594
594
|
/** 字面量 → Abs(transpile 侧数字/字符串/布尔/null/undefined) */
|
|
595
595
|
declare function $lit(v: unknown): Abs;
|
|
596
|
+
/** JS 真值:字面量按 Boolean(v);对象形恒真;不可判 → undefined */
|
|
597
|
+
declare function litTruth(a: Abs): boolean | undefined;
|
|
596
598
|
declare function isDefinitelyTrue(a: Abs): boolean;
|
|
597
599
|
declare function isDefinitelyFalse(a: Abs): boolean;
|
|
598
600
|
/**
|
|
@@ -616,11 +618,11 @@ declare function $forIter(init: Abs, test: (s: Abs) => Abs, step: (s: Abs) => Ab
|
|
|
616
618
|
declare function $for(init: Abs, test: (s: Abs) => Abs, step: (s: Abs) => Abs, body: (s: Abs) => Abs, maxIters?: number): Abs;
|
|
617
619
|
/** 数组字面量 → Abs tuple(长度已知) */
|
|
618
620
|
declare function $arr(items: Abs[]): Abs;
|
|
619
|
-
/** 下标读 a[i];字面量 i 走 tuple
|
|
621
|
+
/** 下标读 a[i];字面量 i 走 tuple 精确投影,否则并所有元素;string[i] → 单字符 */
|
|
620
622
|
declare function $idx(a: Abs, i: Abs): Abs;
|
|
621
|
-
/** 下标写 a[i]=v → 新 tuple */
|
|
623
|
+
/** 下标写 a[i]=v → 新 tuple(越界写按 JS 语义增长,空洞为 undefined) */
|
|
622
624
|
declare function $idxSet(a: Abs, i: Abs, value: Abs): Abs;
|
|
623
|
-
/**
|
|
625
|
+
/** 数组/字符串长度 */
|
|
624
626
|
declare function $len(a: Abs): Abs;
|
|
625
627
|
/** 对象字面量 → Abs obj */
|
|
626
628
|
declare function $obj(slots: Record<string, Abs>): Abs;
|
|
@@ -635,6 +637,13 @@ declare function $elems(a: Abs): Abs[];
|
|
|
635
637
|
* body(item, i) 可返回 void;状态由外部 JS 变量承接。
|
|
636
638
|
*/
|
|
637
639
|
declare function $forOf(iterable: Abs, body: (item: Abs, index: Abs) => void, maxIters?: number): void;
|
|
640
|
+
/**
|
|
641
|
+
* 命名空间身份表:transpile 后 `Math.max(0, x)` 的接收者是宿主 JS 全局对象
|
|
642
|
+
* (非 Abs)。按对象身份识别命名空间,路由到 Abs builtin 表。
|
|
643
|
+
*/
|
|
644
|
+
declare function namespaceNameOf(v: unknown): string | undefined;
|
|
645
|
+
/** 正则字面量 → RegExp brand(source/flags 进 slots,供 exec/test 精确执行) */
|
|
646
|
+
declare function $regex(pattern: string, flags?: string): Abs;
|
|
638
647
|
/** 成员读:obj.slots[key];缺失 → undefined 字面量;brand 解包内层 */
|
|
639
648
|
declare function $get(o: Abs, key: string, opts?: {
|
|
640
649
|
silent?: boolean;
|
|
@@ -899,4 +908,4 @@ declare function callTranspiledExportFull(exports: Record<string, unknown>, name
|
|
|
899
908
|
/** 调用 runTranspiled 导出(仅结果) */
|
|
900
909
|
declare function callTranspiledExport(exports: Record<string, unknown>, name: string, args: Abs[]): Abs;
|
|
901
910
|
|
|
902
|
-
export { $add as $, type AstEnv as A, $invoke as B, type Confidence as C, $invokeSuper as D, $join as E, $le as F, $len as G, type HofSite as H, $lit as I, $lt as J, $mod as K, type LeakBudget as L, $mul as M, $ne as N, $neg as O, type Phi as P, $new as Q, type RelSource as R, type Shape as S, type Term as T, $not as U, $obj as V, $optionalGet as W, $optionalInvoke as X, $orDefault as Y, $
|
|
911
|
+
export { $add as $, type AstEnv as A, $invoke as B, type Confidence as C, $invokeSuper as D, $join as E, $le as F, $len as G, type HofSite as H, $lit as I, $lt as J, $mod as K, type LeakBudget as L, $mul as M, $ne as N, $neg as O, type Phi as P, $new as Q, type RelSource as R, type Shape as S, type Term as T, $not as U, $obj as V, $optionalGet as W, $optionalInvoke as X, $orDefault as Y, $regex as Z, $set as _, type Abs as a, ge as a$, $setKey as a0, $spread as a1, $staticInvoke as a2, $sub as a3, $super as a4, $switch as a5, $thisGet as a6, $thisSet as a7, $throw as a8, $typeof as a9, applyAbsFn as aA, applyCallbackAbs as aB, asAbs as aC, asAbsVal as aD, betaOf as aE, bindImports as aF, bool as aG, boolLit as aH, callFunction as aI, callTranspiledExport as aJ, callTranspiledExportFull as aK, clearBClasses as aL, collectAbsExports as aM, collectAbsNodeTypes as aN, confJoin as aO, createHofCollectCtx as aP, currentExecPhi as aQ, defaultLeakBudget as aR, emptyEnv as aS, emptyPhi as aT, eq as aU, evalMethodBody as aV, evalNode as aW, evalProgramAbs as aX, evalSource as aY, exceedsBudget as aZ, findAbsAtPosition as a_, $while as aa, $whileSeq as ab, $yield as ac, type AbsAssignRecord as ad, type AbsCallRecord as ae, type AbsModuleExports as af, type BCallRecord as ag, type BClassSpec as ah, type BMemberDiag as ai, DEFAULT_MAX_LOOP_ITERS as aj, type EvalOptions as ak, type EvalResult as al, type HofCollectCtx as am, MAX_CALL_DEPTH as an, MAX_TOTAL_CALLS as ao, NudoThrow as ap, type RunTranspiledOptions as aq, type TranspileOptions as ar, type TranspiledCallResult as as, abs as at, absToString as au, alphaOf as av, analyzeFn as aw, and as ax, anyVar as ay, app as az, type Pred as b, strLit as b$, geNum as b0, getAbsOrigin as b1, getBCallCollector as b2, getBClass as b3, gt as b4, gtNum as b5, implies as b6, instantiateReturn as b7, isDefinitelyFalse as b8, isDefinitelyTrue as b9, or as bA, pFalse as bB, pTrue as bC, phiAnd as bD, predEquals as bE, predToString as bF, predVars as bG, projectFlatMapResult as bH, promoteParamShape as bI, ptypeof as bJ, recordMemberDiag as bK, registerBClass as bL, resetAbsCallBudget as bM, resetLeakCounter as bN, runTranspiled as bO, setAbsAssignCollector as bP, setAbsCallCollector as bQ, setAbsNodeCollector as bR, setAbsTruncationCollector as bS, setApplyCallbackHost as bT, setBCallCollector as bU, setMemberDiagCollector as bV, shapeOfTerm as bW, shapeToString as bX, simplifyTerm as bY, snapshotAbs as bZ, str as b_, isExactLit as ba, isNudoThrow as bb, isNumPrim as bc, isRelFn as bd, isStrPrim as be, le as bf, leNum as bg, leakIfNeeded as bh, lit as bi, litTruth as bj, litValue as bk, lt as bl, ltNum as bm, mapElementFallback as bn, maybeLeak as bo, namespaceNameOf as bp, ne as bq, never as br, not as bs, noteMemberDispatchMiss as bt, notePrimMemberMissing as bu, noteUnknownMemberMissing as bv, num as bw, numLit as bx, numVar as by, obj as bz, type PrimName as c, substAbs as c0, substPred as c1, substPredAbs as c2, tagAbsOrigin as c3, termDepth as c4, termEquals as c5, termNodes as c6, termToString as c7, transpile as c8, transpileExpression as c9, transpileFile as ca, transpileSource as cb, tryPromoteDirectCall as cc, tryPromoteForOfIteratee as cd, tryPromoteHofCallback as ce, tryPromoteReceiverAsArr as cf, undefAbs as cg, unknown as ch, v as ci, withExecPhi as cj, withVar as ck, $arr as d, $async as e, $asyncReturn as f, $await as g, $call as h, $callNamed as i, $catchVal as j, $class as k, $concat as l, $div as m, $elems as n, $eq as o, $fnVal as p, $for as q, $forIter as r, $forOf as s, $fork as t, $ge as u, $gen as v, $get as w, $gt as x, $idx as y, $idxSet as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
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-
|
|
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 $
|
|
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
6
|
lookup(name: string): TypeValue;
|
package/dist/index.js
CHANGED
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
$optionalGet,
|
|
41
41
|
$optionalInvoke,
|
|
42
42
|
$orDefault,
|
|
43
|
+
$regex,
|
|
43
44
|
$set,
|
|
44
45
|
$setKey,
|
|
45
46
|
$spread,
|
|
@@ -159,6 +160,7 @@ import {
|
|
|
159
160
|
leakIfNeeded,
|
|
160
161
|
leqAbs,
|
|
161
162
|
lit,
|
|
163
|
+
litTruth,
|
|
162
164
|
litValue,
|
|
163
165
|
lookupMethod,
|
|
164
166
|
lookupMethodWithOwner,
|
|
@@ -170,6 +172,7 @@ import {
|
|
|
170
172
|
maybeLeak,
|
|
171
173
|
mod,
|
|
172
174
|
mul,
|
|
175
|
+
namespaceNameOf,
|
|
173
176
|
ne,
|
|
174
177
|
negAbs,
|
|
175
178
|
never,
|
|
@@ -248,7 +251,7 @@ import {
|
|
|
248
251
|
withExecPhi,
|
|
249
252
|
withVar,
|
|
250
253
|
wrapPromise
|
|
251
|
-
} from "./chunk-
|
|
254
|
+
} from "./chunk-N7E2A7IK.js";
|
|
252
255
|
|
|
253
256
|
// src/refinements/template-predicates.ts
|
|
254
257
|
function isTemplate(tv) {
|
|
@@ -1178,6 +1181,7 @@ function formatShape(a) {
|
|
|
1178
1181
|
return "unknown";
|
|
1179
1182
|
case "prim": {
|
|
1180
1183
|
const lv = litValue(a);
|
|
1184
|
+
if (typeof lv === "number" && !Number.isFinite(lv)) return String(lv);
|
|
1181
1185
|
if (lv !== void 0) return JSON.stringify(lv);
|
|
1182
1186
|
return s.type;
|
|
1183
1187
|
}
|
|
@@ -1486,7 +1490,7 @@ function collectConstraints(source, opts) {
|
|
|
1486
1490
|
}
|
|
1487
1491
|
function extractRefineLines(source, fnName) {
|
|
1488
1492
|
const fnRe = new RegExp(
|
|
1489
|
-
`(?:export\\s+default\\s+)?(?:function\\s+${fnName}\\b|const\\s+${fnName}\\s*=)`
|
|
1493
|
+
`(?:export\\s+(?:default\\s+)?)?(?:async\\s+)?(?:function\\s+${fnName}\\b|const\\s+${fnName}\\s*=)`
|
|
1490
1494
|
);
|
|
1491
1495
|
const m = source.match(fnRe);
|
|
1492
1496
|
if (!m || m.index === void 0) return [];
|
|
@@ -4514,6 +4518,10 @@ function absToTypeValue(a) {
|
|
|
4514
4518
|
result = T.never;
|
|
4515
4519
|
break;
|
|
4516
4520
|
case "unknown":
|
|
4521
|
+
if (a.term?.op === "lit" && a.term.value === null) {
|
|
4522
|
+
result = T.literal(null);
|
|
4523
|
+
break;
|
|
4524
|
+
}
|
|
4517
4525
|
result = T.unknown;
|
|
4518
4526
|
break;
|
|
4519
4527
|
case "any":
|
|
@@ -4822,6 +4830,7 @@ export {
|
|
|
4822
4830
|
$optionalGet,
|
|
4823
4831
|
$optionalInvoke,
|
|
4824
4832
|
$orDefault,
|
|
4833
|
+
$regex,
|
|
4825
4834
|
$set,
|
|
4826
4835
|
$setKey,
|
|
4827
4836
|
$spread,
|
|
@@ -5007,6 +5016,7 @@ export {
|
|
|
5007
5016
|
leqAbs,
|
|
5008
5017
|
listFunctionNames,
|
|
5009
5018
|
lit,
|
|
5019
|
+
litTruth,
|
|
5010
5020
|
litValue,
|
|
5011
5021
|
loadModuleDepsFingerprint,
|
|
5012
5022
|
lookupMethod,
|
|
@@ -5022,6 +5032,7 @@ export {
|
|
|
5022
5032
|
mockHelperToTypeValue,
|
|
5023
5033
|
mod,
|
|
5024
5034
|
mul,
|
|
5035
|
+
namespaceNameOf,
|
|
5025
5036
|
narrowType,
|
|
5026
5037
|
ne,
|
|
5027
5038
|
negAbs,
|