@vltpkg/cli-js 1.0.0-rc.33 → 1.0.0-rc.34

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 (65) hide show
  1. package/{access-VP3KSJ2M.js → access-SXQICNAN.js} +3 -3
  2. package/{bugs-4ZQXJA4F.js → bugs-OOPMFRCI.js} +6 -6
  3. package/{build-P74RVUUP.js → build-HDXI5OA7.js} +3 -3
  4. package/{cache-J4J3ZWXP.js → cache-RW4Y4XNQ.js} +5 -5
  5. package/{chunk-GTICKXWZ.js → chunk-3SQ5Y324.js} +2 -2
  6. package/{chunk-JZQAUAHT.js → chunk-4ZXA6RLP.js} +1 -1
  7. package/{chunk-DJYKQWV2.js → chunk-CCQYIYTA.js} +2 -2
  8. package/{chunk-JLGPPV6Z.js → chunk-D5CP6O6G.js} +1 -1
  9. package/{chunk-VGWEB64T.js → chunk-E5YE7UTZ.js} +234 -204
  10. package/{chunk-7KI6XHXZ.js → chunk-EHEVBLDB.js} +2 -2
  11. package/chunk-HB7CKTYO.js +75 -0
  12. package/{chunk-7TNSW6W3.js → chunk-LCDBW6IT.js} +1 -1
  13. package/{chunk-JEE4B4FL.js → chunk-MU7Y4R5E.js} +2 -2
  14. package/{chunk-BAUMCTQK.js → chunk-U6DM3ROE.js} +12 -2
  15. package/{chunk-5COWONUB.js → chunk-UCD3RJYG.js} +3 -3
  16. package/{chunk-XIJFEV6U.js → chunk-VM2RMMY4.js} +2 -2
  17. package/{chunk-OTNMX4EK.js → chunk-VZ7UNZHR.js} +2 -2
  18. package/{chunk-PMCAQG5J.js → chunk-WP6CYBPM.js} +0 -4
  19. package/{chunk-4SSFBFB5.js → chunk-WXMYKCQW.js} +2 -7
  20. package/{chunk-SSN4CYZF.js → chunk-Y7CQIZ7Y.js} +96 -156
  21. package/{ci-GIDCFAZF.js → ci-MTYU2K2A.js} +3 -3
  22. package/cli-package.json +1 -1
  23. package/{config-LIQMIMTF.js → config-6NXV2BXW.js} +5 -5
  24. package/{config-NBO3COMM.js → config-TVAXCTQO.js} +4 -4
  25. package/{create-K2S3J62I.js → create-LXI5DCDW.js} +10 -10
  26. package/{deprecate-4PJKNFXN.js → deprecate-2AQBL5XT.js} +4 -4
  27. package/{dist-tag-TA6LWT2V.js → dist-tag-BFSYLRIH.js} +3 -3
  28. package/{docs-ZCMIKQAN.js → docs-ADPJ4B4C.js} +6 -6
  29. package/{exec-XVF4KCRJ.js → exec-GMS54RAC.js} +10 -10
  30. package/{exec-cache-2IWJNBFB.js → exec-cache-R5LVZL5Z.js} +8 -8
  31. package/{exec-local-FNFTQYFP.js → exec-local-TVCLZGIM.js} +7 -7
  32. package/{help-ZDRILKVQ.js → help-6CECUD6C.js} +4 -4
  33. package/{init-VMYJE5Q3.js → init-XXFLGYVP.js} +4 -4
  34. package/{install-ZHMWN27D.js → install-6KMXYSF5.js} +4 -4
  35. package/{list-BPFKWXCR.js → list-RUO3SUKY.js} +7 -7
  36. package/{login-DQL5A4NT.js → login-6I2CGO7I.js} +3 -3
  37. package/{logout-Q74VRDSN.js → logout-JTU4BJKH.js} +3 -3
  38. package/{pack-GLURO5KY.js → pack-NCWH2TUA.js} +4 -4
  39. package/package.json +1 -1
  40. package/{ping-PPEYPKZD.js → ping-4MEAC2WD.js} +3 -3
  41. package/{pkg-UTEKJ5CB.js → pkg-ENSKG6G7.js} +5 -5
  42. package/{profile-5QFRWC2L.js → profile-62YHNFSO.js} +3 -3
  43. package/{publish-5VDI3JXX.js → publish-PPY724N2.js} +40 -12
  44. package/{query-I6DZ7TF2.js → query-NLWXKOOT.js} +48 -7
  45. package/{registry-ZVO3VAHY.js → registry-QGI44LG4.js} +2 -2
  46. package/registry-client-package.json +1 -1
  47. package/registry-client-src-revalidate.js +12 -2
  48. package/{repo-SB3C7MZZ.js → repo-BFRAXIVU.js} +6 -6
  49. package/{run-U6CW5Q56.js → run-7O65747G.js} +7 -7
  50. package/{run-exec-RFB572AL.js → run-exec-2OYWHL6K.js} +7 -7
  51. package/{setup-BFKUYGJB.js → setup-MMIDAIJI.js} +5 -5
  52. package/{src-ZWBXAZOV.js → src-OK3KHDYR.js} +8 -8
  53. package/{token-M5HPJJJQ.js → token-VLVXUW54.js} +3 -3
  54. package/{uninstall-UUBTM4ZQ.js → uninstall-TAG6QIAG.js} +4 -4
  55. package/{unpublish-WDSRB6DV.js → unpublish-Y4L5J2IA.js} +3 -3
  56. package/{update-J4BEFJRC.js → update-RYH4RKBS.js} +3 -3
  57. package/{version-ZVG66SKC.js → version-COHB32ON.js} +4 -4
  58. package/{view-WFK75G74.js → view-P7U4MF43.js} +5 -5
  59. package/vlr.js +1 -1
  60. package/vlrx.js +1 -1
  61. package/vlt.js +1 -1
  62. package/vlx.js +1 -1
  63. package/vlxl.js +1 -1
  64. package/{whoami-TCSDOBU2.js → whoami-47MVFMZC.js} +3 -3
  65. package/chunk-EAWRHC27.js +0 -75
