@vltpkg/cli-js 1.1.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/{access-YYMAAPHV.js → access-HIVJOWXZ.js} +10 -10
  2. package/{bugs-RK5JBPSC.js → bugs-2KFUYMPS.js} +19 -19
  3. package/{build-DVJSYCNF.js → build-CX6YZ4LS.js} +12 -12
  4. package/{cache-JKQNGZ7L.js → cache-I6L5ZRGD.js} +145 -16
  5. package/cache-unzip-src-unzip.js +2953 -164
  6. package/{src-MOKZQTH2.js → chunk-263MHLR3.js} +299 -43
  7. package/{chunk-3LUM7NX5.js → chunk-2HXJ4ZSF.js} +3 -3
  8. package/{chunk-GDJ7JT2R.js → chunk-33HBY5CF.js} +1 -1
  9. package/{chunk-MZA6N2TA.js → chunk-C6LK7C3L.js} +4 -4
  10. package/{chunk-34TE4HZS.js → chunk-CU752KW7.js} +2 -2
  11. package/{chunk-2PWSMJD7.js → chunk-D2LEK7VS.js} +1 -1
  12. package/{chunk-CEHPRPGQ.js → chunk-ENSGPOLR.js} +46 -0
  13. package/{chunk-V4YCZZHY.js → chunk-EP7AVBIO.js} +16 -8
  14. package/{chunk-DS7YMIHP.js → chunk-FHMIECHI.js} +158 -59
  15. package/chunk-GDV5LSQ2.js +75 -0
  16. package/{chunk-BWEH7DHQ.js → chunk-HCZOVC3Y.js} +1 -1
  17. package/{chunk-CBASIDQH.js → chunk-I6QGYSB4.js} +1 -1
  18. package/{chunk-KDF7PEBY.js → chunk-ILRJWH6A.js} +5 -5
  19. package/{chunk-JZJWASXL.js → chunk-J2WL3A3C.js} +134 -68
  20. package/{chunk-YOE3VZFX.js → chunk-J3R4XWB3.js} +2 -2
  21. package/{chunk-DF5K4CYR.js → chunk-JFHEXCG5.js} +5 -5
  22. package/{chunk-LR42WTKN.js → chunk-MJWUULO6.js} +14 -12
  23. package/{chunk-QQYTPGIL.js → chunk-N4RCKCHY.js} +1 -1
  24. package/{chunk-X2AWQGYG.js → chunk-P4LLYWCG.js} +112 -23
  25. package/{chunk-BHJT53TP.js → chunk-PDWPFR5T.js} +1 -1
  26. package/{chunk-XIF734VO.js → chunk-QETVMIIT.js} +4 -4
  27. package/{chunk-WE2TQN32.js → chunk-QWJDHBV7.js} +4 -3
  28. package/{chunk-VFBCWAOC.js → chunk-RH2Y7MPW.js} +29 -0
  29. package/{chunk-LN2A74PF.js → chunk-SVMH3NDM.js} +277 -50
  30. package/{chunk-DR4Z63B6.js → chunk-TYLYZKVA.js} +14 -11
  31. package/{chunk-XKVU23NC.js → chunk-V7EQZOO5.js} +1 -1
  32. package/{chunk-YBVTY6ZW.js → chunk-VBADA6QU.js} +1 -1
  33. package/{chunk-GDT6KI4I.js → chunk-W6UMN2YJ.js} +4 -4
  34. package/{chunk-VE6CCH33.js → chunk-Y5PA7DVK.js} +1 -0
  35. package/{chunk-6FT6K5YN.js → chunk-YZWFWSY7.js} +25 -7
  36. package/{chunk-SNOBGFNM.js → chunk-ZNUXDX6R.js} +50 -8
  37. package/{ci-WVYVR4XK.js → ci-BX54SEU3.js} +12 -12
  38. package/cli-package.json +3 -2
  39. package/{config-VYOTYBGS.js → config-HFF6XDCV.js} +9 -9
  40. package/{config-2MFZVP2N.js → config-WBVJX42R.js} +12 -12
  41. package/{create-OJPLHBRR.js → create-W67HRHWZ.js} +20 -20
  42. package/{deprecate-V4PKGFF7.js → deprecate-5T6JTGJ3.js} +14 -14
  43. package/{devtools-UEMPW5GG.js → devtools-UMJUK42W.js} +2 -2
  44. package/{dist-tag-DNLV4VDE.js → dist-tag-YIZTS7GF.js} +10 -10
  45. package/{docs-LXHDCGL5.js → docs-G7CKMPCL.js} +19 -19
  46. package/{exec-P32YSP44.js → exec-YYCAZZ6Z.js} +20 -20
  47. package/{exec-cache-JZ5PDTOY.js → exec-cache-6ENHAGC6.js} +18 -18
  48. package/{exec-local-HHA464H4.js → exec-local-OXG3PSLF.js} +17 -17
  49. package/{help-GVTTOYUL.js → help-RMOIAILM.js} +4 -4
  50. package/{init-RENGG74N.js → init-UPEQXC4D.js} +12 -12
  51. package/{install-V6VXOBH2.js → install-U7LLEQU6.js} +18 -18
  52. package/{list-7N7Y5OXB.js → list-N6CKPXTK.js} +20 -20
  53. package/{login-D2QSAUJC.js → login-MCO4ZLVF.js} +14 -14
  54. package/{logout-QPOYBQNF.js → logout-BJ4QRZYG.js} +10 -10
  55. package/{pack-4YYGXP3A.js → pack-U6PYRFZ6.js} +13 -13
  56. package/package.json +1 -1
  57. package/{ping-QYRIZONU.js → ping-VFB6SCMH.js} +10 -10
  58. package/{pkg-WQTNABKT.js → pkg-ZNK5SCF4.js} +13 -13
  59. package/{profile-PRI7WXK7.js → profile-TW32HLYA.js} +10 -10
  60. package/{publish-PSBYJQS7.js → publish-AHOITWZQ.js} +36 -21
  61. package/{query-UFYLQW4N.js → query-KKP5PNSQ.js} +20 -20
  62. package/{registry-YTJZ3AQD.js → registry-VHB65BWD.js} +5 -5
  63. package/registry-client-src-revalidate.js +5936 -5801
  64. package/{repo-4S6ETFXX.js → repo-BHTVK5KE.js} +19 -19
  65. package/{reporter-GLWYHI2Y.js → reporter-VQU7HYKM.js} +77 -77
  66. package/{run-OU7NUB7A.js → run-UD32OTUJ.js} +17 -17
  67. package/{run-exec-QPBY7ULE.js → run-exec-NOCIUNGL.js} +17 -17
  68. package/security-archive-src-update-expired.js +1 -1
  69. package/{setup-23QXG473.js → setup-PBCWOSTV.js} +18 -18
  70. package/{src-575IYJOL.js → src-LRKPUV4J.js} +16 -16
  71. package/src-T5FBZFMV.js +222 -0
  72. package/{src-3GN7TDNH.js → src-Z44JKVWS.js} +9 -7
  73. package/{token-FCIA3RGD.js → token-PCPB6NOL.js} +10 -10
  74. package/{uninstall-BQVZVKB5.js → uninstall-LOGSQXFS.js} +14 -14
  75. package/{unpublish-YGJ5HEYF.js → unpublish-O3UFCTEJ.js} +10 -10
  76. package/{update-WCGV66JK.js → update-WBCLWGLN.js} +17 -17
  77. package/{version-7EA3UQG7.js → version-S3LCB2TQ.js} +13 -13
  78. package/{view-5FWIENVE.js → view-LMPENVAJ.js} +12 -12
  79. package/vlr.js +1 -1
  80. package/vlrx.js +1 -1
  81. package/vlt.js +1 -1
  82. package/vlx.js +1 -1
  83. package/vlxl.js +1 -1
  84. package/{whoami-O4ZTBIC4.js → whoami-LYMG7R3P.js} +10 -10
  85. package/chunk-WD74RJXW.js +0 -75
