@rsbuild/plugin-babel 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiled/babel-loader/index.js +474 -153
- package/compiled/babel-loader/package.json +1 -1
- package/dist/index.cjs +17 -19
- package/package.json +9 -9
- package/compiled/babel-loader/611.index.js +0 -411
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
|
-
|
|
3
|
+
272: (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
|
+
124: (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__(790);
|
|
38
|
+
const serialize = __nccwpck_require__(436);
|
|
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
|
+
674: (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__(124);
|
|
188
|
+
const transform = __nccwpck_require__(790);
|
|
189
|
+
const injectCaller = __nccwpck_require__(846);
|
|
190
|
+
const schema = __nccwpck_require__(348);
|
|
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
|
+
846: (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
|
+
436: (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
|
+
790: (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__(272);
|
|
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
|
+
348: (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__(674);
|
|
521
842
|
module.exports = __webpack_exports__;
|
|
522
843
|
})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"babel-loader","author":"Luis Couto <hello@luiscouto.pt>","version":"
|
|
1
|
+
{"name":"babel-loader","author":"Luis Couto <hello@luiscouto.pt>","version":"10.0.0","license":"MIT","types":"index.d.ts","type":"commonjs"}
|
package/dist/index.cjs
CHANGED
|
@@ -13,23 +13,17 @@ function __webpack_require__(moduleId) {
|
|
|
13
13
|
};
|
|
14
14
|
return __webpack_modules__[moduleId](module, module.exports, __webpack_require__), module.exports;
|
|
15
15
|
}
|
|
16
|
-
__webpack_require__.n =
|
|
17
|
-
var getter = module && module.__esModule ?
|
|
18
|
-
return module.default;
|
|
19
|
-
} : function() {
|
|
20
|
-
return module;
|
|
21
|
-
};
|
|
16
|
+
__webpack_require__.n = (module)=>{
|
|
17
|
+
var getter = module && module.__esModule ? ()=>module.default : ()=>module;
|
|
22
18
|
return __webpack_require__.d(getter, {
|
|
23
19
|
a: getter
|
|
24
20
|
}), getter;
|
|
25
|
-
}, __webpack_require__.d =
|
|
21
|
+
}, __webpack_require__.d = (exports1, definition)=>{
|
|
26
22
|
for(var key in definition)__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
|
|
27
23
|
enumerable: !0,
|
|
28
24
|
get: definition[key]
|
|
29
25
|
});
|
|
30
|
-
}, __webpack_require__.o =
|
|
31
|
-
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
32
|
-
}, __webpack_require__.r = function(exports1) {
|
|
26
|
+
}, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports1)=>{
|
|
33
27
|
'undefined' != typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
34
28
|
value: 'Module'
|
|
35
29
|
}), Object.defineProperty(exports1, '__esModule', {
|
|
@@ -37,13 +31,13 @@ __webpack_require__.n = function(module) {
|
|
|
37
31
|
});
|
|
38
32
|
};
|
|
39
33
|
var __webpack_exports__ = {};
|
|
40
|
-
(()=>{
|
|
34
|
+
for(var __webpack_i__ in (()=>{
|
|
41
35
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
|
|
42
|
-
|
|
36
|
+
getBabelUtils: ()=>getBabelUtils,
|
|
43
37
|
getDefaultBabelOptions: ()=>getDefaultBabelOptions,
|
|
38
|
+
pluginBabel: ()=>pluginBabel,
|
|
44
39
|
modifyBabelLoaderOptions: ()=>modifyBabelLoaderOptions,
|
|
45
|
-
|
|
46
|
-
pluginBabel: ()=>pluginBabel
|
|
40
|
+
PLUGIN_BABEL_NAME: ()=>PLUGIN_BABEL_NAME
|
|
47
41
|
});
|
|
48
42
|
let external_node_fs_namespaceObject = require("node:fs");
|
|
49
43
|
var external_node_fs_default = __webpack_require__.n(external_node_fs_namespaceObject);
|
|
@@ -126,7 +120,7 @@ var __webpack_exports__ = {};
|
|
|
126
120
|
};
|
|
127
121
|
async function getCacheIdentifier(options) {
|
|
128
122
|
let identifier = `${process.env.NODE_ENV}${JSON.stringify(options)}`, { version: coreVersion } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "@babel/core")), loaderVersion = JSON.parse(await external_node_fs_default().promises.readFile((0, external_node_path_namespaceObject.join)(plugin_dirname, '../compiled/babel-loader/package.json'), 'utf-8')).version ?? '';
|
|
129
|
-
return identifier
|
|
123
|
+
return identifier += `@babel/core@${coreVersion}babel-loader@${loaderVersion}`;
|
|
130
124
|
}
|
|
131
125
|
let getDefaultBabelOptions = (config, context)=>{
|
|
132
126
|
let isLegacyDecorators = 'legacy' === config.source.decorators.version, options = {
|
|
@@ -177,9 +171,13 @@ var __webpack_exports__ = {};
|
|
|
177
171
|
});
|
|
178
172
|
}
|
|
179
173
|
});
|
|
180
|
-
})()
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
174
|
+
})(), exports.PLUGIN_BABEL_NAME = __webpack_exports__.PLUGIN_BABEL_NAME, exports.getBabelUtils = __webpack_exports__.getBabelUtils, exports.getDefaultBabelOptions = __webpack_exports__.getDefaultBabelOptions, exports.modifyBabelLoaderOptions = __webpack_exports__.modifyBabelLoaderOptions, exports.pluginBabel = __webpack_exports__.pluginBabel, __webpack_exports__)-1 === [
|
|
175
|
+
"PLUGIN_BABEL_NAME",
|
|
176
|
+
"getBabelUtils",
|
|
177
|
+
"getDefaultBabelOptions",
|
|
178
|
+
"modifyBabelLoaderOptions",
|
|
179
|
+
"pluginBabel"
|
|
180
|
+
].indexOf(__webpack_i__) && (exports[__webpack_i__] = __webpack_exports__[__webpack_i__]);
|
|
181
|
+
Object.defineProperty(exports, '__esModule', {
|
|
184
182
|
value: !0
|
|
185
183
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-babel",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Babel plugin for Rsbuild",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,22 +23,22 @@
|
|
|
23
23
|
"compiled"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@babel/core": "^7.26.
|
|
26
|
+
"@babel/core": "^7.26.10",
|
|
27
27
|
"@babel/plugin-proposal-decorators": "^7.25.9",
|
|
28
28
|
"@babel/plugin-transform-class-properties": "^7.25.9",
|
|
29
|
-
"@babel/preset-typescript": "^7.
|
|
29
|
+
"@babel/preset-typescript": "^7.27.0",
|
|
30
30
|
"@types/babel__core": "^7.20.5",
|
|
31
31
|
"deepmerge": "^4.3.1",
|
|
32
32
|
"reduce-configs": "^1.1.0",
|
|
33
33
|
"upath": "2.0.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@rslib/core": "0.
|
|
37
|
-
"@types/node": "^22.
|
|
38
|
-
"babel-loader": "
|
|
39
|
-
"prebundle": "1.
|
|
40
|
-
"typescript": "^5.
|
|
41
|
-
"@rsbuild/core": "1.
|
|
36
|
+
"@rslib/core": "0.6.1",
|
|
37
|
+
"@types/node": "^22.14.0",
|
|
38
|
+
"babel-loader": "10.0.0",
|
|
39
|
+
"prebundle": "1.3.3",
|
|
40
|
+
"typescript": "^5.8.3",
|
|
41
|
+
"@rsbuild/core": "1.3.5",
|
|
42
42
|
"@scripts/test-helper": "1.0.1"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
@@ -1,411 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.id = 611;
|
|
3
|
-
exports.ids = [611];
|
|
4
|
-
exports.modules = {
|
|
5
|
-
|
|
6
|
-
/***/ 887:
|
|
7
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const { sep: DEFAULT_SEPARATOR } = __webpack_require__(928)
|
|
11
|
-
|
|
12
|
-
const determineSeparator = paths => {
|
|
13
|
-
for (const path of paths) {
|
|
14
|
-
const match = /(\/|\\)/.exec(path)
|
|
15
|
-
if (match !== null) return match[0]
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return DEFAULT_SEPARATOR
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
module.exports = function commonPathPrefix (paths, sep = determineSeparator(paths)) {
|
|
22
|
-
const [first = '', ...remaining] = paths
|
|
23
|
-
if (first === '' || remaining.length === 0) return ''
|
|
24
|
-
|
|
25
|
-
const parts = first.split(sep)
|
|
26
|
-
|
|
27
|
-
let endOfPrefix = parts.length
|
|
28
|
-
for (const path of remaining) {
|
|
29
|
-
const compare = path.split(sep)
|
|
30
|
-
for (let i = 0; i < endOfPrefix; i++) {
|
|
31
|
-
if (compare[i] !== parts[i]) {
|
|
32
|
-
endOfPrefix = i
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (endOfPrefix === 0) return ''
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const prefix = parts.slice(0, endOfPrefix).join(sep)
|
|
40
|
-
return prefix.endsWith(sep) ? prefix : prefix + sep
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
/***/ }),
|
|
45
|
-
|
|
46
|
-
/***/ 611:
|
|
47
|
-
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
48
|
-
|
|
49
|
-
// ESM COMPAT FLAG
|
|
50
|
-
__webpack_require__.r(__webpack_exports__);
|
|
51
|
-
|
|
52
|
-
// EXPORTS
|
|
53
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
54
|
-
"default": () => (/* binding */ findCacheDirectory)
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
// EXTERNAL MODULE: external "node:process"
|
|
58
|
-
var external_node_process_ = __webpack_require__(708);
|
|
59
|
-
// EXTERNAL MODULE: external "node:path"
|
|
60
|
-
var external_node_path_ = __webpack_require__(760);
|
|
61
|
-
// EXTERNAL MODULE: external "node:fs"
|
|
62
|
-
var external_node_fs_ = __webpack_require__(24);
|
|
63
|
-
// EXTERNAL MODULE: ../../node_modules/.pnpm/common-path-prefix@3.0.0/node_modules/common-path-prefix/index.js
|
|
64
|
-
var common_path_prefix = __webpack_require__(887);
|
|
65
|
-
// EXTERNAL MODULE: external "node:url"
|
|
66
|
-
var external_node_url_ = __webpack_require__(136);
|
|
67
|
-
;// CONCATENATED MODULE: ../../node_modules/.pnpm/p-locate@6.0.0/node_modules/p-locate/index.js
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
class EndError extends Error {
|
|
71
|
-
constructor(value) {
|
|
72
|
-
super();
|
|
73
|
-
this.value = value;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// The input can also be a promise, so we await it.
|
|
78
|
-
const testElement = async (element, tester) => tester(await element);
|
|
79
|
-
|
|
80
|
-
// The input can also be a promise, so we `Promise.all()` them both.
|
|
81
|
-
const finder = async element => {
|
|
82
|
-
const values = await Promise.all(element);
|
|
83
|
-
if (values[1] === true) {
|
|
84
|
-
throw new EndError(values[0]);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return false;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
async function p_locate_pLocate(
|
|
91
|
-
iterable,
|
|
92
|
-
tester,
|
|
93
|
-
{
|
|
94
|
-
concurrency = Number.POSITIVE_INFINITY,
|
|
95
|
-
preserveOrder = true,
|
|
96
|
-
} = {},
|
|
97
|
-
) {
|
|
98
|
-
const limit = pLimit(concurrency);
|
|
99
|
-
|
|
100
|
-
// Start all the promises concurrently with optional limit.
|
|
101
|
-
const items = [...iterable].map(element => [element, limit(testElement, element, tester)]);
|
|
102
|
-
|
|
103
|
-
// Check the promises either serially or concurrently.
|
|
104
|
-
const checkLimit = pLimit(preserveOrder ? 1 : Number.POSITIVE_INFINITY);
|
|
105
|
-
|
|
106
|
-
try {
|
|
107
|
-
await Promise.all(items.map(element => checkLimit(finder, element)));
|
|
108
|
-
} catch (error) {
|
|
109
|
-
if (error instanceof EndError) {
|
|
110
|
-
return error.value;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
throw error;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
;// CONCATENATED MODULE: ../../node_modules/.pnpm/locate-path@7.2.0/node_modules/locate-path/index.js
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
const typeMappings = {
|
|
125
|
-
directory: 'isDirectory',
|
|
126
|
-
file: 'isFile',
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
function checkType(type) {
|
|
130
|
-
if (Object.hasOwnProperty.call(typeMappings, type)) {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
throw new Error(`Invalid type specified: ${type}`);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
const matchType = (type, stat) => stat[typeMappings[type]]();
|
|
138
|
-
|
|
139
|
-
const toPath = urlOrPath => urlOrPath instanceof URL ? (0,external_node_url_.fileURLToPath)(urlOrPath) : urlOrPath;
|
|
140
|
-
|
|
141
|
-
async function locate_path_locatePath(
|
|
142
|
-
paths,
|
|
143
|
-
{
|
|
144
|
-
cwd = process.cwd(),
|
|
145
|
-
type = 'file',
|
|
146
|
-
allowSymlinks = true,
|
|
147
|
-
concurrency,
|
|
148
|
-
preserveOrder,
|
|
149
|
-
} = {},
|
|
150
|
-
) {
|
|
151
|
-
checkType(type);
|
|
152
|
-
cwd = toPath(cwd);
|
|
153
|
-
|
|
154
|
-
const statFunction = allowSymlinks ? fsPromises.stat : fsPromises.lstat;
|
|
155
|
-
|
|
156
|
-
return pLocate(paths, async path_ => {
|
|
157
|
-
try {
|
|
158
|
-
const stat = await statFunction(path.resolve(cwd, path_));
|
|
159
|
-
return matchType(type, stat);
|
|
160
|
-
} catch {
|
|
161
|
-
return false;
|
|
162
|
-
}
|
|
163
|
-
}, {concurrency, preserveOrder});
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function locatePathSync(
|
|
167
|
-
paths,
|
|
168
|
-
{
|
|
169
|
-
cwd = external_node_process_.cwd(),
|
|
170
|
-
type = 'file',
|
|
171
|
-
allowSymlinks = true,
|
|
172
|
-
} = {},
|
|
173
|
-
) {
|
|
174
|
-
checkType(type);
|
|
175
|
-
cwd = toPath(cwd);
|
|
176
|
-
|
|
177
|
-
const statFunction = allowSymlinks ? external_node_fs_.statSync : external_node_fs_.lstatSync;
|
|
178
|
-
|
|
179
|
-
for (const path_ of paths) {
|
|
180
|
-
try {
|
|
181
|
-
const stat = statFunction(external_node_path_.resolve(cwd, path_), {
|
|
182
|
-
throwIfNoEntry: false,
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
if (!stat) {
|
|
186
|
-
continue;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
if (matchType(type, stat)) {
|
|
190
|
-
return path_;
|
|
191
|
-
}
|
|
192
|
-
} catch {}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
;// CONCATENATED MODULE: ../../node_modules/.pnpm/path-exists@5.0.0/node_modules/path-exists/index.js
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
async function pathExists(path) {
|
|
200
|
-
try {
|
|
201
|
-
await fsPromises.access(path);
|
|
202
|
-
return true;
|
|
203
|
-
} catch {
|
|
204
|
-
return false;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
function pathExistsSync(path) {
|
|
209
|
-
try {
|
|
210
|
-
fs.accessSync(path);
|
|
211
|
-
return true;
|
|
212
|
-
} catch {
|
|
213
|
-
return false;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
;// CONCATENATED MODULE: ../../node_modules/.pnpm/find-up@6.3.0/node_modules/find-up/index.js
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
const find_up_toPath = urlOrPath => urlOrPath instanceof URL ? (0,external_node_url_.fileURLToPath)(urlOrPath) : urlOrPath;
|
|
223
|
-
|
|
224
|
-
const findUpStop = Symbol('findUpStop');
|
|
225
|
-
|
|
226
|
-
async function findUpMultiple(name, options = {}) {
|
|
227
|
-
let directory = path.resolve(find_up_toPath(options.cwd) || '');
|
|
228
|
-
const {root} = path.parse(directory);
|
|
229
|
-
const stopAt = path.resolve(directory, options.stopAt || root);
|
|
230
|
-
const limit = options.limit || Number.POSITIVE_INFINITY;
|
|
231
|
-
const paths = [name].flat();
|
|
232
|
-
|
|
233
|
-
const runMatcher = async locateOptions => {
|
|
234
|
-
if (typeof name !== 'function') {
|
|
235
|
-
return locatePath(paths, locateOptions);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
const foundPath = await name(locateOptions.cwd);
|
|
239
|
-
if (typeof foundPath === 'string') {
|
|
240
|
-
return locatePath([foundPath], locateOptions);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
return foundPath;
|
|
244
|
-
};
|
|
245
|
-
|
|
246
|
-
const matches = [];
|
|
247
|
-
// eslint-disable-next-line no-constant-condition
|
|
248
|
-
while (true) {
|
|
249
|
-
// eslint-disable-next-line no-await-in-loop
|
|
250
|
-
const foundPath = await runMatcher({...options, cwd: directory});
|
|
251
|
-
|
|
252
|
-
if (foundPath === findUpStop) {
|
|
253
|
-
break;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
if (foundPath) {
|
|
257
|
-
matches.push(path.resolve(directory, foundPath));
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
if (directory === stopAt || matches.length >= limit) {
|
|
261
|
-
break;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
directory = path.dirname(directory);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
return matches;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
function findUpMultipleSync(name, options = {}) {
|
|
271
|
-
let directory = external_node_path_.resolve(find_up_toPath(options.cwd) || '');
|
|
272
|
-
const {root} = external_node_path_.parse(directory);
|
|
273
|
-
const stopAt = options.stopAt || root;
|
|
274
|
-
const limit = options.limit || Number.POSITIVE_INFINITY;
|
|
275
|
-
const paths = [name].flat();
|
|
276
|
-
|
|
277
|
-
const runMatcher = locateOptions => {
|
|
278
|
-
if (typeof name !== 'function') {
|
|
279
|
-
return locatePathSync(paths, locateOptions);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
const foundPath = name(locateOptions.cwd);
|
|
283
|
-
if (typeof foundPath === 'string') {
|
|
284
|
-
return locatePathSync([foundPath], locateOptions);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
return foundPath;
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
const matches = [];
|
|
291
|
-
// eslint-disable-next-line no-constant-condition
|
|
292
|
-
while (true) {
|
|
293
|
-
const foundPath = runMatcher({...options, cwd: directory});
|
|
294
|
-
|
|
295
|
-
if (foundPath === findUpStop) {
|
|
296
|
-
break;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
if (foundPath) {
|
|
300
|
-
matches.push(external_node_path_.resolve(directory, foundPath));
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
if (directory === stopAt || matches.length >= limit) {
|
|
304
|
-
break;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
directory = external_node_path_.dirname(directory);
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
return matches;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
async function find_up_findUp(name, options = {}) {
|
|
314
|
-
const matches = await findUpMultiple(name, {...options, limit: 1});
|
|
315
|
-
return matches[0];
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
function findUpSync(name, options = {}) {
|
|
319
|
-
const matches = findUpMultipleSync(name, {...options, limit: 1});
|
|
320
|
-
return matches[0];
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
;// CONCATENATED MODULE: ../../node_modules/.pnpm/pkg-dir@7.0.0/node_modules/pkg-dir/index.js
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
async function packageDirectory({cwd} = {}) {
|
|
330
|
-
const filePath = await findUp('package.json', {cwd});
|
|
331
|
-
return filePath && path.dirname(filePath);
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
function packageDirectorySync({cwd} = {}) {
|
|
335
|
-
const filePath = findUpSync('package.json', {cwd});
|
|
336
|
-
return filePath && external_node_path_.dirname(filePath);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
;// CONCATENATED MODULE: ../../node_modules/.pnpm/find-cache-dir@4.0.0/node_modules/find-cache-dir/index.js
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
const {env, cwd} = external_node_process_;
|
|
347
|
-
|
|
348
|
-
const isWritable = path => {
|
|
349
|
-
try {
|
|
350
|
-
external_node_fs_.accessSync(path, external_node_fs_.constants.W_OK);
|
|
351
|
-
return true;
|
|
352
|
-
} catch {
|
|
353
|
-
return false;
|
|
354
|
-
}
|
|
355
|
-
};
|
|
356
|
-
|
|
357
|
-
function useDirectory(directory, options) {
|
|
358
|
-
if (options.create) {
|
|
359
|
-
external_node_fs_.mkdirSync(directory, {recursive: true});
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
if (options.thunk) {
|
|
363
|
-
return (...arguments_) => external_node_path_.join(directory, ...arguments_);
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
return directory;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
function getNodeModuleDirectory(directory) {
|
|
370
|
-
const nodeModules = external_node_path_.join(directory, 'node_modules');
|
|
371
|
-
|
|
372
|
-
if (
|
|
373
|
-
!isWritable(nodeModules)
|
|
374
|
-
&& (external_node_fs_.existsSync(nodeModules) || !isWritable(external_node_path_.join(directory)))
|
|
375
|
-
) {
|
|
376
|
-
return;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
return nodeModules;
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
function findCacheDirectory(options = {}) {
|
|
383
|
-
if (env.CACHE_DIR && !['true', 'false', '1', '0'].includes(env.CACHE_DIR)) {
|
|
384
|
-
return useDirectory(external_node_path_.join(env.CACHE_DIR, options.name), options);
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
let {cwd: directory = cwd()} = options;
|
|
388
|
-
|
|
389
|
-
if (options.files) {
|
|
390
|
-
directory = common_path_prefix(options.files.map(file => external_node_path_.resolve(directory, file)));
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
directory = packageDirectorySync({cwd: directory});
|
|
394
|
-
|
|
395
|
-
if (!directory) {
|
|
396
|
-
return;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
const nodeModules = getNodeModuleDirectory(directory);
|
|
400
|
-
if (!nodeModules) {
|
|
401
|
-
return;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
return useDirectory(external_node_path_.join(directory, 'node_modules', '.cache', options.name), options);
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
/***/ })
|
|
409
|
-
|
|
410
|
-
};
|
|
411
|
-
;
|