@unpackjs/core 3.3.4 → 3.3.6
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 +164 -164
- 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 +190 -249
- package/dist/index.js +135 -160
- package/dist-types/bundler-config/detectCircular.d.ts +6 -0
- package/dist-types/bundler-config/detectCircular.d.ts.map +1 -0
- 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 +8 -8
package/dist/index.cjs
CHANGED
|
@@ -6,41 +6,6 @@ var __webpack_modules__ = {
|
|
|
6
6
|
},
|
|
7
7
|
"compiled/webpack-merge": function(module) {
|
|
8
8
|
module.exports = require("../compiled/webpack-merge/index.js");
|
|
9
|
-
},
|
|
10
|
-
"compiled/webpack-bundle-analyzer": function(module) {
|
|
11
|
-
module.exports = import("../compiled/webpack-bundle-analyzer/index.js").then(function(module) {
|
|
12
|
-
return module;
|
|
13
|
-
});
|
|
14
|
-
},
|
|
15
|
-
cors: function(module) {
|
|
16
|
-
module.exports = import("cors").then(function(module) {
|
|
17
|
-
return module;
|
|
18
|
-
});
|
|
19
|
-
},
|
|
20
|
-
express: function(module) {
|
|
21
|
-
module.exports = import("express").then(function(module) {
|
|
22
|
-
return module;
|
|
23
|
-
});
|
|
24
|
-
},
|
|
25
|
-
jiti: function(module) {
|
|
26
|
-
module.exports = import("jiti").then(function(module) {
|
|
27
|
-
return module;
|
|
28
|
-
});
|
|
29
|
-
},
|
|
30
|
-
"node:readline": function(module) {
|
|
31
|
-
module.exports = import("node:readline").then(function(module) {
|
|
32
|
-
return module;
|
|
33
|
-
});
|
|
34
|
-
},
|
|
35
|
-
"oxc-minify": function(module) {
|
|
36
|
-
module.exports = import("oxc-minify").then(function(module) {
|
|
37
|
-
return module;
|
|
38
|
-
});
|
|
39
|
-
},
|
|
40
|
-
"ts-checker-rspack-plugin": function(module) {
|
|
41
|
-
module.exports = import("ts-checker-rspack-plugin").then(function(module) {
|
|
42
|
-
return module;
|
|
43
|
-
});
|
|
44
9
|
}
|
|
45
10
|
}, __webpack_module_cache__ = {};
|
|
46
11
|
function __webpack_require__(moduleId) {
|
|
@@ -72,74 +37,74 @@ var __webpack_exports__ = {};
|
|
|
72
37
|
for(var __webpack_i__ in (()=>{
|
|
73
38
|
let lastTrackTime, lastFileInfo, logger;
|
|
74
39
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
40
|
+
createChokidar: ()=>createChokidar,
|
|
41
|
+
rspack: ()=>core_namespaceObject.rspack,
|
|
42
|
+
setNodeEnv: ()=>setNodeEnv,
|
|
78
43
|
getAddressUrls: ()=>getAddressUrls,
|
|
44
|
+
LogColor: ()=>logger_LogColor,
|
|
45
|
+
getUserDepVersion: ()=>getUserDepVersion,
|
|
46
|
+
NODE_MODULES_REGEX: ()=>NODE_MODULES_REGEX,
|
|
47
|
+
PROD_DEFAULT_FILENAME: ()=>PROD_DEFAULT_FILENAME,
|
|
48
|
+
CSS_MODULES_REGEX: ()=>CSS_MODULES_REGEX,
|
|
49
|
+
isEmptyDir: ()=>isEmptyDir,
|
|
79
50
|
isDevServer: ()=>utils_isDevServer,
|
|
80
|
-
|
|
81
|
-
isFileExists: ()=>isFileExists,
|
|
82
|
-
getNodeEnv: ()=>getNodeEnv,
|
|
51
|
+
clearLine: ()=>clearLine,
|
|
83
52
|
isWatch: ()=>isWatch,
|
|
53
|
+
DEFAULT_DEV_HOST: ()=>DEFAULT_DEV_HOST,
|
|
54
|
+
isDev: ()=>isDev,
|
|
55
|
+
isRegExp: ()=>isRegExp,
|
|
56
|
+
cleanUpBeforeRestart: ()=>cleanUpBeforeRestart,
|
|
84
57
|
currentDevUnpackConfig: ()=>currentDevUnpackConfig,
|
|
85
|
-
|
|
86
|
-
isFunction: ()=>isFunction,
|
|
58
|
+
isPlainObject: ()=>isPlainObject,
|
|
87
59
|
debounce: ()=>debounce,
|
|
88
|
-
|
|
89
|
-
|
|
60
|
+
isUndefined: ()=>isUndefined,
|
|
61
|
+
trackPerformance: ()=>trackPerformance,
|
|
62
|
+
removeDir: ()=>removeDir,
|
|
63
|
+
CSS_MODULES_LOCAL_IDENT_NAME: ()=>CSS_MODULES_LOCAL_IDENT_NAME,
|
|
64
|
+
findExists: ()=>findExists,
|
|
65
|
+
mergeConfig: ()=>mergeConfig,
|
|
66
|
+
CSS_NAMED_EXPORT: ()=>!1,
|
|
67
|
+
isBoolean: ()=>isBoolean,
|
|
68
|
+
setValueByPath: ()=>setValueByPath,
|
|
69
|
+
isCSSModules: ()=>isCSSModules,
|
|
90
70
|
isNodeVersionAtLeast: ()=>isNodeVersionAtLeast,
|
|
91
|
-
|
|
71
|
+
isProd: ()=>isProd,
|
|
72
|
+
TEMPLATE_CONTENT: ()=>TEMPLATE_CONTENT,
|
|
92
73
|
getCompiledPkgPath: ()=>getCompiledPkgPath,
|
|
93
|
-
|
|
74
|
+
isObject: ()=>isObject,
|
|
94
75
|
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,
|
|
76
|
+
resolveConfigPath: ()=>resolveConfigPath,
|
|
117
77
|
getIpv4Interfaces: ()=>getIpv4Interfaces,
|
|
78
|
+
getNodeEnv: ()=>getNodeEnv,
|
|
79
|
+
getPort: ()=>getPort,
|
|
118
80
|
isCI: ()=>isCI,
|
|
119
|
-
colors: ()=>colors,
|
|
120
|
-
isEmptyDir: ()=>isEmptyDir,
|
|
121
81
|
logger: ()=>logger_logger,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
82
|
+
addRestartCleaner: ()=>addRestartCleaner,
|
|
83
|
+
colors: ()=>colors,
|
|
84
|
+
esVersionToBrowserslist: ()=>esVersionToBrowserslist,
|
|
85
|
+
isFunction: ()=>isFunction,
|
|
126
86
|
pathExists: ()=>pathExists,
|
|
127
|
-
isPlainObject: ()=>isPlainObject,
|
|
128
|
-
CSS_NAMED_EXPORT: ()=>CSS_NAMED_EXPORT,
|
|
129
87
|
DEV_DEFAULT_FILENAME: ()=>DEV_DEFAULT_FILENAME,
|
|
130
|
-
|
|
131
|
-
|
|
88
|
+
isWin: ()=>isWin,
|
|
89
|
+
prettyTime: ()=>prettyTime,
|
|
132
90
|
setupCliShortcuts: ()=>setupCliShortcuts,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
isObject: ()=>isObject,
|
|
136
|
-
trackPerformance: ()=>trackPerformance,
|
|
91
|
+
loadConfig: ()=>loadConfig,
|
|
92
|
+
THREAD_OPTIONS: ()=>THREAD_OPTIONS,
|
|
137
93
|
createUnpack: ()=>createUnpack,
|
|
94
|
+
setDevServer: ()=>setDevServer,
|
|
95
|
+
EXPORT_LOCALS_CONVENTION: ()=>EXPORT_LOCALS_CONVENTION,
|
|
96
|
+
isFileExists: ()=>isFileExists,
|
|
97
|
+
TEMP_DIR: ()=>TEMP_DIR,
|
|
98
|
+
isFileSync: ()=>isFileSync,
|
|
99
|
+
getPathInJs: ()=>getPathInJs,
|
|
138
100
|
getTime: ()=>getTime,
|
|
139
|
-
|
|
140
|
-
isCSSModules: ()=>isCSSModules,
|
|
101
|
+
getValueByPath: ()=>getValueByPath,
|
|
141
102
|
isDebug: ()=>isDebug,
|
|
142
|
-
|
|
103
|
+
launchEditor: ()=>launchEditor,
|
|
104
|
+
logUpdate: ()=>logUpdate,
|
|
105
|
+
defineConfig: ()=>defineConfig,
|
|
106
|
+
getUserDepPath: ()=>getUserDepPath,
|
|
107
|
+
isString: ()=>isString
|
|
143
108
|
});
|
|
144
109
|
let core_namespaceObject = require("@rspack/core"), external_picocolors_namespaceObject = require("picocolors"), colors = {
|
|
145
110
|
...__webpack_require__.n(external_picocolors_namespaceObject)(),
|
|
@@ -178,7 +143,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
178
143
|
jsAsync: 'js/async/[name].[contenthash:8].js',
|
|
179
144
|
css: 'css/[name].[contenthash:8].css',
|
|
180
145
|
cssAsync: 'css/async/[name].[contenthash:8].css'
|
|
181
|
-
}, EXPORT_LOCALS_CONVENTION = 'camel-case-only', TEMP_DIR = 'node_modules/.unpack', NODE_MODULES_REGEX = /[\\/]node_modules[\\/]/,
|
|
146
|
+
}, EXPORT_LOCALS_CONVENTION = 'camel-case-only', TEMP_DIR = 'node_modules/.unpack', NODE_MODULES_REGEX = /[\\/]node_modules[\\/]/, THREAD_OPTIONS = {
|
|
182
147
|
workers: 2
|
|
183
148
|
}, DEFAULT_DEV_HOST = '0.0.0.0', TEMPLATE_CONTENT = ({ title = '', headTag = '', mountId = '' })=>`<!DOCTYPE html>
|
|
184
149
|
<html lang="en">
|
|
@@ -415,7 +380,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
415
380
|
}
|
|
416
381
|
].filter(Boolean), colorPrefix = colors.green(colors.dim('➜'));
|
|
417
382
|
help && console.log(!0 === help ? ` ${colorPrefix} ${colors.dim('press')} ${colors.bold('h + enter')} ${colors.dim('to show help')}` : ` ${colorPrefix} ${help}`);
|
|
418
|
-
let { createInterface } = await
|
|
383
|
+
let { createInterface } = await import("node:readline"), rl = createInterface({
|
|
419
384
|
input: process.stdin
|
|
420
385
|
});
|
|
421
386
|
rl.on('line', (input)=>{
|
|
@@ -432,8 +397,8 @@ for(var __webpack_i__ in (()=>{
|
|
|
432
397
|
}
|
|
433
398
|
let external_node_url_namespaceObject = require("node:url");
|
|
434
399
|
async function loadConfig({ cliOptions, command }) {
|
|
435
|
-
'build' === command ? setNodeEnv(
|
|
436
|
-
let root =
|
|
400
|
+
'build' === command ? setNodeEnv(cliOptions?.watch ? 'development' : 'production') : (setNodeEnv('development'), setDevServer(!0));
|
|
401
|
+
let root = cliOptions?.root ? external_node_path_default().resolve(cliOptions.root) : process.cwd(), configFilePath = resolveConfigPath(root, cliOptions?.config), configExport = {};
|
|
437
402
|
if (configFilePath) {
|
|
438
403
|
if (isNodeVersionAtLeast(22, 18) || /\.(?:js|mjs|cjs)$/.test(configFilePath)) {
|
|
439
404
|
logger_logger.debug('loading config file with native loader:', colors.dim(configFilePath));
|
|
@@ -446,7 +411,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
446
411
|
} else {
|
|
447
412
|
logger_logger.debug('loading config file with jiti:', colors.dim(configFilePath));
|
|
448
413
|
try {
|
|
449
|
-
let { createJiti } = await
|
|
414
|
+
let { createJiti } = await import("jiti"), jiti = createJiti(__filename, {
|
|
450
415
|
moduleCache: !1,
|
|
451
416
|
interopDefault: !0,
|
|
452
417
|
nativeModules: [
|
|
@@ -469,18 +434,18 @@ for(var __webpack_i__ in (()=>{
|
|
|
469
434
|
if (void 0 === (configExport = await configExport(params))) throw Error('unpack config function must return a config object.');
|
|
470
435
|
}
|
|
471
436
|
}
|
|
472
|
-
return
|
|
437
|
+
return cliOptions?.port && setValueByPath(configExport, [
|
|
473
438
|
'server',
|
|
474
439
|
'port'
|
|
475
|
-
], cliOptions.port),
|
|
440
|
+
], cliOptions.port), cliOptions?.open && setValueByPath(configExport, [
|
|
476
441
|
'server',
|
|
477
442
|
'open'
|
|
478
|
-
], cliOptions.open),
|
|
443
|
+
], cliOptions.open), cliOptions?.analyze && setValueByPath(configExport, [
|
|
479
444
|
'performance',
|
|
480
445
|
'bundleAnalyze'
|
|
481
|
-
], cliOptions.analyze),
|
|
446
|
+
], cliOptions.analyze), cliOptions?.root && setValueByPath(configExport, [
|
|
482
447
|
'root'
|
|
483
|
-
], root),
|
|
448
|
+
], root), cliOptions?.host && setValueByPath(configExport, [
|
|
484
449
|
'server',
|
|
485
450
|
'host'
|
|
486
451
|
], cliOptions.host), configExport;
|
|
@@ -509,10 +474,9 @@ for(var __webpack_i__ in (()=>{
|
|
|
509
474
|
}
|
|
510
475
|
let external_dotenv_expand_namespaceObject = require("dotenv-expand"), isFileSync = (filePath)=>{
|
|
511
476
|
try {
|
|
512
|
-
|
|
513
|
-
return null == (_fs_statSync = external_node_fs_default().statSync(filePath, {
|
|
477
|
+
return external_node_fs_default().statSync(filePath, {
|
|
514
478
|
throwIfNoEntry: !1
|
|
515
|
-
})
|
|
479
|
+
})?.isFile();
|
|
516
480
|
} catch {
|
|
517
481
|
return !1;
|
|
518
482
|
}
|
|
@@ -539,14 +503,13 @@ for(var __webpack_i__ in (()=>{
|
|
|
539
503
|
}, DOTENV_LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
|
|
540
504
|
function getNormalizedPluginsByHook(hook, plugins) {
|
|
541
505
|
let pluginMap = new Map();
|
|
542
|
-
return
|
|
506
|
+
return plugins?.forEach((plugin)=>{
|
|
543
507
|
plugin[hook] && pluginMap.set(plugin.name, plugin);
|
|
544
508
|
}), Array.from(pluginMap.values());
|
|
545
509
|
}
|
|
546
510
|
async function applyBundleAnalyzeConfig({ config }) {
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
return null == (_config_plugins = config.plugins) || _config_plugins.push(new BundleAnalyzerPlugin({
|
|
511
|
+
let { default: { BundleAnalyzerPlugin } } = await import("../compiled/webpack-bundle-analyzer/index.js");
|
|
512
|
+
return config.plugins?.push(new BundleAnalyzerPlugin({
|
|
550
513
|
analyzerPort: 'auto'
|
|
551
514
|
})), config;
|
|
552
515
|
}
|
|
@@ -628,7 +591,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
628
591
|
priority: -9,
|
|
629
592
|
test: NODE_MODULES_REGEX,
|
|
630
593
|
name: (module)=>module ? function(modulePath) {
|
|
631
|
-
let handleModuleContext =
|
|
594
|
+
let handleModuleContext = modulePath?.match(MODULE_PATH_REGEX);
|
|
632
595
|
if (!handleModuleContext) return;
|
|
633
596
|
let [, scope, name] = handleModuleContext;
|
|
634
597
|
return [
|
|
@@ -734,19 +697,16 @@ for(var __webpack_i__ in (()=>{
|
|
|
734
697
|
});
|
|
735
698
|
}
|
|
736
699
|
async generateCssTypings(incremental) {
|
|
737
|
-
let cssModulesFiles = (await (0, external_tinyglobby_namespaceObject.glob)(this.globPattern)).filter((file)=>{
|
|
738
|
-
var _this_userOptions;
|
|
739
|
-
return isCSSModules({
|
|
700
|
+
let cssModulesFiles = (await (0, external_tinyglobby_namespaceObject.glob)(this.globPattern)).filter((file)=>isCSSModules({
|
|
740
701
|
resourcePath: file,
|
|
741
|
-
modules:
|
|
742
|
-
});
|
|
743
|
-
}), doTask = incremental ? generateTypingIfNecessary : writeFile;
|
|
702
|
+
modules: this.userOptions?.modules
|
|
703
|
+
})), doTask = incremental ? generateTypingIfNecessary : writeFile;
|
|
744
704
|
return Promise.all(cssModulesFiles.map((file)=>doTask(this.dtsCreator, file)));
|
|
745
705
|
}
|
|
746
706
|
constructor(options){
|
|
747
707
|
_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
708
|
camelCase: !0,
|
|
749
|
-
namedExports:
|
|
709
|
+
namedExports: !1
|
|
750
710
|
});
|
|
751
711
|
}
|
|
752
712
|
}
|
|
@@ -763,7 +723,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
763
723
|
apply(compiler) {
|
|
764
724
|
let meta = JSON.stringify({
|
|
765
725
|
name: jsMinify_PLUGIN_NAME,
|
|
766
|
-
version: "3.3.
|
|
726
|
+
version: "3.3.6",
|
|
767
727
|
options: this.minifyOptions
|
|
768
728
|
});
|
|
769
729
|
compiler.hooks.compilation.tap(jsMinify_PLUGIN_NAME, (compilation)=>{
|
|
@@ -776,7 +736,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
776
736
|
});
|
|
777
737
|
}
|
|
778
738
|
async transformAssets(compilation) {
|
|
779
|
-
let { options: { devtool } } = compilation.compiler, sourceMap = 'string' == typeof devtool && devtool.includes('source-map'), assets = compilation.getAssets().filter((asset)=>!asset.info.minimized && isJsFile.test(asset.name)), minifyFn = this.customMinify ?? (await
|
|
739
|
+
let { options: { devtool } } = compilation.compiler, sourceMap = 'string' == typeof devtool && devtool.includes('source-map'), assets = compilation.getAssets().filter((asset)=>!asset.info.minimized && isJsFile.test(asset.name)), minifyFn = this.customMinify ?? (await import("oxc-minify")).minify;
|
|
780
740
|
assets.forEach((asset)=>{
|
|
781
741
|
let { source, map } = asset.source.sourceAndMap(), { name } = asset, output = minifyFn(name, Buffer.isBuffer(source) ? source.toString() : source, {
|
|
782
742
|
sourcemap: sourceMap,
|
|
@@ -795,13 +755,12 @@ for(var __webpack_i__ in (()=>{
|
|
|
795
755
|
constructor(options = {}){
|
|
796
756
|
jsMinify_define_property(this, "minifyOptions", void 0), jsMinify_define_property(this, "customMinify", void 0);
|
|
797
757
|
const { implementation, ...minifyOptions } = options;
|
|
798
|
-
this.customMinify =
|
|
758
|
+
this.customMinify = implementation?.minify, this.minifyOptions = minifyOptions;
|
|
799
759
|
}
|
|
800
760
|
}
|
|
801
761
|
let external_node_child_process_namespaceObject = require("node:child_process");
|
|
802
762
|
class OxlintPlugin {
|
|
803
763
|
runOxlint(args) {
|
|
804
|
-
var _child_stdout, _child_stderr;
|
|
805
764
|
let child = (0, external_node_child_process_namespaceObject.spawn)('npx', [
|
|
806
765
|
'--yes',
|
|
807
766
|
...args
|
|
@@ -814,12 +773,12 @@ for(var __webpack_i__ in (()=>{
|
|
|
814
773
|
FORCE_COLOR: '1'
|
|
815
774
|
}
|
|
816
775
|
}), output = '';
|
|
817
|
-
|
|
776
|
+
child.stdout?.on('data', (data)=>{
|
|
818
777
|
output += data.toString();
|
|
819
778
|
}), child.on('exit', (code)=>{
|
|
820
779
|
let hasErrors = !output.includes('Found 0 warnings and 0 errors'), hasNoFiles = output.includes('on 0 files');
|
|
821
780
|
(hasErrors || 0 !== code) && !hasNoFiles && process.stdout.write(output);
|
|
822
|
-
}),
|
|
781
|
+
}), child.stderr?.on('data', (data)=>{
|
|
823
782
|
process.stderr.write(data);
|
|
824
783
|
});
|
|
825
784
|
}
|
|
@@ -997,12 +956,12 @@ for(var __webpack_i__ in (()=>{
|
|
|
997
956
|
}), logger_logger.ready(colors.green(`built in ${prettyTime(compileTime)}`));
|
|
998
957
|
else {
|
|
999
958
|
let changedFiles = compiler.modifiedFiles ? Array.from(compiler.modifiedFiles) : null, fileInfo = function(changedFiles, removedFiles, root) {
|
|
1000
|
-
if (!
|
|
1001
|
-
if (
|
|
959
|
+
if (!changedFiles?.length && !removedFiles?.length) return null;
|
|
960
|
+
if (changedFiles?.length && removedFiles?.length) {
|
|
1002
961
|
let changedInfo = formatFileList(changedFiles, root), removedInfo = formatFileList(removedFiles, root);
|
|
1003
962
|
return `${changedInfo}, removed ${removedInfo}`;
|
|
1004
963
|
}
|
|
1005
|
-
return
|
|
964
|
+
return changedFiles?.length ? formatFileList(changedFiles, root) : removedFiles?.length ? `removed ${formatFileList(removedFiles, root)}` : null;
|
|
1006
965
|
}(changedFiles, compiler.removedFiles ? Array.from(compiler.removedFiles) : null, root);
|
|
1007
966
|
if (!fileInfo) return;
|
|
1008
967
|
if (fileInfo === lastFileInfo ? sameCount++ : (lastFileInfo = fileInfo, sameCount = 1), isDebug()) {
|
|
@@ -1010,7 +969,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1010
969
|
let nodeModulesStats, nodeModulesPath;
|
|
1011
970
|
Object.entries((modules = stats.compilation.modules, root1 = root, nodeModulesStats = {}, nodeModulesPath = external_node_path_default().resolve(root1, 'node_modules'), modules.forEach((module)=>{
|
|
1012
971
|
let { resource } = module;
|
|
1013
|
-
if (
|
|
972
|
+
if (resource?.includes(nodeModulesPath)) {
|
|
1014
973
|
let packageName, pathParts = external_node_path_default().relative(nodeModulesPath, resource).split(external_node_path_namespaceObject.sep);
|
|
1015
974
|
(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
975
|
}
|
|
@@ -1054,9 +1013,8 @@ for(var __webpack_i__ in (()=>{
|
|
|
1054
1013
|
}
|
|
1055
1014
|
}
|
|
1056
1015
|
async function applyTypeCheckConfig({ config, unpackConfig }) {
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
return null == (_config_plugins = config.plugins) || _config_plugins.push(new TsCheckerRspackPlugin({
|
|
1016
|
+
let { TsCheckerRspackPlugin } = await import("ts-checker-rspack-plugin"), tsconfigPath = external_node_path_default().resolve(unpackConfig.root, 'tsconfig.json');
|
|
1017
|
+
return config.plugins?.push(new TsCheckerRspackPlugin({
|
|
1060
1018
|
typescript: {
|
|
1061
1019
|
mode: 'readonly',
|
|
1062
1020
|
memoryLimit: 8192,
|
|
@@ -1074,7 +1032,8 @@ for(var __webpack_i__ in (()=>{
|
|
|
1074
1032
|
},
|
|
1075
1033
|
logger: {
|
|
1076
1034
|
log (message) {
|
|
1077
|
-
|
|
1035
|
+
let count = +(/(\d+) errors?/.exec(message)?.[1] || 0);
|
|
1036
|
+
count > 0 && console.log(`Found ${colors.red(colors.bold(`${count} ${1 === count ? 'error' : 'errors'}`))}`);
|
|
1078
1037
|
},
|
|
1079
1038
|
error (message) {
|
|
1080
1039
|
message.includes('RpcExitError') || message.includes('out of memory') || console.log(message.replace(/ERROR/g, 'Type Error'));
|
|
@@ -1083,8 +1042,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1083
1042
|
})), config;
|
|
1084
1043
|
}
|
|
1085
1044
|
async function getBundlerConfig(originalUnpackConfig) {
|
|
1086
|
-
|
|
1087
|
-
let circularCount, { plugins, bundlerConfig, ...rest } = originalUnpackConfig;
|
|
1045
|
+
let { plugins, bundlerConfig, ...rest } = originalUnpackConfig;
|
|
1088
1046
|
for (let plugin of getNormalizedPluginsByHook('config', plugins))rest = await plugin.config(rest, {
|
|
1089
1047
|
...originalUnpackConfig._context,
|
|
1090
1048
|
mergeConfig: mergeConfig
|
|
@@ -1093,7 +1051,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1093
1051
|
...rest,
|
|
1094
1052
|
plugins,
|
|
1095
1053
|
bundlerConfig
|
|
1096
|
-
}, tsconfigPath = external_node_path_default().resolve(unpackConfig.root, 'tsconfig.json'), isTs = external_node_fs_default().existsSync(tsconfigPath), minifyOptions = isPlainObject(
|
|
1054
|
+
}, 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
1055
|
'PUBLIC_'
|
|
1098
1056
|
], processEnv = process.env } = {}) {
|
|
1099
1057
|
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 +1109,23 @@ for(var __webpack_i__ in (()=>{
|
|
|
1151
1109
|
path: external_node_path_default().resolve(unpackConfig.root, unpackConfig.build.outDir),
|
|
1152
1110
|
filename: getOutputFilename({
|
|
1153
1111
|
type: 'js',
|
|
1154
|
-
hash:
|
|
1112
|
+
hash: unpackConfig.build?.filenameHash
|
|
1155
1113
|
}),
|
|
1156
1114
|
chunkFilename: getOutputFilename({
|
|
1157
1115
|
type: 'js',
|
|
1158
|
-
hash:
|
|
1116
|
+
hash: unpackConfig.build?.filenameHash,
|
|
1159
1117
|
async: !0
|
|
1160
1118
|
}),
|
|
1161
1119
|
crossOriginLoading: 'anonymous',
|
|
1162
1120
|
pathinfo: !1,
|
|
1163
|
-
publicPath:
|
|
1121
|
+
publicPath: unpackConfig.build?.publicPath,
|
|
1164
1122
|
webassemblyModuleFilename: 'js/async/[hash].module.wasm',
|
|
1165
1123
|
assetModuleFilename: 'assets/[name].[contenthash:8][ext]'
|
|
1166
1124
|
},
|
|
1167
1125
|
infrastructureLogging: {
|
|
1168
1126
|
level: 'error'
|
|
1169
1127
|
},
|
|
1170
|
-
devtool:
|
|
1128
|
+
devtool: unpackConfig.build?.sourceMap,
|
|
1171
1129
|
module: {
|
|
1172
1130
|
rules: [
|
|
1173
1131
|
{
|
|
@@ -1198,74 +1156,37 @@ for(var __webpack_i__ in (()=>{
|
|
|
1198
1156
|
...unpackConfig.define
|
|
1199
1157
|
}),
|
|
1200
1158
|
!unpackConfig.mpa && new core_namespaceObject.rspack.HtmlRspackPlugin({
|
|
1201
|
-
template:
|
|
1202
|
-
templateContent:
|
|
1159
|
+
template: unpackConfig.html?.template || void 0,
|
|
1160
|
+
templateContent: unpackConfig.html?.templateContent || (unpackConfig.html?.template ? void 0 : TEMPLATE_CONTENT),
|
|
1203
1161
|
templateParameters: {
|
|
1204
1162
|
mountId: unpackConfig.html.mountId,
|
|
1205
|
-
title: isFunction(
|
|
1163
|
+
title: isFunction(unpackConfig.html?.title) ? unpackConfig.html?.title({
|
|
1206
1164
|
entryName: 'index'
|
|
1207
|
-
}) :
|
|
1208
|
-
headTag:
|
|
1209
|
-
...
|
|
1165
|
+
}) : unpackConfig.html?.title || '',
|
|
1166
|
+
headTag: unpackConfig.html?.headTag || '',
|
|
1167
|
+
...unpackConfig.html?.templateParameters
|
|
1210
1168
|
},
|
|
1211
1169
|
minify: !1,
|
|
1212
1170
|
chunks: [
|
|
1213
1171
|
'main'
|
|
1214
1172
|
]
|
|
1215
1173
|
}),
|
|
1216
|
-
|
|
1174
|
+
unpackConfig.performance?.removeMomentLocale && new core_namespaceObject.rspack.IgnorePlugin({
|
|
1217
1175
|
resourceRegExp: /^\.\/locale$/,
|
|
1218
1176
|
contextRegExp: /moment$/
|
|
1219
1177
|
}),
|
|
1220
|
-
|
|
1178
|
+
unpackConfig.build?.copy && new core_namespaceObject.rspack.CopyRspackPlugin({
|
|
1221
1179
|
patterns: unpackConfig.build.copy
|
|
1222
1180
|
}),
|
|
1223
1181
|
new ProgressPlugin(),
|
|
1224
|
-
unpackConfig.lint && new OxlintPlugin()
|
|
1225
|
-
unpackConfig.detectCircular && (circularCount = 0, new core_namespaceObject.rspack.CircularDependencyRspackPlugin({
|
|
1226
|
-
exclude: /node_modules/,
|
|
1227
|
-
onStart () {
|
|
1228
|
-
circularCount = 0;
|
|
1229
|
-
},
|
|
1230
|
-
onDetected (_, modules) {
|
|
1231
|
-
var paths, paths1;
|
|
1232
|
-
circularCount++, console.log(''), logger_logger.warn('circular dependency detected:');
|
|
1233
|
-
let uniquePaths = modules.map((module)=>{
|
|
1234
|
-
let filePath = module.replace(/^.*!/, ''), relativePath = external_node_path_default().relative(unpackConfig.root, filePath);
|
|
1235
|
-
return relativePath.startsWith('..') ? filePath : relativePath;
|
|
1236
|
-
}).slice(0, -1), totalLength = 2 + uniquePaths.join(' → ').length;
|
|
1237
|
-
if (totalLength > (process.stdout.columns || 80)) {
|
|
1238
|
-
let arrow, lastIndex;
|
|
1239
|
-
paths = uniquePaths, console.log(''), arrow = '↳ ', lastIndex = paths.length - 1, paths.forEach((p, i)=>{
|
|
1240
|
-
switch(i){
|
|
1241
|
-
case 0:
|
|
1242
|
-
console.log(` ${p}`);
|
|
1243
|
-
break;
|
|
1244
|
-
case lastIndex:
|
|
1245
|
-
console.log(` ${arrow}${p} ${colors.dim('(cycle introduced)')}`);
|
|
1246
|
-
break;
|
|
1247
|
-
default:
|
|
1248
|
-
console.log(` ${arrow}${p}`);
|
|
1249
|
-
}
|
|
1250
|
-
}), console.log(` ${arrow}${paths[0]}`), console.log('');
|
|
1251
|
-
} else {
|
|
1252
|
-
let line1, upArrowPos, downArrowPos, lineLength;
|
|
1253
|
-
line1 = ' ', upArrowPos = 2, downArrowPos = 0, (paths1 = uniquePaths).forEach((p, i)=>{
|
|
1254
|
-
line1 += p, i < paths1.length - 1 ? line1 += ' → ' : downArrowPos = line1.length - 1;
|
|
1255
|
-
}), lineLength = downArrowPos - upArrowPos, console.log(''), console.log(line1), console.log(' ' + ' '.repeat(upArrowPos - 2) + '↑' + ' '.repeat(downArrowPos - upArrowPos - 1) + '↓'), console.log(' ' + ' '.repeat(upArrowPos - 2) + '└' + '─'.repeat(lineLength - 1) + '┘'), console.log('');
|
|
1256
|
-
}
|
|
1257
|
-
},
|
|
1258
|
-
onEnd () {
|
|
1259
|
-
circularCount > 0 && console.log(`Found ${circularCount} circular ${1 === circularCount ? 'dependency' : 'dependencies'}.`);
|
|
1260
|
-
}
|
|
1261
|
-
}))
|
|
1182
|
+
unpackConfig.lint && new OxlintPlugin()
|
|
1262
1183
|
].filter(Boolean),
|
|
1263
1184
|
externals: unpackConfig.externals,
|
|
1264
1185
|
resolve: {
|
|
1265
1186
|
tsConfig: isTs ? tsconfigPath : void 0,
|
|
1266
1187
|
alias: {
|
|
1267
1188
|
'@': external_node_path_default().resolve(unpackConfig.root, 'src'),
|
|
1268
|
-
...
|
|
1189
|
+
...unpackConfig.resolve?.alias
|
|
1269
1190
|
},
|
|
1270
1191
|
extensionAlias: {
|
|
1271
1192
|
'.js': [
|
|
@@ -1285,21 +1206,20 @@ for(var __webpack_i__ in (()=>{
|
|
|
1285
1206
|
'.js',
|
|
1286
1207
|
'.wasm',
|
|
1287
1208
|
'.json',
|
|
1288
|
-
...
|
|
1209
|
+
...unpackConfig.resolve?.extensions || []
|
|
1289
1210
|
]
|
|
1290
1211
|
},
|
|
1291
|
-
lazyCompilation:
|
|
1212
|
+
lazyCompilation: unpackConfig.dev?.lazyCompilation && utils_isDevServer() && {
|
|
1292
1213
|
imports: !0,
|
|
1293
1214
|
entries: !!unpackConfig.mpa
|
|
1294
1215
|
},
|
|
1295
1216
|
experiments: {
|
|
1296
1217
|
css: !1,
|
|
1297
|
-
asyncWebAssembly: !0
|
|
1298
|
-
lazyBarrel: !0
|
|
1218
|
+
asyncWebAssembly: !0
|
|
1299
1219
|
},
|
|
1300
1220
|
optimization: {
|
|
1301
1221
|
moduleIds: isDev() ? 'named' : 'deterministic',
|
|
1302
|
-
minimize: !!
|
|
1222
|
+
minimize: !!unpackConfig.build?.minify,
|
|
1303
1223
|
minimizer: [
|
|
1304
1224
|
new JsMinifyPlugin(mergeConfig({
|
|
1305
1225
|
compress: {
|
|
@@ -1319,9 +1239,9 @@ for(var __webpack_i__ in (()=>{
|
|
|
1319
1239
|
};
|
|
1320
1240
|
for (let plugin of (config = (({ config, unpackConfig })=>{
|
|
1321
1241
|
let { chunkSplit } = unpackConfig.performance || {};
|
|
1322
|
-
if (
|
|
1242
|
+
if (chunkSplit?.strategy) {
|
|
1323
1243
|
let forceSplittingGroups = {};
|
|
1324
|
-
|
|
1244
|
+
chunkSplit?.forceSplitting && (forceSplittingGroups = function(forceSplitting, strategy) {
|
|
1325
1245
|
let cacheGroups = {};
|
|
1326
1246
|
for (let [key, regexp] of Array.isArray(forceSplitting) ? forceSplitting.map((regexp, index)=>[
|
|
1327
1247
|
`force-split-${index}`,
|
|
@@ -1347,26 +1267,25 @@ for(var __webpack_i__ in (()=>{
|
|
|
1347
1267
|
}
|
|
1348
1268
|
return config;
|
|
1349
1269
|
})({
|
|
1350
|
-
config: config =
|
|
1351
|
-
var _unpackConfig_build, _unpackConfig_build1, _unpackConfig_css, _unpackConfig_css1;
|
|
1270
|
+
config: config = unpackConfig.experiments?.css ? function({ config, unpackConfig }) {
|
|
1352
1271
|
config.output.cssFilename = getOutputFilename({
|
|
1353
1272
|
type: 'css',
|
|
1354
|
-
hash:
|
|
1273
|
+
hash: unpackConfig.build?.filenameHash
|
|
1355
1274
|
}), config.output.cssChunkFilename = getOutputFilename({
|
|
1356
1275
|
type: 'css',
|
|
1357
|
-
hash:
|
|
1276
|
+
hash: unpackConfig.build?.filenameHash,
|
|
1358
1277
|
async: !0
|
|
1359
1278
|
}), setValueByPath(config, [
|
|
1360
1279
|
'experiments',
|
|
1361
1280
|
'css'
|
|
1362
1281
|
], !0);
|
|
1363
|
-
let sourceMap =
|
|
1282
|
+
let sourceMap = unpackConfig.css?.sourceMap, modules = unpackConfig.css?.modules;
|
|
1364
1283
|
isPlainObject(modules) || !1 === modules || (modules = {}), !1 !== modules && !1 !== modules.auto && (setValueByPath(config, [
|
|
1365
1284
|
'module',
|
|
1366
1285
|
'parser',
|
|
1367
1286
|
'css/module'
|
|
1368
1287
|
], {
|
|
1369
|
-
namedExports:
|
|
1288
|
+
namedExports: !1
|
|
1370
1289
|
}), setValueByPath(config, [
|
|
1371
1290
|
'module',
|
|
1372
1291
|
'generator',
|
|
@@ -1383,42 +1302,31 @@ for(var __webpack_i__ in (()=>{
|
|
|
1383
1302
|
use,
|
|
1384
1303
|
type: 'css/module'
|
|
1385
1304
|
};
|
|
1386
|
-
}, getThreadLoader = ()=>{
|
|
1387
|
-
var _unpackConfig_build;
|
|
1388
|
-
return (null == (_unpackConfig_build = unpackConfig.build) ? void 0 : _unpackConfig_build.parallel) && isProd() && {
|
|
1305
|
+
}, getThreadLoader = ()=>unpackConfig.build?.parallel && isProd() && {
|
|
1389
1306
|
loader: require.resolve('thread-loader'),
|
|
1390
1307
|
options: THREAD_OPTIONS
|
|
1391
|
-
}
|
|
1392
|
-
}, getLessLoader = ()=>{
|
|
1393
|
-
var _unpackConfig_css;
|
|
1394
|
-
return {
|
|
1308
|
+
}, getLessLoader = ()=>({
|
|
1395
1309
|
loader: getCompiledPkgPath('less-loader'),
|
|
1396
1310
|
options: {
|
|
1397
1311
|
lessOptions: mergeConfig({
|
|
1398
1312
|
javascriptEnabled: !0
|
|
1399
|
-
},
|
|
1313
|
+
}, unpackConfig.css?.less || {}),
|
|
1400
1314
|
implementation: getUserDepPath(unpackConfig.root, 'less'),
|
|
1401
1315
|
sourceMap
|
|
1402
1316
|
}
|
|
1403
|
-
}
|
|
1404
|
-
}, getCssLoader = ()=>{
|
|
1405
|
-
var _unpackConfig_css, _unpackConfig_css1, _unpackConfig_css2;
|
|
1406
|
-
return (null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.transformer) === 'lightningcss' ? {
|
|
1317
|
+
}), getCssLoader = ()=>unpackConfig.css?.transformer === 'lightningcss' ? {
|
|
1407
1318
|
loader: 'builtin:lightningcss-loader',
|
|
1408
1319
|
options: {
|
|
1409
1320
|
targets: esVersionToBrowserslist(unpackConfig.build.target),
|
|
1410
|
-
...
|
|
1321
|
+
...unpackConfig.css?.lightningcss
|
|
1411
1322
|
}
|
|
1412
1323
|
} : {
|
|
1413
1324
|
loader: getCompiledPkgPath('postcss-loader'),
|
|
1414
1325
|
options: {
|
|
1415
|
-
postcssOptions:
|
|
1326
|
+
postcssOptions: unpackConfig.css?.postcss,
|
|
1416
1327
|
sourceMap
|
|
1417
1328
|
}
|
|
1418
|
-
}
|
|
1419
|
-
}, getSassLoader = ()=>{
|
|
1420
|
-
var _unpackConfig_css;
|
|
1421
|
-
return {
|
|
1329
|
+
}, getSassLoader = ()=>({
|
|
1422
1330
|
loader: getCompiledPkgPath('sass-loader'),
|
|
1423
1331
|
options: {
|
|
1424
1332
|
api: 'modern-compiler',
|
|
@@ -1426,11 +1334,10 @@ for(var __webpack_i__ in (()=>{
|
|
|
1426
1334
|
'sass-embedded',
|
|
1427
1335
|
'sass'
|
|
1428
1336
|
]),
|
|
1429
|
-
sassOptions:
|
|
1337
|
+
sassOptions: unpackConfig.css?.sass,
|
|
1430
1338
|
sourceMap
|
|
1431
1339
|
}
|
|
1432
|
-
};
|
|
1433
|
-
};
|
|
1340
|
+
});
|
|
1434
1341
|
return config.module.rules.push({
|
|
1435
1342
|
test: /\.css$/i,
|
|
1436
1343
|
oneOf: [
|
|
@@ -1489,8 +1396,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1489
1396
|
config,
|
|
1490
1397
|
unpackConfig
|
|
1491
1398
|
}) : 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;
|
|
1399
|
+
let sourceMap = unpackConfig.css?.sourceMap, modules = unpackConfig.css?.modules;
|
|
1494
1400
|
isPlainObject(modules) || !1 === modules || (modules = {});
|
|
1495
1401
|
let getCommonRules = ({ importLoaders })=>[
|
|
1496
1402
|
utils_isDevServer() ? {
|
|
@@ -1519,7 +1425,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1519
1425
|
})(),
|
|
1520
1426
|
localIdentName: !1 !== modules && (modules.localIdentName || CSS_MODULES_LOCAL_IDENT_NAME),
|
|
1521
1427
|
exportLocalsConvention: EXPORT_LOCALS_CONVENTION,
|
|
1522
|
-
namedExport:
|
|
1428
|
+
namedExport: !1
|
|
1523
1429
|
},
|
|
1524
1430
|
sourceMap
|
|
1525
1431
|
}
|
|
@@ -1528,31 +1434,28 @@ for(var __webpack_i__ in (()=>{
|
|
|
1528
1434
|
utils_isDevServer() || config.plugins.push(new core_namespaceObject.rspack.CssExtractRspackPlugin({
|
|
1529
1435
|
filename: getOutputFilename({
|
|
1530
1436
|
type: 'css',
|
|
1531
|
-
hash:
|
|
1437
|
+
hash: unpackConfig.build?.filenameHash
|
|
1532
1438
|
}),
|
|
1533
1439
|
chunkFilename: getOutputFilename({
|
|
1534
1440
|
type: 'css',
|
|
1535
|
-
hash:
|
|
1441
|
+
hash: unpackConfig.build?.filenameHash,
|
|
1536
1442
|
async: !0
|
|
1537
1443
|
}),
|
|
1538
1444
|
ignoreOrder: !0
|
|
1539
1445
|
}));
|
|
1540
|
-
let getCssLoader = ()=>{
|
|
1541
|
-
var _unpackConfig_css, _unpackConfig_css1, _unpackConfig_css2;
|
|
1542
|
-
return (null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.transformer) === 'lightningcss' ? {
|
|
1446
|
+
let getCssLoader = ()=>unpackConfig.css?.transformer === 'lightningcss' ? {
|
|
1543
1447
|
loader: 'builtin:lightningcss-loader',
|
|
1544
1448
|
options: {
|
|
1545
1449
|
targets: esVersionToBrowserslist(unpackConfig.build.target),
|
|
1546
|
-
...
|
|
1450
|
+
...unpackConfig.css?.lightningcss
|
|
1547
1451
|
}
|
|
1548
1452
|
} : {
|
|
1549
1453
|
loader: getCompiledPkgPath('postcss-loader'),
|
|
1550
1454
|
options: {
|
|
1551
|
-
postcssOptions:
|
|
1455
|
+
postcssOptions: unpackConfig.css?.postcss,
|
|
1552
1456
|
sourceMap
|
|
1553
1457
|
}
|
|
1554
1458
|
};
|
|
1555
|
-
};
|
|
1556
1459
|
return config.module.rules.push({
|
|
1557
1460
|
test: /\.less$/i,
|
|
1558
1461
|
use: [
|
|
@@ -1560,7 +1463,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1560
1463
|
importLoaders: 2
|
|
1561
1464
|
}),
|
|
1562
1465
|
getCssLoader(),
|
|
1563
|
-
|
|
1466
|
+
unpackConfig.build?.parallel && isProd() && {
|
|
1564
1467
|
loader: require.resolve('thread-loader'),
|
|
1565
1468
|
options: THREAD_OPTIONS
|
|
1566
1469
|
},
|
|
@@ -1569,7 +1472,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1569
1472
|
options: {
|
|
1570
1473
|
lessOptions: mergeConfig({
|
|
1571
1474
|
javascriptEnabled: !0
|
|
1572
|
-
},
|
|
1475
|
+
}, unpackConfig.css?.less || {}),
|
|
1573
1476
|
implementation: getUserDepPath(unpackConfig.root, 'less'),
|
|
1574
1477
|
sourceMap
|
|
1575
1478
|
}
|
|
@@ -1598,7 +1501,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1598
1501
|
'sass-embedded',
|
|
1599
1502
|
'sass'
|
|
1600
1503
|
]),
|
|
1601
|
-
sassOptions:
|
|
1504
|
+
sassOptions: unpackConfig.css?.sass,
|
|
1602
1505
|
sourceMap
|
|
1603
1506
|
}
|
|
1604
1507
|
}
|
|
@@ -1609,15 +1512,57 @@ for(var __webpack_i__ in (()=>{
|
|
|
1609
1512
|
unpackConfig
|
|
1610
1513
|
}),
|
|
1611
1514
|
unpackConfig
|
|
1612
|
-
}),
|
|
1515
|
+
}), unpackConfig.build?.cache && !(utils_isDevServer() && unpackConfig.dev?.lazyCompilation) && (config = await applyCacheConfig({
|
|
1613
1516
|
config,
|
|
1614
1517
|
unpackConfig,
|
|
1615
1518
|
envFilePaths
|
|
1616
|
-
})),
|
|
1519
|
+
})), unpackConfig.performance?.bundleAnalyze && isProd() && (config = await applyBundleAnalyzeConfig({
|
|
1617
1520
|
config
|
|
1618
1521
|
})), unpackConfig.typeCheck && isDev() && isTs && (config = await applyTypeCheckConfig({
|
|
1619
1522
|
config,
|
|
1620
1523
|
unpackConfig
|
|
1524
|
+
})), unpackConfig.detectCircular && (config = function({ config, unpackConfig }) {
|
|
1525
|
+
let circularCount = 0, circularDependencyPlugin = new core_namespaceObject.rspack.CircularDependencyRspackPlugin({
|
|
1526
|
+
exclude: /node_modules/,
|
|
1527
|
+
onStart () {
|
|
1528
|
+
circularCount = 0;
|
|
1529
|
+
},
|
|
1530
|
+
onDetected (_, modules) {
|
|
1531
|
+
var paths, paths1;
|
|
1532
|
+
circularCount++, console.log(''), logger_logger.warn('circular dependency detected:');
|
|
1533
|
+
let uniquePaths = modules.map((module)=>{
|
|
1534
|
+
let filePath = module.replace(/^.*!/, ''), relativePath = external_node_path_default().relative(unpackConfig.root, filePath);
|
|
1535
|
+
return relativePath.startsWith('..') ? filePath : relativePath;
|
|
1536
|
+
}).slice(0, -1), totalLength = 2 + uniquePaths.join(' → ').length;
|
|
1537
|
+
if (totalLength > (process.stdout.columns || 80)) {
|
|
1538
|
+
let arrow, lastIndex;
|
|
1539
|
+
paths = uniquePaths, console.log(''), arrow = '↳ ', lastIndex = paths.length - 1, paths.forEach((p, i)=>{
|
|
1540
|
+
switch(i){
|
|
1541
|
+
case 0:
|
|
1542
|
+
console.log(` ${p}`);
|
|
1543
|
+
break;
|
|
1544
|
+
case lastIndex:
|
|
1545
|
+
console.log(` ${arrow}${p} ${colors.dim('(cycle introduced)')}`);
|
|
1546
|
+
break;
|
|
1547
|
+
default:
|
|
1548
|
+
console.log(` ${arrow}${p}`);
|
|
1549
|
+
}
|
|
1550
|
+
}), console.log(` ${arrow}${paths[0]}`), console.log('');
|
|
1551
|
+
} else {
|
|
1552
|
+
let line1, upArrowPos, downArrowPos, lineLength;
|
|
1553
|
+
line1 = ' ', upArrowPos = 2, downArrowPos = 0, (paths1 = uniquePaths).forEach((p, i)=>{
|
|
1554
|
+
line1 += p, i < paths1.length - 1 ? line1 += ' → ' : downArrowPos = line1.length - 1;
|
|
1555
|
+
}), lineLength = downArrowPos - upArrowPos, console.log(''), console.log(line1), console.log(' ' + ' '.repeat(upArrowPos - 2) + '↑' + ' '.repeat(downArrowPos - upArrowPos - 1) + '↓'), console.log(' ' + ' '.repeat(upArrowPos - 2) + '└' + '─'.repeat(lineLength - 1) + '┘'), console.log('');
|
|
1556
|
+
}
|
|
1557
|
+
},
|
|
1558
|
+
onEnd () {
|
|
1559
|
+
circularCount > 0 && console.log(`Found ${circularCount} circular ${1 === circularCount ? 'dependency' : 'dependencies'}`);
|
|
1560
|
+
}
|
|
1561
|
+
});
|
|
1562
|
+
return config.plugins?.push(circularDependencyPlugin), config;
|
|
1563
|
+
}({
|
|
1564
|
+
config,
|
|
1565
|
+
unpackConfig
|
|
1621
1566
|
})), getNormalizedPluginsByHook('bundlerConfig', unpackConfig.plugins)))config = await plugin.bundlerConfig(config, {
|
|
1622
1567
|
...unpackConfig._context,
|
|
1623
1568
|
unpackConfig,
|
|
@@ -1633,7 +1578,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1633
1578
|
console.error(err.stack || err), err.details && console.error(err.details);
|
|
1634
1579
|
return;
|
|
1635
1580
|
}
|
|
1636
|
-
|
|
1581
|
+
stats?.hasErrors() && console.log(stats.toString({
|
|
1637
1582
|
colors: !0,
|
|
1638
1583
|
preset: 'errors-only'
|
|
1639
1584
|
})), isWatch() || compiler.close(()=>{});
|
|
@@ -1709,13 +1654,13 @@ for(var __webpack_i__ in (()=>{
|
|
|
1709
1654
|
'react-dom': 'ReactDOM',
|
|
1710
1655
|
'react-router-dom': 'ReactRouterDOM'
|
|
1711
1656
|
})[pkgName] || pkgName, getExternalValue = (pkgName)=>`window ${getExternalLibraryName(pkgName)}`, prebundleDeps = async ({ unpackConfig })=>{
|
|
1712
|
-
var
|
|
1657
|
+
var failedDepsCachePath, externals, failedDepsCachePath1, cache;
|
|
1713
1658
|
let existExternals, cacheDir, count = {
|
|
1714
1659
|
total: 0,
|
|
1715
1660
|
bundled: 0
|
|
1716
1661
|
}, 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
1662
|
logUpdate(`${colors.magenta('»')} optimizing dependencies (${count.bundled}/${count.total})`), count.total === count.bundled + failedDeps.length && console.log();
|
|
1718
|
-
}, userOptions = isPlainObject(
|
|
1663
|
+
}, 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
1664
|
...(externals = unpackConfig.externals, existExternals = new Set(), Array.isArray(externals) ? externals.forEach((item)=>{
|
|
1720
1665
|
isPlainObject(item) && Object.keys(item).forEach((key)=>{
|
|
1721
1666
|
existExternals.add(key);
|
|
@@ -1864,7 +1809,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1864
1809
|
});
|
|
1865
1810
|
compiler.run((_, stats)=>{
|
|
1866
1811
|
let isFailed = !1;
|
|
1867
|
-
|
|
1812
|
+
stats?.hasErrors() ? (isFailed = !0, failedDeps.push(name), failedCache[name] = version, removeDir(outDir)) : count.bundled++, updateProgress(), compiler.close(()=>{
|
|
1868
1813
|
resolve(isFailed ? void 0 : getResult());
|
|
1869
1814
|
});
|
|
1870
1815
|
});
|
|
@@ -1873,8 +1818,8 @@ for(var __webpack_i__ in (()=>{
|
|
|
1873
1818
|
recursive: !0
|
|
1874
1819
|
}), external_node_fs_default().writeFileSync(failedDepsCachePath1, JSON.stringify(cache, null, 2), 'utf-8'), failedDeps[0] && logger_logger.warn(`something went wrong while optimizing "${colors.bold(failedDeps.join(', '))}"`);
|
|
1875
1820
|
let cachePath = external_node_path_default().resolve(root, TEMP_DIR, 'umd'), [{ default: express }, { default: cors }] = await Promise.all([
|
|
1876
|
-
|
|
1877
|
-
|
|
1821
|
+
import("express"),
|
|
1822
|
+
import("cors")
|
|
1878
1823
|
]), app = express();
|
|
1879
1824
|
app.use(cors()), app.use("/umd", express.static(cachePath));
|
|
1880
1825
|
let port = await getPort(), staticServer = app.listen(port, ()=>{});
|
|
@@ -1907,8 +1852,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1907
1852
|
}, unpackConfig.plugins.push({
|
|
1908
1853
|
name: 'unpack:prebundle',
|
|
1909
1854
|
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>`);
|
|
1855
|
+
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
1856
|
return setValueByPath(config, [
|
|
1913
1857
|
'html',
|
|
1914
1858
|
'headTag'
|
|
@@ -1927,12 +1871,11 @@ for(var __webpack_i__ in (()=>{
|
|
|
1927
1871
|
}), unpackConfig;
|
|
1928
1872
|
};
|
|
1929
1873
|
async function unpackDev(originalUnpackConfig) {
|
|
1930
|
-
var _unpackConfig_dev, _unpackConfig_server, _unpackConfig_server1, _unpackConfig_dev1, _unpackConfig_server2, _unpackConfig_server3;
|
|
1931
1874
|
let unpackConfig = originalUnpackConfig;
|
|
1932
|
-
|
|
1875
|
+
unpackConfig.dev?.prebundle && (unpackConfig = await prebundleDeps({
|
|
1933
1876
|
unpackConfig
|
|
1934
1877
|
}));
|
|
1935
|
-
let config = await getBundlerConfig(unpackConfig), compiler = (0, core_namespaceObject.rspack)(config), port = await getPort(
|
|
1878
|
+
let config = await getBundlerConfig(unpackConfig), compiler = (0, core_namespaceObject.rspack)(config), port = await getPort(unpackConfig.server?.port), proxyConfig = unpackConfig.server?.proxy;
|
|
1936
1879
|
isPlainObject(proxyConfig) && (proxyConfig = Object.entries(proxyConfig).map(([contextStr, target])=>{
|
|
1937
1880
|
let baseConfig = {
|
|
1938
1881
|
context: contextStr.split(','),
|
|
@@ -1955,16 +1898,15 @@ for(var __webpack_i__ in (()=>{
|
|
|
1955
1898
|
},
|
|
1956
1899
|
proxy: proxyConfig,
|
|
1957
1900
|
devMiddleware: {
|
|
1958
|
-
writeToDisk:
|
|
1901
|
+
writeToDisk: unpackConfig.dev?.writeToDisk
|
|
1959
1902
|
}
|
|
1960
1903
|
};
|
|
1961
1904
|
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();
|
|
1905
|
+
req.headers.accept?.includes('html') && (req.url = '/index.html'), next();
|
|
1964
1906
|
}), middlewares.unshift(core_namespaceObject.experiments.lazyCompilationMiddleware(compiler)), middlewares);
|
|
1965
1907
|
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 =
|
|
1908
|
+
await server.start(), logger_logger.greet(` ${colors.green(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v3.3.6`)} ${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())));
|
|
1909
|
+
let open = unpackConfig.server?.open, url = isString(open) ? open : `http://localhost:${port}`;
|
|
1968
1910
|
open && openBrowser(url), setupCliShortcuts({
|
|
1969
1911
|
openPage: async ()=>{
|
|
1970
1912
|
await openBrowser(url);
|
|
@@ -1973,8 +1915,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1973
1915
|
await cleanUpBeforeRestart(), process.exit(0);
|
|
1974
1916
|
},
|
|
1975
1917
|
printUrls: ()=>{
|
|
1976
|
-
|
|
1977
|
-
printAddressUrls(port, null == (_unpackConfig_server = unpackConfig.server) ? void 0 : _unpackConfig_server.host);
|
|
1918
|
+
printAddressUrls(port, unpackConfig.server?.host);
|
|
1978
1919
|
},
|
|
1979
1920
|
restartServer: async ()=>{
|
|
1980
1921
|
logger_logger.clear(), await cleanUpBeforeRestart(), createUnpack({
|
|
@@ -2037,7 +1978,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
2037
1978
|
...mergeConfig(defaultConfig, config),
|
|
2038
1979
|
_context: {
|
|
2039
1980
|
callerName,
|
|
2040
|
-
version: "3.3.
|
|
1981
|
+
version: "3.3.6"
|
|
2041
1982
|
}
|
|
2042
1983
|
};
|
|
2043
1984
|
};
|
|
@@ -2045,7 +1986,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
2045
1986
|
build: async ({ watch } = {})=>{
|
|
2046
1987
|
setNodeEnv(watch ? 'development' : 'production');
|
|
2047
1988
|
let config = resolveConfig();
|
|
2048
|
-
console.log(colors.rainbow(`${callerName} v3.3.
|
|
1989
|
+
console.log(colors.rainbow(`${callerName} v3.3.6`), colors.green(`building for ${getNodeEnv()}...`)), await unpackBuild(config);
|
|
2049
1990
|
},
|
|
2050
1991
|
dev: async ()=>{
|
|
2051
1992
|
global.__unpack_start_time = performance.now(), setNodeEnv('development'), setDevServer(!0);
|