@thexjs/core 0.1.4 → 0.1.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.
package/dist/data.d.ts ADDED
@@ -0,0 +1,56 @@
1
+ import { Database } from 'bun:sqlite';
2
+
3
+ interface SQLiteOptions {
4
+ path?: string;
5
+ wal?: boolean;
6
+ foreignKeys?: boolean;
7
+ }
8
+ declare function connectSQLite(options?: SQLiteOptions): Database;
9
+
10
+ interface PostgresClient {
11
+ unsafe(query: string): Promise<unknown>;
12
+ (strings: TemplateStringsArray, ...values: unknown[]): Promise<unknown>;
13
+ }
14
+ type PostgresSslMode = "disable" | "prefer" | "require" | "verify-ca" | "verify-full";
15
+ interface PostgresOptions {
16
+ url?: string;
17
+ /** Max connections in the pool. Default: 10. */
18
+ max?: number;
19
+ /**
20
+ * TLS policy. Defaults to `"require"` when NODE_ENV=production and
21
+ * `"disable"` otherwise (so local dev against a plain Postgres keeps
22
+ * working). Pass `false` to force-disable in production, or one of the
23
+ * Postgres SSL modes. `"no-verify"` is an alias for `"require"`.
24
+ */
25
+ ssl?: boolean | "no-verify" | PostgresSslMode;
26
+ /** PEM-encoded CA certificate, used with `verify-ca` / `verify-full`. */
27
+ ca?: string;
28
+ /**
29
+ * How many connection attempts to make (with exponential backoff) before
30
+ * the first query rejects. Handles the case where the database is still
31
+ * coming up when the app boots. Default: 3. Set to 0 to connect without
32
+ * retrying.
33
+ */
34
+ retryAttempts?: number;
35
+ /**
36
+ * Base delay (ms) between connection attempts, doubled each retry.
37
+ * Default: 250.
38
+ */
39
+ retryDelayMs?: number;
40
+ /** Called before each retry attempt (e.g. to log). */
41
+ onRetry?: (attempt: number, error: unknown) => void;
42
+ }
43
+ declare function connectPostgres(options?: PostgresOptions): PostgresClient;
44
+
45
+ interface MigrationResult {
46
+ applied: string[];
47
+ skipped: string[];
48
+ }
49
+ declare function runSQLiteMigrations(db: Database, migrationsDir: string): MigrationResult;
50
+ interface PostgresMigrationResult {
51
+ applied: string[];
52
+ skipped: string[];
53
+ }
54
+ declare function runPostgresMigrations(client: PostgresClient, migrationsDir: string): Promise<PostgresMigrationResult>;
55
+
56
+ export { type MigrationResult, type PostgresMigrationResult, type PostgresOptions, type SQLiteOptions, connectPostgres, connectSQLite, runPostgresMigrations, runSQLiteMigrations };
package/dist/data.js ADDED
@@ -0,0 +1,161 @@
1
+ // src/data/sqlite.ts
2
+ var require2 = import.meta.require;
3
+ function loadBunSQLite() {
4
+ try {
5
+ return require2("bun:sqlite");
6
+ } catch {
7
+ throw new Error(
8
+ "connectSQLite requires the Bun runtime (bun:sqlite). Use connectPostgres on non-Bun runtimes like Vercel."
9
+ );
10
+ }
11
+ }
12
+ function connectSQLite(options) {
13
+ const { Database: DB } = loadBunSQLite();
14
+ const db = new DB(options?.path ?? "data/dev.db");
15
+ if (options?.wal !== false) {
16
+ db.run("PRAGMA journal_mode = WAL");
17
+ }
18
+ if (options?.foreignKeys !== false) {
19
+ db.run("PRAGMA foreign_keys = ON");
20
+ }
21
+ return db;
22
+ }
23
+
24
+ // src/data/postgres.ts
25
+ var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
26
+ async function probeWithRetry(sql, attempts, baseDelay, onRetry) {
27
+ for (let attempt = 1; ; attempt++) {
28
+ try {
29
+ await sql.unsafe("SELECT 1");
30
+ return;
31
+ } catch (error) {
32
+ if (attempt >= attempts) throw error;
33
+ onRetry?.(attempt, error);
34
+ await sleep(baseDelay * 2 ** (attempt - 1));
35
+ }
36
+ }
37
+ }
38
+ function connectPostgres(options = {}) {
39
+ const url = options.url ?? process.env.DATABASE_URL;
40
+ if (!url) {
41
+ throw new Error(
42
+ "DATABASE_URL is required \u2014 set it via options.url or the DATABASE_URL environment variable"
43
+ );
44
+ }
45
+ const isProd = process.env.NODE_ENV === "production";
46
+ let sslMode;
47
+ if (options.ssl === false) {
48
+ sslMode = "disable";
49
+ } else if (options.ssl === true) {
50
+ sslMode = "require";
51
+ } else if (options.ssl === "no-verify") {
52
+ sslMode = "require";
53
+ } else if (typeof options.ssl === "string") {
54
+ sslMode = options.ssl;
55
+ } else {
56
+ sslMode = isProd ? "require" : "disable";
57
+ }
58
+ const connectionUrl = new URL(url);
59
+ if (sslMode !== "disable") {
60
+ connectionUrl.searchParams.set("sslmode", sslMode);
61
+ }
62
+ const client = new Bun.SQL({
63
+ url: connectionUrl,
64
+ max: options.max ?? 10,
65
+ // Providing a CA also turns on certificate verification (Bun escalates a
66
+ // `ca`-bearing tls object to verify-full), so only attach it when a
67
+ // verified mode is in effect.
68
+ ...options.ca && sslMode !== "disable" ? { tls: { ca: options.ca } } : {}
69
+ });
70
+ const attempts = options.retryAttempts ?? 3;
71
+ if (attempts <= 0) {
72
+ return client;
73
+ }
74
+ const sql = client;
75
+ let primed = null;
76
+ const prime = () => {
77
+ primed ??= probeWithRetry(client, attempts, options.retryDelayMs ?? 250, options.onRetry);
78
+ return primed;
79
+ };
80
+ const run = async (work) => {
81
+ await prime();
82
+ return work();
83
+ };
84
+ return new Proxy(sql, {
85
+ get(target, prop, receiver) {
86
+ if (prop === "unsafe") {
87
+ return (query) => run(() => client.unsafe(query));
88
+ }
89
+ const value = Reflect.get(target, prop, receiver);
90
+ return typeof value === "function" ? value.bind(target) : value;
91
+ },
92
+ apply(_target, _thisArg, args) {
93
+ const [strings, ...values] = args;
94
+ return run(() => client(strings, ...values));
95
+ }
96
+ });
97
+ }
98
+
99
+ // src/data/migrate.ts
100
+ import { readFileSync, readdirSync } from "fs";
101
+ import { join } from "path";
102
+ function runSQLiteMigrations(db, migrationsDir) {
103
+ db.run(`CREATE TABLE IF NOT EXISTS _x_migrations (
104
+ name TEXT PRIMARY KEY,
105
+ applied_at TEXT DEFAULT (datetime('now'))
106
+ )`);
107
+ const stmt = db.prepare("SELECT name FROM _x_migrations");
108
+ const applied = new Set(stmt.all().map((r) => r.name));
109
+ let files;
110
+ try {
111
+ files = readdirSync(migrationsDir).filter((f) => f.endsWith(".sql")).sort();
112
+ } catch {
113
+ return { applied: [], skipped: [] };
114
+ }
115
+ const result = { applied: [], skipped: [] };
116
+ for (const file of files) {
117
+ if (applied.has(file)) {
118
+ result.skipped.push(file);
119
+ continue;
120
+ }
121
+ const sql = readFileSync(join(migrationsDir, file), "utf-8");
122
+ db.run(sql);
123
+ db.run("INSERT INTO _x_migrations (name) VALUES (?1)", [file]);
124
+ console.log(`[x] migration applied: ${file}`);
125
+ result.applied.push(file);
126
+ }
127
+ return result;
128
+ }
129
+ async function runPostgresMigrations(client, migrationsDir) {
130
+ await client.unsafe(`CREATE TABLE IF NOT EXISTS _x_migrations (
131
+ name TEXT PRIMARY KEY,
132
+ applied_at TIMESTAMP DEFAULT NOW()
133
+ )`);
134
+ const rows = await client.unsafe("SELECT name FROM _x_migrations");
135
+ const applied = new Set(rows.map((r) => r.name));
136
+ let files;
137
+ try {
138
+ files = readdirSync(migrationsDir).filter((f) => f.endsWith(".sql")).sort();
139
+ } catch {
140
+ return { applied: [], skipped: [] };
141
+ }
142
+ const result = { applied: [], skipped: [] };
143
+ for (const file of files) {
144
+ if (applied.has(file)) {
145
+ result.skipped.push(file);
146
+ continue;
147
+ }
148
+ const raw = readFileSync(join(migrationsDir, file), "utf-8");
149
+ await client.unsafe(raw);
150
+ await client.unsafe(`INSERT INTO _x_migrations (name) VALUES ('${file}')`);
151
+ console.log(`[x] migration applied: ${file}`);
152
+ result.applied.push(file);
153
+ }
154
+ return result;
155
+ }
156
+ export {
157
+ connectPostgres,
158
+ connectSQLite,
159
+ runPostgresMigrations,
160
+ runSQLiteMigrations
161
+ };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import * as react from 'react';
2
- import { ReactNode, AnchorHTMLAttributes } from 'react';
3
- import { Database } from 'bun:sqlite';
2
+ import { ComponentType, ReactNode, AnchorHTMLAttributes } from 'react';
4
3
 
