@vltpkg/cli-js 1.2.0 → 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-FTHPFPUJ.js → access-HIVJOWXZ.js} +10 -10
  2. package/{bugs-QS6HQUO2.js → bugs-2KFUYMPS.js} +19 -19
  3. package/{build-H27SXMAS.js → build-CX6YZ4LS.js} +11 -11
  4. package/{cache-IB4HMFDT.js → cache-I6L5ZRGD.js} +15 -15
  5. package/cache-unzip-src-unzip.js +31 -12
  6. package/{chunk-QA6RE2GS.js → chunk-263MHLR3.js} +57 -22
  7. package/{chunk-YFNQ6HZ3.js → chunk-2HXJ4ZSF.js} +3 -3
  8. package/{chunk-YTT3UHUB.js → chunk-33HBY5CF.js} +1 -1
  9. package/{chunk-LD4BQJBG.js → chunk-C6LK7C3L.js} +4 -4
  10. package/{chunk-GUATFMMU.js → chunk-CU752KW7.js} +1 -1
  11. package/{chunk-O44Z6MAV.js → chunk-D2LEK7VS.js} +1 -1
  12. package/{chunk-6A3XS52F.js → chunk-ENSGPOLR.js} +13 -0
  13. package/{chunk-7KFMQ3BR.js → chunk-EP7AVBIO.js} +5 -5
  14. package/{chunk-OE6VHHN4.js → chunk-FHMIECHI.js} +27 -27
  15. package/chunk-GDV5LSQ2.js +75 -0
  16. package/{chunk-3CUFJPBK.js → chunk-HCZOVC3Y.js} +1 -1
  17. package/{chunk-55DYW2MP.js → chunk-I6QGYSB4.js} +1 -1
  18. package/{chunk-LEGPLJWK.js → chunk-ILRJWH6A.js} +5 -5
  19. package/{chunk-B2FK2HHL.js → chunk-J2WL3A3C.js} +62 -17
  20. package/{chunk-SYGF27W7.js → chunk-J3R4XWB3.js} +2 -2
  21. package/{chunk-FOJCK57G.js → chunk-JFHEXCG5.js} +3 -3
  22. package/{chunk-UNWQVOLY.js → chunk-MJWUULO6.js} +6 -6
  23. package/{chunk-VHHLO5L6.js → chunk-N4RCKCHY.js} +1 -1
  24. package/{chunk-6G7MTZGS.js → chunk-P4LLYWCG.js} +110 -21
  25. package/{chunk-BHJT53TP.js → chunk-PDWPFR5T.js} +1 -1
  26. package/{chunk-LKQ5R4VX.js → chunk-QETVMIIT.js} +4 -4
  27. package/{chunk-5PP77V44.js → chunk-QWJDHBV7.js} +4 -3
  28. package/{chunk-G5BSQ6DP.js → chunk-RH2Y7MPW.js} +22 -0
  29. package/{chunk-5YB6UIC3.js → chunk-SVMH3NDM.js} +40 -23
  30. package/{chunk-NJZSCUD4.js → chunk-TYLYZKVA.js} +14 -11
  31. package/{chunk-G5NJ7CYI.js → chunk-V7EQZOO5.js} +1 -1
  32. package/{chunk-JTUZP2OD.js → chunk-VBADA6QU.js} +1 -1
  33. package/{chunk-FSZF2RSQ.js → chunk-W6UMN2YJ.js} +4 -4
  34. package/{chunk-VE6CCH33.js → chunk-Y5PA7DVK.js} +1 -0
  35. package/{chunk-5BD4QGW2.js → chunk-YZWFWSY7.js} +6 -6
  36. package/{chunk-UQUIO7LW.js → chunk-ZNUXDX6R.js} +4 -3
  37. package/{ci-XJBYXFFJ.js → ci-BX54SEU3.js} +12 -12
  38. package/cli-package.json +2 -2
  39. package/{config-4Y46SH5K.js → config-HFF6XDCV.js} +9 -9
  40. package/{config-H2Q4ABSS.js → config-WBVJX42R.js} +11 -11
  41. package/{create-LUYL2QI4.js → create-W67HRHWZ.js} +20 -20
  42. package/{deprecate-5ANCI2L6.js → deprecate-5T6JTGJ3.js} +13 -13
  43. package/{devtools-UEMPW5GG.js → devtools-UMJUK42W.js} +2 -2
  44. package/{dist-tag-SD2CRWIL.js → dist-tag-YIZTS7GF.js} +10 -10
  45. package/{docs-B6LVNWTP.js → docs-G7CKMPCL.js} +19 -19
  46. package/{exec-CJ5KQA72.js → exec-YYCAZZ6Z.js} +20 -20
  47. package/{exec-cache-EE7DAOW2.js → exec-cache-6ENHAGC6.js} +18 -18
  48. package/{exec-local-HT3VBN6S.js → exec-local-OXG3PSLF.js} +17 -17
  49. package/{help-GZ44WYDS.js → help-RMOIAILM.js} +4 -4
  50. package/{init-HVXRXFVY.js → init-UPEQXC4D.js} +12 -12
  51. package/{install-E2C7EE6P.js → install-U7LLEQU6.js} +18 -18
  52. package/{list-V4V6SHJP.js → list-N6CKPXTK.js} +20 -20
  53. package/{login-VRFV7MCE.js → login-MCO4ZLVF.js} +14 -14
  54. package/{logout-SU75R7BN.js → logout-BJ4QRZYG.js} +10 -10
  55. package/{pack-IVGKUXTL.js → pack-U6PYRFZ6.js} +13 -13
  56. package/package.json +1 -1
  57. package/{ping-WB222SDT.js → ping-VFB6SCMH.js} +10 -10
  58. package/{pkg-LAAFNONA.js → pkg-ZNK5SCF4.js} +13 -13
  59. package/{profile-P3AVHRDI.js → profile-TW32HLYA.js} +10 -10
  60. package/{publish-IUNB3KH5.js → publish-AHOITWZQ.js} +36 -21
  61. package/{query-XCN55INS.js → query-KKP5PNSQ.js} +20 -20
  62. package/{registry-QQLWJHJI.js → registry-VHB65BWD.js} +5 -5
  63. package/registry-client-src-revalidate.js +25 -26
  64. package/{repo-BQDWUCX5.js → repo-BHTVK5KE.js} +19 -19
  65. package/{reporter-5BVUNWQ6.js → reporter-VQU7HYKM.js} +75 -75
  66. package/{run-QT7DX243.js → run-UD32OTUJ.js} +17 -17
  67. package/{run-exec-XYUI7GLN.js → run-exec-NOCIUNGL.js} +17 -17
  68. package/security-archive-src-update-expired.js +1 -1
  69. package/{setup-CXDJXRAG.js → setup-PBCWOSTV.js} +17 -17
  70. package/{src-UBAERP25.js → src-LRKPUV4J.js} +16 -16
  71. package/{src-OKMGXMAD.js → src-T5FBZFMV.js} +24 -14
  72. package/{src-2BUT4WYP.js → src-Z44JKVWS.js} +6 -6
  73. package/{token-CBOK6DMT.js → token-PCPB6NOL.js} +10 -10
  74. package/{uninstall-27VP46KJ.js → uninstall-LOGSQXFS.js} +14 -14
  75. package/{unpublish-F4637OQX.js → unpublish-O3UFCTEJ.js} +10 -10
  76. package/{update-NGWLJJ22.js → update-WBCLWGLN.js} +17 -17
  77. package/{version-WPD2KNVC.js → version-S3LCB2TQ.js} +12 -12
  78. package/{view-YKFTRRPD.js → view-LMPENVAJ.js} +11 -11
  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-I5Q6RTAP.js → whoami-LYMG7R3P.js} +10 -10
  85. package/chunk-SPRVRSEL.js +0 -75
