@solidjs/prerender 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ryan Carniato
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # @solidjs/prerender
2
+
3
+ Static server functions for Solid. `prerendered()` declares that a `'use server'` function runs at build time — during prerendering — and that each call's result is captured as a static artifact the deployed client fetches instead of calling a server. Pair it with [`prerender-crawler`](../crawler) and `vite build` produces a folder of files that is a complete Solid app with typed server-side data loading and no server.
4
+
5
+ Requires `@solidjs/web` 2 (server functions) and `@solidjs/vite-plugin` with `serverFunctions: true`.
6
+
7
+ ## Setup
8
+
9
+ ```ts
10
+ // vite.config.ts
11
+ import { defineConfig } from "vite";
12
+ import solid from "@solidjs/vite-plugin";
13
+ import { prerender } from "prerender-crawler/vite";
14
+ import { serverFunctions } from "@solidjs/prerender/integration";
15
+
16
+ export default defineConfig({
17
+ plugins: [
18
+ solid({ start: true, ssr: true, serverFunctions: true }),
19
+ prerender({ mode: "static", integrations: [serverFunctions()] })
20
+ ]
21
+ });
22
+ ```
23
+
24
+ `prerender` is the generic crawler; `serverFunctions()` is the Solid integration that captures `prerendered()` calls during the crawl and guards the build.
25
+
26
+ ## `prerendered(fn)`
27
+
28
+ ```ts
29
+ import { query } from "@solidjs/router";
30
+ import { prerendered } from "@solidjs/prerender";
31
+
32
+ export const getPost = query(
33
+ prerendered(async (slug: string) => {
34
+ "use server";
35
+ return db.posts.find(slug); // runs at build time in a prerendered build
36
+ }),
37
+ "post"
38
+ );
39
+ ```
40
+
41
+ - **Implies `GET`.** A prerendered call is by definition a safe read. Outside a prerendered build — the dev server, or a build without the prerender plugin — the reference behaves exactly like `GET(fn)`, so the app still works against a live server. Dev stays fullstack; production is static.
42
+ - **Arguments are the address.** Each call identity (function id + arguments) becomes one artifact under `_static/`. Both the build and the client derive the key from the arguments, so they must be JSON-safe and spell identically in both realms.
43
+ - **Results are unrestricted.** JSON-safe results are stored as plain JSON; rich values (Dates, Maps, typed errors) ride the server-function codec into the artifact, so whatever survives a live call survives the artifact.
44
+ - **Only calls the build made have artifacts.** In a static build, a client calling with arguments no prerendered page used gets a rejected call (there is no server). In a hybrid build the call falls back to the live server.
45
+
46
+ Design pages so the crawl exercises the calls the site needs — which happens naturally when pages link to what they use.
47
+
48
+ ## `serverFunctions(options?)`
49
+
50
+ The integration has two jobs.
51
+
52
+ **Capture.** For the crawl's duration every executed `prerendered` call is collected (the crawl is in-process, so the built server bundle and the integration share a realm), encoded once per call identity, and emitted alongside the pages.
53
+
54
+ **The guard.** `@solidjs/vite-plugin` records every server function the client build can dispatch. After the crawl, any of those ids nothing captured is a call a static deployment cannot answer — because the function lacks `prerendered()`, or because no prerendered page called it. In static mode the build fails naming each one:
55
+
56
+ ```
57
+ [@solidjs/prerender] 1 server function(s) the client can call were never captured during prerendering:
58
+ - getLiveCount (getLiveCount-1679f63b, src/data.ts)
59
+ A static deployment has no server to answer them, so these calls fail at runtime. ...
60
+ ```
61
+
62
+ | Option | Default | |
63
+ | ------------ | ------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
64
+ | `uncaptured` | `"error"` static / `"ignore"` hybrid | `"error"`, `"warn"`, or `"ignore"`. |
65
+ | `codec` | | Codec options for encoding rich results; must match the client's `configureServerFunctionsClient({ codec })`. |
66
+
67
+ The guard needs a `@solidjs/vite-plugin` that records function ids in `.vite/solid-server-functions.json`; with an older version it warns that it cannot verify and lets the build through.
68
+
69
+ ## Modes
70
+
71
+ - **`prerender({ mode: "static" })`** — SSG. Every page written, every `prerendered()` call baked, missing artifact is an error. Deploy `dist/client` to any static host.
72
+ - **`prerender({ mode: "hybrid" })`** — a live server is deployed too. Chosen calls are baked to static artifacts while everything else stays live; clients fetch artifacts first and fall back to the server. Pages aren't written by default (a static file would shadow live SSR).
73
+
74
+ The client learns the posture from `import.meta.env.PRERENDER_MODE`, which the crawler's Vite plugin defines. No plugin, no constant, live behavior.
75
+
76
+ ## Other exports
77
+
78
+ - `staticCallKey(id, args)` / `staticArtifactPath(id, args)` — the artifact key derivation, for tooling that needs to locate an artifact.
79
+ - Types: `PrerenderedFunction`, `ServerFunctionsIntegration`, `ServerFunctionsIntegrationOptions`, `CaptureSink` (server).
80
+
81
+ ## License
82
+
83
+ MIT
@@ -0,0 +1,74 @@
1
+ // src/shared.ts
2
+ var ARTIFACT_DIR = "_static";
3
+ var CAPTURE_SINK = /* @__PURE__ */ Symbol.for("solid-prerender.captureArtifacts");
4
+ function canonicalJSON(value) {
5
+ return writeCanonical(value, /* @__PURE__ */ new Set());
6
+ }
7
+ function writeCanonical(value, ancestors) {
8
+ if (value === null) return "null";
9
+ const t = typeof value;
10
+ if (t === "string") return JSON.stringify(value);
11
+ if (t === "boolean") return value ? "true" : "false";
12
+ if (t === "number") {
13
+ const n = value;
14
+ if (!Number.isFinite(n) || Object.is(n, -0)) {
15
+ throw notJSONSafe(`the number ${Object.is(n, -0) ? "-0" : String(n)}`);
16
+ }
17
+ return JSON.stringify(n);
18
+ }
19
+ if (t !== "object") throw notJSONSafe(`a ${t}`);
20
+ const obj = value;
21
+ if (ancestors.has(obj)) throw notJSONSafe("a cyclic structure");
22
+ ancestors.add(obj);
23
+ let out;
24
+ if (Array.isArray(obj)) {
25
+ let body = "";
26
+ for (let i = 0; i < obj.length; i++) {
27
+ if (!(i in obj)) throw notJSONSafe("a sparse array");
28
+ body += (i ? "," : "") + writeCanonical(obj[i], ancestors);
29
+ }
30
+ out = "[" + body + "]";
31
+ } else {
32
+ const proto = Object.getPrototypeOf(obj);
33
+ if (proto !== Object.prototype && proto !== null) {
34
+ throw notJSONSafe(`an instance of ${proto?.constructor?.name ?? "a null-free prototype"}`);
35
+ }
36
+ const keys = Object.keys(obj).sort();
37
+ let body = "";
38
+ for (let i = 0; i < keys.length; i++) {
39
+ const v = obj[keys[i]];
40
+ if (v === void 0) throw notJSONSafe("an undefined property");
41
+ body += (i ? "," : "") + JSON.stringify(keys[i]) + ":" + writeCanonical(v, ancestors);
42
+ }
43
+ out = "{" + body + "}";
44
+ }
45
+ ancestors.delete(obj);
46
+ return out;
47
+ }
48
+ function notJSONSafe(what) {
49
+ return new Error(
50
+ `Static function arguments must be JSON-safe \u2014 they are the call's address, and both the build and the client must derive the same artifact key from them. Got ${what}. Rich values belong in the function's RESULT (which rides the codec), not its arguments.`
51
+ );
52
+ }
53
+ async function staticCallKey(id, args) {
54
+ const spelling = canonicalJSON([id, ...args]);
55
+ const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(spelling));
56
+ const bytes = new Uint8Array(digest).subarray(0, 16);
57
+ let hex = "";
58
+ for (const byte of bytes) hex += byte.toString(16).padStart(2, "0");
59
+ return hex;
60
+ }
61
+ async function staticArtifactPath(id, args) {
62
+ const key = await staticCallKey(id, args);
63
+ const label = id.replace(/[^a-zA-Z0-9_-]/g, "_").slice(0, 48);
64
+ return `${ARTIFACT_DIR}/${label ? label + "." : ""}${key}.json`;
65
+ }
66
+ var PRERENDERED_META_KEY = "prerendered";
67
+
68
+ export {
69
+ CAPTURE_SINK,
70
+ canonicalJSON,
71
+ staticCallKey,
72
+ staticArtifactPath,
73
+ PRERENDERED_META_KEY
74
+ };
@@ -0,0 +1,37 @@
1
+ import { P as PrerenderedFunction } from './shared-BcBpMOMU.js';
2
+ export { s as staticArtifactPath, a as staticCallKey } from './shared-BcBpMOMU.js';
3
+
4
+ /**
5
+ * Declares a server function PRERENDERED: it runs at build time, during
6
+ * prerendering, and each call's result is captured as a static JSON
7
+ * artifact addressed by the call's identity (function id + arguments).
8
+ * Clients of the built site fetch the artifact instead of invoking a
9
+ * server — a static deploy serves typed, codec-faithful data with no
10
+ * runtime server at all.
11
+ *
12
+ * The declaration implies `GET`: a prerendered call is by definition a
13
+ * safe read (its result is baked into the build), and outside a
14
+ * prerendered build — the dev server, or a build without the prerender
15
+ * plugin — the reference behaves exactly like `GET(fn)`, so the app still
16
+ * works against a live server.
17
+ *
18
+ * Arguments must be JSON-safe: they are the call's ADDRESS (both the
19
+ * build and the client derive the artifact key from them), so they must
20
+ * spell identically in both realms. Results are unrestricted — rich values
21
+ * (Dates, Maps, typed errors) ride the codec into the artifact.
22
+ *
23
+ * Only calls that actually happen during prerendering have artifacts. In a
24
+ * static build, a client calling with arguments no prerendered page used
25
+ * gets a rejected call (there is no server to fall back to); in a hybrid
26
+ * build the call falls back to the live server.
27
+ *
28
+ * ```ts
29
+ * export const getPosts = prerendered(async (tag: string) => {
30
+ * "use server";
31
+ * return db.posts.byTag(tag); // runs at build time in a prerendered build
32
+ * });
33
+ * ```
34
+ */
35
+ declare function prerendered<A extends readonly unknown[], R>(fn: (...args: A) => R): PrerenderedFunction<A, Awaited<R>>;
36
+
37
+ export { PrerenderedFunction, prerendered };
package/dist/client.js ADDED
@@ -0,0 +1,66 @@
1
+ import {
2
+ PRERENDERED_META_KEY,
3
+ staticArtifactPath,
4
+ staticCallKey
5
+ } from "./chunk-XX54FQA3.js";
6
+
7
+ // src/client.ts
8
+ import {
9
+ GET,
10
+ SERVER_FUNCTION_INVOKE,
11
+ deserializeStream,
12
+ getServerFunctionMetadata,
13
+ getServerFunctionsCodec,
14
+ isServerFunction,
15
+ withMeta
16
+ } from "@solidjs/web/server-functions/client";
17
+ var SERVER_FUNCTION_METADATA = /* @__PURE__ */ Symbol.for("solid.ServerFunctionMetadata");
18
+ function posture() {
19
+ const env = import.meta.env;
20
+ const mode = env?.PRERENDER_MODE;
21
+ return {
22
+ mode: mode === "static" || mode === "hybrid" ? mode : void 0,
23
+ base: typeof env?.BASE_URL === "string" ? env.BASE_URL : "/"
24
+ };
25
+ }
26
+ function prerendered(fn) {
27
+ if (!isServerFunction(fn)) {
28
+ throw new Error("prerendered expects a server function reference");
29
+ }
30
+ const source = getServerFunctionMetadata(fn)?.method === "GET" ? fn : GET(fn);
31
+ if (posture().mode === void 0) {
32
+ return withMeta(source, { [PRERENDERED_META_KEY]: true });
33
+ }
34
+ const id = source.id;
35
+ const run = async (args, options) => {
36
+ const { mode, base } = posture();
37
+ const path = await staticArtifactPath(id, args);
38
+ const url = base.endsWith("/") ? base + path : `${base}/${path}`;
39
+ const response = await fetch(url, options?.signal ? { signal: options.signal } : void 0);
40
+ if (!response.ok) {
41
+ if (mode === "hybrid") {
42
+ return source[SERVER_FUNCTION_INVOKE](args, options);
43
+ }
44
+ throw new Error(
45
+ `No static artifact for this call of "${id}" (${response.status} at ${url}): only calls made during prerendering are captured. Prerender a page that performs this call (same arguments), or make the function a live server function.`
46
+ );
47
+ }
48
+ const text = await response.text();
49
+ if (text === "") return void 0;
50
+ return text.startsWith(";0x") ? await deserializeStream(new Response(text), getServerFunctionsCodec()) : JSON.parse(text);
51
+ };
52
+ const wrapped = ((...args) => run(args));
53
+ wrapped[SERVER_FUNCTION_METADATA] = {
54
+ ...getServerFunctionMetadata(source),
55
+ [PRERENDERED_META_KEY]: true
56
+ };
57
+ wrapped[SERVER_FUNCTION_INVOKE] = run;
58
+ wrapped.id = id;
59
+ Object.defineProperty(wrapped, "url", { get: () => source.url, configurable: true });
60
+ return wrapped;
61
+ }
62
+ export {
63
+ prerendered,
64
+ staticArtifactPath,
65
+ staticCallKey
66
+ };
@@ -0,0 +1,39 @@
1
+ import { PrerenderIntegration } from 'prerender-crawler';
2
+
3
+ interface ServerFunctionsIntegrationOptions {
4
+ /**
5
+ * Codec options for encoding artifacts that carry rich (non-JSON-safe)
6
+ * results. Must match the CLIENT's configured codec
7
+ * (`configureServerFunctionsClient({ codec })`) — the artifact is decoded
8
+ * there. Plain JSON-safe results never touch the codec.
9
+ */
10
+ codec?: unknown;
11
+ /**
12
+ * What to do when the client build references server functions the crawl
13
+ * never captured — calls a static deployment cannot answer (no server),
14
+ * whether the function lacks `prerendered()` or no prerendered page ever
15
+ * called it. `"error"` fails the build naming each one.
16
+ * @default "error" in static mode, "ignore" in hybrid (a server exists)
17
+ */
18
+ uncaptured?: "error" | "warn" | "ignore";
19
+ }
20
+ /** The integration, with the ids it saw — what the guard checks against. */
21
+ interface ServerFunctionsIntegration extends PrerenderIntegration {
22
+ /** Every server-function id captured at least once during the crawl. */
23
+ readonly captured: ReadonlySet<string>;
24
+ }
25
+ /**
26
+ * The Solid server-functions integration for a prerender run: captures
27
+ * `prerendered()` results as static artifacts and, in static mode, fails
28
+ * the build if the client can reach server functions nothing prerendered.
29
+ *
30
+ * ```ts
31
+ * import { prerender } from "prerender-crawler/vite";
32
+ * import { serverFunctions } from "@solidjs/prerender/integration";
33
+ *
34
+ * prerender({ mode: "static", integrations: [serverFunctions()] })
35
+ * ```
36
+ */
37
+ declare function serverFunctions(options?: ServerFunctionsIntegrationOptions): ServerFunctionsIntegration;
38
+
39
+ export { type ServerFunctionsIntegration, type ServerFunctionsIntegrationOptions, serverFunctions };
@@ -0,0 +1,77 @@
1
+ import {
2
+ CAPTURE_SINK,
3
+ canonicalJSON,
4
+ staticArtifactPath
5
+ } from "./chunk-XX54FQA3.js";
6
+
7
+ // src/integration.ts
8
+ import { existsSync, readFileSync } from "fs";
9
+ import path from "path";
10
+ var MANIFEST_PATH = ".vite/solid-server-functions.json";
11
+ function serverFunctions(options = {}) {
12
+ const artifacts = /* @__PURE__ */ new Map();
13
+ const captured = /* @__PURE__ */ new Set();
14
+ const globals = globalThis;
15
+ return {
16
+ name: "solid:server-functions",
17
+ captured,
18
+ setup() {
19
+ globals[CAPTURE_SINK] = {
20
+ async capture(id, args, value) {
21
+ captured.add(id);
22
+ const filename = await staticArtifactPath(id, args);
23
+ let payload = artifacts.get(filename);
24
+ if (!payload) {
25
+ payload = encodeArtifact(value, options.codec);
26
+ artifacts.set(filename, payload);
27
+ }
28
+ await payload;
29
+ }
30
+ };
31
+ },
32
+ async teardown(context) {
33
+ delete globals[CAPTURE_SINK];
34
+ guard(context, captured, options.uncaptured);
35
+ for (const [filename, payload] of artifacts) {
36
+ context.emitFile({ filename, contents: await payload });
37
+ }
38
+ }
39
+ };
40
+ }
41
+ function guard(context, captured, policy = context.mode === "static" ? "error" : "ignore") {
42
+ if (policy === "ignore") return;
43
+ const file = path.join(context.outDir, MANIFEST_PATH);
44
+ if (!existsSync(file)) return;
45
+ const manifest = JSON.parse(readFileSync(file, "utf8"));
46
+ if (Array.isArray(manifest) || !manifest.functions) {
47
+ console.warn(
48
+ `[@solidjs/prerender] ${MANIFEST_PATH} carries no function ids, so the static-mode guard cannot verify that every client-reachable server function was prerendered. Upgrade @solidjs/vite-plugin to a version that records them.`
49
+ );
50
+ return;
51
+ }
52
+ const uncaptured = manifest.functions.filter((fn) => !captured.has(fn.id));
53
+ if (uncaptured.length === 0) return;
54
+ const lines = uncaptured.map((fn) => ` - ${fn.name} (${fn.id}, ${fn.module})`);
55
+ const message = `[@solidjs/prerender] ${uncaptured.length} server function(s) the client can call were never captured during prerendering:
56
+ ${lines.join("\n")}
57
+ A static deployment has no server to answer them, so these calls fail at runtime. Wrap each in prerendered() and make sure a prerendered page performs the call (same arguments); calls that must stay live \u2014 mutations, per-request data \u2014 need a deployed server (mode: "hybrid"). Set uncaptured: "warn" on serverFunctions() to build anyway.`;
58
+ if (policy === "error") throw new Error(message);
59
+ console.warn(message);
60
+ }
61
+ async function encodeArtifact(value, codec) {
62
+ if (value === void 0) return "";
63
+ try {
64
+ return canonicalJSON(value);
65
+ } catch {
66
+ const { serializeResponseStream } = await import("@solidjs/web/server-functions/server");
67
+ return await new Response(
68
+ serializeResponseStream(
69
+ value,
70
+ codec
71
+ )
72
+ ).text();
73
+ }
74
+ }
75
+ export {
76
+ serverFunctions
77
+ };
@@ -0,0 +1,19 @@
1
+ import { P as PrerenderedFunction } from './shared-BcBpMOMU.js';
2
+ export { C as CaptureSink, s as staticArtifactPath, a as staticCallKey } from './shared-BcBpMOMU.js';
3
+
4
+ /**
5
+ * Declares a server function PRERENDERED — the server half. Calling the
6
+ * reference during SSR runs the function in-process exactly like a direct
7
+ * server-function call; during prerendering (when the prerender
8
+ * integration has installed its capture sink) each call's settled result
9
+ * is additionally captured as a static artifact keyed by the call's
10
+ * identity. The declaration implies `GET` — it registers the id's GET
11
+ * grant so the client's live fallback (dev, plugin-less builds) can
12
+ * dispatch over HTTP GET.
13
+ *
14
+ * See the client half (the browser build of this module) for the full
15
+ * declaration contract.
16
+ */
17
+ declare function prerendered<A extends readonly unknown[], R>(fn: (...args: A) => R): PrerenderedFunction<A, Awaited<R>>;
18
+
19
+ export { PrerenderedFunction, prerendered };
package/dist/server.js ADDED
@@ -0,0 +1,42 @@
1
+ import {
2
+ CAPTURE_SINK,
3
+ PRERENDERED_META_KEY,
4
+ staticArtifactPath,
5
+ staticCallKey
6
+ } from "./chunk-XX54FQA3.js";
7
+
8
+ // src/server.ts
9
+ import {
10
+ GET,
11
+ SERVER_FUNCTION_INVOKE,
12
+ getServerFunctionMetadata,
13
+ isServerFunction
14
+ } from "@solidjs/web/server-functions/server";
15
+ var SERVER_FUNCTION_METADATA = /* @__PURE__ */ Symbol.for("solid.ServerFunctionMetadata");
16
+ function prerendered(fn) {
17
+ if (!isServerFunction(fn)) {
18
+ throw new Error("prerendered expects a server function reference");
19
+ }
20
+ const source = getServerFunctionMetadata(fn)?.method === "GET" ? fn : GET(fn);
21
+ const id = source.id;
22
+ const run = async (args, options) => {
23
+ const value = await source[SERVER_FUNCTION_INVOKE](args, options);
24
+ const sink = globalThis[CAPTURE_SINK];
25
+ if (sink) await sink.capture(id, args, value);
26
+ return value;
27
+ };
28
+ const wrapped = ((...args) => run(args));
29
+ wrapped[SERVER_FUNCTION_METADATA] = {
30
+ ...getServerFunctionMetadata(source),
31
+ [PRERENDERED_META_KEY]: true
32
+ };
33
+ wrapped[SERVER_FUNCTION_INVOKE] = run;
34
+ wrapped.id = id;
35
+ Object.defineProperty(wrapped, "url", { get: () => source.url, configurable: true });
36
+ return wrapped;
37
+ }
38
+ export {
39
+ prerendered,
40
+ staticArtifactPath,
41
+ staticCallKey
42
+ };
@@ -0,0 +1,30 @@
1
+ /** What the server wrapper hands the sink per executed static call. */
2
+ interface CaptureSink {
3
+ capture(id: string, args: readonly unknown[], value: unknown): void | Promise<void>;
4
+ }
5
+ /**
6
+ * The artifact key of a static call: 128 bits of SHA-256 over the call's
7
+ * canonical spelling, hex-encoded. Async because hashing is
8
+ * (`crypto.subtle` is the one SHA-256 both realms share).
9
+ */
10
+ declare function staticCallKey(id: string, args: readonly unknown[]): Promise<string>;
11
+ /**
12
+ * The artifact's path relative to the static output root:
13
+ * `_static/<label>.<key>.json`. The label is a sanitized slice of the
14
+ * function id — for humans reading a build output or a network tab; the
15
+ * key alone carries the identity.
16
+ */
17
+ declare function staticArtifactPath(id: string, args: readonly unknown[]): Promise<string>;
18
+ /**
19
+ * The public shape of a prerendered reference — mirrors the runtime's
20
+ * `ServerFunction`: an async callable plus its build-stable identity.
21
+ */
22
+ interface PrerenderedFunction<A extends readonly unknown[] = unknown[], T = unknown> {
23
+ (...args: A): Promise<T>;
24
+ /** The build-stable function id. */
25
+ readonly id: string;
26
+ /** The live HTTP address the artifact stands in for (dev fallback, form actions). */
27
+ readonly url: string;
28
+ }
29
+
30
+ export { type CaptureSink as C, type PrerenderedFunction as P, staticCallKey as a, staticArtifactPath as s };
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@solidjs/prerender",
3
+ "version": "0.1.0",
4
+ "description": "Solid's integration for prerender-crawler: prerendered() turns server functions into build-time data captured as static artifacts, and the serverFunctions() integration captures them during the crawl and guards static builds against calls nothing prerendered.",
5
+ "license": "MIT",
6
+ "author": "Ryan Carniato",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/solidjs/prerender-crawler",
10
+ "directory": "packages/solid"
11
+ },
12
+ "homepage": "https://github.com/solidjs/prerender-crawler/tree/main/packages/solid#readme",
13
+ "bugs": "https://github.com/solidjs/prerender-crawler/issues",
14
+ "keywords": [
15
+ "solid",
16
+ "solidjs",
17
+ "prerender",
18
+ "static site generation",
19
+ "ssg",
20
+ "server functions"
21
+ ],
22
+ "type": "module",
23
+ "exports": {
24
+ ".": {
25
+ "browser": {
26
+ "types": "./dist/client.d.ts",
27
+ "default": "./dist/client.js"
28
+ },
29
+ "default": {
30
+ "types": "./dist/server.d.ts",
31
+ "default": "./dist/server.js"
32
+ }
33
+ },
34
+ "./integration": {
35
+ "types": "./dist/integration.d.ts",
36
+ "default": "./dist/integration.js"
37
+ }
38
+ },
39
+ "files": [
40
+ "dist",
41
+ "LICENSE",
42
+ "README.md"
43
+ ],
44
+ "engines": {
45
+ "node": ">=20"
46
+ },
47
+ "peerDependencies": {
48
+ "@solidjs/web": ">=2.0.0-rc.6",
49
+ "prerender-crawler": ">=0.1.0"
50
+ },
51
+ "devDependencies": {
52
+ "@solidjs/web": "^2.0.0-rc.6",
53
+ "@types/node": "^22.0.0",
54
+ "solid-js": "^2.0.0-rc.6",
55
+ "tsup": "^8.5.0",
56
+ "typescript": "^5.8.0",
57
+ "vitest": "^4.0.0",
58
+ "prerender-crawler": "^0.1.0"
59
+ },
60
+ "scripts": {
61
+ "build": "rm -rf dist && tsup",
62
+ "test": "vitest run",
63
+ "test:watch": "vitest"
64
+ }
65
+ }