/** * Inline the manifests read by `loadManifest` and `evalManifest` from `load-manifest.js` * * They rely on `readFileSync` that is not supported by workerd. * - `loadManifest` reads are replaced with `readInlinedManifest`, keeping the Next.js cache logic * - `evalManifest` is replaced with an implementation returning the inlined client reference manifests */ import { type BuildOptions } from "@opennextjs/aws/build/helper.js"; import type { ContentUpdater, Plugin } from "@opennextjs/aws/plugins/content-updater.js"; export declare function inlineLoadManifest(updater: ContentUpdater, buildOpts: BuildOptions): Plugin; /** * A manifest section lifted into a shared variable. */ export type FactoredObject = { /** JavaScript source for the shared value, updated when nested values are factored out. */ source: string; /** Whether at least one reference came from `entryCSSFiles`, making it eligible for inline CSS deduplication. */ isEntryCssFiles: boolean; }; /** * Lift eligible large top-level sections from a client reference manifest. * * Sections listed in `factoredManifestKeys` are lifted when their source text is * longer than 30 characters, even if they occur only once. Identical section * source reuses the same variable across manifests. * * @param manifest The manifest code. * @param values Map of variable names to factored objects and their CSS-section metadata. * @param prefixMap Map of short hash prefix → full hash, updated in place for * collision resolution across calls. * @returns The manifest code with large values factored out. */ export declare function factorManifestValues(manifest: string, values: Map, prefixMap: Map): string; /** * Lift large chunks arrays and inline CSS strings into shared variables. * * Parse each object once. Lift matching values longer than 30 characters even * if they occur only once, and reuse the same variable for identical source. * * @param objects The distinct emitted objects, whose source is rewritten in place. * @param sharedVars Map to accumulate shared variable declarations. * @param prefixMap Map of short hash prefix → full hash, updated in place for collision resolution. * @returns Nothing; updates the object sources and shared variable maps in place. */ export declare function factorObjectValues(objects: ReadonlyMap, sharedVars: Map, prefixMap: Map): void; /** * Get or create a short variable name for a value, resolving collisions. * * Computes a SHA1 hash of the value, then finds the shortest unique prefix * (minimum {@link MIN_PREFIX_LENGTH} hex chars). When a new hash collides with * an existing prefix, the new entry is given a longer prefix — existing entries * are never renamed. * * This allows saving space in the generated code (A full SHA1 is 40 hex chars) because * identifiers are not minimized by the Open Next build process. * * @param value The value to hash. * @param prefixMap Map of short prefix → full hash, updated in place. * @returns The variable name (`v`). */ export declare function getOrCreateVarName(value: string, prefixMap: Map): string;