@@ -13,10 +13,10 @@ import {
13
13
  graphRun,
14
14
  graphRunSync,
15
15
  joinDepIDTuple
16
- } from "./chunk-SYGF27W7.js";
16
+ } from "./chunk-J3R4XWB3.js";
17
17
  import {
18
18
  Spec
19
- } from "./chunk-G5NJ7CYI.js";
19
+ } from "./chunk-V7EQZOO5.js";
20
20
  import {
21
21
  load,
22
22
  parse as parse2,
@@ -29,8 +29,9 @@ import {
29
29
  whichSync
30
30
  } from "./chunk-U7TEQCBN.js";
31
31
  import {
32
+ ot,
32
33
  ts
33
- } from "./chunk-VE6CCH33.js";
34
+ } from "./chunk-Y5PA7DVK.js";
34
35
  import {
35
36
  Range,
36
37
  Version,
@@ -40,8 +41,9 @@ import {
40
41
  longDependencyTypes,
41
42
  normalizeManifest,
42
43
  parse,
44
+ parseRange,
43
45
  satisfies
44
- } from "./chunk-G5BSQ6DP.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-O44Z6MAV.js";
14
+ } from "./chunk-D2LEK7VS.js";
15
15
  import {
16
16
  addKey,
17
17
  asDependency
18
- } from "./chunk-B2FK2HHL.js";
18
+ } from "./chunk-J2WL3A3C.js";
19
19
  import {
20
20
  joinDepIDTuple,
21
21
  splitDepID
22
- } from "./chunk-SYGF27W7.js";
22
+ } from "./chunk-J3R4XWB3.js";
23
23
  import {
24
24
  Spec
25
- } from "./chunk-G5NJ7CYI.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-6G7MTZGS.js";
19
+ } from "./chunk-P4LLYWCG.js";
20
20
  import {
21
21
  Spec
22
- } from "./chunk-G5NJ7CYI.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);
@@ -1949,6 +1949,25 @@ var isBoolean = (value) => typeof value === "boolean";
1949
1949
  var integrityRE = /^sha512-[a-zA-Z0-9/+]{86}==$/;
