@rsbuild/core 2.1.5 → 2.1.7
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/@rstackjs/load-config/index.d.ts +66 -0
- package/compiled/@rstackjs/load-config/license +21 -0
- package/compiled/@rstackjs/load-config/package.json +1 -0
- package/compiled/css-loader/index.js +2 -2
- package/compiled/html-rspack-plugin/index.d.ts +4 -4
- package/compiled/html-rspack-plugin/index.js +53 -48
- package/compiled/postcss/index.js +1 -1
- package/compiled/postcss/lib/postcss.d.ts +4 -1
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rslog/index.d.ts +14 -14
- package/compiled/rslog/package.json +1 -1
- package/dist/711.js +392 -423
- package/dist/http-proxy-middleware.js +8 -8
- package/dist/manifest-plugin.js +37 -33
- package/dist/memfs.js +369 -201
- package/dist/ws.js +34 -38
- package/dist-types/cli/init.d.ts +1 -2
- package/dist-types/createContext.d.ts +2 -1
- package/dist-types/helpers/restartManager.d.ts +13 -0
- package/dist-types/hooks.d.ts +2 -1
- package/dist-types/index.d.ts +1 -1
- package/dist-types/loadConfig.d.ts +4 -39
- package/dist-types/plugins/minimize.d.ts +2 -2
- package/dist-types/restart.d.ts +10 -15
- package/dist-types/types/config.d.ts +12 -4
- package/dist-types/types/context.d.ts +4 -0
- package/dist-types/types/hooks.d.ts +11 -0
- package/dist-types/types/plugin.d.ts +4 -1
- package/dist-types/types/rsbuild.d.ts +12 -5
- package/package.json +9 -8
- /package/dist/{fresh-import.js → freshImport.js} +0 -0
package/dist/ws.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __webpack_require__ } from "./1~rslib-runtime.js";
|
|
2
2
|
import "./711.js";
|
|
3
3
|
__webpack_require__.add({
|
|
4
|
-
"../../node_modules/.pnpm/ws@8.21.
|
|
5
|
-
let { EMPTY_BUFFER } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.
|
|
4
|
+
"../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/buffer-util.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
5
|
+
let { EMPTY_BUFFER } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/constants.js"), FastBuffer = Buffer[Symbol.species];
|
|
6
6
|
function toBuffer(data) {
|
|
7
7
|
let buf;
|
|
8
8
|
return (toBuffer.readOnly = !0, Buffer.isBuffer(data)) ? data : (data instanceof ArrayBuffer ? buf = new FastBuffer(data) : ArrayBuffer.isView(data) ? buf = new FastBuffer(data.buffer, data.byteOffset, data.byteLength) : (buf = Buffer.from(data), toBuffer.readOnly = !1), buf);
|
|
@@ -30,7 +30,7 @@ __webpack_require__.add({
|
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
},
|
|
33
|
-
"../../node_modules/.pnpm/ws@8.21.
|
|
33
|
+
"../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/constants.js" (module) {
|
|
34
34
|
let BINARY_TYPES = [
|
|
35
35
|
'nodebuffer',
|
|
36
36
|
'arraybuffer',
|
|
@@ -49,8 +49,8 @@ __webpack_require__.add({
|
|
|
49
49
|
NOOP: ()=>{}
|
|
50
50
|
};
|
|
51
51
|
},
|
|
52
|
-
"../../node_modules/.pnpm/ws@8.21.
|
|
53
|
-
let { kForOnEventAttribute, kListener } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.
|
|
52
|
+
"../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/event-target.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
53
|
+
let { kForOnEventAttribute, kListener } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/constants.js"), kCode = Symbol('kCode'), kData = Symbol('kData'), kError = Symbol('kError'), kMessage = Symbol('kMessage'), kReason = Symbol('kReason'), kTarget = Symbol('kTarget'), kType = Symbol('kType'), kWasClean = Symbol('kWasClean');
|
|
54
54
|
class Event {
|
|
55
55
|
constructor(type){
|
|
56
56
|
this[kTarget] = null, this[kType] = type;
|
|
@@ -165,8 +165,8 @@ __webpack_require__.add({
|
|
|
165
165
|
MessageEvent
|
|
166
166
|
};
|
|
167
167
|
},
|
|
168
|
-
"../../node_modules/.pnpm/ws@8.21.
|
|
169
|
-
let { tokenChars } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.
|
|
168
|
+
"../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/extension.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
169
|
+
let { tokenChars } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/validation.js");
|
|
170
170
|
function push(dest, name, elem) {
|
|
171
171
|
void 0 === dest[name] ? dest[name] = [
|
|
172
172
|
elem
|
|
@@ -228,7 +228,7 @@ __webpack_require__.add({
|
|
|
228
228
|
}
|
|
229
229
|
};
|
|
230
230
|
},
|
|
231
|
-
"../../node_modules/.pnpm/ws@8.21.
|
|
231
|
+
"../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/limiter.js" (module) {
|
|
232
232
|
let kDone = Symbol('kDone'), kRun = Symbol('kRun');
|
|
233
233
|
module.exports = class {
|
|
234
234
|
constructor(concurrency){
|
|
@@ -247,8 +247,8 @@ __webpack_require__.add({
|
|
|
247
247
|
}
|
|
248
248
|
};
|
|
249
249
|
},
|
|
250
|
-
"../../node_modules/.pnpm/ws@8.21.
|
|
251
|
-
let zlibLimiter, zlib = __webpack_require__("zlib"), bufferUtil = __webpack_require__("../../node_modules/.pnpm/ws@8.21.
|
|
250
|
+
"../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/permessage-deflate.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
251
|
+
let zlibLimiter, zlib = __webpack_require__("zlib"), bufferUtil = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/buffer-util.js"), Limiter = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/limiter.js"), { kStatusCode } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/constants.js"), FastBuffer = Buffer[Symbol.species], TRAILER = Buffer.from([
|
|
252
252
|
0x00,
|
|
253
253
|
0x00,
|
|
254
254
|
0xff,
|
|
@@ -368,11 +368,11 @@ __webpack_require__.add({
|
|
|
368
368
|
}
|
|
369
369
|
};
|
|
370
370
|
},
|
|
371
|
-
"../../node_modules/.pnpm/ws@8.21.
|
|
372
|
-
let { Writable } = __webpack_require__("stream"), PerMessageDeflate = __webpack_require__("../../node_modules/.pnpm/ws@8.21.
|
|
371
|
+
"../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/receiver.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
372
|
+
let { Writable } = __webpack_require__("stream"), PerMessageDeflate = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/permessage-deflate.js"), { BINARY_TYPES, EMPTY_BUFFER, kStatusCode, kWebSocket } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/constants.js"), { concat, toArrayBuffer, unmask } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/buffer-util.js"), { isValidStatusCode, isValidUTF8 } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/validation.js"), FastBuffer = Buffer[Symbol.species];
|
|
373
373
|
module.exports = class extends Writable {
|
|
374
374
|
constructor(options = {}){
|
|
375
|
-
super(), this._allowSynchronousEvents = void 0 === options.allowSynchronousEvents || options.allowSynchronousEvents, this._binaryType = options.binaryType || BINARY_TYPES[0], this._extensions = options.extensions || {}, this._isServer = !!options.isServer, this._maxBufferedChunks = 0 | options.maxBufferedChunks, this._maxFragments = 0 | options.maxFragments, this._maxPayload = 0 | options.maxPayload, this._skipUTF8Validation = !!options.skipUTF8Validation, this[kWebSocket] = void 0, this._bufferedBytes = 0, this._buffers = [], this._compressed = !1, this._payloadLength = 0, this._mask = void 0, this._fragmented = 0, this._masked = !1, this._fin = !1, this._opcode = 0, this._totalPayloadLength = 0, this._messageLength = 0, this._fragments = [], this._errored = !1, this._loop = !1, this._state = 0;
|
|
375
|
+
super(), this._allowSynchronousEvents = void 0 === options.allowSynchronousEvents || options.allowSynchronousEvents, this._binaryType = options.binaryType || BINARY_TYPES[0], this._extensions = options.extensions || {}, this._isServer = !!options.isServer, this._maxBufferedChunks = 0 | options.maxBufferedChunks, this._maxFragments = 0 | options.maxFragments, this._maxPayload = 0 | options.maxPayload, this._skipUTF8Validation = !!options.skipUTF8Validation, this[kWebSocket] = void 0, this._bufferedBytes = 0, this._buffers = [], this._compressed = !1, this._payloadLength = 0, this._mask = void 0, this._fragmented = 0, this._masked = !1, this._fin = !1, this._opcode = 0, this._totalPayloadLength = 0, this._messageLength = 0, this._numFragments = 0, this._fragments = [], this._errored = !1, this._loop = !1, this._state = 0;
|
|
376
376
|
}
|
|
377
377
|
_write(chunk, encoding, cb) {
|
|
378
378
|
return 0x08 === this._opcode && 0 == this._state ? cb() : this._maxBufferedChunks > 0 && this._buffers.length >= this._maxBufferedChunks ? void cb(this.createError(RangeError, 'Too many buffered chunks', !1, 1008, 'WS_ERR_TOO_MANY_BUFFERED_PARTS')) : void (this._bufferedBytes += chunk.length, this._buffers.push(chunk), this.startLoop(cb));
|
|
@@ -478,22 +478,18 @@ __webpack_require__.add({
|
|
|
478
478
|
data = this.consume(this._payloadLength), this._masked && (this._mask[0] | this._mask[1] | this._mask[2] | this._mask[3]) != 0 && unmask(data, this._mask);
|
|
479
479
|
}
|
|
480
480
|
if (this._opcode > 0x07) return void this.controlMessage(data, cb);
|
|
481
|
+
if (this._maxFragments > 0 && ++this._numFragments > this._maxFragments) return void cb(this.createError(RangeError, 'Too many message fragments', !1, 1008, 'WS_ERR_TOO_MANY_BUFFERED_PARTS'));
|
|
481
482
|
if (this._compressed) {
|
|
482
483
|
this._state = 5, this.decompress(data, cb);
|
|
483
484
|
return;
|
|
484
485
|
}
|
|
485
|
-
|
|
486
|
-
if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) return void cb(this.createError(RangeError, 'Too many message fragments', !1, 1008, 'WS_ERR_TOO_MANY_BUFFERED_PARTS'));
|
|
487
|
-
this._messageLength = this._totalPayloadLength, this._fragments.push(data);
|
|
488
|
-
}
|
|
489
|
-
this.dataMessage(cb);
|
|
486
|
+
data.length && (this._messageLength = this._totalPayloadLength, this._fragments.push(data)), this.dataMessage(cb);
|
|
490
487
|
}
|
|
491
488
|
decompress(data, cb) {
|
|
492
489
|
this._extensions[PerMessageDeflate.extensionName].decompress(data, this._fin, (err, buf)=>{
|
|
493
490
|
if (err) return cb(err);
|
|
494
491
|
if (buf.length) {
|
|
495
492
|
if (this._messageLength += buf.length, this._messageLength > this._maxPayload && this._maxPayload > 0) return void cb(this.createError(RangeError, 'Max payload size exceeded', !1, 1009, 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH'));
|
|
496
|
-
if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) return void cb(this.createError(RangeError, 'Too many message fragments', !1, 1008, 'WS_ERR_TOO_MANY_BUFFERED_PARTS'));
|
|
497
493
|
this._fragments.push(buf);
|
|
498
494
|
}
|
|
499
495
|
this.dataMessage(cb), 0 === this._state && this.startLoop(cb);
|
|
@@ -505,7 +501,7 @@ __webpack_require__.add({
|
|
|
505
501
|
return;
|
|
506
502
|
}
|
|
507
503
|
let messageLength = this._messageLength, fragments = this._fragments;
|
|
508
|
-
if (this._totalPayloadLength = 0, this._messageLength = 0, this._fragmented = 0, this._fragments = [], 2 === this._opcode) {
|
|
504
|
+
if (this._totalPayloadLength = 0, this._messageLength = 0, this._fragmented = 0, this._numFragments = 0, this._fragments = [], 2 === this._opcode) {
|
|
509
505
|
let data;
|
|
510
506
|
data = 'nodebuffer' === this._binaryType ? concat(fragments, messageLength) : 'arraybuffer' === this._binaryType ? toArrayBuffer(concat(fragments, messageLength)) : 'blob' === this._binaryType ? new Blob(fragments) : fragments, this._allowSynchronousEvents ? (this.emit('message', data, !0), this._state = 0) : (this._state = 6, setImmediate(()=>{
|
|
511
507
|
this.emit('message', data, !0), this._state = 0, this.startLoop(cb);
|
|
@@ -542,8 +538,8 @@ __webpack_require__.add({
|
|
|
542
538
|
}
|
|
543
539
|
};
|
|
544
540
|
},
|
|
545
|
-
"../../node_modules/.pnpm/ws@8.21.
|
|
546
|
-
let randomPool, { Duplex } = __webpack_require__("stream"), { randomFillSync } = __webpack_require__("crypto"), { types: { isUint8Array } } = __webpack_require__("util"), PerMessageDeflate = __webpack_require__("../../node_modules/.pnpm/ws@8.21.
|
|
541
|
+
"../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/sender.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
542
|
+
let randomPool, { Duplex } = __webpack_require__("stream"), { randomFillSync } = __webpack_require__("crypto"), { types: { isUint8Array } } = __webpack_require__("util"), PerMessageDeflate = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/permessage-deflate.js"), { EMPTY_BUFFER, kWebSocket, NOOP } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/constants.js"), { isBlob, isValidStatusCode } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/validation.js"), { mask: applyMask, toBuffer } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/buffer-util.js"), kByteLength = Symbol('kByteLength'), maskBuffer = Buffer.alloc(4), randomPoolPointer = 8192;
|
|
547
543
|
function callCallbacks(sender, err, cb) {
|
|
548
544
|
'function' == typeof cb && cb(err);
|
|
549
545
|
for(let i = 0; i < sender._queue.length; i++){
|
|
@@ -722,8 +718,8 @@ __webpack_require__.add({
|
|
|
722
718
|
}
|
|
723
719
|
};
|
|
724
720
|
},
|
|
725
|
-
"../../node_modules/.pnpm/ws@8.21.
|
|
726
|
-
__webpack_require__("../../node_modules/.pnpm/ws@8.21.
|
|
721
|
+
"../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/stream.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
722
|
+
__webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/websocket.js");
|
|
727
723
|
let { Duplex } = __webpack_require__("stream");
|
|
728
724
|
function emitClose(stream) {
|
|
729
725
|
stream.emit('close');
|
|
@@ -775,8 +771,8 @@ __webpack_require__.add({
|
|
|
775
771
|
}, duplex.on('end', duplexOnEnd), duplex.on('error', duplexOnError), duplex;
|
|
776
772
|
};
|
|
777
773
|
},
|
|
778
|
-
"../../node_modules/.pnpm/ws@8.21.
|
|
779
|
-
let { tokenChars } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.
|
|
774
|
+
"../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/subprotocol.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
775
|
+
let { tokenChars } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/validation.js");
|
|
780
776
|
module.exports = {
|
|
781
777
|
parse: function parse(header) {
|
|
782
778
|
let protocols = new Set(), start = -1, end = -1, i = 0;
|
|
@@ -799,8 +795,8 @@ __webpack_require__.add({
|
|
|
799
795
|
}
|
|
800
796
|
};
|
|
801
797
|
},
|
|
802
|
-
"../../node_modules/.pnpm/ws@8.21.
|
|
803
|
-
let { isUtf8 } = __webpack_require__("buffer"), { hasBlob } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.
|
|
798
|
+
"../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/validation.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
799
|
+
let { isUtf8 } = __webpack_require__("buffer"), { hasBlob } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/constants.js");
|
|
804
800
|
function _isValidUTF8(buf) {
|
|
805
801
|
let len = buf.length, i = 0;
|
|
806
802
|
for(; i < len;)if ((0x80 & buf[i]) == 0) i++;
|
|
@@ -958,8 +954,8 @@ __webpack_require__.add({
|
|
|
958
954
|
return buf.length < 24 ? _isValidUTF8(buf) : isUtf8(buf);
|
|
959
955
|
});
|
|
960
956
|
},
|
|
961
|
-
"../../node_modules/.pnpm/ws@8.21.
|
|
962
|
-
let EventEmitter = __webpack_require__("events"), http = __webpack_require__("http"), { Duplex } = __webpack_require__("stream"), { createHash } = __webpack_require__("crypto"), extension = __webpack_require__("../../node_modules/.pnpm/ws@8.21.
|
|
957
|
+
"../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/websocket-server.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
958
|
+
let EventEmitter = __webpack_require__("events"), http = __webpack_require__("http"), { Duplex } = __webpack_require__("stream"), { createHash } = __webpack_require__("crypto"), extension = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/extension.js"), PerMessageDeflate = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/permessage-deflate.js"), subprotocol = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/subprotocol.js"), WebSocket = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/websocket.js"), { CLOSE_TIMEOUT, GUID, kWebSocket } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/constants.js"), keyRegex = /^[+/0-9A-Za-z]{22}==$/;
|
|
963
959
|
function addListeners(server, map) {
|
|
964
960
|
for (let event of Object.keys(map))server.on(event, map[event]);
|
|
965
961
|
return function removeListeners() {
|
|
@@ -991,8 +987,8 @@ __webpack_require__.add({
|
|
|
991
987
|
if (super(), null == (options = {
|
|
992
988
|
allowSynchronousEvents: !0,
|
|
993
989
|
autoPong: !0,
|
|
994
|
-
maxBufferedChunks:
|
|
995
|
-
maxFragments:
|
|
990
|
+
maxBufferedChunks: 262144,
|
|
991
|
+
maxFragments: 16384,
|
|
996
992
|
maxPayload: 104857600,
|
|
997
993
|
skipUTF8Validation: !1,
|
|
998
994
|
perMessageDeflate: !1,
|
|
@@ -1133,8 +1129,8 @@ __webpack_require__.add({
|
|
|
1133
1129
|
}
|
|
1134
1130
|
};
|
|
1135
1131
|
},
|
|
1136
|
-
"../../node_modules/.pnpm/ws@8.21.
|
|
1137
|
-
let EventEmitter = __webpack_require__("events"), https = __webpack_require__("https"), http = __webpack_require__("http"), net = __webpack_require__("net"), tls = __webpack_require__("tls"), { randomBytes, createHash } = __webpack_require__("crypto"), { Duplex, Readable } = __webpack_require__("stream"), { URL } = __webpack_require__("url?b918"), PerMessageDeflate = __webpack_require__("../../node_modules/.pnpm/ws@8.21.
|
|
1132
|
+
"../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/websocket.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
1133
|
+
let EventEmitter = __webpack_require__("events"), https = __webpack_require__("https"), http = __webpack_require__("http"), net = __webpack_require__("net"), tls = __webpack_require__("tls"), { randomBytes, createHash } = __webpack_require__("crypto"), { Duplex, Readable } = __webpack_require__("stream"), { URL } = __webpack_require__("url?b918"), PerMessageDeflate = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/permessage-deflate.js"), Receiver = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/receiver.js"), Sender = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/sender.js"), { isBlob } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/validation.js"), { BINARY_TYPES, CLOSE_TIMEOUT, EMPTY_BUFFER, GUID, kForOnEventAttribute, kListener, kStatusCode, kWebSocket, NOOP } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/constants.js"), { EventTarget: { addEventListener, removeEventListener } } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/event-target.js"), { format, parse } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/extension.js"), { toBuffer } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/buffer-util.js"), kAborted = Symbol('kAborted'), protocolVersions = [
|
|
1138
1134
|
8,
|
|
1139
1135
|
13
|
|
1140
1136
|
], readyStates = [
|
|
@@ -1256,8 +1252,8 @@ __webpack_require__.add({
|
|
|
1256
1252
|
autoPong: !0,
|
|
1257
1253
|
closeTimeout: CLOSE_TIMEOUT,
|
|
1258
1254
|
protocolVersion: protocolVersions[1],
|
|
1259
|
-
maxBufferedChunks:
|
|
1260
|
-
maxFragments:
|
|
1255
|
+
maxBufferedChunks: 262144,
|
|
1256
|
+
maxFragments: 16384,
|
|
1261
1257
|
maxPayload: 104857600,
|
|
1262
1258
|
skipUTF8Validation: !1,
|
|
1263
1259
|
perMessageDeflate: !0,
|
|
@@ -1523,6 +1519,6 @@ __webpack_require__.add({
|
|
|
1523
1519
|
}), WebSocket.prototype.addEventListener = addEventListener, WebSocket.prototype.removeEventListener = removeEventListener, module.exports = WebSocket;
|
|
1524
1520
|
}
|
|
1525
1521
|
});
|
|
1526
|
-
let websocket_server = __webpack_require__("../../node_modules/.pnpm/ws@8.21.
|
|
1527
|
-
__webpack_require__("../../node_modules/.pnpm/ws@8.21.
|
|
1522
|
+
let websocket_server = __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/websocket-server.js");
|
|
1523
|
+
__webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/stream.js"), __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/extension.js"), __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/permessage-deflate.js"), __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/receiver.js"), __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/sender.js"), __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/subprotocol.js"), __webpack_require__("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/websocket.js");
|
|
1528
1524
|
export { websocket_server as WebSocketServer };
|
package/dist-types/cli/init.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import type { RsbuildInstance } from '../types';
|
|
|
2
2
|
import type { CommonOptions } from './commands';
|
|
3
3
|
export type CommandName = 'dev' | 'build' | 'preview' | 'inspect';
|
|
4
4
|
export declare const initCliAction: (command: CommandName, options: CommonOptions) => void;
|
|
5
|
-
export declare function init({ isRestart
|
|
5
|
+
export declare function init({ isRestart }?: {
|
|
6
6
|
isRestart?: boolean;
|
|
7
|
-
isBuildWatch?: boolean;
|
|
8
7
|
}): Promise<RsbuildInstance | undefined>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LoadConfigResult } from './loadConfig';
|
|
1
2
|
import type { Logger } from './logger';
|
|
2
3
|
import type { InternalContext, NormalizedEnvironmentConfig, ResolvedCreateRsbuildOptions, RsbuildConfig, RsbuildContext } from './types';
|
|
3
4
|
export declare function getBrowserslist(path: string): string[] | null;
|
|
@@ -8,4 +9,4 @@ export declare function createPublicContext(context: InternalContext): Readonly<
|
|
|
8
9
|
/**
|
|
9
10
|
* Generate the actual context used in the build,
|
|
10
11
|
* which can have a lot of overhead and take some side effects.
|
|
11
|
-
*/ export declare function createContext(options: ResolvedCreateRsbuildOptions, userConfig: RsbuildConfig, logger: Logger): Promise<InternalContext>;
|
|
12
|
+
*/ export declare function createContext(options: ResolvedCreateRsbuildOptions, userConfig: RsbuildConfig, logger: Logger, loadConfigResult?: LoadConfigResult): Promise<InternalContext>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RestartContext, RestartFn } from '../types/hooks';
|
|
2
|
+
import type { MaybePromise } from '../types/utils';
|
|
3
|
+
type Cleanup = () => MaybePromise<void>;
|
|
4
|
+
export type RestartManager = {
|
|
5
|
+
/** Whether a restart executor is available. */ readonly canRestart: boolean;
|
|
6
|
+
/** Register a cleanup callback and return a function that unregisters it. */ registerCleanup(cleanup: Cleanup): () => void;
|
|
7
|
+
/** Handle a restart request and return whether the restart succeeded. */ requestRestart(context: RestartContext): Promise<boolean>;
|
|
8
|
+
};
|
|
9
|
+
export declare const createRestartManager: ({ onRestart, restart }: {
|
|
10
|
+
onRestart: (context: RestartContext) => MaybePromise<unknown>;
|
|
11
|
+
restart?: RestartFn;
|
|
12
|
+
}) => RestartManager;
|
|
13
|
+
export { };
|
package/dist-types/hooks.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { AsyncHook, EnvironmentAsyncHook, InternalContext, ModifyBundlerChainFn, ModifyEnvironmentConfigFn, ModifyHTMLFn, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, ModifyRspackConfigFn, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterDevCompileFn, OnAfterEnvironmentCompileFn, OnAfterStartDevServerFn, OnAfterStartPreviewServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeDevCompileFn, OnBeforeEnvironmentCompileFn, OnBeforeStartDevServerFn, OnBeforeStartPreviewServerFn, OnCloseBuildFn, OnCloseDevServerFn, OnExitFn, Rspack } from './types';
|
|
1
|
+
import type { AsyncHook, EnvironmentAsyncHook, InternalContext, ModifyBundlerChainFn, ModifyEnvironmentConfigFn, ModifyHTMLFn, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, ModifyRspackConfigFn, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterDevCompileFn, OnAfterEnvironmentCompileFn, OnAfterStartDevServerFn, OnAfterStartPreviewServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeDevCompileFn, OnBeforeEnvironmentCompileFn, OnBeforeStartDevServerFn, OnBeforeStartPreviewServerFn, OnCloseBuildFn, OnCloseDevServerFn, OnExitFn, OnRestartFn, Rspack } from './types';
|
|
2
2
|
export declare function createEnvironmentAsyncHook<Callback extends (...args: any[]) => any>(): EnvironmentAsyncHook<Callback>;
|
|
3
3
|
export declare function createAsyncHook<Callback extends (...args: any[]) => any>(): AsyncHook<Callback>;
|
|
4
4
|
export declare function initHooks(): {
|
|
5
5
|
/** The following hooks are global hooks */ onExit: AsyncHook<OnExitFn>;
|
|
6
|
+
onRestart: AsyncHook<OnRestartFn>;
|
|
6
7
|
onAfterBuild: AsyncHook<OnAfterBuildFn>;
|
|
7
8
|
onCloseBuild: AsyncHook<OnCloseBuildFn>;
|
|
8
9
|
onBeforeBuild: AsyncHook<OnBeforeBuildFn>;
|
package/dist-types/index.d.ts
CHANGED
|
@@ -25,4 +25,4 @@ export type { RsbuildDevServer } from './server/devServer';
|
|
|
25
25
|
export type { RsbuildServerBase, ServerStartResult, StartDevServerResult, StartPreviewServerResult } from './server/helper';
|
|
26
26
|
export type { RsbuildPreviewServer } from './server/previewServer';
|
|
27
27
|
// Types
|
|
28
|
-
export type { AliasStrategy, AppIcon, AppIconItem, AutoExternal, AutoExternalExclude, Build, BuildOptions, BuildResult, Charset, CleanDistPath, CleanDistPathObject, ClientConfig, CliShortcut, CompressOptions, ConfigChain, ConfigChainWithContext, Connect, ConsoleType, CreateCompiler, CreateRsbuildOptions, CrossOrigin, CSSLoaderOptions, CSSModules, CSSModulesLocalsConvention, DataUriLimit, Decorators, DevConfig, DistPathConfig, EnvironmentConfig, EnvironmentContext, FilenameConfig, FilenameHash, HistoryApiFallbackContext, HistoryApiFallbackOptions, HtmlBasicTag, HtmlConfig, HtmlFallback, HtmlRspackPlugin, HtmlTag, HtmlTagContext, HtmlTagDescriptor, HtmlTagHandler, InitConfigsOptions, InlineChunkConfig, InlineChunkTest, InlineChunkTestFunction, InspectConfigOptions, InspectConfigResult, InternalContext, LegalComments, LogLevel, ManifestConfig, ManifestData, ManifestObjectConfig, MergedEnvironmentConfig, MetaAttrs, MetaOptions, Minify, ModifyBundlerChainFn, ModifyBundlerChainUtils, ModifyChainUtils, ModifyEnvironmentConfigFn, ModifyEnvironmentConfigUtils, ModifyHTMLContext, ModifyHTMLFn, ModifyHTMLTagsContext, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, ModifyRsbuildConfigUtils, ModifyRspackConfigFn, ModifyRspackConfigUtils, ModuleFederationConfig, NormalizedConfig, NormalizedDevConfig, NormalizedEnvironmentConfig, NormalizedHtmlConfig, NormalizedModuleFederationConfig, NormalizedOutputConfig, NormalizedPerformanceConfig, NormalizedResolveConfig, NormalizedSecurityConfig, NormalizedServerConfig, NormalizedSourceConfig, NormalizedSplitChunksConfig, NormalizedToolsConfig, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterDevCompileFn, OnAfterEnvironmentCompileFn, OnAfterStartDevServerFn, OnAfterStartPreviewServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeDevCompileFn, OnBeforeEnvironmentCompileFn, OnBeforeStartDevServerFn, OnBeforeStartPreviewServerFn, OnCloseBuildFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn, OutputConfig, OverlayOptions, OutputStructure, PerformanceConfig, PluginManager, Polyfill, PostCSSLoaderOptions, PostCSSOptions, PostCSSPlugin, PreconnectOption, PreviewOptions, PrintUrls, ProcessAssetsDescriptor, ProcessAssetsHandler, ProcessAssetsHook, ProgressBarConfig, ProxyBypass, ProxyConfig, ProxyFilter, ProxyOptions, PublicDir, PublicDirOptions, RequestHandler, ResolveConfig, ResolvedCreateRsbuildOptions, ResolveHandler, ResolveHook, ResourceHintsIncludeType, RsbuildConfig, RsbuildContext, RsbuildEntry, RsbuildEntryDescription, RsbuildInstance, RsbuildMode, RsbuildPlugin, RsbuildPluginAPI, RsbuildPlugins, RsbuildTarget, RspackChain, RspackRule, ScriptInject, ScriptLoading, SecurityConfig, ServerConfig, SetupMiddlewaresContext, SetupMiddlewaresFn, SourceConfig, SourceMap, SourceMapExtract, SourceMapExtractOptions, SourceMapExtractTarget, SplitChunks, SplitChunksConfig, SplitChunksPreset, SriAlgorithm, SriOptions, StartDevServerOptions, StyleLoaderOptions, ToolsConfig, TransformContext, TransformDescriptor, TransformHandler, TransformHook, TransformImport, WatchFiles, WebSocketUrlResolver } from './types';
|
|
28
|
+
export type { AliasStrategy, AppIcon, AppIconItem, AutoExternal, AutoExternalExclude, Build, BuildOptions, BuildResult, Charset, CleanDistPath, CleanDistPathObject, ClientConfig, CliShortcut, CompressOptions, ConfigChain, ConfigChainWithContext, Connect, ConsoleType, CreateCompiler, CreateRsbuildOptions, CrossOrigin, CSSLoaderOptions, CSSModules, CSSModulesLocalsConvention, DataUriLimit, Decorators, DevConfig, DistPathConfig, EnvironmentConfig, EnvironmentContext, FilenameConfig, FilenameHash, HistoryApiFallbackContext, HistoryApiFallbackOptions, HtmlBasicTag, HtmlConfig, HtmlFallback, HtmlRspackPlugin, HtmlTag, HtmlTagContext, HtmlTagDescriptor, HtmlTagHandler, InitConfigsOptions, InlineChunkConfig, InlineChunkTest, InlineChunkTestFunction, InspectConfigOptions, InspectConfigResult, InternalContext, LegalComments, LogLevel, ManifestConfig, ManifestData, ManifestObjectConfig, MergedEnvironmentConfig, MetaAttrs, MetaOptions, Minify, ModifyBundlerChainFn, ModifyBundlerChainUtils, ModifyChainUtils, ModifyEnvironmentConfigFn, ModifyEnvironmentConfigUtils, ModifyHTMLContext, ModifyHTMLFn, ModifyHTMLTagsContext, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, ModifyRsbuildConfigUtils, ModifyRspackConfigFn, ModifyRspackConfigUtils, ModuleFederationConfig, NormalizedConfig, NormalizedDevConfig, NormalizedEnvironmentConfig, NormalizedHtmlConfig, NormalizedModuleFederationConfig, NormalizedOutputConfig, NormalizedPerformanceConfig, NormalizedResolveConfig, NormalizedSecurityConfig, NormalizedServerConfig, NormalizedSourceConfig, NormalizedSplitChunksConfig, NormalizedToolsConfig, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterDevCompileFn, OnAfterEnvironmentCompileFn, OnAfterStartDevServerFn, OnAfterStartPreviewServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeDevCompileFn, OnBeforeEnvironmentCompileFn, OnBeforeStartDevServerFn, OnBeforeStartPreviewServerFn, OnCloseBuildFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn, OnRestartFn, OutputConfig, OverlayOptions, OutputStructure, PerformanceConfig, PluginManager, Polyfill, PostCSSLoaderOptions, PostCSSOptions, PostCSSPlugin, PreconnectOption, PreviewOptions, PrintUrls, ProcessAssetsDescriptor, ProcessAssetsHandler, ProcessAssetsHook, ProgressBarConfig, ProxyBypass, ProxyConfig, ProxyFilter, ProxyOptions, PublicDir, PublicDirOptions, RequestHandler, ResolveConfig, ResolvedCreateRsbuildOptions, ResolveHandler, ResolveHook, ResourceHintsIncludeType, RestartContext, RestartFn, RsbuildConfig, RsbuildContext, RsbuildEntry, RsbuildEntryDescription, RsbuildInstance, RsbuildMode, RsbuildPlugin, RsbuildPluginAPI, RsbuildPlugins, RsbuildTarget, RspackChain, RspackRule, ScriptInject, ScriptLoading, SecurityConfig, ServerConfig, SetupMiddlewaresContext, SetupMiddlewaresFn, SourceConfig, SourceMap, SourceMapExtract, SourceMapExtractOptions, SourceMapExtractTarget, SplitChunks, SplitChunksConfig, SplitChunksPreset, SriAlgorithm, SriOptions, StartDevServerOptions, StyleLoaderOptions, ToolsConfig, TransformContext, TransformDescriptor, TransformHandler, TransformHook, TransformImport, WatchFiles, WebSocketUrlResolver } from './types';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { type LoadConfigOptions as BaseOptions, type LoadConfigResult as BaseResult } from '../compiled/@rstackjs/load-config';
|
|
1
2
|
import type { RsbuildConfig } from './types';
|
|
3
|
+
export type { ConfigLoader } from '../compiled/@rstackjs/load-config';
|
|
2
4
|
export type ConfigParams = {
|
|
3
5
|
env: string;
|
|
4
6
|
command: string;
|
|
@@ -8,19 +10,7 @@ export type ConfigParams = {
|
|
|
8
10
|
export type RsbuildConfigAsyncFn = (env: ConfigParams) => Promise<RsbuildConfig>;
|
|
9
11
|
export type RsbuildConfigSyncFn = (env: ConfigParams) => RsbuildConfig;
|
|
10
12
|
export type RsbuildConfigDefinition = RsbuildConfig | RsbuildConfigSyncFn | RsbuildConfigAsyncFn;
|
|
11
|
-
export type LoadConfigOptions = {
|
|
12
|
-
/**
|
|
13
|
-
* The root path to resolve the config file.
|
|
14
|
-
* @default process.cwd()
|
|
15
|
-
*/ cwd?: string;
|
|
16
|
-
/**
|
|
17
|
-
* The path to the config file, can be a relative or absolute path.
|
|
18
|
-
* If `path` is not provided, the function will search for the config file in the `cwd`.
|
|
19
|
-
*/ path?: string;
|
|
20
|
-
/**
|
|
21
|
-
* Config file names to search in `cwd` when `path` is not provided.
|
|
22
|
-
* The list replaces the default `rsbuild.config.*` lookup order.
|
|
23
|
-
*/ configFileNames?: string[];
|
|
13
|
+
export type LoadConfigOptions = Pick<BaseOptions<[ConfigParams]>, 'cwd' | 'path' | 'loader' | 'exportName' | 'configFileNames'> & {
|
|
24
14
|
/**
|
|
25
15
|
* A custom meta object to be passed into the config function of `defineConfig`.
|
|
26
16
|
*/ meta?: Record<string, unknown>;
|
|
@@ -29,35 +19,11 @@ export type LoadConfigOptions = {
|
|
|
29
19
|
* @default process.env.NODE_ENV
|
|
30
20
|
*/ envMode?: string;
|
|
31
21
|
/**
|
|
32
|
-
* Specify the config loader, can be `auto`, `jiti` or `native`.
|
|
33
|
-
* - 'auto': Use native Node.js loader first, fallback to jiti if failed
|
|
34
|
-
* - 'jiti': Use `jiti` as loader, which supports TypeScript and ESM out of the box
|
|
35
|
-
* - 'native': Use native Node.js loader, requires TypeScript support in Node.js >= 22.6
|
|
36
|
-
* @default 'auto'
|
|
37
|
-
*/ loader?: ConfigLoader;
|
|
38
|
-
/**
|
|
39
22
|
* The command passed to the config function.
|
|
40
23
|
* @default process.argv[2]
|
|
41
24
|
*/ command?: string;
|
|
42
|
-
/**
|
|
43
|
-
* The export name to read from the config file.
|
|
44
|
-
* Set to `false` to execute the config file without reading exports.
|
|
45
|
-
* @default 'default'
|
|
46
|
-
*/ exportName?: string | false;
|
|
47
|
-
};
|
|
48
|
-
export type LoadConfigResult<Config = RsbuildConfig> = {
|
|
49
|
-
/**
|
|
50
|
-
* The loaded configuration object.
|
|
51
|
-
*/ content: Config;
|
|
52
|
-
/**
|
|
53
|
-
* The path to the loaded configuration file.
|
|
54
|
-
* Return `null` if the configuration file is not found.
|
|
55
|
-
*/ filePath: string | null;
|
|
56
|
-
/**
|
|
57
|
-
* Absolute file paths of statically imported (relative) dependencies of the
|
|
58
|
-
* config file.
|
|
59
|
-
*/ dependencies: string[];
|
|
60
25
|
};
|
|
26
|
+
export type LoadConfigResult<Config = RsbuildConfig> = Pick<BaseResult<Config>, 'content' | 'filePath' | 'dependencies'>;
|
|
61
27
|
/**
|
|
62
28
|
* This function helps you to autocomplete configuration types.
|
|
63
29
|
* It accepts a Rsbuild config object, or a function that returns a config.
|
|
@@ -65,5 +31,4 @@ export type LoadConfigResult<Config = RsbuildConfig> = {
|
|
|
65
31
|
export declare function defineConfig(config: RsbuildConfigSyncFn): RsbuildConfigSyncFn;
|
|
66
32
|
export declare function defineConfig(config: RsbuildConfigAsyncFn): RsbuildConfigAsyncFn;
|
|
67
33
|
export declare function defineConfig(config: RsbuildConfigDefinition): RsbuildConfigDefinition;
|
|
68
|
-
export type ConfigLoader = 'auto' | 'jiti' | 'native';
|
|
69
34
|
export declare function loadConfig<Config = RsbuildConfig>({ cwd, path, configFileNames, envMode, meta, loader, command, exportName }?: LoadConfigOptions): Promise<LoadConfigResult<Config>>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { LightningCssMinimizerRspackPluginOptions, SwcJsMinimizerRspackPluginOptions } from '@rspack/core';
|
|
2
|
-
import type { NormalizedEnvironmentConfig, RsbuildPlugin } from '../types';
|
|
2
|
+
import type { NormalizedEnvironmentConfig, OneOrMany, RsbuildPlugin } from '../types';
|
|
3
3
|
export declare function getSwcMinimizerOptions(config: NormalizedEnvironmentConfig, jsOptions?: SwcJsMinimizerRspackPluginOptions): SwcJsMinimizerRspackPluginOptions;
|
|
4
4
|
export declare function parseMinifyOptions(config: NormalizedEnvironmentConfig): {
|
|
5
5
|
minifyJs: boolean;
|
|
6
6
|
minifyCss: boolean;
|
|
7
|
-
jsOptions?: SwcJsMinimizerRspackPluginOptions
|
|
7
|
+
jsOptions?: OneOrMany<SwcJsMinimizerRspackPluginOptions>;
|
|
8
8
|
cssOptions?: LightningCssMinimizerRspackPluginOptions;
|
|
9
9
|
};
|
|
10
10
|
export declare const pluginMinimize: () => RsbuildPlugin;
|
package/dist-types/restart.d.ts
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RestartManager } from './helpers/restartManager';
|
|
2
2
|
import type { Logger } from './logger';
|
|
3
|
-
import type
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
* Add a cleaner to handle side effects
|
|
7
|
-
*/ export declare const onBeforeRestartServer: (cleaner: Cleaner) => void;
|
|
8
|
-
export declare const restartDevServer: ({ filePath, clear, logger }: {
|
|
9
|
-
filePath?: string;
|
|
3
|
+
import { type WatchFilesResult } from './server/watchFiles';
|
|
4
|
+
import type { InternalContext, RestartContext, WatchFiles } from './types';
|
|
5
|
+
export declare const requestRestart: ({ filePath, clear, action, logger, restartManager }: RestartContext & {
|
|
10
6
|
clear?: boolean;
|
|
11
7
|
logger: Logger;
|
|
8
|
+
restartManager: RestartManager;
|
|
12
9
|
}) => Promise<boolean>;
|
|
13
|
-
export declare function watchFilesForRestart({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}): Promise<void>;
|
|
19
|
-
export { };
|
|
10
|
+
export declare function watchFilesForRestart({ watchFiles, context, action }: {
|
|
11
|
+
watchFiles: WatchFiles[];
|
|
12
|
+
context: InternalContext;
|
|
13
|
+
action: RestartContext['action'];
|
|
14
|
+
}): WatchFilesResult | undefined;
|
|
@@ -870,8 +870,10 @@ export type Minify = boolean | {
|
|
|
870
870
|
*/ js?: boolean | 'always';
|
|
871
871
|
/**
|
|
872
872
|
* Minimizer options of JavaScript, which will be passed to SWC.
|
|
873
|
+
* When using an array, each item registers a separate minimizer and the first matching item
|
|
874
|
+
* applies to each JavaScript asset.
|
|
873
875
|
* @default {}
|
|
874
|
-
*/ jsOptions?: SwcJsMinimizerRspackPluginOptions
|
|
876
|
+
*/ jsOptions?: OneOrMany<SwcJsMinimizerRspackPluginOptions>;
|
|
875
877
|
/**
|
|
876
878
|
* Whether to enable minification for CSS bundles.
|
|
877
879
|
* - `true`: Enabled in production mode.
|
|
@@ -1500,9 +1502,12 @@ export type WatchFiles = {
|
|
|
1500
1502
|
* Watch options passed to [chokidar](https://github.com/paulmillr/chokidar).
|
|
1501
1503
|
*/ options?: ChokidarOptions;
|
|
1502
1504
|
/**
|
|
1503
|
-
* Specifies
|
|
1505
|
+
* Specifies the action to take when files change.
|
|
1506
|
+
* - `reload-page`: Reload the page.
|
|
1507
|
+
* - `restart`: Trigger a restart request for the dev server or watch build.
|
|
1508
|
+
* - `reload-server`: Deprecated alias for `restart`.
|
|
1504
1509
|
* @default 'reload-page'
|
|
1505
|
-
*/ type?: 'reload-page' | 'reload-server';
|
|
1510
|
+
*/ type?: 'reload-page' | 'restart' | 'reload-server';
|
|
1506
1511
|
};
|
|
1507
1512
|
export type CliShortcut = {
|
|
1508
1513
|
/**
|
|
@@ -1589,7 +1594,7 @@ export interface DevConfig {
|
|
|
1589
1594
|
*/ writeToDisk?: WriteToDisk;
|
|
1590
1595
|
/**
|
|
1591
1596
|
* Watch specified files and directories for changes. When a file change is detected,
|
|
1592
|
-
* it can trigger a page reload or restart the dev server.
|
|
1597
|
+
* it can trigger a page reload or a restart request for the dev server or watch build.
|
|
1593
1598
|
* @default undefined
|
|
1594
1599
|
*/ watchFiles?: WatchFiles | WatchFiles[];
|
|
1595
1600
|
/**
|
|
@@ -1649,6 +1654,9 @@ export type RsbuildConfigMeta = {
|
|
|
1649
1654
|
/**
|
|
1650
1655
|
* Path to the rsbuild config file.
|
|
1651
1656
|
*/ configFilePath: string;
|
|
1657
|
+
/**
|
|
1658
|
+
* Paths to files imported by the rsbuild config file.
|
|
1659
|
+
*/ configFileDependencies?: string[];
|
|
1652
1660
|
};
|
|
1653
1661
|
/**
|
|
1654
1662
|
* Only some dev options can be defined in the environment config
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Hooks } from '../hooks';
|
|
2
|
+
import type { RestartManager } from '../helpers/restartManager';
|
|
2
3
|
import type { Logger } from '../logger';
|
|
3
4
|
import type { SocketServer } from '../server/socketServer';
|
|
4
5
|
import type { NormalizedConfig, RsbuildConfig } from './config';
|
|
@@ -10,6 +11,8 @@ export type ActionType = 'dev' | 'build' | 'preview';
|
|
|
10
11
|
/** The public context */ export type RsbuildContext = {
|
|
11
12
|
/** The Rsbuild core version. */ version: string;
|
|
12
13
|
/** The root path of current project. */ rootPath: string;
|
|
14
|
+
/** Absolute path to the loaded configuration file. */ configFile?: string;
|
|
15
|
+
/** Absolute paths of files imported by the configuration file. */ configFileDependencies: readonly string[];
|
|
13
16
|
/** Absolute path of output files. */ distPath: string;
|
|
14
17
|
/** Absolute path of cache files. */ cachePath: string;
|
|
15
18
|
/**
|
|
@@ -65,6 +68,7 @@ export type BuildState = {
|
|
|
65
68
|
/** The inner context. */ export type InternalContext = RsbuildContext & {
|
|
66
69
|
/** The logger associated with current Rsbuild instance. */ logger: Logger;
|
|
67
70
|
/** All hooks. */ hooks: Readonly<Hooks>;
|
|
71
|
+
/** Manage callbacks for restarting the current Rsbuild instance. */ restartManager: RestartManager;
|
|
68
72
|
/** Current Rsbuild config. */ config: Readonly<RsbuildConfig>;
|
|
69
73
|
/** The original Rsbuild config passed from the createRsbuild method. */ originalConfig: Readonly<RsbuildConfig>;
|
|
70
74
|
/** The normalized Rsbuild config. */ normalizedConfig?: NormalizedConfig;
|
|
@@ -102,6 +102,17 @@ export type OnAfterCreateCompilerFn<Compiler = Rspack.Compiler | Rspack.MultiCom
|
|
|
102
102
|
export type OnExitFn = (context: {
|
|
103
103
|
exitCode: number;
|
|
104
104
|
}) => void;
|
|
105
|
+
export type RestartContext = {
|
|
106
|
+
/**
|
|
107
|
+
* The current Rsbuild action being restarted.
|
|
108
|
+
*/ action: 'dev' | 'build';
|
|
109
|
+
/**
|
|
110
|
+
* The absolute path of the file that triggered the restart.
|
|
111
|
+
* It is undefined when the restart is manually triggered.
|
|
112
|
+
*/ filePath?: string;
|
|
113
|
+
};
|
|
114
|
+
/** Restart the current Rsbuild task and return whether the restart succeeded. */ export type RestartFn = (context: RestartContext) => MaybePromise<boolean>;
|
|
115
|
+
export type OnRestartFn = (context: RestartContext) => MaybePromise<void>;
|
|
105
116
|
export type ModifyHTMLContext = {
|
|
106
117
|
/**
|
|
107
118
|
* The Compilation object of Rspack.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Logger } from '../logger';
|
|
2
2
|
import type { ModifyRspackConfigUtils, NarrowedRspackConfig, NormalizedConfig, NormalizedEnvironmentConfig, RsbuildConfig } from './config';
|
|
3
3
|
import type { RsbuildContext } from './context';
|
|
4
|
-
import type { EnvironmentContext, ModifyBundlerChainFn, ModifyEnvironmentConfigFn, ModifyHTMLFn, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterDevCompileFn, OnAfterEnvironmentCompileFn, OnAfterStartDevServerFn, OnAfterStartPreviewServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeDevCompileFn, OnBeforeEnvironmentCompileFn, OnBeforeStartDevServerFn, OnBeforeStartPreviewServerFn, OnCloseBuildFn, OnCloseDevServerFn, OnExitFn } from './hooks';
|
|
4
|
+
import type { EnvironmentContext, ModifyBundlerChainFn, ModifyEnvironmentConfigFn, ModifyHTMLFn, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterDevCompileFn, OnAfterEnvironmentCompileFn, OnAfterStartDevServerFn, OnAfterStartPreviewServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeDevCompileFn, OnBeforeEnvironmentCompileFn, OnBeforeStartDevServerFn, OnBeforeStartPreviewServerFn, OnCloseBuildFn, OnCloseDevServerFn, OnExitFn, OnRestartFn } from './hooks';
|
|
5
5
|
import type { AddPluginsOptions, RsbuildInstance, RsbuildTarget } from './rsbuild';
|
|
6
6
|
import type { Rspack } from './rspack';
|
|
7
7
|
import type { Falsy, MaybePromise } from './utils';
|
|
@@ -452,6 +452,9 @@ export type GetNormalizedConfig = {
|
|
|
452
452
|
* synchronous code.
|
|
453
453
|
*/ onExit: PluginHook<OnExitFn>;
|
|
454
454
|
/**
|
|
455
|
+
* Called when a restart is requested for the dev server or watch build.
|
|
456
|
+
*/ onRestart: PluginHook<OnRestartFn>;
|
|
457
|
+
/**
|
|
455
458
|
* Modify assets before emitting, the same as Rspack's
|
|
456
459
|
* [compilation.hooks.processAssets](https://rspack.rs/api/plugin-api/compilation-hooks#processassets) hook.
|
|
457
460
|
*/ processAssets: ProcessAssetsHook;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { Compiler, MultiCompiler } from '@rspack/core';
|
|
2
|
+
import type { LoadConfigResult } from '../loadConfig';
|
|
2
3
|
import type { LoadEnvOptions } from '../loadEnv';
|
|
3
4
|
import type { Logger } from '../logger';
|
|
4
5
|
import type { RsbuildDevServer } from '../server/devServer';
|
|
5
6
|
import type { StartDevServerResult, StartPreviewServerResult } from '../server/helper';
|
|
6
7
|
import type { NormalizedConfig, NormalizedEnvironmentConfig, RsbuildConfig } from './config';
|
|
7
8
|
import type { RsbuildContext } from './context';
|
|
9
|
+
import type { RestartFn } from './hooks';
|
|
8
10
|
import type { RsbuildPlugin, RsbuildPluginAPI } from './plugin';
|
|
9
11
|
import type { Rspack } from './rspack';
|
|
10
12
|
import type { Falsy } from './utils';
|
|
@@ -90,6 +92,7 @@ export type InspectConfigResult = {
|
|
|
90
92
|
};
|
|
91
93
|
};
|
|
92
94
|
export type CreateCompiler = () => Promise<Compiler | MultiCompiler>;
|
|
95
|
+
type RsbuildConfigInput = RsbuildConfig | LoadConfigResult;
|
|
93
96
|
export type CreateRsbuildOptions = {
|
|
94
97
|
/**
|
|
95
98
|
* The root path of current project.
|
|
@@ -109,18 +112,21 @@ export type CreateRsbuildOptions = {
|
|
|
109
112
|
/**
|
|
110
113
|
* Alias for `config`.
|
|
111
114
|
* This option will be deprecated in the future.
|
|
112
|
-
*/ rsbuildConfig?:
|
|
115
|
+
*/ rsbuildConfig?: RsbuildConfigInput | (() => Promise<RsbuildConfigInput>);
|
|
113
116
|
/**
|
|
114
|
-
* Rsbuild
|
|
117
|
+
* Rsbuild configuration or the result returned by `loadConfig`.
|
|
115
118
|
* Passing a function to load the config asynchronously with custom logic.
|
|
116
|
-
*/ config?:
|
|
119
|
+
*/ config?: RsbuildConfigInput | (() => Promise<RsbuildConfigInput>);
|
|
117
120
|
/**
|
|
118
121
|
* Whether to call `loadEnv` to load environment variables and define them
|
|
119
122
|
* as global variables via `source.define`.
|
|
120
123
|
* @default false
|
|
121
124
|
*/ loadEnv?: boolean | LoadEnvOptions;
|
|
125
|
+
/**
|
|
126
|
+
* Function used to restart the current dev server or watch build.
|
|
127
|
+
*/ restart?: RestartFn;
|
|
122
128
|
};
|
|
123
|
-
export type ResolvedCreateRsbuildOptions = Required<Pick<CreateRsbuildOptions, 'cwd' | 'callerName'>> & Pick<CreateRsbuildOptions, 'loadEnv' | 'environment'> & {
|
|
129
|
+
export type ResolvedCreateRsbuildOptions = Required<Pick<CreateRsbuildOptions, 'cwd' | 'callerName'>> & Pick<CreateRsbuildOptions, 'loadEnv' | 'environment' | 'restart'> & {
|
|
124
130
|
rsbuildConfig: RsbuildConfig;
|
|
125
131
|
};
|
|
126
132
|
export type CreateDevServer = (options?: CreateDevServerOptions) => Promise<RsbuildDevServer>;
|
|
@@ -214,7 +220,7 @@ export type RsbuildInstance = {
|
|
|
214
220
|
* 1. Start a development server that serves your application.
|
|
215
221
|
* 2. Watch for file changes and trigger recompilation.
|
|
216
222
|
*/ startDevServer: StartDevServer;
|
|
217
|
-
} & Pick<RsbuildPluginAPI, 'context' | 'expose' | 'getNormalizedConfig' | 'getRsbuildConfig' | 'isPluginExists' | 'modifyEnvironmentConfig' | 'modifyRsbuildConfig' | 'onAfterBuild' | 'onAfterCreateCompiler' | 'onAfterDevCompile' | 'onAfterEnvironmentCompile' | 'onAfterStartDevServer' | 'onAfterStartPreviewServer' | 'onBeforeBuild' | 'onBeforeCreateCompiler' | 'onBeforeDevCompile' | 'onBeforeEnvironmentCompile' | 'onBeforeStartDevServer' | 'onBeforeStartPreviewServer' | 'onCloseBuild' | 'onCloseDevServer' | 'onDevCompileDone' | 'onExit'>;
|
|
223
|
+
} & Pick<RsbuildPluginAPI, 'context' | 'expose' | 'getNormalizedConfig' | 'getRsbuildConfig' | 'isPluginExists' | 'modifyEnvironmentConfig' | 'modifyRsbuildConfig' | 'onAfterBuild' | 'onAfterCreateCompiler' | 'onAfterDevCompile' | 'onAfterEnvironmentCompile' | 'onAfterStartDevServer' | 'onAfterStartPreviewServer' | 'onBeforeBuild' | 'onBeforeCreateCompiler' | 'onBeforeDevCompile' | 'onBeforeEnvironmentCompile' | 'onBeforeStartDevServer' | 'onBeforeStartPreviewServer' | 'onCloseBuild' | 'onCloseDevServer' | 'onDevCompileDone' | 'onExit' | 'onRestart'>;
|
|
218
224
|
export type RsbuildTarget = 'web' | 'node' | 'web-worker';
|
|
219
225
|
export type RsbuildEntryDescription = Rspack.EntryDescription & {
|
|
220
226
|
/**
|
|
@@ -231,3 +237,4 @@ export type RsbuildStatsItem = Pick<Rspack.StatsCompilation, 'errors' | 'warning
|
|
|
231
237
|
*/ export type RsbuildStats = RsbuildStatsItem & {
|
|
232
238
|
children: RsbuildStatsItem[];
|
|
233
239
|
};
|
|
240
|
+
export { };
|