import { Worker } from 'node:worker_threads'; import type * as TTypescript from 'typescript'; import type { HeftConfiguration, IScopedLogger } from '@rushstack/heft'; import type { ExtendedTypeScript, IExtendedSolutionBuilder, ITypeScriptNodeSystem } from './internalTypings/TypeScriptInternals'; import type { ITypeScriptConfigurationJson } from './TypeScriptPlugin'; import type { PerformanceMeasurer } from './Performance'; export interface ITypeScriptBuilderConfiguration extends ITypeScriptConfigurationJson { /** * The root folder of the build. */ buildFolderPath: string; /** * The folder to write build metadata. */ buildMetadataFolderPath: string; /** * The path to the TypeScript tool. */ heftConfiguration: HeftConfiguration; /** * The path to the tsconfig file being built. */ tsconfigPath: string; /** * The scoped logger that the builder will log to. */ scopedLogger: IScopedLogger; /** * The callback used to emit the typescript program (or programs) from the builder. */ emitChangedFilesCallback: (program: TTypescript.Program, changedFiles?: Set) => void; } type TWatchProgram = TTypescript.WatchOfFilesAndCompilerOptions; interface IPendingWork { (): void; } interface ITranspileSignal { resolve: (result: TTypescript.EmitResult) => void; reject: (error: Error) => void; } /** * @internal */ export interface IBaseTypeScriptTool { typeScriptToolPath: string; ts: ExtendedTypeScript; system: TSystem; } interface ITypeScriptTool extends IBaseTypeScriptTool { measureSync: PerformanceMeasurer; sourceFileCache: Map; watchProgram: TWatchProgram | undefined; solutionBuilder: IExtendedSolutionBuilder | undefined; rawDiagnostics: TTypescript.Diagnostic[]; pendingOperations: Set; executing: boolean; worker: Worker | undefined; pendingTranspilePromises: Map>; pendingTranspileSignals: Map; reportDiagnostic: TTypescript.DiagnosticReporter; } export declare class TypeScriptBuilder { private readonly _configuration; private readonly _typescriptLogger; private readonly _typescriptTerminal; private _useSolutionBuilder; private _moduleKindsToEmit; private readonly _suppressedDiagnosticCodes; private __tsCacheFilePath; private _tool; private _nextRequestId; private get _tsCacheFilePath(); constructor(configuration: ITypeScriptBuilderConfiguration); invokeAsync(onChangeDetected?: () => void): Promise; _runWatchAsync(tool: ITypeScriptTool): Promise; _runBuildAsync(tool: ITypeScriptTool): Promise; _runSolutionBuildAsync(tool: ITypeScriptTool): Promise; private _logDiagnostics; private _logEmitPerformance; private _logReadPerformance; private _printDiagnosticMessage; private _getAdjustedDiagnosticCategory; private _validateTsconfig; private _addModuleKindToEmit; private _getCreateBuilderProgram; private _buildSolutionBuilderHost; private _buildIncrementalCompilerHost; private _buildWatchCompilerHost; private _changeCompilerHostToUseCache; private _buildWatchSolutionBuilderHost; /** * For each module kind configured with `emitModulePackageJson: true`, writes a * `package.json` with the appropriate `"type"` field to ensure Node.js correctly * interprets `.js` files in the output folder. */ private _emitModulePackageJsonFiles; private _parseModuleKind; private _queueTranspileInWorker; private _cleanupWorker; } export {}; //# sourceMappingURL=TypeScriptBuilder.d.ts.map