@socketsecurity/cli-with-sentry 1.1.56 → 1.1.57

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.
package/dist/vendor.js CHANGED
@@ -23,8 +23,8 @@ var require$$0$h = process$2;
23
23
  var require$$0$i = require('node:buffer');
24
24
  var require$$2$3 = require('node:https');
25
25
  var require$$0$j = require$$0$d;
26
- var require$$2$4 = require$$1$8;
27
- var require$$3$3 = require$$2$3;
26
+ var require$$1$9 = require$$1$8;
27
+ var require$$0$k = require$$2$3;
28
28
  var require$$5$2 = require('node:readline');
29
29
  var require$$6$2 = require$$0$9;
30
30
  var require$$7$5 = require('../external/@socketsecurity/registry/lib/constants/abort-signal');
@@ -34,29 +34,29 @@ var require$$10 = require('../external/@socketsecurity/registry/lib/json');
34
34
  var require$$11 = require('../external/@socketsecurity/registry/lib/objects');
35
35
  var require$$12 = require('../external/@socketsecurity/registry/lib/promises');
36
36
  var require$$13 = require('../external/@socketsecurity/registry/lib/url');
37
- var require$$1$9 = require$$0$g;
37
+ var require$$1$a = require$$0$g;
38
38
  var node_buffer = require$$0$i;
39
39
  var childProcess = require('node:child_process');
40
- var require$$1$a = require('node:path/win32');
41
- var require$$0$k = require('node:module');
42
- var require$$0$m = fs$6;
43
- var require$$0$l = require('node:crypto');
44
- var require$$0$n = childProcess;
45
- var require$$2$5 = require$$5$2;
46
- var require$$1$b = require('node:readline/promises');
47
- var require$$5$3 = require$$0$k;
48
- var require$$2$6 = require('node:string_decoder');
49
- var require$$2$7 = require$$2$6;
50
- var require$$0$o = require('node:zlib');
51
- var require$$1$c = require$$0$c;
52
- var require$$0$p = require$$0$l;
53
- var require$$0$q = require('node:dns');
54
- var require$$0$r = require('node:net');
55
- var require$$1$d = require('node:tls');
56
- var require$$3$4 = require('node:timers/promises');
40
+ var require$$1$b = require('node:path/win32');
41
+ var require$$0$l = require('node:module');
42
+ var require$$0$n = fs$6;
43
+ var require$$0$m = require('node:crypto');
44
+ var require$$0$o = childProcess;
45
+ var require$$0$p = require$$0$m;
46
+ var require$$2$4 = require$$5$2;
47
+ var require$$1$c = require('node:readline/promises');
48
+ var require$$5$3 = require$$0$l;
49
+ var require$$2$5 = require('node:string_decoder');
50
+ var require$$2$6 = require$$2$5;
51
+ var require$$0$q = require('node:zlib');
52
+ var require$$1$d = require$$0$c;
53
+ var require$$0$r = require('node:dns');
54
+ var require$$0$s = require('node:net');
55
+ var require$$1$e = require('node:tls');
56
+ var require$$3$3 = require('node:timers/promises');
57
57
  var require$$6$3 = require('node:querystring');
58
- var require$$0$s = require('node:http2');
59
- var require$$1$e = require('node:v8');
58
+ var require$$0$t = require('node:http2');
59
+ var require$$1$f = require('node:v8');
60
60
 