@@ -12,27 +12,93 @@ var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  rimraf,
14
14
  rimrafSync
15
- } from "./chunk-BHJT53TP.js";
16
- import "./chunk-VE6CCH33.js";
15
+ } from "./chunk-PDWPFR5T.js";
16
+ import {
17
+ isManifest,
18
+ normalizeBinPaths
19
+ } from "./chunk-RH2Y7MPW.js";
17
20
  import {
18
21
  error
19
22
  } from "./chunk-WZWDS3W4.js";
20
- import "./chunk-PZLD7RTK.js";
23
+
24
+ // ../../src/tar/src/store-index.ts
25
+ import { readFileSync } from "node:fs";
26
+ import { debuglog } from "node:util";
27
+ var debug = debuglog("vlt");
28
+ var storeIndexPath = (storeEntry) => storeEntry + ".json";
29
+ var isRecord = (x) => !!x && typeof x === "object" && !Array.isArray(x);
30
+ var isOptString = (x) => x === void 0 || typeof x === "string";
31
+ var unsafePath = /(?:^|\/)\.{0,2}(?:\/|$)|\\/;
32
+ var isRelPath = (p) => typeof p === "string" && !unsafePath.test(p);
33
+ var isIndexFile = (f) => Array.isArray(f) && f.length === 3 && isRelPath(f[0]) && typeof f[1] === "number" && (f[2] === 0 || f[2] === 1);
34
+ var isStoreIndex = (x) => isRecord(x) && x.v === 1 && typeof x.scripts === "boolean" && isOptString(x.name) && isOptString(x.version) && (x.bins === void 0 || isRecord(x.bins) && Object.values(x.bins).every((b) => typeof b === "string")) && Array.isArray(x.dirs) && x.dirs.every(isRelPath) && Array.isArray(x.files) && x.files.every(isIndexFile) && isOptString(x.manifest);
35
+ var readStoreIndex = (storeEntry) => {
36
+ let index;
37
+ try {
38
+ index = JSON.parse(
39
+ readFileSync(storeIndexPath(storeEntry), "utf8")
40
+ );
41
+ } catch (er) {
42
+ if (er.code !== "ENOENT") {
43
+ debug("global store: invalid index", storeEntry);
44
+ }
45
+ return void 0;
46
+ }
47
+ if (isStoreIndex(index)) return index;
48
+ debug("global store: invalid index", storeEntry);
49
+ return void 0;
50
+ };
51
+ var storeIndexManifest = (packageJson, bindingGyp) => {
52
+ let pkg;
53
+ try {
54
+ pkg = JSON.parse(
55
+ packageJson.toString("utf8").replace(/^\uFEFF/, "")
56
+ );
57
+ } catch (cause) {
58
+ throw error("invalid package.json in tarball", { cause });
59
+ }
60
+ if (!isRecord(pkg)) {
61
+ throw error("invalid package.json in tarball", { found: pkg });
62
+ }
63
+ const { name: name2, version, scripts, bin } = pkg;
64
+ const s = isRecord(scripts) ? scripts : {};
65
+ const result = {
66
+ scripts: !!(s.install || s.preinstall || s.postinstall) || bindingGyp
67
+ };
68
+ const bins = normalizeBinPaths({
69
+ name: typeof name2 === "string" ? name2 : void 0,
70
+ bin
71
+ });
72
+ if (bins && Object.keys(bins).length) result.bins = bins;
73
+ if (typeof name2 === "string") result.name = name2;
74
+ if (typeof version === "string") result.version = version;
75
+ if (isManifest(pkg)) result.manifest = JSON.stringify(pkg);
76
+ return result;
77
+ };
21
78
 
