@vltpkg/cli-js 1.1.0 → 1.2.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 (84) hide show
  1. package/{access-GLWBGQLN.js → access-FTHPFPUJ.js} +8 -8
  2. package/{bugs-OCQYFWFE.js → bugs-QS6HQUO2.js} +17 -17
  3. package/{build-CPWGNTCM.js → build-H27SXMAS.js} +11 -11
  4. package/{cache-SL7DQMY2.js → cache-IB4HMFDT.js} +143 -14
  5. package/cache-unzip-src-unzip.js +2934 -164
  6. package/{chunk-TXTK2PKN.js → chunk-3CUFJPBK.js} +1 -1
  7. package/{chunk-CBASIDQH.js → chunk-55DYW2MP.js} +1 -1
  8. package/{chunk-J2XWQVDK.js → chunk-5BD4QGW2.js} +25 -7
  9. package/{chunk-WE2TQN32.js → chunk-5PP77V44.js} +2 -2
  10. package/{chunk-CTQSUNNE.js → chunk-5YB6UIC3.js} +247 -37
  11. package/{chunk-CEHPRPGQ.js → chunk-6A3XS52F.js} +33 -0
  12. package/{chunk-X2AWQGYG.js → chunk-6G7MTZGS.js} +6 -6
  13. package/{chunk-YKCGWKUE.js → chunk-7KFMQ3BR.js} +16 -8
  14. package/{chunk-47M7IZ5P.js → chunk-B2FK2HHL.js} +88 -60
  15. package/{chunk-ZDQJWRCU.js → chunk-FOJCK57G.js} +9 -13
  16. package/{chunk-S6Y57MUS.js → chunk-FSZF2RSQ.js} +4 -4
  17. package/{chunk-VFBCWAOC.js → chunk-G5BSQ6DP.js} +7 -0
  18. package/{chunk-XKVU23NC.js → chunk-G5NJ7CYI.js} +1 -1
  19. package/{chunk-HYCYL4RX.js → chunk-GUATFMMU.js} +37 -5
  20. package/chunk-JTUZP2OD.js +91 -0
  21. package/{chunk-2IMBYPYC.js → chunk-LD4BQJBG.js} +4 -4
  22. package/{chunk-BUXPKRYB.js → chunk-LEGPLJWK.js} +5 -5
  23. package/{chunk-CF5EGH4W.js → chunk-LKQ5R4VX.js} +4 -4
  24. package/{chunk-JSQUYHU7.js → chunk-NJZSCUD4.js} +3 -3
  25. package/{chunk-2PWSMJD7.js → chunk-O44Z6MAV.js} +1 -1
  26. package/{chunk-GJGQTRAT.js → chunk-OE6VHHN4.js} +220 -141
  27. package/{src-MOKZQTH2.js → chunk-QA6RE2GS.js} +249 -28
  28. package/chunk-SPRVRSEL.js +75 -0
  29. package/{chunk-YOE3VZFX.js → chunk-SYGF27W7.js} +2 -2
  30. package/{chunk-TNEMFBP5.js → chunk-UNWQVOLY.js} +14 -12
  31. package/{chunk-SNOBGFNM.js → chunk-UQUIO7LW.js} +47 -6
  32. package/{chunk-TUXWDPCQ.js → chunk-VHHLO5L6.js} +1 -1
  33. package/{chunk-6LEMBT22.js → chunk-YFNQ6HZ3.js} +3 -3
  34. package/{chunk-GDJ7JT2R.js → chunk-YTT3UHUB.js} +1 -1
  35. package/{ci-O2RSLTBX.js → ci-XJBYXFFJ.js} +10 -10
  36. package/cli-package.json +2 -1
  37. package/{config-ZPH7V77F.js → config-4Y46SH5K.js} +8 -8
  38. package/{config-ZBIF32GS.js → config-H2Q4ABSS.js} +12 -12
  39. package/{create-2JX4RV5U.js → create-LUYL2QI4.js} +18 -18
  40. package/{deprecate-XJLP2TUW.js → deprecate-5ANCI2L6.js} +13 -13
  41. package/{dist-tag-F6ZFWGQU.js → dist-tag-SD2CRWIL.js} +8 -8
  42. package/{docs-IJCZZ4V6.js → docs-B6LVNWTP.js} +17 -17
  43. package/{exec-IWSS2LUA.js → exec-CJ5KQA72.js} +18 -18
  44. package/{exec-cache-AG77OOEE.js → exec-cache-EE7DAOW2.js} +16 -16
  45. package/{exec-local-QXPWC4QG.js → exec-local-HT3VBN6S.js} +15 -15
  46. package/{help-TGNDNWLP.js → help-GZ44WYDS.js} +4 -5
  47. package/{init-WU7BRPKR.js → init-HVXRXFVY.js} +10 -10
  48. package/{install-74XKB5N7.js → install-E2C7EE6P.js} +16 -16
  49. package/{list-TOEC6Q3A.js → list-V4V6SHJP.js} +18 -18
  50. package/{login-WJYMAFSL.js → login-VRFV7MCE.js} +12 -12
  51. package/{logout-MTRQWI3L.js → logout-SU75R7BN.js} +8 -8
  52. package/{pack-FFWGLSNC.js → pack-IVGKUXTL.js} +11 -11
  53. package/package.json +1 -1
  54. package/{ping-DWUVTCJB.js → ping-WB222SDT.js} +8 -8
  55. package/{pkg-KNZW5FIA.js → pkg-LAAFNONA.js} +11 -11
  56. package/{profile-6W2ABNXL.js → profile-P3AVHRDI.js} +8 -8
  57. package/{publish-HGNUONU3.js → publish-IUNB3KH5.js} +17 -17
  58. package/{query-FSCYPETX.js → query-XCN55INS.js} +18 -18
  59. package/{registry-YTJZ3AQD.js → registry-QQLWJHJI.js} +5 -5
  60. package/registry-client-src-revalidate.js +5971 -5817
  61. package/{repo-OVIKYYWA.js → repo-BQDWUCX5.js} +17 -17
  62. package/{reporter-ZW7OMRZT.js → reporter-5BVUNWQ6.js} +13 -13
  63. package/{run-UPV3RPQJ.js → run-QT7DX243.js} +15 -15
  64. package/{run-exec-YJSMWMMP.js → run-exec-XYUI7GLN.js} +15 -15
  65. package/security-archive-src-update-expired.js +97 -63
  66. package/{setup-7DPMAPUY.js → setup-CXDJXRAG.js} +40 -22
  67. package/{src-XJT4IJSV.js → src-2BUT4WYP.js} +10 -7
  68. package/src-OKMGXMAD.js +212 -0
  69. package/{src-BNCFK4FH.js → src-UBAERP25.js} +16 -17
  70. package/{token-GA73ER5V.js → token-CBOK6DMT.js} +8 -8
  71. package/{uninstall-E3VKSC3B.js → uninstall-27VP46KJ.js} +12 -12
  72. package/{unpublish-Q6MQHBPQ.js → unpublish-F4637OQX.js} +8 -8
  73. package/{update-4CC44TR5.js → update-NGWLJJ22.js} +15 -15
  74. package/{version-CRZBXNDG.js → version-WPD2KNVC.js} +13 -13
  75. package/{view-ILUULGSO.js → view-YKFTRRPD.js} +11 -11
  76. package/vlr.js +1 -1
  77. package/vlrx.js +1 -1
  78. package/vlt.js +1 -1
  79. package/vlx.js +1 -1
  80. package/vlxl.js +1 -1
  81. package/{whoami-Z4TSLYTR.js → whoami-I5Q6RTAP.js} +8 -8
  82. package/chunk-A75UYRJC.js +0 -75
  83. package/chunk-E74WGW5C.js +0 -49
  84. package/registry-client-package.json +0 -80