5
4
  interface RouteEntry {
6
5
  filePath: string;
@@ -41,6 +40,47 @@ declare function findMiddlewareChain(routeFilePath: string, middleware: Middlewa
41
40
  declare function generateManifestSource(routes: RouteEntry[]): string;
42
41
  declare function writeManifest(routes: RouteEntry[], routesDir: string): string;
43
42
 
43
+ type RouteMode = "static" | "server";
44
+ interface BuildOptions {
45
+ routesDir?: string;
46
+ pagesDir?: string;
47
+ apiDir?: string;
48
+ layoutsDir?: string;
49
+ actionsDir?: string;
50
+ contentDir?: string;
51
+ outDir?: string;
52
+ /**
53
+ * Absolute path to the project's x.config.ts/js/mjs, if any. When set, the
54
+ * generated production server entry re-imports it at startup and forwards
55
+ * its `security`/`observability` fields into `createApp()` — those fields
56
+ * can hold live values (rate-limit key functions, error reporters, health
57
+ * checks) that can't be serialized into the generated file directly.
58
+ */
59
+ configPath?: string;
60
+ }
61
+ declare function build(options: BuildOptions): Promise<void>;
62
+
63
+ /**
64
+ * Minimal remote-image proxy. Fetches an allow-listed remote image
65
+ * server-side and streams it back from your own origin at /_x/image, so the
66
+ * browser never makes a cross-origin request and CSP img-src can stay
67
+ * 'self'-only. No resizing/optimization — just proxy + cache headers.
68
+ */
69
+ interface ImageProxyOptions {
70
+ /** Hostnames allowed to be proxied, e.g. ["stardance.hackclub.com"]. Required — an empty/missing list disables the route (404). */
71
+ remoteHosts?: string[];
72
+ }
73
+ /** Returns a handler for GET /_x/image?url=<encoded remote url>, or null if the request doesn't match. */
74
+ declare function createImageProxyHandler(options?: ImageProxyOptions): (req: Request) => Promise<Response | null>;
75
+
76
+ interface MiddlewareContext {
77
+ params: Record<string, string>;
78
+ request: Request;
79
+ }
80
+ type MiddlewareNext = () => Promise<Response>;
81
+ type MiddlewareFn = (ctx: MiddlewareContext, next: MiddlewareNext) => Promise<Response>;
82
+ declare function composeMiddleware(fns: MiddlewareFn[], handler: (ctx: MiddlewareContext) => Promise<Response>): MiddlewareFn;
83
+
44
84
  /**
45
85
  * Built-in `/healthz` and `/readyz` endpoints for container orchestrators
46
86
  * (Kubernetes, Docker Swarm, Railway, Fly.io) to probe process health and
@@ -181,11 +221,13 @@ declare function buildSecurityHeaders(options?: SecurityHeadersOptions): Headers
181
221
  declare function applySecurityHeaders(res: Response, options?: SecurityHeadersOptions): Response;
182
222
 
183
223
  /**
184
- * Lightweight in-memory rate limiter. Fixed-window counter keyed by client
185
- * IP by default. Good enough for a single-process Bun deployment or as a
186
- * first line of defense in front of brute-force/DDoS traffic; for multi-instance
187
- * deployments, front this with a shared store (Redis, etc.) via a custom `keyFn`
188
- * and store — this implementation intentionally has no external dependencies.
224
+ * Lightweight fixed-window rate limiter. In-memory by default, keyed by client
225
+ * IP — good enough for a single-process Bun deployment or as a first line of
226
+ * defense in front of brute-force/DDoS traffic. For multi-instance deployments
227
+ * (K8s, multiple replicas) pass a shared `store` (see `createRedisRateLimitStore`)
228
+ * so limits are enforced across processes. This implementation has no external
229
+ * dependencies: the Redis store lazy-imports Bun's built-in `bun:redis` only
230
+ * when it's actually used.
189
231
  */
190
232
  interface RateLimitOptions {
191
233
  /** Max requests allowed per window per key. Default: 60. */
@@ -194,6 +236,8 @@ interface RateLimitOptions {
194
236
  windowMs?: number;
195
237
  /** Derives the rate-limit bucket key from a request. Default: client IP from standard headers. */
196
238
  keyFn?: (req: Request) => string;
239
+ /** Optional shared store (e.g. Redis) for multi-instance deployments. */
240
+ store?: RateLimitStore;
197
241
  }
198
242
  interface RateLimitResult {
199
243
  ok: boolean;
@@ -201,21 +245,42 @@ interface RateLimitResult {
201
245
  remaining: number;
202
246
  resetAt: number;
203
247
  }
248
+ /**
249
+ * A shared backend for rate-limit counters. Implementations must atomically
250
+ * increment the counter for `key` (creating a fresh window of `windowMs`
251
+ * when the key is new) and return the new count plus when the window resets.
252
+ */
253
+ interface RateLimitStore {
254
+ incr(key: string, windowMs: number): Promise<{
255
+ count: number;
256
+ resetAt: number;
257
+ }>;
258
+ }
204
259
  interface Bucket {
205
260
  count: number;
206
261
  resetAt: number;
207
262
  }
208
263
  /** Creates an independent rate limiter with its own bucket store. */
209
264
  declare function createRateLimiter(options?: RateLimitOptions): {
210
- check: (req: Request) => RateLimitResult;
265
+ check: (req: Request) => Promise<RateLimitResult>;
211
266
  sweep: () => void;
212
267
  buckets: Map<string, Bucket>;
268
+ dispose: () => void;
213
269
  };
214
270
  /**
215
271
  * Convenience middleware-style handler: returns a 429 Response when the
216
272
  * limit is exceeded, or null when the request should proceed.
217
273
  */
218
- declare function rateLimitMiddleware(limiter: ReturnType<typeof createRateLimiter>, req: Request): Response | null;
274
+ declare function rateLimitMiddleware(limiter: ReturnType<typeof createRateLimiter>, req: Request): Promise<Response | null>;
275
+ /**
276
+ * Shared rate-limit store backed by Redis, so limits are enforced across
277
+ * multiple server instances. Uses Bun's built-in `bun:redis` (no npm
278
+ * dependency) and connects lazily on first use. Pass the result as
279
+ * `store` in `createRateLimiter`/`security.rateLimit`.
280
+ */
281
+ declare function createRedisRateLimitStore(options?: {
282
+ url?: string;
283
+ }): RateLimitStore;
219
284
 
220
285
  interface RouteProps {
221
286
  params: Record<string, string>;
@@ -234,6 +299,14 @@ interface CreateAppOptions {
234
299
  actionsDir?: string;
235
300
  port?: number;
236
301
  development?: boolean;
302
+ /**
303
+ * Resolved stylesheet <link> href (e.g. "/styles.css"), precomputed by the
304
+ * build. Runtimes that can't check the filesystem at request time (Vercel's
305
+ * Node.js functions) rely on this so server-rendered pages still emit the
306
+ * stylesheet tag. When unset, createApp falls back to a runtime probe of
307
+ * `public/styles.css`.
308
+ */
309
+ stylesheetHref?: string;
237
310
  security?: {
238
311
  /** CSRF protection for /__x/actions/* requests. Origin/Referer verification is always on unless disabled. */
239
312
  csrf?: CsrfOptions;
@@ -250,6 +323,42 @@ interface CreateAppOptions {
250
323
  /** /healthz and /readyz endpoints, served ahead of all other routing. */
251
324
  health?: HealthCheckOptions;
252
325
  };
326
+ /** Remote-image proxy at /_x/image?url=... — see ImageProxyOptions. Unset/empty remoteHosts means the route 404s. */
327
+ images?: ImageProxyOptions;
328
+ /**
329
+ * Pre-resolved routes/actions for runtimes that can't scan the filesystem
330
+ * or dynamically `import()` a `.tsx` file at request time (e.g. Vercel's
331
+ * Node.js functions). When set, `createApp` skips all scanning and dynamic
332
+ * imports and builds its handlers straight from this manifest — exactly
333
+ * the same request pipeline (health, rate limit, revalidation, server
334
+ * actions, static assets, islands, image proxy, routing, 404, security
335
+ * headers) as a normally-scanned app.
336
+ */
337
+ preloaded?: PreloadedAppManifest;
338
+ }
339
+ interface PreloadedRoute {
340
+ /** Route metadata (path, param names, api flag). */
341
+ entry: RouteEntry;
342
+ mode: RouteMode;
343
+ /** ISR revalidate seconds for static-mode pages. */
344
+ revalidate?: number;
345
+ /** The route's module namespace (default, loader, middleware, actions, GET/POST...). */
346
+ module: Record<string, unknown>;
347
+ layoutModules: ComponentType<{
348
+ children: ReactNode;
349
+ }>[];
350
+ middlewareModules: MiddlewareFn[];
351
+ /** Layout source file paths, used as the island-bundle cache key on Bun. */
352
+ layoutFilePaths?: string[];
353
+ /** Pre-resolved island <script> URLs for server-mode pages. When omitted, islands are discovered/bundled at request time (Bun only). */
354
+ islandScripts?: string[];
355
+ }
356
+ interface PreloadedAppManifest {
357
+ routes: PreloadedRoute[];
358
+ notFoundComponent?: ComponentType<RouteProps>;
359
+ notFoundLayout?: ComponentType<{
360
+ children: ReactNode;
361
+ }>;
253
362
  }
254
363
  interface AppServeOptions {
255
364
  routes: Record<string, (req: Request) => Promise<Response> | Response>;
@@ -299,26 +408,6 @@ declare function renderStreamingPage(node: ReactNode, options?: RenderOptions):
299
408
  */
300
409
  declare const CLIENT_NAV_SCRIPT: string;
301
410
 
302
- type RouteMode = "static" | "server";
303
- interface BuildOptions {
304
- routesDir?: string;
305
- pagesDir?: string;
306
- apiDir?: string;
307
- layoutsDir?: string;
308
- actionsDir?: string;
309
- contentDir?: string;
310
- outDir?: string;
311
- /**
312
- * Absolute path to the project's x.config.ts/js/mjs, if any. When set, the
313
- * generated production server entry re-imports it at startup and forwards
314
- * its `security`/`observability` fields into `createApp()` — those fields
315
- * can hold live values (rate-limit key functions, error reporters, health
316
- * checks) that can't be serialized into the generated file directly.
317
- */
318
- configPath?: string;
319
- }
320
- declare function build(options: BuildOptions): Promise<void>;
321
-
322
411
  interface Frontmatter {
323
412
  title?: string;
324
413
  [key: string]: unknown;
@@ -353,7 +442,7 @@ declare function Island({ name, client, children, }: {
353
442
 
354
443
  interface LinkProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "href"> {
355
444
  href: string;
356
- children: ReactNode;
445
+ children?: ReactNode;
357
446
  /** Use client-side navigation instead of a full page load (default: true). */
358
447
  clientNav?: boolean;
359
448
  /** Prefetch the destination on hover/focus (default: true). Requires client nav. */
@@ -365,14 +454,6 @@ interface LinkProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "href"
365
454
  */
366
455
  declare function Link({ href, children, clientNav, prefetch, ...rest }: LinkProps): react.JSX.Element;
367
456
 
368
- interface MiddlewareContext {
369
- params: Record<string, string>;
370
- request: Request;
371
- }
372
- type MiddlewareNext = () => Promise<Response>;
373
- type MiddlewareFn = (ctx: MiddlewareContext, next: MiddlewareNext) => Promise<Response>;
374
- declare function composeMiddleware(fns: MiddlewareFn[], handler: (ctx: MiddlewareContext) => Promise<Response>): MiddlewareFn;
375
-
376
457
  declare function generateServerFunctionClient(routeFilePath: string, fnNames: string[], endpointBase: string): string;
377
458
  declare function resetServerFunctions(): void;
378
459
  declare function registerServerFunctions(routePath: string, paramNames: string[], fns: Record<string, (...args: unknown[]) => Promise<unknown>>): void;
@@ -423,31 +504,4 @@ declare const logger: Logger;
423
504
  */
424
505
  declare function withRequestLogging(handler: (req: Request) => Response | Promise<Response>): (req: Request) => Promise<Response>;
425
506
 
426
- interface SQLiteOptions {
427
- path?: string;
428
- wal?: boolean;
429
- foreignKeys?: boolean;
430
- }
431
- declare function connectSQLite(options?: SQLiteOptions): Database;
432
-
433
- interface PostgresClient {
434
- unsafe(query: string): Promise<unknown>;
435
- (strings: TemplateStringsArray, ...values: unknown[]): Promise<unknown>;
436
- }
437
- interface PostgresOptions {
438
- url?: string;
439
- }
440
- declare function connectPostgres(options?: PostgresOptions): PostgresClient;
441
-
442
- interface MigrationResult {
443
- applied: string[];
444
- skipped: string[];
445
- }
446
- declare function runSQLiteMigrations(db: Database, migrationsDir: string): MigrationResult;
447
- interface PostgresMigrationResult {
448
- applied: string[];
449
- skipped: string[];
450
- }
451
- declare function runPostgresMigrations(client: PostgresClient, migrationsDir: string): Promise<PostgresMigrationResult>;
452
-
453
- export { type BuildOptions, CLIENT_NAV_SCRIPT, type ContentEntry, type CreateAppOptions, type CsrfOptions, type CsrfResult, DefaultNotFound, EnvLeakageError, type ErrorContext, type ErrorReporter, type Frontmatter, type HealthCheck, type HealthCheckOptions, Island, type IslandEntry, type IslandMode, IslandProvider, type LayoutEntry, Link, type LinkProps, type LoaderArgs, type LoaderReturn, type LogFields, type Logger, type MiddlewareContext, type MiddlewareEntry, type MiddlewareFn, type MiddlewareNext, type NotFoundEntry, type OtelTracerLike, PUBLIC_ENV_PREFIX, type RateLimitOptions, type RateLimitResult, type ReadinessResult, type RevalidateOptions, type RouteEntry, type RouteMode, type RouteProps, type SecurityHeadersOptions, type SentryLike, applySecurityHeaders, assertNoEnvLeakage, build, buildSecurityHeaders, checkCsrf, combineReporters, composeMiddleware, connectPostgres, connectSQLite, createApp, createHealthCheckHandler, createOtelReporter, createRateLimiter, createSentryReporter, defineConfig, escapeHtml, findLayoutChain, findLeakedEnvKeys, findMiddlewareChain, generateCsrfToken, generateManifestSource, generateServerFunctionClient, getErrorReporter, getServerFunctionHandler, logger, noopReporter, rateLimitMiddleware, registerServerFunctions, renderErrorOverlay, renderMarkdown, renderPage, renderStaticPage, renderStreamingPage, reportException, resetServerFunctions, runPostgresMigrations, runSQLiteMigrations, scanApiDir, scanContent, scanLayouts, scanLayoutsDir, scanMiddleware, scanNotFound, scanPages, scanRoutes, setErrorReporter, verifyCsrfToken, verifyOrigin, withCsrfCookie, withRequestLogging, writeManifest };
507
+ export { type BuildOptions, CLIENT_NAV_SCRIPT, type ContentEntry, type CreateAppOptions, type CsrfOptions, type CsrfResult, DefaultNotFound, EnvLeakageError, type ErrorContext, type ErrorReporter, type Frontmatter, type HealthCheck, type HealthCheckOptions, type ImageProxyOptions, Island, type IslandEntry, type IslandMode, IslandProvider, type LayoutEntry, Link, type LinkProps, type LoaderArgs, type LoaderReturn, type LogFields, type Logger, type MiddlewareContext, type MiddlewareEntry, type MiddlewareFn, type MiddlewareNext, type NotFoundEntry, type OtelTracerLike, PUBLIC_ENV_PREFIX, type RateLimitOptions, type RateLimitResult, type RateLimitStore, type ReadinessResult, type RevalidateOptions, type RouteEntry, type RouteMode, type RouteProps, type SecurityHeadersOptions, type SentryLike, applySecurityHeaders, assertNoEnvLeakage, build, buildSecurityHeaders, checkCsrf, combineReporters, composeMiddleware, createApp, createHealthCheckHandler, createImageProxyHandler, createOtelReporter, createRateLimiter, createRedisRateLimitStore, createSentryReporter, defineConfig, escapeHtml, findLayoutChain, findLeakedEnvKeys, findMiddlewareChain, generateCsrfToken, generateManifestSource, generateServerFunctionClient, getErrorReporter, getServerFunctionHandler, logger, noopReporter, rateLimitMiddleware, registerServerFunctions, renderErrorOverlay, renderMarkdown, renderPage, renderStaticPage, renderStreamingPage, reportException, resetServerFunctions, scanApiDir, scanContent, scanLayouts, scanLayoutsDir, scanMiddleware, scanNotFound, scanPages, scanRoutes, setErrorReporter, verifyCsrfToken, verifyOrigin, withCsrfCookie, withRequestLogging, writeManifest };