@module-federation/bridge-react-webpack-plugin 0.5.0 → 0.5.1
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/CHANGELOG.md +7 -0
- package/dist/index.cjs.js +1687 -1
- package/dist/index.es.js +1666 -1
- package/package.json +4 -2
- package/src/index.ts +4 -1
- package/src/utis.ts +89 -0
package/dist/index.es.js
CHANGED
|
@@ -6,6 +6,1670 @@ var __publicField = (obj, key, value) => {
|
|
|
6
6
|
};
|
|
7
7
|
import fs from "node:fs";
|
|
8
8
|
import path from "node:path";
|
|
9
|
+
function getDefaultExportFromCjs(x) {
|
|
10
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
11
|
+
}
|
|
12
|
+
var re$2 = { exports: {} };
|
|
13
|
+
const SEMVER_SPEC_VERSION = "2.0.0";
|
|
14
|
+
const MAX_LENGTH$1 = 256;
|
|
15
|
+
const MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
|
|
16
|
+
9007199254740991;
|
|
17
|
+
const MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
18
|
+
const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH$1 - 6;
|
|
19
|
+
const RELEASE_TYPES = [
|
|
20
|
+
"major",
|
|
21
|
+
"premajor",
|
|
22
|
+
"minor",
|
|
23
|
+
"preminor",
|
|
24
|
+
"patch",
|
|
25
|
+
"prepatch",
|
|
26
|
+
"prerelease"
|
|
27
|
+
];
|
|
28
|
+
var constants$1 = {
|
|
29
|
+
MAX_LENGTH: MAX_LENGTH$1,
|
|
30
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
31
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
32
|
+
MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1,
|
|
33
|
+
RELEASE_TYPES,
|
|
34
|
+
SEMVER_SPEC_VERSION,
|
|
35
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
36
|
+
FLAG_LOOSE: 2
|
|
37
|
+
};
|
|
38
|
+
const debug$1 = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
|
|
39
|
+
};
|
|
40
|
+
var debug_1 = debug$1;
|
|
41
|
+
(function(module, exports) {
|
|
42
|
+
const {
|
|
43
|
+
MAX_SAFE_COMPONENT_LENGTH: MAX_SAFE_COMPONENT_LENGTH2,
|
|
44
|
+
MAX_SAFE_BUILD_LENGTH: MAX_SAFE_BUILD_LENGTH2,
|
|
45
|
+
MAX_LENGTH: MAX_LENGTH2
|
|
46
|
+
} = constants$1;
|
|
47
|
+
const debug2 = debug_1;
|
|
48
|
+
exports = module.exports = {};
|
|
49
|
+
const re2 = exports.re = [];
|
|
50
|
+
const safeRe = exports.safeRe = [];
|
|
51
|
+
const src = exports.src = [];
|
|
52
|
+
const t2 = exports.t = {};
|
|
53
|
+
let R = 0;
|
|
54
|
+
const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
55
|
+
const safeRegexReplacements = [
|
|
56
|
+
["\\s", 1],
|
|
57
|
+
["\\d", MAX_LENGTH2],
|
|
58
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH2]
|
|
59
|
+
];
|
|
60
|
+
const makeSafeRegex = (value) => {
|
|
61
|
+
for (const [token, max] of safeRegexReplacements) {
|
|
62
|
+
value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
63
|
+
}
|
|
64
|
+
return value;
|
|
65
|
+
};
|
|
66
|
+
const createToken = (name, value, isGlobal) => {
|
|
67
|
+
const safe = makeSafeRegex(value);
|
|
68
|
+
const index = R++;
|
|
69
|
+
debug2(name, index, value);
|
|
70
|
+
t2[name] = index;
|
|
71
|
+
src[index] = value;
|
|
72
|
+
re2[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
|
73
|
+
safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
|
|
74
|
+
};
|
|
75
|
+
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
76
|
+
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
77
|
+
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
78
|
+
createToken("MAINVERSION", `(${src[t2.NUMERICIDENTIFIER]})\\.(${src[t2.NUMERICIDENTIFIER]})\\.(${src[t2.NUMERICIDENTIFIER]})`);
|
|
79
|
+
createToken("MAINVERSIONLOOSE", `(${src[t2.NUMERICIDENTIFIERLOOSE]})\\.(${src[t2.NUMERICIDENTIFIERLOOSE]})\\.(${src[t2.NUMERICIDENTIFIERLOOSE]})`);
|
|
80
|
+
createToken("PRERELEASEIDENTIFIER", `(?:${src[t2.NUMERICIDENTIFIER]}|${src[t2.NONNUMERICIDENTIFIER]})`);
|
|
81
|
+
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t2.NUMERICIDENTIFIERLOOSE]}|${src[t2.NONNUMERICIDENTIFIER]})`);
|
|
82
|
+
createToken("PRERELEASE", `(?:-(${src[t2.PRERELEASEIDENTIFIER]}(?:\\.${src[t2.PRERELEASEIDENTIFIER]})*))`);
|
|
83
|
+
createToken("PRERELEASELOOSE", `(?:-?(${src[t2.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t2.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
84
|
+
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
85
|
+
createToken("BUILD", `(?:\\+(${src[t2.BUILDIDENTIFIER]}(?:\\.${src[t2.BUILDIDENTIFIER]})*))`);
|
|
86
|
+
createToken("FULLPLAIN", `v?${src[t2.MAINVERSION]}${src[t2.PRERELEASE]}?${src[t2.BUILD]}?`);
|
|
87
|
+
createToken("FULL", `^${src[t2.FULLPLAIN]}$`);
|
|
88
|
+
createToken("LOOSEPLAIN", `[v=\\s]*${src[t2.MAINVERSIONLOOSE]}${src[t2.PRERELEASELOOSE]}?${src[t2.BUILD]}?`);
|
|
89
|
+
createToken("LOOSE", `^${src[t2.LOOSEPLAIN]}$`);
|
|
90
|
+
createToken("GTLT", "((?:<|>)?=?)");
|
|
91
|
+
createToken("XRANGEIDENTIFIERLOOSE", `${src[t2.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
92
|
+
createToken("XRANGEIDENTIFIER", `${src[t2.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
93
|
+
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t2.XRANGEIDENTIFIER]})(?:\\.(${src[t2.XRANGEIDENTIFIER]})(?:\\.(${src[t2.XRANGEIDENTIFIER]})(?:${src[t2.PRERELEASE]})?${src[t2.BUILD]}?)?)?`);
|
|
94
|
+
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t2.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t2.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t2.XRANGEIDENTIFIERLOOSE]})(?:${src[t2.PRERELEASELOOSE]})?${src[t2.BUILD]}?)?)?`);
|
|
95
|
+
createToken("XRANGE", `^${src[t2.GTLT]}\\s*${src[t2.XRANGEPLAIN]}$`);
|
|
96
|
+
createToken("XRANGELOOSE", `^${src[t2.GTLT]}\\s*${src[t2.XRANGEPLAINLOOSE]}$`);
|
|
97
|
+
createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH2}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH2}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH2}}))?`);
|
|
98
|
+
createToken("COERCE", `${src[t2.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
99
|
+
createToken("COERCEFULL", src[t2.COERCEPLAIN] + `(?:${src[t2.PRERELEASE]})?(?:${src[t2.BUILD]})?(?:$|[^\\d])`);
|
|
100
|
+
createToken("COERCERTL", src[t2.COERCE], true);
|
|
101
|
+
createToken("COERCERTLFULL", src[t2.COERCEFULL], true);
|
|
102
|
+
createToken("LONETILDE", "(?:~>?)");
|
|
103
|
+
createToken("TILDETRIM", `(\\s*)${src[t2.LONETILDE]}\\s+`, true);
|
|
104
|
+
exports.tildeTrimReplace = "$1~";
|
|
105
|
+
createToken("TILDE", `^${src[t2.LONETILDE]}${src[t2.XRANGEPLAIN]}$`);
|
|
106
|
+
createToken("TILDELOOSE", `^${src[t2.LONETILDE]}${src[t2.XRANGEPLAINLOOSE]}$`);
|
|
107
|
+
createToken("LONECARET", "(?:\\^)");
|
|
108
|
+
createToken("CARETTRIM", `(\\s*)${src[t2.LONECARET]}\\s+`, true);
|
|
109
|
+
exports.caretTrimReplace = "$1^";
|
|
110
|
+
createToken("CARET", `^${src[t2.LONECARET]}${src[t2.XRANGEPLAIN]}$`);
|
|
111
|
+
createToken("CARETLOOSE", `^${src[t2.LONECARET]}${src[t2.XRANGEPLAINLOOSE]}$`);
|
|
112
|
+
createToken("COMPARATORLOOSE", `^${src[t2.GTLT]}\\s*(${src[t2.LOOSEPLAIN]})$|^$`);
|
|
113
|
+
createToken("COMPARATOR", `^${src[t2.GTLT]}\\s*(${src[t2.FULLPLAIN]})$|^$`);
|
|
114
|
+
createToken("COMPARATORTRIM", `(\\s*)${src[t2.GTLT]}\\s*(${src[t2.LOOSEPLAIN]}|${src[t2.XRANGEPLAIN]})`, true);
|
|
115
|
+
exports.comparatorTrimReplace = "$1$2$3";
|
|
116
|
+
createToken("HYPHENRANGE", `^\\s*(${src[t2.XRANGEPLAIN]})\\s+-\\s+(${src[t2.XRANGEPLAIN]})\\s*$`);
|
|
117
|
+
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t2.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t2.XRANGEPLAINLOOSE]})\\s*$`);
|
|
118
|
+
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
119
|
+
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
120
|
+
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
121
|
+
})(re$2, re$2.exports);
|
|
122
|
+
var reExports = re$2.exports;
|
|
123
|
+
const looseOption = Object.freeze({ loose: true });
|
|
124
|
+
const emptyOpts = Object.freeze({});
|
|
125
|
+
const parseOptions$1 = (options) => {
|
|
126
|
+
if (!options) {
|
|
127
|
+
return emptyOpts;
|
|
128
|
+
}
|
|
129
|
+
if (typeof options !== "object") {
|
|
130
|
+
return looseOption;
|
|
131
|
+
}
|
|
132
|
+
return options;
|
|
133
|
+
};
|
|
134
|
+
var parseOptions_1 = parseOptions$1;
|
|
135
|
+
const numeric = /^[0-9]+$/;
|
|
136
|
+
const compareIdentifiers$1 = (a, b) => {
|
|
137
|
+
const anum = numeric.test(a);
|
|
138
|
+
const bnum = numeric.test(b);
|
|
139
|
+
if (anum && bnum) {
|
|
140
|
+
a = +a;
|
|
141
|
+
b = +b;
|
|
142
|
+
}
|
|
143
|
+
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
144
|
+
};
|
|
145
|
+
const rcompareIdentifiers = (a, b) => compareIdentifiers$1(b, a);
|
|
146
|
+
var identifiers$1 = {
|
|
147
|
+
compareIdentifiers: compareIdentifiers$1,
|
|
148
|
+
rcompareIdentifiers
|
|
149
|
+
};
|
|
150
|
+
const debug = debug_1;
|
|
151
|
+
const { MAX_LENGTH, MAX_SAFE_INTEGER } = constants$1;
|
|
152
|
+
const { safeRe: re$1, t: t$1 } = reExports;
|
|
153
|
+
const parseOptions = parseOptions_1;
|
|
154
|
+
const { compareIdentifiers } = identifiers$1;
|
|
155
|
+
let SemVer$d = class SemVer {
|
|
156
|
+
constructor(version, options) {
|
|
157
|
+
options = parseOptions(options);
|
|
158
|
+
if (version instanceof SemVer) {
|
|
159
|
+
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
|
|
160
|
+
return version;
|
|
161
|
+
} else {
|
|
162
|
+
version = version.version;
|
|
163
|
+
}
|
|
164
|
+
} else if (typeof version !== "string") {
|
|
165
|
+
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
166
|
+
}
|
|
167
|
+
if (version.length > MAX_LENGTH) {
|
|
168
|
+
throw new TypeError(
|
|
169
|
+
`version is longer than ${MAX_LENGTH} characters`
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
debug("SemVer", version, options);
|
|
173
|
+
this.options = options;
|
|
174
|
+
this.loose = !!options.loose;
|
|
175
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
176
|
+
const m = version.trim().match(options.loose ? re$1[t$1.LOOSE] : re$1[t$1.FULL]);
|
|
177
|
+
if (!m) {
|
|
178
|
+
throw new TypeError(`Invalid Version: ${version}`);
|
|
179
|
+
}
|
|
180
|
+
this.raw = version;
|
|
181
|
+
this.major = +m[1];
|
|
182
|
+
this.minor = +m[2];
|
|
183
|
+
this.patch = +m[3];
|
|
184
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
185
|
+
throw new TypeError("Invalid major version");
|
|
186
|
+
}
|
|
187
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
188
|
+
throw new TypeError("Invalid minor version");
|
|
189
|
+
}
|
|
190
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
191
|
+
throw new TypeError("Invalid patch version");
|
|
192
|
+
}
|
|
193
|
+
if (!m[4]) {
|
|
194
|
+
this.prerelease = [];
|
|
195
|
+
} else {
|
|
196
|
+
this.prerelease = m[4].split(".").map((id) => {
|
|
197
|
+
if (/^[0-9]+$/.test(id)) {
|
|
198
|
+
const num = +id;
|
|
199
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
200
|
+
return num;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return id;
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
this.build = m[5] ? m[5].split(".") : [];
|
|
207
|
+
this.format();
|
|
208
|
+
}
|
|
209
|
+
format() {
|
|
210
|
+
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
211
|
+
if (this.prerelease.length) {
|
|
212
|
+
this.version += `-${this.prerelease.join(".")}`;
|
|
213
|
+
}
|
|
214
|
+
return this.version;
|
|
215
|
+
}
|
|
216
|
+
toString() {
|
|
217
|
+
return this.version;
|
|
218
|
+
}
|
|
219
|
+
compare(other) {
|
|
220
|
+
debug("SemVer.compare", this.version, this.options, other);
|
|
221
|
+
if (!(other instanceof SemVer)) {
|
|
222
|
+
if (typeof other === "string" && other === this.version) {
|
|
223
|
+
return 0;
|
|
224
|
+
}
|
|
225
|
+
other = new SemVer(other, this.options);
|
|
226
|
+
}
|
|
227
|
+
if (other.version === this.version) {
|
|
228
|
+
return 0;
|
|
229
|
+
}
|
|
230
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
231
|
+
}
|
|
232
|
+
compareMain(other) {
|
|
233
|
+
if (!(other instanceof SemVer)) {
|
|
234
|
+
other = new SemVer(other, this.options);
|
|
235
|
+
}
|
|
236
|
+
return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
|
|
237
|
+
}
|
|
238
|
+
comparePre(other) {
|
|
239
|
+
if (!(other instanceof SemVer)) {
|
|
240
|
+
other = new SemVer(other, this.options);
|
|
241
|
+
}
|
|
242
|
+
if (this.prerelease.length && !other.prerelease.length) {
|
|
243
|
+
return -1;
|
|
244
|
+
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
245
|
+
return 1;
|
|
246
|
+
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
247
|
+
return 0;
|
|
248
|
+
}
|
|
249
|
+
let i = 0;
|
|
250
|
+
do {
|
|
251
|
+
const a = this.prerelease[i];
|
|
252
|
+
const b = other.prerelease[i];
|
|
253
|
+
debug("prerelease compare", i, a, b);
|
|
254
|
+
if (a === void 0 && b === void 0) {
|
|
255
|
+
return 0;
|
|
256
|
+
} else if (b === void 0) {
|
|
257
|
+
return 1;
|
|
258
|
+
} else if (a === void 0) {
|
|
259
|
+
return -1;
|
|
260
|
+
} else if (a === b) {
|
|
261
|
+
continue;
|
|
262
|
+
} else {
|
|
263
|
+
return compareIdentifiers(a, b);
|
|
264
|
+
}
|
|
265
|
+
} while (++i);
|
|
266
|
+
}
|
|
267
|
+
compareBuild(other) {
|
|
268
|
+
if (!(other instanceof SemVer)) {
|
|
269
|
+
other = new SemVer(other, this.options);
|
|
270
|
+
}
|
|
271
|
+
let i = 0;
|
|
272
|
+
do {
|
|
273
|
+
const a = this.build[i];
|
|
274
|
+
const b = other.build[i];
|
|
275
|
+
debug("build compare", i, a, b);
|
|
276
|
+
if (a === void 0 && b === void 0) {
|
|
277
|
+
return 0;
|
|
278
|
+
} else if (b === void 0) {
|
|
279
|
+
return 1;
|
|
280
|
+
} else if (a === void 0) {
|
|
281
|
+
return -1;
|
|
282
|
+
} else if (a === b) {
|
|
283
|
+
continue;
|
|
284
|
+
} else {
|
|
285
|
+
return compareIdentifiers(a, b);
|
|
286
|
+
}
|
|
287
|
+
} while (++i);
|
|
288
|
+
}
|
|
289
|
+
// preminor will bump the version up to the next minor release, and immediately
|
|
290
|
+
// down to pre-release. premajor and prepatch work the same way.
|
|
291
|
+
inc(release, identifier, identifierBase) {
|
|
292
|
+
switch (release) {
|
|
293
|
+
case "premajor":
|
|
294
|
+
this.prerelease.length = 0;
|
|
295
|
+
this.patch = 0;
|
|
296
|
+
this.minor = 0;
|
|
297
|
+
this.major++;
|
|
298
|
+
this.inc("pre", identifier, identifierBase);
|
|
299
|
+
break;
|
|
300
|
+
case "preminor":
|
|
301
|
+
this.prerelease.length = 0;
|
|
302
|
+
this.patch = 0;
|
|
303
|
+
this.minor++;
|
|
304
|
+
this.inc("pre", identifier, identifierBase);
|
|
305
|
+
break;
|
|
306
|
+
case "prepatch":
|
|
307
|
+
this.prerelease.length = 0;
|
|
308
|
+
this.inc("patch", identifier, identifierBase);
|
|
309
|
+
this.inc("pre", identifier, identifierBase);
|
|
310
|
+
break;
|
|
311
|
+
case "prerelease":
|
|
312
|
+
if (this.prerelease.length === 0) {
|
|
313
|
+
this.inc("patch", identifier, identifierBase);
|
|
314
|
+
}
|
|
315
|
+
this.inc("pre", identifier, identifierBase);
|
|
316
|
+
break;
|
|
317
|
+
case "major":
|
|
318
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
319
|
+
this.major++;
|
|
320
|
+
}
|
|
321
|
+
this.minor = 0;
|
|
322
|
+
this.patch = 0;
|
|
323
|
+
this.prerelease = [];
|
|
324
|
+
break;
|
|
325
|
+
case "minor":
|
|
326
|
+
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
327
|
+
this.minor++;
|
|
328
|
+
}
|
|
329
|
+
this.patch = 0;
|
|
330
|
+
this.prerelease = [];
|
|
331
|
+
break;
|
|
332
|
+
case "patch":
|
|
333
|
+
if (this.prerelease.length === 0) {
|
|
334
|
+
this.patch++;
|
|
335
|
+
}
|
|
336
|
+
this.prerelease = [];
|
|
337
|
+
break;
|
|
338
|
+
case "pre": {
|
|
339
|
+
const base = Number(identifierBase) ? 1 : 0;
|
|
340
|
+
if (!identifier && identifierBase === false) {
|
|
341
|
+
throw new Error("invalid increment argument: identifier is empty");
|
|
342
|
+
}
|
|
343
|
+
if (this.prerelease.length === 0) {
|
|
344
|
+
this.prerelease = [base];
|
|
345
|
+
} else {
|
|
346
|
+
let i = this.prerelease.length;
|
|
347
|
+
while (--i >= 0) {
|
|
348
|
+
if (typeof this.prerelease[i] === "number") {
|
|
349
|
+
this.prerelease[i]++;
|
|
350
|
+
i = -2;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
if (i === -1) {
|
|
354
|
+
if (identifier === this.prerelease.join(".") && identifierBase === false) {
|
|
355
|
+
throw new Error("invalid increment argument: identifier already exists");
|
|
356
|
+
}
|
|
357
|
+
this.prerelease.push(base);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
if (identifier) {
|
|
361
|
+
let prerelease2 = [identifier, base];
|
|
362
|
+
if (identifierBase === false) {
|
|
363
|
+
prerelease2 = [identifier];
|
|
364
|
+
}
|
|
365
|
+
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
|
366
|
+
if (isNaN(this.prerelease[1])) {
|
|
367
|
+
this.prerelease = prerelease2;
|
|
368
|
+
}
|
|
369
|
+
} else {
|
|
370
|
+
this.prerelease = prerelease2;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
break;
|
|
374
|
+
}
|
|
375
|
+
default:
|
|
376
|
+
throw new Error(`invalid increment argument: ${release}`);
|
|
377
|
+
}
|
|
378
|
+
this.raw = this.format();
|
|
379
|
+
if (this.build.length) {
|
|
380
|
+
this.raw += `+${this.build.join(".")}`;
|
|
381
|
+
}
|
|
382
|
+
return this;
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
var semver$2 = SemVer$d;
|
|
386
|
+
const SemVer$c = semver$2;
|
|
387
|
+
const parse$6 = (version, options, throwErrors = false) => {
|
|
388
|
+
if (version instanceof SemVer$c) {
|
|
389
|
+
return version;
|
|
390
|
+
}
|
|
391
|
+
try {
|
|
392
|
+
return new SemVer$c(version, options);
|
|
393
|
+
} catch (er) {
|
|
394
|
+
if (!throwErrors) {
|
|
395
|
+
return null;
|
|
396
|
+
}
|
|
397
|
+
throw er;
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
var parse_1 = parse$6;
|
|
401
|
+
const parse$5 = parse_1;
|
|
402
|
+
const valid$2 = (version, options) => {
|
|
403
|
+
const v = parse$5(version, options);
|
|
404
|
+
return v ? v.version : null;
|
|
405
|
+
};
|
|
406
|
+
var valid_1 = valid$2;
|
|
407
|
+
const parse$4 = parse_1;
|
|
408
|
+
const clean$1 = (version, options) => {
|
|
409
|
+
const s = parse$4(version.trim().replace(/^[=v]+/, ""), options);
|
|
410
|
+
return s ? s.version : null;
|
|
411
|
+
};
|
|
412
|
+
var clean_1 = clean$1;
|
|
413
|
+
const SemVer$b = semver$2;
|
|
414
|
+
const inc$1 = (version, release, options, identifier, identifierBase) => {
|
|
415
|
+
if (typeof options === "string") {
|
|
416
|
+
identifierBase = identifier;
|
|
417
|
+
identifier = options;
|
|
418
|
+
options = void 0;
|
|
419
|
+
}
|
|
420
|
+
try {
|
|
421
|
+
return new SemVer$b(
|
|
422
|
+
version instanceof SemVer$b ? version.version : version,
|
|
423
|
+
options
|
|
424
|
+
).inc(release, identifier, identifierBase).version;
|
|
425
|
+
} catch (er) {
|
|
426
|
+
return null;
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
var inc_1 = inc$1;
|
|
430
|
+
const parse$3 = parse_1;
|
|
431
|
+
const diff$1 = (version1, version2) => {
|
|
432
|
+
const v1 = parse$3(version1, null, true);
|
|
433
|
+
const v2 = parse$3(version2, null, true);
|
|
434
|
+
const comparison = v1.compare(v2);
|
|
435
|
+
if (comparison === 0) {
|
|
436
|
+
return null;
|
|
437
|
+
}
|
|
438
|
+
const v1Higher = comparison > 0;
|
|
439
|
+
const highVersion = v1Higher ? v1 : v2;
|
|
440
|
+
const lowVersion = v1Higher ? v2 : v1;
|
|
441
|
+
const highHasPre = !!highVersion.prerelease.length;
|
|
442
|
+
const lowHasPre = !!lowVersion.prerelease.length;
|
|
443
|
+
if (lowHasPre && !highHasPre) {
|
|
444
|
+
if (!lowVersion.patch && !lowVersion.minor) {
|
|
445
|
+
return "major";
|
|
446
|
+
}
|
|
447
|
+
if (highVersion.patch) {
|
|
448
|
+
return "patch";
|
|
449
|
+
}
|
|
450
|
+
if (highVersion.minor) {
|
|
451
|
+
return "minor";
|
|
452
|
+
}
|
|
453
|
+
return "major";
|
|
454
|
+
}
|
|
455
|
+
const prefix = highHasPre ? "pre" : "";
|
|
456
|
+
if (v1.major !== v2.major) {
|
|
457
|
+
return prefix + "major";
|
|
458
|
+
}
|
|
459
|
+
if (v1.minor !== v2.minor) {
|
|
460
|
+
return prefix + "minor";
|
|
461
|
+
}
|
|
462
|
+
if (v1.patch !== v2.patch) {
|
|
463
|
+
return prefix + "patch";
|
|
464
|
+
}
|
|
465
|
+
return "prerelease";
|
|
466
|
+
};
|
|
467
|
+
var diff_1 = diff$1;
|
|
468
|
+
const SemVer$a = semver$2;
|
|
469
|
+
const major$1 = (a, loose) => new SemVer$a(a, loose).major;
|
|
470
|
+
var major_1 = major$1;
|
|
471
|
+
const SemVer$9 = semver$2;
|
|
472
|
+
const minor$1 = (a, loose) => new SemVer$9(a, loose).minor;
|
|
473
|
+
var minor_1 = minor$1;
|
|
474
|
+
const SemVer$8 = semver$2;
|
|
475
|
+
const patch$1 = (a, loose) => new SemVer$8(a, loose).patch;
|
|
476
|
+
var patch_1 = patch$1;
|
|
477
|
+
const parse$2 = parse_1;
|
|
478
|
+
const prerelease$1 = (version, options) => {
|
|
479
|
+
const parsed = parse$2(version, options);
|
|
480
|
+
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
481
|
+
};
|
|
482
|
+
var prerelease_1 = prerelease$1;
|
|
483
|
+
const SemVer$7 = semver$2;
|
|
484
|
+
const compare$b = (a, b, loose) => new SemVer$7(a, loose).compare(new SemVer$7(b, loose));
|
|
485
|
+
var compare_1 = compare$b;
|
|
486
|
+
const compare$a = compare_1;
|
|
487
|
+
const rcompare$1 = (a, b, loose) => compare$a(b, a, loose);
|
|
488
|
+
var rcompare_1 = rcompare$1;
|
|
489
|
+
const compare$9 = compare_1;
|
|
490
|
+
const compareLoose$1 = (a, b) => compare$9(a, b, true);
|
|
491
|
+
var compareLoose_1 = compareLoose$1;
|
|
492
|
+
const SemVer$6 = semver$2;
|
|
493
|
+
const compareBuild$3 = (a, b, loose) => {
|
|
494
|
+
const versionA = new SemVer$6(a, loose);
|
|
495
|
+
const versionB = new SemVer$6(b, loose);
|
|
496
|
+
return versionA.compare(versionB) || versionA.compareBuild(versionB);
|
|
497
|
+
};
|
|
498
|
+
var compareBuild_1 = compareBuild$3;
|
|
499
|
+
const compareBuild$2 = compareBuild_1;
|
|
500
|
+
const sort$1 = (list, loose) => list.sort((a, b) => compareBuild$2(a, b, loose));
|
|
501
|
+
var sort_1 = sort$1;
|
|
502
|
+
const compareBuild$1 = compareBuild_1;
|
|
503
|
+
const rsort$1 = (list, loose) => list.sort((a, b) => compareBuild$1(b, a, loose));
|
|
504
|
+
var rsort_1 = rsort$1;
|
|
505
|
+
const compare$8 = compare_1;
|
|
506
|
+
const gt$4 = (a, b, loose) => compare$8(a, b, loose) > 0;
|
|
507
|
+
var gt_1 = gt$4;
|
|
508
|
+
const compare$7 = compare_1;
|
|
509
|
+
const lt$3 = (a, b, loose) => compare$7(a, b, loose) < 0;
|
|
510
|
+
var lt_1 = lt$3;
|
|
511
|
+
const compare$6 = compare_1;
|
|
512
|
+
const eq$2 = (a, b, loose) => compare$6(a, b, loose) === 0;
|
|
513
|
+
var eq_1 = eq$2;
|
|
514
|
+
const compare$5 = compare_1;
|
|
515
|
+
const neq$2 = (a, b, loose) => compare$5(a, b, loose) !== 0;
|
|
516
|
+
var neq_1 = neq$2;
|
|
517
|
+
const compare$4 = compare_1;
|
|
518
|
+
const gte$3 = (a, b, loose) => compare$4(a, b, loose) >= 0;
|
|
519
|
+
var gte_1 = gte$3;
|
|
520
|
+
const compare$3 = compare_1;
|
|
521
|
+
const lte$3 = (a, b, loose) => compare$3(a, b, loose) <= 0;
|
|
522
|
+
var lte_1 = lte$3;
|
|
523
|
+
const eq$1 = eq_1;
|
|
524
|
+
const neq$1 = neq_1;
|
|
525
|
+
const gt$3 = gt_1;
|
|
526
|
+
const gte$2 = gte_1;
|
|
527
|
+
const lt$2 = lt_1;
|
|
528
|
+
const lte$2 = lte_1;
|
|
529
|
+
const cmp$1 = (a, op, b, loose) => {
|
|
530
|
+
switch (op) {
|
|
531
|
+
case "===":
|
|
532
|
+
if (typeof a === "object") {
|
|
533
|
+
a = a.version;
|
|
534
|
+
}
|
|
535
|
+
if (typeof b === "object") {
|
|
536
|
+
b = b.version;
|
|
537
|
+
}
|
|
538
|
+
return a === b;
|
|
539
|
+
case "!==":
|
|
540
|
+
if (typeof a === "object") {
|
|
541
|
+
a = a.version;
|
|
542
|
+
}
|
|
543
|
+
if (typeof b === "object") {
|
|
544
|
+
b = b.version;
|
|
545
|
+
}
|
|
546
|
+
return a !== b;
|
|
547
|
+
case "":
|
|
548
|
+
case "=":
|
|
549
|
+
case "==":
|
|
550
|
+
return eq$1(a, b, loose);
|
|
551
|
+
case "!=":
|
|
552
|
+
return neq$1(a, b, loose);
|
|
553
|
+
case ">":
|
|
554
|
+
return gt$3(a, b, loose);
|
|
555
|
+
case ">=":
|
|
556
|
+
return gte$2(a, b, loose);
|
|
557
|
+
case "<":
|
|
558
|
+
return lt$2(a, b, loose);
|
|
559
|
+
case "<=":
|
|
560
|
+
return lte$2(a, b, loose);
|
|
561
|
+
default:
|
|
562
|
+
throw new TypeError(`Invalid operator: ${op}`);
|
|
563
|
+
}
|
|
564
|
+
};
|
|
565
|
+
var cmp_1 = cmp$1;
|
|
566
|
+
const SemVer$5 = semver$2;
|
|
567
|
+
const parse$1 = parse_1;
|
|
568
|
+
const { safeRe: re, t } = reExports;
|
|
569
|
+
const coerce$1 = (version, options) => {
|
|
570
|
+
if (version instanceof SemVer$5) {
|
|
571
|
+
return version;
|
|
572
|
+
}
|
|
573
|
+
if (typeof version === "number") {
|
|
574
|
+
version = String(version);
|
|
575
|
+
}
|
|
576
|
+
if (typeof version !== "string") {
|
|
577
|
+
return null;
|
|
578
|
+
}
|
|
579
|
+
options = options || {};
|
|
580
|
+
let match = null;
|
|
581
|
+
if (!options.rtl) {
|
|
582
|
+
match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
|
|
583
|
+
} else {
|
|
584
|
+
const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
|
|
585
|
+
let next;
|
|
586
|
+
while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
|
|
587
|
+
if (!match || next.index + next[0].length !== match.index + match[0].length) {
|
|
588
|
+
match = next;
|
|
589
|
+
}
|
|
590
|
+
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
|
|
591
|
+
}
|
|
592
|
+
coerceRtlRegex.lastIndex = -1;
|
|
593
|
+
}
|
|
594
|
+
if (match === null) {
|
|
595
|
+
return null;
|
|
596
|
+
}
|
|
597
|
+
const major2 = match[2];
|
|
598
|
+
const minor2 = match[3] || "0";
|
|
599
|
+
const patch2 = match[4] || "0";
|
|
600
|
+
const prerelease2 = options.includePrerelease && match[5] ? `-${match[5]}` : "";
|
|
601
|
+
const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
|
|
602
|
+
return parse$1(`${major2}.${minor2}.${patch2}${prerelease2}${build}`, options);
|
|
603
|
+
};
|
|
604
|
+
var coerce_1 = coerce$1;
|
|
605
|
+
class LRUCache {
|
|
606
|
+
constructor() {
|
|
607
|
+
this.max = 1e3;
|
|
608
|
+
this.map = /* @__PURE__ */ new Map();
|
|
609
|
+
}
|
|
610
|
+
get(key) {
|
|
611
|
+
const value = this.map.get(key);
|
|
612
|
+
if (value === void 0) {
|
|
613
|
+
return void 0;
|
|
614
|
+
} else {
|
|
615
|
+
this.map.delete(key);
|
|
616
|
+
this.map.set(key, value);
|
|
617
|
+
return value;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
delete(key) {
|
|
621
|
+
return this.map.delete(key);
|
|
622
|
+
}
|
|
623
|
+
set(key, value) {
|
|
624
|
+
const deleted = this.delete(key);
|
|
625
|
+
if (!deleted && value !== void 0) {
|
|
626
|
+
if (this.map.size >= this.max) {
|
|
627
|
+
const firstKey = this.map.keys().next().value;
|
|
628
|
+
this.delete(firstKey);
|
|
629
|
+
}
|
|
630
|
+
this.map.set(key, value);
|
|
631
|
+
}
|
|
632
|
+
return this;
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
var lrucache = LRUCache;
|
|
636
|
+
var range;
|
|
637
|
+
var hasRequiredRange;
|
|
638
|
+
function requireRange() {
|
|
639
|
+
if (hasRequiredRange)
|
|
640
|
+
return range;
|
|
641
|
+
hasRequiredRange = 1;
|
|
642
|
+
const SPACE_CHARACTERS = /\s+/g;
|
|
643
|
+
class Range2 {
|
|
644
|
+
constructor(range2, options) {
|
|
645
|
+
options = parseOptions2(options);
|
|
646
|
+
if (range2 instanceof Range2) {
|
|
647
|
+
if (range2.loose === !!options.loose && range2.includePrerelease === !!options.includePrerelease) {
|
|
648
|
+
return range2;
|
|
649
|
+
} else {
|
|
650
|
+
return new Range2(range2.raw, options);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
if (range2 instanceof Comparator2) {
|
|
654
|
+
this.raw = range2.value;
|
|
655
|
+
this.set = [[range2]];
|
|
656
|
+
this.formatted = void 0;
|
|
657
|
+
return this;
|
|
658
|
+
}
|
|
659
|
+
this.options = options;
|
|
660
|
+
this.loose = !!options.loose;
|
|
661
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
662
|
+
this.raw = range2.trim().replace(SPACE_CHARACTERS, " ");
|
|
663
|
+
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
664
|
+
if (!this.set.length) {
|
|
665
|
+
throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
666
|
+
}
|
|
667
|
+
if (this.set.length > 1) {
|
|
668
|
+
const first = this.set[0];
|
|
669
|
+
this.set = this.set.filter((c) => !isNullSet(c[0]));
|
|
670
|
+
if (this.set.length === 0) {
|
|
671
|
+
this.set = [first];
|
|
672
|
+
} else if (this.set.length > 1) {
|
|
673
|
+
for (const c of this.set) {
|
|
674
|
+
if (c.length === 1 && isAny(c[0])) {
|
|
675
|
+
this.set = [c];
|
|
676
|
+
break;
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
this.formatted = void 0;
|
|
682
|
+
}
|
|
683
|
+
get range() {
|
|
684
|
+
if (this.formatted === void 0) {
|
|
685
|
+
this.formatted = "";
|
|
686
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
687
|
+
if (i > 0) {
|
|
688
|
+
this.formatted += "||";
|
|
689
|
+
}
|
|
690
|
+
const comps = this.set[i];
|
|
691
|
+
for (let k = 0; k < comps.length; k++) {
|
|
692
|
+
if (k > 0) {
|
|
693
|
+
this.formatted += " ";
|
|
694
|
+
}
|
|
695
|
+
this.formatted += comps[k].toString().trim();
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
return this.formatted;
|
|
700
|
+
}
|
|
701
|
+
format() {
|
|
702
|
+
return this.range;
|
|
703
|
+
}
|
|
704
|
+
toString() {
|
|
705
|
+
return this.range;
|
|
706
|
+
}
|
|
707
|
+
parseRange(range2) {
|
|
708
|
+
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
|
|
709
|
+
const memoKey = memoOpts + ":" + range2;
|
|
710
|
+
const cached = cache.get(memoKey);
|
|
711
|
+
if (cached) {
|
|
712
|
+
return cached;
|
|
713
|
+
}
|
|
714
|
+
const loose = this.options.loose;
|
|
715
|
+
const hr = loose ? re2[t2.HYPHENRANGELOOSE] : re2[t2.HYPHENRANGE];
|
|
716
|
+
range2 = range2.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
717
|
+
debug2("hyphen replace", range2);
|
|
718
|
+
range2 = range2.replace(re2[t2.COMPARATORTRIM], comparatorTrimReplace);
|
|
719
|
+
debug2("comparator trim", range2);
|
|
720
|
+
range2 = range2.replace(re2[t2.TILDETRIM], tildeTrimReplace);
|
|
721
|
+
debug2("tilde trim", range2);
|
|
722
|
+
range2 = range2.replace(re2[t2.CARETTRIM], caretTrimReplace);
|
|
723
|
+
debug2("caret trim", range2);
|
|
724
|
+
let rangeList = range2.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
725
|
+
if (loose) {
|
|
726
|
+
rangeList = rangeList.filter((comp) => {
|
|
727
|
+
debug2("loose invalid filter", comp, this.options);
|
|
728
|
+
return !!comp.match(re2[t2.COMPARATORLOOSE]);
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
debug2("range list", rangeList);
|
|
732
|
+
const rangeMap = /* @__PURE__ */ new Map();
|
|
733
|
+
const comparators = rangeList.map((comp) => new Comparator2(comp, this.options));
|
|
734
|
+
for (const comp of comparators) {
|
|
735
|
+
if (isNullSet(comp)) {
|
|
736
|
+
return [comp];
|
|
737
|
+
}
|
|
738
|
+
rangeMap.set(comp.value, comp);
|
|
739
|
+
}
|
|
740
|
+
if (rangeMap.size > 1 && rangeMap.has("")) {
|
|
741
|
+
rangeMap.delete("");
|
|
742
|
+
}
|
|
743
|
+
const result = [...rangeMap.values()];
|
|
744
|
+
cache.set(memoKey, result);
|
|
745
|
+
return result;
|
|
746
|
+
}
|
|
747
|
+
intersects(range2, options) {
|
|
748
|
+
if (!(range2 instanceof Range2)) {
|
|
749
|
+
throw new TypeError("a Range is required");
|
|
750
|
+
}
|
|
751
|
+
return this.set.some((thisComparators) => {
|
|
752
|
+
return isSatisfiable(thisComparators, options) && range2.set.some((rangeComparators) => {
|
|
753
|
+
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
754
|
+
return rangeComparators.every((rangeComparator) => {
|
|
755
|
+
return thisComparator.intersects(rangeComparator, options);
|
|
756
|
+
});
|
|
757
|
+
});
|
|
758
|
+
});
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
// if ANY of the sets match ALL of its comparators, then pass
|
|
762
|
+
test(version) {
|
|
763
|
+
if (!version) {
|
|
764
|
+
return false;
|
|
765
|
+
}
|
|
766
|
+
if (typeof version === "string") {
|
|
767
|
+
try {
|
|
768
|
+
version = new SemVer3(version, this.options);
|
|
769
|
+
} catch (er) {
|
|
770
|
+
return false;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
774
|
+
if (testSet(this.set[i], version, this.options)) {
|
|
775
|
+
return true;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
return false;
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
range = Range2;
|
|
782
|
+
const LRU = lrucache;
|
|
783
|
+
const cache = new LRU();
|
|
784
|
+
const parseOptions2 = parseOptions_1;
|
|
785
|
+
const Comparator2 = requireComparator();
|
|
786
|
+
const debug2 = debug_1;
|
|
787
|
+
const SemVer3 = semver$2;
|
|
788
|
+
const {
|
|
789
|
+
safeRe: re2,
|
|
790
|
+
t: t2,
|
|
791
|
+
comparatorTrimReplace,
|
|
792
|
+
tildeTrimReplace,
|
|
793
|
+
caretTrimReplace
|
|
794
|
+
} = reExports;
|
|
795
|
+
const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = constants$1;
|
|
796
|
+
const isNullSet = (c) => c.value === "<0.0.0-0";
|
|
797
|
+
const isAny = (c) => c.value === "";
|
|
798
|
+
const isSatisfiable = (comparators, options) => {
|
|
799
|
+
let result = true;
|
|
800
|
+
const remainingComparators = comparators.slice();
|
|
801
|
+
let testComparator = remainingComparators.pop();
|
|
802
|
+
while (result && remainingComparators.length) {
|
|
803
|
+
result = remainingComparators.every((otherComparator) => {
|
|
804
|
+
return testComparator.intersects(otherComparator, options);
|
|
805
|
+
});
|
|
806
|
+
testComparator = remainingComparators.pop();
|
|
807
|
+
}
|
|
808
|
+
return result;
|
|
809
|
+
};
|
|
810
|
+
const parseComparator = (comp, options) => {
|
|
811
|
+
debug2("comp", comp, options);
|
|
812
|
+
comp = replaceCarets(comp, options);
|
|
813
|
+
debug2("caret", comp);
|
|
814
|
+
comp = replaceTildes(comp, options);
|
|
815
|
+
debug2("tildes", comp);
|
|
816
|
+
comp = replaceXRanges(comp, options);
|
|
817
|
+
debug2("xrange", comp);
|
|
818
|
+
comp = replaceStars(comp, options);
|
|
819
|
+
debug2("stars", comp);
|
|
820
|
+
return comp;
|
|
821
|
+
};
|
|
822
|
+
const isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
823
|
+
const replaceTildes = (comp, options) => {
|
|
824
|
+
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
825
|
+
};
|
|
826
|
+
const replaceTilde = (comp, options) => {
|
|
827
|
+
const r = options.loose ? re2[t2.TILDELOOSE] : re2[t2.TILDE];
|
|
828
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
829
|
+
debug2("tilde", comp, _, M, m, p, pr);
|
|
830
|
+
let ret;
|
|
831
|
+
if (isX(M)) {
|
|
832
|
+
ret = "";
|
|
833
|
+
} else if (isX(m)) {
|
|
834
|
+
ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
|
|
835
|
+
} else if (isX(p)) {
|
|
836
|
+
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
|
|
837
|
+
} else if (pr) {
|
|
838
|
+
debug2("replaceTilde pr", pr);
|
|
839
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
840
|
+
} else {
|
|
841
|
+
ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
842
|
+
}
|
|
843
|
+
debug2("tilde return", ret);
|
|
844
|
+
return ret;
|
|
845
|
+
});
|
|
846
|
+
};
|
|
847
|
+
const replaceCarets = (comp, options) => {
|
|
848
|
+
return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
|
|
849
|
+
};
|
|
850
|
+
const replaceCaret = (comp, options) => {
|
|
851
|
+
debug2("caret", comp, options);
|
|
852
|
+
const r = options.loose ? re2[t2.CARETLOOSE] : re2[t2.CARET];
|
|
853
|
+
const z = options.includePrerelease ? "-0" : "";
|
|
854
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
855
|
+
debug2("caret", comp, _, M, m, p, pr);
|
|
856
|
+
let ret;
|
|
857
|
+
if (isX(M)) {
|
|
858
|
+
ret = "";
|
|
859
|
+
} else if (isX(m)) {
|
|
860
|
+
ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
861
|
+
} else if (isX(p)) {
|
|
862
|
+
if (M === "0") {
|
|
863
|
+
ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
864
|
+
} else {
|
|
865
|
+
ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
866
|
+
}
|
|
867
|
+
} else if (pr) {
|
|
868
|
+
debug2("replaceCaret pr", pr);
|
|
869
|
+
if (M === "0") {
|
|
870
|
+
if (m === "0") {
|
|
871
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
|
872
|
+
} else {
|
|
873
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
874
|
+
}
|
|
875
|
+
} else {
|
|
876
|
+
ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
877
|
+
}
|
|
878
|
+
} else {
|
|
879
|
+
debug2("no pr");
|
|
880
|
+
if (M === "0") {
|
|
881
|
+
if (m === "0") {
|
|
882
|
+
ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
|
|
883
|
+
} else {
|
|
884
|
+
ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
|
|
885
|
+
}
|
|
886
|
+
} else {
|
|
887
|
+
ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
debug2("caret return", ret);
|
|
891
|
+
return ret;
|
|
892
|
+
});
|
|
893
|
+
};
|
|
894
|
+
const replaceXRanges = (comp, options) => {
|
|
895
|
+
debug2("replaceXRanges", comp, options);
|
|
896
|
+
return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
|
|
897
|
+
};
|
|
898
|
+
const replaceXRange = (comp, options) => {
|
|
899
|
+
comp = comp.trim();
|
|
900
|
+
const r = options.loose ? re2[t2.XRANGELOOSE] : re2[t2.XRANGE];
|
|
901
|
+
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
902
|
+
debug2("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
903
|
+
const xM = isX(M);
|
|
904
|
+
const xm = xM || isX(m);
|
|
905
|
+
const xp = xm || isX(p);
|
|
906
|
+
const anyX = xp;
|
|
907
|
+
if (gtlt === "=" && anyX) {
|
|
908
|
+
gtlt = "";
|
|
909
|
+
}
|
|
910
|
+
pr = options.includePrerelease ? "-0" : "";
|
|
911
|
+
if (xM) {
|
|
912
|
+
if (gtlt === ">" || gtlt === "<") {
|
|
913
|
+
ret = "<0.0.0-0";
|
|
914
|
+
} else {
|
|
915
|
+
ret = "*";
|
|
916
|
+
}
|
|
917
|
+
} else if (gtlt && anyX) {
|
|
918
|
+
if (xm) {
|
|
919
|
+
m = 0;
|
|
920
|
+
}
|
|
921
|
+
p = 0;
|
|
922
|
+
if (gtlt === ">") {
|
|
923
|
+
gtlt = ">=";
|
|
924
|
+
if (xm) {
|
|
925
|
+
M = +M + 1;
|
|
926
|
+
m = 0;
|
|
927
|
+
p = 0;
|
|
928
|
+
} else {
|
|
929
|
+
m = +m + 1;
|
|
930
|
+
p = 0;
|
|
931
|
+
}
|
|
932
|
+
} else if (gtlt === "<=") {
|
|
933
|
+
gtlt = "<";
|
|
934
|
+
if (xm) {
|
|
935
|
+
M = +M + 1;
|
|
936
|
+
} else {
|
|
937
|
+
m = +m + 1;
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
if (gtlt === "<") {
|
|
941
|
+
pr = "-0";
|
|
942
|
+
}
|
|
943
|
+
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
944
|
+
} else if (xm) {
|
|
945
|
+
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
946
|
+
} else if (xp) {
|
|
947
|
+
ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
|
|
948
|
+
}
|
|
949
|
+
debug2("xRange return", ret);
|
|
950
|
+
return ret;
|
|
951
|
+
});
|
|
952
|
+
};
|
|
953
|
+
const replaceStars = (comp, options) => {
|
|
954
|
+
debug2("replaceStars", comp, options);
|
|
955
|
+
return comp.trim().replace(re2[t2.STAR], "");
|
|
956
|
+
};
|
|
957
|
+
const replaceGTE0 = (comp, options) => {
|
|
958
|
+
debug2("replaceGTE0", comp, options);
|
|
959
|
+
return comp.trim().replace(re2[options.includePrerelease ? t2.GTE0PRE : t2.GTE0], "");
|
|
960
|
+
};
|
|
961
|
+
const hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
962
|
+
if (isX(fM)) {
|
|
963
|
+
from = "";
|
|
964
|
+
} else if (isX(fm)) {
|
|
965
|
+
from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
|
966
|
+
} else if (isX(fp)) {
|
|
967
|
+
from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
|
968
|
+
} else if (fpr) {
|
|
969
|
+
from = `>=${from}`;
|
|
970
|
+
} else {
|
|
971
|
+
from = `>=${from}${incPr ? "-0" : ""}`;
|
|
972
|
+
}
|
|
973
|
+
if (isX(tM)) {
|
|
974
|
+
to = "";
|
|
975
|
+
} else if (isX(tm)) {
|
|
976
|
+
to = `<${+tM + 1}.0.0-0`;
|
|
977
|
+
} else if (isX(tp)) {
|
|
978
|
+
to = `<${tM}.${+tm + 1}.0-0`;
|
|
979
|
+
} else if (tpr) {
|
|
980
|
+
to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
981
|
+
} else if (incPr) {
|
|
982
|
+
to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
983
|
+
} else {
|
|
984
|
+
to = `<=${to}`;
|
|
985
|
+
}
|
|
986
|
+
return `${from} ${to}`.trim();
|
|
987
|
+
};
|
|
988
|
+
const testSet = (set, version, options) => {
|
|
989
|
+
for (let i = 0; i < set.length; i++) {
|
|
990
|
+
if (!set[i].test(version)) {
|
|
991
|
+
return false;
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
if (version.prerelease.length && !options.includePrerelease) {
|
|
995
|
+
for (let i = 0; i < set.length; i++) {
|
|
996
|
+
debug2(set[i].semver);
|
|
997
|
+
if (set[i].semver === Comparator2.ANY) {
|
|
998
|
+
continue;
|
|
999
|
+
}
|
|
1000
|
+
if (set[i].semver.prerelease.length > 0) {
|
|
1001
|
+
const allowed = set[i].semver;
|
|
1002
|
+
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
|
|
1003
|
+
return true;
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
return false;
|
|
1008
|
+
}
|
|
1009
|
+
return true;
|
|
1010
|
+
};
|
|
1011
|
+
return range;
|
|
1012
|
+
}
|
|
1013
|
+
var comparator;
|
|
1014
|
+
var hasRequiredComparator;
|
|
1015
|
+
function requireComparator() {
|
|
1016
|
+
if (hasRequiredComparator)
|
|
1017
|
+
return comparator;
|
|
1018
|
+
hasRequiredComparator = 1;
|
|
1019
|
+
const ANY2 = Symbol("SemVer ANY");
|
|
1020
|
+
class Comparator2 {
|
|
1021
|
+
static get ANY() {
|
|
1022
|
+
return ANY2;
|
|
1023
|
+
}
|
|
1024
|
+
constructor(comp, options) {
|
|
1025
|
+
options = parseOptions2(options);
|
|
1026
|
+
if (comp instanceof Comparator2) {
|
|
1027
|
+
if (comp.loose === !!options.loose) {
|
|
1028
|
+
return comp;
|
|
1029
|
+
} else {
|
|
1030
|
+
comp = comp.value;
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
comp = comp.trim().split(/\s+/).join(" ");
|
|
1034
|
+
debug2("comparator", comp, options);
|
|
1035
|
+
this.options = options;
|
|
1036
|
+
this.loose = !!options.loose;
|
|
1037
|
+
this.parse(comp);
|
|
1038
|
+
if (this.semver === ANY2) {
|
|
1039
|
+
this.value = "";
|
|
1040
|
+
} else {
|
|
1041
|
+
this.value = this.operator + this.semver.version;
|
|
1042
|
+
}
|
|
1043
|
+
debug2("comp", this);
|
|
1044
|
+
}
|
|
1045
|
+
parse(comp) {
|
|
1046
|
+
const r = this.options.loose ? re2[t2.COMPARATORLOOSE] : re2[t2.COMPARATOR];
|
|
1047
|
+
const m = comp.match(r);
|
|
1048
|
+
if (!m) {
|
|
1049
|
+
throw new TypeError(`Invalid comparator: ${comp}`);
|
|
1050
|
+
}
|
|
1051
|
+
this.operator = m[1] !== void 0 ? m[1] : "";
|
|
1052
|
+
if (this.operator === "=") {
|
|
1053
|
+
this.operator = "";
|
|
1054
|
+
}
|
|
1055
|
+
if (!m[2]) {
|
|
1056
|
+
this.semver = ANY2;
|
|
1057
|
+
} else {
|
|
1058
|
+
this.semver = new SemVer3(m[2], this.options.loose);
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
toString() {
|
|
1062
|
+
return this.value;
|
|
1063
|
+
}
|
|
1064
|
+
test(version) {
|
|
1065
|
+
debug2("Comparator.test", version, this.options.loose);
|
|
1066
|
+
if (this.semver === ANY2 || version === ANY2) {
|
|
1067
|
+
return true;
|
|
1068
|
+
}
|
|
1069
|
+
if (typeof version === "string") {
|
|
1070
|
+
try {
|
|
1071
|
+
version = new SemVer3(version, this.options);
|
|
1072
|
+
} catch (er) {
|
|
1073
|
+
return false;
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
return cmp2(version, this.operator, this.semver, this.options);
|
|
1077
|
+
}
|
|
1078
|
+
intersects(comp, options) {
|
|
1079
|
+
if (!(comp instanceof Comparator2)) {
|
|
1080
|
+
throw new TypeError("a Comparator is required");
|
|
1081
|
+
}
|
|
1082
|
+
if (this.operator === "") {
|
|
1083
|
+
if (this.value === "") {
|
|
1084
|
+
return true;
|
|
1085
|
+
}
|
|
1086
|
+
return new Range2(comp.value, options).test(this.value);
|
|
1087
|
+
} else if (comp.operator === "") {
|
|
1088
|
+
if (comp.value === "") {
|
|
1089
|
+
return true;
|
|
1090
|
+
}
|
|
1091
|
+
return new Range2(this.value, options).test(comp.semver);
|
|
1092
|
+
}
|
|
1093
|
+
options = parseOptions2(options);
|
|
1094
|
+
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
|
|
1095
|
+
return false;
|
|
1096
|
+
}
|
|
1097
|
+
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
|
|
1098
|
+
return false;
|
|
1099
|
+
}
|
|
1100
|
+
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
|
|
1101
|
+
return true;
|
|
1102
|
+
}
|
|
1103
|
+
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
|
|
1104
|
+
return true;
|
|
1105
|
+
}
|
|
1106
|
+
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
|
|
1107
|
+
return true;
|
|
1108
|
+
}
|
|
1109
|
+
if (cmp2(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
|
|
1110
|
+
return true;
|
|
1111
|
+
}
|
|
1112
|
+
if (cmp2(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
|
|
1113
|
+
return true;
|
|
1114
|
+
}
|
|
1115
|
+
return false;
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
comparator = Comparator2;
|
|
1119
|
+
const parseOptions2 = parseOptions_1;
|
|
1120
|
+
const { safeRe: re2, t: t2 } = reExports;
|
|
1121
|
+
const cmp2 = cmp_1;
|
|
1122
|
+
const debug2 = debug_1;
|
|
1123
|
+
const SemVer3 = semver$2;
|
|
1124
|
+
const Range2 = requireRange();
|
|
1125
|
+
return comparator;
|
|
1126
|
+
}
|
|
1127
|
+
const Range$9 = requireRange();
|
|
1128
|
+
const satisfies$4 = (version, range2, options) => {
|
|
1129
|
+
try {
|
|
1130
|
+
range2 = new Range$9(range2, options);
|
|
1131
|
+
} catch (er) {
|
|
1132
|
+
return false;
|
|
1133
|
+
}
|
|
1134
|
+
return range2.test(version);
|
|
1135
|
+
};
|
|
1136
|
+
var satisfies_1 = satisfies$4;
|
|
1137
|
+
const Range$8 = requireRange();
|
|
1138
|
+
const toComparators$1 = (range2, options) => new Range$8(range2, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
1139
|
+
var toComparators_1 = toComparators$1;
|
|
1140
|
+
const SemVer$4 = semver$2;
|
|
1141
|
+
const Range$7 = requireRange();
|
|
1142
|
+
const maxSatisfying$1 = (versions, range2, options) => {
|
|
1143
|
+
let max = null;
|
|
1144
|
+
let maxSV = null;
|
|
1145
|
+
let rangeObj = null;
|
|
1146
|
+
try {
|
|
1147
|
+
rangeObj = new Range$7(range2, options);
|
|
1148
|
+
} catch (er) {
|
|
1149
|
+
return null;
|
|
1150
|
+
}
|
|
1151
|
+
versions.forEach((v) => {
|
|
1152
|
+
if (rangeObj.test(v)) {
|
|
1153
|
+
if (!max || maxSV.compare(v) === -1) {
|
|
1154
|
+
max = v;
|
|
1155
|
+
maxSV = new SemVer$4(max, options);
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
});
|
|
1159
|
+
return max;
|
|
1160
|
+
};
|
|
1161
|
+
var maxSatisfying_1 = maxSatisfying$1;
|
|
1162
|
+
const SemVer$3 = semver$2;
|
|
1163
|
+
const Range$6 = requireRange();
|
|
1164
|
+
const minSatisfying$1 = (versions, range2, options) => {
|
|
1165
|
+
let min = null;
|
|
1166
|
+
let minSV = null;
|
|
1167
|
+
let rangeObj = null;
|
|
1168
|
+
try {
|
|
1169
|
+
rangeObj = new Range$6(range2, options);
|
|
1170
|
+
} catch (er) {
|
|
1171
|
+
return null;
|
|
1172
|
+
}
|
|
1173
|
+
versions.forEach((v) => {
|
|
1174
|
+
if (rangeObj.test(v)) {
|
|
1175
|
+
if (!min || minSV.compare(v) === 1) {
|
|
1176
|
+
min = v;
|
|
1177
|
+
minSV = new SemVer$3(min, options);
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
});
|
|
1181
|
+
return min;
|
|
1182
|
+
};
|
|
1183
|
+
var minSatisfying_1 = minSatisfying$1;
|
|
1184
|
+
const SemVer$2 = semver$2;
|
|
1185
|
+
const Range$5 = requireRange();
|
|
1186
|
+
const gt$2 = gt_1;
|
|
1187
|
+
const minVersion$1 = (range2, loose) => {
|
|
1188
|
+
range2 = new Range$5(range2, loose);
|
|
1189
|
+
let minver = new SemVer$2("0.0.0");
|
|
1190
|
+
if (range2.test(minver)) {
|
|
1191
|
+
return minver;
|
|
1192
|
+
}
|
|
1193
|
+
minver = new SemVer$2("0.0.0-0");
|
|
1194
|
+
if (range2.test(minver)) {
|
|
1195
|
+
return minver;
|
|
1196
|
+
}
|
|
1197
|
+
minver = null;
|
|
1198
|
+
for (let i = 0; i < range2.set.length; ++i) {
|
|
1199
|
+
const comparators = range2.set[i];
|
|
1200
|
+
let setMin = null;
|
|
1201
|
+
comparators.forEach((comparator2) => {
|
|
1202
|
+
const compver = new SemVer$2(comparator2.semver.version);
|
|
1203
|
+
switch (comparator2.operator) {
|
|
1204
|
+
case ">":
|
|
1205
|
+
if (compver.prerelease.length === 0) {
|
|
1206
|
+
compver.patch++;
|
|
1207
|
+
} else {
|
|
1208
|
+
compver.prerelease.push(0);
|
|
1209
|
+
}
|
|
1210
|
+
compver.raw = compver.format();
|
|
1211
|
+
case "":
|
|
1212
|
+
case ">=":
|
|
1213
|
+
if (!setMin || gt$2(compver, setMin)) {
|
|
1214
|
+
setMin = compver;
|
|
1215
|
+
}
|
|
1216
|
+
break;
|
|
1217
|
+
case "<":
|
|
1218
|
+
case "<=":
|
|
1219
|
+
break;
|
|
1220
|
+
default:
|
|
1221
|
+
throw new Error(`Unexpected operation: ${comparator2.operator}`);
|
|
1222
|
+
}
|
|
1223
|
+
});
|
|
1224
|
+
if (setMin && (!minver || gt$2(minver, setMin))) {
|
|
1225
|
+
minver = setMin;
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
if (minver && range2.test(minver)) {
|
|
1229
|
+
return minver;
|
|
1230
|
+
}
|
|
1231
|
+
return null;
|
|
1232
|
+
};
|
|
1233
|
+
var minVersion_1 = minVersion$1;
|
|
1234
|
+
const Range$4 = requireRange();
|
|
1235
|
+
const validRange$1 = (range2, options) => {
|
|
1236
|
+
try {
|
|
1237
|
+
return new Range$4(range2, options).range || "*";
|
|
1238
|
+
} catch (er) {
|
|
1239
|
+
return null;
|
|
1240
|
+
}
|
|
1241
|
+
};
|
|
1242
|
+
var valid$1 = validRange$1;
|
|
1243
|
+
const SemVer$1 = semver$2;
|
|
1244
|
+
const Comparator$2 = requireComparator();
|
|
1245
|
+
const { ANY: ANY$1 } = Comparator$2;
|
|
1246
|
+
const Range$3 = requireRange();
|
|
1247
|
+
const satisfies$3 = satisfies_1;
|
|
1248
|
+
const gt$1 = gt_1;
|
|
1249
|
+
const lt$1 = lt_1;
|
|
1250
|
+
const lte$1 = lte_1;
|
|
1251
|
+
const gte$1 = gte_1;
|
|
1252
|
+
const outside$3 = (version, range2, hilo, options) => {
|
|
1253
|
+
version = new SemVer$1(version, options);
|
|
1254
|
+
range2 = new Range$3(range2, options);
|
|
1255
|
+
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
1256
|
+
switch (hilo) {
|
|
1257
|
+
case ">":
|
|
1258
|
+
gtfn = gt$1;
|
|
1259
|
+
ltefn = lte$1;
|
|
1260
|
+
ltfn = lt$1;
|
|
1261
|
+
comp = ">";
|
|
1262
|
+
ecomp = ">=";
|
|
1263
|
+
break;
|
|
1264
|
+
case "<":
|
|
1265
|
+
gtfn = lt$1;
|
|
1266
|
+
ltefn = gte$1;
|
|
1267
|
+
ltfn = gt$1;
|
|
1268
|
+
comp = "<";
|
|
1269
|
+
ecomp = "<=";
|
|
1270
|
+
break;
|
|
1271
|
+
default:
|
|
1272
|
+
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
|
1273
|
+
}
|
|
1274
|
+
if (satisfies$3(version, range2, options)) {
|
|
1275
|
+
return false;
|
|
1276
|
+
}
|
|
1277
|
+
for (let i = 0; i < range2.set.length; ++i) {
|
|
1278
|
+
const comparators = range2.set[i];
|
|
1279
|
+
let high = null;
|
|
1280
|
+
let low = null;
|
|
1281
|
+
comparators.forEach((comparator2) => {
|
|
1282
|
+
if (comparator2.semver === ANY$1) {
|
|
1283
|
+
comparator2 = new Comparator$2(">=0.0.0");
|
|
1284
|
+
}
|
|
1285
|
+
high = high || comparator2;
|
|
1286
|
+
low = low || comparator2;
|
|
1287
|
+
if (gtfn(comparator2.semver, high.semver, options)) {
|
|
1288
|
+
high = comparator2;
|
|
1289
|
+
} else if (ltfn(comparator2.semver, low.semver, options)) {
|
|
1290
|
+
low = comparator2;
|
|
1291
|
+
}
|
|
1292
|
+
});
|
|
1293
|
+
if (high.operator === comp || high.operator === ecomp) {
|
|
1294
|
+
return false;
|
|
1295
|
+
}
|
|
1296
|
+
if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
|
|
1297
|
+
return false;
|
|
1298
|
+
} else if (low.operator === ecomp && ltfn(version, low.semver)) {
|
|
1299
|
+
return false;
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
return true;
|
|
1303
|
+
};
|
|
1304
|
+
var outside_1 = outside$3;
|
|
1305
|
+
const outside$2 = outside_1;
|
|
1306
|
+
const gtr$1 = (version, range2, options) => outside$2(version, range2, ">", options);
|
|
1307
|
+
var gtr_1 = gtr$1;
|
|
1308
|
+
const outside$1 = outside_1;
|
|
1309
|
+
const ltr$1 = (version, range2, options) => outside$1(version, range2, "<", options);
|
|
1310
|
+
var ltr_1 = ltr$1;
|
|
1311
|
+
const Range$2 = requireRange();
|
|
1312
|
+
const intersects$1 = (r1, r2, options) => {
|
|
1313
|
+
r1 = new Range$2(r1, options);
|
|
1314
|
+
r2 = new Range$2(r2, options);
|
|
1315
|
+
return r1.intersects(r2, options);
|
|
1316
|
+
};
|
|
1317
|
+
var intersects_1 = intersects$1;
|
|
1318
|
+
const satisfies$2 = satisfies_1;
|
|
1319
|
+
const compare$2 = compare_1;
|
|
1320
|
+
var simplify = (versions, range2, options) => {
|
|
1321
|
+
const set = [];
|
|
1322
|
+
let first = null;
|
|
1323
|
+
let prev = null;
|
|
1324
|
+
const v = versions.sort((a, b) => compare$2(a, b, options));
|
|
1325
|
+
for (const version of v) {
|
|
1326
|
+
const included = satisfies$2(version, range2, options);
|
|
1327
|
+
if (included) {
|
|
1328
|
+
prev = version;
|
|
1329
|
+
if (!first) {
|
|
1330
|
+
first = version;
|
|
1331
|
+
}
|
|
1332
|
+
} else {
|
|
1333
|
+
if (prev) {
|
|
1334
|
+
set.push([first, prev]);
|
|
1335
|
+
}
|
|
1336
|
+
prev = null;
|
|
1337
|
+
first = null;
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
if (first) {
|
|
1341
|
+
set.push([first, null]);
|
|
1342
|
+
}
|
|
1343
|
+
const ranges = [];
|
|
1344
|
+
for (const [min, max] of set) {
|
|
1345
|
+
if (min === max) {
|
|
1346
|
+
ranges.push(min);
|
|
1347
|
+
} else if (!max && min === v[0]) {
|
|
1348
|
+
ranges.push("*");
|
|
1349
|
+
} else if (!max) {
|
|
1350
|
+
ranges.push(`>=${min}`);
|
|
1351
|
+
} else if (min === v[0]) {
|
|
1352
|
+
ranges.push(`<=${max}`);
|
|
1353
|
+
} else {
|
|
1354
|
+
ranges.push(`${min} - ${max}`);
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
const simplified = ranges.join(" || ");
|
|
1358
|
+
const original = typeof range2.raw === "string" ? range2.raw : String(range2);
|
|
1359
|
+
return simplified.length < original.length ? simplified : range2;
|
|
1360
|
+
};
|
|
1361
|
+
const Range$1 = requireRange();
|
|
1362
|
+
const Comparator$1 = requireComparator();
|
|
1363
|
+
const { ANY } = Comparator$1;
|
|
1364
|
+
const satisfies$1 = satisfies_1;
|
|
1365
|
+
const compare$1 = compare_1;
|
|
1366
|
+
const subset$1 = (sub, dom, options = {}) => {
|
|
1367
|
+
if (sub === dom) {
|
|
1368
|
+
return true;
|
|
1369
|
+
}
|
|
1370
|
+
sub = new Range$1(sub, options);
|
|
1371
|
+
dom = new Range$1(dom, options);
|
|
1372
|
+
let sawNonNull = false;
|
|
1373
|
+
OUTER:
|
|
1374
|
+
for (const simpleSub of sub.set) {
|
|
1375
|
+
for (const simpleDom of dom.set) {
|
|
1376
|
+
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
1377
|
+
sawNonNull = sawNonNull || isSub !== null;
|
|
1378
|
+
if (isSub) {
|
|
1379
|
+
continue OUTER;
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
if (sawNonNull) {
|
|
1383
|
+
return false;
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
return true;
|
|
1387
|
+
};
|
|
1388
|
+
const minimumVersionWithPreRelease = [new Comparator$1(">=0.0.0-0")];
|
|
1389
|
+
const minimumVersion = [new Comparator$1(">=0.0.0")];
|
|
1390
|
+
const simpleSubset = (sub, dom, options) => {
|
|
1391
|
+
if (sub === dom) {
|
|
1392
|
+
return true;
|
|
1393
|
+
}
|
|
1394
|
+
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
1395
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
1396
|
+
return true;
|
|
1397
|
+
} else if (options.includePrerelease) {
|
|
1398
|
+
sub = minimumVersionWithPreRelease;
|
|
1399
|
+
} else {
|
|
1400
|
+
sub = minimumVersion;
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
1404
|
+
if (options.includePrerelease) {
|
|
1405
|
+
return true;
|
|
1406
|
+
} else {
|
|
1407
|
+
dom = minimumVersion;
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
const eqSet = /* @__PURE__ */ new Set();
|
|
1411
|
+
let gt2, lt2;
|
|
1412
|
+
for (const c of sub) {
|
|
1413
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
1414
|
+
gt2 = higherGT(gt2, c, options);
|
|
1415
|
+
} else if (c.operator === "<" || c.operator === "<=") {
|
|
1416
|
+
lt2 = lowerLT(lt2, c, options);
|
|
1417
|
+
} else {
|
|
1418
|
+
eqSet.add(c.semver);
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
if (eqSet.size > 1) {
|
|
1422
|
+
return null;
|
|
1423
|
+
}
|
|
1424
|
+
let gtltComp;
|
|
1425
|
+
if (gt2 && lt2) {
|
|
1426
|
+
gtltComp = compare$1(gt2.semver, lt2.semver, options);
|
|
1427
|
+
if (gtltComp > 0) {
|
|
1428
|
+
return null;
|
|
1429
|
+
} else if (gtltComp === 0 && (gt2.operator !== ">=" || lt2.operator !== "<=")) {
|
|
1430
|
+
return null;
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
for (const eq2 of eqSet) {
|
|
1434
|
+
if (gt2 && !satisfies$1(eq2, String(gt2), options)) {
|
|
1435
|
+
return null;
|
|
1436
|
+
}
|
|
1437
|
+
if (lt2 && !satisfies$1(eq2, String(lt2), options)) {
|
|
1438
|
+
return null;
|
|
1439
|
+
}
|
|
1440
|
+
for (const c of dom) {
|
|
1441
|
+
if (!satisfies$1(eq2, String(c), options)) {
|
|
1442
|
+
return false;
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
return true;
|
|
1446
|
+
}
|
|
1447
|
+
let higher, lower;
|
|
1448
|
+
let hasDomLT, hasDomGT;
|
|
1449
|
+
let needDomLTPre = lt2 && !options.includePrerelease && lt2.semver.prerelease.length ? lt2.semver : false;
|
|
1450
|
+
let needDomGTPre = gt2 && !options.includePrerelease && gt2.semver.prerelease.length ? gt2.semver : false;
|
|
1451
|
+
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt2.operator === "<" && needDomLTPre.prerelease[0] === 0) {
|
|
1452
|
+
needDomLTPre = false;
|
|
1453
|
+
}
|
|
1454
|
+
for (const c of dom) {
|
|
1455
|
+
hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
|
|
1456
|
+
hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
|
|
1457
|
+
if (gt2) {
|
|
1458
|
+
if (needDomGTPre) {
|
|
1459
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) {
|
|
1460
|
+
needDomGTPre = false;
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
1464
|
+
higher = higherGT(gt2, c, options);
|
|
1465
|
+
if (higher === c && higher !== gt2) {
|
|
1466
|
+
return false;
|
|
1467
|
+
}
|
|
1468
|
+
} else if (gt2.operator === ">=" && !satisfies$1(gt2.semver, String(c), options)) {
|
|
1469
|
+
return false;
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
if (lt2) {
|
|
1473
|
+
if (needDomLTPre) {
|
|
1474
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) {
|
|
1475
|
+
needDomLTPre = false;
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
if (c.operator === "<" || c.operator === "<=") {
|
|
1479
|
+
lower = lowerLT(lt2, c, options);
|
|
1480
|
+
if (lower === c && lower !== lt2) {
|
|
1481
|
+
return false;
|
|
1482
|
+
}
|
|
1483
|
+
} else if (lt2.operator === "<=" && !satisfies$1(lt2.semver, String(c), options)) {
|
|
1484
|
+
return false;
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
if (!c.operator && (lt2 || gt2) && gtltComp !== 0) {
|
|
1488
|
+
return false;
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
if (gt2 && hasDomLT && !lt2 && gtltComp !== 0) {
|
|
1492
|
+
return false;
|
|
1493
|
+
}
|
|
1494
|
+
if (lt2 && hasDomGT && !gt2 && gtltComp !== 0) {
|
|
1495
|
+
return false;
|
|
1496
|
+
}
|
|
1497
|
+
if (needDomGTPre || needDomLTPre) {
|
|
1498
|
+
return false;
|
|
1499
|
+
}
|
|
1500
|
+
return true;
|
|
1501
|
+
};
|
|
1502
|
+
const higherGT = (a, b, options) => {
|
|
1503
|
+
if (!a) {
|
|
1504
|
+
return b;
|
|
1505
|
+
}
|
|
1506
|
+
const comp = compare$1(a.semver, b.semver, options);
|
|
1507
|
+
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
1508
|
+
};
|
|
1509
|
+
const lowerLT = (a, b, options) => {
|
|
1510
|
+
if (!a) {
|
|
1511
|
+
return b;
|
|
1512
|
+
}
|
|
1513
|
+
const comp = compare$1(a.semver, b.semver, options);
|
|
1514
|
+
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
1515
|
+
};
|
|
1516
|
+
var subset_1 = subset$1;
|
|
1517
|
+
const internalRe = reExports;
|
|
1518
|
+
const constants = constants$1;
|
|
1519
|
+
const SemVer2 = semver$2;
|
|
1520
|
+
const identifiers = identifiers$1;
|
|
1521
|
+
const parse = parse_1;
|
|
1522
|
+
const valid = valid_1;
|
|
1523
|
+
const clean = clean_1;
|
|
1524
|
+
const inc = inc_1;
|
|
1525
|
+
const diff = diff_1;
|
|
1526
|
+
const major = major_1;
|
|
1527
|
+
const minor = minor_1;
|
|
1528
|
+
const patch = patch_1;
|
|
1529
|
+
const prerelease = prerelease_1;
|
|
1530
|
+
const compare = compare_1;
|
|
1531
|
+
const rcompare = rcompare_1;
|
|
1532
|
+
const compareLoose = compareLoose_1;
|
|
1533
|
+
const compareBuild = compareBuild_1;
|
|
1534
|
+
const sort = sort_1;
|
|
1535
|
+
const rsort = rsort_1;
|
|
1536
|
+
const gt = gt_1;
|
|
1537
|
+
const lt = lt_1;
|
|
1538
|
+
const eq = eq_1;
|
|
1539
|
+
const neq = neq_1;
|
|
1540
|
+
const gte = gte_1;
|
|
1541
|
+
const lte = lte_1;
|
|
1542
|
+
const cmp = cmp_1;
|
|
1543
|
+
const coerce = coerce_1;
|
|
1544
|
+
const Comparator = requireComparator();
|
|
1545
|
+
const Range = requireRange();
|
|
1546
|
+
const satisfies = satisfies_1;
|
|
1547
|
+
const toComparators = toComparators_1;
|
|
1548
|
+
const maxSatisfying = maxSatisfying_1;
|
|
1549
|
+
const minSatisfying = minSatisfying_1;
|
|
1550
|
+
const minVersion = minVersion_1;
|
|
1551
|
+
const validRange = valid$1;
|
|
1552
|
+
const outside = outside_1;
|
|
1553
|
+
const gtr = gtr_1;
|
|
1554
|
+
const ltr = ltr_1;
|
|
1555
|
+
const intersects = intersects_1;
|
|
1556
|
+
const simplifyRange = simplify;
|
|
1557
|
+
const subset = subset_1;
|
|
1558
|
+
var semver = {
|
|
1559
|
+
parse,
|
|
1560
|
+
valid,
|
|
1561
|
+
clean,
|
|
1562
|
+
inc,
|
|
1563
|
+
diff,
|
|
1564
|
+
major,
|
|
1565
|
+
minor,
|
|
1566
|
+
patch,
|
|
1567
|
+
prerelease,
|
|
1568
|
+
compare,
|
|
1569
|
+
rcompare,
|
|
1570
|
+
compareLoose,
|
|
1571
|
+
compareBuild,
|
|
1572
|
+
sort,
|
|
1573
|
+
rsort,
|
|
1574
|
+
gt,
|
|
1575
|
+
lt,
|
|
1576
|
+
eq,
|
|
1577
|
+
neq,
|
|
1578
|
+
gte,
|
|
1579
|
+
lte,
|
|
1580
|
+
cmp,
|
|
1581
|
+
coerce,
|
|
1582
|
+
Comparator,
|
|
1583
|
+
Range,
|
|
1584
|
+
satisfies,
|
|
1585
|
+
toComparators,
|
|
1586
|
+
maxSatisfying,
|
|
1587
|
+
minSatisfying,
|
|
1588
|
+
minVersion,
|
|
1589
|
+
validRange,
|
|
1590
|
+
outside,
|
|
1591
|
+
gtr,
|
|
1592
|
+
ltr,
|
|
1593
|
+
intersects,
|
|
1594
|
+
simplifyRange,
|
|
1595
|
+
subset,
|
|
1596
|
+
SemVer: SemVer2,
|
|
1597
|
+
re: internalRe.re,
|
|
1598
|
+
src: internalRe.src,
|
|
1599
|
+
tokens: internalRe.t,
|
|
1600
|
+
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
|
1601
|
+
RELEASE_TYPES: constants.RELEASE_TYPES,
|
|
1602
|
+
compareIdentifiers: identifiers.compareIdentifiers,
|
|
1603
|
+
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
1604
|
+
};
|
|
1605
|
+
const semver$1 = /* @__PURE__ */ getDefaultExportFromCjs(semver);
|
|
1606
|
+
const getBridgeRouterAlias = (originalAlias) => {
|
|
1607
|
+
const userPackageJsonPath = path.resolve(process.cwd(), "package.json");
|
|
1608
|
+
let userDependencies = {};
|
|
1609
|
+
if (fs.existsSync(userPackageJsonPath)) {
|
|
1610
|
+
const userPackageJson = JSON.parse(
|
|
1611
|
+
fs.readFileSync(userPackageJsonPath, "utf-8")
|
|
1612
|
+
);
|
|
1613
|
+
userDependencies = {
|
|
1614
|
+
...userPackageJson.dependencies,
|
|
1615
|
+
...userPackageJson.devDependencies
|
|
1616
|
+
};
|
|
1617
|
+
}
|
|
1618
|
+
const hasBridgeReact = "@module-federation/bridge-react" in userDependencies;
|
|
1619
|
+
let bridgeRouterAlias = {};
|
|
1620
|
+
if (hasBridgeReact) {
|
|
1621
|
+
const reactRouterDomVersion = userDependencies["react-router-dom"];
|
|
1622
|
+
let majorVersion = 0;
|
|
1623
|
+
let reactRouterDomPath = "";
|
|
1624
|
+
if (reactRouterDomVersion) {
|
|
1625
|
+
majorVersion = semver$1.major(
|
|
1626
|
+
semver$1.coerce(reactRouterDomVersion || "0.0.0") ?? "0.0.0"
|
|
1627
|
+
);
|
|
1628
|
+
reactRouterDomPath = require.resolve("react-router-dom");
|
|
1629
|
+
} else {
|
|
1630
|
+
reactRouterDomPath = require.resolve("react-router-dom");
|
|
1631
|
+
const packageJsonPath = path.resolve(
|
|
1632
|
+
reactRouterDomPath,
|
|
1633
|
+
"../../package.json"
|
|
1634
|
+
);
|
|
1635
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
1636
|
+
majorVersion = parseInt(packageJson.version.split(".")[0]);
|
|
1637
|
+
}
|
|
1638
|
+
reactRouterDomPath = originalAlias || reactRouterDomPath;
|
|
1639
|
+
if (majorVersion === 5) {
|
|
1640
|
+
bridgeRouterAlias = {
|
|
1641
|
+
"react-router-dom$": "@module-federation/bridge-react/dist/router-v5.es.js"
|
|
1642
|
+
};
|
|
1643
|
+
try {
|
|
1644
|
+
require.resolve("react-router-dom/index.js");
|
|
1645
|
+
} catch (error) {
|
|
1646
|
+
bridgeRouterAlias = {
|
|
1647
|
+
...bridgeRouterAlias,
|
|
1648
|
+
"react-router-dom/index.js": reactRouterDomPath
|
|
1649
|
+
};
|
|
1650
|
+
}
|
|
1651
|
+
} else if (majorVersion === 6) {
|
|
1652
|
+
bridgeRouterAlias = {
|
|
1653
|
+
"react-router-dom$": "@module-federation/bridge-react/dist/router-v6.es.js"
|
|
1654
|
+
};
|
|
1655
|
+
try {
|
|
1656
|
+
require.resolve("react-router-dom/dist/index.js");
|
|
1657
|
+
} catch (error) {
|
|
1658
|
+
bridgeRouterAlias = {
|
|
1659
|
+
...bridgeRouterAlias,
|
|
1660
|
+
"react-router-dom/dist/index.js": reactRouterDomPath
|
|
1661
|
+
};
|
|
1662
|
+
}
|
|
1663
|
+
} else {
|
|
1664
|
+
console.warn("react-router-dom version is not supported");
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
console.log(
|
|
1668
|
+
"<<<<<<<<<<<<< bridgeRouterAlias >>>>>>>>>>>>>",
|
|
1669
|
+
bridgeRouterAlias
|
|
1670
|
+
);
|
|
1671
|
+
return bridgeRouterAlias;
|
|
1672
|
+
};
|
|
9
1673
|
class ReactBridgeAliasChangerPlugin {
|
|
10
1674
|
constructor(info) {
|
|
11
1675
|
__publicField(this, "alias");
|
|
@@ -39,7 +1703,8 @@ class ReactBridgeAliasChangerPlugin {
|
|
|
39
1703
|
const originalAlias = originalResolve.alias || {};
|
|
40
1704
|
const updatedAlias = {
|
|
41
1705
|
// allow `alias` can be override
|
|
42
|
-
[this.alias]: targetFilePath,
|
|
1706
|
+
// [this.alias]: targetFilePath,
|
|
1707
|
+
...getBridgeRouterAlias(originalAlias["react-router-dom"]),
|
|
43
1708
|
...originalAlias
|
|
44
1709
|
};
|
|
45
1710
|
compiler.options.resolve = {
|