vite-typescript-plugin
Version:
A Vite plugin for seamless integration between Vite and Typescript.
69 lines (68 loc) • 3.2 kB
TypeScript
import ts from "typescript";
import { createProgram } from "./createProgram";
import { EmitFileValueType, emitFileCode } from "./emitFileCode";
import { getCompilerOptions } from "./getCompilerOptions";
import { readFile } from "./readFile";
import { getCacheFileDetails } from "./getCacheFileDetails";
import { getSourceFile } from "./getSourceFile";
import { getCanonicalFileName } from "./getCanonicalFileName";
import { getDefaultLibLocation } from "./getDefaultLibLocation";
import { getDefaultLibFileName } from "./getDefaultLibFileName";
import { getCurrentDirectory } from "./getCurrentDirectory";
import { getSourceFileByPath } from "./getSourceFileByPath";
import { resolveModuleNames } from "./resolveModuleNames";
import { getTsConfigFilePath } from "./getConfigFilePath";
import { emitFileIfChanged } from "./emitFileIfChanged";
import { getOptimizedRootNames } from "./optimizeRootNames";
export { ts };
export type ExtensionName = string;
export type CustomExtensions = Partial<Record<ExtensionName, {
extension: ts.Extension;
scriptKind: ts.ScriptKind;
}>>;
export declare const Extension: typeof ts.Extension;
export declare const ScriptKind: typeof ts.ScriptKind;
export interface HostOptions {
compilerOptions?: ts.CompilerOptions;
tsConfigPath?: string;
transformers?: ts.CustomTransformers;
extensionsSupport?: CustomExtensions;
}
export declare class CustomCompilerHost {
fileCache: Map<string, {
sourceFile: ts.SourceFile | undefined;
code: string | undefined;
modules: Record<string, ts.ResolvedModule | undefined> | undefined;
emitFileValue: EmitFileValueType | undefined;
}>;
extensionsSupport: CustomExtensions;
defaultCompilerOptions?: ts.CompilerOptions;
defaultTsConfigPath?: string;
tsConfigPath: string;
transformers?: ts.CustomTransformers;
configFileOptions: ts.ParsedCommandLine;
oldProgram: ts.Program;
newLine: string;
rootNames: string[];
constructor(hostOptions: HostOptions, rootNames?: string[]);
getOptimizedRootNames: typeof getOptimizedRootNames;
getSourceFile: typeof getSourceFile;
getSourceFileByPath: typeof getSourceFileByPath;
getCacheFileDetails: typeof getCacheFileDetails;
readFile: typeof readFile;
emitFileIfChanged: typeof emitFileIfChanged;
writeFile(fileName: string): void;
readDirectory: (path: string, extensions?: readonly string[] | undefined, exclude?: readonly string[] | undefined, include?: readonly string[] | undefined, depth?: number | undefined) => string[];
getCanonicalFileName: typeof getCanonicalFileName;
getDefaultLibLocation: typeof getDefaultLibLocation;
getDefaultLibFileName: typeof getDefaultLibFileName;
useCaseSensitiveFileNames(): boolean;
getNewLine(): string;
getCurrentDirectory: typeof getCurrentDirectory;
fileExists(fileName: string): boolean;
getTsConfigFilePath: typeof getTsConfigFilePath;
resolveModuleNames: typeof resolveModuleNames;
getCompilerOptions: typeof getCompilerOptions;
emitFileCode: typeof emitFileCode;
createProgram: typeof createProgram;
}