@unpackjs/core 4.6.1 → 4.7.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.
Files changed (63) hide show
  1. package/compiled/css-loader/index.js +20 -20
  2. package/compiled/less-loader/index.js +8 -8
  3. package/compiled/postcss-loader/index.js +8 -8
  4. package/compiled/sass-loader/index.js +8 -8
  5. package/dist/index.js +1416 -284
  6. package/dist/index.js.LICENSE.txt +20 -0
  7. package/dist/rslib-runtime.js +12 -2
  8. package/dist/transformLoader.js +4 -2
  9. package/dist-types/cli/injectFramework.d.ts.map +1 -1
  10. package/dist-types/constants.d.ts +3 -0
  11. package/dist-types/constants.d.ts.map +1 -1
  12. package/dist-types/createUnpack.d.ts.map +1 -1
  13. package/dist-types/global.d.ts +2 -0
  14. package/dist-types/global.d.ts.map +1 -1
  15. package/dist-types/plugin.d.ts +7 -6
  16. package/dist-types/plugin.d.ts.map +1 -1
  17. package/dist-types/plugins/browserLogs.d.ts.map +1 -1
  18. package/dist-types/plugins/buildAnalyze.d.ts +3 -0
  19. package/dist-types/plugins/buildAnalyze.d.ts.map +1 -0
  20. package/dist-types/plugins/detectCircular.d.ts +3 -0
  21. package/dist-types/plugins/detectCircular.d.ts.map +1 -0
  22. package/dist-types/plugins/prebundle.d.ts.map +1 -1
  23. package/dist-types/plugins/svgIcons.d.ts +2 -2
  24. package/dist-types/plugins/svgIcons.d.ts.map +1 -1
  25. package/dist-types/plugins/target.d.ts +3 -0
  26. package/dist-types/plugins/target.d.ts.map +1 -0
  27. package/dist-types/plugins/typeCheck.d.ts +3 -0
  28. package/dist-types/plugins/typeCheck.d.ts.map +1 -0
  29. package/dist-types/plugins/unocss.d.ts +2 -2
  30. package/dist-types/plugins/unocss.d.ts.map +1 -1
  31. package/dist-types/rspack-config/css.d.ts.map +1 -1
  32. package/dist-types/rspack-config/helpers.d.ts +3 -13
  33. package/dist-types/rspack-config/helpers.d.ts.map +1 -1
  34. package/dist-types/rspack-config/index.d.ts.map +1 -1
  35. package/dist-types/rspack-config/loaders/transformLoader.d.ts +2 -2
  36. package/dist-types/rspack-config/loaders/transformLoader.d.ts.map +1 -1
  37. package/dist-types/rspack-config/nativeCss.d.ts.map +1 -1
  38. package/dist-types/rspack-config/plugins/registerHooks.d.ts.map +1 -1
  39. package/dist-types/run/dev.d.ts +1 -1
  40. package/dist-types/run/dev.d.ts.map +1 -1
  41. package/dist-types/types/config.d.ts +1 -1
  42. package/dist-types/types/config.d.ts.map +1 -1
  43. package/dist-types/types/plugin.d.ts +33 -14
  44. package/dist-types/types/plugin.d.ts.map +1 -1
  45. package/dist-types/types/thirdParty.d.ts +2 -0
  46. package/dist-types/types/thirdParty.d.ts.map +1 -1
  47. package/dist-types/utils.d.ts +2 -2
  48. package/dist-types/utils.d.ts.map +1 -1
  49. package/package.json +4 -4
  50. package/compiled/launch-editor/index.d.ts +0 -16
  51. package/compiled/launch-editor/index.js +0 -761
  52. package/compiled/launch-editor/license +0 -21
  53. package/compiled/launch-editor/package.json +0 -1
  54. package/compiled/webpack-merge/index.d.ts +0 -31
  55. package/compiled/webpack-merge/index.js +0 -1200
  56. package/compiled/webpack-merge/license +0 -20
  57. package/compiled/webpack-merge/package.json +0 -1
  58. package/dist-types/rspack-config/buildAnalyze.d.ts +0 -6
  59. package/dist-types/rspack-config/buildAnalyze.d.ts.map +0 -1
  60. package/dist-types/rspack-config/detectCircular.d.ts +0 -6
  61. package/dist-types/rspack-config/detectCircular.d.ts.map +0 -1
  62. package/dist-types/rspack-config/typeCheck.d.ts +0 -6
  63. package/dist-types/rspack-config/typeCheck.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -1,10 +1,14 @@
1
- let lastTrackTime, lastFileInfo, logger;
1
+ /*! For license information please see index.js.LICENSE.txt */
2
+ let lastTrackTime, devServerPort, lastFileInfo, logger;
2
3
  import __rslib_shim_module__ from "node:module";
3
4
  let require = __rslib_shim_module__.createRequire(import.meta.url);
4
5
  import { fileURLToPath as __rspack_fileURLToPath, pathToFileURL } from "node:url";
5
6
  import node_path, { dirname as __rspack_dirname, join, sep } from "node:path";
6
- import * as __rspack_external__compiled_launch_editor_index_js_29002383 from "../compiled/launch-editor/index.js";
7
- import * as __rspack_external__compiled_webpack_merge_index_js_efd91626 from "../compiled/webpack-merge/index.js";
7
+ import * as __rspack_external_child_process from "child_process";
8
+ import * as __rspack_external_fs from "fs";
9
+ import * as __rspack_external_os from "os";
10
+ import * as __rspack_external_path from "path";
11
+ import * as __rspack_external_url from "url";
8
12
  import { __webpack_require__ } from "./rslib-runtime.js";
9
13
  import { Compilation, rspack } from "@rspack/core";
10
14
  import cac from "cac";
@@ -24,11 +28,1105 @@ import { RspackDevServer } from "@rspack/dev-server";
24
28
  import { exec, spawn } from "node:child_process";
25
29
  import chokidar from "chokidar";
