@webjsdev/server 0.8.79 → 0.8.80
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/package.json +1 -1
- package/src/dev/helpers.js +21 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webjsdev/server",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.80",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The server for WebJs, a full-stack JavaScript framework built on web components with server-side rendering and no build step. Provides the file-based router, SSR, server actions, route handlers, middleware, and live reload on Node 24+ or Bun.",
|
|
6
6
|
"main": "index.js",
|
package/src/dev/helpers.js
CHANGED
|
@@ -585,6 +585,12 @@ function __webjsReportVisibility(send) {
|
|
|
585
585
|
});
|
|
586
586
|
globalThis.__webjsDevActivity = activity;
|
|
587
587
|
}
|
|
588
|
+
let __webjsFellBack = false;
|
|
589
|
+
function __webjsFallBack() {
|
|
590
|
+
if (__webjsFellBack) return;
|
|
591
|
+
__webjsFellBack = true;
|
|
592
|
+
__webjsDirectEvents();
|
|
593
|
+
}
|
|
588
594
|
try {
|
|
589
595
|
if (typeof SharedWorker !== 'undefined') {
|
|
590
596
|
const w = new SharedWorker(${workerUrl});
|
|
@@ -593,13 +599,25 @@ try {
|
|
|
593
599
|
if (m.type === 'reload') __webjsApplyReload(m.verdict);
|
|
594
600
|
else if (m.type === 'webjs-error') __webjsApplyError(m.data);
|
|
595
601
|
};
|
|
602
|
+
// The worker's SCRIPT can fail to load where the page itself loaded: a
|
|
603
|
+
// host that admits the page on a partitioned cookie, which Chromium does
|
|
604
|
+
// not send with a shared worker's script request from a third-party frame
|
|
605
|
+
// (a private preview embedded in a builder). That is an error event, not a
|
|
606
|
+
// throw, so without this the tab would get no reloads and no error
|
|
607
|
+
// overlay at all. Fall back to this tab's own EventSource, which the page's
|
|
608
|
+
// cookies do reach.
|
|
609
|
+
w.onerror = function () {
|
|
610
|
+
w.port.onmessage = null;
|
|
611
|
+
try { w.port.close(); } catch (_) { /* already gone */ }
|
|
612
|
+
__webjsFallBack();
|
|
613
|
+
};
|
|
596
614
|
w.port.start();
|
|
597
|
-
__webjsReportVisibility(function (msg) { w.port.postMessage(msg); });
|
|
615
|
+
__webjsReportVisibility(function (msg) { if (!__webjsFellBack) w.port.postMessage(msg); });
|
|
598
616
|
} else {
|
|
599
|
-
|
|
617
|
+
__webjsFallBack();
|
|
600
618
|
}
|
|
601
619
|
} catch (_) {
|
|
602
|
-
|
|
620
|
+
__webjsFallBack();
|
|
603
621
|
}
|
|
604
622
|
`;
|
|
605
623
|
}
|