nudojs 1.3.15 → 1.3.17

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.
Files changed (2) hide show
  1. package/dist/index.js +490 -211
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -19481,7 +19481,12 @@ var init_unsupported = __esm({
19481
19481
  });
19482
19482
 
19483
19483
  // ../core/src/algebra/param-surface.ts
19484
- function collectPatternNames(p, top, nested, depth, propKey) {
19484
+ function pushNestedPath(prefix2, key, nestedPaths) {
19485
+ if (prefix2.length === 0 || !key) return;
19486
+ if (key.includes(".") || prefix2.some((seg) => seg.includes("."))) return;
19487
+ nestedPaths.push([...prefix2, key].join("."));
19488
+ }
19489
+ function collectPatternNames(p, top, nested, depth, propKey, prefix2, nestedPaths) {
19485
19490
  if (!p) return;
19486
19491
  if (p.type === "Identifier" && p.name) {
19487
19492
  if (depth === 0) top.push(p.name);
@@ -19489,17 +19494,17 @@ function collectPatternNames(p, top, nested, depth, propKey) {
19489
19494
  return;
19490
19495
  }
19491
19496
  if (p.type === "AssignmentPattern") {
19492
- collectPatternNames(p.left, top, nested, depth, propKey);
19497
+ collectPatternNames(p.left, top, nested, depth, propKey, prefix2, nestedPaths);
19493
19498
  return;
19494
19499
  }
19495
19500
  if (p.type === "RestElement") {
19496
- collectPatternNames(p.argument, top, nested, depth, propKey);
19501
+ collectPatternNames(p.argument, top, nested, depth, propKey, prefix2, nestedPaths);
19497
19502
  return;
19498
19503
  }
19499
19504
  if (p.type === "ObjectPattern") {
19500
19505
  for (const prop of p.properties ?? []) {
19501
19506
  if (prop.type === "RestElement" || prop.argument) {
19502
- collectPatternNames(prop.argument, top, nested, depth, propKey);
19507
+ collectPatternNames(prop.argument, top, nested, depth, propKey, prefix2, nestedPaths);
19503
19508
  continue;
19504
19509
  }
19505
19510
  const keyName = prop.key?.type === "Identifier" && prop.key.name ? prop.key.name : prop.key && "value" in prop.key ? String(prop.key.value ?? "") : void 0;
@@ -19511,7 +19516,17 @@ function collectPatternNames(p, top, nested, depth, propKey) {
19511
19516
  else nested.push(keyName);
19512
19517
  if (propKey && depth === 0) propKey[keyName] = keyName;
19513
19518
  }
19519
+ const patternValueKeyRule = () => {
19520
+ if (!keyName) return;
19521
+ if (depth === 0 && prefix2.length === 0) {
19522
+ top.push(keyName);
19523
+ if (propKey) propKey[keyName] = keyName;
19524
+ } else {
19525
+ pushNestedPath(prefix2, keyName, nestedPaths);
19526
+ }
19527
+ };
19514
19528
  if (v2.type === "Identifier" && v2.name) {
19529
+ pushNestedPath(prefix2, keyName ?? "", nestedPaths);
19515
19530
  if (depth === 0) {
19516
19531
  top.push(v2.name);
19517
19532
  if (propKey && keyName) propKey[v2.name] = keyName;
@@ -19519,15 +19534,38 @@ function collectPatternNames(p, top, nested, depth, propKey) {
19519
19534
  } else if (v2.type === "AssignmentPattern") {
19520
19535
  const left = v2.left;
19521
19536
  if (left?.type === "Identifier" && left.name) {
19537
+ pushNestedPath(prefix2, keyName ?? "", nestedPaths);
19522
19538
  if (depth === 0) {
19523
19539
  top.push(left.name);
19524
19540
  if (propKey && keyName) propKey[left.name] = keyName;
19525
19541
  } else nested.push(left.name);
19542
+ } else if (left && (left.type === "ObjectPattern" || left.type === "ArrayPattern")) {
19543
+ patternValueKeyRule();
19544
+ collectPatternNames(
19545
+ v2,
19546
+ top,
19547
+ nested,
19548
+ depth,
19549
+ propKey,
19550
+ prefix2.concat(keyName ? [keyName] : []),
19551
+ nestedPaths
19552
+ );
19526
19553
  } else {
19527
- collectPatternNames(v2, top, nested, depth, propKey);
19528
- }
19554
+ collectPatternNames(v2, top, nested, depth, propKey, prefix2, nestedPaths);
19555
+ }
19556
+ } else if (v2.type === "ObjectPattern" || v2.type === "ArrayPattern") {
19557
+ patternValueKeyRule();
19558
+ collectPatternNames(
19559
+ v2,
19560
+ top,
19561
+ nested,
19562
+ depth + 1,
19563
+ propKey,
19564
+ prefix2.concat(keyName ? [keyName] : []),
19565
+ nestedPaths
19566
+ );
19529
19567
  } else {
19530
- collectPatternNames(v2, top, nested, depth + 1, propKey);
19568
+ collectPatternNames(v2, top, nested, depth + 1, propKey, prefix2, nestedPaths);
19531
19569
  }
19532
19570
  }
19533
19571
  return;
@@ -19539,9 +19577,9 @@ function collectPatternNames(p, top, nested, depth, propKey) {
19539
19577
  if (depth === 0) top.push(el.name);
19540
19578
  else nested.push(el.name);
19541
19579
  } else if (el.type === "AssignmentPattern") {
19542
- collectPatternNames(el, top, nested, depth, propKey);
19580
+ collectPatternNames(el, top, nested, depth, propKey, [], nestedPaths);
19543
19581
  } else {
19544
- collectPatternNames(el, top, nested, depth + 1, propKey);
19582
+ collectPatternNames(el, top, nested, depth + 1, propKey, [], nestedPaths);
19545
19583
  }
19546
19584
  }
19547
19585
  }
@@ -19560,13 +19598,15 @@ function formalParamsFromNodes(params) {
19560
19598
  const top2 = [];
19561
19599
  const nested2 = [];
19562
19600
  const propKey2 = {};
19563
- if (left) collectPatternNames(left, top2, nested2, 0, propKey2);
19601
+ const nestedPaths2 = [];
19602
+ if (left) collectPatternNames(left, top2, nested2, 0, propKey2, [], nestedPaths2);
19564
19603
  return {
19565
19604
  kind: "pattern",
19566
19605
  placeholder: `_p${index2}`,
19567
19606
  bound: top2,
19568
19607
  propKey: propKey2,
19569
19608
  nested: nested2,
19609
+ nestedPaths: nestedPaths2,
19570
19610
  index: index2
19571
19611
  };
19572
19612
  }
@@ -19578,13 +19618,15 @@ function formalParamsFromNodes(params) {
19578
19618
  const top = [];
19579
19619
  const nested = [];
19580
19620
  const propKey = {};
19581
- if (p) collectPatternNames(p, top, nested, 0, propKey);
19621
+ const nestedPaths = [];
19622
+ if (p) collectPatternNames(p, top, nested, 0, propKey, [], nestedPaths);
19582
19623
  return {
19583
19624
  kind: "pattern",
19584
19625
  placeholder: `_p${index2}`,
19585
19626
  bound: top,
19586
19627
  propKey,
19587
19628
  nested,
19629
+ nestedPaths,
19588
19630
  index: index2
19589
19631
  };
19590
19632
  });
@@ -19626,6 +19668,7 @@ function contractParamNameSet(formals) {
19626
19668
  out.add(f.placeholder);
19627
19669
  out.add("_");
19628
19670
  for (const b of f.bound) out.add(b);
19671
+ for (const np of f.nestedPaths) out.add(np);
19629
19672
  }
19630
19673
  }
19631
19674
  return out;
@@ -19643,10 +19686,16 @@ function locateContractParam(formals, contractName) {
19643
19686
  return { index: f.index };
19644
19687
  }
19645
19688
  if (f.bound.includes(contractName)) {
19646
- return { index: f.index, field: f.propKey?.[contractName] ?? contractName };
19689
+ const field = f.propKey?.[contractName] ?? contractName;
19690
+ return { index: f.index, field, fieldPath: [field] };
19647
19691
  }
19648
19692
  }
19649
19693
  }
19694
+ for (const f of formals) {
19695
+ if (f.kind === "pattern" && f.nestedPaths.includes(contractName)) {
19696
+ return { index: f.index, field: contractName, fieldPath: contractName.split(".") };
19697
+ }
19698
+ }
19650
19699
  return void 0;
19651
19700
  }
