Skip to content

Commit

Permalink
fix: Only check file dependencies once/file. (#901)
Browse files Browse the repository at this point in the history
Fixes #900
  • Loading branch information
stephenh authored Aug 13, 2023
1 parent 5fb444e commit 8d61980
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,18 @@ async function main() {

if (options.emitImportedFiles) {
const fileSet = new Set();
const addFilesUnlessAliased = (filenames: string[]) => {
function addFilesUnlessAliased(filenames: string[]) {
filenames
.filter((name) => !options.M[name])
.forEach((name) => {
if (fileSet.has(name)) return;
fileSet.add(name);
const file = request.protoFile.find((file) => file.name === name);
if (file && file.dependency.length > 0) {
addFilesUnlessAliased(file.dependency);
}
});
};
}
addFilesUnlessAliased(request.fileToGenerate);
filesToGenerate = request.protoFile.filter((file) => fileSet.has(file.name));
} else {
Expand Down

0 comments on commit 8d61980

Please sign in to comment.