import esbuild from "esbuild"; import type { RouteInfo } from "../page-tools"; import { AsyncLocalStorage } from "node:async_hooks"; export type PublishEntry = { input: string; target: string; }; type ImportContext = { preBuildHooks: Array<() => Promise>; postBuildHooks: Array<() => Promise>; buildCallbacks: Array<() => Promise>; publishFiles: Array; atomSeeds: Array<{ id: string; initial: any; }>; }; export declare const importContext: AsyncLocalStorage; type ImportedModule = { module: any; preBuildHooks: Array<() => Promise>; postBuildHooks: Array<() => Promise>; buildCallbacks: Array<() => Promise>; publishFiles: Array; atomSeeds: Array<{ id: string; initial: any; }>; }; export declare function importModule(path: string): Promise; export interface CompiledRoute { default: Function; metadata: (...params: unknown[]) => Promise; getEnumeratedRoutes?: () => Promise; pathname: string; preBuildHooks: Array<() => Promise>; postBuildHooks: Array<() => Promise>; buildCallbacks: Array<() => Promise>; publishFiles: Array; atomSeeds: Array<{ id: string; initial: any; }>; } export interface CompiledLayout extends CompiledRoute { } export interface TranspiledRoute { pathname: string; pageFile: string; layouts: string[]; serverCode: string; preClientCode: string; sharedChunkPaths: string[]; } export type CacheKey = string & { readonly __brand: unique symbol; }; export declare function pageCacheKey(pathname: string): CacheKey; export declare function layoutFileCacheKey(layoutPath: string): CacheKey; export declare function statusCodeCacheKey(filePath: string): CacheKey; export declare function serverMjsPath(key: CacheKey): string; export declare function preClientMjsPath(key: CacheKey): string; export declare function clientMjsPath(key: CacheKey): string; export declare function chunkClientPath(key: CacheKey): string; export interface ApiRouteEntry { pathname: string; file: string; } export interface MiddlewareEntry { file: string; } export interface StatusCodePageEntry { pageFile: string; layouts: string[]; layoutCacheKeys: CacheKey[]; cacheKey: CacheKey; } interface RouteEntryBase { pageFile: string; layouts: string[]; layoutCacheKeys: CacheKey[]; cacheKey: CacheKey; sharedChunkPaths: string[]; } export interface StaticRouteEntry extends RouteEntryBase { kind: "static"; pathname: string; } export interface EnumeratedRouteEntry extends RouteEntryBase { kind: "enumerated"; pathname: string; patternPathname: string; } export interface DynamicRouteEntry extends RouteEntryBase { kind: "dynamic"; pathname: string; } export type RouteEntry = StaticRouteEntry | EnumeratedRouteEntry | DynamicRouteEntry; export interface Manifest { buildTime: number; routes: RouteEntry[]; statusCodePages: StatusCodePageEntry[]; apiRoutes: ApiRouteEntry[]; middlewares: MiddlewareEntry[]; } export declare function runBuildHooks(compiled: CompiledRoute, stage: "pre" | "post"): Promise; export declare function minifyHtml(html: string): string; export declare function minifyCode(code: string): Promise; export declare function getSlugParamName(pattern: string): string; export declare function fileHasExports(filePath: string): Promise; export declare function computeFileHash(filePath: string): Promise; export interface IncrementalState { fileHashes: Record; clientCodeHashes: Record; } export declare function loadIncrementalState(): Promise; export declare function saveIncrementalState(state: IncrementalState): Promise; export declare function copyPublicDir(publicDir: string): Promise; export declare function copyPublicDirIncremental(publicDir: string): Promise; export declare function buildClientRuntime(minify: boolean): Promise; export declare const ROUTE_ESBUILD_BASE: { bundle: boolean; write: boolean; format: "esm"; target: string; legalComments: "inline"; packages: "external"; external: string[]; loader: Record; plugins: esbuild.Plugin[]; minify: boolean; treeShaking: boolean; }; export declare function discoverApiRoutes(pagesDir: string): Promise; export declare function discoverMiddlewares(pagesDir: string): Promise; export declare function findAndCacheStatusCodePages(): Promise; export declare function transpileAllRoutes(routes: RouteInfo[], minify: boolean, skipServerKeys?: ReadonlySet): Promise>; export declare function loadLayoutFromCache(pathname: string, cacheKey: CacheKey): Promise; export declare function loadRouteFromCache(entry: { pageFile: string; layouts: string[]; layoutCacheKeys: CacheKey[]; cacheKey: CacheKey; pathname: string; }): Promise; export {}; //# sourceMappingURL=common.d.ts.map