@rushstack/heft-typescript-plugin 0.2.0-rc.6 → 0.2.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.
@@ -81,11 +81,6 @@ export declare interface ITypeScriptConfigurationJson {
81
81
  * so that these files can be resolved by import statements.
82
82
  */
83
83
  staticAssetsToCopy?: IStaticAssetsCopyConfiguration;
84
- /**
85
- * Set this to change the maximum number of file handles that will be opened concurrently for writing.
86
- * The default is 50.
87
- */
88
- maxWriteParallelism?: number;
89
84
  }
90
85
 
91
86
  /**
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.35.0"
8
+ "packageVersion": "7.37.0"
9
9
  }
10
10
  ]
11
11
  }
package/heft-plugin.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://developer.microsoft.com/json-schemas/heft/heft-plugin.schema.json",
2
+ "$schema": "https://developer.microsoft.com/json-schemas/heft/v0/heft-plugin.schema.json",
3
3
 
4
4
  "taskPlugins": [
5
5
  {
@@ -39,7 +39,12 @@ function runTranspiler(message) {
39
39
  }
40
40
  compilerOptions.suppressOutputPathCheck = true;
41
41
  compilerOptions.skipDefaultLibCheck = true;
42
- compilerOptions.preserveValueImports = true;
42
+ // To fully disable the type checker, we have to set `hasNoDefaultLib: true` on every source file.
43
+ // However, doing so loses the information about which imports are used.
44
+ // To retain the imports, we use `preserveValueImports`. However, if some imports are only used for types,
45
+ // this will produce invalid runtime output unless said imports are marked with `type `.
46
+ // Thus we can only enable this optimization if `verbatimModuleSyntax` is enabled (or equivalent).
47
+ compilerOptions.preserveValueImports = fullySkipTypeCheck;
43
48
  const sourceFileByPath = new Map();
44
49
  const includedFiles = [];
45
50
  for (const [fileName, sourceText] of filesToTranspile) {
@@ -1 +1 @@
1
- {"version":3,"file":"TranspilerWorker.js","sourceRoot":"","sources":["../src/TranspilerWorker.ts"],"names":[],"mapp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EAAE,CAAC,OAAO;QACzB,UAAU,EAAE,CAAC,QAAgB,EAAE,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAAC;QAChE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE;QAClB,eAAe,EAAE,GAAG,EAAE,CAAC,IAAI;QAC3B,cAAc,EAAE,GAAG,EAAE,CAAC,EAAE;KACzB,CAAC;IAEF,MAAM,OAAO,GAAwB,EAAE,CAAC,aAAa,CAAC,aAAa,EAAE,eAAe,EAAE,YAAY,CAAC,CAAC;IAEpG,IAAA,2DAA4B,EAAC,OAAO,EAAE,EAAE,EAAE,iBAAiB,EAAE,WAAW,CAAC,CAAC;IAE1E,MAAM,MAAM,GAA2B,OAAO,CAAC,IAAI,CACjD,SAAS;IACT,wEAAwE;IACxE,EAAE,CAAC,GAAG,CAAC,SAAS,EAChB,SAAS,EACT,SAAS,EACT,SAAS,CACV,CAAC;IAEF,MAAM,QAAQ,GAAiC;QAC7C,SAAS;QACT,IAAI,EAAE,SAAS;QACf,MAAM;KACP,CAAC;IAEF,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,gCAAW,CAAC,EAAE,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\nimport { parentPort, workerData } from 'node:worker_threads';\n\nimport type * as TTypescript from 'typescript';\nimport type {\n ITranspilationErrorMessage,\n ITranspilationRequestMessage,\n ITranspilationSuccessMessage,\n ITypescriptWorkerData\n} from './types';\nimport type { ExtendedTypeScript } from './internalTypings/TypeScriptInternals';\nimport { configureProgramForMultiEmit } from './configureProgramForMultiEmit';\n\nconst typedWorkerData: ITypescriptWorkerData = workerData;\n\nconst ts: ExtendedTypeScript = require(typedWorkerData.typeScriptToolPath);\n\nfunction handleMessage(message: ITranspilationRequestMessage | false): void {\n if (!message) {\n process.exit(0);\n }\n\n try {\n const response: ITranspilationSuccessMessage = runTranspiler(message);\n parentPort!.postMessage(response);\n } catch (err) {\n const errorResponse: ITranspilationErrorMessage = {\n requestId: message.requestId,\n type: 'error',\n result: {\n message: err.message,\n ...Object.fromEntries(Object.entries(err))\n }\n };\n parentPort!.postMessage(errorResponse);\n }\n}\n\nfunction runTranspiler(message: ITranspilationRequestMessage): ITranspilationSuccessMessage {\n const { requestId, compilerOptions, moduleKindsToEmit, filesToTranspile } = message;\n\n const fullySkipTypeCheck: boolean =\n /* TypeScript 5+ */ compilerOptions.verbatimModuleSyntax ||\n /* TypeScript 4 */ compilerOptions.importsNotUsedAsValues === ts.ImportsNotUsedAsValues.Error;\n\n for (const [option, value] of Object.entries(ts.getDefaultCompilerOptions())) {\n if (compilerOptions[option] === undefined) {\n compilerOptions[option] = value;\n }\n }\n\n const { target: rawTarget } = compilerOptions;\n\n for (const option of ts.transpileOptionValueCompilerOptions) {\n compilerOptions[option.name] = option.transpileOptionValue;\n }\n\n compilerOptions.suppressOutputPathCheck = true;\n compilerOptions.skipDefaultLibCheck = true;\n compilerOptions.preserveValueImports = true;\n\n const sourceFileByPath: Map<string, TTypescript.SourceFile> = new Map();\n\n const includedFiles: string[] = [];\n for (const [fileName, sourceText] of filesToTranspile) {\n if (sourceText) {\n const sourceFile: TTypescript.SourceFile = ts.createSourceFile(fileName, sourceText, rawTarget!);\n sourceFile.hasNoDefaultLib = fullySkipTypeCheck;\n sourceFileByPath.set(fileName, sourceFile);\n includedFiles.push(fileName);\n }\n }\n\n const newLine: string = ts.getNewLineCharacter(compilerOptions);\n\n const compilerHost: TTypescript.CompilerHost = {\n getSourceFile: (fileName: string) => sourceFileByPath.get(fileName),\n writeFile: ts.sys.writeFile,\n getDefaultLibFileName: () => 'lib.d.ts',\n useCaseSensitiveFileNames: () => true,\n getCanonicalFileName: (fileName: string) => fileName,\n getCurrentDirectory: () => '',\n getNewLine: () => newLine,\n fileExists: (fileName: string) => sourceFileByPath.has(fileName),\n readFile: () => '',\n directoryExists: () => true,\n getDirectories: () => []\n };\n\n const program: TTypescript.Program = ts.createProgram(includedFiles, compilerOptions, compilerHost);\n\n configureProgramForMultiEmit(program, ts, moduleKindsToEmit, 'transpile');\n\n const result: TTypescript.EmitResult = program.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 const response: ITranspilationSuccessMessage = {\n requestId,\n type: 'success',\n result\n };\n\n return response;\n}\n\nparentPort!.on('message', handleMessage);\n"]}
1
+ {"version":3,"file":"TranspilerWorker.js","sourceRoot":"","sources":["../src/TranspilerWorker.ts"],"names":[],"mappings":";;AAAA,4FAA4F;AAC5F,2DAA2D;AAC3D,6DAA6D;AAU7D,iFAA8E;AAE9E,MAAM,eAAe,GAA0B,gCAAU,CAAC;AAE1D,MAAM,EAAE,GAAuB,OAAO,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC;AAE3E,SAAS,aAAa,CAAC,OAA6C;IAClE,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;IAED,IAAI;QACF,MAAM,QAAQ,GAAiC,aAAa,CAAC,OAAO,CAAC,CAAC;QACtE,gCAAW,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;KACnC;IAAC,OAAO,GAAG,EAAE;QACZ,MAAM,aAAa,GAA+B;YAChD,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,IAAI,EAAE,OAAO;YACb,MAAM,kBACJ,OAAO,EAAE,GAAG,CAAC,OAAO,IACjB,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAC3C;SACF,CAAC;QACF,gCAAW,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;KACxC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,OAAqC;IAC1D,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC;IA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soft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\nimport { parentPort, workerData } from 'node:worker_threads';\n\nimport type * as TTypescript from 'typescript';\nimport type {\n ITranspilationErrorMessage,\n ITranspilationRequestMessage,\n ITranspilationSuccessMessage,\n ITypescriptWorkerData\n} from './types';\nimport type { ExtendedTypeScript } from './internalTypings/TypeScriptInternals';\nimport { configureProgramForMultiEmit } from './configureProgramForMultiEmit';\n\nconst typedWorkerData: ITypescriptWorkerData = workerData;\n\nconst ts: ExtendedTypeScript = require(typedWorkerData.typeScriptToolPath);\n\nfunction handleMessage(message: ITranspilationRequestMessage | false): void {\n if (!message) {\n process.exit(0);\n }\n\n try {\n const response: ITranspilationSuccessMessage = runTranspiler(message);\n parentPort!.postMessage(response);\n } catch (err) {\n const errorResponse: ITranspilationErrorMessage = {\n requestId: message.requestId,\n type: 'error',\n result: {\n message: err.message,\n ...Object.fromEntries(Object.entries(err))\n }\n };\n parentPort!.postMessage(errorResponse);\n }\n}\n\nfunction runTranspiler(message: ITranspilationRequestMessage): ITranspilationSuccessMessage {\n const { requestId, compilerOptions, moduleKindsToEmit, filesToTranspile } = message;\n\n const fullySkipTypeCheck: boolean =\n /* TypeScript 5+ */ compilerOptions.verbatimModuleSyntax ||\n /* TypeScript 4 */ compilerOptions.importsNotUsedAsValues === ts.ImportsNotUsedAsValues.Error;\n\n for (const [option, value] of Object.entries(ts.getDefaultCompilerOptions())) {\n if (compilerOptions[option] === undefined) {\n compilerOptions[option] = value;\n }\n }\n\n const { target: rawTarget } = compilerOptions;\n\n for (const option of ts.transpileOptionValueCompilerOptions) {\n compilerOptions[option.name] = option.transpileOptionValue;\n }\n\n compilerOptions.suppressOutputPathCheck = true;\n compilerOptions.skipDefaultLibCheck = true;\n // To fully disable the type checker, we have to set `hasNoDefaultLib: true` on every source file.\n // However, doing so loses the information about which imports are used.\n // To retain the imports, we use `preserveValueImports`. However, if some imports are only used for types,\n // this will produce invalid runtime output unless said imports are marked with `type `.\n // Thus we can only enable this optimization if `verbatimModuleSyntax` is enabled (or equivalent).\n compilerOptions.preserveValueImports = fullySkipTypeCheck;\n\n const sourceFileByPath: Map<string, TTypescript.SourceFile> = new Map();\n\n const includedFiles: string[] = [];\n for (const [fileName, sourceText] of filesToTranspile) {\n if (sourceText) {\n const sourceFile: TTypescript.SourceFile = ts.createSourceFile(fileName, sourceText, rawTarget!);\n sourceFile.hasNoDefaultLib = fullySkipTypeCheck;\n sourceFileByPath.set(fileName, sourceFile);\n includedFiles.push(fileName);\n }\n }\n\n const newLine: string = ts.getNewLineCharacter(compilerOptions);\n\n const compilerHost: TTypescript.CompilerHost = {\n getSourceFile: (fileName: string) => sourceFileByPath.get(fileName),\n writeFile: ts.sys.writeFile,\n getDefaultLibFileName: () => 'lib.d.ts',\n useCaseSensitiveFileNames: () => true,\n getCanonicalFileName: (fileName: string) => fileName,\n getCurrentDirectory: () => '',\n getNewLine: () => newLine,\n fileExists: (fileName: string) => sourceFileByPath.has(fileName),\n readFile: () => '',\n directoryExists: () => true,\n getDirectories: () => []\n };\n\n const program: TTypescript.Program = ts.createProgram(includedFiles, compilerOptions, compilerHost);\n\n configureProgramForMultiEmit(program, ts, moduleKindsToEmit, 'transpile');\n\n const result: TTypescript.EmitResult = program.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 const response: ITranspilationSuccessMessage = {\n requestId,\n type: 'success',\n result\n };\n\n return response;\n}\n\nparentPort!.on('message', handleMessage);\n"]}
@@ -22,11 +22,6 @@ export interface ITypeScriptBuilderConfiguration extends ITypeScriptConfiguratio
22
22
  * The path to the tsconfig file being built.
