@rsbuild/core 1.2.15 → 1.2.16
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/compiled/ws/index.d.ts +49 -13
- package/dist/index.cjs +78 -58
- package/dist/index.js +78 -58
- package/dist-types/types/config.d.ts +3 -3
- package/dist-types/types/hooks.d.ts +26 -0
- package/package.json +2 -2
package/compiled/ws/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import { ClientRequestArgs, IncomingMessage, ClientRequest, OutgoingHttpHeaders, Agent, Server } from 'http';
|
|
4
4
|
import { Server as Server$1 } from 'https';
|
|
5
|
+
import { createConnection } from 'net';
|
|
5
6
|
import { Duplex, DuplexOptions } from 'stream';
|
|
6
7
|
import { SecureContextOptions } from 'tls';
|
|
7
8
|
import { URL } from 'url';
|
|
@@ -18,6 +19,7 @@ type BufferLike =
|
|
|
18
19
|
| Uint8Array
|
|
19
20
|
| ArrayBuffer
|
|
20
21
|
| SharedArrayBuffer
|
|
22
|
+
| Blob
|
|
21
23
|
| readonly any[]
|
|
22
24
|
| readonly number[]
|
|
23
25
|
| { valueOf(): ArrayBuffer }
|
|
@@ -108,21 +110,26 @@ declare class WebSocket extends EventEmitter {
|
|
|
108
110
|
// HTML5 WebSocket events
|
|
109
111
|
addEventListener<K extends keyof WebSocket.WebSocketEventMap>(
|
|
110
112
|
type: K,
|
|
111
|
-
listener:
|
|
113
|
+
listener:
|
|
114
|
+
| ((event: WebSocket.WebSocketEventMap[K]) => void)
|
|
115
|
+
| { handleEvent(event: WebSocket.WebSocketEventMap[K]): void },
|
|
112
116
|
options?: WebSocket.EventListenerOptions,
|
|
113
117
|
): void;
|
|
114
118
|
removeEventListener<K extends keyof WebSocket.WebSocketEventMap>(
|
|
115
119
|
type: K,
|
|
116
|
-
listener:
|
|
120
|
+
listener:
|
|
121
|
+
| ((event: WebSocket.WebSocketEventMap[K]) => void)
|
|
122
|
+
| { handleEvent(event: WebSocket.WebSocketEventMap[K]): void },
|
|
117
123
|
): void;
|
|
118
124
|
|
|
119
125
|
// Events
|
|
120
126
|
on(event: "close", listener: (this: WebSocket, code: number, reason: Buffer) => void): this;
|
|
121
|
-
on(event: "error", listener: (this: WebSocket,
|
|
127
|
+
on(event: "error", listener: (this: WebSocket, error: Error) => void): this;
|
|
122
128
|
on(event: "upgrade", listener: (this: WebSocket, request: IncomingMessage) => void): this;
|
|
123
129
|
on(event: "message", listener: (this: WebSocket, data: WebSocket.RawData, isBinary: boolean) => void): this;
|
|
124
130
|
on(event: "open", listener: (this: WebSocket) => void): this;
|
|
125
131
|
on(event: "ping" | "pong", listener: (this: WebSocket, data: Buffer) => void): this;
|
|
132
|
+
on(event: "redirect", listener: (this: WebSocket, url: string, request: ClientRequest) => void): this;
|
|
126
133
|
on(
|
|
127
134
|
event: "unexpected-response",
|
|
128
135
|
listener: (this: WebSocket, request: ClientRequest, response: IncomingMessage) => void,
|
|
@@ -130,11 +137,12 @@ declare class WebSocket extends EventEmitter {
|
|
|
130
137
|
on(event: string | symbol, listener: (this: WebSocket, ...args: any[]) => void): this;
|
|
131
138
|
|
|
132
139
|
once(event: "close", listener: (this: WebSocket, code: number, reason: Buffer) => void): this;
|
|
133
|
-
once(event: "error", listener: (this: WebSocket,
|
|
140
|
+
once(event: "error", listener: (this: WebSocket, error: Error) => void): this;
|
|
134
141
|
once(event: "upgrade", listener: (this: WebSocket, request: IncomingMessage) => void): this;
|
|
135
142
|
once(event: "message", listener: (this: WebSocket, data: WebSocket.RawData, isBinary: boolean) => void): this;
|
|
136
143
|
once(event: "open", listener: (this: WebSocket) => void): this;
|
|
137
144
|
once(event: "ping" | "pong", listener: (this: WebSocket, data: Buffer) => void): this;
|
|
145
|
+
once(event: "redirect", listener: (this: WebSocket, url: string, request: ClientRequest) => void): this;
|
|
138
146
|
once(
|
|
139
147
|
event: "unexpected-response",
|
|
140
148
|
listener: (this: WebSocket, request: ClientRequest, response: IncomingMessage) => void,
|
|
@@ -142,11 +150,12 @@ declare class WebSocket extends EventEmitter {
|
|
|
142
150
|
once(event: string | symbol, listener: (this: WebSocket, ...args: any[]) => void): this;
|
|
143
151
|
|
|
144
152
|
off(event: "close", listener: (this: WebSocket, code: number, reason: Buffer) => void): this;
|
|
145
|
-
off(event: "error", listener: (this: WebSocket,
|
|
153
|
+
off(event: "error", listener: (this: WebSocket, error: Error) => void): this;
|
|
146
154
|
off(event: "upgrade", listener: (this: WebSocket, request: IncomingMessage) => void): this;
|
|
147
155
|
off(event: "message", listener: (this: WebSocket, data: WebSocket.RawData, isBinary: boolean) => void): this;
|
|
148
156
|
off(event: "open", listener: (this: WebSocket) => void): this;
|
|
149
157
|
off(event: "ping" | "pong", listener: (this: WebSocket, data: Buffer) => void): this;
|
|
158
|
+
off(event: "redirect", listener: (this: WebSocket, url: string, request: ClientRequest) => void): this;
|
|
150
159
|
off(
|
|
151
160
|
event: "unexpected-response",
|
|
152
161
|
listener: (this: WebSocket, request: ClientRequest, response: IncomingMessage) => void,
|
|
@@ -154,11 +163,12 @@ declare class WebSocket extends EventEmitter {
|
|
|
154
163
|
off(event: string | symbol, listener: (this: WebSocket, ...args: any[]) => void): this;
|
|
155
164
|
|
|
156
165
|
addListener(event: "close", listener: (code: number, reason: Buffer) => void): this;
|
|
157
|
-
addListener(event: "error", listener: (
|
|
166
|
+
addListener(event: "error", listener: (error: Error) => void): this;
|
|
158
167
|
addListener(event: "upgrade", listener: (request: IncomingMessage) => void): this;
|
|
159
168
|
addListener(event: "message", listener: (data: WebSocket.RawData, isBinary: boolean) => void): this;
|
|
160
169
|
addListener(event: "open", listener: () => void): this;
|
|
161
170
|
addListener(event: "ping" | "pong", listener: (data: Buffer) => void): this;
|
|
171
|
+
addListener(event: "redirect", listener: (url: string, request: ClientRequest) => void): this;
|
|
162
172
|
addListener(
|
|
163
173
|
event: "unexpected-response",
|
|
164
174
|
listener: (request: ClientRequest, response: IncomingMessage) => void,
|
|
@@ -166,11 +176,12 @@ declare class WebSocket extends EventEmitter {
|
|
|
166
176
|
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
167
177
|
|
|
168
178
|
removeListener(event: "close", listener: (code: number, reason: Buffer) => void): this;
|
|
169
|
-
removeListener(event: "error", listener: (
|
|
179
|
+
removeListener(event: "error", listener: (error: Error) => void): this;
|
|
170
180
|
removeListener(event: "upgrade", listener: (request: IncomingMessage) => void): this;
|
|
171
181
|
removeListener(event: "message", listener: (data: WebSocket.RawData, isBinary: boolean) => void): this;
|
|
172
182
|
removeListener(event: "open", listener: () => void): this;
|
|
173
183
|
removeListener(event: "ping" | "pong", listener: (data: Buffer) => void): this;
|
|
184
|
+
removeListener(event: "redirect", listener: (url: string, request: ClientRequest) => void): this;
|
|
174
185
|
removeListener(
|
|
175
186
|
event: "unexpected-response",
|
|
176
187
|
listener: (request: ClientRequest, response: IncomingMessage) => void,
|
|
@@ -239,8 +250,11 @@ declare namespace WebSocket {
|
|
|
239
250
|
family?: number | undefined;
|
|
240
251
|
checkServerIdentity?(servername: string, cert: CertMeta): boolean;
|
|
241
252
|
rejectUnauthorized?: boolean | undefined;
|
|
253
|
+
allowSynchronousEvents?: boolean | undefined;
|
|
254
|
+
autoPong?: boolean | undefined;
|
|
242
255
|
maxPayload?: number | undefined;
|
|
243
256
|
skipUTF8Validation?: boolean | undefined;
|
|
257
|
+
createConnection?: typeof createConnection | undefined;
|
|
244
258
|
finishRequest?: FinishRequestCallback | undefined;
|
|
245
259
|
}
|
|
246
260
|
|
|
@@ -317,6 +331,8 @@ declare namespace WebSocket {
|
|
|
317
331
|
handleProtocols?: (protocols: Set<string>, request: InstanceType<V>) => string | false;
|
|
318
332
|
path?: string | undefined;
|
|
319
333
|
noServer?: boolean | undefined;
|
|
334
|
+
allowSynchronousEvents?: boolean | undefined;
|
|
335
|
+
autoPong?: boolean | undefined;
|
|
320
336
|
clientTracking?: boolean | undefined;
|
|
321
337
|
perMessageDeflate?: boolean | PerMessageDeflateOptions | undefined;
|
|
322
338
|
maxPayload?: number | undefined;
|
|
@@ -352,19 +368,30 @@ declare namespace WebSocket {
|
|
|
352
368
|
shouldHandle(request: InstanceType<U>): boolean | Promise<boolean>;
|
|
353
369
|
|
|
354
370
|
// Events
|
|
355
|
-
on(
|
|
371
|
+
on(
|
|
372
|
+
event: "connection",
|
|
373
|
+
cb: (this: Server<T>, websocket: InstanceType<T>, request: InstanceType<U>) => void,
|
|
374
|
+
): this;
|
|
356
375
|
on(event: "error", cb: (this: Server<T>, error: Error) => void): this;
|
|
357
376
|
on(event: "headers", cb: (this: Server<T>, headers: string[], request: InstanceType<U>) => void): this;
|
|
358
377
|
on(event: "close" | "listening", cb: (this: Server<T>) => void): this;
|
|
378
|
+
on(
|
|
379
|
+
event: "wsClientError",
|
|
380
|
+
cb: (this: Server<T>, error: Error, socket: Duplex, request: InstanceType<U>) => void,
|
|
381
|
+
): this;
|
|
359
382
|
on(event: string | symbol, listener: (this: Server<T>, ...args: any[]) => void): this;
|
|
360
383
|
|
|
361
384
|
once(
|
|
362
385
|
event: "connection",
|
|
363
|
-
cb: (this: Server<T>,
|
|
386
|
+
cb: (this: Server<T>, websocket: InstanceType<T>, request: InstanceType<U>) => void,
|
|
364
387
|
): this;
|
|
365
388
|
once(event: "error", cb: (this: Server<T>, error: Error) => void): this;
|
|
366
389
|
once(event: "headers", cb: (this: Server<T>, headers: string[], request: InstanceType<U>) => void): this;
|
|
367
390
|
once(event: "close" | "listening", cb: (this: Server<T>) => void): this;
|
|
391
|
+
once(
|
|
392
|
+
event: "wsClientError",
|
|
393
|
+
cb: (this: Server<T>, error: Error, socket: Duplex, request: InstanceType<U>) => void,
|
|
394
|
+
): this;
|
|
368
395
|
once(event: string | symbol, listener: (this: Server<T>, ...args: any[]) => void): this;
|
|
369
396
|
|
|
370
397
|
off(
|
|
@@ -374,18 +401,27 @@ declare namespace WebSocket {
|
|
|
374
401
|
off(event: "error", cb: (this: Server<T>, error: Error) => void): this;
|
|
375
402
|
off(event: "headers", cb: (this: Server<T>, headers: string[], request: InstanceType<U>) => void): this;
|
|
376
403
|
off(event: "close" | "listening", cb: (this: Server<T>) => void): this;
|
|
404
|
+
off(
|
|
405
|
+
event: "wsClientError",
|
|
406
|
+
cb: (this: Server<T>, error: Error, socket: Duplex, request: InstanceType<U>) => void,
|
|
407
|
+
): this;
|
|
377
408
|
off(event: string | symbol, listener: (this: Server<T>, ...args: any[]) => void): this;
|
|
378
409
|
|
|
379
|
-
addListener(event: "connection", cb: (
|
|
380
|
-
addListener(event: "error", cb: (
|
|
410
|
+
addListener(event: "connection", cb: (websocket: InstanceType<T>, request: InstanceType<U>) => void): this;
|
|
411
|
+
addListener(event: "error", cb: (error: Error) => void): this;
|
|
381
412
|
addListener(event: "headers", cb: (headers: string[], request: InstanceType<U>) => void): this;
|
|
382
413
|
addListener(event: "close" | "listening", cb: () => void): this;
|
|
414
|
+
addListener(event: "wsClientError", cb: (error: Error, socket: Duplex, request: InstanceType<U>) => void): this;
|
|
383
415
|
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
384
416
|
|
|
385
|
-
removeListener(event: "connection", cb: (
|
|
386
|
-
removeListener(event: "error", cb: (
|
|
417
|
+
removeListener(event: "connection", cb: (websocket: InstanceType<T>, request: InstanceType<U>) => void): this;
|
|
418
|
+
removeListener(event: "error", cb: (error: Error) => void): this;
|
|
387
419
|
removeListener(event: "headers", cb: (headers: string[], request: InstanceType<U>) => void): this;
|
|
388
420
|
removeListener(event: "close" | "listening", cb: () => void): this;
|
|
421
|
+
removeListener(
|
|
422
|
+
event: "wsClientError",
|
|
423
|
+
cb: (error: Error, socket: Duplex, request: InstanceType<U>) => void,
|
|
424
|
+
): this;
|
|
389
425
|
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
390
426
|
}
|
|
391
427
|
|
package/dist/index.cjs
CHANGED
|
@@ -1744,7 +1744,7 @@ var __webpack_exports__ = {};
|
|
|
1744
1744
|
async function createContext(options, userConfig, bundlerType) {
|
|
1745
1745
|
let { cwd } = options, rootPath = userConfig.root ? getAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, external_node_path_namespaceObject.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0;
|
|
1746
1746
|
return {
|
|
1747
|
-
version: "1.2.
|
|
1747
|
+
version: "1.2.16",
|
|
1748
1748
|
rootPath,
|
|
1749
1749
|
distPath: '',
|
|
1750
1750
|
cachePath,
|
|
@@ -2372,9 +2372,26 @@ var __webpack_exports__ = {};
|
|
|
2372
2372
|
localIdentName,
|
|
2373
2373
|
emitCss
|
|
2374
2374
|
});
|
|
2375
|
-
rule.use(CHAIN_ID.USE.CSS).options(cssLoaderOptions)
|
|
2375
|
+
rule.use(CHAIN_ID.USE.CSS).options(cssLoaderOptions);
|
|
2376
|
+
let isStringExport = 'string' === cssLoaderOptions.exportType;
|
|
2377
|
+
if (isStringExport && rule.uses.has(CHAIN_ID.USE.MINI_CSS_EXTRACT) && rule.uses.delete(CHAIN_ID.USE.MINI_CSS_EXTRACT), rule.merge({
|
|
2376
2378
|
sideEffects: !0
|
|
2377
|
-
}), rule.resolve.preferRelative(!0)
|
|
2379
|
+
}), rule.resolve.preferRelative(!0), emitCss && !config.output.injectStyles && !isStringExport) {
|
|
2380
|
+
let extractPluginOptions = config.tools.cssExtract.pluginOptions, cssPath = config.output.distPath.css, cssFilename = getFilename(config, 'css', isProd), isCssFilenameFn = 'function' == typeof cssFilename, cssAsyncPath = config.output.distPath.cssAsync ?? (cssPath ? `${cssPath}/async` : 'async');
|
|
2381
|
+
chain.plugin(CHAIN_ID.PLUGIN.MINI_CSS_EXTRACT).use(getCssExtractPlugin(), [
|
|
2382
|
+
{
|
|
2383
|
+
filename: isCssFilenameFn ? (...args)=>{
|
|
2384
|
+
let name = cssFilename(...args);
|
|
2385
|
+
return external_node_path_namespaceObject.posix.join(cssPath, name);
|
|
2386
|
+
} : external_node_path_namespaceObject.posix.join(cssPath, cssFilename),
|
|
2387
|
+
chunkFilename: isCssFilenameFn ? (...args)=>{
|
|
2388
|
+
let name = cssFilename(...args);
|
|
2389
|
+
return external_node_path_namespaceObject.posix.join(cssAsyncPath, name);
|
|
2390
|
+
} : external_node_path_namespaceObject.posix.join(cssAsyncPath, cssFilename),
|
|
2391
|
+
...extractPluginOptions
|
|
2392
|
+
}
|
|
2393
|
+
]);
|
|
2394
|
+
}
|
|
2378
2395
|
}
|
|
2379
2396
|
});
|
|
2380
2397
|
}
|
|
@@ -2464,21 +2481,24 @@ var __webpack_exports__ = {};
|
|
|
2464
2481
|
if (0 === assets.length) return logs;
|
|
2465
2482
|
logs.push(''), assets.sort((a, b)=>a.size - b.size);
|
|
2466
2483
|
let longestLabelLength = Math.max(...assets.map((a)=>a.sizeLabel.length)), longestFileLength = Math.max(...assets.map((a)=>(a.folder + external_node_path_default().sep + a.name).length));
|
|
2467
|
-
!1 !== options.detail
|
|
2468
|
-
let
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2484
|
+
if (!1 !== options.detail) {
|
|
2485
|
+
let showGzipHeader = !!(options.compressed && assets.some((item)=>null !== item.gzippedSize));
|
|
2486
|
+
logs.push(function(longestFileLength, longestLabelLength, environmentName, showGzipHeader) {
|
|
2487
|
+
let longestLengths = [
|
|
2488
|
+
longestFileLength,
|
|
2489
|
+
longestLabelLength
|
|
2490
|
+
], rowTypes = [
|
|
2491
|
+
`File (${environmentName})`,
|
|
2492
|
+
'Size'
|
|
2493
|
+
];
|
|
2494
|
+
showGzipHeader && rowTypes.push('Gzip');
|
|
2495
|
+
let headerRow = rowTypes.reduce((prev, cur, index)=>{
|
|
2496
|
+
let length = longestLengths[index], curLabel = cur;
|
|
2497
|
+
return length && (curLabel = cur.length < length ? cur + ' '.repeat(length - cur.length) : cur), `${prev + curLabel} `;
|
|
2498
|
+
}, ' ');
|
|
2499
|
+
return index_js_default().blue(headerRow);
|
|
2500
|
+
}(longestFileLength, longestLabelLength, environmentName, showGzipHeader));
|
|
2501
|
+
}
|
|
2482
2502
|
let totalSize = 0, totalGzipSize = 0;
|
|
2483
2503
|
for (let asset of assets){
|
|
2484
2504
|
let { sizeLabel } = asset, { name, folder, gzipSizeLabel } = asset, fileNameLength = (folder + external_node_path_default().sep + name).length, sizeLength = sizeLabel.length;
|
|
@@ -3206,7 +3226,10 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3206
3226
|
...headTags,
|
|
3207
3227
|
...bodyTags
|
|
3208
3228
|
];
|
|
3209
|
-
if (nonce) for (let tag of allTags)
|
|
3229
|
+
if (nonce) for (let tag of allTags){
|
|
3230
|
+
var _tag_attrs, _tag_attrs1;
|
|
3231
|
+
("script" === tag.tag || 'style' === tag.tag || 'link' === tag.tag && (null === (_tag_attrs = tag.attrs) || void 0 === _tag_attrs ? void 0 : _tag_attrs.rel) === 'preload' && (null === (_tag_attrs1 = tag.attrs) || void 0 === _tag_attrs1 ? void 0 : _tag_attrs1.as) === "script") && (tag.attrs ??= {}, tag.attrs.nonce = nonce);
|
|
3232
|
+
}
|
|
3210
3233
|
return {
|
|
3211
3234
|
headTags,
|
|
3212
3235
|
bodyTags
|
|
@@ -3440,7 +3463,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3440
3463
|
let getJsAsyncPath = (jsPath, isServer, jsAsync)=>void 0 !== jsAsync ? jsAsync : isServer ? jsPath : jsPath ? `${jsPath}/async` : 'async', pluginOutput = ()=>({
|
|
3441
3464
|
name: 'rsbuild:output',
|
|
3442
3465
|
setup (api) {
|
|
3443
|
-
api.modifyBundlerChain(async (chain, { CHAIN_ID,
|
|
3466
|
+
api.modifyBundlerChain(async (chain, { CHAIN_ID, isProd, isServer, environment })=>{
|
|
3444
3467
|
let { distPath, config } = environment, publicPath = function({ isProd, config, context }) {
|
|
3445
3468
|
var _context_devServer, _context_devServer1, _context_devServer2;
|
|
3446
3469
|
let { dev, output, server } = config, publicPath = DEFAULT_ASSET_PREFIX, port = (null === (_context_devServer = context.devServer) || void 0 === _context_devServer ? void 0 : _context_devServer.port) || server.port || 3000;
|
|
@@ -3473,23 +3496,6 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3473
3496
|
options
|
|
3474
3497
|
]);
|
|
3475
3498
|
}
|
|
3476
|
-
let emitCss = config.output.emitCss ?? 'web' === target;
|
|
3477
|
-
if (!config.output.injectStyles && emitCss) {
|
|
3478
|
-
let extractPluginOptions = config.tools.cssExtract.pluginOptions, cssPath = config.output.distPath.css, cssFilename = getFilename(config, 'css', isProd), isCssFilenameFn = 'function' == typeof cssFilename, cssAsyncPath = config.output.distPath.cssAsync ?? (cssPath ? `${cssPath}/async` : 'async');
|
|
3479
|
-
chain.plugin(CHAIN_ID.PLUGIN.MINI_CSS_EXTRACT).use(getCssExtractPlugin(), [
|
|
3480
|
-
{
|
|
3481
|
-
filename: isCssFilenameFn ? (...args)=>{
|
|
3482
|
-
let name = cssFilename(...args);
|
|
3483
|
-
return external_node_path_namespaceObject.posix.join(cssPath, name);
|
|
3484
|
-
} : external_node_path_namespaceObject.posix.join(cssPath, cssFilename),
|
|
3485
|
-
chunkFilename: isCssFilenameFn ? (...args)=>{
|
|
3486
|
-
let name = cssFilename(...args);
|
|
3487
|
-
return external_node_path_namespaceObject.posix.join(cssAsyncPath, name);
|
|
3488
|
-
} : external_node_path_namespaceObject.posix.join(cssAsyncPath, cssFilename),
|
|
3489
|
-
...extractPluginOptions
|
|
3490
|
-
}
|
|
3491
|
-
]);
|
|
3492
|
-
}
|
|
3493
3499
|
});
|
|
3494
3500
|
}
|
|
3495
3501
|
}), pluginPerformance = ()=>({
|
|
@@ -3985,7 +3991,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3985
3991
|
};
|
|
3986
3992
|
'webpack' === api.context.bundlerType && (defaultConfig.enforceSizeThreshold = 50000);
|
|
3987
3993
|
let { chunkSplit } = config.performance, forceSplittingGroups = {};
|
|
3988
|
-
chunkSplit.forceSplitting && (forceSplittingGroups = function(forceSplitting) {
|
|
3994
|
+
chunkSplit.forceSplitting && (forceSplittingGroups = function(forceSplitting, strategy) {
|
|
3989
3995
|
let cacheGroups = {};
|
|
3990
3996
|
for (let [key, regexp] of Array.isArray(forceSplitting) ? forceSplitting.map((regexp, index)=>[
|
|
3991
3997
|
`force-split-${index}`,
|
|
@@ -3994,11 +4000,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3994
4000
|
test: regexp,
|
|
3995
4001
|
name: key,
|
|
3996
4002
|
chunks: 'all',
|
|
3997
|
-
priority:
|
|
4003
|
+
priority: +('single-vendor' === strategy),
|
|
3998
4004
|
enforce: !0
|
|
3999
4005
|
};
|
|
4000
4006
|
return cacheGroups;
|
|
4001
|
-
}(chunkSplit.forceSplitting));
|
|
4007
|
+
}(chunkSplit.forceSplitting, chunkSplit.strategy));
|
|
4002
4008
|
let override = 'custom' === chunkSplit.strategy ? chunkSplit.splitChunks ?? chunkSplit.override : chunkSplit.override, splitChunksOptions = await SPLIT_STRATEGY_DISPATCHER[chunkSplit.strategy || 'split-by-experience']({
|
|
4003
4009
|
defaultConfig,
|
|
4004
4010
|
override: override || {},
|
|
@@ -5730,11 +5736,21 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5730
5736
|
})).middlewares))Array.isArray(item) ? middlewares.use(...item) : middlewares.use(item);
|
|
5731
5737
|
return rslog_index_js_namespaceObject.logger.debug('create dev server done'), devServerAPI;
|
|
5732
5738
|
}
|
|
5733
|
-
function
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5739
|
+
function isLikelyFile(filePath) {
|
|
5740
|
+
return (filePath.split(external_node_path_namespaceObject.sep).pop() || '').includes('.');
|
|
5741
|
+
}
|
|
5742
|
+
function formatFileList(paths, rootPath) {
|
|
5743
|
+
let files = paths.filter(isLikelyFile);
|
|
5744
|
+
0 === files.length && (files = [
|
|
5745
|
+
paths[0]
|
|
5746
|
+
]);
|
|
5747
|
+
let fileInfo = files.slice(0, 1).map((file)=>(function(originalFilePath, root) {
|
|
5748
|
+
let prefix = root.endsWith(external_node_path_namespaceObject.sep) ? root : root + external_node_path_namespaceObject.sep, filePath = originalFilePath;
|
|
5749
|
+
filePath.startsWith(prefix) && (filePath = filePath.slice(prefix.length));
|
|
5750
|
+
let parts = filePath.split(external_node_path_namespaceObject.sep).filter(Boolean);
|
|
5751
|
+
return parts.length > 3 ? parts.slice(-3).join(external_node_path_namespaceObject.sep) : parts.join(external_node_path_namespaceObject.sep);
|
|
5752
|
+
})(file, rootPath)).join(', ');
|
|
5753
|
+
return files.length > 1 ? `${fileInfo} and ${files.length - 1} more` : fileInfo;
|
|
5738
5754
|
}
|
|
5739
5755
|
async function createCompiler_createCompiler(options) {
|
|
5740
5756
|
rslog_index_js_namespaceObject.logger.debug('create compiler');
|
|
@@ -5747,17 +5763,21 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5747
5763
|
isVersionLogged || (rslog_index_js_namespaceObject.logger.debug(`use Rspack v${core_namespaceObject.rspack.rspackVersion}`), isVersionLogged = !0);
|
|
5748
5764
|
};
|
|
5749
5765
|
compiler.hooks.watchRun.tap('rsbuild:compiling', (compiler)=>{
|
|
5750
|
-
|
|
5751
|
-
let changedFiles = compiler.modifiedFiles ? Array.from(compiler.modifiedFiles) :
|
|
5752
|
-
if (changedFiles.length) {
|
|
5753
|
-
let fileInfo =
|
|
5754
|
-
rslog_index_js_namespaceObject.logger.start(`building ${fileInfo}`);
|
|
5755
|
-
|
|
5756
|
-
|
|
5766
|
+
logRspackVersion(), isCompiling || function(compiler, context) {
|
|
5767
|
+
let changedFiles = compiler.modifiedFiles ? Array.from(compiler.modifiedFiles) : null;
|
|
5768
|
+
if (null == changedFiles ? void 0 : changedFiles.length) {
|
|
5769
|
+
let fileInfo = formatFileList(changedFiles, context.rootPath);
|
|
5770
|
+
rslog_index_js_namespaceObject.logger.start(`building ${index_js_default().dim(fileInfo)}`);
|
|
5771
|
+
return;
|
|
5772
|
+
}
|
|
5773
|
+
let removedFiles = compiler.removedFiles ? Array.from(compiler.removedFiles) : null;
|
|
5774
|
+
if (null == removedFiles ? void 0 : removedFiles.length) {
|
|
5775
|
+
let fileInfo = formatFileList(removedFiles, context.rootPath);
|
|
5757
5776
|
rslog_index_js_namespaceObject.logger.start(`building ${index_js_default().dim(`removed ${fileInfo}`)}`);
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5777
|
+
return;
|
|
5778
|
+
}
|
|
5779
|
+
rslog_index_js_namespaceObject.logger.start('build started...');
|
|
5780
|
+
}(compiler, context), isCompiling = !0;
|
|
5761
5781
|
}), 'build' === context.command && compiler.hooks.run.tap('rsbuild:run', logRspackVersion);
|
|
5762
5782
|
let done = (stats)=>{
|
|
5763
5783
|
let statsOptions = getStatsOptions(compiler), statsJson = stats.toJson({
|
|
@@ -6760,12 +6780,12 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6760
6780
|
}
|
|
6761
6781
|
}(), process.title = 'rsbuild-node';
|
|
6762
6782
|
let { npm_execpath } = process.env;
|
|
6763
|
-
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.2.
|
|
6783
|
+
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.2.16\n`);
|
|
6764
6784
|
}();
|
|
6765
6785
|
try {
|
|
6766
6786
|
!function() {
|
|
6767
6787
|
let cli = dist('rsbuild');
|
|
6768
|
-
cli.help(), cli.version("1.2.
|
|
6788
|
+
cli.help(), cli.version("1.2.16"), applyCommonOptions(cli);
|
|
6769
6789
|
let devCommand = cli.command('dev', 'starting the dev server'), buildCommand = cli.command('build', 'build the app for production'), previewCommand = cli.command('preview', 'preview the production build locally'), inspectCommand = cli.command('inspect', 'inspect the Rspack and Rsbuild configs');
|
|
6770
6790
|
applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
|
|
6771
6791
|
try {
|
|
@@ -6816,7 +6836,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6816
6836
|
rslog_index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), rslog_index_js_namespaceObject.logger.error(err);
|
|
6817
6837
|
}
|
|
6818
6838
|
}
|
|
6819
|
-
let src_rslib_entry_version = "1.2.
|
|
6839
|
+
let src_rslib_entry_version = "1.2.16";
|
|
6820
6840
|
})();
|
|
6821
6841
|
var __webpack_export_target__ = exports;
|
|
6822
6842
|
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
package/dist/index.js
CHANGED
|
@@ -1653,7 +1653,7 @@ async function updateEnvironmentContext(context, configs) {
|
|
|
1653
1653
|
async function createContext(options, userConfig, bundlerType) {
|
|
1654
1654
|
let { cwd } = options, rootPath = userConfig.root ? getAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0;
|
|
1655
1655
|
return {
|
|
1656
|
-
version: "1.2.
|
|
1656
|
+
version: "1.2.16",
|
|
1657
1657
|
rootPath,
|
|
1658
1658
|
distPath: '',
|
|
1659
1659
|
cachePath,
|
|
@@ -2280,9 +2280,26 @@ let isPostcssPluginCreator = (plugin)=>'function' == typeof plugin && !0 === plu
|
|
|
2280
2280
|
localIdentName,
|
|
2281
2281
|
emitCss
|
|
2282
2282
|
});
|
|
2283
|
-
rule.use(CHAIN_ID.USE.CSS).options(cssLoaderOptions)
|
|
2283
|
+
rule.use(CHAIN_ID.USE.CSS).options(cssLoaderOptions);
|
|
2284
|
+
let isStringExport = 'string' === cssLoaderOptions.exportType;
|
|
2285
|
+
if (isStringExport && rule.uses.has(CHAIN_ID.USE.MINI_CSS_EXTRACT) && rule.uses.delete(CHAIN_ID.USE.MINI_CSS_EXTRACT), rule.merge({
|
|
2284
2286
|
sideEffects: !0
|
|
2285
|
-
}), rule.resolve.preferRelative(!0)
|
|
2287
|
+
}), rule.resolve.preferRelative(!0), emitCss && !config.output.injectStyles && !isStringExport) {
|
|
2288
|
+
let extractPluginOptions = config.tools.cssExtract.pluginOptions, cssPath = config.output.distPath.css, cssFilename = getFilename(config, 'css', isProd), isCssFilenameFn = 'function' == typeof cssFilename, cssAsyncPath = config.output.distPath.cssAsync ?? (cssPath ? `${cssPath}/async` : 'async');
|
|
2289
|
+
chain.plugin(CHAIN_ID.PLUGIN.MINI_CSS_EXTRACT).use(getCssExtractPlugin(), [
|
|
2290
|
+
{
|
|
2291
|
+
filename: isCssFilenameFn ? (...args)=>{
|
|
2292
|
+
let name = cssFilename(...args);
|
|
2293
|
+
return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.posix.join(cssPath, name);
|
|
2294
|
+
} : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.posix.join(cssPath, cssFilename),
|
|
2295
|
+
chunkFilename: isCssFilenameFn ? (...args)=>{
|
|
2296
|
+
let name = cssFilename(...args);
|
|
2297
|
+
return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.posix.join(cssAsyncPath, name);
|
|
2298
|
+
} : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.posix.join(cssAsyncPath, cssFilename),
|
|
2299
|
+
...extractPluginOptions
|
|
2300
|
+
}
|
|
2301
|
+
]);
|
|
2302
|
+
}
|
|
2286
2303
|
}
|
|
2287
2304
|
});
|
|
2288
2305
|
}
|
|
@@ -2370,21 +2387,24 @@ async function printFileSizes(options, stats, rootPath, environmentName) {
|
|
|
2370
2387
|
if (0 === assets.length) return logs;
|
|
2371
2388
|
logs.push(''), assets.sort((a, b)=>a.size - b.size);
|
|
2372
2389
|
let longestLabelLength = Math.max(...assets.map((a)=>a.sizeLabel.length)), longestFileLength = Math.max(...assets.map((a)=>(a.folder + __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.sep + a.name).length));
|
|
2373
|
-
!1 !== options.detail
|
|
2374
|
-
let
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2390
|
+
if (!1 !== options.detail) {
|
|
2391
|
+
let showGzipHeader = !!(options.compressed && assets.some((item)=>null !== item.gzippedSize));
|
|
2392
|
+
logs.push(function(longestFileLength, longestLabelLength, environmentName, showGzipHeader) {
|
|
2393
|
+
let longestLengths = [
|
|
2394
|
+
longestFileLength,
|
|
2395
|
+
longestLabelLength
|
|
2396
|
+
], rowTypes = [
|
|
2397
|
+
`File (${environmentName})`,
|
|
2398
|
+
'Size'
|
|
2399
|
+
];
|
|
2400
|
+
showGzipHeader && rowTypes.push('Gzip');
|
|
2401
|
+
let headerRow = rowTypes.reduce((prev, cur, index)=>{
|
|
2402
|
+
let length = longestLengths[index], curLabel = cur;
|
|
2403
|
+
return length && (curLabel = cur.length < length ? cur + ' '.repeat(length - cur.length) : cur), `${prev + curLabel} `;
|
|
2404
|
+
}, ' ');
|
|
2405
|
+
return __WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.blue(headerRow);
|
|
2406
|
+
}(longestFileLength, longestLabelLength, environmentName, showGzipHeader));
|
|
2407
|
+
}
|
|
2388
2408
|
let totalSize = 0, totalGzipSize = 0;
|
|
2389
2409
|
for (let asset of assets){
|
|
2390
2410
|
let { sizeLabel } = asset, { name, folder, gzipSizeLabel } = asset, fileNameLength = (folder + __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.sep + name).length, sizeLength = sizeLabel.length;
|
|
@@ -3111,7 +3131,10 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3111
3131
|
...headTags,
|
|
3112
3132
|
...bodyTags
|
|
3113
3133
|
];
|
|
3114
|
-
if (nonce) for (let tag of allTags)
|
|
3134
|
+
if (nonce) for (let tag of allTags){
|
|
3135
|
+
var _tag_attrs, _tag_attrs1;
|
|
3136
|
+
("script" === tag.tag || 'style' === tag.tag || 'link' === tag.tag && (null === (_tag_attrs = tag.attrs) || void 0 === _tag_attrs ? void 0 : _tag_attrs.rel) === 'preload' && (null === (_tag_attrs1 = tag.attrs) || void 0 === _tag_attrs1 ? void 0 : _tag_attrs1.as) === "script") && (tag.attrs ??= {}, tag.attrs.nonce = nonce);
|
|
3137
|
+
}
|
|
3115
3138
|
return {
|
|
3116
3139
|
headTags,
|
|
3117
3140
|
bodyTags
|
|
@@ -3341,7 +3364,7 @@ async function open_open({ https, port, routes, config, clearCache }) {
|
|
|
3341
3364
|
let getJsAsyncPath = (jsPath, isServer, jsAsync)=>void 0 !== jsAsync ? jsAsync : isServer ? jsPath : jsPath ? `${jsPath}/async` : 'async', pluginOutput = ()=>({
|
|
3342
3365
|
name: 'rsbuild:output',
|
|
3343
3366
|
setup (api) {
|
|
3344
|
-
api.modifyBundlerChain(async (chain, { CHAIN_ID,
|
|
3367
|
+
api.modifyBundlerChain(async (chain, { CHAIN_ID, isProd, isServer, environment })=>{
|
|
3345
3368
|
let { distPath, config } = environment, publicPath = function({ isProd, config, context }) {
|
|
3346
3369
|
var _context_devServer, _context_devServer1, _context_devServer2;
|
|
3347
3370
|
let { dev, output, server } = config, publicPath = DEFAULT_ASSET_PREFIX, port = (null === (_context_devServer = context.devServer) || void 0 === _context_devServer ? void 0 : _context_devServer.port) || server.port || 3000;
|
|
@@ -3374,23 +3397,6 @@ let getJsAsyncPath = (jsPath, isServer, jsAsync)=>void 0 !== jsAsync ? jsAsync :
|
|
|
3374
3397
|
options
|
|
3375
3398
|
]);
|
|
3376
3399
|
}
|
|
3377
|
-
let emitCss = config.output.emitCss ?? 'web' === target;
|
|
3378
|
-
if (!config.output.injectStyles && emitCss) {
|
|
3379
|
-
let extractPluginOptions = config.tools.cssExtract.pluginOptions, cssPath = config.output.distPath.css, cssFilename = getFilename(config, 'css', isProd), isCssFilenameFn = 'function' == typeof cssFilename, cssAsyncPath = config.output.distPath.cssAsync ?? (cssPath ? `${cssPath}/async` : 'async');
|
|
3380
|
-
chain.plugin(CHAIN_ID.PLUGIN.MINI_CSS_EXTRACT).use(getCssExtractPlugin(), [
|
|
3381
|
-
{
|
|
3382
|
-
filename: isCssFilenameFn ? (...args)=>{
|
|
3383
|
-
let name = cssFilename(...args);
|
|
3384
|
-
return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.posix.join(cssPath, name);
|
|
3385
|
-
} : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.posix.join(cssPath, cssFilename),
|
|
3386
|
-
chunkFilename: isCssFilenameFn ? (...args)=>{
|
|
3387
|
-
let name = cssFilename(...args);
|
|
3388
|
-
return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.posix.join(cssAsyncPath, name);
|
|
3389
|
-
} : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.posix.join(cssAsyncPath, cssFilename),
|
|
3390
|
-
...extractPluginOptions
|
|
3391
|
-
}
|
|
3392
|
-
]);
|
|
3393
|
-
}
|
|
3394
3400
|
});
|
|
3395
3401
|
}
|
|
3396
3402
|
}), pluginPerformance = ()=>({
|
|
@@ -3882,7 +3888,7 @@ let resourceHints_generateLinks = (options, rel)=>options.map((option)=>({
|
|
|
3882
3888
|
};
|
|
3883
3889
|
'webpack' === api.context.bundlerType && (defaultConfig.enforceSizeThreshold = 50000);
|
|
3884
3890
|
let { chunkSplit } = config.performance, forceSplittingGroups = {};
|
|
3885
|
-
chunkSplit.forceSplitting && (forceSplittingGroups = function(forceSplitting) {
|
|
3891
|
+
chunkSplit.forceSplitting && (forceSplittingGroups = function(forceSplitting, strategy) {
|
|
3886
3892
|
let cacheGroups = {};
|
|
3887
3893
|
for (let [key, regexp] of Array.isArray(forceSplitting) ? forceSplitting.map((regexp, index)=>[
|
|
3888
3894
|
`force-split-${index}`,
|
|
@@ -3891,11 +3897,11 @@ let resourceHints_generateLinks = (options, rel)=>options.map((option)=>({
|
|
|
3891
3897
|
test: regexp,
|
|
3892
3898
|
name: key,
|
|
3893
3899
|
chunks: 'all',
|
|
3894
|
-
priority:
|
|
3900
|
+
priority: +('single-vendor' === strategy),
|
|
3895
3901
|
enforce: !0
|
|
3896
3902
|
};
|
|
3897
3903
|
return cacheGroups;
|
|
3898
|
-
}(chunkSplit.forceSplitting));
|
|
3904
|
+
}(chunkSplit.forceSplitting, chunkSplit.strategy));
|
|
3899
3905
|
let override = 'custom' === chunkSplit.strategy ? chunkSplit.splitChunks ?? chunkSplit.override : chunkSplit.override, splitChunksOptions = await SPLIT_STRATEGY_DISPATCHER[chunkSplit.strategy || 'split-by-experience']({
|
|
3900
3906
|
defaultConfig,
|
|
3901
3907
|
override: override || {},
|
|
@@ -5619,11 +5625,21 @@ async function devServer_createDevServer(options, createCompiler, config, { comp
|
|
|
5619
5625
|
})).middlewares))Array.isArray(item) ? middlewares.use(...item) : middlewares.use(item);
|
|
5620
5626
|
return __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('create dev server done'), devServerAPI;
|
|
5621
5627
|
}
|
|
5622
|
-
function
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5628
|
+
function isLikelyFile(filePath) {
|
|
5629
|
+
return (filePath.split(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep).pop() || '').includes('.');
|
|
5630
|
+
}
|
|
5631
|
+
function formatFileList(paths, rootPath) {
|
|
5632
|
+
let files = paths.filter(isLikelyFile);
|
|
5633
|
+
0 === files.length && (files = [
|
|
5634
|
+
paths[0]
|
|
5635
|
+
]);
|
|
5636
|
+
let fileInfo = files.slice(0, 1).map((file)=>(function(originalFilePath, root) {
|
|
5637
|
+
let prefix = root.endsWith(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep) ? root : root + __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep, filePath = originalFilePath;
|
|
5638
|
+
filePath.startsWith(prefix) && (filePath = filePath.slice(prefix.length));
|
|
5639
|
+
let parts = filePath.split(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep).filter(Boolean);
|
|
5640
|
+
return parts.length > 3 ? parts.slice(-3).join(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep) : parts.join(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep);
|
|
5641
|
+
})(file, rootPath)).join(', ');
|
|
5642
|
+
return files.length > 1 ? `${fileInfo} and ${files.length - 1} more` : fileInfo;
|
|
5627
5643
|
}
|
|
5628
5644
|
async function createCompiler_createCompiler(options) {
|
|
5629
5645
|
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('create compiler');
|
|
@@ -5636,17 +5652,21 @@ async function createCompiler_createCompiler(options) {
|
|
|
5636
5652
|
isVersionLogged || (__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug(`use Rspack v${__WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack.rspackVersion}`), isVersionLogged = !0);
|
|
5637
5653
|
};
|
|
5638
5654
|
compiler.hooks.watchRun.tap('rsbuild:compiling', (compiler)=>{
|
|
5639
|
-
|
|
5640
|
-
let changedFiles = compiler.modifiedFiles ? Array.from(compiler.modifiedFiles) :
|
|
5641
|
-
if (changedFiles.length) {
|
|
5642
|
-
let fileInfo =
|
|
5643
|
-
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.start(`building ${fileInfo}`);
|
|
5644
|
-
|
|
5645
|
-
|
|
5655
|
+
logRspackVersion(), isCompiling || function(compiler, context) {
|
|
5656
|
+
let changedFiles = compiler.modifiedFiles ? Array.from(compiler.modifiedFiles) : null;
|
|
5657
|
+
if (null == changedFiles ? void 0 : changedFiles.length) {
|
|
5658
|
+
let fileInfo = formatFileList(changedFiles, context.rootPath);
|
|
5659
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.start(`building ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.dim(fileInfo)}`);
|
|
5660
|
+
return;
|
|
5661
|
+
}
|
|
5662
|
+
let removedFiles = compiler.removedFiles ? Array.from(compiler.removedFiles) : null;
|
|
5663
|
+
if (null == removedFiles ? void 0 : removedFiles.length) {
|
|
5664
|
+
let fileInfo = formatFileList(removedFiles, context.rootPath);
|
|
5646
5665
|
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.start(`building ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.dim(`removed ${fileInfo}`)}`);
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5666
|
+
return;
|
|
5667
|
+
}
|
|
5668
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.start('build started...');
|
|
5669
|
+
}(compiler, context), isCompiling = !0;
|
|
5650
5670
|
}), 'build' === context.command && compiler.hooks.run.tap('rsbuild:run', logRspackVersion);
|
|
5651
5671
|
let done = (stats)=>{
|
|
5652
5672
|
let statsOptions = getStatsOptions(compiler), statsJson = stats.toJson({
|
|
@@ -6648,12 +6668,12 @@ async function runCLI() {
|
|
|
6648
6668
|
}
|
|
6649
6669
|
}(), process.title = 'rsbuild-node';
|
|
6650
6670
|
let { npm_execpath } = process.env;
|
|
6651
|
-
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rsbuild v1.2.
|
|
6671
|
+
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rsbuild v1.2.16\n`);
|
|
6652
6672
|
}();
|
|
6653
6673
|
try {
|
|
6654
6674
|
!function() {
|
|
6655
6675
|
let cli = dist('rsbuild');
|
|
6656
|
-
cli.help(), cli.version("1.2.
|
|
6676
|
+
cli.help(), cli.version("1.2.16"), applyCommonOptions(cli);
|
|
6657
6677
|
let devCommand = cli.command('dev', 'starting the dev server'), buildCommand = cli.command('build', 'build the app for production'), previewCommand = cli.command('preview', 'preview the production build locally'), inspectCommand = cli.command('inspect', 'inspect the Rspack and Rsbuild configs');
|
|
6658
6678
|
applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
|
|
6659
6679
|
try {
|
|
@@ -6704,6 +6724,6 @@ async function runCLI() {
|
|
|
6704
6724
|
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to start Rsbuild CLI.'), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
|
|
6705
6725
|
}
|
|
6706
6726
|
}
|
|
6707
|
-
let src_version = "1.2.
|
|
6727
|
+
let src_version = "1.2.16";
|
|
6708
6728
|
var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger, __webpack_exports__rspack = __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack;
|
|
6709
6729
|
export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createRsbuild, defineConfig, ensureAssetPrefix, config_loadConfig as loadConfig, loadEnv, mergeRsbuildConfig, runCLI, src_version as version, __webpack_exports__logger as logger, __webpack_exports__rspack as rspack };
|
|
@@ -457,7 +457,7 @@ export interface PerformanceConfig {
|
|
|
457
457
|
/**
|
|
458
458
|
* Configure the chunk splitting strategy.
|
|
459
459
|
*/
|
|
460
|
-
chunkSplit?:
|
|
460
|
+
chunkSplit?: ChunkSplit;
|
|
461
461
|
/**
|
|
462
462
|
* Analyze the size of output files.
|
|
463
463
|
*/
|
|
@@ -497,7 +497,7 @@ export interface PerformanceConfig {
|
|
|
497
497
|
}
|
|
498
498
|
export interface NormalizedPerformanceConfig extends PerformanceConfig {
|
|
499
499
|
printFileSize: PrintFileSizeOptions | boolean;
|
|
500
|
-
chunkSplit:
|
|
500
|
+
chunkSplit: ChunkSplit;
|
|
501
501
|
}
|
|
502
502
|
export type SplitChunks = Configuration extends {
|
|
503
503
|
optimization?: {
|
|
@@ -522,7 +522,7 @@ export interface SplitCustom extends BaseSplitRules {
|
|
|
522
522
|
strategy: 'custom';
|
|
523
523
|
splitChunks?: SplitChunks;
|
|
524
524
|
}
|
|
525
|
-
export type
|
|
525
|
+
export type ChunkSplit = BaseChunkSplit | SplitBySize | SplitCustom;
|
|
526
526
|
export type DistPathConfig = {
|
|
527
527
|
/**
|
|
528
528
|
* The root directory of all files.
|
|
@@ -111,12 +111,38 @@ export type ModifyRsbuildConfigFn = (config: RsbuildConfig, utils: ModifyRsbuild
|
|
|
111
111
|
export type ModifyEnvironmentConfigFn = (config: MergedEnvironmentConfig, utils: ModifyEnvironmentConfigUtils) => MaybePromise<MergedEnvironmentConfig | void>;
|
|
112
112
|
export type EnvironmentContext = {
|
|
113
113
|
index: number;
|
|
114
|
+
/**
|
|
115
|
+
* The unique name of the current environment is used to distinguish and locate the
|
|
116
|
+
* environment, corresponds to the key in the `environments` configuration.
|
|
117
|
+
*/
|
|
114
118
|
name: string;
|
|
119
|
+
/**
|
|
120
|
+
* The entry object from the `source.entry` option.
|
|
121
|
+
*/
|
|
115
122
|
entry: RsbuildEntry;
|
|
123
|
+
/**
|
|
124
|
+
* The path information for all HTML assets.
|
|
125
|
+
* This value is an object, the key is the entry name and the value is the relative
|
|
126
|
+
* path of the HTML file in the dist directory.
|
|
127
|
+
*/
|
|
116
128
|
htmlPaths: Record<string, string>;
|
|
129
|
+
/**
|
|
130
|
+
* The absolute path of the output directory, corresponding to the `output.distPath.root`
|
|
131
|
+
* config of Rsbuild.
|
|
132
|
+
*/
|
|
117
133
|
distPath: string;
|
|
134
|
+
/**
|
|
135
|
+
* The browserslist configuration of the current environment.
|
|
136
|
+
*/
|
|
118
137
|
browserslist: string[];
|
|
138
|
+
/**
|
|
139
|
+
* The absolute path of the tsconfig.json file, or `undefined` if the tsconfig.json file
|
|
140
|
+
* does not exist in current project.
|
|
141
|
+
*/
|
|
119
142
|
tsconfigPath?: string;
|
|
143
|
+
/**
|
|
144
|
+
* The normalized Rsbuild config for the current environment.
|
|
145
|
+
*/
|
|
120
146
|
config: NormalizedEnvironmentConfig;
|
|
121
147
|
};
|
|
122
148
|
export type ModifyChainUtils = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.16",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@types/node": "^22.13.8",
|
|
59
59
|
"@types/on-finished": "2.3.4",
|
|
60
60
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
61
|
-
"@types/ws": "^8.
|
|
61
|
+
"@types/ws": "^8.18.0",
|
|
62
62
|
"browserslist-load-config": "1.0.0",
|
|
63
63
|
"cac": "^6.7.14",
|
|
64
64
|
"chokidar": "^4.0.3",
|