Reference

@reckona/mreact-router

198 public exports.

Function

FunctionassetHreffunction assetHref(manifest: AssetManifest, key: string, options: AssetHelperOptions): stringResolves a manifest entry key to its public asset URL.FunctionassetPreloadLinksfunction assetPreloadLinks(manifest: AssetManifest, keys: string | readonly string[], options: AssetHelperOptions): AssetLinkDescriptor[]Builds unique preload and stylesheet link descriptors for one or more manifest entries.FunctionbuildAppfunction buildApp(options: BuildAppOptions): Promise<BuildAppResult>Builds an app-router project into server, client, and optional deployment-target artifacts. Use this from custom build scripts when the CLI is too coarse-grained; the returned manifest paths describe the files written under `outDir`. The build reads route files, loaders, middleware, metadata, server actions, and client references, so callers should pass the same project root and source allow-list they expect to deploy.FunctioncacheControlfunction cacheControl(options: CacheControlOptions): voidSets the cache policy for the current app-router render. Call this during a loader or route render to override the response `Cache-Control` policy; it throws outside an active app-router request.Functioncookiesfunction cookies(request: Request): RequestCookiesParses request cookies into a small read-only helper. Values are decoded with `decodeURIComponent`; malformed encoded values are ignored rather than throwing during request handling.FunctioncreateFileSystemPrerenderStorefunction createFileSystemPrerenderStore(options: FileSystemPrerenderStoreOptions): AppRouterPrerenderStoreCreates a prerender store that persists entries as JSON files.FunctioncreateFormCsrfTokenfunction createFormCsrfToken(request?: Request): stringCreates or reuses the CSRF token embedded into server-rendered forms.FunctioncreateKeyValuePrerenderStorefunction createKeyValuePrerenderStore(options: KeyValuePrerenderStoreOptions): AppRouterPrerenderStoreCreates a prerender store backed by a caller-provided key-value adapter.FunctioncreateMemoryPrerenderStorefunction createMemoryPrerenderStore(options: MemoryPrerenderStoreOptions): AppRouterPrerenderStoreCreates an in-memory prerender store with optional TTL and LRU eviction.FunctioncreateMemoryRouteCachefunction createMemoryRouteCache(options: MemoryRouteCacheOptions): AppRouterCacheCreates an in-memory route response cache for app-router rendering. The cache is process-local, evicts expired entries during reads/writes, and is suitable for development, tests, or single-process deployments that do not need shared invalidation.Functiondeferfunction defer<TData>(data: TData): DeferredLoaderData<TData>Marks loader data for deferred streaming without changing its data shape.FunctiondefineMessagesfunction defineMessages<Messages>(messages: Messages): MessagesPreserves literal types for a localized message tree.FunctiondefinePagefunction definePage<TLoader>(component: PageComponent<TLoader>): PageComponent<TLoader>Preserves the relationship between a page component and its loader when authoring route files. Wrap a default page export with `definePage<typeof loader>(...)` to infer `data` and `params` props from the route loader without changing runtime behavior.FunctiondeleteCookiefunction deleteCookie(response: Response, name: string, options: Pick<CookieOptions, "domain" | "path" | "sameSite" | "secure">): ResponseAppends an expiring `Set-Cookie` header that removes a cookie in the browser.FunctiondetectLocalefunction detectLocale<Locale>(request: Request, options: LocaleRoutingOptions<Locale>): DetectedLocale<Locale>Detects the request locale from the URL path or Accept-Language header.FunctionformCsrfCookiefunction formCsrfCookie(csrfToken: string): stringSerializes the CSRF cookie used to validate app-router form submissions.FunctiongetRouterRuntimeCacheStatsfunction getRouterRuntimeCacheStats(): RouterRuntimeCacheStat[]Reads app-router runtime cache sizes for diagnostics.Functionheadersfunction headers(request: Request): HeadersReturns the request headers object for route code that follows app-router helper naming.Functionhreffunction href<Path>(path: Path, ...args: HasRouteParams<Path> extends true ? [options: DynamicHrefOptions<Path>] : [options?: StaticHrefOptions]): stringBuilds an internal app-route URL from a route pattern and typed params/search options. Dynamic `:param` and `:...catchAll` segments are URL-encoded, search values are serialized with `URLSearchParams`, and protocol-relative or external paths are rejected.Functionhtmlfunction html(value: string, init: ResponseInit): ResponseCreates an HTML response and defaults the content type to `text/html; charset=utf-8`.FunctionisDeferredLoaderDatafunction isDeferredLoaderData(value: unknown): value is DeferredLoaderData<Record<string, unknown>>Checks whether loader data was marked with `defer()`.FunctionisNotFoundErrorfunction isNotFoundError(error: unknown): booleanChecks whether an unknown error is an app-router not-found signal.FunctionisRedirectErrorfunction isRedirectError(error: unknown): error is Error & { location: string; status: number }Checks whether an unknown error is an app-router redirect signal.Functionjsonfunction json(value: unknown, init?: ResponseInit): ResponseCreates a JSON response using the platform `Response.json()` implementation.FunctionmatchRoutefunction matchRoute(routes: readonly AppRoute[], pathname: string): MatchedRoute | undefinedMatches a request pathname against a route list.Functionnextfunction next(): undefinedContinues middleware processing without changing the request.FunctionnotFoundfunction notFound(): neverThrows a route-level 404 control error. Use this from loaders, metadata, middleware, or route handlers when the matched route is valid but the requested resource is absent.FunctionpackageAwsLambdaArtifactfunction packageAwsLambdaArtifact(options: PackageAwsLambdaArtifactOptions): Promise<AwsLambdaArtifactManifest>Packages a built app-router output directory into the minimal AWS Lambda artifact layout. The package contains `.mreact`, a Lambda handler, project package metadata, production dependencies, and `mreact-lambda-artifact.json`; it intentionally excludes source files and development tooling that are not needed at runtime.FunctionpackageCloudflarePagesArtifactfunction packageCloudflarePagesArtifact(options: PackageCloudflarePagesArtifactOptions): Promise<CloudflarePagesArtifactManifest>Packages a Cloudflare-target build for Cloudflare Pages advanced mode. The package writes `_worker.js`, generated client assets, public assets, and `mreact-cloudflare-pages-artifact.json`; deploy the output directory rather than the raw `.mreact` build tree.FunctionparseCookieHeaderfunction parseCookieHeader(cookieHeader: string | null | undefined): Map<string, string>Parses a raw `Cookie` header into decoded name/value pairs. Malformed percent-encoded values are skipped so one bad cookie does not abort request handling.FunctionparseFormfunction parseForm(request: Request): Promise<FormData> function parseForm<T>(request: Request, schema: ParseSchema<T>): Promise<T>Reads `request.formData()` and optionally validates it with a schema-like parser. Pass a schema object with `parse(FormData)` when a route handler or server action should receive typed form data.FunctionparseMultipartStreamfunction parseMultipartStream(request: Request, options: MultipartStreamParseOptions): AsyncIterable<MultipartStreamPart>Parses a multipart request body as an async iterable of streamable parts.FunctionparseTraceContextfunction parseTraceContext(traceparent: string | null | undefined, tracestate: string | null | undefined): RouterTraceContext | undefinedParses W3C trace context header values for router instrumentation.FunctionpreloadBuiltAppRuntimefunction preloadBuiltAppRuntime(options: { importPolicy?: AppRouterImportPolicy; outDir: string; preload?: BuiltAppRuntimePreloadStrategy; runtimeDir?: string }): Promise<void>Preloads selected modules from a built app-router runtime.Functionredirectfunction redirect(location: string, options: RedirectOptions): neverThrows an internal redirect for loaders, middleware, route handlers, or server actions. The target must be same-origin or relative; use `redirectExternal()` for trusted `http` or `https` destinations. The default status is `303`.Functionredirect303function redirect303(location: string, init: ResponseInit): ResponseCreates a same-origin `303 See Other` redirect response. Use this from route handlers when returning a `Response` is more convenient than throwing through the app-router control flow.FunctionredirectExternalfunction redirectExternal(location: string, options: RedirectOptions): neverThrows an external redirect for trusted `http` or `https` destinations. This helper is intentionally separate from `redirect()` so off-site navigation is explicit. The default status is `307`.FunctionrenderAppRequestfunction renderAppRequest(options: RenderAppRequestOptions): Promise<Response>Renders a source app-router request into a `Response`.FunctionrenderBuiltAppRequestfunction renderBuiltAppRequest(options: RenderBuiltAppRequestOptions): Promise<Response>Renders a request using a built app-router output directory.FunctionrevalidatePathfunction revalidatePath(path: string): voidInvalidates cached route responses for a normalized app-router path. During a request the invalidation is scoped to that route cache context; outside a request it is queued for the next cache access.Functionrewritefunction rewrite(location: string, init: ResponseInit): ResponseCreates an internal rewrite response consumed by app-router middleware. The target must be a same-origin route path, query, hash, or relative URL; protocol-relative, external, and control-character targets are rejected.FunctionscanAppRoutesfunction scanAppRoutes(options: ScanAppRoutesOptions): Promise<AppRoute[]>Scans an app directory and returns sorted app-router route definitions.FunctionserializeCookiefunction serializeCookie(name: string, value: string, options: CookieOptions): stringSerializes a cookie name, value, and attributes for a `Set-Cookie` header. Cookie names and attribute values are validated, and `SameSite=None` requires `Secure`.FunctionsetCookiefunction setCookie(response: Response, name: string, value: string, options: CookieOptions): ResponseAppends a serialized cookie to a response's `Set-Cookie` headers and returns the same response.FunctionstartDevServerfunction startDevServer(options: StartDevServerOptions): Promise<{ server: Server; url: string; function close(): Promise<void> }>Starts the local app-router development server with Vite middleware and route compilation. The server trusts only the configured host settings, merges declared application packages into the development import policy, and returns a `close()` method that should be awaited by tests and scripts.FunctionstartServerfunction startServer(options: StartServerOptions): Promise<{ server: Server; url: string; function close(): Promise<void> }>Starts a Node HTTP server for an already built app-router output directory. Use this for production-like local serving or custom Node deployments. It loads `.mreact/server` artifacts, applies the generated import policy when configured, enforces host trust options, and returns a `close()` method for orderly shutdown.FunctiontextErrorfunction textError(message: string, status: number, init: ResponseInit): ResponseCreates a plain-text error response with a default `text/plain` content type.FunctionthrowNotFoundfunction throwNotFound(): neverAlias for `notFound()` for codebases that prefer an explicit throwing helper name.FunctiontraceContextFromRequestfunction traceContextFromRequest(request: Request): RouterTraceContext | undefinedReads trace context headers from a request.FunctionvalidateFormCsrffunction validateFormCsrf(request: Request, formData: FormData): Response | undefinedValidates the CSRF cookie and hidden form field for a form submission.

