@rsbuild/core 2.1.6 → 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/css-loader/index.js +2 -2
- package/compiled/html-rspack-plugin/index.js +14 -14
- 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 +7 -0
- package/compiled/rslog/package.json +1 -1
- package/dist/711.js +286 -225
- package/dist/http-proxy-middleware.js +8 -8
- package/dist/manifest-plugin.js +6 -6
- 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/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 +6 -6
|
@@ -384,7 +384,7 @@ __webpack_require__.add({
|
|
|
384
384
|
return flat(args), result;
|
|
385
385
|
};
|
|
386
386
|
},
|
|
387
|
-
"../../node_modules/.pnpm/debug@4.4.
|
|
387
|
+
"../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/browser.js" (module, exports, __webpack_require__) {
|
|
388
388
|
let warned;
|
|
389
389
|
function useColors() {
|
|
390
390
|
let m;
|
|
@@ -495,7 +495,7 @@ __webpack_require__.add({
|
|
|
495
495
|
'#FF9933',
|
|
496
496
|
'#FFCC00',
|
|
497
497
|
'#FFCC33'
|
|
498
|
-
], exports.log = console.debug || console.log || (()=>{}), module.exports = __webpack_require__("../../node_modules/.pnpm/debug@4.4.
|
|
498
|
+
], exports.log = console.debug || console.log || (()=>{}), module.exports = __webpack_require__("../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js")(exports);
|
|
499
499
|
let { formatters } = module.exports;
|
|
500
500
|
formatters.j = function(v) {
|
|
501
501
|
try {
|
|
@@ -505,7 +505,7 @@ __webpack_require__.add({
|
|
|
505
505
|
}
|
|
506
506
|
};
|
|
507
507
|
},
|
|
508
|
-
"../../node_modules/.pnpm/debug@4.4.
|
|
508
|
+
"../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
509
509
|
module.exports = function setup(env) {
|
|
510
510
|
function selectColor(namespace) {
|
|
511
511
|
let hash = 0;
|
|
@@ -579,10 +579,10 @@ __webpack_require__.add({
|
|
|
579
579
|
}), createDebug.names = [], createDebug.skips = [], createDebug.formatters = {}, createDebug.selectColor = selectColor, createDebug.enable(createDebug.load()), createDebug;
|
|
580
580
|
};
|
|
581
581
|
},
|
|
582
|
-
"../../node_modules/.pnpm/debug@4.4.
|
|
583
|
-
"u" < typeof process || 'renderer' === process.type || !0 === process.browser || process.__nwjs ? module.exports = __webpack_require__("../../node_modules/.pnpm/debug@4.4.
|
|
582
|
+
"../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
583
|
+
"u" < typeof process || 'renderer' === process.type || !0 === process.browser || process.__nwjs ? module.exports = __webpack_require__("../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/browser.js") : module.exports = __webpack_require__("../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/node.js");
|
|
584
584
|
},
|
|
585
|
-
"../../node_modules/.pnpm/debug@4.4.
|
|
585
|
+
"../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/node.js" (module, exports, __webpack_require__) {
|
|
586
586
|
let tty = __webpack_require__("tty"), util = __webpack_require__("util");
|
|
587
587
|
exports.init = init, exports.log = log, exports.formatArgs = formatArgs, exports.save = save, exports.load = load, exports.useColors = useColors, exports.destroy = util.deprecate(()=>{}, 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'), exports.colors = [
|
|
588
588
|
6,
|
|
@@ -703,7 +703,7 @@ __webpack_require__.add({
|
|
|
703
703
|
exports.inspectOpts = Object.keys(process.env).filter((key)=>/^debug_/i.test(key)).reduce((obj, key)=>{
|
|
704
704
|
let prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k)=>k.toUpperCase()), val = process.env[key];
|
|
705
705
|
return val = !!/^(yes|on|true|enabled)$/i.test(val) || !/^(no|off|false|disabled)$/i.test(val) && ('null' === val ? null : Number(val)), obj[prop] = val, obj;
|
|
706
|
-
}, {}), module.exports = __webpack_require__("../../node_modules/.pnpm/debug@4.4.
|
|
706
|
+
}, {}), module.exports = __webpack_require__("../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js")(exports);
|
|
707
707
|
let { formatters } = module.exports;
|
|
708
708
|
formatters.o = function(v) {
|
|
709
709
|
return this.inspectOpts.colors = this.useColors, util.inspect(v, this.inspectOpts).split('\n').map((str)=>str.trim()).join(' ');
|
|
@@ -2650,7 +2650,7 @@ class errors_HttpProxyMiddlewareError extends Error {
|
|
|
2650
2650
|
function verifyConfig(options) {
|
|
2651
2651
|
if (!options.target && !options.router) throw new errors_HttpProxyMiddlewareError('[HPM] Missing "target" option. Example: {target: "http://www.example.org"}', 'ERR_CONFIG_FACTORY_TARGET_MISSING');
|
|
2652
2652
|
}
|
|
2653
|
-
let Debug = __webpack_require__("../../node_modules/.pnpm/debug@4.4.
|
|
2653
|
+
let Debug = __webpack_require__("../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js")('http-proxy-middleware'), debug = Debug.extend('debug-proxy-errors-plugin'), BODY_PARSER_ERROR_MESSAGE = `[HPM] Connection reset (ECONNRESET) detected with non-empty "req.body" [ERR_HPM.GH40].
|
|
2654
2654
|
|
|
2655
2655
|
This usually means that the POST request body (req.body) was already parsed before reaching the proxy.
|
|
2656
2656
|
When bodyParser runs first, it consumes the request stream, leaving the proxy unable to forward the body data to the target server.
|
package/dist/manifest-plugin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __webpack_require__ } from "./1~rslib-runtime.js";
|
|
2
2
|
import "./711.js";
|
|
3
3
|
__webpack_require__.add({
|
|
4
|
-
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.
|
|
4
|
+
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.5/node_modules/rspack-manifest-plugin/dist/helpers.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
5
5
|
exports.transformFiles = exports.reduceChunk = exports.reduceAssets = exports.generateManifest = void 0;
|
|
6
6
|
let node_path_1 = __webpack_require__("node:path?435f");
|
|
7
7
|
exports.generateManifest = (compilation, files, { generate, seed = {} })=>generate ? generate(seed, files, Array.from(compilation.entrypoints.entries()).reduce((e, [name, entrypoint])=>Object.assign(e, {
|
|
@@ -61,9 +61,9 @@ __webpack_require__.add({
|
|
|
61
61
|
'sort'
|
|
62
62
|
].filter((fname)=>!!options[fname]).reduce((prev, fname)=>prev[fname](options[fname]), files).map(standardizeFilePaths);
|
|
63
63
|
},
|
|
64
|
-
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.
|
|
64
|
+
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.5/node_modules/rspack-manifest-plugin/dist/hooks.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
65
65
|
exports.getCompilerHooks = exports.emitHook = exports.beforeRunHook = void 0;
|
|
66
|
-
let node_fs_1 = __webpack_require__("node:fs?9592"), node_path_1 = __webpack_require__("node:path?435f"), lite_tapable_1 = __webpack_require__("../../node_modules/.pnpm/@rspack+lite-tapable@1.1.2/node_modules/@rspack/lite-tapable/dist/index.cjs"), helpers_1 = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.
|
|
66
|
+
let node_fs_1 = __webpack_require__("node:fs?9592"), node_path_1 = __webpack_require__("node:path?435f"), lite_tapable_1 = __webpack_require__("../../node_modules/.pnpm/@rspack+lite-tapable@1.1.2/node_modules/@rspack/lite-tapable/dist/index.cjs"), helpers_1 = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.5/node_modules/rspack-manifest-plugin/dist/helpers.js"), compilerHookMap = new WeakMap(), getCompilerHooks = (compiler)=>{
|
|
67
67
|
let hooks = compilerHookMap.get(compiler);
|
|
68
68
|
return void 0 === hooks && (hooks = {
|
|
69
69
|
afterEmit: new lite_tapable_1.SyncWaterfallHook([
|
|
@@ -112,9 +112,9 @@ __webpack_require__.add({
|
|
|
112
112
|
getCompilerHooks(compiler).afterEmit.call(manifest);
|
|
113
113
|
};
|
|
114
114
|
},
|
|
115
|
-
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.
|
|
115
|
+
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.5/node_modules/rspack-manifest-plugin/dist/index.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
116
116
|
exports.RspackManifestPlugin = void 0;
|
|
117
|
-
let node_path_1 = __webpack_require__("node:path?435f"), hooks_1 = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.
|
|
117
|
+
let node_path_1 = __webpack_require__("node:path?435f"), hooks_1 = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.5/node_modules/rspack-manifest-plugin/dist/hooks.js"), emitCountMap = new Map(), defaults = {
|
|
118
118
|
assetHookStage: 1 / 0,
|
|
119
119
|
basePath: '',
|
|
120
120
|
fileName: 'manifest.json',
|
|
@@ -688,5 +688,5 @@ __webpack_require__.add({
|
|
|
688
688
|
});
|
|
689
689
|
}
|
|
690
690
|
});
|
|
691
|
-
var RspackManifestPlugin = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.
|
|
691
|
+
var RspackManifestPlugin = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.5/node_modules/rspack-manifest-plugin/dist/index.js").RspackManifestPlugin;
|
|
692
692
|
export { RspackManifestPlugin };
|
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,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;
|