Skip to content

Commit 5543925

Browse files
committed
fix(transform): warn only for isolated decl errors
1 parent 154b770 commit 5543925

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/builders/transform.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,26 @@ export async function transformDir(ctx: BuildContext, entry: TransformEntry): Pr
7676
const errors = results
7777
.filter((result): result is PromiseRejectedResult => result.status === "rejected")
7878
.map((result) => result.reason);
79+
7980
if (errors.length > 0) {
80-
for (const error of errors) {
81+
let isolatedErrors: Error[] = [];
82+
let otherErrors: Error[] = [];
83+
for (const error of errors.flatMap((err) => (Array.isArray(err.cause) ? err.cause : [err]))) {
84+
if (error.message?.includes("--isolatedDeclarations")) {
85+
isolatedErrors.push(error);
86+
} else {
87+
otherErrors.push(error);
88+
}
89+
}
90+
for (const error of otherErrors) {
8191
consola.error(error);
8292
}
83-
throw new Error(`Errors while transforming ${entry.input} (${errors.length} failed)`);
93+
for (const error of isolatedErrors) {
94+
consola.warn(error);
95+
}
96+
if (otherErrors.length > 0) {
97+
throw new Error(`Errors while transforming ${entry.input}`);
98+
}
8499
}
85100

86101
const writtenFiles = results

0 commit comments

Comments
 (0)