Interface

InterfaceAppAssetRouteinterface AppAssetRouteDescribes a static asset route produced from an app file convention.InterfaceAppMetadataRouteinterface AppMetadataRouteDescribes a generated metadata route such as robots or sitemap.InterfaceAppRouterAllowedServerActioninterface AppRouterAllowedServerActionDescribes a server action request reference that the app router may dispatch.InterfaceAppRouterCacheinterface AppRouterCacheDefines the storage interface used by app-router route response caching.InterfaceAppRouterCacheEntryinterface AppRouterCacheEntryStores a cached route response body and its expiration metadata.InterfaceAppRouterCspInlineNonceWarningLogEventinterface AppRouterCspInlineNonceWarningLogEventLogs an inline CSP nonce warning emitted while rendering a route.InterfaceAppRouterImportPolicyinterface AppRouterImportPolicyControls which source roots and runtime packages built app-router handlers may import.InterfaceAppRouterLogErrorinterface AppRouterLogErrorSerializes an error for app-router structured logs.InterfaceAppRouterLoggerinterface AppRouterLoggerReceives structured app-router log events by severity.InterfaceAppRouterPrerenderStoreinterface AppRouterPrerenderStoreDefines storage for prerendered route responses used by built request rendering.InterfaceAppRouterProductionOptionsinterface AppRouterProductionOptionsConfigures production-only app-router build behavior.InterfaceAppRouterRenderTimingLogEventinterface AppRouterRenderTimingLogEventLogs per-phase timings for route rendering.InterfaceAppRouterRequestEndLogEventinterface AppRouterRequestEndLogEventLogs the successful completion of an app-router request.InterfaceAppRouterRequestErrorLogEventinterface AppRouterRequestErrorLogEventLogs a request that ended with an app-router error response.InterfaceAppRouterRequestStartLogEventinterface AppRouterRequestStartLogEventLogs the start of an app-router request.InterfaceAppRouterRequestTimingLogEventinterface AppRouterRequestTimingLogEventLogs per-phase timings for a complete app-router request.InterfaceAppRouterResponseHookContextinterface AppRouterResponseHookContextProvides request context to an app-router response hook.InterfaceAppRouterServerActionOptionsinterface AppRouterServerActionOptionsConfigures app-router server action dispatch, authorization, body limits, and replay protection. Production multi-instance deployments should provide a shared `replayStore` and a stable `MREACT_SERVER_ACTION_SECRET`.InterfaceAssetHelperOptionsinterface AssetHelperOptionsConfigures URL generation for asset helper functions.InterfaceAssetLinkDescriptorinterface AssetLinkDescriptorRepresents a preload or stylesheet link descriptor derived from an asset manifest.InterfaceAssetManifestEntryinterface AssetManifestEntryDescribes the generated files associated with a client bundle manifest entry.InterfaceAwsLambdaArtifactManifestinterface AwsLambdaArtifactManifestSummarizes the files and entry point produced for an AWS Lambda artifact.InterfaceBuildAppOptionsinterface BuildAppOptionsConfigures an app-router production build and its deployment targets.InterfaceBuildAppPhaseTiminginterface BuildAppPhaseTimingCaptures the elapsed time for a completed app-router build phase.InterfaceBuildAppResultinterface BuildAppResultContains the route graph produced by an app-router build.InterfaceBuiltAppRuntimePreloadStrategyinterface BuiltAppRuntimePreloadStrategyConfigures built app runtime preload scope and optional hot routes.InterfaceBuiltImportPolicyArtifactinterface BuiltImportPolicyArtifactDescribes the generated import policy artifact consumed by built request handlers.InterfaceCacheControlOptionsinterface CacheControlOptionsConfigures cache-control directives for route response caching.InterfaceCloudflarePagesArtifactManifestinterface CloudflarePagesArtifactManifestSummarizes the files and worker entry produced for a Cloudflare Pages artifact.InterfaceCookieOptionsinterface CookieOptionsConfigures attributes used when serializing a Set-Cookie header.InterfaceDetectedLocaleinterface DetectedLocaleReports the locale selected for an incoming request.InterfaceDynamicHrefOptionsinterface DynamicHrefOptionsConfigures a dynamic href with route params, optional search params, and hash.InterfaceFileSystemPrerenderStoreOptionsinterface FileSystemPrerenderStoreOptionsConfigures a filesystem-backed prerender store.InterfaceGenerateMetadataContextinterface GenerateMetadataContextContext passed to a route `generateMetadata` export. Metadata is evaluated on the server after loader data is available, so it can derive head tags, robots data, sitemap entries, and security header directives from the same request and route params as the page.InterfaceKeyValuePrerenderStoreAdapterinterface KeyValuePrerenderStoreAdapterDefines the adapter API used by key-value prerender stores.InterfaceKeyValuePrerenderStoreOptionsinterface KeyValuePrerenderStoreOptionsConfigures a key-value-backed prerender store.InterfaceLayoutPropsinterface LayoutPropsProvides children, params, and request context to layout components.InterfaceLoaderContextinterface LoaderContextProvides request, params, environment, and query client data to route loaders.InterfaceLocaleRoutingOptionsinterface LocaleRoutingOptionsConfigures locale detection for app-router requests.InterfaceManifestContextinterface ManifestContextProvides request context to a web app manifest metadata route.InterfaceMatchedRouteinterface MatchedRouteHolds the route and params selected for a request pathname.InterfaceMemoryPrerenderStoreOptionsinterface MemoryPrerenderStoreOptionsConfigures the process-local prerender store used for cached prerendered routes.InterfaceMemoryRouteCacheOptionsinterface MemoryRouteCacheOptionsConfigures the process-local in-memory route cache implementation.InterfaceMetadataImageinterface MetadataImageDescribes an image value used by route metadata.InterfaceMetadataThemeColorinterface MetadataThemeColorDescribes a theme-color metadata entry with an optional media query.InterfaceMultipartFixedLengthStreaminterface MultipartFixedLengthStreamCouples a readable multipart part stream with a completion signal.InterfaceMultipartStreamFieldOptionsinterface MultipartStreamFieldOptionsConfigures parsing behavior for a named multipart field.InterfaceMultipartStreamParseOptionsinterface MultipartStreamParseOptionsConfigures multipart stream parsing limits and field handling.InterfaceMultipartStreamPartinterface MultipartStreamPartRepresents one parsed multipart field or file part.InterfacePackageAwsLambdaArtifactOptionsinterface PackageAwsLambdaArtifactOptionsConfigures packaging of a built app-router output directory for AWS Lambda.InterfacePackageCloudflarePagesArtifactOptionsinterface PackageCloudflarePagesArtifactOptionsConfigures packaging of a built app-router output directory for Cloudflare Pages.InterfacePagePropsinterface PagePropsProvides loader data, params, and request context to page components.InterfacePageRouteinterface PageRouteDescribes a page route that renders a component.InterfaceParseSchemainterface ParseSchemaDescribes a parser used by `parseForm()` to validate submitted form data.InterfacePreparedFormActionReferenceinterface PreparedFormActionReferenceIdentifies an inferred form action expression rewritten during route preparation.InterfaceRenderAppRequestOptionsinterface RenderAppRequestOptionsConfigures server rendering for a source app-router request.InterfaceRenderBuiltAppRequestOptionsinterface RenderBuiltAppRequestOptionsConfigures rendering a request against a built app-router output directory.InterfaceRobotsContextinterface RobotsContextProvides request context to a robots metadata route.InterfaceRobotsManifestinterface RobotsManifestDescribes the robots.txt metadata route result.InterfaceRobotsRuleinterface RobotsRuleDescribes one robots.txt user-agent rule.InterfaceRouteCachePolicyinterface RouteCachePolicyDescribes the cache lifetime assigned to a rendered route response.InterfaceRouteHandlerContextinterface RouteHandlerContextProvides request and params to server route handlers.InterfaceRouteHeadDescriptorinterface RouteHeadDescriptorDescribes an extra head element emitted by route metadata.InterfaceRouteMetadatainterface RouteMetadataDeclarative metadata returned by route metadata exports. Values are rendered into the document head and response headers by the app router; use `generateMetadata` when the values depend on loader data, params, or the current request.InterfaceRouterInstrumentationinterface RouterInstrumentationRegisters optional hooks for app-router request, middleware, and route instrumentation.InterfaceRouterMiddlewareEndInstrumentationEventinterface RouterMiddlewareEndInstrumentationEventDescribes completion of a middleware instrumentation event.InterfaceRouterMiddlewareInstrumentationEventinterface RouterMiddlewareInstrumentationEventDescribes a middleware instrumentation event.InterfaceRouterRequestEndInstrumentationEventinterface RouterRequestEndInstrumentationEventDescribes completion of a router request lifecycle event.InterfaceRouterRequestInstrumentationEventinterface RouterRequestInstrumentationEventDescribes a router request lifecycle instrumentation event.InterfaceRouterRouteEndInstrumentationEventinterface RouterRouteEndInstrumentationEventDescribes completion of a route-level instrumentation event.InterfaceRouterRouteInstrumentationEventinterface RouterRouteInstrumentationEventDescribes a route-level loader or render instrumentation event.InterfaceRouterRuntimeCacheStatinterface RouterRuntimeCacheStatReports runtime cache counters for a named router cache.InterfaceRouterTraceContextinterface RouterTraceContextRepresents parsed W3C trace context headers for router instrumentation.InterfaceRouteSecurityHeadersinterface RouteSecurityHeadersConfigures security-related response headers from route metadata.InterfaceRouteStrictTransportSecurityinterface RouteStrictTransportSecurityConfigures the Strict-Transport-Security header from route metadata.InterfaceServerActionContextinterface ServerActionContextRequest context passed to authorized server actions. It exposes normalized cookies, headers, the original `Request`, and an optional client IP so authorization hooks can make request-aware decisions.InterfaceServerRouteinterface ServerRouteDescribes a server route that handles HTTP methods directly.InterfaceSitemapContextinterface SitemapContextProvides request context to a sitemap metadata route.InterfaceSitemapEntryinterface SitemapEntryDescribes one URL entry returned by a sitemap metadata route.InterfaceStartDevServerOptionsinterface StartDevServerOptionsConfigures the Vite-powered app-router development server.InterfaceStartServerOptionsinterface StartServerOptionsConfigures the Node HTTP server used to serve a built app-router output.InterfaceStaticHrefOptionsinterface StaticHrefOptionsConfigures a static href with optional search params and hash.

