@unpackjs/core 3.2.7 → 3.3.1
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 +271 -233
- package/dist/index.js +269 -236
- package/dist/typedCssModulesLoader.mjs +5 -13
- package/dist-types/bundler-config/index.d.ts.map +1 -1
- package/dist-types/bundler-config/plugins/oxlint/index.d.ts +0 -3
- package/dist-types/bundler-config/plugins/oxlint/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 +9 -9
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.1",
|
|
667
735
|
options: this.minifyOptions
|
|
668
736
|
});
|
|
669
737
|
compiler.hooks.compilation.tap(jsMinify_PLUGIN_NAME, (compilation)=>{
|
|
@@ -694,49 +762,19 @@ 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
|
}
|
|
701
769
|
let external_node_child_process_namespaceObject = require("node:child_process");
|
|
702
|
-
function oxlint_define_property(obj, key, value) {
|
|
703
|
-
return key in obj ? Object.defineProperty(obj, key, {
|
|
704
|
-
value: value,
|
|
705
|
-
enumerable: !0,
|
|
706
|
-
configurable: !0,
|
|
707
|
-
writable: !0
|
|
708
|
-
}) : obj[key] = value, obj;
|
|
709
|
-
}
|
|
710
770
|
class OxlintPlugin {
|
|
711
|
-
getGitChangedFiles() {
|
|
712
|
-
return new Promise((resolve)=>{
|
|
713
|
-
var _child_stdout;
|
|
714
|
-
let child = (0, external_node_child_process_namespaceObject.spawn)('git', [
|
|
715
|
-
'status',
|
|
716
|
-
'--porcelain'
|
|
717
|
-
], {
|
|
718
|
-
cwd: process.cwd(),
|
|
719
|
-
stdio: 'pipe'
|
|
720
|
-
}), output = '';
|
|
721
|
-
null == (_child_stdout = child.stdout) || _child_stdout.on('data', (data)=>{
|
|
722
|
-
output += data.toString();
|
|
723
|
-
}), child.on('exit', (code)=>{
|
|
724
|
-
0 === code ? resolve(output.trim().split('\n').filter(Boolean).map((line)=>{
|
|
725
|
-
let idx = line.indexOf(' '), status = line.slice(0, idx), filePath = line.slice(idx + 1).trim();
|
|
726
|
-
return status.includes('D') ? null : ((status.startsWith('R') || status.startsWith('C')) && (filePath = filePath.split(' -> ')[1]), filePath);
|
|
727
|
-
}).filter(Boolean).map((file)=>external_node_path_default().resolve(process.cwd(), file))) : resolve([]);
|
|
728
|
-
}), child.on('error', ()=>{
|
|
729
|
-
resolve([]);
|
|
730
|
-
});
|
|
731
|
-
});
|
|
732
|
-
}
|
|
733
771
|
runOxlint(args) {
|
|
734
772
|
var _child_stdout, _child_stderr;
|
|
735
|
-
let
|
|
773
|
+
let child = (0, external_node_child_process_namespaceObject.spawn)('npx', [
|
|
736
774
|
'--yes',
|
|
737
775
|
...args
|
|
738
776
|
], {
|
|
739
|
-
cwd,
|
|
777
|
+
cwd: process.cwd(),
|
|
740
778
|
stdio: 'pipe',
|
|
741
779
|
shell: !0,
|
|
742
780
|
env: {
|
|
@@ -747,34 +785,31 @@ for(var __webpack_i__ in (()=>{
|
|
|
747
785
|
null == (_child_stdout = child.stdout) || _child_stdout.on('data', (data)=>{
|
|
748
786
|
output += data.toString();
|
|
749
787
|
}), child.on('exit', (code)=>{
|
|
750
|
-
output.includes('Found 0 warnings and 0 errors')
|
|
788
|
+
let hasErrors = !output.includes('Found 0 warnings and 0 errors'), hasNoFiles = output.includes('on 0 files');
|
|
789
|
+
(hasErrors || 0 !== code) && !hasNoFiles && process.stdout.write(output);
|
|
751
790
|
}), null == (_child_stderr = child.stderr) || _child_stderr.on('data', (data)=>{
|
|
752
791
|
process.stderr.write(data);
|
|
753
792
|
});
|
|
754
793
|
}
|
|
755
794
|
apply(compiler) {
|
|
756
795
|
compiler.hooks.watchRun.tap('OxlintPlugin', ()=>{
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
}, this.debounceTime);
|
|
796
|
+
let configPath = external_node_path_default().resolve(__dirname, '.oxlintrc.json'), changedFiles = compiler.modifiedFiles ? Array.from(compiler.modifiedFiles) : [];
|
|
797
|
+
if (1 === changedFiles.length) {
|
|
798
|
+
let currentFile = changedFiles[0];
|
|
799
|
+
if (external_node_fs_default().existsSync(currentFile) && external_node_fs_default().statSync(currentFile).isFile()) {
|
|
800
|
+
let args = [
|
|
801
|
+
'oxlint',
|
|
802
|
+
'-c',
|
|
803
|
+
configPath,
|
|
804
|
+
currentFile,
|
|
805
|
+
'--fix',
|
|
806
|
+
'--fix-suggestions'
|
|
807
|
+
];
|
|
808
|
+
this.runOxlint(args);
|
|
809
|
+
}
|
|
810
|
+
}
|
|
773
811
|
});
|
|
774
812
|
}
|
|
775
|
-
constructor(){
|
|
776
|
-
oxlint_define_property(this, "timeoutId", null), oxlint_define_property(this, "debounceTime", 200);
|
|
777
|
-
}
|
|
778
813
|
}
|
|
779
814
|
function loadingAnimation_define_property(obj, key, value) {
|
|
780
815
|
return key in obj ? Object.defineProperty(obj, key, {
|
|
@@ -794,16 +829,16 @@ for(var __webpack_i__ in (()=>{
|
|
|
794
829
|
}
|
|
795
830
|
constructor(){
|
|
796
831
|
loadingAnimation_define_property(this, "chars", [
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
832
|
+
'⠋',
|
|
833
|
+
'⠙',
|
|
834
|
+
'⠹',
|
|
835
|
+
'⠸',
|
|
836
|
+
'⠼',
|
|
837
|
+
'⠴',
|
|
838
|
+
'⠦',
|
|
839
|
+
'⠧',
|
|
840
|
+
'⠇',
|
|
841
|
+
'⠏'
|
|
807
842
|
]), loadingAnimation_define_property(this, "currentIndex", 0), loadingAnimation_define_property(this, "lastUpdateTime", 0), loadingAnimation_define_property(this, "interval", 100);
|
|
808
843
|
}
|
|
809
844
|
}
|
|
@@ -871,7 +906,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
871
906
|
}), longest = 0, totalSize = 0, totalCompressedSize = 0;
|
|
872
907
|
await Promise.all(origin.assets.map(async (asset)=>{
|
|
873
908
|
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(
|
|
909
|
+
totalSize += size, totalCompressedSize += compressedSize, compressedCount++, logUpdate(`${loadingAnimation.getCurrentChar()} computing gzip size (${compressedCount})...`), compressedCount === origin.assets.length && (logUpdate(`✓ computed gzip size (${compressedCount})`), console.log());
|
|
875
910
|
let chunk = {
|
|
876
911
|
name: external_node_path_default().basename(asset.name),
|
|
877
912
|
path: `${distFolder}/${asset.name}`,
|
|
@@ -897,11 +932,11 @@ for(var __webpack_i__ in (()=>{
|
|
|
897
932
|
chunkGroups.forEach((group)=>{
|
|
898
933
|
group.chunks.sort((a, b)=>a.size - b.size).forEach((chunk)=>{
|
|
899
934
|
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(`
|
|
935
|
+
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
936
|
});
|
|
902
937
|
});
|
|
903
938
|
let log = colors.blue('Total'.padEnd(longest + 2));
|
|
904
|
-
log += colors.blue(displaySize(totalSize)), console.log(log += colors.dim(`
|
|
939
|
+
log += colors.blue(displaySize(totalSize)), console.log(log += colors.dim(` │ gzip: ${displaySize(totalCompressedSize)}`));
|
|
905
940
|
}
|
|
906
941
|
function isLikelyFile(filePath) {
|
|
907
942
|
return (filePath.split(external_node_path_namespaceObject.sep).pop() || '').includes('.');
|
|
@@ -911,29 +946,14 @@ for(var __webpack_i__ in (()=>{
|
|
|
911
946
|
0 === files.length && (files = [
|
|
912
947
|
paths[0]
|
|
913
948
|
]);
|
|
914
|
-
let fileInfo = files.slice(0, 1).map((file)=>
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
})(file, rootPath)).join(', ');
|
|
949
|
+
let fileInfo = files.slice(0, 1).map((file)=>{
|
|
950
|
+
var originalFilePath, root;
|
|
951
|
+
let prefix, filePath, parts;
|
|
952
|
+
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);
|
|
953
|
+
}).join(', ');
|
|
920
954
|
return files.length > 1 ? `${fileInfo} and ${files.length - 1} more` : fileInfo;
|
|
921
955
|
}
|
|
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
|
-
}
|
|
956
|
+
let sameCount = 0;
|
|
937
957
|
async function compileDone(compiler, stats) {
|
|
938
958
|
let compileTime = stats.toJson({
|
|
939
959
|
preset: 'errors-only',
|
|
@@ -944,27 +964,35 @@ for(var __webpack_i__ in (()=>{
|
|
|
944
964
|
stats
|
|
945
965
|
}), logger_logger.ready(colors.green(`built in ${prettyTime(compileTime)}`));
|
|
946
966
|
else {
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
967
|
+
let changedFiles = compiler.modifiedFiles ? Array.from(compiler.modifiedFiles) : null, fileInfo = function(changedFiles, removedFiles, root) {
|
|
968
|
+
if (!(null == changedFiles ? void 0 : changedFiles.length) && !(null == removedFiles ? void 0 : removedFiles.length)) return null;
|
|
969
|
+
if ((null == changedFiles ? void 0 : changedFiles.length) && (null == removedFiles ? void 0 : removedFiles.length)) {
|
|
970
|
+
let changedInfo = formatFileList(changedFiles, root), removedInfo = formatFileList(removedFiles, root);
|
|
971
|
+
return `${changedInfo}, removed ${removedInfo}`;
|
|
972
|
+
}
|
|
973
|
+
return (null == changedFiles ? void 0 : changedFiles.length) ? formatFileList(changedFiles, root) : (null == removedFiles ? void 0 : removedFiles.length) ? `removed ${formatFileList(removedFiles, root)}` : null;
|
|
974
|
+
}(changedFiles, compiler.removedFiles ? Array.from(compiler.removedFiles) : null, root);
|
|
975
|
+
if (!fileInfo) return;
|
|
976
|
+
if (fileInfo === lastFileInfo ? sameCount++ : (lastFileInfo = fileInfo, sameCount = 1), isDebug()) {
|
|
977
|
+
var modules, root1;
|
|
978
|
+
let nodeModulesStats, nodeModulesPath;
|
|
979
|
+
Object.entries((modules = stats.compilation.modules, root1 = root, nodeModulesStats = {}, nodeModulesPath = external_node_path_default().resolve(root1, 'node_modules'), modules.forEach((module)=>{
|
|
950
980
|
let { resource } = module;
|
|
951
981
|
if (null == resource ? void 0 : resource.includes(nodeModulesPath)) {
|
|
952
982
|
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
|
|
983
|
+
(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
984
|
}
|
|
955
|
-
}), nodeModulesStats
|
|
985
|
+
}), nodeModulesStats)).sort((a, b)=>a[1] - b[1]).forEach(([packageName, count])=>{
|
|
956
986
|
logger_logger.debug(`${colors.cyan(packageName)}: ${colors.yellow(count)} modules`);
|
|
957
987
|
});
|
|
958
988
|
}
|
|
959
|
-
logger_logger.
|
|
989
|
+
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
990
|
}
|
|
961
991
|
}
|
|
962
992
|
let progress_PLUGIN_NAME = 'ProgressPlugin';
|
|
963
993
|
class ProgressLiteRspackPlugin {
|
|
964
994
|
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, ()=>{
|
|
995
|
+
compiler.hooks.run.tap(progress_PLUGIN_NAME, ()=>{
|
|
968
996
|
logger_logger.info('build started...');
|
|
969
997
|
}), compiler.hooks.afterDone.tap(progress_PLUGIN_NAME, async (stats)=>{
|
|
970
998
|
await compileDone(compiler, stats);
|
|
@@ -973,9 +1001,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
973
1001
|
}
|
|
974
1002
|
class ProgressRspackPlugin extends core_namespaceObject.rspack.ProgressPlugin {
|
|
975
1003
|
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)=>{
|
|
1004
|
+
super.apply(compiler), compiler.hooks.afterDone.tap(progress_PLUGIN_NAME, async (stats)=>{
|
|
979
1005
|
await compileDone(compiler, stats);
|
|
980
1006
|
});
|
|
981
1007
|
}
|
|
@@ -1170,16 +1196,15 @@ for(var __webpack_i__ in (()=>{
|
|
|
1170
1196
|
circularCount = 0;
|
|
1171
1197
|
},
|
|
1172
1198
|
onDetected (_, modules) {
|
|
1199
|
+
var paths, paths1;
|
|
1173
1200
|
circularCount++, console.log(''), logger_logger.warn('circular dependency detected:');
|
|
1174
1201
|
let uniquePaths = modules.map((module)=>{
|
|
1175
1202
|
let filePath = module.replace(/^.*!/, ''), relativePath = external_node_path_default().relative(unpackConfig.root, filePath);
|
|
1176
1203
|
return relativePath.startsWith('..') ? filePath : relativePath;
|
|
1177
|
-
}).slice(0, -1), totalLength = 2 + uniquePaths.join(
|
|
1204
|
+
}).slice(0, -1), totalLength = 2 + uniquePaths.join(' → ').length;
|
|
1178
1205
|
if (totalLength > (process.stdout.columns || 80)) {
|
|
1179
|
-
|
|
1180
|
-
console.log('')
|
|
1181
|
-
let arrow = "\u21B3 ", lastIndex = paths.length - 1;
|
|
1182
|
-
paths.forEach((p, i)=>{
|
|
1206
|
+
let arrow, lastIndex;
|
|
1207
|
+
paths = uniquePaths, console.log(''), arrow = '↳ ', lastIndex = paths.length - 1, paths.forEach((p, i)=>{
|
|
1183
1208
|
switch(i){
|
|
1184
1209
|
case 0:
|
|
1185
1210
|
console.log(` ${p}`);
|
|
@@ -1192,13 +1217,10 @@ for(var __webpack_i__ in (()=>{
|
|
|
1192
1217
|
}
|
|
1193
1218
|
}), console.log(` ${arrow}${paths[0]}`), console.log('');
|
|
1194
1219
|
} 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('');
|
|
1220
|
+
let line1, upArrowPos, downArrowPos, lineLength;
|
|
1221
|
+
line1 = ' ', upArrowPos = 2, downArrowPos = 0, (paths1 = uniquePaths).forEach((p, i)=>{
|
|
1222
|
+
line1 += p, i < paths1.length - 1 ? line1 += ' → ' : downArrowPos = line1.length - 1;
|
|
1223
|
+
}), 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
1224
|
}
|
|
1203
1225
|
},
|
|
1204
1226
|
onEnd () {
|
|
@@ -1241,9 +1263,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1241
1263
|
experiments: {
|
|
1242
1264
|
css: !1,
|
|
1243
1265
|
asyncWebAssembly: !0,
|
|
1244
|
-
lazyBarrel: !0
|
|
1245
|
-
inlineEnum: !0,
|
|
1246
|
-
typeReexportsPresence: !0
|
|
1266
|
+
lazyBarrel: !0
|
|
1247
1267
|
},
|
|
1248
1268
|
optimization: {
|
|
1249
1269
|
moduleIds: isDev() ? 'named' : 'deterministic',
|
|
@@ -1314,7 +1334,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1314
1334
|
'parser',
|
|
1315
1335
|
'css/module'
|
|
1316
1336
|
], {
|
|
1317
|
-
namedExports:
|
|
1337
|
+
namedExports: !1
|
|
1318
1338
|
}), setValueByPath(config, [
|
|
1319
1339
|
'module',
|
|
1320
1340
|
'generator',
|
|
@@ -1467,7 +1487,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1467
1487
|
})(),
|
|
1468
1488
|
localIdentName: !1 !== modules && (modules.localIdentName || CSS_MODULES_LOCAL_IDENT_NAME),
|
|
1469
1489
|
exportLocalsConvention: EXPORT_LOCALS_CONVENTION,
|
|
1470
|
-
namedExport:
|
|
1490
|
+
namedExport: !1
|
|
1471
1491
|
},
|
|
1472
1492
|
sourceMap
|
|
1473
1493
|
}
|
|
@@ -1583,7 +1603,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1583
1603
|
};
|
|
1584
1604
|
isWatch() ? compiler.watch({}, handler) : compiler.run(handler);
|
|
1585
1605
|
}
|
|
1586
|
-
let
|
|
1606
|
+
let dev_server_namespaceObject = require("@rspack/dev-server");
|
|
1587
1607
|
async function openBrowser(url) {
|
|
1588
1608
|
if ('darwin' === process.platform) try {
|
|
1589
1609
|
let ps = await execAsync('ps cax'), openedBrowser = [
|
|
@@ -1656,19 +1676,20 @@ for(var __webpack_i__ in (()=>{
|
|
|
1656
1676
|
'react-dom': 'ReactDOM',
|
|
1657
1677
|
'react-router-dom': 'ReactRouterDOM'
|
|
1658
1678
|
})[pkgName] || pkgName, getExternalValue = (pkgName)=>`window ${getExternalLibraryName(pkgName)}`, prebundleDeps = async ({ unpackConfig })=>{
|
|
1659
|
-
var _unpackConfig_dev;
|
|
1660
|
-
let count = {
|
|
1679
|
+
var _unpackConfig_dev, failedDepsCachePath, externals, failedDepsCachePath1, cache;
|
|
1680
|
+
let existExternals, cacheDir, count = {
|
|
1661
1681
|
total: 0,
|
|
1662
1682
|
bundled: 0
|
|
1663
|
-
}, failedDeps = [], root = unpackConfig.root,
|
|
1664
|
-
logUpdate(`${colors.magenta(
|
|
1683
|
+
}, 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 = ()=>{
|
|
1684
|
+
logUpdate(`${colors.magenta('»')} optimizing dependencies (${count.bundled}/${count.total})`), count.total === count.bundled + failedDeps.length && console.log();
|
|
1665
1685
|
}, 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
|
-
|
|
1686
|
+
...(externals = unpackConfig.externals, existExternals = new Set(), Array.isArray(externals) ? externals.forEach((item)=>{
|
|
1687
|
+
isPlainObject(item) && Object.keys(item).forEach((key)=>{
|
|
1688
|
+
existExternals.add(key);
|
|
1689
|
+
});
|
|
1690
|
+
}) : isPlainObject(externals) && Object.keys(externals).forEach((key)=>{
|
|
1691
|
+
existExternals.add(key);
|
|
1692
|
+
}), Array.from(existExternals) || []),
|
|
1672
1693
|
...userOptions.exclude || []
|
|
1673
1694
|
], shouldIncludeDeps = Object.keys(packageJson.dependencies).filter((pkgName)=>!excludeDeps.includes(pkgName)), noEntryDeps = [], needBundleDeps = shouldIncludeDeps.map((pkgName)=>{
|
|
1674
1695
|
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 +1836,16 @@ for(var __webpack_i__ in (()=>{
|
|
|
1815
1836
|
});
|
|
1816
1837
|
});
|
|
1817
1838
|
}))(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(', '))}"`);
|
|
1839
|
+
failedDepsCachePath1 = failedDepsCachePath2, cache = failedCache, cacheDir = external_node_path_default().dirname(failedDepsCachePath1), external_node_fs_default().existsSync(cacheDir) || external_node_fs_default().mkdirSync(cacheDir, {
|
|
1840
|
+
recursive: !0
|
|
1841
|
+
}), 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
1842
|
let cachePath = external_node_path_default().resolve(root, TEMP_DIR, 'umd'), app = external_express_default()();
|
|
1825
1843
|
app.use(external_cors_default()()), app.use("/umd", external_express_default().static(cachePath));
|
|
1826
1844
|
let port = await getPort(), staticServer = app.listen(port, ()=>{});
|
|
1827
|
-
|
|
1828
|
-
let
|
|
1845
|
+
addRestartCleaner(()=>new Promise((resolve)=>staticServer.close(()=>resolve())));
|
|
1846
|
+
let externals1 = {}, jsAssets = [], cssAssets = [], preJsAssets = [];
|
|
1829
1847
|
return bundledDeps.filter(Boolean).forEach((dep)=>{
|
|
1830
|
-
dep && (
|
|
1848
|
+
dep && (externals1[dep.name] = getExternalValue(dep.name), dep.assets.forEach((absPath)=>{
|
|
1831
1849
|
let relativePath = external_node_path_default().relative(cachePath, absPath), preDeps = [
|
|
1832
1850
|
'react',
|
|
1833
1851
|
'react-dom',
|
|
@@ -1845,10 +1863,10 @@ for(var __webpack_i__ in (()=>{
|
|
|
1845
1863
|
}
|
|
1846
1864
|
}));
|
|
1847
1865
|
}), unpackConfig.externals = Array.isArray(unpackConfig.externals) ? [
|
|
1848
|
-
|
|
1866
|
+
externals1,
|
|
1849
1867
|
...unpackConfig.externals
|
|
1850
1868
|
] : {
|
|
1851
|
-
...
|
|
1869
|
+
...externals1,
|
|
1852
1870
|
...unpackConfig.externals
|
|
1853
1871
|
}, unpackConfig.plugins.push({
|
|
1854
1872
|
name: 'unpack:prebundle',
|
|
@@ -1871,10 +1889,9 @@ for(var __webpack_i__ in (()=>{
|
|
|
1871
1889
|
}), config;
|
|
1872
1890
|
}
|
|
1873
1891
|
}), unpackConfig;
|
|
1874
|
-
}
|
|
1875
|
-
var external_webpack_dev_server_default = __webpack_require__.n(external_webpack_dev_server_namespaceObject);
|
|
1892
|
+
};
|
|
1876
1893
|
async function unpackDev(originalUnpackConfig) {
|
|
1877
|
-
var _unpackConfig_dev, _unpackConfig_server, _unpackConfig_server1, _unpackConfig_dev1, _unpackConfig_server2;
|
|
1894
|
+
var _unpackConfig_dev, _unpackConfig_server, _unpackConfig_server1, _unpackConfig_dev1, _unpackConfig_server2, _unpackConfig_server3;
|
|
1878
1895
|
let unpackConfig = originalUnpackConfig;
|
|
1879
1896
|
(null == (_unpackConfig_dev = unpackConfig.dev) ? void 0 : _unpackConfig_dev.prebundle) && (unpackConfig = await prebundleDeps({
|
|
1880
1897
|
unpackConfig
|
|
@@ -1909,23 +1926,40 @@ for(var __webpack_i__ in (()=>{
|
|
|
1909
1926
|
var _req_headers_accept;
|
|
1910
1927
|
(null == (_req_headers_accept = req.headers.accept) ? void 0 : _req_headers_accept.includes('html')) && (req.url = '/index.html'), next();
|
|
1911
1928
|
}), 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
|
-
|
|
1929
|
+
let server = new dev_server_namespaceObject.RspackDevServer(devServerOptions, compiler);
|
|
1930
|
+
await server.start(), logger_logger.greet(` ${colors.green(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v3.3.1`)} ${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(()=>server.stop(), ()=>new Promise((resolve)=>compiler.close(()=>resolve())));
|
|
1931
|
+
let open = null == (_unpackConfig_server3 = unpackConfig.server) ? void 0 : _unpackConfig_server3.open, url = isString(open) ? open : `http://localhost:${port}`;
|
|
1932
|
+
open && openBrowser(url), setupCliShortcuts({
|
|
1933
|
+
openPage: async ()=>{
|
|
1934
|
+
await openBrowser(url);
|
|
1935
|
+
},
|
|
1936
|
+
closeServer: async ()=>{
|
|
1937
|
+
await cleanUpBeforeRestart(), process.exit(0);
|
|
1938
|
+
},
|
|
1939
|
+
printUrls: ()=>{
|
|
1940
|
+
var _unpackConfig_server;
|
|
1941
|
+
printAddressUrls(port, null == (_unpackConfig_server = unpackConfig.server) ? void 0 : _unpackConfig_server.host);
|
|
1942
|
+
},
|
|
1943
|
+
restartServer: async ()=>{
|
|
1944
|
+
logger_logger.clear(), await cleanUpBeforeRestart(), createUnpack({
|
|
1945
|
+
cwd: currentDevUnpackConfig.root,
|
|
1946
|
+
config: currentDevUnpackConfig
|
|
1947
|
+
}).dev();
|
|
1948
|
+
}
|
|
1949
|
+
});
|
|
1950
|
+
}
|
|
1951
|
+
function printAddressUrls(port, host) {
|
|
1952
|
+
let addressUrls = getAddressUrls({
|
|
1953
|
+
port
|
|
1954
|
+
}), colorPrefix = colors.green('➜');
|
|
1955
|
+
addressUrls.forEach((addr, index)=>{
|
|
1956
|
+
let url;
|
|
1957
|
+
if (!host && 0 !== index) {
|
|
1958
|
+
1 === index && console.log(` ${colors.dim(colorPrefix)} ${colors.bold(colors.dim('Network:'))} ${colors.dim('use')} ${colors.bold('--host')} ${colors.dim('to expose')}`);
|
|
1959
|
+
return;
|
|
1960
|
+
}
|
|
1961
|
+
console.log(` ${colorPrefix} ${colors.bold(addr.label)}${(url = addr.url, colors.cyan(url.replace(/:(\d+)\//, (_, port)=>`:${colors.bold(port)}/`)))}`);
|
|
1923
1962
|
});
|
|
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
1963
|
}
|
|
1930
1964
|
function createUnpack({ cwd = process.cwd(), config, callerName = 'unpack' }) {
|
|
1931
1965
|
let resolveConfig = ()=>{
|
|
@@ -1963,11 +1997,11 @@ for(var __webpack_i__ in (()=>{
|
|
|
1963
1997
|
'PUBLIC_'
|
|
1964
1998
|
]
|
|
1965
1999
|
};
|
|
1966
|
-
return {
|
|
2000
|
+
return global.__unpack_caller_name = callerName, {
|
|
1967
2001
|
...mergeConfig(defaultConfig, config),
|
|
1968
2002
|
_context: {
|
|
1969
2003
|
callerName,
|
|
1970
|
-
version: "3.
|
|
2004
|
+
version: "3.3.1"
|
|
1971
2005
|
}
|
|
1972
2006
|
};
|
|
1973
2007
|
};
|
|
@@ -1975,7 +2009,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1975
2009
|
build: async ({ watch } = {})=>{
|
|
1976
2010
|
setNodeEnv(watch ? 'development' : 'production');
|
|
1977
2011
|
let config = resolveConfig();
|
|
1978
|
-
console.log(colors.rainbow(`${callerName} v3.
|
|
2012
|
+
console.log(colors.rainbow(`${callerName} v3.3.1`), colors.green(`building for ${getNodeEnv()}...`)), await unpackBuild(config);
|
|
1979
2013
|
},
|
|
1980
2014
|
dev: async ()=>{
|
|
1981
2015
|
global.__unpack_start_time = performance.now(), setNodeEnv('development'), setDevServer(!0);
|
|
@@ -2002,7 +2036,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
2002
2036
|
...options
|
|
2003
2037
|
});
|
|
2004
2038
|
}
|
|
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.
|
|
2039
|
+
})(), 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
2040
|
"CSS_MODULES_LOCAL_IDENT_NAME",
|
|
2007
2041
|
"CSS_MODULES_REGEX",
|
|
2008
2042
|
"CSS_NAMED_EXPORT",
|
|
@@ -2015,10 +2049,13 @@ for(var __webpack_i__ in (()=>{
|
|
|
2015
2049
|
"TEMPLATE_CONTENT",
|
|
2016
2050
|
"TEMP_DIR",
|
|
2017
2051
|
"THREAD_OPTIONS",
|
|
2052
|
+
"addRestartCleaner",
|
|
2053
|
+
"cleanUpBeforeRestart",
|
|
2018
2054
|
"clearLine",
|
|
2019
2055
|
"colors",
|
|
2020
2056
|
"createChokidar",
|
|
2021
2057
|
"createUnpack",
|
|
2058
|
+
"currentDevUnpackConfig",
|
|
2022
2059
|
"debounce",
|
|
2023
2060
|
"defineConfig",
|
|
2024
2061
|
"esVersionToBrowserslist",
|
|
@@ -2060,11 +2097,12 @@ for(var __webpack_i__ in (()=>{
|
|
|
2060
2097
|
"prettyTime",
|
|
2061
2098
|
"removeDir",
|
|
2062
2099
|
"resolveConfigPath",
|
|
2063
|
-
"restartCleaners",
|
|
2064
2100
|
"rspack",
|
|
2101
|
+
"setCurrentDevUnpackConfig",
|
|
2065
2102
|
"setDevServer",
|
|
2066
2103
|
"setNodeEnv",
|
|
2067
2104
|
"setValueByPath",
|
|
2105
|
+
"setupCliShortcuts",
|
|
2068
2106
|
"trackPerformance"
|
|
2069
2107
|
].indexOf(__webpack_i__) && (exports[__webpack_i__] = __webpack_exports__[__webpack_i__]);
|
|
2070
2108
|
Object.defineProperty(exports, '__esModule', {
|