@@ -13,19 +13,78 @@ import {
13
13
  rimraf,
14
14
  rimrafSync
15
15
  } from "./chunk-BHJT53TP.js";
16
- import "./chunk-VE6CCH33.js";
16
+ import {
17
+ isManifest,
18
+ normalizeBinPaths
19
+ } from "./chunk-G5BSQ6DP.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
90
  import { lstat, mkdir, rename, writeFile } from "node:fs/promises";
@@ -33,6 +92,7 @@ import {
33
92
  basename as basename2,
34
93
  dirname,
35
94
  isAbsolute,
95
+ join,
36
96
  relative,
37
97
  resolve,
38
98
  sep
@@ -688,7 +748,7 @@ var unpackSync = (tarData, target) => {
688
748
  const isGzip = tarData[0] === 31 && tarData[1] === 139;
689
749
  unpackUnzippedSync(isGzip ? unzipSync(tarData) : tarData, target);
690
750
  };
691
- var unpackFileSync = (file, target, offset = 0) => unpackSync(readFileSync(file).subarray(offset), target);
751
+ var unpackFileSync = (file, target, offset = 0) => unpackSync(readFileSync2(file).subarray(offset), target);
692
752
  var tmpName = (target) => dirname(target) + sep + "." + basename2(target) + "." + tmpSuffix();
693
753
  var parseTarball = (buffer, tmp2) => {
694
754
  const isGzip = buffer[0] === 31 && buffer[1] === 139;
@@ -863,32 +923,193 @@ var unpackUnzippedSync = (buffer, target) => {
863
923
  }
864
924
  }
865
925
  };
