@rushstack/heft-typescript-plugin 0.1.0-rc.5 → 0.2.0-rc.6

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.
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.configureProgramForMultiEmit = void 0;
4
+ const node_core_library_1 = require("@rushstack/node-core-library");
5
+ // symbols for attaching hidden metadata to ts.Program instances.
6
+ const INNER_GET_COMPILER_OPTIONS_SYMBOL = Symbol('getCompilerOptions');
7
+ const INNER_EMIT_SYMBOL = Symbol('emit');
8
+ const JS_EXTENSION_REGEX = /\.js(\.map)?$/;
9
+ function wrapWriteFile(baseWriteFile, jsExtensionOverride) {
10
+ if (!jsExtensionOverride) {
11
+ return baseWriteFile;
12
+ }
13
+ const replacementExtension = `${jsExtensionOverride}$1`;
14
+ return (fileName, data, writeBOM, onError, sourceFiles) => {
15
+ return baseWriteFile(fileName.replace(JS_EXTENSION_REGEX, replacementExtension), data, writeBOM, onError, sourceFiles);
16
+ };
17
+ }
18
+ function configureProgramForMultiEmit(innerProgram, ts, moduleKindsToEmit, mode) {
19
+ const program = innerProgram;
20
+ // Check to see if this Program has already been modified.
21
+ let { [INNER_EMIT_SYMBOL]: innerEmit, [INNER_GET_COMPILER_OPTIONS_SYMBOL]: innerGetCompilerOptions } = program;
22
+ if (!innerGetCompilerOptions) {
23
+ program[INNER_GET_COMPILER_OPTIONS_SYMBOL] = innerGetCompilerOptions = program.getCompilerOptions;
24
+ }
25
+ if (!innerEmit) {
26
+ program[INNER_EMIT_SYMBOL] = innerEmit = program.emit;
27
+ }
28
+ let foundPrimary = false;
29
+ let defaultModuleKind;
30
+ const multiEmitMap = new Map();
31
+ for (const moduleKindToEmit of moduleKindsToEmit) {
32
+ const kindCompilerOptions = moduleKindToEmit.isPrimary
33
+ ? Object.assign({}, innerGetCompilerOptions()) : Object.assign(Object.assign({}, innerGetCompilerOptions()), { module: moduleKindToEmit.moduleKind, outDir: moduleKindToEmit.outFolderPath,
34
+ // Don't emit declarations for secondary module kinds
35
+ declaration: false, declarationMap: false });
36
+ if (!kindCompilerOptions.outDir) {
37
+ throw new node_core_library_1.InternalError('Expected compilerOptions.outDir to be assigned');
38
+ }
39
+ if (mode === 'transpile') {
40
+ kindCompilerOptions.declaration = false;
41
+ kindCompilerOptions.declarationMap = false;
42
+ }
43
+ else if (mode === 'declaration') {
44
+ kindCompilerOptions.emitDeclarationOnly = true;
45
+ }
46
+ if (moduleKindToEmit.isPrimary || mode !== 'declaration') {
47
+ multiEmitMap.set(moduleKindToEmit, kindCompilerOptions);
48
+ }
49
+ if (moduleKindToEmit.isPrimary) {
50
+ if (foundPrimary) {
51
+ throw new Error('Multiple primary module emit kinds encountered.');
52
+ }
53
+ else {
54
+ foundPrimary = true;
55
+ }
56
+ defaultModuleKind = moduleKindToEmit.moduleKind;
57
+ }
58
+ }
59
+ const changedFiles = new Set();
60
+ program.emit = (targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) => {
61
+ if (emitOnlyDtsFiles) {
62
+ return program[INNER_EMIT_SYMBOL](targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers);
63
+ }
64
+ if (targetSourceFile && changedFiles) {
65
+ changedFiles.add(targetSourceFile);
66
+ }
67
+ const originalCompilerOptions = program[INNER_GET_COMPILER_OPTIONS_SYMBOL]();
68
+ let defaultModuleKindResult;
69
+ const diagnostics = [];
70
+ let emitSkipped = false;
71
+ try {
72
+ for (const [moduleKindToEmit, kindCompilerOptions] of multiEmitMap) {
73
+ program.getCompilerOptions = () => kindCompilerOptions;
74
+ // Need to mutate the compiler options for the `module` field specifically, because emitWorker() captures
75
+ // options in the closure and passes it to `ts.getTransformers()`
76
+ originalCompilerOptions.module = moduleKindToEmit.moduleKind;
77
+ const flavorResult = program[INNER_EMIT_SYMBOL](targetSourceFile, writeFile && wrapWriteFile(writeFile, moduleKindToEmit.jsExtensionOverride), cancellationToken, emitOnlyDtsFiles, customTransformers);
78
+ emitSkipped = emitSkipped || flavorResult.emitSkipped;
79
+ // Need to aggregate diagnostics because some are impacted by the target module type
80
+ for (const diagnostic of flavorResult.diagnostics) {
81
+ diagnostics.push(diagnostic);
82
+ }
83
+ if (moduleKindToEmit.moduleKind === defaultModuleKind) {
84
+ defaultModuleKindResult = flavorResult;
85
+ }
86
+ }
87
+ const mergedDiagnostics = ts.sortAndDeduplicateDiagnostics(diagnostics);
88
+ return Object.assign(Object.assign({}, defaultModuleKindResult), { changedSourceFiles: changedFiles, diagnostics: mergedDiagnostics, emitSkipped });
89
+ }
90
+ finally {
91
+ // Restore the original compiler options and module kind for future calls
92
+ program.getCompilerOptions = program[INNER_GET_COMPILER_OPTIONS_SYMBOL];
93
+ originalCompilerOptions.module = defaultModuleKind;
94
+ }
95
+ };
96
+ return { changedFiles };
97
+ }
98
+ exports.configureProgramForMultiEmit = configureProgramForMultiEmit;
99
+ //# sourceMappingURL=configureProgramForMultiEmit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configureProgramForMultiEmit.js","sourceRoot":"","sources":["../src/configureProgramForMultiEmit.ts"],"names":[],"mappings":";;;AAGA,oEAA6D;AAK7D,iEAAiE;AACjE,MAAM,iCAAiC,GAAkB,MAAM,CAAC,oBAAoB,CAAC,CAAC;AACtF,MAAM,iBAAiB,GAAkB,MAAM,CAAC,MAAM,CAAC,CAAC;AAExD,MAAM,kBAAkB,GAAW,eAAe,CAAC;AAEnD,SAAS,aAAa,CAEpB,aAA4C,EAC5C,mBAAuC;IAEvC,IAAI,CAAC,mBAAmB,EAAE;QACxB,OAAO,aAAa,CAAC;KACtB;IAED,MAAM,oBAAoB,GAAW,GAAG,mBAAmB,IAAI,CAAC;IAChE,OAAO,CACL,QAAgB,EAChB,IAAY,EACZ,QAAiB,EACjB,OAAiD,EACjD,WAA2D,EAC3D,EAAE;QACF,OAAO,aAAa,CAClB,QAAQ,CAAC,OAAO,CAAC,k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AAC,MAAM,GAAG,gBAAgB,CAAC,UAAU,CAAC;gBAC7D,MAAM,YAAY,GAA2B,OAAO,CAAC,iBAAiB,CAAE,CACtE,gBAAgB,EAChB,SAAS,IAAI,aAAa,CAAC,SAAS,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,EAC3E,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,CACnB,CAAC;gBAEF,WAAW,GAAG,WAAW,IAAI,YAAY,CAAC,WAAW,CAAC;gBACtD,oFAAoF;gBACpF,KAAK,MAAM,UAAU,IAAI,YAAY,CAAC,WAAW,EAAE;oBACjD,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;iBAC9B;gBAED,IAAI,gBAAgB,CAAC,UAAU,KAAK,iBAAiB,EAAE;oBACrD,uBAAuB,GAAG,YAAY,CAAC;iBACxC;aACF;YAED,MAAM,iBAAiB,GACrB,EAAE,CAAC,6BAA6B,CAAC,WAAW,CAAC,CAAC;YAEhD,uCACK,uBAAwB,KAC3B,kBAAkB,EAAE,YAAY,EAChC,WAAW,EAAE,iBAAiB,EAC9B,WAAW,IACX;SACH;gBAAS;YACR,yEAAyE;YACzE,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,iCAAiC,CAAE,CAAC;YACzE,uBAAuB,CAAC,MAAM,GAAG,iBAAiB,CAAC;SACpD;IACH,CAAC,CAAC;IACF,OAAO,EAAE,YAAY,EAAE,CAAC;AAC1B,CAAC;AA7ID,oEA6IC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\nimport type * as TTypescript from 'typescript';\nimport { InternalError } from '@rushstack/node-core-library';\n\nimport type { ExtendedTypeScript } from './internalTypings/TypeScriptInternals';\nimport type { ICachedEmitModuleKind } from './types';\n\n// symbols for attaching hidden metadata to ts.Program instances.\nconst INNER_GET_COMPILER_OPTIONS_SYMBOL: unique symbol = Symbol('getCompilerOptions');\nconst INNER_EMIT_SYMBOL: unique symbol = Symbol('emit');\n\nconst JS_EXTENSION_REGEX: RegExp = /\\.js(\\.map)?$/;\n\nfunction wrapWriteFile(\n this: void,\n baseWriteFile: TTypescript.WriteFileCallback,\n jsExtensionOverride: string | undefined\n): TTypescript.WriteFileCallback {\n if (!jsExtensionOverride) {\n return baseWriteFile;\n }\n\n const replacementExtension: string = `${jsExtensionOverride}$1`;\n return (\n fileName: string,\n data: string,\n writeBOM: boolean,\n onError?: ((message: string) => void) | undefined,\n sourceFiles?: readonly TTypescript.SourceFile[] | undefined\n ) => {\n return baseWriteFile(\n fileName.replace(JS_EXTENSION_REGEX, replacementExtension),\n data,\n writeBOM,\n onError,\n sourceFiles\n );\n };\n}\n\nexport function configureProgramForMultiEmit(\n this: void,\n innerProgram: TTypescript.Program,\n ts: ExtendedTypeScript,\n moduleKindsToEmit: ICachedEmitModuleKind[],\n mode: 'transpile' | 'declaration' | 'both'\n): { changedFiles: Set<TTypescript.SourceFile> } {\n interface IProgramWithMultiEmit extends TTypescript.Program {\n // Attach the originals to the Program instance to avoid modifying the same Program twice.\n // Don't use WeakMap because this Program could theoretically get a { ... } applied to it.\n [INNER_GET_COMPILER_OPTIONS_SYMBOL]?: TTypescript.Program['getCompilerOptions'];\n [INNER_EMIT_SYMBOL]?: TTypescript.Program['emit'];\n }\n\n const program: IProgramWithMultiEmit = innerProgram;\n\n // Check to see if this Program has already been modified.\n let { [INNER_EMIT_SYMBOL]: innerEmit, [INNER_GET_COMPILER_OPTIONS_SYMBOL]: innerGetCompilerOptions } =\n program;\n\n if (!innerGetCompilerOptions) {\n program[INNER_GET_COMPILER_OPTIONS_SYMBOL] = innerGetCompilerOptions = program.getCompilerOptions;\n }\n\n if (!innerEmit) {\n program[INNER_EMIT_SYMBOL] = innerEmit = program.emit;\n }\n\n let foundPrimary: boolean = false;\n let defaultModuleKind: TTypescript.ModuleKind;\n\n const multiEmitMap: Map<ICachedEmitModuleKind, TTypescript.CompilerOptions> = new Map();\n for (const moduleKindToEmit of moduleKindsToEmit) {\n const kindCompilerOptions: TTypescript.CompilerOptions = moduleKindToEmit.isPrimary\n ? {\n ...innerGetCompilerOptions()\n }\n : {\n ...innerGetCompilerOptions(),\n module: moduleKindToEmit.moduleKind,\n outDir: moduleKindToEmit.outFolderPath,\n\n // Don't emit declarations for secondary module kinds\n declaration: false,\n declarationMap: false\n };\n if (!kindCompilerOptions.outDir) {\n throw new InternalError('Expected compilerOptions.outDir to be assigned');\n }\n if (mode === 'transpile') {\n kindCompilerOptions.declaration = false;\n kindCompilerOptions.declarationMap = false;\n } else if (mode === 'declaration') {\n kindCompilerOptions.emitDeclarationOnly = true;\n }\n\n if (moduleKindToEmit.isPrimary || mode !== 'declaration') {\n multiEmitMap.set(moduleKindToEmit, kindCompilerOptions);\n }\n\n if (moduleKindToEmit.isPrimary) {\n if (foundPrimary) {\n throw new Error('Multiple primary module emit kinds encountered.');\n } else {\n foundPrimary = true;\n }\n\n defaultModuleKind = moduleKindToEmit.moduleKind;\n }\n }\n\n const changedFiles: Set<TTypescript.SourceFile> = new Set();\n\n program.emit = (\n targetSourceFile?: TTypescript.SourceFile,\n writeFile?: TTypescript.WriteFileCallback,\n cancellationToken?: TTypescript.CancellationToken,\n emitOnlyDtsFiles?: boolean,\n customTransformers?: TTypescript.CustomTransformers\n ) => {\n if (emitOnlyDtsFiles) {\n return program[INNER_EMIT_SYMBOL]!(\n targetSourceFile,\n writeFile,\n cancellationToken,\n emitOnlyDtsFiles,\n customTransformers\n );\n }\n\n if (targetSourceFile && changedFiles) {\n changedFiles.add(targetSourceFile);\n }\n\n const originalCompilerOptions: TTypescript.CompilerOptions =\n program[INNER_GET_COMPILER_OPTIONS_SYMBOL]!();\n\n let defaultModuleKindResult: TTypescript.EmitResult;\n const diagnostics: TTypescript.Diagnostic[] = [];\n let emitSkipped: boolean = false;\n try {\n for (const [moduleKindToEmit, kindCompilerOptions] of multiEmitMap) {\n program.getCompilerOptions = () => kindCompilerOptions;\n // Need to mutate the compiler options for the `module` field specifically, because emitWorker() captures\n // options in the closure and passes it to `ts.getTransformers()`\n originalCompilerOptions.module = moduleKindToEmit.moduleKind;\n const flavorResult: TTypescript.EmitResult = program[INNER_EMIT_SYMBOL]!(\n targetSourceFile,\n writeFile && wrapWriteFile(writeFile, moduleKindToEmit.jsExtensionOverride),\n cancellationToken,\n emitOnlyDtsFiles,\n customTransformers\n );\n\n emitSkipped = emitSkipped || flavorResult.emitSkipped;\n // Need to aggregate diagnostics because some are impacted by the target module type\n for (const diagnostic of flavorResult.diagnostics) {\n diagnostics.push(diagnostic);\n }\n\n if (moduleKindToEmit.moduleKind === defaultModuleKind) {\n defaultModuleKindResult = flavorResult;\n }\n }\n\n const mergedDiagnostics: readonly TTypescript.Diagnostic[] =\n ts.sortAndDeduplicateDiagnostics(diagnostics);\n\n return {\n ...defaultModuleKindResult!,\n changedSourceFiles: changedFiles,\n diagnostics: mergedDiagnostics,\n emitSkipped\n };\n } finally {\n // Restore the original compiler options and module kind for future calls\n program.getCompilerOptions = program[INNER_GET_COMPILER_OPTIONS_SYMBOL]!;\n originalCompilerOptions.module = defaultModuleKind;\n }\n };\n return { changedFiles };\n}\n"]}
@@ -33,6 +33,11 @@ export interface IExtendedTypeScript {
33
33
  */
34
34
  getCount(measureName: string): number;
35
35
  };
