@unpackjs/core 2.4.4 → 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/compiled/css-loader/index.js +20 -20
- package/compiled/less-loader/index.js +8 -8
- package/compiled/postcss-loader/index.js +8 -8
- package/compiled/sass-loader/index.js +8 -8
- package/compiled/style-loader/index.js +10 -10
- package/dist/index.cjs +177 -232
- package/dist/index.js +173 -221
- 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} +4 -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 +8 -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 +4 -10
- 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;
|
|
@@ -385,7 +375,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
385
375
|
}
|
|
386
376
|
function resolveConfigPath(root, customConfig) {
|
|
387
377
|
if (customConfig) {
|
|
388
|
-
let customConfigPath = (
|
|
378
|
+
let customConfigPath = external_node_path_default().resolve(root, customConfig);
|
|
389
379
|
if (external_node_fs_default().existsSync(customConfigPath)) return customConfigPath;
|
|
390
380
|
logger_logger.warn(`could not find config file: ${customConfigPath}`);
|
|
391
381
|
}
|
|
@@ -397,7 +387,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
397
387
|
'unpack.config.mts',
|
|
398
388
|
'unpack.config.cts'
|
|
399
389
|
]){
|
|
400
|
-
let configFile = (
|
|
390
|
+
let configFile = external_node_path_default().join(root, file);
|
|
401
391
|
if (external_node_fs_default().existsSync(configFile)) return configFile;
|
|
402
392
|
}
|
|
403
393
|
return null;
|
|
@@ -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().
|
|
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");
|
|
@@ -520,7 +502,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
520
502
|
return {
|
|
521
503
|
...defaultConfig,
|
|
522
504
|
minSize: 0,
|
|
523
|
-
maxInitialRequests:
|
|
505
|
+
maxInitialRequests: 1 / 0,
|
|
524
506
|
cacheGroups: {
|
|
525
507
|
...defaultConfig.cacheGroups,
|
|
526
508
|
...forceSplittingGroups,
|
|
@@ -546,7 +528,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
546
528
|
return external_node_assert_default()('split-by-size' === chunkSplit.strategy), {
|
|
547
529
|
...defaultConfig,
|
|
548
530
|
minSize: chunkSplit.minSize ?? 0,
|
|
549
|
-
maxSize: chunkSplit.maxSize ??
|
|
531
|
+
maxSize: chunkSplit.maxSize ?? 1 / 0,
|
|
550
532
|
cacheGroups: {
|
|
551
533
|
...defaultConfig.cacheGroups,
|
|
552
534
|
...forceSplittingGroups
|
|
@@ -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, {
|
|
@@ -864,14 +800,10 @@ for(var __webpack_i__ in (()=>{
|
|
|
864
800
|
}
|
|
865
801
|
class ProgressBar {
|
|
866
802
|
update({ current: originalCurrent, message = '' }) {
|
|
867
|
-
if (isCI()) return;
|
|
868
803
|
let { columns: terminalWidth } = process.stdout, current = originalCurrent;
|
|
869
804
|
originalCurrent >= 0.98 && (current = 1);
|
|
870
805
|
let loadingChar = this.loadingAnimation.getCurrentChar(), messageWidth = terminalWidth - this.prefix.length - (1 === current ? 10 : 9);
|
|
871
|
-
logUpdate(`${loadingChar} ${this.prefix} (${Math.floor(100 * current)}%) ${colors.dim(message.slice(0, messageWidth).padEnd(messageWidth, ' '))}`);
|
|
872
|
-
}
|
|
873
|
-
done() {
|
|
874
|
-
console.log();
|
|
806
|
+
logUpdate(`${loadingChar} ${this.prefix} (${Math.floor(100 * current)}%) ${colors.dim(message.slice(0, messageWidth).padEnd(messageWidth, ' '))}`), 1 === current && clearLine();
|
|
875
807
|
}
|
|
876
808
|
constructor(){
|
|
877
809
|
progressBar_define_property(this, "prefix", 'transforming'), progressBar_define_property(this, "loadingAnimation", new LoadingAnimation());
|
|
@@ -1009,12 +941,23 @@ for(var __webpack_i__ in (()=>{
|
|
|
1009
941
|
logger_logger.ready(`built in ${prettyTime(compileTime)}${isDebug() ? ` (${stats.compilation.modules.size} modules)` : ''}`);
|
|
1010
942
|
}
|
|
1011
943
|
}
|
|
1012
|
-
let
|
|
944
|
+
let progress_PLUGIN_NAME = 'ProgressPlugin';
|
|
945
|
+
class ProgressLiteRspackPlugin {
|
|
946
|
+
apply(compiler) {
|
|
947
|
+
compiler.hooks.watchRun.tap(progress_PLUGIN_NAME, ()=>{
|
|
948
|
+
(!utils_isDevServer() || global.__unpack_dev_server_started) && printDevLog(compiler, compiler.options.context);
|
|
949
|
+
}), compiler.hooks.run.tap(progress_PLUGIN_NAME, ()=>{
|
|
950
|
+
logger_logger.info('build started...');
|
|
951
|
+
}), compiler.hooks.afterDone.tap(progress_PLUGIN_NAME, async (stats)=>{
|
|
952
|
+
await compileDone(compiler, stats);
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
}
|
|
1013
956
|
class ProgressRspackPlugin extends core_namespaceObject.rspack.ProgressPlugin {
|
|
1014
957
|
apply(compiler) {
|
|
1015
|
-
super.apply(compiler), compiler.hooks.watchRun.tap(
|
|
958
|
+
super.apply(compiler), compiler.hooks.watchRun.tap(progress_PLUGIN_NAME, ()=>{
|
|
1016
959
|
(!utils_isDevServer() || global.__unpack_dev_server_started) && printDevLog(compiler, compiler.options.context);
|
|
1017
|
-
}), compiler.hooks.afterDone.tap(
|
|
960
|
+
}), compiler.hooks.afterDone.tap(progress_PLUGIN_NAME, async (stats)=>{
|
|
1018
961
|
await compileDone(compiler, stats);
|
|
1019
962
|
});
|
|
1020
963
|
}
|
|
@@ -1034,41 +977,10 @@ for(var __webpack_i__ in (()=>{
|
|
|
1034
977
|
}(this, "progressBar", new ProgressBar());
|
|
1035
978
|
}
|
|
1036
979
|
}
|
|
1037
|
-
function webpack_define_property(obj, key, value) {
|
|
1038
|
-
return key in obj ? Object.defineProperty(obj, key, {
|
|
1039
|
-
value: value,
|
|
1040
|
-
enumerable: !0,
|
|
1041
|
-
configurable: !0,
|
|
1042
|
-
writable: !0
|
|
1043
|
-
}) : obj[key] = value, obj;
|
|
1044
|
-
}
|
|
1045
|
-
let webpack_PLUGIN_NAME = 'ProgressPlugin';
|
|
1046
|
-
class ProgressWebpackPlugin extends external_webpack_default().ProgressPlugin {
|
|
1047
|
-
apply(compiler) {
|
|
1048
|
-
super.apply(compiler), compiler.hooks.watchRun.tap(webpack_PLUGIN_NAME, ()=>{
|
|
1049
|
-
(!utils_isDevServer() || global.__unpack_dev_server_started) && printDevLog(compiler, compiler.options.context);
|
|
1050
|
-
}), compiler.hooks.afterDone.tap(webpack_PLUGIN_NAME, async (stats)=>{
|
|
1051
|
-
this.isCompleted = !0, await compileDone(compiler, stats);
|
|
1052
|
-
});
|
|
1053
|
-
}
|
|
1054
|
-
constructor(){
|
|
1055
|
-
super({
|
|
1056
|
-
entries: !1,
|
|
1057
|
-
dependencies: !1,
|
|
1058
|
-
activeModules: !0,
|
|
1059
|
-
handler: isProd() ? (percentage, msg, ...args)=>{
|
|
1060
|
-
this.isCompleted || this.progressBar.update({
|
|
1061
|
-
current: percentage,
|
|
1062
|
-
message: `${msg} ${args.join(' ').replace(/(\d+) active /, '')}`
|
|
1063
|
-
});
|
|
1064
|
-
} : void 0
|
|
1065
|
-
}), webpack_define_property(this, "progressBar", new ProgressBar()), webpack_define_property(this, "isCompleted", !1);
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
980
|
let BundleAnalyzerPlugin = __webpack_require__("compiled/webpack-bundle-analyzer").BundleAnalyzerPlugin;
|
|
1069
981
|
async function getBundlerConfig(unpackConfig) {
|
|
1070
|
-
var _unpackConfig_build, _unpackConfig_build1,
|
|
1071
|
-
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 = [
|
|
1072
984
|
'PUBLIC_'
|
|
1073
985
|
], processEnv = process.env } = {}) {
|
|
1074
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.`);
|
|
@@ -1123,7 +1035,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1123
1035
|
stats: 'errors-only',
|
|
1124
1036
|
output: {
|
|
1125
1037
|
clean: !0,
|
|
1126
|
-
path: external_node_path_default().resolve(unpackConfig.root,
|
|
1038
|
+
path: external_node_path_default().resolve(unpackConfig.root, unpackConfig.build.outDir),
|
|
1127
1039
|
filename: getOutputFilename({
|
|
1128
1040
|
type: 'js',
|
|
1129
1041
|
hash: null == (_unpackConfig_build3 = unpackConfig.build) ? void 0 : _unpackConfig_build3.filenameHash
|
|
@@ -1164,23 +1076,23 @@ for(var __webpack_i__ in (()=>{
|
|
|
1164
1076
|
]
|
|
1165
1077
|
},
|
|
1166
1078
|
plugins: [
|
|
1167
|
-
(
|
|
1079
|
+
new core_namespaceObject.rspack.DefinePlugin({
|
|
1168
1080
|
'import.meta.env.MODE': JSON.stringify(getNodeEnv()),
|
|
1169
1081
|
'import.meta.env.DEV': isDev(),
|
|
1170
1082
|
'import.meta.env.PROD': isProd(),
|
|
1171
1083
|
...publicVars,
|
|
1172
1084
|
...unpackConfig.define
|
|
1173
|
-
}
|
|
1174
|
-
!unpackConfig.mpa && new
|
|
1175
|
-
template: (null == (_unpackConfig_html = unpackConfig.html) ? void 0 : _unpackConfig_html.template) ||
|
|
1176
|
-
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),
|
|
1177
1089
|
templateParameters: {
|
|
1178
|
-
mountId:
|
|
1179
|
-
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({
|
|
1180
1092
|
entryName: 'index'
|
|
1181
|
-
}) : (null == (
|
|
1182
|
-
headTag: (null == (
|
|
1183
|
-
...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
|
|
1184
1096
|
},
|
|
1185
1097
|
minify: !1,
|
|
1186
1098
|
chunks: [
|
|
@@ -1190,11 +1102,11 @@ for(var __webpack_i__ in (()=>{
|
|
|
1190
1102
|
(null == (_unpackConfig_performance = unpackConfig.performance) ? void 0 : _unpackConfig_performance.bundleAnalyze) && isProd() && new BundleAnalyzerPlugin({
|
|
1191
1103
|
analyzerPort: 'auto'
|
|
1192
1104
|
}),
|
|
1193
|
-
(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({
|
|
1194
1106
|
resourceRegExp: /^\.\/locale$/,
|
|
1195
1107
|
contextRegExp: /moment$/
|
|
1196
1108
|
}),
|
|
1197
|
-
(null == (_unpackConfig_build7 = unpackConfig.build) ? void 0 : _unpackConfig_build7.copy) && new
|
|
1109
|
+
(null == (_unpackConfig_build7 = unpackConfig.build) ? void 0 : _unpackConfig_build7.copy) && new core_namespaceObject.rspack.CopyRspackPlugin({
|
|
1198
1110
|
patterns: unpackConfig.build.copy
|
|
1199
1111
|
}),
|
|
1200
1112
|
unpackConfig.typeCheck && isDev() && isTs && new external_ts_checker_rspack_plugin_namespaceObject.TsCheckerRspackPlugin({
|
|
@@ -1222,7 +1134,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1222
1134
|
}
|
|
1223
1135
|
}
|
|
1224
1136
|
}),
|
|
1225
|
-
new (
|
|
1137
|
+
new ProgressPlugin(),
|
|
1226
1138
|
unpackConfig.lint && new OxlintPlugin()
|
|
1227
1139
|
].filter(Boolean),
|
|
1228
1140
|
externals: unpackConfig.externals,
|
|
@@ -1269,17 +1181,16 @@ for(var __webpack_i__ in (()=>{
|
|
|
1269
1181
|
moduleIds: isDev() ? 'named' : 'deterministic',
|
|
1270
1182
|
minimize: !!(null == (_unpackConfig_build8 = unpackConfig.build) ? void 0 : _unpackConfig_build8.minify),
|
|
1271
1183
|
minimizer: [
|
|
1272
|
-
new JsMinifyPlugin({
|
|
1273
|
-
...minifyOptions.oxc,
|
|
1184
|
+
new JsMinifyPlugin(mergeConfig({
|
|
1274
1185
|
compress: {
|
|
1275
|
-
target: DEFAULT_ES_TARGET
|
|
1276
|
-
...oxcMinifyCompress
|
|
1186
|
+
target: DEFAULT_ES_TARGET
|
|
1277
1187
|
}
|
|
1278
|
-
}),
|
|
1279
|
-
new
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1188
|
+
}, minifyOptions.oxc || {})),
|
|
1189
|
+
new core_namespaceObject.rspack.LightningCssMinimizerRspackPlugin(mergeConfig({
|
|
1190
|
+
minimizerOptions: {
|
|
1191
|
+
targets: DEFAULT_BROWSERSLIST
|
|
1192
|
+
}
|
|
1193
|
+
}, minifyOptions.lightningcss || {}))
|
|
1283
1194
|
]
|
|
1284
1195
|
},
|
|
1285
1196
|
watchOptions: {
|
|
@@ -1317,7 +1228,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1317
1228
|
return config;
|
|
1318
1229
|
})({
|
|
1319
1230
|
config: config = (null == (_unpackConfig_experiments = unpackConfig.experiments) ? void 0 : _unpackConfig_experiments.css) ? function({ config, unpackConfig }) {
|
|
1320
|
-
var _unpackConfig_build, _unpackConfig_build1, _unpackConfig_css, _unpackConfig_css1
|
|
1231
|
+
var _unpackConfig_build, _unpackConfig_build1, _unpackConfig_css, _unpackConfig_css1;
|
|
1321
1232
|
config.output.cssFilename = getOutputFilename({
|
|
1322
1233
|
type: 'css',
|
|
1323
1234
|
hash: null == (_unpackConfig_build = unpackConfig.build) ? void 0 : _unpackConfig_build.filenameHash
|
|
@@ -1370,33 +1281,14 @@ for(var __webpack_i__ in (()=>{
|
|
|
1370
1281
|
sourceMap
|
|
1371
1282
|
}
|
|
1372
1283
|
};
|
|
1373
|
-
}
|
|
1374
|
-
null == (_config_module = config.module) || null == (_config_module_rules = _config_module.rules) || _config_module_rules.push({
|
|
1375
|
-
test: /\.less$/i,
|
|
1376
|
-
oneOf: [
|
|
1377
|
-
withCssModules({
|
|
1378
|
-
use: [
|
|
1379
|
-
getThreadLoader(),
|
|
1380
|
-
getLessLoader()
|
|
1381
|
-
].filter(Boolean)
|
|
1382
|
-
}),
|
|
1383
|
-
{
|
|
1384
|
-
use: [
|
|
1385
|
-
getThreadLoader(),
|
|
1386
|
-
getLessLoader()
|
|
1387
|
-
].filter(Boolean),
|
|
1388
|
-
type: 'css'
|
|
1389
|
-
}
|
|
1390
|
-
].filter(Boolean)
|
|
1391
|
-
});
|
|
1392
|
-
let getCssLoader = ()=>{
|
|
1284
|
+
}, getCssLoader = ()=>{
|
|
1393
1285
|
var _unpackConfig_css, _unpackConfig_css1, _unpackConfig_css2;
|
|
1394
1286
|
return (null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.transformer) === 'lightningcss' ? {
|
|
1395
|
-
loader:
|
|
1396
|
-
options:
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
}
|
|
1287
|
+
loader: 'builtin:lightningcss-loader',
|
|
1288
|
+
options: {
|
|
1289
|
+
targets: DEFAULT_BROWSERSLIST,
|
|
1290
|
+
...null == (_unpackConfig_css1 = unpackConfig.css) ? void 0 : _unpackConfig_css1.lightningcss
|
|
1291
|
+
}
|
|
1400
1292
|
} : {
|
|
1401
1293
|
loader: getCompiledPkgPath('postcss-loader'),
|
|
1402
1294
|
options: {
|
|
@@ -1404,8 +1296,22 @@ for(var __webpack_i__ in (()=>{
|
|
|
1404
1296
|
sourceMap
|
|
1405
1297
|
}
|
|
1406
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
|
+
};
|
|
1407
1313
|
};
|
|
1408
|
-
|
|
1314
|
+
return config.module.rules.push({
|
|
1409
1315
|
test: /\.css$/i,
|
|
1410
1316
|
oneOf: [
|
|
1411
1317
|
withCssModules({
|
|
@@ -1420,32 +1326,37 @@ for(var __webpack_i__ in (()=>{
|
|
|
1420
1326
|
type: 'css'
|
|
1421
1327
|
}
|
|
1422
1328
|
].filter(Boolean)
|
|
1423
|
-
})
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
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'
|
|
1436
1346
|
}
|
|
1437
|
-
|
|
1438
|
-
}
|
|
1439
|
-
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({
|
|
1440
1349
|
test: /\.s[ac]ss$/i,
|
|
1441
1350
|
oneOf: [
|
|
1442
1351
|
withCssModules({
|
|
1443
1352
|
use: [
|
|
1353
|
+
getCssLoader(),
|
|
1444
1354
|
getSassLoader()
|
|
1445
1355
|
]
|
|
1446
1356
|
}),
|
|
1447
1357
|
{
|
|
1448
1358
|
use: [
|
|
1359
|
+
getCssLoader(),
|
|
1449
1360
|
getSassLoader()
|
|
1450
1361
|
],
|
|
1451
1362
|
type: 'css'
|
|
@@ -1458,14 +1369,14 @@ for(var __webpack_i__ in (()=>{
|
|
|
1458
1369
|
config,
|
|
1459
1370
|
unpackConfig
|
|
1460
1371
|
}) : function({ config, unpackConfig }) {
|
|
1461
|
-
var _unpackConfig_css, _unpackConfig_css1, _unpackConfig_build, _unpackConfig_css2,
|
|
1462
|
-
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;
|
|
1463
1374
|
isPlainObject(modules) || !1 === modules || (modules = {});
|
|
1464
1375
|
let getCommonRules = ({ importLoaders })=>[
|
|
1465
1376
|
utils_isDevServer() ? {
|
|
1466
1377
|
loader: getCompiledPkgPath('style-loader')
|
|
1467
1378
|
} : {
|
|
1468
|
-
loader:
|
|
1379
|
+
loader: core_namespaceObject.rspack.CssExtractRspackPlugin.loader,
|
|
1469
1380
|
options: {
|
|
1470
1381
|
defaultExport: !0
|
|
1471
1382
|
}
|
|
@@ -1494,7 +1405,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1494
1405
|
}
|
|
1495
1406
|
}
|
|
1496
1407
|
].filter(Boolean);
|
|
1497
|
-
|
|
1408
|
+
utils_isDevServer() || config.plugins.push(new core_namespaceObject.rspack.CssExtractRspackPlugin({
|
|
1498
1409
|
filename: getOutputFilename({
|
|
1499
1410
|
type: 'css',
|
|
1500
1411
|
hash: null == (_unpackConfig_build1 = unpackConfig.build) ? void 0 : _unpackConfig_build1.filenameHash
|
|
@@ -1504,12 +1415,30 @@ for(var __webpack_i__ in (()=>{
|
|
|
1504
1415
|
hash: null == (_unpackConfig_build2 = unpackConfig.build) ? void 0 : _unpackConfig_build2.filenameHash,
|
|
1505
1416
|
async: !0
|
|
1506
1417
|
})
|
|
1507
|
-
}))
|
|
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({
|
|
1508
1436
|
test: /\.less$/i,
|
|
1509
1437
|
use: [
|
|
1510
1438
|
...getCommonRules({
|
|
1511
|
-
importLoaders:
|
|
1439
|
+
importLoaders: 2
|
|
1512
1440
|
}),
|
|
1441
|
+
getCssLoader(),
|
|
1513
1442
|
(null == (_unpackConfig_build = unpackConfig.build) ? void 0 : _unpackConfig_build.parallel) && isProd() && {
|
|
1514
1443
|
loader: require.resolve('thread-loader'),
|
|
1515
1444
|
options: THREAD_OPTIONS
|
|
@@ -1525,32 +1454,21 @@ for(var __webpack_i__ in (()=>{
|
|
|
1525
1454
|
}
|
|
1526
1455
|
}
|
|
1527
1456
|
].filter(Boolean)
|
|
1528
|
-
}),
|
|
1457
|
+
}), config.module.rules.push({
|
|
1529
1458
|
test: /\.css$/i,
|
|
1530
1459
|
use: [
|
|
1531
1460
|
...getCommonRules({
|
|
1532
1461
|
importLoaders: 1
|
|
1533
1462
|
}),
|
|
1534
|
-
(
|
|
1535
|
-
loader: external_node_path_default().resolve(__dirname, './lightningcssLoader.mjs'),
|
|
1536
|
-
options: mergeConfig((null == (_unpackConfig_css5 = unpackConfig.css) ? void 0 : _unpackConfig_css5.lightningcss) || {}, {
|
|
1537
|
-
sourceMap,
|
|
1538
|
-
targets: DEFAULT_LIGHTNINGCSS_TARGET
|
|
1539
|
-
})
|
|
1540
|
-
} : {
|
|
1541
|
-
loader: getCompiledPkgPath('postcss-loader'),
|
|
1542
|
-
options: {
|
|
1543
|
-
postcssOptions: null == (_unpackConfig_css6 = unpackConfig.css) ? void 0 : _unpackConfig_css6.postcss,
|
|
1544
|
-
sourceMap
|
|
1545
|
-
}
|
|
1546
|
-
}
|
|
1463
|
+
getCssLoader()
|
|
1547
1464
|
]
|
|
1548
|
-
}),
|
|
1465
|
+
}), config.module.rules.push({
|
|
1549
1466
|
test: /\.s[ac]ss$/i,
|
|
1550
1467
|
use: [
|
|
1551
1468
|
...getCommonRules({
|
|
1552
|
-
importLoaders:
|
|
1469
|
+
importLoaders: 2
|
|
1553
1470
|
}),
|
|
1471
|
+
getCssLoader(),
|
|
1554
1472
|
{
|
|
1555
1473
|
loader: getCompiledPkgPath('sass-loader'),
|
|
1556
1474
|
options: {
|
|
@@ -1584,7 +1502,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1584
1502
|
}) : mergeConfig(config, unpackConfig.bundlerConfig)), config;
|
|
1585
1503
|
}
|
|
1586
1504
|
async function unpackBuild(unpackConfig) {
|
|
1587
|
-
let
|
|
1505
|
+
let config = await getBundlerConfig(unpackConfig), compiler = (0, core_namespaceObject.rspack)(config), handler = (err, stats)=>{
|
|
1588
1506
|
if (err) {
|
|
1589
1507
|
console.error(err.stack || err), err.details && console.error(err.details);
|
|
1590
1508
|
return;
|
|
@@ -1596,8 +1514,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1596
1514
|
};
|
|
1597
1515
|
isWatch() ? compiler.watch({}, handler) : compiler.run(handler);
|
|
1598
1516
|
}
|
|
1599
|
-
let restartCleaners = []
|
|
1600
|
-
var external_open_default = __webpack_require__.n(external_open_namespaceObject);
|
|
1517
|
+
let restartCleaners = [];
|
|
1601
1518
|
async function openBrowser(url) {
|
|
1602
1519
|
if ('darwin' === process.platform) try {
|
|
1603
1520
|
let ps = await execAsync('ps cax'), openedBrowser = [
|
|
@@ -1617,7 +1534,39 @@ for(var __webpack_i__ in (()=>{
|
|
|
1617
1534
|
logger_logger.error(err);
|
|
1618
1535
|
}
|
|
1619
1536
|
try {
|
|
1620
|
-
|
|
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;
|
|
1621
1570
|
} catch (err) {
|
|
1622
1571
|
return logger_logger.error(err), !1;
|
|
1623
1572
|
}
|
|
@@ -1808,7 +1757,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1808
1757
|
let port = await getPort(), staticServer = app.listen(port, ()=>{});
|
|
1809
1758
|
restartCleaners.push(()=>new Promise((resolve)=>staticServer.close(()=>resolve())));
|
|
1810
1759
|
let externals = {}, jsAssets = [], cssAssets = [], preJsAssets = [];
|
|
1811
|
-
bundledDeps.filter(Boolean).forEach((dep)=>{
|
|
1760
|
+
return bundledDeps.filter(Boolean).forEach((dep)=>{
|
|
1812
1761
|
dep && (externals[dep.name] = getExternalValue(dep.name), dep.assets.forEach((absPath)=>{
|
|
1813
1762
|
let relativePath = external_node_path_default().relative(cachePath, absPath), preDeps = [
|
|
1814
1763
|
'react',
|
|
@@ -1832,16 +1781,14 @@ for(var __webpack_i__ in (()=>{
|
|
|
1832
1781
|
] : {
|
|
1833
1782
|
...externals,
|
|
1834
1783
|
...unpackConfig.externals
|
|
1835
|
-
}
|
|
1836
|
-
let HtmlPlugin = 'rspack' === unpackConfig.bundler ? core_namespaceObject.rspack.HtmlRspackPlugin : external_html_webpack_plugin_default();
|
|
1837
|
-
return unpackConfig.plugins.push({
|
|
1784
|
+
}, unpackConfig.plugins.push({
|
|
1838
1785
|
name: 'unpack:prebundle',
|
|
1839
1786
|
bundlerConfig: (config)=>{
|
|
1840
1787
|
let PLUGIN_NAME = 'PluginInjectAssets';
|
|
1841
1788
|
return config.plugins.push({
|
|
1842
1789
|
apply: (compiler)=>{
|
|
1843
1790
|
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation)=>{
|
|
1844
|
-
|
|
1791
|
+
core_namespaceObject.rspack.HtmlRspackPlugin.getCompilationHooks(compilation).beforeAssetTagGeneration.tapPromise(PLUGIN_NAME, async (args)=>{
|
|
1845
1792
|
let sortedPreJsAssets = preJsAssets.sort((a, b)=>a.order - b.order).map((item)=>item.path);
|
|
1846
1793
|
return args.assets.js.unshift(...sortedPreJsAssets, ...jsAssets), args.assets.css.unshift(...cssAssets), args;
|
|
1847
1794
|
});
|
|
@@ -1854,11 +1801,11 @@ for(var __webpack_i__ in (()=>{
|
|
|
1854
1801
|
var external_webpack_dev_server_default = __webpack_require__.n(external_webpack_dev_server_namespaceObject);
|
|
1855
1802
|
async function unpackDev(originalUnpackConfig) {
|
|
1856
1803
|
var _unpackConfig_dev, _unpackConfig_server, _unpackConfig_server1, _unpackConfig_dev1, _unpackConfig_server2;
|
|
1857
|
-
let unpackConfig = originalUnpackConfig
|
|
1804
|
+
let unpackConfig = originalUnpackConfig;
|
|
1858
1805
|
(null == (_unpackConfig_dev = unpackConfig.dev) ? void 0 : _unpackConfig_dev.prebundle) && (unpackConfig = await prebundleDeps({
|
|
1859
1806
|
unpackConfig
|
|
1860
1807
|
}));
|
|
1861
|
-
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;
|
|
1862
1809
|
isPlainObject(proxyConfig) && (proxyConfig = Object.entries(proxyConfig).map(([contextStr, target])=>({
|
|
1863
1810
|
context: contextStr.split(','),
|
|
1864
1811
|
target,
|
|
@@ -1879,9 +1826,9 @@ for(var __webpack_i__ in (()=>{
|
|
|
1879
1826
|
devServerOptions.setupMiddlewares = (middlewares)=>(middlewares.unshift((req, _, next)=>{
|
|
1880
1827
|
var _req_headers_accept;
|
|
1881
1828
|
(null == (_req_headers_accept = req.headers.accept) ? void 0 : _req_headers_accept.includes('html')) && (req.url = '/index.html'), next();
|
|
1882
|
-
}),
|
|
1829
|
+
}), middlewares.unshift(core_namespaceObject.experiments.lazyCompilationMiddleware(compiler)), middlewares);
|
|
1883
1830
|
let server = new (external_webpack_dev_server_default())(devServerOptions, compiler);
|
|
1884
|
-
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) {
|
|
1885
1832
|
let addressUrls = getAddressUrls({
|
|
1886
1833
|
port
|
|
1887
1834
|
});
|
|
@@ -1901,7 +1848,6 @@ for(var __webpack_i__ in (()=>{
|
|
|
1901
1848
|
function createUnpack({ cwd = process.cwd(), config, callerName = 'unpack' }) {
|
|
1902
1849
|
let resolveConfig = async ()=>{
|
|
1903
1850
|
let defaultConfig = {
|
|
1904
|
-
bundler: 'rspack',
|
|
1905
1851
|
root: cwd,
|
|
1906
1852
|
build: {
|
|
1907
1853
|
outDir: 'dist',
|
|
@@ -1935,7 +1881,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1935
1881
|
]
|
|
1936
1882
|
}, _context = {
|
|
1937
1883
|
callerName,
|
|
1938
|
-
version: "
|
|
1884
|
+
version: "3.0.0"
|
|
1939
1885
|
}, { plugins, bundlerConfig, ...rest } = mergeConfig(defaultConfig, config);
|
|
1940
1886
|
for (let plugin of getNormalizedPluginsByHook('config', plugins))rest = await plugin.config(rest, {
|
|
1941
1887
|
..._context,
|
|
@@ -1950,7 +1896,9 @@ for(var __webpack_i__ in (()=>{
|
|
|
1950
1896
|
};
|
|
1951
1897
|
return {
|
|
1952
1898
|
build: async ({ watch } = {})=>{
|
|
1953
|
-
setNodeEnv(watch ? 'development' : 'production')
|
|
1899
|
+
setNodeEnv(watch ? 'development' : 'production');
|
|
1900
|
+
let config = await resolveConfig();
|
|
1901
|
+
console.log(colors.rainbow(`${callerName} v3.0.0`), colors.green(`building for ${getNodeEnv()}...`)), unpackBuild(config);
|
|
1954
1902
|
},
|
|
1955
1903
|
dev: async ()=>{
|
|
1956
1904
|
global.__unpack_start_time = performance.now(), setNodeEnv('development'), setDevServer(!0), unpackDev(await resolveConfig());
|
|
@@ -1975,17 +1923,15 @@ for(var __webpack_i__ in (()=>{
|
|
|
1975
1923
|
...options
|
|
1976
1924
|
});
|
|
1977
1925
|
}
|
|
1978
|
-
})(), 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 === [
|
|
1979
1927
|
"CSS_MODULES_LOCAL_IDENT_NAME",
|
|
1980
1928
|
"CSS_MODULES_REGEX",
|
|
1981
1929
|
"CSS_NAMED_EXPORT",
|
|
1982
1930
|
"DEFAULT_BROWSERSLIST",
|
|
1983
1931
|
"DEFAULT_DEV_HOST",
|
|
1984
1932
|
"DEFAULT_ES_TARGET",
|
|
1985
|
-
"DEFAULT_LIGHTNINGCSS_TARGET",
|
|
1986
1933
|
"DEV_DEFAULT_FILENAME",
|
|
1987
1934
|
"EXPORT_LOCALS_CONVENTION",
|
|
1988
|
-
"HtmlWebpackPlugin",
|
|
1989
1935
|
"LogColor",
|
|
1990
1936
|
"NODE_MODULES_REGEX",
|
|
1991
1937
|
"PROD_DEFAULT_FILENAME",
|
|
@@ -2041,8 +1987,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
2041
1987
|
"setDevServer",
|
|
2042
1988
|
"setNodeEnv",
|
|
2043
1989
|
"setValueByPath",
|
|
2044
|
-
"trackPerformance"
|
|
2045
|
-
"webpack"
|
|
1990
|
+
"trackPerformance"
|
|
2046
1991
|
].indexOf(__webpack_i__) && (exports[__webpack_i__] = __webpack_exports__[__webpack_i__]);
|
|
2047
1992
|
Object.defineProperty(exports, '__esModule', {
|
|
2048
1993
|
value: !0
|