@unpackjs/core 2.4.1 → 2.4.2

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