@rsbuild/core 1.2.0-alpha.0 → 1.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/compiled/css-loader/index.js +20 -20
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/postcss-loader/index.js +8 -8
- package/compiled/rsbuild-dev-middleware/index.js +25 -25
- package/compiled/rspack-chain/index.d.ts +1 -0
- package/compiled/rspack-chain/index.js +67 -66
- package/compiled/rspack-chain/package.json +1 -1
- package/compiled/rspack-manifest-plugin/index.js +4 -4
- package/compiled/style-loader/index.js +13 -13
- package/dist/client/overlay.js +2 -2
- package/dist/index.cjs +219 -239
- package/dist/index.js +511 -531
- package/dist/transformRawLoader.mjs +1 -1
- package/dist-types/hooks.d.ts +2 -2
- package/dist-types/index.d.ts +1 -1
- package/dist-types/rspack/preload/HtmlPreloadOrPrefetchPlugin.d.ts +1 -0
- package/dist-types/types/config.d.ts +8 -1
- package/dist-types/types/hooks.d.ts +1 -1
- package/dist-types/types/plugin.d.ts +2 -2
- package/package.json +5 -5
- package/types.d.ts +4 -0
- package/dist-types/internal.d.ts +0 -6
package/dist/index.cjs
CHANGED
|
@@ -3,14 +3,8 @@ var __webpack_modules__ = {
|
|
|
3
3
|
"../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js": function(module) {
|
|
4
4
|
"use strict";
|
|
5
5
|
var isMergeableObject = function(value) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}(value) && !function(value) {
|
|
9
|
-
var stringValue = Object.prototype.toString.call(value);
|
|
10
|
-
return '[object RegExp]' === stringValue || '[object Date]' === stringValue || function(value) {
|
|
11
|
-
return value.$$typeof === REACT_ELEMENT_TYPE;
|
|
12
|
-
}(value);
|
|
13
|
-
}(value);
|
|
6
|
+
var value1, value2, stringValue;
|
|
7
|
+
return !!(value1 = value) && 'object' == typeof value1 && (value2 = value, '[object RegExp]' !== (stringValue = Object.prototype.toString.call(value2)) && '[object Date]' !== stringValue && value2.$$typeof !== REACT_ELEMENT_TYPE);
|
|
14
8
|
}, REACT_ELEMENT_TYPE = 'function' == typeof Symbol && Symbol.for ? Symbol.for('react.element') : 0xeac7;
|
|
15
9
|
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
16
10
|
return !1 !== options.clone && options.isMergeableObject(value) ? deepmerge(Array.isArray(value) ? [] : {}, value, options) : value;
|
|
@@ -21,10 +15,9 @@ var __webpack_modules__ = {
|
|
|
21
15
|
});
|
|
22
16
|
}
|
|
23
17
|
function getKeys(target) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}) : []));
|
|
18
|
+
return Object.keys(target).concat(Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
19
|
+
return Object.propertyIsEnumerable.call(target, symbol);
|
|
20
|
+
}) : []);
|
|
28
21
|
}
|
|
29
22
|
function propertyIsOnObject(object, property) {
|
|
30
23
|
try {
|
|
@@ -35,27 +28,23 @@ var __webpack_modules__ = {
|
|
|
35
28
|
}
|
|
36
29
|
function deepmerge(target, source, options) {
|
|
37
30
|
(options = options || {}).arrayMerge = options.arrayMerge || defaultArrayMerge, options.isMergeableObject = options.isMergeableObject || isMergeableObject, options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
destination[key] =
|
|
43
|
-
}), getKeys(source1).forEach(function(key) {
|
|
44
|
-
var target, key1;
|
|
45
|
-
if (!propertyIsOnObject(target = target1, key1 = key) || !!(Object.hasOwnProperty.call(target, key1) && Object.propertyIsEnumerable.call(target, key1))) propertyIsOnObject(target1, key) && options1.isMergeableObject(source1[key]) ? destination[key] = (function(key, options) {
|
|
31
|
+
var options1, destination, sourceIsArray = Array.isArray(source);
|
|
32
|
+
return sourceIsArray !== Array.isArray(target) ? cloneUnlessOtherwiseSpecified(source, options) : sourceIsArray ? options.arrayMerge(target, source, options) : (destination = {}, (options1 = options).isMergeableObject(target) && getKeys(target).forEach(function(key) {
|
|
33
|
+
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options1);
|
|
34
|
+
}), getKeys(source).forEach(function(key) {
|
|
35
|
+
(!propertyIsOnObject(target, key) || Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key)) && (propertyIsOnObject(target, key) && options1.isMergeableObject(source[key]) ? destination[key] = (function(key, options) {
|
|
46
36
|
if (!options.customMerge) return deepmerge;
|
|
47
37
|
var customMerge = options.customMerge(key);
|
|
48
38
|
return 'function' == typeof customMerge ? customMerge : deepmerge;
|
|
49
|
-
})(key, options1)(
|
|
50
|
-
}), destination;
|
|
39
|
+
})(key, options1)(target[key], source[key], options1) : destination[key] = cloneUnlessOtherwiseSpecified(source[key], options1));
|
|
40
|
+
}), destination);
|
|
51
41
|
}
|
|
52
42
|
deepmerge.all = function(array, options) {
|
|
53
43
|
if (!Array.isArray(array)) throw Error('first argument should be an array');
|
|
54
44
|
return array.reduce(function(prev, next) {
|
|
55
45
|
return deepmerge(prev, next, options);
|
|
56
46
|
}, {});
|
|
57
|
-
};
|
|
58
|
-
module.exports = deepmerge;
|
|
47
|
+
}, module.exports = deepmerge;
|
|
59
48
|
},
|
|
60
49
|
"../../node_modules/.pnpm/dotenv-expand@12.0.1/node_modules/dotenv-expand/lib/main.js": function(module) {
|
|
61
50
|
"use strict";
|
|
@@ -219,7 +208,8 @@ var __webpack_modules__ = {
|
|
|
219
208
|
if (decryptionFailed) {
|
|
220
209
|
let err = Error('DECRYPTION_FAILED: Please check your DOTENV_KEY');
|
|
221
210
|
throw err.code = 'DECRYPTION_FAILED', err;
|
|
222
|
-
}
|
|
211
|
+
}
|
|
212
|
+
throw error;
|
|
223
213
|
}
|
|
224
214
|
},
|
|
225
215
|
parse: function(src) {
|
|
@@ -454,7 +444,8 @@ var __webpack_exports__ = {};
|
|
|
454
444
|
'avif',
|
|
455
445
|
'tif',
|
|
456
446
|
'tiff',
|
|
457
|
-
'jfif'
|
|
447
|
+
'jfif',
|
|
448
|
+
'cur'
|
|
458
449
|
], VIDEO_EXTENSIONS = [
|
|
459
450
|
'mp4',
|
|
460
451
|
'webm',
|
|
@@ -476,8 +467,7 @@ var __webpack_exports__ = {};
|
|
|
476
467
|
'*'
|
|
477
468
|
].some((key)=>values.includes(key));
|
|
478
469
|
};
|
|
479
|
-
isDebug() && (rslog_index_js_namespaceObject.logger.level = 'verbose')
|
|
480
|
-
rslog_index_js_namespaceObject.logger.override({
|
|
470
|
+
isDebug() && (rslog_index_js_namespaceObject.logger.level = 'verbose'), rslog_index_js_namespaceObject.logger.override({
|
|
481
471
|
debug: (message, ...args)=>{
|
|
482
472
|
if ('verbose' !== rslog_index_js_namespaceObject.logger.level) return;
|
|
483
473
|
let time = index_js_default().gray(`${function() {
|
|
@@ -518,7 +508,7 @@ var __webpack_exports__ = {};
|
|
|
518
508
|
});
|
|
519
509
|
}
|
|
520
510
|
async function emptyDir(dir) {
|
|
521
|
-
if (
|
|
511
|
+
if (await pathExists(dir)) try {
|
|
522
512
|
for (let file of (await external_node_fs_default().promises.readdir(dir)))await external_node_fs_default().promises.rm(external_node_path_default().resolve(dir, file), {
|
|
523
513
|
recursive: !0,
|
|
524
514
|
force: !0
|
|
@@ -611,7 +601,7 @@ var __webpack_exports__ = {};
|
|
|
611
601
|
message = `${fileName}${mainMessage}${details}${stack}${moduleTrace}`;
|
|
612
602
|
} else message = stats;
|
|
613
603
|
let innerError = '-- inner error --';
|
|
614
|
-
return !verbose && message.includes(innerError) && (message = message.split(innerError)[0]), (message = (
|
|
604
|
+
return !verbose && message.includes(innerError) && (message = message.split(innerError)[0]), (message = (message = hintNodePolyfill(message = function(message) {
|
|
615
605
|
let hint = 'You may need an appropriate loader to handle this file type.';
|
|
616
606
|
if (-1 === message.indexOf(hint)) return message;
|
|
617
607
|
for (let plugin of [
|
|
@@ -649,13 +639,12 @@ var __webpack_exports__ = {};
|
|
|
649
639
|
}
|
|
650
640
|
])if (plugin.test.test(message)) return message.replace(hint, plugin.hint);
|
|
651
641
|
return message;
|
|
652
|
-
}(message))).split('\n')
|
|
642
|
+
}(message))).split('\n').filter((line, index, arr)=>0 === index || '' !== line.trim() || line.trim() !== arr[index - 1].trim()).join('\n')).trim();
|
|
653
643
|
}
|
|
654
644
|
function formatStatsMessages(stats, verbose) {
|
|
655
645
|
var _stats_errors, _stats_warnings;
|
|
656
|
-
let formattedErrors = (null === (_stats_errors = stats.errors) || void 0 === _stats_errors ? void 0 : _stats_errors.map((error)=>formatMessage(error, verbose))) || [];
|
|
657
646
|
return {
|
|
658
|
-
errors:
|
|
647
|
+
errors: (null === (_stats_errors = stats.errors) || void 0 === _stats_errors ? void 0 : _stats_errors.map((error)=>formatMessage(error, verbose))) || [],
|
|
659
648
|
warnings: (null === (_stats_warnings = stats.warnings) || void 0 === _stats_warnings ? void 0 : _stats_warnings.map((warning)=>formatMessage(warning, verbose))) || []
|
|
660
649
|
};
|
|
661
650
|
}
|
|
@@ -727,8 +716,7 @@ var __webpack_exports__ = {};
|
|
|
727
716
|
return 'string' == typeof publicPath ? formatPublicPath(publicPath, withSlash) : formatPublicPath(DEFAULT_ASSET_PREFIX, withSlash);
|
|
728
717
|
}, getPublicPathFromCompiler = (compiler)=>{
|
|
729
718
|
let { publicPath } = compiler.options.output;
|
|
730
|
-
|
|
731
|
-
return DEFAULT_ASSET_PREFIX;
|
|
719
|
+
return 'string' == typeof publicPath ? 'auto' === publicPath ? '' : publicPath.endsWith('/') ? publicPath : `${publicPath}/` : DEFAULT_ASSET_PREFIX;
|
|
732
720
|
}, urlJoin = (base, path)=>{
|
|
733
721
|
let [urlProtocol, baseUrl] = base.split('://');
|
|
734
722
|
return `${urlProtocol}://${external_node_path_namespaceObject.posix.join(baseUrl, path)}`;
|
|
@@ -768,7 +756,7 @@ var __webpack_exports__ = {};
|
|
|
768
756
|
}
|
|
769
757
|
let applyToCompiler = (compiler, apply)=>{
|
|
770
758
|
isMultiCompiler(compiler) ? compiler.compilers.forEach(apply) : apply(compiler, 0);
|
|
771
|
-
}, upperFirst = (str)=>str ? str.charAt(0).toUpperCase() + str.slice(1) : '', isURL = (str)=>str.startsWith('http') || str.startsWith('//:'), createVirtualModule = (content)=>`data:text/javascript,${content}`, isMultiCompiler = (compiler)=>'
|
|
759
|
+
}, upperFirst = (str)=>str ? str.charAt(0).toUpperCase() + str.slice(1) : '', isURL = (str)=>str.startsWith('http') || str.startsWith('//:'), createVirtualModule = (content)=>`data:text/javascript,${content}`, isMultiCompiler = (compiler)=>'compilers' in compiler && Array.isArray(compiler.compilers);
|
|
772
760
|
function pick(obj, keys) {
|
|
773
761
|
return keys.reduce((ret, key)=>(void 0 !== obj[key] && (ret[key] = obj[key]), ret), {});
|
|
774
762
|
}
|
|
@@ -806,9 +794,7 @@ var __webpack_exports__ = {};
|
|
|
806
794
|
parsed,
|
|
807
795
|
cleanup: ()=>{
|
|
808
796
|
if (!cleaned) {
|
|
809
|
-
for (let key of Object.keys(parsed))
|
|
810
|
-
if ('NODE_ENV' !== key) process.env[key] === parsed[key] && delete process.env[key];
|
|
811
|
-
}
|
|
797
|
+
for (let key of Object.keys(parsed))'NODE_ENV' !== key && process.env[key] === parsed[key] && delete process.env[key];
|
|
812
798
|
cleaned = !0;
|
|
813
799
|
}
|
|
814
800
|
},
|
|
@@ -953,7 +939,7 @@ var __webpack_exports__ = {};
|
|
|
953
939
|
config.source ||= {}, config.source.define = {
|
|
954
940
|
...envs.publicVars,
|
|
955
941
|
...config.source.define
|
|
956
|
-
}, commonOpts.root && (config.root = root), commonOpts.mode && (config.mode = commonOpts.mode), commonOpts.open
|
|
942
|
+
}, 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);
|
|
957
943
|
let rsbuild = await createRsbuild({
|
|
958
944
|
cwd: root,
|
|
959
945
|
rsbuildConfig: config,
|
|
@@ -985,7 +971,7 @@ var __webpack_exports__ = {};
|
|
|
985
971
|
let rsbuild = await init({
|
|
986
972
|
isRestart: !0
|
|
987
973
|
});
|
|
988
|
-
|
|
974
|
+
rsbuild && await rsbuild.startDevServer();
|
|
989
975
|
}, restartBuild = async ({ filePath, clear = !0 } = {})=>{
|
|
990
976
|
await beforeRestart({
|
|
991
977
|
filePath,
|
|
@@ -996,7 +982,7 @@ var __webpack_exports__ = {};
|
|
|
996
982
|
isRestart: !0,
|
|
997
983
|
isBuildWatch: !0
|
|
998
984
|
});
|
|
999
|
-
|
|
985
|
+
rsbuild && onBeforeRestartServer((await rsbuild.build({
|
|
1000
986
|
watch: !0
|
|
1001
987
|
})).close);
|
|
1002
988
|
};
|
|
@@ -1007,7 +993,7 @@ var __webpack_exports__ = {};
|
|
|
1007
993
|
let publicDirs = normalizePublicDirs(serverConfig.publicDir);
|
|
1008
994
|
if (!publicDirs.length) return;
|
|
1009
995
|
let watchPaths = publicDirs.filter((item)=>item.watch).map((item)=>item.name);
|
|
1010
|
-
if (
|
|
996
|
+
if (watchPaths.length) return startWatchFiles(prepareWatchOptions(watchPaths), compileMiddlewareAPI, root);
|
|
1011
997
|
}(server, compileMiddlewareAPI, root);
|
|
1012
998
|
return {
|
|
1013
999
|
async close () {
|
|
@@ -1165,7 +1151,7 @@ var __webpack_exports__ = {};
|
|
|
1165
1151
|
exportLocalsConvention: 'camelCase'
|
|
1166
1152
|
},
|
|
1167
1153
|
emitAssets: !0
|
|
1168
|
-
}), getDefaultResolveConfig = ()=>(
|
|
1154
|
+
}), getDefaultResolveConfig = ()=>(swcHelpersPath || (swcHelpersPath = (0, external_node_path_namespaceObject.dirname)(config_require.resolve('@swc/helpers/package.json'))), {
|
|
1169
1155
|
alias: {
|
|
1170
1156
|
'@swc/helpers': swcHelpersPath
|
|
1171
1157
|
},
|
|
@@ -1235,8 +1221,7 @@ var __webpack_exports__ = {};
|
|
|
1235
1221
|
ignoreInitial: !0,
|
|
1236
1222
|
ignorePermissionErrors: !0,
|
|
1237
1223
|
...watchOptions
|
|
1238
|
-
})
|
|
1239
|
-
let callback = (func = async (filePath)=>{
|
|
1224
|
+
}), callback = (func = async (filePath)=>{
|
|
1240
1225
|
watcher.close(), isBuildWatch ? await restartBuild({
|
|
1241
1226
|
filePath
|
|
1242
1227
|
}) : await restartDevServer({
|
|
@@ -1482,7 +1467,7 @@ var __webpack_exports__ = {};
|
|
|
1482
1467
|
for(let index = 0; index < compilers.length; index++){
|
|
1483
1468
|
let compiler = compilers[index], compilerDone = !1;
|
|
1484
1469
|
(isWatch ? compiler.hooks.watchRun : compiler.hooks.run).tapPromise(name, async ()=>{
|
|
1485
|
-
!compilerDone && (compilerDone = !0, doneCompilers++),
|
|
1470
|
+
!compilerDone && (compilerDone = !0, doneCompilers++), waitBeforeCompileDone || (waitBeforeCompileDone = null == beforeCompile ? void 0 : beforeCompile()), await waitBeforeCompileDone, await beforeEnvironmentCompiler(index);
|
|
1486
1471
|
}), compiler.hooks.invalid.tap(name, ()=>{
|
|
1487
1472
|
compilerDone && (compilerDone = !1, doneCompilers--), doneCompilers <= 0 && (waitBeforeCompileDone = void 0);
|
|
1488
1473
|
});
|
|
@@ -1715,7 +1700,7 @@ var __webpack_exports__ = {};
|
|
|
1715
1700
|
async function createContext(options, userConfig, bundlerType) {
|
|
1716
1701
|
let { cwd } = options, rootPath = userConfig.root ? getAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, external_node_path_namespaceObject.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0;
|
|
1717
1702
|
return {
|
|
1718
|
-
version: "1.2.0-
|
|
1703
|
+
version: "1.2.0-beta.0",
|
|
1719
1704
|
rootPath,
|
|
1720
1705
|
distPath: '',
|
|
1721
1706
|
cachePath,
|
|
@@ -1880,17 +1865,17 @@ var __webpack_exports__ = {};
|
|
|
1880
1865
|
...AUDIO_EXTENSIONS
|
|
1881
1866
|
], emitAssets), createAssetRule('font', FONT_EXTENSIONS, emitAssets);
|
|
1882
1867
|
let assetsFilename = getMergedFilename('assets');
|
|
1883
|
-
chain.output.assetModuleFilename(assetsFilename),
|
|
1868
|
+
chain.output.assetModuleFilename(assetsFilename), emitAssets || chain.module.generator.merge({
|
|
1884
1869
|
'asset/resource': {
|
|
1885
1870
|
emit: !1
|
|
1886
1871
|
}
|
|
1887
1872
|
});
|
|
1888
1873
|
let { assetsInclude } = config.source;
|
|
1889
1874
|
if (assetsInclude) {
|
|
1890
|
-
let { dataUriLimit } = config.output
|
|
1875
|
+
let { dataUriLimit } = config.output;
|
|
1891
1876
|
chainStaticAssetRule({
|
|
1892
1877
|
emit: emitAssets,
|
|
1893
|
-
rule,
|
|
1878
|
+
rule: chain.module.rule('additional-assets').test(assetsInclude),
|
|
1894
1879
|
maxSize: 'number' == typeof dataUriLimit ? dataUriLimit : dataUriLimit.assets,
|
|
1895
1880
|
filename: assetsFilename,
|
|
1896
1881
|
assetType: 'additional'
|
|
@@ -1968,7 +1953,7 @@ var __webpack_exports__ = {};
|
|
|
1968
1953
|
let pluginCache = ()=>({
|
|
1969
1954
|
name: 'rsbuild:cache',
|
|
1970
1955
|
setup (api) {
|
|
1971
|
-
|
|
1956
|
+
'rspack' !== api.context.bundlerType && api.modifyBundlerChain(async (chain, { environment, env })=>{
|
|
1972
1957
|
var digest;
|
|
1973
1958
|
let { config } = environment, { buildCache } = config.performance;
|
|
1974
1959
|
if (!1 === buildCache) {
|
|
@@ -1999,9 +1984,9 @@ var __webpack_exports__ = {};
|
|
|
1999
1984
|
if (!0 === cleanDistPath || 'auto' === cleanDistPath && isStrictSubdir(rootPath, cleanPath)) return cleanPath;
|
|
2000
1985
|
}, getCleanPath = (environment)=>{
|
|
2001
1986
|
let { rootPath } = api.context, { config, distPath } = environment, { cleanDistPath } = config.output;
|
|
2002
|
-
if ('auto'
|
|
1987
|
+
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;
|
|
2003
1988
|
}, cleanAll = async (params)=>{
|
|
2004
|
-
let cleanPaths = Object.values(params.environments).reduce((total, curr)=>(
|
|
1989
|
+
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);
|
|
2005
1990
|
await Promise.all(dedupeNestedPaths(cleanPaths).map((p)=>emptyDir(p)));
|
|
2006
1991
|
};
|
|
2007
1992
|
api.onBeforeBuild(async ({ isFirstCompile, environments })=>{
|
|
@@ -2047,9 +2032,9 @@ var __webpack_exports__ = {};
|
|
|
2047
2032
|
}
|
|
2048
2033
|
let pluginHelper_require = (0, external_node_module_namespaceObject.createRequire)(__rslib_import_meta_url__), setHTMLPlugin = (plugin)=>{
|
|
2049
2034
|
plugin && (pluginHelper_htmlPlugin = plugin);
|
|
2050
|
-
}, getHTMLPlugin = ()=>(
|
|
2035
|
+
}, getHTMLPlugin = ()=>(pluginHelper_htmlPlugin || (pluginHelper_htmlPlugin = pluginHelper_require('../compiled/html-rspack-plugin/index.js')), pluginHelper_htmlPlugin), setCssExtractPlugin = (plugin)=>{
|
|
2051
2036
|
cssExtractPlugin = plugin;
|
|
2052
|
-
}, getCssExtractPlugin = ()=>cssExtractPlugin
|
|
2037
|
+
}, getCssExtractPlugin = ()=>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)=>{
|
|
2053
2038
|
if (options.modules && exportOnlyLocals) {
|
|
2054
2039
|
let { modules } = options;
|
|
2055
2040
|
return modules = !0 === modules ? {
|
|
@@ -2143,7 +2128,7 @@ var __webpack_exports__ = {};
|
|
|
2143
2128
|
order: 'pre',
|
|
2144
2129
|
handler: async (chain, { target, isProd, CHAIN_ID, environment })=>{
|
|
2145
2130
|
let rule = chain.module.rule(CHAIN_ID.RULE.CSS), { config } = environment;
|
|
2146
|
-
rule.test(CSS_REGEX).type(
|
|
2131
|
+
rule.test(CSS_REGEX).type("javascript/auto").dependency({
|
|
2147
2132
|
not: 'url'
|
|
2148
2133
|
});
|
|
2149
2134
|
let emitCss = config.output.emitCss ?? 'web' === target;
|
|
@@ -2363,8 +2348,8 @@ var __webpack_exports__ = {};
|
|
|
2363
2348
|
'link',
|
|
2364
2349
|
'style',
|
|
2365
2350
|
'meta',
|
|
2366
|
-
|
|
2367
|
-
|
|
2351
|
+
"script",
|
|
2352
|
+
"noscript",
|
|
2368
2353
|
'template'
|
|
2369
2354
|
], FILE_ATTRS = {
|
|
2370
2355
|
link: 'href',
|
|
@@ -2448,7 +2433,7 @@ var __webpack_exports__ = {};
|
|
|
2448
2433
|
return compilation.emitAsset(name, source), name;
|
|
2449
2434
|
}, addFavicon = async (headTags, favicon, compilation, publicPath)=>{
|
|
2450
2435
|
let href = favicon;
|
|
2451
|
-
|
|
2436
|
+
isURL(favicon) || (href = ensureAssetPrefix(await emitFavicon(compilation, favicon), publicPath));
|
|
2452
2437
|
let tag = {
|
|
2453
2438
|
tagName: 'link',
|
|
2454
2439
|
voidTag: !0,
|
|
@@ -2466,7 +2451,7 @@ var __webpack_exports__ = {};
|
|
|
2466
2451
|
let entryName = null === (_data_plugin_options = data.plugin.options) || void 0 === _data_plugin_options ? void 0 : _data_plugin_options.entryName;
|
|
2467
2452
|
if (!entryName) return data;
|
|
2468
2453
|
let { headTags, bodyTags } = data, { favicon, tagConfig, templateContent } = this.options[entryName];
|
|
2469
|
-
|
|
2454
|
+
hasTitle(templateContent) || addTitleTag(headTags, null === (_data_plugin_options1 = data.plugin.options) || void 0 === _data_plugin_options1 ? void 0 : _data_plugin_options1.title), favicon && await addFavicon(headTags, favicon, compilation, data.publicPath);
|
|
2470
2455
|
let tags = {
|
|
2471
2456
|
headTags: headTags.map(formatBasicTag),
|
|
2472
2457
|
bodyTags: bodyTags.map(formatBasicTag)
|
|
@@ -2514,7 +2499,7 @@ var __webpack_exports__ = {};
|
|
|
2514
2499
|
}
|
|
2515
2500
|
let getTagConfig = (config)=>{
|
|
2516
2501
|
let tags = castArray(config.html.tags).filter(Boolean);
|
|
2517
|
-
if (
|
|
2502
|
+
if (tags.length) return {
|
|
2518
2503
|
append: !0,
|
|
2519
2504
|
hash: !1,
|
|
2520
2505
|
publicPath: !0,
|
|
@@ -2527,7 +2512,6 @@ var __webpack_exports__ = {};
|
|
|
2527
2512
|
let { config, htmlPaths } = environment;
|
|
2528
2513
|
if (0 === Object.keys(htmlPaths).length) return;
|
|
2529
2514
|
let assetPrefix = getPublicPathFromChain(chain, !1), entries = chain.entryPoints.entries() || {}, entryNames = Object.keys(entries).filter((entryName)=>!!htmlPaths[entryName]), htmlInfoMap = {}, finalOptions = await Promise.all(entryNames.map(async (entryName)=>{
|
|
2530
|
-
var entryName1, entryName2, config1, assetPrefix1, entryName3, entryName4;
|
|
2531
2515
|
let entryValue = entries[entryName].values(), chunks = function(entryName, entryValue) {
|
|
2532
2516
|
let chunks = [
|
|
2533
2517
|
entryName
|
|
@@ -2535,40 +2519,16 @@ var __webpack_exports__ = {};
|
|
|
2535
2519
|
for (let item of entryValue){
|
|
2536
2520
|
if (!isPlainObject(item)) continue;
|
|
2537
2521
|
let { dependOn } = item;
|
|
2538
|
-
|
|
2522
|
+
dependOn && ('string' == typeof dependOn ? chunks.unshift(dependOn) : chunks.unshift(...dependOn));
|
|
2539
2523
|
}
|
|
2540
2524
|
return chunks;
|
|
2541
|
-
}(entryName, entryValue)
|
|
2542
|
-
let inject = (entryName1 = entryName, reduceConfigsMergeContext({
|
|
2525
|
+
}(entryName, entryValue), inject = reduceConfigsMergeContext({
|
|
2543
2526
|
initial: 'head',
|
|
2544
2527
|
config: config.html.inject,
|
|
2545
2528
|
ctx: {
|
|
2546
|
-
entryName:
|
|
2529
|
+
entryName: entryName
|
|
2547
2530
|
}
|
|
2548
|
-
})
|
|
2549
|
-
let templateParameters = (entryName2 = entryName, config1 = config, assetPrefix1 = assetPrefix, (compilation, assets, assetTags, pluginOptions)=>{
|
|
2550
|
-
let { mountId, templateParameters } = config1.html, rspackConfig = compilation.options, htmlPlugin = {
|
|
2551
|
-
tags: assetTags,
|
|
2552
|
-
files: assets,
|
|
2553
|
-
options: pluginOptions
|
|
2554
|
-
};
|
|
2555
|
-
return reduceConfigsWithContext({
|
|
2556
|
-
initial: {
|
|
2557
|
-
mountId,
|
|
2558
|
-
entryName: entryName2,
|
|
2559
|
-
assetPrefix: assetPrefix1,
|
|
2560
|
-
compilation,
|
|
2561
|
-
htmlPlugin,
|
|
2562
|
-
rspackConfig,
|
|
2563
|
-
webpackConfig: rspackConfig,
|
|
2564
|
-
htmlWebpackPlugin: htmlPlugin
|
|
2565
|
-
},
|
|
2566
|
-
config: templateParameters,
|
|
2567
|
-
ctx: {
|
|
2568
|
-
entryName: entryName2
|
|
2569
|
-
}
|
|
2570
|
-
});
|
|
2571
|
-
}), pluginOptions = {
|
|
2531
|
+
}), filename = htmlPaths[entryName], { templatePath, templateContent } = await getTemplate(entryName, config, api.context.rootPath), pluginOptions = {
|
|
2572
2532
|
meta: function(entryName, config, templateContent) {
|
|
2573
2533
|
let metaTags = reduceConfigsMergeContext({
|
|
2574
2534
|
initial: {},
|
|
@@ -2583,27 +2543,49 @@ var __webpack_exports__ = {};
|
|
|
2583
2543
|
inject,
|
|
2584
2544
|
filename,
|
|
2585
2545
|
entryName,
|
|
2586
|
-
templateParameters,
|
|
2546
|
+
templateParameters: (compilation, assets, assetTags, pluginOptions)=>{
|
|
2547
|
+
let { mountId, templateParameters } = config.html, rspackConfig = compilation.options, htmlPlugin = {
|
|
2548
|
+
tags: assetTags,
|
|
2549
|
+
files: assets,
|
|
2550
|
+
options: pluginOptions
|
|
2551
|
+
};
|
|
2552
|
+
return reduceConfigsWithContext({
|
|
2553
|
+
initial: {
|
|
2554
|
+
mountId,
|
|
2555
|
+
entryName: entryName,
|
|
2556
|
+
assetPrefix: assetPrefix,
|
|
2557
|
+
compilation,
|
|
2558
|
+
htmlPlugin,
|
|
2559
|
+
rspackConfig,
|
|
2560
|
+
webpackConfig: rspackConfig,
|
|
2561
|
+
htmlWebpackPlugin: htmlPlugin
|
|
2562
|
+
},
|
|
2563
|
+
config: templateParameters,
|
|
2564
|
+
ctx: {
|
|
2565
|
+
entryName: entryName
|
|
2566
|
+
}
|
|
2567
|
+
});
|
|
2568
|
+
},
|
|
2587
2569
|
scriptLoading: config.html.scriptLoading
|
|
2588
2570
|
};
|
|
2589
2571
|
templatePath && (pluginOptions.template = templatePath), chunks.length > 1 && (pluginOptions.chunksSortMode = 'manual');
|
|
2590
2572
|
let htmlInfo = {};
|
|
2591
2573
|
htmlInfoMap[entryName] = htmlInfo, templateContent && (htmlInfo.templateContent = templateContent);
|
|
2592
2574
|
let tagConfig = getTagConfig(environment.config);
|
|
2593
|
-
tagConfig && (htmlInfo.tagConfig = tagConfig), pluginOptions.title =
|
|
2575
|
+
tagConfig && (htmlInfo.tagConfig = tagConfig), pluginOptions.title = reduceConfigsMergeContext({
|
|
2594
2576
|
initial: '',
|
|
2595
2577
|
config: config.html.title,
|
|
2596
2578
|
ctx: {
|
|
2597
|
-
entryName:
|
|
2579
|
+
entryName: entryName
|
|
2598
2580
|
}
|
|
2599
|
-
})
|
|
2600
|
-
let favicon =
|
|
2581
|
+
});
|
|
2582
|
+
let favicon = reduceConfigsMergeContext({
|
|
2601
2583
|
initial: '',
|
|
2602
2584
|
config: config.html.favicon,
|
|
2603
2585
|
ctx: {
|
|
2604
|
-
entryName:
|
|
2586
|
+
entryName: entryName
|
|
2605
2587
|
}
|
|
2606
|
-
})
|
|
2588
|
+
});
|
|
2607
2589
|
favicon && (htmlInfo.favicon = favicon);
|
|
2608
2590
|
let finalOptions = reduceConfigsWithContext({
|
|
2609
2591
|
initial: pluginOptions,
|
|
@@ -2613,7 +2595,7 @@ var __webpack_exports__ = {};
|
|
|
2613
2595
|
entryValue
|
|
2614
2596
|
}
|
|
2615
2597
|
});
|
|
2616
|
-
return
|
|
2598
|
+
return finalOptions.template || finalOptions.templateContent || (pluginOptions.template = '', pluginOptions.templateContent = templateContent), finalOptions;
|
|
2617
2599
|
}));
|
|
2618
2600
|
if (entryNames.forEach((entryName, index)=>{
|
|
2619
2601
|
chain.plugin(`${CHAIN_ID.PLUGIN.HTML}-${entryName}`).use(HtmlPlugin, [
|
|
@@ -2638,7 +2620,7 @@ var __webpack_exports__ = {};
|
|
|
2638
2620
|
let formattedCrossorigin = !0 === crossorigin ? 'anonymous' : crossorigin;
|
|
2639
2621
|
for (let tag of allTags){
|
|
2640
2622
|
var _tag_attrs, _tag_attrs1;
|
|
2641
|
-
(
|
|
2623
|
+
("script" === tag.tag && (null === (_tag_attrs = tag.attrs) || void 0 === _tag_attrs ? void 0 : _tag_attrs.src) || 'link' === tag.tag && (null === (_tag_attrs1 = tag.attrs) || void 0 === _tag_attrs1 ? void 0 : _tag_attrs1.rel) === 'stylesheet') && (tag.attrs.crossorigin ??= formattedCrossorigin);
|
|
2642
2624
|
}
|
|
2643
2625
|
}
|
|
2644
2626
|
return {
|
|
@@ -2675,7 +2657,7 @@ var __webpack_exports__ = {};
|
|
|
2675
2657
|
let source = asset.source().toString();
|
|
2676
2658
|
if (!matchTests(scriptName, source, scriptTests)) return tag;
|
|
2677
2659
|
let ret = {
|
|
2678
|
-
tag:
|
|
2660
|
+
tag: "script",
|
|
2679
2661
|
children: updateSourceMappingURL({
|
|
2680
2662
|
source,
|
|
2681
2663
|
compilation,
|
|
@@ -2707,7 +2689,7 @@ var __webpack_exports__ = {};
|
|
|
2707
2689
|
})
|
|
2708
2690
|
};
|
|
2709
2691
|
return inlinedAssets.add(linkName), ret;
|
|
2710
|
-
}, getInlinedTag = (publicPath, tag, compilation, scriptTests, styleTests, config)=>
|
|
2692
|
+
}, getInlinedTag = (publicPath, tag, compilation, scriptTests, styleTests, config)=>"script" === tag.tag ? getInlinedScriptTag(publicPath, tag, compilation, scriptTests, config) : 'link' === tag.tag && tag.attrs && 'stylesheet' === tag.attrs.rel ? getInlinedCSSTag(publicPath, tag, compilation, styleTests, config) : tag;
|
|
2711
2693
|
api.processAssets({
|
|
2712
2694
|
stage: 'summarize'
|
|
2713
2695
|
}, ({ compiler, compilation })=>{
|
|
@@ -2740,7 +2722,7 @@ var __webpack_exports__ = {};
|
|
|
2740
2722
|
var _config_dev;
|
|
2741
2723
|
if (isProd || 'web' !== target) return;
|
|
2742
2724
|
let { config } = environment, options = null === (_config_dev = config.dev) || void 0 === _config_dev ? void 0 : _config_dev.lazyCompilation;
|
|
2743
|
-
|
|
2725
|
+
options && chain.experiments({
|
|
2744
2726
|
...chain.get('experiments'),
|
|
2745
2727
|
lazyCompilation: options
|
|
2746
2728
|
});
|
|
@@ -2828,10 +2810,11 @@ var __webpack_exports__ = {};
|
|
|
2828
2810
|
...defaultOptions,
|
|
2829
2811
|
...manifest
|
|
2830
2812
|
};
|
|
2831
|
-
}(manifest), { RspackManifestPlugin } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/rspack-manifest-plugin/index.js")), { htmlPaths } = environment;
|
|
2813
|
+
}(manifest), { RspackManifestPlugin } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/rspack-manifest-plugin/index.js")), { htmlPaths } = environment, filter = manifestOptions.filter ?? ((file)=>!file.name.endsWith('.LICENSE.txt'));
|
|
2832
2814
|
chain.plugin(CHAIN_ID.PLUGIN.MANIFEST).use(RspackManifestPlugin, [
|
|
2833
2815
|
{
|
|
2834
2816
|
fileName: manifestOptions.filename,
|
|
2817
|
+
filter,
|
|
2835
2818
|
writeToFileEmit: isDev && !0 !== writeToDisk,
|
|
2836
2819
|
generate: generateManifest(htmlPaths, manifestOptions)
|
|
2837
2820
|
}
|
|
@@ -2904,13 +2887,13 @@ var __webpack_exports__ = {};
|
|
|
2904
2887
|
let applyPatch = (cacheGroup)=>{
|
|
2905
2888
|
if ('object' != typeof cacheGroup || (0, types_namespaceObject.isRegExp)(cacheGroup)) return;
|
|
2906
2889
|
let { chunks } = cacheGroup;
|
|
2907
|
-
if (
|
|
2890
|
+
if (chunks && 'async' !== chunks) {
|
|
2908
2891
|
if ('function' == typeof chunks) {
|
|
2909
2892
|
cacheGroup.chunks = (chunk)=>(!chunk.name || chunk.name !== this.name) && chunks(chunk);
|
|
2910
2893
|
return;
|
|
2911
2894
|
}
|
|
2912
2895
|
if ('all' === chunks) {
|
|
2913
|
-
cacheGroup.chunks = (chunk)
|
|
2896
|
+
cacheGroup.chunks = (chunk)=>!chunk.name || chunk.name !== this.name;
|
|
2914
2897
|
return;
|
|
2915
2898
|
}
|
|
2916
2899
|
if ('initial' === chunks) {
|
|
@@ -2921,7 +2904,7 @@ var __webpack_exports__ = {};
|
|
|
2921
2904
|
};
|
|
2922
2905
|
applyPatch(splitChunks);
|
|
2923
2906
|
let { cacheGroups } = splitChunks;
|
|
2924
|
-
if (
|
|
2907
|
+
if (cacheGroups) for (let cacheGroupKey of Object.keys(cacheGroups))applyPatch(cacheGroups[cacheGroupKey]);
|
|
2925
2908
|
}
|
|
2926
2909
|
constructor(name){
|
|
2927
2910
|
!function(obj, key, value) {
|
|
@@ -3001,7 +2984,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3001
2984
|
...headTags,
|
|
3002
2985
|
...bodyTags
|
|
3003
2986
|
];
|
|
3004
|
-
if (nonce) for (let tag of allTags)(
|
|
2987
|
+
if (nonce) for (let tag of allTags)("script" === tag.tag || 'style' === tag.tag) && (tag.attrs ??= {}, tag.attrs.nonce = nonce);
|
|
3005
2988
|
return {
|
|
3006
2989
|
headTags,
|
|
3007
2990
|
bodyTags
|
|
@@ -3100,7 +3083,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3100
3083
|
let interfaces = external_node_os_default().networkInterfaces(), ipv4Interfaces = new Map();
|
|
3101
3084
|
for (let key of Object.keys(interfaces))for (let detail of interfaces[key]){
|
|
3102
3085
|
let familyV4Value = 'string' == typeof detail.family ? 'IPv4' : 4;
|
|
3103
|
-
detail.family
|
|
3086
|
+
detail.family !== familyV4Value || ipv4Interfaces.has(detail.address) || ipv4Interfaces.set(detail.address, detail);
|
|
3104
3087
|
}
|
|
3105
3088
|
return Array.from(ipv4Interfaces.values());
|
|
3106
3089
|
}, isLoopbackHost = (host)=>[
|
|
@@ -3188,7 +3171,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3188
3171
|
}), !0;
|
|
3189
3172
|
rslog_index_js_namespaceObject.logger.debug('Failed to find the target browser.');
|
|
3190
3173
|
} catch (err) {
|
|
3191
|
-
rslog_index_js_namespaceObject.logger.debug(
|
|
3174
|
+
rslog_index_js_namespaceObject.logger.debug("Failed to open start URL with apple script."), rslog_index_js_namespaceObject.logger.debug(err);
|
|
3192
3175
|
}
|
|
3193
3176
|
try {
|
|
3194
3177
|
let { default: open } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/open/index.js"));
|
|
@@ -3226,7 +3209,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3226
3209
|
} catch (e) {
|
|
3227
3210
|
throw Error('[rsbuild:open]: Invalid input: not a valid URL or pathname');
|
|
3228
3211
|
}
|
|
3229
|
-
})(replacePortPlaceholder(target, port), baseUrl))) : routes.length && urls.push(`${baseUrl}${routes[0].pathname}`), before && await before(), urls))
|
|
3212
|
+
})(replacePortPlaceholder(target, port), baseUrl))) : routes.length && urls.push(`${baseUrl}${routes[0].pathname}`), before && await before(), urls))openedURLs.includes(url) || (openBrowser(url), openedURLs.push(url));
|
|
3230
3213
|
}
|
|
3231
3214
|
let getJsAsyncPath = (jsPath, isServer, jsAsync)=>void 0 !== jsAsync ? jsAsync : isServer ? jsPath : jsPath ? `${jsPath}/async` : 'async', pluginOutput = ()=>({
|
|
3232
3215
|
name: 'rsbuild:output',
|
|
@@ -3305,13 +3288,13 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3305
3288
|
}
|
|
3306
3289
|
}), api.modifyBundlerChain((chain, { environment })=>{
|
|
3307
3290
|
let { config } = environment, { profile } = config.performance;
|
|
3308
|
-
|
|
3291
|
+
profile && chain.profile(profile);
|
|
3309
3292
|
});
|
|
3310
3293
|
}
|
|
3311
3294
|
}), pluginProgress = ()=>({
|
|
3312
3295
|
name: 'rsbuild:progress',
|
|
3313
3296
|
setup (api) {
|
|
3314
|
-
|
|
3297
|
+
'webpack' !== api.context.bundlerType && api.modifyBundlerChain(async (chain, { CHAIN_ID, environment })=>{
|
|
3315
3298
|
let { config } = environment, options = config.dev.progressBar ?? 'production' === config.mode;
|
|
3316
3299
|
if (!options) return;
|
|
3317
3300
|
let prefix = !0 !== options && void 0 !== options.id ? options.id : environment.name;
|
|
@@ -3332,17 +3315,17 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3332
3315
|
let { config, tsconfigPath } = environment;
|
|
3333
3316
|
chain.resolve.extensions.merge([
|
|
3334
3317
|
...config.resolve.extensions
|
|
3335
|
-
]), tsconfigPath && chain.resolve.extensionAlias.merge({
|
|
3318
|
+
]), tsconfigPath && !tsconfigPath.endsWith('jsconfig.json') && chain.resolve.extensionAlias.merge({
|
|
3336
3319
|
'.js': [
|
|
3320
|
+
'.js',
|
|
3337
3321
|
'.ts',
|
|
3338
|
-
'.tsx'
|
|
3339
|
-
'.js'
|
|
3322
|
+
'.tsx'
|
|
3340
3323
|
],
|
|
3341
3324
|
'.jsx': [
|
|
3342
|
-
'.
|
|
3343
|
-
'.
|
|
3325
|
+
'.jsx',
|
|
3326
|
+
'.tsx'
|
|
3344
3327
|
]
|
|
3345
|
-
}),
|
|
3328
|
+
}), function({ chain, config, rootPath }) {
|
|
3346
3329
|
let mergedAlias = reduceConfigs({
|
|
3347
3330
|
initial: {},
|
|
3348
3331
|
config: config.resolve.alias
|
|
@@ -3411,7 +3394,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3411
3394
|
};
|
|
3412
3395
|
class HtmlPreloadOrPrefetchPlugin {
|
|
3413
3396
|
apply(compiler) {
|
|
3414
|
-
compiler.hooks.compilation.tap(this.
|
|
3397
|
+
compiler.hooks.compilation.tap(this.name, (compilation)=>{
|
|
3415
3398
|
getHTMLPlugin().getHooks(compilation).beforeAssetTagGeneration.tap(`HTML${upperFirst(this.type)}Plugin`, (htmlPluginData)=>(this.resourceHints = function(options, type, compilation, htmlPluginData, HTMLCount) {
|
|
3416
3399
|
let extractedChunks = function({ compilation, includeType }) {
|
|
3417
3400
|
let chunks = [
|
|
@@ -3426,7 +3409,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3426
3409
|
...(null === (_compilation_assetsInfo = compilation.assetsInfo) || void 0 === _compilation_assetsInfo ? void 0 : _compilation_assetsInfo.values()) || []
|
|
3427
3410
|
].map((info)=>{
|
|
3428
3411
|
var _info_related;
|
|
3429
|
-
return
|
|
3412
|
+
return null !== (_info_related = info.related) && void 0 !== _info_related && !!_info_related.license && info.related.license;
|
|
3430
3413
|
}).filter(Boolean);
|
|
3431
3414
|
return [
|
|
3432
3415
|
{
|
|
@@ -3442,8 +3425,8 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3442
3425
|
...new Set(('all-assets' === options.type || 1 === HTMLCount ? extractedChunks : extractedChunks.filter((chunk)=>(function({ chunk, htmlPluginData }) {
|
|
3443
3426
|
let { options } = htmlPluginData.plugin;
|
|
3444
3427
|
return recursiveChunkEntryNames(chunk).some((chunkName)=>{
|
|
3445
|
-
var
|
|
3446
|
-
return
|
|
3428
|
+
var includeChunks, excludeChunks;
|
|
3429
|
+
return includeChunks = null == options ? void 0 : options.chunks, excludeChunks = null == options ? void 0 : options.excludeChunks, !(Array.isArray(includeChunks) && -1 === includeChunks.indexOf(chunkName) || Array.isArray(excludeChunks) && -1 !== excludeChunks.indexOf(chunkName));
|
|
3447
3430
|
});
|
|
3448
3431
|
})({
|
|
3449
3432
|
chunk: chunk,
|
|
@@ -3468,11 +3451,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3468
3451
|
'css'
|
|
3469
3452
|
].includes(extension) ? 'style' : IMAGE_EXTENSIONS.includes(extension) ? 'image' : VIDEO_EXTENSIONS.includes(extension) ? 'video' : AUDIO_EXTENSIONS.includes(extension) ? 'audio' : FONT_EXTENSIONS.includes(extension) ? 'font' : [
|
|
3470
3453
|
'vtt'
|
|
3471
|
-
].includes(extension) ? 'track' :
|
|
3454
|
+
].includes(extension) ? 'track' : "script";
|
|
3472
3455
|
}({
|
|
3473
3456
|
href,
|
|
3474
3457
|
file
|
|
3475
|
-
}), 'font' === attributes.as && (attributes.crossorigin = ''), (
|
|
3458
|
+
}), 'font' === attributes.as && (attributes.crossorigin = ''), ("script" === attributes.as || 'style' === attributes.as) && crossOriginLoading && !('use-credentials' !== crossOriginLoading && '/' === publicPath) && (attributes.crossorigin = 'anonymous' === crossOriginLoading ? '' : crossOriginLoading)), links.push({
|
|
3476
3459
|
tagName: 'link',
|
|
3477
3460
|
attributes,
|
|
3478
3461
|
voidTag: !0,
|
|
@@ -3493,7 +3476,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3493
3476
|
});
|
|
3494
3477
|
}
|
|
3495
3478
|
constructor(options, type, HTMLCount){
|
|
3496
|
-
HtmlPreloadOrPrefetchPlugin_define_property(this, "options", void 0), HtmlPreloadOrPrefetchPlugin_define_property(this, "resourceHints", []), HtmlPreloadOrPrefetchPlugin_define_property(this, "type", void 0), HtmlPreloadOrPrefetchPlugin_define_property(this, "HTMLCount", void 0), this.options = {
|
|
3479
|
+
HtmlPreloadOrPrefetchPlugin_define_property(this, "options", void 0), HtmlPreloadOrPrefetchPlugin_define_property(this, "name", 'HtmlPreloadOrPrefetchPlugin'), HtmlPreloadOrPrefetchPlugin_define_property(this, "resourceHints", []), HtmlPreloadOrPrefetchPlugin_define_property(this, "type", void 0), HtmlPreloadOrPrefetchPlugin_define_property(this, "HTMLCount", void 0), this.options = {
|
|
3497
3480
|
...HtmlPreloadOrPrefetchPlugin_defaultOptions,
|
|
3498
3481
|
...'boolean' == typeof options ? {} : options
|
|
3499
3482
|
}, this.type = type, this.HTMLCount = HTMLCount;
|
|
@@ -3572,7 +3555,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3572
3555
|
rslog_index_js_namespaceObject.logger.error(`\`process.env.RSDOCTOR\` enabled, but failed to load ${index_js_default().bold(index_js_default().yellow(packageName))} module.`);
|
|
3573
3556
|
return;
|
|
3574
3557
|
}
|
|
3575
|
-
if (
|
|
3558
|
+
if (module && module[pluginName]) {
|
|
3576
3559
|
for (let config of bundlerConfigs)config.plugins ||= [], config.plugins.push(new module[pluginName]());
|
|
3577
3560
|
rslog_index_js_namespaceObject.logger.info(`${index_js_default().bold(index_js_default().yellow(packageName))} enabled.`);
|
|
3578
3561
|
}
|
|
@@ -3581,7 +3564,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3581
3564
|
}), external_node_inspector_namespaceObject = require("node:inspector");
|
|
3582
3565
|
var external_node_inspector_default = __webpack_require__.n(external_node_inspector_namespaceObject);
|
|
3583
3566
|
let stopProfiler = (output, profileSession)=>{
|
|
3584
|
-
|
|
3567
|
+
profileSession && profileSession.post('Profiler.stop', (error, param)=>{
|
|
3585
3568
|
if (error) {
|
|
3586
3569
|
rslog_index_js_namespaceObject.logger.error('Failed to generate JS CPU profile:', error);
|
|
3587
3570
|
return;
|
|
@@ -3598,7 +3581,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3598
3581
|
if (!RSPACK_PROFILE) return;
|
|
3599
3582
|
let timestamp = Date.now(), profileDirName = `rspack-profile-${timestamp}`, enableProfileTrace = 'ALL' === RSPACK_PROFILE || RSPACK_PROFILE.includes('TRACE'), enableCPUProfile = 'ALL' === RSPACK_PROFILE || RSPACK_PROFILE.includes('CPU'), enableLogging = 'ALL' === RSPACK_PROFILE || RSPACK_PROFILE.includes('LOGGING'), onStart = ()=>{
|
|
3600
3583
|
let profileDir = external_node_path_default().join(api.context.distPath, profileDirName), traceFilePath = external_node_path_default().join(profileDir, 'trace.json');
|
|
3601
|
-
|
|
3584
|
+
external_node_fs_default().existsSync(profileDir) || external_node_fs_default().mkdirSync(profileDir, {
|
|
3602
3585
|
recursive: !0
|
|
3603
3586
|
}), enableProfileTrace && core_default().experiments.globalTrace.register('trace', 'chrome', traceFilePath), enableCPUProfile && ((profileSession = new (external_node_inspector_default()).Session()).connect(), profileSession.post('Profiler.enable'), profileSession.post('Profiler.start'));
|
|
3604
3587
|
};
|
|
@@ -3636,7 +3619,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3636
3619
|
}
|
|
3637
3620
|
};
|
|
3638
3621
|
api.onAfterStartDevServer(onStartServer), api.onAfterStartProdServer(onStartServer), api.onBeforeBuild(async ({ isFirstCompile, environments })=>{
|
|
3639
|
-
if (
|
|
3622
|
+
if (isFirstCompile) for (let publicDir of normalizePublicDirs(api.getNormalizedConfig().server.publicDir)){
|
|
3640
3623
|
let { name, copyOnBuild } = publicDir;
|
|
3641
3624
|
if (!1 === copyOnBuild || !name) continue;
|
|
3642
3625
|
let normalizedPath = (0, external_node_path_namespaceObject.isAbsolute)(name) ? name : (0, external_node_path_namespaceObject.join)(api.context.rootPath, name);
|
|
@@ -3821,10 +3804,9 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3821
3804
|
...tags.bodyTags
|
|
3822
3805
|
]){
|
|
3823
3806
|
let url = '';
|
|
3824
|
-
if (!tag.attrs) continue;
|
|
3825
|
-
if ('script' === tag.tag && 'string' == typeof tag.attrs.src ? url = tag.attrs.src : 'link' === tag.tag && isSriLinkRel(tag.attrs.rel) && 'string' == typeof tag.attrs.href && (url = tag.attrs.href), !url) continue;
|
|
3807
|
+
if (!tag.attrs || ("script" === tag.tag && 'string' == typeof tag.attrs.src ? url = tag.attrs.src : 'link' === tag.tag && isSriLinkRel(tag.attrs.rel) && 'string' == typeof tag.attrs.href && (url = tag.attrs.href), !url)) continue;
|
|
3826
3808
|
let assetName = getAssetName(url, assetPrefix);
|
|
3827
|
-
|
|
3809
|
+
assetName && (tag.attrs.integrity ??= `${placeholder}${assetName}`);
|
|
3828
3810
|
}
|
|
3829
3811
|
return tags;
|
|
3830
3812
|
}
|
|
@@ -3837,10 +3819,12 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3837
3819
|
};
|
|
3838
3820
|
for (let match of matches){
|
|
3839
3821
|
let assetName = match[1];
|
|
3840
|
-
if (
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3822
|
+
if (assetName) {
|
|
3823
|
+
if (assets[assetName]) {
|
|
3824
|
+
let integrity = calcIntegrity(algorithm, assetName, assets[assetName].buffer());
|
|
3825
|
+
replacedHtml = replacedHtml.replaceAll(`integrity="${placeholder}${assetName}"`, `integrity="${integrity}"`);
|
|
3826
|
+
} else rslog_index_js_namespaceObject.logger.debug(`[rsbuild:sri] failed to generate integrity for ${assetName}.`), replacedHtml = replacedHtml.replace(`integrity="${placeholder}${assetName}"`, '');
|
|
3827
|
+
}
|
|
3844
3828
|
}
|
|
3845
3829
|
return replacedHtml;
|
|
3846
3830
|
};
|
|
@@ -3855,7 +3839,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3855
3839
|
for (let asset of Object.keys(assets)){
|
|
3856
3840
|
if (!HTML_REGEX.test(asset)) continue;
|
|
3857
3841
|
let htmlContent = assets[asset].source();
|
|
3858
|
-
|
|
3842
|
+
htmlContent.includes(placeholder) && (assets[asset] = new sources.RawSource(replaceIntegrity(htmlContent, assets, algorithm, integrityCache)));
|
|
3859
3843
|
}
|
|
3860
3844
|
});
|
|
3861
3845
|
}
|
|
@@ -3865,13 +3849,12 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3865
3849
|
api.modifyBundlerChain({
|
|
3866
3850
|
order: 'pre',
|
|
3867
3851
|
handler: async (chain, { CHAIN_ID, isDev, target, environment })=>{
|
|
3868
|
-
|
|
3869
|
-
let { config, browserslist: browserslist1 } = environment, cacheRoot = external_node_path_default().join(api.context.cachePath, '.swc'), rule = chain.module.rule(CHAIN_ID.RULE.JS).test(SCRIPT_REGEX).type('javascript/auto').dependency({
|
|
3852
|
+
let { config, browserslist } = environment, cacheRoot = external_node_path_default().join(api.context.cachePath, '.swc'), rule = chain.module.rule(CHAIN_ID.RULE.JS).test(SCRIPT_REGEX).type("javascript/auto").dependency({
|
|
3870
3853
|
not: 'url'
|
|
3871
3854
|
}), dataUriRule = chain.module.rule(CHAIN_ID.RULE.JS_DATA_URI).mimetype({
|
|
3872
3855
|
or: [
|
|
3873
|
-
|
|
3874
|
-
|
|
3856
|
+
"text/javascript",
|
|
3857
|
+
"application/javascript"
|
|
3875
3858
|
]
|
|
3876
3859
|
});
|
|
3877
3860
|
if (!function({ rule, isDev, config, context, rsbuildTarget }) {
|
|
@@ -3891,12 +3874,12 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3891
3874
|
context: api.context,
|
|
3892
3875
|
rsbuildTarget: target
|
|
3893
3876
|
}), 'webpack' === api.context.bundlerType) return;
|
|
3894
|
-
let swcConfig =
|
|
3877
|
+
let swcConfig = {
|
|
3895
3878
|
jsc: {
|
|
3896
3879
|
externalHelpers: !0,
|
|
3897
3880
|
parser: {
|
|
3898
3881
|
tsx: !1,
|
|
3899
|
-
syntax:
|
|
3882
|
+
syntax: "typescript",
|
|
3900
3883
|
decorators: !0
|
|
3901
3884
|
},
|
|
3902
3885
|
experimental: {
|
|
@@ -3908,7 +3891,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3908
3891
|
env: {
|
|
3909
3892
|
targets: browserslist
|
|
3910
3893
|
}
|
|
3911
|
-
}
|
|
3894
|
+
};
|
|
3912
3895
|
if (function(swcConfig, pluginImport) {
|
|
3913
3896
|
let finalPluginImport = reduceTransformImportConfig(pluginImport);
|
|
3914
3897
|
(null == finalPluginImport ? void 0 : finalPluginImport.length) && (swcConfig.rspackExperiments ??= {}, swcConfig.rspackExperiments.import ??= [], swcConfig.rspackExperiments.import.push(...finalPluginImport));
|
|
@@ -3925,7 +3908,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3925
3908
|
default:
|
|
3926
3909
|
throw Error(`[rsbuild:swc] Unknown decorators version: ${version}`);
|
|
3927
3910
|
}
|
|
3928
|
-
}(swcConfig, config), castArray(
|
|
3911
|
+
}(swcConfig, config), castArray(target).includes('web') || target.includes('web-worker')) {
|
|
3929
3912
|
let polyfillMode = config.output.polyfill;
|
|
3930
3913
|
if ('off' === polyfillMode) swcConfig.env.mode = void 0;
|
|
3931
3914
|
else {
|
|
@@ -4011,12 +3994,9 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4011
3994
|
});
|
|
4012
3995
|
});
|
|
4013
3996
|
}
|
|
4014
|
-
}), getInspectOutputPath = (context, inspectOptions)=>
|
|
4015
|
-
if (inspectOptions.outputPath) return (0, external_node_path_namespaceObject.isAbsolute)(inspectOptions.outputPath) ? inspectOptions.outputPath : (0, external_node_path_namespaceObject.join)(context.distPath, inspectOptions.outputPath);
|
|
4016
|
-
return (0, external_node_path_namespaceObject.join)(context.distPath, RSBUILD_OUTPUTS_PATH);
|
|
4017
|
-
};
|
|
3997
|
+
}), getInspectOutputPath = (context, inspectOptions)=>inspectOptions.outputPath ? (0, external_node_path_namespaceObject.isAbsolute)(inspectOptions.outputPath) ? inspectOptions.outputPath : (0, external_node_path_namespaceObject.join)(context.distPath, inspectOptions.outputPath) : (0, external_node_path_namespaceObject.join)(context.distPath, RSBUILD_OUTPUTS_PATH);
|
|
4018
3998
|
async function inspectConfig({ context, pluginManager, rsbuildOptions, bundlerConfigs, inspectOptions = {} }) {
|
|
4019
|
-
inspectOptions.mode ? setNodeEnv(inspectOptions.mode) :
|
|
3999
|
+
inspectOptions.mode ? setNodeEnv(inspectOptions.mode) : getNodeEnv() || setNodeEnv('development');
|
|
4020
4000
|
let rspackConfigs = bundlerConfigs || (await initConfigs({
|
|
4021
4001
|
context,
|
|
4022
4002
|
pluginManager,
|
|
@@ -4124,7 +4104,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4124
4104
|
POSTCSS: 'postcss',
|
|
4125
4105
|
LIGHTNINGCSS: 'lightningcss',
|
|
4126
4106
|
IGNORE_CSS: 'ignore-css',
|
|
4127
|
-
CSS_MODULES_TS:
|
|
4107
|
+
CSS_MODULES_TS: "css-modules-typescript",
|
|
4128
4108
|
MINI_CSS_EXTRACT: 'mini-css-extract',
|
|
4129
4109
|
RESOLVE_URL: 'resolve-url-loader'
|
|
4130
4110
|
},
|
|
@@ -4179,22 +4159,22 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4179
4159
|
mergeConfig: merge,
|
|
4180
4160
|
addRules (rules) {
|
|
4181
4161
|
let ruleArr = castArray(rules);
|
|
4182
|
-
|
|
4162
|
+
config.module || (config.module = {}), config.module.rules || (config.module.rules = []), config.module.rules.unshift(...ruleArr);
|
|
4183
4163
|
},
|
|
4184
4164
|
appendRules (rules) {
|
|
4185
4165
|
let ruleArr = castArray(rules);
|
|
4186
|
-
|
|
4166
|
+
config.module || (config.module = {}), config.module.rules || (config.module.rules = []), config.module.rules.push(...ruleArr);
|
|
4187
4167
|
},
|
|
4188
4168
|
prependPlugins (plugins) {
|
|
4189
4169
|
let pluginArr = castArray(plugins);
|
|
4190
|
-
|
|
4170
|
+
config.plugins || (config.plugins = []), config.plugins.unshift(...pluginArr);
|
|
4191
4171
|
},
|
|
4192
4172
|
appendPlugins (plugins) {
|
|
4193
4173
|
let pluginArr = castArray(plugins);
|
|
4194
|
-
|
|
4174
|
+
config.plugins || (config.plugins = []), config.plugins.push(...pluginArr);
|
|
4195
4175
|
},
|
|
4196
4176
|
removePlugin (pluginName) {
|
|
4197
|
-
|
|
4177
|
+
config.plugins && (config.plugins = config.plugins.filter((plugin)=>!plugin || (plugin.name || plugin.constructor.name) !== pluginName));
|
|
4198
4178
|
}
|
|
4199
4179
|
};
|
|
4200
4180
|
}
|
|
@@ -4253,7 +4233,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4253
4233
|
}
|
|
4254
4234
|
let initEnvironmentConfigs = (normalizedConfig, rootPath, specifiedEnvironments)=>{
|
|
4255
4235
|
let defaultEntry;
|
|
4256
|
-
let getDefaultEntryWithMemo = ()=>(
|
|
4236
|
+
let getDefaultEntryWithMemo = ()=>(defaultEntry || (defaultEntry = function(root) {
|
|
4257
4237
|
let entryFile = findExists([
|
|
4258
4238
|
'ts',
|
|
4259
4239
|
'js',
|
|
@@ -4266,7 +4246,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4266
4246
|
index: entryFile
|
|
4267
4247
|
} : {};
|
|
4268
4248
|
}(rootPath)), defaultEntry), { environments, dev, server, provider, ...rsbuildSharedConfig } = normalizedConfig, isEnvironmentEnabled = (name)=>!specifiedEnvironments || specifiedEnvironments.includes(name), applyEnvironmentDefaultConfig = (config)=>{
|
|
4269
|
-
|
|
4249
|
+
config.source.entry && 0 !== Object.keys(config.source.entry).length || (config.source.entry = getDefaultEntryWithMemo());
|
|
4270
4250
|
let isServer = 'node' === config.output.target;
|
|
4271
4251
|
return void 0 === config.output.distPath.js && (config.output.distPath.js = isServer ? '' : 'static/js'), config;
|
|
4272
4252
|
};
|
|
@@ -4449,8 +4429,8 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4449
4429
|
return (options)=>{
|
|
4450
4430
|
let { clientPaths, clientConfig, callbacks, liveReload, ...restOptions } = options;
|
|
4451
4431
|
return applyToCompiler(multiCompiler, (compiler)=>{
|
|
4452
|
-
clientPaths &&
|
|
4453
|
-
if (
|
|
4432
|
+
clientPaths && function({ compiler, clientPaths, clientConfig = {}, liveReload = !0 }) {
|
|
4433
|
+
if (isClientCompiler(compiler)) for (let clientPath of (new compiler.webpack.DefinePlugin({
|
|
4454
4434
|
RSBUILD_COMPILATION_NAME: JSON.stringify(getCompilationId(compiler)),
|
|
4455
4435
|
RSBUILD_CLIENT_CONFIG: JSON.stringify(clientConfig),
|
|
4456
4436
|
RSBUILD_DEV_LIVE_RELOAD: liveReload
|
|
@@ -4512,7 +4492,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4512
4492
|
}
|
|
4513
4493
|
class SocketServer {
|
|
4514
4494
|
upgrade(req, sock, head) {
|
|
4515
|
-
|
|
4495
|
+
this.wsServer.shouldHandle(req) && this.wsServer.handleUpgrade(req, sock, head, (connection)=>{
|
|
4516
4496
|
this.wsServer.emit('connection', connection, req);
|
|
4517
4497
|
});
|
|
4518
4498
|
}
|
|
@@ -4556,9 +4536,9 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4556
4536
|
this.timer && (clearInterval(this.timer), this.timer = null);
|
|
4557
4537
|
}
|
|
4558
4538
|
onConnect(socket, params) {
|
|
4559
|
-
|
|
4539
|
+
socket.isAlive = !0, socket.on('pong', ()=>{
|
|
4560
4540
|
socket.isAlive = !0;
|
|
4561
|
-
}),
|
|
4541
|
+
}), socket && (this.sockets.push(socket), socket.on('close', ()=>{
|
|
4562
4542
|
let idx = this.sockets.indexOf(socket);
|
|
4563
4543
|
idx >= 0 && this.sockets.splice(idx, 1);
|
|
4564
4544
|
}), (this.options.hmr || this.options.liveReload) && this.singleWrite(socket, {
|
|
@@ -4567,7 +4547,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4567
4547
|
}), this.stats && this.sendStats({
|
|
4568
4548
|
force: !0,
|
|
4569
4549
|
compilationId: params.compilationId
|
|
4570
|
-
});
|
|
4550
|
+
}));
|
|
4571
4551
|
}
|
|
4572
4552
|
getStats(name) {
|
|
4573
4553
|
let curStats = this.stats[name];
|
|
@@ -4589,20 +4569,16 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4589
4569
|
});
|
|
4590
4570
|
}
|
|
4591
4571
|
sendStats({ force = !1, compilationId }) {
|
|
4592
|
-
var a, b;
|
|
4593
4572
|
let stats = this.getStats(compilationId);
|
|
4594
4573
|
if (!stats) return null;
|
|
4595
4574
|
let newInitialChunks = new Set();
|
|
4596
4575
|
if (stats.entrypoints) for (let entrypoint of Object.values(stats.entrypoints)){
|
|
4597
4576
|
let chunks = entrypoint.chunks;
|
|
4598
|
-
if (
|
|
4599
|
-
if (!!chunkName) newInitialChunks.add(String(chunkName));
|
|
4600
|
-
}
|
|
4577
|
+
if (Array.isArray(chunks)) for (let chunkName of chunks)chunkName && newInitialChunks.add(String(chunkName));
|
|
4601
4578
|
}
|
|
4602
|
-
let initialChunks = this.initialChunks[compilationId]
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
].every((value)=>b.has(value))));
|
|
4579
|
+
let initialChunks = this.initialChunks[compilationId], shouldReload = !!stats.entrypoints && !!initialChunks && !(initialChunks.size === newInitialChunks.size && [
|
|
4580
|
+
...initialChunks
|
|
4581
|
+
].every((value)=>newInitialChunks.has(value)));
|
|
4606
4582
|
if (this.initialChunks[compilationId] = newInitialChunks, shouldReload) return this.sockWrite({
|
|
4607
4583
|
type: 'static-changed',
|
|
4608
4584
|
compilationId
|
|
@@ -4626,13 +4602,10 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4626
4602
|
data: {
|
|
4627
4603
|
text: formattedErrors,
|
|
4628
4604
|
html: function(errors) {
|
|
4629
|
-
let htmlItems = errors.map((item)=>{
|
|
4630
|
-
var text;
|
|
4631
|
-
return server_ansiHTML((text = item) ? text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''') : '').replace(/(?:[a-zA-Z]:\\|\/).*?:\d+:\d+/g, (file)=>{
|
|
4605
|
+
let htmlItems = errors.map((item)=>server_ansiHTML(item ? item.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''') : '').replace(/(?:[a-zA-Z]:\\|\/).*?:\d+:\d+/g, (file)=>{
|
|
4632
4606
|
let hasClosingSpan = file.includes('</span>') && !file.includes('<span'), filePath = hasClosingSpan ? file.replace('</span>', '') : file;
|
|
4633
4607
|
return `<a class="file-link" data-file="${filePath}">${filePath}</a>${hasClosingSpan ? '</span>' : ''}`;
|
|
4634
|
-
});
|
|
4635
|
-
});
|
|
4608
|
+
}));
|
|
4636
4609
|
return `
|
|
4637
4610
|
<style>
|
|
4638
4611
|
.root {
|
|
@@ -4776,7 +4749,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4776
4749
|
});
|
|
4777
4750
|
}
|
|
4778
4751
|
send(connection, message) {
|
|
4779
|
-
|
|
4752
|
+
1 === connection.readyState && connection.send(message);
|
|
4780
4753
|
}
|
|
4781
4754
|
constructor(options){
|
|
4782
4755
|
socketServer_define_property(this, "wsServer", void 0), socketServer_define_property(this, "sockets", []), socketServer_define_property(this, "options", void 0), socketServer_define_property(this, "stats", void 0), socketServer_define_property(this, "initialChunks", void 0), socketServer_define_property(this, "timer", null), this.options = options, this.stats = {}, this.initialChunks = {};
|
|
@@ -4854,7 +4827,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4854
4827
|
clientPaths: function(devConfig) {
|
|
4855
4828
|
var _devConfig_client;
|
|
4856
4829
|
let clientPaths = [];
|
|
4857
|
-
return devConfig.hmr || devConfig.liveReload
|
|
4830
|
+
return (devConfig.hmr || devConfig.liveReload) && (clientPaths.push(compilerDevMiddleware_require.resolve('@rsbuild/core/client/hmr')), (null === (_devConfig_client = devConfig.client) || void 0 === _devConfig_client ? void 0 : _devConfig_client.overlay) && clientPaths.push(`${compilerDevMiddleware_require.resolve('@rsbuild/core/client/overlay')}`)), clientPaths;
|
|
4858
4831
|
}(devConfig),
|
|
4859
4832
|
clientConfig: devConfig.client,
|
|
4860
4833
|
liveReload: devConfig.liveReload,
|
|
@@ -4888,7 +4861,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4888
4861
|
].map((name)=>`const _${name} = ${SYNTHETIC_MODULES_STORE}[${i}]${'default' === name ? '' : `[${JSON.stringify(name)}]`}; export { _${name} as ${name}};`).join('\n'), m = new (external_node_vm_default()).SourceTextModule(code, {
|
|
4889
4862
|
context
|
|
4890
4863
|
});
|
|
4891
|
-
return unlinked
|
|
4864
|
+
return unlinked || (await m.link(()=>{}), m.instantiate && m.instantiate(), await m.evaluate()), m;
|
|
4892
4865
|
};
|
|
4893
4866
|
function basic_define_property(obj, key, value) {
|
|
4894
4867
|
return key in obj ? Object.defineProperty(obj, key, {
|
|
@@ -4911,7 +4884,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4911
4884
|
};
|
|
4912
4885
|
class BasicRunner {
|
|
4913
4886
|
run(file) {
|
|
4914
|
-
|
|
4887
|
+
this.globalContext || (this.globalContext = this.createGlobalContext()), this.baseModuleScope = this.createBaseModuleScope(), this.createRunner();
|
|
4915
4888
|
let res = this.getRequire()(this._options.dist, file.startsWith('./') ? file : `./${file}`);
|
|
4916
4889
|
return 'object' == typeof res && 'then' in res ? res : Promise.resolve(res);
|
|
4917
4890
|
}
|
|
@@ -5032,7 +5005,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5032
5005
|
let _require = this.getRequire(), file = context.file || this.getFile(modulePath, currentDirectory);
|
|
5033
5006
|
if (!file) return this.requirers.get('miss')(currentDirectory, modulePath);
|
|
5034
5007
|
let esm = esmCache.get(file.path);
|
|
5035
|
-
return (
|
|
5008
|
+
return (esm || (esm = new (external_node_vm_default()).SourceTextModule(file.content, {
|
|
5036
5009
|
identifier: `${esmIdentifier}-${file.path}`,
|
|
5037
5010
|
url: `${(0, external_node_url_namespaceObject.pathToFileURL)(file.path).href}?${esmIdentifier}`,
|
|
5038
5011
|
context: esmContext,
|
|
@@ -5420,9 +5393,9 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5420
5393
|
};
|
|
5421
5394
|
let outputFileSystem = external_node_fs_default(), waitFirstCompileDone = runCompile ? new Promise((resolve)=>{
|
|
5422
5395
|
options.context.hooks.onDevCompileDone.tap(({ stats, isFirstCompile })=>{
|
|
5423
|
-
|
|
5396
|
+
lastStats = 'stats' in stats ? stats.stats : [
|
|
5424
5397
|
stats
|
|
5425
|
-
],
|
|
5398
|
+
], isFirstCompile && resolve();
|
|
5426
5399
|
});
|
|
5427
5400
|
}) : Promise.resolve(), startCompile = async ()=>{
|
|
5428
5401
|
let compiler = customCompiler || await createCompiler();
|
|
@@ -5567,10 +5540,10 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5567
5540
|
environments: context.environments
|
|
5568
5541
|
}), !await isSatisfyRspackVersion(core_namespaceObject.rspack.rspackVersion)) throw Error(`[rsbuild] The current Rspack version does not meet the requirements, the minimum supported version of Rspack is ${index_js_default().green(rspackMinVersion)}`);
|
|
5569
5542
|
let compiler = 1 === rspackConfigs.length ? (0, core_namespaceObject.rspack)(rspackConfigs[0]) : (0, core_namespaceObject.rspack)(rspackConfigs), isVersionLogged = !1, isCompiling = !1, logRspackVersion = ()=>{
|
|
5570
|
-
|
|
5543
|
+
isVersionLogged || (rslog_index_js_namespaceObject.logger.debug(`Use Rspack v${core_namespaceObject.rspack.rspackVersion}`), isVersionLogged = !0);
|
|
5571
5544
|
};
|
|
5572
5545
|
compiler.hooks.watchRun.tap('rsbuild:compiling', ()=>{
|
|
5573
|
-
logRspackVersion(),
|
|
5546
|
+
logRspackVersion(), isCompiling || rslog_index_js_namespaceObject.logger.start('Building...'), isCompiling = !0;
|
|
5574
5547
|
}), 'build' === context.command && compiler.hooks.run.tap('rsbuild:run', logRspackVersion);
|
|
5575
5548
|
let done = (stats)=>{
|
|
5576
5549
|
let statsOptions = getStatsOptions(compiler), statsJson = stats.toJson({
|
|
@@ -5870,7 +5843,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5870
5843
|
api.modifyRsbuildConfig({
|
|
5871
5844
|
order: 'post',
|
|
5872
5845
|
handler: (config)=>{
|
|
5873
|
-
if (
|
|
5846
|
+
if (isUseAnalyzer(config) || Object.values(config.environments || []).some((config)=>isUseAnalyzer(config))) return config.dev ||= {}, config.dev.writeToDisk = !0, config;
|
|
5874
5847
|
}
|
|
5875
5848
|
}), api.modifyBundlerChain(async (chain, { CHAIN_ID, environment })=>{
|
|
5876
5849
|
let { config } = environment;
|
|
@@ -5892,24 +5865,22 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5892
5865
|
{
|
|
5893
5866
|
name: 'rsbuild:module-federation',
|
|
5894
5867
|
setup (api) {
|
|
5895
|
-
|
|
5868
|
+
'webpack' !== api.context.bundlerType && (api.modifyRsbuildConfig((config)=>{
|
|
5896
5869
|
let { moduleFederation } = config;
|
|
5897
|
-
if (
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
config.dev ||= {}, (null === (_config_server = config.server) || void 0 === _config_server ? void 0 : _config_server.port) && !(null === (_config_dev_client = config.dev.client) || void 0 === _config_dev_client ? void 0 : _config_dev_client.port) && (config.dev.client ||= {}, config.dev.client.port = config.server.port), (null === (_originalConfig_dev = api.getRsbuildConfig('original').dev) || void 0 === _originalConfig_dev ? void 0 : _originalConfig_dev.assetPrefix) === void 0 && config.dev.assetPrefix === (null === (_config_server1 = config.server) || void 0 === _config_server1 ? void 0 : _config_server1.base) && (config.dev.assetPrefix = !0);
|
|
5901
|
-
}
|
|
5870
|
+
if ((null == moduleFederation ? void 0 : moduleFederation.options) && moduleFederation.options.exposes) {
|
|
5871
|
+
var _config_server, _config_dev_client, _originalConfig_dev, _config_server1;
|
|
5872
|
+
config.dev ||= {}, (null === (_config_server = config.server) || void 0 === _config_server ? void 0 : _config_server.port) && !(null === (_config_dev_client = config.dev.client) || void 0 === _config_dev_client ? void 0 : _config_dev_client.port) && (config.dev.client ||= {}, config.dev.client.port = config.server.port), (null === (_originalConfig_dev = api.getRsbuildConfig('original').dev) || void 0 === _originalConfig_dev ? void 0 : _originalConfig_dev.assetPrefix) === void 0 && config.dev.assetPrefix === (null === (_config_server1 = config.server) || void 0 === _config_server1 ? void 0 : _config_server1.base) && (config.dev.assetPrefix = !0);
|
|
5902
5873
|
}
|
|
5903
5874
|
}), api.modifyEnvironmentConfig((config)=>{
|
|
5904
5875
|
var _config_moduleFederation, _config_performance_chunkSplit, _config_performance;
|
|
5905
|
-
|
|
5876
|
+
(null === (_config_moduleFederation = config.moduleFederation) || void 0 === _config_moduleFederation ? void 0 : _config_moduleFederation.options) && ((null === (_config_performance = config.performance) || void 0 === _config_performance ? void 0 : null === (_config_performance_chunkSplit = _config_performance.chunkSplit) || void 0 === _config_performance_chunkSplit ? void 0 : _config_performance_chunkSplit.strategy) === 'split-by-experience' && (config.performance.chunkSplit = {
|
|
5906
5877
|
...config.performance.chunkSplit,
|
|
5907
5878
|
strategy: 'custom'
|
|
5908
5879
|
}), config.source.include = [
|
|
5909
5880
|
...config.source.include || [],
|
|
5910
5881
|
/@module-federation[\\/]sdk/,
|
|
5911
5882
|
/@module-federation[\\/]runtime/
|
|
5912
|
-
];
|
|
5883
|
+
]);
|
|
5913
5884
|
}), api.modifyBundlerChain(async (chain, { CHAIN_ID, target, environment })=>{
|
|
5914
5885
|
var _config_moduleFederation;
|
|
5915
5886
|
let { config } = environment;
|
|
@@ -5919,8 +5890,8 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5919
5890
|
options
|
|
5920
5891
|
]), options.name && (options.exposes && chain.plugin('mf-patch-split-chunks').use(PatchSplitChunksPlugin, [
|
|
5921
5892
|
options.name
|
|
5922
|
-
]),
|
|
5923
|
-
});
|
|
5893
|
+
]), chain.output.get('uniqueName') || chain.output.set('uniqueName', options.name));
|
|
5894
|
+
}));
|
|
5924
5895
|
}
|
|
5925
5896
|
},
|
|
5926
5897
|
pluginRspackProfile(),
|
|
@@ -5930,20 +5901,20 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5930
5901
|
]);
|
|
5931
5902
|
}
|
|
5932
5903
|
async function createRsbuild(options = {}) {
|
|
5933
|
-
let plugins
|
|
5904
|
+
let plugins;
|
|
5905
|
+
let { rsbuildConfig = {} } = options, rsbuildOptions = {
|
|
5934
5906
|
cwd: process.cwd(),
|
|
5935
5907
|
rsbuildConfig,
|
|
5936
5908
|
...options
|
|
5937
|
-
}
|
|
5938
|
-
let pluginManager = (plugins = [], {
|
|
5909
|
+
}, pluginManager = (plugins = [], {
|
|
5939
5910
|
getPlugins: (options = {
|
|
5940
5911
|
environment: RSBUILD_ALL_ENVIRONMENT_SYMBOL
|
|
5941
5912
|
})=>plugins.filter((p)=>isPluginMatchEnvironment(p.environment, options.environment)).map((p)=>p.instance),
|
|
5942
5913
|
getAllPluginsWithMeta: ()=>plugins,
|
|
5943
5914
|
addPlugins: (newPlugins, options)=>{
|
|
5944
5915
|
let { before, environment = RSBUILD_ALL_ENVIRONMENT_SYMBOL } = options || {};
|
|
5945
|
-
for (let newPlugin of newPlugins){
|
|
5946
|
-
if (
|
|
5916
|
+
for (let newPlugin of newPlugins)if (newPlugin) {
|
|
5917
|
+
if (function(plugin) {
|
|
5947
5918
|
let type = typeof plugin;
|
|
5948
5919
|
if ('object' !== type || null === plugin) throw Error(`[rsbuild:plugin] Expect Rsbuild plugin instance to be an object, but got ${type}.`);
|
|
5949
5920
|
if (!isFunction(plugin.setup)) {
|
|
@@ -6035,7 +6006,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6035
6006
|
}, transformId = 0, transformer = {}, processAssetsFns = [], resolveFns = [];
|
|
6036
6007
|
hooks.modifyBundlerChain.tap((chain, { target, environment })=>{
|
|
6037
6008
|
let pluginName = 'RsbuildCorePlugin';
|
|
6038
|
-
chain.plugin(pluginName).use(class
|
|
6009
|
+
chain.plugin(pluginName).use(class {
|
|
6039
6010
|
apply(compiler) {
|
|
6040
6011
|
for (let { handler, environment: pluginEnvironment } of (compiler.__rsbuildTransformer = transformer, resolveFns)){
|
|
6041
6012
|
if (pluginEnvironment && !isPluginMatchEnvironment(pluginEnvironment, environment.name)) return;
|
|
@@ -6068,6 +6039,15 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6068
6039
|
}
|
|
6069
6040
|
});
|
|
6070
6041
|
}
|
|
6042
|
+
constructor(){
|
|
6043
|
+
var key;
|
|
6044
|
+
(key = "name") in this ? Object.defineProperty(this, key, {
|
|
6045
|
+
value: pluginName,
|
|
6046
|
+
enumerable: !0,
|
|
6047
|
+
configurable: !0,
|
|
6048
|
+
writable: !0
|
|
6049
|
+
}) : this[key] = pluginName;
|
|
6050
|
+
}
|
|
6071
6051
|
});
|
|
6072
6052
|
});
|
|
6073
6053
|
let getTransformFn = (environment)=>(descriptor, handler)=>{
|
|
@@ -6097,7 +6077,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6097
6077
|
handler
|
|
6098
6078
|
});
|
|
6099
6079
|
}, onExitListened = !1, onExit = (cb)=>{
|
|
6100
|
-
|
|
6080
|
+
onExitListened || (process.on('exit', ()=>{
|
|
6101
6081
|
hooks.onExit.call();
|
|
6102
6082
|
}), onExitListened = !0), hooks.onExit.tap(cb);
|
|
6103
6083
|
};
|
|
@@ -6169,35 +6149,35 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6169
6149
|
pluginManager,
|
|
6170
6150
|
rsbuildOptions,
|
|
6171
6151
|
helpers: provider_helpers_namespaceObject
|
|
6172
|
-
}),
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6152
|
+
}), rsbuild = {
|
|
6153
|
+
build: async (...args)=>{
|
|
6154
|
+
context.command = 'build', getNodeEnv() || setNodeEnv('production');
|
|
6155
|
+
let buildInstance = await providerInstance.build(...args);
|
|
6156
|
+
return {
|
|
6157
|
+
...buildInstance,
|
|
6158
|
+
close: async ()=>{
|
|
6159
|
+
await context.hooks.onCloseBuild.call(), await buildInstance.close();
|
|
6160
|
+
}
|
|
6161
|
+
};
|
|
6162
|
+
},
|
|
6163
|
+
preview: async (options = {})=>{
|
|
6164
|
+
context.command = 'preview', getNodeEnv() || setNodeEnv('production');
|
|
6165
|
+
let config = await initRsbuildConfig({
|
|
6166
|
+
context,
|
|
6167
|
+
pluginManager
|
|
6168
|
+
}), { distPath } = context, { checkDistDir = !0 } = options;
|
|
6169
|
+
if (checkDistDir) {
|
|
6170
|
+
if (!(0, external_node_fs_namespaceObject.existsSync)(distPath)) throw Error(`[rsbuild:preview] The output directory ${index_js_default().yellow(distPath)} does not exist, please build the project before previewing.`);
|
|
6171
|
+
if (function(path) {
|
|
6172
|
+
let files = external_node_fs_default().readdirSync(path);
|
|
6173
|
+
return 0 === files.length || 1 === files.length && '.git' === files[0];
|
|
6174
|
+
}(distPath)) throw Error(`[rsbuild:preview] The output directory ${index_js_default().yellow(distPath)} is empty, please build the project before previewing.`);
|
|
6193
6175
|
}
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
createCompiler: (...args)=>(!context.command && (context.command = 'development' === getNodeEnv() ? 'dev' : 'build'), providerInstance.createCompiler(...args)),
|
|
6200
|
-
createDevServer: (...args)=>(context.command = 'dev', !getNodeEnv() && setNodeEnv('development'), providerInstance.createDevServer(...args)),
|
|
6176
|
+
return startProdServer(context, config, options);
|
|
6177
|
+
},
|
|
6178
|
+
startDevServer: (...args)=>(context.command = 'dev', getNodeEnv() || setNodeEnv('development'), providerInstance.startDevServer(...args)),
|
|
6179
|
+
createCompiler: (...args)=>(context.command || (context.command = 'development' === getNodeEnv() ? 'dev' : 'build'), providerInstance.createCompiler(...args)),
|
|
6180
|
+
createDevServer: (...args)=>(context.command = 'dev', getNodeEnv() || setNodeEnv('development'), providerInstance.createDevServer(...args)),
|
|
6201
6181
|
...pick(pluginManager, [
|
|
6202
6182
|
'addPlugins',
|
|
6203
6183
|
'getPlugins',
|
|
@@ -6269,7 +6249,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6269
6249
|
alias: {},
|
|
6270
6250
|
boolean: []
|
|
6271
6251
|
};
|
|
6272
|
-
for (let [index, option] of options.entries())option.names.length > 1 && (result.alias[option.names[0]] = option.names.slice(1)), option.isBoolean && (option.negated
|
|
6252
|
+
for (let [index, option] of options.entries())option.names.length > 1 && (result.alias[option.names[0]] = option.names.slice(1)), option.isBoolean && (option.negated && options.some((o, i)=>i !== index && o.names.some((name)=>option.names.includes(name)) && "boolean" == typeof o.required) || result.boolean.push(option.names[0]));
|
|
6273
6253
|
return result;
|
|
6274
6254
|
}, findLongest = (arr)=>arr.sort((a, b)=>a.length > b.length ? -1 : 1)[0], padRight = (str, length)=>str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`, camelcase = (input)=>input.replace(/([a-z])-([a-z])/g, (_, p1, p2)=>p1 + p2.toUpperCase()), setDotProp = (obj, keys, val)=>{
|
|
6275
6255
|
let x, i = 0, length = keys.length, t = obj;
|
|
@@ -6361,7 +6341,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6361
6341
|
...this.options,
|
|
6362
6342
|
...globalOptions || []
|
|
6363
6343
|
];
|
|
6364
|
-
if (
|
|
6344
|
+
if (this.isGlobalCommand || this.isDefaultCommand || (options = options.filter((option)=>"version" !== option.name)), options.length > 0) {
|
|
6365
6345
|
let longestOptionName = findLongest(options.map((option)=>option.rawName));
|
|
6366
6346
|
sections.push({
|
|
6367
6347
|
title: "Options",
|
|
@@ -6444,7 +6424,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6444
6424
|
this.matchedCommand = void 0, this.matchedCommandName = void 0;
|
|
6445
6425
|
}
|
|
6446
6426
|
parse(argv = processArgs, { run = !0 } = {}) {
|
|
6447
|
-
this.rawArgs = argv,
|
|
6427
|
+
this.rawArgs = argv, this.name || (this.name = argv[1] ? getFileName(argv[1]) : "cli");
|
|
6448
6428
|
let shouldParse = !0;
|
|
6449
6429
|
for (let command of this.commands){
|
|
6450
6430
|
let parsed = this.mri(argv.slice(2), command), commandName = parsed.args[0];
|
|
@@ -6571,12 +6551,12 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6571
6551
|
}
|
|
6572
6552
|
}(), process.title = 'rsbuild-node';
|
|
6573
6553
|
let { npm_execpath } = process.env;
|
|
6574
|
-
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.2.0-
|
|
6554
|
+
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.2.0-beta.0\n`);
|
|
6575
6555
|
}();
|
|
6576
6556
|
try {
|
|
6577
6557
|
!function() {
|
|
6578
6558
|
let cli = cac_dist('rsbuild');
|
|
6579
|
-
cli.help(), cli.version("1.2.0-
|
|
6559
|
+
cli.help(), cli.version("1.2.0-beta.0"), applyCommonOptions(cli);
|
|
6580
6560
|
let devCommand = cli.command('dev', 'starting the dev server'), buildCommand = cli.command('build', 'build the app for production'), previewCommand = cli.command('preview', 'preview the production build locally'), inspectCommand = cli.command('inspect', 'inspect the Rspack and Rsbuild configs');
|
|
6581
6561
|
applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
|
|
6582
6562
|
try {
|
|
@@ -6627,7 +6607,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6627
6607
|
rslog_index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), rslog_index_js_namespaceObject.logger.error(err);
|
|
6628
6608
|
}
|
|
6629
6609
|
}
|
|
6630
|
-
let src_rslib_entry_version = "1.2.0-
|
|
6610
|
+
let src_rslib_entry_version = "1.2.0-beta.0";
|
|
6631
6611
|
})();
|
|
6632
6612
|
var __webpack_export_target__ = exports;
|
|
6633
6613
|
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|