Re-export

Re-exportAppRouteDeclarationsconst AppRouteDeclarations: unknownRe-exports link types used by the router root entrypoint.Re-exportAppRouterNavigationStateconst AppRouterNavigationState: unknownRe-exports client navigation state types used by the router root entrypoint.Re-exportAppRouterNavigationStateListenerconst AppRouterNavigationStateListener: unknownRe-exports client navigation state types used by the router root entrypoint.Re-exportAppRouterNavigationTypeconst AppRouterNavigationType: unknownRe-exports client navigation state types used by the router root entrypoint.Re-exportConcreteLinkHrefGuardconst ConcreteLinkHrefGuard: unknownRe-exports link types used by the router root entrypoint.Re-exportgetNavigationStateconst getNavigationState: unknownRe-exportgetServerRuntimeStateconst getServerRuntimeState: unknownRe-exportLinkconst Link: unknownRe-exportLinkChildconst LinkChild: unknownRe-exports link types used by the router root entrypoint.Re-exportLinkHrefconst LinkHref: unknownRe-exports link types used by the router root entrypoint.Re-exportLinkOptionsconst LinkOptions: unknownRe-exports link types used by the router root entrypoint.Re-exportLinkPrefetchconst LinkPrefetch: unknownRe-exports link types used by the router root entrypoint.Re-exportlinkPropsconst linkProps: unknownRe-exportLinkPropsconst LinkProps: unknownRe-exports link types used by the router root entrypoint.Re-exportLinkScrollconst LinkScroll: unknownRe-exports link types used by the router root entrypoint.Re-exportLinkTransitionconst LinkTransition: unknownRe-exports link types used by the router root entrypoint.Re-exportMemorySessionStoreOptionsconst MemorySessionStoreOptions: unknownConfigures the deprecated router memory session store alias.Re-exportRegisteredAppRoutePathconst RegisteredAppRoutePath: unknownRe-exports link types used by the router root entrypoint.Re-exportsubscribeNavigationStateconst subscribeNavigationState: unknownRe-exportTrustedLinkHtmlconst TrustedLinkHtml: unknownRe-exports link types used by the router root entrypoint.

