@rsbuild/core 2.0.0-rc.0 → 2.0.0-rc.2
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/connect-next/package.json +1 -1
- package/compiled/css-loader/index.js +2 -2
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/http-proxy-middleware/index.d.ts +180 -386
- package/compiled/http-proxy-middleware/package.json +1 -1
- package/compiled/postcss/index.js +1 -1
- package/compiled/postcss/lib/at-rule.d.ts +0 -1
- package/compiled/postcss/lib/comment.d.ts +0 -1
- package/compiled/postcss/lib/container.d.ts +1 -6
- package/compiled/postcss/lib/css-syntax-error.d.ts +0 -1
- package/compiled/postcss/lib/declaration.d.ts +0 -1
- package/compiled/postcss/lib/document.d.ts +0 -1
- package/compiled/postcss/lib/fromJSON.d.ts +1 -1
- package/compiled/postcss/lib/input.d.ts +0 -1
- package/compiled/postcss/lib/lazy-result.d.ts +3 -4
- package/compiled/postcss/lib/list.d.ts +1 -1
- package/compiled/postcss/lib/no-work-result.d.ts +0 -1
- package/compiled/postcss/lib/node.d.ts +0 -1
- package/compiled/postcss/lib/parse.d.ts +1 -1
- package/compiled/postcss/lib/postcss.d.ts +1 -3
- package/compiled/postcss/lib/previous-map.d.ts +0 -1
- package/compiled/postcss/lib/processor.d.ts +0 -1
- package/compiled/postcss/lib/result.d.ts +0 -1
- package/compiled/postcss/lib/root.d.ts +0 -1
- package/compiled/postcss/lib/rule.d.ts +12 -12
- package/compiled/postcss/lib/stringifier.d.ts +0 -1
- package/compiled/postcss/lib/stringify.d.ts +1 -1
- package/compiled/postcss/lib/warning.d.ts +0 -1
- package/compiled/postcss/license +1 -1
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rspack-chain/package.json +1 -1
- package/compiled/rspack-chain/types/index.d.ts +38 -115
- package/dist/1~rslib-runtime.js +1 -1
- package/dist/{552.js → 753.js} +143 -196
- package/dist/client/hmr.js +23 -10
- package/dist/connect-next.js +636 -26
- package/dist/connect-next.js.LICENSE.txt +14 -1
- package/dist/http-proxy-middleware.js +1169 -1226
- package/dist/http-proxy-middleware.js.LICENSE.txt +0 -35
- package/dist/index.js +1 -1
- package/dist/launch-editor-middleware.js +6 -6
- package/dist/manifest-plugin.js +8 -8
- package/dist/memfs.js +16 -56
- package/dist/tinyglobby.js +279 -127
- package/dist/ws.js +2 -2
- package/dist-types/client/hmr.d.ts +1 -1
- package/dist-types/helpers/index.d.ts +1 -1
- package/dist-types/helpers/url.d.ts +1 -1
- package/dist-types/pluginHelper.d.ts +1 -8
- package/dist-types/server/devServer.d.ts +9 -7
- package/dist-types/server/socketServer.d.ts +16 -4
- package/dist-types/types/config.d.ts +9 -3
- package/dist-types/types/rspack.d.ts +1 -1
- package/package.json +11 -11
- package/dist/debug.js +0 -503
- package/dist-types/plugins/esm.d.ts +0 -2
- /package/dist/{552.js.LICENSE.txt → 753.js.LICENSE.txt} +0 -0
package/dist/client/hmr.js
CHANGED
|
@@ -25,18 +25,19 @@ const registerOverlay = (createFn, clearFn)=>{
|
|
|
25
25
|
createOverlay = createFn;
|
|
26
26
|
clearOverlay = clearFn;
|
|
27
27
|
};
|
|
28
|
-
function init(token, config, serverHost, serverPort, liveReload, browserLogs, logLevel) {
|
|
28
|
+
function init(token, config, serverHost, serverPort, serverBase, liveReload, browserLogs, logLevel) {
|
|
29
29
|
logger.level = logLevel;
|
|
30
30
|
const queuedMessages = [];
|
|
31
31
|
const clientErrors = [];
|
|
32
32
|
const customListenersMap = new Map();
|
|
33
33
|
let lastHash;
|
|
34
34
|
let hasBuildErrors = false;
|
|
35
|
+
const base = serverBase.endsWith('/') ? serverBase : `${serverBase}/`;
|
|
35
36
|
function formatURL(fallback) {
|
|
36
|
-
const { location } = self;
|
|
37
|
-
const hostname = (fallback ? serverHost : config.host) ||
|
|
38
|
-
const port = (fallback ? serverPort : config.port) ||
|
|
39
|
-
const protocol = config.protocol || ('https:' ===
|
|
37
|
+
const { location: location1 } = self;
|
|
38
|
+
const hostname = (fallback ? serverHost : config.host) || location1.hostname;
|
|
39
|
+
const port = (fallback ? serverPort : config.port) || location1.port;
|
|
40
|
+
const protocol = config.protocol || ('https:' === location1.protocol ? 'wss' : 'ws');
|
|
40
41
|
const pathname = config.path;
|
|
41
42
|
if ("u" > typeof URL) {
|
|
42
43
|
const url = new URL('http://localhost');
|
|
@@ -85,7 +86,7 @@ function init(token, config, serverHost, serverPort, liveReload, browserLogs, lo
|
|
|
85
86
|
const forcedReload = err || !updatedModules;
|
|
86
87
|
if (forcedReload) {
|
|
87
88
|
if (err) logger.error('[rsbuild] HMR update failed, performing full reload:', err);
|
|
88
|
-
|
|
89
|
+
fullReload();
|
|
89
90
|
return;
|
|
90
91
|
}
|
|
91
92
|
tryApplyUpdates();
|
|
@@ -101,7 +102,7 @@ function init(token, config, serverHost, serverPort, liveReload, browserLogs, lo
|
|
|
101
102
|
});
|
|
102
103
|
return;
|
|
103
104
|
}
|
|
104
|
-
|
|
105
|
+
fullReload();
|
|
105
106
|
}
|
|
106
107
|
let socket = null;
|
|
107
108
|
let reconnectCount = 0;
|
|
@@ -133,8 +134,11 @@ function init(token, config, serverHost, serverPort, liveReload, browserLogs, lo
|
|
|
133
134
|
case 'ok':
|
|
134
135
|
handleSuccess();
|
|
135
136
|
break;
|
|
137
|
+
case 'full-reload':
|
|
138
|
+
fullReload(message.data);
|
|
139
|
+
break;
|
|
136
140
|
case 'static-changed':
|
|
137
|
-
|
|
141
|
+
fullReload();
|
|
138
142
|
break;
|
|
139
143
|
case 'warnings':
|
|
140
144
|
handleWarnings(message.data);
|
|
@@ -223,8 +227,17 @@ function init(token, config, serverHost, serverPort, liveReload, browserLogs, lo
|
|
|
223
227
|
socket.removeEventListener('error', onSocketError);
|
|
224
228
|
}
|
|
225
229
|
}
|
|
226
|
-
function
|
|
227
|
-
if (liveReload)
|
|
230
|
+
function fullReload(data) {
|
|
231
|
+
if (!liveReload) return;
|
|
232
|
+
const path = null == data ? void 0 : data.path;
|
|
233
|
+
if (null == path ? void 0 : path.endsWith('.html')) {
|
|
234
|
+
const pathname = decodeURI(location.pathname);
|
|
235
|
+
const targetPath = base + path.slice(1);
|
|
236
|
+
const targetPathWithoutExt = targetPath.slice(0, -5);
|
|
237
|
+
if (pathname === targetPath || pathname === targetPathWithoutExt || pathname.endsWith('/') && `${pathname}index.html` === targetPath) location.reload();
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
location.reload();
|
|
228
241
|
}
|
|
229
242
|
if (browserLogs && "u" > typeof window) {
|
|
230
243
|
window.addEventListener('error', ({ message, error })=>{
|