22
79
  // ../../src/tar/src/unpack.ts
23
80
  import { randomBytes } from "node:crypto";
24
81
  import {
82
+ chmodSync,
25
83
  lstatSync,
26
84
  mkdirSync,
27
- readFileSync,
85
+ readFileSync as readFileSync2,
28
86
  renameSync,
87
+ statSync,
29
88
  writeFileSync
30
89
  } from "node:fs";
31
- import { lstat, mkdir, rename, writeFile } from "node:fs/promises";
90
+ import {
91
+ lstat,
92
+ mkdir,
93
+ readFile,
94
+ rename,
95
+ writeFile
96
+ } from "node:fs/promises";
32
97
  import {
33
98
  basename as basename2,
34
99
  dirname,
35
100
  isAbsolute,
101
+ join,
36
102
  relative,
37
103
  resolve,
38
104
  sep
@@ -530,7 +596,12 @@ var parseKVLine = (set, line) => {
530
596
  };
531
597
 
532
598
  // ../../src/tar/src/unpack.ts
533
- import { unzip as unzipCB, unzipSync as unzipSyncCB } from "node:zlib";
599
+ import {
600
+ brotliDecompress as brotliCB,
601
+ brotliDecompressSync as brotliSyncCB,
602
+ unzip as unzipCB,
603
+ unzipSync as unzipSyncCB
604
+ } from "node:zlib";
534
605
 
535
606
  // ../../src/tar/src/find-tar-dir.ts
536
607
  var findTarDir = (path, tarDir) => {
@@ -579,6 +650,27 @@ var unzipSync = (input) => {
579
650
  throw unzipError(er, input.length, max);
580
651
  }
581
652
  };
653
+ var isGzip = (b) => b[0] === 31 && b[1] === 139;
654
+ var brotli = async (input) => {
655
+ const max = unzipMax(input.length);
656
+ return new Promise(
657
+ (res, rej) => brotliCB(
658
+ input,
659
+ { maxOutputLength: max },
660
+ (er, result) => er ? rej(unzipError(er, input.length, max)) : res(result)
661
+ )
662
+ );
663
+ };
664
+ var brotliSync = (input) => {
665
+ const max = unzipMax(input.length);
666
+ try {
667
+ return brotliSyncCB(input, { maxOutputLength: max });
668
+ } catch (er) {
669
+ throw unzipError(er, input.length, max);
670
+ }
671
+ };
672
+ var decompress = async (input, format) => format === "brotli" ? brotli(input) : isGzip(input) ? unzip(input) : input;
673
+ var decompressSync = (input, format) => format === "brotli" ? brotliSync(input) : isGzip(input) ? unzipSync(input) : input;
582
674
  var exists = async (path) => {
583
675
  try {
584
676
  await lstat(path);
@@ -677,24 +769,26 @@ var write = async (path, body, executable = false) => {
677
769
  mode: executable ? 511 : 438
678
770
  });
679
771
  };
680
- var unpack = async (tarData, target) => {
681
- const isGzip = tarData[0] === 31 && tarData[1] === 139;
682
- await unpackUnzipped(
683
- isGzip ? await unzip(tarData) : tarData,
684
- target
685
- );
772
+ var unpack = async (tarData, target, format) => {
773
+ await unpackUnzipped(await decompress(tarData, format), target);
774
+ };
775
+ var unpackSync = (tarData, target, format) => {
776
+ unpackUnzippedSync(decompressSync(tarData, format), target);
686
777
  };
687
- var unpackSync = (tarData, target) => {
688
- const isGzip = tarData[0] === 31 && tarData[1] === 139;
689
- unpackUnzippedSync(isGzip ? unzipSync(tarData) : tarData, target);
778
+ var unpackParallel = async (tarData, target, format) => {
779
+ unpackUnzippedSync(await decompress(tarData, format), target);
690
780
  };
691
- var unpackFileSync = (file, target, offset = 0) => unpackSync(readFileSync(file).subarray(offset), target);
781
+ var unpackFileParallel = async (file, target, offset = 0, format) => unpackParallel(
782
+ (await readFile(file)).subarray(offset),
783
+ target,
784
+ format
785
+ );
786
+ var unpackFileSync = (file, target, offset = 0, format) => unpackSync(readFileSync2(file).subarray(offset), target, format);
692
787
  var tmpName = (target) => dirname(target) + sep + "." + basename2(target) + "." + tmpSuffix();
693
788
  var parseTarball = (buffer, tmp2) => {
694
- const isGzip = buffer[0] === 31 && buffer[1] === 139;
695
- if (isGzip) {
789
+ if (isGzip(buffer)) {
696
790
  throw error("still gzipped after unzipping", {
697
- found: isGzip,
791
+ found: true,
698
792
  wanted: false
699
793
  });
700
794
  }
@@ -863,32 +957,194 @@ var unpackUnzippedSync = (buffer, target) => {
863
957
  }
864
958
  }
865
959
  };
960
+ var storeLayout = (tarData, dir, format) => {
961
+ const { dirs, files } = parseTarball(
962
+ decompressSync(tarData, format),
963
+ dir
964
+ );
965
+ const rel = (p) => relative(dir, p).replace(/\\/g, "/");
966
+ const list = files.map((f) => [rel(f.path), f]);
967
+ const pj = list.find(([p]) => p === "package.json")?.[1];
968
+ if (!pj) throw error("no package.json in tarball", { path: dir });
969
+ const manifest = storeIndexManifest(
970
+ pj.body,
971
+ list.some(([p]) => p === "binding.gyp")
972
+ );
973
+ const bins = new Set(
974
+ Object.values(manifest.bins ?? {}).map(entryKey)
975
+ );
976
+ const indexFiles = [];
977
+ const binFiles = [];
978
+ for (const [p, f] of list) {
979
+ if (bins.has(entryKey(p))) {
980
+ f.executable = true;
981
+ binFiles.push(f.path);
982
+ }
983
+ indexFiles.push([p, f.body.length, f.executable ? 1 : 0]);
984
+ }
985
+ const allDirs = /* @__PURE__ */ new Set();
986
+ for (const d of dirs) {
987
+ for (let p = rel(d); p && !allDirs.has(p); ) {
988
+ allDirs.add(p);
989
+ p = p.slice(0, Math.max(0, p.lastIndexOf("/")));
990
+ }
991
+ }
992
+ const indexDirs = [...allDirs].sort().sort((a, b) => a.length - b.length);
993
+ return {
994
+ index: {
995
+ v: 1,
996
+ files: indexFiles.sort((a, b) => a[0] < b[0] ? -1 : 1),
997
+ dirs: indexDirs,
998
+ ...manifest
999
+ },
1000
+ files,
1001
+ binFiles
1002
+ };
1003
+ };
1004
+ var unpackToStoreSync = (tarData, dir, format) => {
1005
+ const { index, files, binFiles } = storeLayout(tarData, dir, format);
1006
+ mkdirSync(dirname(dir), { recursive: true });
1007
+ mkdirSync(dir, { mode: 511 });
1008
+ let succeeded = false;
1009
+ try {
1010
+ for (const d of index.dirs) {
1011
+ mkdirSync(join(dir, d), { recursive: true, mode: 511 });
1012
+ }
1013
+ for (const f of files) {
1014
+ writeFileSync(f.path, f.body, {
1015
+ mode: f.executable ? 511 : 438
1016
+ });
1017
+ }
1018
+ let binMode = 0;
1019
+ for (const p of binFiles) {
1020
+ binMode ||= statSync(p).mode & 511 | 73;
1021
+ chmodSync(p, binMode);
1022
+ }
1023
+ succeeded = true;
1024
+ } finally {
1025
+ if (!succeeded) rimrafSync(dir);
1026
+ }
1027
+ return { index };
1028
+ };
866
1029
 
867
- // ../../src/tar/src/pool.ts
868
- import { readFile } from "node:fs/promises";
869
- var syncUnpack = process.env.VLT_TAR_SYNC !== "0";
870
- var Pool = class {
871
- /**
872
- * Provide the tardata to be unpacked, and the location where it's to be
873
- * placed. Resolves when the tarball has been extracted.
874
- */
875
- async unpack(tarData, target) {
876
- if (!syncUnpack) return unpack(tarData, target);
877
- unpackSync(tarData, target);
878
- }
879
- /**
880
- * Same, reading the tarball from a file and skipping `offset` leading
881
- * bytes, so a cache entry is unpacked without loading it into the
882
- * registry client's in-memory cache.
883
- */
884
- async unpackFile(file, target, offset = 0) {
885
- if (!syncUnpack) {
886
- return unpack((await readFile(file)).subarray(offset), target);
887
- }
888
- unpackFileSync(file, target, offset);
1030
+ // ../../src/tar/src/store-entry.ts
1031
+ import {
1032
+ closeSync,
1033
+ lstatSync as lstatSync2,
1034
+ openSync,
1035
+ readdirSync,
1036
+ readFileSync as readFileSync3,
1037
+ statSync as statSync2
1038
+ } from "node:fs";
1039
+ import { join as join2, relative as relative2 } from "node:path";
1040
+ import { isDeepStrictEqual } from "node:util";
1041
+ var noThrow = { throwIfNoEntry: false };
1042
+ var entryName = /^([0-9a-f]{128})(?:\.json|\.copied)?$/;
1043
+ var relPath = (from, to) => relative2(from, to).replace(/\\/g, "/");
1044
+ var storeEntryNames = (root) => {
1045
+ let names;
1046
+ try {
1047
+ names = readdirSync(root);
1048
+ } catch {
1049
+ return [];
1050
+ }
1051
+ const hexes = /* @__PURE__ */ new Set();
1052
+ for (const name2 of names) {
1053
+ const hex = entryName.exec(name2)?.[1];
1054
+ if (hex) hexes.add(hex);
889
1055
  }
1056
+ return [...hexes].sort();
890
1057
  };
1058
+ var storeCopiedPath = (storeEntry) => storeEntry + ".copied";
1059
+ var markStoreEntryCopied = (storeEntry) => {
1060
+ try {
1061
+ closeSync(openSync(storeCopiedPath(storeEntry), "wx"));
1062
+ } catch {
1063
+ }
1064
+ };
1065
+ var removeStoreEntry = (storeEntry) => {
1066
+ rimrafSync(storeEntry);
1067
+ rimrafSync(storeIndexPath(storeEntry));
1068
+ rimrafSync(storeCopiedPath(storeEntry));
1069
+ };
1070
+ var storeEntryTime = (storeEntry) => (statSync2(storeIndexPath(storeEntry), noThrow) ?? statSync2(storeEntry, noThrow))?.mtimeMs ?? 0;
1071
+ var storeEntryCopied = (storeEntry, index = readStoreIndex(storeEntry)) => !!index && (index.scripts || !!lstatSync2(storeCopiedPath(storeEntry), noThrow)) && !!lstatSync2(storeEntry, noThrow)?.isDirectory();
1072
+ var storeEntryLinked = (storeEntry, index = readStoreIndex(storeEntry)) => !!index?.files.some(
1073
+ ([p]) => (lstatSync2(join2(storeEntry, p), noThrow)?.nlink ?? 1) > 1
1074
+ );
1075
+ var indexKeys = [
1076
+ "v",
1077
+ "files",
1078
+ "dirs",
1079
+ "scripts",
1080
+ "bins",
1081
+ "name",
1082
+ "version"
1083
+ ];
1084
+ var verifyStoreEntry = (storeEntry, tarData) => {
1085
+ let layout;
1086
+ try {
1087
+ layout = storeLayout(tarData, storeEntry);
1088
+ } catch {
1089
+ return "bad tarball";
1090
+ }
1091
+ const index = readStoreIndex(storeEntry);
1092
+ if (!index) return "no index";
1093
+ if (indexKeys.some(
1094
+ (k) => !isDeepStrictEqual(index[k], layout.index[k])
1095
+ ) || index.manifest !== void 0 && index.manifest !== layout.index.manifest) {
1096
+ return "index differs";
1097
+ }
1098
+ const found = /* @__PURE__ */ new Set();
1099
+ try {
1100
+ for (const d of readdirSync(storeEntry, {
1101
+ recursive: true,
1102
+ withFileTypes: true
1103
+ })) {
1104
+ if (!d.isDirectory()) {
1105
+ found.add(relPath(storeEntry, join2(d.parentPath, d.name)));
1106
+ }
1107
+ }
1108
+ } catch {
1109
+ return "missing";
1110
+ }
1111
+ const modes = process.platform !== "win32";
1112
+ for (const f of layout.files) {
1113
+ const p = relPath(storeEntry, f.path);
1114
+ if (!found.delete(p)) return `missing ${p}`;
1115
+ let body;
1116
+ let mode;
1117
+ try {
1118
+ mode = statSync2(f.path).mode;
1119
+ body = readFileSync3(f.path);
1120
+ } catch {
1121
+ return `unreadable ${p}`;
1122
+ }
1123
+ if (!body.equals(f.body)) return `modified ${p}`;
1124
+ if (modes && (mode & 73) !== 0 !== f.executable) {
1125
+ return `mode ${p}`;
1126
+ }
1127
+ }
1128
+ const [extra] = found;
1129
+ return extra === void 0 ? void 0 : `extra ${extra}`;
1130
+ };
1131
+
891
1132
  export {
892
- Pool,
893
- unpack
1133
+ storeIndexPath,
1134
+ readStoreIndex,
1135
+ unpack,
1136
+ unpackSync,
1137
+ unpackParallel,
1138
+ unpackFileParallel,
1139
+ unpackFileSync,
1140
+ tmpName,
1141
+ unpackToStoreSync,
1142
+ storeEntryNames,
1143
+ storeCopiedPath,
1144
+ markStoreEntryCopied,
1145
+ removeStoreEntry,
1146
+ storeEntryTime,
1147
+ storeEntryCopied,
1148
+ storeEntryLinked,
1149
+ verifyStoreEntry
894
1150
  };
@@ -13,10 +13,10 @@ import {
13
13
  actual,
14
14
  callLimit,
15
15
  createVirtualRoot
16
- } from "./chunk-JZJWASXL.js";
16
+ } from "./chunk-J2WL3A3C.js";
17
17
  import {
18
18
  SecurityArchive
19
- } from "./chunk-DF5K4CYR.js";
19
+ } from "./chunk-JFHEXCG5.js";
20
20
  import {
21
21
  error
22
22
  } from "./chunk-WZWDS3W4.js";
@@ -140,7 +140,7 @@ var reloadConfig = async (folder) => {
140
140
  unload("project");
141
141
  } catch {
142
142
  }
143
- const { Config } = await import("./config-VYOTYBGS.js");
143
+ const { Config } = await import("./config-HFF6XDCV.js");
144
144
  return Config.load(folder, process.argv, true);
145
145
  };
146
146
 
@@ -12,7 +12,7 @@ var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  isError,
14
14
  isObject
15
- } from "./chunk-VFBCWAOC.js";
15
+ } from "./chunk-RH2Y7MPW.js";
16
16
 
