@verajs/ssr 0.2.1 → 0.3.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.
Files changed (63) hide show
  1. package/README.md +522 -390
  2. package/dist/vera/diagnostics.d.ts +20 -0
  3. package/dist/vera/diagnostics.js +102 -0
  4. package/dist/vera/escaping.d.ts +155 -0
  5. package/dist/vera/escaping.js +293 -0
  6. package/dist/vera/events.d.ts +41 -0
  7. package/dist/vera/events.js +162 -0
  8. package/dist/vera/frames.d.ts +38 -0
  9. package/dist/vera/frames.js +195 -0
  10. package/dist/vera/index.d.ts +48 -0
  11. package/dist/vera/index.js +480 -0
  12. package/{types → dist/vera}/nodes.d.ts +389 -302
  13. package/dist/vera/nodes.js +2339 -0
  14. package/dist/vera/parse.d.ts +53 -0
  15. package/dist/vera/parse.js +485 -0
  16. package/dist/vera/reflections.d.ts +566 -0
  17. package/dist/vera/reflections.js +820 -0
  18. package/dist/vera/registry.d.ts +14 -0
  19. package/{src → dist}/vera/registry.js +5 -1
  20. package/dist/vera/report.d.ts +27 -0
  21. package/dist/vera/report.js +56 -0
  22. package/dist/vera/scan.d.ts +37 -0
  23. package/dist/vera/scan.js +143 -0
  24. package/dist/vera/select.d.ts +40 -0
  25. package/dist/vera/select.js +261 -0
  26. package/dist/vera/serializer.d.ts +39 -0
  27. package/dist/vera/serializer.js +1521 -0
  28. package/dist/vera/shim.d.ts +42 -0
  29. package/dist/vera/shim.js +853 -0
  30. package/dist/vera/slots.d.ts +5 -0
  31. package/dist/vera/slots.js +104 -0
  32. package/dist/vera/stylesheets.d.ts +62 -0
  33. package/dist/vera/stylesheets.js +180 -0
  34. package/dist/vera/tokenizer.d.ts +32 -0
  35. package/dist/vera/tokenizer.js +553 -0
  36. package/dist/vera/types.d.ts +121 -0
  37. package/dist/vera/views.d.ts +63 -0
  38. package/dist/vera/views.js +245 -0
  39. package/package.json +12 -13
  40. package/src/vera/escaping.js +0 -135
  41. package/src/vera/events.js +0 -164
  42. package/src/vera/frames.js +0 -102
  43. package/src/vera/index.js +0 -1187
  44. package/src/vera/nodes.js +0 -2294
  45. package/src/vera/parse.js +0 -381
  46. package/src/vera/reflections.js +0 -811
  47. package/src/vera/select.js +0 -234
  48. package/src/vera/serializer.js +0 -1080
  49. package/src/vera/shim.js +0 -761
  50. package/src/vera/stylesheets.js +0 -155
  51. package/src/vera/views.js +0 -240
  52. package/types/escaping.d.ts +0 -27
  53. package/types/events.d.ts +0 -4
  54. package/types/frames.d.ts +0 -12
  55. package/types/index.d.ts +0 -13
  56. package/types/parse.d.ts +0 -19
  57. package/types/reflections.d.ts +0 -657
  58. package/types/registry.d.ts +0 -8
  59. package/types/select.d.ts +0 -5
  60. package/types/serializer.d.ts +0 -26
  61. package/types/shim.d.ts +0 -23
  62. package/types/stylesheets.d.ts +0 -53
  63. package/types/views.d.ts +0 -26
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Event dispatch with a propagation path.
3
+ *
4
+ * **Bubbling was absent, and the README said why**: this DOM held children as a string, so there was
5
+ * no ancestor chain to walk and an event reached its own target's listeners and stopped. Child nodes
6
+ * are retained now, so the chain exists and the reason has expired — a component dispatching a
7
+ * `CustomEvent` that a parent listens for worked in the browser and did nothing on the server.
8
+ *
9
+ * The listeners live here rather than in the `EventTarget` these classes extend, because that one
10
+ * cannot be asked to run *only* its capturing listeners: a direct dispatch runs them all, so the
11
+ * three phases could not be told apart. What it did give — `once`, `handleEvent` objects, and a
12
+ * return value reflecting `preventDefault` — is reproduced here and covered by the same tests.
13
+ */
14
+ import { PROSE } from './diagnostics.js';
15
+ import { once, ssrWarning } from './report.js';
16
+ import { currentRenderingTag } from './stylesheets.js';
17
+ const capturing = (options) => typeof options === 'boolean' ? options : Boolean(options?.capture);
18
+ /**
19
+ * The path from a node out to its furthest ancestor, crossing a shadow boundary only for an event
20
+ * declared `composed` — which is the rule that keeps a component's internals private.
21
+ */
22
+ export const pathFrom = (node, composed) => {
23
+ const path = [];
24
+ for (let current = node; current;) {
25
+ path.push(current);
26
+ if (current._parent) {
27
+ current = current._parent;
28
+ continue;
29
+ }
30
+ current = composed && current._host ? current._host : null;
31
+ }
32
+ return path;
33
+ };
34
+ export const addListener = (node, type, callback, options) => {
35
+ if (!callback)
36
+ return;
37
+ const listeners = (node._listeners ??= new Map());
38
+ const key = `${type}`;
39
+ const entries = listeners.get(key) ?? [];
40
+ const capture = capturing(options);
41
+ /** The platform ignores a duplicate registration of the same callback in the same phase. */
42
+ if (entries.some((entry) => entry.callback === callback && entry.capture === capture))
43
+ return;
44
+ entries.push({ callback, capture, once: Boolean(options?.once) });
45
+ listeners.set(key, entries);
46
+ options?.signal?.addEventListener?.('abort', () => removeListener(node, type, callback, options));
47
+ };
48
+ export const removeListener = (node, type, callback, options) => {
49
+ const entries = node._listeners?.get(`${type}`);
50
+ if (!entries)
51
+ return;
52
+ const capture = capturing(options);
53
+ const index = entries.findIndex((entry) => entry.callback === callback && entry.capture === capture);
54
+ if (index !== -1)
55
+ entries.splice(index, 1);
56
+ };
57
+ /**
58
+ * `Event.CAPTURING_PHASE`, `AT_TARGET`, `BUBBLING_PHASE` — the numbers every engine reports, and
59
+ * which `installShims` also puts on `Event.prototype` where a browser has them and Node does not.
60
+ */
61
+ const PHASES = { capture: 1, target: 2, bubble: 3 };
62
+ /**
63
+ * Run the listeners registered on one node for one phase.
64
+ */
65
+ const runListeners = (node, event, phase, immediatelyStopped) => {
66
+ const entries = node._listeners?.get(event.type);
67
+ if (!entries?.length)
68
+ return;
69
+ Object.defineProperty(event, 'currentTarget', { value: node, configurable: true });
70
+ /**
71
+ * **`eventPhase` said `NONE` for the whole dispatch**, where every engine reports 1, 2 and 3.
72
+ * `event.eventPhase === event.AT_TARGET` is the ordinary way a component asks "was this mine, or
73
+ * a descendant's?", so the server took the other branch from the client for an event both of them
74
+ * dispatched — with nothing to show for it until the two renders disagreed somewhere else.
75
+ */
76
+ Object.defineProperty(event, 'eventPhase', { value: PHASES[phase], configurable: true });
77
+ /** A copy, because a listener may add or remove listeners while this runs. */
78
+ for (const entry of [...entries]) {
79
+ if (phase === 'capture' && !entry.capture)
80
+ continue;
81
+ if (phase === 'bubble' && entry.capture)
82
+ continue;
83
+ if (entry.once)
84
+ removeListener(node, event.type, entry.callback, entry.capture);
85
+ try {
86
+ if (typeof entry.callback === 'function')
87
+ entry.callback.call(node, event);
88
+ else
89
+ entry.callback?.handleEvent?.(event);
90
+ }
91
+ catch (error) {
92
+ /** A listener that throws must not take the dispatch down, exactly as in a browser. */
93
+ const tag = currentRenderingTag();
94
+ if (once('ssr-listener-threw', `${tag} ${event.type}`))
95
+ console.error('%s', ssrWarning((tag ? `<${tag}>` : 'the page'), 'ssr-listener-threw', PROSE['ssr-listener-threw'](event.type)), error);
96
+ }
97
+ if (immediatelyStopped())
98
+ return;
99
+ }
100
+ };
101
+ /**
102
+ * `event` is `unknown` because it is checked here: anything but an `Event` is refused, as every engine refuses it.
103
+ *
104
+ * @returns false when a cancelable event was prevented, as the platform reports
105
+ */
106
+ export const dispatch = (node, event) => {
107
+ /**
108
+ * **An `Event`, not something shaped like one.** This checked `typeof event.type === 'string'`,
109
+ * which `{ type: 'click' }` satisfies — so the server accepted a dispatch every engine refuses
110
+ * with a `TypeError`, and the code that made it got as far as the client before failing. Being
111
+ * lenient here does not make anything work; it moves the failure and strips the context.
112
+ */
113
+ if (!(event instanceof Event))
114
+ throw new TypeError(`Failed to execute 'dispatchEvent' on 'EventTarget': parameter 1 is not of type 'Event'.`);
115
+ const path = pathFrom(node, Boolean(event.composed));
116
+ let stopped = false;
117
+ let immediate = false;
118
+ /**
119
+ * Wrapped rather than read back: `cancelBubble` reflects `stopPropagation` on this platform's
120
+ * `Event`, but nothing exposes `stopImmediatePropagation`, and the two have to be told apart —
121
+ * one ends the walk, the other ends only the current node's listeners.
122
+ */
123
+ const original = {
124
+ stop: event.stopPropagation?.bind(event),
125
+ immediate: event.stopImmediatePropagation?.bind(event),
126
+ };
127
+ Object.defineProperty(event, 'stopPropagation', {
128
+ value: () => {
129
+ stopped = true;
130
+ original.stop?.();
131
+ },
132
+ configurable: true,
133
+ });
134
+ Object.defineProperty(event, 'stopImmediatePropagation', {
135
+ value: () => {
136
+ stopped = true;
137
+ immediate = true;
138
+ original.immediate?.();
139
+ },
140
+ configurable: true,
141
+ });
142
+ Object.defineProperty(event, 'target', { value: node, configurable: true });
143
+ Object.defineProperty(event, 'composedPath', { value: () => [...path], configurable: true });
144
+ const immediatelyStopped = () => {
145
+ if (!immediate)
146
+ return false;
147
+ immediate = false;
148
+ return true;
149
+ };
150
+ /** Capturing runs outermost first, and never on the target itself. */
151
+ for (let index = path.length - 1; index >= 1 && !stopped; index--)
152
+ runListeners(path[index], event, 'capture', immediatelyStopped);
153
+ if (!stopped)
154
+ runListeners(path[0], event, 'target', immediatelyStopped);
155
+ if (event.bubbles)
156
+ for (let index = 1; index < path.length && !stopped; index++)
157
+ runListeners(path[index], event, 'bubble', immediatelyStopped);
158
+ Object.defineProperty(event, 'currentTarget', { value: null, configurable: true });
159
+ /** Back to `NONE` once the dispatch is over, as the platform reports for a finished event. */
160
+ Object.defineProperty(event, 'eventPhase', { value: 0, configurable: true });
161
+ return !event.defaultPrevented;
162
+ };
@@ -0,0 +1,38 @@
1
+ /**
2
+ * `requestAnimationFrame` on a machine that has no frames. Callbacks queue here and are drained once a
3
+ * component's `connectedCallback` has returned — where a browser would run them, so a component's own
4
+ * ordering holds (work scheduled before `render()` still sees the template) — and drained REPEATEDLY, so
5
+ * the markup is where the client settles: an effect that derives state schedules another render, which is
6
+ * another frame.
7
+ */
8
+ /** One queued callback: handed the frame's timestamp, and allowed to return a promise — the asynchronous drain awaits it. */
9
+ type Frame = (time: number) => unknown;
10
+ /** Where a frame callback's throw is reported, so the render can fail naming the component. */
11
+ type FrameReport = (error: unknown) => void;
12
+ /** `requestAnimationFrame` (`isIdle` false) and `requestIdleCallback` (true): queue `fn`, answer its id. */
13
+ export declare const requestFrame: (fn: Frame, isIdle: boolean) => number;
14
+ /** `cancelAnimationFrame`/`cancelIdleCallback`: drops the callback with that id, if it is still waiting and of that kind. */
15
+ export declare const cancelFrame: (id: number, isIdle: boolean) => void;
16
+ export declare const setCoreFlush: (flush: () => void) => void;
17
+ /** Runs everything queued in core and waiting on a frame, and everything those schedule, up to the bound. */
18
+ export declare const flushFrames: (report?: FrameReport) => void;
19
+ /** Starts a render's budget; the timer itself is made only when something is first awaited. */
20
+ export declare const beginBudget: (milliseconds: number) => void;
21
+ /** Ends it — the timer cleared, so it never holds the process open — and answers whether it ran out. */
22
+ export declare const endBudget: () => boolean;
23
+ /**
24
+ * Awaits `value` if it is a promise, for no longer than the budget allows; a rejection still reaches the caller.
25
+ * Answers whether THIS wait was the one cut at the deadline — so the warning names the component still waiting, not
26
+ * only the page — and not for a wait abandoned unexamined after it, which was never shown to be stuck.
27
+ */
28
+ export declare const bounded: (value: unknown) => Promise<boolean>;
29
+ /**
30
+ * The same drain, for a render allowed to wait. A frame callback that starts asynchronous work —
31
+ * a router's first `navigate()`, awaiting guards and a route module — returns a promise the markup
32
+ * depends on, so it is awaited, and the microtask queue runs between rounds (`await null`, not a timer,
33
+ * so no unrelated request interleaves). **An empty queue is not the end** while such work is in flight:
34
+ * it takes three consecutive empty turns to conclude that nothing more is coming. Answers whether a wait was cut at
35
+ * the deadline, as `bounded` does.
36
+ */
37
+ export declare const flushFramesAsync: (report?: FrameReport) => Promise<boolean>;
38
+ export {};
@@ -0,0 +1,195 @@
1
+ /**
2
+ * `requestAnimationFrame` on a machine that has no frames. Callbacks queue here and are drained once a
3
+ * component's `connectedCallback` has returned — where a browser would run them, so a component's own
4
+ * ordering holds (work scheduled before `render()` still sees the template) — and drained REPEATEDLY, so
5
+ * the markup is where the client settles: an effect that derives state schedules another render, which is
6
+ * another frame.
7
+ */
8
+ /**
9
+ * **Callbacks awaiting a frame that will not arrive on its own, by the id they were given.** The ids are the
10
+ * platform's: unique and increasing for the life of the page, never reused, and a cancel of one that already ran, or
11
+ * of one that never existed, does nothing. They used to be queue positions, which restarted at 1 after every drain,
12
+ * so a component canceling its OWN finished frame deleted whichever callback now sat at that position; and a cancel
13
+ * from inside a frame never reached a callback of the same frame, already taken off the queue. A `Map` keeps the order
14
+ * they were requested in, which is the order they run.
15
+ */
16
+ const frames = new Map();
17
+ /** The ids that are idle callbacks: a browser keeps those apart, so `cancelIdleCallback` never cancels a frame. */
18
+ const idle = new Set();
19
+ let lastId = 0;
20
+ /** `requestAnimationFrame` (`isIdle` false) and `requestIdleCallback` (true): queue `fn`, answer its id. */
21
+ export const requestFrame = (fn, isIdle) => {
22
+ const id = ++lastId;
23
+ frames.set(id, fn);
24
+ if (isIdle)
25
+ idle.add(id);
26
+ return id;
27
+ };
28
+ /** `cancelAnimationFrame`/`cancelIdleCallback`: drops the callback with that id, if it is still waiting and of that kind. */
29
+ export const cancelFrame = (id, isIdle) => {
30
+ if (idle.has(id) !== isIdle)
31
+ return;
32
+ frames.delete(id);
33
+ idle.delete(id);
34
+ };
35
+ /**
36
+ * One round: every callback waiting when it starts — those a callback schedules have later ids and run in the NEXT
37
+ * round, as the next frame — each taken off as it runs, so a callback canceling a later one of the same round stops
38
+ * it, exactly as a browser's frame does. Walked in place: a `Map` iterates in insertion order, skips entries deleted
39
+ * mid-walk and stops here at the round's last id, so a round allocates nothing (a copied id list per round cost a page
40
+ * of 100 components 17% at steady state).
41
+ */
42
+ const round = (report) => {
43
+ const last = lastId;
44
+ for (const [id, fn] of frames) {
45
+ if (id > last)
46
+ break;
47
+ frames.delete(id);
48
+ if (idle.size !== 0)
49
+ idle.delete(id);
50
+ run(fn, report);
51
+ }
52
+ };
53
+ /** A loop that never settles leaves work queued; it must not reach the next component. */
54
+ const discard = () => {
55
+ if (frames.size !== 0)
56
+ frames.clear();
57
+ if (idle.size !== 0)
58
+ idle.clear();
59
+ };
60
+ /**
61
+ * How many rounds one render drains. The bound is for a component that schedules a frame from inside a
62
+ * frame forever — an animation loop, browser-only code reachable here — which runs a few times and stops
63
+ * rather than hanging the request.
64
+ */
65
+ const FRAME_ROUNDS = 20;
66
+ /**
67
+ * One frame callback, isolated: a browser runs each independently and reports a throw rather than
68
+ * abandoning the frame, and here the throw is REPORTED (`report`) so the render fails naming the
69
+ * component, the way a hook error does.
70
+ */
71
+ const run = (frame, report) => {
72
+ try {
73
+ return frame(performance.now());
74
+ }
75
+ catch (error) {
76
+ report?.(error);
77
+ }
78
+ };
79
+ /**
80
+ * **Core's flush** — every queued render, layout effect and effect, run now. Core flushes as a microtask (within its
81
+ * budget), so the synchronous chain, which serializes without yielding, would otherwise serialize before a write's
82
+ * re-render, while the asynchronous chain, which yields, would not: the two disagreed about the same page. Each round
83
+ * of a drain runs it first, so renders and frames interleave until both are empty — and both chains serialize the
84
+ * same settled markup. Set by `index.ts` from the core it wires (the one the page's components import).
85
+ */
86
+ let flushCore = () => { };
87
+ export const setCoreFlush = (flush) => {
88
+ flushCore = flush;
89
+ };
90
+ /** Runs everything queued in core and waiting on a frame, and everything those schedule, up to the bound. */
91
+ export const flushFrames = (report) => {
92
+ for (let count = 0; count < FRAME_ROUNDS; count++) {
93
+ flushCore();
94
+ if (frames.size === 0)
95
+ break;
96
+ round(report);
97
+ }
98
+ discard();
99
+ };
100
+ /**
101
+ * **The render's time budget: no server render waits unboundedly on a user promise.** An asynchronous render awaits
102
+ * what a component starts — an `async connectedCallback`, a promise a frame callback returns — and one that never
103
+ * settles (a wait on a child the server never defines, a forgotten `new Promise(() => {})`) held the request open for
104
+ * ever. Renders take turns (`takeTurn` in `index.ts`), so it held EVERY later request too: the whole server stopped.
105
+ * So each awaited promise races the time left in this render's budget (the `timeout` option, 2000 ms by default),
106
+ * which starts when the render's turn does. When it runs out the promise is abandoned — it may settle later, harmlessly
107
+ * — the render finishes with what it has, and `index.ts` says so in every build, because the served page changed.
108
+ */
109
+ const EXPIRED = Symbol('expired');
110
+ let deadline = Number.POSITIVE_INFINITY;
111
+ let expiry;
112
+ let timer;
113
+ let expired = false;
114
+ /** Starts a render's budget; the timer itself is made only when something is first awaited. */
115
+ export const beginBudget = (milliseconds) => {
116
+ deadline = performance.now() + milliseconds;
117
+ expiry = undefined;
118
+ expired = false;
119
+ };
120
+ /** Ends it — the timer cleared, so it never holds the process open — and answers whether it ran out. */
121
+ export const endBudget = () => {
122
+ if (timer !== undefined)
123
+ clearTimeout(timer);
124
+ timer = undefined;
125
+ deadline = Number.POSITIVE_INFINITY;
126
+ expiry = undefined;
127
+ const ranOut = expired;
128
+ expired = false;
129
+ return ranOut;
130
+ };
131
+ /**
132
+ * Awaits `value` if it is a promise, for no longer than the budget allows; a rejection still reaches the caller.
133
+ * Answers whether THIS wait was the one cut at the deadline — so the warning names the component still waiting, not
134
+ * only the page — and not for a wait abandoned unexamined after it, which was never shown to be stuck.
135
+ */
136
+ export const bounded = async (value) => {
137
+ if (value === null || (typeof value !== 'object' && typeof value !== 'function') || typeof value.then !== 'function')
138
+ return false;
139
+ const promise = Promise.resolve(value);
140
+ if (deadline === Number.POSITIVE_INFINITY) {
141
+ await promise;
142
+ return false;
143
+ }
144
+ if (expired) {
145
+ /** Past the budget nothing more is waited for — and a rejection that arrives later is not an unhandled one. */
146
+ promise.catch(() => { });
147
+ return false;
148
+ }
149
+ expiry ??= new Promise((done) => {
150
+ timer = setTimeout(() => done(EXPIRED), Math.max(0, deadline - performance.now()));
151
+ });
152
+ if ((await Promise.race([promise, expiry])) !== EXPIRED)
153
+ return false;
154
+ expired = true;
155
+ promise.catch(() => { });
156
+ return true;
157
+ };
158
+ /**
159
+ * The same drain, for a render allowed to wait. A frame callback that starts asynchronous work —
160
+ * a router's first `navigate()`, awaiting guards and a route module — returns a promise the markup
161
+ * depends on, so it is awaited, and the microtask queue runs between rounds (`await null`, not a timer,
162
+ * so no unrelated request interleaves). **An empty queue is not the end** while such work is in flight:
163
+ * it takes three consecutive empty turns to conclude that nothing more is coming. Answers whether a wait was cut at
164
+ * the deadline, as `bounded` does.
165
+ */
166
+ export const flushFramesAsync = async (report) => {
167
+ let cut = false;
168
+ for (let round = 0, empty = 0; round < FRAME_ROUNDS && empty < 3; round++) {
169
+ await null;
170
+ flushCore();
171
+ if (!frames.size) {
172
+ empty++;
173
+ continue;
174
+ }
175
+ empty = 0;
176
+ /** The same in-place round as `round`, each callback awaited before the next. */
177
+ const last = lastId;
178
+ for (const [id, fn] of frames) {
179
+ if (id > last)
180
+ break;
181
+ frames.delete(id);
182
+ if (idle.size !== 0)
183
+ idle.delete(id);
184
+ try {
185
+ if (await bounded(run(fn, report)))
186
+ cut = true;
187
+ }
188
+ catch (error) {
189
+ report?.(error);
190
+ }
191
+ }
192
+ }
193
+ discard();
194
+ return cut;
195
+ };
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Vera-native SSR. Node resolves the module graph (`import()`), execution registers component classes
3
+ * (through `customElements.define`, which the shim owns), templates flatten through the sigil-aware
4
+ * serializer, and nested components are found by scanning the markup just written for tags the registry
5
+ * knows (`scan.js`) — never by parsing HTML. Client takeover is `hydration` (`@verajs/renderer/hydration`, wired beside
6
+ * the renderer), which adopts this markup in place, markerless but for light slots' region comments.
7
+ *
8
+ * Import THIS module first — before anything that imports `@verajs/renderer`, which needs the shims at
9
+ * import time.
10
+ *
11
+ * **One render at a time** (`takeTurn`): the per-render state below is module-level, so renders are
12
+ * queued rather than interleaved — synchronous and asynchronous alike. Everything a render touches that
13
+ * outlives it (the location, the document title, static mode) is applied inside that render's turn and
14
+ * restored in one `finally`, so no request can see another's.
15
+ */
16
+ import { registry } from './shim.js';
17
+ import { serializeTemplate } from './serializer.js';
18
+ import type { SsrRenderOptions, SsrRenderResult } from './types.js';
19
+ /**
20
+ * Renders a component module to markup.
21
+ *
22
+ * @param url The component's module URL
23
+ * @param options
24
+ * @param options.tag Picks the element when the module defines several
25
+ * @param options.attributes The entry tag's attributes — an object,
26
+ * whose values are escaped and whose names are checked; a string is written through untouched (**a sink**:
27
+ * never put request data in the string form)
28
+ * @param options.props Properties assigned before `connectedCallback` — how
29
+ * structured data reaches a component
30
+ * @param options.children Markup placed inside the entry tag — what a `<slot>` renders
31
+ * (**raw markup**, a sink like the string form of `attributes`)
32
+ * @param options.seen Shared across renders so a page of islands ships each component's
33
+ * styles once
34
+ * @param options.base A directory the module must resolve inside — pass it whenever any
35
+ * part of `url` came from a request
36
+ * @param options.static This page will not be interactive: stores skip reactivity (~3x), and a
37
+ * write during the render throws
38
+ * @param options.location This request's URL, applied for the render and restored after
39
+ * @param options.timeout How long `renderToStringAsync` waits on what a component starts, in milliseconds (2000)
40
+ */
41
+ export declare const renderToString: (url: string | URL, options?: SsrRenderOptions) => Promise<SsrRenderResult>;
42
+ /**
43
+ * Renders a component module to markup, **awaiting its lifecycle** — an `async connectedCallback`, and
44
+ * work started inside a frame (a router's first navigation). Same options, same output.
45
+ */
46
+ export declare const renderToStringAsync: (url: string | URL, options?: SsrRenderOptions) => Promise<SsrRenderResult>;
47
+ export { registry, serializeTemplate };
48
+ export type { SsrRenderOptions, SsrRenderResult };