@rsbuild/core 2.0.0-beta.6 → 2.0.0-beta.8
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/bin/rsbuild.js +13 -0
- package/compiled/chokidar/index.d.ts +197 -29
- package/compiled/chokidar/package.json +1 -1
- package/compiled/connect-next/index.d.ts +56 -0
- package/compiled/connect-next/license +26 -0
- package/compiled/connect-next/package.json +1 -0
- package/compiled/cors/index.d.ts +56 -0
- package/compiled/cors/license +22 -0
- package/compiled/cors/package.json +1 -0
- package/compiled/css-loader/index.js +2 -2
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/jiti/dist/babel.cjs +60 -60
- package/compiled/jiti/dist/jiti.cjs +2 -2
- package/compiled/postcss/index.js +1 -1
- package/compiled/postcss/lib/at-rule.d.ts +1 -1
- package/compiled/postcss/lib/comment.d.ts +1 -1
- package/compiled/postcss/lib/container.d.ts +1 -1
- package/compiled/postcss/lib/css-syntax-error.d.ts +1 -1
- package/compiled/postcss/lib/declaration.d.ts +1 -1
- package/compiled/postcss/lib/document.d.ts +1 -1
- package/compiled/postcss/lib/input.d.ts +1 -1
- package/compiled/postcss/lib/lazy-result.d.ts +1 -1
- package/compiled/postcss/lib/no-work-result.d.ts +1 -1
- package/compiled/postcss/lib/node.d.ts +1 -1
- package/compiled/postcss/lib/previous-map.d.ts +1 -1
- package/compiled/postcss/lib/processor.d.ts +1 -1
- package/compiled/postcss/lib/result.d.ts +1 -1
- package/compiled/postcss/lib/root.d.ts +1 -1
- package/compiled/postcss/lib/rule.d.ts +1 -1
- package/compiled/postcss/lib/stringifier.d.ts +1 -1
- package/compiled/postcss/lib/warning.d.ts +1 -1
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rslog/index.d.ts +17 -1
- package/compiled/rslog/package.json +1 -1
- package/compiled/rspack-chain/package.json +1 -1
- package/compiled/rspack-chain/types/index.d.ts +0 -2
- package/compiled/rspack-manifest-plugin/index.d.ts +48 -0
- package/compiled/rspack-manifest-plugin/license +21 -0
- package/compiled/rspack-manifest-plugin/package.json +1 -0
- package/compiled/style-loader/index.js +37 -94
- package/compiled/style-loader/package.json +1 -1
- package/dist/{131.js → 958.js} +1125 -1083
- package/dist/chokidar.js +59 -57
- package/dist/client/hmr.js +2 -2
- package/dist/client/overlay.js +1 -1
- package/dist/connect-next.js +268 -0
- package/dist/{connect.js.LICENSE.txt → connect-next.js.LICENSE.txt} +3 -13
- package/dist/cors.js +2 -2
- package/dist/http-proxy-middleware.js +57 -552
- package/dist/index.js +1 -1
- package/dist/launch-editor-middleware.js +31 -15
- package/dist/manifest-plugin.js +18 -18
- package/dist/memfs.js +217 -756
- package/dist/{710.js → mrmime.js} +2 -1
- package/dist/open.js +36 -34
- package/dist/range-parser.js +2 -2
- package/dist/remapping.js +2 -2
- package/dist/rslib-runtime.js +3 -3
- package/dist/sirv.js +14 -14
- package/dist/src.js +510 -0
- package/dist/tinyglobby.js +114 -69
- package/dist/transformLoader.mjs +38 -1
- package/dist/transformRawLoader.mjs +1 -1
- package/dist/ws.js +1541 -0
- package/dist-types/helpers/index.d.ts +1 -1
- package/dist-types/helpers/vendors.d.ts +0 -1
- package/dist-types/server/runner/asModule.d.ts +1 -1
- package/dist-types/server/socketServer.d.ts +1 -1
- package/dist-types/types/config.d.ts +4 -4
- package/dist-types/types/thirdParty.d.ts +14 -5
- package/package.json +13 -14
- package/compiled/chokidar/handler.d.ts +0 -90
- package/compiled/ws/index.d.ts +0 -437
- package/compiled/ws/index.js +0 -3166
- package/compiled/ws/license +0 -20
- package/compiled/ws/package.json +0 -1
- package/dist/397.js +0 -11
- package/dist/7.js +0 -1
- package/dist/712.js +0 -15
- package/dist/743.js +0 -7
- package/dist/88.js +0 -40
- package/dist/connect.js +0 -570
- package/dist-types/helpers/color.d.ts +0 -4
- /package/dist/{131.js.LICENSE.txt → 958.js.LICENSE.txt} +0 -0
- /package/dist/client/{59.js → 797.js} +0 -0
- /package/dist/{31.js → trace-mapping.js} +0 -0
package/dist/tinyglobby.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
2
|
+
import fs_0, * as __rspack_external_fs from "fs";
|
|
3
|
+
import path_0, { basename, dirname, normalize, posix, relative as external_path_relative, resolve, sep } from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
2
5
|
import { createRequire } from "module";
|
|
3
|
-
import "./131.js";
|
|
4
6
|
__webpack_require__.add({
|
|
5
7
|
"../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
6
8
|
let pico = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js"), utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js");
|
|
@@ -942,11 +944,10 @@ __webpack_require__.add({
|
|
|
942
944
|
};
|
|
943
945
|
}
|
|
944
946
|
});
|
|
945
|
-
let external_path_ = __webpack_require__("path"), external_fs_ = __webpack_require__("fs");
|
|
946
947
|
var __require = createRequire(import.meta.url);
|
|
947
948
|
function cleanPath(path) {
|
|
948
|
-
let normalized =
|
|
949
|
-
return normalized.length > 1 && normalized[normalized.length - 1] ===
|
|
949
|
+
let normalized = normalize(path);
|
|
950
|
+
return normalized.length > 1 && normalized[normalized.length - 1] === sep && (normalized = normalized.substring(0, normalized.length - 1)), normalized;
|
|
950
951
|
}
|
|
951
952
|
let SLASHES_REGEX = /[\\/]/g;
|
|
952
953
|
function convertSlashes(path, separator) {
|
|
@@ -958,14 +959,14 @@ function isRootDirectory(path) {
|
|
|
958
959
|
}
|
|
959
960
|
function normalizePath(path, options) {
|
|
960
961
|
let { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options, pathNeedsCleaning = "win32" === process.platform && path.includes("/") || path.startsWith(".");
|
|
961
|
-
return (resolvePaths && (path =
|
|
962
|
+
return (resolvePaths && (path = resolve(path)), (normalizePath$1 || pathNeedsCleaning) && (path = cleanPath(path)), "." === path) ? "" : convertSlashes(path[path.length - 1] !== pathSeparator ? path + pathSeparator : path, pathSeparator);
|
|
962
963
|
}
|
|
963
964
|
function joinPathWithBasePath(filename, directoryPath) {
|
|
964
965
|
return directoryPath + filename;
|
|
965
966
|
}
|
|
966
967
|
function joinPathWithRelativePath(root, options) {
|
|
967
968
|
return function(filename, directoryPath) {
|
|
968
|
-
return directoryPath.startsWith(root) ? directoryPath.slice(root.length) + filename : convertSlashes((
|
|
969
|
+
return directoryPath.startsWith(root) ? directoryPath.slice(root.length) + filename : convertSlashes(external_path_relative(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
|
|
969
970
|
};
|
|
970
971
|
}
|
|
971
972
|
function joinPath(filename) {
|
|
@@ -1050,10 +1051,10 @@ function build$2(options, isSynchronous) {
|
|
|
1050
1051
|
}
|
|
1051
1052
|
function isRecursive(path, resolved, state) {
|
|
1052
1053
|
if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
|
|
1053
|
-
let parent =
|
|
1054
|
+
let parent = dirname(path), depth = 1;
|
|
1054
1055
|
for(; parent !== state.root && depth < 2;){
|
|
1055
1056
|
let resolvedPath = state.symlinks.get(parent);
|
|
1056
|
-
resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath)) ? depth++ : parent =
|
|
1057
|
+
resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath)) ? depth++ : parent = dirname(parent);
|
|
1057
1058
|
}
|
|
1058
1059
|
return state.symlinks.set(path, resolved), depth > 1;
|
|
1059
1060
|
}
|
|
@@ -1152,7 +1153,7 @@ var Queue = class {
|
|
|
1152
1153
|
""
|
|
1153
1154
|
].slice(0, 0),
|
|
1154
1155
|
controller: new Aborter(),
|
|
1155
|
-
fs: options.fs ||
|
|
1156
|
+
fs: options.fs || __rspack_external_fs
|
|
1156
1157
|
}, this.joinPath = build$7(this.root, options), this.pushDirectory = build$6(this.root, options), this.pushFile = build$5(options), this.getArray = build$4(options), this.groupFiles = build$3(options), this.resolveSymlink = build$2(options, this.isSynchronous), this.walkDirectory = build(this.isSynchronous);
|
|
1157
1158
|
}
|
|
1158
1159
|
start() {
|
|
@@ -1176,8 +1177,7 @@ var Queue = class {
|
|
|
1176
1177
|
this.resolveSymlink(path, this.state, (stat, resolvedPath)=>{
|
|
1177
1178
|
if (stat.isDirectory()) resolvedPath = normalizePath(resolvedPath, this.state.options), exclude && exclude(entry.name, useRealPaths ? resolvedPath : path + pathSeparator) || this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path + pathSeparator, depth - 1, this.walk);
|
|
1178
1179
|
else {
|
|
1179
|
-
resolvedPath = useRealPaths ? resolvedPath : path;
|
|
1180
|
-
let filename = (0, external_path_.basename)(resolvedPath), directoryPath$1 = normalizePath((0, external_path_.dirname)(resolvedPath), this.state.options);
|
|
1180
|
+
let filename = basename(resolvedPath = useRealPaths ? resolvedPath : path), directoryPath$1 = normalizePath(dirname(resolvedPath), this.state.options);
|
|
1181
1181
|
resolvedPath = this.joinPath(filename, directoryPath$1), this.pushFile(resolvedPath, files, this.state.counts, filters);
|
|
1182
1182
|
}
|
|
1183
1183
|
});
|
|
@@ -1197,7 +1197,7 @@ function promise(root, options) {
|
|
|
1197
1197
|
function callback(root, options, callback$1) {
|
|
1198
1198
|
new Walker(root, options, callback$1).start();
|
|
1199
1199
|
}
|
|
1200
|
-
function
|
|
1200
|
+
function sync(root, options) {
|
|
1201
1201
|
return new Walker(root, options).start();
|
|
1202
1202
|
}
|
|
1203
1203
|
var APIBuilder = class {
|
|
@@ -1211,7 +1211,7 @@ var APIBuilder = class {
|
|
|
1211
1211
|
callback(this.root, this.options, cb);
|
|
1212
1212
|
}
|
|
1213
1213
|
sync() {
|
|
1214
|
-
return
|
|
1214
|
+
return sync(this.root, this.options);
|
|
1215
1215
|
}
|
|
1216
1216
|
};
|
|
1217
1217
|
let pm = null;
|
|
@@ -1223,7 +1223,7 @@ var Builder = class {
|
|
|
1223
1223
|
options = {
|
|
1224
1224
|
maxDepth: 1 / 0,
|
|
1225
1225
|
suppressErrors: !0,
|
|
1226
|
-
pathSeparator:
|
|
1226
|
+
pathSeparator: sep,
|
|
1227
1227
|
filters: []
|
|
1228
1228
|
};
|
|
1229
1229
|
globFunction;
|
|
@@ -1305,26 +1305,26 @@ var Builder = class {
|
|
|
1305
1305
|
return isMatch || (isMatch = globFn(patterns, ...options), this.globCache[patterns.join("\0")] = isMatch), this.options.filters.push((path)=>isMatch(path)), this;
|
|
1306
1306
|
}
|
|
1307
1307
|
};
|
|
1308
|
-
let picomatch = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js"), ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
|
|
1309
|
-
function getPartialMatcher(patterns, options) {
|
|
1310
|
-
let patternsCount = patterns.length, patternsParts = Array(patternsCount),
|
|
1308
|
+
let picomatch = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js"), isReadonlyArray = Array.isArray, isWin = "win32" === process.platform, ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
|
|
1309
|
+
function getPartialMatcher(patterns, options = {}) {
|
|
1310
|
+
let patternsCount = patterns.length, patternsParts = Array(patternsCount), matchers = Array(patternsCount), globstarEnabled = !options.noglobstar;
|
|
1311
1311
|
for(let i = 0; i < patternsCount; i++){
|
|
1312
1312
|
let parts = splitPattern(patterns[i]);
|
|
1313
1313
|
patternsParts[i] = parts;
|
|
1314
|
-
let partsCount = parts.length,
|
|
1315
|
-
for(let j = 0; j < partsCount; j++)
|
|
1316
|
-
|
|
1314
|
+
let partsCount = parts.length, partMatchers = Array(partsCount);
|
|
1315
|
+
for(let j = 0; j < partsCount; j++)partMatchers[j] = picomatch(parts[j], options);
|
|
1316
|
+
matchers[i] = partMatchers;
|
|
1317
1317
|
}
|
|
1318
1318
|
return (input)=>{
|
|
1319
1319
|
let inputParts = input.split("/");
|
|
1320
1320
|
if (".." === inputParts[0] && ONLY_PARENT_DIRECTORIES.test(input)) return !0;
|
|
1321
1321
|
for(let i = 0; i < patterns.length; i++){
|
|
1322
|
-
let patternParts = patternsParts[i],
|
|
1322
|
+
let patternParts = patternsParts[i], matcher = matchers[i], inputPatternCount = inputParts.length, minParts = Math.min(inputPatternCount, patternParts.length), j = 0;
|
|
1323
1323
|
for(; j < minParts;){
|
|
1324
1324
|
let part = patternParts[j];
|
|
1325
1325
|
if (part.includes("/")) return !0;
|
|
1326
|
-
if (!
|
|
1327
|
-
if ("**" === part) return !0;
|
|
1326
|
+
if (!matcher[j](inputParts[j])) break;
|
|
1327
|
+
if (globstarEnabled && "**" === part) return !0;
|
|
1328
1328
|
j++;
|
|
1329
1329
|
}
|
|
1330
1330
|
if (j === inputPatternCount) return !0;
|
|
@@ -1332,6 +1332,32 @@ function getPartialMatcher(patterns, options) {
|
|
|
1332
1332
|
return !1;
|
|
1333
1333
|
};
|
|
1334
1334
|
}
|
|
1335
|
+
let WIN32_ROOT_DIR = /^[A-Z]:\/$/i, isRoot = isWin ? (p)=>WIN32_ROOT_DIR.test(p) : (p)=>"/" === p;
|
|
1336
|
+
function buildFormat(cwd, root, absolute) {
|
|
1337
|
+
if (cwd === root || root.startsWith(`${cwd}/`)) {
|
|
1338
|
+
if (absolute) {
|
|
1339
|
+
let start = isRoot(cwd) ? cwd.length : cwd.length + 1;
|
|
1340
|
+
return (p, isDir)=>p.slice(start, isDir ? -1 : void 0) || ".";
|
|
1341
|
+
}
|
|
1342
|
+
let prefix = root.slice(cwd.length + 1);
|
|
1343
|
+
return prefix ? (p, isDir)=>{
|
|
1344
|
+
if ("." === p) return prefix;
|
|
1345
|
+
let result = `${prefix}/${p}`;
|
|
1346
|
+
return isDir ? result.slice(0, -1) : result;
|
|
1347
|
+
} : (p, isDir)=>isDir && "." !== p ? p.slice(0, -1) : p;
|
|
1348
|
+
}
|
|
1349
|
+
return absolute ? (p)=>posix.relative(cwd, p) || "." : (p)=>posix.relative(cwd, `${root}/${p}`) || ".";
|
|
1350
|
+
}
|
|
1351
|
+
function buildRelative(cwd, root) {
|
|
1352
|
+
if (root.startsWith(`${cwd}/`)) {
|
|
1353
|
+
let prefix = root.slice(cwd.length + 1);
|
|
1354
|
+
return (p)=>`${prefix}/${p}`;
|
|
1355
|
+
}
|
|
1356
|
+
return (p)=>{
|
|
1357
|
+
let result = posix.relative(cwd, `${root}/${p}`);
|
|
1358
|
+
return p.endsWith("/") && "" !== result ? `${result}/` : result || ".";
|
|
1359
|
+
};
|
|
1360
|
+
}
|
|
1335
1361
|
let splitPatternOptions = {
|
|
1336
1362
|
parts: !0
|
|
1337
1363
|
};
|
|
@@ -1342,7 +1368,7 @@ function splitPattern(path$1) {
|
|
|
1342
1368
|
path$1
|
|
1343
1369
|
];
|
|
1344
1370
|
}
|
|
1345
|
-
let
|
|
1371
|
+
let POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g, WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g, escapePath = isWin ? (path$1)=>path$1.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&") : (path$1)=>path$1.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
1346
1372
|
function isDynamicPattern(pattern, options) {
|
|
1347
1373
|
if ((null == options ? void 0 : options.caseSensitiveMatch) === !1) return !0;
|
|
1348
1374
|
let scan = picomatch.scan(pattern);
|
|
@@ -1356,12 +1382,12 @@ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
|
|
|
1356
1382
|
let result = pattern;
|
|
1357
1383
|
pattern.endsWith("/") && (result = pattern.slice(0, -1)), !result.endsWith("*") && expandDirectories && (result += "/**");
|
|
1358
1384
|
let escapedCwd = escapePath(cwd);
|
|
1359
|
-
result =
|
|
1385
|
+
result = path_0.isAbsolute(result.replace(ESCAPING_BACKSLASHES, "")) ? posix.relative(escapedCwd, result) : posix.normalize(result);
|
|
1360
1386
|
let parentDirectoryMatch = PARENT_DIRECTORY.exec(result), parts = splitPattern(result);
|
|
1361
1387
|
if (null == parentDirectoryMatch ? void 0 : parentDirectoryMatch[0]) {
|
|
1362
1388
|
let n = (parentDirectoryMatch[0].length + 1) / 3, i = 0, cwdParts = escapedCwd.split("/");
|
|
1363
1389
|
for(; i < n && parts[i + n] === cwdParts[cwdParts.length + i - n];)result = result.slice(0, (n - i - 1) * 3) + result.slice((n - i) * 3 + parts[i + n].length + 1) || ".", i++;
|
|
1364
|
-
let potentialRoot =
|
|
1390
|
+
let potentialRoot = posix.join(cwd, parentDirectoryMatch[0].slice(3 * i));
|
|
1365
1391
|
!potentialRoot.startsWith(".") && props.root.length > potentialRoot.length && (props.root = potentialRoot, props.depthOffset = -n + i);
|
|
1366
1392
|
}
|
|
1367
1393
|
if (!isIgnore && props.depthOffset >= 0) {
|
|
@@ -1376,15 +1402,15 @@ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
|
|
|
1376
1402
|
if (part !== props.commonPath[i] || isDynamicPattern(part) || i === parts.length - 1) break;
|
|
1377
1403
|
newCommonPath.push(part);
|
|
1378
1404
|
}
|
|
1379
|
-
props.depthOffset = newCommonPath.length, props.commonPath = newCommonPath, props.root = newCommonPath.length > 0 ?
|
|
1405
|
+
props.depthOffset = newCommonPath.length, props.commonPath = newCommonPath, props.root = newCommonPath.length > 0 ? posix.join(cwd, ...newCommonPath) : cwd;
|
|
1380
1406
|
}
|
|
1381
1407
|
return result;
|
|
1382
1408
|
}
|
|
1383
|
-
function processPatterns({ patterns
|
|
1384
|
-
"
|
|
1409
|
+
function processPatterns({ patterns = [
|
|
1410
|
+
"**/*"
|
|
1411
|
+
], ignore = [], expandDirectories = !0 }, cwd, props) {
|
|
1412
|
+
"string" == typeof patterns && (patterns = [
|
|
1385
1413
|
patterns
|
|
1386
|
-
] : patterns || (patterns = [
|
|
1387
|
-
"**/*"
|
|
1388
1414
|
]), "string" == typeof ignore && (ignore = [
|
|
1389
1415
|
ignore
|
|
1390
1416
|
]);
|
|
@@ -1396,76 +1422,95 @@ function processPatterns({ patterns, ignore = [], expandDirectories = !0 }, cwd,
|
|
|
1396
1422
|
ignore: ignorePatterns
|
|
1397
1423
|
};
|
|
1398
1424
|
}
|
|
1399
|
-
function
|
|
1400
|
-
return external_path_.posix.relative(cwd, `${root}/${path$1}`) || ".";
|
|
1401
|
-
}
|
|
1402
|
-
function processPath(path$1, cwd, root, isDirectory, absolute) {
|
|
1403
|
-
let relativePath = absolute ? path$1.slice("/" === root ? 1 : root.length + 1) || "." : path$1;
|
|
1404
|
-
return root === cwd ? isDirectory && "." !== relativePath ? relativePath.slice(0, -1) : relativePath : getRelativePath(relativePath, cwd, root);
|
|
1405
|
-
}
|
|
1406
|
-
function formatPaths(paths, cwd, root) {
|
|
1425
|
+
function formatPaths(paths, relative) {
|
|
1407
1426
|
for(let i = paths.length - 1; i >= 0; i--){
|
|
1408
1427
|
let path$1 = paths[i];
|
|
1409
|
-
paths[i] =
|
|
1428
|
+
paths[i] = relative(path$1);
|
|
1410
1429
|
}
|
|
1411
1430
|
return paths;
|
|
1412
1431
|
}
|
|
1413
|
-
function
|
|
1414
|
-
|
|
1432
|
+
function normalizeCwd(cwd) {
|
|
1433
|
+
return cwd ? cwd instanceof URL ? fileURLToPath(cwd).replace(BACKSLASHES, "/") : path_0.resolve(cwd).replace(BACKSLASHES, "/") : process.cwd().replace(BACKSLASHES, "/");
|
|
1434
|
+
}
|
|
1435
|
+
function getCrawler(patterns, inputOptions = {}) {
|
|
1436
|
+
let options = process.env.TINYGLOBBY_DEBUG ? {
|
|
1437
|
+
...inputOptions,
|
|
1438
|
+
debug: !0
|
|
1439
|
+
} : inputOptions, cwd = normalizeCwd(options.cwd);
|
|
1440
|
+
if (options.debug && log("globbing with:", {
|
|
1441
|
+
patterns,
|
|
1442
|
+
options,
|
|
1443
|
+
cwd
|
|
1444
|
+
}), Array.isArray(patterns) && 0 === patterns.length) return [
|
|
1445
|
+
{
|
|
1446
|
+
sync: ()=>[],
|
|
1447
|
+
withPromise: async ()=>[]
|
|
1448
|
+
},
|
|
1449
|
+
!1
|
|
1450
|
+
];
|
|
1415
1451
|
let props = {
|
|
1416
1452
|
root: cwd,
|
|
1417
1453
|
commonPath: null,
|
|
1418
1454
|
depthOffset: 0
|
|
1419
|
-
}, processed = processPatterns(
|
|
1455
|
+
}, processed = processPatterns({
|
|
1456
|
+
...options,
|
|
1457
|
+
patterns
|
|
1458
|
+
}, cwd, props);
|
|
1420
1459
|
options.debug && log("internal processing patterns:", processed);
|
|
1421
|
-
let
|
|
1460
|
+
let matchOptions = {
|
|
1422
1461
|
dot: options.dot,
|
|
1423
|
-
|
|
1462
|
+
nobrace: !1 === options.braceExpansion,
|
|
1463
|
+
nocase: !1 === options.caseSensitiveMatch,
|
|
1464
|
+
noextglob: !1 === options.extglob,
|
|
1465
|
+
noglobstar: !1 === options.globstar,
|
|
1466
|
+
posix: !0
|
|
1467
|
+
}, matcher = picomatch(processed.match, {
|
|
1468
|
+
...matchOptions,
|
|
1424
1469
|
ignore: processed.ignore
|
|
1425
|
-
}), ignore = picomatch(processed.ignore, {
|
|
1426
|
-
dot: options.dot,
|
|
1427
|
-
nocase
|
|
1428
|
-
}), partialMatcher = getPartialMatcher(processed.match, {
|
|
1429
|
-
dot: options.dot,
|
|
1430
|
-
nocase
|
|
1431
|
-
}), fdirOptions = {
|
|
1470
|
+
}), ignore = picomatch(processed.ignore, matchOptions), partialMatcher = getPartialMatcher(processed.match, matchOptions), format = buildFormat(cwd, props.root, options.absolute), formatExclude = options.absolute ? format : buildFormat(cwd, props.root, !0), fdirOptions = {
|
|
1432
1471
|
filters: [
|
|
1433
1472
|
options.debug ? (p, isDirectory)=>{
|
|
1434
|
-
let path$1 =
|
|
1473
|
+
let path$1 = format(p, isDirectory), matches = matcher(path$1);
|
|
1435
1474
|
return matches && log(`matched ${path$1}`), matches;
|
|
1436
|
-
} : (p, isDirectory)=>matcher(
|
|
1475
|
+
} : (p, isDirectory)=>matcher(format(p, isDirectory))
|
|
1437
1476
|
],
|
|
1438
1477
|
exclude: options.debug ? (_, p)=>{
|
|
1439
|
-
let relativePath =
|
|
1478
|
+
let relativePath = formatExclude(p, !0), skipped = "." !== relativePath && !partialMatcher(relativePath) || ignore(relativePath);
|
|
1440
1479
|
return skipped ? log(`skipped ${p}`) : log(`crawling ${p}`), skipped;
|
|
1441
1480
|
} : (_, p)=>{
|
|
1442
|
-
let relativePath =
|
|
1481
|
+
let relativePath = formatExclude(p, !0);
|
|
1443
1482
|
return "." !== relativePath && !partialMatcher(relativePath) || ignore(relativePath);
|
|
1444
1483
|
},
|
|
1484
|
+
fs: options.fs ? {
|
|
1485
|
+
readdir: options.fs.readdir || fs_0.readdir,
|
|
1486
|
+
readdirSync: options.fs.readdirSync || fs_0.readdirSync,
|
|
1487
|
+
realpath: options.fs.realpath || fs_0.realpath,
|
|
1488
|
+
realpathSync: options.fs.realpathSync || fs_0.realpathSync,
|
|
1489
|
+
stat: options.fs.stat || fs_0.stat,
|
|
1490
|
+
statSync: options.fs.statSync || fs_0.statSync
|
|
1491
|
+
} : void 0,
|
|
1445
1492
|
pathSeparator: "/",
|
|
1446
1493
|
relativePaths: !0,
|
|
1447
|
-
resolveSymlinks: !0
|
|
1494
|
+
resolveSymlinks: !0,
|
|
1495
|
+
signal: options.signal
|
|
1448
1496
|
};
|
|
1449
1497
|
void 0 !== options.deep && (fdirOptions.maxDepth = Math.round(options.deep - props.depthOffset)), options.absolute && (fdirOptions.relativePaths = !1, fdirOptions.resolvePaths = !0, fdirOptions.includeBasePath = !0), !1 === options.followSymbolicLinks && (fdirOptions.resolveSymlinks = !1, fdirOptions.excludeSymlinks = !0), options.onlyDirectories ? (fdirOptions.excludeFiles = !0, fdirOptions.includeDirs = !0) : !1 === options.onlyFiles && (fdirOptions.includeDirs = !0), props.root = props.root.replace(BACKSLASHES, "");
|
|
1450
1498
|
let root = props.root;
|
|
1451
1499
|
options.debug && log("internal properties:", props);
|
|
1452
|
-
let
|
|
1453
|
-
return
|
|
1500
|
+
let relative = cwd !== root && !options.absolute && buildRelative(cwd, props.root);
|
|
1501
|
+
return [
|
|
1502
|
+
new Builder(fdirOptions).crawl(root),
|
|
1503
|
+
relative
|
|
1504
|
+
];
|
|
1454
1505
|
}
|
|
1455
1506
|
async function glob(patternsOrOptions, options) {
|
|
1456
1507
|
if (patternsOrOptions && (null == options ? void 0 : options.patterns)) throw Error("Cannot pass patterns as both an argument and an option");
|
|
1457
|
-
let
|
|
1458
|
-
|
|
1459
|
-
patterns: patternsOrOptions
|
|
1460
|
-
} : patternsOrOptions, cwd = opts.cwd ? external_path_.default.resolve(opts.cwd).replace(BACKSLASHES, "/") : process.cwd().replace(BACKSLASHES, "/");
|
|
1461
|
-
return crawl(opts, cwd, !1);
|
|
1508
|
+
let isModern = isReadonlyArray(patternsOrOptions) || "string" == typeof patternsOrOptions, opts = isModern ? options : patternsOrOptions, [crawler, relative] = getCrawler(isModern ? patternsOrOptions : patternsOrOptions.patterns, opts);
|
|
1509
|
+
return relative ? formatPaths(await crawler.withPromise(), relative) : crawler.withPromise();
|
|
1462
1510
|
}
|
|
1463
1511
|
function globSync(patternsOrOptions, options) {
|
|
1464
1512
|
if (patternsOrOptions && (null == options ? void 0 : options.patterns)) throw Error("Cannot pass patterns as both an argument and an option");
|
|
1465
|
-
let
|
|
1466
|
-
|
|
1467
|
-
patterns: patternsOrOptions
|
|
1468
|
-
} : patternsOrOptions, cwd = opts.cwd ? external_path_.default.resolve(opts.cwd).replace(BACKSLASHES, "/") : process.cwd().replace(BACKSLASHES, "/");
|
|
1469
|
-
return crawl(opts, cwd, !0);
|
|
1513
|
+
let isModern = isReadonlyArray(patternsOrOptions) || "string" == typeof patternsOrOptions, opts = isModern ? options : patternsOrOptions, [crawler, relative] = getCrawler(isModern ? patternsOrOptions : patternsOrOptions.patterns, opts);
|
|
1514
|
+
return relative ? formatPaths(crawler.sync(), relative) : crawler.sync();
|
|
1470
1515
|
}
|
|
1471
1516
|
export { glob, globSync };
|
package/dist/transformLoader.mjs
CHANGED
|
@@ -1 +1,38 @@
|
|
|
1
|
-
|
|
1
|
+
let mergeSourceMap = async (originalSourceMap, generatedSourceMap)=>{
|
|
2
|
+
if (!originalSourceMap || !generatedSourceMap) return generatedSourceMap ?? originalSourceMap;
|
|
3
|
+
let { default: remapping } = await import("./remapping.js");
|
|
4
|
+
return remapping([
|
|
5
|
+
generatedSourceMap,
|
|
6
|
+
originalSourceMap
|
|
7
|
+
], ()=>null);
|
|
8
|
+
}, transformLoader = async function transform(source, map) {
|
|
9
|
+
let callback = this.async(), bypass = ()=>{
|
|
10
|
+
callback(null, source, map);
|
|
11
|
+
}, { id: transformId, getEnvironment } = this.getOptions();
|
|
12
|
+
if (!transformId) return void bypass();
|
|
13
|
+
let transform = this._compiler?.__rsbuildTransformer?.[transformId];
|
|
14
|
+
if (!transform) return void bypass();
|
|
15
|
+
try {
|
|
16
|
+
let result = await transform({
|
|
17
|
+
code: source,
|
|
18
|
+
context: this.context,
|
|
19
|
+
resource: this.resource,
|
|
20
|
+
resourcePath: this.resourcePath,
|
|
21
|
+
resourceQuery: this.resourceQuery,
|
|
22
|
+
environment: getEnvironment(),
|
|
23
|
+
addDependency: this.addDependency.bind(this),
|
|
24
|
+
addMissingDependency: this.addMissingDependency.bind(this),
|
|
25
|
+
addContextDependency: this.addContextDependency.bind(this),
|
|
26
|
+
emitFile: this.emitFile.bind(this),
|
|
27
|
+
importModule: this.importModule.bind(this),
|
|
28
|
+
resolve: this.resolve.bind(this)
|
|
29
|
+
});
|
|
30
|
+
if (null == result) return void bypass();
|
|
31
|
+
if ('string' == typeof result || Buffer.isBuffer(result)) return void callback(null, result, map);
|
|
32
|
+
let mergedMap = await mergeSourceMap(map, result.map);
|
|
33
|
+
callback(null, result.code, mergedMap);
|
|
34
|
+
} catch (error) {
|
|
35
|
+
error instanceof Error ? callback(error) : callback(Error(String(error)));
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
export default transformLoader;
|