@unpackjs/core 2.4.5 → 3.0.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/dist/index.cjs +167 -235
- package/dist/index.js +162 -223
- package/dist/typedCssModulesLoader.mjs +4 -62
- package/dist-types/bundler-config/cache.d.ts.map +1 -1
- package/dist-types/bundler-config/css.d.ts.map +1 -1
- package/dist-types/bundler-config/experimentCss.d.ts.map +1 -1
- package/dist-types/bundler-config/index.d.ts.map +1 -1
- package/dist-types/bundler-config/plugins/jsMinify.d.ts +2 -2
- package/dist-types/bundler-config/plugins/jsMinify.d.ts.map +1 -1
- package/dist-types/bundler-config/plugins/progress/{rspack.d.ts → index.d.ts} +1 -1
- package/dist-types/bundler-config/plugins/progress/index.d.ts.map +1 -0
- package/dist-types/bundler-config/plugins/typedCssModules.d.ts +1 -1
- package/dist-types/bundler-config/plugins/typedCssModules.d.ts.map +1 -1
- package/dist-types/constants.d.ts +0 -1
- package/dist-types/constants.d.ts.map +1 -1
- package/dist-types/createUnpack.d.ts.map +1 -1
- package/dist-types/index.d.ts +0 -2
- package/dist-types/index.d.ts.map +1 -1
- package/dist-types/logger.d.ts.map +1 -1
- package/dist-types/openBrowser.d.ts.map +1 -1
- package/dist-types/prebundleDeps.d.ts.map +1 -1
- package/dist-types/progressBar.d.ts +0 -1
- package/dist-types/progressBar.d.ts.map +1 -1
- package/dist-types/reporter.d.ts +1 -2
- package/dist-types/reporter.d.ts.map +1 -1
- package/dist-types/run/build.d.ts.map +1 -1
- package/dist-types/run/dev.d.ts.map +1 -1
- package/dist-types/types/config.d.ts +4 -9
- package/dist-types/types/config.d.ts.map +1 -1
- package/dist-types/types/index.d.ts +0 -1
- package/dist-types/types/index.d.ts.map +1 -1
- package/dist-types/utils.d.ts.map +1 -1
- package/package.json +3 -9
- package/dist/lightningcssLoader.mjs +0 -18
- package/dist-types/bundler-config/loaders/lightningcssLoader.d.ts +0 -5
- package/dist-types/bundler-config/loaders/lightningcssLoader.d.ts.map +0 -1
- package/dist-types/bundler-config/plugins/lightningcssMinify.d.ts +0 -10
- package/dist-types/bundler-config/plugins/lightningcssMinify.d.ts.map +0 -1
- package/dist-types/bundler-config/plugins/progress/rspack.d.ts.map +0 -1
- package/dist-types/bundler-config/plugins/progress/webpack.d.ts +0 -9
- package/dist-types/bundler-config/plugins/progress/webpack.d.ts.map +0 -1
- package/dist-types/types/lightningcss.d.ts +0 -11
- package/dist-types/types/lightningcss.d.ts.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -51,7 +51,6 @@ for(var __webpack_i__ in (()=>{
|
|
|
51
51
|
isWatch: ()=>isWatch,
|
|
52
52
|
isNodeVersionAtLeast: ()=>isNodeVersionAtLeast,
|
|
53
53
|
setNodeEnv: ()=>setNodeEnv,
|
|
54
|
-
DEFAULT_LIGHTNINGCSS_TARGET: ()=>DEFAULT_LIGHTNINGCSS_TARGET,
|
|
55
54
|
getCompiledPkgPath: ()=>getCompiledPkgPath,
|
|
56
55
|
LogColor: ()=>logger_LogColor,
|
|
57
56
|
isDebug: ()=>isDebug,
|
|
@@ -76,7 +75,6 @@ for(var __webpack_i__ in (()=>{
|
|
|
76
75
|
getUserDepVersion: ()=>getUserDepVersion,
|
|
77
76
|
DEFAULT_BROWSERSLIST: ()=>DEFAULT_BROWSERSLIST,
|
|
78
77
|
NODE_MODULES_REGEX: ()=>NODE_MODULES_REGEX,
|
|
79
|
-
webpack: ()=>external_webpack_default(),
|
|
80
78
|
getTime: ()=>getTime,
|
|
81
79
|
getValueByPath: ()=>getValueByPath,
|
|
82
80
|
getIpv4Interfaces: ()=>getIpv4Interfaces,
|
|
@@ -99,16 +97,11 @@ for(var __webpack_i__ in (()=>{
|
|
|
99
97
|
trackPerformance: ()=>trackPerformance,
|
|
100
98
|
createUnpack: ()=>createUnpack,
|
|
101
99
|
getPort: ()=>getPort,
|
|
102
|
-
HtmlWebpackPlugin: ()=>external_html_webpack_plugin_default(),
|
|
103
100
|
getUserDepPath: ()=>getUserDepPath,
|
|
104
101
|
isCSSModules: ()=>isCSSModules,
|
|
105
102
|
rspack: ()=>core_namespaceObject.rspack
|
|
106
103
|
});
|
|
107
|
-
let core_namespaceObject = require("@rspack/core"),
|
|
108
|
-
var external_html_webpack_plugin_default = __webpack_require__.n(external_html_webpack_plugin_namespaceObject);
|
|
109
|
-
let external_webpack_namespaceObject = require("webpack");
|
|
110
|
-
var external_webpack_default = __webpack_require__.n(external_webpack_namespaceObject);
|
|
111
|
-
let external_picocolors_namespaceObject = require("picocolors"), colors = {
|
|
104
|
+
let core_namespaceObject = require("@rspack/core"), external_picocolors_namespaceObject = require("picocolors"), colors = {
|
|
112
105
|
...__webpack_require__.n(external_picocolors_namespaceObject)(),
|
|
113
106
|
rainbow: (input)=>{
|
|
114
107
|
let isWord = (char)=>!/[\s\n]/.test(char), chars = [
|
|
@@ -131,7 +124,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
131
124
|
var external_node_os_default = __webpack_require__.n(external_node_os_namespaceObject);
|
|
132
125
|
let external_portfinder_namespaceObject = require("portfinder");
|
|
133
126
|
var external_portfinder_default = __webpack_require__.n(external_portfinder_namespaceObject);
|
|
134
|
-
let
|
|
127
|
+
let CSS_MODULES_LOCAL_IDENT_NAME = '[path][name]__[local]--[hash:5]', CSS_MODULES_REGEX = /\.module\.\w+$/i, DEV_DEFAULT_FILENAME = {
|
|
135
128
|
js: 'js/[name].js',
|
|
136
129
|
jsAsync: 'js/async/[name].js',
|
|
137
130
|
css: 'css/[name].css',
|
|
@@ -148,7 +141,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
148
141
|
'edge >= 107',
|
|
149
142
|
'firefox >= 104',
|
|
150
143
|
'safari >= 16'
|
|
151
|
-
], DEFAULT_ES_TARGET = 'es2022',
|
|
144
|
+
], DEFAULT_ES_TARGET = 'es2022', TEMPLATE_CONTENT = ({ title = '', headTag = '', mountId = '' })=>`<!DOCTYPE html>
|
|
152
145
|
<html lang="en">
|
|
153
146
|
|
|
154
147
|
<head>
|
|
@@ -263,7 +256,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
263
256
|
global[k] = performance.now();
|
|
264
257
|
return;
|
|
265
258
|
}
|
|
266
|
-
msg &&
|
|
259
|
+
msg && console.log(` ${msg} ${colors.dim('in')} ${colors.yellow(`${(performance.now() - global[k]).toFixed(2)}ms`)}`), global[k] = performance.now();
|
|
267
260
|
}, getPathInJs = (absPath)=>JSON.stringify(absPath).slice(1, -1), mergeConfig = merge, getUserDepVersion = (root, dep)=>{
|
|
268
261
|
let depPath = getUserDepPath(root, dep);
|
|
269
262
|
if (depPath) return JSON.parse(external_node_fs_default().readFileSync(external_node_path_default().resolve(depPath, 'package.json'), 'utf-8')).version;
|
|
@@ -316,10 +309,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
316
309
|
text = colors.yellow(message);
|
|
317
310
|
break;
|
|
318
311
|
case 'debug':
|
|
319
|
-
text = `${colors.dim((()
|
|
320
|
-
let now = new Date(), hours = now.getHours().toString().padStart(2, '0'), minutes = now.getMinutes().toString().padStart(2, '0'), seconds = now.getSeconds().toString().padStart(2, '0');
|
|
321
|
-
return `${hours}:${minutes}:${seconds}`;
|
|
322
|
-
})())} ${colors.magenta('debug')} ${message}`;
|
|
312
|
+
text = `${colors.dim(getTime())} ${colors.magenta('debug')} ${message}`;
|
|
323
313
|
break;
|
|
324
314
|
default:
|
|
325
315
|
text = message;
|
|
@@ -408,8 +398,6 @@ for(var __webpack_i__ in (()=>{
|
|
|
408
398
|
plugin[hook] && pluginMap.set(plugin.name, plugin);
|
|
409
399
|
}), Array.from(pluginMap.values());
|
|
410
400
|
}
|
|
411
|
-
let external_copy_webpack_plugin_namespaceObject = require("copy-webpack-plugin");
|
|
412
|
-
var external_copy_webpack_plugin_default = __webpack_require__.n(external_copy_webpack_plugin_namespaceObject);
|
|
413
401
|
let external_json5_namespaceObject = require("json5");
|
|
414
402
|
var external_json5_default = __webpack_require__.n(external_json5_namespaceObject);
|
|
415
403
|
let external_dotenv_expand_namespaceObject = require("dotenv-expand"), isFileSync = (filePath)=>{
|
|
@@ -418,7 +406,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
418
406
|
return null == (_fs_statSync = external_node_fs_default().statSync(filePath, {
|
|
419
407
|
throwIfNoEntry: !1
|
|
420
408
|
})) ? void 0 : _fs_statSync.isFile();
|
|
421
|
-
} catch
|
|
409
|
+
} catch {
|
|
422
410
|
return !1;
|
|
423
411
|
}
|
|
424
412
|
};
|
|
@@ -469,8 +457,8 @@ for(var __webpack_i__ in (()=>{
|
|
|
469
457
|
async function applyCacheConfig({ config, unpackConfig, envFilePaths }) {
|
|
470
458
|
var _unpackConfig_build, _unpackConfig_dev;
|
|
471
459
|
if (!(null == (_unpackConfig_build = unpackConfig.build) ? void 0 : _unpackConfig_build.cache) || utils_isDevServer() && (null == (_unpackConfig_dev = unpackConfig.dev) ? void 0 : _unpackConfig_dev.lazyCompilation)) return config;
|
|
472
|
-
let cacheConfig = isPlainObject(unpackConfig.build.cache) ? unpackConfig.build.cache : {},
|
|
473
|
-
return cacheDirectory && (cacheDirectory = external_node_path_default().resolve(unpackConfig.root, cacheDirectory)), logger_logger.info('persistent cache enabled'), config =
|
|
460
|
+
let cacheConfig = isPlainObject(unpackConfig.build.cache) ? unpackConfig.build.cache : {}, buildDependencies = await getBuildDependencies(unpackConfig.root, cacheConfig.buildDependencies || [], envFilePaths), cacheDirectory = cacheConfig.cacheDirectory;
|
|
461
|
+
return cacheDirectory && (cacheDirectory = external_node_path_default().resolve(unpackConfig.root, cacheDirectory)), logger_logger.info('persistent cache enabled'), config = mergeConfig(config, {
|
|
474
462
|
cache: !0,
|
|
475
463
|
experiments: {
|
|
476
464
|
cache: {
|
|
@@ -482,12 +470,6 @@ for(var __webpack_i__ in (()=>{
|
|
|
482
470
|
}
|
|
483
471
|
}
|
|
484
472
|
}
|
|
485
|
-
}) : mergeConfig(config, {
|
|
486
|
-
cache: {
|
|
487
|
-
type: 'filesystem',
|
|
488
|
-
buildDependencies,
|
|
489
|
-
cacheDirectory
|
|
490
|
-
}
|
|
491
473
|
});
|
|
492
474
|
}
|
|
493
475
|
let external_node_assert_namespaceObject = require("node:assert");
|
|
@@ -583,9 +565,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
583
565
|
}
|
|
584
566
|
};
|
|
585
567
|
}
|
|
586
|
-
},
|
|
587
|
-
var external_mini_css_extract_plugin_default = __webpack_require__.n(external_mini_css_extract_plugin_namespaceObject);
|
|
588
|
-
let external_tinyglobby_namespaceObject = require("tinyglobby");
|
|
568
|
+
}, external_tinyglobby_namespaceObject = require("tinyglobby");
|
|
589
569
|
async function getEntry(root, customEntry) {
|
|
590
570
|
let entry;
|
|
591
571
|
return entry = customEntry ? external_node_path_default().resolve(root, customEntry) : (await (0, external_tinyglobby_namespaceObject.glob)('(index|Index).{js,ts,jsx,tsx}', {
|
|
@@ -661,19 +641,18 @@ for(var __webpack_i__ in (()=>{
|
|
|
661
641
|
writable: !0
|
|
662
642
|
}) : obj[key] = value, obj;
|
|
663
643
|
}
|
|
664
|
-
let { RawSource
|
|
644
|
+
let { RawSource, SourceMapSource } = core_namespaceObject.rspack.sources, isJsFile = /\.[cm]?js(\?.*)?$/i, jsMinify_PLUGIN_NAME = 'JsMinifyPlugin';
|
|
665
645
|
class JsMinifyPlugin {
|
|
666
646
|
apply(compiler) {
|
|
667
647
|
let meta = JSON.stringify({
|
|
668
648
|
name: jsMinify_PLUGIN_NAME,
|
|
669
|
-
version: "
|
|
649
|
+
version: "3.0.0",
|
|
670
650
|
options: this.minifyOptions
|
|
671
651
|
});
|
|
672
652
|
compiler.hooks.compilation.tap(jsMinify_PLUGIN_NAME, (compilation)=>{
|
|
673
|
-
compilation.hooks.chunkHash.tap(jsMinify_PLUGIN_NAME, (_, hash)=>hash.update(meta)), compilation.hooks.processAssets.tap({
|
|
653
|
+
compilation.hooks.chunkHash.tap(jsMinify_PLUGIN_NAME, (_, hash)=>hash.update(Buffer.from(meta))), compilation.hooks.processAssets.tap({
|
|
674
654
|
name: jsMinify_PLUGIN_NAME,
|
|
675
|
-
stage: compiler.
|
|
676
|
-
additionalAssets: !0
|
|
655
|
+
stage: compiler.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE
|
|
677
656
|
}, ()=>this.transformAssets(compilation)), compilation.hooks.statsPrinter.tap(jsMinify_PLUGIN_NAME, (stats)=>{
|
|
678
657
|
stats.hooks.print.for('asset.info.minimized').tap(jsMinify_PLUGIN_NAME, (minimized, { green, formatFlag })=>minimized && green && formatFlag ? green(formatFlag('minimized')) : '');
|
|
679
658
|
});
|
|
@@ -689,7 +668,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
689
668
|
output.map && ((newMap = 'string' == typeof output.map ? JSON.parse(output.map) : output.map).sources = [
|
|
690
669
|
asset.name
|
|
691
670
|
]);
|
|
692
|
-
let newSource = sourceMap && newMap ? new
|
|
671
|
+
let newSource = sourceMap && newMap ? new SourceMapSource(output.code, asset.name, newMap, source, map, !0) : new RawSource(output.code), newInfo = {
|
|
693
672
|
...asset.info,
|
|
694
673
|
minimized: !0
|
|
695
674
|
};
|
|
@@ -702,49 +681,6 @@ for(var __webpack_i__ in (()=>{
|
|
|
702
681
|
this.minify = (null == implementation ? void 0 : implementation.minify) ?? external_oxc_minify_namespaceObject.minify, this.minifyOptions = minifyOptions;
|
|
703
682
|
}
|
|
704
683
|
}
|
|
705
|
-
let external_node_buffer_namespaceObject = require("node:buffer");
|
|
706
|
-
function lightningcssMinify_define_property(obj, key, value) {
|
|
707
|
-
return key in obj ? Object.defineProperty(obj, key, {
|
|
708
|
-
value: value,
|
|
709
|
-
enumerable: !0,
|
|
710
|
-
configurable: !0,
|
|
711
|
-
writable: !0
|
|
712
|
-
}) : obj[key] = value, obj;
|
|
713
|
-
}
|
|
714
|
-
let lightningcssMinify_PLUGIN_NAME = 'LightningcssMinifyPlugin';
|
|
715
|
-
class LightningcssMinifyPlugin {
|
|
716
|
-
apply(compiler) {
|
|
717
|
-
compiler.hooks.compilation.tap(lightningcssMinify_PLUGIN_NAME, (compilation)=>{
|
|
718
|
-
compilation.hooks.processAssets.tap({
|
|
719
|
-
name: lightningcssMinify_PLUGIN_NAME,
|
|
720
|
-
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE
|
|
721
|
-
}, ()=>this.transformAssets(compilation)), compilation.hooks.statsPrinter.tap(lightningcssMinify_PLUGIN_NAME, (statsPrinter)=>{
|
|
722
|
-
statsPrinter.hooks.print.for('asset.info.minimized').tap(lightningcssMinify_PLUGIN_NAME, (minimized, { green, formatFlag })=>minimized && green && formatFlag ? green(formatFlag('minimized')) : '');
|
|
723
|
-
});
|
|
724
|
-
});
|
|
725
|
-
}
|
|
726
|
-
transformAssets(compilation) {
|
|
727
|
-
let { options: { devtool }, webpack: { sources: { SourceMapSource, RawSource } } } = compilation.compiler, sourceMap = 'string' == typeof devtool && devtool.includes('source-map');
|
|
728
|
-
compilation.getAssets().filter((asset)=>!asset.info.minimized && /\.css$/.test(asset.name)).map((asset)=>{
|
|
729
|
-
let { source, map } = asset.source.sourceAndMap(), sourceAsString = source.toString(), code = 'string' == typeof source ? external_node_buffer_namespaceObject.Buffer.from(source) : source, result = this.transform({
|
|
730
|
-
filename: asset.name,
|
|
731
|
-
code,
|
|
732
|
-
minify: !0,
|
|
733
|
-
sourceMap,
|
|
734
|
-
...this.transformOptions
|
|
735
|
-
}), codeString = result.code.toString();
|
|
736
|
-
compilation.updateAsset(asset.name, sourceMap ? new SourceMapSource(codeString, asset.name, JSON.parse(result.map.toString()), sourceAsString, map, !0) : new RawSource(codeString), {
|
|
737
|
-
...asset.info,
|
|
738
|
-
minimized: !0
|
|
739
|
-
});
|
|
740
|
-
});
|
|
741
|
-
}
|
|
742
|
-
constructor(options = {}){
|
|
743
|
-
lightningcssMinify_define_property(this, "transform", void 0), lightningcssMinify_define_property(this, "transformOptions", void 0);
|
|
744
|
-
let { implementation, ...transformOptions } = options;
|
|
745
|
-
this.transform = (null == implementation ? void 0 : implementation.transform) ?? external_lightningcss_namespaceObject.transform, this.transformOptions = transformOptions;
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
684
|
let external_node_child_process_namespaceObject = require("node:child_process");
|
|
749
685
|
function oxlint_define_property(obj, key, value) {
|
|
750
686
|
return key in obj ? Object.defineProperty(obj, key, {
|
|
@@ -867,10 +803,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
867
803
|
let { columns: terminalWidth } = process.stdout, current = originalCurrent;
|
|
868
804
|
originalCurrent >= 0.98 && (current = 1);
|
|
869
805
|
let loadingChar = this.loadingAnimation.getCurrentChar(), messageWidth = terminalWidth - this.prefix.length - (1 === current ? 10 : 9);
|
|
870
|
-
logUpdate(`${loadingChar} ${this.prefix} (${Math.floor(100 * current)}%) ${colors.dim(message.slice(0, messageWidth).padEnd(messageWidth, ' '))}`);
|
|
871
|
-
}
|
|
872
|
-
done() {
|
|
873
|
-
console.log();
|
|
806
|
+
logUpdate(`${loadingChar} ${this.prefix} (${Math.floor(100 * current)}%) ${colors.dim(message.slice(0, messageWidth).padEnd(messageWidth, ' '))}`), 1 === current && clearLine();
|
|
874
807
|
}
|
|
875
808
|
constructor(){
|
|
876
809
|
progressBar_define_property(this, "prefix", 'transforming'), progressBar_define_property(this, "loadingAnimation", new LoadingAnimation());
|
|
@@ -1008,23 +941,23 @@ for(var __webpack_i__ in (()=>{
|
|
|
1008
941
|
logger_logger.ready(`built in ${prettyTime(compileTime)}${isDebug() ? ` (${stats.compilation.modules.size} modules)` : ''}`);
|
|
1009
942
|
}
|
|
1010
943
|
}
|
|
1011
|
-
let
|
|
944
|
+
let progress_PLUGIN_NAME = 'ProgressPlugin';
|
|
1012
945
|
class ProgressLiteRspackPlugin {
|
|
1013
946
|
apply(compiler) {
|
|
1014
|
-
compiler.hooks.watchRun.tap(
|
|
947
|
+
compiler.hooks.watchRun.tap(progress_PLUGIN_NAME, ()=>{
|
|
1015
948
|
(!utils_isDevServer() || global.__unpack_dev_server_started) && printDevLog(compiler, compiler.options.context);
|
|
1016
|
-
}), compiler.hooks.run.tap(
|
|
949
|
+
}), compiler.hooks.run.tap(progress_PLUGIN_NAME, ()=>{
|
|
1017
950
|
logger_logger.info('build started...');
|
|
1018
|
-
}), compiler.hooks.afterDone.tap(
|
|
951
|
+
}), compiler.hooks.afterDone.tap(progress_PLUGIN_NAME, async (stats)=>{
|
|
1019
952
|
await compileDone(compiler, stats);
|
|
1020
953
|
});
|
|
1021
954
|
}
|
|
1022
955
|
}
|
|
1023
956
|
class ProgressRspackPlugin extends core_namespaceObject.rspack.ProgressPlugin {
|
|
1024
957
|
apply(compiler) {
|
|
1025
|
-
super.apply(compiler), compiler.hooks.watchRun.tap(
|
|
958
|
+
super.apply(compiler), compiler.hooks.watchRun.tap(progress_PLUGIN_NAME, ()=>{
|
|
1026
959
|
(!utils_isDevServer() || global.__unpack_dev_server_started) && printDevLog(compiler, compiler.options.context);
|
|
1027
|
-
}), compiler.hooks.afterDone.tap(
|
|
960
|
+
}), compiler.hooks.afterDone.tap(progress_PLUGIN_NAME, async (stats)=>{
|
|
1028
961
|
await compileDone(compiler, stats);
|
|
1029
962
|
});
|
|
1030
963
|
}
|
|
@@ -1044,41 +977,10 @@ for(var __webpack_i__ in (()=>{
|
|
|
1044
977
|
}(this, "progressBar", new ProgressBar());
|
|
1045
978
|
}
|
|
1046
979
|
}
|
|
1047
|
-
function webpack_define_property(obj, key, value) {
|
|
1048
|
-
return key in obj ? Object.defineProperty(obj, key, {
|
|
1049
|
-
value: value,
|
|
1050
|
-
enumerable: !0,
|
|
1051
|
-
configurable: !0,
|
|
1052
|
-
writable: !0
|
|
1053
|
-
}) : obj[key] = value, obj;
|
|
1054
|
-
}
|
|
1055
|
-
let webpack_PLUGIN_NAME = 'ProgressPlugin';
|
|
1056
|
-
class ProgressWebpackPlugin extends external_webpack_default().ProgressPlugin {
|
|
1057
|
-
apply(compiler) {
|
|
1058
|
-
super.apply(compiler), compiler.hooks.watchRun.tap(webpack_PLUGIN_NAME, ()=>{
|
|
1059
|
-
(!utils_isDevServer() || global.__unpack_dev_server_started) && printDevLog(compiler, compiler.options.context);
|
|
1060
|
-
}), compiler.hooks.afterDone.tap(webpack_PLUGIN_NAME, async (stats)=>{
|
|
1061
|
-
this.isCompleted = !0, await compileDone(compiler, stats);
|
|
1062
|
-
});
|
|
1063
|
-
}
|
|
1064
|
-
constructor(){
|
|
1065
|
-
super({
|
|
1066
|
-
entries: !1,
|
|
1067
|
-
dependencies: !1,
|
|
1068
|
-
activeModules: !0,
|
|
1069
|
-
handler: isProd() ? (percentage, msg, ...args)=>{
|
|
1070
|
-
this.isCompleted || this.progressBar.update({
|
|
1071
|
-
current: percentage,
|
|
1072
|
-
message: `${msg} ${args.join(' ').replace(/(\d+) active /, '')}`
|
|
1073
|
-
});
|
|
1074
|
-
} : void 0
|
|
1075
|
-
}), webpack_define_property(this, "progressBar", new ProgressBar()), webpack_define_property(this, "isCompleted", !1);
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
980
|
let BundleAnalyzerPlugin = __webpack_require__("compiled/webpack-bundle-analyzer").BundleAnalyzerPlugin;
|
|
1079
981
|
async function getBundlerConfig(unpackConfig) {
|
|
1080
|
-
var _unpackConfig_build, _unpackConfig_build1,
|
|
1081
|
-
let
|
|
982
|
+
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_performance1, _unpackConfig_build7, _unpackConfig_resolve, _unpackConfig_resolve1, _unpackConfig_dev, _unpackConfig_build8, _unpackConfig_experiments;
|
|
983
|
+
let tsconfigPath = external_node_path_default().resolve(unpackConfig.root, 'tsconfig.json'), isTs = external_node_fs_default().existsSync(tsconfigPath), minifyOptions = isPlainObject(null == (_unpackConfig_build = unpackConfig.build) ? void 0 : _unpackConfig_build.minify) ? null == (_unpackConfig_build1 = unpackConfig.build) ? void 0 : _unpackConfig_build1.minify : {}, ProgressPlugin = (null == (_unpackConfig_build2 = unpackConfig.build) ? void 0 : _unpackConfig_build2.progressBar) ? ProgressRspackPlugin : ProgressLiteRspackPlugin, wasmFilename = 'js/[hash].module.wasm', { publicVars, filePaths: envFilePaths } = function({ cwd = process.cwd(), mode = getNodeEnv(), prefixes = [
|
|
1082
984
|
'PUBLIC_'
|
|
1083
985
|
], processEnv = process.env } = {}) {
|
|
1084
986
|
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.`);
|
|
@@ -1133,26 +1035,26 @@ for(var __webpack_i__ in (()=>{
|
|
|
1133
1035
|
stats: 'errors-only',
|
|
1134
1036
|
output: {
|
|
1135
1037
|
clean: !0,
|
|
1136
|
-
path: external_node_path_default().resolve(unpackConfig.root,
|
|
1038
|
+
path: external_node_path_default().resolve(unpackConfig.root, unpackConfig.build.outDir),
|
|
1137
1039
|
filename: getOutputFilename({
|
|
1138
1040
|
type: 'js',
|
|
1139
|
-
hash: null == (
|
|
1041
|
+
hash: null == (_unpackConfig_build3 = unpackConfig.build) ? void 0 : _unpackConfig_build3.filenameHash
|
|
1140
1042
|
}),
|
|
1141
1043
|
chunkFilename: getOutputFilename({
|
|
1142
1044
|
type: 'js',
|
|
1143
|
-
hash: null == (
|
|
1045
|
+
hash: null == (_unpackConfig_build4 = unpackConfig.build) ? void 0 : _unpackConfig_build4.filenameHash,
|
|
1144
1046
|
async: !0
|
|
1145
1047
|
}),
|
|
1146
1048
|
crossOriginLoading: 'anonymous',
|
|
1147
1049
|
pathinfo: !1,
|
|
1148
|
-
publicPath: null == (
|
|
1050
|
+
publicPath: null == (_unpackConfig_build5 = unpackConfig.build) ? void 0 : _unpackConfig_build5.publicPath,
|
|
1149
1051
|
webassemblyModuleFilename: wasmFilename,
|
|
1150
1052
|
assetModuleFilename: 'assets/[name].[contenthash:8][ext]'
|
|
1151
1053
|
},
|
|
1152
1054
|
infrastructureLogging: {
|
|
1153
1055
|
level: 'error'
|
|
1154
1056
|
},
|
|
1155
|
-
devtool: null == (
|
|
1057
|
+
devtool: null == (_unpackConfig_build6 = unpackConfig.build) ? void 0 : _unpackConfig_build6.sourceMap,
|
|
1156
1058
|
module: {
|
|
1157
1059
|
rules: [
|
|
1158
1060
|
{
|
|
@@ -1174,23 +1076,23 @@ for(var __webpack_i__ in (()=>{
|
|
|
1174
1076
|
]
|
|
1175
1077
|
},
|
|
1176
1078
|
plugins: [
|
|
1177
|
-
(
|
|
1079
|
+
new core_namespaceObject.rspack.DefinePlugin({
|
|
1178
1080
|
'import.meta.env.MODE': JSON.stringify(getNodeEnv()),
|
|
1179
1081
|
'import.meta.env.DEV': isDev(),
|
|
1180
1082
|
'import.meta.env.PROD': isProd(),
|
|
1181
1083
|
...publicVars,
|
|
1182
1084
|
...unpackConfig.define
|
|
1183
|
-
}
|
|
1184
|
-
!unpackConfig.mpa && new
|
|
1185
|
-
template: (null == (_unpackConfig_html = unpackConfig.html) ? void 0 : _unpackConfig_html.template) ||
|
|
1186
|
-
templateContent: (null == (_unpackConfig_html1 = unpackConfig.html) ? void 0 : _unpackConfig_html1.templateContent) || ((null == (_unpackConfig_html2 = unpackConfig.html) ? void 0 : _unpackConfig_html2.template) ?
|
|
1085
|
+
}),
|
|
1086
|
+
!unpackConfig.mpa && new core_namespaceObject.rspack.HtmlRspackPlugin({
|
|
1087
|
+
template: (null == (_unpackConfig_html = unpackConfig.html) ? void 0 : _unpackConfig_html.template) || void 0,
|
|
1088
|
+
templateContent: (null == (_unpackConfig_html1 = unpackConfig.html) ? void 0 : _unpackConfig_html1.templateContent) || ((null == (_unpackConfig_html2 = unpackConfig.html) ? void 0 : _unpackConfig_html2.template) ? void 0 : TEMPLATE_CONTENT),
|
|
1187
1089
|
templateParameters: {
|
|
1188
|
-
mountId:
|
|
1189
|
-
title: isFunction(null == (
|
|
1090
|
+
mountId: unpackConfig.html.mountId,
|
|
1091
|
+
title: isFunction(null == (_unpackConfig_html3 = unpackConfig.html) ? void 0 : _unpackConfig_html3.title) ? null == (_unpackConfig_html4 = unpackConfig.html) ? void 0 : _unpackConfig_html4.title({
|
|
1190
1092
|
entryName: 'index'
|
|
1191
|
-
}) : (null == (
|
|
1192
|
-
headTag: (null == (
|
|
1193
|
-
...null == (
|
|
1093
|
+
}) : (null == (_unpackConfig_html5 = unpackConfig.html) ? void 0 : _unpackConfig_html5.title) || '',
|
|
1094
|
+
headTag: (null == (_unpackConfig_html6 = unpackConfig.html) ? void 0 : _unpackConfig_html6.headTag) || '',
|
|
1095
|
+
...null == (_unpackConfig_html7 = unpackConfig.html) ? void 0 : _unpackConfig_html7.templateParameters
|
|
1194
1096
|
},
|
|
1195
1097
|
minify: !1,
|
|
1196
1098
|
chunks: [
|
|
@@ -1200,11 +1102,11 @@ for(var __webpack_i__ in (()=>{
|
|
|
1200
1102
|
(null == (_unpackConfig_performance = unpackConfig.performance) ? void 0 : _unpackConfig_performance.bundleAnalyze) && isProd() && new BundleAnalyzerPlugin({
|
|
1201
1103
|
analyzerPort: 'auto'
|
|
1202
1104
|
}),
|
|
1203
|
-
(null == (_unpackConfig_performance1 = unpackConfig.performance) ? void 0 : _unpackConfig_performance1.removeMomentLocale) && new IgnorePlugin({
|
|
1105
|
+
(null == (_unpackConfig_performance1 = unpackConfig.performance) ? void 0 : _unpackConfig_performance1.removeMomentLocale) && new core_namespaceObject.rspack.IgnorePlugin({
|
|
1204
1106
|
resourceRegExp: /^\.\/locale$/,
|
|
1205
1107
|
contextRegExp: /moment$/
|
|
1206
1108
|
}),
|
|
1207
|
-
(null == (
|
|
1109
|
+
(null == (_unpackConfig_build7 = unpackConfig.build) ? void 0 : _unpackConfig_build7.copy) && new core_namespaceObject.rspack.CopyRspackPlugin({
|
|
1208
1110
|
patterns: unpackConfig.build.copy
|
|
1209
1111
|
}),
|
|
1210
1112
|
unpackConfig.typeCheck && isDev() && isTs && new external_ts_checker_rspack_plugin_namespaceObject.TsCheckerRspackPlugin({
|
|
@@ -1277,19 +1179,18 @@ for(var __webpack_i__ in (()=>{
|
|
|
1277
1179
|
},
|
|
1278
1180
|
optimization: {
|
|
1279
1181
|
moduleIds: isDev() ? 'named' : 'deterministic',
|
|
1280
|
-
minimize: !!(null == (
|
|
1182
|
+
minimize: !!(null == (_unpackConfig_build8 = unpackConfig.build) ? void 0 : _unpackConfig_build8.minify),
|
|
1281
1183
|
minimizer: [
|
|
1282
|
-
new JsMinifyPlugin({
|
|
1283
|
-
...minifyOptions.oxc,
|
|
1184
|
+
new JsMinifyPlugin(mergeConfig({
|
|
1284
1185
|
compress: {
|
|
1285
|
-
target: DEFAULT_ES_TARGET
|
|
1286
|
-
...oxcMinifyCompress
|
|
1186
|
+
target: DEFAULT_ES_TARGET
|
|
1287
1187
|
}
|
|
1288
|
-
}),
|
|
1289
|
-
new
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1188
|
+
}, minifyOptions.oxc || {})),
|
|
1189
|
+
new core_namespaceObject.rspack.LightningCssMinimizerRspackPlugin(mergeConfig({
|
|
1190
|
+
minimizerOptions: {
|
|
1191
|
+
targets: DEFAULT_BROWSERSLIST
|
|
1192
|
+
}
|
|
1193
|
+
}, minifyOptions.lightningcss || {}))
|
|
1293
1194
|
]
|
|
1294
1195
|
},
|
|
1295
1196
|
watchOptions: {
|
|
@@ -1327,7 +1228,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1327
1228
|
return config;
|
|
1328
1229
|
})({
|
|
1329
1230
|
config: config = (null == (_unpackConfig_experiments = unpackConfig.experiments) ? void 0 : _unpackConfig_experiments.css) ? function({ config, unpackConfig }) {
|
|
1330
|
-
var _unpackConfig_build, _unpackConfig_build1, _unpackConfig_css, _unpackConfig_css1
|
|
1231
|
+
var _unpackConfig_build, _unpackConfig_build1, _unpackConfig_css, _unpackConfig_css1;
|
|
1331
1232
|
config.output.cssFilename = getOutputFilename({
|
|
1332
1233
|
type: 'css',
|
|
1333
1234
|
hash: null == (_unpackConfig_build = unpackConfig.build) ? void 0 : _unpackConfig_build.filenameHash
|
|
@@ -1380,33 +1281,14 @@ for(var __webpack_i__ in (()=>{
|
|
|
1380
1281
|
sourceMap
|
|
1381
1282
|
}
|
|
1382
1283
|
};
|
|
1383
|
-
}
|
|
1384
|
-
null == (_config_module = config.module) || null == (_config_module_rules = _config_module.rules) || _config_module_rules.push({
|
|
1385
|
-
test: /\.less$/i,
|
|
1386
|
-
oneOf: [
|
|
1387
|
-
withCssModules({
|
|
1388
|
-
use: [
|
|
1389
|
-
getThreadLoader(),
|
|
1390
|
-
getLessLoader()
|
|
1391
|
-
].filter(Boolean)
|
|
1392
|
-
}),
|
|
1393
|
-
{
|
|
1394
|
-
use: [
|
|
1395
|
-
getThreadLoader(),
|
|
1396
|
-
getLessLoader()
|
|
1397
|
-
].filter(Boolean),
|
|
1398
|
-
type: 'css'
|
|
1399
|
-
}
|
|
1400
|
-
].filter(Boolean)
|
|
1401
|
-
});
|
|
1402
|
-
let getCssLoader = ()=>{
|
|
1284
|
+
}, getCssLoader = ()=>{
|
|
1403
1285
|
var _unpackConfig_css, _unpackConfig_css1, _unpackConfig_css2;
|
|
1404
1286
|
return (null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.transformer) === 'lightningcss' ? {
|
|
1405
|
-
loader:
|
|
1406
|
-
options:
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
}
|
|
1287
|
+
loader: 'builtin:lightningcss-loader',
|
|
1288
|
+
options: {
|
|
1289
|
+
targets: DEFAULT_BROWSERSLIST,
|
|
1290
|
+
...null == (_unpackConfig_css1 = unpackConfig.css) ? void 0 : _unpackConfig_css1.lightningcss
|
|
1291
|
+
}
|
|
1410
1292
|
} : {
|
|
1411
1293
|
loader: getCompiledPkgPath('postcss-loader'),
|
|
1412
1294
|
options: {
|
|
@@ -1414,8 +1296,22 @@ for(var __webpack_i__ in (()=>{
|
|
|
1414
1296
|
sourceMap
|
|
1415
1297
|
}
|
|
1416
1298
|
};
|
|
1299
|
+
}, getSassLoader = ()=>{
|
|
1300
|
+
var _unpackConfig_css;
|
|
1301
|
+
return {
|
|
1302
|
+
loader: getCompiledPkgPath('sass-loader'),
|
|
1303
|
+
options: {
|
|
1304
|
+
api: 'modern-compiler',
|
|
1305
|
+
implementation: getUserDepPath(unpackConfig.root, [
|
|
1306
|
+
'sass-embedded',
|
|
1307
|
+
'sass'
|
|
1308
|
+
]),
|
|
1309
|
+
sassOptions: null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.sass,
|
|
1310
|
+
sourceMap
|
|
1311
|
+
}
|
|
1312
|
+
};
|
|
1417
1313
|
};
|
|
1418
|
-
|
|
1314
|
+
return config.module.rules.push({
|
|
1419
1315
|
test: /\.css$/i,
|
|
1420
1316
|
oneOf: [
|
|
1421
1317
|
withCssModules({
|
|
@@ -1430,32 +1326,37 @@ for(var __webpack_i__ in (()=>{
|
|
|
1430
1326
|
type: 'css'
|
|
1431
1327
|
}
|
|
1432
1328
|
].filter(Boolean)
|
|
1433
|
-
})
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1329
|
+
}), config.module.rules.push({
|
|
1330
|
+
test: /\.less$/i,
|
|
1331
|
+
oneOf: [
|
|
1332
|
+
withCssModules({
|
|
1333
|
+
use: [
|
|
1334
|
+
getCssLoader(),
|
|
1335
|
+
getThreadLoader(),
|
|
1336
|
+
getLessLoader()
|
|
1337
|
+
].filter(Boolean)
|
|
1338
|
+
}),
|
|
1339
|
+
{
|
|
1340
|
+
use: [
|
|
1341
|
+
getCssLoader(),
|
|
1342
|
+
getThreadLoader(),
|
|
1343
|
+
getLessLoader()
|
|
1344
|
+
].filter(Boolean),
|
|
1345
|
+
type: 'css'
|
|
1446
1346
|
}
|
|
1447
|
-
|
|
1448
|
-
}
|
|
1449
|
-
return null == (_config_module2 = config.module) || null == (_config_module_rules2 = _config_module2.rules) || _config_module_rules2.push({
|
|
1347
|
+
].filter(Boolean)
|
|
1348
|
+
}), config.module.rules.push({
|
|
1450
1349
|
test: /\.s[ac]ss$/i,
|
|
1451
1350
|
oneOf: [
|
|
1452
1351
|
withCssModules({
|
|
1453
1352
|
use: [
|
|
1353
|
+
getCssLoader(),
|
|
1454
1354
|
getSassLoader()
|
|
1455
1355
|
]
|
|
1456
1356
|
}),
|
|
1457
1357
|
{
|
|
1458
1358
|
use: [
|
|
1359
|
+
getCssLoader(),
|
|
1459
1360
|
getSassLoader()
|
|
1460
1361
|
],
|
|
1461
1362
|
type: 'css'
|
|
@@ -1468,14 +1369,14 @@ for(var __webpack_i__ in (()=>{
|
|
|
1468
1369
|
config,
|
|
1469
1370
|
unpackConfig
|
|
1470
1371
|
}) : function({ config, unpackConfig }) {
|
|
1471
|
-
var _unpackConfig_css, _unpackConfig_css1, _unpackConfig_build, _unpackConfig_css2,
|
|
1472
|
-
let
|
|
1372
|
+
var _unpackConfig_css, _unpackConfig_css1, _unpackConfig_build, _unpackConfig_css2, _unpackConfig_css3, _unpackConfig_build1, _unpackConfig_build2;
|
|
1373
|
+
let sourceMap = null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.sourceMap, modules = null == (_unpackConfig_css1 = unpackConfig.css) ? void 0 : _unpackConfig_css1.modules;
|
|
1473
1374
|
isPlainObject(modules) || !1 === modules || (modules = {});
|
|
1474
1375
|
let getCommonRules = ({ importLoaders })=>[
|
|
1475
1376
|
utils_isDevServer() ? {
|
|
1476
1377
|
loader: getCompiledPkgPath('style-loader')
|
|
1477
1378
|
} : {
|
|
1478
|
-
loader:
|
|
1379
|
+
loader: core_namespaceObject.rspack.CssExtractRspackPlugin.loader,
|
|
1479
1380
|
options: {
|
|
1480
1381
|
defaultExport: !0
|
|
1481
1382
|
}
|
|
@@ -1504,7 +1405,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1504
1405
|
}
|
|
1505
1406
|
}
|
|
1506
1407
|
].filter(Boolean);
|
|
1507
|
-
|
|
1408
|
+
utils_isDevServer() || config.plugins.push(new core_namespaceObject.rspack.CssExtractRspackPlugin({
|
|
1508
1409
|
filename: getOutputFilename({
|
|
1509
1410
|
type: 'css',
|
|
1510
1411
|
hash: null == (_unpackConfig_build1 = unpackConfig.build) ? void 0 : _unpackConfig_build1.filenameHash
|
|
@@ -1514,12 +1415,30 @@ for(var __webpack_i__ in (()=>{
|
|
|
1514
1415
|
hash: null == (_unpackConfig_build2 = unpackConfig.build) ? void 0 : _unpackConfig_build2.filenameHash,
|
|
1515
1416
|
async: !0
|
|
1516
1417
|
})
|
|
1517
|
-
}))
|
|
1418
|
+
}));
|
|
1419
|
+
let getCssLoader = ()=>{
|
|
1420
|
+
var _unpackConfig_css, _unpackConfig_css1, _unpackConfig_css2;
|
|
1421
|
+
return (null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.transformer) === 'lightningcss' ? {
|
|
1422
|
+
loader: 'builtin:lightningcss-loader',
|
|
1423
|
+
options: {
|
|
1424
|
+
targets: DEFAULT_BROWSERSLIST,
|
|
1425
|
+
...null == (_unpackConfig_css1 = unpackConfig.css) ? void 0 : _unpackConfig_css1.lightningcss
|
|
1426
|
+
}
|
|
1427
|
+
} : {
|
|
1428
|
+
loader: getCompiledPkgPath('postcss-loader'),
|
|
1429
|
+
options: {
|
|
1430
|
+
postcssOptions: null == (_unpackConfig_css2 = unpackConfig.css) ? void 0 : _unpackConfig_css2.postcss,
|
|
1431
|
+
sourceMap
|
|
1432
|
+
}
|
|
1433
|
+
};
|
|
1434
|
+
};
|
|
1435
|
+
return config.module.rules.push({
|
|
1518
1436
|
test: /\.less$/i,
|
|
1519
1437
|
use: [
|
|
1520
1438
|
...getCommonRules({
|
|
1521
|
-
importLoaders:
|
|
1439
|
+
importLoaders: 2
|
|
1522
1440
|
}),
|
|
1441
|
+
getCssLoader(),
|
|
1523
1442
|
(null == (_unpackConfig_build = unpackConfig.build) ? void 0 : _unpackConfig_build.parallel) && isProd() && {
|
|
1524
1443
|
loader: require.resolve('thread-loader'),
|
|
1525
1444
|
options: THREAD_OPTIONS
|
|
@@ -1535,32 +1454,21 @@ for(var __webpack_i__ in (()=>{
|
|
|
1535
1454
|
}
|
|
1536
1455
|
}
|
|
1537
1456
|
].filter(Boolean)
|
|
1538
|
-
}),
|
|
1457
|
+
}), config.module.rules.push({
|
|
1539
1458
|
test: /\.css$/i,
|
|
1540
1459
|
use: [
|
|
1541
1460
|
...getCommonRules({
|
|
1542
1461
|
importLoaders: 1
|
|
1543
1462
|
}),
|
|
1544
|
-
(
|
|
1545
|
-
loader: external_node_path_default().resolve(__dirname, './lightningcssLoader.mjs'),
|
|
1546
|
-
options: mergeConfig((null == (_unpackConfig_css5 = unpackConfig.css) ? void 0 : _unpackConfig_css5.lightningcss) || {}, {
|
|
1547
|
-
sourceMap,
|
|
1548
|
-
targets: DEFAULT_LIGHTNINGCSS_TARGET
|
|
1549
|
-
})
|
|
1550
|
-
} : {
|
|
1551
|
-
loader: getCompiledPkgPath('postcss-loader'),
|
|
1552
|
-
options: {
|
|
1553
|
-
postcssOptions: null == (_unpackConfig_css6 = unpackConfig.css) ? void 0 : _unpackConfig_css6.postcss,
|
|
1554
|
-
sourceMap
|
|
1555
|
-
}
|
|
1556
|
-
}
|
|
1463
|
+
getCssLoader()
|
|
1557
1464
|
]
|
|
1558
|
-
}),
|
|
1465
|
+
}), config.module.rules.push({
|
|
1559
1466
|
test: /\.s[ac]ss$/i,
|
|
1560
1467
|
use: [
|
|
1561
1468
|
...getCommonRules({
|
|
1562
|
-
importLoaders:
|
|
1469
|
+
importLoaders: 2
|
|
1563
1470
|
}),
|
|
1471
|
+
getCssLoader(),
|
|
1564
1472
|
{
|
|
1565
1473
|
loader: getCompiledPkgPath('sass-loader'),
|
|
1566
1474
|
options: {
|
|
@@ -1594,7 +1502,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1594
1502
|
}) : mergeConfig(config, unpackConfig.bundlerConfig)), config;
|
|
1595
1503
|
}
|
|
1596
1504
|
async function unpackBuild(unpackConfig) {
|
|
1597
|
-
let
|
|
1505
|
+
let config = await getBundlerConfig(unpackConfig), compiler = (0, core_namespaceObject.rspack)(config), handler = (err, stats)=>{
|
|
1598
1506
|
if (err) {
|
|
1599
1507
|
console.error(err.stack || err), err.details && console.error(err.details);
|
|
1600
1508
|
return;
|
|
@@ -1606,8 +1514,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1606
1514
|
};
|
|
1607
1515
|
isWatch() ? compiler.watch({}, handler) : compiler.run(handler);
|
|
1608
1516
|
}
|
|
1609
|
-
let restartCleaners = []
|
|
1610
|
-
var external_open_default = __webpack_require__.n(external_open_namespaceObject);
|
|
1517
|
+
let restartCleaners = [];
|
|
1611
1518
|
async function openBrowser(url) {
|
|
1612
1519
|
if ('darwin' === process.platform) try {
|
|
1613
1520
|
let ps = await execAsync('ps cax'), openedBrowser = [
|
|
@@ -1627,7 +1534,39 @@ for(var __webpack_i__ in (()=>{
|
|
|
1627
1534
|
logger_logger.error(err);
|
|
1628
1535
|
}
|
|
1629
1536
|
try {
|
|
1630
|
-
|
|
1537
|
+
var url1;
|
|
1538
|
+
return (url1 = url, new Promise((resolve, reject)=>{
|
|
1539
|
+
let command, args = [];
|
|
1540
|
+
switch((0, external_node_os_namespaceObject.platform)()){
|
|
1541
|
+
case 'darwin':
|
|
1542
|
+
command = 'open', args = [
|
|
1543
|
+
url1
|
|
1544
|
+
];
|
|
1545
|
+
break;
|
|
1546
|
+
case 'win32':
|
|
1547
|
+
command = 'cmd', args = [
|
|
1548
|
+
'/c',
|
|
1549
|
+
'start',
|
|
1550
|
+
'',
|
|
1551
|
+
url1
|
|
1552
|
+
];
|
|
1553
|
+
break;
|
|
1554
|
+
default:
|
|
1555
|
+
command = 'xdg-open', args = [
|
|
1556
|
+
url1
|
|
1557
|
+
];
|
|
1558
|
+
}
|
|
1559
|
+
let child = (0, external_node_child_process_namespaceObject.spawn)(command, args, {
|
|
1560
|
+
stdio: 'ignore',
|
|
1561
|
+
detached: !0,
|
|
1562
|
+
windowsHide: !0
|
|
1563
|
+
});
|
|
1564
|
+
child.on('error', (error)=>{
|
|
1565
|
+
reject(Error(`Failed to open URL: ${error.message}`));
|
|
1566
|
+
}), child.on('spawn', ()=>{
|
|
1567
|
+
resolve();
|
|
1568
|
+
}), child.unref();
|
|
1569
|
+
})).catch(()=>{}), !0;
|
|
1631
1570
|
} catch (err) {
|
|
1632
1571
|
return logger_logger.error(err), !1;
|
|
1633
1572
|
}
|
|
@@ -1818,7 +1757,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1818
1757
|
let port = await getPort(), staticServer = app.listen(port, ()=>{});
|
|
1819
1758
|
restartCleaners.push(()=>new Promise((resolve)=>staticServer.close(()=>resolve())));
|
|
1820
1759
|
let externals = {}, jsAssets = [], cssAssets = [], preJsAssets = [];
|
|
1821
|
-
bundledDeps.filter(Boolean).forEach((dep)=>{
|
|
1760
|
+
return bundledDeps.filter(Boolean).forEach((dep)=>{
|
|
1822
1761
|
dep && (externals[dep.name] = getExternalValue(dep.name), dep.assets.forEach((absPath)=>{
|
|
1823
1762
|
let relativePath = external_node_path_default().relative(cachePath, absPath), preDeps = [
|
|
1824
1763
|
'react',
|
|
@@ -1842,16 +1781,14 @@ for(var __webpack_i__ in (()=>{
|
|
|
1842
1781
|
] : {
|
|
1843
1782
|
...externals,
|
|
1844
1783
|
...unpackConfig.externals
|
|
1845
|
-
}
|
|
1846
|
-
let HtmlPlugin = 'rspack' === unpackConfig.bundler ? core_namespaceObject.rspack.HtmlRspackPlugin : external_html_webpack_plugin_default();
|
|
1847
|
-
return unpackConfig.plugins.push({
|
|
1784
|
+
}, unpackConfig.plugins.push({
|
|
1848
1785
|
name: 'unpack:prebundle',
|
|
1849
1786
|
bundlerConfig: (config)=>{
|
|
1850
1787
|
let PLUGIN_NAME = 'PluginInjectAssets';
|
|
1851
1788
|
return config.plugins.push({
|
|
1852
1789
|
apply: (compiler)=>{
|
|
1853
1790
|
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation)=>{
|
|
1854
|
-
|
|
1791
|
+
core_namespaceObject.rspack.HtmlRspackPlugin.getCompilationHooks(compilation).beforeAssetTagGeneration.tapPromise(PLUGIN_NAME, async (args)=>{
|
|
1855
1792
|
let sortedPreJsAssets = preJsAssets.sort((a, b)=>a.order - b.order).map((item)=>item.path);
|
|
1856
1793
|
return args.assets.js.unshift(...sortedPreJsAssets, ...jsAssets), args.assets.css.unshift(...cssAssets), args;
|
|
1857
1794
|
});
|
|
@@ -1864,11 +1801,11 @@ for(var __webpack_i__ in (()=>{
|
|
|
1864
1801
|
var external_webpack_dev_server_default = __webpack_require__.n(external_webpack_dev_server_namespaceObject);
|
|
1865
1802
|
async function unpackDev(originalUnpackConfig) {
|
|
1866
1803
|
var _unpackConfig_dev, _unpackConfig_server, _unpackConfig_server1, _unpackConfig_dev1, _unpackConfig_server2;
|
|
1867
|
-
let unpackConfig = originalUnpackConfig
|
|
1804
|
+
let unpackConfig = originalUnpackConfig;
|
|
1868
1805
|
(null == (_unpackConfig_dev = unpackConfig.dev) ? void 0 : _unpackConfig_dev.prebundle) && (unpackConfig = await prebundleDeps({
|
|
1869
1806
|
unpackConfig
|
|
1870
1807
|
}));
|
|
1871
|
-
let
|
|
1808
|
+
let config = await getBundlerConfig(unpackConfig), compiler = (0, core_namespaceObject.rspack)(config), port = await getPort(null == (_unpackConfig_server = unpackConfig.server) ? void 0 : _unpackConfig_server.port), proxyConfig = null == (_unpackConfig_server1 = unpackConfig.server) ? void 0 : _unpackConfig_server1.proxy;
|
|
1872
1809
|
isPlainObject(proxyConfig) && (proxyConfig = Object.entries(proxyConfig).map(([contextStr, target])=>({
|
|
1873
1810
|
context: contextStr.split(','),
|
|
1874
1811
|
target,
|
|
@@ -1889,9 +1826,9 @@ for(var __webpack_i__ in (()=>{
|
|
|
1889
1826
|
devServerOptions.setupMiddlewares = (middlewares)=>(middlewares.unshift((req, _, next)=>{
|
|
1890
1827
|
var _req_headers_accept;
|
|
1891
1828
|
(null == (_req_headers_accept = req.headers.accept) ? void 0 : _req_headers_accept.includes('html')) && (req.url = '/index.html'), next();
|
|
1892
|
-
}),
|
|
1829
|
+
}), middlewares.unshift(core_namespaceObject.experiments.lazyCompilationMiddleware(compiler)), middlewares);
|
|
1893
1830
|
let server = new (external_webpack_dev_server_default())(devServerOptions, compiler);
|
|
1894
|
-
await server.start(), logger_logger.greet(` ${colors.green(`${colors.bold(unpackConfig._context.callerName.toUpperCase())}
|
|
1831
|
+
await server.start(), logger_logger.greet(` ${colors.green(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v3.0.0`)} ${colors.dim(`ready in ${colors.reset(Math.ceil(performance.now() - global.__unpack_start_time))}ms`)}\n`), function(port) {
|
|
1895
1832
|
let addressUrls = getAddressUrls({
|
|
1896
1833
|
port
|
|
1897
1834
|
});
|
|
@@ -1911,7 +1848,6 @@ for(var __webpack_i__ in (()=>{
|
|
|
1911
1848
|
function createUnpack({ cwd = process.cwd(), config, callerName = 'unpack' }) {
|
|
1912
1849
|
let resolveConfig = async ()=>{
|
|
1913
1850
|
let defaultConfig = {
|
|
1914
|
-
bundler: 'rspack',
|
|
1915
1851
|
root: cwd,
|
|
1916
1852
|
build: {
|
|
1917
1853
|
outDir: 'dist',
|
|
@@ -1945,7 +1881,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1945
1881
|
]
|
|
1946
1882
|
}, _context = {
|
|
1947
1883
|
callerName,
|
|
1948
|
-
version: "
|
|
1884
|
+
version: "3.0.0"
|
|
1949
1885
|
}, { plugins, bundlerConfig, ...rest } = mergeConfig(defaultConfig, config);
|
|
1950
1886
|
for (let plugin of getNormalizedPluginsByHook('config', plugins))rest = await plugin.config(rest, {
|
|
1951
1887
|
..._context,
|
|
@@ -1960,10 +1896,9 @@ for(var __webpack_i__ in (()=>{
|
|
|
1960
1896
|
};
|
|
1961
1897
|
return {
|
|
1962
1898
|
build: async ({ watch } = {})=>{
|
|
1963
|
-
var _config_build;
|
|
1964
1899
|
setNodeEnv(watch ? 'development' : 'production');
|
|
1965
1900
|
let config = await resolveConfig();
|
|
1966
|
-
console.log(colors.rainbow(`${callerName}
|
|
1901
|
+
console.log(colors.rainbow(`${callerName} v3.0.0`), colors.green(`building for ${getNodeEnv()}...`)), unpackBuild(config);
|
|
1967
1902
|
},
|
|
1968
1903
|
dev: async ()=>{
|
|
1969
1904
|
global.__unpack_start_time = performance.now(), setNodeEnv('development'), setDevServer(!0), unpackDev(await resolveConfig());
|
|
@@ -1988,17 +1923,15 @@ for(var __webpack_i__ in (()=>{
|
|
|
1988
1923
|
...options
|
|
1989
1924
|
});
|
|
1990
1925
|
}
|
|
1991
|
-
})(), exports.CSS_MODULES_LOCAL_IDENT_NAME = __webpack_exports__.CSS_MODULES_LOCAL_IDENT_NAME, exports.CSS_MODULES_REGEX = __webpack_exports__.CSS_MODULES_REGEX, exports.CSS_NAMED_EXPORT = __webpack_exports__.CSS_NAMED_EXPORT, exports.DEFAULT_BROWSERSLIST = __webpack_exports__.DEFAULT_BROWSERSLIST, exports.DEFAULT_DEV_HOST = __webpack_exports__.DEFAULT_DEV_HOST, exports.DEFAULT_ES_TARGET = __webpack_exports__.DEFAULT_ES_TARGET, exports.
|
|
1926
|
+
})(), exports.CSS_MODULES_LOCAL_IDENT_NAME = __webpack_exports__.CSS_MODULES_LOCAL_IDENT_NAME, exports.CSS_MODULES_REGEX = __webpack_exports__.CSS_MODULES_REGEX, exports.CSS_NAMED_EXPORT = __webpack_exports__.CSS_NAMED_EXPORT, exports.DEFAULT_BROWSERSLIST = __webpack_exports__.DEFAULT_BROWSERSLIST, exports.DEFAULT_DEV_HOST = __webpack_exports__.DEFAULT_DEV_HOST, exports.DEFAULT_ES_TARGET = __webpack_exports__.DEFAULT_ES_TARGET, exports.DEV_DEFAULT_FILENAME = __webpack_exports__.DEV_DEFAULT_FILENAME, exports.EXPORT_LOCALS_CONVENTION = __webpack_exports__.EXPORT_LOCALS_CONVENTION, exports.LogColor = __webpack_exports__.LogColor, exports.NODE_MODULES_REGEX = __webpack_exports__.NODE_MODULES_REGEX, exports.PROD_DEFAULT_FILENAME = __webpack_exports__.PROD_DEFAULT_FILENAME, exports.TEMPLATE_CONTENT = __webpack_exports__.TEMPLATE_CONTENT, exports.TEMP_DIR = __webpack_exports__.TEMP_DIR, exports.THREAD_OPTIONS = __webpack_exports__.THREAD_OPTIONS, exports.clearLine = __webpack_exports__.clearLine, exports.colors = __webpack_exports__.colors, exports.createChokidar = __webpack_exports__.createChokidar, exports.createUnpack = __webpack_exports__.createUnpack, exports.debounce = __webpack_exports__.debounce, exports.defineConfig = __webpack_exports__.defineConfig, exports.findExists = __webpack_exports__.findExists, exports.getAddressUrls = __webpack_exports__.getAddressUrls, exports.getCompiledPkgPath = __webpack_exports__.getCompiledPkgPath, exports.getIpv4Interfaces = __webpack_exports__.getIpv4Interfaces, exports.getNodeEnv = __webpack_exports__.getNodeEnv, exports.getPathInJs = __webpack_exports__.getPathInJs, exports.getPort = __webpack_exports__.getPort, exports.getTime = __webpack_exports__.getTime, exports.getUserDepPath = __webpack_exports__.getUserDepPath, exports.getUserDepVersion = __webpack_exports__.getUserDepVersion, exports.getValueByPath = __webpack_exports__.getValueByPath, exports.isBoolean = __webpack_exports__.isBoolean, exports.isCI = __webpack_exports__.isCI, exports.isCSSModules = __webpack_exports__.isCSSModules, exports.isDebug = __webpack_exports__.isDebug, exports.isDev = __webpack_exports__.isDev, exports.isDevServer = __webpack_exports__.isDevServer, exports.isEmptyDir = __webpack_exports__.isEmptyDir, exports.isFileExists = __webpack_exports__.isFileExists, exports.isFileSync = __webpack_exports__.isFileSync, exports.isFunction = __webpack_exports__.isFunction, exports.isNodeVersionAtLeast = __webpack_exports__.isNodeVersionAtLeast, exports.isObject = __webpack_exports__.isObject, exports.isPlainObject = __webpack_exports__.isPlainObject, exports.isProd = __webpack_exports__.isProd, exports.isRegExp = __webpack_exports__.isRegExp, exports.isString = __webpack_exports__.isString, exports.isUndefined = __webpack_exports__.isUndefined, exports.isWatch = __webpack_exports__.isWatch, exports.isWin = __webpack_exports__.isWin, exports.loadConfig = __webpack_exports__.loadConfig, exports.logUpdate = __webpack_exports__.logUpdate, exports.logger = __webpack_exports__.logger, exports.mergeConfig = __webpack_exports__.mergeConfig, exports.pathExists = __webpack_exports__.pathExists, exports.prettyTime = __webpack_exports__.prettyTime, exports.removeDir = __webpack_exports__.removeDir, exports.resolveConfigPath = __webpack_exports__.resolveConfigPath, exports.restartCleaners = __webpack_exports__.restartCleaners, exports.rspack = __webpack_exports__.rspack, exports.setDevServer = __webpack_exports__.setDevServer, exports.setNodeEnv = __webpack_exports__.setNodeEnv, exports.setValueByPath = __webpack_exports__.setValueByPath, exports.trackPerformance = __webpack_exports__.trackPerformance, __webpack_exports__)-1 === [
|
|
1992
1927
|
"CSS_MODULES_LOCAL_IDENT_NAME",
|
|
1993
1928
|
"CSS_MODULES_REGEX",
|
|
1994
1929
|
"CSS_NAMED_EXPORT",
|
|
1995
1930
|
"DEFAULT_BROWSERSLIST",
|
|
1996
1931
|
"DEFAULT_DEV_HOST",
|
|
1997
1932
|
"DEFAULT_ES_TARGET",
|
|
1998
|
-
"DEFAULT_LIGHTNINGCSS_TARGET",
|
|
1999
1933
|
"DEV_DEFAULT_FILENAME",
|
|
2000
1934
|
"EXPORT_LOCALS_CONVENTION",
|
|
2001
|
-
"HtmlWebpackPlugin",
|
|
2002
1935
|
"LogColor",
|
|
2003
1936
|
"NODE_MODULES_REGEX",
|
|
2004
1937
|
"PROD_DEFAULT_FILENAME",
|
|
@@ -2054,8 +1987,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
2054
1987
|
"setDevServer",
|
|
2055
1988
|
"setNodeEnv",
|
|
2056
1989
|
"setValueByPath",
|
|
2057
|
-
"trackPerformance"
|
|
2058
|
-
"webpack"
|
|
1990
|
+
"trackPerformance"
|
|
2059
1991
|
].indexOf(__webpack_i__) && (exports[__webpack_i__] = __webpack_exports__[__webpack_i__]);
|
|
2060
1992
|
Object.defineProperty(exports, '__esModule', {
|
|
2061
1993
|
value: !0
|