/** * Core build handler for Creek's Next.js adapter. * * Called by Next.js after build completes via onBuildComplete(). * With --webpack, .next/server/ contains standard CJS that esbuild * can bundle directly (unlike Turbopack's custom chunked format). * * Note: onBuildComplete runs BEFORE standalone output is generated * (Next.js source: build/index.js:2544-2581), so we cannot rely on * .next/standalone/. Instead we import directly from .next/server/. */ import type { NextAdapter } from "next"; type BuildContext = Parameters>[0]; /** * Content-dedup a wasm file map in place. The Prisma query-compiler can be * collected twice under different names — Next.js traces it as * `query_compiler_fast_bg.wasm` while `collectPrismaCompilerWasm` stages the * identical bytes as `query_compiler_fast_bg.sqlite.wasm`. They hash to the * same content, so shipping both wastes ~3.5MB of the size-capped bundle on * every deploy. Keep one file per unique payload, preferring `prismaWasmDest` * (the staged name the sentinel redirect references). Returns the count dropped. * * Exported for tests. */ export declare function dedupeWasmByContent(wasmFiles: Map, prismaWasmDest: string | null): Promise; export declare function handleBuild(ctx: BuildContext): Promise; /** * Count native-module references in bundled JS text: quoted string literals * whose path ends in `.node` (e.g. `require("build/Release/better_sqlite3.node")`). * * Deliberately does NOT match bare member access like `tree.node` or * `this.node` — those are ordinary JS, not native binaries. The old naive * `/\.node\b/` count conflated the two, so an oversized bundle whose real cause * was a stale `.next/dev` reported dozens of phantom "native modules" and sent * people down the wrong path. Matching only quoted `.node` filenames keeps the * hint pointed at actual inlined binaries. Pure + exported for testing. */ export declare function countNativeModuleRefs(text: string): number; /** * Collect all JSON manifests from .next/ for embedding in the worker. * Returns a map of absolute path → file content string. */ export declare function collectManifests(distDir: string): Promise>; /** Prerender entry for ISR cache seeding */ export interface PrerenderEntry { pathname: string; html: string; postponedState?: string; allowsFallbackShellResume?: boolean; initialRevalidate?: number | false; initialStatus?: number; initialHeaders?: Record; initialExpiration?: number; pprHeaders?: Record; lastModified?: number; segmentPaths?: string[]; /** * Headers captured from the `.meta` sidecar file next to the prerendered * HTML (e.g. `.next/server/app/index.meta`). `initialHeaders` comes from * `prerender-manifest.json` and *does not* include the `x-next-cache-tags` * entry for cacheComponents routes — those tags are only written to the * per-route `.meta` file. Without reading them, our runtime tag-staleness * check (`__CREEK_TAG_INVALIDATED_AT` ∩ `staticEntry.cacheTags`) never * fires for cacheComponents pages, so `revalidateTag` silently fails. */ metaHeaders?: Record; } /** * A single \`'use cache'\` entry extracted at build time from a prerender's * embedded renderResumeDataCache. Mirrors Next.js's UseCacheCacheStoreSerialized * shape (see packages/next/src/server/resume-data-cache/cache-store.ts) so the * worker can restore these straight into CreekComposableCacheHandler without * running Next.js's parse path (which allocates streams tied to a request's * IoContext). */ export interface ComposableCacheSeed { key: string; value: string; tags: string[]; stale: number; timestamp: number; expire: number; revalidate: number; } export {}; //# sourceMappingURL=build.d.ts.map