treefmt: apply prettier
Pure `nix fmt` output from the commit before this one — no hand edits. 203 files: 52 md, 42 tsx, 32 js, 32 css, 21 ts, 13 html, 8 json, 3 mjs. Reproduce with `nix develop -c nix fmt` on the parent commit; the result should be byte-identical to this tree. None of the 13 `.prettierignore` entries appears here — verified by intersecting the changed-file list against the ignore file, with a control proving the intersection finds a match when one exists.
This commit is contained in:
parent
5d24bedd60
commit
39b95c2ede
203 changed files with 10090 additions and 6085 deletions
|
|
@ -33,8 +33,11 @@ const allPorts = new Set();
|
|||
const PING_INTERVAL_MS = 30_000;
|
||||
setInterval(() => {
|
||||
for (const port of allPorts) {
|
||||
try { port.postMessage({ kind: 'ping' }); }
|
||||
catch { /* port dead — left in the Set; see onconnect's closing comment */ }
|
||||
try {
|
||||
port.postMessage({ kind: "ping" });
|
||||
} catch {
|
||||
/* port dead — left in the Set; see onconnect's closing comment */
|
||||
}
|
||||
}
|
||||
}, PING_INTERVAL_MS);
|
||||
|
||||
|
|
@ -45,20 +48,29 @@ function getOrCreateStream(url) {
|
|||
entry = { es, url, ports: new Set() };
|
||||
es.onopen = () => {
|
||||
for (const port of entry.ports) {
|
||||
try { port.postMessage({ kind: 'open', url }); }
|
||||
catch { /* port dead — cleanup happens on unsubscribe / next subscribe */ }
|
||||
try {
|
||||
port.postMessage({ kind: "open", url });
|
||||
} catch {
|
||||
/* port dead — cleanup happens on unsubscribe / next subscribe */
|
||||
}
|
||||
}
|
||||
};
|
||||
es.onmessage = (e) => {
|
||||
for (const port of entry.ports) {
|
||||
try { port.postMessage({ kind: 'message', url, data: e.data }); }
|
||||
catch { /* same */ }
|
||||
try {
|
||||
port.postMessage({ kind: "message", url, data: e.data });
|
||||
} catch {
|
||||
/* same */
|
||||
}
|
||||
}
|
||||
};
|
||||
es.onerror = () => {
|
||||
for (const port of entry.ports) {
|
||||
try { port.postMessage({ kind: 'error', url }); }
|
||||
catch { /* same */ }
|
||||
try {
|
||||
port.postMessage({ kind: "error", url });
|
||||
} catch {
|
||||
/* same */
|
||||
}
|
||||
}
|
||||
};
|
||||
streams.set(url, entry);
|
||||
|
|
@ -81,8 +93,8 @@ self.onconnect = (connectEvent) => {
|
|||
const subscribedUrls = new Set();
|
||||
port.onmessage = (e) => {
|
||||
const msg = e.data;
|
||||
if (!msg || typeof msg.url !== 'string') return;
|
||||
if (msg.kind === 'subscribe') {
|
||||
if (!msg || typeof msg.url !== "string") return;
|
||||
if (msg.kind === "subscribe") {
|
||||
if (subscribedUrls.has(msg.url)) return; // idempotent
|
||||
const entry = getOrCreateStream(msg.url);
|
||||
entry.ports.add(port);
|
||||
|
|
@ -93,10 +105,13 @@ self.onconnect = (connectEvent) => {
|
|||
// the next reconnect. Hand the new tab the open event explicitly
|
||||
// so its onStreamOpen handler runs.
|
||||
if (entry.es.readyState === EventSource.OPEN) {
|
||||
try { port.postMessage({ kind: 'open', url: msg.url }); }
|
||||
catch { /* port dead immediately — give up */ }
|
||||
try {
|
||||
port.postMessage({ kind: "open", url: msg.url });
|
||||
} catch {
|
||||
/* port dead immediately — give up */
|
||||
}
|
||||
}
|
||||
} else if (msg.kind === 'unsubscribe') {
|
||||
} else if (msg.kind === "unsubscribe") {
|
||||
if (!subscribedUrls.has(msg.url)) return;
|
||||
unsubscribe(port, msg.url);
|
||||
subscribedUrls.delete(msg.url);
|
||||
|
|
|
|||
Loading…
Reference in a new issue