import { NgtscProgram } from '@angular/compiler-cli'; import * as ts from 'typescript'; import { Plugin } from 'vite'; import { FileReplacement } from './plugins/file-replacements.plugin.js'; export declare enum DiagnosticModes { None = 0, Option = 1, Syntactic = 2, Semantic = 4, All = 7 } export interface PluginOptions { tsconfig?: string | (() => string); workspaceRoot?: string; inlineStylesExtension?: string; jit?: boolean; advanced?: { /** * Custom TypeScript transformers that are run before Angular compilation */ tsTransformers?: ts.CustomTransformers; }; supportedBrowsers?: string[]; transformFilter?: (code: string, id: string) => boolean; /** * Additional files to include in compilation */ include?: string[]; additionalContentDirs?: string[]; liveReload?: boolean; disableTypeChecking?: boolean; fileReplacements?: FileReplacement[]; /** * Opt into the fast compile path. Skips Angular's template type-checking * and routes compilation through an internal single-pass transform. * Defaults to `false`. */ fastCompile?: boolean; /** * Compilation output mode used when `fastCompile` is enabled. * - `'full'` (default): Emit final Ivy definitions for application builds. * - `'partial'`: Emit partial declarations for library publishing. */ fastCompileMode?: 'full' | 'partial'; experimental?: { useAngularCompilationAPI?: boolean; }; } export declare function angular(options?: PluginOptions): Plugin[]; export declare function createFsWatcherCacheInvalidator(invalidateFsCaches: () => void, invalidateTsconfigCaches: () => void, performCompilation: () => Promise): () => Promise; /** * Convert Analog/Angular CLI-style file replacements into the flat record * expected by `AngularHostOptions.fileReplacements`. * * Only browser replacements (`{ replace, with }`) are converted. SSR-only * replacements (`{ replace, ssr }`) are left for the Vite runtime plugin to * handle — they should not be baked into the Angular compilation host because * that would apply them to both browser and server builds. * * Relative paths are resolved against `workspaceRoot` so that the host * receives the same absolute paths it would get from the Angular CLI. */ export declare function toAngularCompilationFileReplacements(replacements: FileReplacement[], workspaceRoot: string): Record | undefined; /** * Map Angular's `templateUpdates` (keyed by `encodedFilePath@ClassName`) * back to absolute file paths with their associated HMR code and component * class name. * * Angular's private Compilation API emits template update keys in the form * `encodeURIComponent(relativePath + '@' + className)`. We decode and resolve * them so the caller can look up updates by the same normalized absolute path * used elsewhere in the plugin (`outputFiles`, `classNames`, etc.). */ export declare function mapTemplateUpdatesToFiles(templateUpdates: ReadonlyMap | undefined): Map; export declare function getFileMetadata(program: ts.BuilderProgram, angularCompiler?: NgtscProgram['compiler'], liveReload?: boolean, disableTypeChecking?: boolean): (file: string) => { errors?: undefined; warnings?: undefined; hmrUpdateCode?: undefined; hmrEligible?: undefined; } | { errors: string[]; warnings: (string | ts.DiagnosticMessageChain)[]; hmrUpdateCode: string | null | undefined; hmrEligible: boolean; }; /** * Checks for vitest run from the command line * @returns boolean */ export declare function isTestWatchMode(args?: string[]): boolean;