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