@rushstack/typings-generator
Advanced tools
Comparing version 0.8.11 to 0.8.12
@@ -95,6 +95,6 @@ import { ITerminal } from '@rushstack/node-core-library'; | ||
* | ||
* @param filePaths - The input files to process, relative to the source folder. If not provided, | ||
* @param relativeFilePaths - The input files to process, relative to the source folder. If not provided, | ||
* all input files will be processed. | ||
*/ | ||
generateTypingsAsync(filePaths?: string[]): Promise<void>; | ||
generateTypingsAsync(relativeFilePaths?: string[]): Promise<void>; | ||
runWatcherAsync(): Promise<void>; | ||
@@ -109,2 +109,3 @@ /** | ||
getOutputFilePaths(relativePath: string): string[]; | ||
private _getOutputFilePathsWithoutCheck; | ||
private _reprocessFiles; | ||
@@ -111,0 +112,0 @@ private _parseFileAndGenerateTypingsAsync; |
@@ -52,6 +52,6 @@ import { ITerminal } from '@rushstack/node-core-library'; | ||
* | ||
* @param filePaths - The input files to process, relative to the source folder. If not provided, | ||
* @param relativeFilePaths - The input files to process, relative to the source folder. If not provided, | ||
* all input files will be processed. | ||
*/ | ||
generateTypingsAsync(filePaths?: string[]): Promise<void>; | ||
generateTypingsAsync(relativeFilePaths?: string[]): Promise<void>; | ||
runWatcherAsync(): Promise<void>; | ||
@@ -66,2 +66,3 @@ /** | ||
getOutputFilePaths(relativePath: string): string[]; | ||
private _getOutputFilePathsWithoutCheck; | ||
private _reprocessFiles; | ||
@@ -68,0 +69,0 @@ private _parseFileAndGenerateTypingsAsync; |
@@ -77,8 +77,10 @@ "use strict"; | ||
* | ||
* @param filePaths - The input files to process, relative to the source folder. If not provided, | ||
* @param relativeFilePaths - The input files to process, relative to the source folder. If not provided, | ||
* all input files will be processed. | ||
*/ | ||
async generateTypingsAsync(filePaths) { | ||
if (!(filePaths === null || filePaths === void 0 ? void 0 : filePaths.length)) { | ||
filePaths = await node_core_library_1.LegacyAdapters.convertCallbackToPromise(glob_1.default, this.inputFileGlob, { | ||
async generateTypingsAsync(relativeFilePaths) { | ||
let checkFilePaths = true; | ||
if (!(relativeFilePaths === null || relativeFilePaths === void 0 ? void 0 : relativeFilePaths.length)) { | ||
checkFilePaths = false; // Don't check file paths if we generate them | ||
relativeFilePaths = await node_core_library_1.LegacyAdapters.convertCallbackToPromise(glob_1.default, this.inputFileGlob, { | ||
cwd: this.sourceFolderPath, | ||
@@ -90,3 +92,3 @@ ignore: this.ignoredFileGlobs, | ||
} | ||
await this._reprocessFiles(filePaths); | ||
await this._reprocessFiles(relativeFilePaths, checkFilePaths); | ||
} | ||
@@ -108,3 +110,3 @@ async runWatcherAsync() { | ||
queue.clear(); | ||
this._reprocessFiles(toProcess) | ||
this._reprocessFiles(toProcess, false) | ||
.then(() => { | ||
@@ -140,3 +142,3 @@ processing = false; | ||
watcher.on('unlink', async (relativePath) => { | ||
await Promise.all(this.getOutputFilePaths(relativePath).map(async (outputFile) => { | ||
await Promise.all(this._getOutputFilePathsWithoutCheck(relativePath).map(async (outputFile) => { | ||
await node_core_library_1.FileSystem.deleteFileAsync(outputFile); | ||
@@ -171,2 +173,8 @@ })); | ||
getOutputFilePaths(relativePath) { | ||
if (path.isAbsolute(relativePath)) { | ||
throw new Error(`"${relativePath}" must be relative`); | ||
} | ||
return this._getOutputFilePathsWithoutCheck(relativePath); | ||
} | ||
_getOutputFilePathsWithoutCheck(relativePath) { | ||
var _a, _b; | ||
@@ -177,6 +185,9 @@ const typingsFilePaths = this._getTypingsFilePaths(relativePath); | ||
} | ||
async _reprocessFiles(relativePaths) { | ||
async _reprocessFiles(relativePaths, checkFilePaths) { | ||
// Build a queue of resolved paths | ||
const toProcess = new Set(); | ||
for (const rawPath of relativePaths) { | ||
if (checkFilePaths && path.isAbsolute(rawPath)) { | ||
throw new Error(`"${rawPath}" must be relative`); | ||
} | ||
const relativePath = node_core_library_1.Path.convertToSlashes(rawPath); | ||
@@ -183,0 +194,0 @@ const resolvedPath = path.resolve(this._options.srcFolder, rawPath); |
{ | ||
"name": "@rushstack/typings-generator", | ||
"version": "0.8.11", | ||
"version": "0.8.12", | ||
"description": "This library provides functionality for automatically generating typings for non-TS files.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
58889
566