1950
1950
  var isIntegrity = (i) => typeof i === "string" && integrityRE.test(i);
1951
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
+ };
1952
1971
  var asError = (er, fallbackMessage = "Unknown error") => er instanceof Error ? er : new Error(String(er) || fallbackMessage);
1953
1972
  var isError = (er) => er instanceof Error;
1954
1973
  var isErrorWithCause = (er) => isError(er) && "cause" in er;
@@ -2514,6 +2533,9 @@ export {
2514
2533
  normalizeBinPaths,
2515
2534
  integrityRE,
2516
2535
  integrityHex,
2536
+ tarballFormat,
2537
+ brotliTarballName,
2538
+ brotliTarballUrl,
2517
2539
  asError,
2518
2540
  isError,
2519
2541
  isErrorWithCause,
@@ -20,15 +20,15 @@ import {
20
20
  pickManifest,
21
21
  resolve,
22
22
  revs
23
- } from "./chunk-6G7MTZGS.js";
23
+ } from "./chunk-P4LLYWCG.js";
24
24
  import {
25
25
  Spec
26
- } from "./chunk-G5NJ7CYI.js";
26
+ } from "./chunk-V7EQZOO5.js";
27
27
  import {
28
28
  registryErrorMessage,
29
29
  storeRoot,
30
30
  tokenRefusalAdvice
31
- } from "./chunk-UQUIO7LW.js";
31
+ } from "./chunk-ZNUXDX6R.js";
32
32
  import {
33
33
  logRequest
34
34
  } from "./chunk-U7TEQCBN.js";
@@ -37,8 +37,10 @@ import {
37
37
  } from "./chunk-XNLSTHDK.js";
38
38
  import {
39
39
  asPackument,
40
- integrityHex
41
- } from "./chunk-G5BSQ6DP.js";
40
+ brotliTarballUrl,
41
+ integrityHex,
42
+ tarballFormat
43
+ } from "./chunk-RH2Y7MPW.js";
42
44
  import {
43
45
  error
44
46
  } from "./chunk-WZWDS3W4.js";
