@rsbuild/core 2.0.6 → 2.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ws.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { __webpack_require__ } from "./1~rslib-runtime.js";
2
- import "./753.js";
2
+ import "./756.js";
3
3
  __webpack_require__.add({
4
- "../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/buffer-util.js" (module, __unused_rspack_exports, __webpack_require__) {
5
- let { EMPTY_BUFFER } = __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/constants.js"), FastBuffer = Buffer[Symbol.species];
4
+ "../../node_modules/.pnpm/ws@8.21.0/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.0/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.20.0/node_modules/ws/lib/constants.js" (module) {
33
+ "../../node_modules/.pnpm/ws@8.21.0/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.20.0/node_modules/ws/lib/event-target.js" (module, __unused_rspack_exports, __webpack_require__) {
53
- let { kForOnEventAttribute, kListener } = __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/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');
52
+ "../../node_modules/.pnpm/ws@8.21.0/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.0/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.20.0/node_modules/ws/lib/extension.js" (module, __unused_rspack_exports, __webpack_require__) {
169
- let { tokenChars } = __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/validation.js");
168
+ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/extension.js" (module, __unused_rspack_exports, __webpack_require__) {
169
+ let { tokenChars } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/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.20.0/node_modules/ws/lib/limiter.js" (module) {
231
+ "../../node_modules/.pnpm/ws@8.21.0/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.20.0/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.20.0/node_modules/ws/lib/buffer-util.js"), Limiter = __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/limiter.js"), { kStatusCode } = __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/constants.js"), FastBuffer = Buffer[Symbol.species], TRAILER = Buffer.from([
250
+ "../../node_modules/.pnpm/ws@8.21.0/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.0/node_modules/ws/lib/buffer-util.js"), Limiter = __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/limiter.js"), { kStatusCode } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/constants.js"), FastBuffer = Buffer[Symbol.species], TRAILER = Buffer.from([
252
252
  0x00,
253
253
  0x00,
254
254
  0xff,
@@ -368,15 +368,14 @@ __webpack_require__.add({
368
368
  }
369
369
  };
370
370
  },
371
- "../../node_modules/.pnpm/ws@8.20.0/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.20.0/node_modules/ws/lib/permessage-deflate.js"), { BINARY_TYPES, EMPTY_BUFFER, kStatusCode, kWebSocket } = __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/constants.js"), { concat, toArrayBuffer, unmask } = __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/buffer-util.js"), { isValidStatusCode, isValidUTF8 } = __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/validation.js"), FastBuffer = Buffer[Symbol.species];
371
+ "../../node_modules/.pnpm/ws@8.21.0/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.0/node_modules/ws/lib/permessage-deflate.js"), { BINARY_TYPES, EMPTY_BUFFER, kStatusCode, kWebSocket } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/constants.js"), { concat, toArrayBuffer, unmask } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/buffer-util.js"), { isValidStatusCode, isValidUTF8 } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/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._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._fragments = [], this._errored = !1, this._loop = !1, this._state = 0;
376
376
  }
377
377
  _write(chunk, encoding, cb) {
378
- if (0x08 === this._opcode && 0 == this._state) return cb();
379
- this._bufferedBytes += chunk.length, this._buffers.push(chunk), this.startLoop(cb);
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));
380
379
  }
