@rsbuild/core 2.1.0-beta.0 → 2.1.0-rc.0
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.
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
|
-
|
|
3
|
+
454: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4
4
|
"use strict";
|
|
5
|
-
const { HtmlWebpackChildCompiler } = __nccwpck_require__(
|
|
5
|
+
const { HtmlWebpackChildCompiler } = __nccwpck_require__(215);
|
|
6
6
|
const compilerMap = new WeakMap();
|
|
7
7
|
class CachedChildCompilation {
|
|
8
8
|
constructor(compiler) {
|
|
@@ -311,7 +311,7 @@
|
|
|
311
311
|
}
|
|
312
312
|
module.exports = { CachedChildCompilation };
|
|
313
313
|
},
|
|
314
|
-
|
|
314
|
+
215: (module) => {
|
|
315
315
|
"use strict";
|
|
316
316
|
class HtmlWebpackChildCompiler {
|
|
317
317
|
constructor(templates) {
|
|
@@ -480,7 +480,7 @@
|
|
|
480
480
|
}
|
|
481
481
|
module.exports = { HtmlWebpackChildCompiler };
|
|
482
482
|
},
|
|
483
|
-
|
|
483
|
+
133: (module) => {
|
|
484
484
|
"use strict";
|
|
485
485
|
module.exports = {};
|
|
486
486
|
module.exports.none = (chunks) => chunks;
|
|
@@ -499,7 +499,7 @@
|
|
|
499
499
|
};
|
|
500
500
|
module.exports.auto = module.exports.none;
|
|
501
501
|
},
|
|
502
|
-
|
|
502
|
+
348: (module) => {
|
|
503
503
|
"use strict";
|
|
504
504
|
module.exports = function (err) {
|
|
505
505
|
return {
|
|
@@ -523,7 +523,7 @@
|
|
|
523
523
|
};
|
|
524
524
|
};
|
|
525
525
|
},
|
|
526
|
-
|
|
526
|
+
651: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
527
527
|
"use strict";
|
|
528
528
|
const { AsyncSeriesWaterfallHook } = __nccwpck_require__(159);
|
|
529
529
|
const htmlWebpackPluginHooksMap = new WeakMap();
|
|
@@ -549,7 +549,7 @@
|
|
|
549
549
|
}
|
|
550
550
|
module.exports = { getHtmlRspackPluginHooks };
|
|
551
551
|
},
|
|
552
|
-
|
|
552
|
+
362: (module) => {
|
|
553
553
|
const voidTags = [
|
|
554
554
|
"area",
|
|
555
555
|
"base",
|
|
@@ -617,19 +617,19 @@
|
|
|
617
617
|
htmlTagObjectToString,
|
|
618
618
|
};
|
|
619
619
|
},
|
|
620
|
-
|
|
620
|
+
667: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
621
621
|
"use strict";
|
|
622
622
|
const promisify = __nccwpck_require__(23).promisify;
|
|
623
623
|
const vm = __nccwpck_require__(154);
|
|
624
624
|
const fs = __nccwpck_require__(896);
|
|
625
625
|
const path = __nccwpck_require__(928);
|
|
626
|
-
const { CachedChildCompilation } = __nccwpck_require__(
|
|
626
|
+
const { CachedChildCompilation } = __nccwpck_require__(454);
|
|
627
627
|
const { createHtmlTagObject, htmlTagObjectToString, HtmlTagArray } =
|
|
628
|
-
__nccwpck_require__(
|
|
629
|
-
const prettyError = __nccwpck_require__(
|
|
630
|
-
const chunkSorter = __nccwpck_require__(
|
|
628
|
+
__nccwpck_require__(362);
|
|
629
|
+
const prettyError = __nccwpck_require__(348);
|
|
630
|
+
const chunkSorter = __nccwpck_require__(133);
|
|
631
631
|
const getHtmlRspackPluginHooks =
|
|
632
|
-
__nccwpck_require__(
|
|
632
|
+
__nccwpck_require__(651).getHtmlRspackPluginHooks;
|
|
633
633
|
const WITH_PLACEHOLDER = "function __with_placeholder__";
|
|
634
634
|
class HtmlRspackPlugin {
|
|
635
635
|
constructor(userOptions = {}) {
|
|
@@ -2398,6 +2398,6 @@
|
|
|
2398
2398
|
}
|
|
2399
2399
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
2400
2400
|
__nccwpck_require__.ab = __dirname + "/";
|
|
2401
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
2401
|
+
var __webpack_exports__ = __nccwpck_require__(667);
|
|
2402
2402
|
module.exports = __webpack_exports__;
|
|
2403
2403
|
})();
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
"use strict";
|
|
3
3
|
var __webpack_modules__ = {
|
|
4
|
-
|
|
5
|
-
module.exports = __nccwpck_require__(
|
|
4
|
+
549: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
5
|
+
module.exports = __nccwpck_require__(735)["default"];
|
|
6
6
|
},
|
|
7
|
-
|
|
7
|
+
735: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
8
8
|
var __webpack_unused_export__;
|
|
9
9
|
__webpack_unused_export__ = { value: true };
|
|
10
10
|
exports["default"] = loader;
|
|
11
11
|
var _nodePath = _interopRequireDefault(__nccwpck_require__(760));
|
|
12
|
-
var _utils = __nccwpck_require__(
|
|
12
|
+
var _utils = __nccwpck_require__(506);
|
|
13
13
|
function _interopRequireDefault(e) {
|
|
14
14
|
return e && e.__esModule ? e : { default: e };
|
|
15
15
|
}
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
callback(null, result.css, map, { ast });
|
|
180
180
|
}
|
|
181
181
|
},
|
|
182
|
-
|
|
182
|
+
506: (module, exports, __nccwpck_require__) => {
|
|
183
183
|
module = __nccwpck_require__.nmd(module);
|
|
184
184
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
185
185
|
exports.exec = exec;
|
|
@@ -716,6 +716,6 @@
|
|
|
716
716
|
})();
|
|
717
717
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
718
718
|
__nccwpck_require__.ab = __dirname + "/";
|
|
719
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
719
|
+
var __webpack_exports__ = __nccwpck_require__(549);
|
|
720
720
|
module.exports = __webpack_exports__;
|
|
721
721
|
})();
|
package/dist/756.js
CHANGED
|
@@ -3497,7 +3497,7 @@ function createPublicContext(context) {
|
|
|
3497
3497
|
async function createContext(options, userConfig, logger) {
|
|
3498
3498
|
let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = join(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0;
|
|
3499
3499
|
return {
|
|
3500
|
-
version: "2.1.0-
|
|
3500
|
+
version: "2.1.0-rc.0",
|
|
3501
3501
|
rootPath,
|
|
3502
3502
|
distPath: '',
|
|
3503
3503
|
cachePath,
|
|
@@ -5118,12 +5118,11 @@ function pluginExternals() {
|
|
|
5118
5118
|
};
|
|
5119
5119
|
}
|
|
5120
5120
|
async function gzipSize(input) {
|
|
5121
|
-
|
|
5121
|
+
return (await new Promise((resolve, reject)=>{
|
|
5122
5122
|
node_zlib.gzip(input, (err, result)=>{
|
|
5123
5123
|
err ? reject(err) : resolve(result);
|
|
5124
5124
|
});
|
|
5125
|
-
});
|
|
5126
|
-
return Buffer.byteLength(data);
|
|
5125
|
+
})).length;
|
|
5127
5126
|
}
|
|
5128
5127
|
function getSnapshotPath(dir, snapshotHash) {
|
|
5129
5128
|
return snapshotHash ? node_path.join(dir, `rsbuild/file-sizes-${snapshotHash}.json`) : node_path.join(dir, 'rsbuild/file-sizes.json');
|
|
@@ -5148,7 +5147,7 @@ async function saveSnapshots(snapshotPath, snapshots, logger) {
|
|
|
5148
5147
|
logger.debug('Failed to save file size snapshots:', err);
|
|
5149
5148
|
}
|
|
5150
5149
|
}
|
|
5151
|
-
let EXCLUDE_ASSET_REGEX = /\.(?:map|LICENSE\.txt|d\.ts)$/,
|
|
5150
|
+
let EXCLUDE_ASSET_REGEX = /\.(?:map|LICENSE\.txt|d\.ts)$/, isSignificantDiff = (diff)=>Math.abs(diff) >= 10, formatDiff = (diff)=>{
|
|
5152
5151
|
let label = `(${diff > 0 ? '+' : '-'}${calcFileSize(Math.abs(diff))})`;
|
|
5153
5152
|
return {
|
|
5154
5153
|
label: (diff > 0 ? color.red : color.green)(label),
|
|
@@ -5173,22 +5172,25 @@ function getHeader(maxFileLength, maxSizeLength, fileHeader, showGzipHeader) {
|
|
|
5173
5172
|
let calcFileSize = (len)=>{
|
|
5174
5173
|
let val = len / 1000;
|
|
5175
5174
|
return `${val.toFixed(val < 1 ? 2 : 1)} kB`;
|
|
5176
|
-
}, COMPRESSIBLE_REGEX = /\.(?:js|css|html|json|svg|txt|xml|xhtml|wasm|manifest|md)$/i
|
|
5177
|
-
|
|
5175
|
+
}, COMPRESSIBLE_REGEX = /\.(?:js|css|html|json|svg|txt|xml|xhtml|wasm|manifest|md)$/i, isCompressible = (assetName)=>COMPRESSIBLE_REGEX.test(assetName), getFilePath = (assetName)=>{
|
|
5176
|
+
let queryIndex = assetName.indexOf('?');
|
|
5177
|
+
return -1 === queryIndex ? assetName : assetName.slice(0, queryIndex);
|
|
5178
|
+
};
|
|
5179
|
+
async function printFileSizes(options, stats, rootPath, distPath, environmentName, previousSizes, saveSnapshot) {
|
|
5178
5180
|
let logs = [], showDetail = !1 !== options.detail, showDiff = !1 !== options.diff && null !== previousSizes, showTotal = !1 !== options.total;
|
|
5179
5181
|
if (!showTotal && !showDetail) return {
|
|
5180
5182
|
logs
|
|
5181
5183
|
};
|
|
5182
|
-
let relativeDistPath = node_path.relative(rootPath, distPath), snapshot = {
|
|
5184
|
+
let relativeDistPath = node_path.relative(rootPath, distPath), snapshot = saveSnapshot ? {
|
|
5183
5185
|
files: {},
|
|
5184
5186
|
totalSize: 0,
|
|
5185
5187
|
totalGzipSize: 0
|
|
5186
|
-
}, formatAsset =
|
|
5187
|
-
let
|
|
5188
|
-
snapshot.files[normalizedPath] = {
|
|
5188
|
+
} : null, formatAsset = (filePath, size, gzippedSize)=>{
|
|
5189
|
+
let normalizedPath = '';
|
|
5190
|
+
(snapshot || showDiff) && (normalizedPath = normalizeFilePath(filePath), snapshot && (snapshot.files[normalizedPath] = {
|
|
5189
5191
|
size,
|
|
5190
5192
|
gzippedSize: gzippedSize ?? void 0
|
|
5191
|
-
};
|
|
5193
|
+
}));
|
|
5192
5194
|
let sizeLabel = calcFileSize(size), sizeLabelLength = sizeLabel.length, gzipSizeLabel = gzippedSize ? getAssetColor(gzippedSize)(calcFileSize(gzippedSize)) : null;
|
|
5193
5195
|
if (showDiff) {
|
|
5194
5196
|
let sizeData = previousSizes[environmentName]?.files[normalizedPath], sizeDiff = size - (sizeData?.size ?? 0);
|
|
@@ -5201,12 +5203,11 @@ async function printFileSizes(options, stats, rootPath, distPath, environmentNam
|
|
|
5201
5203
|
isSignificantDiff(gzipDiff) && (gzipSizeLabel += ` ${formatDiff(gzipDiff).label}`);
|
|
5202
5204
|
}
|
|
5203
5205
|
}
|
|
5204
|
-
let
|
|
5206
|
+
let separatorIndex = filePath.lastIndexOf('/'), folderLabel = (-1 === separatorIndex ? node_path.join(relativeDistPath, '.') : node_path.join(relativeDistPath, filePath.slice(0, separatorIndex))) + node_path.sep, filename = -1 === separatorIndex ? filePath : filePath.slice(separatorIndex + 1);
|
|
5205
5207
|
return {
|
|
5206
5208
|
filePath,
|
|
5207
|
-
filename,
|
|
5208
|
-
|
|
5209
|
-
filenameLength,
|
|
5209
|
+
filenameLabel: color.dim(folderLabel) + (JS_REGEX.test(filename) ? color.cyan(filename) : filename.endsWith('.css') ? color.yellow(filename) : filename.endsWith('.html') ? color.green(filename) : color.magenta(filename)),
|
|
5210
|
+
filenameLength: folderLabel.length + filename.length,
|
|
5210
5211
|
size,
|
|
5211
5212
|
sizeLabel,
|
|
5212
5213
|
sizeLabelLength,
|
|
@@ -5214,21 +5215,21 @@ async function printFileSizes(options, stats, rootPath, distPath, environmentNam
|
|
|
5214
5215
|
gzipSizeLabel
|
|
5215
5216
|
};
|
|
5216
5217
|
}, getAssets = async ()=>{
|
|
5217
|
-
let
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
}
|
|
5229
|
-
|
|
5230
|
-
}
|
|
5231
|
-
return (await Promise.all(
|
|
5218
|
+
let { exclude, include } = options, formattedAssets = [], compilationAssets = stats.compilation.assets;
|
|
5219
|
+
for (let assetName of Object.keys(compilationAssets)){
|
|
5220
|
+
let value = compilationAssets[assetName], filePath = getFilePath(assetName);
|
|
5221
|
+
if (!exclude && EXCLUDE_ASSET_REGEX.test(filePath)) continue;
|
|
5222
|
+
let content = options.compressed && isCompressible(filePath) ? value.source() : void 0, size = void 0 === content ? value.size() : Buffer.byteLength(content);
|
|
5223
|
+
if (exclude || include) {
|
|
5224
|
+
let publicAsset = {
|
|
5225
|
+
name: filePath,
|
|
5226
|
+
size
|
|
5227
|
+
};
|
|
5228
|
+
if (exclude?.(publicAsset) || include && !include(publicAsset)) continue;
|
|
5229
|
+
}
|
|
5230
|
+
void 0 === content ? formattedAssets.push(formatAsset(filePath, size, null)) : formattedAssets.push(gzipSize(content).then((gzippedSize)=>formatAsset(filePath, size, gzippedSize)));
|
|
5231
|
+
}
|
|
5232
|
+
return (await Promise.all(formattedAssets)).sort((a, b)=>a.size - b.size);
|
|
5232
5233
|
}, assets = await getAssets();
|
|
5233
5234
|
if (0 === assets.length) return {
|
|
5234
5235
|
logs
|
|
@@ -5242,7 +5243,7 @@ async function printFileSizes(options, stats, rootPath, distPath, environmentNam
|
|
|
5242
5243
|
totalGzipSize
|
|
5243
5244
|
};
|
|
5244
5245
|
})(assets, options.compressed);
|
|
5245
|
-
snapshot.totalSize = totalSize, snapshot.totalGzipSize = totalGzipSize;
|
|
5246
|
+
snapshot && (snapshot.totalSize = totalSize, snapshot.totalGzipSize = totalGzipSize);
|
|
5246
5247
|
let fileHeader = showDetail ? `File (${environmentName})` : '', { totalSizeTitle, totalSizeLabel, totalSizeLabelLength } = (()=>{
|
|
5247
5248
|
if (!showTotal) return {
|
|
5248
5249
|
totalSizeTitle: '',
|
|
@@ -5273,7 +5274,9 @@ async function printFileSizes(options, stats, rootPath, distPath, environmentNam
|
|
|
5273
5274
|
totalGzipSize
|
|
5274
5275
|
}) : null;
|
|
5275
5276
|
if (showDetail) {
|
|
5276
|
-
let maxFileLength = Math.max(
|
|
5277
|
+
let maxFileLength = Math.max(showTotal ? totalSizeTitle.length : 0, fileHeader.length), maxSizeLength = totalSizeLabelLength, hasGzipSize = !1;
|
|
5278
|
+
for (let asset of assets)asset.filenameLength > maxFileLength && (maxFileLength = asset.filenameLength), asset.sizeLabelLength > maxSizeLength && (maxSizeLength = asset.sizeLabelLength), null !== asset.gzippedSize && (hasGzipSize = !0);
|
|
5279
|
+
let showGzipHeader = !!(options.compressed && hasGzipSize);
|
|
5277
5280
|
for (let asset of (logs.push(getHeader(maxFileLength, maxSizeLength, fileHeader, showGzipHeader)), assets)){
|
|
5278
5281
|
let { sizeLabel, filenameLabel } = asset, { sizeLabelLength, gzipSizeLabel, filenameLength } = asset;
|
|
5279
5282
|
sizeLabelLength < maxSizeLength && (sizeLabel += ' '.repeat(maxSizeLength - sizeLabelLength)), filenameLength < maxFileLength && (filenameLabel += ' '.repeat(maxFileLength - filenameLength));
|
|
@@ -6699,7 +6702,7 @@ function createAssetsMiddleware(context, ready, outputFileSystem) {
|
|
|
6699
6702
|
}
|
|
6700
6703
|
async function setupOutputFileSystem(writeToDisk, compilers) {
|
|
6701
6704
|
if (!0 !== writeToDisk) {
|
|
6702
|
-
let { createFsFromVolume, Volume } = await import("./memfs.js").then(__webpack_require__.t.bind(__webpack_require__, "../../node_modules/.pnpm/memfs@4.57.
|
|
6705
|
+
let { createFsFromVolume, Volume } = await import("./memfs.js").then(__webpack_require__.t.bind(__webpack_require__, "../../node_modules/.pnpm/memfs@4.57.8/node_modules/memfs/lib/index.js", 23)), outputFileSystem = createFsFromVolume(new Volume());
|
|
6703
6706
|
for (let compiler of compilers)compiler.outputFileSystem = outputFileSystem;
|
|
6704
6707
|
}
|
|
6705
6708
|
let compiler = compilers.find((compiler)=>!!compiler.outputFileSystem);
|
|
@@ -8651,7 +8654,7 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
8651
8654
|
...defaultConfig,
|
|
8652
8655
|
...printFileSize
|
|
8653
8656
|
};
|
|
8654
|
-
})(config), statsItem, api.context.rootPath, distPath, name, prevSnapshots);
|
|
8657
|
+
})(config), statsItem, api.context.rootPath, distPath, name, prevSnapshots, showDiff);
|
|
8655
8658
|
return snapshot && (nextSnapshots[name] = snapshot), sizeLogs.join('\n');
|
|
8656
8659
|
})).catch((err)=>{
|
|
8657
8660
|
api.logger.warn('Failed to print file size.'), api.logger.warn(err);
|
|
@@ -9486,7 +9489,7 @@ try {
|
|
|
9486
9489
|
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, isDev })=>{
|
|
9487
9490
|
let { output: { manifest }, dev: { writeToDisk } } = environment.config;
|
|
9488
9491
|
if (!1 === manifest) return;
|
|
9489
|
-
let manifestOptions = normalizeManifestObjectConfig(manifest), { RspackManifestPlugin } = await import("./rspack-manifest-plugin.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.0-
|
|
9492
|
+
let manifestOptions = normalizeManifestObjectConfig(manifest), { RspackManifestPlugin } = await import("./rspack-manifest-plugin.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.0-rc.0/node_modules/rspack-manifest-plugin/dist/index.js")), { htmlPaths } = environment, filter = manifestOptions.filter ?? ((file)=>!file.name.endsWith('.LICENSE.txt'));
|
|
9490
9493
|
manifestFilenames.set(environment.name, manifestOptions.filename);
|
|
9491
9494
|
let pluginOptions = {
|
|
9492
9495
|
fileName: manifestOptions.filename,
|
|
@@ -10021,7 +10024,7 @@ let applyServerOptions = (command)=>{
|
|
|
10021
10024
|
};
|
|
10022
10025
|
function setupCommands() {
|
|
10023
10026
|
let cli = ((name = "")=>new CAC(name))('rsbuild');
|
|
10024
|
-
cli.version("2.1.0-
|
|
10027
|
+
cli.version("2.1.0-rc.0"), cli.option('--base <base>', 'Set the base path of the server').option('-c, --config <config>', 'Set the configuration file (relative or absolute path)').option('--config-loader <loader>', 'Set the config file loader (auto | jiti | native)', {
|
|
10025
10028
|
default: 'auto'
|
|
10026
10029
|
}).option('--env-dir <dir>', 'Set the directory for loading `.env` files').option('--env-mode <mode>', 'Set the env mode to load the `.env.[mode]` file').option('--environment <name>', 'Set the environment name(s) to build', {
|
|
10027
10030
|
type: [
|
|
@@ -10092,7 +10095,7 @@ function initNodeEnv(command) {
|
|
|
10092
10095
|
}
|
|
10093
10096
|
function showGreeting() {
|
|
10094
10097
|
let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
|
|
10095
|
-
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.1.0-
|
|
10098
|
+
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.1.0-rc.0\n`);
|
|
10096
10099
|
}
|
|
10097
10100
|
function setupLogLevel() {
|
|
10098
10101
|
if (cli_argv.length <= 3) return;
|
|
@@ -10114,5 +10117,5 @@ function runCLI() {
|
|
|
10114
10117
|
src_logger.error('Failed to start Rsbuild CLI.'), src_logger.error(err), process.exit(1);
|
|
10115
10118
|
}
|
|
10116
10119
|
}
|
|
10117
|
-
let src_version = "2.1.0-
|
|
10120
|
+
let src_version = "2.1.0-rc.0";
|
|
10118
10121
|
export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, core_rspack as rspack, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, loadConfig_loadConfig as loadConfig, loadEnv, logger_createLogger as createLogger, mergeRsbuildConfig, mrmime_lookup, runCLI, src_logger as logger, src_version as version };
|