@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
@@ -13,10 +13,10 @@ import {
13
13
  graphRun,
14
14
  graphRunSync,
15
15
  joinDepIDTuple
16
- } from "./chunk-YOE3VZFX.js";
16
+ } from "./chunk-J3R4XWB3.js";
17
17
  import {
18
18
  Spec
19
- } from "./chunk-XKVU23NC.js";
19
+ } from "./chunk-V7EQZOO5.js";
20
20
  import {
21
21
  load,
22
22
  parse as parse2,
@@ -28,6 +28,10 @@ import {
28
28
  promiseSpawn,
29
29
  whichSync
30
30
  } from "./chunk-U7TEQCBN.js";
31
+ import {
32
+ ot,
33
+ ts
34
+ } from "./chunk-Y5PA7DVK.js";
31
35
  import {
32
36
  Range,
33
37
  Version,
@@ -37,11 +41,9 @@ import {
37
41
  longDependencyTypes,
38
42
  normalizeManifest,
39
43
  parse,
44
+ parseRange,
40
45
  satisfies
41
- } from "./chunk-VFBCWAOC.js";
42
- import {
43
- ts
44
- } from "./chunk-VE6CCH33.js";
46
+ } from "./chunk-RH2Y7MPW.js";
45
47
  import {
46
48
  error
47
49
  } from "./chunk-WZWDS3W4.js";
@@ -5771,6 +5773,59 @@ var assertWSConfig = (conf, path2) => {
5771
5773
  wanted: "string | string[] | { [group: string]: string | string[] }"
5772
5774
  });
5773
5775
  };
5776
+ var manifestWSIgnoredKeys = /* @__PURE__ */ new Set(["nohoist"]);
5777
+ var asManifestWSConfig = (conf, path2) => {
5778
+ if (conf && typeof conf === "object" && !Array.isArray(conf)) {
5779
+ const groups = Object.keys(conf).filter(
5780
+ (k) => k !== "packages" && !manifestWSIgnoredKeys.has(k)
5781
+ );
5782
+ if (groups.length) {
5783
+ throw error(
5784
+ 'Named workspace groups are not supported in package.json. Move them to the "workspaces" field of vlt.json to use them.',
5785
+ {
5786
+ path: path2,
5787
+ found: groups,
5788
+ wanted: "string | string[] | { packages: string[] }"
5789
+ }
5790
+ );
5791
+ }
5792
+ const { packages } = conf;
5793
+ if (packages === void 0) return {};
5794
+ return asWSConfig({ packages }, path2);
5795
+ }
5796
+ return asWSConfig(conf, path2);
5797
+ };
5798
+ var resolveWSConfig = (projectRoot, packageJson = new PackageJson()) => {
5799
+ const fromVltJson = load("workspaces", assertWSConfig);
5800
+ if (fromVltJson !== void 0) {
5801
+ return { config: asWSConfig(fromVltJson), source: "vlt.json" };
5802
+ }
5803
+ const workspaces = packageJson.maybeRead(projectRoot)?.workspaces;
5804
+ if (workspaces === void 0) return { config: {} };
5805
+ return {
5806
+ config: asManifestWSConfig(
5807
+ workspaces,
5808
+ resolve4(projectRoot, "package.json")
5809
+ ),
5810
+ source: "package.json"
5811
+ };
5812
+ };
5813
+ var splitNegatedPatterns = (all) => {
5814
+ const patterns = [];
5815
+ let ignore = [];
5816
+ for (const orig of all) {
5817
+ const excl = /^!+/.exec(orig);
5818
+ const stripped = excl ? orig.slice(excl[0].length) : orig;
5819
+ const pattern = stripped.replace(/^\.?\/+/, "");
5820
+ if (excl && excl[0].length % 2 === 1) {
5821
+ ignore.push(pattern);
5822
+ continue;
5823
+ }
5824
+ ignore = ignore.filter((ign) => !minimatch(pattern, ign));
5825
+ patterns.push(pattern);
5826
+ }
5827
+ return { patterns, ignore };
5828
+ };
5774
5829
  var Monorepo = class _Monorepo {
5775
5830
  /** The project root where vlt.json is found */
5776
5831
  projectRoot;
@@ -5795,9 +5850,9 @@ var Monorepo = class _Monorepo {
5795
5850
  if (options.load) this.load(options.load);
5796
5851
  }
5797
5852
  /**
5798
- * Load the workspace definitions from vlt.json,
5799
- * canonicalizing the result into the effective `{[group:string]:string[]}`
5800
- * form.
5853
+ * Load the workspace definitions from vlt.json, or from the root
5854
+ * package.json when vlt.json declares none, canonicalizing the result
5855
+ * into the effective `{[group:string]:string[]}` form.
5801
5856
  *
5802
5857
  * Eg:
5803
5858
  * - `"src/*"` => `{packages:["src/*"]}`
@@ -5805,9 +5860,10 @@ var Monorepo = class _Monorepo {
5805
5860
  */
5806
5861
  get config() {
5807
5862
  if (this.#config) return this.#config;
5808
- this.#config = asWSConfig(
5809
- load("workspaces", assertWSConfig) ?? {}
5810
- );
5863
+ this.#config = resolveWSConfig(
5864
+ this.projectRoot,
5865
+ this.packageJson
5866
+ ).config;
5811
5867
  return this.#config;
5812
5868
  }
