@rsbuild/core 1.2.14 → 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/css-loader/index.js +18 -18
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rspack-manifest-plugin/index.js +4 -4
- package/compiled/ws/index.d.ts +49 -13
- package/dist/index.cjs +108 -71
- package/dist/index.js +108 -71
- package/dist-types/server/gracefulShutdown.d.ts +10 -0
- package/dist-types/types/config.d.ts +3 -3
- package/dist-types/types/hooks.d.ts +26 -0
- package/package.json +7 -7
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
|
-
|
|
3
|
+
306: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4
4
|
"use strict";
|
|
5
|
-
const loader = __nccwpck_require__(
|
|
5
|
+
const loader = __nccwpck_require__(9232);
|
|
6
6
|
module.exports = loader.default;
|
|
7
7
|
module.exports.defaultGetLocalIdent =
|
|
8
|
-
__nccwpck_require__(
|
|
8
|
+
__nccwpck_require__(7193).defaultGetLocalIdent;
|
|
9
9
|
},
|
|
10
|
-
|
|
10
|
+
9232: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
11
11
|
"use strict";
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports["default"] = loader;
|
|
14
14
|
var _postcss = _interopRequireDefault(__nccwpck_require__(9409));
|
|
15
|
-
var _plugins = __nccwpck_require__(
|
|
16
|
-
var _utils = __nccwpck_require__(
|
|
15
|
+
var _plugins = __nccwpck_require__(3695);
|
|
16
|
+
var _utils = __nccwpck_require__(7193);
|
|
17
17
|
function _interopRequireDefault(obj) {
|
|
18
18
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
19
19
|
}
|
|
@@ -236,7 +236,7 @@
|
|
|
236
236
|
callback(null, `${importCode}${moduleCode}${exportCode}`);
|
|
237
237
|
}
|
|
238
238
|
},
|
|
239
|
-
|
|
239
|
+
3695: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
240
240
|
"use strict";
|
|
241
241
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
242
242
|
Object.defineProperty(exports, "icssParser", {
|
|
@@ -258,22 +258,22 @@
|
|
|
258
258
|
},
|
|
259
259
|
});
|
|
260
260
|
var _postcssImportParser = _interopRequireDefault(
|
|
261
|
-
__nccwpck_require__(
|
|
261
|
+
__nccwpck_require__(7068),
|
|
262
262
|
);
|
|
263
263
|
var _postcssIcssParser = _interopRequireDefault(
|
|
264
|
-
__nccwpck_require__(
|
|
264
|
+
__nccwpck_require__(7113),
|
|
265
265
|
);
|
|
266
|
-
var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(
|
|
266
|
+
var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(4400));
|
|
267
267
|
function _interopRequireDefault(obj) {
|
|
268
268
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
269
269
|
}
|
|
270
270
|
},
|
|
271
|
-
|
|
271
|
+
7113: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
272
272
|
"use strict";
|
|
273
273
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
274
274
|
exports["default"] = void 0;
|
|
275
275
|
var _icssUtils = __nccwpck_require__(4531);
|
|
276
|
-
var _utils = __nccwpck_require__(
|
|
276
|
+
var _utils = __nccwpck_require__(7193);
|
|
277
277
|
const plugin = (options = {}) => ({
|
|
278
278
|
postcssPlugin: "postcss-icss-parser",
|
|
279
279
|
async OnceExit(root) {
|
|
@@ -372,14 +372,14 @@
|
|
|
372
372
|
plugin.postcss = true;
|
|
373
373
|
var _default = (exports["default"] = plugin);
|
|
374
374
|
},
|
|
375
|
-
|
|
375
|
+
7068: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
376
376
|
"use strict";
|
|
377
377
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
378
378
|
exports["default"] = void 0;
|
|
379
379
|
var _postcssValueParser = _interopRequireDefault(
|
|
380
380
|
__nccwpck_require__(2948),
|
|
381
381
|
);
|
|
382
|
-
var _utils = __nccwpck_require__(
|
|
382
|
+
var _utils = __nccwpck_require__(7193);
|
|
383
383
|
function _interopRequireDefault(obj) {
|
|
384
384
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
385
385
|
}
|
|
@@ -684,14 +684,14 @@
|
|
|
684
684
|
plugin.postcss = true;
|
|
685
685
|
var _default = (exports["default"] = plugin);
|
|
686
686
|
},
|
|
687
|
-
|
|
687
|
+
4400: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
688
688
|
"use strict";
|
|
689
689
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
690
690
|
exports["default"] = void 0;
|
|
691
691
|
var _postcssValueParser = _interopRequireDefault(
|
|
692
692
|
__nccwpck_require__(2948),
|
|
693
693
|
);
|
|
694
|
-
var _utils = __nccwpck_require__(
|
|
694
|
+
var _utils = __nccwpck_require__(7193);
|
|
695
695
|
function _interopRequireDefault(obj) {
|
|
696
696
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
697
697
|
}
|
|
@@ -1034,7 +1034,7 @@
|
|
|
1034
1034
|
plugin.postcss = true;
|
|
1035
1035
|
var _default = (exports["default"] = plugin);
|
|
1036
1036
|
},
|
|
1037
|
-
|
|
1037
|
+
7193: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
1038
1038
|
"use strict";
|
|
1039
1039
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1040
1040
|
exports.WEBPACK_IGNORE_COMMENT_REGEXP = void 0;
|
|
@@ -8098,6 +8098,6 @@
|
|
|
8098
8098
|
}
|
|
8099
8099
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
8100
8100
|
__nccwpck_require__.ab = __dirname + "/";
|
|
8101
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
8101
|
+
var __webpack_exports__ = __nccwpck_require__(306);
|
|
8102
8102
|
module.exports = __webpack_exports__;
|
|
8103
8103
|
})();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
|
-
|
|
3
|
+
744: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4
4
|
"use strict";
|
|
5
|
-
const { HtmlWebpackChildCompiler } = __nccwpck_require__(
|
|
5
|
+
const { HtmlWebpackChildCompiler } = __nccwpck_require__(525);
|
|
6
6
|
const compilerMap = new WeakMap();
|
|
7
7
|
class CachedChildCompilation {
|
|
8
8
|
constructor(compiler) {
|
|
@@ -304,7 +304,7 @@
|
|
|
304
304
|
}
|
|
305
305
|
module.exports = { CachedChildCompilation };
|
|
306
306
|
},
|
|
307
|
-
|
|
307
|
+
525: (module) => {
|
|
308
308
|
"use strict";
|
|
309
309
|
class HtmlWebpackChildCompiler {
|
|
310
310
|
constructor(templates) {
|
|
@@ -473,7 +473,7 @@
|
|
|
473
473
|
}
|
|
474
474
|
module.exports = { HtmlWebpackChildCompiler };
|
|
475
475
|
},
|
|
476
|
-
|
|
476
|
+
835: (module) => {
|
|
477
477
|
"use strict";
|
|
478
478
|
module.exports = {};
|
|
479
479
|
module.exports.none = (chunks) => chunks;
|
|
@@ -492,7 +492,7 @@
|
|
|
492
492
|
};
|
|
493
493
|
module.exports.auto = module.exports.none;
|
|
494
494
|
},
|
|
495
|
-
|
|
495
|
+
518: (module) => {
|
|
496
496
|
"use strict";
|
|
497
497
|
module.exports = function (err) {
|
|
498
498
|
return {
|
|
@@ -513,7 +513,7 @@
|
|
|
513
513
|
};
|
|
514
514
|
};
|
|
515
515
|
},
|
|
516
|
-
|
|
516
|
+
621: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
517
517
|
"use strict";
|
|
518
518
|
const { AsyncSeriesWaterfallHook } = __nccwpck_require__(408);
|
|
519
519
|
const htmlWebpackPluginHooksMap = new WeakMap();
|
|
@@ -539,7 +539,7 @@
|
|
|
539
539
|
}
|
|
540
540
|
module.exports = { getHtmlRspackPluginHooks };
|
|
541
541
|
},
|
|
542
|
-
|
|
542
|
+
716: (module) => {
|
|
543
543
|
const voidTags = [
|
|
544
544
|
"area",
|
|
545
545
|
"base",
|
|
@@ -607,19 +607,19 @@
|
|
|
607
607
|
htmlTagObjectToString,
|
|
608
608
|
};
|
|
609
609
|
},
|
|
610
|
-
|
|
610
|
+
185: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
611
611
|
"use strict";
|
|
612
612
|
const promisify = __nccwpck_require__(23).promisify;
|
|
613
613
|
const vm = __nccwpck_require__(154);
|
|
614
614
|
const fs = __nccwpck_require__(896);
|
|
615
615
|
const path = __nccwpck_require__(928);
|
|
616
|
-
const { CachedChildCompilation } = __nccwpck_require__(
|
|
616
|
+
const { CachedChildCompilation } = __nccwpck_require__(744);
|
|
617
617
|
const { createHtmlTagObject, htmlTagObjectToString, HtmlTagArray } =
|
|
618
|
-
__nccwpck_require__(
|
|
619
|
-
const prettyError = __nccwpck_require__(
|
|
620
|
-
const chunkSorter = __nccwpck_require__(
|
|
618
|
+
__nccwpck_require__(716);
|
|
619
|
+
const prettyError = __nccwpck_require__(518);
|
|
620
|
+
const chunkSorter = __nccwpck_require__(835);
|
|
621
621
|
const getHtmlRspackPluginHooks =
|
|
622
|
-
__nccwpck_require__(
|
|
622
|
+
__nccwpck_require__(621).getHtmlRspackPluginHooks;
|
|
623
623
|
class HtmlRspackPlugin {
|
|
624
624
|
constructor(userOptions = {}) {
|
|
625
625
|
this.version = HtmlRspackPlugin.version;
|
|
@@ -1578,6 +1578,6 @@
|
|
|
1578
1578
|
}
|
|
1579
1579
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
1580
1580
|
__nccwpck_require__.ab = __dirname + "/";
|
|
1581
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
1581
|
+
var __webpack_exports__ = __nccwpck_require__(185);
|
|
1582
1582
|
module.exports = __webpack_exports__;
|
|
1583
1583
|
})();
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
"use strict";
|
|
3
3
|
var __webpack_modules__ = {
|
|
4
|
-
|
|
5
|
-
module.exports = __nccwpck_require__(
|
|
4
|
+
737: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
5
|
+
module.exports = __nccwpck_require__(123)["default"];
|
|
6
6
|
},
|
|
7
|
-
|
|
7
|
+
123: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
8
8
|
var __webpack_unused_export__;
|
|
9
9
|
__webpack_unused_export__ = { value: true };
|
|
10
10
|
exports["default"] = loader;
|
|
11
11
|
var _path = _interopRequireDefault(__nccwpck_require__(928));
|
|
12
|
-
var _utils = __nccwpck_require__(
|
|
12
|
+
var _utils = __nccwpck_require__(358);
|
|
13
13
|
function _interopRequireDefault(obj) {
|
|
14
14
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
15
15
|
}
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
callback(null, result.css, map, { ast });
|
|
180
180
|
}
|
|
181
181
|
},
|
|
182
|
-
|
|
182
|
+
358: (module, exports, __nccwpck_require__) => {
|
|
183
183
|
module = __nccwpck_require__.nmd(module);
|
|
184
184
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
185
185
|
exports.exec = exec;
|
|
@@ -716,6 +716,6 @@
|
|
|
716
716
|
})();
|
|
717
717
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
718
718
|
__nccwpck_require__.ab = __dirname + "/";
|
|
719
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
719
|
+
var __webpack_exports__ = __nccwpck_require__(737);
|
|
720
720
|
module.exports = __webpack_exports__;
|
|
721
721
|
})();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
"use strict";
|
|
3
3
|
var __webpack_modules__ = {
|
|
4
|
-
|
|
4
|
+
705: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.transformFiles =
|
|
7
7
|
exports.reduceChunk =
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
.map(standardizeFilePaths);
|
|
121
121
|
exports.transformFiles = transformFiles;
|
|
122
122
|
},
|
|
123
|
-
|
|
123
|
+
964: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
124
124
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
125
125
|
exports.normalModuleLoaderHook =
|
|
126
126
|
exports.getCompilerHooks =
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
const fs_1 = __nccwpck_require__(896);
|
|
131
131
|
const path_1 = __nccwpck_require__(928);
|
|
132
132
|
const lite_tapable_1 = __nccwpck_require__(408);
|
|
133
|
-
const helpers_1 = __nccwpck_require__(
|
|
133
|
+
const helpers_1 = __nccwpck_require__(705);
|
|
134
134
|
const compilerHookMap = new WeakMap();
|
|
135
135
|
const getCompilerHooks = (compiler) => {
|
|
136
136
|
let hooks = compilerHookMap.get(compiler);
|
|
@@ -312,7 +312,7 @@
|
|
|
312
312
|
exports.getCompilerHooks =
|
|
313
313
|
void 0;
|
|
314
314
|
const path_1 = __nccwpck_require__(928);
|
|
315
|
-
const hooks_1 = __nccwpck_require__(
|
|
315
|
+
const hooks_1 = __nccwpck_require__(964);
|
|
316
316
|
Object.defineProperty(exports, "getCompilerHooks", {
|
|
317
317
|
enumerable: true,
|
|
318
318
|
get: function () {
|
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 || {},
|
|
@@ -4664,7 +4670,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4664
4670
|
path: null === (_this_options_client = this.options.client) || void 0 === _this_options_client ? void 0 : _this_options_client.path
|
|
4665
4671
|
}), this.wsServer.on('error', (err)=>{
|
|
4666
4672
|
rslog_index_js_namespaceObject.logger.error(err);
|
|
4667
|
-
}), this.heartbeatTimer = setTimeout(this.checkSockets, 30000), this.wsServer.on('connection', (socket, req)=>{
|
|
4673
|
+
}), this.heartbeatTimer = setTimeout(this.checkSockets, 30000).unref(), this.wsServer.on('connection', (socket, req)=>{
|
|
4668
4674
|
let queryStr = req.url ? req.url.split('?')[1] : '';
|
|
4669
4675
|
this.onConnect(socket, queryStr ? (0, external_node_querystring_namespaceObject.parse)(queryStr) : {});
|
|
4670
4676
|
});
|
|
@@ -4917,7 +4923,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4917
4923
|
constructor(options){
|
|
4918
4924
|
socketServer_define_property(this, "wsServer", void 0), socketServer_define_property(this, "sockets", []), socketServer_define_property(this, "options", void 0), socketServer_define_property(this, "stats", void 0), socketServer_define_property(this, "initialChunks", void 0), socketServer_define_property(this, "heartbeatTimer", null), socketServer_define_property(this, "checkSockets", ()=>{
|
|
4919
4925
|
for (let socket of this.wsServer.clients)socket.isAlive ? (socket.isAlive = !1, socket.ping(()=>{})) : socket.terminate();
|
|
4920
|
-
null !== this.heartbeatTimer && (this.heartbeatTimer = setTimeout(this.checkSockets, 30000));
|
|
4926
|
+
null !== this.heartbeatTimer && (this.heartbeatTimer = setTimeout(this.checkSockets, 30000).unref());
|
|
4921
4927
|
}), this.options = options, this.stats = {}, this.initialChunks = {};
|
|
4922
4928
|
}
|
|
4923
4929
|
}
|
|
@@ -5542,7 +5548,21 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5542
5548
|
onUpgrade,
|
|
5543
5549
|
middlewares
|
|
5544
5550
|
};
|
|
5545
|
-
},
|
|
5551
|
+
}, cleanupCallbacks = new Set(), handleTermination = async (_, exitCode)=>{
|
|
5552
|
+
try {
|
|
5553
|
+
await Promise.all([
|
|
5554
|
+
...cleanupCallbacks
|
|
5555
|
+
].map((cb)=>cb()));
|
|
5556
|
+
} finally{
|
|
5557
|
+
process.exitCode ??= exitCode ? 128 + exitCode : void 0, process.exit();
|
|
5558
|
+
}
|
|
5559
|
+
}, registerCleanup = (callback)=>{
|
|
5560
|
+
cleanupCallbacks.add(callback);
|
|
5561
|
+
}, removeCleanup = (callback)=>{
|
|
5562
|
+
cleanupCallbacks.delete(callback);
|
|
5563
|
+
}, shutdownRefCount = 0, setupGracefulShutdown = ()=>(shutdownRefCount++, process.once('SIGTERM', handleTermination), 'true' !== process.env.CI && process.stdin.on('end', handleTermination), ()=>{
|
|
5564
|
+
!(--shutdownRefCount > 0) && (process.removeListener('SIGTERM', handleTermination), 0 === process.stdin.listenerCount('end') && process.stdin.removeListener('end', handleTermination));
|
|
5565
|
+
}), createHttpServer = async ({ serverConfig, middlewares })=>{
|
|
5546
5566
|
if (serverConfig.https) {
|
|
5547
5567
|
if (serverConfig.proxy) {
|
|
5548
5568
|
let { createServer } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "node:https"));
|
|
@@ -5563,7 +5583,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5563
5583
|
rslog_index_js_namespaceObject.logger.debug('create dev server');
|
|
5564
5584
|
let { port, host, https, portTip } = await getServerConfig({
|
|
5565
5585
|
config
|
|
5566
|
-
}), devConfig = devServer_formatDevConfig(config.dev, port), routes = getRoutes(options.context), root = options.context.rootPath;
|
|
5586
|
+
}), { middlewareMode } = config.server, devConfig = devServer_formatDevConfig(config.dev, port), routes = getRoutes(options.context), root = options.context.rootPath;
|
|
5567
5587
|
options.context.devServer = {
|
|
5568
5588
|
hostname: host,
|
|
5569
5589
|
port,
|
|
@@ -5613,12 +5633,14 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5613
5633
|
routes,
|
|
5614
5634
|
config,
|
|
5615
5635
|
clearCache: !0
|
|
5616
|
-
}), closeServer = async ()=>{
|
|
5617
|
-
await options.context.hooks.onCloseDevServer.callBatch(), await Promise.all([
|
|
5636
|
+
}), cleanupGracefulShutdown = middlewareMode ? null : setupGracefulShutdown(), closeServer = async ()=>{
|
|
5637
|
+
removeCleanup(closeServer), null == cleanupGracefulShutdown || cleanupGracefulShutdown(), await options.context.hooks.onCloseDevServer.callBatch(), await Promise.all([
|
|
5618
5638
|
null == devMiddlewares ? void 0 : devMiddlewares.close(),
|
|
5619
5639
|
null == fileWatcher ? void 0 : fileWatcher.close()
|
|
5620
5640
|
]);
|
|
5621
|
-
}
|
|
5641
|
+
};
|
|
5642
|
+
middlewareMode || registerCleanup(closeServer);
|
|
5643
|
+
let beforeCreateCompiler = ()=>{
|
|
5622
5644
|
if (printUrls(), cliShortcutsEnabled) {
|
|
5623
5645
|
let shortcutsOptions = 'boolean' == typeof devConfig.cliShortcuts ? {} : devConfig.cliShortcuts, cleanup = setupCliShortcuts({
|
|
5624
5646
|
openPage,
|
|
@@ -5649,7 +5671,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5649
5671
|
environment
|
|
5650
5672
|
}))
|
|
5651
5673
|
}
|
|
5652
|
-
])), { default: connect } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/connect/index.js")), middlewares = connect(), httpServer =
|
|
5674
|
+
])), { default: connect } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/connect/index.js")), middlewares = connect(), httpServer = middlewareMode ? null : await createHttpServer({
|
|
5653
5675
|
serverConfig: config.server,
|
|
5654
5676
|
middlewares
|
|
5655
5677
|
}), devServerAPI = {
|
|
@@ -5714,11 +5736,21 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5714
5736
|
})).middlewares))Array.isArray(item) ? middlewares.use(...item) : middlewares.use(item);
|
|
5715
5737
|
return rslog_index_js_namespaceObject.logger.debug('create dev server done'), devServerAPI;
|
|
5716
5738
|
}
|
|
5717
|
-
function
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
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;
|
|
5722
5754
|
}
|
|
5723
5755
|
async function createCompiler_createCompiler(options) {
|
|
5724
5756
|
rslog_index_js_namespaceObject.logger.debug('create compiler');
|
|
@@ -5731,17 +5763,21 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5731
5763
|
isVersionLogged || (rslog_index_js_namespaceObject.logger.debug(`use Rspack v${core_namespaceObject.rspack.rspackVersion}`), isVersionLogged = !0);
|
|
5732
5764
|
};
|
|
5733
5765
|
compiler.hooks.watchRun.tap('rsbuild:compiling', (compiler)=>{
|
|
5734
|
-
|
|
5735
|
-
let changedFiles = compiler.modifiedFiles ? Array.from(compiler.modifiedFiles) :
|
|
5736
|
-
if (changedFiles.length) {
|
|
5737
|
-
let fileInfo =
|
|
5738
|
-
rslog_index_js_namespaceObject.logger.start(`building ${fileInfo}`);
|
|
5739
|
-
|
|
5740
|
-
|
|
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);
|
|
5741
5776
|
rslog_index_js_namespaceObject.logger.start(`building ${index_js_default().dim(`removed ${fileInfo}`)}`);
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5777
|
+
return;
|
|
5778
|
+
}
|
|
5779
|
+
rslog_index_js_namespaceObject.logger.start('build started...');
|
|
5780
|
+
}(compiler, context), isCompiling = !0;
|
|
5745
5781
|
}), 'build' === context.command && compiler.hooks.run.tap('rsbuild:run', logRspackVersion);
|
|
5746
5782
|
let done = (stats)=>{
|
|
5747
5783
|
let statsOptions = getStatsOptions(compiler), statsJson = stats.toJson({
|
|
@@ -5956,12 +5992,14 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5956
5992
|
protocol,
|
|
5957
5993
|
port,
|
|
5958
5994
|
host
|
|
5959
|
-
}), cliShortcutsEnabled = isCliShortcutsEnabled(config.dev), closeServer = async ()=>{
|
|
5960
|
-
await Promise.all([
|
|
5995
|
+
}), cliShortcutsEnabled = isCliShortcutsEnabled(config.dev), cleanupGracefulShutdown = setupGracefulShutdown(), closeServer = async ()=>{
|
|
5996
|
+
removeCleanup(closeServer), cleanupGracefulShutdown(), await Promise.all([
|
|
5961
5997
|
server.close(),
|
|
5962
5998
|
serverTerminator()
|
|
5963
5999
|
]);
|
|
5964
|
-
}
|
|
6000
|
+
};
|
|
6001
|
+
registerCleanup(closeServer);
|
|
6002
|
+
let printUrls = ()=>printServerURLs({
|
|
5965
6003
|
urls,
|
|
5966
6004
|
port,
|
|
5967
6005
|
routes,
|
|
@@ -6076,8 +6114,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6076
6114
|
strategy: 'custom'
|
|
6077
6115
|
}), config.source.include = [
|
|
6078
6116
|
...config.source.include || [],
|
|
6079
|
-
/@module-federation[\\/]
|
|
6080
|
-
/@module-federation[\\/]runtime/
|
|
6117
|
+
/@module-federation[\\/]/
|
|
6081
6118
|
]);
|
|
6082
6119
|
}), api.modifyBundlerChain(async (chain, { CHAIN_ID, target, environment })=>{
|
|
6083
6120
|
var _config_moduleFederation;
|
|
@@ -6743,12 +6780,12 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6743
6780
|
}
|
|
6744
6781
|
}(), process.title = 'rsbuild-node';
|
|
6745
6782
|
let { npm_execpath } = process.env;
|
|
6746
|
-
(!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`);
|
|
6747
6784
|
}();
|
|
6748
6785
|
try {
|
|
6749
6786
|
!function() {
|
|
6750
6787
|
let cli = dist('rsbuild');
|
|
6751
|
-
cli.help(), cli.version("1.2.
|
|
6788
|
+
cli.help(), cli.version("1.2.16"), applyCommonOptions(cli);
|
|
6752
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');
|
|
6753
6790
|
applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
|
|
6754
6791
|
try {
|
|
@@ -6799,7 +6836,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6799
6836
|
rslog_index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), rslog_index_js_namespaceObject.logger.error(err);
|
|
6800
6837
|
}
|
|
6801
6838
|
}
|
|
6802
|
-
let src_rslib_entry_version = "1.2.
|
|
6839
|
+
let src_rslib_entry_version = "1.2.16";
|
|
6803
6840
|
})();
|
|
6804
6841
|
var __webpack_export_target__ = exports;
|
|
6805
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 || {},
|
|
@@ -4558,7 +4564,7 @@ class SocketServer {
|
|
|
4558
4564
|
path: null === (_this_options_client = this.options.client) || void 0 === _this_options_client ? void 0 : _this_options_client.path
|
|
4559
4565
|
}), this.wsServer.on('error', (err)=>{
|
|
4560
4566
|
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
|
|
4561
|
-
}), this.heartbeatTimer = setTimeout(this.checkSockets, 30000), this.wsServer.on('connection', (socket, req)=>{
|
|
4567
|
+
}), this.heartbeatTimer = setTimeout(this.checkSockets, 30000).unref(), this.wsServer.on('connection', (socket, req)=>{
|
|
4562
4568
|
let queryStr = req.url ? req.url.split('?')[1] : '';
|
|
4563
4569
|
this.onConnect(socket, queryStr ? (0, __WEBPACK_EXTERNAL_MODULE_node_querystring_aeb3c0b4__.parse)(queryStr) : {});
|
|
4564
4570
|
});
|
|
@@ -4811,7 +4817,7 @@ class SocketServer {
|
|
|
4811
4817
|
constructor(options){
|
|
4812
4818
|
socketServer_define_property(this, "wsServer", void 0), socketServer_define_property(this, "sockets", []), socketServer_define_property(this, "options", void 0), socketServer_define_property(this, "stats", void 0), socketServer_define_property(this, "initialChunks", void 0), socketServer_define_property(this, "heartbeatTimer", null), socketServer_define_property(this, "checkSockets", ()=>{
|
|
4813
4819
|
for (let socket of this.wsServer.clients)socket.isAlive ? (socket.isAlive = !1, socket.ping(()=>{})) : socket.terminate();
|
|
4814
|
-
null !== this.heartbeatTimer && (this.heartbeatTimer = setTimeout(this.checkSockets, 30000));
|
|
4820
|
+
null !== this.heartbeatTimer && (this.heartbeatTimer = setTimeout(this.checkSockets, 30000).unref());
|
|
4815
4821
|
}), this.options = options, this.stats = {}, this.initialChunks = {};
|
|
4816
4822
|
}
|
|
4817
4823
|
}
|
|
@@ -5431,7 +5437,21 @@ let runner_run = async ({ bundlePath, ...runnerFactoryOptions })=>new BasicRunne
|
|
|
5431
5437
|
onUpgrade,
|
|
5432
5438
|
middlewares
|
|
5433
5439
|
};
|
|
5434
|
-
},
|
|
5440
|
+
}, cleanupCallbacks = new Set(), handleTermination = async (_, exitCode)=>{
|
|
5441
|
+
try {
|
|
5442
|
+
await Promise.all([
|
|
5443
|
+
...cleanupCallbacks
|
|
5444
|
+
].map((cb)=>cb()));
|
|
5445
|
+
} finally{
|
|
5446
|
+
process.exitCode ??= exitCode ? 128 + exitCode : void 0, process.exit();
|
|
5447
|
+
}
|
|
5448
|
+
}, registerCleanup = (callback)=>{
|
|
5449
|
+
cleanupCallbacks.add(callback);
|
|
5450
|
+
}, removeCleanup = (callback)=>{
|
|
5451
|
+
cleanupCallbacks.delete(callback);
|
|
5452
|
+
}, shutdownRefCount = 0, setupGracefulShutdown = ()=>(shutdownRefCount++, process.once('SIGTERM', handleTermination), 'true' !== process.env.CI && process.stdin.on('end', handleTermination), ()=>{
|
|
5453
|
+
!(--shutdownRefCount > 0) && (process.removeListener('SIGTERM', handleTermination), 0 === process.stdin.listenerCount('end') && process.stdin.removeListener('end', handleTermination));
|
|
5454
|
+
}), createHttpServer = async ({ serverConfig, middlewares })=>{
|
|
5435
5455
|
if (serverConfig.https) {
|
|
5436
5456
|
if (serverConfig.proxy) {
|
|
5437
5457
|
let { createServer } = await import("node:https");
|
|
@@ -5452,7 +5472,7 @@ async function devServer_createDevServer(options, createCompiler, config, { comp
|
|
|
5452
5472
|
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('create dev server');
|
|
5453
5473
|
let { port, host, https, portTip } = await getServerConfig({
|
|
5454
5474
|
config
|
|
5455
|
-
}), devConfig = devServer_formatDevConfig(config.dev, port), routes = getRoutes(options.context), root = options.context.rootPath;
|
|
5475
|
+
}), { middlewareMode } = config.server, devConfig = devServer_formatDevConfig(config.dev, port), routes = getRoutes(options.context), root = options.context.rootPath;
|
|
5456
5476
|
options.context.devServer = {
|
|
5457
5477
|
hostname: host,
|
|
5458
5478
|
port,
|
|
@@ -5502,12 +5522,14 @@ async function devServer_createDevServer(options, createCompiler, config, { comp
|
|
|
5502
5522
|
routes,
|
|
5503
5523
|
config,
|
|
5504
5524
|
clearCache: !0
|
|
5505
|
-
}), closeServer = async ()=>{
|
|
5506
|
-
await options.context.hooks.onCloseDevServer.callBatch(), await Promise.all([
|
|
5525
|
+
}), cleanupGracefulShutdown = middlewareMode ? null : setupGracefulShutdown(), closeServer = async ()=>{
|
|
5526
|
+
removeCleanup(closeServer), null == cleanupGracefulShutdown || cleanupGracefulShutdown(), await options.context.hooks.onCloseDevServer.callBatch(), await Promise.all([
|
|
5507
5527
|
null == devMiddlewares ? void 0 : devMiddlewares.close(),
|
|
5508
5528
|
null == fileWatcher ? void 0 : fileWatcher.close()
|
|
5509
5529
|
]);
|
|
5510
|
-
}
|
|
5530
|
+
};
|
|
5531
|
+
middlewareMode || registerCleanup(closeServer);
|
|
5532
|
+
let beforeCreateCompiler = ()=>{
|
|
5511
5533
|
if (printUrls(), cliShortcutsEnabled) {
|
|
5512
5534
|
let shortcutsOptions = 'boolean' == typeof devConfig.cliShortcuts ? {} : devConfig.cliShortcuts, cleanup = setupCliShortcuts({
|
|
5513
5535
|
openPage,
|
|
@@ -5538,7 +5560,7 @@ async function devServer_createDevServer(options, createCompiler, config, { comp
|
|
|
5538
5560
|
environment
|
|
5539
5561
|
}))
|
|
5540
5562
|
}
|
|
5541
|
-
])), { default: connect } = await import("../compiled/connect/index.js"), middlewares = connect(), httpServer =
|
|
5563
|
+
])), { default: connect } = await import("../compiled/connect/index.js"), middlewares = connect(), httpServer = middlewareMode ? null : await createHttpServer({
|
|
5542
5564
|
serverConfig: config.server,
|
|
5543
5565
|
middlewares
|
|
5544
5566
|
}), devServerAPI = {
|
|
@@ -5603,11 +5625,21 @@ async function devServer_createDevServer(options, createCompiler, config, { comp
|
|
|
5603
5625
|
})).middlewares))Array.isArray(item) ? middlewares.use(...item) : middlewares.use(item);
|
|
5604
5626
|
return __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('create dev server done'), devServerAPI;
|
|
5605
5627
|
}
|
|
5606
|
-
function
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
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;
|
|
5611
5643
|
}
|
|
5612
5644
|
async function createCompiler_createCompiler(options) {
|
|
5613
5645
|
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('create compiler');
|
|
@@ -5620,17 +5652,21 @@ async function createCompiler_createCompiler(options) {
|
|
|
5620
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);
|
|
5621
5653
|
};
|
|
5622
5654
|
compiler.hooks.watchRun.tap('rsbuild:compiling', (compiler)=>{
|
|
5623
|
-
|
|
5624
|
-
let changedFiles = compiler.modifiedFiles ? Array.from(compiler.modifiedFiles) :
|
|
5625
|
-
if (changedFiles.length) {
|
|
5626
|
-
let fileInfo =
|
|
5627
|
-
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.start(`building ${fileInfo}`);
|
|
5628
|
-
|
|
5629
|
-
|
|
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);
|
|
5630
5665
|
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.start(`building ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.dim(`removed ${fileInfo}`)}`);
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5666
|
+
return;
|
|
5667
|
+
}
|
|
5668
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.start('build started...');
|
|
5669
|
+
}(compiler, context), isCompiling = !0;
|
|
5634
5670
|
}), 'build' === context.command && compiler.hooks.run.tap('rsbuild:run', logRspackVersion);
|
|
5635
5671
|
let done = (stats)=>{
|
|
5636
5672
|
let statsOptions = getStatsOptions(compiler), statsJson = stats.toJson({
|
|
@@ -5845,12 +5881,14 @@ async function startProdServer(context, config, { getPortSilently } = {}) {
|
|
|
5845
5881
|
protocol,
|
|
5846
5882
|
port,
|
|
5847
5883
|
host
|
|
5848
|
-
}), cliShortcutsEnabled = isCliShortcutsEnabled(config.dev), closeServer = async ()=>{
|
|
5849
|
-
await Promise.all([
|
|
5884
|
+
}), cliShortcutsEnabled = isCliShortcutsEnabled(config.dev), cleanupGracefulShutdown = setupGracefulShutdown(), closeServer = async ()=>{
|
|
5885
|
+
removeCleanup(closeServer), cleanupGracefulShutdown(), await Promise.all([
|
|
5850
5886
|
server.close(),
|
|
5851
5887
|
serverTerminator()
|
|
5852
5888
|
]);
|
|
5853
|
-
}
|
|
5889
|
+
};
|
|
5890
|
+
registerCleanup(closeServer);
|
|
5891
|
+
let printUrls = ()=>printServerURLs({
|
|
5854
5892
|
urls,
|
|
5855
5893
|
port,
|
|
5856
5894
|
routes,
|
|
@@ -5965,8 +6003,7 @@ async function applyDefaultPlugins(pluginManager, context) {
|
|
|
5965
6003
|
strategy: 'custom'
|
|
5966
6004
|
}), config.source.include = [
|
|
5967
6005
|
...config.source.include || [],
|
|
5968
|
-
/@module-federation[\\/]
|
|
5969
|
-
/@module-federation[\\/]runtime/
|
|
6006
|
+
/@module-federation[\\/]/
|
|
5970
6007
|
]);
|
|
5971
6008
|
}), api.modifyBundlerChain(async (chain, { CHAIN_ID, target, environment })=>{
|
|
5972
6009
|
var _config_moduleFederation;
|
|
@@ -6631,12 +6668,12 @@ async function runCLI() {
|
|
|
6631
6668
|
}
|
|
6632
6669
|
}(), process.title = 'rsbuild-node';
|
|
6633
6670
|
let { npm_execpath } = process.env;
|
|
6634
|
-
(!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`);
|
|
6635
6672
|
}();
|
|
6636
6673
|
try {
|
|
6637
6674
|
!function() {
|
|
6638
6675
|
let cli = dist('rsbuild');
|
|
6639
|
-
cli.help(), cli.version("1.2.
|
|
6676
|
+
cli.help(), cli.version("1.2.16"), applyCommonOptions(cli);
|
|
6640
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');
|
|
6641
6678
|
applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
|
|
6642
6679
|
try {
|
|
@@ -6687,6 +6724,6 @@ async function runCLI() {
|
|
|
6687
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);
|
|
6688
6725
|
}
|
|
6689
6726
|
}
|
|
6690
|
-
let src_version = "1.2.
|
|
6727
|
+
let src_version = "1.2.16";
|
|
6691
6728
|
var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger, __webpack_exports__rspack = __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack;
|
|
6692
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 };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registers a cleanup callback to be executed before process termination
|
|
3
|
+
*/
|
|
4
|
+
export declare const registerCleanup: (callback: () => Promise<void>) => void;
|
|
5
|
+
export declare const removeCleanup: (callback: () => Promise<void>) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Sets up listeners for termination signals and stdin end event
|
|
8
|
+
* This should be called once during application initialization
|
|
9
|
+
*/
|
|
10
|
+
export declare const setupGracefulShutdown: () => (() => void);
|
|
@@ -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": {
|
|
@@ -46,19 +46,19 @@
|
|
|
46
46
|
"types.d.ts"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@rspack/core": "1.2.
|
|
49
|
+
"@rspack/core": "1.2.7",
|
|
50
50
|
"@rspack/lite-tapable": "~1.0.1",
|
|
51
51
|
"@swc/helpers": "^0.5.15",
|
|
52
|
-
"core-js": "~3.
|
|
52
|
+
"core-js": "~3.41.0",
|
|
53
53
|
"jiti": "^2.4.2"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@rslib/core": "0.5.
|
|
56
|
+
"@rslib/core": "0.5.2",
|
|
57
57
|
"@types/connect": "3.4.38",
|
|
58
|
-
"@types/node": "^22.13.
|
|
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",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"sirv": "^3.0.1",
|
|
89
89
|
"style-loader": "3.3.4",
|
|
90
90
|
"tinyglobby": "^0.2.12",
|
|
91
|
-
"typescript": "^5.
|
|
91
|
+
"typescript": "^5.8.2",
|
|
92
92
|
"webpack": "^5.98.0",
|
|
93
93
|
"webpack-bundle-analyzer": "^4.10.2",
|
|
94
94
|
"webpack-merge": "6.0.1",
|