vlt 1.6.1 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/{access-YSLEWR2C.js → access-LNHKSCBO.js} +5 -5
  2. package/{bugs-S6CRUEA2.js → bugs-PSOZGCKG.js} +15 -14
  3. package/{build-SG3KPX3W.js → build-GBIF54BN.js} +11 -11
  4. package/{cache-HA77ROM7.js → cache-XOYAGCIO.js} +10 -8
  5. package/cache-unzip-src-unzip.js +190 -3
  6. package/chunk-24DWRCPS.js +79 -0
  7. package/chunk-2CFNQ4QB.js +77 -0
  8. package/{chunk-AEVT3CHK.js → chunk-3RYVF2GG.js} +2 -2
  9. package/{chunk-IHERL3TA.js → chunk-3UDBYFAH.js} +95 -8
  10. package/{chunk-ZJE3OTP3.js → chunk-6BD4RCTR.js} +40 -13
  11. package/{chunk-Y5PA7DVK.js → chunk-6ETYWCJN.js} +197 -1
  12. package/{chunk-KURQHX54.js → chunk-6ISFYONV.js} +2 -2
  13. package/{chunk-VGPLFOJO.js → chunk-AQJR7QDA.js} +1 -1
  14. package/{chunk-JZXNHIQE.js → chunk-BGOXKLQ6.js} +1 -1
  15. package/{chunk-MSWOR3FV.js → chunk-C75GDQFE.js} +9 -2
  16. package/{chunk-WMMKUVAT.js → chunk-FRX5IFFY.js} +4 -4
  17. package/{chunk-EMTGRCSE.js → chunk-GJMDZJPJ.js} +1 -1
  18. package/{chunk-M242QVJS.js → chunk-HHSPE2DS.js} +1 -1
  19. package/{chunk-AHLBPSGQ.js → chunk-JASG7RHB.js} +2 -2
  20. package/{chunk-W24SBFY5.js → chunk-JNPVOACH.js} +4 -4
  21. package/{chunk-OWL5G4K4.js → chunk-JYYIWXJX.js} +1 -1
  22. package/{chunk-5Q2HSLVV.js → chunk-L65CG5LE.js} +1 -1
  23. package/{chunk-PDWPFR5T.js → chunk-LEMHGORE.js} +1 -1
  24. package/{chunk-JV5XR5JQ.js → chunk-MCQTGFJY.js} +1 -1
  25. package/{chunk-O6MQ7NN6.js → chunk-N4SU52H5.js} +1 -1
  26. package/{chunk-Q2UEILN6.js → chunk-NB7QVWHU.js} +84 -16
  27. package/{chunk-N6HV7JWC.js → chunk-QFPAFVRR.js} +39 -67
  28. package/{chunk-DXED4ARV.js → chunk-QGLGNPCQ.js} +2 -2
  29. package/{chunk-3E3ISOYM.js → chunk-QGUQZURY.js} +2 -2
  30. package/{chunk-L3ZF7OYM.js → chunk-TGPL6YRK.js} +2 -2
  31. package/{chunk-C4RJ4NNS.js → chunk-TQBSL35R.js} +5 -5
  32. package/{chunk-6XVW7CWJ.js → chunk-XWA55GAN.js} +3 -3
  33. package/{chunk-BQMHDAYL.js → chunk-XWVEIWTT.js} +1 -1
  34. package/{chunk-4UAIPIAV.js → chunk-Y53EROVE.js} +5 -5
  35. package/{chunk-NO53Y3QO.js → chunk-Z63CXYQF.js} +1 -1
  36. package/{chunk-B6RIGNEO.js → chunk-ZESNN24A.js} +11 -1
  37. package/{ci-GVLL72SS.js → ci-XSH7DZGD.js} +13 -13
  38. package/cli-package.json +1 -1
  39. package/{config-KH6AEMHI.js → config-6XFBWC3U.js} +7 -6
  40. package/{config-TIPKOPYS.js → config-C73FLGQV.js} +7 -6
  41. package/{create-SKNEZEZY.js → create-UNCQKKBS.js} +16 -15
  42. package/{deprecate-RFRLJZVL.js → deprecate-HCVFAVZD.js} +9 -8
  43. package/{dist-tag-LVYOTJHJ.js → dist-tag-WXLJRWFJ.js} +5 -5
  44. package/{docs-INXRFEGY.js → docs-5EFY7ZHN.js} +15 -14
  45. package/{exec-5MA5XRPZ.js → exec-EC5D5GE3.js} +16 -15
  46. package/{exec-cache-7GS4KLWJ.js → exec-cache-EMUFVFCJ.js} +14 -13
  47. package/{exec-local-RE4KVTMN.js → exec-local-L5H4M37T.js} +13 -13
  48. package/{help-JHLP565L.js → help-FUHVZ6UH.js} +1 -1
  49. package/{init-4UFHO67B.js → init-63M6W7N4.js} +11 -11
  50. package/{install-Z33YVCDK.js → install-IHQRULIE.js} +20 -19
  51. package/{list-XAMKR6TL.js → list-EDXNWJJR.js} +16 -16
  52. package/{login-6NXUO5FF.js → login-OD7E5AO5.js} +10 -9
  53. package/{logout-6P7LWTAY.js → logout-V2WJTQV2.js} +5 -5
  54. package/{outdated-YNUSWZJD.js → outdated-7N7NGSSR.js} +15 -14
  55. package/{pack-LMQYH75V.js → pack-TKJW7AEB.js} +12 -12
  56. package/package.json +1 -1
  57. package/{ping-VLFZ3WCY.js → ping-PVWRNSCX.js} +5 -5
  58. package/{pkg-JMPBHKSW.js → pkg-PDP4XR5S.js} +12 -12
  59. package/{profile-PJJAA2YM.js → profile-BP5EALWS.js} +5 -5
  60. package/{publish-33RFJ2HJ.js → publish-HCICK5LY.js} +14 -14
  61. package/{query-LUUOK57K.js → query-TZ3BPC4B.js} +16 -16
  62. package/registry-client-src-revalidate.js +304 -44
  63. package/{repo-VLHLQP2S.js → repo-BYOSXG5J.js} +15 -14
  64. package/{reporter-SNSM2TDC.js → reporter-S6DDAHQL.js} +12 -11
  65. package/{run-USWK7R3N.js → run-JAVVTY7B.js} +13 -13
  66. package/{run-exec-PHE44AWW.js → run-exec-GGENQDEW.js} +13 -13
  67. package/security-archive-src-update-expired.js +1 -1
  68. package/{setup-JMY47ERY.js → setup-I6GLYILV.js} +13 -12
  69. package/{skills-YMMV6TMN.js → skills-5V6HKMA7.js} +14 -13
  70. package/{skills-7PYMTDER.js → skills-QOFA6XMM.js} +6 -6
  71. package/{src-2ZS4VHJP.js → src-74IKO7PC.js} +12 -8
  72. package/src-GY57R4DK.js +659 -0
  73. package/{src-A5ZJNOHN.js → src-REZNPR2X.js} +5 -5
  74. package/tar-src-placement-worker.js +6426 -0
  75. package/{token-YKHELNVQ.js → token-JEAMCRK6.js} +5 -5
  76. package/{uninstall-Q46HWR5S.js → uninstall-WA4FJFVA.js} +14 -14
  77. package/{unpublish-LBANPSJ5.js → unpublish-SG3J524L.js} +5 -5
  78. package/{update-B2EGLZHI.js → update-Y3KY2DZD.js} +15 -14
  79. package/{version-IEOBL3NN.js → version-QBEPMA7Q.js} +11 -11
  80. package/{view-JCA5VT6F.js → view-FYRF3SLJ.js} +8 -7
  81. package/vlr.js +1 -1
  82. package/vlrx.js +1 -1
  83. package/vlt.js +1 -1
  84. package/vlx.js +1 -1
  85. package/vlxl.js +1 -1
  86. package/{whoami-OWJUPO3X.js → whoami-XSQ6SOIC.js} +5 -5
  87. package/chunk-N3V6EK5I.js +0 -77
  88. package/src-W2VQULRG.js +0 -285