926
+ var storeLayout = (tarData, dir) => {
927
+ const isGzip = tarData[0] === 31 && tarData[1] === 139;
928
+ const { dirs, files } = parseTarball(
929
+ isGzip ? unzipSync(tarData) : tarData,
930
+ dir
931
+ );
932
+ const rel = (p) => relative(dir, p).replace(/\\/g, "/");
933
+ const list = files.map((f) => [rel(f.path), f]);
934
+ const pj = list.find(([p]) => p === "package.json")?.[1];
935
+ if (!pj) throw error("no package.json in tarball", { path: dir });
936
+ const manifest = storeIndexManifest(
937
+ pj.body,
938
+ list.some(([p]) => p === "binding.gyp")
939
+ );
940
+ const bins = new Set(
941
+ Object.values(manifest.bins ?? {}).map(entryKey)
942
+ );
943
+ const indexFiles = [];
944
+ const binFiles = [];
945
+ for (const [p, f] of list) {
946
+ if (bins.has(entryKey(p))) {
947
+ f.executable = true;
948
+ binFiles.push(f.path);
949
+ }
950
+ indexFiles.push([p, f.body.length, f.executable ? 1 : 0]);
951
+ }
952
+ const allDirs = /* @__PURE__ */ new Set();
953
+ for (const d of dirs) {
954
+ for (let p = rel(d); p && !allDirs.has(p); ) {
955
+ allDirs.add(p);
956
+ p = p.slice(0, Math.max(0, p.lastIndexOf("/")));
957
+ }
958
+ }
959
+ const indexDirs = [...allDirs].sort().sort((a, b) => a.length - b.length);
960
+ return {
961
+ index: {
962
+ v: 1,
963
+ files: indexFiles.sort((a, b) => a[0] < b[0] ? -1 : 1),
964
+ dirs: indexDirs,
965
+ ...manifest
966
+ },
967
+ files,
968
+ binFiles
969
+ };
970
+ };
971
+ var unpackToStoreSync = (tarData, dir) => {
972
+ const { index, files, binFiles } = storeLayout(tarData, dir);
973
+ mkdirSync(dirname(dir), { recursive: true });
974
+ mkdirSync(dir, { mode: 511 });
975
+ let succeeded = false;
976
+ try {
977
+ for (const d of index.dirs) {
978
+ mkdirSync(join(dir, d), { recursive: true, mode: 511 });
979
+ }
980
+ for (const f of files) {
981
+ writeFileSync(f.path, f.body, {
982
+ mode: f.executable ? 511 : 438
983
+ });
984
+ }
985
+ let binMode = 0;
986
+ for (const p of binFiles) {
987
+ binMode ||= statSync(p).mode & 511 | 73;
988
+ chmodSync(p, binMode);
989
+ }
990
+ succeeded = true;
991
+ } finally {
992
+ if (!succeeded) rimrafSync(dir);
993
+ }
994
+ return { index };
995
+ };
866
996
 
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);
997
+ // ../../src/tar/src/store-entry.ts
998
+ import {
999
+ closeSync,
1000
+ lstatSync as lstatSync2,
1001
+ openSync,
1002
+ readdirSync,
1003
+ readFileSync as readFileSync3,
1004
+ statSync as statSync2
1005
+ } from "node:fs";
1006
+ import { join as join2, relative as relative2 } from "node:path";
1007
+ import { isDeepStrictEqual } from "node:util";
1008
+ var noThrow = { throwIfNoEntry: false };
1009
+ var entryName = /^([0-9a-f]{128})(?:\.json|\.copied)?$/;
1010
+ var relPath = (from, to) => relative2(from, to).replace(/\\/g, "/");
1011
+ var storeEntryNames = (root) => {
1012
+ let names;
1013
+ try {
1014
+ names = readdirSync(root);
1015
+ } catch {
1016
+ return [];
1017
+ }
1018
+ const hexes = /* @__PURE__ */ new Set();
1019
+ for (const name2 of names) {
1020
+ const hex = entryName.exec(name2)?.[1];
1021
+ if (hex) hexes.add(hex);
1022
+ }
1023
+ return [...hexes].sort();
1024
+ };
1025
+ var storeCopiedPath = (storeEntry) => storeEntry + ".copied";
1026
+ var markStoreEntryCopied = (storeEntry) => {
1027
+ try {
1028
+ closeSync(openSync(storeCopiedPath(storeEntry), "wx"));
1029
+ } catch {
889
1030
  }
890
1031
  };