23
23
  */
24
24
  tsconfigPath: string;
25
- /**
26
- * Set this to change the maximum number of file handles that will be opened concurrently for writing.
27
- * The default is 50.
28
- */
29
- maxWriteParallelism: number;
30
25
  /**
31
26
  * The scoped logger that the builder will log to.
32
27
  */
@@ -46,6 +41,7 @@ interface ITranspileSignal {
46
41
  }
47
42
  interface ITypeScriptTool {
48
43
  ts: ExtendedTypeScript;
44
+ system: TTypescript.System;
49
45
  measureSync: PerformanceMeasurer;
50
46
  sourceFileCache: Map<string, TTypescript.SourceFile>;
51
47
  watchProgram: TWatchProgram | undefined;
@@ -57,8 +53,6 @@ interface ITypeScriptTool {
57
53
  pendingTranspilePromises: Map<number, Promise<TTypescript.EmitResult>>;
58
54
  pendingTranspileSignals: Map<number, ITranspileSignal>;
59
55
  reportDiagnostic: TTypescript.DiagnosticReporter;
60
- clearTimeout: (timeout: IPendingWork) => void;
61
- setTimeout: <T extends unknown[]>(timeout: (...args: T) => void, ms: number, ...args: T) => IPendingWork;
62
56
  }
63
57
  export declare class TypeScriptBuilder {
64
58
  private readonly _configuration;
@@ -1 +1 @@
1
- {"version":3,"file":"TypeScriptBuilder.d.ts","sourceRoot":"","sources":["../src/TypeScriptBuilder.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGxC,OAAO,KAAK,KAAK,WAAW,MAAM,YAAY,CAAC;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,KAAK,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AAC1G,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AASzD,MAAM,WAAW,+BAAgC,SAAQ,4BAA4B;IACnF;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,uBAAuB,EAAE,MAAM,CAAC;IAEhC;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAI3B;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,YAAY,EAAE,aAAa,CAAC;IAE5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AK,gBAAgB,GAuB3B;gBAEkB,aAAa,EAAE,+BAA+B;IAMpD,WAAW,CAAC,gBAAgB,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IA6KzD,cAAc,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAyDpD,cAAc,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IA+HpD,sBAAsB,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAmDzE,OAAO,CAAC,eAAe;IAwCvB,OAAO,CAAC,mBAAmB;IAqB3B,OAAO,CAAC,mBAAmB;IAc3B,OAAO,CAAC,uBAAuB;IA0C/B,OAAO,CAAC,8BAA8B;IAuBtC,OAAO,CAAC,iBAAiB;IAyHzB,OAAO,CAAC,oBAAoB;IA8D5B,OAAO,CAAC,aAAa;IA2BrB,OAAO,CAAC,wBAAwB;IAmGhC,OAAO,CAAC,yBAAyB;IA+BjC,OAAO,CAAC,6BAA6B;IAmBrC,OAAO,CAAC,uBAAuB;IAwB/B,OAAO,CAAC,6BAA6B;IA6CrC,OAAO,CAAC,8BAA8B;IActC,OAAO,CAAC,gBAAgB;IAyBxB,OAAO,CAAC,uBAAuB;IAiF/B,OAAO,CAAC,cAAc;CAYvB"}
@@ -134,8 +134,26 @@ class TypeScriptBuilder {
134
134
  this._typescriptTerminal.writeLine(`Using TypeScript version ${ts.version}`);
135
135
  const rawDiagnostics = [];
136
136
  const pendingOperations = new Set();
137
+ const clearTimeout = (timeout) => {
138
+ pendingOperations.delete(timeout);
139
+ };
140
+ const setTimeout = (fn, ms, ...args) => {
141
+ var _a;
142
+ const timeout = () => {
143
+ fn(...args);
144
+ };
145
+ pendingOperations.add(timeout);
146
+ if (!((_a = this._tool) === null || _a === void 0 ? void 0 : _a.executing) && onChangeDetected) {
147
+ onChangeDetected();
148
+ }
149
+ return timeout;
150
+ };
151
+ // Need to also update watchFile and watchDirectory
152
+ const system = Object.assign(Object.assign({}, ts.sys), { getCurrentDirectory: () => this._configuration.buildFolderPath, clearTimeout,
153
+ setTimeout });
137
154
  this._tool = {
138
155
  ts,
156
+ system,
139
157
  measureSync: measureTsPerformance,
140
158
  sourceFileCache: new Map(),
141
159
  watchProgram: undefined,
@@ -146,19 +164,6 @@ class TypeScriptBuilder {
146
164
  reportDiagnostic: (diagnostic) => {
147
165
  rawDiagnostics.push(diagnostic);
148
166
  },
149
- clearTimeout(timeout) {
150
- pendingOperations.delete(timeout);
151
- },
152
- setTimeout(fn, ms, ...args) {
153
- const timeout = () => {
154
- fn(...args);
155
- };
156
- pendingOperations.add(timeout);
157
- if (!this.executing && onChangeDetected) {
158
- onChangeDetected();
159
- }
160
- return timeout;
161
- },
162
167
  worker: undefined,
163
168
  pendingTranspilePromises: new Map(),
164
169
  pendingTranspileSignals: new Map()
@@ -220,7 +225,7 @@ class TypeScriptBuilder {
220
225
  // eslint-disable-next-line require-atomic-updates
221
226
  tool.executing = false;
222
227
  }
223
- this._logDiagnostics(ts, rawDiagnostics);
228
+ this._logDiagnostics(ts, rawDiagnostics, this._useSolutionBuilder);
224
229
  }
225
230
  async _runBuildAsync(tool) {
226
231
  const { ts, measureSync: measureTsPerformance, pendingTranspilePromises } = tool;
@@ -346,16 +351,28 @@ class TypeScriptBuilder {
346
351
  }
347
352
  }
348
353
  }
349
- this._logDiagnostics(ts, rawDiagnostics);
354
+ this._logDiagnostics(ts, rawDiagnostics, true);
350
355
  }
351
- _logDiagnostics(ts, rawDiagnostics) {
356
+ _logDiagnostics(ts, rawDiagnostics, isSolutionMode) {
352
357
  const diagnostics = ts.sortAndDeduplicateDiagnostics(rawDiagnostics);
353
358
  if (diagnostics.length > 0) {
359
+ let warningCount = 0;
360
+ let hasError = false;
354
361
  this._typescriptTerminal.writeLine(`Encountered ${diagnostics.length} TypeScript issue${diagnostics.length > 1 ? 's' : ''}:`);
355
362
  for (const diagnostic of diagnostics) {
356
363
  const diagnosticCategory = this._getAdjustedDiagnosticCategory(diagnostic, ts);
364
+ if (diagnosticCategory === ts.DiagnosticCategory.Warning) {
365
+ warningCount++;
366
+ }
367
+ else if (diagnosticCategory === ts.DiagnosticCategory.Error) {
368
+ hasError = true;
369
+ }
357
370
  this._printDiagnosticMessage(ts, diagnostic, diagnosticCategory);
358
371
  }
372
+ if (isSolutionMode && warningCount > 0 && !hasError) {
373
+ this._typescriptLogger.emitError(new Error(`TypeScript encountered ${warningCount} warning${warningCount === 1 ? '' : 's'} ` +
374
+ `and is configured to build project references. As a result, no files were emitted. Please fix the reported warnings to proceed.`));
375
+ }
359
376
  }
360
377
  }
361
378
  _logEmitPerformance(ts) {
@@ -619,25 +636,23 @@ class TypeScriptBuilder {
619
636
  return solutionBuilderHost;
620
637
  }
621
638
  _buildIncrementalCompilerHost(tool, tsconfig) {
622
- const { ts } = tool;
639
+ const { ts, system } = tool;
623
640
  let compilerHost;
624
641
  if (tsconfig.options.incremental) {
625
- compilerHost = ts.createIncrementalCompilerHost(tsconfig.options, ts.sys);
642
+ compilerHost = ts.createIncrementalCompilerHost(tsconfig.options, system);
626
643
  }
627
644
  else {
628
- compilerHost = ts.createCompilerHost(tsconfig.options);
645
+ compilerHost = ts.createCompilerHost(tsconfig.options, undefined, system);
629
646
  }
630
647
  this._changeCompilerHostToUseCache(compilerHost, tool);
631
648
  return compilerHost;
632
649
  }
633
650
  _buildWatchCompilerHost(tool, tsconfig) {
634
- const { ts } = tool;
651
+ const { ts, system } = tool;
635
652
  const reportWatchStatus = (diagnostic) => {
636
653
  this._printDiagnosticMessage(ts, diagnostic);
637
654
  };
638
- const compilerHost = ts.createWatchCompilerHost(tsconfig.fileNames, tsconfig.options, ts.sys, this._getCreateBuilderProgram(ts), tool.reportDiagnostic, reportWatchStatus, tsconfig.projectReferences, tsconfig.watchOptions);
639
- compilerHost.clearTimeout = tool.clearTimeout;
640
- compilerHost.setTimeout = tool.setTimeout;
655
+ const compilerHost = ts.createWatchCompilerHost(tsconfig.fileNames, tsconfig.options, system, this._getCreateBuilderProgram(ts), tool.reportDiagnostic, reportWatchStatus, tsconfig.projectReferences, tsconfig.watchOptions);
641
656
  return compilerHost;
642
657
  }
643
658
  _changeCompilerHostToUseCache(compilerHost, tool) {
@@ -646,6 +661,7 @@ class TypeScriptBuilder {
646
661
  if (innerGetSourceFile.cache === sourceFileCache) {
647
662
  return;
648
663
  }
664
+ compilerHost.getCurrentDirectory = () => this._configuration.buildFolderPath;
649
665
  // Enable source file persistence
650
666
  const getSourceFile = (fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile) => {
651
667
  if (!shouldCreateNewSourceFile) {
@@ -667,10 +683,8 @@ class TypeScriptBuilder {
667
683
  compilerHost.getSourceFile = getSourceFile;
668
684
  }
669
685
  _buildWatchSolutionBuilderHost(tool) {
670
- const { reportDiagnostic, ts } = tool;
671
- const host = ts.createSolutionBuilderWithWatchHost(ts.sys, this._getCreateBuilderProgram(ts), reportDiagnostic, reportDiagnostic, reportDiagnostic);
672
- host.clearTimeout = tool.clearTimeout;
673
- host.setTimeout = tool.setTimeout;
686
+ const { reportDiagnostic, ts, system } = tool;
687
+ const host = ts.createSolutionBuilderWithWatchHost(system, this._getCreateBuilderProgram(ts), reportDiagnostic, reportDiagnostic, reportDiagnostic);
674
688
  return host;
675
689
  }
676
690
  _parseModuleKind(ts, moduleKindName) {
@@ -1 +1 @@
1
- {"version":3,"file":"TypeScriptBuilder.js","sourceRoot":"","sources":["../src/TypeScriptBuilder.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,+CAAiC;AACjC,2CAA6B;AAC7B,mDAAwC;AAExC,+CAAiC;AAEjC,oEAA4G;AAY5G,iFAA8E;AA6F9E,MAAM,iCAAiC,GAAW,CAAC,CAAC;AACpD,MAAM,iCAAiC,GAAW,CAAC,CAAC;AAEpD,MAAM,iCAAiC,GAAW,CAAC,CAAC;AACpD,MAAM,iCAAi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;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;QACjD,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE;YACjC,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;SAC5D;KACF;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 'crypto';\nimport * as path from 'path';\nimport { Worker } from 'worker_threads';\n\nimport * as semver from 'semver';\nimport type * as TTypescript from 'typescript';\nimport { type ITerminal, JsonFile, type IPackageJson, Path, FileError } from '@rushstack/node-core-library';\nimport type { IScopedLogger } from '@rushstack/heft';\n\nimport type { ExtendedTypeScript, IExtendedSolutionBuilder } from './internalTypings/TypeScriptInternals';\nimport type { ITypeScriptConfigurationJson } from './TypeScriptPlugin';\nimport type { PerformanceMeasurer } from './Performance';\nimport type {\n ICachedEmitModuleKind,\n ITranspilationRequestMessage,\n ITranspilationResponseMessage,\n ITypescriptWorkerData\n} from './types';\nimport { configureProgramForMultiEmit } from './configureProgramForMultiEmit';\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 typeScriptToolPath: string;\n\n // watchMode: boolean;\n\n /**\n * The path to the tsconfig file being built.\n */\n tsconfigPath: string;\n\n /**\n * Set this to change the maximum number of file handles that will be opened concurrently for writing.\n * The default is 50.\n */\n maxWriteParallelism: number;\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 ICompilerCapabilities {\n /**\n * Support for incremental compilation via `ts.createIncrementalProgram()`.\n * Introduced with TypeScript 3.6.\n */\n incrementalProgram: boolean;\n\n /**\n * Support for composite projects via `ts.createSolutionBuilder()`.\n * Introduced with TypeScript 3.0.\n */\n solutionBuilder: boolean;\n}\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\nconst OLDEST_SUPPORTED_TS_MAJOR_VERSION: number = 2;\nconst OLDEST_SUPPORTED_TS_MINOR_VERSION: number = 9;\n\nconst NEWEST_SUPPORTED_TS_MAJOR_VERSION: number = 5;\nconst NEWEST_SUPPORTED_TS_MINOR_VERSION: number = 0;\n\ninterface ITypeScriptTool {\n ts: ExtendedTypeScript;\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 clearTimeout: (timeout: IPendingWork) => void;\n setTimeout: <T extends unknown[]>(timeout: (...args: T) => void, ms: number, ...args: T) => IPendingWork;\n}\n\nexport class TypeScriptBuilder {\n private readonly _configuration: ITypeScriptBuilderConfiguration;\n private readonly _typescriptLogger: IScopedLogger;\n private readonly _typescriptTerminal: ITerminal;\n\n private _typescriptVersion!: string;\n private _typescriptParsedVersion!: semver.SemVer;\n\n private _capabilities!: ICompilerCapabilities;\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 configHash.update(JSON.stringify(this._configuration.additionalModuleKindsToEmit || {}));\n const serializedConfigHash: string = configHash\n .digest('base64')\n .slice(0, 8)\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_');\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 // Determine the compiler version\n const compilerPackageJsonFilename: string = path.join(\n this._configuration.typeScriptToolPath,\n 'package.json'\n );\n const packageJson: IPackageJson = await JsonFile.loadAsync(compilerPackageJsonFilename);\n this._typescriptVersion = packageJson.version;\n const parsedVersion: semver.SemVer | null = semver.parse(this._typescriptVersion);\n if (!parsedVersion) {\n throw new Error(\n `Unable to parse version \"${this._typescriptVersion}\" for TypeScript compiler package in: ` +\n compilerPackageJsonFilename\n );\n }\n this._typescriptParsedVersion = parsedVersion;\n\n // Detect what features this compiler supports. Note that manually comparing major/minor numbers\n // loosens the matching to accept prereleases such as \"3.6.0-dev.20190530\"\n this._capabilities = {\n incrementalProgram: false,\n solutionBuilder: this._typescriptParsedVersion.major >= 3\n };\n\n if (\n this._typescriptParsedVersion.major > 3 ||\n (this._typescriptParsedVersion.major === 3 && this._typescriptParsedVersion.minor >= 6)\n ) {\n this._capabilities.incrementalProgram = true;\n }\n\n this._useSolutionBuilder = !!this._configuration.buildProjectReferences;\n if (this._useSolutionBuilder && !this._capabilities.solutionBuilder) {\n throw new Error(\n `Building project references requires TypeScript@>=3.0, but the current version is ${this._typescriptVersion}`\n );\n }\n\n // Report a warning if the TypeScript version is too old/new. The current oldest supported version is\n // TypeScript 2.9. Prior to that the \"ts.getConfigFileParsingDiagnostics()\" API is missing; more fixups\n // would be required to deal with that. We won't do that work unless someone requests it.\n if (\n this._typescriptParsedVersion.major < OLDEST_SUPPORTED_TS_MAJOR_VERSION ||\n (this._typescriptParsedVersion.major === OLDEST_SUPPORTED_TS_MAJOR_VERSION &&\n this._typescriptParsedVersion.minor < OLDEST_SUPPORTED_TS_MINOR_VERSION)\n ) {\n // We don't use writeWarningLine() here because, if the person wants to take their chances with\n // a seemingly unsupported compiler, their build should be allowed to succeed.\n this._typescriptTerminal.writeLine(\n `The TypeScript compiler version ${this._typescriptVersion} is very old` +\n ` and has not been tested with Heft; it may not work correctly.`\n );\n } else if (\n this._typescriptParsedVersion.major > NEWEST_SUPPORTED_TS_MAJOR_VERSION ||\n (this._typescriptParsedVersion.major === NEWEST_SUPPORTED_TS_MAJOR_VERSION &&\n this._typescriptParsedVersion.minor > NEWEST_SUPPORTED_TS_MINOR_VERSION)\n ) {\n this._typescriptTerminal.writeLine(\n `The TypeScript compiler version ${this._typescriptVersion} is newer` +\n ' than the latest version that was tested with Heft ' +\n `(${NEWEST_SUPPORTED_TS_MAJOR_VERSION}.${NEWEST_SUPPORTED_TS_MINOR_VERSION}); it may not work correctly.`\n );\n }\n\n const ts: ExtendedTypeScript = require(this._configuration.typeScriptToolPath);\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 this._tool = {\n ts,\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 clearTimeout(timeout: IPendingWork): void {\n pendingOperations.delete(timeout);\n },\n\n setTimeout<T extends unknown[]>(fn: (...args: T) => void, ms: number, ...args: T): IPendingWork {\n const timeout: IPendingWork = () => {\n fn(...args);\n };\n pendingOperations.add(timeout);\n if (!this.executing && onChangeDetected) {\n onChangeDetected();\n }\n return timeout;\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 = this._loadTsconfig(ts);\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);\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 = this._loadTsconfig(ts);\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 = this._loadTsconfig(ts);\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);\n }\n\n private _logDiagnostics(ts: ExtendedTypeScript, rawDiagnostics: TTypescript.Diagnostic[]): void {\n const diagnostics: readonly TTypescript.Diagnostic[] = ts.sortAndDeduplicateDiagnostics(rawDiagnostics);\n\n if (diagnostics.length > 0) {\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 this._printDiagnosticMessage(ts, diagnostic, diagnosticCategory);\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 _loadTsconfig(ts: ExtendedTypeScript): TTypescript.ParsedCommandLine {\n const parsedConfigFile: ReturnType<typeof ts.readConfigFile> = ts.readConfigFile(\n this._configuration.tsconfigPath,\n ts.sys.readFile\n );\n\n const currentFolder: string = path.dirname(this._configuration.tsconfigPath);\n const tsconfig: TTypescript.ParsedCommandLine = ts.parseJsonConfigFileContent(\n parsedConfigFile.config,\n {\n fileExists: ts.sys.fileExists,\n readFile: ts.sys.readFile,\n readDirectory: ts.sys.readDirectory,\n useCaseSensitiveFileNames: true\n },\n currentFolder,\n /*existingOptions:*/ undefined,\n this._configuration.tsconfigPath\n );\n\n if (tsconfig.options.incremental) {\n tsconfig.options.tsBuildInfoFile = this._tsCacheFilePath;\n }\n\n return tsconfig;\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 } = tool;\n\n const solutionBuilderHost: TTypescript.SolutionBuilderHost<TTypescript.EmitAndSemanticDiagnosticsBuilderProgram> =\n ts.createSolutionBuilderHost(\n ts.sys,\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 } = tool;\n\n let compilerHost: TTypescript.CompilerHost | undefined;\n\n if (tsconfig.options.incremental) {\n compilerHost = ts.createIncrementalCompilerHost(tsconfig.options, ts.sys);\n } else {\n compilerHost = ts.createCompilerHost(tsconfig.options);\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 } = 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 ts.sys,\n this._getCreateBuilderProgram(ts),\n tool.reportDiagnostic,\n reportWatchStatus,\n tsconfig.projectReferences,\n tsconfig.watchOptions\n );\n\n compilerHost.clearTimeout = tool.clearTimeout;\n compilerHost.setTimeout = tool.setTimeout;\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 // 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 } = tool;\n\n const host: TWatchSolutionHost = ts.createSolutionBuilderWithWatchHost(\n ts.sys,\n this._getCreateBuilderProgram(ts),\n reportDiagnostic,\n reportDiagnostic,\n reportDiagnostic\n );\n\n host.clearTimeout = tool.clearTimeout;\n host.setTimeout = tool.setTimeout;\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 { pendingTranspilePromises, pendingTranspileSignals } = tool;\n let maybeWorker: Worker | undefined = tool.worker;\n if (!maybeWorker) {\n const workerData: ITypescriptWorkerData = {\n typeScriptToolPath: this._configuration.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 changedFilesSet: Set<string> = (\n builderProgram as unknown as { getState(): { changedFilesSet: Set<string> } }\n ).getState().changedFilesSet;\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,+CAAiC;AACjC,2CAA6B;AAC7B,mDAAwC;AAExC,+CAAiC;AAEjC,oEAA4G;AAY5G,iFAA8E;AAuF9E,MAAM,iCAAiC,GAAW,CAAC,CAAC;AACpD,MAAM,iCAAiC,GAAW,CAAC,CAAC;AAEpD,MAAM,iCAAiC,GAAW,CAAC,CAAC;AACpD,MAAM,iCAAiC,GAAW,CAAC,CAAC;AAyBpD,MAAa,iBAAiB;IAoB5B,IAAY,gBAAgB;QAC1B,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE;YAC3B,iHAAiH;YACjH,0DAA0D;YAC1D,MA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AAG,IAAI,CAAC;QACxB,IAAI,MAAM,EAAE;YACV,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YAC1B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;SACzB;IACH,CAAC;CACF;AAvoCD,8CAuoCC;AAED,SAAS,qCAAqC,CAC5C,cAA0C;IAE1C,MAAM,eAAe,GACnB,cACD,CAAC,QAAQ,EAAE,CAAC,eAAe,CAAC;IAC7B,MAAM,gBAAgB,GAAwB,IAAI,GAAG,EAAE,CAAC;IACxD,KAAK,MAAM,QAAQ,IAAI,eAAe,EAAE;QACtC,MAAM,UAAU,GAAuC,cAAc,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC9F,IAAI,UAAU,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE;YAC/C,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;SAC5D;KACF;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;QACjD,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE;YACjC,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;SAC5D;KACF;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 'crypto';\nimport * as path from 'path';\nimport { Worker } from 'worker_threads';\n\nimport * as semver from 'semver';\nimport type * as TTypescript from 'typescript';\nimport { type ITerminal, JsonFile, type IPackageJson, Path, FileError } from '@rushstack/node-core-library';\nimport type { IScopedLogger } from '@rushstack/heft';\n\nimport type { ExtendedTypeScript, IExtendedSolutionBuilder } from './internalTypings/TypeScriptInternals';\nimport type { ITypeScriptConfigurationJson } from './TypeScriptPlugin';\nimport type { PerformanceMeasurer } from './Performance';\nimport type {\n ICachedEmitModuleKind,\n ITranspilationRequestMessage,\n ITranspilationResponseMessage,\n ITypescriptWorkerData\n} from './types';\nimport { configureProgramForMultiEmit } from './configureProgramForMultiEmit';\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 typeScriptToolPath: string;\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 ICompilerCapabilities {\n /**\n * Support for incremental compilation via `ts.createIncrementalProgram()`.\n * Introduced with TypeScript 3.6.\n */\n incrementalProgram: boolean;\n\n /**\n * Support for composite projects via `ts.createSolutionBuilder()`.\n * Introduced with TypeScript 3.0.\n */\n solutionBuilder: boolean;\n}\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\nconst OLDEST_SUPPORTED_TS_MAJOR_VERSION: number = 2;\nconst OLDEST_SUPPORTED_TS_MINOR_VERSION: number = 9;\n\nconst NEWEST_SUPPORTED_TS_MAJOR_VERSION: number = 5;\nconst NEWEST_SUPPORTED_TS_MINOR_VERSION: number = 0;\n\ninterface ITypeScriptTool {\n ts: ExtendedTypeScript;\n system: TTypescript.System;\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 _typescriptVersion!: string;\n private _typescriptParsedVersion!: semver.SemVer;\n\n private _capabilities!: ICompilerCapabilities;\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 configHash.update(JSON.stringify(this._configuration.additionalModuleKindsToEmit || {}));\n const serializedConfigHash: string = configHash\n .digest('base64')\n .slice(0, 8)\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_');\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 // Determine the compiler version\n const compilerPackageJsonFilename: string = path.join(\n this._configuration.typeScriptToolPath,\n 'package.json'\n );\n const packageJson: IPackageJson = await JsonFile.loadAsync(compilerPackageJsonFilename);\n this._typescriptVersion = packageJson.version;\n const parsedVersion: semver.SemVer | null = semver.parse(this._typescriptVersion);\n if (!parsedVersion) {\n throw new Error(\n `Unable to parse version \"${this._typescriptVersion}\" for TypeScript compiler package in: ` +\n compilerPackageJsonFilename\n );\n }\n this._typescriptParsedVersion = parsedVersion;\n\n // Detect what features this compiler supports. Note that manually comparing major/minor numbers\n // loosens the matching to accept prereleases such as \"3.6.0-dev.20190530\"\n this._capabilities = {\n incrementalProgram: false,\n solutionBuilder: this._typescriptParsedVersion.major >= 3\n };\n\n if (\n this._typescriptParsedVersion.major > 3 ||\n (this._typescriptParsedVersion.major === 3 && this._typescriptParsedVersion.minor >= 6)\n ) {\n this._capabilities.incrementalProgram = true;\n }\n\n this._useSolutionBuilder = !!this._configuration.buildProjectReferences;\n if (this._useSolutionBuilder && !this._capabilities.solutionBuilder) {\n throw new Error(\n `Building project references requires TypeScript@>=3.0, but the current version is ${this._typescriptVersion}`\n );\n }\n\n // Report a warning if the TypeScript version is too old/new. The current oldest supported version is\n // TypeScript 2.9. Prior to that the \"ts.getConfigFileParsingDiagnostics()\" API is missing; more fixups\n // would be required to deal with that. We won't do that work unless someone requests it.\n if (\n this._typescriptParsedVersion.major < OLDEST_SUPPORTED_TS_MAJOR_VERSION ||\n (this._typescriptParsedVersion.major === OLDEST_SUPPORTED_TS_MAJOR_VERSION &&\n this._typescriptParsedVersion.minor < OLDEST_SUPPORTED_TS_MINOR_VERSION)\n ) {\n // We don't use writeWarningLine() here because, if the person wants to take their chances with\n // a seemingly unsupported compiler, their build should be allowed to succeed.\n this._typescriptTerminal.writeLine(\n `The TypeScript compiler version ${this._typescriptVersion} is very old` +\n ` and has not been tested with Heft; it may not work correctly.`\n );\n } else if (\n this._typescriptParsedVersion.major > NEWEST_SUPPORTED_TS_MAJOR_VERSION ||\n (this._typescriptParsedVersion.major === NEWEST_SUPPORTED_TS_MAJOR_VERSION &&\n this._typescriptParsedVersion.minor > NEWEST_SUPPORTED_TS_MINOR_VERSION)\n ) {\n this._typescriptTerminal.writeLine(\n `The TypeScript compiler version ${this._typescriptVersion} is newer` +\n ' than the latest version that was tested with Heft ' +\n `(${NEWEST_SUPPORTED_TS_MAJOR_VERSION}.${NEWEST_SUPPORTED_TS_MINOR_VERSION}); it may not work correctly.`\n );\n }\n\n const ts: ExtendedTypeScript = require(this._configuration.typeScriptToolPath);\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 // Need to also update watchFile and watchDirectory\n const system: TTypescript.System = {\n ...ts.sys,\n getCurrentDirectory: () => this._configuration.buildFolderPath,\n clearTimeout,\n setTimeout\n };\n\n this._tool = {\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 = this._loadTsconfig(ts);\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 = this._loadTsconfig(ts);\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 = this._loadTsconfig(ts);\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 _loadTsconfig(ts: ExtendedTypeScript): TTypescript.ParsedCommandLine {\n const parsedConfigFile: ReturnType<typeof ts.readConfigFile> = ts.readConfigFile(\n this._configuration.tsconfigPath,\n ts.sys.readFile\n );\n\n const currentFolder: string = path.dirname(this._configuration.tsconfigPath);\n const tsconfig: TTypescript.ParsedCommandLine = ts.parseJsonConfigFileContent(\n parsedConfigFile.config,\n {\n fileExists: ts.sys.fileExists,\n readFile: ts.sys.readFile,\n readDirectory: ts.sys.readDirectory,\n useCaseSensitiveFileNames: true\n },\n currentFolder,\n /*existingOptions:*/ undefined,\n this._configuration.tsconfigPath\n );\n\n if (tsconfig.options.incremental) {\n tsconfig.options.tsBuildInfoFile = this._tsCacheFilePath;\n }\n\n return tsconfig;\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 } = tool;\n\n const solutionBuilderHost: TTypescript.SolutionBuilderHost<TTypescript.EmitAndSemanticDiagnosticsBuilderProgram> =\n ts.createSolutionBuilderHost(\n ts.sys,\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.createCompilerHost(tsconfig.options, undefined, system);\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 { pendingTranspilePromises, pendingTranspileSignals } = tool;\n let maybeWorker: Worker | undefined = tool.worker;\n if (!maybeWorker) {\n const workerData: ITypescriptWorkerData = {\n typeScriptToolPath: this._configuration.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 changedFilesSet: Set<string> = (\n builderProgram as unknown as { getState(): { changedFilesSet: Set<string> } }\n ).getState().changedFilesSet;\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"]}
@@ -56,11 +56,6 @@ export interface ITypeScriptConfigurationJson {
56
56
  * so that these files can be resolved by import statements.
57
57
  */
58
58
  staticAssetsToCopy?: IStaticAssetsCopyConfiguration;
59
- /**
60
- * Set this to change the maximum number of file handles that will be opened concurrently for writing.
61
- * The default is 50.
62
- */
63
- maxWriteParallelism?: number;
64
59
  }
65
60
  /**
66
61
  * @beta
@@ -1 +1 @@
1
- {"version":3,"file":"TypeScriptPlugin.d.ts","sourceRoot":"","sources":["../src/TypeScriptPlugin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,WAAW,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEhF,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EAKhB,MAAM,iBAAiB,CAAC;AAIzB;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,mBAAyC,CAAC;AAEpE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACxE,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,cAAc,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BAA0B;YA2D1B,uBAAuB;CAYtC"}
@@ -24,6 +24,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  __setModuleDefault(result, mod);
25
25
  return result;
26
26
  };
27
+ var __importDefault = (this && this.__importDefault) || function (mod) {
28
+ return (mod && mod.__esModule) ? mod : { "default": mod };
29
+ };
27
30
  Object.defineProperty(exports, "__esModule", { value: true });
28
31
  exports.loadPartialTsconfigFileAsync = exports.loadTypeScriptConfigurationFileAsync = exports.PLUGIN_NAME = void 0;
29
32
  const path = __importStar(require("path"));
@@ -31,6 +34,8 @@ const tapable_1 = require("tapable");
31
34
  const node_core_library_1 = require("@rushstack/node-core-library");
32
35
  const heft_config_file_1 = require("@rushstack/heft-config-file");
33
36
  const TypeScriptBuilder_1 = require("./TypeScriptBuilder");
37
+ const anything_schema_json_1 = __importDefault(require("./schemas/anything.schema.json"));
38
+ const typescript_schema_json_1 = __importDefault(require("./schemas/typescript.schema.json"));
34
39
  /**
35
40
  * The name of the plugin, as specified in heft-plugin.json
36
41
  *
@@ -49,10 +54,9 @@ async function loadTypeScriptConfigurationFileAsync(heftConfiguration, terminal)
49
54
  if (!typescriptConfigurationFilePromise) {
50
55
  // Ensure that the file loader has been initialized.
51
56
  if (!_typeScriptConfigurationFileLoader) {
52
- const schemaPath = `${__dirname}/schemas/typescript.schema.json`;
53
57
  _typeScriptConfigurationFileLoader = new heft_config_file_1.ConfigurationFile({
54
58
  projectRelativeFilePath: 'config/typescript.json',
55
- jsonSchemaPath: schemaPath,
59
+ jsonSchemaObject: typescript_schema_json_1.default,
56
60
  propertyInheritance: {
57
61
  staticAssetsToCopy: {
58
62
  // When merging objects, arrays will be automatically appended
@@ -71,7 +75,9 @@ exports.loadTypeScriptConfigurationFileAsync = loadTypeScriptConfigurationFileAs
71
75
  let _partialTsconfigFileLoader;
72
76
  const _partialTsconfigFilePromiseCache = new Map();
73
77
  function getTsconfigFilePath(heftConfiguration, typeScriptConfigurationJson) {
74
- return node_core_library_1.Path.convertToSlashes(`${heftConfiguration.buildFolderPath}/${(typeScriptConfigurationJson === null || typeScriptConfigurationJson === void 0 ? void 0 : typeScriptConfigurationJson.project) || './tsconfig.json'}`);
78
+ return node_core_library_1.Path.convertToSlashes(
79
+ // Use path.resolve because the path can start with `./` or `../`
80
+ path.resolve(heftConfiguration.buildFolderPath, (typeScriptConfigurationJson === null || typeScriptConfigurationJson === void 0 ? void 0 : typeScriptConfigurationJson.project) || './tsconfig.json'));
75
81
  }
76
82
  /**
77
83
  * @beta
@@ -93,10 +99,9 @@ async function loadPartialTsconfigFileAsync(heftConfiguration, terminal, typeScr
93
99
  else {
94
100
  // Ensure that the file loader has been initialized.
95
101
  if (!_partialTsconfigFileLoader) {
96
- const schemaPath = `${__dirname}/schemas/anything.schema.json`;
97
102
  _partialTsconfigFileLoader = new heft_config_file_1.ConfigurationFile({
98
- projectRelativeFilePath: 'tsconfig.json',
99
- jsonSchemaPath: schemaPath,
103
+ projectRelativeFilePath: (typeScriptConfigurationJson === null || typeScriptConfigurationJson === void 0 ? void 0 : typeScriptConfigurationJson.project) || 'tsconfig.json',
104
+ jsonSchemaObject: anything_schema_json_1.default,
100
105
  propertyInheritance: {
101
106
  compilerOptions: {
102
107
  inheritanceType: heft_config_file_1.InheritanceType.merge
@@ -186,9 +191,8 @@ class TypeScriptPlugin {
186
191
  // Build out the configuration
187
192
  const typeScriptBuilderConfiguration = {
188
193
  buildFolderPath: heftConfiguration.buildFolderPath,
189
- // Use tempFolderPath instead of cacheFolderPath. Running a clean will delete build outputs
190
- // which the metadata file will imply are unchanged, causing typescript to avoid building
191
- // these files. Since cleaning will delete files in the temp folder path, place it there.
194
+ // Build metadata is just another build output, but we put it in the temp folder because it will
195
+ // usually be discarded when published.
192
196
  buildMetadataFolderPath: taskSession.tempFolderPath,
193
197
  typeScriptToolPath: typeScriptToolPath,
194
198
  buildProjectReferences: typeScriptConfigurationJson === null || typeScriptConfigurationJson === void 0 ? void 0 : typeScriptConfigurationJson.buildProjectReferences,
@@ -197,8 +201,6 @@ class TypeScriptPlugin {
197
201
  additionalModuleKindsToEmit: typeScriptConfigurationJson === null || typeScriptConfigurationJson === void 0 ? void 0 : typeScriptConfigurationJson.additionalModuleKindsToEmit,
198
202
  emitCjsExtensionForCommonJS: !!(typeScriptConfigurationJson === null || typeScriptConfigurationJson === void 0 ? void 0 : typeScriptConfigurationJson.emitCjsExtensionForCommonJS),
199
203
  emitMjsExtensionForESModule: !!(typeScriptConfigurationJson === null || typeScriptConfigurationJson === void 0 ? void 0 : typeScriptConfigurationJson.emitMjsExtensionForESModule),
200
- // watchMode: watchMode,
201
- maxWriteParallelism: (typeScriptConfigurationJson === null || typeScriptConfigurationJson === void 0 ? void 0 : typeScriptConfigurationJson.maxWriteParallelism) || 50,
202
204
  scopedLogger: taskSession.logger,
203
205
  emitChangedFilesCallback: (program, changedFiles) => {
204
206
  // Provide the typescript program dependent plugins
@@ -1 +1 @@
1
- {"version":3,"file":"TypeScriptPlugin.js","sourceRoot":"","sources":["../src/TypeScriptPlugin.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAG7B,qCAAmC;AACnC,oEAAgF;AAChF,kEAAuG;AAWvG,2DAAyF;AAEzF;;;;GAIG;AACU,QAAA,WAAW,GAAwB,mBAAmB,CAAC;AAoGpE,IAAI,kCAA+F,CAAC;AACpG,MAAM,wCAAwC,GAG1C,IAAI,GAAG,EAAE,CAAC;AAEd;;GAEG;AACI,KAAK,UAAU,oCAAoC,CACxD,iBAAoC,EACpC,QAAmB;IAEnB,MAAM,eAAe,GAAW,iBAAiB,CAAC,eAAe,CAAC;IAElE,wBAAwB;IACxB,IAAI,kCAAkC,GACpC,wCAAwC,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAEhE,IAAI,CAAC,kCAAkC,EAAE;QACvC,oDAAoD;QACpD,IAAI,CAAC,kCAAkC,EAAE;YACvC,MAAM,UAAU,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E;oBAC7C,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;iBAClE;YACH,CAAC;SACF,CAAC;QAEF,kBAAkB;QAClB,MAAM,iBAAiB,GAAsB,IAAI,qCAAiB,CAAC,8BAA8B,CAAC,CAAC;QACnG,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAEO,KAAK,CAAC,uBAAuB,CACnC,WAA6B,EAC7B,iBAAoC,EACpC,uBAAiE;;QAEjE,MAAM,mBAAmB,GAAiC,MAAM,4BAA4B,CAC1F,iBAAiB,EACjB,WAAW,CAAC,MAAM,CAAC,QAAQ,EAC3B,uBAAuB,CACxB,CAAC;QACF,OAAO,MAAA,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,eAAe,0CAAE,MAAM,CAAC;IACtD,CAAC;CACF;AAtKD,mCAsKC","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 'path';\n\nimport type * as TTypescript from 'typescript';\nimport { SyncHook } from 'tapable';\nimport { FileSystem, Path, type ITerminal } from '@rushstack/node-core-library';\nimport { ConfigurationFile, InheritanceType, PathResolutionMethod } from '@rushstack/heft-config-file';\nimport type {\n HeftConfiguration,\n IHeftTaskSession,\n IHeftTaskPlugin,\n IHeftTaskRunHookOptions,\n IHeftTaskRunIncrementalHookOptions,\n ICopyOperation,\n IHeftTaskFileOperations\n} from '@rushstack/heft';\n\nimport { TypeScriptBuilder, ITypeScriptBuilderConfiguration } from './TypeScriptBuilder';\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 * @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 * 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 * Set this to change the maximum number of file handles that will be opened concurrently for writing.\n * The default is 50.\n */\n maxWriteParallelism?: number;\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\nlet _typeScriptConfigurationFileLoader: ConfigurationFile<ITypeScriptConfigurationJson> | undefined;\nconst _typeScriptConfigurationFilePromiseCache: Map<\n string,\n Promise<ITypeScriptConfigurationJson | undefined>\n> = new Map();\n\n/**\n * @beta\n */\nexport async function loadTypeScriptConfigurationFileAsync(\n heftConfiguration: HeftConfiguration,\n terminal: ITerminal\n): Promise<ITypeScriptConfigurationJson | undefined> {\n const buildFolderPath: string = heftConfiguration.buildFolderPath;\n\n // Check the cache first\n let typescriptConfigurationFilePromise: Promise<ITypeScriptConfigurationJson | undefined> | undefined =\n _typeScriptConfigurationFilePromiseCache.get(buildFolderPath);\n\n if (!typescriptConfigurationFilePromise) {\n // Ensure that the file loader has been initialized.\n if (!_typeScriptConfigurationFileLoader) {\n const schemaPath: string = `${__dirname}/schemas/typescript.schema.json`;\n _typeScriptConfigurationFileLoader = new ConfigurationFile<ITypeScriptConfigurationJson>({\n projectRelativeFilePath: 'config/typescript.json',\n jsonSchemaPath: schemaPath,\n propertyInheritance: {\n staticAssetsToCopy: {\n // When merging objects, arrays will be automatically appended\n inheritanceType: InheritanceType.merge\n }\n }\n });\n }\n\n typescriptConfigurationFilePromise =\n _typeScriptConfigurationFileLoader.tryLoadConfigurationFileForProjectAsync(\n terminal,\n buildFolderPath,\n heftConfiguration.rigConfig\n );\n _typeScriptConfigurationFilePromiseCache.set(buildFolderPath, typescriptConfigurationFilePromise);\n }\n\n return await typescriptConfigurationFilePromise;\n}\n\nlet _partialTsconfigFileLoader: ConfigurationFile<IPartialTsconfig> | undefined;\nconst _partialTsconfigFilePromiseCache: Map<string, Promise<IPartialTsconfig | undefined>> = new Map();\n\nfunction getTsconfigFilePath(\n heftConfiguration: HeftConfiguration,\n typeScriptConfigurationJson?: ITypeScriptConfigurationJson\n): string {\n return Path.convertToSlashes(\n `${heftConfiguration.buildFolderPath}/${typeScriptConfigurationJson?.project || './tsconfig.json'}`\n );\n}\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(heftConfiguration, typeScriptConfigurationJson);\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 const schemaPath: string = `${__dirname}/schemas/anything.schema.json`;\n _partialTsconfigFileLoader = new ConfigurationFile<IPartialTsconfig>({\n projectRelativeFilePath: 'tsconfig.json',\n jsonSchemaPath: schemaPath,\n propertyInheritance: {\n compilerOptions: {\n inheritanceType: InheritanceType.merge\n }\n },\n jsonPathMetadata: {\n '$.compilerOptions.outDir': {\n pathResolutionMethod: PathResolutionMethod.resolvePathRelativeToConfigurationFile\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\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._getStaticAssetCopyOperations(\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 _getStaticAssetCopyOperations(\n taskSession: IHeftTaskSession,\n heftConfiguration: HeftConfiguration\n ): Promise<ICopyOperation[]> {\n const typeScriptConfiguration: ITypeScriptConfigurationJson | undefined =\n await loadTypeScriptConfigurationFileAsync(heftConfiguration, taskSession.logger.terminal);\n\n // We only care about the copy if static assets were specified.\n const copyOperations: ICopyOperation[] = [];\n if (\n typeScriptConfiguration?.staticAssetsToCopy?.fileExtensions?.length ||\n typeScriptConfiguration?.staticAssetsToCopy?.includeGlobs?.length ||\n typeScriptConfiguration?.staticAssetsToCopy?.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 = await this._getTsconfigOutDirAsync(\n taskSession,\n heftConfiguration,\n typeScriptConfiguration\n );\n if (tsconfigOutDir) {\n destinationFolderPaths.add(tsconfigOutDir);\n }\n for (const emitModule of typeScriptConfiguration?.additionalModuleKindsToEmit || []) {\n destinationFolderPaths.add(`${heftConfiguration.buildFolderPath}/${emitModule.outFolderName}`);\n }\n\n copyOperations.push({\n ...typeScriptConfiguration?.staticAssetsToCopy,\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 return copyOperations;\n }\n\n private async _getTypeScriptBuilderAsync(\n taskSession: IHeftTaskSession,\n heftConfiguration: HeftConfiguration\n ): Promise<TypeScriptBuilder | false> {\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 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 const typeScriptToolPath: string = await heftConfiguration.rigPackageResolver.resolvePackageAsync(\n 'typescript',\n terminal\n );\n\n // Build out the configuration\n const typeScriptBuilderConfiguration: ITypeScriptBuilderConfiguration = {\n buildFolderPath: heftConfiguration.buildFolderPath,\n // Use tempFolderPath instead of cacheFolderPath. Running a clean will delete build outputs\n // which the metadata file will imply are unchanged, causing typescript to avoid building\n // these files. Since cleaning will delete files in the temp folder path, place it there.\n buildMetadataFolderPath: taskSession.tempFolderPath,\n typeScriptToolPath: typeScriptToolPath,\n\n buildProjectReferences: typeScriptConfigurationJson?.buildProjectReferences,\n\n useTranspilerWorker: typeScriptConfigurationJson?.useTranspilerWorker,\n\n tsconfigPath: getTsconfigFilePath(heftConfiguration, typeScriptConfigurationJson),\n additionalModuleKindsToEmit: typeScriptConfigurationJson?.additionalModuleKindsToEmit,\n emitCjsExtensionForCommonJS: !!typeScriptConfigurationJson?.emitCjsExtensionForCommonJS,\n emitMjsExtensionForESModule: !!typeScriptConfigurationJson?.emitMjsExtensionForESModule,\n // watchMode: watchMode,\n maxWriteParallelism: typeScriptConfigurationJson?.maxWriteParallelism || 50,\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 _getTsconfigOutDirAsync(\n taskSession: IHeftTaskSession,\n heftConfiguration: HeftConfiguration,\n typeScriptConfiguration: ITypeScriptConfigurationJson | undefined\n ): Promise<string | undefined> {\n const partialTsconfigFile: IPartialTsconfig | undefined = await loadPartialTsconfigFileAsync(\n heftConfiguration,\n taskSession.logger.terminal,\n typeScriptConfiguration\n );\n return partialTsconfigFile?.compilerOptions?.outDir;\n }\n}\n"]}
1
+ {"version":3,"file":"TypeScriptPlugin.js","sourceRoot":"","sources":["../src/TypeScriptPlugin.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAG7B,qCAAmC;AACnC,oEAAgF;AAChF,kEAAuG;AAWvG,2DAAyF;AACzF,0FAA4D;AAC5D,8FAAsE;AAEtE;;;;GAIG;AACU,QAAA,WAAW,GAAwB,mBAAmB,CAAC;AA8FpE,IAAI,kCAA+F,CAAC;AACpG,MAAM,wCAAwC,GAG1C,IAAI,GAAG,EAAE,CAAC;AAEd;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YAAY,EAAE,WAAW,CAAC,MAAM;YAChC,wBAAwB,EAAE,CACxB,OAA4B,EAC5B,YAA0C,EAC1C,EAAE;gBACF,mDAAmD;gBACnD,IAAI,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,MAAM,EAAE,EAAE;oBAC7C,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;iBAClE;YACH,CAAC;SACF,CAAC;QAEF,kBAAkB;QAClB,MAAM,iBAAiB,GAAsB,IAAI,qCAAiB,CAAC,8BAA8B,CAAC,CAAC;QACnG,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAEO,KAAK,CAAC,uBAAuB,CACnC,WAA6B,EAC7B,iBAAoC,EACpC,uBAAiE;;QAEjE,MAAM,mBAAmB,GAAiC,MAAM,4BAA4B,CAC1F,iBAAiB,EACjB,WAAW,CAAC,MAAM,CAAC,QAAQ,EAC3B,uBAAuB,CACxB,CAAC;QACF,OAAO,MAAA,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,eAAe,0CAAE,MAAM,CAAC;IACtD,CAAC;CACF;AAnKD,mCAmKC","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 'path';\n\nimport type * as TTypescript from 'typescript';\nimport { SyncHook } from 'tapable';\nimport { FileSystem, Path, type ITerminal } from '@rushstack/node-core-library';\nimport { ConfigurationFile, InheritanceType, PathResolutionMethod } from '@rushstack/heft-config-file';\nimport type {\n HeftConfiguration,\n IHeftTaskSession,\n IHeftTaskPlugin,\n IHeftTaskRunHookOptions,\n IHeftTaskRunIncrementalHookOptions,\n ICopyOperation,\n IHeftTaskFileOperations\n} from '@rushstack/heft';\n\nimport { TypeScriptBuilder, ITypeScriptBuilderConfiguration } from './TypeScriptBuilder';\nimport anythingSchema from './schemas/anything.schema.json';\nimport typescriptConfigSchema from './schemas/typescript.schema.json';\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 * @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 * 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\nlet _typeScriptConfigurationFileLoader: ConfigurationFile<ITypeScriptConfigurationJson> | undefined;\nconst _typeScriptConfigurationFilePromiseCache: Map<\n string,\n Promise<ITypeScriptConfigurationJson | undefined>\n> = new Map();\n\n/**\n * @beta\n */\nexport async function loadTypeScriptConfigurationFileAsync(\n heftConfiguration: HeftConfiguration,\n terminal: ITerminal\n): Promise<ITypeScriptConfigurationJson | undefined> {\n const buildFolderPath: string = heftConfiguration.buildFolderPath;\n\n // Check the cache first\n let typescriptConfigurationFilePromise: Promise<ITypeScriptConfigurationJson | undefined> | undefined =\n _typeScriptConfigurationFilePromiseCache.get(buildFolderPath);\n\n if (!typescriptConfigurationFilePromise) {\n // Ensure that the file loader has been initialized.\n if (!_typeScriptConfigurationFileLoader) {\n _typeScriptConfigurationFileLoader = new ConfigurationFile<ITypeScriptConfigurationJson>({\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 });\n }\n\n typescriptConfigurationFilePromise =\n _typeScriptConfigurationFileLoader.tryLoadConfigurationFileForProjectAsync(\n terminal,\n buildFolderPath,\n heftConfiguration.rigConfig\n );\n _typeScriptConfigurationFilePromiseCache.set(buildFolderPath, typescriptConfigurationFilePromise);\n }\n\n return await typescriptConfigurationFilePromise;\n}\n\nlet _partialTsconfigFileLoader: ConfigurationFile<IPartialTsconfig> | undefined;\nconst _partialTsconfigFilePromiseCache: Map<string, Promise<IPartialTsconfig | undefined>> = new Map();\n\nfunction getTsconfigFilePath(\n heftConfiguration: HeftConfiguration,\n typeScriptConfigurationJson?: ITypeScriptConfigurationJson\n): string {\n return Path.convertToSlashes(\n // Use path.resolve because the path can start with `./` or `../`\n path.resolve(heftConfiguration.buildFolderPath, typeScriptConfigurationJson?.project || './tsconfig.json')\n );\n}\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(heftConfiguration, typeScriptConfigurationJson);\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 ConfigurationFile<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.resolvePathRelativeToConfigurationFile\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\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._getStaticAssetCopyOperations(\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 _getStaticAssetCopyOperations(\n taskSession: IHeftTaskSession,\n heftConfiguration: HeftConfiguration\n ): Promise<ICopyOperation[]> {\n const typeScriptConfiguration: ITypeScriptConfigurationJson | undefined =\n await loadTypeScriptConfigurationFileAsync(heftConfiguration, taskSession.logger.terminal);\n\n // We only care about the copy if static assets were specified.\n const copyOperations: ICopyOperation[] = [];\n if (\n typeScriptConfiguration?.staticAssetsToCopy?.fileExtensions?.length ||\n typeScriptConfiguration?.staticAssetsToCopy?.includeGlobs?.length ||\n typeScriptConfiguration?.staticAssetsToCopy?.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 = await this._getTsconfigOutDirAsync(\n taskSession,\n heftConfiguration,\n typeScriptConfiguration\n );\n if (tsconfigOutDir) {\n destinationFolderPaths.add(tsconfigOutDir);\n }\n for (const emitModule of typeScriptConfiguration?.additionalModuleKindsToEmit || []) {\n destinationFolderPaths.add(`${heftConfiguration.buildFolderPath}/${emitModule.outFolderName}`);\n }\n\n copyOperations.push({\n ...typeScriptConfiguration?.staticAssetsToCopy,\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 return copyOperations;\n }\n\n private async _getTypeScriptBuilderAsync(\n taskSession: IHeftTaskSession,\n heftConfiguration: HeftConfiguration\n ): Promise<TypeScriptBuilder | false> {\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 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 const typeScriptToolPath: string = await heftConfiguration.rigPackageResolver.resolvePackageAsync(\n 'typescript',\n terminal\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 typeScriptToolPath: typeScriptToolPath,\n\n buildProjectReferences: typeScriptConfigurationJson?.buildProjectReferences,\n\n useTranspilerWorker: typeScriptConfigurationJson?.useTranspilerWorker,\n\n tsconfigPath: getTsconfigFilePath(heftConfiguration, typeScriptConfigurationJson),\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 _getTsconfigOutDirAsync(\n taskSession: IHeftTaskSession,\n heftConfiguration: HeftConfiguration,\n typeScriptConfiguration: ITypeScriptConfigurationJson | undefined\n ): Promise<string | undefined> {\n const partialTsconfigFile: IPartialTsconfig | undefined = await loadPartialTsconfigFileAsync(\n heftConfiguration,\n taskSession.logger.terminal,\n typeScriptConfiguration\n );\n return partialTsconfigFile?.compilerOptions?.outDir;\n }\n}\n"]}
@@ -38,6 +38,7 @@ export interface IExtendedTypeScript {
38
38
  transpileOptionValue: any;
39
39
  }[];
40
40
  getNewLineCharacter(compilerOptions: TTypescript.CompilerOptions): string;
41
+ createCompilerHost(options: TTypescript.CompilerOptions, setParentNodes?: boolean, system?: TTypescript.System): TTypescript.CompilerHost;
41
42
  /**
42
43
  * https://github.com/microsoft/TypeScript/blob/782c09d783e006a697b4ba6d1e7ec2f718ce8393/src/compiler/utilities.ts#L6540
43
44
  */
@@ -1 +1 @@
1
- {"version":3,"file":"TypeScriptInternals.d.ts","sourceRoot":"","sources":["../../src/internalTypings/TypeScriptIntern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AAM,EAAE,CAAC;IAEZ,WAAW,EAAE;QAGX,uCAAuC,EAAE,WAAW,CAAC,iBAAiB,CAAC;QAIvE,wCAAwC,EAAE,WAAW,CAAC,iBAAiB,CAAC;QAIxE,+EAA+E,EAAE,WAAW,CAAC,iBAAiB,CAAC;QAI/G,6FAA6F,EAAE,WAAW,CAAC,iBAAiB,CAAC;KAC9H,CAAC;CACH;AAED,MAAM,MAAM,kBAAkB,GAAG,OAAO,WAAW,GAAG,mBAAmB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"TypeScriptInternals.js","sourceRoot":"","sources":["../../src/internalTypings/TypeScriptInternals.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 IExtendedSolutionBuilder\n extends TTypescript.SolutionBuilder<TTypescript.EmitAndSemanticDiagnosticsBuilderProgram> {\n getBuildOrder(): readonly string[];\n invalidateProject(configFilePath: string, mode: 0 | 1 | 2): void;\n}\n\nexport interface IExtendedTypeScript {\n /**\n * https://github.com/microsoft/TypeScript/blob/5f597e69b2e3b48d788cb548df40bcb703c8adb1/src/compiler/performance.ts#L3\n */\n performance: {\n /**\n * https://github.com/microsoft/TypeScript/blob/5f597e69b2e3b48d788cb548df40bcb703c8adb1/src/compiler/performance.ts#L119-L121\n */\n disable(): void;\n\n /**\n * https://github.com/microsoft/TypeScript/blob/5f597e69b2e3b48d788cb548df40bcb703c8adb1/src/compiler/performance.ts#L110-L116\n */\n enable(): void;\n\n /**\n * https://github.com/microsoft/TypeScript/blob/5f597e69b2e3b48d788cb548df40bcb703c8adb1/src/compiler/performance.ts#L55-L61\n */\n mark(performanceMaker: string): void;\n\n /**\n * https://github.com/microsoft/TypeScript/blob/5f597e69b2e3b48d788cb548df40bcb703c8adb1/src/compiler/performance.ts#L72-L78\n */\n measure(measureName: string, startMarkName?: string, endMarkName?: string): void;\n\n /**\n * https://github.com/microsoft/TypeScript/blob/5f597e69b2e3b48d788cb548df40bcb703c8adb1/src/compiler/performance.ts#L94-L96\n */\n getDuration(measureName: string): number;\n\n /**\n * https://github.com/microsoft/TypeScript/blob/5f597e69b2e3b48d788cb548df40bcb703c8adb1/src/compiler/performance.ts#L85-L87\n */\n getCount(measureName: string): number;\n };\n\n transpileOptionValueCompilerOptions: {\n name: keyof TTypescript.CompilerOptions;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n transpileOptionValue: any;\n }[];\n\n getNewLineCharacter(compilerOptions: TTypescript.CompilerOptions): string;\n\n /**\n * https://github.com/microsoft/TypeScript/blob/782c09d783e006a697b4ba6d1e7ec2f718ce8393/src/compiler/utilities.ts#L6540\n */\n matchFiles(\n path: string,\n extensions: ReadonlyArray<string> | undefined,\n excludes: ReadonlyArray<string> | undefined,\n includes: ReadonlyArray<string> | undefined,\n useCaseSensitiveFileNames: boolean,\n currentDirectory: string,\n depth: number | undefined,\n getFileSystemEntries: (path: string) => {\n readonly files: ReadonlyArray<string>;\n readonly directories: ReadonlyArray<string>;\n },\n realpath: (path: string) => string,\n directoryExists: (path: string) => boolean\n ): string[];\n\n Diagnostics: {\n // https://github.com/microsoft/TypeScript/blob/5f597e69b2e3b48d788cb548df40bcb703c8adb1/src/compiler/diagnosticMessages.json#L4252-L4255\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Found_1_error_Watching_for_file_changes: TTypescript.DiagnosticMessage;\n\n // https://github.com/microsoft/TypeScript/blob/5f597e69b2e3b48d788cb548df40bcb703c8adb1/src/compiler/diagnosticMessages.json#L4256-L4259\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Found_0_errors_Watching_for_file_changes: TTypescript.DiagnosticMessage;\n\n // https://github.com/microsoft/TypeScript/blob/2428ade1a91248e847f3e1561e31a9426650efee/src/compiler/diagnosticMessages.json#L2252\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor: TTypescript.DiagnosticMessage;\n\n // https://github.com/microsoft/TypeScript/blob/2428ade1a91248e847f3e1561e31a9426650efee/src/compiler/diagnosticMessages.json#L4920\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1: TTypescript.DiagnosticMessage;\n };\n}\n\nexport type ExtendedTypeScript = typeof TTypescript & IExtendedTypeScript;\n"]}
1
+ {"version":3,"file":"TypeScriptInternals.js","sourceRoot":"","sources":["../../src/internalTypings/TypeScriptInternals.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 IExtendedSolutionBuilder\n extends TTypescript.SolutionBuilder<TTypescript.EmitAndSemanticDiagnosticsBuilderProgram> {\n getBuildOrder(): readonly string[];\n invalidateProject(configFilePath: string, mode: 0 | 1 | 2): void;\n}\n\nexport interface IExtendedTypeScript {\n /**\n * https://github.com/microsoft/TypeScript/blob/5f597e69b2e3b48d788cb548df40bcb703c8adb1/src/compiler/performance.ts#L3\n */\n performance: {\n /**\n * https://github.com/microsoft/TypeScript/blob/5f597e69b2e3b48d788cb548df40bcb703c8adb1/src/compiler/performance.ts#L119-L121\n */\n disable(): void;\n\n /**\n * https://github.com/microsoft/TypeScript/blob/5f597e69b2e3b48d788cb548df40bcb703c8adb1/src/compiler/performance.ts#L110-L116\n */\n enable(): void;\n\n /**\n * https://github.com/microsoft/TypeScript/blob/5f597e69b2e3b48d788cb548df40bcb703c8adb1/src/compiler/performance.ts#L55-L61\n */\n mark(performanceMaker: string): void;\n\n /**\n * https://github.com/microsoft/TypeScript/blob/5f597e69b2e3b48d788cb548df40bcb703c8adb1/src/compiler/performance.ts#L72-L78\n */\n measure(measureName: string, startMarkName?: string, endMarkName?: string): void;\n\n /**\n * https://github.com/microsoft/TypeScript/blob/5f597e69b2e3b48d788cb548df40bcb703c8adb1/src/compiler/performance.ts#L94-L96\n */\n getDuration(measureName: string): number;\n\n /**\n * https://github.com/microsoft/TypeScript/blob/5f597e69b2e3b48d788cb548df40bcb703c8adb1/src/compiler/performance.ts#L85-L87\n */\n getCount(measureName: string): number;\n };\n\n transpileOptionValueCompilerOptions: {\n name: keyof TTypescript.CompilerOptions;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n transpileOptionValue: any;\n }[];\n\n getNewLineCharacter(compilerOptions: TTypescript.CompilerOptions): string;\n\n createCompilerHost(\n options: TTypescript.CompilerOptions,\n setParentNodes?: boolean,\n system?: TTypescript.System\n ): TTypescript.CompilerHost;\n\n /**\n * https://github.com/microsoft/TypeScript/blob/782c09d783e006a697b4ba6d1e7ec2f718ce8393/src/compiler/utilities.ts#L6540\n */\n matchFiles(\n path: string,\n extensions: ReadonlyArray<string> | undefined,\n excludes: ReadonlyArray<string> | undefined,\n includes: ReadonlyArray<string> | undefined,\n useCaseSensitiveFileNames: boolean,\n currentDirectory: string,\n depth: number | undefined,\n getFileSystemEntries: (path: string) => {\n readonly files: ReadonlyArray<string>;\n readonly directories: ReadonlyArray<string>;\n },\n realpath: (path: string) => string,\n directoryExists: (path: string) => boolean\n ): string[];\n\n Diagnostics: {\n // https://github.com/microsoft/TypeScript/blob/5f597e69b2e3b48d788cb548df40bcb703c8adb1/src/compiler/diagnosticMessages.json#L4252-L4255\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Found_1_error_Watching_for_file_changes: TTypescript.DiagnosticMessage;\n\n // https://github.com/microsoft/TypeScript/blob/5f597e69b2e3b48d788cb548df40bcb703c8adb1/src/compiler/diagnosticMessages.json#L4256-L4259\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Found_0_errors_Watching_for_file_changes: TTypescript.DiagnosticMessage;\n\n // https://github.com/microsoft/TypeScript/blob/2428ade1a91248e847f3e1561e31a9426650efee/src/compiler/diagnosticMessages.json#L2252\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor: TTypescript.DiagnosticMessage;\n\n // https://github.com/microsoft/TypeScript/blob/2428ade1a91248e847f3e1561e31a9426650efee/src/compiler/diagnosticMessages.json#L4920\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1: TTypescript.DiagnosticMessage;\n };\n}\n\nexport type ExtendedTypeScript = typeof TTypescript & IExtendedTypeScript;\n"]}
@@ -62,11 +62,6 @@
62
62
  "type": "string"
63
63
  },
64
64
 
65
- "maxWriteParallelism": {
66
- "description": "Set this to change the maximum write parallelism. The default is 50.",
67
- "type": "number"
68
- },
69
-
70
65
  "staticAssetsToCopy": {
71
66
  "description": "Configures additional file types that should be copied into the TypeScript compiler's emit folders, for example so that these files can be resolved by import statements.",
72
67
  "type": "object",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/heft-typescript-plugin",
3
- "version": "0.2.0-rc.6",
3
+ "version": "0.2.1",
4
4
  "description": "Heft plugin for TypeScript",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,28 +12,26 @@
12
12
  "types": "dist/heft-typescript-plugin.d.ts",
13
13
  "license": "MIT",
14
14
  "peerDependencies": {
15
- "@rushstack/heft": "0.50.0"
15
+ "@rushstack/heft": "0.60.0"
16
16
  },
17
17
  "dependencies": {
18
18
  "@types/tapable": "1.0.6",
19
- "semver": "~7.3.0",
19
+ "semver": "~7.5.4",
20
20
  "tapable": "1.1.3",
21
- "@rushstack/node-core-library": "3.59.1",
22
- "@rushstack/heft-config-file": "0.12.2"
21
+ "@rushstack/node-core-library": "3.60.0",
22
+ "@rushstack/heft-config-file": "0.14.0"
23
23
  },
24
24
  "devDependencies": {
25
- "@rushstack/heft-legacy": "npm:@rushstack/heft@0.50.6",
26
- "@rushstack/heft-node-rig": "1.13.0",
27
- "@types/node": "14.18.36",
28
- "@types/semver": "7.3.5",
25
+ "@rushstack/heft-node-rig": "2.2.23",
26
+ "@types/node": "18.17.15",
27
+ "@types/semver": "7.5.0",
29
28
  "typescript": "~5.0.4",
30
- "@rushstack/eslint-config": "3.3.0",
31
- "@rushstack/heft": "0.51.0-rc.6"
29
+ "@rushstack/eslint-config": "3.3.4",
30
+ "@rushstack/heft": "0.60.0"
32
31
  },
33
32
  "scripts": {
34
- "build": "node ./node_modules/@rushstack/heft-legacy/bin/heft --unmanaged build --clean",
35
- "start": "node ./node_modules/@rushstack/heft-legacy/bin/heft --unmanaged test --clean --watch",
36
- "_phase:build": "node ./node_modules/@rushstack/heft-legacy/bin/heft --unmanaged build --clean",
37
- "_phase:test": "node ./node_modules/@rushstack/heft-legacy/bin/heft --unmanaged test --no-build"
33
+ "build": "heft test --clean",
34
+ "start": "heft build-watch",
35
+ "_phase:build": "heft run --only build -- --clean"
38
36
  }
39
37
  }