@@ -204,7 +206,7 @@ var PackageInfoClient = class {
204
206
  #tarPoolPromise;
205
207
  async getRegistryClient() {
206
208
  if (this.#registryClient) return this.#registryClient;
207
- this.#registryClientPromise ??= import("./src-2BUT4WYP.js").then(({ RegistryClient }) => {
209
+ this.#registryClientPromise ??= import("./src-Z44JKVWS.js").then(({ RegistryClient }) => {
208
210
  this.#registryClient = new RegistryClient(this.options);
209
211
  return this.#registryClient;
210
212
  });
@@ -244,7 +246,7 @@ var PackageInfoClient = class {
244
246
  }
245
247
  async getTarPool() {
246
248
  if (this.#tarPool) return this.#tarPool;
247
- this.#tarPoolPromise ??= import("./src-OKMGXMAD.js").then(
249
+ this.#tarPoolPromise ??= import("./src-T5FBZFMV.js").then(
248
250
  ({ Pool }) => {
249
251
  this.#tarPool = new Pool();
250
252
  return this.#tarPool;
@@ -252,6 +254,17 @@ var PackageInfoClient = class {
252
254
  );
253
255
  return this.#tarPoolPromise;
254
256
  }
257
+ /**
258
+ * The absolute URL of a version's Brotli (`.tar.br`) tarball, or
259
+ * undefined when the registry advertised none, advertised one this
260
+ * client does not use (see {@link brotliTarballUrl}), or
261
+ * `--no-brotli-tarballs` is set. `dist.tarball` is already absolute
262
+ * here -- see `absolutizeTarballs`.
263
+ */
264
+ #brotliTarball(tarball, alternates) {
265
+ if (this.options["brotli-tarballs"] === false) return void 0;
266
+ return brotliTarballUrl(tarball, alternates);
267
+ }
255
268
  constructor(options = {}) {
256
269
  this.options = options;
257
270
  this.#projectRoot = options.projectRoot || process.cwd();
@@ -286,8 +299,13 @@ var PackageInfoClient = class {
286
299
  installScripts = false
287
300
  } = options;
288
301
  const f = spec.final;
289
- const alreadyResolved = !!(integrity && resolved);
290
- const r = alreadyResolved ? { resolved, integrity, spec } : await this.resolve(spec, options);
302
+ const brotli = !!resolved && tarballFormat(resolved) === "brotli";
303
+ const r = resolved && (integrity || brotli) ? {
304
+ resolved,
305
+ integrity,
306
+ spec,
307
+ ...brotli && !integrity ? { digestRequired: true } : {}
308
+ } : await this.resolve(spec, options);
291
309
  switch (f.type) {
292
310
  case "git": {
293
311
  const {
@@ -322,6 +340,7 @@ var PackageInfoClient = class {
322
340
  }
323
341
  case "registry": {
324
342
  const pool = await this.getTarPool();
343
+ const format = tarballFormat(r.resolved);
325
344
  const hex = f.type === "registry" && this.#storeLinker !== "unpack" ? integrityHex(r.integrity) : void 0;
326
345
  const copy = this.#storeLinker === "copy" || installScripts;
327
346
  if (hex) {
@@ -353,7 +372,7 @@ var PackageInfoClient = class {
353
372
  });
354
373
  if (cached) {
355
374
  try {
356
- await pool.unpack(cached.body, target);
375
+ await pool.unpack(cached.body, target, format);
357
376
  logRequest(r.resolved, "cache");
358
377
  r.integrity ??= cached.integrity;
359
378
  if (hex || cached.gzip) {
@@ -387,7 +406,8 @@ var PackageInfoClient = class {
387
406
  }
388
407
  );
389
408
  }
390
- if (!trustIntegrity && response.checkIntegrity({ spec, url: resolved })) {
409
+ const verified = !trustIntegrity && response.checkIntegrity({ spec, url: resolved });
410
+ if (verified) {
391
411
  this.#trustedIntegrities.set(
392
412
  r.resolved,
393
413
  response.integrity
@@ -395,7 +415,7 @@ var PackageInfoClient = class {
395
415
  }
396
416
  const buf2 = response.buffer();
397
417
  if (r.integrity) {
398
- if (!fromLockfile && !response.fromCache) {
418
+ if (!verified && !fromLockfile && !response.fromCache) {
399
419
  const hash = createHash("sha512");
400
420
  hash.update(buf2);
401
421
  const computed = `sha512-${hash.digest("base64")}`;
@@ -427,7 +447,7 @@ var PackageInfoClient = class {
427
447
  }
428
448
  }
429
449
  try {
430
- await (await this.getTarPool()).unpack(buf, target);
450
+ await pool.unpack(buf, target, format);
431
451
  } catch (er) {
432
452
  throw this.#resolveError(
433
453
  spec,
@@ -627,11 +647,12 @@ var PackageInfoClient = class {
627
647
  { response, url: tarball }
628
648
  );
629
649
  }
630
- if (!trustIntegrity && response.checkIntegrity({ spec, url: tarball })) {
650
+ const verified = !trustIntegrity && response.checkIntegrity({ spec, url: tarball });
651
+ if (verified) {
631
652
  this.#trustedIntegrities.set(tarball, response.integrity);
632
653
  }
633
654
  const buf = response.buffer();
634
- if (integrity && !response.fromCache) {
655
+ if (integrity && !verified && !response.fromCache) {
635
656
  const hash = createHash("sha512");
636
657
  hash.update(buf);
637
658
  const computed = `sha512-${hash.digest("base64")}`;
@@ -1027,15 +1048,11 @@ var PackageInfoClient = class {
1027
1048
  case "registry": {
1028
1049
  const mani = await this.manifest(spec, options);
1029
1050
  if (mani.dist) {
1030
- const { integrity, tarball, signatures } = mani.dist;
1051
+ const { integrity, tarball, signatures, alternates } = mani.dist;
1031
1052
  if (tarball) {
1032
- const r = {
1033
- resolved: tarball,
1034
- integrity,
1035
- signatures,
1036
- spec
1037
- };
1038
- if (!integrity && this.#vltPackuments.has(`${f.registry}${f.name}`)) {
1053
+ const brotli = this.#brotliTarball(tarball, alternates);
1054
+ const r = brotli ? { resolved: brotli, spec, digestRequired: true } : { resolved: tarball, integrity, signatures, spec };
1055
+ if (!brotli && !integrity && this.#vltPackuments.has(`${f.registry}${f.name}`)) {
1039
1056
  r.digestRequired = true;
1040
1057
  }
1041
1058
  this.#resolutions.set(memoKey, r);
@@ -12,15 +12,16 @@ var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  init,
14
14
  install
15
- } from "./chunk-B2FK2HHL.js";
15
+ } from "./chunk-J2WL3A3C.js";
16
16
  import {
17
17
  commandUsage
18
- } from "./chunk-55DYW2MP.js";
18
+ } from "./chunk-I6QGYSB4.js";
19
19
  import {
20
- asWSConfig,
21
20
  assertWSConfig,
22
- minimatch
23
- } from "./chunk-6G7MTZGS.js";
21
+ minimatch,
22
+ resolveWSConfig,
23
+ splitNegatedPatterns
24
+ } from "./chunk-P4LLYWCG.js";
24
25
  import {
25
26
  load,
26
27
  save
@@ -74,8 +75,11 @@ Modify/add properties using \`vlt pkg\`. For example:
74
75
  var command = async (conf) => {
75
76
  const allowScripts = conf.get("allow-scripts") ? String(conf.get("allow-scripts")) : ":not(*)";
76
77
  if (conf.values.workspace?.length) {
77
- const workspacesConfig = load("workspaces", assertWSConfig);
78
- const parsedWSConfig = asWSConfig(workspacesConfig ?? {});
78
+ const { config: parsedWSConfig, source } = resolveWSConfig(
79
+ conf.options.projectRoot,
80
+ conf.options.packageJson
81
+ );
82
+ const workspacesConfig = load("workspaces", assertWSConfig) ?? (source === "package.json" ? Object.values(parsedWSConfig).flat() : void 0);
79
83
  const results = [];
80
84
  const addToConfig = [];
81
85
  for (const workspace of conf.values.workspace) {
@@ -83,10 +87,9 @@ var command = async (conf) => {
83
87
  mkdirSync(cwd, { recursive: true });
84
88
  results.push(await init({ cwd }));
85
89
  const isMatched = Object.values(parsedWSConfig).some(
86
- (patterns) => {
87
- return patterns.some(
88
- (pattern) => minimatch(workspace, pattern)
89
- );
90
+ (group) => {
91
+ const { patterns, ignore } = splitNegatedPatterns(group);
92
+ return patterns.some((pattern) => minimatch(workspace, pattern)) && !ignore.some((pattern) => minimatch(workspace, pattern));
90
93
  }
91
94
  );
92
95
  if (!isMatched) {
@@ -12,7 +12,7 @@ var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  Spec,
14
14
  kCustomInspect
15
- } from "./chunk-G5BSQ6DP.js";
15
+ } from "./chunk-RH2Y7MPW.js";
16
16
 
17
17
  // ../../src/spec/src/index.ts
18
18
  import { homedir } from "node:os";
@@ -14,7 +14,7 @@ var require = _vlt_createRequire(import.meta.filename);
14
14
  var package_default = {
15
15
  name: "@vltpkg/user-agent",
16
16
  description: "The User-Agent string that vlt sends with every outbound request",
17
- version: "1.2.0",
17
+ version: "1.3.0",
18
18
  repository: {
19
19
  type: "git",
20
20
  url: "git+https://github.com/vltpkg/vltpkg.git",
@@ -11,19 +11,19 @@ import {createRequire as _vlt_createRequire} from "node:module";
11
11
  var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  openUrl
14
- } from "./chunk-3CUFJPBK.js";
14
+ } from "./chunk-HCZOVC3Y.js";
15
15
  import {
16
16
  stderr
17
- } from "./chunk-UNWQVOLY.js";
17
+ } from "./chunk-MJWUULO6.js";
18
18
  import {
19
19
  mermaidOutput
20
- } from "./chunk-B2FK2HHL.js";
20
+ } from "./chunk-J2WL3A3C.js";
21
21
  import {
22
22
  ViewClass
23
23
  } from "./chunk-4KCU2KZL.js";
24
24
  import {
25
25
  getTokenByURL
26
- } from "./chunk-OE6VHHN4.js";
26
+ } from "./chunk-FHMIECHI.js";
27
27
 
28
28
  // ../../src/cli-sdk/src/query-auth.ts
29
29
  var createGetAuthHeader = (conf) => async (url) => getTokenByURL(url, conf.options.identity);
@@ -2995,6 +2995,7 @@ var Ze = Object.assign(Je, { glob: Je, globSync: ts, sync: Ui, globStream: Qe, s
2995
2995
  Ze.glob = Ze;
2996
2996
 
2997
2997
  export {
2998
+ ot,
2998
2999
  ts,
2999
3000
  Ze
3000
3001
  };
@@ -11,15 +11,15 @@ 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-5YB6UIC3.js";
14
+ } from "./chunk-SVMH3NDM.js";
15
15
  import {
16
16
  Monorepo,
17
17
  PackageJson,
18
18
  PathScurry
19
- } from "./chunk-6G7MTZGS.js";
19
+ } from "./chunk-P4LLYWCG.js";
20
20
  import {
21
21
  resetCaches
22
- } from "./chunk-SYGF27W7.js";
22
+ } from "./chunk-J3R4XWB3.js";
23
23
  import {
24
24
  commands,
25
25
  defaultValues,
@@ -28,7 +28,7 @@ import {
28
28
  isRecordField,
29
29
  recordFields,
30
30
  storeLinkers
31
- } from "./chunk-6A3XS52F.js";
31
+ } from "./chunk-ENSGPOLR.js";
32
32
  import {
33
33
  find,
34
34
  load,
@@ -37,14 +37,14 @@ import {
37
37
  } from "./chunk-HTOTG4TS.js";
38
38
  import {
39
39
  storeRoot
40
- } from "./chunk-UQUIO7LW.js";
40
+ } from "./chunk-ZNUXDX6R.js";
41
41
  import {
42
42
  assertRecordStringString,
43
43
  assertRecordStringT,
44
44
  getOptions,
45
45
  isObject,
46
46
  isRecordStringString
47
- } from "./chunk-G5BSQ6DP.js";
47
+ } from "./chunk-RH2Y7MPW.js";
48
48
  import {
49
49
  error
50
50
  } from "./chunk-WZWDS3W4.js";
@@ -12,13 +12,13 @@ var require = _vlt_createRequire(import.meta.filename);
12
12
  import {
13
13
  asError,
14
14
  isObject
15
- } from "./chunk-G5BSQ6DP.js";
15
+ } from "./chunk-RH2Y7MPW.js";
16
16
  import {
17
17
  error
18
18
  } from "./chunk-WZWDS3W4.js";
19
19
 
20
20
  // ../../src/registry-client/src/registry-error.ts
21
- import { STATUS_CODES } from "node:http";
21
+ var statusText = (code) => process.getBuiltinModule("node:http").STATUS_CODES[code];
22
22
  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);
@@ -42,7 +42,7 @@ var detailFromJSON = (text) => {
42
42
  return void 0;
43
43
  };
44
44
  var registryErrorMessage = (response) => {
45
- const statusMessage = STATUS_CODES[response.statusCode];
45
+ const statusMessage = statusText(response.statusCode);
46
46
  const status = `${response.statusCode}${statusMessage ? ` ${statusMessage}` : ""}`;
47
47
  let text;
48
48
  try {
@@ -161,6 +161,7 @@ import { resolve } from "node:path";
161
161
  var storeRoot = (cache) => resolve(cache, "store", "v1");
162
162
 
163
163
  export {
164
+ statusText,
164
165
  registryErrorMessage,
165
166
  tokenRefusal,
166
167
  tokenRefusalAdvice,