@rsbuild/plugin-babel 1.0.4 → 1.0.6
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/README.md +1 -1
- package/compiled/babel-loader/index.js +474 -153
- package/compiled/babel-loader/package.json +1 -1
- package/dist/index.cjs +76 -64
- package/dist/index.d.ts +2 -2
- package/dist/index.js +59 -51
- package/package.json +13 -13
- package/compiled/babel-loader/611.index.js +0 -411
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
|
-
|
|
3
|
+
698: (module) => {
|
|
4
4
|
const STRIP_FILENAME_RE = /^[^:]+: /;
|
|
5
5
|
const format = (err) => {
|
|
6
6
|
if (err instanceof SyntaxError) {
|
|
@@ -26,24 +26,17 @@
|
|
|
26
26
|
}
|
|
27
27
|
module.exports = LoaderError;
|
|
28
28
|
},
|
|
29
|
-
|
|
29
|
+
846: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
30
30
|
const os = __nccwpck_require__(857);
|
|
31
31
|
const path = __nccwpck_require__(928);
|
|
32
32
|
const zlib = __nccwpck_require__(106);
|
|
33
|
-
const crypto = __nccwpck_require__(982);
|
|
34
33
|
const { promisify } = __nccwpck_require__(23);
|
|
35
34
|
const { readFile, writeFile, mkdir } = __nccwpck_require__(943);
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
35
|
+
const { sync: findUpSync } = __nccwpck_require__(609);
|
|
36
|
+
const { env } = process;
|
|
37
|
+
const transform = __nccwpck_require__(80);
|
|
38
|
+
const serialize = __nccwpck_require__(786);
|
|
40
39
|
let defaultCacheDirectory = null;
|
|
41
|
-
let hashType = "sha256";
|
|
42
|
-
try {
|
|
43
|
-
crypto.createHash(hashType);
|
|
44
|
-
} catch {
|
|
45
|
-
hashType = "md5";
|
|
46
|
-
}
|
|
47
40
|
const gunzip = promisify(zlib.gunzip);
|
|
48
41
|
const gzip = promisify(zlib.gzip);
|
|
49
42
|
const read = async function (filename, compress) {
|
|
@@ -56,12 +49,40 @@
|
|
|
56
49
|
const data = compress ? await gzip(content) : content;
|
|
57
50
|
return await writeFile(filename + (compress ? ".gz" : ""), data);
|
|
58
51
|
};
|
|
59
|
-
const filename = function (source, identifier, options) {
|
|
60
|
-
|
|
61
|
-
const contents = JSON.stringify({ source, options, identifier });
|
|
62
|
-
hash.update(contents);
|
|
52
|
+
const filename = function (source, identifier, options, hash) {
|
|
53
|
+
hash.update(serialize([options, source, identifier]));
|
|
63
54
|
return hash.digest("hex") + ".json";
|
|
64
55
|
};
|
|
56
|
+
const addTimestamps = async function (
|
|
57
|
+
externalDependencies,
|
|
58
|
+
getFileTimestamp,
|
|
59
|
+
) {
|
|
60
|
+
for (const depAndEmptyTimestamp of externalDependencies) {
|
|
61
|
+
try {
|
|
62
|
+
const [dep] = depAndEmptyTimestamp;
|
|
63
|
+
const { timestamp } = await getFileTimestamp(dep);
|
|
64
|
+
depAndEmptyTimestamp.push(timestamp);
|
|
65
|
+
} catch {}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const areExternalDependenciesModified = async function (
|
|
69
|
+
externalDepsWithTimestamp,
|
|
70
|
+
getFileTimestamp,
|
|
71
|
+
) {
|
|
72
|
+
for (const depAndTimestamp of externalDepsWithTimestamp) {
|
|
73
|
+
const [dep, timestamp] = depAndTimestamp;
|
|
74
|
+
let newTimestamp;
|
|
75
|
+
try {
|
|
76
|
+
newTimestamp = (await getFileTimestamp(dep)).timestamp;
|
|
77
|
+
} catch {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
if (timestamp !== newTimestamp) {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return false;
|
|
85
|
+
};
|
|
65
86
|
const handleCache = async function (directory, params) {
|
|
66
87
|
const {
|
|
67
88
|
source,
|
|
@@ -69,15 +90,29 @@
|
|
|
69
90
|
cacheIdentifier,
|
|
70
91
|
cacheDirectory,
|
|
71
92
|
cacheCompression,
|
|
93
|
+
hash,
|
|
94
|
+
getFileTimestamp,
|
|
72
95
|
logger,
|
|
73
96
|
} = params;
|
|
74
97
|
const file = path.join(
|
|
75
98
|
directory,
|
|
76
|
-
filename(source, cacheIdentifier, options),
|
|
99
|
+
filename(source, cacheIdentifier, options, hash),
|
|
77
100
|
);
|
|
78
101
|
try {
|
|
79
102
|
logger.debug(`reading cache file '${file}'`);
|
|
80
|
-
|
|
103
|
+
const result = await read(file, cacheCompression);
|
|
104
|
+
if (
|
|
105
|
+
!(await areExternalDependenciesModified(
|
|
106
|
+
result.externalDependencies,
|
|
107
|
+
getFileTimestamp,
|
|
108
|
+
))
|
|
109
|
+
) {
|
|
110
|
+
logger.debug(`validated cache file '${file}'`);
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
113
|
+
logger.debug(
|
|
114
|
+
`discarded cache file '${file}' due to changes in external dependencies`,
|
|
115
|
+
);
|
|
81
116
|
} catch {
|
|
82
117
|
logger.debug(`discarded cache as it can not be read`);
|
|
83
118
|
}
|
|
@@ -94,16 +129,15 @@
|
|
|
94
129
|
}
|
|
95
130
|
logger.debug(`applying Babel transform`);
|
|
96
131
|
const result = await transform(source, options);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
throw err;
|
|
132
|
+
await addTimestamps(result.externalDependencies, getFileTimestamp);
|
|
133
|
+
try {
|
|
134
|
+
logger.debug(`writing result to cache file '${file}'`);
|
|
135
|
+
await write(file, cacheCompression, result);
|
|
136
|
+
} catch (err) {
|
|
137
|
+
if (fallback) {
|
|
138
|
+
return handleCache(os.tmpdir(), params);
|
|
106
139
|
}
|
|
140
|
+
throw err;
|
|
107
141
|
}
|
|
108
142
|
return result;
|
|
109
143
|
};
|
|
@@ -112,17 +146,26 @@
|
|
|
112
146
|
if (typeof params.cacheDirectory === "string") {
|
|
113
147
|
directory = params.cacheDirectory;
|
|
114
148
|
} else {
|
|
115
|
-
|
|
116
|
-
const { default: findCacheDir } = await findCacheDirP;
|
|
117
|
-
defaultCacheDirectory =
|
|
118
|
-
findCacheDir({ name: "babel-loader" }) || os.tmpdir();
|
|
119
|
-
}
|
|
149
|
+
defaultCacheDirectory ??= findCacheDir("babel-loader");
|
|
120
150
|
directory = defaultCacheDirectory;
|
|
121
151
|
}
|
|
122
152
|
return await handleCache(directory, params);
|
|
123
153
|
};
|
|
154
|
+
function findCacheDir(name) {
|
|
155
|
+
if (
|
|
156
|
+
env.CACHE_DIR &&
|
|
157
|
+
!["true", "false", "1", "0"].includes(env.CACHE_DIR)
|
|
158
|
+
) {
|
|
159
|
+
return path.join(env.CACHE_DIR, name);
|
|
160
|
+
}
|
|
161
|
+
const rootPkgJSONPath = path.dirname(findUpSync("package.json"));
|
|
162
|
+
if (rootPkgJSONPath) {
|
|
163
|
+
return path.join(rootPkgJSONPath, "node_modules", ".cache", name);
|
|
164
|
+
}
|
|
165
|
+
return os.tmpdir();
|
|
166
|
+
}
|
|
124
167
|
},
|
|
125
|
-
|
|
168
|
+
448: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
126
169
|
let babel;
|
|
127
170
|
try {
|
|
128
171
|
babel = __nccwpck_require__(571);
|
|
@@ -141,12 +184,12 @@
|
|
|
141
184
|
);
|
|
142
185
|
}
|
|
143
186
|
const { version } = __nccwpck_require__(344);
|
|
144
|
-
const cache = __nccwpck_require__(
|
|
145
|
-
const transform = __nccwpck_require__(
|
|
146
|
-
const injectCaller = __nccwpck_require__(
|
|
147
|
-
const schema = __nccwpck_require__(
|
|
187
|
+
const cache = __nccwpck_require__(846);
|
|
188
|
+
const transform = __nccwpck_require__(80);
|
|
189
|
+
const injectCaller = __nccwpck_require__(976);
|
|
190
|
+
const schema = __nccwpck_require__(690);
|
|
148
191
|
const { isAbsolute } = __nccwpck_require__(928);
|
|
149
|
-
const
|
|
192
|
+
const { promisify } = __nccwpck_require__(23);
|
|
150
193
|
function subscribe(subscriber, metadata, context) {
|
|
151
194
|
if (context[subscriber]) {
|
|
152
195
|
context[subscriber](metadata);
|
|
@@ -166,18 +209,9 @@
|
|
|
166
209
|
}
|
|
167
210
|
async function loader(source, inputSourceMap, overrides) {
|
|
168
211
|
const filename = this.resourcePath;
|
|
169
|
-
const logger =
|
|
170
|
-
|
|
171
|
-
? this.getLogger("babel-loader")
|
|
172
|
-
: { debug: () => {} };
|
|
173
|
-
let loaderOptions = this.getOptions();
|
|
174
|
-
validateOptions(schema, loaderOptions, { name: "Babel loader" });
|
|
212
|
+
const logger = this.getLogger("babel-loader");
|
|
213
|
+
let loaderOptions = this.getOptions(schema);
|
|
175
214
|
if (loaderOptions.customize != null) {
|
|
176
|
-
if (typeof loaderOptions.customize !== "string") {
|
|
177
|
-
throw new Error(
|
|
178
|
-
"Customized loaders must be implemented as standalone modules.",
|
|
179
|
-
);
|
|
180
|
-
}
|
|
181
215
|
if (!isAbsolute(loaderOptions.customize)) {
|
|
182
216
|
throw new Error(
|
|
183
217
|
"Customized loaders must be passed as absolute paths, since " +
|
|
@@ -213,17 +247,21 @@
|
|
|
213
247
|
loaderOptions = result.loader;
|
|
214
248
|
}
|
|
215
249
|
if ("forceEnv" in loaderOptions) {
|
|
216
|
-
|
|
217
|
-
|
|
250
|
+
this.emitWarning(
|
|
251
|
+
new Error(
|
|
252
|
+
"The option `forceEnv` has been removed in favor of `envName` in Babel 7.",
|
|
253
|
+
),
|
|
218
254
|
);
|
|
219
255
|
}
|
|
220
256
|
if (typeof loaderOptions.babelrc === "string") {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
"
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
257
|
+
this.emitWarning(
|
|
258
|
+
new Error(
|
|
259
|
+
"The option `babelrc` should not be set to a string anymore in the babel-loader config. " +
|
|
260
|
+
"Please update your configuration and set `babelrc` to true or false.\n" +
|
|
261
|
+
"If you want to specify a specific babel config file to inherit config from " +
|
|
262
|
+
"please use the `extends` option.\nFor more information about this options see " +
|
|
263
|
+
"https://babeljs.io/docs/#options",
|
|
264
|
+
),
|
|
227
265
|
);
|
|
228
266
|
}
|
|
229
267
|
logger.debug("normalizing loader options");
|
|
@@ -269,17 +307,23 @@
|
|
|
269
307
|
}
|
|
270
308
|
const {
|
|
271
309
|
cacheDirectory = null,
|
|
272
|
-
cacheIdentifier =
|
|
273
|
-
|
|
274
|
-
"
|
|
275
|
-
"
|
|
276
|
-
|
|
310
|
+
cacheIdentifier = "core" +
|
|
311
|
+
transform.version +
|
|
312
|
+
"," +
|
|
313
|
+
"loader" +
|
|
314
|
+
version,
|
|
277
315
|
cacheCompression = true,
|
|
278
316
|
metadataSubscribers = [],
|
|
279
317
|
} = loaderOptions;
|
|
280
318
|
let result;
|
|
281
319
|
if (cacheDirectory) {
|
|
282
320
|
logger.debug("cache is enabled");
|
|
321
|
+
const getFileTimestamp = promisify((path, cb) => {
|
|
322
|
+
this._compilation.fileSystemInfo.getFileTimestamp(path, cb);
|
|
323
|
+
});
|
|
324
|
+
const hash = this.utils.createHash(
|
|
325
|
+
this._compilation.outputOptions.hashFunction,
|
|
326
|
+
);
|
|
283
327
|
result = await cache({
|
|
284
328
|
source,
|
|
285
329
|
options,
|
|
@@ -287,6 +331,8 @@
|
|
|
287
331
|
cacheDirectory,
|
|
288
332
|
cacheIdentifier,
|
|
289
333
|
cacheCompression,
|
|
334
|
+
hash,
|
|
335
|
+
getFileTimestamp,
|
|
290
336
|
logger,
|
|
291
337
|
});
|
|
292
338
|
} else {
|
|
@@ -311,7 +357,7 @@
|
|
|
311
357
|
});
|
|
312
358
|
}
|
|
313
359
|
const { code, map, metadata, externalDependencies } = result;
|
|
314
|
-
externalDependencies?.forEach((dep) => {
|
|
360
|
+
externalDependencies?.forEach(([dep]) => {
|
|
315
361
|
this.addDependency(dep);
|
|
316
362
|
logger.debug(`added '${dep}' to webpack dependencies`);
|
|
317
363
|
});
|
|
@@ -327,7 +373,7 @@
|
|
|
327
373
|
return [source, inputSourceMap];
|
|
328
374
|
}
|
|
329
375
|
},
|
|
330
|
-
|
|
376
|
+
976: (module) => {
|
|
331
377
|
module.exports = function injectCaller(opts, target) {
|
|
332
378
|
return Object.assign({}, opts, {
|
|
333
379
|
caller: Object.assign(
|
|
@@ -343,10 +389,76 @@
|
|
|
343
389
|
});
|
|
344
390
|
};
|
|
345
391
|
},
|
|
346
|
-
|
|
392
|
+
786: (module) => {
|
|
393
|
+
var objToString = Object.prototype.toString;
|
|
394
|
+
var objKeys = Object.getOwnPropertyNames;
|
|
395
|
+
function serialize(val, isArrayProp) {
|
|
396
|
+
var i, max, str, keys, key, propVal, toStr;
|
|
397
|
+
if (val === true) {
|
|
398
|
+
return "!0";
|
|
399
|
+
}
|
|
400
|
+
if (val === false) {
|
|
401
|
+
return "!1";
|
|
402
|
+
}
|
|
403
|
+
switch (typeof val) {
|
|
404
|
+
case "object":
|
|
405
|
+
if (val === null) {
|
|
406
|
+
return null;
|
|
407
|
+
} else if (val.toJSON && typeof val.toJSON === "function") {
|
|
408
|
+
return serialize(val.toJSON(), isArrayProp);
|
|
409
|
+
} else {
|
|
410
|
+
toStr = objToString.call(val);
|
|
411
|
+
if (toStr === "[object Array]") {
|
|
412
|
+
str = "[";
|
|
413
|
+
max = val.length - 1;
|
|
414
|
+
for (i = 0; i < max; i++) {
|
|
415
|
+
str += serialize(val[i], true) + ",";
|
|
416
|
+
}
|
|
417
|
+
if (max > -1) {
|
|
418
|
+
str += serialize(val[i], true);
|
|
419
|
+
}
|
|
420
|
+
return str + "]";
|
|
421
|
+
} else if (toStr === "[object Object]") {
|
|
422
|
+
keys = objKeys(val).sort();
|
|
423
|
+
max = keys.length;
|
|
424
|
+
str = "{";
|
|
425
|
+
i = 0;
|
|
426
|
+
while (i < max) {
|
|
427
|
+
key = keys[i];
|
|
428
|
+
propVal = serialize(val[key], false);
|
|
429
|
+
if (propVal !== undefined) {
|
|
430
|
+
if (str) {
|
|
431
|
+
str += ",";
|
|
432
|
+
}
|
|
433
|
+
str += '"' + key + '":' + propVal;
|
|
434
|
+
}
|
|
435
|
+
i++;
|
|
436
|
+
}
|
|
437
|
+
return str + "}";
|
|
438
|
+
} else {
|
|
439
|
+
return JSON.stringify(val);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
case "function":
|
|
443
|
+
case "undefined":
|
|
444
|
+
return isArrayProp ? null : undefined;
|
|
445
|
+
case "string":
|
|
446
|
+
return val;
|
|
447
|
+
default:
|
|
448
|
+
return isFinite(val) ? val : null;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
module.exports = function (val) {
|
|
452
|
+
var returnVal = serialize(val, false);
|
|
453
|
+
if (returnVal !== undefined) {
|
|
454
|
+
return "" + returnVal;
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
},
|
|
458
|
+
80: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
347
459
|
const babel = __nccwpck_require__(571);
|
|
348
460
|
const { promisify } = __nccwpck_require__(23);
|
|
349
|
-
const LoaderError = __nccwpck_require__(
|
|
461
|
+
const LoaderError = __nccwpck_require__(698);
|
|
350
462
|
const transform = promisify(babel.transform);
|
|
351
463
|
module.exports = async function (source, options) {
|
|
352
464
|
let result;
|
|
@@ -367,46 +479,319 @@
|
|
|
367
479
|
map,
|
|
368
480
|
metadata,
|
|
369
481
|
sourceType,
|
|
370
|
-
externalDependencies: Array.from(
|
|
482
|
+
externalDependencies: Array.from(
|
|
483
|
+
externalDependencies || [],
|
|
484
|
+
(dep) => [dep],
|
|
485
|
+
).sort(),
|
|
371
486
|
};
|
|
372
487
|
};
|
|
373
488
|
module.exports.version = babel.version;
|
|
374
489
|
},
|
|
375
|
-
|
|
490
|
+
609: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
376
491
|
"use strict";
|
|
377
|
-
|
|
492
|
+
const path = __nccwpck_require__(928);
|
|
493
|
+
const locatePath = __nccwpck_require__(440);
|
|
494
|
+
const pathExists = __nccwpck_require__(374);
|
|
495
|
+
const stop = Symbol("findUp.stop");
|
|
496
|
+
module.exports = async (name, options = {}) => {
|
|
497
|
+
let directory = path.resolve(options.cwd || "");
|
|
498
|
+
const { root } = path.parse(directory);
|
|
499
|
+
const paths = [].concat(name);
|
|
500
|
+
const runMatcher = async (locateOptions) => {
|
|
501
|
+
if (typeof name !== "function") {
|
|
502
|
+
return locatePath(paths, locateOptions);
|
|
503
|
+
}
|
|
504
|
+
const foundPath = await name(locateOptions.cwd);
|
|
505
|
+
if (typeof foundPath === "string") {
|
|
506
|
+
return locatePath([foundPath], locateOptions);
|
|
507
|
+
}
|
|
508
|
+
return foundPath;
|
|
509
|
+
};
|
|
510
|
+
while (true) {
|
|
511
|
+
const foundPath = await runMatcher({ ...options, cwd: directory });
|
|
512
|
+
if (foundPath === stop) {
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
if (foundPath) {
|
|
516
|
+
return path.resolve(directory, foundPath);
|
|
517
|
+
}
|
|
518
|
+
if (directory === root) {
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
directory = path.dirname(directory);
|
|
522
|
+
}
|
|
523
|
+
};
|
|
524
|
+
module.exports.sync = (name, options = {}) => {
|
|
525
|
+
let directory = path.resolve(options.cwd || "");
|
|
526
|
+
const { root } = path.parse(directory);
|
|
527
|
+
const paths = [].concat(name);
|
|
528
|
+
const runMatcher = (locateOptions) => {
|
|
529
|
+
if (typeof name !== "function") {
|
|
530
|
+
return locatePath.sync(paths, locateOptions);
|
|
531
|
+
}
|
|
532
|
+
const foundPath = name(locateOptions.cwd);
|
|
533
|
+
if (typeof foundPath === "string") {
|
|
534
|
+
return locatePath.sync([foundPath], locateOptions);
|
|
535
|
+
}
|
|
536
|
+
return foundPath;
|
|
537
|
+
};
|
|
538
|
+
while (true) {
|
|
539
|
+
const foundPath = runMatcher({ ...options, cwd: directory });
|
|
540
|
+
if (foundPath === stop) {
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
if (foundPath) {
|
|
544
|
+
return path.resolve(directory, foundPath);
|
|
545
|
+
}
|
|
546
|
+
if (directory === root) {
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
directory = path.dirname(directory);
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
module.exports.exists = pathExists;
|
|
553
|
+
module.exports.sync.exists = pathExists.sync;
|
|
554
|
+
module.exports.stop = stop;
|
|
378
555
|
},
|
|
379
|
-
|
|
556
|
+
440: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
380
557
|
"use strict";
|
|
381
|
-
|
|
558
|
+
const path = __nccwpck_require__(928);
|
|
559
|
+
const fs = __nccwpck_require__(896);
|
|
560
|
+
const { promisify } = __nccwpck_require__(23);
|
|
561
|
+
const pLocate = __nccwpck_require__(601);
|
|
562
|
+
const fsStat = promisify(fs.stat);
|
|
563
|
+
const fsLStat = promisify(fs.lstat);
|
|
564
|
+
const typeMappings = { directory: "isDirectory", file: "isFile" };
|
|
565
|
+
function checkType({ type }) {
|
|
566
|
+
if (type in typeMappings) {
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
throw new Error(`Invalid type specified: ${type}`);
|
|
570
|
+
}
|
|
571
|
+
const matchType = (type, stat) =>
|
|
572
|
+
type === undefined || stat[typeMappings[type]]();
|
|
573
|
+
module.exports = async (paths, options) => {
|
|
574
|
+
options = {
|
|
575
|
+
cwd: process.cwd(),
|
|
576
|
+
type: "file",
|
|
577
|
+
allowSymlinks: true,
|
|
578
|
+
...options,
|
|
579
|
+
};
|
|
580
|
+
checkType(options);
|
|
581
|
+
const statFn = options.allowSymlinks ? fsStat : fsLStat;
|
|
582
|
+
return pLocate(
|
|
583
|
+
paths,
|
|
584
|
+
async (path_) => {
|
|
585
|
+
try {
|
|
586
|
+
const stat = await statFn(path.resolve(options.cwd, path_));
|
|
587
|
+
return matchType(options.type, stat);
|
|
588
|
+
} catch {
|
|
589
|
+
return false;
|
|
590
|
+
}
|
|
591
|
+
},
|
|
592
|
+
options,
|
|
593
|
+
);
|
|
594
|
+
};
|
|
595
|
+
module.exports.sync = (paths, options) => {
|
|
596
|
+
options = {
|
|
597
|
+
cwd: process.cwd(),
|
|
598
|
+
allowSymlinks: true,
|
|
599
|
+
type: "file",
|
|
600
|
+
...options,
|
|
601
|
+
};
|
|
602
|
+
checkType(options);
|
|
603
|
+
const statFn = options.allowSymlinks ? fs.statSync : fs.lstatSync;
|
|
604
|
+
for (const path_ of paths) {
|
|
605
|
+
try {
|
|
606
|
+
const stat = statFn(path.resolve(options.cwd, path_));
|
|
607
|
+
if (matchType(options.type, stat)) {
|
|
608
|
+
return path_;
|
|
609
|
+
}
|
|
610
|
+
} catch {}
|
|
611
|
+
}
|
|
612
|
+
};
|
|
382
613
|
},
|
|
383
|
-
|
|
614
|
+
600: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
384
615
|
"use strict";
|
|
385
|
-
|
|
616
|
+
const Queue = __nccwpck_require__(179);
|
|
617
|
+
const pLimit = (concurrency) => {
|
|
618
|
+
if (
|
|
619
|
+
!(
|
|
620
|
+
(Number.isInteger(concurrency) || concurrency === Infinity) &&
|
|
621
|
+
concurrency > 0
|
|
622
|
+
)
|
|
623
|
+
) {
|
|
624
|
+
throw new TypeError(
|
|
625
|
+
"Expected `concurrency` to be a number from 1 and up",
|
|
626
|
+
);
|
|
627
|
+
}
|
|
628
|
+
const queue = new Queue();
|
|
629
|
+
let activeCount = 0;
|
|
630
|
+
const next = () => {
|
|
631
|
+
activeCount--;
|
|
632
|
+
if (queue.size > 0) {
|
|
633
|
+
queue.dequeue()();
|
|
634
|
+
}
|
|
635
|
+
};
|
|
636
|
+
const run = async (fn, resolve, ...args) => {
|
|
637
|
+
activeCount++;
|
|
638
|
+
const result = (async () => fn(...args))();
|
|
639
|
+
resolve(result);
|
|
640
|
+
try {
|
|
641
|
+
await result;
|
|
642
|
+
} catch {}
|
|
643
|
+
next();
|
|
644
|
+
};
|
|
645
|
+
const enqueue = (fn, resolve, ...args) => {
|
|
646
|
+
queue.enqueue(run.bind(null, fn, resolve, ...args));
|
|
647
|
+
(async () => {
|
|
648
|
+
await Promise.resolve();
|
|
649
|
+
if (activeCount < concurrency && queue.size > 0) {
|
|
650
|
+
queue.dequeue()();
|
|
651
|
+
}
|
|
652
|
+
})();
|
|
653
|
+
};
|
|
654
|
+
const generator = (fn, ...args) =>
|
|
655
|
+
new Promise((resolve) => {
|
|
656
|
+
enqueue(fn, resolve, ...args);
|
|
657
|
+
});
|
|
658
|
+
Object.defineProperties(generator, {
|
|
659
|
+
activeCount: { get: () => activeCount },
|
|
660
|
+
pendingCount: { get: () => queue.size },
|
|
661
|
+
clearQueue: {
|
|
662
|
+
value: () => {
|
|
663
|
+
queue.clear();
|
|
664
|
+
},
|
|
665
|
+
},
|
|
666
|
+
});
|
|
667
|
+
return generator;
|
|
668
|
+
};
|
|
669
|
+
module.exports = pLimit;
|
|
386
670
|
},
|
|
387
|
-
|
|
671
|
+
601: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
388
672
|
"use strict";
|
|
389
|
-
|
|
673
|
+
const pLimit = __nccwpck_require__(600);
|
|
674
|
+
class EndError extends Error {
|
|
675
|
+
constructor(value) {
|
|
676
|
+
super();
|
|
677
|
+
this.value = value;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
const testElement = async (element, tester) => tester(await element);
|
|
681
|
+
const finder = async (element) => {
|
|
682
|
+
const values = await Promise.all(element);
|
|
683
|
+
if (values[1] === true) {
|
|
684
|
+
throw new EndError(values[0]);
|
|
685
|
+
}
|
|
686
|
+
return false;
|
|
687
|
+
};
|
|
688
|
+
const pLocate = async (iterable, tester, options) => {
|
|
689
|
+
options = { concurrency: Infinity, preserveOrder: true, ...options };
|
|
690
|
+
const limit = pLimit(options.concurrency);
|
|
691
|
+
const items = [...iterable].map((element) => [
|
|
692
|
+
element,
|
|
693
|
+
limit(testElement, element, tester),
|
|
694
|
+
]);
|
|
695
|
+
const checkLimit = pLimit(options.preserveOrder ? 1 : Infinity);
|
|
696
|
+
try {
|
|
697
|
+
await Promise.all(
|
|
698
|
+
items.map((element) => checkLimit(finder, element)),
|
|
699
|
+
);
|
|
700
|
+
} catch (error) {
|
|
701
|
+
if (error instanceof EndError) {
|
|
702
|
+
return error.value;
|
|
703
|
+
}
|
|
704
|
+
throw error;
|
|
705
|
+
}
|
|
706
|
+
};
|
|
707
|
+
module.exports = pLocate;
|
|
390
708
|
},
|
|
391
|
-
|
|
709
|
+
374: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
392
710
|
"use strict";
|
|
393
|
-
|
|
711
|
+
const fs = __nccwpck_require__(896);
|
|
712
|
+
const { promisify } = __nccwpck_require__(23);
|
|
713
|
+
const pAccess = promisify(fs.access);
|
|
714
|
+
module.exports = async (path) => {
|
|
715
|
+
try {
|
|
716
|
+
await pAccess(path);
|
|
717
|
+
return true;
|
|
718
|
+
} catch (_) {
|
|
719
|
+
return false;
|
|
720
|
+
}
|
|
721
|
+
};
|
|
722
|
+
module.exports.sync = (path) => {
|
|
723
|
+
try {
|
|
724
|
+
fs.accessSync(path);
|
|
725
|
+
return true;
|
|
726
|
+
} catch (_) {
|
|
727
|
+
return false;
|
|
728
|
+
}
|
|
729
|
+
};
|
|
730
|
+
},
|
|
731
|
+
179: (module) => {
|
|
732
|
+
class Node {
|
|
733
|
+
constructor(value) {
|
|
734
|
+
this.value = value;
|
|
735
|
+
this.next = undefined;
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
class Queue {
|
|
739
|
+
constructor() {
|
|
740
|
+
this.clear();
|
|
741
|
+
}
|
|
742
|
+
enqueue(value) {
|
|
743
|
+
const node = new Node(value);
|
|
744
|
+
if (this._head) {
|
|
745
|
+
this._tail.next = node;
|
|
746
|
+
this._tail = node;
|
|
747
|
+
} else {
|
|
748
|
+
this._head = node;
|
|
749
|
+
this._tail = node;
|
|
750
|
+
}
|
|
751
|
+
this._size++;
|
|
752
|
+
}
|
|
753
|
+
dequeue() {
|
|
754
|
+
const current = this._head;
|
|
755
|
+
if (!current) {
|
|
756
|
+
return;
|
|
757
|
+
}
|
|
758
|
+
this._head = this._head.next;
|
|
759
|
+
this._size--;
|
|
760
|
+
return current.value;
|
|
761
|
+
}
|
|
762
|
+
clear() {
|
|
763
|
+
this._head = undefined;
|
|
764
|
+
this._tail = undefined;
|
|
765
|
+
this._size = 0;
|
|
766
|
+
}
|
|
767
|
+
get size() {
|
|
768
|
+
return this._size;
|
|
769
|
+
}
|
|
770
|
+
*[Symbol.iterator]() {
|
|
771
|
+
let current = this._head;
|
|
772
|
+
while (current) {
|
|
773
|
+
yield current.value;
|
|
774
|
+
current = current.next;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
module.exports = Queue;
|
|
394
779
|
},
|
|
395
|
-
|
|
780
|
+
344: (module) => {
|
|
396
781
|
"use strict";
|
|
397
|
-
module.exports = require("
|
|
782
|
+
module.exports = require("./package.json");
|
|
398
783
|
},
|
|
399
|
-
|
|
784
|
+
571: (module) => {
|
|
400
785
|
"use strict";
|
|
401
|
-
module.exports = require("
|
|
786
|
+
module.exports = require("@babel/core");
|
|
402
787
|
},
|
|
403
|
-
|
|
788
|
+
896: (module) => {
|
|
404
789
|
"use strict";
|
|
405
|
-
module.exports = require("
|
|
790
|
+
module.exports = require("fs");
|
|
406
791
|
},
|
|
407
|
-
|
|
792
|
+
943: (module) => {
|
|
408
793
|
"use strict";
|
|
409
|
-
module.exports = require("
|
|
794
|
+
module.exports = require("fs/promises");
|
|
410
795
|
},
|
|
411
796
|
857: (module) => {
|
|
412
797
|
"use strict";
|
|
@@ -424,10 +809,10 @@
|
|
|
424
809
|
"use strict";
|
|
425
810
|
module.exports = require("zlib");
|
|
426
811
|
},
|
|
427
|
-
|
|
812
|
+
690: (module) => {
|
|
428
813
|
"use strict";
|
|
429
814
|
module.exports = JSON.parse(
|
|
430
|
-
'{"type":"object","properties":{"cacheDirectory":{"
|
|
815
|
+
'{"title":"Babel Loader options","type":"object","properties":{"cacheDirectory":{"anyOf":[{"type":"boolean"},{"type":"string"}],"default":false},"cacheIdentifier":{"type":"string"},"cacheCompression":{"type":"boolean","default":true},"customize":{"anyOf":[{"type":"null"},{"type":"string"}],"default":null},"metadataSubscribers":{"type":"array"}},"additionalProperties":true}',
|
|
431
816
|
);
|
|
432
817
|
},
|
|
433
818
|
};
|
|
@@ -451,72 +836,8 @@
|
|
|
451
836
|
}
|
|
452
837
|
return module.exports;
|
|
453
838
|
}
|
|
454
|
-
__nccwpck_require__.m = __webpack_modules__;
|
|
455
|
-
(() => {
|
|
456
|
-
__nccwpck_require__.d = (exports, definition) => {
|
|
457
|
-
for (var key in definition) {
|
|
458
|
-
if (
|
|
459
|
-
__nccwpck_require__.o(definition, key) &&
|
|
460
|
-
!__nccwpck_require__.o(exports, key)
|
|
461
|
-
) {
|
|
462
|
-
Object.defineProperty(exports, key, {
|
|
463
|
-
enumerable: true,
|
|
464
|
-
get: definition[key],
|
|
465
|
-
});
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
};
|
|
469
|
-
})();
|
|
470
|
-
(() => {
|
|
471
|
-
__nccwpck_require__.f = {};
|
|
472
|
-
__nccwpck_require__.e = (chunkId) =>
|
|
473
|
-
Promise.all(
|
|
474
|
-
Object.keys(__nccwpck_require__.f).reduce((promises, key) => {
|
|
475
|
-
__nccwpck_require__.f[key](chunkId, promises);
|
|
476
|
-
return promises;
|
|
477
|
-
}, []),
|
|
478
|
-
);
|
|
479
|
-
})();
|
|
480
|
-
(() => {
|
|
481
|
-
__nccwpck_require__.u = (chunkId) => "" + chunkId + ".index.js";
|
|
482
|
-
})();
|
|
483
|
-
(() => {
|
|
484
|
-
__nccwpck_require__.o = (obj, prop) =>
|
|
485
|
-
Object.prototype.hasOwnProperty.call(obj, prop);
|
|
486
|
-
})();
|
|
487
|
-
(() => {
|
|
488
|
-
__nccwpck_require__.r = (exports) => {
|
|
489
|
-
if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
|
|
490
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
491
|
-
}
|
|
492
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
493
|
-
};
|
|
494
|
-
})();
|
|
495
839
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
496
840
|
__nccwpck_require__.ab = __dirname + "/";
|
|
497
|
-
(
|
|
498
|
-
var installedChunks = { 792: 1 };
|
|
499
|
-
var installChunk = (chunk) => {
|
|
500
|
-
var moreModules = chunk.modules,
|
|
501
|
-
chunkIds = chunk.ids,
|
|
502
|
-
runtime = chunk.runtime;
|
|
503
|
-
for (var moduleId in moreModules) {
|
|
504
|
-
if (__nccwpck_require__.o(moreModules, moduleId)) {
|
|
505
|
-
__nccwpck_require__.m[moduleId] = moreModules[moduleId];
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
if (runtime) runtime(__nccwpck_require__);
|
|
509
|
-
for (var i = 0; i < chunkIds.length; i++)
|
|
510
|
-
installedChunks[chunkIds[i]] = 1;
|
|
511
|
-
};
|
|
512
|
-
__nccwpck_require__.f.require = (chunkId, promises) => {
|
|
513
|
-
if (!installedChunks[chunkId]) {
|
|
514
|
-
if (true) {
|
|
515
|
-
installChunk(require("./" + __nccwpck_require__.u(chunkId)));
|
|
516
|
-
} else installedChunks[chunkId] = 1;
|
|
517
|
-
}
|
|
518
|
-
};
|
|
519
|
-
})();
|
|
520
|
-
var __webpack_exports__ = __nccwpck_require__(603);
|
|
841
|
+
var __webpack_exports__ = __nccwpck_require__(448);
|
|
521
842
|
module.exports = __webpack_exports__;
|
|
522
843
|
})();
|