1032
+ var removeStoreEntry = (storeEntry) => {
1033
+ rimrafSync(storeEntry);
1034
+ rimrafSync(storeIndexPath(storeEntry));
1035
+ rimrafSync(storeCopiedPath(storeEntry));
1036
+ };
1037
+ var storeEntryTime = (storeEntry) => (statSync2(storeIndexPath(storeEntry), noThrow) ?? statSync2(storeEntry, noThrow))?.mtimeMs ?? 0;
1038
+ var storeEntryCopied = (storeEntry, index = readStoreIndex(storeEntry)) => !!index && (index.scripts || !!lstatSync2(storeCopiedPath(storeEntry), noThrow)) && !!lstatSync2(storeEntry, noThrow)?.isDirectory();
1039
+ var storeEntryLinked = (storeEntry, index = readStoreIndex(storeEntry)) => !!index?.files.some(
1040
+ ([p]) => (lstatSync2(join2(storeEntry, p), noThrow)?.nlink ?? 1) > 1
1041
+ );
1042
+ var indexKeys = [
1043
+ "v",
1044
+ "files",
1045
+ "dirs",
1046
+ "scripts",
1047
+ "bins",
1048
+ "name",
1049
+ "version"
1050
+ ];
1051
+ var verifyStoreEntry = (storeEntry, tarData) => {
1052
+ let layout;
1053
+ try {
1054
+ layout = storeLayout(tarData, storeEntry);
1055
+ } catch {
1056
+ return "bad tarball";
1057
+ }
1058
+ const index = readStoreIndex(storeEntry);
1059
+ if (!index) return "no index";
1060
+ if (indexKeys.some(
1061
+ (k) => !isDeepStrictEqual(index[k], layout.index[k])
1062
+ ) || index.manifest !== void 0 && index.manifest !== layout.index.manifest) {
1063
+ return "index differs";
1064
+ }
1065
+ const found = /* @__PURE__ */ new Set();
1066
+ try {
1067
+ for (const d of readdirSync(storeEntry, {
1068
+ recursive: true,
1069
+ withFileTypes: true
1070
+ })) {
1071
+ if (!d.isDirectory()) {
1072
+ found.add(relPath(storeEntry, join2(d.parentPath, d.name)));
1073
+ }
1074
+ }
1075
+ } catch {
1076
+ return "missing";
1077
+ }
1078
+ const modes = process.platform !== "win32";
1079
+ for (const f of layout.files) {
1080
+ const p = relPath(storeEntry, f.path);
1081
+ if (!found.delete(p)) return `missing ${p}`;
1082
+ let body;
1083
+ let mode;
1084
+ try {
1085
+ mode = statSync2(f.path).mode;
1086
+ body = readFileSync3(f.path);
1087
+ } catch {
1088
+ return `unreadable ${p}`;
1089
+ }
1090
+ if (!body.equals(f.body)) return `modified ${p}`;
1091
+ if (modes && (mode & 73) !== 0 !== f.executable) {
1092
+ return `mode ${p}`;
1093
+ }
1094
+ }
1095
+ const [extra] = found;
1096
+ return extra === void 0 ? void 0 : `extra ${extra}`;
1097
+ };
1098
+
891
1099
  export {
892
- Pool,
893
- unpack
1100
+ storeIndexPath,
1101
+ readStoreIndex,
1102
+ unpack,
1103
+ unpackSync,
1104
+ unpackFileSync,
1105
+ tmpName,
1106
+ unpackToStoreSync,
1107
+ storeEntryNames,
1108
+ storeCopiedPath,
1109
+ markStoreEntryCopied,
1110
+ removeStoreEntry,
1111
+ storeEntryTime,
1112
+ storeEntryCopied,
1113
+ storeEntryLinked,
1114
+ verifyStoreEntry
894
1115
  };