17
17
  // ../../src/output/src/error.ts
18
18
  var parseError = (err) => {
@@ -15,14 +15,14 @@ import {
15
15
  pairsToRecords,
16
16
  registrySelectionFields,
17
17
  registrySelectors
18
- } from "./chunk-6FT6K5YN.js";
18
+ } from "./chunk-YZWFWSY7.js";
19
19
  import {
20
20
  normalizeRegistryURL
21
- } from "./chunk-2PWSMJD7.js";
21
+ } from "./chunk-D2LEK7VS.js";
22
22
  import {
23
23
  getCommand,
24
24
  isRecordField
25
- } from "./chunk-CEHPRPGQ.js";
25
+ } from "./chunk-ENSGPOLR.js";
26
26
  import {
27
27
  find
28
28
  } from "./chunk-HTOTG4TS.js";
@@ -33,7 +33,7 @@ import {
33
33
  defaultRegistries,
34
34
  defaultRegistryName,
35
35
  isObject
36
- } from "./chunk-VFBCWAOC.js";
36
+ } from "./chunk-RH2Y7MPW.js";
37
37
  import {
38
38
  error
39
39
  } from "./chunk-WZWDS3W4.js";
@@ -14,7 +14,7 @@ import {
14
14
  } from "./chunk-WGDTG44V.js";
