@nudojs/cli 2.0.0 → 2.0.1

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 +558 -67
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -16305,7 +16305,12 @@ function isRelFn(a) {
16305
16305
  if (!s || s.k !== "fn") return false;
16306
16306
  if (s.returnType === void 0) return false;
16307
16307
  if (s.paramTypes === void 0) return s.params.length === 0;
16308
- return s.paramTypes.length === s.params.length;
16308
+ if (s.paramTypes.length === s.params.length) return true;
16309
+ let required = 0;
16310
+ for (const p of s.params) {
16311
+ if (p && !p.startsWith("...") && !p.endsWith("?")) required++;
16312
+ }
16313
+ return s.paramTypes.length === required;
16309
16314
  }
16310
16315
  function litOfTerm(t) {
16311
16316
  return t.op === "lit" ? t.value : void 0;
@@ -18910,6 +18915,15 @@ function ok() {
18910
18915
  function fail(reason) {
18911
18916
  return { ok: false, reason };
18912
18917
  }
18918
+ function requiredFnArity(params) {
18919
+ if (!params) return 0;
18920
+ let n = 0;
18921
+ for (const p of params) {
18922
+ if (!p || p.startsWith("...") || p.endsWith("?")) continue;
18923
+ n++;
18924
+ }
18925
+ return n;
18926
+ }
18913
18927
  function leqAbs(src, tgt, opts = {}) {
18914
18928
  const phi2 = opts.phi ?? pTrue;
18915
18929
  return leqWithPred(src, tgt, phi2, opts.env ?? null, 0);
@@ -19062,8 +19076,12 @@ function leqShape(src, tgt, phi2, env, depth) {
19062
19076
  }
19063
19077
  if (t.k === "fn") {
19064
19078
  if (s.k !== "fn") return fail(`shape ${s.k} \u22AD fn`);
19065
- if (s.params.length !== t.params.length) {
19066
- return fail(`fn arity ${s.params.length} \u22AD ${t.params.length}`);
19079
+ const sReq = requiredFnArity(s.params);
19080
+ const tReq = requiredFnArity(t.params);
19081
+ if (sReq > tReq) {
19082
+ return fail(
19083
+ `fn arity required ${sReq} \u22AD target required ${tReq} (params ${s.params.length} / ${t.params.length})`
19084
+ );
19067
19085
  }
19068
19086
  if (t.returnType !== void 0) {
19069
19087
  const sr = s.returnType;
@@ -21319,13 +21337,39 @@ function formatShape(a) {
21319
21337
  case "tuple":
21320
21338
  return `[${s.elements.map(formatShape).join(", ")}]`;
21321
21339
  case "fn": {
21322
- if (s.paramTypes && s.paramTypes.length > 0) {
21323
- const ps = s.paramTypes.map((p) => formatShapeSlot(p));
21324
- const ret2 = s.returnType !== void 0 ? formatShapeSlot(s.returnType) : "?";
21325
- return `(${ps.join(", ")}) => ${ret2}`;
21326
- }
21327
21340
  const ret = s.returnType !== void 0 ? formatShapeSlot(s.returnType) : "?";
21328
- return `(${s.params.join(", ")}) => ${ret}`;
21341
+ const labels = s.params ?? [];
21342
+ const paramTypes = s.paramTypes;
21343
+ const hasMarkers = labels.some(
21344
+ (p) => p.startsWith("...") || p.endsWith("?")
21345
+ );
21346
+ const renderLabeled = () => {
21347
+ const ps = [];
21348
+ const n = paramTypes ? Math.max(paramTypes.length, labels.length) : labels.length;
21349
+ for (let i = 0; i < n; i++) {
21350
+ const label = labels[i];
21351
+ const type = paramTypes?.[i];
21352
+ const typeText = type !== void 0 ? formatShapeSlot(type) : void 0;
21353
+ if (label?.startsWith("...")) {
21354
+ ps.push(typeText ? `...${label.slice(3)}: ${typeText}` : label);
21355
+ } else if (label?.endsWith("?")) {
21356
+ ps.push(typeText ? `${label.slice(0, -1)}?: ${typeText}` : label);
21357
+ } else if (typeText !== void 0) {
21358
+ ps.push(typeText);
21359
+ } else if (label) {
21360
+ ps.push(label);
21361
+ }
21362
+ }
21363
+ return ps;
21364
+ };
21365
+ if (hasMarkers) {
21366
+ return `(${renderLabeled().join(", ")}) => ${ret}`;
21367
+ }
21368
+ if (paramTypes && paramTypes.length > 0) {
21369
+ const ps = paramTypes.map((p) => formatShapeSlot(p));
21370
+ return `(${ps.join(", ")}) => ${ret}`;
21371
+ }
21372
+ return `(${labels.join(", ")}) => ${ret}`;
21329
21373
  }
21330
21374
  case "brand":
21331
21375
  return `${s.name}`;
@@ -31703,6 +31747,7 @@ __export(src_exports, {
31703
31747
  registerBClass: () => registerBClass,
31704
31748
  relationFingerprint: () => relationFingerprint,
31705
31749
  relationFn: () => relationFn,
31750
+ requiredFnArity: () => requiredFnArity,
31706
31751
  resetAbsCallBudget: () => resetAbsCallBudget,
31707
31752
  resetCheckSourceMemo: () => resetCheckSourceMemo,
31708
31753
  resetFnFpCache: () => resetFnFpCache,
@@ -61461,6 +61506,19 @@ function envFn(paramTypes, returnType, apply, opts) {
61461
61506
  if (opts?.conf && opts.conf !== "exact") a.conf = opts.conf;
61462
61507
  return a;
61463
61508
  }
61509
+ function envFnVariadic(restType, returnType, opts) {
61510
+ const required = opts?.required ?? [];
61511
+ const restName = opts?.restName ?? "...rest";
61512
+ const paramTypes = [...required, restType];
61513
+ const params = [
61514
+ ...required.map((_, i) => `x${i}`),
61515
+ restName
61516
+ ];
61517
+ return envFn(paramTypes, returnType, opts?.apply, {
61518
+ params,
61519
+ ...opts?.name ? { name: opts.name } : {}
61520
+ });
61521
+ }
61464
61522
  function slotsOf(entries) {
61465
61523
  const out = {};
61466
61524
  for (const [k, v2] of Object.entries(entries)) {
@@ -62235,6 +62293,106 @@ function defineEnv3() {
62235
62293
  chmodSync: envFn([prim.str(), prim.num()], undef2()),
62236
62294
  chownSync: envFn([prim.str(), prim.num(), prim.num()], undef2()),
62237
62295
  accessSync: envFn([prim.str(), prim.num()], undef2()),
62296
+ // Callback-style async on `fs` / `node:fs` (Node actual API).
62297
+ // Promise APIs live only under fs.promises / node:fs/promises.
62298
+ readFile: envFn(
62299
+ [prim.str(), prim.unknown, prim.unknown],
62300
+ undef2(),
62301
+ void 0,
62302
+ { params: ["path", "options?", "callback"] }
62303
+ ),
62304
+ writeFile: envFn(
62305
+ [prim.str(), unionOf(prim.str(), bufferBrand), prim.unknown],
62306
+ undef2(),
62307
+ void 0,
62308
+ { params: ["path", "data", "callback"] }
62309
+ ),
62310
+ mkdir: envFn(
62311
+ [prim.str(), prim.unknown, prim.unknown],
62312
+ undef2(),
62313
+ void 0,
62314
+ { params: ["path", "options?", "callback"] }
62315
+ ),
62316
+ rm: envFn(
62317
+ [prim.str(), prim.unknown, prim.unknown],
62318
+ undef2(),
62319
+ void 0,
62320
+ { params: ["path", "options?", "callback"] }
62321
+ ),
62322
+ stat: envFn(
62323
+ [prim.str(), prim.unknown, prim.unknown],
62324
+ undef2(),
62325
+ void 0,
62326
+ { params: ["path", "options?", "callback"] }
62327
+ ),
62328
+ readdir: envFn(
62329
+ [prim.str(), prim.unknown, prim.unknown],
62330
+ undef2(),
62331
+ void 0,
62332
+ { params: ["path", "options?", "callback"] }
62333
+ ),
62334
+ access: envFn(
62335
+ [prim.str(), prim.unknown, prim.unknown],
62336
+ undef2(),
62337
+ void 0,
62338
+ { params: ["path", "mode?", "callback"] }
62339
+ ),
62340
+ appendFile: envFn(
62341
+ [prim.str(), unionOf(prim.str(), bufferBrand), prim.unknown],
62342
+ undef2(),
62343
+ void 0,
62344
+ { params: ["path", "data", "callback"] }
62345
+ ),
62346
+ unlink: envFn(
62347
+ [prim.str(), prim.unknown, prim.unknown],
62348
+ undef2(),
62349
+ void 0,
62350
+ { params: ["path", "options?", "callback"] }
62351
+ ),
62352
+ rename: envFn(
62353
+ [prim.str(), prim.str(), prim.unknown],
62354
+ undef2(),
62355
+ void 0,
62356
+ { params: ["oldPath", "newPath", "callback"] }
62357
+ ),
62358
+ copyFile: envFn(
62359
+ [prim.str(), prim.str(), prim.unknown],
62360
+ undef2(),
62361
+ void 0,
62362
+ { params: ["src", "dest", "callback"] }
62363
+ ),
62364
+ realpath: envFn(
62365
+ [prim.str(), prim.unknown, prim.unknown],
62366
+ undef2(),
62367
+ void 0,
62368
+ { params: ["path", "options?", "callback"] }
62369
+ ),
62370
+ readlink: envFn(
62371
+ [prim.str(), prim.unknown, prim.unknown],
62372
+ undef2(),
62373
+ void 0,
62374
+ { params: ["path", "options?", "callback"] }
62375
+ ),
62376
+ symlink: envFn(
62377
+ [prim.str(), prim.str(), prim.unknown, prim.unknown],
62378
+ undef2(),
62379
+ void 0,
62380
+ { params: ["target", "path", "type?", "callback"] }
62381
+ ),
62382
+ chmod: envFn(
62383
+ [prim.str(), prim.num(), prim.unknown],
62384
+ undef2(),
62385
+ void 0,
62386
+ { params: ["path", "mode", "callback"] }
62387
+ ),
62388
+ open: envFn(
62389
+ [prim.str(), prim.unknown, prim.unknown],
62390
+ undef2(),
62391
+ void 0,
62392
+ { params: ["path", "flags?", "callback"] }
62393
+ )
62394
+ };
62395
+ const fsPromisesModule = {
62238
62396
  readFile: envFn(
62239
62397
  [prim.str(), prim.unknown],
62240
62398
  promiseOf(unionOf(prim.str(), bufferBrand))
@@ -62253,7 +62411,19 @@ function defineEnv3() {
62253
62411
  [prim.str(), prim.unknown],
62254
62412
  promiseOf(arrOf(prim.unknown))
62255
62413
  ),
62256
- access: envFn([prim.str(), prim.num()], promiseOf(undef2()))
62414
+ access: envFn([prim.str(), prim.num()], promiseOf(undef2())),
62415
+ appendFile: envFn(
62416
+ [prim.str(), unionOf(prim.str(), bufferBrand)],
62417
+ promiseOf(undef2())
62418
+ ),
62419
+ unlink: envFn([prim.str()], promiseOf(undef2())),
62420
+ rename: envFn([prim.str(), prim.str()], promiseOf(undef2())),
62421
+ copyFile: envFn([prim.str(), prim.str()], promiseOf(undef2())),
62422
+ realpath: envFn([prim.str()], promiseOf(prim.str())),
62423
+ readlink: envFn([prim.str()], promiseOf(prim.str())),
62424
+ symlink: envFn([prim.str(), prim.str()], promiseOf(undef2())),
62425
+ chmod: envFn([prim.str(), prim.num()], promiseOf(undef2())),
62426
+ open: envFn([prim.str(), prim.str()], promiseOf(prim.unknown))
62257
62427
  };
62258
62428
  const strImpl1Abs = (fn2) => (args) => {
62259
62429
  const a = absStr2(args[0]);
@@ -62283,10 +62453,21 @@ function defineEnv3() {
62283
62453
  return p !== void 0 ? boolLit(nodePath.isAbsolute(p)) : void 0;
62284
62454
  };
62285
62455
  const pathModule = {
62286
- join: envFn([prim.str(), prim.str()], prim.str(), pathJoinAbs),
62287
- resolve: envFn([prim.str()], prim.str(), pathResolveAbs),
62456
+ // Node variadic: declare min required arity + rest label (not n fixed slots).
62457
+ join: envFnVariadic(prim.str(), prim.str(), {
62458
+ apply: pathJoinAbs,
62459
+ required: [prim.str()],
62460
+ restName: "...paths"
62461
+ }),
62462
+ resolve: envFnVariadic(prim.str(), prim.str(), {
62463
+ apply: pathResolveAbs,
62464
+ restName: "...paths"
62465
+ }),
62288
62466
  dirname: envFn([prim.str()], prim.str(), strImpl1Abs(nodePath.dirname)),
62289
- basename: envFn([prim.str(), prim.str()], prim.str(), pathBasenameAbs),
62467
+ // ext is optional in Node — required arity 1; label+type render `ext?: string`.
62468
+ basename: envFn([prim.str(), prim.str()], prim.str(), pathBasenameAbs, {
62469
+ params: ["path", "ext?"]
62470
+ }),
62290
62471
  extname: envFn([prim.str()], prim.str(), strImpl1Abs(nodePath.extname)),
62291
62472
  relative: envFn([prim.str(), prim.str()], prim.str(), pathRelativeAbs),
62292
62473
  normalize: envFn([prim.str()], prim.str(), strImpl1Abs(nodePath.normalize)),
@@ -62364,6 +62545,7 @@ function defineEnv3() {
62364
62545
  toJSON: envFn([], prim.str())
62365
62546
  });
62366
62547
  const urlModule = {
62548
+ // base is optional in Node — required arity 1; label+type render `base?: string`.
62367
62549
  URL: envFn(
62368
62550
  [prim.str(), prim.str()],
62369
62551
  nodeUrlObj,
@@ -62391,7 +62573,8 @@ function defineEnv3() {
62391
62573
  } catch {
62392
62574
  return void 0;
62393
62575
  }
62394
- }
62576
+ },
62577
+ { params: ["href", "base?"] }
62395
62578
  ),
62396
62579
  URLSearchParams: envFn(
62397
62580
  [prim.unknown],
@@ -62489,15 +62672,27 @@ function defineEnv3() {
62489
62672
  fork: envFn([prim.str(), arrOf(prim.str()), prim.unknown], prim.unknown)
62490
62673
  };
62491
62674
  const utilModule = {
62492
- promisify: envFn([prim.unknown], prim.unknown),
62675
+ // Signature-level: promisify preserves fn-ness only as unknown (no generic).
62676
+ promisify: envFn([prim.unknown], prim.unknown, void 0, { name: "util.promisify" }),
62493
62677
  inspect: envFn([prim.unknown, prim.unknown], prim.str()),
62494
- format: envFn([prim.str()], prim.str()),
62678
+ format: envFnVariadic(prim.unknown, prim.str(), {
62679
+ // util.format() with zero args is valid in Node.
62680
+ restName: "...args",
62681
+ name: "util.format"
62682
+ }),
62683
+ callbackify: envFn([prim.unknown], prim.unknown),
62684
+ deprecate: envFn([prim.unknown, prim.str()], prim.unknown),
62685
+ inherits: envFn([prim.unknown, prim.unknown], undef2()),
62686
+ isDeepStrictEqual: envFn([prim.unknown, prim.unknown], prim.bool()),
62495
62687
  types: objAbs({
62496
62688
  isDate: envFn([prim.unknown], prim.bool()),
62497
62689
  isRegExp: envFn([prim.unknown], prim.bool()),
62498
62690
  isPromise: envFn([prim.unknown], prim.bool()),
62499
62691
  isArrayBuffer: envFn([prim.unknown], prim.bool()),
62500
- isTypedArray: envFn([prim.unknown], prim.bool())
62692
+ isTypedArray: envFn([prim.unknown], prim.bool()),
62693
+ isNativeError: envFn([prim.unknown], prim.bool()),
62694
+ isAsyncFunction: envFn([prim.unknown], prim.bool()),
62695
+ isGeneratorFunction: envFn([prim.unknown], prim.bool())
62501
62696
  }),
62502
62697
  TextEncoder: envFn(
62503
62698
  [],
@@ -62508,6 +62703,79 @@ function defineEnv3() {
62508
62703
  objAbs({ decode: envFn([prim.unknown], prim.str()) })
62509
62704
  )
62510
62705
  };
62706
+ const eventEmitterShape = objAbs({
62707
+ on: envFn([prim.str(), prim.unknown], prim.unknown),
62708
+ once: envFn([prim.str(), prim.unknown], prim.unknown),
62709
+ off: envFn([prim.str(), prim.unknown], prim.unknown),
62710
+ emit: envFn([prim.str()], prim.bool()),
62711
+ addListener: envFn([prim.str(), prim.unknown], prim.unknown),
62712
+ removeListener: envFn([prim.str(), prim.unknown], prim.unknown),
62713
+ removeAllListeners: envFn([prim.str()], prim.unknown),
62714
+ listeners: envFn([prim.str()], arrOf(prim.unknown)),
62715
+ listenerCount: envFn([prim.str()], prim.num()),
62716
+ eventNames: envFn([], arrOf(prim.str()))
62717
+ });
62718
+ const eventEmitterInstance = brandOf2("EventEmitter", eventEmitterShape);
62719
+ const EventEmitterCtor = envFn([prim.unknown], eventEmitterInstance, void 0, {
62720
+ params: ["options?"]
62721
+ });
62722
+ const eventsModule = {
62723
+ EventEmitter: EventEmitterCtor,
62724
+ once: envFn(
62725
+ [prim.unknown, prim.str()],
62726
+ promiseOf(arrOf(prim.unknown))
62727
+ ),
62728
+ on: envFn([prim.unknown, prim.str()], prim.unknown),
62729
+ listenerCount: envFn([prim.unknown, prim.str()], prim.num())
62730
+ };
62731
+ const streamIoMethods = {
62732
+ on: envFn([prim.str(), prim.unknown], prim.unknown),
62733
+ once: envFn([prim.str(), prim.unknown], prim.unknown),
62734
+ off: envFn([prim.str(), prim.unknown], prim.unknown),
62735
+ emit: envFn([prim.str()], prim.bool()),
62736
+ pipe: envFn([prim.unknown], prim.unknown),
62737
+ destroy: envFn([prim.unknown], undef2()),
62738
+ read: envFn([prim.num()], prim.unknown),
62739
+ write: envFn([unionOf(prim.str(), bufferBrand)], prim.bool()),
62740
+ end: envFn([prim.unknown], undef2()),
62741
+ pause: envFn([], prim.unknown),
62742
+ resume: envFn([], prim.unknown),
62743
+ setEncoding: envFn([prim.str()], prim.unknown)
62744
+ };
62745
+ const streamCtor = (brandName) => envFn([prim.unknown], brandOf2(brandName, objAbs(streamIoMethods)), void 0, {
62746
+ params: ["options?"]
62747
+ });
62748
+ const streamModule = {
62749
+ Readable: streamCtor("Readable"),
62750
+ Writable: streamCtor("Writable"),
62751
+ Duplex: streamCtor("Duplex"),
62752
+ Transform: streamCtor("Transform"),
62753
+ pipeline: envFnVariadic(prim.unknown, promiseOf(undef2()), {
62754
+ restName: "...streams"
62755
+ }),
62756
+ finished: envFn([prim.unknown], promiseOf(undef2()))
62757
+ };
62758
+ const parsedQueryString = brandOf2(
62759
+ "ParsedQueryString",
62760
+ objAbs({})
62761
+ );
62762
+ const querystringModule = {
62763
+ // sep/eq/options optional — required arity 1; labels+types render `sep?: string` etc.
62764
+ parse: envFn(
62765
+ [prim.str(), prim.str(), prim.str(), prim.unknown],
62766
+ parsedQueryString,
62767
+ void 0,
62768
+ { params: ["str", "sep?", "eq?", "options?"] }
62769
+ ),
62770
+ stringify: envFn(
62771
+ [prim.unknown, prim.str(), prim.str(), prim.unknown],
62772
+ prim.str(),
62773
+ void 0,
62774
+ { params: ["obj", "sep?", "eq?", "options?"] }
62775
+ ),
62776
+ escape: envFn([prim.str()], prim.str()),
62777
+ unescape: envFn([prim.str()], prim.str())
62778
+ };
62511
62779
  const nodeGlobals = {
62512
62780
  process: objAbs({
62513
62781
  env: objAbs({}),
@@ -62577,15 +62845,8 @@ function defineEnv3() {
62577
62845
  const modules = {
62578
62846
  fs: fsModule,
62579
62847
  "node:fs": fsModule,
62580
- "node:fs/promises": {
62581
- readFile: fsModule.readFile,
62582
- writeFile: fsModule.writeFile,
62583
- mkdir: fsModule.mkdir,
62584
- rm: fsModule.rm,
62585
- stat: fsModule.stat,
62586
- readdir: fsModule.readdir,
62587
- access: fsModule.access
62588
- },
62848
+ "fs/promises": fsPromisesModule,
62849
+ "node:fs/promises": fsPromisesModule,
62589
62850
  path: pathModule,
62590
62851
  "node:path": pathModule,
62591
62852
  os: osModule,
@@ -62597,7 +62858,13 @@ function defineEnv3() {
62597
62858
  child_process: childProcessModule,
62598
62859
  "node:child_process": childProcessModule,
62599
62860
  util: utilModule,
62600
- "node:util": utilModule
62861
+ "node:util": utilModule,
62862
+ events: eventsModule,
62863
+ "node:events": eventsModule,
62864
+ stream: streamModule,
62865
+ "node:stream": streamModule,
62866
+ querystring: querystringModule,
62867
+ "node:querystring": querystringModule
62601
62868
  };
62602
62869
  return {
62603
62870
  globals: { ...esEnv.globals, ...nodeGlobals },
@@ -63541,7 +63808,7 @@ var require_util2 = __commonJS({
63541
63808
  return path;
63542
63809
  }
63543
63810
  exports.normalize = normalize;
63544
- function join9(aRoot, aPath) {
63811
+ function join10(aRoot, aPath) {
63545
63812
  if (aRoot === "") {
63546
63813
  aRoot = ".";
63547
63814
  }
@@ -63573,7 +63840,7 @@ var require_util2 = __commonJS({
63573
63840
  }
63574
63841
  return joined;
63575
63842
  }
63576
- exports.join = join9;
63843
+ exports.join = join10;
63577
63844
  exports.isAbsolute = function(aPath) {
63578
63845
  return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
63579
63846
  };
@@ -63746,7 +64013,7 @@ var require_util2 = __commonJS({
63746
64013
  parsed.path = parsed.path.substring(0, index + 1);
63747
64014
  }
63748
64015
  }
63749
- sourceURL = join9(urlGenerate(parsed), sourceURL);
64016
+ sourceURL = join10(urlGenerate(parsed), sourceURL);
63750
64017
  }
63751
64018
  return normalize(sourceURL);
63752
64019
  }
@@ -74272,7 +74539,7 @@ ${lanes.join("\n")}
74272
74539
  return process.memoryUsage().heapUsed;
74273
74540
  },
74274
74541
  getFileSize(path) {
74275
- const stat = statSync9(path);
74542
+ const stat = statSync10(path);
74276
74543
  if (stat == null ? void 0 : stat.isFile()) {
74277
74544
  return stat.size;
74278
74545
  }
@@ -74316,7 +74583,7 @@ ${lanes.join("\n")}
74316
74583
  }
74317
74584
  };
74318
74585
  return nodeSystem;
74319
- function statSync9(path) {
74586
+ function statSync10(path) {
74320
74587
  try {
74321
74588
  return _fs.statSync(path, statSyncOptions);
74322
74589
  } catch {
@@ -74375,7 +74642,7 @@ ${lanes.join("\n")}
74375
74642
  activeSession.post("Profiler.stop", (err, { profile }) => {
74376
74643
  var _a;
74377
74644
  if (!err) {
74378
- if ((_a = statSync9(profilePath)) == null ? void 0 : _a.isDirectory()) {
74645
+ if ((_a = statSync10(profilePath)) == null ? void 0 : _a.isDirectory()) {
74379
74646
  profilePath = _path.join(profilePath, `${(/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-")}+P${process.pid}.cpuprofile`);
74380
74647
  }
74381
74648
  try {
@@ -74495,7 +74762,7 @@ ${lanes.join("\n")}
74495
74762
  let stat;
74496
74763
  if (typeof dirent === "string" || dirent.isSymbolicLink()) {
74497
74764
  const name = combinePaths(path, entry);
74498
- stat = statSync9(name);
74765
+ stat = statSync10(name);
74499
74766
  if (!stat) {
74500
74767
  continue;
74501
74768
  }
@@ -74519,7 +74786,7 @@ ${lanes.join("\n")}
74519
74786
  return matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames2, process.cwd(), depth, getAccessibleFileSystemEntries, realpath);
74520
74787
  }
74521
74788
  function fileSystemEntryExists(path, entryKind) {
74522
- const stat = statSync9(path);
74789
+ const stat = statSync10(path);
74523
74790
  if (!stat) {
74524
74791
  return false;
74525
74792
  }
@@ -74561,7 +74828,7 @@ ${lanes.join("\n")}
74561
74828
  }
74562
74829
  function getModifiedTime3(path) {
74563
74830
  var _a;
74564
- return (_a = statSync9(path)) == null ? void 0 : _a.mtime;
74831
+ return (_a = statSync10(path)) == null ? void 0 : _a.mtime;
74565
74832
  }
74566
74833
  function setModifiedTime(path, time) {
74567
74834
  try {
@@ -276035,7 +276302,9 @@ function barePackageName(spec) {
276035
276302
  if (spec.startsWith("@")) {
276036
276303
  return parts.length >= 2 ? `${parts[0]}/${parts[1]}` : void 0;
276037
276304
  }
276038
- return parts[0];
276305
+ const name = parts[0];
276306
+ if (NODE_BUILTINS.has(name)) return void 0;
276307
+ return name;
276039
276308
  }
276040
276309
  function collectBarePackages(source) {
276041
276310
  try {
@@ -276086,13 +276355,56 @@ function autoHarvestModules(source, fromDir) {
276086
276355
  }
276087
276356
  return modules;
276088
276357
  }
276089
- var harvestCache;
276358
+ var NODE_BUILTINS, harvestCache;
276090
276359
  var init_harvest_auto = __esm({
276091
276360
  "../service/src/harvest-auto.ts"() {
276092
276361
  "use strict";
276093
276362
  init_src2();
276094
276363
  init_static_imports();
276095
276364
  init_harvest_package();
276365
+ NODE_BUILTINS = /* @__PURE__ */ new Set([
276366
+ "assert",
276367
+ "async_hooks",
276368
+ "buffer",
276369
+ "child_process",
276370
+ "cluster",
276371
+ "console",
276372
+ "constants",
276373
+ "crypto",
276374
+ "dgram",
276375
+ "diagnostics_channel",
276376
+ "dns",
276377
+ "domain",
276378
+ "events",
276379
+ "fs",
276380
+ "http",
276381
+ "http2",
276382
+ "https",
276383
+ "inspector",
276384
+ "module",
276385
+ "net",
276386
+ "os",
276387
+ "path",
276388
+ "perf_hooks",
276389
+ "process",
276390
+ "punycode",
276391
+ "querystring",
276392
+ "readline",
276393
+ "repl",
276394
+ "stream",
276395
+ "string_decoder",
276396
+ "timers",
276397
+ "tls",
276398
+ "trace_events",
276399
+ "tty",
276400
+ "url",
276401
+ "util",
276402
+ "v8",
276403
+ "vm",
276404
+ "wasi",
276405
+ "worker_threads",
276406
+ "zlib"
276407
+ ]);
276096
276408
  harvestCache = /* @__PURE__ */ new Map();
276097
276409
  }
276098
276410
  });
@@ -276826,6 +277138,49 @@ function collectEnvModules(envNames) {
276826
277138
  }
276827
277139
  return out;
276828
277140
  }
277141
+ function setEnvHarvestConflictCollector(collector2) {
277142
+ const prev = envHarvestConflictCollector;
277143
+ envHarvestConflictCollector = collector2;
277144
+ return prev;
277145
+ }
277146
+ function getEnvHarvestConflictCollector() {
277147
+ return envHarvestConflictCollector;
277148
+ }
277149
+ function mergeHarvestUnderEnv(harvestModules, envModules, opts) {
277150
+ const out = {};
277151
+ for (const [mod2, exports] of Object.entries(harvestModules)) {
277152
+ const named = { ...exports.named };
277153
+ out[mod2] = exports.default !== void 0 ? { named, default: exports.default } : { named };
277154
+ }
277155
+ const notify = opts?.onConflict ?? envHarvestConflictCollector;
277156
+ for (const [mod2, envExports] of Object.entries(envModules)) {
277157
+ const existing = out[mod2];
277158
+ if (!existing) {
277159
+ const named2 = { ...envExports.named };
277160
+ out[mod2] = envExports.default !== void 0 ? { named: named2, default: envExports.default } : { named: named2 };
277161
+ continue;
277162
+ }
277163
+ const overwritten = [];
277164
+ for (const key of Object.keys(envExports.named)) {
277165
+ if (existing.named[key] !== void 0) overwritten.push(key);
277166
+ }
277167
+ const defaultOverwritten = envExports.default !== void 0 && existing.default !== void 0;
277168
+ if (notify && (overwritten.length > 0 || defaultOverwritten)) {
277169
+ try {
277170
+ notify({
277171
+ module: mod2,
277172
+ exports: overwritten,
277173
+ defaultOverwritten
277174
+ });
277175
+ } catch {
277176
+ }
277177
+ }
277178
+ const named = { ...existing.named, ...envExports.named };
277179
+ const defaultAbs = envExports.default !== void 0 ? envExports.default : existing.default;
277180
+ out[mod2] = defaultAbs !== void 0 ? { named, default: defaultAbs } : { named };
277181
+ }
277182
+ return out;
277183
+ }
276829
277184
  function collectBPathReplacements(source) {
276830
277185
  const targets = [];
276831
277186
  const values = {};
@@ -276938,7 +277293,7 @@ function tryRunBPath(source, filePath, opts = {}) {
276938
277293
  try {
276939
277294
  const { modules: graphMods, issues } = evalAbsModuleGraph(source, filePath);
276940
277295
  const envMods = collectEnvModules(opts.envNames ?? []);
276941
- const modules = { ...envMods, ...graphMods };
277296
+ const modules = mergeHarvestUnderEnv(graphMods, envMods);
276942
277297
  const { targets, values, asTargets, asValues } = collectBPathReplacements(source);
276943
277298
  const envGlobals = {
276944
277299
  ...collectEnvGlobals(opts.envNames ?? []),
@@ -277013,7 +277368,7 @@ function tryBPathCall(source, filePath, fnName, args, opts = {}) {
277013
277368
  if (r.shape.k === "unknown" && !r.term) return void 0;
277014
277369
  return r;
277015
277370
  }
277016
- var bRunByFile, MAX_B_RUN_CACHE;
277371
+ var envHarvestConflictCollector, bRunByFile, MAX_B_RUN_CACHE;
277017
277372
  var init_bpath_run = __esm({
277018
277373
  "../service/src/bpath-run.ts"() {
277019
277374
  "use strict";
@@ -277024,6 +277379,7 @@ var init_bpath_run = __esm({
277024
277379
  init_analysis_file_cache();
277025
277380
  init_fn_analysis_cache();
277026
277381
  init_load_module();
277382
+ envHarvestConflictCollector = null;
277027
277383
  bRunByFile = /* @__PURE__ */ new Map();
277028
277384
  MAX_B_RUN_CACHE = 32;
277029
277385
  }
@@ -277879,6 +278235,24 @@ function analyzeFileUncached(filePath, source, activeCases, externalCallRecords,
277879
278235
  () => analyzeFileUncachedInner(filePath, source, activeCases, externalCallRecords, loadModule)
277880
278236
  );
277881
278237
  }
278238
+ function findModuleImportLoc(source, module) {
278239
+ const bare = module.startsWith("node:") ? module.slice("node:".length) : module;
278240
+ const alts = [.../* @__PURE__ */ new Set([module, bare, `node:${bare}`])];
278241
+ const lines = source.split(/\r?\n/);
278242
+ for (let i = 0; i < lines.length; i++) {
278243
+ const line = lines[i];
278244
+ for (const alt of alts) {
278245
+ const re = new RegExp(
278246
+ `["'\`]${alt.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}["'\`]`
278247
+ );
278248
+ const m = re.exec(line);
278249
+ if (m && m.index !== void 0) {
278250
+ return { line: i, column: m.index, length: m[0].length };
278251
+ }
278252
+ }
278253
+ }
278254
+ return null;
278255
+ }
277882
278256
  function analyzeFileUncachedInner(filePath, source, activeCases, externalCallRecords, loadModule) {
277883
278257
  const ast = parse(source);
277884
278258
  const functions = extractDirectives(ast);
@@ -277887,6 +278261,18 @@ function analyzeFileUncachedInner(filePath, source, activeCases, externalCallRec
277887
278261
  const nodeAbsMap = /* @__PURE__ */ new Map();
277888
278262
  const functionResults = [];
277889
278263
  const caseHints = [];
278264
+ const envHarvestConflicts = [];
278265
+ const prevHarvestConflictCollector = setEnvHarvestConflictCollector((c) => {
278266
+ if (!envHarvestConflicts.some((x) => x.module === c.module)) {
278267
+ envHarvestConflicts.push(c);
278268
+ } else {
278269
+ const prev = envHarvestConflicts.find((x) => x.module === c.module);
278270
+ for (const e of c.exports) {
278271
+ if (!prev.exports.includes(e)) prev.exports.push(e);
278272
+ }
278273
+ prev.defaultOverwritten ||= c.defaultOverwritten;
278274
+ }
278275
+ });
277890
278276
  const fileDirectives = extractFileDirectives(ast);
277891
278277
  const fileEnvNames = fileDirectives.filter((d) => d.kind === "env").flatMap((d) => d.envs);
277892
278278
  const projectConfig = findProjectConfig(dirname9(filePath));
@@ -277976,7 +278362,7 @@ function analyzeFileUncachedInner(filePath, source, activeCases, externalCallRec
277976
278362
  seedFns: seeds.seedFns,
277977
278363
  ...loadModule ? { loadModule } : {}
277978
278364
  });
277979
- absGraphModules = { ...collectEnvModules(envNames), ...g.modules };
278365
+ absGraphModules = mergeHarvestUnderEnv(g.modules, collectEnvModules(envNames));
277980
278366
  pushBModuleIssues(g.issues);
277981
278367
  } catch {
277982
278368
  }
@@ -278582,6 +278968,24 @@ function analyzeFileUncachedInner(filePath, source, activeCases, externalCallRec
278582
278968
  filePath,
278583
278969
  analysisConfig(projectConfig?.config).callSiteBudget
278584
278970
  );
278971
+ setEnvHarvestConflictCollector(prevHarvestConflictCollector);
278972
+ for (const c of envHarvestConflicts) {
278973
+ const parts = [];
278974
+ if (c.exports.length > 0) parts.push(`export(s) ${c.exports.join(", ")}`);
278975
+ if (c.defaultOverwritten) parts.push("default");
278976
+ const detail = parts.length > 0 ? ` \u2014 ${parts.join("; ")}` : "";
278977
+ const loc = findModuleImportLoc(source, c.module);
278978
+ const range = loc ? {
278979
+ start: { line: loc.line, column: loc.column },
278980
+ end: { line: loc.line, column: loc.column + loc.length }
278981
+ } : { start: { line: 0, column: 0 }, end: { line: 0, column: 0 } };
278982
+ diagnostics.push({
278983
+ range,
278984
+ severity: "warning",
278985
+ message: `handwritten @nudo:env wins over harvest on module "${c.module}"${detail}; harvest only fills missing slots (B8). code=nudo:env-harvest-conflict`,
278986
+ code: "nudo:env-harvest-conflict"
278987
+ });
278988
+ }
278585
278989
  return {
278586
278990
  functions: functionResults,
278587
278991
  diagnostics,
@@ -278694,7 +279098,7 @@ function collectAbsCallRecords(source, seeds, filePath, precomputedModules, envN
278694
279098
  }
278695
279099
  }
278696
279100
  if (envNames.length > 0) {
278697
- modules = { ...collectEnvModules(envNames), ...modules ?? {} };
279101
+ modules = mergeHarvestUnderEnv(modules ?? {}, collectEnvModules(envNames));
278698
279102
  }
278699
279103
  try {
278700
279104
  importLocals = buildAbsImportLocalMap(source, filePath);
@@ -279897,18 +280301,93 @@ var init_dep_contents = __esm({
279897
280301
  });
279898
280302
 
279899
280303
  // ../service/src/harvest-node.ts
279900
- import { existsSync as existsSync11 } from "fs";
279901
- function harvestNodeTypes(fromDir, maxFiles = 12, maxMs = 2500) {
280304
+ import { existsSync as existsSync11, statSync as statSync8 } from "fs";
280305
+ import { join as join7 } from "path";
280306
+ function notFoundCacheKey(fromDir) {
280307
+ return `not-found|@types/node|${fromDir ?? ""}`;
280308
+ }
280309
+ function nodeHarvestCacheKey(root, maxFiles, maxMs) {
280310
+ let sig2 = "nostat";
280311
+ try {
280312
+ const st = statSync8(join7(root, "package.json"));
280313
+ sig2 = `${st.size}:${Math.floor(st.mtimeMs)}`;
280314
+ } catch {
280315
+ }
280316
+ return `${root}|${maxFiles}|${maxMs}|${sig2}`;
280317
+ }
280318
+ function clearNodeHarvestCache() {
280319
+ nodeHarvestCache.clear();
280320
+ }
280321
+ function getNodeHarvestCacheSize() {
280322
+ return nodeHarvestCache.size;
280323
+ }
280324
+ function isHarvestNodeDisabled(env = process.env) {
280325
+ return env.NUDO_HARVEST_NODE === "off";
280326
+ }
280327
+ function harvestNodeTypes(fromDir, maxFiles = HARVEST_NODE_DEFAULT_MAX_FILES, maxMs = HARVEST_NODE_DEFAULT_MAX_MS) {
280328
+ if (isHarvestNodeDisabled()) {
280329
+ return {
280330
+ ok: false,
280331
+ error: "harvest disabled via NUDO_HARVEST_NODE=off",
280332
+ reason: "disabled"
280333
+ };
280334
+ }
279902
280335
  const root = resolvePackageRoot("@types/node", fromDir) ?? resolvePackageRoot("node", fromDir);
279903
280336
  if (!root || !existsSync11(root)) {
279904
- return { ok: false, error: "@types/node not found" };
280337
+ const missKey = notFoundCacheKey(fromDir);
280338
+ const miss = nodeHarvestCache.get(missKey);
280339
+ if (miss && !miss.ok && miss.reason === "not-found") {
280340
+ return { ...miss, cached: true };
280341
+ }
280342
+ const result = {
280343
+ ok: false,
280344
+ error: "@types/node not found",
280345
+ reason: "not-found"
280346
+ };
280347
+ nodeHarvestCache.set(missKey, result);
280348
+ return result;
280349
+ }
280350
+ const key = nodeHarvestCacheKey(root, maxFiles, maxMs);
280351
+ const hit = nodeHarvestCache.get(key);
280352
+ if (hit) {
280353
+ return hit.ok ? { ...hit, cached: true } : { ...hit, cached: true };
279905
280354
  }
279906
280355
  const dts = collectDtsFiles(root, maxFiles);
279907
280356
  if (dts.length === 0) {
279908
- return { ok: false, error: `no .d.ts under ${root}` };
280357
+ const result = {
280358
+ ok: false,
280359
+ error: `no .d.ts under ${root}`,
280360
+ reason: "no-dts"
280361
+ };
280362
+ nodeHarvestCache.set(key, result);
280363
+ return result;
280364
+ }
280365
+ try {
280366
+ const env = harvestDts(dts, { maxMs });
280367
+ const stats = {
280368
+ files: env.stats.files,
280369
+ symbols: env.stats.symbols,
280370
+ skipped: env.stats.skipped
280371
+ };
280372
+ const result = {
280373
+ ok: true,
280374
+ env,
280375
+ root,
280376
+ files: stats.files,
280377
+ stats,
280378
+ cached: false
280379
+ };
280380
+ nodeHarvestCache.set(key, result);
280381
+ return result;
280382
+ } catch (e) {
280383
+ const result = {
280384
+ ok: false,
280385
+ error: `harvest failed: ${e.message}`,
280386
+ reason: "failed"
280387
+ };
280388
+ nodeHarvestCache.set(key, result);
280389
+ return result;
279909
280390
  }
279910
- const env = harvestDts(dts, { maxMs });
279911
- return { ok: true, env, root, files: env.stats.files };
279912
280391
  }
279913
280392
  function summarizeNodeEnv(env) {
279914
280393
  return {
@@ -279917,11 +280396,15 @@ function summarizeNodeEnv(env) {
279917
280396
  symbolCount: env.stats.symbols
279918
280397
  };
279919
280398
  }
280399
+ var HARVEST_NODE_DEFAULT_MAX_FILES, HARVEST_NODE_DEFAULT_MAX_MS, nodeHarvestCache;
279920
280400
  var init_harvest_node = __esm({
279921
280401
  "../service/src/harvest-node.ts"() {
279922
280402
  "use strict";
279923
280403
  init_src3();
279924
280404
  init_harvest_package();
280405
+ HARVEST_NODE_DEFAULT_MAX_FILES = 12;
280406
+ HARVEST_NODE_DEFAULT_MAX_MS = 2500;
280407
+ nodeHarvestCache = /* @__PURE__ */ new Map();
279925
280408
  }
279926
280409
  });
279927
280410
 
@@ -281542,7 +282025,7 @@ var init_interface_emitter = __esm({
281542
282025
 
281543
282026
  // ../service/src/interface-draft.ts
281544
282027
  import { existsSync as existsSync14, readFileSync as readFileSync13, writeFileSync as writeFileSync4, realpathSync as realpathSync2 } from "fs";
281545
- import { basename as basename3, dirname as dirname15, isAbsolute as isAbsolute2, join as join7, relative as relative4 } from "path";
282028
+ import { basename as basename3, dirname as dirname15, isAbsolute as isAbsolute2, join as join8, relative as relative4 } from "path";
281546
282029
  function collectParamBodyAccesses(source) {
281547
282030
  const out = /* @__PURE__ */ new Map();
281548
282031
  let ast;
@@ -282059,7 +282542,7 @@ function safeRealpath(p) {
282059
282542
  return realpathSync2(p);
282060
282543
  } catch {
282061
282544
  try {
282062
- return join7(realpathSync2(dirname15(p)), basename3(p));
282545
+ return join8(realpathSync2(dirname15(p)), basename3(p));
282063
282546
  } catch {
282064
282547
  return p;
282065
282548
  }
@@ -283068,6 +283551,8 @@ __export(src_exports2, {
283068
283551
  ANALYSIS_ABI: () => ANALYSIS_ABI,
283069
283552
  DEFAULT_ANALYSIS_MODE: () => DEFAULT_ANALYSIS_MODE,
283070
283553
  DiskCache: () => DiskCache,
283554
+ HARVEST_NODE_DEFAULT_MAX_FILES: () => HARVEST_NODE_DEFAULT_MAX_FILES,
283555
+ HARVEST_NODE_DEFAULT_MAX_MS: () => HARVEST_NODE_DEFAULT_MAX_MS,
283071
283556
  SEMANTIC_TOKEN_MODIFIERS: () => SEMANTIC_TOKEN_MODIFIERS,
283072
283557
  SEMANTIC_TOKEN_TYPES: () => SEMANTIC_TOKEN_TYPES,
283073
283558
  absToTSType: () => absToTSType,
@@ -283092,6 +283577,7 @@ __export(src_exports2, {
283092
283577
  clearEnvPathDeps: () => clearEnvPathDeps,
283093
283578
  clearFnAnalysisCache: () => clearFnAnalysisCache,
283094
283579
  clearHarvestCache: () => clearHarvestCache,
283580
+ clearNodeHarvestCache: () => clearNodeHarvestCache,
283095
283581
  clearPathEnvCaches: () => clearPathEnvCaches,
283096
283582
  collectAbsBindingsFromGraph: () => collectAbsBindingsFromGraph,
283097
283583
  collectAbsInlays: () => collectAbsInlays,
@@ -283144,7 +283630,9 @@ __export(src_exports2, {
283144
283630
  getAnalysisSession: () => getAnalysisSession,
283145
283631
  getCasesForFile: () => getCasesForFile,
283146
283632
  getCompletionsAtPosition: () => getCompletionsAtPosition,
283633
+ getEnvHarvestConflictCollector: () => getEnvHarvestConflictCollector,
283147
283634
  getHoverAtPosition: () => getHoverAtPosition,
283635
+ getNodeHarvestCacheSize: () => getNodeHarvestCacheSize,
283148
283636
  getTypeAtPosition: () => getTypeAtPosition,
283149
283637
  getTypeAtPositionAsync: () => getTypeAtPositionAsync,
283150
283638
  harvestNodeTypes: () => harvestNodeTypes,
@@ -283160,12 +283648,14 @@ __export(src_exports2, {
283160
283648
  isBPathCapable: () => isBPathCapable,
283161
283649
  isDraftableEntry: () => isDraftableEntry,
283162
283650
  isEnvTemplatePath: () => isEnvTemplatePath,
283651
+ isHarvestNodeDisabled: () => isHarvestNodeDisabled,
283163
283652
  isNudoTargetPath: () => isNudoTargetPath,
283164
283653
  isProjectConfigPath: () => isProjectConfigPath,
283165
283654
  isSidecarPath: () => isSidecarPath,
283166
283655
  isWatchRelevantPath: () => isWatchRelevantPath,
283167
283656
  lookupHarvested: () => lookupHarvested,
283168
283657
  matchesEmitAllowlist: () => matchesEmitAllowlist,
283658
+ mergeHarvestUnderEnv: () => mergeHarvestUnderEnv,
283169
283659
  mockDirectivesToAbsSeeds: () => mockDirectivesToAbsSeeds,
283170
283660
  noteEnvPathDeps: () => noteEnvPathDeps,
283171
283661
  packageHarvestToAbsModules: () => packageHarvestToAbsModules,
@@ -283175,6 +283665,7 @@ __export(src_exports2, {
283175
283665
  serializeCaseArg: () => serializeCaseArg,
283176
283666
  serializeInferJson: () => serializeInferJson,
283177
283667
  setAnalysisSession: () => setAnalysisSession,
283668
+ setEnvHarvestConflictCollector: () => setEnvHarvestConflictCollector,
283178
283669
  sha256Hex: () => sha256Hex,
283179
283670
  shouldAnalyzeFile: () => shouldAnalyzeFile,
283180
283671
  sidecarDraftPath: () => sidecarDraftPath,
@@ -283235,8 +283726,8 @@ var init_src4 = __esm({
283235
283726
  init_src();
283236
283727
  init_src4();
283237
283728
  init_src3();
283238
- import { readFileSync as readFileSync15, existsSync as existsSync16, watch, readdirSync as readdirSync2, statSync as statSync8, writeFileSync as writeFileSync6, mkdirSync as mkdirSync3, realpathSync as realpathSync3 } from "fs";
283239
- import { resolve as resolve12, dirname as dirname17, relative as relative6, join as join8, basename as basename5, isAbsolute as isAbsolute3 } from "path";
283729
+ import { readFileSync as readFileSync15, existsSync as existsSync16, watch, readdirSync as readdirSync2, statSync as statSync9, writeFileSync as writeFileSync6, mkdirSync as mkdirSync3, realpathSync as realpathSync3 } from "fs";
283730
+ import { resolve as resolve12, dirname as dirname17, relative as relative6, join as join9, basename as basename5, isAbsolute as isAbsolute3 } from "path";
283240
283731
  import { fileURLToPath } from "url";
283241
283732
  import { Command } from "commander";
283242
283733
 
@@ -283310,7 +283801,7 @@ function formatTestReport(r) {
283310
283801
  // src/index.ts
283311
283802
  var program = new Command();
283312
283803
  function readPackageVersion() {
283313
- const pkgPath = join8(dirname17(fileURLToPath(import.meta.url)), "..", "package.json");
283804
+ const pkgPath = join9(dirname17(fileURLToPath(import.meta.url)), "..", "package.json");
283314
283805
  const pkg = JSON.parse(readFileSync15(pkgPath, "utf-8"));
283315
283806
  return pkg.version ?? "0.0.0";
283316
283807
  }
@@ -283330,7 +283821,7 @@ function collectExternalRecords(sites) {
283330
283821
  process.exitCode = 1;
283331
283822
  continue;
283332
283823
  }
283333
- const siteFiles = statSync8(sitePath).isDirectory() ? collectNudoFiles(sitePath) : [sitePath];
283824
+ const siteFiles = statSync9(sitePath).isDirectory() ? collectNudoFiles(sitePath) : [sitePath];
283334
283825
  for (const sf of siteFiles) {
283335
283826
  records.push(...collectCallRecords(sf, readFileSync15(sf, "utf-8")));
283336
283827
  }
@@ -283509,7 +284000,7 @@ program.command("infer").description("Infer types from a JS/TS file (or a direct
283509
284000
  externalRecords = collectExternalRecords(opts.callsites);
283510
284001
  }
283511
284002
  const target = resolve12(file);
283512
- if (existsSync16(target) && statSync8(target).isDirectory()) {
284003
+ if (existsSync16(target) && statSync9(target).isDirectory()) {
283513
284004
  const files = collectNudoFiles(target);
283514
284005
  if (files.length === 0) {
283515
284006
  console.log("No nudo files found in directory.");
@@ -283673,7 +284164,7 @@ function resolveTargets(path) {
283673
284164
  process.exitCode = 1;
283674
284165
  return [];
283675
284166
  }
283676
- if (statSync8(resolved).isDirectory()) {
284167
+ if (statSync9(resolved).isDirectory()) {
283677
284168
  const files = collectNudoFiles(resolved);
283678
284169
  if (files.length === 0) {
283679
284170
  console.error(`No nudo files found in directory: ${resolved}`);
@@ -283793,7 +284284,7 @@ async function runInterfaceDraft(file, opts) {
283793
284284
  let dir = dirname17(filePath);
283794
284285
  const fsRoot = resolve12("/");
283795
284286
  while (dir !== fsRoot) {
283796
- if (existsSync16(join8(dir, "package.json"))) {
284287
+ if (existsSync16(join9(dir, "package.json"))) {
283797
284288
  projectRoot = dir;
283798
284289
  break;
283799
284290
  }
@@ -284115,7 +284606,7 @@ async function runDoctor(paths, opts) {
284115
284606
  reports.push({ file: displayPath(abs2), functions: 0, entryOnly: 0, uncovered: [], error: `File not found: ${abs2}` });
284116
284607
  continue;
284117
284608
  }
284118
- files.push(...statSync8(abs2).isDirectory() ? collectNudoFiles(abs2) : [abs2]);
284609
+ files.push(...statSync9(abs2).isDirectory() ? collectNudoFiles(abs2) : [abs2]);
284119
284610
  }
284120
284611
  for (const filePath of files) {
284121
284612
  reports.push(await doctorFile(filePath, externalRecords));
@@ -284195,7 +284686,7 @@ program.command("doctor").description(
284195
284686
  });
284196
284687
  program.command("watch").description("Watch file(s) for changes and re-run inference").argument("<path>", "File or directory to watch").option("--dts", "Generate .d.ts files on each change").action((watchPath, opts) => {
284197
284688
  const resolved = resolve12(watchPath);
284198
- const isDir = existsSync16(resolved) && statSync8(resolved).isDirectory();
284689
+ const isDir = existsSync16(resolved) && statSync9(resolved).isDirectory();
284199
284690
  const getFiles = () => {
284200
284691
  if (!isDir) return [resolved];
284201
284692
  return collectNudoFiles(resolved);
@@ -284278,7 +284769,7 @@ program.command("watch").description("Watch file(s) for changes and re-run infer
284278
284769
  const pendingChanged = /* @__PURE__ */ new Set();
284279
284770
  watch(watchTarget, { recursive: isDir }, (_event, filename) => {
284280
284771
  if (!filename) return;
284281
- const fullPath = isDir ? join8(watchTarget, filename) : resolved;
284772
+ const fullPath = isDir ? join9(watchTarget, filename) : resolved;
284282
284773
  if (!isWatchRelevantPath(fullPath)) return;
284283
284774
  if (!existsSync16(fullPath)) {
284284
284775
  pendingChanged.add(fullPath);
@@ -284305,7 +284796,7 @@ program.command("watch").description("Watch file(s) for changes and re-run infer
284305
284796
  function collectNudoFiles(dir) {
284306
284797
  const results = [];
284307
284798
  for (const entry of readdirSync2(dir, { withFileTypes: true })) {
284308
- const fullPath = join8(dir, entry.name);
284799
+ const fullPath = join9(dir, entry.name);
284309
284800
  if (entry.isDirectory() && entry.name !== "node_modules") {
284310
284801
  results.push(...collectNudoFiles(fullPath));
284311
284802
  } else if (entry.isFile() && isNudoTargetPath(fullPath)) {
@@ -284362,17 +284853,17 @@ async function runGenerate(file, format, output) {
284362
284853
  mkdirSync3(outDir, { recursive: true });
284363
284854
  const written = [];
284364
284855
  if (zodChunks.length > 0) {
284365
- const p = join8(outDir, `${stem}.nudo.zod.ts`);
284856
+ const p = join9(outDir, `${stem}.nudo.zod.ts`);
284366
284857
  writeFileSync6(p, zodChunks.join("\n") + "\n", "utf-8");
284367
284858
  written.push(p);
284368
284859
  }
284369
284860
  if (guardChunks.length > 0) {
284370
- const p = join8(outDir, `${stem}.nudo.guard.ts`);
284861
+ const p = join9(outDir, `${stem}.nudo.guard.ts`);
284371
284862
  writeFileSync6(p, guardChunks.join("\n") + "\n", "utf-8");
284372
284863
  written.push(p);
284373
284864
  }
284374
284865
  if (dtsChunks.length > 0) {
284375
- const p = join8(outDir, `${stem}.d.ts`);
284866
+ const p = join9(outDir, `${stem}.d.ts`);
284376
284867
  writeFileSync6(p, dtsChunks.join("\n") + "\n", "utf-8");
284377
284868
  written.push(p);
284378
284869
  }
@@ -284409,8 +284900,8 @@ function runHarvest(pkg, outOpt) {
284409
284900
  process.exitCode = 1;
284410
284901
  return;
284411
284902
  }
284412
- let entry = join8(typesDir, "index.d.ts");
284413
- const pkgJsonPath = join8(typesDir, "package.json");
284903
+ let entry = join9(typesDir, "index.d.ts");
284904
+ const pkgJsonPath = join9(typesDir, "package.json");
284414
284905
  if (existsSync16(pkgJsonPath)) {
284415
284906
  try {
284416
284907
  const pkgJson = JSON.parse(readFileSync15(pkgJsonPath, "utf-8"));
@@ -284450,7 +284941,7 @@ Usage \u2014 add this directive at the top of your JS file:`);
284450
284941
  program.command("harvest").description("Convert @types/<pkg> .d.ts declarations into a Nudo env file (TS source using T.* constructors)").argument("[pkg]", "Package name under @types (e.g. node)").option("--out <file>", "Output .ts env file (default: ./nudo-harvest-<pkg>.ts)").option("--auto [dir]", "Scan directory (default .) for bare imports and report auto-harvestable @types packages").action(async (pkg, opts) => {
284451
284942
  if (opts.auto !== void 0) {
284452
284943
  const dir = resolve12(typeof opts.auto === "string" ? opts.auto : ".");
284453
- const files = existsSync16(dir) && statSync8(dir).isDirectory() ? collectNudoFiles(dir) : existsSync16(dir) ? [dir] : [];
284944
+ const files = existsSync16(dir) && statSync9(dir).isDirectory() ? collectNudoFiles(dir) : existsSync16(dir) ? [dir] : [];
284454
284945
  if (files.length === 0) {
284455
284946
  console.error(`No inference targets under ${dir}`);
284456
284947
  process.exitCode = 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nudojs/cli",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "engines": {
5
5
  "node": ">=20"
6
6
  },
@@ -43,11 +43,11 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "commander": "^13.0.0",
46
- "@nudojs/core": "2.0.0",
47
- "@nudojs/parser": "0.5.0",
48
- "@nudojs/service": "2.0.0",
49
- "@nudojs/env": "0.3.0",
50
- "@nudojs/harvester": "0.2.5"
46
+ "@nudojs/parser": "0.5.1",
47
+ "@nudojs/core": "2.0.1",
48
+ "@nudojs/service": "3.0.0",
49
+ "@nudojs/env": "0.4.0",
50
+ "@nudojs/harvester": "0.2.6"
51
51
  },
52
52
  "scripts": {
53
53
  "build": "tsup"