@unpackjs/core 3.2.7 → 3.3.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/dist/index.cjs +252 -181
- package/dist/index.js +252 -186
- package/dist/typedCssModulesLoader.mjs +5 -13
- package/dist-types/bundler-config/index.d.ts.map +1 -1
- package/dist-types/bundler-config/plugins/progress/helpers.d.ts +0 -1
- package/dist-types/bundler-config/plugins/progress/helpers.d.ts.map +1 -1
- package/dist-types/bundler-config/plugins/progress/index.d.ts.map +1 -1
- package/dist-types/cliShortcuts.d.ts +22 -0
- package/dist-types/cliShortcuts.d.ts.map +1 -0
- package/dist-types/config.d.ts.map +1 -1
- package/dist-types/createUnpack.d.ts.map +1 -1
- package/dist-types/global.d.ts +7 -1
- package/dist-types/global.d.ts.map +1 -1
- package/dist-types/index.d.ts +1 -0
- package/dist-types/index.d.ts.map +1 -1
- package/dist-types/logger.d.ts.map +1 -1
- package/dist-types/prebundleDeps.d.ts.map +1 -1
- package/dist-types/run/dev.d.ts.map +1 -1
- package/dist-types/types/config.d.ts +4 -2
- package/dist-types/types/config.d.ts.map +1 -1
- package/dist-types/types/index.d.ts +1 -0
- package/dist-types/types/index.d.ts.map +1 -1
- package/dist-types/types/logger.d.ts +2 -2
- package/dist-types/types/logger.d.ts.map +1 -1
- package/dist-types/utils.d.ts.map +1 -1
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
const __rslib_import_meta_url__ = 'undefined' == typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
3
3
|
var __webpack_modules__ = {
|
|
4
4
|
"compiled/webpack-bundle-analyzer": function(module) {
|
|
5
5
|
module.exports = require("../compiled/webpack-bundle-analyzer/index.js");
|
|
@@ -7,6 +7,11 @@ var __webpack_modules__ = {
|
|
|
7
7
|
"compiled/webpack-merge": function(module) {
|
|
8
8
|
module.exports = require("../compiled/webpack-merge/index.js");
|
|
9
9
|
},
|
|
10
|
+
"node:readline": function(module) {
|
|
11
|
+
module.exports = import("node:readline").then(function(module) {
|
|
12
|
+
return module;
|
|
13
|
+
});
|
|
14
|
+
},
|
|
10
15
|
"oxc-minify": function(module) {
|
|
11
16
|
module.exports = import("oxc-minify").then(function(module) {
|
|
12
17
|
return module;
|
|
@@ -40,24 +45,27 @@ __webpack_require__.n = (module)=>{
|
|
|
40
45
|
};
|
|
41
46
|
var __webpack_exports__ = {};
|
|
42
47
|
for(var __webpack_i__ in (()=>{
|
|
48
|
+
let lastTrackTime, lastFileInfo, logger;
|
|
43
49
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
|
|
44
50
|
setValueByPath: ()=>setValueByPath,
|
|
45
51
|
TEMPLATE_CONTENT: ()=>TEMPLATE_CONTENT,
|
|
46
52
|
removeDir: ()=>removeDir,
|
|
47
53
|
getAddressUrls: ()=>getAddressUrls,
|
|
48
54
|
isDevServer: ()=>utils_isDevServer,
|
|
49
|
-
|
|
55
|
+
addRestartCleaner: ()=>addRestartCleaner,
|
|
50
56
|
isFileExists: ()=>isFileExists,
|
|
51
57
|
getNodeEnv: ()=>getNodeEnv,
|
|
52
58
|
isWatch: ()=>isWatch,
|
|
53
|
-
|
|
59
|
+
currentDevUnpackConfig: ()=>currentDevUnpackConfig,
|
|
54
60
|
THREAD_OPTIONS: ()=>THREAD_OPTIONS,
|
|
61
|
+
isFunction: ()=>isFunction,
|
|
55
62
|
debounce: ()=>debounce,
|
|
56
63
|
isDev: ()=>isDev,
|
|
57
64
|
isNodeVersionAtLeast: ()=>isNodeVersionAtLeast,
|
|
58
65
|
setNodeEnv: ()=>setNodeEnv,
|
|
59
66
|
getCompiledPkgPath: ()=>getCompiledPkgPath,
|
|
60
67
|
LogColor: ()=>logger_LogColor,
|
|
68
|
+
setCurrentDevUnpackConfig: ()=>setCurrentDevUnpackConfig,
|
|
61
69
|
CSS_MODULES_REGEX: ()=>CSS_MODULES_REGEX,
|
|
62
70
|
loadConfig: ()=>loadConfig,
|
|
63
71
|
PROD_DEFAULT_FILENAME: ()=>PROD_DEFAULT_FILENAME,
|
|
@@ -91,9 +99,11 @@ for(var __webpack_i__ in (()=>{
|
|
|
91
99
|
isWin: ()=>isWin,
|
|
92
100
|
pathExists: ()=>pathExists,
|
|
93
101
|
isPlainObject: ()=>isPlainObject,
|
|
94
|
-
CSS_NAMED_EXPORT: ()
|
|
102
|
+
CSS_NAMED_EXPORT: ()=>!1,
|
|
95
103
|
DEV_DEFAULT_FILENAME: ()=>DEV_DEFAULT_FILENAME,
|
|
104
|
+
cleanUpBeforeRestart: ()=>cleanUpBeforeRestart,
|
|
96
105
|
isUndefined: ()=>isUndefined,
|
|
106
|
+
setupCliShortcuts: ()=>setupCliShortcuts,
|
|
97
107
|
defineConfig: ()=>defineConfig,
|
|
98
108
|
logUpdate: ()=>logUpdate,
|
|
99
109
|
isObject: ()=>isObject,
|
|
@@ -114,18 +124,22 @@ for(var __webpack_i__ in (()=>{
|
|
|
114
124
|
for (let char of chars)isWord(char) && (r += rStep, g += gStep, b += bStep), output += `\x1b[38;2;${Math.round(r)};${Math.round(g)};${Math.round(b)}m${char}\x1b[39m`;
|
|
115
125
|
return output;
|
|
116
126
|
}
|
|
117
|
-
},
|
|
127
|
+
}, restartCleaners = [], addRestartCleaner = (...cleaners)=>{
|
|
128
|
+
restartCleaners.push(...cleaners);
|
|
129
|
+
}, cleanUpBeforeRestart = async ()=>{
|
|
130
|
+
await Promise.all(restartCleaners.map((cleaner)=>cleaner())), restartCleaners.length = 0;
|
|
131
|
+
}, currentDevUnpackConfig = {}, setCurrentDevUnpackConfig = (config)=>{
|
|
132
|
+
currentDevUnpackConfig = config;
|
|
133
|
+
}, external_node_readline_namespaceObject = require("node:readline");
|
|
134
|
+
var LogColor, external_node_readline_default = __webpack_require__.n(external_node_readline_namespaceObject), logger_LogColor = ((LogColor = {}).error = "red", LogColor.warn = "yellow", LogColor.info = "cyan", LogColor.ready = "green", LogColor.event = "magenta", LogColor.wait = "blue", LogColor);
|
|
135
|
+
let external_node_fs_namespaceObject = require("node:fs");
|
|
118
136
|
var external_node_fs_default = __webpack_require__.n(external_node_fs_namespaceObject);
|
|
119
|
-
let external_node_path_namespaceObject = require("node:path");
|
|
120
|
-
var external_node_path_default = __webpack_require__.n(external_node_path_namespaceObject);
|
|
121
|
-
let external_node_url_namespaceObject = require("node:url"), external_jiti_namespaceObject = require("jiti"), external_node_readline_namespaceObject = require("node:readline");
|
|
122
|
-
var external_node_readline_default = __webpack_require__.n(external_node_readline_namespaceObject), logger_LogColor = function(LogColor) {
|
|
123
|
-
return LogColor.error = "red", LogColor.warn = "yellow", LogColor.info = "cyan", LogColor.ready = "green", LogColor.event = "magenta", LogColor.wait = "blue", LogColor.debug = "dim", LogColor;
|
|
124
|
-
}({});
|
|
125
137
|
let external_node_net_namespaceObject = require("node:net");
|
|
126
138
|
var external_node_net_default = __webpack_require__.n(external_node_net_namespaceObject);
|
|
127
139
|
let external_node_os_namespaceObject = require("node:os");
|
|
128
140
|
var external_node_os_default = __webpack_require__.n(external_node_os_namespaceObject);
|
|
141
|
+
let external_node_path_namespaceObject = require("node:path");
|
|
142
|
+
var external_node_path_default = __webpack_require__.n(external_node_path_namespaceObject);
|
|
129
143
|
let external_portfinder_namespaceObject = require("portfinder");
|
|
130
144
|
var external_portfinder_default = __webpack_require__.n(external_portfinder_namespaceObject);
|
|
131
145
|
let CSS_MODULES_LOCAL_IDENT_NAME = '[path][name]__[local]--[hash:5]', CSS_MODULES_REGEX = /\.module\.\w+$/i, DEV_DEFAULT_FILENAME = {
|
|
@@ -138,7 +152,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
138
152
|
jsAsync: 'js/async/[name].[contenthash:8].js',
|
|
139
153
|
css: 'css/[name].[contenthash:8].css',
|
|
140
154
|
cssAsync: 'css/async/[name].[contenthash:8].css'
|
|
141
|
-
}, EXPORT_LOCALS_CONVENTION = 'camel-case-only', TEMP_DIR = 'node_modules/.unpack', NODE_MODULES_REGEX = /[\\/]node_modules[\\/]/,
|
|
155
|
+
}, EXPORT_LOCALS_CONVENTION = 'camel-case-only', TEMP_DIR = 'node_modules/.unpack', NODE_MODULES_REGEX = /[\\/]node_modules[\\/]/, THREAD_OPTIONS = {
|
|
142
156
|
workers: 2
|
|
143
157
|
}, DEFAULT_DEV_HOST = '0.0.0.0', TEMPLATE_CONTENT = ({ title = '', headTag = '', mountId = '' })=>`<!DOCTYPE html>
|
|
144
158
|
<html lang="en">
|
|
@@ -219,16 +233,19 @@ for(var __webpack_i__ in (()=>{
|
|
|
219
233
|
'::1',
|
|
220
234
|
'0000:0000:0000:0000:0000:0000:0000:0001'
|
|
221
235
|
].includes(host), concatUrl = ({ host, port, protocol })=>`${protocol}://${host}:${port}/`, LOCAL_LABEL = 'Local: ', NETWORK_LABEL = 'Network: ', getAddressUrls = ({ protocol = 'http', port, host })=>{
|
|
222
|
-
if (host && host !== DEFAULT_DEV_HOST)
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
236
|
+
if (host && host !== DEFAULT_DEV_HOST) {
|
|
237
|
+
var host1;
|
|
238
|
+
return [
|
|
239
|
+
{
|
|
240
|
+
label: isLoopbackHost(host) ? LOCAL_LABEL : NETWORK_LABEL,
|
|
241
|
+
url: concatUrl({
|
|
242
|
+
port,
|
|
243
|
+
host: (host1 = host, external_node_net_default().isIPv6(host1) ? '::' === host1 ? '[::1]' : `[${host1}]` : host1),
|
|
244
|
+
protocol
|
|
245
|
+
})
|
|
246
|
+
}
|
|
247
|
+
];
|
|
248
|
+
}
|
|
232
249
|
let ipv4Interfaces = getIpv4Interfaces(), addressUrls = [], hasLocalUrl = !1;
|
|
233
250
|
for (let detail of ipv4Interfaces)if (isLoopbackHost(detail.address) || detail.internal) {
|
|
234
251
|
if (hasLocalUrl) continue;
|
|
@@ -250,12 +267,11 @@ for(var __webpack_i__ in (()=>{
|
|
|
250
267
|
});
|
|
251
268
|
return addressUrls;
|
|
252
269
|
}, trackPerformance = (msg)=>{
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
global[k] = performance.now();
|
|
270
|
+
if (!lastTrackTime) {
|
|
271
|
+
lastTrackTime = performance.now();
|
|
256
272
|
return;
|
|
257
273
|
}
|
|
258
|
-
msg && console.log(` ${msg} ${colors.dim('in')} ${colors.yellow(`${(performance.now() -
|
|
274
|
+
msg && console.log(` ${msg} ${colors.dim('in')} ${colors.yellow(`${(performance.now() - lastTrackTime).toFixed(2)}ms`)}`), lastTrackTime = performance.now();
|
|
259
275
|
}, getPathInJs = (absPath)=>JSON.stringify(absPath).slice(1, -1), mergeConfig = merge, getUserDepVersion = (root, dep)=>{
|
|
260
276
|
let depPath = getUserDepPath(root, dep);
|
|
261
277
|
if (depPath) return JSON.parse(external_node_fs_default().readFileSync(external_node_path_default().resolve(depPath, 'package.json'), 'utf-8')).version;
|
|
@@ -296,50 +312,99 @@ for(var __webpack_i__ in (()=>{
|
|
|
296
312
|
if (!browsers) throw Error(`Unsupported ES version: ${esVersion}`);
|
|
297
313
|
return browsers;
|
|
298
314
|
}, logger_prefixes = {
|
|
299
|
-
wait:
|
|
300
|
-
error:
|
|
301
|
-
warn:
|
|
302
|
-
info:
|
|
303
|
-
ready:
|
|
304
|
-
event:
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
}
|
|
315
|
+
wait: '○',
|
|
316
|
+
error: '⨯',
|
|
317
|
+
warn: '⚠',
|
|
318
|
+
info: 'ℹ',
|
|
319
|
+
ready: '✓',
|
|
320
|
+
event: '»'
|
|
321
|
+
}, logger_logger = (logger = {
|
|
322
|
+
clear: ()=>{
|
|
323
|
+
let repeatCount = process.stdout.rows - 2;
|
|
324
|
+
console.log(repeatCount > 0 ? '\n'.repeat(repeatCount) : ''), external_node_readline_default().cursorTo(process.stdout, 0, 0), external_node_readline_default().clearScreenDown(process.stdout);
|
|
325
|
+
},
|
|
326
|
+
greet: (msg)=>{
|
|
327
|
+
let { npm_execpath, npm_lifecycle_event } = process.env;
|
|
328
|
+
(!npm_execpath || 'npx' === npm_lifecycle_event || npm_execpath.includes('npx-cli') || npm_execpath.includes('.bun') || npm_execpath.includes('yarn')) && console.log(), console.log(msg);
|
|
329
|
+
},
|
|
330
|
+
debug: (message, ...args)=>{
|
|
331
|
+
isDebug() && console.log(`${colors.gray(colors.dim(getTime()))} ${message}`, ...args);
|
|
332
|
+
}
|
|
333
|
+
}, Object.keys(logger_prefixes).forEach((type)=>{
|
|
334
|
+
logger[type] = (message, ...args)=>{
|
|
335
|
+
((type, message, ...args)=>{
|
|
336
|
+
let label = colors[logger_LogColor[type]](logger_prefixes[type]), text = '';
|
|
337
|
+
switch(type){
|
|
338
|
+
case 'error':
|
|
339
|
+
if (message instanceof Error) if (message.stack) {
|
|
340
|
+
let [name, ...rest] = message.stack.split('\n');
|
|
341
|
+
name.startsWith('Error: ') && (name = name.slice(7), rest = rest.map((line)=>line.slice(2))), text = `${colors.red(name)}\n${colors.dim(rest.join('\n'))}`;
|
|
342
|
+
} else text = colors.red(message.message);
|
|
343
|
+
else text = colors.red(message);
|
|
344
|
+
break;
|
|
345
|
+
case 'warn':
|
|
346
|
+
text = colors.yellow(message);
|
|
347
|
+
break;
|
|
348
|
+
default:
|
|
349
|
+
text = message;
|
|
350
|
+
}
|
|
351
|
+
console.log(`${label} ${text}`, ...args);
|
|
352
|
+
})(type, message, ...args);
|
|
316
353
|
};
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
354
|
+
}), logger);
|
|
355
|
+
async function setupCliShortcuts({ help = !0, openPage, closeServer, printUrls, restartServer }) {
|
|
356
|
+
let shortcuts = [
|
|
357
|
+
restartServer ? {
|
|
358
|
+
key: 'r',
|
|
359
|
+
description: 'restart server',
|
|
360
|
+
action: restartServer
|
|
361
|
+
} : null,
|
|
362
|
+
{
|
|
363
|
+
key: 'u',
|
|
364
|
+
description: 'show server url',
|
|
365
|
+
action: printUrls
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
key: 'o',
|
|
369
|
+
description: 'open in browser',
|
|
370
|
+
action: openPage
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
key: 'c',
|
|
374
|
+
description: 'clear console',
|
|
375
|
+
action: ()=>{
|
|
376
|
+
logger_logger.clear();
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
key: 'q',
|
|
381
|
+
description: 'quit',
|
|
382
|
+
action: async ()=>{
|
|
383
|
+
try {
|
|
384
|
+
await closeServer();
|
|
385
|
+
} finally{
|
|
386
|
+
process.exit(0);
|
|
337
387
|
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
})
|
|
342
|
-
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
].filter(Boolean), colorPrefix = colors.green(colors.dim('➜'));
|
|
391
|
+
help && console.log(!0 === help ? ` ${colorPrefix} ${colors.dim('press')} ${colors.bold('h + enter')} ${colors.dim('to show help')}` : ` ${colorPrefix} ${help}`);
|
|
392
|
+
let { createInterface } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "node:readline")), rl = createInterface({
|
|
393
|
+
input: process.stdin
|
|
394
|
+
});
|
|
395
|
+
rl.on('line', (input)=>{
|
|
396
|
+
if ('h' === input) {
|
|
397
|
+
let message = '\n Shortcuts\n';
|
|
398
|
+
for (let shortcut of shortcuts){
|
|
399
|
+
let fullDescription = `${colors.dim('press')} ${colors.bold(`${shortcut.key} + enter`)} ${colors.dim(`to ${shortcut.description}`)}`;
|
|
400
|
+
message += ` ${fullDescription}\n`;
|
|
401
|
+
}
|
|
402
|
+
console.log(message);
|
|
403
|
+
}
|
|
404
|
+
for (let shortcut of shortcuts)if (input === shortcut.key) return void shortcut.action();
|
|
405
|
+
}), addRestartCleaner(()=>rl.close());
|
|
406
|
+
}
|
|
407
|
+
let external_node_url_namespaceObject = require("node:url"), external_jiti_namespaceObject = require("jiti");
|
|
343
408
|
async function loadConfig({ cliOptions, command }) {
|
|
344
409
|
'build' === command ? setNodeEnv((null == cliOptions ? void 0 : cliOptions.watch) ? 'development' : 'production') : (setNodeEnv('development'), setDevServer(!0));
|
|
345
410
|
let root = (null == cliOptions ? void 0 : cliOptions.root) ? external_node_path_default().resolve(cliOptions.root) : process.cwd(), configFilePath = resolveConfigPath(root, null == cliOptions ? void 0 : cliOptions.config), configExport = {};
|
|
@@ -389,7 +454,10 @@ for(var __webpack_i__ in (()=>{
|
|
|
389
454
|
'bundleAnalyze'
|
|
390
455
|
], cliOptions.analyze), (null == cliOptions ? void 0 : cliOptions.root) && setValueByPath(configExport, [
|
|
391
456
|
'root'
|
|
392
|
-
], root), configExport
|
|
457
|
+
], root), (null == cliOptions ? void 0 : cliOptions.host) && setValueByPath(configExport, [
|
|
458
|
+
'server',
|
|
459
|
+
'host'
|
|
460
|
+
], cliOptions.host), configExport;
|
|
393
461
|
}
|
|
394
462
|
function defineConfig(config) {
|
|
395
463
|
return config;
|
|
@@ -646,7 +714,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
646
714
|
constructor(options){
|
|
647
715
|
_define_property(this, "dtsCreator", void 0), _define_property(this, "useIncremental", !1), _define_property(this, "globPattern", 'src/**/*.{css,less,scss}'), _define_property(this, "userOptions", void 0), this.userOptions = options, this.dtsCreator = new DtsCreator({
|
|
648
716
|
camelCase: !0,
|
|
649
|
-
namedExports:
|
|
717
|
+
namedExports: !1
|
|
650
718
|
});
|
|
651
719
|
}
|
|
652
720
|
}
|
|
@@ -663,7 +731,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
663
731
|
apply(compiler) {
|
|
664
732
|
let meta = JSON.stringify({
|
|
665
733
|
name: jsMinify_PLUGIN_NAME,
|
|
666
|
-
version: "3.
|
|
734
|
+
version: "3.3.0",
|
|
667
735
|
options: this.minifyOptions
|
|
668
736
|
});
|
|
669
737
|
compiler.hooks.compilation.tap(jsMinify_PLUGIN_NAME, (compilation)=>{
|
|
@@ -694,7 +762,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
694
762
|
}
|
|
695
763
|
constructor(options = {}){
|
|
696
764
|
jsMinify_define_property(this, "minifyOptions", void 0), jsMinify_define_property(this, "customMinify", void 0);
|
|
697
|
-
|
|
765
|
+
const { implementation, ...minifyOptions } = options;
|
|
698
766
|
this.customMinify = null == implementation ? void 0 : implementation.minify, this.minifyOptions = minifyOptions;
|
|
699
767
|
}
|
|
700
768
|
}
|
|
@@ -794,16 +862,16 @@ for(var __webpack_i__ in (()=>{
|
|
|
794
862
|
}
|
|
795
863
|
constructor(){
|
|
796
864
|
loadingAnimation_define_property(this, "chars", [
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
865
|
+
'⠋',
|
|
866
|
+
'⠙',
|
|
867
|
+
'⠹',
|
|
868
|
+
'⠸',
|
|
869
|
+
'⠼',
|
|
870
|
+
'⠴',
|
|
871
|
+
'⠦',
|
|
872
|
+
'⠧',
|
|
873
|
+
'⠇',
|
|
874
|
+
'⠏'
|
|
807
875
|
]), loadingAnimation_define_property(this, "currentIndex", 0), loadingAnimation_define_property(this, "lastUpdateTime", 0), loadingAnimation_define_property(this, "interval", 100);
|
|
808
876
|
}
|
|
809
877
|
}
|
|
@@ -871,7 +939,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
871
939
|
}), longest = 0, totalSize = 0, totalCompressedSize = 0;
|
|
872
940
|
await Promise.all(origin.assets.map(async (asset)=>{
|
|
873
941
|
let content = await external_node_fs_default().promises.readFile(external_node_path_default().join(distPath, asset.name)), size = content.length, compressedSize = await getCompressedSize(content);
|
|
874
|
-
totalSize += size, totalCompressedSize += compressedSize, compressedCount++, logUpdate(`${loadingAnimation.getCurrentChar()} computing gzip size (${compressedCount})...`), compressedCount === origin.assets.length && (logUpdate(
|
|
942
|
+
totalSize += size, totalCompressedSize += compressedSize, compressedCount++, logUpdate(`${loadingAnimation.getCurrentChar()} computing gzip size (${compressedCount})...`), compressedCount === origin.assets.length && (logUpdate(`✓ computed gzip size (${compressedCount})`), console.log());
|
|
875
943
|
let chunk = {
|
|
876
944
|
name: external_node_path_default().basename(asset.name),
|
|
877
945
|
path: `${distFolder}/${asset.name}`,
|
|
@@ -897,11 +965,11 @@ for(var __webpack_i__ in (()=>{
|
|
|
897
965
|
chunkGroups.forEach((group)=>{
|
|
898
966
|
group.chunks.sort((a, b)=>a.size - b.size).forEach((chunk)=>{
|
|
899
967
|
let isLarge = 'JS' === group.type && chunk.size / 1000 > 500, relativeOutDir = external_node_path_default().dirname(chunk.path) + '/', log = colors.dim(relativeOutDir);
|
|
900
|
-
log += colors[group.color](chunk.name.padEnd(longest + 2 - relativeOutDir.length)), log += colors[isLarge ? 'yellow' : 'dim'](displaySize(chunk.size).padStart(sizePad)), chunk.compressedSize && (log += colors.dim(`
|
|
968
|
+
log += colors[group.color](chunk.name.padEnd(longest + 2 - relativeOutDir.length)), log += colors[isLarge ? 'yellow' : 'dim'](displaySize(chunk.size).padStart(sizePad)), chunk.compressedSize && (log += colors.dim(` │ gzip: ${displaySize(chunk.compressedSize).padStart(compressPad)}`)), console.log(log);
|
|
901
969
|
});
|
|
902
970
|
});
|
|
903
971
|
let log = colors.blue('Total'.padEnd(longest + 2));
|
|
904
|
-
log += colors.blue(displaySize(totalSize)), console.log(log += colors.dim(`
|
|
972
|
+
log += colors.blue(displaySize(totalSize)), console.log(log += colors.dim(` │ gzip: ${displaySize(totalCompressedSize)}`));
|
|
905
973
|
}
|
|
906
974
|
function isLikelyFile(filePath) {
|
|
907
975
|
return (filePath.split(external_node_path_namespaceObject.sep).pop() || '').includes('.');
|
|
@@ -911,29 +979,14 @@ for(var __webpack_i__ in (()=>{
|
|
|
911
979
|
0 === files.length && (files = [
|
|
912
980
|
paths[0]
|
|
913
981
|
]);
|
|
914
|
-
let fileInfo = files.slice(0, 1).map((file)=>
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
})(file, rootPath)).join(', ');
|
|
982
|
+
let fileInfo = files.slice(0, 1).map((file)=>{
|
|
983
|
+
var originalFilePath, root;
|
|
984
|
+
let prefix, filePath, parts;
|
|
985
|
+
return originalFilePath = file, prefix = (root = rootPath).endsWith(external_node_path_namespaceObject.sep) ? root : root + external_node_path_namespaceObject.sep, (filePath = originalFilePath).startsWith(prefix) && (filePath = filePath.slice(prefix.length)), (parts = filePath.split(external_node_path_namespaceObject.sep).filter(Boolean)).length > 3 ? parts.slice(-3).join(external_node_path_namespaceObject.sep) : parts.join(external_node_path_namespaceObject.sep);
|
|
986
|
+
}).join(', ');
|
|
920
987
|
return files.length > 1 ? `${fileInfo} and ${files.length - 1} more` : fileInfo;
|
|
921
988
|
}
|
|
922
|
-
|
|
923
|
-
let changedFiles = compiler.modifiedFiles ? Array.from(compiler.modifiedFiles) : null;
|
|
924
|
-
if (null == changedFiles ? void 0 : changedFiles.length) {
|
|
925
|
-
let fileInfo = formatFileList(changedFiles, root);
|
|
926
|
-
logger_logger.wait(`building ${colors.dim(fileInfo)}`);
|
|
927
|
-
return;
|
|
928
|
-
}
|
|
929
|
-
let removedFiles = compiler.removedFiles ? Array.from(compiler.removedFiles) : null;
|
|
930
|
-
if (null == removedFiles ? void 0 : removedFiles.length) {
|
|
931
|
-
let fileInfo = formatFileList(removedFiles, root);
|
|
932
|
-
logger_logger.wait(`building ${colors.dim(`removed ${fileInfo}`)}`);
|
|
933
|
-
return;
|
|
934
|
-
}
|
|
935
|
-
logger_logger.wait('building...');
|
|
936
|
-
}
|
|
989
|
+
let sameCount = 0;
|
|
937
990
|
async function compileDone(compiler, stats) {
|
|
938
991
|
let compileTime = stats.toJson({
|
|
939
992
|
preset: 'errors-only',
|
|
@@ -944,27 +997,35 @@ for(var __webpack_i__ in (()=>{
|
|
|
944
997
|
stats
|
|
945
998
|
}), logger_logger.ready(colors.green(`built in ${prettyTime(compileTime)}`));
|
|
946
999
|
else {
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
1000
|
+
let changedFiles = compiler.modifiedFiles ? Array.from(compiler.modifiedFiles) : null, fileInfo = function(changedFiles, removedFiles, root) {
|
|
1001
|
+
if (!(null == changedFiles ? void 0 : changedFiles.length) && !(null == removedFiles ? void 0 : removedFiles.length)) return null;
|
|
1002
|
+
if ((null == changedFiles ? void 0 : changedFiles.length) && (null == removedFiles ? void 0 : removedFiles.length)) {
|
|
1003
|
+
let changedInfo = formatFileList(changedFiles, root), removedInfo = formatFileList(removedFiles, root);
|
|
1004
|
+
return `${changedInfo}, removed ${removedInfo}`;
|
|
1005
|
+
}
|
|
1006
|
+
return (null == changedFiles ? void 0 : changedFiles.length) ? formatFileList(changedFiles, root) : (null == removedFiles ? void 0 : removedFiles.length) ? `removed ${formatFileList(removedFiles, root)}` : null;
|
|
1007
|
+
}(changedFiles, compiler.removedFiles ? Array.from(compiler.removedFiles) : null, root);
|
|
1008
|
+
if (!fileInfo) return;
|
|
1009
|
+
if (fileInfo === lastFileInfo ? sameCount++ : (lastFileInfo = fileInfo, sameCount = 1), isDebug()) {
|
|
1010
|
+
var modules, root1;
|
|
1011
|
+
let nodeModulesStats, nodeModulesPath;
|
|
1012
|
+
Object.entries((modules = stats.compilation.modules, root1 = root, nodeModulesStats = {}, nodeModulesPath = external_node_path_default().resolve(root1, 'node_modules'), modules.forEach((module)=>{
|
|
950
1013
|
let { resource } = module;
|
|
951
1014
|
if (null == resource ? void 0 : resource.includes(nodeModulesPath)) {
|
|
952
1015
|
let packageName, pathParts = external_node_path_default().relative(nodeModulesPath, resource).split(external_node_path_namespaceObject.sep);
|
|
953
|
-
(packageName = '.pnpm' === pathParts[0] && pathParts.length >= 4 ? pathParts[3].startsWith('@') ? `${pathParts[3]}/${pathParts[4]}` : pathParts[3] : pathParts[0].startsWith('@') ? `${pathParts[0]}/${pathParts[1]}` : pathParts[0]) && nodeModulesStats
|
|
1016
|
+
(packageName = '.pnpm' === pathParts[0] && pathParts.length >= 4 ? pathParts[3].startsWith('@') ? `${pathParts[3]}/${pathParts[4]}` : pathParts[3] : pathParts[0].startsWith('@') ? `${pathParts[0]}/${pathParts[1]}` : pathParts[0]) && (nodeModulesStats[packageName] = (nodeModulesStats[packageName] || 0) + 1);
|
|
954
1017
|
}
|
|
955
|
-
}), nodeModulesStats
|
|
1018
|
+
}), nodeModulesStats)).sort((a, b)=>a[1] - b[1]).forEach(([packageName, count])=>{
|
|
956
1019
|
logger_logger.debug(`${colors.cyan(packageName)}: ${colors.yellow(count)} modules`);
|
|
957
1020
|
});
|
|
958
1021
|
}
|
|
959
|
-
logger_logger.
|
|
1022
|
+
isDebug() || logger_logger.clear(), console.log(colors.dim(getTime()), colors.cyan(colors.bold(`[${global.__unpack_caller_name}]`)), colors.green(utils_isDevServer() ? 'hmr update' : 'build'), `${colors.dim(fileInfo)}${sameCount > 1 ? ` ${colors.yellow(`(x${sameCount})`)}` : ''}`, isDebug() ? colors.dim(`| ${prettyTime(compileTime)} (${stats.compilation.modules.size} modules)`) : '');
|
|
960
1023
|
}
|
|
961
1024
|
}
|
|
962
1025
|
let progress_PLUGIN_NAME = 'ProgressPlugin';
|
|
963
1026
|
class ProgressLiteRspackPlugin {
|
|
964
1027
|
apply(compiler) {
|
|
965
|
-
compiler.hooks.
|
|
966
|
-
(!utils_isDevServer() || global.__unpack_dev_server_started) && printDevLog(compiler, compiler.options.context);
|
|
967
|
-
}), compiler.hooks.run.tap(progress_PLUGIN_NAME, ()=>{
|
|
1028
|
+
compiler.hooks.run.tap(progress_PLUGIN_NAME, ()=>{
|
|
968
1029
|
logger_logger.info('build started...');
|
|
969
1030
|
}), compiler.hooks.afterDone.tap(progress_PLUGIN_NAME, async (stats)=>{
|
|
970
1031
|
await compileDone(compiler, stats);
|
|
@@ -973,9 +1034,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
973
1034
|
}
|
|
974
1035
|
class ProgressRspackPlugin extends core_namespaceObject.rspack.ProgressPlugin {
|
|
975
1036
|
apply(compiler) {
|
|
976
|
-
super.apply(compiler), compiler.hooks.
|
|
977
|
-
(!utils_isDevServer() || global.__unpack_dev_server_started) && printDevLog(compiler, compiler.options.context);
|
|
978
|
-
}), compiler.hooks.afterDone.tap(progress_PLUGIN_NAME, async (stats)=>{
|
|
1037
|
+
super.apply(compiler), compiler.hooks.afterDone.tap(progress_PLUGIN_NAME, async (stats)=>{
|
|
979
1038
|
await compileDone(compiler, stats);
|
|
980
1039
|
});
|
|
981
1040
|
}
|
|
@@ -1170,16 +1229,15 @@ for(var __webpack_i__ in (()=>{
|
|
|
1170
1229
|
circularCount = 0;
|
|
1171
1230
|
},
|
|
1172
1231
|
onDetected (_, modules) {
|
|
1232
|
+
var paths, paths1;
|
|
1173
1233
|
circularCount++, console.log(''), logger_logger.warn('circular dependency detected:');
|
|
1174
1234
|
let uniquePaths = modules.map((module)=>{
|
|
1175
1235
|
let filePath = module.replace(/^.*!/, ''), relativePath = external_node_path_default().relative(unpackConfig.root, filePath);
|
|
1176
1236
|
return relativePath.startsWith('..') ? filePath : relativePath;
|
|
1177
|
-
}).slice(0, -1), totalLength = 2 + uniquePaths.join(
|
|
1237
|
+
}).slice(0, -1), totalLength = 2 + uniquePaths.join(' → ').length;
|
|
1178
1238
|
if (totalLength > (process.stdout.columns || 80)) {
|
|
1179
|
-
|
|
1180
|
-
console.log('')
|
|
1181
|
-
let arrow = "\u21B3 ", lastIndex = paths.length - 1;
|
|
1182
|
-
paths.forEach((p, i)=>{
|
|
1239
|
+
let arrow, lastIndex;
|
|
1240
|
+
paths = uniquePaths, console.log(''), arrow = '↳ ', lastIndex = paths.length - 1, paths.forEach((p, i)=>{
|
|
1183
1241
|
switch(i){
|
|
1184
1242
|
case 0:
|
|
1185
1243
|
console.log(` ${p}`);
|
|
@@ -1192,13 +1250,10 @@ for(var __webpack_i__ in (()=>{
|
|
|
1192
1250
|
}
|
|
1193
1251
|
}), console.log(` ${arrow}${paths[0]}`), console.log('');
|
|
1194
1252
|
} else {
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
});
|
|
1200
|
-
let lineLength = downArrowPos - upArrowPos;
|
|
1201
|
-
console.log(''), console.log(line1), console.log(' ' + ' '.repeat(upArrowPos - 2) + "\u2191" + ' '.repeat(downArrowPos - upArrowPos - 1) + "\u2193"), console.log(' ' + ' '.repeat(upArrowPos - 2) + "\u2514" + "\u2500".repeat(lineLength - 1) + "\u2518"), console.log('');
|
|
1253
|
+
let line1, upArrowPos, downArrowPos, lineLength;
|
|
1254
|
+
line1 = ' ', upArrowPos = 2, downArrowPos = 0, (paths1 = uniquePaths).forEach((p, i)=>{
|
|
1255
|
+
line1 += p, i < paths1.length - 1 ? line1 += ' → ' : downArrowPos = line1.length - 1;
|
|
1256
|
+
}), lineLength = downArrowPos - upArrowPos, console.log(''), console.log(line1), console.log(' ' + ' '.repeat(upArrowPos - 2) + '↑' + ' '.repeat(downArrowPos - upArrowPos - 1) + '↓'), console.log(' ' + ' '.repeat(upArrowPos - 2) + '└' + '─'.repeat(lineLength - 1) + '┘'), console.log('');
|
|
1202
1257
|
}
|
|
1203
1258
|
},
|
|
1204
1259
|
onEnd () {
|
|
@@ -1241,9 +1296,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1241
1296
|
experiments: {
|
|
1242
1297
|
css: !1,
|
|
1243
1298
|
asyncWebAssembly: !0,
|
|
1244
|
-
lazyBarrel: !0
|
|
1245
|
-
inlineEnum: !0,
|
|
1246
|
-
typeReexportsPresence: !0
|
|
1299
|
+
lazyBarrel: !0
|
|
1247
1300
|
},
|
|
1248
1301
|
optimization: {
|
|
1249
1302
|
moduleIds: isDev() ? 'named' : 'deterministic',
|
|
@@ -1314,7 +1367,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1314
1367
|
'parser',
|
|
1315
1368
|
'css/module'
|
|
1316
1369
|
], {
|
|
1317
|
-
namedExports:
|
|
1370
|
+
namedExports: !1
|
|
1318
1371
|
}), setValueByPath(config, [
|
|
1319
1372
|
'module',
|
|
1320
1373
|
'generator',
|
|
@@ -1467,7 +1520,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1467
1520
|
})(),
|
|
1468
1521
|
localIdentName: !1 !== modules && (modules.localIdentName || CSS_MODULES_LOCAL_IDENT_NAME),
|
|
1469
1522
|
exportLocalsConvention: EXPORT_LOCALS_CONVENTION,
|
|
1470
|
-
namedExport:
|
|
1523
|
+
namedExport: !1
|
|
1471
1524
|
},
|
|
1472
1525
|
sourceMap
|
|
1473
1526
|
}
|
|
@@ -1583,7 +1636,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1583
1636
|
};
|
|
1584
1637
|
isWatch() ? compiler.watch({}, handler) : compiler.run(handler);
|
|
1585
1638
|
}
|
|
1586
|
-
let
|
|
1639
|
+
let dev_server_namespaceObject = require("@rspack/dev-server");
|
|
1587
1640
|
async function openBrowser(url) {
|
|
1588
1641
|
if ('darwin' === process.platform) try {
|
|
1589
1642
|
let ps = await execAsync('ps cax'), openedBrowser = [
|
|
@@ -1656,19 +1709,20 @@ for(var __webpack_i__ in (()=>{
|
|
|
1656
1709
|
'react-dom': 'ReactDOM',
|
|
1657
1710
|
'react-router-dom': 'ReactRouterDOM'
|
|
1658
1711
|
})[pkgName] || pkgName, getExternalValue = (pkgName)=>`window ${getExternalLibraryName(pkgName)}`, prebundleDeps = async ({ unpackConfig })=>{
|
|
1659
|
-
var _unpackConfig_dev;
|
|
1660
|
-
let count = {
|
|
1712
|
+
var _unpackConfig_dev, failedDepsCachePath, externals, failedDepsCachePath1, cache;
|
|
1713
|
+
let existExternals, cacheDir, count = {
|
|
1661
1714
|
total: 0,
|
|
1662
1715
|
bundled: 0
|
|
1663
|
-
}, failedDeps = [], root = unpackConfig.root,
|
|
1664
|
-
logUpdate(`${colors.magenta(
|
|
1716
|
+
}, failedDeps = [], root = unpackConfig.root, failedDepsCachePath2 = external_node_path_default().resolve(root, TEMP_DIR, 'failed-deps.json'), failedCache = (failedDepsCachePath = failedDepsCachePath2, external_node_fs_default().existsSync(failedDepsCachePath) ? JSON.parse(external_node_fs_default().readFileSync(failedDepsCachePath, 'utf-8')) : {}), updateProgress = ()=>{
|
|
1717
|
+
logUpdate(`${colors.magenta('»')} optimizing dependencies (${count.bundled}/${count.total})`), count.total === count.bundled + failedDeps.length && console.log();
|
|
1665
1718
|
}, userOptions = isPlainObject(null == (_unpackConfig_dev = unpackConfig.dev) ? void 0 : _unpackConfig_dev.prebundle) ? unpackConfig.dev.prebundle : {}, ignoreCSSDeps = userOptions.ignoreCSS || [], packageJson = JSON.parse(external_node_fs_default().readFileSync(external_node_path_default().resolve(root, 'package.json'), 'utf-8')), excludeDeps = [
|
|
1666
|
-
...((externals)=>{
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1719
|
+
...(externals = unpackConfig.externals, existExternals = new Set(), Array.isArray(externals) ? externals.forEach((item)=>{
|
|
1720
|
+
isPlainObject(item) && Object.keys(item).forEach((key)=>{
|
|
1721
|
+
existExternals.add(key);
|
|
1722
|
+
});
|
|
1723
|
+
}) : isPlainObject(externals) && Object.keys(externals).forEach((key)=>{
|
|
1724
|
+
existExternals.add(key);
|
|
1725
|
+
}), Array.from(existExternals) || []),
|
|
1672
1726
|
...userOptions.exclude || []
|
|
1673
1727
|
], shouldIncludeDeps = Object.keys(packageJson.dependencies).filter((pkgName)=>!excludeDeps.includes(pkgName)), noEntryDeps = [], needBundleDeps = shouldIncludeDeps.map((pkgName)=>{
|
|
1674
1728
|
let packageJson = JSON.parse(external_node_fs_default().readFileSync(external_node_path_default().resolve(root, 'node_modules', pkgName, 'package.json'), 'utf-8')), version = packageJson.version;
|
|
@@ -1815,19 +1869,16 @@ for(var __webpack_i__ in (()=>{
|
|
|
1815
1869
|
});
|
|
1816
1870
|
});
|
|
1817
1871
|
}))(depInfo)));
|
|
1818
|
-
((
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
recursive: !0
|
|
1822
|
-
}), external_node_fs_default().writeFileSync(failedDepsCachePath, JSON.stringify(cache, null, 2), 'utf-8');
|
|
1823
|
-
})(failedDepsCachePath, failedCache), failedDeps[0] && logger_logger.warn(`something went wrong while optimizing "${colors.bold(failedDeps.join(', '))}"`);
|
|
1872
|
+
failedDepsCachePath1 = failedDepsCachePath2, cache = failedCache, cacheDir = external_node_path_default().dirname(failedDepsCachePath1), external_node_fs_default().existsSync(cacheDir) || external_node_fs_default().mkdirSync(cacheDir, {
|
|
1873
|
+
recursive: !0
|
|
1874
|
+
}), external_node_fs_default().writeFileSync(failedDepsCachePath1, JSON.stringify(cache, null, 2), 'utf-8'), failedDeps[0] && logger_logger.warn(`something went wrong while optimizing "${colors.bold(failedDeps.join(', '))}"`);
|
|
1824
1875
|
let cachePath = external_node_path_default().resolve(root, TEMP_DIR, 'umd'), app = external_express_default()();
|
|
1825
1876
|
app.use(external_cors_default()()), app.use("/umd", external_express_default().static(cachePath));
|
|
1826
1877
|
let port = await getPort(), staticServer = app.listen(port, ()=>{});
|
|
1827
|
-
|
|
1828
|
-
let
|
|
1878
|
+
addRestartCleaner(()=>new Promise((resolve)=>staticServer.close(()=>resolve())));
|
|
1879
|
+
let externals1 = {}, jsAssets = [], cssAssets = [], preJsAssets = [];
|
|
1829
1880
|
return bundledDeps.filter(Boolean).forEach((dep)=>{
|
|
1830
|
-
dep && (
|
|
1881
|
+
dep && (externals1[dep.name] = getExternalValue(dep.name), dep.assets.forEach((absPath)=>{
|
|
1831
1882
|
let relativePath = external_node_path_default().relative(cachePath, absPath), preDeps = [
|
|
1832
1883
|
'react',
|
|
1833
1884
|
'react-dom',
|
|
@@ -1845,10 +1896,10 @@ for(var __webpack_i__ in (()=>{
|
|
|
1845
1896
|
}
|
|
1846
1897
|
}));
|
|
1847
1898
|
}), unpackConfig.externals = Array.isArray(unpackConfig.externals) ? [
|
|
1848
|
-
|
|
1899
|
+
externals1,
|
|
1849
1900
|
...unpackConfig.externals
|
|
1850
1901
|
] : {
|
|
1851
|
-
...
|
|
1902
|
+
...externals1,
|
|
1852
1903
|
...unpackConfig.externals
|
|
1853
1904
|
}, unpackConfig.plugins.push({
|
|
1854
1905
|
name: 'unpack:prebundle',
|
|
@@ -1871,10 +1922,9 @@ for(var __webpack_i__ in (()=>{
|
|
|
1871
1922
|
}), config;
|
|
1872
1923
|
}
|
|
1873
1924
|
}), unpackConfig;
|
|
1874
|
-
}
|
|
1875
|
-
var external_webpack_dev_server_default = __webpack_require__.n(external_webpack_dev_server_namespaceObject);
|
|
1925
|
+
};
|
|
1876
1926
|
async function unpackDev(originalUnpackConfig) {
|
|
1877
|
-
var _unpackConfig_dev, _unpackConfig_server, _unpackConfig_server1, _unpackConfig_dev1, _unpackConfig_server2;
|
|
1927
|
+
var _unpackConfig_dev, _unpackConfig_server, _unpackConfig_server1, _unpackConfig_dev1, _unpackConfig_server2, _unpackConfig_server3;
|
|
1878
1928
|
let unpackConfig = originalUnpackConfig;
|
|
1879
1929
|
(null == (_unpackConfig_dev = unpackConfig.dev) ? void 0 : _unpackConfig_dev.prebundle) && (unpackConfig = await prebundleDeps({
|
|
1880
1930
|
unpackConfig
|
|
@@ -1909,23 +1959,40 @@ for(var __webpack_i__ in (()=>{
|
|
|
1909
1959
|
var _req_headers_accept;
|
|
1910
1960
|
(null == (_req_headers_accept = req.headers.accept) ? void 0 : _req_headers_accept.includes('html')) && (req.url = '/index.html'), next();
|
|
1911
1961
|
}), middlewares.unshift(core_namespaceObject.experiments.lazyCompilationMiddleware(compiler)), middlewares);
|
|
1912
|
-
let server = new (
|
|
1913
|
-
await server.start(), logger_logger.greet(` ${colors.green(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v3.
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1962
|
+
let server = new dev_server_namespaceObject.RspackDevServer(devServerOptions, compiler);
|
|
1963
|
+
await server.start(), logger_logger.greet(` ${colors.green(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v3.3.0`)} ${colors.dim('ready in')} ${colors.bold(Math.ceil(performance.now() - global.__unpack_start_time))} ms\n`), printAddressUrls(port, null == (_unpackConfig_server2 = unpackConfig.server) ? void 0 : _unpackConfig_server2.host), addRestartCleaner(async ()=>await server.stop(), ()=>new Promise((resolve)=>compiler.close(()=>resolve())));
|
|
1964
|
+
let open = null == (_unpackConfig_server3 = unpackConfig.server) ? void 0 : _unpackConfig_server3.open, url = isString(open) ? open : `http://localhost:${port}`;
|
|
1965
|
+
open && openBrowser(url), setupCliShortcuts({
|
|
1966
|
+
openPage: async ()=>{
|
|
1967
|
+
await openBrowser(url);
|
|
1968
|
+
},
|
|
1969
|
+
closeServer: async ()=>{
|
|
1970
|
+
await cleanUpBeforeRestart(), process.exit(0);
|
|
1971
|
+
},
|
|
1972
|
+
printUrls: ()=>{
|
|
1973
|
+
var _unpackConfig_server;
|
|
1974
|
+
printAddressUrls(port, null == (_unpackConfig_server = unpackConfig.server) ? void 0 : _unpackConfig_server.host);
|
|
1975
|
+
},
|
|
1976
|
+
restartServer: async ()=>{
|
|
1977
|
+
logger_logger.clear(), await cleanUpBeforeRestart(), createUnpack({
|
|
1978
|
+
cwd: currentDevUnpackConfig.root,
|
|
1979
|
+
config: currentDevUnpackConfig
|
|
1980
|
+
}).dev();
|
|
1981
|
+
}
|
|
1982
|
+
});
|
|
1983
|
+
}
|
|
1984
|
+
function printAddressUrls(port, host) {
|
|
1985
|
+
let addressUrls = getAddressUrls({
|
|
1986
|
+
port
|
|
1987
|
+
}), colorPrefix = colors.green('➜');
|
|
1988
|
+
addressUrls.forEach((addr, index)=>{
|
|
1989
|
+
let url;
|
|
1990
|
+
if (!host && 0 !== index) {
|
|
1991
|
+
1 === index && console.log(` ${colors.dim(colorPrefix)} ${colors.bold(colors.dim('Network:'))} ${colors.dim('use')} ${colors.bold('--host')} ${colors.dim('to expose')}`);
|
|
1992
|
+
return;
|
|
1993
|
+
}
|
|
1994
|
+
console.log(` ${colorPrefix} ${colors.bold(addr.label)}${(url = addr.url, colors.cyan(url.replace(/:(\d+)\//, (_, port)=>`:${colors.bold(port)}/`)))}`);
|
|
1923
1995
|
});
|
|
1924
|
-
let open = null == (_unpackConfig_server2 = unpackConfig.server) ? void 0 : _unpackConfig_server2.open;
|
|
1925
|
-
if (open) {
|
|
1926
|
-
let url = isString(open) ? open : `http://localhost:${port}`;
|
|
1927
|
-
await openBrowser(url);
|
|
1928
|
-
}
|
|
1929
1996
|
}
|
|
1930
1997
|
function createUnpack({ cwd = process.cwd(), config, callerName = 'unpack' }) {
|
|
1931
1998
|
let resolveConfig = ()=>{
|
|
@@ -1963,11 +2030,11 @@ for(var __webpack_i__ in (()=>{
|
|
|
1963
2030
|
'PUBLIC_'
|
|
1964
2031
|
]
|
|
1965
2032
|
};
|
|
1966
|
-
return {
|
|
2033
|
+
return global.__unpack_caller_name = callerName, {
|
|
1967
2034
|
...mergeConfig(defaultConfig, config),
|
|
1968
2035
|
_context: {
|
|
1969
2036
|
callerName,
|
|
1970
|
-
version: "3.
|
|
2037
|
+
version: "3.3.0"
|
|
1971
2038
|
}
|
|
1972
2039
|
};
|
|
1973
2040
|
};
|
|
@@ -1975,7 +2042,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1975
2042
|
build: async ({ watch } = {})=>{
|
|
1976
2043
|
setNodeEnv(watch ? 'development' : 'production');
|
|
1977
2044
|
let config = resolveConfig();
|
|
1978
|
-
console.log(colors.rainbow(`${callerName} v3.
|
|
2045
|
+
console.log(colors.rainbow(`${callerName} v3.3.0`), colors.green(`building for ${getNodeEnv()}...`)), await unpackBuild(config);
|
|
1979
2046
|
},
|
|
1980
2047
|
dev: async ()=>{
|
|
1981
2048
|
global.__unpack_start_time = performance.now(), setNodeEnv('development'), setDevServer(!0);
|
|
@@ -2002,7 +2069,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
2002
2069
|
...options
|
|
2003
2070
|
});
|
|
2004
2071
|
}
|
|
2005
|
-
})(), 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_DEV_HOST = __webpack_exports__.DEFAULT_DEV_HOST, 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.esVersionToBrowserslist = __webpack_exports__.esVersionToBrowserslist, 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.
|
|
2072
|
+
})(), 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_DEV_HOST = __webpack_exports__.DEFAULT_DEV_HOST, 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.addRestartCleaner = __webpack_exports__.addRestartCleaner, exports.cleanUpBeforeRestart = __webpack_exports__.cleanUpBeforeRestart, exports.clearLine = __webpack_exports__.clearLine, exports.colors = __webpack_exports__.colors, exports.createChokidar = __webpack_exports__.createChokidar, exports.createUnpack = __webpack_exports__.createUnpack, exports.currentDevUnpackConfig = __webpack_exports__.currentDevUnpackConfig, exports.debounce = __webpack_exports__.debounce, exports.defineConfig = __webpack_exports__.defineConfig, exports.esVersionToBrowserslist = __webpack_exports__.esVersionToBrowserslist, 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.rspack = __webpack_exports__.rspack, exports.setCurrentDevUnpackConfig = __webpack_exports__.setCurrentDevUnpackConfig, exports.setDevServer = __webpack_exports__.setDevServer, exports.setNodeEnv = __webpack_exports__.setNodeEnv, exports.setValueByPath = __webpack_exports__.setValueByPath, exports.setupCliShortcuts = __webpack_exports__.setupCliShortcuts, exports.trackPerformance = __webpack_exports__.trackPerformance, __webpack_exports__)-1 === [
|
|
2006
2073
|
"CSS_MODULES_LOCAL_IDENT_NAME",
|
|
2007
2074
|
"CSS_MODULES_REGEX",
|
|
2008
2075
|
"CSS_NAMED_EXPORT",
|
|
@@ -2015,10 +2082,13 @@ for(var __webpack_i__ in (()=>{
|
|
|
2015
2082
|
"TEMPLATE_CONTENT",
|
|
2016
2083
|
"TEMP_DIR",
|
|
2017
2084
|
"THREAD_OPTIONS",
|
|
2085
|
+
"addRestartCleaner",
|
|
2086
|
+
"cleanUpBeforeRestart",
|
|
2018
2087
|
"clearLine",
|
|
2019
2088
|
"colors",
|
|
2020
2089
|
"createChokidar",
|
|
2021
2090
|
"createUnpack",
|
|
2091
|
+
"currentDevUnpackConfig",
|
|
2022
2092
|
"debounce",
|
|
2023
2093
|
"defineConfig",
|
|
2024
2094
|
"esVersionToBrowserslist",
|
|
@@ -2060,11 +2130,12 @@ for(var __webpack_i__ in (()=>{
|
|
|
2060
2130
|
"prettyTime",
|
|
2061
2131
|
"removeDir",
|
|
2062
2132
|
"resolveConfigPath",
|
|
2063
|
-
"restartCleaners",
|
|
2064
2133
|
"rspack",
|
|
2134
|
+
"setCurrentDevUnpackConfig",
|
|
2065
2135
|
"setDevServer",
|
|
2066
2136
|
"setNodeEnv",
|
|
2067
2137
|
"setValueByPath",
|
|
2138
|
+
"setupCliShortcuts",
|
|
2068
2139
|
"trackPerformance"
|
|
2069
2140
|
].indexOf(__webpack_i__) && (exports[__webpack_i__] = __webpack_exports__[__webpack_i__]);
|
|
2070
2141
|
Object.defineProperty(exports, '__esModule', {
|