@vltpkg/cli-js 1.3.7 → 1.4.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 (87) hide show
  1. package/{access-4W6PMOGC.js → access-422UGEWN.js} +8 -8
  2. package/{bugs-FJHQFPZF.js → bugs-RED7Y33Q.js} +17 -17
  3. package/{build-SPWU3NOH.js → build-IHMPBWRO.js} +9 -9
  4. package/{cache-SBNEPOMQ.js → cache-FJP2RZJX.js} +31 -19
  5. package/cache-unzip-src-unzip.js +21 -1
  6. package/{chunk-SPWJ3X5Y.js → chunk-2AMOC4DN.js} +4 -4
  7. package/{chunk-QYS5MGGM.js → chunk-4UCADW6S.js} +86 -10
  8. package/{chunk-GZ5MYMBT.js → chunk-5IJTPZXP.js} +1 -1
  9. package/{chunk-L3K2ZAOO.js → chunk-5RHABCYI.js} +76 -11
  10. package/{chunk-OWUICQFY.js → chunk-5TNXLRW2.js} +33 -20
  11. package/{chunk-IHXJVKAE.js → chunk-5Y4SYLJ2.js} +2 -1
  12. package/chunk-6IF3RJND.js +81 -0
  13. package/{chunk-3U6QWN62.js → chunk-7T3XAYP4.js} +1 -1
  14. package/{chunk-FKZ5I53D.js → chunk-ASLX43R3.js} +3 -3
  15. package/{chunk-5ZCDGBVU.js → chunk-C23TDXRG.js} +1 -1
  16. package/{chunk-H77JYU7F.js → chunk-DNRR3XMG.js} +12 -3
  17. package/{chunk-IBGFQR23.js → chunk-FLH4YC6W.js} +21 -0
  18. package/{chunk-XDSZO74H.js → chunk-FZUYGJZU.js} +7 -7
  19. package/{chunk-W2ZO5RZL.js → chunk-GIIAODRI.js} +4 -4
  20. package/{chunk-F5D3DVC5.js → chunk-HZXJ423P.js} +7 -3
  21. package/{chunk-CB65DPZ2.js → chunk-I7UMHYZX.js} +151 -27
  22. package/{chunk-2M2O6A4R.js → chunk-ISE4IRHF.js} +4 -4
  23. package/{chunk-TLY4VGMH.js → chunk-LHPEBLOU.js} +1 -1
  24. package/{chunk-EL4GVZK5.js → chunk-MKWPTN3C.js} +2 -2
  25. package/{chunk-QVPNKMUU.js → chunk-OAJ3PO3Z.js} +115 -19
  26. package/{chunk-7BHHCB5C.js → chunk-OVPHE4O7.js} +348 -24
  27. package/{chunk-KOFQTETH.js → chunk-PHJJPY5G.js} +3 -3
  28. package/{chunk-SV4WK3KX.js → chunk-PLG3OYCX.js} +2 -2
  29. package/{chunk-KMOOTBHM.js → chunk-QCSUWACA.js} +1 -1
  30. package/{chunk-6D54UN4T.js → chunk-SR2VOY5J.js} +1 -1
  31. package/chunk-T6FBP4OU.js +76 -0
  32. package/{chunk-A2TSRXZD.js → chunk-THSYN5EK.js} +1 -1
  33. package/{chunk-3D3IB4YN.js → chunk-TO23PR7J.js} +61 -27
  34. package/{chunk-OWMR2EDW.js → chunk-TPRK6IDA.js} +1 -1
  35. package/chunk-UGCKF5ZE.js +57 -0
  36. package/{chunk-SE2FSMBR.js → chunk-WF6KLKRN.js} +26 -10
  37. package/{chunk-I7SCSGUO.js → chunk-X4FVR4R5.js} +23 -18
  38. package/{chunk-VBDNOU76.js → chunk-ZJMJ7MCT.js} +1 -1
  39. package/{ci-76TAJGF5.js → ci-YSKNNO5M.js} +10 -10
  40. package/cli-package.json +1 -1
  41. package/{config-3UQXAYAA.js → config-CSPCDMR3.js} +9 -8
  42. package/{config-AFIHF54I.js → config-HO7GY3QT.js} +11 -10
  43. package/{create-5ADQTH6K.js → create-2TJT3AHJ.js} +19 -18
  44. package/{deprecate-RTQVLJDZ.js → deprecate-7FRJI2RL.js} +11 -11
  45. package/{dist-tag-V4DRDHWA.js → dist-tag-WCFF5OEG.js} +8 -8
  46. package/{docs-RRULRTKQ.js → docs-JMBPTU23.js} +17 -17
  47. package/{exec-NXQUCX3I.js → exec-FBOUKZZ2.js} +27 -18
  48. package/{exec-cache-KVZJHFZD.js → exec-cache-X3ZWM5S3.js} +16 -16
  49. package/{exec-local-53B5IRKG.js → exec-local-Y3KQC22N.js} +16 -15
  50. package/{help-EN4XUTMS.js → help-PUKVH5X7.js} +4 -4
  51. package/{init-4L6CQMIL.js → init-GOKAQXXZ.js} +10 -10
  52. package/{install-MHWLYW3X.js → install-XFN4UFOC.js} +116 -16
  53. package/{list-XZRF7TBW.js → list-43JFFG5D.js} +19 -19
  54. package/{login-6GRRY4H7.js → login-RSTZKNKN.js} +13 -12
  55. package/{logout-KI2AOYRT.js → logout-4576FFXZ.js} +8 -8
  56. package/{outdated-TWUPFRCD.js → outdated-ACQ5A2Y7.js} +31 -29
  57. package/{pack-2ZQLDYFD.js → pack-QQVJ3G25.js} +15 -12
  58. package/package.json +1 -1
  59. package/{ping-ZOTGLOKY.js → ping-QCDQQRO5.js} +8 -8
  60. package/{pkg-HRNOTFXB.js → pkg-CSOJV7UC.js} +17 -12
  61. package/{profile-5V3FFDMG.js → profile-VL4HPW3N.js} +8 -8
  62. package/{publish-7ZXEMWTW.js → publish-2YBO6ZXE.js} +23 -18
  63. package/{query-62UDNMGR.js → query-IHHFMJRT.js} +19 -19
  64. package/{registry-MQJJCWJY.js → registry-W7BRZZZ2.js} +5 -5
  65. package/registry-client-src-revalidate.js +132 -17
  66. package/{repo-HDUGP5PH.js → repo-L3BXAAWS.js} +17 -17
  67. package/{reporter-TGBPLNR5.js → reporter-5NYOHBO7.js} +11 -10
  68. package/{run-6NRDZD4T.js → run-AMUUVLTI.js} +16 -15
  69. package/{run-exec-I4IIXTLW.js → run-exec-5W3XWQZA.js} +16 -15
  70. package/security-archive-src-update-expired.js +46 -12
  71. package/{setup-UVXEFUUJ.js → setup-TFM4GJF7.js} +16 -15
  72. package/{src-QEJ6WZQ7.js → src-4CYCUWZL.js} +29 -24
  73. package/{src-6CJEMSVB.js → src-I3GMULFP.js} +6 -4
  74. package/{src-GP7VLT7P.js → src-LUTN2ODD.js} +58 -9
  75. package/{token-WTN27E7A.js → token-OANOBE3G.js} +8 -8
  76. package/{uninstall-ZJOKXIVQ.js → uninstall-YXTQ4AIZ.js} +12 -12
  77. package/{unpublish-LMUGR7GI.js → unpublish-SZXYMYIU.js} +8 -8
  78. package/{update-WVWMRUYY.js → update-FHLMWGIM.js} +26 -16
  79. package/{version-OJTRHNKV.js → version-ZWFCTU5V.js} +16 -11
  80. package/{view-6Q5B7ZYN.js → view-NFNJXMLV.js} +73 -25
  81. package/vlr.js +1 -1
  82. package/vlrx.js +1 -1
  83. package/vlt.js +1 -1
  84. package/vlx.js +1 -1
  85. package/vlxl.js +1 -1
  86. package/{whoami-SPF34TV6.js → whoami-O7GOSGCI.js} +8 -8
  87. package/chunk-A6FAI65V.js +0 -76