15
15
  import {
16
16
  commandAliases
17
- } from "./chunk-CEHPRPGQ.js";
17
+ } from "./chunk-ENSGPOLR.js";
18
18
 
19
19
  // ../../node_modules/.vlt/~npm~package-json-from-dist@1.0.1/node_modules/package-json-from-dist/dist/esm/index.js
20
20
  import { readFileSync } from "node:fs";
@@ -107,7 +107,7 @@ var commandHelp = {
107
107
  defaultOrder: 4
108
108
  },
109
109
  cache: {
110
- args: "[add|ls|info|clean|delete|delete-before|delete-all]",
110
+ args: "[add|ls|info|clean|delete|delete-before|delete-all|verify|prune-store]",
111
111
  desc: "Manage the package cache"
112
112
  },
113
113
  ci: {
@@ -14,7 +14,7 @@ import {
14
14
  defaultRegistryName,
15
15
  isErrorWithCause,
16
16
  isObject
17
- } from "./chunk-VFBCWAOC.js";
17
+ } from "./chunk-RH2Y7MPW.js";
18
18
  import {
19
19
  error
20
20
  } from "./chunk-WZWDS3W4.js";
@@ -1164,6 +1164,12 @@ var recordFields = [
1164
1164
  "jsr-registries"
1165
1165
  ];