19652
19701
  var init_param_surface = __esm({
@@ -21075,19 +21124,36 @@ function mergeGuardInto(list, g) {
21075
21124
  if (grainA !== grainB) prev.grain = "nullish";
21076
21125
  if (prev.memberKey === void 0 && g.memberKey !== void 0) prev.memberKey = g.memberKey;
21077
21126
  }
21127
+ function appendReceiverGuards(test, out) {
21128
+ const facts = [];
21129
+ collectReceiverFacts(test, "both", facts);
21130
+ for (const f of facts) {
21131
+ const prev = out.find((x) => x.name === f.name && x.arm === f.arm);
21132
+ if (!prev) {
21133
+ out.push(f);
21134
+ continue;
21135
+ }
21136
+ const grainA = prev.grain ?? "nullish";
21137
+ const grainB = f.grain ?? "nullish";
21138
+ if (grainA !== grainB) prev.grain = "nullish";
21139
+ if (prev.memberKey === void 0 && f.memberKey !== void 0) prev.memberKey = f.memberKey;
21140
+ }
21141
+ }
21078
21142
  function nullishGuardsOf(test) {
21079
21143
  const t = test;
21080
21144
  if (t?.type === "LogicalExpression" && (t.operator === "||" || t.operator === "&&")) {
21081
21145
  const wantArm = t.operator === "||" ? "alt" : "cons";
21082
- const out = [];
21146
+ const out2 = [];
21083
21147
  for (const g2 of [...nullishGuardsOf(t.left), ...nullishGuardsOf(t.right)]) {
21084
21148
  if (g2.arm !== wantArm) continue;
21085
- mergeGuardInto(out, g2);
21149
+ mergeGuardInto(out2, g2);
21086
21150
  }
21087
- return out;
21151
+ return out2;
21088
21152
  }
21089
21153
  const g = nullishGuardOf(test);
21090
- return g ? [g] : [];
21154
+ const out = g ? [g] : [];
21155
+ appendReceiverGuards(test, out);
21156
+ return out;
21091
21157
  }
21092
21158
  function typeGuardOf(test) {
21093
21159
  const t = test;
@@ -21178,7 +21244,7 @@ function narrowDiscriminantArmThunks(thunk, guards, arm, forkBindingNames) {
21178
21244
  ).join(", ");
21179
21245
  return `((${params}) => ${thunk})(${args})`;
21180
21246
  }
21181
- var TYPEOF_NAMES2, isStrLitNode, typeofArgName, memberGuardTarget, assignGuardTarget, isPrimLitNode;
21247
+ var TYPEOF_NAMES2, isStrLitNode, typeofArgName, memberGuardTarget, assignGuardTarget, methodReceiverTarget, collectReceiverFacts, isPrimLitNode;
21182
21248
  var init_stmt_predicates = __esm({
21183
21249
  "../core/src/algebra/exec/transpile/stmt-predicates.ts"() {
21184
21250
  "use strict";
@@ -21208,9 +21274,17 @@ var init_stmt_predicates = __esm({
21208
21274
  const t = n;
21209
21275
  const m = t?.type === "ChainExpression" ? t.expression : t;
21210
21276
  if (m?.type !== "MemberExpression" && m?.type !== "OptionalMemberExpression") return void 0;
21211
- if (m.computed) return void 0;
21212
21277
  if (m.object?.type !== "Identifier" || !m.object.name) return void 0;
21213
21278
  const p = m.property;
21279
+ if (m.computed) {
21280
+ if (p?.type === "NumericLiteral" && typeof p.value === "number") {
21281
+ return { name: m.object.name, key: String(p.value) };
21282
+ }
21283
+ if (p?.type === "StringLiteral" && typeof p.value === "string" && /^-?\d+$/.test(p.value)) {
21284
+ return { name: m.object.name, key: p.value };
21285
+ }
21286
+ return void 0;
21287
+ }
21214
21288
  const key = p?.type === "Identifier" ? p.name : p?.type === "StringLiteral" && typeof p.value === "string" ? p.value : void 0;
21215
21289
  if (key === void 0) return void 0;
21216
21290
  return { name: m.object.name, key };
@@ -21222,6 +21296,59 @@ var init_stmt_predicates = __esm({
21222
21296
  }
21223
21297
  return void 0;
21224
21298
  };
21299
+ methodReceiverTarget = (callee) => {
21300
+ const c = callee;
21301
+ if (c?.type !== "MemberExpression") return void 0;
21302
+ const o = c.object;
21303
+ if (o?.type === "Identifier" && o.name) return { name: o.name };
21304
+ if (o?.type === "MemberExpression") return memberGuardTarget(o);
21305
+ return void 0;
21306
+ };
21307
+ collectReceiverFacts = (n, ctx2, out) => {
21308
+ if (ctx2 === null || !n || typeof n !== "object") return;
21309
+ const t = n;
21310
+ switch (t.type) {
21311
+ case "LogicalExpression":
21312
+ if (t.operator === "&&" || t.operator === "||") {
21313
+ const rArm = t.operator === "&&" ? "cons" : "alt";
21314
+ collectReceiverFacts(t.left, ctx2, out);
21315
+ collectReceiverFacts(
21316
+ t.right,
21317
+ ctx2 === "both" || ctx2 === rArm ? rArm : null,
21318
+ out
21319
+ );
21320
+ } else if (t.operator === "??") {
21321
+ collectReceiverFacts(t.left, ctx2, out);
21322
+ }
21323
+ return;
21324
+ case "ConditionalExpression":
21325
+ collectReceiverFacts(t.test, ctx2, out);
21326
+ return;
21327
+ case "CallExpression": {
21328
+ const recv = methodReceiverTarget(t.callee);
21329
+ if (recv) {
21330
+ for (const arm of ctx2 === "both" ? ["cons", "alt"] : [ctx2]) {
21331
+ out.push({
21332
+ name: recv.name,
21333
+ arm,
21334
+ grain: "nullish",
21335
+ ...recv.key !== void 0 ? { memberKey: recv.key } : {}
21336
+ });
21337
+ }
21338
+ }
21339
+ collectReceiverFacts(t.callee, ctx2, out);
21340
+ for (const a of t.arguments ?? []) collectReceiverFacts(a, ctx2, out);
21341
+ return;
21342
+ }
21343
+ default:
21344
+ collectReceiverFacts(t.left, ctx2, out);
21345
+ collectReceiverFacts(t.right, ctx2, out);
21346
+ collectReceiverFacts(t.argument, ctx2, out);
21347
+ collectReceiverFacts(t.object, ctx2, out);
21348
+ if (t.computed) collectReceiverFacts(t.property, ctx2, out);
21349
+ return;
21350
+ }
21351
+ };
21225
21352
  isPrimLitNode = (n) => {
21226
21353
  const t = n;
21227
21354
  if (t?.type === "StringLiteral") return typeof t.value === "string";
@@ -32238,10 +32365,32 @@ function execRegexBrand(re, method, args) {
32238
32365
  if (method === "test") {
32239
32366
  return abs({ k: "prim", type: "boolean" }, void 0, void 0, "partial");
32240
32367
  }
32241
- const element = joinAbs(str(), undefAbs());
32242
- const matchAbs = abs({ k: "arr", element }, void 0, void 0, "path");
32243
- const nullAbs3 = abs({ k: "unknown" }, { op: "lit", value: null }, void 0, "exact");
32244
- return joinAbs(nullAbs3, matchAbs);
32368
+ let probe = null;
32369
+ try {
32370
+ probe = new RegExp(`${parts.pat}|`).exec("");
32371
+ } catch {
32372
+ probe = null;
32373
+ }
32374
+ const nullArm = abs({ k: "unknown" }, { op: "lit", value: null }, void 0, "exact");
32375
+ if (!probe) {
32376
+ const element = joinAbs(str(), undefAbs());
32377
+ return joinAbs(nullArm, abs({ k: "arr", element }, void 0, void 0, "path"));
32378
+ }
32379
+ const ng = probe.length - 1;
32380
+ const slots = {
32381
+ "0": { value: str() },
32382
+ length: { value: numLit(probe.length) },
32383
+ index: { value: num() },
32384
+ input: { value: str() }
32385
+ };
32386
+ for (let i = 1; i <= ng; i++) {
32387
+ slots[String(i)] = { value: joinAbs(str(), undefAbs()) };
32388
+ }
32389
+ const groupNames = probe.groups ? Object.keys(probe.groups) : [];
32390
+ slots["groups"] = {
32391
+ value: groupNames.length ? objOf(Object.fromEntries(groupNames.map((n) => [n, { value: joinAbs(str(), undefAbs()) }]))) : undefAbs()
32392
+ };
32393
+ return joinAbs(nullArm, abs({ k: "obj", slots }, void 0, void 0, "path"));
32245
32394
  }
32246
32395
  try {
32247
32396
  return regexExecWithState(re, method, subject).result;
@@ -41455,8 +41604,8 @@ function formatEffectiveInterfaceDisplay(eff) {
41455
41604
  if (eff.returns) s += ` \u2192 ${formatConstraint(eff.returns.constraint)}`;
41456
41605
  return s;
41457
41606
  }
41458
- function formatInterfaceTierLine(source) {
41459
- return `\u25CF interface / ${source}`;
41607
+ function formatInterfaceTierLine(source, active = true) {
41608
+ return `${active ? "\u25CF" : "\u25CB"} contract / ${INTERFACE_SOURCE_ABBR[source]}`;
41460
41609
  }
41461
41610
  function interfaceTierOf(source, fnName, fromFile, opts = {}) {
41462
41611
  if (!localNamedExports(source).has(fnName)) return void 0;
@@ -41470,7 +41619,7 @@ function interfaceTierOf(source, fnName, fromFile, opts = {}) {
41470
41619
  function interfaceSourceOf(source, fnName, fromFile, opts = {}) {
41471
41620
  return interfaceTierOf(source, fnName, fromFile, opts)?.source;
41472
41621
  }
41473
- var MAX_INTERFACE_DIAGS, interfaceDiagChannel, sidecarLoadFailureSlot, MAX_SIDECAR_FP_NODES, LAZY_DISPLAY_DEPTH;
41622
+ var MAX_INTERFACE_DIAGS, interfaceDiagChannel, sidecarLoadFailureSlot, MAX_SIDECAR_FP_NODES, LAZY_DISPLAY_DEPTH, INTERFACE_SOURCE_ABBR;
41474
41623
  var init_interface = __esm({
41475
41624
  "../core/src/algebra/interface.ts"() {
41476
41625
  "use strict";
@@ -41495,6 +41644,11 @@ var init_interface = __esm({
41495
41644
  registerCollectorScopeParticipant((body) => sidecarLoadFailureSlot.runScoped(body));
41496
41645
  MAX_SIDECAR_FP_NODES = 64;
41497
41646
  LAZY_DISPLAY_DEPTH = 2;
41647
+ INTERFACE_SOURCE_ABBR = {
41648
+ handwritten: "hw",
41649
+ generated: "gen",
41650
+ implicit: "imp"
41651
+ };
41498
41652
  }
41499
41653
  });
41500
41654
 
@@ -41718,11 +41872,11 @@ function sidecarSpecsOf(source) {
41718
41872
  (spec) => (spec.startsWith(".") || spec.startsWith("/")) && (spec.endsWith(".nudo.js") || spec.endsWith(".nudo.ts"))
41719
41873
  );
41720
41874
  }
41721
- function loadOrMiss(loadModule, spec, from) {
41875
+ function tryLoadDeps(loadModule, spec, from) {
41722
41876
  try {
41723
- return loadModule(spec, from);
41877
+ return { src: loadModule(spec, from), err: false };
41724
41878
  } catch {
41725
- return void 0;
41879
+ return { src: void 0, err: true };
41726
41880
  }
41727
41881
  }
41728
41882
  function loadModuleDepsFingerprint(source, loadModule, fromFile) {
@@ -41735,16 +41889,35 @@ function loadModuleDepsFingerprint(source, loadModule, fromFile) {
41735
41889
  );
41736
41890
  let n = 0;
41737
41891
  let truncated = false;
41892
+ let readError = false;
41893
+ const load = (spec, from) => {
41894
+ const a = tryLoadDeps(loadModule, spec, from);
41895
+ if (a.err) readError = true;
41896
+ return a;
41897
+ };
41738
41898
  const finish = () => {
41739
41899
  parts.sort();
41740
- return truncated ? { fp: `trunc:${parts.join(",")}`, paths, contents, truncated: true } : { fp: parts.join(","), paths, contents, truncated: false };
41900
+ const prefix2 = truncated ? "trunc:" : readError ? "readerr:" : "";
41901
+ return {
41902
+ fp: `${prefix2}${parts.join(",")}`,
41903
+ paths,
41904
+ contents,
41905
+ truncated,
41906
+ readError
41907
+ };
41741
41908
  };
41742
41909
  const absorbSidecarClosure = (entryFile) => {
41743
41910
  const sidecarPath = sidecarPathOf(entryFile);
41744
41911
  if (seen.has(sidecarPath)) return;
41745
41912
  const sidecarSpec = `./${sidecarPath.slice(sidecarPath.lastIndexOf("/") + 1)}`;
41746
- const sidecarSrc = loadOrMiss(loadModule, sidecarSpec, entryFile);
41747
- if (sidecarSrc === void 0) return;
41913
+ const root = load(sidecarSpec, entryFile);
41914
+ if (root.err) {
41915
+ paths.push(sidecarPath);
41916
+ contents.push({ path: sidecarPath, content: null });
41917
+ return;
41918
+ }
41919
+ if (root.src === void 0) return;
41920
+ const sidecarSrc = root.src;
41748
41921
  if (n >= MAX_LOAD_DEP_NODES) {
41749
41922
  truncated = true;
41750
41923
  return;
@@ -41767,7 +41940,7 @@ function loadModuleDepsFingerprint(source, loadModule, fromFile) {
41767
41940
  if (seen.has(path)) continue;
41768
41941
  seen.add(path);
41769
41942
  n++;
41770
- const src = loadOrMiss(loadModule, cur.spec, cur.from);
41943
+ const src = load(cur.spec, cur.from).src;
41771
41944
  parts.push(`sidecar:${path}=${src === void 0 ? "miss" : hashSource(src)}`);
41772
41945
  paths.push(path);
41773
41946
  contents.push({ path, content: src ?? null });
@@ -41788,7 +41961,7 @@ function loadModuleDepsFingerprint(source, loadModule, fromFile) {
41788
41961
  if (seen.has(path)) continue;
41789
41962
  seen.add(path);
41790
41963
  n++;
41791
- const src = loadOrMiss(loadModule, cur.spec, cur.from);
41964
+ const src = load(cur.spec, cur.from).src;
41792
41965
  parts.push(`${path}=${src === void 0 ? "miss" : hashSource(src)}`);
41793
41966
  paths.push(path);
41794
41967
  contents.push({ path, content: src ?? null });
@@ -42442,7 +42615,7 @@ function loadModuleId(fn2) {
42442
42615
  }
42443
42616
  function refineDepsFingerprint(source, refine) {
42444
42617
  if (!refine?.loadModule || !refine.fromFile) {
42445
- return { fp: "-", paths: [], contents: [], truncated: false };
42618
+ return { fp: "-", paths: [], contents: [], truncated: false, readError: false };
42446
42619
  }
42447
42620
  return loadModuleDepsFingerprint(source, refine.loadModule, refine.fromFile);
42448
42621
  }
@@ -42458,7 +42631,7 @@ function moduleMapId(m) {
42458
42631
  function generalizeMemoKey(fnName, source, opts) {
42459
42632
  const r = opts.refine;
42460
42633
  const budget = opts.budget ?? defaultLeakBudget;
42461
- const deps = opts.depsFp ?? (r ? refineDepsFingerprint(source, r) : { fp: "-", paths: [], contents: [], truncated: false });
42634
+ const deps = opts.depsFp ?? (r ? refineDepsFingerprint(source, r) : { fp: "-", paths: [], contents: [], truncated: false, readError: false });
42462
42635
  const sc = opts.sidecarFp ?? (r?.loadModule && r.fromFile ? sidecarClosureFingerprint(r.fromFile, r) : void 0);
42463
42636
  const scPath = sc !== void 0 && !sc.startsWith("trunc:") && r?.fromFile ? sidecarPathOf(r.fromFile) : void 0;
42464
42637
  const srcPart = generalizeSourceKeyPart(source, fnName, opts.file);
@@ -42476,7 +42649,7 @@ function generalizeMemoKey(fnName, source, opts) {
42476
42649
  return {
42477
42650
  key,
42478
42651
  depPaths: scPath !== void 0 ? [...deps.paths, scPath] : deps.paths,
42479
- truncated: deps.truncated || (sc?.startsWith("trunc:") ?? false)
42652
+ truncated: deps.truncated || deps.readError || (sc?.startsWith("trunc:") ?? false)
42480
42653
  };
42481
42654
  }
42482
42655
  function generalizeMemoGet(key) {
@@ -42745,10 +42918,33 @@ function generalizeFromAstUncached(fnName, source, opts = {}) {
42745
42918
  patternFields.set(hit.index, bag);
42746
42919
  }
42747
42920
  const fieldAbs = constraintToEntryAbs(e.constraint, e.param);
42748
- bag[hit.field] = {
42921
+ const leaf = {
42749
42922
  abs: fieldAbs,
42750
42923
  ...e.constraint.isOptional ? { optional: true } : {}
42751
42924
  };
42925
+ const segs = hit.fieldPath ?? [hit.field];
42926
+ if (segs.length <= 1) {
42927
+ bag[hit.field] = leaf;
42928
+ continue;
42929
+ }
42930
+ let level = bag;
42931
+ let skip2 = false;
42932
+ for (let i = 0; i < segs.length - 1; i++) {
42933
+ const node = level[segs[i]];
42934
+ if (node === void 0) {
42935
+ const sub2 = { slots: {} };
42936
+ level[segs[i]] = sub2;
42937
+ level = sub2.slots;
42938
+ } else if ("slots" in node) {
42939
+ level = node.slots;
42940
+ } else {
42941
+ skip2 = true;
42942
+ break;
42943
+ }
42944
+ }
42945
+ if (!skip2) {
42946
+ level[segs[segs.length - 1]] = leaf;
42947
+ }
42752
42948
  } else if (hit) {
42753
42949
  const entryAbs = constraintToEntryAbs(e.constraint, e.param);
42754
42950
  typeParams[hit.index] = {
@@ -42761,20 +42957,34 @@ function generalizeFromAstUncached(fnName, source, opts = {}) {
42761
42957
  });
42762
42958
  }
42763
42959
  }
42764
- for (const [pIdx, bag] of patternFields) {
42960
+ const sigNames = formalParamSignatureNames(formals);
42961
+ const buildPatternObjAbs = (slotsBag, sigName, walked) => {
42765
42962
  const slots = {};
42766
- for (const [key, rec] of Object.entries(bag)) {
42767
- slots[key] = {
42768
- value: rec.abs,
42769
- ...rec.optional ? { optional: true } : {}
42770
- };
42963
+ for (const [key, node] of Object.entries(slotsBag)) {
42964
+ if ("abs" in node) {
42965
+ slots[key] = {
42966
+ value: node.abs,
42967
+ ...node.optional ? { optional: true } : {}
42968
+ };
42969
+ } else {
42970
+ slots[key] = {
42971
+ value: buildPatternObjAbs(node.slots, sigName, [...walked, key])
42972
+ };
42973
+ }
42771
42974
  }
42772
- const objAbs2 = abs(
42975
+ return abs(
42773
42976
  { k: "obj", slots },
42774
- v(params[pIdx] ?? `_p${pIdx}`),
42977
+ v(walked.length === 0 ? sigName : `${sigName}.${walked.join(".")}`),
42775
42978
  void 0,
42776
42979
  "path"
42777
42980
  );
42981
+ };
42982
+ for (const [pIdx, bag] of patternFields) {
42983
+ const objAbs2 = buildPatternObjAbs(
42984
+ bag,
42985
+ sigNames[pIdx] ?? params[pIdx] ?? `_p${pIdx}`,
42986
+ []
42987
+ );
42778
42988
  typeParams[pIdx] = {
42779
42989
  id: typeParams[pIdx].id,
42780
42990
  value: objAbs2
@@ -42918,6 +43128,7 @@ function generalizeFromAstUncached(fnName, source, opts = {}) {
42918
43128
  }));
42919
43129
  }
42920
43130
  }
43131
+ const renderNames = formals.length > 0 ? formalParamSignatureNames(formals) : params;
42921
43132
  return {
42922
43133
  name: fnName,
42923
43134
  params,
@@ -42926,6 +43137,7 @@ function generalizeFromAstUncached(fnName, source, opts = {}) {
42926
43137
  instantiate: (args, phi2) => run(args, phi2 ?? pTrue),
42927
43138
  display: formatPoly(
42928
43139
  fnName,
43140
+ renderNames,
42929
43141
  params,
42930
43142
  typeParams,
42931
43143
  symbolic,
@@ -42940,12 +43152,13 @@ function generalizeFromAstUncached(fnName, source, opts = {}) {
42940
43152
  ...hofSites ? { hofSites } : {}
42941
43153
  };
42942
43154
  }
42943
- function formatPoly(name, params, typeParams, symbolic, entryReqs, entryShapes, fnRels) {
43155
+ function formatPoly(name, renderNames, params, typeParams, symbolic, entryReqs, entryShapes, fnRels) {
42944
43156
  const reqByParam = new Map((entryReqs ?? []).map((r) => [r.param, r.pred]));
42945
- const ps = params.map((p, i) => {
43157
+ const ps = renderNames.map((p, i) => {
43158
+ const key = params[i] ?? p;
42946
43159
  const id = typeParams[i]?.id ?? "unknown";
42947
- const pred = reqByParam.get(p);
42948
- const promoted = entryShapes?.get(p)?.abs ?? fnRels?.get(p)?.abs;
43160
+ const pred = reqByParam.get(key);
43161
+ const promoted = entryShapes?.get(key)?.abs ?? fnRels?.get(key)?.abs;
42949
43162
  if (promoted) {
42950
43163
  const slot = formatShapeSlot(promoted);
42951
43164
  if (pred && pred.op !== "true") {
@@ -44189,13 +44402,17 @@ function scanLiteralCalls(source, knownFns, phi2, opts) {
44189
44402
  eiCache.set(key, r);
44190
44403
  return r;
44191
44404
  };
44192
- const projectArgField = (arg, field) => {
44193
- if (!arg) return void 0;
44194
- if (arg.shape.k === "brand") {
44195
- return projectArgField(arg.shape.shape, field);
44405
+ const projectArgPath = (arg, segments) => {
44406
+ let cur = arg;
44407
+ for (const seg of segments) {
44408
+ if (!cur) return void 0;
44409
+ if (cur.shape.k === "brand") {
44410
+ cur = cur.shape.shape;
44411
+ }
44412
+ if (cur.shape.k !== "obj") return void 0;
44413
+ cur = getSlot(cur.shape.slots, seg)?.value;
44196
44414
  }
44197
- if (arg.shape.k !== "obj") return void 0;
44198
- return getSlot(arg.shape.slots, field)?.value;
44415
+ return cur;
44199
44416
  };
44200
44417
  const interfaceToIndexed = (ei, paramNames, formals) => {
44201
44418
  const conflict = new Set(ei.conflict?.params ?? []);
@@ -44217,7 +44434,7 @@ function scanLiteralCalls(source, knownFns, phi2, opts) {
44217
44434
  entries.push([
44218
44435
  hit.index,
44219
44436
  { param, pred: instantiateConstraint(constraint, param), constraint },
44220
- hit.field
44437
+ hit.fieldPath ?? (hit.field !== void 0 ? [hit.field] : void 0)
44221
44438
  ]);
44222
44439
  }
44223
44440
  }
@@ -44253,17 +44470,18 @@ function scanLiteralCalls(source, knownFns, phi2, opts) {
44253
44470
  return lv <= n;
44254
44471
  };
44255
44472
  const checkReqs = (displayName, reqs, paramNames, absArgs, argIndexOf, loc) => {
44256
- for (const [idx, pred, field, contractParam] of reqs) {
44473
+ for (const [idx, pred, fieldPath, contractParam] of reqs) {
44257
44474
  const argIdx = argIndexOf(idx);
44258
44475
  if (argIdx === void 0) continue;
44259
44476
  let arg = absArgs[argIdx];
44260
44477
  if (!arg) continue;
44261
44478
  const paramName2 = contractParam || paramNames[idx] || `arg${idx}`;
44262
- if (field) {
44263
- const projected = projectArgField(arg, field);
44479
+ if (fieldPath) {
44480
+ const projected = projectArgPath(arg, fieldPath);
44264
44481
  if (!projected) {
44265
44482
  const k = arg.shape.k;
44266
44483
  if (k !== "unknown" && k !== "any") {
44484
+ const field = fieldPath.join(".");
44267
44485
  out.push({
44268
44486
  severity: "error",
44269
44487
  code: "nudo:constraint-violated",
@@ -44604,7 +44822,7 @@ function scanLiteralCalls(source, knownFns, phi2, opts) {
44604
44822
  }
44605
44823
  };
44606
44824
  const checkShapeReqs = (displayName, reqs, paramNames, absArgs, argIndexOf, loc) => {
44607
- for (const [idx, entry, field] of reqs) {
44825
+ for (const [idx, entry, fieldPath] of reqs) {
44608
44826
  const c = entry.constraint;
44609
44827
  if (!c.fields && !c.element && !isIntFlag(c) && !c.prim) continue;
44610
44828
  const argIdx = argIndexOf(idx);
@@ -44612,11 +44830,12 @@ function scanLiteralCalls(source, knownFns, phi2, opts) {
44612
44830
  let arg = absArgs[argIdx];
44613
44831
  if (!arg) continue;
44614
44832
  const paramName2 = entry.param || paramNames[idx] || `arg${idx}`;
44615
- if (field) {
44616
- const projected = projectArgField(arg, field);
44833
+ if (fieldPath) {
44834
+ const projected = projectArgPath(arg, fieldPath);
44617
44835
  if (!projected) {
44618
44836
  const k = arg.shape.k;
44619
44837
  if (k !== "unknown" && k !== "any") {
44838
+ const field = fieldPath.join(".");
44620
44839
  out.push({
44621
44840
  severity: "error",
44622
44841
  code: "nudo:constraint-violated",
@@ -45677,7 +45896,7 @@ function loadModuleId2(fn2) {
45677
45896
  }
45678
45897
  function checkDepsFingerprint(source, opts) {
45679
45898
  if (!opts.loadModule || !opts.fromFile) {
45680
- return { fp: "-", paths: [], contents: [], truncated: false };
45899
+ return { fp: "-", paths: [], contents: [], truncated: false, readError: false };
45681
45900
  }
45682
45901
  return loadModuleDepsFingerprint(source, opts.loadModule, opts.fromFile);
45683
45902
  }
@@ -46007,13 +46226,17 @@ var init_check_assign = __esm({
46007
46226
  });
46008
46227
 
46009
46228
  // ../core/src/algebra/check-case-scan.ts
46010
- function projectCaseArgField(arg, field) {
46011
- if (!arg) return void 0;
46012
- if (arg.shape.k === "brand") {
46013
- return projectCaseArgField(arg.shape.shape, field);
46229
+ function projectCaseArgField(arg, fieldPath) {
46230
+ let cur = arg;
46231
+ for (const seg of fieldPath) {
46232
+ if (!cur) return void 0;
46233
+ if (cur.shape.k === "brand") {
46234
+ cur = cur.shape.shape;
46235
+ }
46236
+ if (cur.shape.k !== "obj") return void 0;
46237
+ cur = getSlot(cur.shape.slots, seg)?.value;
46014
46238
  }
46015
- if (arg.shape.k !== "obj") return void 0;
46016
- return getSlot(arg.shape.slots, field)?.value;
46239
+ return cur;
46017
46240
  }
46018
46241
  function scanCaseInconsistency(source, knownFns, opts) {
46019
46242
  const out = [];
@@ -46094,12 +46317,12 @@ function scanCaseInconsistency(source, knownFns, opts) {
46094
46317
  for (const p of eff.params) {
46095
46318
  if (conflictParams.has(p.param)) continue;
46096
46319
  let idx = paramNames.indexOf(p.param);
46097
- let field;
46320
+ let fieldPath;
46098
46321
  if (idx < 0 && formals.length > 0) {
46099
46322
  const hit = locateContractParam(formals, p.param);
46100
46323
  if (hit) {
46101
46324
  idx = hit.index;
46102
- field = hit.field;
46325
+ fieldPath = hit.fieldPath ?? (hit.field !== void 0 ? [hit.field] : void 0);
46103
46326
  }
46104
46327
  }
46105
46328
  if (idx < 0) continue;
@@ -46110,7 +46333,7 @@ function scanCaseInconsistency(source, knownFns, opts) {
46110
46333
  pred: instantiateConstraint(p.constraint, p.param),
46111
46334
  constraint: p.constraint
46112
46335
  },
46113
- field
46336
+ fieldPath
46114
46337
  ]);
46115
46338
  }
46116
46339
  if (reqs.length === 0) return;
@@ -46118,16 +46341,17 @@ function scanCaseInconsistency(source, knownFns, opts) {
46118
46341
  for (const req of reqs) {
46119
46342
  const idx = req[0];
46120
46343
  const entry = req[1];
46121
- const field = req[2];
46344
+ const fieldPath = req[2];
46122
46345
  if (entry.constraint.fields) continue;
46123
46346
  let arg = absArgs[idx];
46124
46347
  if (!arg) continue;
46125
- if (field) {
46126
- const projected = projectCaseArgField(arg, field);
46348
+ if (fieldPath) {
46349
+ const projected = projectCaseArgField(arg, fieldPath);
46127
46350
  if (!projected) {
46128
46351
  const k = arg.shape.k;
46129
46352
  if (k !== "unknown" && k !== "any") {
46130
46353
  const paramName2 = entry.param || paramNames[idx] || `arg${idx}`;
46354
+ const field = fieldPath.join(".");
46131
46355
  out.push({
46132
46356
  severity: "error",
46133
46357
  code: "nudo:case-inconsistency",
@@ -46268,7 +46492,9 @@ function checkSourceInScope(filePath, source, phi2, opts) {
46268
46492
  const stable = stableAnalyzeKeySource(source);
46269
46493
  const depsFp = checkDepsFingerprint(stable, callOpts);
46270
46494
  const sidecarFp = callOpts.loadModule && callOpts.fromFile ? sidecarClosureFingerprint(callOpts.fromFile, callOpts) : void 0;
46271
- const allowMemo = useMemo && !depsFp.truncated && !(sidecarFp?.startsWith("trunc:") ?? false);
46495
+ const allowMemo = useMemo && !depsFp.truncated && // 读错误轮键不可信(#135):错误轮报告(nudo:interface-load)与真 miss 轮
46496
+ // (干净)若共享 miss 键会互为跨次陈旧命中——不读也不写 memo
46497
+ !depsFp.readError && !(sidecarFp?.startsWith("trunc:") ?? false);
46272
46498
  if (allowMemo) {
46273
46499
  memoKey = checkMemoKey(filePath, stable, opts, depsFp, sidecarFp);
46274
46500
  const hit = checkMemoGet(memoKey);
@@ -47436,6 +47662,7 @@ __export(src_exports, {
47436
47662
  CONSTRAINT_BUILDER_NAMES: () => CONSTRAINT_BUILDER_NAMES,
47437
47663
  CONSTRAINT_EXPR_RE: () => CONSTRAINT_EXPR_RE,
47438
47664
  DEFAULT_MAX_LOOP_ITERS: () => DEFAULT_MAX_LOOP_ITERS,
47665
+ INTERFACE_SOURCE_ABBR: () => INTERFACE_SOURCE_ABBR,
47439
47666
  MAX_EVAL_CALL_DEPTH: () => MAX_EVAL_CALL_DEPTH,
47440
47667
  MAX_EVAL_TOTAL_CALLS: () => MAX_EVAL_TOTAL_CALLS,
47441
47668
  NudoLoopSignal: () => NudoLoopSignal,
@@ -48058,12 +48285,16 @@ function collectAbsInlays(source, opts) {
48058
48285
  const inlays = [];
48059
48286
  const refineOpts = opts?.loadModule || opts?.fromFile ? {
48060
48287
  ...opts.loadModule ? { loadModule: opts.loadModule } : {},
48061
- ...opts.fromFile ? { fromFile: opts.fromFile } : {}
48288
+ ...opts.fromFile ? { fromFile: opts.fromFile } : {},
48289
+ ...opts.autoBind !== void 0 ? { autoBind: opts.autoBind } : {}
48062
48290
  } : void 0;
48063
48291
  for (const { name, node } of listFunctions(source)) {
48064
48292
  let g;
48065
48293
  try {
48066
- g = generalizeFromAst(name, source, refineOpts ? { refine: refineOpts } : {});
48294
+ g = generalizeFromAst(name, source, {
48295
+ ...refineOpts ? { refine: refineOpts } : {},
48296
+ ...opts?.modules ? { modules: opts.modules } : {}
48297
+ });
48067
48298
  } catch {
48068
48299
  continue;
48069
48300
  }
@@ -49801,7 +50032,7 @@ var init_resolve_npm = __esm({
49801
50032
  });
49802
50033
 
49803
50034
  // ../service/src/load-module.ts
49804
- import { existsSync as existsSync3, statSync as statSync2, readFileSync as readFileSync3 } from "fs";
50035
+ import { statSync as statSync2, readFileSync as readFileSync3 } from "fs";
49805
50036
  import { dirname as dirname3, resolve as resolve2, join as join3 } from "path";
49806
50037
  function moduleResolveCandidates(spec, fromFile) {
49807
50038
  const p = resolve2(dirname3(resolve2(fromFile)), spec);
@@ -49813,18 +50044,21 @@ function moduleResolveCandidates(spec, fromFile) {
49813
50044
  }
49814
50045
  function resolveModuleFile(spec, fromFile) {
49815
50046
  for (const cand of moduleResolveCandidates(spec, fromFile)) {
49816
- if (existsSync3(cand) && !statSync2(cand).isDirectory()) return cand;
50047
+ let st;
50048
+ try {
50049
+ st = statSync2(cand);
50050
+ } catch (e) {
50051
+ const code2 = e?.code;
50052
+ if (code2 === "ENOENT" || code2 === "ENOTDIR" || code2 === "EISDIR") continue;
50053
+ throw new ModuleReadError(cand, e);
50054
+ }
50055
+ if (!st.isDirectory()) return cand;
49817
50056
  }
49818
50057
  return void 0;
49819
50058
  }
49820
50059
  function defaultLoadModule(spec, fromFile) {
49821
50060
  if (!spec.startsWith(".") && !spec.startsWith("/")) return void 0;
49822
- let cand;
49823
- try {
49824
- cand = resolveModuleFile(spec, fromFile);
49825
- } catch {
49826
- return void 0;
49827
- }
50061
+ const cand = resolveModuleFile(spec, fromFile);
49828
50062
  if (!cand) return void 0;
49829
50063
  try {
49830
50064
  return readFileSync3(cand, "utf-8");
@@ -49860,7 +50094,7 @@ var init_load_module = __esm({
49860
50094
  });
49861
50095
 
49862
50096
  // ../service/src/static-imports.ts
49863
- import { readFileSync as readFileSync4, existsSync as existsSync4 } from "fs";
50097
+ import { readFileSync as readFileSync4, existsSync as existsSync3 } from "fs";
49864
50098
  import { resolve as resolve3, dirname as dirname4, join as join4 } from "path";
49865
50099
  function resolveRelative(fromFile, spec) {
49866
50100
  if (!spec.startsWith(".") && !spec.startsWith("/")) return void 0;
@@ -49878,7 +50112,7 @@ function resolveRelative(fromFile, spec) {
49878
50112
  join4(base, "index.mjs"),
49879
50113
  join4(base, "index.ts")
49880
50114
  ]) {
49881
- if (existsSync4(cand)) return cand;
50115
+ if (existsSync3(cand)) return cand;
49882
50116
  }
49883
50117
  return void 0;
49884
50118
  }
@@ -50010,7 +50244,7 @@ function collectStaticImports(entryFile, maxDepth = 8) {
50010
50244
  const { file, depth } = queue.shift();
50011
50245
  if (seen.has(file) || depth > maxDepth) continue;
50012
50246
  seen.add(file);
50013
- if (!existsSync4(file)) continue;
50247
+ if (!existsSync3(file)) continue;
50014
50248
  const source = readFileSync4(file, "utf8");
50015
50249
  const mod2 = analyzeExportsFromSource(file, source);
50016
50250
  graph.set(file, mod2);
@@ -50031,7 +50265,7 @@ var init_static_imports = __esm({
50031
50265
  });
50032
50266
 
50033
50267
  // ../service/src/analyzer-module-load.ts
50034
- import { readFileSync as readFileSync5, existsSync as existsSync5, statSync as statSync3 } from "fs";
50268
+ import { readFileSync as readFileSync5, existsSync as existsSync4, statSync as statSync3 } from "fs";
50035
50269
  import { resolve as resolve4 } from "path";
50036
50270
  function resolveModule(source, fromDir) {
50037
50271
  const extensions = [...MODULE_RESOLVE_EXTS];
@@ -50043,17 +50277,17 @@ function resolveModule(source, fromDir) {
50043
50277
  const basePath = resolve4(fromDir, source);
50044
50278
  for (const ext of ["", ...extensions]) {
50045
50279
  const candidate = basePath + ext;
50046
- if (!existsSync5(candidate)) continue;
50280
+ if (!existsSync4(candidate)) continue;
50047
50281
  if (statSync3(candidate).isDirectory()) {
50048
50282
  let entry = null;
50049
50283
  const pkgPath = resolve4(candidate, "package.json");
50050
- if (existsSync5(pkgPath)) {
50284
+ if (existsSync4(pkgPath)) {
50051
50285
  try {
50052
50286
  const main = JSON.parse(readFileSync5(pkgPath, "utf-8")).main;
50053
50287
  if (typeof main === "string") {
50054
50288
  for (const e of ["", ...extensions]) {
50055
50289
  const p = resolve4(candidate, main + e);
50056
- if (existsSync5(p) && statSync3(p).isFile()) {
50290
+ if (existsSync4(p) && statSync3(p).isFile()) {
50057
50291
  entry = p;
50058
50292
  break;
50059
50293
  }
@@ -50065,7 +50299,7 @@ function resolveModule(source, fromDir) {
50065
50299
  if (!entry) {
50066
50300
  for (const e of ["", ...extensions]) {
50067
50301
  const p = resolve4(candidate, "index" + e);
50068
- if (existsSync5(p) && statSync3(p).isFile()) {
50302
+ if (existsSync4(p) && statSync3(p).isFile()) {
50069
50303
  entry = p;
50070
50304
  break;
50071
50305
  }
@@ -57345,9 +57579,9 @@ function analysisFileCacheKey(filePath, source, activeCases, externalCallRecords
57345
57579
  let noCache = false;
57346
57580
  try {
57347
57581
  const fp = loadModuleDepsFingerprint(source, effectiveLoader, filePath);
57348
- if (fp.truncated) {
57582
+ if (fp.truncated || fp.readError) {
57349
57583
  noCache = true;
57350
- depSeg = `trunc:${fp.paths.length}`;
57584
+ depSeg = `${fp.truncated ? "trunc" : "readerr"}:${fp.paths.length}`;
57351
57585
  } else {
57352
57586
  depSeg = hashSource(fp.fp);
57353
57587
  }
@@ -59707,7 +59941,7 @@ var init_lru_map2 = __esm({
59707
59941
  });
59708
59942
 
59709
59943
  // ../service/src/evaluator/env-loader.ts
59710
- import { readFileSync as readFileSync6, existsSync as existsSync6, statSync as statSync4, mkdirSync, writeFileSync } from "fs";
59944
+ import { readFileSync as readFileSync6, existsSync as existsSync5, statSync as statSync4, mkdirSync, writeFileSync } from "fs";
59711
59945
  import { resolve as resolvePath, join as joinPath } from "path";
59712
59946
  import { pathToFileURL } from "url";
59713
59947
  import { createRequire as createRequire2 } from "module";
@@ -59744,7 +59978,7 @@ function isPathEnvName(name, baseDir) {
59744
59978
  if (name in envFactories) return false;
59745
59979
  if (name.includes("/") || name.startsWith("./") || name.startsWith("../")) return true;
59746
59980
  const resolved = resolvePath(baseDir, name);
59747
- return resolved.endsWith(".ts") && existsSync6(resolved);
59981
+ return resolved.endsWith(".ts") && existsSync5(resolved);
59748
59982
  }
59749
59983
  function rewriteBareImports(text) {
59750
59984
  const require3 = createRequire2(import.meta.url);
@@ -59875,7 +60109,7 @@ async function preloadPathEnvs(envNames, baseDir) {
59875
60109
  for (const name of envNames) {
59876
60110
  if (!isPathEnvName(name, baseDir)) continue;
59877
60111
  const resolved = resolvePath(baseDir, name);
59878
- if (!existsSync6(resolved)) {
60112
+ if (!existsSync5(resolved)) {
59879
60113
  recordPathEnvError(resolved, baseDir, new Error(`path env not found: ${resolved}`));
59880
60114
  continue;
59881
60115
  }
@@ -60125,13 +60359,22 @@ function pkgStatFp(pkgPath) {
60125
60359
  try {
60126
60360
  const st = statSync5(pkgPath);
60127
60361
  return `${st.mtimeMs}:${st.size}`;
60128
- } catch {
60129
- return void 0;
60362
+ } catch (err) {
60363
+ if (err instanceof Error && err.code === "ENOENT") {
60364
+ return void 0;
60365
+ }
60366
+ throw err;
60130
60367
  }
60131
60368
  }
60132
60369
  function projectConfigMemoHit(entry) {
60133
60370
  for (const { pkgPath, fp } of entry.chain) {
60134
- if (pkgStatFp(pkgPath) !== fp) return false;
60371
+ let current;
60372
+ try {
60373
+ current = pkgStatFp(pkgPath);
60374
+ } catch {
60375
+ return false;
60376
+ }
60377
+ if (current !== fp) return false;
60135
60378
  }
60136
60379
  return true;
60137
60380
  }
@@ -60159,7 +60402,18 @@ function findProjectConfig(startDir) {
60159
60402
  if (hit && projectConfigMemoHit(hit)) return hit.result;
60160
60403
  while (dir !== root) {
60161
60404
  const pkgPath = resolve6(dir, "package.json");
60162
- const statFp = pkgStatFp(pkgPath);
60405
+ let statFp;
60406
+ try {
60407
+ statFp = pkgStatFp(pkgPath);
60408
+ } catch (err) {
60409
+ memoEntry.chain.push({ pkgPath, fp: STAT_ERROR_FP });
60410
+ process.stderr?.write?.(
60411
+ `nudo: package.json stat failed at ${pkgPath} (${err instanceof Error ? err.message : String(err)}); project config disabled for this subtree (defaults + env apply)
60412
+ `
60413
+ );
60414
+ applyBForkBudgetFromConfig(null);
60415
+ return memoize(null);
60416
+ }
60163
60417
  memoEntry.chain.push({ pkgPath, fp: statFp });
60164
60418
  if (statFp !== void 0) {
60165
60419
  let pkg;
@@ -60188,7 +60442,7 @@ function findProjectConfig(startDir) {
60188
60442
  applyBForkBudgetFromConfig(null);
60189
60443
  return memoize(null);
60190
60444
  }
60191
- var DEFAULT_ANALYSIS_EXCLUDE, DEFAULT_ANALYSIS_MODE, projectConfigMemo, MAX_PROJECT_CONFIG_MEMO, projectConfigDiskReads;
60445
+ var DEFAULT_ANALYSIS_EXCLUDE, DEFAULT_ANALYSIS_MODE, projectConfigMemo, MAX_PROJECT_CONFIG_MEMO, projectConfigDiskReads, STAT_ERROR_FP;
60192
60446
  var init_config = __esm({
60193
60447
  "../service/src/evaluator/config.ts"() {
60194
60448
  "use strict";
@@ -60203,6 +60457,7 @@ var init_config = __esm({
60203
60457
  projectConfigMemo = /* @__PURE__ */ new Map();
60204
60458
  MAX_PROJECT_CONFIG_MEMO = 128;
60205
60459
  projectConfigDiskReads = 0;
60460
+ STAT_ERROR_FP = "\0stat-error";
60206
60461
  }
60207
60462
  });
60208
60463
 
@@ -274993,7 +275248,7 @@ var init_harvest_dts = __esm({
274993
275248
  });
274994
275249
 
274995
275250
  // ../harvester/src/dts-contract-draft.ts
274996
- import { readFileSync as readFileSync9, existsSync as existsSync7, statSync as statSync7, readdirSync } from "fs";
275251
+ import { readFileSync as readFileSync9, existsSync as existsSync6, statSync as statSync7, readdirSync } from "fs";
274997
275252
  import { basename, dirname as dirname6, join as join5 } from "path";
274998
275253
  function keywordDsl(node) {
274999
275254
  switch (node.kind) {
@@ -275278,7 +275533,7 @@ function readDtsFiles(paths, maxFiles = 16) {
275278
275533
  }
275279
275534
  };
275280
275535
  for (const p of paths) {
275281
- if (!existsSync7(p)) continue;
275536
+ if (!existsSync6(p)) continue;
275282
275537
  const st = statSync7(p);
275283
275538
  if (st.isDirectory()) walk(p, 0);
275284
275539
  else if (/\.d\.ts$/.test(p) || /\.(m)?ts$/.test(p)) {
@@ -275288,7 +275543,7 @@ function readDtsFiles(paths, maxFiles = 16) {
275288
275543
  return out.slice(0, maxFiles);
275289
275544
  }
275290
275545
  function dtsToContractDraft(dtsFiles, label) {
275291
- const files = dtsFiles.filter((f) => existsSync7(f));
275546
+ const files = dtsFiles.filter((f) => existsSync6(f));
275292
275547
  const exports = [];
275293
275548
  let skippedFiles = 0;
275294
275549
  for (const file of files) {
@@ -275344,16 +275599,16 @@ var init_dts_contract_draft = __esm({
275344
275599
  });
275345
275600
 
275346
275601
  // ../harvester/src/harvest-package.ts
275347
- import { existsSync as existsSync8, readdirSync as readdirSync2, statSync as statSync8, readFileSync as readFileSync10 } from "fs";
275602
+ import { existsSync as existsSync7, readdirSync as readdirSync2, statSync as statSync8, readFileSync as readFileSync10 } from "fs";
275348
275603
  import { join as join6, resolve as resolve7, dirname as dirname7, basename as basename2 } from "path";
275349
275604
  function resolvePackageRoot(pkg, fromDir = process.cwd()) {
275350
275605
  let dir = resolve7(fromDir);
275351
275606
  const bare = pkg.replace(/^@/, "").replace(/\//g, "__");
275352
275607
  for (let i = 0; i < 8; i++) {
275353
275608
  const typesPath = join6(dir, "node_modules", "@types", bare);
275354
- if (existsSync8(typesPath)) return typesPath;
275609
+ if (existsSync7(typesPath)) return typesPath;
275355
275610
  const pkgPath = join6(dir, "node_modules", pkg);
275356
- if (existsSync8(pkgPath)) return pkgPath;
275611
+ if (existsSync7(pkgPath)) return pkgPath;
275357
275612
  const parent = resolve7(dir, "..");
275358
275613
  if (parent === dir) break;
275359
275614
  dir = parent;
@@ -275402,13 +275657,13 @@ function collectDtsFiles(root, maxFiles = 8) {
275402
275657
  }
275403
275658
  function entryDtsFromPackageJson(root) {
275404
275659
  const pj = join6(root, "package.json");
275405
- if (!existsSync8(pj)) return void 0;
275660
+ if (!existsSync7(pj)) return void 0;
275406
275661
  try {
275407
275662
  const raw = JSON.parse(readFileSync10(pj, "utf8"));
275408
275663
  const entry = raw.types ?? raw.typings;
275409
275664
  if (typeof entry === "string" && entry.endsWith(".d.ts")) {
275410
275665
  const p = resolve7(root, entry);
275411
- if (existsSync8(p)) {
275666
+ if (existsSync7(p)) {
275412
275667
  const st = statSync8(p);
275413
275668
  if (st.size <= MAX_DTS_BYTES) return p;
275414
275669
  }
@@ -275425,7 +275680,7 @@ function collectDtsFromEntry(entry, maxFiles = 200) {
275425
275680
  const RELATIVE_FROM_REGEX = /\bfrom\s+["'](\.[^"']+)["']/g;
275426
275681
  while (queue.length > 0 && files.length < maxFiles) {
275427
275682
  const current = queue.shift();
275428
- if (seen.has(current) || !existsSync8(current)) continue;
275683
+ if (seen.has(current) || !existsSync7(current)) continue;
275429
275684
  seen.add(current);
275430
275685
  if (!current.endsWith(".d.ts")) continue;
275431
275686
  files.push(current);
@@ -275442,7 +275697,7 @@ function collectDtsFromEntry(entry, maxFiles = 200) {
275442
275697
  for (const match of text.matchAll(RELATIVE_FROM_REGEX)) {
275443
275698
  const base = resolve7(dir, match[1]);
275444
275699
  for (const candidate of [`${base}.d.ts`, join6(base, "index.d.ts")]) {
275445
- if (existsSync8(candidate)) {
275700
+ if (existsSync7(candidate)) {
275446
275701
  queue.push(candidate);
275447
275702
  break;
275448
275703
  }
@@ -275455,10 +275710,10 @@ function harvestPackage(pkg, fromDir, maxFiles = 24) {
275455
275710
  const root = resolvePackageRoot(pkg, fromDir);
275456
275711
  if (!root) return { error: `package not found: ${pkg}` };
275457
275712
  const entry = entryDtsFromPackageJson(root) ?? join6(root, "index.d.ts");
275458
- let dtsFiles = existsSync8(entry) ? collectDtsFromEntry(entry, maxFiles) : [];
275713
+ let dtsFiles = existsSync7(entry) ? collectDtsFromEntry(entry, maxFiles) : [];
275459
275714
  if (dtsFiles.length === 0) {
275460
275715
  const collected = collectDtsFiles(root, maxFiles);
275461
- dtsFiles = entry && existsSync8(entry) && !collected.includes(entry) ? [entry, ...collected.filter((f) => f !== entry)].slice(0, maxFiles) : collected;
275716
+ dtsFiles = entry && existsSync7(entry) && !collected.includes(entry) ? [entry, ...collected.filter((f) => f !== entry)].slice(0, maxFiles) : collected;
275462
275717
  }
275463
275718
  if (dtsFiles.length === 0) {
275464
275719
  return { error: `no .d.ts under ${root}` };
@@ -275770,7 +276025,7 @@ var init_harvest_json = __esm({
275770
276025
 
275771
276026
  // ../harvester/src/harvest-disk.ts
275772
276027
  import { createHash as createHash3 } from "crypto";
275773
- import { existsSync as existsSync9, mkdirSync as mkdirSync2, readFileSync as readFileSync11, writeFileSync as writeFileSync2 } from "fs";
276028
+ import { existsSync as existsSync8, mkdirSync as mkdirSync2, readFileSync as readFileSync11, writeFileSync as writeFileSync2 } from "fs";
275774
276029
  import { homedir } from "os";
275775
276030
  import { join as join7, dirname as dirname8 } from "path";
275776
276031
  function depsCacheRoot() {
@@ -275809,7 +276064,7 @@ function diskPath(root, key) {
275809
276064
  function readHarvestDisk(root, key) {
275810
276065
  try {
275811
276066
  const p = diskPath(root, key);
275812
- if (!existsSync9(p)) return void 0;
276067
+ if (!existsSync8(p)) return void 0;
275813
276068
  const parsed = JSON.parse(readFileSync11(p, "utf8"));
275814
276069
  if (parsed?.abi !== HARVEST_DISK_ABI) return void 0;
275815
276070
  return parsed.value;
@@ -275837,10 +276092,10 @@ function listPackageDts(pkg, fromDir, maxFiles) {
275837
276092
  return void 0;
275838
276093
  }
275839
276094
  })();
275840
- let dtsFiles = entry && existsSync9(entry) ? collectDtsFromEntry(entry, Math.max(maxFiles, 24)) : [];
276095
+ let dtsFiles = entry && existsSync8(entry) ? collectDtsFromEntry(entry, Math.max(maxFiles, 24)) : [];
275841
276096
  if (dtsFiles.length === 0) {
275842
276097
  const collected = collectDtsFiles(root, maxFiles);
275843
- dtsFiles = entry && existsSync9(entry) && !collected.includes(entry) ? [entry, ...collected.filter((f) => f !== entry)].slice(0, maxFiles) : collected;
276098
+ dtsFiles = entry && existsSync8(entry) && !collected.includes(entry) ? [entry, ...collected.filter((f) => f !== entry)].slice(0, maxFiles) : collected;
275844
276099
  }
275845
276100
  if (dtsFiles.length === 0) return null;
275846
276101
  return { root, dtsFiles, pkgVersion: readPkgVersion(root) };
@@ -276181,7 +276436,7 @@ var init_harvest_to_abs = __esm({
276181
276436
  });
276182
276437
 
276183
276438
  // ../harvester/src/harvest-node.ts
276184
- import { existsSync as existsSync10, statSync as statSync9, readFileSync as readFileSync12 } from "fs";
276439
+ import { existsSync as existsSync9, statSync as statSync9, readFileSync as readFileSync12 } from "fs";
276185
276440
  import { join as join8 } from "path";
276186
276441
  function notFoundCacheKey(fromDir) {
276187
276442
  return `not-found|@types/node|${fromDir ?? ""}`;
@@ -276265,7 +276520,7 @@ function harvestNodeTypes(fromDir, maxFiles = HARVEST_NODE_DEFAULT_MAX_FILES, ma
276265
276520
  };
276266
276521
  }
276267
276522
  const root = resolvePackageRoot("@types/node", fromDir) ?? resolvePackageRoot("node", fromDir);
276268
- if (!root || !existsSync10(root)) {
276523
+ if (!root || !existsSync9(root)) {
276269
276524
  const missKey = notFoundCacheKey(fromDir);
276270
276525
  const miss = nodeHarvestCache.get(missKey);
276271
276526
  if (miss) {
@@ -277467,7 +277722,7 @@ function evalCacheSlotKey(filePath, mode) {
277467
277722
  function evalDepKey(source, filePath, loadModule) {
277468
277723
  try {
277469
277724
  const fp = loadModuleDepsFingerprint(source, loadModule ?? defaultLoadModule, filePath);
277470
- if (fp.truncated) return null;
277725
+ if (fp.truncated || fp.readError) return null;
277471
277726
  return hashSource(fp.fp);
277472
277727
  } catch {
277473
277728
  return null;
@@ -278241,7 +278496,7 @@ var init_analyzer_orchestrate_calls = __esm({
278241
278496
  });
278242
278497
 
278243
278498
  // ../service/src/entry-variants.ts
278244
- import { existsSync as existsSync11, readFileSync as readFileSync14 } from "fs";
278499
+ import { existsSync as existsSync10, readFileSync as readFileSync14 } from "fs";
278245
278500
  import { dirname as dirname12, join as join9, resolve as resolve8 } from "path";
278246
278501
  function collectConditionFaces(val) {
278247
278502
  const browser = [];
@@ -278355,7 +278610,7 @@ function findOwningPackage(fromFile) {
278355
278610
  const root = resolve8("/");
278356
278611
  for (; ; ) {
278357
278612
  const pkgPath = join9(dir, "package.json");
278358
- if (existsSync11(pkgPath)) {
278613
+ if (existsSync10(pkgPath)) {
278359
278614
  try {
278360
278615
  const pkg = JSON.parse(readFileSync14(pkgPath, "utf-8"));
278361
278616
  return { path: pkgPath, dir, pkg };
@@ -278672,7 +278927,7 @@ function computeFnDepSegment(source, loadModule, filePath) {
278672
278927
  let fnDepFailClosed = false;
278673
278928
  try {
278674
278929
  const dfp = loadModuleDepsFingerprint(source, loadModule ?? defaultLoadModule, filePath);
278675
- if (dfp.truncated) {
278930
+ if (dfp.truncated || dfp.readError) {
278676
278931
  fnDepFailClosed = true;
278677
278932
  fnDepSeg = null;
278678
278933
  } else {
@@ -279740,7 +279995,7 @@ var init_target_path = __esm({
279740
279995
 
279741
279996
  // ../service/src/analysis-scope.ts
279742
279997
  import { dirname as dirname16 } from "path";
279743
- import { existsSync as existsSync12 } from "fs";
279998
+ import { existsSync as existsSync11 } from "fs";
279744
279999
  function filterDiagnosticsByLevel(diags, level) {
279745
280000
  if (level === "verbose") return diags;
279746
280001
  if (level === "off") return [];
@@ -279784,7 +280039,7 @@ function shouldAnalyzeFile(filePath, source, config) {
279784
280039
  if (cfg.mode === "directives") return false;
279785
280040
  if (text !== void 0 && hasExport(text)) return true;
279786
280041
  try {
279787
- if (existsSync12(sidecarPathOf(filePath))) return true;
280042
+ if (existsSync11(sidecarPathOf(filePath))) return true;
279788
280043
  } catch {
279789
280044
  }
279790
280045
  return false;
@@ -280090,7 +280345,7 @@ import {
280090
280345
  mkdirSync as mkdirSync3,
280091
280346
  readFileSync as readFileSync15,
280092
280347
  writeFileSync as writeFileSync3,
280093
- existsSync as existsSync13,
280348
+ existsSync as existsSync12,
280094
280349
  rmSync,
280095
280350
  renameSync,
280096
280351
  unlinkSync
@@ -280135,7 +280390,7 @@ function monorepoLogicalPath(posixPath) {
280135
280390
  let dir = dirname17(posixPath);
280136
280391
  let workspacesRoot;
280137
280392
  for (; ; ) {
280138
- if (existsSync13(join10(dir, "pnpm-workspace.yaml")) || existsSync13(join10(dir, "lerna.json"))) {
280393
+ if (existsSync12(join10(dir, "pnpm-workspace.yaml")) || existsSync12(join10(dir, "lerna.json"))) {
280139
280394
  return toPosix(relative3(dir, posixPath)) || void 0;
280140
280395
  }
280141
280396
  if (!workspacesRoot) {
@@ -280258,7 +280513,7 @@ var init_disk_cache = __esm({
280258
280513
  if (!this.enabled || !this.root) return void 0;
280259
280514
  try {
280260
280515
  const p = this.pathFor(key);
280261
- if (!existsSync13(p)) return void 0;
280516
+ if (!existsSync12(p)) return void 0;
280262
280517
  const raw = readFileSync15(p, "utf8");
280263
280518
  const parsed = JSON.parse(raw);
280264
280519
  if (parsed?.abi !== ANALYSIS_ABI) return void 0;
@@ -280280,7 +280535,7 @@ var init_disk_cache = __esm({
280280
280535
  } catch {
280281
280536
  if (tmp) {
280282
280537
  try {
280283
- if (existsSync13(tmp)) unlinkSync(tmp);
280538
+ if (existsSync12(tmp)) unlinkSync(tmp);
280284
280539
  } catch {
280285
280540
  }
280286
280541
  }
@@ -280499,7 +280754,7 @@ import {
280499
280754
  mkdirSync as mkdirSync4,
280500
280755
  readFileSync as readFileSync16,
280501
280756
  writeFileSync as writeFileSync4,
280502
- existsSync as existsSync14,
280757
+ existsSync as existsSync13,
280503
280758
  rmSync as rmSync2,
280504
280759
  renameSync as renameSync2,
280505
280760
  unlinkSync as unlinkSync2
@@ -280688,7 +280943,7 @@ function monorepoLogicalPath2(posixPath) {
280688
280943
  let dir = dirname18(posixPath);
280689
280944
  let workspacesRoot;
280690
280945
  for (; ; ) {
280691
- if (existsSync14(join11(dir, "pnpm-workspace.yaml")) || existsSync14(join11(dir, "lerna.json"))) {
280946
+ if (existsSync13(join11(dir, "pnpm-workspace.yaml")) || existsSync13(join11(dir, "lerna.json"))) {
280692
280947
  return toPosix2(relative4(dir, posixPath)) || void 0;
280693
280948
  }
280694
280949
  if (!workspacesRoot) {
@@ -280784,7 +281039,7 @@ var init_chunk_4TAFH6ZZ = __esm({
280784
281039
  if (!this.enabled || !this.root) return void 0;
280785
281040
  try {
280786
281041
  const p = this.pathFor(key);
280787
- if (!existsSync14(p)) return void 0;
281042
+ if (!existsSync13(p)) return void 0;
280788
281043
  const raw = readFileSync16(p, "utf8");
280789
281044
  const parsed = JSON.parse(raw);
280790
281045
  if (parsed?.abi !== ANALYSIS_ABI2) return void 0;
@@ -280806,7 +281061,7 @@ var init_chunk_4TAFH6ZZ = __esm({
280806
281061
  } catch {
280807
281062
  if (tmp) {
280808
281063
  try {
280809
- if (existsSync14(tmp)) unlinkSync2(tmp);
281064
+ if (existsSync13(tmp)) unlinkSync2(tmp);
280810
281065
  } catch {
280811
281066
  }
280812
281067
  }
@@ -280823,8 +281078,8 @@ var init_chunk_4TAFH6ZZ = __esm({
280823
281078
  }
280824
281079
  });
280825
281080
 
280826
- // ../service/dist/chunk-RKFQ6H4V.js
280827
- import { readFileSync as readFileSync17, existsSync as existsSync15, statSync as statSync11, mkdirSync as mkdirSync5, writeFileSync as writeFileSync5 } from "fs";
281081
+ // ../service/dist/chunk-EGGGBJDA.js
281082
+ import { readFileSync as readFileSync17, existsSync as existsSync14, statSync as statSync11, mkdirSync as mkdirSync5, writeFileSync as writeFileSync5 } from "fs";
280828
281083
  import { resolve as resolvePath2, join as joinPath2 } from "path";
280829
281084
  import { pathToFileURL as pathToFileURL2 } from "url";
280830
281085
  import { createRequire as createRequire5 } from "module";
@@ -280883,7 +281138,7 @@ function isPathEnvName2(name, baseDir) {
280883
281138
  if (name in envFactories2) return false;
280884
281139
  if (name.includes("/") || name.startsWith("./") || name.startsWith("../")) return true;
280885
281140
  const resolved = resolvePath2(baseDir, name);
280886
- return resolved.endsWith(".ts") && existsSync15(resolved);
281141
+ return resolved.endsWith(".ts") && existsSync14(resolved);
280887
281142
  }
280888
281143
  function rewriteBareImports2(text) {
280889
281144
  const require22 = createRequire5(import.meta.url);
@@ -280990,7 +281245,7 @@ async function preloadPathEnvs2(envNames, baseDir) {
280990
281245
  for (const name of envNames) {
280991
281246
  if (!isPathEnvName2(name, baseDir)) continue;
280992
281247
  const resolved = resolvePath2(baseDir, name);
280993
- if (!existsSync15(resolved)) {
281248
+ if (!existsSync14(resolved)) {
280994
281249
  recordPathEnvError2(resolved, baseDir, new Error(`path env not found: ${resolved}`));
280995
281250
  continue;
280996
281251
  }
@@ -281160,13 +281415,22 @@ function pkgStatFp2(pkgPath) {
281160
281415
  try {
281161
281416
  const st = statSync22(pkgPath);
281162
281417
  return `${st.mtimeMs}:${st.size}`;
281163
- } catch {
281164
- return void 0;
281418
+ } catch (err) {
281419
+ if (err instanceof Error && err.code === "ENOENT") {
281420
+ return void 0;
281421
+ }
281422
+ throw err;
281165
281423
  }
281166
281424
  }
281167
281425
  function projectConfigMemoHit2(entry) {
281168
281426
  for (const { pkgPath, fp } of entry.chain) {
281169
- if (pkgStatFp2(pkgPath) !== fp) return false;
281427
+ let current;
281428
+ try {
281429
+ current = pkgStatFp2(pkgPath);
281430
+ } catch {
281431
+ return false;
281432
+ }
281433
+ if (current !== fp) return false;
281170
281434
  }
281171
281435
  return true;
281172
281436
  }
@@ -281188,7 +281452,18 @@ function findProjectConfig2(startDir) {
281188
281452
  if (hit && projectConfigMemoHit2(hit)) return hit.result;
281189
281453
  while (dir !== root) {
281190
281454
  const pkgPath = resolve10(dir, "package.json");
281191
- const statFp = pkgStatFp2(pkgPath);
281455
+ let statFp;
281456
+ try {
281457
+ statFp = pkgStatFp2(pkgPath);
281458
+ } catch (err) {
281459
+ memoEntry.chain.push({ pkgPath, fp: STAT_ERROR_FP2 });
281460
+ process.stderr?.write?.(
281461
+ `nudo: package.json stat failed at ${pkgPath} (${err instanceof Error ? err.message : String(err)}); project config disabled for this subtree (defaults + env apply)
281462
+ `
281463
+ );
281464
+ applyBForkBudgetFromConfig2(null);
281465
+ return memoize(null);
281466
+ }
281192
281467
  memoEntry.chain.push({ pkgPath, fp: statFp });
281193
281468
  if (statFp !== void 0) {
281194
281469
  let pkg;
@@ -281359,9 +281634,9 @@ function resolveNpmJsEntryDetailed2(source, fromDir) {
281359
281634
  }
281360
281635
  return { path: tryInsidePkg2(pkgDir, subpath, tryFile), exportsUnresolved: false };
281361
281636
  }
281362
- var BUILTIN_ERROR_CLASSES2, BUILTIN_PROTOTYPE_CLASSES2, numA2, strA2, boolA2, unkA2, undefA2, nullA2, OBJECT_PROTOTYPE_METHODS2, BUILTIN_PROTOTYPE_METHOD_APPROXIMATIONS2, BoundedLruMap4, envFactories2, impliedDeps2, PATH_ENV_CACHE_MAX2, PATH_ENV_BY_PATH_MAX2, PATH_ENV_BASE_DIRS_MAX2, pathEnvCache2, pathEnvByPath2, pathEnvBaseDirs2, pathEnvFiles2, pathEnvLoadErrors2, DEFAULT_SESSION_CACHE_LIMITS2, HARD_CAP2, explicit2, fromProject2, DEFAULT_ANALYSIS_EXCLUDE2, DEFAULT_ANALYSIS_MODE2, projectConfigMemo2, MAX_PROJECT_CONFIG_MEMO2, projectConfigDiskReads2, JS_CONDITIONS2;
281363
- var init_chunk_RKFQ6H4V = __esm({
281364
- "../service/dist/chunk-RKFQ6H4V.js"() {
281637
+ var BUILTIN_ERROR_CLASSES2, BUILTIN_PROTOTYPE_CLASSES2, numA2, strA2, boolA2, unkA2, undefA2, nullA2, OBJECT_PROTOTYPE_METHODS2, BUILTIN_PROTOTYPE_METHOD_APPROXIMATIONS2, BoundedLruMap4, envFactories2, impliedDeps2, PATH_ENV_CACHE_MAX2, PATH_ENV_BY_PATH_MAX2, PATH_ENV_BASE_DIRS_MAX2, pathEnvCache2, pathEnvByPath2, pathEnvBaseDirs2, pathEnvFiles2, pathEnvLoadErrors2, DEFAULT_SESSION_CACHE_LIMITS2, HARD_CAP2, explicit2, fromProject2, DEFAULT_ANALYSIS_EXCLUDE2, DEFAULT_ANALYSIS_MODE2, projectConfigMemo2, MAX_PROJECT_CONFIG_MEMO2, projectConfigDiskReads2, STAT_ERROR_FP2, JS_CONDITIONS2;
281638
+ var init_chunk_EGGGBJDA = __esm({
281639
+ "../service/dist/chunk-EGGGBJDA.js"() {
281365
281640
  "use strict";
281366
281641
  init_src();
281367
281642
  init_es();
@@ -281638,17 +281913,18 @@ var init_chunk_RKFQ6H4V = __esm({
281638
281913
  projectConfigMemo2 = /* @__PURE__ */ new Map();
281639
281914
  MAX_PROJECT_CONFIG_MEMO2 = 128;
281640
281915
  projectConfigDiskReads2 = 0;
281916
+ STAT_ERROR_FP2 = "\0stat-error";
281641
281917
  JS_CONDITIONS2 = ["node", "require", "import", "default", "browser"];
281642
281918
  }
281643
281919
  });
281644
281920
 
281645
- // ../service/dist/chunk-Z2P52JEO.js
281646
- import { existsSync as existsSync16, statSync as statSync12, readFileSync as readFileSync18 } from "fs";
281921
+ // ../service/dist/chunk-MV2LPYT2.js
281922
+ import { statSync as statSync12, readFileSync as readFileSync18 } from "fs";
281647
281923
  import { dirname as dirname20, resolve as resolve11, join as join13 } from "path";
281648
281924
  import { readFileSync as readFileSync42, statSync as statSync33 } from "fs";
281649
281925
  import { dirname as dirname32 } from "path";
281650
281926
  import { dirname as dirname42 } from "path";
281651
- import { existsSync as existsSync42, readFileSync as readFileSync52 } from "fs";
281927
+ import { existsSync as existsSync32, readFileSync as readFileSync52 } from "fs";
281652
281928
  import { dirname as dirname52, join as join32, resolve as resolve42 } from "path";
281653
281929
  import { dirname as dirname82 } from "path";
281654
281930
  import { realpathSync as realpathSync2 } from "fs";
@@ -281664,18 +281940,21 @@ function moduleResolveCandidates2(spec, fromFile) {
281664
281940
  }
281665
281941
  function resolveModuleFile2(spec, fromFile) {
281666
281942
  for (const cand of moduleResolveCandidates2(spec, fromFile)) {
281667
- if (existsSync16(cand) && !statSync12(cand).isDirectory()) return cand;
281943
+ let st;
281944
+ try {
281945
+ st = statSync12(cand);
281946
+ } catch (e) {
281947
+ const code2 = e?.code;
281948
+ if (code2 === "ENOENT" || code2 === "ENOTDIR" || code2 === "EISDIR") continue;
281949
+ throw new ModuleReadError2(cand, e);
281950
+ }
281951
+ if (!st.isDirectory()) return cand;
281668
281952
  }
281669
281953
  return void 0;
281670
281954
  }
281671
281955
  function defaultLoadModule2(spec, fromFile) {
281672
281956
  if (!spec.startsWith(".") && !spec.startsWith("/")) return void 0;
281673
- let cand;
281674
- try {
281675
- cand = resolveModuleFile2(spec, fromFile);
281676
- } catch {
281677
- return void 0;
281678
- }
281957
+ const cand = resolveModuleFile2(spec, fromFile);
281679
281958
  if (!cand) return void 0;
281680
281959
  try {
281681
281960
  return readFileSync18(cand, "utf-8");
@@ -282106,9 +282385,9 @@ function analysisFileCacheKey2(filePath, source, activeCases, externalCallRecord
282106
282385
  let noCache = false;
282107
282386
  try {
282108
282387
  const fp = loadModuleDepsFingerprint(source, effectiveLoader, filePath);
282109
- if (fp.truncated) {
282388
+ if (fp.truncated || fp.readError) {
282110
282389
  noCache = true;
282111
- depSeg = `trunc:${fp.paths.length}`;
282390
+ depSeg = `${fp.truncated ? "trunc" : "readerr"}:${fp.paths.length}`;
282112
282391
  } else {
282113
282392
  depSeg = hashSource(fp.fp);
282114
282393
  }
@@ -283060,7 +283339,7 @@ function evalCacheSlotKey2(filePath, mode) {
283060
283339
  function evalDepKey2(source, filePath, loadModule) {
283061
283340
  try {
283062
283341
  const fp = loadModuleDepsFingerprint(source, loadModule ?? defaultLoadModule2, filePath);
283063
- if (fp.truncated) return null;
283342
+ if (fp.truncated || fp.readError) return null;
283064
283343
  return hashSource(fp.fp);
283065
283344
  } catch {
283066
283345
  return null;
@@ -283805,7 +284084,7 @@ function findOwningPackage2(fromFile) {
283805
284084
  const root = resolve42("/");
283806
284085
  for (; ; ) {
283807
284086
  const pkgPath = join32(dir, "package.json");
283808
- if (existsSync42(pkgPath)) {
284087
+ if (existsSync32(pkgPath)) {
283809
284088
  try {
283810
284089
  const pkg = JSON.parse(readFileSync52(pkgPath, "utf-8"));
283811
284090
  return { path: pkgPath, dir, pkg };
@@ -284186,7 +284465,7 @@ function computeFnDepSegment2(source, loadModule, filePath) {
284186
284465
  let fnDepFailClosed = false;
284187
284466
  try {
284188
284467
  const dfp = loadModuleDepsFingerprint(source, loadModule ?? defaultLoadModule2, filePath);
284189
- if (dfp.truncated) {
284468
+ if (dfp.truncated || dfp.readError) {
284190
284469
  fnDepFailClosed = true;
284191
284470
  fnDepSeg = null;
284192
284471
  } else {
@@ -285150,10 +285429,10 @@ function analyzeFile2(filePath, source, activeCases, externalCallRecords, loadMo
285150
285429
  });
285151
285430
  }
285152
285431
  var MODULE_RESOLVE_EXTS2, ModuleReadError2, neverAbs2, undefAbs4, MAX_RECORD_TYPE_NODES2, ABS_MODULE_CACHE_MAX2, absModuleCache2, ENV_DEPENDENTS_MAX2, ENV_DEPENDENTS_PER_KEY_MAX2, envDependents2, analysisByFile2, fnAnalysisCache2, envHarvestConflictCollectorSlot2, evalRunByFile2, KNOWN_GLOBALS2, DEFAULT_CALLSITE_BUDGET2, COLLAPSE_LITERAL_THRESHOLD2;
285153
- var init_chunk_Z2P52JEO = __esm({
285154
- "../service/dist/chunk-Z2P52JEO.js"() {
285432
+ var init_chunk_MV2LPYT2 = __esm({
285433
+ "../service/dist/chunk-MV2LPYT2.js"() {
285155
285434
  "use strict";
285156
- init_chunk_RKFQ6H4V();
285435
+ init_chunk_EGGGBJDA();
285157
285436
  init_src2();
285158
285437
  init_src();
285159
285438
  init_src2();
@@ -285311,14 +285590,14 @@ __export(emit_exports, {
285311
285590
  wrapReturnNullable: () => wrapReturnNullable,
285312
285591
  writeInterfaceDraft: () => writeInterfaceDraft
285313
285592
  });
285314
- import { readFileSync as readFileSync19, existsSync as existsSync17 } from "fs";
285593
+ import { readFileSync as readFileSync19, existsSync as existsSync15 } from "fs";
285315
285594
  import { dirname as dirname21, resolve as resolve12 } from "path";
285316
285595
  import { existsSync as existsSync23, readFileSync as readFileSync23, writeFileSync as writeFileSync6, renameSync as renameSync3, unlinkSync as unlinkSync3 } from "fs";
285317
285596
  import { basename as basename3, dirname as dirname23, relative as relative6, resolve as resolve23 } from "path";
285318
285597
  import { randomBytes as randomBytes3 } from "crypto";
285319
- import { existsSync as existsSync32, readFileSync as readFileSync33, writeFileSync as writeFileSync22, realpathSync as realpathSync3 } from "fs";
285598
+ import { existsSync as existsSync33, readFileSync as readFileSync33, writeFileSync as writeFileSync22, realpathSync as realpathSync3 } from "fs";
285320
285599
  import { basename as basename22, dirname as dirname33, isAbsolute as isAbsolute5, join as join14, relative as relative23 } from "path";
285321
- import { existsSync as existsSync43, readFileSync as readFileSync43 } from "fs";
285600
+ import { existsSync as existsSync42, readFileSync as readFileSync43 } from "fs";
285322
285601
  import { basename as basename32, dirname as dirname43, relative as relative32, resolve as resolve32 } from "path";
285323
285602
  import { relative as relative42, resolve as resolve43 } from "path";
285324
285603
  import { existsSync as existsSync52, readFileSync as readFileSync53, renameSync as renameSync22, unlinkSync as unlinkSync22, writeFileSync as writeFileSync32 } from "fs";
@@ -285380,7 +285659,7 @@ async function interfaceSurface(filePath, opts = {}) {
285380
285659
  if (autoBind !== false) {
285381
285660
  const openSc = loadModule(`./${sc.slice(sc.lastIndexOf("/") + 1)}`, abs2);
285382
285661
  if (openSc !== void 0) sidecarSource = openSc;
285383
- else if (existsSync17(sc)) sidecarSource = readFileSync19(sc, "utf-8");
285662
+ else if (existsSync15(sc)) sidecarSource = readFileSync19(sc, "utf-8");
285384
285663
  }
285385
285664
  } catch {
285386
285665
  sidecarSource = void 0;
@@ -287186,7 +287465,7 @@ function writeInterfaceDraft(filePath, draftSource, opts = {}) {
287186
287465
  }
287187
287466
  }
287188
287467
  const draftable = opts.draftable !== void 0 ? opts.draftable : opts.entries !== void 0 ? isDraftableEntry(opts.entries) : /export\s+const\s+[\p{ID_Start}$_][\p{ID_Continue}$]*\s*=/u.test(draftSource);
287189
- const prev = existsSync32(draftPath) ? readFileSync33(draftPath, "utf-8") : void 0;
287468
+ const prev = existsSync33(draftPath) ? readFileSync33(draftPath, "utf-8") : void 0;
287190
287469
  const changed = prev !== draftSource;
287191
287470
  const written = !opts.dryRun && changed && draftable;
287192
287471
  if (written) {
@@ -287511,7 +287790,7 @@ function importLocalMap(source, fromFile) {
287511
287790
  const raw = resolve32(base, spec);
287512
287791
  let modulePath = null;
287513
287792
  for (const cand of [raw, `${raw}.js`, `${raw}.ts`, `${raw}.mjs`]) {
287514
- if (existsSync43(cand)) {
287793
+ if (existsSync42(cand)) {
287515
287794
  modulePath = cand;
287516
287795
  break;
287517
287796
  }
@@ -287535,7 +287814,7 @@ function deriveFromRoot(filePath, opts = {}) {
287535
287814
  const autoBind = opts.autoBind ?? interfaceConfig2(findProjectConfig2(dirname43(abs2))?.config).autoBind;
287536
287815
  const loadModule = opts.loadModule ?? defaultLoadModule2;
287537
287816
  const sidecarPath = sidecarPathOf(abs2);
287538
- const sidecarSrc = existsSync43(sidecarPath) && !isNodeModulesPath(sidecarPath) ? readFileSync43(sidecarPath, "utf-8") : "";
287817
+ const sidecarSrc = existsSync42(sidecarPath) && !isNodeModulesPath(sidecarPath) ? readFileSync43(sidecarPath, "utf-8") : "";
287539
287818
  const fnNames = topLevelFnNames(source);
287540
287819
  const roots = [];
287541
287820
  const plans = [];
@@ -287663,7 +287942,7 @@ function deriveOneRoot(plan, source, file, modules, importLocals, label) {
287663
287942
  targetFile = file;
287664
287943
  }
287665
287944
  if (isNodeModulesPath(targetFile)) continue;
287666
- if (!existsSync43(targetFile)) continue;
287945
+ if (!existsSync42(targetFile)) continue;
287667
287946
  const key = `${targetFile}::${targetExport}`;
287668
287947
  let agg = byCallee.get(key);
287669
287948
  if (!agg) {
@@ -289748,8 +290027,8 @@ var init_emit2 = __esm({
289748
290027
  "../service/dist/emit/index.js"() {
289749
290028
  "use strict";
289750
290029
  init_chunk_4TAFH6ZZ();
289751
- init_chunk_Z2P52JEO();
289752
- init_chunk_RKFQ6H4V();
290030
+ init_chunk_MV2LPYT2();
290031
+ init_chunk_EGGGBJDA();
289753
290032
  init_src();
289754
290033
  init_src();
289755
290034
  init_internal();
@@ -290011,7 +290290,7 @@ __export(migrate_exports, {
290011
290290
  stripTsToJs: () => stripTsToJs
290012
290291
  });
290013
290292
  import {
290014
- existsSync as existsSync25,
290293
+ existsSync as existsSync21,
290015
290294
  mkdirSync as mkdirSync7,
290016
290295
  readFileSync as readFileSync28,
290017
290296
  readdirSync as readdirSync4,
@@ -290032,7 +290311,7 @@ function readJson(path) {
290032
290311
  }
290033
290312
  function writeFileAtomic(path, data) {
290034
290313
  const dir = dirname29(path);
290035
- if (!existsSync25(dir)) mkdirSync7(dir, { recursive: true });
290314
+ if (!existsSync21(dir)) mkdirSync7(dir, { recursive: true });
290036
290315
  const tmp = `${path}.tmp-${process.pid}-${Date.now()}`;
290037
290316
  try {
290038
290317
  writeFileSync11(tmp, data, "utf-8");
@@ -290050,7 +290329,7 @@ function writeJson(path, value) {
290050
290329
  `);
290051
290330
  }
290052
290331
  function snapshotFile(path) {
290053
- if (!existsSync25(path)) return { path, kind: "missing" };
290332
+ if (!existsSync21(path)) return { path, kind: "missing" };
290054
290333
  try {
290055
290334
  if (statSync16(path).isFile()) {
290056
290335
  return { path, kind: "file", content: readFileSync28(path, "utf-8") };
@@ -290062,7 +290341,7 @@ function snapshotFile(path) {
290062
290341
  }
290063
290342
  function restoreSnapshot(snap) {
290064
290343
  if (snap.kind === "missing") {
290065
- if (existsSync25(snap.path)) rmSync3(snap.path, { force: true });
290344
+ if (existsSync21(snap.path)) rmSync3(snap.path, { force: true });
290066
290345
  return;
290067
290346
  }
290068
290347
  if (snap.kind === "file") writeFileAtomic(snap.path, snap.content);
@@ -290159,7 +290438,7 @@ function unquoteYamlScalar(s) {
290159
290438
  }
290160
290439
  function parsePnpmWorkspacePackages(root) {
290161
290440
  const yamlPath = join18(root, "pnpm-workspace.yaml");
290162
- if (!existsSync25(yamlPath)) return [];
290441
+ if (!existsSync21(yamlPath)) return [];
290163
290442
  let text;
290164
290443
  try {
290165
290444
  text = readFileSync28(yamlPath, "utf-8");
@@ -290221,17 +290500,17 @@ function packageRoots(root) {
290221
290500
  if (w.startsWith("!")) continue;
290222
290501
  if (w.endsWith("/*") || w.endsWith("/**")) {
290223
290502
  const base = join18(root, w.replace(/\/\*\*?$/, ""));
290224
- if (!existsSync25(base)) continue;
290503
+ if (!existsSync21(base)) continue;
290225
290504
  for (const name of readdirSync4(base)) {
290226
290505
  const p = join18(base, name);
290227
- if (!existsSync25(join18(p, "package.json"))) continue;
290506
+ if (!existsSync21(join18(p, "package.json"))) continue;
290228
290507
  if (seen.has(p)) continue;
290229
290508
  seen.add(p);
290230
290509
  roots.push(p);
290231
290510
  }
290232
290511
  } else {
290233
290512
  const p = join18(root, w);
290234
- if (!existsSync25(join18(p, "package.json"))) continue;
290513
+ if (!existsSync21(join18(p, "package.json"))) continue;
290235
290514
  if (seen.has(p)) continue;
290236
290515
  seen.add(p);
290237
290516
  roots.push(p);
@@ -290459,7 +290738,7 @@ function findWorkflowDir(from) {
290459
290738
  let cur = resolve19(from);
290460
290739
  for (let i = 0; i < 6; i++) {
290461
290740
  const wf = join18(cur, ".github", "workflows");
290462
- if (existsSync25(wf) && statSync16(wf).isDirectory()) return wf;
290741
+ if (existsSync21(wf) && statSync16(wf).isDirectory()) return wf;
290463
290742
  const parent = dirname29(cur);
290464
290743
  if (parent === cur) break;
290465
290744
  cur = parent;
@@ -290505,7 +290784,7 @@ function rewriteWorkflowsNear(from, opts = {}) {
290505
290784
  }
290506
290785
  function resolveMigrateRoot(rootDir) {
290507
290786
  const raw = resolve19(rootDir);
290508
- if (!existsSync25(raw)) {
290787
+ if (!existsSync21(raw)) {
290509
290788
  throw new Error(`not found: ${rootDir}`);
290510
290789
  }
290511
290790
  return statSync16(raw).isDirectory() ? raw : dirname29(raw);
@@ -290529,9 +290808,9 @@ function migrateStatus(rootDir) {
290529
290808
  ...pkg?.devDependencies ?? {}
290530
290809
  };
290531
290810
  const markerPath = join18(r, ".nudo", "migrate-retired.json");
290532
- const retired = existsSync25(markerPath) && statSync16(markerPath).isFile();
290811
+ const retired = existsSync21(markerPath) && statSync16(markerPath).isFile();
290533
290812
  const retiringPath = join18(r, ".nudo", "migrate-retiring.json");
290534
- const retiring = !retired && existsSync25(retiringPath) && statSync16(retiringPath).isFile();
290813
+ const retiring = !retired && existsSync21(retiringPath) && statSync16(retiringPath).isFile();
290535
290814
  const blockers = [];
290536
290815
  if (retiring) {
290537
290816
  blockers.push(
@@ -290552,9 +290831,9 @@ function migrateStatus(rootDir) {
290552
290831
  }
290553
290832
  rows.push({
290554
290833
  root: relative12(process.cwd(), r) || ".",
290555
- packageJson: existsSync25(pkgPath),
290834
+ packageJson: existsSync21(pkgPath),
290556
290835
  typescriptDep: Boolean(deps.typescript),
290557
- tsconfig: existsSync25(join18(r, "tsconfig.json")),
290836
+ tsconfig: existsSync21(join18(r, "tsconfig.json")),
290558
290837
  tscScripts,
290559
290838
  tsFiles,
290560
290839
  tsxFiles,
@@ -290594,7 +290873,7 @@ async function migrateStrip(paths, opts = {}) {
290594
290873
  const files = [];
290595
290874
  for (const p of paths) {
290596
290875
  const abs2 = resolve19(p);
290597
- if (!existsSync25(abs2)) {
290876
+ if (!existsSync21(abs2)) {
290598
290877
  throw new Error(`not found: ${p}`);
290599
290878
  }
290600
290879
  if (statSync16(abs2).isDirectory()) {
@@ -290618,9 +290897,9 @@ async function migrateStrip(paths, opts = {}) {
290618
290897
  const outFile = TSX_EXT.has(ext) ? file.replace(/\.tsx$/i, ".jsx") : file.replace(/\.tsx$/i, ".js").replace(/\.mts$/i, ".mjs").replace(/\.cts$/i, ".cjs").replace(/\.ts$/i, ".js");
290619
290898
  const wouldClobberNonTs = outFile === file && !isStripSource(file);
290620
290899
  if (opts.write && !wouldClobberNonTs) {
290621
- if (opts.backup && existsSync25(file) && !existsSync25(`${file}.bak`)) {
290900
+ if (opts.backup && existsSync21(file) && !existsSync21(`${file}.bak`)) {
290622
290901
  renameSync4(file, `${file}.bak`);
290623
- } else if (opts.backup !== true && existsSync25(file) && extname(file).toLowerCase() !== extname(outFile).toLowerCase()) {
290902
+ } else if (opts.backup !== true && existsSync21(file) && extname(file).toLowerCase() !== extname(outFile).toLowerCase()) {
290624
290903
  }
290625
290904
  writeFileSync11(outFile, code2, "utf-8");
290626
290905
  }
@@ -290630,7 +290909,7 @@ async function migrateStrip(paths, opts = {}) {
290630
290909
  const draft = await draftInterface(outFile, { source: code2, bodyAccesses: true });
290631
290910
  if (draft.draftSource && draft.draftSource.trim().length > 0) {
290632
290911
  const sc = sidecarPathOf(outFile);
290633
- if (!existsSync25(sc)) {
290912
+ if (!existsSync21(sc)) {
290634
290913
  mkdirSync7(dirname29(sc), { recursive: true });
290635
290914
  writeFileSync11(sc, draft.draftSource, "utf-8");
290636
290915
  sidecarDraft = sc;
@@ -290670,7 +290949,7 @@ async function migrateVerify(paths, opts = {}) {
290670
290949
  const files = [];
290671
290950
  for (const p of paths) {
290672
290951
  const abs2 = resolve19(p);
290673
- if (!existsSync25(abs2)) {
290952
+ if (!existsSync21(abs2)) {
290674
290953
  throw new Error(`not found: ${p}`);
290675
290954
  }
290676
290955
  if (statSync16(abs2).isDirectory()) {
@@ -290767,7 +291046,7 @@ function migrateRetire(rootDir, opts = {}) {
290767
291046
  mkdirSync7(markerDir, { recursive: true });
290768
291047
  commitWriteSet(root, ops);
290769
291048
  const retiring = join18(markerDir, "migrate-retiring.json");
290770
- if (existsSync25(retiring)) rmSync3(retiring, { force: true });
291049
+ if (existsSync21(retiring)) rmSync3(retiring, { force: true });
290771
291050
  }
290772
291051
  return {
290773
291052
  root: relative12(process.cwd(), root) || ".",
@@ -290941,13 +291220,13 @@ init_src4();
290941
291220
  init_src2();
290942
291221
  init_emit2();
290943
291222
  init_evaluator_api();
290944
- import { readFileSync as readFileSync21, writeFileSync as writeFileSync7, existsSync as existsSync19 } from "fs";
291223
+ import { readFileSync as readFileSync21, writeFileSync as writeFileSync7, existsSync as existsSync17 } from "fs";
290945
291224
  import { resolve as resolve14, dirname as dirname25, basename as basename6 } from "path";
290946
291225
 
290947
291226
  // src/commands/shared.ts
290948
291227
  init_emit2();
290949
291228
  init_src4();
290950
- import { readFileSync as readFileSync20, existsSync as existsSync18, watch, readdirSync as readdirSync3, statSync as statSync13 } from "fs";
291229
+ import { readFileSync as readFileSync20, existsSync as existsSync16, watch, readdirSync as readdirSync3, statSync as statSync13 } from "fs";
290951
291230
  import { resolve as resolve13, dirname as dirname24, relative as relative7, join as join15, basename as basename5 } from "path";
290952
291231
  function usageError(message, fix) {
290953
291232
  console.error(message);
@@ -290989,7 +291268,7 @@ function collectExternalRecords(sites, errorSink) {
290989
291268
  const records = [];
290990
291269
  for (const site of sites) {
290991
291270
  const sitePath = resolve13(site);
290992
- if (!existsSync18(sitePath)) {
291271
+ if (!existsSync16(sitePath)) {
290993
291272
  const err = {
290994
291273
  path: sitePath,
290995
291274
  code: "nudo:path-missing-callsite",
@@ -291021,7 +291300,7 @@ function collectNudoFiles(dir) {
291021
291300
  }
291022
291301
  function resolveTargetsCollect(path) {
291023
291302
  const resolved = resolve13(path);
291024
- if (!existsSync18(resolved)) {
291303
+ if (!existsSync16(resolved)) {
291025
291304
  return {
291026
291305
  targets: [],
291027
291306
  errors: [
@@ -291073,12 +291352,12 @@ function resolveTargets(path) {
291073
291352
  }
291074
291353
  function startWatch(paths, runOne, label, onRoundStart) {
291075
291354
  const resolvedList = paths.map((p) => resolve13(p));
291076
- const isDir = resolvedList.some((p) => existsSync18(p) && statSync13(p).isDirectory());
291355
+ const isDir = resolvedList.some((p) => existsSync16(p) && statSync13(p).isDirectory());
291077
291356
  const primary = resolvedList[0];
291078
291357
  const getFiles = () => {
291079
291358
  const out = [];
291080
291359
  for (const p of resolvedList) {
291081
- if (!existsSync18(p)) continue;
291360
+ if (!existsSync16(p)) continue;
291082
291361
  if (statSync13(p).isDirectory()) out.push(...collectNudoFiles(p));
291083
291362
  else out.push(p);
291084
291363
  }
@@ -291174,7 +291453,7 @@ function startWatch(paths, runOne, label, onRoundStart) {
291174
291453
  debounceTimer = setTimeout(() => {
291175
291454
  const changedFiles = [...pendingChanged];
291176
291455
  pendingChanged.clear();
291177
- if (changedFiles.some((f) => !existsSync18(f))) getAnalysisSession().clear();
291456
+ if (changedFiles.some((f) => !existsSync16(f))) getAnalysisSession().clear();
291178
291457
  runIncremental(changedFiles).catch(() => {
291179
291458
  });
291180
291459
  }, 200);
@@ -291541,7 +291820,7 @@ async function loadCheckCache(filePath, source, opts) {
291541
291820
  if (autoBind !== false) {
291542
291821
  try {
291543
291822
  const scPath = sidecarPathOf(filePath);
291544
- if (existsSync19(scPath)) sidecarContent = readFileSync21(scPath, "utf-8");
291823
+ if (existsSync17(scPath)) sidecarContent = readFileSync21(scPath, "utf-8");
291545
291824
  } catch {
291546
291825
  sidecarContent = null;
291547
291826
  }
@@ -291812,7 +292091,7 @@ async function runCheckFix(opts) {
291812
292091
  const sidecar = sidecarPathOf(file);
291813
292092
  let sidecarText;
291814
292093
  try {
291815
- sidecarText = existsSync19(sidecar) ? readFileSync21(sidecar, "utf-8") : void 0;
292094
+ sidecarText = existsSync17(sidecar) ? readFileSync21(sidecar, "utf-8") : void 0;
291816
292095
  } catch {
291817
292096
  sidecarText = void 0;
291818
292097
  }
@@ -292430,7 +292709,7 @@ function registerTestCommand(program3) {
292430
292709
  // src/commands/contract.ts
292431
292710
  init_emit2();
292432
292711
  init_src4();
292433
- import { readFileSync as readFileSync25, existsSync as existsSync20, statSync as statSync14, writeFileSync as writeFileSync9, realpathSync as realpathSync4 } from "fs";
292712
+ import { readFileSync as readFileSync25, existsSync as existsSync18, statSync as statSync14, writeFileSync as writeFileSync9, realpathSync as realpathSync4 } from "fs";
292434
292713
  import { resolve as resolve16, dirname as dirname27, relative as relative9, join as join16, basename as basename7, isAbsolute as isAbsolute6 } from "path";
292435
292714
  async function runContractPrint(file, records) {
292436
292715
  const { interfaceSurface: interfaceSurface2 } = await Promise.resolve().then(() => (init_emit2(), emit_exports));
@@ -292460,8 +292739,8 @@ async function runContractFromDts(paths, opts) {
292460
292739
  }
292461
292740
  let label = "dts";
292462
292741
  let dtsFiles = [];
292463
- const fileLike = paths.filter((p) => existsSync20(p));
292464
- const barePkgs = paths.filter((p) => !existsSync20(p));
292742
+ const fileLike = paths.filter((p) => existsSync18(p));
292743
+ const barePkgs = paths.filter((p) => !existsSync18(p));
292465
292744
  for (const p of fileLike) {
292466
292745
  const abs2 = resolve16(p);
292467
292746
  if (statSync14(abs2).isDirectory()) {
@@ -292471,7 +292750,7 @@ async function runContractFromDts(paths, opts) {
292471
292750
  dtsFiles.push(abs2);
292472
292751
  } else {
292473
292752
  const sibling = abs2.replace(/\.[cm]?[jt]sx?$/, ".d.ts");
292474
- if (existsSync20(sibling)) dtsFiles.push(sibling);
292753
+ if (existsSync18(sibling)) dtsFiles.push(sibling);
292475
292754
  }
292476
292755
  }
292477
292756
  for (const pkg of barePkgs) {
@@ -292582,7 +292861,7 @@ async function runContractDraft(file, opts) {
292582
292861
  let dir = dirname27(filePath);
292583
292862
  const fsRoot = resolve16("/");
292584
292863
  while (dir !== fsRoot) {
292585
- if (existsSync20(join16(dir, "package.json"))) {
292864
+ if (existsSync18(join16(dir, "package.json"))) {
292586
292865
  projectRoot = dir;
292587
292866
  break;
292588
292867
  }
@@ -293061,7 +293340,7 @@ function registerExportCommand(program3) {
293061
293340
 
293062
293341
  // src/commands/health.ts
293063
293342
  init_src4();
293064
- import { readFileSync as readFileSync27, existsSync as existsSync24, statSync as statSync15 } from "fs";
293343
+ import { readFileSync as readFileSync27, existsSync as existsSync20, statSync as statSync15 } from "fs";
293065
293344
  import { resolve as resolve18, dirname as dirname28 } from "path";
293066
293345
  async function healthFile(filePath, records) {
293067
293346
  const report = { file: displayPathOf(filePath), functions: 0, entryOnly: 0, uncovered: [] };
@@ -293157,7 +293436,7 @@ async function runHealth(paths, opts) {
293157
293436
  const reports = [];
293158
293437
  for (const p of targetPaths) {
293159
293438
  const abs2 = resolve18(p);
293160
- if (!existsSync24(abs2)) {
293439
+ if (!existsSync20(abs2)) {
293161
293440
  reports.push({ file: displayPathOf(abs2), functions: 0, entryOnly: 0, uncovered: [], error: `File not found: ${displayPathOf(abs2)}` });
293162
293441
  continue;
293163
293442
  }