@torpor/view 1.2.0 → 1.2.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/dist/ssr.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ssr.mjs","names":[],"sources":["../src/render/formatAttributeText.ts","../src/ssr/formatText.ts","../src/ssr/serverAwaitState.ts","../src/ssr/$serverAsync.ts","../src/ssr/$serverBatch.ts","../src/ssr/$serverBind.ts","../src/ssr/$serverCache.ts","../src/ssr/$serverOnmount.ts","../src/ssr/$serverPeek.ts","../src/ssr/$serverPending.ts","../src/ssr/$serverRefresh.ts","../src/ssr/$serverRun.ts","../src/ssr/$serverStream.ts","../src/ssr/$serverUnwrap.ts","../src/ssr/$serverWatch.ts","../src/ssr/serverSentinels.ts","../src/ssr/runServerAwait.ts","../src/ssr/unavailable.ts"],"sourcesContent":["export default function formatAttributeText(value: any): string {\n\treturn (value ?? \"\").toString().replaceAll('\"', \"&quot;\");\n}\n","import formatText from \"../render/formatText\";\n\nconst ESCAPABLE: Record<string, string> = {\n\t\"&\": \"&amp;\",\n\t\"<\": \"&lt;\",\n\t\">\": \"&gt;\",\n};\n\n/**\n * Formats a text value for inclusion in server-rendered HTML.\n *\n * Unlike the client version (which assigns to `textContent` and so needs no\n * escaping), the server interpolates values into an HTML string, so the\n * characters that would otherwise be parsed as markup are escaped here.\n */\nexport default function formatServerText(value: any): string {\n\treturn formatText(value).replace(/[&<>]/g, (c) => ESCAPABLE[c]);\n}\n","/**\n * The per-request state for a `source: \"server\"` async render. Server awaits\n * are orchestrated by `t_server_flush` (the component's render) and\n * `t_await_server` (each `@await` boundary), which coordinate through the\n * module-level `current` pointer:\n *\n * - **Collect phase** — the boundary's content is rendered speculatively (a\n * discarded pass) purely to invoke its getters. Each `source: \"server\"`\n * getter read calls its thunk (starting the fetch) and records the promise\n * here. Sibling reads in the same pass therefore start in one wave, exactly\n * like the client's speculative render.\n * - **Render phase** — after the recorded promises settle, the content is\n * rendered again; getter reads consume the settled values through a cursor\n * in record order. The second pass's output is what ships.\n *\n * `current` is only ever read synchronously (inside a helper's render\n * segments), so concurrent requests interleave safely: each helper captures\n * and restores the pointer around its awaits.\n */\nexport default interface ServerAwaitState {\n\t/** \"collect\" during the speculative pass, \"render\" during the resolved pass. */\n\tphase: \"collect\" | \"render\";\n\n\t/**\n\t * Recorded `source: \"server\"` reads, in read order. Each entry holds the\n\t * promise, its per-getter timeout, and — once settled — the fulfilled\n\t * value or rejection.\n\t */\n\tpromises: ServerPromiseEntry[];\n\n\t/** How many values the render phase has consumed (the payload cursor). */\n\tcursor: number;\n\n\t/**\n\t * `source: \"server\"` reads made during the render pass. Pass 1 and pass 2\n\t * must read the same getters in the same order; a count mismatch at the\n\t * end of pass 2 means the render isn't stable, so the boundary degrades\n\t * to the `with` branch + client fetch.\n\t */\n\trenderReads: number;\n\n\t/**\n\t * Client-fetch `$async` reads made during the render pass (the server\n\t * stub's no-option calls). Any of these would suspend on the client, so a\n\t * boundary that touched one cannot ship resolved content — it degrades.\n\t */\n\tclientReads: number;\n\n\t/**\n\t * Nested boundary states created inside this boundary's collect pass,\n\t * keyed by `\"<site id>:<occurrence>\"`. The render pass re-invokes each\n\t * nested boundary in the same order, so it looks up the state by the same\n\t * key and awaits its final HTML instead of re-fetching.\n\t */\n\tchildren: Map<string, Promise<{ body: string; head: string }>>;\n\n\t/** Per-site occurrence counters, reset at the start of each pass. */\n\tcounters: Map<string, number>;\n\n\t/** Set when the boundary degrades to its `with` branch. */\n\tdegraded: boolean;\n\n\t/**\n\t * True for component flush roots. A flush root is a collect-phase context\n\t * but not a recording one: `source: \"server\"` reads outside any boundary\n\t * don't fetch. Boundaries created directly under the root stash their\n\t * final HTML here, keyed by the sentinel they returned.\n\t */\n\tisRoot: boolean;\n\n\t/**\n\t * Stashed boundary lifecycles keyed by sentinel comment, for substitution\n\t * at the end of the flush (or a degraded `with` branch's render). Only\n\t * used by flush roots.\n\t */\n\tsentinels: Map<string, Promise<{ body: string; head: string }>>;\n}\n\n/**\n * A recorded `source: \"server\"` read: the promise returned by the getter's\n * thunk, and the settled outcome once it arrives.\n */\nexport interface ServerPromiseEntry {\n\tpromise: Promise<any>;\n\ttimeout: number;\n\t/** Set by the settle handler: `{ ok: true, value }` or `{ ok: false, error }`. */\n\tresult?: { ok: true; value: any } | { ok: false; error: any };\n}\n\n/**\n * The sentinel thrown when the render pass hits a boundary state that the\n * collect pass didn't create (or a cursor that ran past the recorded reads).\n * Only this error degrades the boundary; real render errors propagate.\n */\nexport class ServerAwaitMisaligned extends Error {\n\tconstructor() {\n\t\tsuper(\"Server await render pass did not match the collect pass\");\n\t}\n}\n\n/** The innermost active server await state, or null outside any. */\nlet current: ServerAwaitState | null = null;\n\n/**\n * Runs `fn` with `state` as the current server await state. `fn` may be sync\n * or async; the pointer is restored when it settles. Because the pointer is\n * only read synchronously, interleaved async renders restore it correctly.\n */\nexport async function withServerAwait<T>(\n\tstate: ServerAwaitState | null,\n\tfn: () => T | Promise<T>,\n): Promise<T> {\n\tconst previous = current;\n\tcurrent = state;\n\ttry {\n\t\treturn await fn();\n\t} finally {\n\t\tcurrent = previous;\n\t}\n}\n\n/** The current server await state, or null. Only read synchronously. */\nexport function currentServerAwait(): ServerAwaitState | null {\n\treturn current;\n}\n\n/** Creates a fresh state for one boundary (or component flush root). */\nexport function newServerAwaitState(): ServerAwaitState {\n\treturn {\n\t\tphase: \"collect\",\n\t\tpromises: [],\n\t\tcursor: 0,\n\t\trenderReads: 0,\n\t\tclientReads: 0,\n\t\tchildren: new Map(),\n\t\tcounters: new Map(),\n\t\tdegraded: false,\n\t\tisRoot: false,\n\t\tsentinels: new Map(),\n\t};\n}\n\n/**\n * The occurrence key for a nested boundary call site: `\"<id>:<n>\"`. The\n * counter lives on the enclosing state and resets each pass, so the collect\n * and render passes derive identical key sequences.\n */\nexport function childKey(state: ServerAwaitState, id: string): string {\n\tconst n = state.counters.get(id) ?? 0;\n\tstate.counters.set(id, n + 1);\n\treturn `${id}:${n}`;\n}\n","import type AsyncOptions from \"../types/AsyncOptions\";\nimport {\n\tcurrentServerAwait,\n\tServerAwaitMisaligned,\n\ttype ServerPromiseEntry,\n} from \"./serverAwaitState\";\n\n/**\n * Default number of milliseconds a `source: \"server\"` read may take before\n * its boundary degrades to the `with` branch and the client fetches instead\n * (ASYNC.md → \"Server rendering\").\n */\nexport const SERVER_ASYNC_TIMEOUT = 5000;\n\n/**\n * Server counterpart of the client-side `$async` getter primitive.\n *\n * Without options (the default), this is a no-op stub: server renders are\n * synchronous, an async value never resolves during SSR, and `@await`\n * boundaries render their `with` branch and never read the getter. The stub\n * exists so server builds importing `$async` don't emit a dangling import.\n * A read inside a boundary's render pass is still recorded, so the boundary\n * degrades to the `with` branch + client fetch instead of shipping content\n * that would suspend on the client.\n *\n * With `{ source: \"server\" }` the getter participates in the server's\n * collect/render pass (ASYNC.md → \"Server rendering\"):\n *\n * - **Collect pass** — calls the thunk (starting the fetch) and records the\n * promise on the enclosing boundary, so sibling reads start in one wave.\n * Returns `undefined`; the speculative pass's output is discarded.\n * - **Render pass** — returns the settled value from the recorded promise at\n * the same position in read order, without calling the thunk again. A\n * rejection is re-thrown here so `@try`/`@error` handles it like any other\n * render error. Running past the recorded reads throws a sentinel that\n * degrades the boundary (the render pass no longer matches the collect\n * pass, so the shipped HTML can't be trusted).\n *\n * Outside any `@await` boundary (including in a `with` branch) a\n * `source: \"server\"` read returns `undefined` without fetching — the same\n * undefined-then-recover contract the client has for un-boundaried reads.\n */\nexport default function $serverAsync<T>(fn: () => Promise<T>, options?: AsyncOptions): T {\n\tconst state = currentServerAwait();\n\n\tif (state === null || state.isRoot || options?.source !== \"server\") {\n\t\tif (state !== null && !state.isRoot && state.phase === \"render\") {\n\t\t\t// A client-fetch read during a boundary's render pass: the client\n\t\t\t// will suspend on it, so the boundary can't ship resolved content\n\t\t\tstate.clientReads++;\n\t\t}\n\t\treturn undefined as T;\n\t}\n\n\tif (state.phase === \"collect\") {\n\t\tconst entry: ServerPromiseEntry = {\n\t\t\tpromise: fn(),\n\t\t\ttimeout: options.timeout ?? SERVER_ASYNC_TIMEOUT,\n\t\t};\n\t\t// Record the outcome as soon as it settles — this both captures the\n\t\t// value/error for the render pass and consumes the rejection, so a\n\t\t// boundary that degrades (timeout) or a superseded fetch can never\n\t\t// surface as an unhandled rejection\n\t\tentry.promise.then(\n\t\t\t(value) => {\n\t\t\t\tentry.result = { ok: true, value };\n\t\t\t},\n\t\t\t(error) => {\n\t\t\t\tentry.result = { ok: false, error };\n\t\t\t},\n\t\t);\n\t\tstate.promises.push(entry);\n\t\treturn undefined as T;\n\t}\n\n\t// Render pass: consume the recorded read at this position\n\tconst index = state.cursor;\n\tif (index >= state.promises.length) {\n\t\tthrow new ServerAwaitMisaligned();\n\t}\n\tstate.cursor++;\n\tstate.renderReads++;\n\tconst result = state.promises[index].result;\n\tif (result === undefined) {\n\t\t// Not settled — only possible when the boundary already blew its\n\t\t// timeout, which degrades before rendering; treat as misaligned\n\t\tthrow new ServerAwaitMisaligned();\n\t}\n\tif (result.ok) {\n\t\treturn result.value as T;\n\t}\n\tthrow result.error;\n}\n","export default function $serverBatch<T>(fn: () => T): T {\n\treturn fn();\n}\n","/**\n * Server no-op for the client-side `$bind` two-way sync primitive. Two-way\n * binding is a client runtime feature — there are no reactive updates during\n * SSR, so there is nothing to sync. The stub exists so server builds\n * importing `$bind` don't emit a dangling import.\n */\nexport default function $serverBind(\n\t_state: Record<PropertyKey, any>,\n\t_props: Record<PropertyKey, any> | undefined,\n\t..._keys: (string | string[])[]\n): void {}\n","export default function $serverCache<T>(fn: () => T): T {\n\treturn fn();\n}\n","import type Cleanup from \"../types/Cleanup\";\n\nexport default function $serverOnmount(_fn: () => Cleanup | void): void {}\n","export default function $serverPeek<T>(fn: () => T): T {\n\treturn fn();\n}\n","/**\n * Server no-op for the client-side `$pending` query. Nothing is ever pending\n * during a synchronous SSR render, so the query is always `false`. The stub\n * exists so server builds importing `$pending` don't emit a dangling import.\n */\nexport default function $serverPending(_fn: () => any): boolean {\n\treturn false;\n}\n","/**\n * Server no-op for the client-side `$refresh` primitive. A refresh is an\n * imperative action that never runs during SSR. The stub exists so server\n * builds importing `$refresh` don't emit a dangling import.\n */\nexport default function $serverRefresh(_fn: () => any): void {}\n","import type Cleanup from \"../types/Cleanup\";\n\nexport default function $serverRun(_fn: () => Cleanup | void): void {}\n","import type StreamSource from \"../types/StreamSource\";\n\n/**\n * Server stub for `$stream` — external sources are never subscribed to\n * during a server render. The subscription starts when the component is\n * mounted on the client.\n */\nexport default function $serverStream<T>(\n\t_source: StreamSource<T>,\n\t_handler: (value: T) => void,\n\t_options?: { debounce?: number },\n): void {}\n","export default function $serverUnwrap<T extends Record<PropertyKey, any>>(object: T): T {\n\treturn object;\n}\n","export default function $serverWatch<T extends Record<PropertyKey, any>>(object: T): T {\n\treturn object;\n}\n","import { newServerAwaitState, withServerAwait } from \"./serverAwaitState\";\nimport type ServerAwaitState from \"./serverAwaitState\";\n\n/** Comment prefix marking an unsubstituted boundary sentinel. */\nexport const SENTINEL_PREFIX = \"<!--t-aw:\";\n\n/** The body/head pair that server components and boundaries render into. */\nexport interface ServerHtml {\n\tbody: string;\n\thead: string;\n}\n\n/**\n * Renders a component's (or a degraded boundary's `with` branch's) markup\n * with a fresh flush root as the enclosing await state, then substitutes any\n * boundary sentinels with their final HTML.\n *\n * Boundaries created during the render stash their lifecycle promise under a\n * sentinel comment and return the sentinel immediately, so the render itself\n * never blocks on a fetch — every `source: \"server\"` read in the render\n * starts in the same wave. Substitution awaits the stashed promises at the\n * end, which is the only point an async component render actually waits.\n *\n * On the client this has no counterpart: `render` here is the compiled\n * component body closure that the generated component function returns.\n */\nexport async function serverFlush(render: () => Promise<ServerHtml>): Promise<ServerHtml> {\n\tconst state = newServerAwaitState();\n\tstate.isRoot = true;\n\tconst result = await withServerAwait(state, render);\n\treturn substituteSentinels(result, state);\n}\n\n/**\n * Renders a degraded boundary's `with` branch inside its own flush root, so\n * a `with` branch containing its own `@await` boundaries still resolves\n * them, then wraps it in the boundary's hydration markers. The `with` branch\n * must not start server fetches for its own reads — the flush root isn't a\n * recording context.\n */\nexport async function renderWithBranch(\n\trenderWith: (() => Promise<ServerHtml>) | null,\n): Promise<ServerHtml> {\n\tconst html = await serverFlush(async () => {\n\t\tif (renderWith === null) {\n\t\t\treturn { body: \"\", head: \"\" };\n\t\t}\n\t\treturn renderWith();\n\t});\n\treturn { body: `<![>${html.body}<!]><!>`, head: html.head };\n}\n\n/**\n * Replaces every sentinel the state stashed with its boundary's final HTML.\n * Boundary head tags are appended to the head (they hoist into the document\n * head regardless of where the boundary sits in the body). Any sentinel left\n * over means a boundary's state was lost — a bug, not a degradation path, so\n * it throws.\n */\nexport async function substituteSentinels(\n\tresult: ServerHtml,\n\tstate: ServerAwaitState,\n): Promise<ServerHtml> {\n\tlet { body, head } = result;\n\tfor (const [sentinel, promise] of state.sentinels) {\n\t\tconst html = await promise;\n\t\tbody = body.split(sentinel).join(html.body);\n\t\thead += html.head;\n\t}\n\tif (body.includes(SENTINEL_PREFIX) || head.includes(SENTINEL_PREFIX)) {\n\t\tthrow new Error(\"Unsubstituted async boundary sentinel — boundary state was lost\");\n\t}\n\treturn { body, head };\n}\n","import {\n\tchildKey,\n\tcurrentServerAwait,\n\tnewServerAwaitState,\n\tServerAwaitMisaligned,\n\twithServerAwait,\n} from \"./serverAwaitState\";\nimport type ServerAwaitState from \"./serverAwaitState\";\nimport { renderWithBranch } from \"./serverSentinels\";\n\nlet sentinelCount = 0;\n\nfunction nextSentinel(): string {\n\treturn `<!--t-aw:${sentinelCount++}-->`;\n}\n\n/**\n * Renders an `@await` boundary on the server (compiled as `t_await_server`).\n *\n * The generated code calls this for every `@await`, passing the boundary's\n * site id, a closure that renders the content branch, and one that renders\n * the `with` branch. It always returns a `{ body, head }` pair to append:\n *\n * - **Inside a boundary's render pass** — this boundary was already started\n * during the collect pass; its body/head is the finished HTML (awaited if\n * still in flight). A missing entry means the render pass doesn't match\n * the collect pass, which degrades the enclosing boundary.\n * - **Inside a collect pass or a component flush** — start the full\n * lifecycle (collect, settle, render) without blocking the enclosing\n * render, and return a sentinel comment as the body. Sibling reads and\n * nested boundaries keep rendering, so every fetch in the pass starts in\n * one wave. The sentinel is substituted later: by the enclosing boundary's\n * render pass (which re-invokes this helper and awaits the finished HTML),\n * or by the component flush (which replaces top-level sentinels directly).\n *\n * The lifecycle: render content once to start the `source: \"server\"` fetches\n * (discarding the output), wait for them with a per-getter timeout, then\n * render again with the settled values. The second pass ships wrapped in\n * hydration markers plus a `<!--t-await:...-->` comment carrying the values\n * for the client's `$async` hydration path. Any instability — timeout, a\n * render pass that reads a different set of getters, a client-fetch read —\n * degrades to the `with` branch + client fetch, exactly the pre-`source`\n * behavior.\n *\n * @param id The boundary's site id (unique per `@await` in the component)\n * @param renderContent Renders the content branch (may read `$async` getters)\n * @param renderWith Renders the `with` branch, or null for empty\n */\nexport default function runServerAwait(\n\tid: string,\n\trenderContent: () => Promise<{ body: string; head: string }>,\n\trenderWith: (() => Promise<{ body: string; head: string }>) | null,\n): { body: string; head: string } | Promise<{ body: string; head: string }> {\n\tconst parent = currentServerAwait();\n\n\tif (parent !== null && parent.phase === \"render\") {\n\t\t// The enclosing boundary is rendering its resolved pass: this nested\n\t\t// boundary was started during the collect pass, so reuse its result\n\t\tconst cached = parent.children.get(childKey(parent, id));\n\t\tif (cached === undefined) {\n\t\t\tthrow new ServerAwaitMisaligned();\n\t\t}\n\t\treturn cached;\n\t}\n\n\tconst state = newServerAwaitState();\n\tconst final = renderBoundary(state, renderContent, renderWith);\n\n\tconst sentinel = nextSentinel();\n\tif (parent !== null) {\n\t\tif (parent.isRoot) {\n\t\t\t// Top-level boundary: the component flush substitutes the sentinel\n\t\t\tparent.sentinels.set(sentinel, final);\n\t\t} else {\n\t\t\t// Nested boundary: the enclosing boundary's render pass looks this\n\t\t\t// up by occurrence key\n\t\t\tparent.children.set(childKey(parent, id), final);\n\t\t}\n\t}\n\t// The sentinel body is replaced by the finished content; the head tags a\n\t// resolved boundary renders are hoisted when it finishes\n\treturn { body: sentinel, head: \"\" };\n}\n\n/**\n * The full lifecycle for one boundary: speculative collect pass, settle, and\n * resolved render pass. Runs concurrently with the enclosing render; the\n * returned promise resolves to the boundary's final HTML.\n */\nasync function renderBoundary(\n\tstate: ServerAwaitState,\n\trenderContent: () => Promise<{ body: string; head: string }>,\n\trenderWith: (() => Promise<{ body: string; head: string }>) | null,\n): Promise<{ body: string; head: string }> {\n\t// Collect pass: render content speculatively to invoke the getters. Each\n\t// `source: \"server\"` read starts its fetch and is recorded; sibling reads\n\t// in this pass therefore start together. The output is discarded — reads\n\t// return undefined, so user markup that dereferences them may throw, and\n\t// a throw here costs nothing.\n\tawait withServerAwait(state, renderContent).catch(() => {\n\t\t// Expected when unresolved values are dereferenced; fetches already\n\t\t// started. Any other error resurfaces in the render pass below.\n\t});\n\n\tif (state.promises.length === 0) {\n\t\t// No server-source reads: nothing was (or can be) resolved here, so\n\t\t// ship the `with` branch and let the client fetch — the default SSR\n\t\t// behavior for client-fetch getters\n\t\treturn renderWithBranch(renderWith);\n\t}\n\n\t// Settle the recorded fetches. Each getter carries its own timeout; the\n\t// boundary waits for the longest, and a miss degrades the whole boundary\n\t// (content ships only when every read resolved)\n\tconst timeout = Math.max(...state.promises.map((entry) => entry.timeout));\n\tconst settled = await Promise.race([\n\t\tPromise.all(\n\t\t\tstate.promises.map((entry) =>\n\t\t\t\tentry.promise.then(\n\t\t\t\t\t() => true,\n\t\t\t\t\t() => true,\n\t\t\t\t),\n\t\t\t),\n\t\t).then(\n\t\t\t() => true,\n\t\t\t() => true,\n\t\t),\n\t\tnew Promise<false>((resolve) => setTimeout(resolve, timeout, false)),\n\t]);\n\n\t// Render pass: same reads, now consuming settled values through the\n\t// cursor. The pass must replay the collect pass exactly — a different\n\t// read count, an unknown nested boundary, or a client-fetch read all\n\t// mean the content can't be trusted, and the boundary degrades.\n\t//\n\t// A rejection (or any render error) also degrades: the boundary's\n\t// lifecycle runs detached from the enclosing render (which has already\n\t// moved on after the sentinel), so the error can't propagate to the\n\t// emitted `@try` positionally. Instead the with branch ships and the\n\t// client re-runs the getter, rejects there, and its `@try` renders the\n\t// catch branch — the same path a client-fetch error takes.\n\tlet degraded = settled === false;\n\tlet content: { body: string; head: string } | undefined;\n\tif (!degraded) {\n\t\tstate.phase = \"render\";\n\t\tstate.cursor = 0;\n\t\tstate.renderReads = 0;\n\t\tstate.clientReads = 0;\n\t\tstate.counters.clear();\n\t\ttry {\n\t\t\tcontent = await withServerAwait(state, renderContent);\n\t\t\tif (state.cursor !== state.promises.length || state.clientReads > 0) {\n\t\t\t\tdegraded = true;\n\t\t\t}\n\t\t} catch {\n\t\t\tdegraded = true;\n\t\t}\n\t}\n\n\tif (degraded || content === undefined) {\n\t\tstate.degraded = true;\n\t\ttry {\n\t\t\treturn await renderWithBranch(renderWith);\n\t\t} catch {\n\t\t\t// A with-branch render error can't be positioned either; ship an\n\t\t\t// empty boundary rather than failing the whole response\n\t\t\treturn { body: \"<![><!]><!>\", head: \"\" };\n\t\t}\n\t}\n\n\t// Ship the resolved content with the embedded values for hydration.\n\t// Rejections never reach here — the render pass consumes them and\n\t// degrades — but guard anyway so a bad entry can't ship as `undefined`\n\tconst values: any[] = [];\n\tfor (let i = 0; i < state.cursor; i++) {\n\t\tconst result = state.promises[i].result;\n\t\tif (result === undefined) {\n\t\t\tdegraded = true;\n\t\t\tbreak;\n\t\t}\n\t\tvalues.push(result.ok ? result.value : undefined);\n\t}\n\tif (degraded) {\n\t\tstate.degraded = true;\n\t\treturn renderWithBranch(renderWith);\n\t}\n\treturn {\n\t\tbody: `${\"<![>\"}${content.body}${\"<!]><!>\"}${payloadComment(values)}`,\n\t\thead: content.head,\n\t};\n}\n\n/**\n * The `<!--t-await:...-->` comment carrying the boundary's resolved values,\n * in read order, for the client's `$async` hydration path. `-->` inside the\n * JSON is escaped so the comment can't terminate early.\n */\nfunction payloadComment(values: any[]): string {\n\tconst json = JSON.stringify(values).replaceAll(\"-->\", \"--\\\\u003E\");\n\treturn `<!--t-await:${json}-->`;\n}\n","/**\n * Server stubs for the client-only runtime, so that modules compiled for the\n * client -- or shared helpers that import them from the main `@torpor/view`\n * entry -- still resolve when they end up in a server bundle (the SSR\n * environment resolves `@torpor/view` to this module; see @torpor/build's\n * ssr-view plugin).\n *\n * They throw when called: mounting, hydrating and DOM rendering must not run\n * during SSR. Importing them is fine, which keeps a stray client-only import\n * from failing the server build.\n */\ntype Unavailable = (...args: unknown[]) => never;\n\nfunction unavailable(name: string): Unavailable {\n\treturn (..._args: unknown[]): never => {\n\t\tthrow new Error(`${name} is not available during server rendering`);\n\t};\n}\n\nexport const mount: Unavailable = unavailable(\"mount\");\nexport const hydrate: Unavailable = unavailable(\"hydrate\");\nexport const unmount: Unavailable = unavailable(\"unmount\");\nexport const fillLayoutSlot: Unavailable = unavailable(\"fillLayoutSlot\");\nexport const clearLayoutSlot: Unavailable = unavailable(\"clearLayoutSlot\");\n\nexport const t_add_element: Unavailable = unavailable(\"t_add_element\");\nexport const t_add_fragment: Unavailable = unavailable(\"t_add_fragment\");\nexport const t_anchor: Unavailable = unavailable(\"t_anchor\");\nexport const t_animate: Unavailable = unavailable(\"t_animate\");\nexport const t_apply_props: Unavailable = unavailable(\"t_apply_props\");\nexport const t_attribute: Unavailable = unavailable(\"t_attribute\");\nexport const t_child: Unavailable = unavailable(\"t_child\");\nexport const t_dynamic: Unavailable = unavailable(\"t_dynamic\");\nexport const t_event: Unavailable = unavailable(\"t_event\");\nexport const t_first_inside: Unavailable = unavailable(\"t_first_inside\");\nexport const t_fragment: Unavailable = unavailable(\"t_fragment\");\nexport const t_fragment_el: Unavailable = unavailable(\"t_fragment_el\");\nexport const t_head_element: Unavailable = unavailable(\"t_head_element\");\nexport const t_list_item: Unavailable = unavailable(\"t_list_item\");\nexport const t_next: Unavailable = unavailable(\"t_next\");\nexport const t_pop_region: Unavailable = unavailable(\"t_pop_region\");\nexport const t_push_region: Unavailable = unavailable(\"t_push_region\");\nexport const t_region: Unavailable = unavailable(\"t_region\");\nexport const t_rerun_region_effects: Unavailable = unavailable(\"t_rerun_region_effects\");\nexport const t_restore_hydration: Unavailable = unavailable(\"t_restore_hydration\");\nexport const t_root: Unavailable = unavailable(\"t_root\");\nexport const t_root_el: Unavailable = unavailable(\"t_root_el\");\nexport const t_run_await: Unavailable = unavailable(\"t_run_await\");\nexport const t_run_branch: Unavailable = unavailable(\"t_run_branch\");\nexport const t_run_control: Unavailable = unavailable(\"t_run_control\");\nexport const t_run_list: Unavailable = unavailable(\"t_run_list\");\nexport const t_run_try: Unavailable = unavailable(\"t_run_try\");\nexport const t_save_hydration: Unavailable = unavailable(\"t_save_hydration\");\nexport const t_skip: Unavailable = unavailable(\"t_skip\");\n"],"mappings":";;AAAA,SAAwB,oBAAoB,OAAoB;CAC/D,QAAQ,SAAS,GAAA,CAAI,SAAS,CAAC,CAAC,WAAW,MAAK,QAAQ;AACzD;;;ACAA,MAAM,YAAoC;CACzC,KAAK;CACL,KAAK;CACL,KAAK;AACN;;;;;;;;AASA,SAAwB,iBAAiB,OAAoB;CAC5D,OAAO,WAAW,KAAK,CAAC,CAAC,QAAQ,WAAW,MAAM,UAAU,EAAE;AAC/D;;;;;;;;AC6EA,IAAa,wBAAb,cAA2C,MAAM;CAChD,cAAc;EACb,MAAM,yDAAyD;CAChE;AACD;;AAGA,IAAI,UAAmC;;;;;;AAOvC,eAAsB,gBACrB,OACA,IACa;CACb,MAAM,WAAW;CACjB,UAAU;CACV,IAAI;EACH,OAAO,MAAM,GAAG;CACjB,UAAU;EACT,UAAU;CACX;AACD;;AAGA,SAAgB,qBAA8C;CAC7D,OAAO;AACR;;AAGA,SAAgB,sBAAwC;CACvD,OAAO;EACN,OAAO;EACP,UAAU,CAAC;EACX,QAAQ;EACR,aAAa;EACb,aAAa;EACb,0BAAU,IAAI,IAAI;EAClB,0BAAU,IAAI,IAAI;EAClB,UAAU;EACV,Q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,eAAe;AACrE,MAAa,iBAA8B,YAAY,gBAAgB;AACvE,MAAa,cAA2B,YAAY,aAAa;AACjE,MAAa,SAAsB,YAAY,QAAQ;AACvD,MAAa,eAA4B,YAAY,cAAc;AACnE,MAAa,gBAA6B,YAAY,eAAe;AACrE,MAAa,WAAwB,YAAY,UAAU;AAC3D,MAAa,yBAAsC,YAAY,wBAAwB;AACvF,MAAa,sBAAmC,YAAY,qBAAqB;AACjF,MAAa,SAAsB,YAAY,QAAQ;AACvD,MAAa,YAAyB,YAAY,WAAW;AAC7D,MAAa,cAA2B,YAAY,aAAa;AACjE,MAAa,eAA4B,YAAY,cAAc;AACnE,MAAa,gBAA6B,YAAY,eAAe;AACrE,MAAa,aAA0B,YAAY,YAAY;AAC/D,MAAa,YAAyB,YAAY,WAAW;AAC7D,MAAa,mBAAgC,YAAY,kBAAkB;AAC3E,MAAa,SAAsB,YAAY,QAAQ"}
1
+ {"version":3,"file":"ssr.mjs","names":[],"sources":["../src/render/formatAttributeText.ts","../src/ssr/formatText.ts","../src/ssr/$serverWatch.ts","../src/ssr/serverAwaitState.ts","../src/ssr/$serverAsync.ts","../src/ssr/$serverBatch.ts","../src/ssr/$serverBind.ts","../src/ssr/$serverCache.ts","../src/ssr/$serverOnmount.ts","../src/ssr/$serverPeek.ts","../src/ssr/$serverPending.ts","../src/ssr/$serverRefresh.ts","../src/ssr/$serverRun.ts","../src/ssr/$serverStream.ts","../src/ssr/$serverUnwrap.ts","../src/ssr/serverSentinels.ts","../src/ssr/runServerAwait.ts","../src/ssr/unavailable.ts"],"sourcesContent":["export default function formatAttributeText(value: any): string {\n\treturn (value ?? \"\").toString().replaceAll('\"', \"&quot;\");\n}\n","import formatText from \"../render/formatText\";\n\nconst ESCAPABLE: Record<string, string> = {\n\t\"&\": \"&amp;\",\n\t\"<\": \"&lt;\",\n\t\">\": \"&gt;\",\n};\n\n/**\n * Formats a text value for inclusion in server-rendered HTML.\n *\n * Unlike the client version (which assigns to `textContent` and so needs no\n * escaping), the server interpolates values into an HTML string, so the\n * characters that would otherwise be parsed as markup are escaped here.\n */\nexport default function formatServerText(value: any): string {\n\treturn formatText(value).replace(/[&<>]/g, (c) => ESCAPABLE[c]);\n}\n","/**\n * The identity of a `source: \"server\"` getter read: the watched object and the\n * property key being read. The server await state records reads by identity\n * (rather than position) so the render pass can read a getter a different\n * number of times than the collect pass did — e.g. when markup branches on the\n * resolved value.\n */\nexport interface ServerReadSite {\n\towner: object | null;\n\tkey: PropertyKey | string;\n}\n\nlet currentSite: ServerReadSite | null = null;\n\n/** The watched getter currently being read, or null outside a `$watch` get. */\nexport function currentServerReadSite(): ServerReadSite | null {\n\treturn currentSite;\n}\n\n/**\n * Server-render counterpart of `$watch`.\n *\n * State doesn't need to be reactive on the server, so values aren't wrapped\n * for tracking. Plain objects and arrays are wrapped in a lightweight proxy\n * that only records the property key while an accessor getter runs:\n * `$serverAsync` uses that to identify the getter site across the collect and\n * render passes. Other objects (Maps, class instances, …) are returned\n * untouched — proxying them would break internal slots or private fields, and\n * they rarely carry async getters.\n */\nexport default function $serverWatch<T extends Record<PropertyKey, any>>(object: T): T {\n\tif (object === null || object === undefined) {\n\t\treturn object;\n\t}\n\tconst prototype = Object.getPrototypeOf(object);\n\tif (!Array.isArray(object) && prototype !== Object.prototype && prototype !== null) {\n\t\treturn object;\n\t}\n\n\treturn new Proxy(object, {\n\t\tget(target, key, receiver) {\n\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(target, key);\n\t\t\tif (descriptor?.get === undefined) {\n\t\t\t\treturn Reflect.get(target, key, receiver);\n\t\t\t}\n\t\t\tconst previous = currentSite;\n\t\t\tcurrentSite = { owner: target, key };\n\t\t\ttry {\n\t\t\t\treturn Reflect.get(target, key, receiver);\n\t\t\t} finally {\n\t\t\t\tcurrentSite = previous;\n\t\t\t}\n\t\t},\n\t});\n}\n","/**\n * The per-request state for a `source: \"server\"` async render. Server awaits\n * are orchestrated by `t_server_flush` (the component's render) and\n * `t_await_server` (each `@await` boundary), which coordinate through the\n * module-level `current` pointer:\n *\n * - **Collect phase** — the boundary's content is rendered speculatively (a\n * discarded pass) purely to invoke its getters. Each `source: \"server\"`\n * getter read calls its thunk (starting the fetch) and records the promise\n * here. Sibling reads in the same pass therefore start in one wave, exactly\n * like the client's speculative render.\n * - **Render phase** — after the recorded promises settle, the content is\n * rendered again; getter reads look up the settled value by getter identity\n * (watched object + property key), so the pass may read a getter a different\n * number of times than the collect pass did. The second pass's output is\n * what ships.\n *\n * `current` is only ever read synchronously (inside a helper's render\n * segments), so concurrent requests interleave safely: each helper captures\n * and restores the pointer around its awaits.\n */\nexport default interface ServerAwaitState {\n\t/** \"collect\" during the speculative pass, \"render\" during the resolved pass. */\n\tphase: \"collect\" | \"render\";\n\n\t/**\n\t * Recorded `source: \"server\"` reads, in first-read order. Each entry holds\n\t * the getter identity, the promise, its per-getter timeout, and — once\n\t * settled — the fulfilled value or rejection. A getter read more than once\n\t * is recorded once, so repeated reads share one fetch.\n\t */\n\tpromises: ServerPromiseEntry[];\n\n\t/**\n\t * Recorded reads made during the render pass, in first-read order. This is\n\t * the order the client will read the getters during hydration, so it also\n\t * determines the payload's value order.\n\t */\n\trenderEntries: ServerPromiseEntry[];\n\n\t/** Entries in `renderEntries`, for O(1) dedup while rendering. */\n\trenderSeen: Set<ServerPromiseEntry>;\n\n\t/**\n\t * Client-fetch `$async` reads made during the render pass (the server\n\t * stub's no-option calls). Any of these would suspend on the client, so a\n\t * boundary that touched one cannot ship resolved content — it degrades.\n\t */\n\tclientReads: number;\n\n\t/**\n\t * Nested boundary states created inside this boundary's collect pass,\n\t * keyed by `\"<site id>:<occurrence>\"`. The render pass re-invokes each\n\t * nested boundary in the same order, so it looks up the state by the same\n\t * key and awaits its final HTML instead of re-fetching.\n\t */\n\tchildren: Map<string, Promise<{ body: string; head: string }>>;\n\n\t/** Per-site occurrence counters, reset at the start of each pass. */\n\tcounters: Map<string, number>;\n\n\t/** Set when the boundary degrades to its `with` branch. */\n\tdegraded: boolean;\n\n\t/**\n\t * True for component flush roots. A flush root is a collect-phase context\n\t * but not a recording one: `source: \"server\"` reads outside any boundary\n\t * don't fetch. Boundaries created directly under the root stash their\n\t * final HTML here, keyed by the sentinel they returned.\n\t */\n\tisRoot: boolean;\n\n\t/**\n\t * Stashed boundary lifecycles keyed by sentinel comment, for substitution\n\t * at the end of the flush (or a degraded `with` branch's render). Only\n\t * used by flush roots.\n\t */\n\tsentinels: Map<string, Promise<{ body: string; head: string }>>;\n}\n\n/**\n * A recorded `source: \"server\"` read: the getter identity, the promise\n * returned by the getter's thunk, and the settled outcome once it arrives.\n */\nexport interface ServerPromiseEntry {\n\t/** The watched object (or null for an untracked getter). */\n\towner: object | null;\n\t/** The property key on `owner` (or the thunk source when untracked). */\n\tkey: PropertyKey | string;\n\tpromise: Promise<any>;\n\ttimeout: number;\n\t/** Set by the settle handler: `{ ok: true, value }` or `{ ok: false, error }`. */\n\tresult?: { ok: true; value: any } | { ok: false; error: any };\n}\n\n/**\n * The sentinel thrown when the render pass reads a `source: \"server\"` getter\n * that the collect pass never recorded (or one whose value hasn't settled).\n * Only this error degrades the boundary; real render errors propagate.\n */\nexport class ServerAwaitMisaligned extends Error {\n\tconstructor() {\n\t\tsuper(\"Server await render pass did not match the collect pass\");\n\t}\n}\n\n/** The innermost active server await state, or null outside any. */\nlet current: ServerAwaitState | null = null;\n\n/**\n * Runs `fn` with `state` as the current server await state. `fn` may be sync\n * or async; the pointer is restored when it settles. Because the pointer is\n * only read synchronously, interleaved async renders restore it correctly.\n */\nexport async function withServerAwait<T>(\n\tstate: ServerAwaitState | null,\n\tfn: () => T | Promise<T>,\n): Promise<T> {\n\tconst previous = current;\n\tcurrent = state;\n\ttry {\n\t\treturn await fn();\n\t} finally {\n\t\tcurrent = previous;\n\t}\n}\n\n/** The current server await state, or null. Only read synchronously. */\nexport function currentServerAwait(): ServerAwaitState | null {\n\treturn current;\n}\n\n/** Creates a fresh state for one boundary (or component flush root). */\nexport function newServerAwaitState(): ServerAwaitState {\n\treturn {\n\t\tphase: \"collect\",\n\t\tpromises: [],\n\t\trenderEntries: [],\n\t\trenderSeen: new Set(),\n\t\tclientReads: 0,\n\t\tchildren: new Map(),\n\t\tcounters: new Map(),\n\t\tdegraded: false,\n\t\tisRoot: false,\n\t\tsentinels: new Map(),\n\t};\n}\n\n/**\n * The occurrence key for a nested boundary call site: `\"<id>:<n>\"`. The\n * counter lives on the enclosing state and resets each pass, so the collect\n * and render passes derive identical key sequences.\n */\nexport function childKey(state: ServerAwaitState, id: string): string {\n\tconst n = state.counters.get(id) ?? 0;\n\tstate.counters.set(id, n + 1);\n\treturn `${id}:${n}`;\n}\n","import type AsyncOptions from \"../types/AsyncOptions\";\nimport { currentServerReadSite } from \"./$serverWatch\";\nimport type ServerAwaitState from \"./serverAwaitState\";\nimport {\n\tcurrentServerAwait,\n\tServerAwaitMisaligned,\n\ttype ServerPromiseEntry,\n} from \"./serverAwaitState\";\n\n/**\n * Default number of milliseconds a `source: \"server\"` read may take before\n * its boundary degrades to the `with` branch and the client fetches instead\n * (ASYNC.md → \"Server rendering\").\n */\nexport const SERVER_ASYNC_TIMEOUT = 5000;\n\n/**\n * Server counterpart of the client-side `$async` getter primitive.\n *\n * Without options (the default), this is a no-op stub: server renders are\n * synchronous, an async value never resolves during SSR, and `@await`\n * boundaries render their `with` branch and never read the getter. The stub\n * exists so server builds importing `$async` don't emit a dangling import.\n * A read inside a boundary's render pass is still recorded, so the boundary\n * degrades to the `with` branch + client fetch instead of shipping content\n * that would suspend on the client.\n *\n * With `{ source: \"server\" }` the getter participates in the server's\n * collect/render pass (ASYNC.md → \"Server rendering\"):\n *\n * - **Collect pass** — calls the thunk (starting the fetch) and records the\n * promise on the enclosing boundary, so sibling reads start in one wave.\n * The read is keyed by getter identity (watched object + property key), so\n * reading the same getter again reuses the recorded fetch. Returns\n * `undefined`; the speculative pass's output is discarded.\n * - **Render pass** — returns the settled value for the same getter identity,\n * without calling the thunk again. The pass may read a getter any number of\n * times, so markup may branch on the resolved value. A rejection is\n * re-thrown here so `@try`/`@error` handles it like any other render error.\n * Reading a getter the collect pass never touched throws a sentinel that\n * degrades the boundary (its value can't be resolved without fetching, and\n * the shipped HTML can't be trusted).\n *\n * Outside any `@await` boundary (including in a `with` branch) a\n * `source: \"server\"` read returns `undefined` without fetching — the same\n * undefined-then-recover contract the client has for un-boundaried reads.\n */\nexport default function $serverAsync<T>(\n\tfn: (serverValue?: T) => Promise<T>,\n\toptions?: AsyncOptions,\n): T {\n\tconst state = currentServerAwait();\n\n\tif (state === null || state.isRoot || options?.source !== \"server\") {\n\t\tif (state !== null && !state.isRoot && state.phase === \"render\") {\n\t\t\t// A client-fetch read during a boundary's render pass: the client\n\t\t\t// will suspend on it, so the boundary can't ship resolved content\n\t\t\tstate.clientReads++;\n\t\t}\n\t\treturn undefined as T;\n\t}\n\n\t// Identity captured before the thunk runs: reads inside the thunk (e.g.\n\t// `$state.id`) must not be mistaken for the getter being read here\n\tconst site = currentServerReadSite();\n\tconst owner = site?.owner ?? null;\n\tconst key = site?.key ?? fn.toString();\n\n\tif (state.phase === \"collect\") {\n\t\t// A repeated read of the same getter shares the first fetch\n\t\tconst existing = findEntry(state, owner, key);\n\t\tif (existing === undefined) {\n\t\t\tconst entry: ServerPromiseEntry = {\n\t\t\t\towner,\n\t\t\t\tkey,\n\t\t\t\tpromise: fn(),\n\t\t\t\ttimeout: options.timeout ?? SERVER_ASYNC_TIMEOUT,\n\t\t\t};\n\t\t\t// Record the outcome as soon as it settles — this both captures the\n\t\t\t// value/error for the render pass and consumes the rejection, so a\n\t\t\t// boundary that degrades (timeout) or a superseded fetch can never\n\t\t\t// surface as an unhandled rejection\n\t\t\tentry.promise.then(\n\t\t\t\t(value) => {\n\t\t\t\t\tentry.result = { ok: true, value };\n\t\t\t\t},\n\t\t\t\t(error) => {\n\t\t\t\t\tentry.result = { ok: false, error };\n\t\t\t\t},\n\t\t\t);\n\t\t\tstate.promises.push(entry);\n\t\t}\n\t\treturn undefined as T;\n\t}\n\n\t// Render pass: look the recorded read up by getter identity\n\tconst entry = findEntry(state, owner, key);\n\tif (entry === undefined) {\n\t\tthrow new ServerAwaitMisaligned();\n\t}\n\tif (!state.renderSeen.has(entry)) {\n\t\tstate.renderSeen.add(entry);\n\t\tstate.renderEntries.push(entry);\n\t}\n\tconst result = entry.result;\n\tif (result === undefined) {\n\t\t// Not settled — only possible when the boundary already blew its\n\t\t// timeout, which degrades before rendering; treat as misaligned\n\t\tthrow new ServerAwaitMisaligned();\n\t}\n\tif (result.ok) {\n\t\treturn result.value as T;\n\t}\n\tthrow result.error;\n}\n\nfunction findEntry(\n\tstate: ServerAwaitState,\n\towner: object | null,\n\tkey: PropertyKey | string,\n): ServerPromiseEntry | undefined {\n\tfor (const entry of state.promises) {\n\t\tif (entry.owner === owner && entry.key === key) {\n\t\t\treturn entry;\n\t\t}\n\t}\n\treturn undefined;\n}\n","export default function $serverBatch<T>(fn: () => T): T {\n\treturn fn();\n}\n","/**\n * Server no-op for the client-side `$bind` two-way sync primitive. Two-way\n * binding is a client runtime feature — there are no reactive updates during\n * SSR, so there is nothing to sync. The stub exists so server builds\n * importing `$bind` don't emit a dangling import.\n */\nexport default function $serverBind(\n\t_state: Record<PropertyKey, any>,\n\t_props: Record<PropertyKey, any> | undefined,\n\t..._keys: (string | string[])[]\n): void {}\n","export default function $serverCache<T>(fn: () => T): T {\n\treturn fn();\n}\n","import type Cleanup from \"../types/Cleanup\";\n\nexport default function $serverOnmount(_fn: () => Cleanup | void): void {}\n","export default function $serverPeek<T>(fn: () => T): T {\n\treturn fn();\n}\n","/**\n * Server no-op for the client-side `$pending` query. Nothing is ever pending\n * during a synchronous SSR render, so the query is always `false`. The stub\n * exists so server builds importing `$pending` don't emit a dangling import.\n */\nexport default function $serverPending(_fn: () => any): boolean {\n\treturn false;\n}\n","/**\n * Server no-op for the client-side `$refresh` primitive. A refresh is an\n * imperative action that never runs during SSR. The stub exists so server\n * builds importing `$refresh` don't emit a dangling import.\n */\nexport default function $serverRefresh(_fn: () => any): void {}\n","import type Cleanup from \"../types/Cleanup\";\n\nexport default function $serverRun(_fn: () => Cleanup | void): void {}\n","import type StreamSource from \"../types/StreamSource\";\n\n/**\n * Server stub for `$stream` — external sources are never subscribed to\n * during a server render. The subscription starts when the component is\n * mounted on the client.\n */\nexport default function $serverStream<T>(\n\t_source: StreamSource<T>,\n\t_handler: (value: T) => void,\n\t_options?: { debounce?: number },\n): void {}\n","export default function $serverUnwrap<T extends Record<PropertyKey, any>>(object: T): T {\n\treturn object;\n}\n","import { newServerAwaitState, withServerAwait } from \"./serverAwaitState\";\nimport type ServerAwaitState from \"./serverAwaitState\";\n\n/** Comment prefix marking an unsubstituted boundary sentinel. */\nexport const SENTINEL_PREFIX = \"<!--t-aw:\";\n\n/** The body/head pair that server components and boundaries render into. */\nexport interface ServerHtml {\n\tbody: string;\n\thead: string;\n}\n\n/**\n * Renders a component's (or a degraded boundary's `with` branch's) markup\n * with a fresh flush root as the enclosing await state, then substitutes any\n * boundary sentinels with their final HTML.\n *\n * Boundaries created during the render stash their lifecycle promise under a\n * sentinel comment and return the sentinel immediately, so the render itself\n * never blocks on a fetch — every `source: \"server\"` read in the render\n * starts in the same wave. Substitution awaits the stashed promises at the\n * end, which is the only point an async component render actually waits.\n *\n * On the client this has no counterpart: `render` here is the compiled\n * component body closure that the generated component function returns.\n */\nexport async function serverFlush(render: () => Promise<ServerHtml>): Promise<ServerHtml> {\n\tconst state = newServerAwaitState();\n\tstate.isRoot = true;\n\tconst result = await withServerAwait(state, render);\n\treturn substituteSentinels(result, state);\n}\n\n/**\n * Renders a degraded boundary's `with` branch inside its own flush root, so\n * a `with` branch containing its own `@await` boundaries still resolves\n * them, then wraps it in the boundary's hydration markers. The `with` branch\n * must not start server fetches for its own reads — the flush root isn't a\n * recording context.\n */\nexport async function renderWithBranch(\n\trenderWith: (() => Promise<ServerHtml>) | null,\n): Promise<ServerHtml> {\n\tconst html = await serverFlush(async () => {\n\t\tif (renderWith === null) {\n\t\t\treturn { body: \"\", head: \"\" };\n\t\t}\n\t\treturn renderWith();\n\t});\n\treturn { body: `<![>${html.body}<!]><!>`, head: html.head };\n}\n\n/**\n * Replaces every sentinel the state stashed with its boundary's final HTML.\n * Boundary head tags are appended to the head (they hoist into the document\n * head regardless of where the boundary sits in the body). Any sentinel left\n * over means a boundary's state was lost — a bug, not a degradation path, so\n * it throws.\n */\nexport async function substituteSentinels(\n\tresult: ServerHtml,\n\tstate: ServerAwaitState,\n): Promise<ServerHtml> {\n\tlet { body, head } = result;\n\tfor (const [sentinel, promise] of state.sentinels) {\n\t\tconst html = await promise;\n\t\tbody = body.split(sentinel).join(html.body);\n\t\thead += html.head;\n\t}\n\tif (body.includes(SENTINEL_PREFIX) || head.includes(SENTINEL_PREFIX)) {\n\t\tthrow new Error(\"Unsubstituted async boundary sentinel — boundary state was lost\");\n\t}\n\treturn { body, head };\n}\n","import {\n\tchildKey,\n\tcurrentServerAwait,\n\tnewServerAwaitState,\n\tServerAwaitMisaligned,\n\twithServerAwait,\n} from \"./serverAwaitState\";\nimport type ServerAwaitState from \"./serverAwaitState\";\nimport { renderWithBranch } from \"./serverSentinels\";\n\nlet sentinelCount = 0;\n\nfunction nextSentinel(): string {\n\treturn `<!--t-aw:${sentinelCount++}-->`;\n}\n\n/**\n * Renders an `@await` boundary on the server (compiled as `t_await_server`).\n *\n * The generated code calls this for every `@await`, passing the boundary's\n * site id, a closure that renders the content branch, and one that renders\n * the `with` branch. It always returns a `{ body, head }` pair to append:\n *\n * - **Inside a boundary's render pass** — this boundary was already started\n * during the collect pass; its body/head is the finished HTML (awaited if\n * still in flight). A missing entry means the render pass doesn't match\n * the collect pass, which degrades the enclosing boundary.\n * - **Inside a collect pass or a component flush** — start the full\n * lifecycle (collect, settle, render) without blocking the enclosing\n * render, and return a sentinel comment as the body. Sibling reads and\n * nested boundaries keep rendering, so every fetch in the pass starts in\n * one wave. The sentinel is substituted later: by the enclosing boundary's\n * render pass (which re-invokes this helper and awaits the finished HTML),\n * or by the component flush (which replaces top-level sentinels directly).\n *\n * The lifecycle: render content once to start the `source: \"server\"` fetches\n * (discarding the output), wait for them with a per-getter timeout, then\n * render again with the settled values. Reads are matched by getter identity,\n * so the render pass may read a getter more than once (e.g. branch on it).\n * The second pass ships wrapped in hydration markers plus a\n * `<!--t-await:...-->` comment carrying the values for the client's `$async`\n * hydration path. Any instability — timeout, a render pass that reads a getter\n * the collect pass never touched, a client-fetch read — degrades to the `with`\n * branch + client fetch, exactly the pre-`source` behavior.\n *\n * @param id The boundary's site id (unique per `@await` in the component)\n * @param renderContent Renders the content branch (may read `$async` getters)\n * @param renderWith Renders the `with` branch, or null for empty\n */\nexport default function runServerAwait(\n\tid: string,\n\trenderContent: () => Promise<{ body: string; head: string }>,\n\trenderWith: (() => Promise<{ body: string; head: string }>) | null,\n): { body: string; head: string } | Promise<{ body: string; head: string }> {\n\tconst parent = currentServerAwait();\n\n\tif (parent !== null && parent.phase === \"render\") {\n\t\t// The enclosing boundary is rendering its resolved pass: this nested\n\t\t// boundary was started during the collect pass, so reuse its result\n\t\tconst cached = parent.children.get(childKey(parent, id));\n\t\tif (cached === undefined) {\n\t\t\tthrow new ServerAwaitMisaligned();\n\t\t}\n\t\treturn cached;\n\t}\n\n\tconst state = newServerAwaitState();\n\tconst final = renderBoundary(state, renderContent, renderWith);\n\n\tconst sentinel = nextSentinel();\n\tif (parent !== null) {\n\t\tif (parent.isRoot) {\n\t\t\t// Top-level boundary: the component flush substitutes the sentinel\n\t\t\tparent.sentinels.set(sentinel, final);\n\t\t} else {\n\t\t\t// Nested boundary: the enclosing boundary's render pass looks this\n\t\t\t// up by occurrence key\n\t\t\tparent.children.set(childKey(parent, id), final);\n\t\t}\n\t}\n\t// The sentinel body is replaced by the finished content; the head tags a\n\t// resolved boundary renders are hoisted when it finishes\n\treturn { body: sentinel, head: \"\" };\n}\n\n/**\n * The full lifecycle for one boundary: speculative collect pass, settle, and\n * resolved render pass. Runs concurrently with the enclosing render; the\n * returned promise resolves to the boundary's final HTML.\n */\nasync function renderBoundary(\n\tstate: ServerAwaitState,\n\trenderContent: () => Promise<{ body: string; head: string }>,\n\trenderWith: (() => Promise<{ body: string; head: string }>) | null,\n): Promise<{ body: string; head: string }> {\n\t// Collect pass: render content speculatively to invoke the getters. Each\n\t// `source: \"server\"` read starts its fetch and is recorded; sibling reads\n\t// in this pass therefore start together. The output is discarded — reads\n\t// return undefined, so user markup that dereferences them may throw, and\n\t// a throw here costs nothing.\n\tawait withServerAwait(state, renderContent).catch(() => {\n\t\t// Expected when unresolved values are dereferenced; fetches already\n\t\t// started. Any other error resurfaces in the render pass below.\n\t});\n\n\tif (state.promises.length === 0) {\n\t\t// No server-source reads: nothing was (or can be) resolved here, so\n\t\t// ship the `with` branch and let the client fetch — the default SSR\n\t\t// behavior for client-fetch getters\n\t\treturn renderWithBranch(renderWith);\n\t}\n\n\t// Settle the recorded fetches. Each getter carries its own timeout; the\n\t// boundary waits for the longest, and a miss degrades the whole boundary\n\t// (content ships only when every read resolved)\n\tconst timeout = Math.max(...state.promises.map((entry) => entry.timeout));\n\tconst settled = await Promise.race([\n\t\tPromise.all(\n\t\t\tstate.promises.map((entry) =>\n\t\t\t\tentry.promise.then(\n\t\t\t\t\t() => true,\n\t\t\t\t\t() => true,\n\t\t\t\t),\n\t\t\t),\n\t\t).then(\n\t\t\t() => true,\n\t\t\t() => true,\n\t\t),\n\t\tnew Promise<false>((resolve) => setTimeout(resolve, timeout, false)),\n\t]);\n\n\t// Render pass: same reads, now looking settled values up by getter\n\t// identity. The pass may read a getter more than once (markup can branch\n\t// on its value), but every read must have been recorded by the collect\n\t// pass. A read the collect pass never touched, a client-fetch read, or a\n\t// render error means the content can't be trusted, and the boundary\n\t// degrades.\n\t//\n\t// A rejection (or any render error) also degrades: the boundary's\n\t// lifecycle runs detached from the enclosing render (which has already\n\t// moved on after the sentinel), so the error can't propagate to the\n\t// emitted `@try` positionally. Instead the with branch ships and the\n\t// client re-runs the getter, rejects there, and its `@try` renders the\n\t// catch branch — the same path a client-fetch error takes.\n\tlet degraded = settled === false;\n\tlet content: { body: string; head: string } | undefined;\n\tif (!degraded) {\n\t\tstate.phase = \"render\";\n\t\tstate.renderEntries.length = 0;\n\t\tstate.renderSeen.clear();\n\t\tstate.clientReads = 0;\n\t\tstate.counters.clear();\n\t\ttry {\n\t\t\tcontent = await withServerAwait(state, renderContent);\n\t\t\tif (state.clientReads > 0) {\n\t\t\t\tdegraded = true;\n\t\t\t}\n\t\t} catch {\n\t\t\tdegraded = true;\n\t\t}\n\t}\n\n\tif (degraded || content === undefined) {\n\t\tstate.degraded = true;\n\t\ttry {\n\t\t\treturn await renderWithBranch(renderWith);\n\t\t} catch {\n\t\t\t// A with-branch render error can't be positioned either; ship an\n\t\t\t// empty boundary rather than failing the whole response\n\t\t\treturn { body: \"<![><!]><!>\", head: \"\" };\n\t\t}\n\t}\n\n\t// Ship the resolved content with the embedded values for hydration.\n\t// Rejections never reach here — the render pass consumes them and\n\t// degrades — but guard anyway so a bad entry can't ship as `undefined`\n\tconst values: any[] = [];\n\tfor (const entry of state.renderEntries) {\n\t\tconst result = entry.result;\n\t\tif (result === undefined) {\n\t\t\tdegraded = true;\n\t\t\tbreak;\n\t\t}\n\t\tvalues.push(result.ok ? result.value : undefined);\n\t}\n\tif (degraded) {\n\t\tstate.degraded = true;\n\t\treturn renderWithBranch(renderWith);\n\t}\n\treturn {\n\t\tbody: `${\"<![>\"}${content.body}${\"<!]><!>\"}${payloadComment(values)}`,\n\t\thead: content.head,\n\t};\n}\n\n/**\n * The `<!--t-await:...-->` comment carrying the boundary's resolved values,\n * in the order the render pass first read them, for the client's `$async`\n * hydration path. `-->` inside the JSON is escaped so the comment can't\n * terminate early.\n */\nfunction payloadComment(values: any[]): string {\n\tconst json = JSON.stringify(values).replaceAll(\"-->\", \"--\\\\u003E\");\n\treturn `<!--t-await:${json}-->`;\n}\n","/**\n * Server stubs for the client-only runtime, so that modules compiled for the\n * client -- or shared helpers that import them from the main `@torpor/view`\n * entry -- still resolve when they end up in a server bundle (the SSR\n * environment resolves `@torpor/view` to this module; see @torpor/build's\n * ssr-view plugin).\n *\n * They throw when called: mounting, hydrating and DOM rendering must not run\n * during SSR. Importing them is fine, which keeps a stray client-only import\n * from failing the server build.\n */\ntype Unavailable = (...args: unknown[]) => never;\n\nfunction unavailable(name: string): Unavailable {\n\treturn (..._args: unknown[]): never => {\n\t\tthrow new Error(`${name} is not available during server rendering`);\n\t};\n}\n\nexport const mount: Unavailable = unavailable(\"mount\");\nexport const hydrate: Unavailable = unavailable(\"hydrate\");\nexport const unmount: Unavailable = unavailable(\"unmount\");\nexport const fillLayoutSlot: Unavailable = unavailable(\"fillLayoutSlot\");\nexport const clearLayoutSlot: Unavailable = unavailable(\"clearLayoutSlot\");\n\nexport const t_add_element: Unavailable = unavailable(\"t_add_element\");\nexport const t_add_fragment: Unavailable = unavailable(\"t_add_fragment\");\nexport const t_anchor: Unavailable = unavailable(\"t_anchor\");\nexport const t_animate: Unavailable = unavailable(\"t_animate\");\nexport const t_apply_props: Unavailable = unavailable(\"t_apply_props\");\nexport const t_attribute: Unavailable = unavailable(\"t_attribute\");\nexport const t_child: Unavailable = unavailable(\"t_child\");\nexport const t_dynamic: Unavailable = unavailable(\"t_dynamic\");\nexport const t_event: Unavailable = unavailable(\"t_event\");\nexport const t_first_inside: Unavailable = unavailable(\"t_first_inside\");\nexport const t_fragment: Unavailable = unavailable(\"t_fragment\");\nexport const t_fragment_el: Unavailable = unavailable(\"t_fragment_el\");\nexport const t_head_element: Unavailable = unavailable(\"t_head_element\");\nexport const t_list_item: Unavailable = unavailable(\"t_list_item\");\nexport const t_next: Unavailable = unavailable(\"t_next\");\nexport const t_pop_region: Unavailable = unavailable(\"t_pop_region\");\nexport const t_push_region: Unavailable = unavailable(\"t_push_region\");\nexport const t_region: Unavailable = unavailable(\"t_region\");\nexport const t_rerun_region_effects: Unavailable = unavailable(\"t_rerun_region_effects\");\nexport const t_restore_hydration: Unavailable = unavailable(\"t_restore_hydration\");\nexport const t_root: Unavailable = unavailable(\"t_root\");\nexport const t_root_el: Unavailable = unavailable(\"t_root_el\");\nexport const t_run_await: Unavailable = unavailable(\"t_run_await\");\nexport const t_run_branch: Unavailable = unavailable(\"t_run_branch\");\nexport const t_run_control: Unavailable = unavailable(\"t_run_control\");\nexport const t_run_list: Unavailable = unavailable(\"t_run_list\");\nexport const t_run_try: Unavailable = unavailable(\"t_run_try\");\nexport const t_save_hydration: Unavailable = unavailable(\"t_save_hydration\");\nexport const t_skip: Unavailable = unavailable(\"t_skip\");\n"],"mappings":";;AAAA,SAAwB,oBAAoB,OAAoB;CAC/D,QAAQ,SAAS,GAAA,CAAI,SAAS,CAAC,CAAC,WAAW,MAAK,QAAQ;AACzD;;;ACAA,MAAM,YAAoC;CACzC,KAAK;CACL,KAAK;CACL,KAAK;AACN;;;;;;;;AASA,SAAwB,iBAAiB,OAAoB;CAC5D,OAAO,WAAW,KAAK,CAAC,CAAC,QAAQ,WAAW,MAAM,UAAU,EAAE;AAC/D;;;ACLA,IAAI,cAAqC;;AAGzC,SAAgB,wBAA+C;CAC9D,OAAO;AACR;;;;;;;;;;;;AAaA,SAAwB,aAAiD,QAAc;CACtF,IAAI,WAAW,QAAQ,WAAW,KAAA,GACjC,OAAO;CAER,MAAM,YAAY,OAAO,eAAe,MAAM;CAC9C,IAAI,CAAC,MAAM,QAAQ,MAAM,KAAK,cAAc,OAAO,aAAa,cAAc,MAC7E,OAAO;CAGR,OAAO,IAAI,MAAM,QAAQ,EACxB,IAAI,QAAQ,KAAK,UAAU;EAE1B,IADmB,OAAO,yBAAyB,QAAQ,GAC9C,CAAC,EAAE,QAAQ,KAAA,GACvB,OAAO,QAAQ,IAAI,QAAQ,KAAK,QAAQ;EAEzC,MAAM,WAAW;EACjB,cAAc;GAAE,OAAO;GAAQ;EAAI;EACnC,IAAI;GACH,OAAO,QAAQ,IAAI,QAAQ,KAAK,QAAQ;EACzC,UAAU;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B,YAAY,YAAY;AAC/D,MAAa,YAAyB,YAAY,WAAW;AAC7D,MAAa,mBAAgC,YAAY,kBAAkB;AAC3E,MAAa,SAAsB,YAAY,QAAQ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@torpor/view",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Torpor's view library, for writing and mounting components",
5
5
  "type": "module",
6
6
  "exports": {
@@ -41,18 +41,18 @@
41
41
  "devDependencies": {
42
42
  "@testing-library/dom": "^10.4.2",
43
43
  "@testing-library/jest-dom": "^7.0.1",
44
- "@testing-library/user-event": "^14.6.7",
44
+ "@testing-library/user-event": "^14.6.8",
45
45
  "@types/jsdom": "^30.0.0",
46
- "@types/node": "^26.6.4",
46
+ "@types/node": "^26.6.5",
47
47
  "@typescript/native-preview": "7.0.0-dev.20260707.2",
48
48
  "fast-glob": "^3.3.3",
49
49
  "jsdom": "^30.1.2",
50
50
  "sucrase": "^3.35.1",
51
- "tinybench": "^6.2.1",
51
+ "tinybench": "^6.2.2",
52
52
  "tsx": "^4.23.15",
53
53
  "typescript": "^7.0.2",
54
- "vite": "npm:@voidzero-dev/vite-plus-core@1.1.0",
55
- "vite-plus": "1.1.0"
54
+ "vite": "npm:@voidzero-dev/vite-plus-core@1.2.0",
55
+ "vite-plus": "1.2.0"
56
56
  },
57
57
  "scripts": {
58
58
  "check": "tsgo --noEmit && pnpm dlx oxlint --type-aware",