react-doctor 0.4.2-dev.93d4eec → 0.4.2-dev.a254414
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/cli.js +1915 -29
- package/dist/index.d.ts +46 -0
- package/dist/index.js +1756 -15
- package/dist/lsp.js +1746 -13
- package/package.json +4 -4
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b818de08-3056-5722-a734-180e56f0923b")}catch(e){}}();
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
|
|
5
5
|
import * as path$1 from "node:path";
|
|
@@ -3205,7 +3205,7 @@ var JsonReportV2 = class extends Schema.Class("JsonReportV2")({
|
|
|
3205
3205
|
Schema.Union([JsonReportV1, JsonReportV2]);
|
|
3206
3206
|
//#endregion
|
|
3207
3207
|
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js
|
|
3208
|
-
var require_constants = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
3208
|
+
var require_constants$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
3209
3209
|
const WIN_SLASH = "\\\\/";
|
|
3210
3210
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
3211
3211
|
const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
|
|
@@ -3375,7 +3375,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
3375
3375
|
//#endregion
|
|
3376
3376
|
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js
|
|
3377
3377
|
var require_utils = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
3378
|
-
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
|
|
3378
|
+
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants$1();
|
|
3379
3379
|
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
3380
3380
|
exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
|
|
3381
3381
|
exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
|
|
@@ -3424,7 +3424,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
3424
3424
|
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js
|
|
3425
3425
|
var require_scan = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
3426
3426
|
const utils = require_utils();
|
|
3427
|
-
const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants();
|
|
3427
|
+
const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants$1();
|
|
3428
3428
|
const isPathSeparator = (code) => {
|
|
3429
3429
|
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
3430
3430
|
};
|
|
@@ -3709,8 +3709,8 @@ var require_scan = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
3709
3709
|
}));
|
|
3710
3710
|
//#endregion
|
|
3711
3711
|
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js
|
|
3712
|
-
var require_parse = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
3713
|
-
const constants = require_constants();
|
|
3712
|
+
var require_parse$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
3713
|
+
const constants = require_constants$1();
|
|
3714
3714
|
const utils = require_utils();
|
|
3715
3715
|
/**
|
|
3716
3716
|
* Constants
|
|
@@ -4766,9 +4766,9 @@ var require_parse = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
4766
4766
|
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js
|
|
4767
4767
|
var require_picomatch$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
4768
4768
|
const scan = require_scan();
|
|
4769
|
-
const parse = require_parse();
|
|
4769
|
+
const parse = require_parse$1();
|
|
4770
4770
|
const utils = require_utils();
|
|
4771
|
-
const constants = require_constants();
|
|
4771
|
+
const constants = require_constants$1();
|
|
4772
4772
|
const isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
4773
4773
|
/**
|
|
4774
4774
|
* Creates a matcher function from one or more glob patterns. The
|
|
@@ -5063,8 +5063,8 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
|
|
|
5063
5063
|
module.exports = picomatch;
|
|
5064
5064
|
}));
|
|
5065
5065
|
//#endregion
|
|
5066
|
-
//#region
|
|
5067
|
-
var
|
|
5066
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js
|
|
5067
|
+
var require_picomatch = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5068
5068
|
const pico = require_picomatch$1();
|
|
5069
5069
|
const utils = require_utils();
|
|
5070
5070
|
function picomatch(glob, options, returnState = false) {
|
|
@@ -5076,7 +5076,1349 @@ var import_picomatch = /* @__PURE__ */ __toESM$1((/* @__PURE__ */ __commonJSMin$
|
|
|
5076
5076
|
}
|
|
5077
5077
|
Object.assign(picomatch, pico);
|
|
5078
5078
|
module.exports = picomatch;
|
|
5079
|
-
}))
|
|
5079
|
+
}));
|
|
5080
|
+
//#endregion
|
|
5081
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/constants.js
|
|
5082
|
+
var require_constants = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5083
|
+
const SEMVER_SPEC_VERSION = "2.0.0";
|
|
5084
|
+
const MAX_LENGTH = 256;
|
|
5085
|
+
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
|
|
5086
|
+
module.exports = {
|
|
5087
|
+
MAX_LENGTH,
|
|
5088
|
+
MAX_SAFE_COMPONENT_LENGTH: 16,
|
|
5089
|
+
MAX_SAFE_BUILD_LENGTH: MAX_LENGTH - 6,
|
|
5090
|
+
MAX_SAFE_INTEGER,
|
|
5091
|
+
RELEASE_TYPES: [
|
|
5092
|
+
"major",
|
|
5093
|
+
"premajor",
|
|
5094
|
+
"minor",
|
|
5095
|
+
"preminor",
|
|
5096
|
+
"patch",
|
|
5097
|
+
"prepatch",
|
|
5098
|
+
"prerelease"
|
|
5099
|
+
],
|
|
5100
|
+
SEMVER_SPEC_VERSION,
|
|
5101
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
5102
|
+
FLAG_LOOSE: 2
|
|
5103
|
+
};
|
|
5104
|
+
}));
|
|
5105
|
+
//#endregion
|
|
5106
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/debug.js
|
|
5107
|
+
var require_debug = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5108
|
+
module.exports = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
|
|
5109
|
+
}));
|
|
5110
|
+
//#endregion
|
|
5111
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/re.js
|
|
5112
|
+
var require_re = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5113
|
+
const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = require_constants();
|
|
5114
|
+
const debug = require_debug();
|
|
5115
|
+
exports = module.exports = {};
|
|
5116
|
+
const re = exports.re = [];
|
|
5117
|
+
const safeRe = exports.safeRe = [];
|
|
5118
|
+
const src = exports.src = [];
|
|
5119
|
+
const safeSrc = exports.safeSrc = [];
|
|
5120
|
+
const t = exports.t = {};
|
|
5121
|
+
let R = 0;
|
|
5122
|
+
const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
5123
|
+
const safeRegexReplacements = [
|
|
5124
|
+
["\\s", 1],
|
|
5125
|
+
["\\d", MAX_LENGTH],
|
|
5126
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
5127
|
+
];
|
|
5128
|
+
const makeSafeRegex = (value) => {
|
|
5129
|
+
for (const [token, max] of safeRegexReplacements) value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
5130
|
+
return value;
|
|
5131
|
+
};
|
|
5132
|
+
const createToken = (name, value, isGlobal) => {
|
|
5133
|
+
const safe = makeSafeRegex(value);
|
|
5134
|
+
const index = R++;
|
|
5135
|
+
debug(name, index, value);
|
|
5136
|
+
t[name] = index;
|
|
5137
|
+
src[index] = value;
|
|
5138
|
+
safeSrc[index] = safe;
|
|
5139
|
+
re[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
|
5140
|
+
safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
|
|
5141
|
+
};
|
|
5142
|
+
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
5143
|
+
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
5144
|
+
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
5145
|
+
createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
|
|
5146
|
+
createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
5147
|
+
createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
|
|
5148
|
+
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
5149
|
+
createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
|
5150
|
+
createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
5151
|
+
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
5152
|
+
createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
|
5153
|
+
createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
|
|
5154
|
+
createToken("FULL", `^${src[t.FULLPLAIN]}$`);
|
|
5155
|
+
createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
|
|
5156
|
+
createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
|
|
5157
|
+
createToken("GTLT", "((?:<|>)?=?)");
|
|
5158
|
+
createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
5159
|
+
createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
5160
|
+
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
|
|
5161
|
+
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
|
|
5162
|
+
createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
|
5163
|
+
createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
|
5164
|
+
createToken("COERCEPLAIN", `(^|[^\\d])(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
5165
|
+
createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
5166
|
+
createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
|
|
5167
|
+
createToken("COERCERTL", src[t.COERCE], true);
|
|
5168
|
+
createToken("COERCERTLFULL", src[t.COERCEFULL], true);
|
|
5169
|
+
createToken("LONETILDE", "(?:~>?)");
|
|
5170
|
+
createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
5171
|
+
exports.tildeTrimReplace = "$1~";
|
|
5172
|
+
createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
5173
|
+
createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
5174
|
+
createToken("LONECARET", "(?:\\^)");
|
|
5175
|
+
createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
5176
|
+
exports.caretTrimReplace = "$1^";
|
|
5177
|
+
createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
5178
|
+
createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
5179
|
+
createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
|
5180
|
+
createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
|
5181
|
+
createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
5182
|
+
exports.comparatorTrimReplace = "$1$2$3";
|
|
5183
|
+
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
|
|
5184
|
+
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
|
|
5185
|
+
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
5186
|
+
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
5187
|
+
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
5188
|
+
}));
|
|
5189
|
+
//#endregion
|
|
5190
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/parse-options.js
|
|
5191
|
+
var require_parse_options = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5192
|
+
const looseOption = Object.freeze({ loose: true });
|
|
5193
|
+
const emptyOpts = Object.freeze({});
|
|
5194
|
+
const parseOptions = (options) => {
|
|
5195
|
+
if (!options) return emptyOpts;
|
|
5196
|
+
if (typeof options !== "object") return looseOption;
|
|
5197
|
+
return options;
|
|
5198
|
+
};
|
|
5199
|
+
module.exports = parseOptions;
|
|
5200
|
+
}));
|
|
5201
|
+
//#endregion
|
|
5202
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/identifiers.js
|
|
5203
|
+
var require_identifiers = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5204
|
+
const numeric = /^[0-9]+$/;
|
|
5205
|
+
const compareIdentifiers = (a, b) => {
|
|
5206
|
+
if (typeof a === "number" && typeof b === "number") return a === b ? 0 : a < b ? -1 : 1;
|
|
5207
|
+
const anum = numeric.test(a);
|
|
5208
|
+
const bnum = numeric.test(b);
|
|
5209
|
+
if (anum && bnum) {
|
|
5210
|
+
a = +a;
|
|
5211
|
+
b = +b;
|
|
5212
|
+
}
|
|
5213
|
+
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
5214
|
+
};
|
|
5215
|
+
const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
|
|
5216
|
+
module.exports = {
|
|
5217
|
+
compareIdentifiers,
|
|
5218
|
+
rcompareIdentifiers
|
|
5219
|
+
};
|
|
5220
|
+
}));
|
|
5221
|
+
//#endregion
|
|
5222
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/semver.js
|
|
5223
|
+
var require_semver$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5224
|
+
const debug = require_debug();
|
|
5225
|
+
const { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
5226
|
+
const { safeRe: re, t } = require_re();
|
|
5227
|
+
const parseOptions = require_parse_options();
|
|
5228
|
+
const { compareIdentifiers } = require_identifiers();
|
|
5229
|
+
module.exports = class SemVer {
|
|
5230
|
+
constructor(version, options) {
|
|
5231
|
+
options = parseOptions(options);
|
|
5232
|
+
if (version instanceof SemVer) if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
|
|
5233
|
+
else version = version.version;
|
|
5234
|
+
else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
5235
|
+
if (version.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
|
|
5236
|
+
debug("SemVer", version, options);
|
|
5237
|
+
this.options = options;
|
|
5238
|
+
this.loose = !!options.loose;
|
|
5239
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
5240
|
+
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
5241
|
+
if (!m) throw new TypeError(`Invalid Version: ${version}`);
|
|
5242
|
+
this.raw = version;
|
|
5243
|
+
this.major = +m[1];
|
|
5244
|
+
this.minor = +m[2];
|
|
5245
|
+
this.patch = +m[3];
|
|
5246
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) throw new TypeError("Invalid major version");
|
|
5247
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) throw new TypeError("Invalid minor version");
|
|
5248
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) throw new TypeError("Invalid patch version");
|
|
5249
|
+
if (!m[4]) this.prerelease = [];
|
|
5250
|
+
else this.prerelease = m[4].split(".").map((id) => {
|
|
5251
|
+
if (/^[0-9]+$/.test(id)) {
|
|
5252
|
+
const num = +id;
|
|
5253
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) return num;
|
|
5254
|
+
}
|
|
5255
|
+
return id;
|
|
5256
|
+
});
|
|
5257
|
+
this.build = m[5] ? m[5].split(".") : [];
|
|
5258
|
+
this.format();
|
|
5259
|
+
}
|
|
5260
|
+
format() {
|
|
5261
|
+
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
5262
|
+
if (this.prerelease.length) this.version += `-${this.prerelease.join(".")}`;
|
|
5263
|
+
return this.version;
|
|
5264
|
+
}
|
|
5265
|
+
toString() {
|
|
5266
|
+
return this.version;
|
|
5267
|
+
}
|
|
5268
|
+
compare(other) {
|
|
5269
|
+
debug("SemVer.compare", this.version, this.options, other);
|
|
5270
|
+
if (!(other instanceof SemVer)) {
|
|
5271
|
+
if (typeof other === "string" && other === this.version) return 0;
|
|
5272
|
+
other = new SemVer(other, this.options);
|
|
5273
|
+
}
|
|
5274
|
+
if (other.version === this.version) return 0;
|
|
5275
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
5276
|
+
}
|
|
5277
|
+
compareMain(other) {
|
|
5278
|
+
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
5279
|
+
if (this.major < other.major) return -1;
|
|
5280
|
+
if (this.major > other.major) return 1;
|
|
5281
|
+
if (this.minor < other.minor) return -1;
|
|
5282
|
+
if (this.minor > other.minor) return 1;
|
|
5283
|
+
if (this.patch < other.patch) return -1;
|
|
5284
|
+
if (this.patch > other.patch) return 1;
|
|
5285
|
+
return 0;
|
|
5286
|
+
}
|
|
5287
|
+
comparePre(other) {
|
|
5288
|
+
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
5289
|
+
if (this.prerelease.length && !other.prerelease.length) return -1;
|
|
5290
|
+
else if (!this.prerelease.length && other.prerelease.length) return 1;
|
|
5291
|
+
else if (!this.prerelease.length && !other.prerelease.length) return 0;
|
|
5292
|
+
let i = 0;
|
|
5293
|
+
do {
|
|
5294
|
+
const a = this.prerelease[i];
|
|
5295
|
+
const b = other.prerelease[i];
|
|
5296
|
+
debug("prerelease compare", i, a, b);
|
|
5297
|
+
if (a === void 0 && b === void 0) return 0;
|
|
5298
|
+
else if (b === void 0) return 1;
|
|
5299
|
+
else if (a === void 0) return -1;
|
|
5300
|
+
else if (a === b) continue;
|
|
5301
|
+
else return compareIdentifiers(a, b);
|
|
5302
|
+
} while (++i);
|
|
5303
|
+
}
|
|
5304
|
+
compareBuild(other) {
|
|
5305
|
+
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
5306
|
+
let i = 0;
|
|
5307
|
+
do {
|
|
5308
|
+
const a = this.build[i];
|
|
5309
|
+
const b = other.build[i];
|
|
5310
|
+
debug("build compare", i, a, b);
|
|
5311
|
+
if (a === void 0 && b === void 0) return 0;
|
|
5312
|
+
else if (b === void 0) return 1;
|
|
5313
|
+
else if (a === void 0) return -1;
|
|
5314
|
+
else if (a === b) continue;
|
|
5315
|
+
else return compareIdentifiers(a, b);
|
|
5316
|
+
} while (++i);
|
|
5317
|
+
}
|
|
5318
|
+
inc(release, identifier, identifierBase) {
|
|
5319
|
+
if (release.startsWith("pre")) {
|
|
5320
|
+
if (!identifier && identifierBase === false) throw new Error("invalid increment argument: identifier is empty");
|
|
5321
|
+
if (identifier) {
|
|
5322
|
+
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
|
|
5323
|
+
if (!match || match[1] !== identifier) throw new Error(`invalid identifier: ${identifier}`);
|
|
5324
|
+
}
|
|
5325
|
+
}
|
|
5326
|
+
switch (release) {
|
|
5327
|
+
case "premajor":
|
|
5328
|
+
this.prerelease.length = 0;
|
|
5329
|
+
this.patch = 0;
|
|
5330
|
+
this.minor = 0;
|
|
5331
|
+
this.major++;
|
|
5332
|
+
this.inc("pre", identifier, identifierBase);
|
|
5333
|
+
break;
|
|
5334
|
+
case "preminor":
|
|
5335
|
+
this.prerelease.length = 0;
|
|
5336
|
+
this.patch = 0;
|
|
5337
|
+
this.minor++;
|
|
5338
|
+
this.inc("pre", identifier, identifierBase);
|
|
5339
|
+
break;
|
|
5340
|
+
case "prepatch":
|
|
5341
|
+
this.prerelease.length = 0;
|
|
5342
|
+
this.inc("patch", identifier, identifierBase);
|
|
5343
|
+
this.inc("pre", identifier, identifierBase);
|
|
5344
|
+
break;
|
|
5345
|
+
case "prerelease":
|
|
5346
|
+
if (this.prerelease.length === 0) this.inc("patch", identifier, identifierBase);
|
|
5347
|
+
this.inc("pre", identifier, identifierBase);
|
|
5348
|
+
break;
|
|
5349
|
+
case "release":
|
|
5350
|
+
if (this.prerelease.length === 0) throw new Error(`version ${this.raw} is not a prerelease`);
|
|
5351
|
+
this.prerelease.length = 0;
|
|
5352
|
+
break;
|
|
5353
|
+
case "major":
|
|
5354
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) this.major++;
|
|
5355
|
+
this.minor = 0;
|
|
5356
|
+
this.patch = 0;
|
|
5357
|
+
this.prerelease = [];
|
|
5358
|
+
break;
|
|
5359
|
+
case "minor":
|
|
5360
|
+
if (this.patch !== 0 || this.prerelease.length === 0) this.minor++;
|
|
5361
|
+
this.patch = 0;
|
|
5362
|
+
this.prerelease = [];
|
|
5363
|
+
break;
|
|
5364
|
+
case "patch":
|
|
5365
|
+
if (this.prerelease.length === 0) this.patch++;
|
|
5366
|
+
this.prerelease = [];
|
|
5367
|
+
break;
|
|
5368
|
+
case "pre": {
|
|
5369
|
+
const base = Number(identifierBase) ? 1 : 0;
|
|
5370
|
+
if (this.prerelease.length === 0) this.prerelease = [base];
|
|
5371
|
+
else {
|
|
5372
|
+
let i = this.prerelease.length;
|
|
5373
|
+
while (--i >= 0) if (typeof this.prerelease[i] === "number") {
|
|
5374
|
+
this.prerelease[i]++;
|
|
5375
|
+
i = -2;
|
|
5376
|
+
}
|
|
5377
|
+
if (i === -1) {
|
|
5378
|
+
if (identifier === this.prerelease.join(".") && identifierBase === false) throw new Error("invalid increment argument: identifier already exists");
|
|
5379
|
+
this.prerelease.push(base);
|
|
5380
|
+
}
|
|
5381
|
+
}
|
|
5382
|
+
if (identifier) {
|
|
5383
|
+
let prerelease = [identifier, base];
|
|
5384
|
+
if (identifierBase === false) prerelease = [identifier];
|
|
5385
|
+
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
|
5386
|
+
if (isNaN(this.prerelease[1])) this.prerelease = prerelease;
|
|
5387
|
+
} else this.prerelease = prerelease;
|
|
5388
|
+
}
|
|
5389
|
+
break;
|
|
5390
|
+
}
|
|
5391
|
+
default: throw new Error(`invalid increment argument: ${release}`);
|
|
5392
|
+
}
|
|
5393
|
+
this.raw = this.format();
|
|
5394
|
+
if (this.build.length) this.raw += `+${this.build.join(".")}`;
|
|
5395
|
+
return this;
|
|
5396
|
+
}
|
|
5397
|
+
};
|
|
5398
|
+
}));
|
|
5399
|
+
//#endregion
|
|
5400
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/parse.js
|
|
5401
|
+
var require_parse = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5402
|
+
const SemVer = require_semver$1();
|
|
5403
|
+
const parse = (version, options, throwErrors = false) => {
|
|
5404
|
+
if (version instanceof SemVer) return version;
|
|
5405
|
+
try {
|
|
5406
|
+
return new SemVer(version, options);
|
|
5407
|
+
} catch (er) {
|
|
5408
|
+
if (!throwErrors) return null;
|
|
5409
|
+
throw er;
|
|
5410
|
+
}
|
|
5411
|
+
};
|
|
5412
|
+
module.exports = parse;
|
|
5413
|
+
}));
|
|
5414
|
+
//#endregion
|
|
5415
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/valid.js
|
|
5416
|
+
var require_valid$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5417
|
+
const parse = require_parse();
|
|
5418
|
+
const valid = (version, options) => {
|
|
5419
|
+
const v = parse(version, options);
|
|
5420
|
+
return v ? v.version : null;
|
|
5421
|
+
};
|
|
5422
|
+
module.exports = valid;
|
|
5423
|
+
}));
|
|
5424
|
+
//#endregion
|
|
5425
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/clean.js
|
|
5426
|
+
var require_clean = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5427
|
+
const parse = require_parse();
|
|
5428
|
+
const clean = (version, options) => {
|
|
5429
|
+
const s = parse(version.trim().replace(/^[=v]+/, ""), options);
|
|
5430
|
+
return s ? s.version : null;
|
|
5431
|
+
};
|
|
5432
|
+
module.exports = clean;
|
|
5433
|
+
}));
|
|
5434
|
+
//#endregion
|
|
5435
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/inc.js
|
|
5436
|
+
var require_inc = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5437
|
+
const SemVer = require_semver$1();
|
|
5438
|
+
const inc = (version, release, options, identifier, identifierBase) => {
|
|
5439
|
+
if (typeof options === "string") {
|
|
5440
|
+
identifierBase = identifier;
|
|
5441
|
+
identifier = options;
|
|
5442
|
+
options = void 0;
|
|
5443
|
+
}
|
|
5444
|
+
try {
|
|
5445
|
+
return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier, identifierBase).version;
|
|
5446
|
+
} catch (er) {
|
|
5447
|
+
return null;
|
|
5448
|
+
}
|
|
5449
|
+
};
|
|
5450
|
+
module.exports = inc;
|
|
5451
|
+
}));
|
|
5452
|
+
//#endregion
|
|
5453
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/diff.js
|
|
5454
|
+
var require_diff = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5455
|
+
const parse = require_parse();
|
|
5456
|
+
const diff = (version1, version2) => {
|
|
5457
|
+
const v1 = parse(version1, null, true);
|
|
5458
|
+
const v2 = parse(version2, null, true);
|
|
5459
|
+
const comparison = v1.compare(v2);
|
|
5460
|
+
if (comparison === 0) return null;
|
|
5461
|
+
const v1Higher = comparison > 0;
|
|
5462
|
+
const highVersion = v1Higher ? v1 : v2;
|
|
5463
|
+
const lowVersion = v1Higher ? v2 : v1;
|
|
5464
|
+
const highHasPre = !!highVersion.prerelease.length;
|
|
5465
|
+
if (!!lowVersion.prerelease.length && !highHasPre) {
|
|
5466
|
+
if (!lowVersion.patch && !lowVersion.minor) return "major";
|
|
5467
|
+
if (lowVersion.compareMain(highVersion) === 0) {
|
|
5468
|
+
if (lowVersion.minor && !lowVersion.patch) return "minor";
|
|
5469
|
+
return "patch";
|
|
5470
|
+
}
|
|
5471
|
+
}
|
|
5472
|
+
const prefix = highHasPre ? "pre" : "";
|
|
5473
|
+
if (v1.major !== v2.major) return prefix + "major";
|
|
5474
|
+
if (v1.minor !== v2.minor) return prefix + "minor";
|
|
5475
|
+
if (v1.patch !== v2.patch) return prefix + "patch";
|
|
5476
|
+
return "prerelease";
|
|
5477
|
+
};
|
|
5478
|
+
module.exports = diff;
|
|
5479
|
+
}));
|
|
5480
|
+
//#endregion
|
|
5481
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/major.js
|
|
5482
|
+
var require_major = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5483
|
+
const SemVer = require_semver$1();
|
|
5484
|
+
const major = (a, loose) => new SemVer(a, loose).major;
|
|
5485
|
+
module.exports = major;
|
|
5486
|
+
}));
|
|
5487
|
+
//#endregion
|
|
5488
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/minor.js
|
|
5489
|
+
var require_minor = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5490
|
+
const SemVer = require_semver$1();
|
|
5491
|
+
const minor = (a, loose) => new SemVer(a, loose).minor;
|
|
5492
|
+
module.exports = minor;
|
|
5493
|
+
}));
|
|
5494
|
+
//#endregion
|
|
5495
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/patch.js
|
|
5496
|
+
var require_patch = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5497
|
+
const SemVer = require_semver$1();
|
|
5498
|
+
const patch = (a, loose) => new SemVer(a, loose).patch;
|
|
5499
|
+
module.exports = patch;
|
|
5500
|
+
}));
|
|
5501
|
+
//#endregion
|
|
5502
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/prerelease.js
|
|
5503
|
+
var require_prerelease = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5504
|
+
const parse = require_parse();
|
|
5505
|
+
const prerelease = (version, options) => {
|
|
5506
|
+
const parsed = parse(version, options);
|
|
5507
|
+
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
5508
|
+
};
|
|
5509
|
+
module.exports = prerelease;
|
|
5510
|
+
}));
|
|
5511
|
+
//#endregion
|
|
5512
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare.js
|
|
5513
|
+
var require_compare = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5514
|
+
const SemVer = require_semver$1();
|
|
5515
|
+
const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
5516
|
+
module.exports = compare;
|
|
5517
|
+
}));
|
|
5518
|
+
//#endregion
|
|
5519
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rcompare.js
|
|
5520
|
+
var require_rcompare = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5521
|
+
const compare = require_compare();
|
|
5522
|
+
const rcompare = (a, b, loose) => compare(b, a, loose);
|
|
5523
|
+
module.exports = rcompare;
|
|
5524
|
+
}));
|
|
5525
|
+
//#endregion
|
|
5526
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-loose.js
|
|
5527
|
+
var require_compare_loose = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5528
|
+
const compare = require_compare();
|
|
5529
|
+
const compareLoose = (a, b) => compare(a, b, true);
|
|
5530
|
+
module.exports = compareLoose;
|
|
5531
|
+
}));
|
|
5532
|
+
//#endregion
|
|
5533
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-build.js
|
|
5534
|
+
var require_compare_build = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5535
|
+
const SemVer = require_semver$1();
|
|
5536
|
+
const compareBuild = (a, b, loose) => {
|
|
5537
|
+
const versionA = new SemVer(a, loose);
|
|
5538
|
+
const versionB = new SemVer(b, loose);
|
|
5539
|
+
return versionA.compare(versionB) || versionA.compareBuild(versionB);
|
|
5540
|
+
};
|
|
5541
|
+
module.exports = compareBuild;
|
|
5542
|
+
}));
|
|
5543
|
+
//#endregion
|
|
5544
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/sort.js
|
|
5545
|
+
var require_sort = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5546
|
+
const compareBuild = require_compare_build();
|
|
5547
|
+
const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
|
|
5548
|
+
module.exports = sort;
|
|
5549
|
+
}));
|
|
5550
|
+
//#endregion
|
|
5551
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rsort.js
|
|
5552
|
+
var require_rsort = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5553
|
+
const compareBuild = require_compare_build();
|
|
5554
|
+
const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
|
|
5555
|
+
module.exports = rsort;
|
|
5556
|
+
}));
|
|
5557
|
+
//#endregion
|
|
5558
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gt.js
|
|
5559
|
+
var require_gt = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5560
|
+
const compare = require_compare();
|
|
5561
|
+
const gt = (a, b, loose) => compare(a, b, loose) > 0;
|
|
5562
|
+
module.exports = gt;
|
|
5563
|
+
}));
|
|
5564
|
+
//#endregion
|
|
5565
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lt.js
|
|
5566
|
+
var require_lt = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5567
|
+
const compare = require_compare();
|
|
5568
|
+
const lt = (a, b, loose) => compare(a, b, loose) < 0;
|
|
5569
|
+
module.exports = lt;
|
|
5570
|
+
}));
|
|
5571
|
+
//#endregion
|
|
5572
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/eq.js
|
|
5573
|
+
var require_eq = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5574
|
+
const compare = require_compare();
|
|
5575
|
+
const eq = (a, b, loose) => compare(a, b, loose) === 0;
|
|
5576
|
+
module.exports = eq;
|
|
5577
|
+
}));
|
|
5578
|
+
//#endregion
|
|
5579
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/neq.js
|
|
5580
|
+
var require_neq = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5581
|
+
const compare = require_compare();
|
|
5582
|
+
const neq = (a, b, loose) => compare(a, b, loose) !== 0;
|
|
5583
|
+
module.exports = neq;
|
|
5584
|
+
}));
|
|
5585
|
+
//#endregion
|
|
5586
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gte.js
|
|
5587
|
+
var require_gte = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5588
|
+
const compare = require_compare();
|
|
5589
|
+
const gte = (a, b, loose) => compare(a, b, loose) >= 0;
|
|
5590
|
+
module.exports = gte;
|
|
5591
|
+
}));
|
|
5592
|
+
//#endregion
|
|
5593
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lte.js
|
|
5594
|
+
var require_lte = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5595
|
+
const compare = require_compare();
|
|
5596
|
+
const lte = (a, b, loose) => compare(a, b, loose) <= 0;
|
|
5597
|
+
module.exports = lte;
|
|
5598
|
+
}));
|
|
5599
|
+
//#endregion
|
|
5600
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/cmp.js
|
|
5601
|
+
var require_cmp = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5602
|
+
const eq = require_eq();
|
|
5603
|
+
const neq = require_neq();
|
|
5604
|
+
const gt = require_gt();
|
|
5605
|
+
const gte = require_gte();
|
|
5606
|
+
const lt = require_lt();
|
|
5607
|
+
const lte = require_lte();
|
|
5608
|
+
const cmp = (a, op, b, loose) => {
|
|
5609
|
+
switch (op) {
|
|
5610
|
+
case "===":
|
|
5611
|
+
if (typeof a === "object") a = a.version;
|
|
5612
|
+
if (typeof b === "object") b = b.version;
|
|
5613
|
+
return a === b;
|
|
5614
|
+
case "!==":
|
|
5615
|
+
if (typeof a === "object") a = a.version;
|
|
5616
|
+
if (typeof b === "object") b = b.version;
|
|
5617
|
+
return a !== b;
|
|
5618
|
+
case "":
|
|
5619
|
+
case "=":
|
|
5620
|
+
case "==": return eq(a, b, loose);
|
|
5621
|
+
case "!=": return neq(a, b, loose);
|
|
5622
|
+
case ">": return gt(a, b, loose);
|
|
5623
|
+
case ">=": return gte(a, b, loose);
|
|
5624
|
+
case "<": return lt(a, b, loose);
|
|
5625
|
+
case "<=": return lte(a, b, loose);
|
|
5626
|
+
default: throw new TypeError(`Invalid operator: ${op}`);
|
|
5627
|
+
}
|
|
5628
|
+
};
|
|
5629
|
+
module.exports = cmp;
|
|
5630
|
+
}));
|
|
5631
|
+
//#endregion
|
|
5632
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/coerce.js
|
|
5633
|
+
var require_coerce = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5634
|
+
const SemVer = require_semver$1();
|
|
5635
|
+
const parse = require_parse();
|
|
5636
|
+
const { safeRe: re, t } = require_re();
|
|
5637
|
+
const coerce = (version, options) => {
|
|
5638
|
+
if (version instanceof SemVer) return version;
|
|
5639
|
+
if (typeof version === "number") version = String(version);
|
|
5640
|
+
if (typeof version !== "string") return null;
|
|
5641
|
+
options = options || {};
|
|
5642
|
+
let match = null;
|
|
5643
|
+
if (!options.rtl) match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
|
|
5644
|
+
else {
|
|
5645
|
+
const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
|
|
5646
|
+
let next;
|
|
5647
|
+
while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
|
|
5648
|
+
if (!match || next.index + next[0].length !== match.index + match[0].length) match = next;
|
|
5649
|
+
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
|
|
5650
|
+
}
|
|
5651
|
+
coerceRtlRegex.lastIndex = -1;
|
|
5652
|
+
}
|
|
5653
|
+
if (match === null) return null;
|
|
5654
|
+
const major = match[2];
|
|
5655
|
+
return parse(`${major}.${match[3] || "0"}.${match[4] || "0"}${options.includePrerelease && match[5] ? `-${match[5]}` : ""}${options.includePrerelease && match[6] ? `+${match[6]}` : ""}`, options);
|
|
5656
|
+
};
|
|
5657
|
+
module.exports = coerce;
|
|
5658
|
+
}));
|
|
5659
|
+
//#endregion
|
|
5660
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/lrucache.js
|
|
5661
|
+
var require_lrucache = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5662
|
+
var LRUCache = class {
|
|
5663
|
+
constructor() {
|
|
5664
|
+
this.max = 1e3;
|
|
5665
|
+
this.map = /* @__PURE__ */ new Map();
|
|
5666
|
+
}
|
|
5667
|
+
get(key) {
|
|
5668
|
+
const value = this.map.get(key);
|
|
5669
|
+
if (value === void 0) return;
|
|
5670
|
+
else {
|
|
5671
|
+
this.map.delete(key);
|
|
5672
|
+
this.map.set(key, value);
|
|
5673
|
+
return value;
|
|
5674
|
+
}
|
|
5675
|
+
}
|
|
5676
|
+
delete(key) {
|
|
5677
|
+
return this.map.delete(key);
|
|
5678
|
+
}
|
|
5679
|
+
set(key, value) {
|
|
5680
|
+
if (!this.delete(key) && value !== void 0) {
|
|
5681
|
+
if (this.map.size >= this.max) {
|
|
5682
|
+
const firstKey = this.map.keys().next().value;
|
|
5683
|
+
this.delete(firstKey);
|
|
5684
|
+
}
|
|
5685
|
+
this.map.set(key, value);
|
|
5686
|
+
}
|
|
5687
|
+
return this;
|
|
5688
|
+
}
|
|
5689
|
+
};
|
|
5690
|
+
module.exports = LRUCache;
|
|
5691
|
+
}));
|
|
5692
|
+
//#endregion
|
|
5693
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/range.js
|
|
5694
|
+
var require_range = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5695
|
+
const SPACE_CHARACTERS = /\s+/g;
|
|
5696
|
+
module.exports = class Range {
|
|
5697
|
+
constructor(range, options) {
|
|
5698
|
+
options = parseOptions(options);
|
|
5699
|
+
if (range instanceof Range) if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
|
|
5700
|
+
else return new Range(range.raw, options);
|
|
5701
|
+
if (range instanceof Comparator) {
|
|
5702
|
+
this.raw = range.value;
|
|
5703
|
+
this.set = [[range]];
|
|
5704
|
+
this.formatted = void 0;
|
|
5705
|
+
return this;
|
|
5706
|
+
}
|
|
5707
|
+
this.options = options;
|
|
5708
|
+
this.loose = !!options.loose;
|
|
5709
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
5710
|
+
this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
|
|
5711
|
+
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
5712
|
+
if (!this.set.length) throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
5713
|
+
if (this.set.length > 1) {
|
|
5714
|
+
const first = this.set[0];
|
|
5715
|
+
this.set = this.set.filter((c) => !isNullSet(c[0]));
|
|
5716
|
+
if (this.set.length === 0) this.set = [first];
|
|
5717
|
+
else if (this.set.length > 1) {
|
|
5718
|
+
for (const c of this.set) if (c.length === 1 && isAny(c[0])) {
|
|
5719
|
+
this.set = [c];
|
|
5720
|
+
break;
|
|
5721
|
+
}
|
|
5722
|
+
}
|
|
5723
|
+
}
|
|
5724
|
+
this.formatted = void 0;
|
|
5725
|
+
}
|
|
5726
|
+
get range() {
|
|
5727
|
+
if (this.formatted === void 0) {
|
|
5728
|
+
this.formatted = "";
|
|
5729
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
5730
|
+
if (i > 0) this.formatted += "||";
|
|
5731
|
+
const comps = this.set[i];
|
|
5732
|
+
for (let k = 0; k < comps.length; k++) {
|
|
5733
|
+
if (k > 0) this.formatted += " ";
|
|
5734
|
+
this.formatted += comps[k].toString().trim();
|
|
5735
|
+
}
|
|
5736
|
+
}
|
|
5737
|
+
}
|
|
5738
|
+
return this.formatted;
|
|
5739
|
+
}
|
|
5740
|
+
format() {
|
|
5741
|
+
return this.range;
|
|
5742
|
+
}
|
|
5743
|
+
toString() {
|
|
5744
|
+
return this.range;
|
|
5745
|
+
}
|
|
5746
|
+
parseRange(range) {
|
|
5747
|
+
const memoKey = ((this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE)) + ":" + range;
|
|
5748
|
+
const cached = cache.get(memoKey);
|
|
5749
|
+
if (cached) return cached;
|
|
5750
|
+
const loose = this.options.loose;
|
|
5751
|
+
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
5752
|
+
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
5753
|
+
debug("hyphen replace", range);
|
|
5754
|
+
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
5755
|
+
debug("comparator trim", range);
|
|
5756
|
+
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
5757
|
+
debug("tilde trim", range);
|
|
5758
|
+
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
5759
|
+
debug("caret trim", range);
|
|
5760
|
+
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
5761
|
+
if (loose) rangeList = rangeList.filter((comp) => {
|
|
5762
|
+
debug("loose invalid filter", comp, this.options);
|
|
5763
|
+
return !!comp.match(re[t.COMPARATORLOOSE]);
|
|
5764
|
+
});
|
|
5765
|
+
debug("range list", rangeList);
|
|
5766
|
+
const rangeMap = /* @__PURE__ */ new Map();
|
|
5767
|
+
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
5768
|
+
for (const comp of comparators) {
|
|
5769
|
+
if (isNullSet(comp)) return [comp];
|
|
5770
|
+
rangeMap.set(comp.value, comp);
|
|
5771
|
+
}
|
|
5772
|
+
if (rangeMap.size > 1 && rangeMap.has("")) rangeMap.delete("");
|
|
5773
|
+
const result = [...rangeMap.values()];
|
|
5774
|
+
cache.set(memoKey, result);
|
|
5775
|
+
return result;
|
|
5776
|
+
}
|
|
5777
|
+
intersects(range, options) {
|
|
5778
|
+
if (!(range instanceof Range)) throw new TypeError("a Range is required");
|
|
5779
|
+
return this.set.some((thisComparators) => {
|
|
5780
|
+
return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
|
|
5781
|
+
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
5782
|
+
return rangeComparators.every((rangeComparator) => {
|
|
5783
|
+
return thisComparator.intersects(rangeComparator, options);
|
|
5784
|
+
});
|
|
5785
|
+
});
|
|
5786
|
+
});
|
|
5787
|
+
});
|
|
5788
|
+
}
|
|
5789
|
+
test(version) {
|
|
5790
|
+
if (!version) return false;
|
|
5791
|
+
if (typeof version === "string") try {
|
|
5792
|
+
version = new SemVer(version, this.options);
|
|
5793
|
+
} catch (er) {
|
|
5794
|
+
return false;
|
|
5795
|
+
}
|
|
5796
|
+
for (let i = 0; i < this.set.length; i++) if (testSet(this.set[i], version, this.options)) return true;
|
|
5797
|
+
return false;
|
|
5798
|
+
}
|
|
5799
|
+
};
|
|
5800
|
+
const cache = new (require_lrucache())();
|
|
5801
|
+
const parseOptions = require_parse_options();
|
|
5802
|
+
const Comparator = require_comparator();
|
|
5803
|
+
const debug = require_debug();
|
|
5804
|
+
const SemVer = require_semver$1();
|
|
5805
|
+
const { safeRe: re, t, comparatorTrimReplace, tildeTrimReplace, caretTrimReplace } = require_re();
|
|
5806
|
+
const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
|
|
5807
|
+
const isNullSet = (c) => c.value === "<0.0.0-0";
|
|
5808
|
+
const isAny = (c) => c.value === "";
|
|
5809
|
+
const isSatisfiable = (comparators, options) => {
|
|
5810
|
+
let result = true;
|
|
5811
|
+
const remainingComparators = comparators.slice();
|
|
5812
|
+
let testComparator = remainingComparators.pop();
|
|
5813
|
+
while (result && remainingComparators.length) {
|
|
5814
|
+
result = remainingComparators.every((otherComparator) => {
|
|
5815
|
+
return testComparator.intersects(otherComparator, options);
|
|
5816
|
+
});
|
|
5817
|
+
testComparator = remainingComparators.pop();
|
|
5818
|
+
}
|
|
5819
|
+
return result;
|
|
5820
|
+
};
|
|
5821
|
+
const parseComparator = (comp, options) => {
|
|
5822
|
+
comp = comp.replace(re[t.BUILD], "");
|
|
5823
|
+
debug("comp", comp, options);
|
|
5824
|
+
comp = replaceCarets(comp, options);
|
|
5825
|
+
debug("caret", comp);
|
|
5826
|
+
comp = replaceTildes(comp, options);
|
|
5827
|
+
debug("tildes", comp);
|
|
5828
|
+
comp = replaceXRanges(comp, options);
|
|
5829
|
+
debug("xrange", comp);
|
|
5830
|
+
comp = replaceStars(comp, options);
|
|
5831
|
+
debug("stars", comp);
|
|
5832
|
+
return comp;
|
|
5833
|
+
};
|
|
5834
|
+
const isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
5835
|
+
const replaceTildes = (comp, options) => {
|
|
5836
|
+
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
5837
|
+
};
|
|
5838
|
+
const replaceTilde = (comp, options) => {
|
|
5839
|
+
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
5840
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
5841
|
+
debug("tilde", comp, _, M, m, p, pr);
|
|
5842
|
+
let ret;
|
|
5843
|
+
if (isX(M)) ret = "";
|
|
5844
|
+
else if (isX(m)) ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
|
|
5845
|
+
else if (isX(p)) ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
|
|
5846
|
+
else if (pr) {
|
|
5847
|
+
debug("replaceTilde pr", pr);
|
|
5848
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
5849
|
+
} else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
5850
|
+
debug("tilde return", ret);
|
|
5851
|
+
return ret;
|
|
5852
|
+
});
|
|
5853
|
+
};
|
|
5854
|
+
const replaceCarets = (comp, options) => {
|
|
5855
|
+
return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
|
|
5856
|
+
};
|
|
5857
|
+
const replaceCaret = (comp, options) => {
|
|
5858
|
+
debug("caret", comp, options);
|
|
5859
|
+
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
5860
|
+
const z = options.includePrerelease ? "-0" : "";
|
|
5861
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
5862
|
+
debug("caret", comp, _, M, m, p, pr);
|
|
5863
|
+
let ret;
|
|
5864
|
+
if (isX(M)) ret = "";
|
|
5865
|
+
else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
5866
|
+
else if (isX(p)) if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
5867
|
+
else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
5868
|
+
else if (pr) {
|
|
5869
|
+
debug("replaceCaret pr", pr);
|
|
5870
|
+
if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
|
5871
|
+
else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
5872
|
+
else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
5873
|
+
} else {
|
|
5874
|
+
debug("no pr");
|
|
5875
|
+
if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
|
|
5876
|
+
else ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
|
|
5877
|
+
else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
5878
|
+
}
|
|
5879
|
+
debug("caret return", ret);
|
|
5880
|
+
return ret;
|
|
5881
|
+
});
|
|
5882
|
+
};
|
|
5883
|
+
const replaceXRanges = (comp, options) => {
|
|
5884
|
+
debug("replaceXRanges", comp, options);
|
|
5885
|
+
return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
|
|
5886
|
+
};
|
|
5887
|
+
const replaceXRange = (comp, options) => {
|
|
5888
|
+
comp = comp.trim();
|
|
5889
|
+
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
5890
|
+
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
5891
|
+
debug("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
5892
|
+
const xM = isX(M);
|
|
5893
|
+
const xm = xM || isX(m);
|
|
5894
|
+
const xp = xm || isX(p);
|
|
5895
|
+
const anyX = xp;
|
|
5896
|
+
if (gtlt === "=" && anyX) gtlt = "";
|
|
5897
|
+
pr = options.includePrerelease ? "-0" : "";
|
|
5898
|
+
if (xM) if (gtlt === ">" || gtlt === "<") ret = "<0.0.0-0";
|
|
5899
|
+
else ret = "*";
|
|
5900
|
+
else if (gtlt && anyX) {
|
|
5901
|
+
if (xm) m = 0;
|
|
5902
|
+
p = 0;
|
|
5903
|
+
if (gtlt === ">") {
|
|
5904
|
+
gtlt = ">=";
|
|
5905
|
+
if (xm) {
|
|
5906
|
+
M = +M + 1;
|
|
5907
|
+
m = 0;
|
|
5908
|
+
p = 0;
|
|
5909
|
+
} else {
|
|
5910
|
+
m = +m + 1;
|
|
5911
|
+
p = 0;
|
|
5912
|
+
}
|
|
5913
|
+
} else if (gtlt === "<=") {
|
|
5914
|
+
gtlt = "<";
|
|
5915
|
+
if (xm) M = +M + 1;
|
|
5916
|
+
else m = +m + 1;
|
|
5917
|
+
}
|
|
5918
|
+
if (gtlt === "<") pr = "-0";
|
|
5919
|
+
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
5920
|
+
} else if (xm) ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
5921
|
+
else if (xp) ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
|
|
5922
|
+
debug("xRange return", ret);
|
|
5923
|
+
return ret;
|
|
5924
|
+
});
|
|
5925
|
+
};
|
|
5926
|
+
const replaceStars = (comp, options) => {
|
|
5927
|
+
debug("replaceStars", comp, options);
|
|
5928
|
+
return comp.trim().replace(re[t.STAR], "");
|
|
5929
|
+
};
|
|
5930
|
+
const replaceGTE0 = (comp, options) => {
|
|
5931
|
+
debug("replaceGTE0", comp, options);
|
|
5932
|
+
return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
5933
|
+
};
|
|
5934
|
+
const hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
5935
|
+
if (isX(fM)) from = "";
|
|
5936
|
+
else if (isX(fm)) from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
|
5937
|
+
else if (isX(fp)) from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
|
5938
|
+
else if (fpr) from = `>=${from}`;
|
|
5939
|
+
else from = `>=${from}${incPr ? "-0" : ""}`;
|
|
5940
|
+
if (isX(tM)) to = "";
|
|
5941
|
+
else if (isX(tm)) to = `<${+tM + 1}.0.0-0`;
|
|
5942
|
+
else if (isX(tp)) to = `<${tM}.${+tm + 1}.0-0`;
|
|
5943
|
+
else if (tpr) to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
5944
|
+
else if (incPr) to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
5945
|
+
else to = `<=${to}`;
|
|
5946
|
+
return `${from} ${to}`.trim();
|
|
5947
|
+
};
|
|
5948
|
+
const testSet = (set, version, options) => {
|
|
5949
|
+
for (let i = 0; i < set.length; i++) if (!set[i].test(version)) return false;
|
|
5950
|
+
if (version.prerelease.length && !options.includePrerelease) {
|
|
5951
|
+
for (let i = 0; i < set.length; i++) {
|
|
5952
|
+
debug(set[i].semver);
|
|
5953
|
+
if (set[i].semver === Comparator.ANY) continue;
|
|
5954
|
+
if (set[i].semver.prerelease.length > 0) {
|
|
5955
|
+
const allowed = set[i].semver;
|
|
5956
|
+
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) return true;
|
|
5957
|
+
}
|
|
5958
|
+
}
|
|
5959
|
+
return false;
|
|
5960
|
+
}
|
|
5961
|
+
return true;
|
|
5962
|
+
};
|
|
5963
|
+
}));
|
|
5964
|
+
//#endregion
|
|
5965
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/comparator.js
|
|
5966
|
+
var require_comparator = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
5967
|
+
const ANY = Symbol("SemVer ANY");
|
|
5968
|
+
module.exports = class Comparator {
|
|
5969
|
+
static get ANY() {
|
|
5970
|
+
return ANY;
|
|
5971
|
+
}
|
|
5972
|
+
constructor(comp, options) {
|
|
5973
|
+
options = parseOptions(options);
|
|
5974
|
+
if (comp instanceof Comparator) if (comp.loose === !!options.loose) return comp;
|
|
5975
|
+
else comp = comp.value;
|
|
5976
|
+
comp = comp.trim().split(/\s+/).join(" ");
|
|
5977
|
+
debug("comparator", comp, options);
|
|
5978
|
+
this.options = options;
|
|
5979
|
+
this.loose = !!options.loose;
|
|
5980
|
+
this.parse(comp);
|
|
5981
|
+
if (this.semver === ANY) this.value = "";
|
|
5982
|
+
else this.value = this.operator + this.semver.version;
|
|
5983
|
+
debug("comp", this);
|
|
5984
|
+
}
|
|
5985
|
+
parse(comp) {
|
|
5986
|
+
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
5987
|
+
const m = comp.match(r);
|
|
5988
|
+
if (!m) throw new TypeError(`Invalid comparator: ${comp}`);
|
|
5989
|
+
this.operator = m[1] !== void 0 ? m[1] : "";
|
|
5990
|
+
if (this.operator === "=") this.operator = "";
|
|
5991
|
+
if (!m[2]) this.semver = ANY;
|
|
5992
|
+
else this.semver = new SemVer(m[2], this.options.loose);
|
|
5993
|
+
}
|
|
5994
|
+
toString() {
|
|
5995
|
+
return this.value;
|
|
5996
|
+
}
|
|
5997
|
+
test(version) {
|
|
5998
|
+
debug("Comparator.test", version, this.options.loose);
|
|
5999
|
+
if (this.semver === ANY || version === ANY) return true;
|
|
6000
|
+
if (typeof version === "string") try {
|
|
6001
|
+
version = new SemVer(version, this.options);
|
|
6002
|
+
} catch (er) {
|
|
6003
|
+
return false;
|
|
6004
|
+
}
|
|
6005
|
+
return cmp(version, this.operator, this.semver, this.options);
|
|
6006
|
+
}
|
|
6007
|
+
intersects(comp, options) {
|
|
6008
|
+
if (!(comp instanceof Comparator)) throw new TypeError("a Comparator is required");
|
|
6009
|
+
if (this.operator === "") {
|
|
6010
|
+
if (this.value === "") return true;
|
|
6011
|
+
return new Range(comp.value, options).test(this.value);
|
|
6012
|
+
} else if (comp.operator === "") {
|
|
6013
|
+
if (comp.value === "") return true;
|
|
6014
|
+
return new Range(this.value, options).test(comp.semver);
|
|
6015
|
+
}
|
|
6016
|
+
options = parseOptions(options);
|
|
6017
|
+
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) return false;
|
|
6018
|
+
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) return false;
|
|
6019
|
+
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) return true;
|
|
6020
|
+
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) return true;
|
|
6021
|
+
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) return true;
|
|
6022
|
+
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) return true;
|
|
6023
|
+
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) return true;
|
|
6024
|
+
return false;
|
|
6025
|
+
}
|
|
6026
|
+
};
|
|
6027
|
+
const parseOptions = require_parse_options();
|
|
6028
|
+
const { safeRe: re, t } = require_re();
|
|
6029
|
+
const cmp = require_cmp();
|
|
6030
|
+
const debug = require_debug();
|
|
6031
|
+
const SemVer = require_semver$1();
|
|
6032
|
+
const Range = require_range();
|
|
6033
|
+
}));
|
|
6034
|
+
//#endregion
|
|
6035
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/satisfies.js
|
|
6036
|
+
var require_satisfies = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
6037
|
+
const Range = require_range();
|
|
6038
|
+
const satisfies = (version, range, options) => {
|
|
6039
|
+
try {
|
|
6040
|
+
range = new Range(range, options);
|
|
6041
|
+
} catch (er) {
|
|
6042
|
+
return false;
|
|
6043
|
+
}
|
|
6044
|
+
return range.test(version);
|
|
6045
|
+
};
|
|
6046
|
+
module.exports = satisfies;
|
|
6047
|
+
}));
|
|
6048
|
+
//#endregion
|
|
6049
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/to-comparators.js
|
|
6050
|
+
var require_to_comparators = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
6051
|
+
const Range = require_range();
|
|
6052
|
+
const toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
6053
|
+
module.exports = toComparators;
|
|
6054
|
+
}));
|
|
6055
|
+
//#endregion
|
|
6056
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/max-satisfying.js
|
|
6057
|
+
var require_max_satisfying = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
6058
|
+
const SemVer = require_semver$1();
|
|
6059
|
+
const Range = require_range();
|
|
6060
|
+
const maxSatisfying = (versions, range, options) => {
|
|
6061
|
+
let max = null;
|
|
6062
|
+
let maxSV = null;
|
|
6063
|
+
let rangeObj = null;
|
|
6064
|
+
try {
|
|
6065
|
+
rangeObj = new Range(range, options);
|
|
6066
|
+
} catch (er) {
|
|
6067
|
+
return null;
|
|
6068
|
+
}
|
|
6069
|
+
versions.forEach((v) => {
|
|
6070
|
+
if (rangeObj.test(v)) {
|
|
6071
|
+
if (!max || maxSV.compare(v) === -1) {
|
|
6072
|
+
max = v;
|
|
6073
|
+
maxSV = new SemVer(max, options);
|
|
6074
|
+
}
|
|
6075
|
+
}
|
|
6076
|
+
});
|
|
6077
|
+
return max;
|
|
6078
|
+
};
|
|
6079
|
+
module.exports = maxSatisfying;
|
|
6080
|
+
}));
|
|
6081
|
+
//#endregion
|
|
6082
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-satisfying.js
|
|
6083
|
+
var require_min_satisfying = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
6084
|
+
const SemVer = require_semver$1();
|
|
6085
|
+
const Range = require_range();
|
|
6086
|
+
const minSatisfying = (versions, range, options) => {
|
|
6087
|
+
let min = null;
|
|
6088
|
+
let minSV = null;
|
|
6089
|
+
let rangeObj = null;
|
|
6090
|
+
try {
|
|
6091
|
+
rangeObj = new Range(range, options);
|
|
6092
|
+
} catch (er) {
|
|
6093
|
+
return null;
|
|
6094
|
+
}
|
|
6095
|
+
versions.forEach((v) => {
|
|
6096
|
+
if (rangeObj.test(v)) {
|
|
6097
|
+
if (!min || minSV.compare(v) === 1) {
|
|
6098
|
+
min = v;
|
|
6099
|
+
minSV = new SemVer(min, options);
|
|
6100
|
+
}
|
|
6101
|
+
}
|
|
6102
|
+
});
|
|
6103
|
+
return min;
|
|
6104
|
+
};
|
|
6105
|
+
module.exports = minSatisfying;
|
|
6106
|
+
}));
|
|
6107
|
+
//#endregion
|
|
6108
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-version.js
|
|
6109
|
+
var require_min_version = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
6110
|
+
const SemVer = require_semver$1();
|
|
6111
|
+
const Range = require_range();
|
|
6112
|
+
const gt = require_gt();
|
|
6113
|
+
const minVersion = (range, loose) => {
|
|
6114
|
+
range = new Range(range, loose);
|
|
6115
|
+
let minver = new SemVer("0.0.0");
|
|
6116
|
+
if (range.test(minver)) return minver;
|
|
6117
|
+
minver = new SemVer("0.0.0-0");
|
|
6118
|
+
if (range.test(minver)) return minver;
|
|
6119
|
+
minver = null;
|
|
6120
|
+
for (let i = 0; i < range.set.length; ++i) {
|
|
6121
|
+
const comparators = range.set[i];
|
|
6122
|
+
let setMin = null;
|
|
6123
|
+
comparators.forEach((comparator) => {
|
|
6124
|
+
const compver = new SemVer(comparator.semver.version);
|
|
6125
|
+
switch (comparator.operator) {
|
|
6126
|
+
case ">":
|
|
6127
|
+
if (compver.prerelease.length === 0) compver.patch++;
|
|
6128
|
+
else compver.prerelease.push(0);
|
|
6129
|
+
compver.raw = compver.format();
|
|
6130
|
+
case "":
|
|
6131
|
+
case ">=":
|
|
6132
|
+
if (!setMin || gt(compver, setMin)) setMin = compver;
|
|
6133
|
+
break;
|
|
6134
|
+
case "<":
|
|
6135
|
+
case "<=": break;
|
|
6136
|
+
/* istanbul ignore next */
|
|
6137
|
+
default: throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
6138
|
+
}
|
|
6139
|
+
});
|
|
6140
|
+
if (setMin && (!minver || gt(minver, setMin))) minver = setMin;
|
|
6141
|
+
}
|
|
6142
|
+
if (minver && range.test(minver)) return minver;
|
|
6143
|
+
return null;
|
|
6144
|
+
};
|
|
6145
|
+
module.exports = minVersion;
|
|
6146
|
+
}));
|
|
6147
|
+
//#endregion
|
|
6148
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/valid.js
|
|
6149
|
+
var require_valid = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
6150
|
+
const Range = require_range();
|
|
6151
|
+
const validRange = (range, options) => {
|
|
6152
|
+
try {
|
|
6153
|
+
return new Range(range, options).range || "*";
|
|
6154
|
+
} catch (er) {
|
|
6155
|
+
return null;
|
|
6156
|
+
}
|
|
6157
|
+
};
|
|
6158
|
+
module.exports = validRange;
|
|
6159
|
+
}));
|
|
6160
|
+
//#endregion
|
|
6161
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/outside.js
|
|
6162
|
+
var require_outside = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
6163
|
+
const SemVer = require_semver$1();
|
|
6164
|
+
const Comparator = require_comparator();
|
|
6165
|
+
const { ANY } = Comparator;
|
|
6166
|
+
const Range = require_range();
|
|
6167
|
+
const satisfies = require_satisfies();
|
|
6168
|
+
const gt = require_gt();
|
|
6169
|
+
const lt = require_lt();
|
|
6170
|
+
const lte = require_lte();
|
|
6171
|
+
const gte = require_gte();
|
|
6172
|
+
const outside = (version, range, hilo, options) => {
|
|
6173
|
+
version = new SemVer(version, options);
|
|
6174
|
+
range = new Range(range, options);
|
|
6175
|
+
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
6176
|
+
switch (hilo) {
|
|
6177
|
+
case ">":
|
|
6178
|
+
gtfn = gt;
|
|
6179
|
+
ltefn = lte;
|
|
6180
|
+
ltfn = lt;
|
|
6181
|
+
comp = ">";
|
|
6182
|
+
ecomp = ">=";
|
|
6183
|
+
break;
|
|
6184
|
+
case "<":
|
|
6185
|
+
gtfn = lt;
|
|
6186
|
+
ltefn = gte;
|
|
6187
|
+
ltfn = gt;
|
|
6188
|
+
comp = "<";
|
|
6189
|
+
ecomp = "<=";
|
|
6190
|
+
break;
|
|
6191
|
+
default: throw new TypeError("Must provide a hilo val of \"<\" or \">\"");
|
|
6192
|
+
}
|
|
6193
|
+
if (satisfies(version, range, options)) return false;
|
|
6194
|
+
for (let i = 0; i < range.set.length; ++i) {
|
|
6195
|
+
const comparators = range.set[i];
|
|
6196
|
+
let high = null;
|
|
6197
|
+
let low = null;
|
|
6198
|
+
comparators.forEach((comparator) => {
|
|
6199
|
+
if (comparator.semver === ANY) comparator = new Comparator(">=0.0.0");
|
|
6200
|
+
high = high || comparator;
|
|
6201
|
+
low = low || comparator;
|
|
6202
|
+
if (gtfn(comparator.semver, high.semver, options)) high = comparator;
|
|
6203
|
+
else if (ltfn(comparator.semver, low.semver, options)) low = comparator;
|
|
6204
|
+
});
|
|
6205
|
+
if (high.operator === comp || high.operator === ecomp) return false;
|
|
6206
|
+
if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) return false;
|
|
6207
|
+
else if (low.operator === ecomp && ltfn(version, low.semver)) return false;
|
|
6208
|
+
}
|
|
6209
|
+
return true;
|
|
6210
|
+
};
|
|
6211
|
+
module.exports = outside;
|
|
6212
|
+
}));
|
|
6213
|
+
//#endregion
|
|
6214
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/gtr.js
|
|
6215
|
+
var require_gtr = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
6216
|
+
const outside = require_outside();
|
|
6217
|
+
const gtr = (version, range, options) => outside(version, range, ">", options);
|
|
6218
|
+
module.exports = gtr;
|
|
6219
|
+
}));
|
|
6220
|
+
//#endregion
|
|
6221
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/ltr.js
|
|
6222
|
+
var require_ltr = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
6223
|
+
const outside = require_outside();
|
|
6224
|
+
const ltr = (version, range, options) => outside(version, range, "<", options);
|
|
6225
|
+
module.exports = ltr;
|
|
6226
|
+
}));
|
|
6227
|
+
//#endregion
|
|
6228
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/intersects.js
|
|
6229
|
+
var require_intersects = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
6230
|
+
const Range = require_range();
|
|
6231
|
+
const intersects = (r1, r2, options) => {
|
|
6232
|
+
r1 = new Range(r1, options);
|
|
6233
|
+
r2 = new Range(r2, options);
|
|
6234
|
+
return r1.intersects(r2, options);
|
|
6235
|
+
};
|
|
6236
|
+
module.exports = intersects;
|
|
6237
|
+
}));
|
|
6238
|
+
//#endregion
|
|
6239
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/simplify.js
|
|
6240
|
+
var require_simplify = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
6241
|
+
const satisfies = require_satisfies();
|
|
6242
|
+
const compare = require_compare();
|
|
6243
|
+
module.exports = (versions, range, options) => {
|
|
6244
|
+
const set = [];
|
|
6245
|
+
let first = null;
|
|
6246
|
+
let prev = null;
|
|
6247
|
+
const v = versions.sort((a, b) => compare(a, b, options));
|
|
6248
|
+
for (const version of v) if (satisfies(version, range, options)) {
|
|
6249
|
+
prev = version;
|
|
6250
|
+
if (!first) first = version;
|
|
6251
|
+
} else {
|
|
6252
|
+
if (prev) set.push([first, prev]);
|
|
6253
|
+
prev = null;
|
|
6254
|
+
first = null;
|
|
6255
|
+
}
|
|
6256
|
+
if (first) set.push([first, null]);
|
|
6257
|
+
const ranges = [];
|
|
6258
|
+
for (const [min, max] of set) if (min === max) ranges.push(min);
|
|
6259
|
+
else if (!max && min === v[0]) ranges.push("*");
|
|
6260
|
+
else if (!max) ranges.push(`>=${min}`);
|
|
6261
|
+
else if (min === v[0]) ranges.push(`<=${max}`);
|
|
6262
|
+
else ranges.push(`${min} - ${max}`);
|
|
6263
|
+
const simplified = ranges.join(" || ");
|
|
6264
|
+
const original = typeof range.raw === "string" ? range.raw : String(range);
|
|
6265
|
+
return simplified.length < original.length ? simplified : range;
|
|
6266
|
+
};
|
|
6267
|
+
}));
|
|
6268
|
+
//#endregion
|
|
6269
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/subset.js
|
|
6270
|
+
var require_subset = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
6271
|
+
const Range = require_range();
|
|
6272
|
+
const Comparator = require_comparator();
|
|
6273
|
+
const { ANY } = Comparator;
|
|
6274
|
+
const satisfies = require_satisfies();
|
|
6275
|
+
const compare = require_compare();
|
|
6276
|
+
const subset = (sub, dom, options = {}) => {
|
|
6277
|
+
if (sub === dom) return true;
|
|
6278
|
+
sub = new Range(sub, options);
|
|
6279
|
+
dom = new Range(dom, options);
|
|
6280
|
+
let sawNonNull = false;
|
|
6281
|
+
OUTER: for (const simpleSub of sub.set) {
|
|
6282
|
+
for (const simpleDom of dom.set) {
|
|
6283
|
+
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
6284
|
+
sawNonNull = sawNonNull || isSub !== null;
|
|
6285
|
+
if (isSub) continue OUTER;
|
|
6286
|
+
}
|
|
6287
|
+
if (sawNonNull) return false;
|
|
6288
|
+
}
|
|
6289
|
+
return true;
|
|
6290
|
+
};
|
|
6291
|
+
const minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
|
|
6292
|
+
const minimumVersion = [new Comparator(">=0.0.0")];
|
|
6293
|
+
const simpleSubset = (sub, dom, options) => {
|
|
6294
|
+
if (sub === dom) return true;
|
|
6295
|
+
if (sub.length === 1 && sub[0].semver === ANY) if (dom.length === 1 && dom[0].semver === ANY) return true;
|
|
6296
|
+
else if (options.includePrerelease) sub = minimumVersionWithPreRelease;
|
|
6297
|
+
else sub = minimumVersion;
|
|
6298
|
+
if (dom.length === 1 && dom[0].semver === ANY) if (options.includePrerelease) return true;
|
|
6299
|
+
else dom = minimumVersion;
|
|
6300
|
+
const eqSet = /* @__PURE__ */ new Set();
|
|
6301
|
+
let gt, lt;
|
|
6302
|
+
for (const c of sub) if (c.operator === ">" || c.operator === ">=") gt = higherGT(gt, c, options);
|
|
6303
|
+
else if (c.operator === "<" || c.operator === "<=") lt = lowerLT(lt, c, options);
|
|
6304
|
+
else eqSet.add(c.semver);
|
|
6305
|
+
if (eqSet.size > 1) return null;
|
|
6306
|
+
let gtltComp;
|
|
6307
|
+
if (gt && lt) {
|
|
6308
|
+
gtltComp = compare(gt.semver, lt.semver, options);
|
|
6309
|
+
if (gtltComp > 0) return null;
|
|
6310
|
+
else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) return null;
|
|
6311
|
+
}
|
|
6312
|
+
for (const eq of eqSet) {
|
|
6313
|
+
if (gt && !satisfies(eq, String(gt), options)) return null;
|
|
6314
|
+
if (lt && !satisfies(eq, String(lt), options)) return null;
|
|
6315
|
+
for (const c of dom) if (!satisfies(eq, String(c), options)) return false;
|
|
6316
|
+
return true;
|
|
6317
|
+
}
|
|
6318
|
+
let higher, lower;
|
|
6319
|
+
let hasDomLT, hasDomGT;
|
|
6320
|
+
let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
|
|
6321
|
+
let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
|
|
6322
|
+
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) needDomLTPre = false;
|
|
6323
|
+
for (const c of dom) {
|
|
6324
|
+
hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
|
|
6325
|
+
hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
|
|
6326
|
+
if (gt) {
|
|
6327
|
+
if (needDomGTPre) {
|
|
6328
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) needDomGTPre = false;
|
|
6329
|
+
}
|
|
6330
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
6331
|
+
higher = higherGT(gt, c, options);
|
|
6332
|
+
if (higher === c && higher !== gt) return false;
|
|
6333
|
+
} else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) return false;
|
|
6334
|
+
}
|
|
6335
|
+
if (lt) {
|
|
6336
|
+
if (needDomLTPre) {
|
|
6337
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) needDomLTPre = false;
|
|
6338
|
+
}
|
|
6339
|
+
if (c.operator === "<" || c.operator === "<=") {
|
|
6340
|
+
lower = lowerLT(lt, c, options);
|
|
6341
|
+
if (lower === c && lower !== lt) return false;
|
|
6342
|
+
} else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) return false;
|
|
6343
|
+
}
|
|
6344
|
+
if (!c.operator && (lt || gt) && gtltComp !== 0) return false;
|
|
6345
|
+
}
|
|
6346
|
+
if (gt && hasDomLT && !lt && gtltComp !== 0) return false;
|
|
6347
|
+
if (lt && hasDomGT && !gt && gtltComp !== 0) return false;
|
|
6348
|
+
if (needDomGTPre || needDomLTPre) return false;
|
|
6349
|
+
return true;
|
|
6350
|
+
};
|
|
6351
|
+
const higherGT = (a, b, options) => {
|
|
6352
|
+
if (!a) return b;
|
|
6353
|
+
const comp = compare(a.semver, b.semver, options);
|
|
6354
|
+
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
6355
|
+
};
|
|
6356
|
+
const lowerLT = (a, b, options) => {
|
|
6357
|
+
if (!a) return b;
|
|
6358
|
+
const comp = compare(a.semver, b.semver, options);
|
|
6359
|
+
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
6360
|
+
};
|
|
6361
|
+
module.exports = subset;
|
|
6362
|
+
}));
|
|
6363
|
+
//#endregion
|
|
6364
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/index.js
|
|
6365
|
+
var require_semver = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
6366
|
+
const internalRe = require_re();
|
|
6367
|
+
const constants = require_constants();
|
|
6368
|
+
const SemVer = require_semver$1();
|
|
6369
|
+
const identifiers = require_identifiers();
|
|
6370
|
+
module.exports = {
|
|
6371
|
+
parse: require_parse(),
|
|
6372
|
+
valid: require_valid$1(),
|
|
6373
|
+
clean: require_clean(),
|
|
6374
|
+
inc: require_inc(),
|
|
6375
|
+
diff: require_diff(),
|
|
6376
|
+
major: require_major(),
|
|
6377
|
+
minor: require_minor(),
|
|
6378
|
+
patch: require_patch(),
|
|
6379
|
+
prerelease: require_prerelease(),
|
|
6380
|
+
compare: require_compare(),
|
|
6381
|
+
rcompare: require_rcompare(),
|
|
6382
|
+
compareLoose: require_compare_loose(),
|
|
6383
|
+
compareBuild: require_compare_build(),
|
|
6384
|
+
sort: require_sort(),
|
|
6385
|
+
rsort: require_rsort(),
|
|
6386
|
+
gt: require_gt(),
|
|
6387
|
+
lt: require_lt(),
|
|
6388
|
+
eq: require_eq(),
|
|
6389
|
+
neq: require_neq(),
|
|
6390
|
+
gte: require_gte(),
|
|
6391
|
+
lte: require_lte(),
|
|
6392
|
+
cmp: require_cmp(),
|
|
6393
|
+
coerce: require_coerce(),
|
|
6394
|
+
Comparator: require_comparator(),
|
|
6395
|
+
Range: require_range(),
|
|
6396
|
+
satisfies: require_satisfies(),
|
|
6397
|
+
toComparators: require_to_comparators(),
|
|
6398
|
+
maxSatisfying: require_max_satisfying(),
|
|
6399
|
+
minSatisfying: require_min_satisfying(),
|
|
6400
|
+
minVersion: require_min_version(),
|
|
6401
|
+
validRange: require_valid(),
|
|
6402
|
+
outside: require_outside(),
|
|
6403
|
+
gtr: require_gtr(),
|
|
6404
|
+
ltr: require_ltr(),
|
|
6405
|
+
intersects: require_intersects(),
|
|
6406
|
+
simplifyRange: require_simplify(),
|
|
6407
|
+
subset: require_subset(),
|
|
6408
|
+
SemVer,
|
|
6409
|
+
re: internalRe.re,
|
|
6410
|
+
src: internalRe.src,
|
|
6411
|
+
tokens: internalRe.t,
|
|
6412
|
+
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
|
6413
|
+
RELEASE_TYPES: constants.RELEASE_TYPES,
|
|
6414
|
+
compareIdentifiers: identifiers.compareIdentifiers,
|
|
6415
|
+
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
6416
|
+
};
|
|
6417
|
+
}));
|
|
6418
|
+
//#endregion
|
|
6419
|
+
//#region ../core/dist/index.js
|
|
6420
|
+
var import_picomatch = /* @__PURE__ */ __toESM$1(require_picomatch(), 1);
|
|
6421
|
+
var import_semver = /* @__PURE__ */ __toESM$1(require_semver(), 1);
|
|
5080
6422
|
var __create = Object.create;
|
|
5081
6423
|
var __defProp = Object.defineProperty;
|
|
5082
6424
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -6148,6 +7490,13 @@ const OXLINT_OUTPUT_MAX_BYTES = 50 * 1024 * 1024;
|
|
|
6148
7490
|
const OXLINT_SPAWN_TIMEOUT_MS = 6e4;
|
|
6149
7491
|
const DEAD_CODE_WORKER_MAX_OLD_SPACE_MB = 8192;
|
|
6150
7492
|
const RECOMMENDED_PNPM_MINIMUM_RELEASE_AGE_MINUTES = 10080;
|
|
7493
|
+
const REACT_SERVER_DOM_PACKAGES = [
|
|
7494
|
+
"react-server-dom-webpack",
|
|
7495
|
+
"react-server-dom-parcel",
|
|
7496
|
+
"react-server-dom-turbopack"
|
|
7497
|
+
];
|
|
7498
|
+
const REACT_BLOG_RSC_ADVISORY_URL = "https://react.dev/blog/2025/12/03/critical-security-vulnerability-in-react-server-components";
|
|
7499
|
+
const VERCEL_NEXTJS_SECURITY_RELEASE_URL = "https://vercel.com/changelog/next-js-may-2026-security-release";
|
|
6151
7500
|
const DIAGNOSTIC_CATEGORY_BUCKETS = [
|
|
6152
7501
|
"Security",
|
|
6153
7502
|
"Bugs",
|
|
@@ -6164,6 +7513,13 @@ const COMPILER_CLEANUP_BUCKET = "compiler-cleanup";
|
|
|
6164
7513
|
const COMPILER_CLEANUP_RULE_KEYS = new Set(["react-doctor/react-compiler-no-manual-memoization"]);
|
|
6165
7514
|
const MAX_GLOB_PATTERN_LENGTH_CHARS = 1024;
|
|
6166
7515
|
const CONFIG_CACHE_TTL_MS = 300 * 1e3;
|
|
7516
|
+
const SOCKET_FREE_PURL_API_BASE = "https://firewall-api.socket.dev/purl";
|
|
7517
|
+
const SOCKET_PACKAGE_PAGE_BASE = "https://socket.dev/npm/package";
|
|
7518
|
+
const SOCKET_FREE_USER_AGENT = "react-doctor-supply-chain";
|
|
7519
|
+
const SUPPLY_CHAIN_PLUGIN = "socket";
|
|
7520
|
+
const SUPPLY_CHAIN_RULE = "low-supply-chain-score";
|
|
7521
|
+
const SUPPLY_CHAIN_CATEGORY = "Security";
|
|
7522
|
+
const SUPPLY_CHAIN_IGNORED_PACKAGES = new Set(["next"]);
|
|
6167
7523
|
const TSCONFIG_FILENAME = "tsconfig.json";
|
|
6168
7524
|
const isRelativeExtendsValue = (extendsValue) => extendsValue.startsWith("./") || extendsValue.startsWith("../") || path$1.isAbsolute(extendsValue);
|
|
6169
7525
|
const ensureJsonExtension = (filePath) => path$1.extname(filePath) === "" ? `${filePath}.json` : filePath;
|
|
@@ -8606,6 +9962,168 @@ const checkReactNativeProject = (rootDirectory, project) => {
|
|
|
8606
9962
|
if (!isReactNativeProject(project)) return [];
|
|
8607
9963
|
return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
|
|
8608
9964
|
};
|
|
9965
|
+
const RULE_KEY = "no-vulnerable-react-server-components";
|
|
9966
|
+
const DEPENDENCY_SECTIONS = [
|
|
9967
|
+
"dependencies",
|
|
9968
|
+
"devDependencies",
|
|
9969
|
+
"peerDependencies",
|
|
9970
|
+
"optionalDependencies"
|
|
9971
|
+
];
|
|
9972
|
+
const REACT_RSC_ADVISORIES_BY_MINOR = {
|
|
9973
|
+
"19.0": {
|
|
9974
|
+
rceFixedVersion: "19.0.1",
|
|
9975
|
+
latestSafeVersion: "19.0.6"
|
|
9976
|
+
},
|
|
9977
|
+
"19.1": {
|
|
9978
|
+
rceFixedVersion: "19.1.2",
|
|
9979
|
+
latestSafeVersion: "19.1.7"
|
|
9980
|
+
},
|
|
9981
|
+
"19.2": {
|
|
9982
|
+
rceFixedVersion: "19.2.1",
|
|
9983
|
+
latestSafeVersion: "19.2.6"
|
|
9984
|
+
}
|
|
9985
|
+
};
|
|
9986
|
+
const NEXTJS_OLDEST_AFFECTED_MAJOR = 13;
|
|
9987
|
+
const NEXTJS_RCE_FIXED_BY_MINOR = {
|
|
9988
|
+
"15.0": "15.0.5",
|
|
9989
|
+
"15.1": "15.1.9",
|
|
9990
|
+
"15.2": "15.2.6",
|
|
9991
|
+
"15.3": "15.3.6",
|
|
9992
|
+
"15.4": "15.4.8",
|
|
9993
|
+
"15.5": "15.5.7",
|
|
9994
|
+
"16.0": "16.0.7"
|
|
9995
|
+
};
|
|
9996
|
+
const NEXTJS_LATEST_SAFE_BY_MAJOR = {
|
|
9997
|
+
15: "15.5.18",
|
|
9998
|
+
16: "16.2.6"
|
|
9999
|
+
};
|
|
10000
|
+
const NEXTJS_SUPPORTED_UPGRADE_TARGETS = "15.5.18 or 16.2.6";
|
|
10001
|
+
const buildAdvisoryDiagnostic = (input) => ({
|
|
10002
|
+
filePath: "package.json",
|
|
10003
|
+
plugin: "react-doctor",
|
|
10004
|
+
rule: RULE_KEY,
|
|
10005
|
+
severity: input.severity,
|
|
10006
|
+
message: input.message,
|
|
10007
|
+
help: input.help,
|
|
10008
|
+
line: 0,
|
|
10009
|
+
column: 0,
|
|
10010
|
+
category: "Security"
|
|
10011
|
+
});
|
|
10012
|
+
const enumerateWorkspaceDirectories = (workspaceRoot) => {
|
|
10013
|
+
const patterns = getWorkspacePatterns(workspaceRoot, readPackageJson$1(path$1.join(workspaceRoot, "package.json")));
|
|
10014
|
+
const directories = /* @__PURE__ */ new Set();
|
|
10015
|
+
for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
|
|
10016
|
+
return [...directories];
|
|
10017
|
+
};
|
|
10018
|
+
const readDeclaredSpec = (packageJson, packageName) => {
|
|
10019
|
+
for (const section of DEPENDENCY_SECTIONS) {
|
|
10020
|
+
const spec = packageJson[section]?.[packageName];
|
|
10021
|
+
if (typeof spec === "string") return spec;
|
|
10022
|
+
}
|
|
10023
|
+
return null;
|
|
10024
|
+
};
|
|
10025
|
+
const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
|
|
10026
|
+
const manifestPath = path$1.join(directory, "node_modules", packageName, "package.json");
|
|
10027
|
+
if (isFile(manifestPath)) {
|
|
10028
|
+
const installedVersion = import_semver.valid(readPackageJson$1(manifestPath).version ?? null);
|
|
10029
|
+
if (installedVersion !== null) return installedVersion;
|
|
10030
|
+
}
|
|
10031
|
+
const candidateSpecs = [readDeclaredSpec(readPackageJson$1(path$1.join(directory, "package.json")), packageName), declaredSpecOverride];
|
|
10032
|
+
for (const spec of candidateSpecs) {
|
|
10033
|
+
const pinnedVersion = spec === null ? null : import_semver.valid(spec);
|
|
10034
|
+
if (pinnedVersion !== null) return pinnedVersion;
|
|
10035
|
+
}
|
|
10036
|
+
return null;
|
|
10037
|
+
};
|
|
10038
|
+
const checkReactServerDomAdvisory = (packageName, version) => {
|
|
10039
|
+
const advisory = REACT_RSC_ADVISORIES_BY_MINOR[`${import_semver.major(version)}.${import_semver.minor(version)}`];
|
|
10040
|
+
if (advisory === void 0) return [];
|
|
10041
|
+
const installedDisplay = `${packageName}@${version}`;
|
|
10042
|
+
const lineDisplay = `${import_semver.major(version)}.${import_semver.minor(version)}`;
|
|
10043
|
+
if (import_semver.lt(version, advisory.rceFixedVersion)) return [buildAdvisoryDiagnostic({
|
|
10044
|
+
severity: "error",
|
|
10045
|
+
message: `${installedDisplay} has the critical React Server Components remote code execution vulnerability (CVE-2025-55182, CVSS 10.0) — an unauthenticated attacker can run arbitrary code on your server by sending a crafted payload to any Server Function endpoint`,
|
|
10046
|
+
help: `Upgrade React's Server Components runtime to ${advisory.latestSafeVersion} — a patch-level bump within ${lineDisplay} with no breaking changes. Run \`npm install ${packageName}@${advisory.latestSafeVersion}\` and pin \`react\`/\`react-dom\` to ${advisory.latestSafeVersion} too. See ${REACT_BLOG_RSC_ADVISORY_URL}`
|
|
10047
|
+
})];
|
|
10048
|
+
if (import_semver.lt(version, advisory.latestSafeVersion)) return [buildAdvisoryDiagnostic({
|
|
10049
|
+
severity: "warning",
|
|
10050
|
+
message: `${installedDisplay} is affected by a high-severity React Server Components denial-of-service vulnerability (CVE-2026-23870) patched in ${advisory.latestSafeVersion}`,
|
|
10051
|
+
help: `Upgrade to ${advisory.latestSafeVersion} — a patch-level bump within ${lineDisplay}. Run \`npm install ${packageName}@${advisory.latestSafeVersion}\` and align \`react\`/\`react-dom\`. See ${VERCEL_NEXTJS_SECURITY_RELEASE_URL}`
|
|
10052
|
+
})];
|
|
10053
|
+
return [];
|
|
10054
|
+
};
|
|
10055
|
+
const checkNextjsAdvisory = (version) => {
|
|
10056
|
+
const major = import_semver.major(version);
|
|
10057
|
+
if (major < NEXTJS_OLDEST_AFFECTED_MAJOR) return [];
|
|
10058
|
+
const installedDisplay = `next@${version}`;
|
|
10059
|
+
const latestSafeVersion = NEXTJS_LATEST_SAFE_BY_MAJOR[major];
|
|
10060
|
+
if (latestSafeVersion === void 0) {
|
|
10061
|
+
if (major >= 15) return [];
|
|
10062
|
+
return [buildAdvisoryDiagnostic({
|
|
10063
|
+
severity: "warning",
|
|
10064
|
+
message: `${installedDisplay} is on an unsupported Next.js release line affected by the React Server Components security advisories — there is no patched ${major}.x release`,
|
|
10065
|
+
help: `Upgrade to a patched Next.js release (${NEXTJS_SUPPORTED_UPGRADE_TARGETS}). Next.js bundles its own React Server Components runtime, so upgrading Next.js is what ships the fix. See ${VERCEL_NEXTJS_SECURITY_RELEASE_URL}`
|
|
10066
|
+
})];
|
|
10067
|
+
}
|
|
10068
|
+
const rceFixedVersion = NEXTJS_RCE_FIXED_BY_MINOR[`${major}.${import_semver.minor(version)}`];
|
|
10069
|
+
if (rceFixedVersion !== void 0 && import_semver.lt(version, rceFixedVersion)) return [buildAdvisoryDiagnostic({
|
|
10070
|
+
severity: "error",
|
|
10071
|
+
message: `${installedDisplay} bundles the React Server Components runtime affected by the critical remote code execution vulnerability (CVE-2025-55182, CVSS 10.0) — an unauthenticated attacker can run arbitrary code on your server by sending a crafted payload to any Server Function or Server Action endpoint`,
|
|
10072
|
+
help: `Upgrade Next.js to ${latestSafeVersion} (or newer). Next.js bundles its own React Server Components runtime, so bumping Next.js — not \`react\` — ships the fix. Run \`npm install next@${latestSafeVersion}\`. See ${VERCEL_NEXTJS_SECURITY_RELEASE_URL}`
|
|
10073
|
+
})];
|
|
10074
|
+
if (import_semver.lt(version, latestSafeVersion)) return [buildAdvisoryDiagnostic({
|
|
10075
|
+
severity: "warning",
|
|
10076
|
+
message: `${installedDisplay} bundles a React Server Components runtime affected by a high-severity denial-of-service vulnerability (CVE-2026-23870) patched in Next.js ${latestSafeVersion}`,
|
|
10077
|
+
help: `Upgrade Next.js to ${latestSafeVersion} (or newer). Next.js bundles its own React Server Components runtime, so bumping Next.js ships the fix. Run \`npm install next@${latestSafeVersion}\`. See ${VERCEL_NEXTJS_SECURITY_RELEASE_URL}`
|
|
10078
|
+
})];
|
|
10079
|
+
return [];
|
|
10080
|
+
};
|
|
10081
|
+
/**
|
|
10082
|
+
* Flags a project running React Server Components on a version with a known
|
|
10083
|
+
* security advisory — primarily the critical unauthenticated RCE
|
|
10084
|
+
* (CVE-2025-55182), plus the later high-severity DoS (CVE-2026-23870).
|
|
10085
|
+
*
|
|
10086
|
+
* Every candidate directory — the scan root and each workspace package — is
|
|
10087
|
+
* probed independently, so heterogeneous monorepo installs are all seen (a
|
|
10088
|
+
* vulnerable `next` in one workspace isn't masked by an inert one elsewhere).
|
|
10089
|
+
* Next.js vendors its own RSC runtime, so an affected `next` install in a
|
|
10090
|
+
* directory is reported by its `next` version (the fix is a Next.js bump) and
|
|
10091
|
+
* suppresses the standalone `react-server-dom-*` check for that directory only;
|
|
10092
|
+
* every other framework or bundler — Vite, Parcel, React Router, Waku,
|
|
10093
|
+
* RedwoodSDK — is reported by its `react-server-dom-*` version. Dispatch keys
|
|
10094
|
+
* on resolved installs rather than the root framework classification, so a
|
|
10095
|
+
* monorepo whose root is Vite but whose workspace runs Next.js is still
|
|
10096
|
+
* covered. Pure client-side React apps (no RSC packages, no Next.js) are not
|
|
10097
|
+
* affected and stay quiet.
|
|
10098
|
+
*/
|
|
10099
|
+
const checkReactServerComponentsAdvisory = (scanDirectory, project) => {
|
|
10100
|
+
const workspaceRoot = findMonorepoRoot(scanDirectory) ?? project.rootDirectory;
|
|
10101
|
+
const candidateDirectories = [...new Set([
|
|
10102
|
+
scanDirectory,
|
|
10103
|
+
project.rootDirectory,
|
|
10104
|
+
workspaceRoot,
|
|
10105
|
+
...enumerateWorkspaceDirectories(workspaceRoot)
|
|
10106
|
+
])];
|
|
10107
|
+
const diagnostics = [];
|
|
10108
|
+
const seenMessages = /* @__PURE__ */ new Set();
|
|
10109
|
+
const pushUnique = (candidates) => {
|
|
10110
|
+
for (const candidate of candidates) {
|
|
10111
|
+
if (seenMessages.has(candidate.message)) continue;
|
|
10112
|
+
seenMessages.add(candidate.message);
|
|
10113
|
+
diagnostics.push(candidate);
|
|
10114
|
+
}
|
|
10115
|
+
};
|
|
10116
|
+
for (const directory of candidateDirectories) {
|
|
10117
|
+
const nextVersion = resolveVersionInDirectory(directory, "next", directory === scanDirectory ? project.nextjsVersion : null);
|
|
10118
|
+
if (nextVersion !== null) pushUnique(checkNextjsAdvisory(nextVersion));
|
|
10119
|
+
if (nextVersion !== null && import_semver.major(nextVersion) >= NEXTJS_OLDEST_AFFECTED_MAJOR) continue;
|
|
10120
|
+
for (const packageName of REACT_SERVER_DOM_PACKAGES) {
|
|
10121
|
+
const version = resolveVersionInDirectory(directory, packageName, null);
|
|
10122
|
+
if (version !== null) pushUnique(checkReactServerDomAdvisory(packageName, version));
|
|
10123
|
+
}
|
|
10124
|
+
}
|
|
10125
|
+
return diagnostics;
|
|
10126
|
+
};
|
|
8609
10127
|
const REDUCED_MOTION_GREP_PATTERN = "prefers-reduced-motion|useReducedMotion|MotionConfig|reducedMotion";
|
|
8610
10128
|
const REDUCED_MOTION_FILE_GLOBS = [
|
|
8611
10129
|
"*.ts",
|
|
@@ -11572,6 +13090,262 @@ var Score = class Score extends Context.Service()("react-doctor/Score") {
|
|
|
11572
13090
|
}) }));
|
|
11573
13091
|
static layerOf = (result) => Layer.succeed(Score, Score.of({ compute: () => Effect.succeed(result) }));
|
|
11574
13092
|
};
|
|
13093
|
+
const SocketScoreSchema = Schema.Struct({
|
|
13094
|
+
overall: Schema.Number,
|
|
13095
|
+
license: Schema.Number,
|
|
13096
|
+
maintenance: Schema.Number,
|
|
13097
|
+
quality: Schema.Number,
|
|
13098
|
+
supplyChain: Schema.Number,
|
|
13099
|
+
vulnerability: Schema.Number
|
|
13100
|
+
});
|
|
13101
|
+
const SocketArtifactSchema = Schema.Struct({ score: Schema.optional(SocketScoreSchema) });
|
|
13102
|
+
const decodeArtifact = Schema.decodeUnknownOption(SocketArtifactSchema);
|
|
13103
|
+
const SCORE_AXES = [
|
|
13104
|
+
{
|
|
13105
|
+
key: "supplyChain",
|
|
13106
|
+
label: "supply chain"
|
|
13107
|
+
},
|
|
13108
|
+
{
|
|
13109
|
+
key: "vulnerability",
|
|
13110
|
+
label: "vulnerability"
|
|
13111
|
+
},
|
|
13112
|
+
{
|
|
13113
|
+
key: "maintenance",
|
|
13114
|
+
label: "maintenance"
|
|
13115
|
+
},
|
|
13116
|
+
{
|
|
13117
|
+
key: "quality",
|
|
13118
|
+
label: "quality"
|
|
13119
|
+
},
|
|
13120
|
+
{
|
|
13121
|
+
key: "license",
|
|
13122
|
+
label: "license"
|
|
13123
|
+
}
|
|
13124
|
+
];
|
|
13125
|
+
const clampScore = (value) => {
|
|
13126
|
+
if (!Number.isFinite(value)) return 50;
|
|
13127
|
+
return Math.min(Math.max(value, 0), 100);
|
|
13128
|
+
};
|
|
13129
|
+
const toHundred = (normalizedScore) => Math.round(clampScore(normalizedScore * 100));
|
|
13130
|
+
const resolveOptions = (config) => {
|
|
13131
|
+
const supplyChain = config?.supplyChain ?? {};
|
|
13132
|
+
return {
|
|
13133
|
+
minScore: typeof supplyChain.minScore === "number" ? clampScore(supplyChain.minScore) : 50,
|
|
13134
|
+
severity: supplyChain.severity === "warning" ? "warning" : "error",
|
|
13135
|
+
includeDevDependencies: supplyChain.includeDevDependencies !== false
|
|
13136
|
+
};
|
|
13137
|
+
};
|
|
13138
|
+
const resolveConcreteVersion = (spec) => {
|
|
13139
|
+
const trimmed = spec.trim();
|
|
13140
|
+
if (trimmed.length === 0) return null;
|
|
13141
|
+
if (trimmed.includes(":")) return null;
|
|
13142
|
+
const match = trimmed.match(/\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?/);
|
|
13143
|
+
return match ? match[0] : null;
|
|
13144
|
+
};
|
|
13145
|
+
const locateDependencyKey = (packageJsonText, section, name) => {
|
|
13146
|
+
const needle = `"${name}"`;
|
|
13147
|
+
const sectionHeader = new RegExp(`"${section}"\\s*:\\s*\\{`);
|
|
13148
|
+
const lines = packageJsonText.split(/\r?\n/);
|
|
13149
|
+
let depth = 0;
|
|
13150
|
+
let insideSection = false;
|
|
13151
|
+
for (let lineIndex = 0; lineIndex < lines.length; lineIndex += 1) {
|
|
13152
|
+
const lineText = lines[lineIndex];
|
|
13153
|
+
if (!insideSection) {
|
|
13154
|
+
if (sectionHeader.test(lineText)) {
|
|
13155
|
+
insideSection = true;
|
|
13156
|
+
depth = 1;
|
|
13157
|
+
}
|
|
13158
|
+
continue;
|
|
13159
|
+
}
|
|
13160
|
+
const columnIndex = lineText.indexOf(needle);
|
|
13161
|
+
if (columnIndex >= 0 && /^\s*:/.test(lineText.slice(columnIndex + needle.length))) return {
|
|
13162
|
+
line: lineIndex + 1,
|
|
13163
|
+
column: columnIndex + 1
|
|
13164
|
+
};
|
|
13165
|
+
for (const character of lineText) if (character === "{") depth += 1;
|
|
13166
|
+
else if (character === "}") depth -= 1;
|
|
13167
|
+
if (depth <= 0) return null;
|
|
13168
|
+
}
|
|
13169
|
+
return null;
|
|
13170
|
+
};
|
|
13171
|
+
const collectDependenciesToScore = (packageJson, packageJsonText, includeDevDependencies) => {
|
|
13172
|
+
const sectionByName = /* @__PURE__ */ new Map();
|
|
13173
|
+
for (const name of Object.keys(packageJson.dependencies ?? {})) sectionByName.set(name, "dependencies");
|
|
13174
|
+
if (includeDevDependencies) {
|
|
13175
|
+
for (const name of Object.keys(packageJson.devDependencies ?? {})) if (!sectionByName.has(name)) sectionByName.set(name, "devDependencies");
|
|
13176
|
+
}
|
|
13177
|
+
const dependencies = [];
|
|
13178
|
+
for (const [name, section] of sectionByName) {
|
|
13179
|
+
if (SUPPLY_CHAIN_IGNORED_PACKAGES.has(name)) continue;
|
|
13180
|
+
const spec = (packageJson[section] ?? {})[name] ?? "";
|
|
13181
|
+
const version = resolveConcreteVersion(spec);
|
|
13182
|
+
if (version === null) continue;
|
|
13183
|
+
const location = locateDependencyKey(packageJsonText, section, name);
|
|
13184
|
+
dependencies.push({
|
|
13185
|
+
name,
|
|
13186
|
+
version,
|
|
13187
|
+
spec,
|
|
13188
|
+
line: location?.line ?? 0,
|
|
13189
|
+
column: location?.column ?? 0
|
|
13190
|
+
});
|
|
13191
|
+
}
|
|
13192
|
+
return dependencies;
|
|
13193
|
+
};
|
|
13194
|
+
const readPackageJsonText = (packageJsonPath) => {
|
|
13195
|
+
try {
|
|
13196
|
+
return fs$1.readFileSync(packageJsonPath, "utf-8");
|
|
13197
|
+
} catch {
|
|
13198
|
+
return "";
|
|
13199
|
+
}
|
|
13200
|
+
};
|
|
13201
|
+
const collectWorkspaceDirectories = (startDirectory) => {
|
|
13202
|
+
const monorepoRoot = isMonorepoRoot(startDirectory) ? startDirectory : findMonorepoRoot(startDirectory) ?? startDirectory;
|
|
13203
|
+
const rootPackageJson = readPackageJson$1(path$1.join(monorepoRoot, "package.json"));
|
|
13204
|
+
const directories = [monorepoRoot];
|
|
13205
|
+
const visited = new Set([monorepoRoot]);
|
|
13206
|
+
for (const pattern of getWorkspacePatterns(monorepoRoot, rootPackageJson)) for (const workspaceDirectory of resolveWorkspaceDirectories(monorepoRoot, pattern)) {
|
|
13207
|
+
if (visited.has(workspaceDirectory)) continue;
|
|
13208
|
+
visited.add(workspaceDirectory);
|
|
13209
|
+
directories.push(workspaceDirectory);
|
|
13210
|
+
}
|
|
13211
|
+
return directories;
|
|
13212
|
+
};
|
|
13213
|
+
const collectMonorepoDependencies = (startDirectory, includeDevDependencies) => {
|
|
13214
|
+
const dependenciesByKey = /* @__PURE__ */ new Map();
|
|
13215
|
+
for (const directory of collectWorkspaceDirectories(startDirectory)) {
|
|
13216
|
+
const packageJsonPath = path$1.join(directory, "package.json");
|
|
13217
|
+
const packageJson = readPackageJson$1(packageJsonPath);
|
|
13218
|
+
const packageJsonText = readPackageJsonText(packageJsonPath);
|
|
13219
|
+
for (const dependency of collectDependenciesToScore(packageJson, packageJsonText, includeDevDependencies)) {
|
|
13220
|
+
const key = `${dependency.name}@${dependency.version}`;
|
|
13221
|
+
if (!dependenciesByKey.has(key)) dependenciesByKey.set(key, dependency);
|
|
13222
|
+
}
|
|
13223
|
+
}
|
|
13224
|
+
return [...dependenciesByKey.values()];
|
|
13225
|
+
};
|
|
13226
|
+
const toPurl = (dependency) => `pkg:npm/${dependency.name}@${dependency.version}`;
|
|
13227
|
+
const parseScoreFromBody = (body) => {
|
|
13228
|
+
for (const line of body.split("\n")) {
|
|
13229
|
+
if (line.trim().length === 0) continue;
|
|
13230
|
+
let parsed;
|
|
13231
|
+
try {
|
|
13232
|
+
parsed = JSON.parse(line);
|
|
13233
|
+
} catch {
|
|
13234
|
+
continue;
|
|
13235
|
+
}
|
|
13236
|
+
const artifact = Option.getOrNull(decodeArtifact(parsed));
|
|
13237
|
+
if (artifact?.score) return artifact.score;
|
|
13238
|
+
}
|
|
13239
|
+
return null;
|
|
13240
|
+
};
|
|
13241
|
+
const fetchSocketScore = (dependency) => Effect.tryPromise(async (signal) => {
|
|
13242
|
+
const requestUrl = `${SOCKET_FREE_PURL_API_BASE}/${encodeURIComponent(toPurl(dependency))}`;
|
|
13243
|
+
const response = await fetch(requestUrl, {
|
|
13244
|
+
headers: { "User-Agent": SOCKET_FREE_USER_AGENT },
|
|
13245
|
+
signal
|
|
13246
|
+
});
|
|
13247
|
+
if (!response.ok) return null;
|
|
13248
|
+
return parseScoreFromBody(await response.text());
|
|
13249
|
+
}).pipe(Effect.timeout(FETCH_TIMEOUT_MS), Effect.orElseSucceed(() => null), Effect.tap((score) => {
|
|
13250
|
+
const scoreAttributes = {};
|
|
13251
|
+
if (score !== null) {
|
|
13252
|
+
scoreAttributes["socket.score.overall"] = toHundred(score.overall);
|
|
13253
|
+
for (const axis of SCORE_AXES) scoreAttributes[`socket.score.${axis.key}`] = toHundred(score[axis.key]);
|
|
13254
|
+
}
|
|
13255
|
+
return Effect.annotateCurrentSpan({
|
|
13256
|
+
"socket.scored": score !== null,
|
|
13257
|
+
...scoreAttributes
|
|
13258
|
+
});
|
|
13259
|
+
}), Effect.withSpan("SupplyChain.fetchScore", { attributes: {
|
|
13260
|
+
"socket.package": dependency.name,
|
|
13261
|
+
"socket.version": dependency.version,
|
|
13262
|
+
"socket.purl": toPurl(dependency)
|
|
13263
|
+
} }));
|
|
13264
|
+
const formatAxisScores = (score) => SCORE_AXES.map((axis) => `${axis.label} ${toHundred(score[axis.key])}`).join(", ");
|
|
13265
|
+
const buildLowScoreDiagnostic = (dependency, score, options) => {
|
|
13266
|
+
const overall = toHundred(score.overall);
|
|
13267
|
+
const packagePageUrl = `${SOCKET_PACKAGE_PAGE_BASE}/${dependency.name}/overview/${dependency.version}`;
|
|
13268
|
+
return {
|
|
13269
|
+
filePath: "package.json",
|
|
13270
|
+
plugin: SUPPLY_CHAIN_PLUGIN,
|
|
13271
|
+
rule: SUPPLY_CHAIN_RULE,
|
|
13272
|
+
severity: options.severity,
|
|
13273
|
+
message: `\`${dependency.name}\` (declared in package.json as "${dependency.spec}", scored at ${dependency.version}) has a Socket supply-chain score of ${overall}/100 (below the minimum of ${options.minScore}). Axis scores — ${formatAxisScores(score)}.`,
|
|
13274
|
+
help: `Update or replace the \`"${dependency.name}": "${dependency.spec}"\` entry in package.json. Review ${dependency.name} on Socket: ${packagePageUrl}. Or raise \`supplyChain.minScore\` if you have vetted and accepted this package.`,
|
|
13275
|
+
url: packagePageUrl,
|
|
13276
|
+
line: dependency.line,
|
|
13277
|
+
column: dependency.column,
|
|
13278
|
+
category: SUPPLY_CHAIN_CATEGORY
|
|
13279
|
+
};
|
|
13280
|
+
};
|
|
13281
|
+
/**
|
|
13282
|
+
* Fetches the Socket score of every direct dependency declared across the
|
|
13283
|
+
* whole monorepo (the workspace root plus every workspace package.json),
|
|
13284
|
+
* de-duplicated by `name@version` — not just the ones below a threshold —
|
|
13285
|
+
* via the same free, keyless endpoint as {@link checkSupplyChain}. Backs the
|
|
13286
|
+
* CLI's `--sfw` demo listing. Unknown packages and per-package failures come
|
|
13287
|
+
* back with `overall: null` rather than being dropped, so the caller can show
|
|
13288
|
+
* them explicitly.
|
|
13289
|
+
*/
|
|
13290
|
+
const collectSupplyChainScores = (input) => Effect.gen(function* () {
|
|
13291
|
+
const options = resolveOptions(input.userConfig);
|
|
13292
|
+
const dependencies = collectMonorepoDependencies(input.rootDirectory, options.includeDevDependencies);
|
|
13293
|
+
if (dependencies.length === 0) return [];
|
|
13294
|
+
const scores = yield* Effect.forEach(dependencies, fetchSocketScore, { concurrency: 8 });
|
|
13295
|
+
return dependencies.map((dependency, index) => {
|
|
13296
|
+
const score = scores[index];
|
|
13297
|
+
return {
|
|
13298
|
+
name: dependency.name,
|
|
13299
|
+
version: dependency.version,
|
|
13300
|
+
overall: score ? toHundred(score.overall) : null
|
|
13301
|
+
};
|
|
13302
|
+
});
|
|
13303
|
+
});
|
|
13304
|
+
/**
|
|
13305
|
+
* Scores every direct dependency in the project's `package.json` against
|
|
13306
|
+
* Socket.dev's free PURL endpoint (the same one Socket Firewall's free tier
|
|
13307
|
+
* uses — no API key) and returns a diagnostic for each dependency whose
|
|
13308
|
+
* Socket `overall` score is below the configured `minScore`.
|
|
13309
|
+
*
|
|
13310
|
+
* Lookups run with bounded concurrency via `Effect.forEach`. The check is
|
|
13311
|
+
* total/fail-open: each per-package lookup already recovers to `null`
|
|
13312
|
+
* (skip) on timeout or network/parse failure, so a flaky Socket API never
|
|
13313
|
+
* sinks the scan. Diagnostics default to `"error"` severity, so a low score
|
|
13314
|
+
* fails the run at the standard `blocking` gate.
|
|
13315
|
+
*/
|
|
13316
|
+
const checkSupplyChain = (input) => Effect.gen(function* () {
|
|
13317
|
+
const options = resolveOptions(input.userConfig);
|
|
13318
|
+
const packageJsonPath = path$1.join(input.rootDirectory, "package.json");
|
|
13319
|
+
const dependencies = collectDependenciesToScore(readPackageJson$1(packageJsonPath), readPackageJsonText(packageJsonPath), options.includeDevDependencies);
|
|
13320
|
+
if (dependencies.length === 0) return [];
|
|
13321
|
+
const scores = yield* Effect.forEach(dependencies, fetchSocketScore, { concurrency: 8 });
|
|
13322
|
+
const diagnostics = [];
|
|
13323
|
+
for (let index = 0; index < dependencies.length; index += 1) {
|
|
13324
|
+
const score = scores[index];
|
|
13325
|
+
if (!score) continue;
|
|
13326
|
+
if (toHundred(score.overall) >= options.minScore) continue;
|
|
13327
|
+
diagnostics.push(buildLowScoreDiagnostic(dependencies[index], score, options));
|
|
13328
|
+
}
|
|
13329
|
+
return diagnostics;
|
|
13330
|
+
});
|
|
13331
|
+
/**
|
|
13332
|
+
* `SupplyChain` scores the project's direct dependencies against Socket.dev's
|
|
13333
|
+
* free, keyless PURL endpoint — the same lookup Socket Firewall's free tier
|
|
13334
|
+
* (`sfw`) performs — and streams a diagnostic for each dependency whose
|
|
13335
|
+
* Socket score falls below the configured `supplyChain.minScore`.
|
|
13336
|
+
*
|
|
13337
|
+
* Runs by default (one network request per dependency); the orchestrator
|
|
13338
|
+
* provides `layerOf([])` only when the user opts out via
|
|
13339
|
+
* `supplyChain.enabled: false`, and always skips it in `--diff` / `--staged`
|
|
13340
|
+
* mode (dependency health is a whole-project property).
|
|
13341
|
+
* The underlying `checkSupplyChain` Effect is total/fail-open — per-package
|
|
13342
|
+
* timeouts and network failures recover to "skip" — so the stream never
|
|
13343
|
+
* fails, mirroring `DeadCode`'s stream shape so the two compose the same way.
|
|
13344
|
+
*/
|
|
13345
|
+
var SupplyChain = class SupplyChain extends Context.Service()("react-doctor/SupplyChain") {
|
|
13346
|
+
static layerNode = Layer.succeed(SupplyChain, SupplyChain.of({ run: (input) => Stream.unwrap(checkSupplyChain(input).pipe(Effect.map((diagnostics) => Stream.fromIterable(diagnostics)), Effect.withSpan("SupplyChain.run"))) }));
|
|
13347
|
+
static layerOf = (diagnostics) => Layer.succeed(SupplyChain, SupplyChain.of({ run: () => Stream.fromIterable(diagnostics) }));
|
|
13348
|
+
};
|
|
11575
13349
|
const getObjectProperty = (value, propertyName) => {
|
|
11576
13350
|
if (typeof value !== "object" || value === null) return void 0;
|
|
11577
13351
|
return Reflect.get(value, propertyName);
|
|
@@ -11649,6 +13423,7 @@ const runInspect = (input, hooks = {}) => Effect.gen(function* () {
|
|
|
11649
13423
|
const reporterService = yield* Reporter;
|
|
11650
13424
|
const scoreService = yield* Score;
|
|
11651
13425
|
const deadCodeService = yield* DeadCode;
|
|
13426
|
+
const supplyChainService = yield* SupplyChain;
|
|
11652
13427
|
const gitService = yield* Git;
|
|
11653
13428
|
const progressService = yield* Progress;
|
|
11654
13429
|
const partialFailuresRef = yield* LintPartialFailures;
|
|
@@ -11684,10 +13459,15 @@ const runInspect = (input, hooks = {}) => Effect.gen(function* () {
|
|
|
11684
13459
|
const environmentDiagnostics = isDiffMode ? [] : [
|
|
11685
13460
|
...checkReducedMotion(scanDirectory),
|
|
11686
13461
|
...checkPnpmHardening(scanDirectory),
|
|
13462
|
+
...checkReactServerComponentsAdvisory(scanDirectory, project),
|
|
11687
13463
|
...checkExpoProject(scanDirectory, project),
|
|
11688
13464
|
...checkReactNativeProject(scanDirectory, project)
|
|
11689
13465
|
];
|
|
11690
13466
|
const envCollected = yield* Stream.runCollect(applyPerElementPipeline(Stream.fromIterable(environmentDiagnostics)));
|
|
13467
|
+
const supplyChainCollected = !isDiffMode || (input.supplyChainManifestChanged ?? false) ? yield* Stream.runCollect(applyPerElementPipeline(supplyChainService.run({
|
|
13468
|
+
rootDirectory: scanDirectory,
|
|
13469
|
+
userConfig: resolvedConfig.config
|
|
13470
|
+
}))) : [];
|
|
11691
13471
|
const lintFailure = yield* Ref.make({
|
|
11692
13472
|
didFail: false,
|
|
11693
13473
|
reason: null,
|
|
@@ -11752,6 +13532,7 @@ const runInspect = (input, hooks = {}) => Effect.gen(function* () {
|
|
|
11752
13532
|
yield* reporterService.finalize;
|
|
11753
13533
|
const finalDiagnostics = [
|
|
11754
13534
|
...envCollected,
|
|
13535
|
+
...supplyChainCollected,
|
|
11755
13536
|
...lintCollected,
|
|
11756
13537
|
...deadCodeCollected
|
|
11757
13538
|
];
|
|
@@ -12285,8 +14066,9 @@ const groupBy = (items, keyFn) => {
|
|
|
12285
14066
|
*
|
|
12286
14067
|
* Recipes are generated from react-doctor's own engine rules, so only
|
|
12287
14068
|
* those resolve. Dead-code (`deslop`), the synthetic environment and
|
|
12288
|
-
* supply-chain checks (`require-reduced-motion`, `require-pnpm-hardening
|
|
12289
|
-
* — `react-doctor`-namespaced but not
|
|
14069
|
+
* supply-chain checks (`require-reduced-motion`, `require-pnpm-hardening`,
|
|
14070
|
+
* `no-vulnerable-react-server-components` — `react-doctor`-namespaced but not
|
|
14071
|
+
* engine rules), and adopted
|
|
12290
14072
|
* third-party plugins (`eslint`, `unicorn`, `react-hooks-js`, …) have no
|
|
12291
14073
|
* recipe, so advertising "fetch the fix recipe" for them sends agents to
|
|
12292
14074
|
* a 404. Gate the directive on this predicate.
|
|
@@ -12468,7 +14250,7 @@ const makeNoopConsole = () => ({
|
|
|
12468
14250
|
});
|
|
12469
14251
|
//#endregion
|
|
12470
14252
|
//#region src/cli/utils/version.ts
|
|
12471
|
-
const VERSION = "0.4.2-dev.
|
|
14253
|
+
const VERSION = "0.4.2-dev.a254414";
|
|
12472
14254
|
//#endregion
|
|
12473
14255
|
//#region src/cli/utils/json-mode.ts
|
|
12474
14256
|
let context = null;
|
|
@@ -12826,13 +14608,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
12826
14608
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
12827
14609
|
* standard `SENTRY_RELEASE` override.
|
|
12828
14610
|
*/
|
|
12829
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.4.2-dev.
|
|
14611
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.4.2-dev.a254414`;
|
|
12830
14612
|
/**
|
|
12831
14613
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
12832
14614
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
12833
14615
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
12834
14616
|
*/
|
|
12835
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.4.2-dev.
|
|
14617
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.4.2-dev.a254414") ? "development" : "production");
|
|
12836
14618
|
/**
|
|
12837
14619
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
12838
14620
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -16095,6 +17877,7 @@ const buildRuntimeLayers = (input) => {
|
|
|
16095
17877
|
const linterLayer = input.shouldSkipLint ? Linter.layerOf([]) : Linter.layerOxlint;
|
|
16096
17878
|
const deadCodeLayer = input.shouldRunDeadCode ? DeadCode.layerNode : DeadCode.layerOf([]);
|
|
16097
17879
|
const scoreLayer = input.shouldComputeScore ? Score.layerHttp : Score.layerOf(null);
|
|
17880
|
+
const supplyChainLayer = input.userConfig?.supplyChain?.enabled === false ? SupplyChain.layerOf([]) : SupplyChain.layerNode;
|
|
16098
17881
|
const projectLayer = input.projectInfoOverride === void 0 ? Project.layerNode : Project.layerOf(input.projectInfoOverride);
|
|
16099
17882
|
const progressLayer = input.shouldShowProgressSpinners ? Progress.layerOra(buildSpinnerProgressHandle) : Progress.layerNoop;
|
|
16100
17883
|
const configLayer = input.hasConfigOverride ? Config.layerOf({
|
|
@@ -16102,7 +17885,7 @@ const buildRuntimeLayers = (input) => {
|
|
|
16102
17885
|
resolvedDirectory: input.directory,
|
|
16103
17886
|
configSourceDirectory: input.configSourceDirectory
|
|
16104
17887
|
}) : Config.layerNode;
|
|
16105
|
-
const baseLayers = Layer.mergeAll(projectLayer, configLayer, Files.layerNode, Git.layerNode, linterLayer, LintPartialFailures.layerLive, deadCodeLayer, progressLayer, Reporter.layerNoop, scoreLayer);
|
|
17888
|
+
const baseLayers = Layer.mergeAll(projectLayer, configLayer, Files.layerNode, Git.layerNode, linterLayer, LintPartialFailures.layerLive, deadCodeLayer, progressLayer, Reporter.layerNoop, scoreLayer, supplyChainLayer);
|
|
16106
17889
|
return input.oxlintConcurrency === void 0 ? baseLayers : Layer.mergeAll(baseLayers, Layer.succeed(OxlintConcurrency, input.oxlintConcurrency));
|
|
16107
17890
|
};
|
|
16108
17891
|
//#endregion
|
|
@@ -17676,7 +19459,8 @@ const buildScanResultCacheKey = (input) => {
|
|
|
17676
19459
|
baselineRef: input.options.baseline?.ref,
|
|
17677
19460
|
noScore: input.options.noScore,
|
|
17678
19461
|
isCi: input.options.isCi,
|
|
17679
|
-
suppressRendering: input.options.suppressRendering
|
|
19462
|
+
suppressRendering: input.options.suppressRendering,
|
|
19463
|
+
supplyChainManifestChanged: input.options.supplyChainManifestChanged
|
|
17680
19464
|
}
|
|
17681
19465
|
});
|
|
17682
19466
|
return cacheKeyJson === null ? null : hashString(cacheKeyJson);
|
|
@@ -17747,7 +19531,8 @@ const mergeInspectOptions = (inputOptions, userConfig) => ({
|
|
|
17747
19531
|
outputSurface: inputOptions.outputSurface ?? "cli",
|
|
17748
19532
|
suppressRendering: inputOptions.suppressRendering ?? false,
|
|
17749
19533
|
concurrency: inputOptions.concurrency,
|
|
17750
|
-
baseline: inputOptions.baseline ?? null
|
|
19534
|
+
baseline: inputOptions.baseline ?? null,
|
|
19535
|
+
supplyChainManifestChanged: inputOptions.supplyChainManifestChanged ?? false
|
|
17751
19536
|
});
|
|
17752
19537
|
const buildRunEventConfig = (options, userConfig, hasCustomConfig) => ({
|
|
17753
19538
|
parallel: options.concurrency !== void 0,
|
|
@@ -17849,7 +19634,8 @@ const runBaselineComparison = async (params) => {
|
|
|
17849
19634
|
doctorVersion: VERSION,
|
|
17850
19635
|
runId: getRunId(),
|
|
17851
19636
|
resolveLocalGithubViewerPermission: false,
|
|
17852
|
-
suppressScanSummary: true
|
|
19637
|
+
suppressScanSummary: true,
|
|
19638
|
+
supplyChainManifestChanged: params.options.supplyChainManifestChanged
|
|
17853
19639
|
}, {});
|
|
17854
19640
|
const baseOutput = await Effect.runPromise(restoreLegacyThrow(baseProgram.pipe(Effect.provide(baseLayers), Effect.provideService(Console.Console, silentConsole))));
|
|
17855
19641
|
if (baseOutput.didLintFail) return null;
|
|
@@ -17935,7 +19721,8 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
|
|
|
17935
19721
|
doctorVersion: VERSION,
|
|
17936
19722
|
runId: getRunId(),
|
|
17937
19723
|
resolveLocalGithubViewerPermission: !options.noScore,
|
|
17938
|
-
suppressScanSummary: options.suppressRendering
|
|
19724
|
+
suppressScanSummary: options.suppressRendering,
|
|
19725
|
+
supplyChainManifestChanged: options.supplyChainManifestChanged
|
|
17939
19726
|
}, { beforeLint: (projectInfo, lintIncludePaths) => Effect.gen(function* () {
|
|
17940
19727
|
recordSentryProjectContext(projectInfo, rootSentrySpan);
|
|
17941
19728
|
recordCount(METRIC.projectDetected, 1);
|
|
@@ -20656,13 +22443,28 @@ const coerceDiffValue = (value) => {
|
|
|
20656
22443
|
//#region src/cli/utils/resolve-effective-diff.ts
|
|
20657
22444
|
const resolveEffectiveDiff = (flags, userConfig) => coerceDiffValue(flags.diff ?? userConfig?.diff);
|
|
20658
22445
|
//#endregion
|
|
22446
|
+
//#region src/cli/utils/resolve-project-relative-directory.ts
|
|
22447
|
+
/**
|
|
22448
|
+
* The scanned project's directory relative to the diff root, forward-slashed —
|
|
22449
|
+
* or `null` when the project resolves outside the root (a `..` segment or an
|
|
22450
|
+
* absolute path, neither of which can be matched against repo-relative changed
|
|
22451
|
+
* files). An empty string means the project *is* the diff root. Shared by the
|
|
22452
|
+
* diff helpers that map changed files to a workspace (`resolveProjectDiffIncludePaths`,
|
|
22453
|
+
* `projectManifestChanged`) so the boundary rule lives in one place.
|
|
22454
|
+
*/
|
|
22455
|
+
const resolveProjectRelativeDirectory = (rootDirectory, projectDirectory) => {
|
|
22456
|
+
const relativeProjectDirectory = toForwardSlashes(path$1.relative(rootDirectory, projectDirectory));
|
|
22457
|
+
if (relativeProjectDirectory === ".." || relativeProjectDirectory.startsWith("../")) return null;
|
|
22458
|
+
if (path$1.isAbsolute(relativeProjectDirectory)) return null;
|
|
22459
|
+
return relativeProjectDirectory;
|
|
22460
|
+
};
|
|
22461
|
+
//#endregion
|
|
20659
22462
|
//#region src/cli/utils/resolve-project-diff-include-paths.ts
|
|
20660
22463
|
const resolveProjectDiffIncludePaths = (rootDirectory, projectDirectory, diffInfo) => {
|
|
22464
|
+
const relativeProjectDirectory = resolveProjectRelativeDirectory(rootDirectory, projectDirectory);
|
|
22465
|
+
if (relativeProjectDirectory === null) return [];
|
|
20661
22466
|
const changedSourceFiles = filterSourceFiles(diffInfo.changedFiles);
|
|
20662
|
-
const relativeProjectDirectory = toForwardSlashes(path$1.relative(rootDirectory, projectDirectory));
|
|
20663
22467
|
if (relativeProjectDirectory.length === 0) return changedSourceFiles;
|
|
20664
|
-
if (relativeProjectDirectory.startsWith("../") || relativeProjectDirectory === "..") return [];
|
|
20665
|
-
if (path$1.isAbsolute(relativeProjectDirectory)) return [];
|
|
20666
22468
|
const projectPrefix = `${relativeProjectDirectory}/`;
|
|
20667
22469
|
return changedSourceFiles.flatMap((filePath) => {
|
|
20668
22470
|
const normalizedFilePath = toForwardSlashes(filePath);
|
|
@@ -20835,6 +22637,63 @@ const runExplain = async (fileLineArgument, context) => {
|
|
|
20835
22637
|
}
|
|
20836
22638
|
};
|
|
20837
22639
|
//#endregion
|
|
22640
|
+
//#region src/cli/utils/project-manifest-changed.ts
|
|
22641
|
+
const PACKAGE_JSON = "package.json";
|
|
22642
|
+
/**
|
|
22643
|
+
* True when the scanned project's own `package.json` is among the diff's
|
|
22644
|
+
* changed files. Shares `resolveProjectRelativeDirectory`'s boundary handling
|
|
22645
|
+
* with `resolveProjectDiffIncludePaths` so a workspace package matches only
|
|
22646
|
+
* its own manifest (not the monorepo root's or a sibling's) — which is exactly
|
|
22647
|
+
* what that project's per-project supply-chain check scores.
|
|
22648
|
+
*/
|
|
22649
|
+
const projectManifestChanged = (rootDirectory, projectDirectory, diffInfo) => {
|
|
22650
|
+
const relativeProjectDirectory = resolveProjectRelativeDirectory(rootDirectory, projectDirectory);
|
|
22651
|
+
if (relativeProjectDirectory === null) return false;
|
|
22652
|
+
const manifestPath = relativeProjectDirectory.length === 0 ? PACKAGE_JSON : `${relativeProjectDirectory}/${PACKAGE_JSON}`;
|
|
22653
|
+
return diffInfo.changedFiles.some((filePath) => toForwardSlashes(filePath) === manifestPath);
|
|
22654
|
+
};
|
|
22655
|
+
//#endregion
|
|
22656
|
+
//#region src/cli/utils/render-supply-chain-scores.ts
|
|
22657
|
+
const scoreLabel = (score) => {
|
|
22658
|
+
if (score >= 75) return "Healthy";
|
|
22659
|
+
if (score >= 50) return "Review";
|
|
22660
|
+
return "At risk";
|
|
22661
|
+
};
|
|
22662
|
+
const byRiskThenName = (left, right) => {
|
|
22663
|
+
if (left.overall === null) return right.overall === null ? 0 : 1;
|
|
22664
|
+
if (right.overall === null) return -1;
|
|
22665
|
+
if (left.overall !== right.overall) return left.overall - right.overall;
|
|
22666
|
+
return left.name.localeCompare(right.name);
|
|
22667
|
+
};
|
|
22668
|
+
/**
|
|
22669
|
+
* Renders the `--sfw` demo table: every direct dependency with its Socket.dev
|
|
22670
|
+
* supply-chain score (0–100), color-coded and labelled. Pure string builder —
|
|
22671
|
+
* the command prints the result through `cliLogger`.
|
|
22672
|
+
*/
|
|
22673
|
+
const renderSupplyChainScores = (rows) => {
|
|
22674
|
+
if (rows.length === 0) return highlighter.dim(" No direct dependencies found in package.json.");
|
|
22675
|
+
const sorted = [...rows].sort(byRiskThenName);
|
|
22676
|
+
const nameWidth = Math.max(...sorted.map((row) => row.name.length));
|
|
22677
|
+
const versionWidth = Math.max(...sorted.map((row) => row.version.length));
|
|
22678
|
+
const lines = [
|
|
22679
|
+
highlighter.bold(" Socket supply-chain scores"),
|
|
22680
|
+
highlighter.dim(` ${rows.length} ${rows.length === 1 ? "dependency" : "dependencies"}`),
|
|
22681
|
+
""
|
|
22682
|
+
];
|
|
22683
|
+
for (const row of sorted) {
|
|
22684
|
+
const paddedName = row.name.padEnd(nameWidth);
|
|
22685
|
+
const paddedVersion = row.version.padEnd(versionWidth);
|
|
22686
|
+
if (row.overall === null) {
|
|
22687
|
+
lines.push(` ${highlighter.dim(paddedName)} ${highlighter.dim(paddedVersion)} ${highlighter.dim(" — no score")}`);
|
|
22688
|
+
continue;
|
|
22689
|
+
}
|
|
22690
|
+
const score = colorizeByScore(String(row.overall).padStart(3), row.overall);
|
|
22691
|
+
const label = colorizeByScore(scoreLabel(row.overall), row.overall);
|
|
22692
|
+
lines.push(` ${paddedName} ${highlighter.dim(paddedVersion)} ${score} ${label}`);
|
|
22693
|
+
}
|
|
22694
|
+
return lines.join("\n");
|
|
22695
|
+
};
|
|
22696
|
+
//#endregion
|
|
20838
22697
|
//#region src/cli/utils/warn-deprecated-fail-on.ts
|
|
20839
22698
|
const warnDeprecatedFailOn = (flags, userConfig) => {
|
|
20840
22699
|
const usedFlag = flags.failOn !== void 0;
|
|
@@ -20852,6 +22711,15 @@ const validateModeFlags = (flags) => {
|
|
|
20852
22711
|
if (exclusiveModes.length > 1) throw new CliInputError(`Cannot combine ${exclusiveModes.join(" and ")}; pick one mode.`);
|
|
20853
22712
|
if (flags.score && flags.json) throw new CliInputError("Cannot combine --score and --json; pick one output mode.");
|
|
20854
22713
|
if (flags.score && flags.telemetry === false) throw new CliInputError("Cannot combine --score with --no-telemetry; --score prints the score that --no-telemetry disables.");
|
|
22714
|
+
if (flags.sfw) {
|
|
22715
|
+
const conflictingFlag = [
|
|
22716
|
+
flags.json ? "--json" : null,
|
|
22717
|
+
flags.score ? "--score" : null,
|
|
22718
|
+
flags.staged ? "--staged" : null,
|
|
22719
|
+
coercedDiff !== void 0 && coercedDiff !== false ? "--diff" : null
|
|
22720
|
+
].find((name) => name !== null);
|
|
22721
|
+
if (conflictingFlag) throw new CliInputError(`Cannot combine --sfw with ${conflictingFlag}; --sfw is a standalone demo listing.`);
|
|
22722
|
+
}
|
|
20855
22723
|
};
|
|
20856
22724
|
//#endregion
|
|
20857
22725
|
//#region src/cli/commands/inspect.ts
|
|
@@ -20958,6 +22826,18 @@ const inspectAction = async (directory, flags) => {
|
|
|
20958
22826
|
});
|
|
20959
22827
|
return;
|
|
20960
22828
|
}
|
|
22829
|
+
if (flags.sfw) {
|
|
22830
|
+
const sfwSpinner = spinner("Scoring dependencies against Socket.dev…").start();
|
|
22831
|
+
const scores = await Effect.runPromise(collectSupplyChainScores({
|
|
22832
|
+
rootDirectory: resolvedDirectory,
|
|
22833
|
+
userConfig
|
|
22834
|
+
}));
|
|
22835
|
+
sfwSpinner.stop();
|
|
22836
|
+
cliLogger.break();
|
|
22837
|
+
cliLogger.log(renderSupplyChainScores(scores));
|
|
22838
|
+
cliLogger.break();
|
|
22839
|
+
return;
|
|
22840
|
+
}
|
|
20961
22841
|
if (!isQuiet) if (!flags.verbose && canAnimateOnboarding(process.stdout)) {
|
|
20962
22842
|
const isReturningUser = !isOnboardingForced() && hasCompletedOnboarding();
|
|
20963
22843
|
await Effect.runPromise(playWelcomeScene({ speedMultiplier: isReturningUser ? 2 : 1 }));
|
|
@@ -21052,18 +22932,22 @@ const inspectAction = async (directory, flags) => {
|
|
|
21052
22932
|
const allDiagnostics = [];
|
|
21053
22933
|
const completedScans = [];
|
|
21054
22934
|
const isMultiProject = projectDirectories.length > 1;
|
|
22935
|
+
const supplyChainEnabled = userConfig?.supplyChain?.enabled !== false;
|
|
21055
22936
|
for (const projectDirectory of projectDirectories) {
|
|
21056
22937
|
let includePaths;
|
|
22938
|
+
let supplyChainManifestChanged = false;
|
|
21057
22939
|
if (isDiffMode) {
|
|
21058
22940
|
const changedSourceFiles = diffInfo === null ? [] : resolveProjectDiffIncludePaths(resolvedDirectory, projectDirectory, diffInfo);
|
|
21059
|
-
|
|
22941
|
+
supplyChainManifestChanged = supplyChainEnabled && diffInfo !== null && projectManifestChanged(resolvedDirectory, projectDirectory, diffInfo);
|
|
22942
|
+
if (changedSourceFiles.length === 0 && !supplyChainManifestChanged) {
|
|
21060
22943
|
if (!isQuiet) {
|
|
21061
22944
|
cliLogger.dim(`No changed source files in ${projectDirectory}, skipping.`);
|
|
21062
22945
|
cliLogger.break();
|
|
21063
22946
|
}
|
|
21064
22947
|
continue;
|
|
21065
22948
|
}
|
|
21066
|
-
includePaths = changedSourceFiles;
|
|
22949
|
+
includePaths = [...changedSourceFiles];
|
|
22950
|
+
if (supplyChainManifestChanged) includePaths.push("package.json");
|
|
21067
22951
|
}
|
|
21068
22952
|
if (!isQuiet && !isMultiProject) cliLogger.dim(" ");
|
|
21069
22953
|
const scanResult = await inspect(projectDirectory, {
|
|
@@ -21071,7 +22955,8 @@ const inspectAction = async (directory, flags) => {
|
|
|
21071
22955
|
includePaths,
|
|
21072
22956
|
configOverride: userConfig,
|
|
21073
22957
|
suppressRendering: isMultiProject,
|
|
21074
|
-
baseline: baselineRef ? { ref: baselineRef } : void 0
|
|
22958
|
+
baseline: baselineRef ? { ref: baselineRef } : void 0,
|
|
22959
|
+
supplyChainManifestChanged
|
|
21075
22960
|
});
|
|
21076
22961
|
allDiagnostics.push(...scanResult.diagnostics);
|
|
21077
22962
|
completedScans.push({
|
|
@@ -21895,6 +23780,7 @@ const ROOT_FLAG_SPEC = {
|
|
|
21895
23780
|
"--no-telemetry",
|
|
21896
23781
|
"--no-warnings",
|
|
21897
23782
|
"--score",
|
|
23783
|
+
"--sfw",
|
|
21898
23784
|
"--staged",
|
|
21899
23785
|
"--verbose",
|
|
21900
23786
|
"--version",
|
|
@@ -22089,7 +23975,7 @@ ${highlighter.dim("Learn more:")}
|
|
|
22089
23975
|
${highlighter.info(CANONICAL_GITHUB_URL)}
|
|
22090
23976
|
`;
|
|
22091
23977
|
const collectCategoryOption = (value, previousValues) => [...previousValues ?? [], value];
|
|
22092
|
-
const program = new Command().name("react-doctor").description("Diagnose React codebase health").version(VERSION, "-v, --version", "display the version number").argument("[directory]", "project directory to scan", ".").option("--lint", "enable linting").option("--no-lint", "skip linting").option("--dead-code", "enable dead-code analysis (default)").option("--no-dead-code", "skip dead-code analysis (unused files / exports / dependencies, circular imports)").option("--verbose", "show every rule and per-file details (default shows top 3 rules)").option("--score", "output only the score").option("--json", "output a single structured JSON report (suppresses other output)").option("--json-compact", "with --json, emit compact JSON (no indentation)").option("-y, --yes", "skip prompts, scan all workspace projects").option("--no-parallel", "lint serially with one worker (default: parallel across CPU cores; set the worker count with REACT_DOCTOR_PARALLEL)").option("--project <name>", "select workspace project (comma-separated for multiple)").option("--diff [base]", "scan only files changed vs base branch (pass `false` to force a full scan, overriding config)").addOption(new Option$1("--changed-files-from <file>", "scan source files listed in a newline-delimited changed-files file").hideHelp()).option("--no-score", "skip the score API, the share URL, and crash reporting").addOption(new Option$1("--category <category>", "only show diagnostics in a category (repeatable; e.g. Security)").argParser(collectCategoryOption)).option("--no-telemetry", "alias for --no-score (skip the score API, share URL, and crash reporting)").option("--staged", "scan only staged (git index) files for pre-commit hooks").option("--blocking <level>", "severity that fails CI: error (default), warning, or none (advisory)").addOption(new Option$1("--fail-on <level>", "[deprecated] alias for --blocking <level>").hideHelp()).option("--no-respect-inline-disables", "audit mode: neutralize inline lint suppressions before scanning").option("--warnings", "show warning-severity diagnostics (default)").option("--no-warnings", "hide warning-severity diagnostics (errors only)").option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").addHelpText("after", renderRootHelpEpilog);
|
|
23978
|
+
const program = new Command().name("react-doctor").description("Diagnose React codebase health").version(VERSION, "-v, --version", "display the version number").argument("[directory]", "project directory to scan", ".").option("--lint", "enable linting").option("--no-lint", "skip linting").option("--dead-code", "enable dead-code analysis (default)").option("--no-dead-code", "skip dead-code analysis (unused files / exports / dependencies, circular imports)").option("--verbose", "show every rule and per-file details (default shows top 3 rules)").option("--score", "output only the score").option("--json", "output a single structured JSON report (suppresses other output)").option("--json-compact", "with --json, emit compact JSON (no indentation)").option("-y, --yes", "skip prompts, scan all workspace projects").option("--no-parallel", "lint serially with one worker (default: parallel across CPU cores; set the worker count with REACT_DOCTOR_PARALLEL)").option("--project <name>", "select workspace project (comma-separated for multiple)").option("--diff [base]", "scan only files changed vs base branch (pass `false` to force a full scan, overriding config)").addOption(new Option$1("--changed-files-from <file>", "scan source files listed in a newline-delimited changed-files file").hideHelp()).option("--no-score", "skip the score API, the share URL, and crash reporting").addOption(new Option$1("--category <category>", "only show diagnostics in a category (repeatable; e.g. Security)").argParser(collectCategoryOption)).option("--no-telemetry", "alias for --no-score (skip the score API, share URL, and crash reporting)").option("--staged", "scan only staged (git index) files for pre-commit hooks").option("--blocking <level>", "severity that fails CI: error (default), warning, or none (advisory)").addOption(new Option$1("--fail-on <level>", "[deprecated] alias for --blocking <level>").hideHelp()).option("--no-respect-inline-disables", "audit mode: neutralize inline lint suppressions before scanning").option("--warnings", "show warning-severity diagnostics (default)").option("--no-warnings", "hide warning-severity diagnostics (errors only)").option("--sfw", "demo: print the Socket.dev supply-chain score of every direct dependency, then exit").option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").addHelpText("after", renderRootHelpEpilog);
|
|
22093
23979
|
program.action(inspectAction);
|
|
22094
23980
|
program.command("why <location>").description("Explain why a rule fired (or why a suppression didn't apply) at a file:line").option("--project <name>", "select workspace project (comma-separated for multiple)").option("-c, --cwd <cwd>", "working directory", process.cwd()).option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").action((location, options) => whyAction(location, options));
|
|
22095
23981
|
program.command("install").alias("setup").description("Install the react-doctor skill into your coding agents and optional git hook").option("-y, --yes", "skip prompts, install for all detected agents").option("--dry-run", "show what would be installed without writing files").option("--agent-hooks", "install native non-blocking agent hooks for Claude Code and Cursor").option("-c, --cwd <cwd>", "working directory", process.cwd()).option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").addHelpText("after", renderInstallHelpEpilog).action(installAction);
|
|
@@ -22132,4 +24018,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
22132
24018
|
export {};
|
|
22133
24019
|
|
|
22134
24020
|
//# sourceMappingURL=cli.js.map
|
|
22135
|
-
//# debugId=
|
|
24021
|
+
//# debugId=b818de08-3056-5722-a734-180e56f0923b
|