@nudojs/core 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{check-report-BWmfy810.d.ts → check-report-Ci1dDysO.d.ts} +52 -27
- package/dist/{chunk-CKH6GQAI.js → chunk-W2MP6REI.js} +2351 -1896
- package/dist/{chunk-5YNR4Q7E.js → chunk-YO4GKCNE.js} +817 -169
- package/dist/exec.d.ts +8 -16
- package/dist/exec.js +9 -1
- package/dist/index.d.ts +125 -110
- package/dist/index.js +174 -94
- package/dist/internal.d.ts +4 -4
- package/dist/internal.js +39 -27
- package/dist/{run-Dk08Q5zl.d.ts → run-WJfj477N.d.ts} +186 -3
- package/package.json +1 -1
|
@@ -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, 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-WJfj477N.js';
|
|
3
3
|
|
|
4
4
|
declare function resetParseSourceCache(): void;
|
|
5
5
|
declare function getParseSourceCacheSize(): number;
|
|
@@ -60,6 +60,21 @@ declare function leakIfNeeded(a: Abs, budget?: LeakBudget, label?: string): Abs;
|
|
|
60
60
|
* refine / LSP 共享单一定义——历史上三份内联拷贝已各自漂移过)。
|
|
61
61
|
*/
|
|
62
62
|
declare function normPath(p: string): string;
|
|
63
|
+
/**
|
|
64
|
+
* 稳定路径键:统一 Windows 盘符形态(`file:///c:/x` / `/c:/x` / `c:\x` / `c:/x` /
|
|
65
|
+
* `C:/x` → `c:/x`),POSIX 绝对路径过 normPath 后恒等。幂等。
|
|
66
|
+
*
|
|
67
|
+
* L0 memo 依赖索引与定向逐出、模块图脏传播查找必须走同一键——否则跨形态
|
|
68
|
+
* 逐出/脏传播在 Windows 上 miss(FIX-RESIDUAL-3)。core 不引 path:此处只做
|
|
69
|
+
* 纯字符串归一,相对路径的 resolve 由宿主(LSP cacheKey)负责。
|
|
70
|
+
*/
|
|
71
|
+
declare function stablePathKey(p: string): string;
|
|
72
|
+
/**
|
|
73
|
+
* 把 `buildModuleGraph` 的 imports/dependents 边表按键形态归一到 stablePathKey。
|
|
74
|
+
* 边目标来自 resolveModuleFile(fs 原生,如 `c:\a.js`)、from 节点可能已是
|
|
75
|
+
* 键形态(`c:/a.js`)——混形态会让 computeDirtySet 跨形态查找漏边。
|
|
76
|
+
*/
|
|
77
|
+
declare function stablePathKeyGraph(m: Map<string, Set<string>>): Map<string, Set<string>>;
|
|
63
78
|
/** core 不引 path:相对 spec 纯字符串拼接(与 LSP resolve 对齐时双方 norm) */
|
|
64
79
|
declare function resolveDepPath(fromFile: string, spec: string): string;
|
|
65
80
|
/**
|
|
@@ -75,26 +90,6 @@ declare function isNodeModulesPath(p: string): boolean;
|
|
|
75
90
|
*/
|
|
76
91
|
declare function sidecarPathOf(file: string): string;
|
|
77
92
|
|
|
78
|
-
/**
|
|
79
|
-
* 约束模板构建器(参数无关)。
|
|
80
|
-
*
|
|
81
|
-
* number().gt(0) → 占位项 self 上的 Pred
|
|
82
|
-
* number().int().ge(0) → 整数 + 下界
|
|
83
|
-
* string().min(1) → 非空串(长度)
|
|
84
|
-
* array(number().gt(0)) → 元素约束
|
|
85
|
-
* shape({ id: number().gt(0) }) → object 形状约束
|
|
86
|
-
* lit(42) → 字面量(prim + eq(self, 42))
|
|
87
|
-
* union(number().gt(0), lit(0)) → 成员析取(or / joinAbs)
|
|
88
|
-
* fn({ x: number().gt(0) }, number()) → 一等函数约束
|
|
89
|
-
* number().gt(0).shift(1) → 界平移(x>0 ⇒ x+n>1)
|
|
90
|
-
* instantiate("ms") → Pred ms > 0 / u.id > 0 ∧ …
|
|
91
|
-
*
|
|
92
|
-
* 在 *.nudo.js 里执行;不是 zod 绑定,是我们自己的运行时 API。
|
|
93
|
-
* 不需要 interface/type 语法——契约用 JS 表达式声明。
|
|
94
|
-
* 命名:litC/andC 与 term.ts 的 lit、pred.ts 的 and 消歧(桶导出不再冲突)。
|
|
95
|
-
* 侧车注入表仍以 `lit`/`and` 为键名(*.nudo.js 用户写法不变)。
|
|
96
|
-
*/
|
|
97
|
-
|
|
98
93
|
/** 模板占位项;instantiate 时换成真实参数名 */
|
|
99
94
|
declare const SELF = "__nudo_self__";
|
|
100
95
|
/** 字段访问项:u.id */
|
|
@@ -173,7 +168,7 @@ declare function array(item: NudoConstraint | ConstraintBuilder | number | strin
|
|
|
173
168
|
*/
|
|
174
169
|
declare function shape(fields: Record<string, NudoConstraint | ConstraintBuilder | number | string | boolean | null | undefined>): ConstraintBuilder;
|
|
175
170
|
/** litC(v):字面量契约——prim 按 v 类型、eq(self, v) pred 编码(不开新字段) */
|
|
176
|
-
declare function litC(v:
|
|
171
|
+
declare function litC(v: LiteralValue): ConstraintBuilder;
|
|
177
172
|
/** union(...cs):成员析取;instantiate 为 or(...),entry Abs 为成员 joinAbs。空参 throw */
|
|
178
173
|
declare function union(...cs: (NudoConstraint | ConstraintBuilder | number | string | boolean | null | undefined)[]): ConstraintBuilder;
|
|
179
174
|
/**
|
|
@@ -208,6 +203,22 @@ declare function partial(c: NudoConstraint | ConstraintBuilder): ConstraintBuild
|
|
|
208
203
|
declare function pick(c: NudoConstraint | ConstraintBuilder, keys: string[]): ConstraintBuilder;
|
|
209
204
|
/** omit(c, keys):shape 去字段;非 shape throw */
|
|
210
205
|
declare function omit(c: NudoConstraint | ConstraintBuilder, keys: string[]): ConstraintBuilder;
|
|
206
|
+
/**
|
|
207
|
+
* 约束构建器表面名表(单一真源):case 实参文法、mock 类型表达式识别与
|
|
208
|
+
* 侧车注入共用的名字 → 实现映射。键名是 *.nudo.js / 指令里的用户写法
|
|
209
|
+
* (`lit`/`and` 而非内部的 litC/andC)。
|
|
210
|
+
*
|
|
211
|
+
* 任何「构建器名单」硬编码(CONSTRAINT_EXPR_RE 一类的识别正则)必须由
|
|
212
|
+
* `CONSTRAINT_BUILDER_NAMES` 生成,禁止再手维护一份。
|
|
213
|
+
*/
|
|
214
|
+
declare const CONSTRAINT_BUILDERS: Record<string, unknown>;
|
|
215
|
+
/** 构建器表面名(供文法正则 / 测试枚举;顺序即表定义顺序) */
|
|
216
|
+
declare const CONSTRAINT_BUILDER_NAMES: readonly string[];
|
|
217
|
+
/**
|
|
218
|
+
* 约束表达式头:`name(` 形态。由 CONSTRAINT_BUILDER_NAMES 生成——
|
|
219
|
+
* 名单只在 CONSTRAINT_BUILDERS 一处维护。
|
|
220
|
+
*/
|
|
221
|
+
declare const CONSTRAINT_EXPR_RE: RegExp;
|
|
211
222
|
/** 把模板绑定到参数名:self → paramName;shape 展开为字段访问 Pred */
|
|
212
223
|
declare function instantiateConstraint(c: NudoConstraint, paramName: string): Pred;
|
|
213
224
|
/**
|
|
@@ -255,6 +266,10 @@ type NamedImport = {
|
|
|
255
266
|
names: string[];
|
|
256
267
|
spec: string;
|
|
257
268
|
};
|
|
269
|
+
/**
|
|
270
|
+
* `@nudo:import` 命名/namespace 导入(D5=F1:文法在 directive-scan 单源)。
|
|
271
|
+
* default 等未识别形态发 nudo:contract-syntax,不再静默丢弃。
|
|
272
|
+
*/
|
|
258
273
|
declare function extractNudoImports(source: string): NamedImport[];
|
|
259
274
|
/** refine 侧车加载诊断(severity 由消费方按 code 定档,形状对齐 Issue 子集) */
|
|
260
275
|
type RefineDiag = {
|
|
@@ -316,8 +331,8 @@ declare function extractRefineReturnFromSource(source: string, fnName: string, o
|
|
|
316
331
|
* @nudo:case "neg" (0) !! throws → 申报任意 throw
|
|
317
332
|
* @nudo:case "neg" (0) !! throws Error → 申报 Error
|
|
318
333
|
*
|
|
319
|
-
* 与 refine
|
|
320
|
-
* undefined = 无申报(L2 照常执法)。
|
|
334
|
+
* 与 refine 同扫函数前注释块(D6=G2 同一 scope 绑定)。
|
|
335
|
+
* 返回 `*` = 申报任意;数组 = 按名申报;undefined = 无申报(L2 照常执法)。
|
|
321
336
|
*/
|
|
322
337
|
declare function extractDeclaredThrows(source: string, fnName: string): string[] | "*" | undefined;
|
|
323
338
|
/**
|
|
@@ -326,8 +341,8 @@ declare function extractDeclaredThrows(source: string, fnName: string): string[]
|
|
|
326
341
|
* @nudo:budget calls=50000 depth=128
|
|
327
342
|
* @nudo:budget forks=20000, calls=50000
|
|
328
343
|
*
|
|
329
|
-
* 与 @nudo:throws
|
|
330
|
-
*
|
|
344
|
+
* 与 @nudo:throws 同路径扫函数前注释块(D6=G2 同一 scope 绑定)。
|
|
345
|
+
* 只抬高预算(不降低全局默认);未声明的维度沿用全局。非法值忽略。
|
|
331
346
|
*/
|
|
332
347
|
declare function extractFnBudget(source: string, fnName: string): {
|
|
333
348
|
forks?: number;
|
|
@@ -673,6 +688,16 @@ type CheckJsonMulti = {
|
|
|
673
688
|
budgetTruncated?: boolean;
|
|
674
689
|
};
|
|
675
690
|
budget?: CheckReport["budget"];
|
|
691
|
+
/**
|
|
692
|
+
* 路径/IO 错误(additive)。`pathErrors` 非空 ⇒ `ok: false` ⇒ CLI exit 1。
|
|
693
|
+
* ok↔exit 单一来源:CLI 在 --json 路径只按信封 ok 设 exit。
|
|
694
|
+
*/
|
|
695
|
+
pathErrors?: Array<{
|
|
696
|
+
path: string;
|
|
697
|
+
code: string;
|
|
698
|
+
message: string;
|
|
699
|
+
suggestion?: string;
|
|
700
|
+
}>;
|
|
676
701
|
reports: CheckJson[];
|
|
677
702
|
};
|
|
678
703
|
declare function serializeCheckJson(r: CheckReport): CheckJson;
|
|
@@ -710,4 +735,4 @@ declare function formatGitlabCodeQuality(r: CheckReport, opts?: {
|
|
|
710
735
|
workspaceRoot?: string;
|
|
711
736
|
}): GitlabCodeQualityIssue[];
|
|
712
737
|
|
|
713
|
-
export {
|
|
738
|
+
export { constraintAdmitsNullish as $, type EffectiveInterface as A, type InterfaceDiag as B, type CheckIssue as C, type Diagnostic as D, type EffectiveInterfaceOpts as E, type InterfaceTierInfo as F, type GitlabCodeQualityIssue as G, type NamedImport as H, type InterfaceSource as I, type NudoField as J, type NudoFnConstraint as K, type LeakBudget as L, MAX_PROMISE_MICROS as M, type NudoConstraint as N, NudoSidecarError as O, type NudoSig as P, type RefineEntry as Q, type RefineDiag as R, type RefineResolveOpts as S, SELF as T, actionsForIssue as U, andC as V, any as W, array as X, boolean as Y, checkArg as Z, checkCall as _, type InterfaceTierOpts as a, constraintToEntryAbs as a0, drainPromiseMicros as a1, effectiveInterface as a2, enterPromiseExecutorScope as a3, evalPromiseCtor as a4, evalPromiseMethod as a5, evalPromiseStatic as a6, execNudoModule as a7, extractDeclaredThrows as a8, extractFnBudget as a9, notePromiseExecutorFork as aA, nullable as aB, number as aC, omit as aD, partial as aE, pick as aF, queuePromiseMicro as aG, refineDiagCount as aH, refineToIndexedFull as aI, resetNudoModuleExecCache as aJ, resetParseSourceCache as aK, resetSidecarLoadFailureCache as aL, serializeCheckJson as aM, serializeCheckJsonMulti as aN, setInterfaceDiagCollector as aO, setRefineDiagCollector as aP, shape as aQ, sidecarClosureFingerprint as aR, sidecarPathOf as aS, string as aT, takeInterfaceDiags as aU, takeInterfaceDiagsSince as aV, takeRefineDiags as aW, takeRefineDiagsSince as aX, throwConstraintToKinds as aY, union as aZ, extractNudoImports as aa, extractRefineReturnFromSource as ab, extractRefinesFromSource as ac, fn as ad, fnConstraintToEntryReqs as ae, formatCheckReport as af, formatConstraint as ag, formatDiagnostics as ah, formatEffectiveInterfaceDisplay as ai, formatGithubAnnotations as aj, formatGitlabCodeQuality as ak, formatInterfaceTierLine as al, generatedExportNames as am, getParseSourceCacheSize as an, getTerm as ao, instantiateConstraint as ap, interfaceDiagCount as aq, interfaceSourceOf as ar, interfaceTierOf as as, isIntFlag as at, isNodeModulesPath as au, isNudoConstraint as av, leavePromiseExecutorScope as aw, lenTerm as ax, litC as ay, localNamedExports as az, type LoadDepsFingerprint as b, extractAllLoadSpecs as c, defaultLeakBudget as d, exceedsBudget as e, loadModuleDepsFingerprint as f, getPromiseMicrosLength as g, resolveDepPath as h, stablePathKey as i, stablePathKeyGraph as j, termNodes as k, leakIfNeeded as l, maybeLeak as m, normPath as n, type CheckReport as o, parseSource as p, CONSTRAINT_BUILDERS as q, resetLeakCounter as r, sidecarSpecsOf as s, termDepth as t, CONSTRAINT_BUILDER_NAMES as u, CONSTRAINT_EXPR_RE as v, type CheckAction as w, type CheckJson as x, type CheckJsonMulti as y, type ConstraintBuilder as z };
|