@@ -13,7 +13,7 @@ import {
13
13
  AbortError,
14
14
  SecurityArchive,
15
15
  pRetry
16
- } from "./chunk-OWUICQFY.js";
16
+ } from "./chunk-5TNXLRW2.js";
17
17
  import {
18
18
  Monorepo,
19
19
  PackageJson,
@@ -21,7 +21,7 @@ import {
21
21
  getUser,
22
22
  minimatch,
23
23
  platformCheck
24
- } from "./chunk-CB65DPZ2.js";
24
+ } from "./chunk-I7UMHYZX.js";
25
25
  import {
26
26
  asDepID,
27
27
  baseDepID,
@@ -36,10 +36,10 @@ import {
36
36
  joinExtra,
37
37
  splitDepID,
38
38
  splitExtra
39
- } from "./chunk-SV4WK3KX.js";
39
+ } from "./chunk-PLG3OYCX.js";
40
40
  import {
41
41
  Spec as Spec2
42
- } from "./chunk-GZ5MYMBT.js";
42
+ } from "./chunk-5IJTPZXP.js";
43
43
  import {
44
44
  load,
45
45
  walkUp
@@ -47,7 +47,7 @@ import {
47
47
  import {
48
48
  userAgent,
49
49
  userAgentHeaders
50
- } from "./chunk-VBDNOU76.js";
50
+ } from "./chunk-ZJMJ7MCT.js";
51
51
  import {
52
52
  graphStep,
53
53
  promiseSpawn
@@ -100,9 +100,10 @@ import {
100
100
  shortDependencyTypes,
101
101
  subset,
102
102
  tarballFormat
103
- } from "./chunk-IBGFQR23.js";
103
+ } from "./chunk-FLH4YC6W.js";
104
104
  import {
105
105
  error,
106
+ syntaxError,
106
107
  typeError
107
108
  } from "./chunk-WZWDS3W4.js";
108
109
  import {
@@ -5542,11 +5543,11 @@ var exec = async (options) => {
5542
5543
  projectRoot,
5543
5544
  "script-shell": shell2 = false,
5544
5545
  color = false,
5545
- signal,
5546
5546
  ...spawnOptions
5547
5547
  } = options;
5548
5548
  const [spawnCmd, spawnArgs] = withShellArgs(shell2, arg0, args);
5549
5549
  const p = promiseSpawn(spawnCmd, spawnArgs, {
5550
+ // `signal` kills it when aborted
5550
5551
  ...spawnOptions,
5551
5552
  shell: shell2,
5552
5553
  stdio: "pipe",
@@ -5565,6 +5566,10 @@ var exec = async (options) => {
5565
5566
  windowsHide: true
5566
5567
  });
5567
5568
  proxySignals(p.process);
5569
+ p.process.on("error", () => {
5570
+ p.process.stdout.destroy();
5571
+ p.process.stderr.destroy();
5572
+ });
5568
5573
  return await p;
5569
5574
  };
5570
5575
  var execFG = async (options) => {
@@ -5632,6 +5637,85 @@ var runExecFG = async (options) => runExecImpl(options, runFG, execFG);
5632
5637
  // ../../src/dss-parser/src/index.ts
5633
5638
  var import_postcss_selector_parser = __toESM(require_dist(), 1);
5634
5639
 
5640
+ // ../../src/dss-parser/src/grammar.ts
5641
+ var pseudoClassNames = [
5642
+ "abandoned",
5643
+ "attr",
5644
+ "built",
5645
+ "confused",
5646
+ "cve",
5647
+ "cwe",
5648
+ "debug",
5649
+ "deprecated",
5650
+ "dev",
5651
+ "diff",
5652
+ "dist",
5653
+ "dynamic",
5654
+ "empty",
5655
+ "entropic",
5656
+ "env",
5657
+ "eval",
5658
+ "fs",
5659
+ "has",
5660
+ "host",
5661
+ "hostname",
5662
+ "is",
5663
+ "license",
5664
+ "link",
5665
+ "malware",
5666
+ "minified",
5667
+ "missing",
5668
+ "native",
5669
+ "network",
5670
+ "not",
5671
+ "obfuscated",
5672
+ "optional",
5673
+ "outdated",
5674
+ "overridden",
5675
+ "path",
5676
+ "peer",
5677
+ "prerelease",
5678
+ "private",
5679
+ "prod",
5680
+ "project",
5681
+ "published",
5682
+ "registry",
5683
+ "root",
5684
+ "scanned",
5685
+ "scope",
5686
+ "score",
5687
+ "scripts",
5688
+ "semver",
5689
+ "sev",
5690
+ "severity",
5691
+ "shell",
5692
+ "shrinkwrap",
5693
+ "spec",
5694
+ "squat",
5695
+ "suspicious",
5696
+ "tracker",
5697
+ "trivial",
5698
+ "type",
5699
+ "undesirable",
5700
+ "unknown",
5701
+ "unmaintained",
5702
+ "unpopular",
5703
+ "unstable",
5704
+ "v",
5705
+ "vuln",
5706
+ "vulnerable",
5707
+ "workspace"
5708
+ ];
5709
+ var combinatorNames = [">", "~", " "];
5710
+ var attributeOperatorNames = [
5711
+ "=",
5712
+ "^=",
5713
+ "$=",
5714
+ "~=",
5715
+ "*=",
5716
+ "|="
5717
+ ];
5718
+
5635
5719
  // ../../src/dss-parser/src/types.ts
5636
5720
  var isPostcssNodeWithChildren = (node) => "type" in node && "nodes" in node;
5637
5721
  var asPostcssNodeWithChildren = (node) => {
@@ -5758,7 +5842,68 @@ var pseudoCleanUpNeeded = /* @__PURE__ */ new Set([
5758
5842
  ":vulnerable"
5759
5843
  ]);
5760
5844
  var hasParamsToEscape = (node) => pseudoCleanUpNeeded.has(node.value);
5761
- var parse2 = (query) => {
5845
+ var pseudoClasses = new Set(pseudoClassNames);
5846
+ var combinators = new Set(combinatorNames);
5847
+ var attributeOperators = new Set(attributeOperatorNames);
5848
+ var selectorPseudos = /* @__PURE__ */ new Set(["has", "is", "not"]);
5849
+ var invalid = (message, found) => syntaxError(message, { code: "EQUERY", found });
5850
+ var validate = (selector, query, forgiving = false) => {
5851
+ const nodes = selector.nodes.filter((n) => n.type !== "comment");
5852
+ if (!nodes.length && !forgiving) {
5853
+ throw invalid("Empty selector", query);
5854
+ }
5855
+ nodes.forEach((node, i) => {
5856
+ if (node.type === "id" && !node.value || node.type === "attribute" && !node.attribute) {
5857
+ throw invalid(
5858
+ "Unsupported selector",
5859
+ node.type === "id" ? "#" : "[]"
5860
+ );
5861
+ }
5862
+ if (isCombinatorNode(node)) {
5863
+ if (forgiving) return;
5864
+ if (!combinators.has(node.value)) {
5865
+ throw syntaxError(`Unsupported combinator: ${node.value}`, {
5866
+ code: "EQUERY",
5867
+ found: node.value,
5868
+ validOptions: combinatorNames
5869
+ });
5870
+ }
5871
+ const next = nodes[i + 1];
5872
+ if (!next || isCombinatorNode(next)) {
5873
+ throw invalid("Dangling combinator", query);
5874
+ }
5875
+ } else if (isPseudoNode(node)) {
5876
+ const name = node.value.slice(1);
5877
+ if (!pseudoClasses.has(name)) {
5878
+ if (forgiving) return;
5879
+ throw invalid(
5880
+ `Unsupported pseudo-class: ${node.value}`,
5881
+ node.value
5882
+ );
5883
+ }
5884
+ if (selectorPseudos.has(name)) {
5885
+ for (const n of node.nodes) {
5886
+ validate(
5887
+ asSelectorNode(n),
5888
+ query,
5889
+ forgiving || name === "is"
5890
+ );
5891
+ }
5892
+ }
5893
+ } else if (isAttributeNode(node)) {
5894
+ if (!forgiving && node.operator && !attributeOperators.has(node.operator)) {
5895
+ throw invalid(
5896
+ `Unsupported attribute operator: ${node.operator}`,
5897
+ node.operator
5898
+ );
5899
+ }
5900
+ } else if (isTagNode(node) && node.value !== "{" && node.value !== "}" || isStringNode(node)) {
5901
+ throw invalid("Unsupported selector", node.value);
5902
+ }
5903
+ });
5904
+ };
5905
+ var parse2 = (query, { loose = false } = {}) => {
5906
+ if (!loose && !query.trim()) throw invalid("Empty query", query);
5762
5907
  const escapedQuery = escapeDots(escapeScopedNamesSlashes(query));
5763
5908
  const transformAst = (root2) => {
5764
5909
  root2.walk((node) => {
@@ -5768,6 +5913,7 @@ var parse2 = (query) => {
5768
5913
  if (isPseudoNode(node) && hasParamsToEscape(node)) {
5769
5914
  for (const n of node.nodes) {
5770
5915
  const selector = asSelectorNode(n);
5916
+ if (!selector.nodes.length) continue;
5771
5917
  selector.nodes.forEach((currentNode, index, arr) => {
5772
5918
  const nextNode = arr[index + 1];
5773
5919
  if (isCombinatorNode(currentNode) && isTagNode(nextNode)) {
@@ -5797,7 +5943,24 @@ var parse2 = (query) => {
5797
5943
  }
5798
5944
  });
5799
5945
  };
5800
- return (0, import_postcss_selector_parser.default)(transformAst).astSync(escapedQuery);
5946
+ let ast;
5947
+ try {
5948
+ ast = (0, import_postcss_selector_parser.default)(transformAst).astSync(escapedQuery);
5949
+ } catch (err) {
5950
+ const reason = err instanceof TypeError ? "unexpected end of input" : err.message;
5951
+ throw syntaxError(`Invalid query syntax: ${reason}`, {
5952
+ code: "EQUERY",
5953
+ found: query,
5954
+ cause: err
5955
+ });
5956
+ }
5957
+ if (!loose) {
5958
+ if (/(^|[^\\])(\\\\)*,\s*$/.test(query)) {
5959
+ throw invalid("Empty selector", query);
5960
+ }
5961
+ for (const s of ast.nodes) validate(s, query);
5962
+ }
5963
+ return ast;
5801
5964
  };
5802
5965
 
5803
5966
  // ../../src/query/src/error.ts
@@ -8951,7 +9114,7 @@ var Query = class {
8951
9114
  edges.add(edge);
8952
9115
  }
8953
9116
  }
8954
- const current = parse2(query);
9117
+ const current = parse2(query, { loose: true });
8955
9118
  const loose = asPostcssNodeWithChildren(current).nodes.length > 1;
8956
9119
  const {
8957
9120
  collect,
@@ -9006,7 +9169,7 @@ var Query = class {
9006
9169
  const tokens = [];
9007
9170
  const ast = (q) => {
9008
9171
  try {
9009
- return parse2(q);
9172
+ return parse2(q, { loose: true });
9010
9173
  } catch (_e) {
9011
9174
  return ast(q.slice(0, -1));
9012
9175
  }
@@ -9437,9 +9600,10 @@ var Graph = class {
9437
9600
  /**
9438
9601
  * Whether the lockfile on disk no longer matches this graph even
9439
9602
  * though no node changed, e.g. an importer edge spec was rewritten to
9440
- * the value saved to `package.json`, or the config options the graph
9441
- * was built with differ from the ones stored in the lockfile. Reify
9442
- * saves the lockfiles from its no-diff early return when set.
9603
+ * the value saved to `package.json`, a node dev/optional flag was
9604
+ * re-derived, or the config options the graph was built with differ
9605
+ * from the ones stored in the lockfile. Reify saves the lockfiles
9606
+ * from its no-diff early return when set.
9443
9607
  */
9444
9608
  lockfileStale = false;
9445
9609
  /**
@@ -9530,6 +9694,34 @@ var Graph = class {
9530
9694
  nextPeerContextIndex() {
9531
9695
  return ++this.currentPeerContextIndex;
9532
9696
  }
9697
+ /**
9698
+ * Re-derive node `dev`/`optional` flags: a node is dev/optional only
9699
+ * when every importer path crosses a dev/optional edge. Placement only
9700
+ * ever lowers these flags, so removed or retyped edges leave them
9701
+ * stale. Sets `lockfileStale` when any flag changes.
9702
+ */
9703
+ recomputeFlags() {
9704
+ const reach = (skip) => {
9705
+ const seen = new Set(this.importers);
9706
+ for (const node of seen) {
9707
+ for (const edge of node.edgesOut.values()) {
9708
+ if (edge.to && !skip(edge)) seen.add(edge.to);
9709
+ }
9710
+ }
9711
+ return seen;
9712
+ };
9713
+ const nonDev = reach((edge) => edge.dev);
9714
+ const nonOptional = reach((edge) => edge.optional);
9715
+ for (const node of this.nodes.values()) {
9716
+ const dev2 = !nonDev.has(node);
9717
+ const optional2 = !nonOptional.has(node);
9718
+ if (node.dev !== dev2 || node.optional !== optional2) {
9719
+ node.dev = dev2;
9720
+ node.optional = optional2;
9721
+ this.lockfileStale = true;
9722
+ }
9723
+ }
9724
+ }
9533
9725
  /**
9534
9726
  * Delete all nodes and edges that are unreachable from the importers.
9535
9727
  * The collection of deleted nodes is returned.
@@ -10459,6 +10651,9 @@ var parseDir = (options, scurry, packageJson, depsFound, graph, fromNode, currDi
10459
10651
  registry: fromNode.registry ?? options.registry
10460
10652
  });
10461
10653
  const { spec: modifiedSpec, queryModifier } = maybeApplyModifierToSpec(spec2, name, modifierRefs);
10654
+ if (modifiedSpec !== spec2 && modifiedSpec.bareSpec === "-") {
10655
+ continue;
10656
+ }
10462
10657
  spec2 = modifiedSpec;
10463
10658
  graph.placePackage(
10464
10659
  fromNode,
@@ -11513,7 +11708,7 @@ var Breadcrumb = class {
11513
11708
  constructor(query) {
11514
11709
  this.#items = [];
11515
11710
  this.specificity = { idCounter: 0, commonCounter: 0 };
11516
- const ast = parse2(query);
11711
+ const ast = parse2(query, { loose: true });
11517
11712
  let afterCombinator = true;
11518
11713
  for (const item of ast.first.nodes) {
11519
11714
  const pseudoNode = isPseudoNode(item);
@@ -11751,6 +11946,29 @@ var GraphModifier = class _GraphModifier {
11751
11946
  }
11752
11947
  return false;
11753
11948
  }
11949
+ /**
11950
+ * Selector of the modifier that wins the direct `importer -> spec.name`
11951
+ * edge, if it removes it (value `-`). Same pick as tryNewDependency:
11952
+ * complete entries whose qualifier accepts the spec, highest
11953
+ * specificity, importer-anchored before lone on ties.
11954
+ */
11955
+ removesImporterEdge(importer, spec2) {
11956
+ const anchored = [];
11957
+ const lone = [];
11958
+ for (const mod2 of this.#modifiers) {
11959
+ const { last } = mod2.breadcrumb;
11960
+ if (last.name !== spec2.name || !matchesQualifier(last, spec2))
11961
+ continue;
11962
+ const { prev } = last;
11963
+ if (!prev) lone.push(mod2);
11964
+ else if (!prev.prev && matchesImporter(prev, importer))
11965
+ anchored.push(mod2);
11966
+ }
11967
+ const all = [...anchored, ...lone];
11968
+ const [winner] = specificitySort(all.map((m) => m.breadcrumb));
11969
+ const mod = all.find((m) => m.breadcrumb === winner);
11970
+ return mod?.value === "-" ? mod.query : void 0;
11971
+ }
11754
11972
  /**
11755
11973
  * Loads the modifiers defined in `vlt.json` into memory.
11756
11974
  */
@@ -12136,6 +12354,7 @@ var getImporterSpecs = (options) => {
12136
12354
  const { add, graph, remove } = options;
12137
12355
  const addResult = new AddImportersDependenciesMapImpl();
12138
12356
  const removeResult = new RemoveImportersDependenciesMapImpl();
12357
+ const removedEdges = /* @__PURE__ */ new Set();
12139
12358
  for (const importer of graph.importers) {
12140
12359
  const addDeps = /* @__PURE__ */ new Map();
12141
12360
  const removeDeps = /* @__PURE__ */ new Set();
@@ -12162,6 +12381,10 @@ var getImporterSpecs = (options) => {
12162
12381
  continue;
12163
12382
  }
12164
12383
  const spec2 = Spec2.parse(depName, depSpec, options);
12384
+ if (options.modifiers?.removesImporterEdge(importer, spec2)) {
12385
+ if (edge) removedEdges.add(edge);
12386
+ continue;
12387
+ }
12165
12388
  if (spec2.type === "workspace" && !edge?.to) {
12166
12389
  const wsExists = [...graph.importers].some(
12167
12390
  (n) => n.name === depName
@@ -12267,6 +12490,7 @@ var getImporterSpecs = (options) => {
12267
12490
  return {
12268
12491
  add: addResult,
12269
12492
  remove: removeResult,
12493
+ removedEdges,
12270
12494
  staleSpecs,
12271
12495
  transientAdd,
12272
12496
  transientRemove
@@ -13580,6 +13804,12 @@ var fetchManifestsForDeps = async (packageInfo, graph, fromNode, deps, scurry, o
13580
13804
  if (queryModifier && completeModifier && "spec" in activeModifier.modifier) {
13581
13805
  spec2 = activeModifier.modifier.spec;
13582
13806
  if (spec2.bareSpec === "-") {
13807
+ if (isExplicit) {
13808
+ throw error(
13809
+ `Cannot add ${originalSpec.name}: it is removed by a graph modifier`,
13810
+ { code: "ECONFIG", found: queryModifier }
13811
+ );
13812
+ }
13583
13813
  continue;
13584
13814
  }
13585
13815
  }
@@ -13692,6 +13922,8 @@ var fetchManifestsForDeps = async (packageInfo, graph, fromNode, deps, scurry, o
13692
13922
  throw er;
13693
13923
  })
13694
13924
  );
13925
+ manifestPromise.catch(() => {
13926
+ });
13695
13927
  const fetchTask = {
13696
13928
  spec: spec2,
13697
13929
  type: type2,
@@ -13706,6 +13938,7 @@ var fetchManifestsForDeps = async (packageInfo, graph, fromNode, deps, scurry, o
13706
13938
  };
13707
13939
  fetchTasks.push(fetchTask);
13708
13940
  }
13941
+ await Promise.all(fetchTasks.map((t) => t.manifestPromise));
13709
13942
  for (const fetchTask of fetchTasks) {
13710
13943
  const manifest = await fetchTask.manifestPromise;
13711
13944
  placementTasks.push({
@@ -14105,7 +14338,11 @@ var refreshIdealGraph = async ({
14105
14338
  transientAdd,
14106
14339
  transientRemove,
14107
14340
  explicit
14108
- );
14341
+ ).catch((er) => {
14342
+ for (const p of extractPromises ?? []) p.catch(() => {
14343
+ });
14344
+ throw er;
14345
+ });
14109
14346
  }
14110
14347
  graph.lockedResolutions = void 0;
14111
14348
  for (const importer of graph.importers) {
@@ -14163,6 +14400,12 @@ var buildIdealFromStartingGraph = async (options) => {
14163
14400
  if (importerSpecs.staleSpecs.size) {
14164
14401
  options.graph.lockfileStale = true;
14165
14402
  }
14403
+ for (const edge of importerSpecs.removedEdges) {
14404
+ edge.from.edgesOut.delete(edge.name);
14405
+ edge.to?.edgesIn.delete(edge);
14406
+ options.graph.edges.delete(edge);
14407
+ options.graph.lockfileStale = true;
14408
+ }
14166
14409
  await refreshIdealGraph({
14167
14410
  ...options,
14168
14411
  explicit,
@@ -14176,6 +14419,7 @@ var buildIdealFromStartingGraph = async (options) => {
14176
14419
  options
14177
14420
  );
14178
14421
  }
14422
+ options.graph.recomputeFlags();
14179
14423
  return options.graph;
14180
14424
  };
14181
14425
 
@@ -14310,7 +14554,7 @@ import {
14310
14554
  stat as stat2,
14311
14555
  writeFile as writeFile3
14312
14556
  } from "node:fs/promises";
14313
- import { dirname as dirname5, relative as relative2 } from "node:path";
14557
+ import { dirname as dirname5, isAbsolute, relative as relative2 } from "node:path";
14314
14558
 
14315
14559
  // ../../src/cmd-shim/src/to-batch-syntax.ts
14316
14560
  var convertToSetCommand = (key, value) => convertToSetCommand_(key.trim(), value.trim());
@@ -14411,6 +14655,18 @@ var cmdShimIfExists = async (from, to, remover) => {
14411
14655
  }
14412
14656
  await writeShim(from, to, remover);
14413
14657
  };
14658
+ var cmdShim = async (from, to, remover) => {
14659
+ try {
14660
+ await stat2(from);
14661
+ await writeShim(from, to, remover);
14662
+ } catch (er) {
14663
+ throw error("Could not shim to executable file", {
14664
+ path: from,
14665
+ target: to,
14666
+ cause: er
14667
+ });
14668
+ }
14669
+ };
14414
14670
  var writeShim = async (from, to, remover) => {
14415
14671
  await Promise.all([
14416
14672
  remover.rm(to),
@@ -14435,6 +14691,7 @@ var writeShim = async (from, to, remover) => {
14435
14691
  };
14436
14692
  var writeShim_ = async (from, to, prog, args, variables) => {
14437
14693
  let shTarget = relative2(dirname5(to), from);
14694
+ const [dp0, basedir] = isAbsolute(shTarget) ? ["", ""] : ["%dp0%\\", "$basedir/"];
14438
14695
  let target = shTarget.split("/").join("\\");
14439
14696
  let longProg;
14440
14697
  let shProg = prog?.split("\\").join("/");
@@ -14445,8 +14702,8 @@ var writeShim_ = async (from, to, prog, args, variables) => {
14445
14702
  args = args || "";
14446
14703
  variables = variables || "";
14447
14704
  if (!prog) {
14448
- prog = `"%dp0%\\${target}"`;
14449
- shProg = `"$basedir/${shTarget}"`;
14705
+ prog = `"${dp0}${target}"`;
14706
+ shProg = `"${basedir}${shTarget}"`;
14450
14707
  pwshProg = shProg;
14451
14708
  args = "";
14452
14709
  target = "";
@@ -14455,8 +14712,8 @@ var writeShim_ = async (from, to, prog, args, variables) => {
14455
14712
  longProg = `"%dp0%\\${prog}.exe"`;
14456
14713
  shLongProg = `"$basedir/${prog}"`;
14457
14714
  pwshLongProg = `"$basedir/${prog}$exe"`;
14458
- target = `"%dp0%\\${target}"`;
14459
- shTarget = `"$basedir/${shTarget}"`;
14715
+ target = `"${dp0}${target}"`;
14716
+ shTarget = `"${basedir}${shTarget}"`;
14460
14717
  }
14461
14718
  const head = "@ECHO off\r\nGOTO start\r\n:find_dp0\r\nSET dp0=%~dp0\r\nEXIT /b\r\n:start\r\nSETLOCAL\r\nCALL :find_dp0\r\n";
14462
14719
  let cmd;
@@ -15056,7 +15313,7 @@ var reify = async (options) => {
15056
15313
  );
15057
15314
  const noModifiedDependencies = !options.add?.modifiedDependencies && !options.remove?.modifiedDependencies;
15058
15315
  const hasLockfiles = !!scurry.lstatSync("vlt-lock.json") && !!scurry.lstatSync("node_modules/.vlt-lock.json");
15059
- const skipOptionalOnly = noModifiedDependencies && diff2.optionalOnly;
15316
+ const skipOptionalOnly = noModifiedDependencies && diff2.optionalOnly && !diff2.nodes.delete.size && !diff2.edges.delete.size;
15060
15317
  const skippable = skipOptionalOnly && !options.update && hasLockfiles;
15061
15318
  const res = { diff: diff2 };
15062
15319
  if (!diff2.hasChanges() || skippable) {
@@ -15174,19 +15431,26 @@ var uninstall = async (options, remove) => {
15174
15431
  const mainManifest = options.packageJson.read(options.projectRoot);
15175
15432
  const modifiers = GraphModifier.maybeLoad(options);
15176
15433
  const remover = new RollbackRemove();
15434
+ const monorepo = Monorepo.maybeLoad(options.projectRoot, {
15435
+ packageJson: options.packageJson,
15436
+ scurry: options.scurry
15437
+ });
15177
15438
  try {
15178
15439
  const act = load4({
15179
15440
  ...options,
15441
+ monorepo,
15180
15442
  modifiers: void 0,
15181
15443
  mainManifest,
15182
15444
  loadManifests: true
15183
15445
  });
15184
15446
  const graph = await build3({
15185
15447
  ...options,
15448
+ monorepo,
15186
15449
  actual: act,
15187
15450
  remove,
15188
15451
  mainManifest,
15189
15452
  loadManifests: true,
15453
+ modifiers,
15190
15454
  remover
15191
15455
  });
15192
15456
  if (options.lockfileOnly) {
@@ -15209,6 +15473,7 @@ var uninstall = async (options, remove) => {
15209
15473
  actual: act,
15210
15474
  graph,
15211
15475
  loadManifests: true,
15476
+ modifiers,
15212
15477
  remover
15213
15478
  });
15214
15479
  return { graph, diff: diff2 };
@@ -15232,6 +15497,30 @@ var uninstall = async (options, remove) => {
15232
15497
  // ../../src/graph/src/update.ts
15233
15498
  import { existsSync as existsSync5, rmSync as rmSync3 } from "node:fs";
15234
15499
  import { resolve as resolve12 } from "node:path";
15500
+ var startingGraph = (options, monorepo) => {
15501
+ const fresh = () => new Graph({ ...options, monorepo });
15502
+ if (!options.monorepo || !monorepo) return fresh();
15503
+ const selected = new Set(
15504
+ [...options.monorepo.values()].map((ws) => ws.id)
15505
+ );
15506
+ if (selected.size === monorepo.size) return fresh();
15507
+ let graph;
15508
+ try {
15509
+ graph = load3({ ...options, monorepo });
15510
+ } catch (err) {
15511
+ if (isPathSecurityError(err)) throw err;
15512
+ graph = load4({ ...options, monorepo, loadManifests: true });
15513
+ }
15514
+ for (const importer of graph.importers) {
15515
+ if (!selected.has(importer.id)) continue;
15516
+ for (const edge of importer.edgesOut.values()) {
15517
+ edge.to?.edgesIn.delete(edge);
15518
+ }
15519
+ importer.edgesOut.clear();
15520
+ }
15521
+ graph.gc();
15522
+ return graph;
15523
+ };
15235
15524
  var update = async (options) => {
15236
15525
  let mainManifest = void 0;
15237
15526
  try {
@@ -15248,6 +15537,10 @@ var update = async (options) => {
15248
15537
  }
15249
15538
  const modifiers = GraphModifier.maybeLoad(options);
15250
15539
  const remover = new RollbackRemove();
15540
+ const monorepo = Monorepo.maybeLoad(options.projectRoot, {
15541
+ packageJson: options.packageJson,
15542
+ scurry: options.scurry
15543
+ });
15251
15544
  try {
15252
15545
  const done = graphStep("build");
15253
15546
  const graph = await buildIdealFromStartingGraph({
@@ -15256,13 +15549,17 @@ var update = async (options) => {
15256
15549
  remove: Object.assign(/* @__PURE__ */ new Map(), {
15257
15550
  modifiedDependencies: false
15258
15551
  }),
15259
- graph: new Graph({ ...options, mainManifest }),
15552
+ graph: startingGraph(
15553
+ { ...options, mainManifest, modifiers },
15554
+ monorepo
15555
+ ),
15260
15556
  modifiers,
15261
15557
  remover
15262
15558
  });
15263
15559
  done();
15264
15560
  const act = load4({
15265
15561
  ...options,
15562
+ monorepo,
15266
15563
  mainManifest,
15267
15564
  loadManifests: true
15268
15565
  });
@@ -15462,7 +15759,7 @@ var install = async (options, add) => {
15462
15759
  }
15463
15760
  }
15464
15761
  }
15465
- if (importerSpecs.add.modifiedDependencies || importerSpecs.remove.modifiedDependencies || specChanges.length > 0 || lockfileGraph.optionsChanged) {
15762
+ if (importerSpecs.add.modifiedDependencies || importerSpecs.remove.modifiedDependencies || importerSpecs.removedEdges.size > 0 || specChanges.length > 0 || lockfileGraph.optionsChanged) {
15466
15763
  const details = [];
15467
15764
  if (lockfileGraph.optionsChanged) {
15468
15765
  details.push(" Configuration options have changed:");
@@ -15498,6 +15795,11 @@ var install = async (options, add) => {
15498
15795
  );
15499
15796
  }
15500
15797
  }
15798
+ for (const edge of importerSpecs.removedEdges) {
15799
+ details.push(
15800
+ ` ${edge.from.location}: ${edge.name} is removed by a graph modifier`
15801
+ );
15802
+ }
15501
15803
  const lockfilePath = resolve13(
15502
15804
  options.projectRoot,
15503
15805
  "vlt-lock.json"
@@ -15510,6 +15812,27 @@ var install = async (options, add) => {
15510
15812
  );
15511
15813
  }
15512
15814
  }
15815
+ if (modifiers && add?.modifiedDependencies) {
15816
+ const wsIds = new Set(
15817
+ [...fullMonorepo?.values() ?? []].map((ws) => ws.id)
15818
+ );
15819
+ for (const [id2, deps] of add) {
15820
+ const mainImporter = id2 === joinDepIDTuple(["file", "."]);
15821
+ if (!mainImporter && !wsIds.has(id2)) continue;
15822
+ for (const { spec: spec2 } of deps.values()) {
15823
+ const found = modifiers.removesImporterEdge(
15824
+ { importer: true, mainImporter },
15825
+ spec2
15826
+ );
15827
+ if (found) {
15828
+ throw error(
15829
+ `Cannot add ${spec2.name}: it is removed by a graph modifier`,
15830
+ { code: "ECONFIG", found }
15831
+ );
15832
+ }
15833
+ }
15834
+ }
15835
+ }
15513
15836
  const remover = new RollbackRemove();
15514
15837
  if (options.cleanInstall) {
15515
15838
  const nodeModulesPath = resolve13(
@@ -15612,6 +15935,7 @@ export {
15612
15935
  humanReadableOutput,
15613
15936
  mermaidOutput,
15614
15937
  findCmdShimIfExists,
15938
+ cmdShim,
15615
15939
  RollbackRemove,
15616
15940
  GraphModifier,
15617
15941
  init,
@@ -11,13 +11,13 @@ 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-OWMR2EDW.js";
14
+ } from "./chunk-TPRK6IDA.js";
15
15
  import {
16
16
  stderr
17
- } from "./chunk-XDSZO74H.js";
17
+ } from "./chunk-FZUYGJZU.js";
18
18
  import {
19
19
  mermaidOutput
20
- } from "./chunk-7BHHCB5C.js";
20
+ } from "./chunk-OVPHE4O7.js";
21
21
  import {
22
22
  ViewClass
23
23
  } from "./chunk-4KCU2KZL.js";