Skip to content

Commit 46b19dd

Browse files
committed
simplify types
1 parent a9b7d7a commit 46b19dd

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/project/project-context.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ export async function projectInputFiles(
741741
engineIntermediates: string[];
742742
};
743743

744-
const addFile = async (file: string): Promise<FileInclusion | undefined> => {
744+
const addFile = async (file: string): Promise<FileInclusion[]> => {
745745
// ignore the file if it is in the output directory
746746
if (
747747
outputDir &&
@@ -752,23 +752,23 @@ export async function projectInputFiles(
752752
ensureTrailingSlash(dir),
753753
)
754754
) {
755-
return;
755+
return [];
756756
}
757757

758758
const engine = await fileExecutionEngine(file, undefined, project);
759759
// ignore the file if there's no engine to handle it
760760
if (!engine) {
761-
return undefined;
761+
return [];
762762
}
763763
const engineIntermediates = executionEngineIntermediateFiles(
764764
engine,
765765
file,
766766
);
767-
return {
767+
return [{
768768
file,
769769
engineName: engine.name,
770770
engineIntermediates: engineIntermediates,
771-
};
771+
}];
772772
};
773773
const addDir = async (dir: string): Promise<FileInclusion[]> => {
774774
// ignore selected other globs
@@ -794,18 +794,13 @@ export async function projectInputFiles(
794794
return !projectIgnores.some((regex) => regex.test(pathRelative));
795795
})
796796
.map(async (walk) => addFile(walk.path)),
797-
).then((fileInclusions) => fileInclusions.filter((f) => f !== undefined));
797+
).then((fileInclusions) => fileInclusions.flat());
798798
};
799799
const addEntry = async (entry: string) => {
800800
if (Deno.statSync(entry).isDirectory) {
801801
return addDir(entry);
802802
} else {
803-
const inclusion = await addFile(entry);
804-
if (inclusion) {
805-
return [inclusion];
806-
} else {
807-
return [];
808-
}
803+
return addFile(entry);
809804
}
810805
};
811806
const renderFiles = metadata?.project[kProjectRender];

0 commit comments

Comments
 (0)