@unpackjs/core 3.5.3 → 3.6.0

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