@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,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
|
-
;
|