36
+ transpileOptionValueCompilerOptions: {
37
+ name: keyof TTypescript.CompilerOptions;
38
+ transpileOptionValue: any;
39
+ }[];
40
+ getNewLineCharacter(compilerOptions: TTypescript.CompilerOptions): string;
36
41
  /**
37
42
  * https://github.com/microsoft/TypeScript/blob/782c09d783e006a697b4ba6d1e7ec2f718ce8393/src/compiler/utilities.ts#L6540
38
43
  */
@@ -47,5 +52,5 @@ export interface IExtendedTypeScript {
47
52
  Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1: TTypescript.DiagnosticMessage;
48
53
  };
49
54
  }
50
- export declare type ExtendedTypeScript = typeof TTypescript & IExtendedTypeScript;
55
+ export type ExtendedTypeScript = typeof TTypescript & IExtendedTypeScript;
51
56
  //# sourceMappingURL=TypeScriptInternals.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TypeScriptInternals.d.ts","sourceRoot":"","sources":["../../src/internalTypings/TypeScriptInternals.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,WAAW,MAAM,YAAY,CAAC;AAE/C,MAAM,WAAW,wBACf,SAAQ,WAAW,CAAC,eAAe,CAAC,WAAW,CAAC,wCAAwC,CAAC;IACzF,aAAa,IAAI,SAAS,MAAM,EAAE,CAAC;IACnC,iBAAiB,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;CAClE;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,WAAW,EAAE;QACX;;WAEG;QACH,OAAO,IAAI,IAAI,CAAC;QAEhB;;WAEG;QACH,MAAM,IAAI,IAAI,CAAC;QAEf;;WAEG;QACH,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;QAErC;;WAEG;QACH,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAEjF;;WAEG;QACH,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;QAEzC;;WAEG;QACH,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;KACvC,CAAC;IAEF;;OAEG;IACH,UAAU,CACR,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,EAC7C,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,EAC3C,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,EAC3C,yBAAyB,EAAE,OAAO,EAClC,gBAAgB,EAAE,MAAM,EACxB,KAAK,EAAE,MAAM,GAAG,SAAS,EAC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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 /**\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 /**\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"]}
