@rsbuild/core 2.0.0-beta.6 → 2.0.0-beta.7
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/chokidar/index.d.ts +197 -29
- package/compiled/chokidar/package.json +1 -1
- package/compiled/connect/index.d.ts +90 -0
- package/compiled/connect/license +25 -0
- package/compiled/connect/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/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/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 +851 -706
- package/dist/client/hmr.js +1 -1
- package/dist/connect.js +5 -1
- package/dist/launch-editor-middleware.js +11 -10
- package/dist/manifest-plugin.js +5 -5
- package/dist/memfs.js +45 -45
- package/dist/open.js +3 -4
- package/dist/tinyglobby.js +100 -55
- package/dist-types/types/config.d.ts +4 -4
- package/dist-types/types/thirdParty.d.ts +14 -5
- package/package.json +9 -9
- package/compiled/chokidar/handler.d.ts +0 -90
package/dist/tinyglobby.js
CHANGED
|
@@ -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;
|
|
@@ -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 external_url_ = __webpack_require__("url"), 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)=>external_path_.posix.relative(cwd, p) || "." : (p)=>external_path_.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 = external_path_.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);
|
|
@@ -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 ? external_path_.
|
|
1405
|
+
props.depthOffset = newCommonPath.length, props.commonPath = newCommonPath, props.root = newCommonPath.length > 0 ? external_path_.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 ? (0, external_url_.fileURLToPath)(cwd).replace(BACKSLASHES, "/") : external_path_.default.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 || external_fs_.default.readdir,
|
|
1486
|
+
readdirSync: options.fs.readdirSync || external_fs_.default.readdirSync,
|
|
1487
|
+
realpath: options.fs.realpath || external_fs_.default.realpath,
|
|
1488
|
+
realpathSync: options.fs.realpathSync || external_fs_.default.realpathSync,
|
|
1489
|
+
stat: options.fs.stat || external_fs_.default.stat,
|
|
1490
|
+
statSync: options.fs.statSync || external_fs_.default.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 };
|
|
@@ -3,11 +3,11 @@ import type { SecureServerSessionOptions } from 'node:http2';
|
|
|
3
3
|
import type { ServerOptions as HttpsServerOptions } from 'node:https';
|
|
4
4
|
import type { URL } from 'node:url';
|
|
5
5
|
import type { CopyRspackPluginOptions, DefinePluginOptions, Externals, LightningCssMinimizerRspackPluginOptions, ModuleFederationPluginOptions, RuleSetCondition, SwcJsMinimizerRspackPluginOptions, SwcLoaderOptions } from '@rspack/core';
|
|
6
|
-
import type { CorsOptions } from 'cors';
|
|
7
|
-
import type RspackChain from '../../compiled/rspack-chain/types';
|
|
8
|
-
import type { FileDescriptor } from 'rspack-manifest-plugin';
|
|
9
6
|
import type { ChokidarOptions } from '../../compiled/chokidar';
|
|
7
|
+
import type Cors from '../../compiled/cors';
|
|
10
8
|
import type { Options as HttpProxyOptions, Filter as ProxyFilter } from '../../compiled/http-proxy-middleware';
|
|
9
|
+
import type RspackChain from '../../compiled/rspack-chain/types';
|
|
10
|
+
import type { FileDescriptor } from '../../compiled/rspack-manifest-plugin';
|
|
11
11
|
import type { RsbuildDevServer } from '../server/devServer';
|
|
12
12
|
import type { RsbuildPreviewServer } from '../server/previewServer';
|
|
13
13
|
import type { EnvironmentContext, ModifyBundlerChainUtils, ModifyChainUtils, Routes } from './hooks';
|
|
@@ -414,7 +414,7 @@ export interface ServerConfig {
|
|
|
414
414
|
*
|
|
415
415
|
* @link https://github.com/expressjs/cors
|
|
416
416
|
*/
|
|
417
|
-
cors?: boolean | CorsOptions;
|
|
417
|
+
cors?: boolean | Cors.CorsOptions;
|
|
418
418
|
/**
|
|
419
419
|
* Configure proxy rules for the dev server or preview server to proxy requests to
|
|
420
420
|
* the specified service.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CssExtractRspackLoaderOptions, CssExtractRspackPluginOptions } from '@rspack/core';
|
|
2
|
-
import type Connect from 'connect';
|
|
2
|
+
import type Connect from '../../compiled/connect';
|
|
3
3
|
import type HtmlRspackPlugin from '../../compiled/html-rspack-plugin';
|
|
4
4
|
import type { AcceptedPlugin, ProcessOptions } from '../../compiled/postcss';
|
|
5
5
|
import type { Rspack } from './rspack';
|
|
@@ -169,15 +169,24 @@ export interface StyleLoaderOptions {
|
|
|
169
169
|
*/
|
|
170
170
|
attributes?: Record<string, string>;
|
|
171
171
|
/**
|
|
172
|
-
* By default,
|
|
172
|
+
* By default, style-loader appends <style>/<link> elements to the end of the style target,
|
|
173
|
+
* which is the <head> tag of the page unless specified by insert.
|
|
173
174
|
* This will cause CSS created by the loader to take priority over CSS already present in the target.
|
|
174
175
|
* You can use other values if the standard behavior is not suitable for you, but we do not recommend doing this.
|
|
176
|
+
* If you target an iframe, make sure you have sufficient access rights.
|
|
177
|
+
*
|
|
178
|
+
* Supports:
|
|
179
|
+
* - a CSS selector where styles are injected
|
|
180
|
+
* - an absolute path to a custom insert module
|
|
175
181
|
*
|
|
176
182
|
* @default 'head'
|
|
177
183
|
*/
|
|
178
|
-
insert?: LiteralUnion<'head' | 'body', string
|
|
184
|
+
insert?: LiteralUnion<'head' | 'body', string>;
|
|
179
185
|
/**
|
|
180
|
-
* Allows to setup absolute path to custom
|
|
186
|
+
* Allows to setup an absolute path to a custom module that overrides
|
|
187
|
+
* the default styleTagTransform behavior.
|
|
188
|
+
*
|
|
189
|
+
* @default undefined
|
|
181
190
|
*/
|
|
182
|
-
styleTagTransform?: string
|
|
191
|
+
styleTagTransform?: string;
|
|
183
192
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.7",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.rs",
|
|
6
6
|
"bugs": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"types.d.ts"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@rspack/core": "2.0.0-beta.
|
|
39
|
+
"@rspack/core": "2.0.0-beta.5",
|
|
40
40
|
"@swc/helpers": "^0.5.19"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
@@ -53,12 +53,12 @@
|
|
|
53
53
|
"@rslib/core": "0.19.6",
|
|
54
54
|
"@types/connect": "3.4.38",
|
|
55
55
|
"@types/cors": "^2.8.19",
|
|
56
|
-
"@types/node": "^24.
|
|
56
|
+
"@types/node": "^24.11.0",
|
|
57
57
|
"@types/on-finished": "2.3.5",
|
|
58
58
|
"@types/range-parser": "^1.2.7",
|
|
59
59
|
"@types/ws": "^8.18.1",
|
|
60
60
|
"browserslist-load-config": "1.0.1",
|
|
61
|
-
"cac": "^
|
|
61
|
+
"cac": "^7.0.0",
|
|
62
62
|
"chokidar": "^5.0.0",
|
|
63
63
|
"connect": "3.7.0",
|
|
64
64
|
"cors": "^2.8.6",
|
|
@@ -68,25 +68,25 @@
|
|
|
68
68
|
"html-rspack-plugin": "6.1.7",
|
|
69
69
|
"http-proxy-middleware": "^3.0.5",
|
|
70
70
|
"jiti": "^2.6.1",
|
|
71
|
-
"launch-editor-middleware": "^2.13.
|
|
71
|
+
"launch-editor-middleware": "^2.13.1",
|
|
72
72
|
"memfs": "^4.56.10",
|
|
73
73
|
"mrmime": "^2.0.1",
|
|
74
74
|
"on-finished": "2.4.1",
|
|
75
75
|
"open": "^11.0.0",
|
|
76
|
-
"postcss": "^8.5.
|
|
76
|
+
"postcss": "^8.5.8",
|
|
77
77
|
"postcss-load-config": "6.0.1",
|
|
78
78
|
"postcss-loader": "8.2.1",
|
|
79
79
|
"prebundle": "1.6.2",
|
|
80
80
|
"range-parser": "^1.2.1",
|
|
81
81
|
"reduce-configs": "^1.1.1",
|
|
82
82
|
"rslog": "^2.0.0",
|
|
83
|
-
"rspack-chain": "^2.0.0-
|
|
83
|
+
"rspack-chain": "^2.0.0-beta.0",
|
|
84
84
|
"rspack-manifest-plugin": "5.2.1",
|
|
85
85
|
"sirv": "^3.0.2",
|
|
86
86
|
"stacktrace-parser": "^0.1.11",
|
|
87
|
-
"style-loader": "
|
|
87
|
+
"style-loader": "^4.0.0",
|
|
88
88
|
"supports-color": "^10.2.2",
|
|
89
|
-
"tinyglobby": "0.2.
|
|
89
|
+
"tinyglobby": "^0.2.15",
|
|
90
90
|
"typescript": "^5.9.3",
|
|
91
91
|
"webpack-merge": "6.0.1",
|
|
92
92
|
"ws": "^8.19.0"
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import type { FSWatcher as NativeFsWatcher, Stats, WatchEventType } from 'node:fs';
|
|
2
|
-
import type { EntryInfo } from 'readdirp';
|
|
3
|
-
import type { FSWatcher, Throttler, WatchHelper } from './index.js';
|
|
4
|
-
export type Path = string;
|
|
5
|
-
export declare const STR_DATA = "data";
|
|
6
|
-
export declare const STR_END = "end";
|
|
7
|
-
export declare const STR_CLOSE = "close";
|
|
8
|
-
export declare const EMPTY_FN: () => void;
|
|
9
|
-
export declare const IDENTITY_FN: (val: unknown) => unknown;
|
|
10
|
-
export declare const isWindows: boolean;
|
|
11
|
-
export declare const isMacos: boolean;
|
|
12
|
-
export declare const isLinux: boolean;
|
|
13
|
-
export declare const isFreeBSD: boolean;
|
|
14
|
-
export declare const isIBMi: boolean;
|
|
15
|
-
export declare const EVENTS: {
|
|
16
|
-
readonly ALL: "all";
|
|
17
|
-
readonly READY: "ready";
|
|
18
|
-
readonly ADD: "add";
|
|
19
|
-
readonly CHANGE: "change";
|
|
20
|
-
readonly ADD_DIR: "addDir";
|
|
21
|
-
readonly UNLINK: "unlink";
|
|
22
|
-
readonly UNLINK_DIR: "unlinkDir";
|
|
23
|
-
readonly RAW: "raw";
|
|
24
|
-
readonly ERROR: "error";
|
|
25
|
-
};
|
|
26
|
-
export type EventName = (typeof EVENTS)[keyof typeof EVENTS];
|
|
27
|
-
export type FsWatchContainer = {
|
|
28
|
-
listeners: (path: string) => void | Set<any>;
|
|
29
|
-
errHandlers: (err: unknown) => void | Set<any>;
|
|
30
|
-
rawEmitters: (ev: WatchEventType, path: string, opts: unknown) => void | Set<any>;
|
|
31
|
-
watcher: NativeFsWatcher;
|
|
32
|
-
watcherUnusable?: boolean;
|
|
33
|
-
};
|
|
34
|
-
export interface WatchHandlers {
|
|
35
|
-
listener: (path: string) => void;
|
|
36
|
-
errHandler: (err: unknown) => void;
|
|
37
|
-
rawEmitter: (ev: WatchEventType, path: string, opts: unknown) => void;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* @mixin
|
|
41
|
-
*/
|
|
42
|
-
export declare class NodeFsHandler {
|
|
43
|
-
fsw: FSWatcher;
|
|
44
|
-
_boundHandleError: (error: unknown) => void;
|
|
45
|
-
constructor(fsW: FSWatcher);
|
|
46
|
-
/**
|
|
47
|
-
* Watch file for changes with fs_watchFile or fs_watch.
|
|
48
|
-
* @param path to file or dir
|
|
49
|
-
* @param listener on fs change
|
|
50
|
-
* @returns closer for the watcher instance
|
|
51
|
-
*/
|
|
52
|
-
_watchWithNodeFs(path: string, listener: (path: string, newStats?: any) => void | Promise<void>): (() => void) | undefined;
|
|
53
|
-
/**
|
|
54
|
-
* Watch a file and emit add event if warranted.
|
|
55
|
-
* @returns closer for the watcher instance
|
|
56
|
-
*/
|
|
57
|
-
_handleFile(file: Path, stats: Stats, initialAdd: boolean): (() => void) | undefined;
|
|
58
|
-
/**
|
|
59
|
-
* Handle symlinks encountered while reading a dir.
|
|
60
|
-
* @param entry returned by readdirp
|
|
61
|
-
* @param directory path of dir being read
|
|
62
|
-
* @param path of this item
|
|
63
|
-
* @param item basename of this item
|
|
64
|
-
* @returns true if no more processing is needed for this entry.
|
|
65
|
-
*/
|
|
66
|
-
_handleSymlink(entry: EntryInfo, directory: string, path: Path, item: string): Promise<boolean | undefined>;
|
|
67
|
-
_handleRead(directory: string, initialAdd: boolean, wh: WatchHelper, target: Path | undefined, dir: Path, depth: number, throttler: Throttler): Promise<unknown> | undefined;
|
|
68
|
-
/**
|
|
69
|
-
* Read directory to add / remove files from `@watched` list and re-read it on change.
|
|
70
|
-
* @param dir fs path
|
|
71
|
-
* @param stats
|
|
72
|
-
* @param initialAdd
|
|
73
|
-
* @param depth relative to user-supplied path
|
|
74
|
-
* @param target child path targeted for watch
|
|
75
|
-
* @param wh Common watch helpers for this path
|
|
76
|
-
* @param realpath
|
|
77
|
-
* @returns closer for the watcher instance.
|
|
78
|
-
*/
|
|
79
|
-
_handleDir(dir: string, stats: Stats, initialAdd: boolean, depth: number, target: string | undefined, wh: WatchHelper, realpath: string): Promise<(() => void) | undefined>;
|
|
80
|
-
/**
|
|
81
|
-
* Handle added file, directory, or glob pattern.
|
|
82
|
-
* Delegates call to _handleFile / _handleDir after checks.
|
|
83
|
-
* @param path to file or ir
|
|
84
|
-
* @param initialAdd was the file added at watch instantiation?
|
|
85
|
-
* @param priorWh depth relative to user-supplied path
|
|
86
|
-
* @param depth Child path actually targeted for watch
|
|
87
|
-
* @param target Child path actually targeted for watch
|
|
88
|
-
*/
|
|
89
|
-
_addToNodeFs(path: string, initialAdd: boolean, priorWh: WatchHelper | undefined, depth: number, target?: string): Promise<string | false | undefined>;
|
|
90
|
-
}
|