@rsbuild/core 1.5.12 → 1.5.13
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/@jridgewell/remapping/index.js +5 -848
- package/compiled/@jridgewell/trace-mapping/index.d.ts +194 -0
- package/compiled/@jridgewell/trace-mapping/index.js +1408 -0
- package/compiled/@jridgewell/trace-mapping/license +19 -0
- package/compiled/@jridgewell/trace-mapping/package.json +1 -0
- package/compiled/css-loader/index.js +22 -22
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/launch-editor-middleware/index.js +3 -3
- package/compiled/memfs/index.d.ts +6 -1
- package/compiled/memfs/index.js +662 -636
- package/compiled/memfs/package.json +1 -1
- package/compiled/postcss/index.js +4 -4
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rspack-manifest-plugin/index.js +4 -4
- package/dist/client/hmr.js +58 -19
- package/dist/index.cjs +426 -373
- package/dist/index.js +420 -369
- package/dist-types/configChain.d.ts +0 -4
- package/dist-types/server/assets-middleware/getFileFromUrl.d.ts +9 -0
- package/dist-types/server/assets-middleware/index.d.ts +48 -0
- package/dist-types/server/assets-middleware/middleware.d.ts +3 -0
- package/dist-types/server/assets-middleware/setupOutputFileSystem.d.ts +4 -0
- package/dist-types/server/assets-middleware/setupWriteToDisk.d.ts +15 -0
- package/dist-types/server/browserLogs.d.ts +7 -0
- package/dist-types/server/{compilationManager.d.ts → buildManager.d.ts} +11 -11
- package/dist-types/server/devMiddlewares.d.ts +2 -2
- package/dist-types/server/devServer.d.ts +3 -3
- package/dist-types/server/middlewares.d.ts +3 -3
- package/dist-types/server/socketServer.d.ts +22 -11
- package/dist-types/server/watchFiles.d.ts +2 -2
- package/dist-types/types/config.d.ts +13 -6
- package/dist-types/types/context.d.ts +14 -4
- package/dist-types/types/plugin.d.ts +1 -1
- package/dist-types/types/rsbuild.d.ts +8 -1
- package/package.json +5 -3
- package/dist-types/dev-middleware/index.d.ts +0 -53
- package/dist-types/dev-middleware/middleware.d.ts +0 -3
- package/dist-types/dev-middleware/utils/getFilenameFromUrl.d.ts +0 -7
- package/dist-types/dev-middleware/utils/getPaths.d.ts +0 -7
- package/dist-types/dev-middleware/utils/ready.d.ts +0 -2
- package/dist-types/dev-middleware/utils/setupHooks.d.ts +0 -3
- package/dist-types/dev-middleware/utils/setupOutputFileSystem.d.ts +0 -3
- package/dist-types/dev-middleware/utils/setupWriteToDisk.d.ts +0 -7
- package/dist-types/server/compilationMiddleware.d.ts +0 -36
- /package/dist-types/{dev-middleware/utils → server/assets-middleware}/escapeHtml.d.ts +0 -0
- /package/dist-types/{dev-middleware/utils → server/assets-middleware}/memorize.d.ts +0 -0
- /package/dist-types/{dev-middleware/utils → server/assets-middleware}/parseTokenList.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"memfs","author":{"name":"streamich","url":"https://github.com/streamich"},"version":"4.
|
|
1
|
+
{"name":"memfs","author":{"name":"streamich","url":"https://github.com/streamich"},"version":"4.47.0","funding":{"type":"github","url":"https://github.com/sponsors/streamich"},"license":"Apache-2.0","types":"index.d.ts","type":"commonjs"}
|
|
@@ -419,7 +419,7 @@
|
|
|
419
419
|
},
|
|
420
420
|
337: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
421
421
|
"use strict";
|
|
422
|
-
let pico = __nccwpck_require__(
|
|
422
|
+
let pico = __nccwpck_require__(31);
|
|
423
423
|
let terminalHighlight = __nccwpck_require__(978);
|
|
424
424
|
class CssSyntaxError extends Error {
|
|
425
425
|
constructor(message, line, column, source, file, plugin) {
|
|
@@ -3509,7 +3509,7 @@
|
|
|
3509
3509
|
},
|
|
3510
3510
|
978: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
3511
3511
|
"use strict";
|
|
3512
|
-
let pico = __nccwpck_require__(
|
|
3512
|
+
let pico = __nccwpck_require__(31);
|
|
3513
3513
|
let tokenizer = __nccwpck_require__(410);
|
|
3514
3514
|
let Input;
|
|
3515
3515
|
function registerInput(dependant) {
|
|
@@ -5991,9 +5991,9 @@
|
|
|
5991
5991
|
exports.SourceMapConsumer = __nccwpck_require__(313).SourceMapConsumer;
|
|
5992
5992
|
exports.SourceNode = __nccwpck_require__(276).SourceNode;
|
|
5993
5993
|
},
|
|
5994
|
-
|
|
5994
|
+
31: (module) => {
|
|
5995
5995
|
"use strict";
|
|
5996
|
-
module.exports = require("../picocolors");
|
|
5996
|
+
module.exports = require("../picocolors/index.js");
|
|
5997
5997
|
},
|
|
5998
5998
|
896: (module) => {
|
|
5999
5999
|
"use strict";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
"use strict";
|
|
3
3
|
var __webpack_modules__ = {
|
|
4
|
-
|
|
5
|
-
module.exports = __nccwpck_require__(
|
|
4
|
+
720: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
5
|
+
module.exports = __nccwpck_require__(702)["default"];
|
|
6
6
|
},
|
|
7
|
-
|
|
7
|
+
702: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
8
8
|
var __webpack_unused_export__;
|
|
9
9
|
__webpack_unused_export__ = { value: true };
|
|
10
10
|
exports["default"] = loader;
|
|
11
11
|
var _nodePath = _interopRequireDefault(__nccwpck_require__(760));
|
|
12
|
-
var _utils = __nccwpck_require__(
|
|
12
|
+
var _utils = __nccwpck_require__(951);
|
|
13
13
|
function _interopRequireDefault(e) {
|
|
14
14
|
return e && e.__esModule ? e : { default: e };
|
|
15
15
|
}
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
callback(null, result.css, map, { ast });
|
|
180
180
|
}
|
|
181
181
|
},
|
|
182
|
-
|
|
182
|
+
951: (module, exports, __nccwpck_require__) => {
|
|
183
183
|
module = __nccwpck_require__.nmd(module);
|
|
184
184
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
185
185
|
exports.exec = exec;
|
|
@@ -715,6 +715,6 @@
|
|
|
715
715
|
})();
|
|
716
716
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
717
717
|
__nccwpck_require__.ab = __dirname + "/";
|
|
718
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
718
|
+
var __webpack_exports__ = __nccwpck_require__(720);
|
|
719
719
|
module.exports = __webpack_exports__;
|
|
720
720
|
})();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
"use strict";
|
|
3
3
|
var __webpack_modules__ = {
|
|
4
|
-
|
|
4
|
+
161: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.transformFiles =
|
|
7
7
|
exports.reduceChunk =
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
.map(standardizeFilePaths);
|
|
121
121
|
exports.transformFiles = transformFiles;
|
|
122
122
|
},
|
|
123
|
-
|
|
123
|
+
308: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
124
124
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
125
125
|
exports.normalModuleLoaderHook =
|
|
126
126
|
exports.getCompilerHooks =
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
const node_fs_1 = __nccwpck_require__(24);
|
|
131
131
|
const node_path_1 = __nccwpck_require__(760);
|
|
132
132
|
const lite_tapable_1 = __nccwpck_require__(408);
|
|
133
|
-
const helpers_1 = __nccwpck_require__(
|
|
133
|
+
const helpers_1 = __nccwpck_require__(161);
|
|
134
134
|
const compilerHookMap = new WeakMap();
|
|
135
135
|
const getCompilerHooks = (compiler) => {
|
|
136
136
|
let hooks = compilerHookMap.get(compiler);
|
|
@@ -313,7 +313,7 @@
|
|
|
313
313
|
exports.getCompilerHooks =
|
|
314
314
|
void 0;
|
|
315
315
|
const node_path_1 = __nccwpck_require__(760);
|
|
316
|
-
const hooks_1 = __nccwpck_require__(
|
|
316
|
+
const hooks_1 = __nccwpck_require__(308);
|
|
317
317
|
Object.defineProperty(exports, "getCompilerHooks", {
|
|
318
318
|
enumerable: true,
|
|
319
319
|
get: function () {
|
package/dist/client/hmr.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
const config = RSBUILD_CLIENT_CONFIG;
|
|
2
2
|
const serverHost = RSBUILD_SERVER_HOST;
|
|
3
3
|
const serverPort = RSBUILD_SERVER_PORT;
|
|
4
|
+
const queuedMessages = [];
|
|
5
|
+
let lastHash;
|
|
6
|
+
let hasBuildErrors = false;
|
|
4
7
|
function formatURL(fallback) {
|
|
5
8
|
const { location } = self;
|
|
6
9
|
const hostname = (fallback ? serverHost : config.host) || location.hostname;
|
|
@@ -19,10 +22,9 @@ function formatURL(fallback) {
|
|
|
19
22
|
const colon = -1 === protocol.indexOf(':') ? ':' : '';
|
|
20
23
|
return `${protocol}${colon}//${hostname}:${port}${pathname}?token=${RSBUILD_WEB_SOCKET_TOKEN}`;
|
|
21
24
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (console.clear && hasCompileErrors) console.clear();
|
|
25
|
+
function clearBuildErrors() {
|
|
26
|
+
if (console.clear && hasBuildErrors) console.clear();
|
|
27
|
+
hasBuildErrors = false;
|
|
26
28
|
}
|
|
27
29
|
let createOverlay;
|
|
28
30
|
let clearOverlay;
|
|
@@ -31,14 +33,12 @@ const registerOverlay = (createFn, clearFn)=>{
|
|
|
31
33
|
clearOverlay = clearFn;
|
|
32
34
|
};
|
|
33
35
|
function handleSuccess() {
|
|
34
|
-
|
|
35
|
-
hasCompileErrors = false;
|
|
36
|
+
clearBuildErrors();
|
|
36
37
|
tryApplyUpdates();
|
|
37
38
|
}
|
|
38
39
|
function handleWarnings(param) {
|
|
39
40
|
let { text } = param;
|
|
40
|
-
|
|
41
|
-
hasCompileErrors = false;
|
|
41
|
+
clearBuildErrors();
|
|
42
42
|
for(let i = 0; i < text.length; i++){
|
|
43
43
|
if (5 === i) {
|
|
44
44
|
console.warn('[rsbuild] Additional warnings detected. View complete log in terminal for details.');
|
|
@@ -50,12 +50,12 @@ function handleWarnings(param) {
|
|
|
50
50
|
}
|
|
51
51
|
function handleErrors(param) {
|
|
52
52
|
let { text, html } = param;
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
clearBuildErrors();
|
|
54
|
+
hasBuildErrors = true;
|
|
55
55
|
for (const error of text)console.error(error);
|
|
56
56
|
if (createOverlay) createOverlay(html);
|
|
57
57
|
}
|
|
58
|
-
const
|
|
58
|
+
const shouldUpdate = ()=>lastHash !== __webpack_hash__;
|
|
59
59
|
const handleApplyUpdates = (err, updatedModules)=>{
|
|
60
60
|
const forcedReload = err || !updatedModules;
|
|
61
61
|
if (forcedReload) {
|
|
@@ -66,7 +66,7 @@ const handleApplyUpdates = (err, updatedModules)=>{
|
|
|
66
66
|
tryApplyUpdates();
|
|
67
67
|
};
|
|
68
68
|
function tryApplyUpdates() {
|
|
69
|
-
if (!
|
|
69
|
+
if (!shouldUpdate()) return;
|
|
70
70
|
if (import.meta.webpackHot) {
|
|
71
71
|
if ('idle' !== import.meta.webpackHot.status()) return;
|
|
72
72
|
import.meta.webpackHot.check(true).then((updatedModules)=>{
|
|
@@ -81,21 +81,29 @@ function tryApplyUpdates() {
|
|
|
81
81
|
let socket = null;
|
|
82
82
|
let reconnectCount = 0;
|
|
83
83
|
let pingIntervalId;
|
|
84
|
+
const isSocketReady = ()=>socket && socket.readyState === socket.OPEN;
|
|
85
|
+
const socketSend = (data)=>{
|
|
86
|
+
if (isSocketReady()) socket.send(JSON.stringify(data));
|
|
87
|
+
};
|
|
84
88
|
function onOpen() {
|
|
85
89
|
console.info('[rsbuild] WebSocket connected.');
|
|
86
90
|
reconnectCount = 0;
|
|
87
91
|
pingIntervalId = setInterval(()=>{
|
|
88
|
-
|
|
92
|
+
socketSend({
|
|
89
93
|
type: 'ping'
|
|
90
|
-
})
|
|
94
|
+
});
|
|
91
95
|
}, 30000);
|
|
96
|
+
if (queuedMessages.length) {
|
|
97
|
+
queuedMessages.forEach(socketSend);
|
|
98
|
+
queuedMessages.length = 0;
|
|
99
|
+
}
|
|
92
100
|
}
|
|
93
101
|
function onMessage(e) {
|
|
94
102
|
const message = JSON.parse(e.data);
|
|
95
103
|
switch(message.type){
|
|
96
104
|
case 'hash':
|
|
97
|
-
|
|
98
|
-
if (clearOverlay &&
|
|
105
|
+
lastHash = message.data;
|
|
106
|
+
if (clearOverlay && shouldUpdate()) clearOverlay();
|
|
99
107
|
break;
|
|
100
108
|
case 'ok':
|
|
101
109
|
handleSuccess();
|
|
@@ -123,7 +131,7 @@ function onClose() {
|
|
|
123
131
|
reconnectCount++;
|
|
124
132
|
setTimeout(connect, 1000 * 1.5 ** reconnectCount);
|
|
125
133
|
}
|
|
126
|
-
function
|
|
134
|
+
function onSocketError() {
|
|
127
135
|
if (formatURL() !== formatURL(true)) {
|
|
128
136
|
console.error('[rsbuild] WebSocket connection failed. Trying direct connection fallback.');
|
|
129
137
|
removeListeners();
|
|
@@ -131,6 +139,30 @@ function onError() {
|
|
|
131
139
|
connect(true);
|
|
132
140
|
}
|
|
133
141
|
}
|
|
142
|
+
function sendError(message, stack) {
|
|
143
|
+
const messageInfo = {
|
|
144
|
+
type: 'client-error',
|
|
145
|
+
message,
|
|
146
|
+
stack
|
|
147
|
+
};
|
|
148
|
+
if (isSocketReady()) socketSend(messageInfo);
|
|
149
|
+
else queuedMessages.push(messageInfo);
|
|
150
|
+
}
|
|
151
|
+
function onUnhandledRejection(param) {
|
|
152
|
+
let { reason } = param;
|
|
153
|
+
let message;
|
|
154
|
+
let stack;
|
|
155
|
+
if (reason instanceof Error) {
|
|
156
|
+
message = reason.name ? `${reason.name}: ${reason.message}` : reason.message;
|
|
157
|
+
stack = reason.stack;
|
|
158
|
+
} else if ('string' == typeof reason) message = reason;
|
|
159
|
+
else try {
|
|
160
|
+
message = JSON.stringify(reason);
|
|
161
|
+
} catch (_) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
sendError(`Uncaught (in promise) ${message}`, stack);
|
|
165
|
+
}
|
|
134
166
|
function connect() {
|
|
135
167
|
let fallback = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : false;
|
|
136
168
|
if (0 === reconnectCount) console.info('[rsbuild] WebSocket connecting...');
|
|
@@ -139,7 +171,7 @@ function connect() {
|
|
|
139
171
|
socket.addEventListener('open', onOpen);
|
|
140
172
|
socket.addEventListener('close', onClose);
|
|
141
173
|
socket.addEventListener('message', onMessage);
|
|
142
|
-
if (!fallback) socket.addEventListener('error',
|
|
174
|
+
if (!fallback) socket.addEventListener('error', onSocketError);
|
|
143
175
|
}
|
|
144
176
|
function removeListeners() {
|
|
145
177
|
clearInterval(pingIntervalId);
|
|
@@ -147,11 +179,18 @@ function removeListeners() {
|
|
|
147
179
|
socket.removeEventListener('open', onOpen);
|
|
148
180
|
socket.removeEventListener('close', onClose);
|
|
149
181
|
socket.removeEventListener('message', onMessage);
|
|
150
|
-
socket.removeEventListener('error',
|
|
182
|
+
socket.removeEventListener('error', onSocketError);
|
|
151
183
|
}
|
|
152
184
|
}
|
|
153
185
|
function reloadPage() {
|
|
154
186
|
if (RSBUILD_DEV_LIVE_RELOAD) window.location.reload();
|
|
155
187
|
}
|
|
188
|
+
if (RSBUILD_DEV_BROWSER_LOGS && 'undefined' != typeof window) {
|
|
189
|
+
window.addEventListener('error', (param)=>{
|
|
190
|
+
let { message, error } = param;
|
|
191
|
+
sendError(message, error instanceof Error ? error.stack : void 0);
|
|
192
|
+
});
|
|
193
|
+
window.addEventListener('unhandledrejection', onUnhandledRejection);
|
|
194
|
+
}
|
|
156
195
|
connect();
|
|
157
196
|
export { registerOverlay };
|