Type Alias

Type AliasAppFileConventiontype AppFileConvention = "apple-icon" | "icon" | "manifest" | "opengraph-image" | "robots" | "sitemap"Names file conventions that app-router treats as metadata or static asset routes.Type AliasAppRoutetype AppRoute = AppAssetRoute | AppMetadataRoute | PageRoute | ServerRouteRepresents any route discovered by the app-router file-system scanner.Type AliasAppRouteHreftype AppRouteHref = keyof RouteParamsFor<Path> extends never ? (options?: StaticHrefOptions): string : (options: DynamicHrefOptions<Path>): stringBuilds the callable `href()` helper type for a specific app route path.Type AliasAppRouteLinkHreftype AppRouteLinkHref = `${AppRouteLinkPathname<Path>}${AppRouteLinkHrefSuffix}`Builds the Link `href` string type accepted for a specific app route path.Type AliasAppRouteLinkHrefSuffixtype AppRouteLinkHrefSuffix = "" | `?${string}` | `#${string}` | `?${string}#${string}`Represents the search and hash suffix portion of a typed route href.Type AliasAppRouteLinkPathnametype AppRouteLinkPathname = Path extends "/" ? "/" : Path extends `/${infer Segments}` ? `/${AppRouteLinkSegments<Segments>}` : neverBuilds the pathname string type for a typed route href.Type AliasAppRouteLinkSegmenttype AppRouteLinkSegment = Segment extends `:${string}` ? string : SegmentBuilds the string type for one static or dynamic route segment.Type AliasAppRouteLinkSegmentstype AppRouteLinkSegments = Segments extends `${infer Segment}/${infer Rest}` ? `${AppRouteLinkSegment<Segment>}/${AppRouteLinkSegments<Rest>}` : AppRouteLinkSegment<Segments>Builds the joined path segment string type for a typed route href.Type AliasAppRouterBuildTargettype AppRouterBuildTarget = "node" | "cloudflare" | "aws-lambda"Selects the deployment runtime artifacts emitted by an app-router build.Type AliasAppRouterClientConsoleMethodtype AppRouterClientConsoleMethod = "debug" | "error" | "info" | "log" | "trace" | "warn"Names a browser console method that can be stripped from client bundles.Type AliasAppRouterClientSourceMapModetype AppRouterClientSourceMapMode = "none" | "hidden" | "linked"Controls how client bundle source maps are generated.Type AliasAppRouterClientSourceMapOptiontype AppRouterClientSourceMapOption = boolean | AppRouterClientSourceMapModeConfigures client source map output with a boolean shortcut or explicit mode.Type AliasAppRouterLogEventtype AppRouterLogEvent = AppRouterRequestStartLogEvent | AppRouterRequestEndLogEvent | AppRouterRequestErrorLogEvent | AppRouterRequestTimingLogEvent | AppRouterRenderTimingLogEvent | AppRouterCspInlineNonceWarningLogEventRepresents every structured log event emitted by the app router.Type AliasAppRouterLogLeveltype AppRouterLogLevel = "debug" | "info" | "warn" | "error"Names the severity channel used for app-router structured logs.Type AliasAppRouterResponseHooktype AppRouterResponseHook = (response: Response, context: AppRouterResponseHookContext): Response | undefined | void | Promise<Response | undefined | void>Allows callers to inspect or replace an app-router response before it is returned.Type AliasAppRouterRuntimetype AppRouterRuntime = "aws-lambda" | "cloudflare" | "edge" | "node"Names the runtime that handled an app-router request.Type AliasAssetManifesttype AssetManifest = Readonly<Record<string, AssetManifestEntry>>Maps app-router entry keys to generated client asset metadata.Type AliasBuildAppPhasetype BuildAppPhase = "scan" | "collectFiles" | "analyzeSources" | "validate" | "prepareOutput" | "publicAssets" | "serverActionManifest" | "serverModules" | "importPolicy" | "serverModuleArtifacts" | "clientBundles" | "navigationRuntime" | "prerender" | "cloudflare" | "writeManifests" | "adapterArtifacts"Names a high-level phase reported while building an app-router application.Type AliasBuildAppProgressEventtype BuildAppProgressEvent = { kind: "phase-start"; phase: BuildAppPhase } | { kind: "phase-end"; ms: number; phase: BuildAppPhase } | { count: number; kind: "routes-discovered" }Reports build progress events emitted during app-router compilation and packaging.Type AliasBuiltAppRuntimePreloadModetype BuiltAppRuntimePreloadMode = "all" | "hot-route-requests" | "hot-routes" | "middleware" | "none"Selects which built runtime modules should be preloaded.Type AliasDeferredLoaderDatatype DeferredLoaderData = TData & { [deferredLoaderDataSymbol]: true }Marks loader data that contains streamed deferred values.Type AliasHttpUpgradeHandlertype HttpUpgradeHandler = (request: IncomingMessage, socket: Duplex, head: Buffer): voidHandles an HTTP upgrade request on the app-router Node server.Type AliasInferLoaderDatatype InferLoaderData = Awaited<ReturnType<TLoader>>Infers resolved data returned by a route loader.Type AliasInferLoaderParamstype InferLoaderParams = TLoader extends (context: infer TContext, ...args: never[]): unknown ? TContext extends { params: infer TParams } ? TParams extends RouteParams ? TParams : RouteParams : RouteParams : RouteParamsInfers route params from a loader context parameter.Type AliasManifestDescriptortype ManifestDescriptor = Record<string, unknown>Represents an arbitrary web app manifest descriptor.Type AliasMessageTreetype MessageTree = objectDescribes a nested tree of localized message strings.Type AliasMetadataScalartype MetadataScalar = boolean | number | stringRepresents scalar metadata values rendered into head tags and headers.Type AliasMetadataViewporttype MetadataViewport = Record<string, MetadataScalar | null | undefined>Describes viewport metadata key-value pairs.Type AliasMReactNodetype MReactNode = ReactCompatNodeRe-exports the node type accepted by mreact-compatible components.Type AliasPageComponenttype PageComponent = (props: PageProps<InferLoaderData<TLoader>, InferLoaderParams<TLoader>>): ReactCompatNodeRepresents a page component whose props are inferred from a route loader.Type AliasRequestHostPolicytype RequestHostPolicy = "strict" | "trusted-proxy"Controls whether built request handling trusts the incoming Host header.Type AliasRouteLoadertype RouteLoader = (...args: never[]): unknownRepresents an app-router loader function.Type AliasRouteParamstype RouteParams = Record<string, readonly string[] | string>Represents dynamic route params passed to loaders, pages, and handlers.Type AliasRouteParamsFortype RouteParamsFor = Simplify<ExtractRouteParams<Path>>Extracts dynamic and catch-all params from an app route path pattern.Type AliasRouteSearchParamstype RouteSearchParams = Record<string, RouteSearchValue | readonly RouteSearchValue[]>Represents search params accepted by typed route href helpers.Type AliasRouteSearchValuetype RouteSearchValue = boolean | number | string | null | undefinedRepresents a value accepted in generated route search params.Type AliasRouteSegmenttype RouteSegment = { kind: "static"; value: string } | { kind: "dynamic"; name: string } | { kind: "catch-all"; name: string }Represents a static, dynamic, or catch-all segment in an app route path.Type AliasSessionCookieOptionstype SessionCookieOptions = SessionCookieOptionsInternalConfigures the deprecated router session cookie alias.Type AliasSessionRecordtype SessionRecord = SessionRecordInternal<TData>Stores session data through the deprecated router session record alias.Type AliasSessionStoretype SessionStore = SessionStoreInternal<TData>Defines session persistence through the deprecated router session store alias.

Variable

VariablecreateMemorySessionStoreconst createMemorySessionStore: <TData>(options: MemorySessionStoreOptions): SessionStore<TData>Creates a deprecated process-local session store alias.VariablecreateSessionconst createSession: <TData>(response: Response, store: SessionStore<TData>, data: TData, options: SessionCookieOptions): Promise<SessionRecord<TData>>Creates a deprecated session record and cookie alias.VariabledestroySessionconst destroySession: <TData>(request: Request, response: Response, store: SessionStore<TData>, options: SessionCookieOptions): Promise<void>Destroys a session through a deprecated router session alias.VariableformCsrfFieldNameconst formCsrfFieldName: "__mreact_csrf"Names the hidden form field used for app-router CSRF validation.VariablegetSessionconst getSession: <TData>(request: Request, store: SessionStore<TData>, options: SessionCookieOptions): Promise<SessionRecord<TData> | undefined>Reads a session through a deprecated router session alias.VariablerotateSessionconst rotateSession: <TData>(request: Request, response: Response, store: SessionStore<TData>, options: SessionCookieOptions): Promise<SessionRecord<TData> | undefined>Rotates a session through a deprecated router session alias.