vite 6.0.7 → 6.0.9
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/client/client.mjs +14 -8
- package/dist/node/chunks/{dep-BJP6rrE_.js → dep-BdTvomPN.js} +501 -310
- package/dist/node/chunks/{dep-DB1BmmOk.js → dep-BurZv_3i.js} +63 -66
- package/dist/node/chunks/{dep-Cpceb51t.js → dep-CgjxNdwk.js} +1 -1
- package/dist/node/chunks/{dep-DnSxfB-q.js → dep-DcIXjcop.js} +17 -17
- package/dist/node/cli.js +19 -18
- package/dist/node/index.d.ts +49 -2
- package/dist/node/index.js +4 -3
- package/dist/node-cjs/publicUtils.cjs +5 -5
- package/package.json +5 -5
package/dist/client/client.mjs
CHANGED
@@ -80,7 +80,7 @@ class HMRContext {
|
|
80
80
|
off(event, cb) {
|
81
81
|
const removeFromMap = (map) => {
|
82
82
|
const existing = map.get(event);
|
83
|
-
if (existing ===
|
83
|
+
if (existing === undefined) {
|
84
84
|
return;
|
85
85
|
}
|
86
86
|
const pruned = existing.filter((l) => l !== cb);
|
@@ -206,7 +206,7 @@ class HMRClient {
|
|
206
206
|
return () => {
|
207
207
|
for (const { deps, fn } of qualifiedCallbacks) {
|
208
208
|
fn(
|
209
|
-
deps.map((dep) => dep === acceptedPath ? fetchedModule :
|
209
|
+
deps.map((dep) => dep === acceptedPath ? fetchedModule : undefined)
|
210
210
|
);
|
211
211
|
}
|
212
212
|
const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`;
|
@@ -379,7 +379,7 @@ const normalizeModuleRunnerTransport = (transport) => {
|
|
379
379
|
if (maybePromise) {
|
380
380
|
connectingPromise = maybePromise;
|
381
381
|
await connectingPromise;
|
382
|
-
connectingPromise =
|
382
|
+
connectingPromise = undefined;
|
383
383
|
}
|
384
384
|
isConnected = true;
|
385
385
|
}
|
@@ -748,10 +748,14 @@ const socketHost = `${__HMR_HOSTNAME__ || importMetaUrl.hostname}:${hmrPort || i
|
|
748
748
|
const directSocketHost = __HMR_DIRECT_TARGET__;
|
749
749
|
const base = __BASE__ || "/";
|
750
750
|
const hmrTimeout = __HMR_TIMEOUT__;
|
751
|
+
const wsToken = __WS_TOKEN__;
|
751
752
|
const transport = normalizeModuleRunnerTransport(
|
752
753
|
(() => {
|
753
754
|
let wsTransport = createWebSocketModuleRunnerTransport({
|
754
|
-
createConnection: () => new WebSocket(
|
755
|
+
createConnection: () => new WebSocket(
|
756
|
+
`${socketProtocol}://${socketHost}?token=${wsToken}`,
|
757
|
+
"vite-hmr"
|
758
|
+
),
|
755
759
|
pingInterval: hmrTimeout
|
756
760
|
});
|
757
761
|
return {
|
@@ -762,7 +766,7 @@ const transport = normalizeModuleRunnerTransport(
|
|
762
766
|
if (!hmrPort) {
|
763
767
|
wsTransport = createWebSocketModuleRunnerTransport({
|
764
768
|
createConnection: () => new WebSocket(
|
765
|
-
`${socketProtocol}://${directSocketHost}`,
|
769
|
+
`${socketProtocol}://${directSocketHost}?token=${wsToken}`,
|
766
770
|
"vite-hmr"
|
767
771
|
),
|
768
772
|
pingInterval: hmrTimeout
|
@@ -912,7 +916,9 @@ async function handleMessage(payload) {
|
|
912
916
|
if (hasDocument && !willUnload) {
|
913
917
|
console.log(`[vite] server connection lost. Polling for restart...`);
|
914
918
|
const socket = payload.data.webSocket;
|
915
|
-
|
919
|
+
const url = new URL(socket.url);
|
920
|
+
url.search = "";
|
921
|
+
await waitForSuccessfulPing(url.href);
|
916
922
|
location.reload();
|
917
923
|
}
|
918
924
|
}
|
@@ -1036,7 +1042,7 @@ if ("document" in globalThis) {
|
|
1036
1042
|
sheetsMap.set(el.getAttribute("data-vite-dev-id"), el);
|
1037
1043
|
});
|
1038
1044
|
}
|
1039
|
-
const cspNonce = "document" in globalThis ? document.querySelector("meta[property=csp-nonce]")?.nonce :
|
1045
|
+
const cspNonce = "document" in globalThis ? document.querySelector("meta[property=csp-nonce]")?.nonce : undefined;
|
1040
1046
|
let lastInsertedStyle;
|
1041
1047
|
function updateStyle(id, content) {
|
1042
1048
|
let style = sheetsMap.get(id);
|
@@ -1051,7 +1057,7 @@ function updateStyle(id, content) {
|
|
1051
1057
|
if (!lastInsertedStyle) {
|
1052
1058
|
document.head.appendChild(style);
|
1053
1059
|
setTimeout(() => {
|
1054
|
-
lastInsertedStyle =
|
1060
|
+
lastInsertedStyle = undefined;
|
1055
1061
|
}, 0);
|
1056
1062
|
} else {
|
1057
1063
|
lastInsertedStyle.insertAdjacentElement("afterend", style);
|