@unpackjs/core 3.3.3 → 3.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiled/css-loader/index.js +339 -217
- package/compiled/launch-editor/index.js +21 -20
- package/compiled/launch-editor/package.json +1 -1
- package/compiled/less-loader/index.js +8 -8
- package/compiled/postcss-loader/index.js +194 -192
- package/compiled/sass-loader/index.js +142 -156
- package/compiled/sass-loader/package.json +1 -1
- package/compiled/semver/index.js +187 -169
- package/compiled/semver/package.json +1 -1
- package/compiled/style-loader/index.js +10 -10
- package/compiled/webpack-bundle-analyzer/index.js +2 -2
- package/compiled/webpack-merge/index.js +29 -29
- package/dist/index.cjs +139 -168
- package/dist/index.js +92 -122
- package/dist-types/bundler-config/index.d.ts.map +1 -1
- package/dist-types/bundler-config/typeCheck.d.ts.map +1 -1
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -72,74 +72,74 @@ var __webpack_exports__ = {};
|
|
|
72
72
|
for(var __webpack_i__ in (()=>{
|
|
73
73
|
let lastTrackTime, lastFileInfo, logger;
|
|
74
74
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
createChokidar: ()=>createChokidar,
|
|
76
|
+
rspack: ()=>core_namespaceObject.rspack,
|
|
77
|
+
setNodeEnv: ()=>setNodeEnv,
|
|
78
78
|
getAddressUrls: ()=>getAddressUrls,
|
|
79
|
+
LogColor: ()=>logger_LogColor,
|
|
80
|
+
getUserDepVersion: ()=>getUserDepVersion,
|
|
81
|
+
NODE_MODULES_REGEX: ()=>NODE_MODULES_REGEX,
|
|
82
|
+
PROD_DEFAULT_FILENAME: ()=>PROD_DEFAULT_FILENAME,
|
|
83
|
+
CSS_MODULES_REGEX: ()=>CSS_MODULES_REGEX,
|
|
84
|
+
isEmptyDir: ()=>isEmptyDir,
|
|
79
85
|
isDevServer: ()=>utils_isDevServer,
|
|
80
|
-
|
|
81
|
-
isFileExists: ()=>isFileExists,
|
|
82
|
-
getNodeEnv: ()=>getNodeEnv,
|
|
86
|
+
clearLine: ()=>clearLine,
|
|
83
87
|
isWatch: ()=>isWatch,
|
|
88
|
+
DEFAULT_DEV_HOST: ()=>DEFAULT_DEV_HOST,
|
|
89
|
+
isDev: ()=>isDev,
|
|
90
|
+
isRegExp: ()=>isRegExp,
|
|
91
|
+
cleanUpBeforeRestart: ()=>cleanUpBeforeRestart,
|
|
84
92
|
currentDevUnpackConfig: ()=>currentDevUnpackConfig,
|
|
85
|
-
|
|
86
|
-
isFunction: ()=>isFunction,
|
|
93
|
+
isPlainObject: ()=>isPlainObject,
|
|
87
94
|
debounce: ()=>debounce,
|
|
88
|
-
|
|
89
|
-
|
|
95
|
+
isUndefined: ()=>isUndefined,
|
|
96
|
+
trackPerformance: ()=>trackPerformance,
|
|
97
|
+
removeDir: ()=>removeDir,
|
|
98
|
+
CSS_MODULES_LOCAL_IDENT_NAME: ()=>CSS_MODULES_LOCAL_IDENT_NAME,
|
|
99
|
+
findExists: ()=>findExists,
|
|
100
|
+
mergeConfig: ()=>mergeConfig,
|
|
101
|
+
CSS_NAMED_EXPORT: ()=>!1,
|
|
102
|
+
isBoolean: ()=>isBoolean,
|
|
103
|
+
setValueByPath: ()=>setValueByPath,
|
|
104
|
+
isCSSModules: ()=>isCSSModules,
|
|
90
105
|
isNodeVersionAtLeast: ()=>isNodeVersionAtLeast,
|
|
91
|
-
|
|
106
|
+
isProd: ()=>isProd,
|
|
107
|
+
TEMPLATE_CONTENT: ()=>TEMPLATE_CONTENT,
|
|
92
108
|
getCompiledPkgPath: ()=>getCompiledPkgPath,
|
|
93
|
-
|
|
109
|
+
isObject: ()=>isObject,
|
|
94
110
|
setCurrentDevUnpackConfig: ()=>setCurrentDevUnpackConfig,
|
|
95
|
-
|
|
96
|
-
loadConfig: ()=>loadConfig,
|
|
97
|
-
PROD_DEFAULT_FILENAME: ()=>PROD_DEFAULT_FILENAME,
|
|
98
|
-
prettyTime: ()=>prettyTime,
|
|
99
|
-
esVersionToBrowserslist: ()=>esVersionToBrowserslist,
|
|
100
|
-
mergeConfig: ()=>mergeConfig,
|
|
101
|
-
isString: ()=>isString,
|
|
102
|
-
getPathInJs: ()=>getPathInJs,
|
|
103
|
-
isFileSync: ()=>isFileSync,
|
|
104
|
-
clearLine: ()=>clearLine,
|
|
105
|
-
TEMP_DIR: ()=>TEMP_DIR,
|
|
106
|
-
EXPORT_LOCALS_CONVENTION: ()=>EXPORT_LOCALS_CONVENTION,
|
|
107
|
-
isProd: ()=>isProd,
|
|
108
|
-
isBoolean: ()=>isBoolean,
|
|
109
|
-
createChokidar: ()=>createChokidar,
|
|
110
|
-
setDevServer: ()=>setDevServer,
|
|
111
|
-
CSS_MODULES_LOCAL_IDENT_NAME: ()=>CSS_MODULES_LOCAL_IDENT_NAME,
|
|
112
|
-
findExists: ()=>findExists,
|
|
113
|
-
getUserDepVersion: ()=>getUserDepVersion,
|
|
114
|
-
NODE_MODULES_REGEX: ()=>NODE_MODULES_REGEX,
|
|
115
|
-
getPort: ()=>getPort,
|
|
116
|
-
getValueByPath: ()=>getValueByPath,
|
|
111
|
+
resolveConfigPath: ()=>resolveConfigPath,
|
|
117
112
|
getIpv4Interfaces: ()=>getIpv4Interfaces,
|
|
113
|
+
getNodeEnv: ()=>getNodeEnv,
|
|
114
|
+
getPort: ()=>getPort,
|
|
118
115
|
isCI: ()=>isCI,
|
|
119
|
-
colors: ()=>colors,
|
|
120
|
-
isEmptyDir: ()=>isEmptyDir,
|
|
121
116
|
logger: ()=>logger_logger,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
117
|
+
addRestartCleaner: ()=>addRestartCleaner,
|
|
118
|
+
colors: ()=>colors,
|
|
119
|
+
esVersionToBrowserslist: ()=>esVersionToBrowserslist,
|
|
120
|
+
isFunction: ()=>isFunction,
|
|
126
121
|
pathExists: ()=>pathExists,
|
|
127
|
-
isPlainObject: ()=>isPlainObject,
|
|
128
|
-
CSS_NAMED_EXPORT: ()=>CSS_NAMED_EXPORT,
|
|
129
122
|
DEV_DEFAULT_FILENAME: ()=>DEV_DEFAULT_FILENAME,
|
|
130
|
-
|
|
131
|
-
|
|
123
|
+
isWin: ()=>isWin,
|
|
124
|
+
prettyTime: ()=>prettyTime,
|
|
132
125
|
setupCliShortcuts: ()=>setupCliShortcuts,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
isObject: ()=>isObject,
|
|
136
|
-
trackPerformance: ()=>trackPerformance,
|
|
126
|
+
loadConfig: ()=>loadConfig,
|
|
127
|
+
THREAD_OPTIONS: ()=>THREAD_OPTIONS,
|
|
137
128
|
createUnpack: ()=>createUnpack,
|
|
129
|
+
setDevServer: ()=>setDevServer,
|
|
130
|
+
EXPORT_LOCALS_CONVENTION: ()=>EXPORT_LOCALS_CONVENTION,
|
|
131
|
+
isFileExists: ()=>isFileExists,
|
|
132
|
+
TEMP_DIR: ()=>TEMP_DIR,
|
|
133
|
+
isFileSync: ()=>isFileSync,
|
|
134
|
+
getPathInJs: ()=>getPathInJs,
|
|
138
135
|
getTime: ()=>getTime,
|
|
139
|
-
|
|
140
|
-
isCSSModules: ()=>isCSSModules,
|
|
136
|
+
getValueByPath: ()=>getValueByPath,
|
|
141
137
|
isDebug: ()=>isDebug,
|
|
142
|
-
|
|
138
|
+
launchEditor: ()=>launchEditor,
|
|
139
|
+
logUpdate: ()=>logUpdate,
|
|
140
|
+
defineConfig: ()=>defineConfig,
|
|
141
|
+
getUserDepPath: ()=>getUserDepPath,
|
|
142
|
+
isString: ()=>isString
|
|
143
143
|
});
|
|
144
144
|
let core_namespaceObject = require("@rspack/core"), external_picocolors_namespaceObject = require("picocolors"), colors = {
|
|
145
145
|
...__webpack_require__.n(external_picocolors_namespaceObject)(),
|
|
@@ -178,7 +178,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
178
178
|
jsAsync: 'js/async/[name].[contenthash:8].js',
|
|
179
179
|
css: 'css/[name].[contenthash:8].css',
|
|
180
180
|
cssAsync: 'css/async/[name].[contenthash:8].css'
|
|
181
|
-
}, EXPORT_LOCALS_CONVENTION = 'camel-case-only', TEMP_DIR = 'node_modules/.unpack', NODE_MODULES_REGEX = /[\\/]node_modules[\\/]/,
|
|
181
|
+
}, EXPORT_LOCALS_CONVENTION = 'camel-case-only', TEMP_DIR = 'node_modules/.unpack', NODE_MODULES_REGEX = /[\\/]node_modules[\\/]/, THREAD_OPTIONS = {
|
|
182
182
|
workers: 2
|
|
183
183
|
}, DEFAULT_DEV_HOST = '0.0.0.0', TEMPLATE_CONTENT = ({ title = '', headTag = '', mountId = '' })=>`<!DOCTYPE html>
|
|
184
184
|
<html lang="en">
|
|
@@ -432,8 +432,8 @@ for(var __webpack_i__ in (()=>{
|
|
|
432
432
|
}
|
|
433
433
|
let external_node_url_namespaceObject = require("node:url");
|
|
434
434
|
async function loadConfig({ cliOptions, command }) {
|
|
435
|
-
'build' === command ? setNodeEnv(
|
|
436
|
-
let root =
|
|
435
|
+
'build' === command ? setNodeEnv(cliOptions?.watch ? 'development' : 'production') : (setNodeEnv('development'), setDevServer(!0));
|
|
436
|
+
let root = cliOptions?.root ? external_node_path_default().resolve(cliOptions.root) : process.cwd(), configFilePath = resolveConfigPath(root, cliOptions?.config), configExport = {};
|
|
437
437
|
if (configFilePath) {
|
|
438
438
|
if (isNodeVersionAtLeast(22, 18) || /\.(?:js|mjs|cjs)$/.test(configFilePath)) {
|
|
439
439
|
logger_logger.debug('loading config file with native loader:', colors.dim(configFilePath));
|
|
@@ -469,18 +469,18 @@ for(var __webpack_i__ in (()=>{
|
|
|
469
469
|
if (void 0 === (configExport = await configExport(params))) throw Error('unpack config function must return a config object.');
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
|
-
return
|
|
472
|
+
return cliOptions?.port && setValueByPath(configExport, [
|
|
473
473
|
'server',
|
|
474
474
|
'port'
|
|
475
|
-
], cliOptions.port),
|
|
475
|
+
], cliOptions.port), cliOptions?.open && setValueByPath(configExport, [
|
|
476
476
|
'server',
|
|
477
477
|
'open'
|
|
478
|
-
], cliOptions.open),
|
|
478
|
+
], cliOptions.open), cliOptions?.analyze && setValueByPath(configExport, [
|
|
479
479
|
'performance',
|
|
480
480
|
'bundleAnalyze'
|
|
481
|
-
], cliOptions.analyze),
|
|
481
|
+
], cliOptions.analyze), cliOptions?.root && setValueByPath(configExport, [
|
|
482
482
|
'root'
|
|
483
|
-
], root),
|
|
483
|
+
], root), cliOptions?.host && setValueByPath(configExport, [
|
|
484
484
|
'server',
|
|
485
485
|
'host'
|
|
486
486
|
], cliOptions.host), configExport;
|
|
@@ -509,10 +509,9 @@ for(var __webpack_i__ in (()=>{
|
|
|
509
509
|
}
|
|
510
510
|
let external_dotenv_expand_namespaceObject = require("dotenv-expand"), isFileSync = (filePath)=>{
|
|
511
511
|
try {
|
|
512
|
-
|
|
513
|
-
return null == (_fs_statSync = external_node_fs_default().statSync(filePath, {
|
|
512
|
+
return external_node_fs_default().statSync(filePath, {
|
|
514
513
|
throwIfNoEntry: !1
|
|
515
|
-
})
|
|
514
|
+
})?.isFile();
|
|
516
515
|
} catch {
|
|
517
516
|
return !1;
|
|
518
517
|
}
|
|
@@ -539,14 +538,13 @@ for(var __webpack_i__ in (()=>{
|
|
|
539
538
|
}, DOTENV_LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
|
|
540
539
|
function getNormalizedPluginsByHook(hook, plugins) {
|
|
541
540
|
let pluginMap = new Map();
|
|
542
|
-
return
|
|
541
|
+
return plugins?.forEach((plugin)=>{
|
|
543
542
|
plugin[hook] && pluginMap.set(plugin.name, plugin);
|
|
544
543
|
}), Array.from(pluginMap.values());
|
|
545
544
|
}
|
|
546
545
|
async function applyBundleAnalyzeConfig({ config }) {
|
|
547
|
-
var _config_plugins;
|
|
548
546
|
let { default: { BundleAnalyzerPlugin } } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "compiled/webpack-bundle-analyzer"));
|
|
549
|
-
return
|
|
547
|
+
return config.plugins?.push(new BundleAnalyzerPlugin({
|
|
550
548
|
analyzerPort: 'auto'
|
|
551
549
|
})), config;
|
|
552
550
|
}
|
|
@@ -628,7 +626,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
628
626
|
priority: -9,
|
|
629
627
|
test: NODE_MODULES_REGEX,
|
|
630
628
|
name: (module)=>module ? function(modulePath) {
|
|
631
|
-
let handleModuleContext =
|
|
629
|
+
let handleModuleContext = modulePath?.match(MODULE_PATH_REGEX);
|
|
632
630
|
if (!handleModuleContext) return;
|
|
633
631
|
let [, scope, name] = handleModuleContext;
|
|
634
632
|
return [
|
|
@@ -734,19 +732,16 @@ for(var __webpack_i__ in (()=>{
|
|
|
734
732
|
});
|
|
735
733
|
}
|
|
736
734
|
async generateCssTypings(incremental) {
|
|
737
|
-
let cssModulesFiles = (await (0, external_tinyglobby_namespaceObject.glob)(this.globPattern)).filter((file)=>{
|
|
738
|
-
var _this_userOptions;
|
|
739
|
-
return isCSSModules({
|
|
735
|
+
let cssModulesFiles = (await (0, external_tinyglobby_namespaceObject.glob)(this.globPattern)).filter((file)=>isCSSModules({
|
|
740
736
|
resourcePath: file,
|
|
741
|
-
modules:
|
|
742
|
-
});
|
|
743
|
-
}), doTask = incremental ? generateTypingIfNecessary : writeFile;
|
|
737
|
+
modules: this.userOptions?.modules
|
|
738
|
+
})), doTask = incremental ? generateTypingIfNecessary : writeFile;
|
|
744
739
|
return Promise.all(cssModulesFiles.map((file)=>doTask(this.dtsCreator, file)));
|
|
745
740
|
}
|
|
746
741
|
constructor(options){
|
|
747
742
|
_define_property(this, "dtsCreator", void 0), _define_property(this, "useIncremental", !1), _define_property(this, "globPattern", 'src/**/*.{css,less,scss}'), _define_property(this, "userOptions", void 0), this.userOptions = options, this.dtsCreator = new DtsCreator({
|
|
748
743
|
camelCase: !0,
|
|
749
|
-
namedExports:
|
|
744
|
+
namedExports: !1
|
|
750
745
|
});
|
|
751
746
|
}
|
|
752
747
|
}
|
|
@@ -763,7 +758,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
763
758
|
apply(compiler) {
|
|
764
759
|
let meta = JSON.stringify({
|
|
765
760
|
name: jsMinify_PLUGIN_NAME,
|
|
766
|
-
version: "3.3.
|
|
761
|
+
version: "3.3.5",
|
|
767
762
|
options: this.minifyOptions
|
|
768
763
|
});
|
|
769
764
|
compiler.hooks.compilation.tap(jsMinify_PLUGIN_NAME, (compilation)=>{
|
|
@@ -795,13 +790,12 @@ for(var __webpack_i__ in (()=>{
|
|
|
795
790
|
constructor(options = {}){
|
|
796
791
|
jsMinify_define_property(this, "minifyOptions", void 0), jsMinify_define_property(this, "customMinify", void 0);
|
|
797
792
|
const { implementation, ...minifyOptions } = options;
|
|
798
|
-
this.customMinify =
|
|
793
|
+
this.customMinify = implementation?.minify, this.minifyOptions = minifyOptions;
|
|
799
794
|
}
|
|
800
795
|
}
|
|
801
796
|
let external_node_child_process_namespaceObject = require("node:child_process");
|
|
802
797
|
class OxlintPlugin {
|
|
803
798
|
runOxlint(args) {
|
|
804
|
-
var _child_stdout, _child_stderr;
|
|
805
799
|
let child = (0, external_node_child_process_namespaceObject.spawn)('npx', [
|
|
806
800
|
'--yes',
|
|
807
801
|
...args
|
|
@@ -814,12 +808,12 @@ for(var __webpack_i__ in (()=>{
|
|
|
814
808
|
FORCE_COLOR: '1'
|
|
815
809
|
}
|
|
816
810
|
}), output = '';
|
|
817
|
-
|
|
811
|
+
child.stdout?.on('data', (data)=>{
|
|
818
812
|
output += data.toString();
|
|
819
813
|
}), child.on('exit', (code)=>{
|
|
820
814
|
let hasErrors = !output.includes('Found 0 warnings and 0 errors'), hasNoFiles = output.includes('on 0 files');
|
|
821
815
|
(hasErrors || 0 !== code) && !hasNoFiles && process.stdout.write(output);
|
|
822
|
-
}),
|
|
816
|
+
}), child.stderr?.on('data', (data)=>{
|
|
823
817
|
process.stderr.write(data);
|
|
824
818
|
});
|
|
825
819
|
}
|
|
@@ -997,12 +991,12 @@ for(var __webpack_i__ in (()=>{
|
|
|
997
991
|
}), logger_logger.ready(colors.green(`built in ${prettyTime(compileTime)}`));
|
|
998
992
|
else {
|
|
999
993
|
let changedFiles = compiler.modifiedFiles ? Array.from(compiler.modifiedFiles) : null, fileInfo = function(changedFiles, removedFiles, root) {
|
|
1000
|
-
if (!
|
|
1001
|
-
if (
|
|
994
|
+
if (!changedFiles?.length && !removedFiles?.length) return null;
|
|
995
|
+
if (changedFiles?.length && removedFiles?.length) {
|
|
1002
996
|
let changedInfo = formatFileList(changedFiles, root), removedInfo = formatFileList(removedFiles, root);
|
|
1003
997
|
return `${changedInfo}, removed ${removedInfo}`;
|
|
1004
998
|
}
|
|
1005
|
-
return
|
|
999
|
+
return changedFiles?.length ? formatFileList(changedFiles, root) : removedFiles?.length ? `removed ${formatFileList(removedFiles, root)}` : null;
|
|
1006
1000
|
}(changedFiles, compiler.removedFiles ? Array.from(compiler.removedFiles) : null, root);
|
|
1007
1001
|
if (!fileInfo) return;
|
|
1008
1002
|
if (fileInfo === lastFileInfo ? sameCount++ : (lastFileInfo = fileInfo, sameCount = 1), isDebug()) {
|
|
@@ -1010,7 +1004,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1010
1004
|
let nodeModulesStats, nodeModulesPath;
|
|
1011
1005
|
Object.entries((modules = stats.compilation.modules, root1 = root, nodeModulesStats = {}, nodeModulesPath = external_node_path_default().resolve(root1, 'node_modules'), modules.forEach((module)=>{
|
|
1012
1006
|
let { resource } = module;
|
|
1013
|
-
if (
|
|
1007
|
+
if (resource?.includes(nodeModulesPath)) {
|
|
1014
1008
|
let packageName, pathParts = external_node_path_default().relative(nodeModulesPath, resource).split(external_node_path_namespaceObject.sep);
|
|
1015
1009
|
(packageName = '.pnpm' === pathParts[0] && pathParts.length >= 4 ? pathParts[3].startsWith('@') ? `${pathParts[3]}/${pathParts[4]}` : pathParts[3] : pathParts[0].startsWith('@') ? `${pathParts[0]}/${pathParts[1]}` : pathParts[0]) && (nodeModulesStats[packageName] = (nodeModulesStats[packageName] || 0) + 1);
|
|
1016
1010
|
}
|
|
@@ -1054,9 +1048,8 @@ for(var __webpack_i__ in (()=>{
|
|
|
1054
1048
|
}
|
|
1055
1049
|
}
|
|
1056
1050
|
async function applyTypeCheckConfig({ config, unpackConfig }) {
|
|
1057
|
-
var _config_plugins;
|
|
1058
1051
|
let { TsCheckerRspackPlugin } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "ts-checker-rspack-plugin")), tsconfigPath = external_node_path_default().resolve(unpackConfig.root, 'tsconfig.json');
|
|
1059
|
-
return
|
|
1052
|
+
return config.plugins?.push(new TsCheckerRspackPlugin({
|
|
1060
1053
|
typescript: {
|
|
1061
1054
|
mode: 'readonly',
|
|
1062
1055
|
memoryLimit: 8192,
|
|
@@ -1074,7 +1067,8 @@ for(var __webpack_i__ in (()=>{
|
|
|
1074
1067
|
},
|
|
1075
1068
|
logger: {
|
|
1076
1069
|
log (message) {
|
|
1077
|
-
|
|
1070
|
+
let count = +(/(\d+) errors?/.exec(message)?.[1] || 0);
|
|
1071
|
+
count > 0 && console.log(`Found ${colors.red(colors.bold(`${count} ${1 === count ? 'error' : 'errors'}`))}`);
|
|
1078
1072
|
},
|
|
1079
1073
|
error (message) {
|
|
1080
1074
|
message.includes('RpcExitError') || message.includes('out of memory') || console.log(message.replace(/ERROR/g, 'Type Error'));
|
|
@@ -1083,7 +1077,6 @@ for(var __webpack_i__ in (()=>{
|
|
|
1083
1077
|
})), config;
|
|
1084
1078
|
}
|
|
1085
1079
|
async function getBundlerConfig(originalUnpackConfig) {
|
|
1086
|
-
var _unpackConfig_build, _unpackConfig_build1, _unpackConfig_build2, _unpackConfig_build3, _unpackConfig_build4, _unpackConfig_build5, _unpackConfig_build6, _unpackConfig_html, _unpackConfig_html1, _unpackConfig_html2, _unpackConfig_html3, _unpackConfig_html4, _unpackConfig_html5, _unpackConfig_html6, _unpackConfig_html7, _unpackConfig_performance, _unpackConfig_build7, _unpackConfig_resolve, _unpackConfig_resolve1, _unpackConfig_dev, _unpackConfig_build8, _unpackConfig_experiments, _unpackConfig_build9, _unpackConfig_dev1, _unpackConfig_performance1;
|
|
1087
1080
|
let circularCount, { plugins, bundlerConfig, ...rest } = originalUnpackConfig;
|
|
1088
1081
|
for (let plugin of getNormalizedPluginsByHook('config', plugins))rest = await plugin.config(rest, {
|
|
1089
1082
|
...originalUnpackConfig._context,
|
|
@@ -1093,7 +1086,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1093
1086
|
...rest,
|
|
1094
1087
|
plugins,
|
|
1095
1088
|
bundlerConfig
|
|
1096
|
-
}, tsconfigPath = external_node_path_default().resolve(unpackConfig.root, 'tsconfig.json'), isTs = external_node_fs_default().existsSync(tsconfigPath), minifyOptions = isPlainObject(
|
|
1089
|
+
}, tsconfigPath = external_node_path_default().resolve(unpackConfig.root, 'tsconfig.json'), isTs = external_node_fs_default().existsSync(tsconfigPath), minifyOptions = isPlainObject(unpackConfig.build?.minify) ? unpackConfig.build?.minify : {}, ProgressPlugin = unpackConfig.build?.progressBar ? ProgressRspackPlugin : ProgressLiteRspackPlugin, { publicVars, filePaths: envFilePaths } = function({ cwd = process.cwd(), mode = getNodeEnv(), prefixes = [
|
|
1097
1090
|
'PUBLIC_'
|
|
1098
1091
|
], processEnv = process.env } = {}) {
|
|
1099
1092
|
if ('local' === mode) throw Error(`${colors.yellow('local')} cannot be used as a value for env mode, because ${colors.yellow('.env.local')} represents a temporary local file. Please use another value.`);
|
|
@@ -1151,23 +1144,23 @@ for(var __webpack_i__ in (()=>{
|
|
|
1151
1144
|
path: external_node_path_default().resolve(unpackConfig.root, unpackConfig.build.outDir),
|
|
1152
1145
|
filename: getOutputFilename({
|
|
1153
1146
|
type: 'js',
|
|
1154
|
-
hash:
|
|
1147
|
+
hash: unpackConfig.build?.filenameHash
|
|
1155
1148
|
}),
|
|
1156
1149
|
chunkFilename: getOutputFilename({
|
|
1157
1150
|
type: 'js',
|
|
1158
|
-
hash:
|
|
1151
|
+
hash: unpackConfig.build?.filenameHash,
|
|
1159
1152
|
async: !0
|
|
1160
1153
|
}),
|
|
1161
1154
|
crossOriginLoading: 'anonymous',
|
|
1162
1155
|
pathinfo: !1,
|
|
1163
|
-
publicPath:
|
|
1156
|
+
publicPath: unpackConfig.build?.publicPath,
|
|
1164
1157
|
webassemblyModuleFilename: 'js/async/[hash].module.wasm',
|
|
1165
1158
|
assetModuleFilename: 'assets/[name].[contenthash:8][ext]'
|
|
1166
1159
|
},
|
|
1167
1160
|
infrastructureLogging: {
|
|
1168
1161
|
level: 'error'
|
|
1169
1162
|
},
|
|
1170
|
-
devtool:
|
|
1163
|
+
devtool: unpackConfig.build?.sourceMap,
|
|
1171
1164
|
module: {
|
|
1172
1165
|
rules: [
|
|
1173
1166
|
{
|
|
@@ -1198,26 +1191,26 @@ for(var __webpack_i__ in (()=>{
|
|
|
1198
1191
|
...unpackConfig.define
|
|
1199
1192
|
}),
|
|
1200
1193
|
!unpackConfig.mpa && new core_namespaceObject.rspack.HtmlRspackPlugin({
|
|
1201
|
-
template:
|
|
1202
|
-
templateContent:
|
|
1194
|
+
template: unpackConfig.html?.template || void 0,
|
|
1195
|
+
templateContent: unpackConfig.html?.templateContent || (unpackConfig.html?.template ? void 0 : TEMPLATE_CONTENT),
|
|
1203
1196
|
templateParameters: {
|
|
1204
1197
|
mountId: unpackConfig.html.mountId,
|
|
1205
|
-
title: isFunction(
|
|
1198
|
+
title: isFunction(unpackConfig.html?.title) ? unpackConfig.html?.title({
|
|
1206
1199
|
entryName: 'index'
|
|
1207
|
-
}) :
|
|
1208
|
-
headTag:
|
|
1209
|
-
...
|
|
1200
|
+
}) : unpackConfig.html?.title || '',
|
|
1201
|
+
headTag: unpackConfig.html?.headTag || '',
|
|
1202
|
+
...unpackConfig.html?.templateParameters
|
|
1210
1203
|
},
|
|
1211
1204
|
minify: !1,
|
|
1212
1205
|
chunks: [
|
|
1213
1206
|
'main'
|
|
1214
1207
|
]
|
|
1215
1208
|
}),
|
|
1216
|
-
|
|
1209
|
+
unpackConfig.performance?.removeMomentLocale && new core_namespaceObject.rspack.IgnorePlugin({
|
|
1217
1210
|
resourceRegExp: /^\.\/locale$/,
|
|
1218
1211
|
contextRegExp: /moment$/
|
|
1219
1212
|
}),
|
|
1220
|
-
|
|
1213
|
+
unpackConfig.build?.copy && new core_namespaceObject.rspack.CopyRspackPlugin({
|
|
1221
1214
|
patterns: unpackConfig.build.copy
|
|
1222
1215
|
}),
|
|
1223
1216
|
new ProgressPlugin(),
|
|
@@ -1265,7 +1258,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1265
1258
|
tsConfig: isTs ? tsconfigPath : void 0,
|
|
1266
1259
|
alias: {
|
|
1267
1260
|
'@': external_node_path_default().resolve(unpackConfig.root, 'src'),
|
|
1268
|
-
...
|
|
1261
|
+
...unpackConfig.resolve?.alias
|
|
1269
1262
|
},
|
|
1270
1263
|
extensionAlias: {
|
|
1271
1264
|
'.js': [
|
|
@@ -1285,21 +1278,20 @@ for(var __webpack_i__ in (()=>{
|
|
|
1285
1278
|
'.js',
|
|
1286
1279
|
'.wasm',
|
|
1287
1280
|
'.json',
|
|
1288
|
-
...
|
|
1281
|
+
...unpackConfig.resolve?.extensions || []
|
|
1289
1282
|
]
|
|
1290
1283
|
},
|
|
1291
|
-
lazyCompilation:
|
|
1284
|
+
lazyCompilation: unpackConfig.dev?.lazyCompilation && utils_isDevServer() && {
|
|
1292
1285
|
imports: !0,
|
|
1293
1286
|
entries: !!unpackConfig.mpa
|
|
1294
1287
|
},
|
|
1295
1288
|
experiments: {
|
|
1296
1289
|
css: !1,
|
|
1297
|
-
asyncWebAssembly: !0
|
|
1298
|
-
lazyBarrel: !0
|
|
1290
|
+
asyncWebAssembly: !0
|
|
1299
1291
|
},
|
|
1300
1292
|
optimization: {
|
|
1301
1293
|
moduleIds: isDev() ? 'named' : 'deterministic',
|
|
1302
|
-
minimize: !!
|
|
1294
|
+
minimize: !!unpackConfig.build?.minify,
|
|
1303
1295
|
minimizer: [
|
|
1304
1296
|
new JsMinifyPlugin(mergeConfig({
|
|
1305
1297
|
compress: {
|
|
@@ -1319,9 +1311,9 @@ for(var __webpack_i__ in (()=>{
|
|
|
1319
1311
|
};
|
|
1320
1312
|
for (let plugin of (config = (({ config, unpackConfig })=>{
|
|
1321
1313
|
let { chunkSplit } = unpackConfig.performance || {};
|
|
1322
|
-
if (
|
|
1314
|
+
if (chunkSplit?.strategy) {
|
|
1323
1315
|
let forceSplittingGroups = {};
|
|
1324
|
-
|
|
1316
|
+
chunkSplit?.forceSplitting && (forceSplittingGroups = function(forceSplitting, strategy) {
|
|
1325
1317
|
let cacheGroups = {};
|
|
1326
1318
|
for (let [key, regexp] of Array.isArray(forceSplitting) ? forceSplitting.map((regexp, index)=>[
|
|
1327
1319
|
`force-split-${index}`,
|
|
@@ -1347,26 +1339,25 @@ for(var __webpack_i__ in (()=>{
|
|
|
1347
1339
|
}
|
|
1348
1340
|
return config;
|
|
1349
1341
|
})({
|
|
1350
|
-
config: config =
|
|
1351
|
-
var _unpackConfig_build, _unpackConfig_build1, _unpackConfig_css, _unpackConfig_css1;
|
|
1342
|
+
config: config = unpackConfig.experiments?.css ? function({ config, unpackConfig }) {
|
|
1352
1343
|
config.output.cssFilename = getOutputFilename({
|
|
1353
1344
|
type: 'css',
|
|
1354
|
-
hash:
|
|
1345
|
+
hash: unpackConfig.build?.filenameHash
|
|
1355
1346
|
}), config.output.cssChunkFilename = getOutputFilename({
|
|
1356
1347
|
type: 'css',
|
|
1357
|
-
hash:
|
|
1348
|
+
hash: unpackConfig.build?.filenameHash,
|
|
1358
1349
|
async: !0
|
|
1359
1350
|
}), setValueByPath(config, [
|
|
1360
1351
|
'experiments',
|
|
1361
1352
|
'css'
|
|
1362
1353
|
], !0);
|
|
1363
|
-
let sourceMap =
|
|
1354
|
+
let sourceMap = unpackConfig.css?.sourceMap, modules = unpackConfig.css?.modules;
|
|
1364
1355
|
isPlainObject(modules) || !1 === modules || (modules = {}), !1 !== modules && !1 !== modules.auto && (setValueByPath(config, [
|
|
1365
1356
|
'module',
|
|
1366
1357
|
'parser',
|
|
1367
1358
|
'css/module'
|
|
1368
1359
|
], {
|
|
1369
|
-
namedExports:
|
|
1360
|
+
namedExports: !1
|
|
1370
1361
|
}), setValueByPath(config, [
|
|
1371
1362
|
'module',
|
|
1372
1363
|
'generator',
|
|
@@ -1383,42 +1374,31 @@ for(var __webpack_i__ in (()=>{
|
|
|
1383
1374
|
use,
|
|
1384
1375
|
type: 'css/module'
|
|
1385
1376
|
};
|
|
1386
|
-
}, getThreadLoader = ()=>{
|
|
1387
|
-
var _unpackConfig_build;
|
|
1388
|
-
return (null == (_unpackConfig_build = unpackConfig.build) ? void 0 : _unpackConfig_build.parallel) && isProd() && {
|
|
1377
|
+
}, getThreadLoader = ()=>unpackConfig.build?.parallel && isProd() && {
|
|
1389
1378
|
loader: require.resolve('thread-loader'),
|
|
1390
1379
|
options: THREAD_OPTIONS
|
|
1391
|
-
}
|
|
1392
|
-
}, getLessLoader = ()=>{
|
|
1393
|
-
var _unpackConfig_css;
|
|
1394
|
-
return {
|
|
1380
|
+
}, getLessLoader = ()=>({
|
|
1395
1381
|
loader: getCompiledPkgPath('less-loader'),
|
|
1396
1382
|
options: {
|
|
1397
1383
|
lessOptions: mergeConfig({
|
|
1398
1384
|
javascriptEnabled: !0
|
|
1399
|
-
},
|
|
1385
|
+
}, unpackConfig.css?.less || {}),
|
|
1400
1386
|
implementation: getUserDepPath(unpackConfig.root, 'less'),
|
|
1401
1387
|
sourceMap
|
|
1402
1388
|
}
|
|
1403
|
-
}
|
|
1404
|
-
}, getCssLoader = ()=>{
|
|
1405
|
-
var _unpackConfig_css, _unpackConfig_css1, _unpackConfig_css2;
|
|
1406
|
-
return (null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.transformer) === 'lightningcss' ? {
|
|
1389
|
+
}), getCssLoader = ()=>unpackConfig.css?.transformer === 'lightningcss' ? {
|
|
1407
1390
|
loader: 'builtin:lightningcss-loader',
|
|
1408
1391
|
options: {
|
|
1409
1392
|
targets: esVersionToBrowserslist(unpackConfig.build.target),
|
|
1410
|
-
...
|
|
1393
|
+
...unpackConfig.css?.lightningcss
|
|
1411
1394
|
}
|
|
1412
1395
|
} : {
|
|
1413
1396
|
loader: getCompiledPkgPath('postcss-loader'),
|
|
1414
1397
|
options: {
|
|
1415
|
-
postcssOptions:
|
|
1398
|
+
postcssOptions: unpackConfig.css?.postcss,
|
|
1416
1399
|
sourceMap
|
|
1417
1400
|
}
|
|
1418
|
-
}
|
|
1419
|
-
}, getSassLoader = ()=>{
|
|
1420
|
-
var _unpackConfig_css;
|
|
1421
|
-
return {
|
|
1401
|
+
}, getSassLoader = ()=>({
|
|
1422
1402
|
loader: getCompiledPkgPath('sass-loader'),
|
|
1423
1403
|
options: {
|
|
1424
1404
|
api: 'modern-compiler',
|
|
@@ -1426,11 +1406,10 @@ for(var __webpack_i__ in (()=>{
|
|
|
1426
1406
|
'sass-embedded',
|
|
1427
1407
|
'sass'
|
|
1428
1408
|
]),
|
|
1429
|
-
sassOptions:
|
|
1409
|
+
sassOptions: unpackConfig.css?.sass,
|
|
1430
1410
|
sourceMap
|
|
1431
1411
|
}
|
|
1432
|
-
};
|
|
1433
|
-
};
|
|
1412
|
+
});
|
|
1434
1413
|
return config.module.rules.push({
|
|
1435
1414
|
test: /\.css$/i,
|
|
1436
1415
|
oneOf: [
|
|
@@ -1489,8 +1468,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1489
1468
|
config,
|
|
1490
1469
|
unpackConfig
|
|
1491
1470
|
}) : function({ config, unpackConfig }) {
|
|
1492
|
-
|
|
1493
|
-
let sourceMap = null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.sourceMap, modules = null == (_unpackConfig_css1 = unpackConfig.css) ? void 0 : _unpackConfig_css1.modules;
|
|
1471
|
+
let sourceMap = unpackConfig.css?.sourceMap, modules = unpackConfig.css?.modules;
|
|
1494
1472
|
isPlainObject(modules) || !1 === modules || (modules = {});
|
|
1495
1473
|
let getCommonRules = ({ importLoaders })=>[
|
|
1496
1474
|
utils_isDevServer() ? {
|
|
@@ -1519,7 +1497,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1519
1497
|
})(),
|
|
1520
1498
|
localIdentName: !1 !== modules && (modules.localIdentName || CSS_MODULES_LOCAL_IDENT_NAME),
|
|
1521
1499
|
exportLocalsConvention: EXPORT_LOCALS_CONVENTION,
|
|
1522
|
-
namedExport:
|
|
1500
|
+
namedExport: !1
|
|
1523
1501
|
},
|
|
1524
1502
|
sourceMap
|
|
1525
1503
|
}
|
|
@@ -1528,31 +1506,28 @@ for(var __webpack_i__ in (()=>{
|
|
|
1528
1506
|
utils_isDevServer() || config.plugins.push(new core_namespaceObject.rspack.CssExtractRspackPlugin({
|
|
1529
1507
|
filename: getOutputFilename({
|
|
1530
1508
|
type: 'css',
|
|
1531
|
-
hash:
|
|
1509
|
+
hash: unpackConfig.build?.filenameHash
|
|
1532
1510
|
}),
|
|
1533
1511
|
chunkFilename: getOutputFilename({
|
|
1534
1512
|
type: 'css',
|
|
1535
|
-
hash:
|
|
1513
|
+
hash: unpackConfig.build?.filenameHash,
|
|
1536
1514
|
async: !0
|
|
1537
1515
|
}),
|
|
1538
1516
|
ignoreOrder: !0
|
|
1539
1517
|
}));
|
|
1540
|
-
let getCssLoader = ()=>{
|
|
1541
|
-
var _unpackConfig_css, _unpackConfig_css1, _unpackConfig_css2;
|
|
1542
|
-
return (null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.transformer) === 'lightningcss' ? {
|
|
1518
|
+
let getCssLoader = ()=>unpackConfig.css?.transformer === 'lightningcss' ? {
|
|
1543
1519
|
loader: 'builtin:lightningcss-loader',
|
|
1544
1520
|
options: {
|
|
1545
1521
|
targets: esVersionToBrowserslist(unpackConfig.build.target),
|
|
1546
|
-
...
|
|
1522
|
+
...unpackConfig.css?.lightningcss
|
|
1547
1523
|
}
|
|
1548
1524
|
} : {
|
|
1549
1525
|
loader: getCompiledPkgPath('postcss-loader'),
|
|
1550
1526
|
options: {
|
|
1551
|
-
postcssOptions:
|
|
1527
|
+
postcssOptions: unpackConfig.css?.postcss,
|
|
1552
1528
|
sourceMap
|
|
1553
1529
|
}
|
|
1554
1530
|
};
|
|
1555
|
-
};
|
|
1556
1531
|
return config.module.rules.push({
|
|
1557
1532
|
test: /\.less$/i,
|
|
1558
1533
|
use: [
|
|
@@ -1560,7 +1535,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1560
1535
|
importLoaders: 2
|
|
1561
1536
|
}),
|
|
1562
1537
|
getCssLoader(),
|
|
1563
|
-
|
|
1538
|
+
unpackConfig.build?.parallel && isProd() && {
|
|
1564
1539
|
loader: require.resolve('thread-loader'),
|
|
1565
1540
|
options: THREAD_OPTIONS
|
|
1566
1541
|
},
|
|
@@ -1569,7 +1544,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1569
1544
|
options: {
|
|
1570
1545
|
lessOptions: mergeConfig({
|
|
1571
1546
|
javascriptEnabled: !0
|
|
1572
|
-
},
|
|
1547
|
+
}, unpackConfig.css?.less || {}),
|
|
1573
1548
|
implementation: getUserDepPath(unpackConfig.root, 'less'),
|
|
1574
1549
|
sourceMap
|
|
1575
1550
|
}
|
|
@@ -1598,7 +1573,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1598
1573
|
'sass-embedded',
|
|
1599
1574
|
'sass'
|
|
1600
1575
|
]),
|
|
1601
|
-
sassOptions:
|
|
1576
|
+
sassOptions: unpackConfig.css?.sass,
|
|
1602
1577
|
sourceMap
|
|
1603
1578
|
}
|
|
1604
1579
|
}
|
|
@@ -1609,11 +1584,11 @@ for(var __webpack_i__ in (()=>{
|
|
|
1609
1584
|
unpackConfig
|
|
1610
1585
|
}),
|
|
1611
1586
|
unpackConfig
|
|
1612
|
-
}),
|
|
1587
|
+
}), unpackConfig.build?.cache && !(utils_isDevServer() && unpackConfig.dev?.lazyCompilation) && (config = await applyCacheConfig({
|
|
1613
1588
|
config,
|
|
1614
1589
|
unpackConfig,
|
|
1615
1590
|
envFilePaths
|
|
1616
|
-
})),
|
|
1591
|
+
})), unpackConfig.performance?.bundleAnalyze && isProd() && (config = await applyBundleAnalyzeConfig({
|
|
1617
1592
|
config
|
|
1618
1593
|
})), unpackConfig.typeCheck && isDev() && isTs && (config = await applyTypeCheckConfig({
|
|
1619
1594
|
config,
|
|
@@ -1633,7 +1608,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1633
1608
|
console.error(err.stack || err), err.details && console.error(err.details);
|
|
1634
1609
|
return;
|
|
1635
1610
|
}
|
|
1636
|
-
|
|
1611
|
+
stats?.hasErrors() && console.log(stats.toString({
|
|
1637
1612
|
colors: !0,
|
|
1638
1613
|
preset: 'errors-only'
|
|
1639
1614
|
})), isWatch() || compiler.close(()=>{});
|
|
@@ -1709,13 +1684,13 @@ for(var __webpack_i__ in (()=>{
|
|
|
1709
1684
|
'react-dom': 'ReactDOM',
|
|
1710
1685
|
'react-router-dom': 'ReactRouterDOM'
|
|
1711
1686
|
})[pkgName] || pkgName, getExternalValue = (pkgName)=>`window ${getExternalLibraryName(pkgName)}`, prebundleDeps = async ({ unpackConfig })=>{
|
|
1712
|
-
var
|
|
1687
|
+
var failedDepsCachePath, externals, failedDepsCachePath1, cache;
|
|
1713
1688
|
let existExternals, cacheDir, count = {
|
|
1714
1689
|
total: 0,
|
|
1715
1690
|
bundled: 0
|
|
1716
1691
|
}, failedDeps = [], root = unpackConfig.root, failedDepsCachePath2 = external_node_path_default().resolve(root, TEMP_DIR, 'failed-deps.json'), failedCache = (failedDepsCachePath = failedDepsCachePath2, external_node_fs_default().existsSync(failedDepsCachePath) ? JSON.parse(external_node_fs_default().readFileSync(failedDepsCachePath, 'utf-8')) : {}), updateProgress = ()=>{
|
|
1717
1692
|
logUpdate(`${colors.magenta('»')} optimizing dependencies (${count.bundled}/${count.total})`), count.total === count.bundled + failedDeps.length && console.log();
|
|
1718
|
-
}, userOptions = isPlainObject(
|
|
1693
|
+
}, userOptions = isPlainObject(unpackConfig.dev?.prebundle) ? unpackConfig.dev.prebundle : {}, ignoreCSSDeps = userOptions.ignoreCSS || [], packageJson = JSON.parse(external_node_fs_default().readFileSync(external_node_path_default().resolve(root, 'package.json'), 'utf-8')), excludeDeps = [
|
|
1719
1694
|
...(externals = unpackConfig.externals, existExternals = new Set(), Array.isArray(externals) ? externals.forEach((item)=>{
|
|
1720
1695
|
isPlainObject(item) && Object.keys(item).forEach((key)=>{
|
|
1721
1696
|
existExternals.add(key);
|
|
@@ -1864,7 +1839,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1864
1839
|
});
|
|
1865
1840
|
compiler.run((_, stats)=>{
|
|
1866
1841
|
let isFailed = !1;
|
|
1867
|
-
|
|
1842
|
+
stats?.hasErrors() ? (isFailed = !0, failedDeps.push(name), failedCache[name] = version, removeDir(outDir)) : count.bundled++, updateProgress(), compiler.close(()=>{
|
|
1868
1843
|
resolve(isFailed ? void 0 : getResult());
|
|
1869
1844
|
});
|
|
1870
1845
|
});
|
|
@@ -1907,8 +1882,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1907
1882
|
}, unpackConfig.plugins.push({
|
|
1908
1883
|
name: 'unpack:prebundle',
|
|
1909
1884
|
config: (config)=>{
|
|
1910
|
-
|
|
1911
|
-
let originalHeadTag = (null == (_config_html = config.html) ? void 0 : _config_html.headTag) || '', sortedPreTags = preJsAssets.sort((a, b)=>a.order - b.order).map((item)=>item.path).map((item)=>`<script defer src="${item}"></script>`);
|
|
1885
|
+
let originalHeadTag = config.html?.headTag || '', sortedPreTags = preJsAssets.sort((a, b)=>a.order - b.order).map((item)=>item.path).map((item)=>`<script defer src="${item}"></script>`);
|
|
1912
1886
|
return setValueByPath(config, [
|
|
1913
1887
|
'html',
|
|
1914
1888
|
'headTag'
|
|
@@ -1927,12 +1901,11 @@ for(var __webpack_i__ in (()=>{
|
|
|
1927
1901
|
}), unpackConfig;
|
|
1928
1902
|
};
|
|
1929
1903
|
async function unpackDev(originalUnpackConfig) {
|
|
1930
|
-
var _unpackConfig_dev, _unpackConfig_server, _unpackConfig_server1, _unpackConfig_dev1, _unpackConfig_server2, _unpackConfig_server3;
|
|
1931
1904
|
let unpackConfig = originalUnpackConfig;
|
|
1932
|
-
|
|
1905
|
+
unpackConfig.dev?.prebundle && (unpackConfig = await prebundleDeps({
|
|
1933
1906
|
unpackConfig
|
|
1934
1907
|
}));
|
|
1935
|
-
let config = await getBundlerConfig(unpackConfig), compiler = (0, core_namespaceObject.rspack)(config), port = await getPort(
|
|
1908
|
+
let config = await getBundlerConfig(unpackConfig), compiler = (0, core_namespaceObject.rspack)(config), port = await getPort(unpackConfig.server?.port), proxyConfig = unpackConfig.server?.proxy;
|
|
1936
1909
|
isPlainObject(proxyConfig) && (proxyConfig = Object.entries(proxyConfig).map(([contextStr, target])=>{
|
|
1937
1910
|
let baseConfig = {
|
|
1938
1911
|
context: contextStr.split(','),
|
|
@@ -1955,16 +1928,15 @@ for(var __webpack_i__ in (()=>{
|
|
|
1955
1928
|
},
|
|
1956
1929
|
proxy: proxyConfig,
|
|
1957
1930
|
devMiddleware: {
|
|
1958
|
-
writeToDisk:
|
|
1931
|
+
writeToDisk: unpackConfig.dev?.writeToDisk
|
|
1959
1932
|
}
|
|
1960
1933
|
};
|
|
1961
1934
|
devServerOptions.setupMiddlewares = (middlewares)=>(middlewares.unshift((req, _, next)=>{
|
|
1962
|
-
|
|
1963
|
-
(null == (_req_headers_accept = req.headers.accept) ? void 0 : _req_headers_accept.includes('html')) && (req.url = '/index.html'), next();
|
|
1935
|
+
req.headers.accept?.includes('html') && (req.url = '/index.html'), next();
|
|
1964
1936
|
}), middlewares.unshift(core_namespaceObject.experiments.lazyCompilationMiddleware(compiler)), middlewares);
|
|
1965
1937
|
let server = new dev_server_namespaceObject.RspackDevServer(devServerOptions, compiler);
|
|
1966
|
-
await server.start(), logger_logger.greet(` ${colors.green(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v3.3.
|
|
1967
|
-
let open =
|
|
1938
|
+
await server.start(), logger_logger.greet(` ${colors.green(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v3.3.5`)} ${colors.dim('ready in')} ${colors.bold(Math.ceil(performance.now() - global.__unpack_start_time))} ms\n`), printAddressUrls(port, unpackConfig.server?.host), addRestartCleaner(()=>server.stop(), ()=>new Promise((resolve)=>compiler.close(()=>resolve())));
|
|
1939
|
+
let open = unpackConfig.server?.open, url = isString(open) ? open : `http://localhost:${port}`;
|
|
1968
1940
|
open && openBrowser(url), setupCliShortcuts({
|
|
1969
1941
|
openPage: async ()=>{
|
|
1970
1942
|
await openBrowser(url);
|
|
@@ -1973,8 +1945,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1973
1945
|
await cleanUpBeforeRestart(), process.exit(0);
|
|
1974
1946
|
},
|
|
1975
1947
|
printUrls: ()=>{
|
|
1976
|
-
|
|
1977
|
-
printAddressUrls(port, null == (_unpackConfig_server = unpackConfig.server) ? void 0 : _unpackConfig_server.host);
|
|
1948
|
+
printAddressUrls(port, unpackConfig.server?.host);
|
|
1978
1949
|
},
|
|
1979
1950
|
restartServer: async ()=>{
|
|
1980
1951
|
logger_logger.clear(), await cleanUpBeforeRestart(), createUnpack({
|
|
@@ -2037,7 +2008,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
2037
2008
|
...mergeConfig(defaultConfig, config),
|
|
2038
2009
|
_context: {
|
|
2039
2010
|
callerName,
|
|
2040
|
-
version: "3.3.
|
|
2011
|
+
version: "3.3.5"
|
|
2041
2012
|
}
|
|
2042
2013
|
};
|
|
2043
2014
|
};
|
|
@@ -2045,7 +2016,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
2045
2016
|
build: async ({ watch } = {})=>{
|
|
2046
2017
|
setNodeEnv(watch ? 'development' : 'production');
|
|
2047
2018
|
let config = resolveConfig();
|
|
2048
|
-
console.log(colors.rainbow(`${callerName} v3.3.
|
|
2019
|
+
console.log(colors.rainbow(`${callerName} v3.3.5`), colors.green(`building for ${getNodeEnv()}...`)), await unpackBuild(config);
|
|
2049
2020
|
},
|
|
2050
2021
|
dev: async ()=>{
|
|
2051
2022
|
global.__unpack_start_time = performance.now(), setNodeEnv('development'), setDevServer(!0);
|