@@ -52,6 +52,11 @@
52
52
  "type": "boolean"
53
53
  },
54
54
 
55
+ "useTranspilerWorker": {
56
+ "description": "If true, and the tsconfig has \"isolatedModules\": true, then transpilation will happen in parallel in a worker thread.",
57
+ "type": "boolean"
58
+ },
59
+
55
60
  "project": {
56
61
  "description": "Specifies the tsconfig.json file that will be used for compilation. Equivalent to the \"project\" argument for the 'tsc' and 'tslint' command line tools. The default value is \"./tsconfig.json\".",
57
62
  "type": "string"
package/lib/types.d.ts ADDED
@@ -0,0 +1,54 @@
1
+ import type * as TTypescript from 'typescript';
2
+ export interface ITypescriptWorkerData {
3
+ /**
4
+ * Path to the version of TypeScript to use.
5
+ */
6
+ typeScriptToolPath: string;
7
+ }
8
+ export interface ITranspilationRequestMessage {
9
+ /**
10
+ * Unique identifier for this request.
11
+ */
12
+ requestId: number;
13
+ /**
14
+ * The tsconfig compiler options to use for the request.
15
+ */
16
+ compilerOptions: TTypescript.CompilerOptions;
17
+ /**
18
+ * The variants to emit.
19
+ */
20
+ moduleKindsToEmit: ICachedEmitModuleKind[];
21
+ /**
22
+ * The set of files to build.
23
+ */
24
+ filesToTranspile: Map<string, string>;
25
+ }
26
+ export interface ITranspilationSuccessMessage {
27
+ requestId: number;
28
+ type: 'success';
29
+ result: TTypescript.EmitResult;
30
+ }
31
+ export interface ITranspilationErrorMessage {
32
+ requestId: number;
33
+ type: 'error';
34
+ result: {
35
+ message: string;
36
+ [key: string]: unknown;
37
+ };
38
+ }
39
+ export type ITranspilationResponseMessage = ITranspilationSuccessMessage | ITranspilationErrorMessage;
40
+ export interface ICachedEmitModuleKind {
41
+ moduleKind: TTypescript.ModuleKind;
42
+ outFolderPath: string;
43
+ /**
44
+ * File extension to use instead of '.js' for emitted ECMAScript files.
45
+ * For example, '.cjs' to indicate commonjs content, or '.mjs' to indicate ECMAScript modules.
46
+ */
47
+ jsExtensionOverride: string | undefined;
48
+ /**
49
+ * Set to true if this is the emit kind that is specified in the tsconfig.json.
50
+ * Declarations are only emitted for the primary module kind.
51
+ */
52
+ isPrimary: boolean;
53
+ }
54
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,WAAW,MAAM,YAAY,CAAC;AAE/C,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,eAAe,EAAE,WAAW,CAAC,eAAe,CAAC;IAC7C;;OAEG;IACH,iBAAiB,EAAE,qBAAqB,EAAE,CAAC;IAC3C;;OAEG;IACH,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,4BAA4B;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC,UAAU,CAAC;CAChC;AAED,MAAM,WAAW,0BAA0B;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;CACH;AAED,MAAM,MAAM,6BAA6B,GAAG,4BAA4B,GAAG,0BAA0B,CAAC;AAEtG,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,WAAW,CAAC,UAAU,CAAC;IAEnC,aAAa,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC;IAExC;;;OAGG;IACH,SAAS,EAAE,OAAO,CAAC;CACpB"}
package/lib/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\nimport type * as TTypescript from 'typescript';\n\nexport interface ITypescriptWorkerData {\n /**\n * Path to the version of TypeScript to use.\n */\n typeScriptToolPath: string;\n}\n\nexport interface ITranspilationRequestMessage {\n /**\n * Unique identifier for this request.\n */\n requestId: number;\n /**\n * The tsconfig compiler options to use for the request.\n */\n compilerOptions: TTypescript.CompilerOptions;\n /**\n * The variants to emit.\n */\n moduleKindsToEmit: ICachedEmitModuleKind[];\n /**\n * The set of files to build.\n */\n filesToTranspile: Map<string, string>;\n}\n\nexport interface ITranspilationSuccessMessage {\n requestId: number;\n type: 'success';\n result: TTypescript.EmitResult;\n}\n\nexport interface ITranspilationErrorMessage {\n requestId: number;\n type: 'error';\n result: {\n message: string;\n [key: string]: unknown;\n };\n}\n\nexport type ITranspilationResponseMessage = ITranspilationSuccessMessage | ITranspilationErrorMessage;\n\nexport interface ICachedEmitModuleKind {\n moduleKind: TTypescript.ModuleKind;\n\n outFolderPath: string;\n\n /**\n * File extension to use instead of '.js' for emitted ECMAScript files.\n * For example, '.cjs' to indicate commonjs content, or '.mjs' to indicate ECMAScript modules.\n */\n jsExtensionOverride: string | undefined;\n\n /**\n * Set to true if this is the emit kind that is specified in the tsconfig.json.\n * Declarations are only emitted for the primary module kind.\n */\n isPrimary: boolean;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/heft-typescript-plugin",
3
- "version": "0.1.0-rc.5",
3
+ "version": "0.2.0-rc.6",
4
4
  "description": "Heft plugin for TypeScript",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,17 +18,17 @@
18
18
  "@types/tapable": "1.0.6",
19
19
  "semver": "~7.3.0",
20
20
  "tapable": "1.1.3",
21
- "@rushstack/node-core-library": "3.56.0",
22
- "@rushstack/heft-config-file": "0.11.10"
21
+ "@rushstack/node-core-library": "3.59.1",
22
+ "@rushstack/heft-config-file": "0.12.2"
23
23
  },
24
24
  "devDependencies": {
25
- "@rushstack/heft-legacy": "npm:@rushstack/heft@0.50.0",
26
- "@rushstack/heft-node-rig": "1.12.6",
25
+ "@rushstack/heft-legacy": "npm:@rushstack/heft@0.50.6",
26
+ "@rushstack/heft-node-rig": "1.13.0",
27
27
  "@types/node": "14.18.36",
28
28
  "@types/semver": "7.3.5",
29
- "typescript": "~4.8.4",
30
- "@rushstack/eslint-config": "3.2.0",
31
- "@rushstack/heft": "0.51.0-rc.5"
29
+ "typescript": "~5.0.4",
30
+ "@rushstack/eslint-config": "3.3.0",
31
+ "@rushstack/heft": "0.51.0-rc.6"
32
32
  },
33
33
  "scripts": {
34
34
  "build": "node ./node_modules/@rushstack/heft-legacy/bin/heft --unmanaged build --clean",