@unpackjs/core 3.2.6 → 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 +90 -79
- package/compiled/postcss-loader/package.json +1 -1
- package/compiled/sass-loader/index.js +8 -8
- package/dist/index.cjs +265 -190
- package/dist/index.js +260 -195
- package/dist/typedCssModulesLoader.mjs +5 -13
- package/dist-types/bundler-config/index.d.ts.map +1 -1
- package/dist-types/bundler-config/plugins/jsMinify.d.ts +1 -1
- package/dist-types/bundler-config/plugins/jsMinify.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/types/oxc.d.ts +2 -2
- package/dist-types/types/oxc.d.ts.map +1 -1
- package/dist-types/utils.d.ts.map +1 -1
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
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");
|
|
6
6
|
},
|
|
7
7
|
"compiled/webpack-merge": function(module) {
|
|
8
8
|
module.exports = require("../compiled/webpack-merge/index.js");
|
|
9
|
+
},
|
|
10
|
+
"node:readline": function(module) {
|
|
11
|
+
module.exports = import("node:readline").then(function(module) {
|
|
12
|
+
return module;
|
|
13
|
+
});
|
|
14
|
+
},
|
|
15
|
+
"oxc-minify": function(module) {
|
|
16
|
+
module.exports = import("oxc-minify").then(function(module) {
|
|
17
|
+
return module;
|
|
18
|
+
});
|
|
9
19
|
}
|
|
10
20
|
}, __webpack_module_cache__ = {};
|
|
11
21
|
function __webpack_require__(moduleId) {
|
|
@@ -35,24 +45,27 @@ __webpack_require__.n = (module)=>{
|
|
|
35
45
|
};
|
|
36
46
|
var __webpack_exports__ = {};
|
|
37
47
|
for(var __webpack_i__ in (()=>{
|
|
48
|
+
let lastTrackTime, lastFileInfo, logger;
|
|
38
49
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
|
|
39
50
|
setValueByPath: ()=>setValueByPath,
|
|
40
51
|
TEMPLATE_CONTENT: ()=>TEMPLATE_CONTENT,
|
|
41
52
|
removeDir: ()=>removeDir,
|
|
42
53
|
getAddressUrls: ()=>getAddressUrls,
|
|
43
54
|
isDevServer: ()=>utils_isDevServer,
|
|
44
|
-
|
|
55
|
+
addRestartCleaner: ()=>addRestartCleaner,
|
|
45
56
|
isFileExists: ()=>isFileExists,
|
|
46
57
|
getNodeEnv: ()=>getNodeEnv,
|
|
47
58
|
isWatch: ()=>isWatch,
|
|
48
|
-
|
|
59
|
+
currentDevUnpackConfig: ()=>currentDevUnpackConfig,
|
|
49
60
|
THREAD_OPTIONS: ()=>THREAD_OPTIONS,
|
|
61
|
+
isFunction: ()=>isFunction,
|
|
50
62
|
debounce: ()=>debounce,
|
|
51
63
|
isDev: ()=>isDev,
|
|
52
64
|
isNodeVersionAtLeast: ()=>isNodeVersionAtLeast,
|
|
53
65
|
setNodeEnv: ()=>setNodeEnv,
|
|
54
66
|
getCompiledPkgPath: ()=>getCompiledPkgPath,
|
|
55
67
|
LogColor: ()=>logger_LogColor,
|
|
68
|
+
setCurrentDevUnpackConfig: ()=>setCurrentDevUnpackConfig,
|
|
56
69
|
CSS_MODULES_REGEX: ()=>CSS_MODULES_REGEX,
|
|
57
70
|
loadConfig: ()=>loadConfig,
|
|
58
71
|
PROD_DEFAULT_FILENAME: ()=>PROD_DEFAULT_FILENAME,
|
|
@@ -86,9 +99,11 @@ for(var __webpack_i__ in (()=>{
|
|
|
86
99
|
isWin: ()=>isWin,
|
|
87
100
|
pathExists: ()=>pathExists,
|
|
88
101
|
isPlainObject: ()=>isPlainObject,
|
|
89
|
-
CSS_NAMED_EXPORT: ()
|
|
102
|
+
CSS_NAMED_EXPORT: ()=>!1,
|
|
90
103
|
DEV_DEFAULT_FILENAME: ()=>DEV_DEFAULT_FILENAME,
|
|
104
|
+
cleanUpBeforeRestart: ()=>cleanUpBeforeRestart,
|
|
91
105
|
isUndefined: ()=>isUndefined,
|
|
106
|
+
setupCliShortcuts: ()=>setupCliShortcuts,
|
|
92
107
|
defineConfig: ()=>defineConfig,
|
|
93
108
|
logUpdate: ()=>logUpdate,
|
|
94
109
|
isObject: ()=>isObject,
|
|
@@ -109,18 +124,22 @@ for(var __webpack_i__ in (()=>{
|
|
|
109
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`;
|
|
110
125
|
return output;
|
|
111
126
|
}
|
|
112
|
-
},
|
|
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");
|
|
113
136
|
var external_node_fs_default = __webpack_require__.n(external_node_fs_namespaceObject);
|
|
114
|
-
let external_node_path_namespaceObject = require("node:path");
|
|
115
|
-
var external_node_path_default = __webpack_require__.n(external_node_path_namespaceObject);
|
|
116
|
-
let external_node_url_namespaceObject = require("node:url"), external_jiti_namespaceObject = require("jiti"), external_node_readline_namespaceObject = require("node:readline");
|
|
117
|
-
var external_node_readline_default = __webpack_require__.n(external_node_readline_namespaceObject), logger_LogColor = function(LogColor) {
|
|
118
|
-
return LogColor.error = "red", LogColor.warn = "yellow", LogColor.info = "cyan", LogColor.ready = "green", LogColor.event = "magenta", LogColor.wait = "blue", LogColor.debug = "dim", LogColor;
|
|
119
|
-
}({});
|
|
120
137
|
let external_node_net_namespaceObject = require("node:net");
|
|
121
138
|
var external_node_net_default = __webpack_require__.n(external_node_net_namespaceObject);
|
|
122
139
|
let external_node_os_namespaceObject = require("node:os");
|
|
123
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);
|
|
124
143
|
let external_portfinder_namespaceObject = require("portfinder");
|
|
125
144
|
var external_portfinder_default = __webpack_require__.n(external_portfinder_namespaceObject);
|
|
126
145
|
let CSS_MODULES_LOCAL_IDENT_NAME = '[path][name]__[local]--[hash:5]', CSS_MODULES_REGEX = /\.module\.\w+$/i, DEV_DEFAULT_FILENAME = {
|
|
@@ -133,7 +152,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
133
152
|
jsAsync: 'js/async/[name].[contenthash:8].js',
|
|
134
153
|
css: 'css/[name].[contenthash:8].css',
|
|
135
154
|
cssAsync: 'css/async/[name].[contenthash:8].css'
|
|
136
|
-
}, 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 = {
|
|
137
156
|
workers: 2
|
|
138
157
|
}, DEFAULT_DEV_HOST = '0.0.0.0', TEMPLATE_CONTENT = ({ title = '', headTag = '', mountId = '' })=>`<!DOCTYPE html>
|
|
139
158
|
<html lang="en">
|
|
@@ -214,16 +233,19 @@ for(var __webpack_i__ in (()=>{
|
|
|
214
233
|
'::1',
|
|
215
234
|
'0000:0000:0000:0000:0000:0000:0000:0001'
|
|
216
235
|
].includes(host), concatUrl = ({ host, port, protocol })=>`${protocol}://${host}:${port}/`, LOCAL_LABEL = 'Local: ', NETWORK_LABEL = 'Network: ', getAddressUrls = ({ protocol = 'http', port, host })=>{
|
|
217
|
-
if (host && host !== DEFAULT_DEV_HOST)
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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
|
+
}
|
|
227
249
|
let ipv4Interfaces = getIpv4Interfaces(), addressUrls = [], hasLocalUrl = !1;
|
|
228
250
|
for (let detail of ipv4Interfaces)if (isLoopbackHost(detail.address) || detail.internal) {
|
|
229
251
|
if (hasLocalUrl) continue;
|
|
@@ -245,12 +267,11 @@ for(var __webpack_i__ in (()=>{
|
|
|
245
267
|
});
|
|
246
268
|
return addressUrls;
|
|
247
269
|
}, trackPerformance = (msg)=>{
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
global[k] = performance.now();
|
|
270
|
+
if (!lastTrackTime) {
|
|
271
|
+
lastTrackTime = performance.now();
|
|
251
272
|
return;
|
|
252
273
|
}
|
|
253
|
-
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();
|
|
254
275
|
}, getPathInJs = (absPath)=>JSON.stringify(absPath).slice(1, -1), mergeConfig = merge, getUserDepVersion = (root, dep)=>{
|
|
255
276
|
let depPath = getUserDepPath(root, dep);
|
|
256
277
|
if (depPath) return JSON.parse(external_node_fs_default().readFileSync(external_node_path_default().resolve(depPath, 'package.json'), 'utf-8')).version;
|
|
@@ -291,50 +312,99 @@ for(var __webpack_i__ in (()=>{
|
|
|
291
312
|
if (!browsers) throw Error(`Unsupported ES version: ${esVersion}`);
|
|
292
313
|
return browsers;
|
|
293
314
|
}, logger_prefixes = {
|
|
294
|
-
wait:
|
|
295
|
-
error:
|
|
296
|
-
warn:
|
|
297
|
-
info:
|
|
298
|
-
ready:
|
|
299
|
-
event:
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
}
|
|
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);
|
|
311
353
|
};
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
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);
|
|
332
387
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
})
|
|
337
|
-
|
|
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");
|
|
338
408
|
async function loadConfig({ cliOptions, command }) {
|
|
339
409
|
'build' === command ? setNodeEnv((null == cliOptions ? void 0 : cliOptions.watch) ? 'development' : 'production') : (setNodeEnv('development'), setDevServer(!0));
|
|
340
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 = {};
|
|
@@ -384,7 +454,10 @@ for(var __webpack_i__ in (()=>{
|
|
|
384
454
|
'bundleAnalyze'
|
|
385
455
|
], cliOptions.analyze), (null == cliOptions ? void 0 : cliOptions.root) && setValueByPath(configExport, [
|
|
386
456
|
'root'
|
|
387
|
-
], root), configExport
|
|
457
|
+
], root), (null == cliOptions ? void 0 : cliOptions.host) && setValueByPath(configExport, [
|
|
458
|
+
'server',
|
|
459
|
+
'host'
|
|
460
|
+
], cliOptions.host), configExport;
|
|
388
461
|
}
|
|
389
462
|
function defineConfig(config) {
|
|
390
463
|
return config;
|
|
@@ -641,11 +714,10 @@ for(var __webpack_i__ in (()=>{
|
|
|
641
714
|
constructor(options){
|
|
642
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({
|
|
643
716
|
camelCase: !0,
|
|
644
|
-
namedExports:
|
|
717
|
+
namedExports: !1
|
|
645
718
|
});
|
|
646
719
|
}
|
|
647
720
|
}
|
|
648
|
-
let external_oxc_minify_namespaceObject = require("oxc-minify");
|
|
649
721
|
function jsMinify_define_property(obj, key, value) {
|
|
650
722
|
return key in obj ? Object.defineProperty(obj, key, {
|
|
651
723
|
value: value,
|
|
@@ -659,11 +731,11 @@ for(var __webpack_i__ in (()=>{
|
|
|
659
731
|
apply(compiler) {
|
|
660
732
|
let meta = JSON.stringify({
|
|
661
733
|
name: jsMinify_PLUGIN_NAME,
|
|
662
|
-
version: "3.
|
|
734
|
+
version: "3.3.0",
|
|
663
735
|
options: this.minifyOptions
|
|
664
736
|
});
|
|
665
737
|
compiler.hooks.compilation.tap(jsMinify_PLUGIN_NAME, (compilation)=>{
|
|
666
|
-
compilation.hooks.chunkHash.tap(jsMinify_PLUGIN_NAME, (_, hash)=>hash.update(Buffer.from(meta))), compilation.hooks.processAssets.
|
|
738
|
+
compilation.hooks.chunkHash.tap(jsMinify_PLUGIN_NAME, (_, hash)=>hash.update(Buffer.from(meta))), compilation.hooks.processAssets.tapPromise({
|
|
667
739
|
name: jsMinify_PLUGIN_NAME,
|
|
668
740
|
stage: compiler.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE
|
|
669
741
|
}, ()=>this.transformAssets(compilation)), compilation.hooks.statsPrinter.tap(jsMinify_PLUGIN_NAME, (stats)=>{
|
|
@@ -671,10 +743,10 @@ for(var __webpack_i__ in (()=>{
|
|
|
671
743
|
});
|
|
672
744
|
});
|
|
673
745
|
}
|
|
674
|
-
transformAssets(compilation) {
|
|
675
|
-
let { options: { devtool } } = compilation.compiler, sourceMap = 'string' == typeof devtool && devtool.includes('source-map');
|
|
676
|
-
|
|
677
|
-
let { source, map } = asset.source.sourceAndMap(), { name } = asset, output =
|
|
746
|
+
async transformAssets(compilation) {
|
|
747
|
+
let { options: { devtool } } = compilation.compiler, sourceMap = 'string' == typeof devtool && devtool.includes('source-map'), assets = compilation.getAssets().filter((asset)=>!asset.info.minimized && isJsFile.test(asset.name)), minifyFn = this.customMinify ?? (await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "oxc-minify"))).minify;
|
|
748
|
+
assets.forEach((asset)=>{
|
|
749
|
+
let { source, map } = asset.source.sourceAndMap(), { name } = asset, output = minifyFn(name, Buffer.isBuffer(source) ? source.toString() : source, {
|
|
678
750
|
sourcemap: sourceMap,
|
|
679
751
|
...this.minifyOptions
|
|
680
752
|
}), newMap = null;
|
|
@@ -689,9 +761,9 @@ for(var __webpack_i__ in (()=>{
|
|
|
689
761
|
});
|
|
690
762
|
}
|
|
691
763
|
constructor(options = {}){
|
|
692
|
-
jsMinify_define_property(this, "
|
|
693
|
-
|
|
694
|
-
this.
|
|
764
|
+
jsMinify_define_property(this, "minifyOptions", void 0), jsMinify_define_property(this, "customMinify", void 0);
|
|
765
|
+
const { implementation, ...minifyOptions } = options;
|
|
766
|
+
this.customMinify = null == implementation ? void 0 : implementation.minify, this.minifyOptions = minifyOptions;
|
|
695
767
|
}
|
|
696
768
|
}
|
|
697
769
|
let external_node_child_process_namespaceObject = require("node:child_process");
|
|
@@ -790,17 +862,17 @@ for(var __webpack_i__ in (()=>{
|
|
|
790
862
|
}
|
|
791
863
|
constructor(){
|
|
792
864
|
loadingAnimation_define_property(this, "chars", [
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
]), loadingAnimation_define_property(this, "currentIndex", 0), loadingAnimation_define_property(this, "lastUpdateTime", 0), loadingAnimation_define_property(this, "interval",
|
|
865
|
+
'⠋',
|
|
866
|
+
'⠙',
|
|
867
|
+
'⠹',
|
|
868
|
+
'⠸',
|
|
869
|
+
'⠼',
|
|
870
|
+
'⠴',
|
|
871
|
+
'⠦',
|
|
872
|
+
'⠧',
|
|
873
|
+
'⠇',
|
|
874
|
+
'⠏'
|
|
875
|
+
]), loadingAnimation_define_property(this, "currentIndex", 0), loadingAnimation_define_property(this, "lastUpdateTime", 0), loadingAnimation_define_property(this, "interval", 100);
|
|
804
876
|
}
|
|
805
877
|
}
|
|
806
878
|
function progressBar_define_property(obj, key, value) {
|
|
@@ -867,7 +939,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
867
939
|
}), longest = 0, totalSize = 0, totalCompressedSize = 0;
|
|
868
940
|
await Promise.all(origin.assets.map(async (asset)=>{
|
|
869
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);
|
|
870
|
-
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());
|
|
871
943
|
let chunk = {
|
|
872
944
|
name: external_node_path_default().basename(asset.name),
|
|
873
945
|
path: `${distFolder}/${asset.name}`,
|
|
@@ -893,11 +965,11 @@ for(var __webpack_i__ in (()=>{
|
|
|
893
965
|
chunkGroups.forEach((group)=>{
|
|
894
966
|
group.chunks.sort((a, b)=>a.size - b.size).forEach((chunk)=>{
|
|
895
967
|
let isLarge = 'JS' === group.type && chunk.size / 1000 > 500, relativeOutDir = external_node_path_default().dirname(chunk.path) + '/', log = colors.dim(relativeOutDir);
|
|
896
|
-
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);
|
|
897
969
|
});
|
|
898
970
|
});
|
|
899
971
|
let log = colors.blue('Total'.padEnd(longest + 2));
|
|
900
|
-
log += colors.blue(displaySize(totalSize)), console.log(log += colors.dim(`
|
|
972
|
+
log += colors.blue(displaySize(totalSize)), console.log(log += colors.dim(` │ gzip: ${displaySize(totalCompressedSize)}`));
|
|
901
973
|
}
|
|
902
974
|
function isLikelyFile(filePath) {
|
|
903
975
|
return (filePath.split(external_node_path_namespaceObject.sep).pop() || '').includes('.');
|
|
@@ -907,29 +979,14 @@ for(var __webpack_i__ in (()=>{
|
|
|
907
979
|
0 === files.length && (files = [
|
|
908
980
|
paths[0]
|
|
909
981
|
]);
|
|
910
|
-
let fileInfo = files.slice(0, 1).map((file)=>
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
})(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(', ');
|
|
916
987
|
return files.length > 1 ? `${fileInfo} and ${files.length - 1} more` : fileInfo;
|
|
917
988
|
}
|
|
918
|
-
|
|
919
|
-
let changedFiles = compiler.modifiedFiles ? Array.from(compiler.modifiedFiles) : null;
|
|
920
|
-
if (null == changedFiles ? void 0 : changedFiles.length) {
|
|
921
|
-
let fileInfo = formatFileList(changedFiles, root);
|
|
922
|
-
logger_logger.wait(`building ${colors.dim(fileInfo)}`);
|
|
923
|
-
return;
|
|
924
|
-
}
|
|
925
|
-
let removedFiles = compiler.removedFiles ? Array.from(compiler.removedFiles) : null;
|
|
926
|
-
if (null == removedFiles ? void 0 : removedFiles.length) {
|
|
927
|
-
let fileInfo = formatFileList(removedFiles, root);
|
|
928
|
-
logger_logger.wait(`building ${colors.dim(`removed ${fileInfo}`)}`);
|
|
929
|
-
return;
|
|
930
|
-
}
|
|
931
|
-
logger_logger.wait('building...');
|
|
932
|
-
}
|
|
989
|
+
let sameCount = 0;
|
|
933
990
|
async function compileDone(compiler, stats) {
|
|
934
991
|
let compileTime = stats.toJson({
|
|
935
992
|
preset: 'errors-only',
|
|
@@ -940,27 +997,35 @@ for(var __webpack_i__ in (()=>{
|
|
|
940
997
|
stats
|
|
941
998
|
}), logger_logger.ready(colors.green(`built in ${prettyTime(compileTime)}`));
|
|
942
999
|
else {
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
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)=>{
|
|
946
1013
|
let { resource } = module;
|
|
947
1014
|
if (null == resource ? void 0 : resource.includes(nodeModulesPath)) {
|
|
948
1015
|
let packageName, pathParts = external_node_path_default().relative(nodeModulesPath, resource).split(external_node_path_namespaceObject.sep);
|
|
949
|
-
(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);
|
|
950
1017
|
}
|
|
951
|
-
}), nodeModulesStats
|
|
1018
|
+
}), nodeModulesStats)).sort((a, b)=>a[1] - b[1]).forEach(([packageName, count])=>{
|
|
952
1019
|
logger_logger.debug(`${colors.cyan(packageName)}: ${colors.yellow(count)} modules`);
|
|
953
1020
|
});
|
|
954
1021
|
}
|
|
955
|
-
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)`) : '');
|
|
956
1023
|
}
|
|
957
1024
|
}
|
|
958
1025
|
let progress_PLUGIN_NAME = 'ProgressPlugin';
|
|
959
1026
|
class ProgressLiteRspackPlugin {
|
|
960
1027
|
apply(compiler) {
|
|
961
|
-
compiler.hooks.
|
|
962
|
-
(!utils_isDevServer() || global.__unpack_dev_server_started) && printDevLog(compiler, compiler.options.context);
|
|
963
|
-
}), compiler.hooks.run.tap(progress_PLUGIN_NAME, ()=>{
|
|
1028
|
+
compiler.hooks.run.tap(progress_PLUGIN_NAME, ()=>{
|
|
964
1029
|
logger_logger.info('build started...');
|
|
965
1030
|
}), compiler.hooks.afterDone.tap(progress_PLUGIN_NAME, async (stats)=>{
|
|
966
1031
|
await compileDone(compiler, stats);
|
|
@@ -969,9 +1034,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
969
1034
|
}
|
|
970
1035
|
class ProgressRspackPlugin extends core_namespaceObject.rspack.ProgressPlugin {
|
|
971
1036
|
apply(compiler) {
|
|
972
|
-
super.apply(compiler), compiler.hooks.
|
|
973
|
-
(!utils_isDevServer() || global.__unpack_dev_server_started) && printDevLog(compiler, compiler.options.context);
|
|
974
|
-
}), compiler.hooks.afterDone.tap(progress_PLUGIN_NAME, async (stats)=>{
|
|
1037
|
+
super.apply(compiler), compiler.hooks.afterDone.tap(progress_PLUGIN_NAME, async (stats)=>{
|
|
975
1038
|
await compileDone(compiler, stats);
|
|
976
1039
|
});
|
|
977
1040
|
}
|
|
@@ -1166,16 +1229,15 @@ for(var __webpack_i__ in (()=>{
|
|
|
1166
1229
|
circularCount = 0;
|
|
1167
1230
|
},
|
|
1168
1231
|
onDetected (_, modules) {
|
|
1232
|
+
var paths, paths1;
|
|
1169
1233
|
circularCount++, console.log(''), logger_logger.warn('circular dependency detected:');
|
|
1170
1234
|
let uniquePaths = modules.map((module)=>{
|
|
1171
1235
|
let filePath = module.replace(/^.*!/, ''), relativePath = external_node_path_default().relative(unpackConfig.root, filePath);
|
|
1172
1236
|
return relativePath.startsWith('..') ? filePath : relativePath;
|
|
1173
|
-
}).slice(0, -1), totalLength = 2 + uniquePaths.join(
|
|
1237
|
+
}).slice(0, -1), totalLength = 2 + uniquePaths.join(' → ').length;
|
|
1174
1238
|
if (totalLength > (process.stdout.columns || 80)) {
|
|
1175
|
-
|
|
1176
|
-
console.log('')
|
|
1177
|
-
let arrow = "\u21B3 ", lastIndex = paths.length - 1;
|
|
1178
|
-
paths.forEach((p, i)=>{
|
|
1239
|
+
let arrow, lastIndex;
|
|
1240
|
+
paths = uniquePaths, console.log(''), arrow = '↳ ', lastIndex = paths.length - 1, paths.forEach((p, i)=>{
|
|
1179
1241
|
switch(i){
|
|
1180
1242
|
case 0:
|
|
1181
1243
|
console.log(` ${p}`);
|
|
@@ -1188,13 +1250,10 @@ for(var __webpack_i__ in (()=>{
|
|
|
1188
1250
|
}
|
|
1189
1251
|
}), console.log(` ${arrow}${paths[0]}`), console.log('');
|
|
1190
1252
|
} else {
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
});
|
|
1196
|
-
let lineLength = downArrowPos - upArrowPos;
|
|
1197
|
-
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('');
|
|
1198
1257
|
}
|
|
1199
1258
|
},
|
|
1200
1259
|
onEnd () {
|
|
@@ -1237,9 +1296,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1237
1296
|
experiments: {
|
|
1238
1297
|
css: !1,
|
|
1239
1298
|
asyncWebAssembly: !0,
|
|
1240
|
-
lazyBarrel: !0
|
|
1241
|
-
inlineEnum: !0,
|
|
1242
|
-
typeReexportsPresence: !0
|
|
1299
|
+
lazyBarrel: !0
|
|
1243
1300
|
},
|
|
1244
1301
|
optimization: {
|
|
1245
1302
|
moduleIds: isDev() ? 'named' : 'deterministic',
|
|
@@ -1310,7 +1367,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1310
1367
|
'parser',
|
|
1311
1368
|
'css/module'
|
|
1312
1369
|
], {
|
|
1313
|
-
namedExports:
|
|
1370
|
+
namedExports: !1
|
|
1314
1371
|
}), setValueByPath(config, [
|
|
1315
1372
|
'module',
|
|
1316
1373
|
'generator',
|
|
@@ -1463,7 +1520,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1463
1520
|
})(),
|
|
1464
1521
|
localIdentName: !1 !== modules && (modules.localIdentName || CSS_MODULES_LOCAL_IDENT_NAME),
|
|
1465
1522
|
exportLocalsConvention: EXPORT_LOCALS_CONVENTION,
|
|
1466
|
-
namedExport:
|
|
1523
|
+
namedExport: !1
|
|
1467
1524
|
},
|
|
1468
1525
|
sourceMap
|
|
1469
1526
|
}
|
|
@@ -1579,7 +1636,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1579
1636
|
};
|
|
1580
1637
|
isWatch() ? compiler.watch({}, handler) : compiler.run(handler);
|
|
1581
1638
|
}
|
|
1582
|
-
let
|
|
1639
|
+
let dev_server_namespaceObject = require("@rspack/dev-server");
|
|
1583
1640
|
async function openBrowser(url) {
|
|
1584
1641
|
if ('darwin' === process.platform) try {
|
|
1585
1642
|
let ps = await execAsync('ps cax'), openedBrowser = [
|
|
@@ -1652,19 +1709,20 @@ for(var __webpack_i__ in (()=>{
|
|
|
1652
1709
|
'react-dom': 'ReactDOM',
|
|
1653
1710
|
'react-router-dom': 'ReactRouterDOM'
|
|
1654
1711
|
})[pkgName] || pkgName, getExternalValue = (pkgName)=>`window ${getExternalLibraryName(pkgName)}`, prebundleDeps = async ({ unpackConfig })=>{
|
|
1655
|
-
var _unpackConfig_dev;
|
|
1656
|
-
let count = {
|
|
1712
|
+
var _unpackConfig_dev, failedDepsCachePath, externals, failedDepsCachePath1, cache;
|
|
1713
|
+
let existExternals, cacheDir, count = {
|
|
1657
1714
|
total: 0,
|
|
1658
1715
|
bundled: 0
|
|
1659
|
-
}, failedDeps = [], root = unpackConfig.root,
|
|
1660
|
-
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();
|
|
1661
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 = [
|
|
1662
|
-
...((externals)=>{
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
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) || []),
|
|
1668
1726
|
...userOptions.exclude || []
|
|
1669
1727
|
], shouldIncludeDeps = Object.keys(packageJson.dependencies).filter((pkgName)=>!excludeDeps.includes(pkgName)), noEntryDeps = [], needBundleDeps = shouldIncludeDeps.map((pkgName)=>{
|
|
1670
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;
|
|
@@ -1811,19 +1869,16 @@ for(var __webpack_i__ in (()=>{
|
|
|
1811
1869
|
});
|
|
1812
1870
|
});
|
|
1813
1871
|
}))(depInfo)));
|
|
1814
|
-
((
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
recursive: !0
|
|
1818
|
-
}), external_node_fs_default().writeFileSync(failedDepsCachePath, JSON.stringify(cache, null, 2), 'utf-8');
|
|
1819
|
-
})(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(', '))}"`);
|
|
1820
1875
|
let cachePath = external_node_path_default().resolve(root, TEMP_DIR, 'umd'), app = external_express_default()();
|
|
1821
1876
|
app.use(external_cors_default()()), app.use("/umd", external_express_default().static(cachePath));
|
|
1822
1877
|
let port = await getPort(), staticServer = app.listen(port, ()=>{});
|
|
1823
|
-
|
|
1824
|
-
let
|
|
1878
|
+
addRestartCleaner(()=>new Promise((resolve)=>staticServer.close(()=>resolve())));
|
|
1879
|
+
let externals1 = {}, jsAssets = [], cssAssets = [], preJsAssets = [];
|
|
1825
1880
|
return bundledDeps.filter(Boolean).forEach((dep)=>{
|
|
1826
|
-
dep && (
|
|
1881
|
+
dep && (externals1[dep.name] = getExternalValue(dep.name), dep.assets.forEach((absPath)=>{
|
|
1827
1882
|
let relativePath = external_node_path_default().relative(cachePath, absPath), preDeps = [
|
|
1828
1883
|
'react',
|
|
1829
1884
|
'react-dom',
|
|
@@ -1841,10 +1896,10 @@ for(var __webpack_i__ in (()=>{
|
|
|
1841
1896
|
}
|
|
1842
1897
|
}));
|
|
1843
1898
|
}), unpackConfig.externals = Array.isArray(unpackConfig.externals) ? [
|
|
1844
|
-
|
|
1899
|
+
externals1,
|
|
1845
1900
|
...unpackConfig.externals
|
|
1846
1901
|
] : {
|
|
1847
|
-
...
|
|
1902
|
+
...externals1,
|
|
1848
1903
|
...unpackConfig.externals
|
|
1849
1904
|
}, unpackConfig.plugins.push({
|
|
1850
1905
|
name: 'unpack:prebundle',
|
|
@@ -1867,10 +1922,9 @@ for(var __webpack_i__ in (()=>{
|
|
|
1867
1922
|
}), config;
|
|
1868
1923
|
}
|
|
1869
1924
|
}), unpackConfig;
|
|
1870
|
-
}
|
|
1871
|
-
var external_webpack_dev_server_default = __webpack_require__.n(external_webpack_dev_server_namespaceObject);
|
|
1925
|
+
};
|
|
1872
1926
|
async function unpackDev(originalUnpackConfig) {
|
|
1873
|
-
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;
|
|
1874
1928
|
let unpackConfig = originalUnpackConfig;
|
|
1875
1929
|
(null == (_unpackConfig_dev = unpackConfig.dev) ? void 0 : _unpackConfig_dev.prebundle) && (unpackConfig = await prebundleDeps({
|
|
1876
1930
|
unpackConfig
|
|
@@ -1905,23 +1959,40 @@ for(var __webpack_i__ in (()=>{
|
|
|
1905
1959
|
var _req_headers_accept;
|
|
1906
1960
|
(null == (_req_headers_accept = req.headers.accept) ? void 0 : _req_headers_accept.includes('html')) && (req.url = '/index.html'), next();
|
|
1907
1961
|
}), middlewares.unshift(core_namespaceObject.experiments.lazyCompilationMiddleware(compiler)), middlewares);
|
|
1908
|
-
let server = new (
|
|
1909
|
-
await server.start(), logger_logger.greet(` ${colors.green(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v3.
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
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)}/`)))}`);
|
|
1919
1995
|
});
|
|
1920
|
-
let open = null == (_unpackConfig_server2 = unpackConfig.server) ? void 0 : _unpackConfig_server2.open;
|
|
1921
|
-
if (open) {
|
|
1922
|
-
let url = isString(open) ? open : `http://localhost:${port}`;
|
|
1923
|
-
await openBrowser(url);
|
|
1924
|
-
}
|
|
1925
1996
|
}
|
|
1926
1997
|
function createUnpack({ cwd = process.cwd(), config, callerName = 'unpack' }) {
|
|
1927
1998
|
let resolveConfig = ()=>{
|
|
@@ -1959,11 +2030,11 @@ for(var __webpack_i__ in (()=>{
|
|
|
1959
2030
|
'PUBLIC_'
|
|
1960
2031
|
]
|
|
1961
2032
|
};
|
|
1962
|
-
return {
|
|
2033
|
+
return global.__unpack_caller_name = callerName, {
|
|
1963
2034
|
...mergeConfig(defaultConfig, config),
|
|
1964
2035
|
_context: {
|
|
1965
2036
|
callerName,
|
|
1966
|
-
version: "3.
|
|
2037
|
+
version: "3.3.0"
|
|
1967
2038
|
}
|
|
1968
2039
|
};
|
|
1969
2040
|
};
|
|
@@ -1971,7 +2042,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1971
2042
|
build: async ({ watch } = {})=>{
|
|
1972
2043
|
setNodeEnv(watch ? 'development' : 'production');
|
|
1973
2044
|
let config = resolveConfig();
|
|
1974
|
-
console.log(colors.rainbow(`${callerName} v3.
|
|
2045
|
+
console.log(colors.rainbow(`${callerName} v3.3.0`), colors.green(`building for ${getNodeEnv()}...`)), await unpackBuild(config);
|
|
1975
2046
|
},
|
|
1976
2047
|
dev: async ()=>{
|
|
1977
2048
|
global.__unpack_start_time = performance.now(), setNodeEnv('development'), setDevServer(!0);
|
|
@@ -1998,7 +2069,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1998
2069
|
...options
|
|
1999
2070
|
});
|
|
2000
2071
|
}
|
|
2001
|
-
})(), 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 === [
|
|
2002
2073
|
"CSS_MODULES_LOCAL_IDENT_NAME",
|
|
2003
2074
|
"CSS_MODULES_REGEX",
|
|
2004
2075
|
"CSS_NAMED_EXPORT",
|
|
@@ -2011,10 +2082,13 @@ for(var __webpack_i__ in (()=>{
|
|
|
2011
2082
|
"TEMPLATE_CONTENT",
|
|
2012
2083
|
"TEMP_DIR",
|
|
2013
2084
|
"THREAD_OPTIONS",
|
|
2085
|
+
"addRestartCleaner",
|
|
2086
|
+
"cleanUpBeforeRestart",
|
|
2014
2087
|
"clearLine",
|
|
2015
2088
|
"colors",
|
|
2016
2089
|
"createChokidar",
|
|
2017
2090
|
"createUnpack",
|
|
2091
|
+
"currentDevUnpackConfig",
|
|
2018
2092
|
"debounce",
|
|
2019
2093
|
"defineConfig",
|
|
2020
2094
|
"esVersionToBrowserslist",
|
|
@@ -2056,11 +2130,12 @@ for(var __webpack_i__ in (()=>{
|
|
|
2056
2130
|
"prettyTime",
|
|
2057
2131
|
"removeDir",
|
|
2058
2132
|
"resolveConfigPath",
|
|
2059
|
-
"restartCleaners",
|
|
2060
2133
|
"rspack",
|
|
2134
|
+
"setCurrentDevUnpackConfig",
|
|
2061
2135
|
"setDevServer",
|
|
2062
2136
|
"setNodeEnv",
|
|
2063
2137
|
"setValueByPath",
|
|
2138
|
+
"setupCliShortcuts",
|
|
2064
2139
|
"trackPerformance"
|
|
2065
2140
|
].indexOf(__webpack_i__) && (exports[__webpack_i__] = __webpack_exports__[__webpack_i__]);
|
|
2066
2141
|
Object.defineProperty(exports, '__esModule', {
|