5813
5869
  /**
@@ -5902,7 +5958,7 @@ var Monorepo = class _Monorepo {
5902
5958
  }
5903
5959
  // can't be cached, because it's dependent on the matches set
5904
5960
  // but still worthwhile to have it defined in one place
5905
- #globOptions(matches, parseErrors) {
5961
+ #globOptions(matches, ignore, parseErrors) {
5906
5962
  const inMatches = (p) => {
5907
5963
  return !!p?.relativePosix() && (matches.has(p.relativePosix()) || inMatches(p.parent));
5908
5964
  };
@@ -5913,12 +5969,15 @@ var Monorepo = class _Monorepo {
5913
5969
  scurry: this.scurry,
5914
5970
  withFileTypes: false,
5915
5971
  ignore: {
5916
- childrenIgnored: (p) => basename2(p.relativePosix()) === "node_modules" || inMatches(p),
5972
+ childrenIgnored: (p) => basename2(p.relativePosix()) === "node_modules" || // only prunes the subtree for a `!foo/**` style negation,
5973
+ // matching npm -- a bare `!foo` still gets walked into
5974
+ !!ignore?.childrenIgnored(p) || inMatches(p),
5917
5975
  // ignore if fails to load package.json
5918
5976
  ignored: (p) => {
5919
5977
  p.lstatSync();
5920
5978
  const rel = p.relativePosix();
5921
5979
  if (!rel) return true;
5980
+ if (ignore?.ignored(p)) return true;
5922
5981
  const maybeDelete = [];
5923
5982
  for (const m of matches) {
5924
5983
  if (rel.startsWith(m + "/")) return true;
@@ -5946,10 +6005,21 @@ var Monorepo = class _Monorepo {
5946
6005
  }
5947
6006
  };
5948
6007
  }
6008
+ // patterns are always an array: asWSConfig normalizes every
6009
+ // WorkspaceConfig shape to string[], and the path filter is a Set
5949
6010
  #glob(pattern) {
6011
+ const { patterns, ignore } = splitNegatedPatterns(pattern);
5950
6012
  const matches = /* @__PURE__ */ new Set();
6013
+ if (!patterns.length) return matches;
5951
6014
  const parseErrors = /* @__PURE__ */ new Map();
