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/index.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]="50a9af23-7f4c-50ee-ab12-d23a4915d902")}catch(e){}}();
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import * as Schema from "effect/Schema";
|
|
5
5
|
import * as fs$1 from "node:fs";
|
|
@@ -179,7 +179,7 @@ var JsonReportV2 = class extends Schema.Class("JsonReportV2")({
|
|
|
179
179
|
Schema.Union([JsonReportV1, JsonReportV2]);
|
|
180
180
|
//#endregion
|
|
181
181
|
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js
|
|
182
|
-
var require_constants = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
182
|
+
var require_constants$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
183
183
|
const WIN_SLASH = "\\\\/";
|
|
184
184
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
185
185
|
const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
|
|
@@ -349,7 +349,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
349
349
|
//#endregion
|
|
350
350
|
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js
|
|
351
351
|
var require_utils = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
352
|
-
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
|
|
352
|
+
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants$1();
|
|
353
353
|
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
354
354
|
exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
|
|
355
355
|
exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
|
|
@@ -398,7 +398,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
398
398
|
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js
|
|
399
399
|
var require_scan = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
400
400
|
const utils = require_utils();
|
|
401
|
-
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();
|
|
401
|
+
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();
|
|
402
402
|
const isPathSeparator = (code) => {
|
|
403
403
|
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
404
404
|
};
|
|
@@ -683,8 +683,8 @@ var require_scan = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
683
683
|
}));
|
|
684
684
|
//#endregion
|
|
685
685
|
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js
|
|
686
|
-
var require_parse = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
687
|
-
const constants = require_constants();
|
|
686
|
+
var require_parse$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
687
|
+
const constants = require_constants$1();
|
|
688
688
|
const utils = require_utils();
|
|
689
689
|
/**
|
|
690
690
|
* Constants
|
|
@@ -1740,9 +1740,9 @@ var require_parse = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
1740
1740
|
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js
|
|
1741
1741
|
var require_picomatch$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
1742
1742
|
const scan = require_scan();
|
|
1743
|
-
const parse = require_parse();
|
|
1743
|
+
const parse = require_parse$1();
|
|
1744
1744
|
const utils = require_utils();
|
|
1745
|
-
const constants = require_constants();
|
|
1745
|
+
const constants = require_constants$1();
|
|
1746
1746
|
const isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
1747
1747
|
/**
|
|
1748
1748
|
* Creates a matcher function from one or more glob patterns. The
|
|
@@ -2037,8 +2037,8 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
|
|
|
2037
2037
|
module.exports = picomatch;
|
|
2038
2038
|
}));
|
|
2039
2039
|
//#endregion
|
|
2040
|
-
//#region
|
|
2041
|
-
var
|
|
2040
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js
|
|
2041
|
+
var require_picomatch = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2042
2042
|
const pico = require_picomatch$1();
|
|
2043
2043
|
const utils = require_utils();
|
|
2044
2044
|
function picomatch(glob, options, returnState = false) {
|
|
@@ -2050,7 +2050,1349 @@ var import_picomatch = /* @__PURE__ */ __toESM$1((/* @__PURE__ */ __commonJSMin$
|
|
|
2050
2050
|
}
|
|
2051
2051
|
Object.assign(picomatch, pico);
|
|
2052
2052
|
module.exports = picomatch;
|
|
2053
|
-
}))
|
|
2053
|
+
}));
|
|
2054
|
+
//#endregion
|
|
2055
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/constants.js
|
|
2056
|
+
var require_constants = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2057
|
+
const SEMVER_SPEC_VERSION = "2.0.0";
|
|
2058
|
+
const MAX_LENGTH = 256;
|
|
2059
|
+
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
|
|
2060
|
+
module.exports = {
|
|
2061
|
+
MAX_LENGTH,
|
|
2062
|
+
MAX_SAFE_COMPONENT_LENGTH: 16,
|
|
2063
|
+
MAX_SAFE_BUILD_LENGTH: MAX_LENGTH - 6,
|
|
2064
|
+
MAX_SAFE_INTEGER,
|
|
2065
|
+
RELEASE_TYPES: [
|
|
2066
|
+
"major",
|
|
2067
|
+
"premajor",
|
|
2068
|
+
"minor",
|
|
2069
|
+
"preminor",
|
|
2070
|
+
"patch",
|
|
2071
|
+
"prepatch",
|
|
2072
|
+
"prerelease"
|
|
2073
|
+
],
|
|
2074
|
+
SEMVER_SPEC_VERSION,
|
|
2075
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
2076
|
+
FLAG_LOOSE: 2
|
|
2077
|
+
};
|
|
2078
|
+
}));
|
|
2079
|
+
//#endregion
|
|
2080
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/debug.js
|
|
2081
|
+
var require_debug = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2082
|
+
module.exports = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
|
|
2083
|
+
}));
|
|
2084
|
+
//#endregion
|
|
2085
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/re.js
|
|
2086
|
+
var require_re = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2087
|
+
const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = require_constants();
|
|
2088
|
+
const debug = require_debug();
|
|
2089
|
+
exports = module.exports = {};
|
|
2090
|
+
const re = exports.re = [];
|
|
2091
|
+
const safeRe = exports.safeRe = [];
|
|
2092
|
+
const src = exports.src = [];
|
|
2093
|
+
const safeSrc = exports.safeSrc = [];
|
|
2094
|
+
const t = exports.t = {};
|
|
2095
|
+
let R = 0;
|
|
2096
|
+
const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
2097
|
+
const safeRegexReplacements = [
|
|
2098
|
+
["\\s", 1],
|
|
2099
|
+
["\\d", MAX_LENGTH],
|
|
2100
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
2101
|
+
];
|
|
2102
|
+
const makeSafeRegex = (value) => {
|
|
2103
|
+
for (const [token, max] of safeRegexReplacements) value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
2104
|
+
return value;
|
|
2105
|
+
};
|
|
2106
|
+
const createToken = (name, value, isGlobal) => {
|
|
2107
|
+
const safe = makeSafeRegex(value);
|
|
2108
|
+
const index = R++;
|
|
2109
|
+
debug(name, index, value);
|
|
2110
|
+
t[name] = index;
|
|
2111
|
+
src[index] = value;
|
|
2112
|
+
safeSrc[index] = safe;
|
|
2113
|
+
re[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
|
2114
|
+
safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
|
|
2115
|
+
};
|
|
2116
|
+
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
2117
|
+
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
2118
|
+
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
2119
|
+
createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
|
|
2120
|
+
createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
2121
|
+
createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
|
|
2122
|
+
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
2123
|
+
createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
|
2124
|
+
createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
2125
|
+
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
2126
|
+
createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
|
2127
|
+
createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
|
|
2128
|
+
createToken("FULL", `^${src[t.FULLPLAIN]}$`);
|
|
2129
|
+
createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
|
|
2130
|
+
createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
|
|
2131
|
+
createToken("GTLT", "((?:<|>)?=?)");
|
|
2132
|
+
createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
2133
|
+
createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
2134
|
+
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
|
|
2135
|
+
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
|
|
2136
|
+
createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
|
2137
|
+
createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
|
2138
|
+
createToken("COERCEPLAIN", `(^|[^\\d])(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
2139
|
+
createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
2140
|
+
createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
|
|
2141
|
+
createToken("COERCERTL", src[t.COERCE], true);
|
|
2142
|
+
createToken("COERCERTLFULL", src[t.COERCEFULL], true);
|
|
2143
|
+
createToken("LONETILDE", "(?:~>?)");
|
|
2144
|
+
createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
2145
|
+
exports.tildeTrimReplace = "$1~";
|
|
2146
|
+
createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
2147
|
+
createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
2148
|
+
createToken("LONECARET", "(?:\\^)");
|
|
2149
|
+
createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
2150
|
+
exports.caretTrimReplace = "$1^";
|
|
2151
|
+
createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
2152
|
+
createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
2153
|
+
createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
|
2154
|
+
createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
|
2155
|
+
createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
2156
|
+
exports.comparatorTrimReplace = "$1$2$3";
|
|
2157
|
+
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
|
|
2158
|
+
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
|
|
2159
|
+
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
2160
|
+
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
2161
|
+
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
2162
|
+
}));
|
|
2163
|
+
//#endregion
|
|
2164
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/parse-options.js
|
|
2165
|
+
var require_parse_options = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2166
|
+
const looseOption = Object.freeze({ loose: true });
|
|
2167
|
+
const emptyOpts = Object.freeze({});
|
|
2168
|
+
const parseOptions = (options) => {
|
|
2169
|
+
if (!options) return emptyOpts;
|
|
2170
|
+
if (typeof options !== "object") return looseOption;
|
|
2171
|
+
return options;
|
|
2172
|
+
};
|
|
2173
|
+
module.exports = parseOptions;
|
|
2174
|
+
}));
|
|
2175
|
+
//#endregion
|
|
2176
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/identifiers.js
|
|
2177
|
+
var require_identifiers = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2178
|
+
const numeric = /^[0-9]+$/;
|
|
2179
|
+
const compareIdentifiers = (a, b) => {
|
|
2180
|
+
if (typeof a === "number" && typeof b === "number") return a === b ? 0 : a < b ? -1 : 1;
|
|
2181
|
+
const anum = numeric.test(a);
|
|
2182
|
+
const bnum = numeric.test(b);
|
|
2183
|
+
if (anum && bnum) {
|
|
2184
|
+
a = +a;
|
|
2185
|
+
b = +b;
|
|
2186
|
+
}
|
|
2187
|
+
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
2188
|
+
};
|
|
2189
|
+
const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
|
|
2190
|
+
module.exports = {
|
|
2191
|
+
compareIdentifiers,
|
|
2192
|
+
rcompareIdentifiers
|
|
2193
|
+
};
|
|
2194
|
+
}));
|
|
2195
|
+
//#endregion
|
|
2196
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/semver.js
|
|
2197
|
+
var require_semver$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2198
|
+
const debug = require_debug();
|
|
2199
|
+
const { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
2200
|
+
const { safeRe: re, t } = require_re();
|
|
2201
|
+
const parseOptions = require_parse_options();
|
|
2202
|
+
const { compareIdentifiers } = require_identifiers();
|
|
2203
|
+
module.exports = class SemVer {
|
|
2204
|
+
constructor(version, options) {
|
|
2205
|
+
options = parseOptions(options);
|
|
2206
|
+
if (version instanceof SemVer) if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
|
|
2207
|
+
else version = version.version;
|
|
2208
|
+
else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
2209
|
+
if (version.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
|
|
2210
|
+
debug("SemVer", version, options);
|
|
2211
|
+
this.options = options;
|
|
2212
|
+
this.loose = !!options.loose;
|
|
2213
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
2214
|
+
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
2215
|
+
if (!m) throw new TypeError(`Invalid Version: ${version}`);
|
|
2216
|
+
this.raw = version;
|
|
2217
|
+
this.major = +m[1];
|
|
2218
|
+
this.minor = +m[2];
|
|
2219
|
+
this.patch = +m[3];
|
|
2220
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) throw new TypeError("Invalid major version");
|
|
2221
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) throw new TypeError("Invalid minor version");
|
|
2222
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) throw new TypeError("Invalid patch version");
|
|
2223
|
+
if (!m[4]) this.prerelease = [];
|
|
2224
|
+
else this.prerelease = m[4].split(".").map((id) => {
|
|
2225
|
+
if (/^[0-9]+$/.test(id)) {
|
|
2226
|
+
const num = +id;
|
|
2227
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) return num;
|
|
2228
|
+
}
|
|
2229
|
+
return id;
|
|
2230
|
+
});
|
|
2231
|
+
this.build = m[5] ? m[5].split(".") : [];
|
|
2232
|
+
this.format();
|
|
2233
|
+
}
|
|
2234
|
+
format() {
|
|
2235
|
+
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
2236
|
+
if (this.prerelease.length) this.version += `-${this.prerelease.join(".")}`;
|
|
2237
|
+
return this.version;
|
|
2238
|
+
}
|
|
2239
|
+
toString() {
|
|
2240
|
+
return this.version;
|
|
2241
|
+
}
|
|
2242
|
+
compare(other) {
|
|
2243
|
+
debug("SemVer.compare", this.version, this.options, other);
|
|
2244
|
+
if (!(other instanceof SemVer)) {
|
|
2245
|
+
if (typeof other === "string" && other === this.version) return 0;
|
|
2246
|
+
other = new SemVer(other, this.options);
|
|
2247
|
+
}
|
|
2248
|
+
if (other.version === this.version) return 0;
|
|
2249
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
2250
|
+
}
|
|
2251
|
+
compareMain(other) {
|
|
2252
|
+
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
2253
|
+
if (this.major < other.major) return -1;
|
|
2254
|
+
if (this.major > other.major) return 1;
|
|
2255
|
+
if (this.minor < other.minor) return -1;
|
|
2256
|
+
if (this.minor > other.minor) return 1;
|
|
2257
|
+
if (this.patch < other.patch) return -1;
|
|
2258
|
+
if (this.patch > other.patch) return 1;
|
|
2259
|
+
return 0;
|
|
2260
|
+
}
|
|
2261
|
+
comparePre(other) {
|
|
2262
|
+
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
2263
|
+
if (this.prerelease.length && !other.prerelease.length) return -1;
|
|
2264
|
+
else if (!this.prerelease.length && other.prerelease.length) return 1;
|
|
2265
|
+
else if (!this.prerelease.length && !other.prerelease.length) return 0;
|
|
2266
|
+
let i = 0;
|
|
2267
|
+
do {
|
|
2268
|
+
const a = this.prerelease[i];
|
|
2269
|
+
const b = other.prerelease[i];
|
|
2270
|
+
debug("prerelease compare", i, a, b);
|
|
2271
|
+
if (a === void 0 && b === void 0) return 0;
|
|
2272
|
+
else if (b === void 0) return 1;
|
|
2273
|
+
else if (a === void 0) return -1;
|
|
2274
|
+
else if (a === b) continue;
|
|
2275
|
+
else return compareIdentifiers(a, b);
|
|
2276
|
+
} while (++i);
|
|
2277
|
+
}
|
|
2278
|
+
compareBuild(other) {
|
|
2279
|
+
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
2280
|
+
let i = 0;
|
|
2281
|
+
do {
|
|
2282
|
+
const a = this.build[i];
|
|
2283
|
+
const b = other.build[i];
|
|
2284
|
+
debug("build compare", i, a, b);
|
|
2285
|
+
if (a === void 0 && b === void 0) return 0;
|
|
2286
|
+
else if (b === void 0) return 1;
|
|
2287
|
+
else if (a === void 0) return -1;
|
|
2288
|
+
else if (a === b) continue;
|
|
2289
|
+
else return compareIdentifiers(a, b);
|
|
2290
|
+
} while (++i);
|
|
2291
|
+
}
|
|
2292
|
+
inc(release, identifier, identifierBase) {
|
|
2293
|
+
if (release.startsWith("pre")) {
|
|
2294
|
+
if (!identifier && identifierBase === false) throw new Error("invalid increment argument: identifier is empty");
|
|
2295
|
+
if (identifier) {
|
|
2296
|
+
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
|
|
2297
|
+
if (!match || match[1] !== identifier) throw new Error(`invalid identifier: ${identifier}`);
|
|
2298
|
+
}
|
|
2299
|
+
}
|
|
2300
|
+
switch (release) {
|
|
2301
|
+
case "premajor":
|
|
2302
|
+
this.prerelease.length = 0;
|
|
2303
|
+
this.patch = 0;
|
|
2304
|
+
this.minor = 0;
|
|
2305
|
+
this.major++;
|
|
2306
|
+
this.inc("pre", identifier, identifierBase);
|
|
2307
|
+
break;
|
|
2308
|
+
case "preminor":
|
|
2309
|
+
this.prerelease.length = 0;
|
|
2310
|
+
this.patch = 0;
|
|
2311
|
+
this.minor++;
|
|
2312
|
+
this.inc("pre", identifier, identifierBase);
|
|
2313
|
+
break;
|
|
2314
|
+
case "prepatch":
|
|
2315
|
+
this.prerelease.length = 0;
|
|
2316
|
+
this.inc("patch", identifier, identifierBase);
|
|
2317
|
+
this.inc("pre", identifier, identifierBase);
|
|
2318
|
+
break;
|
|
2319
|
+
case "prerelease":
|
|
2320
|
+
if (this.prerelease.length === 0) this.inc("patch", identifier, identifierBase);
|
|
2321
|
+
this.inc("pre", identifier, identifierBase);
|
|
2322
|
+
break;
|
|
2323
|
+
case "release":
|
|
2324
|
+
if (this.prerelease.length === 0) throw new Error(`version ${this.raw} is not a prerelease`);
|
|
2325
|
+
this.prerelease.length = 0;
|
|
2326
|
+
break;
|
|
2327
|
+
case "major":
|
|
2328
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) this.major++;
|
|
2329
|
+
this.minor = 0;
|
|
2330
|
+
this.patch = 0;
|
|
2331
|
+
this.prerelease = [];
|
|
2332
|
+
break;
|
|
2333
|
+
case "minor":
|
|
2334
|
+
if (this.patch !== 0 || this.prerelease.length === 0) this.minor++;
|
|
2335
|
+
this.patch = 0;
|
|
2336
|
+
this.prerelease = [];
|
|
2337
|
+
break;
|
|
2338
|
+
case "patch":
|
|
2339
|
+
if (this.prerelease.length === 0) this.patch++;
|
|
2340
|
+
this.prerelease = [];
|
|
2341
|
+
break;
|
|
2342
|
+
case "pre": {
|
|
2343
|
+
const base = Number(identifierBase) ? 1 : 0;
|
|
2344
|
+
if (this.prerelease.length === 0) this.prerelease = [base];
|
|
2345
|
+
else {
|
|
2346
|
+
let i = this.prerelease.length;
|
|
2347
|
+
while (--i >= 0) if (typeof this.prerelease[i] === "number") {
|
|
2348
|
+
this.prerelease[i]++;
|
|
2349
|
+
i = -2;
|
|
2350
|
+
}
|
|
2351
|
+
if (i === -1) {
|
|
2352
|
+
if (identifier === this.prerelease.join(".") && identifierBase === false) throw new Error("invalid increment argument: identifier already exists");
|
|
2353
|
+
this.prerelease.push(base);
|
|
2354
|
+
}
|
|
2355
|
+
}
|
|
2356
|
+
if (identifier) {
|
|
2357
|
+
let prerelease = [identifier, base];
|
|
2358
|
+
if (identifierBase === false) prerelease = [identifier];
|
|
2359
|
+
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
|
2360
|
+
if (isNaN(this.prerelease[1])) this.prerelease = prerelease;
|
|
2361
|
+
} else this.prerelease = prerelease;
|
|
2362
|
+
}
|
|
2363
|
+
break;
|
|
2364
|
+
}
|
|
2365
|
+
default: throw new Error(`invalid increment argument: ${release}`);
|
|
2366
|
+
}
|
|
2367
|
+
this.raw = this.format();
|
|
2368
|
+
if (this.build.length) this.raw += `+${this.build.join(".")}`;
|
|
2369
|
+
return this;
|
|
2370
|
+
}
|
|
2371
|
+
};
|
|
2372
|
+
}));
|
|
2373
|
+
//#endregion
|
|
2374
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/parse.js
|
|
2375
|
+
var require_parse = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2376
|
+
const SemVer = require_semver$1();
|
|
2377
|
+
const parse = (version, options, throwErrors = false) => {
|
|
2378
|
+
if (version instanceof SemVer) return version;
|
|
2379
|
+
try {
|
|
2380
|
+
return new SemVer(version, options);
|
|
2381
|
+
} catch (er) {
|
|
2382
|
+
if (!throwErrors) return null;
|
|
2383
|
+
throw er;
|
|
2384
|
+
}
|
|
2385
|
+
};
|
|
2386
|
+
module.exports = parse;
|
|
2387
|
+
}));
|
|
2388
|
+
//#endregion
|
|
2389
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/valid.js
|
|
2390
|
+
var require_valid$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2391
|
+
const parse = require_parse();
|
|
2392
|
+
const valid = (version, options) => {
|
|
2393
|
+
const v = parse(version, options);
|
|
2394
|
+
return v ? v.version : null;
|
|
2395
|
+
};
|
|
2396
|
+
module.exports = valid;
|
|
2397
|
+
}));
|
|
2398
|
+
//#endregion
|
|
2399
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/clean.js
|
|
2400
|
+
var require_clean = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2401
|
+
const parse = require_parse();
|
|
2402
|
+
const clean = (version, options) => {
|
|
2403
|
+
const s = parse(version.trim().replace(/^[=v]+/, ""), options);
|
|
2404
|
+
return s ? s.version : null;
|
|
2405
|
+
};
|
|
2406
|
+
module.exports = clean;
|
|
2407
|
+
}));
|
|
2408
|
+
//#endregion
|
|
2409
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/inc.js
|
|
2410
|
+
var require_inc = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2411
|
+
const SemVer = require_semver$1();
|
|
2412
|
+
const inc = (version, release, options, identifier, identifierBase) => {
|
|
2413
|
+
if (typeof options === "string") {
|
|
2414
|
+
identifierBase = identifier;
|
|
2415
|
+
identifier = options;
|
|
2416
|
+
options = void 0;
|
|
2417
|
+
}
|
|
2418
|
+
try {
|
|
2419
|
+
return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier, identifierBase).version;
|
|
2420
|
+
} catch (er) {
|
|
2421
|
+
return null;
|
|
2422
|
+
}
|
|
2423
|
+
};
|
|
2424
|
+
module.exports = inc;
|
|
2425
|
+
}));
|
|
2426
|
+
//#endregion
|
|
2427
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/diff.js
|
|
2428
|
+
var require_diff = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2429
|
+
const parse = require_parse();
|
|
2430
|
+
const diff = (version1, version2) => {
|
|
2431
|
+
const v1 = parse(version1, null, true);
|
|
2432
|
+
const v2 = parse(version2, null, true);
|
|
2433
|
+
const comparison = v1.compare(v2);
|
|
2434
|
+
if (comparison === 0) return null;
|
|
2435
|
+
const v1Higher = comparison > 0;
|
|
2436
|
+
const highVersion = v1Higher ? v1 : v2;
|
|
2437
|
+
const lowVersion = v1Higher ? v2 : v1;
|
|
2438
|
+
const highHasPre = !!highVersion.prerelease.length;
|
|
2439
|
+
if (!!lowVersion.prerelease.length && !highHasPre) {
|
|
2440
|
+
if (!lowVersion.patch && !lowVersion.minor) return "major";
|
|
2441
|
+
if (lowVersion.compareMain(highVersion) === 0) {
|
|
2442
|
+
if (lowVersion.minor && !lowVersion.patch) return "minor";
|
|
2443
|
+
return "patch";
|
|
2444
|
+
}
|
|
2445
|
+
}
|
|
2446
|
+
const prefix = highHasPre ? "pre" : "";
|
|
2447
|
+
if (v1.major !== v2.major) return prefix + "major";
|
|
2448
|
+
if (v1.minor !== v2.minor) return prefix + "minor";
|
|
2449
|
+
if (v1.patch !== v2.patch) return prefix + "patch";
|
|
2450
|
+
return "prerelease";
|
|
2451
|
+
};
|
|
2452
|
+
module.exports = diff;
|
|
2453
|
+
}));
|
|
2454
|
+
//#endregion
|
|
2455
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/major.js
|
|
2456
|
+
var require_major = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2457
|
+
const SemVer = require_semver$1();
|
|
2458
|
+
const major = (a, loose) => new SemVer(a, loose).major;
|
|
2459
|
+
module.exports = major;
|
|
2460
|
+
}));
|
|
2461
|
+
//#endregion
|
|
2462
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/minor.js
|
|
2463
|
+
var require_minor = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2464
|
+
const SemVer = require_semver$1();
|
|
2465
|
+
const minor = (a, loose) => new SemVer(a, loose).minor;
|
|
2466
|
+
module.exports = minor;
|
|
2467
|
+
}));
|
|
2468
|
+
//#endregion
|
|
2469
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/patch.js
|
|
2470
|
+
var require_patch = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2471
|
+
const SemVer = require_semver$1();
|
|
2472
|
+
const patch = (a, loose) => new SemVer(a, loose).patch;
|
|
2473
|
+
module.exports = patch;
|
|
2474
|
+
}));
|
|
2475
|
+
//#endregion
|
|
2476
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/prerelease.js
|
|
2477
|
+
var require_prerelease = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2478
|
+
const parse = require_parse();
|
|
2479
|
+
const prerelease = (version, options) => {
|
|
2480
|
+
const parsed = parse(version, options);
|
|
2481
|
+
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
2482
|
+
};
|
|
2483
|
+
module.exports = prerelease;
|
|
2484
|
+
}));
|
|
2485
|
+
//#endregion
|
|
2486
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare.js
|
|
2487
|
+
var require_compare = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2488
|
+
const SemVer = require_semver$1();
|
|
2489
|
+
const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
2490
|
+
module.exports = compare;
|
|
2491
|
+
}));
|
|
2492
|
+
//#endregion
|
|
2493
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rcompare.js
|
|
2494
|
+
var require_rcompare = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2495
|
+
const compare = require_compare();
|
|
2496
|
+
const rcompare = (a, b, loose) => compare(b, a, loose);
|
|
2497
|
+
module.exports = rcompare;
|
|
2498
|
+
}));
|
|
2499
|
+
//#endregion
|
|
2500
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-loose.js
|
|
2501
|
+
var require_compare_loose = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2502
|
+
const compare = require_compare();
|
|
2503
|
+
const compareLoose = (a, b) => compare(a, b, true);
|
|
2504
|
+
module.exports = compareLoose;
|
|
2505
|
+
}));
|
|
2506
|
+
//#endregion
|
|
2507
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-build.js
|
|
2508
|
+
var require_compare_build = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2509
|
+
const SemVer = require_semver$1();
|
|
2510
|
+
const compareBuild = (a, b, loose) => {
|
|
2511
|
+
const versionA = new SemVer(a, loose);
|
|
2512
|
+
const versionB = new SemVer(b, loose);
|
|
2513
|
+
return versionA.compare(versionB) || versionA.compareBuild(versionB);
|
|
2514
|
+
};
|
|
2515
|
+
module.exports = compareBuild;
|
|
2516
|
+
}));
|
|
2517
|
+
//#endregion
|
|
2518
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/sort.js
|
|
2519
|
+
var require_sort = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2520
|
+
const compareBuild = require_compare_build();
|
|
2521
|
+
const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
|
|
2522
|
+
module.exports = sort;
|
|
2523
|
+
}));
|
|
2524
|
+
//#endregion
|
|
2525
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rsort.js
|
|
2526
|
+
var require_rsort = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2527
|
+
const compareBuild = require_compare_build();
|
|
2528
|
+
const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
|
|
2529
|
+
module.exports = rsort;
|
|
2530
|
+
}));
|
|
2531
|
+
//#endregion
|
|
2532
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gt.js
|
|
2533
|
+
var require_gt = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2534
|
+
const compare = require_compare();
|
|
2535
|
+
const gt = (a, b, loose) => compare(a, b, loose) > 0;
|
|
2536
|
+
module.exports = gt;
|
|
2537
|
+
}));
|
|
2538
|
+
//#endregion
|
|
2539
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lt.js
|
|
2540
|
+
var require_lt = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2541
|
+
const compare = require_compare();
|
|
2542
|
+
const lt = (a, b, loose) => compare(a, b, loose) < 0;
|
|
2543
|
+
module.exports = lt;
|
|
2544
|
+
}));
|
|
2545
|
+
//#endregion
|
|
2546
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/eq.js
|
|
2547
|
+
var require_eq = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2548
|
+
const compare = require_compare();
|
|
2549
|
+
const eq = (a, b, loose) => compare(a, b, loose) === 0;
|
|
2550
|
+
module.exports = eq;
|
|
2551
|
+
}));
|
|
2552
|
+
//#endregion
|
|
2553
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/neq.js
|
|
2554
|
+
var require_neq = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2555
|
+
const compare = require_compare();
|
|
2556
|
+
const neq = (a, b, loose) => compare(a, b, loose) !== 0;
|
|
2557
|
+
module.exports = neq;
|
|
2558
|
+
}));
|
|
2559
|
+
//#endregion
|
|
2560
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gte.js
|
|
2561
|
+
var require_gte = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2562
|
+
const compare = require_compare();
|
|
2563
|
+
const gte = (a, b, loose) => compare(a, b, loose) >= 0;
|
|
2564
|
+
module.exports = gte;
|
|
2565
|
+
}));
|
|
2566
|
+
//#endregion
|
|
2567
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lte.js
|
|
2568
|
+
var require_lte = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2569
|
+
const compare = require_compare();
|
|
2570
|
+
const lte = (a, b, loose) => compare(a, b, loose) <= 0;
|
|
2571
|
+
module.exports = lte;
|
|
2572
|
+
}));
|
|
2573
|
+
//#endregion
|
|
2574
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/cmp.js
|
|
2575
|
+
var require_cmp = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2576
|
+
const eq = require_eq();
|
|
2577
|
+
const neq = require_neq();
|
|
2578
|
+
const gt = require_gt();
|
|
2579
|
+
const gte = require_gte();
|
|
2580
|
+
const lt = require_lt();
|
|
2581
|
+
const lte = require_lte();
|
|
2582
|
+
const cmp = (a, op, b, loose) => {
|
|
2583
|
+
switch (op) {
|
|
2584
|
+
case "===":
|
|
2585
|
+
if (typeof a === "object") a = a.version;
|
|
2586
|
+
if (typeof b === "object") b = b.version;
|
|
2587
|
+
return a === b;
|
|
2588
|
+
case "!==":
|
|
2589
|
+
if (typeof a === "object") a = a.version;
|
|
2590
|
+
if (typeof b === "object") b = b.version;
|
|
2591
|
+
return a !== b;
|
|
2592
|
+
case "":
|
|
2593
|
+
case "=":
|
|
2594
|
+
case "==": return eq(a, b, loose);
|
|
2595
|
+
case "!=": return neq(a, b, loose);
|
|
2596
|
+
case ">": return gt(a, b, loose);
|
|
2597
|
+
case ">=": return gte(a, b, loose);
|
|
2598
|
+
case "<": return lt(a, b, loose);
|
|
2599
|
+
case "<=": return lte(a, b, loose);
|
|
2600
|
+
default: throw new TypeError(`Invalid operator: ${op}`);
|
|
2601
|
+
}
|
|
2602
|
+
};
|
|
2603
|
+
module.exports = cmp;
|
|
2604
|
+
}));
|
|
2605
|
+
//#endregion
|
|
2606
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/coerce.js
|
|
2607
|
+
var require_coerce = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2608
|
+
const SemVer = require_semver$1();
|
|
2609
|
+
const parse = require_parse();
|
|
2610
|
+
const { safeRe: re, t } = require_re();
|
|
2611
|
+
const coerce = (version, options) => {
|
|
2612
|
+
if (version instanceof SemVer) return version;
|
|
2613
|
+
if (typeof version === "number") version = String(version);
|
|
2614
|
+
if (typeof version !== "string") return null;
|
|
2615
|
+
options = options || {};
|
|
2616
|
+
let match = null;
|
|
2617
|
+
if (!options.rtl) match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
|
|
2618
|
+
else {
|
|
2619
|
+
const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
|
|
2620
|
+
let next;
|
|
2621
|
+
while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
|
|
2622
|
+
if (!match || next.index + next[0].length !== match.index + match[0].length) match = next;
|
|
2623
|
+
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
|
|
2624
|
+
}
|
|
2625
|
+
coerceRtlRegex.lastIndex = -1;
|
|
2626
|
+
}
|
|
2627
|
+
if (match === null) return null;
|
|
2628
|
+
const major = match[2];
|
|
2629
|
+
return parse(`${major}.${match[3] || "0"}.${match[4] || "0"}${options.includePrerelease && match[5] ? `-${match[5]}` : ""}${options.includePrerelease && match[6] ? `+${match[6]}` : ""}`, options);
|
|
2630
|
+
};
|
|
2631
|
+
module.exports = coerce;
|
|
2632
|
+
}));
|
|
2633
|
+
//#endregion
|
|
2634
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/lrucache.js
|
|
2635
|
+
var require_lrucache = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2636
|
+
var LRUCache = class {
|
|
2637
|
+
constructor() {
|
|
2638
|
+
this.max = 1e3;
|
|
2639
|
+
this.map = /* @__PURE__ */ new Map();
|
|
2640
|
+
}
|
|
2641
|
+
get(key) {
|
|
2642
|
+
const value = this.map.get(key);
|
|
2643
|
+
if (value === void 0) return;
|
|
2644
|
+
else {
|
|
2645
|
+
this.map.delete(key);
|
|
2646
|
+
this.map.set(key, value);
|
|
2647
|
+
return value;
|
|
2648
|
+
}
|
|
2649
|
+
}
|
|
2650
|
+
delete(key) {
|
|
2651
|
+
return this.map.delete(key);
|
|
2652
|
+
}
|
|
2653
|
+
set(key, value) {
|
|
2654
|
+
if (!this.delete(key) && value !== void 0) {
|
|
2655
|
+
if (this.map.size >= this.max) {
|
|
2656
|
+
const firstKey = this.map.keys().next().value;
|
|
2657
|
+
this.delete(firstKey);
|
|
2658
|
+
}
|
|
2659
|
+
this.map.set(key, value);
|
|
2660
|
+
}
|
|
2661
|
+
return this;
|
|
2662
|
+
}
|
|
2663
|
+
};
|
|
2664
|
+
module.exports = LRUCache;
|
|
2665
|
+
}));
|
|
2666
|
+
//#endregion
|
|
2667
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/range.js
|
|
2668
|
+
var require_range = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2669
|
+
const SPACE_CHARACTERS = /\s+/g;
|
|
2670
|
+
module.exports = class Range {
|
|
2671
|
+
constructor(range, options) {
|
|
2672
|
+
options = parseOptions(options);
|
|
2673
|
+
if (range instanceof Range) if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
|
|
2674
|
+
else return new Range(range.raw, options);
|
|
2675
|
+
if (range instanceof Comparator) {
|
|
2676
|
+
this.raw = range.value;
|
|
2677
|
+
this.set = [[range]];
|
|
2678
|
+
this.formatted = void 0;
|
|
2679
|
+
return this;
|
|
2680
|
+
}
|
|
2681
|
+
this.options = options;
|
|
2682
|
+
this.loose = !!options.loose;
|
|
2683
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
2684
|
+
this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
|
|
2685
|
+
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
2686
|
+
if (!this.set.length) throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
2687
|
+
if (this.set.length > 1) {
|
|
2688
|
+
const first = this.set[0];
|
|
2689
|
+
this.set = this.set.filter((c) => !isNullSet(c[0]));
|
|
2690
|
+
if (this.set.length === 0) this.set = [first];
|
|
2691
|
+
else if (this.set.length > 1) {
|
|
2692
|
+
for (const c of this.set) if (c.length === 1 && isAny(c[0])) {
|
|
2693
|
+
this.set = [c];
|
|
2694
|
+
break;
|
|
2695
|
+
}
|
|
2696
|
+
}
|
|
2697
|
+
}
|
|
2698
|
+
this.formatted = void 0;
|
|
2699
|
+
}
|
|
2700
|
+
get range() {
|
|
2701
|
+
if (this.formatted === void 0) {
|
|
2702
|
+
this.formatted = "";
|
|
2703
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
2704
|
+
if (i > 0) this.formatted += "||";
|
|
2705
|
+
const comps = this.set[i];
|
|
2706
|
+
for (let k = 0; k < comps.length; k++) {
|
|
2707
|
+
if (k > 0) this.formatted += " ";
|
|
2708
|
+
this.formatted += comps[k].toString().trim();
|
|
2709
|
+
}
|
|
2710
|
+
}
|
|
2711
|
+
}
|
|
2712
|
+
return this.formatted;
|
|
2713
|
+
}
|
|
2714
|
+
format() {
|
|
2715
|
+
return this.range;
|
|
2716
|
+
}
|
|
2717
|
+
toString() {
|
|
2718
|
+
return this.range;
|
|
2719
|
+
}
|
|
2720
|
+
parseRange(range) {
|
|
2721
|
+
const memoKey = ((this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE)) + ":" + range;
|
|
2722
|
+
const cached = cache.get(memoKey);
|
|
2723
|
+
if (cached) return cached;
|
|
2724
|
+
const loose = this.options.loose;
|
|
2725
|
+
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
2726
|
+
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
2727
|
+
debug("hyphen replace", range);
|
|
2728
|
+
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
2729
|
+
debug("comparator trim", range);
|
|
2730
|
+
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
2731
|
+
debug("tilde trim", range);
|
|
2732
|
+
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
2733
|
+
debug("caret trim", range);
|
|
2734
|
+
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
2735
|
+
if (loose) rangeList = rangeList.filter((comp) => {
|
|
2736
|
+
debug("loose invalid filter", comp, this.options);
|
|
2737
|
+
return !!comp.match(re[t.COMPARATORLOOSE]);
|
|
2738
|
+
});
|
|
2739
|
+
debug("range list", rangeList);
|
|
2740
|
+
const rangeMap = /* @__PURE__ */ new Map();
|
|
2741
|
+
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
2742
|
+
for (const comp of comparators) {
|
|
2743
|
+
if (isNullSet(comp)) return [comp];
|
|
2744
|
+
rangeMap.set(comp.value, comp);
|
|
2745
|
+
}
|
|
2746
|
+
if (rangeMap.size > 1 && rangeMap.has("")) rangeMap.delete("");
|
|
2747
|
+
const result = [...rangeMap.values()];
|
|
2748
|
+
cache.set(memoKey, result);
|
|
2749
|
+
return result;
|
|
2750
|
+
}
|
|
2751
|
+
intersects(range, options) {
|
|
2752
|
+
if (!(range instanceof Range)) throw new TypeError("a Range is required");
|
|
2753
|
+
return this.set.some((thisComparators) => {
|
|
2754
|
+
return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
|
|
2755
|
+
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
2756
|
+
return rangeComparators.every((rangeComparator) => {
|
|
2757
|
+
return thisComparator.intersects(rangeComparator, options);
|
|
2758
|
+
});
|
|
2759
|
+
});
|
|
2760
|
+
});
|
|
2761
|
+
});
|
|
2762
|
+
}
|
|
2763
|
+
test(version) {
|
|
2764
|
+
if (!version) return false;
|
|
2765
|
+
if (typeof version === "string") try {
|
|
2766
|
+
version = new SemVer(version, this.options);
|
|
2767
|
+
} catch (er) {
|
|
2768
|
+
return false;
|
|
2769
|
+
}
|
|
2770
|
+
for (let i = 0; i < this.set.length; i++) if (testSet(this.set[i], version, this.options)) return true;
|
|
2771
|
+
return false;
|
|
2772
|
+
}
|
|
2773
|
+
};
|
|
2774
|
+
const cache = new (require_lrucache())();
|
|
2775
|
+
const parseOptions = require_parse_options();
|
|
2776
|
+
const Comparator = require_comparator();
|
|
2777
|
+
const debug = require_debug();
|
|
2778
|
+
const SemVer = require_semver$1();
|
|
2779
|
+
const { safeRe: re, t, comparatorTrimReplace, tildeTrimReplace, caretTrimReplace } = require_re();
|
|
2780
|
+
const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
|
|
2781
|
+
const isNullSet = (c) => c.value === "<0.0.0-0";
|
|
2782
|
+
const isAny = (c) => c.value === "";
|
|
2783
|
+
const isSatisfiable = (comparators, options) => {
|
|
2784
|
+
let result = true;
|
|
2785
|
+
const remainingComparators = comparators.slice();
|
|
2786
|
+
let testComparator = remainingComparators.pop();
|
|
2787
|
+
while (result && remainingComparators.length) {
|
|
2788
|
+
result = remainingComparators.every((otherComparator) => {
|
|
2789
|
+
return testComparator.intersects(otherComparator, options);
|
|
2790
|
+
});
|
|
2791
|
+
testComparator = remainingComparators.pop();
|
|
2792
|
+
}
|
|
2793
|
+
return result;
|
|
2794
|
+
};
|
|
2795
|
+
const parseComparator = (comp, options) => {
|
|
2796
|
+
comp = comp.replace(re[t.BUILD], "");
|
|
2797
|
+
debug("comp", comp, options);
|
|
2798
|
+
comp = replaceCarets(comp, options);
|
|
2799
|
+
debug("caret", comp);
|
|
2800
|
+
comp = replaceTildes(comp, options);
|
|
2801
|
+
debug("tildes", comp);
|
|
2802
|
+
comp = replaceXRanges(comp, options);
|
|
2803
|
+
debug("xrange", comp);
|
|
2804
|
+
comp = replaceStars(comp, options);
|
|
2805
|
+
debug("stars", comp);
|
|
2806
|
+
return comp;
|
|
2807
|
+
};
|
|
2808
|
+
const isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
2809
|
+
const replaceTildes = (comp, options) => {
|
|
2810
|
+
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
2811
|
+
};
|
|
2812
|
+
const replaceTilde = (comp, options) => {
|
|
2813
|
+
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
2814
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
2815
|
+
debug("tilde", comp, _, M, m, p, pr);
|
|
2816
|
+
let ret;
|
|
2817
|
+
if (isX(M)) ret = "";
|
|
2818
|
+
else if (isX(m)) ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
|
|
2819
|
+
else if (isX(p)) ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
|
|
2820
|
+
else if (pr) {
|
|
2821
|
+
debug("replaceTilde pr", pr);
|
|
2822
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
2823
|
+
} else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
2824
|
+
debug("tilde return", ret);
|
|
2825
|
+
return ret;
|
|
2826
|
+
});
|
|
2827
|
+
};
|
|
2828
|
+
const replaceCarets = (comp, options) => {
|
|
2829
|
+
return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
|
|
2830
|
+
};
|
|
2831
|
+
const replaceCaret = (comp, options) => {
|
|
2832
|
+
debug("caret", comp, options);
|
|
2833
|
+
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
2834
|
+
const z = options.includePrerelease ? "-0" : "";
|
|
2835
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
2836
|
+
debug("caret", comp, _, M, m, p, pr);
|
|
2837
|
+
let ret;
|
|
2838
|
+
if (isX(M)) ret = "";
|
|
2839
|
+
else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
2840
|
+
else if (isX(p)) if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
2841
|
+
else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
2842
|
+
else if (pr) {
|
|
2843
|
+
debug("replaceCaret pr", pr);
|
|
2844
|
+
if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
|
2845
|
+
else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
2846
|
+
else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
2847
|
+
} else {
|
|
2848
|
+
debug("no pr");
|
|
2849
|
+
if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
|
|
2850
|
+
else ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
|
|
2851
|
+
else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
2852
|
+
}
|
|
2853
|
+
debug("caret return", ret);
|
|
2854
|
+
return ret;
|
|
2855
|
+
});
|
|
2856
|
+
};
|
|
2857
|
+
const replaceXRanges = (comp, options) => {
|
|
2858
|
+
debug("replaceXRanges", comp, options);
|
|
2859
|
+
return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
|
|
2860
|
+
};
|
|
2861
|
+
const replaceXRange = (comp, options) => {
|
|
2862
|
+
comp = comp.trim();
|
|
2863
|
+
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
2864
|
+
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
2865
|
+
debug("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
2866
|
+
const xM = isX(M);
|
|
2867
|
+
const xm = xM || isX(m);
|
|
2868
|
+
const xp = xm || isX(p);
|
|
2869
|
+
const anyX = xp;
|
|
2870
|
+
if (gtlt === "=" && anyX) gtlt = "";
|
|
2871
|
+
pr = options.includePrerelease ? "-0" : "";
|
|
2872
|
+
if (xM) if (gtlt === ">" || gtlt === "<") ret = "<0.0.0-0";
|
|
2873
|
+
else ret = "*";
|
|
2874
|
+
else if (gtlt && anyX) {
|
|
2875
|
+
if (xm) m = 0;
|
|
2876
|
+
p = 0;
|
|
2877
|
+
if (gtlt === ">") {
|
|
2878
|
+
gtlt = ">=";
|
|
2879
|
+
if (xm) {
|
|
2880
|
+
M = +M + 1;
|
|
2881
|
+
m = 0;
|
|
2882
|
+
p = 0;
|
|
2883
|
+
} else {
|
|
2884
|
+
m = +m + 1;
|
|
2885
|
+
p = 0;
|
|
2886
|
+
}
|
|
2887
|
+
} else if (gtlt === "<=") {
|
|
2888
|
+
gtlt = "<";
|
|
2889
|
+
if (xm) M = +M + 1;
|
|
2890
|
+
else m = +m + 1;
|
|
2891
|
+
}
|
|
2892
|
+
if (gtlt === "<") pr = "-0";
|
|
2893
|
+
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
2894
|
+
} else if (xm) ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
2895
|
+
else if (xp) ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
|
|
2896
|
+
debug("xRange return", ret);
|
|
2897
|
+
return ret;
|
|
2898
|
+
});
|
|
2899
|
+
};
|
|
2900
|
+
const replaceStars = (comp, options) => {
|
|
2901
|
+
debug("replaceStars", comp, options);
|
|
2902
|
+
return comp.trim().replace(re[t.STAR], "");
|
|
2903
|
+
};
|
|
2904
|
+
const replaceGTE0 = (comp, options) => {
|
|
2905
|
+
debug("replaceGTE0", comp, options);
|
|
2906
|
+
return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
2907
|
+
};
|
|
2908
|
+
const hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
2909
|
+
if (isX(fM)) from = "";
|
|
2910
|
+
else if (isX(fm)) from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
|
2911
|
+
else if (isX(fp)) from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
|
2912
|
+
else if (fpr) from = `>=${from}`;
|
|
2913
|
+
else from = `>=${from}${incPr ? "-0" : ""}`;
|
|
2914
|
+
if (isX(tM)) to = "";
|
|
2915
|
+
else if (isX(tm)) to = `<${+tM + 1}.0.0-0`;
|
|
2916
|
+
else if (isX(tp)) to = `<${tM}.${+tm + 1}.0-0`;
|
|
2917
|
+
else if (tpr) to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
2918
|
+
else if (incPr) to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
2919
|
+
else to = `<=${to}`;
|
|
2920
|
+
return `${from} ${to}`.trim();
|
|
2921
|
+
};
|
|
2922
|
+
const testSet = (set, version, options) => {
|
|
2923
|
+
for (let i = 0; i < set.length; i++) if (!set[i].test(version)) return false;
|
|
2924
|
+
if (version.prerelease.length && !options.includePrerelease) {
|
|
2925
|
+
for (let i = 0; i < set.length; i++) {
|
|
2926
|
+
debug(set[i].semver);
|
|
2927
|
+
if (set[i].semver === Comparator.ANY) continue;
|
|
2928
|
+
if (set[i].semver.prerelease.length > 0) {
|
|
2929
|
+
const allowed = set[i].semver;
|
|
2930
|
+
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) return true;
|
|
2931
|
+
}
|
|
2932
|
+
}
|
|
2933
|
+
return false;
|
|
2934
|
+
}
|
|
2935
|
+
return true;
|
|
2936
|
+
};
|
|
2937
|
+
}));
|
|
2938
|
+
//#endregion
|
|
2939
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/comparator.js
|
|
2940
|
+
var require_comparator = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
2941
|
+
const ANY = Symbol("SemVer ANY");
|
|
2942
|
+
module.exports = class Comparator {
|
|
2943
|
+
static get ANY() {
|
|
2944
|
+
return ANY;
|
|
2945
|
+
}
|
|
2946
|
+
constructor(comp, options) {
|
|
2947
|
+
options = parseOptions(options);
|
|
2948
|
+
if (comp instanceof Comparator) if (comp.loose === !!options.loose) return comp;
|
|
2949
|
+
else comp = comp.value;
|
|
2950
|
+
comp = comp.trim().split(/\s+/).join(" ");
|
|
2951
|
+
debug("comparator", comp, options);
|
|
2952
|
+
this.options = options;
|
|
2953
|
+
this.loose = !!options.loose;
|
|
2954
|
+
this.parse(comp);
|
|
2955
|
+
if (this.semver === ANY) this.value = "";
|
|
2956
|
+
else this.value = this.operator + this.semver.version;
|
|
2957
|
+
debug("comp", this);
|
|
2958
|
+
}
|
|
2959
|
+
parse(comp) {
|
|
2960
|
+
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
2961
|
+
const m = comp.match(r);
|
|
2962
|
+
if (!m) throw new TypeError(`Invalid comparator: ${comp}`);
|
|
2963
|
+
this.operator = m[1] !== void 0 ? m[1] : "";
|
|
2964
|
+
if (this.operator === "=") this.operator = "";
|
|
2965
|
+
if (!m[2]) this.semver = ANY;
|
|
2966
|
+
else this.semver = new SemVer(m[2], this.options.loose);
|
|
2967
|
+
}
|
|
2968
|
+
toString() {
|
|
2969
|
+
return this.value;
|
|
2970
|
+
}
|
|
2971
|
+
test(version) {
|
|
2972
|
+
debug("Comparator.test", version, this.options.loose);
|
|
2973
|
+
if (this.semver === ANY || version === ANY) return true;
|
|
2974
|
+
if (typeof version === "string") try {
|
|
2975
|
+
version = new SemVer(version, this.options);
|
|
2976
|
+
} catch (er) {
|
|
2977
|
+
return false;
|
|
2978
|
+
}
|
|
2979
|
+
return cmp(version, this.operator, this.semver, this.options);
|
|
2980
|
+
}
|
|
2981
|
+
intersects(comp, options) {
|
|
2982
|
+
if (!(comp instanceof Comparator)) throw new TypeError("a Comparator is required");
|
|
2983
|
+
if (this.operator === "") {
|
|
2984
|
+
if (this.value === "") return true;
|
|
2985
|
+
return new Range(comp.value, options).test(this.value);
|
|
2986
|
+
} else if (comp.operator === "") {
|
|
2987
|
+
if (comp.value === "") return true;
|
|
2988
|
+
return new Range(this.value, options).test(comp.semver);
|
|
2989
|
+
}
|
|
2990
|
+
options = parseOptions(options);
|
|
2991
|
+
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) return false;
|
|
2992
|
+
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) return false;
|
|
2993
|
+
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) return true;
|
|
2994
|
+
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) return true;
|
|
2995
|
+
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) return true;
|
|
2996
|
+
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) return true;
|
|
2997
|
+
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) return true;
|
|
2998
|
+
return false;
|
|
2999
|
+
}
|
|
3000
|
+
};
|
|
3001
|
+
const parseOptions = require_parse_options();
|
|
3002
|
+
const { safeRe: re, t } = require_re();
|
|
3003
|
+
const cmp = require_cmp();
|
|
3004
|
+
const debug = require_debug();
|
|
3005
|
+
const SemVer = require_semver$1();
|
|
3006
|
+
const Range = require_range();
|
|
3007
|
+
}));
|
|
3008
|
+
//#endregion
|
|
3009
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/satisfies.js
|
|
3010
|
+
var require_satisfies = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
3011
|
+
const Range = require_range();
|
|
3012
|
+
const satisfies = (version, range, options) => {
|
|
3013
|
+
try {
|
|
3014
|
+
range = new Range(range, options);
|
|
3015
|
+
} catch (er) {
|
|
3016
|
+
return false;
|
|
3017
|
+
}
|
|
3018
|
+
return range.test(version);
|
|
3019
|
+
};
|
|
3020
|
+
module.exports = satisfies;
|
|
3021
|
+
}));
|
|
3022
|
+
//#endregion
|
|
3023
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/to-comparators.js
|
|
3024
|
+
var require_to_comparators = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
3025
|
+
const Range = require_range();
|
|
3026
|
+
const toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
3027
|
+
module.exports = toComparators;
|
|
3028
|
+
}));
|
|
3029
|
+
//#endregion
|
|
3030
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/max-satisfying.js
|
|
3031
|
+
var require_max_satisfying = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
3032
|
+
const SemVer = require_semver$1();
|
|
3033
|
+
const Range = require_range();
|
|
3034
|
+
const maxSatisfying = (versions, range, options) => {
|
|
3035
|
+
let max = null;
|
|
3036
|
+
let maxSV = null;
|
|
3037
|
+
let rangeObj = null;
|
|
3038
|
+
try {
|
|
3039
|
+
rangeObj = new Range(range, options);
|
|
3040
|
+
} catch (er) {
|
|
3041
|
+
return null;
|
|
3042
|
+
}
|
|
3043
|
+
versions.forEach((v) => {
|
|
3044
|
+
if (rangeObj.test(v)) {
|
|
3045
|
+
if (!max || maxSV.compare(v) === -1) {
|
|
3046
|
+
max = v;
|
|
3047
|
+
maxSV = new SemVer(max, options);
|
|
3048
|
+
}
|
|
3049
|
+
}
|
|
3050
|
+
});
|
|
3051
|
+
return max;
|
|
3052
|
+
};
|
|
3053
|
+
module.exports = maxSatisfying;
|
|
3054
|
+
}));
|
|
3055
|
+
//#endregion
|
|
3056
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-satisfying.js
|
|
3057
|
+
var require_min_satisfying = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
3058
|
+
const SemVer = require_semver$1();
|
|
3059
|
+
const Range = require_range();
|
|
3060
|
+
const minSatisfying = (versions, range, options) => {
|
|
3061
|
+
let min = null;
|
|
3062
|
+
let minSV = null;
|
|
3063
|
+
let rangeObj = null;
|
|
3064
|
+
try {
|
|
3065
|
+
rangeObj = new Range(range, options);
|
|
3066
|
+
} catch (er) {
|
|
3067
|
+
return null;
|
|
3068
|
+
}
|
|
3069
|
+
versions.forEach((v) => {
|
|
3070
|
+
if (rangeObj.test(v)) {
|
|
3071
|
+
if (!min || minSV.compare(v) === 1) {
|
|
3072
|
+
min = v;
|
|
3073
|
+
minSV = new SemVer(min, options);
|
|
3074
|
+
}
|
|
3075
|
+
}
|
|
3076
|
+
});
|
|
3077
|
+
return min;
|
|
3078
|
+
};
|
|
3079
|
+
module.exports = minSatisfying;
|
|
3080
|
+
}));
|
|
3081
|
+
//#endregion
|
|
3082
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-version.js
|
|
3083
|
+
var require_min_version = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
3084
|
+
const SemVer = require_semver$1();
|
|
3085
|
+
const Range = require_range();
|
|
3086
|
+
const gt = require_gt();
|
|
3087
|
+
const minVersion = (range, loose) => {
|
|
3088
|
+
range = new Range(range, loose);
|
|
3089
|
+
let minver = new SemVer("0.0.0");
|
|
3090
|
+
if (range.test(minver)) return minver;
|
|
3091
|
+
minver = new SemVer("0.0.0-0");
|
|
3092
|
+
if (range.test(minver)) return minver;
|
|
3093
|
+
minver = null;
|
|
3094
|
+
for (let i = 0; i < range.set.length; ++i) {
|
|
3095
|
+
const comparators = range.set[i];
|
|
3096
|
+
let setMin = null;
|
|
3097
|
+
comparators.forEach((comparator) => {
|
|
3098
|
+
const compver = new SemVer(comparator.semver.version);
|
|
3099
|
+
switch (comparator.operator) {
|
|
3100
|
+
case ">":
|
|
3101
|
+
if (compver.prerelease.length === 0) compver.patch++;
|
|
3102
|
+
else compver.prerelease.push(0);
|
|
3103
|
+
compver.raw = compver.format();
|
|
3104
|
+
case "":
|
|
3105
|
+
case ">=":
|
|
3106
|
+
if (!setMin || gt(compver, setMin)) setMin = compver;
|
|
3107
|
+
break;
|
|
3108
|
+
case "<":
|
|
3109
|
+
case "<=": break;
|
|
3110
|
+
/* istanbul ignore next */
|
|
3111
|
+
default: throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
3112
|
+
}
|
|
3113
|
+
});
|
|
3114
|
+
if (setMin && (!minver || gt(minver, setMin))) minver = setMin;
|
|
3115
|
+
}
|
|
3116
|
+
if (minver && range.test(minver)) return minver;
|
|
3117
|
+
return null;
|
|
3118
|
+
};
|
|
3119
|
+
module.exports = minVersion;
|
|
3120
|
+
}));
|
|
3121
|
+
//#endregion
|
|
3122
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/valid.js
|
|
3123
|
+
var require_valid = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
3124
|
+
const Range = require_range();
|
|
3125
|
+
const validRange = (range, options) => {
|
|
3126
|
+
try {
|
|
3127
|
+
return new Range(range, options).range || "*";
|
|
3128
|
+
} catch (er) {
|
|
3129
|
+
return null;
|
|
3130
|
+
}
|
|
3131
|
+
};
|
|
3132
|
+
module.exports = validRange;
|
|
3133
|
+
}));
|
|
3134
|
+
//#endregion
|
|
3135
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/outside.js
|
|
3136
|
+
var require_outside = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
3137
|
+
const SemVer = require_semver$1();
|
|
3138
|
+
const Comparator = require_comparator();
|
|
3139
|
+
const { ANY } = Comparator;
|
|
3140
|
+
const Range = require_range();
|
|
3141
|
+
const satisfies = require_satisfies();
|
|
3142
|
+
const gt = require_gt();
|
|
3143
|
+
const lt = require_lt();
|
|
3144
|
+
const lte = require_lte();
|
|
3145
|
+
const gte = require_gte();
|
|
3146
|
+
const outside = (version, range, hilo, options) => {
|
|
3147
|
+
version = new SemVer(version, options);
|
|
3148
|
+
range = new Range(range, options);
|
|
3149
|
+
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
3150
|
+
switch (hilo) {
|
|
3151
|
+
case ">":
|
|
3152
|
+
gtfn = gt;
|
|
3153
|
+
ltefn = lte;
|
|
3154
|
+
ltfn = lt;
|
|
3155
|
+
comp = ">";
|
|
3156
|
+
ecomp = ">=";
|
|
3157
|
+
break;
|
|
3158
|
+
case "<":
|
|
3159
|
+
gtfn = lt;
|
|
3160
|
+
ltefn = gte;
|
|
3161
|
+
ltfn = gt;
|
|
3162
|
+
comp = "<";
|
|
3163
|
+
ecomp = "<=";
|
|
3164
|
+
break;
|
|
3165
|
+
default: throw new TypeError("Must provide a hilo val of \"<\" or \">\"");
|
|
3166
|
+
}
|
|
3167
|
+
if (satisfies(version, range, options)) return false;
|
|
3168
|
+
for (let i = 0; i < range.set.length; ++i) {
|
|
3169
|
+
const comparators = range.set[i];
|
|
3170
|
+
let high = null;
|
|
3171
|
+
let low = null;
|
|
3172
|
+
comparators.forEach((comparator) => {
|
|
3173
|
+
if (comparator.semver === ANY) comparator = new Comparator(">=0.0.0");
|
|
3174
|
+
high = high || comparator;
|
|
3175
|
+
low = low || comparator;
|
|
3176
|
+
if (gtfn(comparator.semver, high.semver, options)) high = comparator;
|
|
3177
|
+
else if (ltfn(comparator.semver, low.semver, options)) low = comparator;
|
|
3178
|
+
});
|
|
3179
|
+
if (high.operator === comp || high.operator === ecomp) return false;
|
|
3180
|
+
if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) return false;
|
|
3181
|
+
else if (low.operator === ecomp && ltfn(version, low.semver)) return false;
|
|
3182
|
+
}
|
|
3183
|
+
return true;
|
|
3184
|
+
};
|
|
3185
|
+
module.exports = outside;
|
|
3186
|
+
}));
|
|
3187
|
+
//#endregion
|
|
3188
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/gtr.js
|
|
3189
|
+
var require_gtr = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
3190
|
+
const outside = require_outside();
|
|
3191
|
+
const gtr = (version, range, options) => outside(version, range, ">", options);
|
|
3192
|
+
module.exports = gtr;
|
|
3193
|
+
}));
|
|
3194
|
+
//#endregion
|
|
3195
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/ltr.js
|
|
3196
|
+
var require_ltr = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
3197
|
+
const outside = require_outside();
|
|
3198
|
+
const ltr = (version, range, options) => outside(version, range, "<", options);
|
|
3199
|
+
module.exports = ltr;
|
|
3200
|
+
}));
|
|
3201
|
+
//#endregion
|
|
3202
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/intersects.js
|
|
3203
|
+
var require_intersects = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
3204
|
+
const Range = require_range();
|
|
3205
|
+
const intersects = (r1, r2, options) => {
|
|
3206
|
+
r1 = new Range(r1, options);
|
|
3207
|
+
r2 = new Range(r2, options);
|
|
3208
|
+
return r1.intersects(r2, options);
|
|
3209
|
+
};
|
|
3210
|
+
module.exports = intersects;
|
|
3211
|
+
}));
|
|
3212
|
+
//#endregion
|
|
3213
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/simplify.js
|
|
3214
|
+
var require_simplify = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
3215
|
+
const satisfies = require_satisfies();
|
|
3216
|
+
const compare = require_compare();
|
|
3217
|
+
module.exports = (versions, range, options) => {
|
|
3218
|
+
const set = [];
|
|
3219
|
+
let first = null;
|
|
3220
|
+
let prev = null;
|
|
3221
|
+
const v = versions.sort((a, b) => compare(a, b, options));
|
|
3222
|
+
for (const version of v) if (satisfies(version, range, options)) {
|
|
3223
|
+
prev = version;
|
|
3224
|
+
if (!first) first = version;
|
|
3225
|
+
} else {
|
|
3226
|
+
if (prev) set.push([first, prev]);
|
|
3227
|
+
prev = null;
|
|
3228
|
+
first = null;
|
|
3229
|
+
}
|
|
3230
|
+
if (first) set.push([first, null]);
|
|
3231
|
+
const ranges = [];
|
|
3232
|
+
for (const [min, max] of set) if (min === max) ranges.push(min);
|
|
3233
|
+
else if (!max && min === v[0]) ranges.push("*");
|
|
3234
|
+
else if (!max) ranges.push(`>=${min}`);
|
|
3235
|
+
else if (min === v[0]) ranges.push(`<=${max}`);
|
|
3236
|
+
else ranges.push(`${min} - ${max}`);
|
|
3237
|
+
const simplified = ranges.join(" || ");
|
|
3238
|
+
const original = typeof range.raw === "string" ? range.raw : String(range);
|
|
3239
|
+
return simplified.length < original.length ? simplified : range;
|
|
3240
|
+
};
|
|
3241
|
+
}));
|
|
3242
|
+
//#endregion
|
|
3243
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/subset.js
|
|
3244
|
+
var require_subset = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
3245
|
+
const Range = require_range();
|
|
3246
|
+
const Comparator = require_comparator();
|
|
3247
|
+
const { ANY } = Comparator;
|
|
3248
|
+
const satisfies = require_satisfies();
|
|
3249
|
+
const compare = require_compare();
|
|
3250
|
+
const subset = (sub, dom, options = {}) => {
|
|
3251
|
+
if (sub === dom) return true;
|
|
3252
|
+
sub = new Range(sub, options);
|
|
3253
|
+
dom = new Range(dom, options);
|
|
3254
|
+
let sawNonNull = false;
|
|
3255
|
+
OUTER: for (const simpleSub of sub.set) {
|
|
3256
|
+
for (const simpleDom of dom.set) {
|
|
3257
|
+
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
3258
|
+
sawNonNull = sawNonNull || isSub !== null;
|
|
3259
|
+
if (isSub) continue OUTER;
|
|
3260
|
+
}
|
|
3261
|
+
if (sawNonNull) return false;
|
|
3262
|
+
}
|
|
3263
|
+
return true;
|
|
3264
|
+
};
|
|
3265
|
+
const minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
|
|
3266
|
+
const minimumVersion = [new Comparator(">=0.0.0")];
|
|
3267
|
+
const simpleSubset = (sub, dom, options) => {
|
|
3268
|
+
if (sub === dom) return true;
|
|
3269
|
+
if (sub.length === 1 && sub[0].semver === ANY) if (dom.length === 1 && dom[0].semver === ANY) return true;
|
|
3270
|
+
else if (options.includePrerelease) sub = minimumVersionWithPreRelease;
|
|
3271
|
+
else sub = minimumVersion;
|
|
3272
|
+
if (dom.length === 1 && dom[0].semver === ANY) if (options.includePrerelease) return true;
|
|
3273
|
+
else dom = minimumVersion;
|
|
3274
|
+
const eqSet = /* @__PURE__ */ new Set();
|
|
3275
|
+
let gt, lt;
|
|
3276
|
+
for (const c of sub) if (c.operator === ">" || c.operator === ">=") gt = higherGT(gt, c, options);
|
|
3277
|
+
else if (c.operator === "<" || c.operator === "<=") lt = lowerLT(lt, c, options);
|
|
3278
|
+
else eqSet.add(c.semver);
|
|
3279
|
+
if (eqSet.size > 1) return null;
|
|
3280
|
+
let gtltComp;
|
|
3281
|
+
if (gt && lt) {
|
|
3282
|
+
gtltComp = compare(gt.semver, lt.semver, options);
|
|
3283
|
+
if (gtltComp > 0) return null;
|
|
3284
|
+
else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) return null;
|
|
3285
|
+
}
|
|
3286
|
+
for (const eq of eqSet) {
|
|
3287
|
+
if (gt && !satisfies(eq, String(gt), options)) return null;
|
|
3288
|
+
if (lt && !satisfies(eq, String(lt), options)) return null;
|
|
3289
|
+
for (const c of dom) if (!satisfies(eq, String(c), options)) return false;
|
|
3290
|
+
return true;
|
|
3291
|
+
}
|
|
3292
|
+
let higher, lower;
|
|
3293
|
+
let hasDomLT, hasDomGT;
|
|
3294
|
+
let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
|
|
3295
|
+
let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
|
|
3296
|
+
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) needDomLTPre = false;
|
|
3297
|
+
for (const c of dom) {
|
|
3298
|
+
hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
|
|
3299
|
+
hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
|
|
3300
|
+
if (gt) {
|
|
3301
|
+
if (needDomGTPre) {
|
|
3302
|
+
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;
|
|
3303
|
+
}
|
|
3304
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
3305
|
+
higher = higherGT(gt, c, options);
|
|
3306
|
+
if (higher === c && higher !== gt) return false;
|
|
3307
|
+
} else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) return false;
|
|
3308
|
+
}
|
|
3309
|
+
if (lt) {
|
|
3310
|
+
if (needDomLTPre) {
|
|
3311
|
+
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;
|
|
3312
|
+
}
|
|
3313
|
+
if (c.operator === "<" || c.operator === "<=") {
|
|
3314
|
+
lower = lowerLT(lt, c, options);
|
|
3315
|
+
if (lower === c && lower !== lt) return false;
|
|
3316
|
+
} else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) return false;
|
|
3317
|
+
}
|
|
3318
|
+
if (!c.operator && (lt || gt) && gtltComp !== 0) return false;
|
|
3319
|
+
}
|
|
3320
|
+
if (gt && hasDomLT && !lt && gtltComp !== 0) return false;
|
|
3321
|
+
if (lt && hasDomGT && !gt && gtltComp !== 0) return false;
|
|
3322
|
+
if (needDomGTPre || needDomLTPre) return false;
|
|
3323
|
+
return true;
|
|
3324
|
+
};
|
|
3325
|
+
const higherGT = (a, b, options) => {
|
|
3326
|
+
if (!a) return b;
|
|
3327
|
+
const comp = compare(a.semver, b.semver, options);
|
|
3328
|
+
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
3329
|
+
};
|
|
3330
|
+
const lowerLT = (a, b, options) => {
|
|
3331
|
+
if (!a) return b;
|
|
3332
|
+
const comp = compare(a.semver, b.semver, options);
|
|
3333
|
+
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
3334
|
+
};
|
|
3335
|
+
module.exports = subset;
|
|
3336
|
+
}));
|
|
3337
|
+
//#endregion
|
|
3338
|
+
//#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/index.js
|
|
3339
|
+
var require_semver = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
3340
|
+
const internalRe = require_re();
|
|
3341
|
+
const constants = require_constants();
|
|
3342
|
+
const SemVer = require_semver$1();
|
|
3343
|
+
const identifiers = require_identifiers();
|
|
3344
|
+
module.exports = {
|
|
3345
|
+
parse: require_parse(),
|
|
3346
|
+
valid: require_valid$1(),
|
|
3347
|
+
clean: require_clean(),
|
|
3348
|
+
inc: require_inc(),
|
|
3349
|
+
diff: require_diff(),
|
|
3350
|
+
major: require_major(),
|
|
3351
|
+
minor: require_minor(),
|
|
3352
|
+
patch: require_patch(),
|
|
3353
|
+
prerelease: require_prerelease(),
|
|
3354
|
+
compare: require_compare(),
|
|
3355
|
+
rcompare: require_rcompare(),
|
|
3356
|
+
compareLoose: require_compare_loose(),
|
|
3357
|
+
compareBuild: require_compare_build(),
|
|
3358
|
+
sort: require_sort(),
|
|
3359
|
+
rsort: require_rsort(),
|
|
3360
|
+
gt: require_gt(),
|
|
3361
|
+
lt: require_lt(),
|
|
3362
|
+
eq: require_eq(),
|
|
3363
|
+
neq: require_neq(),
|
|
3364
|
+
gte: require_gte(),
|
|
3365
|
+
lte: require_lte(),
|
|
3366
|
+
cmp: require_cmp(),
|
|
3367
|
+
coerce: require_coerce(),
|
|
3368
|
+
Comparator: require_comparator(),
|
|
3369
|
+
Range: require_range(),
|
|
3370
|
+
satisfies: require_satisfies(),
|
|
3371
|
+
toComparators: require_to_comparators(),
|
|
3372
|
+
maxSatisfying: require_max_satisfying(),
|
|
3373
|
+
minSatisfying: require_min_satisfying(),
|
|
3374
|
+
minVersion: require_min_version(),
|
|
3375
|
+
validRange: require_valid(),
|
|
3376
|
+
outside: require_outside(),
|
|
3377
|
+
gtr: require_gtr(),
|
|
3378
|
+
ltr: require_ltr(),
|
|
3379
|
+
intersects: require_intersects(),
|
|
3380
|
+
simplifyRange: require_simplify(),
|
|
3381
|
+
subset: require_subset(),
|
|
3382
|
+
SemVer,
|
|
3383
|
+
re: internalRe.re,
|
|
3384
|
+
src: internalRe.src,
|
|
3385
|
+
tokens: internalRe.t,
|
|
3386
|
+
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
|
3387
|
+
RELEASE_TYPES: constants.RELEASE_TYPES,
|
|
3388
|
+
compareIdentifiers: identifiers.compareIdentifiers,
|
|
3389
|
+
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
3390
|
+
};
|
|
3391
|
+
}));
|
|
3392
|
+
//#endregion
|
|
3393
|
+
//#region ../core/dist/index.js
|
|
3394
|
+
var import_picomatch = /* @__PURE__ */ __toESM$1(require_picomatch(), 1);
|
|
3395
|
+
var import_semver = /* @__PURE__ */ __toESM$1(require_semver(), 1);
|
|
2054
3396
|
var __create = Object.create;
|
|
2055
3397
|
var __defProp = Object.defineProperty;
|
|
2056
3398
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -3092,6 +4434,13 @@ const OXLINT_OUTPUT_MAX_BYTES = 50 * 1024 * 1024;
|
|
|
3092
4434
|
const OXLINT_SPAWN_TIMEOUT_MS = 6e4;
|
|
3093
4435
|
const DEAD_CODE_WORKER_MAX_OLD_SPACE_MB = 8192;
|
|
3094
4436
|
const RECOMMENDED_PNPM_MINIMUM_RELEASE_AGE_MINUTES = 10080;
|
|
4437
|
+
const REACT_SERVER_DOM_PACKAGES = [
|
|
4438
|
+
"react-server-dom-webpack",
|
|
4439
|
+
"react-server-dom-parcel",
|
|
4440
|
+
"react-server-dom-turbopack"
|
|
4441
|
+
];
|
|
4442
|
+
const REACT_BLOG_RSC_ADVISORY_URL = "https://react.dev/blog/2025/12/03/critical-security-vulnerability-in-react-server-components";
|
|
4443
|
+
const VERCEL_NEXTJS_SECURITY_RELEASE_URL = "https://vercel.com/changelog/next-js-may-2026-security-release";
|
|
3095
4444
|
const DIAGNOSTIC_CATEGORY_BUCKETS = [
|
|
3096
4445
|
"Security",
|
|
3097
4446
|
"Bugs",
|
|
@@ -3108,6 +4457,13 @@ const COMPILER_CLEANUP_BUCKET = "compiler-cleanup";
|
|
|
3108
4457
|
const COMPILER_CLEANUP_RULE_KEYS = new Set(["react-doctor/react-compiler-no-manual-memoization"]);
|
|
3109
4458
|
const MAX_GLOB_PATTERN_LENGTH_CHARS = 1024;
|
|
3110
4459
|
const CONFIG_CACHE_TTL_MS = 300 * 1e3;
|
|
4460
|
+
const SOCKET_FREE_PURL_API_BASE = "https://firewall-api.socket.dev/purl";
|
|
4461
|
+
const SOCKET_PACKAGE_PAGE_BASE = "https://socket.dev/npm/package";
|
|
4462
|
+
const SOCKET_FREE_USER_AGENT = "react-doctor-supply-chain";
|
|
4463
|
+
const SUPPLY_CHAIN_PLUGIN = "socket";
|
|
4464
|
+
const SUPPLY_CHAIN_RULE = "low-supply-chain-score";
|
|
4465
|
+
const SUPPLY_CHAIN_CATEGORY = "Security";
|
|
4466
|
+
const SUPPLY_CHAIN_IGNORED_PACKAGES = new Set(["next"]);
|
|
3111
4467
|
const TSCONFIG_FILENAME = "tsconfig.json";
|
|
3112
4468
|
const isRelativeExtendsValue = (extendsValue) => extendsValue.startsWith("./") || extendsValue.startsWith("../") || path$1.isAbsolute(extendsValue);
|
|
3113
4469
|
const ensureJsonExtension = (filePath) => path$1.extname(filePath) === "" ? `${filePath}.json` : filePath;
|
|
@@ -5529,6 +6885,168 @@ const checkReactNativeProject = (rootDirectory, project) => {
|
|
|
5529
6885
|
if (!isReactNativeProject(project)) return [];
|
|
5530
6886
|
return [...checkReactNativeMetroBabelPreset(rootDirectory), ...checkReactNativeLibraryDependencies(rootDirectory)];
|
|
5531
6887
|
};
|
|
6888
|
+
const RULE_KEY = "no-vulnerable-react-server-components";
|
|
6889
|
+
const DEPENDENCY_SECTIONS = [
|
|
6890
|
+
"dependencies",
|
|
6891
|
+
"devDependencies",
|
|
6892
|
+
"peerDependencies",
|
|
6893
|
+
"optionalDependencies"
|
|
6894
|
+
];
|
|
6895
|
+
const REACT_RSC_ADVISORIES_BY_MINOR = {
|
|
6896
|
+
"19.0": {
|
|
6897
|
+
rceFixedVersion: "19.0.1",
|
|
6898
|
+
latestSafeVersion: "19.0.6"
|
|
6899
|
+
},
|
|
6900
|
+
"19.1": {
|
|
6901
|
+
rceFixedVersion: "19.1.2",
|
|
6902
|
+
latestSafeVersion: "19.1.7"
|
|
6903
|
+
},
|
|
6904
|
+
"19.2": {
|
|
6905
|
+
rceFixedVersion: "19.2.1",
|
|
6906
|
+
latestSafeVersion: "19.2.6"
|
|
6907
|
+
}
|
|
6908
|
+
};
|
|
6909
|
+
const NEXTJS_OLDEST_AFFECTED_MAJOR = 13;
|
|
6910
|
+
const NEXTJS_RCE_FIXED_BY_MINOR = {
|
|
6911
|
+
"15.0": "15.0.5",
|
|
6912
|
+
"15.1": "15.1.9",
|
|
6913
|
+
"15.2": "15.2.6",
|
|
6914
|
+
"15.3": "15.3.6",
|
|
6915
|
+
"15.4": "15.4.8",
|
|
6916
|
+
"15.5": "15.5.7",
|
|
6917
|
+
"16.0": "16.0.7"
|
|
6918
|
+
};
|
|
6919
|
+
const NEXTJS_LATEST_SAFE_BY_MAJOR = {
|
|
6920
|
+
15: "15.5.18",
|
|
6921
|
+
16: "16.2.6"
|
|
6922
|
+
};
|
|
6923
|
+
const NEXTJS_SUPPORTED_UPGRADE_TARGETS = "15.5.18 or 16.2.6";
|
|
6924
|
+
const buildAdvisoryDiagnostic = (input) => ({
|
|
6925
|
+
filePath: "package.json",
|
|
6926
|
+
plugin: "react-doctor",
|
|
6927
|
+
rule: RULE_KEY,
|
|
6928
|
+
severity: input.severity,
|
|
6929
|
+
message: input.message,
|
|
6930
|
+
help: input.help,
|
|
6931
|
+
line: 0,
|
|
6932
|
+
column: 0,
|
|
6933
|
+
category: "Security"
|
|
6934
|
+
});
|
|
6935
|
+
const enumerateWorkspaceDirectories = (workspaceRoot) => {
|
|
6936
|
+
const patterns = getWorkspacePatterns(workspaceRoot, readPackageJson(path$1.join(workspaceRoot, "package.json")));
|
|
6937
|
+
const directories = /* @__PURE__ */ new Set();
|
|
6938
|
+
for (const pattern of patterns) for (const directory of resolveWorkspaceDirectories(workspaceRoot, pattern)) directories.add(directory);
|
|
6939
|
+
return [...directories];
|
|
6940
|
+
};
|
|
6941
|
+
const readDeclaredSpec = (packageJson, packageName) => {
|
|
6942
|
+
for (const section of DEPENDENCY_SECTIONS) {
|
|
6943
|
+
const spec = packageJson[section]?.[packageName];
|
|
6944
|
+
if (typeof spec === "string") return spec;
|
|
6945
|
+
}
|
|
6946
|
+
return null;
|
|
6947
|
+
};
|
|
6948
|
+
const resolveVersionInDirectory = (directory, packageName, declaredSpecOverride) => {
|
|
6949
|
+
const manifestPath = path$1.join(directory, "node_modules", packageName, "package.json");
|
|
6950
|
+
if (isFile(manifestPath)) {
|
|
6951
|
+
const installedVersion = import_semver.valid(readPackageJson(manifestPath).version ?? null);
|
|
6952
|
+
if (installedVersion !== null) return installedVersion;
|
|
6953
|
+
}
|
|
6954
|
+
const candidateSpecs = [readDeclaredSpec(readPackageJson(path$1.join(directory, "package.json")), packageName), declaredSpecOverride];
|
|
6955
|
+
for (const spec of candidateSpecs) {
|
|
6956
|
+
const pinnedVersion = spec === null ? null : import_semver.valid(spec);
|
|
6957
|
+
if (pinnedVersion !== null) return pinnedVersion;
|
|
6958
|
+
}
|
|
6959
|
+
return null;
|
|
6960
|
+
};
|
|
6961
|
+
const checkReactServerDomAdvisory = (packageName, version) => {
|
|
6962
|
+
const advisory = REACT_RSC_ADVISORIES_BY_MINOR[`${import_semver.major(version)}.${import_semver.minor(version)}`];
|
|
6963
|
+
if (advisory === void 0) return [];
|
|
6964
|
+
const installedDisplay = `${packageName}@${version}`;
|
|
6965
|
+
const lineDisplay = `${import_semver.major(version)}.${import_semver.minor(version)}`;
|
|
6966
|
+
if (import_semver.lt(version, advisory.rceFixedVersion)) return [buildAdvisoryDiagnostic({
|
|
6967
|
+
severity: "error",
|
|
6968
|
+
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`,
|
|
6969
|
+
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}`
|
|
6970
|
+
})];
|
|
6971
|
+
if (import_semver.lt(version, advisory.latestSafeVersion)) return [buildAdvisoryDiagnostic({
|
|
6972
|
+
severity: "warning",
|
|
6973
|
+
message: `${installedDisplay} is affected by a high-severity React Server Components denial-of-service vulnerability (CVE-2026-23870) patched in ${advisory.latestSafeVersion}`,
|
|
6974
|
+
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}`
|
|
6975
|
+
})];
|
|
6976
|
+
return [];
|
|
6977
|
+
};
|
|
6978
|
+
const checkNextjsAdvisory = (version) => {
|
|
6979
|
+
const major = import_semver.major(version);
|
|
6980
|
+
if (major < NEXTJS_OLDEST_AFFECTED_MAJOR) return [];
|
|
6981
|
+
const installedDisplay = `next@${version}`;
|
|
6982
|
+
const latestSafeVersion = NEXTJS_LATEST_SAFE_BY_MAJOR[major];
|
|
6983
|
+
if (latestSafeVersion === void 0) {
|
|
6984
|
+
if (major >= 15) return [];
|
|
6985
|
+
return [buildAdvisoryDiagnostic({
|
|
6986
|
+
severity: "warning",
|
|
6987
|
+
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`,
|
|
6988
|
+
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}`
|
|
6989
|
+
})];
|
|
6990
|
+
}
|
|
6991
|
+
const rceFixedVersion = NEXTJS_RCE_FIXED_BY_MINOR[`${major}.${import_semver.minor(version)}`];
|
|
6992
|
+
if (rceFixedVersion !== void 0 && import_semver.lt(version, rceFixedVersion)) return [buildAdvisoryDiagnostic({
|
|
6993
|
+
severity: "error",
|
|
6994
|
+
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`,
|
|
6995
|
+
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}`
|
|
6996
|
+
})];
|
|
6997
|
+
if (import_semver.lt(version, latestSafeVersion)) return [buildAdvisoryDiagnostic({
|
|
6998
|
+
severity: "warning",
|
|
6999
|
+
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}`,
|
|
7000
|
+
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}`
|
|
7001
|
+
})];
|
|
7002
|
+
return [];
|
|
7003
|
+
};
|
|
7004
|
+
/**
|
|
7005
|
+
* Flags a project running React Server Components on a version with a known
|
|
7006
|
+
* security advisory — primarily the critical unauthenticated RCE
|
|
7007
|
+
* (CVE-2025-55182), plus the later high-severity DoS (CVE-2026-23870).
|
|
7008
|
+
*
|
|
7009
|
+
* Every candidate directory — the scan root and each workspace package — is
|
|
7010
|
+
* probed independently, so heterogeneous monorepo installs are all seen (a
|
|
7011
|
+
* vulnerable `next` in one workspace isn't masked by an inert one elsewhere).
|
|
7012
|
+
* Next.js vendors its own RSC runtime, so an affected `next` install in a
|
|
7013
|
+
* directory is reported by its `next` version (the fix is a Next.js bump) and
|
|
7014
|
+
* suppresses the standalone `react-server-dom-*` check for that directory only;
|
|
7015
|
+
* every other framework or bundler — Vite, Parcel, React Router, Waku,
|
|
7016
|
+
* RedwoodSDK — is reported by its `react-server-dom-*` version. Dispatch keys
|
|
7017
|
+
* on resolved installs rather than the root framework classification, so a
|
|
7018
|
+
* monorepo whose root is Vite but whose workspace runs Next.js is still
|
|
7019
|
+
* covered. Pure client-side React apps (no RSC packages, no Next.js) are not
|
|
7020
|
+
* affected and stay quiet.
|
|
7021
|
+
*/
|
|
7022
|
+
const checkReactServerComponentsAdvisory = (scanDirectory, project) => {
|
|
7023
|
+
const workspaceRoot = findMonorepoRoot(scanDirectory) ?? project.rootDirectory;
|
|
7024
|
+
const candidateDirectories = [...new Set([
|
|
7025
|
+
scanDirectory,
|
|
7026
|
+
project.rootDirectory,
|
|
7027
|
+
workspaceRoot,
|
|
7028
|
+
...enumerateWorkspaceDirectories(workspaceRoot)
|
|
7029
|
+
])];
|
|
7030
|
+
const diagnostics = [];
|
|
7031
|
+
const seenMessages = /* @__PURE__ */ new Set();
|
|
7032
|
+
const pushUnique = (candidates) => {
|
|
7033
|
+
for (const candidate of candidates) {
|
|
7034
|
+
if (seenMessages.has(candidate.message)) continue;
|
|
7035
|
+
seenMessages.add(candidate.message);
|
|
7036
|
+
diagnostics.push(candidate);
|
|
7037
|
+
}
|
|
7038
|
+
};
|
|
7039
|
+
for (const directory of candidateDirectories) {
|
|
7040
|
+
const nextVersion = resolveVersionInDirectory(directory, "next", directory === scanDirectory ? project.nextjsVersion : null);
|
|
7041
|
+
if (nextVersion !== null) pushUnique(checkNextjsAdvisory(nextVersion));
|
|
7042
|
+
if (nextVersion !== null && import_semver.major(nextVersion) >= NEXTJS_OLDEST_AFFECTED_MAJOR) continue;
|
|
7043
|
+
for (const packageName of REACT_SERVER_DOM_PACKAGES) {
|
|
7044
|
+
const version = resolveVersionInDirectory(directory, packageName, null);
|
|
7045
|
+
if (version !== null) pushUnique(checkReactServerDomAdvisory(packageName, version));
|
|
7046
|
+
}
|
|
7047
|
+
}
|
|
7048
|
+
return diagnostics;
|
|
7049
|
+
};
|
|
5532
7050
|
const REDUCED_MOTION_GREP_PATTERN = "prefers-reduced-motion|useReducedMotion|MotionConfig|reducedMotion";
|
|
5533
7051
|
const REDUCED_MOTION_FILE_GLOBS = [
|
|
5534
7052
|
"*.ts",
|
|
@@ -8479,6 +9997,214 @@ var Score = class Score extends Context.Service()("react-doctor/Score") {
|
|
|
8479
9997
|
}) }));
|
|
8480
9998
|
static layerOf = (result) => Layer.succeed(Score, Score.of({ compute: () => Effect.succeed(result) }));
|
|
8481
9999
|
};
|
|
10000
|
+
const SocketScoreSchema = Schema.Struct({
|
|
10001
|
+
overall: Schema.Number,
|
|
10002
|
+
license: Schema.Number,
|
|
10003
|
+
maintenance: Schema.Number,
|
|
10004
|
+
quality: Schema.Number,
|
|
10005
|
+
supplyChain: Schema.Number,
|
|
10006
|
+
vulnerability: Schema.Number
|
|
10007
|
+
});
|
|
10008
|
+
const SocketArtifactSchema = Schema.Struct({ score: Schema.optional(SocketScoreSchema) });
|
|
10009
|
+
const decodeArtifact = Schema.decodeUnknownOption(SocketArtifactSchema);
|
|
10010
|
+
const SCORE_AXES = [
|
|
10011
|
+
{
|
|
10012
|
+
key: "supplyChain",
|
|
10013
|
+
label: "supply chain"
|
|
10014
|
+
},
|
|
10015
|
+
{
|
|
10016
|
+
key: "vulnerability",
|
|
10017
|
+
label: "vulnerability"
|
|
10018
|
+
},
|
|
10019
|
+
{
|
|
10020
|
+
key: "maintenance",
|
|
10021
|
+
label: "maintenance"
|
|
10022
|
+
},
|
|
10023
|
+
{
|
|
10024
|
+
key: "quality",
|
|
10025
|
+
label: "quality"
|
|
10026
|
+
},
|
|
10027
|
+
{
|
|
10028
|
+
key: "license",
|
|
10029
|
+
label: "license"
|
|
10030
|
+
}
|
|
10031
|
+
];
|
|
10032
|
+
const clampScore = (value) => {
|
|
10033
|
+
if (!Number.isFinite(value)) return 50;
|
|
10034
|
+
return Math.min(Math.max(value, 0), 100);
|
|
10035
|
+
};
|
|
10036
|
+
const toHundred = (normalizedScore) => Math.round(clampScore(normalizedScore * 100));
|
|
10037
|
+
const resolveOptions = (config) => {
|
|
10038
|
+
const supplyChain = config?.supplyChain ?? {};
|
|
10039
|
+
return {
|
|
10040
|
+
minScore: typeof supplyChain.minScore === "number" ? clampScore(supplyChain.minScore) : 50,
|
|
10041
|
+
severity: supplyChain.severity === "warning" ? "warning" : "error",
|
|
10042
|
+
includeDevDependencies: supplyChain.includeDevDependencies !== false
|
|
10043
|
+
};
|
|
10044
|
+
};
|
|
10045
|
+
const resolveConcreteVersion = (spec) => {
|
|
10046
|
+
const trimmed = spec.trim();
|
|
10047
|
+
if (trimmed.length === 0) return null;
|
|
10048
|
+
if (trimmed.includes(":")) return null;
|
|
10049
|
+
const match = trimmed.match(/\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?/);
|
|
10050
|
+
return match ? match[0] : null;
|
|
10051
|
+
};
|
|
10052
|
+
const locateDependencyKey = (packageJsonText, section, name) => {
|
|
10053
|
+
const needle = `"${name}"`;
|
|
10054
|
+
const sectionHeader = new RegExp(`"${section}"\\s*:\\s*\\{`);
|
|
10055
|
+
const lines = packageJsonText.split(/\r?\n/);
|
|
10056
|
+
let depth = 0;
|
|
10057
|
+
let insideSection = false;
|
|
10058
|
+
for (let lineIndex = 0; lineIndex < lines.length; lineIndex += 1) {
|
|
10059
|
+
const lineText = lines[lineIndex];
|
|
10060
|
+
if (!insideSection) {
|
|
10061
|
+
if (sectionHeader.test(lineText)) {
|
|
10062
|
+
insideSection = true;
|
|
10063
|
+
depth = 1;
|
|
10064
|
+
}
|
|
10065
|
+
continue;
|
|
10066
|
+
}
|
|
10067
|
+
const columnIndex = lineText.indexOf(needle);
|
|
10068
|
+
if (columnIndex >= 0 && /^\s*:/.test(lineText.slice(columnIndex + needle.length))) return {
|
|
10069
|
+
line: lineIndex + 1,
|
|
10070
|
+
column: columnIndex + 1
|
|
10071
|
+
};
|
|
10072
|
+
for (const character of lineText) if (character === "{") depth += 1;
|
|
10073
|
+
else if (character === "}") depth -= 1;
|
|
10074
|
+
if (depth <= 0) return null;
|
|
10075
|
+
}
|
|
10076
|
+
return null;
|
|
10077
|
+
};
|
|
10078
|
+
const collectDependenciesToScore = (packageJson, packageJsonText, includeDevDependencies) => {
|
|
10079
|
+
const sectionByName = /* @__PURE__ */ new Map();
|
|
10080
|
+
for (const name of Object.keys(packageJson.dependencies ?? {})) sectionByName.set(name, "dependencies");
|
|
10081
|
+
if (includeDevDependencies) {
|
|
10082
|
+
for (const name of Object.keys(packageJson.devDependencies ?? {})) if (!sectionByName.has(name)) sectionByName.set(name, "devDependencies");
|
|
10083
|
+
}
|
|
10084
|
+
const dependencies = [];
|
|
10085
|
+
for (const [name, section] of sectionByName) {
|
|
10086
|
+
if (SUPPLY_CHAIN_IGNORED_PACKAGES.has(name)) continue;
|
|
10087
|
+
const spec = (packageJson[section] ?? {})[name] ?? "";
|
|
10088
|
+
const version = resolveConcreteVersion(spec);
|
|
10089
|
+
if (version === null) continue;
|
|
10090
|
+
const location = locateDependencyKey(packageJsonText, section, name);
|
|
10091
|
+
dependencies.push({
|
|
10092
|
+
name,
|
|
10093
|
+
version,
|
|
10094
|
+
spec,
|
|
10095
|
+
line: location?.line ?? 0,
|
|
10096
|
+
column: location?.column ?? 0
|
|
10097
|
+
});
|
|
10098
|
+
}
|
|
10099
|
+
return dependencies;
|
|
10100
|
+
};
|
|
10101
|
+
const readPackageJsonText = (packageJsonPath) => {
|
|
10102
|
+
try {
|
|
10103
|
+
return fs$1.readFileSync(packageJsonPath, "utf-8");
|
|
10104
|
+
} catch {
|
|
10105
|
+
return "";
|
|
10106
|
+
}
|
|
10107
|
+
};
|
|
10108
|
+
const toPurl = (dependency) => `pkg:npm/${dependency.name}@${dependency.version}`;
|
|
10109
|
+
const parseScoreFromBody = (body) => {
|
|
10110
|
+
for (const line of body.split("\n")) {
|
|
10111
|
+
if (line.trim().length === 0) continue;
|
|
10112
|
+
let parsed;
|
|
10113
|
+
try {
|
|
10114
|
+
parsed = JSON.parse(line);
|
|
10115
|
+
} catch {
|
|
10116
|
+
continue;
|
|
10117
|
+
}
|
|
10118
|
+
const artifact = Option.getOrNull(decodeArtifact(parsed));
|
|
10119
|
+
if (artifact?.score) return artifact.score;
|
|
10120
|
+
}
|
|
10121
|
+
return null;
|
|
10122
|
+
};
|
|
10123
|
+
const fetchSocketScore = (dependency) => Effect.tryPromise(async (signal) => {
|
|
10124
|
+
const requestUrl = `${SOCKET_FREE_PURL_API_BASE}/${encodeURIComponent(toPurl(dependency))}`;
|
|
10125
|
+
const response = await fetch(requestUrl, {
|
|
10126
|
+
headers: { "User-Agent": SOCKET_FREE_USER_AGENT },
|
|
10127
|
+
signal
|
|
10128
|
+
});
|
|
10129
|
+
if (!response.ok) return null;
|
|
10130
|
+
return parseScoreFromBody(await response.text());
|
|
10131
|
+
}).pipe(Effect.timeout(FETCH_TIMEOUT_MS), Effect.orElseSucceed(() => null), Effect.tap((score) => {
|
|
10132
|
+
const scoreAttributes = {};
|
|
10133
|
+
if (score !== null) {
|
|
10134
|
+
scoreAttributes["socket.score.overall"] = toHundred(score.overall);
|
|
10135
|
+
for (const axis of SCORE_AXES) scoreAttributes[`socket.score.${axis.key}`] = toHundred(score[axis.key]);
|
|
10136
|
+
}
|
|
10137
|
+
return Effect.annotateCurrentSpan({
|
|
10138
|
+
"socket.scored": score !== null,
|
|
10139
|
+
...scoreAttributes
|
|
10140
|
+
});
|
|
10141
|
+
}), Effect.withSpan("SupplyChain.fetchScore", { attributes: {
|
|
10142
|
+
"socket.package": dependency.name,
|
|
10143
|
+
"socket.version": dependency.version,
|
|
10144
|
+
"socket.purl": toPurl(dependency)
|
|
10145
|
+
} }));
|
|
10146
|
+
const formatAxisScores = (score) => SCORE_AXES.map((axis) => `${axis.label} ${toHundred(score[axis.key])}`).join(", ");
|
|
10147
|
+
const buildLowScoreDiagnostic = (dependency, score, options) => {
|
|
10148
|
+
const overall = toHundred(score.overall);
|
|
10149
|
+
const packagePageUrl = `${SOCKET_PACKAGE_PAGE_BASE}/${dependency.name}/overview/${dependency.version}`;
|
|
10150
|
+
return {
|
|
10151
|
+
filePath: "package.json",
|
|
10152
|
+
plugin: SUPPLY_CHAIN_PLUGIN,
|
|
10153
|
+
rule: SUPPLY_CHAIN_RULE,
|
|
10154
|
+
severity: options.severity,
|
|
10155
|
+
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)}.`,
|
|
10156
|
+
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.`,
|
|
10157
|
+
url: packagePageUrl,
|
|
10158
|
+
line: dependency.line,
|
|
10159
|
+
column: dependency.column,
|
|
10160
|
+
category: SUPPLY_CHAIN_CATEGORY
|
|
10161
|
+
};
|
|
10162
|
+
};
|
|
10163
|
+
/**
|
|
10164
|
+
* Scores every direct dependency in the project's `package.json` against
|
|
10165
|
+
* Socket.dev's free PURL endpoint (the same one Socket Firewall's free tier
|
|
10166
|
+
* uses — no API key) and returns a diagnostic for each dependency whose
|
|
10167
|
+
* Socket `overall` score is below the configured `minScore`.
|
|
10168
|
+
*
|
|
10169
|
+
* Lookups run with bounded concurrency via `Effect.forEach`. The check is
|
|
10170
|
+
* total/fail-open: each per-package lookup already recovers to `null`
|
|
10171
|
+
* (skip) on timeout or network/parse failure, so a flaky Socket API never
|
|
10172
|
+
* sinks the scan. Diagnostics default to `"error"` severity, so a low score
|
|
10173
|
+
* fails the run at the standard `blocking` gate.
|
|
10174
|
+
*/
|
|
10175
|
+
const checkSupplyChain = (input) => Effect.gen(function* () {
|
|
10176
|
+
const options = resolveOptions(input.userConfig);
|
|
10177
|
+
const packageJsonPath = path$1.join(input.rootDirectory, "package.json");
|
|
10178
|
+
const dependencies = collectDependenciesToScore(readPackageJson(packageJsonPath), readPackageJsonText(packageJsonPath), options.includeDevDependencies);
|
|
10179
|
+
if (dependencies.length === 0) return [];
|
|
10180
|
+
const scores = yield* Effect.forEach(dependencies, fetchSocketScore, { concurrency: 8 });
|
|
10181
|
+
const diagnostics = [];
|
|
10182
|
+
for (let index = 0; index < dependencies.length; index += 1) {
|
|
10183
|
+
const score = scores[index];
|
|
10184
|
+
if (!score) continue;
|
|
10185
|
+
if (toHundred(score.overall) >= options.minScore) continue;
|
|
10186
|
+
diagnostics.push(buildLowScoreDiagnostic(dependencies[index], score, options));
|
|
10187
|
+
}
|
|
10188
|
+
return diagnostics;
|
|
10189
|
+
});
|
|
10190
|
+
/**
|
|
10191
|
+
* `SupplyChain` scores the project's direct dependencies against Socket.dev's
|
|
10192
|
+
* free, keyless PURL endpoint — the same lookup Socket Firewall's free tier
|
|
10193
|
+
* (`sfw`) performs — and streams a diagnostic for each dependency whose
|
|
10194
|
+
* Socket score falls below the configured `supplyChain.minScore`.
|
|
10195
|
+
*
|
|
10196
|
+
* Runs by default (one network request per dependency); the orchestrator
|
|
10197
|
+
* provides `layerOf([])` only when the user opts out via
|
|
10198
|
+
* `supplyChain.enabled: false`, and always skips it in `--diff` / `--staged`
|
|
10199
|
+
* mode (dependency health is a whole-project property).
|
|
10200
|
+
* The underlying `checkSupplyChain` Effect is total/fail-open — per-package
|
|
10201
|
+
* timeouts and network failures recover to "skip" — so the stream never
|
|
10202
|
+
* fails, mirroring `DeadCode`'s stream shape so the two compose the same way.
|
|
10203
|
+
*/
|
|
10204
|
+
var SupplyChain = class SupplyChain extends Context.Service()("react-doctor/SupplyChain") {
|
|
10205
|
+
static layerNode = Layer.succeed(SupplyChain, SupplyChain.of({ run: (input) => Stream.unwrap(checkSupplyChain(input).pipe(Effect.map((diagnostics) => Stream.fromIterable(diagnostics)), Effect.withSpan("SupplyChain.run"))) }));
|
|
10206
|
+
static layerOf = (diagnostics) => Layer.succeed(SupplyChain, SupplyChain.of({ run: () => Stream.fromIterable(diagnostics) }));
|
|
10207
|
+
};
|
|
8482
10208
|
const getObjectProperty = (value, propertyName) => {
|
|
8483
10209
|
if (typeof value !== "object" || value === null) return void 0;
|
|
8484
10210
|
return Reflect.get(value, propertyName);
|
|
@@ -8556,6 +10282,7 @@ const runInspect = (input, hooks = {}) => Effect.gen(function* () {
|
|
|
8556
10282
|
const reporterService = yield* Reporter;
|
|
8557
10283
|
const scoreService = yield* Score;
|
|
8558
10284
|
const deadCodeService = yield* DeadCode;
|
|
10285
|
+
const supplyChainService = yield* SupplyChain;
|
|
8559
10286
|
const gitService = yield* Git;
|
|
8560
10287
|
const progressService = yield* Progress;
|
|
8561
10288
|
const partialFailuresRef = yield* LintPartialFailures;
|
|
@@ -8591,10 +10318,15 @@ const runInspect = (input, hooks = {}) => Effect.gen(function* () {
|
|
|
8591
10318
|
const environmentDiagnostics = isDiffMode ? [] : [
|
|
8592
10319
|
...checkReducedMotion(scanDirectory),
|
|
8593
10320
|
...checkPnpmHardening(scanDirectory),
|
|
10321
|
+
...checkReactServerComponentsAdvisory(scanDirectory, project),
|
|
8594
10322
|
...checkExpoProject(scanDirectory, project),
|
|
8595
10323
|
...checkReactNativeProject(scanDirectory, project)
|
|
8596
10324
|
];
|
|
8597
10325
|
const envCollected = yield* Stream.runCollect(applyPerElementPipeline(Stream.fromIterable(environmentDiagnostics)));
|
|
10326
|
+
const supplyChainCollected = !isDiffMode || (input.supplyChainManifestChanged ?? false) ? yield* Stream.runCollect(applyPerElementPipeline(supplyChainService.run({
|
|
10327
|
+
rootDirectory: scanDirectory,
|
|
10328
|
+
userConfig: resolvedConfig.config
|
|
10329
|
+
}))) : [];
|
|
8598
10330
|
const lintFailure = yield* Ref.make({
|
|
8599
10331
|
didFail: false,
|
|
8600
10332
|
reason: null,
|
|
@@ -8659,6 +10391,7 @@ const runInspect = (input, hooks = {}) => Effect.gen(function* () {
|
|
|
8659
10391
|
yield* reporterService.finalize;
|
|
8660
10392
|
const finalDiagnostics = [
|
|
8661
10393
|
...envCollected,
|
|
10394
|
+
...supplyChainCollected,
|
|
8662
10395
|
...lintCollected,
|
|
8663
10396
|
...deadCodeCollected
|
|
8664
10397
|
];
|
|
@@ -9105,7 +10838,14 @@ const clearAutoSuppressionCaches = () => {};
|
|
|
9105
10838
|
const defineConfig = (config) => config;
|
|
9106
10839
|
//#endregion
|
|
9107
10840
|
//#region ../api/dist/index.js
|
|
9108
|
-
const buildDiagnoseLayer = (
|
|
10841
|
+
const buildDiagnoseLayer = (config, configOverride) => {
|
|
10842
|
+
const configLayer = configOverride === void 0 ? Config.layerNode : Config.layerOf({
|
|
10843
|
+
config,
|
|
10844
|
+
resolvedDirectory: configOverride.resolvedDirectory,
|
|
10845
|
+
configSourceDirectory: null
|
|
10846
|
+
});
|
|
10847
|
+
return Layer.mergeAll(Project.layerNode, configLayer, DeadCode.layerNode, Files.layerNode, Git.layerNode, Linter.layerOxlint, LintPartialFailures.layerLive, Progress.layerNoop, Reporter.layerNoop, Score.layerHttp, config?.supplyChain?.enabled !== false ? SupplyChain.layerNode : SupplyChain.layerOf([]));
|
|
10848
|
+
};
|
|
9109
10849
|
const buildInspectProgram = (scanTarget, options, configOverride) => {
|
|
9110
10850
|
const effectiveConfig = configOverride ?? scanTarget.userConfig;
|
|
9111
10851
|
const includePaths = options.includePaths ?? [];
|
|
@@ -9136,8 +10876,9 @@ const outputToDiagnoseResult = (output, elapsedMilliseconds) => {
|
|
|
9136
10876
|
};
|
|
9137
10877
|
const diagnose = async (directory, options = {}) => {
|
|
9138
10878
|
const startTime = globalThis.performance.now();
|
|
9139
|
-
const
|
|
9140
|
-
|
|
10879
|
+
const scanTarget = await resolveScanTarget(directory);
|
|
10880
|
+
const program = buildInspectProgram(scanTarget, options);
|
|
10881
|
+
return outputToDiagnoseResult(await Effect.runPromise(restoreLegacyThrow(program.pipe(Effect.provide(buildDiagnoseLayer(scanTarget.userConfig)), Effect.provide(layerOtlp)))), globalThis.performance.now() - startTime);
|
|
9141
10882
|
};
|
|
9142
10883
|
//#endregion
|
|
9143
10884
|
//#region src/index.ts
|
|
@@ -9171,4 +10912,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
9171
10912
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
9172
10913
|
|
|
9173
10914
|
//# sourceMappingURL=index.js.map
|
|
9174
|
-
//# debugId=
|
|
10915
|
+
//# debugId=50a9af23-7f4c-50ee-ab12-d23a4915d902
|