@@ -0,0 +1,75 @@
1
+ var global = globalThis;
2
+ import {Buffer} from "node:buffer";
3
+ import {setTimeout as _vlt_setTimeout,clearTimeout as _vlt_clearTimeout,setImmediate as _vlt_setImmediate,clearImmediate as _vlt_clearImmediate,setInterval as _vlt_setInterval,clearInterval as _vlt_clearInterval} from "node:timers";
4
+ globalThis.setTimeout = _vlt_setTimeout;
5
+ globalThis.clearTimeout = _vlt_clearTimeout;
6
+ globalThis.setImmediate = _vlt_setImmediate;
7
+ globalThis.clearImmediate = _vlt_clearImmediate;
8
+ globalThis.setInterval = _vlt_setInterval;
9
+ globalThis.clearInterval = _vlt_clearInterval;
10
+ import {createRequire as _vlt_createRequire} from "node:module";
11
+ var require = _vlt_createRequire(import.meta.filename);
12
+ import {
13
+ error
14
+ } from "./chunk-WZWDS3W4.js";
15
+ import {
16
+ __glob
17
+ } from "./chunk-PZLD7RTK.js";
18
+
19
+ // import("./commands/**/*.ts") in ../../src/cli-sdk/src/load-command.ts
20
+ var globImport_commands_ts = __glob({
21
+ "./commands/access.ts": () => import("./access-FTHPFPUJ.js"),
22
+ "./commands/bugs.ts": () => import("./bugs-QS6HQUO2.js"),
23
+ "./commands/build.ts": () => import("./build-H27SXMAS.js"),
24
+ "./commands/cache.ts": () => import("./cache-IB4HMFDT.js"),
25
+ "./commands/ci.ts": () => import("./ci-XJBYXFFJ.js"),
26
+ "./commands/config.ts": () => import("./config-H2Q4ABSS.js"),
27
+ "./commands/create.ts": () => import("./create-LUYL2QI4.js"),
28
+ "./commands/deprecate.ts": () => import("./deprecate-5ANCI2L6.js"),
29
+ "./commands/dist-tag.ts": () => import("./dist-tag-SD2CRWIL.js"),
30
+ "./commands/docs.ts": () => import("./docs-B6LVNWTP.js"),
31
+ "./commands/exec-cache.ts": () => import("./exec-cache-EE7DAOW2.js"),
32
+ "./commands/exec-local.ts": () => import("./exec-local-HT3VBN6S.js"),
33
+ "./commands/exec.ts": () => import("./exec-CJ5KQA72.js"),
34
+ "./commands/help.ts": () => import("./help-GZ44WYDS.js"),
35
+ "./commands/init.ts": () => import("./init-HVXRXFVY.js"),
36
+ "./commands/install.ts": () => import("./install-E2C7EE6P.js"),
37
+ "./commands/install/reporter.ts": () => import("./reporter-5BVUNWQ6.js"),
38
+ "./commands/list.ts": () => import("./list-V4V6SHJP.js"),
39
+ "./commands/login.ts": () => import("./login-VRFV7MCE.js"),
40
+ "./commands/logout.ts": () => import("./logout-SU75R7BN.js"),
41
+ "./commands/pack.ts": () => import("./pack-IVGKUXTL.js"),
42
+ "./commands/ping.ts": () => import("./ping-WB222SDT.js"),
43
+ "./commands/pkg.ts": () => import("./pkg-LAAFNONA.js"),
44
+ "./commands/profile.ts": () => import("./profile-P3AVHRDI.js"),
45
+ "./commands/publish.ts": () => import("./publish-IUNB3KH5.js"),
46
+ "./commands/query.ts": () => import("./query-XCN55INS.js"),
47
+ "./commands/registry.ts": () => import("./registry-QQLWJHJI.js"),
48
+ "./commands/repo.ts": () => import("./repo-BQDWUCX5.js"),
49
+ "./commands/run-exec.ts": () => import("./run-exec-XYUI7GLN.js"),
50
+ "./commands/run.ts": () => import("./run-QT7DX243.js"),
51
+ "./commands/setup.ts": () => import("./setup-CXDJXRAG.js"),
52
+ "./commands/token.ts": () => import("./token-CBOK6DMT.js"),
53
+ "./commands/uninstall.ts": () => import("./uninstall-27VP46KJ.js"),
54
+ "./commands/unpublish.ts": () => import("./unpublish-F4637OQX.js"),
55
+ "./commands/update.ts": () => import("./update-NGWLJJ22.js"),
56
+ "./commands/version.ts": () => import("./version-WPD2KNVC.js"),
57
+ "./commands/view.ts": () => import("./view-YKFTRRPD.js"),
58
+ "./commands/whoami.ts": () => import("./whoami-I5Q6RTAP.js")
59
+ });
60
+
61
+ // ../../src/cli-sdk/src/load-command.ts
62
+ var loadCommand = async (command) => {
63
+ try {
64
+ return await globImport_commands_ts(`./commands/${command}.ts`);
65
+ } catch (e) {
66
+ throw error("Could not load command", {
67
+ found: command,
68
+ cause: e
69
+ });
70
+ }
71
+ };
72
+
73
+ export {
74
+ loadCommand
75
+ };
@@ -11,12 +11,12 @@ import {createRequire as _vlt_createRequire} from "node:module";
11
11
  var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  Spec as Spec2