381
380
  consume(n) {
382
381
  if (this._bufferedBytes -= n, n === this._buffers[0].length) return this._buffers.shift();
@@ -483,13 +482,18 @@ __webpack_require__.add({
483
482
  this._state = 5, this.decompress(data, cb);
484
483
  return;
485
484
  }
486
- data.length && (this._messageLength = this._totalPayloadLength, this._fragments.push(data)), this.dataMessage(cb);
485
+ if (data.length) {
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);
487
490
  }
488
491
  decompress(data, cb) {
489
492
  this._extensions[PerMessageDeflate.extensionName].decompress(data, this._fin, (err, buf)=>{
490
493
  if (err) return cb(err);
491
494
  if (buf.length) {
492
495
  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'));
493
497
  this._fragments.push(buf);
494
498
  }
495
499
  this.dataMessage(cb), 0 === this._state && this.startLoop(cb);
@@ -538,8 +542,8 @@ __webpack_require__.add({
538
542
  }
539
543
  };
540
544
  },
541
- "../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/sender.js" (module, __unused_rspack_exports, __webpack_require__) {
542
- let randomPool, { Duplex } = __webpack_require__("stream"), { randomFillSync } = __webpack_require__("crypto"), PerMessageDeflate = __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/permessage-deflate.js"), { EMPTY_BUFFER, kWebSocket, NOOP } = __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/constants.js"), { isBlob, isValidStatusCode } = __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/validation.js"), { mask: applyMask, toBuffer } = __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/buffer-util.js"), kByteLength = Symbol('kByteLength'), maskBuffer = Buffer.alloc(4), randomPoolPointer = 8192;
545
+ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/sender.js" (module, __unused_rspack_exports, __webpack_require__) {
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.0/node_modules/ws/lib/permessage-deflate.js"), { EMPTY_BUFFER, kWebSocket, NOOP } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/constants.js"), { isBlob, isValidStatusCode } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/validation.js"), { mask: applyMask, toBuffer } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/buffer-util.js"), kByteLength = Symbol('kByteLength'), maskBuffer = Buffer.alloc(4), randomPoolPointer = 8192;
543
547
  function callCallbacks(sender, err, cb) {
544
548
  'function' == typeof cb && cb(err);
545
549
  for(let i = 0; i < sender._queue.length; i++){
@@ -579,7 +583,9 @@ __webpack_require__.add({
579
583
  else if ('number' == typeof code && isValidStatusCode(code)) if (void 0 !== data && data.length) {
580
584
  let length = Buffer.byteLength(data);
581
585
  if (length > 123) throw RangeError('The message must not be greater than 123 bytes');
582
- (buf = Buffer.allocUnsafe(2 + length)).writeUInt16BE(code, 0), 'string' == typeof data ? buf.write(data, 2) : buf.set(data, 2);
586
+ if ((buf = Buffer.allocUnsafe(2 + length)).writeUInt16BE(code, 0), 'string' == typeof data) buf.write(data, 2);
587
+ else if (isUint8Array(data)) buf.set(data, 2);
588
+ else throw TypeError('Second argument must be a string or a Uint8Array');
583
589
  } else (buf = Buffer.allocUnsafe(2)).writeUInt16BE(code, 0);
584
590
  else throw TypeError('First argument must be a valid error code number');
585
591
  let options = {
@@ -716,8 +722,8 @@ __webpack_require__.add({
716
722
  }
717
723
  };
718
724
  },
719
- "../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/stream.js" (module, __unused_rspack_exports, __webpack_require__) {
720
- __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/websocket.js");
725
+ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/stream.js" (module, __unused_rspack_exports, __webpack_require__) {
726
+ __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/websocket.js");
721
727
  let { Duplex } = __webpack_require__("stream");
722
728
  function emitClose(stream) {
723
729
  stream.emit('close');
@@ -769,8 +775,8 @@ __webpack_require__.add({
769
775
  }, duplex.on('end', duplexOnEnd), duplex.on('error', duplexOnError), duplex;
770
776
  };
771
777
  },
772
- "../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/subprotocol.js" (module, __unused_rspack_exports, __webpack_require__) {
773
- let { tokenChars } = __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/validation.js");
778
+ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/subprotocol.js" (module, __unused_rspack_exports, __webpack_require__) {
779
+ let { tokenChars } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/validation.js");
774
780
  module.exports = {
775
781
  parse: function parse(header) {
776
782
  let protocols = new Set(), start = -1, end = -1, i = 0;
@@ -793,8 +799,8 @@ __webpack_require__.add({
793
799
  }
794
800
  };
795
801
  },
796
- "../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/validation.js" (module, __unused_rspack_exports, __webpack_require__) {
797
- let { isUtf8 } = __webpack_require__("buffer"), { hasBlob } = __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/constants.js");
802
+ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/validation.js" (module, __unused_rspack_exports, __webpack_require__) {
803
+ let { isUtf8 } = __webpack_require__("buffer"), { hasBlob } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/constants.js");
798
804
  function _isValidUTF8(buf) {
799
805
  let len = buf.length, i = 0;
800
806
  for(; i < len;)if ((0x80 & buf[i]) == 0) i++;
@@ -952,8 +958,8 @@ __webpack_require__.add({
952
958
  return buf.length < 24 ? _isValidUTF8(buf) : isUtf8(buf);
953
959
  });
954
960
  },
955
- "../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/websocket-server.js" (module, __unused_rspack_exports, __webpack_require__) {
956
- 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.20.0/node_modules/ws/lib/extension.js"), PerMessageDeflate = __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/permessage-deflate.js"), subprotocol = __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/subprotocol.js"), WebSocket = __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/websocket.js"), { CLOSE_TIMEOUT, GUID, kWebSocket } = __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/constants.js"), keyRegex = /^[+/0-9A-Za-z]{22}==$/;
961
+ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/websocket-server.js" (module, __unused_rspack_exports, __webpack_require__) {
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.0/node_modules/ws/lib/extension.js"), PerMessageDeflate = __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/permessage-deflate.js"), subprotocol = __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/subprotocol.js"), WebSocket = __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/websocket.js"), { CLOSE_TIMEOUT, GUID, kWebSocket } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/constants.js"), keyRegex = /^[+/0-9A-Za-z]{22}==$/;
957
963
  function addListeners(server, map) {
958
964
  for (let event of Object.keys(map))server.on(event, map[event]);
959
965
  return function removeListeners() {
@@ -985,6 +991,8 @@ __webpack_require__.add({
985
991
  if (super(), null == (options = {
986
992
  allowSynchronousEvents: !0,
987
993
  autoPong: !0,
994
+ maxBufferedChunks: 1048576,
995
+ maxFragments: 131072,
988
996
  maxPayload: 104857600,
989
997
  skipUTF8Validation: !1,
990
998
  perMessageDeflate: !1,
@@ -1115,6 +1123,8 @@ __webpack_require__.add({
1115
1123
  }
1116
1124
  this.emit('headers', headers, req), socket.write(headers.concat('\r\n').join('\r\n')), socket.removeListener('error', socketOnError), ws.setSocket(socket, head, {
1117
1125
  allowSynchronousEvents: this.options.allowSynchronousEvents,
1126
+ maxBufferedChunks: this.options.maxBufferedChunks,
1127
+ maxFragments: this.options.maxFragments,
1118
1128
  maxPayload: this.options.maxPayload,
1119
1129
  skipUTF8Validation: this.options.skipUTF8Validation
1120
1130
  }), this.clients && (this.clients.add(ws), ws.on('close', ()=>{
@@ -1123,8 +1133,8 @@ __webpack_require__.add({
1123
1133
  }
1124
1134
  };
1125
1135
  },
1126
- "../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/websocket.js" (module, __unused_rspack_exports, __webpack_require__) {
1127
- 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.20.0/node_modules/ws/lib/permessage-deflate.js"), Receiver = __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/receiver.js"), Sender = __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/sender.js"), { isBlob } = __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/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.20.0/node_modules/ws/lib/constants.js"), { EventTarget: { addEventListener, removeEventListener } } = __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/event-target.js"), { format, parse } = __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/extension.js"), { toBuffer } = __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/buffer-util.js"), kAborted = Symbol('kAborted'), protocolVersions = [
1136
+ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/websocket.js" (module, __unused_rspack_exports, __webpack_require__) {
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.0/node_modules/ws/lib/permessage-deflate.js"), Receiver = __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/receiver.js"), Sender = __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/sender.js"), { isBlob } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/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.0/node_modules/ws/lib/constants.js"), { EventTarget: { addEventListener, removeEventListener } } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/event-target.js"), { format, parse } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/extension.js"), { toBuffer } = __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/buffer-util.js"), kAborted = Symbol('kAborted'), protocolVersions = [
1128
1138
  8,
1129
1139
  13
1130
1140
  ], readyStates = [
@@ -1181,6 +1191,8 @@ __webpack_require__.add({
1181
1191
  binaryType: this.binaryType,
1182
1192
  extensions: this._extensions,
1183
1193
  isServer: this._isServer,
1194
+ maxBufferedChunks: options.maxBufferedChunks,
1195
+ maxFragments: options.maxFragments,
1184
1196
  maxPayload: options.maxPayload,
1185
1197
  skipUTF8Validation: options.skipUTF8Validation
1186
1198
  }), sender = new Sender(socket, this._extensions, options.generateMask);
@@ -1244,6 +1256,8 @@ __webpack_require__.add({
1244
1256
  autoPong: !0,
1245
1257
  closeTimeout: CLOSE_TIMEOUT,
1246
1258
  protocolVersion: protocolVersions[1],
1259
+ maxBufferedChunks: 1048576,
1260
+ maxFragments: 131072,
1247
1261
  maxPayload: 104857600,
1248
1262
  skipUTF8Validation: !1,
1249
1263
  perMessageDeflate: !0,
@@ -1363,6 +1377,8 @@ __webpack_require__.add({
1363
1377
  websocket.setSocket(socket, head, {
1364
1378
  allowSynchronousEvents: opts.allowSynchronousEvents,
1365
1379
  generateMask: opts.generateMask,
1380
+ maxBufferedChunks: opts.maxBufferedChunks,
1381
+ maxFragments: opts.maxFragments,
1366
1382
  maxPayload: opts.maxPayload,
1367
1383
  skipUTF8Validation: opts.skipUTF8Validation
1368
1384
  });
@@ -1507,6 +1523,6 @@ __webpack_require__.add({
1507
1523
  }), WebSocket.prototype.addEventListener = addEventListener, WebSocket.prototype.removeEventListener = removeEventListener, module.exports = WebSocket;
1508
1524
  }
1509
1525
  });
1510
- let websocket_server = __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/websocket-server.js");
1511
- __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/stream.js"), __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/extension.js"), __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/permessage-deflate.js"), __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/receiver.js"), __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/sender.js"), __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/subprotocol.js"), __webpack_require__("../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/websocket.js");
1526
+ let websocket_server = __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/websocket-server.js");
1527
+ __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/stream.js"), __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/extension.js"), __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/permessage-deflate.js"), __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/receiver.js"), __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/sender.js"), __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/subprotocol.js"), __webpack_require__("../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/websocket.js");
1512
1528
  export { websocket_server as WebSocketServer };
@@ -41,6 +41,7 @@ export declare const CHAIN_ID: {
41
41
  readonly ONE_OF: {
42
42
  /** JS oneOf rules */
43
43
  readonly JS_MAIN: 'js';
44
+ readonly JS_WORKER: 'js-worker';
44
45
  readonly JS_RAW: 'js-raw';
45
46
  /** CSS oneOf rules */
46
47
  readonly CSS_MAIN: 'css';
@@ -75,6 +76,8 @@ export declare const CHAIN_ID: {
75
76
  readonly VUE: 'vue';
76
77
  /** swc-loader */
77
78
  readonly SWC: 'swc';
79
+ /** worker query loader */
80
+ readonly WORKER_QUERY: 'worker-query';
78
81
  /** svgr */
79
82
  readonly SVGR: 'svgr';
80
83
  /** babel-loader */
@@ -45,6 +45,11 @@ export declare const INLINE_QUERY_REGEX: RegExp;
45
45
  * Matches patterns like: `?url`, `?url&other=value`, `?other=value&url`, `?url=value`
46
46
  */
47
47
  export declare const URL_QUERY_REGEX: RegExp;
48
+ /**
49
+ * Regular expression to match the 'worker' query parameter.
50
+ * Matches patterns like: `?worker`, `?worker&inline`, `?inline&worker`, `?worker=value`
51
+ */
52
+ export declare const WORKER_QUERY_REGEX: RegExp;
48
53
  export declare const NODE_MODULES_REGEX: RegExp;
49
54
  export declare const PLUGIN_SWC_NAME = "rsbuild:swc";
50
55
  export declare const PLUGIN_CSS_NAME = "rsbuild:css";
@@ -0,0 +1,9 @@
1
+ export type PackageJson = Partial<{
2
+ name: string;
3
+ type: string;
4
+ dependencies: Record<string, string>;
5
+ optionalDependencies: Record<string, string>;
6
+ peerDependencies: Record<string, string>;
7
+ devDependencies: Record<string, string>;
8
+ }>;
9
+ export declare const readPackageJsonByPath: (pkgJsonPath: string) => Promise<PackageJson | undefined>;
@@ -20,4 +20,4 @@ export { mergeRsbuildConfig } from './mergeConfig';
20
20
  export type { RsbuildDevServer } from './server/devServer';
21
21
  export type { RsbuildServerBase, ServerStartResult, StartDevServerResult, StartPreviewServerResult, } from './server/helper';
22
22
  export type { RsbuildPreviewServer } from './server/previewServer';
23
- export type { AliasStrategy, AppIcon, AppIconItem, 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, } from './types';
23
+ 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, } from './types';
@@ -0,0 +1,6 @@
1
+ import type { LoaderDefinition } from '@rspack/core';
2
+ type WorkerLoaderOptions = {
3
+ name?: string;
4
+ };
5
+ declare const workerLoader: LoaderDefinition<WorkerLoaderOptions>;
6
+ export default workerLoader;
@@ -1,2 +1,8 @@
1
1
  import type { RsbuildConfig } from './types';
2
+ /**
3
+ * Deeply merges multiple Rsbuild configuration objects.
4
+ *
5
+ * This function returns a new merged configuration object and does not modify
6
+ * the input configuration objects.
7
+ */
2
8
  export declare const mergeRsbuildConfig: <T = RsbuildConfig>(...originalConfigs: (T | undefined)[]) => T;
@@ -1,4 +1,4 @@
1
1
  import type { CSSLoaderOptions, NormalizedEnvironmentConfig, RsbuildPlugin, Rspack } from '../types';
2
- export declare function getLightningCSSLoaderOptions(config: NormalizedEnvironmentConfig, targets: string[], minify: boolean): Rspack.LightningcssLoaderOptions;
2
+ export declare function getLightningCSSLoaderOptions(config: NormalizedEnvironmentConfig, targets: string[], minify: boolean): Promise<Rspack.LightningcssLoaderOptions>;
3
3
  export declare const normalizeCssLoaderOptions: (options: CSSLoaderOptions, exportOnlyLocals: boolean) => CSSLoaderOptions;
4
4
  export declare const pluginCss: () => RsbuildPlugin;
@@ -1,2 +1,9 @@
1
- import type { RsbuildPlugin } from '../types';
1
+ import type { Externals } from '@rspack/core';
2
+ import { type PackageJson } from '../helpers/packageJson';
3
+ import type { AutoExternal, RsbuildPlugin } from '../types';
4
+ export declare const composeAutoExternalRules: (options: {
5
+ autoExternal?: AutoExternal;
6
+ pkgJson?: PackageJson;
7
+ userExternals?: Externals;
8
+ }) => RegExp[] | undefined;
2
9
  export declare function pluginExternals(): RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginWorker: () => RsbuildPlugin;
@@ -26,8 +26,9 @@ export type ServerStartResult<T> = {
26
26
  export type StartDevServerResult = ServerStartResult<RsbuildDevServer>;
27
27
  export type StartPreviewServerResult = ServerStartResult<RsbuildPreviewServer>;
28
28
  export declare const normalizeUrl: (url: string) => string;
29
- export declare const joinUrlSegments: (s1: string, s2: string) => string;
30
- export declare const stripBase: (path: string, base: string) => string;
29
+ export declare const joinUrlPath: (basePath: string, pathname: string) => string;
30
+ export declare const isUrlPathUnderBase: (pathname: string, base: string) => boolean;
31
+ export declare const removeBasePath: (url: string, base: string) => string;
31
32
  export declare const getRoutes: (context: InternalContext) => Routes;
32
33
  export declare const formatRoutes: (entry: RsbuildEntry, base: string, distPathPrefix: string | undefined, outputStructure: OutputStructure | undefined) => Routes;
33
34
  export declare function printServerURLs({ urls: originalUrls, port, routes, protocol, printUrls, fallbackPathname, trailingLineBreak, originalConfig, logger, }: {
@@ -16,7 +16,7 @@ import type { RsbuildPlugins } from './plugin';
16
16
  import type { RsbuildEntry, RsbuildMode, RsbuildTarget } from './rsbuild';
17
17
  import type { Rspack, RspackRule } from './rspack';
18
18
  import type { Connect, CSSExtractOptions, CSSLoaderModulesOptions, CSSLoaderOptions, HtmlRspackPlugin, LoosePostCSSPlugin, PostCSSLoaderOptions, StyleLoaderOptions } from './thirdParty';
19
- import type { ConfigChain, ConfigChainMergeContext, ConfigChainWithContext, LiteralUnion, MaybePromise, OneOrMany, Optional, TwoLevelReadonly } from './utils';
19
+ import type { ConfigChain, ConfigChainAsyncWithContext, ConfigChainMergeContext, ConfigChainWithContext, LiteralUnion, MaybePromise, OneOrMany, Optional, TwoLevelReadonly } from './utils';
20
20
  export type ToolsSwcConfig = ConfigChain<SwcLoaderOptions>;
21
21
  export type ToolsBundlerChainConfig = OneOrMany<(chain: RspackChain, utils: ModifyBundlerChainUtils) => MaybePromise<void>>;
22
22
  export type ToolsPostCSSContext = {
@@ -39,10 +39,10 @@ export type ToolsHtmlPluginConfig = ConfigChainWithContext<HtmlRspackPlugin.Opti
39
39
  }>;
40
40
  export type RspackMerge = (firstConfiguration: Rspack.Configuration | Rspack.Configuration[], ...configurations: Rspack.Configuration[]) => Rspack.Configuration;
41
41
  export type ModifyRspackConfigUtils = ModifyChainUtils & {
42
- addRules: (rules: RspackRule | RspackRule[]) => void;
43
- appendRules: (rules: RspackRule | RspackRule[]) => void;
44
- prependPlugins: (plugins: Rspack.RspackPluginInstance | Rspack.RspackPluginInstance[]) => void;
45
- appendPlugins: (plugins: Rspack.RspackPluginInstance | Rspack.RspackPluginInstance[]) => void;
42
+ addRules: (rules: OneOrMany<RspackRule>) => void;
43
+ appendRules: (rules: OneOrMany<RspackRule>) => void;
44
+ prependPlugins: (plugins: OneOrMany<Rspack.Plugin>) => void;
45
+ appendPlugins: (plugins: OneOrMany<Rspack.Plugin>) => void;
46
46
  removePlugin: (pluginName: string) => void;
47
47
  mergeConfig: RspackMerge;
48
48
  };
@@ -78,7 +78,7 @@ export type NarrowedRspackConfig = Omit<Rspack.Configuration, 'plugins' | 'modul
78
78
  /**
79
79
  * Plugins to use during compilation.
80
80
  */
81
- plugins: NonNullable<Rspack.Configuration['plugins']>;
81
+ plugins: Rspack.Plugin[];
82
82
  /**
83
83
  * Options for module configuration.
84
84
  */
@@ -1104,6 +1104,41 @@ export type CleanDistPathObject = {
1104
1104
  keep?: RegExp[];
1105
1105
  };
1106
1106
  export type CleanDistPath = boolean | 'auto' | CleanDistPathObject;
1107
+ export type AutoExternalExclude = OneOrMany<string | RegExp>;
1108
+ export type AutoExternal = boolean | {
1109
+ /**
1110
+ * Whether to automatically externalize dependencies of type `dependencies`.
1111
+ * @default true
1112
+ */
1113
+ dependencies?: boolean;
1114
+ /**
1115
+ * Whether to automatically externalize dependencies of type `optionalDependencies`.
1116
+ * @default true
1117
+ */
1118
+ optionalDependencies?: boolean;
1119
+ /**
1120
+ * Whether to automatically externalize dependencies of type `peerDependencies`.
1121
+ * @default true
1122
+ */
1123
+ peerDependencies?: boolean;
1124
+ /**
1125
+ * Whether to automatically externalize dependencies of type `devDependencies`.
1126
+ * @default false
1127
+ */
1128
+ devDependencies?: boolean;
1129
+ /**
1130
+ * Specify the package.json file path(s) used to collect dependencies.
1131
+ * Relative paths are resolved from the Rsbuild root directory.
1132
+ * @default '<root>/package.json'
1133
+ */
1134
+ packageJson?: string | string[];
1135
+ /**
1136
+ * Prevent matched packages from being automatically externalized.
1137
+ * Strings match package names exactly, and regular expressions test package names.
1138
+ * @default undefined
1139
+ */
1140
+ exclude?: AutoExternalExclude;
1141
+ };
1107
1142
  export interface OutputConfig {
1108
1143
  /**
1109
1144
  * Setting the build target for Rsbuild.
@@ -1117,6 +1152,12 @@ export interface OutputConfig {
1117
1152
  * @default undefined
1118
1153
  */
1119
1154
  externals?: Externals;
1155
+ /**
1156
+ * Automatically externalize dependencies declared in the root package.json.
1157
+ * This option will generate `externals` rules for matching dependencies and their subpath imports.
1158
+ * @default false
1159
+ */
1160
+ autoExternal?: AutoExternal;
1120
1161
  /**
1121
1162
  * Set the directory of the output files.
1122
1163
  * Rsbuild will emit files to the specified subdirectory according to the file type.
@@ -1532,7 +1573,7 @@ export interface HtmlConfig {
1532
1573
  * Define the parameters in the HTML template,
1533
1574
  * corresponding to the `templateParameters` config of [html-rspack-plugin](https://github.com/rstackjs/html-rspack-plugin).
1534
1575
  */
1535
- templateParameters?: ConfigChainWithContext<Record<string, unknown>, {
1576
+ templateParameters?: ConfigChainAsyncWithContext<Record<string, unknown>, {
1536
1577
  entryName: string;
1537
1578
  }>;
1538
1579
  /**
@@ -452,7 +452,7 @@ export type RsbuildPluginAPI = Readonly<{
452
452
  */
453
453
  onAfterBuild: PluginHook<OnAfterBuildFn>;
454
454
  /**
455
- * A callback function that is triggered after the compiler instance has been
455
+ * A callback function that is triggered after the Rspack Compiler instance has been
456
456
  * created, but before the build process. This hook is called when you run
457
457
  * `rsbuild.startDevServer`, `rsbuild.build`, or `rsbuild.createCompiler`.
458
458
  */
@@ -488,8 +488,8 @@ export type RsbuildPluginAPI = Readonly<{
488
488
  */
489
489
  onBeforeDevCompile: PluginHook<OnBeforeDevCompileFn>;
490
490
  /**
491
- * A callback function that is triggered after the Compiler instance has been
492
- * created, but before the build process begins. This hook is called when you
491
+ * A callback function that is triggered before the Rspack Compiler instance is
492
+ * created. This hook is called when you
493
493
  * run `rsbuild.startDevServer`, `rsbuild.build`, or `rsbuild.createCompiler`.
494
494
  */
495
495
  onBeforeCreateCompiler: PluginHook<OnBeforeCreateCompilerFn>;
@@ -190,7 +190,7 @@ export type RsbuildInstance = {
190
190
  * Remove the plugin in the specified environment.
191
191
  * If environment is not specified, remove it in all environments.
192
192
  */
193
- environment: string;
193
+ environment?: string;
194
194
  }) => void;
195
195
  /**
196
196
  * Perform a production mode build. This method will generate optimized
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "2.0.6",
3
+ "version": "2.0.8",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.rs",
6
6
  "bugs": {
@@ -36,8 +36,8 @@
36
36
  "types.d.ts"
37
37
  ],
38
38
  "dependencies": {
39
- "@rspack/core": "~2.0.3",
40
- "@swc/helpers": "^0.5.21"
39
+ "@rspack/core": "~2.0.5",
40
+ "@swc/helpers": "^0.5.23"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "core-js": ">= 3.0.0"
@@ -50,20 +50,21 @@
50
50
  "devDependencies": {
51
51
  "@jridgewell/remapping": "^2.3.5",
52
52
  "@jridgewell/trace-mapping": "^0.3.31",
53
- "@rslib/core": "0.21.4",
53
+ "@rslib/core": "0.21.5",
54
54
  "@types/cors": "^2.8.19",
55
- "@types/node": "^24.12.3",
55
+ "@types/node": "^24.12.4",
56
56
  "@types/on-finished": "2.3.5",
57
57
  "@types/range-parser": "^1.2.7",
58
58
  "@types/ws": "^8.18.1",
59
- "browserslist-load-config": "1.0.1",
59
+ "browserslist-load-config": "^1.0.1",
60
60
  "cac": "^7.0.0",
61
61
  "chokidar": "^5.0.0",
62
62
  "connect-next": "4.0.1",
63
+ "core-js": "^3.49.0",
63
64
  "cors": "^2.8.6",
64
65
  "css-loader": "7.1.4",
65
66
  "deepmerge": "^4.3.1",
66
- "dotenv-expand": "13.0.0",
67
+ "dotenv-expand": "^13.0.0",
67
68
  "html-rspack-plugin": "6.1.8",
68
69
  "http-proxy-middleware": "4.0.0",
69
70
  "jiti": "^2.7.0",
@@ -72,12 +73,12 @@
72
73
  "mrmime": "^2.0.1",
73
74
  "on-finished": "2.4.1",
74
75
  "open": "^11.0.0",
75
- "postcss": "^8.5.14",
76
+ "postcss": "^8.5.15",
76
77
  "postcss-load-config": "6.0.1",
77
78
  "postcss-loader": "8.2.1",
78
79
  "prebundle": "1.6.4",
79
80
  "range-parser": "^1.2.1",
80
- "reduce-configs": "^1.1.2",
81
+ "reduce-configs": "^2.0.0",
81
82
  "rslog": "^2.1.1",
82
83
  "rspack-chain": "^2.0.1",
83
84
  "rspack-manifest-plugin": "5.2.1",
@@ -85,10 +86,9 @@
85
86
  "sirv": "^3.0.2",
86
87
  "stacktrace-parser": "^0.1.11",
87
88
  "style-loader": "^4.0.0",
88
- "supports-color": "^10.2.2",
89
89
  "tinyglobby": "^0.2.16",
90
90
  "typescript": "^6.0.3",
91
- "ws": "^8.20.0"
91
+ "ws": "^8.21.0"
92
92
  },
93
93
  "engines": {
94
94
  "node": "^20.19.0 || >=22.12.0"
package/types.d.ts CHANGED
@@ -45,6 +45,15 @@ interface ImportMetaEnv extends Record<ImportMetaEnvFallbackKey, any> {
45
45
  * }
46
46
  */
47
47
  PROD: boolean;
48
+ /**
49
+ * Whether the current build is for the server (SSR).
50
+ * If `output.target` is `'node'`, the value is `true`; otherwise, it is `false`.
51
+ * @example
52
+ * if (import.meta.env.SSR) {
53
+ * console.log('SSR build');
54
+ * }
55
+ */
56
+ SSR: boolean;
48
57
  /**
49
58
  * The value of the `server.base` configuration.
50
59
  * @example
@@ -252,6 +261,39 @@ declare module '*?url' {
252
261
  export default content;
253
262
  }
254
263
 
264
+ /**
265
+ * Imports the file as a Web Worker constructor.
266
+ * @example
267
+ * import MyWorker from './worker.ts?worker';
268
+ * const worker = new MyWorker();
269
+ */
270
+ declare module '*?worker' {
271
+ const WorkerConstructor: {
272
+ new (options?: { name?: string }): Worker;
273
+ };
274
+ export default WorkerConstructor;
275
+ }
276
+
277
+ /**
278
+ * Imports the file as an inline Web Worker constructor.
279
+ * @example
280
+ * import MyWorker from './worker.ts?worker&inline';
281
+ * const worker = new MyWorker();
282
+ */
283
+ declare module '*?worker&inline' {
284
+ const WorkerConstructor: {
285
+ new (options?: { name?: string }): Worker;
286
+ };
287
+ export default WorkerConstructor;
288
+ }
289
+
290
+ declare module '*?inline&worker' {
291
+ const WorkerConstructor: {
292
+ new (options?: { name?: string }): Worker;
293
+ };
294
+ export default WorkerConstructor;
295
+ }
296
+
255
297
  /**
256
298
  * Imports the file content as a base64 encoded string.
257
299
  * @note Only works for static assets and CSS files by default.
File without changes
File without changes