@rsbuild/core 1.1.2 → 1.1.3
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 +2 -10
- package/compiled/css-loader/index.js +46 -46
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/postcss/index.js +135 -117
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-load-config/index.js +10 -10
- package/compiled/postcss-loader/index.js +11 -11
- package/compiled/rspack-manifest-plugin/index.js +4 -4
- package/dist/client/hmr.js +10 -1
- package/dist/index.cjs +406 -453
- package/dist/index.js +309 -358
- package/dist-types/cli/commands.d.ts +1 -1
- package/dist-types/cli/index.d.ts +1 -0
- package/dist-types/helpers/stats.d.ts +2 -3
- package/dist-types/index.d.ts +1 -0
- package/dist-types/internal.d.ts +0 -2
- package/package.json +4 -6
- package/dist/index.cjs.LICENSE.txt +0 -13
- package/dist/index.js.LICENSE.txt +0 -13
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/*! For license information please see index.cjs.LICENSE.txt */
|
|
2
1
|
var __webpack_modules__ = {
|
|
3
2
|
"../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js": function(module1) {
|
|
4
3
|
"use strict";
|
|
@@ -57,14 +56,14 @@ var __webpack_modules__ = {
|
|
|
57
56
|
};
|
|
58
57
|
module1.exports = deepmerge;
|
|
59
58
|
},
|
|
60
|
-
"../../node_modules/.pnpm/dotenv-expand@11.0.
|
|
59
|
+
"../../node_modules/.pnpm/dotenv-expand@11.0.7/node_modules/dotenv-expand/lib/main.js": function(module1) {
|
|
61
60
|
"use strict";
|
|
62
61
|
let DOTENV_SUBSTITUTION_REGEX = /(\\)?(\$)(?!\()(\{?)([\w.]+)(?::?-((?:\$\{(?:\$\{(?:\$\{[^}]*\}|[^}])*}|[^}])*}|[^}])+))?(\}?)/gi;
|
|
63
62
|
function interpolate(value, processEnv, parsed) {
|
|
64
63
|
return value.replace(DOTENV_SUBSTITUTION_REGEX, (match, escaped, dollarSign, openBrace, key, defaultValue, closeBrace)=>{
|
|
65
64
|
if ('\\' === escaped) return match.slice(1);
|
|
66
65
|
if (processEnv[key]) return processEnv[key] === parsed[key] ? processEnv[key] : interpolate(processEnv[key], processEnv, parsed);
|
|
67
|
-
if (parsed[key]
|
|
66
|
+
if (parsed[key] && parsed[key] !== value) return interpolate(parsed[key], processEnv, parsed);
|
|
68
67
|
if (defaultValue) return defaultValue.startsWith('$') ? interpolate(defaultValue, processEnv, parsed) : defaultValue;
|
|
69
68
|
return '';
|
|
70
69
|
});
|
|
@@ -232,62 +231,6 @@ var __webpack_modules__ = {
|
|
|
232
231
|
};
|
|
233
232
|
module1.exports.configDotenv = DotenvModule.configDotenv, module1.exports._configVault = DotenvModule._configVault, module1.exports._parseVault = DotenvModule._parseVault, module1.exports.config = DotenvModule.config, module1.exports.decrypt = DotenvModule.decrypt, module1.exports.parse = DotenvModule.parse, module1.exports.populate = DotenvModule.populate, module1.exports = DotenvModule;
|
|
234
233
|
},
|
|
235
|
-
"../../node_modules/.pnpm/is-extglob@2.1.1/node_modules/is-extglob/index.js": function(module1) {
|
|
236
|
-
module1.exports = function(str) {
|
|
237
|
-
var match;
|
|
238
|
-
if ('string' != typeof str || '' === str) return !1;
|
|
239
|
-
for(; match = /(\\).|([@?!+*]\(.*\))/g.exec(str);){
|
|
240
|
-
if (match[2]) return !0;
|
|
241
|
-
str = str.slice(match.index + match[0].length);
|
|
242
|
-
}
|
|
243
|
-
return !1;
|
|
244
|
-
};
|
|
245
|
-
},
|
|
246
|
-
"../../node_modules/.pnpm/is-glob@4.0.3/node_modules/is-glob/index.js": function(module1, __unused_webpack_exports, __webpack_require__) {
|
|
247
|
-
var isExtglob = __webpack_require__("../../node_modules/.pnpm/is-extglob@2.1.1/node_modules/is-extglob/index.js"), chars = {
|
|
248
|
-
'{': '}',
|
|
249
|
-
'(': ')',
|
|
250
|
-
'[': ']'
|
|
251
|
-
}, strictCheck = function(str) {
|
|
252
|
-
if ('!' === str[0]) return !0;
|
|
253
|
-
for(var index = 0, pipeIndex = -2, closeSquareIndex = -2, closeCurlyIndex = -2, closeParenIndex = -2, backSlashIndex = -2; index < str.length;){
|
|
254
|
-
if ('*' === str[index] || '?' === str[index + 1] && /[\].+)]/.test(str[index]) || -1 !== closeSquareIndex && '[' === str[index] && ']' !== str[index + 1] && (closeSquareIndex < index && (closeSquareIndex = str.indexOf(']', index)), closeSquareIndex > index && (-1 === backSlashIndex || backSlashIndex > closeSquareIndex || -1 === (backSlashIndex = str.indexOf('\\', index)) || backSlashIndex > closeSquareIndex)) || -1 !== closeCurlyIndex && '{' === str[index] && '}' !== str[index + 1] && (closeCurlyIndex = str.indexOf('}', index)) > index && (-1 === (backSlashIndex = str.indexOf('\\', index)) || backSlashIndex > closeCurlyIndex) || -1 !== closeParenIndex && '(' === str[index] && '?' === str[index + 1] && /[:!=]/.test(str[index + 2]) && ')' !== str[index + 3] && (closeParenIndex = str.indexOf(')', index)) > index && (-1 === (backSlashIndex = str.indexOf('\\', index)) || backSlashIndex > closeParenIndex) || -1 !== pipeIndex && '(' === str[index] && '|' !== str[index + 1] && (pipeIndex < index && (pipeIndex = str.indexOf('|', index)), -1 !== pipeIndex && ')' !== str[pipeIndex + 1] && (closeParenIndex = str.indexOf(')', pipeIndex)) > pipeIndex && (-1 === (backSlashIndex = str.indexOf('\\', pipeIndex)) || backSlashIndex > closeParenIndex))) return !0;
|
|
255
|
-
if ('\\' === str[index]) {
|
|
256
|
-
var open = str[index + 1];
|
|
257
|
-
index += 2;
|
|
258
|
-
var close = chars[open];
|
|
259
|
-
if (close) {
|
|
260
|
-
var n = str.indexOf(close, index);
|
|
261
|
-
-1 !== n && (index = n + 1);
|
|
262
|
-
}
|
|
263
|
-
if ('!' === str[index]) return !0;
|
|
264
|
-
} else index++;
|
|
265
|
-
}
|
|
266
|
-
return !1;
|
|
267
|
-
}, relaxedCheck = function(str) {
|
|
268
|
-
if ('!' === str[0]) return !0;
|
|
269
|
-
for(var index = 0; index < str.length;){
|
|
270
|
-
if (/[*?{}()[\]]/.test(str[index])) return !0;
|
|
271
|
-
if ('\\' === str[index]) {
|
|
272
|
-
var open = str[index + 1];
|
|
273
|
-
index += 2;
|
|
274
|
-
var close = chars[open];
|
|
275
|
-
if (close) {
|
|
276
|
-
var n = str.indexOf(close, index);
|
|
277
|
-
-1 !== n && (index = n + 1);
|
|
278
|
-
}
|
|
279
|
-
if ('!' === str[index]) return !0;
|
|
280
|
-
} else index++;
|
|
281
|
-
}
|
|
282
|
-
return !1;
|
|
283
|
-
};
|
|
284
|
-
module1.exports = function(str, options) {
|
|
285
|
-
if ('string' != typeof str || '' === str) return !1;
|
|
286
|
-
if (isExtglob(str)) return !0;
|
|
287
|
-
var check = strictCheck;
|
|
288
|
-
return options && !1 === options.strict && (check = relaxedCheck), check(str);
|
|
289
|
-
};
|
|
290
|
-
},
|
|
291
234
|
"../../compiled/chokidar/index.js": function(module1) {
|
|
292
235
|
"use strict";
|
|
293
236
|
module1.exports = require("../compiled/chokidar/index.js");
|
|
@@ -1514,7 +1457,7 @@ __webpack_require__.n = function(module1) {
|
|
|
1514
1457
|
var __webpack_exports__ = {};
|
|
1515
1458
|
(()=>{
|
|
1516
1459
|
"use strict";
|
|
1517
|
-
let
|
|
1460
|
+
let pluginHelper_htmlPlugin, cssExtractPlugin, swcHelpersPath;
|
|
1518
1461
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
|
|
1519
1462
|
ensureAssetPrefix: ()=>ensureAssetPrefix,
|
|
1520
1463
|
createRsbuild: ()=>createRsbuild,
|
|
@@ -1522,13 +1465,18 @@ var __webpack_exports__ = {};
|
|
|
1522
1465
|
loadConfig: ()=>config_loadConfig,
|
|
1523
1466
|
version: ()=>src_version,
|
|
1524
1467
|
PLUGIN_CSS_NAME: ()=>PLUGIN_CSS_NAME,
|
|
1525
|
-
logger: ()=>
|
|
1468
|
+
logger: ()=>rslog_index_js_namespaceObject.logger,
|
|
1526
1469
|
loadEnv: ()=>loadEnv,
|
|
1527
1470
|
mergeRsbuildConfig: ()=>mergeRsbuildConfig,
|
|
1528
1471
|
rspack: ()=>core_namespaceObject.rspack,
|
|
1529
1472
|
__internalHelper: ()=>internal_namespaceObject,
|
|
1473
|
+
runCLI: ()=>runCLI,
|
|
1530
1474
|
defineConfig: ()=>defineConfig
|
|
1531
1475
|
});
|
|
1476
|
+
var internal_namespaceObject = {};
|
|
1477
|
+
__webpack_require__.r(internal_namespaceObject), __webpack_require__.d(internal_namespaceObject, {
|
|
1478
|
+
setHTMLPlugin: ()=>setHTMLPlugin
|
|
1479
|
+
});
|
|
1532
1480
|
var provider_helpers_namespaceObject = {};
|
|
1533
1481
|
__webpack_require__.r(provider_helpers_namespaceObject), __webpack_require__.d(provider_helpers_namespaceObject, {
|
|
1534
1482
|
chainToConfig: ()=>chainToConfig,
|
|
@@ -1548,18 +1496,16 @@ var __webpack_exports__ = {};
|
|
|
1548
1496
|
setCssExtractPlugin: ()=>setCssExtractPlugin,
|
|
1549
1497
|
stringifyConfig: ()=>stringifyConfig
|
|
1550
1498
|
});
|
|
1551
|
-
var internal_namespaceObject = {};
|
|
1552
|
-
__webpack_require__.r(internal_namespaceObject), __webpack_require__.d(internal_namespaceObject, {
|
|
1553
|
-
prepareCli: ()=>prepareCli,
|
|
1554
|
-
runCli: ()=>runCli,
|
|
1555
|
-
setHTMLPlugin: ()=>setHTMLPlugin
|
|
1556
|
-
});
|
|
1557
1499
|
let core_namespaceObject = require("@rspack/core");
|
|
1558
1500
|
var core_default = __webpack_require__.n(core_namespaceObject);
|
|
1559
|
-
let
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1501
|
+
let external_node_module_namespaceObject = require("node:module"), pluginHelper_require = (0, external_node_module_namespaceObject.createRequire)('undefined' == typeof document ? new (module.require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href), setHTMLPlugin = (plugin)=>{
|
|
1502
|
+
plugin && (pluginHelper_htmlPlugin = plugin);
|
|
1503
|
+
}, getHTMLPlugin = ()=>(!pluginHelper_htmlPlugin && (pluginHelper_htmlPlugin = pluginHelper_require('../compiled/html-rspack-plugin/index.js')), pluginHelper_htmlPlugin), setCssExtractPlugin = (plugin)=>{
|
|
1504
|
+
cssExtractPlugin = plugin;
|
|
1505
|
+
}, getCssExtractPlugin = ()=>cssExtractPlugin ? cssExtractPlugin : core_default().CssExtractRspackPlugin;
|
|
1506
|
+
var external_node_fs_ = __webpack_require__("node:fs"), external_node_fs_default = __webpack_require__.n(external_node_fs_), external_node_path_ = __webpack_require__("node:path"), external_node_path_default = __webpack_require__.n(external_node_path_), main = __webpack_require__("../../node_modules/.pnpm/dotenv@16.4.5/node_modules/dotenv/lib/main.js"), lib_main = __webpack_require__("../../node_modules/.pnpm/dotenv-expand@11.0.7/node_modules/dotenv-expand/lib/main.js"), cjs = __webpack_require__("../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js"), cjs_default = __webpack_require__.n(cjs);
|
|
1507
|
+
let index_js_namespaceObject = require("../compiled/picocolors/index.js");
|
|
1508
|
+
var index_js_default = __webpack_require__.n(index_js_namespaceObject);
|
|
1563
1509
|
let ROOT_DIST_DIR = 'dist', LOADER_PATH = (0, external_node_path_.join)(__dirname), STATIC_PATH = (0, external_node_path_.join)(__dirname, '../static'), COMPILED_PATH = (0, external_node_path_.join)(__dirname, '../compiled'), RSBUILD_OUTPUTS_PATH = '.rsbuild', DEFAULT_DEV_HOST = '0.0.0.0', DEFAULT_ASSET_PREFIX = '/', DEFAULT_WEB_BROWSERSLIST = [
|
|
1564
1510
|
'chrome >= 87',
|
|
1565
1511
|
'edge >= 88',
|
|
@@ -1605,8 +1551,26 @@ var __webpack_exports__ = {};
|
|
|
1605
1551
|
'aac',
|
|
1606
1552
|
'm4a',
|
|
1607
1553
|
'opus'
|
|
1608
|
-
]
|
|
1609
|
-
|
|
1554
|
+
], rslog_index_js_namespaceObject = require("../compiled/rslog/index.js"), isDebug = ()=>{
|
|
1555
|
+
if (!process.env.DEBUG) return !1;
|
|
1556
|
+
let values = process.env.DEBUG.toLocaleLowerCase().split(',');
|
|
1557
|
+
return [
|
|
1558
|
+
'rsbuild',
|
|
1559
|
+
'builder',
|
|
1560
|
+
'*'
|
|
1561
|
+
].some((key)=>values.includes(key));
|
|
1562
|
+
};
|
|
1563
|
+
isDebug() && (rslog_index_js_namespaceObject.logger.level = 'verbose');
|
|
1564
|
+
rslog_index_js_namespaceObject.logger.override({
|
|
1565
|
+
debug: (message, ...args)=>{
|
|
1566
|
+
if ('verbose' !== rslog_index_js_namespaceObject.logger.level) return;
|
|
1567
|
+
let time = index_js_default().gray(`${function() {
|
|
1568
|
+
let now = new Date(), hours = String(now.getHours()).padStart(2, '0'), minutes = String(now.getMinutes()).padStart(2, '0'), seconds = String(now.getSeconds()).padStart(2, '0');
|
|
1569
|
+
return `${hours}:${minutes}:${seconds}`;
|
|
1570
|
+
}()}`);
|
|
1571
|
+
console.log(` ${index_js_default().magenta('rsbuild')} ${time} ${message}`, ...args);
|
|
1572
|
+
}
|
|
1573
|
+
});
|
|
1610
1574
|
let isFileSync = (filePath)=>{
|
|
1611
1575
|
try {
|
|
1612
1576
|
var _fs_statSync;
|
|
@@ -1644,7 +1608,7 @@ var __webpack_exports__ = {};
|
|
|
1644
1608
|
force: !0
|
|
1645
1609
|
});
|
|
1646
1610
|
} catch (err) {
|
|
1647
|
-
|
|
1611
|
+
rslog_index_js_namespaceObject.logger.debug(`Failed to empty dir: ${dir}`), rslog_index_js_namespaceObject.logger.debug(err);
|
|
1648
1612
|
}
|
|
1649
1613
|
}
|
|
1650
1614
|
function getAbsolutePath(base, filepath) {
|
|
@@ -1670,8 +1634,12 @@ var __webpack_exports__ = {};
|
|
|
1670
1634
|
}
|
|
1671
1635
|
let file = stats.file || stats.moduleName;
|
|
1672
1636
|
return file ? `File: ${file}\n` : '';
|
|
1673
|
-
}(stats), mainMessage = stats.message, details = verbose && stats.details ? `\nDetails: ${stats.details}\n` : '', stack = verbose && stats.stack ? `\n${stats.stack}` : ''
|
|
1674
|
-
|
|
1637
|
+
}(stats), mainMessage = stats.message, details = verbose && stats.details ? `\nDetails: ${stats.details}\n` : '', stack = verbose && stats.stack ? `\n${stats.stack}` : '', moduleTrace = function(stats) {
|
|
1638
|
+
let traceStr = '';
|
|
1639
|
+
if (stats.moduleTrace) for (let trace of stats.moduleTrace)trace.originName && (traceStr += `\n @ ${trace.originName}`);
|
|
1640
|
+
return traceStr;
|
|
1641
|
+
}(stats);
|
|
1642
|
+
message = `${fileName}${mainMessage}${details}${stack}${moduleTrace}`;
|
|
1675
1643
|
} else message = stats;
|
|
1676
1644
|
message = (lines = (lines = (message = function(message) {
|
|
1677
1645
|
let hint = 'You may need an appropriate loader to handle this file type.';
|
|
@@ -1692,9 +1660,9 @@ var __webpack_exports__ = {};
|
|
|
1692
1660
|
let getTips = (moduleName)=>{
|
|
1693
1661
|
let tips = [
|
|
1694
1662
|
`Tip: "${moduleName}" is a built-in Node.js module. It cannot be imported in client-side code.`,
|
|
1695
|
-
`Check if you need to import Node.js module. If needed, you can use ${
|
|
1663
|
+
`Check if you need to import Node.js module. If needed, you can use ${index_js_default().cyan('@rsbuild/plugin-node-polyfill')}.`
|
|
1696
1664
|
];
|
|
1697
|
-
return `${message}\n\n${
|
|
1665
|
+
return `${message}\n\n${index_js_default().yellow(tips.join('\n'))}`;
|
|
1698
1666
|
};
|
|
1699
1667
|
if (message.includes('need an additional plugin to handle "node:" URIs')) return getTips('node:*');
|
|
1700
1668
|
if (!message.includes("Can't resolve")) return message;
|
|
@@ -1749,12 +1717,16 @@ var __webpack_exports__ = {};
|
|
|
1749
1717
|
return statsData.warningsCount && (null === (_statsData_warnings = statsData.warnings) || void 0 === _statsData_warnings ? void 0 : _statsData_warnings.length) === 0 ? null === (_statsData_children = statsData.children) || void 0 === _statsData_children ? void 0 : _statsData_children.reduce((warnings, curr)=>warnings.concat(curr.warnings || []), []) : statsData.warnings;
|
|
1750
1718
|
};
|
|
1751
1719
|
function getStatsOptions(compiler) {
|
|
1752
|
-
|
|
1720
|
+
if (isMultiCompiler(compiler)) return {
|
|
1753
1721
|
children: compiler.compilers.map((compiler)=>compiler.options ? compiler.options.stats : void 0)
|
|
1754
|
-
}
|
|
1722
|
+
};
|
|
1723
|
+
let { stats } = compiler.options;
|
|
1724
|
+
return 'string' == typeof stats ? {
|
|
1725
|
+
preset: stats
|
|
1726
|
+
} : 'object' == typeof stats ? stats : {};
|
|
1755
1727
|
}
|
|
1756
1728
|
function formatStats(statsData, hasErrors) {
|
|
1757
|
-
let verbose = 'verbose' ===
|
|
1729
|
+
let verbose = 'verbose' === rslog_index_js_namespaceObject.logger.level;
|
|
1758
1730
|
if (hasErrors) {
|
|
1759
1731
|
let { errors } = formatStatsMessages({
|
|
1760
1732
|
errors: getAllStatsErrors(statsData),
|
|
@@ -1762,9 +1734,9 @@ var __webpack_exports__ = {};
|
|
|
1762
1734
|
}, verbose);
|
|
1763
1735
|
return {
|
|
1764
1736
|
message: function(errors) {
|
|
1765
|
-
let messages = errors.map((error)=>hintNodePolyfill(error)), text = `${messages.join('\n\n')}\n`, title =
|
|
1766
|
-
if (!errors.length) return `${title}\n${
|
|
1767
|
-
let tip =
|
|
1737
|
+
let messages = errors.map((error)=>hintNodePolyfill(error)), text = `${messages.join('\n\n')}\n`, title = index_js_default().bold(index_js_default().red('Compile error: '));
|
|
1738
|
+
if (!errors.length) return `${title}\n${index_js_default().yellow("For more details, please setting 'stats.errors: true' ")}`;
|
|
1739
|
+
let tip = index_js_default().yellow('Failed to compile, check the errors for troubleshooting.');
|
|
1768
1740
|
return `${title}\n${tip}\n${text}`;
|
|
1769
1741
|
}(errors),
|
|
1770
1742
|
level: 'error'
|
|
@@ -1775,7 +1747,7 @@ var __webpack_exports__ = {};
|
|
|
1775
1747
|
warnings: getAllStatsWarnings(statsData)
|
|
1776
1748
|
}, verbose);
|
|
1777
1749
|
if (warnings.length) {
|
|
1778
|
-
let title =
|
|
1750
|
+
let title = index_js_default().bold(index_js_default().yellow('Compile Warning: \n'));
|
|
1779
1751
|
return {
|
|
1780
1752
|
message: `${title}${warnings.join('\n\n')}\n`,
|
|
1781
1753
|
level: 'warning'
|
|
@@ -1845,7 +1817,7 @@ var __webpack_exports__ = {};
|
|
|
1845
1817
|
return keys.reduce((ret, key)=>(void 0 !== obj[key] && (ret[key] = obj[key]), ret), {});
|
|
1846
1818
|
}
|
|
1847
1819
|
let camelCase = (input)=>input.replace(/[-_](\w)/g, (_, c)=>c.toUpperCase()), prettyTime = (seconds)=>{
|
|
1848
|
-
let format = (time)=>
|
|
1820
|
+
let format = (time)=>index_js_default().bold(time);
|
|
1849
1821
|
if (seconds < 10) {
|
|
1850
1822
|
let digits = seconds >= 0.01 ? 2 : 3;
|
|
1851
1823
|
return `${format(seconds.toFixed(digits))} s`;
|
|
@@ -1853,27 +1825,110 @@ var __webpack_exports__ = {};
|
|
|
1853
1825
|
if (seconds < 60) return `${format(seconds.toFixed(1))} s`;
|
|
1854
1826
|
let minutes = seconds / 60;
|
|
1855
1827
|
return `${format(minutes.toFixed(2))} m`;
|
|
1856
|
-
}, isTTY = (type = 'stdout')=>('stdin' === type ? process.stdin.isTTY : process.stdout.isTTY) && !process.env.CI
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
'
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1828
|
+
}, isTTY = (type = 'stdout')=>('stdin' === type ? process.stdin.isTTY : process.stdout.isTTY) && !process.env.CI;
|
|
1829
|
+
function loadEnv({ cwd = process.cwd(), mode = getNodeEnv(), prefixes = [
|
|
1830
|
+
'PUBLIC_'
|
|
1831
|
+
] } = {}) {
|
|
1832
|
+
if ('local' === mode) throw Error("'local' cannot be used as a value for env mode, because \".env.local\" represents a temporary local file. Please use another value.");
|
|
1833
|
+
let filePaths = [
|
|
1834
|
+
'.env',
|
|
1835
|
+
'.env.local',
|
|
1836
|
+
`.env.${mode}`,
|
|
1837
|
+
`.env.${mode}.local`
|
|
1838
|
+
].map((filename)=>(0, external_node_path_.join)(cwd, filename)).filter(isFileSync), parsed = {};
|
|
1839
|
+
for (let envPath of filePaths)Object.assign(parsed, (0, main.parse)(external_node_fs_default().readFileSync(envPath)));
|
|
1840
|
+
parsed.NODE_ENV && (process.env.NODE_ENV = parsed.NODE_ENV), (0, lib_main.expand)({
|
|
1841
|
+
parsed
|
|
1842
|
+
});
|
|
1843
|
+
let publicVars = {}, rawPublicVars = {};
|
|
1844
|
+
for (let key of Object.keys(process.env))if (prefixes.some((prefix)=>key.startsWith(prefix))) {
|
|
1845
|
+
let val = process.env[key];
|
|
1846
|
+
publicVars[`import.meta.env.${key}`] = JSON.stringify(val), publicVars[`process.env.${key}`] = JSON.stringify(val), rawPublicVars[key] = val;
|
|
1874
1847
|
}
|
|
1875
|
-
|
|
1876
|
-
|
|
1848
|
+
let cleaned = !1;
|
|
1849
|
+
return {
|
|
1850
|
+
parsed,
|
|
1851
|
+
cleanup: ()=>{
|
|
1852
|
+
if (!cleaned) {
|
|
1853
|
+
for (let key of Object.keys(parsed)){
|
|
1854
|
+
if ('NODE_ENV' !== key) process.env[key] === parsed[key] && delete process.env[key];
|
|
1855
|
+
}
|
|
1856
|
+
cleaned = !0;
|
|
1857
|
+
}
|
|
1858
|
+
},
|
|
1859
|
+
filePaths,
|
|
1860
|
+
publicVars,
|
|
1861
|
+
rawPublicVars
|
|
1862
|
+
};
|
|
1863
|
+
}
|
|
1864
|
+
let types_namespaceObject = require("node:util/types");
|
|
1865
|
+
class BrowserslistError extends Error {
|
|
1866
|
+
constructor(message){
|
|
1867
|
+
super(message), function(obj, key, value) {
|
|
1868
|
+
key in obj ? Object.defineProperty(obj, key, {
|
|
1869
|
+
value: value,
|
|
1870
|
+
enumerable: !0,
|
|
1871
|
+
configurable: !0,
|
|
1872
|
+
writable: !0
|
|
1873
|
+
}) : obj[key] = value;
|
|
1874
|
+
}(this, "browserslist", void 0), this.name = 'BrowserslistError', this.browserslist = !0, Error.captureStackTrace && Error.captureStackTrace(this, BrowserslistError);
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
let isFileCache = {};
|
|
1878
|
+
function isFile(file) {
|
|
1879
|
+
if (file in isFileCache) return isFileCache[file];
|
|
1880
|
+
let result = external_node_fs_.existsSync(file) && external_node_fs_.statSync(file).isFile();
|
|
1881
|
+
return isFileCache[file] = result, result;
|
|
1882
|
+
}
|
|
1883
|
+
function parsePackage(file) {
|
|
1884
|
+
let config = JSON.parse(external_node_fs_.readFileSync(file).toString().replace(/^\uFEFF/m, ''));
|
|
1885
|
+
if (config.browserlist && !config.browserslist) throw new BrowserslistError(`\`browserlist\` key instead of \`browserslist\` in ${file}`);
|
|
1886
|
+
let list = config.browserslist;
|
|
1887
|
+
for(let i in Array.isArray(list) && (list = {
|
|
1888
|
+
defaults: list
|
|
1889
|
+
}), 'string' == typeof list && (list = parseConfig(list)), list)!function(section) {
|
|
1890
|
+
let FORMAT = 'Browserslist config should be a string or an array of strings with browser queries';
|
|
1891
|
+
if (Array.isArray(section)) {
|
|
1892
|
+
for(let i = 0; i < section.length; i++)if ('string' != typeof section[i]) throw new BrowserslistError(FORMAT);
|
|
1893
|
+
} else if ('string' != typeof section) throw new BrowserslistError(FORMAT);
|
|
1894
|
+
}(list[i]);
|
|
1895
|
+
return list;
|
|
1896
|
+
}
|
|
1897
|
+
let IS_SECTION = /^\s*\[(.+)]\s*$/;
|
|
1898
|
+
function parseConfig(string) {
|
|
1899
|
+
let result = {
|
|
1900
|
+
defaults: []
|
|
1901
|
+
}, sections = [
|
|
1902
|
+
'defaults'
|
|
1903
|
+
];
|
|
1904
|
+
return string.toString().replace(/#[^\n]*/g, '').split(/\n|,/).map((line)=>line.trim()).filter((line)=>'' !== line).forEach((line)=>{
|
|
1905
|
+
let matched = line.match(IS_SECTION);
|
|
1906
|
+
matched ? (sections = matched[1].trim().split(' ')).forEach((section)=>{
|
|
1907
|
+
if (result[section]) throw new BrowserslistError(`Duplicate section ${section} in Browserslist config`);
|
|
1908
|
+
result[section] = [];
|
|
1909
|
+
}) : sections.forEach((section)=>{
|
|
1910
|
+
result[section].push(line);
|
|
1911
|
+
});
|
|
1912
|
+
}), result;
|
|
1913
|
+
}
|
|
1914
|
+
function parsePackageOrReadConfig(file) {
|
|
1915
|
+
return 'package.json' === external_node_path_.basename(file) ? parsePackage(file) : function(file) {
|
|
1916
|
+
if (!isFile(file)) throw new BrowserslistError(`Can't read ${file} config`);
|
|
1917
|
+
return parseConfig(external_node_fs_.readFileSync(file, 'utf-8'));
|
|
1918
|
+
}(file);
|
|
1919
|
+
}
|
|
1920
|
+
function pickEnv(config, opts) {
|
|
1921
|
+
let name;
|
|
1922
|
+
return 'object' != typeof config ? config : ('string' == typeof opts.env ? name = opts.env : process.env.BROWSERSLIST_ENV ? name = process.env.BROWSERSLIST_ENV : process.env.NODE_ENV ? name = process.env.NODE_ENV : name = 'production', config[name] || config.defaults);
|
|
1923
|
+
}
|
|
1924
|
+
function eachParent(file, callback) {
|
|
1925
|
+
let dir = isFile(file) ? external_node_path_.dirname(file) : file, loc = external_node_path_.resolve(dir);
|
|
1926
|
+
do {
|
|
1927
|
+
let result = callback(loc);
|
|
1928
|
+
if (void 0 !== result) return result;
|
|
1929
|
+
}while (loc !== (loc = external_node_path_.dirname(loc)));
|
|
1930
|
+
}
|
|
1931
|
+
let configCache = {}, rspack_chain_index_js_namespaceObject = require("../compiled/rspack-chain/index.js");
|
|
1877
1932
|
var rspack_chain_index_js_default = __webpack_require__.n(rspack_chain_index_js_namespaceObject);
|
|
1878
1933
|
let OVERRIDE_PATHS = [
|
|
1879
1934
|
'performance.removeConsole',
|
|
@@ -1914,8 +1969,78 @@ var __webpack_exports__ = {};
|
|
|
1914
1969
|
merged[key] = mergeConfig_merge(x[key], y[key], childPath);
|
|
1915
1970
|
}
|
|
1916
1971
|
return merged;
|
|
1917
|
-
}, mergeRsbuildConfig = (...configs)=>2 === configs.length ? mergeConfig_merge(configs[0], configs[1]) : configs.length < 2 ? configs[0] : configs.reduce((result, config)=>mergeConfig_merge(result, config), {});
|
|
1918
|
-
|
|
1972
|
+
}, 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().resolve(cwd, envDir) : cwd;
|
|
1973
|
+
async function init({ cliOptions, isRestart, isBuildWatch = !1 }) {
|
|
1974
|
+
cliOptions && (commonOpts = cliOptions);
|
|
1975
|
+
try {
|
|
1976
|
+
var _config_server, _config_dev, _config_dev1;
|
|
1977
|
+
let cwd = process.cwd(), root = commonOpts.root ? getAbsolutePath(cwd, commonOpts.root) : cwd, envs = loadEnv({
|
|
1978
|
+
cwd: getEnvDir(root, commonOpts.envDir),
|
|
1979
|
+
mode: commonOpts.envMode
|
|
1980
|
+
});
|
|
1981
|
+
onBeforeRestartServer(envs.cleanup);
|
|
1982
|
+
let { content: config, filePath: configFilePath } = await config_loadConfig({
|
|
1983
|
+
cwd: root,
|
|
1984
|
+
path: commonOpts.config,
|
|
1985
|
+
envMode: commonOpts.envMode
|
|
1986
|
+
}), command = process.argv[2];
|
|
1987
|
+
if ('dev' === command || isBuildWatch) {
|
|
1988
|
+
let files = [
|
|
1989
|
+
...envs.filePaths
|
|
1990
|
+
];
|
|
1991
|
+
if (configFilePath && files.push(configFilePath), null === (_config_dev1 = config.dev) || void 0 === _config_dev1 ? void 0 : _config_dev1.watchFiles) for (let watchFilesConfig of castArray(config.dev.watchFiles)){
|
|
1992
|
+
if ('reload-server' !== watchFilesConfig.type) continue;
|
|
1993
|
+
let paths = castArray(watchFilesConfig.paths);
|
|
1994
|
+
watchFilesConfig.options ? watchFilesForRestart(paths, root, isBuildWatch, watchFilesConfig.options) : files.push(...paths);
|
|
1995
|
+
}
|
|
1996
|
+
watchFilesForRestart(files, root, isBuildWatch);
|
|
1997
|
+
}
|
|
1998
|
+
return config.source ||= {}, config.source.define = {
|
|
1999
|
+
...envs.publicVars,
|
|
2000
|
+
...config.source.define
|
|
2001
|
+
}, commonOpts.root && (config.root = root), commonOpts.mode && (config.mode = commonOpts.mode), commonOpts.open && !(null === (_config_server = config.server) || void 0 === _config_server ? void 0 : _config_server.open) && (config.server ||= {}, config.server.open = commonOpts.open), commonOpts.host && (config.server ||= {}, config.server.host = commonOpts.host), commonOpts.port && (config.server ||= {}, config.server.port = commonOpts.port), (null === (_config_dev = config.dev) || void 0 === _config_dev ? void 0 : _config_dev.cliShortcuts) === void 0 && (config.dev ||= {}, config.dev.cliShortcuts = !0), createRsbuild({
|
|
2002
|
+
cwd: root,
|
|
2003
|
+
rsbuildConfig: config,
|
|
2004
|
+
environment: commonOpts.environment
|
|
2005
|
+
});
|
|
2006
|
+
} catch (err) {
|
|
2007
|
+
if (isRestart) rslog_index_js_namespaceObject.logger.error(err);
|
|
2008
|
+
else throw err;
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
let cleaners = [], onBeforeRestartServer = (cleaner)=>{
|
|
2012
|
+
cleaners.push(cleaner);
|
|
2013
|
+
}, clearConsole = ()=>{
|
|
2014
|
+
isTTY() && !process.env.DEBUG && process.stdout.write('\x1B[H\x1B[2J');
|
|
2015
|
+
}, beforeRestart = async ({ filePath, clear = !0 } = {})=>{
|
|
2016
|
+
if (clear && clearConsole(), filePath) {
|
|
2017
|
+
let filename = external_node_path_default().basename(filePath);
|
|
2018
|
+
rslog_index_js_namespaceObject.logger.info(`Restart server because ${index_js_default().yellow(filename)} is changed.\n`);
|
|
2019
|
+
} else rslog_index_js_namespaceObject.logger.info('Restarting server...\n');
|
|
2020
|
+
for (let cleaner of cleaners)await cleaner();
|
|
2021
|
+
cleaners = [];
|
|
2022
|
+
}, restartDevServer = async ({ filePath, clear = !0 } = {})=>{
|
|
2023
|
+
await beforeRestart({
|
|
2024
|
+
filePath,
|
|
2025
|
+
clear
|
|
2026
|
+
});
|
|
2027
|
+
let rsbuild = await init({
|
|
2028
|
+
isRestart: !0
|
|
2029
|
+
});
|
|
2030
|
+
if (!!rsbuild) await rsbuild.startDevServer();
|
|
2031
|
+
}, restartBuild = async ({ filePath, clear = !0 } = {})=>{
|
|
2032
|
+
await beforeRestart({
|
|
2033
|
+
filePath,
|
|
2034
|
+
clear
|
|
2035
|
+
});
|
|
2036
|
+
let rsbuild = await init({
|
|
2037
|
+
isRestart: !0,
|
|
2038
|
+
isBuildWatch: !0
|
|
2039
|
+
});
|
|
2040
|
+
if (!!rsbuild) onBeforeRestartServer((await rsbuild.build({
|
|
2041
|
+
watch: !0
|
|
2042
|
+
})).close);
|
|
2043
|
+
};
|
|
1919
2044
|
async function setupWatchFiles(options) {
|
|
1920
2045
|
let { dev, server, root, compileMiddlewareAPI } = options, { hmr, liveReload } = dev;
|
|
1921
2046
|
if (!hmr && !liveReload || !compileMiddlewareAPI) return;
|
|
@@ -1955,8 +2080,9 @@ var __webpack_exports__ = {};
|
|
|
1955
2080
|
type
|
|
1956
2081
|
};
|
|
1957
2082
|
}
|
|
2083
|
+
let GLOB_REGEX = /[*?{}[\]()!@+|]/, isGlob = (str)=>GLOB_REGEX.test(str);
|
|
1958
2084
|
async function createChokidar(pathOrGlobs, root, options) {
|
|
1959
|
-
let chokidar = await Promise.resolve().then(__webpack_require__.t.bind(__webpack_require__, "../../compiled/chokidar/index.js", 23)), watchFiles = new Set(), globPatterns = pathOrGlobs.filter((pathOrGlob)=>!!
|
|
2085
|
+
let chokidar = await Promise.resolve().then(__webpack_require__.t.bind(__webpack_require__, "../../compiled/chokidar/index.js", 23)), watchFiles = new Set(), globPatterns = pathOrGlobs.filter((pathOrGlob)=>!!isGlob(pathOrGlob) || (watchFiles.add(pathOrGlob), !1));
|
|
1960
2086
|
if (globPatterns.length) {
|
|
1961
2087
|
let tinyglobby = await Promise.resolve().then(__webpack_require__.t.bind(__webpack_require__, "../../compiled/tinyglobby/index.js", 23)), { glob } = tinyglobby.default || tinyglobby;
|
|
1962
2088
|
for (let file of (await glob(globPatterns, {
|
|
@@ -2115,7 +2241,7 @@ var __webpack_exports__ = {};
|
|
|
2115
2241
|
if (customConfig) {
|
|
2116
2242
|
let customConfigPath = (0, external_node_path_.isAbsolute)(customConfig) ? customConfig : (0, external_node_path_.join)(root, customConfig);
|
|
2117
2243
|
if (external_node_fs_default().existsSync(customConfigPath)) return customConfigPath;
|
|
2118
|
-
|
|
2244
|
+
rslog_index_js_namespaceObject.logger.warn(`Cannot find config file: ${index_js_default().dim(customConfigPath)}\n`);
|
|
2119
2245
|
}
|
|
2120
2246
|
for (let file of [
|
|
2121
2247
|
'rsbuild.config.mjs',
|
|
@@ -2166,7 +2292,7 @@ var __webpack_exports__ = {};
|
|
|
2166
2292
|
let exportModule = await import(`${configFilePath}?t=${Date.now()}`);
|
|
2167
2293
|
configExport = exportModule.default ? exportModule.default : exportModule;
|
|
2168
2294
|
} catch (err) {
|
|
2169
|
-
|
|
2295
|
+
rslog_index_js_namespaceObject.logger.debug(`Failed to load file with dynamic import: ${index_js_default().dim(configFilePath)}`);
|
|
2170
2296
|
}
|
|
2171
2297
|
try {
|
|
2172
2298
|
if (void 0 === configExport) {
|
|
@@ -2178,7 +2304,7 @@ var __webpack_exports__ = {};
|
|
|
2178
2304
|
})(configFilePath);
|
|
2179
2305
|
}
|
|
2180
2306
|
} catch (err) {
|
|
2181
|
-
throw
|
|
2307
|
+
throw rslog_index_js_namespaceObject.logger.error(`Failed to load file with jiti: ${index_js_default().dim(configFilePath)}`), err;
|
|
2182
2308
|
}
|
|
2183
2309
|
if ('function' == typeof configExport) {
|
|
2184
2310
|
let command = process.argv[2], nodeEnv = getNodeEnv(), result = await configExport({
|
|
@@ -2192,7 +2318,7 @@ var __webpack_exports__ = {};
|
|
|
2192
2318
|
filePath: configFilePath
|
|
2193
2319
|
};
|
|
2194
2320
|
}
|
|
2195
|
-
if (!isObject(configExport)) throw Error(`The config must be an object or a function that returns an object, get ${
|
|
2321
|
+
if (!isObject(configExport)) throw Error(`The config must be an object or a function that returns an object, get ${index_js_default().yellow(configExport)}`);
|
|
2196
2322
|
return {
|
|
2197
2323
|
content: applyMetaInfo(configExport),
|
|
2198
2324
|
filePath: configFilePath
|
|
@@ -2255,8 +2381,8 @@ var __webpack_exports__ = {};
|
|
|
2255
2381
|
await external_node_fs_default().promises.mkdir(outputPath, {
|
|
2256
2382
|
recursive: !0
|
|
2257
2383
|
}), await Promise.all(files.map(async (item)=>external_node_fs_default().promises.writeFile(item.path, `export default ${item.content}`)));
|
|
2258
|
-
let fileInfos = files.map((item)=>` - ${
|
|
2259
|
-
|
|
2384
|
+
let fileInfos = files.map((item)=>` - ${index_js_default().bold(index_js_default().yellow(item.label))}: ${index_js_default().underline(item.path)}`).join('\n');
|
|
2385
|
+
rslog_index_js_namespaceObject.logger.success(`Inspect config succeed, open following files to view the content: \n\n${fileInfos}\n`);
|
|
2260
2386
|
}
|
|
2261
2387
|
function stringifyConfig(config, verbose) {
|
|
2262
2388
|
return (0, rspack_chain_index_js_default().toString)(config, {
|
|
@@ -2281,74 +2407,7 @@ var __webpack_exports__ = {};
|
|
|
2281
2407
|
...publicDir
|
|
2282
2408
|
}
|
|
2283
2409
|
];
|
|
2284
|
-
},
|
|
2285
|
-
class BrowserslistError extends Error {
|
|
2286
|
-
constructor(message){
|
|
2287
|
-
super(message), function(obj, key, value) {
|
|
2288
|
-
key in obj ? Object.defineProperty(obj, key, {
|
|
2289
|
-
value: value,
|
|
2290
|
-
enumerable: !0,
|
|
2291
|
-
configurable: !0,
|
|
2292
|
-
writable: !0
|
|
2293
|
-
}) : obj[key] = value;
|
|
2294
|
-
}(this, "browserslist", void 0), this.name = 'BrowserslistError', this.browserslist = !0, Error.captureStackTrace && Error.captureStackTrace(this, BrowserslistError);
|
|
2295
|
-
}
|
|
2296
|
-
}
|
|
2297
|
-
let isFileCache = {};
|
|
2298
|
-
function isFile(file) {
|
|
2299
|
-
if (file in isFileCache) return isFileCache[file];
|
|
2300
|
-
let result = external_node_fs_.existsSync(file) && external_node_fs_.statSync(file).isFile();
|
|
2301
|
-
return isFileCache[file] = result, result;
|
|
2302
|
-
}
|
|
2303
|
-
function parsePackage(file) {
|
|
2304
|
-
let config = JSON.parse(external_node_fs_.readFileSync(file).toString().replace(/^\uFEFF/m, ''));
|
|
2305
|
-
if (config.browserlist && !config.browserslist) throw new BrowserslistError(`\`browserlist\` key instead of \`browserslist\` in ${file}`);
|
|
2306
|
-
let list = config.browserslist;
|
|
2307
|
-
for(let i in Array.isArray(list) && (list = {
|
|
2308
|
-
defaults: list
|
|
2309
|
-
}), 'string' == typeof list && (list = parseConfig(list)), list)!function(section) {
|
|
2310
|
-
let FORMAT = 'Browserslist config should be a string or an array of strings with browser queries';
|
|
2311
|
-
if (Array.isArray(section)) {
|
|
2312
|
-
for(let i = 0; i < section.length; i++)if ('string' != typeof section[i]) throw new BrowserslistError(FORMAT);
|
|
2313
|
-
} else if ('string' != typeof section) throw new BrowserslistError(FORMAT);
|
|
2314
|
-
}(list[i]);
|
|
2315
|
-
return list;
|
|
2316
|
-
}
|
|
2317
|
-
let IS_SECTION = /^\s*\[(.+)]\s*$/;
|
|
2318
|
-
function parseConfig(string) {
|
|
2319
|
-
let result = {
|
|
2320
|
-
defaults: []
|
|
2321
|
-
}, sections = [
|
|
2322
|
-
'defaults'
|
|
2323
|
-
];
|
|
2324
|
-
return string.toString().replace(/#[^\n]*/g, '').split(/\n|,/).map((line)=>line.trim()).filter((line)=>'' !== line).forEach((line)=>{
|
|
2325
|
-
let matched = line.match(IS_SECTION);
|
|
2326
|
-
matched ? (sections = matched[1].trim().split(' ')).forEach((section)=>{
|
|
2327
|
-
if (result[section]) throw new BrowserslistError(`Duplicate section ${section} in Browserslist config`);
|
|
2328
|
-
result[section] = [];
|
|
2329
|
-
}) : sections.forEach((section)=>{
|
|
2330
|
-
result[section].push(line);
|
|
2331
|
-
});
|
|
2332
|
-
}), result;
|
|
2333
|
-
}
|
|
2334
|
-
function parsePackageOrReadConfig(file) {
|
|
2335
|
-
return 'package.json' === external_node_path_.basename(file) ? parsePackage(file) : function(file) {
|
|
2336
|
-
if (!isFile(file)) throw new BrowserslistError(`Can't read ${file} config`);
|
|
2337
|
-
return parseConfig(external_node_fs_.readFileSync(file, 'utf-8'));
|
|
2338
|
-
}(file);
|
|
2339
|
-
}
|
|
2340
|
-
function pickEnv(config, opts) {
|
|
2341
|
-
let name;
|
|
2342
|
-
return 'object' != typeof config ? config : ('string' == typeof opts.env ? name = opts.env : process.env.BROWSERSLIST_ENV ? name = process.env.BROWSERSLIST_ENV : process.env.NODE_ENV ? name = process.env.NODE_ENV : name = 'production', config[name] || config.defaults);
|
|
2343
|
-
}
|
|
2344
|
-
function eachParent(file, callback) {
|
|
2345
|
-
let dir = isFile(file) ? external_node_path_.dirname(file) : file, loc = external_node_path_.resolve(dir);
|
|
2346
|
-
do {
|
|
2347
|
-
let result = callback(loc);
|
|
2348
|
-
if (void 0 !== result) return result;
|
|
2349
|
-
}while (loc !== (loc = external_node_path_.dirname(loc)));
|
|
2350
|
-
}
|
|
2351
|
-
let configCache = {}, RSBUILD_ALL_ENVIRONMENT_SYMBOL = 'RSBUILD_ALL_ENVIRONMENT_SYMBOL', isPluginMatchEnvironment = (pluginEnvironment, currentEnvironment)=>pluginEnvironment === currentEnvironment || pluginEnvironment === RSBUILD_ALL_ENVIRONMENT_SYMBOL, pluginDagSort = (plugins)=>{
|
|
2410
|
+
}, RSBUILD_ALL_ENVIRONMENT_SYMBOL = 'RSBUILD_ALL_ENVIRONMENT_SYMBOL', isPluginMatchEnvironment = (pluginEnvironment, currentEnvironment)=>pluginEnvironment === currentEnvironment || pluginEnvironment === RSBUILD_ALL_ENVIRONMENT_SYMBOL, pluginDagSort = (plugins)=>{
|
|
2352
2411
|
let allLines = [];
|
|
2353
2412
|
function getPlugin(name) {
|
|
2354
2413
|
let targets = plugins.filter((item)=>item.instance.name === name);
|
|
@@ -2378,7 +2437,7 @@ var __webpack_exports__ = {};
|
|
|
2378
2437
|
return sortedPoint;
|
|
2379
2438
|
};
|
|
2380
2439
|
async function initPlugins({ getPluginAPI, pluginManager }) {
|
|
2381
|
-
|
|
2440
|
+
rslog_index_js_namespaceObject.logger.debug('init plugins');
|
|
2382
2441
|
let plugins = pluginDagSort(pluginManager.getAllPluginsWithMeta()), removedPlugins = plugins.reduce((ret, plugin)=>(plugin.instance.remove && (ret[plugin.environment] ??= [], ret[plugin.environment].push(...plugin.instance.remove)), ret), {});
|
|
2383
2442
|
for (let plugin of plugins){
|
|
2384
2443
|
var _removedPlugins_plugin_environment, _removedPlugins_RSBUILD_ALL_ENVIRONMENT_SYMBOL;
|
|
@@ -2387,7 +2446,7 @@ var __webpack_exports__ = {};
|
|
|
2387
2446
|
let { instance, environment } = plugin;
|
|
2388
2447
|
await instance.setup(getPluginAPI(environment));
|
|
2389
2448
|
}
|
|
2390
|
-
|
|
2449
|
+
rslog_index_js_namespaceObject.logger.debug('init plugins done');
|
|
2391
2450
|
}
|
|
2392
2451
|
function createEnvironmentAsyncHook() {
|
|
2393
2452
|
let preGroup = [], postGroup = [], defaultGroup = [], tapEnvironment = ({ environment, handler: cb })=>{
|
|
@@ -2657,7 +2716,7 @@ var __webpack_exports__ = {};
|
|
|
2657
2716
|
let filename;
|
|
2658
2717
|
filename = config.output.filename.html ? config.output.filename.html.replace('[name]', entryName) : 'flat' === config.html.outputStructure ? `${entryName}.html` : `${entryName}/index.html`;
|
|
2659
2718
|
let prefix = config.output.distPath.html;
|
|
2660
|
-
return prefix.startsWith('/') &&
|
|
2719
|
+
return prefix.startsWith('/') && rslog_index_js_namespaceObject.logger.warn(`Absolute path is not recommended at \`output.distPath.html\`: "${prefix}", please use relative path instead.`), removeLeadingSlash(external_node_path_.posix.join(prefix, filename));
|
|
2661
2720
|
}(key, config)), prev;
|
|
2662
2721
|
}, {});
|
|
2663
2722
|
async function updateEnvironmentContext(context, configs) {
|
|
@@ -2677,14 +2736,14 @@ var __webpack_exports__ = {};
|
|
|
2677
2736
|
};
|
|
2678
2737
|
context.environments[name] = new Proxy(environmentContext, {
|
|
2679
2738
|
get: (target, prop)=>target[prop],
|
|
2680
|
-
set: (_, prop)=>(
|
|
2739
|
+
set: (_, prop)=>(rslog_index_js_namespaceObject.logger.error(`EnvironmentContext is readonly, you can not assign to the "environment.${prop}" prop.`), !0)
|
|
2681
2740
|
});
|
|
2682
2741
|
}
|
|
2683
2742
|
}
|
|
2684
2743
|
async function createContext(options, userConfig, bundlerType) {
|
|
2685
2744
|
let { cwd } = options, rootPath = userConfig.root ? getAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, external_node_path_.join)(rootPath, 'node_modules', '.cache');
|
|
2686
2745
|
return {
|
|
2687
|
-
version: "1.1.
|
|
2746
|
+
version: "1.1.3",
|
|
2688
2747
|
rootPath,
|
|
2689
2748
|
distPath: '',
|
|
2690
2749
|
cachePath,
|
|
@@ -2961,7 +3020,7 @@ var __webpack_exports__ = {};
|
|
|
2961
3020
|
if (!0 === cleanDistPath || 'auto' === cleanDistPath && isStrictSubdir(rootPath, cleanPath)) return cleanPath;
|
|
2962
3021
|
}, getCleanPath = (environment)=>{
|
|
2963
3022
|
let { rootPath } = api.context, { config, distPath } = environment, { cleanDistPath } = config.output;
|
|
2964
|
-
if ('auto' === cleanDistPath && !(cleanDistPath = isStrictSubdir(rootPath, distPath)) && (
|
|
3023
|
+
if ('auto' === cleanDistPath && !(cleanDistPath = isStrictSubdir(rootPath, distPath)) && (rslog_index_js_namespaceObject.logger.warn('The dist path is not a subdir of root path, Rsbuild will not empty it.'), rslog_index_js_namespaceObject.logger.warn(`Please set ${index_js_default().yellow('`output.cleanDistPath`')} config manually.`), rslog_index_js_namespaceObject.logger.warn(`Current root path: ${index_js_default().dim(rootPath)}`), rslog_index_js_namespaceObject.logger.warn(`Current dist path: ${index_js_default().dim(distPath)}`)), cleanDistPath) return distPath;
|
|
2965
3024
|
}, cleanAll = async (params)=>{
|
|
2966
3025
|
let cleanPaths = Object.values(params.environments).reduce((total, curr)=>(!total.find((t)=>t.distPath === curr.distPath) && total.push(curr), total), []).map((e)=>getCleanPath(e)).concat(getRsbuildCleanPath()).filter((p)=>!!p);
|
|
2967
3026
|
await Promise.all(dedupeCleanPaths(cleanPaths).map((p)=>emptyDir(p)));
|
|
@@ -3008,11 +3067,7 @@ var __webpack_exports__ = {};
|
|
|
3008
3067
|
mergeFn
|
|
3009
3068
|
}), initial) : config ?? initial;
|
|
3010
3069
|
}
|
|
3011
|
-
let
|
|
3012
|
-
plugin && (pluginHelper_htmlPlugin = plugin);
|
|
3013
|
-
}, getHTMLPlugin = ()=>(!pluginHelper_htmlPlugin && (pluginHelper_htmlPlugin = pluginHelper_require('../compiled/html-rspack-plugin/index.js')), pluginHelper_htmlPlugin), setCssExtractPlugin = (plugin)=>{
|
|
3014
|
-
cssExtractPlugin = plugin;
|
|
3015
|
-
}, getCssExtractPlugin = ()=>cssExtractPlugin ? cssExtractPlugin : core_default().CssExtractRspackPlugin, getCSSModulesLocalIdentName = (config, isProd)=>config.output.cssModules.localIdentName || (isProd ? '[local]-[hash:base64:6]' : '[path][name]__[local]-[hash:base64:6]'), normalizeCssLoaderOptions = (options, exportOnlyLocals)=>{
|
|
3070
|
+
let getCSSModulesLocalIdentName = (config, isProd)=>config.output.cssModules.localIdentName || (isProd ? '[local]-[hash:base64:6]' : '[path][name]__[local]-[hash:base64:6]'), normalizeCssLoaderOptions = (options, exportOnlyLocals)=>{
|
|
3016
3071
|
if (options.modules && exportOnlyLocals) {
|
|
3017
3072
|
let { modules } = options;
|
|
3018
3073
|
return modules = !0 === modules ? {
|
|
@@ -3191,7 +3246,7 @@ var __webpack_exports__ = {};
|
|
|
3191
3246
|
preEntry.forEach(addEntry), injectCoreJsEntry && addEntry(createVirtualModule('import "core-js";')), castArray(entry[entryName]).forEach(addEntry);
|
|
3192
3247
|
}
|
|
3193
3248
|
}), api.onBeforeCreateCompiler(({ bundlerConfigs })=>{
|
|
3194
|
-
if (bundlerConfigs.every((config)=>!config.entry)) throw Error(`Could not find any entry module, please make sure that ${
|
|
3249
|
+
if (bundlerConfigs.every((config)=>!config.entry)) throw Error(`Could not find any entry module, please make sure that ${index_js_default().cyan('src/index.(ts|js|tsx|jsx|mjs|cjs)')} exists, or customize entry through the ${index_js_default().cyan('source.entry')} configuration.`);
|
|
3195
3250
|
});
|
|
3196
3251
|
}
|
|
3197
3252
|
}), external_node_zlib_namespaceObject = require("node:zlib");
|
|
@@ -3200,10 +3255,10 @@ var __webpack_exports__ = {};
|
|
|
3200
3255
|
async function gzipSize(input) {
|
|
3201
3256
|
return (await fileSize_gzip(input)).length;
|
|
3202
3257
|
}
|
|
3203
|
-
let filterAsset = (asset)=>!/\.map$/.test(asset) && !/\.LICENSE\.txt$/.test(asset), getAssetColor = (size)=>size > 300000 ?
|
|
3258
|
+
let filterAsset = (asset)=>!/\.map$/.test(asset) && !/\.LICENSE\.txt$/.test(asset), getAssetColor = (size)=>size > 300000 ? index_js_default().red : size > 100000 ? index_js_default().yellow : index_js_default().green, calcFileSize = (len)=>{
|
|
3204
3259
|
let val = len / 1000;
|
|
3205
3260
|
return `${val.toFixed(val < 1 ? 2 : 1)} kB`;
|
|
3206
|
-
}, coloringAssetName = (assetName)=>JS_REGEX.test(assetName) ?
|
|
3261
|
+
}, coloringAssetName = (assetName)=>JS_REGEX.test(assetName) ? index_js_default().cyan(assetName) : CSS_REGEX.test(assetName) ? index_js_default().yellow(assetName) : HTML_REGEX.test(assetName) ? index_js_default().green(assetName) : index_js_default().magenta(assetName);
|
|
3207
3262
|
async function printFileSizes(options, stats, rootPath, environmentName) {
|
|
3208
3263
|
let logs = [];
|
|
3209
3264
|
if (!1 === options.detail && !1 === options.total) return logs;
|
|
@@ -3248,22 +3303,22 @@ var __webpack_exports__ = {};
|
|
|
3248
3303
|
let length = longestLengths[index], curLabel = cur;
|
|
3249
3304
|
return length && (curLabel = cur.length < length ? cur + ' '.repeat(length - cur.length) : cur), `${prev + curLabel} `;
|
|
3250
3305
|
}, ' ');
|
|
3251
|
-
return
|
|
3306
|
+
return index_js_default().blue(headerRow);
|
|
3252
3307
|
}(longestFileLength, longestLabelLength, options, environmentName));
|
|
3253
3308
|
let totalSize = 0, totalGzipSize = 0;
|
|
3254
3309
|
for (let asset of assets){
|
|
3255
3310
|
let { sizeLabel } = asset, { name, folder, gzipSizeLabel } = asset, fileNameLength = (folder + external_node_path_default().sep + name).length, sizeLength = sizeLabel.length;
|
|
3256
3311
|
if (totalSize += asset.size, asset.gzippedSize && (totalGzipSize += asset.gzippedSize), !1 !== options.detail) {
|
|
3257
3312
|
sizeLength < longestLabelLength && (sizeLabel += ' '.repeat(longestLabelLength - sizeLength));
|
|
3258
|
-
let fileNameLabel =
|
|
3313
|
+
let fileNameLabel = index_js_default().dim(asset.folder + external_node_path_default().sep) + coloringAssetName(asset.name);
|
|
3259
3314
|
fileNameLength < longestFileLength && (fileNameLabel += ' '.repeat(longestFileLength - fileNameLength));
|
|
3260
3315
|
let log = ` ${fileNameLabel} ${sizeLabel}`;
|
|
3261
3316
|
gzipSizeLabel && (log += ` ${gzipSizeLabel}`), logs.push(log);
|
|
3262
3317
|
}
|
|
3263
3318
|
}
|
|
3264
3319
|
if (!1 !== options.total) {
|
|
3265
|
-
let totalSizeLabel = `${
|
|
3266
|
-
options.compressed && (log +=
|
|
3320
|
+
let totalSizeLabel = `${index_js_default().blue('Total:')} ${calcFileSize(totalSize)}`, log = `\n ${totalSizeLabel}`;
|
|
3321
|
+
options.compressed && (log += index_js_default().dim(` (gzip: ${calcFileSize(totalGzipSize)})`)), log += '\n', logs.push(log);
|
|
3267
3322
|
}
|
|
3268
3323
|
return logs;
|
|
3269
3324
|
}
|
|
@@ -3286,10 +3341,10 @@ var __webpack_exports__ = {};
|
|
|
3286
3341
|
...defaultConfig,
|
|
3287
3342
|
...printFileSize
|
|
3288
3343
|
}, statsLogs = await printFileSizes(mergedConfig, multiStats[index], api.context.rootPath, environment.name);
|
|
3289
|
-
logs.length && logs.push(
|
|
3344
|
+
logs.length && logs.push(index_js_default().dim(' -----')), logs.push(...statsLogs);
|
|
3290
3345
|
})).catch((err)=>{
|
|
3291
|
-
|
|
3292
|
-
}),
|
|
3346
|
+
rslog_index_js_namespaceObject.logger.warn('Failed to print file size.'), rslog_index_js_namespaceObject.logger.warn(err);
|
|
3347
|
+
}), rslog_index_js_namespaceObject.logger.log(logs.join('\n'));
|
|
3293
3348
|
});
|
|
3294
3349
|
}
|
|
3295
3350
|
});
|
|
@@ -3463,7 +3518,7 @@ var __webpack_exports__ = {};
|
|
|
3463
3518
|
};
|
|
3464
3519
|
let absolutePath = (0, external_node_path_.isAbsolute)(templatePath) ? templatePath : external_node_path_default().resolve(rootPath, templatePath);
|
|
3465
3520
|
if (!existTemplatePath.has(absolutePath)) {
|
|
3466
|
-
if (!await isFileExists(absolutePath)) throw Error(`Failed to resolve HTML template, please check if the file exists: ${
|
|
3521
|
+
if (!await isFileExists(absolutePath)) throw Error(`Failed to resolve HTML template, please check if the file exists: ${index_js_default().cyan(absolutePath)}`);
|
|
3467
3522
|
existTemplatePath.add(absolutePath);
|
|
3468
3523
|
}
|
|
3469
3524
|
let templateContent = await external_node_fs_default().promises.readFile(absolutePath, 'utf-8');
|
|
@@ -3997,16 +4052,16 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3997
4052
|
if (routes.length <= 1) {
|
|
3998
4053
|
let pathname = routes.length ? routes[0].pathname : '';
|
|
3999
4054
|
return urls.map(({ label, url })=>{
|
|
4000
|
-
let normalizedPathname = normalizeUrl(`${url}${pathname}`), prefix = `➜ ${
|
|
4001
|
-
return ` ${prefix}${
|
|
4055
|
+
let normalizedPathname = normalizeUrl(`${url}${pathname}`), prefix = `➜ ${index_js_default().dim(label.padEnd(10))}`;
|
|
4056
|
+
return ` ${prefix}${index_js_default().cyan(normalizedPathname)}\n`;
|
|
4002
4057
|
}).join('');
|
|
4003
4058
|
}
|
|
4004
4059
|
let message = '', maxNameLength = Math.max(...routes.map((r)=>r.entryName.length));
|
|
4005
4060
|
return urls.forEach(({ label, url }, index)=>{
|
|
4006
|
-
for (let r of (index > 0 && (message += '\n'), message += ` ➜ ${label}\n`, routes))message += ` ${
|
|
4061
|
+
for (let r of (index > 0 && (message += '\n'), message += ` ➜ ${label}\n`, routes))message += ` ${index_js_default().dim('-')} ${index_js_default().dim(r.entryName.padEnd(maxNameLength + 4))}${index_js_default().cyan(normalizeUrl(`${url}${r.pathname}`))}\n`;
|
|
4007
4062
|
}), message;
|
|
4008
4063
|
}(urls, routes);
|
|
4009
|
-
return !1 === trailingLineBreak && message.endsWith('\n') && (message = message.slice(0, -1)),
|
|
4064
|
+
return !1 === trailingLineBreak && message.endsWith('\n') && (message = message.slice(0, -1)), rslog_index_js_namespaceObject.logger.log(message), message;
|
|
4010
4065
|
}
|
|
4011
4066
|
let getPort = async ({ host, port, strictPort, tryLimits = 20 })=>{
|
|
4012
4067
|
'string' == typeof port && (port = Number.parseInt(port, 10)), strictPort && (tryLimits = 1);
|
|
@@ -4032,7 +4087,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4032
4087
|
host,
|
|
4033
4088
|
port: originalPort,
|
|
4034
4089
|
strictPort: config.server.strictPort || !1
|
|
4035
|
-
}), https = !!config.server.https, portTip = port !== originalPort ? `Port ${originalPort} is in use, ${
|
|
4090
|
+
}), https = !!config.server.https, portTip = port !== originalPort ? `Port ${originalPort} is in use, ${index_js_default().yellow(`using port ${port}.`)}` : void 0;
|
|
4036
4091
|
return {
|
|
4037
4092
|
port,
|
|
4038
4093
|
host,
|
|
@@ -4129,15 +4184,15 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4129
4184
|
if (targetBrowser) return await execAsync(`osascript openChrome.applescript "${encodeURI(url)}" "${targetBrowser}"`, {
|
|
4130
4185
|
cwd: STATIC_PATH
|
|
4131
4186
|
}), !0;
|
|
4132
|
-
|
|
4187
|
+
rslog_index_js_namespaceObject.logger.debug('Failed to find the target browser.');
|
|
4133
4188
|
} catch (err) {
|
|
4134
|
-
|
|
4189
|
+
rslog_index_js_namespaceObject.logger.debug('Failed to open start URL with apple script.'), rslog_index_js_namespaceObject.logger.debug(err);
|
|
4135
4190
|
}
|
|
4136
4191
|
try {
|
|
4137
4192
|
let { default: open } = await Promise.resolve().then(__webpack_require__.t.bind(__webpack_require__, "../../compiled/open/index.js", 23));
|
|
4138
4193
|
return await open(url), !0;
|
|
4139
4194
|
} catch (err) {
|
|
4140
|
-
return
|
|
4195
|
+
return rslog_index_js_namespaceObject.logger.error('Failed to open start URL.'), rslog_index_js_namespaceObject.logger.error(err), !1;
|
|
4141
4196
|
}
|
|
4142
4197
|
}
|
|
4143
4198
|
let openedURLs = [], clearOpenedURLs = ()=>{
|
|
@@ -4489,18 +4544,18 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4489
4544
|
]
|
|
4490
4545
|
});
|
|
4491
4546
|
} catch (err) {
|
|
4492
|
-
|
|
4547
|
+
rslog_index_js_namespaceObject.logger.warn(`\`process.env.RSDOCTOR\` enabled, please install ${index_js_default().bold(index_js_default().yellow(packageName))} package.`);
|
|
4493
4548
|
return;
|
|
4494
4549
|
}
|
|
4495
4550
|
try {
|
|
4496
4551
|
module1 = await import(packagePath);
|
|
4497
4552
|
} catch (err) {
|
|
4498
|
-
|
|
4553
|
+
rslog_index_js_namespaceObject.logger.error(`\`process.env.RSDOCTOR\` enabled, but failed to load ${index_js_default().bold(index_js_default().yellow(packageName))} module.`);
|
|
4499
4554
|
return;
|
|
4500
4555
|
}
|
|
4501
4556
|
if (!!module1 && !!module1[pluginName]) {
|
|
4502
4557
|
for (let config of bundlerConfigs)config.plugins ||= [], config.plugins.push(new module1[pluginName]());
|
|
4503
|
-
|
|
4558
|
+
rslog_index_js_namespaceObject.logger.info(`${index_js_default().bold(index_js_default().yellow(packageName))} enabled.`);
|
|
4504
4559
|
}
|
|
4505
4560
|
});
|
|
4506
4561
|
}
|
|
@@ -4509,7 +4564,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4509
4564
|
let stopProfiler = (output, profileSession)=>{
|
|
4510
4565
|
if (!!profileSession) profileSession.post('Profiler.stop', (error, param)=>{
|
|
4511
4566
|
if (error) {
|
|
4512
|
-
|
|
4567
|
+
rslog_index_js_namespaceObject.logger.error('Failed to generate JS CPU profile:', error);
|
|
4513
4568
|
return;
|
|
4514
4569
|
}
|
|
4515
4570
|
external_node_fs_default().writeFileSync(output, JSON.stringify(param.profile));
|
|
@@ -4543,7 +4598,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4543
4598
|
}), api.onExit(()=>{
|
|
4544
4599
|
enableProfileTrace && core_default().experiments.globalTrace.cleanup();
|
|
4545
4600
|
let profileDir = external_node_path_default().join(api.context.distPath, profileDirName);
|
|
4546
|
-
stopProfiler(external_node_path_default().join(profileDir, 'jscpuprofile.json'), profileSession),
|
|
4601
|
+
stopProfiler(external_node_path_default().join(profileDir, 'jscpuprofile.json'), profileSession), rslog_index_js_namespaceObject.logger.info(`Saved Rspack profile file to ${profileDir}`);
|
|
4547
4602
|
});
|
|
4548
4603
|
}
|
|
4549
4604
|
}), pluginServer = ()=>({
|
|
@@ -4764,7 +4819,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4764
4819
|
if (!!assetName) if (assets[assetName]) {
|
|
4765
4820
|
let integrity = calcIntegrity(algorithm, assetName, assets[assetName].buffer());
|
|
4766
4821
|
replacedHtml = replacedHtml.replaceAll(`integrity="${placeholder}${assetName}"`, `integrity="${integrity}"`);
|
|
4767
|
-
} else
|
|
4822
|
+
} else rslog_index_js_namespaceObject.logger.debug(`[rsbuild:sri] failed to generate integrity for ${assetName}.`), replacedHtml = replacedHtml.replace(`integrity="${placeholder}${assetName}"`, '');
|
|
4768
4823
|
}
|
|
4769
4824
|
return replacedHtml;
|
|
4770
4825
|
};
|
|
@@ -4972,7 +5027,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4972
5027
|
}
|
|
4973
5028
|
async function modifyBundlerChain(context, utils) {
|
|
4974
5029
|
var _utils_environment_config_tools;
|
|
4975
|
-
|
|
5030
|
+
rslog_index_js_namespaceObject.logger.debug('modify bundler chain');
|
|
4976
5031
|
let bundlerChain = new (rspack_chain_index_js_default())(), [modifiedBundlerChain] = await context.hooks.modifyBundlerChain.callInEnvironment({
|
|
4977
5032
|
environment: utils.environment.name,
|
|
4978
5033
|
args: [
|
|
@@ -4981,7 +5036,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4981
5036
|
]
|
|
4982
5037
|
});
|
|
4983
5038
|
if (null === (_utils_environment_config_tools = utils.environment.config.tools) || void 0 === _utils_environment_config_tools ? void 0 : _utils_environment_config_tools.bundlerChain) for (let item of castArray(utils.environment.config.tools.bundlerChain))await item(modifiedBundlerChain, utils);
|
|
4984
|
-
return
|
|
5039
|
+
return rslog_index_js_namespaceObject.logger.debug('modify bundler chain done'), modifiedBundlerChain;
|
|
4985
5040
|
}
|
|
4986
5041
|
function chainToConfig(chain) {
|
|
4987
5042
|
let config = chain.toConfig(), { entry } = config;
|
|
@@ -5078,7 +5133,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5078
5133
|
};
|
|
5079
5134
|
async function modifyRspackConfig(context, rspackConfig, utils) {
|
|
5080
5135
|
var _utils_environment_config_tools;
|
|
5081
|
-
|
|
5136
|
+
rslog_index_js_namespaceObject.logger.debug('modify Rspack config');
|
|
5082
5137
|
let [modifiedConfig] = await context.hooks.modifyRspackConfig.callInEnvironment({
|
|
5083
5138
|
environment: utils.environment.name,
|
|
5084
5139
|
args: [
|
|
@@ -5091,7 +5146,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5091
5146
|
config: utils.environment.config.tools.rspack,
|
|
5092
5147
|
ctx: utils,
|
|
5093
5148
|
mergeFn: utils.mergeConfig
|
|
5094
|
-
})),
|
|
5149
|
+
})), rslog_index_js_namespaceObject.logger.debug('modify Rspack config done'), modifiedConfig;
|
|
5095
5150
|
}
|
|
5096
5151
|
async function getConfigUtils(config, chainUtils) {
|
|
5097
5152
|
let { merge } = await Promise.resolve().then(__webpack_require__.t.bind(__webpack_require__, "../../compiled/webpack-merge/index.js", 23));
|
|
@@ -5146,21 +5201,21 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5146
5201
|
}));
|
|
5147
5202
|
if ((rspackConfig = await modifyRspackConfig(context, rspackConfig, await getConfigUtils(rspackConfig, chainUtils))).plugins) {
|
|
5148
5203
|
for (let plugin of rspackConfig.plugins)if (plugin && void 0 === plugin.apply && 'name' in plugin && 'setup' in plugin) {
|
|
5149
|
-
let name =
|
|
5204
|
+
let name = index_js_default().bold(index_js_default().yellow(plugin.name));
|
|
5150
5205
|
throw Error(`${name} appears to be an Rsbuild plugin. It cannot be used as an Rspack plugin.`);
|
|
5151
5206
|
}
|
|
5152
5207
|
}
|
|
5153
5208
|
return rspackConfig;
|
|
5154
5209
|
}
|
|
5155
5210
|
async function modifyRsbuildConfig(context) {
|
|
5156
|
-
|
|
5211
|
+
rslog_index_js_namespaceObject.logger.debug('modify Rsbuild config');
|
|
5157
5212
|
let [modified] = await context.hooks.modifyRsbuildConfig.call(context.config, {
|
|
5158
5213
|
mergeRsbuildConfig: mergeRsbuildConfig
|
|
5159
5214
|
});
|
|
5160
|
-
context.config = modified,
|
|
5215
|
+
context.config = modified, rslog_index_js_namespaceObject.logger.debug('modify Rsbuild config done');
|
|
5161
5216
|
}
|
|
5162
5217
|
async function modifyEnvironmentConfig(context, config, name) {
|
|
5163
|
-
|
|
5218
|
+
rslog_index_js_namespaceObject.logger.debug(`modify Rsbuild environment(${name}) config`);
|
|
5164
5219
|
let [modified] = await context.hooks.modifyEnvironmentConfig.callInEnvironment({
|
|
5165
5220
|
environment: name,
|
|
5166
5221
|
args: [
|
|
@@ -5171,7 +5226,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5171
5226
|
}
|
|
5172
5227
|
]
|
|
5173
5228
|
});
|
|
5174
|
-
return
|
|
5229
|
+
return rslog_index_js_namespaceObject.logger.debug(`modify Rsbuild environment(${name}) config done`), modified;
|
|
5175
5230
|
}
|
|
5176
5231
|
let initEnvironmentConfigs = (normalizedConfig, rootPath, specifiedEnvironments)=>{
|
|
5177
5232
|
let defaultEntry;
|
|
@@ -5208,11 +5263,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5208
5263
|
}, config)
|
|
5209
5264
|
})
|
|
5210
5265
|
]));
|
|
5211
|
-
if (!Object.keys(resolvedEnvironments).length) throw Error(`The current build is specified to run only in the ${
|
|
5266
|
+
if (!Object.keys(resolvedEnvironments).length) throw Error(`The current build is specified to run only in the ${index_js_default().yellow(null == specifiedEnvironments ? void 0 : specifiedEnvironments.join(','))} environment, but the configuration of the specified environment was not found.`);
|
|
5212
5267
|
return resolvedEnvironments;
|
|
5213
5268
|
}
|
|
5214
5269
|
let defaultEnvironmentName = camelCase(rsbuildSharedConfig.output.target);
|
|
5215
|
-
if (!isEnvironmentEnabled(defaultEnvironmentName)) throw Error(`The current build is specified to run only in the ${
|
|
5270
|
+
if (!isEnvironmentEnabled(defaultEnvironmentName)) throw Error(`The current build is specified to run only in the ${index_js_default().yellow(null == specifiedEnvironments ? void 0 : specifiedEnvironments.join(','))} environment, but the configuration of the specified environment was not found.`);
|
|
5216
5271
|
return {
|
|
5217
5272
|
[defaultEnvironmentName]: applyEnvironmentDefaultConfig({
|
|
5218
5273
|
...rsbuildSharedConfig,
|
|
@@ -5301,19 +5356,19 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5301
5356
|
let shortcuts = [
|
|
5302
5357
|
{
|
|
5303
5358
|
key: 'c',
|
|
5304
|
-
description: `${
|
|
5359
|
+
description: `${index_js_default().bold('c + enter')} ${index_js_default().dim('clear console')}`,
|
|
5305
5360
|
action: ()=>{
|
|
5306
5361
|
console.clear();
|
|
5307
5362
|
}
|
|
5308
5363
|
},
|
|
5309
5364
|
{
|
|
5310
5365
|
key: 'o',
|
|
5311
|
-
description: `${
|
|
5366
|
+
description: `${index_js_default().bold('o + enter')} ${index_js_default().dim('open in browser')}`,
|
|
5312
5367
|
action: openPage
|
|
5313
5368
|
},
|
|
5314
5369
|
{
|
|
5315
5370
|
key: 'q',
|
|
5316
|
-
description: `${
|
|
5371
|
+
description: `${index_js_default().bold('q + enter')} ${index_js_default().dim('quit process')}`,
|
|
5317
5372
|
action: async ()=>{
|
|
5318
5373
|
try {
|
|
5319
5374
|
await closeServer();
|
|
@@ -5324,25 +5379,25 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5324
5379
|
},
|
|
5325
5380
|
restartServer ? {
|
|
5326
5381
|
key: 'r',
|
|
5327
|
-
description: `${
|
|
5382
|
+
description: `${index_js_default().bold('r + enter')} ${index_js_default().dim('restart server')}`,
|
|
5328
5383
|
action: restartServer
|
|
5329
5384
|
} : null,
|
|
5330
5385
|
{
|
|
5331
5386
|
key: 'u',
|
|
5332
|
-
description: `${
|
|
5387
|
+
description: `${index_js_default().bold('u + enter')} ${index_js_default().dim('show urls')}`,
|
|
5333
5388
|
action: printUrls
|
|
5334
5389
|
}
|
|
5335
5390
|
].filter(Boolean);
|
|
5336
5391
|
if (customShortcuts && !Array.isArray(shortcuts = customShortcuts(shortcuts))) throw Error('`dev.cliShortcuts` must return an array of shortcuts.');
|
|
5337
|
-
help &&
|
|
5392
|
+
help && rslog_index_js_namespaceObject.logger.log(` ➜ ${index_js_default().dim('press')} ${index_js_default().bold('h + enter')} ${index_js_default().dim('to show shortcuts')}\n`);
|
|
5338
5393
|
let rl = external_node_readline_default().createInterface({
|
|
5339
5394
|
input: process.stdin
|
|
5340
5395
|
});
|
|
5341
5396
|
rl.on('line', (input)=>{
|
|
5342
5397
|
if ('h' === input) {
|
|
5343
|
-
let message = `\n ${
|
|
5398
|
+
let message = `\n ${index_js_default().bold(index_js_default().blue('Shortcuts:'))}\n`;
|
|
5344
5399
|
for (let shortcut of shortcuts)message += ` ${shortcut.description}\n`;
|
|
5345
|
-
|
|
5400
|
+
rslog_index_js_namespaceObject.logger.log(message);
|
|
5346
5401
|
}
|
|
5347
5402
|
for (let shortcut of shortcuts)if (input === shortcut.key) {
|
|
5348
5403
|
shortcut.action();
|
|
@@ -5405,7 +5460,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5405
5460
|
noServer: !0,
|
|
5406
5461
|
path: null === (_this_options_client = this.options.client) || void 0 === _this_options_client ? void 0 : _this_options_client.path
|
|
5407
5462
|
}), this.wsServer.on('error', (err)=>{
|
|
5408
|
-
|
|
5463
|
+
rslog_index_js_namespaceObject.logger.error(err);
|
|
5409
5464
|
}), this.timer = setInterval(()=>{
|
|
5410
5465
|
for (let socket of this.wsServer.clients)socket.isAlive ? (socket.isAlive = !1, socket.ping(()=>{})) : socket.terminate();
|
|
5411
5466
|
}, 30000), this.wsServer.on('connection', (socket, req)=>{
|
|
@@ -5453,7 +5508,9 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5453
5508
|
}
|
|
5454
5509
|
getStats(name) {
|
|
5455
5510
|
let curStats = this.stats[name];
|
|
5456
|
-
|
|
5511
|
+
if (!curStats) return null;
|
|
5512
|
+
let statsOptions = getStatsOptions(curStats.compilation.compiler);
|
|
5513
|
+
return curStats.toJson({
|
|
5457
5514
|
all: !1,
|
|
5458
5515
|
hash: !0,
|
|
5459
5516
|
assets: !0,
|
|
@@ -5463,8 +5520,9 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5463
5520
|
errorsCount: !0,
|
|
5464
5521
|
errorDetails: !1,
|
|
5465
5522
|
entrypoints: !0,
|
|
5466
|
-
children: !0
|
|
5467
|
-
|
|
5523
|
+
children: !0,
|
|
5524
|
+
...statsOptions
|
|
5525
|
+
});
|
|
5468
5526
|
}
|
|
5469
5527
|
sendStats({ force = !1, compilationId }) {
|
|
5470
5528
|
let stats = this.getStats(compilationId);
|
|
@@ -5847,13 +5905,13 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5847
5905
|
]), res), next();
|
|
5848
5906
|
}, faviconFallbackMiddleware = (req, res, next)=>{
|
|
5849
5907
|
'/favicon.ico' === req.url ? (res.statusCode = 204, res.end()) : next();
|
|
5850
|
-
}, getStatusCodeColor = (status)=>status >= 500 ?
|
|
5908
|
+
}, getStatusCodeColor = (status)=>status >= 500 ? index_js_default().red : status >= 400 ? index_js_default().yellow : status >= 300 ? index_js_default().cyan : status >= 200 ? index_js_default().green : (res)=>res, getRequestLoggerMiddleware = async ()=>{
|
|
5851
5909
|
let { default: onFinished } = await Promise.resolve().then(__webpack_require__.t.bind(__webpack_require__, "../../compiled/on-finished/index.js", 23));
|
|
5852
5910
|
return (req, res, next)=>{
|
|
5853
5911
|
let _startAt = process.hrtime();
|
|
5854
5912
|
onFinished(res, ()=>{
|
|
5855
5913
|
let method = req.method, url = req.originalUrl || req.url, status = Number(res.statusCode), statusColor = getStatusCodeColor(status), endAt = process.hrtime(), totalTime = (endAt[0] - _startAt[0]) * 1e3 + (endAt[1] - _startAt[1]) * 1e-6;
|
|
5856
|
-
|
|
5914
|
+
rslog_index_js_namespaceObject.logger.debug(`${statusColor(status)} ${method} ${index_js_default().gray(url)} ${index_js_default().gray(`${totalTime.toFixed(3)} ms`)}`);
|
|
5857
5915
|
}), next();
|
|
5858
5916
|
};
|
|
5859
5917
|
}, notFoundMiddleware = (_req, res, _next)=>{
|
|
@@ -5904,7 +5962,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5904
5962
|
let filePath = external_node_path_default().join(distPath, 'index.html');
|
|
5905
5963
|
if (await middlewares_isFileExists(filePath, outputFileSystem)) {
|
|
5906
5964
|
let newUrl = '/index.html';
|
|
5907
|
-
return 'verbose' ===
|
|
5965
|
+
return 'verbose' === rslog_index_js_namespaceObject.logger.level && rslog_index_js_namespaceObject.logger.debug(`${req.method} ${index_js_default().gray(`${req.url} ${index_js_default().yellow('fallback')} to ${newUrl}`)}`), req.url = newUrl, callback(req, res, (...args)=>next(...args));
|
|
5908
5966
|
}
|
|
5909
5967
|
next();
|
|
5910
5968
|
}, viewingServedFilesMiddleware = ({ environments })=>async (req, res, next)=>{
|
|
@@ -5964,7 +6022,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5964
6022
|
}
|
|
5965
6023
|
res.end('</body></html>');
|
|
5966
6024
|
} catch (err) {
|
|
5967
|
-
|
|
6025
|
+
rslog_index_js_namespaceObject.logger.error(err), res.writeHead(500), res.end('Failed to list the files');
|
|
5968
6026
|
}
|
|
5969
6027
|
} else next();
|
|
5970
6028
|
}, createProxyMiddleware = async (proxyOptions)=>{
|
|
@@ -5980,7 +6038,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5980
6038
|
};
|
|
5981
6039
|
'string' == typeof options ? opts.target = options : Object.assign(opts, options), ret.push(opts);
|
|
5982
6040
|
}
|
|
5983
|
-
let handleError = (err)=>
|
|
6041
|
+
let handleError = (err)=>rslog_index_js_namespaceObject.logger.error(err);
|
|
5984
6042
|
for (let opts of ret)opts.onError ??= handleError;
|
|
5985
6043
|
return ret;
|
|
5986
6044
|
}(proxyOptions), proxyMiddlewares = [], middlewares = [], { createProxyMiddleware: baseMiddleware } = await Promise.resolve().then(__webpack_require__.t.bind(__webpack_require__, "../../compiled/http-proxy-middleware/index.js", 23));
|
|
@@ -6070,7 +6128,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6070
6128
|
};
|
|
6071
6129
|
}, getMiddlewares = async (options)=>{
|
|
6072
6130
|
let middlewares = [], { environments, compileMiddlewareAPI } = options;
|
|
6073
|
-
'verbose' ===
|
|
6131
|
+
'verbose' === rslog_index_js_namespaceObject.logger.level && middlewares.push(await getRequestLoggerMiddleware());
|
|
6074
6132
|
let { before, after } = applySetupMiddlewares(options.dev, environments, compileMiddlewareAPI);
|
|
6075
6133
|
middlewares.push(...before);
|
|
6076
6134
|
let { onUpgrade } = await applyDefaultMiddlewares({
|
|
@@ -6102,7 +6160,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6102
6160
|
}, devServer_formatDevConfig = (config, port)=>('<port>' === config.client.port && (config.client.port = String(port)), config);
|
|
6103
6161
|
async function devServer_createDevServer(options, createCompiler, config, { compiler: customCompiler, getPortSilently, runCompile = !0 } = {}) {
|
|
6104
6162
|
let lastStats;
|
|
6105
|
-
|
|
6163
|
+
rslog_index_js_namespaceObject.logger.debug('create dev server');
|
|
6106
6164
|
let { port, host, https, portTip } = await getServerConfig({
|
|
6107
6165
|
config
|
|
6108
6166
|
}), devConfig = devServer_formatDevConfig(config.dev, port), routes = getRoutes(options.context);
|
|
@@ -6175,7 +6233,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6175
6233
|
customShortcuts: shortcutsOptions.custom
|
|
6176
6234
|
});
|
|
6177
6235
|
}
|
|
6178
|
-
!getPortSilently && portTip &&
|
|
6236
|
+
!getPortSilently && portTip && rslog_index_js_namespaceObject.logger.info(portTip);
|
|
6179
6237
|
};
|
|
6180
6238
|
runCompile ? options.context.hooks.onBeforeCreateCompiler.tap(beforeCreateCompiler) : beforeCreateCompiler();
|
|
6181
6239
|
let compileMiddlewareAPI = runCompile ? await startCompile() : void 0, root = options.context.rootPath, fileWatcher = await setupWatchFiles({
|
|
@@ -6220,13 +6278,13 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6220
6278
|
serverConfig: config.server,
|
|
6221
6279
|
middlewares
|
|
6222
6280
|
}), serverTerminator = getServerTerminator(httpServer);
|
|
6223
|
-
return
|
|
6281
|
+
return rslog_index_js_namespaceObject.logger.debug('listen dev server'), options.context.hooks.onCloseDevServer.tap(serverTerminator), new Promise((resolve)=>{
|
|
6224
6282
|
httpServer.listen({
|
|
6225
6283
|
host,
|
|
6226
6284
|
port
|
|
6227
6285
|
}, async (err)=>{
|
|
6228
6286
|
if (err) throw err;
|
|
6229
|
-
middlewares.use(notFoundMiddleware), httpServer.on('upgrade', devMiddlewares.onUpgrade),
|
|
6287
|
+
middlewares.use(notFoundMiddleware), httpServer.on('upgrade', devMiddlewares.onUpgrade), rslog_index_js_namespaceObject.logger.debug('listen dev server done'), await devServerAPI.afterListen(), onBeforeRestartServer(devServerAPI.close), resolve({
|
|
6230
6288
|
port,
|
|
6231
6289
|
urls: urls.map((item)=>item.url),
|
|
6232
6290
|
server: {
|
|
@@ -6250,36 +6308,32 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6250
6308
|
printUrls,
|
|
6251
6309
|
open: openPage
|
|
6252
6310
|
};
|
|
6253
|
-
return
|
|
6311
|
+
return rslog_index_js_namespaceObject.logger.debug('create dev server done'), devServerAPI;
|
|
6254
6312
|
}
|
|
6255
6313
|
async function createCompiler_createCompiler(options) {
|
|
6256
6314
|
var _context_normalizedConfig, _context_normalizedConfig1;
|
|
6257
|
-
|
|
6315
|
+
rslog_index_js_namespaceObject.logger.debug('create compiler');
|
|
6258
6316
|
let { context } = options, { rspackConfigs } = await initConfigs(options);
|
|
6259
6317
|
if (await context.hooks.onBeforeCreateCompiler.call({
|
|
6260
6318
|
bundlerConfigs: rspackConfigs,
|
|
6261
6319
|
environments: context.environments
|
|
6262
|
-
}), !await isSatisfyRspackVersion(core_namespaceObject.rspack.rspackVersion)) throw Error(`The current Rspack version does not meet the requirements, the minimum supported version of Rspack is ${
|
|
6320
|
+
}), !await isSatisfyRspackVersion(core_namespaceObject.rspack.rspackVersion)) throw Error(`The current Rspack version does not meet the requirements, the minimum supported version of Rspack is ${index_js_default().green(rspackMinVersion)}`);
|
|
6263
6321
|
let compiler = 1 === rspackConfigs.length ? (0, core_namespaceObject.rspack)(rspackConfigs[0]) : (0, core_namespaceObject.rspack)(rspackConfigs), isVersionLogged = !1, isCompiling = !1, logRspackVersion = ()=>{
|
|
6264
|
-
!isVersionLogged && (
|
|
6322
|
+
!isVersionLogged && (rslog_index_js_namespaceObject.logger.debug(`Use Rspack v${core_namespaceObject.rspack.rspackVersion}`), isVersionLogged = !0);
|
|
6265
6323
|
};
|
|
6266
6324
|
compiler.hooks.watchRun.tap('rsbuild:compiling', ()=>{
|
|
6267
|
-
logRspackVersion(), !isCompiling &&
|
|
6325
|
+
logRspackVersion(), !isCompiling && rslog_index_js_namespaceObject.logger.start('Building...'), isCompiling = !0;
|
|
6268
6326
|
}), (null === (_context_normalizedConfig = context.normalizedConfig) || void 0 === _context_normalizedConfig ? void 0 : _context_normalizedConfig.mode) === 'production' && compiler.hooks.run.tap('rsbuild:run', logRspackVersion);
|
|
6269
6327
|
let done = (stats)=>{
|
|
6270
6328
|
let statsOptions = getStatsOptions(compiler), statsJson = stats.toJson({
|
|
6271
6329
|
children: !0,
|
|
6272
6330
|
timings: !0,
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
} : {
|
|
6276
|
-
preset: 'errors-warnings'
|
|
6277
|
-
},
|
|
6278
|
-
...'object' == typeof statsOptions ? statsOptions : {}
|
|
6331
|
+
preset: 'errors-warnings',
|
|
6332
|
+
...statsOptions
|
|
6279
6333
|
}), printTime = (c, index)=>{
|
|
6280
6334
|
if (c.time) {
|
|
6281
|
-
let time = prettyTime(c.time / 1000), { name } = rspackConfigs[index], suffix = name ?
|
|
6282
|
-
|
|
6335
|
+
let time = prettyTime(c.time / 1000), { name } = rspackConfigs[index], suffix = name ? index_js_default().gray(` (${name})`) : '';
|
|
6336
|
+
rslog_index_js_namespaceObject.logger.ready(`Built in ${time}${suffix}`);
|
|
6283
6337
|
}
|
|
6284
6338
|
}, hasErrors = stats.hasErrors();
|
|
6285
6339
|
if (!hasErrors) {
|
|
@@ -6289,7 +6343,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6289
6343
|
}) : printTime(statsJson, 0);
|
|
6290
6344
|
}
|
|
6291
6345
|
let { message, level } = formatStats(statsJson, hasErrors);
|
|
6292
|
-
'error' === level &&
|
|
6346
|
+
'error' === level && rslog_index_js_namespaceObject.logger.error(message), 'warning' === level && rslog_index_js_namespaceObject.logger.warn(message), isCompiling = !1;
|
|
6293
6347
|
};
|
|
6294
6348
|
return compiler.hooks.done.tap('rsbuild:done', (stats)=>{
|
|
6295
6349
|
done(stats);
|
|
@@ -6301,7 +6355,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6301
6355
|
}), await context.hooks.onAfterCreateCompiler.call({
|
|
6302
6356
|
compiler,
|
|
6303
6357
|
environments: context.environments
|
|
6304
|
-
}),
|
|
6358
|
+
}), rslog_index_js_namespaceObject.logger.debug('create compiler done'), {
|
|
6305
6359
|
compiler,
|
|
6306
6360
|
rspackConfigs
|
|
6307
6361
|
};
|
|
@@ -6321,7 +6375,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6321
6375
|
isWatch: !!watch,
|
|
6322
6376
|
MultiStatsCtor: core_namespaceObject.rspack.MultiStats
|
|
6323
6377
|
}), watch) return compiler.watch({}, (err)=>{
|
|
6324
|
-
err &&
|
|
6378
|
+
err && rslog_index_js_namespaceObject.logger.error(err);
|
|
6325
6379
|
}), {
|
|
6326
6380
|
close: ()=>new Promise((resolve)=>{
|
|
6327
6381
|
compiler.close(()=>{
|
|
@@ -6332,7 +6386,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6332
6386
|
let { stats } = await new Promise((resolve, reject)=>{
|
|
6333
6387
|
compiler.run((err, stats)=>{
|
|
6334
6388
|
err ? reject(err) : (null == stats ? void 0 : stats.hasErrors()) ? reject(Error('Rspack build failed!')) : compiler.close((closeErr)=>{
|
|
6335
|
-
closeErr &&
|
|
6389
|
+
closeErr && rslog_index_js_namespaceObject.logger.error(closeErr), resolve({
|
|
6336
6390
|
stats
|
|
6337
6391
|
});
|
|
6338
6392
|
});
|
|
@@ -6412,7 +6466,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6412
6466
|
}
|
|
6413
6467
|
async applyDefaultMiddlewares() {
|
|
6414
6468
|
let { headers, proxy, historyApiFallback, compress, base } = this.options.serverConfig;
|
|
6415
|
-
if ('verbose' ===
|
|
6469
|
+
if ('verbose' === rslog_index_js_namespaceObject.logger.level && this.middlewares.use(await getRequestLoggerMiddleware()), compress && this.middlewares.use(gzipMiddleware({
|
|
6416
6470
|
level: 6
|
|
6417
6471
|
})), headers && this.middlewares.use((_req, res, next)=>{
|
|
6418
6472
|
for (let [key, value] of Object.entries(headers))res.setHeader(key, value);
|
|
@@ -6511,7 +6565,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6511
6565
|
customShortcuts: shortcutsOptions.custom
|
|
6512
6566
|
});
|
|
6513
6567
|
}
|
|
6514
|
-
!getPortSilently && portTip &&
|
|
6568
|
+
!getPortSilently && portTip && rslog_index_js_namespaceObject.logger.info(portTip), resolve({
|
|
6515
6569
|
port,
|
|
6516
6570
|
urls: urls.map((item)=>item.url),
|
|
6517
6571
|
server: {
|
|
@@ -6647,8 +6701,8 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6647
6701
|
if (isFunction(plugin.apply)) {
|
|
6648
6702
|
let { name = 'SomeWebpackPlugin' } = plugin.constructor || {};
|
|
6649
6703
|
throw Error([
|
|
6650
|
-
`${
|
|
6651
|
-
|
|
6704
|
+
`${index_js_default().yellow(name)} looks like a Webpack or Rspack plugin, please use ${index_js_default().yellow('`tools.rspack`')} to register it:`,
|
|
6705
|
+
index_js_default().green(`
|
|
6652
6706
|
// rsbuild.config.ts
|
|
6653
6707
|
export default {
|
|
6654
6708
|
tools: {
|
|
@@ -6664,7 +6718,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6664
6718
|
}
|
|
6665
6719
|
}(newPlugin), before) {
|
|
6666
6720
|
let index = plugins.findIndex((item)=>item.instance.name === before);
|
|
6667
|
-
-1 === index ? (
|
|
6721
|
+
-1 === index ? (rslog_index_js_namespaceObject.logger.warn(`Plugin "${before}" does not exist.`), plugins.push({
|
|
6668
6722
|
environment,
|
|
6669
6723
|
instance: newPlugin
|
|
6670
6724
|
})) : plugins.splice(index, 0, {
|
|
@@ -6697,7 +6751,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6697
6751
|
get (target, prop) {
|
|
6698
6752
|
if (exposedKeys.includes(prop)) return target[prop];
|
|
6699
6753
|
},
|
|
6700
|
-
set: (_, prop)=>(
|
|
6754
|
+
set: (_, prop)=>(rslog_index_js_namespaceObject.logger.error(`Context is readonly, you can not assign to the "context.${prop}" prop.`), !0)
|
|
6701
6755
|
});
|
|
6702
6756
|
}(context);
|
|
6703
6757
|
function getNormalizedConfig(options) {
|
|
@@ -6859,7 +6913,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6859
6913
|
});
|
|
6860
6914
|
context.getPluginAPI = getPluginAPI;
|
|
6861
6915
|
let globalPluginAPI = getPluginAPI();
|
|
6862
|
-
|
|
6916
|
+
rslog_index_js_namespaceObject.logger.debug('add default plugins'), await applyDefaultPlugins(pluginManager, context), rslog_index_js_namespaceObject.logger.debug('add default plugins done');
|
|
6863
6917
|
let provider = rsbuildConfig.provider || rspackProvider, providerInstance = await provider({
|
|
6864
6918
|
context,
|
|
6865
6919
|
pluginManager,
|
|
@@ -6872,11 +6926,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6872
6926
|
pluginManager
|
|
6873
6927
|
}), { distPath } = context, { checkDistDir = !0 } = options;
|
|
6874
6928
|
if (checkDistDir) {
|
|
6875
|
-
if (!(0, external_node_fs_.existsSync)(distPath)) throw Error(`The output directory ${
|
|
6929
|
+
if (!(0, external_node_fs_.existsSync)(distPath)) throw Error(`The output directory ${index_js_default().yellow(distPath)} does not exist, please build the project before previewing.`);
|
|
6876
6930
|
if (function(path) {
|
|
6877
6931
|
let files = external_node_fs_default().readdirSync(path);
|
|
6878
6932
|
return 0 === files.length || 1 === files.length && '.git' === files[0];
|
|
6879
|
-
}(distPath)) throw Error(`The output directory ${
|
|
6933
|
+
}(distPath)) throw Error(`The output directory ${index_js_default().yellow(distPath)} is empty, please build the project before previewing.`);
|
|
6880
6934
|
}
|
|
6881
6935
|
return startProdServer(context, config, options);
|
|
6882
6936
|
}, rsbuild = {
|
|
@@ -6931,188 +6985,87 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6931
6985
|
}
|
|
6932
6986
|
})), rsbuild;
|
|
6933
6987
|
}
|
|
6934
|
-
|
|
6935
|
-
function loadEnv({ cwd = process.cwd(), mode = getNodeEnv(), prefixes = [
|
|
6936
|
-
'PUBLIC_'
|
|
6937
|
-
] } = {}) {
|
|
6938
|
-
if ('local' === mode) throw Error("'local' cannot be used as a value for env mode, because \".env.local\" represents a temporary local file. Please use another value.");
|
|
6939
|
-
let filePaths = [
|
|
6940
|
-
'.env',
|
|
6941
|
-
'.env.local',
|
|
6942
|
-
`.env.${mode}`,
|
|
6943
|
-
`.env.${mode}.local`
|
|
6944
|
-
].map((filename)=>(0, external_node_path_.join)(cwd, filename)).filter(isFileSync), parsed = {};
|
|
6945
|
-
for (let envPath of filePaths)Object.assign(parsed, (0, main.parse)(external_node_fs_default().readFileSync(envPath)));
|
|
6946
|
-
parsed.NODE_ENV && (process.env.NODE_ENV = parsed.NODE_ENV), (0, lib_main.expand)({
|
|
6947
|
-
parsed
|
|
6948
|
-
});
|
|
6949
|
-
let publicVars = {}, rawPublicVars = {};
|
|
6950
|
-
for (let key of Object.keys(process.env))if (prefixes.some((prefix)=>key.startsWith(prefix))) {
|
|
6951
|
-
let val = process.env[key];
|
|
6952
|
-
publicVars[`import.meta.env.${key}`] = JSON.stringify(val), publicVars[`process.env.${key}`] = JSON.stringify(val), rawPublicVars[key] = val;
|
|
6953
|
-
}
|
|
6954
|
-
let cleaned = !1;
|
|
6955
|
-
return {
|
|
6956
|
-
parsed,
|
|
6957
|
-
cleanup: ()=>{
|
|
6958
|
-
if (!cleaned) {
|
|
6959
|
-
for (let key of Object.keys(parsed)){
|
|
6960
|
-
if ('NODE_ENV' !== key) process.env[key] === parsed[key] && delete process.env[key];
|
|
6961
|
-
}
|
|
6962
|
-
cleaned = !0;
|
|
6963
|
-
}
|
|
6964
|
-
},
|
|
6965
|
-
filePaths,
|
|
6966
|
-
publicVars,
|
|
6967
|
-
rawPublicVars
|
|
6968
|
-
};
|
|
6969
|
-
}
|
|
6970
|
-
let commonOpts = {}, getEnvDir = (cwd, envDir)=>envDir ? external_node_path_default().isAbsolute(envDir) ? envDir : external_node_path_default().resolve(cwd, envDir) : cwd;
|
|
6971
|
-
async function init({ cliOptions, isRestart, isBuildWatch = !1 }) {
|
|
6972
|
-
cliOptions && (commonOpts = cliOptions);
|
|
6973
|
-
try {
|
|
6974
|
-
var _config_server, _config_dev, _config_dev1;
|
|
6975
|
-
let cwd = process.cwd(), root = commonOpts.root ? getAbsolutePath(cwd, commonOpts.root) : cwd, envs = loadEnv({
|
|
6976
|
-
cwd: getEnvDir(root, commonOpts.envDir),
|
|
6977
|
-
mode: commonOpts.envMode
|
|
6978
|
-
});
|
|
6979
|
-
onBeforeRestartServer(envs.cleanup);
|
|
6980
|
-
let { content: config, filePath: configFilePath } = await config_loadConfig({
|
|
6981
|
-
cwd: root,
|
|
6982
|
-
path: commonOpts.config,
|
|
6983
|
-
envMode: commonOpts.envMode
|
|
6984
|
-
}), command = process.argv[2];
|
|
6985
|
-
if ('dev' === command || isBuildWatch) {
|
|
6986
|
-
let files = [
|
|
6987
|
-
...envs.filePaths
|
|
6988
|
-
];
|
|
6989
|
-
if (configFilePath && files.push(configFilePath), null === (_config_dev1 = config.dev) || void 0 === _config_dev1 ? void 0 : _config_dev1.watchFiles) for (let watchFilesConfig of castArray(config.dev.watchFiles)){
|
|
6990
|
-
if ('reload-server' !== watchFilesConfig.type) continue;
|
|
6991
|
-
let paths = castArray(watchFilesConfig.paths);
|
|
6992
|
-
watchFilesConfig.options ? watchFilesForRestart(paths, root, isBuildWatch, watchFilesConfig.options) : files.push(...paths);
|
|
6993
|
-
}
|
|
6994
|
-
watchFilesForRestart(files, root, isBuildWatch);
|
|
6995
|
-
}
|
|
6996
|
-
return config.source ||= {}, config.source.define = {
|
|
6997
|
-
...envs.publicVars,
|
|
6998
|
-
...config.source.define
|
|
6999
|
-
}, commonOpts.root && (config.root = root), commonOpts.mode && (config.mode = commonOpts.mode), commonOpts.open && !(null === (_config_server = config.server) || void 0 === _config_server ? void 0 : _config_server.open) && (config.server ||= {}, config.server.open = commonOpts.open), commonOpts.host && (config.server ||= {}, config.server.host = commonOpts.host), commonOpts.port && (config.server ||= {}, config.server.port = commonOpts.port), (null === (_config_dev = config.dev) || void 0 === _config_dev ? void 0 : _config_dev.cliShortcuts) === void 0 && (config.dev ||= {}, config.dev.cliShortcuts = !0), createRsbuild({
|
|
7000
|
-
cwd: root,
|
|
7001
|
-
rsbuildConfig: config,
|
|
7002
|
-
environment: commonOpts.environment
|
|
7003
|
-
});
|
|
7004
|
-
} catch (err) {
|
|
7005
|
-
if (isRestart) index_js_namespaceObject.logger.error(err);
|
|
7006
|
-
else throw err;
|
|
7007
|
-
}
|
|
7008
|
-
}
|
|
7009
|
-
let cleaners = [], onBeforeRestartServer = (cleaner)=>{
|
|
7010
|
-
cleaners.push(cleaner);
|
|
7011
|
-
}, clearConsole = ()=>{
|
|
7012
|
-
isTTY() && !process.env.DEBUG && process.stdout.write('\x1B[H\x1B[2J');
|
|
7013
|
-
}, beforeRestart = async ({ filePath, clear = !0 } = {})=>{
|
|
7014
|
-
if (clear && clearConsole(), filePath) {
|
|
7015
|
-
let filename = external_node_path_default().basename(filePath);
|
|
7016
|
-
index_js_namespaceObject.logger.info(`Restart server because ${picocolors_index_js_default().yellow(filename)} is changed.\n`);
|
|
7017
|
-
} else index_js_namespaceObject.logger.info('Restarting server...\n');
|
|
7018
|
-
for (let cleaner of cleaners)await cleaner();
|
|
7019
|
-
cleaners = [];
|
|
7020
|
-
}, restartDevServer = async ({ filePath, clear = !0 } = {})=>{
|
|
7021
|
-
await beforeRestart({
|
|
7022
|
-
filePath,
|
|
7023
|
-
clear
|
|
7024
|
-
});
|
|
7025
|
-
let rsbuild = await init({
|
|
7026
|
-
isRestart: !0
|
|
7027
|
-
});
|
|
7028
|
-
if (!!rsbuild) await rsbuild.startDevServer();
|
|
7029
|
-
}, restartBuild = async ({ filePath, clear = !0 } = {})=>{
|
|
7030
|
-
await beforeRestart({
|
|
7031
|
-
filePath,
|
|
7032
|
-
clear
|
|
7033
|
-
});
|
|
7034
|
-
let rsbuild = await init({
|
|
7035
|
-
isRestart: !0,
|
|
7036
|
-
isBuildWatch: !0
|
|
7037
|
-
});
|
|
7038
|
-
if (!!rsbuild) onBeforeRestartServer((await rsbuild.build({
|
|
7039
|
-
watch: !0
|
|
7040
|
-
})).close);
|
|
7041
|
-
}, applyCommonOptions = (command)=>{
|
|
6988
|
+
let { program, createCommand, createArgument, createOption, CommanderError, InvalidArgumentError, InvalidOptionArgumentError, Command, Argument, Option, Help } = __webpack_require__("../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/index.js"), applyCommonOptions = (command)=>{
|
|
7042
6989
|
command.option('-c --config <config>', 'specify the configuration file, can be a relative or absolute path').option('-r --root <root>', 'specify the project root directory, can be an absolute path or a path relative to cwd').option('-m --mode <mode>', 'specify the build mode, can be `development`, `production` or `none`').option('--env-mode <mode>', 'specify the env mode to load the `.env.[mode]` file').option('--environment <name>', 'specify the name of environment to build', (str, prev)=>prev ? prev.concat(str.split(',')) : str.split(',')).option('--env-dir <dir>', 'specify the directory to load `.env` files');
|
|
7043
6990
|
}, applyServerOptions = (command)=>{
|
|
7044
6991
|
command.option('-o --open [url]', 'open the page in browser on startup').option('--port <port>', 'specify a port number for server to listen').option('--host <host>', 'specify the host that the server listens to');
|
|
7045
6992
|
};
|
|
7046
|
-
function
|
|
7047
|
-
program.name('rsbuild').usage('<command> [options]').version("1.1.2");
|
|
7048
|
-
let devCommand = program.command('dev'), buildCommand = program.command('build'), previewCommand = program.command('preview'), inspectCommand = program.command('inspect');
|
|
7049
|
-
[
|
|
7050
|
-
devCommand,
|
|
7051
|
-
buildCommand,
|
|
7052
|
-
previewCommand,
|
|
7053
|
-
inspectCommand
|
|
7054
|
-
].forEach(applyCommonOptions), [
|
|
7055
|
-
devCommand,
|
|
7056
|
-
previewCommand
|
|
7057
|
-
].forEach(applyServerOptions), devCommand.description('starting the dev server').action(async (options)=>{
|
|
7058
|
-
try {
|
|
7059
|
-
let rsbuild = await init({
|
|
7060
|
-
cliOptions: options
|
|
7061
|
-
});
|
|
7062
|
-
await (null == rsbuild ? void 0 : rsbuild.startDevServer());
|
|
7063
|
-
} catch (err) {
|
|
7064
|
-
index_js_namespaceObject.logger.error('Failed to start dev server.'), index_js_namespaceObject.logger.error(err), process.exit(1);
|
|
7065
|
-
}
|
|
7066
|
-
}), buildCommand.option('-w --watch', 'turn on watch mode, watch for changes and rebuild').description('build the app for production').action(async (options)=>{
|
|
7067
|
-
try {
|
|
7068
|
-
let rsbuild = await init({
|
|
7069
|
-
cliOptions: options,
|
|
7070
|
-
isBuildWatch: options.watch
|
|
7071
|
-
}), buildInstance = await (null == rsbuild ? void 0 : rsbuild.build({
|
|
7072
|
-
watch: options.watch
|
|
7073
|
-
}));
|
|
7074
|
-
options.watch && buildInstance && onBeforeRestartServer(buildInstance.close);
|
|
7075
|
-
} catch (err) {
|
|
7076
|
-
index_js_namespaceObject.logger.error('Failed to build.'), index_js_namespaceObject.logger.error(err), process.exit(1);
|
|
7077
|
-
}
|
|
7078
|
-
}), previewCommand.description('preview the production build locally').action(async (options)=>{
|
|
7079
|
-
try {
|
|
7080
|
-
let rsbuild = await init({
|
|
7081
|
-
cliOptions: options
|
|
7082
|
-
});
|
|
7083
|
-
await (null == rsbuild ? void 0 : rsbuild.preview());
|
|
7084
|
-
} catch (err) {
|
|
7085
|
-
index_js_namespaceObject.logger.error('Failed to start preview server.'), index_js_namespaceObject.logger.error(err), process.exit(1);
|
|
7086
|
-
}
|
|
7087
|
-
}), inspectCommand.description('inspect the Rspack and Rsbuild configs').option('--output <output>', 'specify inspect content output path').option('--verbose', 'show full function definitions in output').action(async (options)=>{
|
|
7088
|
-
try {
|
|
7089
|
-
let rsbuild = await init({
|
|
7090
|
-
cliOptions: options
|
|
7091
|
-
});
|
|
7092
|
-
await (null == rsbuild ? void 0 : rsbuild.inspectConfig({
|
|
7093
|
-
verbose: options.verbose,
|
|
7094
|
-
outputPath: options.output,
|
|
7095
|
-
writeToDisk: !0
|
|
7096
|
-
}));
|
|
7097
|
-
} catch (err) {
|
|
7098
|
-
index_js_namespaceObject.logger.error('Failed to inspect config.'), index_js_namespaceObject.logger.error(err), process.exit(1);
|
|
7099
|
-
}
|
|
7100
|
-
}), program.parse();
|
|
7101
|
-
}
|
|
7102
|
-
function prepareCli() {
|
|
6993
|
+
async function runCLI() {
|
|
7103
6994
|
!function() {
|
|
7104
|
-
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
6995
|
+
!function() {
|
|
6996
|
+
if (!process.env.NODE_ENV) {
|
|
6997
|
+
let command = process.argv[2];
|
|
6998
|
+
process.env.NODE_ENV = [
|
|
6999
|
+
'build',
|
|
7000
|
+
'preview'
|
|
7001
|
+
].includes(command) ? 'production' : 'development';
|
|
7002
|
+
}
|
|
7003
|
+
}();
|
|
7004
|
+
let { npm_execpath } = process.env;
|
|
7005
|
+
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.1.3\n`);
|
|
7111
7006
|
}();
|
|
7112
|
-
|
|
7113
|
-
|
|
7007
|
+
try {
|
|
7008
|
+
!function() {
|
|
7009
|
+
program.name('rsbuild').usage('<command> [options]').version("1.1.3");
|
|
7010
|
+
let devCommand = program.command('dev'), buildCommand = program.command('build'), previewCommand = program.command('preview'), inspectCommand = program.command('inspect');
|
|
7011
|
+
[
|
|
7012
|
+
devCommand,
|
|
7013
|
+
buildCommand,
|
|
7014
|
+
previewCommand,
|
|
7015
|
+
inspectCommand
|
|
7016
|
+
].forEach(applyCommonOptions), [
|
|
7017
|
+
devCommand,
|
|
7018
|
+
previewCommand
|
|
7019
|
+
].forEach(applyServerOptions), devCommand.description('starting the dev server').action(async (options)=>{
|
|
7020
|
+
try {
|
|
7021
|
+
let rsbuild = await init({
|
|
7022
|
+
cliOptions: options
|
|
7023
|
+
});
|
|
7024
|
+
await (null == rsbuild ? void 0 : rsbuild.startDevServer());
|
|
7025
|
+
} catch (err) {
|
|
7026
|
+
rslog_index_js_namespaceObject.logger.error('Failed to start dev server.'), rslog_index_js_namespaceObject.logger.error(err), process.exit(1);
|
|
7027
|
+
}
|
|
7028
|
+
}), buildCommand.option('-w --watch', 'turn on watch mode, watch for changes and rebuild').description('build the app for production').action(async (options)=>{
|
|
7029
|
+
try {
|
|
7030
|
+
let rsbuild = await init({
|
|
7031
|
+
cliOptions: options,
|
|
7032
|
+
isBuildWatch: options.watch
|
|
7033
|
+
}), buildInstance = await (null == rsbuild ? void 0 : rsbuild.build({
|
|
7034
|
+
watch: options.watch
|
|
7035
|
+
}));
|
|
7036
|
+
options.watch && buildInstance && onBeforeRestartServer(buildInstance.close);
|
|
7037
|
+
} catch (err) {
|
|
7038
|
+
rslog_index_js_namespaceObject.logger.error('Failed to build.'), rslog_index_js_namespaceObject.logger.error(err), process.exit(1);
|
|
7039
|
+
}
|
|
7040
|
+
}), previewCommand.description('preview the production build locally').action(async (options)=>{
|
|
7041
|
+
try {
|
|
7042
|
+
let rsbuild = await init({
|
|
7043
|
+
cliOptions: options
|
|
7044
|
+
});
|
|
7045
|
+
await (null == rsbuild ? void 0 : rsbuild.preview());
|
|
7046
|
+
} catch (err) {
|
|
7047
|
+
rslog_index_js_namespaceObject.logger.error('Failed to start preview server.'), rslog_index_js_namespaceObject.logger.error(err), process.exit(1);
|
|
7048
|
+
}
|
|
7049
|
+
}), inspectCommand.description('inspect the Rspack and Rsbuild configs').option('--output <output>', 'specify inspect content output path').option('--verbose', 'show full function definitions in output').action(async (options)=>{
|
|
7050
|
+
try {
|
|
7051
|
+
let rsbuild = await init({
|
|
7052
|
+
cliOptions: options
|
|
7053
|
+
});
|
|
7054
|
+
await (null == rsbuild ? void 0 : rsbuild.inspectConfig({
|
|
7055
|
+
verbose: options.verbose,
|
|
7056
|
+
outputPath: options.output,
|
|
7057
|
+
writeToDisk: !0
|
|
7058
|
+
}));
|
|
7059
|
+
} catch (err) {
|
|
7060
|
+
rslog_index_js_namespaceObject.logger.error('Failed to inspect config.'), rslog_index_js_namespaceObject.logger.error(err), process.exit(1);
|
|
7061
|
+
}
|
|
7062
|
+
}), program.parse();
|
|
7063
|
+
}();
|
|
7064
|
+
} catch (err) {
|
|
7065
|
+
rslog_index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), rslog_index_js_namespaceObject.logger.error(err);
|
|
7066
|
+
}
|
|
7114
7067
|
}
|
|
7115
|
-
let src_version = "1.1.
|
|
7068
|
+
let src_version = "1.1.3";
|
|
7116
7069
|
})();
|
|
7117
7070
|
var __webpack_export_target__ = exports;
|
|
7118
7071
|
for(var i in __webpack_exports__)__webpack_export_target__[i] = __webpack_exports__[i];
|