@@ -17,11 +17,11 @@ import {
17
17
  pickManifest,
18
18
  resolve,
19
19
  revs
20
- } from "./chunk-EMTGRCSE.js";
20
+ } from "./chunk-GJMDZJPJ.js";
21
21
  import {
22
22
  Monorepo,
23
23
  PackageJson
24
- } from "./chunk-KURQHX54.js";
24
+ } from "./chunk-6ISFYONV.js";
25
25
  import {
26
26
  Spec
27
27
  } from "./chunk-6D3QAFNZ.js";
@@ -32,10 +32,16 @@ import {
32
32
  } from "./chunk-4GMNWW4C.js";
33
33
  import {
34
34
  logRequest
35
- } from "./chunk-B6RIGNEO.js";
35
+ } from "./chunk-ZESNN24A.js";
36
36
  import {
37
37
  XDG
38
38
  } from "./chunk-XNLSTHDK.js";
39
+ import {
40
+ storeIndexPath
41
+ } from "./chunk-24DWRCPS.js";
42
+ import {
43
+ span
44
+ } from "./chunk-6ETYWCJN.js";
39
45
  import {
40
46
  asPackument,
41
47
  brotliTarballUrl,
@@ -107,6 +113,7 @@ var parseRecord = (l) => {
107
113
 
108
114
  // ../../src/package-info/src/index.ts
109
115
  import { createHash, randomBytes } from "node:crypto";
116
+ import { lstatSync } from "node:fs";
110
117
  import {
111
118
  mkdir,
112
119
  readFile,
@@ -338,7 +345,7 @@ var PackageInfoClient = class {
338
345
  }
339
346
  async getRegistryClient() {
340
347
  if (this.#registryClient) return this.#registryClient;
341
- this.#registryClientPromise ??= import("./src-A5ZJNOHN.js").then(({ RegistryClient }) => {
348
+ this.#registryClientPromise ??= import("./src-REZNPR2X.js").then(({ RegistryClient }) => {
342
349
  this.#registryClient = new RegistryClient(this.options);
343
350
  return this.#registryClient;
344
351
  });
@@ -377,7 +384,7 @@ var PackageInfoClient = class {
377
384
  }
378
385
  async getTarPool() {
379
386
  if (this.#tarPool) return this.#tarPool;
380
- this.#tarPoolPromise ??= import("./src-W2VQULRG.js").then(
387
+ this.#tarPoolPromise ??= import("./src-GY57R4DK.js").then(
381
388
  ({ Pool }) => {
382
389
  this.#tarPool = new Pool();
383
390
  return this.#tarPool;
@@ -385,6 +392,44 @@ var PackageInfoClient = class {
385
392
  );
386
393
  return this.#tarPoolPromise;
387
394
  }
395
+ /**
396
+ * Terminate the tar pool's placement worker threads, if any were
397
+ * started. Reify calls this once placement is done; it is a no-op when
398
+ * the pool was never created or ran inline.
399
+ */
400
+ async closeTarPool() {
401
+ await this.#tarPoolPromise;
402
+ await this.#tarPool?.close();
403
+ }
404
+ /**
405
+ * Start the tar pool's unpack workers for an install about to place
406
+ * `nodes`, so they boot while the first packages are fetched instead
407
+ * of on the critical path of the first unpack. Only the nodes the
408
+ * global store does not already hold count: a store hit is linked on
409
+ * the main thread, so a warm install of all hits starts no worker.
410
+ * Best effort and never rejects: if the pool cannot start, unpacking
411
+ * just runs inline, and a real failure resurfaces at the first
412
+ * extract.
413
+ */
414
+ async warmTarPool(nodes) {
415
+ try {
416
+ const storeOn = this.#storeLinker !== "unpack";
417
+ let jobs = 0;
418
+ for (const { integrity } of nodes) {
419
+ const hex = storeOn ? integrityHex(integrity) : void 0;
420
+ if (hex && lstatSync(
421
+ storeIndexPath(pathResolve(this.#storeRoot, hex)),
422
+ { throwIfNoEntry: false }
423
+ )) {
424
+ continue;
425
+ }
426
+ jobs++;
427
+ }
428
+ if (!jobs) return;
429
+ await (await this.getTarPool()).warm(jobs);
430
+ } catch {
431
+ }
432
+ }
388
433
  /**
389
434
  * A version's Brotli (`.tar.br`) alternate: its absolute URL, plus its
390
435
  * hash if the registry sent one. Returns undefined if the version has no
@@ -417,6 +462,15 @@ var PackageInfoClient = class {
417
462
  this.#storeLinker = linker && storeLinkers.has(linker) ? linker : "unpack";
418
463
  }
419
464
  async extract(spec, target, options = {}) {
465
+ const extractSpan = {};
466
+ try {
467
+ return await this.#extract(spec, target, options, extractSpan);
468
+ } catch (er) {
469
+ extractSpan.end?.({ how: "error" });
470
+ throw er;
471
+ }
472
+ }
473
+ async #extract(spec, target, options, extractSpan) {
420
474
  if (typeof spec === "string")
421
475
  spec = Spec.parse(spec, this.options);
422
476
  const {
@@ -434,6 +488,11 @@ var PackageInfoClient = class {
434
488
  spec,
435
489
  ...brotli && !integrity ? { digestRequired: true } : {}
436
490
  } : await this.resolve(spec, options);
491
+ const end = span("extract", {
492
+ spec: String(spec),
493
+ url: r.resolved
494
+ });
495
+ extractSpan.end = end;
437
496
  switch (f.type) {
438
497
  case "git": {
439
498
  const {
@@ -463,6 +522,7 @@ var PackageInfoClient = class {
463
522
  await clone(gitRemote, gitCommittish, target, { spec });
464
523
  void rm2(target + "/.git", { recursive: true });
465
524
  }
525
+ end({ how: "git" });
466
526
  return r;
467
527
  }
468
528
  }
@@ -491,6 +551,7 @@ var PackageInfoClient = class {
491
551
  this.#storeHits[how]++;
492
552
  logRequest(r.resolved, how === "copy" ? "cache" : "store");
493
553
  r.integrity ??= cachedIntegrity;
554
+ end({ how });
494
555
  return {
495
556
  ...r,
496
557
  manifest: index.manifest,
@@ -501,17 +562,23 @@ var PackageInfoClient = class {
501
562
  this.#storeMisses++;
502
563
  }
503
564
  const rc = await this.getRegistryClient();
504
- const cached = rc.cachedBody(r.resolved, {
565
+ const cached = rc.cachedTarball(r.resolved, {
505
566
  integrity: r.integrity
506
567
  });
507
568
  if (cached) {
508
569
  try {
509
- await pool.unpack(cached.body, target, format);
570
+ const unpacked = span("tarball:unpack", {
571
+ url: r.resolved,
572
+ bytes: cached.bytes
573
+ });
574
+ await pool.unpackCacheEntry(cached.path, target, format);
575
+ unpacked();
510
576
  logRequest(r.resolved, "cache");
511
577
  r.integrity ??= cached.integrity;
512
578
  if (storeOn || cached.gzip) {
513
579
  rc.queueForStore(cached.key, r.integrity);
514
580
  }
581
+ end({ how: "cache" });
515
582
  return r;
516
583
  } catch (er) {
517
584
  debug(
@@ -523,12 +590,17 @@ var PackageInfoClient = class {
523
590
  }
524
591
  const fetchTarball = async (useCache) => {
525
592
  const trustIntegrity = this.#trustedIntegrities.get(r.resolved) === r.integrity;
593
+ const fetched = span("tarball:fetch", { url: r.resolved });
526
594
  const response = await (await this.getRegistryClient()).request(r.resolved, {
527
595
  integrity: r.integrity,
528
596
  trustIntegrity,
529
597
  verifyDigest: r.digestRequired ? "required" : true,
530
598
  ...useCache === false ? { useCache } : {}
531
599
  });
600
+ fetched({
601
+ status: response.statusCode,
602
+ fromCache: response.fromCache
603
+ });
532
604
  if (response.statusCode !== 200) {
533
605
  throw this.#resolveError(
534
606
  spec,
@@ -581,7 +653,12 @@ var PackageInfoClient = class {
581
653
  }
582
654
  }
583
655
  try {
656
+ const unpacked = span("tarball:unpack", {
657
+ url: r.resolved,
658
+ bytes: buf.length
659
+ });
584
660
  await pool.unpack(buf, target, format);
661
+ unpacked();
585
662
  } catch (er) {
586
663
  throw this.#resolveError(
587
664
  spec,
@@ -590,11 +667,12 @@ var PackageInfoClient = class {
590
667
  { cause: er }
591
668
  );
592
669
  }
670
+ end({ how: "fetch", bytes: buf.length });
593
671
  return r;
594
672
  }
595
673
  case "remote": {
596
674
  const rc = await this.getRegistryClient();
597
- const { CacheEntry: Entry, cacheKey } = await import("./src-A5ZJNOHN.js");
675
+ const { CacheEntry: Entry, cacheKey } = await import("./src-REZNPR2X.js");
598
676
  const key = cacheKey("GET", new URL(r.resolved));
599
677
  const unzipped = (entry) => {
600
678
  try {
@@ -668,6 +746,7 @@ var PackageInfoClient = class {
668
746
  { cause: er }
669
747
  );
670
748
  }
749
+ end({ how: "remote", bytes: buf.length });
671
750
  return r;
672
751
  }
673
752
  case "file": {
@@ -697,12 +776,14 @@ var PackageInfoClient = class {
697
776
  "file: specifier does not resolve to directory or tarball"
698
777
  );
699
778
  }
779
+ end({ how: "file" });
700
780
  return r;
701
781
  }
702
782
  case "workspace": {
703
783
  const ws = this.#getWS(spec, options);
704
784
  const rel = relative(dirname(target), ws.fullpath);
705
785
  await symlink(rel, target, "dir");
786
+ end({ how: "workspace" });
706
787
  return r;
707
788
  }
708
789
  }
@@ -1092,6 +1173,12 @@ var PackageInfoClient = class {
1092
1173
  return this.#resolvedManifests.size;
1093
1174
  }
1094
1175
  async manifest(spec, options = {}) {
1176
+ const end = span("manifest", { spec: String(spec) });
1177
+ const mani = await this.#manifest(spec, options);
1178
+ end();
1179
+ return mani;
1180
+ }
1181
+ async #manifest(spec, options) {
1095
1182
  const { from = this.#projectRoot } = options;
1096
1183
  if (typeof spec === "string")
1097
1184
  spec = Spec.parse(spec, this.options);
@@ -51,25 +51,25 @@ import {
51
51
  shouldInstallDepType,
52
52
  symlinkSyncMkdirp,
53
53
  unshare
54
- } from "./chunk-C4RJ4NNS.js";
54
+ } from "./chunk-TQBSL35R.js";
55
55
  import {
56
56
  SecurityArchive,
57
57
  usesNpmRegistry
58
- } from "./chunk-AHLBPSGQ.js";
58
+ } from "./chunk-JASG7RHB.js";
59
59
  import {
60
60
  RollbackRemove,
61
61
  cmdShimIfExists,
62
62
  readCmdShimIfExists
63
- } from "./chunk-JV5XR5JQ.js";
63
+ } from "./chunk-MCQTGFJY.js";
64
64
  import {
65
65
  detectLibc,
66
66
  getUser,
67
67
  platformCheck
68
- } from "./chunk-EMTGRCSE.js";
68
+ } from "./chunk-GJMDZJPJ.js";
69
69
  import {
70
70
  Monorepo,
71
71
  PackageJson
72
- } from "./chunk-KURQHX54.js";
72
+ } from "./chunk-6ISFYONV.js";
73
73
  import {
74
74
  baseDepID,
75
75
  getTuple,
@@ -88,16 +88,20 @@ import {
88
88
  } from "./chunk-HTOTG4TS.js";
89
89
  import {
90
90
  userAgent
91
- } from "./chunk-M242QVJS.js";
91
+ } from "./chunk-HHSPE2DS.js";
92
92
  import {
93
93
  promiseSpawn
94
94
  } from "./chunk-SUU2WETN.js";
95
95
  import {
96
96
  graphStep
97
- } from "./chunk-B6RIGNEO.js";
97
+ } from "./chunk-ZESNN24A.js";
98
98
  import {
99
99
  XDG
100
100
  } from "./chunk-XNLSTHDK.js";
101
+ import {
102
+ mark,
103
+ trace
104
+ } from "./chunk-6ETYWCJN.js";
101
105
  import {
102
106
  Spec,
103
107
  Version,
@@ -4670,6 +4674,12 @@ var appendNodes = async (packageInfo, graph, fromNode, deps, scurry, options, se
4670
4674
  ];
4671
4675
  while (currentLevelDeps.length > 0) {
4672
4676
  const nextLevelDeps = [];
4677
+ const depth = currentLevelDeps[0]?.depth ?? 0;
4678
+ trace("build:level", {
4679
+ from: fromNode.id,
4680
+ depth,
4681
+ entries: currentLevelDeps.length
4682
+ });
4673
4683
  const fetchResults = await Promise.all(
4674
4684
  currentLevelDeps.map(
4675
4685
  async ({
@@ -4677,7 +4687,7 @@ var appendNodes = async (packageInfo, graph, fromNode, deps, scurry, options, se
4677
4687
  deps: nodeDeps,
4678
4688
  modifierRefs: nodeModifierRefs,
4679
4689
  peerContext,
4680
- depth
4690
+ depth: depth2
4681
4691
  }) => {
4682
4692
  const result = await fetchManifestsForDeps(
4683
4693
  packageInfo,
@@ -4692,7 +4702,7 @@ var appendNodes = async (packageInfo, graph, fromNode, deps, scurry, options, se
4692
4702
  hydrations,
4693
4703
  peerContext,
4694
4704
  nodeModifierRefs,
4695
- depth,
4705
+ depth2,
4696
4706
  explicit
4697
4707
  );
4698
4708
  return {
@@ -4701,13 +4711,14 @@ var appendNodes = async (packageInfo, graph, fromNode, deps, scurry, options, se
4701
4711
  deps: nodeDeps,
4702
4712
  modifierRefs: nodeModifierRefs,
4703
4713
  peerContext,
4704
- depth
4714
+ depth: depth2
4705
4715
  },
4706
4716
  result
4707
4717
  };
4708
4718
  }
4709
4719
  )
4710
4720
  );
4721
+ trace("build:level:fetched", { from: fromNode.id, depth });
4711
4722
  const sortedResults = fetchResults.sort((a, b) => {
4712
4723
  const keyA = `${a.entry.node.id}::${a.entry.depth}`;
4713
4724
  const keyB = `${b.entry.node.id}::${b.entry.depth}`;
@@ -4764,6 +4775,11 @@ var appendNodes = async (packageInfo, graph, fromNode, deps, scurry, options, se
4764
4775
  nextLevelDeps.push({ ...childDep, depth: nextDepth });
4765
4776
  }
4766
4777
  }
4778
+ trace("build:level:placed", {
4779
+ from: fromNode.id,
4780
+ depth,
4781
+ next: nextLevelDeps.length
4782
+ });
4767
4783
  currentLevelDeps = nextLevelDeps;
4768
4784
  }
4769
4785
  };
@@ -4877,6 +4893,7 @@ var refreshIdealGraph = async ({
4877
4893
  node.setDefaultLocation();
4878
4894
  }
4879
4895
  if (extractPromises?.length) {
4896
+ mark("build:extract-wait", { jobs: extractPromises.length });
4880
4897
  await Promise.all(extractPromises);
4881
4898
  }
4882
4899
  };
@@ -5604,6 +5621,8 @@ var reify = async (options) => {
5604
5621
  success = true;
5605
5622
  res.buildQueue = buildQueue;
5606
5623
  } finally {
5624
+ await options.packageInfo.closeTarPool().catch(() => {
5625
+ });
5607
5626
  if (!success) {
5608
5627
  await rollback(remover, diff, scurry).catch(() => {
5609
5628
  });
@@ -5617,6 +5636,7 @@ var reify_ = async (options, diff, remover, saveImportersPackageJson) => {
5617
5636
  const { packageInfo, packageJson, scurry, allowScripts } = options;
5618
5637
  const lfData = lockfileData(options);
5619
5638
  pruneUnsupportedOptional(diff);
5639
+ void packageInfo.warmTarPool(diff.nodes.add);
5620
5640
  const actions = addNodes(
5621
5641
  diff,
5622
5642
  scurry,
@@ -5624,18 +5644,23 @@ var reify_ = async (options, diff, remover, saveImportersPackageJson) => {
5624
5644
  options,
5625
5645
  packageInfo
5626
5646
  ).concat(deleteEdges(diff, scurry, remover));
5647
+ mark("reify:extract", { jobs: actions.length, limit });
5627
5648
  if (actions.length) await callLimit(actions, { limit });
5628
5649
  const edgeActions = addEdges(diff, scurry, remover);
5650
+ mark("reify:edges", { jobs: edgeActions.length });
5629
5651
  if (edgeActions.length) await callLimit(edgeActions, { limit });
5630
5652
  const binActions = relinkBins(diff, scurry, remover);
5631
5653
  if (binActions.length) await callLimit(binActions, { limit });
5654
+ mark("reify:hoist");
5632
5655
  await internalHoist(diff.to, options, remover);
5633
5656
  checkNeededBuild({ diff, scurry, packageJson });
5634
5657
  const allowScriptsNodes = await filterNodesByQuery(
5635
5658
  diff.to,
5636
5659
  allowScripts
5637
5660
  );
5661
+ mark("reify:chmod");
5638
5662
  await binChmodAll(diff.nodes.add, scurry);
5663
+ mark("reify:scripts");
5639
5664
  await build(diff, packageJson, scurry, allowScriptsNodes);
5640
5665
  res.buildQueue = [...diff.to.nodes.values()].filter((node) => node.buildState === "needed").map((node) => node.id);
5641
5666
  if (diff.hadOptionalFailures) {
@@ -5644,6 +5669,7 @@ var reify_ = async (options, diff, remover, saveImportersPackageJson) => {
5644
5669
  diff.nodes.delete.add(node);
5645
5670
  }
5646
5671
  }
5672
+ mark("reify:lockfile");
5647
5673
  saveHidden(options);
5648
5674
  const rmActions = deleteNodes(
5649
5675
  diff,
@@ -5651,6 +5677,7 @@ var reify_ = async (options, diff, remover, saveImportersPackageJson) => {
5651
5677
  scurry,
5652
5678
  options.keepNodes
5653
5679
  );
5680
+ mark("reify:delete", { jobs: rmActions.length });
5654
5681
  if (rmActions.length) await Promise.all(rmActions);
5655
5682
  saveImportersPackageJson?.();
5656
5683
  for (const node of diff.nodes.add) {
@@ -5765,7 +5792,7 @@ var uninstall = async (options, remove) => {
5765
5792
  throw err;
5766
5793
  }
5767
5794
  if (!allowSkills) return result;
5768
- const { linkSkills: linkSkills2 } = await import("./skills-7PYMTDER.js");
5795
+ const { linkSkills: linkSkills2 } = await import("./skills-QOFA6XMM.js");
5769
5796
  result.skills = await linkSkills2({
5770
5797
  ...options,
5771
5798
  graph: result.graph,
@@ -5875,7 +5902,7 @@ var update = async (options) => {
5875
5902
  throw err;
5876
5903
  }
5877
5904
  if (!allowSkills) return result;
5878
- const { linkSkills: linkSkills2 } = await import("./skills-7PYMTDER.js");
5905
+ const { linkSkills: linkSkills2 } = await import("./skills-QOFA6XMM.js");
5879
5906
  result.skills = await linkSkills2({
5880
5907
  ...options,
5881
5908
  graph: result.graph,
@@ -6219,7 +6246,7 @@ var install = async (options, add) => {
6219
6246
  throw err;
6220
6247
  }
6221
6248
  if (!allowSkills) return result;
6222
- const { linkSkills: linkSkills2 } = await import("./skills-7PYMTDER.js");
6249
+ const { linkSkills: linkSkills2 } = await import("./skills-QOFA6XMM.js");
6223
6250
  result.skills = await linkSkills2({
6224
6251
  ...options,
6225
6252
  graph: result.graph,
@@ -10,6 +10,197 @@ globalThis.clearInterval = _vlt_clearInterval;
10
10
  import {createRequire as _vlt_createRequire} from "node:module";
11
11
  var require = _vlt_createRequire(import.meta.filename);
12
12
 
13
+ // ../../src/output/src/trace.ts
14
+ import { appendFileSync } from "node:fs";
15
+ import { monitorEventLoopDelay, performance as performance2 } from "node:perf_hooks";
16
+ import { threadId as ownThreadId } from "node:worker_threads";
17
+ var sharedNow = () => performance2.timeOrigin + performance2.now();
18
+ var defaultAppend = (file, data) => appendFileSync(file, data, { mode: 384 });
19
+ var defaultWrite = (line) => process.stderr.write(line + "\n");
20
+ var Tracer = class _Tracer {
21
+ enabled;
22
+ file;
23
+ phases;
24
+ #tid;
25
+ #now;
26
+ #append;
27
+ #write;
28
+ #flushLines;
29
+ #flushMs;
30
+ #buffer = [];
31
+ #timer;
32
+ #sampler;
33
+ #marks = [];
34
+ #start;
35
+ #loop;
36
+ #closed = false;
37
+ constructor(options = {}) {
38
+ this.file = options.file || void 0;
39
+ this.phases = !!options.phases;
40
+ this.enabled = !!this.file || this.phases;
41
+ this.#tid = options.threadId ?? ownThreadId;
42
+ this.#now = options.now ?? sharedNow;
43
+ this.#append = options.append ?? defaultAppend;
44
+ this.#write = options.write ?? defaultWrite;
45
+ this.#flushLines = options.flushLines ?? 200;
46
+ this.#flushMs = options.flushMs ?? 50;
47
+ this.#start = this.#now();
48
+ if (!this.enabled) return;
49
+ const main = options.main ?? this.#tid === 0;
50
+ if (main) {
51
+ this.#loop = monitorEventLoopDelay({ resolution: 20 });
52
+ this.#loop.enable();
53
+ const sampleMs = options.sampleMs ?? 20;
54
+ if (this.file && sampleMs > 0) {
55
+ this.#sampler = setInterval(() => this.sample(), sampleMs);
56
+ this.#sampler.unref();
57
+ }
58
+ process.once("exit", () => this.close());
59
+ }
60
+ this.trace("open", { pid: process.pid });
61
+ }
62
+ /**
63
+ * Build a tracer from the environment: `VLT_TRACE` names the file,
64
+ * `VLT_PHASES` (any value but `0` or empty) asks for the summary.
65
+ */
66
+ static fromEnv(env = process.env, options = {}) {
67
+ const phases = env.VLT_PHASES;
68
+ return new _Tracer({
69
+ ...options,
70
+ file: env.VLT_TRACE,
71
+ phases: !!phases && phases !== "0"
72
+ });
73
+ }
74
+ /** Record one event. */
75
+ trace(ev, fields) {
76
+ if (!this.file || this.#closed) return;
77
+ const event = { t: this.#now(), tid: this.#tid, ev };
78
+ if (fields) {
79
+ for (const [k2, v2] of Object.entries(fields)) {
80
+ if (v2 !== void 0) event[k2] = v2;
81
+ }
82
+ }
83
+ this.#buffer.push(JSON.stringify(event));
84
+ if (this.#buffer.length >= this.#flushLines) this.flush();
85
+ else if (!this.#timer) {
86
+ this.#timer = setTimeout(() => this.flush(), this.#flushMs);
87
+ this.#timer.unref();
88
+ }
89
+ }
90
+ /**
91
+ * Record a `<ev>:start` event now and return a function that records
92
+ * `<ev>:end` with the elapsed `ms` (plus any fields it is given). The
93
+ * same `fields` are stamped on both ends so the two can be paired.
94
+ */
95
+ span(ev, fields) {
96
+ if (!this.file) return noop;
97
+ const t0 = this.#now();
98
+ this.trace(`${ev}:start`, fields);
99
+ return (end) => this.trace(`${ev}:end`, {
100
+ ...fields,
101
+ ...end,
102
+ ms: Math.round((this.#now() - t0) * 1e3) / 1e3
103
+ });
104
+ }
105
+ /**
106
+ * Mark the start of a phase. The summary reports the ms between each
107
+ * mark and the next one, and the trace records a `phase` event.
108
+ */
109
+ mark(name, fields) {
110
+ if (!this.enabled) return;
111
+ this.#marks.push({ name, t: this.#now() });
112
+ this.trace("phase", { ...fields, name });
113
+ }
114
+ /**
115
+ * Record how busy a resource lane is: how many jobs it is running and
116
+ * how many are waiting for a slot. The report derives idle time per
117
+ * lane from these.
118
+ */
119
+ lane(name, busy, queued) {
120
+ if (!this.file) return;
121
+ this.trace("lane", { name, busy, queued });
122
+ }
123
+ /** Record a memory sample. */
124
+ sample() {
125
+ if (!this.file) return;
126
+ const m = process.memoryUsage();
127
+ this.trace("rss", {
128
+ rss: m.rss,
129
+ heap: m.heapUsed,
130
+ ext: m.external,
131
+ ab: m.arrayBuffers
132
+ });
133
+ }
134
+ /** Write buffered lines to the file. */
135
+ flush() {
136
+ if (this.#timer) {
137
+ clearTimeout(this.#timer);
138
+ this.#timer = void 0;
139
+ }
140
+ if (!this.file || !this.#buffer.length) return;
141
+ const data = this.#buffer.join("\n") + "\n";
142
+ this.#buffer = [];
143
+ try {
144
+ this.#append(this.file, data);
145
+ } catch {
146
+ }
147
+ }
148
+ /**
149
+ * The one-line phase summary, or undefined when phases are off. Each
150
+ * phase is reported as the ms from its mark to the next mark (or to
151
+ * now, for the last one).
152
+ */
153
+ summary() {
154
+ if (!this.phases) return void 0;
155
+ const now = this.#now();
156
+ const parts = [];
157
+ for (const [i, m] of this.#marks.entries()) {
158
+ const next = this.#marks[i + 1]?.t ?? now;
159
+ parts.push(`${m.name}=${Math.round(next - m.t)}`);
160
+ }
161
+ parts.push(`total=${Math.round(now - this.#start)}`);
162
+ if (this.#loop) {
163
+ const ms2 = (n7) => Math.round(n7 / 1e6);
164
+ parts.push(
165
+ `loop p50=${ms2(this.#loop.percentile(50))} p99=${ms2(this.#loop.percentile(99))} max=${ms2(this.#loop.max)}`
166
+ );
167
+ }
168
+ const { maxRSS } = process.resourceUsage();
169
+ parts.push(`maxrss=${Math.round(maxRSS / 1024)}MB`);
170
+ return `PHASES ${parts.join(" ")}`;
171
+ }
172
+ /**
173
+ * Stop sampling, flush, and print the summary. Runs at process exit
174
+ * on the main thread; safe to call more than once.
175
+ */
176
+ close() {
177
+ if (this.#closed) return;
178
+ if (this.#sampler) clearInterval(this.#sampler);
179
+ if (this.enabled) {
180
+ if (this.#loop) {
181
+ this.#loop.disable();
182
+ this.trace("exit", {
183
+ loopP50: Math.round(this.#loop.percentile(50) / 1e6),
184
+ loopP99: Math.round(this.#loop.percentile(99) / 1e6),
185
+ loopMax: Math.round(this.#loop.max / 1e6),
186
+ maxrss: process.resourceUsage().maxRSS
187
+ });
188
+ }
189
+ const line = this.summary();
190
+ this.flush();
191
+ if (line) this.#write(line);
192
+ }
193
+ this.#closed = true;
194
+ }
195
+ };
196
+ var noop = () => {
197
+ };
198
+ var tracer = Tracer.fromEnv();
199
+ var trace = (ev, fields) => tracer.trace(ev, fields);
200
+ var span = (ev, fields) => tracer.span(ev, fields);
201
+ var mark = (name, fields) => tracer.mark(name, fields);
202
+ var lane = (name, busy, queued) => tracer.lane(name, busy, queued);
203
+
13
204
  // ../../node_modules/.vlt/~npm~glob@13.0.6/node_modules/glob/dist/esm/index.min.js
14
205
  import { fileURLToPath as Wi } from "node:url";
15
206
  import { posix as mi, win32 as re } from "node:path";
@@ -2997,5 +3188,10 @@ Ze.glob = Ze;
2997
3188
  export {
2998
3189
  ot,
2999
3190
  ts,
3000
- Ze
3191
+ Ze,
3192
+ tracer,
3193
+ trace,
3194
+ span,
3195
+ mark,
3196
+ lane
3001
3197
  };
@@ -22,11 +22,11 @@ import {
22
22
  } from "./chunk-HTOTG4TS.js";
23
23
  import {
24
24
  I
25
- } from "./chunk-B6RIGNEO.js";
25
+ } from "./chunk-ZESNN24A.js";
26
26
  import {
27
27
  ot,
28
28
  ts
29
- } from "./chunk-Y5PA7DVK.js";
29
+ } from "./chunk-6ETYWCJN.js";
30
30
  import {
31
31
  asManifest,
32
32
  longDependencyTypes,
@@ -13,7 +13,7 @@ import {
13
13
  defaultRegistryKey,
14
14
  getTokenByURL,
15
15
  registryKeys
16
- } from "./chunk-Q2UEILN6.js";
16
+ } from "./chunk-NB7QVWHU.js";
17
17
 
18
18
  // ../../src/cli-sdk/src/query-auth.ts
19
19
  var createGetAuthHeader = (conf) => {
@@ -15,7 +15,7 @@ import {
15
15
  } from "./chunk-SRWDPPLX.js";
16
16
  import {
17
17
  minimatch
18
- } from "./chunk-KURQHX54.js";
18
+ } from "./chunk-6ISFYONV.js";
19
19
  import {
20
20
  Spec
21
21
  } from "./chunk-6D3QAFNZ.js";