vite 7.0.6 → 7.1.0-beta.1
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/LICENSE.md +53 -79
- package/bin/openChrome.js +68 -0
- package/dist/client/client.mjs +132 -41
- package/dist/node/chunks/{dep-BHkUv4Z8.js → dep-B-hsmHjg.js} +2879 -2629
- package/dist/node/chunks/{dep-Ctugieod.js → dep-BDCsDwBr.js} +2 -1
- package/dist/node/chunks/{dep-BpPEUsd2.js → dep-BeJ5EQ78.js} +126 -129
- package/dist/node/chunks/{dep-Bg9-PZ8I.js → dep-D3dx-MVo.js} +2 -2
- package/dist/node/chunks/{dep-DcjhO6Jt.js → dep-G9cgWHwY.js} +21 -21
- package/dist/node/chunks/{dep-PzytSxfE.js → dep-L2kJu-gJ.js} +2 -2
- package/dist/node/chunks/{dep-BO5GbxpL.js → dep-V5uAjiuB.js} +544 -1074
- package/dist/node/chunks/{dep-Ck0J6tA7.js → dep-bSJfBHhb.js} +2 -2
- package/dist/node/chunks/{dep-DmY5m86w.js → dep-f94b-k0u.js} +10 -10
- package/dist/node/chunks/{dep-CmzxWWz4.js → dep-ll8ogJMK.js} +2 -2
- package/dist/node/cli.js +7 -7
- package/dist/node/constants.js +2 -2
- package/dist/node/index.d.ts +216 -171
- package/dist/node/index.js +3 -3
- package/dist/node/module-runner.d.ts +14 -2
- package/dist/node/module-runner.js +80 -30
- package/package.json +10 -9
- package/types/metadata.d.ts +0 -2
- package/bin/openChrome.applescript +0 -95
package/LICENSE.md
CHANGED
@@ -360,6 +360,38 @@ Repository: lukeed/polka
|
|
360
360
|
|
361
361
|
---------------------------------------
|
362
362
|
|
363
|
+
## @rolldown/pluginutils
|
364
|
+
License: MIT
|
365
|
+
Repository: git+https://github.com/rolldown/rolldown.git
|
366
|
+
|
367
|
+
> MIT License
|
368
|
+
>
|
369
|
+
> Copyright (c) 2024-present VoidZero Inc. & Contributors
|
370
|
+
>
|
371
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
372
|
+
> of this software and associated documentation files (the "Software"), to deal
|
373
|
+
> in the Software without restriction, including without limitation the rights
|
374
|
+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
375
|
+
> copies of the Software, and to permit persons to whom the Software is
|
376
|
+
> furnished to do so, subject to the following conditions:
|
377
|
+
>
|
378
|
+
> The above copyright notice and this permission notice shall be included in all
|
379
|
+
> copies or substantial portions of the Software.
|
380
|
+
>
|
381
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
382
|
+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
383
|
+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
384
|
+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
385
|
+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
386
|
+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
387
|
+
> SOFTWARE.
|
388
|
+
>
|
389
|
+
> end of terms and conditions
|
390
|
+
>
|
391
|
+
> The licenses of externally maintained libraries from which parts of the Software is derived are listed [here](https://github.com/rolldown/rolldown/blob/main/THIRD-PARTY-LICENSE).
|
392
|
+
|
393
|
+
---------------------------------------
|
394
|
+
|
363
395
|
## @rollup/plugin-alias, @rollup/plugin-commonjs, @rollup/plugin-dynamic-import-vars, @rollup/pluginutils
|
364
396
|
License: MIT
|
365
397
|
By: Johannes Stein
|
@@ -1027,35 +1059,6 @@ Repository: jshttp/etag
|
|
1027
1059
|
|
1028
1060
|
---------------------------------------
|
1029
1061
|
|
1030
|
-
## eventemitter3
|
1031
|
-
License: MIT
|
1032
|
-
By: Arnout Kazemier
|
1033
|
-
Repository: git://github.com/primus/eventemitter3.git
|
1034
|
-
|
1035
|
-
> The MIT License (MIT)
|
1036
|
-
>
|
1037
|
-
> Copyright (c) 2014 Arnout Kazemier
|
1038
|
-
>
|
1039
|
-
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
1040
|
-
> of this software and associated documentation files (the "Software"), to deal
|
1041
|
-
> in the Software without restriction, including without limitation the rights
|
1042
|
-
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
1043
|
-
> copies of the Software, and to permit persons to whom the Software is
|
1044
|
-
> furnished to do so, subject to the following conditions:
|
1045
|
-
>
|
1046
|
-
> The above copyright notice and this permission notice shall be included in all
|
1047
|
-
> copies or substantial portions of the Software.
|
1048
|
-
>
|
1049
|
-
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
1050
|
-
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
1051
|
-
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
1052
|
-
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
1053
|
-
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
1054
|
-
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
1055
|
-
> SOFTWARE.
|
1056
|
-
|
1057
|
-
---------------------------------------
|
1058
|
-
|
1059
1062
|
## finalhandler
|
1060
1063
|
License: MIT
|
1061
1064
|
By: Douglas Christopher Wilson
|
@@ -1193,33 +1196,33 @@ Repository: git+https://github.com/sapphi-red/host-validation-middleware.git
|
|
1193
1196
|
|
1194
1197
|
---------------------------------------
|
1195
1198
|
|
1196
|
-
## http-proxy
|
1199
|
+
## http-proxy-3
|
1197
1200
|
License: MIT
|
1198
|
-
By: Charlie Robbins,
|
1199
|
-
Repository: https://github.com/
|
1201
|
+
By: William Stein, Charlie Robbins, Jimb Esser, jcrugzz
|
1202
|
+
Repository: https://github.com/sagemathinc/http-proxy-3.git
|
1200
1203
|
|
1201
|
-
> node-http-
|
1204
|
+
> node-http-3
|
1202
1205
|
>
|
1203
|
-
>
|
1206
|
+
> Copyright (c) 2010-2025 William Stein, Charlie Robbins, Jarrett Cruger & the Contributors.
|
1204
1207
|
>
|
1205
|
-
>
|
1206
|
-
>
|
1207
|
-
>
|
1208
|
-
>
|
1209
|
-
>
|
1210
|
-
>
|
1211
|
-
>
|
1208
|
+
> Permission is hereby granted, free of charge, to any person obtaining
|
1209
|
+
> a copy of this software and associated documentation files (the
|
1210
|
+
> "Software"), to deal in the Software without restriction, including
|
1211
|
+
> without limitation the rights to use, copy, modify, merge, publish,
|
1212
|
+
> distribute, sublicense, and/or sell copies of the Software, and to
|
1213
|
+
> permit persons to whom the Software is furnished to do so, subject to
|
1214
|
+
> the following conditions:
|
1212
1215
|
>
|
1213
|
-
>
|
1214
|
-
>
|
1216
|
+
> The above copyright notice and this permission notice shall be
|
1217
|
+
> included in all copies or substantial portions of the Software.
|
1215
1218
|
>
|
1216
|
-
>
|
1217
|
-
>
|
1218
|
-
>
|
1219
|
-
>
|
1220
|
-
>
|
1221
|
-
>
|
1222
|
-
>
|
1219
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
1220
|
+
> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
1221
|
+
> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
1222
|
+
> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
1223
|
+
> LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
1224
|
+
> OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
1225
|
+
> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1223
1226
|
|
1224
1227
|
---------------------------------------
|
1225
1228
|
|
@@ -2057,35 +2060,6 @@ Repository: git://github.com/paulmillr/readdirp.git
|
|
2057
2060
|
|
2058
2061
|
---------------------------------------
|
2059
2062
|
|
2060
|
-
## requires-port
|
2061
|
-
License: MIT
|
2062
|
-
By: Arnout Kazemier
|
2063
|
-
Repository: https://github.com/unshiftio/requires-port
|
2064
|
-
|
2065
|
-
> The MIT License (MIT)
|
2066
|
-
>
|
2067
|
-
> Copyright (c) 2015 Unshift.io, Arnout Kazemier, the Contributors.
|
2068
|
-
>
|
2069
|
-
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
2070
|
-
> of this software and associated documentation files (the "Software"), to deal
|
2071
|
-
> in the Software without restriction, including without limitation the rights
|
2072
|
-
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
2073
|
-
> copies of the Software, and to permit persons to whom the Software is
|
2074
|
-
> furnished to do so, subject to the following conditions:
|
2075
|
-
>
|
2076
|
-
> The above copyright notice and this permission notice shall be included in all
|
2077
|
-
> copies or substantial portions of the Software.
|
2078
|
-
>
|
2079
|
-
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
2080
|
-
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
2081
|
-
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
2082
|
-
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
2083
|
-
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
2084
|
-
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
2085
|
-
> SOFTWARE.
|
2086
|
-
|
2087
|
-
---------------------------------------
|
2088
|
-
|
2089
2063
|
## resolve.exports, totalist
|
2090
2064
|
License: MIT
|
2091
2065
|
By: Luke Edwards
|
@@ -0,0 +1,68 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2015-present, Facebook, Inc.
|
3
|
+
|
4
|
+
This source code is licensed under the MIT license found in the
|
5
|
+
LICENSE file at
|
6
|
+
https://github.com/facebookincubator/create-react-app/blob/master/LICENSE
|
7
|
+
*/
|
8
|
+
|
9
|
+
/* global Application */
|
10
|
+
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
12
|
+
function run(argv) {
|
13
|
+
const urlToOpen = argv[0]
|
14
|
+
// Allow requested program to be optional, default to Google Chrome
|
15
|
+
const programName = argv[1] ?? 'Google Chrome'
|
16
|
+
|
17
|
+
const app = Application(programName)
|
18
|
+
|
19
|
+
if (app.windows.length === 0) {
|
20
|
+
app.Window().make()
|
21
|
+
}
|
22
|
+
|
23
|
+
// 1: Looking for tab running debugger then,
|
24
|
+
// Reload debugging tab if found, then return
|
25
|
+
const found = lookupTabWithUrl(urlToOpen, app)
|
26
|
+
if (found) {
|
27
|
+
found.targetWindow.activeTabIndex = found.targetTabIndex
|
28
|
+
found.targetTab.reload()
|
29
|
+
found.targetWindow.index = 1
|
30
|
+
app.activate()
|
31
|
+
return
|
32
|
+
}
|
33
|
+
|
34
|
+
// 2: Looking for Empty tab
|
35
|
+
// In case debugging tab was not found
|
36
|
+
// We try to find an empty tab instead
|
37
|
+
const emptyTabFound = lookupTabWithUrl('chrome://newtab/', app)
|
38
|
+
if (emptyTabFound) {
|
39
|
+
emptyTabFound.targetWindow.activeTabIndex = emptyTabFound.targetTabIndex
|
40
|
+
emptyTabFound.targetTab.url = urlToOpen
|
41
|
+
app.activate()
|
42
|
+
return
|
43
|
+
}
|
44
|
+
|
45
|
+
// 3: Create new tab
|
46
|
+
// both debugging and empty tab were not found make a new tab with url
|
47
|
+
const firstWindow = app.windows[0]
|
48
|
+
firstWindow.tabs.push(app.Tab({ url: urlToOpen }))
|
49
|
+
app.activate()
|
50
|
+
}
|
51
|
+
|
52
|
+
/**
|
53
|
+
* Lookup tab with given url
|
54
|
+
*/
|
55
|
+
function lookupTabWithUrl(lookupUrl, app) {
|
56
|
+
const windows = app.windows()
|
57
|
+
for (const window of windows) {
|
58
|
+
for (const [tabIndex, tab] of window.tabs().entries()) {
|
59
|
+
if (tab.url().includes(lookupUrl)) {
|
60
|
+
return {
|
61
|
+
targetTab: tab,
|
62
|
+
targetTabIndex: tabIndex + 1,
|
63
|
+
targetWindow: window,
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
package/dist/client/client.mjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import "@vite/env";
|
2
2
|
|
3
|
-
//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.
|
3
|
+
//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.80.0/node_modules/@oxc-project/runtime/src/helpers/esm/typeof.js
|
4
4
|
function _typeof(o) {
|
5
5
|
"@babel/helpers - typeof";
|
6
6
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
@@ -11,7 +11,7 @@ function _typeof(o) {
|
|
11
11
|
}
|
12
12
|
|
13
13
|
//#endregion
|
14
|
-
//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.
|
14
|
+
//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.80.0/node_modules/@oxc-project/runtime/src/helpers/esm/toPrimitive.js
|
15
15
|
function toPrimitive(t, r) {
|
16
16
|
if ("object" != _typeof(t) || !t) return t;
|
17
17
|
var e = t[Symbol.toPrimitive];
|
@@ -24,14 +24,14 @@ function toPrimitive(t, r) {
|
|
24
24
|
}
|
25
25
|
|
26
26
|
//#endregion
|
27
|
-
//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.
|
27
|
+
//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.80.0/node_modules/@oxc-project/runtime/src/helpers/esm/toPropertyKey.js
|
28
28
|
function toPropertyKey(t) {
|
29
29
|
var i = toPrimitive(t, "string");
|
30
30
|
return "symbol" == _typeof(i) ? i : i + "";
|
31
31
|
}
|
32
32
|
|
33
33
|
//#endregion
|
34
|
-
//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.
|
34
|
+
//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.80.0/node_modules/@oxc-project/runtime/src/helpers/esm/defineProperty.js
|
35
35
|
function _defineProperty(e, r, t) {
|
36
36
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
37
37
|
value: t,
|
@@ -804,7 +804,7 @@ const debounceReload = (time) => {
|
|
804
804
|
}, time);
|
805
805
|
};
|
806
806
|
};
|
807
|
-
const pageReload = debounceReload(
|
807
|
+
const pageReload = debounceReload(20);
|
808
808
|
const hmrClient = new HMRClient({
|
809
809
|
error: (err) => console.error("[vite]", err),
|
810
810
|
debug: (...msg) => console.debug("[vite]", ...msg)
|
@@ -858,7 +858,7 @@ async function handleMessage(payload) {
|
|
858
858
|
}));
|
859
859
|
await hmrClient.notifyListeners("vite:afterUpdate", payload);
|
860
860
|
break;
|
861
|
-
case "custom":
|
861
|
+
case "custom":
|
862
862
|
await hmrClient.notifyListeners(payload.event, payload.data);
|
863
863
|
if (payload.event === "vite:ws:disconnect") {
|
864
864
|
if (hasDocument && !willUnload) {
|
@@ -871,7 +871,6 @@ async function handleMessage(payload) {
|
|
871
871
|
}
|
872
872
|
}
|
873
873
|
break;
|
874
|
-
}
|
875
874
|
case "full-reload":
|
876
875
|
await hmrClient.notifyListeners("vite:beforeFullReload", payload);
|
877
876
|
if (hasDocument) if (payload.path && payload.path.endsWith(".html")) {
|
@@ -885,7 +884,7 @@ async function handleMessage(payload) {
|
|
885
884
|
await hmrClient.notifyListeners("vite:beforePrune", payload);
|
886
885
|
await hmrClient.prunePaths(payload.paths);
|
887
886
|
break;
|
888
|
-
case "error":
|
887
|
+
case "error":
|
889
888
|
await hmrClient.notifyListeners("vite:error", payload);
|
890
889
|
if (hasDocument) {
|
891
890
|
const err = payload.err;
|
@@ -893,7 +892,6 @@ async function handleMessage(payload) {
|
|
893
892
|
else console.error(`[vite] Internal Server Error\n${err.message}\n${err.stack}`);
|
894
893
|
}
|
895
894
|
break;
|
896
|
-
}
|
897
895
|
case "ping": break;
|
898
896
|
default: {
|
899
897
|
const check = payload;
|
@@ -917,47 +915,140 @@ function clearErrorOverlay() {
|
|
917
915
|
function hasErrorOverlay() {
|
918
916
|
return document.querySelectorAll(overlayId).length;
|
919
917
|
}
|
920
|
-
|
921
|
-
|
922
|
-
const
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
918
|
+
function waitForSuccessfulPing(socketUrl) {
|
919
|
+
if (typeof SharedWorker === "undefined") {
|
920
|
+
const visibilityManager = {
|
921
|
+
currentState: document.visibilityState,
|
922
|
+
listeners: /* @__PURE__ */ new Set()
|
923
|
+
};
|
924
|
+
const onVisibilityChange = () => {
|
925
|
+
visibilityManager.currentState = document.visibilityState;
|
926
|
+
for (const listener of visibilityManager.listeners) listener(visibilityManager.currentState);
|
927
|
+
};
|
928
|
+
document.addEventListener("visibilitychange", onVisibilityChange);
|
929
|
+
return waitForSuccessfulPingInternal(socketUrl, visibilityManager);
|
930
|
+
}
|
931
|
+
const blob = new Blob([
|
932
|
+
"\"use strict\";",
|
933
|
+
`const waitForSuccessfulPingInternal = ${waitForSuccessfulPingInternal.toString()};`,
|
934
|
+
`const fn = ${pingWorkerContentMain.toString()};`,
|
935
|
+
`fn(${JSON.stringify(socketUrl)})`
|
936
|
+
], { type: "application/javascript" });
|
937
|
+
const objURL = URL.createObjectURL(blob);
|
938
|
+
const sharedWorker = new SharedWorker(objURL);
|
939
|
+
return new Promise((resolve, reject) => {
|
940
|
+
const onVisibilityChange = () => {
|
941
|
+
sharedWorker.port.postMessage({ visibility: document.visibilityState });
|
942
|
+
};
|
943
|
+
document.addEventListener("visibilitychange", onVisibilityChange);
|
944
|
+
sharedWorker.port.addEventListener("message", (event) => {
|
945
|
+
document.removeEventListener("visibilitychange", onVisibilityChange);
|
946
|
+
sharedWorker.port.close();
|
947
|
+
const data = event.data;
|
948
|
+
if (data.type === "error") {
|
949
|
+
reject(data.error);
|
950
|
+
return;
|
927
951
|
}
|
928
|
-
|
929
|
-
|
930
|
-
|
952
|
+
resolve();
|
953
|
+
});
|
954
|
+
onVisibilityChange();
|
955
|
+
sharedWorker.port.start();
|
956
|
+
});
|
957
|
+
}
|
958
|
+
function pingWorkerContentMain(socketUrl) {
|
959
|
+
self.addEventListener("connect", (_event) => {
|
960
|
+
const event = _event;
|
961
|
+
const port = event.ports[0];
|
962
|
+
if (!socketUrl) {
|
963
|
+
port.postMessage({
|
964
|
+
type: "error",
|
965
|
+
error: /* @__PURE__ */ new Error("socketUrl not found")
|
966
|
+
});
|
967
|
+
return;
|
968
|
+
}
|
969
|
+
const visibilityManager = {
|
970
|
+
currentState: "visible",
|
971
|
+
listeners: /* @__PURE__ */ new Set()
|
972
|
+
};
|
973
|
+
port.addEventListener("message", (event$1) => {
|
974
|
+
const { visibility } = event$1.data;
|
975
|
+
visibilityManager.currentState = visibility;
|
976
|
+
console.debug("new window visibility", visibility);
|
977
|
+
for (const listener of visibilityManager.listeners) listener(visibility);
|
978
|
+
});
|
979
|
+
port.start();
|
980
|
+
console.debug("connected from window");
|
981
|
+
waitForSuccessfulPingInternal(socketUrl, visibilityManager).then(() => {
|
982
|
+
console.debug("ping successful");
|
983
|
+
try {
|
984
|
+
port.postMessage({ type: "success" });
|
985
|
+
} catch (error) {
|
986
|
+
port.postMessage({
|
987
|
+
type: "error",
|
988
|
+
error
|
989
|
+
});
|
931
990
|
}
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
991
|
+
}, (error) => {
|
992
|
+
console.debug("error happened", error);
|
993
|
+
try {
|
994
|
+
port.postMessage({
|
995
|
+
type: "error",
|
996
|
+
error
|
997
|
+
});
|
998
|
+
} catch (error$1) {
|
999
|
+
port.postMessage({
|
1000
|
+
type: "error",
|
1001
|
+
error: error$1
|
1002
|
+
});
|
936
1003
|
}
|
937
|
-
|
938
|
-
|
1004
|
+
});
|
1005
|
+
});
|
1006
|
+
}
|
1007
|
+
async function waitForSuccessfulPingInternal(socketUrl, visibilityManager, ms = 1e3) {
|
1008
|
+
function wait(ms$1) {
|
1009
|
+
return new Promise((resolve) => setTimeout(resolve, ms$1));
|
1010
|
+
}
|
1011
|
+
async function ping() {
|
1012
|
+
try {
|
1013
|
+
const socket = new WebSocket(socketUrl, "vite-ping");
|
1014
|
+
return new Promise((resolve) => {
|
1015
|
+
function onOpen() {
|
1016
|
+
resolve(true);
|
1017
|
+
close();
|
1018
|
+
}
|
1019
|
+
function onError() {
|
1020
|
+
resolve(false);
|
1021
|
+
close();
|
1022
|
+
}
|
1023
|
+
function close() {
|
1024
|
+
socket.removeEventListener("open", onOpen);
|
1025
|
+
socket.removeEventListener("error", onError);
|
1026
|
+
socket.close();
|
1027
|
+
}
|
1028
|
+
socket.addEventListener("open", onOpen);
|
1029
|
+
socket.addEventListener("error", onError);
|
1030
|
+
});
|
1031
|
+
} catch {
|
1032
|
+
return false;
|
1033
|
+
}
|
1034
|
+
}
|
1035
|
+
function waitForWindowShow(visibilityManager$1) {
|
1036
|
+
return new Promise((resolve) => {
|
1037
|
+
const onChange = (newVisibility) => {
|
1038
|
+
if (newVisibility === "visible") {
|
1039
|
+
resolve();
|
1040
|
+
visibilityManager$1.listeners.delete(onChange);
|
1041
|
+
}
|
1042
|
+
};
|
1043
|
+
visibilityManager$1.listeners.add(onChange);
|
939
1044
|
});
|
940
1045
|
}
|
941
1046
|
if (await ping()) return;
|
942
1047
|
await wait(ms);
|
943
|
-
while (true) if (
|
1048
|
+
while (true) if (visibilityManager.currentState === "visible") {
|
944
1049
|
if (await ping()) break;
|
945
1050
|
await wait(ms);
|
946
|
-
} else await waitForWindowShow();
|
947
|
-
}
|
948
|
-
function wait(ms) {
|
949
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
950
|
-
}
|
951
|
-
function waitForWindowShow() {
|
952
|
-
return new Promise((resolve) => {
|
953
|
-
const onChange = async () => {
|
954
|
-
if (document.visibilityState === "visible") {
|
955
|
-
resolve();
|
956
|
-
document.removeEventListener("visibilitychange", onChange);
|
957
|
-
}
|
958
|
-
};
|
959
|
-
document.addEventListener("visibilitychange", onChange);
|
960
|
-
});
|
1051
|
+
} else await waitForWindowShow(visibilityManager);
|
961
1052
|
}
|
962
1053
|
const sheetsMap = /* @__PURE__ */ new Map();
|
963
1054
|
if ("document" in globalThis) document.querySelectorAll("style[data-vite-dev-id]").forEach((el) => {
|