61
61
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
62
62
  function camelCase$1(str) {
@@ -10194,19 +10194,19 @@ function requireUtil$5() {
10194
10194
  return util$5;
10195
10195
  }
10196
10196
 
10197
- var types$4 = {};
10197
+ var types$5 = {};
10198
10198
 
10199
- var hasRequiredTypes$4;
10200
- function requireTypes$4() {
10201
- if (hasRequiredTypes$4) return types$4;
10202
- hasRequiredTypes$4 = 1;
10199
+ var hasRequiredTypes$5;
10200
+ function requireTypes$5() {
10201
+ if (hasRequiredTypes$5) return types$5;
10202
+ hasRequiredTypes$5 = 1;
10203
10203
  const path = require$$1$7;
10204
10204
  const Stream = require$$0$9.Stream;
10205
10205
  const url = require$$0$e;
10206
10206
  const Umask = () => {};
10207
10207
  const getLocalAddresses = () => [];
10208
10208
  const semver = () => {};
10209
- types$4.types = {
10209
+ types$5.types = {
10210
10210
  access: [null, 'restricted', 'public'],
10211
10211
  'allow-same-version': Boolean,
10212
10212
  'always-auth': Boolean,
@@ -10330,7 +10330,7 @@ function requireTypes$4() {
10330
10330
  viewer: String,
10331
10331
  _exit: Boolean
10332
10332
  };
10333
- return types$4;
10333
+ return types$5;
10334
10334
  }
10335
10335
 
10336
10336
  var conf;
@@ -10353,7 +10353,7 @@ function requireConf() {
10353
10353
  constructor(base, types) {
10354
10354
  super(base);
10355
10355
  this.root = base;
10356
- this._parseField = util.parseField.bind(null, types || requireTypes$4());
10356
+ this._parseField = util.parseField.bind(null, types || requireTypes$5());
10357
10357
  }
10358
10358
 
10359
10359
  // https://github.com/npm/cli/blob/latest/lib/config/core.js#L326-L338
@@ -18811,22 +18811,22 @@ function requireDraft7() {
18811
18811
 
18812
18812
  var discriminator = {};
18813
18813
 
18814
- var types$3 = {};
18814
+ var types$4 = {};
18815
18815
 
18816
- var hasRequiredTypes$3;
18817
- function requireTypes$3() {
18818
- if (hasRequiredTypes$3) return types$3;
18819
- hasRequiredTypes$3 = 1;
18820
- Object.defineProperty(types$3, "__esModule", {
18816
+ var hasRequiredTypes$4;
18817
+ function requireTypes$4() {
18818
+ if (hasRequiredTypes$4) return types$4;
18819
+ hasRequiredTypes$4 = 1;
18820
+ Object.defineProperty(types$4, "__esModule", {
18821
18821
  value: true
18822
18822
  });
18823
- types$3.DiscrError = void 0;
18823
+ types$4.DiscrError = void 0;
18824
18824
  var DiscrError;
18825
18825
  (function (DiscrError) {
18826
18826
  DiscrError["Tag"] = "tag";
18827
18827
  DiscrError["Mapping"] = "mapping";
18828
- })(DiscrError || (types$3.DiscrError = DiscrError = {}));
18829
- return types$3;
18828
+ })(DiscrError || (types$4.DiscrError = DiscrError = {}));
18829
+ return types$4;
18830
18830
  }
18831
18831
 
18832
18832
  var hasRequiredDiscriminator;
@@ -18837,7 +18837,7 @@ function requireDiscriminator() {
18837
18837
  value: true
18838
18838
  });
18839
18839
  const codegen_1 = requireCodegen();
18840
- const types_1 = requireTypes$3();
18840
+ const types_1 = requireTypes$4();
18841
18841
  const compile_1 = requireCompile$1();
18842
18842
  const ref_error_1 = requireRef_error();
18843
18843
  const util_1 = requireUtil$4();
@@ -27894,8 +27894,8 @@ function requireDist$e () {
27894
27894
  dist$e.createUserAgentFromPkgJson = createUserAgentFromPkgJson;
27895
27895
  const node_events_1 = __importDefault(require$$0$j);
27896
27896
  const node_fs_1 = fs$5;
27897
- const node_http_1 = __importDefault(require$$2$4);
27898
- const node_https_1 = __importDefault(require$$3$3);
27897
+ const node_http_1 = __importDefault(require$$1$9);
27898
+ const node_https_1 = __importDefault(require$$0$k);
27899
27899
  const node_path_1 = __importDefault(path$4);
27900
27900
  const node_readline_1 = __importDefault(require$$5$2);
27901
27901
  const node_stream_1 = require$$6$2;
@@ -29289,7 +29289,7 @@ function requireSupportsColor$2() {
29289
29289
  if (hasRequiredSupportsColor$2) return supportsColor_1$1;
29290
29290
  hasRequiredSupportsColor$2 = 1;
29291
29291
  const os = require$$0$f;
29292
- const tty = require$$1$9;
29292
+ const tty = require$$1$a;
29293
29293
  const hasFlag = requireHasFlag$1();
29294
29294
  const {
29295
29295
  env
@@ -50575,7 +50575,7 @@ function requireLib$M() {
50575
50575
  hasRequiredLib$M = 1;
50576
50576
  const {
50577
50577
  builtinModules: builtins
50578
- } = require$$0$k;
50578
+ } = require$$0$l;
50579
50579
  var scopedPackagePattern = new RegExp('^(?:@([^/]+?)[/])?([^/]+?)$');
50580
50580
  var exclusionList = ['node_modules', 'favicon.ico'];
50581
50581
  function validate(name) {
@@ -50813,7 +50813,7 @@ function requireNpa() {
50813
50813
  URL
50814
50814
  } = require$$0$7;
50815
50815
  // We need to use path/win32 so that we get consistent results in tests, but this also means we need to manually convert backslashes to forward slashes when generating file: urls with paths.
50816
- const path = isWindows ? require$$1$a : path$4;
50816
+ const path = isWindows ? require$$1$b : path$4;
50817
50817
  const {
50818
50818
  homedir
50819
50819
  } = os$3;
@@ -64165,7 +64165,7 @@ function requireTypeAliases () {
64165
64165
  return typeAliases;
64166
64166
  }
64167
64167
 
64168
- var types$2 = {};
64168
+ var types$3 = {};
64169
64169
 
64170
64170
  var errorUtil = {};
64171
64171
 
@@ -64185,16 +64185,16 @@ function requireErrorUtil () {
64185
64185
  return errorUtil;
64186
64186
  }
64187
64187
 
64188
- var hasRequiredTypes$2;
64188
+ var hasRequiredTypes$3;
64189
64189
 
64190
- function requireTypes$2 () {
64191
- if (hasRequiredTypes$2) return types$2;
64192
- hasRequiredTypes$2 = 1;
64193
- Object.defineProperty(types$2, "__esModule", { value: true });
64194
- types$2.discriminatedUnion = types$2.date = types$2.boolean = types$2.bigint = types$2.array = types$2.any = types$2.coerce = types$2.ZodFirstPartyTypeKind = types$2.late = types$2.ZodSchema = types$2.Schema = types$2.ZodReadonly = types$2.ZodPipeline = types$2.ZodBranded = types$2.BRAND = types$2.ZodNaN = types$2.ZodCatch = types$2.ZodDefault = types$2.ZodNullable = types$2.ZodOptional = types$2.ZodTransformer = types$2.ZodEffects = types$2.ZodPromise = types$2.ZodNativeEnum = types$2.ZodEnum = types$2.ZodLiteral = types$2.ZodLazy = types$2.ZodFunction = types$2.ZodSet = types$2.ZodMap = types$2.ZodRecord = types$2.ZodTuple = types$2.ZodIntersection = types$2.ZodDiscriminatedUnion = types$2.ZodUnion = types$2.ZodObject = types$2.ZodArray = types$2.ZodVoid = types$2.ZodNever = types$2.ZodUnknown = types$2.ZodAny = types$2.ZodNull = types$2.ZodUndefined = types$2.ZodSymbol = types$2.ZodDate = types$2.ZodBoolean = types$2.ZodBigInt = types$2.ZodNumber = types$2.ZodString = types$2.ZodType = void 0;
64195
- types$2.NEVER = types$2.void = types$2.unknown = types$2.union = types$2.undefined = types$2.tuple = types$2.transformer = types$2.symbol = types$2.string = types$2.strictObject = types$2.set = types$2.record = types$2.promise = types$2.preprocess = types$2.pipeline = types$2.ostring = types$2.optional = types$2.onumber = types$2.oboolean = types$2.object = types$2.number = types$2.nullable = types$2.null = types$2.never = types$2.nativeEnum = types$2.nan = types$2.map = types$2.literal = types$2.lazy = types$2.intersection = types$2.instanceof = types$2.function = types$2.enum = types$2.effect = void 0;
64196
- types$2.datetimeRegex = datetimeRegex;
64197
- types$2.custom = custom;
64190
+ function requireTypes$3 () {
64191
+ if (hasRequiredTypes$3) return types$3;
64192
+ hasRequiredTypes$3 = 1;
64193
+ Object.defineProperty(types$3, "__esModule", { value: true });
64194
+ types$3.discriminatedUnion = types$3.date = types$3.boolean = types$3.bigint = types$3.array = types$3.any = types$3.coerce = types$3.ZodFirstPartyTypeKind = types$3.late = types$3.ZodSchema = types$3.Schema = types$3.ZodReadonly = types$3.ZodPipeline = types$3.ZodBranded = types$3.BRAND = types$3.ZodNaN = types$3.ZodCatch = types$3.ZodDefault = types$3.ZodNullable = types$3.ZodOptional = types$3.ZodTransformer = types$3.ZodEffects = types$3.ZodPromise = types$3.ZodNativeEnum = types$3.ZodEnum = types$3.ZodLiteral = types$3.ZodLazy = types$3.ZodFunction = types$3.ZodSet = types$3.ZodMap = types$3.ZodRecord = types$3.ZodTuple = types$3.ZodIntersection = types$3.ZodDiscriminatedUnion = types$3.ZodUnion = types$3.ZodObject = types$3.ZodArray = types$3.ZodVoid = types$3.ZodNever = types$3.ZodUnknown = types$3.ZodAny = types$3.ZodNull = types$3.ZodUndefined = types$3.ZodSymbol = types$3.ZodDate = types$3.ZodBoolean = types$3.ZodBigInt = types$3.ZodNumber = types$3.ZodString = types$3.ZodType = void 0;
64195
+ types$3.NEVER = types$3.void = types$3.unknown = types$3.union = types$3.undefined = types$3.tuple = types$3.transformer = types$3.symbol = types$3.string = types$3.strictObject = types$3.set = types$3.record = types$3.promise = types$3.preprocess = types$3.pipeline = types$3.ostring = types$3.optional = types$3.onumber = types$3.oboolean = types$3.object = types$3.number = types$3.nullable = types$3.null = types$3.never = types$3.nativeEnum = types$3.nan = types$3.map = types$3.literal = types$3.lazy = types$3.intersection = types$3.instanceof = types$3.function = types$3.enum = types$3.effect = void 0;
64196
+ types$3.datetimeRegex = datetimeRegex;
64197
+ types$3.custom = custom;
64198
64198
  const ZodError_js_1 = /*@__PURE__*/ requireZodError();
64199
64199
  const errors_js_1 = /*@__PURE__*/ requireErrors$9();
64200
64200
  const errorUtil_js_1 = /*@__PURE__*/ requireErrorUtil();
@@ -64557,9 +64557,9 @@ function requireTypes$2 () {
64557
64557
  return this.safeParse(null).success;
64558
64558
  }
64559
64559
  }
64560
- types$2.ZodType = ZodType;
64561
- types$2.Schema = ZodType;
64562
- types$2.ZodSchema = ZodType;
64560
+ types$3.ZodType = ZodType;
64561
+ types$3.Schema = ZodType;
64562
+ types$3.ZodSchema = ZodType;
64563
64563
  const cuidRegex = /^c[^\s-]{8,}$/i;
64564
64564
  const cuid2Regex = /^[0-9a-z]+$/;
64565
64565
  const ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
@@ -65243,7 +65243,7 @@ function requireTypes$2 () {
65243
65243
  return max;
65244
65244
  }
65245
65245
  }
65246
- types$2.ZodString = ZodString;
65246
+ types$3.ZodString = ZodString;
65247
65247
  ZodString.create = (params) => {
65248
65248
  return new ZodString({
65249
65249
  checks: [],
@@ -65492,7 +65492,7 @@ function requireTypes$2 () {
65492
65492
  return Number.isFinite(min) && Number.isFinite(max);
65493
65493
  }
65494
65494
  }
65495
- types$2.ZodNumber = ZodNumber;
65495
+ types$3.ZodNumber = ZodNumber;
65496
65496
  ZodNumber.create = (params) => {
65497
65497
  return new ZodNumber({
65498
65498
  checks: [],
@@ -65669,7 +65669,7 @@ function requireTypes$2 () {
65669
65669
  return max;
65670
65670
  }
65671
65671
  }
65672
- types$2.ZodBigInt = ZodBigInt;
65672
+ types$3.ZodBigInt = ZodBigInt;
65673
65673
  ZodBigInt.create = (params) => {
65674
65674
  return new ZodBigInt({
65675
65675
  checks: [],
@@ -65696,7 +65696,7 @@ function requireTypes$2 () {
65696
65696
  return (0, parseUtil_js_1.OK)(input.data);
65697
65697
  }
65698
65698
  }
65699
- types$2.ZodBoolean = ZodBoolean;
65699
+ types$3.ZodBoolean = ZodBoolean;
65700
65700
  ZodBoolean.create = (params) => {
65701
65701
  return new ZodBoolean({
65702
65702
  typeName: ZodFirstPartyTypeKind.ZodBoolean,
@@ -65807,7 +65807,7 @@ function requireTypes$2 () {
65807
65807
  return max != null ? new Date(max) : null;
65808
65808
  }
65809
65809
  }
65810
- types$2.ZodDate = ZodDate;
65810
+ types$3.ZodDate = ZodDate;
65811
65811
  ZodDate.create = (params) => {
65812
65812
  return new ZodDate({
65813
65813
  checks: [],
@@ -65831,7 +65831,7 @@ function requireTypes$2 () {
65831
65831
  return (0, parseUtil_js_1.OK)(input.data);
65832
65832
  }
65833
65833
  }
65834
- types$2.ZodSymbol = ZodSymbol;
65834
+ types$3.ZodSymbol = ZodSymbol;
65835
65835
  ZodSymbol.create = (params) => {
65836
65836
  return new ZodSymbol({
65837
65837
  typeName: ZodFirstPartyTypeKind.ZodSymbol,
@@ -65853,7 +65853,7 @@ function requireTypes$2 () {
65853
65853
  return (0, parseUtil_js_1.OK)(input.data);
65854
65854
  }
65855
65855
  }
65856
- types$2.ZodUndefined = ZodUndefined;
65856
+ types$3.ZodUndefined = ZodUndefined;
65857
65857
  ZodUndefined.create = (params) => {
65858
65858
  return new ZodUndefined({
65859
65859
  typeName: ZodFirstPartyTypeKind.ZodUndefined,
@@ -65875,7 +65875,7 @@ function requireTypes$2 () {
65875
65875
  return (0, parseUtil_js_1.OK)(input.data);
65876
65876
  }
65877
65877
  }
65878
- types$2.ZodNull = ZodNull;
65878
+ types$3.ZodNull = ZodNull;
65879
65879
  ZodNull.create = (params) => {
65880
65880
  return new ZodNull({
65881
65881
  typeName: ZodFirstPartyTypeKind.ZodNull,
@@ -65892,7 +65892,7 @@ function requireTypes$2 () {
65892
65892
  return (0, parseUtil_js_1.OK)(input.data);
65893
65893
  }
65894
65894
  }
65895
- types$2.ZodAny = ZodAny;
65895
+ types$3.ZodAny = ZodAny;
65896
65896
  ZodAny.create = (params) => {
65897
65897
  return new ZodAny({
65898
65898
  typeName: ZodFirstPartyTypeKind.ZodAny,
@@ -65909,7 +65909,7 @@ function requireTypes$2 () {
65909
65909
  return (0, parseUtil_js_1.OK)(input.data);
65910
65910
  }
65911
65911
  }
65912
- types$2.ZodUnknown = ZodUnknown;
65912
+ types$3.ZodUnknown = ZodUnknown;
65913
65913
  ZodUnknown.create = (params) => {
65914
65914
  return new ZodUnknown({
65915
65915
  typeName: ZodFirstPartyTypeKind.ZodUnknown,
@@ -65927,7 +65927,7 @@ function requireTypes$2 () {
65927
65927
  return parseUtil_js_1.INVALID;
65928
65928
  }
65929
65929
  }
65930
- types$2.ZodNever = ZodNever;
65930
+ types$3.ZodNever = ZodNever;
65931
65931
  ZodNever.create = (params) => {
65932
65932
  return new ZodNever({
65933
65933
  typeName: ZodFirstPartyTypeKind.ZodNever,
@@ -65949,7 +65949,7 @@ function requireTypes$2 () {
65949
65949
  return (0, parseUtil_js_1.OK)(input.data);
65950
65950
  }
65951
65951
  }
65952
- types$2.ZodVoid = ZodVoid;
65952
+ types$3.ZodVoid = ZodVoid;
65953
65953
  ZodVoid.create = (params) => {
65954
65954
  return new ZodVoid({
65955
65955
  typeName: ZodFirstPartyTypeKind.ZodVoid,
@@ -66047,7 +66047,7 @@ function requireTypes$2 () {
66047
66047
  return this.min(1, message);
66048
66048
  }
66049
66049
  }
66050
- types$2.ZodArray = ZodArray;
66050
+ types$3.ZodArray = ZodArray;
66051
66051
  ZodArray.create = (schema, params) => {
66052
66052
  return new ZodArray({
66053
66053
  type: schema,
@@ -66449,7 +66449,7 @@ function requireTypes$2 () {
66449
66449
  return createZodEnum(util_js_1.util.objectKeys(this.shape));
66450
66450
  }
66451
66451
  }
66452
- types$2.ZodObject = ZodObject;
66452
+ types$3.ZodObject = ZodObject;
66453
66453
  ZodObject.create = (shape, params) => {
66454
66454
  return new ZodObject({
66455
66455
  shape: () => shape,
@@ -66566,7 +66566,7 @@ function requireTypes$2 () {
66566
66566
  return this._def.options;
66567
66567
  }
66568
66568
  }
66569
- types$2.ZodUnion = ZodUnion;
66569
+ types$3.ZodUnion = ZodUnion;
66570
66570
  ZodUnion.create = (types, params) => {
66571
66571
  return new ZodUnion({
66572
66572
  options: types,
@@ -66705,7 +66705,7 @@ function requireTypes$2 () {
66705
66705
  });
66706
66706
  }
66707
66707
  }
66708
- types$2.ZodDiscriminatedUnion = ZodDiscriminatedUnion;
66708
+ types$3.ZodDiscriminatedUnion = ZodDiscriminatedUnion;
66709
66709
  function mergeValues(a, b) {
66710
66710
  const aType = (0, util_js_1.getParsedType)(a);
66711
66711
  const bType = (0, util_js_1.getParsedType)(b);
@@ -66794,7 +66794,7 @@ function requireTypes$2 () {
66794
66794
  }
66795
66795
  }
66796
66796
  }
66797
- types$2.ZodIntersection = ZodIntersection;
66797
+ types$3.ZodIntersection = ZodIntersection;
66798
66798
  ZodIntersection.create = (left, right, params) => {
66799
66799
  return new ZodIntersection({
66800
66800
  left: left,
@@ -66863,7 +66863,7 @@ function requireTypes$2 () {
66863
66863
  });
66864
66864
  }
66865
66865
  }
66866
- types$2.ZodTuple = ZodTuple;
66866
+ types$3.ZodTuple = ZodTuple;
66867
66867
  ZodTuple.create = (schemas, params) => {
66868
66868
  if (!Array.isArray(schemas)) {
66869
66869
  throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
@@ -66929,7 +66929,7 @@ function requireTypes$2 () {
66929
66929
  });
66930
66930
  }
66931
66931
  }
66932
- types$2.ZodRecord = ZodRecord;
66932
+ types$3.ZodRecord = ZodRecord;
66933
66933
  class ZodMap extends ZodType {
66934
66934
  get keySchema() {
66935
66935
  return this._def.keyType;
@@ -66989,7 +66989,7 @@ function requireTypes$2 () {
66989
66989
  }
66990
66990
  }
66991
66991
  }
66992
- types$2.ZodMap = ZodMap;
66992
+ types$3.ZodMap = ZodMap;
66993
66993
  ZodMap.create = (keyType, valueType, params) => {
66994
66994
  return new ZodMap({
66995
66995
  valueType,
@@ -67075,7 +67075,7 @@ function requireTypes$2 () {
67075
67075
  return this.min(1, message);
67076
67076
  }
67077
67077
  }
67078
- types$2.ZodSet = ZodSet;
67078
+ types$3.ZodSet = ZodSet;
67079
67079
  ZodSet.create = (valueType, params) => {
67080
67080
  return new ZodSet({
67081
67081
  valueType,
@@ -67199,7 +67199,7 @@ function requireTypes$2 () {
67199
67199
  });
67200
67200
  }
67201
67201
  }
67202
- types$2.ZodFunction = ZodFunction;
67202
+ types$3.ZodFunction = ZodFunction;
67203
67203
  class ZodLazy extends ZodType {
67204
67204
  get schema() {
67205
67205
  return this._def.getter();
@@ -67210,7 +67210,7 @@ function requireTypes$2 () {
67210
67210
  return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
67211
67211
  }
67212
67212
  }
67213
- types$2.ZodLazy = ZodLazy;
67213
+ types$3.ZodLazy = ZodLazy;
67214
67214
  ZodLazy.create = (getter, params) => {
67215
67215
  return new ZodLazy({
67216
67216
  getter: getter,
@@ -67235,7 +67235,7 @@ function requireTypes$2 () {
67235
67235
  return this._def.value;
67236
67236
  }
67237
67237
  }
67238
- types$2.ZodLiteral = ZodLiteral;
67238
+ types$3.ZodLiteral = ZodLiteral;
67239
67239
  ZodLiteral.create = (value, params) => {
67240
67240
  return new ZodLiteral({
67241
67241
  value: value,
@@ -67314,7 +67314,7 @@ function requireTypes$2 () {
67314
67314
  });
67315
67315
  }
67316
67316
  }
67317
- types$2.ZodEnum = ZodEnum;
67317
+ types$3.ZodEnum = ZodEnum;
67318
67318
  ZodEnum.create = createZodEnum;
67319
67319
  class ZodNativeEnum extends ZodType {
67320
67320
  _parse(input) {
@@ -67347,7 +67347,7 @@ function requireTypes$2 () {
67347
67347
  return this._def.values;
67348
67348
  }
67349
67349
  }
67350
- types$2.ZodNativeEnum = ZodNativeEnum;
67350
+ types$3.ZodNativeEnum = ZodNativeEnum;
67351
67351
  ZodNativeEnum.create = (values, params) => {
67352
67352
  return new ZodNativeEnum({
67353
67353
  values: values,
@@ -67378,7 +67378,7 @@ function requireTypes$2 () {
67378
67378
  }));
67379
67379
  }
67380
67380
  }
67381
- types$2.ZodPromise = ZodPromise;
67381
+ types$3.ZodPromise = ZodPromise;
67382
67382
  ZodPromise.create = (schema, params) => {
67383
67383
  return new ZodPromise({
67384
67384
  type: schema,
@@ -67516,8 +67516,8 @@ function requireTypes$2 () {
67516
67516
  util_js_1.util.assertNever(effect);
67517
67517
  }
67518
67518
  }
67519
- types$2.ZodEffects = ZodEffects;
67520
- types$2.ZodTransformer = ZodEffects;
67519
+ types$3.ZodEffects = ZodEffects;
67520
+ types$3.ZodTransformer = ZodEffects;
67521
67521
  ZodEffects.create = (schema, effect, params) => {
67522
67522
  return new ZodEffects({
67523
67523
  schema,
@@ -67546,7 +67546,7 @@ function requireTypes$2 () {
67546
67546
  return this._def.innerType;
67547
67547
  }
67548
67548
  }
67549
- types$2.ZodOptional = ZodOptional;
67549
+ types$3.ZodOptional = ZodOptional;
67550
67550
  ZodOptional.create = (type, params) => {
67551
67551
  return new ZodOptional({
67552
67552
  innerType: type,
@@ -67566,7 +67566,7 @@ function requireTypes$2 () {
67566
67566
  return this._def.innerType;
67567
67567
  }
67568
67568
  }
67569
- types$2.ZodNullable = ZodNullable;
67569
+ types$3.ZodNullable = ZodNullable;
67570
67570
  ZodNullable.create = (type, params) => {
67571
67571
  return new ZodNullable({
67572
67572
  innerType: type,
@@ -67591,7 +67591,7 @@ function requireTypes$2 () {
67591
67591
  return this._def.innerType;
67592
67592
  }
67593
67593
  }
67594
- types$2.ZodDefault = ZodDefault;
67594
+ types$3.ZodDefault = ZodDefault;
67595
67595
  ZodDefault.create = (type, params) => {
67596
67596
  return new ZodDefault({
67597
67597
  innerType: type,
@@ -67651,7 +67651,7 @@ function requireTypes$2 () {
67651
67651
  return this._def.innerType;
67652
67652
  }
67653
67653
  }
67654
- types$2.ZodCatch = ZodCatch;
67654
+ types$3.ZodCatch = ZodCatch;
67655
67655
  ZodCatch.create = (type, params) => {
67656
67656
  return new ZodCatch({
67657
67657
  innerType: type,
@@ -67675,14 +67675,14 @@ function requireTypes$2 () {
67675
67675
  return { status: "valid", value: input.data };
67676
67676
  }
67677
67677
  }
67678
- types$2.ZodNaN = ZodNaN;
67678
+ types$3.ZodNaN = ZodNaN;
67679
67679
  ZodNaN.create = (params) => {
67680
67680
  return new ZodNaN({
67681
67681
  typeName: ZodFirstPartyTypeKind.ZodNaN,
67682
67682
  ...processCreateParams(params),
67683
67683
  });
67684
67684
  };
67685
- types$2.BRAND = Symbol("zod_brand");
67685
+ types$3.BRAND = Symbol("zod_brand");
67686
67686
  class ZodBranded extends ZodType {
67687
67687
  _parse(input) {
67688
67688
  const { ctx } = this._processInputParams(input);
@@ -67697,7 +67697,7 @@ function requireTypes$2 () {
67697
67697
  return this._def.type;
67698
67698
  }
67699
67699
  }
67700
- types$2.ZodBranded = ZodBranded;
67700
+ types$3.ZodBranded = ZodBranded;
67701
67701
  class ZodPipeline extends ZodType {
67702
67702
  _parse(input) {
67703
67703
  const { status, ctx } = this._processInputParams(input);
@@ -67756,7 +67756,7 @@ function requireTypes$2 () {
67756
67756
  });
67757
67757
  }
67758
67758
  }
67759
- types$2.ZodPipeline = ZodPipeline;
67759
+ types$3.ZodPipeline = ZodPipeline;
67760
67760
  class ZodReadonly extends ZodType {
67761
67761
  _parse(input) {
67762
67762
  const result = this._def.innerType._parse(input);
@@ -67772,7 +67772,7 @@ function requireTypes$2 () {
67772
67772
  return this._def.innerType;
67773
67773
  }
67774
67774
  }
67775
- types$2.ZodReadonly = ZodReadonly;
67775
+ types$3.ZodReadonly = ZodReadonly;
67776
67776
  ZodReadonly.create = (type, params) => {
67777
67777
  return new ZodReadonly({
67778
67778
  innerType: type,
@@ -67825,7 +67825,7 @@ function requireTypes$2 () {
67825
67825
  });
67826
67826
  return ZodAny.create();
67827
67827
  }
67828
- types$2.late = {
67828
+ types$3.late = {
67829
67829
  object: ZodObject.lazycreate,
67830
67830
  };
67831
67831
  var ZodFirstPartyTypeKind;
@@ -67866,89 +67866,89 @@ function requireTypes$2 () {
67866
67866
  ZodFirstPartyTypeKind["ZodBranded"] = "ZodBranded";
67867
67867
  ZodFirstPartyTypeKind["ZodPipeline"] = "ZodPipeline";
67868
67868
  ZodFirstPartyTypeKind["ZodReadonly"] = "ZodReadonly";
67869
- })(ZodFirstPartyTypeKind || (types$2.ZodFirstPartyTypeKind = ZodFirstPartyTypeKind = {}));
67869
+ })(ZodFirstPartyTypeKind || (types$3.ZodFirstPartyTypeKind = ZodFirstPartyTypeKind = {}));
67870
67870
  const instanceOfType = (
67871
67871
  // const instanceOfType = <T extends new (...args: any[]) => any>(
67872
67872
  cls, params = {
67873
67873
  message: `Input not instance of ${cls.name}`,
67874
67874
  }) => custom((data) => data instanceof cls, params);
67875
- types$2.instanceof = instanceOfType;
67875
+ types$3.instanceof = instanceOfType;
67876
67876
  const stringType = ZodString.create;
67877
- types$2.string = stringType;
67877
+ types$3.string = stringType;
67878
67878
  const numberType = ZodNumber.create;
67879
- types$2.number = numberType;
67879
+ types$3.number = numberType;
67880
67880
  const nanType = ZodNaN.create;
67881
- types$2.nan = nanType;
67881
+ types$3.nan = nanType;
67882
67882
  const bigIntType = ZodBigInt.create;
67883
- types$2.bigint = bigIntType;
67883
+ types$3.bigint = bigIntType;
67884
67884
  const booleanType = ZodBoolean.create;
67885
- types$2.boolean = booleanType;
67885
+ types$3.boolean = booleanType;
67886
67886
  const dateType = ZodDate.create;
67887
- types$2.date = dateType;
67887
+ types$3.date = dateType;
67888
67888
  const symbolType = ZodSymbol.create;
67889
- types$2.symbol = symbolType;
67889
+ types$3.symbol = symbolType;
67890
67890
  const undefinedType = ZodUndefined.create;
67891
- types$2.undefined = undefinedType;
67891
+ types$3.undefined = undefinedType;
67892
67892
  const nullType = ZodNull.create;
67893
- types$2.null = nullType;
67893
+ types$3.null = nullType;
67894
67894
  const anyType = ZodAny.create;
67895
- types$2.any = anyType;
67895
+ types$3.any = anyType;
67896
67896
  const unknownType = ZodUnknown.create;
67897
- types$2.unknown = unknownType;
67897
+ types$3.unknown = unknownType;
67898
67898
  const neverType = ZodNever.create;
67899
- types$2.never = neverType;
67899
+ types$3.never = neverType;
67900
67900
  const voidType = ZodVoid.create;
67901
- types$2.void = voidType;
67901
+ types$3.void = voidType;
67902
67902
  const arrayType = ZodArray.create;
67903
- types$2.array = arrayType;
67903
+ types$3.array = arrayType;
67904
67904
  const objectType = ZodObject.create;
67905
- types$2.object = objectType;
67905
+ types$3.object = objectType;
67906
67906
  const strictObjectType = ZodObject.strictCreate;
67907
- types$2.strictObject = strictObjectType;
67907
+ types$3.strictObject = strictObjectType;
67908
67908
  const unionType = ZodUnion.create;
67909
- types$2.union = unionType;
67909
+ types$3.union = unionType;
67910
67910
  const discriminatedUnionType = ZodDiscriminatedUnion.create;
67911
- types$2.discriminatedUnion = discriminatedUnionType;
67911
+ types$3.discriminatedUnion = discriminatedUnionType;
67912
67912
  const intersectionType = ZodIntersection.create;
67913
- types$2.intersection = intersectionType;
67913
+ types$3.intersection = intersectionType;
67914
67914
  const tupleType = ZodTuple.create;
67915
- types$2.tuple = tupleType;
67915
+ types$3.tuple = tupleType;
67916
67916
  const recordType = ZodRecord.create;
67917
- types$2.record = recordType;
67917
+ types$3.record = recordType;
67918
67918
  const mapType = ZodMap.create;
67919
- types$2.map = mapType;
67919
+ types$3.map = mapType;
67920
67920
  const setType = ZodSet.create;
67921
- types$2.set = setType;
67921
+ types$3.set = setType;
67922
67922
  const functionType = ZodFunction.create;
67923
- types$2.function = functionType;
67923
+ types$3.function = functionType;
67924
67924
  const lazyType = ZodLazy.create;
67925
- types$2.lazy = lazyType;
67925
+ types$3.lazy = lazyType;
67926
67926
  const literalType = ZodLiteral.create;
67927
- types$2.literal = literalType;
67927
+ types$3.literal = literalType;
67928
67928
  const enumType = ZodEnum.create;
67929
- types$2.enum = enumType;
67929
+ types$3.enum = enumType;
67930
67930
  const nativeEnumType = ZodNativeEnum.create;
67931
- types$2.nativeEnum = nativeEnumType;
67931
+ types$3.nativeEnum = nativeEnumType;
67932
67932
  const promiseType = ZodPromise.create;
67933
- types$2.promise = promiseType;
67933
+ types$3.promise = promiseType;
67934
67934
  const effectsType = ZodEffects.create;
67935
- types$2.effect = effectsType;
67936
- types$2.transformer = effectsType;
67935
+ types$3.effect = effectsType;
67936
+ types$3.transformer = effectsType;
67937
67937
  const optionalType = ZodOptional.create;
67938
- types$2.optional = optionalType;
67938
+ types$3.optional = optionalType;
67939
67939
  const nullableType = ZodNullable.create;
67940
- types$2.nullable = nullableType;
67940
+ types$3.nullable = nullableType;
67941
67941
  const preprocessType = ZodEffects.createWithPreprocess;
67942
- types$2.preprocess = preprocessType;
67942
+ types$3.preprocess = preprocessType;
67943
67943
  const pipelineType = ZodPipeline.create;
67944
- types$2.pipeline = pipelineType;
67944
+ types$3.pipeline = pipelineType;
67945
67945
  const ostring = () => stringType().optional();
67946
- types$2.ostring = ostring;
67946
+ types$3.ostring = ostring;
67947
67947
  const onumber = () => numberType().optional();
67948
- types$2.onumber = onumber;
67948
+ types$3.onumber = onumber;
67949
67949
  const oboolean = () => booleanType().optional();
67950
- types$2.oboolean = oboolean;
67951
- types$2.coerce = {
67950
+ types$3.oboolean = oboolean;
67951
+ types$3.coerce = {
67952
67952
  string: ((arg) => ZodString.create({ ...arg, coerce: true })),
67953
67953
  number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),
67954
67954
  boolean: ((arg) => ZodBoolean.create({
@@ -67958,8 +67958,8 @@ function requireTypes$2 () {
67958
67958
  bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),
67959
67959
  date: ((arg) => ZodDate.create({ ...arg, coerce: true })),
67960
67960
  };
67961
- types$2.NEVER = parseUtil_js_1.INVALID;
67962
- return types$2;
67961
+ types$3.NEVER = parseUtil_js_1.INVALID;
67962
+ return types$3;
67963
67963
  }
67964
67964
 
67965
67965
  var hasRequiredExternal;
@@ -67987,7 +67987,7 @@ function requireExternal () {
67987
67987
  __exportStar(/*@__PURE__*/ requireParseUtil(), exports);
67988
67988
  __exportStar(/*@__PURE__*/ requireTypeAliases(), exports);
67989
67989
  __exportStar(/*@__PURE__*/ requireUtil$3(), exports);
67990
- __exportStar(/*@__PURE__*/ requireTypes$2(), exports);
67990
+ __exportStar(/*@__PURE__*/ requireTypes$3(), exports);
67991
67991
  __exportStar(/*@__PURE__*/ requireZodError(), exports);
67992
67992
  } (external));
67993
67993
  return external;
@@ -68133,7 +68133,7 @@ function requireGitSha256() {
68133
68133
  });
68134
68134
  gitSha256.computeGitSHA256FromBuffer = computeGitSHA256FromBuffer;
68135
68135
  gitSha256.computeGitSHA256FromChunks = computeGitSHA256FromChunks;
68136
- const crypto = __importStar(require$$0$l);
68136
+ const crypto = __importStar(require$$0$m);
68137
68137
  /**
68138
68138
  * Compute Git-compatible SHA256 hash for a buffer
68139
68139
  * @param buffer - Buffer or Uint8Array to hash
@@ -68214,7 +68214,7 @@ function requireFileHash() {
68214
68214
  });
68215
68215
  fileHash.computeFileGitSHA256 = computeFileGitSHA256;
68216
68216
  const fs = __importStar(require$$0$b);
68217
- const fsp = __importStar(require$$0$m);
68217
+ const fsp = __importStar(require$$0$n);
68218
68218
  const git_sha256_js_1 = requireGitSha256();
68219
68219
  /**
68220
68220
  * Compute Git-compatible SHA256 hash of file contents using streaming
@@ -68288,7 +68288,7 @@ function requireApply$1() {
68288
68288
  apply.applyPackagePatch = applyPackagePatch;
68289
68289
  apply.findNodeModules = findNodeModules;
68290
68290
  apply.findPackagesForPatches = findPackagesForPatches;
68291
- const fs = __importStar(require$$0$m);
68291
+ const fs = __importStar(require$$0$n);
68292
68292
  const path = __importStar(require$$1$7);
68293
68293
  const file_hash_js_1 = requireFileHash();
68294
68294
  /**
@@ -68560,7 +68560,7 @@ function requireOperations() {
68560
68560
  operations.validateManifest = validateManifest;
68561
68561
  operations.readManifest = readManifest;
68562
68562
  operations.writeManifest = writeManifest;
68563
- const fs = __importStar(require$$0$m);
68563
+ const fs = __importStar(require$$0$n);
68564
68564
  const manifest_schema_js_1 = requireManifestSchema();
68565
68565
  /**
68566
68566
  * Get all blob hashes referenced by a manifest (both beforeHash and afterHash)
@@ -68725,7 +68725,7 @@ function requireCleanupBlobs() {
68725
68725
  });
68726
68726
  cleanupBlobs.cleanupUnusedBlobs = cleanupUnusedBlobs;
68727
68727
  cleanupBlobs.formatCleanupResult = formatCleanupResult;
68728
- const fs = __importStar(require$$0$m);
68728
+ const fs = __importStar(require$$0$n);
68729
68729
  const path = __importStar(require$$1$7);
68730
68730
  const operations_js_1 = requireOperations();
68731
68731
  /**
@@ -68877,8 +68877,8 @@ function requireApiClient() {
68877
68877
  });
68878
68878
  apiClient.APIClient = void 0;
68879
68879
  apiClient.getAPIClientFromEnv = getAPIClientFromEnv;
68880
- const https = __importStar(require$$3$3);
68881
- const http = __importStar(require$$2$4);
68880
+ const https = __importStar(require$$0$k);
68881
+ const http = __importStar(require$$1$9);
68882
68882
  // Default public patch API URL for free patches (no auth required).
68883
68883
  const DEFAULT_PATCH_API_PROXY_URL = 'https://patches-api.socket.dev';
68884
68884
  /**
@@ -68895,6 +68895,22 @@ function requireApiClient() {
68895
68895
  console.error(`[socket-patch debug] ${message}`, ...args);
68896
68896
  }
68897
68897
  }
68898
+ // Severity order for sorting (most severe = lowest number)
68899
+ const SEVERITY_ORDER = {
68900
+ critical: 0,
68901
+ high: 1,
68902
+ medium: 2,
68903
+ low: 3,
68904
+ unknown: 4
68905
+ };
68906
+ /**
68907
+ * Get numeric severity order for comparison.
68908
+ * Lower numbers = higher severity.
68909
+ */
68910
+ function getSeverityOrder(severity) {
68911
+ if (!severity) return 4;
68912
+ return SEVERITY_ORDER[severity.toLowerCase()] ?? 4;
68913
+ }
68898
68914
  /**
68899
68915
  * Get the HTTP proxy URL from environment variables.
68900
68916
  * Returns undefined if no proxy is configured.
@@ -68978,6 +68994,65 @@ function requireApiClient() {
68978
68994
  req.end();
68979
68995
  });
68980
68996
  }
68997
+ /**
68998
+ * Make a POST request to the API.
68999
+ */
69000
+ async post(path, body) {
69001
+ const url = `${this.apiUrl}${path}`;
69002
+ debugLog(`POST ${url}`);
69003
+ return new Promise((resolve, reject) => {
69004
+ const urlObj = new URL(url);
69005
+ const isHttps = urlObj.protocol === 'https:';
69006
+ const httpModule = isHttps ? https : http;
69007
+ const jsonBody = JSON.stringify(body);
69008
+ const headers = {
69009
+ 'Accept': 'application/json',
69010
+ 'Content-Type': 'application/json',
69011
+ 'Content-Length': Buffer.byteLength(jsonBody).toString(),
69012
+ 'User-Agent': 'SocketPatchCLI/1.0'
69013
+ };
69014
+ // Only add auth header if we have a token (not using public proxy).
69015
+ if (this.apiToken) {
69016
+ headers['Authorization'] = `Bearer ${this.apiToken}`;
69017
+ }
69018
+ const options = {
69019
+ method: 'POST',
69020
+ headers
69021
+ };
69022
+ const req = httpModule.request(urlObj, options, res => {
69023
+ let data = '';
69024
+ res.on('data', chunk => {
69025
+ data += chunk;
69026
+ });
69027
+ res.on('end', () => {
69028
+ if (res.statusCode === 200) {
69029
+ try {
69030
+ const parsed = JSON.parse(data);
69031
+ resolve(parsed);
69032
+ } catch (err) {
69033
+ reject(new Error(`Failed to parse response: ${err}`));
69034
+ }
69035
+ } else if (res.statusCode === 404) {
69036
+ resolve(null);
69037
+ } else if (res.statusCode === 401) {
69038
+ reject(new Error('Unauthorized: Invalid API token'));
69039
+ } else if (res.statusCode === 403) {
69040
+ const msg = this.usePublicProxy ? 'Forbidden: This resource is only available to paid subscribers.' : 'Forbidden: Access denied.';
69041
+ reject(new Error(msg));
69042
+ } else if (res.statusCode === 429) {
69043
+ reject(new Error('Rate limit exceeded. Please try again later.'));
69044
+ } else {
69045
+ reject(new Error(`API request failed with status ${res.statusCode}: ${data}`));
69046
+ }
69047
+ });
69048
+ });
69049
+ req.on('error', err => {
69050
+ reject(new Error(`Network error: ${err.message}`));
69051
+ });
69052
+ req.write(jsonBody);
69053
+ req.end();
69054
+ });
69055
+ }
68981
69056
  /**
68982
69057
  * Fetch a patch by UUID (full details with blob content)
68983
69058
  */
@@ -69031,6 +69106,136 @@ function requireApiClient() {
69031
69106
  canAccessPaidPatches: false
69032
69107
  };
69033
69108
  }
69109
+ /**
69110
+ * Search patches for multiple packages by PURL (batch)
69111
+ * Returns minimal patch information for each package that has available patches.
69112
+ *
69113
+ * Each PURL must:
69114
+ * - Start with "pkg:"
69115
+ * - Include a valid ecosystem type (npm, pypi, maven, etc.)
69116
+ * - Include package name
69117
+ * - Include version (required for batch lookups)
69118
+ *
69119
+ * Maximum 500 PURLs per request.
69120
+ *
69121
+ * When using the public proxy, this falls back to individual GET requests
69122
+ * per package since the batch endpoint is not available on the public proxy
69123
+ * (POST requests with varying bodies cannot be cached by Cloudflare CDN).
69124
+ */
69125
+ async searchPatchesBatch(orgSlug, purls) {
69126
+ // For authenticated API, use the batch endpoint
69127
+ if (!this.usePublicProxy) {
69128
+ const path = `/v0/orgs/${orgSlug}/patches/batch`;
69129
+ // Use CDX-style components format
69130
+ const components = purls.map(purl => ({
69131
+ purl
69132
+ }));
69133
+ const result = await this.post(path, {
69134
+ components
69135
+ });
69136
+ return result ?? {
69137
+ packages: [],
69138
+ canAccessPaidPatches: false
69139
+ };
69140
+ }
69141
+ // For public proxy, fall back to individual per-package GET requests
69142
+ // These are cacheable by Cloudflare CDN
69143
+ return this.searchPatchesBatchViaIndividualQueries(purls);
69144
+ }
69145
+ /**
69146
+ * Internal method to search patches by making individual GET requests
69147
+ * for each PURL. Used when the batch endpoint is not available.
69148
+ *
69149
+ * Runs requests in parallel with a concurrency limit to avoid overwhelming
69150
+ * the server while still being efficient.
69151
+ */
69152
+ async searchPatchesBatchViaIndividualQueries(purls) {
69153
+ const CONCURRENCY_LIMIT = 10;
69154
+ const packages = [];
69155
+ let canAccessPaidPatches = false;
69156
+ // Process PURLs in parallel with concurrency limit
69157
+ const results = [];
69158
+ for (let i = 0; i < purls.length; i += CONCURRENCY_LIMIT) {
69159
+ const batch = purls.slice(i, i + CONCURRENCY_LIMIT);
69160
+ const batchResults = await Promise.all(batch.map(async purl => {
69161
+ try {
69162
+ const response = await this.searchPatchesByPackage(null, purl);
69163
+ return {
69164
+ purl,
69165
+ response
69166
+ };
69167
+ } catch (error) {
69168
+ // Log error but continue with other packages
69169
+ debugLog(`Error fetching patches for ${purl}:`, error);
69170
+ return {
69171
+ purl,
69172
+ response: null
69173
+ };
69174
+ }
69175
+ }));
69176
+ results.push(...batchResults);
69177
+ }
69178
+ // Convert individual responses to batch response format
69179
+ for (const {
69180
+ purl,
69181
+ response
69182
+ } of results) {
69183
+ if (!response || response.patches.length === 0) {
69184
+ continue;
69185
+ }
69186
+ // Track paid patch access
69187
+ if (response.canAccessPaidPatches) {
69188
+ canAccessPaidPatches = true;
69189
+ }
69190
+ // Convert PatchSearchResult[] to BatchPatchInfo[]
69191
+ const batchPatches = response.patches.map(patch => {
69192
+ // Extract CVE and GHSA IDs from vulnerabilities
69193
+ const cveIds = [];
69194
+ const ghsaIds = [];
69195
+ let highestSeverity = null;
69196
+ let title = '';
69197
+ for (const [ghsaId, vuln] of Object.entries(patch.vulnerabilities)) {
69198
+ // GHSA ID is the key
69199
+ ghsaIds.push(ghsaId);
69200
+ // CVE IDs are in the vuln object
69201
+ for (const cve of vuln.cves) {
69202
+ if (!cveIds.includes(cve)) {
69203
+ cveIds.push(cve);
69204
+ }
69205
+ }
69206
+ // Track highest severity
69207
+ if (!highestSeverity || getSeverityOrder(vuln.severity) < getSeverityOrder(highestSeverity)) {
69208
+ highestSeverity = vuln.severity || null;
69209
+ }
69210
+ // Use first summary as title
69211
+ if (!title && vuln.summary) {
69212
+ title = vuln.summary.length > 100 ? vuln.summary.slice(0, 97) + '...' : vuln.summary;
69213
+ }
69214
+ }
69215
+ // Use description as fallback title
69216
+ if (!title && patch.description) {
69217
+ title = patch.description.length > 100 ? patch.description.slice(0, 97) + '...' : patch.description;
69218
+ }
69219
+ return {
69220
+ uuid: patch.uuid,
69221
+ purl: patch.purl,
69222
+ tier: patch.tier,
69223
+ cveIds: cveIds.sort(),
69224
+ ghsaIds: ghsaIds.sort(),
69225
+ severity: highestSeverity,
69226
+ title
69227
+ };
69228
+ });
69229
+ packages.push({
69230
+ purl,
69231
+ patches: batchPatches
69232
+ });
69233
+ }
69234
+ return {
69235
+ packages,
69236
+ canAccessPaidPatches
69237
+ };
69238
+ }
69034
69239
  /**
69035
69240
  * Fetch a blob by its SHA256 hash.
69036
69241
  * Returns the raw binary content as a Buffer, or null if not found.
@@ -69194,7 +69399,7 @@ function requireBlobFetcher() {
69194
69399
  blobFetcher.createBlobEnsurer = createBlobEnsurer;
69195
69400
  blobFetcher.fetchBlobsByHash = fetchBlobsByHash;
69196
69401
  blobFetcher.formatFetchResult = formatFetchResult;
69197
- const fs = __importStar(require$$0$m);
69402
+ const fs = __importStar(require$$0$n);
69198
69403
  const path = __importStar(require$$1$7);
69199
69404
  const operations_js_1 = requireOperations();
69200
69405
  const api_client_js_1 = requireApiClient();
@@ -69439,151 +69644,892 @@ function requireBlobFetcher() {
69439
69644
  return blobFetcher;
69440
69645
  }
69441
69646
 
69442
- var globalPackages = {};
69647
+ var crawlers = {};
69443
69648
 
69444
- var hasRequiredGlobalPackages;
69445
- function requireGlobalPackages() {
69446
- if (hasRequiredGlobalPackages) return globalPackages;
69447
- hasRequiredGlobalPackages = 1;
69448
- var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
69449
- if (k2 === undefined) k2 = k;
69450
- var desc = Object.getOwnPropertyDescriptor(m, k);
69451
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
69452
- desc = {
69453
- enumerable: true,
69454
- get: function () {
69455
- return m[k];
69456
- }
69457
- };
69458
- }
69459
- Object.defineProperty(o, k2, desc);
69460
- } : function (o, m, k, k2) {
69461
- if (k2 === undefined) k2 = k;
69462
- o[k2] = m[k];
69463
- });
69464
- var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
69465
- Object.defineProperty(o, "default", {
69466
- enumerable: true,
69467
- value: v
69468
- });
69469
- } : function (o, v) {
69470
- o["default"] = v;
69471
- });
69472
- var __importStar = this && this.__importStar || function () {
69473
- var ownKeys = function (o) {
69474
- ownKeys = Object.getOwnPropertyNames || function (o) {
69475
- var ar = [];
69476
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
69477
- return ar;
69478
- };
69479
- return ownKeys(o);
69480
- };
69481
- return function (mod) {
69482
- if (mod && mod.__esModule) return mod;
69483
- var result = {};
69484
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
69485
- __setModuleDefault(result, mod);
69486
- return result;
69487
- };
69488
- }();
69489
- Object.defineProperty(globalPackages, "__esModule", {
69649
+ var types$2 = {};
69650
+
69651
+ var hasRequiredTypes$2;
69652
+ function requireTypes$2() {
69653
+ if (hasRequiredTypes$2) return types$2;
69654
+ hasRequiredTypes$2 = 1;
69655
+ Object.defineProperty(types$2, "__esModule", {
69490
69656
  value: true
69491
69657
  });
69492
- globalPackages.getNpmGlobalPrefix = getNpmGlobalPrefix;
69493
- globalPackages.getYarnGlobalPrefix = getYarnGlobalPrefix;
69494
- globalPackages.getPnpmGlobalPrefix = getPnpmGlobalPrefix;
69495
- globalPackages.getGlobalPrefix = getGlobalPrefix;
69496
- globalPackages.getGlobalNodeModulesPaths = getGlobalNodeModulesPaths;
69497
- globalPackages.isGlobalPath = isGlobalPath;
69498
- const child_process_1 = require$$0$n;
69499
- const path = __importStar(require$$1$7);
69500
- /**
69501
- * Get the npm global node_modules path using 'npm root -g'
69502
- * @returns The path to the global node_modules directory
69503
- */
69504
- function getNpmGlobalPrefix() {
69505
- try {
69506
- const result = (0, child_process_1.execSync)('npm root -g', {
69507
- encoding: 'utf-8',
69508
- stdio: ['pipe', 'pipe', 'pipe']
69509
- });
69510
- return result.trim();
69511
- } catch (error) {
69512
- throw new Error('Failed to determine npm global prefix. Ensure npm is installed and in PATH.');
69513
- }
69514
- }
69515
- /**
69516
- * Get the yarn global node_modules path
69517
- * @returns The path to yarn's global node_modules directory, or null if not available
69518
- */
69519
- function getYarnGlobalPrefix() {
69520
- try {
69521
- const result = (0, child_process_1.execSync)('yarn global dir', {
69522
- encoding: 'utf-8',
69523
- stdio: ['pipe', 'pipe', 'pipe']
69524
- });
69525
- return path.join(result.trim(), 'node_modules');
69526
- } catch {
69527
- return null;
69528
- }
69529
- }
69530
- /**
69531
- * Get the pnpm global node_modules path
69532
- * @returns The path to pnpm's global node_modules directory, or null if not available
69533
- */
69534
- function getPnpmGlobalPrefix() {
69535
- try {
69536
- const result = (0, child_process_1.execSync)('pnpm root -g', {
69537
- encoding: 'utf-8',
69538
- stdio: ['pipe', 'pipe', 'pipe']
69539
- });
69540
- return result.trim();
69541
- } catch {
69542
- return null;
69543
- }
69544
- }
69545
- /**
69546
- * Get the global node_modules path, with support for custom override
69547
- * @param customPrefix - Optional custom path to use instead of auto-detection
69548
- * @returns The path to the global node_modules directory
69549
- */
69550
- function getGlobalPrefix(customPrefix) {
69551
- if (customPrefix) {
69552
- return customPrefix;
69553
- }
69554
- return getNpmGlobalPrefix();
69555
- }
69556
- /**
69557
- * Get all global node_modules paths for package lookup
69558
- * Currently returns npm global path, but could be extended for yarn global, etc.
69559
- * @param customPrefix - Optional custom path to use instead of auto-detection
69560
- * @returns Array of global node_modules paths
69561
- */
69562
- function getGlobalNodeModulesPaths(customPrefix) {
69563
- if (customPrefix) {
69564
- return [customPrefix];
69565
- }
69566
- return [getNpmGlobalPrefix()];
69567
- }
69568
- /**
69569
- * Check if a path is within a global node_modules directory
69570
- */
69571
- function isGlobalPath(pkgPath) {
69572
- try {
69573
- const globalPaths = getGlobalNodeModulesPaths();
69574
- const normalizedPkgPath = path.normalize(pkgPath);
69575
- return globalPaths.some(globalPath => normalizedPkgPath.startsWith(path.normalize(globalPath)));
69576
- } catch {
69577
- return false;
69578
- }
69579
- }
69580
- return globalPackages;
69658
+ return types$2;
69581
69659
  }
69582
69660
 
69583
- var hasRequiredApply;
69584
- function requireApply() {
69585
- if (hasRequiredApply) return apply$1;
69586
- hasRequiredApply = 1;
69661
+ var npmCrawler = {};
69662
+
69663
+ var hasRequiredNpmCrawler;
69664
+ function requireNpmCrawler() {
69665
+ if (hasRequiredNpmCrawler) return npmCrawler;
69666
+ hasRequiredNpmCrawler = 1;
69667
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
69668
+ if (k2 === undefined) k2 = k;
69669
+ var desc = Object.getOwnPropertyDescriptor(m, k);
69670
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
69671
+ desc = {
69672
+ enumerable: true,
69673
+ get: function () {
69674
+ return m[k];
69675
+ }
69676
+ };
69677
+ }
69678
+ Object.defineProperty(o, k2, desc);
69679
+ } : function (o, m, k, k2) {
69680
+ if (k2 === undefined) k2 = k;
69681
+ o[k2] = m[k];
69682
+ });
69683
+ var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
69684
+ Object.defineProperty(o, "default", {
69685
+ enumerable: true,
69686
+ value: v
69687
+ });
69688
+ } : function (o, v) {
69689
+ o["default"] = v;
69690
+ });
69691
+ var __importStar = this && this.__importStar || function () {
69692
+ var ownKeys = function (o) {
69693
+ ownKeys = Object.getOwnPropertyNames || function (o) {
69694
+ var ar = [];
69695
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
69696
+ return ar;
69697
+ };
69698
+ return ownKeys(o);
69699
+ };
69700
+ return function (mod) {
69701
+ if (mod && mod.__esModule) return mod;
69702
+ var result = {};
69703
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
69704
+ __setModuleDefault(result, mod);
69705
+ return result;
69706
+ };
69707
+ }();
69708
+ Object.defineProperty(npmCrawler, "__esModule", {
69709
+ value: true
69710
+ });
69711
+ npmCrawler.NpmCrawler = void 0;
69712
+ npmCrawler.getNpmGlobalPrefix = getNpmGlobalPrefix;
69713
+ npmCrawler.getYarnGlobalPrefix = getYarnGlobalPrefix;
69714
+ npmCrawler.getPnpmGlobalPrefix = getPnpmGlobalPrefix;
69715
+ const fs = __importStar(require$$0$n);
69716
+ const path = __importStar(require$$1$7);
69717
+ const child_process_1 = require$$0$o;
69718
+ const DEFAULT_BATCH_SIZE = 100;
69719
+ /**
69720
+ * Read and parse a package.json file
69721
+ */
69722
+ async function readPackageJson(pkgPath) {
69723
+ try {
69724
+ const content = await fs.readFile(pkgPath, 'utf-8');
69725
+ const pkg = JSON.parse(content);
69726
+ if (typeof pkg.name === 'string' && typeof pkg.version === 'string') {
69727
+ return {
69728
+ name: pkg.name,
69729
+ version: pkg.version
69730
+ };
69731
+ }
69732
+ return null;
69733
+ } catch {
69734
+ return null;
69735
+ }
69736
+ }
69737
+ /**
69738
+ * Parse a package name into namespace and name components
69739
+ */
69740
+ function parsePackageName(fullName) {
69741
+ if (fullName.startsWith('@')) {
69742
+ const slashIndex = fullName.indexOf('/');
69743
+ if (slashIndex !== -1) {
69744
+ return {
69745
+ namespace: fullName.substring(0, slashIndex),
69746
+ name: fullName.substring(slashIndex + 1)
69747
+ };
69748
+ }
69749
+ }
69750
+ return {
69751
+ name: fullName
69752
+ };
69753
+ }
69754
+ /**
69755
+ * Build a PURL string from package components
69756
+ */
69757
+ function buildPurl(namespace, name, version) {
69758
+ if (namespace) {
69759
+ return `pkg:npm/${namespace}/${name}@${version}`;
69760
+ }
69761
+ return `pkg:npm/${name}@${version}`;
69762
+ }
69763
+ /**
69764
+ * Get the npm global node_modules path using 'npm root -g'
69765
+ */
69766
+ function getNpmGlobalPrefix() {
69767
+ try {
69768
+ const result = (0, child_process_1.execSync)('npm root -g', {
69769
+ encoding: 'utf-8',
69770
+ stdio: ['pipe', 'pipe', 'pipe']
69771
+ });
69772
+ return result.trim();
69773
+ } catch {
69774
+ throw new Error('Failed to determine npm global prefix. Ensure npm is installed and in PATH.');
69775
+ }
69776
+ }
69777
+ /**
69778
+ * Get the yarn global node_modules path
69779
+ */
69780
+ function getYarnGlobalPrefix() {
69781
+ try {
69782
+ const result = (0, child_process_1.execSync)('yarn global dir', {
69783
+ encoding: 'utf-8',
69784
+ stdio: ['pipe', 'pipe', 'pipe']
69785
+ });
69786
+ return path.join(result.trim(), 'node_modules');
69787
+ } catch {
69788
+ return null;
69789
+ }
69790
+ }
69791
+ /**
69792
+ * Get the pnpm global node_modules path
69793
+ */
69794
+ function getPnpmGlobalPrefix() {
69795
+ try {
69796
+ const result = (0, child_process_1.execSync)('pnpm root -g', {
69797
+ encoding: 'utf-8',
69798
+ stdio: ['pipe', 'pipe', 'pipe']
69799
+ });
69800
+ return result.trim();
69801
+ } catch {
69802
+ return null;
69803
+ }
69804
+ }
69805
+ /**
69806
+ * NPM ecosystem crawler for discovering packages in node_modules
69807
+ */
69808
+ class NpmCrawler {
69809
+ /**
69810
+ * Get node_modules paths based on options
69811
+ */
69812
+ async getNodeModulesPaths(options) {
69813
+ if (options.global || options.globalPrefix) {
69814
+ // Global mode: return well-known global paths
69815
+ if (options.globalPrefix) {
69816
+ return [options.globalPrefix];
69817
+ }
69818
+ return this.getGlobalNodeModulesPaths();
69819
+ }
69820
+ // Local mode: find node_modules in cwd and workspace directories
69821
+ return this.findLocalNodeModulesDirs(options.cwd);
69822
+ }
69823
+ /**
69824
+ * Get well-known global node_modules paths
69825
+ * Only checks standard locations where global packages are installed
69826
+ */
69827
+ getGlobalNodeModulesPaths() {
69828
+ const paths = [];
69829
+ // Try npm global path
69830
+ try {
69831
+ paths.push(getNpmGlobalPrefix());
69832
+ } catch {
69833
+ // npm not available
69834
+ }
69835
+ // Try pnpm global path
69836
+ const pnpmPath = getPnpmGlobalPrefix();
69837
+ if (pnpmPath) {
69838
+ paths.push(pnpmPath);
69839
+ }
69840
+ // Try yarn global path
69841
+ const yarnPath = getYarnGlobalPrefix();
69842
+ if (yarnPath) {
69843
+ paths.push(yarnPath);
69844
+ }
69845
+ return paths;
69846
+ }
69847
+ /**
69848
+ * Find node_modules directories within the project root.
69849
+ * Recursively searches for workspace node_modules but stays within the project.
69850
+ */
69851
+ async findLocalNodeModulesDirs(startPath) {
69852
+ const results = [];
69853
+ // Check for node_modules directly in startPath
69854
+ const directNodeModules = path.join(startPath, 'node_modules');
69855
+ try {
69856
+ const stat = await fs.stat(directNodeModules);
69857
+ if (stat.isDirectory()) {
69858
+ results.push(directNodeModules);
69859
+ }
69860
+ } catch {
69861
+ // No direct node_modules
69862
+ }
69863
+ // Recursively search for workspace node_modules
69864
+ await this.findWorkspaceNodeModules(startPath, startPath, results);
69865
+ return results;
69866
+ }
69867
+ /**
69868
+ * Recursively find node_modules in subdirectories (for monorepos/workspaces).
69869
+ * Stays within the project by not crossing into other projects or system directories.
69870
+ * Skips symlinks to avoid duplicates and potential infinite loops.
69871
+ */
69872
+ async findWorkspaceNodeModules(dir, rootPath, results) {
69873
+ let entries;
69874
+ try {
69875
+ entries = await fs.readdir(dir, {
69876
+ withFileTypes: true
69877
+ });
69878
+ } catch {
69879
+ return;
69880
+ }
69881
+ for (const entry of entries) {
69882
+ // Skip non-directories and symlinks (avoid duplicates and infinite loops)
69883
+ if (!entry.isDirectory()) continue;
69884
+ const fullPath = path.join(dir, entry.name);
69885
+ // Skip node_modules - we handle these separately when found
69886
+ if (entry.name === 'node_modules') continue;
69887
+ // Skip hidden directories
69888
+ if (entry.name.startsWith('.')) continue;
69889
+ // Skip common build/output directories that won't have workspace node_modules
69890
+ if (entry.name === 'dist' || entry.name === 'build' || entry.name === 'coverage' || entry.name === 'tmp' || entry.name === 'temp' || entry.name === '__pycache__' || entry.name === 'vendor') {
69891
+ continue;
69892
+ }
69893
+ // Check if this subdirectory has its own node_modules
69894
+ const subNodeModules = path.join(fullPath, 'node_modules');
69895
+ try {
69896
+ const stat = await fs.stat(subNodeModules);
69897
+ if (stat.isDirectory()) {
69898
+ results.push(subNodeModules);
69899
+ }
69900
+ } catch {
69901
+ // No node_modules here
69902
+ }
69903
+ // Recurse into subdirectory
69904
+ await this.findWorkspaceNodeModules(fullPath, rootPath, results);
69905
+ }
69906
+ }
69907
+ /**
69908
+ * Yield packages in batches (memory efficient for large codebases)
69909
+ */
69910
+ async *crawlBatches(options) {
69911
+ const batchSize = options.batchSize ?? DEFAULT_BATCH_SIZE;
69912
+ const seen = new Set();
69913
+ let batch = [];
69914
+ const nodeModulesPaths = await this.getNodeModulesPaths(options);
69915
+ for (const nodeModulesPath of nodeModulesPaths) {
69916
+ for await (const pkg of this.scanNodeModules(nodeModulesPath, seen)) {
69917
+ batch.push(pkg);
69918
+ if (batch.length >= batchSize) {
69919
+ yield batch;
69920
+ batch = [];
69921
+ }
69922
+ }
69923
+ }
69924
+ // Yield remaining packages
69925
+ if (batch.length > 0) {
69926
+ yield batch;
69927
+ }
69928
+ }
69929
+ /**
69930
+ * Return all packages at once (convenience method)
69931
+ */
69932
+ async crawlAll(options) {
69933
+ const packages = [];
69934
+ for await (const batch of this.crawlBatches(options)) {
69935
+ packages.push(...batch);
69936
+ }
69937
+ return packages;
69938
+ }
69939
+ /**
69940
+ * Find specific packages by PURL
69941
+ * Efficient O(n) lookup where n = number of PURLs to find
69942
+ */
69943
+ async findByPurls(nodeModulesPath, purls) {
69944
+ const result = new Map();
69945
+ // Parse PURLs to extract package info for targeted lookup
69946
+ const purlSet = new Set(purls);
69947
+ const packageTargets = new Map();
69948
+ for (const purl of purls) {
69949
+ const parsed = this.parsePurl(purl);
69950
+ if (parsed) {
69951
+ // Key by directory path pattern: @scope/name or name
69952
+ const dirKey = parsed.namespace ? `${parsed.namespace}/${parsed.name}` : parsed.name;
69953
+ packageTargets.set(dirKey, {
69954
+ ...parsed,
69955
+ purl
69956
+ });
69957
+ }
69958
+ }
69959
+ // Check each target package directory directly
69960
+ for (const [dirKey, target] of packageTargets) {
69961
+ const pkgPath = path.join(nodeModulesPath, dirKey);
69962
+ const pkgJsonPath = path.join(pkgPath, 'package.json');
69963
+ const pkgInfo = await readPackageJson(pkgJsonPath);
69964
+ if (pkgInfo && pkgInfo.version === target.version) {
69965
+ const purl = buildPurl(target.namespace, target.name, pkgInfo.version);
69966
+ if (purlSet.has(purl)) {
69967
+ result.set(purl, {
69968
+ name: target.name,
69969
+ version: pkgInfo.version,
69970
+ namespace: target.namespace,
69971
+ purl,
69972
+ path: pkgPath
69973
+ });
69974
+ }
69975
+ }
69976
+ }
69977
+ return result;
69978
+ }
69979
+ /**
69980
+ * Scan a node_modules directory and yield packages
69981
+ */
69982
+ async *scanNodeModules(nodeModulesPath, seen) {
69983
+ let entries;
69984
+ try {
69985
+ entries = await fs.readdir(nodeModulesPath, {
69986
+ withFileTypes: true
69987
+ });
69988
+ } catch {
69989
+ return;
69990
+ }
69991
+ for (const entry of entries) {
69992
+ // Skip hidden files and special directories
69993
+ if (entry.name.startsWith('.') || entry.name === 'node_modules') {
69994
+ continue;
69995
+ }
69996
+ // Allow both directories and symlinks (pnpm uses symlinks)
69997
+ if (!entry.isDirectory() && !entry.isSymbolicLink()) {
69998
+ continue;
69999
+ }
70000
+ const entryPath = path.join(nodeModulesPath, entry.name);
70001
+ // Handle scoped packages (@scope/package)
70002
+ if (entry.name.startsWith('@')) {
70003
+ yield* this.scanScopedPackages(entryPath, entry.name, seen);
70004
+ } else {
70005
+ // Regular package
70006
+ const pkg = await this.checkPackage(entryPath, seen);
70007
+ if (pkg) {
70008
+ yield pkg;
70009
+ }
70010
+ // Check for nested node_modules only for real directories (not symlinks)
70011
+ // Symlinked packages (pnpm) have their deps managed separately
70012
+ if (entry.isDirectory()) {
70013
+ yield* this.scanNestedNodeModules(entryPath, seen);
70014
+ }
70015
+ }
70016
+ }
70017
+ }
70018
+ /**
70019
+ * Scan scoped packages directory (@scope/)
70020
+ */
70021
+ async *scanScopedPackages(scopePath, _scope, seen) {
70022
+ let scopeEntries;
70023
+ try {
70024
+ scopeEntries = await fs.readdir(scopePath, {
70025
+ withFileTypes: true
70026
+ });
70027
+ } catch {
70028
+ return;
70029
+ }
70030
+ for (const scopeEntry of scopeEntries) {
70031
+ if (scopeEntry.name.startsWith('.')) continue;
70032
+ // Allow both directories and symlinks (pnpm uses symlinks)
70033
+ if (!scopeEntry.isDirectory() && !scopeEntry.isSymbolicLink()) {
70034
+ continue;
70035
+ }
70036
+ const pkgPath = path.join(scopePath, scopeEntry.name);
70037
+ const pkg = await this.checkPackage(pkgPath, seen);
70038
+ if (pkg) {
70039
+ yield pkg;
70040
+ }
70041
+ // Check for nested node_modules only for real directories (not symlinks)
70042
+ if (scopeEntry.isDirectory()) {
70043
+ yield* this.scanNestedNodeModules(pkgPath, seen);
70044
+ }
70045
+ }
70046
+ }
70047
+ /**
70048
+ * Scan nested node_modules inside a package (if it exists)
70049
+ */
70050
+ async *scanNestedNodeModules(pkgPath, seen) {
70051
+ const nestedNodeModules = path.join(pkgPath, 'node_modules');
70052
+ try {
70053
+ // Try to read the directory - this checks existence and gets entries in one call
70054
+ const entries = await fs.readdir(nestedNodeModules, {
70055
+ withFileTypes: true
70056
+ });
70057
+ // If we got here, the directory exists and we have its entries
70058
+ // Yield packages from this nested node_modules
70059
+ for (const entry of entries) {
70060
+ if (entry.name.startsWith('.') || entry.name === 'node_modules') {
70061
+ continue;
70062
+ }
70063
+ if (!entry.isDirectory() && !entry.isSymbolicLink()) {
70064
+ continue;
70065
+ }
70066
+ const entryPath = path.join(nestedNodeModules, entry.name);
70067
+ if (entry.name.startsWith('@')) {
70068
+ yield* this.scanScopedPackages(entryPath, entry.name, seen);
70069
+ } else {
70070
+ const pkg = await this.checkPackage(entryPath, seen);
70071
+ if (pkg) {
70072
+ yield pkg;
70073
+ }
70074
+ // Recursively check for deeper nested node_modules
70075
+ yield* this.scanNestedNodeModules(entryPath, seen);
70076
+ }
70077
+ }
70078
+ } catch {
70079
+ // No nested node_modules or can't read it - this is the common case
70080
+ }
70081
+ }
70082
+ /**
70083
+ * Check a package directory and return CrawledPackage if valid
70084
+ */
70085
+ async checkPackage(pkgPath, seen) {
70086
+ const packageJsonPath = path.join(pkgPath, 'package.json');
70087
+ const pkgInfo = await readPackageJson(packageJsonPath);
70088
+ if (!pkgInfo) {
70089
+ return null;
70090
+ }
70091
+ const {
70092
+ namespace,
70093
+ name
70094
+ } = parsePackageName(pkgInfo.name);
70095
+ const purl = buildPurl(namespace, name, pkgInfo.version);
70096
+ // Deduplicate by PURL
70097
+ if (seen.has(purl)) {
70098
+ return null;
70099
+ }
70100
+ seen.add(purl);
70101
+ return {
70102
+ name,
70103
+ version: pkgInfo.version,
70104
+ namespace,
70105
+ purl,
70106
+ path: pkgPath
70107
+ };
70108
+ }
70109
+ /**
70110
+ * Parse a PURL string to extract components
70111
+ */
70112
+ parsePurl(purl) {
70113
+ // Format: pkg:npm/name@version or pkg:npm/@scope/name@version
70114
+ const match = purl.match(/^pkg:npm\/(?:(@[^/]+)\/)?([^@]+)@(.+)$/);
70115
+ if (!match) {
70116
+ return null;
70117
+ }
70118
+ return {
70119
+ namespace: match[1] || undefined,
70120
+ name: match[2],
70121
+ version: match[3]
70122
+ };
70123
+ }
70124
+ }
70125
+ npmCrawler.NpmCrawler = NpmCrawler;
70126
+ return npmCrawler;
70127
+ }
70128
+
70129
+ var hasRequiredCrawlers;
70130
+ function requireCrawlers() {
70131
+ if (hasRequiredCrawlers) return crawlers;
70132
+ hasRequiredCrawlers = 1;
70133
+ (function (exports) {
70134
+
70135
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
70136
+ if (k2 === undefined) k2 = k;
70137
+ var desc = Object.getOwnPropertyDescriptor(m, k);
70138
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
70139
+ desc = {
70140
+ enumerable: true,
70141
+ get: function () {
70142
+ return m[k];
70143
+ }
70144
+ };
70145
+ }
70146
+ Object.defineProperty(o, k2, desc);
70147
+ } : function (o, m, k, k2) {
70148
+ if (k2 === undefined) k2 = k;
70149
+ o[k2] = m[k];
70150
+ });
70151
+ var __exportStar = this && this.__exportStar || function (m, exports) {
70152
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
70153
+ };
70154
+ Object.defineProperty(exports, "__esModule", {
70155
+ value: true
70156
+ });
70157
+ exports.getPnpmGlobalPrefix = exports.getYarnGlobalPrefix = exports.getNpmGlobalPrefix = exports.NpmCrawler = void 0;
70158
+ __exportStar(requireTypes$2(), exports);
70159
+ var npm_crawler_js_1 = requireNpmCrawler();
70160
+ Object.defineProperty(exports, "NpmCrawler", {
70161
+ enumerable: true,
70162
+ get: function () {
70163
+ return npm_crawler_js_1.NpmCrawler;
70164
+ }
70165
+ });
70166
+ Object.defineProperty(exports, "getNpmGlobalPrefix", {
70167
+ enumerable: true,
70168
+ get: function () {
70169
+ return npm_crawler_js_1.getNpmGlobalPrefix;
70170
+ }
70171
+ });
70172
+ Object.defineProperty(exports, "getYarnGlobalPrefix", {
70173
+ enumerable: true,
70174
+ get: function () {
70175
+ return npm_crawler_js_1.getYarnGlobalPrefix;
70176
+ }
70177
+ });
70178
+ Object.defineProperty(exports, "getPnpmGlobalPrefix", {
70179
+ enumerable: true,
70180
+ get: function () {
70181
+ return npm_crawler_js_1.getPnpmGlobalPrefix;
70182
+ }
70183
+ });
70184
+ })(crawlers);
70185
+ return crawlers;
70186
+ }
70187
+
70188
+ var telemetry = {};
70189
+
70190
+ var hasRequiredTelemetry;
70191
+ function requireTelemetry() {
70192
+ if (hasRequiredTelemetry) return telemetry;
70193
+ hasRequiredTelemetry = 1;
70194
+ /**
70195
+ * Telemetry module for socket-patch CLI.
70196
+ * Collects anonymous usage data for patch lifecycle events.
70197
+ *
70198
+ * Telemetry can be disabled via:
70199
+ * - Environment variable: SOCKET_PATCH_TELEMETRY_DISABLED=1
70200
+ * - Running in test environment: VITEST=true
70201
+ *
70202
+ * Events are sent to:
70203
+ * - Authenticated: https://api.socket.dev/v0/orgs/{org}/telemetry
70204
+ * - Public proxy: https://patches-api.socket.dev/patch/telemetry
70205
+ */
70206
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
70207
+ if (k2 === undefined) k2 = k;
70208
+ var desc = Object.getOwnPropertyDescriptor(m, k);
70209
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
70210
+ desc = {
70211
+ enumerable: true,
70212
+ get: function () {
70213
+ return m[k];
70214
+ }
70215
+ };
70216
+ }
70217
+ Object.defineProperty(o, k2, desc);
70218
+ } : function (o, m, k, k2) {
70219
+ if (k2 === undefined) k2 = k;
70220
+ o[k2] = m[k];
70221
+ });
70222
+ var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
70223
+ Object.defineProperty(o, "default", {
70224
+ enumerable: true,
70225
+ value: v
70226
+ });
70227
+ } : function (o, v) {
70228
+ o["default"] = v;
70229
+ });
70230
+ var __importStar = this && this.__importStar || function () {
70231
+ var ownKeys = function (o) {
70232
+ ownKeys = Object.getOwnPropertyNames || function (o) {
70233
+ var ar = [];
70234
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
70235
+ return ar;
70236
+ };
70237
+ return ownKeys(o);
70238
+ };
70239
+ return function (mod) {
70240
+ if (mod && mod.__esModule) return mod;
70241
+ var result = {};
70242
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
70243
+ __setModuleDefault(result, mod);
70244
+ return result;
70245
+ };
70246
+ }();
70247
+ Object.defineProperty(telemetry, "__esModule", {
70248
+ value: true
70249
+ });
70250
+ telemetry.trackPatchEvent = trackPatchEvent;
70251
+ telemetry.trackPatchApplied = trackPatchApplied;
70252
+ telemetry.trackPatchApplyFailed = trackPatchApplyFailed;
70253
+ telemetry.trackPatchRemoved = trackPatchRemoved;
70254
+ telemetry.trackPatchRemoveFailed = trackPatchRemoveFailed;
70255
+ telemetry.trackPatchRolledBack = trackPatchRolledBack;
70256
+ telemetry.trackPatchRollbackFailed = trackPatchRollbackFailed;
70257
+ const https = __importStar(require$$0$k);
70258
+ const http = __importStar(require$$1$9);
70259
+ const os = __importStar(os$3);
70260
+ const crypto = __importStar(require$$0$p);
70261
+ // Default public patch API URL for free tier telemetry.
70262
+ const DEFAULT_PATCH_API_PROXY_URL = 'https://patches-api.socket.dev';
70263
+ // Package version - updated during build.
70264
+ const PACKAGE_VERSION = '1.0.0';
70265
+ /**
70266
+ * Check if telemetry is disabled via environment variables.
70267
+ */
70268
+ function isTelemetryDisabled() {
70269
+ return process.env['SOCKET_PATCH_TELEMETRY_DISABLED'] === '1' || process.env['SOCKET_PATCH_TELEMETRY_DISABLED'] === 'true' || false === 'true';
70270
+ }
70271
+ /**
70272
+ * Check if debug mode is enabled.
70273
+ */
70274
+ function isDebugEnabled() {
70275
+ return process.env['SOCKET_PATCH_DEBUG'] === '1' || process.env['SOCKET_PATCH_DEBUG'] === 'true';
70276
+ }
70277
+ /**
70278
+ * Log debug messages when debug mode is enabled.
70279
+ */
70280
+ function debugLog(message, ...args) {
70281
+ if (isDebugEnabled()) {
70282
+ console.error(`[socket-patch telemetry] ${message}`, ...args);
70283
+ }
70284
+ }
70285
+ /**
70286
+ * Generate a unique session ID for the current CLI invocation.
70287
+ * This is shared across all telemetry events in a single CLI run.
70288
+ */
70289
+ const SESSION_ID = crypto.randomUUID();
70290
+ /**
70291
+ * Build the telemetry context for the current environment.
70292
+ */
70293
+ function buildTelemetryContext(command) {
70294
+ return {
70295
+ version: PACKAGE_VERSION,
70296
+ platform: process.platform,
70297
+ node_version: process.version,
70298
+ arch: os.arch(),
70299
+ command
70300
+ };
70301
+ }
70302
+ /**
70303
+ * Sanitize error for telemetry.
70304
+ * Removes sensitive paths and information.
70305
+ */
70306
+ function sanitizeError(error) {
70307
+ const homeDir = os.homedir();
70308
+ let message = error.message;
70309
+ if (homeDir) {
70310
+ message = message.replace(new RegExp(homeDir.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g'), '~');
70311
+ }
70312
+ return {
70313
+ type: error.constructor.name,
70314
+ message
70315
+ };
70316
+ }
70317
+ /**
70318
+ * Build a telemetry event from the given options.
70319
+ */
70320
+ function buildTelemetryEvent(options) {
70321
+ const event = {
70322
+ event_sender_created_at: new Date().toISOString(),
70323
+ event_type: options.eventType,
70324
+ context: buildTelemetryContext(options.command),
70325
+ session_id: SESSION_ID
70326
+ };
70327
+ if (options.metadata && Object.keys(options.metadata).length > 0) {
70328
+ event.metadata = options.metadata;
70329
+ }
70330
+ if (options.error) {
70331
+ event.error = sanitizeError(options.error);
70332
+ }
70333
+ return event;
70334
+ }
70335
+ /**
70336
+ * Send telemetry event to the API.
70337
+ * Returns a promise that resolves when the request completes.
70338
+ * Errors are logged but never thrown - telemetry should never block CLI operations.
70339
+ */
70340
+ async function sendTelemetryEvent(event, apiToken, orgSlug) {
70341
+ // Determine the telemetry endpoint based on authentication.
70342
+ let url;
70343
+ let useAuth = false;
70344
+ if (apiToken && orgSlug) {
70345
+ // Authenticated endpoint.
70346
+ const apiUrl = process.env['SOCKET_API_URL'] || 'https://api.socket.dev';
70347
+ url = `${apiUrl}/v0/orgs/${orgSlug}/telemetry`;
70348
+ useAuth = true;
70349
+ } else {
70350
+ // Public proxy endpoint.
70351
+ const proxyUrl = process.env['SOCKET_PATCH_PROXY_URL'] || DEFAULT_PATCH_API_PROXY_URL;
70352
+ url = `${proxyUrl}/patch/telemetry`;
70353
+ }
70354
+ debugLog(`Sending telemetry to ${url}`, event);
70355
+ return new Promise(resolve => {
70356
+ const body = JSON.stringify(event);
70357
+ const urlObj = new URL(url);
70358
+ const isHttps = urlObj.protocol === 'https:';
70359
+ const httpModule = isHttps ? https : http;
70360
+ const headers = {
70361
+ 'Content-Type': 'application/json',
70362
+ 'Content-Length': Buffer.byteLength(body).toString(),
70363
+ 'User-Agent': 'SocketPatchCLI/1.0'
70364
+ };
70365
+ if (useAuth && apiToken) {
70366
+ headers['Authorization'] = `Bearer ${apiToken}`;
70367
+ }
70368
+ const requestOptions = {
70369
+ method: 'POST',
70370
+ headers,
70371
+ timeout: 5000 // 5 second timeout.
70372
+ };
70373
+ const req = httpModule.request(urlObj, requestOptions, res => {
70374
+ // Consume response body to free resources.
70375
+ res.on('data', () => {});
70376
+ res.on('end', () => {
70377
+ if (res.statusCode === 200) {
70378
+ debugLog('Telemetry sent successfully');
70379
+ } else {
70380
+ debugLog(`Telemetry request returned status ${res.statusCode}`);
70381
+ }
70382
+ resolve();
70383
+ });
70384
+ });
70385
+ req.on('error', err => {
70386
+ debugLog(`Telemetry request failed: ${err.message}`);
70387
+ resolve();
70388
+ });
70389
+ req.on('timeout', () => {
70390
+ debugLog('Telemetry request timed out');
70391
+ req.destroy();
70392
+ resolve();
70393
+ });
70394
+ req.write(body);
70395
+ req.end();
70396
+ });
70397
+ }
70398
+ /**
70399
+ * Track a patch lifecycle event.
70400
+ *
70401
+ * This function is non-blocking and will never throw errors.
70402
+ * Telemetry failures are logged in debug mode but don't affect CLI operation.
70403
+ *
70404
+ * @param options - Event tracking options.
70405
+ * @returns Promise that resolves when the event is sent (or immediately if telemetry is disabled).
70406
+ *
70407
+ * @example
70408
+ * ```typescript
70409
+ * // Track successful patch application.
70410
+ * await trackPatchEvent({
70411
+ * eventType: 'patch_applied',
70412
+ * command: 'apply',
70413
+ * metadata: {
70414
+ * patches_count: 5,
70415
+ * dry_run: false,
70416
+ * },
70417
+ * })
70418
+ *
70419
+ * // Track failed patch application.
70420
+ * await trackPatchEvent({
70421
+ * eventType: 'patch_apply_failed',
70422
+ * command: 'apply',
70423
+ * error: new Error('Failed to apply patch'),
70424
+ * metadata: {
70425
+ * patches_count: 0,
70426
+ * dry_run: false,
70427
+ * },
70428
+ * })
70429
+ * ```
70430
+ */
70431
+ async function trackPatchEvent(options) {
70432
+ if (isTelemetryDisabled()) {
70433
+ debugLog('Telemetry is disabled, skipping event');
70434
+ return;
70435
+ }
70436
+ try {
70437
+ const event = buildTelemetryEvent(options);
70438
+ await sendTelemetryEvent(event, options.apiToken, options.orgSlug);
70439
+ } catch (err) {
70440
+ // Telemetry should never block CLI operations.
70441
+ debugLog(`Failed to track event: ${err instanceof Error ? err.message : String(err)}`);
70442
+ }
70443
+ }
70444
+ /**
70445
+ * Convenience function to track a successful patch application.
70446
+ */
70447
+ async function trackPatchApplied(patchesCount, dryRun, apiToken, orgSlug) {
70448
+ await trackPatchEvent({
70449
+ eventType: 'patch_applied',
70450
+ command: 'apply',
70451
+ metadata: {
70452
+ patches_count: patchesCount,
70453
+ dry_run: dryRun
70454
+ },
70455
+ apiToken,
70456
+ orgSlug
70457
+ });
70458
+ }
70459
+ /**
70460
+ * Convenience function to track a failed patch application.
70461
+ */
70462
+ async function trackPatchApplyFailed(error, dryRun, apiToken, orgSlug) {
70463
+ await trackPatchEvent({
70464
+ eventType: 'patch_apply_failed',
70465
+ command: 'apply',
70466
+ error,
70467
+ metadata: {
70468
+ dry_run: dryRun
70469
+ },
70470
+ apiToken,
70471
+ orgSlug
70472
+ });
70473
+ }
70474
+ /**
70475
+ * Convenience function to track a successful patch removal.
70476
+ */
70477
+ async function trackPatchRemoved(removedCount, apiToken, orgSlug) {
70478
+ await trackPatchEvent({
70479
+ eventType: 'patch_removed',
70480
+ command: 'remove',
70481
+ metadata: {
70482
+ removed_count: removedCount
70483
+ },
70484
+ apiToken,
70485
+ orgSlug
70486
+ });
70487
+ }
70488
+ /**
70489
+ * Convenience function to track a failed patch removal.
70490
+ */
70491
+ async function trackPatchRemoveFailed(error, apiToken, orgSlug) {
70492
+ await trackPatchEvent({
70493
+ eventType: 'patch_remove_failed',
70494
+ command: 'remove',
70495
+ error,
70496
+ apiToken,
70497
+ orgSlug
70498
+ });
70499
+ }
70500
+ /**
70501
+ * Convenience function to track a successful patch rollback.
70502
+ */
70503
+ async function trackPatchRolledBack(rolledBackCount, apiToken, orgSlug) {
70504
+ await trackPatchEvent({
70505
+ eventType: 'patch_rolled_back',
70506
+ command: 'rollback',
70507
+ metadata: {
70508
+ rolled_back_count: rolledBackCount
70509
+ },
70510
+ apiToken,
70511
+ orgSlug
70512
+ });
70513
+ }
70514
+ /**
70515
+ * Convenience function to track a failed patch rollback.
70516
+ */
70517
+ async function trackPatchRollbackFailed(error, apiToken, orgSlug) {
70518
+ await trackPatchEvent({
70519
+ eventType: 'patch_rollback_failed',
70520
+ command: 'rollback',
70521
+ error,
70522
+ apiToken,
70523
+ orgSlug
70524
+ });
70525
+ }
70526
+ return telemetry;
70527
+ }
70528
+
70529
+ var hasRequiredApply;
70530
+ function requireApply() {
70531
+ if (hasRequiredApply) return apply$1;
70532
+ hasRequiredApply = 1;
69587
70533
  var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
69588
70534
  if (k2 === undefined) k2 = k;
69589
70535
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -69629,13 +70575,14 @@ function requireApply() {
69629
70575
  value: true
69630
70576
  });
69631
70577
  apply$1.applyCommand = void 0;
69632
- const fs = __importStar(require$$0$m);
70578
+ const fs = __importStar(require$$0$n);
69633
70579
  const path = __importStar(require$$1$7);
69634
70580
  const manifest_schema_js_1 = requireManifestSchema();
69635
70581
  const apply_js_1 = requireApply$1();
69636
70582
  const cleanup_blobs_js_1 = requireCleanupBlobs();
69637
70583
  const blob_fetcher_js_1 = requireBlobFetcher();
69638
- const global_packages_js_1 = requireGlobalPackages();
70584
+ const index_js_1 = requireCrawlers();
70585
+ const telemetry_js_1 = requireTelemetry();
69639
70586
  async function applyPatches(cwd, manifestPath, dryRun, silent, offline, useGlobal, globalPrefix) {
69640
70587
  // Read and parse manifest
69641
70588
  const manifestContent = await fs.readFile(manifestPath, 'utf-8');
@@ -69684,25 +70631,26 @@ function requireApply() {
69684
70631
  };
69685
70632
  }
69686
70633
  }
69687
- // Find node_modules directories
70634
+ // Find node_modules directories using the crawler
70635
+ const crawler = new index_js_1.NpmCrawler();
69688
70636
  let nodeModulesPaths;
69689
- if (useGlobal || globalPrefix) {
69690
- try {
69691
- nodeModulesPaths = [(0, global_packages_js_1.getGlobalPrefix)(globalPrefix)];
69692
- if (!silent) {
69693
- console.log(`Using global npm packages at: ${nodeModulesPaths[0]}`);
69694
- }
69695
- } catch (error) {
69696
- if (!silent) {
69697
- console.error('Failed to find global npm packages:', error instanceof Error ? error.message : String(error));
69698
- }
69699
- return {
69700
- success: false,
69701
- results: []
69702
- };
70637
+ try {
70638
+ nodeModulesPaths = await crawler.getNodeModulesPaths({
70639
+ cwd,
70640
+ global: useGlobal,
70641
+ globalPrefix
70642
+ });
70643
+ if ((useGlobal || globalPrefix) && !silent && nodeModulesPaths.length > 0) {
70644
+ console.log(`Using global npm packages at: ${nodeModulesPaths[0]}`);
69703
70645
  }
69704
- } else {
69705
- nodeModulesPaths = await (0, apply_js_1.findNodeModules)(cwd);
70646
+ } catch (error) {
70647
+ if (!silent) {
70648
+ console.error('Failed to find npm packages:', error instanceof Error ? error.message : String(error));
70649
+ }
70650
+ return {
70651
+ success: false,
70652
+ results: []
70653
+ };
69706
70654
  }
69707
70655
  if (nodeModulesPaths.length === 0) {
69708
70656
  if (!silent) {
@@ -69713,10 +70661,11 @@ function requireApply() {
69713
70661
  results: []
69714
70662
  };
69715
70663
  }
69716
- // Find all packages that need patching
70664
+ // Find all packages that need patching using the crawler
70665
+ const manifestPurls = Object.keys(manifest.patches);
69717
70666
  const allPackages = new Map();
69718
70667
  for (const nmPath of nodeModulesPaths) {
69719
- const packages = await (0, apply_js_1.findPackagesForPatches)(nmPath, manifest);
70668
+ const packages = await crawler.findByPurls(nmPath, manifestPurls);
69720
70669
  for (const [purl, location] of packages) {
69721
70670
  if (!allPackages.has(purl)) {
69722
70671
  allPackages.set(purl, location.path);
@@ -69797,6 +70746,9 @@ function requireApply() {
69797
70746
  }).example('$0 apply', 'Apply all patches to local packages').example('$0 apply --global', 'Apply patches to global npm packages').example('$0 apply --global-prefix /custom/path', 'Apply patches to custom global location').example('$0 apply --dry-run', 'Preview patches without applying');
69798
70747
  },
69799
70748
  handler: async argv => {
70749
+ // Get API credentials for authenticated telemetry (optional).
70750
+ const apiToken = process.env['SOCKET_API_TOKEN'];
70751
+ const orgSlug = process.env['SOCKET_ORG_SLUG'];
69800
70752
  try {
69801
70753
  const manifestPath = path.isAbsolute(argv['manifest-path']) ? argv['manifest-path'] : path.join(argv.cwd, argv['manifest-path']);
69802
70754
  // Check if manifest exists - exit successfully if no .socket folder is set up
@@ -69834,8 +70786,18 @@ function requireApply() {
69834
70786
  }
69835
70787
  }
69836
70788
  }
70789
+ // Track telemetry event.
70790
+ const patchedCount = results.filter(r => r.success && r.filesPatched.length > 0).length;
70791
+ if (success) {
70792
+ await (0, telemetry_js_1.trackPatchApplied)(patchedCount, argv['dry-run'], apiToken, orgSlug);
70793
+ } else {
70794
+ await (0, telemetry_js_1.trackPatchApplyFailed)(new Error('One or more patches failed to apply'), argv['dry-run'], apiToken, orgSlug);
70795
+ }
69837
70796
  process.exit(success ? 0 : 1);
69838
70797
  } catch (err) {
70798
+ // Track telemetry for unexpected errors.
70799
+ const error = err instanceof Error ? err : new Error(String(err));
70800
+ await (0, telemetry_js_1.trackPatchApplyFailed)(error, argv['dry-run'], apiToken, orgSlug);
69839
70801
  if (!argv.silent) {
69840
70802
  const errorMessage = err instanceof Error ? err.message : String(err);
69841
70803
  console.error(`Error: ${errorMessage}`);
@@ -69849,217 +70811,6 @@ function requireApply() {
69849
70811
 
69850
70812
  var get$2 = {};
69851
70813
 
69852
- var enumeratePackages = {};
69853
-
69854
- var hasRequiredEnumeratePackages;
69855
- function requireEnumeratePackages() {
69856
- if (hasRequiredEnumeratePackages) return enumeratePackages;
69857
- hasRequiredEnumeratePackages = 1;
69858
- var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
69859
- if (k2 === undefined) k2 = k;
69860
- var desc = Object.getOwnPropertyDescriptor(m, k);
69861
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
69862
- desc = {
69863
- enumerable: true,
69864
- get: function () {
69865
- return m[k];
69866
- }
69867
- };
69868
- }
69869
- Object.defineProperty(o, k2, desc);
69870
- } : function (o, m, k, k2) {
69871
- if (k2 === undefined) k2 = k;
69872
- o[k2] = m[k];
69873
- });
69874
- var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
69875
- Object.defineProperty(o, "default", {
69876
- enumerable: true,
69877
- value: v
69878
- });
69879
- } : function (o, v) {
69880
- o["default"] = v;
69881
- });
69882
- var __importStar = this && this.__importStar || function () {
69883
- var ownKeys = function (o) {
69884
- ownKeys = Object.getOwnPropertyNames || function (o) {
69885
- var ar = [];
69886
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
69887
- return ar;
69888
- };
69889
- return ownKeys(o);
69890
- };
69891
- return function (mod) {
69892
- if (mod && mod.__esModule) return mod;
69893
- var result = {};
69894
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
69895
- __setModuleDefault(result, mod);
69896
- return result;
69897
- };
69898
- }();
69899
- Object.defineProperty(enumeratePackages, "__esModule", {
69900
- value: true
69901
- });
69902
- enumeratePackages.enumerateNodeModules = enumerateNodeModules;
69903
- const fs = __importStar(require$$0$m);
69904
- const path = __importStar(require$$1$7);
69905
- /**
69906
- * Read and parse a package.json file
69907
- */
69908
- async function readPackageJson(pkgPath) {
69909
- try {
69910
- const content = await fs.readFile(pkgPath, 'utf-8');
69911
- const pkg = JSON.parse(content);
69912
- if (typeof pkg.name === 'string' && typeof pkg.version === 'string') {
69913
- return {
69914
- name: pkg.name,
69915
- version: pkg.version
69916
- };
69917
- }
69918
- return null;
69919
- } catch {
69920
- return null;
69921
- }
69922
- }
69923
- /**
69924
- * Parse a package name into namespace and name components
69925
- * @param fullName - Full package name (e.g., "@types/node" or "lodash")
69926
- */
69927
- function parsePackageName(fullName) {
69928
- if (fullName.startsWith('@')) {
69929
- const slashIndex = fullName.indexOf('/');
69930
- if (slashIndex !== -1) {
69931
- return {
69932
- namespace: fullName.substring(0, slashIndex),
69933
- name: fullName.substring(slashIndex + 1)
69934
- };
69935
- }
69936
- }
69937
- return {
69938
- name: fullName
69939
- };
69940
- }
69941
- /**
69942
- * Build a PURL string from package components
69943
- */
69944
- function buildPurl(ecosystem, namespace, name, version) {
69945
- if (namespace) {
69946
- return `pkg:${ecosystem}/${namespace}/${name}@${version}`;
69947
- }
69948
- return `pkg:${ecosystem}/${name}@${version}`;
69949
- }
69950
- /**
69951
- * Enumerate all packages in a node_modules directory
69952
- *
69953
- * @param cwd - Working directory to start from
69954
- * @param ecosystem - Package ecosystem (default: npm)
69955
- * @returns Array of enumerated packages
69956
- */
69957
- async function enumerateNodeModules(cwd, ecosystem = 'npm') {
69958
- const packages = [];
69959
- const seen = new Set();
69960
- const nodeModulesPath = path.join(cwd, 'node_modules');
69961
- try {
69962
- await fs.access(nodeModulesPath);
69963
- } catch {
69964
- // node_modules doesn't exist
69965
- return packages;
69966
- }
69967
- await scanDirectory(nodeModulesPath, packages, seen, ecosystem);
69968
- return packages;
69969
- }
69970
- /**
69971
- * Recursively scan a directory for packages
69972
- */
69973
- async function scanDirectory(dirPath, packages, seen, ecosystem) {
69974
- let entries;
69975
- try {
69976
- entries = await fs.readdir(dirPath);
69977
- } catch {
69978
- return;
69979
- }
69980
- for (const entry of entries) {
69981
- // Skip hidden files and special directories
69982
- if (entry.startsWith('.') || entry === 'node_modules') {
69983
- continue;
69984
- }
69985
- const entryPath = path.join(dirPath, entry);
69986
- // Handle scoped packages (@scope/package)
69987
- if (entry.startsWith('@')) {
69988
- // This is a scope directory, scan its contents
69989
- let scopeEntries;
69990
- try {
69991
- scopeEntries = await fs.readdir(entryPath);
69992
- } catch {
69993
- continue;
69994
- }
69995
- for (const scopeEntry of scopeEntries) {
69996
- if (scopeEntry.startsWith('.')) continue;
69997
- const pkgPath = path.join(entryPath, scopeEntry);
69998
- const packageJsonPath = path.join(pkgPath, 'package.json');
69999
- const pkgInfo = await readPackageJson(packageJsonPath);
70000
- if (pkgInfo) {
70001
- const {
70002
- namespace,
70003
- name
70004
- } = parsePackageName(pkgInfo.name);
70005
- const purl = buildPurl(ecosystem, namespace, name, pkgInfo.version);
70006
- // Deduplicate by PURL
70007
- if (!seen.has(purl)) {
70008
- seen.add(purl);
70009
- packages.push({
70010
- name,
70011
- version: pkgInfo.version,
70012
- namespace,
70013
- purl,
70014
- path: pkgPath
70015
- });
70016
- }
70017
- // Check for nested node_modules
70018
- const nestedNodeModules = path.join(pkgPath, 'node_modules');
70019
- try {
70020
- await fs.access(nestedNodeModules);
70021
- await scanDirectory(nestedNodeModules, packages, seen, ecosystem);
70022
- } catch {
70023
- // No nested node_modules
70024
- }
70025
- }
70026
- }
70027
- } else {
70028
- // Regular package
70029
- const packageJsonPath = path.join(entryPath, 'package.json');
70030
- const pkgInfo = await readPackageJson(packageJsonPath);
70031
- if (pkgInfo) {
70032
- const {
70033
- namespace,
70034
- name
70035
- } = parsePackageName(pkgInfo.name);
70036
- const purl = buildPurl(ecosystem, namespace, name, pkgInfo.version);
70037
- // Deduplicate by PURL
70038
- if (!seen.has(purl)) {
70039
- seen.add(purl);
70040
- packages.push({
70041
- name,
70042
- version: pkgInfo.version,
70043
- namespace,
70044
- purl,
70045
- path: entryPath
70046
- });
70047
- }
70048
- // Check for nested node_modules
70049
- const nestedNodeModules = path.join(entryPath, 'node_modules');
70050
- try {
70051
- await fs.access(nestedNodeModules);
70052
- await scanDirectory(nestedNodeModules, packages, seen, ecosystem);
70053
- } catch {
70054
- // No nested node_modules
70055
- }
70056
- }
70057
- }
70058
- }
70059
- }
70060
- return enumeratePackages;
70061
- }
70062
-
70063
70814
  var fuzzyMatch = {};
70064
70815
 
70065
70816
  var hasRequiredFuzzyMatch;
@@ -70237,7 +70988,7 @@ function requireRollback$1() {
70237
70988
  rollback$1.verifyFileRollback = verifyFileRollback;
70238
70989
  rollback$1.rollbackFilePatch = rollbackFilePatch;
70239
70990
  rollback$1.rollbackPackagePatch = rollbackPackagePatch;
70240
- const fs = __importStar(require$$0$m);
70991
+ const fs = __importStar(require$$0$n);
70241
70992
  const path = __importStar(require$$1$7);
70242
70993
  const file_hash_js_1 = requireFileHash();
70243
70994
  /**
@@ -70427,16 +71178,15 @@ function requireGet$2() {
70427
71178
  value: true
70428
71179
  });
70429
71180
  get$2.getCommand = void 0;
70430
- const fs = __importStar(require$$0$m);
71181
+ const fs = __importStar(require$$0$n);
70431
71182
  const path = __importStar(require$$1$7);
70432
- const readline = __importStar(require$$2$5);
71183
+ const readline = __importStar(require$$2$4);
70433
71184
  const os = __importStar(require$$0$f);
70434
71185
  const manifest_schema_js_1 = requireManifestSchema();
70435
71186
  const api_client_js_1 = requireApiClient();
70436
71187
  const cleanup_blobs_js_1 = requireCleanupBlobs();
70437
- const enumerate_packages_js_1 = requireEnumeratePackages();
71188
+ const index_js_1 = requireCrawlers();
70438
71189
  const fuzzy_match_js_1 = requireFuzzyMatch();
70439
- const global_packages_js_1 = requireGlobalPackages();
70440
71190
  const apply_js_1 = requireApply$1();
70441
71191
  const rollback_js_1 = requireRollback$1();
70442
71192
  const blob_fetcher_js_1 = requireBlobFetcher();
@@ -70521,15 +71271,14 @@ function requireGet$2() {
70521
71271
  patches,
70522
71272
  canAccessPaidPatches
70523
71273
  } = searchResponse;
70524
- // Filter to only accessible patches
70525
- const accessiblePatches = patches.filter(patch => patch.tier === 'free' || canAccessPaidPatches);
70526
- if (accessiblePatches.length === 0) {
71274
+ // Include all patches (free and paid) - we'll show upgrade CTA for paid patches
71275
+ if (patches.length === 0) {
70527
71276
  continue;
70528
71277
  }
70529
- // Extract CVE and GHSA IDs from patches
71278
+ // Extract CVE and GHSA IDs from all patches
70530
71279
  const cveIds = new Set();
70531
71280
  const ghsaIds = new Set();
70532
- for (const patch of accessiblePatches) {
71281
+ for (const patch of patches) {
70533
71282
  for (const [vulnId, vulnInfo] of Object.entries(patch.vulnerabilities)) {
70534
71283
  // Check if the vulnId itself is a GHSA
70535
71284
  if (GHSA_PATTERN.test(vulnId)) {
@@ -70547,7 +71296,7 @@ function requireGet$2() {
70547
71296
  }
70548
71297
  packagesWithPatches.push({
70549
71298
  ...pkg,
70550
- patches: accessiblePatches,
71299
+ patches,
70551
71300
  canAccessPaidPatches,
70552
71301
  cveIds: Array.from(cveIds).sort(),
70553
71302
  ghsaIds: Array.from(ghsaIds).sort()
@@ -70603,6 +71352,9 @@ function requireGet$2() {
70603
71352
  // Build vulnerability summary
70604
71353
  const vulnIds = [...pkg.cveIds, ...pkg.ghsaIds];
70605
71354
  const vulnSummary = vulnIds.length > 3 ? `${vulnIds.slice(0, 3).join(', ')} (+${vulnIds.length - 3} more)` : vulnIds.join(', ');
71355
+ // Count free vs paid patches
71356
+ const freePatches = pkg.patches.filter(p => p.tier === 'free').length;
71357
+ const paidPatches = pkg.patches.filter(p => p.tier === 'paid').length;
70606
71358
  // Count patches and show severity info
70607
71359
  const severities = new Set();
70608
71360
  for (const patch of pkg.patches) {
@@ -70614,8 +71366,17 @@ function requireGet$2() {
70614
71366
  const order = ['critical', 'high', 'medium', 'low'];
70615
71367
  return order.indexOf(a.toLowerCase()) - order.indexOf(b.toLowerCase());
70616
71368
  });
71369
+ // Build patch count string
71370
+ let patchCountStr = String(freePatches);
71371
+ if (paidPatches > 0) {
71372
+ if (pkg.canAccessPaidPatches) {
71373
+ patchCountStr += `+${paidPatches}`;
71374
+ } else {
71375
+ patchCountStr += `+\x1b[33m${paidPatches} paid\x1b[0m`;
71376
+ }
71377
+ }
70617
71378
  console.log(` ${i + 1}. ${displayName}@${pkg.version}`);
70618
- console.log(` Patches: ${pkg.patches.length} | Severity: ${severityList.join(', ')}`);
71379
+ console.log(` Patches: ${patchCountStr} | Severity: ${severityList.join(', ')}`);
70619
71380
  console.log(` Fixes: ${vulnSummary}`);
70620
71381
  }
70621
71382
  const rl = readline.createInterface({
@@ -70740,19 +71501,20 @@ function requireGet$2() {
70740
71501
  return false;
70741
71502
  }
70742
71503
  }
70743
- // Find node_modules directories
71504
+ // Find node_modules directories using the crawler
71505
+ const crawler = new index_js_1.NpmCrawler();
70744
71506
  let nodeModulesPaths;
70745
- if (useGlobal || globalPrefix) {
70746
- try {
70747
- nodeModulesPaths = [(0, global_packages_js_1.getGlobalPrefix)(globalPrefix)];
70748
- } catch (error) {
70749
- {
70750
- console.error('Failed to find global npm packages:', error instanceof Error ? error.message : String(error));
70751
- }
70752
- return false;
71507
+ try {
71508
+ nodeModulesPaths = await crawler.getNodeModulesPaths({
71509
+ cwd,
71510
+ global: useGlobal,
71511
+ globalPrefix
71512
+ });
71513
+ } catch (error) {
71514
+ {
71515
+ console.error('Failed to find npm packages:', error instanceof Error ? error.message : String(error));
70753
71516
  }
70754
- } else {
70755
- nodeModulesPaths = await (0, apply_js_1.findNodeModules)(cwd);
71517
+ return false;
70756
71518
  }
70757
71519
  if (nodeModulesPaths.length === 0) {
70758
71520
  {
@@ -70760,10 +71522,11 @@ function requireGet$2() {
70760
71522
  }
70761
71523
  return false;
70762
71524
  }
70763
- // Find all packages that need patching
71525
+ // Find all packages that need patching using the crawler
71526
+ const manifestPurls = Object.keys(manifest.patches);
70764
71527
  const allPackages = new Map();
70765
71528
  for (const nmPath of nodeModulesPaths) {
70766
- const packages = await (0, apply_js_1.findPackagesForPatches)(nmPath, manifest);
71529
+ const packages = await crawler.findByPurls(nmPath, manifestPurls);
70767
71530
  for (const [purl, location] of packages) {
70768
71531
  if (!allPackages.has(purl)) {
70769
71532
  allPackages.set(purl, location.path);
@@ -70816,21 +71579,23 @@ function requireGet$2() {
70816
71579
  * Handle one-off patch application (no manifest storage)
70817
71580
  */
70818
71581
  async function applyOneOffPatch(patch, useGlobal, cwd, silent, globalPrefix) {
70819
- // Find the package location
71582
+ // Find the package location using the crawler
71583
+ const crawler = new index_js_1.NpmCrawler();
70820
71584
  let nodeModulesPath;
70821
- if (useGlobal || globalPrefix) {
70822
- try {
70823
- nodeModulesPath = (0, global_packages_js_1.getGlobalPrefix)(globalPrefix);
70824
- } catch (error) {
70825
- {
70826
- console.error('Failed to find global npm packages:', error instanceof Error ? error.message : String(error));
70827
- }
70828
- return {
70829
- success: false
70830
- };
71585
+ try {
71586
+ const paths = await crawler.getNodeModulesPaths({
71587
+ cwd,
71588
+ global: useGlobal,
71589
+ globalPrefix
71590
+ });
71591
+ nodeModulesPath = paths[0] ?? path.join(cwd, 'node_modules');
71592
+ } catch (error) {
71593
+ {
71594
+ console.error('Failed to find npm packages:', error instanceof Error ? error.message : String(error));
70831
71595
  }
70832
- } else {
70833
- nodeModulesPath = path.join(cwd, 'node_modules');
71596
+ return {
71597
+ success: false
71598
+ };
70834
71599
  }
70835
71600
  // Parse PURL to get package directory
70836
71601
  const parsed = parsePurl(patch.purl);
@@ -70976,17 +71741,21 @@ function requireGet$2() {
70976
71741
  }
70977
71742
  // The org slug to use (null when using public proxy)
70978
71743
  const effectiveOrgSlug = usePublicProxy ? null : orgSlug ?? null;
70979
- // Determine node_modules path for package lookups
71744
+ // Determine node_modules path for package lookups using the crawler
71745
+ const crawler = new index_js_1.NpmCrawler();
70980
71746
  let nodeModulesPath;
70981
- if (useGlobal || globalPrefix) {
70982
- try {
70983
- nodeModulesPath = (0, global_packages_js_1.getGlobalPrefix)(globalPrefix);
71747
+ try {
71748
+ const paths = await crawler.getNodeModulesPaths({
71749
+ cwd,
71750
+ global: useGlobal,
71751
+ globalPrefix
71752
+ });
71753
+ nodeModulesPath = paths[0] ?? path.join(cwd, 'node_modules');
71754
+ if (useGlobal || globalPrefix) {
70984
71755
  console.log(`Using global npm packages at: ${nodeModulesPath}`);
70985
- } catch (error) {
70986
- throw new Error(`Failed to find global npm packages: ${error instanceof Error ? error.message : String(error)}`);
70987
71756
  }
70988
- } else {
70989
- nodeModulesPath = path.join(cwd, 'node_modules');
71757
+ } catch (error) {
71758
+ throw new Error(`Failed to find npm packages: ${error instanceof Error ? error.message : String(error)}`);
70990
71759
  }
70991
71760
  // Determine identifier type
70992
71761
  let idType;
@@ -71018,6 +71787,17 @@ function requireGet$2() {
71018
71787
  console.log(`No patch found with UUID: ${identifier}`);
71019
71788
  return true;
71020
71789
  }
71790
+ // Check if patch is paid and user doesn't have access
71791
+ if (patch.tier === 'paid' && usePublicProxy) {
71792
+ console.log(`\n\x1b[33m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m`);
71793
+ console.log(`\x1b[33m This patch requires a paid subscription to download.\x1b[0m`);
71794
+ console.log(`\x1b[33m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m`);
71795
+ console.log(`\n Patch: ${patch.purl}`);
71796
+ console.log(` Tier: \x1b[33mpaid\x1b[0m`);
71797
+ console.log(`\n Upgrade to Socket's paid plan to access this patch and many more:`);
71798
+ console.log(` \x1b[36mhttps://socket.dev/pricing\x1b[0m\n`);
71799
+ return true;
71800
+ }
71021
71801
  // Handle one-off mode
71022
71802
  if (oneOff) {
71023
71803
  const {
@@ -71090,10 +71870,13 @@ function requireGet$2() {
71090
71870
  }
71091
71871
  case 'package':
71092
71872
  {
71093
- // Enumerate packages from node_modules and fuzzy match
71094
- const enumPath = useGlobal ? nodeModulesPath : cwd;
71095
- console.log(`Enumerating packages in ${enumPath}...`);
71096
- const packages = useGlobal ? await (0, enumerate_packages_js_1.enumerateNodeModules)(path.dirname(nodeModulesPath)) : await (0, enumerate_packages_js_1.enumerateNodeModules)(cwd);
71873
+ // Enumerate packages from node_modules using the crawler and fuzzy match
71874
+ console.log(`Enumerating packages in ${nodeModulesPath}...`);
71875
+ const packages = await crawler.crawlAll({
71876
+ cwd,
71877
+ global: useGlobal,
71878
+ globalPrefix
71879
+ });
71097
71880
  if (packages.length === 0) {
71098
71881
  console.log(useGlobal ? 'No global packages found.' : 'No packages found in node_modules. Run npm/yarn/pnpm install first.');
71099
71882
  return true;
@@ -71218,11 +72001,16 @@ function requireGet$2() {
71218
72001
  if (notInstalledCount > 0) {
71219
72002
  console.log(`Note: ${notInstalledCount} patch(es) for packages not installed in this project were hidden.`);
71220
72003
  }
71221
- if (inaccessibleCount > 0) {
71222
- console.log(`Note: ${inaccessibleCount} patch(es) require paid access and will be skipped.`);
72004
+ if (inaccessibleCount > 0 && !canAccessPaidPatches) {
72005
+ console.log(`\x1b[33mNote: ${inaccessibleCount} patch(es) require a paid subscription and will be skipped.\x1b[0m`);
71223
72006
  }
71224
72007
  if (accessiblePatches.length === 0) {
71225
- console.log('No accessible patches available. Upgrade to access paid patches.');
72008
+ console.log(`\n\x1b[33m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m`);
72009
+ console.log(`\x1b[33m All available patches require a paid subscription.\x1b[0m`);
72010
+ console.log(`\x1b[33m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m`);
72011
+ console.log(`\n Found ${inaccessibleCount} paid patch(es) that you cannot currently access.`);
72012
+ console.log(`\n Upgrade to Socket's paid plan to access these patches:`);
72013
+ console.log(` \x1b[36mhttps://socket.dev/pricing\x1b[0m\n`);
71226
72014
  return true;
71227
72015
  }
71228
72016
  // Prompt for confirmation if multiple patches and not using --yes
@@ -71456,7 +72244,7 @@ function requireList$1() {
71456
72244
  value: true
71457
72245
  });
71458
72246
  list$1.listCommand = void 0;
71459
- const fs = __importStar(require$$0$m);
72247
+ const fs = __importStar(require$$0$n);
71460
72248
  const path = __importStar(require$$1$7);
71461
72249
  const manifest_schema_js_1 = requireManifestSchema();
71462
72250
  async function listPatches(manifestPath, outputJson) {
@@ -71589,6 +72377,147 @@ var remove = {};
71589
72377
 
71590
72378
  var rollback = {};
71591
72379
 
72380
+ var globalPackages = {};
72381
+
72382
+ var hasRequiredGlobalPackages;
72383
+ function requireGlobalPackages() {
72384
+ if (hasRequiredGlobalPackages) return globalPackages;
72385
+ hasRequiredGlobalPackages = 1;
72386
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
72387
+ if (k2 === undefined) k2 = k;
72388
+ var desc = Object.getOwnPropertyDescriptor(m, k);
72389
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
72390
+ desc = {
72391
+ enumerable: true,
72392
+ get: function () {
72393
+ return m[k];
72394
+ }
72395
+ };
72396
+ }
72397
+ Object.defineProperty(o, k2, desc);
72398
+ } : function (o, m, k, k2) {
72399
+ if (k2 === undefined) k2 = k;
72400
+ o[k2] = m[k];
72401
+ });
72402
+ var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
72403
+ Object.defineProperty(o, "default", {
72404
+ enumerable: true,
72405
+ value: v
72406
+ });
72407
+ } : function (o, v) {
72408
+ o["default"] = v;
72409
+ });
72410
+ var __importStar = this && this.__importStar || function () {
72411
+ var ownKeys = function (o) {
72412
+ ownKeys = Object.getOwnPropertyNames || function (o) {
72413
+ var ar = [];
72414
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
72415
+ return ar;
72416
+ };
72417
+ return ownKeys(o);
72418
+ };
72419
+ return function (mod) {
72420
+ if (mod && mod.__esModule) return mod;
72421
+ var result = {};
72422
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
72423
+ __setModuleDefault(result, mod);
72424
+ return result;
72425
+ };
72426
+ }();
72427
+ Object.defineProperty(globalPackages, "__esModule", {
72428
+ value: true
72429
+ });
72430
+ globalPackages.getNpmGlobalPrefix = getNpmGlobalPrefix;
72431
+ globalPackages.getYarnGlobalPrefix = getYarnGlobalPrefix;
72432
+ globalPackages.getPnpmGlobalPrefix = getPnpmGlobalPrefix;
72433
+ globalPackages.getGlobalPrefix = getGlobalPrefix;
72434
+ globalPackages.getGlobalNodeModulesPaths = getGlobalNodeModulesPaths;
72435
+ globalPackages.isGlobalPath = isGlobalPath;
72436
+ const child_process_1 = require$$0$o;
72437
+ const path = __importStar(require$$1$7);
72438
+ /**
72439
+ * Get the npm global node_modules path using 'npm root -g'
72440
+ * @returns The path to the global node_modules directory
72441
+ */
72442
+ function getNpmGlobalPrefix() {
72443
+ try {
72444
+ const result = (0, child_process_1.execSync)('npm root -g', {
72445
+ encoding: 'utf-8',
72446
+ stdio: ['pipe', 'pipe', 'pipe']
72447
+ });
72448
+ return result.trim();
72449
+ } catch (error) {
72450
+ throw new Error('Failed to determine npm global prefix. Ensure npm is installed and in PATH.');
72451
+ }
72452
+ }
72453
+ /**
72454
+ * Get the yarn global node_modules path
72455
+ * @returns The path to yarn's global node_modules directory, or null if not available
72456
+ */
72457
+ function getYarnGlobalPrefix() {
72458
+ try {
72459
+ const result = (0, child_process_1.execSync)('yarn global dir', {
72460
+ encoding: 'utf-8',
72461
+ stdio: ['pipe', 'pipe', 'pipe']
72462
+ });
72463
+ return path.join(result.trim(), 'node_modules');
72464
+ } catch {
72465
+ return null;
72466
+ }
72467
+ }
72468
+ /**
72469
+ * Get the pnpm global node_modules path
72470
+ * @returns The path to pnpm's global node_modules directory, or null if not available
72471
+ */
72472
+ function getPnpmGlobalPrefix() {
72473
+ try {
72474
+ const result = (0, child_process_1.execSync)('pnpm root -g', {
72475
+ encoding: 'utf-8',
72476
+ stdio: ['pipe', 'pipe', 'pipe']
72477
+ });
72478
+ return result.trim();
72479
+ } catch {
72480
+ return null;
72481
+ }
72482
+ }
72483
+ /**
72484
+ * Get the global node_modules path, with support for custom override
72485
+ * @param customPrefix - Optional custom path to use instead of auto-detection
72486
+ * @returns The path to the global node_modules directory
72487
+ */
72488
+ function getGlobalPrefix(customPrefix) {
72489
+ if (customPrefix) {
72490
+ return customPrefix;
72491
+ }
72492
+ return getNpmGlobalPrefix();
72493
+ }
72494
+ /**
72495
+ * Get all global node_modules paths for package lookup
72496
+ * Currently returns npm global path, but could be extended for yarn global, etc.
72497
+ * @param customPrefix - Optional custom path to use instead of auto-detection
72498
+ * @returns Array of global node_modules paths
72499
+ */
72500
+ function getGlobalNodeModulesPaths(customPrefix) {
72501
+ if (customPrefix) {
72502
+ return [customPrefix];
72503
+ }
72504
+ return [getNpmGlobalPrefix()];
72505
+ }
72506
+ /**
72507
+ * Check if a path is within a global node_modules directory
72508
+ */
72509
+ function isGlobalPath(pkgPath) {
72510
+ try {
72511
+ const globalPaths = getGlobalNodeModulesPaths();
72512
+ const normalizedPkgPath = path.normalize(pkgPath);
72513
+ return globalPaths.some(globalPath => normalizedPkgPath.startsWith(path.normalize(globalPath)));
72514
+ } catch {
72515
+ return false;
72516
+ }
72517
+ }
72518
+ return globalPackages;
72519
+ }
72520
+
71592
72521
  var hasRequiredRollback;
71593
72522
  function requireRollback() {
71594
72523
  if (hasRequiredRollback) return rollback;
@@ -71640,7 +72569,7 @@ function requireRollback() {
71640
72569
  rollback.rollbackCommand = void 0;
71641
72570
  rollback.rollbackPatches = rollbackPatches;
71642
72571
  rollback.findPatchesToRollback = findPatchesToRollback;
71643
- const fs = __importStar(require$$0$m);
72572
+ const fs = __importStar(require$$0$n);
71644
72573
  const path = __importStar(require$$1$7);
71645
72574
  const os = __importStar(require$$0$f);
71646
72575
  const manifest_schema_js_1 = requireManifestSchema();
@@ -71649,6 +72578,7 @@ function requireRollback() {
71649
72578
  const blob_fetcher_js_1 = requireBlobFetcher();
71650
72579
  const global_packages_js_1 = requireGlobalPackages();
71651
72580
  const api_client_js_1 = requireApiClient();
72581
+ const telemetry_js_1 = requireTelemetry();
71652
72582
  /**
71653
72583
  * Find patches to rollback based on identifier
71654
72584
  * - If identifier starts with 'pkg:' -> treat as PURL
@@ -71913,10 +72843,19 @@ function requireRollback() {
71913
72843
  });
71914
72844
  },
71915
72845
  handler: async argv => {
72846
+ // Get API credentials for authenticated telemetry (optional).
72847
+ const apiToken = argv['api-token'] || process.env['SOCKET_API_TOKEN'];
72848
+ const orgSlug = argv.org || process.env['SOCKET_ORG_SLUG'];
71916
72849
  try {
71917
72850
  // Handle one-off mode (no manifest required)
71918
72851
  if (argv['one-off']) {
71919
72852
  const success = await rollbackOneOff(argv.identifier, argv.cwd, argv.global, argv['global-prefix'], argv['dry-run'], argv.silent, argv.org, argv['api-url'], argv['api-token']);
72853
+ // Track telemetry for one-off rollback.
72854
+ if (success) {
72855
+ await (0, telemetry_js_1.trackPatchRolledBack)(1, apiToken, orgSlug);
72856
+ } else {
72857
+ await (0, telemetry_js_1.trackPatchRollbackFailed)(new Error('One-off rollback failed'), apiToken, orgSlug);
72858
+ }
71920
72859
  process.exit(success ? 0 : 1);
71921
72860
  }
71922
72861
  const manifestPath = path.isAbsolute(argv['manifest-path']) ? argv['manifest-path'] : path.join(argv.cwd, argv['manifest-path']);
@@ -71966,8 +72905,18 @@ function requireRollback() {
71966
72905
  }
71967
72906
  }
71968
72907
  }
72908
+ // Track telemetry event.
72909
+ const rolledBackCount = results.filter(r => r.success && r.filesRolledBack.length > 0).length;
72910
+ if (success) {
72911
+ await (0, telemetry_js_1.trackPatchRolledBack)(rolledBackCount, apiToken, orgSlug);
72912
+ } else {
72913
+ await (0, telemetry_js_1.trackPatchRollbackFailed)(new Error('One or more rollbacks failed'), apiToken, orgSlug);
72914
+ }
71969
72915
  process.exit(success ? 0 : 1);
71970
72916
  } catch (err) {
72917
+ // Track telemetry for unexpected errors.
72918
+ const error = err instanceof Error ? err : new Error(String(err));
72919
+ await (0, telemetry_js_1.trackPatchRollbackFailed)(error, apiToken, orgSlug);
71971
72920
  if (!argv.silent) {
71972
72921
  const errorMessage = err instanceof Error ? err.message : String(err);
71973
72922
  console.error(`Error: ${errorMessage}`);
@@ -72190,11 +73139,12 @@ function requireRemove() {
72190
73139
  value: true
72191
73140
  });
72192
73141
  remove.removeCommand = void 0;
72193
- const fs = __importStar(require$$0$m);
73142
+ const fs = __importStar(require$$0$n);
72194
73143
  const path = __importStar(require$$1$7);
72195
73144
  const manifest_schema_js_1 = requireManifestSchema();
72196
73145
  const cleanup_blobs_js_1 = requireCleanupBlobs();
72197
73146
  const rollback_js_1 = requireRollback();
73147
+ const telemetry_js_1 = requireTelemetry();
72198
73148
  async function removePatch(identifier, manifestPath) {
72199
73149
  // Read and parse manifest
72200
73150
  const manifestContent = await fs.readFile(manifestPath, 'utf-8');
@@ -72262,6 +73212,9 @@ function requireRemove() {
72262
73212
  }).example('$0 remove pkg:npm/lodash@4.17.21', 'Rollback and remove a patch by PURL').example('$0 remove 12345678-1234-1234-1234-123456789abc', 'Rollback and remove a patch by UUID').example('$0 remove pkg:npm/lodash@4.17.21 --skip-rollback', 'Remove from manifest without rolling back files').example('$0 remove pkg:npm/lodash@4.17.21 --global', 'Remove and rollback from global npm packages');
72263
73213
  },
72264
73214
  handler: async argv => {
73215
+ // Get API credentials for authenticated telemetry (optional).
73216
+ const apiToken = process.env['SOCKET_API_TOKEN'];
73217
+ const orgSlug = process.env['SOCKET_ORG_SLUG'];
72265
73218
  try {
72266
73219
  const manifestPath = path.isAbsolute(argv['manifest-path']) ? argv['manifest-path'] : path.join(argv.cwd, argv['manifest-path']);
72267
73220
  // Check if manifest exists
@@ -72285,6 +73238,7 @@ function requireRemove() {
72285
73238
  // not offline
72286
73239
  argv.global, argv['global-prefix']);
72287
73240
  if (!rollbackSuccess) {
73241
+ await (0, telemetry_js_1.trackPatchRemoveFailed)(new Error('Rollback failed during patch removal'), apiToken, orgSlug);
72288
73242
  console.error('\nRollback failed. Use --skip-rollback to remove from manifest without restoring files.');
72289
73243
  process.exit(1);
72290
73244
  }
@@ -72309,6 +73263,7 @@ function requireRemove() {
72309
73263
  manifest
72310
73264
  } = await removePatch(argv.identifier, manifestPath);
72311
73265
  if (notFound) {
73266
+ await (0, telemetry_js_1.trackPatchRemoveFailed)(new Error(`No patch found matching identifier: ${argv.identifier}`), apiToken, orgSlug);
72312
73267
  console.error(`No patch found matching identifier: ${argv.identifier}`);
72313
73268
  process.exit(1);
72314
73269
  }
@@ -72324,8 +73279,13 @@ function requireRemove() {
72324
73279
  if (cleanupResult.blobsRemoved > 0) {
72325
73280
  console.log(`\n${(0, cleanup_blobs_js_1.formatCleanupResult)(cleanupResult, false)}`);
72326
73281
  }
73282
+ // Track successful removal.
73283
+ await (0, telemetry_js_1.trackPatchRemoved)(removed.length, apiToken, orgSlug);
72327
73284
  process.exit(0);
72328
73285
  } catch (err) {
73286
+ // Track telemetry for unexpected errors.
73287
+ const error = err instanceof Error ? err : new Error(String(err));
73288
+ await (0, telemetry_js_1.trackPatchRemoveFailed)(error, apiToken, orgSlug);
72329
73289
  const errorMessage = err instanceof Error ? err.message : String(err);
72330
73290
  console.error(`Error: ${errorMessage}`);
72331
73291
  process.exit(1);
@@ -72386,7 +73346,7 @@ function requireRepair() {
72386
73346
  value: true
72387
73347
  });
72388
73348
  repair.repairCommand = void 0;
72389
- const fs = __importStar(require$$0$m);
73349
+ const fs = __importStar(require$$0$n);
72390
73350
  const path = __importStar(require$$1$7);
72391
73351
  const manifest_schema_js_1 = requireManifestSchema();
72392
73352
  const cleanup_blobs_js_1 = requireCleanupBlobs();
@@ -72564,7 +73524,7 @@ function requireFind$2() {
72564
73524
  });
72565
73525
  find$2.findPackageJsonFiles = findPackageJsonFiles;
72566
73526
  find$2.detectWorkspaces = detectWorkspaces;
72567
- const fs = __importStar(require$$0$m);
73527
+ const fs = __importStar(require$$0$n);
72568
73528
  const path = __importStar(require$$1$7);
72569
73529
  /**
72570
73530
  * Find all package.json files recursively, respecting workspace configurations
@@ -72998,7 +73958,7 @@ function requireUpdate$1() {
72998
73958
  });
72999
73959
  update$1.updatePackageJson = updatePackageJson;
73000
73960
  update$1.updateMultiplePackageJsons = updateMultiplePackageJsons;
73001
- const fs = __importStar(require$$0$m);
73961
+ const fs = __importStar(require$$0$n);
73002
73962
  const detect_js_1 = requireDetect();
73003
73963
  /**
73004
73964
  * Update a single package.json file with socket-patch postinstall script
@@ -73181,7 +74141,7 @@ function requireSetup() {
73181
74141
  });
73182
74142
  setup.setupCommand = void 0;
73183
74143
  const path = __importStar(require$$1$7);
73184
- const readline = __importStar(require$$1$b);
74144
+ const readline = __importStar(require$$1$c);
73185
74145
  const index_js_1 = requirePackageJson();
73186
74146
  /**
73187
74147
  * Display a preview table of changes
@@ -73460,7 +74420,7 @@ function requireLib$K() {
73460
74420
  stat,
73461
74421
  unlink,
73462
74422
  writeFile
73463
- } = require$$0$m;
74423
+ } = require$$0$n;
73464
74424
  const {
73465
74425
  dirname,
73466
74426
  relative
@@ -77807,7 +78767,7 @@ function requireLib$G() {
77807
78767
  readFile,
77808
78768
  lstat,
77809
78769
  readdir
77810
- } = require$$0$m;
78770
+ } = require$$0$n;
77811
78771
  const parse = requireLib$I();
77812
78772
  const normalizePackageBin = requireLib$H();
77813
78773
  const {
@@ -78820,7 +79780,7 @@ function requireFixBin() {
78820
79780
  chmod,
78821
79781
  open,
78822
79782
  readFile
78823
- } = require$$0$m;
79783
+ } = require$$0$n;
78824
79784
  const execMode = 0o777 & ~process.umask();
78825
79785
  const writeFileAtomic = requireLib$E();
78826
79786
  const isWindowsHashBang = buf => buf[0] === '#'.charCodeAt(0) && buf[1] === '!'.charCodeAt(0) && /^#![^\n]+\r\n/.test(buf.toString());
@@ -78853,7 +79813,7 @@ function requireShimBin() {
78853
79813
  } = require$$1$7;
78854
79814
  const {
78855
79815
  lstat
78856
- } = require$$0$m;
79816
+ } = require$$0$n;
78857
79817
  const throwNonEnoent = er => {
78858
79818
  if (er.code !== 'ENOENT') {
78859
79819
  throw er;
@@ -78960,7 +79920,7 @@ function requireLinkGently() {
78960
79920
  readlink,
78961
79921
  rm,
78962
79922
  symlink
78963
- } = require$$0$m;
79923
+ } = require$$0$n;
78964
79924
  const {
78965
79925
  log
78966
79926
  } = requireLib$L();
@@ -79232,7 +80192,7 @@ function requireCheckBin() {
79232
80192
  const readCmdShim = requireLib$F();
79233
80193
  const {
79234
80194
  readlink
79235
- } = require$$0$m;
80195
+ } = require$$0$n;
79236
80196
  const checkBin = async ({
79237
80197
  bin,
79238
80198
  path,
@@ -88416,7 +89376,7 @@ function requireCommonjs$b() {
88416
89376
  };
88417
89377
  const node_events_1 = require$$0$j;
88418
89378
  const node_stream_1 = __importDefault(require$$6$2);
88419
- const node_string_decoder_1 = require$$2$6;
89379
+ const node_string_decoder_1 = require$$2$5;
88420
89380
  /**
88421
89381
  * Return true if the argument is a Minipass stream, Node stream, or something
88422
89382
  * else that Minipass can interact with.
@@ -94295,7 +95255,7 @@ function requirePosix() {
94295
95255
  });
94296
95256
  posix.sync = posix.isexe = void 0;
94297
95257
  const fs_1 = require$$0$b;
94298
- const promises_1 = require$$0$m;
95258
+ const promises_1 = require$$0$n;
94299
95259
  /**
94300
95260
  * Determine whether a path is executable according to the mode and
94301
95261
  * current (or specified) user and group IDs.
@@ -94368,7 +95328,7 @@ function requireWin32() {
94368
95328
  });
94369
95329
  win32.sync = win32.isexe = void 0;
94370
95330
  const fs_1 = require$$0$b;
94371
- const promises_1 = require$$0$m;
95331
+ const promises_1 = require$$0$n;
94372
95332
  /**
94373
95333
  * Determine whether a path is executable based on the file extension
94374
95334
  * and PATHEXT environment variable (or specified pathExt option)
@@ -94700,7 +95660,7 @@ function requireLib$A() {
94700
95660
  hasRequiredLib$A = 1;
94701
95661
  const {
94702
95662
  spawn
94703
- } = require$$0$n;
95663
+ } = require$$0$o;
94704
95664
  const os = require$$0$f;
94705
95665
  const which = requireLib$B();
94706
95666
  const escape = require_escape();
@@ -96183,7 +97143,7 @@ function requireClone$1() {
96183
97143
  isWindows
96184
97144
  } = requireUtils$4();
96185
97145
  const pickManifest = requireLib$y();
96186
- const fs = require$$0$m;
97146
+ const fs = require$$0$n;
96187
97147
  clone_1$1 = (repo, ref = 'HEAD', target = null, opts = {}) => getRevs(repo, opts).then(revs => clone(repo, revs, ref, resolveRef(revs, ref, opts), target || defaultTarget(repo, opts.cwd), opts));
96188
97148
  const maybeShallow = (repo, opts) => {
96189
97149
  if (opts.gitShallow === false || opts.gitShallow) {
@@ -96300,7 +97260,7 @@ function requireIs$1() {
96300
97260
  // not an airtight indicator, but a good gut-check to even bother trying
96301
97261
  const {
96302
97262
  stat
96303
- } = require$$0$m;
97263
+ } = require$$0$n;
96304
97264
  is$1 = ({
96305
97265
  cwd = process.cwd()
96306
97266
  } = {}) => stat(cwd + '/.git').then(() => true, () => false);
@@ -96991,7 +97951,7 @@ function requireReadPackage$1() {
96991
97951
 
96992
97952
  const {
96993
97953
  readFile
96994
- } = require$$0$m;
97954
+ } = require$$0$n;
96995
97955
  const parseJSON = requireLib$I();
96996
97956
  async function read(filename) {
96997
97957
  try {
@@ -97545,7 +98505,7 @@ function requireMinipass() {
97545
98505
  };
97546
98506
  const EE = require$$0$d;
97547
98507
  const Stream = require$$0$9;
97548
- const SD = require$$2$7.StringDecoder;
98508
+ const SD = require$$2$6.StringDecoder;
97549
98509
  const EOF = Symbol('EOF');
97550
98510
  const MAYBE_EMIT_END = Symbol('maybeEmitEnd');
97551
98511
  const EMITTED_END = Symbol('emittedEnd');
@@ -98155,7 +99115,7 @@ var hasRequiredLib$v;
98155
99115
  function requireLib$v() {
98156
99116
  if (hasRequiredLib$v) return lib$u;
98157
99117
  hasRequiredLib$v = 1;
98158
- const crypto = require$$0$l;
99118
+ const crypto = require$$0$m;
98159
99119
  const {
98160
99120
  Minipass
98161
99121
  } = requireCommonjs$b();
@@ -98938,7 +99898,7 @@ function requirePolyfill() {
98938
99898
  symlink,
98939
99899
  unlink,
98940
99900
  utimes
98941
- } = require$$0$m;
99901
+ } = require$$0$n;
98942
99902
  const {
98943
99903
  dirname,
98944
99904
  isAbsolute,
@@ -99302,7 +100262,7 @@ var hasRequiredCp;
99302
100262
  function requireCp() {
99303
100263
  if (hasRequiredCp) return cp_1;
99304
100264
  hasRequiredCp = 1;
99305
- const fs = require$$0$m;
100265
+ const fs = require$$0$n;
99306
100266
  const getOptions = requireGetOptions();
99307
100267
  const node = requireNode$2();
99308
100268
  const polyfill = requirePolyfill();
@@ -99337,7 +100297,7 @@ function requireWithTempDir() {
99337
100297
  mkdir,
99338
100298
  mkdtemp,
99339
100299
  rm
99340
- } = require$$0$m;
100300
+ } = require$$0$n;
99341
100301
 
99342
100302
  // create a temp directory, ensure its permissions match its parent, then call
99343
100303
  // the supplied function passing it the path to the directory. clean up after
@@ -99382,7 +100342,7 @@ function requireReaddirScoped() {
99382
100342
  hasRequiredReaddirScoped = 1;
99383
100343
  const {
99384
100344
  readdir
99385
- } = require$$0$m;
100345
+ } = require$$0$n;
99386
100346
  const {
99387
100347
  join
99388
100348
  } = require$$1$7;
@@ -99415,7 +100375,7 @@ function requireMoveFile() {
99415
100375
  relative,
99416
100376
  isAbsolute
99417
100377
  } = require$$1$7;
99418
- const fs = require$$0$m;
100378
+ const fs = require$$0$n;
99419
100379
  const pathExists = async path => {
99420
100380
  try {
99421
100381
  await fs.access(path);
@@ -99514,7 +100474,7 @@ var hasRequiredEntryIndex$1;
99514
100474
  function requireEntryIndex$1() {
99515
100475
  if (hasRequiredEntryIndex$1) return entryIndex$1;
99516
100476
  hasRequiredEntryIndex$1 = 1;
99517
- const crypto = require$$0$l;
100477
+ const crypto = require$$0$m;
99518
100478
  const {
99519
100479
  appendFile,
99520
100480
  mkdir,
@@ -99522,7 +100482,7 @@ function requireEntryIndex$1() {
99522
100482
  readdir,
99523
100483
  rm,
99524
100484
  writeFile
99525
- } = require$$0$m;
100485
+ } = require$$0$n;
99526
100486
  const {
99527
100487
  Minipass
99528
100488
  } = requireCommonjs$b();
@@ -100302,7 +101262,7 @@ var hasRequiredRead$1;
100302
101262
  function requireRead$1() {
100303
101263
  if (hasRequiredRead$1) return read$1.exports;
100304
101264
  hasRequiredRead$1 = 1;
100305
- const fs = require$$0$m;
101265
+ const fs = require$$0$n;
100306
101266
  const fsm = requireLib$r();
100307
101267
  const ssri = requireLib$v();
100308
101268
  const contentPath = requirePath$1();
@@ -100690,7 +101650,7 @@ function requireWrite$1() {
100690
101650
  hasRequiredWrite$1 = 1;
100691
101651
  const events = require$$0$d;
100692
101652
  const contentPath = requirePath$1();
100693
- const fs = require$$0$m;
101653
+ const fs = require$$0$n;
100694
101654
  const {
100695
101655
  moveFile
100696
101656
  } = requireLib$s();
@@ -100995,7 +101955,7 @@ var hasRequiredRm$3;
100995
101955
  function requireRm$3() {
100996
101956
  if (hasRequiredRm$3) return rm_1$1;
100997
101957
  hasRequiredRm$3 = 1;
100998
- const fs = require$$0$m;
101958
+ const fs = require$$0$n;
100999
101959
  const contentPath = requirePath$1();
101000
101960
  const {
101001
101961
  hasContent
@@ -101023,7 +101983,7 @@ function requireRm$2() {
101023
101983
  hasRequiredRm$2 = 1;
101024
101984
  const {
101025
101985
  rm
101026
- } = require$$0$m;
101986
+ } = require$$0$n;
101027
101987
  const glob = requireGlob$2();
101028
101988
  const index = requireEntryIndex$1();
101029
101989
  const memo = requireMemoization$1();
@@ -101068,7 +102028,7 @@ function requireVerify$2() {
101068
102028
  stat,
101069
102029
  truncate,
101070
102030
  writeFile
101071
- } = require$$0$m;
102031
+ } = require$$0$n;
101072
102032
  const contentPath = requirePath$1();
101073
102033
  const fsm = requireLib$r();
101074
102034
  const glob = requireGlob$2();
@@ -101319,7 +102279,7 @@ function requireTmp$1() {
101319
102279
  const {
101320
102280
  withTempDir
101321
102281
  } = requireLib$s();
101322
- const fs = require$$0$m;
102282
+ const fs = require$$0$n;
101323
102283
  const path = require$$1$7;
101324
102284
  tmp$1.mkdir = mktmpdir;
101325
102285
  async function mktmpdir(cache, opts = {}) {
@@ -101647,7 +102607,7 @@ function requireLib$o() {
101647
102607
  readFile,
101648
102608
  readdir,
101649
102609
  stat
101650
- } = require$$0$m;
102610
+ } = require$$0$n;
101651
102611
  const {
101652
102612
  resolve,
101653
102613
  basename,
@@ -102369,7 +103329,7 @@ function requireConstants$3() {
102369
103329
  // Node v6 didn't export this, so we just hard code the version and rely
102370
103330
  // on all the other hard-coded values from zlib v4736. When node v6
102371
103331
  // support drops, we can just export the realZlibConstants object.
102372
- const zlib_1 = __importDefault(require$$0$o);
103332
+ const zlib_1 = __importDefault(require$$0$q);
102373
103333
  /* c8 ignore start */
102374
103334
  const realZlibConstants = zlib_1.default.constants || {
102375
103335
  ZLIB_VERNUM: 4736
@@ -102545,7 +103505,7 @@ function requireCommonjs$7() {
102545
103505
  const assert_1 = __importDefault(require$$0$c);
102546
103506
  const buffer_1 = require$$0$i;
102547
103507
  const minipass_1 = requireCommonjs$b();
102548
- const realZlib = __importStar(require$$0$o);
103508
+ const realZlib = __importStar(require$$0$q);
102549
103509
  const constants_js_1 = requireConstants$3();
102550
103510
  var constants_js_2 = requireConstants$3();
102551
103511
  Object.defineProperty(exports, "constants", {
@@ -106803,7 +107763,7 @@ function requireUnpack() {
106803
107763
  });
106804
107764
  unpack.UnpackSync = unpack.Unpack = void 0;
106805
107765
  const fsm = __importStar(requireCommonjs$8());
106806
- const node_assert_1 = __importDefault(require$$1$c);
107766
+ const node_assert_1 = __importDefault(require$$1$d);
106807
107767
  const node_crypto_1 = require$$0$p;
106808
107768
  const node_fs_1 = __importDefault(fs$5);
106809
107769
  const node_path_1 = __importDefault(path$4);
@@ -109915,7 +110875,7 @@ function requireInternal() {
109915
110875
  //------------------------------------------------------------------------------
109916
110876
 
109917
110877
  // We use node.js internal decoder. Its signature is the same as ours.
109918
- var StringDecoder = require$$2$7.StringDecoder;
110878
+ var StringDecoder = require$$2$6.StringDecoder;
109919
110879
  if (!StringDecoder.prototype.end)
109920
110880
  // Node v0.8 doesn't have this method.
109921
110881
  StringDecoder.prototype.end = function () {};
@@ -122806,7 +123766,7 @@ var hasRequiredOptions$3;
122806
123766
  function requireOptions$3() {
122807
123767
  if (hasRequiredOptions$3) return options$3;
122808
123768
  hasRequiredOptions$3 = 1;
122809
- const dns = require$$0$q;
123769
+ const dns = require$$0$r;
122810
123770
  const conditionalHeaders = ['if-modified-since', 'if-none-match', 'if-unmodified-since', 'if-match', 'if-range'];
122811
123771
  const configureOptions = opts => {
122812
123772
  const {
@@ -124811,7 +125771,7 @@ function requireDns$1() {
124811
125771
  const {
124812
125772
  LRUCache
124813
125773
  } = /*@__PURE__*/requireCommonjs$h();
124814
- const dns = require$$0$q;
125774
+ const dns = require$$0$r;
124815
125775
 
124816
125776
  // this is a factory so that each request can have its own opts (i.e. ttl)
124817
125777
  // while still sharing the cache across all requests
@@ -125643,7 +126603,7 @@ function requireNode$1() {
125643
126603
  if (hasRequiredNode$1) return node$1.exports;
125644
126604
  hasRequiredNode$1 = 1;
125645
126605
  (function (module, exports) {
125646
- const tty = require$$1$9;
126606
+ const tty = require$$1$a;
125647
126607
  const util = require$$0$a;
125648
126608
 
125649
126609
  /**
@@ -125955,7 +126915,7 @@ function requireDist$c() {
125955
126915
  value: true
125956
126916
  });
125957
126917
  exports.Agent = void 0;
125958
- const net = __importStar(require$$0$r);
126918
+ const net = __importStar(require$$0$s);
125959
126919
  const http = __importStar(require$$1$8);
125960
126920
  const https_1 = require$$2$3;
125961
126921
  __exportStar(requireHelpers$2(), exports);
@@ -126146,8 +127106,8 @@ function requireDist$b() {
126146
127106
  value: true
126147
127107
  });
126148
127108
  dist$c.HttpProxyAgent = void 0;
126149
- const net = __importStar(require$$0$r);
126150
- const tls = __importStar(require$$1$d);
127109
+ const net = __importStar(require$$0$s);
127110
+ const tls = __importStar(require$$1$e);
126151
127111
  const debug_1 = __importDefault(requireSrc());
126152
127112
  const events_1 = require$$0$d;
126153
127113
  const agent_base_1 = requireDist$c();
@@ -126410,8 +127370,8 @@ function requireDist$a() {
126410
127370
  value: true
126411
127371
  });
126412
127372
  dist$a.HttpsProxyAgent = void 0;
126413
- const net = __importStar(require$$0$r);
126414
- const tls = __importStar(require$$1$d);
127373
+ const net = __importStar(require$$0$s);
127374
+ const tls = __importStar(require$$1$e);
126415
127375
  const assert_1 = __importDefault(require$$0$c);
126416
127376
  const debug_1 = __importDefault(requireSrc());
126417
127377
  const agent_base_1 = requireDist$c();
@@ -129814,7 +130774,7 @@ function requireHelpers() {
129814
130774
  const constants_1 = requireConstants$2();
129815
130775
  const stream = require$$0$9;
129816
130776
  const ip_address_1 = requireIpAddress();
129817
- const net = require$$0$r;
130777
+ const net = require$$0$s;
129818
130778
  /**
129819
130779
  * Validates the provided SocksClientOptions
129820
130780
  * @param options { SocksClientOptions }
@@ -130044,7 +131004,7 @@ function requireSocksclient() {
130044
131004
  });
130045
131005
  exports.SocksClientError = exports.SocksClient = void 0;
130046
131006
  const events_1 = require$$0$d;
130047
- const net = require$$0$r;
131007
+ const net = require$$0$s;
130048
131008
  const smart_buffer_1 = requireSmartbuffer();
130049
131009
  const constants_1 = requireConstants$2();
130050
131010
  const helpers_1 = requireHelpers();
@@ -130880,9 +131840,9 @@ function requireDist$9() {
130880
131840
  const socks_1 = requireBuild$1();
130881
131841
  const agent_base_1 = requireDist$c();
130882
131842
  const debug_1 = __importDefault(requireSrc());
130883
- const dns = __importStar(require$$0$q);
130884
- const net = __importStar(require$$0$r);
130885
- const tls = __importStar(require$$1$d);
131843
+ const dns = __importStar(require$$0$r);
131844
+ const net = __importStar(require$$0$s);
131845
+ const tls = __importStar(require$$1$e);
130886
131846
  const url_1 = require$$0$e;
130887
131847
  const debug = (0, debug_1.default)('socks-proxy-agent');
130888
131848
  const setServernameFromNonIpHost = options => {
@@ -131208,12 +132168,12 @@ var hasRequiredAgents$1;
131208
132168
  function requireAgents$1() {
131209
132169
  if (hasRequiredAgents$1) return agents$1;
131210
132170
  hasRequiredAgents$1 = 1;
131211
- const net = require$$0$r;
131212
- const tls = require$$1$d;
132171
+ const net = require$$0$s;
132172
+ const tls = require$$1$e;
131213
132173
  const {
131214
132174
  once
131215
132175
  } = require$$0$d;
131216
- const timers = require$$3$4;
132176
+ const timers = require$$3$3;
131217
132177
  const {
131218
132178
  normalizeOptions,
131219
132179
  cacheOptions
@@ -136469,7 +137429,7 @@ function requireCrypto() {
136469
137429
  See the License for the specific language governing permissions and
136470
137430
  limitations under the License.
136471
137431
  */
136472
- const crypto_1 = __importDefault(require$$0$l);
137432
+ const crypto_1 = __importDefault(require$$0$m);
136473
137433
  function createPublicKey(key, type = 'spki') {
136474
137434
  if (typeof key === 'string') {
136475
137435
  return crypto_1.default.createPublicKey(key);
@@ -138516,7 +139476,7 @@ function requireFetch$1() {
138516
139476
  See the License for the specific language governing permissions and
138517
139477
  limitations under the License.
138518
139478
  */
138519
- const http2_1 = require$$0$s;
139479
+ const http2_1 = require$$0$t;
138520
139480
  const make_fetch_happen_1 = __importDefault(requireLib$g());
138521
139481
  const proc_log_1 = requireLib$L();
138522
139482
  const promise_retry_1 = __importDefault(requirePromiseRetry());
@@ -138743,7 +139703,7 @@ function requireEphemeral() {
138743
139703
  See the License for the specific language governing permissions and
138744
139704
  limitations under the License.
138745
139705
  */
138746
- const crypto_1 = __importDefault(require$$0$l);
139706
+ const crypto_1 = __importDefault(require$$0$m);
138747
139707
  const EC_KEYPAIR_TYPE = 'ec';
138748
139708
  const P256_CURVE = 'P-256';
138749
139709
  // Signer implementation which uses an ephemeral keypair to sign artifacts.
@@ -139798,7 +140758,7 @@ function requireVerify$1() {
139798
140758
  });
139799
140759
  verify$1.verifySignature = void 0;
139800
140760
  const canonical_json_1 = requireLib$e();
139801
- const crypto_1 = __importDefault(require$$0$l);
140761
+ const crypto_1 = __importDefault(require$$0$m);
139802
140762
  const verifySignature = (metaDataSignedData, key, signature) => {
139803
140763
  const canonicalData = Buffer.from((0, canonical_json_1.canonicalize)(metaDataSignedData));
139804
140764
  return crypto_1.default.verify(undefined, canonicalData, key, Buffer.from(signature, 'hex'));
@@ -139979,7 +140939,7 @@ function requireFile() {
139979
140939
  value: true
139980
140940
  });
139981
140941
  file.TargetFile = file.MetaFile = void 0;
139982
- const crypto_1 = __importDefault(require$$0$l);
140942
+ const crypto_1 = __importDefault(require$$0$m);
139983
140943
  const util_1 = __importDefault(require$$0$a);
139984
140944
  const error_1 = requireError$3();
139985
140945
  const utils_1 = requireUtils$1();
@@ -140221,7 +141181,7 @@ function requireKey$3() {
140221
141181
  value: true
140222
141182
  });
140223
141183
  key$2.getPublicKey = getPublicKey;
140224
- const crypto_1 = __importDefault(require$$0$l);
141184
+ const crypto_1 = __importDefault(require$$0$m);
140225
141185
  const error_1 = requireError$3();
140226
141186
  const oid_1 = requireOid();
140227
141187
  const ASN1_TAG_SEQUENCE = 0x30;
@@ -140452,7 +141412,7 @@ function requireRole() {
140452
141412
  value: true
140453
141413
  });
140454
141414
  role.SuccinctRoles = role.DelegatedRole = role.Role = role.TOP_LEVEL_ROLE_NAMES = void 0;
140455
- const crypto_1 = __importDefault(require$$0$l);
141415
+ const crypto_1 = __importDefault(require$$0$m);
140456
141416
  const minimatch_1 = requireCommonjs$f();
140457
141417
  const util_1 = __importDefault(require$$0$a);
140458
141418
  const error_1 = requireError$3();
@@ -141720,7 +142680,7 @@ function requireTmpfile() {
141720
142680
  value: true
141721
142681
  });
141722
142682
  tmpfile.withTempFile = void 0;
141723
- const promises_1 = __importDefault(require$$0$m);
142683
+ const promises_1 = __importDefault(require$$0$n);
141724
142684
  const os_1 = __importDefault(require$$0$f);
141725
142685
  const path_1 = __importDefault(require$$1$7);
141726
142686
  // Invokes the given handler with the path to a temporary file. The file
@@ -146153,7 +147113,7 @@ var hasRequiredOptions$1;
146153
147113
  function requireOptions$1() {
146154
147114
  if (hasRequiredOptions$1) return options$1;
146155
147115
  hasRequiredOptions$1 = 1;
146156
- const dns = require$$0$q;
147116
+ const dns = require$$0$r;
146157
147117
  const conditionalHeaders = ['if-modified-since', 'if-none-match', 'if-unmodified-since', 'if-match', 'if-range'];
146158
147118
  const configureOptions = opts => {
146159
147119
  const {
@@ -146459,7 +147419,7 @@ var hasRequiredEntryIndex;
146459
147419
  function requireEntryIndex() {
146460
147420
  if (hasRequiredEntryIndex) return entryIndex;
146461
147421
  hasRequiredEntryIndex = 1;
146462
- const crypto = require$$0$l;
147422
+ const crypto = require$$0$m;
146463
147423
  const {
146464
147424
  appendFile,
146465
147425
  mkdir,
@@ -146467,7 +147427,7 @@ function requireEntryIndex() {
146467
147427
  readdir,
146468
147428
  rm,
146469
147429
  writeFile
146470
- } = require$$0$m;
147430
+ } = require$$0$n;
146471
147431
  const {
146472
147432
  Minipass
146473
147433
  } = requireCommonjs$b();
@@ -148372,7 +149332,7 @@ var hasRequiredRead;
148372
149332
  function requireRead() {
148373
149333
  if (hasRequiredRead) return read.exports;
148374
149334
  hasRequiredRead = 1;
148375
- const fs = require$$0$m;
149335
+ const fs = require$$0$n;
148376
149336
  const fsm = requireLib$r();
148377
149337
  const ssri = requireLib$v();
148378
149338
  const contentPath = requirePath();
@@ -148724,7 +149684,7 @@ function requireWrite() {
148724
149684
  hasRequiredWrite = 1;
148725
149685
  const events = require$$0$d;
148726
149686
  const contentPath = requirePath();
148727
- const fs = require$$0$m;
149687
+ const fs = require$$0$n;
148728
149688
  const {
148729
149689
  moveFile
148730
149690
  } = requireLib$s();
@@ -152341,7 +153301,7 @@ var hasRequiredRm$1;
152341
153301
  function requireRm$1() {
152342
153302
  if (hasRequiredRm$1) return rm_1;
152343
153303
  hasRequiredRm$1 = 1;
152344
- const fs = require$$0$m;
153304
+ const fs = require$$0$n;
152345
153305
  const contentPath = requirePath();
152346
153306
  const {
152347
153307
  hasContent
@@ -152369,7 +153329,7 @@ function requireRm() {
152369
153329
  hasRequiredRm = 1;
152370
153330
  const {
152371
153331
  rm: rm$1
152372
- } = require$$0$m;
153332
+ } = require$$0$n;
152373
153333
  const glob = requireGlob();
152374
153334
  const index = requireEntryIndex();
152375
153335
  const memo = requireMemoization();
@@ -152414,7 +153374,7 @@ function requireVerify() {
152414
153374
  stat,
152415
153375
  truncate,
152416
153376
  writeFile
152417
- } = require$$0$m;
153377
+ } = require$$0$n;
152418
153378
  const contentPath = requirePath();
152419
153379
  const fsm = requireLib$r();
152420
153380
  const glob = requireGlob();
@@ -152665,7 +153625,7 @@ function requireTmp() {
152665
153625
  const {
152666
153626
  withTempDir
152667
153627
  } = requireLib$s();
152668
- const fs = require$$0$m;
153628
+ const fs = require$$0$n;
152669
153629
  const path = require$$1$7;
152670
153630
  tmp.mkdir = mktmpdir;
152671
153631
  async function mktmpdir(cache, opts = {}) {
@@ -152814,7 +153774,7 @@ function requireDns() {
152814
153774
  const {
152815
153775
  LRUCache
152816
153776
  } = /*@__PURE__*/requireCommonjs$3();
152817
- const dns = require$$0$q;
153777
+ const dns = require$$0$r;
152818
153778
 
152819
153779
  // this is a factory so that each request can have its own opts (i.e. ttl)
152820
153780
  // while still sharing the cache across all requests
@@ -153116,12 +154076,12 @@ var hasRequiredAgents;
153116
154076
  function requireAgents() {
153117
154077
  if (hasRequiredAgents) return agents;
153118
154078
  hasRequiredAgents = 1;
153119
- const net = require$$0$r;
153120
- const tls = require$$1$d;
154079
+ const net = require$$0$s;
154080
+ const tls = require$$1$e;
153121
154081
  const {
153122
154082
  once
153123
154083
  } = require$$0$d;
153124
- const timers = require$$3$4;
154084
+ const timers = require$$3$3;
153125
154085
  const {
153126
154086
  normalizeOptions,
153127
154087
  cacheOptions
@@ -158888,7 +159848,7 @@ function requireClone() {
158888
159848
  isWindows
158889
159849
  } = requireUtils();
158890
159850
  const pickManifest = requireLib$6();
158891
- const fs = require$$0$m;
159851
+ const fs = require$$0$n;
158892
159852
  clone_1 = (repo, ref = 'HEAD', target = null, opts = {}) => getRevs(repo, opts).then(revs => clone(repo, revs, ref, resolveRef(revs, ref, opts), target || defaultTarget(repo, opts.cwd), opts));
158893
159853
  const maybeShallow = (repo, opts) => {
158894
159854
  if (opts.gitShallow === false || opts.gitShallow) {
@@ -159005,7 +159965,7 @@ function requireIs() {
159005
159965
  // not an airtight indicator, but a good gut-check to even bother trying
159006
159966
  const {
159007
159967
  stat
159008
- } = require$$0$m;
159968
+ } = require$$0$n;
159009
159969
  is = ({
159010
159970
  cwd = process.cwd()
159011
159971
  } = {}) => stat(cwd + '/.git').then(() => true, () => false);
@@ -159942,7 +160902,7 @@ function requireReadPackage() {
159942
160902
 
159943
160903
  const {
159944
160904
  readFile
159945
- } = require$$0$m;
160905
+ } = require$$0$n;
159946
160906
  const parseJSON = requireLib$I();
159947
160907
  async function read(filename) {
159948
160908
  try {
@@ -160976,7 +161936,7 @@ function requireHash() {
160976
161936
  hasRequiredHash = 1;
160977
161937
  const {
160978
161938
  createHash
160979
- } = require$$0$l;
161939
+ } = require$$0$m;
160980
161940
  hash = ({
160981
161941
  name,
160982
161942
  source
@@ -161867,7 +162827,7 @@ function requirePackumentCache() {
161867
162827
  } = /*@__PURE__*/requireCommonjs$3();
161868
162828
  const {
161869
162829
  getHeapStatistics
161870
- } = require$$1$e;
162830
+ } = require$$1$f;
161871
162831
  const {
161872
162832
  log
161873
162833
  } = requireLib$L();
@@ -172154,5 +173114,5 @@ exports.terminalLinkExports = terminalLinkExports;
172154
173114
  exports.updater = updater$1;
172155
173115
  exports.yargsParser = yargsParser;
172156
173116
  exports.yoctocolorsCjsExports = yoctocolorsCjsExports;
172157
- //# debugId=5a8a47e0-496a-4f20-8cac-d9510a4fed74
173117
+ //# debugId=14bf8a4f-fac4-497b-99da-8c2ac0d7bffa
172158
173118
  //# sourceMappingURL=vendor.js.map