@rsbuild/webpack 1.0.0 → 1.0.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/README.md +23 -2
  2. package/dist/index.cjs +2582 -0
  3. package/dist/index.js +2609 -17
  4. package/dist-types/build.d.ts +3 -0
  5. package/dist-types/createCompiler.d.ts +12 -0
  6. package/dist-types/index.d.ts +2 -0
  7. package/dist-types/initConfigs.d.ts +11 -0
  8. package/dist-types/inspectConfig.d.ts +7 -0
  9. package/dist-types/package.json +1 -0
  10. package/dist-types/plugin.d.ts +5 -0
  11. package/dist-types/progress/ProgressPlugin.d.ts +13 -0
  12. package/{dist/webpackPlugins/ProgressPlugin → dist-types/progress}/helpers/bar.d.ts +2 -2
  13. package/dist-types/progress/helpers/bus.d.ts +18 -0
  14. package/dist-types/progress/helpers/index.d.ts +4 -0
  15. package/dist-types/progress/helpers/log.d.ts +8 -0
  16. package/dist-types/progress/helpers/nonTty.d.ts +9 -0
  17. package/{dist/webpackPlugins/ProgressPlugin → dist-types/progress}/helpers/percentage.d.ts +1 -1
  18. package/dist-types/progress/helpers/types.d.ts +24 -0
  19. package/{dist/webpackPlugins/ProgressPlugin → dist-types/progress}/helpers/utils.d.ts +1 -1
  20. package/dist-types/provider.d.ts +2 -0
  21. package/dist-types/shared.d.ts +17 -0
  22. package/dist-types/types.d.ts +3 -0
  23. package/dist-types/webpackConfig.d.ts +8 -0
  24. package/package.json +21 -50
  25. package/static/ModuleFilenameHelpers.js +1 -1
  26. package/compiled/ansi-escapes/index.d.ts +0 -248
  27. package/compiled/ansi-escapes/index.js +0 -1
  28. package/compiled/ansi-escapes/license +0 -9
  29. package/compiled/ansi-escapes/package.json +0 -1
  30. package/compiled/ansi-escapes/type-fest/index.d.ts +0 -2
  31. package/compiled/babel-plugin-lodash/index.d.ts +0 -1
  32. package/compiled/babel-plugin-lodash/index.js +0 -1
  33. package/compiled/babel-plugin-lodash/license +0 -44
  34. package/compiled/babel-plugin-lodash/package.json +0 -1
  35. package/compiled/babel-plugin-transform-react-remove-prop-types/index.d.ts +0 -1
  36. package/compiled/babel-plugin-transform-react-remove-prop-types/index.js +0 -1
  37. package/compiled/babel-plugin-transform-react-remove-prop-types/license +0 -22
  38. package/compiled/babel-plugin-transform-react-remove-prop-types/package.json +0 -1
  39. package/compiled/cli-truncate/index.d.ts +0 -96
  40. package/compiled/cli-truncate/index.js +0 -1
  41. package/compiled/cli-truncate/license +0 -9
  42. package/compiled/cli-truncate/package.json +0 -1
  43. package/compiled/copy-webpack-plugin/index.d.ts +0 -1
  44. package/compiled/copy-webpack-plugin/index.js +0 -22
  45. package/compiled/copy-webpack-plugin/license +0 -20
  46. package/compiled/copy-webpack-plugin/package.json +0 -1
  47. package/compiled/patch-console/build/index.d.ts +0 -4
  48. package/compiled/patch-console/index.js +0 -1
  49. package/compiled/patch-console/package.json +0 -1
  50. package/compiled/schema-utils3/index.d.ts +0 -1
  51. package/compiled/schema-utils3/index.js +0 -3
  52. package/compiled/schema-utils3/license +0 -20
  53. package/compiled/schema-utils3/package.json +0 -1
  54. package/compiled/tapable/index.js +0 -1
  55. package/compiled/tapable/license +0 -21
  56. package/compiled/tapable/package.json +0 -1
  57. package/compiled/tapable/tapable.d.ts +0 -116
  58. package/compiled/webpack-sources/index.d.ts +0 -1
  59. package/compiled/webpack-sources/index.js +0 -1
  60. package/compiled/webpack-sources/license +0 -21
  61. package/compiled/webpack-sources/package.json +0 -1
  62. package/dist/config/defaults.d.ts +0 -3
  63. package/dist/config/defaults.js +0 -47
  64. package/dist/config/normalize.d.ts +0 -7
  65. package/dist/config/normalize.js +0 -33
  66. package/dist/core/build.d.ts +0 -20
  67. package/dist/core/build.js +0 -80
  68. package/dist/core/createCompiler.d.ts +0 -14
  69. package/dist/core/createCompiler.js +0 -88
  70. package/dist/core/createContext.d.ts +0 -13
  71. package/dist/core/createContext.js +0 -58
  72. package/dist/core/devMiddleware.d.ts +0 -3
  73. package/dist/core/devMiddleware.js +0 -73
  74. package/dist/core/initConfigs.d.ts +0 -14
  75. package/dist/core/initConfigs.js +0 -79
  76. package/dist/core/initHooks.d.ts +0 -19
  77. package/dist/core/initHooks.js +0 -44
  78. package/dist/core/initPlugins.d.ts +0 -9
  79. package/dist/core/initPlugins.js +0 -86
  80. package/dist/core/inspectConfig.d.ts +0 -20
  81. package/dist/core/inspectConfig.js +0 -81
  82. package/dist/core/webpackConfig.d.ts +0 -9
  83. package/dist/core/webpackConfig.js +0 -164
  84. package/dist/exports/webpack.d.ts +0 -2
  85. package/dist/exports/webpack.js +0 -35
  86. package/dist/index.d.ts +0 -6
  87. package/dist/plugins/babel.d.ts +0 -3
  88. package/dist/plugins/babel.js +0 -169
  89. package/dist/plugins/basic.d.ts +0 -5
  90. package/dist/plugins/basic.js +0 -58
  91. package/dist/plugins/copy.d.ts +0 -2
  92. package/dist/plugins/copy.js +0 -69
  93. package/dist/plugins/css.d.ts +0 -23
  94. package/dist/plugins/css.js +0 -121
  95. package/dist/plugins/hmr.d.ts +0 -2
  96. package/dist/plugins/hmr.js +0 -41
  97. package/dist/plugins/less.d.ts +0 -6
  98. package/dist/plugins/less.js +0 -65
  99. package/dist/plugins/minimize.d.ts +0 -2
  100. package/dist/plugins/minimize.js +0 -64
  101. package/dist/plugins/output.d.ts +0 -2
  102. package/dist/plugins/output.js +0 -66
  103. package/dist/plugins/progress.d.ts +0 -2
  104. package/dist/plugins/progress.js +0 -58
  105. package/dist/plugins/react.d.ts +0 -2
  106. package/dist/plugins/react.js +0 -97
  107. package/dist/plugins/resolve.d.ts +0 -2
  108. package/dist/plugins/resolve.js +0 -86
  109. package/dist/plugins/sass.d.ts +0 -2
  110. package/dist/plugins/sass.js +0 -76
  111. package/dist/plugins/tsLoader.d.ts +0 -2
  112. package/dist/plugins/tsLoader.js +0 -105
  113. package/dist/provider.d.ts +0 -9
  114. package/dist/provider.js +0 -108
  115. package/dist/shared/fs.d.ts +0 -1
  116. package/dist/shared/fs.js +0 -48
  117. package/dist/shared/index.d.ts +0 -1
  118. package/dist/shared/index.js +0 -22
  119. package/dist/shared/plugin.d.ts +0 -3
  120. package/dist/shared/plugin.js +0 -78
  121. package/dist/types/config/index.d.ts +0 -26
  122. package/dist/types/config/index.js +0 -22
  123. package/dist/types/config/tools.d.ts +0 -51
  124. package/dist/types/config/tools.js +0 -16
  125. package/dist/types/context.d.ts +0 -17
  126. package/dist/types/context.js +0 -16
  127. package/dist/types/index.d.ts +0 -4
  128. package/dist/types/index.js +0 -28
  129. package/dist/types/plugin.d.ts +0 -6
  130. package/dist/types/plugin.js +0 -16
  131. package/dist/types/thirdParty/css.d.ts +0 -7
  132. package/dist/types/thirdParty/css.js +0 -16
  133. package/dist/types/thirdParty/index.d.ts +0 -8
  134. package/dist/types/thirdParty/index.js +0 -16
  135. package/dist/webpackPlugins/ProgressPlugin/ProgressPlugin.d.ts +0 -13
  136. package/dist/webpackPlugins/ProgressPlugin/ProgressPlugin.js +0 -104
  137. package/dist/webpackPlugins/ProgressPlugin/helpers/bar.js +0 -142
  138. package/dist/webpackPlugins/ProgressPlugin/helpers/bus.d.ts +0 -17
  139. package/dist/webpackPlugins/ProgressPlugin/helpers/bus.js +0 -105
  140. package/dist/webpackPlugins/ProgressPlugin/helpers/index.d.ts +0 -4
  141. package/dist/webpackPlugins/ProgressPlugin/helpers/index.js +0 -28
  142. package/dist/webpackPlugins/ProgressPlugin/helpers/log.d.ts +0 -9
  143. package/dist/webpackPlugins/ProgressPlugin/helpers/log.js +0 -62
  144. package/dist/webpackPlugins/ProgressPlugin/helpers/nonTty.d.ts +0 -15
  145. package/dist/webpackPlugins/ProgressPlugin/helpers/nonTty.js +0 -56
  146. package/dist/webpackPlugins/ProgressPlugin/helpers/percentage.js +0 -52
  147. package/dist/webpackPlugins/ProgressPlugin/helpers/type.d.ts +0 -23
  148. package/dist/webpackPlugins/ProgressPlugin/helpers/type.js +0 -16
  149. package/dist/webpackPlugins/ProgressPlugin/helpers/utils.js +0 -30
package/dist/index.js CHANGED
@@ -1,8 +1,26 @@
1
- "use strict";
1
+ import { createRequire } from 'module';
2
+ var require = createRequire(import.meta['url']);
3
+
4
+ var __create = Object.create;
2
5
  var __defProp = Object.defineProperty;
3
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
7
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
5
9
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
12
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
13
+ }) : x)(function(x) {
14
+ if (typeof require !== "undefined")
15
+ return require.apply(this, arguments);
16
+ throw Error('Dynamic require of "' + x + '" is not supported');
17
+ });
18
+ var __esm = (fn, res) => function __init() {
19
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
20
+ };
21
+ var __commonJS = (cb, mod) => function __require2() {
22
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
23
+ };
6
24
  var __export = (target, all) => {
7
25
  for (var name in all)
8
26
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -15,20 +33,2594 @@ var __copyProps = (to, from, except, desc) => {
15
33
  }
16
34
  return to;
17
35
  };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var src_exports = {};
