@unpackjs/core 3.5.4 → 3.6.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/dist/index.cjs DELETED
@@ -1,2054 +0,0 @@
1
- "use strict";
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
- var __webpack_modules__ = {
4
- "compiled/launch-editor": function(module) {
5
- module.exports = require("../compiled/launch-editor/index.js");
6
- },
7
- "compiled/webpack-merge": function(module) {
8
- module.exports = require("../compiled/webpack-merge/index.js");
9
- }
10
- }, __webpack_module_cache__ = {};
11
- function __webpack_require__(moduleId) {
12
- var cachedModule = __webpack_module_cache__[moduleId];
13
- if (void 0 !== cachedModule) return cachedModule.exports;
14
- var module = __webpack_module_cache__[moduleId] = {
15
- exports: {}
16
- };
17
- return __webpack_modules__[moduleId](module, module.exports, __webpack_require__), module.exports;
18
- }
19
- __webpack_require__.n = (module)=>{
20
- var getter = module && module.__esModule ? ()=>module.default : ()=>module;
21
- return __webpack_require__.d(getter, {
22
- a: getter
23
- }), getter;
24
- }, __webpack_require__.d = (exports1, definition)=>{
25
- for(var key in definition)__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
26
- enumerable: !0,
27
- get: definition[key]
28
- });
29
- }, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports1)=>{
30
- 'undefined' != typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports1, Symbol.toStringTag, {
31
- value: 'Module'
32
- }), Object.defineProperty(exports1, '__esModule', {
33
- value: !0
34
- });
35
- };
36
- var __webpack_exports__ = {};
37
- for(var __webpack_i__ in (()=>{
38
- let lastTrackTime, lastFileInfo, logger;
39
- __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
40
- createChokidar: ()=>createChokidar,
41
- rspack: ()=>core_namespaceObject.rspack,
42
- setNodeEnv: ()=>setNodeEnv,
43
- getAddressUrls: ()=>getAddressUrls,
44
- LogColor: ()=>logger_LogColor,
45
- getUserDepVersion: ()=>getUserDepVersion,
46
- NODE_MODULES_REGEX: ()=>NODE_MODULES_REGEX,
47
- PROD_DEFAULT_FILENAME: ()=>PROD_DEFAULT_FILENAME,
48
- CSS_MODULES_REGEX: ()=>CSS_MODULES_REGEX,
49
- isEmptyDir: ()=>isEmptyDir,
50
- isDevServer: ()=>utils_isDevServer,
51
- clearLine: ()=>clearLine,
52
- isWatch: ()=>isWatch,
53
- DEFAULT_DEV_HOST: ()=>DEFAULT_DEV_HOST,
54
- isDev: ()=>isDev,
55
- isRegExp: ()=>isRegExp,
56
- cleanUpBeforeRestart: ()=>cleanUpBeforeRestart,
57
- currentDevUnpackConfig: ()=>currentDevUnpackConfig,
58
- isPlainObject: ()=>isPlainObject,
59
- debounce: ()=>debounce,
60
- isUndefined: ()=>isUndefined,
61
- trackPerformance: ()=>trackPerformance,
62
- removeDir: ()=>removeDir,
63
- CSS_MODULES_LOCAL_IDENT_NAME: ()=>CSS_MODULES_LOCAL_IDENT_NAME,
64
- findExists: ()=>findExists,
65
- mergeConfig: ()=>mergeConfig,
66
- CSS_NAMED_EXPORT: ()=>!1,
67
- isBoolean: ()=>isBoolean,
68
- setValueByPath: ()=>setValueByPath,
69
- isCSSModules: ()=>isCSSModules,
70
- isNodeVersionAtLeast: ()=>isNodeVersionAtLeast,
71
- isProd: ()=>isProd,
72
- TEMPLATE_CONTENT: ()=>TEMPLATE_CONTENT,
73
- getCompiledPkgPath: ()=>getCompiledPkgPath,
74
- isObject: ()=>isObject,
75
- setCurrentDevUnpackConfig: ()=>setCurrentDevUnpackConfig,
76
- resolveConfigPath: ()=>resolveConfigPath,
77
- getIpv4Interfaces: ()=>getIpv4Interfaces,
78
- getNodeEnv: ()=>getNodeEnv,
79
- getPort: ()=>getPort,
80
- isCI: ()=>utils_isCI,
81
- logger: ()=>logger_logger,
82
- addRestartCleaner: ()=>addRestartCleaner,
83
- colors: ()=>colors,
84
- esVersionToBrowserslist: ()=>esVersionToBrowserslist,
85
- isFunction: ()=>isFunction,
86
- pathExists: ()=>pathExists,
87
- DEV_DEFAULT_FILENAME: ()=>DEV_DEFAULT_FILENAME,
88
- isWin: ()=>isWin,
89
- prettyTime: ()=>prettyTime,
90
- setupCliShortcuts: ()=>setupCliShortcuts,
91
- convertBasicAnsiColors: ()=>convertBasicAnsiColors,
92
- THREAD_OPTIONS: ()=>THREAD_OPTIONS,
93
- createUnpack: ()=>createUnpack,
94
- loadConfig: ()=>loadConfig,
95
- setDevServer: ()=>setDevServer,
96
- EXPORT_LOCALS_CONVENTION: ()=>EXPORT_LOCALS_CONVENTION,
97
- isFileExists: ()=>isFileExists,
98
- isFileSync: ()=>isFileSync,
99
- getPathInJs: ()=>getPathInJs,
100
- getTime: ()=>getTime,
101
- getValueByPath: ()=>getValueByPath,
102
- isDebug: ()=>isDebug,
103
- launchEditor: ()=>launchEditor,
104
- logUpdate: ()=>logUpdate,
105
- defineConfig: ()=>defineConfig,
106
- getUserDepPath: ()=>getUserDepPath,
107
- isString: ()=>isString
108
- });
109
- let core_namespaceObject = require("@rspack/core"), isCI = !!process.env.CI, isTTY = !!process.stdout?.isTTY, noColor = !!process.env.NO_COLOR, forceColor = !!process.env.FORCE_COLOR, disableColor = !1;
110
- disableColor = !!noColor || !forceColor && (isCI || !isTTY);
111
- let ANSI_SGR_RE = /\x1b\[[0-9;]*m/g, ANSI_OPEN_RE = /\x1b\[([0-9;]+)m/g, COLOR_HEX = {
112
- brand: '#B39AFF',
113
- red: '#F38BA8',
114
- green: '#A6E3A1',
115
- yellow: '#F9E2AF',
116
- blue: '#89B4FA',
117
- magenta: '#EE90DB',
118
- cyan: '#89DCEB',
119
- gray: '#6C7086'
120
- }, COLOR_HEX_TO_OPEN = Object.fromEntries(Object.values(COLOR_HEX).map((hex)=>[
121
- hex,
122
- ((hex)=>{
123
- let r, g, b, value = (hex || '').trim().replace(/^#/, '');
124
- if (/^[0-9a-fA-F]{3}$/.test(value)) r = Number.parseInt(value[0] + value[0], 16), g = Number.parseInt(value[1] + value[1], 16), b = Number.parseInt(value[2] + value[2], 16);
125
- else {
126
- if (!/^[0-9a-fA-F]{6}$/.test(value)) return '';
127
- r = Number.parseInt(value.slice(0, 2), 16), g = Number.parseInt(value.slice(2, 4), 16), b = Number.parseInt(value.slice(4, 6), 16);
128
- }
129
- return `\x1b[38;2;${r};${g};${b}m`;
130
- })(hex)
131
- ])), hexColor = (hex)=>{
132
- if (disableColor) return (input)=>String(input);
133
- let open = COLOR_HEX_TO_OPEN[hex];
134
- return open ? (input)=>`${open}${input}\x1b[39m` : (input)=>String(input);
135
- }, ansi = (open, close)=>(input)=>disableColor ? String(input) : `${open}${input}${close}`, colors = {
136
- brand: hexColor(COLOR_HEX.brand),
137
- red: hexColor(COLOR_HEX.red),
138
- green: hexColor(COLOR_HEX.green),
139
- yellow: hexColor(COLOR_HEX.yellow),
140
- blue: hexColor(COLOR_HEX.blue),
141
- magenta: hexColor(COLOR_HEX.magenta),
142
- cyan: hexColor(COLOR_HEX.cyan),
143
- gray: hexColor(COLOR_HEX.gray),
144
- bold: ansi('\x1b[1m', '\x1b[22m'),
145
- dim: ansi('\x1b[2m', '\x1b[22m')
146
- }, CODE_TO_OPEN = Object.fromEntries(Object.entries({
147
- 31: COLOR_HEX.red,
148
- 32: COLOR_HEX.green,
149
- 33: COLOR_HEX.yellow,
150
- 34: COLOR_HEX.blue,
151
- 35: COLOR_HEX.magenta,
152
- 36: COLOR_HEX.cyan,
153
- 90: COLOR_HEX.gray,
154
- 91: COLOR_HEX.red,
155
- 92: COLOR_HEX.green,
156
- 93: COLOR_HEX.yellow,
157
- 94: COLOR_HEX.blue,
158
- 95: COLOR_HEX.magenta,
159
- 96: COLOR_HEX.cyan
160
- }).map(([code, hex])=>[
161
- code,
162
- COLOR_HEX_TO_OPEN[hex]
163
- ]));
164
- function convertBasicAnsiColors(input) {
165
- let text = String(input ?? '');
166
- return text ? disableColor ? text.replace(ANSI_SGR_RE, '') : text.replace(ANSI_OPEN_RE, (substring, params)=>{
167
- let tokens = params.split(';').filter(Boolean), colorToken = tokens.find((t)=>t in CODE_TO_OPEN);
168
- if (!colorToken) return substring;
169
- let open = CODE_TO_OPEN[colorToken];
170
- if (!open) return substring;
171
- let styleTokens = tokens.filter((t)=>t !== colorToken), styleSeq = styleTokens.length ? `\x1b[${styleTokens.join(';')}m` : '';
172
- return `${styleSeq}${open}`;
173
- }) : '';
174
- }
175
- let restartCleaners = [], addRestartCleaner = (...cleaners)=>{
176
- restartCleaners.push(...cleaners);
177
- }, cleanUpBeforeRestart = async ()=>{
178
- await Promise.all(restartCleaners.map((cleaner)=>cleaner())), restartCleaners.length = 0;
179
- }, currentDevUnpackConfig = {}, setCurrentDevUnpackConfig = (config)=>{
180
- currentDevUnpackConfig = config;
181
- }, external_node_readline_namespaceObject = require("node:readline");
182
- 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);
183
- let external_node_fs_namespaceObject = require("node:fs");
184
- var external_node_fs_default = __webpack_require__.n(external_node_fs_namespaceObject);
185
- let external_node_net_namespaceObject = require("node:net");
186
- var external_node_net_default = __webpack_require__.n(external_node_net_namespaceObject);
187
- let external_node_os_namespaceObject = require("node:os");
188
- var external_node_os_default = __webpack_require__.n(external_node_os_namespaceObject);
189
- let external_node_path_namespaceObject = require("node:path");
190
- var external_node_path_default = __webpack_require__.n(external_node_path_namespaceObject);
191
- let external_portfinder_namespaceObject = require("portfinder");
192
- var external_portfinder_default = __webpack_require__.n(external_portfinder_namespaceObject);
193
- let CSS_MODULES_LOCAL_IDENT_NAME = '[path][name]__[local]--[hash:5]', CSS_MODULES_REGEX = /\.module\.\w+$/i, DEV_DEFAULT_FILENAME = {
194
- js: 'js/[name].js',
195
- jsAsync: 'js/async/[name].js',
196
- css: 'css/[name].css',
197
- cssAsync: 'css/async/[name].css'
198
- }, PROD_DEFAULT_FILENAME = {
199
- js: 'js/[name].[contenthash:8].js',
200
- jsAsync: 'js/async/[name].[contenthash:8].js',
201
- css: 'css/[name].[contenthash:8].css',
202
- cssAsync: 'css/async/[name].[contenthash:8].css'
203
- }, EXPORT_LOCALS_CONVENTION = 'camel-case-only', NODE_MODULES_REGEX = /[\\/]node_modules[\\/]/, THREAD_OPTIONS = {
204
- workers: 2
205
- }, DEFAULT_DEV_HOST = '0.0.0.0', TEMPLATE_CONTENT = ({ title = '', headTag = '', mountId = '' })=>`<!DOCTYPE html>
206
- <html lang="en">
207
-
208
- <head>
209
- <meta charset="UTF-8" />
210
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
211
- <title>
212
- ${title}
213
- </title>
214
- ${headTag}
215
- </head>
216
-
217
- <body>
218
- <div id="${mountId}"></div>
219
- </body>
220
-
221
- </html>`, { merge } = __webpack_require__("compiled/webpack-merge"), launchEditor = __webpack_require__("compiled/launch-editor"), getNodeEnv = ()=>process.env.NODE_ENV, setNodeEnv = (env)=>{
222
- process.env.NODE_ENV = env;
223
- }, setDevServer = (isDevServer)=>{
224
- process.env.DEV_SERVER = isDevServer ? 'true' : 'false';
225
- }, isDev = ()=>'development' === getNodeEnv(), utils_isDevServer = ()=>'true' === process.env.DEV_SERVER, isWatch = ()=>isDev() && !utils_isDevServer(), isProd = ()=>'production' === getNodeEnv(), isWin = ()=>'win32' === process.platform, isString = (str)=>'string' == typeof str, isBoolean = (bool)=>'boolean' == typeof bool, isUndefined = (obj)=>void 0 === obj, isFunction = (func)=>'function' == typeof func, isObject = (obj)=>null !== obj && 'object' == typeof obj, isPlainObject = (obj)=>isObject(obj) && '[object Object]' === Object.prototype.toString.call(obj), isRegExp = (obj)=>'[object RegExp]' === Object.prototype.toString.call(obj), prettyTime = (seconds)=>{
226
- let toFixed = (num, len)=>{
227
- let factor = 10 ** len;
228
- return Math.floor(num * factor) / factor;
229
- };
230
- return seconds < 1 ? `${toFixed(1000 * seconds, 0)}ms` : seconds < 60 ? `${toFixed(seconds, 2)}s` : `${toFixed(seconds / 60, 2)}m`;
231
- }, getValueByPath = (target, pathArray, defaultValue)=>{
232
- let current = target;
233
- for(let i = 0; i < pathArray.length - 1; i++){
234
- let currKey = pathArray[i];
235
- current[currKey] && 'object' == typeof current[currKey] || (current[currKey] = 'string' == typeof pathArray[i + 1] ? {} : []), current = current[currKey];
236
- }
237
- let lastKey = pathArray.at(-1);
238
- return void 0 === current[lastKey] && (current[lastKey] = defaultValue), current[lastKey];
239
- }, setValueByPath = (target, pathArray, value)=>{
240
- let current = target;
241
- for(let i = 0; i < pathArray.length - 1; i++){
242
- let currKey = pathArray[i];
243
- current[currKey] && 'object' == typeof current[currKey] || (current[currKey] = 'string' == typeof pathArray[i + 1] ? {} : []), current = current[currKey];
244
- }
245
- current[pathArray.at(-1)] = value;
246
- }, getPort = (startPort = 45678)=>new Promise((resolve)=>{
247
- external_portfinder_default().getPort({
248
- port: startPort
249
- }, (_, port)=>{
250
- resolve(port);
251
- });
252
- }), getCompiledPkgPath = (packageName)=>external_node_path_default().join(__dirname, '../compiled', packageName), getUserDepPath = (root, deps)=>{
253
- for (let dep of Array.isArray(deps) ? deps : [
254
- deps
255
- ]){
256
- let absPath = external_node_path_default().resolve(root, 'node_modules', dep);
257
- if (external_node_fs_default().existsSync(absPath)) return absPath;
258
- }
259
- };
260
- function getTime() {
261
- let now = new Date(), hours = String(now.getHours()).padStart(2, '0'), minutes = String(now.getMinutes()).padStart(2, '0'), seconds = String(now.getSeconds()).padStart(2, '0');
262
- return `${hours}:${minutes}:${seconds}`;
263
- }
264
- let debounce = (fn, delay)=>{
265
- let timer = null;
266
- return (...args)=>{
267
- clearTimeout(timer), timer = setTimeout(()=>{
268
- fn(...args);
269
- }, delay);
270
- };
271
- }, getIpv4Interfaces = ()=>{
272
- let interfaces = external_node_os_default().networkInterfaces(), ipv4Interfaces = new Map();
273
- for (let key of Object.keys(interfaces))for (let detail of interfaces[key]){
274
- let familyV4Value = 'string' == typeof detail.family ? 'IPv4' : 4;
275
- detail.family !== familyV4Value || ipv4Interfaces.has(detail.address) || ipv4Interfaces.set(detail.address, detail);
276
- }
277
- return Array.from(ipv4Interfaces.values());
278
- }, isLoopbackHost = (host)=>[
279
- 'localhost',
280
- '127.0.0.1',
281
- '::1',
282
- '0000:0000:0000:0000:0000:0000:0000:0001'
283
- ].includes(host), concatUrl = ({ host, port, protocol })=>`${protocol}://${host}:${port}/`, LOCAL_LABEL = 'Local: ', NETWORK_LABEL = 'Network: ', getAddressUrls = ({ protocol = 'http', port, host })=>{
284
- if (host && host !== DEFAULT_DEV_HOST) {
285
- var host1;
286
- return [
287
- {
288
- label: isLoopbackHost(host) ? LOCAL_LABEL : NETWORK_LABEL,
289
- url: concatUrl({
290
- port,
291
- host: (host1 = host, external_node_net_default().isIPv6(host1) ? '::' === host1 ? '[::1]' : `[${host1}]` : host1),
292
- protocol
293
- })
294
- }
295
- ];
296
- }
297
- let ipv4Interfaces = getIpv4Interfaces(), addressUrls = [], hasLocalUrl = !1;
298
- for (let detail of ipv4Interfaces)if (isLoopbackHost(detail.address) || detail.internal) {
299
- if (hasLocalUrl) continue;
300
- addressUrls.push({
301
- label: LOCAL_LABEL,
302
- url: concatUrl({
303
- host: 'localhost',
304
- port,
305
- protocol
306
- })
307
- }), hasLocalUrl = !0;
308
- } else addressUrls.push({
309
- label: NETWORK_LABEL,
310
- url: concatUrl({
311
- host: detail.address,
312
- port,
313
- protocol
314
- })
315
- });
316
- return addressUrls;
317
- }, trackPerformance = (msg)=>{
318
- if (!lastTrackTime) {
319
- lastTrackTime = performance.now();
320
- return;
321
- }
322
- msg && console.log(` ${msg} ${colors.dim('in')} ${colors.yellow(`${(performance.now() - lastTrackTime).toFixed(2)}ms`)}`), lastTrackTime = performance.now();
323
- }, getPathInJs = (absPath)=>JSON.stringify(absPath).slice(1, -1), mergeConfig = merge, getUserDepVersion = (root, dep)=>{
324
- let depPath = getUserDepPath(root, dep);
325
- if (depPath) return JSON.parse(external_node_fs_default().readFileSync(external_node_path_default().resolve(depPath, 'package.json'), 'utf-8')).version;
326
- }, clearLine = ()=>{
327
- process.stdout.isTTY && (process.stdout.clearLine(0), process.stdout.cursorTo(0));
328
- }, logUpdate = (output)=>{
329
- clearLine(), process.stdout.write(output);
330
- }, isDebug = ()=>'unpack' === process.env.DEBUG, utils_isCI = ()=>!!process.env.CI;
331
- function isNodeVersionAtLeast(major, minor) {
332
- let [currMajor, currMinor] = process.versions.node.split('.').map(Number);
333
- return currMajor > major || currMajor === major && currMinor >= minor;
334
- }
335
- let isCSSModules = ({ resourcePath, modules })=>{
336
- if (!1 === modules) return !1;
337
- isPlainObject(modules) || (modules = {});
338
- let auto = modules.auto;
339
- return !1 !== auto && (isRegExp(auto) ? auto.test(resourcePath) : isFunction(auto) ? auto(resourcePath) : CSS_MODULES_REGEX.test(resourcePath));
340
- }, esVersionToBrowserslist = (esVersion)=>{
341
- let browsers = {
342
- es2015: [
343
- 'chrome >= 51',
344
- 'edge >= 15',
345
- 'firefox >= 54',
346
- 'safari >= 10'
347
- ],
348
- es2022: [
349
- 'chrome >= 107',
350
- 'edge >= 107',
351
- 'firefox >= 104',
352
- 'safari >= 16'
353
- ],
354
- esnext: [
355
- 'last 2 versions',
356
- 'not dead',
357
- '> 0.5%'
358
- ]
359
- }[esVersion];
360
- if (!browsers) throw Error(`Unsupported ES version: ${esVersion}`);
361
- return browsers;
362
- }, logger_prefixes = {
363
- wait: '○',
364
- error: '⨯',
365
- warn: '⚠',
366
- info: 'ℹ',
367
- ready: '✓',
368
- event: '»'
369
- }, logger_logger = (logger = {
370
- clear: ()=>{
371
- let repeatCount = process.stdout.rows - 2;
372
- console.log(repeatCount > 0 ? '\n'.repeat(repeatCount) : ''), external_node_readline_default().cursorTo(process.stdout, 0, 0), external_node_readline_default().clearScreenDown(process.stdout);
373
- },
374
- greet: (msg)=>{
375
- let { npm_execpath, npm_lifecycle_event } = process.env;
376
- (!npm_execpath || 'npx' === npm_lifecycle_event || npm_execpath.includes('npx-cli') || npm_execpath.includes('.bun') || npm_execpath.includes('yarn')) && console.log(), console.log(msg);
377
- },
378
- debug: (message, ...args)=>{
379
- isDebug() && console.log(`${colors.gray(colors.dim(getTime()))} ${message}`, ...args);
380
- }
381
- }, Object.keys(logger_prefixes).forEach((type)=>{
382
- logger[type] = (message, ...args)=>{
383
- ((type, message, ...args)=>{
384
- let label = colors[logger_LogColor[type]](logger_prefixes[type]), text = '';
385
- switch(type){
386
- case 'error':
387
- if (message instanceof Error) if (message.stack) {
388
- let [name, ...rest] = message.stack.split('\n');
389
- name.startsWith('Error: ') && (name = name.slice(7), rest = rest.map((line)=>line.slice(2))), text = `${colors.red(name)}\n${colors.dim(rest.join('\n'))}`;
390
- } else text = colors.red(message.message);
391
- else text = colors.red(message);
392
- break;
393
- case 'warn':
394
- text = colors.yellow(message);
395
- break;
396
- default:
397
- text = message;
398
- }
399
- console.log(`${label} ${text}`, ...args);
400
- })(type, message, ...args);
401
- };
402
- }), logger);
403
- async function setupCliShortcuts({ help = !0, openPage, closeServer, printUrls, restartServer }) {
404
- let shortcuts = [
405
- restartServer ? {
406
- key: 'r',
407
- description: 'restart server',
408
- action: restartServer
409
- } : null,
410
- {
411
- key: 'u',
412
- description: 'show server url',
413
- action: printUrls
414
- },
415
- {
416
- key: 'o',
417
- description: 'open in browser',
418
- action: openPage
419
- },
420
- {
421
- key: 'c',
422
- description: 'clear console',
423
- action: ()=>{
424
- logger_logger.clear();
425
- }
426
- },
427
- {
428
- key: 'q',
429
- description: 'quit',
430
- action: async ()=>{
431
- try {
432
- await closeServer();
433
- } finally{
434
- process.exit(0);
435
- }
436
- }
437
- }
438
- ].filter(Boolean), colorPrefix = colors.brand(colors.dim('➜'));
439
- help && console.log(!0 === help ? ` ${colorPrefix} ${colors.dim('press')} ${colors.bold('h + enter')} ${colors.dim('to show help')}` : ` ${colorPrefix} ${help}`);
440
- let { createInterface } = await import("node:readline"), rl = createInterface({
441
- input: process.stdin
442
- });
443
- rl.on('line', (input)=>{
444
- if ('h' === input) {
445
- let message = '\n Shortcuts\n';
446
- for (let shortcut of shortcuts){
447
- let fullDescription = `${colors.dim('press')} ${colors.bold(`${shortcut.key} + enter`)} ${colors.dim(`to ${shortcut.description}`)}`;
448
- message += ` ${fullDescription}\n`;
449
- }
450
- console.log(message);
451
- }
452
- for (let shortcut of shortcuts)if (input === shortcut.key) return void shortcut.action();
453
- }), addRestartCleaner(()=>rl.close());
454
- }
455
- let external_node_url_namespaceObject = require("node:url");
456
- async function loadConfig({ cliOptions, command }) {
457
- 'build' === command ? setNodeEnv(cliOptions?.watch ? 'development' : 'production') : (setNodeEnv('development'), setDevServer(!0));
458
- let root = cliOptions?.root ? external_node_path_default().resolve(cliOptions.root) : process.cwd(), configFilePath = resolveConfigPath(root, cliOptions?.config), configExport = {};
459
- if (configFilePath) {
460
- if (isNodeVersionAtLeast(22, 18) || /\.(?:js|mjs|cjs)$/.test(configFilePath)) {
461
- logger_logger.debug('loading config file with native loader:', colors.dim(configFilePath));
462
- try {
463
- let configFileURL = (0, external_node_url_namespaceObject.pathToFileURL)(configFilePath).href, exportModule = await import(`${configFileURL}?t=${Date.now()}`);
464
- configExport = exportModule.default ? exportModule.default : exportModule;
465
- } catch (err) {
466
- throw logger_logger.error('failed to load config file with native loader:', colors.dim(configFilePath)), err;
467
- }
468
- } else {
469
- logger_logger.debug('loading config file with jiti:', colors.dim(configFilePath));
470
- try {
471
- let { createJiti } = await import("jiti"), jiti = createJiti(__filename, {
472
- moduleCache: !1,
473
- interopDefault: !0,
474
- nativeModules: [
475
- '@rspack/core',
476
- "typescript"
477
- ]
478
- });
479
- configExport = await jiti.import(configFilePath, {
480
- default: !0
481
- });
482
- } catch (err) {
483
- throw logger_logger.error('failed to load config file with jiti:', colors.dim(configFilePath)), err;
484
- }
485
- }
486
- if ('function' == typeof configExport) {
487
- let params = {
488
- env: getNodeEnv(),
489
- command: process.argv[2]
490
- };
491
- if (void 0 === (configExport = await configExport(params))) throw Error('unpack config function must return a config object.');
492
- }
493
- }
494
- return cliOptions?.port && setValueByPath(configExport, [
495
- 'server',
496
- 'port'
497
- ], cliOptions.port), cliOptions?.open && setValueByPath(configExport, [
498
- 'server',
499
- 'open'
500
- ], cliOptions.open), cliOptions?.analyze && setValueByPath(configExport, [
501
- 'performance',
502
- 'buildAnalyze'
503
- ], cliOptions.analyze), cliOptions?.root && setValueByPath(configExport, [
504
- 'root'
505
- ], root), cliOptions?.host && setValueByPath(configExport, [
506
- 'server',
507
- 'host'
508
- ], cliOptions.host), configExport;
509
- }
510
- function defineConfig(config) {
511
- return config;
512
- }
513
- function resolveConfigPath(root, customConfig) {
514
- if (customConfig) {
515
- let customConfigPath = external_node_path_default().resolve(root, customConfig);
516
- if (external_node_fs_default().existsSync(customConfigPath)) return customConfigPath;
517
- logger_logger.warn(`could not find config file: ${customConfigPath}`);
518
- }
519
- for (let file of [
520
- 'unpack.config.mjs',
521
- 'unpack.config.ts',
522
- 'unpack.config.js',
523
- 'unpack.config.cjs',
524
- 'unpack.config.mts',
525
- 'unpack.config.cts'
526
- ]){
527
- let configFile = external_node_path_default().join(root, file);
528
- if (external_node_fs_default().existsSync(configFile)) return configFile;
529
- }
530
- return null;
531
- }
532
- let external_dotenv_expand_namespaceObject = require("dotenv-expand"), isFileSync = (filePath)=>{
533
- try {
534
- return external_node_fs_default().statSync(filePath, {
535
- throwIfNoEntry: !1
536
- })?.isFile();
537
- } catch {
538
- return !1;
539
- }
540
- };
541
- function isEmptyDir(path) {
542
- let files = external_node_fs_default().readdirSync(path);
543
- return 0 === files.length || 1 === files.length && '.git' === files[0];
544
- }
545
- let findExists = (files)=>{
546
- for (let file of files)if (isFileSync(file)) return file;
547
- return !1;
548
- };
549
- async function pathExists(path) {
550
- return external_node_fs_default().promises.access(path).then(()=>!0).catch(()=>!1);
551
- }
552
- async function isFileExists(file) {
553
- return external_node_fs_default().promises.access(file, external_node_fs_default().constants.F_OK).then(()=>!0).catch(()=>!1);
554
- }
555
- let removeDir = (dir)=>{
556
- external_node_fs_default().rmSync(dir, {
557
- recursive: !0,
558
- force: !0
559
- });
560
- }, DOTENV_LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
561
- function getNormalizedPluginsByHook(hook, plugins) {
562
- let pluginMap = new Map();
563
- return plugins?.forEach((plugin)=>{
564
- plugin[hook] && pluginMap.set(plugin.name, plugin);
565
- }), Array.from(pluginMap.values());
566
- }
567
- async function applyBuildAnalyzeConfig({ config }) {
568
- let { RsdoctorRspackPlugin } = await import("@rsdoctor/rspack-plugin");
569
- return config.plugins?.push(new RsdoctorRspackPlugin()), config;
570
- }
571
- async function getBuildDependencies(root, userBuildDependencies, envFilePaths) {
572
- let rootPackageJson = external_node_path_default().join(root, 'package.json'), browserslistConfig = external_node_path_default().join(root, '.browserslistrc'), tsconfigPath = external_node_path_default().join(root, 'tsconfig.json'), buildDependencies = {};
573
- await isFileExists(rootPackageJson) && (buildDependencies.packageJson = [
574
- rootPackageJson
575
- ]), await isFileExists(tsconfigPath) && (buildDependencies.tsconfig = [
576
- tsconfigPath
577
- ]), buildDependencies.unpackConfig = [
578
- resolveConfigPath(root)
579
- ], await isFileExists(browserslistConfig) && (buildDependencies.browserslistrc = [
580
- browserslistConfig
581
- ]);
582
- let tailwindConfig = findExists([
583
- 'ts',
584
- 'js',
585
- 'cjs',
586
- 'mjs'
587
- ].map((ext)=>external_node_path_default().join(root, `tailwind.config.${ext}`)));
588
- return tailwindConfig && (buildDependencies.tailwindcss = [
589
- tailwindConfig
590
- ]), envFilePaths && envFilePaths.length > 0 && (buildDependencies.envFiles = envFilePaths), {
591
- ...buildDependencies,
592
- userBuildDependencies
593
- };
594
- }
595
- async function applyCacheConfig({ config, unpackConfig, envFilePaths }) {
596
- let cacheConfig = isPlainObject(unpackConfig.build.cache) ? unpackConfig.build.cache : {}, buildDependencies = await getBuildDependencies(unpackConfig.root, cacheConfig.buildDependencies || [], envFilePaths), cacheDirectory = cacheConfig.cacheDirectory;
597
- return cacheDirectory && (cacheDirectory = external_node_path_default().resolve(unpackConfig.root, cacheDirectory)), logger_logger.info('persistent cache enabled'), config = mergeConfig(config, {
598
- cache: !0,
599
- experiments: {
600
- cache: {
601
- type: 'persistent',
602
- buildDependencies: Object.values(buildDependencies).flat(),
603
- storage: {
604
- type: 'filesystem',
605
- directory: cacheDirectory
606
- }
607
- }
608
- }
609
- });
610
- }
611
- let external_node_assert_namespaceObject = require("node:assert");
612
- var external_node_assert_default = __webpack_require__.n(external_node_assert_namespaceObject);
613
- let MODULE_PATH_REGEX = /.*[\\/]node_modules[\\/](?!\.pnpm[\\/])(?:(@[^\\/]+)[\\/])?([^\\/]+)/, SPLIT_STRATEGY_DISPATCHER = {
614
- 'split-by-experience': function(ctx) {
615
- let { defaultConfig, forceSplittingGroups } = ctx, experienceCacheGroup = {};
616
- for (let [name, test] of Object.entries({
617
- axios: /node_modules[\\/]axios(-.+)?[\\/]/,
618
- polyfill: /node_modules[\\/](?:tslib|core-js|@swc[\\/]helpers)[\\/]/
619
- })){
620
- let key = `lib-${name}`;
621
- experienceCacheGroup[key] = {
622
- test,
623
- priority: 0,
624
- name: key
625
- };
626
- }
627
- return {
628
- ...defaultConfig,
629
- cacheGroups: {
630
- ...defaultConfig.cacheGroups,
631
- ...experienceCacheGroup,
632
- ...forceSplittingGroups
633
- }
634
- };
635
- },
636
- 'split-by-module': function(ctx) {
637
- let { forceSplittingGroups, defaultConfig } = ctx;
638
- return {
639
- ...defaultConfig,
640
- minSize: 0,
641
- maxInitialRequests: 1 / 0,
642
- cacheGroups: {
643
- ...defaultConfig.cacheGroups,
644
- ...forceSplittingGroups,
645
- vendors: {
646
- priority: -9,
647
- test: NODE_MODULES_REGEX,
648
- name: (module)=>module ? function(modulePath) {
649
- let handleModuleContext = modulePath?.match(MODULE_PATH_REGEX);
650
- if (!handleModuleContext) return;
651
- let [, scope, name] = handleModuleContext;
652
- return [
653
- 'npm',
654
- (scope ?? '').replace('@', ''),
655
- name
656
- ].filter(Boolean).join('.');
657
- }(module.context) : void 0
658
- }
659
- }
660
- };
661
- },
662
- 'split-by-size': function(ctx) {
663
- let { forceSplittingGroups, defaultConfig, chunkSplit } = ctx;
664
- return external_node_assert_default()('split-by-size' === chunkSplit.strategy), {
665
- ...defaultConfig,
666
- minSize: chunkSplit.minSize ?? 0,
667
- maxSize: chunkSplit.maxSize ?? 1 / 0,
668
- cacheGroups: {
669
- ...defaultConfig.cacheGroups,
670
- ...forceSplittingGroups
671
- }
672
- };
673
- },
674
- custom: function(ctx) {
675
- let { forceSplittingGroups, defaultConfig } = ctx;
676
- return {
677
- ...defaultConfig,
678
- cacheGroups: {
679
- ...defaultConfig.cacheGroups,
680
- ...forceSplittingGroups
681
- }
682
- };
683
- },
684
- 'all-in-one': function(_ctx) {
685
- return !1;
686
- },
687
- 'single-vendor': function(ctx) {
688
- let { defaultConfig, forceSplittingGroups } = ctx;
689
- return {
690
- ...defaultConfig,
691
- cacheGroups: {
692
- ...defaultConfig.cacheGroups,
693
- singleVendor: {
694
- test: NODE_MODULES_REGEX,
695
- priority: 0,
696
- chunks: 'all',
697
- name: 'vendor',
698
- enforce: !0
699
- },
700
- ...forceSplittingGroups
701
- }
702
- };
703
- }
704
- }, external_tinyglobby_namespaceObject = require("tinyglobby");
705
- async function getEntry(root, customEntry) {
706
- let entry;
707
- return entry = customEntry ? external_node_path_default().resolve(root, customEntry) : (await (0, external_tinyglobby_namespaceObject.glob)('(index|Index).{js,ts,jsx,tsx}', {
708
- cwd: external_node_path_default().join(root, 'src'),
709
- absolute: !0
710
- }))[0], external_node_fs_default().existsSync(entry) || (logger_logger.error(Error('could not find entry file')), process.exit(1)), entry;
711
- }
712
- let getOutputFilename = ({ type, hash, async })=>{
713
- let FILENAME = isProd() && !1 !== hash ? PROD_DEFAULT_FILENAME : DEV_DEFAULT_FILENAME;
714
- return async ? 'js' === type ? FILENAME.jsAsync : FILENAME.cssAsync : FILENAME[type];
715
- };
716
- function _define_property(obj, key, value) {
717
- return key in obj ? Object.defineProperty(obj, key, {
718
- value: value,
719
- enumerable: !0,
720
- configurable: !0,
721
- writable: !0
722
- }) : obj[key] = value, obj;
723
- }
724
- let { RawSource, SourceMapSource } = core_namespaceObject.rspack.sources, isJsFile = /\.[cm]?js(\?.*)?$/i, jsMinify_PLUGIN_NAME = 'JsMinifyPlugin';
725
- class JsMinifyPlugin {
726
- apply(compiler) {
727
- let meta = JSON.stringify({
728
- name: jsMinify_PLUGIN_NAME,
729
- version: "3.5.4",
730
- options: this.minifyOptions
731
- });
732
- compiler.hooks.compilation.tap(jsMinify_PLUGIN_NAME, (compilation)=>{
733
- compilation.hooks.chunkHash.tap(jsMinify_PLUGIN_NAME, (_, hash)=>hash.update(Buffer.from(meta))), compilation.hooks.processAssets.tapPromise({
734
- name: jsMinify_PLUGIN_NAME,
735
- stage: compiler.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE
736
- }, ()=>this.transformAssets(compilation)), compilation.hooks.statsPrinter.tap(jsMinify_PLUGIN_NAME, (stats)=>{
737
- stats.hooks.print.for('asset.info.minimized').tap(jsMinify_PLUGIN_NAME, (minimized, { green, formatFlag })=>minimized && green && formatFlag ? green(formatFlag('minimized')) : '');
738
- });
739
- });
740
- }
741
- async transformAssets(compilation) {
742
- 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 import("oxc-minify")).minify;
743
- await Promise.all(assets.map(async (asset)=>{
744
- try {
745
- let { source, map } = asset.source.sourceAndMap(), { name } = asset, inputCode = Buffer.isBuffer(source) ? source.toString() : source, output = await minifyFn(name, inputCode, {
746
- sourcemap: sourceMap,
747
- ...this.minifyOptions
748
- }), newMap = null;
749
- output.map && ((newMap = 'string' == typeof output.map ? JSON.parse(output.map) : output.map).sources && 0 !== newMap.sources.length || (newMap.sources = [
750
- asset.name
751
- ]));
752
- let newSource = sourceMap && newMap ? new SourceMapSource(output.code, asset.name, newMap, inputCode, map ?? void 0, !0) : new RawSource(output.code), newInfo = {
753
- ...asset.info,
754
- minimized: !0
755
- };
756
- compilation.updateAsset(asset.name, newSource, newInfo);
757
- } catch (error) {
758
- let err = Error(`[${jsMinify_PLUGIN_NAME}] Failed to minify ${asset.name}: ${error.message}`);
759
- err.stack = error.stack, compilation.errors.push(err);
760
- }
761
- }));
762
- }
763
- constructor(options = {}){
764
- _define_property(this, "minifyOptions", void 0), _define_property(this, "customMinify", void 0);
765
- const { implementation, ...minifyOptions } = options;
766
- this.customMinify = implementation?.minify, this.minifyOptions = minifyOptions;
767
- }
768
- }
769
- function loadingAnimation_define_property(obj, key, value) {
770
- return key in obj ? Object.defineProperty(obj, key, {
771
- value: value,
772
- enumerable: !0,
773
- configurable: !0,
774
- writable: !0
775
- }) : obj[key] = value, obj;
776
- }
777
- class LoadingAnimation {
778
- getCurrentChar() {
779
- let now = Date.now();
780
- return now - this.lastUpdateTime >= this.interval && (this.currentIndex = (this.currentIndex + 1) % this.chars.length, this.lastUpdateTime = now), this.chars[this.currentIndex];
781
- }
782
- reset() {
783
- this.currentIndex = 0, this.lastUpdateTime = 0;
784
- }
785
- constructor(){
786
- loadingAnimation_define_property(this, "chars", [
787
- '⠋',
788
- '⠙',
789
- '⠹',
790
- '⠸',
791
- '⠼',
792
- '⠴',
793
- '⠦',
794
- '⠧',
795
- '⠇',
796
- '⠏'
797
- ]), loadingAnimation_define_property(this, "currentIndex", 0), loadingAnimation_define_property(this, "lastUpdateTime", 0), loadingAnimation_define_property(this, "interval", 100);
798
- }
799
- }
800
- function progressBar_define_property(obj, key, value) {
801
- return key in obj ? Object.defineProperty(obj, key, {
802
- value: value,
803
- enumerable: !0,
804
- configurable: !0,
805
- writable: !0
806
- }) : obj[key] = value, obj;
807
- }
808
- class ProgressBar {
809
- update({ current: originalCurrent, message = '' }) {
810
- let { columns: terminalWidth } = process.stdout, current = originalCurrent;
811
- originalCurrent >= 0.98 && (current = 1);
812
- let loadingChar = this.loadingAnimation.getCurrentChar(), messageWidth = terminalWidth - this.prefix.length - (1 === current ? 10 : 9);
813
- logUpdate(`${loadingChar} ${this.prefix} (${Math.floor(100 * current)}%) ${colors.dim(message.slice(0, messageWidth).padEnd(messageWidth, ' '))}`), 1 === current && clearLine();
814
- }
815
- constructor(){
816
- progressBar_define_property(this, "prefix", 'transforming'), progressBar_define_property(this, "loadingAnimation", new LoadingAnimation());
817
- }
818
- }
819
- let external_node_util_namespaceObject = require("node:util"), external_node_zlib_namespaceObject = require("node:zlib");
820
- var external_node_zlib_default = __webpack_require__.n(external_node_zlib_namespaceObject);
821
- let gzip = (0, external_node_util_namespaceObject.promisify)(external_node_zlib_default().gzip), numberFormatter = new Intl.NumberFormat('en', {
822
- maximumFractionDigits: 2,
823
- minimumFractionDigits: 2
824
- }), displaySize = (bytes)=>`${numberFormatter.format(bytes / 1000)} kB`;
825
- async function getCompressedSize(content) {
826
- return (await gzip(content)).length;
827
- }
828
- async function printFileSize({ root, stats }) {
829
- let chunkGroups = [
830
- {
831
- type: 'HTML',
832
- color: 'green',
833
- chunks: []
834
- },
835
- {
836
- type: 'Assets',
837
- color: 'yellow',
838
- chunks: []
839
- },
840
- {
841
- type: 'CSS',
842
- color: 'magenta',
843
- chunks: []
844
- },
845
- {
846
- type: 'JS',
847
- color: 'cyan',
848
- chunks: []
849
- }
850
- ], chunkGroupMap = chunkGroups.reduce((acc, cur)=>(acc[cur.type] = cur, acc), {}), compressedCount = 0, loadingAnimation = new LoadingAnimation();
851
- logUpdate(`${loadingAnimation.getCurrentChar()} computing gzip size (0)...`);
852
- let distPath = stats.compilation.outputOptions.path, distFolder = external_node_path_default().relative(root, distPath), origin = stats.toJson({
853
- all: !1,
854
- assets: !0,
855
- cachedAssets: !0,
856
- groupAssetsByInfo: !1,
857
- groupAssetsByPath: !1,
858
- groupAssetsByChunk: !1,
859
- groupAssetsByExtension: !1,
860
- groupAssetsByEmitStatus: !1
861
- }), longest = 0, totalSize = 0, totalCompressedSize = 0;
862
- await Promise.all(origin.assets.map(async (asset)=>{
863
- let content = await external_node_fs_default().promises.readFile(external_node_path_default().join(distPath, asset.name)), size = content.length, compressedSize = await getCompressedSize(content);
864
- totalSize += size, totalCompressedSize += compressedSize, compressedCount++, logUpdate(`${loadingAnimation.getCurrentChar()} computing gzip size (${compressedCount})...`), compressedCount === origin.assets.length && (logUpdate(`✓ computed gzip size (${compressedCount})`), console.log());
865
- let chunk = {
866
- name: external_node_path_default().basename(asset.name),
867
- path: `${distFolder}/${asset.name}`,
868
- size,
869
- compressedSize
870
- };
871
- switch(chunk.path.length > longest && (longest = chunk.path.length), external_node_path_default().extname(asset.name)){
872
- case '.html':
873
- chunkGroupMap.HTML.chunks.push(chunk);
874
- break;
875
- case '.css':
876
- chunkGroupMap.CSS.chunks.push(chunk);
877
- break;
878
- case '.js':
879
- case '.wasm':
880
- chunkGroupMap.JS.chunks.push(chunk);
881
- break;
882
- default:
883
- chunkGroupMap.Assets.chunks.push(chunk);
884
- }
885
- }));
886
- let sizePad = displaySize(totalSize).length, compressPad = displaySize(totalCompressedSize).length;
887
- chunkGroups.forEach((group)=>{
888
- group.chunks.sort((a, b)=>a.size - b.size).forEach((chunk)=>{
889
- let isLarge = 'JS' === group.type && chunk.size / 1000 > 500, relativeOutDir = external_node_path_default().dirname(chunk.path) + '/', log = colors.dim(relativeOutDir);
890
- 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);
891
- });
892
- });
893
- let log = colors.blue('Total'.padEnd(longest + 2));
894
- log += colors.blue(displaySize(totalSize)), console.log(log += colors.dim(` │ gzip: ${displaySize(totalCompressedSize)}`));
895
- }
896
- function isLikelyFile(filePath) {
897
- return (filePath.split(external_node_path_namespaceObject.sep).pop() || '').includes('.');
898
- }
899
- function formatFileList(paths, rootPath) {
900
- let files = paths.filter(isLikelyFile);
901
- 0 === files.length && (files = [
902
- paths[0]
903
- ]);
904
- let fileInfo = files.slice(0, 1).map((file)=>{
905
- var originalFilePath, root;
906
- let prefix, filePath, parts;
907
- 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);
908
- }).join(', ');
909
- return files.length > 1 ? `${fileInfo} and ${files.length - 1} more` : fileInfo;
910
- }
911
- let getCompileTime = (stats)=>stats.toJson({
912
- preset: 'errors-only',
913
- timings: !0
914
- }).time / 1000, sameCount = 0;
915
- async function compileDone(compiler, stats) {
916
- let root = compiler.options.context;
917
- if (!stats.hasErrors()) if (isProd()) utils_isCI() || await printFileSize({
918
- root,
919
- stats
920
- }), logger_logger.ready(colors.green(`built in ${prettyTime(getCompileTime(stats))}`));
921
- else {
922
- let changedFiles = compiler.modifiedFiles ? Array.from(compiler.modifiedFiles) : null, fileInfo = function(changedFiles, removedFiles, root) {
923
- if (!changedFiles?.length && !removedFiles?.length) return null;
924
- if (changedFiles?.length && removedFiles?.length) {
925
- let changedInfo = formatFileList(changedFiles, root), removedInfo = formatFileList(removedFiles, root);
926
- return `${changedInfo}, removed ${removedInfo}`;
927
- }
928
- return changedFiles?.length ? formatFileList(changedFiles, root) : removedFiles?.length ? `removed ${formatFileList(removedFiles, root)}` : null;
929
- }(changedFiles, compiler.removedFiles ? Array.from(compiler.removedFiles) : null, root);
930
- if (!fileInfo) return;
931
- if (fileInfo === lastFileInfo ? sameCount++ : (lastFileInfo = fileInfo, sameCount = 1), isDebug()) {
932
- var modules, root1;
933
- let nodeModulesStats, nodeModulesPath;
934
- Object.entries((modules = stats.compilation.modules, root1 = root, nodeModulesStats = {}, nodeModulesPath = external_node_path_default().resolve(root1, 'node_modules'), modules.forEach((module)=>{
935
- let { resource } = module;
936
- if (resource?.includes(nodeModulesPath)) {
937
- let packageName, pathParts = external_node_path_default().relative(nodeModulesPath, resource).split(external_node_path_namespaceObject.sep);
938
- (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);
939
- }
940
- }), nodeModulesStats)).sort((a, b)=>a[1] - b[1]).forEach(([packageName, count])=>{
941
- logger_logger.debug(`${colors.cyan(packageName)}: ${colors.yellow(count)} modules`);
942
- });
943
- }
944
- isDebug() || logger_logger.clear(), console.log(colors.dim(getTime()), colors.cyan(`[${global.__unpack_caller_name}]`), colors.brand(utils_isDevServer() ? 'hmr update' : 'build'), `${colors.dim(fileInfo)}${sameCount > 1 ? ` ${colors.yellow(`(x${sameCount})`)}` : ''}`, isDebug() ? colors.dim(`| ${prettyTime(getCompileTime(stats))} (${stats.compilation.modules.size} modules)`) : '');
945
- }
946
- }
947
- let progress_PLUGIN_NAME = 'ProgressPlugin';
948
- class ProgressLiteRspackPlugin {
949
- apply(compiler) {
950
- compiler.hooks.run.tap(progress_PLUGIN_NAME, ()=>{
951
- logger_logger.info('build started...');
952
- }), compiler.hooks.afterDone.tap(progress_PLUGIN_NAME, async (stats)=>{
953
- await compileDone(compiler, stats);
954
- });
955
- }
956
- }
957
- class ProgressRspackPlugin extends core_namespaceObject.rspack.ProgressPlugin {
958
- apply(compiler) {
959
- super.apply(compiler), compiler.hooks.afterDone.tap(progress_PLUGIN_NAME, async (stats)=>{
960
- await compileDone(compiler, stats);
961
- });
962
- }
963
- constructor(){
964
- super((percentage, msg, ...args)=>{
965
- isProd() && this.progressBar.update({
966
- current: percentage,
967
- message: `${msg} ${args.join(' ')}`
968
- });
969
- }), function(obj, key, value) {
970
- key in obj ? Object.defineProperty(obj, key, {
971
- value: value,
972
- enumerable: !0,
973
- configurable: !0,
974
- writable: !0
975
- }) : obj[key] = value;
976
- }(this, "progressBar", new ProgressBar());
977
- }
978
- }
979
- async function applyTypeCheckConfig({ config, unpackConfig }) {
980
- let { TsCheckerRspackPlugin } = await import("ts-checker-rspack-plugin"), tsconfigPath = external_node_path_default().resolve(unpackConfig.root, 'tsconfig.json');
981
- return config.plugins?.push(new TsCheckerRspackPlugin({
982
- typescript: {
983
- mode: 'readonly',
984
- memoryLimit: 8192,
985
- configFile: tsconfigPath,
986
- typescriptPath: require.resolve("typescript", {
987
- paths: [
988
- unpackConfig.root
989
- ]
990
- })
991
- },
992
- issue: {
993
- exclude: [
994
- ({ file = '' })=>NODE_MODULES_REGEX.test(file)
995
- ]
996
- },
997
- logger: {
998
- log (message) {
999
- let count = +(/(\d+) errors?/.exec(message)?.[1] || 0);
1000
- count > 0 && console.log(`Found ${colors.red(colors.bold(`${count} ${1 === count ? 'error' : 'errors'}`))}`);
1001
- },
1002
- error (message) {
1003
- message.includes('RpcExitError') || message.includes('out of memory') || console.log(convertBasicAnsiColors(message.replace(/ERROR/g, 'Type Error')));
1004
- }
1005
- }
1006
- })), config;
1007
- }
1008
- async function getBundlerConfig(originalUnpackConfig) {
1009
- let { plugins, bundlerConfig, ...rest } = originalUnpackConfig;
1010
- for (let plugin of getNormalizedPluginsByHook('config', plugins))rest = await plugin.config(rest, {
1011
- ...originalUnpackConfig._context,
1012
- mergeConfig: mergeConfig
1013
- });
1014
- let unpackConfig = {
1015
- ...rest,
1016
- plugins,
1017
- bundlerConfig
1018
- }, tsconfigPath = external_node_path_default().resolve(unpackConfig.root, 'tsconfig.json'), isTs = external_node_fs_default().existsSync(tsconfigPath), minifyOptions = isPlainObject(unpackConfig.build?.minify) ? unpackConfig.build?.minify : {}, ProgressPlugin = unpackConfig.build?.progressBar ? ProgressRspackPlugin : ProgressLiteRspackPlugin, { publicVars, filePaths: envFilePaths } = function({ cwd = process.cwd(), mode = getNodeEnv(), prefixes = [
1019
- 'PUBLIC_'
1020
- ], processEnv = process.env } = {}) {
1021
- if ('local' === mode) throw Error(`${colors.yellow('local')} cannot be used as a value for env mode, because ${colors.yellow('.env.local')} represents a temporary local file. Please use another value.`);
1022
- let filePaths = [
1023
- '.env',
1024
- '.env.local',
1025
- `.env.${mode}`,
1026
- `.env.${mode}.local`
1027
- ].map((filename)=>(0, external_node_path_namespaceObject.join)(cwd, filename)).filter(isFileSync), parsed = {};
1028
- for (let envPath of filePaths)Object.assign(parsed, function(src) {
1029
- let match, obj = {}, lines = src.toString();
1030
- for(lines = lines.replace(/\r\n?/gm, '\n'); null != (match = DOTENV_LINE.exec(lines));){
1031
- let key = match[1], value = match[2] || '', maybeQuote = (value = value.trim())[0];
1032
- value = value.replace(/^(['"`])([\s\S]*)\1$/gm, '$2'), '"' === maybeQuote && (value = (value = value.replace(/\\n/g, '\n')).replace(/\\r/g, '\r')), obj[key] = value;
1033
- }
1034
- return obj;
1035
- }(external_node_fs_default().readFileSync(envPath))), logger_logger.debug('loaded env file:', envPath);
1036
- parsed.NODE_ENV && (processEnv.NODE_ENV = parsed.NODE_ENV), (0, external_dotenv_expand_namespaceObject.expand)({
1037
- parsed,
1038
- processEnv
1039
- });
1040
- let publicVars = {}, rawPublicVars = {}, normalizedPrefixes = Array.isArray(prefixes) ? prefixes : [
1041
- prefixes
1042
- ];
1043
- for (let key of Object.keys(processEnv))if (normalizedPrefixes.some((prefix)=>key.startsWith(prefix))) {
1044
- let val = processEnv[key];
1045
- publicVars[`import.meta.env.${key}`] = JSON.stringify(val), publicVars[`process.env.${key}`] = JSON.stringify(val), rawPublicVars[key] = val;
1046
- }
1047
- publicVars['import.meta.env'] = JSON.stringify(rawPublicVars), publicVars['process.env'] = JSON.stringify(rawPublicVars);
1048
- let cleaned = !1;
1049
- return {
1050
- parsed,
1051
- cleanup: ()=>{
1052
- if (!cleaned) {
1053
- for (let key of Object.keys(parsed))'NODE_ENV' !== key && processEnv[key] === parsed[key] && delete processEnv[key];
1054
- cleaned = !0;
1055
- }
1056
- },
1057
- filePaths,
1058
- publicVars,
1059
- rawPublicVars
1060
- };
1061
- }({
1062
- prefixes: unpackConfig.envPrefix,
1063
- cwd: unpackConfig.root
1064
- }), config = {
1065
- context: unpackConfig.root,
1066
- mode: isDev() ? 'development' : 'production',
1067
- entry: unpackConfig.mpa ? {} : {
1068
- main: await getEntry(unpackConfig.root, unpackConfig.entry)
1069
- },
1070
- stats: 'errors-only',
1071
- output: {
1072
- clean: !0,
1073
- path: external_node_path_default().resolve(unpackConfig.root, unpackConfig.build.outDir),
1074
- filename: getOutputFilename({
1075
- type: 'js',
1076
- hash: unpackConfig.build?.filenameHash
1077
- }),
1078
- chunkFilename: getOutputFilename({
1079
- type: 'js',
1080
- hash: unpackConfig.build?.filenameHash,
1081
- async: !0
1082
- }),
1083
- crossOriginLoading: 'anonymous',
1084
- pathinfo: !1,
1085
- publicPath: unpackConfig.build?.publicPath,
1086
- webassemblyModuleFilename: 'js/async/[hash].module.wasm',
1087
- assetModuleFilename: 'assets/[name].[contenthash:8][ext]'
1088
- },
1089
- infrastructureLogging: {
1090
- level: 'error'
1091
- },
1092
- devtool: unpackConfig.build?.sourceMap,
1093
- module: {
1094
- rules: [
1095
- {
1096
- test: /\.(png|jpe?g|gif|webp)$/i,
1097
- type: 'asset'
1098
- },
1099
- {
1100
- test: /\.(woff2?|eot|ttf|otf)$/i,
1101
- type: 'asset'
1102
- },
1103
- {
1104
- test: /\.(mp4|m4v|webm|ogv|ogg|mp3|m4a|wav|flac|aac|opus)$/i,
1105
- type: 'asset/resource'
1106
- },
1107
- {
1108
- test: /\.wasm$/,
1109
- dependency: 'url',
1110
- type: 'asset/resource'
1111
- }
1112
- ]
1113
- },
1114
- plugins: [
1115
- new core_namespaceObject.rspack.DefinePlugin({
1116
- 'import.meta.env.MODE': JSON.stringify(getNodeEnv()),
1117
- 'import.meta.env.DEV': isDev(),
1118
- 'import.meta.env.PROD': isProd(),
1119
- ...publicVars,
1120
- ...unpackConfig.define
1121
- }),
1122
- !unpackConfig.mpa && new core_namespaceObject.rspack.HtmlRspackPlugin({
1123
- template: unpackConfig.html?.template || void 0,
1124
- templateContent: unpackConfig.html?.templateContent || (unpackConfig.html?.template ? void 0 : TEMPLATE_CONTENT),
1125
- templateParameters: {
1126
- mountId: unpackConfig.html.mountId,
1127
- title: isFunction(unpackConfig.html?.title) ? unpackConfig.html?.title({
1128
- entryName: 'index'
1129
- }) : unpackConfig.html?.title || '',
1130
- headTag: unpackConfig.html?.headTag || '',
1131
- ...unpackConfig.html?.templateParameters
1132
- },
1133
- minify: !1,
1134
- chunks: [
1135
- 'main'
1136
- ]
1137
- }),
1138
- unpackConfig.performance?.removeMomentLocale && new core_namespaceObject.rspack.IgnorePlugin({
1139
- resourceRegExp: /^\.\/locale$/,
1140
- contextRegExp: /moment$/
1141
- }),
1142
- unpackConfig.build?.copy && new core_namespaceObject.rspack.CopyRspackPlugin({
1143
- patterns: unpackConfig.build.copy
1144
- }),
1145
- new ProgressPlugin()
1146
- ].filter(Boolean),
1147
- externals: unpackConfig.externals,
1148
- resolve: {
1149
- tsConfig: isTs ? tsconfigPath : void 0,
1150
- alias: {
1151
- '@': external_node_path_default().resolve(unpackConfig.root, 'src'),
1152
- ...unpackConfig.resolve?.alias
1153
- },
1154
- extensionAlias: {
1155
- '.js': [
1156
- '.js',
1157
- '.ts',
1158
- '.tsx'
1159
- ],
1160
- '.jsx': [
1161
- '.jsx',
1162
- '.tsx'
1163
- ]
1164
- },
1165
- extensions: [
1166
- '.tsx',
1167
- '.ts',
1168
- '.jsx',
1169
- '.js',
1170
- '.wasm',
1171
- '.json',
1172
- ...unpackConfig.resolve?.extensions || []
1173
- ]
1174
- },
1175
- lazyCompilation: unpackConfig.dev?.lazyCompilation && utils_isDevServer() && {
1176
- imports: !0,
1177
- entries: !!unpackConfig.mpa
1178
- },
1179
- experiments: {
1180
- css: !1,
1181
- asyncWebAssembly: !0,
1182
- nativeWatcher: !0
1183
- },
1184
- optimization: {
1185
- moduleIds: isDev() ? 'named' : 'deterministic',
1186
- minimize: !!unpackConfig.build?.minify,
1187
- minimizer: [
1188
- new JsMinifyPlugin(mergeConfig({
1189
- compress: {
1190
- target: unpackConfig.build.target
1191
- }
1192
- }, minifyOptions.oxc || {})),
1193
- new core_namespaceObject.rspack.LightningCssMinimizerRspackPlugin(mergeConfig({
1194
- minimizerOptions: {
1195
- targets: esVersionToBrowserslist(unpackConfig.build.target)
1196
- }
1197
- }, minifyOptions.lightningcss || {}))
1198
- ]
1199
- },
1200
- watchOptions: {
1201
- aggregateTimeout: 0
1202
- },
1203
- performance: {
1204
- hints: !1
1205
- }
1206
- };
1207
- for (let plugin of (config = (({ config, unpackConfig })=>{
1208
- let { chunkSplit } = unpackConfig.performance || {};
1209
- if (chunkSplit?.strategy) {
1210
- let forceSplittingGroups = {};
1211
- chunkSplit?.forceSplitting && (forceSplittingGroups = function(forceSplitting, strategy) {
1212
- let cacheGroups = {};
1213
- for (let [key, regexp] of Array.isArray(forceSplitting) ? forceSplitting.map((regexp, index)=>[
1214
- `force-split-${index}`,
1215
- regexp
1216
- ]) : Object.entries(forceSplitting))cacheGroups[key] = {
1217
- test: regexp,
1218
- name: key,
1219
- chunks: 'all',
1220
- priority: +('single-vendor' === strategy),
1221
- enforce: !0
1222
- };
1223
- return cacheGroups;
1224
- }(chunkSplit.forceSplitting, chunkSplit.strategy)), setValueByPath(config, [
1225
- 'optimization',
1226
- 'splitChunks'
1227
- ], SPLIT_STRATEGY_DISPATCHER[chunkSplit.strategy]({
1228
- defaultConfig: {
1229
- chunks: 'all'
1230
- },
1231
- forceSplittingGroups,
1232
- chunkSplit
1233
- }));
1234
- }
1235
- return config;
1236
- })({
1237
- config: config = unpackConfig.experiments?.css ? function({ config, unpackConfig }) {
1238
- config.output.cssFilename = getOutputFilename({
1239
- type: 'css',
1240
- hash: unpackConfig.build?.filenameHash
1241
- }), config.output.cssChunkFilename = getOutputFilename({
1242
- type: 'css',
1243
- hash: unpackConfig.build?.filenameHash,
1244
- async: !0
1245
- }), setValueByPath(config, [
1246
- 'experiments',
1247
- 'css'
1248
- ], !0);
1249
- let sourceMap = unpackConfig.css?.sourceMap, modules = unpackConfig.css?.modules;
1250
- isPlainObject(modules) || !1 === modules || (modules = {}), !1 !== modules && !1 !== modules.auto && (setValueByPath(config, [
1251
- 'module',
1252
- 'parser',
1253
- 'css/module'
1254
- ], {
1255
- namedExports: !1
1256
- }), setValueByPath(config, [
1257
- 'module',
1258
- 'generator',
1259
- 'css/module'
1260
- ], {
1261
- localIdentName: modules.localIdentName || CSS_MODULES_LOCAL_IDENT_NAME,
1262
- exportsConvention: EXPORT_LOCALS_CONVENTION
1263
- }));
1264
- let withCssModules = ({ use })=>{
1265
- if (!1 === modules) return !1;
1266
- let auto = modules.auto;
1267
- return !1 !== auto && {
1268
- test: (resourcePath)=>resourcePath.includes('node_modules') ? CSS_MODULES_REGEX.test(resourcePath) : isRegExp(auto) ? auto.test(resourcePath) : isFunction(auto) ? auto(resourcePath) : CSS_MODULES_REGEX.test(resourcePath),
1269
- use,
1270
- type: 'css/module'
1271
- };
1272
- }, getThreadLoader = ()=>unpackConfig.build?.parallel && isProd() && {
1273
- loader: require.resolve('thread-loader'),
1274
- options: THREAD_OPTIONS
1275
- }, getLessLoader = ()=>({
1276
- loader: getCompiledPkgPath('less-loader'),
1277
- options: {
1278
- lessOptions: mergeConfig({
1279
- javascriptEnabled: !0
1280
- }, unpackConfig.css?.less || {}),
1281
- implementation: getUserDepPath(unpackConfig.root, 'less'),
1282
- sourceMap
1283
- }
1284
- }), getCssLoader = ()=>unpackConfig.css?.transformer === 'lightningcss' ? {
1285
- loader: 'builtin:lightningcss-loader',
1286
- options: {
1287
- targets: esVersionToBrowserslist(unpackConfig.build.target),
1288
- ...unpackConfig.css?.lightningcss
1289
- }
1290
- } : {
1291
- loader: getCompiledPkgPath('postcss-loader'),
1292
- options: {
1293
- postcssOptions: unpackConfig.css?.postcss,
1294
- sourceMap
1295
- }
1296
- }, getSassLoader = ()=>({
1297
- loader: getCompiledPkgPath('sass-loader'),
1298
- options: {
1299
- api: 'modern-compiler',
1300
- implementation: getUserDepPath(unpackConfig.root, [
1301
- 'sass-embedded',
1302
- 'sass'
1303
- ]),
1304
- sassOptions: unpackConfig.css?.sass,
1305
- sourceMap
1306
- }
1307
- });
1308
- return config.module.rules.push({
1309
- test: /\.css$/i,
1310
- oneOf: [
1311
- withCssModules({
1312
- use: [
1313
- getCssLoader()
1314
- ]
1315
- }),
1316
- {
1317
- use: [
1318
- getCssLoader()
1319
- ],
1320
- type: 'css'
1321
- }
1322
- ].filter(Boolean)
1323
- }), config.module.rules.push({
1324
- test: /\.less$/i,
1325
- oneOf: [
1326
- withCssModules({
1327
- use: [
1328
- getCssLoader(),
1329
- getThreadLoader(),
1330
- getLessLoader()
1331
- ].filter(Boolean)
1332
- }),
1333
- {
1334
- use: [
1335
- getCssLoader(),
1336
- getThreadLoader(),
1337
- getLessLoader()
1338
- ].filter(Boolean),
1339
- type: 'css'
1340
- }
1341
- ].filter(Boolean)
1342
- }), config.module.rules.push({
1343
- test: /\.s[ac]ss$/i,
1344
- oneOf: [
1345
- withCssModules({
1346
- use: [
1347
- getCssLoader(),
1348
- getSassLoader()
1349
- ]
1350
- }),
1351
- {
1352
- use: [
1353
- getCssLoader(),
1354
- getSassLoader()
1355
- ],
1356
- type: 'css'
1357
- }
1358
- ].filter(Boolean)
1359
- }), config;
1360
- }({
1361
- config,
1362
- unpackConfig
1363
- }) : function({ config, unpackConfig }) {
1364
- let sourceMap = unpackConfig.css?.sourceMap, modules = unpackConfig.css?.modules;
1365
- isPlainObject(modules) || !1 === modules || (modules = {});
1366
- let getCommonRules = ({ importLoaders })=>[
1367
- utils_isDevServer() ? {
1368
- loader: getCompiledPkgPath('style-loader')
1369
- } : {
1370
- loader: core_namespaceObject.rspack.CssExtractRspackPlugin.loader,
1371
- options: {
1372
- defaultExport: !0
1373
- }
1374
- },
1375
- isDev() && {
1376
- loader: external_node_path_default().resolve(__dirname, './typedCssModulesLoader.mjs'),
1377
- options: {
1378
- modules
1379
- }
1380
- },
1381
- {
1382
- loader: getCompiledPkgPath('css-loader'),
1383
- options: {
1384
- importLoaders,
1385
- modules: {
1386
- auto: (()=>{
1387
- if (!1 === modules) return !1;
1388
- let auto = modules.auto;
1389
- return !1 !== auto && ((resourcePath)=>resourcePath.includes('node_modules') ? CSS_MODULES_REGEX.test(resourcePath) : isRegExp(auto) ? auto.test(resourcePath) : isFunction(auto) ? auto(resourcePath) : CSS_MODULES_REGEX.test(resourcePath));
1390
- })(),
1391
- localIdentName: !1 !== modules && (modules.localIdentName || CSS_MODULES_LOCAL_IDENT_NAME),
1392
- exportLocalsConvention: EXPORT_LOCALS_CONVENTION,
1393
- namedExport: !1
1394
- },
1395
- sourceMap
1396
- }
1397
- }
1398
- ].filter(Boolean);
1399
- utils_isDevServer() || config.plugins.push(new core_namespaceObject.rspack.CssExtractRspackPlugin({
1400
- filename: getOutputFilename({
1401
- type: 'css',
1402
- hash: unpackConfig.build?.filenameHash
1403
- }),
1404
- chunkFilename: getOutputFilename({
1405
- type: 'css',
1406
- hash: unpackConfig.build?.filenameHash,
1407
- async: !0
1408
- }),
1409
- ignoreOrder: !0
1410
- }));
1411
- let getCssLoader = ()=>unpackConfig.css?.transformer === 'lightningcss' ? {
1412
- loader: 'builtin:lightningcss-loader',
1413
- options: {
1414
- targets: esVersionToBrowserslist(unpackConfig.build.target),
1415
- ...unpackConfig.css?.lightningcss
1416
- }
1417
- } : {
1418
- loader: getCompiledPkgPath('postcss-loader'),
1419
- options: {
1420
- postcssOptions: unpackConfig.css?.postcss,
1421
- sourceMap
1422
- }
1423
- };
1424
- return config.module.rules.push({
1425
- test: /\.less$/i,
1426
- use: [
1427
- ...getCommonRules({
1428
- importLoaders: 2
1429
- }),
1430
- getCssLoader(),
1431
- unpackConfig.build?.parallel && isProd() && {
1432
- loader: require.resolve('thread-loader'),
1433
- options: THREAD_OPTIONS
1434
- },
1435
- {
1436
- loader: getCompiledPkgPath('less-loader'),
1437
- options: {
1438
- lessOptions: mergeConfig({
1439
- javascriptEnabled: !0
1440
- }, unpackConfig.css?.less || {}),
1441
- implementation: getUserDepPath(unpackConfig.root, 'less'),
1442
- sourceMap
1443
- }
1444
- }
1445
- ].filter(Boolean)
1446
- }), config.module.rules.push({
1447
- test: /\.css$/i,
1448
- use: [
1449
- ...getCommonRules({
1450
- importLoaders: 1
1451
- }),
1452
- getCssLoader()
1453
- ]
1454
- }), config.module.rules.push({
1455
- test: /\.s[ac]ss$/i,
1456
- use: [
1457
- ...getCommonRules({
1458
- importLoaders: 2
1459
- }),
1460
- getCssLoader(),
1461
- {
1462
- loader: getCompiledPkgPath('sass-loader'),
1463
- options: {
1464
- api: 'modern-compiler',
1465
- implementation: getUserDepPath(unpackConfig.root, [
1466
- 'sass-embedded',
1467
- 'sass'
1468
- ]),
1469
- sassOptions: unpackConfig.css?.sass,
1470
- sourceMap
1471
- }
1472
- }
1473
- ]
1474
- }), config;
1475
- }({
1476
- config,
1477
- unpackConfig
1478
- }),
1479
- unpackConfig
1480
- }), unpackConfig.build?.cache && !(utils_isDevServer() && unpackConfig.dev?.lazyCompilation) && (config = await applyCacheConfig({
1481
- config,
1482
- unpackConfig,
1483
- envFilePaths
1484
- })), unpackConfig.performance?.buildAnalyze && isProd() && (config = await applyBuildAnalyzeConfig({
1485
- config
1486
- })), unpackConfig.typeCheck && isDev() && isTs && (config = await applyTypeCheckConfig({
1487
- config,
1488
- unpackConfig
1489
- })), unpackConfig.detectCircular && (config = function({ config, unpackConfig }) {
1490
- let circularCount = 0, circularDependencyPlugin = new core_namespaceObject.rspack.CircularDependencyRspackPlugin({
1491
- exclude: /node_modules/,
1492
- onStart () {
1493
- circularCount = 0;
1494
- },
1495
- onDetected (_, modules) {
1496
- var paths, paths1;
1497
- circularCount++, console.log(''), logger_logger.warn('circular dependency detected:');
1498
- let uniquePaths = modules.map((module)=>{
1499
- let filePath = module.replace(/^.*!/, ''), relativePath = external_node_path_default().relative(unpackConfig.root, filePath);
1500
- return relativePath.startsWith('..') ? filePath : relativePath;
1501
- }).slice(0, -1), totalLength = 2 + uniquePaths.join(' → ').length;
1502
- if (totalLength > (process.stdout.columns || 80)) {
1503
- let arrow, lastIndex;
1504
- paths = uniquePaths, console.log(''), arrow = '↳ ', lastIndex = paths.length - 1, paths.forEach((p, i)=>{
1505
- switch(i){
1506
- case 0:
1507
- console.log(` ${p}`);
1508
- break;
1509
- case lastIndex:
1510
- console.log(` ${arrow}${p} ${colors.dim('(cycle introduced)')}`);
1511
- break;
1512
- default:
1513
- console.log(` ${arrow}${p}`);
1514
- }
1515
- }), console.log(` ${arrow}${paths[0]}`), console.log('');
1516
- } else {
1517
- let line1, upArrowPos, downArrowPos, lineLength;
1518
- line1 = ' ', upArrowPos = 2, downArrowPos = 0, (paths1 = uniquePaths).forEach((p, i)=>{
1519
- line1 += p, i < paths1.length - 1 ? line1 += ' → ' : downArrowPos = line1.length - 1;
1520
- }), 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('');
1521
- }
1522
- },
1523
- onEnd () {
1524
- circularCount > 0 && console.log(`Found ${circularCount} circular ${1 === circularCount ? 'dependency' : 'dependencies'}`);
1525
- }
1526
- });
1527
- return config.plugins?.push(circularDependencyPlugin), config;
1528
- }({
1529
- config,
1530
- unpackConfig
1531
- })), getNormalizedPluginsByHook('bundlerConfig', unpackConfig.plugins)))config = await plugin.bundlerConfig(config, {
1532
- ...unpackConfig._context,
1533
- unpackConfig,
1534
- mergeConfig: mergeConfig
1535
- });
1536
- return unpackConfig.bundlerConfig && (config = isFunction(unpackConfig.bundlerConfig) ? await unpackConfig.bundlerConfig(config, {
1537
- mergeConfig: mergeConfig
1538
- }) : mergeConfig(config, unpackConfig.bundlerConfig)), config;
1539
- }
1540
- async function unpackBuild(unpackConfig) {
1541
- let config = await getBundlerConfig(unpackConfig), compiler = (0, core_namespaceObject.rspack)(config), handler = (err, stats)=>{
1542
- if (err) {
1543
- console.error(err.stack || err), err.details && console.error(err.details);
1544
- return;
1545
- }
1546
- stats?.hasErrors() && console.log(stats.toString({
1547
- colors: !0,
1548
- preset: 'errors-only'
1549
- })), isWatch() || compiler.close(()=>{});
1550
- };
1551
- isWatch() ? compiler.watch({}, handler) : compiler.run(handler);
1552
- }
1553
- let dev_server_namespaceObject = require("@rspack/dev-server"), external_node_child_process_namespaceObject = require("node:child_process");
1554
- async function openBrowser(url) {
1555
- if ('darwin' === process.platform) try {
1556
- let ps = await execAsync('ps cax'), openedBrowser = [
1557
- 'Google Chrome Canary',
1558
- 'Google Chrome Dev',
1559
- 'Google Chrome Beta',
1560
- 'Google Chrome',
1561
- 'Microsoft Edge',
1562
- 'Brave Browser',
1563
- 'Vivaldi',
1564
- 'Chromium'
1565
- ].find((b)=>ps.includes(b));
1566
- if (openedBrowser) return await execAsync(`osascript openChrome.applescript "${encodeURI(url)}" "${openedBrowser}"`, {
1567
- cwd: external_node_path_default().join(__dirname, '../static')
1568
- }), !0;
1569
- } catch (err) {
1570
- logger_logger.error(err);
1571
- }
1572
- try {
1573
- var url1;
1574
- return (url1 = url, new Promise((resolve, reject)=>{
1575
- let command, args = [];
1576
- switch((0, external_node_os_namespaceObject.platform)()){
1577
- case 'darwin':
1578
- command = 'open', args = [
1579
- url1
1580
- ];
1581
- break;
1582
- case 'win32':
1583
- command = 'cmd', args = [
1584
- '/c',
1585
- 'start',
1586
- '',
1587
- url1
1588
- ];
1589
- break;
1590
- default:
1591
- command = 'xdg-open', args = [
1592
- url1
1593
- ];
1594
- }
1595
- let child = (0, external_node_child_process_namespaceObject.spawn)(command, args, {
1596
- stdio: 'ignore',
1597
- detached: !0,
1598
- windowsHide: !0
1599
- });
1600
- child.on('error', (error)=>{
1601
- reject(Error(`Failed to open URL: ${error.message}`));
1602
- }), child.on('spawn', ()=>{
1603
- resolve();
1604
- }), child.unref();
1605
- })).catch(()=>{}), !0;
1606
- } catch (err) {
1607
- return logger_logger.error(err), !1;
1608
- }
1609
- }
1610
- function execAsync(command, options) {
1611
- return new Promise((resolve, reject)=>{
1612
- (0, external_node_child_process_namespaceObject.exec)(command, options, (error, stdout)=>{
1613
- error ? reject(error) : resolve(stdout.toString());
1614
- });
1615
- });
1616
- }
1617
- let getExternalLibraryName = (pkgName)=>({
1618
- react: 'React',
1619
- 'react-dom': 'ReactDOM',
1620
- 'react-router-dom': 'ReactRouterDOM'
1621
- })[pkgName] || pkgName, getExternalValue = (pkgName)=>`window ${getExternalLibraryName(pkgName)}`, prebundleDeps = async ({ unpackConfig })=>{
1622
- var failedDepsCachePath, externals, failedDepsCachePath1, cache;
1623
- let existExternals, cacheDir, count = {
1624
- total: 0,
1625
- bundled: 0
1626
- }, failedDeps = [], root = unpackConfig.root, CACHE_PATH = unpackConfig._context.cachePath, failedDepsCachePath2 = external_node_path_default().resolve(root, CACHE_PATH, 'failed-deps.json'), failedCache = (failedDepsCachePath = failedDepsCachePath2, external_node_fs_default().existsSync(failedDepsCachePath) ? JSON.parse(external_node_fs_default().readFileSync(failedDepsCachePath, 'utf-8')) : {}), updateProgress = ()=>{
1627
- logUpdate(`${colors.magenta('»')} optimizing dependencies (${count.bundled}/${count.total})`), count.total === count.bundled + failedDeps.length && console.log();
1628
- }, userOptions = isPlainObject(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 = [
1629
- ...(externals = unpackConfig.externals, existExternals = new Set(), Array.isArray(externals) ? externals.forEach((item)=>{
1630
- isPlainObject(item) && Object.keys(item).forEach((key)=>{
1631
- existExternals.add(key);
1632
- });
1633
- }) : isPlainObject(externals) && Object.keys(externals).forEach((key)=>{
1634
- existExternals.add(key);
1635
- }), Array.from(existExternals) || []),
1636
- ...userOptions.exclude || []
1637
- ], shouldIncludeDeps = Object.keys(packageJson.dependencies).filter((pkgName)=>!excludeDeps.includes(pkgName)), noEntryDeps = [], needBundleDeps = shouldIncludeDeps.map((pkgName)=>{
1638
- 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;
1639
- if (failedCache[pkgName] === version) return;
1640
- let entry = ((packageJson)=>{
1641
- if (packageJson.module) return packageJson.module;
1642
- if (packageJson.exports) {
1643
- if (isString(packageJson.exports)) return packageJson.exports;
1644
- let defaultExport = packageJson.exports['.'];
1645
- if (defaultExport) {
1646
- if (isString(defaultExport)) return defaultExport;
1647
- if (isString(defaultExport.import)) return defaultExport.import;
1648
- if (isString(defaultExport.browser)) return defaultExport.browser;
1649
- if (isString(defaultExport.default)) return defaultExport.default;
1650
- }
1651
- if (isString(packageJson.exports.default)) return packageJson.exports.default;
1652
- }
1653
- if (packageJson.main) return packageJson.main;
1654
- })(packageJson);
1655
- if (!entry) {
1656
- noEntryDeps.push(pkgName), failedCache[pkgName] = version;
1657
- return;
1658
- }
1659
- return {
1660
- name: pkgName,
1661
- entry: external_node_path_default().resolve(root, 'node_modules', pkgName, entry),
1662
- version
1663
- };
1664
- }).filter(Boolean), bundledDeps = await Promise.all(needBundleDeps.map((depInfo)=>(({ name, entry, version })=>new Promise((resolve)=>{
1665
- let pkgDir = external_node_path_default().resolve(root, CACHE_PATH, 'umd', name), outDir = external_node_path_default().resolve(pkgDir, version), getResult = ()=>({
1666
- name,
1667
- assets: (0, external_tinyglobby_namespaceObject.globSync)('**/index.{js,css}', {
1668
- cwd: outDir,
1669
- absolute: !0
1670
- })
1671
- });
1672
- if (external_node_fs_default().existsSync(outDir)) return void resolve(getResult());
1673
- count.total++, updateProgress();
1674
- let getSwcOptions = ({ tsx })=>({
1675
- jsc: {
1676
- parser: {
1677
- tsx,
1678
- syntax: "typescript",
1679
- dynamicImport: !0,
1680
- decorators: !0
1681
- },
1682
- transform: {
1683
- react: {
1684
- runtime: 'automatic'
1685
- }
1686
- }
1687
- }
1688
- }), compiler = (0, core_namespaceObject.rspack)({
1689
- entry: {
1690
- index: entry
1691
- },
1692
- context: root,
1693
- mode: 'development',
1694
- output: {
1695
- clean: !0,
1696
- path: outDir,
1697
- pathinfo: !1,
1698
- library: {
1699
- name: getExternalLibraryName(name),
1700
- type: 'umd',
1701
- umdNamedDefine: !0
1702
- },
1703
- globalObject: 'this'
1704
- },
1705
- devtool: !1,
1706
- module: {
1707
- rules: [
1708
- {
1709
- test: /\.(j|t)s$/,
1710
- use: [
1711
- {
1712
- loader: 'builtin:swc-loader',
1713
- options: getSwcOptions({
1714
- tsx: !1
1715
- })
1716
- }
1717
- ]
1718
- },
1719
- {
1720
- test: /\.(j|t)sx$/,
1721
- use: [
1722
- {
1723
- loader: 'builtin:swc-loader',
1724
- options: getSwcOptions({
1725
- tsx: !0
1726
- })
1727
- }
1728
- ]
1729
- },
1730
- {
1731
- test: /\.less$/,
1732
- type: 'css/auto',
1733
- use: [
1734
- {
1735
- loader: getCompiledPkgPath('less-loader'),
1736
- options: {
1737
- lessOptions: {
1738
- javascriptEnabled: !0
1739
- },
1740
- implementation: getUserDepPath(root, 'less')
1741
- }
1742
- }
1743
- ]
1744
- },
1745
- {
1746
- test: /\.s[ac]ss$/i,
1747
- type: 'css/auto',
1748
- use: [
1749
- {
1750
- loader: getCompiledPkgPath('sass-loader'),
1751
- options: {
1752
- api: 'modern-compiler',
1753
- implementation: getUserDepPath(root, [
1754
- 'sass-embedded',
1755
- 'sass'
1756
- ])
1757
- }
1758
- }
1759
- ]
1760
- }
1761
- ]
1762
- },
1763
- optimization: {
1764
- splitChunks: !1
1765
- },
1766
- experiments: {
1767
- css: !0
1768
- },
1769
- externals: {
1770
- react: getExternalValue('react'),
1771
- 'react-dom': getExternalValue('react-dom'),
1772
- 'react-router-dom': getExternalValue('react-router-dom')
1773
- }
1774
- });
1775
- compiler.run((_, stats)=>{
1776
- let isFailed = !1;
1777
- stats?.hasErrors() ? (isFailed = !0, failedDeps.push(name), failedCache[name] = version, removeDir(outDir)) : count.bundled++, updateProgress(), compiler.close(()=>{
1778
- resolve(isFailed ? void 0 : getResult());
1779
- });
1780
- });
1781
- }))(depInfo)));
1782
- failedDepsCachePath1 = failedDepsCachePath2, cache = failedCache, cacheDir = external_node_path_default().dirname(failedDepsCachePath1), external_node_fs_default().existsSync(cacheDir) || external_node_fs_default().mkdirSync(cacheDir, {
1783
- recursive: !0
1784
- }), 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(', '))}"`);
1785
- let cachePath = external_node_path_default().resolve(root, CACHE_PATH, 'umd'), [{ default: express }, { default: cors }] = await Promise.all([
1786
- import("express"),
1787
- import("cors")
1788
- ]), app = express();
1789
- app.use(cors()), app.use("/umd", express.static(cachePath));
1790
- let port = await getPort(), staticServer = app.listen(port, ()=>{});
1791
- addRestartCleaner(()=>new Promise((resolve)=>staticServer.close(()=>resolve())));
1792
- let externals1 = {}, jsAssets = [], cssAssets = [], preJsAssets = [];
1793
- return bundledDeps.filter(Boolean).forEach((dep)=>{
1794
- dep && (externals1[dep.name] = getExternalValue(dep.name), dep.assets.forEach((absPath)=>{
1795
- let relativePath = external_node_path_default().relative(cachePath, absPath), preDeps = [
1796
- 'react',
1797
- 'react-dom',
1798
- 'react-router-dom'
1799
- ], serverPath = `//localhost:${port}/umd/${relativePath}`;
1800
- switch(external_node_path_default().extname(relativePath)){
1801
- case '.js':
1802
- preDeps.includes(dep.name) ? preJsAssets.push({
1803
- path: serverPath,
1804
- order: preDeps.indexOf(dep.name)
1805
- }) : jsAssets.push(serverPath);
1806
- break;
1807
- case '.css':
1808
- ignoreCSSDeps.includes(dep.name) || cssAssets.push(serverPath);
1809
- }
1810
- }));
1811
- }), unpackConfig.externals = Array.isArray(unpackConfig.externals) ? [
1812
- externals1,
1813
- ...unpackConfig.externals
1814
- ] : {
1815
- ...externals1,
1816
- ...unpackConfig.externals
1817
- }, unpackConfig.plugins.push({
1818
- name: 'unpack:prebundle',
1819
- config: (config)=>{
1820
- let originalHeadTag = config.html?.headTag || '', sortedPreTags = preJsAssets.sort((a, b)=>a.order - b.order).map((item)=>item.path).map((item)=>`<script defer src="${item}"></script>`);
1821
- return setValueByPath(config, [
1822
- 'html',
1823
- 'headTag'
1824
- ], `${sortedPreTags.join('')}${originalHeadTag}`), config;
1825
- },
1826
- bundlerConfig: (config)=>{
1827
- let PLUGIN_NAME = 'PluginInjectAssets';
1828
- return config.plugins.push({
1829
- apply: (compiler)=>{
1830
- compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation)=>{
1831
- core_namespaceObject.rspack.HtmlRspackPlugin.getCompilationHooks(compilation).beforeAssetTagGeneration.tapPromise(PLUGIN_NAME, async (args)=>(args.assets.js.unshift(...jsAssets), args.assets.css.unshift(...cssAssets), args));
1832
- });
1833
- }
1834
- }), config;
1835
- }
1836
- }), unpackConfig;
1837
- };
1838
- async function unpackDev(originalUnpackConfig) {
1839
- let unpackConfig = originalUnpackConfig;
1840
- unpackConfig.dev?.prebundle && (unpackConfig = await prebundleDeps({
1841
- unpackConfig
1842
- }));
1843
- let config = await getBundlerConfig(unpackConfig), compiler = (0, core_namespaceObject.rspack)(config), port = await getPort(unpackConfig.server?.port), proxyConfig = unpackConfig.server?.proxy;
1844
- isPlainObject(proxyConfig) && (proxyConfig = Object.entries(proxyConfig).map(([contextStr, target])=>{
1845
- let baseConfig = {
1846
- context: contextStr.split(','),
1847
- changeOrigin: !0
1848
- };
1849
- return isPlainObject(target) ? {
1850
- ...baseConfig,
1851
- ...target
1852
- } : {
1853
- ...baseConfig,
1854
- target
1855
- };
1856
- }));
1857
- let devServerOptions = {
1858
- hot: !0,
1859
- port,
1860
- open: !1,
1861
- client: {
1862
- overlay: !1
1863
- },
1864
- proxy: proxyConfig,
1865
- devMiddleware: {
1866
- writeToDisk: unpackConfig.dev?.writeToDisk
1867
- }
1868
- };
1869
- devServerOptions.setupMiddlewares = (middlewares)=>(middlewares.unshift((req, _, next)=>{
1870
- req.headers.accept?.includes('html') && (req.url = '/index.html'), next();
1871
- }), middlewares.unshift(core_namespaceObject.experiments.lazyCompilationMiddleware(compiler)), middlewares);
1872
- let server = new dev_server_namespaceObject.RspackDevServer(devServerOptions, compiler);
1873
- await server.start(), logger_logger.greet(` ${colors.brand(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v3.5.4`)} ${colors.dim('ready in')} ${colors.bold(Math.ceil(performance.now() - global.__unpack_start_time))} ${colors.dim('ms')}\n`), printAddressUrls(port, unpackConfig.server?.host), addRestartCleaner(()=>server.stop(), ()=>new Promise((resolve)=>compiler.close(()=>resolve())));
1874
- let open = unpackConfig.server?.open, url = isString(open) ? open : `http://localhost:${port}`;
1875
- open && openBrowser(url), setupCliShortcuts({
1876
- openPage: async ()=>{
1877
- await openBrowser(url);
1878
- },
1879
- closeServer: async ()=>{
1880
- await cleanUpBeforeRestart(), process.exit(0);
1881
- },
1882
- printUrls: ()=>{
1883
- printAddressUrls(port, unpackConfig.server?.host);
1884
- },
1885
- restartServer: async ()=>{
1886
- logger_logger.clear(), await cleanUpBeforeRestart(), createUnpack({
1887
- cwd: currentDevUnpackConfig.root,
1888
- config: currentDevUnpackConfig
1889
- }).dev();
1890
- }
1891
- });
1892
- }
1893
- function printAddressUrls(port, host) {
1894
- let addressUrls = getAddressUrls({
1895
- port
1896
- }), colorPrefix = colors.brand('➜');
1897
- addressUrls.forEach((addr, index)=>{
1898
- let url;
1899
- if (!host && 0 !== index) {
1900
- 1 === index && console.log(` ${colors.dim(colorPrefix)} ${colors.bold(colors.dim('Network:'))} ${colors.dim('use')} ${colors.bold('--host')} ${colors.dim('to expose')}`);
1901
- return;
1902
- }
1903
- console.log(` ${colorPrefix} ${colors.bold(addr.label)}${(url = addr.url, colors.cyan(url.replace(/:(\d+)\//, (_, port)=>`:${colors.bold(port)}/`)))}`);
1904
- });
1905
- }
1906
- function createUnpack({ cwd = process.cwd(), config, callerName = 'unpack' }) {
1907
- let resolveConfig = ()=>{
1908
- let defaultConfig = {
1909
- root: cwd,
1910
- build: {
1911
- outDir: 'dist',
1912
- minify: isProd(),
1913
- sourceMap: !isProd() && 'cheap-module-source-map',
1914
- parallel: !0,
1915
- filenameHash: !0,
1916
- target: 'es2022'
1917
- },
1918
- dev: {
1919
- lazyCompilation: !0
1920
- },
1921
- server: {
1922
- port: 3000
1923
- },
1924
- html: {
1925
- mountId: 'root'
1926
- },
1927
- css: {
1928
- modules: !0,
1929
- transformer: 'postcss',
1930
- sourceMap: !1
1931
- },
1932
- performance: {
1933
- chunkSplit: {
1934
- strategy: 'split-by-experience'
1935
- }
1936
- },
1937
- typeCheck: !0,
1938
- envPrefix: [
1939
- 'PUBLIC_'
1940
- ]
1941
- };
1942
- return global.__unpack_caller_name = callerName, {
1943
- ...mergeConfig(defaultConfig, config),
1944
- _context: {
1945
- callerName,
1946
- version: "3.5.4",
1947
- cachePath: 'node_modules/.unpack'
1948
- }
1949
- };
1950
- };
1951
- return {
1952
- build: async ({ watch } = {})=>{
1953
- setNodeEnv(watch ? 'development' : 'production');
1954
- let config = resolveConfig();
1955
- console.log(colors.brand(`${callerName} v3.5.4`), colors.cyan(`building for ${getNodeEnv()}...`)), await unpackBuild(config);
1956
- },
1957
- dev: async ()=>{
1958
- global.__unpack_start_time = performance.now(), setNodeEnv('development'), setDevServer(!0);
1959
- let config = resolveConfig();
1960
- await unpackDev(config);
1961
- }
1962
- };
1963
- }
1964
- let external_chokidar_namespaceObject = require("chokidar");
1965
- var external_chokidar_default = __webpack_require__.n(external_chokidar_namespaceObject);
1966
- let GLOB_REGEX = /[*?{}[\]()!@+|]/;
1967
- async function createChokidar(pathOrGlobs, root = process.cwd(), options) {
1968
- let watchFiles = new Set(), globPatterns = pathOrGlobs.filter((pathOrGlob)=>{
1969
- let str;
1970
- return str = pathOrGlob, !!GLOB_REGEX.test(str) || (watchFiles.add(pathOrGlob), !1);
1971
- });
1972
- if (globPatterns.length) for (let file of (await (0, external_tinyglobby_namespaceObject.glob)(globPatterns, {
1973
- cwd: root,
1974
- absolute: !0
1975
- })))watchFiles.add(file);
1976
- return external_chokidar_default().watch(Array.from(watchFiles), {
1977
- ignoreInitial: !0,
1978
- ignorePermissionErrors: !0,
1979
- ...options
1980
- });
1981
- }
1982
- })(), 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.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.convertBasicAnsiColors = __webpack_exports__.convertBasicAnsiColors, 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.launchEditor = __webpack_exports__.launchEditor, 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 === [
1983
- "CSS_MODULES_LOCAL_IDENT_NAME",
1984
- "CSS_MODULES_REGEX",
1985
- "CSS_NAMED_EXPORT",
1986
- "DEFAULT_DEV_HOST",
1987
- "DEV_DEFAULT_FILENAME",
1988
- "EXPORT_LOCALS_CONVENTION",
1989
- "LogColor",
1990
- "NODE_MODULES_REGEX",
1991
- "PROD_DEFAULT_FILENAME",
1992
- "TEMPLATE_CONTENT",
1993
- "THREAD_OPTIONS",
1994
- "addRestartCleaner",
1995
- "cleanUpBeforeRestart",
1996
- "clearLine",
1997
- "colors",
1998
- "convertBasicAnsiColors",
1999
- "createChokidar",
2000
- "createUnpack",
2001
- "currentDevUnpackConfig",
2002
- "debounce",
2003
- "defineConfig",
2004
- "esVersionToBrowserslist",
2005
- "findExists",
2006
- "getAddressUrls",
2007
- "getCompiledPkgPath",
2008
- "getIpv4Interfaces",
2009
- "getNodeEnv",
2010
- "getPathInJs",
2011
- "getPort",
2012
- "getTime",
2013
- "getUserDepPath",
2014
- "getUserDepVersion",
2015
- "getValueByPath",
2016
- "isBoolean",
2017
- "isCI",
2018
- "isCSSModules",
2019
- "isDebug",
2020
- "isDev",
2021
- "isDevServer",
2022
- "isEmptyDir",
2023
- "isFileExists",
2024
- "isFileSync",
2025
- "isFunction",
2026
- "isNodeVersionAtLeast",
2027
- "isObject",
2028
- "isPlainObject",
2029
- "isProd",
2030
- "isRegExp",
2031
- "isString",
2032
- "isUndefined",
2033
- "isWatch",
2034
- "isWin",
2035
- "launchEditor",
2036
- "loadConfig",
2037
- "logUpdate",
2038
- "logger",
2039
- "mergeConfig",
2040
- "pathExists",
2041
- "prettyTime",
2042
- "removeDir",
2043
- "resolveConfigPath",
2044
- "rspack",
2045
- "setCurrentDevUnpackConfig",
2046
- "setDevServer",
2047
- "setNodeEnv",
2048
- "setValueByPath",
2049
- "setupCliShortcuts",
2050
- "trackPerformance"
2051
- ].indexOf(__webpack_i__) && (exports[__webpack_i__] = __webpack_exports__[__webpack_i__]);
2052
- Object.defineProperty(exports, '__esModule', {
2053
- value: !0
2054
- });