@cloudflare/vitest-pool-workers 0.12.3 → 0.12.5
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/pool/index.mjs +1868 -12
- package/dist/pool/index.mjs.map +3 -3
- package/dist/worker/index.mjs +478 -4
- package/dist/worker/index.mjs.map +3 -3
- package/dist/worker/lib/cloudflare/mock-agent.cjs +600 -145
- package/dist/worker/lib/cloudflare/mock-agent.cjs.map +3 -3
- package/package.json +11 -11
package/dist/pool/index.mjs
CHANGED
|
@@ -1,7 +1,1139 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __esm = (fn, res) => function __init() {
|
|
8
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
9
|
+
};
|
|
10
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
11
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
|
|
1
30
|
// <define:VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES>
|
|
2
|
-
var define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES_default
|
|
31
|
+
var define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES_default;
|
|
32
|
+
var init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES = __esm({
|
|
33
|
+
"<define:VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES>"() {
|
|
34
|
+
define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES_default = ["node-internal:async_hooks", "node-internal:buffer", "node-internal:crypto", "node-internal:module", "node-internal:process", "node-internal:util", "node-internal:diagnostics_channel", "node-internal:zlib", "node-internal:url", "node-internal:timers", "node-internal:sqlite", "node-internal:dns", "node:_stream_duplex", "node:_stream_passthrough", "node:_stream_readable", "node:_stream_transform", "node:_stream_writable", "node:_tls_common", "node:_tls_wrap", "node:assert", "node:assert/strict", "node:async_hooks", "node:buffer", "node:constants", "node:crypto", "node:diagnostics_channel", "node:dns", "node:dns/promises", "node:events", "node:fs/promises", "node:module", "node:net", "node:path", "node:path/posix", "node:path/win32", "node:querystring", "node:stream", "node:stream/consumers", "node:stream/promises", "node:stream/web", "node:string_decoder", "node:test", "node:timers", "node:timers/promises", "node:tls", "node:url", "node:util", "node:util/types", "node:zlib", "node-internal:constants", "node-internal:crypto_cipher", "node-internal:crypto_dh", "node-internal:crypto_hash", "node-internal:crypto_hkdf", "node-internal:crypto_keys", "node-internal:crypto_pbkdf2", "node-internal:crypto_random", "node-internal:crypto_scrypt", "node-internal:crypto_sign", "node-internal:crypto_spkac", "node-internal:crypto_util", "node-internal:crypto_x509", "node-internal:debuglog", "node-internal:events", "node-internal:internal_assert", "node-internal:internal_assertionerror", "node-internal:internal_buffer", "node-internal:internal_comparisons", "node-internal:internal_diffs", "node-internal:internal_dns", "node-internal:internal_dns_client", "node-internal:internal_dns_constants", "node-internal:internal_dns_promises", "node-internal:internal_errors", "node-internal:internal_fs", "node-internal:internal_fs_callback", "node-internal:internal_fs_constants", "node-internal:internal_fs_promises", "node-internal:internal_fs_streams", "node-internal:internal_fs_sync", "node-internal:internal_fs_utils", "node-internal:internal_http", "node-internal:internal_http2_constants", "node-internal:internal_http_agent", "node-internal:internal_http_client", "node-internal:internal_http_constants", "node-internal:internal_http_incoming", "node-internal:internal_http_outgoing", "node-internal:internal_http_server", "node-internal:internal_http_util", "node-internal:internal_https_agent", "node-internal:internal_https_server", "node-internal:internal_inspect", "node-internal:internal_module", "node-internal:internal_net", "node-internal:internal_path", "node-internal:internal_process", "node-internal:internal_querystring", "node-internal:internal_readline", "node-internal:internal_readline_promises", "node-internal:internal_stringdecoder", "node-internal:internal_timers", "node-internal:internal_timers_global_override", "node-internal:internal_timers_promises", "node-internal:internal_tls", "node-internal:internal_tls_common", "node-internal:internal_tls_constants", "node-internal:internal_tls_jsstream", "node-internal:internal_tls_wrap", "node-internal:internal_types", "node-internal:internal_url", "node-internal:internal_utils", "node-internal:internal_zlib", "node-internal:internal_zlib_base", "node-internal:internal_zlib_constants", "node-internal:legacy_process", "node-internal:legacy_url", "node-internal:mock", "node-internal:public_process", "node-internal:streams_add_abort_signal", "node-internal:streams_compose", "node-internal:streams_destroy", "node-internal:streams_duplex", "node-internal:streams_end_of_stream", "node-internal:streams_legacy", "node-internal:streams_pipeline", "node-internal:streams_promises", "node-internal:streams_readable", "node-internal:streams_state", "node-internal:streams_transform", "node-internal:streams_util", "node-internal:streams_writable", "node-internal:validators", "internal:unsafe-eval", "cloudflare-internal:sockets", "cloudflare-internal:base64", "cloudflare:ai", "cloudflare:br", "cloudflare:email", "cloudflare:node", "cloudflare:pipelines", "cloudflare:sockets", "cloudflare:vectorize", "cloudflare:workers", "cloudflare:workflows", "cloudflare-internal:ai-api", "cloudflare-internal:aig-api", "cloudflare-internal:autorag-api", "cloudflare-internal:br-api", "cloudflare-internal:d1-api", "cloudflare-internal:http", "cloudflare-internal:images-api", "cloudflare-internal:pipeline-transform", "cloudflare-internal:streaming-base64", "cloudflare-internal:streaming-forms", "cloudflare-internal:test-tracing-wrapper", "cloudflare-internal:to-markdown-api", "cloudflare-internal:tracing-helpers", "cloudflare-internal:vectorize-api", "cloudflare-internal:workflows-api", "cloudflare-internal:workers", "cloudflare-internal:tracing", "cloudflare-internal:env", "cloudflare-internal:filesystem", "workerd:unsafe"];
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// ../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/internal/lrucache.js
|
|
39
|
+
var require_lrucache = __commonJS({
|
|
40
|
+
"../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/internal/lrucache.js"(exports, module) {
|
|
41
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
42
|
+
var LRUCache = class {
|
|
43
|
+
constructor() {
|
|
44
|
+
this.max = 1e3;
|
|
45
|
+
this.map = /* @__PURE__ */ new Map();
|
|
46
|
+
}
|
|
47
|
+
get(key) {
|
|
48
|
+
const value = this.map.get(key);
|
|
49
|
+
if (value === void 0) {
|
|
50
|
+
return void 0;
|
|
51
|
+
} else {
|
|
52
|
+
this.map.delete(key);
|
|
53
|
+
this.map.set(key, value);
|
|
54
|
+
return value;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
delete(key) {
|
|
58
|
+
return this.map.delete(key);
|
|
59
|
+
}
|
|
60
|
+
set(key, value) {
|
|
61
|
+
const deleted = this.delete(key);
|
|
62
|
+
if (!deleted && value !== void 0) {
|
|
63
|
+
if (this.map.size >= this.max) {
|
|
64
|
+
const firstKey = this.map.keys().next().value;
|
|
65
|
+
this.delete(firstKey);
|
|
66
|
+
}
|
|
67
|
+
this.map.set(key, value);
|
|
68
|
+
}
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
module.exports = LRUCache;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// ../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/internal/parse-options.js
|
|
77
|
+
var require_parse_options = __commonJS({
|
|
78
|
+
"../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/internal/parse-options.js"(exports, module) {
|
|
79
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
80
|
+
var looseOption = Object.freeze({ loose: true });
|
|
81
|
+
var emptyOpts = Object.freeze({});
|
|
82
|
+
var parseOptions = (options) => {
|
|
83
|
+
if (!options) {
|
|
84
|
+
return emptyOpts;
|
|
85
|
+
}
|
|
86
|
+
if (typeof options !== "object") {
|
|
87
|
+
return looseOption;
|
|
88
|
+
}
|
|
89
|
+
return options;
|
|
90
|
+
};
|
|
91
|
+
module.exports = parseOptions;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// ../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/internal/constants.js
|
|
96
|
+
var require_constants = __commonJS({
|
|
97
|
+
"../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/internal/constants.js"(exports, module) {
|
|
98
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
99
|
+
var SEMVER_SPEC_VERSION = "2.0.0";
|
|
100
|
+
var MAX_LENGTH = 256;
|
|
101
|
+
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
|
|
102
|
+
9007199254740991;
|
|
103
|
+
var MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
104
|
+
var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
|
|
105
|
+
var RELEASE_TYPES = [
|
|
106
|
+
"major",
|
|
107
|
+
"premajor",
|
|
108
|
+
"minor",
|
|
109
|
+
"preminor",
|
|
110
|
+
"patch",
|
|
111
|
+
"prepatch",
|
|
112
|
+
"prerelease"
|
|
113
|
+
];
|
|
114
|
+
module.exports = {
|
|
115
|
+
MAX_LENGTH,
|
|
116
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
117
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
118
|
+
MAX_SAFE_INTEGER,
|
|
119
|
+
RELEASE_TYPES,
|
|
120
|
+
SEMVER_SPEC_VERSION,
|
|
121
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
122
|
+
FLAG_LOOSE: 2
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
// ../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/internal/debug.js
|
|
128
|
+
var require_debug = __commonJS({
|
|
129
|
+
"../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/internal/debug.js"(exports, module) {
|
|
130
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
131
|
+
var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
|
|
132
|
+
};
|
|
133
|
+
module.exports = debug;
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// ../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/internal/re.js
|
|
138
|
+
var require_re = __commonJS({
|
|
139
|
+
"../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/internal/re.js"(exports, module) {
|
|
140
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
141
|
+
var {
|
|
142
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
143
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
144
|
+
MAX_LENGTH
|
|
145
|
+
} = require_constants();
|
|
146
|
+
var debug = require_debug();
|
|
147
|
+
exports = module.exports = {};
|
|
148
|
+
var re = exports.re = [];
|
|
149
|
+
var safeRe = exports.safeRe = [];
|
|
150
|
+
var src = exports.src = [];
|
|
151
|
+
var safeSrc = exports.safeSrc = [];
|
|
152
|
+
var t = exports.t = {};
|
|
153
|
+
var R = 0;
|
|
154
|
+
var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
155
|
+
var safeRegexReplacements = [
|
|
156
|
+
["\\s", 1],
|
|
157
|
+
["\\d", MAX_LENGTH],
|
|
158
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
159
|
+
];
|
|
160
|
+
var makeSafeRegex = (value) => {
|
|
161
|
+
for (const [token, max] of safeRegexReplacements) {
|
|
162
|
+
value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
163
|
+
}
|
|
164
|
+
return value;
|
|
165
|
+
};
|
|
166
|
+
var createToken = (name, value, isGlobal) => {
|
|
167
|
+
const safe = makeSafeRegex(value);
|
|
168
|
+
const index = R++;
|
|
169
|
+
debug(name, index, value);
|
|
170
|
+
t[name] = index;
|
|
171
|
+
src[index] = value;
|
|
172
|
+
safeSrc[index] = safe;
|
|
173
|
+
re[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
|
174
|
+
safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
|
|
175
|
+
};
|
|
176
|
+
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
177
|
+
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
178
|
+
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
179
|
+
createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
|
|
180
|
+
createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
181
|
+
createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`);
|
|
182
|
+
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`);
|
|
183
|
+
createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
|
184
|
+
createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
185
|
+
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
186
|
+
createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
|
187
|
+
createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
|
|
188
|
+
createToken("FULL", `^${src[t.FULLPLAIN]}$`);
|
|
189
|
+
createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
|
|
190
|
+
createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
|
|
191
|
+
createToken("GTLT", "((?:<|>)?=?)");
|
|
192
|
+
createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
193
|
+
createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
194
|
+
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
|
|
195
|
+
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
|
|
196
|
+
createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
|
197
|
+
createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
|
198
|
+
createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
199
|
+
createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
200
|
+
createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
|
|
201
|
+
createToken("COERCERTL", src[t.COERCE], true);
|
|
202
|
+
createToken("COERCERTLFULL", src[t.COERCEFULL], true);
|
|
203
|
+
createToken("LONETILDE", "(?:~>?)");
|
|
204
|
+
createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
205
|
+
exports.tildeTrimReplace = "$1~";
|
|
206
|
+
createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
207
|
+
createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
208
|
+
createToken("LONECARET", "(?:\\^)");
|
|
209
|
+
createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
210
|
+
exports.caretTrimReplace = "$1^";
|
|
211
|
+
createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
212
|
+
createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
213
|
+
createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
|
214
|
+
createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
|
215
|
+
createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
216
|
+
exports.comparatorTrimReplace = "$1$2$3";
|
|
217
|
+
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
|
|
218
|
+
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
|
|
219
|
+
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
220
|
+
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
221
|
+
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
// ../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/internal/identifiers.js
|
|
226
|
+
var require_identifiers = __commonJS({
|
|
227
|
+
"../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/internal/identifiers.js"(exports, module) {
|
|
228
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
229
|
+
var numeric = /^[0-9]+$/;
|
|
230
|
+
var compareIdentifiers = (a, b) => {
|
|
231
|
+
const anum = numeric.test(a);
|
|
232
|
+
const bnum = numeric.test(b);
|
|
233
|
+
if (anum && bnum) {
|
|
234
|
+
a = +a;
|
|
235
|
+
b = +b;
|
|
236
|
+
}
|
|
237
|
+
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
238
|
+
};
|
|
239
|
+
var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
|
|
240
|
+
module.exports = {
|
|
241
|
+
compareIdentifiers,
|
|
242
|
+
rcompareIdentifiers
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
// ../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/classes/semver.js
|
|
248
|
+
var require_semver = __commonJS({
|
|
249
|
+
"../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/classes/semver.js"(exports, module) {
|
|
250
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
251
|
+
var debug = require_debug();
|
|
252
|
+
var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
253
|
+
var { safeRe: re, safeSrc: src, t } = require_re();
|
|
254
|
+
var parseOptions = require_parse_options();
|
|
255
|
+
var { compareIdentifiers } = require_identifiers();
|
|
256
|
+
var SemVer = class _SemVer {
|
|
257
|
+
constructor(version, options) {
|
|
258
|
+
options = parseOptions(options);
|
|
259
|
+
if (version instanceof _SemVer) {
|
|
260
|
+
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
|
|
261
|
+
return version;
|
|
262
|
+
} else {
|
|
263
|
+
version = version.version;
|
|
264
|
+
}
|
|
265
|
+
} else if (typeof version !== "string") {
|
|
266
|
+
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
267
|
+
}
|
|
268
|
+
if (version.length > MAX_LENGTH) {
|
|
269
|
+
throw new TypeError(
|
|
270
|
+
`version is longer than ${MAX_LENGTH} characters`
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
debug("SemVer", version, options);
|
|
274
|
+
this.options = options;
|
|
275
|
+
this.loose = !!options.loose;
|
|
276
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
277
|
+
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
278
|
+
if (!m) {
|
|
279
|
+
throw new TypeError(`Invalid Version: ${version}`);
|
|
280
|
+
}
|
|
281
|
+
this.raw = version;
|
|
282
|
+
this.major = +m[1];
|
|
283
|
+
this.minor = +m[2];
|
|
284
|
+
this.patch = +m[3];
|
|
285
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
286
|
+
throw new TypeError("Invalid major version");
|
|
287
|
+
}
|
|
288
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
289
|
+
throw new TypeError("Invalid minor version");
|
|
290
|
+
}
|
|
291
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
292
|
+
throw new TypeError("Invalid patch version");
|
|
293
|
+
}
|
|
294
|
+
if (!m[4]) {
|
|
295
|
+
this.prerelease = [];
|
|
296
|
+
} else {
|
|
297
|
+
this.prerelease = m[4].split(".").map((id) => {
|
|
298
|
+
if (/^[0-9]+$/.test(id)) {
|
|
299
|
+
const num = +id;
|
|
300
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
301
|
+
return num;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return id;
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
this.build = m[5] ? m[5].split(".") : [];
|
|
308
|
+
this.format();
|
|
309
|
+
}
|
|
310
|
+
format() {
|
|
311
|
+
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
312
|
+
if (this.prerelease.length) {
|
|
313
|
+
this.version += `-${this.prerelease.join(".")}`;
|
|
314
|
+
}
|
|
315
|
+
return this.version;
|
|
316
|
+
}
|
|
317
|
+
toString() {
|
|
318
|
+
return this.version;
|
|
319
|
+
}
|
|
320
|
+
compare(other) {
|
|
321
|
+
debug("SemVer.compare", this.version, this.options, other);
|
|
322
|
+
if (!(other instanceof _SemVer)) {
|
|
323
|
+
if (typeof other === "string" && other === this.version) {
|
|
324
|
+
return 0;
|
|
325
|
+
}
|
|
326
|
+
other = new _SemVer(other, this.options);
|
|
327
|
+
}
|
|
328
|
+
if (other.version === this.version) {
|
|
329
|
+
return 0;
|
|
330
|
+
}
|
|
331
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
332
|
+
}
|
|
333
|
+
compareMain(other) {
|
|
334
|
+
if (!(other instanceof _SemVer)) {
|
|
335
|
+
other = new _SemVer(other, this.options);
|
|
336
|
+
}
|
|
337
|
+
return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
|
|
338
|
+
}
|
|
339
|
+
comparePre(other) {
|
|
340
|
+
if (!(other instanceof _SemVer)) {
|
|
341
|
+
other = new _SemVer(other, this.options);
|
|
342
|
+
}
|
|
343
|
+
if (this.prerelease.length && !other.prerelease.length) {
|
|
344
|
+
return -1;
|
|
345
|
+
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
346
|
+
return 1;
|
|
347
|
+
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
348
|
+
return 0;
|
|
349
|
+
}
|
|
350
|
+
let i = 0;
|
|
351
|
+
do {
|
|
352
|
+
const a = this.prerelease[i];
|
|
353
|
+
const b = other.prerelease[i];
|
|
354
|
+
debug("prerelease compare", i, a, b);
|
|
355
|
+
if (a === void 0 && b === void 0) {
|
|
356
|
+
return 0;
|
|
357
|
+
} else if (b === void 0) {
|
|
358
|
+
return 1;
|
|
359
|
+
} else if (a === void 0) {
|
|
360
|
+
return -1;
|
|
361
|
+
} else if (a === b) {
|
|
362
|
+
continue;
|
|
363
|
+
} else {
|
|
364
|
+
return compareIdentifiers(a, b);
|
|
365
|
+
}
|
|
366
|
+
} while (++i);
|
|
367
|
+
}
|
|
368
|
+
compareBuild(other) {
|
|
369
|
+
if (!(other instanceof _SemVer)) {
|
|
370
|
+
other = new _SemVer(other, this.options);
|
|
371
|
+
}
|
|
372
|
+
let i = 0;
|
|
373
|
+
do {
|
|
374
|
+
const a = this.build[i];
|
|
375
|
+
const b = other.build[i];
|
|
376
|
+
debug("build compare", i, a, b);
|
|
377
|
+
if (a === void 0 && b === void 0) {
|
|
378
|
+
return 0;
|
|
379
|
+
} else if (b === void 0) {
|
|
380
|
+
return 1;
|
|
381
|
+
} else if (a === void 0) {
|
|
382
|
+
return -1;
|
|
383
|
+
} else if (a === b) {
|
|
384
|
+
continue;
|
|
385
|
+
} else {
|
|
386
|
+
return compareIdentifiers(a, b);
|
|
387
|
+
}
|
|
388
|
+
} while (++i);
|
|
389
|
+
}
|
|
390
|
+
// preminor will bump the version up to the next minor release, and immediately
|
|
391
|
+
// down to pre-release. premajor and prepatch work the same way.
|
|
392
|
+
inc(release, identifier, identifierBase) {
|
|
393
|
+
if (release.startsWith("pre")) {
|
|
394
|
+
if (!identifier && identifierBase === false) {
|
|
395
|
+
throw new Error("invalid increment argument: identifier is empty");
|
|
396
|
+
}
|
|
397
|
+
if (identifier) {
|
|
398
|
+
const r = new RegExp(`^${this.options.loose ? src[t.PRERELEASELOOSE] : src[t.PRERELEASE]}$`);
|
|
399
|
+
const match = `-${identifier}`.match(r);
|
|
400
|
+
if (!match || match[1] !== identifier) {
|
|
401
|
+
throw new Error(`invalid identifier: ${identifier}`);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
switch (release) {
|
|
406
|
+
case "premajor":
|
|
407
|
+
this.prerelease.length = 0;
|
|
408
|
+
this.patch = 0;
|
|
409
|
+
this.minor = 0;
|
|
410
|
+
this.major++;
|
|
411
|
+
this.inc("pre", identifier, identifierBase);
|
|
412
|
+
break;
|
|
413
|
+
case "preminor":
|
|
414
|
+
this.prerelease.length = 0;
|
|
415
|
+
this.patch = 0;
|
|
416
|
+
this.minor++;
|
|
417
|
+
this.inc("pre", identifier, identifierBase);
|
|
418
|
+
break;
|
|
419
|
+
case "prepatch":
|
|
420
|
+
this.prerelease.length = 0;
|
|
421
|
+
this.inc("patch", identifier, identifierBase);
|
|
422
|
+
this.inc("pre", identifier, identifierBase);
|
|
423
|
+
break;
|
|
424
|
+
// If the input is a non-prerelease version, this acts the same as
|
|
425
|
+
// prepatch.
|
|
426
|
+
case "prerelease":
|
|
427
|
+
if (this.prerelease.length === 0) {
|
|
428
|
+
this.inc("patch", identifier, identifierBase);
|
|
429
|
+
}
|
|
430
|
+
this.inc("pre", identifier, identifierBase);
|
|
431
|
+
break;
|
|
432
|
+
case "release":
|
|
433
|
+
if (this.prerelease.length === 0) {
|
|
434
|
+
throw new Error(`version ${this.raw} is not a prerelease`);
|
|
435
|
+
}
|
|
436
|
+
this.prerelease.length = 0;
|
|
437
|
+
break;
|
|
438
|
+
case "major":
|
|
439
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
440
|
+
this.major++;
|
|
441
|
+
}
|
|
442
|
+
this.minor = 0;
|
|
443
|
+
this.patch = 0;
|
|
444
|
+
this.prerelease = [];
|
|
445
|
+
break;
|
|
446
|
+
case "minor":
|
|
447
|
+
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
448
|
+
this.minor++;
|
|
449
|
+
}
|
|
450
|
+
this.patch = 0;
|
|
451
|
+
this.prerelease = [];
|
|
452
|
+
break;
|
|
453
|
+
case "patch":
|
|
454
|
+
if (this.prerelease.length === 0) {
|
|
455
|
+
this.patch++;
|
|
456
|
+
}
|
|
457
|
+
this.prerelease = [];
|
|
458
|
+
break;
|
|
459
|
+
// This probably shouldn't be used publicly.
|
|
460
|
+
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
|
461
|
+
case "pre": {
|
|
462
|
+
const base = Number(identifierBase) ? 1 : 0;
|
|
463
|
+
if (this.prerelease.length === 0) {
|
|
464
|
+
this.prerelease = [base];
|
|
465
|
+
} else {
|
|
466
|
+
let i = this.prerelease.length;
|
|
467
|
+
while (--i >= 0) {
|
|
468
|
+
if (typeof this.prerelease[i] === "number") {
|
|
469
|
+
this.prerelease[i]++;
|
|
470
|
+
i = -2;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
if (i === -1) {
|
|
474
|
+
if (identifier === this.prerelease.join(".") && identifierBase === false) {
|
|
475
|
+
throw new Error("invalid increment argument: identifier already exists");
|
|
476
|
+
}
|
|
477
|
+
this.prerelease.push(base);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
if (identifier) {
|
|
481
|
+
let prerelease = [identifier, base];
|
|
482
|
+
if (identifierBase === false) {
|
|
483
|
+
prerelease = [identifier];
|
|
484
|
+
}
|
|
485
|
+
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
|
486
|
+
if (isNaN(this.prerelease[1])) {
|
|
487
|
+
this.prerelease = prerelease;
|
|
488
|
+
}
|
|
489
|
+
} else {
|
|
490
|
+
this.prerelease = prerelease;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
break;
|
|
494
|
+
}
|
|
495
|
+
default:
|
|
496
|
+
throw new Error(`invalid increment argument: ${release}`);
|
|
497
|
+
}
|
|
498
|
+
this.raw = this.format();
|
|
499
|
+
if (this.build.length) {
|
|
500
|
+
this.raw += `+${this.build.join(".")}`;
|
|
501
|
+
}
|
|
502
|
+
return this;
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
module.exports = SemVer;
|
|
506
|
+
}
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
// ../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/compare.js
|
|
510
|
+
var require_compare = __commonJS({
|
|
511
|
+
"../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/compare.js"(exports, module) {
|
|
512
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
513
|
+
var SemVer = require_semver();
|
|
514
|
+
var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
515
|
+
module.exports = compare;
|
|
516
|
+
}
|
|
517
|
+
});
|
|
518
|
+
|
|
519
|
+
// ../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/eq.js
|
|
520
|
+
var require_eq = __commonJS({
|
|
521
|
+
"../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/eq.js"(exports, module) {
|
|
522
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
523
|
+
var compare = require_compare();
|
|
524
|
+
var eq = (a, b, loose) => compare(a, b, loose) === 0;
|
|
525
|
+
module.exports = eq;
|
|
526
|
+
}
|
|
527
|
+
});
|
|
528
|
+
|
|
529
|
+
// ../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/neq.js
|
|
530
|
+
var require_neq = __commonJS({
|
|
531
|
+
"../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/neq.js"(exports, module) {
|
|
532
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
533
|
+
var compare = require_compare();
|
|
534
|
+
var neq = (a, b, loose) => compare(a, b, loose) !== 0;
|
|
535
|
+
module.exports = neq;
|
|
536
|
+
}
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
// ../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/gt.js
|
|
540
|
+
var require_gt = __commonJS({
|
|
541
|
+
"../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/gt.js"(exports, module) {
|
|
542
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
543
|
+
var compare = require_compare();
|
|
544
|
+
var gt = (a, b, loose) => compare(a, b, loose) > 0;
|
|
545
|
+
module.exports = gt;
|
|
546
|
+
}
|
|
547
|
+
});
|
|
548
|
+
|
|
549
|
+
// ../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/gte.js
|
|
550
|
+
var require_gte = __commonJS({
|
|
551
|
+
"../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/gte.js"(exports, module) {
|
|
552
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
553
|
+
var compare = require_compare();
|
|
554
|
+
var gte = (a, b, loose) => compare(a, b, loose) >= 0;
|
|
555
|
+
module.exports = gte;
|
|
556
|
+
}
|
|
557
|
+
});
|
|
558
|
+
|
|
559
|
+
// ../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/lt.js
|
|
560
|
+
var require_lt = __commonJS({
|
|
561
|
+
"../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/lt.js"(exports, module) {
|
|
562
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
563
|
+
var compare = require_compare();
|
|
564
|
+
var lt = (a, b, loose) => compare(a, b, loose) < 0;
|
|
565
|
+
module.exports = lt;
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
|
|
569
|
+
// ../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/lte.js
|
|
570
|
+
var require_lte = __commonJS({
|
|
571
|
+
"../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/lte.js"(exports, module) {
|
|
572
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
573
|
+
var compare = require_compare();
|
|
574
|
+
var lte = (a, b, loose) => compare(a, b, loose) <= 0;
|
|
575
|
+
module.exports = lte;
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
|
|
579
|
+
// ../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/cmp.js
|
|
580
|
+
var require_cmp = __commonJS({
|
|
581
|
+
"../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/cmp.js"(exports, module) {
|
|
582
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
583
|
+
var eq = require_eq();
|
|
584
|
+
var neq = require_neq();
|
|
585
|
+
var gt = require_gt();
|
|
586
|
+
var gte = require_gte();
|
|
587
|
+
var lt = require_lt();
|
|
588
|
+
var lte = require_lte();
|
|
589
|
+
var cmp = (a, op, b, loose) => {
|
|
590
|
+
switch (op) {
|
|
591
|
+
case "===":
|
|
592
|
+
if (typeof a === "object") {
|
|
593
|
+
a = a.version;
|
|
594
|
+
}
|
|
595
|
+
if (typeof b === "object") {
|
|
596
|
+
b = b.version;
|
|
597
|
+
}
|
|
598
|
+
return a === b;
|
|
599
|
+
case "!==":
|
|
600
|
+
if (typeof a === "object") {
|
|
601
|
+
a = a.version;
|
|
602
|
+
}
|
|
603
|
+
if (typeof b === "object") {
|
|
604
|
+
b = b.version;
|
|
605
|
+
}
|
|
606
|
+
return a !== b;
|
|
607
|
+
case "":
|
|
608
|
+
case "=":
|
|
609
|
+
case "==":
|
|
610
|
+
return eq(a, b, loose);
|
|
611
|
+
case "!=":
|
|
612
|
+
return neq(a, b, loose);
|
|
613
|
+
case ">":
|
|
614
|
+
return gt(a, b, loose);
|
|
615
|
+
case ">=":
|
|
616
|
+
return gte(a, b, loose);
|
|
617
|
+
case "<":
|
|
618
|
+
return lt(a, b, loose);
|
|
619
|
+
case "<=":
|
|
620
|
+
return lte(a, b, loose);
|
|
621
|
+
default:
|
|
622
|
+
throw new TypeError(`Invalid operator: ${op}`);
|
|
623
|
+
}
|
|
624
|
+
};
|
|
625
|
+
module.exports = cmp;
|
|
626
|
+
}
|
|
627
|
+
});
|
|
628
|
+
|
|
629
|
+
// ../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/classes/comparator.js
|
|
630
|
+
var require_comparator = __commonJS({
|
|
631
|
+
"../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/classes/comparator.js"(exports, module) {
|
|
632
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
633
|
+
var ANY = Symbol("SemVer ANY");
|
|
634
|
+
var Comparator = class _Comparator {
|
|
635
|
+
static get ANY() {
|
|
636
|
+
return ANY;
|
|
637
|
+
}
|
|
638
|
+
constructor(comp, options) {
|
|
639
|
+
options = parseOptions(options);
|
|
640
|
+
if (comp instanceof _Comparator) {
|
|
641
|
+
if (comp.loose === !!options.loose) {
|
|
642
|
+
return comp;
|
|
643
|
+
} else {
|
|
644
|
+
comp = comp.value;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
comp = comp.trim().split(/\s+/).join(" ");
|
|
648
|
+
debug("comparator", comp, options);
|
|
649
|
+
this.options = options;
|
|
650
|
+
this.loose = !!options.loose;
|
|
651
|
+
this.parse(comp);
|
|
652
|
+
if (this.semver === ANY) {
|
|
653
|
+
this.value = "";
|
|
654
|
+
} else {
|
|
655
|
+
this.value = this.operator + this.semver.version;
|
|
656
|
+
}
|
|
657
|
+
debug("comp", this);
|
|
658
|
+
}
|
|
659
|
+
parse(comp) {
|
|
660
|
+
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
661
|
+
const m = comp.match(r);
|
|
662
|
+
if (!m) {
|
|
663
|
+
throw new TypeError(`Invalid comparator: ${comp}`);
|
|
664
|
+
}
|
|
665
|
+
this.operator = m[1] !== void 0 ? m[1] : "";
|
|
666
|
+
if (this.operator === "=") {
|
|
667
|
+
this.operator = "";
|
|
668
|
+
}
|
|
669
|
+
if (!m[2]) {
|
|
670
|
+
this.semver = ANY;
|
|
671
|
+
} else {
|
|
672
|
+
this.semver = new SemVer(m[2], this.options.loose);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
toString() {
|
|
676
|
+
return this.value;
|
|
677
|
+
}
|
|
678
|
+
test(version) {
|
|
679
|
+
debug("Comparator.test", version, this.options.loose);
|
|
680
|
+
if (this.semver === ANY || version === ANY) {
|
|
681
|
+
return true;
|
|
682
|
+
}
|
|
683
|
+
if (typeof version === "string") {
|
|
684
|
+
try {
|
|
685
|
+
version = new SemVer(version, this.options);
|
|
686
|
+
} catch (er) {
|
|
687
|
+
return false;
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
return cmp(version, this.operator, this.semver, this.options);
|
|
691
|
+
}
|
|
692
|
+
intersects(comp, options) {
|
|
693
|
+
if (!(comp instanceof _Comparator)) {
|
|
694
|
+
throw new TypeError("a Comparator is required");
|
|
695
|
+
}
|
|
696
|
+
if (this.operator === "") {
|
|
697
|
+
if (this.value === "") {
|
|
698
|
+
return true;
|
|
699
|
+
}
|
|
700
|
+
return new Range(comp.value, options).test(this.value);
|
|
701
|
+
} else if (comp.operator === "") {
|
|
702
|
+
if (comp.value === "") {
|
|
703
|
+
return true;
|
|
704
|
+
}
|
|
705
|
+
return new Range(this.value, options).test(comp.semver);
|
|
706
|
+
}
|
|
707
|
+
options = parseOptions(options);
|
|
708
|
+
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
|
|
709
|
+
return false;
|
|
710
|
+
}
|
|
711
|
+
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
|
|
712
|
+
return false;
|
|
713
|
+
}
|
|
714
|
+
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
|
|
715
|
+
return true;
|
|
716
|
+
}
|
|
717
|
+
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
|
|
718
|
+
return true;
|
|
719
|
+
}
|
|
720
|
+
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
|
|
721
|
+
return true;
|
|
722
|
+
}
|
|
723
|
+
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
|
|
724
|
+
return true;
|
|
725
|
+
}
|
|
726
|
+
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
|
|
727
|
+
return true;
|
|
728
|
+
}
|
|
729
|
+
return false;
|
|
730
|
+
}
|
|
731
|
+
};
|
|
732
|
+
module.exports = Comparator;
|
|
733
|
+
var parseOptions = require_parse_options();
|
|
734
|
+
var { safeRe: re, t } = require_re();
|
|
735
|
+
var cmp = require_cmp();
|
|
736
|
+
var debug = require_debug();
|
|
737
|
+
var SemVer = require_semver();
|
|
738
|
+
var Range = require_range();
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
// ../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/classes/range.js
|
|
743
|
+
var require_range = __commonJS({
|
|
744
|
+
"../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/classes/range.js"(exports, module) {
|
|
745
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
746
|
+
var SPACE_CHARACTERS = /\s+/g;
|
|
747
|
+
var Range = class _Range {
|
|
748
|
+
constructor(range, options) {
|
|
749
|
+
options = parseOptions(options);
|
|
750
|
+
if (range instanceof _Range) {
|
|
751
|
+
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
|
|
752
|
+
return range;
|
|
753
|
+
} else {
|
|
754
|
+
return new _Range(range.raw, options);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
if (range instanceof Comparator) {
|
|
758
|
+
this.raw = range.value;
|
|
759
|
+
this.set = [[range]];
|
|
760
|
+
this.formatted = void 0;
|
|
761
|
+
return this;
|
|
762
|
+
}
|
|
763
|
+
this.options = options;
|
|
764
|
+
this.loose = !!options.loose;
|
|
765
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
766
|
+
this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
|
|
767
|
+
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
768
|
+
if (!this.set.length) {
|
|
769
|
+
throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
770
|
+
}
|
|
771
|
+
if (this.set.length > 1) {
|
|
772
|
+
const first = this.set[0];
|
|
773
|
+
this.set = this.set.filter((c) => !isNullSet(c[0]));
|
|
774
|
+
if (this.set.length === 0) {
|
|
775
|
+
this.set = [first];
|
|
776
|
+
} else if (this.set.length > 1) {
|
|
777
|
+
for (const c of this.set) {
|
|
778
|
+
if (c.length === 1 && isAny(c[0])) {
|
|
779
|
+
this.set = [c];
|
|
780
|
+
break;
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
this.formatted = void 0;
|
|
786
|
+
}
|
|
787
|
+
get range() {
|
|
788
|
+
if (this.formatted === void 0) {
|
|
789
|
+
this.formatted = "";
|
|
790
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
791
|
+
if (i > 0) {
|
|
792
|
+
this.formatted += "||";
|
|
793
|
+
}
|
|
794
|
+
const comps = this.set[i];
|
|
795
|
+
for (let k = 0; k < comps.length; k++) {
|
|
796
|
+
if (k > 0) {
|
|
797
|
+
this.formatted += " ";
|
|
798
|
+
}
|
|
799
|
+
this.formatted += comps[k].toString().trim();
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
return this.formatted;
|
|
804
|
+
}
|
|
805
|
+
format() {
|
|
806
|
+
return this.range;
|
|
807
|
+
}
|
|
808
|
+
toString() {
|
|
809
|
+
return this.range;
|
|
810
|
+
}
|
|
811
|
+
parseRange(range) {
|
|
812
|
+
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
|
|
813
|
+
const memoKey = memoOpts + ":" + range;
|
|
814
|
+
const cached = cache.get(memoKey);
|
|
815
|
+
if (cached) {
|
|
816
|
+
return cached;
|
|
817
|
+
}
|
|
818
|
+
const loose = this.options.loose;
|
|
819
|
+
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
820
|
+
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
821
|
+
debug("hyphen replace", range);
|
|
822
|
+
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
823
|
+
debug("comparator trim", range);
|
|
824
|
+
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
825
|
+
debug("tilde trim", range);
|
|
826
|
+
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
827
|
+
debug("caret trim", range);
|
|
828
|
+
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
829
|
+
if (loose) {
|
|
830
|
+
rangeList = rangeList.filter((comp) => {
|
|
831
|
+
debug("loose invalid filter", comp, this.options);
|
|
832
|
+
return !!comp.match(re[t.COMPARATORLOOSE]);
|
|
833
|
+
});
|
|
834
|
+
}
|
|
835
|
+
debug("range list", rangeList);
|
|
836
|
+
const rangeMap = /* @__PURE__ */ new Map();
|
|
837
|
+
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
838
|
+
for (const comp of comparators) {
|
|
839
|
+
if (isNullSet(comp)) {
|
|
840
|
+
return [comp];
|
|
841
|
+
}
|
|
842
|
+
rangeMap.set(comp.value, comp);
|
|
843
|
+
}
|
|
844
|
+
if (rangeMap.size > 1 && rangeMap.has("")) {
|
|
845
|
+
rangeMap.delete("");
|
|
846
|
+
}
|
|
847
|
+
const result = [...rangeMap.values()];
|
|
848
|
+
cache.set(memoKey, result);
|
|
849
|
+
return result;
|
|
850
|
+
}
|
|
851
|
+
intersects(range, options) {
|
|
852
|
+
if (!(range instanceof _Range)) {
|
|
853
|
+
throw new TypeError("a Range is required");
|
|
854
|
+
}
|
|
855
|
+
return this.set.some((thisComparators) => {
|
|
856
|
+
return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
|
|
857
|
+
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
858
|
+
return rangeComparators.every((rangeComparator) => {
|
|
859
|
+
return thisComparator.intersects(rangeComparator, options);
|
|
860
|
+
});
|
|
861
|
+
});
|
|
862
|
+
});
|
|
863
|
+
});
|
|
864
|
+
}
|
|
865
|
+
// if ANY of the sets match ALL of its comparators, then pass
|
|
866
|
+
test(version) {
|
|
867
|
+
if (!version) {
|
|
868
|
+
return false;
|
|
869
|
+
}
|
|
870
|
+
if (typeof version === "string") {
|
|
871
|
+
try {
|
|
872
|
+
version = new SemVer(version, this.options);
|
|
873
|
+
} catch (er) {
|
|
874
|
+
return false;
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
878
|
+
if (testSet(this.set[i], version, this.options)) {
|
|
879
|
+
return true;
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
return false;
|
|
883
|
+
}
|
|
884
|
+
};
|
|
885
|
+
module.exports = Range;
|
|
886
|
+
var LRU = require_lrucache();
|
|
887
|
+
var cache = new LRU();
|
|
888
|
+
var parseOptions = require_parse_options();
|
|
889
|
+
var Comparator = require_comparator();
|
|
890
|
+
var debug = require_debug();
|
|
891
|
+
var SemVer = require_semver();
|
|
892
|
+
var {
|
|
893
|
+
safeRe: re,
|
|
894
|
+
t,
|
|
895
|
+
comparatorTrimReplace,
|
|
896
|
+
tildeTrimReplace,
|
|
897
|
+
caretTrimReplace
|
|
898
|
+
} = require_re();
|
|
899
|
+
var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
|
|
900
|
+
var isNullSet = (c) => c.value === "<0.0.0-0";
|
|
901
|
+
var isAny = (c) => c.value === "";
|
|
902
|
+
var isSatisfiable = (comparators, options) => {
|
|
903
|
+
let result = true;
|
|
904
|
+
const remainingComparators = comparators.slice();
|
|
905
|
+
let testComparator = remainingComparators.pop();
|
|
906
|
+
while (result && remainingComparators.length) {
|
|
907
|
+
result = remainingComparators.every((otherComparator) => {
|
|
908
|
+
return testComparator.intersects(otherComparator, options);
|
|
909
|
+
});
|
|
910
|
+
testComparator = remainingComparators.pop();
|
|
911
|
+
}
|
|
912
|
+
return result;
|
|
913
|
+
};
|
|
914
|
+
var parseComparator = (comp, options) => {
|
|
915
|
+
debug("comp", comp, options);
|
|
916
|
+
comp = replaceCarets(comp, options);
|
|
917
|
+
debug("caret", comp);
|
|
918
|
+
comp = replaceTildes(comp, options);
|
|
919
|
+
debug("tildes", comp);
|
|
920
|
+
comp = replaceXRanges(comp, options);
|
|
921
|
+
debug("xrange", comp);
|
|
922
|
+
comp = replaceStars(comp, options);
|
|
923
|
+
debug("stars", comp);
|
|
924
|
+
return comp;
|
|
925
|
+
};
|
|
926
|
+
var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
927
|
+
var replaceTildes = (comp, options) => {
|
|
928
|
+
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
929
|
+
};
|
|
930
|
+
var replaceTilde = (comp, options) => {
|
|
931
|
+
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
932
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
933
|
+
debug("tilde", comp, _, M, m, p, pr);
|
|
934
|
+
let ret;
|
|
935
|
+
if (isX(M)) {
|
|
936
|
+
ret = "";
|
|
937
|
+
} else if (isX(m)) {
|
|
938
|
+
ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
|
|
939
|
+
} else if (isX(p)) {
|
|
940
|
+
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
|
|
941
|
+
} else if (pr) {
|
|
942
|
+
debug("replaceTilde pr", pr);
|
|
943
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
944
|
+
} else {
|
|
945
|
+
ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
946
|
+
}
|
|
947
|
+
debug("tilde return", ret);
|
|
948
|
+
return ret;
|
|
949
|
+
});
|
|
950
|
+
};
|
|
951
|
+
var replaceCarets = (comp, options) => {
|
|
952
|
+
return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
|
|
953
|
+
};
|
|
954
|
+
var replaceCaret = (comp, options) => {
|
|
955
|
+
debug("caret", comp, options);
|
|
956
|
+
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
957
|
+
const z2 = options.includePrerelease ? "-0" : "";
|
|
958
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
959
|
+
debug("caret", comp, _, M, m, p, pr);
|
|
960
|
+
let ret;
|
|
961
|
+
if (isX(M)) {
|
|
962
|
+
ret = "";
|
|
963
|
+
} else if (isX(m)) {
|
|
964
|
+
ret = `>=${M}.0.0${z2} <${+M + 1}.0.0-0`;
|
|
965
|
+
} else if (isX(p)) {
|
|
966
|
+
if (M === "0") {
|
|
967
|
+
ret = `>=${M}.${m}.0${z2} <${M}.${+m + 1}.0-0`;
|
|
968
|
+
} else {
|
|
969
|
+
ret = `>=${M}.${m}.0${z2} <${+M + 1}.0.0-0`;
|
|
970
|
+
}
|
|
971
|
+
} else if (pr) {
|
|
972
|
+
debug("replaceCaret pr", pr);
|
|
973
|
+
if (M === "0") {
|
|
974
|
+
if (m === "0") {
|
|
975
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
|
976
|
+
} else {
|
|
977
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
978
|
+
}
|
|
979
|
+
} else {
|
|
980
|
+
ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
981
|
+
}
|
|
982
|
+
} else {
|
|
983
|
+
debug("no pr");
|
|
984
|
+
if (M === "0") {
|
|
985
|
+
if (m === "0") {
|
|
986
|
+
ret = `>=${M}.${m}.${p}${z2} <${M}.${m}.${+p + 1}-0`;
|
|
987
|
+
} else {
|
|
988
|
+
ret = `>=${M}.${m}.${p}${z2} <${M}.${+m + 1}.0-0`;
|
|
989
|
+
}
|
|
990
|
+
} else {
|
|
991
|
+
ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
debug("caret return", ret);
|
|
995
|
+
return ret;
|
|
996
|
+
});
|
|
997
|
+
};
|
|
998
|
+
var replaceXRanges = (comp, options) => {
|
|
999
|
+
debug("replaceXRanges", comp, options);
|
|
1000
|
+
return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
|
|
1001
|
+
};
|
|
1002
|
+
var replaceXRange = (comp, options) => {
|
|
1003
|
+
comp = comp.trim();
|
|
1004
|
+
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
1005
|
+
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
1006
|
+
debug("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
1007
|
+
const xM = isX(M);
|
|
1008
|
+
const xm = xM || isX(m);
|
|
1009
|
+
const xp = xm || isX(p);
|
|
1010
|
+
const anyX = xp;
|
|
1011
|
+
if (gtlt === "=" && anyX) {
|
|
1012
|
+
gtlt = "";
|
|
1013
|
+
}
|
|
1014
|
+
pr = options.includePrerelease ? "-0" : "";
|
|
1015
|
+
if (xM) {
|
|
1016
|
+
if (gtlt === ">" || gtlt === "<") {
|
|
1017
|
+
ret = "<0.0.0-0";
|
|
1018
|
+
} else {
|
|
1019
|
+
ret = "*";
|
|
1020
|
+
}
|
|
1021
|
+
} else if (gtlt && anyX) {
|
|
1022
|
+
if (xm) {
|
|
1023
|
+
m = 0;
|
|
1024
|
+
}
|
|
1025
|
+
p = 0;
|
|
1026
|
+
if (gtlt === ">") {
|
|
1027
|
+
gtlt = ">=";
|
|
1028
|
+
if (xm) {
|
|
1029
|
+
M = +M + 1;
|
|
1030
|
+
m = 0;
|
|
1031
|
+
p = 0;
|
|
1032
|
+
} else {
|
|
1033
|
+
m = +m + 1;
|
|
1034
|
+
p = 0;
|
|
1035
|
+
}
|
|
1036
|
+
} else if (gtlt === "<=") {
|
|
1037
|
+
gtlt = "<";
|
|
1038
|
+
if (xm) {
|
|
1039
|
+
M = +M + 1;
|
|
1040
|
+
} else {
|
|
1041
|
+
m = +m + 1;
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
if (gtlt === "<") {
|
|
1045
|
+
pr = "-0";
|
|
1046
|
+
}
|
|
1047
|
+
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
1048
|
+
} else if (xm) {
|
|
1049
|
+
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
1050
|
+
} else if (xp) {
|
|
1051
|
+
ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
|
|
1052
|
+
}
|
|
1053
|
+
debug("xRange return", ret);
|
|
1054
|
+
return ret;
|
|
1055
|
+
});
|
|
1056
|
+
};
|
|
1057
|
+
var replaceStars = (comp, options) => {
|
|
1058
|
+
debug("replaceStars", comp, options);
|
|
1059
|
+
return comp.trim().replace(re[t.STAR], "");
|
|
1060
|
+
};
|
|
1061
|
+
var replaceGTE0 = (comp, options) => {
|
|
1062
|
+
debug("replaceGTE0", comp, options);
|
|
1063
|
+
return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
1064
|
+
};
|
|
1065
|
+
var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
1066
|
+
if (isX(fM)) {
|
|
1067
|
+
from = "";
|
|
1068
|
+
} else if (isX(fm)) {
|
|
1069
|
+
from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
|
1070
|
+
} else if (isX(fp)) {
|
|
1071
|
+
from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
|
1072
|
+
} else if (fpr) {
|
|
1073
|
+
from = `>=${from}`;
|
|
1074
|
+
} else {
|
|
1075
|
+
from = `>=${from}${incPr ? "-0" : ""}`;
|
|
1076
|
+
}
|
|
1077
|
+
if (isX(tM)) {
|
|
1078
|
+
to = "";
|
|
1079
|
+
} else if (isX(tm)) {
|
|
1080
|
+
to = `<${+tM + 1}.0.0-0`;
|
|
1081
|
+
} else if (isX(tp)) {
|
|
1082
|
+
to = `<${tM}.${+tm + 1}.0-0`;
|
|
1083
|
+
} else if (tpr) {
|
|
1084
|
+
to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
1085
|
+
} else if (incPr) {
|
|
1086
|
+
to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
1087
|
+
} else {
|
|
1088
|
+
to = `<=${to}`;
|
|
1089
|
+
}
|
|
1090
|
+
return `${from} ${to}`.trim();
|
|
1091
|
+
};
|
|
1092
|
+
var testSet = (set, version, options) => {
|
|
1093
|
+
for (let i = 0; i < set.length; i++) {
|
|
1094
|
+
if (!set[i].test(version)) {
|
|
1095
|
+
return false;
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
if (version.prerelease.length && !options.includePrerelease) {
|
|
1099
|
+
for (let i = 0; i < set.length; i++) {
|
|
1100
|
+
debug(set[i].semver);
|
|
1101
|
+
if (set[i].semver === Comparator.ANY) {
|
|
1102
|
+
continue;
|
|
1103
|
+
}
|
|
1104
|
+
if (set[i].semver.prerelease.length > 0) {
|
|
1105
|
+
const allowed = set[i].semver;
|
|
1106
|
+
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
|
|
1107
|
+
return true;
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
return false;
|
|
1112
|
+
}
|
|
1113
|
+
return true;
|
|
1114
|
+
};
|
|
1115
|
+
}
|
|
1116
|
+
});
|
|
1117
|
+
|
|
1118
|
+
// ../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/satisfies.js
|
|
1119
|
+
var require_satisfies = __commonJS({
|
|
1120
|
+
"../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/satisfies.js"(exports, module) {
|
|
1121
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
1122
|
+
var Range = require_range();
|
|
1123
|
+
var satisfies = (version, range, options) => {
|
|
1124
|
+
try {
|
|
1125
|
+
range = new Range(range, options);
|
|
1126
|
+
} catch (er) {
|
|
1127
|
+
return false;
|
|
1128
|
+
}
|
|
1129
|
+
return range.test(version);
|
|
1130
|
+
};
|
|
1131
|
+
module.exports = satisfies;
|
|
1132
|
+
}
|
|
1133
|
+
});
|
|
3
1134
|
|
|
4
1135
|
// src/pool/index.ts
|
|
1136
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
5
1137
|
import assert4 from "node:assert";
|
|
6
1138
|
import crypto from "node:crypto";
|
|
7
1139
|
import events from "node:events";
|
|
@@ -9,9 +1141,726 @@ import fs3 from "node:fs";
|
|
|
9
1141
|
import path5 from "node:path";
|
|
10
1142
|
import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "node:url";
|
|
11
1143
|
import util2 from "node:util";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1144
|
+
|
|
1145
|
+
// ../../node_modules/.pnpm/birpc@0.2.14/node_modules/birpc/dist/index.mjs
|
|
1146
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
1147
|
+
var DEFAULT_TIMEOUT = 6e4;
|
|
1148
|
+
function defaultSerialize(i) {
|
|
1149
|
+
return i;
|
|
1150
|
+
}
|
|
1151
|
+
var defaultDeserialize = defaultSerialize;
|
|
1152
|
+
var { clearTimeout, setTimeout: setTimeout2 } = globalThis;
|
|
1153
|
+
var random = Math.random.bind(Math);
|
|
1154
|
+
function createBirpc(functions, options) {
|
|
1155
|
+
const {
|
|
1156
|
+
post,
|
|
1157
|
+
on,
|
|
1158
|
+
eventNames = [],
|
|
1159
|
+
serialize = defaultSerialize,
|
|
1160
|
+
deserialize = defaultDeserialize,
|
|
1161
|
+
resolver,
|
|
1162
|
+
timeout: timeout2 = DEFAULT_TIMEOUT
|
|
1163
|
+
} = options;
|
|
1164
|
+
const rpcPromiseMap = /* @__PURE__ */ new Map();
|
|
1165
|
+
let _promise;
|
|
1166
|
+
const rpc = new Proxy({}, {
|
|
1167
|
+
get(_, method) {
|
|
1168
|
+
if (method === "$functions")
|
|
1169
|
+
return functions;
|
|
1170
|
+
const sendEvent = (...args) => {
|
|
1171
|
+
post(serialize({ m: method, a: args, t: "q" }));
|
|
1172
|
+
};
|
|
1173
|
+
if (eventNames.includes(method)) {
|
|
1174
|
+
sendEvent.asEvent = sendEvent;
|
|
1175
|
+
return sendEvent;
|
|
1176
|
+
}
|
|
1177
|
+
const sendCall = async (...args) => {
|
|
1178
|
+
await _promise;
|
|
1179
|
+
return new Promise((resolve2, reject) => {
|
|
1180
|
+
const id = nanoid();
|
|
1181
|
+
let timeoutId;
|
|
1182
|
+
if (timeout2 >= 0) {
|
|
1183
|
+
timeoutId = setTimeout2(() => {
|
|
1184
|
+
reject(new Error(`[birpc] timeout on calling "${method}"`));
|
|
1185
|
+
rpcPromiseMap.delete(id);
|
|
1186
|
+
}, timeout2).unref?.();
|
|
1187
|
+
}
|
|
1188
|
+
rpcPromiseMap.set(id, { resolve: resolve2, reject, timeoutId });
|
|
1189
|
+
post(serialize({ m: method, a: args, i: id, t: "q" }));
|
|
1190
|
+
});
|
|
1191
|
+
};
|
|
1192
|
+
sendCall.asEvent = sendEvent;
|
|
1193
|
+
return sendCall;
|
|
1194
|
+
}
|
|
1195
|
+
});
|
|
1196
|
+
_promise = on(async (data, ...extra) => {
|
|
1197
|
+
const msg = deserialize(data);
|
|
1198
|
+
if (msg.t === "q") {
|
|
1199
|
+
const { m: method, a: args } = msg;
|
|
1200
|
+
let result, error;
|
|
1201
|
+
const fn = resolver ? resolver(method, functions[method]) : functions[method];
|
|
1202
|
+
if (!fn) {
|
|
1203
|
+
error = new Error(`[birpc] function "${method}" not found`);
|
|
1204
|
+
} else {
|
|
1205
|
+
try {
|
|
1206
|
+
result = await fn.apply(rpc, args);
|
|
1207
|
+
} catch (e) {
|
|
1208
|
+
error = e;
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
if (msg.i) {
|
|
1212
|
+
if (error && options.onError)
|
|
1213
|
+
options.onError(error, method, args);
|
|
1214
|
+
post(serialize({ t: "s", i: msg.i, r: result, e: error }), ...extra);
|
|
1215
|
+
}
|
|
1216
|
+
} else {
|
|
1217
|
+
const { i: ack, r: result, e: error } = msg;
|
|
1218
|
+
const promise = rpcPromiseMap.get(ack);
|
|
1219
|
+
if (promise) {
|
|
1220
|
+
clearTimeout(promise.timeoutId);
|
|
1221
|
+
if (error)
|
|
1222
|
+
promise.reject(error);
|
|
1223
|
+
else
|
|
1224
|
+
promise.resolve(result);
|
|
1225
|
+
}
|
|
1226
|
+
rpcPromiseMap.delete(ack);
|
|
1227
|
+
}
|
|
1228
|
+
});
|
|
1229
|
+
return rpc;
|
|
1230
|
+
}
|
|
1231
|
+
var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
1232
|
+
function nanoid(size = 21) {
|
|
1233
|
+
let id = "";
|
|
1234
|
+
let i = size;
|
|
1235
|
+
while (i--)
|
|
1236
|
+
id += urlAlphabet[random() * 64 | 0];
|
|
1237
|
+
return id;
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
// ../../node_modules/.pnpm/devalue@5.3.2/node_modules/devalue/index.js
|
|
1241
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
1242
|
+
|
|
1243
|
+
// ../../node_modules/.pnpm/devalue@5.3.2/node_modules/devalue/src/utils.js
|
|
1244
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
1245
|
+
var DevalueError = class extends Error {
|
|
1246
|
+
/**
|
|
1247
|
+
* @param {string} message
|
|
1248
|
+
* @param {string[]} keys
|
|
1249
|
+
*/
|
|
1250
|
+
constructor(message, keys) {
|
|
1251
|
+
super(message);
|
|
1252
|
+
this.name = "DevalueError";
|
|
1253
|
+
this.path = keys.join("");
|
|
1254
|
+
}
|
|
1255
|
+
};
|
|
1256
|
+
function is_primitive(thing) {
|
|
1257
|
+
return Object(thing) !== thing;
|
|
1258
|
+
}
|
|
1259
|
+
var object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(
|
|
1260
|
+
Object.prototype
|
|
1261
|
+
).sort().join("\0");
|
|
1262
|
+
function is_plain_object(thing) {
|
|
1263
|
+
const proto = Object.getPrototypeOf(thing);
|
|
1264
|
+
return proto === Object.prototype || proto === null || Object.getPrototypeOf(proto) === null || Object.getOwnPropertyNames(proto).sort().join("\0") === object_proto_names;
|
|
1265
|
+
}
|
|
1266
|
+
function get_type(thing) {
|
|
1267
|
+
return Object.prototype.toString.call(thing).slice(8, -1);
|
|
1268
|
+
}
|
|
1269
|
+
function get_escaped_char(char) {
|
|
1270
|
+
switch (char) {
|
|
1271
|
+
case '"':
|
|
1272
|
+
return '\\"';
|
|
1273
|
+
case "<":
|
|
1274
|
+
return "\\u003C";
|
|
1275
|
+
case "\\":
|
|
1276
|
+
return "\\\\";
|
|
1277
|
+
case "\n":
|
|
1278
|
+
return "\\n";
|
|
1279
|
+
case "\r":
|
|
1280
|
+
return "\\r";
|
|
1281
|
+
case " ":
|
|
1282
|
+
return "\\t";
|
|
1283
|
+
case "\b":
|
|
1284
|
+
return "\\b";
|
|
1285
|
+
case "\f":
|
|
1286
|
+
return "\\f";
|
|
1287
|
+
case "\u2028":
|
|
1288
|
+
return "\\u2028";
|
|
1289
|
+
case "\u2029":
|
|
1290
|
+
return "\\u2029";
|
|
1291
|
+
default:
|
|
1292
|
+
return char < " " ? `\\u${char.charCodeAt(0).toString(16).padStart(4, "0")}` : "";
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
function stringify_string(str) {
|
|
1296
|
+
let result = "";
|
|
1297
|
+
let last_pos = 0;
|
|
1298
|
+
const len = str.length;
|
|
1299
|
+
for (let i = 0; i < len; i += 1) {
|
|
1300
|
+
const char = str[i];
|
|
1301
|
+
const replacement = get_escaped_char(char);
|
|
1302
|
+
if (replacement) {
|
|
1303
|
+
result += str.slice(last_pos, i) + replacement;
|
|
1304
|
+
last_pos = i + 1;
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
return `"${last_pos === 0 ? str : result + str.slice(last_pos)}"`;
|
|
1308
|
+
}
|
|
1309
|
+
function enumerable_symbols(object) {
|
|
1310
|
+
return Object.getOwnPropertySymbols(object).filter(
|
|
1311
|
+
(symbol) => Object.getOwnPropertyDescriptor(object, symbol).enumerable
|
|
1312
|
+
);
|
|
1313
|
+
}
|
|
1314
|
+
var is_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
|
|
1315
|
+
function stringify_key(key) {
|
|
1316
|
+
return is_identifier.test(key) ? "." + key : "[" + JSON.stringify(key) + "]";
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
// ../../node_modules/.pnpm/devalue@5.3.2/node_modules/devalue/src/parse.js
|
|
1320
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
1321
|
+
|
|
1322
|
+
// ../../node_modules/.pnpm/devalue@5.3.2/node_modules/devalue/src/base64.js
|
|
1323
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
1324
|
+
function encode64(arraybuffer) {
|
|
1325
|
+
const dv = new DataView(arraybuffer);
|
|
1326
|
+
let binaryString = "";
|
|
1327
|
+
for (let i = 0; i < arraybuffer.byteLength; i++) {
|
|
1328
|
+
binaryString += String.fromCharCode(dv.getUint8(i));
|
|
1329
|
+
}
|
|
1330
|
+
return binaryToAscii(binaryString);
|
|
1331
|
+
}
|
|
1332
|
+
function decode64(string) {
|
|
1333
|
+
const binaryString = asciiToBinary(string);
|
|
1334
|
+
const arraybuffer = new ArrayBuffer(binaryString.length);
|
|
1335
|
+
const dv = new DataView(arraybuffer);
|
|
1336
|
+
for (let i = 0; i < arraybuffer.byteLength; i++) {
|
|
1337
|
+
dv.setUint8(i, binaryString.charCodeAt(i));
|
|
1338
|
+
}
|
|
1339
|
+
return arraybuffer;
|
|
1340
|
+
}
|
|
1341
|
+
var KEY_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1342
|
+
function asciiToBinary(data) {
|
|
1343
|
+
if (data.length % 4 === 0) {
|
|
1344
|
+
data = data.replace(/==?$/, "");
|
|
1345
|
+
}
|
|
1346
|
+
let output = "";
|
|
1347
|
+
let buffer = 0;
|
|
1348
|
+
let accumulatedBits = 0;
|
|
1349
|
+
for (let i = 0; i < data.length; i++) {
|
|
1350
|
+
buffer <<= 6;
|
|
1351
|
+
buffer |= KEY_STRING.indexOf(data[i]);
|
|
1352
|
+
accumulatedBits += 6;
|
|
1353
|
+
if (accumulatedBits === 24) {
|
|
1354
|
+
output += String.fromCharCode((buffer & 16711680) >> 16);
|
|
1355
|
+
output += String.fromCharCode((buffer & 65280) >> 8);
|
|
1356
|
+
output += String.fromCharCode(buffer & 255);
|
|
1357
|
+
buffer = accumulatedBits = 0;
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
if (accumulatedBits === 12) {
|
|
1361
|
+
buffer >>= 4;
|
|
1362
|
+
output += String.fromCharCode(buffer);
|
|
1363
|
+
} else if (accumulatedBits === 18) {
|
|
1364
|
+
buffer >>= 2;
|
|
1365
|
+
output += String.fromCharCode((buffer & 65280) >> 8);
|
|
1366
|
+
output += String.fromCharCode(buffer & 255);
|
|
1367
|
+
}
|
|
1368
|
+
return output;
|
|
1369
|
+
}
|
|
1370
|
+
function binaryToAscii(str) {
|
|
1371
|
+
let out = "";
|
|
1372
|
+
for (let i = 0; i < str.length; i += 3) {
|
|
1373
|
+
const groupsOfSix = [void 0, void 0, void 0, void 0];
|
|
1374
|
+
groupsOfSix[0] = str.charCodeAt(i) >> 2;
|
|
1375
|
+
groupsOfSix[1] = (str.charCodeAt(i) & 3) << 4;
|
|
1376
|
+
if (str.length > i + 1) {
|
|
1377
|
+
groupsOfSix[1] |= str.charCodeAt(i + 1) >> 4;
|
|
1378
|
+
groupsOfSix[2] = (str.charCodeAt(i + 1) & 15) << 2;
|
|
1379
|
+
}
|
|
1380
|
+
if (str.length > i + 2) {
|
|
1381
|
+
groupsOfSix[2] |= str.charCodeAt(i + 2) >> 6;
|
|
1382
|
+
groupsOfSix[3] = str.charCodeAt(i + 2) & 63;
|
|
1383
|
+
}
|
|
1384
|
+
for (let j = 0; j < groupsOfSix.length; j++) {
|
|
1385
|
+
if (typeof groupsOfSix[j] === "undefined") {
|
|
1386
|
+
out += "=";
|
|
1387
|
+
} else {
|
|
1388
|
+
out += KEY_STRING[groupsOfSix[j]];
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
return out;
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
// ../../node_modules/.pnpm/devalue@5.3.2/node_modules/devalue/src/constants.js
|
|
1396
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
1397
|
+
var UNDEFINED = -1;
|
|
1398
|
+
var HOLE = -2;
|
|
1399
|
+
var NAN = -3;
|
|
1400
|
+
var POSITIVE_INFINITY = -4;
|
|
1401
|
+
var NEGATIVE_INFINITY = -5;
|
|
1402
|
+
var NEGATIVE_ZERO = -6;
|
|
1403
|
+
|
|
1404
|
+
// ../../node_modules/.pnpm/devalue@5.3.2/node_modules/devalue/src/parse.js
|
|
1405
|
+
function parse(serialized, revivers) {
|
|
1406
|
+
return unflatten(JSON.parse(serialized), revivers);
|
|
1407
|
+
}
|
|
1408
|
+
function unflatten(parsed, revivers) {
|
|
1409
|
+
if (typeof parsed === "number") return hydrate(parsed, true);
|
|
1410
|
+
if (!Array.isArray(parsed) || parsed.length === 0) {
|
|
1411
|
+
throw new Error("Invalid input");
|
|
1412
|
+
}
|
|
1413
|
+
const values = (
|
|
1414
|
+
/** @type {any[]} */
|
|
1415
|
+
parsed
|
|
1416
|
+
);
|
|
1417
|
+
const hydrated = Array(values.length);
|
|
1418
|
+
function hydrate(index, standalone = false) {
|
|
1419
|
+
if (index === UNDEFINED) return void 0;
|
|
1420
|
+
if (index === NAN) return NaN;
|
|
1421
|
+
if (index === POSITIVE_INFINITY) return Infinity;
|
|
1422
|
+
if (index === NEGATIVE_INFINITY) return -Infinity;
|
|
1423
|
+
if (index === NEGATIVE_ZERO) return -0;
|
|
1424
|
+
if (standalone || typeof index !== "number") {
|
|
1425
|
+
throw new Error(`Invalid input`);
|
|
1426
|
+
}
|
|
1427
|
+
if (index in hydrated) return hydrated[index];
|
|
1428
|
+
const value = values[index];
|
|
1429
|
+
if (!value || typeof value !== "object") {
|
|
1430
|
+
hydrated[index] = value;
|
|
1431
|
+
} else if (Array.isArray(value)) {
|
|
1432
|
+
if (typeof value[0] === "string") {
|
|
1433
|
+
const type = value[0];
|
|
1434
|
+
const reviver = revivers?.[type];
|
|
1435
|
+
if (reviver) {
|
|
1436
|
+
return hydrated[index] = reviver(hydrate(value[1]));
|
|
1437
|
+
}
|
|
1438
|
+
switch (type) {
|
|
1439
|
+
case "Date":
|
|
1440
|
+
hydrated[index] = new Date(value[1]);
|
|
1441
|
+
break;
|
|
1442
|
+
case "Set":
|
|
1443
|
+
const set = /* @__PURE__ */ new Set();
|
|
1444
|
+
hydrated[index] = set;
|
|
1445
|
+
for (let i = 1; i < value.length; i += 1) {
|
|
1446
|
+
set.add(hydrate(value[i]));
|
|
1447
|
+
}
|
|
1448
|
+
break;
|
|
1449
|
+
case "Map":
|
|
1450
|
+
const map = /* @__PURE__ */ new Map();
|
|
1451
|
+
hydrated[index] = map;
|
|
1452
|
+
for (let i = 1; i < value.length; i += 2) {
|
|
1453
|
+
map.set(hydrate(value[i]), hydrate(value[i + 1]));
|
|
1454
|
+
}
|
|
1455
|
+
break;
|
|
1456
|
+
case "RegExp":
|
|
1457
|
+
hydrated[index] = new RegExp(value[1], value[2]);
|
|
1458
|
+
break;
|
|
1459
|
+
case "Object":
|
|
1460
|
+
hydrated[index] = Object(value[1]);
|
|
1461
|
+
break;
|
|
1462
|
+
case "BigInt":
|
|
1463
|
+
hydrated[index] = BigInt(value[1]);
|
|
1464
|
+
break;
|
|
1465
|
+
case "null":
|
|
1466
|
+
const obj = /* @__PURE__ */ Object.create(null);
|
|
1467
|
+
hydrated[index] = obj;
|
|
1468
|
+
for (let i = 1; i < value.length; i += 2) {
|
|
1469
|
+
obj[value[i]] = hydrate(value[i + 1]);
|
|
1470
|
+
}
|
|
1471
|
+
break;
|
|
1472
|
+
case "Int8Array":
|
|
1473
|
+
case "Uint8Array":
|
|
1474
|
+
case "Uint8ClampedArray":
|
|
1475
|
+
case "Int16Array":
|
|
1476
|
+
case "Uint16Array":
|
|
1477
|
+
case "Int32Array":
|
|
1478
|
+
case "Uint32Array":
|
|
1479
|
+
case "Float32Array":
|
|
1480
|
+
case "Float64Array":
|
|
1481
|
+
case "BigInt64Array":
|
|
1482
|
+
case "BigUint64Array": {
|
|
1483
|
+
const TypedArrayConstructor = globalThis[type];
|
|
1484
|
+
const typedArray = new TypedArrayConstructor(hydrate(value[1]));
|
|
1485
|
+
hydrated[index] = value[2] !== void 0 ? typedArray.subarray(value[2], value[3]) : typedArray;
|
|
1486
|
+
break;
|
|
1487
|
+
}
|
|
1488
|
+
case "ArrayBuffer": {
|
|
1489
|
+
const base64 = value[1];
|
|
1490
|
+
const arraybuffer = decode64(base64);
|
|
1491
|
+
hydrated[index] = arraybuffer;
|
|
1492
|
+
break;
|
|
1493
|
+
}
|
|
1494
|
+
case "Temporal.Duration":
|
|
1495
|
+
case "Temporal.Instant":
|
|
1496
|
+
case "Temporal.PlainDate":
|
|
1497
|
+
case "Temporal.PlainTime":
|
|
1498
|
+
case "Temporal.PlainDateTime":
|
|
1499
|
+
case "Temporal.PlainMonthDay":
|
|
1500
|
+
case "Temporal.PlainYearMonth":
|
|
1501
|
+
case "Temporal.ZonedDateTime": {
|
|
1502
|
+
const temporalName = type.slice(9);
|
|
1503
|
+
hydrated[index] = Temporal[temporalName].from(value[1]);
|
|
1504
|
+
break;
|
|
1505
|
+
}
|
|
1506
|
+
case "URL": {
|
|
1507
|
+
const url = new URL(value[1]);
|
|
1508
|
+
hydrated[index] = url;
|
|
1509
|
+
break;
|
|
1510
|
+
}
|
|
1511
|
+
case "URLSearchParams": {
|
|
1512
|
+
const url = new URLSearchParams(value[1]);
|
|
1513
|
+
hydrated[index] = url;
|
|
1514
|
+
break;
|
|
1515
|
+
}
|
|
1516
|
+
default:
|
|
1517
|
+
throw new Error(`Unknown type ${type}`);
|
|
1518
|
+
}
|
|
1519
|
+
} else {
|
|
1520
|
+
const array = new Array(value.length);
|
|
1521
|
+
hydrated[index] = array;
|
|
1522
|
+
for (let i = 0; i < value.length; i += 1) {
|
|
1523
|
+
const n = value[i];
|
|
1524
|
+
if (n === HOLE) continue;
|
|
1525
|
+
array[i] = hydrate(n);
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
} else {
|
|
1529
|
+
const object = {};
|
|
1530
|
+
hydrated[index] = object;
|
|
1531
|
+
for (const key in value) {
|
|
1532
|
+
if (key === "__proto__") {
|
|
1533
|
+
throw new Error("Cannot parse an object with a `__proto__` property");
|
|
1534
|
+
}
|
|
1535
|
+
const n = value[key];
|
|
1536
|
+
object[key] = hydrate(n);
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
return hydrated[index];
|
|
1540
|
+
}
|
|
1541
|
+
return hydrate(0);
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
// ../../node_modules/.pnpm/devalue@5.3.2/node_modules/devalue/src/stringify.js
|
|
1545
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
1546
|
+
function stringify(value, reducers) {
|
|
1547
|
+
const stringified = [];
|
|
1548
|
+
const indexes = /* @__PURE__ */ new Map();
|
|
1549
|
+
const custom = [];
|
|
1550
|
+
if (reducers) {
|
|
1551
|
+
for (const key of Object.getOwnPropertyNames(reducers)) {
|
|
1552
|
+
custom.push({ key, fn: reducers[key] });
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
const keys = [];
|
|
1556
|
+
let p = 0;
|
|
1557
|
+
function flatten(thing) {
|
|
1558
|
+
if (typeof thing === "function") {
|
|
1559
|
+
throw new DevalueError(`Cannot stringify a function`, keys);
|
|
1560
|
+
}
|
|
1561
|
+
if (thing === void 0) return UNDEFINED;
|
|
1562
|
+
if (Number.isNaN(thing)) return NAN;
|
|
1563
|
+
if (thing === Infinity) return POSITIVE_INFINITY;
|
|
1564
|
+
if (thing === -Infinity) return NEGATIVE_INFINITY;
|
|
1565
|
+
if (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO;
|
|
1566
|
+
if (indexes.has(thing)) return indexes.get(thing);
|
|
1567
|
+
const index2 = p++;
|
|
1568
|
+
indexes.set(thing, index2);
|
|
1569
|
+
for (const { key, fn } of custom) {
|
|
1570
|
+
const value2 = fn(thing);
|
|
1571
|
+
if (value2) {
|
|
1572
|
+
stringified[index2] = `["${key}",${flatten(value2)}]`;
|
|
1573
|
+
return index2;
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
let str = "";
|
|
1577
|
+
if (is_primitive(thing)) {
|
|
1578
|
+
str = stringify_primitive(thing);
|
|
1579
|
+
} else {
|
|
1580
|
+
const type = get_type(thing);
|
|
1581
|
+
switch (type) {
|
|
1582
|
+
case "Number":
|
|
1583
|
+
case "String":
|
|
1584
|
+
case "Boolean":
|
|
1585
|
+
str = `["Object",${stringify_primitive(thing)}]`;
|
|
1586
|
+
break;
|
|
1587
|
+
case "BigInt":
|
|
1588
|
+
str = `["BigInt",${thing}]`;
|
|
1589
|
+
break;
|
|
1590
|
+
case "Date":
|
|
1591
|
+
const valid = !isNaN(thing.getDate());
|
|
1592
|
+
str = `["Date","${valid ? thing.toISOString() : ""}"]`;
|
|
1593
|
+
break;
|
|
1594
|
+
case "URL":
|
|
1595
|
+
str = `["URL",${stringify_string(thing.toString())}]`;
|
|
1596
|
+
break;
|
|
1597
|
+
case "URLSearchParams":
|
|
1598
|
+
str = `["URLSearchParams",${stringify_string(thing.toString())}]`;
|
|
1599
|
+
break;
|
|
1600
|
+
case "RegExp":
|
|
1601
|
+
const { source, flags } = thing;
|
|
1602
|
+
str = flags ? `["RegExp",${stringify_string(source)},"${flags}"]` : `["RegExp",${stringify_string(source)}]`;
|
|
1603
|
+
break;
|
|
1604
|
+
case "Array":
|
|
1605
|
+
str = "[";
|
|
1606
|
+
for (let i = 0; i < thing.length; i += 1) {
|
|
1607
|
+
if (i > 0) str += ",";
|
|
1608
|
+
if (i in thing) {
|
|
1609
|
+
keys.push(`[${i}]`);
|
|
1610
|
+
str += flatten(thing[i]);
|
|
1611
|
+
keys.pop();
|
|
1612
|
+
} else {
|
|
1613
|
+
str += HOLE;
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
str += "]";
|
|
1617
|
+
break;
|
|
1618
|
+
case "Set":
|
|
1619
|
+
str = '["Set"';
|
|
1620
|
+
for (const value2 of thing) {
|
|
1621
|
+
str += `,${flatten(value2)}`;
|
|
1622
|
+
}
|
|
1623
|
+
str += "]";
|
|
1624
|
+
break;
|
|
1625
|
+
case "Map":
|
|
1626
|
+
str = '["Map"';
|
|
1627
|
+
for (const [key, value2] of thing) {
|
|
1628
|
+
keys.push(
|
|
1629
|
+
`.get(${is_primitive(key) ? stringify_primitive(key) : "..."})`
|
|
1630
|
+
);
|
|
1631
|
+
str += `,${flatten(key)},${flatten(value2)}`;
|
|
1632
|
+
keys.pop();
|
|
1633
|
+
}
|
|
1634
|
+
str += "]";
|
|
1635
|
+
break;
|
|
1636
|
+
case "Int8Array":
|
|
1637
|
+
case "Uint8Array":
|
|
1638
|
+
case "Uint8ClampedArray":
|
|
1639
|
+
case "Int16Array":
|
|
1640
|
+
case "Uint16Array":
|
|
1641
|
+
case "Int32Array":
|
|
1642
|
+
case "Uint32Array":
|
|
1643
|
+
case "Float32Array":
|
|
1644
|
+
case "Float64Array":
|
|
1645
|
+
case "BigInt64Array":
|
|
1646
|
+
case "BigUint64Array": {
|
|
1647
|
+
const typedArray = thing;
|
|
1648
|
+
str = '["' + type + '",' + flatten(typedArray.buffer);
|
|
1649
|
+
const a = thing.byteOffset;
|
|
1650
|
+
const b = a + thing.byteLength;
|
|
1651
|
+
if (a > 0 || b !== typedArray.buffer.byteLength) {
|
|
1652
|
+
const m = +/(\d+)/.exec(type)[1] / 8;
|
|
1653
|
+
str += `,${a / m},${b / m}`;
|
|
1654
|
+
}
|
|
1655
|
+
str += "]";
|
|
1656
|
+
break;
|
|
1657
|
+
}
|
|
1658
|
+
case "ArrayBuffer": {
|
|
1659
|
+
const arraybuffer = thing;
|
|
1660
|
+
const base64 = encode64(arraybuffer);
|
|
1661
|
+
str = `["ArrayBuffer","${base64}"]`;
|
|
1662
|
+
break;
|
|
1663
|
+
}
|
|
1664
|
+
case "Temporal.Duration":
|
|
1665
|
+
case "Temporal.Instant":
|
|
1666
|
+
case "Temporal.PlainDate":
|
|
1667
|
+
case "Temporal.PlainTime":
|
|
1668
|
+
case "Temporal.PlainDateTime":
|
|
1669
|
+
case "Temporal.PlainMonthDay":
|
|
1670
|
+
case "Temporal.PlainYearMonth":
|
|
1671
|
+
case "Temporal.ZonedDateTime":
|
|
1672
|
+
str = `["${type}",${stringify_string(thing.toString())}]`;
|
|
1673
|
+
break;
|
|
1674
|
+
default:
|
|
1675
|
+
if (!is_plain_object(thing)) {
|
|
1676
|
+
throw new DevalueError(
|
|
1677
|
+
`Cannot stringify arbitrary non-POJOs`,
|
|
1678
|
+
keys
|
|
1679
|
+
);
|
|
1680
|
+
}
|
|
1681
|
+
if (enumerable_symbols(thing).length > 0) {
|
|
1682
|
+
throw new DevalueError(
|
|
1683
|
+
`Cannot stringify POJOs with symbolic keys`,
|
|
1684
|
+
keys
|
|
1685
|
+
);
|
|
1686
|
+
}
|
|
1687
|
+
if (Object.getPrototypeOf(thing) === null) {
|
|
1688
|
+
str = '["null"';
|
|
1689
|
+
for (const key in thing) {
|
|
1690
|
+
keys.push(stringify_key(key));
|
|
1691
|
+
str += `,${stringify_string(key)},${flatten(thing[key])}`;
|
|
1692
|
+
keys.pop();
|
|
1693
|
+
}
|
|
1694
|
+
str += "]";
|
|
1695
|
+
} else {
|
|
1696
|
+
str = "{";
|
|
1697
|
+
let started = false;
|
|
1698
|
+
for (const key in thing) {
|
|
1699
|
+
if (started) str += ",";
|
|
1700
|
+
started = true;
|
|
1701
|
+
keys.push(stringify_key(key));
|
|
1702
|
+
str += `${stringify_string(key)}:${flatten(thing[key])}`;
|
|
1703
|
+
keys.pop();
|
|
1704
|
+
}
|
|
1705
|
+
str += "}";
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
stringified[index2] = str;
|
|
1710
|
+
return index2;
|
|
1711
|
+
}
|
|
1712
|
+
const index = flatten(value);
|
|
1713
|
+
if (index < 0) return `${index}`;
|
|
1714
|
+
return `[${stringified.join(",")}]`;
|
|
1715
|
+
}
|
|
1716
|
+
function stringify_primitive(thing) {
|
|
1717
|
+
const type = typeof thing;
|
|
1718
|
+
if (type === "string") return stringify_string(thing);
|
|
1719
|
+
if (thing instanceof String) return stringify_string(thing.toString());
|
|
1720
|
+
if (thing === void 0) return UNDEFINED.toString();
|
|
1721
|
+
if (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO.toString();
|
|
1722
|
+
if (type === "bigint") return `["BigInt","${thing}"]`;
|
|
1723
|
+
return String(thing);
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
// ../../node_modules/.pnpm/get-port@7.1.0/node_modules/get-port/index.js
|
|
1727
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
1728
|
+
import net from "node:net";
|
|
1729
|
+
import os from "node:os";
|
|
1730
|
+
var Locked = class extends Error {
|
|
1731
|
+
constructor(port) {
|
|
1732
|
+
super(`${port} is locked`);
|
|
1733
|
+
}
|
|
1734
|
+
};
|
|
1735
|
+
var lockedPorts = {
|
|
1736
|
+
old: /* @__PURE__ */ new Set(),
|
|
1737
|
+
young: /* @__PURE__ */ new Set()
|
|
1738
|
+
};
|
|
1739
|
+
var releaseOldLockedPortsIntervalMs = 1e3 * 15;
|
|
1740
|
+
var minPort = 1024;
|
|
1741
|
+
var maxPort = 65535;
|
|
1742
|
+
var timeout;
|
|
1743
|
+
var getLocalHosts = () => {
|
|
1744
|
+
const interfaces = os.networkInterfaces();
|
|
1745
|
+
const results = /* @__PURE__ */ new Set([void 0, "0.0.0.0"]);
|
|
1746
|
+
for (const _interface of Object.values(interfaces)) {
|
|
1747
|
+
for (const config of _interface) {
|
|
1748
|
+
results.add(config.address);
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
return results;
|
|
1752
|
+
};
|
|
1753
|
+
var checkAvailablePort = (options) => new Promise((resolve2, reject) => {
|
|
1754
|
+
const server = net.createServer();
|
|
1755
|
+
server.unref();
|
|
1756
|
+
server.on("error", reject);
|
|
1757
|
+
server.listen(options, () => {
|
|
1758
|
+
const { port } = server.address();
|
|
1759
|
+
server.close(() => {
|
|
1760
|
+
resolve2(port);
|
|
1761
|
+
});
|
|
1762
|
+
});
|
|
1763
|
+
});
|
|
1764
|
+
var getAvailablePort = async (options, hosts) => {
|
|
1765
|
+
if (options.host || options.port === 0) {
|
|
1766
|
+
return checkAvailablePort(options);
|
|
1767
|
+
}
|
|
1768
|
+
for (const host of hosts) {
|
|
1769
|
+
try {
|
|
1770
|
+
await checkAvailablePort({ port: options.port, host });
|
|
1771
|
+
} catch (error) {
|
|
1772
|
+
if (!["EADDRNOTAVAIL", "EINVAL"].includes(error.code)) {
|
|
1773
|
+
throw error;
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
return options.port;
|
|
1778
|
+
};
|
|
1779
|
+
var portCheckSequence = function* (ports) {
|
|
1780
|
+
if (ports) {
|
|
1781
|
+
yield* ports;
|
|
1782
|
+
}
|
|
1783
|
+
yield 0;
|
|
1784
|
+
};
|
|
1785
|
+
async function getPorts(options) {
|
|
1786
|
+
let ports;
|
|
1787
|
+
let exclude = /* @__PURE__ */ new Set();
|
|
1788
|
+
if (options) {
|
|
1789
|
+
if (options.port) {
|
|
1790
|
+
ports = typeof options.port === "number" ? [options.port] : options.port;
|
|
1791
|
+
}
|
|
1792
|
+
if (options.exclude) {
|
|
1793
|
+
const excludeIterable = options.exclude;
|
|
1794
|
+
if (typeof excludeIterable[Symbol.iterator] !== "function") {
|
|
1795
|
+
throw new TypeError("The `exclude` option must be an iterable.");
|
|
1796
|
+
}
|
|
1797
|
+
for (const element of excludeIterable) {
|
|
1798
|
+
if (typeof element !== "number") {
|
|
1799
|
+
throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");
|
|
1800
|
+
}
|
|
1801
|
+
if (!Number.isSafeInteger(element)) {
|
|
1802
|
+
throw new TypeError(`Number ${element} in the exclude option is not a safe integer and can't be used`);
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
exclude = new Set(excludeIterable);
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
if (timeout === void 0) {
|
|
1809
|
+
timeout = setTimeout(() => {
|
|
1810
|
+
timeout = void 0;
|
|
1811
|
+
lockedPorts.old = lockedPorts.young;
|
|
1812
|
+
lockedPorts.young = /* @__PURE__ */ new Set();
|
|
1813
|
+
}, releaseOldLockedPortsIntervalMs);
|
|
1814
|
+
if (timeout.unref) {
|
|
1815
|
+
timeout.unref();
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
const hosts = getLocalHosts();
|
|
1819
|
+
for (const port of portCheckSequence(ports)) {
|
|
1820
|
+
try {
|
|
1821
|
+
if (exclude.has(port)) {
|
|
1822
|
+
continue;
|
|
1823
|
+
}
|
|
1824
|
+
let availablePort = await getAvailablePort({ ...options, port }, hosts);
|
|
1825
|
+
while (lockedPorts.old.has(availablePort) || lockedPorts.young.has(availablePort)) {
|
|
1826
|
+
if (port !== 0) {
|
|
1827
|
+
throw new Locked(port);
|
|
1828
|
+
}
|
|
1829
|
+
availablePort = await getAvailablePort({ ...options, port }, hosts);
|
|
1830
|
+
}
|
|
1831
|
+
lockedPorts.young.add(availablePort);
|
|
1832
|
+
return availablePort;
|
|
1833
|
+
} catch (error) {
|
|
1834
|
+
if (!["EADDRINUSE", "EACCES"].includes(error.code) && !(error instanceof Locked)) {
|
|
1835
|
+
throw error;
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
throw new Error("No available ports found");
|
|
1840
|
+
}
|
|
1841
|
+
function portNumbers(from, to) {
|
|
1842
|
+
if (!Number.isInteger(from) || !Number.isInteger(to)) {
|
|
1843
|
+
throw new TypeError("`from` and `to` must be integer numbers");
|
|
1844
|
+
}
|
|
1845
|
+
if (from < minPort || from > maxPort) {
|
|
1846
|
+
throw new RangeError(`'from' must be between ${minPort} and ${maxPort}`);
|
|
1847
|
+
}
|
|
1848
|
+
if (to < minPort || to > maxPort) {
|
|
1849
|
+
throw new RangeError(`'to' must be between ${minPort} and ${maxPort}`);
|
|
1850
|
+
}
|
|
1851
|
+
if (from > to) {
|
|
1852
|
+
throw new RangeError("`to` must be greater than or equal to `from`");
|
|
1853
|
+
}
|
|
1854
|
+
const generator = function* (from2, to2) {
|
|
1855
|
+
for (let port = from2; port <= to2; port++) {
|
|
1856
|
+
yield port;
|
|
1857
|
+
}
|
|
1858
|
+
};
|
|
1859
|
+
return generator(from, to);
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
// src/pool/index.ts
|
|
1863
|
+
var import_satisfies = __toESM(require_satisfies(), 1);
|
|
15
1864
|
import {
|
|
16
1865
|
compileModuleRules,
|
|
17
1866
|
getNodeCompat,
|
|
@@ -27,19 +1876,20 @@ import {
|
|
|
27
1876
|
testRegExps,
|
|
28
1877
|
WebSocket
|
|
29
1878
|
} from "miniflare";
|
|
30
|
-
import semverSatisfies from "semver/functions/satisfies.js";
|
|
31
1879
|
import { createMethodsRPC } from "vitest/node";
|
|
32
1880
|
import { experimental_readRawConfig } from "wrangler";
|
|
33
1881
|
|
|
34
1882
|
// src/shared/builtin-modules.ts
|
|
1883
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
35
1884
|
var workerdBuiltinModules = /* @__PURE__ */ new Set([
|
|
36
1885
|
...define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES_default,
|
|
37
1886
|
"__STATIC_CONTENT_MANIFEST"
|
|
38
1887
|
]);
|
|
39
1888
|
|
|
40
1889
|
// src/shared/chunking-socket.ts
|
|
1890
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
41
1891
|
import assert from "node:assert";
|
|
42
|
-
import { Buffer } from "node:buffer";
|
|
1892
|
+
import { Buffer as Buffer2 } from "node:buffer";
|
|
43
1893
|
function createChunkingSocket(socket, maxChunkByteLength = 1048576) {
|
|
44
1894
|
const listeners = [];
|
|
45
1895
|
const decoder = new TextDecoder();
|
|
@@ -61,8 +1911,8 @@ function createChunkingSocket(socket, maxChunkByteLength = 1048576) {
|
|
|
61
1911
|
});
|
|
62
1912
|
return {
|
|
63
1913
|
post(value) {
|
|
64
|
-
if (
|
|
65
|
-
const encoded =
|
|
1914
|
+
if (Buffer2.byteLength(value) > maxChunkByteLength) {
|
|
1915
|
+
const encoded = Buffer2.from(value);
|
|
66
1916
|
for (let i = 0; i < encoded.byteLength; i += maxChunkByteLength) {
|
|
67
1917
|
socket.post(encoded.subarray(i, i + maxChunkByteLength));
|
|
68
1918
|
}
|
|
@@ -78,6 +1928,7 @@ function createChunkingSocket(socket, maxChunkByteLength = 1048576) {
|
|
|
78
1928
|
}
|
|
79
1929
|
|
|
80
1930
|
// src/pool/compatibility-flag-assertions.ts
|
|
1931
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
81
1932
|
var CompatibilityFlagAssertions = class {
|
|
82
1933
|
#compatibilityDate;
|
|
83
1934
|
#compatibilityFlags;
|
|
@@ -195,6 +2046,7 @@ function isDateSufficient(compatibilityDate, defaultOnDate) {
|
|
|
195
2046
|
}
|
|
196
2047
|
|
|
197
2048
|
// src/pool/config.ts
|
|
2049
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
198
2050
|
import path2 from "node:path";
|
|
199
2051
|
import {
|
|
200
2052
|
formatZodError,
|
|
@@ -208,6 +2060,7 @@ import {
|
|
|
208
2060
|
import { z } from "zod";
|
|
209
2061
|
|
|
210
2062
|
// src/pool/helpers.ts
|
|
2063
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
211
2064
|
import path from "node:path";
|
|
212
2065
|
var WORKER_NAME_PREFIX = "vitest-pool-workers-";
|
|
213
2066
|
function isFileNotFoundError(e) {
|
|
@@ -503,6 +2356,7 @@ ${formatted}`
|
|
|
503
2356
|
}
|
|
504
2357
|
|
|
505
2358
|
// src/pool/guess-exports.ts
|
|
2359
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
506
2360
|
import path3 from "node:path";
|
|
507
2361
|
import { build } from "esbuild";
|
|
508
2362
|
async function guessWorkerExports(entryFile, additionalExports = {}) {
|
|
@@ -544,6 +2398,7 @@ async function guessWorkerExports(entryFile, additionalExports = {}) {
|
|
|
544
2398
|
}
|
|
545
2399
|
|
|
546
2400
|
// src/pool/loopback.ts
|
|
2401
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
547
2402
|
import assert2 from "node:assert";
|
|
548
2403
|
import fs from "node:fs/promises";
|
|
549
2404
|
import path4 from "node:path";
|
|
@@ -883,6 +2738,7 @@ function handleLoopbackRequest(request, mf) {
|
|
|
883
2738
|
}
|
|
884
2739
|
|
|
885
2740
|
// src/pool/module-fallback.ts
|
|
2741
|
+
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
886
2742
|
import assert3 from "node:assert";
|
|
887
2743
|
import fs2 from "node:fs";
|
|
888
2744
|
import { createRequire } from "node:module";
|
|
@@ -1237,10 +3093,10 @@ function structuredSerializableStringify(value) {
|
|
|
1237
3093
|
if (value && typeof value === "object" && "r" in value && value.r && typeof value.r === "object" && "map" in value.r && value.r.map) {
|
|
1238
3094
|
delete value.r.map;
|
|
1239
3095
|
}
|
|
1240
|
-
return
|
|
3096
|
+
return stringify(value, structuredSerializableReducers);
|
|
1241
3097
|
}
|
|
1242
3098
|
function structuredSerializableParse(value) {
|
|
1243
|
-
return
|
|
3099
|
+
return parse(value, structuredSerializableRevivers);
|
|
1244
3100
|
}
|
|
1245
3101
|
var debuglog2 = util2.debuglog(
|
|
1246
3102
|
"vitest-pool-workers:index",
|
|
@@ -1599,7 +3455,7 @@ var SHARED_MINIFLARE_OPTIONS = {
|
|
|
1599
3455
|
};
|
|
1600
3456
|
var DEFAULT_INSPECTOR_PORT = 9229;
|
|
1601
3457
|
function getFirstAvailablePort(start) {
|
|
1602
|
-
return
|
|
3458
|
+
return getPorts({ port: portNumbers(start, 65535) });
|
|
1603
3459
|
}
|
|
1604
3460
|
var moduleFallbackServices = /* @__PURE__ */ new WeakMap();
|
|
1605
3461
|
function getModuleFallbackService(ctx) {
|
|
@@ -1868,7 +3724,7 @@ function assertCompatibleVitestVersion(ctx) {
|
|
|
1868
3724
|
actualVitestVersion !== void 0,
|
|
1869
3725
|
"Expected to find `vitest`'s version"
|
|
1870
3726
|
);
|
|
1871
|
-
if (!
|
|
3727
|
+
if (!(0, import_satisfies.default)(actualVitestVersion, expectedVitestVersion)) {
|
|
1872
3728
|
const message = [
|
|
1873
3729
|
`You're running \`vitest@${actualVitestVersion}\`, but this version of \`@cloudflare/vitest-pool-workers\` only officially supports \`vitest ${expectedVitestVersion}\`.`,
|
|
1874
3730
|
"`@cloudflare/vitest-pool-workers` currently depends on internal Vitest APIs that are not protected by semantic-versioning guarantees.",
|