20
- __export(src_exports, {
21
- createDefaultConfig: () => import_defaults.createDefaultConfig,
22
- webpackBuild: () => import_build.webpackBuild,
23
- webpackProvider: () => import_provider.webpackProvider
24
- });
25
- module.exports = __toCommonJS(src_exports);
26
- var import_provider = require("./provider");
27
- var import_build = require("./core/build");
28
- var import_defaults = require("./config/defaults");
29
- // Annotate the CommonJS export names for ESM import in node:
30
- 0 && (module.exports = {
31
- createDefaultConfig,
32
- webpackBuild,
33
- webpackProvider
36
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
37
+ // If the importer is in node compatibility mode or this is not an ESM
38
+ // file that has been converted to a CommonJS file using a Babel-
39
+ // compatible transform (i.e. "__esModule" has not been set), then set
40
+ // "default" to the CommonJS "module.exports" for node compatibility.
41
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
42
+ mod
43
+ ));
44
+ var __publicField = (obj, key, value) => {
45
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
46
+ return value;
47
+ };
48
+
49
+ // ../../../node_modules/.pnpm/@modern-js+module-tools@2.54.6_eslint@9.6.0_typescript@5.5.2/node_modules/@modern-js/module-tools/shims/esm.js
50
+ import { fileURLToPath } from "url";
51
+ import path from "path";
52
+ var init_esm = __esm({
53
+ "../../../node_modules/.pnpm/@modern-js+module-tools@2.54.6_eslint@9.6.0_typescript@5.5.2/node_modules/@modern-js/module-tools/shims/esm.js"() {
54
+ "use strict";
55
+ }
56
+ });
57
+
58
+ // src/shared.ts
59
+ import { __internalHelper } from "@rsbuild/core";
60
+ var getChainUtils, initRsbuildConfig, createDevServer, formatStats, getDevMiddleware, getStatsOptions, stringifyConfig, outputInspectConfigFiles, getRsbuildInspectConfig, chainToConfig, modifyBundlerChain, onCompileDone, prettyTime, castArray;
61
+ var init_shared = __esm({
62
+ "src/shared.ts"() {
63
+ "use strict";
64
+ init_esm();
65
+ ({
66
+ getChainUtils,
67
+ initRsbuildConfig,
68
+ createDevServer,
69
+ formatStats,
70
+ getDevMiddleware,
71
+ getStatsOptions,
72
+ stringifyConfig,
73
+ outputInspectConfigFiles,
74
+ getRsbuildInspectConfig,
75
+ chainToConfig,
76
+ modifyBundlerChain,
77
+ onCompileDone,
78
+ prettyTime
79
+ } = __internalHelper);
80
+ castArray = (arr) => {
81
+ if (arr === void 0) {
82
+ return [];
83
+ }
84
+ return Array.isArray(arr) ? arr : [arr];
85
+ };
86
+ }
87
+ });
88
+
89
+ // src/inspectConfig.ts
90
+ var inspectConfig_exports = {};
91
+ __export(inspectConfig_exports, {
92
+ inspectConfig: () => inspectConfig
93
+ });
94
+ import { isAbsolute, join } from "path";
95
+ async function inspectConfig({
96
+ context,
97
+ pluginManager,
98
+ rsbuildOptions,
99
+ bundlerConfigs,
100
+ inspectOptions = {}
101
+ }) {
102
+ if (inspectOptions.env) {
103
+ process.env.NODE_ENV = inspectOptions.env;
104
+ } else if (!process.env.NODE_ENV) {
105
+ process.env.NODE_ENV = "development";
106
+ }
107
+ const webpackConfigs = bundlerConfigs || (await initConfigs({
108
+ context,
109
+ pluginManager,
110
+ rsbuildOptions
111
+ })).webpackConfigs;
112
+ const rawBundlerConfigs = webpackConfigs.map((config, index) => ({
113
+ name: config.name || String(index),
114
+ content: stringifyConfig(config, inspectOptions.verbose)
115
+ }));
116
+ const {
117
+ rsbuildConfig,
118
+ rawRsbuildConfig,
119
+ environmentConfigs,
120
+ rawEnvironmentConfigs
121
+ } = getRsbuildInspectConfig({
122
+ normalizedConfig: context.normalizedConfig,
123
+ inspectOptions,
124
+ pluginManager
125
+ });
126
+ let outputPath = inspectOptions.outputPath || context.distPath;
127
+ if (!isAbsolute(outputPath)) {
128
+ outputPath = join(context.rootPath, outputPath);
129
+ }
130
+ if (inspectOptions.writeToDisk) {
131
+ await outputInspectConfigFiles({
132
+ rawBundlerConfigs,
133
+ rawEnvironmentConfigs,
134
+ inspectOptions: {
135
+ ...inspectOptions,
136
+ outputPath
137
+ },
138
+ configType: "webpack"
139
+ });
140
+ }
141
+ return {
142
+ rsbuildConfig: rawRsbuildConfig,
143
+ environmentConfigs: rawEnvironmentConfigs.map((r) => r.content),
144
+ bundlerConfigs: rawBundlerConfigs.map((r) => r.content),
145
+ origin: {
146
+ rsbuildConfig,
147
+ environmentConfigs,
148
+ bundlerConfigs: webpackConfigs
149
+ }
150
+ };
151
+ }
152
+ var init_inspectConfig = __esm({
153
+ "src/inspectConfig.ts"() {
154
+ "use strict";
155
+ init_esm();
156
+ init_initConfigs();
157
+ init_shared();
158
+ }
159
+ });
160
+
161
+ // src/webpackConfig.ts
162
+ import {
163
+ __internalHelper as __internalHelper2,
164
+ logger
165
+ } from "@rsbuild/core";
166
+ import { reduceConfigsWithContext } from "reduce-configs";
167
+ async function modifyWebpackChain(context, utils, chain) {
168
+ logger.debug("modify webpack chain");
169
+ const [modifiedChain] = await context.hooks.modifyWebpackChain.call(
170
+ chain,
171
+ utils
172
+ );
173
+ if (utils.environment.config.tools?.webpackChain) {
174
+ for (const item of castArray(utils.environment.config.tools.webpackChain)) {
175
+ item(modifiedChain, utils);
176
+ }
177
+ }
178
+ logger.debug("modify webpack chain done");
179
+ return modifiedChain;
180
+ }
181
+ async function modifyWebpackConfig(context, webpackConfig, utils) {
182
+ logger.debug("modify webpack config");
183
+ let [modifiedConfig] = await context.hooks.modifyWebpackConfig.call(
184
+ webpackConfig,
185
+ utils
186
+ );
187
+ if (utils.environment.config.tools?.webpack) {
188
+ modifiedConfig = reduceConfigsWithContext({
189
+ initial: modifiedConfig,
190
+ config: utils.environment.config.tools.webpack,
191
+ ctx: utils,
192
+ mergeFn: utils.mergeConfig
193
+ });
194
+ }
195
+ logger.debug("modify webpack config done");
196
+ return modifiedConfig;
197
+ }
198
+ async function getChainUtils2(target, environment) {
199
+ const { default: webpack2 } = await import("webpack");
200
+ const nameMap = {
201
+ web: "client",
202
+ node: "server",
203
+ "web-worker": "web-worker"
204
+ };
205
+ return {
206
+ ...getChainUtils(target, environment),
207
+ name: nameMap[target] || "",
208
+ webpack: webpack2,
209
+ HtmlWebpackPlugin: __internalHelper2.getHTMLPlugin()
210
+ };
211
+ }
212
+ async function generateWebpackConfig({
213
+ target,
214
+ context,
215
+ environment
216
+ }) {
217
+ const chainUtils = await getChainUtils2(
218
+ target,
219
+ context.environments[environment]
220
+ );
221
+ const { default: webpack2 } = await import("webpack");
222
+ const {
223
+ BannerPlugin,
224
+ DefinePlugin,
225
+ IgnorePlugin,
226
+ ProvidePlugin,
227
+ HotModuleReplacementPlugin
228
+ } = webpack2;
229
+ const bundlerChain = await modifyBundlerChain(context, {
230
+ ...chainUtils,
231
+ bundler: {
232
+ BannerPlugin,
233
+ DefinePlugin,
234
+ IgnorePlugin,
235
+ ProvidePlugin,
236
+ HotModuleReplacementPlugin
237
+ }
238
+ });
239
+ const chain = await modifyWebpackChain(context, chainUtils, bundlerChain);
240
+ let webpackConfig = chainToConfig(chain);
241
+ const configUtils = await __internalHelper2.getConfigUtils(
242
+ webpackConfig,
243
+ chainUtils
244
+ );
245
+ webpackConfig = await modifyWebpackConfig(
246
+ context,
247
+ webpackConfig,
248
+ configUtils
249
+ );
250
+ return webpackConfig;
251
+ }
252
+ var init_webpackConfig = __esm({
253
+ "src/webpackConfig.ts"() {
254
+ "use strict";
255
+ init_esm();
256
+ init_shared();
257
+ }
258
+ });
259
+
260
+ // src/initConfigs.ts
261
+ import {
262
+ logger as logger2
263
+ } from "@rsbuild/core";
264
+ async function initConfigs({
265
+ context,
266
+ pluginManager,
267
+ rsbuildOptions
268
+ }) {
269
+ const normalizedConfig = await initRsbuildConfig({
270
+ context,
271
+ pluginManager
272
+ });
273
+ const webpackConfigs = await Promise.all(
274
+ Object.entries(normalizedConfig.environments).map(
275
+ ([environment, config]) => generateWebpackConfig({
276
+ target: config.output.target,
277
+ context,
278
+ environment
279
+ })
280
+ )
281
+ );
282
+ if (logger2.level === "verbose") {
283
+ const inspect = () => {
284
+ const inspectOptions = {
285
+ verbose: true,
286
+ writeToDisk: true
287
+ };
288
+ inspectConfig({
289
+ context,
290
+ pluginManager,
291
+ inspectOptions,
292
+ rsbuildOptions,
293
+ bundlerConfigs: webpackConfigs
294
+ });
295
+ };
296
+ context.hooks.onBeforeBuild.tap(inspect);
297
+ context.hooks.onAfterStartDevServer.tap(inspect);
298
+ }
299
+ return {
300
+ webpackConfigs
301
+ };
302
+ }
303
+ var init_initConfigs = __esm({
304
+ "src/initConfigs.ts"() {
305
+ "use strict";
306
+ init_esm();
307
+ init_inspectConfig();
308
+ init_shared();
309
+ init_webpackConfig();
310
+ }
34
311
  });
