@nudojs/core 1.7.0 → 1.7.2

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/internal.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import {
2
2
  canSkipLiteralCallScan,
3
3
  checkInjectedDomainEvidence,
4
+ createDiagChannel,
5
+ createScopedDiagChannel,
4
6
  exportedNameOfLocal,
5
7
  extractAllLoadSpecs,
6
8
  fnFingerprints,
@@ -19,7 +21,7 @@ import {
19
21
  stableAnalyzeKeySource,
20
22
  stablePathKey,
21
23
  stablePathKeyGraph
22
- } from "./chunk-CEYNHXFC.js";
24
+ } from "./chunk-XVU2O6VF.js";
23
25
  import {
24
26
  $tryDigestSoft,
25
27
  $tryMarkSoft,
@@ -37,7 +39,11 @@ import {
37
39
  PROMISE_MICRO_OVERFLOW_LABEL,
38
40
  ProjectionBudget,
39
41
  abortDerivationSession,
42
+ absLit,
43
+ absNumLit,
44
+ absStrLit,
40
45
  absTemplateViews,
46
+ allAbsStr,
41
47
  allFixedTextOfViews,
42
48
  anyMemberResult,
43
49
  awaitAbs,
@@ -50,6 +56,7 @@ import {
50
56
  clearPureMemo,
51
57
  coerceAsyncReturn,
52
58
  concatString,
59
+ createScopedSlot,
53
60
  createTemplateAbs,
54
61
  decideEndsWith,
55
62
  decideIncludes,
@@ -124,10 +131,12 @@ import {
124
131
  pushMayThrowFrame,
125
132
  recordMayThrow,
126
133
  recordMemberDiag,
134
+ registerCollectorScopeParticipant,
127
135
  resetAbsCallBudget,
128
136
  resetEvalFallbackStats,
129
137
  resetEvalForkBudget,
130
138
  resetLeakCounter,
139
+ runWithCollectorScope,
131
140
  runWithEvalMissingSlot,
132
141
  runWithMayThrowSession,
133
142
  scanStringLiterals,
@@ -160,7 +169,7 @@ import {
160
169
  withEvalBudgetOverride,
161
170
  withFnBudgetOverride,
162
171
  wrapPromise
163
- } from "./chunk-LZJC7X5J.js";
172
+ } from "./chunk-TO2W45NU.js";
164
173
 
165
174
  // src/algebra/inlay.ts
166
175
  function listFunctions(source) {
@@ -605,7 +614,11 @@ export {
605
614
  PROMISE_MICRO_OVERFLOW_LABEL,
606
615
  ProjectionBudget,
607
616
  abortDerivationSession,
617
+ absLit,
618
+ absNumLit,
619
+ absStrLit,
608
620
  absTemplateViews,
621
+ allAbsStr,
609
622
  allFixedTextOfViews,
610
623
  anyMemberResult,
611
624
  awaitAbs,
@@ -621,6 +634,9 @@ export {
621
634
  coerceAsyncReturn,
622
635
  collectAbsInlays,
623
636
  concatString,
637
+ createDiagChannel,
638
+ createScopedDiagChannel,
639
+ createScopedSlot,
624
640
  createTemplateAbs,
625
641
  decideEndsWith,
626
642
  decideIncludes,
@@ -705,6 +721,7 @@ export {
705
721
  pushMayThrowFrame,
706
722
  recordMayThrow,
707
723
  recordMemberDiag,
724
+ registerCollectorScopeParticipant,
708
725
  resetAbsCallBudget,
709
726
  resetEvalFallbackStats,
710
727
  resetEvalForkBudget,
@@ -712,6 +729,7 @@ export {
712
729
  resetHashSourceCache,
713
730
  resetLeakCounter,
714
731
  resolveDepPath,
732
+ runWithCollectorScope,
715
733
  runWithEvalMissingSlot,
716
734
  runWithMayThrowSession,
717
735
  safeMemberAccess,
@@ -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-Dg7gQO2z.js';
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-BuTz_p4k.js';
3
3
 
4
4
  declare function resetParseSourceCache(): void;
5
5
  declare function getParseSourceCacheSize(): number;
@@ -356,6 +356,45 @@ declare function extractFnBudget(source: string, fnName: string): {
356
356
  depth?: number;
357
357
  } | undefined;
358
358
 
359
+ /**
360
+ * 源文件导出面 AST 扫描:localNamedExports(本地导出名表,侧车自动绑定
361
+ * 边界)/ exportedNameOfLocal(DESIGN-003 本地名→导出名查询)/
362
+ * generatedExportNames(侧车生成段识别)。
363
+ * 自 interface.ts 机械拆出(纯解析层,只依赖 parse-source);语义未改。
364
+ * interface.ts 头部 re-export 维持其既有导出面(index.ts / internal.ts 不变形)。
365
+ */
366
+ /**
367
+ * 源文件本地导出名表(侧车自动绑定边界):
368
+ * - ESM:`export function/const/let/var/class` 与本地 `export { x }` /
369
+ * `export { local as exported }`(按**导出名**绑定);
370
+ * - `export default function add` / `const add = …; export default add`:
371
+ * 按**本地名** `add` 绑定(侧车可 `export const add = fn(…)`);
372
+ * 同时登记 `"default"`,供侧车 `export default fn(…)` 对齐;
373
+ * - CJS(C4.3):`module.exports = { a, b }`、`module.exports.a = …`、
374
+ * `exports.a = …`、`module.exports = localFn`(登记 localFn 名)。
375
+ * 排除 re-export(`export {x} from` / `export *`)。
376
+ */
377
+ declare function localNamedExports(source: string): Set<string>;
378
+ /**
379
+ * `export { local as exported }`(含 string 导出名 `export { x as "a-b" }`)
380
+ * 的本地声明名 → 导出名查询(DESIGN-003:契约身份=导出名)。声明形态
381
+ * (exported === local)与 default 形态不进表——default 走 C4.4 的
382
+ * 本地名/default 双键绑定,身份保持本地名。解析失败 / 无别名子句 →
383
+ * undefined。
384
+ */
385
+ declare function exportedNameOfLocal(source: string, localName: string): string | undefined;
386
+ /**
387
+ * 侧车源码的生成段导出名:export 之前(跳过紧邻的 import/const 链)的注释
388
+ * 行含 `@generated` → 该名为 generated。组合式下行段(§5.3)形态为
389
+ * `import` + `@generated 头` + prelude + export;callsite 段则是头紧贴
390
+ * export。隔了其他代码行 / 无标记 / re-export 列表均不算。
391
+ *
392
+ * DESIGN-003 别名段:导出名不是合法绑定名(保留字 / 非 ident)时发射为
393
+ * `const _nudo_1 = …; export { _nudo_1 as class };` —— 身份恒为**导出名**
394
+ * (`class` / string 名),不是绑定别名。
395
+ */
396
+ declare function generatedExportNames(sidecarSrc: string): Set<string>;
397
+
359
398
  /**
360
399
  * Interface 分层推导(design-refine-derivation §2.1/§2.2/§11 第 0 步):
361
400
  *
@@ -405,37 +444,7 @@ declare function takeInterfaceDiags(): InterfaceDiag[];
405
444
  declare function takeInterfaceDiagsSince(since: number): InterfaceDiag[];
406
445
  /** 有效契约来源:手写(源码 refine ∪ 侧车手写绑定)> 生成段 > 隐式 */
407
446
  type InterfaceSource = "handwritten" | "generated" | "implicit";
408
- /**
409
- * 源文件本地导出名表(侧车自动绑定边界):
410
- * - ESM:`export function/const/let/var/class` 与本地 `export { x }` /
411
- * `export { local as exported }`(按**导出名**绑定);
412
- * - `export default function add` / `const add = …; export default add`:
413
- * 按**本地名** `add` 绑定(侧车可 `export const add = fn(…)`);
414
- * 同时登记 `"default"`,供侧车 `export default fn(…)` 对齐;
415
- * - CJS(C4.3):`module.exports = { a, b }`、`module.exports.a = …`、
416
- * `exports.a = …`、`module.exports = localFn`(登记 localFn 名)。
417
- * 排除 re-export(`export {x} from` / `export *`)。
418
- */
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;
428
- /**
429
- * 侧车源码的生成段导出名:export 之前(跳过紧邻的 import/const 链)的注释
430
- * 行含 `@generated` → 该名为 generated。组合式下行段(§5.3)形态为
431
- * `import` + `@generated 头` + prelude + export;callsite 段则是头紧贴
432
- * export。隔了其他代码行 / 无标记 / re-export 列表均不算。
433
- *
434
- * DESIGN-003 别名段:导出名不是合法绑定名(保留字 / 非 ident)时发射为
435
- * `const _nudo_1 = …; export { _nudo_1 as class };` —— 身份恒为**导出名**
436
- * (`class` / string 名),不是绑定别名。
437
- */
438
- declare function generatedExportNames(sidecarSrc: string): Set<string>;
447
+
439
448
  type EffectiveInterfaceOpts = RefineResolveOpts & {
440
449
  /** false(或谓词返回 false)→ 不 ambient 加载侧车;默认 true */
441
450
  autoBind?: boolean | ((sidecarPath: string) => boolean);
@@ -258,11 +258,27 @@ type LitValueResult = {
258
258
  ok: false;
259
259
  };
260
260
  declare function litValue(a: Abs): LitValueResult;
261
+ /** 抽取 number 字面量值;入参缺省 / term 非 lit / 值非 number → undefined */
262
+ declare function absNumLit(a: Abs | undefined): number | undefined;
263
+ /** 抽取 string 字面量值;入参缺省 / term 非 lit / 值非 string → undefined */
264
+ declare function absStrLit(a: Abs | undefined): string | undefined;
265
+ /** 全员 string 字面量才命中(variadic 内建折叠,如 path.join);任一未命中 → undefined */
266
+ declare function allAbsStr(args: Abs[]): string[] | undefined;
267
+ /**
268
+ * 具体值 → 字面量 Abs(.d.ts 字面量类型节点物化):
269
+ * num/str/bool → lit 构造;bigint → 无 term 的 exact prim(d.ts 不保数值);
270
+ * null/undefined → unknown 叶子(不 brand —— 与 env 显示层的 branded null 区分)。
271
+ */
272
+ declare function absLit(value: string | number | boolean | bigint | null | undefined): Abs;
261
273
 
262
274
  /**
263
- * may-throw 效果收集(design-cli-semantics §3.3)。
275
+ * may-throw 效果收集(design-cli-semantics §3.3)(内核叶子模块)。
264
276
  * any/nullish 成员访问等危险操作记录 throws 域,不立刻 hard-fail 求值。
265
277
  * Collector/tryFrames 经 AsyncLocalStorage 会话隔离,避免 LSP 并发串档。
278
+ * 内核算子(arithmetic/surface 等)对「可能抛」的运算记 soft 效果——
279
+ * 原语定居 algebra/(内核不得 import exec/);exec/may-throw.ts re-export
280
+ * 维持引擎侧既有 import 面(runtime/*、check*、internal 均经老路径可达)。
281
+ * 依赖面:仅 ./abs.ts 与 node:async_hooks(core 既有依赖,不引入新面)。
266
282
  */
267
283
 
268
284
  type MayThrowEffect = {
@@ -770,4 +786,4 @@ declare function callTranspiledExport(exports: Record<string, unknown>, name: st
770
786
  */
771
787
  declare function callTranspiledExportApply(exports: Record<string, unknown> | (() => Record<string, unknown>), name: string): (args: Abs[], thisVal?: Abs) => AbsApplyResult;
772
788
 
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 };
789
+ export { $tryDigestSoft as $, type Abs as A, popMayThrowFrame as B, type Confidence as C, pushMayThrowFrame as D, ERROR_FAMILY as E, recordMayThrow as F, resetEvalFallbackStats as G, runWithMayThrowSession as H, setMayThrowCollector as I, throwAbsToKinds as J, throwsKindCovered as K, type LiteralValue as L, type MayThrowEffect as M, withEvalBudgetOverride as N, type HofCollectCtx as O, type PrimName as P, type HofSite as Q, type RelSource as R, type Shape as S, type Term as T, type AbsModuleExports as U, type RunTranspiledOptions as V, $assignRecord as W, $call as X, $callNamed as Y, $recordBinding as Z, type AbsApplyNoThrow as _, type Pred as a, negatePred as a$, type AbsApplyNoThrowFn as a0, type AbsApplyResult as a1, type AbsApplyReturn as a2, type AbsFnImpl as a3, type AbsSigImpl as a4, type EvalAbsAssignRecord as a5, type EvalCallRecord as a6, type EvalFallback as a7, type ImplicationOracle as a8, type LitValueResult as a9, emptyPhi as aA, eq as aB, evalExprAbs as aC, ge as aD, geNum as aE, getEvalCallCollector as aF, getFnImpl as aG, getImplicationOracle as aH, gt as aI, gtNum as aJ, implies as aK, isAbsApplyResult as aL, isAbsVal as aM, isBigPrim as aN, isExactLit as aO, isNumPrim as aP, isStrPrim as aQ, le as aR, leNum as aS, lit as aT, litValue as aU, lt as aV, ltNum as aW, makeAbsApplyResult as aX, markPureFn as aY, namespaceAbsOf as aZ, ne as a_, MAX_EVAL_CALL_DEPTH as aa, MAX_EVAL_TOTAL_CALLS as ab, RUNTIME_IMPORT_RE as ac, TYPEOF_NAMES as ad, type TranspiledCallResult as ae, type TypeofName as af, abs as ag, absFunction as ah, absOnly as ai, absToString as aj, and as ak, anyAbs as al, anyVar as am, app as an, assumeFinite as ao, attachFnImpl as ap, bigintLit as aq, bindImports as ar, bindingsOf as as, bool as at, boolLit as au, callTranspiledExport as av, callTranspiledExportApply as aw, callTranspiledExportFull as ax, collectAbsExports as ay, confJoin as az, type Phi as b, never as b0, not as b1, noteEvalCallRecord as b2, noteEvalFallback as b3, num as b4, numLit as b5, numVar as b6, obj as b7, or as b8, pFalse as b9, termToString as bA, tryRunTranspiled as bB, unknown as bC, v as bD, routeApplyThrows as bE, pTrue as ba, phiAnd as bb, predEquals as bc, predToString as bd, predVars as be, primToTypeof as bf, ptypeof as bg, pureFnNameOf as bh, relationFingerprint as bi, relationFn as bj, resetEvalCallBudget as bk, runTranspiled as bl, runTranspiledOptionsMemoKey as bm, setEvalAssignCollector as bn, setEvalBindingSink as bo, setEvalCallCollector as bp, setEvalFallbackCollector as bq, setImplicationOracle as br, shapeOfTerm as bs, shapeOnlyFn as bt, shapeToString as bu, simplifyTerm as bv, str as bw, strLit as bx, substPred as by, termEquals as bz, type AstEnv as c, $tryMarkSoft as d, $tryReleaseSoft as e, type EvalFallbackStats as f, absLit as g, absNumLit as h, absStrLit as i, allAbsStr as j, clearPureCallMemo as k, clearPureMemo as l, enterEvalCallBudgetSession as m, errorTypeAbs as n, exitEvalCallBudgetSession as o, filterDeclaredThrows as p, filterGateThrows as q, filterIgnoredThrows as r, flushMayThrowEffects as s, formatThrowsAbs as t, getEvalCallBudgetState as u, getEvalFallbackStats as v, getMayThrowCollector as w, isThrowsIgnored as x, mayThrowEffectsToAbs as y, orphanMayThrowEffects as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nudojs/core",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "engines": {
5
5
  "node": ">=20"
6
6
  },