5952
- ts(pattern, this.#globOptions(matches, parseErrors));
6015
+ ts(
6016
+ patterns,
6017
+ this.#globOptions(
6018
+ matches,
6019
+ ignore.length ? new ot(ignore, {}) : void 0,
6020
+ parseErrors
6021
+ )
6022
+ );
5953
6023
  for (const [rel, err] of parseErrors) {
5954
6024
  let isNested = false;
5955
6025
  for (const m of matches) {
@@ -5978,6 +6048,12 @@ var Monorepo = class _Monorepo {
5978
6048
  * This does *not* get the full set of dependencies, or expand any
5979
6049
  * `workspace:` dependencies that are not loaded.
5980
6050
  *
6051
+ * Bare semver specs are matched by name, and linked only when the
6052
+ * local workspace version satisfies the range -- the same test
6053
+ * `@vltpkg/satisfies` applies at resolution time, so the two agree on
6054
+ * which deps are local. Specs that aren't parseable ranges, such as
6055
+ * dist-tags, still match by name alone.
6056
+ *
5981
6057
  * Call with the `forceLoad` param set to `true` to attempt a full
5982
6058
  * load if any deps are not currently loaded.
5983
6059
  */
@@ -5994,15 +6070,20 @@ var Monorepo = class _Monorepo {
5994
6070
  const deps = manifest[depType];
5995
6071
  if (!deps) continue;
5996
6072
  for (const [dep, spec] of Object.entries(deps)) {
5997
- if (spec.startsWith("workspace:")) {
6073
+ if (spec.startsWith("workspace:") || !spec.includes(":")) {
5998
6074
  let depWS = this.#workspaces.get(dep);
6075
+ if (depWS && depWS.name !== dep) depWS = void 0;
5999
6076
  if (!depWS) {
6000
6077
  if (!forceLoad) continue;
6001
6078
  if (didForceLoad) continue;
6002
6079
  didForceLoad = true;
6003
6080
  this.load();
6004
6081
  depWS = this.#workspaces.get(dep);
6005
- if (!depWS) continue;
6082
+ if (depWS?.name !== dep) continue;
6083
+ }
6084
+ const range2 = spec.includes(":") ? void 0 : parseRange(spec);
6085
+ if (range2 && !satisfies(depWS.manifest.version ?? "", range2)) {
6086
+ continue;
6006
6087
  }
6007
6088
  depWorkspaces.push(depWS);
6008
6089
  }
@@ -6142,13 +6223,20 @@ var Monorepo = class _Monorepo {
6142
6223
  }
6143
6224
  /**
6144
6225
  * Convenience method to instantiate and load in one call.
6145
- * Returns undefined if the project is not a monorepo workspaces
6146
- * root, otherwise returns the loaded Monorepo.
6226
+ * Returns undefined if the project is not a monorepo workspaces root,
6227
+ * meaning neither `vlt.json` nor the root `package.json` declares any
6228
+ * workspaces. Otherwise returns the loaded Monorepo.
6147
6229
  */
6148
6230
  static maybeLoad(projectRoot, options = { load: {} }) {
6149
- const config = load("workspaces", assertWSConfig);
6150
- if (!config) return;
6151
- return new _Monorepo(projectRoot, { load: {}, ...options });
6231
+ if (options.config) {
6232
+ return new _Monorepo(projectRoot, { load: {}, ...options });
6233
+ }
6234
+ const { config, source } = resolveWSConfig(
6235
+ projectRoot,
6236
+ options.packageJson
6237
+ );
6238
+ if (!source) return;
6239
+ return new _Monorepo(projectRoot, { load: {}, ...options, config });
6152
6240
  }
6153
6241
  /**
6154
6242
  * Convenience method to instantiate and load in one call.
@@ -6198,7 +6286,8 @@ export {
6198
6286
  PackageJson,
6199
6287
  minimatch,
6200
6288
  PathScurry,
6201
- asWSConfig,
6202
6289
  assertWSConfig,
6290
+ resolveWSConfig,
6291
+ splitNegatedPatterns,
6203
6292
  Monorepo
6204
6293
  };
@@ -12,7 +12,7 @@ var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  Ze,
14
14
  ts
15
- } from "./chunk-VE6CCH33.js";
15
+ } from "./chunk-Y5PA7DVK.js";
16
16
 
17
17
  // ../../node_modules/.vlt/~npm~rimraf@6.1.3/node_modules/rimraf/dist/esm/opt-arg.js
18
18
  var typeOrUndef = (val, t) => typeof val === "undefined" || typeof val === t;
@@ -11,18 +11,18 @@ import {createRequire as _vlt_createRequire} from "node:module";
11
11
  var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  asUnknownSpecPrefix
14
- } from "./chunk-2PWSMJD7.js";
14
+ } from "./chunk-D2LEK7VS.js";
15
15
  import {
16
16
  addKey,
17
17
  asDependency
18
- } from "./chunk-JZJWASXL.js";
18
+ } from "./chunk-J2WL3A3C.js";
19
19
  import {
20
20
  joinDepIDTuple,
21
21
  splitDepID
22
- } from "./chunk-YOE3VZFX.js";
22
+ } from "./chunk-J3R4XWB3.js";
23
23
  import {
24
24
  Spec
25
- } from "./chunk-XKVU23NC.js";
25
+ } from "./chunk-V7EQZOO5.js";
26
26
 
27
27
  // ../../src/cli-sdk/src/parse-add-remove-args.ts
28
28
  import { isAbsolute, relative, resolve } from "node:path";
@@ -16,10 +16,10 @@ import {
16
16
  } from "./chunk-ZWKI5OSF.js";
17
17
  import {
18
18
  minimatch
19
- } from "./chunk-X2AWQGYG.js";
19
+ } from "./chunk-P4LLYWCG.js";
20
20
  import {
21
21
  Spec
22
- } from "./chunk-XKVU23NC.js";
22
+ } from "./chunk-V7EQZOO5.js";
23
23
  import {
24
24
  parse,
25
25
  stringify
@@ -770,7 +770,8 @@ var packTarball = async (manifest, dir, config) => {
770
770
  files,
771
771
  integrity,
772
772
  shasum,
773
- resolvedManifest: processedManifest
773
+ resolvedManifest: processedManifest,
774
+ packDir
774
775
  };
775
776
  } finally {
776
777
  config.options.packageJson.write(packDir, manifest);
@@ -1946,6 +1946,28 @@ var normalizeBinPaths = (manifest) => {
1946
1946
  }
1947
1947
  };
1948
1948
  var isBoolean = (value) => typeof value === "boolean";
1949
+ var integrityRE = /^sha512-[a-zA-Z0-9/+]{86}==$/;
1950
+ var isIntegrity = (i) => typeof i === "string" && integrityRE.test(i);
1951
+ var integrityHex = (i) => isIntegrity(i) ? Buffer.from(i.slice(7), "base64").toString("hex") : void 0;
1952
+ var BROTLI_TARBALL_EXT = ".tar.br";
1953
+ var tarballFormat = (url) => {
1954
+ const end = /[?#]/.exec(url)?.index ?? url.length;
1955
+ return url.endsWith(BROTLI_TARBALL_EXT, end) ? "brotli" : void 0;
1956
+ };
1957
+ var brotliTarballName = (tgz) => tgz.replace(/\.tgz$/, BROTLI_TARBALL_EXT);
1958
+ var brotliTarballUrl = (tarball, alternates) => {
1959
+ if (!tarball) return void 0;
1960
+ const entry = alternates?.find(
1961
+ (a) => a.kind === "tar.br" && !!a.tarball
1962
+ );
1963
+ if (!entry) return void 0;
1964
+ try {
1965
+ const href = new URL(entry.tarball, tarball).href;
1966
+ return href === new URL(brotliTarballName(tarball)).href ? href : void 0;
1967
+ } catch {
1968
+ return void 0;
1969
+ }
1970
+ };
1949
1971
  var asError = (er, fallbackMessage = "Unknown error") => er instanceof Error ? er : new Error(String(er) || fallbackMessage);
1950
1972
  var isError = (er) => er instanceof Error;
1951
1973
  var isErrorWithCause = (er) => isError(er) && "cause" in er;
@@ -2508,6 +2530,12 @@ export {
2508
2530
  isSpec,
2509
2531
  currentDefaultRegistryName,
2510
2532
  Spec,
2533
+ normalizeBinPaths,
2534
+ integrityRE,
2535
+ integrityHex,
2536
+ tarballFormat,
2537
+ brotliTarballName,
2538
+ brotliTarballUrl,
2511
2539
  asError,
2512
2540
  isError,
2513
2541
  isErrorWithCause,
@@ -2515,6 +2543,7 @@ export {
2515
2543
  isRecordStringString,
2516
2544
  assertRecordStringString,
2517
2545
  assertRecordStringT,
2546
+ isManifest,
2518
2547
  asManifest,
2519
2548
  normalizeManifest,
2520
2549
  asNormalizedManifest,