@rushstack/heft-typescript-plugin 1.1.14 → 1.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.
- package/CHANGELOG.json +58 -0
- package/CHANGELOG.md +15 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/heft-plugin.json +1 -1
- package/lib-esm/Performance.js +4 -0
- package/lib-esm/Performance.js.map +1 -0
- package/lib-esm/TranspilerWorker.js +92 -0
- package/lib-esm/TranspilerWorker.js.map +1 -0
- package/lib-esm/TypeScriptBuilder.js +758 -0
- package/lib-esm/TypeScriptBuilder.js.map +1 -0
- package/lib-esm/TypeScriptPlugin.js +205 -0
- package/lib-esm/TypeScriptPlugin.js.map +1 -0
- package/lib-esm/configureProgramForMultiEmit.js +110 -0
- package/lib-esm/configureProgramForMultiEmit.js.map +1 -0
- package/lib-esm/fileSystem/TypeScriptCachedFileSystem.js +159 -0
- package/lib-esm/fileSystem/TypeScriptCachedFileSystem.js.map +1 -0
- package/lib-esm/index.js +6 -0
- package/lib-esm/index.js.map +1 -0
- package/lib-esm/internalTypings/TypeScriptInternals.js +4 -0
- package/lib-esm/internalTypings/TypeScriptInternals.js.map +1 -0
- package/lib-esm/loadTypeScriptTool.js +75 -0
- package/lib-esm/loadTypeScriptTool.js.map +1 -0
- package/lib-esm/schemas/anything.schema.json +28 -0
- package/lib-esm/schemas/typescript.schema.json +106 -0
- package/lib-esm/tsconfigLoader.js +33 -0
- package/lib-esm/tsconfigLoader.js.map +1 -0
- package/lib-esm/types.js +4 -0
- package/lib-esm/types.js.map +1 -0
- package/package.json +34 -8
- /package/{lib → lib-commonjs}/Performance.js +0 -0
- /package/{lib → lib-commonjs}/Performance.js.map +0 -0
- /package/{lib → lib-commonjs}/TranspilerWorker.js +0 -0
- /package/{lib → lib-commonjs}/TranspilerWorker.js.map +0 -0
- /package/{lib → lib-commonjs}/TypeScriptBuilder.js +0 -0
- /package/{lib → lib-commonjs}/TypeScriptBuilder.js.map +0 -0
- /package/{lib → lib-commonjs}/TypeScriptPlugin.js +0 -0
- /package/{lib → lib-commonjs}/TypeScriptPlugin.js.map +0 -0
- /package/{lib → lib-commonjs}/configureProgramForMultiEmit.js +0 -0
- /package/{lib → lib-commonjs}/configureProgramForMultiEmit.js.map +0 -0
- /package/{lib → lib-commonjs}/fileSystem/TypeScriptCachedFileSystem.js +0 -0
- /package/{lib → lib-commonjs}/fileSystem/TypeScriptCachedFileSystem.js.map +0 -0
- /package/{lib → lib-commonjs}/index.js +0 -0
- /package/{lib → lib-commonjs}/index.js.map +0 -0
- /package/{lib → lib-commonjs}/internalTypings/TypeScriptInternals.js +0 -0
- /package/{lib → lib-commonjs}/internalTypings/TypeScriptInternals.js.map +0 -0
- /package/{lib → lib-commonjs}/loadTypeScriptTool.js +0 -0
- /package/{lib → lib-commonjs}/loadTypeScriptTool.js.map +0 -0
- /package/{lib → lib-commonjs}/schemas/anything.schema.json +0 -0
- /package/{lib → lib-commonjs}/schemas/typescript.schema.json +0 -0
- /package/{lib → lib-commonjs}/tsconfigLoader.js +0 -0
- /package/{lib → lib-commonjs}/tsconfigLoader.js.map +0 -0
- /package/{lib → lib-commonjs}/types.js +0 -0
- /package/{lib → lib-commonjs}/types.js.map +0 -0
- /package/{lib → lib-dts}/Performance.d.ts +0 -0
- /package/{lib → lib-dts}/Performance.d.ts.map +0 -0
- /package/{lib → lib-dts}/TranspilerWorker.d.ts +0 -0
- /package/{lib → lib-dts}/TranspilerWorker.d.ts.map +0 -0
- /package/{lib → lib-dts}/TypeScriptBuilder.d.ts +0 -0
- /package/{lib → lib-dts}/TypeScriptBuilder.d.ts.map +0 -0
- /package/{lib → lib-dts}/TypeScriptPlugin.d.ts +0 -0
- /package/{lib → lib-dts}/TypeScriptPlugin.d.ts.map +0 -0
- /package/{lib → lib-dts}/configureProgramForMultiEmit.d.ts +0 -0
- /package/{lib → lib-dts}/configureProgramForMultiEmit.d.ts.map +0 -0
- /package/{lib → lib-dts}/fileSystem/TypeScriptCachedFileSystem.d.ts +0 -0
- /package/{lib → lib-dts}/fileSystem/TypeScriptCachedFileSystem.d.ts.map +0 -0
- /package/{lib → lib-dts}/index.d.ts +0 -0
- /package/{lib → lib-dts}/index.d.ts.map +0 -0
- /package/{lib → lib-dts}/internalTypings/TypeScriptInternals.d.ts +0 -0
- /package/{lib → lib-dts}/internalTypings/TypeScriptInternals.d.ts.map +0 -0
- /package/{lib → lib-dts}/loadTypeScriptTool.d.ts +0 -0
- /package/{lib → lib-dts}/loadTypeScriptTool.d.ts.map +0 -0
- /package/{lib → lib-dts}/tsconfigLoader.d.ts +0 -0
- /package/{lib → lib-dts}/tsconfigLoader.d.ts.map +0 -0
- /package/{lib → lib-dts}/types.d.ts +0 -0
- /package/{lib → lib-dts}/types.d.ts.map +0 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import { Encoding, Text, FileSystem, Sort } from '@rushstack/node-core-library';
|
|
4
|
+
/**
|
|
5
|
+
* This is a FileSystem API (largely unrelated to the @rushstack/node-core-library FileSystem API)
|
|
6
|
+
* that provides caching to the Heft TypeScriptBuilder.
|
|
7
|
+
* It uses an in-memory cache to avoid requests against the disk. It assumes that the disk stays
|
|
8
|
+
* static after construction, except for writes performed through the TypeScriptCachedFileSystem
|
|
9
|
+
* instance.
|
|
10
|
+
*/
|
|
11
|
+
export class TypeScriptCachedFileSystem {
|
|
12
|
+
constructor() {
|
|
13
|
+
this._statsCache = new Map();
|
|
14
|
+
this._readFolderCache = new Map();
|
|
15
|
+
this._readFileCache = new Map();
|
|
16
|
+
this._realPathCache = new Map();
|
|
17
|
+
this.exists = (path) => {
|
|
18
|
+
try {
|
|
19
|
+
this.getStatistics(path);
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
catch (e) {
|
|
23
|
+
if (FileSystem.isNotExistError(e)) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
throw e;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
this.directoryExists = (path) => {
|
|
32
|
+
try {
|
|
33
|
+
const stats = this.getStatistics(path);
|
|
34
|
+
return stats.isDirectory();
|
|
35
|
+
}
|
|
36
|
+
catch (e) {
|
|
37
|
+
if (FileSystem.isNotExistError(e)) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
throw e;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
this.getStatistics = (path) => {
|
|
46
|
+
return this._withCaching(path, FileSystem.getStatistics, this._statsCache);
|
|
47
|
+
};
|
|
48
|
+
this.ensureFolder = (folderPath) => {
|
|
49
|
+
var _a, _b;
|
|
50
|
+
if (!((_a = this._readFolderCache.get(folderPath)) === null || _a === void 0 ? void 0 : _a.entry) && !((_b = this._statsCache.get(folderPath)) === null || _b === void 0 ? void 0 : _b.entry)) {
|
|
51
|
+
FileSystem.ensureFolder(folderPath);
|
|
52
|
+
this._invalidateCacheEntry(folderPath);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
this.ensureFolderAsync = async (folderPath) => {
|
|
56
|
+
var _a, _b;
|
|
57
|
+
if (!((_a = this._readFolderCache.get(folderPath)) === null || _a === void 0 ? void 0 : _a.entry) && !((_b = this._statsCache.get(folderPath)) === null || _b === void 0 ? void 0 : _b.entry)) {
|
|
58
|
+
await FileSystem.ensureFolderAsync(folderPath);
|
|
59
|
+
this._invalidateCacheEntry(folderPath);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
this.writeFile = (filePath, contents, options) => {
|
|
63
|
+
FileSystem.writeFile(filePath, contents, options);
|
|
64
|
+
this._invalidateCacheEntry(filePath);
|
|
65
|
+
};
|
|
66
|
+
this.readFile = (filePath, options) => {
|
|
67
|
+
let contents = this.readFileToBuffer(filePath).toString((options === null || options === void 0 ? void 0 : options.encoding) || Encoding.Utf8);
|
|
68
|
+
if (options === null || options === void 0 ? void 0 : options.convertLineEndings) {
|
|
69
|
+
contents = Text.convertTo(contents, options.convertLineEndings);
|
|
70
|
+
}
|
|
71
|
+
return contents;
|
|
72
|
+
};
|
|
73
|
+
this.readFileToBuffer = (filePath) => {
|
|
74
|
+
return this._withCaching(filePath, FileSystem.readFileToBuffer, this._readFileCache);
|
|
75
|
+
};
|
|
76
|
+
this.copyFileAsync = async (options) => {
|
|
77
|
+
await FileSystem.copyFileAsync(options);
|
|
78
|
+
this._invalidateCacheEntry(options.destinationPath);
|
|
79
|
+
};
|
|
80
|
+
this.deleteFile = (filePath, options) => {
|
|
81
|
+
var _a;
|
|
82
|
+
const cachedError = (_a = this._statsCache.get(filePath)) === null || _a === void 0 ? void 0 : _a.error;
|
|
83
|
+
if (!cachedError || !FileSystem.isFileDoesNotExistError(cachedError)) {
|
|
84
|
+
FileSystem.deleteFile(filePath);
|
|
85
|
+
this._invalidateCacheEntry(filePath);
|
|
86
|
+
}
|
|
87
|
+
else if (options === null || options === void 0 ? void 0 : options.throwIfNotExists) {
|
|
88
|
+
throw cachedError;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
this.createHardLinkAsync = async (options) => {
|
|
92
|
+
await FileSystem.createHardLinkAsync(options);
|
|
93
|
+
this._invalidateCacheEntry(options.newLinkPath);
|
|
94
|
+
};
|
|
95
|
+
this.getRealPath = (linkPath) => {
|
|
96
|
+
return this._withCaching(linkPath, (path) => {
|
|
97
|
+
try {
|
|
98
|
+
return FileSystem.getRealPath(path);
|
|
99
|
+
}
|
|
100
|
+
catch (e) {
|
|
101
|
+
if (FileSystem.isNotExistError(e)) {
|
|
102
|
+
// TypeScript's ts.sys.realpath returns the path it's provided if that path doesn't exist
|
|
103
|
+
return path;
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
throw e;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}, this._realPathCache);
|
|
110
|
+
};
|
|
111
|
+
this.readFolderFilesAndDirectories = (folderPath) => {
|
|
112
|
+
return this._withCaching(folderPath, (path) => {
|
|
113
|
+
const folderEntries = FileSystem.readFolderItems(path);
|
|
114
|
+
return this._sortFolderEntries(folderEntries);
|
|
115
|
+
}, this._readFolderCache);
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
_sortFolderEntries(folderEntries) {
|
|
119
|
+
// TypeScript expects entries sorted ordinally by name
|
|
120
|
+
// In practice this might not matter
|
|
121
|
+
folderEntries.sort((a, b) => Sort.compareByValue(a, b));
|
|
122
|
+
const files = [];
|
|
123
|
+
const directories = [];
|
|
124
|
+
for (const folderEntry of folderEntries) {
|
|
125
|
+
if (folderEntry.isFile()) {
|
|
126
|
+
files.push(folderEntry.name);
|
|
127
|
+
}
|
|
128
|
+
else if (folderEntry.isDirectory()) {
|
|
129
|
+
directories.push(folderEntry.name);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return { files, directories };
|
|
133
|
+
}
|
|
134
|
+
_withCaching(path, fn, cache) {
|
|
135
|
+
let cacheEntry = cache.get(path);
|
|
136
|
+
if (!cacheEntry) {
|
|
137
|
+
try {
|
|
138
|
+
cacheEntry = { entry: fn(path) };
|
|
139
|
+
}
|
|
140
|
+
catch (e) {
|
|
141
|
+
cacheEntry = { error: e, entry: undefined };
|
|
142
|
+
}
|
|
143
|
+
cache.set(path, cacheEntry);
|
|
144
|
+
}
|
|
145
|
+
if (cacheEntry.entry) {
|
|
146
|
+
return cacheEntry.entry;
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
throw cacheEntry.error;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
_invalidateCacheEntry(path) {
|
|
153
|
+
this._statsCache.delete(path);
|
|
154
|
+
this._readFolderCache.delete(path);
|
|
155
|
+
this._readFileCache.delete(path);
|
|
156
|
+
this._realPathCache.delete(path);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=TypeScriptCachedFileSystem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypeScriptCachedFileSystem.js","sourceRoot":"","sources":["../../src/fileSystem/TypeScriptCachedFileSystem.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,EACL,QAAQ,EACR,IAAI,EAMJ,UAAU,EAEV,IAAI,EAEL,MAAM,8BAA8B,CAAC;AAYtC;;;;;;GAMG;AACH,MAAM,OAAO,0BAA0B;IAAvC;QACU,gBAAW,GAA8C,IAAI,GAAG,EAAE,CAAC;QACnE,qBAAgB,GAAmE,IAAI,GAAG,EAAE,CAAC;QAC7F,mBAAc,GAAqC,IAAI,GAAG,EAAE,CAAC;QAC7D,mBAAc,GAAqC,IAAI,GAAG,EAAE,CAAC;QAE9D,WAAM,GAA8B,CAAC,IAAY,EAAE,EAAE;YAC1D,IAAI,CAAC;gBACH,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;gBACzB,OAAO,IAAI,CAAC;YACd,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,IAAI,UAAU,CAAC,eAAe,CAAC,CAAU,CAAC,EAAE,CAAC;oBAC3C,OAAO,KAAK,CAAC;gBACf,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,CAAC;gBACV,CAAC;YACH,CAAC;QACH,CAAC,CAAC;QAEK,oBAAe,GAA8B,CAAC,IAAY,EAAE,EAAE;YACnE,IAAI,CAAC;gBACH,MAAM,KAAK,GAAoB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;gBACxD,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;YAC7B,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,IAAI,UAAU,CAAC,eAAe,CAAC,CAAU,CAAC,EAAE,CAAC;oBAC3C,OAAO,KAAK,CAAC;gBACf,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,CAA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jC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport {\n Encoding,\n Text,\n type IFileSystemWriteFileOptions,\n type IFileSystemReadFileOptions,\n type IFileSystemCopyFileOptions,\n type IFileSystemDeleteFileOptions,\n type IFileSystemCreateLinkOptions,\n FileSystem,\n type FileSystemStats,\n Sort,\n type FolderItem\n} from '@rushstack/node-core-library';\n\nexport interface IReadFolderFilesAndDirectoriesResult {\n files: string[];\n directories: string[];\n}\n\ninterface ICacheEntry<TEntry> {\n entry: TEntry | undefined;\n error?: NodeJS.ErrnoException;\n}\n\n/**\n * This is a FileSystem API (largely unrelated to the @rushstack/node-core-library FileSystem API)\n * that provides caching to the Heft TypeScriptBuilder.\n * It uses an in-memory cache to avoid requests against the disk. It assumes that the disk stays\n * static after construction, except for writes performed through the TypeScriptCachedFileSystem\n * instance.\n */\nexport class TypeScriptCachedFileSystem {\n private _statsCache: Map<string, ICacheEntry<FileSystemStats>> = new Map();\n private _readFolderCache: Map<string, ICacheEntry<IReadFolderFilesAndDirectoriesResult>> = new Map();\n private _readFileCache: Map<string, ICacheEntry<Buffer>> = new Map();\n private _realPathCache: Map<string, ICacheEntry<string>> = new Map();\n\n public exists: (path: string) => boolean = (path: string) => {\n try {\n this.getStatistics(path);\n return true;\n } catch (e) {\n if (FileSystem.isNotExistError(e as Error)) {\n return false;\n } else {\n throw e;\n }\n }\n };\n\n public directoryExists: (path: string) => boolean = (path: string) => {\n try {\n const stats: FileSystemStats = this.getStatistics(path);\n return stats.isDirectory();\n } catch (e) {\n if (FileSystem.isNotExistError(e as Error)) {\n return false;\n } else {\n throw e;\n }\n }\n };\n\n public getStatistics: (path: string) => FileSystemStats = (path: string) => {\n return this._withCaching(path, FileSystem.getStatistics, this._statsCache);\n };\n\n public ensureFolder: (folderPath: string) => void = (folderPath: string) => {\n if (!this._readFolderCache.get(folderPath)?.entry && !this._statsCache.get(folderPath)?.entry) {\n FileSystem.ensureFolder(folderPath);\n this._invalidateCacheEntry(folderPath);\n }\n };\n\n public ensureFolderAsync: (folderPath: string) => Promise<void> = async (folderPath: string) => {\n if (!this._readFolderCache.get(folderPath)?.entry && !this._statsCache.get(folderPath)?.entry) {\n await FileSystem.ensureFolderAsync(folderPath);\n this._invalidateCacheEntry(folderPath);\n }\n };\n\n public writeFile: (\n filePath: string,\n contents: string | Buffer,\n options?: IFileSystemWriteFileOptions | undefined\n ) => void = (\n filePath: string,\n contents: string | Buffer,\n options?: IFileSystemWriteFileOptions | undefined\n ) => {\n FileSystem.writeFile(filePath, contents, options);\n this._invalidateCacheEntry(filePath);\n };\n\n public readFile: (filePath: string, options?: IFileSystemReadFileOptions | undefined) => string = (\n filePath: string,\n options?: IFileSystemReadFileOptions | undefined\n ) => {\n let contents: string = this.readFileToBuffer(filePath).toString(options?.encoding || Encoding.Utf8);\n if (options?.convertLineEndings) {\n contents = Text.convertTo(contents, options.convertLineEndings);\n }\n\n return contents;\n };\n\n public readFileToBuffer: (filePath: string) => Buffer = (filePath: string) => {\n return this._withCaching(filePath, FileSystem.readFileToBuffer, this._readFileCache);\n };\n\n public copyFileAsync: (options: IFileSystemCopyFileOptions) => Promise<void> = async (\n options: IFileSystemCopyFileOptions\n ) => {\n await FileSystem.copyFileAsync(options);\n this._invalidateCacheEntry(options.destinationPath);\n };\n\n public deleteFile: (filePath: string, options?: IFileSystemDeleteFileOptions | undefined) => void = (\n filePath: string,\n options?: IFileSystemDeleteFileOptions | undefined\n ) => {\n const cachedError: Error | undefined = this._statsCache.get(filePath)?.error;\n if (!cachedError || !FileSystem.isFileDoesNotExistError(cachedError)) {\n FileSystem.deleteFile(filePath);\n this._invalidateCacheEntry(filePath);\n } else if (options?.throwIfNotExists) {\n throw cachedError;\n }\n };\n\n public createHardLinkAsync: (options: IFileSystemCreateLinkOptions) => Promise<void> = async (\n options: IFileSystemCreateLinkOptions\n ) => {\n await FileSystem.createHardLinkAsync(options);\n this._invalidateCacheEntry(options.newLinkPath);\n };\n\n public getRealPath: (linkPath: string) => string = (linkPath: string) => {\n return this._withCaching(\n linkPath,\n (path: string) => {\n try {\n return FileSystem.getRealPath(path);\n } catch (e) {\n if (FileSystem.isNotExistError(e as Error)) {\n // TypeScript's ts.sys.realpath returns the path it's provided if that path doesn't exist\n return path;\n } else {\n throw e;\n }\n }\n },\n this._realPathCache\n );\n };\n\n public readFolderFilesAndDirectories: (folderPath: string) => IReadFolderFilesAndDirectoriesResult = (\n folderPath: string\n ) => {\n return this._withCaching(\n folderPath,\n (path: string) => {\n const folderEntries: FolderItem[] = FileSystem.readFolderItems(path);\n return this._sortFolderEntries(folderEntries);\n },\n this._readFolderCache\n );\n };\n\n private _sortFolderEntries(folderEntries: FolderItem[]): IReadFolderFilesAndDirectoriesResult {\n // TypeScript expects entries sorted ordinally by name\n // In practice this might not matter\n folderEntries.sort((a, b) => Sort.compareByValue(a, b));\n\n const files: string[] = [];\n const directories: string[] = [];\n for (const folderEntry of folderEntries) {\n if (folderEntry.isFile()) {\n files.push(folderEntry.name);\n } else if (folderEntry.isDirectory()) {\n directories.push(folderEntry.name);\n }\n }\n\n return { files, directories };\n }\n\n private _withCaching<TResult>(\n path: string,\n fn: (path: string) => TResult,\n cache: Map<string, ICacheEntry<TResult>>\n ): TResult {\n let cacheEntry: ICacheEntry<TResult> | undefined = cache.get(path);\n if (!cacheEntry) {\n try {\n cacheEntry = { entry: fn(path) };\n } catch (e) {\n cacheEntry = { error: e as Error, entry: undefined };\n }\n\n cache.set(path, cacheEntry);\n }\n\n if (cacheEntry.entry) {\n return cacheEntry.entry;\n } else {\n throw cacheEntry.error;\n }\n }\n\n private _invalidateCacheEntry(path: string): void {\n this._statsCache.delete(path);\n this._readFolderCache.delete(path);\n this._readFileCache.delete(path);\n this._realPathCache.delete(path);\n }\n}\n"]}
|
package/lib-esm/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
export { PLUGIN_NAME as TypeScriptPluginName, loadTypeScriptConfigurationFileAsync, loadPartialTsconfigFileAsync } from './TypeScriptPlugin';
|
|
4
|
+
export { loadTypeScriptToolAsync as _loadTypeScriptToolAsync } from './loadTypeScriptTool';
|
|
5
|
+
export { loadTsconfig as _loadTsconfig, getTsconfigFilePath as _getTsconfigFilePath } from './tsconfigLoader';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAkB3D,OAAO,EACL,WAAW,IAAI,oBAAoB,EACnC,oCAAoC,EACpC,4BAA4B,EAC7B,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,uBAAuB,IAAI,wBAAwB,EAIpD,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,YAAY,IAAI,aAAa,EAC7B,mBAAmB,IAAI,oBAAoB,EAE5C,MAAM,kBAAkB,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\n/**\n * A Heft plugin for using TypeScript.\n *\n * @packageDocumentation\n */\n\nexport type {\n IEmitModuleKind,\n IStaticAssetsCopyConfiguration,\n ITypeScriptConfigurationJson,\n IPartialTsconfigCompilerOptions,\n IPartialTsconfig,\n IChangedFilesHookOptions,\n ITypeScriptPluginAccessor\n} from './TypeScriptPlugin';\n\nexport {\n PLUGIN_NAME as TypeScriptPluginName,\n loadTypeScriptConfigurationFileAsync,\n loadPartialTsconfigFileAsync\n} from './TypeScriptPlugin';\n\nexport type { IBaseTypeScriptTool as _IBaseTypeScriptTool } from './TypeScriptBuilder';\nexport {\n loadTypeScriptToolAsync as _loadTypeScriptToolAsync,\n type ILoadedTypeScriptTool as _ILoadedTypeScriptTool,\n type ICompilerCapabilities as _ICompilerCapabilities,\n type ILoadTypeScriptToolOptions as _ILoadTypeScriptToolOptions\n} from './loadTypeScriptTool';\nexport {\n loadTsconfig as _loadTsconfig,\n getTsconfigFilePath as _getTsconfigFilePath,\n type ILoadTsconfigOptions as _ILoadTsconfigOptions\n} from './tsconfigLoader';\nimport type * as TTypeScript from 'typescript';\nexport { TTypeScript as _TTypeScript };\n"]}
|
|
@@ -0,0 +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\n/**\n * @internal\n */\nexport interface ITypeScriptNodeSystem extends TTypescript.System {\n /**\n * https://github.com/microsoft/TypeScript/blob/d85767abfd83880cea17cea70f9913e9c4496dcc/src/compiler/sys.ts#L1438\n */\n getAccessibleFileSystemEntries?: (folderPath: string) => {\n files: string[];\n directories: string[];\n };\n}\n\n/**\n * @internal\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 createCompilerHostWorker(\n options: TTypescript.CompilerOptions,\n setParentNodes?: boolean,\n system?: TTypescript.System\n ): TTypescript.CompilerHost;\n\n combinePaths(path1: string, path2: string): 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\nexport type ExtendedBuilderProgram = TTypescript.BuilderProgram & {\n /**\n * Typescript 5.6+\n */\n state?: { changedFilesSet: Set<string> };\n /**\n * Typescript < 5.6\n */\n getState(): { changedFilesSet: Set<string> };\n};\n"]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import semver from 'semver';
|
|
4
|
+
import { JsonFile, RealNodeModulePathResolver } from '@rushstack/node-core-library';
|
|
5
|
+
const OLDEST_SUPPORTED_TS_MAJOR_VERSION = 2;
|
|
6
|
+
const OLDEST_SUPPORTED_TS_MINOR_VERSION = 9;
|
|
7
|
+
const NEWEST_SUPPORTED_TS_MAJOR_VERSION = 5;
|
|
8
|
+
const NEWEST_SUPPORTED_TS_MINOR_VERSION = 8;
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export async function loadTypeScriptToolAsync(options) {
|
|
13
|
+
const { terminal, heftConfiguration, buildProjectReferences, onlyResolveSymlinksInNodeModules } = options;
|
|
14
|
+
const typeScriptToolPath = await heftConfiguration.rigPackageResolver.resolvePackageAsync('typescript', terminal);
|
|
15
|
+
// Determine the compiler version
|
|
16
|
+
const compilerPackageJsonFilename = `${typeScriptToolPath}/package.json`;
|
|
17
|
+
const packageJson = await JsonFile.loadAsync(compilerPackageJsonFilename);
|
|
18
|
+
const typescriptVersion = packageJson.version;
|
|
19
|
+
const typescriptParsedVersion = semver.parse(typescriptVersion);
|
|
20
|
+
if (!typescriptParsedVersion) {
|
|
21
|
+
throw new Error(`Unable to parse version "${typescriptVersion}" for TypeScript compiler package in: ` +
|
|
22
|
+
compilerPackageJsonFilename);
|
|
23
|
+
}
|
|
24
|
+
// Detect what features this compiler supports. Note that manually comparing major/minor numbers
|
|
25
|
+
// loosens the matching to accept prereleases such as "3.6.0-dev.20190530"
|
|
26
|
+
const capabilities = {
|
|
27
|
+
incrementalProgram: false,
|
|
28
|
+
solutionBuilder: typescriptParsedVersion.major >= 3
|
|
29
|
+
};
|
|
30
|
+
if (typescriptParsedVersion.major > 3 ||
|
|
31
|
+
(typescriptParsedVersion.major === 3 && typescriptParsedVersion.minor >= 6)) {
|
|
32
|
+
capabilities.incrementalProgram = true;
|
|
33
|
+
}
|
|
34
|
+
if (buildProjectReferences && !capabilities.solutionBuilder) {
|
|
35
|
+
throw new Error(`Building project references requires TypeScript@>=3.0, but the current version is ${typescriptVersion}`);
|
|
36
|
+
}
|
|
37
|
+
// Report a warning if the TypeScript version is too old/new. The current oldest supported version is
|
|
38
|
+
// TypeScript 2.9. Prior to that the "ts.getConfigFileParsingDiagnostics()" API is missing; more fixups
|
|
39
|
+
// would be required to deal with that. We won't do that work unless someone requests it.
|
|
40
|
+
if (typescriptParsedVersion.major < OLDEST_SUPPORTED_TS_MAJOR_VERSION ||
|
|
41
|
+
(typescriptParsedVersion.major === OLDEST_SUPPORTED_TS_MAJOR_VERSION &&
|
|
42
|
+
typescriptParsedVersion.minor < OLDEST_SUPPORTED_TS_MINOR_VERSION)) {
|
|
43
|
+
// We don't use writeWarningLine() here because, if the person wants to take their chances with
|
|
44
|
+
// a seemingly unsupported compiler, their build should be allowed to succeed.
|
|
45
|
+
terminal.writeLine(`The TypeScript compiler version ${typescriptVersion} is very old` +
|
|
46
|
+
` and has not been tested with Heft; it may not work correctly.`);
|
|
47
|
+
}
|
|
48
|
+
else if (typescriptParsedVersion.major > NEWEST_SUPPORTED_TS_MAJOR_VERSION ||
|
|
49
|
+
(typescriptParsedVersion.major === NEWEST_SUPPORTED_TS_MAJOR_VERSION &&
|
|
50
|
+
typescriptParsedVersion.minor > NEWEST_SUPPORTED_TS_MINOR_VERSION)) {
|
|
51
|
+
terminal.writeLine(`The TypeScript compiler version ${typescriptVersion} is newer` +
|
|
52
|
+
' than the latest version that was tested with Heft ' +
|
|
53
|
+
`(${NEWEST_SUPPORTED_TS_MAJOR_VERSION}.${NEWEST_SUPPORTED_TS_MINOR_VERSION}); it may not work correctly.`);
|
|
54
|
+
}
|
|
55
|
+
const ts = require(typeScriptToolPath);
|
|
56
|
+
let realpath = ts.sys.realpath;
|
|
57
|
+
if (onlyResolveSymlinksInNodeModules) {
|
|
58
|
+
const resolver = new RealNodeModulePathResolver();
|
|
59
|
+
realpath = resolver.realNodeModulePath;
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
tool: {
|
|
63
|
+
ts,
|
|
64
|
+
system: {
|
|
65
|
+
...ts.sys,
|
|
66
|
+
realpath
|
|
67
|
+
},
|
|
68
|
+
typeScriptToolPath
|
|
69
|
+
},
|
|
70
|
+
typescriptVersion,
|
|
71
|
+
typescriptParsedVersion,
|
|
72
|
+
capabilities
|
|
73
|
+
};
|
|
74
|
+
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AAC;IACzC,CAAC;IAED,OAAO;QACL,IAAI,EAAE;YACJ,EAAE;YACF,MAAM,EAAE;gBACN,GAAG,EAAE,CAAC,GAAG;gBACT,QAAQ;aACT;YACD,kBAAkB;SACnB;QACD,iBAAiB;QACjB,uBAAuB;QACvB,YAAY;KACb,CAAC;AACJ,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 semver from 'semver';\n\nimport type { HeftConfiguration } from '@rushstack/heft';\nimport type { ITerminal } from '@rushstack/terminal';\nimport { type IPackageJson, JsonFile, RealNodeModulePathResolver } from '@rushstack/node-core-library';\n\nimport type { ExtendedTypeScript } from './internalTypings/TypeScriptInternals';\nimport type { IBaseTypeScriptTool } from './TypeScriptBuilder';\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 = 8;\n\n/**\n * @internal\n */\nexport interface ILoadedTypeScriptTool {\n tool: IBaseTypeScriptTool;\n typescriptVersion: string;\n typescriptParsedVersion: semver.SemVer;\n capabilities: ICompilerCapabilities;\n}\n\n/**\n * @internal\n */\nexport interface 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\n/**\n * @internal\n */\nexport interface ILoadTypeScriptToolOptions {\n terminal: ITerminal;\n heftConfiguration: HeftConfiguration;\n onlyResolveSymlinksInNodeModules?: boolean;\n buildProjectReferences?: boolean;\n}\n\n/**\n * @internal\n */\nexport async function loadTypeScriptToolAsync(\n options: ILoadTypeScriptToolOptions\n): Promise<ILoadedTypeScriptTool> {\n const { terminal, heftConfiguration, buildProjectReferences, onlyResolveSymlinksInNodeModules } = options;\n\n const typeScriptToolPath: string = await heftConfiguration.rigPackageResolver.resolvePackageAsync(\n 'typescript',\n terminal\n );\n\n // Determine the compiler version\n const compilerPackageJsonFilename: string = `${typeScriptToolPath}/package.json`;\n const packageJson: IPackageJson = await JsonFile.loadAsync(compilerPackageJsonFilename);\n const typescriptVersion: string = packageJson.version;\n const typescriptParsedVersion: semver.SemVer | null = semver.parse(typescriptVersion);\n if (!typescriptParsedVersion) {\n throw new Error(\n `Unable to parse version \"${typescriptVersion}\" for TypeScript compiler package in: ` +\n compilerPackageJsonFilename\n );\n }\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 const capabilities: ICompilerCapabilities = {\n incrementalProgram: false,\n solutionBuilder: typescriptParsedVersion.major >= 3\n };\n\n if (\n typescriptParsedVersion.major > 3 ||\n (typescriptParsedVersion.major === 3 && typescriptParsedVersion.minor >= 6)\n ) {\n capabilities.incrementalProgram = true;\n }\n\n if (buildProjectReferences && !capabilities.solutionBuilder) {\n throw new Error(\n `Building project references requires TypeScript@>=3.0, but the current version is ${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 typescriptParsedVersion.major < OLDEST_SUPPORTED_TS_MAJOR_VERSION ||\n (typescriptParsedVersion.major === OLDEST_SUPPORTED_TS_MAJOR_VERSION &&\n 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 terminal.writeLine(\n `The TypeScript compiler version ${typescriptVersion} is very old` +\n ` and has not been tested with Heft; it may not work correctly.`\n );\n } else if (\n typescriptParsedVersion.major > NEWEST_SUPPORTED_TS_MAJOR_VERSION ||\n (typescriptParsedVersion.major === NEWEST_SUPPORTED_TS_MAJOR_VERSION &&\n typescriptParsedVersion.minor > NEWEST_SUPPORTED_TS_MINOR_VERSION)\n ) {\n terminal.writeLine(\n `The TypeScript compiler version ${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(typeScriptToolPath);\n\n let realpath: typeof ts.sys.realpath = ts.sys.realpath;\n if (onlyResolveSymlinksInNodeModules) {\n const resolver: RealNodeModulePathResolver = new RealNodeModulePathResolver();\n realpath = resolver.realNodeModulePath;\n }\n\n return {\n tool: {\n ts,\n system: {\n ...ts.sys,\n realpath\n },\n typeScriptToolPath\n },\n typescriptVersion,\n typescriptParsedVersion,\n capabilities\n };\n}\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
3
|
+
"description": "Schema that matches anything",
|
|
4
|
+
|
|
5
|
+
"oneOf": [
|
|
6
|
+
{
|
|
7
|
+
"type": "array"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"type": "boolean"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"type": "integer"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"type": "null"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"type": "number"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"type": "object"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"type": "string"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
3
|
+
"title": "TypeScript Build Configuration",
|
|
4
|
+
"description": "Defines optional options for TypeScript build.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
|
|
9
|
+
"properties": {
|
|
10
|
+
"$schema": {
|
|
11
|
+
"description": "Part of the JSON Schema standard, this optional keyword declares the URL of the schema that the file conforms to. Editors may download the schema and use it to perform syntax highlighting.",
|
|
12
|
+
"type": "string"
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
"extends": {
|
|
16
|
+
"description": "Optionally specifies another JSON config file that this file extends from. This provides a way for standard settings to be shared across multiple projects. To delete an inherited setting, set it to `null` in this file.",
|
|
17
|
+
"type": "string"
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
"additionalModuleKindsToEmit": {
|
|
21
|
+
"type": "array",
|
|
22
|
+
"description": "If provided, emit these module kinds in addition to the modules specified in the tsconfig. Note that this option only applies to the main tsconfig.json configuration.",
|
|
23
|
+
"items": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"properties": {
|
|
26
|
+
"moduleKind": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"enum": ["commonjs", "amd", "umd", "system", "es2015", "esnext"]
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
"outFolderName": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"pattern": "[^\\\\\\/]"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"required": ["moduleKind", "outFolderName"]
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
"onlyResolveSymlinksInNodeModules": {
|
|
41
|
+
"description": "If true, the TypeScript compiler will only resolve symlinks to their targets if the links are in a node_modules folder. This significantly reduces file system operations in typical usage.",
|
|
42
|
+
"type": "boolean"
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
"emitCjsExtensionForCommonJS": {
|
|
46
|
+
"description": "If true, emit CommonJS module output to the folder specified in the tsconfig \"outDir\" compiler option with the .cjs extension alongside (or instead of, if TSConfig specifies CommonJS) the default compilation output.",
|
|
47
|
+
"type": "boolean"
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
"emitMjsExtensionForESModule": {
|
|
51
|
+
"description": "If true, emit ESNext module output to the folder specified in the tsconfig \"outDir\" compiler option with the .mjs extension alongside (or instead of, if TSConfig specifies ESNext) the default compilation output.",
|
|
52
|
+
"type": "boolean"
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
"buildProjectReferences": {
|
|
56
|
+
"description": "If true, enable behavior analogous to the \"tsc --build\" command. Will build projects referenced by the main project. Note that this will effectively enable \"noEmitOnError\".",
|
|
57
|
+
"type": "boolean"
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
"useTranspilerWorker": {
|
|
61
|
+
"description": "If true, and the tsconfig has \"isolatedModules\": true, then transpilation will happen in parallel in a worker thread.",
|
|
62
|
+
"type": "boolean"
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
"project": {
|
|
66
|
+
"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\".",
|
|
67
|
+
"type": "string"
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
"staticAssetsToCopy": {
|
|
71
|
+
"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
|
+
"type": "object",
|
|
73
|
+
|
|
74
|
+
"additionalProperties": false,
|
|
75
|
+
|
|
76
|
+
"properties": {
|
|
77
|
+
"fileExtensions": {
|
|
78
|
+
"type": "array",
|
|
79
|
+
"description": "File extensions that should be copied from the source folder to the destination folder(s)",
|
|
80
|
+
"items": {
|
|
81
|
+
"type": "string",
|
|
82
|
+
"pattern": "^\\.[A-z0-9-_.]*[A-z0-9-_]+$"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
"excludeGlobs": {
|
|
87
|
+
"type": "array",
|
|
88
|
+
"description": "Globs that should be explicitly excluded. This takes precedence over globs listed in \"includeGlobs\" and files that match the file extensions provided in \"fileExtensions\".",
|
|
89
|
+
"items": {
|
|
90
|
+
"type": "string",
|
|
91
|
+
"pattern": "[^\\\\]"
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
"includeGlobs": {
|
|
96
|
+
"type": "array",
|
|
97
|
+
"description": "Globs that should be explicitly included.",
|
|
98
|
+
"items": {
|
|
99
|
+
"type": "string",
|
|
100
|
+
"pattern": "[^\\\\]"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { Path } from '@rushstack/node-core-library';
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export function getTsconfigFilePath(heftConfiguration, tsconfigRelativePath) {
|
|
9
|
+
return Path.convertToSlashes(
|
|
10
|
+
// Use path.resolve because the path can start with `./` or `../`
|
|
11
|
+
path.resolve(heftConfiguration.buildFolderPath, tsconfigRelativePath !== null && tsconfigRelativePath !== void 0 ? tsconfigRelativePath : './tsconfig.json'));
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export function loadTsconfig(options) {
|
|
17
|
+
const { tool: { ts, system }, tsconfigPath, tsCacheFilePath } = options;
|
|
18
|
+
const parsedConfigFile = ts.readConfigFile(tsconfigPath, system.readFile);
|
|
19
|
+
const currentFolder = path.dirname(tsconfigPath);
|
|
20
|
+
const tsconfig = ts.parseJsonConfigFileContent(parsedConfigFile.config, {
|
|
21
|
+
fileExists: system.fileExists,
|
|
22
|
+
readFile: system.readFile,
|
|
23
|
+
readDirectory: system.readDirectory,
|
|
24
|
+
realpath: system.realpath,
|
|
25
|
+
useCaseSensitiveFileNames: true
|
|
26
|
+
}, currentFolder,
|
|
27
|
+
/*existingOptions:*/ undefined, tsconfigPath);
|
|
28
|
+
if (tsconfig.options.incremental) {
|
|
29
|
+
tsconfig.options.tsBuildInfoFile = tsCacheFilePath;
|
|
30
|
+
}
|
|
31
|
+
return tsconfig;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=tsconfigLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsconfigLoader.js","sourceRoot":"","sources":["../src/tsconfigLoader.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAcpD;;GAEG;AACH,MAAM,UAAU,mBAAmB,CACjC,iBAAoC,EACpC,oBAAwC;IAExC,OAAO,IAAI,CAAC,gBAAgB;IAC1B,iEAAiE;IACjE,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,eAAe,EAAE,oBAAoB,aAApB,oBAAoB,cAApB,oBAAoB,GAAI,iBAAiB,CAAC,CAC3F,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,OAA6B;IACxD,MAAM,EACJ,IAAI,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EACpB,YAAY,EACZ,eAAe,EAChB,GAAG,OAAO,CAAC;IACZ,MAAM,gBAAgB,GAAyC,EAAE,CAAC,cAAc,CAC9E,YAAY,EACZ,MAAM,CAAC,QAAQ,CAChB,CAAC;IAEF,MAAM,aAAa,GAAW,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACzD,MAAM,QAAQ,GAAkC,EAAE,CAAC,0BAA0B,CAC3E,gBAAgB,CAAC,MAAM,EACvB;QACE,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,yBAAyB,EAAE,IAAI;KAChC,EACD,aAAa;IACb,oBAAoB,CAAC,SAAS,EAC9B,YAAY,CACb,CAAC;IAEF,IAAI,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QACjC,QAAQ,CAAC,OAAO,CAAC,eAAe,GAAG,eAAe,CAAC;IACrD,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,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 path from 'node:path';\n\nimport type * as TTypescript from 'typescript';\n\nimport { Path } from '@rushstack/node-core-library';\nimport type { HeftConfiguration } from '@rushstack/heft';\n\nimport type { IBaseTypeScriptTool } from './TypeScriptBuilder';\n\n/**\n * @internal\n */\nexport interface ILoadTsconfigOptions {\n tool: IBaseTypeScriptTool;\n tsconfigPath: string;\n tsCacheFilePath?: string;\n}\n\n/**\n * @internal\n */\nexport function getTsconfigFilePath(\n heftConfiguration: HeftConfiguration,\n tsconfigRelativePath: string | undefined\n): string {\n return Path.convertToSlashes(\n // Use path.resolve because the path can start with `./` or `../`\n path.resolve(heftConfiguration.buildFolderPath, tsconfigRelativePath ?? './tsconfig.json')\n );\n}\n\n/**\n * @internal\n */\nexport function loadTsconfig(options: ILoadTsconfigOptions): TTypescript.ParsedCommandLine {\n const {\n tool: { ts, system },\n tsconfigPath,\n tsCacheFilePath\n } = options;\n const parsedConfigFile: ReturnType<typeof ts.readConfigFile> = ts.readConfigFile(\n tsconfigPath,\n system.readFile\n );\n\n const currentFolder: string = path.dirname(tsconfigPath);\n const tsconfig: TTypescript.ParsedCommandLine = ts.parseJsonConfigFileContent(\n parsedConfigFile.config,\n {\n fileExists: system.fileExists,\n readFile: system.readFile,\n readDirectory: system.readDirectory,\n realpath: system.realpath,\n useCaseSensitiveFileNames: true\n },\n currentFolder,\n /*existingOptions:*/ undefined,\n tsconfigPath\n );\n\n if (tsconfig.options.incremental) {\n tsconfig.options.tsBuildInfoFile = tsCacheFilePath;\n }\n\n return tsconfig;\n}\n"]}
|
package/lib-esm/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type * as TTypescript from 'typescript';\n\nexport interface ITypescriptWorkerData {\n /**\n * Path to the version of TypeScript to use.\n */\n typeScriptToolPath: string;\n}\n\nexport interface ITranspilationRequestMessage {\n /**\n * Unique identifier for this request.\n */\n requestId: number;\n /**\n * The tsconfig compiler options to use for the request.\n */\n compilerOptions: TTypescript.CompilerOptions;\n /**\n * The variants to emit.\n */\n moduleKindsToEmit: ICachedEmitModuleKind[];\n /**\n * The set of files to build.\n */\n filesToTranspile: Map<string, string>;\n}\n\nexport interface ITranspilationSuccessMessage {\n requestId: number;\n type: 'success';\n result: TTypescript.EmitResult;\n}\n\nexport interface ITranspilationErrorMessage {\n requestId: number;\n type: 'error';\n result: {\n message: string;\n [key: string]: unknown;\n };\n}\n\nexport type ITranspilationResponseMessage = ITranspilationSuccessMessage | ITranspilationErrorMessage;\n\nexport interface ICachedEmitModuleKind {\n moduleKind: TTypescript.ModuleKind;\n\n outFolderPath: string;\n\n /**\n * File extension to use instead of '.js' for emitted ECMAScript files.\n * For example, '.cjs' to indicate commonjs content, or '.mjs' to indicate ECMAScript modules.\n */\n jsExtensionOverride: string | undefined;\n\n /**\n * Set to true if this is the emit kind that is specified in the tsconfig.json.\n * Declarations are only emitted for the primary module kind.\n */\n isPrimary: boolean;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/heft-typescript-plugin",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Heft plugin for TypeScript",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,27 +8,53 @@
|
|
|
8
8
|
"directory": "heft-plugins/heft-typescript-plugin"
|
|
9
9
|
},
|
|
10
10
|
"homepage": "https://rushstack.io/pages/heft/overview/",
|
|
11
|
-
"main": "lib/index.js",
|
|
12
|
-
"
|
|
11
|
+
"main": "./lib-commonjs/index.js",
|
|
12
|
+
"module": "./lib-esm/index.js",
|
|
13
|
+
"types": "./dist/heft-typescript-plugin.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/heft-typescript-plugin.d.ts",
|
|
17
|
+
"node": "./lib-commonjs/index.js",
|
|
18
|
+
"import": "./lib-esm/index.js",
|
|
19
|
+
"require": "./lib-commonjs/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./lib/*.schema.json": "./lib-commonjs/*.schema.json",
|
|
22
|
+
"./lib/*": {
|
|
23
|
+
"types": "./lib-dts/*.d.ts",
|
|
24
|
+
"node": "./lib-commonjs/*.js",
|
|
25
|
+
"import": "./lib-esm/*.js",
|
|
26
|
+
"require": "./lib-commonjs/*.js"
|
|
27
|
+
},
|
|
28
|
+
"./heft-plugin.json": "./heft-plugin.json",
|
|
29
|
+
"./package.json": "./package.json"
|
|
30
|
+
},
|
|
31
|
+
"typesVersions": {
|
|
32
|
+
"*": {
|
|
33
|
+
"lib/*": [
|
|
34
|
+
"lib-dts/*"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
},
|
|
13
38
|
"license": "MIT",
|
|
14
39
|
"peerDependencies": {
|
|
15
|
-
"@rushstack/heft": "1.1
|
|
40
|
+
"@rushstack/heft": "1.2.1"
|
|
16
41
|
},
|
|
17
42
|
"dependencies": {
|
|
18
43
|
"@types/tapable": "1.0.6",
|
|
19
44
|
"semver": "~7.5.4",
|
|
20
45
|
"tapable": "1.1.3",
|
|
21
|
-
"@rushstack/
|
|
22
|
-
"@rushstack/
|
|
46
|
+
"@rushstack/node-core-library": "5.20.1",
|
|
47
|
+
"@rushstack/heft-config-file": "0.20.1"
|
|
23
48
|
},
|
|
24
49
|
"devDependencies": {
|
|
25
50
|
"@types/semver": "7.5.0",
|
|
26
51
|
"eslint": "~9.37.0",
|
|
27
52
|
"typescript": "~5.8.2",
|
|
28
|
-
"@rushstack/heft": "1.1
|
|
53
|
+
"@rushstack/heft": "1.2.1",
|
|
29
54
|
"decoupled-local-node-rig": "1.0.0",
|
|
30
|
-
"@rushstack/terminal": "0.
|
|
55
|
+
"@rushstack/terminal": "0.22.1"
|
|
31
56
|
},
|
|
57
|
+
"sideEffects": false,
|
|
32
58
|
"scripts": {
|
|
33
59
|
"build": "heft test --clean",
|
|
34
60
|
"start": "heft build-watch",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|