@pyreon/server 0.5.6 → 0.5.7

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.
@@ -1,160 +1,46 @@
1
- import { h } from "@pyreon/core";
2
- import { RouterProvider, createRouter, hydrateLoaderData } from "@pyreon/router";
3
- import { hydrateRoot, mount } from "@pyreon/runtime-dom";
1
+ import { ComponentFn } from "@pyreon/core";
2
+ import { RouteRecord } from "@pyreon/router";
4
3
 
5
- //#region src/client.ts
6
- /**
7
- * Hydrate a server-rendered Pyreon app on the client.
8
- *
9
- * Handles:
10
- * - Router creation (history mode)
11
- * - Loader data hydration from `window.__PYREON_LOADER_DATA__`
12
- * - Hydration if container has SSR content, fresh mount otherwise
13
- *
14
- * Returns a cleanup function that unmounts the app.
15
- */
16
- function startClient(options) {
17
- const {
18
- App,
19
- routes,
20
- container = "#app"
21
- } = options;
22
- const el = typeof container === "string" ? document.querySelector(container) : container;
23
- if (!el) throw new Error(`[pyreon/client] Container "${container}" not found`);
24
- const router = createRouter({
25
- routes,
26
- mode: "history"
27
- });
28
- const loaderData = window.__PYREON_LOADER_DATA__;
29
- if (loaderData && typeof loaderData === "object") hydrateLoaderData(router, loaderData);
30
- const app = h(RouterProvider, {
31
- router
32
- }, h(App, null));
33
- if (el.childNodes.length > 0) return hydrateRoot(el, app);
34
- return mount(app, el);
4
+ //#region src/client.d.ts
5
+ interface StartClientOptions {
6
+ /** Root application component */
7
+ App: ComponentFn;
8
+ /** Route definitions (same as server) */
9
+ routes: RouteRecord[];
10
+ /** CSS selector or element for the app container (default: "#app") */
11
+ container?: string | Element;
35
12
  }
36
13
  /**
37
- * Hydrate all `<pyreon-island>` elements on the page.
38
- *
39
- * Only loads JavaScript for components that are actually present in the HTML.
40
- * Respects hydration strategies (load, idle, visible, media, never).
41
- *
42
- * @example
43
- * hydrateIslands({
44
- * Counter: () => import("./Counter"),
45
- * Search: () => import("./Search"),
46
- * })
47
- */
14
+ * Hydrate a server-rendered Pyreon app on the client.
15
+ *
16
+ * Handles:
17
+ * - Router creation (history mode)
18
+ * - Loader data hydration from `window.__PYREON_LOADER_DATA__`
19
+ * - Hydration if container has SSR content, fresh mount otherwise
20
+ *
21
+ * Returns a cleanup function that unmounts the app.
22
+ */
23
+ declare function startClient(options: StartClientOptions): () => void;
24
+ type IslandLoader = () => Promise<{
25
+ default: ComponentFn;
26
+ } | ComponentFn>;
48
27
  /**
49
- * Hydrate all `<pyreon-island>` elements on the page.
50
- * Returns a cleanup function that disconnects any pending observers/listeners.
51
- */
52
- function hydrateIslands(registry) {
53
- const islands = document.querySelectorAll("pyreon-island");
54
- const cleanups = [];
55
- for (const el of islands) {
56
- const componentId = el.getAttribute("data-component");
57
- if (!componentId) continue;
58
- const loader = registry[componentId];
59
- if (!loader) {
60
- console.warn(`No loader registered for island "${componentId}"`);
61
- continue;
62
- }
63
- const strategy = el.getAttribute("data-hydrate") ?? "load";
64
- const cleanup = scheduleHydration(el, loader, el.getAttribute("data-props") ?? "{}", strategy);
65
- if (cleanup) cleanups.push(cleanup);
66
- }
67
- return () => {
68
- for (const fn of cleanups) fn();
69
- };
70
- }
71
- function scheduleHydration(el, loader, propsJson, strategy) {
72
- let cancelled = false;
73
- const hydrate = () => {
74
- if (!cancelled) hydrateIsland(el, loader, propsJson);
75
- };
76
- switch (strategy) {
77
- case "load":
78
- hydrate();
79
- return null;
80
- case "idle":
81
- {
82
- if ("requestIdleCallback" in window) {
83
- const id = requestIdleCallback(hydrate);
84
- return () => {
85
- cancelled = true;
86
- cancelIdleCallback(id);
87
- };
88
- }
89
- const id = setTimeout(hydrate, 200);
90
- return () => {
91
- cancelled = true;
92
- clearTimeout(id);
93
- };
94
- }
95
- case "visible":
96
- return observeVisibility(el, hydrate);
97
- case "never":
98
- return null;
99
- default:
100
- if (strategy.startsWith("media(")) {
101
- const query = strategy.slice(6, -1);
102
- const mql = window.matchMedia(query);
103
- if (mql.matches) {
104
- hydrate();
105
- return null;
106
- }
107
- const onChange = e => {
108
- if (e.matches) {
109
- mql.removeEventListener("change", onChange);
110
- hydrate();
111
- }
112
- };
113
- mql.addEventListener("change", onChange);
114
- return () => {
115
- cancelled = true;
116
- mql.removeEventListener("change", onChange);
117
- };
118
- }
119
- hydrate();
120
- return null;
121
- }
122
- }
123
- async function hydrateIsland(el, loader, propsJson) {
124
- const name = el.getAttribute("data-component") ?? "unknown";
125
- try {
126
- let props;
127
- try {
128
- props = JSON.parse(propsJson);
129
- if (typeof props !== "object" || props === null || Array.isArray(props)) throw new TypeError("Expected object");
130
- } catch (parseErr) {
131
- console.error(`Invalid island props JSON for "${name}"`, parseErr);
132
- return;
133
- }
134
- const mod = await loader();
135
- hydrateRoot(el, h(typeof mod === "function" ? mod : mod.default, props));
136
- } catch (err) {
137
- console.error(`Failed to hydrate island "${name}"`, err);
138
- }
139
- }
140
- function observeVisibility(el, callback) {
141
- if (!("IntersectionObserver" in window)) {
142
- callback();
143
- return null;
144
- }
145
- const observer = new IntersectionObserver(entries => {
146
- for (const entry of entries) if (entry.isIntersecting) {
147
- observer.disconnect();
148
- callback();
149
- return;
150
- }
151
- }, {
152
- rootMargin: "200px"
153
- });
154
- observer.observe(el);
155
- return () => observer.disconnect();
156
- }
157
-
28
+ * Hydrate all `<pyreon-island>` elements on the page.
29
+ *
30
+ * Only loads JavaScript for components that are actually present in the HTML.
31
+ * Respects hydration strategies (load, idle, visible, media, never).
32
+ *
33
+ * @example
34
+ * hydrateIslands({
35
+ * Counter: () => import("./Counter"),
36
+ * Search: () => import("./Search"),
37
+ * })
38
+ */
39
+ /**
40
+ * Hydrate all `<pyreon-island>` elements on the page.
41
+ * Returns a cleanup function that disconnects any pending observers/listeners.
42
+ */
43
+ declare function hydrateIslands(registry: Record<string, IslandLoader>): () => void;
158
44
  //#endregion
159
- export { hydrateIslands, startClient };
160
- //# sourceMappingURL=client.d.ts.map
45
+ export { StartClientOptions, hydrateIslands, startClient };
46
+ //# sourceMappingURL=client2.d.ts.map
@@ -1 +1 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AQ,KAAA,CAAM,6BAA6B,IAAA,GAAK,EAAI,GAAA,CAAI;;;AAI5D,SAAS,iBAAA,CAAkB,EAAA,EAAiB,QAAA,EAA2C;EACrF,IAAI,EAAE,sBAAA,IAA0B,MAAA,CAAA,EAAS;IACvC,QAAA,CAAA,CAAU;IACV,OAAO,IAAA;;EAGT,MAAM,QAAA,GAAW,IAAI,oBAAA,CAClB,OAAA,IAAY;IACX,KAAK,MAAM,KAAA,IAAS,OAAA,EAClB,IAAI,KAAA,CAAM,cAAA,EAAgB;MACxB,QAAA,CAAS,UAAA,CAAA,CAAY;MACrB,QAAA,CAAA,CAAU;MACV;;KAIN;IAAE,UAAA,EAAY;EAAA,CAAS,CACxB;EAED,QAAA,CAAS,OAAA,CAAQ,EAAA,CAAG;EACpB,OAAA,MAAa,QAAA,CAAS,UAAA,CAAA,CAAY"}
1
+ {"version":3,"file":"client2.d.ts","names":[],"sources":["../../../src/client.ts"],"mappings":";;;;UAmCiB,kBAAA;EAiD4C;EA/C3D,GAAA,EAAK,WAAA;EA+C0B;EA7C/B,MAAA,EAAQ,WAAA;EA6CgB;EA3CxB,SAAA,YAAqB,OAAA;AAAA;;;;AA6DvB;;;;;;;iBAhDgB,WAAA,CAAY,OAAA,EAAS,kBAAA;AAAA,KA8BhC,YAAA,SAAqB,OAAA;EAAU,OAAA,EAAS,WAAA;AAAA,IAAgB,WAAA;;;;;;;;;;;;;;;;;iBAkB7C,cAAA,CAAe,QAAA,EAAU,MAAA,SAAe,YAAA"}
@@ -1,340 +1,201 @@
1
- import { h } from "@pyreon/core";
2
- import { renderWithHead } from "@pyreon/head";
3
- import { RouterProvider, createRouter, prefetchLoaderData, serializeLoaderData } from "@pyreon/router";
4
- import { renderToStream, runWithRequestContext } from "@pyreon/runtime-server";
5
- import { mkdir, writeFile } from "node:fs/promises";
6
- import { dirname, join, resolve } from "node:path";
1
+ import { ComponentFn, Props } from "@pyreon/core";
2
+ import { RouteRecord } from "@pyreon/router";
7
3
 
8
- //#region src/html.ts
4
+ //#region src/middleware.d.ts
9
5
  /**
10
- * HTML template processing for SSR/SSG.
11
- *
12
- * Templates use comment placeholders:
13
- * <!--pyreon-head--> — replaced with <head> tags (title, meta, link, etc.)
14
- * <!--pyreon-app--> — replaced with rendered application HTML
15
- * <!--pyreon-scripts--> — replaced with client entry script + inline loader data
16
- */
17
-
18
- function compileTemplate(template) {
19
- if (!template.includes("<!--pyreon-app-->")) throw new Error("[pyreon/server] Template must contain <!--pyreon-app--> placeholder");
20
- const [beforeHead, afterHead] = splitOnce(template, "<!--pyreon-head-->");
21
- const [betweenHeadApp, afterApp] = splitOnce(afterHead, "<!--pyreon-app-->");
22
- const [betweenAppScripts, afterScripts] = splitOnce(afterApp, "<!--pyreon-scripts-->");
23
- return {
24
- parts: [beforeHead, betweenHeadApp, betweenAppScripts, afterScripts]
25
- };
26
- }
27
- function splitOnce(str, delimiter) {
28
- const idx = str.indexOf(delimiter);
29
- if (idx === -1) return [str, ""];
30
- return [str.slice(0, idx), str.slice(idx + delimiter.length)];
31
- }
32
- function processTemplate(template, data) {
33
- return template.replace("<!--pyreon-head-->", data.head).replace("<!--pyreon-app-->", data.app).replace("<!--pyreon-scripts-->", data.scripts);
34
- }
35
- /** Fast path using a pre-compiled template */
36
- function processCompiledTemplate(compiled, data) {
37
- const [p0, p1, p2, p3] = compiled.parts;
38
- return p0 + data.head + p1 + data.app + p2 + data.scripts + p3;
6
+ * SSR middleware — simple request processing pipeline.
7
+ *
8
+ * Middleware runs before rendering. Return a Response to short-circuit
9
+ * (e.g. for redirects, auth checks, or static file serving).
10
+ * Return void / undefined to continue to the next middleware or rendering.
11
+ *
12
+ * @example
13
+ * const authMiddleware: Middleware = async (ctx) => {
14
+ * const token = ctx.req.headers.get("Authorization")
15
+ * if (!token) return new Response("Unauthorized", { status: 401 })
16
+ * ctx.locals.user = await verifyToken(token)
17
+ * }
18
+ *
19
+ * const handler = createHandler({
20
+ * App,
21
+ * routes,
22
+ * middleware: [authMiddleware],
23
+ * })
24
+ */
25
+ interface MiddlewareContext {
26
+ /** The incoming request */
27
+ req: Request;
28
+ /** Parsed URL */
29
+ url: URL;
30
+ /** Pathname + search (passed to router) */
31
+ path: string;
32
+ /** Response headers — middleware can set custom headers */
33
+ headers: Headers;
34
+ /** Arbitrary per-request data shared between middleware and components */
35
+ locals: Record<string, unknown>;
39
36
  }
40
37
  /**
41
- * Build the script tags for client hydration.
42
- *
43
- * Emits:
44
- * 1. Inline script with serialized loader data (if any)
45
- * 2. Module script tag pointing to the client entry
46
- */
47
- function buildScripts(clientEntry, loaderData) {
48
- const parts = [];
49
- if (loaderData && Object.keys(loaderData).length > 0) {
50
- const json = JSON.stringify(loaderData).replace(/<\//g, "<\\/");
51
- parts.push(`<script>window.__PYREON_LOADER_DATA__=${json}<\/script>`);
52
- }
53
- parts.push(`<script type="module" src="${clientEntry}"><\/script>`);
54
- return parts.join("\n ");
55
- }
56
- /** Pre-build the static client entry script tag (invariant across requests) */
57
- function buildClientEntryTag(clientEntry) {
58
- return `<script type="module" src="${clientEntry}"><\/script>`;
59
- }
60
- /** Fast path: build scripts with a pre-built client entry tag */
61
- function buildScriptsFast(clientEntryTag, loaderData) {
62
- if (loaderData && Object.keys(loaderData).length > 0) return `<script>window.__PYREON_LOADER_DATA__=${JSON.stringify(loaderData).replace(/<\//g, "<\\/")}<\/script>\n ${clientEntryTag}`;
63
- return clientEntryTag;
64
- }
65
-
38
+ * Middleware function. Return a Response to short-circuit, or void to continue.
39
+ */
40
+ type Middleware = (ctx: MiddlewareContext) => Response | void | Promise<Response | void>;
66
41
  //#endregion
67
- //#region src/handler.ts
68
- function createHandler(options) {
69
- const {
70
- App,
71
- routes,
72
- template = DEFAULT_TEMPLATE,
73
- clientEntry = "/src/entry-client.ts",
74
- middleware = [],
75
- mode = "string"
76
- } = options;
77
- const compiled = compileTemplate(template);
78
- const clientEntryTag = buildClientEntryTag(clientEntry);
79
- return async function handler(req) {
80
- const url = new URL(req.url);
81
- const path = url.pathname + url.search;
82
- const ctx = {
83
- req,
84
- url,
85
- path,
86
- headers: new Headers({
87
- "Content-Type": "text/html; charset=utf-8"
88
- }),
89
- locals: {}
90
- };
91
- for (const mw of middleware) {
92
- const result = await mw(ctx);
93
- if (result instanceof Response) return result;
94
- }
95
- const router = createRouter({
96
- routes,
97
- mode: "history",
98
- url: path
99
- });
100
- return runWithRequestContext(async () => {
101
- try {
102
- await prefetchLoaderData(router, path);
103
- const app = h(RouterProvider, {
104
- router
105
- }, h(App, null));
106
- if (mode === "stream") return renderStreamResponse(app, router, compiled, clientEntryTag, ctx.headers);
107
- const {
108
- html: appHtml,
109
- head
110
- } = await renderWithHead(app);
111
- const fullHtml = processCompiledTemplate(compiled, {
112
- head,
113
- app: appHtml,
114
- scripts: buildScriptsFast(clientEntryTag, serializeLoaderData(router))
115
- });
116
- return new Response(fullHtml, {
117
- status: 200,
118
- headers: ctx.headers
119
- });
120
- } catch (_err) {
121
- return new Response("Internal Server Error", {
122
- status: 500,
123
- headers: {
124
- "Content-Type": "text/plain"
125
- }
126
- });
127
- }
128
- });
129
- };
130
- }
131
- /**
132
- * Streaming mode: shell is emitted immediately, app content streams progressively.
133
- *
134
- * Head tags from the initial synchronous render are included in the shell.
135
- * Suspense boundaries resolve out-of-order via inline <template> + swap scripts.
136
- */
137
- async function renderStreamResponse(app, router, compiled, clientEntryTag, extraHeaders) {
138
- const scripts = buildScriptsFast(clientEntryTag, serializeLoaderData(router));
139
- const [p0, p1, p2, p3] = compiled.parts;
140
- const shellHead = p0 + p1;
141
- const shellTail = p2 + scripts + p3;
142
- const reader = renderToStream(app).getReader();
143
- const stream = new ReadableStream({
144
- async start(controller) {
145
- const encoder = new TextEncoder();
146
- const push = s => controller.enqueue(encoder.encode(s));
147
- try {
148
- push(shellHead);
149
- let done = false;
150
- while (!done) {
151
- const result = await reader.read();
152
- done = result.done;
153
- if (result.value) push(result.value);
154
- }
155
- push(shellTail);
156
- } catch (_err) {
157
- push(`<script>console.error("[pyreon/server] Stream render failed")<\/script>`);
158
- push(shellTail);
159
- } finally {
160
- controller.close();
161
- }
162
- }
163
- });
164
- return new Response(stream, {
165
- status: 200,
166
- headers: extraHeaders
167
- });
42
+ //#region src/handler.d.ts
43
+ interface HandlerOptions {
44
+ /** Root application component */
45
+ App: ComponentFn;
46
+ /** Route definitions */
47
+ routes: RouteRecord[];
48
+ /**
49
+ * HTML template with placeholders:
50
+ * <!--pyreon-head--> — head tags (title, meta, link, etc.)
51
+ * <!--pyreon-app--> — rendered app HTML
52
+ * <!--pyreon-scripts--> client entry + loader data
53
+ *
54
+ * Defaults to a minimal HTML5 template.
55
+ */
56
+ template?: string;
57
+ /** Path to the client entry module (default: "/src/entry-client.ts") */
58
+ clientEntry?: string;
59
+ /** Middleware chain — runs before rendering */
60
+ middleware?: Middleware[];
61
+ /**
62
+ * Rendering mode:
63
+ * "string" (default) — full renderToString, complete HTML in one response
64
+ * "stream" — progressive streaming via renderToStream (Suspense out-of-order)
65
+ */
66
+ mode?: "string" | "stream";
168
67
  }
169
-
68
+ declare function createHandler(options: HandlerOptions): (req: Request) => Promise<Response>;
170
69
  //#endregion
171
- //#region src/island.ts
70
+ //#region src/html.d.ts
172
71
  /**
173
- * Create an island component.
174
- *
175
- * Returns an async ComponentFn that:
176
- * 1. Resolves the dynamic import
177
- * 2. Renders the component to VNodes
178
- * 3. Wraps the output in `<pyreon-island>` with serialized props + hydration strategy
179
- */
180
- function island(loader, options) {
181
- const {
182
- name,
183
- hydrate = "load"
184
- } = options;
185
- const wrapper = async function IslandWrapper(props) {
186
- const mod = await loader();
187
- const Comp = typeof mod === "function" ? mod : mod.default;
188
- const serializedProps = serializeIslandProps(props);
189
- return h("pyreon-island", {
190
- "data-component": name,
191
- "data-props": serializedProps,
192
- "data-hydrate": hydrate
193
- }, h(Comp, props));
194
- };
195
- Object.defineProperties(wrapper, {
196
- __island: {
197
- value: true,
198
- enumerable: true
199
- },
200
- name: {
201
- value: name,
202
- enumerable: true,
203
- writable: false,
204
- configurable: true
205
- },
206
- hydrate: {
207
- value: hydrate,
208
- enumerable: true
209
- }
210
- });
211
- return wrapper;
72
+ * HTML template processing for SSR/SSG.
73
+ *
74
+ * Templates use comment placeholders:
75
+ * <!--pyreon-head--> — replaced with <head> tags (title, meta, link, etc.)
76
+ * <!--pyreon-app--> — replaced with rendered application HTML
77
+ * <!--pyreon-scripts--> — replaced with client entry script + inline loader data
78
+ */
79
+ declare const DEFAULT_TEMPLATE = "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <!--pyreon-head-->\n</head>\n<body>\n <div id=\"app\"><!--pyreon-app--></div>\n <!--pyreon-scripts-->\n</body>\n</html>";
80
+ interface TemplateData {
81
+ head: string;
82
+ app: string;
83
+ scripts: string;
212
84
  }
213
85
  /**
214
- * Serialize component props to a JSON string for embedding in HTML attributes.
215
- * Strips non-serializable values (functions, symbols, children).
216
- */
217
- function serializeIslandProps(props) {
218
- const clean = {};
219
- for (const [key, value] of Object.entries(props)) {
220
- if (key === "children") continue;
221
- if (typeof value === "function") continue;
222
- if (typeof value === "symbol") continue;
223
- if (value === void 0) continue;
224
- clean[key] = value;
225
- }
226
- return JSON.stringify(clean);
86
+ * Pre-compiled template splits the template string once so that
87
+ * each request only concatenates 6 parts instead of scanning 3x with `.replace()`.
88
+ */
89
+ interface CompiledTemplate {
90
+ /** [before-head, between-head-app, between-app-scripts, after-scripts] */
91
+ parts: [string, string, string, string];
227
92
  }
228
-
93
+ declare function compileTemplate(template: string): CompiledTemplate;
94
+ declare function processTemplate(template: string, data: TemplateData): string;
95
+ /** Fast path using a pre-compiled template */
96
+ declare function processCompiledTemplate(compiled: CompiledTemplate, data: TemplateData): string;
97
+ /**
98
+ * Build the script tags for client hydration.
99
+ *
100
+ * Emits:
101
+ * 1. Inline script with serialized loader data (if any)
102
+ * 2. Module script tag pointing to the client entry
103
+ */
104
+ declare function buildScripts(clientEntry: string, loaderData: Record<string, unknown> | null): string;
229
105
  //#endregion
230
- //#region src/ssg.ts
106
+ //#region src/island.d.ts
107
+ type HydrationStrategy = "load" | "idle" | "visible" | "never" | `media(${string})`;
108
+ interface IslandOptions {
109
+ /** Unique name — must match the key in the client-side hydrateIslands() registry */
110
+ name: string;
111
+ /** When to hydrate on the client (default: "load") */
112
+ hydrate?: HydrationStrategy;
113
+ }
114
+ interface IslandMeta {
115
+ readonly __island: true;
116
+ readonly name: string;
117
+ readonly hydrate: HydrationStrategy;
118
+ }
231
119
  /**
232
- * Static Site Generation — pre-render routes to HTML files at build time.
233
- *
234
- * @example
235
- * // ssg.ts (run with: bun run ssg.ts)
236
- * import { createHandler } from "@pyreon/server"
237
- * import { prerender } from "@pyreon/server"
238
- * import { App } from "./src/App"
239
- * import { routes } from "./src/routes"
240
- *
241
- * const handler = createHandler({ App, routes })
242
- *
243
- * await prerender({
244
- * handler,
245
- * paths: ["/", "/about", "/blog", "/blog/hello-world"],
246
- * outDir: "dist",
247
- * })
248
- *
249
- * @example
250
- * // Dynamic paths from a CMS or filesystem
251
- * await prerender({
252
- * handler,
253
- * paths: async () => {
254
- * const posts = await fetchAllPosts()
255
- * return ["/", "/about", ...posts.map(p => `/blog/${p.slug}`)]
256
- * },
257
- * outDir: "dist",
258
- * })
259
- */
120
+ * Create an island component.
121
+ *
122
+ * Returns an async ComponentFn that:
123
+ * 1. Resolves the dynamic import
124
+ * 2. Renders the component to VNodes
125
+ * 3. Wraps the output in `<pyreon-island>` with serialized props + hydration strategy
126
+ */
127
+ declare function island<P extends Props = Props>(loader: () => Promise<{
128
+ default: ComponentFn<P>;
129
+ } | ComponentFn<P>>, options: IslandOptions): ComponentFn<P> & IslandMeta;
130
+ //#endregion
131
+ //#region src/ssg.d.ts
260
132
  /**
261
- * Pre-render a list of routes to static HTML files.
262
- *
263
- * For each path:
264
- * 1. Constructs a Request for the path
265
- * 2. Calls the SSR handler to render to HTML
266
- * 3. Writes the HTML to `outDir/<path>/index.html`
267
- *
268
- * The root path "/" becomes `outDir/index.html`.
269
- * Paths like "/about" become `outDir/about/index.html`.
270
- */
271
- async function prerender(options) {
272
- const {
273
- handler,
274
- outDir,
275
- origin = "http://localhost",
276
- onPage
277
- } = options;
278
- const start = Date.now();
279
- const paths = typeof options.paths === "function" ? await options.paths() : options.paths;
280
- let pages = 0;
281
- const errors = [];
282
- async function renderPage(path) {
283
- const url = new URL(path, origin);
284
- const req = new Request(url.href);
285
- const res = await Promise.race([handler(req), new Promise((_, reject) => setTimeout(() => reject(/* @__PURE__ */new Error(`Prerender timeout for "${path}" (30s)`)), 3e4))]);
286
- if (!res.ok) {
287
- errors.push({
288
- path,
289
- error: /* @__PURE__ */new Error(`HTTP ${res.status}`)
290
- });
291
- return;
292
- }
293
- const html = await res.text();
294
- if (onPage) {
295
- if ((await onPage(path, html)) === false) return;
296
- }
297
- const filePath = resolveOutputPath(outDir, path);
298
- const resolvedOut = resolve(outDir);
299
- if (!resolve(filePath).startsWith(resolvedOut)) {
300
- errors.push({
301
- path,
302
- error: /* @__PURE__ */new Error(`Path traversal detected: "${path}"`)
303
- });
304
- return;
305
- }
306
- await mkdir(dirname(filePath), {
307
- recursive: true
308
- });
309
- await writeFile(filePath, html, "utf-8");
310
- pages++;
311
- }
312
- const BATCH_SIZE = 10;
313
- for (let i = 0; i < paths.length; i += BATCH_SIZE) {
314
- const batch = paths.slice(i, i + BATCH_SIZE);
315
- await Promise.all(batch.map(async path => {
316
- try {
317
- await renderPage(path);
318
- } catch (error) {
319
- errors.push({
320
- path,
321
- error
322
- });
323
- }
324
- }));
325
- }
326
- return {
327
- pages,
328
- errors,
329
- elapsed: Date.now() - start
330
- };
133
+ * Static Site Generation pre-render routes to HTML files at build time.
134
+ *
135
+ * @example
136
+ * // ssg.ts (run with: bun run ssg.ts)
137
+ * import { createHandler } from "@pyreon/server"
138
+ * import { prerender } from "@pyreon/server"
139
+ * import { App } from "./src/App"
140
+ * import { routes } from "./src/routes"
141
+ *
142
+ * const handler = createHandler({ App, routes })
143
+ *
144
+ * await prerender({
145
+ * handler,
146
+ * paths: ["/", "/about", "/blog", "/blog/hello-world"],
147
+ * outDir: "dist",
148
+ * })
149
+ *
150
+ * @example
151
+ * // Dynamic paths from a CMS or filesystem
152
+ * await prerender({
153
+ * handler,
154
+ * paths: async () => {
155
+ * const posts = await fetchAllPosts()
156
+ * return ["/", "/about", ...posts.map(p => `/blog/${p.slug}`)]
157
+ * },
158
+ * outDir: "dist",
159
+ * })
160
+ */
161
+ interface PrerenderOptions {
162
+ /** SSR handler created by createHandler() */
163
+ handler: (req: Request) => Promise<Response>;
164
+ /** Routes to pre-render — array of URL paths or async function that returns them */
165
+ paths: string[] | (() => string[] | Promise<string[]>);
166
+ /** Output directory for the generated HTML files */
167
+ outDir: string;
168
+ /** Origin for constructing full URLs (default: "http://localhost") */
169
+ origin?: string;
170
+ /**
171
+ * Called after each page is rendered — use for logging or progress tracking.
172
+ * Return false to skip writing this page.
173
+ */
174
+ onPage?: (path: string, html: string) => void | boolean | Promise<void | boolean>;
331
175
  }
332
- function resolveOutputPath(outDir, path) {
333
- if (path === "/") return join(outDir, "index.html");
334
- if (path.endsWith(".html")) return join(outDir, path);
335
- return join(outDir, path, "index.html");
176
+ interface PrerenderResult {
177
+ /** Number of pages generated */
178
+ pages: number;
179
+ /** Paths that failed to render */
180
+ errors: {
181
+ path: string;
182
+ error: unknown;
183
+ }[];
184
+ /** Total elapsed time in milliseconds */
185
+ elapsed: number;
336
186
  }
337
-
187
+ /**
188
+ * Pre-render a list of routes to static HTML files.
189
+ *
190
+ * For each path:
191
+ * 1. Constructs a Request for the path
192
+ * 2. Calls the SSR handler to render to HTML
193
+ * 3. Writes the HTML to `outDir/<path>/index.html`
194
+ *
195
+ * The root path "/" becomes `outDir/index.html`.
196
+ * Paths like "/about" become `outDir/about/index.html`.
197
+ */
198
+ declare function prerender(options: PrerenderOptions): Promise<PrerenderResult>;
338
199
  //#endregion
339
- export { DEFAULT_TEMPLATE, buildScripts, compileTemplate, createHandler, island, prerender, processCompiledTemplate, processTemplate };
340
- //# sourceMappingURL=index.d.ts.map
200
+ export { type CompiledTemplate, DEFAULT_TEMPLATE, type HandlerOptions, type HydrationStrategy, type IslandMeta, type IslandOptions, type Middleware, type MiddlewareContext, type PrerenderOptions, type PrerenderResult, type TemplateData, buildScripts, compileTemplate, createHandler, island, prerender, processCompiledTemplate, processTemplate };
201
+ //# sourceMappingURL=index2.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/html.ts","../../../src/handler.ts","../../../src/island.ts","../../../src/ssg.ts"],"mappings":";;;;;;;;;;;;;;;;;AAqCA,SAAgB,eAAA,CAAgB,QAAA,EAAoC;EAClE,IAAI,CAAC,QAAA,CAAS,QAAA,CAAS,mBAAA,CAAoB,EACzC,MAAM,IAAI,KAAA,CAAM,qEAAA,CAAsE;EAExF,MAAM,CAAC,UAAA,EAAY,SAAA,CAAA,GAAa,SAAA,CAAU,QAAA,EAAU,oBAAA,CAAqB;EACzE,MAAM,CAAC,cAAA,EAAgB,QAAA,CAAA,GAAY,SAAA,CAAU,SAAA,EAAW,mBAAA,CAAoB;EAC5E,MAAM,CAAC,iBAAA,EAAmB,YAAA,CAAA,GAAgB,SAAA,CAAU,QAAA,EAAU,uBAAA,CAAwB;EACtF,OAAO;IAAE,KAAA,EAAO,CAAC,UAAA,EAAY,cAAA,EAAgB,iBAAA,EAAmB,YAAA;EAAa,CAAE;;AAGjF,SAAS,SAAA,CAAU,GAAA,EAAa,SAAA,EAAqC;EACnE,MAAM,GAAA,GAAM,GAAA,CAAI,OAAA,CAAQ,SAAA,CAAU;EAClC,IAAI,GAAA,KAAQ,CAAA,CAAA,EAAI,OAAO,CAAC,GAAA,EAAK,EAAA,CAAG;EAChC,OAAO,CAAC,GAAA,CAAI,KAAA,CAAM,CAAA,EAAG,GAAA,CAAI,EAAE,GAAA,CAAI,KAAA,CAAM,GAAA,GAAM,SAAA,CAAU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AA,CAAM,MAAA,EAAQ,CAAA,IAAK,UAAA,EAAY;IACjD,MAAM,KAAA,GAAQ,KAAA,CAAM,KAAA,CAAM,CAAA,EAAG,CAAA,GAAI,UAAA,CAAW;IAC5C,MAAM,OAAA,CAAQ,GAAA,CACZ,KAAA,CAAM,GAAA,CAAI,MAAO,IAAA,IAAS;MACxB,IAAI;QACF,MAAM,UAAA,CAAW,IAAA,CAAK;eACf,KAAA,EAAO;QACd,MAAA,CAAO,IAAA,CAAK;UAAE,IAAA;UAAM;SAAO,CAAC;;MAE9B,CACH;;EAGH,OAAO;IACL,KAAA;IACA,MAAA;IACA,OAAA,EAAS,IAAA,CAAK,GAAA,CAAA,CAAK,GAAG;GACvB;;AAGH,SAAS,iBAAA,CAAkB,MAAA,EAAgB,IAAA,EAAsB;EAC/D,IAAI,IAAA,KAAS,GAAA,EAAK,OAAO,IAAA,CAAK,MAAA,EAAQ,YAAA,CAAa;EACnD,IAAI,IAAA,CAAK,QAAA,CAAS,OAAA,CAAQ,EAAE,OAAO,IAAA,CAAK,MAAA,EAAQ,IAAA,CAAK;EACrD,OAAO,IAAA,CAAK,MAAA,EAAQ,IAAA,EAAM,YAAA,CAAa"}
1
+ {"version":3,"file":"index2.d.ts","names":[],"sources":["../../../src/middleware.ts","../../../src/handler.ts","../../../src/html.ts","../../../src/island.ts","../../../src/ssg.ts"],"mappings":";;;;;;;;AAqBA;;;;;;;;;;;;;;;;UAAiB,iBAAA;EAUP;EARR,GAAA,EAAK,OAAA;EAQS;EANd,GAAA,EAAK,GAAA;EAae;EAXpB,IAAA;EAW6B;EAT7B,OAAA,EAAS,OAAA;EASoE;EAP7E,MAAA,EAAQ,MAAA;AAAA;;;;KAOE,UAAA,IAAc,GAAA,EAAK,iBAAA,KAAsB,QAAA,UAAkB,OAAA,CAAQ,QAAA;;;UCS9D,cAAA;EDT8D;ECW7E,GAAA,EAAK,WAAA;EDXuE;ECa5E,MAAA,EAAQ,WAAA;EDbqB;;;;;;;;ECsB7B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Ef,KAAA;EHDQ;EGGR,MAAA;IAAU,IAAA;IAAc,KAAA;EAAA;EHLnB;EGOL,OAAA;AAAA;;;;;;;;AHiBF;;;;iBGHsB,SAAA,CAAU,OAAA,EAAS,gBAAA,GAAmB,OAAA,CAAQ,eAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pyreon/server",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "description": "SSR handler, SSG prerender, and island architecture for Pyreon",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -44,12 +44,12 @@
44
44
  "prepublishOnly": "bun run build"
45
45
  },
46
46
  "dependencies": {
47
- "@pyreon/core": "^0.5.6",
48
- "@pyreon/head": "^0.5.6",
49
- "@pyreon/reactivity": "^0.5.6",
50
- "@pyreon/router": "^0.5.6",
51
- "@pyreon/runtime-dom": "^0.5.6",
52
- "@pyreon/runtime-server": "^0.5.6"
47
+ "@pyreon/core": "^0.5.7",
48
+ "@pyreon/head": "^0.5.7",
49
+ "@pyreon/reactivity": "^0.5.7",
50
+ "@pyreon/router": "^0.5.7",
51
+ "@pyreon/runtime-dom": "^0.5.7",
52
+ "@pyreon/runtime-server": "^0.5.7"
53
53
  },
54
54
  "publishConfig": {
55
55
  "access": "public"