/** * A Heft plugin for using TypeScript. * * @packageDocumentation */ import type { HeftConfiguration } from '@rushstack/heft'; import type { ITerminal } from '@rushstack/terminal'; import semver from 'semver'; import { SyncHook } from 'tapable'; import type * as _TTypeScript from 'typescript'; declare type ExtendedTypeScript = typeof _TTypeScript & IExtendedTypeScript; /** * @internal */ export declare function _getTsconfigFilePath(heftConfiguration: HeftConfiguration, tsconfigRelativePath: string | undefined): string; /** * @internal */ export declare interface _IBaseTypeScriptTool { typeScriptToolPath: string; ts: ExtendedTypeScript; system: TSystem; } /** * @beta */ export declare interface IChangedFilesHookOptions { program: _TTypeScript.Program; changedFiles?: ReadonlySet<_TTypeScript.SourceFile>; } /** * @internal */ export declare interface _ICompilerCapabilities { /** * Support for incremental compilation via `ts.createIncrementalProgram()`. * Introduced with TypeScript 3.6. */ incrementalProgram: boolean; /** * Support for composite projects via `ts.createSolutionBuilder()`. * Introduced with TypeScript 3.0. */ solutionBuilder: boolean; } /** * @beta */ export declare interface IEmitModuleKind { moduleKind: 'commonjs' | 'amd' | 'umd' | 'system' | 'es2015' | 'esnext'; outFolderName: string; jsExtensionOverride?: string; emitModulePackageJson?: boolean; } /** * @internal */ declare interface IExtendedTypeScript { /** * https://github.com/microsoft/TypeScript/blob/5f597e69b2e3b48d788cb548df40bcb703c8adb1/src/compiler/performance.ts#L3 */ performance: { /** * https://github.com/microsoft/TypeScript/blob/5f597e69b2e3b48d788cb548df40bcb703c8adb1/src/compiler/performance.ts#L119-L121 */ disable(): void; /** * https://github.com/microsoft/TypeScript/blob/5f597e69b2e3b48d788cb548df40bcb703c8adb1/src/compiler/performance.ts#L110-L116 */ enable(): void; /** * https://github.com/microsoft/TypeScript/blob/5f597e69b2e3b48d788cb548df40bcb703c8adb1/src/compiler/performance.ts#L55-L61 */ mark(performanceMaker: string): void; /** * https://github.com/microsoft/TypeScript/blob/5f597e69b2e3b48d788cb548df40bcb703c8adb1/src/compiler/performance.ts#L72-L78 */ measure(measureName: string, startMarkName?: string, endMarkName?: string): void; /** * https://github.com/microsoft/TypeScript/blob/5f597e69b2e3b48d788cb548df40bcb703c8adb1/src/compiler/performance.ts#L94-L96 */ getDuration(measureName: string): number; /** * https://github.com/microsoft/TypeScript/blob/5f597e69b2e3b48d788cb548df40bcb703c8adb1/src/compiler/performance.ts#L85-L87 */ getCount(measureName: string): number; }; transpileOptionValueCompilerOptions: { name: keyof _TTypeScript.CompilerOptions; transpileOptionValue: any; }[]; getNewLineCharacter(compilerOptions: _TTypeScript.CompilerOptions): string; createCompilerHost(options: _TTypeScript.CompilerOptions, setParentNodes?: boolean, system?: _TTypeScript.System): _TTypeScript.CompilerHost; createCompilerHostWorker(options: _TTypeScript.CompilerOptions, setParentNodes?: boolean, system?: _TTypeScript.System): _TTypeScript.CompilerHost; combinePaths(path1: string, path2: string): string; /** * https://github.com/microsoft/TypeScript/blob/782c09d783e006a697b4ba6d1e7ec2f718ce8393/src/compiler/utilities.ts#L6540 */ matchFiles(path: string, extensions: ReadonlyArray | undefined, excludes: ReadonlyArray | undefined, includes: ReadonlyArray | undefined, useCaseSensitiveFileNames: boolean, currentDirectory: string, depth: number | undefined, getFileSystemEntries: (path: string) => { readonly files: ReadonlyArray; readonly directories: ReadonlyArray; }, realpath: (path: string) => string, directoryExists: (path: string) => boolean): string[]; Diagnostics: { Found_1_error_Watching_for_file_changes: _TTypeScript.DiagnosticMessage; Found_0_errors_Watching_for_file_changes: _TTypeScript.DiagnosticMessage; Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor: _TTypeScript.DiagnosticMessage; Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1: _TTypeScript.DiagnosticMessage; }; } /** * @internal */ export declare interface _ILoadedTypeScriptTool { tool: _IBaseTypeScriptTool; typescriptVersion: string; typescriptParsedVersion: semver.SemVer; capabilities: _ICompilerCapabilities; } /** * @internal */ export declare interface _ILoadTsconfigOptions { tool: _IBaseTypeScriptTool; tsconfigPath: string; tsCacheFilePath?: string; } /** * @internal */ export declare interface _ILoadTypeScriptToolOptions { terminal: ITerminal; heftConfiguration: HeftConfiguration; onlyResolveSymlinksInNodeModules?: boolean; buildProjectReferences?: boolean; } /** * @beta */ export declare interface IPartialTsconfig { compilerOptions?: IPartialTsconfigCompilerOptions; } /** * @beta */ export declare interface IPartialTsconfigCompilerOptions { outDir?: string; } /** * @beta */ export declare interface IStaticAssetsCopyConfiguration { fileExtensions: string[]; excludeGlobs: string[]; includeGlobs: string[]; } /** * @beta */ export declare interface ITypeScriptConfigurationJson { /** * If provided, emit these module kinds in addition to the modules specified in the tsconfig. * Note that this option only applies to the main tsconfig.json configuration. */ additionalModuleKindsToEmit?: IEmitModuleKind[] | undefined; /** * If 'true', emit CommonJS output into the TSConfig outDir with the file extension '.cjs' */ emitCjsExtensionForCommonJS?: boolean | undefined; /** * If 'true', emit ESModule output into the TSConfig outDir with the file extension '.mjs' */ emitMjsExtensionForESModule?: boolean | undefined; /** * If true, enable behavior analogous to the "tsc --build" command. Will build projects referenced by the main project in dependency order. * Note that this will effectively enable \"noEmitOnError\". */ buildProjectReferences?: boolean; /** * If true, and the tsconfig has \"isolatedModules\": true, then transpilation will happen in parallel in a worker thread. */ useTranspilerWorker?: boolean; /** * If true, the TypeScript compiler will only resolve symlinks to their targets if the links are in a node_modules folder. * This significantly reduces file system operations in typical usage. */ onlyResolveSymlinksInNodeModules?: boolean; project?: string; /** * Configures additional file types that should be copied into the TypeScript compiler's emit folders, for example * so that these files can be resolved by import statements. */ staticAssetsToCopy?: IStaticAssetsCopyConfiguration; } /** * @beta */ export declare interface ITypeScriptPluginAccessor { readonly onChangedFilesHook: SyncHook; } /** * @beta */ export declare function loadPartialTsconfigFileAsync(heftConfiguration: HeftConfiguration, terminal: ITerminal, typeScriptConfigurationJson: ITypeScriptConfigurationJson | undefined): Promise; /** * @internal */ export declare function _loadTsconfig(options: _ILoadTsconfigOptions): _TTypeScript.ParsedCommandLine; /** * @beta */ export declare function loadTypeScriptConfigurationFileAsync(heftConfiguration: HeftConfiguration, terminal: ITerminal): Promise; /** * @internal */ export declare function _loadTypeScriptToolAsync(options: _ILoadTypeScriptToolOptions): Promise<_ILoadedTypeScriptTool>; export { _TTypeScript } /** * The name of the plugin, as specified in heft-plugin.json * * @public */ export declare const TypeScriptPluginName: 'typescript-plugin'; export { }