@thexjs/core 1.3.4 → 1.3.6

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/adapter.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  scanNotFound,
10
10
  scanPages,
11
11
  scanRoutes
12
- } from "./chunk-LV4CJQYM.js";
12
+ } from "./chunk-VAWSOVGY.js";
13
13
 
14
14
  // src/adapter/bundle.ts
15
15
  import { mkdirSync, rmSync, writeFileSync } from "fs";
@@ -267,8 +267,8 @@ function findMiddlewareChain(routeFilePath, middleware, routesDir) {
267
267
  return chain;
268
268
  }
269
269
  function routePatternToRegex(routePath) {
270
- const regexStr = routePath.replace(/\//g, "\\/").replace(/:(\w+)/g, "([^/]+)").replace(/\*/g, "(.+)");
271
- return new RegExp(`^${regexStr}$`);
270
+ const escaped = routePath.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\//g, "\\/").replace(/:(\w+)/g, "([^/]+)").replace(/\*/g, "(.+)");
271
+ return new RegExp(`^${escaped}$`);
272
272
  }
273
273
  function extractParams(routePath, paramNames, url) {
274
274
  const regex = routePatternToRegex(routePath);
@@ -323,6 +323,65 @@ function writeManifest(routes, routesDir) {
323
323
  return manifestPath;
324
324
  }
325
325
 
326
+ // src/security/body-size.ts
327
+ var DEFAULT_MAX_BODY_SIZE = 1048576;
328
+ var RequestBodyTooLargeError = class extends Error {
329
+ maxBytes;
330
+ constructor(maxBytes) {
331
+ super(`Request body exceeds the ${maxBytes} byte limit`);
332
+ this.name = "RequestBodyTooLargeError";
333
+ this.maxBytes = maxBytes;
334
+ }
335
+ };
336
+ function isBodylessMethod(method) {
337
+ return method === "GET" || method === "HEAD" || method === "OPTIONS";
338
+ }
339
+ function enforceRequestBodySize(req, maxBytes) {
340
+ if (isBodylessMethod(req.method)) return req;
341
+ const contentLength = req.headers.get("content-length");
342
+ if (contentLength !== null) {
343
+ const declared = Number(contentLength);
344
+ if (Number.isFinite(declared) && declared > maxBytes) {
345
+ return new Response("Payload too large", {
346
+ status: 413,
347
+ headers: { "Content-Type": "text/plain; charset=utf-8" }
348
+ });
349
+ }
350
+ return req;
351
+ }
352
+ const source = req.body;
353
+ if (source === null) return req;
354
+ const { readable, writable } = new TransformStream();
355
+ const writer = writable.getWriter();
356
+ let total = 0;
357
+ const pump = async () => {
358
+ const reader = source.getReader();
359
+ try {
360
+ while (true) {
361
+ const { done, value } = await reader.read();
362
+ if (done) break;
363
+ total += value.byteLength;
364
+ if (total > maxBytes) {
365
+ await reader.cancel().catch(() => {
366
+ });
367
+ await writer.abort(new RequestBodyTooLargeError(maxBytes));
368
+ return;
369
+ }
370
+ await writer.write(value);
371
+ }
372
+ await writer.close();
373
+ } catch (err) {
374
+ await writer.abort(err);
375
+ }
376
+ };
377
+ void pump();
378
+ return new Request(req.url, {
379
+ method: req.method,
380
+ headers: req.headers,
381
+ body: readable
382
+ });
383
+ }
384
+
326
385
  // src/security/csrf.ts
327
386
  var CSRF_COOKIE_NAME = "x_csrf_token";
328
387
  var CSRF_HEADER_NAME = "x-csrf-token";
@@ -366,6 +425,15 @@ function readCookie(req, name) {
366
425
  }
367
426
  return null;
368
427
  }
428
+ function tokensEqual(a, b) {
429
+ const encoder = new TextEncoder();
430
+ const aBytes = encoder.encode(a);
431
+ const bBytes = encoder.encode(b);
432
+ if (aBytes.length !== bBytes.length) return false;
433
+ let diff = 0;
434
+ for (let i = 0; i < aBytes.length; i++) diff |= (aBytes[i] ?? 0) ^ (bBytes[i] ?? 0);
435
+ return diff === 0;
436
+ }
369
437
  function verifyCsrfToken(req) {
370
438
  if (SAFE_METHODS.has(req.method)) return { ok: true };
371
439
  const cookieToken = readCookie(req, CSRF_COOKIE_NAME);
@@ -373,7 +441,7 @@ function verifyCsrfToken(req) {
373
441
  if (!cookieToken || !headerToken) {
374
442
  return { ok: false, reason: `missing CSRF cookie or "${CSRF_HEADER_NAME}" header` };
375
443
  }
376
- if (cookieToken !== headerToken) {
444
+ if (!tokensEqual(cookieToken, headerToken)) {
377
445
  return { ok: false, reason: "CSRF token mismatch" };
378
446
  }
379
447
  return { ok: true };
@@ -466,14 +534,24 @@ function getServerFunctionHandler(csrfOptions) {
466
534
  try {
467
535
  const body = await req.json();
468
536
  args = Array.isArray(body) ? body : [body];
469
- } catch {
537
+ } catch (err) {
538
+ if (err instanceof RequestBodyTooLargeError) {
539
+ return new Response("Payload too large", { status: 413 });
540
+ }
470
541
  return new Response("Invalid request body", { status: 400 });
471
542
  }
472
543
  try {
473
544
  const result = await fn(...args);
474
545
  return Response.json(result);
475
546
  } catch (err) {
476
- reportException(err, { route: concretePath, phase: "action" });
547
+ const errorId = crypto.randomUUID().replace(/-/g, "");
548
+ reportException(err, { route: concretePath, phase: "action", errorId });
549
+ if (process.env.NODE_ENV === "production") {
550
+ return new Response(`Internal error (id: ${errorId})`, {
551
+ status: 500,
552
+ headers: { "x-x-error-id": errorId }
553
+ });
554
+ }
477
555
  const message = err instanceof Error ? err.message : "Internal error";
478
556
  return new Response(message, { status: 500 });
479
557
  }
@@ -540,17 +618,36 @@ function resolveIsland(name: string) {
540
618
 
541
619
  // Islands whose render is non-deterministic (e.g. \`useState(() => ...)\` with
542
620
  // Math.random) can't be hydrated against their SSR output. React recovers by
543
- // re-rendering client-side, so the island is still fully interactive -- the
544
- // mismatch is benign, so swallow the recovery so it doesn't spam the console
545
- // or cascade into React's event system.
546
- function onRecoverableError() {}
621
+ // re-rendering client-side, so the island is still fully interactive. The
622
+ // mismatch is NOT silently swallowed: it is reported to the server so real
623
+ // rendering bugs are observable in production instead of hidden.
624
+ function reportHydrationMismatch(error, name) {
625
+ try {
626
+ console.error("[x] hydration mismatch on island '" + name + "':", error);
627
+ } catch (_) {}
628
+ try {
629
+ var message = error instanceof Error ? error.message : String(error);
630
+ navigator.sendBeacon(
631
+ "/__x/hydration-mismatch",
632
+ new Blob([JSON.stringify({ error: message, island: name, url: location.href })], {
633
+ type: "application/json",
634
+ }),
635
+ );
636
+ } catch (_) {
637
+ // sendBeacon is best-effort; a failing beacon must not break hydration.
638
+ }
639
+ }
547
640
 
548
641
  document.querySelectorAll("[data-island]").forEach((el) => {
549
642
  const name = el.getAttribute("data-island");
550
643
  if (!name) return;
551
644
  const Component = resolveIsland(name);
552
645
  if (!Component) return;
553
- hydrateRoot(el, React.createElement(Component), { onRecoverableError });
646
+ hydrateRoot(el, React.createElement(Component), {
647
+ onRecoverableError(error) {
648
+ reportHydrationMismatch(error, name);
649
+ },
650
+ });
554
651
  });
555
652
  `;
556
653
  }
@@ -675,6 +772,9 @@ export {
675
772
  extractParams,
676
773
  generateManifestSource,
677
774
  writeManifest,
775
+ DEFAULT_MAX_BODY_SIZE,
776
+ RequestBodyTooLargeError,
777
+ enforceRequestBodySize,
678
778
  verifyOrigin,
679
779
  generateCsrfToken,
680
780
  verifyCsrfToken,
package/dist/index.d.ts CHANGED
@@ -50,15 +50,23 @@ declare function scanContent(rootDir: string): ContentEntry[];
50
50
  declare function escapeHtml(s: string): string;
51
51
  declare function renderMarkdown(md: string): string;
52
52
 
53
- /**
54
- * Minimal remote-image proxy. Fetches an allow-listed remote image
55
- * server-side and streams it back from your own origin at /_x/image, so the
56
- * browser never makes a cross-origin request and CSP img-src can stay
57
- * 'self'-only. No resizing/optimization — just proxy + cache headers.
58
- */
59
53
  interface ImageProxyOptions {
60
54
  /** Hostnames allowed to be proxied, e.g. ["stardance.hackclub.com"]. Required — an empty/missing list disables the route (404). */
61
55
  remoteHosts?: string[];
56
+ /**
57
+ * Max bytes to accept from an upstream image. Enforced via `Content-Length`
58
+ * (rejected before streaming) and a counting stream (aborted mid-transfer).
59
+ * Default: 10 MiB.
60
+ */
61
+ maxBytes?: number;
62
+ /**
63
+ * Resolves an allow-listed hostname to its IPs for the DNS-rebinding check.
64
+ * Every returned IP must be public. The default uses `Bun.dns.lookup`
65
+ * (RFC 2606 test/reserved TLDs are skipped). Override to pin answers or
66
+ * route through a resolver. A resolver error fails open — an unreachable
67
+ * DNS must not break image loading.
68
+ */
69
+ resolveHost?: (hostname: string) => Promise<string[]>;
62
70
  }
63
71
  /** Returns a handler for GET /_x/image?url=<encoded remote url>, or null if the request doesn't match. */
64
72
  declare function createImageProxyHandler(options?: ImageProxyOptions): (req: Request) => Promise<Response | null>;
@@ -200,7 +208,11 @@ declare function withRequestMetrics<Server = unknown>(reporter: MetricsReporter,
200
208
  interface ErrorContext {
201
209
  route?: string;
202
210
  requestId?: string;
211
+ /** Opaque correlation id echoed to clients so they can reference the incident. */
212
+ errorId?: string;
203
213
  phase: "ssr" | "action" | "api" | "loader";
214
+ /** Free-form discriminator, e.g. `hydration-mismatch`, for filtering. */
215
+ tag?: string;
204
216
  }
205
217
  interface ErrorReporter {
206
218
  captureException(error: unknown, context: ErrorContext): void;
@@ -341,6 +353,14 @@ interface SecurityHeadersOptions {
341
353
  contentTypeOptions?: string | false;
342
354
  /** Referrer-Policy. Default: "strict-origin-when-cross-origin". Set false to disable. */
343
355
  referrerPolicy?: string | false;
356
+ /**
357
+ * Per-response random nonce for the default Content-Security-Policy. When
358
+ * present, `script-src` becomes `'self' 'nonce-<value>'` instead of
359
+ * `'self' 'unsafe-inline'`, letting HTML responses defend against inline
360
+ * script injection. Ignored when a custom `contentSecurityPolicy` is set —
361
+ * that value is applied verbatim.
362
+ */
363
+ cspNonce?: string;
344
364
  }
345
365
  declare function buildSecurityHeaders(options?: SecurityHeadersOptions): Headers;
346
366
  /** Returns a new Response with security headers merged onto the original response's headers. */
@@ -474,6 +494,14 @@ interface CreateAppOptions {
474
494
  };
475
495
  /** Remote-image proxy at /_x/image?url=... — see ImageProxyOptions. Unset/empty remoteHosts means the route 404s. */
476
496
  images?: ImageProxyOptions;
497
+ /**
498
+ * Maximum request body size in bytes, enforced ahead of route/action
499
+ * dispatch (including `/api/*` and `/__x/actions/*`). Requests whose
500
+ * `Content-Length` exceeds this are rejected with 413; chunked requests
501
+ * without a `Content-Length` are aborted mid-stream once the limit is
502
+ * crossed. Default: 1 MiB.
503
+ */
504
+ maxBodySize?: number;
477
505
  /**
478
506
  * Pre-resolved routes/actions for runtimes that can't scan the filesystem
479
507
  * or dynamically `import()` a `.tsx` file at request time (e.g. Vercel's
@@ -603,6 +631,105 @@ declare function Link({ href, children, clientNav, prefetch, ...rest }: LinkProp
603
631
 
604
632
  declare function DefaultNotFound(_props: RouteProps): react.JSX.Element;
605
633
 
634
+ /**
635
+ * Structured, append-only audit logging for security-relevant events.
636
+ *
637
+ * Mirrors the `MetricsReporter`/`ErrorReporter` pluggability discipline: a
638
+ * default sink prints one JSON line per event to stdout (append-only at the OS
639
+ * level), and enterprise deployments swap in a SIEM sink via `setAuditSink`
640
+ * without forking the framework. Every entry carries the event type, a
641
+ * timestamp, `userId` (or null), the client IP (or null) and a human-readable
642
+ * reason, so a compliance reviewer can answer "who did what, when" and an
643
+ * operator can spot brute-force patterns.
644
+ *
645
+ * Secrets are scrubbed before emission: the reason string and any metadata are
646
+ * passed through the same redaction used by the logger, and fields are
647
+ * structured (typed keys) rather than free-form blobs, so a password or token
648
+ * value cannot slip into an entry.
649
+ */
650
+ type AuditEvent = "auth.login.success" | "auth.login.failure" | "auth.logout" | "auth.password_changed" | "auth.role_changed" | "auth.permission_denied" | "auth.session_revoked";
651
+ interface AuditEntry {
652
+ timestamp: string;
653
+ event: AuditEvent;
654
+ userId: string | null;
655
+ ip: string | null;
656
+ reason?: string;
657
+ provider?: string;
658
+ requestId?: string;
659
+ /** HMAC digest of the session token (safe to store — not the token itself). */
660
+ sessionHash?: string;
661
+ metadata?: Record<string, unknown>;
662
+ }
663
+ /** Receives audit entries. Implementations must treat them as append-only. */
664
+ interface AuditSink {
665
+ write(entry: AuditEntry): void;
666
+ }
667
+ /** No-op sink used until an app installs one. */
668
+ declare const noopAuditSink: AuditSink;
669
+ /** Default sink: one JSON object per line on stdout — append-only at the OS level. */
670
+ declare function createConsoleAuditSink(): AuditSink;
671
+ declare function setAuditSink(sink: AuditSink): void;
672
+ declare function getAuditSink(): AuditSink;
673
+ /** Best-effort client IP from proxy headers; null when the request has none. */
674
+ declare function clientIpFromRequest(req: Request): string | null;
675
+ /** Correlation id already assigned to the request by `withRequestLogging`, if any. */
676
+ declare function requestIdFromRequest(req: Request): string | undefined;
677
+ /**
678
+ * Emits an audit entry with the reason (and any metadata) redacted so secret
679
+ * patterns that ride along in error strings or metadata objects never reach
680
+ * the sink.
681
+ */
682
+ declare function audit(entry: AuditEntry): void;
683
+ interface AuditEventInput {
684
+ userId: string | null;
685
+ ip: string | null;
686
+ reason?: string;
687
+ provider?: string;
688
+ requestId?: string;
689
+ sessionHash?: string;
690
+ metadata?: Record<string, unknown>;
691
+ }
692
+ /** Convenience helpers for the framework's own events and app-driven events. */
693
+ declare function auditLoginSuccess(input: AuditEventInput & {
694
+ userId: string;
695
+ }): void;
696
+ declare function auditLoginFailure(input: AuditEventInput): void;
697
+ declare function auditLogout(input: AuditEventInput): void;
698
+ declare function auditPasswordChanged(input: AuditEventInput & {
699
+ userId: string;
700
+ }): void;
701
+ declare function auditRoleChanged(input: AuditEventInput & {
702
+ userId: string;
703
+ }): void;
704
+ declare function auditPermissionDenied(input: AuditEventInput): void;
705
+ declare function auditSessionRevoked(input: AuditEventInput & {
706
+ userId: string;
707
+ }): void;
708
+
709
+ /**
710
+ * Process-level crash handlers for the Bun server path.
711
+ *
712
+ * Request-scoped errors are contained inside `createApp`'s fetch boundary
713
+ * (route handlers, API handlers, server actions). What still escapes to the
714
+ * event loop is a crash *outside* the request lifecycle — a throw during
715
+ * module eval, a rejected promise from a background sweep, a timer callback —
716
+ * which would otherwise take the whole process down with it.
717
+ *
718
+ * These handlers report the crash through the configured error reporter so an
719
+ * operator sees it, rather than dying silently (or staying up silently with no
720
+ * trace of what happened). By default the process keeps serving; set
721
+ * `exitOnCrash` to opt into crash-on-error semantics (e.g. when running under
722
+ * a supervisor like systemd/K8s that restarts the box).
723
+ */
724
+ interface ProcessCrashHandlerOptions {
725
+ /** Phase tag forwarded to the error reporter. Defaults to "api". */
726
+ phase?: "ssr" | "action" | "api" | "loader";
727
+ /** When true, `process.exit(1)` after reporting. Defaults to false. */
728
+ exitOnCrash?: boolean;
729
+ }
730
+ /** Registers `uncaughtException`/`unhandledRejection` handlers; returns a disposer. */
731
+ declare function installProcessCrashHandlers(options?: ProcessCrashHandlerOptions): () => void;
732
+
606
733
  /**
607
734
  * Structured JSON logging. Replaces ad-hoc `console.log` with one JSON
608
735
  * object per line — easy to ingest into Datadog, Grafana Loki, Kibana, etc.
@@ -624,6 +751,33 @@ declare const logger: Logger;
624
751
  */
625
752
  declare function withRequestLogging<Server = unknown>(handler: (req: Request, server?: Server) => Response | Promise<Response>): (req: Request, server?: Server) => Promise<Response>;
626
753
 
754
+ /**
755
+ * Secret redaction for structured logging.
756
+ *
757
+ * Server logs can silently echo secrets — a DB driver error interpolating a
758
+ * connection string, an app error whose message contains a token, or a caller
759
+ * passing `{ password }` into the logger. This is separate from the build-time
760
+ * env-leak scanner: that one protects client bundles; this one keeps values
761
+ * shaped like secrets out of anything emitted to the log sink, in dev and prod
762
+ * alike. It is belt-and-suspenders, not a substitute for not logging secrets —
763
+ * the pass is deliberately conservative (a key containing "token" anywhere is
764
+ * treated as sensitive).
765
+ */
766
+ declare const REDACTED = "[REDACTED]";
767
+ /** True when a field key looks like it holds a secret value. */
768
+ declare function isSensitiveKey(key: string): boolean;
769
+ /** Masks bearer/basic credentials and inline `Authorization: ...` values in a string. */
770
+ declare function redactString(input: string): string;
771
+ /**
772
+ * Recursively redacts a value before it is serialized to a log line:
773
+ * - values under a sensitive key names are replaced with {@link REDACTED};
774
+ * - string values (including error messages) are scanned for embedded bearer
775
+ * tokens / `Authorization:` values;
776
+ * - arrays and plain objects are walked recursively. Non-plain objects and
777
+ * primitives other than strings pass through untouched.
778
+ */
779
+ declare function redactValue(value: unknown, depth?: number): unknown;
780
+
627
781
  interface RenderOptions {
628
782
  title?: string;
629
783
  islandScripts?: string[];
@@ -640,6 +794,20 @@ interface RenderOptions {
640
794
  * reporter/metrics instead of shipping a partial page silently.
641
795
  */
642
796
  onRenderError?: (error: unknown) => void;
797
+ /**
798
+ * Single-render island resolution. When set, the page renders exactly once
799
+ * and this callback is awaited to resolve the island script list from the
800
+ * islands that pass actually produced (the caller holds the registry). Used
801
+ * to eliminate the two-pass discovery render.
802
+ */
803
+ resolveIslandScripts?: () => Promise<string[]>;
804
+ /**
805
+ * CSP nonce applied to every inline script the shell emits. Lets responses
806
+ * drop `'unsafe-inline'` from the default `script-src` (see
807
+ * `buildSecurityHeaders`) while keeping client navigation, live-reload and
808
+ * island hydration props working.
809
+ */
810
+ cspNonce?: string;
643
811
  }
644
812
  interface LoaderArgs {
645
813
  params: Record<string, string>;
@@ -650,6 +818,42 @@ declare function renderPage(node: ReactNode, options?: RenderOptions): string;
650
818
  declare function renderStaticPage(node: ReactNode, options?: RenderOptions): string;
651
819
  declare function renderStreamingPage(node: ReactNode, options?: RenderOptions): Promise<ReadableStream<Uint8Array>>;
652
820
 
821
+ /**
822
+ * Request body size enforcement.
823
+ *
824
+ * The framework buffers whatever a route, server function, or API handler asks
825
+ * for (`req.json()`, `req.text()`, `req.formData()`, ...) in memory before any
826
+ * validation runs. Without a byte budget an attacker can POST an arbitrarily
827
+ * large body and drive the single Bun process toward OOM — the exact crash
828
+ * class the hardening work on #85 is trying to contain. This module gives
829
+ * `createApp` a `maxBodySize` knob applied ahead of route/action dispatch.
830
+ */
831
+ declare const DEFAULT_MAX_BODY_SIZE = 1048576;
832
+ /**
833
+ * The error a wrapped request body stream is rejected with the moment it
834
+ * exceeds the configured `maxBodySize`. Kept distinct from a generic stream
835
+ * error so dispatch paths can map it to a 413 instead of a generic 500.
836
+ */
837
+ declare class RequestBodyTooLargeError extends Error {
838
+ readonly maxBytes: number;
839
+ constructor(maxBytes: number);
840
+ }
841
+ /**
842
+ * Enforces `maxBytes` on a request body.
843
+ *
844
+ * - When `Content-Length` is declared and exceeds the limit, the request is
845
+ * rejected immediately with a 413 `Response`.
846
+ * - When `Content-Length` is absent (chunked transfer) the body is wrapped in
847
+ * a counting stream that errors with {@link RequestBodyTooLargeError} the
848
+ * instant the limit is crossed. The wrapper only pulls from the source as
849
+ * fast as the downstream consumer reads, so an oversized body is aborted
850
+ * before it is ever fully buffered, instead of being read wholesale.
851
+ *
852
+ * Returns the (possibly wrapped) request, or a 413 `Response` when the
853
+ * declared size is already over the limit.
854
+ */
855
+ declare function enforceRequestBodySize(req: Request, maxBytes: number): Request | Response;
856
+
653
857
  /**
654
858
  * Compiler boundary between server-only environment variables and the
655
859
  * client bundle. Convention: only variables prefixed with `THEXJS_PUBLIC_`
@@ -679,4 +883,4 @@ declare function resetServerFunctions(): void;
679
883
  declare function registerServerFunctions(routePath: string, paramNames: string[], fns: Record<string, (...args: unknown[]) => Promise<unknown>>): void;
680
884
  declare function getServerFunctionHandler(csrfOptions?: CsrfOptions): (req: Request) => Promise<Response | null>;
681
885
 
682
- export { type BuildOptions, CLIENT_NAV_SCRIPT, type ContentEntry, type CounterSeries, type CreateAppOptions, type CsrfOptions, type CsrfResult, DEFAULT_HISTOGRAM_BUCKETS_MS, DefaultNotFound, EnvLeakageError, type ErrorContext, type ErrorReporter, type Frontmatter, type HealthCheck, type HealthCheckOptions, type HistogramSeries, Image, type ImageProps, type ImageProxyOptions, type InMemoryMetricsOptions, type InMemoryMetricsReporter, Island, type IslandEntry, type IslandMode, IslandProvider, type LayoutEntry, Link, type LinkProps, type LoaderArgs, type LoaderReturn, type LogFields, type Logger, type MetricLabels, type MetricsReporter, type MetricsSnapshot, type MiddlewareContext, type MiddlewareEntry, type MiddlewareFn, type MiddlewareNext, type NotFoundEntry, type OtelMeterLike, type OtelTracerLike, PUBLIC_ENV_PREFIX, type RateLimitOptions, type RateLimitResult, type RateLimitStore, type ReadinessResult, type RevalidateOptions, type RouteEntry, type RouteMode, type RouteProps, SRCSET_WIDTHS, type SecurityHeadersOptions, type SentryLike, applySecurityHeaders, assertNoEnvLeakage, build, buildSecurityHeaders, buildSrcSet, checkCsrf, combineReporters, composeMiddleware, createApp, createHealthCheckHandler, createImageProxyHandler, createInMemoryMetrics, createOtelReporter, createOtlpMetricsReporter, createRateLimiter, createRedisRateLimitStore, createSentryReporter, defineConfig, escapeHtml, findLayoutChain, findLeakedEnvKeys, findMiddlewareChain, generateCsrfToken, generateManifestSource, generateServerFunctionClient, getErrorReporter, getServerFunctionHandler, logger, noopMetrics, noopReporter, rateLimitMiddleware, registerServerFunctions, renderErrorOverlay, renderMarkdown, renderPage, renderStaticPage, renderStreamingPage, reportException, resetServerFunctions, scanApiDir, scanContent, scanLayouts, scanLayoutsDir, scanMiddleware, scanNotFound, scanPages, scanRoutes, setErrorReporter, setImageRemoteHosts, verifyCsrfToken, verifyOrigin, withCsrfCookie, withRequestLogging, withRequestMetrics, writeManifest };
886
+ export { type AuditEntry, type AuditEvent, type AuditSink, type BuildOptions, CLIENT_NAV_SCRIPT, type ContentEntry, type CounterSeries, type CreateAppOptions, type CsrfOptions, type CsrfResult, DEFAULT_HISTOGRAM_BUCKETS_MS, DEFAULT_MAX_BODY_SIZE, DefaultNotFound, EnvLeakageError, type ErrorContext, type ErrorReporter, type Frontmatter, type HealthCheck, type HealthCheckOptions, type HistogramSeries, Image, type ImageProps, type ImageProxyOptions, type InMemoryMetricsOptions, type InMemoryMetricsReporter, Island, type IslandEntry, type IslandMode, IslandProvider, type LayoutEntry, Link, type LinkProps, type LoaderArgs, type LoaderReturn, type LogFields, type Logger, type MetricLabels, type MetricsReporter, type MetricsSnapshot, type MiddlewareContext, type MiddlewareEntry, type MiddlewareFn, type MiddlewareNext, type NotFoundEntry, type OtelMeterLike, type OtelTracerLike, PUBLIC_ENV_PREFIX, type ProcessCrashHandlerOptions, REDACTED, type RateLimitOptions, type RateLimitResult, type RateLimitStore, type ReadinessResult, RequestBodyTooLargeError, type RevalidateOptions, type RouteEntry, type RouteMode, type RouteProps, SRCSET_WIDTHS, type SecurityHeadersOptions, type SentryLike, applySecurityHeaders, assertNoEnvLeakage, audit, auditLoginFailure, auditLoginSuccess, auditLogout, auditPasswordChanged, auditPermissionDenied, auditRoleChanged, auditSessionRevoked, build, buildSecurityHeaders, buildSrcSet, checkCsrf, clientIpFromRequest, combineReporters, composeMiddleware, createApp, createConsoleAuditSink, createHealthCheckHandler, createImageProxyHandler, createInMemoryMetrics, createOtelReporter, createOtlpMetricsReporter, createRateLimiter, createRedisRateLimitStore, createSentryReporter, defineConfig, enforceRequestBodySize, escapeHtml, findLayoutChain, findLeakedEnvKeys, findMiddlewareChain, generateCsrfToken, generateManifestSource, generateServerFunctionClient, getAuditSink, getErrorReporter, getServerFunctionHandler, installProcessCrashHandlers, isSensitiveKey, logger, noopAuditSink, noopMetrics, noopReporter, rateLimitMiddleware, redactString, redactValue, registerServerFunctions, renderErrorOverlay, renderMarkdown, renderPage, renderStaticPage, renderStreamingPage, reportException, requestIdFromRequest, resetServerFunctions, scanApiDir, scanContent, scanLayouts, scanLayoutsDir, scanMiddleware, scanNotFound, scanPages, scanRoutes, setAuditSink, setErrorReporter, setImageRemoteHosts, verifyCsrfToken, verifyOrigin, withCsrfCookie, withRequestLogging, withRequestMetrics, writeManifest };