@rsbuild/core 1.2.12 → 1.2.13
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.
|
@@ -4449,14 +4449,15 @@
|
|
|
4449
4449
|
return a.start - b.start;
|
|
4450
4450
|
}
|
|
4451
4451
|
},
|
|
4452
|
-
|
|
4452
|
+
4189: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4453
4453
|
"use strict";
|
|
4454
|
-
const
|
|
4455
|
-
const
|
|
4456
|
-
const
|
|
4457
|
-
const
|
|
4458
|
-
const
|
|
4459
|
-
const
|
|
4454
|
+
const { logger } = __nccwpck_require__(8679);
|
|
4455
|
+
const middleware = __nccwpck_require__(7217);
|
|
4456
|
+
const getFilenameFromUrl = __nccwpck_require__(5513);
|
|
4457
|
+
const setupHooks = __nccwpck_require__(2628);
|
|
4458
|
+
const setupWriteToDisk = __nccwpck_require__(495);
|
|
4459
|
+
const setupOutputFileSystem = __nccwpck_require__(6372);
|
|
4460
|
+
const ready = __nccwpck_require__(4480);
|
|
4460
4461
|
const noop = () => {};
|
|
4461
4462
|
function wdm(compiler, options = {}) {
|
|
4462
4463
|
const context = {
|
|
@@ -4465,7 +4466,6 @@
|
|
|
4465
4466
|
callbacks: [],
|
|
4466
4467
|
options,
|
|
4467
4468
|
compiler,
|
|
4468
|
-
logger: compiler.getInfrastructureLogger("webpack-dev-middleware"),
|
|
4469
4469
|
};
|
|
4470
4470
|
setupHooks(context);
|
|
4471
4471
|
if (options.writeToDisk) {
|
|
@@ -4477,7 +4477,10 @@
|
|
|
4477
4477
|
} else {
|
|
4478
4478
|
const errorHandler = (error) => {
|
|
4479
4479
|
if (error) {
|
|
4480
|
-
|
|
4480
|
+
if (error.message && error.message.includes("× Error:")) {
|
|
4481
|
+
error.message = error.message.replace("× Error:", "").trim();
|
|
4482
|
+
}
|
|
4483
|
+
logger.error(error);
|
|
4481
4484
|
}
|
|
4482
4485
|
};
|
|
4483
4486
|
if (Array.isArray(context.compiler.compilers)) {
|
|
@@ -4511,14 +4514,15 @@
|
|
|
4511
4514
|
}
|
|
4512
4515
|
module.exports = wdm;
|
|
4513
4516
|
},
|
|
4514
|
-
|
|
4517
|
+
7217: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4515
4518
|
"use strict";
|
|
4516
4519
|
const mrmime = __nccwpck_require__(8311);
|
|
4520
|
+
const { logger } = __nccwpck_require__(8679);
|
|
4517
4521
|
const onFinishedStream = __nccwpck_require__(21);
|
|
4518
|
-
const getFilenameFromUrl = __nccwpck_require__(
|
|
4519
|
-
const ready = __nccwpck_require__(
|
|
4520
|
-
const parseTokenList = __nccwpck_require__(
|
|
4521
|
-
const memorize = __nccwpck_require__(
|
|
4522
|
+
const getFilenameFromUrl = __nccwpck_require__(5513);
|
|
4523
|
+
const ready = __nccwpck_require__(4480);
|
|
4524
|
+
const parseTokenList = __nccwpck_require__(1855);
|
|
4525
|
+
const memorize = __nccwpck_require__(2297);
|
|
4522
4526
|
async function getEtag(stat) {
|
|
4523
4527
|
const mtime = stat.mtime.getTime().toString(16);
|
|
4524
4528
|
const size = stat.size.toString(16);
|
|
@@ -4610,7 +4614,7 @@
|
|
|
4610
4614
|
return;
|
|
4611
4615
|
}
|
|
4612
4616
|
function sendError(status, options) {
|
|
4613
|
-
const escapeHtml = __nccwpck_require__(
|
|
4617
|
+
const escapeHtml = __nccwpck_require__(2117);
|
|
4614
4618
|
const content = statuses[status] || String(status);
|
|
4615
4619
|
const document = Buffer.from(
|
|
4616
4620
|
`<!DOCTYPE html>\n<html lang="en">\n<head>\n<meta charset="utf-8">\n<title>Error</title>\n</head>\n<body>\n<pre>${escapeHtml(content)}</pre>\n</body>\n</html>`,
|
|
@@ -4769,7 +4773,9 @@
|
|
|
4769
4773
|
const filename = getFilenameFromUrl(context, req.url, extra);
|
|
4770
4774
|
if (extra.errorCode) {
|
|
4771
4775
|
if (extra.errorCode === 403) {
|
|
4772
|
-
|
|
4776
|
+
logger.error(
|
|
4777
|
+
`[rsbuild-dev-middleware] Malicious path "${filename}".`,
|
|
4778
|
+
);
|
|
4773
4779
|
}
|
|
4774
4780
|
sendError(extra.errorCode);
|
|
4775
4781
|
return;
|
|
@@ -4836,7 +4842,9 @@
|
|
|
4836
4842
|
parsedRanges = [];
|
|
4837
4843
|
}
|
|
4838
4844
|
if (parsedRanges === -1) {
|
|
4839
|
-
|
|
4845
|
+
logger.error(
|
|
4846
|
+
"[rsbuild-dev-middleware] Unsatisfiable range for 'Range' header.",
|
|
4847
|
+
);
|
|
4840
4848
|
res.setHeader(
|
|
4841
4849
|
"Content-Range",
|
|
4842
4850
|
getValueContentRangeHeader("bytes", size),
|
|
@@ -4847,12 +4855,12 @@
|
|
|
4847
4855
|
return;
|
|
4848
4856
|
}
|
|
4849
4857
|
if (parsedRanges === -2) {
|
|
4850
|
-
|
|
4851
|
-
"A malformed 'Range' header was provided. A regular response will be sent for this request.",
|
|
4858
|
+
logger.error(
|
|
4859
|
+
"[rsbuild-dev-middleware] A malformed 'Range' header was provided. A regular response will be sent for this request.",
|
|
4852
4860
|
);
|
|
4853
4861
|
} else if (parsedRanges.length > 1) {
|
|
4854
|
-
|
|
4855
|
-
"A 'Range' header with multiple ranges was provided. Multiple ranges are not supported, so a regular response will be sent for this request.",
|
|
4862
|
+
logger.error(
|
|
4863
|
+
"[rsbuild-dev-middleware] A 'Range' header with multiple ranges was provided. Multiple ranges are not supported, so a regular response will be sent for this request.",
|
|
4856
4864
|
);
|
|
4857
4865
|
}
|
|
4858
4866
|
if (parsedRanges !== -2 && parsedRanges.length === 1) {
|
|
@@ -4915,7 +4923,7 @@
|
|
|
4915
4923
|
}
|
|
4916
4924
|
module.exports = wrapper;
|
|
4917
4925
|
},
|
|
4918
|
-
|
|
4926
|
+
2117: (module) => {
|
|
4919
4927
|
"use strict";
|
|
4920
4928
|
const matchHtmlRegExp = /["'&<>]/;
|
|
4921
4929
|
function escapeHtml(string) {
|
|
@@ -4960,13 +4968,13 @@
|
|
|
4960
4968
|
}
|
|
4961
4969
|
module.exports = escapeHtml;
|
|
4962
4970
|
},
|
|
4963
|
-
|
|
4971
|
+
5513: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4964
4972
|
"use strict";
|
|
4965
4973
|
const path = __nccwpck_require__(6928);
|
|
4966
4974
|
const { parse } = __nccwpck_require__(7016);
|
|
4967
4975
|
const querystring = __nccwpck_require__(3480);
|
|
4968
|
-
const getPaths = __nccwpck_require__(
|
|
4969
|
-
const memorize = __nccwpck_require__(
|
|
4976
|
+
const getPaths = __nccwpck_require__(4803);
|
|
4977
|
+
const memorize = __nccwpck_require__(2297);
|
|
4970
4978
|
const memoizedParse = memorize(parse, undefined, (value) => {
|
|
4971
4979
|
if (value.pathname) {
|
|
4972
4980
|
value.pathname = decode(value.pathname);
|
|
@@ -5049,7 +5057,7 @@
|
|
|
5049
5057
|
}
|
|
5050
5058
|
module.exports = getFilenameFromUrl;
|
|
5051
5059
|
},
|
|
5052
|
-
|
|
5060
|
+
4803: (module) => {
|
|
5053
5061
|
"use strict";
|
|
5054
5062
|
function getPaths(context) {
|
|
5055
5063
|
const { stats, options } = context;
|
|
@@ -5070,7 +5078,7 @@
|
|
|
5070
5078
|
}
|
|
5071
5079
|
module.exports = getPaths;
|
|
5072
5080
|
},
|
|
5073
|
-
|
|
5081
|
+
2297: (module) => {
|
|
5074
5082
|
"use strict";
|
|
5075
5083
|
const cacheStore = new WeakMap();
|
|
5076
5084
|
function memorize(fn, { cache = new Map() } = {}, callback) {
|
|
@@ -5092,7 +5100,7 @@
|
|
|
5092
5100
|
}
|
|
5093
5101
|
module.exports = memorize;
|
|
5094
5102
|
},
|
|
5095
|
-
|
|
5103
|
+
1855: (module) => {
|
|
5096
5104
|
"use strict";
|
|
5097
5105
|
function parseTokenList(str) {
|
|
5098
5106
|
let end = 0;
|
|
@@ -5125,28 +5133,26 @@
|
|
|
5125
5133
|
}
|
|
5126
5134
|
module.exports = parseTokenList;
|
|
5127
5135
|
},
|
|
5128
|
-
|
|
5136
|
+
4480: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
5129
5137
|
"use strict";
|
|
5138
|
+
const { logger } = __nccwpck_require__(8679);
|
|
5130
5139
|
function ready(context, callback, req) {
|
|
5131
5140
|
if (context.state) {
|
|
5132
5141
|
callback(context.stats);
|
|
5133
5142
|
return;
|
|
5134
5143
|
}
|
|
5135
5144
|
const name = (req && req.url) || callback.name;
|
|
5136
|
-
|
|
5137
|
-
`wait until bundle finished${name ? `: ${name}` : ""}`,
|
|
5145
|
+
logger.debug(
|
|
5146
|
+
`[rsbuild-dev-middleware] wait until bundle finished${name ? `: ${name}` : ""}`,
|
|
5138
5147
|
);
|
|
5139
5148
|
context.callbacks.push(callback);
|
|
5140
5149
|
}
|
|
5141
5150
|
module.exports = ready;
|
|
5142
5151
|
},
|
|
5143
|
-
|
|
5152
|
+
2628: (module) => {
|
|
5144
5153
|
"use strict";
|
|
5145
5154
|
function setupHooks(context) {
|
|
5146
5155
|
function invalid() {
|
|
5147
|
-
if (context.state) {
|
|
5148
|
-
context.logger.log("Compilation starting...");
|
|
5149
|
-
}
|
|
5150
5156
|
context.state = false;
|
|
5151
5157
|
context.stats = undefined;
|
|
5152
5158
|
}
|
|
@@ -5154,11 +5160,10 @@
|
|
|
5154
5160
|
context.state = true;
|
|
5155
5161
|
context.stats = stats;
|
|
5156
5162
|
process.nextTick(() => {
|
|
5157
|
-
const {
|
|
5163
|
+
const { state, callbacks } = context;
|
|
5158
5164
|
if (!state) {
|
|
5159
5165
|
return;
|
|
5160
5166
|
}
|
|
5161
|
-
logger.log("Compilation finished");
|
|
5162
5167
|
context.callbacks = [];
|
|
5163
5168
|
callbacks.forEach((callback) => {
|
|
5164
5169
|
callback(stats);
|
|
@@ -5172,7 +5177,7 @@
|
|
|
5172
5177
|
}
|
|
5173
5178
|
module.exports = setupHooks;
|
|
5174
5179
|
},
|
|
5175
|
-
|
|
5180
|
+
6372: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
5176
5181
|
"use strict";
|
|
5177
5182
|
const memfs = __nccwpck_require__(5590);
|
|
5178
5183
|
function setupOutputFileSystem(context) {
|
|
@@ -5199,10 +5204,11 @@
|
|
|
5199
5204
|
}
|
|
5200
5205
|
module.exports = setupOutputFileSystem;
|
|
5201
5206
|
},
|
|
5202
|
-
|
|
5207
|
+
495: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
5203
5208
|
"use strict";
|
|
5204
5209
|
const fs = __nccwpck_require__(9896);
|
|
5205
5210
|
const path = __nccwpck_require__(6928);
|
|
5211
|
+
const { logger } = __nccwpck_require__(8679);
|
|
5206
5212
|
function setupWriteToDisk(context) {
|
|
5207
5213
|
const compilers = context.compiler.compilers || [context.compiler];
|
|
5208
5214
|
for (const compiler of compilers) {
|
|
@@ -5228,20 +5234,20 @@
|
|
|
5228
5234
|
: "";
|
|
5229
5235
|
return fs.mkdir(dir, { recursive: true }, (mkdirError) => {
|
|
5230
5236
|
if (mkdirError) {
|
|
5231
|
-
|
|
5232
|
-
|
|
5237
|
+
logger.error(
|
|
5238
|
+
`[rsbuild-dev-middleware] ${name}Unable to write "${dir}" directory to disk:\n${mkdirError}`,
|
|
5233
5239
|
);
|
|
5234
5240
|
return callback(mkdirError);
|
|
5235
5241
|
}
|
|
5236
5242
|
return fs.writeFile(targetPath, content, (writeFileError) => {
|
|
5237
5243
|
if (writeFileError) {
|
|
5238
|
-
|
|
5239
|
-
|
|
5244
|
+
logger.error(
|
|
5245
|
+
`[rsbuild-dev-middleware] ${name}Unable to write "${targetPath}" asset to disk:\n${writeFileError}`,
|
|
5240
5246
|
);
|
|
5241
5247
|
return callback(writeFileError);
|
|
5242
5248
|
}
|
|
5243
|
-
|
|
5244
|
-
|
|
5249
|
+
logger.debug(
|
|
5250
|
+
`[rsbuild-dev-middleware] ${name}Asset written to disk: "${targetPath}"`,
|
|
5245
5251
|
);
|
|
5246
5252
|
return callback();
|
|
5247
5253
|
});
|
|
@@ -6118,6 +6124,10 @@
|
|
|
6118
6124
|
"use strict";
|
|
6119
6125
|
module.exports = require("../mrmime");
|
|
6120
6126
|
},
|
|
6127
|
+
8679: (module) => {
|
|
6128
|
+
"use strict";
|
|
6129
|
+
module.exports = require("../rslog");
|
|
6130
|
+
},
|
|
6121
6131
|
2613: (module) => {
|
|
6122
6132
|
"use strict";
|
|
6123
6133
|
module.exports = require("assert");
|
|
@@ -6185,6 +6195,6 @@
|
|
|
6185
6195
|
}
|
|
6186
6196
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
6187
6197
|
__nccwpck_require__.ab = __dirname + "/";
|
|
6188
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
6198
|
+
var __webpack_exports__ = __nccwpck_require__(4189);
|
|
6189
6199
|
module.exports = __webpack_exports__;
|
|
6190
6200
|
})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"rsbuild-dev-middleware","author":"Tobias Koppers @sokra","version":"0.
|
|
1
|
+
{"name":"rsbuild-dev-middleware","author":"Tobias Koppers @sokra","version":"0.2.0","funding":{"type":"opencollective","url":"https://opencollective.com/webpack"},"license":"MIT","types":"index.d.ts","type":"commonjs"}
|
package/dist/index.cjs
CHANGED
|
@@ -521,7 +521,7 @@ var __webpack_exports__ = {};
|
|
|
521
521
|
withFileTypes: !0
|
|
522
522
|
});
|
|
523
523
|
await Promise.all(entries.map(async (entry)=>{
|
|
524
|
-
let fullPath = external_node_path_default().
|
|
524
|
+
let fullPath = external_node_path_default().join(dir, entry.name);
|
|
525
525
|
!keep.some((reg)=>reg.test(toPosixPath(fullPath))) && (entry.isDirectory() ? (await emptyDir(fullPath, keep, !1), keep.length || await external_node_fs_default().promises.rmdir(fullPath)) : await external_node_fs_default().promises.unlink(fullPath));
|
|
526
526
|
}));
|
|
527
527
|
} catch (err) {
|
|
@@ -772,7 +772,9 @@ var __webpack_exports__ = {};
|
|
|
772
772
|
if (seconds < 60) return `${format(seconds.toFixed(1))} s`;
|
|
773
773
|
let minutes = seconds / 60;
|
|
774
774
|
return `${format(minutes.toFixed(2))} m`;
|
|
775
|
-
}, isTTY = (type = 'stdout')=>('stdin' === type ? process.stdin.isTTY : process.stdout.isTTY) && !process.env.CI
|
|
775
|
+
}, isTTY = (type = 'stdout')=>('stdin' === type ? process.stdin.isTTY : process.stdout.isTTY) && !process.env.CI, addCompilationError = (compilation, message)=>{
|
|
776
|
+
compilation.errors.push(new compilation.compiler.webpack.WebpackError(message));
|
|
777
|
+
};
|
|
776
778
|
function loadEnv({ cwd = process.cwd(), mode = getNodeEnv(), prefixes = [
|
|
777
779
|
'PUBLIC_'
|
|
778
780
|
], processEnv = process.env } = {}) {
|
|
@@ -916,7 +918,7 @@ var __webpack_exports__ = {};
|
|
|
916
918
|
merged[key] = mergeConfig_merge(x[key], y[key], childPath);
|
|
917
919
|
}
|
|
918
920
|
return merged;
|
|
919
|
-
}, mergeRsbuildConfig = (...configs)=>2 === configs.length ? mergeConfig_merge(configs[0], configs[1]) : configs.length < 2 ? configs[0] : configs.reduce((result, config)=>mergeConfig_merge(result, config), {}), commonOpts = {}, getEnvDir = (cwd, envDir)=>envDir ? external_node_path_default().isAbsolute(envDir) ? envDir : external_node_path_default().
|
|
921
|
+
}, mergeRsbuildConfig = (...configs)=>2 === configs.length ? mergeConfig_merge(configs[0], configs[1]) : configs.length < 2 ? configs[0] : configs.reduce((result, config)=>mergeConfig_merge(result, config), {}), commonOpts = {}, getEnvDir = (cwd, envDir)=>envDir ? external_node_path_default().isAbsolute(envDir) ? envDir : external_node_path_default().join(cwd, envDir) : cwd;
|
|
920
922
|
async function init({ cliOptions, isRestart, isBuildWatch = !1 }) {
|
|
921
923
|
cliOptions && (commonOpts = cliOptions);
|
|
922
924
|
try {
|
|
@@ -1742,7 +1744,7 @@ var __webpack_exports__ = {};
|
|
|
1742
1744
|
async function createContext(options, userConfig, bundlerType) {
|
|
1743
1745
|
let { cwd } = options, rootPath = userConfig.root ? getAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, external_node_path_namespaceObject.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0;
|
|
1744
1746
|
return {
|
|
1745
|
-
version: "1.2.
|
|
1747
|
+
version: "1.2.13",
|
|
1746
1748
|
rootPath,
|
|
1747
1749
|
distPath: '',
|
|
1748
1750
|
cachePath,
|
|
@@ -1821,12 +1823,24 @@ var __webpack_exports__ = {};
|
|
|
1821
1823
|
if (!appIcon) return;
|
|
1822
1824
|
let distDir = config.output.distPath.image, manifestFile = appIcon.filename ?? 'manifest.webmanifest', publicPath = getPublicPathFromCompiler(compilation), icons = appIcon.icons.map((icon)=>formatIcon(icon, distDir, publicPath)), tags = [];
|
|
1823
1825
|
for (let icon of icons){
|
|
1824
|
-
if ('web-app-manifest' === icon.target && !appIcon.name)
|
|
1826
|
+
if ('web-app-manifest' === icon.target && !appIcon.name) {
|
|
1827
|
+
addCompilationError(compilation, '[rsbuild:app-icon] "appIcon.name" is required when "target" is "web-app-manifest".');
|
|
1828
|
+
continue;
|
|
1829
|
+
}
|
|
1825
1830
|
if (!icon.isURL) {
|
|
1826
|
-
if (!compilation.inputFileSystem)
|
|
1827
|
-
|
|
1831
|
+
if (!compilation.inputFileSystem) {
|
|
1832
|
+
addCompilationError(compilation, '[rsbuild:app-icon] Failed to read the icon file as "compilation.inputFileSystem" is not available.');
|
|
1833
|
+
continue;
|
|
1834
|
+
}
|
|
1835
|
+
if (!await fileExistsByCompilation(compilation, icon.absolutePath)) {
|
|
1836
|
+
addCompilationError(compilation, `[rsbuild:app-icon] Failed to find the icon file at "${index_js_default().cyan(icon.absolutePath)}".`);
|
|
1837
|
+
continue;
|
|
1838
|
+
}
|
|
1828
1839
|
let source = await (0, external_node_util_namespaceObject.promisify)(compilation.inputFileSystem.readFile)(icon.absolutePath);
|
|
1829
|
-
if (!source)
|
|
1840
|
+
if (!source) {
|
|
1841
|
+
addCompilationError(compilation, `[rsbuild:app-icon] Failed to read the icon file at "${index_js_default().cyan(icon.absolutePath)}".`);
|
|
1842
|
+
continue;
|
|
1843
|
+
}
|
|
1830
1844
|
compilation.emitAsset(icon.relativePath, new sources.RawSource(source));
|
|
1831
1845
|
}
|
|
1832
1846
|
('apple-touch-icon' === icon.target || !icon.target && icon.size < 200) && tags.push({
|
|
@@ -2043,7 +2057,7 @@ var __webpack_exports__ = {};
|
|
|
2043
2057
|
javascript: {
|
|
2044
2058
|
exportsPresence: 'error'
|
|
2045
2059
|
}
|
|
2046
|
-
}), isDev && config.dev.hmr && 'web' === target && chain.plugin(CHAIN_ID.PLUGIN.HMR).use(bundler.HotModuleReplacementPlugin), 'development' === env && chain.output.devtoolModuleFilenameTemplate((info)=>toPosixPath(
|
|
2060
|
+
}), isDev && config.dev.hmr && 'web' === target && chain.plugin(CHAIN_ID.PLUGIN.HMR).use(bundler.HotModuleReplacementPlugin), 'development' === env && chain.output.devtoolModuleFilenameTemplate((info)=>toPosixPath(info.absoluteResourcePath)), process.env.RSPACK_CONFIG_VALIDATE ||= 'loose-unrecognized-keys', process.env.WATCHPACK_WATCHER_LIMIT ||= '20', process.env.EXPERIMENTAL_RSPACK_INCREMENTAL && chain.experiments({
|
|
2047
2061
|
...chain.get('experiments'),
|
|
2048
2062
|
incremental: isDev
|
|
2049
2063
|
});
|
|
@@ -2614,16 +2628,25 @@ var __webpack_exports__ = {};
|
|
|
2614
2628
|
class RsbuildHtmlPlugin {
|
|
2615
2629
|
apply(compiler) {
|
|
2616
2630
|
let emitFavicon = async (compilation, favicon)=>{
|
|
2631
|
+
let buffer;
|
|
2617
2632
|
let name = external_node_path_default().basename(favicon);
|
|
2618
2633
|
if (compilation.assets[name]) return name;
|
|
2619
|
-
if (!compilation.inputFileSystem)
|
|
2620
|
-
let filename = external_node_path_default().
|
|
2621
|
-
|
|
2622
|
-
|
|
2634
|
+
if (!compilation.inputFileSystem) return addCompilationError(compilation, '[rsbuild:html] Failed to read the favicon file as "compilation.inputFileSystem" is not available.'), null;
|
|
2635
|
+
let filename = external_node_path_default().isAbsolute(favicon) ? favicon : external_node_path_default().join(compilation.compiler.context, favicon);
|
|
2636
|
+
try {
|
|
2637
|
+
if (!(buffer = await (0, external_node_util_namespaceObject.promisify)(compilation.inputFileSystem.readFile)(filename))) throw Error('Buffer is undefined');
|
|
2638
|
+
} catch (error) {
|
|
2639
|
+
return rslog_index_js_namespaceObject.logger.debug(`read favicon error: ${error}`), addCompilationError(compilation, `[rsbuild:html] Failed to read the favicon file at "${index_js_default().cyan(filename)}".`), null;
|
|
2640
|
+
}
|
|
2641
|
+
let source = new compiler.webpack.sources.RawSource(buffer, !1);
|
|
2623
2642
|
return compilation.emitAsset(name, source), name;
|
|
2624
2643
|
}, addFavicon = async (headTags, favicon, compilation, publicPath)=>{
|
|
2625
2644
|
let href = favicon;
|
|
2626
|
-
|
|
2645
|
+
if (!isURL(favicon)) {
|
|
2646
|
+
let name = await emitFavicon(compilation, favicon);
|
|
2647
|
+
if (null === name) return;
|
|
2648
|
+
href = ensureAssetPrefix(name, publicPath);
|
|
2649
|
+
}
|
|
2627
2650
|
let tag = {
|
|
2628
2651
|
tagName: 'link',
|
|
2629
2652
|
voidTag: !0,
|
|
@@ -2676,7 +2699,7 @@ var __webpack_exports__ = {};
|
|
|
2676
2699
|
templatePath: void 0,
|
|
2677
2700
|
templateContent: getDefaultTemplateContent(config.html.mountId)
|
|
2678
2701
|
};
|
|
2679
|
-
let absolutePath = (0, external_node_path_namespaceObject.isAbsolute)(templatePath) ? templatePath : external_node_path_default().
|
|
2702
|
+
let absolutePath = (0, external_node_path_namespaceObject.isAbsolute)(templatePath) ? templatePath : external_node_path_default().join(rootPath, templatePath);
|
|
2680
2703
|
if (!existTemplatePath.has(absolutePath)) {
|
|
2681
2704
|
if (!await isFileExists(absolutePath)) throw Error(`[rsbuild:html] Failed to resolve HTML template, please check if the file exists: ${index_js_default().cyan(absolutePath)}`);
|
|
2682
2705
|
existTemplatePath.add(absolutePath);
|
|
@@ -4648,7 +4671,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4648
4671
|
}
|
|
4649
4672
|
updateStats(stats) {
|
|
4650
4673
|
let compilationId = getCompilationId(stats.compilation);
|
|
4651
|
-
this.stats[compilationId] = stats, this.sendStats({
|
|
4674
|
+
this.stats[compilationId] = stats, this.sockets.length && this.sendStats({
|
|
4652
4675
|
compilationId
|
|
4653
4676
|
});
|
|
4654
4677
|
}
|
|
@@ -5559,7 +5582,10 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5559
5582
|
getPublicPathFromCompiler(compiler)
|
|
5560
5583
|
], compilerDevMiddleware = new CompilerDevMiddleware({
|
|
5561
5584
|
dev: devConfig,
|
|
5562
|
-
server:
|
|
5585
|
+
server: {
|
|
5586
|
+
...config.server,
|
|
5587
|
+
port
|
|
5588
|
+
},
|
|
5563
5589
|
publicPaths: publicPaths,
|
|
5564
5590
|
compiler,
|
|
5565
5591
|
environments: options.context.environments
|
|
@@ -6180,35 +6206,29 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6180
6206
|
let pluginName = 'RsbuildCorePlugin';
|
|
6181
6207
|
chain.plugin(pluginName).use(class {
|
|
6182
6208
|
apply(compiler) {
|
|
6183
|
-
for (let { handler, environment: pluginEnvironment } of (compiler.__rsbuildTransformer = transformer, resolveFns)){
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
}));
|
|
6192
|
-
});
|
|
6193
|
-
}
|
|
6209
|
+
for (let { handler, environment: pluginEnvironment } of (compiler.__rsbuildTransformer = transformer, resolveFns))(!pluginEnvironment || isPluginMatchEnvironment(pluginEnvironment, environment.name)) && compiler.hooks.compilation.tap(pluginName, (compilation, { normalModuleFactory })=>{
|
|
6210
|
+
normalModuleFactory.hooks.resolve.tapPromise(pluginName, async (resolveData)=>handler({
|
|
6211
|
+
compiler,
|
|
6212
|
+
compilation,
|
|
6213
|
+
environment,
|
|
6214
|
+
resolveData
|
|
6215
|
+
}));
|
|
6216
|
+
});
|
|
6194
6217
|
compiler.hooks.thisCompilation.tap(pluginName, (compilation)=>{
|
|
6195
6218
|
compilation.hooks.childCompiler.tap(pluginName, (childCompiler)=>{
|
|
6196
6219
|
childCompiler.__rsbuildTransformer = transformer;
|
|
6197
6220
|
});
|
|
6198
6221
|
let { sources } = compiler.webpack;
|
|
6199
|
-
for (let { descriptor, handler, environment: pluginEnvironment } of processAssetsFns){
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
sources
|
|
6210
|
-
}));
|
|
6211
|
-
}
|
|
6222
|
+
for (let { descriptor, handler, environment: pluginEnvironment } of processAssetsFns)(!descriptor.targets || descriptor.targets.includes(target)) && (!descriptor.environments || descriptor.environments.includes(environment.name)) && (!pluginEnvironment || isPluginMatchEnvironment(pluginEnvironment, environment.name)) && compilation.hooks.processAssets.tapPromise({
|
|
6223
|
+
name: pluginName,
|
|
6224
|
+
stage: mapProcessAssetsStage(compiler, descriptor.stage)
|
|
6225
|
+
}, async (assets)=>handler({
|
|
6226
|
+
assets,
|
|
6227
|
+
compiler,
|
|
6228
|
+
compilation,
|
|
6229
|
+
environment,
|
|
6230
|
+
sources
|
|
6231
|
+
}));
|
|
6212
6232
|
});
|
|
6213
6233
|
}
|
|
6214
6234
|
constructor(){
|
|
@@ -6723,12 +6743,12 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6723
6743
|
}
|
|
6724
6744
|
}(), process.title = 'rsbuild-node';
|
|
6725
6745
|
let { npm_execpath } = process.env;
|
|
6726
|
-
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.2.
|
|
6746
|
+
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.2.13\n`);
|
|
6727
6747
|
}();
|
|
6728
6748
|
try {
|
|
6729
6749
|
!function() {
|
|
6730
6750
|
let cli = dist('rsbuild');
|
|
6731
|
-
cli.help(), cli.version("1.2.
|
|
6751
|
+
cli.help(), cli.version("1.2.13"), applyCommonOptions(cli);
|
|
6732
6752
|
let devCommand = cli.command('dev', 'starting the dev server'), buildCommand = cli.command('build', 'build the app for production'), previewCommand = cli.command('preview', 'preview the production build locally'), inspectCommand = cli.command('inspect', 'inspect the Rspack and Rsbuild configs');
|
|
6733
6753
|
applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
|
|
6734
6754
|
try {
|
|
@@ -6779,7 +6799,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6779
6799
|
rslog_index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), rslog_index_js_namespaceObject.logger.error(err);
|
|
6780
6800
|
}
|
|
6781
6801
|
}
|
|
6782
|
-
let src_rslib_entry_version = "1.2.
|
|
6802
|
+
let src_rslib_entry_version = "1.2.13";
|
|
6783
6803
|
})();
|
|
6784
6804
|
var __webpack_export_target__ = exports;
|
|
6785
6805
|
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
package/dist/index.js
CHANGED
|
@@ -434,7 +434,7 @@ async function emptyDir(dir, keep = [], checkExists = !0) {
|
|
|
434
434
|
withFileTypes: !0
|
|
435
435
|
});
|
|
436
436
|
await Promise.all(entries.map(async (entry)=>{
|
|
437
|
-
let fullPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.
|
|
437
|
+
let fullPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(dir, entry.name);
|
|
438
438
|
!keep.some((reg)=>reg.test(toPosixPath(fullPath))) && (entry.isDirectory() ? (await emptyDir(fullPath, keep, !1), keep.length || await __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.default.promises.rmdir(fullPath)) : await __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.default.promises.unlink(fullPath));
|
|
439
439
|
}));
|
|
440
440
|
} catch (err) {
|
|
@@ -685,7 +685,9 @@ let camelCase = (input)=>input.replace(/[-_](\w)/g, (_, c)=>c.toUpperCase()), pr
|
|
|
685
685
|
if (seconds < 60) return `${format(seconds.toFixed(1))} s`;
|
|
686
686
|
let minutes = seconds / 60;
|
|
687
687
|
return `${format(minutes.toFixed(2))} m`;
|
|
688
|
-
}, isTTY = (type = 'stdout')=>('stdin' === type ? process.stdin.isTTY : process.stdout.isTTY) && !process.env.CI
|
|
688
|
+
}, isTTY = (type = 'stdout')=>('stdin' === type ? process.stdin.isTTY : process.stdout.isTTY) && !process.env.CI, addCompilationError = (compilation, message)=>{
|
|
689
|
+
compilation.errors.push(new compilation.compiler.webpack.WebpackError(message));
|
|
690
|
+
};
|
|
689
691
|
function loadEnv({ cwd = process.cwd(), mode = getNodeEnv(), prefixes = [
|
|
690
692
|
'PUBLIC_'
|
|
691
693
|
], processEnv = process.env } = {}) {
|
|
@@ -825,7 +827,7 @@ let configCache = {}, OVERRIDE_PATHS = [
|
|
|
825
827
|
merged[key] = mergeConfig_merge(x[key], y[key], childPath);
|
|
826
828
|
}
|
|
827
829
|
return merged;
|
|
828
|
-
}, mergeRsbuildConfig = (...configs)=>2 === configs.length ? mergeConfig_merge(configs[0], configs[1]) : configs.length < 2 ? configs[0] : configs.reduce((result, config)=>mergeConfig_merge(result, config), {}), commonOpts = {}, getEnvDir = (cwd, envDir)=>envDir ? __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.isAbsolute(envDir) ? envDir : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.
|
|
830
|
+
}, mergeRsbuildConfig = (...configs)=>2 === configs.length ? mergeConfig_merge(configs[0], configs[1]) : configs.length < 2 ? configs[0] : configs.reduce((result, config)=>mergeConfig_merge(result, config), {}), commonOpts = {}, getEnvDir = (cwd, envDir)=>envDir ? __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.isAbsolute(envDir) ? envDir : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(cwd, envDir) : cwd;
|
|
829
831
|
async function init({ cliOptions, isRestart, isBuildWatch = !1 }) {
|
|
830
832
|
cliOptions && (commonOpts = cliOptions);
|
|
831
833
|
try {
|
|
@@ -1651,7 +1653,7 @@ async function updateEnvironmentContext(context, configs) {
|
|
|
1651
1653
|
async function createContext(options, userConfig, bundlerType) {
|
|
1652
1654
|
let { cwd } = options, rootPath = userConfig.root ? getAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0;
|
|
1653
1655
|
return {
|
|
1654
|
-
version: "1.2.
|
|
1656
|
+
version: "1.2.13",
|
|
1655
1657
|
rootPath,
|
|
1656
1658
|
distPath: '',
|
|
1657
1659
|
cachePath,
|
|
@@ -1730,12 +1732,24 @@ let pluginAppIcon = ()=>({
|
|
|
1730
1732
|
if (!appIcon) return;
|
|
1731
1733
|
let distDir = config.output.distPath.image, manifestFile = appIcon.filename ?? 'manifest.webmanifest', publicPath = getPublicPathFromCompiler(compilation), icons = appIcon.icons.map((icon)=>formatIcon(icon, distDir, publicPath)), tags = [];
|
|
1732
1734
|
for (let icon of icons){
|
|
1733
|
-
if ('web-app-manifest' === icon.target && !appIcon.name)
|
|
1735
|
+
if ('web-app-manifest' === icon.target && !appIcon.name) {
|
|
1736
|
+
addCompilationError(compilation, '[rsbuild:app-icon] "appIcon.name" is required when "target" is "web-app-manifest".');
|
|
1737
|
+
continue;
|
|
1738
|
+
}
|
|
1734
1739
|
if (!icon.isURL) {
|
|
1735
|
-
if (!compilation.inputFileSystem)
|
|
1736
|
-
|
|
1740
|
+
if (!compilation.inputFileSystem) {
|
|
1741
|
+
addCompilationError(compilation, '[rsbuild:app-icon] Failed to read the icon file as "compilation.inputFileSystem" is not available.');
|
|
1742
|
+
continue;
|
|
1743
|
+
}
|
|
1744
|
+
if (!await fileExistsByCompilation(compilation, icon.absolutePath)) {
|
|
1745
|
+
addCompilationError(compilation, `[rsbuild:app-icon] Failed to find the icon file at "${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.cyan(icon.absolutePath)}".`);
|
|
1746
|
+
continue;
|
|
1747
|
+
}
|
|
1737
1748
|
let source = await (0, __WEBPACK_EXTERNAL_MODULE_node_util_1b29d436__.promisify)(compilation.inputFileSystem.readFile)(icon.absolutePath);
|
|
1738
|
-
if (!source)
|
|
1749
|
+
if (!source) {
|
|
1750
|
+
addCompilationError(compilation, `[rsbuild:app-icon] Failed to read the icon file at "${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.cyan(icon.absolutePath)}".`);
|
|
1751
|
+
continue;
|
|
1752
|
+
}
|
|
1739
1753
|
compilation.emitAsset(icon.relativePath, new sources.RawSource(source));
|
|
1740
1754
|
}
|
|
1741
1755
|
('apple-touch-icon' === icon.target || !icon.target && icon.size < 200) && tags.push({
|
|
@@ -1952,7 +1966,7 @@ let configChain_CHAIN_ID = {
|
|
|
1952
1966
|
javascript: {
|
|
1953
1967
|
exportsPresence: 'error'
|
|
1954
1968
|
}
|
|
1955
|
-
}), isDev && config.dev.hmr && 'web' === target && chain.plugin(CHAIN_ID.PLUGIN.HMR).use(bundler.HotModuleReplacementPlugin), 'development' === env && chain.output.devtoolModuleFilenameTemplate((info)=>toPosixPath(
|
|
1969
|
+
}), isDev && config.dev.hmr && 'web' === target && chain.plugin(CHAIN_ID.PLUGIN.HMR).use(bundler.HotModuleReplacementPlugin), 'development' === env && chain.output.devtoolModuleFilenameTemplate((info)=>toPosixPath(info.absoluteResourcePath)), process.env.RSPACK_CONFIG_VALIDATE ||= 'loose-unrecognized-keys', process.env.WATCHPACK_WATCHER_LIMIT ||= '20', process.env.EXPERIMENTAL_RSPACK_INCREMENTAL && chain.experiments({
|
|
1956
1970
|
...chain.get('experiments'),
|
|
1957
1971
|
incremental: isDev
|
|
1958
1972
|
});
|
|
@@ -2520,16 +2534,25 @@ let VOID_TAGS = [
|
|
|
2520
2534
|
class RsbuildHtmlPlugin {
|
|
2521
2535
|
apply(compiler) {
|
|
2522
2536
|
let emitFavicon = async (compilation, favicon)=>{
|
|
2537
|
+
let buffer;
|
|
2523
2538
|
let name = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.basename(favicon);
|
|
2524
2539
|
if (compilation.assets[name]) return name;
|
|
2525
|
-
if (!compilation.inputFileSystem)
|
|
2526
|
-
let filename = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.
|
|
2527
|
-
|
|
2528
|
-
|
|
2540
|
+
if (!compilation.inputFileSystem) return addCompilationError(compilation, '[rsbuild:html] Failed to read the favicon file as "compilation.inputFileSystem" is not available.'), null;
|
|
2541
|
+
let filename = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.isAbsolute(favicon) ? favicon : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(compilation.compiler.context, favicon);
|
|
2542
|
+
try {
|
|
2543
|
+
if (!(buffer = await (0, __WEBPACK_EXTERNAL_MODULE_node_util_1b29d436__.promisify)(compilation.inputFileSystem.readFile)(filename))) throw Error('Buffer is undefined');
|
|
2544
|
+
} catch (error) {
|
|
2545
|
+
return __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug(`read favicon error: ${error}`), addCompilationError(compilation, `[rsbuild:html] Failed to read the favicon file at "${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.cyan(filename)}".`), null;
|
|
2546
|
+
}
|
|
2547
|
+
let source = new compiler.webpack.sources.RawSource(buffer, !1);
|
|
2529
2548
|
return compilation.emitAsset(name, source), name;
|
|
2530
2549
|
}, addFavicon = async (headTags, favicon, compilation, publicPath)=>{
|
|
2531
2550
|
let href = favicon;
|
|
2532
|
-
|
|
2551
|
+
if (!isURL(favicon)) {
|
|
2552
|
+
let name = await emitFavicon(compilation, favicon);
|
|
2553
|
+
if (null === name) return;
|
|
2554
|
+
href = ensureAssetPrefix(name, publicPath);
|
|
2555
|
+
}
|
|
2533
2556
|
let tag = {
|
|
2534
2557
|
tagName: 'link',
|
|
2535
2558
|
voidTag: !0,
|
|
@@ -2582,7 +2605,7 @@ async function getTemplate(entryName, config, rootPath) {
|
|
|
2582
2605
|
templatePath: void 0,
|
|
2583
2606
|
templateContent: getDefaultTemplateContent(config.html.mountId)
|
|
2584
2607
|
};
|
|
2585
|
-
let absolutePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.isAbsolute)(templatePath) ? templatePath : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.
|
|
2608
|
+
let absolutePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.isAbsolute)(templatePath) ? templatePath : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(rootPath, templatePath);
|
|
2586
2609
|
if (!existTemplatePath.has(absolutePath)) {
|
|
2587
2610
|
if (!await isFileExists(absolutePath)) throw Error(`[rsbuild:html] Failed to resolve HTML template, please check if the file exists: ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.cyan(absolutePath)}`);
|
|
2588
2611
|
existTemplatePath.add(absolutePath);
|
|
@@ -4542,7 +4565,7 @@ class SocketServer {
|
|
|
4542
4565
|
}
|
|
4543
4566
|
updateStats(stats) {
|
|
4544
4567
|
let compilationId = getCompilationId(stats.compilation);
|
|
4545
|
-
this.stats[compilationId] = stats, this.sendStats({
|
|
4568
|
+
this.stats[compilationId] = stats, this.sockets.length && this.sendStats({
|
|
4546
4569
|
compilationId
|
|
4547
4570
|
});
|
|
4548
4571
|
}
|
|
@@ -5448,7 +5471,10 @@ async function devServer_createDevServer(options, createCompiler, config, { comp
|
|
|
5448
5471
|
getPublicPathFromCompiler(compiler)
|
|
5449
5472
|
], compilerDevMiddleware = new CompilerDevMiddleware({
|
|
5450
5473
|
dev: devConfig,
|
|
5451
|
-
server:
|
|
5474
|
+
server: {
|
|
5475
|
+
...config.server,
|
|
5476
|
+
port
|
|
5477
|
+
},
|
|
5452
5478
|
publicPaths: publicPaths,
|
|
5453
5479
|
compiler,
|
|
5454
5480
|
environments: options.context.environments
|
|
@@ -6069,35 +6095,29 @@ async function createRsbuild(options = {}) {
|
|
|
6069
6095
|
let pluginName = 'RsbuildCorePlugin';
|
|
6070
6096
|
chain.plugin(pluginName).use(class {
|
|
6071
6097
|
apply(compiler) {
|
|
6072
|
-
for (let { handler, environment: pluginEnvironment } of (compiler.__rsbuildTransformer = transformer, resolveFns)){
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
}));
|
|
6081
|
-
});
|
|
6082
|
-
}
|
|
6098
|
+
for (let { handler, environment: pluginEnvironment } of (compiler.__rsbuildTransformer = transformer, resolveFns))(!pluginEnvironment || isPluginMatchEnvironment(pluginEnvironment, environment.name)) && compiler.hooks.compilation.tap(pluginName, (compilation, { normalModuleFactory })=>{
|
|
6099
|
+
normalModuleFactory.hooks.resolve.tapPromise(pluginName, async (resolveData)=>handler({
|
|
6100
|
+
compiler,
|
|
6101
|
+
compilation,
|
|
6102
|
+
environment,
|
|
6103
|
+
resolveData
|
|
6104
|
+
}));
|
|
6105
|
+
});
|
|
6083
6106
|
compiler.hooks.thisCompilation.tap(pluginName, (compilation)=>{
|
|
6084
6107
|
compilation.hooks.childCompiler.tap(pluginName, (childCompiler)=>{
|
|
6085
6108
|
childCompiler.__rsbuildTransformer = transformer;
|
|
6086
6109
|
});
|
|
6087
6110
|
let { sources } = compiler.webpack;
|
|
6088
|
-
for (let { descriptor, handler, environment: pluginEnvironment } of processAssetsFns){
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
sources
|
|
6099
|
-
}));
|
|
6100
|
-
}
|
|
6111
|
+
for (let { descriptor, handler, environment: pluginEnvironment } of processAssetsFns)(!descriptor.targets || descriptor.targets.includes(target)) && (!descriptor.environments || descriptor.environments.includes(environment.name)) && (!pluginEnvironment || isPluginMatchEnvironment(pluginEnvironment, environment.name)) && compilation.hooks.processAssets.tapPromise({
|
|
6112
|
+
name: pluginName,
|
|
6113
|
+
stage: mapProcessAssetsStage(compiler, descriptor.stage)
|
|
6114
|
+
}, async (assets)=>handler({
|
|
6115
|
+
assets,
|
|
6116
|
+
compiler,
|
|
6117
|
+
compilation,
|
|
6118
|
+
environment,
|
|
6119
|
+
sources
|
|
6120
|
+
}));
|
|
6101
6121
|
});
|
|
6102
6122
|
}
|
|
6103
6123
|
constructor(){
|
|
@@ -6611,12 +6631,12 @@ async function runCLI() {
|
|
|
6611
6631
|
}
|
|
6612
6632
|
}(), process.title = 'rsbuild-node';
|
|
6613
6633
|
let { npm_execpath } = process.env;
|
|
6614
|
-
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rsbuild v1.2.
|
|
6634
|
+
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rsbuild v1.2.13\n`);
|
|
6615
6635
|
}();
|
|
6616
6636
|
try {
|
|
6617
6637
|
!function() {
|
|
6618
6638
|
let cli = dist('rsbuild');
|
|
6619
|
-
cli.help(), cli.version("1.2.
|
|
6639
|
+
cli.help(), cli.version("1.2.13"), applyCommonOptions(cli);
|
|
6620
6640
|
let devCommand = cli.command('dev', 'starting the dev server'), buildCommand = cli.command('build', 'build the app for production'), previewCommand = cli.command('preview', 'preview the production build locally'), inspectCommand = cli.command('inspect', 'inspect the Rspack and Rsbuild configs');
|
|
6621
6641
|
applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
|
|
6622
6642
|
try {
|
|
@@ -6667,6 +6687,6 @@ async function runCLI() {
|
|
|
6667
6687
|
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to start Rsbuild CLI.'), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
|
|
6668
6688
|
}
|
|
6669
6689
|
}
|
|
6670
|
-
let src_version = "1.2.
|
|
6690
|
+
let src_version = "1.2.13";
|
|
6671
6691
|
var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger, __webpack_exports__rspack = __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack;
|
|
6672
6692
|
export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createRsbuild, defineConfig, ensureAssetPrefix, config_loadConfig as loadConfig, loadEnv, mergeRsbuildConfig, runCLI, src_version as version, __webpack_exports__logger as logger, __webpack_exports__rspack as rspack };
|
|
@@ -45,3 +45,4 @@ export declare const prettyTime: (seconds: number) => string;
|
|
|
45
45
|
* Check if running in a TTY context
|
|
46
46
|
*/
|
|
47
47
|
export declare const isTTY: (type?: "stdin" | "stdout") => boolean;
|
|
48
|
+
export declare const addCompilationError: (compilation: Rspack.Compilation, message: string) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.13",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"postcss-loader": "8.1.1",
|
|
82
82
|
"prebundle": "1.2.7",
|
|
83
83
|
"reduce-configs": "^1.1.0",
|
|
84
|
-
"rsbuild-dev-middleware": "0.
|
|
84
|
+
"rsbuild-dev-middleware": "0.2.0",
|
|
85
85
|
"rslog": "^1.2.3",
|
|
86
86
|
"rspack-chain": "^1.2.1",
|
|
87
87
|
"rspack-manifest-plugin": "5.0.3",
|