@nudojs/core 1.5.0 → 1.6.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-YO4GKCNE.js → chunk-I35CHJNO.js} +120 -34
- package/dist/{chunk-W2MP6REI.js → chunk-LZJC7X5J.js} +214 -87
- package/dist/exec.d.ts +5 -3
- package/dist/exec.js +3 -1
- package/dist/index.d.ts +13 -6
- package/dist/index.js +28 -19
- package/dist/internal.d.ts +23 -5
- package/dist/internal.js +108 -16
- package/dist/{check-report-Ci1dDysO.d.ts → projection-budget-CGbs16aX.d.ts} +61 -3
- package/dist/{run-WJfj477N.d.ts → run-Dg7gQO2z.d.ts} +6 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { c as AstEnv, A as Abs, b as Phi, T as Term, I as HofCollectCtx, C as Confidence, S as Shape, a as Pred, R as RelSource, J as HofSite, K as AbsModuleExports, N as RunTranspiledOptions } from './run-
|
|
2
|
-
export { O as $assignRecord, Q as $call, U as $callNamed, V as $recordBinding, W as AbsApplyNoThrow, X as AbsApplyNoThrowFn, Y as AbsApplyResult, Z as AbsApplyReturn, _ as AbsFnImpl, a0 as AbsSigImpl, a1 as EvalAbsAssignRecord, a2 as EvalCallRecord, a3 as EvalFallback, a4 as ImplicationOracle, a5 as LitValueResult, L as LiteralValue, a6 as MAX_EVAL_CALL_DEPTH, a7 as MAX_EVAL_TOTAL_CALLS, P as PrimName, a8 as RUNTIME_IMPORT_RE, a9 as TYPEOF_NAMES, aa as TranspiledCallResult, ab as TypeofName, ac as abs, ad as absFunction, ae as absOnly, af as absToString, ag as and, ah as anyAbs, ai as anyVar, aj as app, ak as assumeFinite, al as attachFnImpl, am as bigintLit, an as bindImports, ao as bindingsOf, ap as bool, aq as boolLit, ar as callTranspiledExport, as as callTranspiledExportApply, at as callTranspiledExportFull, au as collectAbsExports, av as confJoin, aw as emptyPhi, ax as eq, ay as evalExprAbs, az as ge, aA as geNum, aB as getEvalCallCollector, aC as getFnImpl, aD as getImplicationOracle, aE as gt, aF as gtNum, aG as implies, aH as isAbsApplyResult, aI as
|
|
1
|
+
import { c as AstEnv, A as Abs, b as Phi, T as Term, I as HofCollectCtx, C as Confidence, S as Shape, a as Pred, R as RelSource, J as HofSite, K as AbsModuleExports, N as RunTranspiledOptions } from './run-Dg7gQO2z.js';
|
|
2
|
+
export { O as $assignRecord, Q as $call, U as $callNamed, V as $recordBinding, W as AbsApplyNoThrow, X as AbsApplyNoThrowFn, Y as AbsApplyResult, Z as AbsApplyReturn, _ as AbsFnImpl, a0 as AbsSigImpl, a1 as EvalAbsAssignRecord, a2 as EvalCallRecord, a3 as EvalFallback, a4 as ImplicationOracle, a5 as LitValueResult, L as LiteralValue, a6 as MAX_EVAL_CALL_DEPTH, a7 as MAX_EVAL_TOTAL_CALLS, P as PrimName, a8 as RUNTIME_IMPORT_RE, a9 as TYPEOF_NAMES, aa as TranspiledCallResult, ab as TypeofName, ac as abs, ad as absFunction, ae as absOnly, af as absToString, ag as and, ah as anyAbs, ai as anyVar, aj as app, ak as assumeFinite, al as attachFnImpl, am as bigintLit, an as bindImports, ao as bindingsOf, ap as bool, aq as boolLit, ar as callTranspiledExport, as as callTranspiledExportApply, at as callTranspiledExportFull, au as collectAbsExports, av as confJoin, aw as emptyPhi, ax as eq, ay as evalExprAbs, az as ge, aA as geNum, aB as getEvalCallCollector, aC as getFnImpl, aD as getImplicationOracle, aE as gt, aF as gtNum, aG as implies, aH as isAbsApplyResult, aI as isAbsVal, aJ as isBigPrim, aK as isExactLit, aL as isNumPrim, aM as isStrPrim, aN as le, aO as leNum, aP as lit, aQ as litValue, aR as lt, aS as ltNum, aT as makeAbsApplyResult, aU as markPureFn, aV as namespaceAbsOf, aW as ne, aX as negatePred, aY as never, aZ as not, a_ as noteEvalCallRecord, a$ as noteEvalFallback, b0 as num, b1 as numLit, b2 as numVar, b3 as obj, b4 as or, b5 as pFalse, b6 as pTrue, b7 as phiAnd, b8 as predEquals, b9 as predToString, ba as predVars, bb as primToTypeof, bc as ptypeof, bd as pureFnNameOf, be as relationFingerprint, bf as relationFn, bg as resetEvalCallBudget, bh as runTranspiled, bi as runTranspiledOptionsMemoKey, bj as setEvalAssignCollector, bk as setEvalBindingSink, bl as setEvalCallCollector, bm as setEvalFallbackCollector, bn as setImplicationOracle, bo as shapeOfTerm, bp as shapeOnlyFn, bq as shapeToString, br as simplifyTerm, bs as str, bt as strLit, bu as substPred, bv as termEquals, bw as termToString, bx as tryRunTranspiled, by as unknown, bz as v } from './run-Dg7gQO2z.js';
|
|
3
3
|
import { Node, File } from '@babel/types';
|
|
4
|
-
import { p as parseSource, L as LeakBudget, E as EffectiveInterfaceOpts, b as LoadDepsFingerprint,
|
|
5
|
-
export {
|
|
4
|
+
import { p as parseSource, L as LeakBudget, E as EffectiveInterfaceOpts, b as LoadDepsFingerprint, v as CheckReport, N as NudoConstraint, c as ProjectionBudget } from './projection-budget-CGbs16aX.js';
|
|
5
|
+
export { w as CONSTRAINT_BUILDERS, x as CONSTRAINT_BUILDER_NAMES, y as CONSTRAINT_EXPR_RE, z as CheckAction, C as CheckIssue, A as CheckJson, B as CheckJsonMulti, D as ConstraintBuilder, F as Diagnostic, G as EffectiveInterface, H as GitlabCodeQualityIssue, J as InterfaceDiag, I as InterfaceSource, K as InterfaceTierInfo, a as InterfaceTierOpts, O as NamedImport, Q as NudoField, R as NudoFnConstraint, S as NudoSidecarError, T as NudoSig, U as RefineDiag, V as RefineEntry, W as RefineResolveOpts, X as SELF, Y as actionsForIssue, Z as andC, _ as any, $ as array, a0 as boolean, a1 as checkArg, a2 as checkCall, a3 as constraintAdmitsNullish, a4 as constraintToEntryAbs, a5 as drainPromiseMicros, a6 as effectiveInterface, a7 as enterPromiseExecutorScope, a8 as evalPromiseCtor, a9 as evalPromiseMethod, aa as evalPromiseStatic, ab as execNudoModule, ac as extractDeclaredThrows, ad as extractFnBudget, ae as extractNudoImports, af as extractRefineReturnFromSource, ag as extractRefinesFromSource, ah as fn, ai as fnConstraintToEntryReqs, aj as formatCheckReport, ak as formatConstraint, al as formatDiagnostics, am as formatEffectiveInterfaceDisplay, an as formatGithubAnnotations, ao as formatGitlabCodeQuality, ap as formatInterfaceTierLine, aq as generatedExportNames, ar as getParseSourceCacheSize, as as getTerm, at as instantiateConstraint, au as interfaceDiagCount, av as interfaceSourceOf, aw as interfaceTierOf, ax as isIntFlag, ay as isNodeModulesPath, az as isNudoConstraint, aA as leavePromiseExecutorScope, aB as lenTerm, aC as litC, aD as localNamedExports, aE as notePromiseExecutorFork, aF as nullable, aG as number, aH as omit, aI as partial, aJ as pick, aK as queuePromiseMicro, aL as refineDiagCount, aM as refineToIndexedFull, aN as resetNudoModuleExecCache, aO as resetParseSourceCache, aP as resetSidecarLoadFailureCache, aQ as serializeCheckJson, aR as serializeCheckJsonMulti, aS as setInterfaceDiagCollector, aT as setRefineDiagCollector, aU as shape, aV as sidecarClosureFingerprint, aW as sidecarPathOf, aX as string, aY as takeInterfaceDiags, aZ as takeInterfaceDiagsSince, a_ as takeRefineDiags, a$ as takeRefineDiagsSince, b0 as throwConstraintToKinds, b1 as union } from './projection-budget-CGbs16aX.js';
|
|
6
6
|
export { $add, $arguments, $arr, $arrMutContainer, $arrRest, $arrWithHoles, $async, $asyncReturn, $await, $bitand, $bitnot, $bitor, $bitxor, $catchVal, $class, $classExpr, $collectionForEach, $concat, $copy, $del, $delRes, $div, $dynamicImport, $elems, $eq, $eqLoose, $fnVal, $for, $forInKeys, $forIter, $forOf, $fork, $ge, $gen, $get, $gt, $idx, $idxSet, $importMeta, $in, $instanceof, $instanceofNonIdent, $invoke, $invokeSuper, $isBreakTo, $isForkExit, $join, $le, $len, $lit, $loopBreak, $loopContinue, $loopReturn, $lt, $mod, $mul, $ne, $neLoose, $neg, $new, $not, $nullishTest, $obj, $objAccessor, $objRest, $optionalGet, $optionalInvoke, $orDefault, $pow, $pushLoopExit, $rawThis, $reStateCall, $regex, $rethrowIfNudoReturn, $set, $setKey, $shl, $shr, $spread, $staticInvoke, $sub, $super, $switch, $thisGet, $thisSet, $throw, $toNumber, $toNumeric, $tryCurrentMark, $tryDetachSoftCatch, $tryDigestSoftCatch, $tryDiscardSoft, $tryMark, $tryOrphanSoft, $tryPopMark, $tryReleaseSoftCatch, $tryReleaseSoftOut, $tryTakeSince, $typeof, $unknown, $updateAdd, $updateSub, $ushr, $while, $whileSeq, $yield, DEFAULT_MAX_LOOP_ITERS, EvalClassSpec, NudoLoopSignal, NudoReturn, NudoThrow, NudoUnsupportedError, TranspileOptions, asAbsVal, callAtFunctionBoundary, clearBClasses, clearStaleTermPred, currentExecPhi, fillTuple, foldRequireSpecArg, foldStaticStringExpr, getEvalClass, isArrMutator, isDefinitelyFalse, isDefinitelyTrue, isNudoBreak, isNudoContinue, isNudoReturn, isNudoThrow, litTruth, lookupObjAccessor, namespaceNameOf, pushLoopExit, pushThrowExit, registerEvalClass, runWithLoopExits, runtimeImportOf, takeLoopExits, takeThrowExits, transpile, transpileBodyNode, transpileExpression, transpileFile, transpileSource, withExecPhi } from './exec.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -1106,12 +1106,17 @@ type MockModuleRecord = {
|
|
|
1106
1106
|
*/
|
|
1107
1107
|
declare function parseMockModulePayload(payload: string): MockModuleRecord | undefined;
|
|
1108
1108
|
type NudoImportRecord = {
|
|
1109
|
+
/** 本地绑定名(`a as b` 的 `b`,@nudo:contract 的引用名);namespace 记 `*ns` */
|
|
1109
1110
|
names: string[];
|
|
1111
|
+
/** local → 侧车原始导出名(`a as b` 的 `a`);未写别名的名字不进表 */
|
|
1112
|
+
importedOfLocal: Record<string, string>;
|
|
1110
1113
|
spec: string;
|
|
1111
1114
|
};
|
|
1112
1115
|
/**
|
|
1113
1116
|
* `@nudo:import` 载荷:named `{ a, b as c }` / namespace `* as ns`。
|
|
1114
1117
|
* default 等未识别形态返回 `malformed`(由消费方发诊断)。
|
|
1118
|
+
* import 绑定语义 local ← imported:`a as b` 两个名字都保留——只留 local
|
|
1119
|
+
* 会让查表用错名字(`exports[b]` miss,BUG-016)。
|
|
1115
1120
|
*/
|
|
1116
1121
|
declare function parseNudoImportPayload(payload: string): NudoImportRecord | "malformed-default" | "malformed" | undefined;
|
|
1117
1122
|
declare function extractFileEnvNames(source: string): string[];
|
|
@@ -1202,8 +1207,10 @@ declare function literalMeetsConstraint(lv: number | string | boolean | null | u
|
|
|
1202
1207
|
* lit/and 已消歧;侧车注入键名仍为 lit/and)。
|
|
1203
1208
|
*/
|
|
1204
1209
|
|
|
1205
|
-
/** Abs → 契约;不可表达 → undefined
|
|
1206
|
-
|
|
1210
|
+
/** Abs → 契约;不可表达 → undefined。
|
|
1211
|
+
* `budget`:共享遍历预算(DESIGN-001)——环 / 超深 shape 返回 undefined
|
|
1212
|
+
* (不可表达),调用方走既有 fallback;schema 投影传入与自身共享的实例。 */
|
|
1213
|
+
declare function absToConstraint(a: Abs, budget?: ProjectionBudget): NudoConstraint | undefined;
|
|
1207
1214
|
/**
|
|
1208
1215
|
* 工件聚合投影(设计 §4.2:先 Abs join 折叠再投影)。
|
|
1209
1216
|
* 空列表 → undefined(无证据不产约束)。
|
package/dist/index.js
CHANGED
|
@@ -91,7 +91,7 @@ import {
|
|
|
91
91
|
takeRefineDiagsSince,
|
|
92
92
|
throwConstraintToKinds,
|
|
93
93
|
union
|
|
94
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-I35CHJNO.js";
|
|
95
95
|
import {
|
|
96
96
|
$add,
|
|
97
97
|
$arguments,
|
|
@@ -215,6 +215,7 @@ import {
|
|
|
215
215
|
OBJECT_PROTO_METHOD_NAMES,
|
|
216
216
|
PROMISE_MICRO_ERROR_LABEL,
|
|
217
217
|
PROMISE_MICRO_OVERFLOW_LABEL,
|
|
218
|
+
ProjectionBudget,
|
|
218
219
|
RUNTIME_IMPORT_RE,
|
|
219
220
|
TYPEOF_NAMES,
|
|
220
221
|
abs,
|
|
@@ -331,6 +332,7 @@ import {
|
|
|
331
332
|
implies,
|
|
332
333
|
instantiateReturn,
|
|
333
334
|
isAbsApplyResult,
|
|
335
|
+
isAbsVal,
|
|
334
336
|
isArrMutator,
|
|
335
337
|
isBigPrim,
|
|
336
338
|
isDefinitelyFalse,
|
|
@@ -507,7 +509,7 @@ import {
|
|
|
507
509
|
v,
|
|
508
510
|
withExecPhi,
|
|
509
511
|
withVar
|
|
510
|
-
} from "./chunk-
|
|
512
|
+
} from "./chunk-LZJC7X5J.js";
|
|
511
513
|
|
|
512
514
|
// src/environment.ts
|
|
513
515
|
function createEnvironment(parent, bindings = /* @__PURE__ */ new Map()) {
|
|
@@ -1030,8 +1032,17 @@ var ARR_FALLBACK_CONF = /* @__PURE__ */ new Set([
|
|
|
1030
1032
|
"path",
|
|
1031
1033
|
"widened"
|
|
1032
1034
|
]);
|
|
1033
|
-
function absToConstraint(a) {
|
|
1035
|
+
function absToConstraint(a, budget = new ProjectionBudget()) {
|
|
1034
1036
|
if (!PROJECTABLE_CONF.has(a.conf)) return void 0;
|
|
1037
|
+
const stop = budget.enter(a);
|
|
1038
|
+
if (stop) return void 0;
|
|
1039
|
+
try {
|
|
1040
|
+
return absToConstraintInner(a, budget);
|
|
1041
|
+
} finally {
|
|
1042
|
+
budget.exit();
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
function absToConstraintInner(a, budget) {
|
|
1035
1046
|
const s = a.shape;
|
|
1036
1047
|
switch (s.k) {
|
|
1037
1048
|
case "prim":
|
|
@@ -1049,9 +1060,9 @@ function absToConstraint(a) {
|
|
|
1049
1060
|
case "any":
|
|
1050
1061
|
return a.pred?.op === "or" ? projectOrLiterals(a) : void 0;
|
|
1051
1062
|
case "obj":
|
|
1052
|
-
return projectObj(s.slots, s.index, s.open);
|
|
1063
|
+
return projectObj(s.slots, s.index, s.open, budget);
|
|
1053
1064
|
case "arr":
|
|
1054
|
-
return projectArr(s.element);
|
|
1065
|
+
return projectArr(s.element, budget);
|
|
1055
1066
|
case "sum":
|
|
1056
1067
|
return projectSum(s.members);
|
|
1057
1068
|
default:
|
|
@@ -1234,18 +1245,18 @@ function projectOrLiterals(a) {
|
|
|
1234
1245
|
}
|
|
1235
1246
|
return lits.length > 0 ? union(...lits) : void 0;
|
|
1236
1247
|
}
|
|
1237
|
-
function projectObj(slots, index, open) {
|
|
1248
|
+
function projectObj(slots, index, open, budget) {
|
|
1238
1249
|
if (index || open) return void 0;
|
|
1239
1250
|
const fields = {};
|
|
1240
1251
|
for (const [k, slot] of Object.entries(slots)) {
|
|
1241
|
-
const fc = absToConstraint(slot.value);
|
|
1252
|
+
const fc = absToConstraint(slot.value, budget);
|
|
1242
1253
|
if (!fc) return void 0;
|
|
1243
1254
|
fields[k] = { constraint: fc, ...slot.optional ? { optional: true } : {} };
|
|
1244
1255
|
}
|
|
1245
1256
|
return { __nudoConstraint: true, preds: [], fields };
|
|
1246
1257
|
}
|
|
1247
|
-
function projectArr(element) {
|
|
1248
|
-
const ec = absToConstraint(element);
|
|
1258
|
+
function projectArr(element, budget) {
|
|
1259
|
+
const ec = absToConstraint(element, budget);
|
|
1249
1260
|
if (ec) return array(ec);
|
|
1250
1261
|
if (element.shape.k === "prim" && isBuilderPrim(element.shape.type) && (!element.pred || element.pred.op === "true") && ARR_FALLBACK_CONF.has(element.conf)) {
|
|
1251
1262
|
return array(primConstraint(element.shape.type));
|
|
@@ -1725,7 +1736,7 @@ function evalThrowsOf(source, fnName, args, opts = {}, phi = pTrue) {
|
|
|
1725
1736
|
exports = run;
|
|
1726
1737
|
evalRunMemo.set(runKey, exports);
|
|
1727
1738
|
}
|
|
1728
|
-
const
|
|
1739
|
+
const isAbsVal2 = (v2) => !!v2 && typeof v2 === "object" && "shape" in v2 && "conf" in v2;
|
|
1729
1740
|
const call = (name, callArgs) => {
|
|
1730
1741
|
try {
|
|
1731
1742
|
return callTranspiledExportFull(exports, name, callArgs, phi.op === "true" ? void 0 : { phi });
|
|
@@ -1734,11 +1745,11 @@ function evalThrowsOf(source, fnName, args, opts = {}, phi = pTrue) {
|
|
|
1734
1745
|
}
|
|
1735
1746
|
};
|
|
1736
1747
|
try {
|
|
1737
|
-
if (fnName
|
|
1748
|
+
if (Object.hasOwn(exports, fnName)) return call(fnName, args);
|
|
1738
1749
|
if (fnName.includes(".")) {
|
|
1739
1750
|
const [clsName, methodName] = fnName.split(".", 2);
|
|
1740
1751
|
const clsAbs = exports[clsName ?? ""];
|
|
1741
|
-
if (
|
|
1752
|
+
if (isAbsVal2(clsAbs)) {
|
|
1742
1753
|
return invokeAsThrows(() => $staticInvoke(clsAbs, methodName ?? "", args), phi);
|
|
1743
1754
|
}
|
|
1744
1755
|
return void 0;
|
|
@@ -1746,7 +1757,7 @@ function evalThrowsOf(source, fnName, args, opts = {}, phi = pTrue) {
|
|
|
1746
1757
|
if ("default" in exports) {
|
|
1747
1758
|
const d = exports["default"];
|
|
1748
1759
|
if (typeof d === "function") return call("default", args);
|
|
1749
|
-
if (
|
|
1760
|
+
if (isAbsVal2(d)) {
|
|
1750
1761
|
if (d.shape.k === "fn") return call("default", args);
|
|
1751
1762
|
if (d.shape.k === "obj") {
|
|
1752
1763
|
return invokeAsThrows(() => $invoke(d, fnName, args), phi);
|
|
@@ -1765,12 +1776,9 @@ function widenForAssign(a) {
|
|
|
1765
1776
|
if (s.k === "tuple") {
|
|
1766
1777
|
const holes = new Set(s.holes ?? []);
|
|
1767
1778
|
const els = s.elements.filter((_, i) => !holes.has(i));
|
|
1768
|
-
|
|
1769
|
-
if (
|
|
1770
|
-
|
|
1771
|
-
} else if (s.rest) {
|
|
1772
|
-
el = widenForAssign(s.rest);
|
|
1773
|
-
}
|
|
1779
|
+
const parts = els.map(widenForAssign);
|
|
1780
|
+
if (s.rest) parts.push(widenForAssign(s.rest));
|
|
1781
|
+
const el = parts.length > 0 ? parts.reduce((x, y) => joinAbs(x, y)) : anyAbs;
|
|
1774
1782
|
return abs({ k: "arr", element: el }, void 0, void 0, a.conf);
|
|
1775
1783
|
}
|
|
1776
1784
|
if (s.k === "obj") {
|
|
@@ -3211,6 +3219,7 @@ export {
|
|
|
3211
3219
|
interfaceSourceOf,
|
|
3212
3220
|
interfaceTierOf,
|
|
3213
3221
|
isAbsApplyResult,
|
|
3222
|
+
isAbsVal,
|
|
3214
3223
|
isArrMutator,
|
|
3215
3224
|
isBigPrim,
|
|
3216
3225
|
isDefinitelyFalse,
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { I as InterfaceSource, a as InterfaceTierOpts, p as parseSource, C as CheckIssue } from './
|
|
2
|
-
export { L as LeakBudget, b as LoadDepsFingerprint, M as MAX_PROMISE_MICROS, d as
|
|
3
|
-
import { A as Abs, T as Term, c as AstEnv } from './run-
|
|
4
|
-
export { $ as $tryDigestSoft, d as $tryMarkSoft, e as $tryReleaseSoft, E as ERROR_FAMILY, f as EvalFallbackStats, M as MayThrowEffect, g as clearPureCallMemo, h as clearPureMemo, i as enterEvalCallBudgetSession, j as errorTypeAbs, k as exitEvalCallBudgetSession, l as filterDeclaredThrows, m as filterGateThrows, n as filterIgnoredThrows, o as flushMayThrowEffects, p as formatThrowsAbs, q as getEvalCallBudgetState, r as getEvalFallbackStats, s as getMayThrowCollector, t as isThrowsIgnored, u as mayThrowEffectsToAbs, v as orphanMayThrowEffects, w as popMayThrowFrame, x as pushMayThrowFrame, y as recordMayThrow, z as resetEvalFallbackStats, B as runWithMayThrowSession, D as setMayThrowCollector, F as throwAbsToKinds, G as throwsKindCovered, H as withEvalBudgetOverride } from './run-
|
|
1
|
+
import { I as InterfaceSource, a as InterfaceTierOpts, p as parseSource, C as CheckIssue } from './projection-budget-CGbs16aX.js';
|
|
2
|
+
export { L as LeakBudget, b as LoadDepsFingerprint, M as MAX_PROMISE_MICROS, P as PROJECTION_MAX_DEPTH, c as ProjectionBudget, d as ProjectionStopReason, e as defaultLeakBudget, f as exceedsBudget, g as exportedNameOfLocal, h as extractAllLoadSpecs, i as getPromiseMicrosLength, l as leakIfNeeded, j as loadModuleDepsFingerprint, m as maybeLeak, n as normPath, r as resetLeakCounter, k as resolveDepPath, s as sidecarSpecsOf, o as stablePathKey, q as stablePathKeyGraph, t as termDepth, u as termNodes } from './projection-budget-CGbs16aX.js';
|
|
3
|
+
import { A as Abs, T as Term, c as AstEnv } from './run-Dg7gQO2z.js';
|
|
4
|
+
export { $ as $tryDigestSoft, d as $tryMarkSoft, e as $tryReleaseSoft, E as ERROR_FAMILY, f as EvalFallbackStats, M as MayThrowEffect, g as clearPureCallMemo, h as clearPureMemo, i as enterEvalCallBudgetSession, j as errorTypeAbs, k as exitEvalCallBudgetSession, l as filterDeclaredThrows, m as filterGateThrows, n as filterIgnoredThrows, o as flushMayThrowEffects, p as formatThrowsAbs, q as getEvalCallBudgetState, r as getEvalFallbackStats, s as getMayThrowCollector, t as isThrowsIgnored, u as mayThrowEffectsToAbs, v as orphanMayThrowEffects, w as popMayThrowFrame, x as pushMayThrowFrame, y as recordMayThrow, z as resetEvalFallbackStats, B as runWithMayThrowSession, D as setMayThrowCollector, F as throwAbsToKinds, G as throwsKindCovered, H as withEvalBudgetOverride } from './run-Dg7gQO2z.js';
|
|
5
5
|
import { File, Node } from '@babel/types';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -414,8 +414,26 @@ declare function denoteGuard(a: Abs, v: string): string;
|
|
|
414
414
|
* - member access: `recv.key` for idents, `recv["key"]` otherwise
|
|
415
415
|
* - template literal type fixed segments: escape `\` `` ` `` `$`
|
|
416
416
|
* - comment bodies: neutralize block-comment close, line breaks, control chars
|
|
417
|
+
* - binding names (`export const/function`, params): ident + non-reserved
|
|
417
418
|
*/
|
|
418
419
|
declare function isJsIdent(name: string): boolean;
|
|
420
|
+
/**
|
|
421
|
+
* True when `name` is legal as a `const` / `function` / `class` binding
|
|
422
|
+
* (or a `.d.ts` param / type-param name): IdentifierName shape and not
|
|
423
|
+
* a reserved word. Unlike `isJsIdent`, accepts Unicode identifiers and
|
|
424
|
+
* rejects `class` / `default` / `let` / `eval` / …
|
|
425
|
+
*/
|
|
426
|
+
declare function isJsBindingIdent(name: string): boolean;
|
|
427
|
+
/**
|
|
428
|
+
* Binding name for a generated `export const` / `export function` slot.
|
|
429
|
+
*
|
|
430
|
+
* - already a legal binding → unchanged (Unicode names preserved)
|
|
431
|
+
* - reserved word → `_` prefix (`class` → `_class`)
|
|
432
|
+
* - otherwise sanitize: non-ident chars → `_`, leading non-start → `_` prefix
|
|
433
|
+
* - `used` (when given) de-duplicates within one generated module
|
|
434
|
+
* (`a_b`, `a_b_2`, …) so cleaned names cannot collide
|
|
435
|
+
*/
|
|
436
|
+
declare function toJsBindingIdent(name: string, used?: Set<string>): string;
|
|
419
437
|
/**
|
|
420
438
|
* Object-literal / type-member key: bare ident or canonical integer,
|
|
421
439
|
* otherwise JSON-quoted. Leading-zero digit keys (`01`) stay quoted — bare
|
|
@@ -651,4 +669,4 @@ declare function runWithEvalMissingSlot<T>(enabled: boolean, body: () => T): T;
|
|
|
651
669
|
*/
|
|
652
670
|
declare function noteObjSlotMissing(recv: Abs | undefined, name: string, loc?: [number, number]): boolean;
|
|
653
671
|
|
|
654
|
-
export { type AbsBudgetStats, type AbsInlay, type ArgDerivation, type ClassDef, type CollectAbsInlaysOpts, type DerivationNode, type EvalMemberDiag, FORK_TRUNCATION_LABEL, type FnFp, HOST_EFFECT_LABEL_PREFIX, type InjectedDomainEvidenceOpts, type InjectedDomainRecord, MAX_CALL_DEPTH, MAX_EVAL_TOTAL_FORKS, MAX_TOTAL_CALLS, type MethodDef, OBJECT_PROTO_NAMES, PROMISE_MICRO_ERROR_LABEL, PROMISE_MICRO_OVERFLOW_LABEL, type StringLiteralSpan, type TemplateMeta, type TemplatePartDesc, type TemplatePartView, type TemplatePredicateDecision, abortDerivationSession, absTemplateViews, allFixedTextOfViews, anyMemberResult, awaitAbs, beginDerivationSession, bumpEvalForkBudget, callBudgetKey, canSkipLiteralCallScan, checkInjectedDomainEvidence, classChainNames, classFromMethods, coerceAsyncReturn, collectAbsInlays, concatString, createTemplateAbs, decideEndsWith, decideIncludes, decideStartsWith, defineClass, definitelyUncallableMember, denoteGuard, derivationChain, endDerivationSession, enterCall, escapeTemplateTypeFixed, exitCall, fixedLengthOfViews, fnFingerprints, formatObjectKey, formatTemplateNameViews, generalizeSourceKeyPart, getAbsCallBudgetStats, getAbsOrigin, getClass, getClassChain, getDerivation, getEvalForkBudgetLimit, getEvalForkCount, getFnNameAndBodies, hasDerivationSession, hashSource, instanceOf, instantiateClass, isEvalMissingSlotEnabled, isJsIdent, isNullishAbs, isTemplateLike, knownPrefixOfViews, knownSuffixOfViews, listTopFunctions, lookupMethod, lookupMethodWithOwner, lookupSuperMethod, maskCommentsAndStrings, mergeAdjacentFixedViews, noteAbsTruncation, noteAnyMemberMayThrow, noteDerivationAdd, noteDerivationJoin, noteEvalForkTruncation, noteHostEffectBlocked, noteMemberDispatchMiss, noteNullishMemberThrows, noteObjSlotMissing, notePrimMemberMissing, noteUnknownMemberMissing, popCallLoc, projectBrand, projectDerivationDsl, pushCallLoc, recordMemberDiag, resetAbsCallBudget, resetEvalForkBudget, resetFnFpCache, resetHashSourceCache, runWithEvalMissingSlot, safeMemberAccess, sanitizeCommentText, scanStringLiterals, setAbsTruncationCollector, setDerivation, setDerivationCollector, setEvalForkBudgetLimit, setEvalMissingSlotEnabled, setMemberDiagCollector, sourceHasCjsExports, sourceHasModuleDependency, sourceHasRequireCall, stableAnalyzeKeySource, stableCallId, stripCommentsAndStrings, stripStringsKeepComments, superNameOf, tagAbsOrigin, tagDerivationRoot, templateMatchesValue, templatePartsOf, termKey, truncatedAbs, viewTemplateParts, withFnBudgetOverride, wrapPromise };
|
|
672
|
+
export { type AbsBudgetStats, type AbsInlay, type ArgDerivation, type ClassDef, type CollectAbsInlaysOpts, type DerivationNode, type EvalMemberDiag, FORK_TRUNCATION_LABEL, type FnFp, HOST_EFFECT_LABEL_PREFIX, type InjectedDomainEvidenceOpts, type InjectedDomainRecord, MAX_CALL_DEPTH, MAX_EVAL_TOTAL_FORKS, MAX_TOTAL_CALLS, type MethodDef, OBJECT_PROTO_NAMES, PROMISE_MICRO_ERROR_LABEL, PROMISE_MICRO_OVERFLOW_LABEL, type StringLiteralSpan, type TemplateMeta, type TemplatePartDesc, type TemplatePartView, type TemplatePredicateDecision, abortDerivationSession, absTemplateViews, allFixedTextOfViews, anyMemberResult, awaitAbs, beginDerivationSession, bumpEvalForkBudget, callBudgetKey, canSkipLiteralCallScan, checkInjectedDomainEvidence, classChainNames, classFromMethods, coerceAsyncReturn, collectAbsInlays, concatString, createTemplateAbs, decideEndsWith, decideIncludes, decideStartsWith, defineClass, definitelyUncallableMember, denoteGuard, derivationChain, endDerivationSession, enterCall, escapeTemplateTypeFixed, exitCall, fixedLengthOfViews, fnFingerprints, formatObjectKey, formatTemplateNameViews, generalizeSourceKeyPart, getAbsCallBudgetStats, getAbsOrigin, getClass, getClassChain, getDerivation, getEvalForkBudgetLimit, getEvalForkCount, getFnNameAndBodies, hasDerivationSession, hashSource, instanceOf, instantiateClass, isEvalMissingSlotEnabled, isJsBindingIdent, isJsIdent, isNullishAbs, isTemplateLike, knownPrefixOfViews, knownSuffixOfViews, listTopFunctions, lookupMethod, lookupMethodWithOwner, lookupSuperMethod, maskCommentsAndStrings, mergeAdjacentFixedViews, noteAbsTruncation, noteAnyMemberMayThrow, noteDerivationAdd, noteDerivationJoin, noteEvalForkTruncation, noteHostEffectBlocked, noteMemberDispatchMiss, noteNullishMemberThrows, noteObjSlotMissing, notePrimMemberMissing, noteUnknownMemberMissing, popCallLoc, projectBrand, projectDerivationDsl, pushCallLoc, recordMemberDiag, resetAbsCallBudget, resetEvalForkBudget, resetFnFpCache, resetHashSourceCache, runWithEvalMissingSlot, safeMemberAccess, sanitizeCommentText, scanStringLiterals, setAbsTruncationCollector, setDerivation, setDerivationCollector, setEvalForkBudgetLimit, setEvalMissingSlotEnabled, setMemberDiagCollector, sourceHasCjsExports, sourceHasModuleDependency, sourceHasRequireCall, stableAnalyzeKeySource, stableCallId, stripCommentsAndStrings, stripStringsKeepComments, superNameOf, tagAbsOrigin, tagDerivationRoot, templateMatchesValue, templatePartsOf, termKey, toJsBindingIdent, truncatedAbs, viewTemplateParts, withFnBudgetOverride, wrapPromise };
|
package/dist/internal.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
canSkipLiteralCallScan,
|
|
3
3
|
checkInjectedDomainEvidence,
|
|
4
|
+
exportedNameOfLocal,
|
|
4
5
|
extractAllLoadSpecs,
|
|
5
6
|
fnFingerprints,
|
|
6
7
|
generalizeFromAst,
|
|
@@ -18,7 +19,7 @@ import {
|
|
|
18
19
|
stableAnalyzeKeySource,
|
|
19
20
|
stablePathKey,
|
|
20
21
|
stablePathKeyGraph
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-I35CHJNO.js";
|
|
22
23
|
import {
|
|
23
24
|
$tryDigestSoft,
|
|
24
25
|
$tryMarkSoft,
|
|
@@ -31,8 +32,10 @@ import {
|
|
|
31
32
|
MAX_PROMISE_MICROS,
|
|
32
33
|
MAX_TOTAL_CALLS,
|
|
33
34
|
OBJECT_PROTO_NAMES,
|
|
35
|
+
PROJECTION_MAX_DEPTH,
|
|
34
36
|
PROMISE_MICRO_ERROR_LABEL,
|
|
35
37
|
PROMISE_MICRO_OVERFLOW_LABEL,
|
|
38
|
+
ProjectionBudget,
|
|
36
39
|
abortDerivationSession,
|
|
37
40
|
absTemplateViews,
|
|
38
41
|
allFixedTextOfViews,
|
|
@@ -157,7 +160,7 @@ import {
|
|
|
157
160
|
withEvalBudgetOverride,
|
|
158
161
|
withFnBudgetOverride,
|
|
159
162
|
wrapPromise
|
|
160
|
-
} from "./chunk-
|
|
163
|
+
} from "./chunk-LZJC7X5J.js";
|
|
161
164
|
|
|
162
165
|
// src/algebra/inlay.ts
|
|
163
166
|
function listFunctions(source) {
|
|
@@ -311,10 +314,85 @@ function collectAbsInlays(source, opts) {
|
|
|
311
314
|
|
|
312
315
|
// src/algebra/codegen-escape.ts
|
|
313
316
|
var JS_IDENT = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
317
|
+
var JS_BINDING_IDENT = /^(?:[$_\p{ID_Start}])(?:[$\u200C\u200D\p{ID_Continue}])*$/u;
|
|
318
|
+
var JS_BINDING_RESERVED = /* @__PURE__ */ new Set([
|
|
319
|
+
// ECMA-262 keywords
|
|
320
|
+
"break",
|
|
321
|
+
"case",
|
|
322
|
+
"catch",
|
|
323
|
+
"class",
|
|
324
|
+
"const",
|
|
325
|
+
"continue",
|
|
326
|
+
"debugger",
|
|
327
|
+
"default",
|
|
328
|
+
"delete",
|
|
329
|
+
"do",
|
|
330
|
+
"else",
|
|
331
|
+
"enum",
|
|
332
|
+
"export",
|
|
333
|
+
"extends",
|
|
334
|
+
"false",
|
|
335
|
+
"finally",
|
|
336
|
+
"for",
|
|
337
|
+
"function",
|
|
338
|
+
"if",
|
|
339
|
+
"import",
|
|
340
|
+
"in",
|
|
341
|
+
"instanceof",
|
|
342
|
+
"new",
|
|
343
|
+
"null",
|
|
344
|
+
"return",
|
|
345
|
+
"super",
|
|
346
|
+
"switch",
|
|
347
|
+
"this",
|
|
348
|
+
"throw",
|
|
349
|
+
"true",
|
|
350
|
+
"try",
|
|
351
|
+
"typeof",
|
|
352
|
+
"var",
|
|
353
|
+
"void",
|
|
354
|
+
"while",
|
|
355
|
+
"with",
|
|
356
|
+
"yield",
|
|
357
|
+
// strict mode / module-code reserved
|
|
358
|
+
"let",
|
|
359
|
+
"static",
|
|
360
|
+
"await",
|
|
361
|
+
"implements",
|
|
362
|
+
"interface",
|
|
363
|
+
"package",
|
|
364
|
+
"private",
|
|
365
|
+
"protected",
|
|
366
|
+
"public",
|
|
367
|
+
// never legal bindings in strict / module code
|
|
368
|
+
"eval",
|
|
369
|
+
"arguments"
|
|
370
|
+
]);
|
|
314
371
|
var JS_CANONICAL_INT = /^(?:0|[1-9]\d*)$/;
|
|
315
372
|
function isJsIdent(name) {
|
|
316
373
|
return JS_IDENT.test(name);
|
|
317
374
|
}
|
|
375
|
+
function isJsBindingIdent(name) {
|
|
376
|
+
return JS_BINDING_IDENT.test(name) && !JS_BINDING_RESERVED.has(name);
|
|
377
|
+
}
|
|
378
|
+
function toJsBindingIdent(name, used) {
|
|
379
|
+
let base = name;
|
|
380
|
+
if (!JS_BINDING_IDENT.test(base)) {
|
|
381
|
+
base = base.replace(/[^\p{ID_Continue}$\u200C\u200D]/gu, "_");
|
|
382
|
+
if (base.length === 0) base = "_";
|
|
383
|
+
else if (!/^[$_\p{ID_Start}]/u.test(base)) base = `_${base}`;
|
|
384
|
+
}
|
|
385
|
+
if (JS_BINDING_RESERVED.has(base)) base = `_${base}`;
|
|
386
|
+
if (!used) return base;
|
|
387
|
+
let n = base;
|
|
388
|
+
let i = 2;
|
|
389
|
+
while (used.has(n)) {
|
|
390
|
+
n = `${base}_${i}`;
|
|
391
|
+
i++;
|
|
392
|
+
}
|
|
393
|
+
used.add(n);
|
|
394
|
+
return n;
|
|
395
|
+
}
|
|
318
396
|
function formatObjectKey(k) {
|
|
319
397
|
if (JS_IDENT.test(k)) return k;
|
|
320
398
|
if (JS_CANONICAL_INT.test(k)) return k;
|
|
@@ -332,16 +410,25 @@ function sanitizeCommentText(text) {
|
|
|
332
410
|
|
|
333
411
|
// src/algebra/denote.ts
|
|
334
412
|
function denoteGuard(a, v) {
|
|
335
|
-
|
|
336
|
-
|
|
413
|
+
return denoteGuardB(a, v, new ProjectionBudget());
|
|
414
|
+
}
|
|
415
|
+
function denoteGuardB(a, v, budget) {
|
|
416
|
+
const stop = budget.enter(a);
|
|
417
|
+
if (stop) return `/* nudo:truncated:${stop} */ true`;
|
|
418
|
+
try {
|
|
419
|
+
if (a.term?.op === "lit" && (!a.pred || a.pred.op === "true")) {
|
|
420
|
+
return eqGuard(v, a.term.value);
|
|
421
|
+
}
|
|
422
|
+
const shape = denoteShape(a.shape, v, budget);
|
|
423
|
+
const pred = denotePred(a, v);
|
|
424
|
+
if (shape === "true") return pred;
|
|
425
|
+
if (pred === "true") return shape;
|
|
426
|
+
return `(${shape}) && (${pred})`;
|
|
427
|
+
} finally {
|
|
428
|
+
budget.exit();
|
|
337
429
|
}
|
|
338
|
-
const shape = denoteShape(a.shape, v);
|
|
339
|
-
const pred = denotePred(a, v);
|
|
340
|
-
if (shape === "true") return pred;
|
|
341
|
-
if (pred === "true") return shape;
|
|
342
|
-
return `(${shape}) && (${pred})`;
|
|
343
430
|
}
|
|
344
|
-
function denoteShape(s, v) {
|
|
431
|
+
function denoteShape(s, v, budget) {
|
|
345
432
|
switch (s.k) {
|
|
346
433
|
case "never":
|
|
347
434
|
return "false";
|
|
@@ -367,7 +454,7 @@ function denoteShape(s, v) {
|
|
|
367
454
|
const checks = [`typeof ${v} === "object"`, `${v} !== null`];
|
|
368
455
|
for (const [key, slot] of Object.entries(s.slots)) {
|
|
369
456
|
const access = safeMemberAccess(v, key);
|
|
370
|
-
const inner =
|
|
457
|
+
const inner = denoteGuardB(slot.value, access, budget);
|
|
371
458
|
if (slot.optional) {
|
|
372
459
|
if (inner !== "true") checks.push(`(${access} === undefined || ${inner})`);
|
|
373
460
|
} else {
|
|
@@ -377,7 +464,7 @@ function denoteShape(s, v) {
|
|
|
377
464
|
return checks.join(" && ");
|
|
378
465
|
}
|
|
379
466
|
case "arr":
|
|
380
|
-
return `Array.isArray(${v}) && ${v}.every((item) => ${
|
|
467
|
+
return `Array.isArray(${v}) && ${v}.every((item) => ${denoteGuardB(s.element, "item", budget)})`;
|
|
381
468
|
case "tuple": {
|
|
382
469
|
const checks = [`Array.isArray(${v})`];
|
|
383
470
|
const minLen = s.elements.length;
|
|
@@ -388,14 +475,14 @@ function denoteShape(s, v) {
|
|
|
388
475
|
checks.push(`!(${i} in ${v})`);
|
|
389
476
|
return;
|
|
390
477
|
}
|
|
391
|
-
const inner =
|
|
478
|
+
const inner = denoteGuardB(el, `${v}[${i}]`, budget);
|
|
392
479
|
if (inner !== "true") checks.push(inner);
|
|
393
480
|
});
|
|
394
481
|
for (const i of holes) {
|
|
395
482
|
if (i >= minLen) checks.push(`!(${i} in ${v})`);
|
|
396
483
|
}
|
|
397
484
|
if (s.rest) {
|
|
398
|
-
const rest =
|
|
485
|
+
const rest = denoteGuardB(s.rest, "item", budget);
|
|
399
486
|
if (rest !== "true") {
|
|
400
487
|
checks.push(`${v}.slice(${minLen}).every((item) => ${rest})`);
|
|
401
488
|
}
|
|
@@ -408,10 +495,10 @@ function denoteShape(s, v) {
|
|
|
408
495
|
if (s.eff === "promise") return `${v} instanceof Promise`;
|
|
409
496
|
return "true";
|
|
410
497
|
case "brand":
|
|
411
|
-
return denoteShape(s.shape.shape, v);
|
|
498
|
+
return denoteShape(s.shape.shape, v, budget);
|
|
412
499
|
case "sum": {
|
|
413
500
|
if (s.members.length === 0) return "false";
|
|
414
|
-
const parts = s.members.map((m) =>
|
|
501
|
+
const parts = s.members.map((m) => denoteGuardB(m, v, budget));
|
|
415
502
|
return `(${parts.join(" || ")})`;
|
|
416
503
|
}
|
|
417
504
|
}
|
|
@@ -513,8 +600,10 @@ export {
|
|
|
513
600
|
MAX_PROMISE_MICROS,
|
|
514
601
|
MAX_TOTAL_CALLS,
|
|
515
602
|
OBJECT_PROTO_NAMES,
|
|
603
|
+
PROJECTION_MAX_DEPTH,
|
|
516
604
|
PROMISE_MICRO_ERROR_LABEL,
|
|
517
605
|
PROMISE_MICRO_OVERFLOW_LABEL,
|
|
606
|
+
ProjectionBudget,
|
|
518
607
|
abortDerivationSession,
|
|
519
608
|
absTemplateViews,
|
|
520
609
|
allFixedTextOfViews,
|
|
@@ -549,6 +638,7 @@ export {
|
|
|
549
638
|
exceedsBudget,
|
|
550
639
|
exitCall,
|
|
551
640
|
exitEvalCallBudgetSession,
|
|
641
|
+
exportedNameOfLocal,
|
|
552
642
|
extractAllLoadSpecs,
|
|
553
643
|
filterDeclaredThrows,
|
|
554
644
|
filterGateThrows,
|
|
@@ -577,6 +667,7 @@ export {
|
|
|
577
667
|
instanceOf,
|
|
578
668
|
instantiateClass,
|
|
579
669
|
isEvalMissingSlotEnabled,
|
|
670
|
+
isJsBindingIdent,
|
|
580
671
|
isJsIdent,
|
|
581
672
|
isNullishAbs,
|
|
582
673
|
isTemplateLike,
|
|
@@ -653,6 +744,7 @@ export {
|
|
|
653
744
|
termNodes,
|
|
654
745
|
throwAbsToKinds,
|
|
655
746
|
throwsKindCovered,
|
|
747
|
+
toJsBindingIdent,
|
|
656
748
|
truncatedAbs,
|
|
657
749
|
viewTemplateParts,
|
|
658
750
|
withEvalBudgetOverride,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { File } from '@babel/types';
|
|
2
|
-
import { A as Abs, T as Term, P as PrimName, a as Pred, L as LiteralValue, b as Phi, C as Confidence } from './run-
|
|
2
|
+
import { A as Abs, T as Term, P as PrimName, a as Pred, L as LiteralValue, b as Phi, C as Confidence } from './run-Dg7gQO2z.js';
|
|
3
3
|
|
|
4
4
|
declare function resetParseSourceCache(): void;
|
|
5
5
|
declare function getParseSourceCacheSize(): number;
|
|
@@ -217,6 +217,11 @@ declare const CONSTRAINT_BUILDER_NAMES: readonly string[];
|
|
|
217
217
|
/**
|
|
218
218
|
* 约束表达式头:`name(` 形态。由 CONSTRAINT_BUILDER_NAMES 生成——
|
|
219
219
|
* 名单只在 CONSTRAINT_BUILDERS 一处维护。
|
|
220
|
+
*
|
|
221
|
+
* 注意:这只是**前缀预筛**(快速判定「像不像构建器调用」),不是安全门禁。
|
|
222
|
+
* 整条表达式在进入 execNudoModule/new Function 前必须过 AST 白名单
|
|
223
|
+
* (parser 的 isSafeTypeExprSource)——否则 `number(), process.exit(1)`
|
|
224
|
+
* 这类拼接可以借前缀骗过本正则并执行任意 JS。
|
|
220
225
|
*/
|
|
221
226
|
declare const CONSTRAINT_EXPR_RE: RegExp;
|
|
222
227
|
/** 把模板绑定到参数名:self → paramName;shape 展开为字段访问 Pred */
|
|
@@ -268,7 +273,8 @@ type NamedImport = {
|
|
|
268
273
|
};
|
|
269
274
|
/**
|
|
270
275
|
* `@nudo:import` 命名/namespace 导入(D5=F1:文法在 directive-scan 单源)。
|
|
271
|
-
*
|
|
276
|
+
* `names` 是本地绑定名(契约引用名);别名→导出名的映射留在
|
|
277
|
+
* `NudoImportRecord.importedOfLocal`(查表口 collectConstraints 消费)。
|
|
272
278
|
*/
|
|
273
279
|
declare function extractNudoImports(source: string): NamedImport[];
|
|
274
280
|
/** refine 侧车加载诊断(severity 由消费方按 code 定档,形状对齐 Issue 子集) */
|
|
@@ -411,11 +417,23 @@ type InterfaceSource = "handwritten" | "generated" | "implicit";
|
|
|
411
417
|
* 排除 re-export(`export {x} from` / `export *`)。
|
|
412
418
|
*/
|
|
413
419
|
declare function localNamedExports(source: string): Set<string>;
|
|
420
|
+
/**
|
|
421
|
+
* `export { local as exported }`(含 string 导出名 `export { x as "a-b" }`)
|
|
422
|
+
* 的本地声明名 → 导出名查询(DESIGN-003:契约身份=导出名)。声明形态
|
|
423
|
+
* (exported === local)与 default 形态不进表——default 走 C4.4 的
|
|
424
|
+
* 本地名/default 双键绑定,身份保持本地名。解析失败 / 无别名子句 →
|
|
425
|
+
* undefined。
|
|
426
|
+
*/
|
|
427
|
+
declare function exportedNameOfLocal(source: string, localName: string): string | undefined;
|
|
414
428
|
/**
|
|
415
429
|
* 侧车源码的生成段导出名:export 之前(跳过紧邻的 import/const 链)的注释
|
|
416
430
|
* 行含 `@generated` → 该名为 generated。组合式下行段(§5.3)形态为
|
|
417
431
|
* `import` + `@generated 头` + prelude + export;callsite 段则是头紧贴
|
|
418
432
|
* export。隔了其他代码行 / 无标记 / re-export 列表均不算。
|
|
433
|
+
*
|
|
434
|
+
* DESIGN-003 别名段:导出名不是合法绑定名(保留字 / 非 ident)时发射为
|
|
435
|
+
* `const _nudo_1 = …; export { _nudo_1 as class };` —— 身份恒为**导出名**
|
|
436
|
+
* (`class` / string 名),不是绑定别名。
|
|
419
437
|
*/
|
|
420
438
|
declare function generatedExportNames(sidecarSrc: string): Set<string>;
|
|
421
439
|
type EffectiveInterfaceOpts = RefineResolveOpts & {
|
|
@@ -735,4 +753,44 @@ declare function formatGitlabCodeQuality(r: CheckReport, opts?: {
|
|
|
735
753
|
workspaceRoot?: string;
|
|
736
754
|
}): GitlabCodeQualityIssue[];
|
|
737
755
|
|
|
738
|
-
|
|
756
|
+
/**
|
|
757
|
+
* 投影/格式化层共享的 Abs 遍历预算(DESIGN-001)。
|
|
758
|
+
*
|
|
759
|
+
* Abs 是可计算值:shape 图可环(evaluator 对 `const a = {}; a.self = a` 产出
|
|
760
|
+
* 真环)、可深(深层嵌套结构 / harvest 链)。所有外延出口(formatShape /
|
|
761
|
+
* absToString / absToTSType / absToSchemaNode / denoteGuard / absToConstraint /
|
|
762
|
+
* serializeCaseArg)必须有界——absStableKey / absShapeKey 的 "cycle" 哨兵早已
|
|
763
|
+
* 承认该不变量,本模块是它的共享抽象。
|
|
764
|
+
*
|
|
765
|
+
* 语义:
|
|
766
|
+
* - enter/exit 按「当前路径」记账(进栈/出栈):只有祖先重复才算环。
|
|
767
|
+
* 兄弟复用同一子树(DAG 共享)不误判——与 absStableKey 的累积 seen 不同,
|
|
768
|
+
* 那是键生成口径,渲染需要完整兄弟分支,不能沿用。
|
|
769
|
+
* - 深度 = 当前路径长度;达到 maxDepth 返回 "depth"。
|
|
770
|
+
* - truncated 粘性记录本次投影是否截断及原因,供 dropped 台账 / 注释标记
|
|
771
|
+
* 消费(与 load-deps-fp truncated → noCache 同风格:截断必须可观测)。
|
|
772
|
+
*
|
|
773
|
+
* 本模块零依赖(Abs/Shape 都是普通 object),供 core 各层与 service emit
|
|
774
|
+
* 共同 import,不引入环。
|
|
775
|
+
*/
|
|
776
|
+
/** 投影深度上限。BUG-014 给手写 case 实参文法 32 层(合法用例 ~4 层);
|
|
777
|
+
* 渲染面消费的是机器生成的 shape(evaluator 嵌套 / env harvest),取 2×
|
|
778
|
+
* 余量 64:足够深到覆盖真实结构,又把最坏输出/栈框钉在有界。 */
|
|
779
|
+
declare const PROJECTION_MAX_DEPTH = 64;
|
|
780
|
+
type ProjectionStopReason = "cycle" | "depth";
|
|
781
|
+
declare class ProjectionBudget {
|
|
782
|
+
#private;
|
|
783
|
+
/** 粘性:本次投影是否发生过截断("cycle" / "depth"),供台账记录 */
|
|
784
|
+
truncated: ProjectionStopReason | undefined;
|
|
785
|
+
constructor(maxDepth?: number);
|
|
786
|
+
/**
|
|
787
|
+
* 进入一个 Abs(或 Shape)子树。返回 null → 继续递归,之后必须配对
|
|
788
|
+
* `exit()`;返回 "cycle" | "depth" → 不得递归,按出口各自的约定渲染
|
|
789
|
+
* 截断标记(不调用 exit——本次 enter 没有入栈)。
|
|
790
|
+
*/
|
|
791
|
+
enter(a: object): ProjectionStopReason | null;
|
|
792
|
+
/** 离开子树(与返回 null 的 enter 严格配对)。 */
|
|
793
|
+
exit(): void;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
export { array as $, type CheckJson as A, type CheckJsonMulti as B, type CheckIssue as C, type ConstraintBuilder as D, type EffectiveInterfaceOpts as E, type Diagnostic as F, type EffectiveInterface as G, type GitlabCodeQualityIssue as H, type InterfaceSource as I, type InterfaceDiag as J, type InterfaceTierInfo as K, type LeakBudget as L, MAX_PROMISE_MICROS as M, type NudoConstraint as N, type NamedImport as O, PROJECTION_MAX_DEPTH as P, type NudoField as Q, type NudoFnConstraint as R, NudoSidecarError as S, type NudoSig as T, type RefineDiag as U, type RefineEntry as V, type RefineResolveOpts as W, SELF as X, actionsForIssue as Y, andC as Z, any as _, type InterfaceTierOpts as a, takeRefineDiagsSince as a$, boolean as a0, checkArg as a1, checkCall as a2, constraintAdmitsNullish as a3, constraintToEntryAbs as a4, drainPromiseMicros as a5, effectiveInterface as a6, enterPromiseExecutorScope as a7, evalPromiseCtor as a8, evalPromiseMethod as a9, leavePromiseExecutorScope as aA, lenTerm as aB, litC as aC, localNamedExports as aD, notePromiseExecutorFork as aE, nullable as aF, number as aG, omit as aH, partial as aI, pick as aJ, queuePromiseMicro as aK, refineDiagCount as aL, refineToIndexedFull as aM, resetNudoModuleExecCache as aN, resetParseSourceCache as aO, resetSidecarLoadFailureCache as aP, serializeCheckJson as aQ, serializeCheckJsonMulti as aR, setInterfaceDiagCollector as aS, setRefineDiagCollector as aT, shape as aU, sidecarClosureFingerprint as aV, sidecarPathOf as aW, string as aX, takeInterfaceDiags as aY, takeInterfaceDiagsSince as aZ, takeRefineDiags as a_, evalPromiseStatic as aa, execNudoModule as ab, extractDeclaredThrows as ac, extractFnBudget as ad, extractNudoImports as ae, extractRefineReturnFromSource as af, extractRefinesFromSource as ag, fn as ah, fnConstraintToEntryReqs as ai, formatCheckReport as aj, formatConstraint as ak, formatDiagnostics as al, formatEffectiveInterfaceDisplay as am, formatGithubAnnotations as an, formatGitlabCodeQuality as ao, formatInterfaceTierLine as ap, generatedExportNames as aq, getParseSourceCacheSize as ar, getTerm as as, instantiateConstraint as at, interfaceDiagCount as au, interfaceSourceOf as av, interfaceTierOf as aw, isIntFlag as ax, isNodeModulesPath as ay, isNudoConstraint as az, type LoadDepsFingerprint as b, throwConstraintToKinds as b0, union as b1, ProjectionBudget as c, type ProjectionStopReason as d, defaultLeakBudget as e, exceedsBudget as f, exportedNameOfLocal as g, extractAllLoadSpecs as h, getPromiseMicrosLength as i, loadModuleDepsFingerprint as j, resolveDepPath as k, leakIfNeeded as l, maybeLeak as m, normPath as n, stablePathKey as o, parseSource as p, stablePathKeyGraph as q, resetLeakCounter as r, sidecarSpecsOf as s, termDepth as t, termNodes as u, type CheckReport as v, CONSTRAINT_BUILDERS as w, CONSTRAINT_BUILDER_NAMES as x, CONSTRAINT_EXPR_RE as y, type CheckAction as z };
|
|
@@ -366,7 +366,10 @@ type EvalCallRecord = {
|
|
|
366
366
|
line: number;
|
|
367
367
|
column: number;
|
|
368
368
|
};
|
|
369
|
-
|
|
369
|
+
/** BUG-028:必填——漏设时异常 payload 会被当成功结果
|
|
370
|
+
* (resultAbs=payload、throwsAbs=never,isLeakedCallRecord
|
|
371
|
+
* 的 never+never 拦不住)。5 处 emitter 均已显式设置。 */
|
|
372
|
+
threw: boolean;
|
|
370
373
|
};
|
|
371
374
|
/** 清空 pureCallMemo(宿主入口 / 会话缓存失效) */
|
|
372
375
|
declare function clearPureCallMemo(): void;
|
|
@@ -748,6 +751,7 @@ type TranspiledCallResult = {
|
|
|
748
751
|
/** 非 never 表示函数可能 throw 该类型 */
|
|
749
752
|
throws: Abs;
|
|
750
753
|
};
|
|
754
|
+
declare function isAbsVal(v: unknown): v is Abs;
|
|
751
755
|
/** 调用 runTranspiled 导出(捕获 $throw)。opts.phi:入口 Φ 种子
|
|
752
756
|
* (instantiate/symbolic 的约束入口——eval 侧路径条件收窄)。
|
|
753
757
|
* 嵌套进入(导出桥 apply)继承外层预算;仅最外层宿主入口重置。 */
|
|
@@ -766,4 +770,4 @@ declare function callTranspiledExport(exports: Record<string, unknown>, name: st
|
|
|
766
770
|
*/
|
|
767
771
|
declare function callTranspiledExportApply(exports: Record<string, unknown> | (() => Record<string, unknown>), name: string): (args: Abs[], thisVal?: Abs) => AbsApplyResult;
|
|
768
772
|
|
|
769
|
-
export { $tryDigestSoft as $, type Abs as A, runWithMayThrowSession as B, type Confidence as C, setMayThrowCollector as D, ERROR_FAMILY as E, throwAbsToKinds as F, throwsKindCovered as G, withEvalBudgetOverride as H, type HofCollectCtx as I, type HofSite as J, type AbsModuleExports as K, type LiteralValue as L, type MayThrowEffect as M, type RunTranspiledOptions as N, $assignRecord as O, type PrimName as P, $call as Q, type RelSource as R, type Shape as S, type Term as T, $callNamed as U, $recordBinding as V, type AbsApplyNoThrow as W, type AbsApplyNoThrowFn as X, type AbsApplyResult as Y, type AbsApplyReturn as Z, type AbsFnImpl as _, type Pred as a,
|
|
773
|
+
export { $tryDigestSoft as $, type Abs as A, runWithMayThrowSession as B, type Confidence as C, setMayThrowCollector as D, ERROR_FAMILY as E, throwAbsToKinds as F, throwsKindCovered as G, withEvalBudgetOverride as H, type HofCollectCtx as I, type HofSite as J, type AbsModuleExports as K, type LiteralValue as L, type MayThrowEffect as M, type RunTranspiledOptions as N, $assignRecord as O, type PrimName as P, $call as Q, type RelSource as R, type Shape as S, type Term as T, $callNamed as U, $recordBinding as V, type AbsApplyNoThrow as W, type AbsApplyNoThrowFn as X, type AbsApplyResult as Y, type AbsApplyReturn as Z, type AbsFnImpl as _, type Pred as a, noteEvalFallback as a$, type AbsSigImpl as a0, type EvalAbsAssignRecord as a1, type EvalCallRecord as a2, type EvalFallback as a3, type ImplicationOracle as a4, type LitValueResult as a5, MAX_EVAL_CALL_DEPTH as a6, MAX_EVAL_TOTAL_CALLS as a7, RUNTIME_IMPORT_RE as a8, TYPEOF_NAMES as a9, geNum as aA, getEvalCallCollector as aB, getFnImpl as aC, getImplicationOracle as aD, gt as aE, gtNum as aF, implies as aG, isAbsApplyResult as aH, isAbsVal as aI, isBigPrim as aJ, isExactLit as aK, isNumPrim as aL, isStrPrim as aM, le as aN, leNum as aO, lit as aP, litValue as aQ, lt as aR, ltNum as aS, makeAbsApplyResult as aT, markPureFn as aU, namespaceAbsOf as aV, ne as aW, negatePred as aX, never as aY, not as aZ, noteEvalCallRecord as a_, type TranspiledCallResult as aa, type TypeofName as ab, abs as ac, absFunction as ad, absOnly as ae, absToString as af, and as ag, anyAbs as ah, anyVar as ai, app as aj, assumeFinite as ak, attachFnImpl as al, bigintLit as am, bindImports as an, bindingsOf as ao, bool as ap, boolLit as aq, callTranspiledExport as ar, callTranspiledExportApply as as, callTranspiledExportFull as at, collectAbsExports as au, confJoin as av, emptyPhi as aw, eq as ax, evalExprAbs as ay, ge as az, type Phi as b, num as b0, numLit as b1, numVar as b2, obj as b3, or as b4, pFalse as b5, pTrue as b6, phiAnd as b7, predEquals as b8, predToString as b9, routeApplyThrows as bA, predVars as ba, primToTypeof as bb, ptypeof as bc, pureFnNameOf as bd, relationFingerprint as be, relationFn as bf, resetEvalCallBudget as bg, runTranspiled as bh, runTranspiledOptionsMemoKey as bi, setEvalAssignCollector as bj, setEvalBindingSink as bk, setEvalCallCollector as bl, setEvalFallbackCollector as bm, setImplicationOracle as bn, shapeOfTerm as bo, shapeOnlyFn as bp, shapeToString as bq, simplifyTerm as br, str as bs, strLit as bt, substPred as bu, termEquals as bv, termToString as bw, tryRunTranspiled as bx, unknown as by, v as bz, type AstEnv as c, $tryMarkSoft as d, $tryReleaseSoft as e, type EvalFallbackStats as f, clearPureCallMemo as g, clearPureMemo as h, enterEvalCallBudgetSession as i, errorTypeAbs as j, exitEvalCallBudgetSession as k, filterDeclaredThrows as l, filterGateThrows as m, filterIgnoredThrows as n, flushMayThrowEffects as o, formatThrowsAbs as p, getEvalCallBudgetState as q, getEvalFallbackStats as r, getMayThrowCollector as s, isThrowsIgnored as t, mayThrowEffectsToAbs as u, orphanMayThrowEffects as v, popMayThrowFrame as w, pushMayThrowFrame as x, recordMayThrow as y, resetEvalFallbackStats as z };
|