@rstest/core 0.0.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/LICENSE +21 -0
- package/README.md +11 -0
- package/bin/rstest.js +20 -0
- package/dist/285.js +98 -0
- package/dist/353.js +488 -0
- package/dist/355.js +96 -0
- package/dist/629.js +80 -0
- package/dist/64.js +1735 -0
- package/dist/72.js +1309 -0
- package/dist/773.js +1709 -0
- package/dist/813.js +137 -0
- package/dist/973.js +482 -0
- package/dist/992.js +485 -0
- package/dist/cli.js +3685 -0
- package/dist/node.js +0 -0
- package/dist/public.js +4 -0
- package/dist/worker.js +5727 -0
- package/dist/worker.js.LICENSE.txt +28 -0
- package/dist-types/cli.d.ts +3 -0
- package/dist-types/node.d.ts +368 -0
- package/dist-types/public.d.ts +850 -0
- package/dist-types/worker.d.ts +646 -0
- package/globals.d.ts +13 -0
- package/importMeta.d.ts +3 -0
- package/package.json +85 -0
package/dist/cli.js
ADDED
|
@@ -0,0 +1,3685 @@
|
|
|
1
|
+
import external_process_default from "process";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ from "@rsbuild/core";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__vitest_snapshot_manager_ed2bcef6__ from "@vitest/snapshot/manager";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE_birpc__ from "birpc";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE_fs__ from "fs";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_events_0a6aefe7__ from "node:events";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
|
|
8
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__ from "node:fs/promises";
|
|
9
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__ from "node:os";
|
|
10
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
11
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";
|
|
12
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_util_1b29d436__ from "node:util";
|
|
13
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_v8_d0df5498__ from "node:v8";
|
|
14
|
+
import * as __WEBPACK_EXTERNAL_MODULE_os__ from "os";
|
|
15
|
+
import * as __WEBPACK_EXTERNAL_MODULE_path__ from "path";
|
|
16
|
+
import * as __WEBPACK_EXTERNAL_MODULE_pathe__ from "pathe";
|
|
17
|
+
import * as __WEBPACK_EXTERNAL_MODULE_std_env_1c7b8267__ from "std-env";
|
|
18
|
+
import * as __WEBPACK_EXTERNAL_MODULE_tinypool__ from "tinypool";
|
|
19
|
+
import * as __WEBPACK_EXTERNAL_MODULE_tty__ from "tty";
|
|
20
|
+
import { EventEmitter } from "events";
|
|
21
|
+
var __webpack_modules__ = {
|
|
22
|
+
"../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/async.js": function(__unused_webpack_module, exports, __webpack_require__) {
|
|
23
|
+
Object.defineProperty(exports, "__esModule", {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
exports.callback = exports.promise = void 0;
|
|
27
|
+
const walker_1 = __webpack_require__("../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/walker.js");
|
|
28
|
+
function promise(root, options) {
|
|
29
|
+
return new Promise((resolve, reject)=>{
|
|
30
|
+
callback(root, options, (err, output)=>{
|
|
31
|
+
if (err) return reject(err);
|
|
32
|
+
resolve(output);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
exports.promise = promise;
|
|
37
|
+
function callback(root, options, callback) {
|
|
38
|
+
let walker = new walker_1.Walker(root, options, callback);
|
|
39
|
+
walker.start();
|
|
40
|
+
}
|
|
41
|
+
exports.callback = callback;
|
|
42
|
+
},
|
|
43
|
+
"../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/counter.js": function(__unused_webpack_module, exports) {
|
|
44
|
+
Object.defineProperty(exports, "__esModule", {
|
|
45
|
+
value: true
|
|
46
|
+
});
|
|
47
|
+
exports.Counter = void 0;
|
|
48
|
+
class Counter {
|
|
49
|
+
_files = 0;
|
|
50
|
+
_directories = 0;
|
|
51
|
+
set files(num) {
|
|
52
|
+
this._files = num;
|
|
53
|
+
}
|
|
54
|
+
get files() {
|
|
55
|
+
return this._files;
|
|
56
|
+
}
|
|
57
|
+
set directories(num) {
|
|
58
|
+
this._directories = num;
|
|
59
|
+
}
|
|
60
|
+
get directories() {
|
|
61
|
+
return this._directories;
|
|
62
|
+
}
|
|
63
|
+
get dirs() {
|
|
64
|
+
return this._directories;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.Counter = Counter;
|
|
68
|
+
},
|
|
69
|
+
"../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/functions/get-array.js": function(__unused_webpack_module, exports) {
|
|
70
|
+
Object.defineProperty(exports, "__esModule", {
|
|
71
|
+
value: true
|
|
72
|
+
});
|
|
73
|
+
exports.build = void 0;
|
|
74
|
+
const getArray = (paths)=>paths;
|
|
75
|
+
const getArrayGroup = ()=>[
|
|
76
|
+
""
|
|
77
|
+
].slice(0, 0);
|
|
78
|
+
function build(options) {
|
|
79
|
+
return options.group ? getArrayGroup : getArray;
|
|
80
|
+
}
|
|
81
|
+
exports.build = build;
|
|
82
|
+
},
|
|
83
|
+
"../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/functions/group-files.js": function(__unused_webpack_module, exports) {
|
|
84
|
+
Object.defineProperty(exports, "__esModule", {
|
|
85
|
+
value: true
|
|
86
|
+
});
|
|
87
|
+
exports.build = void 0;
|
|
88
|
+
const groupFiles = (groups, directory, files)=>{
|
|
89
|
+
groups.push({
|
|
90
|
+
directory,
|
|
91
|
+
files,
|
|
92
|
+
dir: directory
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
const empty = ()=>{};
|
|
96
|
+
function build(options) {
|
|
97
|
+
return options.group ? groupFiles : empty;
|
|
98
|
+
}
|
|
99
|
+
exports.build = build;
|
|
100
|
+
},
|
|
101
|
+
"../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/functions/invoke-callback.js": function(__unused_webpack_module, exports) {
|
|
102
|
+
Object.defineProperty(exports, "__esModule", {
|
|
103
|
+
value: true
|
|
104
|
+
});
|
|
105
|
+
exports.build = void 0;
|
|
106
|
+
const onlyCountsSync = (state)=>state.counts;
|
|
107
|
+
const groupsSync = (state)=>state.groups;
|
|
108
|
+
const defaultSync = (state)=>state.paths;
|
|
109
|
+
const limitFilesSync = (state)=>state.paths.slice(0, state.options.maxFiles);
|
|
110
|
+
const onlyCountsAsync = (state, error, callback)=>{
|
|
111
|
+
report(error, callback, state.counts, state.options.suppressErrors);
|
|
112
|
+
return null;
|
|
113
|
+
};
|
|
114
|
+
const defaultAsync = (state, error, callback)=>{
|
|
115
|
+
report(error, callback, state.paths, state.options.suppressErrors);
|
|
116
|
+
return null;
|
|
117
|
+
};
|
|
118
|
+
const limitFilesAsync = (state, error, callback)=>{
|
|
119
|
+
report(error, callback, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors);
|
|
120
|
+
return null;
|
|
121
|
+
};
|
|
122
|
+
const groupsAsync = (state, error, callback)=>{
|
|
123
|
+
report(error, callback, state.groups, state.options.suppressErrors);
|
|
124
|
+
return null;
|
|
125
|
+
};
|
|
126
|
+
function report(error, callback, output, suppressErrors) {
|
|
127
|
+
callback(error && !suppressErrors ? error : null, output);
|
|
128
|
+
}
|
|
129
|
+
function build(options, isSynchronous) {
|
|
130
|
+
const { onlyCounts, group, maxFiles } = options;
|
|
131
|
+
if (onlyCounts) return isSynchronous ? onlyCountsSync : onlyCountsAsync;
|
|
132
|
+
if (group) return isSynchronous ? groupsSync : groupsAsync;
|
|
133
|
+
if (maxFiles) return isSynchronous ? limitFilesSync : limitFilesAsync;
|
|
134
|
+
return isSynchronous ? defaultSync : defaultAsync;
|
|
135
|
+
}
|
|
136
|
+
exports.build = build;
|
|
137
|
+
},
|
|
138
|
+
"../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/functions/join-path.js": function(__unused_webpack_module, exports, __webpack_require__) {
|
|
139
|
+
Object.defineProperty(exports, "__esModule", {
|
|
140
|
+
value: true
|
|
141
|
+
});
|
|
142
|
+
exports.build = exports.joinDirectoryPath = exports.joinPathWithBasePath = void 0;
|
|
143
|
+
const path_1 = __webpack_require__("path");
|
|
144
|
+
const utils_1 = __webpack_require__("../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/utils.js");
|
|
145
|
+
function joinPathWithBasePath(filename, directoryPath) {
|
|
146
|
+
return directoryPath + filename;
|
|
147
|
+
}
|
|
148
|
+
exports.joinPathWithBasePath = joinPathWithBasePath;
|
|
149
|
+
function joinPathWithRelativePath(root, options) {
|
|
150
|
+
return function(filename, directoryPath) {
|
|
151
|
+
const sameRoot = directoryPath.startsWith(root);
|
|
152
|
+
if (sameRoot) return directoryPath.replace(root, "") + filename;
|
|
153
|
+
return (0, utils_1.convertSlashes)((0, path_1.relative)(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function joinPath(filename) {
|
|
157
|
+
return filename;
|
|
158
|
+
}
|
|
159
|
+
function joinDirectoryPath(filename, directoryPath, separator) {
|
|
160
|
+
return directoryPath + filename + separator;
|
|
161
|
+
}
|
|
162
|
+
exports.joinDirectoryPath = joinDirectoryPath;
|
|
163
|
+
function build(root, options) {
|
|
164
|
+
const { relativePaths, includeBasePath } = options;
|
|
165
|
+
return relativePaths && root ? joinPathWithRelativePath(root, options) : includeBasePath ? joinPathWithBasePath : joinPath;
|
|
166
|
+
}
|
|
167
|
+
exports.build = build;
|
|
168
|
+
},
|
|
169
|
+
"../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/functions/push-directory.js": function(__unused_webpack_module, exports) {
|
|
170
|
+
Object.defineProperty(exports, "__esModule", {
|
|
171
|
+
value: true
|
|
172
|
+
});
|
|
173
|
+
exports.build = void 0;
|
|
174
|
+
function pushDirectoryWithRelativePath(root) {
|
|
175
|
+
return function(directoryPath, paths) {
|
|
176
|
+
paths.push(directoryPath.substring(root.length) || ".");
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
function pushDirectoryFilterWithRelativePath(root) {
|
|
180
|
+
return function(directoryPath, paths, filters) {
|
|
181
|
+
const relativePath = directoryPath.substring(root.length) || ".";
|
|
182
|
+
if (filters.every((filter)=>filter(relativePath, true))) paths.push(relativePath);
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
const pushDirectory = (directoryPath, paths)=>{
|
|
186
|
+
paths.push(directoryPath || ".");
|
|
187
|
+
};
|
|
188
|
+
const pushDirectoryFilter = (directoryPath, paths, filters)=>{
|
|
189
|
+
const path = directoryPath || ".";
|
|
190
|
+
if (filters.every((filter)=>filter(path, true))) paths.push(path);
|
|
191
|
+
};
|
|
192
|
+
const empty = ()=>{};
|
|
193
|
+
function build(root, options) {
|
|
194
|
+
const { includeDirs, filters, relativePaths } = options;
|
|
195
|
+
if (!includeDirs) return empty;
|
|
196
|
+
if (relativePaths) return filters && filters.length ? pushDirectoryFilterWithRelativePath(root) : pushDirectoryWithRelativePath(root);
|
|
197
|
+
return filters && filters.length ? pushDirectoryFilter : pushDirectory;
|
|
198
|
+
}
|
|
199
|
+
exports.build = build;
|
|
200
|
+
},
|
|
201
|
+
"../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/functions/push-file.js": function(__unused_webpack_module, exports) {
|
|
202
|
+
Object.defineProperty(exports, "__esModule", {
|
|
203
|
+
value: true
|
|
204
|
+
});
|
|
205
|
+
exports.build = void 0;
|
|
206
|
+
const pushFileFilterAndCount = (filename, _paths, counts, filters)=>{
|
|
207
|
+
if (filters.every((filter)=>filter(filename, false))) counts.files++;
|
|
208
|
+
};
|
|
209
|
+
const pushFileFilter = (filename, paths, _counts, filters)=>{
|
|
210
|
+
if (filters.every((filter)=>filter(filename, false))) paths.push(filename);
|
|
211
|
+
};
|
|
212
|
+
const pushFileCount = (_filename, _paths, counts, _filters)=>{
|
|
213
|
+
counts.files++;
|
|
214
|
+
};
|
|
215
|
+
const pushFile = (filename, paths)=>{
|
|
216
|
+
paths.push(filename);
|
|
217
|
+
};
|
|
218
|
+
const empty = ()=>{};
|
|
219
|
+
function build(options) {
|
|
220
|
+
const { excludeFiles, filters, onlyCounts } = options;
|
|
221
|
+
if (excludeFiles) return empty;
|
|
222
|
+
if (filters && filters.length) return onlyCounts ? pushFileFilterAndCount : pushFileFilter;
|
|
223
|
+
if (onlyCounts) return pushFileCount;
|
|
224
|
+
return pushFile;
|
|
225
|
+
}
|
|
226
|
+
exports.build = build;
|
|
227
|
+
},
|
|
228
|
+
"../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/functions/resolve-symlink.js": function(__unused_webpack_module, exports, __webpack_require__) {
|
|
229
|
+
var __importDefault = this && this.__importDefault || function(mod) {
|
|
230
|
+
return mod && mod.__esModule ? mod : {
|
|
231
|
+
default: mod
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
Object.defineProperty(exports, "__esModule", {
|
|
235
|
+
value: true
|
|
236
|
+
});
|
|
237
|
+
exports.build = void 0;
|
|
238
|
+
const fs_1 = __importDefault(__webpack_require__("fs"));
|
|
239
|
+
const path_1 = __webpack_require__("path");
|
|
240
|
+
const resolveSymlinksAsync = function(path, state, callback) {
|
|
241
|
+
const { queue, options: { suppressErrors } } = state;
|
|
242
|
+
queue.enqueue();
|
|
243
|
+
fs_1.default.realpath(path, (error, resolvedPath)=>{
|
|
244
|
+
if (error) return queue.dequeue(suppressErrors ? null : error, state);
|
|
245
|
+
fs_1.default.stat(resolvedPath, (error, stat)=>{
|
|
246
|
+
if (error) return queue.dequeue(suppressErrors ? null : error, state);
|
|
247
|
+
if (stat.isDirectory() && isRecursive(path, resolvedPath, state)) return queue.dequeue(null, state);
|
|
248
|
+
callback(stat, resolvedPath);
|
|
249
|
+
queue.dequeue(null, state);
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
};
|
|
253
|
+
const resolveSymlinks = function(path, state, callback) {
|
|
254
|
+
const { queue, options: { suppressErrors } } = state;
|
|
255
|
+
queue.enqueue();
|
|
256
|
+
try {
|
|
257
|
+
const resolvedPath = fs_1.default.realpathSync(path);
|
|
258
|
+
const stat = fs_1.default.statSync(resolvedPath);
|
|
259
|
+
if (stat.isDirectory() && isRecursive(path, resolvedPath, state)) return;
|
|
260
|
+
callback(stat, resolvedPath);
|
|
261
|
+
} catch (e) {
|
|
262
|
+
if (!suppressErrors) throw e;
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
function build(options, isSynchronous) {
|
|
266
|
+
if (!options.resolveSymlinks || options.excludeSymlinks) return null;
|
|
267
|
+
return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
|
|
268
|
+
}
|
|
269
|
+
exports.build = build;
|
|
270
|
+
function isRecursive(path, resolved, state) {
|
|
271
|
+
if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
|
|
272
|
+
let parent = (0, path_1.dirname)(path);
|
|
273
|
+
let depth = 1;
|
|
274
|
+
while(parent !== state.root && depth < 2){
|
|
275
|
+
const resolvedPath = state.symlinks.get(parent);
|
|
276
|
+
const isSameRoot = !!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath));
|
|
277
|
+
if (isSameRoot) depth++;
|
|
278
|
+
else parent = (0, path_1.dirname)(parent);
|
|
279
|
+
}
|
|
280
|
+
state.symlinks.set(path, resolved);
|
|
281
|
+
return depth > 1;
|
|
282
|
+
}
|
|
283
|
+
function isRecursiveUsingRealPaths(resolved, state) {
|
|
284
|
+
return state.visited.includes(resolved + state.options.pathSeparator);
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
"../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/functions/walk-directory.js": function(__unused_webpack_module, exports, __webpack_require__) {
|
|
288
|
+
var __importDefault = this && this.__importDefault || function(mod) {
|
|
289
|
+
return mod && mod.__esModule ? mod : {
|
|
290
|
+
default: mod
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
Object.defineProperty(exports, "__esModule", {
|
|
294
|
+
value: true
|
|
295
|
+
});
|
|
296
|
+
exports.build = void 0;
|
|
297
|
+
const fs_1 = __importDefault(__webpack_require__("fs"));
|
|
298
|
+
const readdirOpts = {
|
|
299
|
+
withFileTypes: true
|
|
300
|
+
};
|
|
301
|
+
const walkAsync = (state, crawlPath, directoryPath, currentDepth, callback)=>{
|
|
302
|
+
if (currentDepth < 0) return state.queue.dequeue(null, state);
|
|
303
|
+
state.visited.push(crawlPath);
|
|
304
|
+
state.counts.directories++;
|
|
305
|
+
state.queue.enqueue();
|
|
306
|
+
fs_1.default.readdir(crawlPath || ".", readdirOpts, (error, entries = [])=>{
|
|
307
|
+
callback(entries, directoryPath, currentDepth);
|
|
308
|
+
state.queue.dequeue(state.options.suppressErrors ? null : error, state);
|
|
309
|
+
});
|
|
310
|
+
};
|
|
311
|
+
const walkSync = (state, crawlPath, directoryPath, currentDepth, callback)=>{
|
|
312
|
+
if (currentDepth < 0) return;
|
|
313
|
+
state.visited.push(crawlPath);
|
|
314
|
+
state.counts.directories++;
|
|
315
|
+
let entries = [];
|
|
316
|
+
try {
|
|
317
|
+
entries = fs_1.default.readdirSync(crawlPath || ".", readdirOpts);
|
|
318
|
+
} catch (e) {
|
|
319
|
+
if (!state.options.suppressErrors) throw e;
|
|
320
|
+
}
|
|
321
|
+
callback(entries, directoryPath, currentDepth);
|
|
322
|
+
};
|
|
323
|
+
function build(isSynchronous) {
|
|
324
|
+
return isSynchronous ? walkSync : walkAsync;
|
|
325
|
+
}
|
|
326
|
+
exports.build = build;
|
|
327
|
+
},
|
|
328
|
+
"../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/queue.js": function(__unused_webpack_module, exports) {
|
|
329
|
+
Object.defineProperty(exports, "__esModule", {
|
|
330
|
+
value: true
|
|
331
|
+
});
|
|
332
|
+
exports.Queue = void 0;
|
|
333
|
+
class Queue {
|
|
334
|
+
onQueueEmpty;
|
|
335
|
+
count = 0;
|
|
336
|
+
constructor(onQueueEmpty){
|
|
337
|
+
this.onQueueEmpty = onQueueEmpty;
|
|
338
|
+
}
|
|
339
|
+
enqueue() {
|
|
340
|
+
this.count++;
|
|
341
|
+
}
|
|
342
|
+
dequeue(error, output) {
|
|
343
|
+
if (--this.count <= 0 || error) this.onQueueEmpty(error, output);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
exports.Queue = Queue;
|
|
347
|
+
},
|
|
348
|
+
"../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/sync.js": function(__unused_webpack_module, exports, __webpack_require__) {
|
|
349
|
+
Object.defineProperty(exports, "__esModule", {
|
|
350
|
+
value: true
|
|
351
|
+
});
|
|
352
|
+
exports.sync = void 0;
|
|
353
|
+
const walker_1 = __webpack_require__("../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/walker.js");
|
|
354
|
+
function sync(root, options) {
|
|
355
|
+
const walker = new walker_1.Walker(root, options);
|
|
356
|
+
return walker.start();
|
|
357
|
+
}
|
|
358
|
+
exports.sync = sync;
|
|
359
|
+
},
|
|
360
|
+
"../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/walker.js": function(__unused_webpack_module, exports, __webpack_require__) {
|
|
361
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
362
|
+
if (void 0 === k2) k2 = k;
|
|
363
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
364
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
365
|
+
enumerable: true,
|
|
366
|
+
get: function() {
|
|
367
|
+
return m[k];
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
Object.defineProperty(o, k2, desc);
|
|
371
|
+
} : function(o, m, k, k2) {
|
|
372
|
+
if (void 0 === k2) k2 = k;
|
|
373
|
+
o[k2] = m[k];
|
|
374
|
+
});
|
|
375
|
+
var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function(o, v) {
|
|
376
|
+
Object.defineProperty(o, "default", {
|
|
377
|
+
enumerable: true,
|
|
378
|
+
value: v
|
|
379
|
+
});
|
|
380
|
+
} : function(o, v) {
|
|
381
|
+
o["default"] = v;
|
|
382
|
+
});
|
|
383
|
+
var __importStar = this && this.__importStar || function(mod) {
|
|
384
|
+
if (mod && mod.__esModule) return mod;
|
|
385
|
+
var result = {};
|
|
386
|
+
if (null != mod) {
|
|
387
|
+
for(var k in mod)if ("default" !== k && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
388
|
+
}
|
|
389
|
+
__setModuleDefault(result, mod);
|
|
390
|
+
return result;
|
|
391
|
+
};
|
|
392
|
+
Object.defineProperty(exports, "__esModule", {
|
|
393
|
+
value: true
|
|
394
|
+
});
|
|
395
|
+
exports.Walker = void 0;
|
|
396
|
+
const path_1 = __webpack_require__("path");
|
|
397
|
+
const utils_1 = __webpack_require__("../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/utils.js");
|
|
398
|
+
const joinPath = __importStar(__webpack_require__("../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/functions/join-path.js"));
|
|
399
|
+
const pushDirectory = __importStar(__webpack_require__("../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/functions/push-directory.js"));
|
|
400
|
+
const pushFile = __importStar(__webpack_require__("../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/functions/push-file.js"));
|
|
401
|
+
const getArray = __importStar(__webpack_require__("../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/functions/get-array.js"));
|
|
402
|
+
const groupFiles = __importStar(__webpack_require__("../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/functions/group-files.js"));
|
|
403
|
+
const resolveSymlink = __importStar(__webpack_require__("../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/functions/resolve-symlink.js"));
|
|
404
|
+
const invokeCallback = __importStar(__webpack_require__("../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/functions/invoke-callback.js"));
|
|
405
|
+
const walkDirectory = __importStar(__webpack_require__("../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/functions/walk-directory.js"));
|
|
406
|
+
const queue_1 = __webpack_require__("../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/queue.js");
|
|
407
|
+
const counter_1 = __webpack_require__("../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/counter.js");
|
|
408
|
+
class Walker {
|
|
409
|
+
root;
|
|
410
|
+
isSynchronous;
|
|
411
|
+
state;
|
|
412
|
+
joinPath;
|
|
413
|
+
pushDirectory;
|
|
414
|
+
pushFile;
|
|
415
|
+
getArray;
|
|
416
|
+
groupFiles;
|
|
417
|
+
resolveSymlink;
|
|
418
|
+
walkDirectory;
|
|
419
|
+
callbackInvoker;
|
|
420
|
+
constructor(root, options, callback){
|
|
421
|
+
this.isSynchronous = !callback;
|
|
422
|
+
this.callbackInvoker = invokeCallback.build(options, this.isSynchronous);
|
|
423
|
+
this.root = (0, utils_1.normalizePath)(root, options);
|
|
424
|
+
this.state = {
|
|
425
|
+
root: (0, utils_1.isRootDirectory)(this.root) ? this.root : this.root.slice(0, -1),
|
|
426
|
+
paths: [
|
|
427
|
+
""
|
|
428
|
+
].slice(0, 0),
|
|
429
|
+
groups: [],
|
|
430
|
+
counts: new counter_1.Counter(),
|
|
431
|
+
options,
|
|
432
|
+
queue: new queue_1.Queue((error, state)=>this.callbackInvoker(state, error, callback)),
|
|
433
|
+
symlinks: new Map(),
|
|
434
|
+
visited: [
|
|
435
|
+
""
|
|
436
|
+
].slice(0, 0)
|
|
437
|
+
};
|
|
438
|
+
this.joinPath = joinPath.build(this.root, options);
|
|
439
|
+
this.pushDirectory = pushDirectory.build(this.root, options);
|
|
440
|
+
this.pushFile = pushFile.build(options);
|
|
441
|
+
this.getArray = getArray.build(options);
|
|
442
|
+
this.groupFiles = groupFiles.build(options);
|
|
443
|
+
this.resolveSymlink = resolveSymlink.build(options, this.isSynchronous);
|
|
444
|
+
this.walkDirectory = walkDirectory.build(this.isSynchronous);
|
|
445
|
+
}
|
|
446
|
+
start() {
|
|
447
|
+
this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk);
|
|
448
|
+
return this.isSynchronous ? this.callbackInvoker(this.state, null) : null;
|
|
449
|
+
}
|
|
450
|
+
walk = (entries, directoryPath, depth)=>{
|
|
451
|
+
const { paths, options: { filters, resolveSymlinks, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator } } = this.state;
|
|
452
|
+
if (signal && signal.aborted || maxFiles && paths.length > maxFiles) return;
|
|
453
|
+
this.pushDirectory(directoryPath, paths, filters);
|
|
454
|
+
const files = this.getArray(this.state.paths);
|
|
455
|
+
for(let i = 0; i < entries.length; ++i){
|
|
456
|
+
const entry = entries[i];
|
|
457
|
+
if (entry.isFile() || entry.isSymbolicLink() && !resolveSymlinks && !excludeSymlinks) {
|
|
458
|
+
const filename = this.joinPath(entry.name, directoryPath);
|
|
459
|
+
this.pushFile(filename, files, this.state.counts, filters);
|
|
460
|
+
} else if (entry.isDirectory()) {
|
|
461
|
+
let path = joinPath.joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
|
|
462
|
+
if (exclude && exclude(entry.name, path)) continue;
|
|
463
|
+
this.walkDirectory(this.state, path, path, depth - 1, this.walk);
|
|
464
|
+
} else if (entry.isSymbolicLink() && this.resolveSymlink) {
|
|
465
|
+
let path = joinPath.joinPathWithBasePath(entry.name, directoryPath);
|
|
466
|
+
this.resolveSymlink(path, this.state, (stat, resolvedPath)=>{
|
|
467
|
+
if (stat.isDirectory()) {
|
|
468
|
+
resolvedPath = (0, utils_1.normalizePath)(resolvedPath, this.state.options);
|
|
469
|
+
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path + pathSeparator)) return;
|
|
470
|
+
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path + pathSeparator, depth - 1, this.walk);
|
|
471
|
+
} else {
|
|
472
|
+
resolvedPath = useRealPaths ? resolvedPath : path;
|
|
473
|
+
const filename = (0, path_1.basename)(resolvedPath);
|
|
474
|
+
const directoryPath = (0, utils_1.normalizePath)((0, path_1.dirname)(resolvedPath), this.state.options);
|
|
475
|
+
resolvedPath = this.joinPath(filename, directoryPath);
|
|
476
|
+
this.pushFile(resolvedPath, files, this.state.counts, filters);
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
this.groupFiles(this.state.groups, directoryPath, files);
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
exports.Walker = Walker;
|
|
485
|
+
},
|
|
486
|
+
"../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/builder/api-builder.js": function(__unused_webpack_module, exports, __webpack_require__) {
|
|
487
|
+
Object.defineProperty(exports, "__esModule", {
|
|
488
|
+
value: true
|
|
489
|
+
});
|
|
490
|
+
exports.APIBuilder = void 0;
|
|
491
|
+
const async_1 = __webpack_require__("../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/async.js");
|
|
492
|
+
const sync_1 = __webpack_require__("../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/sync.js");
|
|
493
|
+
class APIBuilder {
|
|
494
|
+
root;
|
|
495
|
+
options;
|
|
496
|
+
constructor(root, options){
|
|
497
|
+
this.root = root;
|
|
498
|
+
this.options = options;
|
|
499
|
+
}
|
|
500
|
+
withPromise() {
|
|
501
|
+
return (0, async_1.promise)(this.root, this.options);
|
|
502
|
+
}
|
|
503
|
+
withCallback(cb) {
|
|
504
|
+
(0, async_1.callback)(this.root, this.options, cb);
|
|
505
|
+
}
|
|
506
|
+
sync() {
|
|
507
|
+
return (0, sync_1.sync)(this.root, this.options);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
exports.APIBuilder = APIBuilder;
|
|
511
|
+
},
|
|
512
|
+
"../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/builder/index.js": function(__unused_webpack_module, exports, __webpack_require__) {
|
|
513
|
+
Object.defineProperty(exports, "__esModule", {
|
|
514
|
+
value: true
|
|
515
|
+
});
|
|
516
|
+
exports.Builder = void 0;
|
|
517
|
+
const path_1 = __webpack_require__("path");
|
|
518
|
+
const api_builder_1 = __webpack_require__("../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/builder/api-builder.js");
|
|
519
|
+
var pm = null;
|
|
520
|
+
try {
|
|
521
|
+
require.resolve("picomatch");
|
|
522
|
+
pm = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/index.js");
|
|
523
|
+
} catch (_e) {}
|
|
524
|
+
class Builder {
|
|
525
|
+
globCache = {};
|
|
526
|
+
options = {
|
|
527
|
+
maxDepth: 1 / 0,
|
|
528
|
+
suppressErrors: true,
|
|
529
|
+
pathSeparator: path_1.sep,
|
|
530
|
+
filters: []
|
|
531
|
+
};
|
|
532
|
+
globFunction;
|
|
533
|
+
constructor(options){
|
|
534
|
+
this.options = {
|
|
535
|
+
...this.options,
|
|
536
|
+
...options
|
|
537
|
+
};
|
|
538
|
+
this.globFunction = this.options.globFunction;
|
|
539
|
+
}
|
|
540
|
+
group() {
|
|
541
|
+
this.options.group = true;
|
|
542
|
+
return this;
|
|
543
|
+
}
|
|
544
|
+
withPathSeparator(separator) {
|
|
545
|
+
this.options.pathSeparator = separator;
|
|
546
|
+
return this;
|
|
547
|
+
}
|
|
548
|
+
withBasePath() {
|
|
549
|
+
this.options.includeBasePath = true;
|
|
550
|
+
return this;
|
|
551
|
+
}
|
|
552
|
+
withRelativePaths() {
|
|
553
|
+
this.options.relativePaths = true;
|
|
554
|
+
return this;
|
|
555
|
+
}
|
|
556
|
+
withDirs() {
|
|
557
|
+
this.options.includeDirs = true;
|
|
558
|
+
return this;
|
|
559
|
+
}
|
|
560
|
+
withMaxDepth(depth) {
|
|
561
|
+
this.options.maxDepth = depth;
|
|
562
|
+
return this;
|
|
563
|
+
}
|
|
564
|
+
withMaxFiles(limit) {
|
|
565
|
+
this.options.maxFiles = limit;
|
|
566
|
+
return this;
|
|
567
|
+
}
|
|
568
|
+
withFullPaths() {
|
|
569
|
+
this.options.resolvePaths = true;
|
|
570
|
+
this.options.includeBasePath = true;
|
|
571
|
+
return this;
|
|
572
|
+
}
|
|
573
|
+
withErrors() {
|
|
574
|
+
this.options.suppressErrors = false;
|
|
575
|
+
return this;
|
|
576
|
+
}
|
|
577
|
+
withSymlinks({ resolvePaths = true } = {}) {
|
|
578
|
+
this.options.resolveSymlinks = true;
|
|
579
|
+
this.options.useRealPaths = resolvePaths;
|
|
580
|
+
return this.withFullPaths();
|
|
581
|
+
}
|
|
582
|
+
withAbortSignal(signal) {
|
|
583
|
+
this.options.signal = signal;
|
|
584
|
+
return this;
|
|
585
|
+
}
|
|
586
|
+
normalize() {
|
|
587
|
+
this.options.normalizePath = true;
|
|
588
|
+
return this;
|
|
589
|
+
}
|
|
590
|
+
filter(predicate) {
|
|
591
|
+
this.options.filters.push(predicate);
|
|
592
|
+
return this;
|
|
593
|
+
}
|
|
594
|
+
onlyDirs() {
|
|
595
|
+
this.options.excludeFiles = true;
|
|
596
|
+
this.options.includeDirs = true;
|
|
597
|
+
return this;
|
|
598
|
+
}
|
|
599
|
+
exclude(predicate) {
|
|
600
|
+
this.options.exclude = predicate;
|
|
601
|
+
return this;
|
|
602
|
+
}
|
|
603
|
+
onlyCounts() {
|
|
604
|
+
this.options.onlyCounts = true;
|
|
605
|
+
return this;
|
|
606
|
+
}
|
|
607
|
+
crawl(root) {
|
|
608
|
+
return new api_builder_1.APIBuilder(root || ".", this.options);
|
|
609
|
+
}
|
|
610
|
+
withGlobFunction(fn) {
|
|
611
|
+
this.globFunction = fn;
|
|
612
|
+
return this;
|
|
613
|
+
}
|
|
614
|
+
crawlWithOptions(root, options) {
|
|
615
|
+
this.options = {
|
|
616
|
+
...this.options,
|
|
617
|
+
...options
|
|
618
|
+
};
|
|
619
|
+
return new api_builder_1.APIBuilder(root || ".", this.options);
|
|
620
|
+
}
|
|
621
|
+
glob(...patterns) {
|
|
622
|
+
if (this.globFunction) return this.globWithOptions(patterns);
|
|
623
|
+
return this.globWithOptions(patterns, {
|
|
624
|
+
dot: true
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
globWithOptions(patterns, ...options) {
|
|
628
|
+
const globFn = this.globFunction || pm;
|
|
629
|
+
if (!globFn) throw new Error("Please specify a glob function to use glob matching.");
|
|
630
|
+
var isMatch = this.globCache[patterns.join("\0")];
|
|
631
|
+
if (!isMatch) {
|
|
632
|
+
isMatch = globFn(patterns, ...options);
|
|
633
|
+
this.globCache[patterns.join("\0")] = isMatch;
|
|
634
|
+
}
|
|
635
|
+
this.options.filters.push((path)=>isMatch(path));
|
|
636
|
+
return this;
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
exports.Builder = Builder;
|
|
640
|
+
},
|
|
641
|
+
"../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/index.js": function(__unused_webpack_module, exports, __webpack_require__) {
|
|
642
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
643
|
+
if (void 0 === k2) k2 = k;
|
|
644
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
645
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
646
|
+
enumerable: true,
|
|
647
|
+
get: function() {
|
|
648
|
+
return m[k];
|
|
649
|
+
}
|
|
650
|
+
};
|
|
651
|
+
Object.defineProperty(o, k2, desc);
|
|
652
|
+
} : function(o, m, k, k2) {
|
|
653
|
+
if (void 0 === k2) k2 = k;
|
|
654
|
+
o[k2] = m[k];
|
|
655
|
+
});
|
|
656
|
+
var __exportStar = this && this.__exportStar || function(m, exports) {
|
|
657
|
+
for(var p in m)if ("default" !== p && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
658
|
+
};
|
|
659
|
+
Object.defineProperty(exports, "__esModule", {
|
|
660
|
+
value: true
|
|
661
|
+
});
|
|
662
|
+
exports.fdir = void 0;
|
|
663
|
+
const builder_1 = __webpack_require__("../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/builder/index.js");
|
|
664
|
+
Object.defineProperty(exports, "fdir", {
|
|
665
|
+
enumerable: true,
|
|
666
|
+
get: function() {
|
|
667
|
+
return builder_1.Builder;
|
|
668
|
+
}
|
|
669
|
+
});
|
|
670
|
+
__exportStar(__webpack_require__("../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/types.js"), exports);
|
|
671
|
+
},
|
|
672
|
+
"../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/types.js": function(__unused_webpack_module, exports) {
|
|
673
|
+
Object.defineProperty(exports, "__esModule", {
|
|
674
|
+
value: true
|
|
675
|
+
});
|
|
676
|
+
},
|
|
677
|
+
"../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/utils.js": function(__unused_webpack_module, exports, __webpack_require__) {
|
|
678
|
+
Object.defineProperty(exports, "__esModule", {
|
|
679
|
+
value: true
|
|
680
|
+
});
|
|
681
|
+
exports.normalizePath = exports.isRootDirectory = exports.convertSlashes = exports.cleanPath = void 0;
|
|
682
|
+
const path_1 = __webpack_require__("path");
|
|
683
|
+
function cleanPath(path) {
|
|
684
|
+
let normalized = (0, path_1.normalize)(path);
|
|
685
|
+
if (normalized.length > 1 && normalized[normalized.length - 1] === path_1.sep) normalized = normalized.substring(0, normalized.length - 1);
|
|
686
|
+
return normalized;
|
|
687
|
+
}
|
|
688
|
+
exports.cleanPath = cleanPath;
|
|
689
|
+
const SLASHES_REGEX = /[\\/]/g;
|
|
690
|
+
function convertSlashes(path, separator) {
|
|
691
|
+
return path.replace(SLASHES_REGEX, separator);
|
|
692
|
+
}
|
|
693
|
+
exports.convertSlashes = convertSlashes;
|
|
694
|
+
function isRootDirectory(path) {
|
|
695
|
+
return "/" === path || /^[a-z]:\\$/i.test(path);
|
|
696
|
+
}
|
|
697
|
+
exports.isRootDirectory = isRootDirectory;
|
|
698
|
+
function normalizePath(path, options) {
|
|
699
|
+
const { resolvePaths, normalizePath, pathSeparator } = options;
|
|
700
|
+
const pathNeedsCleaning = "win32" === process.platform && path.includes("/") || path.startsWith(".");
|
|
701
|
+
if (resolvePaths) path = (0, path_1.resolve)(path);
|
|
702
|
+
if (normalizePath || pathNeedsCleaning) path = cleanPath(path);
|
|
703
|
+
if ("." === path) return "";
|
|
704
|
+
const needsSeperator = path[path.length - 1] !== pathSeparator;
|
|
705
|
+
return convertSlashes(needsSeperator ? path + pathSeparator : path, pathSeparator);
|
|
706
|
+
}
|
|
707
|
+
exports.normalizePath = normalizePath;
|
|
708
|
+
},
|
|
709
|
+
"../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js": function(module) {
|
|
710
|
+
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
711
|
+
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || "win32" === p.platform || (p.stdout || {}).isTTY && "dumb" !== env.TERM || !!env.CI);
|
|
712
|
+
let formatter = (open, close, replace = open)=>(input)=>{
|
|
713
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
714
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
715
|
+
};
|
|
716
|
+
let replaceClose = (string, close, replace, index)=>{
|
|
717
|
+
let result = "", cursor = 0;
|
|
718
|
+
do {
|
|
719
|
+
result += string.substring(cursor, index) + replace;
|
|
720
|
+
cursor = index + close.length;
|
|
721
|
+
index = string.indexOf(close, cursor);
|
|
722
|
+
}while (~index);
|
|
723
|
+
return result + string.substring(cursor);
|
|
724
|
+
};
|
|
725
|
+
let createColors = (enabled = isColorSupported)=>{
|
|
726
|
+
let f = enabled ? formatter : ()=>String;
|
|
727
|
+
return {
|
|
728
|
+
isColorSupported: enabled,
|
|
729
|
+
reset: f("\x1b[0m", "\x1b[0m"),
|
|
730
|
+
bold: f("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
|
|
731
|
+
dim: f("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
|
|
732
|
+
italic: f("\x1b[3m", "\x1b[23m"),
|
|
733
|
+
underline: f("\x1b[4m", "\x1b[24m"),
|
|
734
|
+
inverse: f("\x1b[7m", "\x1b[27m"),
|
|
735
|
+
hidden: f("\x1b[8m", "\x1b[28m"),
|
|
736
|
+
strikethrough: f("\x1b[9m", "\x1b[29m"),
|
|
737
|
+
black: f("\x1b[30m", "\x1b[39m"),
|
|
738
|
+
red: f("\x1b[31m", "\x1b[39m"),
|
|
739
|
+
green: f("\x1b[32m", "\x1b[39m"),
|
|
740
|
+
yellow: f("\x1b[33m", "\x1b[39m"),
|
|
741
|
+
blue: f("\x1b[34m", "\x1b[39m"),
|
|
742
|
+
magenta: f("\x1b[35m", "\x1b[39m"),
|
|
743
|
+
cyan: f("\x1b[36m", "\x1b[39m"),
|
|
744
|
+
white: f("\x1b[37m", "\x1b[39m"),
|
|
745
|
+
gray: f("\x1b[90m", "\x1b[39m"),
|
|
746
|
+
bgBlack: f("\x1b[40m", "\x1b[49m"),
|
|
747
|
+
bgRed: f("\x1b[41m", "\x1b[49m"),
|
|
748
|
+
bgGreen: f("\x1b[42m", "\x1b[49m"),
|
|
749
|
+
bgYellow: f("\x1b[43m", "\x1b[49m"),
|
|
750
|
+
bgBlue: f("\x1b[44m", "\x1b[49m"),
|
|
751
|
+
bgMagenta: f("\x1b[45m", "\x1b[49m"),
|
|
752
|
+
bgCyan: f("\x1b[46m", "\x1b[49m"),
|
|
753
|
+
bgWhite: f("\x1b[47m", "\x1b[49m"),
|
|
754
|
+
blackBright: f("\x1b[90m", "\x1b[39m"),
|
|
755
|
+
redBright: f("\x1b[91m", "\x1b[39m"),
|
|
756
|
+
greenBright: f("\x1b[92m", "\x1b[39m"),
|
|
757
|
+
yellowBright: f("\x1b[93m", "\x1b[39m"),
|
|
758
|
+
blueBright: f("\x1b[94m", "\x1b[39m"),
|
|
759
|
+
magentaBright: f("\x1b[95m", "\x1b[39m"),
|
|
760
|
+
cyanBright: f("\x1b[96m", "\x1b[39m"),
|
|
761
|
+
whiteBright: f("\x1b[97m", "\x1b[39m"),
|
|
762
|
+
bgBlackBright: f("\x1b[100m", "\x1b[49m"),
|
|
763
|
+
bgRedBright: f("\x1b[101m", "\x1b[49m"),
|
|
764
|
+
bgGreenBright: f("\x1b[102m", "\x1b[49m"),
|
|
765
|
+
bgYellowBright: f("\x1b[103m", "\x1b[49m"),
|
|
766
|
+
bgBlueBright: f("\x1b[104m", "\x1b[49m"),
|
|
767
|
+
bgMagentaBright: f("\x1b[105m", "\x1b[49m"),
|
|
768
|
+
bgCyanBright: f("\x1b[106m", "\x1b[49m"),
|
|
769
|
+
bgWhiteBright: f("\x1b[107m", "\x1b[49m")
|
|
770
|
+
};
|
|
771
|
+
};
|
|
772
|
+
module.exports = createColors();
|
|
773
|
+
module.exports.createColors = createColors;
|
|
774
|
+
},
|
|
775
|
+
"../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
776
|
+
const pico = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/picomatch.js");
|
|
777
|
+
const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/utils.js");
|
|
778
|
+
function picomatch(glob, options, returnState = false) {
|
|
779
|
+
if (options && (null === options.windows || void 0 === options.windows)) options = {
|
|
780
|
+
...options,
|
|
781
|
+
windows: utils.isWindows()
|
|
782
|
+
};
|
|
783
|
+
return pico(glob, options, returnState);
|
|
784
|
+
}
|
|
785
|
+
Object.assign(picomatch, pico);
|
|
786
|
+
module.exports = picomatch;
|
|
787
|
+
},
|
|
788
|
+
"../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/constants.js": function(module) {
|
|
789
|
+
const WIN_SLASH = '\\\\/';
|
|
790
|
+
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
791
|
+
const DOT_LITERAL = '\\.';
|
|
792
|
+
const PLUS_LITERAL = '\\+';
|
|
793
|
+
const QMARK_LITERAL = '\\?';
|
|
794
|
+
const SLASH_LITERAL = '\\/';
|
|
795
|
+
const ONE_CHAR = '(?=.)';
|
|
796
|
+
const QMARK = '[^/]';
|
|
797
|
+
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
|
798
|
+
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
|
799
|
+
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
|
800
|
+
const NO_DOT = `(?!${DOT_LITERAL})`;
|
|
801
|
+
const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
|
802
|
+
const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
|
803
|
+
const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
|
804
|
+
const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
|
805
|
+
const STAR = `${QMARK}*?`;
|
|
806
|
+
const SEP = '/';
|
|
807
|
+
const POSIX_CHARS = {
|
|
808
|
+
DOT_LITERAL,
|
|
809
|
+
PLUS_LITERAL,
|
|
810
|
+
QMARK_LITERAL,
|
|
811
|
+
SLASH_LITERAL,
|
|
812
|
+
ONE_CHAR,
|
|
813
|
+
QMARK,
|
|
814
|
+
END_ANCHOR,
|
|
815
|
+
DOTS_SLASH,
|
|
816
|
+
NO_DOT,
|
|
817
|
+
NO_DOTS,
|
|
818
|
+
NO_DOT_SLASH,
|
|
819
|
+
NO_DOTS_SLASH,
|
|
820
|
+
QMARK_NO_DOT,
|
|
821
|
+
STAR,
|
|
822
|
+
START_ANCHOR,
|
|
823
|
+
SEP
|
|
824
|
+
};
|
|
825
|
+
const WINDOWS_CHARS = {
|
|
826
|
+
...POSIX_CHARS,
|
|
827
|
+
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
|
828
|
+
QMARK: WIN_NO_SLASH,
|
|
829
|
+
STAR: `${WIN_NO_SLASH}*?`,
|
|
830
|
+
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
|
831
|
+
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
832
|
+
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
833
|
+
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
|
834
|
+
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
835
|
+
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
|
836
|
+
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
|
837
|
+
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
|
|
838
|
+
SEP: '\\'
|
|
839
|
+
};
|
|
840
|
+
const POSIX_REGEX_SOURCE = {
|
|
841
|
+
alnum: 'a-zA-Z0-9',
|
|
842
|
+
alpha: 'a-zA-Z',
|
|
843
|
+
ascii: '\\x00-\\x7F',
|
|
844
|
+
blank: ' \\t',
|
|
845
|
+
cntrl: '\\x00-\\x1F\\x7F',
|
|
846
|
+
digit: '0-9',
|
|
847
|
+
graph: '\\x21-\\x7E',
|
|
848
|
+
lower: 'a-z',
|
|
849
|
+
print: '\\x20-\\x7E ',
|
|
850
|
+
punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
|
|
851
|
+
space: ' \\t\\r\\n\\v\\f',
|
|
852
|
+
upper: 'A-Z',
|
|
853
|
+
word: 'A-Za-z0-9_',
|
|
854
|
+
xdigit: 'A-Fa-f0-9'
|
|
855
|
+
};
|
|
856
|
+
module.exports = {
|
|
857
|
+
MAX_LENGTH: 65536,
|
|
858
|
+
POSIX_REGEX_SOURCE,
|
|
859
|
+
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
860
|
+
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
861
|
+
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
862
|
+
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
863
|
+
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
864
|
+
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
865
|
+
REPLACEMENTS: {
|
|
866
|
+
'***': '*',
|
|
867
|
+
'**/**': '**',
|
|
868
|
+
'**/**/**': '**'
|
|
869
|
+
},
|
|
870
|
+
CHAR_0: 48,
|
|
871
|
+
CHAR_9: 57,
|
|
872
|
+
CHAR_UPPERCASE_A: 65,
|
|
873
|
+
CHAR_LOWERCASE_A: 97,
|
|
874
|
+
CHAR_UPPERCASE_Z: 90,
|
|
875
|
+
CHAR_LOWERCASE_Z: 122,
|
|
876
|
+
CHAR_LEFT_PARENTHESES: 40,
|
|
877
|
+
CHAR_RIGHT_PARENTHESES: 41,
|
|
878
|
+
CHAR_ASTERISK: 42,
|
|
879
|
+
CHAR_AMPERSAND: 38,
|
|
880
|
+
CHAR_AT: 64,
|
|
881
|
+
CHAR_BACKWARD_SLASH: 92,
|
|
882
|
+
CHAR_CARRIAGE_RETURN: 13,
|
|
883
|
+
CHAR_CIRCUMFLEX_ACCENT: 94,
|
|
884
|
+
CHAR_COLON: 58,
|
|
885
|
+
CHAR_COMMA: 44,
|
|
886
|
+
CHAR_DOT: 46,
|
|
887
|
+
CHAR_DOUBLE_QUOTE: 34,
|
|
888
|
+
CHAR_EQUAL: 61,
|
|
889
|
+
CHAR_EXCLAMATION_MARK: 33,
|
|
890
|
+
CHAR_FORM_FEED: 12,
|
|
891
|
+
CHAR_FORWARD_SLASH: 47,
|
|
892
|
+
CHAR_GRAVE_ACCENT: 96,
|
|
893
|
+
CHAR_HASH: 35,
|
|
894
|
+
CHAR_HYPHEN_MINUS: 45,
|
|
895
|
+
CHAR_LEFT_ANGLE_BRACKET: 60,
|
|
896
|
+
CHAR_LEFT_CURLY_BRACE: 123,
|
|
897
|
+
CHAR_LEFT_SQUARE_BRACKET: 91,
|
|
898
|
+
CHAR_LINE_FEED: 10,
|
|
899
|
+
CHAR_NO_BREAK_SPACE: 160,
|
|
900
|
+
CHAR_PERCENT: 37,
|
|
901
|
+
CHAR_PLUS: 43,
|
|
902
|
+
CHAR_QUESTION_MARK: 63,
|
|
903
|
+
CHAR_RIGHT_ANGLE_BRACKET: 62,
|
|
904
|
+
CHAR_RIGHT_CURLY_BRACE: 125,
|
|
905
|
+
CHAR_RIGHT_SQUARE_BRACKET: 93,
|
|
906
|
+
CHAR_SEMICOLON: 59,
|
|
907
|
+
CHAR_SINGLE_QUOTE: 39,
|
|
908
|
+
CHAR_SPACE: 32,
|
|
909
|
+
CHAR_TAB: 9,
|
|
910
|
+
CHAR_UNDERSCORE: 95,
|
|
911
|
+
CHAR_VERTICAL_LINE: 124,
|
|
912
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
913
|
+
extglobChars (chars) {
|
|
914
|
+
return {
|
|
915
|
+
'!': {
|
|
916
|
+
type: 'negate',
|
|
917
|
+
open: '(?:(?!(?:',
|
|
918
|
+
close: `))${chars.STAR})`
|
|
919
|
+
},
|
|
920
|
+
'?': {
|
|
921
|
+
type: 'qmark',
|
|
922
|
+
open: '(?:',
|
|
923
|
+
close: ')?'
|
|
924
|
+
},
|
|
925
|
+
'+': {
|
|
926
|
+
type: 'plus',
|
|
927
|
+
open: '(?:',
|
|
928
|
+
close: ')+'
|
|
929
|
+
},
|
|
930
|
+
'*': {
|
|
931
|
+
type: 'star',
|
|
932
|
+
open: '(?:',
|
|
933
|
+
close: ')*'
|
|
934
|
+
},
|
|
935
|
+
'@': {
|
|
936
|
+
type: 'at',
|
|
937
|
+
open: '(?:',
|
|
938
|
+
close: ')'
|
|
939
|
+
}
|
|
940
|
+
};
|
|
941
|
+
},
|
|
942
|
+
globChars (win32) {
|
|
943
|
+
return true === win32 ? WINDOWS_CHARS : POSIX_CHARS;
|
|
944
|
+
}
|
|
945
|
+
};
|
|
946
|
+
},
|
|
947
|
+
"../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/parse.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
948
|
+
const constants = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/constants.js");
|
|
949
|
+
const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/utils.js");
|
|
950
|
+
const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants;
|
|
951
|
+
const expandRange = (args, options)=>{
|
|
952
|
+
if ('function' == typeof options.expandRange) return options.expandRange(...args, options);
|
|
953
|
+
args.sort();
|
|
954
|
+
const value = `[${args.join('-')}]`;
|
|
955
|
+
try {
|
|
956
|
+
new RegExp(value);
|
|
957
|
+
} catch (ex) {
|
|
958
|
+
return args.map((v)=>utils.escapeRegex(v)).join('..');
|
|
959
|
+
}
|
|
960
|
+
return value;
|
|
961
|
+
};
|
|
962
|
+
const syntaxError = (type, char)=>`Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
963
|
+
const parse = (input, options)=>{
|
|
964
|
+
if ('string' != typeof input) throw new TypeError('Expected a string');
|
|
965
|
+
input = REPLACEMENTS[input] || input;
|
|
966
|
+
const opts = {
|
|
967
|
+
...options
|
|
968
|
+
};
|
|
969
|
+
const max = 'number' == typeof opts.maxLength ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
970
|
+
let len = input.length;
|
|
971
|
+
if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
972
|
+
const bos = {
|
|
973
|
+
type: 'bos',
|
|
974
|
+
value: '',
|
|
975
|
+
output: opts.prepend || ''
|
|
976
|
+
};
|
|
977
|
+
const tokens = [
|
|
978
|
+
bos
|
|
979
|
+
];
|
|
980
|
+
const capture = opts.capture ? '' : '?:';
|
|
981
|
+
const PLATFORM_CHARS = constants.globChars(opts.windows);
|
|
982
|
+
const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
|
|
983
|
+
const { DOT_LITERAL, PLUS_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOT_SLASH, NO_DOTS_SLASH, QMARK, QMARK_NO_DOT, STAR, START_ANCHOR } = PLATFORM_CHARS;
|
|
984
|
+
const globstar = (opts)=>`(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
985
|
+
const nodot = opts.dot ? '' : NO_DOT;
|
|
986
|
+
const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
|
|
987
|
+
let star = true === opts.bash ? globstar(opts) : STAR;
|
|
988
|
+
if (opts.capture) star = `(${star})`;
|
|
989
|
+
if ('boolean' == typeof opts.noext) opts.noextglob = opts.noext;
|
|
990
|
+
const state = {
|
|
991
|
+
input,
|
|
992
|
+
index: -1,
|
|
993
|
+
start: 0,
|
|
994
|
+
dot: true === opts.dot,
|
|
995
|
+
consumed: '',
|
|
996
|
+
output: '',
|
|
997
|
+
prefix: '',
|
|
998
|
+
backtrack: false,
|
|
999
|
+
negated: false,
|
|
1000
|
+
brackets: 0,
|
|
1001
|
+
braces: 0,
|
|
1002
|
+
parens: 0,
|
|
1003
|
+
quotes: 0,
|
|
1004
|
+
globstar: false,
|
|
1005
|
+
tokens
|
|
1006
|
+
};
|
|
1007
|
+
input = utils.removePrefix(input, state);
|
|
1008
|
+
len = input.length;
|
|
1009
|
+
const extglobs = [];
|
|
1010
|
+
const braces = [];
|
|
1011
|
+
const stack = [];
|
|
1012
|
+
let prev = bos;
|
|
1013
|
+
let value;
|
|
1014
|
+
const eos = ()=>state.index === len - 1;
|
|
1015
|
+
const peek = state.peek = (n = 1)=>input[state.index + n];
|
|
1016
|
+
const advance = state.advance = ()=>input[++state.index] || '';
|
|
1017
|
+
const remaining = ()=>input.slice(state.index + 1);
|
|
1018
|
+
const consume = (value = '', num = 0)=>{
|
|
1019
|
+
state.consumed += value;
|
|
1020
|
+
state.index += num;
|
|
1021
|
+
};
|
|
1022
|
+
const append = (token)=>{
|
|
1023
|
+
state.output += null != token.output ? token.output : token.value;
|
|
1024
|
+
consume(token.value);
|
|
1025
|
+
};
|
|
1026
|
+
const negate = ()=>{
|
|
1027
|
+
let count = 1;
|
|
1028
|
+
while('!' === peek() && ('(' !== peek(2) || '?' === peek(3))){
|
|
1029
|
+
advance();
|
|
1030
|
+
state.start++;
|
|
1031
|
+
count++;
|
|
1032
|
+
}
|
|
1033
|
+
if (count % 2 === 0) return false;
|
|
1034
|
+
state.negated = true;
|
|
1035
|
+
state.start++;
|
|
1036
|
+
return true;
|
|
1037
|
+
};
|
|
1038
|
+
const increment = (type)=>{
|
|
1039
|
+
state[type]++;
|
|
1040
|
+
stack.push(type);
|
|
1041
|
+
};
|
|
1042
|
+
const decrement = (type)=>{
|
|
1043
|
+
state[type]--;
|
|
1044
|
+
stack.pop();
|
|
1045
|
+
};
|
|
1046
|
+
const push = (tok)=>{
|
|
1047
|
+
if ('globstar' === prev.type) {
|
|
1048
|
+
const isBrace = state.braces > 0 && ('comma' === tok.type || 'brace' === tok.type);
|
|
1049
|
+
const isExtglob = true === tok.extglob || extglobs.length && ('pipe' === tok.type || 'paren' === tok.type);
|
|
1050
|
+
if ('slash' !== tok.type && 'paren' !== tok.type && !isBrace && !isExtglob) {
|
|
1051
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
1052
|
+
prev.type = 'star';
|
|
1053
|
+
prev.value = '*';
|
|
1054
|
+
prev.output = star;
|
|
1055
|
+
state.output += prev.output;
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
if (extglobs.length && 'paren' !== tok.type) extglobs[extglobs.length - 1].inner += tok.value;
|
|
1059
|
+
if (tok.value || tok.output) append(tok);
|
|
1060
|
+
if (prev && 'text' === prev.type && 'text' === tok.type) {
|
|
1061
|
+
prev.output = (prev.output || prev.value) + tok.value;
|
|
1062
|
+
prev.value += tok.value;
|
|
1063
|
+
return;
|
|
1064
|
+
}
|
|
1065
|
+
tok.prev = prev;
|
|
1066
|
+
tokens.push(tok);
|
|
1067
|
+
prev = tok;
|
|
1068
|
+
};
|
|
1069
|
+
const extglobOpen = (type, value)=>{
|
|
1070
|
+
const token = {
|
|
1071
|
+
...EXTGLOB_CHARS[value],
|
|
1072
|
+
conditions: 1,
|
|
1073
|
+
inner: ''
|
|
1074
|
+
};
|
|
1075
|
+
token.prev = prev;
|
|
1076
|
+
token.parens = state.parens;
|
|
1077
|
+
token.output = state.output;
|
|
1078
|
+
const output = (opts.capture ? '(' : '') + token.open;
|
|
1079
|
+
increment('parens');
|
|
1080
|
+
push({
|
|
1081
|
+
type,
|
|
1082
|
+
value,
|
|
1083
|
+
output: state.output ? '' : ONE_CHAR
|
|
1084
|
+
});
|
|
1085
|
+
push({
|
|
1086
|
+
type: 'paren',
|
|
1087
|
+
extglob: true,
|
|
1088
|
+
value: advance(),
|
|
1089
|
+
output
|
|
1090
|
+
});
|
|
1091
|
+
extglobs.push(token);
|
|
1092
|
+
};
|
|
1093
|
+
const extglobClose = (token)=>{
|
|
1094
|
+
let output = token.close + (opts.capture ? ')' : '');
|
|
1095
|
+
let rest;
|
|
1096
|
+
if ('negate' === token.type) {
|
|
1097
|
+
let extglobStar = star;
|
|
1098
|
+
if (token.inner && token.inner.length > 1 && token.inner.includes('/')) extglobStar = globstar(opts);
|
|
1099
|
+
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) output = token.close = `)$))${extglobStar}`;
|
|
1100
|
+
if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
1101
|
+
const expression = parse(rest, {
|
|
1102
|
+
...options,
|
|
1103
|
+
fastpaths: false
|
|
1104
|
+
}).output;
|
|
1105
|
+
output = token.close = `)${expression})${extglobStar})`;
|
|
1106
|
+
}
|
|
1107
|
+
if ('bos' === token.prev.type) state.negatedExtglob = true;
|
|
1108
|
+
}
|
|
1109
|
+
push({
|
|
1110
|
+
type: 'paren',
|
|
1111
|
+
extglob: true,
|
|
1112
|
+
value,
|
|
1113
|
+
output
|
|
1114
|
+
});
|
|
1115
|
+
decrement('parens');
|
|
1116
|
+
};
|
|
1117
|
+
if (false !== opts.fastpaths && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
1118
|
+
let backslashes = false;
|
|
1119
|
+
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index)=>{
|
|
1120
|
+
if ('\\' === first) {
|
|
1121
|
+
backslashes = true;
|
|
1122
|
+
return m;
|
|
1123
|
+
}
|
|
1124
|
+
if ('?' === first) {
|
|
1125
|
+
if (esc) return esc + first + (rest ? QMARK.repeat(rest.length) : '');
|
|
1126
|
+
if (0 === index) return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
|
|
1127
|
+
return QMARK.repeat(chars.length);
|
|
1128
|
+
}
|
|
1129
|
+
if ('.' === first) return DOT_LITERAL.repeat(chars.length);
|
|
1130
|
+
if ('*' === first) {
|
|
1131
|
+
if (esc) return esc + first + (rest ? star : '');
|
|
1132
|
+
return star;
|
|
1133
|
+
}
|
|
1134
|
+
return esc ? m : `\\${m}`;
|
|
1135
|
+
});
|
|
1136
|
+
if (true === backslashes) output = true === opts.unescape ? output.replace(/\\/g, '') : output.replace(/\\+/g, (m)=>m.length % 2 === 0 ? '\\\\' : m ? '\\' : '');
|
|
1137
|
+
if (output === input && true === opts.contains) {
|
|
1138
|
+
state.output = input;
|
|
1139
|
+
return state;
|
|
1140
|
+
}
|
|
1141
|
+
state.output = utils.wrapOutput(output, state, options);
|
|
1142
|
+
return state;
|
|
1143
|
+
}
|
|
1144
|
+
while(!eos()){
|
|
1145
|
+
value = advance();
|
|
1146
|
+
if ('\u0000' === value) continue;
|
|
1147
|
+
if ('\\' === value) {
|
|
1148
|
+
const next = peek();
|
|
1149
|
+
if ('/' === next && true !== opts.bash) continue;
|
|
1150
|
+
if ('.' === next || ';' === next) continue;
|
|
1151
|
+
if (!next) {
|
|
1152
|
+
value += '\\';
|
|
1153
|
+
push({
|
|
1154
|
+
type: 'text',
|
|
1155
|
+
value
|
|
1156
|
+
});
|
|
1157
|
+
continue;
|
|
1158
|
+
}
|
|
1159
|
+
const match = /^\\+/.exec(remaining());
|
|
1160
|
+
let slashes = 0;
|
|
1161
|
+
if (match && match[0].length > 2) {
|
|
1162
|
+
slashes = match[0].length;
|
|
1163
|
+
state.index += slashes;
|
|
1164
|
+
if (slashes % 2 !== 0) value += '\\';
|
|
1165
|
+
}
|
|
1166
|
+
if (true === opts.unescape) value = advance();
|
|
1167
|
+
else value += advance();
|
|
1168
|
+
if (0 === state.brackets) {
|
|
1169
|
+
push({
|
|
1170
|
+
type: 'text',
|
|
1171
|
+
value
|
|
1172
|
+
});
|
|
1173
|
+
continue;
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
if (state.brackets > 0 && (']' !== value || '[' === prev.value || '[^' === prev.value)) {
|
|
1177
|
+
if (false !== opts.posix && ':' === value) {
|
|
1178
|
+
const inner = prev.value.slice(1);
|
|
1179
|
+
if (inner.includes('[')) {
|
|
1180
|
+
prev.posix = true;
|
|
1181
|
+
if (inner.includes(':')) {
|
|
1182
|
+
const idx = prev.value.lastIndexOf('[');
|
|
1183
|
+
const pre = prev.value.slice(0, idx);
|
|
1184
|
+
const rest = prev.value.slice(idx + 2);
|
|
1185
|
+
const posix = POSIX_REGEX_SOURCE[rest];
|
|
1186
|
+
if (posix) {
|
|
1187
|
+
prev.value = pre + posix;
|
|
1188
|
+
state.backtrack = true;
|
|
1189
|
+
advance();
|
|
1190
|
+
if (!bos.output && 1 === tokens.indexOf(prev)) bos.output = ONE_CHAR;
|
|
1191
|
+
continue;
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
if ('[' === value && ':' !== peek() || '-' === value && ']' === peek()) value = `\\${value}`;
|
|
1197
|
+
if (']' === value && ('[' === prev.value || '[^' === prev.value)) value = `\\${value}`;
|
|
1198
|
+
if (true === opts.posix && '!' === value && '[' === prev.value) value = '^';
|
|
1199
|
+
prev.value += value;
|
|
1200
|
+
append({
|
|
1201
|
+
value
|
|
1202
|
+
});
|
|
1203
|
+
continue;
|
|
1204
|
+
}
|
|
1205
|
+
if (1 === state.quotes && '"' !== value) {
|
|
1206
|
+
value = utils.escapeRegex(value);
|
|
1207
|
+
prev.value += value;
|
|
1208
|
+
append({
|
|
1209
|
+
value
|
|
1210
|
+
});
|
|
1211
|
+
continue;
|
|
1212
|
+
}
|
|
1213
|
+
if ('"' === value) {
|
|
1214
|
+
state.quotes = 1 === state.quotes ? 0 : 1;
|
|
1215
|
+
if (true === opts.keepQuotes) push({
|
|
1216
|
+
type: 'text',
|
|
1217
|
+
value
|
|
1218
|
+
});
|
|
1219
|
+
continue;
|
|
1220
|
+
}
|
|
1221
|
+
if ('(' === value) {
|
|
1222
|
+
increment('parens');
|
|
1223
|
+
push({
|
|
1224
|
+
type: 'paren',
|
|
1225
|
+
value
|
|
1226
|
+
});
|
|
1227
|
+
continue;
|
|
1228
|
+
}
|
|
1229
|
+
if (')' === value) {
|
|
1230
|
+
if (0 === state.parens && true === opts.strictBrackets) throw new SyntaxError(syntaxError('opening', '('));
|
|
1231
|
+
const extglob = extglobs[extglobs.length - 1];
|
|
1232
|
+
if (extglob && state.parens === extglob.parens + 1) {
|
|
1233
|
+
extglobClose(extglobs.pop());
|
|
1234
|
+
continue;
|
|
1235
|
+
}
|
|
1236
|
+
push({
|
|
1237
|
+
type: 'paren',
|
|
1238
|
+
value,
|
|
1239
|
+
output: state.parens ? ')' : '\\)'
|
|
1240
|
+
});
|
|
1241
|
+
decrement('parens');
|
|
1242
|
+
continue;
|
|
1243
|
+
}
|
|
1244
|
+
if ('[' === value) {
|
|
1245
|
+
if (true !== opts.nobracket && remaining().includes(']')) increment('brackets');
|
|
1246
|
+
else {
|
|
1247
|
+
if (true !== opts.nobracket && true === opts.strictBrackets) throw new SyntaxError(syntaxError('closing', ']'));
|
|
1248
|
+
value = `\\${value}`;
|
|
1249
|
+
}
|
|
1250
|
+
push({
|
|
1251
|
+
type: 'bracket',
|
|
1252
|
+
value
|
|
1253
|
+
});
|
|
1254
|
+
continue;
|
|
1255
|
+
}
|
|
1256
|
+
if (']' === value) {
|
|
1257
|
+
if (true === opts.nobracket || prev && 'bracket' === prev.type && 1 === prev.value.length) {
|
|
1258
|
+
push({
|
|
1259
|
+
type: 'text',
|
|
1260
|
+
value,
|
|
1261
|
+
output: `\\${value}`
|
|
1262
|
+
});
|
|
1263
|
+
continue;
|
|
1264
|
+
}
|
|
1265
|
+
if (0 === state.brackets) {
|
|
1266
|
+
if (true === opts.strictBrackets) throw new SyntaxError(syntaxError('opening', '['));
|
|
1267
|
+
push({
|
|
1268
|
+
type: 'text',
|
|
1269
|
+
value,
|
|
1270
|
+
output: `\\${value}`
|
|
1271
|
+
});
|
|
1272
|
+
continue;
|
|
1273
|
+
}
|
|
1274
|
+
decrement('brackets');
|
|
1275
|
+
const prevValue = prev.value.slice(1);
|
|
1276
|
+
if (true !== prev.posix && '^' === prevValue[0] && !prevValue.includes('/')) value = `/${value}`;
|
|
1277
|
+
prev.value += value;
|
|
1278
|
+
append({
|
|
1279
|
+
value
|
|
1280
|
+
});
|
|
1281
|
+
if (false === opts.literalBrackets || utils.hasRegexChars(prevValue)) continue;
|
|
1282
|
+
const escaped = utils.escapeRegex(prev.value);
|
|
1283
|
+
state.output = state.output.slice(0, -prev.value.length);
|
|
1284
|
+
if (true === opts.literalBrackets) {
|
|
1285
|
+
state.output += escaped;
|
|
1286
|
+
prev.value = escaped;
|
|
1287
|
+
continue;
|
|
1288
|
+
}
|
|
1289
|
+
prev.value = `(${capture}${escaped}|${prev.value})`;
|
|
1290
|
+
state.output += prev.value;
|
|
1291
|
+
continue;
|
|
1292
|
+
}
|
|
1293
|
+
if ('{' === value && true !== opts.nobrace) {
|
|
1294
|
+
increment('braces');
|
|
1295
|
+
const open = {
|
|
1296
|
+
type: 'brace',
|
|
1297
|
+
value,
|
|
1298
|
+
output: '(',
|
|
1299
|
+
outputIndex: state.output.length,
|
|
1300
|
+
tokensIndex: state.tokens.length
|
|
1301
|
+
};
|
|
1302
|
+
braces.push(open);
|
|
1303
|
+
push(open);
|
|
1304
|
+
continue;
|
|
1305
|
+
}
|
|
1306
|
+
if ('}' === value) {
|
|
1307
|
+
const brace = braces[braces.length - 1];
|
|
1308
|
+
if (true === opts.nobrace || !brace) {
|
|
1309
|
+
push({
|
|
1310
|
+
type: 'text',
|
|
1311
|
+
value,
|
|
1312
|
+
output: value
|
|
1313
|
+
});
|
|
1314
|
+
continue;
|
|
1315
|
+
}
|
|
1316
|
+
let output = ')';
|
|
1317
|
+
if (true === brace.dots) {
|
|
1318
|
+
const arr = tokens.slice();
|
|
1319
|
+
const range = [];
|
|
1320
|
+
for(let i = arr.length - 1; i >= 0; i--){
|
|
1321
|
+
tokens.pop();
|
|
1322
|
+
if ('brace' === arr[i].type) break;
|
|
1323
|
+
if ('dots' !== arr[i].type) range.unshift(arr[i].value);
|
|
1324
|
+
}
|
|
1325
|
+
output = expandRange(range, opts);
|
|
1326
|
+
state.backtrack = true;
|
|
1327
|
+
}
|
|
1328
|
+
if (true !== brace.comma && true !== brace.dots) {
|
|
1329
|
+
const out = state.output.slice(0, brace.outputIndex);
|
|
1330
|
+
const toks = state.tokens.slice(brace.tokensIndex);
|
|
1331
|
+
brace.value = brace.output = '\\{';
|
|
1332
|
+
value = output = '\\}';
|
|
1333
|
+
state.output = out;
|
|
1334
|
+
for (const t of toks)state.output += t.output || t.value;
|
|
1335
|
+
}
|
|
1336
|
+
push({
|
|
1337
|
+
type: 'brace',
|
|
1338
|
+
value,
|
|
1339
|
+
output
|
|
1340
|
+
});
|
|
1341
|
+
decrement('braces');
|
|
1342
|
+
braces.pop();
|
|
1343
|
+
continue;
|
|
1344
|
+
}
|
|
1345
|
+
if ('|' === value) {
|
|
1346
|
+
if (extglobs.length > 0) extglobs[extglobs.length - 1].conditions++;
|
|
1347
|
+
push({
|
|
1348
|
+
type: 'text',
|
|
1349
|
+
value
|
|
1350
|
+
});
|
|
1351
|
+
continue;
|
|
1352
|
+
}
|
|
1353
|
+
if (',' === value) {
|
|
1354
|
+
let output = value;
|
|
1355
|
+
const brace = braces[braces.length - 1];
|
|
1356
|
+
if (brace && 'braces' === stack[stack.length - 1]) {
|
|
1357
|
+
brace.comma = true;
|
|
1358
|
+
output = '|';
|
|
1359
|
+
}
|
|
1360
|
+
push({
|
|
1361
|
+
type: 'comma',
|
|
1362
|
+
value,
|
|
1363
|
+
output
|
|
1364
|
+
});
|
|
1365
|
+
continue;
|
|
1366
|
+
}
|
|
1367
|
+
if ('/' === value) {
|
|
1368
|
+
if ('dot' === prev.type && state.index === state.start + 1) {
|
|
1369
|
+
state.start = state.index + 1;
|
|
1370
|
+
state.consumed = '';
|
|
1371
|
+
state.output = '';
|
|
1372
|
+
tokens.pop();
|
|
1373
|
+
prev = bos;
|
|
1374
|
+
continue;
|
|
1375
|
+
}
|
|
1376
|
+
push({
|
|
1377
|
+
type: 'slash',
|
|
1378
|
+
value,
|
|
1379
|
+
output: SLASH_LITERAL
|
|
1380
|
+
});
|
|
1381
|
+
continue;
|
|
1382
|
+
}
|
|
1383
|
+
if ('.' === value) {
|
|
1384
|
+
if (state.braces > 0 && 'dot' === prev.type) {
|
|
1385
|
+
if ('.' === prev.value) prev.output = DOT_LITERAL;
|
|
1386
|
+
const brace = braces[braces.length - 1];
|
|
1387
|
+
prev.type = 'dots';
|
|
1388
|
+
prev.output += value;
|
|
1389
|
+
prev.value += value;
|
|
1390
|
+
brace.dots = true;
|
|
1391
|
+
continue;
|
|
1392
|
+
}
|
|
1393
|
+
if (state.braces + state.parens === 0 && 'bos' !== prev.type && 'slash' !== prev.type) {
|
|
1394
|
+
push({
|
|
1395
|
+
type: 'text',
|
|
1396
|
+
value,
|
|
1397
|
+
output: DOT_LITERAL
|
|
1398
|
+
});
|
|
1399
|
+
continue;
|
|
1400
|
+
}
|
|
1401
|
+
push({
|
|
1402
|
+
type: 'dot',
|
|
1403
|
+
value,
|
|
1404
|
+
output: DOT_LITERAL
|
|
1405
|
+
});
|
|
1406
|
+
continue;
|
|
1407
|
+
}
|
|
1408
|
+
if ('?' === value) {
|
|
1409
|
+
const isGroup = prev && '(' === prev.value;
|
|
1410
|
+
if (!isGroup && true !== opts.noextglob && '(' === peek() && '?' !== peek(2)) {
|
|
1411
|
+
extglobOpen('qmark', value);
|
|
1412
|
+
continue;
|
|
1413
|
+
}
|
|
1414
|
+
if (prev && 'paren' === prev.type) {
|
|
1415
|
+
const next = peek();
|
|
1416
|
+
let output = value;
|
|
1417
|
+
if ('(' === prev.value && !/[!=<:]/.test(next) || '<' === next && !/<([!=]|\w+>)/.test(remaining())) output = `\\${value}`;
|
|
1418
|
+
push({
|
|
1419
|
+
type: 'text',
|
|
1420
|
+
value,
|
|
1421
|
+
output
|
|
1422
|
+
});
|
|
1423
|
+
continue;
|
|
1424
|
+
}
|
|
1425
|
+
if (true !== opts.dot && ('slash' === prev.type || 'bos' === prev.type)) {
|
|
1426
|
+
push({
|
|
1427
|
+
type: 'qmark',
|
|
1428
|
+
value,
|
|
1429
|
+
output: QMARK_NO_DOT
|
|
1430
|
+
});
|
|
1431
|
+
continue;
|
|
1432
|
+
}
|
|
1433
|
+
push({
|
|
1434
|
+
type: 'qmark',
|
|
1435
|
+
value,
|
|
1436
|
+
output: QMARK
|
|
1437
|
+
});
|
|
1438
|
+
continue;
|
|
1439
|
+
}
|
|
1440
|
+
if ('!' === value) {
|
|
1441
|
+
if (true !== opts.noextglob && '(' === peek()) {
|
|
1442
|
+
if ('?' !== peek(2) || !/[!=<:]/.test(peek(3))) {
|
|
1443
|
+
extglobOpen('negate', value);
|
|
1444
|
+
continue;
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
if (true !== opts.nonegate && 0 === state.index) {
|
|
1448
|
+
negate();
|
|
1449
|
+
continue;
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
if ('+' === value) {
|
|
1453
|
+
if (true !== opts.noextglob && '(' === peek() && '?' !== peek(2)) {
|
|
1454
|
+
extglobOpen('plus', value);
|
|
1455
|
+
continue;
|
|
1456
|
+
}
|
|
1457
|
+
if (prev && '(' === prev.value || false === opts.regex) {
|
|
1458
|
+
push({
|
|
1459
|
+
type: 'plus',
|
|
1460
|
+
value,
|
|
1461
|
+
output: PLUS_LITERAL
|
|
1462
|
+
});
|
|
1463
|
+
continue;
|
|
1464
|
+
}
|
|
1465
|
+
if (prev && ('bracket' === prev.type || 'paren' === prev.type || 'brace' === prev.type) || state.parens > 0) {
|
|
1466
|
+
push({
|
|
1467
|
+
type: 'plus',
|
|
1468
|
+
value
|
|
1469
|
+
});
|
|
1470
|
+
continue;
|
|
1471
|
+
}
|
|
1472
|
+
push({
|
|
1473
|
+
type: 'plus',
|
|
1474
|
+
value: PLUS_LITERAL
|
|
1475
|
+
});
|
|
1476
|
+
continue;
|
|
1477
|
+
}
|
|
1478
|
+
if ('@' === value) {
|
|
1479
|
+
if (true !== opts.noextglob && '(' === peek() && '?' !== peek(2)) {
|
|
1480
|
+
push({
|
|
1481
|
+
type: 'at',
|
|
1482
|
+
extglob: true,
|
|
1483
|
+
value,
|
|
1484
|
+
output: ''
|
|
1485
|
+
});
|
|
1486
|
+
continue;
|
|
1487
|
+
}
|
|
1488
|
+
push({
|
|
1489
|
+
type: 'text',
|
|
1490
|
+
value
|
|
1491
|
+
});
|
|
1492
|
+
continue;
|
|
1493
|
+
}
|
|
1494
|
+
if ('*' !== value) {
|
|
1495
|
+
if ('$' === value || '^' === value) value = `\\${value}`;
|
|
1496
|
+
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
|
1497
|
+
if (match) {
|
|
1498
|
+
value += match[0];
|
|
1499
|
+
state.index += match[0].length;
|
|
1500
|
+
}
|
|
1501
|
+
push({
|
|
1502
|
+
type: 'text',
|
|
1503
|
+
value
|
|
1504
|
+
});
|
|
1505
|
+
continue;
|
|
1506
|
+
}
|
|
1507
|
+
if (prev && ('globstar' === prev.type || true === prev.star)) {
|
|
1508
|
+
prev.type = 'star';
|
|
1509
|
+
prev.star = true;
|
|
1510
|
+
prev.value += value;
|
|
1511
|
+
prev.output = star;
|
|
1512
|
+
state.backtrack = true;
|
|
1513
|
+
state.globstar = true;
|
|
1514
|
+
consume(value);
|
|
1515
|
+
continue;
|
|
1516
|
+
}
|
|
1517
|
+
let rest = remaining();
|
|
1518
|
+
if (true !== opts.noextglob && /^\([^?]/.test(rest)) {
|
|
1519
|
+
extglobOpen('star', value);
|
|
1520
|
+
continue;
|
|
1521
|
+
}
|
|
1522
|
+
if ('star' === prev.type) {
|
|
1523
|
+
if (true === opts.noglobstar) {
|
|
1524
|
+
consume(value);
|
|
1525
|
+
continue;
|
|
1526
|
+
}
|
|
1527
|
+
const prior = prev.prev;
|
|
1528
|
+
const before = prior.prev;
|
|
1529
|
+
const isStart = 'slash' === prior.type || 'bos' === prior.type;
|
|
1530
|
+
const afterStar = before && ('star' === before.type || 'globstar' === before.type);
|
|
1531
|
+
if (true === opts.bash && (!isStart || rest[0] && '/' !== rest[0])) {
|
|
1532
|
+
push({
|
|
1533
|
+
type: 'star',
|
|
1534
|
+
value,
|
|
1535
|
+
output: ''
|
|
1536
|
+
});
|
|
1537
|
+
continue;
|
|
1538
|
+
}
|
|
1539
|
+
const isBrace = state.braces > 0 && ('comma' === prior.type || 'brace' === prior.type);
|
|
1540
|
+
const isExtglob = extglobs.length && ('pipe' === prior.type || 'paren' === prior.type);
|
|
1541
|
+
if (!isStart && 'paren' !== prior.type && !isBrace && !isExtglob) {
|
|
1542
|
+
push({
|
|
1543
|
+
type: 'star',
|
|
1544
|
+
value,
|
|
1545
|
+
output: ''
|
|
1546
|
+
});
|
|
1547
|
+
continue;
|
|
1548
|
+
}
|
|
1549
|
+
while('/**' === rest.slice(0, 3)){
|
|
1550
|
+
const after = input[state.index + 4];
|
|
1551
|
+
if (after && '/' !== after) break;
|
|
1552
|
+
rest = rest.slice(3);
|
|
1553
|
+
consume('/**', 3);
|
|
1554
|
+
}
|
|
1555
|
+
if ('bos' === prior.type && eos()) {
|
|
1556
|
+
prev.type = 'globstar';
|
|
1557
|
+
prev.value += value;
|
|
1558
|
+
prev.output = globstar(opts);
|
|
1559
|
+
state.output = prev.output;
|
|
1560
|
+
state.globstar = true;
|
|
1561
|
+
consume(value);
|
|
1562
|
+
continue;
|
|
1563
|
+
}
|
|
1564
|
+
if ('slash' === prior.type && 'bos' !== prior.prev.type && !afterStar && eos()) {
|
|
1565
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
1566
|
+
prior.output = `(?:${prior.output}`;
|
|
1567
|
+
prev.type = 'globstar';
|
|
1568
|
+
prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
|
|
1569
|
+
prev.value += value;
|
|
1570
|
+
state.globstar = true;
|
|
1571
|
+
state.output += prior.output + prev.output;
|
|
1572
|
+
consume(value);
|
|
1573
|
+
continue;
|
|
1574
|
+
}
|
|
1575
|
+
if ('slash' === prior.type && 'bos' !== prior.prev.type && '/' === rest[0]) {
|
|
1576
|
+
const end = void 0 !== rest[1] ? '|$' : '';
|
|
1577
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
1578
|
+
prior.output = `(?:${prior.output}`;
|
|
1579
|
+
prev.type = 'globstar';
|
|
1580
|
+
prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
|
|
1581
|
+
prev.value += value;
|
|
1582
|
+
state.output += prior.output + prev.output;
|
|
1583
|
+
state.globstar = true;
|
|
1584
|
+
consume(value + advance());
|
|
1585
|
+
push({
|
|
1586
|
+
type: 'slash',
|
|
1587
|
+
value: '/',
|
|
1588
|
+
output: ''
|
|
1589
|
+
});
|
|
1590
|
+
continue;
|
|
1591
|
+
}
|
|
1592
|
+
if ('bos' === prior.type && '/' === rest[0]) {
|
|
1593
|
+
prev.type = 'globstar';
|
|
1594
|
+
prev.value += value;
|
|
1595
|
+
prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
|
|
1596
|
+
state.output = prev.output;
|
|
1597
|
+
state.globstar = true;
|
|
1598
|
+
consume(value + advance());
|
|
1599
|
+
push({
|
|
1600
|
+
type: 'slash',
|
|
1601
|
+
value: '/',
|
|
1602
|
+
output: ''
|
|
1603
|
+
});
|
|
1604
|
+
continue;
|
|
1605
|
+
}
|
|
1606
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
1607
|
+
prev.type = 'globstar';
|
|
1608
|
+
prev.output = globstar(opts);
|
|
1609
|
+
prev.value += value;
|
|
1610
|
+
state.output += prev.output;
|
|
1611
|
+
state.globstar = true;
|
|
1612
|
+
consume(value);
|
|
1613
|
+
continue;
|
|
1614
|
+
}
|
|
1615
|
+
const token = {
|
|
1616
|
+
type: 'star',
|
|
1617
|
+
value,
|
|
1618
|
+
output: star
|
|
1619
|
+
};
|
|
1620
|
+
if (true === opts.bash) {
|
|
1621
|
+
token.output = '.*?';
|
|
1622
|
+
if ('bos' === prev.type || 'slash' === prev.type) token.output = nodot + token.output;
|
|
1623
|
+
push(token);
|
|
1624
|
+
continue;
|
|
1625
|
+
}
|
|
1626
|
+
if (prev && ('bracket' === prev.type || 'paren' === prev.type) && true === opts.regex) {
|
|
1627
|
+
token.output = value;
|
|
1628
|
+
push(token);
|
|
1629
|
+
continue;
|
|
1630
|
+
}
|
|
1631
|
+
if (state.index === state.start || 'slash' === prev.type || 'dot' === prev.type) {
|
|
1632
|
+
if ('dot' === prev.type) {
|
|
1633
|
+
state.output += NO_DOT_SLASH;
|
|
1634
|
+
prev.output += NO_DOT_SLASH;
|
|
1635
|
+
} else if (true === opts.dot) {
|
|
1636
|
+
state.output += NO_DOTS_SLASH;
|
|
1637
|
+
prev.output += NO_DOTS_SLASH;
|
|
1638
|
+
} else {
|
|
1639
|
+
state.output += nodot;
|
|
1640
|
+
prev.output += nodot;
|
|
1641
|
+
}
|
|
1642
|
+
if ('*' !== peek()) {
|
|
1643
|
+
state.output += ONE_CHAR;
|
|
1644
|
+
prev.output += ONE_CHAR;
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
push(token);
|
|
1648
|
+
}
|
|
1649
|
+
while(state.brackets > 0){
|
|
1650
|
+
if (true === opts.strictBrackets) throw new SyntaxError(syntaxError('closing', ']'));
|
|
1651
|
+
state.output = utils.escapeLast(state.output, '[');
|
|
1652
|
+
decrement('brackets');
|
|
1653
|
+
}
|
|
1654
|
+
while(state.parens > 0){
|
|
1655
|
+
if (true === opts.strictBrackets) throw new SyntaxError(syntaxError('closing', ')'));
|
|
1656
|
+
state.output = utils.escapeLast(state.output, '(');
|
|
1657
|
+
decrement('parens');
|
|
1658
|
+
}
|
|
1659
|
+
while(state.braces > 0){
|
|
1660
|
+
if (true === opts.strictBrackets) throw new SyntaxError(syntaxError('closing', '}'));
|
|
1661
|
+
state.output = utils.escapeLast(state.output, '{');
|
|
1662
|
+
decrement('braces');
|
|
1663
|
+
}
|
|
1664
|
+
if (true !== opts.strictSlashes && ('star' === prev.type || 'bracket' === prev.type)) push({
|
|
1665
|
+
type: 'maybe_slash',
|
|
1666
|
+
value: '',
|
|
1667
|
+
output: `${SLASH_LITERAL}?`
|
|
1668
|
+
});
|
|
1669
|
+
if (true === state.backtrack) {
|
|
1670
|
+
state.output = '';
|
|
1671
|
+
for (const token of state.tokens){
|
|
1672
|
+
state.output += null != token.output ? token.output : token.value;
|
|
1673
|
+
if (token.suffix) state.output += token.suffix;
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
return state;
|
|
1677
|
+
};
|
|
1678
|
+
parse.fastpaths = (input, options)=>{
|
|
1679
|
+
const opts = {
|
|
1680
|
+
...options
|
|
1681
|
+
};
|
|
1682
|
+
const max = 'number' == typeof opts.maxLength ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
1683
|
+
const len = input.length;
|
|
1684
|
+
if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
1685
|
+
input = REPLACEMENTS[input] || input;
|
|
1686
|
+
const { DOT_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOTS, NO_DOTS_SLASH, STAR, START_ANCHOR } = constants.globChars(opts.windows);
|
|
1687
|
+
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
1688
|
+
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
1689
|
+
const capture = opts.capture ? '' : '?:';
|
|
1690
|
+
const state = {
|
|
1691
|
+
negated: false,
|
|
1692
|
+
prefix: ''
|
|
1693
|
+
};
|
|
1694
|
+
let star = true === opts.bash ? '.*?' : STAR;
|
|
1695
|
+
if (opts.capture) star = `(${star})`;
|
|
1696
|
+
const globstar = (opts)=>{
|
|
1697
|
+
if (true === opts.noglobstar) return star;
|
|
1698
|
+
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
1699
|
+
};
|
|
1700
|
+
const create = (str)=>{
|
|
1701
|
+
switch(str){
|
|
1702
|
+
case '*':
|
|
1703
|
+
return `${nodot}${ONE_CHAR}${star}`;
|
|
1704
|
+
case '.*':
|
|
1705
|
+
return `${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
1706
|
+
case '*.*':
|
|
1707
|
+
return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
1708
|
+
case '*/*':
|
|
1709
|
+
return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
|
|
1710
|
+
case '**':
|
|
1711
|
+
return nodot + globstar(opts);
|
|
1712
|
+
case '**/*':
|
|
1713
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
|
|
1714
|
+
case '**/*.*':
|
|
1715
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
1716
|
+
case '**/.*':
|
|
1717
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
1718
|
+
default:
|
|
1719
|
+
{
|
|
1720
|
+
const match = /^(.*?)\.(\w+)$/.exec(str);
|
|
1721
|
+
if (!match) return;
|
|
1722
|
+
const source = create(match[1]);
|
|
1723
|
+
if (!source) return;
|
|
1724
|
+
return source + DOT_LITERAL + match[2];
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1727
|
+
};
|
|
1728
|
+
const output = utils.removePrefix(input, state);
|
|
1729
|
+
let source = create(output);
|
|
1730
|
+
if (source && true !== opts.strictSlashes) source += `${SLASH_LITERAL}?`;
|
|
1731
|
+
return source;
|
|
1732
|
+
};
|
|
1733
|
+
module.exports = parse;
|
|
1734
|
+
},
|
|
1735
|
+
"../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/picomatch.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
1736
|
+
const scan = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/scan.js");
|
|
1737
|
+
const parse = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/parse.js");
|
|
1738
|
+
const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/utils.js");
|
|
1739
|
+
const constants = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/constants.js");
|
|
1740
|
+
const isObject = (val)=>val && 'object' == typeof val && !Array.isArray(val);
|
|
1741
|
+
const picomatch = (glob, options, returnState = false)=>{
|
|
1742
|
+
if (Array.isArray(glob)) {
|
|
1743
|
+
const fns = glob.map((input)=>picomatch(input, options, returnState));
|
|
1744
|
+
const arrayMatcher = (str)=>{
|
|
1745
|
+
for (const isMatch of fns){
|
|
1746
|
+
const state = isMatch(str);
|
|
1747
|
+
if (state) return state;
|
|
1748
|
+
}
|
|
1749
|
+
return false;
|
|
1750
|
+
};
|
|
1751
|
+
return arrayMatcher;
|
|
1752
|
+
}
|
|
1753
|
+
const isState = isObject(glob) && glob.tokens && glob.input;
|
|
1754
|
+
if ('' === glob || 'string' != typeof glob && !isState) throw new TypeError('Expected pattern to be a non-empty string');
|
|
1755
|
+
const opts = options || {};
|
|
1756
|
+
const posix = opts.windows;
|
|
1757
|
+
const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
|
|
1758
|
+
const state = regex.state;
|
|
1759
|
+
delete regex.state;
|
|
1760
|
+
let isIgnored = ()=>false;
|
|
1761
|
+
if (opts.ignore) {
|
|
1762
|
+
const ignoreOpts = {
|
|
1763
|
+
...options,
|
|
1764
|
+
ignore: null,
|
|
1765
|
+
onMatch: null,
|
|
1766
|
+
onResult: null
|
|
1767
|
+
};
|
|
1768
|
+
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
|
|
1769
|
+
}
|
|
1770
|
+
const matcher = (input, returnObject = false)=>{
|
|
1771
|
+
const { isMatch, match, output } = picomatch.test(input, regex, options, {
|
|
1772
|
+
glob,
|
|
1773
|
+
posix
|
|
1774
|
+
});
|
|
1775
|
+
const result = {
|
|
1776
|
+
glob,
|
|
1777
|
+
state,
|
|
1778
|
+
regex,
|
|
1779
|
+
posix,
|
|
1780
|
+
input,
|
|
1781
|
+
output,
|
|
1782
|
+
match,
|
|
1783
|
+
isMatch
|
|
1784
|
+
};
|
|
1785
|
+
if ('function' == typeof opts.onResult) opts.onResult(result);
|
|
1786
|
+
if (false === isMatch) {
|
|
1787
|
+
result.isMatch = false;
|
|
1788
|
+
return returnObject ? result : false;
|
|
1789
|
+
}
|
|
1790
|
+
if (isIgnored(input)) {
|
|
1791
|
+
if ('function' == typeof opts.onIgnore) opts.onIgnore(result);
|
|
1792
|
+
result.isMatch = false;
|
|
1793
|
+
return returnObject ? result : false;
|
|
1794
|
+
}
|
|
1795
|
+
if ('function' == typeof opts.onMatch) opts.onMatch(result);
|
|
1796
|
+
return returnObject ? result : true;
|
|
1797
|
+
};
|
|
1798
|
+
if (returnState) matcher.state = state;
|
|
1799
|
+
return matcher;
|
|
1800
|
+
};
|
|
1801
|
+
picomatch.test = (input, regex, options, { glob, posix } = {})=>{
|
|
1802
|
+
if ('string' != typeof input) throw new TypeError('Expected input to be a string');
|
|
1803
|
+
if ('' === input) return {
|
|
1804
|
+
isMatch: false,
|
|
1805
|
+
output: ''
|
|
1806
|
+
};
|
|
1807
|
+
const opts = options || {};
|
|
1808
|
+
const format = opts.format || (posix ? utils.toPosixSlashes : null);
|
|
1809
|
+
let match = input === glob;
|
|
1810
|
+
let output = match && format ? format(input) : input;
|
|
1811
|
+
if (false === match) {
|
|
1812
|
+
output = format ? format(input) : input;
|
|
1813
|
+
match = output === glob;
|
|
1814
|
+
}
|
|
1815
|
+
if (false === match || true === opts.capture) match = true === opts.matchBase || true === opts.basename ? picomatch.matchBase(input, regex, options, posix) : regex.exec(output);
|
|
1816
|
+
return {
|
|
1817
|
+
isMatch: Boolean(match),
|
|
1818
|
+
match,
|
|
1819
|
+
output
|
|
1820
|
+
};
|
|
1821
|
+
};
|
|
1822
|
+
picomatch.matchBase = (input, glob, options)=>{
|
|
1823
|
+
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
|
1824
|
+
return regex.test(utils.basename(input));
|
|
1825
|
+
};
|
|
1826
|
+
picomatch.isMatch = (str, patterns, options)=>picomatch(patterns, options)(str);
|
|
1827
|
+
picomatch.parse = (pattern, options)=>{
|
|
1828
|
+
if (Array.isArray(pattern)) return pattern.map((p)=>picomatch.parse(p, options));
|
|
1829
|
+
return parse(pattern, {
|
|
1830
|
+
...options,
|
|
1831
|
+
fastpaths: false
|
|
1832
|
+
});
|
|
1833
|
+
};
|
|
1834
|
+
picomatch.scan = (input, options)=>scan(input, options);
|
|
1835
|
+
picomatch.compileRe = (state, options, returnOutput = false, returnState = false)=>{
|
|
1836
|
+
if (true === returnOutput) return state.output;
|
|
1837
|
+
const opts = options || {};
|
|
1838
|
+
const prepend = opts.contains ? '' : '^';
|
|
1839
|
+
const append = opts.contains ? '' : '$';
|
|
1840
|
+
let source = `${prepend}(?:${state.output})${append}`;
|
|
1841
|
+
if (state && true === state.negated) source = `^(?!${source}).*$`;
|
|
1842
|
+
const regex = picomatch.toRegex(source, options);
|
|
1843
|
+
if (true === returnState) regex.state = state;
|
|
1844
|
+
return regex;
|
|
1845
|
+
};
|
|
1846
|
+
picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false)=>{
|
|
1847
|
+
if (!input || 'string' != typeof input) throw new TypeError('Expected a non-empty string');
|
|
1848
|
+
let parsed = {
|
|
1849
|
+
negated: false,
|
|
1850
|
+
fastpaths: true
|
|
1851
|
+
};
|
|
1852
|
+
if (false !== options.fastpaths && ('.' === input[0] || '*' === input[0])) parsed.output = parse.fastpaths(input, options);
|
|
1853
|
+
if (!parsed.output) parsed = parse(input, options);
|
|
1854
|
+
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
|
1855
|
+
};
|
|
1856
|
+
picomatch.toRegex = (source, options)=>{
|
|
1857
|
+
try {
|
|
1858
|
+
const opts = options || {};
|
|
1859
|
+
return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
|
|
1860
|
+
} catch (err) {
|
|
1861
|
+
if (options && true === options.debug) throw err;
|
|
1862
|
+
return /$^/;
|
|
1863
|
+
}
|
|
1864
|
+
};
|
|
1865
|
+
picomatch.constants = constants;
|
|
1866
|
+
module.exports = picomatch;
|
|
1867
|
+
},
|
|
1868
|
+
"../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/scan.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
1869
|
+
const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/utils.js");
|
|
1870
|
+
const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/constants.js");
|
|
1871
|
+
const isPathSeparator = (code)=>code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
1872
|
+
const depth = (token)=>{
|
|
1873
|
+
if (true !== token.isPrefix) token.depth = token.isGlobstar ? 1 / 0 : 1;
|
|
1874
|
+
};
|
|
1875
|
+
const scan = (input, options)=>{
|
|
1876
|
+
const opts = options || {};
|
|
1877
|
+
const length = input.length - 1;
|
|
1878
|
+
const scanToEnd = true === opts.parts || true === opts.scanToEnd;
|
|
1879
|
+
const slashes = [];
|
|
1880
|
+
const tokens = [];
|
|
1881
|
+
const parts = [];
|
|
1882
|
+
let str = input;
|
|
1883
|
+
let index = -1;
|
|
1884
|
+
let start = 0;
|
|
1885
|
+
let lastIndex = 0;
|
|
1886
|
+
let isBrace = false;
|
|
1887
|
+
let isBracket = false;
|
|
1888
|
+
let isGlob = false;
|
|
1889
|
+
let isExtglob = false;
|
|
1890
|
+
let isGlobstar = false;
|
|
1891
|
+
let braceEscaped = false;
|
|
1892
|
+
let backslashes = false;
|
|
1893
|
+
let negated = false;
|
|
1894
|
+
let negatedExtglob = false;
|
|
1895
|
+
let finished = false;
|
|
1896
|
+
let braces = 0;
|
|
1897
|
+
let prev;
|
|
1898
|
+
let code;
|
|
1899
|
+
let token = {
|
|
1900
|
+
value: '',
|
|
1901
|
+
depth: 0,
|
|
1902
|
+
isGlob: false
|
|
1903
|
+
};
|
|
1904
|
+
const eos = ()=>index >= length;
|
|
1905
|
+
const peek = ()=>str.charCodeAt(index + 1);
|
|
1906
|
+
const advance = ()=>{
|
|
1907
|
+
prev = code;
|
|
1908
|
+
return str.charCodeAt(++index);
|
|
1909
|
+
};
|
|
1910
|
+
while(index < length){
|
|
1911
|
+
code = advance();
|
|
1912
|
+
let next;
|
|
1913
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
1914
|
+
backslashes = token.backslashes = true;
|
|
1915
|
+
code = advance();
|
|
1916
|
+
if (code === CHAR_LEFT_CURLY_BRACE) braceEscaped = true;
|
|
1917
|
+
continue;
|
|
1918
|
+
}
|
|
1919
|
+
if (true === braceEscaped || code === CHAR_LEFT_CURLY_BRACE) {
|
|
1920
|
+
braces++;
|
|
1921
|
+
while(true !== eos() && (code = advance())){
|
|
1922
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
1923
|
+
backslashes = token.backslashes = true;
|
|
1924
|
+
advance();
|
|
1925
|
+
continue;
|
|
1926
|
+
}
|
|
1927
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
1928
|
+
braces++;
|
|
1929
|
+
continue;
|
|
1930
|
+
}
|
|
1931
|
+
if (true !== braceEscaped && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
|
1932
|
+
isBrace = token.isBrace = true;
|
|
1933
|
+
isGlob = token.isGlob = true;
|
|
1934
|
+
finished = true;
|
|
1935
|
+
if (true === scanToEnd) continue;
|
|
1936
|
+
break;
|
|
1937
|
+
}
|
|
1938
|
+
if (true !== braceEscaped && code === CHAR_COMMA) {
|
|
1939
|
+
isBrace = token.isBrace = true;
|
|
1940
|
+
isGlob = token.isGlob = true;
|
|
1941
|
+
finished = true;
|
|
1942
|
+
if (true === scanToEnd) continue;
|
|
1943
|
+
break;
|
|
1944
|
+
}
|
|
1945
|
+
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
|
1946
|
+
braces--;
|
|
1947
|
+
if (0 === braces) {
|
|
1948
|
+
braceEscaped = false;
|
|
1949
|
+
isBrace = token.isBrace = true;
|
|
1950
|
+
finished = true;
|
|
1951
|
+
break;
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
if (true === scanToEnd) continue;
|
|
1956
|
+
break;
|
|
1957
|
+
}
|
|
1958
|
+
if (code === CHAR_FORWARD_SLASH) {
|
|
1959
|
+
slashes.push(index);
|
|
1960
|
+
tokens.push(token);
|
|
1961
|
+
token = {
|
|
1962
|
+
value: '',
|
|
1963
|
+
depth: 0,
|
|
1964
|
+
isGlob: false
|
|
1965
|
+
};
|
|
1966
|
+
if (true === finished) continue;
|
|
1967
|
+
if (prev === CHAR_DOT && index === start + 1) {
|
|
1968
|
+
start += 2;
|
|
1969
|
+
continue;
|
|
1970
|
+
}
|
|
1971
|
+
lastIndex = index + 1;
|
|
1972
|
+
continue;
|
|
1973
|
+
}
|
|
1974
|
+
if (true !== opts.noext) {
|
|
1975
|
+
const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
|
|
1976
|
+
if (true === isExtglobChar && peek() === CHAR_LEFT_PARENTHESES) {
|
|
1977
|
+
isGlob = token.isGlob = true;
|
|
1978
|
+
isExtglob = token.isExtglob = true;
|
|
1979
|
+
finished = true;
|
|
1980
|
+
if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
|
|
1981
|
+
if (true === scanToEnd) {
|
|
1982
|
+
while(true !== eos() && (code = advance())){
|
|
1983
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
1984
|
+
backslashes = token.backslashes = true;
|
|
1985
|
+
code = advance();
|
|
1986
|
+
continue;
|
|
1987
|
+
}
|
|
1988
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
1989
|
+
isGlob = token.isGlob = true;
|
|
1990
|
+
finished = true;
|
|
1991
|
+
break;
|
|
1992
|
+
}
|
|
1993
|
+
}
|
|
1994
|
+
continue;
|
|
1995
|
+
}
|
|
1996
|
+
break;
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
if (code === CHAR_ASTERISK) {
|
|
2000
|
+
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
|
|
2001
|
+
isGlob = token.isGlob = true;
|
|
2002
|
+
finished = true;
|
|
2003
|
+
if (true === scanToEnd) continue;
|
|
2004
|
+
break;
|
|
2005
|
+
}
|
|
2006
|
+
if (code === CHAR_QUESTION_MARK) {
|
|
2007
|
+
isGlob = token.isGlob = true;
|
|
2008
|
+
finished = true;
|
|
2009
|
+
if (true === scanToEnd) continue;
|
|
2010
|
+
break;
|
|
2011
|
+
}
|
|
2012
|
+
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
2013
|
+
while(true !== eos() && (next = advance())){
|
|
2014
|
+
if (next === CHAR_BACKWARD_SLASH) {
|
|
2015
|
+
backslashes = token.backslashes = true;
|
|
2016
|
+
advance();
|
|
2017
|
+
continue;
|
|
2018
|
+
}
|
|
2019
|
+
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
2020
|
+
isBracket = token.isBracket = true;
|
|
2021
|
+
isGlob = token.isGlob = true;
|
|
2022
|
+
finished = true;
|
|
2023
|
+
break;
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
if (true === scanToEnd) continue;
|
|
2027
|
+
break;
|
|
2028
|
+
}
|
|
2029
|
+
if (true !== opts.nonegate && code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
2030
|
+
negated = token.negated = true;
|
|
2031
|
+
start++;
|
|
2032
|
+
continue;
|
|
2033
|
+
}
|
|
2034
|
+
if (true !== opts.noparen && code === CHAR_LEFT_PARENTHESES) {
|
|
2035
|
+
isGlob = token.isGlob = true;
|
|
2036
|
+
if (true === scanToEnd) {
|
|
2037
|
+
while(true !== eos() && (code = advance())){
|
|
2038
|
+
if (code === CHAR_LEFT_PARENTHESES) {
|
|
2039
|
+
backslashes = token.backslashes = true;
|
|
2040
|
+
code = advance();
|
|
2041
|
+
continue;
|
|
2042
|
+
}
|
|
2043
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
2044
|
+
finished = true;
|
|
2045
|
+
break;
|
|
2046
|
+
}
|
|
2047
|
+
}
|
|
2048
|
+
continue;
|
|
2049
|
+
}
|
|
2050
|
+
break;
|
|
2051
|
+
}
|
|
2052
|
+
if (true === isGlob) {
|
|
2053
|
+
finished = true;
|
|
2054
|
+
if (true === scanToEnd) continue;
|
|
2055
|
+
break;
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
2058
|
+
if (true === opts.noext) {
|
|
2059
|
+
isExtglob = false;
|
|
2060
|
+
isGlob = false;
|
|
2061
|
+
}
|
|
2062
|
+
let base = str;
|
|
2063
|
+
let prefix = '';
|
|
2064
|
+
let glob = '';
|
|
2065
|
+
if (start > 0) {
|
|
2066
|
+
prefix = str.slice(0, start);
|
|
2067
|
+
str = str.slice(start);
|
|
2068
|
+
lastIndex -= start;
|
|
2069
|
+
}
|
|
2070
|
+
if (base && true === isGlob && lastIndex > 0) {
|
|
2071
|
+
base = str.slice(0, lastIndex);
|
|
2072
|
+
glob = str.slice(lastIndex);
|
|
2073
|
+
} else if (true === isGlob) {
|
|
2074
|
+
base = '';
|
|
2075
|
+
glob = str;
|
|
2076
|
+
} else base = str;
|
|
2077
|
+
if (base && '' !== base && '/' !== base && base !== str) {
|
|
2078
|
+
if (isPathSeparator(base.charCodeAt(base.length - 1))) base = base.slice(0, -1);
|
|
2079
|
+
}
|
|
2080
|
+
if (true === opts.unescape) {
|
|
2081
|
+
if (glob) glob = utils.removeBackslashes(glob);
|
|
2082
|
+
if (base && true === backslashes) base = utils.removeBackslashes(base);
|
|
2083
|
+
}
|
|
2084
|
+
const state = {
|
|
2085
|
+
prefix,
|
|
2086
|
+
input,
|
|
2087
|
+
start,
|
|
2088
|
+
base,
|
|
2089
|
+
glob,
|
|
2090
|
+
isBrace,
|
|
2091
|
+
isBracket,
|
|
2092
|
+
isGlob,
|
|
2093
|
+
isExtglob,
|
|
2094
|
+
isGlobstar,
|
|
2095
|
+
negated,
|
|
2096
|
+
negatedExtglob
|
|
2097
|
+
};
|
|
2098
|
+
if (true === opts.tokens) {
|
|
2099
|
+
state.maxDepth = 0;
|
|
2100
|
+
if (!isPathSeparator(code)) tokens.push(token);
|
|
2101
|
+
state.tokens = tokens;
|
|
2102
|
+
}
|
|
2103
|
+
if (true === opts.parts || true === opts.tokens) {
|
|
2104
|
+
let prevIndex;
|
|
2105
|
+
for(let idx = 0; idx < slashes.length; idx++){
|
|
2106
|
+
const n = prevIndex ? prevIndex + 1 : start;
|
|
2107
|
+
const i = slashes[idx];
|
|
2108
|
+
const value = input.slice(n, i);
|
|
2109
|
+
if (opts.tokens) {
|
|
2110
|
+
if (0 === idx && 0 !== start) {
|
|
2111
|
+
tokens[idx].isPrefix = true;
|
|
2112
|
+
tokens[idx].value = prefix;
|
|
2113
|
+
} else tokens[idx].value = value;
|
|
2114
|
+
depth(tokens[idx]);
|
|
2115
|
+
state.maxDepth += tokens[idx].depth;
|
|
2116
|
+
}
|
|
2117
|
+
if (0 !== idx || '' !== value) parts.push(value);
|
|
2118
|
+
prevIndex = i;
|
|
2119
|
+
}
|
|
2120
|
+
if (prevIndex && prevIndex + 1 < input.length) {
|
|
2121
|
+
const value = input.slice(prevIndex + 1);
|
|
2122
|
+
parts.push(value);
|
|
2123
|
+
if (opts.tokens) {
|
|
2124
|
+
tokens[tokens.length - 1].value = value;
|
|
2125
|
+
depth(tokens[tokens.length - 1]);
|
|
2126
|
+
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
state.slashes = slashes;
|
|
2130
|
+
state.parts = parts;
|
|
2131
|
+
}
|
|
2132
|
+
return state;
|
|
2133
|
+
};
|
|
2134
|
+
module.exports = scan;
|
|
2135
|
+
},
|
|
2136
|
+
"../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/utils.js": function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2137
|
+
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/constants.js");
|
|
2138
|
+
exports.isObject = (val)=>null !== val && 'object' == typeof val && !Array.isArray(val);
|
|
2139
|
+
exports.hasRegexChars = (str)=>REGEX_SPECIAL_CHARS.test(str);
|
|
2140
|
+
exports.isRegexChar = (str)=>1 === str.length && exports.hasRegexChars(str);
|
|
2141
|
+
exports.escapeRegex = (str)=>str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
|
|
2142
|
+
exports.toPosixSlashes = (str)=>str.replace(REGEX_BACKSLASH, '/');
|
|
2143
|
+
exports.isWindows = ()=>{
|
|
2144
|
+
if ('undefined' != typeof navigator && navigator.platform) {
|
|
2145
|
+
const platform = navigator.platform.toLowerCase();
|
|
2146
|
+
return 'win32' === platform || 'windows' === platform;
|
|
2147
|
+
}
|
|
2148
|
+
if ('undefined' != typeof process && process.platform) return 'win32' === process.platform;
|
|
2149
|
+
return false;
|
|
2150
|
+
};
|
|
2151
|
+
exports.removeBackslashes = (str)=>str.replace(REGEX_REMOVE_BACKSLASH, (match)=>'\\' === match ? '' : match);
|
|
2152
|
+
exports.escapeLast = (input, char, lastIdx)=>{
|
|
2153
|
+
const idx = input.lastIndexOf(char, lastIdx);
|
|
2154
|
+
if (-1 === idx) return input;
|
|
2155
|
+
if ('\\' === input[idx - 1]) return exports.escapeLast(input, char, idx - 1);
|
|
2156
|
+
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
2157
|
+
};
|
|
2158
|
+
exports.removePrefix = (input, state = {})=>{
|
|
2159
|
+
let output = input;
|
|
2160
|
+
if (output.startsWith('./')) {
|
|
2161
|
+
output = output.slice(2);
|
|
2162
|
+
state.prefix = './';
|
|
2163
|
+
}
|
|
2164
|
+
return output;
|
|
2165
|
+
};
|
|
2166
|
+
exports.wrapOutput = (input, state = {}, options = {})=>{
|
|
2167
|
+
const prepend = options.contains ? '' : '^';
|
|
2168
|
+
const append = options.contains ? '' : '$';
|
|
2169
|
+
let output = `${prepend}(?:${input})${append}`;
|
|
2170
|
+
if (true === state.negated) output = `(?:^(?!${output}).*$)`;
|
|
2171
|
+
return output;
|
|
2172
|
+
};
|
|
2173
|
+
exports.basename = (path, { windows } = {})=>{
|
|
2174
|
+
const segs = path.split(windows ? /[\\/]/ : '/');
|
|
2175
|
+
const last = segs[segs.length - 1];
|
|
2176
|
+
if ('' === last) return segs[segs.length - 2];
|
|
2177
|
+
return last;
|
|
2178
|
+
};
|
|
2179
|
+
},
|
|
2180
|
+
"./src/config.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2181
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
2182
|
+
ME: ()=>loadConfig,
|
|
2183
|
+
hY: ()=>withDefaultConfig
|
|
2184
|
+
});
|
|
2185
|
+
var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("node:fs");
|
|
2186
|
+
var _rsbuild_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("@rsbuild/core");
|
|
2187
|
+
var pathe__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("pathe");
|
|
2188
|
+
var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./src/utils/index.ts");
|
|
2189
|
+
const findConfig = (basePath)=>_utils__WEBPACK_IMPORTED_MODULE_3__.Io.map((ext)=>basePath + ext).find(node_fs__WEBPACK_IMPORTED_MODULE_0__["default"].existsSync);
|
|
2190
|
+
const resolveConfigPath = (root, customConfig)=>{
|
|
2191
|
+
if (customConfig) {
|
|
2192
|
+
const customConfigPath = (0, pathe__WEBPACK_IMPORTED_MODULE_2__.isAbsolute)(customConfig) ? customConfig : (0, pathe__WEBPACK_IMPORTED_MODULE_2__.join)(root, customConfig);
|
|
2193
|
+
if (node_fs__WEBPACK_IMPORTED_MODULE_0__["default"].existsSync(customConfigPath)) return customConfigPath;
|
|
2194
|
+
_utils__WEBPACK_IMPORTED_MODULE_3__.kg.warn(`Cannot find config file: ${_utils__WEBPACK_IMPORTED_MODULE_3__.$_.dim(customConfigPath)}`);
|
|
2195
|
+
_utils__WEBPACK_IMPORTED_MODULE_3__.kg.log('');
|
|
2196
|
+
}
|
|
2197
|
+
const configFilePath = findConfig((0, pathe__WEBPACK_IMPORTED_MODULE_2__.join)(root, _utils__WEBPACK_IMPORTED_MODULE_3__.F7));
|
|
2198
|
+
if (configFilePath) return configFilePath;
|
|
2199
|
+
return null;
|
|
2200
|
+
};
|
|
2201
|
+
async function loadConfig({ cwd = process.cwd(), path, envMode, configLoader }) {
|
|
2202
|
+
const configFilePath = resolveConfigPath(cwd, path);
|
|
2203
|
+
if (!configFilePath) {
|
|
2204
|
+
_utils__WEBPACK_IMPORTED_MODULE_3__.kg.debug('no config file found');
|
|
2205
|
+
return {
|
|
2206
|
+
content: {},
|
|
2207
|
+
filePath: configFilePath
|
|
2208
|
+
};
|
|
2209
|
+
}
|
|
2210
|
+
const { content } = await (0, _rsbuild_core__WEBPACK_IMPORTED_MODULE_1__.loadConfig)({
|
|
2211
|
+
cwd: (0, pathe__WEBPACK_IMPORTED_MODULE_2__.dirname)(configFilePath),
|
|
2212
|
+
path: configFilePath,
|
|
2213
|
+
envMode,
|
|
2214
|
+
loader: configLoader
|
|
2215
|
+
});
|
|
2216
|
+
return {
|
|
2217
|
+
content: content,
|
|
2218
|
+
filePath: configFilePath
|
|
2219
|
+
};
|
|
2220
|
+
}
|
|
2221
|
+
const mergeRstestConfig = (...configs)=>(0, _rsbuild_core__WEBPACK_IMPORTED_MODULE_1__.mergeRsbuildConfig)(...configs);
|
|
2222
|
+
const createDefaultConfig = ()=>({
|
|
2223
|
+
root: process.cwd(),
|
|
2224
|
+
name: 'rstest',
|
|
2225
|
+
include: [
|
|
2226
|
+
'**/*.{test,spec}.?(c|m)[jt]s?(x)'
|
|
2227
|
+
],
|
|
2228
|
+
exclude: [
|
|
2229
|
+
'**/node_modules/**',
|
|
2230
|
+
'**/dist/**'
|
|
2231
|
+
],
|
|
2232
|
+
includeSource: [],
|
|
2233
|
+
pool: {
|
|
2234
|
+
type: 'forks'
|
|
2235
|
+
},
|
|
2236
|
+
isolate: true,
|
|
2237
|
+
globals: false,
|
|
2238
|
+
passWithNoTests: false,
|
|
2239
|
+
update: false,
|
|
2240
|
+
testTimeout: 5000,
|
|
2241
|
+
testEnvironment: 'node',
|
|
2242
|
+
retry: 0,
|
|
2243
|
+
reporters: [
|
|
2244
|
+
'default'
|
|
2245
|
+
],
|
|
2246
|
+
clearMocks: false,
|
|
2247
|
+
resetMocks: false,
|
|
2248
|
+
restoreMocks: false,
|
|
2249
|
+
slowTestThreshold: 300,
|
|
2250
|
+
unstubGlobals: false,
|
|
2251
|
+
unstubEnvs: false,
|
|
2252
|
+
maxConcurrency: 5,
|
|
2253
|
+
printConsoleTrace: false,
|
|
2254
|
+
disableConsoleIntercept: false
|
|
2255
|
+
});
|
|
2256
|
+
const withDefaultConfig = (config)=>{
|
|
2257
|
+
const merged = mergeRstestConfig(createDefaultConfig(), config);
|
|
2258
|
+
merged.include = config.include || merged.include;
|
|
2259
|
+
merged.exclude = (config.exclude || merged.exclude || []).concat([
|
|
2260
|
+
_utils__WEBPACK_IMPORTED_MODULE_3__.f1
|
|
2261
|
+
]);
|
|
2262
|
+
merged.reporters = config.reporters ?? merged.reporters;
|
|
2263
|
+
merged.pool = 'string' == typeof config.pool ? {
|
|
2264
|
+
type: config.pool
|
|
2265
|
+
} : merged.pool;
|
|
2266
|
+
return merged;
|
|
2267
|
+
};
|
|
2268
|
+
},
|
|
2269
|
+
"./src/utils/constants.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2270
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
2271
|
+
F7: ()=>DEFAULT_CONFIG_NAME,
|
|
2272
|
+
Io: ()=>DEFAULT_CONFIG_EXTENSIONS,
|
|
2273
|
+
Nk: ()=>TEMP_RSTEST_OUTPUT_DIR,
|
|
2274
|
+
Qd: ()=>TEST_DELIMITER,
|
|
2275
|
+
f1: ()=>TEMP_RSTEST_OUTPUT_DIR_GLOB
|
|
2276
|
+
});
|
|
2277
|
+
const DEFAULT_CONFIG_NAME = 'rstest.config';
|
|
2278
|
+
const TEST_DELIMITER = '>';
|
|
2279
|
+
const TEMP_RSTEST_OUTPUT_DIR = 'dist/.rstest-temp';
|
|
2280
|
+
const TEMP_RSTEST_OUTPUT_DIR_GLOB = '**/dist/.rstest-temp';
|
|
2281
|
+
const DEFAULT_CONFIG_EXTENSIONS = [
|
|
2282
|
+
'.js',
|
|
2283
|
+
'.ts',
|
|
2284
|
+
'.mjs',
|
|
2285
|
+
'.mts',
|
|
2286
|
+
'.cjs',
|
|
2287
|
+
'.cts'
|
|
2288
|
+
];
|
|
2289
|
+
},
|
|
2290
|
+
"./src/utils/helper.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2291
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
2292
|
+
$_: ()=>picocolors__WEBPACK_IMPORTED_MODULE_2___default.a,
|
|
2293
|
+
AS: ()=>prettyTime,
|
|
2294
|
+
H: ()=>parsePosix,
|
|
2295
|
+
XQ: ()=>castArray,
|
|
2296
|
+
Yz: ()=>getTaskNameWithPrefix,
|
|
2297
|
+
Z: ()=>formatError,
|
|
2298
|
+
ZY: ()=>getAbsolutePath,
|
|
2299
|
+
v8: ()=>serializableConfig
|
|
2300
|
+
});
|
|
2301
|
+
var pathe__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("pathe");
|
|
2302
|
+
var picocolors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
2303
|
+
var picocolors__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/ __webpack_require__.n(picocolors__WEBPACK_IMPORTED_MODULE_2__);
|
|
2304
|
+
var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./src/utils/constants.ts");
|
|
2305
|
+
function getAbsolutePath(base, filepath) {
|
|
2306
|
+
return (0, pathe__WEBPACK_IMPORTED_MODULE_0__.isAbsolute)(filepath) ? filepath : (0, pathe__WEBPACK_IMPORTED_MODULE_0__.join)(base, filepath);
|
|
2307
|
+
}
|
|
2308
|
+
const parsePosix = (filePath)=>{
|
|
2309
|
+
const { dir, base } = (0, pathe__WEBPACK_IMPORTED_MODULE_0__.parse)(filePath);
|
|
2310
|
+
return {
|
|
2311
|
+
dir: dir.split(pathe__WEBPACK_IMPORTED_MODULE_0__.sep).join('/'),
|
|
2312
|
+
base
|
|
2313
|
+
};
|
|
2314
|
+
};
|
|
2315
|
+
const castArray = (arr)=>{
|
|
2316
|
+
if (void 0 === arr) return [];
|
|
2317
|
+
return Array.isArray(arr) ? arr : [
|
|
2318
|
+
arr
|
|
2319
|
+
];
|
|
2320
|
+
};
|
|
2321
|
+
const isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && Object.getPrototypeOf(obj) === Object.prototype;
|
|
2322
|
+
function formatError(error) {
|
|
2323
|
+
if ('string' == typeof error || error instanceof Error) return error;
|
|
2324
|
+
if (isPlainObject(error) && error.message) {
|
|
2325
|
+
const e = new Error(error.name || 'unknown error');
|
|
2326
|
+
e.message = error.message;
|
|
2327
|
+
e.stack = error.stack;
|
|
2328
|
+
return e;
|
|
2329
|
+
}
|
|
2330
|
+
return String(error);
|
|
2331
|
+
}
|
|
2332
|
+
const prettyTime = (milliseconds, shouldFormat = true)=>{
|
|
2333
|
+
const format = (time)=>shouldFormat ? picocolors__WEBPACK_IMPORTED_MODULE_2___default().bold(time) : time;
|
|
2334
|
+
const indent = shouldFormat ? ' ' : '';
|
|
2335
|
+
if (milliseconds < 1000) return `${Math.round(milliseconds)}${indent}ms`;
|
|
2336
|
+
const seconds = milliseconds / 1000;
|
|
2337
|
+
if (seconds < 10) {
|
|
2338
|
+
const digits = seconds >= 0.01 ? 2 : 3;
|
|
2339
|
+
return `${format(seconds.toFixed(digits))}${indent}s`;
|
|
2340
|
+
}
|
|
2341
|
+
if (seconds < 60) return `${format(seconds.toFixed(1))}${indent}s`;
|
|
2342
|
+
const minutes = seconds / 60;
|
|
2343
|
+
return `${format(minutes.toFixed(2))}${indent}m`;
|
|
2344
|
+
};
|
|
2345
|
+
const getTaskNames = (test)=>(test.parentNames || []).concat(test.name).filter(Boolean);
|
|
2346
|
+
const getTaskNameWithPrefix = (test, delimiter = _constants__WEBPACK_IMPORTED_MODULE_1__.Qd)=>getTaskNames(test).join(` ${delimiter} `);
|
|
2347
|
+
const REGEXP_FLAG_PREFIX = 'RSTEST_REGEXP:';
|
|
2348
|
+
const wrapRegex = (value)=>`${REGEXP_FLAG_PREFIX}${value.toString()}`;
|
|
2349
|
+
const serializableConfig = (normalizedConfig)=>{
|
|
2350
|
+
const { testNamePattern } = normalizedConfig;
|
|
2351
|
+
return {
|
|
2352
|
+
...normalizedConfig,
|
|
2353
|
+
testNamePattern: testNamePattern && 'string' != typeof testNamePattern ? wrapRegex(testNamePattern) : testNamePattern
|
|
2354
|
+
};
|
|
2355
|
+
};
|
|
2356
|
+
},
|
|
2357
|
+
"./src/utils/index.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2358
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
2359
|
+
F7: ()=>constants.F7,
|
|
2360
|
+
GL: ()=>getTestEntries,
|
|
2361
|
+
aj: ()=>prettyTestPath,
|
|
2362
|
+
aA: ()=>getSetupFiles,
|
|
2363
|
+
kg: ()=>logger.k,
|
|
2364
|
+
Io: ()=>constants.Io,
|
|
2365
|
+
Ps: ()=>formatTestPath,
|
|
2366
|
+
XQ: ()=>helper.XQ,
|
|
2367
|
+
$_: ()=>helper.$_,
|
|
2368
|
+
Nk: ()=>constants.Nk,
|
|
2369
|
+
Yz: ()=>helper.Yz,
|
|
2370
|
+
L1: ()=>logger.L,
|
|
2371
|
+
v8: ()=>helper.v8,
|
|
2372
|
+
Qd: ()=>constants.Qd,
|
|
2373
|
+
f1: ()=>constants.f1,
|
|
2374
|
+
AS: ()=>helper.AS
|
|
2375
|
+
});
|
|
2376
|
+
var helper = __webpack_require__("./src/utils/helper.ts");
|
|
2377
|
+
var logger = __webpack_require__("./src/utils/logger.ts");
|
|
2378
|
+
var promises_ = __webpack_require__("node:fs/promises");
|
|
2379
|
+
var external_pathe_ = __webpack_require__("pathe");
|
|
2380
|
+
var dist = __webpack_require__("../../node_modules/.pnpm/tinyglobby@0.2.14/node_modules/tinyglobby/dist/index.mjs");
|
|
2381
|
+
const filterFiles = (testFiles, filters, dir)=>{
|
|
2382
|
+
if (!filters.length) return testFiles;
|
|
2383
|
+
const fileFilters = 'win32' === process.platform ? filters.map((f)=>f.split(external_pathe_["default"].sep).join('/')) : filters;
|
|
2384
|
+
return testFiles.filter((t)=>{
|
|
2385
|
+
const testFile = external_pathe_["default"].relative(dir, t).toLocaleLowerCase();
|
|
2386
|
+
return fileFilters.some((f)=>{
|
|
2387
|
+
if (external_pathe_["default"].isAbsolute(f) && t.startsWith(f)) return true;
|
|
2388
|
+
const relativePath = f.endsWith('/') ? external_pathe_["default"].join(external_pathe_["default"].relative(dir, f), '/') : external_pathe_["default"].relative(dir, f);
|
|
2389
|
+
return testFile.includes(f.toLocaleLowerCase()) || testFile.includes(relativePath.toLocaleLowerCase());
|
|
2390
|
+
});
|
|
2391
|
+
});
|
|
2392
|
+
};
|
|
2393
|
+
const hasInSourceTestCode = (code)=>code.includes('import.meta.rstest');
|
|
2394
|
+
const getTestEntries = async ({ include, exclude, root, fileFilters, includeSource })=>{
|
|
2395
|
+
const testFiles = await (0, dist.zA)(include, {
|
|
2396
|
+
cwd: root,
|
|
2397
|
+
absolute: true,
|
|
2398
|
+
ignore: exclude,
|
|
2399
|
+
dot: true,
|
|
2400
|
+
expandDirectories: false
|
|
2401
|
+
});
|
|
2402
|
+
if (includeSource?.length) {
|
|
2403
|
+
const sourceFiles = await (0, dist.zA)(includeSource, {
|
|
2404
|
+
cwd: root,
|
|
2405
|
+
absolute: true,
|
|
2406
|
+
ignore: exclude,
|
|
2407
|
+
dot: true,
|
|
2408
|
+
expandDirectories: false
|
|
2409
|
+
});
|
|
2410
|
+
await Promise.all(sourceFiles.map(async (file)=>{
|
|
2411
|
+
try {
|
|
2412
|
+
const code = await promises_["default"].readFile(file, 'utf-8');
|
|
2413
|
+
if (hasInSourceTestCode(code)) testFiles.push(file);
|
|
2414
|
+
} catch {
|
|
2415
|
+
return;
|
|
2416
|
+
}
|
|
2417
|
+
}));
|
|
2418
|
+
}
|
|
2419
|
+
return Object.fromEntries(filterFiles(testFiles, fileFilters, root).map((entry)=>{
|
|
2420
|
+
const name = external_pathe_["default"].relative(root, entry);
|
|
2421
|
+
return [
|
|
2422
|
+
name,
|
|
2423
|
+
entry
|
|
2424
|
+
];
|
|
2425
|
+
}));
|
|
2426
|
+
};
|
|
2427
|
+
const getSetupFiles = (setups, rootPath)=>Object.fromEntries((0, helper.XQ)(setups).map((setupFile)=>{
|
|
2428
|
+
const setupFilePath = (0, helper.ZY)(rootPath, setupFile);
|
|
2429
|
+
const name = external_pathe_["default"].relative(rootPath, setupFilePath);
|
|
2430
|
+
return [
|
|
2431
|
+
name,
|
|
2432
|
+
setupFilePath
|
|
2433
|
+
];
|
|
2434
|
+
}));
|
|
2435
|
+
const prettyTestPath = (testPath)=>{
|
|
2436
|
+
const { dir, base } = (0, helper.H)(testPath);
|
|
2437
|
+
return `${'.' !== dir ? helper.$_.gray(`${dir}/`) : ''}${helper.$_.cyan(base)}`;
|
|
2438
|
+
};
|
|
2439
|
+
const formatTestPath = (root, testFilePath)=>{
|
|
2440
|
+
let testPath = testFilePath;
|
|
2441
|
+
if (external_pathe_["default"].isAbsolute(testPath) && testPath.includes(root)) testPath = external_pathe_["default"].relative(root, testPath);
|
|
2442
|
+
return prettyTestPath(testPath);
|
|
2443
|
+
};
|
|
2444
|
+
var constants = __webpack_require__("./src/utils/constants.ts");
|
|
2445
|
+
},
|
|
2446
|
+
"./src/utils/logger.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2447
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
2448
|
+
L: ()=>isDebug,
|
|
2449
|
+
k: ()=>logger
|
|
2450
|
+
});
|
|
2451
|
+
var external_os_ = __webpack_require__("os");
|
|
2452
|
+
var external_tty_ = __webpack_require__("tty");
|
|
2453
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : external_process_default.argv) {
|
|
2454
|
+
const prefix = flag.startsWith("-") ? "" : 1 === flag.length ? "-" : "--";
|
|
2455
|
+
const position = argv.indexOf(prefix + flag);
|
|
2456
|
+
const terminatorPosition = argv.indexOf("--");
|
|
2457
|
+
return -1 !== position && (-1 === terminatorPosition || position < terminatorPosition);
|
|
2458
|
+
}
|
|
2459
|
+
var { env } = external_process_default;
|
|
2460
|
+
var flagForceColor;
|
|
2461
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) flagForceColor = 0;
|
|
2462
|
+
else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) flagForceColor = 1;
|
|
2463
|
+
function envForceColor() {
|
|
2464
|
+
if ("FORCE_COLOR" in env) {
|
|
2465
|
+
if ("true" === env.FORCE_COLOR) return 1;
|
|
2466
|
+
if ("false" === env.FORCE_COLOR) return 0;
|
|
2467
|
+
return 0 === env.FORCE_COLOR.length ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
function translateLevel(level) {
|
|
2471
|
+
if (0 === level) return false;
|
|
2472
|
+
return {
|
|
2473
|
+
level,
|
|
2474
|
+
hasBasic: true,
|
|
2475
|
+
has256: level >= 2,
|
|
2476
|
+
has16m: level >= 3
|
|
2477
|
+
};
|
|
2478
|
+
}
|
|
2479
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
2480
|
+
const noFlagForceColor = envForceColor();
|
|
2481
|
+
if (void 0 !== noFlagForceColor) flagForceColor = noFlagForceColor;
|
|
2482
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
2483
|
+
if (0 === forceColor) return 0;
|
|
2484
|
+
if (sniffFlags) {
|
|
2485
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
|
|
2486
|
+
if (hasFlag("color=256")) return 2;
|
|
2487
|
+
}
|
|
2488
|
+
if ("TF_BUILD" in env && "AGENT_NAME" in env) return 1;
|
|
2489
|
+
if (haveStream && !streamIsTTY && void 0 === forceColor) return 0;
|
|
2490
|
+
const min = forceColor || 0;
|
|
2491
|
+
if ("dumb" === env.TERM) return min;
|
|
2492
|
+
if ("win32" === external_process_default.platform) {
|
|
2493
|
+
const osRelease = external_os_["default"].release().split(".");
|
|
2494
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
2495
|
+
return 1;
|
|
2496
|
+
}
|
|
2497
|
+
if ("CI" in env) {
|
|
2498
|
+
if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) return 3;
|
|
2499
|
+
if ([
|
|
2500
|
+
"TRAVIS",
|
|
2501
|
+
"CIRCLECI",
|
|
2502
|
+
"APPVEYOR",
|
|
2503
|
+
"GITLAB_CI",
|
|
2504
|
+
"BUILDKITE",
|
|
2505
|
+
"DRONE"
|
|
2506
|
+
].some((sign)=>sign in env) || "codeship" === env.CI_NAME) return 1;
|
|
2507
|
+
return min;
|
|
2508
|
+
}
|
|
2509
|
+
if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
2510
|
+
if ("truecolor" === env.COLORTERM) return 3;
|
|
2511
|
+
if ("xterm-kitty" === env.TERM) return 3;
|
|
2512
|
+
if ("TERM_PROGRAM" in env) {
|
|
2513
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
2514
|
+
switch(env.TERM_PROGRAM){
|
|
2515
|
+
case "iTerm.app":
|
|
2516
|
+
return version >= 3 ? 3 : 2;
|
|
2517
|
+
case "Apple_Terminal":
|
|
2518
|
+
return 2;
|
|
2519
|
+
}
|
|
2520
|
+
}
|
|
2521
|
+
if (/-256(color)?$/i.test(env.TERM)) return 2;
|
|
2522
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
|
|
2523
|
+
if ("COLORTERM" in env) return 1;
|
|
2524
|
+
return min;
|
|
2525
|
+
}
|
|
2526
|
+
function createSupportsColor(stream, options = {}) {
|
|
2527
|
+
const level = _supportsColor(stream, {
|
|
2528
|
+
streamIsTTY: stream && stream.isTTY,
|
|
2529
|
+
...options
|
|
2530
|
+
});
|
|
2531
|
+
return translateLevel(level);
|
|
2532
|
+
}
|
|
2533
|
+
var supportsColor = {
|
|
2534
|
+
stdout: createSupportsColor({
|
|
2535
|
+
isTTY: external_tty_["default"].isatty(1)
|
|
2536
|
+
}),
|
|
2537
|
+
stderr: createSupportsColor({
|
|
2538
|
+
isTTY: external_tty_["default"].isatty(2)
|
|
2539
|
+
})
|
|
2540
|
+
};
|
|
2541
|
+
var supports_color_default = supportsColor;
|
|
2542
|
+
var colorLevel = supports_color_default.stdout ? supports_color_default.stdout.level : 0;
|
|
2543
|
+
var errorStackRegExp = /at\s.*:\d+:\d+[\s\)]*$/;
|
|
2544
|
+
var anonymousErrorStackRegExp = /at\s.*\(<anonymous>\)$/;
|
|
2545
|
+
var isErrorStackMessage = (message)=>errorStackRegExp.test(message) || anonymousErrorStackRegExp.test(message);
|
|
2546
|
+
var formatter = (open, close, replace = open)=>colorLevel >= 2 ? (input)=>{
|
|
2547
|
+
let string = "" + input;
|
|
2548
|
+
let index = string.indexOf(close, open.length);
|
|
2549
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
2550
|
+
} : String;
|
|
2551
|
+
var replaceClose = (string, close, replace, index)=>{
|
|
2552
|
+
let start = string.substring(0, index) + replace;
|
|
2553
|
+
let end = string.substring(index + close.length);
|
|
2554
|
+
let nextIndex = end.indexOf(close);
|
|
2555
|
+
return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end;
|
|
2556
|
+
};
|
|
2557
|
+
var bold = formatter("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m");
|
|
2558
|
+
var red = formatter("\x1B[31m", "\x1B[39m");
|
|
2559
|
+
var green = formatter("\x1B[32m", "\x1B[39m");
|
|
2560
|
+
var yellow = formatter("\x1B[33m", "\x1B[39m");
|
|
2561
|
+
var magenta = formatter("\x1B[35m", "\x1B[39m");
|
|
2562
|
+
var cyan = formatter("\x1B[36m", "\x1B[39m");
|
|
2563
|
+
var gray = formatter("\x1B[90m", "\x1B[39m");
|
|
2564
|
+
var startColor = [
|
|
2565
|
+
189,
|
|
2566
|
+
255,
|
|
2567
|
+
243
|
|
2568
|
+
];
|
|
2569
|
+
var endColor = [
|
|
2570
|
+
74,
|
|
2571
|
+
194,
|
|
2572
|
+
154
|
|
2573
|
+
];
|
|
2574
|
+
var isWord = (char)=>!/[\s\n]/.test(char);
|
|
2575
|
+
var gradient = (message)=>{
|
|
2576
|
+
if (colorLevel < 3) return 2 === colorLevel ? bold(cyan(message)) : message;
|
|
2577
|
+
let chars = [
|
|
2578
|
+
...message
|
|
2579
|
+
];
|
|
2580
|
+
let steps = chars.filter(isWord).length;
|
|
2581
|
+
let r = startColor[0];
|
|
2582
|
+
let g = startColor[1];
|
|
2583
|
+
let b = startColor[2];
|
|
2584
|
+
let rStep = (endColor[0] - r) / steps;
|
|
2585
|
+
let gStep = (endColor[1] - g) / steps;
|
|
2586
|
+
let bStep = (endColor[2] - b) / steps;
|
|
2587
|
+
let output = "";
|
|
2588
|
+
for (let char of chars){
|
|
2589
|
+
if (isWord(char)) {
|
|
2590
|
+
r += rStep;
|
|
2591
|
+
g += gStep;
|
|
2592
|
+
b += bStep;
|
|
2593
|
+
}
|
|
2594
|
+
output += `\x1B[38;2;${Math.round(r)};${Math.round(g)};${Math.round(b)}m${char}\x1B[39m`;
|
|
2595
|
+
}
|
|
2596
|
+
return bold(output);
|
|
2597
|
+
};
|
|
2598
|
+
var LOG_LEVEL = {
|
|
2599
|
+
error: 0,
|
|
2600
|
+
warn: 1,
|
|
2601
|
+
info: 2,
|
|
2602
|
+
log: 3,
|
|
2603
|
+
verbose: 4
|
|
2604
|
+
};
|
|
2605
|
+
var LOG_TYPES = {
|
|
2606
|
+
error: {
|
|
2607
|
+
label: "error",
|
|
2608
|
+
level: "error",
|
|
2609
|
+
color: red
|
|
2610
|
+
},
|
|
2611
|
+
warn: {
|
|
2612
|
+
label: "warn",
|
|
2613
|
+
level: "warn",
|
|
2614
|
+
color: yellow
|
|
2615
|
+
},
|
|
2616
|
+
info: {
|
|
2617
|
+
label: "info",
|
|
2618
|
+
level: "info",
|
|
2619
|
+
color: cyan
|
|
2620
|
+
},
|
|
2621
|
+
start: {
|
|
2622
|
+
label: "start",
|
|
2623
|
+
level: "info",
|
|
2624
|
+
color: cyan
|
|
2625
|
+
},
|
|
2626
|
+
ready: {
|
|
2627
|
+
label: "ready",
|
|
2628
|
+
level: "info",
|
|
2629
|
+
color: green
|
|
2630
|
+
},
|
|
2631
|
+
success: {
|
|
2632
|
+
label: "success",
|
|
2633
|
+
level: "info",
|
|
2634
|
+
color: green
|
|
2635
|
+
},
|
|
2636
|
+
log: {
|
|
2637
|
+
level: "log"
|
|
2638
|
+
},
|
|
2639
|
+
debug: {
|
|
2640
|
+
label: "debug",
|
|
2641
|
+
level: "verbose",
|
|
2642
|
+
color: magenta
|
|
2643
|
+
}
|
|
2644
|
+
};
|
|
2645
|
+
var createLogger = (options = {})=>{
|
|
2646
|
+
let maxLevel = options.level || "log";
|
|
2647
|
+
let log = (type, message, ...args)=>{
|
|
2648
|
+
if (LOG_LEVEL[LOG_TYPES[type].level] > LOG_LEVEL[maxLevel]) return;
|
|
2649
|
+
if (null == message) return console.log();
|
|
2650
|
+
let logType = LOG_TYPES[type];
|
|
2651
|
+
let label = "";
|
|
2652
|
+
let text = "";
|
|
2653
|
+
if ("label" in logType) {
|
|
2654
|
+
label = (logType.label || "").padEnd(7);
|
|
2655
|
+
label = bold(logType.color ? logType.color(label) : label);
|
|
2656
|
+
}
|
|
2657
|
+
if (message instanceof Error) if (message.stack) {
|
|
2658
|
+
let [name, ...rest] = message.stack.split("\n");
|
|
2659
|
+
if (name.startsWith("Error: ")) name = name.slice(7);
|
|
2660
|
+
text = `${name}
|
|
2661
|
+
${gray(rest.join("\n"))}`;
|
|
2662
|
+
} else text = message.message;
|
|
2663
|
+
else if ("error" === logType.level && "string" == typeof message) {
|
|
2664
|
+
let lines = message.split("\n");
|
|
2665
|
+
text = lines.map((line)=>isErrorStackMessage(line) ? gray(line) : line).join("\n");
|
|
2666
|
+
} else text = `${message}`;
|
|
2667
|
+
console.log(label.length ? `${label} ${text}` : text, ...args);
|
|
2668
|
+
};
|
|
2669
|
+
let logger2 = {
|
|
2670
|
+
greet: (message)=>log("log", gradient(message))
|
|
2671
|
+
};
|
|
2672
|
+
Object.keys(LOG_TYPES).forEach((key)=>{
|
|
2673
|
+
logger2[key] = (...args)=>log(key, ...args);
|
|
2674
|
+
});
|
|
2675
|
+
Object.defineProperty(logger2, "level", {
|
|
2676
|
+
get: ()=>maxLevel,
|
|
2677
|
+
set (val) {
|
|
2678
|
+
maxLevel = val;
|
|
2679
|
+
}
|
|
2680
|
+
});
|
|
2681
|
+
logger2.override = (customLogger)=>{
|
|
2682
|
+
Object.assign(logger2, customLogger);
|
|
2683
|
+
};
|
|
2684
|
+
return logger2;
|
|
2685
|
+
};
|
|
2686
|
+
var logger = createLogger();
|
|
2687
|
+
var helper = __webpack_require__("./src/utils/helper.ts");
|
|
2688
|
+
const isDebug = ()=>{
|
|
2689
|
+
if (!process.env.DEBUG) return false;
|
|
2690
|
+
const values = process.env.DEBUG.toLocaleLowerCase().split(',');
|
|
2691
|
+
return [
|
|
2692
|
+
'rstest',
|
|
2693
|
+
'rsbuild',
|
|
2694
|
+
'builder',
|
|
2695
|
+
'*'
|
|
2696
|
+
].some((key)=>values.includes(key));
|
|
2697
|
+
};
|
|
2698
|
+
if (isDebug()) logger.level = 'verbose';
|
|
2699
|
+
function getTime() {
|
|
2700
|
+
const now = new Date();
|
|
2701
|
+
const hours = String(now.getHours()).padStart(2, '0');
|
|
2702
|
+
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
2703
|
+
const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
2704
|
+
return `${hours}:${minutes}:${seconds}`;
|
|
2705
|
+
}
|
|
2706
|
+
logger.override({
|
|
2707
|
+
debug: (message, ...args)=>{
|
|
2708
|
+
if ('verbose' !== logger.level) return;
|
|
2709
|
+
const time = helper.$_.gray(`${getTime()}`);
|
|
2710
|
+
console.log(` ${helper.$_.magenta('rstest')} ${time} ${message}`, ...args);
|
|
2711
|
+
}
|
|
2712
|
+
});
|
|
2713
|
+
},
|
|
2714
|
+
"@rsbuild/core": function(module) {
|
|
2715
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__;
|
|
2716
|
+
},
|
|
2717
|
+
"@vitest/snapshot/manager": function(module) {
|
|
2718
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__vitest_snapshot_manager_ed2bcef6__;
|
|
2719
|
+
},
|
|
2720
|
+
birpc: function(module) {
|
|
2721
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_birpc__;
|
|
2722
|
+
},
|
|
2723
|
+
fs: function(module) {
|
|
2724
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_fs__;
|
|
2725
|
+
},
|
|
2726
|
+
"node:events": function(module) {
|
|
2727
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_events_0a6aefe7__;
|
|
2728
|
+
},
|
|
2729
|
+
"node:fs": function(module) {
|
|
2730
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__;
|
|
2731
|
+
},
|
|
2732
|
+
"node:fs/promises": function(module) {
|
|
2733
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__;
|
|
2734
|
+
},
|
|
2735
|
+
"node:os": function(module) {
|
|
2736
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__;
|
|
2737
|
+
},
|
|
2738
|
+
"node:path": function(module) {
|
|
2739
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__;
|
|
2740
|
+
},
|
|
2741
|
+
"node:url": function(module) {
|
|
2742
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__;
|
|
2743
|
+
},
|
|
2744
|
+
"node:util": function(module) {
|
|
2745
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_util_1b29d436__;
|
|
2746
|
+
},
|
|
2747
|
+
"node:v8": function(module) {
|
|
2748
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_v8_d0df5498__;
|
|
2749
|
+
},
|
|
2750
|
+
os: function(module) {
|
|
2751
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_os__;
|
|
2752
|
+
},
|
|
2753
|
+
path: function(module) {
|
|
2754
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_path__;
|
|
2755
|
+
},
|
|
2756
|
+
pathe: function(module) {
|
|
2757
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_pathe__;
|
|
2758
|
+
},
|
|
2759
|
+
"std-env": function(module) {
|
|
2760
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_std_env_1c7b8267__;
|
|
2761
|
+
},
|
|
2762
|
+
tinypool: function(module) {
|
|
2763
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_tinypool__;
|
|
2764
|
+
},
|
|
2765
|
+
tty: function(module) {
|
|
2766
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_tty__;
|
|
2767
|
+
},
|
|
2768
|
+
"../../node_modules/.pnpm/tinyglobby@0.2.14/node_modules/tinyglobby/dist/index.mjs": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
2769
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
2770
|
+
zA: ()=>glob
|
|
2771
|
+
});
|
|
2772
|
+
var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("path");
|
|
2773
|
+
var fdir__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/index.js");
|
|
2774
|
+
var picomatch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/index.js");
|
|
2775
|
+
const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
|
|
2776
|
+
function getPartialMatcher(patterns, options) {
|
|
2777
|
+
const patternsCount = patterns.length;
|
|
2778
|
+
const patternsParts = Array(patternsCount);
|
|
2779
|
+
const regexes = Array(patternsCount);
|
|
2780
|
+
for(let i = 0; i < patternsCount; i++){
|
|
2781
|
+
const parts = splitPattern(patterns[i]);
|
|
2782
|
+
patternsParts[i] = parts;
|
|
2783
|
+
const partsCount = parts.length;
|
|
2784
|
+
const partRegexes = Array(partsCount);
|
|
2785
|
+
for(let j = 0; j < partsCount; j++)partRegexes[j] = picomatch__WEBPACK_IMPORTED_MODULE_2__.makeRe(parts[j], options);
|
|
2786
|
+
regexes[i] = partRegexes;
|
|
2787
|
+
}
|
|
2788
|
+
return (input)=>{
|
|
2789
|
+
const inputParts = input.split("/");
|
|
2790
|
+
if (".." === inputParts[0] && ONLY_PARENT_DIRECTORIES.test(input)) return true;
|
|
2791
|
+
for(let i = 0; i < patterns.length; i++){
|
|
2792
|
+
const patternParts = patternsParts[i];
|
|
2793
|
+
const regex = regexes[i];
|
|
2794
|
+
const inputPatternCount = inputParts.length;
|
|
2795
|
+
const minParts = Math.min(inputPatternCount, patternParts.length);
|
|
2796
|
+
let j = 0;
|
|
2797
|
+
while(j < minParts){
|
|
2798
|
+
const part = patternParts[j];
|
|
2799
|
+
if (part.includes("/")) return true;
|
|
2800
|
+
const match = regex[j].test(inputParts[j]);
|
|
2801
|
+
if (!match) break;
|
|
2802
|
+
if ("**" === part) return true;
|
|
2803
|
+
j++;
|
|
2804
|
+
}
|
|
2805
|
+
if (j === inputPatternCount) return true;
|
|
2806
|
+
}
|
|
2807
|
+
return false;
|
|
2808
|
+
};
|
|
2809
|
+
}
|
|
2810
|
+
const splitPatternOptions = {
|
|
2811
|
+
parts: true
|
|
2812
|
+
};
|
|
2813
|
+
function splitPattern(path$1) {
|
|
2814
|
+
var _result$parts;
|
|
2815
|
+
const result = picomatch__WEBPACK_IMPORTED_MODULE_2__.scan(path$1, splitPatternOptions);
|
|
2816
|
+
return (null == (_result$parts = result.parts) ? void 0 : _result$parts.length) ? result.parts : [
|
|
2817
|
+
path$1
|
|
2818
|
+
];
|
|
2819
|
+
}
|
|
2820
|
+
const isWin = "win32" === process.platform;
|
|
2821
|
+
const POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
|
|
2822
|
+
const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
|
|
2823
|
+
const escapePosixPath = (path$1)=>path$1.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
2824
|
+
const escapeWin32Path = (path$1)=>path$1.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
2825
|
+
const escapePath = isWin ? escapeWin32Path : escapePosixPath;
|
|
2826
|
+
function isDynamicPattern(pattern, options) {
|
|
2827
|
+
if ((null == options ? void 0 : options.caseSensitiveMatch) === false) return true;
|
|
2828
|
+
const scan = picomatch__WEBPACK_IMPORTED_MODULE_2__.scan(pattern);
|
|
2829
|
+
return scan.isGlob || scan.negated;
|
|
2830
|
+
}
|
|
2831
|
+
function log(...tasks) {
|
|
2832
|
+
console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`, ...tasks);
|
|
2833
|
+
}
|
|
2834
|
+
const PARENT_DIRECTORY = /^(\/?\.\.)+/;
|
|
2835
|
+
const ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
|
|
2836
|
+
const BACKSLASHES = /\\/g;
|
|
2837
|
+
function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
|
|
2838
|
+
let result = pattern;
|
|
2839
|
+
if (pattern.endsWith("/")) result = pattern.slice(0, -1);
|
|
2840
|
+
if (!result.endsWith("*") && expandDirectories) result += "/**";
|
|
2841
|
+
const escapedCwd = escapePath(cwd);
|
|
2842
|
+
result = path__WEBPACK_IMPORTED_MODULE_0__["default"].isAbsolute(result.replace(ESCAPING_BACKSLASHES, "")) ? path__WEBPACK_IMPORTED_MODULE_0__.posix.relative(escapedCwd, result) : path__WEBPACK_IMPORTED_MODULE_0__.posix.normalize(result);
|
|
2843
|
+
const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
|
|
2844
|
+
const parts = splitPattern(result);
|
|
2845
|
+
if (null == parentDirectoryMatch ? void 0 : parentDirectoryMatch[0]) {
|
|
2846
|
+
const n = (parentDirectoryMatch[0].length + 1) / 3;
|
|
2847
|
+
let i = 0;
|
|
2848
|
+
const cwdParts = escapedCwd.split("/");
|
|
2849
|
+
while(i < n && parts[i + n] === cwdParts[cwdParts.length + i - n]){
|
|
2850
|
+
result = result.slice(0, (n - i - 1) * 3) + result.slice((n - i) * 3 + parts[i + n].length + 1) || ".";
|
|
2851
|
+
i++;
|
|
2852
|
+
}
|
|
2853
|
+
const potentialRoot = path__WEBPACK_IMPORTED_MODULE_0__.posix.join(cwd, parentDirectoryMatch[0].slice(3 * i));
|
|
2854
|
+
if (!potentialRoot.startsWith(".") && props.root.length > potentialRoot.length) {
|
|
2855
|
+
props.root = potentialRoot;
|
|
2856
|
+
props.depthOffset = -n + i;
|
|
2857
|
+
}
|
|
2858
|
+
}
|
|
2859
|
+
if (!isIgnore && props.depthOffset >= 0) {
|
|
2860
|
+
var _props$commonPath;
|
|
2861
|
+
null != props.commonPath || (props.commonPath = parts);
|
|
2862
|
+
const newCommonPath = [];
|
|
2863
|
+
const length = Math.min(props.commonPath.length, parts.length);
|
|
2864
|
+
for(let i = 0; i < length; i++){
|
|
2865
|
+
const part = parts[i];
|
|
2866
|
+
if ("**" === part && !parts[i + 1]) {
|
|
2867
|
+
newCommonPath.pop();
|
|
2868
|
+
break;
|
|
2869
|
+
}
|
|
2870
|
+
if (part !== props.commonPath[i] || isDynamicPattern(part) || i === parts.length - 1) break;
|
|
2871
|
+
newCommonPath.push(part);
|
|
2872
|
+
}
|
|
2873
|
+
props.depthOffset = newCommonPath.length;
|
|
2874
|
+
props.commonPath = newCommonPath;
|
|
2875
|
+
props.root = newCommonPath.length > 0 ? path__WEBPACK_IMPORTED_MODULE_0__["default"].posix.join(cwd, ...newCommonPath) : cwd;
|
|
2876
|
+
}
|
|
2877
|
+
return result;
|
|
2878
|
+
}
|
|
2879
|
+
function processPatterns({ patterns, ignore = [], expandDirectories = true }, cwd, props) {
|
|
2880
|
+
if ("string" == typeof patterns) patterns = [
|
|
2881
|
+
patterns
|
|
2882
|
+
];
|
|
2883
|
+
else if (!patterns) patterns = [
|
|
2884
|
+
"**/*"
|
|
2885
|
+
];
|
|
2886
|
+
if ("string" == typeof ignore) ignore = [
|
|
2887
|
+
ignore
|
|
2888
|
+
];
|
|
2889
|
+
const matchPatterns = [];
|
|
2890
|
+
const ignorePatterns = [];
|
|
2891
|
+
for (const pattern of ignore)if (pattern) {
|
|
2892
|
+
if ("!" !== pattern[0] || "(" === pattern[1]) ignorePatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, true));
|
|
2893
|
+
}
|
|
2894
|
+
for (const pattern of patterns)if (pattern) {
|
|
2895
|
+
if ("!" !== pattern[0] || "(" === pattern[1]) matchPatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, false));
|
|
2896
|
+
else if ("!" !== pattern[1] || "(" === pattern[2]) ignorePatterns.push(normalizePattern(pattern.slice(1), expandDirectories, cwd, props, true));
|
|
2897
|
+
}
|
|
2898
|
+
return {
|
|
2899
|
+
match: matchPatterns,
|
|
2900
|
+
ignore: ignorePatterns
|
|
2901
|
+
};
|
|
2902
|
+
}
|
|
2903
|
+
function getRelativePath(path$1, cwd, root) {
|
|
2904
|
+
return path__WEBPACK_IMPORTED_MODULE_0__.posix.relative(cwd, `${root}/${path$1}`) || ".";
|
|
2905
|
+
}
|
|
2906
|
+
function processPath(path$1, cwd, root, isDirectory, absolute) {
|
|
2907
|
+
const relativePath = absolute ? path$1.slice("/" === root ? 1 : root.length + 1) || "." : path$1;
|
|
2908
|
+
if (root === cwd) return isDirectory && "." !== relativePath ? relativePath.slice(0, -1) : relativePath;
|
|
2909
|
+
return getRelativePath(relativePath, cwd, root);
|
|
2910
|
+
}
|
|
2911
|
+
function formatPaths(paths, cwd, root) {
|
|
2912
|
+
for(let i = paths.length - 1; i >= 0; i--){
|
|
2913
|
+
const path$1 = paths[i];
|
|
2914
|
+
paths[i] = getRelativePath(path$1, cwd, root) + (!path$1 || path$1.endsWith("/") ? "/" : "");
|
|
2915
|
+
}
|
|
2916
|
+
return paths;
|
|
2917
|
+
}
|
|
2918
|
+
function crawl(options, cwd, sync) {
|
|
2919
|
+
if (process.env.TINYGLOBBY_DEBUG) options.debug = true;
|
|
2920
|
+
if (options.debug) log("globbing with options:", options, "cwd:", cwd);
|
|
2921
|
+
if (Array.isArray(options.patterns) && 0 === options.patterns.length) return sync ? [] : Promise.resolve([]);
|
|
2922
|
+
const props = {
|
|
2923
|
+
root: cwd,
|
|
2924
|
+
commonPath: null,
|
|
2925
|
+
depthOffset: 0
|
|
2926
|
+
};
|
|
2927
|
+
const processed = processPatterns(options, cwd, props);
|
|
2928
|
+
const nocase = false === options.caseSensitiveMatch;
|
|
2929
|
+
if (options.debug) log("internal processing patterns:", processed);
|
|
2930
|
+
const matcher = picomatch__WEBPACK_IMPORTED_MODULE_2__(processed.match, {
|
|
2931
|
+
dot: options.dot,
|
|
2932
|
+
nocase,
|
|
2933
|
+
ignore: processed.ignore
|
|
2934
|
+
});
|
|
2935
|
+
const ignore = picomatch__WEBPACK_IMPORTED_MODULE_2__(processed.ignore, {
|
|
2936
|
+
dot: options.dot,
|
|
2937
|
+
nocase
|
|
2938
|
+
});
|
|
2939
|
+
const partialMatcher = getPartialMatcher(processed.match, {
|
|
2940
|
+
dot: options.dot,
|
|
2941
|
+
nocase
|
|
2942
|
+
});
|
|
2943
|
+
const fdirOptions = {
|
|
2944
|
+
filters: [
|
|
2945
|
+
options.debug ? (p, isDirectory)=>{
|
|
2946
|
+
const path$1 = processPath(p, cwd, props.root, isDirectory, options.absolute);
|
|
2947
|
+
const matches = matcher(path$1);
|
|
2948
|
+
if (matches) log(`matched ${path$1}`);
|
|
2949
|
+
return matches;
|
|
2950
|
+
} : (p, isDirectory)=>matcher(processPath(p, cwd, props.root, isDirectory, options.absolute))
|
|
2951
|
+
],
|
|
2952
|
+
exclude: options.debug ? (_, p)=>{
|
|
2953
|
+
const relativePath = processPath(p, cwd, props.root, true, true);
|
|
2954
|
+
const skipped = "." !== relativePath && !partialMatcher(relativePath) || ignore(relativePath);
|
|
2955
|
+
skipped ? log(`skipped ${p}`) : log(`crawling ${p}`);
|
|
2956
|
+
return skipped;
|
|
2957
|
+
} : (_, p)=>{
|
|
2958
|
+
const relativePath = processPath(p, cwd, props.root, true, true);
|
|
2959
|
+
return "." !== relativePath && !partialMatcher(relativePath) || ignore(relativePath);
|
|
2960
|
+
},
|
|
2961
|
+
pathSeparator: "/",
|
|
2962
|
+
relativePaths: true,
|
|
2963
|
+
resolveSymlinks: true
|
|
2964
|
+
};
|
|
2965
|
+
if (void 0 !== options.deep) fdirOptions.maxDepth = Math.round(options.deep - props.depthOffset);
|
|
2966
|
+
if (options.absolute) {
|
|
2967
|
+
fdirOptions.relativePaths = false;
|
|
2968
|
+
fdirOptions.resolvePaths = true;
|
|
2969
|
+
fdirOptions.includeBasePath = true;
|
|
2970
|
+
}
|
|
2971
|
+
if (false === options.followSymbolicLinks) {
|
|
2972
|
+
fdirOptions.resolveSymlinks = false;
|
|
2973
|
+
fdirOptions.excludeSymlinks = true;
|
|
2974
|
+
}
|
|
2975
|
+
if (options.onlyDirectories) {
|
|
2976
|
+
fdirOptions.excludeFiles = true;
|
|
2977
|
+
fdirOptions.includeDirs = true;
|
|
2978
|
+
} else if (false === options.onlyFiles) fdirOptions.includeDirs = true;
|
|
2979
|
+
props.root = props.root.replace(BACKSLASHES, "");
|
|
2980
|
+
const root = props.root;
|
|
2981
|
+
if (options.debug) log("internal properties:", props);
|
|
2982
|
+
const api = new fdir__WEBPACK_IMPORTED_MODULE_1__.fdir(fdirOptions).crawl(root);
|
|
2983
|
+
if (cwd === root || options.absolute) return sync ? api.sync() : api.withPromise();
|
|
2984
|
+
return sync ? formatPaths(api.sync(), cwd, root) : api.withPromise().then((paths)=>formatPaths(paths, cwd, root));
|
|
2985
|
+
}
|
|
2986
|
+
async function glob(patternsOrOptions, options) {
|
|
2987
|
+
if (patternsOrOptions && (null == options ? void 0 : options.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
|
|
2988
|
+
const opts = Array.isArray(patternsOrOptions) || "string" == typeof patternsOrOptions ? {
|
|
2989
|
+
...options,
|
|
2990
|
+
patterns: patternsOrOptions
|
|
2991
|
+
} : patternsOrOptions;
|
|
2992
|
+
const cwd = opts.cwd ? path__WEBPACK_IMPORTED_MODULE_0__["default"].resolve(opts.cwd).replace(BACKSLASHES, "/") : process.cwd().replace(BACKSLASHES, "/");
|
|
2993
|
+
return crawl(opts, cwd, false);
|
|
2994
|
+
}
|
|
2995
|
+
}
|
|
2996
|
+
};
|
|
2997
|
+
var __webpack_module_cache__ = {};
|
|
2998
|
+
function __webpack_require__(moduleId) {
|
|
2999
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
3000
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
3001
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
3002
|
+
exports: {}
|
|
3003
|
+
};
|
|
3004
|
+
__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
3005
|
+
return module.exports;
|
|
3006
|
+
}
|
|
3007
|
+
__webpack_require__.m = __webpack_modules__;
|
|
3008
|
+
(()=>{
|
|
3009
|
+
__webpack_require__.n = (module)=>{
|
|
3010
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
3011
|
+
__webpack_require__.d(getter, {
|
|
3012
|
+
a: getter
|
|
3013
|
+
});
|
|
3014
|
+
return getter;
|
|
3015
|
+
};
|
|
3016
|
+
})();
|
|
3017
|
+
(()=>{
|
|
3018
|
+
__webpack_require__.d = (exports, definition)=>{
|
|
3019
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
3020
|
+
enumerable: true,
|
|
3021
|
+
get: definition[key]
|
|
3022
|
+
});
|
|
3023
|
+
};
|
|
3024
|
+
})();
|
|
3025
|
+
(()=>{
|
|
3026
|
+
__webpack_require__.f = {};
|
|
3027
|
+
__webpack_require__.e = (chunkId)=>Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key)=>{
|
|
3028
|
+
__webpack_require__.f[key](chunkId, promises);
|
|
3029
|
+
return promises;
|
|
3030
|
+
}, []));
|
|
3031
|
+
})();
|
|
3032
|
+
(()=>{
|
|
3033
|
+
__webpack_require__.u = (chunkId)=>"" + chunkId + ".js";
|
|
3034
|
+
})();
|
|
3035
|
+
(()=>{
|
|
3036
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
3037
|
+
})();
|
|
3038
|
+
(()=>{
|
|
3039
|
+
var installedChunks = {
|
|
3040
|
+
614: 0
|
|
3041
|
+
};
|
|
3042
|
+
var installChunk = (data)=>{
|
|
3043
|
+
var __webpack_ids__ = data.__webpack_ids__;
|
|
3044
|
+
var __webpack_modules__ = data.__webpack_modules__;
|
|
3045
|
+
var __webpack_runtime__ = data.__webpack_runtime__;
|
|
3046
|
+
var moduleId, chunkId, i = 0;
|
|
3047
|
+
for(moduleId in __webpack_modules__)if (__webpack_require__.o(__webpack_modules__, moduleId)) __webpack_require__.m[moduleId] = __webpack_modules__[moduleId];
|
|
3048
|
+
if (__webpack_runtime__) __webpack_runtime__(__webpack_require__);
|
|
3049
|
+
for(; i < __webpack_ids__.length; i++){
|
|
3050
|
+
chunkId = __webpack_ids__[i];
|
|
3051
|
+
if (__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) installedChunks[chunkId][0]();
|
|
3052
|
+
installedChunks[__webpack_ids__[i]] = 0;
|
|
3053
|
+
}
|
|
3054
|
+
};
|
|
3055
|
+
__webpack_require__.f.j = function(chunkId, promises) {
|
|
3056
|
+
var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : void 0;
|
|
3057
|
+
if (0 !== installedChunkData) if (installedChunkData) promises.push(installedChunkData[1]);
|
|
3058
|
+
else {
|
|
3059
|
+
var promise = import("./" + __webpack_require__.u(chunkId)).then(installChunk, (e)=>{
|
|
3060
|
+
if (0 !== installedChunks[chunkId]) installedChunks[chunkId] = void 0;
|
|
3061
|
+
throw e;
|
|
3062
|
+
});
|
|
3063
|
+
var promise = Promise.race([
|
|
3064
|
+
promise,
|
|
3065
|
+
new Promise((resolve)=>{
|
|
3066
|
+
installedChunkData = installedChunks[chunkId] = [
|
|
3067
|
+
resolve
|
|
3068
|
+
];
|
|
3069
|
+
})
|
|
3070
|
+
]);
|
|
3071
|
+
promises.push(installedChunkData[1] = promise);
|
|
3072
|
+
}
|
|
3073
|
+
};
|
|
3074
|
+
})();
|
|
3075
|
+
var logger = __webpack_require__("./src/utils/logger.ts");
|
|
3076
|
+
function toArr(any) {
|
|
3077
|
+
return null == any ? [] : Array.isArray(any) ? any : [
|
|
3078
|
+
any
|
|
3079
|
+
];
|
|
3080
|
+
}
|
|
3081
|
+
function toVal(out, key, val, opts) {
|
|
3082
|
+
var x, old = out[key], nxt = ~opts.string.indexOf(key) ? null == val || true === val ? '' : String(val) : 'boolean' == typeof val ? val : ~opts.boolean.indexOf(key) ? 'false' === val ? false : 'true' === val || (out._.push((x = +val, 0 * x === 0) ? x : val), !!val) : (x = +val, 0 * x === 0) ? x : val;
|
|
3083
|
+
out[key] = null == old ? nxt : Array.isArray(old) ? old.concat(nxt) : [
|
|
3084
|
+
old,
|
|
3085
|
+
nxt
|
|
3086
|
+
];
|
|
3087
|
+
}
|
|
3088
|
+
function mri2(args, opts) {
|
|
3089
|
+
args = args || [];
|
|
3090
|
+
opts = opts || {};
|
|
3091
|
+
var k, arr, arg, name, val, out = {
|
|
3092
|
+
_: []
|
|
3093
|
+
};
|
|
3094
|
+
var i = 0, j = 0, idx = 0, len = args.length;
|
|
3095
|
+
const alibi = void 0 !== opts.alias;
|
|
3096
|
+
const strict = void 0 !== opts.unknown;
|
|
3097
|
+
const defaults = void 0 !== opts.default;
|
|
3098
|
+
opts.alias = opts.alias || {};
|
|
3099
|
+
opts.string = toArr(opts.string);
|
|
3100
|
+
opts.boolean = toArr(opts.boolean);
|
|
3101
|
+
if (alibi) for(k in opts.alias){
|
|
3102
|
+
arr = opts.alias[k] = toArr(opts.alias[k]);
|
|
3103
|
+
for(i = 0; i < arr.length; i++)(opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);
|
|
3104
|
+
}
|
|
3105
|
+
for(i = opts.boolean.length; i-- > 0;){
|
|
3106
|
+
arr = opts.alias[opts.boolean[i]] || [];
|
|
3107
|
+
for(j = arr.length; j-- > 0;)opts.boolean.push(arr[j]);
|
|
3108
|
+
}
|
|
3109
|
+
for(i = opts.string.length; i-- > 0;){
|
|
3110
|
+
arr = opts.alias[opts.string[i]] || [];
|
|
3111
|
+
for(j = arr.length; j-- > 0;)opts.string.push(arr[j]);
|
|
3112
|
+
}
|
|
3113
|
+
if (defaults) for(k in opts.default){
|
|
3114
|
+
name = typeof opts.default[k];
|
|
3115
|
+
arr = opts.alias[k] = opts.alias[k] || [];
|
|
3116
|
+
if (void 0 !== opts[name]) {
|
|
3117
|
+
opts[name].push(k);
|
|
3118
|
+
for(i = 0; i < arr.length; i++)opts[name].push(arr[i]);
|
|
3119
|
+
}
|
|
3120
|
+
}
|
|
3121
|
+
const keys = strict ? Object.keys(opts.alias) : [];
|
|
3122
|
+
for(i = 0; i < len; i++){
|
|
3123
|
+
arg = args[i];
|
|
3124
|
+
if ('--' === arg) {
|
|
3125
|
+
out._ = out._.concat(args.slice(++i));
|
|
3126
|
+
break;
|
|
3127
|
+
}
|
|
3128
|
+
for(j = 0; j < arg.length && 45 === arg.charCodeAt(j); j++);
|
|
3129
|
+
if (0 === j) out._.push(arg);
|
|
3130
|
+
else if ('no-' === arg.substring(j, j + 3)) {
|
|
3131
|
+
name = arg.substring(j + 3);
|
|
3132
|
+
if (strict && !~keys.indexOf(name)) return opts.unknown(arg);
|
|
3133
|
+
out[name] = false;
|
|
3134
|
+
} else {
|
|
3135
|
+
for(idx = j + 1; idx < arg.length && 61 !== arg.charCodeAt(idx); idx++);
|
|
3136
|
+
name = arg.substring(j, idx);
|
|
3137
|
+
val = arg.substring(++idx) || i + 1 === len || 45 === ('' + args[i + 1]).charCodeAt(0) || args[++i];
|
|
3138
|
+
arr = 2 === j ? [
|
|
3139
|
+
name
|
|
3140
|
+
] : name;
|
|
3141
|
+
for(idx = 0; idx < arr.length; idx++){
|
|
3142
|
+
name = arr[idx];
|
|
3143
|
+
if (strict && !~keys.indexOf(name)) return opts.unknown('-'.repeat(j) + name);
|
|
3144
|
+
toVal(out, name, idx + 1 < arr.length || val, opts);
|
|
3145
|
+
}
|
|
3146
|
+
}
|
|
3147
|
+
}
|
|
3148
|
+
if (defaults) {
|
|
3149
|
+
for(k in opts.default)if (void 0 === out[k]) out[k] = opts.default[k];
|
|
3150
|
+
}
|
|
3151
|
+
if (alibi) for(k in out){
|
|
3152
|
+
arr = opts.alias[k] || [];
|
|
3153
|
+
while(arr.length > 0)out[arr.shift()] = out[k];
|
|
3154
|
+
}
|
|
3155
|
+
return out;
|
|
3156
|
+
}
|
|
3157
|
+
const removeBrackets = (v)=>v.replace(/[<[].+/, "").trim();
|
|
3158
|
+
const findAllBrackets = (v)=>{
|
|
3159
|
+
const ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g;
|
|
3160
|
+
const SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g;
|
|
3161
|
+
const res = [];
|
|
3162
|
+
const parse = (match)=>{
|
|
3163
|
+
let variadic = false;
|
|
3164
|
+
let value = match[1];
|
|
3165
|
+
if (value.startsWith("...")) {
|
|
3166
|
+
value = value.slice(3);
|
|
3167
|
+
variadic = true;
|
|
3168
|
+
}
|
|
3169
|
+
return {
|
|
3170
|
+
required: match[0].startsWith("<"),
|
|
3171
|
+
value,
|
|
3172
|
+
variadic
|
|
3173
|
+
};
|
|
3174
|
+
};
|
|
3175
|
+
let angledMatch;
|
|
3176
|
+
while(angledMatch = ANGLED_BRACKET_RE_GLOBAL.exec(v))res.push(parse(angledMatch));
|
|
3177
|
+
let squareMatch;
|
|
3178
|
+
while(squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v))res.push(parse(squareMatch));
|
|
3179
|
+
return res;
|
|
3180
|
+
};
|
|
3181
|
+
const getMriOptions = (options)=>{
|
|
3182
|
+
const result = {
|
|
3183
|
+
alias: {},
|
|
3184
|
+
boolean: []
|
|
3185
|
+
};
|
|
3186
|
+
for (const [index, option] of options.entries()){
|
|
3187
|
+
if (option.names.length > 1) result.alias[option.names[0]] = option.names.slice(1);
|
|
3188
|
+
if (option.isBoolean) if (option.negated) {
|
|
3189
|
+
const hasStringTypeOption = options.some((o, i)=>i !== index && o.names.some((name)=>option.names.includes(name)) && "boolean" == typeof o.required);
|
|
3190
|
+
if (!hasStringTypeOption) result.boolean.push(option.names[0]);
|
|
3191
|
+
} else result.boolean.push(option.names[0]);
|
|
3192
|
+
}
|
|
3193
|
+
return result;
|
|
3194
|
+
};
|
|
3195
|
+
const findLongest = (arr)=>arr.sort((a, b)=>a.length > b.length ? -1 : 1)[0];
|
|
3196
|
+
const padRight = (str, length)=>str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
|
|
3197
|
+
const camelcase = (input)=>input.replace(/([a-z])-([a-z])/g, (_, p1, p2)=>p1 + p2.toUpperCase());
|
|
3198
|
+
const setDotProp = (obj, keys, val)=>{
|
|
3199
|
+
let i = 0;
|
|
3200
|
+
let length = keys.length;
|
|
3201
|
+
let t = obj;
|
|
3202
|
+
let x;
|
|
3203
|
+
for(; i < length; ++i){
|
|
3204
|
+
x = t[keys[i]];
|
|
3205
|
+
t = t[keys[i]] = i === length - 1 ? val : null != x ? x : !~keys[i + 1].indexOf(".") && +keys[i + 1] > -1 ? [] : {};
|
|
3206
|
+
}
|
|
3207
|
+
};
|
|
3208
|
+
const setByType = (obj, transforms)=>{
|
|
3209
|
+
for (const key of Object.keys(transforms)){
|
|
3210
|
+
const transform = transforms[key];
|
|
3211
|
+
if (transform.shouldTransform) {
|
|
3212
|
+
obj[key] = Array.prototype.concat.call([], obj[key]);
|
|
3213
|
+
if ("function" == typeof transform.transformFunction) obj[key] = obj[key].map(transform.transformFunction);
|
|
3214
|
+
}
|
|
3215
|
+
}
|
|
3216
|
+
};
|
|
3217
|
+
const getFileName = (input)=>{
|
|
3218
|
+
const m = /([^\\\/]+)$/.exec(input);
|
|
3219
|
+
return m ? m[1] : "";
|
|
3220
|
+
};
|
|
3221
|
+
const camelcaseOptionName = (name)=>name.split(".").map((v, i)=>0 === i ? camelcase(v) : v).join(".");
|
|
3222
|
+
class CACError extends Error {
|
|
3223
|
+
constructor(message){
|
|
3224
|
+
super(message);
|
|
3225
|
+
this.name = this.constructor.name;
|
|
3226
|
+
if ("function" == typeof Error.captureStackTrace) Error.captureStackTrace(this, this.constructor);
|
|
3227
|
+
else this.stack = new Error(message).stack;
|
|
3228
|
+
}
|
|
3229
|
+
}
|
|
3230
|
+
class Option {
|
|
3231
|
+
constructor(rawName, description, config){
|
|
3232
|
+
this.rawName = rawName;
|
|
3233
|
+
this.description = description;
|
|
3234
|
+
this.config = Object.assign({}, config);
|
|
3235
|
+
rawName = rawName.replace(/\.\*/g, "");
|
|
3236
|
+
this.negated = false;
|
|
3237
|
+
this.names = removeBrackets(rawName).split(",").map((v)=>{
|
|
3238
|
+
let name = v.trim().replace(/^-{1,2}/, "");
|
|
3239
|
+
if (name.startsWith("no-")) {
|
|
3240
|
+
this.negated = true;
|
|
3241
|
+
name = name.replace(/^no-/, "");
|
|
3242
|
+
}
|
|
3243
|
+
return camelcaseOptionName(name);
|
|
3244
|
+
}).sort((a, b)=>a.length > b.length ? 1 : -1);
|
|
3245
|
+
this.name = this.names[this.names.length - 1];
|
|
3246
|
+
if (this.negated && null == this.config.default) this.config.default = true;
|
|
3247
|
+
if (rawName.includes("<")) this.required = true;
|
|
3248
|
+
else if (rawName.includes("[")) this.required = false;
|
|
3249
|
+
else this.isBoolean = true;
|
|
3250
|
+
}
|
|
3251
|
+
}
|
|
3252
|
+
const processArgs = process.argv;
|
|
3253
|
+
const platformInfo = `${process.platform}-${process.arch} node-${process.version}`;
|
|
3254
|
+
class Command {
|
|
3255
|
+
constructor(rawName, description, config = {}, cli){
|
|
3256
|
+
this.rawName = rawName;
|
|
3257
|
+
this.description = description;
|
|
3258
|
+
this.config = config;
|
|
3259
|
+
this.cli = cli;
|
|
3260
|
+
this.options = [];
|
|
3261
|
+
this.aliasNames = [];
|
|
3262
|
+
this.name = removeBrackets(rawName);
|
|
3263
|
+
this.args = findAllBrackets(rawName);
|
|
3264
|
+
this.examples = [];
|
|
3265
|
+
}
|
|
3266
|
+
usage(text) {
|
|
3267
|
+
this.usageText = text;
|
|
3268
|
+
return this;
|
|
3269
|
+
}
|
|
3270
|
+
allowUnknownOptions() {
|
|
3271
|
+
this.config.allowUnknownOptions = true;
|
|
3272
|
+
return this;
|
|
3273
|
+
}
|
|
3274
|
+
ignoreOptionDefaultValue() {
|
|
3275
|
+
this.config.ignoreOptionDefaultValue = true;
|
|
3276
|
+
return this;
|
|
3277
|
+
}
|
|
3278
|
+
version(version, customFlags = "-v, --version") {
|
|
3279
|
+
this.versionNumber = version;
|
|
3280
|
+
this.option(customFlags, "Display version number");
|
|
3281
|
+
return this;
|
|
3282
|
+
}
|
|
3283
|
+
example(example) {
|
|
3284
|
+
this.examples.push(example);
|
|
3285
|
+
return this;
|
|
3286
|
+
}
|
|
3287
|
+
option(rawName, description, config) {
|
|
3288
|
+
const option = new Option(rawName, description, config);
|
|
3289
|
+
this.options.push(option);
|
|
3290
|
+
return this;
|
|
3291
|
+
}
|
|
3292
|
+
alias(name) {
|
|
3293
|
+
this.aliasNames.push(name);
|
|
3294
|
+
return this;
|
|
3295
|
+
}
|
|
3296
|
+
action(callback) {
|
|
3297
|
+
this.commandAction = callback;
|
|
3298
|
+
return this;
|
|
3299
|
+
}
|
|
3300
|
+
isMatched(name) {
|
|
3301
|
+
return this.name === name || this.aliasNames.includes(name);
|
|
3302
|
+
}
|
|
3303
|
+
get isDefaultCommand() {
|
|
3304
|
+
return "" === this.name || this.aliasNames.includes("!");
|
|
3305
|
+
}
|
|
3306
|
+
get isGlobalCommand() {
|
|
3307
|
+
return this instanceof GlobalCommand;
|
|
3308
|
+
}
|
|
3309
|
+
hasOption(name) {
|
|
3310
|
+
name = name.split(".")[0];
|
|
3311
|
+
return this.options.find((option)=>option.names.includes(name));
|
|
3312
|
+
}
|
|
3313
|
+
outputHelp() {
|
|
3314
|
+
const { name, commands } = this.cli;
|
|
3315
|
+
const { versionNumber, options: globalOptions, helpCallback } = this.cli.globalCommand;
|
|
3316
|
+
let sections = [
|
|
3317
|
+
{
|
|
3318
|
+
body: `${name}${versionNumber ? `/${versionNumber}` : ""}`
|
|
3319
|
+
}
|
|
3320
|
+
];
|
|
3321
|
+
sections.push({
|
|
3322
|
+
title: "Usage",
|
|
3323
|
+
body: ` $ ${name} ${this.usageText || this.rawName}`
|
|
3324
|
+
});
|
|
3325
|
+
const showCommands = (this.isGlobalCommand || this.isDefaultCommand) && commands.length > 0;
|
|
3326
|
+
if (showCommands) {
|
|
3327
|
+
const longestCommandName = findLongest(commands.map((command)=>command.rawName));
|
|
3328
|
+
sections.push({
|
|
3329
|
+
title: "Commands",
|
|
3330
|
+
body: commands.map((command)=>` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`).join("\n")
|
|
3331
|
+
});
|
|
3332
|
+
sections.push({
|
|
3333
|
+
title: "For more info, run any command with the `--help` flag",
|
|
3334
|
+
body: commands.map((command)=>` $ ${name}${"" === command.name ? "" : ` ${command.name}`} --help`).join("\n")
|
|
3335
|
+
});
|
|
3336
|
+
}
|
|
3337
|
+
let options = this.isGlobalCommand ? globalOptions : [
|
|
3338
|
+
...this.options,
|
|
3339
|
+
...globalOptions || []
|
|
3340
|
+
];
|
|
3341
|
+
if (!this.isGlobalCommand && !this.isDefaultCommand) options = options.filter((option)=>"version" !== option.name);
|
|
3342
|
+
if (options.length > 0) {
|
|
3343
|
+
const longestOptionName = findLongest(options.map((option)=>option.rawName));
|
|
3344
|
+
sections.push({
|
|
3345
|
+
title: "Options",
|
|
3346
|
+
body: options.map((option)=>` ${padRight(option.rawName, longestOptionName.length)} ${option.description} ${void 0 === option.config.default ? "" : `(default: ${option.config.default})`}`).join("\n")
|
|
3347
|
+
});
|
|
3348
|
+
}
|
|
3349
|
+
if (this.examples.length > 0) sections.push({
|
|
3350
|
+
title: "Examples",
|
|
3351
|
+
body: this.examples.map((example)=>{
|
|
3352
|
+
if ("function" == typeof example) return example(name);
|
|
3353
|
+
return example;
|
|
3354
|
+
}).join("\n")
|
|
3355
|
+
});
|
|
3356
|
+
if (helpCallback) sections = helpCallback(sections) || sections;
|
|
3357
|
+
console.log(sections.map((section)=>section.title ? `${section.title}:
|
|
3358
|
+
${section.body}` : section.body).join("\n\n"));
|
|
3359
|
+
}
|
|
3360
|
+
outputVersion() {
|
|
3361
|
+
const { name } = this.cli;
|
|
3362
|
+
const { versionNumber } = this.cli.globalCommand;
|
|
3363
|
+
if (versionNumber) console.log(`${name}/${versionNumber} ${platformInfo}`);
|
|
3364
|
+
}
|
|
3365
|
+
checkRequiredArgs() {
|
|
3366
|
+
const minimalArgsCount = this.args.filter((arg)=>arg.required).length;
|
|
3367
|
+
if (this.cli.args.length < minimalArgsCount) throw new CACError(`missing required args for command \`${this.rawName}\``);
|
|
3368
|
+
}
|
|
3369
|
+
checkUnknownOptions() {
|
|
3370
|
+
const { options, globalCommand } = this.cli;
|
|
3371
|
+
if (!this.config.allowUnknownOptions) {
|
|
3372
|
+
for (const name of Object.keys(options))if ("--" !== name && !this.hasOption(name) && !globalCommand.hasOption(name)) throw new CACError(`Unknown option \`${name.length > 1 ? `--${name}` : `-${name}`}\``);
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
3375
|
+
checkOptionValue() {
|
|
3376
|
+
const { options: parsedOptions, globalCommand } = this.cli;
|
|
3377
|
+
const options = [
|
|
3378
|
+
...globalCommand.options,
|
|
3379
|
+
...this.options
|
|
3380
|
+
];
|
|
3381
|
+
for (const option of options){
|
|
3382
|
+
const value = parsedOptions[option.name.split(".")[0]];
|
|
3383
|
+
if (option.required) {
|
|
3384
|
+
const hasNegated = options.some((o)=>o.negated && o.names.includes(option.name));
|
|
3385
|
+
if (true === value || false === value && !hasNegated) throw new CACError(`option \`${option.rawName}\` value is missing`);
|
|
3386
|
+
}
|
|
3387
|
+
}
|
|
3388
|
+
}
|
|
3389
|
+
}
|
|
3390
|
+
class GlobalCommand extends Command {
|
|
3391
|
+
constructor(cli){
|
|
3392
|
+
super("@@global@@", "", {}, cli);
|
|
3393
|
+
}
|
|
3394
|
+
}
|
|
3395
|
+
var __assign = Object.assign;
|
|
3396
|
+
class CAC extends EventEmitter {
|
|
3397
|
+
constructor(name = ""){
|
|
3398
|
+
super();
|
|
3399
|
+
this.name = name;
|
|
3400
|
+
this.commands = [];
|
|
3401
|
+
this.rawArgs = [];
|
|
3402
|
+
this.args = [];
|
|
3403
|
+
this.options = {};
|
|
3404
|
+
this.globalCommand = new GlobalCommand(this);
|
|
3405
|
+
this.globalCommand.usage("<command> [options]");
|
|
3406
|
+
}
|
|
3407
|
+
usage(text) {
|
|
3408
|
+
this.globalCommand.usage(text);
|
|
3409
|
+
return this;
|
|
3410
|
+
}
|
|
3411
|
+
command(rawName, description, config) {
|
|
3412
|
+
const command = new Command(rawName, description || "", config, this);
|
|
3413
|
+
command.globalCommand = this.globalCommand;
|
|
3414
|
+
this.commands.push(command);
|
|
3415
|
+
return command;
|
|
3416
|
+
}
|
|
3417
|
+
option(rawName, description, config) {
|
|
3418
|
+
this.globalCommand.option(rawName, description, config);
|
|
3419
|
+
return this;
|
|
3420
|
+
}
|
|
3421
|
+
help(callback) {
|
|
3422
|
+
this.globalCommand.option("-h, --help", "Display this message");
|
|
3423
|
+
this.globalCommand.helpCallback = callback;
|
|
3424
|
+
this.showHelpOnExit = true;
|
|
3425
|
+
return this;
|
|
3426
|
+
}
|
|
3427
|
+
version(version, customFlags = "-v, --version") {
|
|
3428
|
+
this.globalCommand.version(version, customFlags);
|
|
3429
|
+
this.showVersionOnExit = true;
|
|
3430
|
+
return this;
|
|
3431
|
+
}
|
|
3432
|
+
example(example) {
|
|
3433
|
+
this.globalCommand.example(example);
|
|
3434
|
+
return this;
|
|
3435
|
+
}
|
|
3436
|
+
outputHelp() {
|
|
3437
|
+
if (this.matchedCommand) this.matchedCommand.outputHelp();
|
|
3438
|
+
else this.globalCommand.outputHelp();
|
|
3439
|
+
}
|
|
3440
|
+
outputVersion() {
|
|
3441
|
+
this.globalCommand.outputVersion();
|
|
3442
|
+
}
|
|
3443
|
+
setParsedInfo({ args, options }, matchedCommand, matchedCommandName) {
|
|
3444
|
+
this.args = args;
|
|
3445
|
+
this.options = options;
|
|
3446
|
+
if (matchedCommand) this.matchedCommand = matchedCommand;
|
|
3447
|
+
if (matchedCommandName) this.matchedCommandName = matchedCommandName;
|
|
3448
|
+
return this;
|
|
3449
|
+
}
|
|
3450
|
+
unsetMatchedCommand() {
|
|
3451
|
+
this.matchedCommand = void 0;
|
|
3452
|
+
this.matchedCommandName = void 0;
|
|
3453
|
+
}
|
|
3454
|
+
parse(argv = processArgs, { run = true } = {}) {
|
|
3455
|
+
this.rawArgs = argv;
|
|
3456
|
+
if (!this.name) this.name = argv[1] ? getFileName(argv[1]) : "cli";
|
|
3457
|
+
let shouldParse = true;
|
|
3458
|
+
for (const command of this.commands){
|
|
3459
|
+
const parsed = this.mri(argv.slice(2), command);
|
|
3460
|
+
const commandName = parsed.args[0];
|
|
3461
|
+
if (command.isMatched(commandName)) {
|
|
3462
|
+
shouldParse = false;
|
|
3463
|
+
const parsedInfo = __assign(__assign({}, parsed), {
|
|
3464
|
+
args: parsed.args.slice(1)
|
|
3465
|
+
});
|
|
3466
|
+
this.setParsedInfo(parsedInfo, command, commandName);
|
|
3467
|
+
this.emit(`command:${commandName}`, command);
|
|
3468
|
+
}
|
|
3469
|
+
}
|
|
3470
|
+
if (shouldParse) {
|
|
3471
|
+
for (const command of this.commands)if ("" === command.name) {
|
|
3472
|
+
shouldParse = false;
|
|
3473
|
+
const parsed = this.mri(argv.slice(2), command);
|
|
3474
|
+
this.setParsedInfo(parsed, command);
|
|
3475
|
+
this.emit("command:!", command);
|
|
3476
|
+
}
|
|
3477
|
+
}
|
|
3478
|
+
if (shouldParse) {
|
|
3479
|
+
const parsed = this.mri(argv.slice(2));
|
|
3480
|
+
this.setParsedInfo(parsed);
|
|
3481
|
+
}
|
|
3482
|
+
if (this.options.help && this.showHelpOnExit) {
|
|
3483
|
+
this.outputHelp();
|
|
3484
|
+
run = false;
|
|
3485
|
+
this.unsetMatchedCommand();
|
|
3486
|
+
}
|
|
3487
|
+
if (this.options.version && this.showVersionOnExit && null == this.matchedCommandName) {
|
|
3488
|
+
this.outputVersion();
|
|
3489
|
+
run = false;
|
|
3490
|
+
this.unsetMatchedCommand();
|
|
3491
|
+
}
|
|
3492
|
+
const parsedArgv = {
|
|
3493
|
+
args: this.args,
|
|
3494
|
+
options: this.options
|
|
3495
|
+
};
|
|
3496
|
+
if (run) this.runMatchedCommand();
|
|
3497
|
+
if (!this.matchedCommand && this.args[0]) this.emit("command:*");
|
|
3498
|
+
return parsedArgv;
|
|
3499
|
+
}
|
|
3500
|
+
mri(argv, command) {
|
|
3501
|
+
const cliOptions = [
|
|
3502
|
+
...this.globalCommand.options,
|
|
3503
|
+
...command ? command.options : []
|
|
3504
|
+
];
|
|
3505
|
+
const mriOptions = getMriOptions(cliOptions);
|
|
3506
|
+
let argsAfterDoubleDashes = [];
|
|
3507
|
+
const doubleDashesIndex = argv.indexOf("--");
|
|
3508
|
+
if (doubleDashesIndex > -1) {
|
|
3509
|
+
argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1);
|
|
3510
|
+
argv = argv.slice(0, doubleDashesIndex);
|
|
3511
|
+
}
|
|
3512
|
+
let parsed = mri2(argv, mriOptions);
|
|
3513
|
+
parsed = Object.keys(parsed).reduce((res, name)=>__assign(__assign({}, res), {
|
|
3514
|
+
[camelcaseOptionName(name)]: parsed[name]
|
|
3515
|
+
}), {
|
|
3516
|
+
_: []
|
|
3517
|
+
});
|
|
3518
|
+
const args = parsed._;
|
|
3519
|
+
const options = {
|
|
3520
|
+
"--": argsAfterDoubleDashes
|
|
3521
|
+
};
|
|
3522
|
+
const ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue;
|
|
3523
|
+
let transforms = Object.create(null);
|
|
3524
|
+
for (const cliOption of cliOptions){
|
|
3525
|
+
if (!ignoreDefault && void 0 !== cliOption.config.default) for (const name of cliOption.names)options[name] = cliOption.config.default;
|
|
3526
|
+
if (Array.isArray(cliOption.config.type)) {
|
|
3527
|
+
if (void 0 === transforms[cliOption.name]) {
|
|
3528
|
+
transforms[cliOption.name] = Object.create(null);
|
|
3529
|
+
transforms[cliOption.name]["shouldTransform"] = true;
|
|
3530
|
+
transforms[cliOption.name]["transformFunction"] = cliOption.config.type[0];
|
|
3531
|
+
}
|
|
3532
|
+
}
|
|
3533
|
+
}
|
|
3534
|
+
for (const key of Object.keys(parsed))if ("_" !== key) {
|
|
3535
|
+
const keys = key.split(".");
|
|
3536
|
+
setDotProp(options, keys, parsed[key]);
|
|
3537
|
+
setByType(options, transforms);
|
|
3538
|
+
}
|
|
3539
|
+
return {
|
|
3540
|
+
args,
|
|
3541
|
+
options
|
|
3542
|
+
};
|
|
3543
|
+
}
|
|
3544
|
+
runMatchedCommand() {
|
|
3545
|
+
const { args, options, matchedCommand: command } = this;
|
|
3546
|
+
if (!command || !command.commandAction) return;
|
|
3547
|
+
command.checkUnknownOptions();
|
|
3548
|
+
command.checkOptionValue();
|
|
3549
|
+
command.checkRequiredArgs();
|
|
3550
|
+
const actionArgs = [];
|
|
3551
|
+
command.args.forEach((arg, index)=>{
|
|
3552
|
+
if (arg.variadic) actionArgs.push(args.slice(index));
|
|
3553
|
+
else actionArgs.push(args[index]);
|
|
3554
|
+
});
|
|
3555
|
+
actionArgs.push(options);
|
|
3556
|
+
return command.commandAction.apply(this, actionArgs);
|
|
3557
|
+
}
|
|
3558
|
+
}
|
|
3559
|
+
const cac = (name = "")=>new CAC(name);
|
|
3560
|
+
const dist = cac;
|
|
3561
|
+
var external_pathe_ = __webpack_require__("pathe");
|
|
3562
|
+
var external_std_env_ = __webpack_require__("std-env");
|
|
3563
|
+
var src_config = __webpack_require__("./src/config.ts");
|
|
3564
|
+
var helper = __webpack_require__("./src/utils/helper.ts");
|
|
3565
|
+
function initNodeEnv() {
|
|
3566
|
+
if (!process.env.NODE_ENV) process.env.NODE_ENV = 'test';
|
|
3567
|
+
}
|
|
3568
|
+
function prepareCli() {
|
|
3569
|
+
initNodeEnv();
|
|
3570
|
+
const { npm_execpath } = process.env;
|
|
3571
|
+
if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) console.log();
|
|
3572
|
+
}
|
|
3573
|
+
function showRstest() {
|
|
3574
|
+
logger.k.greet(" Rstest v0.0.1");
|
|
3575
|
+
logger.k.log('');
|
|
3576
|
+
}
|
|
3577
|
+
const applyCommonOptions = (cli)=>{
|
|
3578
|
+
cli.option('-c, --config <config>', 'Specify the configuration file, can be a relative or absolute path').option('--config-loader <loader>', 'Specify the loader to load the config file, can be `jiti` or `native`', {
|
|
3579
|
+
default: 'jiti'
|
|
3580
|
+
}).option('-r, --root <root>', 'Specify the project root directory, can be an absolute path or a path relative to cwd').option('--globals', 'Provide global APIs').option('-u, --update', 'Update snapshot files').option('--passWithNoTests', 'Allows the test suite to pass when no files are found').option('--printConsoleTrace', 'Print console traces when calling any console method').option('--disableConsoleIntercept', 'Disable console intercept').option('--slowTestThreshold <value>', 'The number of milliseconds after which a test or suite is considered slow').option('-t, --testNamePattern <value>', 'Run only tests with a name that matches the regex').option('--testEnvironment <name>', 'The environment that will be used for testing').option('--testTimeout <value>', 'Timeout of a test in milliseconds').option('--retry <retry>', 'Number of times to retry a test if it fails').option('--maxConcurrency <value>', 'Maximum number of concurrent tests').option('--clearMocks', 'Automatically clear mock calls, instances, contexts and results before every test').option('--resetMocks', 'Automatically reset mock state before every test').option('--restoreMocks', 'Automatically restore mock state and implementation before every test').option('--unstubGlobals', 'Restores all global variables that were changed with `rstest.stubGlobal` before every test').option('--unstubEnvs', 'Restores all `process.env` values that were changed with `rstest.stubEnv` before every test');
|
|
3581
|
+
};
|
|
3582
|
+
async function initCli(options) {
|
|
3583
|
+
const cwd = process.cwd();
|
|
3584
|
+
const root = options.root ? (0, helper.ZY)(cwd, options.root) : cwd;
|
|
3585
|
+
const { content: config, filePath: configFilePath } = await (0, src_config.ME)({
|
|
3586
|
+
cwd: root,
|
|
3587
|
+
path: options.config,
|
|
3588
|
+
configLoader: options.configLoader
|
|
3589
|
+
});
|
|
3590
|
+
const keys = [
|
|
3591
|
+
'root',
|
|
3592
|
+
'globals',
|
|
3593
|
+
'passWithNoTests',
|
|
3594
|
+
'update',
|
|
3595
|
+
'testNamePattern',
|
|
3596
|
+
'testTimeout',
|
|
3597
|
+
'clearMocks',
|
|
3598
|
+
'resetMocks',
|
|
3599
|
+
'restoreMocks',
|
|
3600
|
+
'unstubEnvs',
|
|
3601
|
+
'unstubGlobals',
|
|
3602
|
+
'retry',
|
|
3603
|
+
'slowTestThreshold',
|
|
3604
|
+
'maxConcurrency',
|
|
3605
|
+
'printConsoleTrace',
|
|
3606
|
+
'disableConsoleIntercept',
|
|
3607
|
+
'testEnvironment'
|
|
3608
|
+
];
|
|
3609
|
+
for (const key of keys)if (void 0 !== options[key]) config[key] = options[key];
|
|
3610
|
+
return {
|
|
3611
|
+
config,
|
|
3612
|
+
configFilePath
|
|
3613
|
+
};
|
|
3614
|
+
}
|
|
3615
|
+
function setupCommands() {
|
|
3616
|
+
const cli = dist('rstest');
|
|
3617
|
+
cli.help();
|
|
3618
|
+
cli.version("0.0.1");
|
|
3619
|
+
applyCommonOptions(cli);
|
|
3620
|
+
cli.command('[...filters]', 'run tests').action(async (filters, options)=>{
|
|
3621
|
+
showRstest();
|
|
3622
|
+
try {
|
|
3623
|
+
const { config } = await initCli(options);
|
|
3624
|
+
const { createRstest } = await __webpack_require__.e("353").then(__webpack_require__.bind(__webpack_require__, "./src/core/index.ts"));
|
|
3625
|
+
if (external_std_env_.isCI) {
|
|
3626
|
+
const rstest = createRstest(config, 'run', filters.map(external_pathe_.normalize));
|
|
3627
|
+
await rstest.runTests();
|
|
3628
|
+
} else {
|
|
3629
|
+
const rstest = createRstest(config, 'watch', filters.map(external_pathe_.normalize));
|
|
3630
|
+
await rstest.runTests();
|
|
3631
|
+
}
|
|
3632
|
+
} catch (err) {
|
|
3633
|
+
logger.k.error('Failed to run Rstest.');
|
|
3634
|
+
logger.k.error(err);
|
|
3635
|
+
process.exit(1);
|
|
3636
|
+
}
|
|
3637
|
+
});
|
|
3638
|
+
cli.command('run [...filters]', 'run tests without watch mode').action(async (filters, options)=>{
|
|
3639
|
+
showRstest();
|
|
3640
|
+
const { config } = await initCli(options);
|
|
3641
|
+
const { createRstest } = await __webpack_require__.e("353").then(__webpack_require__.bind(__webpack_require__, "./src/core/index.ts"));
|
|
3642
|
+
const rstest = createRstest(config, 'run', filters.map(external_pathe_.normalize));
|
|
3643
|
+
try {
|
|
3644
|
+
await rstest.runTests();
|
|
3645
|
+
} catch (err) {
|
|
3646
|
+
for (const reporter of rstest.context.reporters)reporter.onExit?.();
|
|
3647
|
+
logger.k.error('Failed to run Rstest.');
|
|
3648
|
+
logger.k.error((0, helper.Z)(err));
|
|
3649
|
+
process.exit(1);
|
|
3650
|
+
}
|
|
3651
|
+
});
|
|
3652
|
+
cli.command('watch [...filters]', 'run tests in watch mode').action(async (filters, options)=>{
|
|
3653
|
+
showRstest();
|
|
3654
|
+
const { config } = await initCli(options);
|
|
3655
|
+
const { createRstest } = await __webpack_require__.e("353").then(__webpack_require__.bind(__webpack_require__, "./src/core/index.ts"));
|
|
3656
|
+
const rstest = createRstest(config, 'watch', filters.map(external_pathe_.normalize));
|
|
3657
|
+
await rstest.runTests();
|
|
3658
|
+
});
|
|
3659
|
+
cli.command('list [...filters]', 'lists all test files that Rstest will run').option('--filesOnly', 'only list the test files').option('--json [boolean/path]', 'print tests as JSON or write to a file').action(async (filters, options)=>{
|
|
3660
|
+
try {
|
|
3661
|
+
const { config } = await initCli(options);
|
|
3662
|
+
const { createRstest } = await __webpack_require__.e("353").then(__webpack_require__.bind(__webpack_require__, "./src/core/index.ts"));
|
|
3663
|
+
const rstest = createRstest(config, 'list', filters.map(external_pathe_.normalize));
|
|
3664
|
+
await rstest.listTests({
|
|
3665
|
+
filesOnly: options.filesOnly,
|
|
3666
|
+
json: options.json
|
|
3667
|
+
});
|
|
3668
|
+
} catch (err) {
|
|
3669
|
+
logger.k.error('Failed to run Rstest list.');
|
|
3670
|
+
logger.k.error((0, helper.Z)(err));
|
|
3671
|
+
process.exit(1);
|
|
3672
|
+
}
|
|
3673
|
+
});
|
|
3674
|
+
cli.parse();
|
|
3675
|
+
}
|
|
3676
|
+
async function runCLI() {
|
|
3677
|
+
prepareCli();
|
|
3678
|
+
try {
|
|
3679
|
+
setupCommands();
|
|
3680
|
+
} catch (err) {
|
|
3681
|
+
logger.k.error('Failed to start Rstest CLI.');
|
|
3682
|
+
logger.k.error(err);
|
|
3683
|
+
}
|
|
3684
|
+
}
|
|
3685
|
+
export { runCLI };
|