@rushstack/heft-typescript-plugin 1.2.4 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +44 -0
- package/CHANGELOG.md +13 -1
- package/dist/heft-typescript-plugin.d.ts +1 -0
- package/dist/tsdoc-metadata.json +1 -1
- package/lib-commonjs/TypeScriptBuilder.js +65 -13
- package/lib-commonjs/TypeScriptBuilder.js.map +1 -1
- package/lib-commonjs/TypeScriptPlugin.js.map +1 -1
- package/lib-commonjs/schemas/typescript.schema.json +5 -0
- package/lib-commonjs/types.js.map +1 -1
- package/lib-dts/TypeScriptBuilder.d.ts +6 -0
- package/lib-dts/TypeScriptBuilder.d.ts.map +1 -1
- package/lib-dts/TypeScriptPlugin.d.ts +1 -0
- package/lib-dts/TypeScriptPlugin.d.ts.map +1 -1
- package/lib-dts/types.d.ts +5 -0
- package/lib-dts/types.d.ts.map +1 -1
- package/lib-esm/TypeScriptBuilder.js +65 -13
- package/lib-esm/TypeScriptBuilder.js.map +1 -1
- package/lib-esm/TypeScriptPlugin.js.map +1 -1
- package/lib-esm/schemas/typescript.schema.json +5 -0
- package/lib-esm/types.js.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeScriptBuilder.js","sourceRoot":"","sources":["../src/TypeScriptBuilder.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAI7C,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAkB/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAA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,WAAW,CAAC,KAAK,CAAC,CAAC;YAC1B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QAC1B,CAAC;IACH,CAAC;CACF;AAED,SAAS,qCAAqC,CAC5C,cAA0C;;IAE1C,MAAM,OAAO,GAA2B,cAAmD,CAAC;IAC5F,8DAA8D;IAC9D,MAAM,eAAe,GAAgB,CAAC,MAAA,OAAO,CAAC,KAAK,mCAAI,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,eAAe,CAAC;IAE3F,MAAM,gBAAgB,GAAwB,IAAI,GAAG,EAAE,CAAC;IACxD,KAAK,MAAM,QAAQ,IAAI,eAAe,EAAE,CAAC;QACvC,MAAM,UAAU,GAAuC,cAAc,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC9F,IAAI,UAAU,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE,CAAC;YAChD,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED,SAAS,8BAA8B,CAAC,OAA4B;IAClE,MAAM,gBAAgB,GAAwB,IAAI,GAAG,EAAE,CAAC;IACxD,KAAK,MAAM,UAAU,IAAI,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;QAClD,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE,CAAC;YAClC,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as crypto from 'node:crypto';\nimport * as path from 'node:path';\nimport { Worker } from 'node:worker_threads';\n\nimport type * as TTypescript from 'typescript';\n\nimport { Path, FileError } from '@rushstack/node-core-library';\nimport type { ITerminal } from '@rushstack/terminal';\nimport type { HeftConfiguration, IScopedLogger } from '@rushstack/heft';\n\nimport type {\n ExtendedBuilderProgram,\n ExtendedTypeScript,\n IExtendedSolutionBuilder,\n ITypeScriptNodeSystem\n} from './internalTypings/TypeScriptInternals';\nimport type { ITypeScriptConfigurationJson, IEmitModuleKind } from './TypeScriptPlugin';\nimport type { PerformanceMeasurer } from './Performance';\nimport type {\n ICachedEmitModuleKind,\n ITranspilationRequestMessage,\n ITranspilationResponseMessage,\n ITypescriptWorkerData\n} from './types';\nimport { configureProgramForMultiEmit } from './configureProgramForMultiEmit';\nimport { loadTsconfig } from './tsconfigLoader';\nimport { loadTypeScriptToolAsync } from './loadTypeScriptTool';\n\nexport interface ITypeScriptBuilderConfiguration extends ITypeScriptConfigurationJson {\n /**\n * The root folder of the build.\n */\n buildFolderPath: string;\n\n /**\n * The folder to write build metadata.\n */\n buildMetadataFolderPath: string;\n\n /**\n * The path to the TypeScript tool.\n */\n heftConfiguration: HeftConfiguration;\n\n // watchMode: boolean;\n\n /**\n * The path to the tsconfig file being built.\n */\n tsconfigPath: string;\n\n /**\n * The scoped logger that the builder will log to.\n */\n scopedLogger: IScopedLogger;\n\n /**\n * The callback used to emit the typescript program (or programs) from the builder.\n */\n emitChangedFilesCallback: (\n program: TTypescript.Program,\n changedFiles?: Set<TTypescript.SourceFile>\n ) => void;\n}\n\ntype TSolutionHost = TTypescript.SolutionBuilderHost<TTypescript.EmitAndSemanticDiagnosticsBuilderProgram>;\ntype TWatchCompilerHost =\n TTypescript.WatchCompilerHostOfFilesAndCompilerOptions<TTypescript.EmitAndSemanticDiagnosticsBuilderProgram>;\ntype TWatchSolutionHost =\n TTypescript.SolutionBuilderWithWatchHost<TTypescript.EmitAndSemanticDiagnosticsBuilderProgram>;\ntype TWatchProgram =\n TTypescript.WatchOfFilesAndCompilerOptions<TTypescript.EmitAndSemanticDiagnosticsBuilderProgram>;\n\ninterface IFileToWrite {\n filePath: string;\n data: string;\n}\n\ninterface IModuleKindReason {\n kind: keyof typeof TTypescript.ModuleKind;\n outDir: string;\n extension: '.js' | '.cjs' | '.mjs';\n reason: string;\n}\n\ninterface IExtendedEmitResult extends TTypescript.EmitResult {\n changedSourceFiles: Set<TTypescript.SourceFile>;\n filesToWrite: IFileToWrite[];\n}\n\ninterface IPendingWork {\n (): void;\n}\n\ninterface ITranspileSignal {\n resolve: (result: TTypescript.EmitResult) => void;\n reject: (error: Error) => void;\n}\n\n/**\n * @internal\n */\nexport interface IBaseTypeScriptTool<TSystem extends TTypescript.System = TTypescript.System> {\n typeScriptToolPath: string;\n ts: ExtendedTypeScript;\n system: TSystem;\n}\n\ninterface ITypeScriptTool extends IBaseTypeScriptTool<ITypeScriptNodeSystem> {\n measureSync: PerformanceMeasurer;\n\n sourceFileCache: Map<string, TTypescript.SourceFile>;\n\n watchProgram: TWatchProgram | undefined;\n\n solutionBuilder: IExtendedSolutionBuilder | undefined;\n\n rawDiagnostics: TTypescript.Diagnostic[];\n pendingOperations: Set<IPendingWork>;\n\n executing: boolean;\n\n worker: Worker | undefined;\n pendingTranspilePromises: Map<number, Promise<TTypescript.EmitResult>>;\n pendingTranspileSignals: Map<number, ITranspileSignal>;\n\n reportDiagnostic: TTypescript.DiagnosticReporter;\n}\n\nexport class TypeScriptBuilder {\n private readonly _configuration: ITypeScriptBuilderConfiguration;\n private readonly _typescriptLogger: IScopedLogger;\n private readonly _typescriptTerminal: ITerminal;\n\n private _useSolutionBuilder!: boolean;\n\n private _moduleKindsToEmit!: ICachedEmitModuleKind[];\n private readonly _suppressedDiagnosticCodes: Set<number> = new Set();\n\n private __tsCacheFilePath: string | undefined;\n\n private _tool: ITypeScriptTool | undefined = undefined;\n\n private _nextRequestId: number = 0;\n\n private get _tsCacheFilePath(): string {\n if (!this.__tsCacheFilePath) {\n // TypeScript internally handles if the tsconfig options have changed from when the tsbuildinfo file was created.\n // We only need to hash our additional Heft configuration.\n const configHash: crypto.Hash = crypto.createHash('sha1');\n\n // Relativize the outFolderName paths before hashing to ensure portability across different machines\n const normalizedConfig: IEmitModuleKind[] =\n this._configuration.additionalModuleKindsToEmit?.map((emitKind) => ({\n ...emitKind,\n outFolderName: Path.convertToSlashes(\n path.relative(this._configuration.buildFolderPath, emitKind.outFolderName)\n )\n })) || [];\n\n configHash.update(JSON.stringify(normalizedConfig));\n const serializedConfigHash: string = configHash.digest('base64url').slice(0, 8);\n\n // This conversion is theoretically redundant, but it is here to make absolutely sure that the path is formatted\n // using only '/' as the directory separator so that incremental builds don't break on Windows.\n // TypeScript will normalize to '/' when serializing, but not on the direct input, and uses exact string equality.\n const normalizedCacheFolderPath: string = Path.convertToSlashes(\n this._configuration.buildMetadataFolderPath\n );\n this.__tsCacheFilePath = `${normalizedCacheFolderPath}/ts_${serializedConfigHash}.json`;\n }\n\n return this.__tsCacheFilePath;\n }\n\n public constructor(configuration: ITypeScriptBuilderConfiguration) {\n this._configuration = configuration;\n this._typescriptLogger = configuration.scopedLogger;\n this._typescriptTerminal = configuration.scopedLogger.terminal;\n }\n\n public async invokeAsync(onChangeDetected?: () => void): Promise<void> {\n if (!this._tool) {\n const {\n tool: { ts, system: baseSystem, typeScriptToolPath }\n } = await loadTypeScriptToolAsync({\n terminal: this._typescriptTerminal,\n heftConfiguration: this._configuration.heftConfiguration,\n buildProjectReferences: this._configuration.buildProjectReferences,\n onlyResolveSymlinksInNodeModules: this._configuration.onlyResolveSymlinksInNodeModules\n });\n this._useSolutionBuilder = !!this._configuration.buildProjectReferences;\n\n ts.performance.enable();\n\n const suppressedCodes: (number | undefined)[] = [\n ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor?.code,\n // This diagnostic code is not present in old versions of TypeScript\n ts.Diagnostics\n .Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1?.code\n ];\n for (const code of suppressedCodes) {\n if (code !== undefined) {\n this._suppressedDiagnosticCodes.add(code);\n }\n }\n\n const measureTsPerformance: PerformanceMeasurer = <TResult extends object | void>(\n measurementName: string,\n fn: () => TResult\n ) => {\n const beforeName: string = `before${measurementName}`;\n ts.performance.mark(beforeName);\n const result: TResult = fn();\n const afterName: string = `after${measurementName}`;\n ts.performance.mark(afterName);\n ts.performance.measure(measurementName, beforeName, afterName);\n return {\n ...result,\n duration: ts.performance.getDuration(measurementName),\n count: ts.performance.getCount(beforeName)\n };\n };\n\n this._typescriptTerminal.writeLine(`Using TypeScript version ${ts.version}`);\n\n const rawDiagnostics: TTypescript.Diagnostic[] = [];\n\n const pendingOperations: Set<IPendingWork> = new Set();\n\n const clearTimeout = (timeout: IPendingWork): void => {\n pendingOperations.delete(timeout);\n };\n\n const setTimeout = <T extends unknown[]>(\n fn: (...args: T) => void,\n ms: number,\n ...args: T\n ): IPendingWork => {\n const timeout: IPendingWork = () => {\n fn(...args);\n };\n pendingOperations.add(timeout);\n if (!this._tool?.executing && onChangeDetected) {\n onChangeDetected();\n }\n return timeout;\n };\n\n const getCurrentDirectory: () => string = () => this._configuration.buildFolderPath;\n\n // Need to also update watchFile and watchDirectory\n const system: ITypeScriptNodeSystem = {\n ...baseSystem,\n getCurrentDirectory,\n clearTimeout,\n setTimeout\n };\n const { realpath } = system;\n\n if (realpath && system.getAccessibleFileSystemEntries) {\n const { getAccessibleFileSystemEntries } = system;\n system.readDirectory = (folderPath, extensions, exclude, include, depth): string[] => {\n return ts.matchFiles(\n folderPath,\n extensions,\n exclude,\n include,\n ts.sys.useCaseSensitiveFileNames,\n getCurrentDirectory(),\n depth,\n getAccessibleFileSystemEntries,\n realpath,\n ts.sys.directoryExists\n );\n };\n }\n\n this._tool = {\n typeScriptToolPath,\n ts,\n system,\n\n measureSync: measureTsPerformance,\n\n sourceFileCache: new Map(),\n\n watchProgram: undefined,\n solutionBuilder: undefined,\n\n rawDiagnostics,\n\n pendingOperations,\n\n executing: false,\n\n reportDiagnostic: (diagnostic: TTypescript.Diagnostic) => {\n rawDiagnostics.push(diagnostic);\n },\n\n worker: undefined,\n\n pendingTranspilePromises: new Map(),\n pendingTranspileSignals: new Map()\n };\n }\n\n const { performance } = this._tool.ts;\n // Reset the performance counters to 0 to avoid contamination from previous runs\n performance.disable();\n performance.enable();\n\n if (onChangeDetected !== undefined) {\n await this._runWatchAsync(this._tool);\n } else if (this._useSolutionBuilder) {\n await this._runSolutionBuildAsync(this._tool);\n } else {\n await this._runBuildAsync(this._tool);\n }\n }\n\n public async _runWatchAsync(tool: ITypeScriptTool): Promise<void> {\n const {\n ts,\n measureSync: measureTsPerformance,\n pendingOperations,\n rawDiagnostics,\n pendingTranspilePromises\n } = tool;\n\n if (!tool.solutionBuilder && !tool.watchProgram) {\n //#region CONFIGURE\n const { duration: configureDurationMs, tsconfig } = measureTsPerformance('Configure', () => {\n const _tsconfig: TTypescript.ParsedCommandLine = loadTsconfig({\n tool,\n tsconfigPath: this._configuration.tsconfigPath,\n tsCacheFilePath: this._tsCacheFilePath\n });\n this._validateTsconfig(ts, _tsconfig);\n\n return {\n tsconfig: _tsconfig\n };\n });\n this._typescriptTerminal.writeVerboseLine(`Configure: ${configureDurationMs}ms`);\n //#endregion\n\n if (this._useSolutionBuilder) {\n const solutionHost: TWatchSolutionHost = this._buildWatchSolutionBuilderHost(tool);\n const builder: TTypescript.SolutionBuilder<TTypescript.EmitAndSemanticDiagnosticsBuilderProgram> =\n ts.createSolutionBuilderWithWatch(solutionHost, [this._configuration.tsconfigPath], {});\n\n tool.solutionBuilder = builder as IExtendedSolutionBuilder;\n\n builder.build();\n } else {\n const compilerHost: TWatchCompilerHost = this._buildWatchCompilerHost(tool, tsconfig);\n tool.watchProgram = ts.createWatchProgram(compilerHost);\n }\n }\n\n if (pendingOperations.size > 0) {\n rawDiagnostics.length = 0;\n tool.executing = true;\n for (const operation of pendingOperations) {\n pendingOperations.delete(operation);\n operation();\n }\n if (pendingTranspilePromises.size) {\n const emitResults: TTypescript.EmitResult[] = await Promise.all(pendingTranspilePromises.values());\n for (const { diagnostics } of emitResults) {\n for (const diagnostic of diagnostics) {\n rawDiagnostics.push(diagnostic);\n }\n }\n }\n // eslint-disable-next-line require-atomic-updates\n tool.executing = false;\n }\n this._logDiagnostics(ts, rawDiagnostics, this._useSolutionBuilder);\n }\n\n public async _runBuildAsync(tool: ITypeScriptTool): Promise<void> {\n const { ts, measureSync: measureTsPerformance, pendingTranspilePromises } = tool;\n\n //#region CONFIGURE\n const {\n duration: configureDurationMs,\n tsconfig,\n compilerHost\n } = measureTsPerformance('Configure', () => {\n const _tsconfig: TTypescript.ParsedCommandLine = loadTsconfig({\n tool,\n tsconfigPath: this._configuration.tsconfigPath,\n tsCacheFilePath: this._tsCacheFilePath\n });\n this._validateTsconfig(ts, _tsconfig);\n\n const _compilerHost: TTypescript.CompilerHost = this._buildIncrementalCompilerHost(tool, _tsconfig);\n\n return {\n tsconfig: _tsconfig,\n compilerHost: _compilerHost\n };\n });\n this._typescriptTerminal.writeVerboseLine(`Configure: ${configureDurationMs}ms`);\n //#endregion\n\n //#region PROGRAM\n // There will be only one program here; emit will get a bit abused if we produce multiple outputs\n let builderProgram: TTypescript.BuilderProgram | undefined = undefined;\n let innerProgram: TTypescript.Program;\n\n const isolatedModules: boolean =\n !!this._configuration.useTranspilerWorker && !!tsconfig.options.isolatedModules;\n const mode: 'both' | 'declaration' = isolatedModules ? 'declaration' : 'both';\n\n let filesToTranspile: Map<string, string> | undefined;\n\n if (tsconfig.options.incremental) {\n // Use ts.createEmitAndSemanticDiagnositcsBuilderProgram directly because the customizations performed by\n // _getCreateBuilderProgram duplicate those performed in this function for non-incremental build.\n const oldProgram: TTypescript.EmitAndSemanticDiagnosticsBuilderProgram | undefined =\n ts.readBuilderProgram(tsconfig.options, compilerHost);\n builderProgram = ts.createEmitAndSemanticDiagnosticsBuilderProgram(\n tsconfig.fileNames,\n tsconfig.options,\n compilerHost,\n oldProgram,\n ts.getConfigFileParsingDiagnostics(tsconfig),\n tsconfig.projectReferences\n );\n filesToTranspile = getFilesToTranspileFromBuilderProgram(builderProgram);\n innerProgram = builderProgram.getProgram();\n } else {\n innerProgram = ts.createProgram({\n rootNames: tsconfig.fileNames,\n options: tsconfig.options,\n projectReferences: tsconfig.projectReferences,\n host: compilerHost,\n oldProgram: undefined,\n configFileParsingDiagnostics: ts.getConfigFileParsingDiagnostics(tsconfig)\n });\n filesToTranspile = getFilesToTranspileFromProgram(innerProgram);\n }\n\n // Prefer the builder program, since it is what gives us incremental builds\n const genericProgram: TTypescript.BuilderProgram | TTypescript.Program = builderProgram || innerProgram;\n\n this._logReadPerformance(ts);\n //#endregion\n\n if (isolatedModules) {\n // Kick the transpilation worker.\n this._queueTranspileInWorker(tool, genericProgram.getCompilerOptions(), filesToTranspile);\n }\n\n //#region ANALYSIS\n const { duration: diagnosticsDurationMs, diagnostics: preDiagnostics } = measureTsPerformance(\n 'Analyze',\n () => {\n const rawDiagnostics: TTypescript.Diagnostic[] = [\n ...genericProgram.getConfigFileParsingDiagnostics(),\n ...genericProgram.getOptionsDiagnostics(),\n ...genericProgram.getSyntacticDiagnostics(),\n ...genericProgram.getGlobalDiagnostics(),\n ...genericProgram.getSemanticDiagnostics()\n ];\n return { diagnostics: rawDiagnostics };\n }\n );\n this._typescriptTerminal.writeVerboseLine(`Analyze: ${diagnosticsDurationMs}ms`);\n //#endregion\n\n //#region EMIT\n const { changedFiles } = configureProgramForMultiEmit(innerProgram, ts, this._moduleKindsToEmit, mode);\n\n const emitResult: TTypescript.EmitResult = genericProgram.emit(\n undefined,\n // The writeFile callback must be provided for the multi-emit redirector\n ts.sys.writeFile,\n undefined,\n undefined,\n undefined\n );\n\n this._cleanupWorker();\n //#endregion\n\n this._logEmitPerformance(ts);\n\n //#region FINAL_ANALYSIS\n // Need to ensure that we include emit diagnostics, since they might not be part of the other sets\n const rawDiagnostics: TTypescript.Diagnostic[] = [...preDiagnostics, ...emitResult.diagnostics];\n //#endregion\n\n this._configuration.emitChangedFilesCallback(innerProgram, changedFiles);\n\n if (pendingTranspilePromises.size) {\n const emitResults: TTypescript.EmitResult[] = await Promise.all(pendingTranspilePromises.values());\n for (const { diagnostics } of emitResults) {\n for (const diagnostic of diagnostics) {\n rawDiagnostics.push(diagnostic);\n }\n }\n }\n\n this._logDiagnostics(ts, rawDiagnostics);\n // Reset performance counters in case any are used in the callback\n ts.performance.disable();\n ts.performance.enable();\n }\n\n public async _runSolutionBuildAsync(tool: ITypeScriptTool): Promise<void> {\n this._typescriptTerminal.writeVerboseLine(`Using solution mode`);\n\n const { ts, measureSync, rawDiagnostics, pendingTranspilePromises } = tool;\n rawDiagnostics.length = 0;\n\n if (!tool.solutionBuilder) {\n //#region CONFIGURE\n const { duration: configureDurationMs, solutionBuilderHost } = measureSync('Configure', () => {\n const _tsconfig: TTypescript.ParsedCommandLine = loadTsconfig({\n tool,\n tsconfigPath: this._configuration.tsconfigPath,\n tsCacheFilePath: this._tsCacheFilePath\n });\n this._validateTsconfig(ts, _tsconfig);\n\n const _solutionBuilderHost: TSolutionHost = this._buildSolutionBuilderHost(tool);\n\n return {\n solutionBuilderHost: _solutionBuilderHost\n };\n });\n this._typescriptTerminal.writeVerboseLine(`Configure: ${configureDurationMs}ms`);\n //#endregion\n\n tool.solutionBuilder = ts.createSolutionBuilder(\n solutionBuilderHost,\n [this._configuration.tsconfigPath],\n {}\n ) as IExtendedSolutionBuilder;\n } else {\n // Force reload everything from disk\n for (const project of tool.solutionBuilder.getBuildOrder()) {\n tool.solutionBuilder.invalidateProject(project, 1);\n }\n }\n\n //#region EMIT\n // Ignoring the exit status because we only care about presence of diagnostics\n tool.solutionBuilder.build();\n this._cleanupWorker();\n //#endregion\n\n if (pendingTranspilePromises.size) {\n const emitResults: TTypescript.EmitResult[] = await Promise.all(pendingTranspilePromises.values());\n for (const { diagnostics } of emitResults) {\n for (const diagnostic of diagnostics) {\n rawDiagnostics.push(diagnostic);\n }\n }\n }\n\n this._logDiagnostics(ts, rawDiagnostics, true);\n }\n\n private _logDiagnostics(\n ts: ExtendedTypeScript,\n rawDiagnostics: TTypescript.Diagnostic[],\n isSolutionMode?: boolean\n ): void {\n const diagnostics: readonly TTypescript.Diagnostic[] = ts.sortAndDeduplicateDiagnostics(rawDiagnostics);\n\n if (diagnostics.length > 0) {\n let warningCount: number = 0;\n let hasError: boolean = false;\n\n this._typescriptTerminal.writeLine(\n `Encountered ${diagnostics.length} TypeScript issue${diagnostics.length > 1 ? 's' : ''}:`\n );\n for (const diagnostic of diagnostics) {\n const diagnosticCategory: TTypescript.DiagnosticCategory = this._getAdjustedDiagnosticCategory(\n diagnostic,\n ts\n );\n\n if (diagnosticCategory === ts.DiagnosticCategory.Warning) {\n warningCount++;\n } else if (diagnosticCategory === ts.DiagnosticCategory.Error) {\n hasError = true;\n }\n\n this._printDiagnosticMessage(ts, diagnostic, diagnosticCategory);\n }\n\n if (isSolutionMode && warningCount > 0 && !hasError) {\n this._typescriptLogger.emitError(\n new Error(\n `TypeScript encountered ${warningCount} warning${warningCount === 1 ? '' : 's'} ` +\n `and is configured to build project references. As a result, no files were emitted. Please fix the reported warnings to proceed.`\n )\n );\n }\n }\n }\n\n private _logEmitPerformance(ts: ExtendedTypeScript): void {\n this._typescriptTerminal.writeVerboseLine(`Bind: ${ts.performance.getDuration('Bind')}ms`);\n this._typescriptTerminal.writeVerboseLine(`Check: ${ts.performance.getDuration('Check')}ms`);\n this._typescriptTerminal.writeVerboseLine(\n `Transform: ${ts.performance.getDuration('transformTime')}ms ` +\n `(${ts.performance.getCount('beforeTransform')} files)`\n );\n this._typescriptTerminal.writeVerboseLine(\n `Print: ${ts.performance.getDuration('printTime')}ms ` +\n `(${ts.performance.getCount('beforePrint')} files) (Includes Transform)`\n );\n this._typescriptTerminal.writeVerboseLine(\n `Emit: ${ts.performance.getDuration('Emit')}ms (Includes Print)`\n );\n this._typescriptTerminal.writeVerboseLine(\n `I/O Write: ${ts.performance.getDuration('I/O Write')}ms (${ts.performance.getCount(\n 'beforeIOWrite'\n )} files)`\n );\n }\n\n private _logReadPerformance(ts: ExtendedTypeScript): void {\n this._typescriptTerminal.writeVerboseLine(\n `I/O Read: ${ts.performance.getDuration('I/O Read')}ms (${ts.performance.getCount(\n 'beforeIORead'\n )} files)`\n );\n this._typescriptTerminal.writeVerboseLine(\n `Parse: ${ts.performance.getDuration('Parse')}ms (${ts.performance.getCount('beforeParse')} files)`\n );\n this._typescriptTerminal.writeVerboseLine(\n `Program (includes Read + Parse): ${ts.performance.getDuration('Program')}ms`\n );\n }\n\n private _printDiagnosticMessage(\n ts: ExtendedTypeScript,\n diagnostic: TTypescript.Diagnostic,\n diagnosticCategory: TTypescript.DiagnosticCategory = this._getAdjustedDiagnosticCategory(diagnostic, ts)\n ): void {\n // Code taken from reference example\n let diagnosticMessage: string;\n let errorObject: Error;\n if (diagnostic.file) {\n const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start!);\n const message: string = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\\n');\n const formattedMessage: string = `(TS${diagnostic.code}) ${message}`;\n errorObject = new FileError(formattedMessage, {\n absolutePath: diagnostic.file.fileName,\n projectFolder: this._configuration.buildFolderPath,\n line: line + 1,\n column: character + 1\n });\n diagnosticMessage = errorObject.toString();\n } else {\n diagnosticMessage = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\\n');\n errorObject = new Error(diagnosticMessage);\n }\n\n switch (diagnosticCategory) {\n case ts.DiagnosticCategory.Error: {\n this._typescriptLogger.emitError(errorObject);\n break;\n }\n\n case ts.DiagnosticCategory.Warning: {\n this._typescriptLogger.emitWarning(errorObject);\n break;\n }\n\n default: {\n this._typescriptTerminal.writeLine(...diagnosticMessage);\n break;\n }\n }\n }\n\n private _getAdjustedDiagnosticCategory(\n diagnostic: TTypescript.Diagnostic,\n ts: ExtendedTypeScript\n ): TTypescript.DiagnosticCategory {\n // Workaround for https://github.com/microsoft/TypeScript/issues/40058\n // The compiler reports a hard error for issues such as this:\n //\n // error TS6133: 'x' is declared but its value is never read.\n //\n // These should properly be treated as warnings, because they are purely cosmetic issues.\n // TODO: Maybe heft should provide a config file for managing DiagnosticCategory mappings.\n if (diagnostic.reportsUnnecessary && diagnostic.category === ts.DiagnosticCategory.Error) {\n return ts.DiagnosticCategory.Warning;\n }\n\n // These pedantic checks also should not be treated as hard errors\n if (this._suppressedDiagnosticCodes.has(diagnostic.code)) {\n return ts.DiagnosticCategory.Warning;\n }\n\n return diagnostic.category;\n }\n\n private _validateTsconfig(ts: ExtendedTypeScript, tsconfig: TTypescript.ParsedCommandLine): void {\n if (\n (tsconfig.options.module && !tsconfig.options.outDir) ||\n (!tsconfig.options.module && tsconfig.options.outDir)\n ) {\n throw new Error(\n 'If either the module or the outDir option is provided in the tsconfig compilerOptions, both must be provided'\n );\n }\n\n this._moduleKindsToEmit = [];\n const specifiedKinds: Map<TTypescript.ModuleKind, IModuleKindReason> = new Map();\n const specifiedOutDirs: Map<string, IModuleKindReason> = new Map();\n\n if (!tsconfig.options.module) {\n throw new Error(\n 'If the module tsconfig compilerOption is not provided, the builder must be provided with the ' +\n 'additionalModuleKindsToEmit configuration option.'\n );\n }\n\n if (this._configuration.emitCjsExtensionForCommonJS) {\n this._addModuleKindToEmit(\n ts.ModuleKind.CommonJS,\n tsconfig.options.outDir!,\n /* isPrimary */ tsconfig.options.module === ts.ModuleKind.CommonJS,\n '.cjs'\n );\n\n const cjsReason: IModuleKindReason = {\n outDir: tsconfig.options.outDir!,\n kind: 'CommonJS',\n extension: '.cjs',\n reason: 'emitCjsExtensionForCommonJS'\n };\n\n specifiedKinds.set(ts.ModuleKind.CommonJS, cjsReason);\n specifiedOutDirs.set(`${tsconfig.options.outDir!}:.cjs`, cjsReason);\n }\n\n if (this._configuration.emitMjsExtensionForESModule) {\n this._addModuleKindToEmit(\n ts.ModuleKind.ESNext,\n tsconfig.options.outDir!,\n /* isPrimary */ tsconfig.options.module === ts.ModuleKind.ESNext,\n '.mjs'\n );\n\n const mjsReason: IModuleKindReason = {\n outDir: tsconfig.options.outDir!,\n kind: 'ESNext',\n extension: '.mjs',\n reason: 'emitMjsExtensionForESModule'\n };\n\n specifiedKinds.set(ts.ModuleKind.ESNext, mjsReason);\n specifiedOutDirs.set(`${tsconfig.options.outDir!}:.mjs`, mjsReason);\n }\n\n if (!specifiedKinds.has(tsconfig.options.module)) {\n this._addModuleKindToEmit(\n tsconfig.options.module,\n tsconfig.options.outDir!,\n /* isPrimary */ true,\n /* jsExtensionOverride */ undefined\n );\n\n const tsConfigReason: IModuleKindReason = {\n outDir: tsconfig.options.outDir!,\n kind: ts.ModuleKind[tsconfig.options.module] as keyof typeof TTypescript.ModuleKind,\n extension: '.js',\n reason: 'tsconfig.json'\n };\n\n specifiedKinds.set(tsconfig.options.module, tsConfigReason);\n specifiedOutDirs.set(`${tsconfig.options.outDir!}:.js`, tsConfigReason);\n }\n\n if (this._configuration.additionalModuleKindsToEmit) {\n for (const additionalModuleKindToEmit of this._configuration.additionalModuleKindsToEmit) {\n const moduleKind: TTypescript.ModuleKind = this._parseModuleKind(\n ts,\n additionalModuleKindToEmit.moduleKind\n );\n\n const outDirKey: string = `${additionalModuleKindToEmit.outFolderName}:.js`;\n const moduleKindReason: IModuleKindReason = {\n kind: ts.ModuleKind[moduleKind] as keyof typeof TTypescript.ModuleKind,\n outDir: additionalModuleKindToEmit.outFolderName,\n extension: '.js',\n reason: `additionalModuleKindsToEmit`\n };\n\n const existingKind: IModuleKindReason | undefined = specifiedKinds.get(moduleKind);\n const existingDir: IModuleKindReason | undefined = specifiedOutDirs.get(outDirKey);\n\n if (existingKind) {\n throw new Error(\n `Module kind \"${additionalModuleKindToEmit.moduleKind}\" is already emitted at ${existingKind.outDir} with extension '${existingKind.extension}' by option ${existingKind.reason}.`\n );\n } else if (existingDir) {\n throw new Error(\n `Output folder \"${additionalModuleKindToEmit.outFolderName}\" already contains module kind ${existingDir.kind} with extension '${existingDir.extension}', specified by option ${existingDir.reason}.`\n );\n } else {\n const outFolderKey: string | undefined = this._addModuleKindToEmit(\n moduleKind,\n additionalModuleKindToEmit.outFolderName,\n /* isPrimary */ false,\n undefined\n );\n\n if (outFolderKey) {\n specifiedKinds.set(moduleKind, moduleKindReason);\n specifiedOutDirs.set(outFolderKey, moduleKindReason);\n }\n }\n }\n }\n }\n\n private _addModuleKindToEmit(\n moduleKind: TTypescript.ModuleKind,\n outFolderPath: string,\n isPrimary: boolean,\n jsExtensionOverride: string | undefined\n ): string | undefined {\n let outFolderName: string;\n if (path.isAbsolute(outFolderPath)) {\n outFolderName = path.relative(this._configuration.buildFolderPath, outFolderPath);\n } else {\n outFolderName = outFolderPath;\n outFolderPath = path.resolve(this._configuration.buildFolderPath, outFolderPath);\n }\n\n outFolderPath = Path.convertToSlashes(outFolderPath);\n outFolderPath = outFolderPath.replace(/\\/*$/, '/'); // Ensure the outFolderPath ends with a slash\n\n for (const existingModuleKindToEmit of this._moduleKindsToEmit) {\n let errorText: string | undefined;\n\n if (existingModuleKindToEmit.outFolderPath === outFolderPath) {\n if (existingModuleKindToEmit.jsExtensionOverride === jsExtensionOverride) {\n errorText =\n 'Unable to output two different module kinds with the same ' +\n `module extension (${jsExtensionOverride || '.js'}) to the same ` +\n `folder (\"${outFolderPath}\").`;\n }\n } else {\n let parentFolder: string | undefined;\n let childFolder: string | undefined;\n if (outFolderPath.startsWith(existingModuleKindToEmit.outFolderPath)) {\n parentFolder = outFolderPath;\n childFolder = existingModuleKindToEmit.outFolderPath;\n } else if (existingModuleKindToEmit.outFolderPath.startsWith(outFolderPath)) {\n parentFolder = existingModuleKindToEmit.outFolderPath;\n childFolder = outFolderPath;\n }\n\n if (parentFolder) {\n errorText =\n 'Unable to output two different module kinds to nested folders ' +\n `(\"${parentFolder}\" and \"${childFolder}\").`;\n }\n }\n\n if (errorText) {\n this._typescriptLogger.emitError(new Error(errorText));\n return undefined;\n }\n }\n\n this._moduleKindsToEmit.push({\n outFolderPath,\n moduleKind,\n jsExtensionOverride,\n\n isPrimary\n });\n\n return `${outFolderName}:${jsExtensionOverride || '.js'}`;\n }\n\n private _getCreateBuilderProgram(\n ts: ExtendedTypeScript\n ): TTypescript.CreateProgram<TTypescript.EmitAndSemanticDiagnosticsBuilderProgram> {\n const {\n _configuration: { emitChangedFilesCallback }\n } = this;\n\n const createMultiEmitBuilderProgram: TTypescript.CreateProgram<\n TTypescript.EmitAndSemanticDiagnosticsBuilderProgram\n > = (\n fileNames: readonly string[] | undefined,\n compilerOptions: TTypescript.CompilerOptions | undefined,\n host: TTypescript.CompilerHost | undefined,\n oldProgram: TTypescript.EmitAndSemanticDiagnosticsBuilderProgram | undefined,\n configFileParsingDiagnostics: readonly TTypescript.Diagnostic[] | undefined,\n projectReferences: readonly TTypescript.ProjectReference[] | undefined\n ): TTypescript.EmitAndSemanticDiagnosticsBuilderProgram => {\n // Reset performance counters\n ts.performance.disable();\n ts.performance.enable();\n\n this._typescriptTerminal.writeVerboseLine(`Reading program \"${compilerOptions!.configFilePath}\"`);\n\n const newProgram: TTypescript.EmitAndSemanticDiagnosticsBuilderProgram =\n ts.createEmitAndSemanticDiagnosticsBuilderProgram(\n fileNames,\n compilerOptions,\n host,\n oldProgram,\n configFileParsingDiagnostics,\n projectReferences\n );\n\n this._logReadPerformance(ts);\n\n const isolatedModules: boolean =\n !!this._configuration.useTranspilerWorker && !!compilerOptions!.isolatedModules;\n const mode: 'both' | 'declaration' = isolatedModules ? 'declaration' : 'both';\n\n if (isolatedModules) {\n // Kick the transpilation worker.\n const filesToTranspile: Map<string, string> = getFilesToTranspileFromBuilderProgram(newProgram);\n this._queueTranspileInWorker(this._tool!, compilerOptions!, filesToTranspile);\n }\n\n const { emit: originalEmit } = newProgram;\n\n const emit: TTypescript.Program['emit'] = (\n outerTargetSourceFile?: TTypescript.SourceFile,\n outerWriteFile?: TTypescript.WriteFileCallback,\n outerCancellationToken?: TTypescript.CancellationToken,\n outerEmitOnlyDtsFiles?: boolean,\n outerCustomTransformers?: TTypescript.CustomTransformers\n ) => {\n const innerProgram: TTypescript.Program = newProgram.getProgram();\n\n const innerCompilerOptions: TTypescript.CompilerOptions = innerProgram.getCompilerOptions();\n\n const { changedFiles } = configureProgramForMultiEmit(\n innerProgram,\n ts,\n this._moduleKindsToEmit,\n mode\n );\n\n const result: TTypescript.EmitResult = originalEmit.call(\n newProgram,\n outerTargetSourceFile,\n outerWriteFile,\n outerCancellationToken,\n outerEmitOnlyDtsFiles,\n outerCustomTransformers\n );\n\n (result as IExtendedEmitResult).changedSourceFiles = changedFiles;\n\n this._typescriptTerminal.writeVerboseLine(\n `Emitting program \"${innerCompilerOptions!.configFilePath}\"`\n );\n\n this._logEmitPerformance(ts);\n\n // Reset performance counters\n ts.performance.disable();\n ts.performance.enable();\n\n emitChangedFilesCallback(innerProgram, changedFiles);\n\n return result;\n };\n\n newProgram.emit = emit;\n\n return newProgram;\n };\n\n return createMultiEmitBuilderProgram;\n }\n\n private _buildSolutionBuilderHost(tool: ITypeScriptTool): TSolutionHost {\n const reportSolutionBuilderStatus: TTypescript.DiagnosticReporter = tool.reportDiagnostic;\n const reportEmitErrorSummary: TTypescript.ReportEmitErrorSummary = (errorCount: number): void => {\n // Do nothing\n };\n\n const { ts, system } = tool;\n\n const solutionBuilderHost: TTypescript.SolutionBuilderHost<TTypescript.EmitAndSemanticDiagnosticsBuilderProgram> =\n ts.createSolutionBuilderHost(\n system,\n this._getCreateBuilderProgram(ts),\n tool.reportDiagnostic,\n reportSolutionBuilderStatus,\n reportEmitErrorSummary\n );\n\n solutionBuilderHost.afterProgramEmitAndDiagnostics = (\n program: TTypescript.EmitAndSemanticDiagnosticsBuilderProgram\n ) => {\n // Use the native metric since we aren't overwriting the writer\n this._typescriptTerminal.writeVerboseLine(\n `I/O Write: ${ts.performance.getDuration('I/O Write')}ms (${ts.performance.getCount(\n 'beforeIOWrite'\n )} files)`\n );\n };\n\n return solutionBuilderHost;\n }\n\n private _buildIncrementalCompilerHost(\n tool: ITypeScriptTool,\n tsconfig: TTypescript.ParsedCommandLine\n ): TTypescript.CompilerHost {\n const { ts, system } = tool;\n\n let compilerHost: TTypescript.CompilerHost | undefined;\n\n if (tsconfig.options.incremental) {\n compilerHost = ts.createIncrementalCompilerHost(tsconfig.options, system);\n } else {\n compilerHost = (ts.createCompilerHostWorker ?? ts.createCompilerHost)(\n tsconfig.options,\n undefined,\n system\n );\n }\n\n this._changeCompilerHostToUseCache(compilerHost, tool);\n\n return compilerHost;\n }\n\n private _buildWatchCompilerHost(\n tool: ITypeScriptTool,\n tsconfig: TTypescript.ParsedCommandLine\n ): TWatchCompilerHost {\n const { ts, system } = tool;\n\n const reportWatchStatus: TTypescript.DiagnosticReporter = (diagnostic: TTypescript.Diagnostic): void => {\n this._printDiagnosticMessage(ts, diagnostic);\n };\n\n const compilerHost: TWatchCompilerHost = ts.createWatchCompilerHost(\n tsconfig.fileNames,\n tsconfig.options,\n system,\n this._getCreateBuilderProgram(ts),\n tool.reportDiagnostic,\n reportWatchStatus,\n tsconfig.projectReferences,\n tsconfig.watchOptions\n );\n\n return compilerHost;\n }\n\n private _changeCompilerHostToUseCache(compilerHost: TTypescript.CompilerHost, tool: ITypeScriptTool): void {\n const { sourceFileCache } = tool;\n\n const { getSourceFile: innerGetSourceFile } = compilerHost;\n if ((innerGetSourceFile as { cache?: typeof sourceFileCache }).cache === sourceFileCache) {\n return;\n }\n\n compilerHost.getCurrentDirectory = () => this._configuration.buildFolderPath;\n\n // Enable source file persistence\n const getSourceFile: typeof innerGetSourceFile & {\n cache?: typeof sourceFileCache;\n } = (\n fileName: string,\n languageVersionOrOptions: TTypescript.ScriptTarget | TTypescript.CreateSourceFileOptions,\n onError?: ((message: string) => void) | undefined,\n shouldCreateNewSourceFile?: boolean | undefined\n ): TTypescript.SourceFile | undefined => {\n if (!shouldCreateNewSourceFile) {\n const cachedSourceFile: TTypescript.SourceFile | undefined = sourceFileCache.get(fileName);\n if (cachedSourceFile) {\n return cachedSourceFile;\n }\n }\n\n const result: TTypescript.SourceFile | undefined = innerGetSourceFile(\n fileName,\n languageVersionOrOptions,\n onError,\n shouldCreateNewSourceFile\n );\n if (result) {\n sourceFileCache.set(fileName, result);\n } else {\n sourceFileCache.delete(fileName);\n }\n return result;\n };\n\n getSourceFile.cache = sourceFileCache;\n\n compilerHost.getSourceFile = getSourceFile;\n }\n\n private _buildWatchSolutionBuilderHost(tool: ITypeScriptTool): TWatchSolutionHost {\n const { reportDiagnostic, ts, system } = tool;\n\n const host: TWatchSolutionHost = ts.createSolutionBuilderWithWatchHost(\n system,\n this._getCreateBuilderProgram(ts),\n reportDiagnostic,\n reportDiagnostic,\n reportDiagnostic\n );\n\n return host;\n }\n\n private _parseModuleKind(ts: ExtendedTypeScript, moduleKindName: string): TTypescript.ModuleKind {\n switch (moduleKindName.toLowerCase()) {\n case 'commonjs':\n return ts.ModuleKind.CommonJS;\n\n case 'amd':\n return ts.ModuleKind.AMD;\n\n case 'umd':\n return ts.ModuleKind.UMD;\n\n case 'system':\n return ts.ModuleKind.System;\n\n case 'es2015':\n return ts.ModuleKind.ES2015;\n\n case 'esnext':\n return ts.ModuleKind.ESNext;\n\n default:\n throw new Error(`\"${moduleKindName}\" is not a valid module kind name.`);\n }\n }\n\n private _queueTranspileInWorker(\n tool: ITypeScriptTool,\n compilerOptions: TTypescript.CompilerOptions,\n filesToTranspile: Map<string, string>\n ): void {\n const { typeScriptToolPath, pendingTranspilePromises, pendingTranspileSignals } = tool;\n let maybeWorker: Worker | undefined = tool.worker;\n if (!maybeWorker) {\n const workerData: ITypescriptWorkerData = {\n typeScriptToolPath\n };\n tool.worker = maybeWorker = new Worker(require.resolve('./TranspilerWorker.js'), {\n workerData: workerData\n });\n\n maybeWorker.on('message', (response: ITranspilationResponseMessage) => {\n const { requestId: resolvingRequestId, type, result } = response;\n const signal: ITranspileSignal | undefined = pendingTranspileSignals.get(resolvingRequestId);\n\n if (type === 'error') {\n const error: Error = Object.assign(new Error(result.message), result);\n if (signal) {\n signal.reject(error);\n } else {\n this._typescriptTerminal.writeErrorLine(\n `Unexpected worker rejection for request with id ${resolvingRequestId}: ${error}`\n );\n }\n } else if (signal) {\n signal.resolve(result);\n } else {\n this._typescriptTerminal.writeErrorLine(\n `Unexpected worker resolution for request with id ${resolvingRequestId}`\n );\n }\n\n pendingTranspileSignals.delete(resolvingRequestId);\n pendingTranspilePromises.delete(resolvingRequestId);\n });\n\n maybeWorker.once('exit', (exitCode: number) => {\n if (pendingTranspileSignals.size) {\n const error: Error = new Error(`Worker exited unexpectedly with code ${exitCode}.`);\n for (const { reject: rejectTranspile } of pendingTranspileSignals.values()) {\n rejectTranspile(error);\n }\n pendingTranspileSignals.clear();\n }\n });\n\n maybeWorker.once('error', (err: Error) => {\n for (const { reject: rejectTranspile } of pendingTranspileSignals.values()) {\n rejectTranspile(err);\n }\n pendingTranspileSignals.clear();\n });\n }\n\n // make linter happy\n const worker: Worker = maybeWorker;\n\n const requestId: number = ++this._nextRequestId;\n const transpilePromise: Promise<TTypescript.EmitResult> = new Promise(\n (resolve: (result: TTypescript.EmitResult) => void, reject: (err: Error) => void) => {\n pendingTranspileSignals.set(requestId, { resolve, reject });\n\n this._typescriptTerminal.writeLine(`Asynchronously transpiling ${compilerOptions.configFilePath}`);\n const request: ITranspilationRequestMessage = {\n compilerOptions,\n filesToTranspile,\n moduleKindsToEmit: this._moduleKindsToEmit,\n requestId\n };\n\n worker.postMessage(request);\n }\n );\n\n pendingTranspilePromises.set(requestId, transpilePromise);\n }\n\n private _cleanupWorker(): void {\n const tool: ITypeScriptTool | undefined = this._tool;\n if (!tool) {\n return;\n }\n\n const { worker } = tool;\n if (worker) {\n worker.postMessage(false);\n tool.worker = undefined;\n }\n }\n}\n\nfunction getFilesToTranspileFromBuilderProgram(\n builderProgram: TTypescript.BuilderProgram\n): Map<string, string> {\n const program: ExtendedBuilderProgram = builderProgram as unknown as ExtendedBuilderProgram;\n // getState was removed in Typescript 5.6, replaced with state\n const changedFilesSet: Set<string> = (program.state ?? program.getState()).changedFilesSet;\n\n const filesToTranspile: Map<string, string> = new Map();\n for (const fileName of changedFilesSet) {\n const sourceFile: TTypescript.SourceFile | undefined = builderProgram.getSourceFile(fileName);\n if (sourceFile && !sourceFile.isDeclarationFile) {\n filesToTranspile.set(sourceFile.fileName, sourceFile.text);\n }\n }\n return filesToTranspile;\n}\n\nfunction getFilesToTranspileFromProgram(program: TTypescript.Program): Map<string, string> {\n const filesToTranspile: Map<string, string> = new Map();\n for (const sourceFile of program.getSourceFiles()) {\n if (!sourceFile.isDeclarationFile) {\n filesToTranspile.set(sourceFile.fileName, sourceFile.text);\n }\n }\n return filesToTranspile;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TypeScriptBuilder.js","sourceRoot":"","sources":["../src/TypeScriptBuilder.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAI7C,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAkB/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAuG/D,MAAM,OAAO,iBAAiB;IAgB5B,IAAY,gBAAgB;;QAC1B,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC5B,iHAAiH;YACjH,0DAA0D;YAC1D,MAAM,UAAU,GAAgB,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;YAE1D,oGAAoG;YACpG,MAAM,gBAAgB,GACpB,CAAA,MAAA,IAAI,CAAC,cAAc,CAAC,2BAA2B,0CAAE,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;gBAClE,GAAG,QAAQ;gBACX,aAAa,EAAE,IAAI,CAAC,gBAAgB,CAClC,IAAI,CAAC,QAAQ,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C5C,cAA0C;;IAE1C,MAAM,OAAO,GAA2B,cAAmD,CAAC;IAC5F,8DAA8D;IAC9D,MAAM,eAAe,GAAgB,CAAC,MAAA,OAAO,CAAC,KAAK,mCAAI,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,eAAe,CAAC;IAE3F,MAAM,gBAAgB,GAAwB,IAAI,GAAG,EAAE,CAAC;IACxD,KAAK,MAAM,QAAQ,IAAI,eAAe,EAAE,CAAC;QACvC,MAAM,UAAU,GAAuC,cAAc,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC9F,IAAI,UAAU,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE,CAAC;YAChD,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED,SAAS,8BAA8B,CAAC,OAA4B;IAClE,MAAM,gBAAgB,GAAwB,IAAI,GAAG,EAAE,CAAC;IACxD,KAAK,MAAM,UAAU,IAAI,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;QAClD,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE,CAAC;YAClC,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as crypto from 'node:crypto';\nimport * as path from 'node:path';\nimport { Worker } from 'node:worker_threads';\n\nimport type * as TTypescript from 'typescript';\n\nimport { Path, FileError } from '@rushstack/node-core-library';\nimport type { ITerminal } from '@rushstack/terminal';\nimport type { HeftConfiguration, IScopedLogger } from '@rushstack/heft';\n\nimport type {\n ExtendedBuilderProgram,\n ExtendedTypeScript,\n IExtendedSolutionBuilder,\n ITypeScriptNodeSystem\n} from './internalTypings/TypeScriptInternals';\nimport type { ITypeScriptConfigurationJson, IEmitModuleKind } from './TypeScriptPlugin';\nimport type { PerformanceMeasurer } from './Performance';\nimport type {\n ICachedEmitModuleKind,\n ITranspilationRequestMessage,\n ITranspilationResponseMessage,\n ITypescriptWorkerData\n} from './types';\nimport { configureProgramForMultiEmit } from './configureProgramForMultiEmit';\nimport { loadTsconfig } from './tsconfigLoader';\nimport { loadTypeScriptToolAsync } from './loadTypeScriptTool';\n\nexport interface ITypeScriptBuilderConfiguration extends ITypeScriptConfigurationJson {\n /**\n * The root folder of the build.\n */\n buildFolderPath: string;\n\n /**\n * The folder to write build metadata.\n */\n buildMetadataFolderPath: string;\n\n /**\n * The path to the TypeScript tool.\n */\n heftConfiguration: HeftConfiguration;\n\n // watchMode: boolean;\n\n /**\n * The path to the tsconfig file being built.\n */\n tsconfigPath: string;\n\n /**\n * The scoped logger that the builder will log to.\n */\n scopedLogger: IScopedLogger;\n\n /**\n * The callback used to emit the typescript program (or programs) from the builder.\n */\n emitChangedFilesCallback: (\n program: TTypescript.Program,\n changedFiles?: Set<TTypescript.SourceFile>\n ) => void;\n}\n\ntype TSolutionHost = TTypescript.SolutionBuilderHost<TTypescript.EmitAndSemanticDiagnosticsBuilderProgram>;\ntype TWatchCompilerHost =\n TTypescript.WatchCompilerHostOfFilesAndCompilerOptions<TTypescript.EmitAndSemanticDiagnosticsBuilderProgram>;\ntype TWatchSolutionHost =\n TTypescript.SolutionBuilderWithWatchHost<TTypescript.EmitAndSemanticDiagnosticsBuilderProgram>;\ntype TWatchProgram =\n TTypescript.WatchOfFilesAndCompilerOptions<TTypescript.EmitAndSemanticDiagnosticsBuilderProgram>;\n\ninterface IFileToWrite {\n filePath: string;\n data: string;\n}\n\ninterface IModuleKindReason {\n kind: keyof typeof TTypescript.ModuleKind;\n outDir: string;\n extension: '.js' | '.cjs' | '.mjs';\n reason: string;\n}\n\ninterface IExtendedEmitResult extends TTypescript.EmitResult {\n changedSourceFiles: Set<TTypescript.SourceFile>;\n filesToWrite: IFileToWrite[];\n}\n\ninterface IPendingWork {\n (): void;\n}\n\ninterface ITranspileSignal {\n resolve: (result: TTypescript.EmitResult) => void;\n reject: (error: Error) => void;\n}\n\n/**\n * @internal\n */\nexport interface IBaseTypeScriptTool<TSystem extends TTypescript.System = TTypescript.System> {\n typeScriptToolPath: string;\n ts: ExtendedTypeScript;\n system: TSystem;\n}\n\ninterface ITypeScriptTool extends IBaseTypeScriptTool<ITypeScriptNodeSystem> {\n measureSync: PerformanceMeasurer;\n\n sourceFileCache: Map<string, TTypescript.SourceFile>;\n\n watchProgram: TWatchProgram | undefined;\n\n solutionBuilder: IExtendedSolutionBuilder | undefined;\n\n rawDiagnostics: TTypescript.Diagnostic[];\n pendingOperations: Set<IPendingWork>;\n\n executing: boolean;\n\n worker: Worker | undefined;\n pendingTranspilePromises: Map<number, Promise<TTypescript.EmitResult>>;\n pendingTranspileSignals: Map<number, ITranspileSignal>;\n\n reportDiagnostic: TTypescript.DiagnosticReporter;\n}\n\nexport class TypeScriptBuilder {\n private readonly _configuration: ITypeScriptBuilderConfiguration;\n private readonly _typescriptLogger: IScopedLogger;\n private readonly _typescriptTerminal: ITerminal;\n\n private _useSolutionBuilder!: boolean;\n\n private _moduleKindsToEmit!: ICachedEmitModuleKind[];\n private readonly _suppressedDiagnosticCodes: Set<number> = new Set();\n\n private __tsCacheFilePath: string | undefined;\n\n private _tool: ITypeScriptTool | undefined = undefined;\n\n private _nextRequestId: number = 0;\n\n private get _tsCacheFilePath(): string {\n if (!this.__tsCacheFilePath) {\n // TypeScript internally handles if the tsconfig options have changed from when the tsbuildinfo file was created.\n // We only need to hash our additional Heft configuration.\n const configHash: crypto.Hash = crypto.createHash('sha1');\n\n // Relativize the outFolderName paths before hashing to ensure portability across different machines\n const normalizedConfig: IEmitModuleKind[] =\n this._configuration.additionalModuleKindsToEmit?.map((emitKind) => ({\n ...emitKind,\n outFolderName: Path.convertToSlashes(\n path.relative(this._configuration.buildFolderPath, emitKind.outFolderName)\n )\n })) || [];\n\n configHash.update(JSON.stringify(normalizedConfig));\n const serializedConfigHash: string = configHash.digest('base64url').slice(0, 8);\n\n // This conversion is theoretically redundant, but it is here to make absolutely sure that the path is formatted\n // using only '/' as the directory separator so that incremental builds don't break on Windows.\n // TypeScript will normalize to '/' when serializing, but not on the direct input, and uses exact string equality.\n const normalizedCacheFolderPath: string = Path.convertToSlashes(\n this._configuration.buildMetadataFolderPath\n );\n this.__tsCacheFilePath = `${normalizedCacheFolderPath}/ts_${serializedConfigHash}.json`;\n }\n\n return this.__tsCacheFilePath;\n }\n\n public constructor(configuration: ITypeScriptBuilderConfiguration) {\n this._configuration = configuration;\n this._typescriptLogger = configuration.scopedLogger;\n this._typescriptTerminal = configuration.scopedLogger.terminal;\n }\n\n public async invokeAsync(onChangeDetected?: () => void): Promise<void> {\n if (!this._tool) {\n const {\n tool: { ts, system: baseSystem, typeScriptToolPath }\n } = await loadTypeScriptToolAsync({\n terminal: this._typescriptTerminal,\n heftConfiguration: this._configuration.heftConfiguration,\n buildProjectReferences: this._configuration.buildProjectReferences,\n onlyResolveSymlinksInNodeModules: this._configuration.onlyResolveSymlinksInNodeModules\n });\n this._useSolutionBuilder = !!this._configuration.buildProjectReferences;\n\n ts.performance.enable();\n\n const suppressedCodes: (number | undefined)[] = [\n ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor?.code,\n // This diagnostic code is not present in old versions of TypeScript\n ts.Diagnostics\n .Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1?.code\n ];\n for (const code of suppressedCodes) {\n if (code !== undefined) {\n this._suppressedDiagnosticCodes.add(code);\n }\n }\n\n const measureTsPerformance: PerformanceMeasurer = <TResult extends object | void>(\n measurementName: string,\n fn: () => TResult\n ) => {\n const beforeName: string = `before${measurementName}`;\n ts.performance.mark(beforeName);\n const result: TResult = fn();\n const afterName: string = `after${measurementName}`;\n ts.performance.mark(afterName);\n ts.performance.measure(measurementName, beforeName, afterName);\n return {\n ...result,\n duration: ts.performance.getDuration(measurementName),\n count: ts.performance.getCount(beforeName)\n };\n };\n\n this._typescriptTerminal.writeLine(`Using TypeScript version ${ts.version}`);\n\n const rawDiagnostics: TTypescript.Diagnostic[] = [];\n\n const pendingOperations: Set<IPendingWork> = new Set();\n\n const clearTimeout = (timeout: IPendingWork): void => {\n pendingOperations.delete(timeout);\n };\n\n const setTimeout = <T extends unknown[]>(\n fn: (...args: T) => void,\n ms: number,\n ...args: T\n ): IPendingWork => {\n const timeout: IPendingWork = () => {\n fn(...args);\n };\n pendingOperations.add(timeout);\n if (!this._tool?.executing && onChangeDetected) {\n onChangeDetected();\n }\n return timeout;\n };\n\n const getCurrentDirectory: () => string = () => this._configuration.buildFolderPath;\n\n // Need to also update watchFile and watchDirectory\n const system: ITypeScriptNodeSystem = {\n ...baseSystem,\n getCurrentDirectory,\n clearTimeout,\n setTimeout\n };\n const { realpath } = system;\n\n if (realpath && system.getAccessibleFileSystemEntries) {\n const { getAccessibleFileSystemEntries } = system;\n system.readDirectory = (folderPath, extensions, exclude, include, depth): string[] => {\n return ts.matchFiles(\n folderPath,\n extensions,\n exclude,\n include,\n ts.sys.useCaseSensitiveFileNames,\n getCurrentDirectory(),\n depth,\n getAccessibleFileSystemEntries,\n realpath,\n ts.sys.directoryExists\n );\n };\n }\n\n this._tool = {\n typeScriptToolPath,\n ts,\n system,\n\n measureSync: measureTsPerformance,\n\n sourceFileCache: new Map(),\n\n watchProgram: undefined,\n solutionBuilder: undefined,\n\n rawDiagnostics,\n\n pendingOperations,\n\n executing: false,\n\n reportDiagnostic: (diagnostic: TTypescript.Diagnostic) => {\n rawDiagnostics.push(diagnostic);\n },\n\n worker: undefined,\n\n pendingTranspilePromises: new Map(),\n pendingTranspileSignals: new Map()\n };\n }\n\n const { performance } = this._tool.ts;\n // Reset the performance counters to 0 to avoid contamination from previous runs\n performance.disable();\n performance.enable();\n\n if (onChangeDetected !== undefined) {\n await this._runWatchAsync(this._tool);\n } else if (this._useSolutionBuilder) {\n await this._runSolutionBuildAsync(this._tool);\n } else {\n await this._runBuildAsync(this._tool);\n }\n }\n\n public async _runWatchAsync(tool: ITypeScriptTool): Promise<void> {\n const {\n ts,\n measureSync: measureTsPerformance,\n pendingOperations,\n rawDiagnostics,\n pendingTranspilePromises\n } = tool;\n\n if (!tool.solutionBuilder && !tool.watchProgram) {\n //#region CONFIGURE\n const { duration: configureDurationMs, tsconfig } = measureTsPerformance('Configure', () => {\n const _tsconfig: TTypescript.ParsedCommandLine = loadTsconfig({\n tool,\n tsconfigPath: this._configuration.tsconfigPath,\n tsCacheFilePath: this._tsCacheFilePath\n });\n this._validateTsconfig(ts, _tsconfig);\n\n return {\n tsconfig: _tsconfig\n };\n });\n this._typescriptTerminal.writeVerboseLine(`Configure: ${configureDurationMs}ms`);\n //#endregion\n\n if (this._useSolutionBuilder) {\n const solutionHost: TWatchSolutionHost = this._buildWatchSolutionBuilderHost(tool);\n const builder: TTypescript.SolutionBuilder<TTypescript.EmitAndSemanticDiagnosticsBuilderProgram> =\n ts.createSolutionBuilderWithWatch(solutionHost, [this._configuration.tsconfigPath], {});\n\n tool.solutionBuilder = builder as IExtendedSolutionBuilder;\n\n builder.build();\n } else {\n const compilerHost: TWatchCompilerHost = this._buildWatchCompilerHost(tool, tsconfig);\n tool.watchProgram = ts.createWatchProgram(compilerHost);\n }\n }\n\n if (pendingOperations.size > 0) {\n rawDiagnostics.length = 0;\n tool.executing = true;\n for (const operation of pendingOperations) {\n pendingOperations.delete(operation);\n operation();\n }\n if (pendingTranspilePromises.size) {\n const emitResults: TTypescript.EmitResult[] = await Promise.all(pendingTranspilePromises.values());\n for (const { diagnostics } of emitResults) {\n for (const diagnostic of diagnostics) {\n rawDiagnostics.push(diagnostic);\n }\n }\n }\n // eslint-disable-next-line require-atomic-updates\n tool.executing = false;\n }\n this._logDiagnostics(ts, rawDiagnostics, this._useSolutionBuilder);\n }\n\n public async _runBuildAsync(tool: ITypeScriptTool): Promise<void> {\n const { ts, measureSync: measureTsPerformance, pendingTranspilePromises } = tool;\n\n //#region CONFIGURE\n const {\n duration: configureDurationMs,\n tsconfig,\n compilerHost\n } = measureTsPerformance('Configure', () => {\n const _tsconfig: TTypescript.ParsedCommandLine = loadTsconfig({\n tool,\n tsconfigPath: this._configuration.tsconfigPath,\n tsCacheFilePath: this._tsCacheFilePath\n });\n this._validateTsconfig(ts, _tsconfig);\n\n const _compilerHost: TTypescript.CompilerHost = this._buildIncrementalCompilerHost(tool, _tsconfig);\n\n return {\n tsconfig: _tsconfig,\n compilerHost: _compilerHost\n };\n });\n this._typescriptTerminal.writeVerboseLine(`Configure: ${configureDurationMs}ms`);\n //#endregion\n\n //#region PROGRAM\n // There will be only one program here; emit will get a bit abused if we produce multiple outputs\n let builderProgram: TTypescript.BuilderProgram | undefined = undefined;\n let innerProgram: TTypescript.Program;\n\n const isolatedModules: boolean =\n !!this._configuration.useTranspilerWorker && !!tsconfig.options.isolatedModules;\n const mode: 'both' | 'declaration' = isolatedModules ? 'declaration' : 'both';\n\n let filesToTranspile: Map<string, string> | undefined;\n\n if (tsconfig.options.incremental) {\n // Use ts.createEmitAndSemanticDiagnositcsBuilderProgram directly because the customizations performed by\n // _getCreateBuilderProgram duplicate those performed in this function for non-incremental build.\n const oldProgram: TTypescript.EmitAndSemanticDiagnosticsBuilderProgram | undefined =\n ts.readBuilderProgram(tsconfig.options, compilerHost);\n builderProgram = ts.createEmitAndSemanticDiagnosticsBuilderProgram(\n tsconfig.fileNames,\n tsconfig.options,\n compilerHost,\n oldProgram,\n ts.getConfigFileParsingDiagnostics(tsconfig),\n tsconfig.projectReferences\n );\n filesToTranspile = getFilesToTranspileFromBuilderProgram(builderProgram);\n innerProgram = builderProgram.getProgram();\n } else {\n innerProgram = ts.createProgram({\n rootNames: tsconfig.fileNames,\n options: tsconfig.options,\n projectReferences: tsconfig.projectReferences,\n host: compilerHost,\n oldProgram: undefined,\n configFileParsingDiagnostics: ts.getConfigFileParsingDiagnostics(tsconfig)\n });\n filesToTranspile = getFilesToTranspileFromProgram(innerProgram);\n }\n\n // Prefer the builder program, since it is what gives us incremental builds\n const genericProgram: TTypescript.BuilderProgram | TTypescript.Program = builderProgram || innerProgram;\n\n this._logReadPerformance(ts);\n //#endregion\n\n if (isolatedModules) {\n // Kick the transpilation worker.\n this._queueTranspileInWorker(tool, genericProgram.getCompilerOptions(), filesToTranspile);\n }\n\n //#region ANALYSIS\n const { duration: diagnosticsDurationMs, diagnostics: preDiagnostics } = measureTsPerformance(\n 'Analyze',\n () => {\n const rawDiagnostics: TTypescript.Diagnostic[] = [\n ...genericProgram.getConfigFileParsingDiagnostics(),\n ...genericProgram.getOptionsDiagnostics(),\n ...genericProgram.getSyntacticDiagnostics(),\n ...genericProgram.getGlobalDiagnostics(),\n ...genericProgram.getSemanticDiagnostics()\n ];\n return { diagnostics: rawDiagnostics };\n }\n );\n this._typescriptTerminal.writeVerboseLine(`Analyze: ${diagnosticsDurationMs}ms`);\n //#endregion\n\n //#region EMIT\n const { changedFiles } = configureProgramForMultiEmit(innerProgram, ts, this._moduleKindsToEmit, mode);\n\n const emitResult: TTypescript.EmitResult = genericProgram.emit(\n undefined,\n // The writeFile callback must be provided for the multi-emit redirector\n ts.sys.writeFile,\n undefined,\n undefined,\n undefined\n );\n\n this._cleanupWorker();\n //#endregion\n\n this._emitModulePackageJsonFiles(ts);\n this._logEmitPerformance(ts);\n\n //#region FINAL_ANALYSIS\n // Need to ensure that we include emit diagnostics, since they might not be part of the other sets\n const rawDiagnostics: TTypescript.Diagnostic[] = [...preDiagnostics, ...emitResult.diagnostics];\n //#endregion\n\n this._configuration.emitChangedFilesCallback(innerProgram, changedFiles);\n\n if (pendingTranspilePromises.size) {\n const emitResults: TTypescript.EmitResult[] = await Promise.all(pendingTranspilePromises.values());\n for (const { diagnostics } of emitResults) {\n for (const diagnostic of diagnostics) {\n rawDiagnostics.push(diagnostic);\n }\n }\n }\n\n this._logDiagnostics(ts, rawDiagnostics);\n // Reset performance counters in case any are used in the callback\n ts.performance.disable();\n ts.performance.enable();\n }\n\n public async _runSolutionBuildAsync(tool: ITypeScriptTool): Promise<void> {\n this._typescriptTerminal.writeVerboseLine(`Using solution mode`);\n\n const { ts, measureSync, rawDiagnostics, pendingTranspilePromises } = tool;\n rawDiagnostics.length = 0;\n\n if (!tool.solutionBuilder) {\n //#region CONFIGURE\n const { duration: configureDurationMs, solutionBuilderHost } = measureSync('Configure', () => {\n const _tsconfig: TTypescript.ParsedCommandLine = loadTsconfig({\n tool,\n tsconfigPath: this._configuration.tsconfigPath,\n tsCacheFilePath: this._tsCacheFilePath\n });\n this._validateTsconfig(ts, _tsconfig);\n\n const _solutionBuilderHost: TSolutionHost = this._buildSolutionBuilderHost(tool);\n\n return {\n solutionBuilderHost: _solutionBuilderHost\n };\n });\n this._typescriptTerminal.writeVerboseLine(`Configure: ${configureDurationMs}ms`);\n //#endregion\n\n tool.solutionBuilder = ts.createSolutionBuilder(\n solutionBuilderHost,\n [this._configuration.tsconfigPath],\n {}\n ) as IExtendedSolutionBuilder;\n } else {\n // Force reload everything from disk\n for (const project of tool.solutionBuilder.getBuildOrder()) {\n tool.solutionBuilder.invalidateProject(project, 1);\n }\n }\n\n //#region EMIT\n // Ignoring the exit status because we only care about presence of diagnostics\n tool.solutionBuilder.build();\n this._cleanupWorker();\n //#endregion\n\n this._emitModulePackageJsonFiles(ts);\n\n if (pendingTranspilePromises.size) {\n const emitResults: TTypescript.EmitResult[] = await Promise.all(pendingTranspilePromises.values());\n for (const { diagnostics } of emitResults) {\n for (const diagnostic of diagnostics) {\n rawDiagnostics.push(diagnostic);\n }\n }\n }\n\n this._logDiagnostics(ts, rawDiagnostics, true);\n }\n\n private _logDiagnostics(\n ts: ExtendedTypeScript,\n rawDiagnostics: TTypescript.Diagnostic[],\n isSolutionMode?: boolean\n ): void {\n const diagnostics: readonly TTypescript.Diagnostic[] = ts.sortAndDeduplicateDiagnostics(rawDiagnostics);\n\n if (diagnostics.length > 0) {\n let warningCount: number = 0;\n let hasError: boolean = false;\n\n this._typescriptTerminal.writeLine(\n `Encountered ${diagnostics.length} TypeScript issue${diagnostics.length > 1 ? 's' : ''}:`\n );\n for (const diagnostic of diagnostics) {\n const diagnosticCategory: TTypescript.DiagnosticCategory = this._getAdjustedDiagnosticCategory(\n diagnostic,\n ts\n );\n\n if (diagnosticCategory === ts.DiagnosticCategory.Warning) {\n warningCount++;\n } else if (diagnosticCategory === ts.DiagnosticCategory.Error) {\n hasError = true;\n }\n\n this._printDiagnosticMessage(ts, diagnostic, diagnosticCategory);\n }\n\n if (isSolutionMode && warningCount > 0 && !hasError) {\n this._typescriptLogger.emitError(\n new Error(\n `TypeScript encountered ${warningCount} warning${warningCount === 1 ? '' : 's'} ` +\n `and is configured to build project references. As a result, no files were emitted. Please fix the reported warnings to proceed.`\n )\n );\n }\n }\n }\n\n private _logEmitPerformance(ts: ExtendedTypeScript): void {\n this._typescriptTerminal.writeVerboseLine(`Bind: ${ts.performance.getDuration('Bind')}ms`);\n this._typescriptTerminal.writeVerboseLine(`Check: ${ts.performance.getDuration('Check')}ms`);\n this._typescriptTerminal.writeVerboseLine(\n `Transform: ${ts.performance.getDuration('transformTime')}ms ` +\n `(${ts.performance.getCount('beforeTransform')} files)`\n );\n this._typescriptTerminal.writeVerboseLine(\n `Print: ${ts.performance.getDuration('printTime')}ms ` +\n `(${ts.performance.getCount('beforePrint')} files) (Includes Transform)`\n );\n this._typescriptTerminal.writeVerboseLine(\n `Emit: ${ts.performance.getDuration('Emit')}ms (Includes Print)`\n );\n this._typescriptTerminal.writeVerboseLine(\n `I/O Write: ${ts.performance.getDuration('I/O Write')}ms (${ts.performance.getCount(\n 'beforeIOWrite'\n )} files)`\n );\n }\n\n private _logReadPerformance(ts: ExtendedTypeScript): void {\n this._typescriptTerminal.writeVerboseLine(\n `I/O Read: ${ts.performance.getDuration('I/O Read')}ms (${ts.performance.getCount(\n 'beforeIORead'\n )} files)`\n );\n this._typescriptTerminal.writeVerboseLine(\n `Parse: ${ts.performance.getDuration('Parse')}ms (${ts.performance.getCount('beforeParse')} files)`\n );\n this._typescriptTerminal.writeVerboseLine(\n `Program (includes Read + Parse): ${ts.performance.getDuration('Program')}ms`\n );\n }\n\n private _printDiagnosticMessage(\n ts: ExtendedTypeScript,\n diagnostic: TTypescript.Diagnostic,\n diagnosticCategory: TTypescript.DiagnosticCategory = this._getAdjustedDiagnosticCategory(diagnostic, ts)\n ): void {\n // Code taken from reference example\n let diagnosticMessage: string;\n let errorObject: Error;\n if (diagnostic.file) {\n const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start!);\n const message: string = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\\n');\n const formattedMessage: string = `(TS${diagnostic.code}) ${message}`;\n errorObject = new FileError(formattedMessage, {\n absolutePath: diagnostic.file.fileName,\n projectFolder: this._configuration.buildFolderPath,\n line: line + 1,\n column: character + 1\n });\n diagnosticMessage = errorObject.toString();\n } else {\n diagnosticMessage = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\\n');\n errorObject = new Error(diagnosticMessage);\n }\n\n switch (diagnosticCategory) {\n case ts.DiagnosticCategory.Error: {\n this._typescriptLogger.emitError(errorObject);\n break;\n }\n\n case ts.DiagnosticCategory.Warning: {\n this._typescriptLogger.emitWarning(errorObject);\n break;\n }\n\n default: {\n this._typescriptTerminal.writeLine(...diagnosticMessage);\n break;\n }\n }\n }\n\n private _getAdjustedDiagnosticCategory(\n diagnostic: TTypescript.Diagnostic,\n ts: ExtendedTypeScript\n ): TTypescript.DiagnosticCategory {\n // Workaround for https://github.com/microsoft/TypeScript/issues/40058\n // The compiler reports a hard error for issues such as this:\n //\n // error TS6133: 'x' is declared but its value is never read.\n //\n // These should properly be treated as warnings, because they are purely cosmetic issues.\n // TODO: Maybe heft should provide a config file for managing DiagnosticCategory mappings.\n if (diagnostic.reportsUnnecessary && diagnostic.category === ts.DiagnosticCategory.Error) {\n return ts.DiagnosticCategory.Warning;\n }\n\n // These pedantic checks also should not be treated as hard errors\n if (this._suppressedDiagnosticCodes.has(diagnostic.code)) {\n return ts.DiagnosticCategory.Warning;\n }\n\n return diagnostic.category;\n }\n\n private _validateTsconfig(ts: ExtendedTypeScript, tsconfig: TTypescript.ParsedCommandLine): void {\n if (\n (tsconfig.options.module && !tsconfig.options.outDir) ||\n (!tsconfig.options.module && tsconfig.options.outDir)\n ) {\n throw new Error(\n 'If either the module or the outDir option is provided in the tsconfig compilerOptions, both must be provided'\n );\n }\n\n this._moduleKindsToEmit = [];\n const specifiedKinds: Map<TTypescript.ModuleKind, IModuleKindReason> = new Map();\n const specifiedOutDirs: Map<string, IModuleKindReason> = new Map();\n\n if (!tsconfig.options.module) {\n throw new Error(\n 'If the module tsconfig compilerOption is not provided, the builder must be provided with the ' +\n 'additionalModuleKindsToEmit configuration option.'\n );\n }\n\n if (this._configuration.emitCjsExtensionForCommonJS) {\n this._addModuleKindToEmit(\n ts.ModuleKind.CommonJS,\n tsconfig.options.outDir!,\n /* isPrimary */ tsconfig.options.module === ts.ModuleKind.CommonJS,\n '.cjs',\n /* emitModulePackageJson */ false\n );\n\n const cjsReason: IModuleKindReason = {\n outDir: tsconfig.options.outDir!,\n kind: 'CommonJS',\n extension: '.cjs',\n reason: 'emitCjsExtensionForCommonJS'\n };\n\n specifiedKinds.set(ts.ModuleKind.CommonJS, cjsReason);\n specifiedOutDirs.set(`${tsconfig.options.outDir!}:.cjs`, cjsReason);\n }\n\n if (this._configuration.emitMjsExtensionForESModule) {\n this._addModuleKindToEmit(\n ts.ModuleKind.ESNext,\n tsconfig.options.outDir!,\n /* isPrimary */ tsconfig.options.module === ts.ModuleKind.ESNext,\n '.mjs',\n /* emitModulePackageJson */ false\n );\n\n const mjsReason: IModuleKindReason = {\n outDir: tsconfig.options.outDir!,\n kind: 'ESNext',\n extension: '.mjs',\n reason: 'emitMjsExtensionForESModule'\n };\n\n specifiedKinds.set(ts.ModuleKind.ESNext, mjsReason);\n specifiedOutDirs.set(`${tsconfig.options.outDir!}:.mjs`, mjsReason);\n }\n\n if (!specifiedKinds.has(tsconfig.options.module)) {\n this._addModuleKindToEmit(\n tsconfig.options.module,\n tsconfig.options.outDir!,\n /* isPrimary */ true,\n /* jsExtensionOverride */ undefined,\n /* emitModulePackageJson */ false\n );\n\n const tsConfigReason: IModuleKindReason = {\n outDir: tsconfig.options.outDir!,\n kind: ts.ModuleKind[tsconfig.options.module] as keyof typeof TTypescript.ModuleKind,\n extension: '.js',\n reason: 'tsconfig.json'\n };\n\n specifiedKinds.set(tsconfig.options.module, tsConfigReason);\n specifiedOutDirs.set(`${tsconfig.options.outDir!}:.js`, tsConfigReason);\n }\n\n if (this._configuration.additionalModuleKindsToEmit) {\n for (const { moduleKind: moduleKindString, outFolderName, emitModulePackageJson = false } of this\n ._configuration.additionalModuleKindsToEmit) {\n const moduleKind: TTypescript.ModuleKind = this._parseModuleKind(ts, moduleKindString);\n\n const outDirKey: string = `${outFolderName}:.js`;\n const moduleKindReason: IModuleKindReason = {\n kind: ts.ModuleKind[moduleKind] as keyof typeof TTypescript.ModuleKind,\n outDir: outFolderName,\n extension: '.js',\n reason: `additionalModuleKindsToEmit`\n };\n\n const existingKind: IModuleKindReason | undefined = specifiedKinds.get(moduleKind);\n const existingDir: IModuleKindReason | undefined = specifiedOutDirs.get(outDirKey);\n\n if (existingKind) {\n throw new Error(\n `Module kind \"${moduleKind}\" is already emitted at ${existingKind.outDir} with extension '${existingKind.extension}' by option ${existingKind.reason}.`\n );\n } else if (existingDir) {\n throw new Error(\n `Output folder \"${outFolderName}\" already contains module kind ${existingDir.kind} with extension '${existingDir.extension}', specified by option ${existingDir.reason}.`\n );\n } else {\n const outFolderKey: string | undefined = this._addModuleKindToEmit(\n moduleKind,\n outFolderName,\n /* isPrimary */ false,\n undefined,\n emitModulePackageJson\n );\n\n if (outFolderKey) {\n specifiedKinds.set(moduleKind, moduleKindReason);\n specifiedOutDirs.set(outFolderKey, moduleKindReason);\n }\n }\n }\n }\n }\n\n private _addModuleKindToEmit(\n moduleKind: TTypescript.ModuleKind,\n outFolderPath: string,\n isPrimary: boolean,\n jsExtensionOverride: string | undefined,\n emitModulePackageJson: boolean\n ): string | undefined {\n let outFolderName: string;\n if (path.isAbsolute(outFolderPath)) {\n outFolderName = path.relative(this._configuration.buildFolderPath, outFolderPath);\n } else {\n outFolderName = outFolderPath;\n outFolderPath = path.resolve(this._configuration.buildFolderPath, outFolderPath);\n }\n\n outFolderPath = Path.convertToSlashes(outFolderPath);\n outFolderPath = outFolderPath.replace(/\\/*$/, '/'); // Ensure the outFolderPath ends with a slash\n\n for (const existingModuleKindToEmit of this._moduleKindsToEmit) {\n let errorText: string | undefined;\n\n if (existingModuleKindToEmit.outFolderPath === outFolderPath) {\n if (existingModuleKindToEmit.jsExtensionOverride === jsExtensionOverride) {\n errorText =\n 'Unable to output two different module kinds with the same ' +\n `module extension (${jsExtensionOverride || '.js'}) to the same ` +\n `folder (\"${outFolderPath}\").`;\n }\n } else {\n let parentFolder: string | undefined;\n let childFolder: string | undefined;\n if (outFolderPath.startsWith(existingModuleKindToEmit.outFolderPath)) {\n parentFolder = outFolderPath;\n childFolder = existingModuleKindToEmit.outFolderPath;\n } else if (existingModuleKindToEmit.outFolderPath.startsWith(outFolderPath)) {\n parentFolder = existingModuleKindToEmit.outFolderPath;\n childFolder = outFolderPath;\n }\n\n if (parentFolder) {\n errorText =\n 'Unable to output two different module kinds to nested folders ' +\n `(\"${parentFolder}\" and \"${childFolder}\").`;\n }\n }\n\n if (errorText) {\n this._typescriptLogger.emitError(new Error(errorText));\n return undefined;\n }\n }\n\n this._moduleKindsToEmit.push({\n outFolderPath,\n moduleKind,\n jsExtensionOverride,\n isPrimary,\n emitModulePackageJson\n });\n\n return `${outFolderName}:${jsExtensionOverride || '.js'}`;\n }\n\n private _getCreateBuilderProgram(\n ts: ExtendedTypeScript\n ): TTypescript.CreateProgram<TTypescript.EmitAndSemanticDiagnosticsBuilderProgram> {\n const {\n _configuration: { emitChangedFilesCallback }\n } = this;\n\n const createMultiEmitBuilderProgram: TTypescript.CreateProgram<\n TTypescript.EmitAndSemanticDiagnosticsBuilderProgram\n > = (\n fileNames: readonly string[] | undefined,\n compilerOptions: TTypescript.CompilerOptions | undefined,\n host: TTypescript.CompilerHost | undefined,\n oldProgram: TTypescript.EmitAndSemanticDiagnosticsBuilderProgram | undefined,\n configFileParsingDiagnostics: readonly TTypescript.Diagnostic[] | undefined,\n projectReferences: readonly TTypescript.ProjectReference[] | undefined\n ): TTypescript.EmitAndSemanticDiagnosticsBuilderProgram => {\n // Reset performance counters\n ts.performance.disable();\n ts.performance.enable();\n\n this._typescriptTerminal.writeVerboseLine(`Reading program \"${compilerOptions!.configFilePath}\"`);\n\n const newProgram: TTypescript.EmitAndSemanticDiagnosticsBuilderProgram =\n ts.createEmitAndSemanticDiagnosticsBuilderProgram(\n fileNames,\n compilerOptions,\n host,\n oldProgram,\n configFileParsingDiagnostics,\n projectReferences\n );\n\n this._logReadPerformance(ts);\n\n const isolatedModules: boolean =\n !!this._configuration.useTranspilerWorker && !!compilerOptions!.isolatedModules;\n const mode: 'both' | 'declaration' = isolatedModules ? 'declaration' : 'both';\n\n if (isolatedModules) {\n // Kick the transpilation worker.\n const filesToTranspile: Map<string, string> = getFilesToTranspileFromBuilderProgram(newProgram);\n this._queueTranspileInWorker(this._tool!, compilerOptions!, filesToTranspile);\n }\n\n const { emit: originalEmit } = newProgram;\n\n const emit: TTypescript.Program['emit'] = (\n outerTargetSourceFile?: TTypescript.SourceFile,\n outerWriteFile?: TTypescript.WriteFileCallback,\n outerCancellationToken?: TTypescript.CancellationToken,\n outerEmitOnlyDtsFiles?: boolean,\n outerCustomTransformers?: TTypescript.CustomTransformers\n ) => {\n const innerProgram: TTypescript.Program = newProgram.getProgram();\n\n const innerCompilerOptions: TTypescript.CompilerOptions = innerProgram.getCompilerOptions();\n\n const { changedFiles } = configureProgramForMultiEmit(\n innerProgram,\n ts,\n this._moduleKindsToEmit,\n mode\n );\n\n const result: TTypescript.EmitResult = originalEmit.call(\n newProgram,\n outerTargetSourceFile,\n outerWriteFile,\n outerCancellationToken,\n outerEmitOnlyDtsFiles,\n outerCustomTransformers\n );\n\n (result as IExtendedEmitResult).changedSourceFiles = changedFiles;\n\n this._typescriptTerminal.writeVerboseLine(\n `Emitting program \"${innerCompilerOptions!.configFilePath}\"`\n );\n\n this._emitModulePackageJsonFiles(ts);\n this._logEmitPerformance(ts);\n\n // Reset performance counters\n ts.performance.disable();\n ts.performance.enable();\n\n emitChangedFilesCallback(innerProgram, changedFiles);\n\n return result;\n };\n\n newProgram.emit = emit;\n\n return newProgram;\n };\n\n return createMultiEmitBuilderProgram;\n }\n\n private _buildSolutionBuilderHost(tool: ITypeScriptTool): TSolutionHost {\n const reportSolutionBuilderStatus: TTypescript.DiagnosticReporter = tool.reportDiagnostic;\n const reportEmitErrorSummary: TTypescript.ReportEmitErrorSummary = (errorCount: number): void => {\n // Do nothing\n };\n\n const { ts, system } = tool;\n\n const solutionBuilderHost: TTypescript.SolutionBuilderHost<TTypescript.EmitAndSemanticDiagnosticsBuilderProgram> =\n ts.createSolutionBuilderHost(\n system,\n this._getCreateBuilderProgram(ts),\n tool.reportDiagnostic,\n reportSolutionBuilderStatus,\n reportEmitErrorSummary\n );\n\n solutionBuilderHost.afterProgramEmitAndDiagnostics = (\n program: TTypescript.EmitAndSemanticDiagnosticsBuilderProgram\n ) => {\n // Use the native metric since we aren't overwriting the writer\n this._typescriptTerminal.writeVerboseLine(\n `I/O Write: ${ts.performance.getDuration('I/O Write')}ms (${ts.performance.getCount(\n 'beforeIOWrite'\n )} files)`\n );\n };\n\n return solutionBuilderHost;\n }\n\n private _buildIncrementalCompilerHost(\n tool: ITypeScriptTool,\n tsconfig: TTypescript.ParsedCommandLine\n ): TTypescript.CompilerHost {\n const { ts, system } = tool;\n\n let compilerHost: TTypescript.CompilerHost | undefined;\n\n if (tsconfig.options.incremental) {\n compilerHost = ts.createIncrementalCompilerHost(tsconfig.options, system);\n } else {\n compilerHost = (ts.createCompilerHostWorker ?? ts.createCompilerHost)(\n tsconfig.options,\n undefined,\n system\n );\n }\n\n this._changeCompilerHostToUseCache(compilerHost, tool);\n\n return compilerHost;\n }\n\n private _buildWatchCompilerHost(\n tool: ITypeScriptTool,\n tsconfig: TTypescript.ParsedCommandLine\n ): TWatchCompilerHost {\n const { ts, system } = tool;\n\n const reportWatchStatus: TTypescript.DiagnosticReporter = (diagnostic: TTypescript.Diagnostic): void => {\n this._printDiagnosticMessage(ts, diagnostic);\n };\n\n const compilerHost: TWatchCompilerHost = ts.createWatchCompilerHost(\n tsconfig.fileNames,\n tsconfig.options,\n system,\n this._getCreateBuilderProgram(ts),\n tool.reportDiagnostic,\n reportWatchStatus,\n tsconfig.projectReferences,\n tsconfig.watchOptions\n );\n\n return compilerHost;\n }\n\n private _changeCompilerHostToUseCache(compilerHost: TTypescript.CompilerHost, tool: ITypeScriptTool): void {\n const { sourceFileCache } = tool;\n\n const { getSourceFile: innerGetSourceFile } = compilerHost;\n if ((innerGetSourceFile as { cache?: typeof sourceFileCache }).cache === sourceFileCache) {\n return;\n }\n\n compilerHost.getCurrentDirectory = () => this._configuration.buildFolderPath;\n\n // Enable source file persistence\n const getSourceFile: typeof innerGetSourceFile & {\n cache?: typeof sourceFileCache;\n } = (\n fileName: string,\n languageVersionOrOptions: TTypescript.ScriptTarget | TTypescript.CreateSourceFileOptions,\n onError?: ((message: string) => void) | undefined,\n shouldCreateNewSourceFile?: boolean | undefined\n ): TTypescript.SourceFile | undefined => {\n if (!shouldCreateNewSourceFile) {\n const cachedSourceFile: TTypescript.SourceFile | undefined = sourceFileCache.get(fileName);\n if (cachedSourceFile) {\n return cachedSourceFile;\n }\n }\n\n const result: TTypescript.SourceFile | undefined = innerGetSourceFile(\n fileName,\n languageVersionOrOptions,\n onError,\n shouldCreateNewSourceFile\n );\n if (result) {\n sourceFileCache.set(fileName, result);\n } else {\n sourceFileCache.delete(fileName);\n }\n return result;\n };\n\n getSourceFile.cache = sourceFileCache;\n\n compilerHost.getSourceFile = getSourceFile;\n }\n\n private _buildWatchSolutionBuilderHost(tool: ITypeScriptTool): TWatchSolutionHost {\n const { reportDiagnostic, ts, system } = tool;\n\n const host: TWatchSolutionHost = ts.createSolutionBuilderWithWatchHost(\n system,\n this._getCreateBuilderProgram(ts),\n reportDiagnostic,\n reportDiagnostic,\n reportDiagnostic\n );\n\n return host;\n }\n\n /**\n * For each module kind configured with `emitModulePackageJson: true`, writes a\n * `package.json` with the appropriate `\"type\"` field to ensure Node.js correctly\n * interprets `.js` files in the output folder.\n */\n private _emitModulePackageJsonFiles(ts: ExtendedTypeScript): void {\n for (const { emitModulePackageJson, moduleKind, outFolderPath } of this._moduleKindsToEmit) {\n if (!emitModulePackageJson) {\n continue;\n }\n\n // \"module\" and \"commonjs\" are the only recognized values. See\n // https://nodejs.org/api/packages.html#type\n let moduleType: string | undefined;\n switch (moduleKind) {\n // UMD contains a CommonJS wrapper, so it should be treated as CommonJS for package.json generation purposes\n case ts.ModuleKind.UMD:\n case ts.ModuleKind.CommonJS: {\n moduleType = 'commonjs';\n break;\n }\n\n case ts.ModuleKind.AMD:\n case ts.ModuleKind.None:\n case ts.ModuleKind.Preserve:\n case ts.ModuleKind.System: {\n moduleType = undefined;\n break;\n }\n\n default: {\n moduleType = 'module';\n break;\n }\n }\n\n if (moduleType) {\n const packageJsonPath: string = `${outFolderPath}package.json`;\n const packageJsonContent: string = `{\\n \"type\": \"${moduleType}\"\\n}\\n`;\n\n ts.sys.writeFile(packageJsonPath, packageJsonContent);\n this._typescriptTerminal.writeVerboseLine(`Wrote ${packageJsonPath} with \"type\": \"${moduleType}\"`);\n } else {\n throw new Error(\n `Unsupported module kind ${ts.ModuleKind[moduleKind]} for package.json generation. ` +\n `Remove the \\`emitModulePackageJson\\` option for this module kind.`\n );\n }\n }\n }\n\n private _parseModuleKind(ts: ExtendedTypeScript, moduleKindName: string): TTypescript.ModuleKind {\n switch (moduleKindName.toLowerCase()) {\n case 'commonjs':\n return ts.ModuleKind.CommonJS;\n\n case 'amd':\n return ts.ModuleKind.AMD;\n\n case 'umd':\n return ts.ModuleKind.UMD;\n\n case 'system':\n return ts.ModuleKind.System;\n\n case 'es2015':\n return ts.ModuleKind.ES2015;\n\n case 'esnext':\n return ts.ModuleKind.ESNext;\n\n default:\n throw new Error(`\"${moduleKindName}\" is not a valid module kind name.`);\n }\n }\n\n private _queueTranspileInWorker(\n tool: ITypeScriptTool,\n compilerOptions: TTypescript.CompilerOptions,\n filesToTranspile: Map<string, string>\n ): void {\n const { typeScriptToolPath, pendingTranspilePromises, pendingTranspileSignals } = tool;\n let maybeWorker: Worker | undefined = tool.worker;\n if (!maybeWorker) {\n const workerData: ITypescriptWorkerData = {\n typeScriptToolPath\n };\n tool.worker = maybeWorker = new Worker(require.resolve('./TranspilerWorker.js'), {\n workerData: workerData\n });\n\n maybeWorker.on('message', (response: ITranspilationResponseMessage) => {\n const { requestId: resolvingRequestId, type, result } = response;\n const signal: ITranspileSignal | undefined = pendingTranspileSignals.get(resolvingRequestId);\n\n if (type === 'error') {\n const error: Error = Object.assign(new Error(result.message), result);\n if (signal) {\n signal.reject(error);\n } else {\n this._typescriptTerminal.writeErrorLine(\n `Unexpected worker rejection for request with id ${resolvingRequestId}: ${error}`\n );\n }\n } else if (signal) {\n signal.resolve(result);\n } else {\n this._typescriptTerminal.writeErrorLine(\n `Unexpected worker resolution for request with id ${resolvingRequestId}`\n );\n }\n\n pendingTranspileSignals.delete(resolvingRequestId);\n pendingTranspilePromises.delete(resolvingRequestId);\n });\n\n maybeWorker.once('exit', (exitCode: number) => {\n if (pendingTranspileSignals.size) {\n const error: Error = new Error(`Worker exited unexpectedly with code ${exitCode}.`);\n for (const { reject: rejectTranspile } of pendingTranspileSignals.values()) {\n rejectTranspile(error);\n }\n pendingTranspileSignals.clear();\n }\n });\n\n maybeWorker.once('error', (err: Error) => {\n for (const { reject: rejectTranspile } of pendingTranspileSignals.values()) {\n rejectTranspile(err);\n }\n pendingTranspileSignals.clear();\n });\n }\n\n // make linter happy\n const worker: Worker = maybeWorker;\n\n const requestId: number = ++this._nextRequestId;\n const transpilePromise: Promise<TTypescript.EmitResult> = new Promise(\n (resolve: (result: TTypescript.EmitResult) => void, reject: (err: Error) => void) => {\n pendingTranspileSignals.set(requestId, { resolve, reject });\n\n this._typescriptTerminal.writeLine(`Asynchronously transpiling ${compilerOptions.configFilePath}`);\n const request: ITranspilationRequestMessage = {\n compilerOptions,\n filesToTranspile,\n moduleKindsToEmit: this._moduleKindsToEmit,\n requestId\n };\n\n worker.postMessage(request);\n }\n );\n\n pendingTranspilePromises.set(requestId, transpilePromise);\n }\n\n private _cleanupWorker(): void {\n const tool: ITypeScriptTool | undefined = this._tool;\n if (!tool) {\n return;\n }\n\n const { worker } = tool;\n if (worker) {\n worker.postMessage(false);\n tool.worker = undefined;\n }\n }\n}\n\nfunction getFilesToTranspileFromBuilderProgram(\n builderProgram: TTypescript.BuilderProgram\n): Map<string, string> {\n const program: ExtendedBuilderProgram = builderProgram as unknown as ExtendedBuilderProgram;\n // getState was removed in Typescript 5.6, replaced with state\n const changedFilesSet: Set<string> = (program.state ?? program.getState()).changedFilesSet;\n\n const filesToTranspile: Map<string, string> = new Map();\n for (const fileName of changedFilesSet) {\n const sourceFile: TTypescript.SourceFile | undefined = builderProgram.getSourceFile(fileName);\n if (sourceFile && !sourceFile.isDeclarationFile) {\n filesToTranspile.set(sourceFile.fileName, sourceFile.text);\n }\n }\n return filesToTranspile;\n}\n\nfunction getFilesToTranspileFromProgram(program: TTypescript.Program): Map<string, string> {\n const filesToTranspile: Map<string, string> = new Map();\n for (const sourceFile of program.getSourceFiles()) {\n if (!sourceFile.isDeclarationFile) {\n filesToTranspile.set(sourceFile.fileName, sourceFile.text);\n }\n }\n return filesToTranspile;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":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,CAAC,CAAC;QAE1E,MAAM,mBAAmB,GAAiC,MAAM,4BAA4B,CAC1F,iBAAiB,EACjB,QAAQ,EACR,2BAA2B,CAC5B,CAAC;QAEF,OAAO;YACL,2BAA2B;YAC3B,mBAAmB;SACpB,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'node:path';\n\nimport type * as TTypescript from 'typescript';\nimport { SyncHook } from 'tapable';\n\nimport { FileSystem } from '@rushstack/node-core-library';\nimport type { ITerminal } from '@rushstack/terminal';\nimport { ProjectConfigurationFile, InheritanceType, PathResolutionMethod } from '@rushstack/heft-config-file';\nimport type {\n HeftConfiguration,\n IHeftTaskSession,\n IHeftTaskPlugin,\n IHeftTaskRunHookOptions,\n IHeftTaskRunIncrementalHookOptions,\n ICopyOperation,\n IHeftTaskFileOperations,\n ConfigurationFile\n} from '@rushstack/heft';\n\nimport { TypeScriptBuilder, type ITypeScriptBuilderConfiguration } from './TypeScriptBuilder';\nimport anythingSchema from './schemas/anything.schema.json';\nimport typescriptConfigSchema from './schemas/typescript.schema.json';\nimport { getTsconfigFilePath } from './tsconfigLoader';\n\n/**\n * The name of the plugin, as specified in heft-plugin.json\n *\n * @public\n */\nexport const PLUGIN_NAME: 'typescript-plugin' = 'typescript-plugin';\n\n/**\n * The ${configDir} token supported in TypeScript 5.5\n * @see {@link https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-5.html#the-configdir-template-variable-for-configuration-files}\n */\nconst CONFIG_DIR_TOKEN: '${configDir}' = '${configDir}';\n\n/**\n * @beta\n */\nexport interface IEmitModuleKind {\n moduleKind: 'commonjs' | 'amd' | 'umd' | 'system' | 'es2015' | 'esnext';\n outFolderName: string;\n jsExtensionOverride?: string;\n}\n\n/**\n * @beta\n */\nexport interface IStaticAssetsCopyConfiguration {\n fileExtensions: string[];\n excludeGlobs: string[];\n includeGlobs: string[];\n}\n\n/**\n * @beta\n */\nexport interface ITypeScriptConfigurationJson {\n /**\n * If provided, emit these module kinds in addition to the modules specified in the tsconfig.\n * Note that this option only applies to the main tsconfig.json configuration.\n */\n additionalModuleKindsToEmit?: IEmitModuleKind[] | undefined;\n\n /**\n * If 'true', emit CommonJS output into the TSConfig outDir with the file extension '.cjs'\n */\n emitCjsExtensionForCommonJS?: boolean | undefined;\n\n /**\n * If 'true', emit ESModule output into the TSConfig outDir with the file extension '.mjs'\n */\n emitMjsExtensionForESModule?: boolean | undefined;\n\n /**\n * If true, enable behavior analogous to the \"tsc --build\" command. Will build projects referenced by the main project in dependency order.\n * Note that this will effectively enable \\\"noEmitOnError\\\".\n */\n buildProjectReferences?: boolean;\n\n /**\n * If true, and the tsconfig has \\\"isolatedModules\\\": true, then transpilation will happen in parallel in a worker thread.\n */\n useTranspilerWorker?: boolean;\n\n /**\n * If true, the TypeScript compiler will only resolve symlinks to their targets if the links are in a node_modules folder.\n * This significantly reduces file system operations in typical usage.\n */\n onlyResolveSymlinksInNodeModules?: boolean;\n\n /*\n * Specifies the tsconfig.json file that will be used for compilation. Equivalent to the \"project\" argument for the 'tsc' and 'tslint' command line tools.\n *\n * The default value is \"./tsconfig.json\"\n */\n project?: string;\n\n /**\n * Configures additional file types that should be copied into the TypeScript compiler's emit folders, for example\n * so that these files can be resolved by import statements.\n */\n staticAssetsToCopy?: IStaticAssetsCopyConfiguration;\n}\n\n/**\n * @beta\n */\nexport interface IPartialTsconfigCompilerOptions {\n outDir?: string;\n}\n\n/**\n * @beta\n */\nexport interface IPartialTsconfig {\n compilerOptions?: IPartialTsconfigCompilerOptions;\n}\n\n/**\n * @beta\n */\nexport interface IChangedFilesHookOptions {\n program: TTypescript.Program;\n changedFiles?: ReadonlySet<TTypescript.SourceFile>;\n}\n\n/**\n * @beta\n */\nexport interface ITypeScriptPluginAccessor {\n readonly onChangedFilesHook: SyncHook<IChangedFilesHookOptions>;\n}\n\nconst TYPESCRIPT_LOADER_CONFIG: ConfigurationFile.IProjectConfigurationFileSpecification<ITypeScriptConfigurationJson> =\n {\n projectRelativeFilePath: 'config/typescript.json',\n jsonSchemaObject: typescriptConfigSchema,\n propertyInheritance: {\n staticAssetsToCopy: {\n // When merging objects, arrays will be automatically appended\n inheritanceType: InheritanceType.merge\n }\n },\n jsonPathMetadata: {\n '$.additionalModuleKindsToEmit.*.outFolderName': {\n pathResolutionMethod: PathResolutionMethod.resolvePathRelativeToProjectRoot\n }\n }\n };\n\n/**\n * @beta\n */\nexport async function loadTypeScriptConfigurationFileAsync(\n heftConfiguration: HeftConfiguration,\n terminal: ITerminal\n): Promise<ITypeScriptConfigurationJson | undefined> {\n return await heftConfiguration.tryLoadProjectConfigurationFileAsync<ITypeScriptConfigurationJson>(\n TYPESCRIPT_LOADER_CONFIG,\n terminal\n );\n}\n\nlet _partialTsconfigFileLoader: ProjectConfigurationFile<IPartialTsconfig> | undefined;\nconst _partialTsconfigFilePromiseCache: Map<string, Promise<IPartialTsconfig | undefined>> = new Map();\n\n/**\n * @beta\n */\nexport async function loadPartialTsconfigFileAsync(\n heftConfiguration: HeftConfiguration,\n terminal: ITerminal,\n typeScriptConfigurationJson: ITypeScriptConfigurationJson | undefined\n): Promise<IPartialTsconfig | undefined> {\n const buildFolderPath: string = heftConfiguration.buildFolderPath;\n\n // Check the cache first\n let partialTsconfigFilePromise: Promise<IPartialTsconfig | undefined> | undefined =\n _partialTsconfigFilePromiseCache.get(buildFolderPath);\n\n if (!partialTsconfigFilePromise) {\n // We don't want to load the tsconfig.json file through the rig, but we do want to take\n // advantage of the extends functionality that ConfigurationFile provides. So we'll\n // check to see if the file exists and exit early if not.\n\n const tsconfigFilePath: string = getTsconfigFilePath(\n heftConfiguration,\n typeScriptConfigurationJson?.project\n );\n terminal.writeVerboseLine(`Looking for tsconfig at ${tsconfigFilePath}`);\n const tsconfigExists: boolean = await FileSystem.existsAsync(tsconfigFilePath);\n if (!tsconfigExists) {\n partialTsconfigFilePromise = Promise.resolve(undefined);\n } else {\n // Ensure that the file loader has been initialized.\n if (!_partialTsconfigFileLoader) {\n _partialTsconfigFileLoader = new ProjectConfigurationFile<IPartialTsconfig>({\n projectRelativeFilePath: typeScriptConfigurationJson?.project || 'tsconfig.json',\n jsonSchemaObject: anythingSchema,\n propertyInheritance: {\n compilerOptions: {\n inheritanceType: InheritanceType.merge\n }\n },\n jsonPathMetadata: {\n '$.compilerOptions.outDir': {\n pathResolutionMethod: PathResolutionMethod.custom,\n customResolver(\n resolverOptions: ConfigurationFile.IJsonPathMetadataResolverOptions<IPartialTsconfig>\n ): string {\n if (resolverOptions.propertyValue.includes(CONFIG_DIR_TOKEN)) {\n // Typescript 5.5. introduced the `${configDir}` token to refer to the directory containing the root tsconfig\n const configDir: string = path.dirname(tsconfigFilePath);\n // The token is an absolute path, so it should occur at most once.\n return path.resolve(resolverOptions.propertyValue.replace(CONFIG_DIR_TOKEN, configDir));\n } else {\n const thisConfigDir: string = path.dirname(resolverOptions.configurationFilePath);\n return path.resolve(thisConfigDir, resolverOptions.propertyValue);\n }\n }\n }\n }\n });\n }\n\n partialTsconfigFilePromise = _partialTsconfigFileLoader.loadConfigurationFileForProjectAsync(\n terminal,\n buildFolderPath,\n heftConfiguration.rigConfig\n );\n }\n _partialTsconfigFilePromiseCache.set(buildFolderPath, partialTsconfigFilePromise);\n }\n\n return await partialTsconfigFilePromise;\n}\n\ninterface ITypeScriptConfigurationJsonAndPartialTsconfigFile {\n typeScriptConfigurationJson: ITypeScriptConfigurationJson | undefined;\n partialTsconfigFile: IPartialTsconfig | undefined;\n}\n\nexport default class TypeScriptPlugin implements IHeftTaskPlugin {\n public accessor: ITypeScriptPluginAccessor = {\n onChangedFilesHook: new SyncHook<IChangedFilesHookOptions>(['changedFilesHookOptions'])\n };\n\n public apply(taskSession: IHeftTaskSession, heftConfiguration: HeftConfiguration): void {\n taskSession.hooks.registerFileOperations.tapPromise(\n PLUGIN_NAME,\n async (fileOperations: IHeftTaskFileOperations): Promise<IHeftTaskFileOperations> => {\n // TODO: We should consider maybe only doing one copy of static assets and pointing\n // all source files to this set of static assets. This would allow us to avoid\n // having to copy the static assets multiple times, increasing build times and\n // package size.\n for (const copyOperation of await this._getStaticAssetCopyOperationsAsync(\n taskSession,\n heftConfiguration\n )) {\n fileOperations.copyOperations.add(copyOperation);\n }\n\n return fileOperations;\n }\n );\n\n taskSession.hooks.run.tapPromise(PLUGIN_NAME, async (runOptions: IHeftTaskRunHookOptions) => {\n const builder: TypeScriptBuilder | false = await this._getTypeScriptBuilderAsync(\n taskSession,\n heftConfiguration\n );\n if (builder) {\n await builder.invokeAsync();\n }\n });\n\n let incrementalBuilder: TypeScriptBuilder | undefined | false;\n taskSession.hooks.runIncremental.tapPromise(\n PLUGIN_NAME,\n async (runIncrementalOptions: IHeftTaskRunIncrementalHookOptions) => {\n if (incrementalBuilder === undefined) {\n // eslint-disable-next-line require-atomic-updates\n incrementalBuilder = await this._getTypeScriptBuilderAsync(taskSession, heftConfiguration);\n }\n\n if (incrementalBuilder) {\n await incrementalBuilder.invokeAsync(runIncrementalOptions.requestRun);\n }\n }\n );\n }\n\n private async _getStaticAssetCopyOperationsAsync(\n taskSession: IHeftTaskSession,\n heftConfiguration: HeftConfiguration\n ): Promise<ICopyOperation[]> {\n const { typeScriptConfigurationJson, partialTsconfigFile } = await this._loadConfigAsync(\n taskSession,\n heftConfiguration\n );\n\n // We only care about the copy if static assets were specified.\n const copyOperations: ICopyOperation[] = [];\n const staticAssetsConfig: IStaticAssetsCopyConfiguration | undefined =\n typeScriptConfigurationJson?.staticAssetsToCopy;\n if (\n staticAssetsConfig &&\n (staticAssetsConfig.fileExtensions?.length ||\n staticAssetsConfig.includeGlobs?.length ||\n staticAssetsConfig.excludeGlobs?.length)\n ) {\n const destinationFolderPaths: Set<string> = new Set<string>();\n\n // Add the output folder and all additional module kind output folders as destinations\n const tsconfigOutDir: string | undefined = partialTsconfigFile?.compilerOptions?.outDir;\n if (tsconfigOutDir) {\n destinationFolderPaths.add(tsconfigOutDir);\n }\n\n for (const emitModule of typeScriptConfigurationJson?.additionalModuleKindsToEmit || []) {\n destinationFolderPaths.add(emitModule.outFolderName);\n }\n\n copyOperations.push({\n ...staticAssetsConfig,\n\n // For now - these may need to be revised later\n sourcePath: path.resolve(heftConfiguration.buildFolderPath, 'src'),\n destinationFolders: Array.from(destinationFolderPaths),\n flatten: false,\n hardlink: false\n });\n }\n\n return copyOperations;\n }\n\n private async _getTypeScriptBuilderAsync(\n taskSession: IHeftTaskSession,\n heftConfiguration: HeftConfiguration\n ): Promise<TypeScriptBuilder | false> {\n const { typeScriptConfigurationJson, partialTsconfigFile } = await this._loadConfigAsync(\n taskSession,\n heftConfiguration\n );\n\n if (!partialTsconfigFile) {\n // There is no tsconfig file, we can exit early\n // This check may need watch mode to break on tsconfig addition/deletion\n return false;\n }\n\n // Build out the configuration\n const typeScriptBuilderConfiguration: ITypeScriptBuilderConfiguration = {\n buildFolderPath: heftConfiguration.buildFolderPath,\n // Build metadata is just another build output, but we put it in the temp folder because it will\n // usually be discarded when published.\n buildMetadataFolderPath: taskSession.tempFolderPath,\n heftConfiguration,\n\n buildProjectReferences: typeScriptConfigurationJson?.buildProjectReferences,\n\n useTranspilerWorker: typeScriptConfigurationJson?.useTranspilerWorker,\n\n onlyResolveSymlinksInNodeModules: typeScriptConfigurationJson?.onlyResolveSymlinksInNodeModules,\n\n tsconfigPath: getTsconfigFilePath(heftConfiguration, typeScriptConfigurationJson?.project),\n additionalModuleKindsToEmit: typeScriptConfigurationJson?.additionalModuleKindsToEmit,\n emitCjsExtensionForCommonJS: !!typeScriptConfigurationJson?.emitCjsExtensionForCommonJS,\n emitMjsExtensionForESModule: !!typeScriptConfigurationJson?.emitMjsExtensionForESModule,\n scopedLogger: taskSession.logger,\n emitChangedFilesCallback: (\n program: TTypescript.Program,\n changedFiles?: Set<TTypescript.SourceFile>\n ) => {\n // Provide the typescript program dependent plugins\n if (this.accessor.onChangedFilesHook.isUsed()) {\n this.accessor.onChangedFilesHook.call({ program, changedFiles });\n }\n }\n };\n\n // Run the builder\n const typeScriptBuilder: TypeScriptBuilder = new TypeScriptBuilder(typeScriptBuilderConfiguration);\n return typeScriptBuilder;\n }\n\n private async _loadConfigAsync(\n taskSession: IHeftTaskSession,\n heftConfiguration: HeftConfiguration\n ): Promise<ITypeScriptConfigurationJsonAndPartialTsconfigFile> {\n const terminal: ITerminal = taskSession.logger.terminal;\n\n const typeScriptConfigurationJson: ITypeScriptConfigurationJson | undefined =\n await loadTypeScriptConfigurationFileAsync(heftConfiguration, terminal);\n\n const partialTsconfigFile: IPartialTsconfig | undefined = await loadPartialTsconfigFileAsync(\n heftConfiguration,\n terminal,\n typeScriptConfigurationJson\n );\n\n return {\n typeScriptConfigurationJson,\n partialTsconfigFile\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TypeScriptPlugin.js","sourceRoot":"","sources":["../src/TypeScriptPlugin.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAY9G,OAAO,EAAE,iBAAiB,EAAwC,MAAM,qBAAqB,CAAC;AAC9F,OAAO,cAAc,MAAM,gCAAgC,CAAC;AAC5D,OAAO,sBAAsB,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAwB,mBAAmB,CAAC;AAEpE;;;GAGG;AACH,MAAM,gBAAgB,GAAmB,cAAc,CAAC;AAqGxD,MAAM,wBAAwB,GAC5B;IACE,uBAAuB,EAAE,wBAAwB;IACjD,gBAAgB,EAAE,sBAAs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CAAC,QAAQ,CAAC,kBAAkB,CAAC,MAAM,EAAE,EAAE,CAAC;oBAC9C,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;gBACnE,CAAC;YACH,CAAC;SACF,CAAC;QAEF,kBAAkB;QAClB,MAAM,iBAAiB,GAAsB,IAAI,iBAAiB,CAAC,8BAA8B,CAAC,CAAC;QACnG,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAEO,KAAK,CAAC,gBAAgB,CAC5B,WAA6B,EAC7B,iBAAoC;QAEpC,MAAM,QAAQ,GAAc,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC;QAExD,MAAM,2BAA2B,GAC/B,MAAM,oCAAoC,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;QAE1E,MAAM,mBAAmB,GAAiC,MAAM,4BAA4B,CAC1F,iBAAiB,EACjB,QAAQ,EACR,2BAA2B,CAC5B,CAAC;QAEF,OAAO;YACL,2BAA2B;YAC3B,mBAAmB;SACpB,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'node:path';\n\nimport type * as TTypescript from 'typescript';\nimport { SyncHook } from 'tapable';\n\nimport { FileSystem } from '@rushstack/node-core-library';\nimport type { ITerminal } from '@rushstack/terminal';\nimport { ProjectConfigurationFile, InheritanceType, PathResolutionMethod } from '@rushstack/heft-config-file';\nimport type {\n HeftConfiguration,\n IHeftTaskSession,\n IHeftTaskPlugin,\n IHeftTaskRunHookOptions,\n IHeftTaskRunIncrementalHookOptions,\n ICopyOperation,\n IHeftTaskFileOperations,\n ConfigurationFile\n} from '@rushstack/heft';\n\nimport { TypeScriptBuilder, type ITypeScriptBuilderConfiguration } from './TypeScriptBuilder';\nimport anythingSchema from './schemas/anything.schema.json';\nimport typescriptConfigSchema from './schemas/typescript.schema.json';\nimport { getTsconfigFilePath } from './tsconfigLoader';\n\n/**\n * The name of the plugin, as specified in heft-plugin.json\n *\n * @public\n */\nexport const PLUGIN_NAME: 'typescript-plugin' = 'typescript-plugin';\n\n/**\n * The ${configDir} token supported in TypeScript 5.5\n * @see {@link https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-5.html#the-configdir-template-variable-for-configuration-files}\n */\nconst CONFIG_DIR_TOKEN: '${configDir}' = '${configDir}';\n\n/**\n * @beta\n */\nexport interface IEmitModuleKind {\n moduleKind: 'commonjs' | 'amd' | 'umd' | 'system' | 'es2015' | 'esnext';\n outFolderName: string;\n jsExtensionOverride?: string;\n emitModulePackageJson?: boolean;\n}\n\n/**\n * @beta\n */\nexport interface IStaticAssetsCopyConfiguration {\n fileExtensions: string[];\n excludeGlobs: string[];\n includeGlobs: string[];\n}\n\n/**\n * @beta\n */\nexport interface ITypeScriptConfigurationJson {\n /**\n * If provided, emit these module kinds in addition to the modules specified in the tsconfig.\n * Note that this option only applies to the main tsconfig.json configuration.\n */\n additionalModuleKindsToEmit?: IEmitModuleKind[] | undefined;\n\n /**\n * If 'true', emit CommonJS output into the TSConfig outDir with the file extension '.cjs'\n */\n emitCjsExtensionForCommonJS?: boolean | undefined;\n\n /**\n * If 'true', emit ESModule output into the TSConfig outDir with the file extension '.mjs'\n */\n emitMjsExtensionForESModule?: boolean | undefined;\n\n /**\n * If true, enable behavior analogous to the \"tsc --build\" command. Will build projects referenced by the main project in dependency order.\n * Note that this will effectively enable \\\"noEmitOnError\\\".\n */\n buildProjectReferences?: boolean;\n\n /**\n * If true, and the tsconfig has \\\"isolatedModules\\\": true, then transpilation will happen in parallel in a worker thread.\n */\n useTranspilerWorker?: boolean;\n\n /**\n * If true, the TypeScript compiler will only resolve symlinks to their targets if the links are in a node_modules folder.\n * This significantly reduces file system operations in typical usage.\n */\n onlyResolveSymlinksInNodeModules?: boolean;\n\n /*\n * Specifies the tsconfig.json file that will be used for compilation. Equivalent to the \"project\" argument for the 'tsc' and 'tslint' command line tools.\n *\n * The default value is \"./tsconfig.json\"\n */\n project?: string;\n\n /**\n * Configures additional file types that should be copied into the TypeScript compiler's emit folders, for example\n * so that these files can be resolved by import statements.\n */\n staticAssetsToCopy?: IStaticAssetsCopyConfiguration;\n}\n\n/**\n * @beta\n */\nexport interface IPartialTsconfigCompilerOptions {\n outDir?: string;\n}\n\n/**\n * @beta\n */\nexport interface IPartialTsconfig {\n compilerOptions?: IPartialTsconfigCompilerOptions;\n}\n\n/**\n * @beta\n */\nexport interface IChangedFilesHookOptions {\n program: TTypescript.Program;\n changedFiles?: ReadonlySet<TTypescript.SourceFile>;\n}\n\n/**\n * @beta\n */\nexport interface ITypeScriptPluginAccessor {\n readonly onChangedFilesHook: SyncHook<IChangedFilesHookOptions>;\n}\n\nconst TYPESCRIPT_LOADER_CONFIG: ConfigurationFile.IProjectConfigurationFileSpecification<ITypeScriptConfigurationJson> =\n {\n projectRelativeFilePath: 'config/typescript.json',\n jsonSchemaObject: typescriptConfigSchema,\n propertyInheritance: {\n staticAssetsToCopy: {\n // When merging objects, arrays will be automatically appended\n inheritanceType: InheritanceType.merge\n }\n },\n jsonPathMetadata: {\n '$.additionalModuleKindsToEmit.*.outFolderName': {\n pathResolutionMethod: PathResolutionMethod.resolvePathRelativeToProjectRoot\n }\n }\n };\n\n/**\n * @beta\n */\nexport async function loadTypeScriptConfigurationFileAsync(\n heftConfiguration: HeftConfiguration,\n terminal: ITerminal\n): Promise<ITypeScriptConfigurationJson | undefined> {\n return await heftConfiguration.tryLoadProjectConfigurationFileAsync<ITypeScriptConfigurationJson>(\n TYPESCRIPT_LOADER_CONFIG,\n terminal\n );\n}\n\nlet _partialTsconfigFileLoader: ProjectConfigurationFile<IPartialTsconfig> | undefined;\nconst _partialTsconfigFilePromiseCache: Map<string, Promise<IPartialTsconfig | undefined>> = new Map();\n\n/**\n * @beta\n */\nexport async function loadPartialTsconfigFileAsync(\n heftConfiguration: HeftConfiguration,\n terminal: ITerminal,\n typeScriptConfigurationJson: ITypeScriptConfigurationJson | undefined\n): Promise<IPartialTsconfig | undefined> {\n const buildFolderPath: string = heftConfiguration.buildFolderPath;\n\n // Check the cache first\n let partialTsconfigFilePromise: Promise<IPartialTsconfig | undefined> | undefined =\n _partialTsconfigFilePromiseCache.get(buildFolderPath);\n\n if (!partialTsconfigFilePromise) {\n // We don't want to load the tsconfig.json file through the rig, but we do want to take\n // advantage of the extends functionality that ConfigurationFile provides. So we'll\n // check to see if the file exists and exit early if not.\n\n const tsconfigFilePath: string = getTsconfigFilePath(\n heftConfiguration,\n typeScriptConfigurationJson?.project\n );\n terminal.writeVerboseLine(`Looking for tsconfig at ${tsconfigFilePath}`);\n const tsconfigExists: boolean = await FileSystem.existsAsync(tsconfigFilePath);\n if (!tsconfigExists) {\n partialTsconfigFilePromise = Promise.resolve(undefined);\n } else {\n // Ensure that the file loader has been initialized.\n if (!_partialTsconfigFileLoader) {\n _partialTsconfigFileLoader = new ProjectConfigurationFile<IPartialTsconfig>({\n projectRelativeFilePath: typeScriptConfigurationJson?.project || 'tsconfig.json',\n jsonSchemaObject: anythingSchema,\n propertyInheritance: {\n compilerOptions: {\n inheritanceType: InheritanceType.merge\n }\n },\n jsonPathMetadata: {\n '$.compilerOptions.outDir': {\n pathResolutionMethod: PathResolutionMethod.custom,\n customResolver(\n resolverOptions: ConfigurationFile.IJsonPathMetadataResolverOptions<IPartialTsconfig>\n ): string {\n if (resolverOptions.propertyValue.includes(CONFIG_DIR_TOKEN)) {\n // Typescript 5.5. introduced the `${configDir}` token to refer to the directory containing the root tsconfig\n const configDir: string = path.dirname(tsconfigFilePath);\n // The token is an absolute path, so it should occur at most once.\n return path.resolve(resolverOptions.propertyValue.replace(CONFIG_DIR_TOKEN, configDir));\n } else {\n const thisConfigDir: string = path.dirname(resolverOptions.configurationFilePath);\n return path.resolve(thisConfigDir, resolverOptions.propertyValue);\n }\n }\n }\n }\n });\n }\n\n partialTsconfigFilePromise = _partialTsconfigFileLoader.loadConfigurationFileForProjectAsync(\n terminal,\n buildFolderPath,\n heftConfiguration.rigConfig\n );\n }\n _partialTsconfigFilePromiseCache.set(buildFolderPath, partialTsconfigFilePromise);\n }\n\n return await partialTsconfigFilePromise;\n}\n\ninterface ITypeScriptConfigurationJsonAndPartialTsconfigFile {\n typeScriptConfigurationJson: ITypeScriptConfigurationJson | undefined;\n partialTsconfigFile: IPartialTsconfig | undefined;\n}\n\nexport default class TypeScriptPlugin implements IHeftTaskPlugin {\n public accessor: ITypeScriptPluginAccessor = {\n onChangedFilesHook: new SyncHook<IChangedFilesHookOptions>(['changedFilesHookOptions'])\n };\n\n public apply(taskSession: IHeftTaskSession, heftConfiguration: HeftConfiguration): void {\n taskSession.hooks.registerFileOperations.tapPromise(\n PLUGIN_NAME,\n async (fileOperations: IHeftTaskFileOperations): Promise<IHeftTaskFileOperations> => {\n // TODO: We should consider maybe only doing one copy of static assets and pointing\n // all source files to this set of static assets. This would allow us to avoid\n // having to copy the static assets multiple times, increasing build times and\n // package size.\n for (const copyOperation of await this._getStaticAssetCopyOperationsAsync(\n taskSession,\n heftConfiguration\n )) {\n fileOperations.copyOperations.add(copyOperation);\n }\n\n return fileOperations;\n }\n );\n\n taskSession.hooks.run.tapPromise(PLUGIN_NAME, async (runOptions: IHeftTaskRunHookOptions) => {\n const builder: TypeScriptBuilder | false = await this._getTypeScriptBuilderAsync(\n taskSession,\n heftConfiguration\n );\n if (builder) {\n await builder.invokeAsync();\n }\n });\n\n let incrementalBuilder: TypeScriptBuilder | undefined | false;\n taskSession.hooks.runIncremental.tapPromise(\n PLUGIN_NAME,\n async (runIncrementalOptions: IHeftTaskRunIncrementalHookOptions) => {\n if (incrementalBuilder === undefined) {\n // eslint-disable-next-line require-atomic-updates\n incrementalBuilder = await this._getTypeScriptBuilderAsync(taskSession, heftConfiguration);\n }\n\n if (incrementalBuilder) {\n await incrementalBuilder.invokeAsync(runIncrementalOptions.requestRun);\n }\n }\n );\n }\n\n private async _getStaticAssetCopyOperationsAsync(\n taskSession: IHeftTaskSession,\n heftConfiguration: HeftConfiguration\n ): Promise<ICopyOperation[]> {\n const { typeScriptConfigurationJson, partialTsconfigFile } = await this._loadConfigAsync(\n taskSession,\n heftConfiguration\n );\n\n // We only care about the copy if static assets were specified.\n const copyOperations: ICopyOperation[] = [];\n const staticAssetsConfig: IStaticAssetsCopyConfiguration | undefined =\n typeScriptConfigurationJson?.staticAssetsToCopy;\n if (\n staticAssetsConfig &&\n (staticAssetsConfig.fileExtensions?.length ||\n staticAssetsConfig.includeGlobs?.length ||\n staticAssetsConfig.excludeGlobs?.length)\n ) {\n const destinationFolderPaths: Set<string> = new Set<string>();\n\n // Add the output folder and all additional module kind output folders as destinations\n const tsconfigOutDir: string | undefined = partialTsconfigFile?.compilerOptions?.outDir;\n if (tsconfigOutDir) {\n destinationFolderPaths.add(tsconfigOutDir);\n }\n\n for (const emitModule of typeScriptConfigurationJson?.additionalModuleKindsToEmit || []) {\n destinationFolderPaths.add(emitModule.outFolderName);\n }\n\n copyOperations.push({\n ...staticAssetsConfig,\n\n // For now - these may need to be revised later\n sourcePath: path.resolve(heftConfiguration.buildFolderPath, 'src'),\n destinationFolders: Array.from(destinationFolderPaths),\n flatten: false,\n hardlink: false\n });\n }\n\n return copyOperations;\n }\n\n private async _getTypeScriptBuilderAsync(\n taskSession: IHeftTaskSession,\n heftConfiguration: HeftConfiguration\n ): Promise<TypeScriptBuilder | false> {\n const { typeScriptConfigurationJson, partialTsconfigFile } = await this._loadConfigAsync(\n taskSession,\n heftConfiguration\n );\n\n if (!partialTsconfigFile) {\n // There is no tsconfig file, we can exit early\n // This check may need watch mode to break on tsconfig addition/deletion\n return false;\n }\n\n // Build out the configuration\n const typeScriptBuilderConfiguration: ITypeScriptBuilderConfiguration = {\n buildFolderPath: heftConfiguration.buildFolderPath,\n // Build metadata is just another build output, but we put it in the temp folder because it will\n // usually be discarded when published.\n buildMetadataFolderPath: taskSession.tempFolderPath,\n heftConfiguration,\n\n buildProjectReferences: typeScriptConfigurationJson?.buildProjectReferences,\n\n useTranspilerWorker: typeScriptConfigurationJson?.useTranspilerWorker,\n\n onlyResolveSymlinksInNodeModules: typeScriptConfigurationJson?.onlyResolveSymlinksInNodeModules,\n\n tsconfigPath: getTsconfigFilePath(heftConfiguration, typeScriptConfigurationJson?.project),\n additionalModuleKindsToEmit: typeScriptConfigurationJson?.additionalModuleKindsToEmit,\n emitCjsExtensionForCommonJS: !!typeScriptConfigurationJson?.emitCjsExtensionForCommonJS,\n emitMjsExtensionForESModule: !!typeScriptConfigurationJson?.emitMjsExtensionForESModule,\n scopedLogger: taskSession.logger,\n emitChangedFilesCallback: (\n program: TTypescript.Program,\n changedFiles?: Set<TTypescript.SourceFile>\n ) => {\n // Provide the typescript program dependent plugins\n if (this.accessor.onChangedFilesHook.isUsed()) {\n this.accessor.onChangedFilesHook.call({ program, changedFiles });\n }\n }\n };\n\n // Run the builder\n const typeScriptBuilder: TypeScriptBuilder = new TypeScriptBuilder(typeScriptBuilderConfiguration);\n return typeScriptBuilder;\n }\n\n private async _loadConfigAsync(\n taskSession: IHeftTaskSession,\n heftConfiguration: HeftConfiguration\n ): Promise<ITypeScriptConfigurationJsonAndPartialTsconfigFile> {\n const terminal: ITerminal = taskSession.logger.terminal;\n\n const typeScriptConfigurationJson: ITypeScriptConfigurationJson | undefined =\n await loadTypeScriptConfigurationFileAsync(heftConfiguration, terminal);\n\n const partialTsconfigFile: IPartialTsconfig | undefined = await loadPartialTsconfigFileAsync(\n heftConfiguration,\n terminal,\n typeScriptConfigurationJson\n );\n\n return {\n typeScriptConfigurationJson,\n partialTsconfigFile\n };\n }\n}\n"]}
|
|
@@ -31,6 +31,11 @@
|
|
|
31
31
|
"outFolderName": {
|
|
32
32
|
"type": "string",
|
|
33
33
|
"pattern": "[^\\\\\\/]"
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
"emitModulePackageJson": {
|
|
37
|
+
"description": "If true, a package.json file will be written to the output folder with the appropriate \"type\" field for the specified module kind. This ensures that Node.js correctly interprets .js files in the output folder regardless of the nearest ancestor package.json \"type\" setting. Only valid for CommonJS, UMD, and ES module kinds.",
|
|
38
|
+
"type": "boolean"
|
|
34
39
|
}
|
|
35
40
|
},
|
|
36
41
|
"required": ["moduleKind", "outFolderName"]
|
package/lib-esm/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type * as TTypescript from 'typescript';\n\nexport interface ITypescriptWorkerData {\n /**\n * Path to the version of TypeScript to use.\n */\n typeScriptToolPath: string;\n}\n\nexport interface ITranspilationRequestMessage {\n /**\n * Unique identifier for this request.\n */\n requestId: number;\n /**\n * The tsconfig compiler options to use for the request.\n */\n compilerOptions: TTypescript.CompilerOptions;\n /**\n * The variants to emit.\n */\n moduleKindsToEmit: ICachedEmitModuleKind[];\n /**\n * The set of files to build.\n */\n filesToTranspile: Map<string, string>;\n}\n\nexport interface ITranspilationSuccessMessage {\n requestId: number;\n type: 'success';\n result: TTypescript.EmitResult;\n}\n\nexport interface ITranspilationErrorMessage {\n requestId: number;\n type: 'error';\n result: {\n message: string;\n [key: string]: unknown;\n };\n}\n\nexport type ITranspilationResponseMessage = ITranspilationSuccessMessage | ITranspilationErrorMessage;\n\nexport interface ICachedEmitModuleKind {\n moduleKind: TTypescript.ModuleKind;\n\n outFolderPath: string;\n\n /**\n * File extension to use instead of '.js' for emitted ECMAScript files.\n * For example, '.cjs' to indicate commonjs content, or '.mjs' to indicate ECMAScript modules.\n */\n jsExtensionOverride: string | undefined;\n\n /**\n * Set to true if this is the emit kind that is specified in the tsconfig.json.\n * Declarations are only emitted for the primary module kind.\n */\n isPrimary: boolean;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type * as TTypescript from 'typescript';\n\nexport interface ITypescriptWorkerData {\n /**\n * Path to the version of TypeScript to use.\n */\n typeScriptToolPath: string;\n}\n\nexport interface ITranspilationRequestMessage {\n /**\n * Unique identifier for this request.\n */\n requestId: number;\n /**\n * The tsconfig compiler options to use for the request.\n */\n compilerOptions: TTypescript.CompilerOptions;\n /**\n * The variants to emit.\n */\n moduleKindsToEmit: ICachedEmitModuleKind[];\n /**\n * The set of files to build.\n */\n filesToTranspile: Map<string, string>;\n}\n\nexport interface ITranspilationSuccessMessage {\n requestId: number;\n type: 'success';\n result: TTypescript.EmitResult;\n}\n\nexport interface ITranspilationErrorMessage {\n requestId: number;\n type: 'error';\n result: {\n message: string;\n [key: string]: unknown;\n };\n}\n\nexport type ITranspilationResponseMessage = ITranspilationSuccessMessage | ITranspilationErrorMessage;\n\nexport interface ICachedEmitModuleKind {\n moduleKind: TTypescript.ModuleKind;\n\n outFolderPath: string;\n\n /**\n * File extension to use instead of '.js' for emitted ECMAScript files.\n * For example, '.cjs' to indicate commonjs content, or '.mjs' to indicate ECMAScript modules.\n */\n jsExtensionOverride: string | undefined;\n\n /**\n * Set to true if this is the emit kind that is specified in the tsconfig.json.\n * Declarations are only emitted for the primary module kind.\n */\n isPrimary: boolean;\n\n /**\n * If true, a package.json with the appropriate \"type\" field will be written\n * to the output folder after emit.\n */\n emitModulePackageJson: boolean;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/heft-typescript-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Heft plugin for TypeScript",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,21 +37,21 @@
|
|
|
37
37
|
},
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@rushstack/heft": "1.2.
|
|
40
|
+
"@rushstack/heft": "1.2.6"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@types/tapable": "1.0.6",
|
|
44
44
|
"semver": "~7.5.4",
|
|
45
45
|
"tapable": "1.1.3",
|
|
46
|
-
"@rushstack/node-core-library": "5.20.
|
|
47
|
-
"@rushstack/heft-config-file": "0.20.
|
|
46
|
+
"@rushstack/node-core-library": "5.20.3",
|
|
47
|
+
"@rushstack/heft-config-file": "0.20.3"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/semver": "7.5.0",
|
|
51
51
|
"eslint": "~9.37.0",
|
|
52
52
|
"typescript": "~5.8.2",
|
|
53
|
-
"@rushstack/heft": "1.2.
|
|
54
|
-
"@rushstack/terminal": "0.22.
|
|
53
|
+
"@rushstack/heft": "1.2.6",
|
|
54
|
+
"@rushstack/terminal": "0.22.3",
|
|
55
55
|
"decoupled-local-node-rig": "1.0.0"
|
|
56
56
|
},
|
|
57
57
|
"sideEffects": false,
|