nudojs 1.3.12 → 1.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +187 -33
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -21800,7 +21800,58 @@ function narrowTypeArmThunk(thunk, guard, arm, forkBindingNames) {
|
|
|
21800
21800
|
const keep = arm === guard.arm;
|
|
21801
21801
|
return `((${guard.name}) => ${thunk})($narrowTypeOf(${guard.name}, ${JSON.stringify(guard.typeOf)}, ${keep}))`;
|
|
21802
21802
|
}
|
|
21803
|
-
|
|
21803
|
+
function discriminantGuardOf(test) {
|
|
21804
|
+
const t = test;
|
|
21805
|
+
if (t?.type !== "BinaryExpression") return void 0;
|
|
21806
|
+
if (t.operator !== "===" && t.operator !== "!==") return void 0;
|
|
21807
|
+
const lm = memberGuardTarget(t.left);
|
|
21808
|
+
const rm = memberGuardTarget(t.right);
|
|
21809
|
+
const m = lm !== void 0 && isPrimLitNode(t.right) ? { target: lm, lit: t.right } : rm !== void 0 && isPrimLitNode(t.left) ? { target: rm, lit: t.left } : void 0;
|
|
21810
|
+
if (!m) return void 0;
|
|
21811
|
+
return {
|
|
21812
|
+
name: m.target.name,
|
|
21813
|
+
key: m.target.key,
|
|
21814
|
+
value: m.lit.value,
|
|
21815
|
+
arm: t.operator === "===" ? "cons" : "alt"
|
|
21816
|
+
};
|
|
21817
|
+
}
|
|
21818
|
+
function discriminantGuardsOf(test) {
|
|
21819
|
+
const t = test;
|
|
21820
|
+
if (t?.type === "LogicalExpression" && (t.operator === "&&" || t.operator === "||")) {
|
|
21821
|
+
const wantArm = t.operator === "&&" ? "cons" : "alt";
|
|
21822
|
+
const out = [];
|
|
21823
|
+
for (const g2 of [...discriminantGuardsOf(t.left), ...discriminantGuardsOf(t.right)]) {
|
|
21824
|
+
if (g2.arm !== wantArm) continue;
|
|
21825
|
+
if (out.some((x) => x.name === g2.name && x.key === g2.key && x.value === g2.value)) continue;
|
|
21826
|
+
out.push(g2);
|
|
21827
|
+
}
|
|
21828
|
+
return out;
|
|
21829
|
+
}
|
|
21830
|
+
const g = discriminantGuardOf(test);
|
|
21831
|
+
return g ? [g] : [];
|
|
21832
|
+
}
|
|
21833
|
+
function narrowDiscriminantArmThunks(thunk, guards, arm, forkBindingNames) {
|
|
21834
|
+
if (!guards || guards.length === 0) return thunk;
|
|
21835
|
+
const matching = guards.filter((g) => g.arm === arm);
|
|
21836
|
+
if (matching.length === 0) return thunk;
|
|
21837
|
+
const names2 = forkBindingNames instanceof Set ? forkBindingNames : new Set(forkBindingNames);
|
|
21838
|
+
if (matching.some((g) => names2.has(g.name))) return thunk;
|
|
21839
|
+
const byName = /* @__PURE__ */ new Map();
|
|
21840
|
+
for (const g of matching) {
|
|
21841
|
+
const list = byName.get(g.name) ?? [];
|
|
21842
|
+
if (!list.some((x) => x.key === g.key && x.value === g.value)) list.push(g);
|
|
21843
|
+
byName.set(g.name, list);
|
|
21844
|
+
}
|
|
21845
|
+
const params = [...byName.keys()].join(", ");
|
|
21846
|
+
const args = [...byName.entries()].map(
|
|
21847
|
+
([name, gs]) => gs.reduce(
|
|
21848
|
+
(acc, g) => `$narrowMemberEq(${acc}, ${JSON.stringify(g.key)}, ${JSON.stringify(g.value)}, true)`,
|
|
21849
|
+
name
|
|
21850
|
+
)
|
|
21851
|
+
).join(", ");
|
|
21852
|
+
return `((${params}) => ${thunk})(${args})`;
|
|
21853
|
+
}
|
|
21854
|
+
var TYPEOF_NAMES2, isStrLitNode, typeofArgName, memberGuardTarget, assignGuardTarget, isPrimLitNode;
|
|
21804
21855
|
var init_stmt_predicates = __esm({
|
|
21805
21856
|
"../core/src/algebra/exec/transpile/stmt-predicates.ts"() {
|
|
21806
21857
|
"use strict";
|
|
@@ -21844,6 +21895,13 @@ var init_stmt_predicates = __esm({
|
|
|
21844
21895
|
}
|
|
21845
21896
|
return void 0;
|
|
21846
21897
|
};
|
|
21898
|
+
isPrimLitNode = (n) => {
|
|
21899
|
+
const t = n;
|
|
21900
|
+
if (t?.type === "StringLiteral") return typeof t.value === "string";
|
|
21901
|
+
if (t?.type === "NumericLiteral") return typeof t.value === "number";
|
|
21902
|
+
if (t?.type === "BooleanLiteral") return typeof t.value === "boolean";
|
|
21903
|
+
return false;
|
|
21904
|
+
};
|
|
21847
21905
|
}
|
|
21848
21906
|
});
|
|
21849
21907
|
|
|
@@ -21941,14 +21999,20 @@ function transpileFnBodyStmts(stmtsIn, depth, opts, varScope) {
|
|
|
21941
21999
|
const testRebinds = testRecvs.size ? emitArrMutatorRebinds(stmt.test, scopedOpts, pad) : [];
|
|
21942
22000
|
const earlyGuards = nullishGuardsOf(stmt.test);
|
|
21943
22001
|
const earlyTGuard = typeGuardOf(stmt.test);
|
|
21944
|
-
const
|
|
21945
|
-
|
|
21946
|
-
|
|
21947
|
-
|
|
22002
|
+
const earlyDGuards = discriminantGuardsOf(stmt.test);
|
|
22003
|
+
const consNarrowed = narrowDiscriminantArmThunks(
|
|
22004
|
+
narrowTypeArmThunk(
|
|
22005
|
+
narrowNullishArmThunks(
|
|
22006
|
+
transpileBlockAsThunk(stmt.consequent, depth, scopedOpts),
|
|
22007
|
+
earlyGuards,
|
|
22008
|
+
"cons",
|
|
22009
|
+
recvSet
|
|
22010
|
+
),
|
|
22011
|
+
earlyTGuard,
|
|
21948
22012
|
"cons",
|
|
21949
22013
|
recvSet
|
|
21950
22014
|
),
|
|
21951
|
-
|
|
22015
|
+
earlyDGuards,
|
|
21952
22016
|
"cons",
|
|
21953
22017
|
recvSet
|
|
21954
22018
|
);
|
|
@@ -21957,9 +22021,14 @@ function transpileFnBodyStmts(stmtsIn, depth, opts, varScope) {
|
|
|
21957
22021
|
const altThunk = `() => {
|
|
21958
22022
|
${altBody}
|
|
21959
22023
|
${pad}}`;
|
|
21960
|
-
const altNarrowed =
|
|
21961
|
-
|
|
21962
|
-
|
|
22024
|
+
const altNarrowed = narrowDiscriminantArmThunks(
|
|
22025
|
+
narrowTypeArmThunk(
|
|
22026
|
+
narrowNullishArmThunks(altThunk, earlyGuards, "alt", recvSet),
|
|
22027
|
+
earlyTGuard,
|
|
22028
|
+
"alt",
|
|
22029
|
+
recvSet
|
|
22030
|
+
),
|
|
22031
|
+
earlyDGuards,
|
|
21963
22032
|
"alt",
|
|
21964
22033
|
recvSet
|
|
21965
22034
|
);
|
|
@@ -22290,15 +22359,26 @@ ${pad}export default ${name};`;
|
|
|
22290
22359
|
}) : null;
|
|
22291
22360
|
const guards = nullishGuardsOf(stmt.test);
|
|
22292
22361
|
const tguard = typeGuardOf(stmt.test);
|
|
22293
|
-
const
|
|
22294
|
-
|
|
22295
|
-
|
|
22362
|
+
const dguards = discriminantGuardsOf(stmt.test);
|
|
22363
|
+
const consNarrowed = narrowDiscriminantArmThunks(
|
|
22364
|
+
narrowTypeArmThunk(
|
|
22365
|
+
narrowNullishArmThunks(consRaw, guards, "cons", recvSet),
|
|
22366
|
+
tguard,
|
|
22367
|
+
"cons",
|
|
22368
|
+
recvSet
|
|
22369
|
+
),
|
|
22370
|
+
dguards,
|
|
22296
22371
|
"cons",
|
|
22297
22372
|
recvSet
|
|
22298
22373
|
);
|
|
22299
|
-
const altNarrowed = altRaw === null ? null :
|
|
22300
|
-
|
|
22301
|
-
|
|
22374
|
+
const altNarrowed = altRaw === null ? null : narrowDiscriminantArmThunks(
|
|
22375
|
+
narrowTypeArmThunk(
|
|
22376
|
+
narrowNullishArmThunks(altRaw, guards, "alt", recvSet),
|
|
22377
|
+
tguard,
|
|
22378
|
+
"alt",
|
|
22379
|
+
recvSet
|
|
22380
|
+
),
|
|
22381
|
+
dguards,
|
|
22302
22382
|
"alt",
|
|
22303
22383
|
recvSet
|
|
22304
22384
|
);
|
|
@@ -23247,14 +23327,27 @@ function transpileShortCircuitExpr(opts, parts) {
|
|
|
23247
23327
|
consExpr = apply(consExpr, "cons");
|
|
23248
23328
|
altExpr = apply(altExpr, "alt");
|
|
23249
23329
|
}
|
|
23330
|
+
const applyDisc = (src, arm) => narrowDiscriminantArmThunks(src, parts.discGuards, arm, []);
|
|
23331
|
+
consExpr = applyDisc(consExpr, "cons");
|
|
23332
|
+
altExpr = applyDisc(altExpr, "alt");
|
|
23250
23333
|
return `$fork(${forkTest2}, () => ${consExpr}, () => ${altExpr})`;
|
|
23251
23334
|
}
|
|
23252
23335
|
const consLines = parts.consSrc === "__test" ? [`return __test;`] : consRebinds.length === 0 ? [`return (${parts.consSrc});`] : [`const __v = (${parts.consSrc});`, ...consRebinds, `return __v;`];
|
|
23253
23336
|
const altLines = parts.altSrc === "__test" ? [`return __test;`] : altRebinds.length === 0 ? [`return (${parts.altSrc});`] : [`const __v = (${parts.altSrc});`, ...altRebinds, `return __v;`];
|
|
23254
23337
|
const forkTest = parts.testSrc ?? "__test";
|
|
23255
23338
|
const guards = parts.narrowGuards;
|
|
23256
|
-
const consFinal =
|
|
23257
|
-
|
|
23339
|
+
const consFinal = narrowDiscriminantArmThunks(
|
|
23340
|
+
narrowNullishArmThunks(forkArmThunk(consLines, "fk1_", names2), guards, "cons", names2),
|
|
23341
|
+
parts.discGuards,
|
|
23342
|
+
"cons",
|
|
23343
|
+
names2
|
|
23344
|
+
);
|
|
23345
|
+
const altFinal = narrowDiscriminantArmThunks(
|
|
23346
|
+
narrowNullishArmThunks(forkArmThunk(altLines, "fk2_", names2), guards, "alt", names2),
|
|
23347
|
+
parts.discGuards,
|
|
23348
|
+
"alt",
|
|
23349
|
+
names2
|
|
23350
|
+
);
|
|
23258
23351
|
return [
|
|
23259
23352
|
`(() => {`,
|
|
23260
23353
|
` const __test = (${parts.alwaysSrc});`,
|
|
@@ -23478,6 +23571,7 @@ ${inner}
|
|
|
23478
23571
|
}
|
|
23479
23572
|
const leftGuards = nullishGuardsOf(expr.left);
|
|
23480
23573
|
const andTypeGuard = typeGuardOf(expr.left);
|
|
23574
|
+
const leftDiscGuards = discriminantGuardsOf(expr.left);
|
|
23481
23575
|
return op === "&&" ? transpileShortCircuitExpr(opts, {
|
|
23482
23576
|
alwaysNodes: [lNode],
|
|
23483
23577
|
alwaysSrc: l,
|
|
@@ -23486,7 +23580,8 @@ ${inner}
|
|
|
23486
23580
|
altSrc: "__test",
|
|
23487
23581
|
altNodes: [],
|
|
23488
23582
|
narrowGuards: leftGuards.filter((g) => g.arm === "cons"),
|
|
23489
|
-
typeGuard: andTypeGuard
|
|
23583
|
+
typeGuard: andTypeGuard,
|
|
23584
|
+
discGuards: leftDiscGuards.filter((g) => g.arm === "cons")
|
|
23490
23585
|
}) : transpileShortCircuitExpr(opts, {
|
|
23491
23586
|
alwaysNodes: [lNode],
|
|
23492
23587
|
alwaysSrc: l,
|
|
@@ -23495,7 +23590,8 @@ ${inner}
|
|
|
23495
23590
|
altSrc: r,
|
|
23496
23591
|
altNodes: [rNode],
|
|
23497
23592
|
narrowGuards: leftGuards.filter((g) => g.arm === "alt"),
|
|
23498
|
-
typeGuard: andTypeGuard
|
|
23593
|
+
typeGuard: andTypeGuard,
|
|
23594
|
+
discGuards: leftDiscGuards.filter((g) => g.arm === "alt")
|
|
23499
23595
|
});
|
|
23500
23596
|
}
|
|
23501
23597
|
case "ConditionalExpression": {
|
|
@@ -23514,9 +23610,11 @@ ${inner}
|
|
|
23514
23610
|
altNodes: [altNode],
|
|
23515
23611
|
// 三元的 nullish/typeof 守卫臂收窄(issue #97:`p === null ? -1 : p.major`;
|
|
23516
23612
|
// Bug 23:`typeof v === "string" ? v + "!" : 0`;#118 v3/#120:多名复合
|
|
23517
|
-
// `obj == null || node.p == null ? … : node.p.name`
|
|
23613
|
+
// `obj == null || node.p == null ? … : node.p.name` 一臂多事实);
|
|
23614
|
+
// 判别等值守卫(issue #126):`node.type === 'TL' ? node.quasis[0] : null`
|
|
23518
23615
|
narrowGuards: nullishGuardsOf(expr.test),
|
|
23519
|
-
typeGuard: typeGuardOf(expr.test)
|
|
23616
|
+
typeGuard: typeGuardOf(expr.test),
|
|
23617
|
+
discGuards: discriminantGuardsOf(expr.test)
|
|
23520
23618
|
});
|
|
23521
23619
|
}
|
|
23522
23620
|
case "RegExpLiteral": {
|
|
@@ -24273,7 +24371,7 @@ function transpileSource(source, opts = {}) {
|
|
|
24273
24371
|
return transpileFile(file, { ...opts, source: opts.source ?? source });
|
|
24274
24372
|
}
|
|
24275
24373
|
function runtimeImportOf(runtime) {
|
|
24276
|
-
return `import { $absVal, $add, $sub, $mul, $div, $mod, $bitand, $bitor, $bitxor, $bitnot, $shl, $shr, $ushr, $pow, $toNumber, $toNumeric, $updateAdd, $updateSub, $in, $instanceof, $instanceofNonIdent, $classExpr, $del, $delRes, $objAccessor, $objAccessorKey, $neg, $typeof, $not, $eq, $ne, $eqLoose, $neLoose, $lt, $le, $gt, $ge, $join, $lit, $fork, $for, $forIter, $obj, $get, $set, $setProto, $while, $whileSeq, $arr, $arrWithHoles, $arrMutContainer, $idx, $idxSet, $len, $call, $throw, $loopReturn, $loopBreak, $loopContinue, $class, $new, $invoke, $invokeSuper, $invokeSuperObj, $invokeSuperKey, $getSuper, $getSuperObj, $super, $async, $copy, $await, $asyncReturn, $orDefault, $callNamed, $optionalGet, $optionalInvoke, $spread, $concat, $forOf, $forInKeys, $iterCheck, $catchVal, $switch, $staticInvoke, $setKey, $gen, $newTarget, $staticInit, $yield, $fnVal, $regex, $reStateCall, $rethrowIfNudoReturn, $nullishTest, $removeNullish, $removeNull, $removeUndefined, $removeMemberNullish, $narrowTypeOf, $tryMark, $assignRecord, $recordBinding, $unknown, $importMeta, $dynamicImport, $tryTakeSince, $tryCurrentMark, $tryPopMark, $tryDigestSoftCatch, $tryReleaseSoftOut, $tryDetachSoftCatch, $tryDiscardSoft, $tryOrphanSoft, $pushLoopExit, $objRest, $arrRest, $elems, $arguments, $isForkExit, $rawThis, $isBreakTo, $yieldStar, $tpl } from ${JSON.stringify(runtime)};`;
|
|
24374
|
+
return `import { $absVal, $add, $sub, $mul, $div, $mod, $bitand, $bitor, $bitxor, $bitnot, $shl, $shr, $ushr, $pow, $toNumber, $toNumeric, $updateAdd, $updateSub, $in, $instanceof, $instanceofNonIdent, $classExpr, $del, $delRes, $objAccessor, $objAccessorKey, $neg, $typeof, $not, $eq, $ne, $eqLoose, $neLoose, $lt, $le, $gt, $ge, $join, $lit, $fork, $for, $forIter, $obj, $get, $set, $setProto, $while, $whileSeq, $arr, $arrWithHoles, $arrMutContainer, $idx, $idxSet, $len, $call, $throw, $loopReturn, $loopBreak, $loopContinue, $class, $new, $invoke, $invokeSuper, $invokeSuperObj, $invokeSuperKey, $getSuper, $getSuperObj, $super, $async, $copy, $await, $asyncReturn, $orDefault, $callNamed, $optionalGet, $optionalInvoke, $spread, $concat, $forOf, $forInKeys, $iterCheck, $catchVal, $switch, $staticInvoke, $setKey, $gen, $newTarget, $staticInit, $yield, $fnVal, $regex, $reStateCall, $rethrowIfNudoReturn, $nullishTest, $removeNullish, $removeNull, $removeUndefined, $removeMemberNullish, $narrowMemberEq, $narrowTypeOf, $tryMark, $assignRecord, $recordBinding, $unknown, $importMeta, $dynamicImport, $tryTakeSince, $tryCurrentMark, $tryPopMark, $tryDigestSoftCatch, $tryReleaseSoftOut, $tryDetachSoftCatch, $tryDiscardSoft, $tryOrphanSoft, $pushLoopExit, $objRest, $arrRest, $elems, $arguments, $isForkExit, $rawThis, $isBreakTo, $yieldStar, $tpl } from ${JSON.stringify(runtime)};`;
|
|
24277
24375
|
}
|
|
24278
24376
|
function transpileFile(file, opts = {}) {
|
|
24279
24377
|
const runtime = opts.runtimeImport ?? "@nudojs/core/exec";
|
|
@@ -24294,7 +24392,7 @@ function transpileFile(file, opts = {}) {
|
|
|
24294
24392
|
};
|
|
24295
24393
|
const lines = [
|
|
24296
24394
|
`// nudo evaluator transpile \u2014 values are Abs; operators are overloaded calls`,
|
|
24297
|
-
`import { $absVal, $add, $sub, $mul, $div, $mod, $bitand, $bitor, $bitxor, $bitnot, $shl, $shr, $ushr, $pow, $toNumber, $toNumeric, $updateAdd, $updateSub, $in, $instanceof, $instanceofNonIdent, $classExpr, $del, $delRes, $objAccessor, $objAccessorKey, $neg, $typeof, $not, $eq, $ne, $eqLoose, $neLoose, $lt, $le, $gt, $ge, $join, $lit, $fork, $for, $forIter, $obj, $get, $set, $setProto, $while, $whileSeq, $arr, $arrWithHoles, $arrMutContainer, $idx, $idxSet, $len, $call, $throw, $loopReturn, $loopBreak, $loopContinue, $class, $new, $invoke, $invokeSuper, $invokeSuperObj, $invokeSuperKey, $getSuper, $getSuperObj, $super, $async, $copy, $await, $asyncReturn, $orDefault, $callNamed, $optionalGet, $optionalInvoke, $spread, $concat, $forOf, $forInKeys, $iterCheck, $catchVal, $switch, $staticInvoke, $setKey, $gen, $newTarget, $staticInit, $yield, $fnVal, $regex, $reStateCall, $rethrowIfNudoReturn, $nullishTest, $removeNullish, $removeNull, $removeUndefined, $removeMemberNullish, $narrowTypeOf, $tryMark, $assignRecord, $recordBinding, $unknown, $importMeta, $dynamicImport, $tryTakeSince, $tryCurrentMark, $tryPopMark, $tryDigestSoftCatch, $tryReleaseSoftOut, $tryDetachSoftCatch, $tryDiscardSoft, $tryOrphanSoft, $pushLoopExit, $objRest, $arrRest, $elems, $arguments, $isForkExit, $rawThis, $isBreakTo, $yieldStar, $tpl } from ${JSON.stringify(runtime)};`,
|
|
24395
|
+
`import { $absVal, $add, $sub, $mul, $div, $mod, $bitand, $bitor, $bitxor, $bitnot, $shl, $shr, $ushr, $pow, $toNumber, $toNumeric, $updateAdd, $updateSub, $in, $instanceof, $instanceofNonIdent, $classExpr, $del, $delRes, $objAccessor, $objAccessorKey, $neg, $typeof, $not, $eq, $ne, $eqLoose, $neLoose, $lt, $le, $gt, $ge, $join, $lit, $fork, $for, $forIter, $obj, $get, $set, $setProto, $while, $whileSeq, $arr, $arrWithHoles, $arrMutContainer, $idx, $idxSet, $len, $call, $throw, $loopReturn, $loopBreak, $loopContinue, $class, $new, $invoke, $invokeSuper, $invokeSuperObj, $invokeSuperKey, $getSuper, $getSuperObj, $super, $async, $copy, $await, $asyncReturn, $orDefault, $callNamed, $optionalGet, $optionalInvoke, $spread, $concat, $forOf, $forInKeys, $iterCheck, $catchVal, $switch, $staticInvoke, $setKey, $gen, $newTarget, $staticInit, $yield, $fnVal, $regex, $reStateCall, $rethrowIfNudoReturn, $nullishTest, $removeNullish, $removeNull, $removeUndefined, $removeMemberNullish, $narrowMemberEq, $narrowTypeOf, $tryMark, $assignRecord, $recordBinding, $unknown, $importMeta, $dynamicImport, $tryTakeSince, $tryCurrentMark, $tryPopMark, $tryDigestSoftCatch, $tryReleaseSoftOut, $tryDetachSoftCatch, $tryDiscardSoft, $tryOrphanSoft, $pushLoopExit, $objRest, $arrRest, $elems, $arguments, $isForkExit, $rawThis, $isBreakTo, $yieldStar, $tpl } from ${JSON.stringify(runtime)};`,
|
|
24298
24396
|
``
|
|
24299
24397
|
];
|
|
24300
24398
|
if (varHoistLine) lines.push(varHoistLine);
|
|
@@ -28324,6 +28422,58 @@ function $narrowTypeOf(a, typeOf2, keep) {
|
|
|
28324
28422
|
if (kept.length === 0) return a;
|
|
28325
28423
|
return kept.length === 1 ? kept[0] : { ...a, shape: { k: "sum", members: kept } };
|
|
28326
28424
|
}
|
|
28425
|
+
function litRefutesEq(other, v2) {
|
|
28426
|
+
return other !== v2;
|
|
28427
|
+
}
|
|
28428
|
+
function memberEqClass(m, key, litAbs, value) {
|
|
28429
|
+
const sh = m.shape;
|
|
28430
|
+
if (sh.k === "obj") {
|
|
28431
|
+
const slots = sh.slots;
|
|
28432
|
+
if (!Object.prototype.hasOwnProperty.call(slots, key)) {
|
|
28433
|
+
return sh.open ? "may" : "never";
|
|
28434
|
+
}
|
|
28435
|
+
const slotValue = slots[key].value;
|
|
28436
|
+
if (slotValue.shape.k === "any" || slotValue.shape.k === "unknown") return "may";
|
|
28437
|
+
const shapeOnly = (s) => abs(s, void 0, void 0, "exact");
|
|
28438
|
+
if (!leqAbs(shapeOnly(litAbs.shape), shapeOnly(slotValue.shape)).ok) return "never";
|
|
28439
|
+
const t = slotValue.term;
|
|
28440
|
+
const p = slotValue.pred;
|
|
28441
|
+
if (!t || !p || p.op === "true") return "may";
|
|
28442
|
+
const litTerm = lit(value);
|
|
28443
|
+
if (implies(p, { op: "eq", a: t, b: litTerm })) return "only";
|
|
28444
|
+
if (implies(p, { op: "ne", a: t, b: litTerm })) return "never";
|
|
28445
|
+
const conjuncts = [];
|
|
28446
|
+
const visit2 = (c) => {
|
|
28447
|
+
if (c.op === "and") {
|
|
28448
|
+
c.args.forEach(visit2);
|
|
28449
|
+
return;
|
|
28450
|
+
}
|
|
28451
|
+
conjuncts.push(c);
|
|
28452
|
+
};
|
|
28453
|
+
visit2(p);
|
|
28454
|
+
for (const c of conjuncts) {
|
|
28455
|
+
if (c.op !== "eq") continue;
|
|
28456
|
+
const other = termEquals(c.a, t) && c.b.op === "lit" ? c.b.value : termEquals(c.b, t) && c.a.op === "lit" ? c.a.value : void 0;
|
|
28457
|
+
if (other !== void 0 && litRefutesEq(other, value)) return "never";
|
|
28458
|
+
}
|
|
28459
|
+
return "may";
|
|
28460
|
+
}
|
|
28461
|
+
if (m.term?.op === "lit") return "never";
|
|
28462
|
+
return "may";
|
|
28463
|
+
}
|
|
28464
|
+
function $narrowMemberEq(a, key, value, keep) {
|
|
28465
|
+
if (!a || typeof a !== "object" || !("shape" in a)) return a;
|
|
28466
|
+
if (a.shape.k !== "sum") return a;
|
|
28467
|
+
const litAbs = typeof value === "string" ? strLit(value) : typeof value === "number" ? numLit(value) : boolLit(value);
|
|
28468
|
+
const members = a.shape.members;
|
|
28469
|
+
const kept = members.filter((m) => {
|
|
28470
|
+
const c = memberEqClass(m, key, litAbs, value);
|
|
28471
|
+
return keep ? c !== "never" : c !== "only";
|
|
28472
|
+
});
|
|
28473
|
+
if (kept.length === members.length) return a;
|
|
28474
|
+
if (kept.length === 0) return a;
|
|
28475
|
+
return kept.length === 1 ? kept[0] : { ...a, shape: { k: "sum", members: kept } };
|
|
28476
|
+
}
|
|
28327
28477
|
function primShapeOfTypeOf(typeOf2) {
|
|
28328
28478
|
switch (typeOf2) {
|
|
28329
28479
|
case "string":
|
|
@@ -28348,7 +28498,10 @@ var init_async = __esm({
|
|
|
28348
28498
|
"../core/src/algebra/exec/runtime/async.ts"() {
|
|
28349
28499
|
"use strict";
|
|
28350
28500
|
init_abs();
|
|
28501
|
+
init_term();
|
|
28502
|
+
init_pred();
|
|
28351
28503
|
init_objects();
|
|
28504
|
+
init_leq();
|
|
28352
28505
|
init_abs_fn();
|
|
28353
28506
|
init_surface();
|
|
28354
28507
|
init_state();
|
|
@@ -28418,6 +28571,7 @@ __export(runtime_exports, {
|
|
|
28418
28571
|
$lt: () => $lt,
|
|
28419
28572
|
$mod: () => $mod,
|
|
28420
28573
|
$mul: () => $mul,
|
|
28574
|
+
$narrowMemberEq: () => $narrowMemberEq,
|
|
28421
28575
|
$narrowTypeOf: () => $narrowTypeOf,
|
|
28422
28576
|
$ne: () => $ne,
|
|
28423
28577
|
$neLoose: () => $neLoose,
|
|
@@ -60590,7 +60744,7 @@ var require_typescript = __commonJS({
|
|
|
60590
60744
|
affectsEmitOptionDeclarations: () => affectsEmitOptionDeclarations,
|
|
60591
60745
|
allKeysStartWithDot: () => allKeysStartWithDot,
|
|
60592
60746
|
altDirectorySeparator: () => altDirectorySeparator,
|
|
60593
|
-
and: () =>
|
|
60747
|
+
and: () => and8,
|
|
60594
60748
|
append: () => append,
|
|
60595
60749
|
appendIfUnique: () => appendIfUnique,
|
|
60596
60750
|
arrayFrom: () => arrayFrom,
|
|
@@ -64045,7 +64199,7 @@ var require_typescript = __commonJS({
|
|
|
64045
64199
|
function isPatternMatch({ prefix: prefix2, suffix }, candidate) {
|
|
64046
64200
|
return candidate.length >= prefix2.length + suffix.length && startsWith(candidate, prefix2) && endsWith(candidate, suffix);
|
|
64047
64201
|
}
|
|
64048
|
-
function
|
|
64202
|
+
function and8(f, g) {
|
|
64049
64203
|
return (arg) => f(arg) && g(arg);
|
|
64050
64204
|
}
|
|
64051
64205
|
function or2(...fs) {
|
|
@@ -115131,7 +115285,7 @@ ${lanes.join("\n")}
|
|
|
115131
115285
|
SignatureCheckMode3[SignatureCheckMode3["Callback"] = 3] = "Callback";
|
|
115132
115286
|
return SignatureCheckMode3;
|
|
115133
115287
|
})(SignatureCheckMode || {});
|
|
115134
|
-
var isNotOverloadAndNotAccessor =
|
|
115288
|
+
var isNotOverloadAndNotAccessor = and8(isNotOverload, isNotAccessor);
|
|
115135
115289
|
var intrinsicTypeKinds = new Map(Object.entries({
|
|
115136
115290
|
Uppercase: 0,
|
|
115137
115291
|
Lowercase: 1,
|
|
@@ -158117,7 +158271,7 @@ ${lanes.join("\n")}
|
|
|
158117
158271
|
if (flags & (1920 | 384)) {
|
|
158118
158272
|
return;
|
|
158119
158273
|
}
|
|
158120
|
-
const exportedDeclarationsCount = countWhere(declarations,
|
|
158274
|
+
const exportedDeclarationsCount = countWhere(declarations, and8(isNotOverloadAndNotAccessor, not2(isInterfaceDeclaration)));
|
|
158121
158275
|
if (flags & 524288 && exportedDeclarationsCount <= 2) {
|
|
158122
158276
|
return;
|
|
158123
158277
|
}
|
|
@@ -229474,7 +229628,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
229474
229628
|
const maybeHeritageClauseSymbol = getHeritageClauseSymbolTable(classDeclaration, checker);
|
|
229475
229629
|
const implementedType = checker.getTypeAtLocation(implementedTypeNode);
|
|
229476
229630
|
const implementedTypeSymbols = checker.getPropertiesOfType(implementedType);
|
|
229477
|
-
const nonPrivateAndNotExistedInHeritageClauseMembers = implementedTypeSymbols.filter(
|
|
229631
|
+
const nonPrivateAndNotExistedInHeritageClauseMembers = implementedTypeSymbols.filter(and8(symbolPointsToNonPrivateMember, (symbol) => !maybeHeritageClauseSymbol.has(symbol.escapedName)));
|
|
229478
229632
|
const classType = checker.getTypeAtLocation(classDeclaration);
|
|
229479
229633
|
const constructor = find2(classDeclaration.members, (m) => isConstructorDeclaration(m));
|
|
229480
229634
|
if (!classType.getNumberIndexType()) {
|
|
@@ -256847,7 +257001,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
256847
257001
|
affectsEmitOptionDeclarations: () => affectsEmitOptionDeclarations,
|
|
256848
257002
|
allKeysStartWithDot: () => allKeysStartWithDot,
|
|
256849
257003
|
altDirectorySeparator: () => altDirectorySeparator,
|
|
256850
|
-
and: () =>
|
|
257004
|
+
and: () => and8,
|
|
256851
257005
|
append: () => append,
|
|
256852
257006
|
appendIfUnique: () => appendIfUnique,
|
|
256853
257007
|
arrayFrom: () => arrayFrom,
|
|
@@ -288556,7 +288710,7 @@ function runTscBaseline(root, files) {
|
|
|
288556
288710
|
}
|
|
288557
288711
|
}
|
|
288558
288712
|
async function migrateVerify(paths, opts = {}) {
|
|
288559
|
-
const { checkSource: checkSource2, formatCheckReport: formatCheckReport2, pTrue:
|
|
288713
|
+
const { checkSource: checkSource2, formatCheckReport: formatCheckReport2, pTrue: pTrue4 } = await Promise.resolve().then(() => (init_src(), src_exports));
|
|
288560
288714
|
const { collectSkipReturns: collectSkipReturns2, defaultLoadModule: defaultLoadModule3, findProjectConfig: findProjectConfig3, interfaceConfig: interfaceConfig3, checkConfig: checkConfig2 } = await Promise.resolve().then(() => (init_src4(), src_exports3));
|
|
288561
288715
|
const files = [];
|
|
288562
288716
|
for (const p of paths) {
|
|
@@ -288581,7 +288735,7 @@ async function migrateVerify(paths, opts = {}) {
|
|
|
288581
288735
|
const proj = findProjectConfig3(dirname29(file));
|
|
288582
288736
|
const cCfg = checkConfig2(proj?.config);
|
|
288583
288737
|
const autoBind = interfaceConfig3(proj?.config).autoBind;
|
|
288584
|
-
const report = checkSource2(file, source,
|
|
288738
|
+
const report = checkSource2(file, source, pTrue4, {
|
|
288585
288739
|
loadModule: defaultLoadModule3,
|
|
288586
288740
|
fromFile: file,
|
|
288587
288741
|
...autoBind === false ? { autoBind: false } : {},
|
|
@@ -291010,7 +291164,7 @@ async function healthFile(filePath, records) {
|
|
|
291010
291164
|
return report;
|
|
291011
291165
|
}
|
|
291012
291166
|
async function countInterfaceDrift(filePath) {
|
|
291013
|
-
const { sidecarPathOf: sidecarPathOf2, checkSource: checkSource2, pTrue:
|
|
291167
|
+
const { sidecarPathOf: sidecarPathOf2, checkSource: checkSource2, pTrue: pTrue4 } = await Promise.resolve().then(() => (init_src(), src_exports));
|
|
291014
291168
|
const { defaultLoadModule: defaultLoadModule3 } = await Promise.resolve().then(() => (init_src4(), src_exports3));
|
|
291015
291169
|
const { existsSync: ex, readFileSync: rf } = await import("fs");
|
|
291016
291170
|
const abs2 = resolve18(filePath);
|
|
@@ -291028,7 +291182,7 @@ async function countInterfaceDrift(filePath) {
|
|
|
291028
291182
|
const proj = findProjectConfig3(dirname28(abs2));
|
|
291029
291183
|
const autoBind = interfaceConfig3(proj?.config).autoBind;
|
|
291030
291184
|
const source = rf(abs2, "utf-8");
|
|
291031
|
-
const r = checkSource2(abs2, source,
|
|
291185
|
+
const r = checkSource2(abs2, source, pTrue4, {
|
|
291032
291186
|
loadModule: defaultLoadModule3,
|
|
291033
291187
|
fromFile: abs2,
|
|
291034
291188
|
...autoBind === false ? { autoBind: false } : {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nudojs",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.13",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=20"
|
|
6
6
|
},
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@babel/generator": "^8.0.6",
|
|
48
48
|
"@babel/types": "^8.0.6",
|
|
49
|
-
"@nudojs/core": "1.
|
|
50
|
-
"@nudojs/env": "0.4.
|
|
51
|
-
"@nudojs/harvester": "0.3.
|
|
52
|
-
"@nudojs/parser": "1.4.
|
|
53
|
-
"@nudojs/service": "1.6.
|
|
49
|
+
"@nudojs/core": "1.9.0",
|
|
50
|
+
"@nudojs/env": "0.4.27",
|
|
51
|
+
"@nudojs/harvester": "0.3.13",
|
|
52
|
+
"@nudojs/parser": "1.4.9",
|
|
53
|
+
"@nudojs/service": "1.6.12",
|
|
54
54
|
"commander": "^15.0.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|