26
30
  __webpack_require__.add({
27
- "compiled/launch-editor" (module) {
28
- module.exports = __rspack_external__compiled_launch_editor_index_js_29002383;
31
+ "../../node_modules/.pnpm/clone-deep@4.0.1/node_modules/clone-deep/index.js" (module, __unused_rspack_exports, __webpack_require__) {
32
+ let clone = __webpack_require__("../../node_modules/.pnpm/shallow-clone@3.0.1/node_modules/shallow-clone/index.js"), typeOf = __webpack_require__("../../node_modules/.pnpm/kind-of@6.0.3/node_modules/kind-of/index.js"), isPlainObject = __webpack_require__("../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js");
33
+ module.exports = function cloneDeep(val, instanceClone) {
34
+ switch(typeOf(val)){
35
+ case 'object':
36
+ var val1 = val, instanceClone1 = instanceClone;
37
+ if ('function' == typeof instanceClone1) return instanceClone1(val1);
38
+ if (instanceClone1 || isPlainObject(val1)) {
39
+ let res = new val1.constructor();
40
+ for(let key in val1)res[key] = cloneDeep(val1[key], instanceClone1);
41
+ return res;
42
+ }
43
+ return val1;
44
+ case 'array':
45
+ var val2 = val, instanceClone2 = instanceClone;
46
+ let res = new val2.constructor(val2.length);
47
+ for(let i = 0; i < val2.length; i++)res[i] = cloneDeep(val2[i], instanceClone2);
48
+ return res;
49
+ default:
50
+ return clone(val);
51
+ }
52
+ };
53
+ },
54
+ "../../node_modules/.pnpm/flat@5.0.2/node_modules/flat/index.js" (module) {
55
+ function isBuffer(obj) {
56
+ return obj && obj.constructor && 'function' == typeof obj.constructor.isBuffer && obj.constructor.isBuffer(obj);
57
+ }
58
+ function keyIdentity(key) {
59
+ return key;
60
+ }
61
+ function flatten(target, opts) {
62
+ let delimiter = (opts = opts || {}).delimiter || '.', maxDepth = opts.maxDepth, transformKey = opts.transformKey || keyIdentity, output = {};
63
+ return !function step(object, prev, currentDepth) {
64
+ currentDepth = currentDepth || 1, Object.keys(object).forEach(function(key) {
65
+ let value = object[key], isarray = opts.safe && Array.isArray(value), type = Object.prototype.toString.call(value), isbuffer = isBuffer(value), newKey = prev ? prev + delimiter + transformKey(key) : transformKey(key);
66
+ if (!isarray && !isbuffer && ('[object Object]' === type || '[object Array]' === type) && Object.keys(value).length && (!opts.maxDepth || currentDepth < maxDepth)) return step(value, newKey, currentDepth + 1);
67
+ output[newKey] = value;
68
+ });
69
+ }(target), output;
70
+ }
71
+ module.exports = flatten, flatten.flatten = flatten, flatten.unflatten = function unflatten(target, opts) {
72
+ let delimiter = (opts = opts || {}).delimiter || '.', overwrite = opts.overwrite || !1, transformKey = opts.transformKey || keyIdentity, result = {};
73
+ if (isBuffer(target) || '[object Object]' !== Object.prototype.toString.call(target)) return target;
74
+ function getkey(key) {
75
+ let parsedKey = Number(key);
76
+ return isNaN(parsedKey) || -1 !== key.indexOf('.') || opts.object ? key : parsedKey;
77
+ }
78
+ return Object.keys(target = Object.keys(target).reduce(function(result, key) {
79
+ var target1, val;
80
+ let type, type1 = Object.prototype.toString.call(target[key]);
81
+ return ('[object Object]' === type1 || '[object Array]' === type1) && (val = target[key], type = Object.prototype.toString.call(val), val && ('[object Array]' === type ? val.length : '[object Object]' === type ? Object.keys(val).length : !void 0)) ? Object.keys(target1 = flatten(target[key], opts)).reduce(function(result, key1) {
82
+ return result[key + delimiter + key1] = target1[key1], result;
83
+ }, result) : (result[key] = target[key], result);
84
+ }, {})).forEach(function(key) {
85
+ let split = key.split(delimiter).map(transformKey), key1 = getkey(split.shift()), key2 = getkey(split[0]), recipient = result;
86
+ for(; void 0 !== key2;){
87
+ if ('__proto__' === key1) return;
88
+ let type = Object.prototype.toString.call(recipient[key1]), isobject = '[object Object]' === type || '[object Array]' === type;
89
+ if (!overwrite && !isobject && void 0 !== recipient[key1]) return;
90
+ (!overwrite || isobject) && (overwrite || null != recipient[key1]) || (recipient[key1] = 'number' != typeof key2 || opts.object ? {} : []), recipient = recipient[key1], split.length > 0 && (key1 = getkey(split.shift()), key2 = getkey(split[0]));
91
+ }
92
+ recipient[key1] = unflatten(target[key], opts);
93
+ }), result;
94
+ };
95
+ },
96
+ "../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js" (module, __unused_rspack_exports, __webpack_require__) {
97
+ var isObject = __webpack_require__("../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js");
98
+ function isObjectObject(o) {
99
+ return !0 === isObject(o) && '[object Object]' === Object.prototype.toString.call(o);
100
+ }
101
+ module.exports = function(o) {
102
+ var ctor, prot;
103
+ return !1 !== isObjectObject(o) && 'function' == typeof (ctor = o.constructor) && !1 !== isObjectObject(prot = ctor.prototype) && !1 !== prot.hasOwnProperty('isPrototypeOf');
104
+ };
105
+ },
106
+ "../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js" (module) {
107
+ module.exports = function(val) {
108
+ return null != val && 'object' == typeof val && !1 === Array.isArray(val);
109
+ };
110
+ },
111
+ "../../node_modules/.pnpm/kind-of@6.0.3/node_modules/kind-of/index.js" (module) {
112
+ var toString = Object.prototype.toString;
113
+ function ctorName(val) {
114
+ return 'function' == typeof val.constructor ? val.constructor.name : null;
115
+ }
116
+ module.exports = function(val) {
117
+ if (void 0 === val) return 'undefined';
118
+ if (null === val) return 'null';
119
+ var val1, val2, val3, val4, val5, val6, type = typeof val;
120
+ if ('boolean' === type) return 'boolean';
121
+ if ('string' === type) return 'string';
122
+ if ('number' === type) return 'number';
123
+ if ('symbol' === type) return 'symbol';
124
+ if ('function' === type) return 'GeneratorFunction' === ctorName(val) ? 'generatorfunction' : 'function';
125
+ if (val1 = val, Array.isArray ? Array.isArray(val1) : val1 instanceof Array) return 'array';
126
+ if ((val2 = val).constructor && 'function' == typeof val2.constructor.isBuffer && val2.constructor.isBuffer(val2)) return 'buffer';
127
+ if (function(val) {
128
+ try {
129
+ if ('number' == typeof val.length && 'function' == typeof val.callee) return !0;
130
+ } catch (err) {
131
+ if (-1 !== err.message.indexOf('callee')) return !0;
132
+ }
133
+ return !1;
134
+ }(val)) return 'arguments';
135
+ if ((val3 = val) instanceof Date || 'function' == typeof val3.toDateString && 'function' == typeof val3.getDate && 'function' == typeof val3.setDate) return 'date';
136
+ if ((val4 = val) instanceof Error || 'string' == typeof val4.message && val4.constructor && 'number' == typeof val4.constructor.stackTraceLimit) return 'error';
137
+ if ((val5 = val) instanceof RegExp || 'string' == typeof val5.flags && 'boolean' == typeof val5.ignoreCase && 'boolean' == typeof val5.multiline && 'boolean' == typeof val5.global) return 'regexp';
138
+ switch(ctorName(val)){
139
+ case 'Symbol':
140
+ return 'symbol';
141
+ case 'Promise':
142
+ return 'promise';
143
+ case 'WeakMap':
144
+ return 'weakmap';
145
+ case 'WeakSet':
146
+ return 'weakset';
147
+ case 'Map':
148
+ return 'map';
149
+ case 'Set':
150
+ return 'set';
151
+ case 'Int8Array':
152
+ return 'int8array';
153
+ case 'Uint8Array':
154
+ return 'uint8array';
155
+ case 'Uint8ClampedArray':
156
+ return 'uint8clampedarray';
157
+ case 'Int16Array':
158
+ return 'int16array';
159
+ case 'Uint16Array':
160
+ return 'uint16array';
161
+ case 'Int32Array':
162
+ return 'int32array';
163
+ case 'Uint32Array':
164
+ return 'uint32array';
165
+ case 'Float32Array':
166
+ return 'float32array';
167
+ case 'Float64Array':
168
+ return 'float64array';
169
+ }
170
+ if ('function' == typeof (val6 = val).throw && 'function' == typeof val6.return && 'function' == typeof val6.next) return 'generator';
171
+ switch(type = toString.call(val)){
172
+ case '[object Object]':
173
+ return 'object';
174
+ case '[object Map Iterator]':
175
+ return 'mapiterator';
176
+ case '[object Set Iterator]':
177
+ return 'setiterator';
178
+ case '[object String Iterator]':
179
+ return 'stringiterator';
180
+ case '[object Array Iterator]':
181
+ return 'arrayiterator';
182
+ }
183
+ return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
184
+ };
185
+ },
186
+ "../../node_modules/.pnpm/launch-editor@2.13.1/node_modules/launch-editor/editor-info/linux.js" (module) {
187
+ module.exports = {
188
+ atom: 'atom',
189
+ Brackets: 'brackets',
190
+ 'code-insiders': 'code-insiders',
191
+ code: 'code',
192
+ vscodium: 'vscodium',
193
+ codium: 'codium',
194
+ cursor: 'cursor',
195
+ trae: 'trae',
196
+ antigravity: 'antigravity',
197
+ emacs: 'emacs',
198
+ gvim: 'gvim',
199
+ idea: 'idea',
200
+ 'idea.sh': 'idea',
201
+ phpstorm: 'phpstorm',
202
+ 'phpstorm.sh': 'phpstorm',
203
+ pycharm: 'pycharm',
204
+ 'pycharm.sh': 'pycharm',
205
+ rubymine: 'rubymine',
206
+ 'rubymine.sh': 'rubymine',
207
+ sublime_text: 'subl',
208
+ vim: 'vim',
209
+ webstorm: 'webstorm',
210
+ 'webstorm.sh': 'webstorm',
211
+ goland: 'goland',
212
+ 'goland.sh': 'goland',
213
+ rider: 'rider',
214
+ 'rider.sh': 'rider',
215
+ zed: 'zed'
216
+ };
217
+ },
218
+ "../../node_modules/.pnpm/launch-editor@2.13.1/node_modules/launch-editor/editor-info/macos.js" (module) {
219
+ module.exports = {
220
+ '/Applications/Atom.app/Contents/MacOS/Atom': 'atom',
221
+ '/Applications/Atom Beta.app/Contents/MacOS/Atom Beta': '/Applications/Atom Beta.app/Contents/MacOS/Atom Beta',
222
+ '/Applications/Brackets.app/Contents/MacOS/Brackets': 'brackets',
223
+ '/Applications/Sublime Text.app/Contents/MacOS/Sublime Text': '/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl',
224
+ '/Applications/Sublime Text.app/Contents/MacOS/sublime_text': '/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl',
225
+ '/Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2': '/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl',
226
+ '/Applications/Sublime Text Dev.app/Contents/MacOS/Sublime Text': '/Applications/Sublime Text Dev.app/Contents/SharedSupport/bin/subl',
227
+ '/Applications/Visual Studio Code.app/Contents/MacOS/Electron': 'code',
228
+ '/Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Code - Insiders': 'code-insiders',
229
+ '/Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Electron': 'code-insiders',
230
+ '/Applications/VSCodium.app/Contents/MacOS/Electron': 'codium',
231
+ '/Applications/Cursor.app/Contents/MacOS/Cursor': 'cursor',
232
+ '/Applications/Trae.app/Contents/MacOS/Electron': 'trae',
233
+ '/Applications/Antigravity.app/Contents/MacOS/Electron': 'antigravity',
234
+ '/Applications/AppCode.app/Contents/MacOS/appcode': '/Applications/AppCode.app/Contents/MacOS/appcode',
235
+ '/Applications/CLion.app/Contents/MacOS/clion': '/Applications/CLion.app/Contents/MacOS/clion',
236
+ '/Applications/IntelliJ IDEA.app/Contents/MacOS/idea': '/Applications/IntelliJ IDEA.app/Contents/MacOS/idea',
237
+ '/Applications/IntelliJ IDEA Ultimate.app/Contents/MacOS/idea': '/Applications/IntelliJ IDEA Ultimate.app/Contents/MacOS/idea',
238
+ '/Applications/IntelliJ IDEA Community Edition.app/Contents/MacOS/idea': '/Applications/IntelliJ IDEA Community Edition.app/Contents/MacOS/idea',
239
+ '/Applications/PhpStorm.app/Contents/MacOS/phpstorm': '/Applications/PhpStorm.app/Contents/MacOS/phpstorm',
240
+ '/Applications/PyCharm.app/Contents/MacOS/pycharm': '/Applications/PyCharm.app/Contents/MacOS/pycharm',
241
+ '/Applications/PyCharm CE.app/Contents/MacOS/pycharm': '/Applications/PyCharm CE.app/Contents/MacOS/pycharm',
242
+ '/Applications/RubyMine.app/Contents/MacOS/rubymine': '/Applications/RubyMine.app/Contents/MacOS/rubymine',
243
+ '/Applications/WebStorm.app/Contents/MacOS/webstorm': '/Applications/WebStorm.app/Contents/MacOS/webstorm',
244
+ '/Applications/MacVim.app/Contents/MacOS/MacVim': 'mvim',
245
+ '/Applications/GoLand.app/Contents/MacOS/goland': '/Applications/GoLand.app/Contents/MacOS/goland',
246
+ '/Applications/Rider.app/Contents/MacOS/rider': '/Applications/Rider.app/Contents/MacOS/rider',
247
+ '/Applications/Zed.app/Contents/MacOS/zed': 'zed'
248
+ };
249
+ },
250
+ "../../node_modules/.pnpm/launch-editor@2.13.1/node_modules/launch-editor/editor-info/windows.js" (module) {
251
+ module.exports = [
252
+ 'Brackets.exe',
253
+ 'Code.exe',
254
+ 'Code - Insiders.exe',
255
+ 'VSCodium.exe',
256
+ 'Cursor.exe',
257
+ 'atom.exe',
258
+ 'sublime_text.exe',
259
+ 'notepad++.exe',
260
+ 'clion.exe',
261
+ 'clion64.exe',
262
+ 'idea.exe',
263
+ 'idea64.exe',
264
+ 'phpstorm.exe',
265
+ 'phpstorm64.exe',
266
+ 'pycharm.exe',
267
+ 'pycharm64.exe',
268
+ 'rubymine.exe',
269
+ 'rubymine64.exe',
270
+ 'webstorm.exe',
271
+ 'webstorm64.exe',
272
+ 'goland.exe',
273
+ 'goland64.exe',
274
+ 'rider.exe',
275
+ 'rider64.exe',
276
+ 'trae.exe',
277
+ 'zed.exe',
278
+ 'Antigravity.exe'
279
+ ];
280
+ },
281
+ "../../node_modules/.pnpm/launch-editor@2.13.1/node_modules/launch-editor/get-args.js" (module, __unused_rspack_exports, __webpack_require__) {
282
+ let path = __webpack_require__("path");
283
+ module.exports = function(editor, fileName, lineNumber, columnNumber = 1) {
284
+ switch(path.basename(editor).replace(/\.(exe|cmd|bat)$/i, '')){
285
+ case 'atom':
286
+ case 'Atom':
287
+ case 'Atom Beta':
288
+ case 'subl':
289
+ case 'sublime':
290
+ case 'sublime_text':
291
+ case 'wstorm':
292
+ case 'charm':
293
+ case 'zed':
294
+ return [
295
+ `${fileName}:${lineNumber}:${columnNumber}`
296
+ ];
297
+ case 'notepad++':
298
+ return [
299
+ '-n' + lineNumber,
300
+ '-c' + columnNumber,
301
+ fileName
302
+ ];
303
+ case 'vim':
304
+ case 'mvim':
305
+ return [
306
+ `+call cursor(${lineNumber}, ${columnNumber})`,
307
+ fileName
308
+ ];
309
+ case 'joe':
310
+ case 'gvim':
311
+ return [
312
+ `+${lineNumber}`,
313
+ fileName
314
+ ];
315
+ case 'emacs':
316
+ case 'emacsclient':
317
+ return [
318
+ `+${lineNumber}:${columnNumber}`,
319
+ fileName
320
+ ];
321
+ case 'rmate':
322
+ case 'mate':
323
+ case 'mine':
324
+ return [
325
+ '--line',
326
+ lineNumber,
327
+ fileName
328
+ ];
329
+ case 'code':
330
+ case 'Code':
331
+ case 'code-insiders':
332
+ case 'Code - Insiders':
333
+ case 'codium':
334
+ case 'trae':
335
+ case 'antigravity':
336
+ case 'cursor':
337
+ case 'vscodium':
338
+ case 'VSCodium':
339
+ return [
340
+ '-r',
341
+ '-g',
342
+ `${fileName}:${lineNumber}:${columnNumber}`
343
+ ];
344
+ case 'appcode':
345
+ case 'clion':
346
+ case 'clion64':
347
+ case 'idea':
348
+ case 'idea64':
349
+ case 'phpstorm':
350
+ case 'phpstorm64':
351
+ case 'pycharm':
352
+ case 'pycharm64':
353
+ case 'rubymine':
354
+ case 'rubymine64':
355
+ case 'webstorm':
356
+ case 'webstorm64':
357
+ case 'goland':
358
+ case 'goland64':
359
+ case 'rider':
360
+ case 'rider64':
361
+ return [
362
+ '--line',
363
+ lineNumber,
364
+ '--column',
365
+ columnNumber,
366
+ fileName
367
+ ];
368
+ }
369
+ return process.env.LAUNCH_EDITOR ? [
370
+ fileName,
371
+ lineNumber,
372
+ columnNumber
373
+ ] : [
374
+ fileName
375
+ ];
376
+ };
377
+ },
378
+ "../../node_modules/.pnpm/launch-editor@2.13.1/node_modules/launch-editor/guess.js" (module, __unused_rspack_exports, __webpack_require__) {
379
+ let path = __webpack_require__("path"), shellQuote = __webpack_require__("../../node_modules/.pnpm/shell-quote@1.8.3/node_modules/shell-quote/index.js"), childProcess = __webpack_require__("child_process"), COMMON_EDITORS_MACOS = __webpack_require__("../../node_modules/.pnpm/launch-editor@2.13.1/node_modules/launch-editor/editor-info/macos.js"), COMMON_EDITORS_LINUX = __webpack_require__("../../node_modules/.pnpm/launch-editor@2.13.1/node_modules/launch-editor/editor-info/linux.js"), COMMON_EDITORS_WIN = __webpack_require__("../../node_modules/.pnpm/launch-editor@2.13.1/node_modules/launch-editor/editor-info/windows.js");
380
+ module.exports = function(specifiedEditor) {
381
+ if (specifiedEditor) return shellQuote.parse(specifiedEditor);
382
+ if (process.env.LAUNCH_EDITOR) return [
383
+ process.env.LAUNCH_EDITOR
384
+ ];
385
+ if (process.versions.webcontainer) return [
386
+ process.env.EDITOR || 'code'
387
+ ];
388
+ try {
389
+ if ('darwin' === process.platform) {
390
+ let output = childProcess.execSync('ps x -o comm=', {
391
+ stdio: [
392
+ 'pipe',
393
+ 'pipe',
394
+ 'ignore'
395
+ ]
396
+ }).toString(), processNames = Object.keys(COMMON_EDITORS_MACOS), processList = output.split('\n');
397
+ for(let i = 0; i < processNames.length; i++){
398
+ let processName = processNames[i];
399
+ if (processList.includes(processName)) return [
400
+ COMMON_EDITORS_MACOS[processName]
401
+ ];
402
+ let processNameWithoutApplications = processName.replace('/Applications', '');
403
+ if (-1 !== output.indexOf(processNameWithoutApplications)) {
404
+ if (processName !== COMMON_EDITORS_MACOS[processName]) return [
405
+ COMMON_EDITORS_MACOS[processName]
406
+ ];
407
+ let runningProcess = processList.find((procName)=>procName.endsWith(processNameWithoutApplications));
408
+ if (void 0 !== runningProcess) return [
409
+ runningProcess
410
+ ];
411
+ }
412
+ }
413
+ } else if ('win32' === process.platform) {
414
+ let runningProcesses = childProcess.execSync('powershell -NoProfile -Command "[Console]::OutputEncoding=[Text.Encoding]::UTF8;Get-CimInstance -Query \\"select executablepath from win32_process where executablepath is not null\\" | % { $_.ExecutablePath }"', {
415
+ stdio: [
416
+ 'pipe',
417
+ 'pipe',
418
+ 'ignore'
419
+ ]
420
+ }).toString().split('\r\n');
421
+ for(let i = 0; i < runningProcesses.length; i++){
422
+ let fullProcessPath = runningProcesses[i].trim(), shortProcessName = path.basename(fullProcessPath);
423
+ if (-1 !== COMMON_EDITORS_WIN.indexOf(shortProcessName)) return [
424
+ fullProcessPath
425
+ ];
426
+ }
427
+ } else if ('linux' === process.platform) {
428
+ let output = childProcess.execSync('ps x --no-heading -o comm --sort=comm', {
429
+ stdio: [
430
+ 'pipe',
431
+ 'pipe',
432
+ 'ignore'
433
+ ]
434
+ }).toString(), processNames = Object.keys(COMMON_EDITORS_LINUX);
435
+ for(let i = 0; i < processNames.length; i++){
436
+ let processName = processNames[i];
437
+ if (-1 !== output.indexOf(processName)) return [
438
+ COMMON_EDITORS_LINUX[processName]
439
+ ];
440
+ }
441
+ }
442
+ } catch (ignoreError) {}
443
+ return process.env.VISUAL ? [
444
+ process.env.VISUAL
445
+ ] : process.env.EDITOR ? [
446
+ process.env.EDITOR
447
+ ] : [
448
+ null
449
+ ];
450
+ };
451
+ },
452
+ "../../node_modules/.pnpm/launch-editor@2.13.1/node_modules/launch-editor/index.js" (module, __unused_rspack_exports, __webpack_require__) {
453
+ let fs = __webpack_require__("fs"), os = __webpack_require__("os"), path = __webpack_require__("path"), colors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"), childProcess = __webpack_require__("child_process"), guessEditor = __webpack_require__("../../node_modules/.pnpm/launch-editor@2.13.1/node_modules/launch-editor/guess.js"), getArgumentsForPosition = __webpack_require__("../../node_modules/.pnpm/launch-editor@2.13.1/node_modules/launch-editor/get-args.js"), positionRE = /:(\d+)(:(\d+))?$/, _childProcess = null;
454
+ module.exports = function(file, specifiedEditor, onErrorCallback) {
455
+ var file1, cb;
456
+ let fileName, match, parsed = ((file1 = file).startsWith('file://') && (file1 = __webpack_require__("url").fileURLToPath(file1)), fileName = file1.replace(positionRE, ''), {
457
+ fileName,
458
+ lineNumber: (match = file1.match(positionRE)) && match[1],
459
+ columnNumber: match && match[3]
460
+ }), { fileName: fileName1 } = parsed, { lineNumber, columnNumber } = parsed;
461
+ if (!fs.existsSync(fileName1)) return;
462
+ 'function' == typeof specifiedEditor && (onErrorCallback = specifiedEditor, specifiedEditor = void 0), cb = onErrorCallback, onErrorCallback = (fileName, errorMessage)=>{
463
+ console.log(), console.log(colors.red('Could not open ' + path.basename(fileName) + ' in the editor.')), errorMessage && ('.' !== errorMessage[errorMessage.length - 1] && (errorMessage += '.'), console.log(colors.red('The editor process exited with an error: ' + errorMessage))), console.log(), cb && cb(fileName, errorMessage);
464
+ };
465
+ let [editor, ...args] = guessEditor(specifiedEditor);
466
+ if (!editor) return void onErrorCallback(fileName1, null);
467
+ if ('linux' === process.platform && fileName1.startsWith('/mnt/') && /Microsoft/i.test(os.release()) && (fileName1 = path.relative('', fileName1)), lineNumber) {
468
+ let extraArgs = getArgumentsForPosition(editor, fileName1, lineNumber, columnNumber);
469
+ args.push.apply(args, extraArgs);
470
+ } else args.push(fileName1);
471
+ if (_childProcess && function(editor) {
472
+ switch(editor){
473
+ case 'vim':
474
+ case 'emacs':
475
+ case 'nano':
476
+ return !0;
477
+ }
478
+ return !1;
479
+ }(editor) && _childProcess.kill('SIGKILL'), 'win32' === process.platform) {
480
+ let launchCommand = [
481
+ editor,
482
+ ...args.map(function(cmdArgs) {
483
+ return cmdArgs.replace(/([&|<>,;=^])/g, '^$1');
484
+ })
485
+ ].map(function(str) {
486
+ return str.includes('^') ? `^"${str}^"` : str.includes(' ') ? `"${str}"` : str;
487
+ }).join(' ');
488
+ _childProcess = childProcess.exec(launchCommand, {
489
+ stdio: 'inherit',
490
+ shell: !0
491
+ });
492
+ } else _childProcess = childProcess.spawn(editor, args, {
493
+ stdio: 'inherit'
494
+ });
495
+ _childProcess.on('exit', function(errorCode) {
496
+ _childProcess = null, errorCode && onErrorCallback(fileName1, '(code ' + errorCode + ')');
497
+ }), _childProcess.on('error', function(error) {
498
+ let { code, message } = error;
499
+ 'ENOENT' === code && (message = `${message} ('${editor}' command does not exist in 'PATH')`), onErrorCallback(fileName1, message);
500
+ });
501
+ };
502
+ },
503
+ "../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js" (module) {
504
+ let p = process || {}, argv = p.argv || [], env = p.env || {}, isColorSupported = !(env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || "win32" === p.platform || (p.stdout || {}).isTTY && "dumb" !== env.TERM || !!env.CI), formatter = (open, close, replace = open)=>(input)=>{
505
+ let string = "" + input, index = string.indexOf(close, open.length);
506
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
507
+ }, replaceClose = (string, close, replace, index)=>{
508
+ let result = "", cursor = 0;
509
+ do result += string.substring(cursor, index) + replace, cursor = index + close.length, index = string.indexOf(close, cursor);
510
+ while (~index);
511
+ return result + string.substring(cursor);
512
+ }, createColors = (enabled = isColorSupported)=>{
513
+ let f = enabled ? formatter : ()=>String;
514
+ return {
515
+ isColorSupported: enabled,
516
+ reset: f("\x1b[0m", "\x1b[0m"),
517
+ bold: f("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
518
+ dim: f("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
519
+ italic: f("\x1b[3m", "\x1b[23m"),
520
+ underline: f("\x1b[4m", "\x1b[24m"),
521
+ inverse: f("\x1b[7m", "\x1b[27m"),
522
+ hidden: f("\x1b[8m", "\x1b[28m"),
523
+ strikethrough: f("\x1b[9m", "\x1b[29m"),
524
+ black: f("\x1b[30m", "\x1b[39m"),
525
+ red: f("\x1b[31m", "\x1b[39m"),
526
+ green: f("\x1b[32m", "\x1b[39m"),
527
+ yellow: f("\x1b[33m", "\x1b[39m"),
528
+ blue: f("\x1b[34m", "\x1b[39m"),
529
+ magenta: f("\x1b[35m", "\x1b[39m"),
530
+ cyan: f("\x1b[36m", "\x1b[39m"),
531
+ white: f("\x1b[37m", "\x1b[39m"),
532
+ gray: f("\x1b[90m", "\x1b[39m"),
533
+ bgBlack: f("\x1b[40m", "\x1b[49m"),
534
+ bgRed: f("\x1b[41m", "\x1b[49m"),
535
+ bgGreen: f("\x1b[42m", "\x1b[49m"),
536
+ bgYellow: f("\x1b[43m", "\x1b[49m"),
537
+ bgBlue: f("\x1b[44m", "\x1b[49m"),
538
+ bgMagenta: f("\x1b[45m", "\x1b[49m"),
539
+ bgCyan: f("\x1b[46m", "\x1b[49m"),
540
+ bgWhite: f("\x1b[47m", "\x1b[49m"),
541
+ blackBright: f("\x1b[90m", "\x1b[39m"),
542
+ redBright: f("\x1b[91m", "\x1b[39m"),
543
+ greenBright: f("\x1b[92m", "\x1b[39m"),
544
+ yellowBright: f("\x1b[93m", "\x1b[39m"),
545
+ blueBright: f("\x1b[94m", "\x1b[39m"),
546
+ magentaBright: f("\x1b[95m", "\x1b[39m"),
547
+ cyanBright: f("\x1b[96m", "\x1b[39m"),
548
+ whiteBright: f("\x1b[97m", "\x1b[39m"),
549
+ bgBlackBright: f("\x1b[100m", "\x1b[49m"),
550
+ bgRedBright: f("\x1b[101m", "\x1b[49m"),
551
+ bgGreenBright: f("\x1b[102m", "\x1b[49m"),
552
+ bgYellowBright: f("\x1b[103m", "\x1b[49m"),
553
+ bgBlueBright: f("\x1b[104m", "\x1b[49m"),
554
+ bgMagentaBright: f("\x1b[105m", "\x1b[49m"),
555
+ bgCyanBright: f("\x1b[106m", "\x1b[49m"),
556
+ bgWhiteBright: f("\x1b[107m", "\x1b[49m")
557
+ };
558
+ };
559
+ module.exports = createColors(), module.exports.createColors = createColors;
560
+ },
561
+ "../../node_modules/.pnpm/shallow-clone@3.0.1/node_modules/shallow-clone/index.js" (module, __unused_rspack_exports, __webpack_require__) {
562
+ let valueOf = Symbol.prototype.valueOf, typeOf = __webpack_require__("../../node_modules/.pnpm/kind-of@6.0.3/node_modules/kind-of/index.js");
563
+ module.exports = function(val, deep) {
564
+ var val1, val2, val3, val4, val5;
565
+ switch(typeOf(val)){
566
+ case 'array':
567
+ return val.slice();
568
+ case 'object':
569
+ return Object.assign({}, val);
570
+ case 'date':
571
+ return new val.constructor(Number(val));
572
+ case 'map':
573
+ return new Map(val);
574
+ case 'set':
575
+ return new Set(val);
576
+ case 'buffer':
577
+ let len, buf;
578
+ return len = (val1 = val).length, buf = Buffer.allocUnsafe ? Buffer.allocUnsafe(len) : Buffer.from(len), val1.copy(buf), buf;
579
+ case 'symbol':
580
+ return val2 = val, valueOf ? Object(valueOf.call(val2)) : {};
581
+ case 'arraybuffer':
582
+ let res;
583
+ return new Uint8Array(res = new (val3 = val).constructor(val3.byteLength)).set(new Uint8Array(val3)), res;
584
+ case 'float32array':
585
+ case 'float64array':
586
+ case 'int16array':
587
+ case 'int32array':
588
+ case 'int8array':
589
+ case 'uint16array':
590
+ case 'uint32array':
591
+ case 'uint8clampedarray':
592
+ case 'uint8array':
593
+ return new (val4 = val).constructor(val4.buffer, val4.byteOffset, val4.length);
594
+ case 'regexp':
595
+ let flags, re;
596
+ return flags = void 0 !== (val5 = val).flags ? val5.flags : /\w+$/.exec(val5) || void 0, (re = new val5.constructor(val5.source, flags)).lastIndex = val5.lastIndex, re;
597
+ case 'error':
598
+ return Object.create(val);
599
+ default:
600
+ return val;
601
+ }
602
+ };
603
+ },
604
+ "../../node_modules/.pnpm/shell-quote@1.8.3/node_modules/shell-quote/index.js" (__unused_rspack_module, exports, __webpack_require__) {
605
+ exports.quote = __webpack_require__("../../node_modules/.pnpm/shell-quote@1.8.3/node_modules/shell-quote/quote.js"), exports.parse = __webpack_require__("../../node_modules/.pnpm/shell-quote@1.8.3/node_modules/shell-quote/parse.js");
606
+ },
607
+ "../../node_modules/.pnpm/shell-quote@1.8.3/node_modules/shell-quote/parse.js" (module) {
608
+ for(var CONTROL = "(?:\\|\\||\\&\\&|;;|\\|\\&|\\<\\(|\\<\\<\\<|>>|>\\&|<\\&|[&;()|<>])", controlRE = RegExp('^' + CONTROL + '$'), META = '|&;()<> \\t', hash = /^#$/, TOKEN = '', i = 0; i < 4; i++)TOKEN += (0x100000000 * Math.random()).toString(16);
609
+ var startsWithToken = RegExp('^' + TOKEN);
610
+ module.exports = function(s, env, opts) {
611
+ var mapped = function(string, env, opts) {
612
+ opts || (opts = {});
613
+ var BS = opts.escape || '\\', matches = function(s, r) {
614
+ for(var matchObj, origIndex = r.lastIndex, matches = []; matchObj = r.exec(s);)matches.push(matchObj), r.lastIndex === matchObj.index && (r.lastIndex += 1);
615
+ return r.lastIndex = origIndex, matches;
616
+ }(string, RegExp([
617
+ '(' + CONTROL + ')',
618
+ '(' + ('(\\' + BS + '[\'"' + META + ']|[^\\s\'"' + META) + "])+|\"((\\\\\"|[^\"])*?)\"|'((\\\\'|[^'])*?)')+"
619
+ ].join('|'), 'g'));
620
+ if (0 === matches.length) return [];
621
+ env || (env = {});
622
+ var commented = !1;
623
+ return matches.map(function(match) {
624
+ var i, s = match[0];
625
+ if (s && !commented) {
626
+ if (controlRE.test(s)) return {
627
+ op: s
628
+ };
629
+ var quote = !1, esc = !1, out = '', isGlob = !1;
630
+ for(i = 0; i < s.length; i++){
631
+ var c = s.charAt(i);
632
+ if (isGlob = isGlob || !quote && ('*' === c || '?' === c), esc) out += c, esc = !1;
633
+ else if (quote) c === quote ? quote = !1 : "'" == quote ? out += c : c === BS ? (i += 1, '"' === (c = s.charAt(i)) || c === BS || '$' === c ? out += c : out += BS + c) : '$' === c ? out += parseEnvVar() : out += c;
634
+ else if ('"' === c || "'" === c) quote = c;
635
+ else if (controlRE.test(c)) return {
636
+ op: s
637
+ };
638
+ else if (hash.test(c)) {
639
+ commented = !0;
640
+ var commentObj = {
641
+ comment: string.slice(match.index + i + 1)
642
+ };
643
+ if (out.length) return [
644
+ out,
645
+ commentObj
646
+ ];
647
+ return [
648
+ commentObj
649
+ ];
650
+ } else c === BS ? esc = !0 : '$' === c ? out += parseEnvVar() : out += c;
651
+ }
652
+ return isGlob ? {
653
+ op: 'glob',
654
+ pattern: out
655
+ } : out;
656
+ }
657
+ function parseEnvVar() {
658
+ i += 1;
659
+ var env1, key, r, varend, varname, char = s.charAt(i);
660
+ if ('{' === char) {
661
+ if (i += 1, '}' === s.charAt(i)) throw Error('Bad substitution: ' + s.slice(i - 2, i + 1));
662
+ if ((varend = s.indexOf('}', i)) < 0) throw Error('Bad substitution: ' + s.slice(i));
663
+ varname = s.slice(i, varend), i = varend;
664
+ } else if (/[*@#?$!_-]/.test(char)) varname = char, i += 1;
665
+ else {
666
+ var slicedFromI = s.slice(i);
667
+ (varend = slicedFromI.match(/[^\w\d_]/)) ? (varname = slicedFromI.slice(0, varend.index), i += varend.index - 1) : (varname = slicedFromI, i = s.length);
668
+ }
669
+ return env1 = env, key = varname, (void 0 === (r = 'function' == typeof env1 ? env1(key) : env1[key]) && '' != key ? r = '' : void 0 === r && (r = '$'), 'object' == typeof r) ? '' + TOKEN + JSON.stringify(r) + TOKEN : '' + r;
670
+ }
671
+ }).reduce(function(prev, arg) {
672
+ return void 0 === arg ? prev : prev.concat(arg);
673
+ }, []);
674
+ }(s, env, opts);
675
+ return 'function' != typeof env ? mapped : mapped.reduce(function(acc, s) {
676
+ if ('object' == typeof s) return acc.concat(s);
677
+ var xs = s.split(RegExp('(' + TOKEN + '.*?' + TOKEN + ')', 'g'));
678
+ return 1 === xs.length ? acc.concat(xs[0]) : acc.concat(xs.filter(Boolean).map(function(x) {
679
+ return startsWithToken.test(x) ? JSON.parse(x.split(TOKEN)[1]) : x;
680
+ }));
681
+ }, []);
682
+ };
683
+ },
684
+ "../../node_modules/.pnpm/shell-quote@1.8.3/node_modules/shell-quote/quote.js" (module) {
685
+ module.exports = function(xs) {
686
+ return xs.map(function(s) {
687
+ return '' === s ? '\'\'' : s && 'object' == typeof s ? s.op.replace(/(.)/g, '\\$1') : /["\s\\]/.test(s) && !/'/.test(s) ? "'" + s.replace(/(['])/g, '\\$1') + "'" : /["'\s]/.test(s) ? '"' + s.replace(/(["\\$`!])/g, '\\$1') + '"' : String(s).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g, '$1\\$2');
688
+ }).join(' ');
689
+ };
690
+ },
691
+ "../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/index.js" (__unused_rspack_module, exports, __webpack_require__) {
692
+ var __read = this && this.__read || function(o, n) {
693
+ var m = "function" == typeof Symbol && o[Symbol.iterator];
694
+ if (!m) return o;
695
+ var r, e, i = m.call(o), ar = [];
696
+ try {
697
+ for(; (void 0 === n || n-- > 0) && !(r = i.next()).done;)ar.push(r.value);
698
+ } catch (error) {
699
+ e = {
700
+ error: error
701
+ };
702
+ } finally{
703
+ try {
704
+ r && !r.done && (m = i.return) && m.call(i);
705
+ } finally{
706
+ if (e) throw e.error;
707
+ }
708
+ }
709
+ return ar;
710
+ }, __spreadArray = this && this.__spreadArray || function(to, from, pack) {
711
+ if (pack || 2 == arguments.length) for(var ar, i = 0, l = from.length; i < l; i++)!ar && i in from || (ar || (ar = Array.prototype.slice.call(from, 0, i)), ar[i] = from[i]);
712
+ return to.concat(ar || Array.prototype.slice.call(from));
713
+ }, __importDefault = this && this.__importDefault || function(mod) {
714
+ return mod && mod.__esModule ? mod : {
715
+ default: mod
716
+ };
717
+ };
718
+ Object.defineProperty(exports, "__esModule", {
719
+ value: !0
720
+ }), exports.unique = exports.mergeWithRules = exports.mergeWithCustomize = exports.default = exports.merge = exports.CustomizeRule = exports.customizeObject = exports.customizeArray = void 0;
721
+ var wildcard_1 = __importDefault(__webpack_require__("../../node_modules/.pnpm/wildcard@2.0.1/node_modules/wildcard/index.js")), merge_with_1 = __importDefault(__webpack_require__("../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/merge-with.js")), join_arrays_1 = __importDefault(__webpack_require__("../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/join-arrays.js"));
722
+ exports.unique = __importDefault(__webpack_require__("../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/unique.js")).default;
723
+ var types_1 = __webpack_require__("../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/types.js");
724
+ Object.defineProperty(exports, "CustomizeRule", {
725
+ enumerable: !0,
726
+ get: function() {
727
+ return types_1.CustomizeRule;
728
+ }
729
+ });
730
+ var utils_1 = __webpack_require__("../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/utils.js");
731
+ function merge(firstConfiguration) {
732
+ for(var configurations = [], _i = 1; _i < arguments.length; _i++)configurations[_i - 1] = arguments[_i];
733
+ return mergeWithCustomize({}).apply(void 0, __spreadArray([
734
+ firstConfiguration
735
+ ], __read(configurations), !1));
736
+ }
737
+ function mergeWithCustomize(options) {
738
+ return function(firstConfiguration) {
739
+ for(var configurations = [], _i = 1; _i < arguments.length; _i++)configurations[_i - 1] = arguments[_i];
740
+ if ((0, utils_1.isUndefined)(firstConfiguration) || configurations.some(utils_1.isUndefined)) throw TypeError("Merging undefined is not supported");
741
+ if (firstConfiguration.then) throw TypeError("Promises are not supported");
742
+ if (!firstConfiguration) return {};
743
+ if (0 === configurations.length) {
744
+ if (Array.isArray(firstConfiguration)) {
745
+ if (0 === firstConfiguration.length) return {};
746
+ if (firstConfiguration.some(utils_1.isUndefined)) throw TypeError("Merging undefined is not supported");
747
+ if (firstConfiguration[0].then) throw TypeError("Promises are not supported");
748
+ return (0, merge_with_1.default)(firstConfiguration, (0, join_arrays_1.default)(options));
749
+ }
750
+ return firstConfiguration;
751
+ }
752
+ return (0, merge_with_1.default)([
753
+ firstConfiguration
754
+ ].concat(configurations), (0, join_arrays_1.default)(options));
755
+ };
756
+ }
757
+ exports.merge = merge, exports.default = merge, exports.mergeWithCustomize = mergeWithCustomize, exports.customizeArray = function(rules) {
758
+ return function(a, b, key) {
759
+ var matchedRule = Object.keys(rules).find(function(rule) {
760
+ return (0, wildcard_1.default)(rule, key);
761
+ }) || "";
762
+ if (matchedRule) switch(rules[matchedRule]){
763
+ case types_1.CustomizeRule.Prepend:
764
+ return __spreadArray(__spreadArray([], __read(b), !1), __read(a), !1);
765
+ case types_1.CustomizeRule.Replace:
766
+ return b;
767
+ case types_1.CustomizeRule.Append:
768
+ default:
769
+ return __spreadArray(__spreadArray([], __read(a), !1), __read(b), !1);
770
+ }
771
+ };
772
+ }, exports.mergeWithRules = function(rules) {
773
+ return mergeWithCustomize({
774
+ customizeArray: function(a, b, key) {
775
+ var currentRule = rules;
776
+ return (key.split(".").forEach(function(k) {
777
+ currentRule && (currentRule = currentRule[k]);
778
+ }), (0, utils_1.isPlainObject)(currentRule)) ? function mergeWithRule(_a) {
779
+ var currentRule = _a.currentRule, a = _a.a, b = _a.b;
780
+ if (!isArray(a)) return a;
781
+ var bAllMatches = [];
782
+ return a.map(function(ao) {
783
+ if (!(0, utils_1.isPlainObject)(currentRule)) return ao;
784
+ var ret = {}, rulesToMatch = [], operations = {};
785
+ Object.entries(currentRule).forEach(function(_a) {
786
+ var _b = __read(_a, 2), k = _b[0], v = _b[1];
787
+ v === types_1.CustomizeRule.Match ? rulesToMatch.push(k) : operations[k] = v;
788
+ });
789
+ var bMatches = b.filter(function(o) {
790
+ var matches = rulesToMatch.every(function(rule) {
791
+ return (0, utils_1.isSameCondition)(ao[rule], o[rule]);
792
+ });
793
+ return matches && bAllMatches.push(o), matches;
794
+ });
795
+ return (0, utils_1.isPlainObject)(ao) ? (Object.entries(ao).forEach(function(_a) {
796
+ var _b = __read(_a, 2), k = _b[0], v = _b[1];
797
+ switch(currentRule[k]){
798
+ case types_1.CustomizeRule.Match:
799
+ ret[k] = v, Object.entries(currentRule).forEach(function(_a) {
800
+ var _b = __read(_a, 2), k = _b[0];
801
+ if (_b[1] === types_1.CustomizeRule.Replace && bMatches.length > 0) {
802
+ var val = last(bMatches)[k];
803
+ void 0 !== val && (ret[k] = val);
804
+ }
805
+ });
806
+ break;
807
+ case types_1.CustomizeRule.Append:
808
+ if (!bMatches.length) {
809
+ ret[k] = v;
810
+ break;
811
+ }
812
+ var appendValue = last(bMatches)[k];
813
+ if (!isArray(v) || !isArray(appendValue)) throw TypeError("Trying to append non-arrays");
814
+ ret[k] = v.concat(appendValue);
815
+ break;
816
+ case types_1.CustomizeRule.Merge:
817
+ if (!bMatches.length) {
818
+ ret[k] = v;
819
+ break;
820
+ }
821
+ var lastValue = last(bMatches)[k];
822
+ if (!(0, utils_1.isPlainObject)(v) || !(0, utils_1.isPlainObject)(lastValue)) throw TypeError("Trying to merge non-objects");
823
+ ret[k] = merge(v, lastValue);
824
+ break;
825
+ case types_1.CustomizeRule.Prepend:
826
+ if (!bMatches.length) {
827
+ ret[k] = v;
828
+ break;
829
+ }
830
+ var prependValue = last(bMatches)[k];
831
+ if (!isArray(v) || !isArray(prependValue)) throw TypeError("Trying to prepend non-arrays");
832
+ ret[k] = prependValue.concat(v);
833
+ break;
834
+ case types_1.CustomizeRule.Replace:
835
+ ret[k] = bMatches.length > 0 ? last(bMatches)[k] : v;
836
+ break;
837
+ default:
838
+ var currentRule_1 = operations[k], b_1 = bMatches.map(function(o) {
839
+ return o[k];
840
+ }).reduce(function(acc, val) {
841
+ return isArray(acc) && isArray(val) ? __spreadArray(__spreadArray([], __read(acc), !1), __read(val), !1) : acc;
842
+ }, []);
843
+ ret[k] = mergeWithRule({
844
+ currentRule: currentRule_1,
845
+ a: v,
846
+ b: b_1
847
+ });
848
+ }
849
+ }), ret) : ao;
850
+ }).concat(b.filter(function(o) {
851
+ return !bAllMatches.includes(o);
852
+ }));
853
+ }({
854
+ currentRule: currentRule,
855
+ a: a,
856
+ b: b
857
+ }) : "string" == typeof currentRule ? function(_a) {
858
+ var currentRule = _a.currentRule, a = _a.a, b = _a.b;
859
+ switch(currentRule){
860
+ case types_1.CustomizeRule.Append:
861
+ return a.concat(b);
862
+ case types_1.CustomizeRule.Prepend:
863
+ return b.concat(a);
864
+ case types_1.CustomizeRule.Replace:
865
+ return b;
866
+ }
867
+ return a;
868
+ }({
869
+ currentRule: currentRule,
870
+ a: a,
871
+ b: b
872
+ }) : void 0;
873
+ }
874
+ });
875
+ };
876
+ var isArray = Array.isArray;
877
+ function last(arr) {
878
+ return arr[arr.length - 1];
879
+ }
880
+ exports.customizeObject = function(rules) {
881
+ return function(a, b, key) {
882
+ switch(rules[key]){
883
+ case types_1.CustomizeRule.Prepend:
884
+ return (0, merge_with_1.default)([
885
+ b,
886
+ a
887
+ ], (0, join_arrays_1.default)());
888
+ case types_1.CustomizeRule.Replace:
889
+ return b;
890
+ case types_1.CustomizeRule.Append:
891
+ return (0, merge_with_1.default)([
892
+ a,
893
+ b
894
+ ], (0, join_arrays_1.default)());
895
+ }
896
+ };
897
+ };
898
+ },
899
+ "../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/join-arrays.js" (__unused_rspack_module, exports, __webpack_require__) {
900
+ var __read = this && this.__read || function(o, n) {
901
+ var m = "function" == typeof Symbol && o[Symbol.iterator];
902
+ if (!m) return o;
903
+ var r, e, i = m.call(o), ar = [];
904
+ try {
905
+ for(; (void 0 === n || n-- > 0) && !(r = i.next()).done;)ar.push(r.value);
906
+ } catch (error) {
907
+ e = {
908
+ error: error
909
+ };
910
+ } finally{
911
+ try {
912
+ r && !r.done && (m = i.return) && m.call(i);
913
+ } finally{
914
+ if (e) throw e.error;
915
+ }
916
+ }
917
+ return ar;
918
+ }, __spreadArray = this && this.__spreadArray || function(to, from, pack) {
919
+ if (pack || 2 == arguments.length) for(var ar, i = 0, l = from.length; i < l; i++)!ar && i in from || (ar || (ar = Array.prototype.slice.call(from, 0, i)), ar[i] = from[i]);
920
+ return to.concat(ar || Array.prototype.slice.call(from));
921
+ }, __importDefault = this && this.__importDefault || function(mod) {
922
+ return mod && mod.__esModule ? mod : {
923
+ default: mod
924
+ };
925
+ };
926
+ Object.defineProperty(exports, "__esModule", {
927
+ value: !0
928
+ });
929
+ var clone_deep_1 = __importDefault(__webpack_require__("../../node_modules/.pnpm/clone-deep@4.0.1/node_modules/clone-deep/index.js")), merge_with_1 = __importDefault(__webpack_require__("../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/merge-with.js")), utils_1 = __webpack_require__("../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/utils.js"), isArray = Array.isArray;
930
+ exports.default = function joinArrays(_a) {
931
+ var _b = void 0 === _a ? {} : _a, customizeArray = _b.customizeArray, customizeObject = _b.customizeObject, key = _b.key;
932
+ return function _joinArrays(a, b, k) {
933
+ var newKey = key ? "".concat(key, ".").concat(k) : k;
934
+ if ((0, utils_1.isFunction)(a) && (0, utils_1.isFunction)(b)) return function() {
935
+ for(var args = [], _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i];
936
+ return _joinArrays(a.apply(void 0, __spreadArray([], __read(args), !1)), b.apply(void 0, __spreadArray([], __read(args), !1)), k);
937
+ };
938
+ if (isArray(a) && isArray(b)) {
939
+ var customResult = customizeArray && customizeArray(a, b, newKey);
940
+ return customResult || __spreadArray(__spreadArray([], __read(a), !1), __read(b), !1);
941
+ }
942
+ if ((0, utils_1.isRegex)(b)) return b;
943
+ if ((0, utils_1.isPlainObject)(a) && (0, utils_1.isPlainObject)(b)) {
944
+ var customResult = customizeObject && customizeObject(a, b, newKey);
945
+ return customResult || (0, merge_with_1.default)([
946
+ a,
947
+ b
948
+ ], joinArrays({
949
+ customizeArray: customizeArray,
950
+ customizeObject: customizeObject,
951
+ key: newKey
952
+ }));
953
+ }
954
+ return (0, utils_1.isPlainObject)(b) ? (0, clone_deep_1.default)(b) : isArray(b) ? __spreadArray([], __read(b), !1) : b;
955
+ };
956
+ };
957
+ },
958
+ "../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/merge-with.js" (__unused_rspack_module, exports) {
959
+ var __read = this && this.__read || function(o, n) {
960
+ var m = "function" == typeof Symbol && o[Symbol.iterator];
961
+ if (!m) return o;
962
+ var r, e, i = m.call(o), ar = [];
963
+ try {
964
+ for(; (void 0 === n || n-- > 0) && !(r = i.next()).done;)ar.push(r.value);
965
+ } catch (error) {
966
+ e = {
967
+ error: error
968
+ };
969
+ } finally{
970
+ try {
971
+ r && !r.done && (m = i.return) && m.call(i);
972
+ } finally{
973
+ if (e) throw e.error;
974
+ }
975
+ }
976
+ return ar;
977
+ };
978
+ Object.defineProperty(exports, "__esModule", {
979
+ value: !0
980
+ }), exports.default = function(objects, customizer) {
981
+ var _a = __read(objects), first = _a[0], rest = _a.slice(1), ret = first;
982
+ return rest.forEach(function(a) {
983
+ var a1, b, customizer1, ret1;
984
+ a1 = ret, b = a, customizer1 = customizer, ret1 = {}, Object.keys(a1).concat(Object.keys(b)).forEach(function(k) {
985
+ var v = customizer1(a1[k], b[k], k);
986
+ ret1[k] = void 0 === v ? a1[k] : v;
987
+ }), ret = ret1;
988
+ }), ret;
989
+ };
990
+ },
991
+ "../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/types.js" (__unused_rspack_module, exports) {
992
+ var CustomizeRule, CustomizeRule1;
993
+ Object.defineProperty(exports, "__esModule", {
994
+ value: !0
995
+ }), exports.CustomizeRule = void 0, (CustomizeRule1 = CustomizeRule || (exports.CustomizeRule = CustomizeRule = {})).Match = "match", CustomizeRule1.Merge = "merge", CustomizeRule1.Append = "append", CustomizeRule1.Prepend = "prepend", CustomizeRule1.Replace = "replace";
996
+ },
997
+ "../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/unique.js" (__unused_rspack_module, exports) {
998
+ var __read = this && this.__read || function(o, n) {
999
+ var m = "function" == typeof Symbol && o[Symbol.iterator];
1000
+ if (!m) return o;
1001
+ var r, e, i = m.call(o), ar = [];
1002
+ try {
1003
+ for(; (void 0 === n || n-- > 0) && !(r = i.next()).done;)ar.push(r.value);
1004
+ } catch (error) {
1005
+ e = {
1006
+ error: error
1007
+ };
1008
+ } finally{
1009
+ try {
1010
+ r && !r.done && (m = i.return) && m.call(i);
1011
+ } finally{
1012
+ if (e) throw e.error;
1013
+ }
1014
+ }
1015
+ return ar;
1016
+ }, __spreadArray = this && this.__spreadArray || function(to, from, pack) {
1017
+ if (pack || 2 == arguments.length) for(var ar, i = 0, l = from.length; i < l; i++)!ar && i in from || (ar || (ar = Array.prototype.slice.call(from, 0, i)), ar[i] = from[i]);
1018
+ return to.concat(ar || Array.prototype.slice.call(from));
1019
+ };
1020
+ Object.defineProperty(exports, "__esModule", {
1021
+ value: !0
1022
+ }), exports.default = function(key, uniques, getter) {
1023
+ var uniquesSet = new Set(uniques);
1024
+ return function(a, b, k) {
1025
+ return k === key && Array.from(__spreadArray(__spreadArray([], __read(a), !1), __read(b), !1).map(function(it) {
1026
+ return {
1027
+ key: getter(it),
1028
+ value: it
1029
+ };
1030
+ }).map(function(_a) {
1031
+ var key = _a.key, value = _a.value;
1032
+ return {
1033
+ key: uniquesSet.has(key) ? key : value,
1034
+ value: value
1035
+ };
1036
+ }).reduce(function(m, _a) {
1037
+ var key = _a.key, value = _a.value;
1038
+ return m.delete(key), m.set(key, value);
1039
+ }, new Map()).values());
1040
+ };
1041
+ };
1042
+ },
1043
+ "../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/utils.js" (__unused_rspack_module, exports, __webpack_require__) {
1044
+ var __read = this && this.__read || function(o, n) {
1045
+ var m = "function" == typeof Symbol && o[Symbol.iterator];
1046
+ if (!m) return o;
1047
+ var r, e, i = m.call(o), ar = [];
1048
+ try {
1049
+ for(; (void 0 === n || n-- > 0) && !(r = i.next()).done;)ar.push(r.value);
1050
+ } catch (error) {
1051
+ e = {
1052
+ error: error
1053
+ };
1054
+ } finally{
1055
+ try {
1056
+ r && !r.done && (m = i.return) && m.call(i);
1057
+ } finally{
1058
+ if (e) throw e.error;
1059
+ }
1060
+ }
1061
+ return ar;
1062
+ };
1063
+ Object.defineProperty(exports, "__esModule", {
1064
+ value: !0
1065
+ }), exports.isSameCondition = exports.isUndefined = exports.isPlainObject = exports.isFunction = exports.isRegex = void 0;
1066
+ var flat_1 = __webpack_require__("../../node_modules/.pnpm/flat@5.0.2/node_modules/flat/index.js");
1067
+ function isRegex(o) {
1068
+ return o instanceof RegExp;
1069
+ }
1070
+ function isFunction(functionToCheck) {
1071
+ return functionToCheck && "[object Function]" === ({}).toString.call(functionToCheck);
1072
+ }
1073
+ exports.isRegex = isRegex, exports.isFunction = isFunction, exports.isPlainObject = function(a) {
1074
+ return !(null === a || Array.isArray(a)) && "object" == typeof a;
1075
+ }, exports.isUndefined = function(a) {
1076
+ return void 0 === a;
1077
+ }, exports.isSameCondition = function(a, b) {
1078
+ if (!a || !b) return a === b;
1079
+ if ("string" == typeof a || "string" == typeof b || isRegex(a) || isRegex(b) || isFunction(a) || isFunction(b)) return a.toString() === b.toString();
1080
+ var _a, _b, entriesA = Object.entries((0, flat_1.flatten)(a)), entriesB = Object.entries((0, flat_1.flatten)(b));
1081
+ if (entriesA.length !== entriesB.length) return !1;
1082
+ for(var i = 0; i < entriesA.length; i++)entriesA[i][0] = entriesA[i][0].replace(/\b\d+\b/g, "[]"), entriesB[i][0] = entriesB[i][0].replace(/\b\d+\b/g, "[]");
1083
+ function cmp(_a, _b) {
1084
+ var _c = __read(_a, 2), k1 = _c[0], v1 = _c[1], _d = __read(_b, 2), k2 = _d[0], v2 = _d[1];
1085
+ return k1 < k2 ? -1 : k1 > k2 ? 1 : v1 < v2 ? -1 : +(v1 > v2);
1086
+ }
1087
+ if (entriesA.sort(cmp), entriesB.sort(cmp), entriesA.length !== entriesB.length) return !1;
1088
+ for(var i = 0; i < entriesA.length; i++)if (entriesA[i][0] !== entriesB[i][0] || (null == (_a = entriesA[i][1]) ? void 0 : _a.toString()) !== (null == (_b = entriesB[i][1]) ? void 0 : _b.toString())) return !1;
1089
+ return !0;
1090
+ };
29
1091
  },
30
- "compiled/webpack-merge" (module) {
31
- module.exports = __rspack_external__compiled_webpack_merge_index_js_efd91626;
1092
+ "../../node_modules/.pnpm/wildcard@2.0.1/node_modules/wildcard/index.js" (module) {
1093
+ var REGEXP_PARTS = /(\*|\?)/g;
1094
+ function WildcardMatcher(text, separator) {
1095
+ this.text = text = text || '', this.hasWild = text.indexOf('*') >= 0, this.separator = separator, this.parts = text.split(separator).map(this.classifyPart.bind(this));
1096
+ }
1097
+ WildcardMatcher.prototype.match = function(input) {
1098
+ var ii, testParts, matches = !0, parts = this.parts, partsCount = parts.length;
1099
+ if ('string' == typeof input || input instanceof String) if (this.hasWild || this.text == input) {
1100
+ for(ii = 0, testParts = (input || '').split(this.separator); matches && ii < partsCount; ii++)if ('*' === parts[ii]) continue;
1101
+ else matches = ii < testParts.length && (parts[ii] instanceof RegExp ? parts[ii].test(testParts[ii]) : parts[ii] === testParts[ii]);
1102
+ matches = matches && testParts;
1103
+ } else matches = !1;
1104
+ else if ('function' == typeof input.splice) for(matches = [], ii = input.length; ii--;)this.match(input[ii]) && (matches[matches.length] = input[ii]);
1105
+ else if ('object' == typeof input) for(var key in matches = {}, input)this.match(key) && (matches[key] = input[key]);
1106
+ return matches;
1107
+ }, WildcardMatcher.prototype.classifyPart = function(part) {
1108
+ if ('*' === part) ;
1109
+ else if (part.indexOf('*') >= 0 || part.indexOf('?') >= 0) return new RegExp(part.replace(REGEXP_PARTS, '\.$1'));
1110
+ return part;
1111
+ }, module.exports = function(text, test, separator) {
1112
+ var matcher = new WildcardMatcher(text, separator || /[\/\.]/);
1113
+ return void 0 !== test ? matcher.match(test) : matcher;
1114
+ };
1115
+ },
1116
+ child_process (module) {
1117
+ module.exports = __rspack_external_child_process;
1118
+ },
1119
+ fs (module) {
1120
+ module.exports = __rspack_external_fs;
1121
+ },
1122
+ os (module) {
1123
+ module.exports = __rspack_external_os;
1124
+ },
1125
+ path (module) {
1126
+ module.exports = __rspack_external_path;
1127
+ },
1128
+ url (module) {
1129
+ module.exports = __rspack_external_url;
32
1130
  }
33
1131
  });
34
1132
  let isCI = !!process.env.CI, isTTY = !!process.stdout?.isTTY, noColor = !!process.env.NO_COLOR, forceColor = !!process.env.FORCE_COLOR, disableColor = !1;
@@ -119,9 +1217,9 @@ let CSS_MODULES_LOCAL_IDENT_NAME = '[path][name]__[local]--[hash:5]', CSS_MODULE
119
1217
  <body>
120
1218
  <div id="${mountId}"></div>
121
1219
  </body>
122
- </html>`, JS_REGEX = /\.[jt]s$/, JSX_REGEX = /\.[jt]sx$/, SCRIPT_REGEX = /\.[jt]sx?$/;
1220
+ </html>`, JS_REGEX = /\.[jt]s$/, JSX_REGEX = /\.[jt]sx$/, SCRIPT_REGEX = /\.[jt]sx?$/, CSS_REGEX = /\.css$/i, LESS_REGEX = /\.less$/i, SASS_REGEX = /\.s[ac]ss$/i;
123
1221
  var utils_dirname = __rspack_dirname(__rspack_fileURLToPath(import.meta.url));
124
- let { merge: utils_mergeConfig } = __webpack_require__("compiled/webpack-merge"), { default: launchEditor } = __webpack_require__("compiled/launch-editor"), getNodeEnv = ()=>process.env.NODE_ENV, setNodeEnv = (env)=>{
1222
+ let getNodeEnv = ()=>process.env.NODE_ENV, setNodeEnv = (env)=>{
125
1223
  process.env.NODE_ENV = env;
126
1224
  }, setDevServer = (isDevServer)=>{
127
1225
  process.env.DEV_SERVER = isDevServer ? 'true' : 'false';
@@ -540,6 +1638,8 @@ let removeDir = (dir)=>{
540
1638
  currentUnpackConfig = config;
541
1639
  }, unpackStartTime = 0, getUnpackStartTime = ()=>unpackStartTime, setUnpackStartTime = (time)=>{
542
1640
  unpackStartTime = time;
1641
+ }, getDevServerPort = ()=>devServerPort, setDevServerPort = (port)=>{
1642
+ devServerPort = port;
543
1643
  }, STYLE_IMPORT_RE = /import\s+((?:(?!\nimport\s)[\s\S])*?)\s+from\s+(['"])([^'"]+?\.(?:css|less|scss|sass)(?:\?[^'"]+)?(?:#[^'"]+)?)\2/g, TYPE_IMPORT_CLAUSE_RE = /^\s*type\b/, STYLE_EXT_HINTS = [
544
1644
  '.css',
545
1645
  '.less',
@@ -657,7 +1757,18 @@ let COMPRESSIBLE_REGEX = /\.(?:js|css|html|json|svg|txt|xml|xhtml|wasm|manifest|
657
1757
  if ('function' == typeof symbolId) return symbolId(name, filePath);
658
1758
  let id = (symbolId || 'icon-[dir]-[name]').replace(/\[name\]/g, name).replace(/\[dir\]/g, dir);
659
1759
  return id.replace(/--+/g, '-').replace(/^-+|-+$/g, '');
660
- }, UNOCSS_CONFIG_FILES = [
1760
+ }, BROWSERSLIST_CONFIG_FILES = [
1761
+ '.browserslistrc',
1762
+ '.browserslistrc.json',
1763
+ '.browserslistrc.yaml',
1764
+ '.browserslistrc.yml',
1765
+ 'browserslist',
1766
+ 'browserslist.config.js',
1767
+ 'browserslist.config.cjs',
1768
+ 'browserslist.config.mjs'
1769
+ ], dist = __webpack_require__("../../node_modules/.pnpm/webpack-merge@6.0.1/node_modules/webpack-merge/dist/index.js");
1770
+ var dist_default = __webpack_require__.n(dist), dist_default_0 = dist_default();
1771
+ let UNOCSS_CONFIG_FILES = [
661
1772
  'unocss.config.mjs',
662
1773
  'unocss.config.ts',
663
1774
  'unocss.config.js',
@@ -670,10 +1781,12 @@ let COMPRESSIBLE_REGEX = /\.(?:js|css|html|json|svg|txt|xml|xhtml|wasm|manifest|
670
1781
  if (!view) return (css)=>css;
671
1782
  let prefix = {};
672
1783
  return view.trim().replace(/(\\*)\\(["'`\\])/g, (_, bs, char)=>(prefix[char] = bs.replace(/\\\\/g, '\\'), '')), (css)=>css.replace(/["'`\\]/g, (v)=>(prefix[v] || '') + v);
673
- }, DOTENV_LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
1784
+ }, DOTENV_LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm, TRANSFORM_TIMING_STORE = Symbol.for('unpack:transformTimingMap'), PLUGIN_CONTEXT_STORE = Symbol.for('unpack:pluginContextStore'), globalScope = globalThis;
1785
+ globalScope[TRANSFORM_TIMING_STORE] ??= new WeakMap(), globalScope[PLUGIN_CONTEXT_STORE] ??= new WeakMap();
1786
+ let flattenUnpackPlugins = ()=>getCurrentUnpackConfig().plugins?.flat(1 / 0) || [];
674
1787
  function getNormalizedPluginsByHook(hook) {
675
1788
  let pluginMap = new Map();
676
- (getCurrentUnpackConfig().plugins?.flat(1 / 0) || []).forEach((plugin)=>{
1789
+ flattenUnpackPlugins().forEach((plugin)=>{
677
1790
  plugin && ((plugin, hook)=>{
678
1791
  if (!plugin[hook]) return !1;
679
1792
  let apply = plugin.apply;
@@ -682,7 +1795,9 @@ function getNormalizedPluginsByHook(hook) {
682
1795
  mode: getNodeEnv(),
683
1796
  command: utils_isDevServer() ? 'dev' : 'build'
684
1797
  };
685
- return 'string' == typeof apply ? apply === env.command : !!apply(getCurrentUnpackConfig(), env);
1798
+ if ('string' == typeof apply) return apply === env.command;
1799
+ let config = getCurrentUnpackConfig(), context = createPluginContext(plugin);
1800
+ return !!apply.call(context, config, env);
686
1801
  })(plugin, hook) && pluginMap.set(plugin.name, plugin);
687
1802
  });
688
1803
  let normalizedPlugins = Array.from(pluginMap.values()), enforceOrder = (plugin)=>'pre' === plugin.enforce ? 0 : 'post' === plugin.enforce ? 2 : 1;
@@ -694,7 +1809,7 @@ function getNormalizedPluginsByHook(hook) {
694
1809
  return 0 !== diff ? diff : a.index - b.index;
695
1810
  }).map((item)=>item.plugin);
696
1811
  }
697
- let createPluginHookTimer = (plugin, hook)=>{
1812
+ let createPluginHookTimer = (pluginName, hook)=>{
698
1813
  let startTime = 0;
699
1814
  return {
700
1815
  start: ()=>{
@@ -702,22 +1817,40 @@ let createPluginHookTimer = (plugin, hook)=>{
702
1817
  },
703
1818
  end: ()=>{
704
1819
  let duration = performance.now() - startTime;
705
- logger_logger.debug(`${colors.magenta('[plugin]')} ${colors.cyan(plugin.name)} ${colors.blue(hook)} ${colors.dim('in')} ${colors.yellow(`${duration.toFixed(2)}ms`)}`);
1820
+ logger_logger.debug(`${colors.magenta('[plugin]')} ${colors.cyan(pluginName)} ${colors.blue(hook)} ${colors.dim('in')} ${colors.yellow(`${duration.toFixed(2)}ms`)}`);
706
1821
  }
707
1822
  };
708
- }, TRANSFORM_TIMING_STORE = Symbol.for('unpack:transformTimingMap'), globalScope = globalThis, transformTimingMap = globalScope[TRANSFORM_TIMING_STORE] ?? new WeakMap();
1823
+ }, transformTimingMap = globalScope[TRANSFORM_TIMING_STORE], pluginContextStore = globalScope[PLUGIN_CONTEXT_STORE], createPluginContext = (plugin)=>{
1824
+ let cached = pluginContextStore.get(plugin);
1825
+ if (cached) return cached;
1826
+ let context = {
1827
+ name: plugin.name,
1828
+ get port () {
1829
+ return getDevServerPort();
1830
+ },
1831
+ get cachePath () {
1832
+ return getCurrentUnpackConfig()._context.cachePath;
1833
+ },
1834
+ info: (msg)=>logger_logger.info(msg),
1835
+ warn: (msg)=>logger_logger.warn(msg),
1836
+ error: (msg)=>logger_logger.error(msg),
1837
+ debug: (msg)=>logger_logger.debug(msg),
1838
+ isPluginExists: (name)=>flattenUnpackPlugins().some((item)=>item && item.name === name)
1839
+ };
1840
+ return pluginContextStore.set(plugin, context), context;
1841
+ };
709
1842
  async function applyPluginsByHook(hook, runner) {
710
1843
  let shouldMeasure = 'processAssets' !== hook && 'transform' !== hook;
711
1844
  for (let plugin of getNormalizedPluginsByHook(hook)){
712
- let impl = plugin[hook];
1845
+ let impl = plugin[hook], context = createPluginContext(plugin);
713
1846
  if (!shouldMeasure) {
714
- await runner(impl, plugin);
1847
+ await runner(impl, context);
715
1848
  continue;
716
1849
  }
717
- let timer = createPluginHookTimer(plugin, hook);
1850
+ let timer = createPluginHookTimer(plugin.name, hook);
718
1851
  timer.start();
719
1852
  try {
720
- await runner(impl, plugin);
1853
+ await runner(impl, context);
721
1854
  } finally{
722
1855
  timer.end();
723
1856
  }
@@ -726,35 +1859,20 @@ async function applyPluginsByHook(hook, runner) {
726
1859
  function applyPluginsByHookSync(hook, runner) {
727
1860
  let shouldMeasure = 'processAssets' !== hook && 'transform' !== hook;
728
1861
  for (let plugin of getNormalizedPluginsByHook(hook)){
729
- let impl = plugin[hook];
1862
+ let impl = plugin[hook], context = createPluginContext(plugin);
730
1863
  if (!shouldMeasure) {
731
- runner(impl, plugin);
1864
+ runner(impl, context);
732
1865
  continue;
733
1866
  }
734
- let timer = createPluginHookTimer(plugin, hook);
1867
+ let timer = createPluginHookTimer(plugin.name, hook);
735
1868
  timer.start();
736
1869
  try {
737
- runner(impl, plugin);
1870
+ runner(impl, context);
738
1871
  } finally{
739
1872
  timer.end();
740
1873
  }
741
1874
  }
742
1875
  }
743
- async function applyBuildAnalyzeConfig({ config, unpackConfig }) {
744
- let { RsdoctorRspackPlugin } = await import("@rsdoctor/rspack-plugin");
745
- return config.plugins?.push(new RsdoctorRspackPlugin({
746
- linter: {
747
- rules: {
748
- 'ecma-version-check': [
749
- 'Warn',
750
- {
751
- targets: esVersionToBrowserslist(unpackConfig.build.target)
752
- }
753
- ]
754
- }
755
- }
756
- })), config.devtool = 'source-map', config;
757
- }
758
1876
  async function getBuildDependencies(root) {
759
1877
  let rootPackageJson = node_path.join(root, 'package.json'), browserslistConfig = node_path.join(root, '.browserslistrc'), tsconfigPath = node_path.join(root, 'tsconfig.json'), buildDependencies = {};
760
1878
  await isFileExists(rootPackageJson) && (buildDependencies.packageJson = [
@@ -782,7 +1900,7 @@ async function applyCacheConfig({ config, unpackConfig, envFilePaths }) {
782
1900
  let cacheConfig = isPlainObject(unpackConfig.performance.cache) ? unpackConfig.performance.cache : {}, buildDependencies = await getBuildDependencies(unpackConfig.root);
783
1901
  buildDependencies.userBuildDependencies = cacheConfig.buildDependencies || [], buildDependencies.envFilePaths = envFilePaths;
784
1902
  let cacheDirectory = node_path.resolve(unpackConfig.root, cacheConfig.cacheDirectory || `${unpackConfig._context.cachePath}/cache`, utils_isDevServer() ? 'dev' : 'build');
785
- return utils_mergeConfig(config, {
1903
+ return dist_default()(config, {
786
1904
  cache: {
787
1905
  type: 'persistent',
788
1906
  buildDependencies: Object.values(buildDependencies).flat(),
@@ -801,16 +1919,12 @@ async function getEntry(root, customEntry) {
801
1919
  }))[0], !node_fs.existsSync(entry)) throw Error('could not find entry file');
802
1920
  return entry;
803
1921
  }
804
- globalScope[TRANSFORM_TIMING_STORE] = transformTimingMap;
805
1922
  let getOutputFilename = ({ type, hash, async })=>{
806
1923
  let FILENAME = utils_isProd() && !1 !== hash ? PROD_DEFAULT_FILENAME : DEV_DEFAULT_FILENAME;
807
1924
  return async ? 'js' === type ? FILENAME.jsAsync : FILENAME.cssAsync : FILENAME[type];
808
1925
  }, getCssLoader = (unpackConfig)=>unpackConfig.css?.transformer === 'lightningcss' ? {
809
1926
  loader: 'builtin:lightningcss-loader',
810
- options: {
811
- targets: esVersionToBrowserslist(unpackConfig.build.target),
812
- ...unpackConfig.css?.lightningcssLoader
813
- }
1927
+ options: unpackConfig.css?.lightningcssLoader
814
1928
  } : {
815
1929
  loader: getCompiledPkgPath('postcss-loader'),
816
1930
  options: {
@@ -830,7 +1944,7 @@ let getOutputFilename = ({ type, hash, async })=>{
830
1944
  }
831
1945
  }), getLessLoader = (unpackConfig)=>({
832
1946
  loader: getCompiledPkgPath('less-loader'),
833
- options: utils_mergeConfig({
1947
+ options: dist_default()({
834
1948
  lessOptions: {
835
1949
  javascriptEnabled: !0
836
1950
  },
@@ -870,7 +1984,7 @@ class JsMinifyPlugin {
870
1984
  apply(compiler) {
871
1985
  let meta = JSON.stringify({
872
1986
  name: jsMinify_PLUGIN_NAME,
873
- version: "4.6.1",
1987
+ version: "4.7.1",
874
1988
  options: this.minifyOptions
875
1989
  });
876
1990
  compiler.hooks.compilation.tap(jsMinify_PLUGIN_NAME, (compilation)=>{
@@ -997,13 +2111,13 @@ class RegisterHooksPlugin {
997
2111
  virtualModulesPlugin.apply(compiler);
998
2112
  let resolveIdPlugins = getNormalizedPluginsByHook('resolveId'), loadPlugins = getNormalizedPluginsByHook('load'), resolveId = async (id, importer)=>{
999
2113
  for (let plugin of resolveIdPlugins){
1000
- let start = performance.now(), result = await plugin.resolveId(id, importer), duration = performance.now() - start;
2114
+ let context = createPluginContext(plugin), start = performance.now(), result = await plugin.resolveId.call(context, id, importer), duration = performance.now() - start;
1001
2115
  if (this.resolveIdTimings.set(plugin.name, (this.resolveIdTimings.get(plugin.name) || 0) + duration), 'string' == typeof result && result) return result;
1002
2116
  }
1003
2117
  return null;
1004
2118
  }, load = async (id)=>{
1005
2119
  for (let plugin of loadPlugins){
1006
- let start = performance.now(), result = await plugin.load(id), duration = performance.now() - start;
2120
+ let context = createPluginContext(plugin), start = performance.now(), result = await plugin.load.call(context, id), duration = performance.now() - start;
1007
2121
  if (this.loadTimings.set(plugin.name, (this.loadTimings.get(plugin.name) || 0) + duration), 'string' == typeof result) return result;
1008
2122
  }
1009
2123
  return null;
@@ -1019,8 +2133,8 @@ class RegisterHooksPlugin {
1019
2133
  null !== loaded && this.lastLoadedModules.get(resolvedId) !== loaded && (this.lastLoadedModules.set(resolvedId, loaded), virtualModulesPlugin.writeModule(resolvedId, loaded));
1020
2134
  });
1021
2135
  }), compiler.hooks.compile.tap(registerHooks_PLUGIN_NAME, ()=>{
1022
- this.isCompiling = !0, this.resolveIdTimings.clear(), this.loadTimings.clear(), applyPluginsByHookSync('buildStart', (impl)=>{
1023
- impl({
2136
+ this.isCompiling = !0, this.resolveIdTimings.clear(), this.loadTimings.clear(), applyPluginsByHookSync('buildStart', (impl, context)=>{
2137
+ impl.call(context, {
1024
2138
  compiler,
1025
2139
  isFirstCompile: this.isFirstCompile,
1026
2140
  isWatch: isDev()
@@ -1034,16 +2148,16 @@ class RegisterHooksPlugin {
1034
2148
  }
1035
2149
  };
1036
2150
  compiler.hooks.thisCompilation.tap(registerHooks_PLUGIN_NAME, (compilation)=>{
1037
- applyPluginsByHookSync('processAssets', (impl, plugin)=>{
2151
+ applyPluginsByHookSync('processAssets', (impl, context)=>{
1038
2152
  let { stage, handler } = impl;
1039
2153
  compilation.hooks.processAssets.tapPromise({
1040
2154
  name: registerHooks_PLUGIN_NAME,
1041
2155
  stage
1042
2156
  }, async (assets)=>{
1043
- let timer = createPluginHookTimer(plugin, 'processAssets');
2157
+ let timer = createPluginHookTimer(context.name, 'processAssets');
1044
2158
  timer.start();
1045
2159
  try {
1046
- await handler({
2160
+ await handler.call(context, {
1047
2161
  assets,
1048
2162
  compilation,
1049
2163
  sources: rspack.sources,
@@ -1055,8 +2169,8 @@ class RegisterHooksPlugin {
1055
2169
  });
1056
2170
  });
1057
2171
  }), compiler.hooks.compilation.tap(registerHooks_PLUGIN_NAME, (compilation)=>{
1058
- rspack.HtmlRspackPlugin.getCompilationHooks(compilation).beforeEmit.tapPromise(registerHooks_PLUGIN_NAME, async (data)=>(await applyPluginsByHook('transformHtml', async (impl)=>{
1059
- let result = await impl(data.html);
2172
+ rspack.HtmlRspackPlugin.getCompilationHooks(compilation).beforeEmit.tapPromise(registerHooks_PLUGIN_NAME, async (data)=>(await applyPluginsByHook('transformHtml', async (impl, context)=>{
2173
+ let result = await impl.call(context, data.html);
1060
2174
  data.html = 'string' == typeof result ? result : applyHtmlTagDescriptors(data.html, result);
1061
2175
  }), data));
1062
2176
  }), compiler.hooks.finishMake.tap(registerHooks_PLUGIN_NAME, (compilation)=>{
@@ -1068,8 +2182,8 @@ class RegisterHooksPlugin {
1068
2182
  transformTimingMap.delete(compilation);
1069
2183
  }
1070
2184
  }), compiler.hooks.done.tapPromise(registerHooks_PLUGIN_NAME, async (stats)=>{
1071
- await applyPluginsByHook('buildEnd', async (impl)=>{
1072
- await impl({
2185
+ await applyPluginsByHook('buildEnd', async (impl, context)=>{
2186
+ await impl.call(context, {
1073
2187
  compiler,
1074
2188
  isFirstCompile: this.isFirstCompile,
1075
2189
  isWatch: isDev(),
@@ -1083,43 +2197,13 @@ class RegisterHooksPlugin {
1083
2197
  });
1084
2198
  }
1085
2199
  }
1086
- async function applyTypeCheckConfig({ config, unpackConfig }) {
1087
- let { TsCheckerRspackPlugin } = await import("ts-checker-rspack-plugin"), tsconfigPath = node_path.resolve(unpackConfig.root, 'tsconfig.json');
1088
- return config.plugins?.push(new TsCheckerRspackPlugin({
1089
- typescript: {
1090
- mode: 'readonly',
1091
- memoryLimit: 8192,
1092
- configFile: tsconfigPath,
1093
- typescriptPath: require.resolve("typescript", {
1094
- paths: [
1095
- unpackConfig.root
1096
- ]
1097
- })
1098
- },
1099
- issue: {
1100
- exclude: [
1101
- ({ file = '' })=>NODE_MODULES_REGEX.test(file)
1102
- ]
1103
- },
1104
- logger: {
1105
- log (message) {
1106
- let count = +(/(\d+) errors?/.exec(message)?.[1] || 0);
1107
- count > 0 && console.log(`Found ${colors.red(colors.bold(`${count} ${1 === count ? 'error' : 'errors'}`))}`);
1108
- },
1109
- error (message) {
1110
- message.includes('RpcExitError') || message.includes('out of memory') || console.log(convertBasicAnsiColors(message.replace(/ERROR/g, 'Type Error')));
1111
- }
1112
- }
1113
- })), config;
1114
- }
1115
2200
  var rspack_config_dirname = __rspack_dirname(__rspack_fileURLToPath(import.meta.url));
1116
2201
  async function getRspackConfig(originalUnpackConfig) {
1117
2202
  setCurrentUnpackConfig(originalUnpackConfig);
1118
2203
  let { plugins, rspack: rspackConfig, ...rest } = originalUnpackConfig;
1119
- await applyPluginsByHook('config', async (impl)=>{
1120
- rest = await impl(rest, {
1121
- ...originalUnpackConfig._context,
1122
- mergeConfig: utils_mergeConfig
2204
+ await applyPluginsByHook('config', async (impl, context)=>{
2205
+ rest = await impl.call(context, rest, {
2206
+ mergeConfig: dist_default()
1123
2207
  });
1124
2208
  });
1125
2209
  let unpackConfig = {
@@ -1127,10 +2211,16 @@ async function getRspackConfig(originalUnpackConfig) {
1127
2211
  plugins,
1128
2212
  rspack: rspackConfig
1129
2213
  };
1130
- setCurrentUnpackConfig(unpackConfig), await applyPluginsByHook('configResolved', async (impl)=>{
1131
- await impl(unpackConfig, originalUnpackConfig._context);
2214
+ setCurrentUnpackConfig(unpackConfig), utils_isDevServer() && setDevServerPort(await getPort(unpackConfig.server?.port)), await applyPluginsByHook('configResolved', async (impl, context)=>{
2215
+ await impl.call(context, unpackConfig);
1132
2216
  });
1133
- let tsconfigPath = node_path.resolve(unpackConfig.root, 'tsconfig.json'), isTS = node_fs.existsSync(tsconfigPath), minifyOptions = isPlainObject(unpackConfig.build?.minify) ? unpackConfig.build?.minify : {}, { publicVars, filePaths: envFilePaths } = function({ cwd = process.cwd(), mode = getNodeEnv(), prefixes = [
2217
+ let tsconfigPath = node_path.resolve(unpackConfig.root, 'tsconfig.json'), isTS = node_fs.existsSync(tsconfigPath), minifyOptions = isPlainObject(unpackConfig.build?.minify) ? unpackConfig.build?.minify : {}, publicDir = node_path.resolve(unpackConfig.root, 'public'), shouldCopyPublic = node_fs.existsSync(publicDir) && node_fs.statSync(publicDir).isDirectory() && node_fs.readdirSync(publicDir).length > 0, copyPatterns = [
2218
+ ...unpackConfig.build?.copy || []
2219
+ ];
2220
+ shouldCopyPublic && copyPatterns.unshift({
2221
+ from: publicDir
2222
+ });
2223
+ let { publicVars, filePaths: envFilePaths } = function({ cwd = process.cwd(), mode = getNodeEnv(), prefixes = [
1134
2224
  'PUBLIC_'
1135
2225
  ], processEnv = process.env } = {}) {
1136
2226
  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.`);
@@ -1240,8 +2330,8 @@ async function getRspackConfig(originalUnpackConfig) {
1240
2330
  ...publicVars,
1241
2331
  ...unpackConfig.define
1242
2332
  }),
1243
- unpackConfig.build?.copy && new rspack.CopyRspackPlugin({
1244
- patterns: unpackConfig.build.copy
2333
+ copyPatterns.length > 0 && new rspack.CopyRspackPlugin({
2334
+ patterns: copyPatterns
1245
2335
  }),
1246
2336
  new RegisterHooksPlugin(),
1247
2337
  unpackConfig.build?.progressBar ? new ProgressPlugin() : new ProgressLitePlugin()
@@ -1286,16 +2376,8 @@ async function getRspackConfig(originalUnpackConfig) {
1286
2376
  moduleIds: isDev() ? 'named' : 'deterministic',
1287
2377
  minimize: !!unpackConfig.build?.minify && utils_isProd(),
1288
2378
  minimizer: [
1289
- new JsMinifyPlugin(utils_mergeConfig({
1290
- compress: {
1291
- target: unpackConfig.build.target
1292
- }
1293
- }, minifyOptions.oxc || {})),
1294
- new rspack.LightningCssMinimizerRspackPlugin(utils_mergeConfig({
1295
- minimizerOptions: {
1296
- targets: esVersionToBrowserslist(unpackConfig.build.target)
1297
- }
1298
- }, minifyOptions.lightningcss || {}))
2379
+ new JsMinifyPlugin(minifyOptions.oxc),
2380
+ new rspack.LightningCssMinimizerRspackPlugin(minifyOptions.lightningcss)
1299
2381
  ]
1300
2382
  },
1301
2383
  watchOptions: {
@@ -1305,7 +2387,7 @@ async function getRspackConfig(originalUnpackConfig) {
1305
2387
  hints: !1
1306
2388
  }
1307
2389
  };
1308
- return applyPluginsByHookSync('transform', (impl, plugin)=>{
2390
+ return applyPluginsByHookSync('transform', (impl, context)=>{
1309
2391
  let { filter, handler } = impl;
1310
2392
  config.module.rules.unshift({
1311
2393
  exclude: NODE_MODULES_REGEX,
@@ -1315,8 +2397,8 @@ async function getRspackConfig(originalUnpackConfig) {
1315
2397
  {
1316
2398
  loader: node_path.resolve(rspack_config_dirname, './transformLoader.js'),
1317
2399
  options: {
1318
- handler,
1319
- pluginName: plugin.name
2400
+ handler: (code, id)=>handler.call(context, code, id),
2401
+ pluginName: context.name
1320
2402
  }
1321
2403
  }
1322
2404
  ]
@@ -1367,15 +2449,15 @@ async function getRspackConfig(originalUnpackConfig) {
1367
2449
  ]
1368
2450
  };
1369
2451
  };
1370
- return config.module.rules.push(createStyleRule(/\.css$/i, [
2452
+ return config.module.rules.push(createStyleRule(CSS_REGEX, [
1371
2453
  getCssLoader(unpackConfig),
1372
2454
  unpackConfig.css?.tailwindcss && {
1373
2455
  loader: require.resolve('@tailwindcss/webpack')
1374
2456
  }
1375
- ])), config.module.rules.push(createStyleRule(/\.less$/i, [
2457
+ ])), config.module.rules.push(createStyleRule(LESS_REGEX, [
1376
2458
  getCssLoader(unpackConfig),
1377
2459
  getLessLoader(unpackConfig)
1378
- ])), config.module.rules.push(createStyleRule(/\.s[ac]ss$/i, [
2460
+ ])), config.module.rules.push(createStyleRule(SASS_REGEX, [
1379
2461
  getCssLoader(unpackConfig),
1380
2462
  getSassLoader(unpackConfig)
1381
2463
  ])), config;
@@ -1421,7 +2503,7 @@ async function getRspackConfig(originalUnpackConfig) {
1421
2503
  }),
1422
2504
  ignoreOrder: !0
1423
2505
  })), config.module.rules.push({
1424
- test: /\.less$/i,
2506
+ test: LESS_REGEX,
1425
2507
  use: [
1426
2508
  ...getCommonRules({
1427
2509
  importLoaders: 2
@@ -1430,7 +2512,7 @@ async function getRspackConfig(originalUnpackConfig) {
1430
2512
  getLessLoader(unpackConfig)
1431
2513
  ]
1432
2514
  }), config.module.rules.push({
1433
- test: /\.css$/i,
2515
+ test: CSS_REGEX,
1434
2516
  use: [
1435
2517
  ...getCommonRules({
1436
2518
  importLoaders: unpackConfig.css?.tailwindcss ? 2 : 1
@@ -1441,7 +2523,7 @@ async function getRspackConfig(originalUnpackConfig) {
1441
2523
  }
1442
2524
  ].filter(Boolean)
1443
2525
  }), config.module.rules.push({
1444
- test: /\.s[ac]ss$/i,
2526
+ test: SASS_REGEX,
1445
2527
  use: [
1446
2528
  ...getCommonRules({
1447
2529
  importLoaders: 2
@@ -1460,54 +2542,14 @@ async function getRspackConfig(originalUnpackConfig) {
1460
2542
  config,
1461
2543
  unpackConfig,
1462
2544
  envFilePaths
1463
- })), unpackConfig.performance?.buildAnalyze && utils_isProd() && (config = await applyBuildAnalyzeConfig({
1464
- config,
1465
- unpackConfig
1466
- })), unpackConfig.typeCheck && isDev() && isTS && (config = await applyTypeCheckConfig({
1467
- config,
1468
- unpackConfig
1469
- })), unpackConfig.detectCircular && (config = function({ config, unpackConfig }) {
1470
- let circularCount = 0, circularDependencyPlugin = new rspack.CircularDependencyRspackPlugin({
1471
- exclude: NODE_MODULES_REGEX,
1472
- onStart () {
1473
- circularCount = 0;
1474
- },
1475
- onDetected (_, modules) {
1476
- var paths;
1477
- let arrow, lastIndex;
1478
- circularCount++, logger_logger.warn('circular dependency detected:'), paths = modules.map((module)=>{
1479
- let filePath = module.replace(/^.*!/, ''), relativePath = node_path.relative(unpackConfig.root, filePath);
1480
- return relativePath.startsWith('..') ? filePath : relativePath;
1481
- }).slice(0, -1), console.log(''), arrow = colors.dim('↳ '), lastIndex = paths.length - 1, paths.forEach((p, i)=>{
1482
- switch(i){
1483
- case 0:
1484
- console.log(` ${p}`);
1485
- break;
1486
- case lastIndex:
1487
- console.log(` ${arrow}${p} ${colors.yellow(colors.dim('(cycle introduced)'))}`);
1488
- break;
1489
- default:
1490
- console.log(` ${arrow}${p}`);
1491
- }
1492
- }), console.log(` ${arrow}${paths[0]}`), console.log('');
1493
- },
1494
- onEnd () {
1495
- circularCount > 0 && console.log('Found', colors.yellow(colors.bold(`${circularCount} circular ${1 === circularCount ? 'dependency' : 'dependencies'}`)));
1496
- }
1497
- });
1498
- return config.plugins?.push(circularDependencyPlugin), config;
1499
- }({
1500
- config,
1501
- unpackConfig
1502
- })), await applyPluginsByHook('rspackConfig', async (impl)=>{
1503
- config = await impl(config, {
1504
- ...originalUnpackConfig._context,
2545
+ })), await applyPluginsByHook('rspackConfig', async (impl, context)=>{
2546
+ config = await impl.call(context, config, {
1505
2547
  unpackConfig,
1506
- mergeConfig: utils_mergeConfig
2548
+ mergeConfig: dist_default()
1507
2549
  });
1508
2550
  }), unpackConfig.rspack && (config = isFunction(unpackConfig.rspack) ? await unpackConfig.rspack(config, {
1509
- mergeConfig: utils_mergeConfig
1510
- }) : utils_mergeConfig(config, unpackConfig.rspack)), config;
2551
+ mergeConfig: dist_default()
2552
+ }) : dist_default()(config, unpackConfig.rspack)), config;
1511
2553
  }
1512
2554
  async function unpackBuild(unpackConfig) {
1513
2555
  let compiler = rspack(await getRspackConfig(unpackConfig)), handler = (err, stats)=>{
@@ -1585,8 +2627,8 @@ function execAsync(command, options) {
1585
2627
  });
1586
2628
  });
1587
2629
  }
1588
- async function unpackDev(unpackConfig) {
1589
- let compiler = rspack(await getRspackConfig(unpackConfig)), port = await getPort(unpackConfig.server?.port), proxyConfig = unpackConfig.server?.proxy;
2630
+ async function unpackDev(originalConfig) {
2631
+ let config = await getRspackConfig(originalConfig), unpackConfig = getCurrentUnpackConfig(), compiler = rspack(config), port = getDevServerPort(), proxyConfig = unpackConfig.server?.proxy;
1590
2632
  isPlainObject(proxyConfig) && (proxyConfig = Object.entries(proxyConfig).map(([contextStr, target])=>{
1591
2633
  let baseConfig = {
1592
2634
  context: contextStr.split(','),
@@ -1614,8 +2656,8 @@ async function unpackDev(unpackConfig) {
1614
2656
  },
1615
2657
  host: unpackConfig.server?.host ? ALL_INTERFACES_IPV4 : LOCALHOST
1616
2658
  }, pluginMiddlewares = [];
1617
- await applyPluginsByHook('setupMiddlewares', async (impl)=>{
1618
- pluginMiddlewares = await impl(pluginMiddlewares);
2659
+ await applyPluginsByHook('setupMiddlewares', async (impl, context)=>{
2660
+ pluginMiddlewares = await impl.call(context, pluginMiddlewares);
1619
2661
  }), devServerOptions.setupMiddlewares = (middlewares)=>(middlewares.unshift((req, _, next)=>{
1620
2662
  let accept = req.headers.accept;
1621
2663
  if ('string' == typeof accept && accept.includes('html')) {
@@ -1628,7 +2670,7 @@ async function unpackDev(unpackConfig) {
1628
2670
  ...middlewares
1629
2671
  ]);
1630
2672
  let server = new RspackDevServer(devServerOptions, compiler);
1631
- await server.start(), logger_logger.greet(` ${colors.brand(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v4.6.1`)} ${colors.dim('ready in')} ${colors.bold(Math.ceil(performance.now() - getUnpackStartTime()))} ${colors.dim('ms')}\n`), printServerUrls({
2673
+ await server.start(), logger_logger.greet(` ${colors.brand(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v4.7.1`)} ${colors.dim('ready in')} ${colors.bold(Math.ceil(performance.now() - getUnpackStartTime()))} ${colors.dim('ms')}\n`), printServerUrls({
1632
2674
  port,
1633
2675
  host: unpackConfig.server.host,
1634
2676
  base: unpackConfig.base
@@ -1642,10 +2684,10 @@ async function unpackDev(unpackConfig) {
1642
2684
  function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'unpack' }) {
1643
2685
  let _context = {
1644
2686
  callerName,
1645
- version: "4.6.1",
2687
+ version: "4.7.1",
1646
2688
  cachePath: 'node_modules/.unpack'
1647
2689
  }, resolveConfig = (mode)=>{
1648
- let rootPath, outputPath, basePath, cachedTraceMap, fs, isValidMethodName, parseFrame, formatOriginalLocation, formatFullStack, resolveErrorLocationAndStack, root, alias, shouldTransformDeepImport, preJsAssets, jsAssets, cssAssets, bundledDepsCachePath, deepImportPkgPattern, deepImportRegex, plugin, root1, uno, generated, configOrPathFromUnpackConfig, defaultsFromUnpackConfig, VIRTUAL_UNO_CSS_ID, rootDir, isMpa, unoConfig, configFilePath, unpackConfigPath, tokens, requestedLayers, tasks, unocssCacheDir, tokensCachePath, layersCachePath, timeCachePath, configHashCachePath, generatedCachePath, bundlerCacheDir, cachedTokensSize, cachedLayersSize, isCompiling, resolveUnocssConfig, flushTasks, getVirtualModuleContent, hash, restoreSkipCode, applyUnoTransformers, optionsFromUnpackConfig, rootPath1, registerCode, namesCode, defaultConfig = {
2690
+ let rootPath, outputPath, basePath, cachedTraceMap, fs, isValidMethodName, parseFrame, formatOriginalLocation, formatFullStack, resolveErrorLocationAndStack, root, alias, shouldTransformDeepImport, preJsAssets, jsAssets, cssAssets, bundledDepsCachePath, deepImportPkgPattern, deepImportRegex, plugin, tsconfigPath, root1, uno, generated, configOrPath, defaults, VIRTUAL_UNO_CSS_ID, rootDir, isMpa, unoConfig, configFilePath, unpackConfigPath, tokens, requestedLayers, tasks, unocssCacheDir, tokensCachePath, layersCachePath, timeCachePath, configHashCachePath, generatedCachePath, bundlerCacheDir, cachedTokensSize, cachedLayersSize, isCompiling, resolveUnocssConfig, flushTasks, getVirtualModuleContent, hash, restoreSkipCode, applyUnoTransformers, options, rootPath1, registerCode, namesCode, defaultConfig = {
1649
2691
  root: cwd,
1650
2692
  base: '/',
1651
2693
  sourceMap: 'production' !== mode && 'cheap-module-source-map',
@@ -1878,79 +2920,76 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
1878
2920
  `
1879
2921
  }
1880
2922
  ],
1881
- setupMiddlewares: (middlewares)=>[
1882
- (req, res, next)=>{
1883
- if ('POST' !== req.method || !req.url?.startsWith(BROWSER_LOGS_ENDPOINT)) return next();
1884
- let raw = '';
1885
- req.on('data', (chunk)=>{
1886
- raw += chunk.toString();
1887
- }), req.on('end', async ()=>{
1888
- try {
1889
- let { level, time, args = [] } = JSON.parse(raw || '{}'), formattedArgs = await Promise.all(args.map(async (item)=>{
1890
- if (!item) return '';
1891
- if ('error' === item.type) {
1892
- let { locationSuffix, stackString } = await resolveErrorLocationAndStack(item), msg = item.message || '', suffix = locationSuffix ? msg ? ` ${locationSuffix}` : locationSuffix : '';
1893
- return `${msg}${suffix}${stackString}`;
2923
+ setupMiddlewares: (middlewares)=>(middlewares.unshift((req, res, next)=>{
2924
+ if ('POST' !== req.method || !req.url?.startsWith(BROWSER_LOGS_ENDPOINT)) return next();
2925
+ let raw = '';
2926
+ req.on('data', (chunk)=>{
2927
+ raw += chunk.toString();
2928
+ }), req.on('end', async ()=>{
2929
+ try {
2930
+ let { level, time, args = [] } = JSON.parse(raw || '{}'), formattedArgs = await Promise.all(args.map(async (item)=>{
2931
+ if (!item) return '';
2932
+ if ('error' === item.type) {
2933
+ let { locationSuffix, stackString } = await resolveErrorLocationAndStack(item), msg = item.message || '', suffix = locationSuffix ? msg ? ` ${locationSuffix}` : locationSuffix : '';
2934
+ return `${msg}${suffix}${stackString}`;
2935
+ }
2936
+ switch(item.type){
2937
+ case 'string':
2938
+ let trimmed;
2939
+ return (trimmed = item.message.trim()) ? trimmed.split(/\r?\n/g).filter((line)=>{
2940
+ let normalized = line.trim().replace(/`/g, '');
2941
+ return !!normalized && !/^at\s+/.test(normalized);
2942
+ }).join('\n').trim() : '';
2943
+ case 'null':
2944
+ return null;
2945
+ case 'undefined':
2946
+ return;
2947
+ case 'object':
2948
+ return JSON.parse(item.message || '');
2949
+ default:
2950
+ return item.message;
2951
+ }
2952
+ })), outputArgs = ((args)=>{
2953
+ if (args.length < 2 || 'string' != typeof args[0]) return args;
2954
+ let template = args[0];
2955
+ if (!/%[sdifoOj%c%]/.test(template)) return args;
2956
+ let rest = args.slice(1), cleanedTemplate = '';
2957
+ for(let i = 0; i < template.length; i++){
2958
+ let ch = template[i];
2959
+ if ('%' !== ch || i + 1 >= template.length) {
2960
+ cleanedTemplate += ch;
2961
+ continue;
1894
2962
  }
1895
- switch(item.type){
1896
- case 'string':
1897
- let trimmed;
1898
- return (trimmed = item.message.trim()) ? trimmed.split(/\r?\n/g).filter((line)=>{
1899
- let normalized = line.trim().replace(/`/g, '');
1900
- return !!normalized && !/^at\s+/.test(normalized);
1901
- }).join('\n').trim() : '';
1902
- case 'null':
1903
- return null;
1904
- case 'undefined':
1905
- return;
1906
- case 'object':
1907
- return JSON.parse(item.message || '');
1908
- default:
1909
- return item.message;
2963
+ let next = template[i + 1];
2964
+ if ('%' === next) {
2965
+ cleanedTemplate += '%%', i++;
2966
+ continue;
1910
2967
  }
1911
- })), outputArgs = ((args)=>{
1912
- if (args.length < 2 || 'string' != typeof args[0]) return args;
1913
- let template = args[0];
1914
- if (!/%[sdifoOj%c%]/.test(template)) return args;
1915
- let rest = args.slice(1), cleanedTemplate = '';
1916
- for(let i = 0; i < template.length; i++){
1917
- let ch = template[i];
1918
- if ('%' !== ch || i + 1 >= template.length) {
1919
- cleanedTemplate += ch;
1920
- continue;
1921
- }
1922
- let next = template[i + 1];
1923
- if ('%' === next) {
1924
- cleanedTemplate += '%%', i++;
1925
- continue;
1926
- }
1927
- if ('c' === next) {
1928
- rest.length > 0 && rest.shift(), i++;
1929
- continue;
1930
- }
1931
- cleanedTemplate += `%${next}`, i++;
2968
+ if ('c' === next) {
2969
+ rest.length > 0 && rest.shift(), i++;
2970
+ continue;
1932
2971
  }
1933
- return [
1934
- format(cleanedTemplate, ...rest)
1935
- ];
1936
- })(formattedArgs), prefix = colors.dim(`[browser ${time}]`);
1937
- switch(level){
1938
- case 'error':
1939
- console.log(colors.red(`${prefix} ${format(...outputArgs)}`));
1940
- break;
1941
- case 'warn':
1942
- console.log(colors.yellow(`${prefix} ${format(...outputArgs)}`));
1943
- break;
1944
- case 'debug':
1945
- console.log(prefix, ...outputArgs);
2972
+ cleanedTemplate += `%${next}`, i++;
1946
2973
  }
1947
- } finally{
1948
- res.statusCode = 204, res.end();
2974
+ return [
2975
+ format(cleanedTemplate, ...rest)
2976
+ ];
2977
+ })(formattedArgs), prefix = colors.dim(`[browser ${time}]`);
2978
+ switch(level){
2979
+ case 'error':
2980
+ console.log(colors.red(`${prefix} ${format(...outputArgs)}`));
2981
+ break;
2982
+ case 'warn':
2983
+ console.log(colors.yellow(`${prefix} ${format(...outputArgs)}`));
2984
+ break;
2985
+ case 'debug':
2986
+ console.log(prefix, ...outputArgs);
1949
2987
  }
1950
- });
1951
- },
1952
- ...middlewares
1953
- ]
2988
+ } finally{
2989
+ res.statusCode = 204, res.end();
2990
+ }
2991
+ });
2992
+ }), middlewares)
1954
2993
  }),
1955
2994
  (root = '', alias = {}, {
1956
2995
  name: 'unpack:glob',
@@ -2040,14 +3079,14 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
2040
3079
  ].sort((a, b)=>b.length - a.length).map((name)=>name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|'), deepImportRegex = RegExp(`import\\s+([a-zA-Z0-9_$]+)\\s+from\\s+['"]((${deepImportPkgPattern})/[^'"]+)['"]`, 'g'), plugin = {
2041
3080
  name: 'unpack:prebundle',
2042
3081
  apply: (config, { command })=>'dev' === command && !!config.dev?.prebundle,
2043
- config: async (config, context)=>{
3082
+ async config (config) {
2044
3083
  var externals;
2045
3084
  let existExternals, root = config.root;
2046
- bundledDepsCachePath = node_path.resolve(root, context.cachePath, 'umd');
3085
+ bundledDepsCachePath = node_path.resolve(root, this.cachePath, 'umd');
2047
3086
  let count = {
2048
3087
  total: 0,
2049
3088
  bundled: 0
2050
- }, failedDepsJsonPath = node_path.resolve(root, context.cachePath, 'failed-deps.json'), failedDeps = [], failedCache = node_fs.existsSync(failedDepsJsonPath) ? JSON.parse(node_fs.readFileSync(failedDepsJsonPath, 'utf-8')) : {}, updateProgress = ()=>{
3089
+ }, failedDepsJsonPath = node_path.resolve(root, this.cachePath, 'failed-deps.json'), failedDeps = [], failedCache = node_fs.existsSync(failedDepsJsonPath) ? JSON.parse(node_fs.readFileSync(failedDepsJsonPath, 'utf-8')) : {}, updateProgress = ()=>{
2051
3090
  let errMsg = failedDeps.length > 0 ? ` failed: ${failedDeps.join(', ')}` : '';
2052
3091
  logUpdate(`${colors.magenta('»')} optimizing dependencies (${count.bundled}/${count.total})${errMsg}`), count.total === count.bundled + failedDeps.length && console.log();
2053
3092
  }, userOptions = isPlainObject(config.dev?.prebundle) ? config.dev.prebundle : {}, ignoreCSSDeps = userOptions.ignoreCSS || [], packageJson = JSON.parse(node_fs.readFileSync(node_path.resolve(root, 'package.json'), 'utf-8')), excludeDeps = [
@@ -2188,7 +3227,7 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
2188
3227
  ]
2189
3228
  },
2190
3229
  {
2191
- test: /\.less$/,
3230
+ test: LESS_REGEX,
2192
3231
  type: 'css/auto',
2193
3232
  use: [
2194
3233
  {
@@ -2203,7 +3242,7 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
2203
3242
  ]
2204
3243
  },
2205
3244
  {
2206
- test: /\.s[ac]ss$/i,
3245
+ test: SASS_REGEX,
2207
3246
  type: 'css/auto',
2208
3247
  use: [
2209
3248
  {
@@ -2217,6 +3256,10 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
2217
3256
  }
2218
3257
  }
2219
3258
  ]
3259
+ },
3260
+ {
3261
+ test: CSS_REGEX,
3262
+ type: 'css/auto'
2220
3263
  }
2221
3264
  ]
2222
3265
  },
@@ -2281,29 +3324,26 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
2281
3324
  src
2282
3325
  }
2283
3326
  })),
2284
- setupMiddlewares: (middlewares)=>[
2285
- (req, res, next)=>{
2286
- if ('string' != typeof req.url) return void next();
2287
- let url = new URL(req.url, 'http://localhost');
2288
- if (!url.pathname.startsWith("/umd/")) return void next();
2289
- let relativePath = url.pathname.replace("/umd/", '');
2290
- if (relativePath.includes('..')) {
2291
- res.statusCode = 403, res.end();
2292
- return;
2293
- }
2294
- let filePath = node_path.join(bundledDepsCachePath, relativePath);
2295
- if (!node_fs.existsSync(filePath)) return void next();
2296
- let stat = node_fs.statSync(filePath);
2297
- if (!stat.isFile()) return void next();
2298
- let mtime = stat.mtime.toUTCString(), ext = node_path.extname(filePath);
2299
- if (res.setHeader('Cache-Control', 'no-cache'), res.setHeader('Last-Modified', mtime), '.js' === ext && res.setHeader('Content-Type', "application/javascript"), '.css' === ext && res.setHeader('Content-Type', 'text/css'), req.headers['if-modified-since'] === mtime) {
2300
- res.statusCode = 304, res.end();
2301
- return;
2302
- }
2303
- res.statusCode = 200, node_fs.createReadStream(filePath).pipe(res);
2304
- },
2305
- ...middlewares
2306
- ],
3327
+ setupMiddlewares: (middlewares)=>(middlewares.unshift((req, res, next)=>{
3328
+ if ('string' != typeof req.url) return void next();
3329
+ let url = new URL(req.url, 'http://localhost');
3330
+ if (!url.pathname.startsWith("/umd/")) return void next();
3331
+ let relativePath = url.pathname.replace("/umd/", '');
3332
+ if (relativePath.includes('..')) {
3333
+ res.statusCode = 403, res.end();
3334
+ return;
3335
+ }
3336
+ let filePath = node_path.join(bundledDepsCachePath, relativePath);
3337
+ if (!node_fs.existsSync(filePath)) return void next();
3338
+ let stat = node_fs.statSync(filePath);
3339
+ if (!stat.isFile()) return void next();
3340
+ let mtime = stat.mtime.toUTCString(), ext = node_path.extname(filePath);
3341
+ if (res.setHeader('Cache-Control', 'no-cache'), res.setHeader('Last-Modified', mtime), '.js' === ext && res.setHeader('Content-Type', "application/javascript"), '.css' === ext && res.setHeader('Content-Type', 'text/css'), req.headers['if-modified-since'] === mtime) {
3342
+ res.statusCode = 304, res.end();
3343
+ return;
3344
+ }
3345
+ res.statusCode = 200, node_fs.createReadStream(filePath).pipe(res);
3346
+ }), middlewares),
2307
3347
  rspackConfig: (config)=>{
2308
3348
  let PLUGIN_NAME = 'InjectAssetsPlugin';
2309
3349
  return config.plugins.push({
@@ -2315,6 +3355,92 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
2315
3355
  }), config;
2316
3356
  }
2317
3357
  }),
3358
+ {
3359
+ name: 'unpack:type-check',
3360
+ apply: (config, { command })=>(tsconfigPath = node_path.resolve(config.root, 'tsconfig.json'), node_fs.existsSync(tsconfigPath) && 'dev' === command && config.typeCheck),
3361
+ async rspackConfig (config, { unpackConfig }) {
3362
+ let { TsCheckerRspackPlugin } = await import("ts-checker-rspack-plugin");
3363
+ return config.plugins.push(new TsCheckerRspackPlugin({
3364
+ typescript: {
3365
+ mode: 'readonly',
3366
+ memoryLimit: 8192,
3367
+ configFile: tsconfigPath,
3368
+ typescriptPath: require.resolve("typescript", {
3369
+ paths: [
3370
+ unpackConfig.root
3371
+ ]
3372
+ })
3373
+ },
3374
+ issue: {
3375
+ exclude: [
3376
+ ({ file = '' })=>NODE_MODULES_REGEX.test(file)
3377
+ ]
3378
+ },
3379
+ logger: {
3380
+ log (message) {
3381
+ let count = +(/(\d+) errors?/.exec(message)?.[1] || 0);
3382
+ count > 0 && console.log(`Found ${colors.red(colors.bold(`${count} ${1 === count ? 'error' : 'errors'}`))}`);
3383
+ },
3384
+ error (message) {
3385
+ message.includes('RpcExitError') || message.includes('out of memory') || console.log(convertBasicAnsiColors(message.replace(/ERROR/g, 'Type Error')));
3386
+ }
3387
+ }
3388
+ })), config;
3389
+ }
3390
+ },
3391
+ {
3392
+ name: 'unpack:target',
3393
+ rspackConfig: (config)=>(config.target = 'browserslist', config),
3394
+ configResolved (config) {
3395
+ let root = config.root, packageJsonPath = node_path.join(root, 'package.json');
3396
+ if (!node_fs.existsSync(packageJsonPath) || BROWSERSLIST_CONFIG_FILES.some((file)=>node_fs.existsSync(node_path.join(root, file)))) return;
3397
+ let packageJson = JSON.parse(node_fs.readFileSync(packageJsonPath, 'utf-8'));
3398
+ 'browserslist' in packageJson || (packageJson.browserslist = esVersionToBrowserslist(config.build.target), node_fs.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`));
3399
+ }
3400
+ },
3401
+ {
3402
+ name: 'unpack:build-analyze',
3403
+ apply: (config, { command })=>'build' === command && config.performance?.buildAnalyze,
3404
+ async rspackConfig (config) {
3405
+ let { RsdoctorRspackPlugin } = await import("@rsdoctor/rspack-plugin");
3406
+ return config.plugins.push(new RsdoctorRspackPlugin()), config.devtool = 'source-map', config;
3407
+ }
3408
+ },
3409
+ {
3410
+ name: 'unpack:detect-circular',
3411
+ apply: (config)=>config.detectCircular,
3412
+ rspackConfig (config, { unpackConfig }) {
3413
+ let circularCount = 0;
3414
+ return config.plugins.push(new rspack.CircularDependencyRspackPlugin({
3415
+ exclude: NODE_MODULES_REGEX,
3416
+ onStart () {
3417
+ circularCount = 0;
3418
+ },
3419
+ onDetected (_, modules) {
3420
+ var paths;
3421
+ let arrow, lastIndex;
3422
+ circularCount++, logger_logger.warn('circular dependency detected:'), paths = modules.map((module)=>{
3423
+ let filePath = module.replace(/^.*!/, ''), relativePath = node_path.relative(unpackConfig.root, filePath);
3424
+ return relativePath.startsWith('..') ? filePath : relativePath;
3425
+ }).slice(0, -1), console.log(''), arrow = colors.dim('↳ '), lastIndex = paths.length - 1, paths.forEach((p, i)=>{
3426
+ switch(i){
3427
+ case 0:
3428
+ console.log(` ${p}`);
3429
+ break;
3430
+ case lastIndex:
3431
+ console.log(` ${arrow}${p} ${colors.yellow(colors.dim('(cycle introduced)'))}`);
3432
+ break;
3433
+ default:
3434
+ console.log(` ${arrow}${p}`);
3435
+ }
3436
+ }), console.log(` ${arrow}${paths[0]}`), console.log('');
3437
+ },
3438
+ onEnd () {
3439
+ circularCount > 0 && console.log('Found', colors.yellow(colors.bold(`${circularCount} circular ${1 === circularCount ? 'dependency' : 'dependencies'}`)));
3440
+ }
3441
+ })), config;
3442
+ }
3443
+ },
2318
3444
  (root1 = '', {
2319
3445
  name: 'unpack:file-size',
2320
3446
  apply: (config, { mode })=>'production' === mode && config.performance?.printFileSize,
@@ -2390,8 +3516,8 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
2390
3516
  (VIRTUAL_UNO_CSS_ID = 'uno.css', rootDir = process.cwd(), isMpa = !1, unoConfig = {}, configFilePath = '', unpackConfigPath = '', tokens = new Set(), requestedLayers = new Set([
2391
3517
  LAYER_MARK_ALL
2392
3518
  ]), tasks = [], unocssCacheDir = '', tokensCachePath = '', layersCachePath = '', timeCachePath = '', configHashCachePath = '', generatedCachePath = '', bundlerCacheDir = '', cachedTokensSize = 0, cachedLayersSize = 0, isCompiling = !0, resolveUnocssConfig = async ()=>{
2393
- let resolvedConfigOrPath = (void 0) ?? configOrPathFromUnpackConfig, resolvedDefaults = (void 0) ?? defaultsFromUnpackConfig, configFromOption = {};
2394
- return isPlainObject(resolvedConfigOrPath) ? configFromOption = resolvedConfigOrPath : isString(resolvedConfigOrPath) && (configFilePath = node_path.isAbsolute(resolvedConfigOrPath) ? resolvedConfigOrPath : node_path.resolve(rootDir, resolvedConfigOrPath)), configFilePath = ((root, customConfig)=>{
3519
+ let configFromOption = {};
3520
+ isPlainObject(configOrPath) ? configFromOption = configOrPath : isString(configOrPath) && (configFilePath = node_path.isAbsolute(configOrPath) ? configOrPath : node_path.resolve(rootDir, configOrPath)), configFilePath = ((root, customConfig)=>{
2395
3521
  if (customConfig) {
2396
3522
  let absPath = node_path.isAbsolute(customConfig) ? customConfig : node_path.resolve(root, customConfig);
2397
3523
  if (node_fs.existsSync(absPath)) return absPath;
@@ -2400,7 +3526,9 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
2400
3526
  let configFile = node_path.join(root, file);
2401
3527
  if (node_fs.existsSync(configFile)) return configFile;
2402
3528
  }
2403
- })(rootDir, configFilePath), configFromOption = utils_mergeConfig(configFromOption, await loadConfigFromFile(configFilePath)), resolvedDefaults && (configFromOption = utils_mergeConfig(resolvedDefaults, configFromOption)), configFromOption;
3529
+ })(rootDir, configFilePath);
3530
+ let loaded = await loadConfigFromFile(configFilePath);
3531
+ return configFromOption = dist_default()(configFromOption, loaded), defaults && (configFromOption = dist_default()(defaults, configFromOption)), configFromOption;
2404
3532
  }, flushTasks = async ()=>{
2405
3533
  if (!tasks.length) return;
2406
3534
  logger_logger.debug(colors.yellow(`[unocss] Extract token from ${tasks.length} modules.`));
@@ -2438,10 +3566,10 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
2438
3566
  }, {
2439
3567
  name: 'unpack:unocss',
2440
3568
  apply: (config)=>!!config.css?.unocss,
2441
- configResolved: async (config, { cachePath })=>{
2442
- if (rootDir = config.root, isMpa = !!config.mpa, unpackConfigPath = resolveConfigPath(rootDir), bundlerCacheDir = node_path.resolve(rootDir, cachePath, 'cache'), unocssCacheDir = node_path.resolve(rootDir, cachePath, 'unocss'), tokensCachePath = node_path.resolve(unocssCacheDir, 'tokens'), layersCachePath = node_path.resolve(unocssCacheDir, 'layers'), timeCachePath = node_path.resolve(unocssCacheDir, 'created_at'), configHashCachePath = node_path.resolve(unocssCacheDir, 'config_hash'), generatedCachePath = node_path.resolve(unocssCacheDir, 'generated'), Array.isArray(config.css?.unocss)) {
3569
+ async configResolved (config) {
3570
+ if (rootDir = config.root, isMpa = !!config.mpa, unpackConfigPath = resolveConfigPath(rootDir), bundlerCacheDir = node_path.resolve(rootDir, this.cachePath, 'cache'), unocssCacheDir = node_path.resolve(rootDir, this.cachePath, 'unocss'), tokensCachePath = node_path.resolve(unocssCacheDir, 'tokens'), layersCachePath = node_path.resolve(unocssCacheDir, 'layers'), timeCachePath = node_path.resolve(unocssCacheDir, 'created_at'), configHashCachePath = node_path.resolve(unocssCacheDir, 'config_hash'), generatedCachePath = node_path.resolve(unocssCacheDir, 'generated'), Array.isArray(config.css?.unocss)) {
2443
3571
  let [configOrPathValue, defaultsValue] = config.css.unocss;
2444
- configOrPathFromUnpackConfig = configOrPathValue, defaultsFromUnpackConfig = defaultsValue;
3572
+ configOrPath = configOrPathValue, defaults = defaultsValue;
2445
3573
  }
2446
3574
  unoConfig = await resolveUnocssConfig();
2447
3575
  let core = await import("@unocss/core");
@@ -2549,8 +3677,8 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
2549
3677
  name: 'unpack:svg-icons',
2550
3678
  apply: (config)=>!!config.svgIcons,
2551
3679
  configResolved: (config)=>{
2552
- rootPath1 = config.root || process.cwd(), optionsFromUnpackConfig = config.svgIcons, (()=>{
2553
- let root, resolvedOptions = (void 0) ?? optionsFromUnpackConfig, inject = resolvedOptions.inject || 'body-last', domId = resolvedOptions.customDomId || '__svg__icons__dom__', { svg, names } = ((iconDirs, symbolId, customDomId)=>{
3680
+ rootPath1 = config.root || process.cwd(), options = config.svgIcons, (()=>{
3681
+ let root, inject = options.inject || 'body-last', domId = options.customDomId || '__svg__icons__dom__', { svg, names } = ((iconDirs, symbolId, customDomId)=>{
2554
3682
  let symbols = [], names = [], idSet = new Set();
2555
3683
  for (let dir of iconDirs)for (let file of readSvgFiles(dir)){
2556
3684
  let { inner, viewBox } = extractSvgContent(normalizeSvg(node_fs.readFileSync(file, 'utf-8'))), id = toSymbolId(file, dir, symbolId);
@@ -2560,7 +3688,7 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
2560
3688
  svg: `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="${customDomId}" style="position: absolute; width: 0; height: 0" aria-hidden="true">${symbols.join('')}</svg>`,
2561
3689
  names
2562
3690
  };
2563
- })((root = rootPath1, (resolvedOptions.iconDirs || []).map((dir)=>node_path.isAbsolute(dir) ? dir : node_path.resolve(root, dir))), resolvedOptions.symbolId, domId);
3691
+ })((root = rootPath1, (options.iconDirs || []).map((dir)=>node_path.isAbsolute(dir) ? dir : node_path.resolve(root, dir))), options.symbolId, domId);
2564
3692
  registerCode = `const svgDomId = ${JSON.stringify(domId)}\nconst svgHtml = ${JSON.stringify(svg)}\nconst inject = (position) => {\n if (typeof document === 'undefined') return\n if (document.getElementById(svgDomId)) return\n const div = document.createElement('div')\n div.innerHTML = svgHtml\n const svgEl = div.firstElementChild\n if (!svgEl) return\n if (position === 'head' && document.head) {\n document.head.prepend(svgEl)\n return\n }\n const body = document.body\n if (!body) return\n if (position === 'body-first' && body.firstChild) {\n body.insertBefore(svgEl, body.firstChild)\n } else {\n body.appendChild(svgEl)\n }\n}\nconst mount = () => inject(${JSON.stringify(inject)})\nif (typeof document !== 'undefined') {\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', mount)\n } else {\n mount()\n }\n}\nexport default mount`, namesCode = `export const svgIconNames = ${JSON.stringify(names)}\nexport default svgIconNames`;
2565
3693
  })();
2566
3694
  },
@@ -2626,7 +3754,7 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
2626
3754
  ]
2627
3755
  };
2628
3756
  return {
2629
- ...utils_mergeConfig(defaultConfig, userConfig),
3757
+ ...dist_default()(defaultConfig, userConfig),
2630
3758
  _context
2631
3759
  };
2632
3760
  };
@@ -2635,7 +3763,7 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
2635
3763
  let mode = watch ? 'development' : 'production';
2636
3764
  setNodeEnv(mode);
2637
3765
  let config = resolveConfig(mode);
2638
- console.log(colors.brand(`${callerName} v4.6.1`), colors.cyan(`building for ${mode}...`)), await unpackBuild(config);
3766
+ console.log(colors.brand(`${callerName} v4.7.1`), colors.cyan(`building for ${mode}...`)), await unpackBuild(config);
2639
3767
  },
2640
3768
  dev: async ()=>{
2641
3769
  setUnpackStartTime(performance.now());
@@ -2664,14 +3792,17 @@ async function createChokidar(pathOrGlobs, root = process.cwd(), options) {
2664
3792
  });
2665
3793
  }
2666
3794
  var injectFramework_dirname = __rspack_dirname(__rspack_fileURLToPath(import.meta.url));
2667
- async function injectFrameworkPluginForDebug(userConfig) {
2668
- var plugin;
2669
- let framework = process.env.FRAMEWORK?.trim();
2670
- if (!framework) return;
2671
- let pluginPath = node_path.resolve(injectFramework_dirname, `../../plugin-${framework}/dist/index.js`);
2672
- node_fs.existsSync(pluginPath) && (plugin = (0, (await import(pluginPath))[`plugin${framework.charAt(0).toUpperCase() + framework.slice(1)}`])(), userConfig.plugins ? userConfig.plugins.unshift(plugin) : userConfig.plugins = [
3795
+ let injectPlugin = (userConfig, plugin)=>{
3796
+ userConfig.plugins ? userConfig.plugins.unshift(plugin) : userConfig.plugins = [
2673
3797
  plugin
2674
- ]);
3798
+ ];
3799
+ };
3800
+ async function injectFrameworkPluginForDebug(userConfig) {
3801
+ let frameworkEnv = process.env.FRAMEWORK?.trim();
3802
+ if (frameworkEnv) for (let framework of frameworkEnv.split(',').map((item)=>item.trim()).filter(Boolean)){
3803
+ let pluginPath = node_path.resolve(injectFramework_dirname, `../../plugin-${framework}/dist/index.js`);
3804
+ if (node_fs.existsSync(pluginPath)) injectPlugin(userConfig, (0, (await import(pluginPath))[`plugin${framework.charAt(0).toUpperCase() + framework.slice(1)}`])());
3805
+ }
2675
3806
  }
2676
3807
  async function setupCliShortcuts({ help = !0, openPage, closeServer, printUrls, restartServer }) {
2677
3808
  let shortcuts = [
@@ -2786,7 +3917,8 @@ function runCLI() {
2786
3917
  logger_logger.clear(), logger_logger.info(`${node_path.basename(file)} changed, restarting server...`), await watcher.close(), await cleanUpBeforeRestart(), startServer(options);
2787
3918
  });
2788
3919
  });
2789
- devCommand.option('-o, --open [url]', 'Open browser on startup').option('--port <port>', 'Specify port').option('--host', 'Expose hostname').action(startServer), cli.help(), cli.version("4.6.1"), cli.parse();
3920
+ devCommand.option('-o, --open [url]', 'Open browser on startup').option('--port <port>', 'Specify port').option('--host', 'Expose hostname').action(startServer), cli.help(), cli.version("4.7.1"), cli.parse();
2790
3921
  }
2791
- var src_CSS_MODULES_NAMED_EXPORT = !1;
2792
- export { ALL_INTERFACES_IPV4, CSS_MODULES_EXPORTS_CONVENTION, CSS_MODULES_LOCAL_IDENT_NAME, DEV_DEFAULT_FILENAME, JSX_REGEX, JS_REGEX, LOCALHOST, NODE_MODULES_REGEX, PROD_DEFAULT_FILENAME, SCRIPT_REGEX, TEMPLATE_CONTENT, addRestartCleaner, applyHtmlTagDescriptors, cleanUpBeforeRestart, clearLine, colors, convertBasicAnsiColors, createChokidar, createUnpack, debounce, defineConfig, emptyDir, ensureDir, esVersionToBrowserslist, external_tinyglobby_glob as glob, findExists, getAddressUrls, getCompiledPkgPath, getCurrentUnpackConfig, getFilesContentHash, getHtmlTemplateOrContent, getIpv4Interfaces, getNodeEnv, getOrSetDefault, getPathInJs, getPort, getTime, getUnpackStartTime, getUserDepPath, getUserDepVersion, globSync, isBoolean, isDebug, isDev, isEmptyDir, isFileExists, isFileSync, isFunction, isNodeVersionAtLeast, isObject, isPlainObject, isRegExp, isString, isUndefined, isWin, launchEditor, loadConfig, loadConfigFromFile, logUpdate, logger_LogColor as LogColor, logger_logger as logger, normalizePublicPath, openBrowser, pLimit, pathExists, pathToExportIdentifier, prettyTime, printServerUrls, removeDir, renderHtmlTagDescriptor, resolveConfigPath, rspack, runCLI, set, setCurrentUnpackConfig, setDevServer, setNodeEnv, setUnpackStartTime, src_CSS_MODULES_NAMED_EXPORT as CSS_MODULES_NAMED_EXPORT, trackPerformance, utils_isDevServer as isDevServer, utils_isProd as isProd, utils_mergeConfig as mergeConfig };
3922
+ let launch_editor = __webpack_require__("../../node_modules/.pnpm/launch-editor@2.13.1/node_modules/launch-editor/index.js");
3923
+ var launch_editor_default_0 = __webpack_require__.n(launch_editor)(), src_CSS_MODULES_NAMED_EXPORT = !1;
3924
+ export { ALL_INTERFACES_IPV4, CSS_MODULES_EXPORTS_CONVENTION, CSS_MODULES_LOCAL_IDENT_NAME, CSS_REGEX, DEV_DEFAULT_FILENAME, JSX_REGEX, JS_REGEX, LESS_REGEX, LOCALHOST, NODE_MODULES_REGEX, PROD_DEFAULT_FILENAME, SASS_REGEX, SCRIPT_REGEX, TEMPLATE_CONTENT, addRestartCleaner, applyHtmlTagDescriptors, cleanUpBeforeRestart, clearLine, colors, convertBasicAnsiColors, createChokidar, createUnpack, debounce, defineConfig, dist_default_0 as mergeConfig, emptyDir, ensureDir, esVersionToBrowserslist, external_tinyglobby_glob as glob, findExists, getAddressUrls, getCompiledPkgPath, getCurrentUnpackConfig, getDevServerPort, getFilesContentHash, getHtmlTemplateOrContent, getIpv4Interfaces, getNodeEnv, getOrSetDefault, getPathInJs, getPort, getTime, getUnpackStartTime, getUserDepPath, getUserDepVersion, globSync, isBoolean, isDebug, isDev, isEmptyDir, isFileExists, isFileSync, isFunction, isNodeVersionAtLeast, isObject, isPlainObject, isRegExp, isString, isUndefined, isWin, launch_editor_default_0 as launchEditor, loadConfig, loadConfigFromFile, logUpdate, logger_LogColor as LogColor, logger_logger as logger, normalizePublicPath, openBrowser, pLimit, pathExists, pathToExportIdentifier, prettyTime, printServerUrls, removeDir, renderHtmlTagDescriptor, resolveConfigPath, rspack, runCLI, set, setCurrentUnpackConfig, setDevServer, setDevServerPort, setNodeEnv, setUnpackStartTime, src_CSS_MODULES_NAMED_EXPORT as CSS_MODULES_NAMED_EXPORT, trackPerformance, utils_isDevServer as isDevServer, utils_isProd as isProd };