import { IndexHtmlGenerator, type IndexHtmlGeneratorOptions } from '@angular/build/private';
import { Compilation, RspackPluginInstance, type Compiler } from '@rspack/core';
import type { I18nOptions, IndexExpandedDefinition } from '../models';
import { type CriticalCssPlan } from '../utils/beasties';
/** The index html documents of a server build for one locale. */
export interface ServerIndexHtml {
/** `index.server.html`, the document server rendering renders into. */
server: string;
/** `index.csr.html`, served as-is for client-rendered routes. */
csr: string;
/** The `ngCspNonce` attribute value of the server document. */
nonce: string | undefined;
}
export interface ServerRenderingInputs {
/** Keyed by locale, the empty string when not localizing. */
indexHtml: Map;
/**
* Set when critical CSS is inlined from compiled plans, which
* `@angular/build` >= 22.2 does.
*/
criticalCssPlans: CriticalCssPlan[] | undefined;
emitsOriginalIndex?: boolean;
}
/**
* Holds the server rendering inputs of the browser compiler's last
* compilation without errors, for the server compiler that runs after it.
*/
export interface SharedServerRenderingInputs {
current?: ServerRenderingInputs;
}
export interface IndexHtmlPluginOptions extends IndexHtmlGeneratorOptions {
baseHref: string | undefined;
i18n: I18nOptions;
index: IndexExpandedDefinition;
isSsr: boolean;
outputPath: string;
serverRenderingInputs?: SharedServerRenderingInputs;
serverPostTransform?: IndexHtmlGeneratorOptions['postTransform'];
}
/**
* Whether a server build emits its server index as `index.original.html`,
* which Nx's CommonEngine server template renders instead of `index.html`.
* From 22.2, CommonEngine inlining critical CSS a second time into the browser
* index leaves a stylesheet that never loads.
*/
export declare function emitsServerIndexAsOriginal(index: IndexExpandedDefinition): boolean;
export declare class IndexHtmlPlugin extends IndexHtmlGenerator implements RspackPluginInstance {
#private;
readonly options: IndexHtmlPluginOptions;
private _compilation;
get compilation(): Compilation;
constructor(options: IndexHtmlPluginOptions);
apply(compiler: Compiler): void;
readAsset(path: string): Promise;
protected readIndex(path: string): Promise;
getLocaleBaseHref(locale: string): string | undefined;
}
//# sourceMappingURL=index-html-plugin.d.ts.map