@rsbuild/webpack 1.0.0-alpha.2 → 1.0.0-alpha.3
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/build.d.ts +1 -1
- package/dist/index.cjs +52 -79
- package/dist/index.js +40 -69
- package/dist/initConfigs.d.ts +1 -2
- package/dist/progress/ProgressPlugin.d.ts +1 -1
- package/dist/progress/helpers/bar.d.ts +1 -1
- package/dist/progress/helpers/bus.d.ts +1 -2
- package/dist/progress/helpers/index.d.ts +1 -1
- package/dist/progress/helpers/{type.d.ts → types.d.ts} +2 -1
- package/dist/shared.d.ts +3 -2
- package/package.json +4 -4
package/dist/build.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { BuildOptions } from '@rsbuild/
|
|
1
|
+
import type { BuildOptions } from '@rsbuild/core';
|
|
2
2
|
import { type InitConfigsOptions } from './initConfigs';
|
|
3
3
|
export declare const build: (initOptions: InitConfigsOptions, { mode, watch, compiler: customCompiler }?: BuildOptions) => Promise<void>;
|
package/dist/index.cjs
CHANGED
|
@@ -39,7 +39,7 @@ var __publicField = (obj, key, value) => {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
// src/shared.ts
|
|
42
|
-
var import_core, getChainUtils, initRsbuildConfig, createDevServer, formatStats, getDevMiddleware, getStatsOptions, stringifyConfig, outputInspectConfigFiles, getRsbuildInspectConfig, chainToConfig, modifyBundlerChain, onCompileDone, prettyTime;
|
|
42
|
+
var import_core, getChainUtils, initRsbuildConfig, createDevServer, formatStats, getDevMiddleware, getStatsOptions, stringifyConfig, outputInspectConfigFiles, getRsbuildInspectConfig, chainToConfig, modifyBundlerChain, onCompileDone, prettyTime, castArray;
|
|
43
43
|
var init_shared = __esm({
|
|
44
44
|
"src/shared.ts"() {
|
|
45
45
|
"use strict";
|
|
@@ -59,6 +59,12 @@ var init_shared = __esm({
|
|
|
59
59
|
onCompileDone,
|
|
60
60
|
prettyTime
|
|
61
61
|
} = import_core.__internalHelper);
|
|
62
|
+
castArray = (arr) => {
|
|
63
|
+
if (arr === void 0) {
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
return Array.isArray(arr) ? arr : [arr];
|
|
67
|
+
};
|
|
62
68
|
}
|
|
63
69
|
});
|
|
64
70
|
|
|
@@ -141,8 +147,8 @@ async function modifyWebpackChain(context, utils, chain) {
|
|
|
141
147
|
chain,
|
|
142
148
|
utils
|
|
143
149
|
);
|
|
144
|
-
if (
|
|
145
|
-
for (const item of
|
|
150
|
+
if (utils.environment.config.tools?.webpackChain) {
|
|
151
|
+
for (const item of castArray(utils.environment.config.tools.webpackChain)) {
|
|
146
152
|
item(modifiedChain, utils);
|
|
147
153
|
}
|
|
148
154
|
}
|
|
@@ -155,10 +161,10 @@ async function modifyWebpackConfig(context, webpackConfig, utils) {
|
|
|
155
161
|
webpackConfig,
|
|
156
162
|
utils
|
|
157
163
|
);
|
|
158
|
-
if (
|
|
164
|
+
if (utils.environment.config.tools?.webpack) {
|
|
159
165
|
modifiedConfig = (0, import_reduce_configs.reduceConfigsWithContext)({
|
|
160
166
|
initial: modifiedConfig,
|
|
161
|
-
config:
|
|
167
|
+
config: utils.environment.config.tools.webpack,
|
|
162
168
|
ctx: utils,
|
|
163
169
|
mergeFn: utils.mergeConfig
|
|
164
170
|
});
|
|
@@ -180,44 +186,6 @@ async function getChainUtils2(target, environment) {
|
|
|
180
186
|
HtmlWebpackPlugin: import_core2.__internalHelper.getHTMLPlugin()
|
|
181
187
|
};
|
|
182
188
|
}
|
|
183
|
-
async function getConfigUtils(config, chainUtils) {
|
|
184
|
-
const { merge } = await import("@rsbuild/shared/webpack-merge");
|
|
185
|
-
return {
|
|
186
|
-
...chainUtils,
|
|
187
|
-
mergeConfig: merge,
|
|
188
|
-
addRules(rules) {
|
|
189
|
-
const ruleArr = (0, import_shared2.castArray)(rules);
|
|
190
|
-
if (!config.module) {
|
|
191
|
-
config.module = {};
|
|
192
|
-
}
|
|
193
|
-
if (!config.module.rules) {
|
|
194
|
-
config.module.rules = [];
|
|
195
|
-
}
|
|
196
|
-
config.module.rules.unshift(...ruleArr);
|
|
197
|
-
},
|
|
198
|
-
prependPlugins(plugins) {
|
|
199
|
-
const pluginArr = (0, import_shared2.castArray)(plugins);
|
|
200
|
-
if (!config.plugins) {
|
|
201
|
-
config.plugins = [];
|
|
202
|
-
}
|
|
203
|
-
config.plugins.unshift(...pluginArr);
|
|
204
|
-
},
|
|
205
|
-
appendPlugins(plugins) {
|
|
206
|
-
const pluginArr = (0, import_shared2.castArray)(plugins);
|
|
207
|
-
if (!config.plugins) {
|
|
208
|
-
config.plugins = [];
|
|
209
|
-
}
|
|
210
|
-
config.plugins.push(...pluginArr);
|
|
211
|
-
},
|
|
212
|
-
removePlugin(pluginName) {
|
|
213
|
-
if (config.plugins) {
|
|
214
|
-
config.plugins = config.plugins.filter(
|
|
215
|
-
(item) => item?.constructor.name !== pluginName
|
|
216
|
-
);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
189
|
async function generateWebpackConfig({
|
|
222
190
|
target,
|
|
223
191
|
context,
|
|
@@ -247,19 +215,22 @@ async function generateWebpackConfig({
|
|
|
247
215
|
});
|
|
248
216
|
const chain = await modifyWebpackChain(context, chainUtils, bundlerChain);
|
|
249
217
|
let webpackConfig = chainToConfig(chain);
|
|
218
|
+
const configUtils = await import_core2.__internalHelper.getConfigUtils(
|
|
219
|
+
webpackConfig,
|
|
220
|
+
chainUtils
|
|
221
|
+
);
|
|
250
222
|
webpackConfig = await modifyWebpackConfig(
|
|
251
223
|
context,
|
|
252
224
|
webpackConfig,
|
|
253
|
-
|
|
225
|
+
configUtils
|
|
254
226
|
);
|
|
255
227
|
return webpackConfig;
|
|
256
228
|
}
|
|
257
|
-
var import_core2,
|
|
229
|
+
var import_core2, import_reduce_configs;
|
|
258
230
|
var init_webpackConfig = __esm({
|
|
259
231
|
"src/webpackConfig.ts"() {
|
|
260
232
|
"use strict";
|
|
261
233
|
import_core2 = require("@rsbuild/core");
|
|
262
|
-
import_shared2 = require("@rsbuild/shared");
|
|
263
234
|
import_reduce_configs = require("reduce-configs");
|
|
264
235
|
init_shared();
|
|
265
236
|
}
|
|
@@ -1839,12 +1810,12 @@ var init_utils = __esm({
|
|
|
1839
1810
|
});
|
|
1840
1811
|
|
|
1841
1812
|
// src/progress/helpers/bar.ts
|
|
1842
|
-
var
|
|
1813
|
+
var import_cli_truncate, import_picocolors, defaultOption, padding, FULL_WIDTH, MIDDLE_WIDTH, renderBar;
|
|
1843
1814
|
var init_bar = __esm({
|
|
1844
1815
|
"src/progress/helpers/bar.ts"() {
|
|
1845
1816
|
"use strict";
|
|
1846
|
-
import_shared7 = require("@rsbuild/shared");
|
|
1847
1817
|
import_cli_truncate = __toESM(require_cli_truncate());
|
|
1818
|
+
import_picocolors = __toESM(require("picocolors"));
|
|
1848
1819
|
init_utils();
|
|
1849
1820
|
defaultOption = {
|
|
1850
1821
|
total: 100,
|
|
@@ -1897,15 +1868,15 @@ var init_bar = __esm({
|
|
|
1897
1868
|
} = mergedOptions;
|
|
1898
1869
|
const space = " ".repeat(spaceWidth);
|
|
1899
1870
|
const percent = clamp(Math.floor(current / total * 100), 0, 100);
|
|
1900
|
-
const barColor =
|
|
1901
|
-
const backgroundColor =
|
|
1902
|
-
const doneColor = hasErrors ?
|
|
1871
|
+
const barColor = import_picocolors.default[color3];
|
|
1872
|
+
const backgroundColor = import_picocolors.default[bgColor];
|
|
1873
|
+
const doneColor = hasErrors ? import_picocolors.default.red : barColor;
|
|
1903
1874
|
const idColor = done ? doneColor : barColor;
|
|
1904
1875
|
const id = mergedOptions.id ? idColor(padding(mergedOptions.id, maxIdLen)) : "";
|
|
1905
1876
|
const { columns: terminalWidth = FULL_WIDTH } = process.stdout;
|
|
1906
1877
|
if (done) {
|
|
1907
1878
|
if (hasErrors) {
|
|
1908
|
-
const message2 =
|
|
1879
|
+
const message2 = import_picocolors.default.bold(doneColor(errorInfo));
|
|
1909
1880
|
if (terminalWidth >= MIDDLE_WIDTH) {
|
|
1910
1881
|
return [idColor(errorIcon), id, doneColor(`${space}${message2}`)].join(
|
|
1911
1882
|
""
|
|
@@ -1915,7 +1886,7 @@ var init_bar = __esm({
|
|
|
1915
1886
|
}
|
|
1916
1887
|
return "";
|
|
1917
1888
|
}
|
|
1918
|
-
const msgStr =
|
|
1889
|
+
const msgStr = import_picocolors.default[messageColor](
|
|
1919
1890
|
(0, import_cli_truncate.default)(message, messageWidth, { position: "start" })
|
|
1920
1891
|
);
|
|
1921
1892
|
const left = clamp(Math.floor(percent * width / 100), 0, width);
|
|
@@ -2180,9 +2151,9 @@ var init_bus = __esm({
|
|
|
2180
2151
|
}
|
|
2181
2152
|
});
|
|
2182
2153
|
|
|
2183
|
-
// src/progress/helpers/
|
|
2184
|
-
var
|
|
2185
|
-
"src/progress/helpers/
|
|
2154
|
+
// src/progress/helpers/types.ts
|
|
2155
|
+
var init_types = __esm({
|
|
2156
|
+
"src/progress/helpers/types.ts"() {
|
|
2186
2157
|
"use strict";
|
|
2187
2158
|
}
|
|
2188
2159
|
});
|
|
@@ -2226,7 +2197,7 @@ var init_helpers = __esm({
|
|
|
2226
2197
|
"use strict";
|
|
2227
2198
|
init_bus();
|
|
2228
2199
|
init_bar();
|
|
2229
|
-
|
|
2200
|
+
init_types();
|
|
2230
2201
|
init_percentage();
|
|
2231
2202
|
}
|
|
2232
2203
|
});
|
|
@@ -2241,7 +2212,7 @@ function createNonTTYLogger() {
|
|
|
2241
2212
|
hasErrors,
|
|
2242
2213
|
compileTime
|
|
2243
2214
|
}) => {
|
|
2244
|
-
const suffix =
|
|
2215
|
+
const suffix = import_picocolors2.default.gray(`(${id})`);
|
|
2245
2216
|
if (done) {
|
|
2246
2217
|
if (prevPercentage === 100) {
|
|
2247
2218
|
return;
|
|
@@ -2261,12 +2232,12 @@ function createNonTTYLogger() {
|
|
|
2261
2232
|
log
|
|
2262
2233
|
};
|
|
2263
2234
|
}
|
|
2264
|
-
var import_core5,
|
|
2235
|
+
var import_core5, import_picocolors2;
|
|
2265
2236
|
var init_nonTty = __esm({
|
|
2266
2237
|
"src/progress/helpers/nonTty.ts"() {
|
|
2267
2238
|
"use strict";
|
|
2268
2239
|
import_core5 = require("@rsbuild/core");
|
|
2269
|
-
|
|
2240
|
+
import_picocolors2 = __toESM(require("picocolors"));
|
|
2270
2241
|
}
|
|
2271
2242
|
});
|
|
2272
2243
|
|
|
@@ -2275,12 +2246,12 @@ var ProgressPlugin_exports = {};
|
|
|
2275
2246
|
__export(ProgressPlugin_exports, {
|
|
2276
2247
|
ProgressPlugin: () => ProgressPlugin
|
|
2277
2248
|
});
|
|
2278
|
-
var import_core6,
|
|
2249
|
+
var import_core6, import_picocolors3, import_webpack, ProgressPlugin;
|
|
2279
2250
|
var init_ProgressPlugin = __esm({
|
|
2280
2251
|
"src/progress/ProgressPlugin.ts"() {
|
|
2281
2252
|
"use strict";
|
|
2282
2253
|
import_core6 = require("@rsbuild/core");
|
|
2283
|
-
|
|
2254
|
+
import_picocolors3 = __toESM(require("picocolors"));
|
|
2284
2255
|
import_webpack = __toESM(require("webpack"));
|
|
2285
2256
|
init_shared();
|
|
2286
2257
|
init_helpers();
|
|
@@ -2343,7 +2314,7 @@ var init_ProgressPlugin = __esm({
|
|
|
2343
2314
|
this.compileTime = prettyTime(seconds);
|
|
2344
2315
|
startTime = null;
|
|
2345
2316
|
if (!this.hasCompileErrors) {
|
|
2346
|
-
const suffix = this.id ?
|
|
2317
|
+
const suffix = this.id ? import_picocolors3.default.gray(` (${this.id})`) : "";
|
|
2347
2318
|
import_core6.logger.ready(`Compiled in ${this.compileTime} ${suffix}`);
|
|
2348
2319
|
}
|
|
2349
2320
|
}
|
|
@@ -2376,15 +2347,15 @@ async function applyTsConfigPathsPlugin({
|
|
|
2376
2347
|
]);
|
|
2377
2348
|
}
|
|
2378
2349
|
function isWebTarget(target) {
|
|
2379
|
-
const targets =
|
|
2350
|
+
const targets = castArray(target);
|
|
2380
2351
|
return targets.includes("web") || target.includes("web-worker");
|
|
2381
2352
|
}
|
|
2382
|
-
var import_node_fs,
|
|
2353
|
+
var import_node_fs, getMainFields, pluginAdaptor;
|
|
2383
2354
|
var init_plugin = __esm({
|
|
2384
2355
|
"src/plugin.ts"() {
|
|
2385
2356
|
"use strict";
|
|
2386
2357
|
import_node_fs = __toESM(require("fs"));
|
|
2387
|
-
|
|
2358
|
+
init_shared();
|
|
2388
2359
|
getMainFields = (chain, target) => {
|
|
2389
2360
|
const mainFields = chain.resolve.mainFields.values();
|
|
2390
2361
|
if (mainFields.length) {
|
|
@@ -2503,19 +2474,21 @@ var init_build = __esm({
|
|
|
2503
2474
|
});
|
|
2504
2475
|
return;
|
|
2505
2476
|
}
|
|
2506
|
-
await new Promise(
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2477
|
+
await new Promise(
|
|
2478
|
+
(resolve, reject) => {
|
|
2479
|
+
compiler.run((err, stats) => {
|
|
2480
|
+
if (err || stats?.hasErrors()) {
|
|
2481
|
+
const buildError = err || new Error("Webpack build failed!");
|
|
2482
|
+
reject(buildError);
|
|
2483
|
+
} else {
|
|
2484
|
+
compiler.close((closeErr) => {
|
|
2485
|
+
closeErr && import_core7.logger.error(closeErr);
|
|
2486
|
+
resolve({ stats });
|
|
2487
|
+
});
|
|
2488
|
+
}
|
|
2489
|
+
});
|
|
2490
|
+
}
|
|
2491
|
+
);
|
|
2519
2492
|
};
|
|
2520
2493
|
}
|
|
2521
2494
|
});
|
package/dist/index.js
CHANGED
|
@@ -57,7 +57,7 @@ var init_esm = __esm({
|
|
|
57
57
|
|
|
58
58
|
// src/shared.ts
|
|
59
59
|
import { __internalHelper } from "@rsbuild/core";
|
|
60
|
-
var getChainUtils, initRsbuildConfig, createDevServer, formatStats, getDevMiddleware, getStatsOptions, stringifyConfig, outputInspectConfigFiles, getRsbuildInspectConfig, chainToConfig, modifyBundlerChain, onCompileDone, prettyTime;
|
|
60
|
+
var getChainUtils, initRsbuildConfig, createDevServer, formatStats, getDevMiddleware, getStatsOptions, stringifyConfig, outputInspectConfigFiles, getRsbuildInspectConfig, chainToConfig, modifyBundlerChain, onCompileDone, prettyTime, castArray;
|
|
61
61
|
var init_shared = __esm({
|
|
62
62
|
"src/shared.ts"() {
|
|
63
63
|
"use strict";
|
|
@@ -77,6 +77,12 @@ var init_shared = __esm({
|
|
|
77
77
|
onCompileDone,
|
|
78
78
|
prettyTime
|
|
79
79
|
} = __internalHelper);
|
|
80
|
+
castArray = (arr) => {
|
|
81
|
+
if (arr === void 0) {
|
|
82
|
+
return [];
|
|
83
|
+
}
|
|
84
|
+
return Array.isArray(arr) ? arr : [arr];
|
|
85
|
+
};
|
|
80
86
|
}
|
|
81
87
|
});
|
|
82
88
|
|
|
@@ -157,9 +163,6 @@ import {
|
|
|
157
163
|
__internalHelper as __internalHelper2,
|
|
158
164
|
logger
|
|
159
165
|
} from "@rsbuild/core";
|
|
160
|
-
import {
|
|
161
|
-
castArray
|
|
162
|
-
} from "@rsbuild/shared";
|
|
163
166
|
import { reduceConfigsWithContext } from "reduce-configs";
|
|
164
167
|
async function modifyWebpackChain(context, utils, chain) {
|
|
165
168
|
logger.debug("modify webpack chain");
|
|
@@ -167,8 +170,8 @@ async function modifyWebpackChain(context, utils, chain) {
|
|
|
167
170
|
chain,
|
|
168
171
|
utils
|
|
169
172
|
);
|
|
170
|
-
if (
|
|
171
|
-
for (const item of castArray(
|
|
173
|
+
if (utils.environment.config.tools?.webpackChain) {
|
|
174
|
+
for (const item of castArray(utils.environment.config.tools.webpackChain)) {
|
|
172
175
|
item(modifiedChain, utils);
|
|
173
176
|
}
|
|
174
177
|
}
|
|
@@ -181,10 +184,10 @@ async function modifyWebpackConfig(context, webpackConfig, utils) {
|
|
|
181
184
|
webpackConfig,
|
|
182
185
|
utils
|
|
183
186
|
);
|
|
184
|
-
if (
|
|
187
|
+
if (utils.environment.config.tools?.webpack) {
|
|
185
188
|
modifiedConfig = reduceConfigsWithContext({
|
|
186
189
|
initial: modifiedConfig,
|
|
187
|
-
config:
|
|
190
|
+
config: utils.environment.config.tools.webpack,
|
|
188
191
|
ctx: utils,
|
|
189
192
|
mergeFn: utils.mergeConfig
|
|
190
193
|
});
|
|
@@ -206,44 +209,6 @@ async function getChainUtils2(target, environment) {
|
|
|
206
209
|
HtmlWebpackPlugin: __internalHelper2.getHTMLPlugin()
|
|
207
210
|
};
|
|
208
211
|
}
|
|
209
|
-
async function getConfigUtils(config, chainUtils) {
|
|
210
|
-
const { merge } = await import("@rsbuild/shared/webpack-merge");
|
|
211
|
-
return {
|
|
212
|
-
...chainUtils,
|
|
213
|
-
mergeConfig: merge,
|
|
214
|
-
addRules(rules) {
|
|
215
|
-
const ruleArr = castArray(rules);
|
|
216
|
-
if (!config.module) {
|
|
217
|
-
config.module = {};
|
|
218
|
-
}
|
|
219
|
-
if (!config.module.rules) {
|
|
220
|
-
config.module.rules = [];
|
|
221
|
-
}
|
|
222
|
-
config.module.rules.unshift(...ruleArr);
|
|
223
|
-
},
|
|
224
|
-
prependPlugins(plugins) {
|
|
225
|
-
const pluginArr = castArray(plugins);
|
|
226
|
-
if (!config.plugins) {
|
|
227
|
-
config.plugins = [];
|
|
228
|
-
}
|
|
229
|
-
config.plugins.unshift(...pluginArr);
|
|
230
|
-
},
|
|
231
|
-
appendPlugins(plugins) {
|
|
232
|
-
const pluginArr = castArray(plugins);
|
|
233
|
-
if (!config.plugins) {
|
|
234
|
-
config.plugins = [];
|
|
235
|
-
}
|
|
236
|
-
config.plugins.push(...pluginArr);
|
|
237
|
-
},
|
|
238
|
-
removePlugin(pluginName) {
|
|
239
|
-
if (config.plugins) {
|
|
240
|
-
config.plugins = config.plugins.filter(
|
|
241
|
-
(item) => item?.constructor.name !== pluginName
|
|
242
|
-
);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
212
|
async function generateWebpackConfig({
|
|
248
213
|
target,
|
|
249
214
|
context,
|
|
@@ -273,10 +238,14 @@ async function generateWebpackConfig({
|
|
|
273
238
|
});
|
|
274
239
|
const chain = await modifyWebpackChain(context, chainUtils, bundlerChain);
|
|
275
240
|
let webpackConfig = chainToConfig(chain);
|
|
241
|
+
const configUtils = await __internalHelper2.getConfigUtils(
|
|
242
|
+
webpackConfig,
|
|
243
|
+
chainUtils
|
|
244
|
+
);
|
|
276
245
|
webpackConfig = await modifyWebpackConfig(
|
|
277
246
|
context,
|
|
278
247
|
webpackConfig,
|
|
279
|
-
|
|
248
|
+
configUtils
|
|
280
249
|
);
|
|
281
250
|
return webpackConfig;
|
|
282
251
|
}
|
|
@@ -1879,7 +1848,7 @@ var init_utils = __esm({
|
|
|
1879
1848
|
});
|
|
1880
1849
|
|
|
1881
1850
|
// src/progress/helpers/bar.ts
|
|
1882
|
-
import
|
|
1851
|
+
import colors from "picocolors";
|
|
1883
1852
|
var import_cli_truncate, defaultOption, padding, FULL_WIDTH, MIDDLE_WIDTH, renderBar;
|
|
1884
1853
|
var init_bar = __esm({
|
|
1885
1854
|
"src/progress/helpers/bar.ts"() {
|
|
@@ -2224,9 +2193,9 @@ var init_bus = __esm({
|
|
|
2224
2193
|
}
|
|
2225
2194
|
});
|
|
2226
2195
|
|
|
2227
|
-
// src/progress/helpers/
|
|
2228
|
-
var
|
|
2229
|
-
"src/progress/helpers/
|
|
2196
|
+
// src/progress/helpers/types.ts
|
|
2197
|
+
var init_types = __esm({
|
|
2198
|
+
"src/progress/helpers/types.ts"() {
|
|
2230
2199
|
"use strict";
|
|
2231
2200
|
init_esm();
|
|
2232
2201
|
}
|
|
@@ -2273,14 +2242,14 @@ var init_helpers = __esm({
|
|
|
2273
2242
|
init_esm();
|
|
2274
2243
|
init_bus();
|
|
2275
2244
|
init_bar();
|
|
2276
|
-
|
|
2245
|
+
init_types();
|
|
2277
2246
|
init_percentage();
|
|
2278
2247
|
}
|
|
2279
2248
|
});
|
|
2280
2249
|
|
|
2281
2250
|
// src/progress/helpers/nonTty.ts
|
|
2282
2251
|
import { logger as logger4 } from "@rsbuild/core";
|
|
2283
|
-
import
|
|
2252
|
+
import color from "picocolors";
|
|
2284
2253
|
function createNonTTYLogger() {
|
|
2285
2254
|
let prevPercentage = 0;
|
|
2286
2255
|
const log = ({
|
|
@@ -2323,7 +2292,7 @@ __export(ProgressPlugin_exports, {
|
|
|
2323
2292
|
ProgressPlugin: () => ProgressPlugin
|
|
2324
2293
|
});
|
|
2325
2294
|
import { logger as logger5 } from "@rsbuild/core";
|
|
2326
|
-
import
|
|
2295
|
+
import color2 from "picocolors";
|
|
2327
2296
|
import webpack from "webpack";
|
|
2328
2297
|
var ProgressPlugin;
|
|
2329
2298
|
var init_ProgressPlugin = __esm({
|
|
@@ -2407,7 +2376,6 @@ __export(plugin_exports, {
|
|
|
2407
2376
|
pluginAdaptor: () => pluginAdaptor
|
|
2408
2377
|
});
|
|
2409
2378
|
import fs from "fs";
|
|
2410
|
-
import { castArray as castArray2 } from "@rsbuild/shared";
|
|
2411
2379
|
async function applyTsConfigPathsPlugin({
|
|
2412
2380
|
chain,
|
|
2413
2381
|
CHAIN_ID,
|
|
@@ -2426,7 +2394,7 @@ async function applyTsConfigPathsPlugin({
|
|
|
2426
2394
|
]);
|
|
2427
2395
|
}
|
|
2428
2396
|
function isWebTarget(target) {
|
|
2429
|
-
const targets =
|
|
2397
|
+
const targets = castArray(target);
|
|
2430
2398
|
return targets.includes("web") || target.includes("web-worker");
|
|
2431
2399
|
}
|
|
2432
2400
|
var getMainFields, pluginAdaptor;
|
|
@@ -2434,6 +2402,7 @@ var init_plugin = __esm({
|
|
|
2434
2402
|
"src/plugin.ts"() {
|
|
2435
2403
|
"use strict";
|
|
2436
2404
|
init_esm();
|
|
2405
|
+
init_shared();
|
|
2437
2406
|
getMainFields = (chain, target) => {
|
|
2438
2407
|
const mainFields = chain.resolve.mainFields.values();
|
|
2439
2408
|
if (mainFields.length) {
|
|
@@ -2553,19 +2522,21 @@ var init_build = __esm({
|
|
|
2553
2522
|
});
|
|
2554
2523
|
return;
|
|
2555
2524
|
}
|
|
2556
|
-
await new Promise(
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2525
|
+
await new Promise(
|
|
2526
|
+
(resolve, reject) => {
|
|
2527
|
+
compiler.run((err, stats) => {
|
|
2528
|
+
if (err || stats?.hasErrors()) {
|
|
2529
|
+
const buildError = err || new Error("Webpack build failed!");
|
|
2530
|
+
reject(buildError);
|
|
2531
|
+
} else {
|
|
2532
|
+
compiler.close((closeErr) => {
|
|
2533
|
+
closeErr && logger6.error(closeErr);
|
|
2534
|
+
resolve({ stats });
|
|
2535
|
+
});
|
|
2536
|
+
}
|
|
2537
|
+
});
|
|
2538
|
+
}
|
|
2539
|
+
);
|
|
2569
2540
|
};
|
|
2570
2541
|
}
|
|
2571
2542
|
});
|
package/dist/initConfigs.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { type CreateRsbuildOptions } from '@rsbuild/core';
|
|
2
|
-
import type { PluginManager } from '@rsbuild/shared';
|
|
1
|
+
import { type CreateRsbuildOptions, type PluginManager } from '@rsbuild/core';
|
|
3
2
|
import { type InternalContext } from './shared';
|
|
4
3
|
import type { WebpackConfig } from './types';
|
|
5
4
|
export type InitConfigsOptions = {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { Colors } from '@rsbuild/shared';
|
|
2
1
|
import type { LogUpdate } from './log';
|
|
3
|
-
import type { Props } from './
|
|
2
|
+
import type { Colors, Props } from './types';
|
|
4
3
|
export declare const getProgressColor: (index: number) => Colors;
|
|
5
4
|
declare class Bus {
|
|
6
5
|
states: Partial<Props>[];
|
package/dist/shared.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { __internalHelper } from '@rsbuild/core';
|
|
|
2
2
|
declare const getChainUtils: typeof __internalHelper.getChainUtils, initRsbuildConfig: typeof __internalHelper.initRsbuildConfig, createDevServer: typeof __internalHelper.createDevServer, formatStats: typeof __internalHelper.formatStats, getDevMiddleware: (multiCompiler: import("@rspack/core").Compiler | import("@rspack/core").MultiCompiler) => Promise<NonNullable<import("node_modules/@rsbuild/core/dist-types/server/devMiddleware").DevMiddleware>>, getStatsOptions: typeof __internalHelper.getStatsOptions, stringifyConfig: typeof __internalHelper.stringifyConfig, outputInspectConfigFiles: typeof __internalHelper.outputInspectConfigFiles, getRsbuildInspectConfig: ({ normalizedConfig, inspectOptions, pluginManager, }: {
|
|
3
3
|
normalizedConfig: import("@rsbuild/core").NormalizedConfig;
|
|
4
4
|
inspectOptions: import("@rsbuild/core").InspectConfigOptions;
|
|
5
|
-
pluginManager: import("@rsbuild/
|
|
5
|
+
pluginManager: import("@rsbuild/core").PluginManager;
|
|
6
6
|
}) => {
|
|
7
7
|
rawRsbuildConfig: string;
|
|
8
8
|
rsbuildConfig: import("@rsbuild/core").InspectConfigResult["origin"]["rsbuildConfig"];
|
|
@@ -11,6 +11,7 @@ declare const getChainUtils: typeof __internalHelper.getChainUtils, initRsbuildC
|
|
|
11
11
|
content: string;
|
|
12
12
|
}>;
|
|
13
13
|
environmentConfigs: import("@rsbuild/core").InspectConfigResult["origin"]["environmentConfigs"];
|
|
14
|
-
}, chainToConfig: typeof __internalHelper.chainToConfig, modifyBundlerChain: typeof __internalHelper.modifyBundlerChain, onCompileDone: (compiler: import("@rspack/core").Compiler | import("@rspack/core").MultiCompiler, onDone: (stats: import("@
|
|
14
|
+
}, chainToConfig: typeof __internalHelper.chainToConfig, modifyBundlerChain: typeof __internalHelper.modifyBundlerChain, onCompileDone: (compiler: import("@rspack/core").Compiler | import("@rspack/core").MultiCompiler, onDone: (stats: import("@rspack/core").Stats | import("@rspack/core").MultiStats) => Promise<void>, MultiStatsCtor: new (stats: import("@rspack/core").Stats[]) => import("@rspack/core").MultiStats) => void, prettyTime: (seconds: number) => string;
|
|
15
15
|
export { getChainUtils, initRsbuildConfig, createDevServer, formatStats, getDevMiddleware, getStatsOptions, stringifyConfig, outputInspectConfigFiles, chainToConfig, modifyBundlerChain, onCompileDone, prettyTime, getRsbuildInspectConfig, };
|
|
16
16
|
export type InternalContext = __internalHelper.InternalContext;
|
|
17
|
+
export declare const castArray: <T>(arr?: T | T[]) => T[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/webpack",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.3",
|
|
4
4
|
"homepage": "https://rsbuild.dev",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"copy-webpack-plugin": "11.0.0",
|
|
27
27
|
"mini-css-extract-plugin": "2.9.0",
|
|
28
|
+
"picocolors": "^1.0.1",
|
|
28
29
|
"reduce-configs": "^1.0.0",
|
|
29
30
|
"tsconfig-paths-webpack-plugin": "4.1.0",
|
|
30
31
|
"webpack": "^5.92.1",
|
|
31
|
-
"@rsbuild/core": "1.0.0-alpha.
|
|
32
|
-
"@rsbuild/shared": "1.0.0-alpha.2"
|
|
32
|
+
"@rsbuild/core": "1.0.0-alpha.3"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/node": "18.x",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"cli-truncate": "2.1.0",
|
|
38
38
|
"patch-console": "1.0.0",
|
|
39
39
|
"typescript": "^5.5.2",
|
|
40
|
-
"@scripts/test-helper": "1.0.0-alpha.
|
|
40
|
+
"@scripts/test-helper": "1.0.0-alpha.3"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public",
|