14
- } from "./chunk-XKVU23NC.js";
14
+ } from "./chunk-G5NJ7CYI.js";
15
15
  import {
16
16
  Spec,
17
17
  currentDefaultRegistryName,
18
18
  defaultRegistryName
19
- } from "./chunk-VFBCWAOC.js";
19
+ } from "./chunk-G5BSQ6DP.js";
20
20
  import {
21
21
  error
22
22
  } from "./chunk-WZWDS3W4.js";
@@ -12,7 +12,7 @@ var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  generateDefaultHelp,
14
14
  generateFullHelp
15
- } from "./chunk-HYCYL4RX.js";
15
+ } from "./chunk-GUATFMMU.js";
16
16
  import {
17
17
  flush,
18
18
  trackCommand,
@@ -20,13 +20,13 @@ import {
20
20
  } from "./chunk-G2YT2GWF.js";
21
21
  import {
22
22
  parseError
23
- } from "./chunk-GDJ7JT2R.js";
23
+ } from "./chunk-YTT3UHUB.js";
24
24
  import {
25
25
  hasConfiguredRegistry,
26
26
  hasNpmRegistry,
27
27
  missingNpmRegistryError,
28
28
  missingRegistryError
29
- } from "./chunk-2PWSMJD7.js";
29
+ } from "./chunk-O44Z6MAV.js";
30
30
  import {
31
31
  isLazyView,
32
32
  isViewClass,
@@ -35,20 +35,20 @@ import {
35
35
  import {
36
36
  isGraphRunError,
37
37
  splitDepID
38
- } from "./chunk-YOE3VZFX.js";
38
+ } from "./chunk-SYGF27W7.js";
39
39
  import {
40
40
  defaultView
41
- } from "./chunk-CEHPRPGQ.js";
41
+ } from "./chunk-6A3XS52F.js";
42
42
  import {
43
43
  emitter
44
44
  } from "./chunk-U7TEQCBN.js";
45
- import {
46
- isErrorWithCause,
47
- isObject
48
- } from "./chunk-VFBCWAOC.js";
49
45
  import {
50
46
  XDG
51
47
  } from "./chunk-XNLSTHDK.js";
48
+ import {
49
+ isErrorWithCause,
50
+ isObject
51
+ } from "./chunk-G5BSQ6DP.js";
52
52
 
53
53
  // ../../src/cli-sdk/src/print-err.ts
54
54
  import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
@@ -64,7 +64,7 @@ var formatURL = (v, format) => v instanceof URL ? v.toString() : (
64
64
  /* c8 ignore next */
65
65
  format(v)
66
66
  );
67
- var hasCustomToString = (v) => isObject(v) && v.toString !== Object.prototype.toString;
67
+ var hasCustomToString = (v) => typeof v === "object" && v !== null && v.toString !== Object.prototype.toString;
68
68
  var formatToString = (v, format) => hasCustomToString(v) ? v.toString() : format(v);