1166
1166
  var isRecordField = (s) => recordFields.includes(s);
1167
+ var storeLinkers = [
1168
+ "auto",
1169
+ "hardlink",
1170
+ "copy",
1171
+ "unpack"
1172
+ ];
1167
1173
  var j2 = jack({
1168
1174
  envPrefix: "VLT",
1169
1175
  allowPositionals: true,
@@ -1357,6 +1363,32 @@ var definition = j2.heading("Configuration").description(
1357
1363
  `,
1358
1364
  default: cacheDir
1359
1365
  },
1366
+ "store-linker": {
1367
+ hint: "auto | hardlink | copy | unpack",
1368
+ description: `How packages are placed in \`node_modules\`. Every
1369
+ linker but \`unpack\` fills a global store under
1370
+ \`cache\` in the background, then places packages
1371
+ from it.
1372
+
1373
+ - auto: Default. On Linux, hardlink from the global
1374
+ store, copying any file that cannot be linked.
1375
+ Elsewhere, same as \`unpack\`: a hardlink is the
1376
+ slowest way to place a file on APFS, so macOS and
1377
+ Windows unpack by default.
1378
+ - hardlink: Hardlink from the global store on every
1379
+ platform.
1380
+ - copy: Copy from the global store. Use this when
1381
+ editing files in \`node_modules\` in place, since
1382
+ a hardlink shares its content with every project.
1383
+ - unpack: Unpack each package tarball, skipping the
1384
+ global store.
1385
+
1386
+ Packages with install scripts are always copied.
1387
+ An invalid \`VLT_STORE_LINKER\` warns and uses
1388
+ \`unpack\`.`,
1389
+ validOptions: storeLinkers,
1390
+ default: "auto"
1391
+ },
1360
1392
  tag: {
1361
1393
  description: `Default \`dist-tag\` to install or publish`,
1362
1394
  default: "latest"
@@ -1748,6 +1780,19 @@ var definition = j2.heading("Configuration").description(
1748
1780
  },
1749
1781
  "lockfile-only": {
1750
1782
  description: "Only update the lockfile (vlt-lock.json) and package.json files, skip all node_modules operations including package extraction and filesystem changes."
1783
+ },
1784
+ "brotli-tarballs": {
1785
+ description: `Resolve to the Brotli (\`.tar.br\`) tarball when the
1786
+ registry advertises one for a version, transferring far
1787
+ less than the gzip \`.tgz\`.
1788
+
1789
+ The \`.tar.br\` is its own artifact and hashes
1790
+ differently, so a version installed this way records that
1791
+ hash in \`vlt-lock.json\`. An existing lockfile keeps
1792
+ whichever artifact it already pinned; set
1793
+ \`--no-brotli-tarballs\` before resolving to pin the
1794
+ \`.tgz\` instead.`,
1795
+ default: true
1751
1796
  }
1752
1797
  }).opt({
1753
1798
  "allow-scripts": {
@@ -1847,6 +1892,7 @@ export {
1847
1892
  getCommand,
1848
1893
  recordFields,
1849
1894
  isRecordField,
1895
+ storeLinkers,
1850
1896
  definition,
1851
1897
  defaultValues,
1852
1898
  getSortedCliOptions,
@@ -11,26 +11,26 @@ import {createRequire as _vlt_createRequire} from "node:module";
11
11
  var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  PackageInfoClient
14
- } from "./chunk-LN2A74PF.js";
14
+ } from "./chunk-SVMH3NDM.js";
15
15
  import {
16
16
  findCmdShimIfExists,
17
17
  install
18
- } from "./chunk-JZJWASXL.js";
18
+ } from "./chunk-J2WL3A3C.js";
19
19
  import {
20
20
  PathScurry
21
- } from "./chunk-X2AWQGYG.js";
21
+ } from "./chunk-P4LLYWCG.js";
22
22
  import {
23
23
  Spec
24
- } from "./chunk-XKVU23NC.js";
24
+ } from "./chunk-V7EQZOO5.js";
25
25
  import {
26
26
  walkUp
27
27
  } from "./chunk-HTOTG4TS.js";