@@ -5636,12 +5636,13 @@ var unescapeDots = (query) => query.replaceAll("\\.", ".");
5636
5636
  var pseudoCleanUpNeeded = /* @__PURE__ */ new Set([
5637
5637
  ":published",
5638
5638
  ":score",
5639
- ":malware",
5640
5639
  ":severity",
5641
5640
  ":sev",
5642
5641
  ":squat",
5643
5642
  ":semver",
5644
- ":v"
5643
+ ":v",
5644
+ ":vuln",
5645
+ ":vulnerable"
5645
5646
  ]);
5646
5647
  var hasParamsToEscape = (node) => pseudoCleanUpNeeded.has(node.value);
5647
5648
  var parse2 = (query) => {
@@ -6661,155 +6662,21 @@ var link = async (state) => {
6661
6662
  };
6662
6663
 
6663
6664
  // ../../src/query/src/pseudo/malware.ts
6664
- var kindsMap2 = /* @__PURE__ */ new Map([
6665
- ["critical", "malware"],
6666
- ["high", "gptMalware"],
6667
- ["medium", "gptSecurity"],
6668
- ["low", "gptAnomaly"],
6669
- ["0", "malware"],
6670
- ["1", "gptMalware"],
6671
- ["2", "gptSecurity"],
6672
- ["3", "gptAnomaly"]
6673
- ]);
6674
- var kindLevelMap = /* @__PURE__ */ new Map([
6675
- ["critical", 0],
6676
- ["high", 1],
6677
- ["medium", 2],
6678
- ["low", 3],
6679
- ["0", 0],
6680
- ["1", 1],
6681
- ["2", 2],
6682
- ["3", 3]
6683
- ]);
6684
- var kinds2 = new Set(kindsMap2.keys());
6685
- var isMalwareKind = (value) => kinds2.has(value);
6686
- var asMalwareKind = (value) => {
6687
- if (!isMalwareKind(value)) {
6688
- throw error("Expected a valid malware kind", {
6689
- found: value,
6690
- validOptions: Array.from(kinds2)
6691
- });
6692
- }
6693
- return value;
6694
- };
6695
- var parseInternals7 = (nodes) => {
6696
- if (!nodes[0]) {
6697
- return { kind: void 0, comparator: void 0 };
6698
- }
6699
- const selectorNode = asPostcssNodeWithChildren(nodes[0]);
6700
- if (!selectorNode.nodes[0]) {
6701
- return { kind: void 0, comparator: void 0 };
6702
- }
6703
- let kindValue = "";
6704
- let comparator = void 0;
6705
- let kind;
6706
- if (isStringNode(selectorNode.nodes[0])) {
6707
- kindValue = removeQuotes(
6708
- asStringNode(selectorNode.nodes[0]).value
6709
- );
6710
- } else if (isTagNode(selectorNode.nodes[0])) {
6711
- kindValue = asTagNode(selectorNode.nodes[0]).value;
6712
- }
6713
- if (kindValue.startsWith(">=")) {
6714
- comparator = ">=";
6715
- kindValue = kindValue.substring(2);
6716
- } else if (kindValue.startsWith("<=")) {
6717
- comparator = "<=";
6718
- kindValue = kindValue.substring(2);
6719
- } else if (kindValue.startsWith(">")) {
6720
- comparator = ">";
6721
- kindValue = kindValue.substring(1);
6722
- } else if (kindValue.startsWith("<")) {
6723
- comparator = "<";
6724
- kindValue = kindValue.substring(1);
6725
- }
6726
- if (!comparator) {
6727
- kind = asMalwareKind(kindValue);
6728
- } else {
6729
- if (isMalwareKind(kindValue)) {
6730
- kind = kindValue;
6731
- } else {
6732
- throw error(
6733
- "Expected a valid malware kind or number between 0-3",
6734
- {
6735
- found: kindValue
6736
- }
6737
- );
6738
- }
6739
- }
6740
- return { kind, comparator };
6741
- };
6665
+ var malwareAlertTypes = /* @__PURE__ */ new Set(["malware", "gptMalware"]);
6742
6666
  var malware = async (state) => {
6743
6667
  assertSecurityArchive(state, "malware");
6744
- let internals;
6745
- try {
6746
- internals = parseInternals7(
6747
- asPostcssNodeWithChildren(state.current).nodes
6668
+ const currentNode = asPostcssNodeWithChildren(state.current);
6669
+ if (currentNode.nodes.length > 0) {
6670
+ throw error(
6671
+ ":malware selector does not accept parameters. Use :vuln(<severity>) for severity-based filtering."
6748
6672
  );
6749
- } catch (err) {
6750
- throw error("Failed to parse :malware selector", { cause: err });
6751
- }
6752
- const { kind, comparator } = internals;
6753
- const alertName = comparator ? void 0 : kindsMap2.get(kind);
6754
- for (const node of state.partial.nodes) {
6755
- const report = state.securityArchive.get(node.id);
6756
- if (!report?.alerts || report.alerts.length === 0) {
6757
- removeNode(state, node);
6758
- }
6759
6673
  }
6760
6674
  for (const node of state.partial.nodes) {
6761
6675
  const report = state.securityArchive.get(node.id);
6762
- let exclude = true;
6763
- if (report) {
6764
- if (kind === void 0 && comparator === void 0) {
6765
- exclude = !report.alerts.some(
6766
- (alert) => alert.type === "malware" || alert.type === "gptMalware" || alert.type === "gptSecurity"
6767
- );
6768
- } else if (comparator) {
6769
- const kindLevel = kindLevelMap.get(kind);
6770
- if (kindLevel == null) break;
6771
- for (const alert of report.alerts) {
6772
- const alertType = alert.type;
6773
- const currentAlertLevelKey = [...kindsMap2.entries()].find(
6774
- ([_, alertValue]) => alertValue === alertType
6775
- )?.[0];
6776
- if (currentAlertLevelKey) {
6777
- const currentAlertLevel = kindLevelMap.get(
6778
- currentAlertLevelKey
6779
- );
6780
- if (currentAlertLevel == null) continue;
6781
- switch (comparator) {
6782
- case ">":
6783
- if (currentAlertLevel > kindLevel) {
6784
- exclude = false;
6785
- }
6786
- break;
6787
- case "<":
6788
- if (currentAlertLevel < kindLevel) {
6789
- exclude = false;
6790
- }
6791
- break;
6792
- case ">=":
6793
- if (currentAlertLevel >= kindLevel) {
6794
- exclude = false;
6795
- }
6796
- break;
6797
- case "<=":
6798
- if (currentAlertLevel <= kindLevel) {
6799
- exclude = false;
6800
- }
6801
- break;
6802
- }
6803
- if (!exclude) break;
6804
- }
6805
- }
6806
- } else {
6807
- exclude = !report.alerts.some(
6808
- (alert) => alert.type === alertName
6809
- );
6810
- }
6811
- }
6812
- if (exclude) {
6676
+ const hasMalware = report?.alerts.some(
6677
+ (alert) => malwareAlertTypes.has(alert.type)
6678
+ );
6679
+ if (!hasMalware) {
6813
6680
  removeNode(state, node);
6814
6681
  }
6815
6682
  }
@@ -6864,7 +6731,7 @@ var optional = async (state) => {
6864
6731
  };
6865
6732
 
6866
6733
  // ../../src/query/src/pseudo/outdated.ts
6867
- var kinds3 = /* @__PURE__ */ new Set([
6734
+ var kinds2 = /* @__PURE__ */ new Set([
6868
6735
  "any",
6869
6736
  "major",
6870
6737
  "minor",
@@ -6872,12 +6739,12 @@ var kinds3 = /* @__PURE__ */ new Set([
6872
6739
  "in-range",
6873
6740
  "out-of-range"
6874
6741
  ]);
6875
- var isOutdatedKind = (value) => kinds3.has(value);
6742
+ var isOutdatedKind = (value) => kinds2.has(value);
6876
6743
  var asOutdatedKind = (value) => {
6877
6744
  if (!isOutdatedKind(value)) {
6878
6745
  throw error("Expected a valid outdated kind", {
6879
6746
  found: value,
6880
- validOptions: Array.from(kinds3)
6747
+ validOptions: Array.from(kinds2)
6881
6748
  });
6882
6749
  }
6883
6750
  return value;
@@ -6908,7 +6775,7 @@ var retrieveRemoteVersions = async (node, signal) => {
6908
6775
  const packument = await response.json();
6909
6776
  return Object.keys(packument.versions).sort(compare);
6910
6777
  };
6911
- var parseInternals8 = (nodes) => {
6778
+ var parseInternals7 = (nodes) => {
6912
6779
  let kind = "any";
6913
6780
  if (isStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])) {
6914
6781
  kind = asOutdatedKind(
@@ -7002,7 +6869,7 @@ var queueNode2 = async (state, node, kind) => {
7002
6869
  var outdated = async (state) => {
7003
6870
  let internals;
7004
6871
  try {
7005
- internals = parseInternals8(
6872
+ internals = parseInternals7(
7006
6873
  asPostcssNodeWithChildren(state.current).nodes
7007
6874
  );
7008
6875
  } catch (err) {
@@ -7185,7 +7052,7 @@ var retrieveRemoteDate = async (node, signal) => {
7185
7052
  const res = packument.time?.[node.version];
7186
7053
  return res;
7187
7054
  };
7188
- var parseInternals9 = (nodes) => {
7055
+ var parseInternals8 = (nodes) => {
7189
7056
  let value = "";
7190
7057
  if (isStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])) {
7191
7058
  value = removeQuotes(
@@ -7259,7 +7126,7 @@ var queueNode3 = async (state, node, relativeDate, comparator) => {
7259
7126
  var published = async (state) => {
7260
7127
  let internals;
7261
7128
  try {
7262
- internals = parseInternals9(
7129
+ internals = parseInternals8(
7263
7130
  asPostcssNodeWithChildren(state.current).nodes
7264
7131
  );
7265
7132
  } catch (err) {
@@ -7364,7 +7231,7 @@ var scanned = async (state) => {
7364
7231
  };
7365
7232
 
7366
7233
  // ../../src/query/src/pseudo/score.ts
7367
- var kinds4 = /* @__PURE__ */ new Set([
7234
+ var kinds3 = /* @__PURE__ */ new Set([
7368
7235
  "overall",
7369
7236
  "license",
7370
7237
  "maintenance",
@@ -7373,17 +7240,17 @@ var kinds4 = /* @__PURE__ */ new Set([
7373
7240
  "vulnerability",
7374
7241
  void 0
7375
7242
  ]);
7376
- var isScoreKind = (value) => kinds4.has(value);
7243
+ var isScoreKind = (value) => kinds3.has(value);
7377
7244
  var asScoreKind = (value) => {
7378
7245
  if (!isScoreKind(value)) {
7379
7246
  throw error("Expected a valid score kind", {
7380
7247
  found: value,
7381
- validOptions: Array.from(kinds4)
7248
+ validOptions: Array.from(kinds3)
7382
7249
  });
7383
7250
  }
7384
7251
  return value;
7385
7252
  };
7386
- var parseInternals10 = (nodes) => {
7253
+ var parseInternals9 = (nodes) => {
7387
7254
  let rateStr = "";
7388
7255
  let comparator = "=";
7389
7256
  let kind = "overall";
@@ -7438,7 +7305,7 @@ var score = async (state) => {
7438
7305
  assertSecurityArchive(state, "score");
7439
7306
  let internals;
7440
7307
  try {
7441
- internals = parseInternals10(
7308
+ internals = parseInternals9(
7442
7309
  asPostcssNodeWithChildren(state.current).nodes
7443
7310
  );
7444
7311
  } catch (err) {
@@ -7552,7 +7419,7 @@ var semverRangeFunctions = /* @__PURE__ */ new Map([
7552
7419
  ["intersects", intersects],
7553
7420
  ["subset", subset]
7554
7421
  ]);
7555
- var parseInternals11 = (nodes, loose) => {
7422
+ var parseInternals10 = (nodes, loose) => {
7556
7423
  let semverValue = "";
7557
7424
  try {
7558
7425
  semverValue = removeQuotes(
@@ -7635,7 +7502,7 @@ var parseInternals11 = (nodes, loose) => {
7635
7502
  var semverParser = async (state) => {
7636
7503
  let internals;
7637
7504
  try {
7638
- internals = parseInternals11(
7505
+ internals = parseInternals10(
7639
7506
  asPostcssNodeWithChildren(state.current).nodes,
7640
7507
  !!state.loose
7641
7508
  );
@@ -7702,7 +7569,7 @@ var semverParser = async (state) => {
7702
7569
  };
7703
7570
 
7704
7571
  // ../../src/query/src/pseudo/severity.ts
7705
- var kindsMap3 = /* @__PURE__ */ new Map([
7572
+ var kindsMap2 = /* @__PURE__ */ new Map([
7706
7573
  ["critical", "criticalCVE"],
7707
7574
  ["high", "cve"],
7708
7575
  ["medium", "potentialVulnerability"],
@@ -7712,7 +7579,7 @@ var kindsMap3 = /* @__PURE__ */ new Map([
7712
7579
  ["2", "potentialVulnerability"],
7713
7580
  ["3", "mildCVE"]
7714
7581
  ]);
7715
- var kindLevelMap2 = /* @__PURE__ */ new Map([
7582
+ var kindLevelMap = /* @__PURE__ */ new Map([
7716
7583
  ["critical", 0],
7717
7584
  ["high", 1],
7718
7585
  ["medium", 2],
@@ -7722,9 +7589,9 @@ var kindLevelMap2 = /* @__PURE__ */ new Map([
7722
7589
  ["2", 2],
7723
7590
  ["3", 3]
7724
7591
  ]);
7725
- var kinds5 = new Set(kindsMap3.keys());
7726
- var isSeverityKind = (value) => kinds5.has(value);
7727
- var parseInternals12 = (nodes) => {
7592
+ var kinds4 = new Set(kindsMap2.keys());
7593
+ var isSeverityKind = (value) => kinds4.has(value);
7594
+ var parseInternals11 = (nodes) => {
7728
7595
  let kind;
7729
7596
  let comparator;
7730
7597
  if (nodes.length === 0) {
@@ -7771,7 +7638,7 @@ var severity = async (state) => {
7771
7638
  assertSecurityArchive(state, "severity");
7772
7639
  let internals;
7773
7640
  try {
7774
- internals = parseInternals12(
7641
+ internals = parseInternals11(
7775
7642
  asPostcssNodeWithChildren(state.current).nodes
7776
7643
  );
7777
7644
  } catch (err) {
@@ -7789,15 +7656,15 @@ var severity = async (state) => {
7789
7656
  let exclude = true;
7790
7657
  if (report) {
7791
7658
  if (comparator) {
7792
- const kindLevel = kindLevelMap2.get(kind);
7659
+ const kindLevel = kindLevelMap.get(kind);
7793
7660
  if (!kindLevel) break;
7794
7661
  for (const alert of report.alerts) {
7795
7662
  const alertType = alert.type;
7796
- const currentAlertLevelKey = [...kindsMap3.entries()].find(
7663
+ const currentAlertLevelKey = [...kindsMap2.entries()].find(
7797
7664
  ([_, alertValue]) => alertValue === alertType
7798
7665
  )?.[0];
7799
7666
  if (currentAlertLevelKey) {
7800
- const currentAlertLevel = kindLevelMap2.get(
7667
+ const currentAlertLevel = kindLevelMap.get(
7801
7668
  currentAlertLevelKey
7802
7669
  );
7803
7670
  if (currentAlertLevel == null) continue;
@@ -7826,7 +7693,7 @@ var severity = async (state) => {
7826
7693
  }
7827
7694
  }
7828
7695
  } else {
7829
- const alertName = kindsMap3.get(kind);
7696
+ const alertName = kindsMap2.get(kind);
7830
7697
  exclude = !report.alerts.some(
7831
7698
  (alert) => alert.type === alertName
7832
7699
  );
@@ -7847,22 +7714,22 @@ var shrinkwrap = createSecuritySelectorFilter(
7847
7714
  );
7848
7715
 
7849
7716
  // ../../src/query/src/pseudo/squat.ts
7850
- var kindsMap4 = /* @__PURE__ */ new Map([
7717
+ var kindsMap3 = /* @__PURE__ */ new Map([
7851
7718
  ["critical", "didYouMean"],
7852
7719
  ["medium", "gptDidYouMean"],
7853
7720
  ["0", "didYouMean"],
7854
7721
  ["2", "gptDidYouMean"],
7855
7722
  [void 0, void 0]
7856
7723
  ]);
7857
- var kindLevelMap3 = /* @__PURE__ */ new Map([
7724
+ var kindLevelMap2 = /* @__PURE__ */ new Map([
7858
7725
  ["critical", 0],
7859
7726
  ["medium", 2],
7860
7727
  ["0", 0],
7861
7728
  ["2", 2]
7862
7729
  ]);
7863
- var kinds6 = new Set(kindsMap4.keys());
7864
- var isSquatKind = (value) => kinds6.has(value);
7865
- var parseInternals13 = (nodes) => {
7730
+ var kinds5 = new Set(kindsMap3.keys());
7731
+ var isSquatKind = (value) => kinds5.has(value);
7732
+ var parseInternals12 = (nodes) => {
7866
7733
  let kind;
7867
7734
  let comparator;
7868
7735
  let kindValue = "";
@@ -7894,7 +7761,7 @@ var parseInternals13 = (nodes) => {
7894
7761
  } else {
7895
7762
  throw error("Expected a valid squat kind for comparison", {
7896
7763
  found: kindValue,
7897
- validOptions: Array.from(kinds6)
7764
+ validOptions: Array.from(kinds5)
7898
7765
  });
7899
7766
  }
7900
7767
  }
@@ -7904,7 +7771,7 @@ var squat = async (state) => {
7904
7771
  assertSecurityArchive(state, "squat");
7905
7772
  let internals;
7906
7773
  try {
7907
- internals = parseInternals13(
7774
+ internals = parseInternals12(
7908
7775
  asPostcssNodeWithChildren(state.current).nodes
7909
7776
  );
7910
7777
  } catch (err) {
@@ -7927,21 +7794,21 @@ var squat = async (state) => {
7927
7794
  let exclude = true;
7928
7795
  if (kind === void 0 && comparator === void 0) {
7929
7796
  exclude = !report.alerts.some(
7930
- (alert) => [...kindsMap4.values()].includes(
7797
+ (alert) => [...kindsMap3.values()].includes(
7931
7798
  alert.type
7932
7799
  )
7933
7800
  );
7934
7801
  } else if (comparator) {
7935
- const kindLevel = kindLevelMap3.get(kind);
7802
+ const kindLevel = kindLevelMap2.get(kind);
7936
7803
  if (kindLevel === void 0) break;
7937
7804
  let matchesComparison = false;
7938
7805
  for (const alert of report.alerts) {
7939
7806
  const alertType = alert.type;
7940
- const alertLevelKey = [...kindsMap4.entries()].find(
7807
+ const alertLevelKey = [...kindsMap3.entries()].find(
7941
7808
  ([_, value]) => value === alertType
7942
7809
  )?.[0];
7943
7810
  if (alertLevelKey) {
7944
- const alertLevel = kindLevelMap3.get(alertLevelKey);
7811
+ const alertLevel = kindLevelMap2.get(alertLevelKey);
7945
7812
  if (alertLevel === void 0) continue;
7946
7813
  switch (comparator) {
7947
7814
  case ">":
@@ -7970,7 +7837,7 @@ var squat = async (state) => {
7970
7837
  }
7971
7838
  exclude = !matchesComparison;
7972
7839
  } else {
7973
- const alertName = kindsMap4.get(kind);
7840
+ const alertName = kindsMap3.get(kind);
7974
7841
  exclude = !report.alerts.some((alert) => alert.type === alertName);
7975
7842
  }
7976
7843
  if (exclude) {
@@ -8044,13 +7911,171 @@ var unstable = createSecuritySelectorFilter(
8044
7911
  "unstableOwnership"
8045
7912
  );
8046
7913
 
8047
- // ../../src/query/src/pseudo/vulnerable.ts
8048
- var vulnerable = async (state) => {
8049
- assertSecurityArchive(state, "vulnerable");
7914
+ // ../../src/query/src/pseudo/vuln.ts
7915
+ var kinds6 = /* @__PURE__ */ new Set([
7916
+ "critical",
7917
+ "high",
7918
+ "medium",
7919
+ "low",
7920
+ "0",
7921
+ "1",
7922
+ "2",
7923
+ "3"
7924
+ ]);
7925
+ var kindLevelMap3 = /* @__PURE__ */ new Map([
7926
+ ["critical", 0],
7927
+ ["high", 1],
7928
+ ["medium", 2],
7929
+ ["low", 3],
7930
+ ["0", 0],
7931
+ ["1", 1],
7932
+ ["2", 2],
7933
+ ["3", 3]
7934
+ ]);
7935
+ var alertLevelMap = /* @__PURE__ */ new Map([
7936
+ ["criticalCVE", 0],
7937
+ ["cve", 1],
7938
+ ["potentialVulnerability", 2],
7939
+ ["gptSecurity", 2],
7940
+ ["mildCVE", 3],
7941
+ ["gptAnomaly", 3]
7942
+ ]);
7943
+ var severityLevelMap = /* @__PURE__ */ new Map([
7944
+ ["critical", 0],
7945
+ ["high", 1],
7946
+ ["medium", 2],
7947
+ ["low", 3]
7948
+ ]);
7949
+ var getAlertLevel = (alert) => {
7950
+ const level = alertLevelMap.get(alert.type);
7951
+ if (level != null) return level;
7952
+ if (alert.props?.cveId && alert.severity) {
7953
+ return severityLevelMap.get(alert.severity);
7954
+ }
7955
+ return void 0;
7956
+ };
7957
+ var isVulnKind = (value) => kinds6.has(value);
7958
+ var asVulnKind = (value) => {
7959
+ if (!isVulnKind(value)) {
7960
+ throw error("Expected a valid vuln kind", {
7961
+ found: value,
7962
+ validOptions: Array.from(kinds6)
7963
+ });
7964
+ }
7965
+ return value;
7966
+ };
7967
+ var parseInternals13 = (nodes) => {
7968
+ if (!nodes[0]) {
7969
+ return { kind: void 0, comparator: void 0 };
7970
+ }
7971
+ const selectorNode = asPostcssNodeWithChildren(nodes[0]);
7972
+ if (!selectorNode.nodes[0]) {
7973
+ return { kind: void 0, comparator: void 0 };
7974
+ }
7975
+ let kindValue = "";
7976
+ let comparator = void 0;
7977
+ let kind;
7978
+ if (isStringNode(selectorNode.nodes[0])) {
7979
+ kindValue = removeQuotes(
7980
+ asStringNode(selectorNode.nodes[0]).value
7981
+ );
7982
+ } else if (isTagNode(selectorNode.nodes[0])) {
7983
+ kindValue = asTagNode(selectorNode.nodes[0]).value;
7984
+ }
7985
+ if (kindValue.startsWith(">=")) {
7986
+ comparator = ">=";
7987
+ kindValue = kindValue.substring(2);
7988
+ } else if (kindValue.startsWith("<=")) {
7989
+ comparator = "<=";
7990
+ kindValue = kindValue.substring(2);
7991
+ } else if (kindValue.startsWith(">")) {
7992
+ comparator = ">";
7993
+ kindValue = kindValue.substring(1);
7994
+ } else if (kindValue.startsWith("<")) {
7995
+ comparator = "<";
7996
+ kindValue = kindValue.substring(1);
7997
+ }
7998
+ if (!comparator) {
7999
+ kind = asVulnKind(kindValue);
8000
+ } else {
8001
+ if (isVulnKind(kindValue)) {
8002
+ kind = kindValue;
8003
+ } else {
8004
+ throw error(
8005
+ "Expected a valid vuln kind or number between 0-3",
8006
+ {
8007
+ found: kindValue
8008
+ }
8009
+ );
8010
+ }
8011
+ }
8012
+ return { kind, comparator };
8013
+ };
8014
+ var vuln = async (state) => {
8015
+ assertSecurityArchive(state, "vuln");
8016
+ let internals;
8017
+ try {
8018
+ internals = parseInternals13(
8019
+ asPostcssNodeWithChildren(state.current).nodes
8020
+ );
8021
+ } catch (err) {
8022
+ throw error("Failed to parse :vuln selector", { cause: err });
8023
+ }
8024
+ const { kind, comparator } = internals;
8050
8025
  for (const node of state.partial.nodes) {
8051
8026
  const report = state.securityArchive.get(node.id);
8052
- const hasCve = report?.alerts.some((alert) => alert.props?.cveId);
8053
- if (!hasCve) {
8027
+ if (!report?.alerts || report.alerts.length === 0) {
8028
+ removeNode(state, node);
8029
+ }
8030
+ }
8031
+ for (const node of state.partial.nodes) {
8032
+ const report = state.securityArchive.get(node.id);
8033
+ let exclude = true;
8034
+ if (report) {
8035
+ if (kind === void 0 && comparator === void 0) {
8036
+ exclude = !report.alerts.some((alert) => {
8037
+ const level = getAlertLevel(alert);
8038
+ return level != null && level <= 2;
8039
+ });
8040
+ } else if (comparator) {
8041
+ const kindLevel = kindLevelMap3.get(kind);
8042
+ if (kindLevel == null) break;
8043
+ for (const alert of report.alerts) {
8044
+ const currentAlertLevel = getAlertLevel(alert);
8045
+ if (currentAlertLevel == null) continue;
8046
+ switch (comparator) {
8047
+ case ">":
8048
+ if (currentAlertLevel > kindLevel) {
8049
+ exclude = false;
8050
+ }
8051
+ break;
8052
+ case "<":
8053
+ if (currentAlertLevel < kindLevel) {
8054
+ exclude = false;
8055
+ }
8056
+ break;
8057
+ case ">=":
8058
+ if (currentAlertLevel >= kindLevel) {
8059
+ exclude = false;
8060
+ }
8061
+ break;
8062
+ case "<=":
8063
+ if (currentAlertLevel <= kindLevel) {
8064
+ exclude = false;
8065
+ }
8066
+ break;
8067
+ }
8068
+ if (!exclude) break;
8069
+ }
8070
+ } else {
8071
+ const targetLevel = kindLevelMap3.get(kind);
8072
+ exclude = !report.alerts.some((alert) => {
8073
+ const level = getAlertLevel(alert);
8074
+ return level != null && level === targetLevel;
8075
+ });
8076
+ }
8077
+ }
8078
+ if (exclude) {
8054
8079
  removeNode(state, node);
8055
8080
  }
8056
8081
  }
@@ -8320,8 +8345,8 @@ var pseudoSelectors = new Map(
8320
8345
  unpopular,
8321
8346
  unstable,
8322
8347
  v: semverParser,
8323
- vuln: vulnerable,
8324
- vulnerable,
8348
+ vuln,
8349
+ vulnerable: vuln,
8325
8350
  workspace
8326
8351
  })
8327
8352
  );
@@ -8463,7 +8488,9 @@ var securitySelectors = /* @__PURE__ */ new Set([
8463
8488
  ":unknown",
8464
8489
  ":unmaintained",
8465
8490
  ":unpopular",
8466
- ":unstable"
8491
+ ":unstable",
8492
+ ":vuln",
8493
+ ":vulnerable"
8467
8494
  ]);
8468
8495
  var setMethodToJSON = (node) => {
8469
8496
  const { toJSON } = node;
@@ -8606,20 +8633,9 @@ var Query = class {
8606
8633
  (i) => i.type === "licenseException"
8607
8634
  )
8608
8635
  },
8609
- malware: {
8610
- low: securityArchiveEntry.alerts.some(
8611
- (i) => i.type === "gptAnomaly"
8612
- ),
8613
- medium: securityArchiveEntry.alerts.some(
8614
- (i) => i.type === "gptSecurity"
8615
- ),
8616
- high: securityArchiveEntry.alerts.some(
8617
- (i) => i.type === "gptMalware"
8618
- ),
8619
- critical: securityArchiveEntry.alerts.some(
8620
- (i) => i.type === "malware"
8621
- )
8622
- },
8636
+ malware: securityArchiveEntry.alerts.some(
8637
+ (i) => i.type === "malware" || i.type === "gptMalware"
8638
+ ),
8623
8639
  minified: securityArchiveEntry.alerts.some(
8624
8640
  (i) => i.type === "minifiedFile"
8625
8641
  ),
@@ -8686,7 +8702,21 @@ var Query = class {
8686
8702
  ),
8687
8703
  unstable: securityArchiveEntry.alerts.some(
8688
8704
  (i) => i.type === "unstableOwnership"
8689
- )
8705
+ ),
8706
+ vuln: {
8707
+ low: securityArchiveEntry.alerts.some(
8708
+ (i) => i.type === "mildCVE" || i.type === "gptAnomaly"
8709
+ ),
8710
+ medium: securityArchiveEntry.alerts.some(
8711
+ (i) => i.type === "potentialVulnerability" || i.type === "gptSecurity"
8712
+ ),
8713
+ high: securityArchiveEntry.alerts.some(
8714
+ (i) => i.type === "cve"
8715
+ ),
8716
+ critical: securityArchiveEntry.alerts.some(
8717
+ (i) => i.type === "criticalCVE"
8718
+ )
8719
+ }
8690
8720
  };
8691
8721
  setMethodToJSON(node);
8692
8722
  }
@@ -17,7 +17,7 @@ import {
17
17
  import {
18
18
  generateDefaultHelp,
19
19
  generateFullHelp
20
- } from "./chunk-SSN4CYZF.js";
20
+ } from "./chunk-Y7CQIZ7Y.js";
21
21
  import {
22
22
  isViewClass
23
23
  } from "./chunk-RXNA2XCX.js";
@@ -34,7 +34,7 @@ import {
34
34
  } from "./chunk-FAG776ZD.js";
35
35
  import {
36
36
  defaultView
37
- } from "./chunk-PMCAQG5J.js";
37
+ } from "./chunk-WP6CYBPM.js";
38
38
  import {
39
39
  emitter
40
40
  } from "./chunk-UBLFPJHV.js";