69
69
  var formatArray = (v, format, joiner = ", ") => Array.isArray(v) ? v.join(joiner) : (
70
70
  /* c8 ignore next */
@@ -209,8 +209,9 @@ var printCode = (err, usage, stderr2, format) => {
209
209
  if (from) {
210
210
  stderr2(indent(`From: ${format(from)}`));
211
211
  }
212
- if (response) {
213
- stderr2(indent(`Response: ${format(response)}`));
212
+ const status = response?.statusCode;
213
+ if (status) {
214
+ stderr2(indent(`Status: ${format(status)}`));
214
215
  }
215
216
  return { file: true };
216
217
  }
@@ -441,6 +442,7 @@ var tagStyle = (state, statusCode) => {
441
442
  switch (state) {
442
443
  case "cache":
443
444
  case "stale":
445
+ case "store":
444
446
  case "304":
445
447
  return "green";
446
448
  case "start":
@@ -12,7 +12,7 @@ var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  asError,
14
14
  isObject
15
- } from "./chunk-VFBCWAOC.js";
15
+ } from "./chunk-G5BSQ6DP.js";
16
16
  import {
17
17
  error
18
18
  } from "./chunk-WZWDS3W4.js";
@@ -23,15 +23,18 @@ var MAX_DETAIL_LENGTH = 512;
23
23
  var truncate = (s) => s.length <= MAX_DETAIL_LENGTH ? s : `${s.slice(0, MAX_DETAIL_LENGTH - 1)}\u2026`;
24
24
  var isHTML = (s) => /^\s*(<!doctype\s+html|<html\b)/i.test(s);
25
25
  var stripTags = (s) => s.replace(/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi, " ").replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
26
- var detailFromJSON = (text) => {
26
+ var parseBody = (text) => {
27
27
  let body;
28
28
  try {
29
29
  body = JSON.parse(text);
30
30
  } catch {
31
31
  return void 0;
32
32
  }
33
- if (!body || typeof body !== "object") return void 0;
34
- const rec = body;
33
+ return !body || typeof body !== "object" ? void 0 : body;
34
+ };
35
+ var detailFromJSON = (text) => {
36
+ const rec = parseBody(text);
37
+ if (!rec) return void 0;
35
38
  const nested = rec.error;
36
39
  for (const v of [rec.error, rec.message, nested?.message]) {
37
40
  if (typeof v === "string" && v.trim()) return v.trim();
@@ -51,10 +54,41 @@ var registryErrorMessage = (response) => {
51
54
  const detail = detailFromJSON(text) ?? (isHTML(text) ? stripTags(text) : text);
52
55
  return detail ? `${status} \u2014 ${truncate(detail)}` : status;
53
56
  };
57
+ var refusals = {
58
+ TokenExpiredError: "expired",
59
+ TokenRevokedError: "revoked"
60
+ };
61
+ var accountSlug = /^(?=.{3,63}$)[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/;
62
+ var tokenRefusal = (response) => {
63
+ const res = response;
64
+ if (typeof res !== "object" || res?.statusCode !== 401)
65
+ return void 0;
66
+ let text = "";
67
+ try {
68
+ if (typeof res.text === "function") text = res.text();
69
+ } catch {
70
+ return void 0;
71
+ }
72
+ const code = parseBody(text)?.code;
73
+ return typeof code === "string" ? refusals[code] : void 0;
74
+ };
75
+ var tokenRefusalAdvice = (response, url) => {
76
+ const gone = tokenRefusal(response);
77
+ if (!gone || url === void 0) return void 0;
78
+ let account;
79
+ try {
80
+ account = new URL(String(url)).pathname.split("/")[1];
81
+ } catch {
82
+ return void 0;
83
+ }
84
+ if (!account || !accountSlug.test(account)) return void 0;
85
+ return `Your token for the "${account}" account ${gone === "expired" ? "has expired" : "was revoked"}. Run \`vlt setup ${account}\` to log in again.`;
86
+ };
54
87
  var registryError = (response, { message, url, method = "GET", advice }, from, cause) => {
55
88
  const { statusCode } = response;
56
89
  const denied = statusCode === 401 || statusCode === 403;
57
- const extra = advice?.(statusCode);
90
+ const refused = tokenRefusalAdvice(response, url);
91
+ const extra = refused ?? advice?.(statusCode);
58
92
  const tips = (Array.isArray(extra) ? extra : [extra]).filter(
59
93
  (t) => !!t
60
94
  );
@@ -122,8 +156,15 @@ var requestError = (err, { message, url, method = "GET", advice }) => {
122
156
  );
123
157
  };
124
158
 
159
+ // ../../src/registry-client/src/store-root.ts
160
+ import { resolve } from "node:path";
161
+ var storeRoot = (cache) => resolve(cache, "store", "v1");
162
+
125
163
  export {
126
164
  registryErrorMessage,
165
+ tokenRefusal,
166
+ tokenRefusalAdvice,
127
167
  assertOk,
128
- requestError
168
+ requestError,
169
+ storeRoot
129
170
  };
@@ -19,7 +19,7 @@ var run = async (command) => {
19
19
  if (command) {
20
20
  process.argv.splice(2, 0, command);
21
21
  }
22
- const vlt = await import("./src-BNCFK4FH.js");
22
+ const vlt = await import("./src-UBAERP25.js");
23
23
  await vlt.default();
24
24
  };
25
25
 
@@ -13,10 +13,10 @@ import {
13
13
  actual,
14
14
  callLimit,
15
15
  createVirtualRoot
16
- } from "./chunk-47M7IZ5P.js";
16
+ } from "./chunk-B2FK2HHL.js";
17
17
  import {
18
18
  SecurityArchive
19
- } from "./chunk-ZDQJWRCU.js";
19
+ } from "./chunk-FOJCK57G.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-ZPH7V77F.js");
143
+ const { Config } = await import("./config-4Y46SH5K.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-G5BSQ6DP.js";
16
16
 
17
17
  // ../../src/output/src/error.ts
18
18
  var parseError = (err) => {
@@ -11,25 +11,25 @@ import {createRequire as _vlt_createRequire} from "node:module";
11
11
  var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  install
14
- } from "./chunk-47M7IZ5P.js";
15
- import "./chunk-ZDQJWRCU.js";
14
+ } from "./chunk-B2FK2HHL.js";
15
+ import "./chunk-FOJCK57G.js";
16
16
  import {
17
17
  commandUsage
18
- } from "./chunk-CBASIDQH.js";
19
- import "./chunk-X2AWQGYG.js";
18
+ } from "./chunk-55DYW2MP.js";
19
+ import "./chunk-6G7MTZGS.js";
20
20
  import {
21
21
  lazyView
22
22
  } from "./chunk-4KCU2KZL.js";
23
- import "./chunk-YOE3VZFX.js";
24
- import "./chunk-XKVU23NC.js";
25
- import "./chunk-CEHPRPGQ.js";
23
+ import "./chunk-SYGF27W7.js";
24
+ import "./chunk-G5NJ7CYI.js";
25
+ import "./chunk-6A3XS52F.js";
26
26
  import "./chunk-HTOTG4TS.js";
27
- import "./chunk-E74WGW5C.js";
27
+ import "./chunk-JTUZP2OD.js";
28
28
  import "./chunk-U7TEQCBN.js";
29
- import "./chunk-VFBCWAOC.js";
30
29
  import "./chunk-XNLSTHDK.js";
31
30
  import "./chunk-BHJT53TP.js";
32
31
  import "./chunk-VE6CCH33.js";
32
+ import "./chunk-G5BSQ6DP.js";
33
33
  import "./chunk-WZWDS3W4.js";
34
34
  import "./chunk-PZLD7RTK.js";
35
35
 
@@ -59,7 +59,7 @@ var usage = () => commandUsage({
59
59
  var views = {
60
60
  json: (i) => i.graph.toJSON(),
61
61
  human: lazyView(
62
- async () => (await import("./reporter-ZW7OMRZT.js")).InstallReporter
62
+ async () => (await import("./reporter-5BVUNWQ6.js")).InstallReporter
63
63
  )
64
64
  };
65
65
  var command = async (conf) => {
package/cli-package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vltpkg/cli-sdk",
3
3
  "description": "The source for the vlt CLI",
4
- "version": "1.1.0",
4
+ "version": "1.2.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/vltpkg/vltpkg.git",
@@ -28,6 +28,7 @@
28
28
  "@vltpkg/run": "workspace:*",
29
29
  "@vltpkg/security-archive": "workspace:*",
30
30
  "@vltpkg/spec": "workspace:*",
31
+ "@vltpkg/tar": "workspace:*",
31
32
  "@vltpkg/types": "workspace:*",
32
33
  "@vltpkg/url-open": "workspace:*",
33
34
  "@vltpkg/vlt-json": "workspace:*",