28
- import {
29
- parseScope
30
- } from "./chunk-VFBCWAOC.js";
31
28
  import {
32
29
  XDG
33
30
  } from "./chunk-XNLSTHDK.js";
31
+ import {
32
+ parseScope
33
+ } from "./chunk-RH2Y7MPW.js";
34
34
  import {
35
35
  error
36
36
  } from "./chunk-WZWDS3W4.js";
@@ -200,7 +200,7 @@ var vlxInstall = async (spec, options, promptFn) => {
200
200
  resolve3(dir, "package.json"),
201
201
  JSON.stringify(manifest, null, 2) + "\n"
202
202
  );
203
- await install({
203
+ const { graph } = await install({
204
204
  ...options,
205
205
  packageInfo,
206
206
  projectRoot: dir,
@@ -209,6 +209,14 @@ var vlxInstall = async (spec, options, promptFn) => {
209
209
  // allow lifecycle scripts but filter out malware via security archive
210
210
  allowScripts: ":scripts:not(:malware)"
211
211
  });
212
+ const installed = graph.mainImporter.edgesOut.get(pkgSpec.name)?.to;
213
+ if (!manifest.vlx.integrity && installed?.integrity) {
214
+ manifest.vlx.integrity = installed.integrity;
215
+ await writeFile(
216
+ resolve3(dir, "package.json"),
217
+ JSON.stringify(manifest, null, 2) + "\n"
218
+ );
219
+ }
212
220
  return vlxInfo(dir, options, manifest);
213
221
  };
214
222