312
+
313
+ // src/createCompiler.ts
314
+ var createCompiler_exports = {};
315
+ __export(createCompiler_exports, {
316
+ createCompiler: () => createCompiler,
317
+ createDevMiddleware: () => createDevMiddleware
318
+ });
319
+ import { logger as logger3 } from "@rsbuild/core";
320
+ import WebpackMultiStats from "webpack/lib/MultiStats.js";
321
+ async function createCompiler({
322
+ context,
323
+ webpackConfigs
324
+ }) {
325
+ logger3.debug("create compiler");
326
+ await context.hooks.onBeforeCreateCompiler.call({
327
+ bundlerConfigs: webpackConfigs,
328
+ environments: context.environments
329
+ });
330
+ const { default: webpack2 } = await import("webpack");
331
+ const compiler = webpackConfigs.length === 1 ? webpack2(webpackConfigs[0]) : webpack2(webpackConfigs);
332
+ const done = async (stats) => {
333
+ const { message, level } = formatStats(
334
+ stats,
335
+ getStatsOptions(compiler)
336
+ );
337
+ if (level === "error") {
338
+ logger3.error(message);
339
+ }
340
+ if (level === "warning") {
341
+ logger3.warn(message);
342
+ }
343
+ if (process.env.NODE_ENV === "development") {
344
+ await context.hooks.onDevCompileDone.call({
345
+ isFirstCompile,
346
+ stats,
347
+ environments: context.environments
348
+ });
349
+ }
350
+ isFirstCompile = false;
351
+ };
352
+ let isFirstCompile = true;
353
+ onCompileDone(compiler, done, WebpackMultiStats);
354
+ await context.hooks.onAfterCreateCompiler.call({
355
+ compiler,
356
+ environments: context.environments
357
+ });
358
+ logger3.debug("create compiler done");
359
+ return compiler;
360
+ }
361
+ async function createDevMiddleware(options, customCompiler) {
362
+ let compiler;
363
+ if (customCompiler) {
364
+ compiler = customCompiler;
365
+ } else {
366
+ const { webpackConfigs } = await initConfigs(options);
367
+ compiler = await createCompiler({
368
+ context: options.context,
369
+ webpackConfigs
370
+ });
371
+ }
372
+ return {
373
+ devMiddleware: await getDevMiddleware(compiler),
374
+ compiler
375
+ };
376
+ }
377
+ var init_createCompiler = __esm({
378
+ "src/createCompiler.ts"() {
379
+ "use strict";
380
+ init_esm();
381
+ init_initConfigs();
382
+ init_shared();
383
+ init_shared();
384
+ }
385
+ });
386
+
387
+ // ../../../node_modules/.pnpm/is-fullwidth-code-point@3.0.0/node_modules/is-fullwidth-code-point/index.js
388
+ var require_is_fullwidth_code_point = __commonJS({
389
+ "../../../node_modules/.pnpm/is-fullwidth-code-point@3.0.0/node_modules/is-fullwidth-code-point/index.js"(exports, module) {
390
+ "use strict";
391
+ init_esm();
392
+ var isFullwidthCodePoint = (codePoint) => {
393
+ if (Number.isNaN(codePoint)) {
394
+ return false;
395
+ }
396
+ if (codePoint >= 4352 && (codePoint <= 4447 || // Hangul Jamo
397
+ codePoint === 9001 || // LEFT-POINTING ANGLE BRACKET
398
+ codePoint === 9002 || // RIGHT-POINTING ANGLE BRACKET
399
+ // CJK Radicals Supplement .. Enclosed CJK Letters and Months
400
+ 11904 <= codePoint && codePoint <= 12871 && codePoint !== 12351 || // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
401
+ 12880 <= codePoint && codePoint <= 19903 || // CJK Unified Ideographs .. Yi Radicals
402
+ 19968 <= codePoint && codePoint <= 42182 || // Hangul Jamo Extended-A
403
+ 43360 <= codePoint && codePoint <= 43388 || // Hangul Syllables
404
+ 44032 <= codePoint && codePoint <= 55203 || // CJK Compatibility Ideographs
405
+ 63744 <= codePoint && codePoint <= 64255 || // Vertical Forms
406
+ 65040 <= codePoint && codePoint <= 65049 || // CJK Compatibility Forms .. Small Form Variants
407
+ 65072 <= codePoint && codePoint <= 65131 || // Halfwidth and Fullwidth Forms
408
+ 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510 || // Kana Supplement
409
+ 110592 <= codePoint && codePoint <= 110593 || // Enclosed Ideographic Supplement
410
+ 127488 <= codePoint && codePoint <= 127569 || // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
411
+ 131072 <= codePoint && codePoint <= 262141)) {
412
+ return true;
413
+ }
414
+ return false;
415
+ };
416
+ module.exports = isFullwidthCodePoint;
417
+ module.exports.default = isFullwidthCodePoint;
418
+ }
419
+ });
420
+
421
+ // ../../../node_modules/.pnpm/astral-regex@2.0.0/node_modules/astral-regex/index.js
422
+ var require_astral_regex = __commonJS({
423
+ "../../../node_modules/.pnpm/astral-regex@2.0.0/node_modules/astral-regex/index.js"(exports, module) {
424
+ "use strict";
425
+ init_esm();
426
+ var regex = "[\uD800-\uDBFF][\uDC00-\uDFFF]";
427
+ var astralRegex = (options) => options && options.exact ? new RegExp(`^${regex}$`) : new RegExp(regex, "g");
428
+ module.exports = astralRegex;
429
+ }
430
+ });
431
+
432
+ // ../../../node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js
433
+ var require_color_name = __commonJS({
434
+ "../../../node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js"(exports, module) {
435
+ "use strict";
436
+ init_esm();
437
+ module.exports = {
438
+ "aliceblue": [240, 248, 255],
439
+ "antiquewhite": [250, 235, 215],
440
+ "aqua": [0, 255, 255],
441
+ "aquamarine": [127, 255, 212],
442
+ "azure": [240, 255, 255],
443
+ "beige": [245, 245, 220],
444
+ "bisque": [255, 228, 196],
445
+ "black": [0, 0, 0],
446
+ "blanchedalmond": [255, 235, 205],
447
+ "blue": [0, 0, 255],
448
+ "blueviolet": [138, 43, 226],
449
+ "brown": [165, 42, 42],
450
+ "burlywood": [222, 184, 135],
451
+ "cadetblue": [95, 158, 160],
452
+ "chartreuse": [127, 255, 0],
453
+ "chocolate": [210, 105, 30],
454
+ "coral": [255, 127, 80],
455
+ "cornflowerblue": [100, 149, 237],
456
+ "cornsilk": [255, 248, 220],
457
+ "crimson": [220, 20, 60],
458
+ "cyan": [0, 255, 255],
459
+ "darkblue": [0, 0, 139],
460
+ "darkcyan": [0, 139, 139],
461
+ "darkgoldenrod": [184, 134, 11],
462
+ "darkgray": [169, 169, 169],
463
+ "darkgreen": [0, 100, 0],
464
+ "darkgrey": [169, 169, 169],
465
+ "darkkhaki": [189, 183, 107],
466
+ "darkmagenta": [139, 0, 139],
467
+ "darkolivegreen": [85, 107, 47],
468
+ "darkorange": [255, 140, 0],
469
+ "darkorchid": [153, 50, 204],
470
+ "darkred": [139, 0, 0],
471
+ "darksalmon": [233, 150, 122],
472
+ "darkseagreen": [143, 188, 143],
473
+ "darkslateblue": [72, 61, 139],
474
+ "darkslategray": [47, 79, 79],
475
+ "darkslategrey": [47, 79, 79],
476
+ "darkturquoise": [0, 206, 209],
477
+ "darkviolet": [148, 0, 211],
478
+ "deeppink": [255, 20, 147],
479
+ "deepskyblue": [0, 191, 255],
480
+ "dimgray": [105, 105, 105],
481
+ "dimgrey": [105, 105, 105],
482
+ "dodgerblue": [30, 144, 255],
483
+ "firebrick": [178, 34, 34],
484
+ "floralwhite": [255, 250, 240],
485
+ "forestgreen": [34, 139, 34],
486
+ "fuchsia": [255, 0, 255],
487
+ "gainsboro": [220, 220, 220],
488
+ "ghostwhite": [248, 248, 255],
489
+ "gold": [255, 215, 0],
490
+ "goldenrod": [218, 165, 32],
491
+ "gray": [128, 128, 128],
492
+ "green": [0, 128, 0],
493
+ "greenyellow": [173, 255, 47],
494
+ "grey": [128, 128, 128],
495
+ "honeydew": [240, 255, 240],
496
+ "hotpink": [255, 105, 180],
497
+ "indianred": [205, 92, 92],
498
+ "indigo": [75, 0, 130],
499
+ "ivory": [255, 255, 240],
500
+ "khaki": [240, 230, 140],
501
+ "lavender": [230, 230, 250],
502
+ "lavenderblush": [255, 240, 245],
503
+ "lawngreen": [124, 252, 0],
504
+ "lemonchiffon": [255, 250, 205],
505
+ "lightblue": [173, 216, 230],
506
+ "lightcoral": [240, 128, 128],
507
+ "lightcyan": [224, 255, 255],
508
+ "lightgoldenrodyellow": [250, 250, 210],
509
+ "lightgray": [211, 211, 211],
510
+ "lightgreen": [144, 238, 144],
511
+ "lightgrey": [211, 211, 211],
512
+ "lightpink": [255, 182, 193],
513
+ "lightsalmon": [255, 160, 122],
514
+ "lightseagreen": [32, 178, 170],
515
+ "lightskyblue": [135, 206, 250],
516
+ "lightslategray": [119, 136, 153],
517
+ "lightslategrey": [119, 136, 153],
518
+ "lightsteelblue": [176, 196, 222],
519
+ "lightyellow": [255, 255, 224],
520
+ "lime": [0, 255, 0],
521
+ "limegreen": [50, 205, 50],
522
+ "linen": [250, 240, 230],
523
+ "magenta": [255, 0, 255],
524
+ "maroon": [128, 0, 0],
525
+ "mediumaquamarine": [102, 205, 170],
526
+ "mediumblue": [0, 0, 205],
527
+ "mediumorchid": [186, 85, 211],
528
+ "mediumpurple": [147, 112, 219],
529
+ "mediumseagreen": [60, 179, 113],
530
+ "mediumslateblue": [123, 104, 238],
531
+ "mediumspringgreen": [0, 250, 154],
532
+ "mediumturquoise": [72, 209, 204],
533
+ "mediumvioletred": [199, 21, 133],
534
+ "midnightblue": [25, 25, 112],
535
+ "mintcream": [245, 255, 250],
536
+ "mistyrose": [255, 228, 225],
537
+ "moccasin": [255, 228, 181],
538
+ "navajowhite": [255, 222, 173],
539
+ "navy": [0, 0, 128],
540
+ "oldlace": [253, 245, 230],
541
+ "olive": [128, 128, 0],
542
+ "olivedrab": [107, 142, 35],
543
+ "orange": [255, 165, 0],
544
+ "orangered": [255, 69, 0],
545
+ "orchid": [218, 112, 214],
546
+ "palegoldenrod": [238, 232, 170],
547
+ "palegreen": [152, 251, 152],
548
+ "paleturquoise": [175, 238, 238],
549
+ "palevioletred": [219, 112, 147],
550
+ "papayawhip": [255, 239, 213],
551
+ "peachpuff": [255, 218, 185],
552
+ "peru": [205, 133, 63],
553
+ "pink": [255, 192, 203],
554
+ "plum": [221, 160, 221],
555
+ "powderblue": [176, 224, 230],
556
+ "purple": [128, 0, 128],
557
+ "rebeccapurple": [102, 51, 153],
558
+ "red": [255, 0, 0],
559
+ "rosybrown": [188, 143, 143],
560
+ "royalblue": [65, 105, 225],
561
+ "saddlebrown": [139, 69, 19],
562
+ "salmon": [250, 128, 114],
563
+ "sandybrown": [244, 164, 96],
564
+ "seagreen": [46, 139, 87],
565
+ "seashell": [255, 245, 238],
566
+ "sienna": [160, 82, 45],
567
+ "silver": [192, 192, 192],
568
+ "skyblue": [135, 206, 235],
569
+ "slateblue": [106, 90, 205],
570
+ "slategray": [112, 128, 144],
571
+ "slategrey": [112, 128, 144],
572
+ "snow": [255, 250, 250],
573
+ "springgreen": [0, 255, 127],
574
+ "steelblue": [70, 130, 180],
575
+ "tan": [210, 180, 140],
576
+ "teal": [0, 128, 128],
577
+ "thistle": [216, 191, 216],
578
+ "tomato": [255, 99, 71],
579
+ "turquoise": [64, 224, 208],
580
+ "violet": [238, 130, 238],
581
+ "wheat": [245, 222, 179],
582
+ "white": [255, 255, 255],
583
+ "whitesmoke": [245, 245, 245],
584
+ "yellow": [255, 255, 0],
585
+ "yellowgreen": [154, 205, 50]
586
+ };
587
+ }
588
+ });
589
+
590
+ // ../../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js
591
+ var require_conversions = __commonJS({
592
+ "../../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js"(exports, module) {
593
+ "use strict";
594
+ init_esm();
595
+ var cssKeywords = require_color_name();
596
+ var reverseKeywords = {};
597
+ for (const key of Object.keys(cssKeywords)) {
598
+ reverseKeywords[cssKeywords[key]] = key;
599
+ }
600
+ var convert = {
601
+ rgb: { channels: 3, labels: "rgb" },
602
+ hsl: { channels: 3, labels: "hsl" },
603
+ hsv: { channels: 3, labels: "hsv" },
604
+ hwb: { channels: 3, labels: "hwb" },
605
+ cmyk: { channels: 4, labels: "cmyk" },
606
+ xyz: { channels: 3, labels: "xyz" },
607
+ lab: { channels: 3, labels: "lab" },
608
+ lch: { channels: 3, labels: "lch" },
609
+ hex: { channels: 1, labels: ["hex"] },
610
+ keyword: { channels: 1, labels: ["keyword"] },
611
+ ansi16: { channels: 1, labels: ["ansi16"] },
612
+ ansi256: { channels: 1, labels: ["ansi256"] },
613
+ hcg: { channels: 3, labels: ["h", "c", "g"] },
614
+ apple: { channels: 3, labels: ["r16", "g16", "b16"] },
615
+ gray: { channels: 1, labels: ["gray"] }
616
+ };
617
+ module.exports = convert;
618
+ for (const model of Object.keys(convert)) {
619
+ if (!("channels" in convert[model])) {
620
+ throw new Error("missing channels property: " + model);
621
+ }
622
+ if (!("labels" in convert[model])) {
623
+ throw new Error("missing channel labels property: " + model);
624
+ }
625
+ if (convert[model].labels.length !== convert[model].channels) {
626
+ throw new Error("channel and label counts mismatch: " + model);
627
+ }
628
+ const { channels, labels } = convert[model];
629
+ delete convert[model].channels;
630
+ delete convert[model].labels;
631
+ Object.defineProperty(convert[model], "channels", { value: channels });
632
+ Object.defineProperty(convert[model], "labels", { value: labels });
633
+ }
634
+ convert.rgb.hsl = function(rgb) {
635
+ const r = rgb[0] / 255;
636
+ const g = rgb[1] / 255;
637
+ const b = rgb[2] / 255;
638
+ const min = Math.min(r, g, b);
639
+ const max = Math.max(r, g, b);
640
+ const delta = max - min;
641
+ let h;
642
+ let s;
643
+ if (max === min) {
644
+ h = 0;
645
+ } else if (r === max) {
646
+ h = (g - b) / delta;
647
+ } else if (g === max) {
648
+ h = 2 + (b - r) / delta;
649
+ } else if (b === max) {
650
+ h = 4 + (r - g) / delta;
651
+ }
652
+ h = Math.min(h * 60, 360);
653
+ if (h < 0) {
654
+ h += 360;
655
+ }
656
+ const l = (min + max) / 2;
657
+ if (max === min) {
658
+ s = 0;
659
+ } else if (l <= 0.5) {
660
+ s = delta / (max + min);
661
+ } else {
662
+ s = delta / (2 - max - min);
663
+ }
664
+ return [h, s * 100, l * 100];
665
+ };
666
+ convert.rgb.hsv = function(rgb) {
667
+ let rdif;
668
+ let gdif;
669
+ let bdif;
670
+ let h;
671
+ let s;
672
+ const r = rgb[0] / 255;
673
+ const g = rgb[1] / 255;
674
+ const b = rgb[2] / 255;
675
+ const v = Math.max(r, g, b);
676
+ const diff = v - Math.min(r, g, b);
677
+ const diffc = function(c) {
678
+ return (v - c) / 6 / diff + 1 / 2;
679
+ };
680
+ if (diff === 0) {
681
+ h = 0;
682
+ s = 0;
683
+ } else {
684
+ s = diff / v;
685
+ rdif = diffc(r);
686
+ gdif = diffc(g);
687
+ bdif = diffc(b);
688
+ if (r === v) {
689
+ h = bdif - gdif;
690
+ } else if (g === v) {
691
+ h = 1 / 3 + rdif - bdif;
692
+ } else if (b === v) {
693
+ h = 2 / 3 + gdif - rdif;
694
+ }
695
+ if (h < 0) {
696
+ h += 1;
697
+ } else if (h > 1) {
698
+ h -= 1;
699
+ }
700
+ }
701
+ return [
702
+ h * 360,
703
+ s * 100,
704
+ v * 100
705
+ ];
706
+ };
707
+ convert.rgb.hwb = function(rgb) {
708
+ const r = rgb[0];
709
+ const g = rgb[1];
710
+ let b = rgb[2];
711
+ const h = convert.rgb.hsl(rgb)[0];
712
+ const w = 1 / 255 * Math.min(r, Math.min(g, b));
713
+ b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
714
+ return [h, w * 100, b * 100];
715
+ };
716
+ convert.rgb.cmyk = function(rgb) {
717
+ const r = rgb[0] / 255;
718
+ const g = rgb[1] / 255;
719
+ const b = rgb[2] / 255;
720
+ const k = Math.min(1 - r, 1 - g, 1 - b);
721
+ const c = (1 - r - k) / (1 - k) || 0;
722
+ const m = (1 - g - k) / (1 - k) || 0;
723
+ const y = (1 - b - k) / (1 - k) || 0;
724
+ return [c * 100, m * 100, y * 100, k * 100];
725
+ };
726
+ function comparativeDistance(x, y) {
727
+ return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
728
+ }
729
+ convert.rgb.keyword = function(rgb) {
730
+ const reversed = reverseKeywords[rgb];
731
+ if (reversed) {
732
+ return reversed;
733
+ }
734
+ let currentClosestDistance = Infinity;
735
+ let currentClosestKeyword;
736
+ for (const keyword of Object.keys(cssKeywords)) {
737
+ const value = cssKeywords[keyword];
738
+ const distance = comparativeDistance(rgb, value);
739
+ if (distance < currentClosestDistance) {
740
+ currentClosestDistance = distance;
741
+ currentClosestKeyword = keyword;
742
+ }
743
+ }
744
+ return currentClosestKeyword;
745
+ };
746
+ convert.keyword.rgb = function(keyword) {
747
+ return cssKeywords[keyword];
748
+ };
749
+ convert.rgb.xyz = function(rgb) {
750
+ let r = rgb[0] / 255;
751
+ let g = rgb[1] / 255;
752
+ let b = rgb[2] / 255;
753
+ r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
754
+ g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
755
+ b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
756
+ const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
757
+ const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
758
+ const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
759
+ return [x * 100, y * 100, z * 100];
760
+ };
761
+ convert.rgb.lab = function(rgb) {
762
+ const xyz = convert.rgb.xyz(rgb);
763
+ let x = xyz[0];
764
+ let y = xyz[1];
765
+ let z = xyz[2];
766
+ x /= 95.047;
767
+ y /= 100;
768
+ z /= 108.883;
769
+ x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
770
+ y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
771
+ z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
772
+ const l = 116 * y - 16;
773
+ const a = 500 * (x - y);
774
+ const b = 200 * (y - z);
775
+ return [l, a, b];
776
+ };
777
+ convert.hsl.rgb = function(hsl) {
778
+ const h = hsl[0] / 360;
779
+ const s = hsl[1] / 100;
780
+ const l = hsl[2] / 100;
781
+ let t2;
782
+ let t3;
783
+ let val;
784
+ if (s === 0) {
785
+ val = l * 255;
786
+ return [val, val, val];
787
+ }
788
+ if (l < 0.5) {
789
+ t2 = l * (1 + s);
790
+ } else {
791
+ t2 = l + s - l * s;
792
+ }
793
+ const t1 = 2 * l - t2;
794
+ const rgb = [0, 0, 0];
795
+ for (let i = 0; i < 3; i++) {
796
+ t3 = h + 1 / 3 * -(i - 1);
797
+ if (t3 < 0) {
798
+ t3++;
799
+ }
800
+ if (t3 > 1) {
801
+ t3--;
802
+ }
803
+ if (6 * t3 < 1) {
804
+ val = t1 + (t2 - t1) * 6 * t3;
805
+ } else if (2 * t3 < 1) {
806
+ val = t2;
807
+ } else if (3 * t3 < 2) {
808
+ val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
809
+ } else {
810
+ val = t1;
811
+ }
812
+ rgb[i] = val * 255;
813
+ }
814
+ return rgb;
815
+ };
816
+ convert.hsl.hsv = function(hsl) {
817
+ const h = hsl[0];
818
+ let s = hsl[1] / 100;
819
+ let l = hsl[2] / 100;
820
+ let smin = s;
821
+ const lmin = Math.max(l, 0.01);
822
+ l *= 2;
823
+ s *= l <= 1 ? l : 2 - l;
824
+ smin *= lmin <= 1 ? lmin : 2 - lmin;
825
+ const v = (l + s) / 2;
826
+ const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
827
+ return [h, sv * 100, v * 100];
828
+ };
829
+ convert.hsv.rgb = function(hsv) {
830
+ const h = hsv[0] / 60;
831
+ const s = hsv[1] / 100;
832
+ let v = hsv[2] / 100;
833
+ const hi = Math.floor(h) % 6;
834
+ const f = h - Math.floor(h);
835
+ const p = 255 * v * (1 - s);
836
+ const q = 255 * v * (1 - s * f);
837
+ const t = 255 * v * (1 - s * (1 - f));
838
+ v *= 255;
839
+ switch (hi) {
840
+ case 0:
841
+ return [v, t, p];
842
+ case 1:
843
+ return [q, v, p];
844
+ case 2:
845
+ return [p, v, t];
846
+ case 3:
847
+ return [p, q, v];
848
+ case 4:
849
+ return [t, p, v];
850
+ case 5:
851
+ return [v, p, q];
852
+ }
853
+ };
854
+ convert.hsv.hsl = function(hsv) {
855
+ const h = hsv[0];
856
+ const s = hsv[1] / 100;
857
+ const v = hsv[2] / 100;
858
+ const vmin = Math.max(v, 0.01);
859
+ let sl;
860
+ let l;
861
+ l = (2 - s) * v;
862
+ const lmin = (2 - s) * vmin;
863
+ sl = s * vmin;
864
+ sl /= lmin <= 1 ? lmin : 2 - lmin;
865
+ sl = sl || 0;
866
+ l /= 2;
867
+ return [h, sl * 100, l * 100];
868
+ };
869
+ convert.hwb.rgb = function(hwb) {
870
+ const h = hwb[0] / 360;
871
+ let wh = hwb[1] / 100;
872
+ let bl = hwb[2] / 100;
873
+ const ratio = wh + bl;
874
+ let f;
875
+ if (ratio > 1) {
876
+ wh /= ratio;
877
+ bl /= ratio;
878
+ }
879
+ const i = Math.floor(6 * h);
880
+ const v = 1 - bl;
881
+ f = 6 * h - i;
882
+ if ((i & 1) !== 0) {
883
+ f = 1 - f;
884
+ }
885
+ const n = wh + f * (v - wh);
886
+ let r;
887
+ let g;
888
+ let b;
889
+ switch (i) {
890
+ default:
891
+ case 6:
892
+ case 0:
893
+ r = v;
894
+ g = n;
895
+ b = wh;
896
+ break;
897
+ case 1:
898
+ r = n;
899
+ g = v;
900
+ b = wh;
901
+ break;
902
+ case 2:
903
+ r = wh;
904
+ g = v;
905
+ b = n;
906
+ break;
907
+ case 3:
908
+ r = wh;
909
+ g = n;
910
+ b = v;
911
+ break;
912
+ case 4:
913
+ r = n;
914
+ g = wh;
915
+ b = v;
916
+ break;
917
+ case 5:
918
+ r = v;
919
+ g = wh;
920
+ b = n;
921
+ break;
922
+ }
923
+ return [r * 255, g * 255, b * 255];
924
+ };
925
+ convert.cmyk.rgb = function(cmyk) {
926
+ const c = cmyk[0] / 100;
927
+ const m = cmyk[1] / 100;
928
+ const y = cmyk[2] / 100;
929
+ const k = cmyk[3] / 100;
930
+ const r = 1 - Math.min(1, c * (1 - k) + k);
931
+ const g = 1 - Math.min(1, m * (1 - k) + k);
932
+ const b = 1 - Math.min(1, y * (1 - k) + k);
933
+ return [r * 255, g * 255, b * 255];
934
+ };
935
+ convert.xyz.rgb = function(xyz) {
936
+ const x = xyz[0] / 100;
937
+ const y = xyz[1] / 100;
938
+ const z = xyz[2] / 100;
939
+ let r;
940
+ let g;
941
+ let b;
942
+ r = x * 3.2406 + y * -1.5372 + z * -0.4986;
943
+ g = x * -0.9689 + y * 1.8758 + z * 0.0415;
944
+ b = x * 0.0557 + y * -0.204 + z * 1.057;
945
+ r = r > 31308e-7 ? 1.055 * r ** (1 / 2.4) - 0.055 : r * 12.92;
946
+ g = g > 31308e-7 ? 1.055 * g ** (1 / 2.4) - 0.055 : g * 12.92;
947
+ b = b > 31308e-7 ? 1.055 * b ** (1 / 2.4) - 0.055 : b * 12.92;
948
+ r = Math.min(Math.max(0, r), 1);
949
+ g = Math.min(Math.max(0, g), 1);
950
+ b = Math.min(Math.max(0, b), 1);
951
+ return [r * 255, g * 255, b * 255];
952
+ };
953
+ convert.xyz.lab = function(xyz) {
954
+ let x = xyz[0];
955
+ let y = xyz[1];
956
+ let z = xyz[2];
957
+ x /= 95.047;
958
+ y /= 100;
959
+ z /= 108.883;
960
+ x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
961
+ y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
962
+ z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
963
+ const l = 116 * y - 16;
964
+ const a = 500 * (x - y);
965
+ const b = 200 * (y - z);
966
+ return [l, a, b];
967
+ };
968
+ convert.lab.xyz = function(lab) {
969
+ const l = lab[0];
970
+ const a = lab[1];
971
+ const b = lab[2];
972
+ let x;
973
+ let y;
974
+ let z;
975
+ y = (l + 16) / 116;
976
+ x = a / 500 + y;
977
+ z = y - b / 200;
978
+ const y2 = y ** 3;
979
+ const x2 = x ** 3;
980
+ const z2 = z ** 3;
981
+ y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
982
+ x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
983
+ z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
984
+ x *= 95.047;
985
+ y *= 100;
986
+ z *= 108.883;
987
+ return [x, y, z];
988
+ };
989
+ convert.lab.lch = function(lab) {
990
+ const l = lab[0];
991
+ const a = lab[1];
992
+ const b = lab[2];
993
+ let h;
994
+ const hr = Math.atan2(b, a);
995
+ h = hr * 360 / 2 / Math.PI;
996
+ if (h < 0) {
997
+ h += 360;
998
+ }
999
+ const c = Math.sqrt(a * a + b * b);
1000
+ return [l, c, h];
1001
+ };
1002
+ convert.lch.lab = function(lch) {
1003
+ const l = lch[0];
1004
+ const c = lch[1];
1005
+ const h = lch[2];
1006
+ const hr = h / 360 * 2 * Math.PI;
1007
+ const a = c * Math.cos(hr);
1008
+ const b = c * Math.sin(hr);
1009
+ return [l, a, b];
1010
+ };
1011
+ convert.rgb.ansi16 = function(args, saturation = null) {
1012
+ const [r, g, b] = args;
1013
+ let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
1014
+ value = Math.round(value / 50);
1015
+ if (value === 0) {
1016
+ return 30;
1017
+ }
1018
+ let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
1019
+ if (value === 2) {
1020
+ ansi += 60;
1021
+ }
1022
+ return ansi;
1023
+ };
1024
+ convert.hsv.ansi16 = function(args) {
1025
+ return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
1026
+ };
1027
+ convert.rgb.ansi256 = function(args) {
1028
+ const r = args[0];
1029
+ const g = args[1];
1030
+ const b = args[2];
1031
+ if (r === g && g === b) {
1032
+ if (r < 8) {
1033
+ return 16;
1034
+ }
1035
+ if (r > 248) {
1036
+ return 231;
1037
+ }
1038
+ return Math.round((r - 8) / 247 * 24) + 232;
1039
+ }
1040
+ const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
1041
+ return ansi;
1042
+ };
1043
+ convert.ansi16.rgb = function(args) {
1044
+ let color3 = args % 10;
1045
+ if (color3 === 0 || color3 === 7) {
1046
+ if (args > 50) {
1047
+ color3 += 3.5;
1048
+ }
1049
+ color3 = color3 / 10.5 * 255;
1050
+ return [color3, color3, color3];
1051
+ }
1052
+ const mult = (~~(args > 50) + 1) * 0.5;
1053
+ const r = (color3 & 1) * mult * 255;
1054
+ const g = (color3 >> 1 & 1) * mult * 255;
1055
+ const b = (color3 >> 2 & 1) * mult * 255;
1056
+ return [r, g, b];
1057
+ };
1058
+ convert.ansi256.rgb = function(args) {
1059
+ if (args >= 232) {
1060
+ const c = (args - 232) * 10 + 8;
1061
+ return [c, c, c];
1062
+ }
1063
+ args -= 16;
1064
+ let rem;
1065
+ const r = Math.floor(args / 36) / 5 * 255;
1066
+ const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
1067
+ const b = rem % 6 / 5 * 255;
1068
+ return [r, g, b];
1069
+ };
1070
+ convert.rgb.hex = function(args) {
1071
+ const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
1072
+ const string = integer.toString(16).toUpperCase();
1073
+ return "000000".substring(string.length) + string;
1074
+ };
1075
+ convert.hex.rgb = function(args) {
1076
+ const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
1077
+ if (!match) {
1078
+ return [0, 0, 0];
1079
+ }
1080
+ let colorString = match[0];
1081
+ if (match[0].length === 3) {
1082
+ colorString = colorString.split("").map((char) => {
1083
+ return char + char;
1084
+ }).join("");
1085
+ }
1086
+ const integer = parseInt(colorString, 16);
1087
+ const r = integer >> 16 & 255;
1088
+ const g = integer >> 8 & 255;
1089
+ const b = integer & 255;
1090
+ return [r, g, b];
1091
+ };
1092
+ convert.rgb.hcg = function(rgb) {
1093
+ const r = rgb[0] / 255;
1094
+ const g = rgb[1] / 255;
1095
+ const b = rgb[2] / 255;
1096
+ const max = Math.max(Math.max(r, g), b);
1097
+ const min = Math.min(Math.min(r, g), b);
1098
+ const chroma = max - min;
1099
+ let grayscale;
1100
+ let hue;
1101
+ if (chroma < 1) {
1102
+ grayscale = min / (1 - chroma);
1103
+ } else {
1104
+ grayscale = 0;
1105
+ }
1106
+ if (chroma <= 0) {
1107
+ hue = 0;
1108
+ } else if (max === r) {
1109
+ hue = (g - b) / chroma % 6;
1110
+ } else if (max === g) {
1111
+ hue = 2 + (b - r) / chroma;
1112
+ } else {
1113
+ hue = 4 + (r - g) / chroma;
1114
+ }
1115
+ hue /= 6;
1116
+ hue %= 1;
1117
+ return [hue * 360, chroma * 100, grayscale * 100];
1118
+ };
1119
+ convert.hsl.hcg = function(hsl) {
1120
+ const s = hsl[1] / 100;
1121
+ const l = hsl[2] / 100;
1122
+ const c = l < 0.5 ? 2 * s * l : 2 * s * (1 - l);
1123
+ let f = 0;
1124
+ if (c < 1) {
1125
+ f = (l - 0.5 * c) / (1 - c);
1126
+ }
1127
+ return [hsl[0], c * 100, f * 100];
1128
+ };
1129
+ convert.hsv.hcg = function(hsv) {
1130
+ const s = hsv[1] / 100;
1131
+ const v = hsv[2] / 100;
1132
+ const c = s * v;
1133
+ let f = 0;
1134
+ if (c < 1) {
1135
+ f = (v - c) / (1 - c);
1136
+ }
1137
+ return [hsv[0], c * 100, f * 100];
1138
+ };
1139
+ convert.hcg.rgb = function(hcg) {
1140
+ const h = hcg[0] / 360;
1141
+ const c = hcg[1] / 100;
1142
+ const g = hcg[2] / 100;
1143
+ if (c === 0) {
1144
+ return [g * 255, g * 255, g * 255];
1145
+ }
1146
+ const pure = [0, 0, 0];
1147
+ const hi = h % 1 * 6;
1148
+ const v = hi % 1;
1149
+ const w = 1 - v;
1150
+ let mg = 0;
1151
+ switch (Math.floor(hi)) {
1152
+ case 0:
1153
+ pure[0] = 1;
1154
+ pure[1] = v;
1155
+ pure[2] = 0;
1156
+ break;
1157
+ case 1:
1158
+ pure[0] = w;
1159
+ pure[1] = 1;
1160
+ pure[2] = 0;
1161
+ break;
1162
+ case 2:
1163
+ pure[0] = 0;
1164
+ pure[1] = 1;
1165
+ pure[2] = v;
1166
+ break;
1167
+ case 3:
1168
+ pure[0] = 0;
1169
+ pure[1] = w;
1170
+ pure[2] = 1;
1171
+ break;
1172
+ case 4:
1173
+ pure[0] = v;
1174
+ pure[1] = 0;
1175
+ pure[2] = 1;
1176
+ break;
1177
+ default:
1178
+ pure[0] = 1;
1179
+ pure[1] = 0;
1180
+ pure[2] = w;
1181
+ }
1182
+ mg = (1 - c) * g;
1183
+ return [
1184
+ (c * pure[0] + mg) * 255,
1185
+ (c * pure[1] + mg) * 255,
1186
+ (c * pure[2] + mg) * 255
1187
+ ];
1188
+ };
1189
+ convert.hcg.hsv = function(hcg) {
1190
+ const c = hcg[1] / 100;
1191
+ const g = hcg[2] / 100;
1192
+ const v = c + g * (1 - c);
1193
+ let f = 0;
1194
+ if (v > 0) {
1195
+ f = c / v;
1196
+ }
1197
+ return [hcg[0], f * 100, v * 100];
1198
+ };
1199
+ convert.hcg.hsl = function(hcg) {
1200
+ const c = hcg[1] / 100;
1201
+ const g = hcg[2] / 100;
1202
+ const l = g * (1 - c) + 0.5 * c;
1203
+ let s = 0;
1204
+ if (l > 0 && l < 0.5) {
1205
+ s = c / (2 * l);
1206
+ } else if (l >= 0.5 && l < 1) {
1207
+ s = c / (2 * (1 - l));
1208
+ }
1209
+ return [hcg[0], s * 100, l * 100];
1210
+ };
1211
+ convert.hcg.hwb = function(hcg) {
1212
+ const c = hcg[1] / 100;
1213
+ const g = hcg[2] / 100;
1214
+ const v = c + g * (1 - c);
1215
+ return [hcg[0], (v - c) * 100, (1 - v) * 100];
1216
+ };
1217
+ convert.hwb.hcg = function(hwb) {
1218
+ const w = hwb[1] / 100;
1219
+ const b = hwb[2] / 100;
1220
+ const v = 1 - b;
1221
+ const c = v - w;
1222
+ let g = 0;
1223
+ if (c < 1) {
1224
+ g = (v - c) / (1 - c);
1225
+ }
1226
+ return [hwb[0], c * 100, g * 100];
1227
+ };
1228
+ convert.apple.rgb = function(apple) {
1229
+ return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
1230
+ };
1231
+ convert.rgb.apple = function(rgb) {
1232
+ return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
1233
+ };
1234
+ convert.gray.rgb = function(args) {
1235
+ return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
1236
+ };
1237
+ convert.gray.hsl = function(args) {
1238
+ return [0, 0, args[0]];
1239
+ };
1240
+ convert.gray.hsv = convert.gray.hsl;
1241
+ convert.gray.hwb = function(gray) {
1242
+ return [0, 100, gray[0]];
1243
+ };
1244
+ convert.gray.cmyk = function(gray) {
1245
+ return [0, 0, 0, gray[0]];
1246
+ };
1247
+ convert.gray.lab = function(gray) {
1248
+ return [gray[0], 0, 0];
1249
+ };
1250
+ convert.gray.hex = function(gray) {
1251
+ const val = Math.round(gray[0] / 100 * 255) & 255;
1252
+ const integer = (val << 16) + (val << 8) + val;
1253
+ const string = integer.toString(16).toUpperCase();
1254
+ return "000000".substring(string.length) + string;
1255
+ };
1256
+ convert.rgb.gray = function(rgb) {
1257
+ const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
1258
+ return [val / 255 * 100];
1259
+ };
1260
+ }
1261
+ });
1262
+
1263
+ // ../../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js
1264
+ var require_route = __commonJS({
1265
+ "../../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js"(exports, module) {
1266
+ "use strict";
1267
+ init_esm();
1268
+ var conversions = require_conversions();
1269
+ function buildGraph() {
1270
+ const graph = {};
1271
+ const models = Object.keys(conversions);
1272
+ for (let len = models.length, i = 0; i < len; i++) {
1273
+ graph[models[i]] = {
1274
+ // http://jsperf.com/1-vs-infinity
1275
+ // micro-opt, but this is simple.
1276
+ distance: -1,
1277
+ parent: null
1278
+ };
1279
+ }
1280
+ return graph;
1281
+ }
1282
+ function deriveBFS(fromModel) {
1283
+ const graph = buildGraph();
1284
+ const queue = [fromModel];
1285
+ graph[fromModel].distance = 0;
1286
+ while (queue.length) {
1287
+ const current = queue.pop();
1288
+ const adjacents = Object.keys(conversions[current]);
1289
+ for (let len = adjacents.length, i = 0; i < len; i++) {
1290
+ const adjacent = adjacents[i];
1291
+ const node = graph[adjacent];
1292
+ if (node.distance === -1) {
1293
+ node.distance = graph[current].distance + 1;
1294
+ node.parent = current;
1295
+ queue.unshift(adjacent);
1296
+ }
1297
+ }
1298
+ }
1299
+ return graph;
1300
+ }
1301
+ function link(from, to) {
1302
+ return function(args) {
1303
+ return to(from(args));
1304
+ };
1305
+ }
1306
+ function wrapConversion(toModel, graph) {
1307
+ const path2 = [graph[toModel].parent, toModel];
1308
+ let fn = conversions[graph[toModel].parent][toModel];
1309
+ let cur = graph[toModel].parent;
1310
+ while (graph[cur].parent) {
1311
+ path2.unshift(graph[cur].parent);
1312
+ fn = link(conversions[graph[cur].parent][cur], fn);
1313
+ cur = graph[cur].parent;
1314
+ }
1315
+ fn.conversion = path2;
1316
+ return fn;
1317
+ }
1318
+ module.exports = function(fromModel) {
1319
+ const graph = deriveBFS(fromModel);
1320
+ const conversion = {};
1321
+ const models = Object.keys(graph);
1322
+ for (let len = models.length, i = 0; i < len; i++) {
1323
+ const toModel = models[i];
1324
+ const node = graph[toModel];
1325
+ if (node.parent === null) {
1326
+ continue;
1327
+ }
1328
+ conversion[toModel] = wrapConversion(toModel, graph);
1329
+ }
1330
+ return conversion;
1331
+ };
1332
+ }
1333
+ });
1334
+
1335
+ // ../../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js
1336
+ var require_color_convert = __commonJS({
1337
+ "../../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js"(exports, module) {
1338
+ "use strict";
1339
+ init_esm();
1340
+ var conversions = require_conversions();
1341
+ var route = require_route();
1342
+ var convert = {};
1343
+ var models = Object.keys(conversions);
1344
+ function wrapRaw(fn) {
1345
+ const wrappedFn = function(...args) {
1346
+ const arg0 = args[0];
1347
+ if (arg0 === void 0 || arg0 === null) {
1348
+ return arg0;
1349
+ }
1350
+ if (arg0.length > 1) {
1351
+ args = arg0;
1352
+ }
1353
+ return fn(args);
1354
+ };
1355
+ if ("conversion" in fn) {
1356
+ wrappedFn.conversion = fn.conversion;
1357
+ }
1358
+ return wrappedFn;
1359
+ }
1360
+ function wrapRounded(fn) {
1361
+ const wrappedFn = function(...args) {
1362
+ const arg0 = args[0];
1363
+ if (arg0 === void 0 || arg0 === null) {
1364
+ return arg0;
1365
+ }
1366
+ if (arg0.length > 1) {
1367
+ args = arg0;
1368
+ }
1369
+ const result = fn(args);
1370
+ if (typeof result === "object") {
1371
+ for (let len = result.length, i = 0; i < len; i++) {
1372
+ result[i] = Math.round(result[i]);
1373
+ }
1374
+ }
1375
+ return result;
1376
+ };
1377
+ if ("conversion" in fn) {
1378
+ wrappedFn.conversion = fn.conversion;
1379
+ }
1380
+ return wrappedFn;
1381
+ }
1382
+ models.forEach((fromModel) => {
1383
+ convert[fromModel] = {};
1384
+ Object.defineProperty(convert[fromModel], "channels", { value: conversions[fromModel].channels });
1385
+ Object.defineProperty(convert[fromModel], "labels", { value: conversions[fromModel].labels });
1386
+ const routes = route(fromModel);
1387
+ const routeModels = Object.keys(routes);
1388
+ routeModels.forEach((toModel) => {
1389
+ const fn = routes[toModel];
1390
+ convert[fromModel][toModel] = wrapRounded(fn);
1391
+ convert[fromModel][toModel].raw = wrapRaw(fn);
1392
+ });
1393
+ });
1394
+ module.exports = convert;
1395
+ }
1396
+ });
1397
+
1398
+ // ../../../node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js
1399
+ var require_ansi_styles = __commonJS({
1400
+ "../../../node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js"(exports, module) {
1401
+ "use strict";
1402
+ init_esm();
1403
+ var wrapAnsi16 = (fn, offset) => (...args) => {
1404
+ const code = fn(...args);
1405
+ return `\x1B[${code + offset}m`;
1406
+ };
1407
+ var wrapAnsi256 = (fn, offset) => (...args) => {
1408
+ const code = fn(...args);
1409
+ return `\x1B[${38 + offset};5;${code}m`;
1410
+ };
1411
+ var wrapAnsi16m = (fn, offset) => (...args) => {
1412
+ const rgb = fn(...args);
1413
+ return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
1414
+ };
1415
+ var ansi2ansi = (n) => n;
1416
+ var rgb2rgb = (r, g, b) => [r, g, b];
1417
+ var setLazyProperty = (object, property, get) => {
1418
+ Object.defineProperty(object, property, {
1419
+ get: () => {
1420
+ const value = get();
1421
+ Object.defineProperty(object, property, {
1422
+ value,
1423
+ enumerable: true,
1424
+ configurable: true
1425
+ });
1426
+ return value;
1427
+ },
1428
+ enumerable: true,
1429
+ configurable: true
1430
+ });
1431
+ };
1432
+ var colorConvert;
1433
+ var makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
1434
+ if (colorConvert === void 0) {
1435
+ colorConvert = require_color_convert();
1436
+ }
1437
+ const offset = isBackground ? 10 : 0;
1438
+ const styles = {};
1439
+ for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
1440
+ const name = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
1441
+ if (sourceSpace === targetSpace) {
1442
+ styles[name] = wrap(identity, offset);
1443
+ } else if (typeof suite === "object") {
1444
+ styles[name] = wrap(suite[targetSpace], offset);
1445
+ }
1446
+ }
1447
+ return styles;
1448
+ };
1449
+ function assembleStyles() {
1450
+ const codes = /* @__PURE__ */ new Map();
1451
+ const styles = {
1452
+ modifier: {
1453
+ reset: [0, 0],
1454
+ // 21 isn't widely supported and 22 does the same thing
1455
+ bold: [1, 22],
1456
+ dim: [2, 22],
1457
+ italic: [3, 23],
1458
+ underline: [4, 24],
1459
+ inverse: [7, 27],
1460
+ hidden: [8, 28],
1461
+ strikethrough: [9, 29]
1462
+ },
1463
+ color: {
1464
+ black: [30, 39],
1465
+ red: [31, 39],
1466
+ green: [32, 39],
1467
+ yellow: [33, 39],
1468
+ blue: [34, 39],
1469
+ magenta: [35, 39],
1470
+ cyan: [36, 39],
1471
+ white: [37, 39],
1472
+ // Bright color
1473
+ blackBright: [90, 39],
1474
+ redBright: [91, 39],
1475
+ greenBright: [92, 39],
1476
+ yellowBright: [93, 39],
1477
+ blueBright: [94, 39],
1478
+ magentaBright: [95, 39],
1479
+ cyanBright: [96, 39],
1480
+ whiteBright: [97, 39]
1481
+ },
1482
+ bgColor: {
1483
+ bgBlack: [40, 49],
1484
+ bgRed: [41, 49],
1485
+ bgGreen: [42, 49],
1486
+ bgYellow: [43, 49],
1487
+ bgBlue: [44, 49],
1488
+ bgMagenta: [45, 49],
1489
+ bgCyan: [46, 49],
1490
+ bgWhite: [47, 49],
1491
+ // Bright color
1492
+ bgBlackBright: [100, 49],
1493
+ bgRedBright: [101, 49],
1494
+ bgGreenBright: [102, 49],
1495
+ bgYellowBright: [103, 49],
1496
+ bgBlueBright: [104, 49],
1497
+ bgMagentaBright: [105, 49],
1498
+ bgCyanBright: [106, 49],
1499
+ bgWhiteBright: [107, 49]
1500
+ }
1501
+ };
1502
+ styles.color.gray = styles.color.blackBright;
1503
+ styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
1504
+ styles.color.grey = styles.color.blackBright;
1505
+ styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
1506
+ for (const [groupName, group] of Object.entries(styles)) {
1507
+ for (const [styleName, style] of Object.entries(group)) {
1508
+ styles[styleName] = {
1509
+ open: `\x1B[${style[0]}m`,
1510
+ close: `\x1B[${style[1]}m`
1511
+ };
1512
+ group[styleName] = styles[styleName];
1513
+ codes.set(style[0], style[1]);
1514
+ }
1515
+ Object.defineProperty(styles, groupName, {
1516
+ value: group,
1517
+ enumerable: false
1518
+ });
1519
+ }
1520
+ Object.defineProperty(styles, "codes", {
1521
+ value: codes,
1522
+ enumerable: false
1523
+ });
1524
+ styles.color.close = "\x1B[39m";
1525
+ styles.bgColor.close = "\x1B[49m";
1526
+ setLazyProperty(styles.color, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, false));
1527
+ setLazyProperty(styles.color, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, false));
1528
+ setLazyProperty(styles.color, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, false));
1529
+ setLazyProperty(styles.bgColor, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, true));
1530
+ setLazyProperty(styles.bgColor, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, true));
1531
+ setLazyProperty(styles.bgColor, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, true));
1532
+ return styles;
1533
+ }
1534
+ Object.defineProperty(module, "exports", {
1535
+ enumerable: true,
1536
+ get: assembleStyles
1537
+ });
1538
+ }
1539
+ });
1540
+
1541
+ // ../../../node_modules/.pnpm/slice-ansi@3.0.0/node_modules/slice-ansi/index.js
1542
+ var require_slice_ansi = __commonJS({
1543
+ "../../../node_modules/.pnpm/slice-ansi@3.0.0/node_modules/slice-ansi/index.js"(exports, module) {
1544
+ "use strict";
1545
+ init_esm();
1546
+ var isFullwidthCodePoint = require_is_fullwidth_code_point();
1547
+ var astralRegex = require_astral_regex();
1548
+ var ansiStyles = require_ansi_styles();
1549
+ var ESCAPES = [
1550
+ "\x1B",
1551
+ "›"
1552
+ ];
1553
+ var wrapAnsi = (code) => `${ESCAPES[0]}[${code}m`;
1554
+ var checkAnsi = (ansiCodes, isEscapes, endAnsiCode) => {
1555
+ let output = [];
1556
+ ansiCodes = [...ansiCodes];
1557
+ for (let ansiCode of ansiCodes) {
1558
+ const ansiCodeOrigin = ansiCode;
1559
+ if (ansiCode.match(";")) {
1560
+ ansiCode = ansiCode.split(";")[0][0] + "0";
1561
+ }
1562
+ const item = ansiStyles.codes.get(parseInt(ansiCode, 10));
1563
+ if (item) {
1564
+ const indexEscape = ansiCodes.indexOf(item.toString());
1565
+ if (indexEscape >= 0) {
1566
+ ansiCodes.splice(indexEscape, 1);
1567
+ } else {
1568
+ output.push(wrapAnsi(isEscapes ? item : ansiCodeOrigin));
1569
+ }
1570
+ } else if (isEscapes) {
1571
+ output.push(wrapAnsi(0));
1572
+ break;
1573
+ } else {
1574
+ output.push(wrapAnsi(ansiCodeOrigin));
1575
+ }
1576
+ }
1577
+ if (isEscapes) {
1578
+ output = output.filter((element, index) => output.indexOf(element) === index);
1579
+ if (endAnsiCode !== void 0) {
1580
+ const fistEscapeCode = wrapAnsi(ansiStyles.codes.get(parseInt(endAnsiCode, 10)));
1581
+ output = output.reduce((current, next) => next === fistEscapeCode ? [next, ...current] : [...current, next], []);
1582
+ }
1583
+ }
1584
+ return output.join("");
1585
+ };
1586
+ module.exports = (string, begin, end) => {
1587
+ const characters = [...string.normalize()];
1588
+ const ansiCodes = [];
1589
+ end = typeof end === "number" ? end : characters.length;
1590
+ let isInsideEscape = false;
1591
+ let ansiCode;
1592
+ let visible = 0;
1593
+ let output = "";
1594
+ for (const [index, character] of characters.entries()) {
1595
+ let leftEscape = false;
1596
+ if (ESCAPES.includes(character)) {
1597
+ const code = /\d[^m]*/.exec(string.slice(index, index + 18));
1598
+ ansiCode = code && code.length > 0 ? code[0] : void 0;
1599
+ if (visible < end) {
1600
+ isInsideEscape = true;
1601
+ if (ansiCode !== void 0) {
1602
+ ansiCodes.push(ansiCode);
1603
+ }
1604
+ }
1605
+ } else if (isInsideEscape && character === "m") {
1606
+ isInsideEscape = false;
1607
+ leftEscape = true;
1608
+ }
1609
+ if (!isInsideEscape && !leftEscape) {
1610
+ ++visible;
1611
+ }
1612
+ if (!astralRegex({ exact: true }).test(character) && isFullwidthCodePoint(character.codePointAt())) {
1613
+ ++visible;
1614
+ }
1615
+ if (visible > begin && visible <= end) {
1616
+ output += character;
1617
+ } else if (visible === begin && !isInsideEscape && ansiCode !== void 0) {
1618
+ output = checkAnsi(ansiCodes);
1619
+ } else if (visible >= end) {
1620
+ output += checkAnsi(ansiCodes, true, ansiCode);
1621
+ break;
1622
+ }
1623
+ }
1624
+ return output;
1625
+ };
1626
+ }
1627
+ });
1628
+
1629
+ // ../../../node_modules/.pnpm/ansi-regex@5.0.1/node_modules/ansi-regex/index.js
1630
+ var require_ansi_regex = __commonJS({
1631
+ "../../../node_modules/.pnpm/ansi-regex@5.0.1/node_modules/ansi-regex/index.js"(exports, module) {
1632
+ "use strict";
1633
+ init_esm();
1634
+ module.exports = ({ onlyFirst = false } = {}) => {
1635
+ const pattern = [
1636
+ "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
1637
+ "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
1638
+ ].join("|");
1639
+ return new RegExp(pattern, onlyFirst ? void 0 : "g");
1640
+ };
1641
+ }
1642
+ });
1643
+
1644
+ // ../../../node_modules/.pnpm/strip-ansi@6.0.1/node_modules/strip-ansi/index.js
1645
+ var require_strip_ansi = __commonJS({
1646
+ "../../../node_modules/.pnpm/strip-ansi@6.0.1/node_modules/strip-ansi/index.js"(exports, module) {
1647
+ "use strict";
1648
+ init_esm();
1649
+ var ansiRegex = require_ansi_regex();
1650
+ module.exports = (string) => typeof string === "string" ? string.replace(ansiRegex(), "") : string;
1651
+ }
1652
+ });
1653
+
1654
+ // ../../../node_modules/.pnpm/emoji-regex@8.0.0/node_modules/emoji-regex/index.js
1655
+ var require_emoji_regex = __commonJS({
1656
+ "../../../node_modules/.pnpm/emoji-regex@8.0.0/node_modules/emoji-regex/index.js"(exports, module) {
1657
+ "use strict";
1658
+ init_esm();
1659
+ module.exports = function() {
1660
+ return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
1661
+ };
1662
+ }
1663
+ });
1664
+
1665
+ // ../../../node_modules/.pnpm/string-width@4.2.3/node_modules/string-width/index.js
1666
+ var require_string_width = __commonJS({
1667
+ "../../../node_modules/.pnpm/string-width@4.2.3/node_modules/string-width/index.js"(exports, module) {
1668
+ "use strict";
1669
+ init_esm();
1670
+ var stripAnsi = require_strip_ansi();
1671
+ var isFullwidthCodePoint = require_is_fullwidth_code_point();
1672
+ var emojiRegex = require_emoji_regex();
1673
+ var stringWidth = (string) => {
1674
+ if (typeof string !== "string" || string.length === 0) {
1675
+ return 0;
1676
+ }
1677
+ string = stripAnsi(string);
1678
+ if (string.length === 0) {
1679
+ return 0;
1680
+ }
1681
+ string = string.replace(emojiRegex(), " ");
1682
+ let width = 0;
1683
+ for (let i = 0; i < string.length; i++) {
1684
+ const code = string.codePointAt(i);
1685
+ if (code <= 31 || code >= 127 && code <= 159) {
1686
+ continue;
1687
+ }
1688
+ if (code >= 768 && code <= 879) {
1689
+ continue;
1690
+ }
1691
+ if (code > 65535) {
1692
+ i++;
1693
+ }
1694
+ width += isFullwidthCodePoint(code) ? 2 : 1;
1695
+ }
1696
+ return width;
1697
+ };
1698
+ module.exports = stringWidth;
1699
+ module.exports.default = stringWidth;
1700
+ }
1701
+ });
1702
+
1703
+ // ../../../node_modules/.pnpm/cli-truncate@2.1.0/node_modules/cli-truncate/index.js
1704
+ var require_cli_truncate = __commonJS({
1705
+ "../../../node_modules/.pnpm/cli-truncate@2.1.0/node_modules/cli-truncate/index.js"(exports, module) {
1706
+ "use strict";
1707
+ init_esm();
1708
+ var sliceAnsi = require_slice_ansi();
1709
+ var stringWidth = require_string_width();
1710
+ function getIndexOfNearestSpace(string, index, shouldSearchRight) {
1711
+ if (string.charAt(index) === " ") {
1712
+ return index;
1713
+ }
1714
+ for (let i = 1; i <= 3; i++) {
1715
+ if (shouldSearchRight) {
1716
+ if (string.charAt(index + i) === " ") {
1717
+ return index + i;
1718
+ }
1719
+ } else if (string.charAt(index - i) === " ") {
1720
+ return index - i;
1721
+ }
1722
+ }
1723
+ return index;
1724
+ }
1725
+ module.exports = (text, columns, options) => {
1726
+ options = {
1727
+ position: "end",
1728
+ preferTruncationOnSpace: false,
1729
+ ...options
1730
+ };
1731
+ const { position, space, preferTruncationOnSpace } = options;
1732
+ let ellipsis = "…";
1733
+ let ellipsisWidth = 1;
1734
+ if (typeof text !== "string") {
1735
+ throw new TypeError(`Expected \`input\` to be a string, got ${typeof text}`);
1736
+ }
1737
+ if (typeof columns !== "number") {
1738
+ throw new TypeError(`Expected \`columns\` to be a number, got ${typeof columns}`);
1739
+ }
1740
+ if (columns < 1) {
1741
+ return "";
1742
+ }
1743
+ if (columns === 1) {
1744
+ return ellipsis;
1745
+ }
1746
+ const length = stringWidth(text);
1747
+ if (length <= columns) {
1748
+ return text;
1749
+ }
1750
+ if (position === "start") {
1751
+ if (preferTruncationOnSpace) {
1752
+ const nearestSpace = getIndexOfNearestSpace(text, length - columns + 1, true);
1753
+ return ellipsis + sliceAnsi(text, nearestSpace, length).trim();
1754
+ }
1755
+ if (space === true) {
1756
+ ellipsis += " ";
1757
+ ellipsisWidth = 2;
1758
+ }
1759
+ return ellipsis + sliceAnsi(text, length - columns + ellipsisWidth, length);
1760
+ }
1761
+ if (position === "middle") {
1762
+ if (space === true) {
1763
+ ellipsis = " " + ellipsis + " ";
1764
+ ellipsisWidth = 3;
1765
+ }
1766
+ const half = Math.floor(columns / 2);
1767
+ if (preferTruncationOnSpace) {
1768
+ const spaceNearFirstBreakPoint = getIndexOfNearestSpace(text, half);
1769
+ const spaceNearSecondBreakPoint = getIndexOfNearestSpace(text, length - (columns - half) + 1, true);
1770
+ return sliceAnsi(text, 0, spaceNearFirstBreakPoint) + ellipsis + sliceAnsi(text, spaceNearSecondBreakPoint, length).trim();
1771
+ }
1772
+ return sliceAnsi(text, 0, half) + ellipsis + sliceAnsi(text, length - (columns - half) + ellipsisWidth, length);
1773
+ }
1774
+ if (position === "end") {
1775
+ if (preferTruncationOnSpace) {
1776
+ const nearestSpace = getIndexOfNearestSpace(text, columns - 1);
1777
+ return sliceAnsi(text, 0, nearestSpace) + ellipsis;
1778
+ }
1779
+ if (space === true) {
1780
+ ellipsis = " " + ellipsis;
1781
+ ellipsisWidth = 2;
1782
+ }
1783
+ return sliceAnsi(text, 0, columns - ellipsisWidth) + ellipsis;
1784
+ }
1785
+ throw new Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${position}`);
1786
+ };
1787
+ }
1788
+ });
1789
+
1790
+ // ../../../node_modules/.pnpm/patch-console@1.0.0/node_modules/patch-console/build/index.js
1791
+ var require_build = __commonJS({
1792
+ "../../../node_modules/.pnpm/patch-console@1.0.0/node_modules/patch-console/build/index.js"(exports, module) {
1793
+ "use strict";
1794
+ init_esm();
1795
+ var stream_1 = __require("stream");
1796
+ var CONSOLE_METHODS = [
1797
+ "assert",
1798
+ "count",
1799
+ "countReset",
1800
+ "debug",
1801
+ "dir",
1802
+ "dirxml",
1803
+ "error",
1804
+ "group",
1805
+ "groupCollapsed",
1806
+ "groupEnd",
1807
+ "info",
1808
+ "log",
1809
+ "table",
1810
+ "time",
1811
+ "timeEnd",
1812
+ "timeLog",
1813
+ "trace",
1814
+ "warn"
1815
+ ];
1816
+ var originalMethods = {};
1817
+ var patchConsole2 = (callback) => {
1818
+ const stdout = new stream_1.PassThrough();
1819
+ const stderr = new stream_1.PassThrough();
1820
+ stdout.write = (data) => callback("stdout", data);
1821
+ stderr.write = (data) => callback("stderr", data);
1822
+ const internalConsole = new console.Console(stdout, stderr);
1823
+ for (const method of CONSOLE_METHODS) {
1824
+ originalMethods[method] = console[method];
1825
+ console[method] = internalConsole[method];
1826
+ }
1827
+ return () => {
1828
+ for (const method of CONSOLE_METHODS) {
1829
+ console[method] = originalMethods[method];
1830
+ }
1831
+ originalMethods = {};
1832
+ };
1833
+ };
1834
+ module.exports = patchConsole2;
1835
+ }
1836
+ });
1837
+
1838
+ // src/progress/helpers/utils.ts
1839
+ var clamp;
1840
+ var init_utils = __esm({
1841
+ "src/progress/helpers/utils.ts"() {
1842
+ "use strict";
1843
+ init_esm();
1844
+ clamp = (x, min, max) => {
1845
+ return Math.min(max, Math.max(min, x));
1846
+ };
1847
+ }
1848
+ });
1849
+
1850
+ // src/progress/helpers/bar.ts
1851
+ import colors from "picocolors";
1852
+ var import_cli_truncate, defaultOption, padding, FULL_WIDTH, MIDDLE_WIDTH, renderBar;
1853
+ var init_bar = __esm({
1854
+ "src/progress/helpers/bar.ts"() {
1855
+ "use strict";
1856
+ init_esm();
1857
+ import_cli_truncate = __toESM(require_cli_truncate());
1858
+ init_utils();
1859
+ defaultOption = {
1860
+ total: 100,
1861
+ current: 0,
1862
+ color: "green",
1863
+ bgColor: "gray",
1864
+ char: "━",
1865
+ width: 25,
1866
+ buildIcon: "◯",
1867
+ errorIcon: "✖",
1868
+ errorInfo: "compile failed",
1869
+ message: "",
1870
+ done: false,
1871
+ spaceWidth: 1,
1872
+ messageWidth: 25,
1873
+ messageColor: "gray",
1874
+ id: "",
1875
+ maxIdLen: 16,
1876
+ hasErrors: false
1877
+ };
1878
+ padding = (id, maxLen) => {
1879
+ const left = Math.floor((maxLen - id.length) / 2);
1880
+ const right = maxLen - left - id.length;
1881
+ return " ".repeat(left) + id + " ".repeat(right);
1882
+ };
1883
+ FULL_WIDTH = 70;
1884
+ MIDDLE_WIDTH = 40;
1885
+ renderBar = (option) => {
1886
+ const mergedOptions = {
1887
+ ...defaultOption,
1888
+ ...option
1889
+ };
1890
+ const {
1891
+ total,
1892
+ done,
1893
+ buildIcon,
1894
+ errorIcon,
1895
+ errorInfo,
1896
+ width,
1897
+ current,
1898
+ color: color3,
1899
+ bgColor,
1900
+ char,
1901
+ message,
1902
+ messageWidth,
1903
+ spaceWidth,
1904
+ messageColor,
1905
+ maxIdLen,
1906
+ hasErrors
1907
+ } = mergedOptions;
1908
+ const space = " ".repeat(spaceWidth);
1909
+ const percent = clamp(Math.floor(current / total * 100), 0, 100);
1910
+ const barColor = colors[color3];
1911
+ const backgroundColor = colors[bgColor];
1912
+ const doneColor = hasErrors ? colors.red : barColor;
1913
+ const idColor = done ? doneColor : barColor;
1914
+ const id = mergedOptions.id ? idColor(padding(mergedOptions.id, maxIdLen)) : "";
1915
+ const { columns: terminalWidth = FULL_WIDTH } = process.stdout;
1916
+ if (done) {
1917
+ if (hasErrors) {
1918
+ const message2 = colors.bold(doneColor(errorInfo));
1919
+ if (terminalWidth >= MIDDLE_WIDTH) {
1920
+ return [idColor(errorIcon), id, doneColor(`${space}${message2}`)].join(
1921
+ ""
1922
+ );
1923
+ }
1924
+ return [id, doneColor(`${message2}`)].join("");
1925
+ }
1926
+ return "";
1927
+ }
1928
+ const msgStr = colors[messageColor](
1929
+ (0, import_cli_truncate.default)(message, messageWidth, { position: "start" })
1930
+ );
1931
+ const left = clamp(Math.floor(percent * width / 100), 0, width);
1932
+ const right = clamp(width - left, 0, width);
1933
+ const barStr = `${barColor(char.repeat(left))}${backgroundColor(
1934
+ char.repeat(right)
1935
+ )}`;
1936
+ const percentStr = `${percent.toString().padStart(3)}%`;
1937
+ if (terminalWidth >= FULL_WIDTH) {
1938
+ return [
1939
+ idColor(buildIcon),
1940
+ id,
1941
+ space,
1942
+ barStr,
1943
+ space,
1944
+ percentStr,
1945
+ space,
1946
+ msgStr
1947
+ ].join("");
1948
+ }
1949
+ if (terminalWidth >= MIDDLE_WIDTH) {
1950
+ return [idColor(buildIcon), id, space, barStr, space, percentStr].join("");
1951
+ }
1952
+ return [idColor(buildIcon), id, space, percentStr].join("");
1953
+ };
1954
+ }
1955
+ });
1956
+
1957
+ // ../../../node_modules/.pnpm/ansi-escapes@4.3.2/node_modules/ansi-escapes/index.js
1958
+ var require_ansi_escapes = __commonJS({
1959
+ "../../../node_modules/.pnpm/ansi-escapes@4.3.2/node_modules/ansi-escapes/index.js"(exports, module) {
1960
+ "use strict";
1961
+ init_esm();
1962
+ var ansiEscapes2 = module.exports;
1963
+ module.exports.default = ansiEscapes2;
1964
+ var ESC = "\x1B[";
1965
+ var OSC = "\x1B]";
1966
+ var BEL = "\x07";
1967
+ var SEP = ";";
1968
+ var isTerminalApp = process.env.TERM_PROGRAM === "Apple_Terminal";
1969
+ ansiEscapes2.cursorTo = (x, y) => {
1970
+ if (typeof x !== "number") {
1971
+ throw new TypeError("The `x` argument is required");
1972
+ }
1973
+ if (typeof y !== "number") {
1974
+ return ESC + (x + 1) + "G";
1975
+ }
1976
+ return ESC + (y + 1) + ";" + (x + 1) + "H";
1977
+ };
1978
+ ansiEscapes2.cursorMove = (x, y) => {
1979
+ if (typeof x !== "number") {
1980
+ throw new TypeError("The `x` argument is required");
1981
+ }
1982
+ let ret = "";
1983
+ if (x < 0) {
1984
+ ret += ESC + -x + "D";
1985
+ } else if (x > 0) {
1986
+ ret += ESC + x + "C";
1987
+ }
1988
+ if (y < 0) {
1989
+ ret += ESC + -y + "A";
1990
+ } else if (y > 0) {
1991
+ ret += ESC + y + "B";
1992
+ }
1993
+ return ret;
1994
+ };
1995
+ ansiEscapes2.cursorUp = (count = 1) => ESC + count + "A";
1996
+ ansiEscapes2.cursorDown = (count = 1) => ESC + count + "B";
1997
+ ansiEscapes2.cursorForward = (count = 1) => ESC + count + "C";
1998
+ ansiEscapes2.cursorBackward = (count = 1) => ESC + count + "D";
1999
+ ansiEscapes2.cursorLeft = ESC + "G";
2000
+ ansiEscapes2.cursorSavePosition = isTerminalApp ? "\x1B7" : ESC + "s";
2001
+ ansiEscapes2.cursorRestorePosition = isTerminalApp ? "\x1B8" : ESC + "u";
2002
+ ansiEscapes2.cursorGetPosition = ESC + "6n";
2003
+ ansiEscapes2.cursorNextLine = ESC + "E";
2004
+ ansiEscapes2.cursorPrevLine = ESC + "F";
2005
+ ansiEscapes2.cursorHide = ESC + "?25l";
2006
+ ansiEscapes2.cursorShow = ESC + "?25h";
2007
+ ansiEscapes2.eraseLines = (count) => {
2008
+ let clear = "";
2009
+ for (let i = 0; i < count; i++) {
2010
+ clear += ansiEscapes2.eraseLine + (i < count - 1 ? ansiEscapes2.cursorUp() : "");
2011
+ }
2012
+ if (count) {
2013
+ clear += ansiEscapes2.cursorLeft;
2014
+ }
2015
+ return clear;
2016
+ };
2017
+ ansiEscapes2.eraseEndLine = ESC + "K";
2018
+ ansiEscapes2.eraseStartLine = ESC + "1K";
2019
+ ansiEscapes2.eraseLine = ESC + "2K";
2020
+ ansiEscapes2.eraseDown = ESC + "J";
2021
+ ansiEscapes2.eraseUp = ESC + "1J";
2022
+ ansiEscapes2.eraseScreen = ESC + "2J";
2023
+ ansiEscapes2.scrollUp = ESC + "S";
2024
+ ansiEscapes2.scrollDown = ESC + "T";
2025
+ ansiEscapes2.clearScreen = "\x1Bc";
2026
+ ansiEscapes2.clearTerminal = process.platform === "win32" ? `${ansiEscapes2.eraseScreen}${ESC}0f` : (
2027
+ // 1. Erases the screen (Only done in case `2` is not supported)
2028
+ // 2. Erases the whole screen including scrollback buffer
2029
+ // 3. Moves cursor to the top-left position
2030
+ // More info: https://www.real-world-systems.com/docs/ANSIcode.html
2031
+ `${ansiEscapes2.eraseScreen}${ESC}3J${ESC}H`
2032
+ );
2033
+ ansiEscapes2.beep = BEL;
2034
+ ansiEscapes2.link = (text, url) => {
2035
+ return [
2036
+ OSC,
2037
+ "8",
2038
+ SEP,
2039
+ SEP,
2040
+ url,
2041
+ BEL,
2042
+ text,
2043
+ OSC,
2044
+ "8",
2045
+ SEP,
2046
+ SEP,
2047
+ BEL
2048
+ ].join("");
2049
+ };
2050
+ ansiEscapes2.image = (buffer, options = {}) => {
2051
+ let ret = `${OSC}1337;File=inline=1`;
2052
+ if (options.width) {
2053
+ ret += `;width=${options.width}`;
2054
+ }
2055
+ if (options.height) {
2056
+ ret += `;height=${options.height}`;
2057
+ }
2058
+ if (options.preserveAspectRatio === false) {
2059
+ ret += ";preserveAspectRatio=0";
2060
+ }
2061
+ return ret + ":" + buffer.toString("base64") + BEL;
2062
+ };
2063
+ ansiEscapes2.iTerm = {
2064
+ setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
2065
+ annotation: (message, options = {}) => {
2066
+ let ret = `${OSC}1337;`;
2067
+ const hasX = typeof options.x !== "undefined";
2068
+ const hasY = typeof options.y !== "undefined";
2069
+ if ((hasX || hasY) && !(hasX && hasY && typeof options.length !== "undefined")) {
2070
+ throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");
2071
+ }
2072
+ message = message.replace(/\|/g, "");
2073
+ ret += options.isHidden ? "AddHiddenAnnotation=" : "AddAnnotation=";
2074
+ if (options.length > 0) {
2075
+ ret += (hasX ? [message, options.length, options.x, options.y] : [options.length, message]).join("|");
2076
+ } else {
2077
+ ret += message;
2078
+ }
2079
+ return ret + BEL;
2080
+ }
2081
+ };
2082
+ }
2083
+ });
2084
+
2085
+ // src/progress/helpers/log.ts
2086
+ var import_ansi_escapes, create;
2087
+ var init_log = __esm({
2088
+ "src/progress/helpers/log.ts"() {
2089
+ "use strict";
2090
+ init_esm();
2091
+ import_ansi_escapes = __toESM(require_ansi_escapes());
2092
+ create = (stream) => {
2093
+ let previousLineCount = 0;
2094
+ let previousOutput = "";
2095
+ const render = (str) => {
2096
+ const output = `${str}
2097
+ `;
2098
+ if (output === previousOutput) {
2099
+ return;
2100
+ }
2101
+ previousOutput = output;
2102
+ stream.write(import_ansi_escapes.default.eraseLines(previousLineCount) + output);
2103
+ previousLineCount = output.split("\n").length;
2104
+ };
2105
+ render.clear = () => {
2106
+ stream.write(import_ansi_escapes.default.eraseLines(previousLineCount));
2107
+ previousOutput = "";
2108
+ previousLineCount = 0;
2109
+ };
2110
+ render.done = () => {
2111
+ previousOutput = "";
2112
+ previousLineCount = 0;
2113
+ };
2114
+ return render;
2115
+ };
2116
+ }
2117
+ });
2118
+
2119
+ // src/progress/helpers/bus.ts
2120
+ import { Console } from "console";
2121
+ var import_cli_truncate2, import_patch_console, colorList, getProgressColor, Bus, bus;
2122
+ var init_bus = __esm({
2123
+ "src/progress/helpers/bus.ts"() {
2124
+ "use strict";
2125
+ init_esm();
2126
+ import_cli_truncate2 = __toESM(require_cli_truncate());
2127
+ import_patch_console = __toESM(require_build());
2128
+ init_bar();
2129
+ init_log();
2130
+ colorList = ["green", "cyan", "yellow", "blue", "magenta"];
2131
+ getProgressColor = (index) => colorList[index % colorList.length];
2132
+ Bus = class {
2133
+ constructor() {
2134
+ __publicField(this, "states", []);
2135
+ __publicField(this, "log");
2136
+ __publicField(this, "restore");
2137
+ __publicField(this, "prevOutput");
2138
+ __publicField(this, "destroyed", false);
2139
+ this.prevOutput = "";
2140
+ this.log = create(process.stdout);
2141
+ console.Console = Console;
2142
+ this.restore = (0, import_patch_console.default)((type, data) => {
2143
+ this.writeToStd(type, data);
2144
+ });
2145
+ }
2146
+ update(state) {
2147
+ const index = this.states.findIndex((i) => i.id === state.id);
2148
+ if (index === -1) {
2149
+ this.states.push(state);
2150
+ return;
2151
+ }
2152
+ this.states[index] = state;
2153
+ }
2154
+ writeToStd(type = "stdout", data) {
2155
+ this.log.clear();
2156
+ if (data) {
2157
+ if (type === "stdout") {
2158
+ process.stdout.write(data);
2159
+ } else if (type === "stderr") {
2160
+ process.stderr.write(data);
2161
+ }
2162
+ }
2163
+ this.log(this.prevOutput);
2164
+ }
2165
+ render() {
2166
+ const maxIdLen = Math.max(...this.states.map((i) => i.id?.length ?? 0)) + 2;
2167
+ const { columns = FULL_WIDTH } = process.stdout;
2168
+ this.prevOutput = this.states.map((i, k) => {
2169
+ const bar = renderBar({
2170
+ maxIdLen,
2171
+ color: i.color ?? getProgressColor(k),
2172
+ ...i
2173
+ });
2174
+ if (bar) {
2175
+ return (0, import_cli_truncate2.default)(bar, columns, { position: "end" });
2176
+ }
2177
+ return null;
2178
+ }).filter((item) => item !== null).join("\n");
2179
+ this.writeToStd();
2180
+ }
2181
+ destroy() {
2182
+ if (!this.destroyed) {
2183
+ this.restore();
2184
+ }
2185
+ this.destroyed = true;
2186
+ }
2187
+ clear() {
2188
+ this.log.clear();
2189
+ this.log.done();
2190
+ }
2191
+ };
2192
+ bus = new Bus();
2193
+ }
2194
+ });
2195
+
2196
+ // src/progress/helpers/types.ts
2197
+ var init_types = __esm({
2198
+ "src/progress/helpers/types.ts"() {
2199
+ "use strict";
2200
+ init_esm();
2201
+ }
2202
+ });
2203
+
2204
+ // src/progress/helpers/percentage.ts
2205
+ var createFriendlyPercentage;
2206
+ var init_percentage = __esm({
2207
+ "src/progress/helpers/percentage.ts"() {
2208
+ "use strict";
2209
+ init_esm();
2210
+ createFriendlyPercentage = () => {
2211
+ let prevPercentage = 0;
2212
+ return (percentage) => {
2213
+ if (percentage === 0 || percentage === 1) {
2214
+ prevPercentage = 0;
2215
+ return percentage;
2216
+ }
2217
+ if (percentage <= prevPercentage) {
2218
+ let step = 0;
2219
+ if (prevPercentage < 0.3) {
2220
+ step = 1e-3;
2221
+ } else if (prevPercentage < 0.6) {
2222
+ step = 2e-3;
2223
+ } else if (prevPercentage < 0.8) {
2224
+ step = 4e-3;
2225
+ } else if (prevPercentage < 0.99) {
2226
+ step = 2e-3;
2227
+ }
2228
+ prevPercentage += step;
2229
+ return prevPercentage;
2230
+ }
2231
+ prevPercentage = percentage;
2232
+ return percentage;
2233
+ };
2234
+ };
2235
+ }
2236
+ });
2237
+
2238
+ // src/progress/helpers/index.ts
2239
+ var init_helpers = __esm({
2240
+ "src/progress/helpers/index.ts"() {
2241
+ "use strict";
2242
+ init_esm();
2243
+ init_bus();
2244
+ init_bar();
2245
+ init_types();
2246
+ init_percentage();
2247
+ }
2248
+ });
2249
+
2250
+ // src/progress/helpers/nonTty.ts
2251
+ import { logger as logger4 } from "@rsbuild/core";
2252
+ import color from "picocolors";
2253
+ function createNonTTYLogger() {
2254
+ let prevPercentage = 0;
2255
+ const log = ({
2256
+ id,
2257
+ done,
2258
+ current,
2259
+ hasErrors,
2260
+ compileTime
2261
+ }) => {
2262
+ const suffix = color.gray(`(${id})`);
2263
+ if (done) {
2264
+ if (prevPercentage === 100) {
2265
+ return;
2266
+ }
2267
+ prevPercentage = 100;
2268
+ if (hasErrors) {
2269
+ logger4.error(`Compile failed in ${compileTime} ${suffix}`);
2270
+ } else {
2271
+ logger4.ready(`Compiled in ${compileTime} ${suffix}`);
2272
+ }
2273
+ } else if (current - prevPercentage > 10) {
2274
+ prevPercentage = current;
2275
+ logger4.info(`Compile progress: ${current.toFixed(0)}% ${suffix}`);
2276
+ }
2277
+ };
2278
+ return {
2279
+ log
2280
+ };
2281
+ }
2282
+ var init_nonTty = __esm({
2283
+ "src/progress/helpers/nonTty.ts"() {
2284
+ "use strict";
2285
+ init_esm();
2286
+ }
2287
+ });
2288
+
2289
+ // src/progress/ProgressPlugin.ts
2290
+ var ProgressPlugin_exports = {};
2291
+ __export(ProgressPlugin_exports, {
2292
+ ProgressPlugin: () => ProgressPlugin
2293
+ });
2294
+ import { logger as logger5 } from "@rsbuild/core";
2295
+ import color2 from "picocolors";
2296
+ import webpack from "webpack";
2297
+ var ProgressPlugin;
2298
+ var init_ProgressPlugin = __esm({
2299
+ "src/progress/ProgressPlugin.ts"() {
2300
+ "use strict";
2301
+ init_esm();
2302
+ init_shared();
2303
+ init_helpers();
2304
+ init_nonTty();
2305
+ ProgressPlugin = class extends webpack.ProgressPlugin {
2306
+ constructor(options) {
2307
+ const { id = "Rsbuild" } = options;
2308
+ const nonTTYLogger = createNonTTYLogger();
2309
+ const friendlyPercentage = createFriendlyPercentage();
2310
+ super({
2311
+ activeModules: false,
2312
+ entries: true,
2313
+ modules: true,
2314
+ modulesCount: 5e3,
2315
+ profile: false,
2316
+ dependencies: true,
2317
+ dependenciesCount: 1e4,
2318
+ percentBy: null,
2319
+ handler: (originalPercentage, message) => {
2320
+ const percentage = friendlyPercentage(originalPercentage);
2321
+ const done = percentage === 1;
2322
+ if (process.stdout.isTTY) {
2323
+ bus.update({
2324
+ id,
2325
+ current: percentage * 100,
2326
+ message,
2327
+ done,
2328
+ hasErrors: this.hasCompileErrors
2329
+ });
2330
+ bus.render();
2331
+ } else {
2332
+ nonTTYLogger.log({
2333
+ id,
2334
+ done,
2335
+ current: percentage * 100,
2336
+ hasErrors: this.hasCompileErrors,
2337
+ compileTime: this.compileTime
2338
+ });
2339
+ }
2340
+ }
2341
+ });
2342
+ __publicField(this, "name", "ProgressPlugin");
2343
+ __publicField(this, "id");
2344
+ __publicField(this, "hasCompileErrors", false);
2345
+ __publicField(this, "compileTime", null);
2346
+ this.id = id;
2347
+ }
2348
+ apply(compiler) {
2349
+ super.apply(compiler);
2350
+ let startTime = null;
2351
+ compiler.hooks.compile.tap(this.name, () => {
2352
+ this.compileTime = null;
2353
+ startTime = process.hrtime();
2354
+ });
2355
+ compiler.hooks.done.tap(this.name, (stat) => {
2356
+ if (startTime) {
2357
+ this.hasCompileErrors = stat.hasErrors();
2358
+ const hrtime = process.hrtime(startTime);
2359
+ const seconds = hrtime[0] + hrtime[1] / 1e9;
2360
+ this.compileTime = prettyTime(seconds);
2361
+ startTime = null;
2362
+ if (!this.hasCompileErrors) {
2363
+ const suffix = this.id ? color2.gray(` (${this.id})`) : "";
2364
+ logger5.ready(`Compiled in ${this.compileTime} ${suffix}`);
2365
+ }
2366
+ }
2367
+ });
2368
+ }
2369
+ };
2370
+ }
2371
+ });
2372
+
2373
+ // src/plugin.ts
2374
+ var plugin_exports = {};
2375
+ __export(plugin_exports, {
2376
+ pluginAdaptor: () => pluginAdaptor
2377
+ });
2378
+ import fs from "fs";
2379
+ async function applyTsConfigPathsPlugin({
2380
+ chain,
2381
+ CHAIN_ID,
2382
+ mainFields,
2383
+ extensions,
2384
+ configFile
2385
+ }) {
2386
+ const { TsconfigPathsPlugin } = await import("tsconfig-paths-webpack-plugin");
2387
+ chain.resolve.plugin(CHAIN_ID.RESOLVE_PLUGIN.TS_CONFIG_PATHS).use(TsconfigPathsPlugin, [
2388
+ {
2389
+ configFile,
2390
+ extensions,
2391
+ // https://github.com/dividab/tsconfig-paths-webpack-plugin/pull/106
2392
+ mainFields
2393
+ }
2394
+ ]);
2395
+ }
2396
+ function isWebTarget(target) {
2397
+ const targets = castArray(target);
2398
+ return targets.includes("web") || target.includes("web-worker");
2399
+ }
2400
+ var getMainFields, pluginAdaptor;
2401
+ var init_plugin = __esm({
2402
+ "src/plugin.ts"() {
2403
+ "use strict";
2404
+ init_esm();
2405
+ init_shared();
2406
+ getMainFields = (chain, target) => {
2407
+ const mainFields = chain.resolve.mainFields.values();
2408
+ if (mainFields.length) {
2409
+ return mainFields;
2410
+ }
2411
+ if (isWebTarget(target)) {
2412
+ return ["browser", "module", "main"];
2413
+ }
2414
+ return ["module", "main"];
2415
+ };
2416
+ pluginAdaptor = () => ({
2417
+ name: "rsbuild-webpack:adaptor",
2418
+ setup(api) {
2419
+ api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, target }) => {
2420
+ const { config, tsconfigPath } = environment;
2421
+ if (tsconfigPath && config.source.aliasStrategy === "prefer-tsconfig") {
2422
+ await applyTsConfigPathsPlugin({
2423
+ chain,
2424
+ CHAIN_ID,
2425
+ configFile: tsconfigPath,
2426
+ mainFields: getMainFields(chain, target),
2427
+ extensions: chain.resolve.extensions.values()
2428
+ });
2429
+ }
2430
+ const progress = config.dev.progressBar ?? true;
2431
+ if (progress) {
2432
+ const { ProgressPlugin: ProgressPlugin2 } = await Promise.resolve().then(() => (init_ProgressPlugin(), ProgressPlugin_exports));
2433
+ chain.plugin(CHAIN_ID.PLUGIN.PROGRESS).use(ProgressPlugin2, [
2434
+ {
2435
+ id: environment.name,
2436
+ ...progress === true ? {} : progress
2437
+ }
2438
+ ]);
2439
+ }
2440
+ const { copy } = config.output;
2441
+ if (copy) {
2442
+ const { default: CopyPlugin } = await import("copy-webpack-plugin");
2443
+ const options = Array.isArray(copy) ? { patterns: copy } : copy;
2444
+ chain.plugin(CHAIN_ID.PLUGIN.COPY).use(CopyPlugin, [
2445
+ // @ts-expect-error to type mismatch
2446
+ options
2447
+ ]);
2448
+ }
2449
+ });
2450
+ api.modifyWebpackConfig(async (config) => {
2451
+ const copyPlugin = config.plugins?.find(
2452
+ (item) => item?.constructor.name === "CopyPlugin"
2453
+ );
2454
+ if (copyPlugin) {
2455
+ const isContextNotExists = copyPlugin.patterns.every(
2456
+ (pattern) => typeof pattern !== "string" && pattern.context && !fs.existsSync(pattern.context)
2457
+ );
2458
+ if (isContextNotExists) {
2459
+ config.plugins = config.plugins?.filter(
2460
+ (item) => item?.constructor.name !== "CopyPlugin"
2461
+ );
2462
+ }
2463
+ }
2464
+ });
2465
+ }
2466
+ });
2467
+ }
2468
+ });
2469
+
2470
+ // src/build.ts
2471
+ var build_exports = {};
2472
+ __export(build_exports, {
2473
+ build: () => build
2474
+ });
2475
+ import { logger as logger6 } from "@rsbuild/core";
2476
+ import WebpackMultiStats2 from "webpack/lib/MultiStats.js";
2477
+ var build;
2478
+ var init_build = __esm({
2479
+ "src/build.ts"() {
2480
+ "use strict";
2481
+ init_esm();
2482
+ init_createCompiler();
2483
+ init_initConfigs();
2484
+ init_shared();
2485
+ build = async (initOptions, { mode = "production", watch, compiler: customCompiler } = {}) => {
2486
+ if (!process.env.NODE_ENV) {
2487
+ process.env.NODE_ENV = mode;
2488
+ }
2489
+ const { context } = initOptions;
2490
+ let compiler;
2491
+ let bundlerConfigs;
2492
+ if (customCompiler) {
2493
+ compiler = customCompiler;
2494
+ } else {
2495
+ const { webpackConfigs } = await initConfigs(initOptions);
2496
+ compiler = await createCompiler({
2497
+ context,
2498
+ webpackConfigs
2499
+ });
2500
+ bundlerConfigs = webpackConfigs;
2501
+ }
2502
+ let isFirstCompile = true;
2503
+ await context.hooks.onBeforeBuild.call({
2504
+ bundlerConfigs,
2505
+ environments: context.environments
2506
+ });
2507
+ const onDone = async (stats) => {
2508
+ const p = context.hooks.onAfterBuild.call({
2509
+ isFirstCompile,
2510
+ stats,
2511
+ environments: context.environments
2512
+ });
2513
+ isFirstCompile = false;
2514
+ await p;
2515
+ };
2516
+ onCompileDone(compiler, onDone, WebpackMultiStats2);
2517
+ if (watch) {
2518
+ compiler.watch({}, (err) => {
2519
+ if (err) {
2520
+ logger6.error(err);
2521
+ }
2522
+ });
2523
+ return;
2524
+ }
2525
+ await new Promise(
2526
+ (resolve, reject) => {
2527
+ compiler.run((err, stats) => {
2528
+ if (err || stats?.hasErrors()) {
2529
+ const buildError = err || new Error("Webpack build failed!");
2530
+ reject(buildError);
2531
+ } else {
2532
+ compiler.close((closeErr) => {
2533
+ closeErr && logger6.error(closeErr);
2534
+ resolve({ stats });
2535
+ });
2536
+ }
2537
+ });
2538
+ }
2539
+ );
2540
+ };
2541
+ }
2542
+ });
2543
+
2544
+ // src/index.ts
2545
+ init_esm();
2546
+
2547
+ // src/provider.ts
2548
+ init_esm();
2549
+ init_initConfigs();
2550
+ init_shared();
2551
+ var webpackProvider = async ({
2552
+ context,
2553
+ pluginManager,
2554
+ rsbuildOptions,
2555
+ setCssExtractPlugin
2556
+ }) => {
2557
+ const { default: cssExtractPlugin } = await import("mini-css-extract-plugin");
2558
+ setCssExtractPlugin(cssExtractPlugin);
2559
+ const createCompiler2 = async () => {
2560
+ const { createCompiler: createCompiler3 } = await Promise.resolve().then(() => (init_createCompiler(), createCompiler_exports));
2561
+ const { webpackConfigs } = await initConfigs({
2562
+ context,
2563
+ pluginManager,
2564
+ rsbuildOptions
2565
+ });
2566
+ return createCompiler3({ context, webpackConfigs });
2567
+ };
2568
+ const { pluginAdaptor: pluginAdaptor2 } = await Promise.resolve().then(() => (init_plugin(), plugin_exports));
2569
+ pluginManager.addPlugins([pluginAdaptor2()]);
2570
+ return {
2571
+ bundler: "webpack",
2572
+ createCompiler: createCompiler2,
2573
+ async initConfigs() {
2574
+ const { webpackConfigs } = await initConfigs({
2575
+ context,
2576
+ pluginManager,
2577
+ rsbuildOptions
2578
+ });
2579
+ return webpackConfigs;
2580
+ },
2581
+ async createDevServer(options) {
2582
+ const { createDevMiddleware: createDevMiddleware2 } = await Promise.resolve().then(() => (init_createCompiler(), createCompiler_exports));
2583
+ const config = await initRsbuildConfig({ context, pluginManager });
2584
+ return createDevServer(
2585
+ { context, pluginManager, rsbuildOptions },
2586
+ createDevMiddleware2,
2587
+ config,
2588
+ options
2589
+ );
2590
+ },
2591
+ async startDevServer(options) {
2592
+ const { createDevMiddleware: createDevMiddleware2 } = await Promise.resolve().then(() => (init_createCompiler(), createCompiler_exports));
2593
+ const config = await initRsbuildConfig({
2594
+ context,
2595
+ pluginManager
2596
+ });
2597
+ const server = await createDevServer(
2598
+ {
2599
+ context,
2600
+ pluginManager,
2601
+ rsbuildOptions
2602
+ },
2603
+ createDevMiddleware2,
2604
+ config,
2605
+ options
2606
+ );
2607
+ return server.listen();
2608
+ },
2609
+ async build(options) {
2610
+ const { build: build2 } = await Promise.resolve().then(() => (init_build(), build_exports));
2611
+ return build2({ context, pluginManager, rsbuildOptions }, options);
2612
+ },
2613
+ async inspectConfig(inspectOptions) {
2614
+ const { inspectConfig: inspectConfig2 } = await Promise.resolve().then(() => (init_inspectConfig(), inspectConfig_exports));
2615
+ return await inspectConfig2({
2616
+ context,
2617
+ pluginManager,
2618
+ rsbuildOptions,
2619
+ inspectOptions
2620
+ });
2621
+ }
2622
+ };
2623
+ };
2624
+ export {
2625
+ webpackProvider
2626
+ };