diff --git a/README.md b/README.md index 6c83d52..a471e33 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ ## Features -- 🚀 **Fast**: Blazing-fast `.d.ts` generator, powered by Oxc. +- 🚀 **Fast**: Generates `.d.ts` files significantly faster than `tsc`. - 🎨 **Transformer**: Support Oxc, SWC, and TypeScript transformer. - 📦 **Zero Config**: No configuration required, works out of the box. - ✨ **Bundler Support**: Works with Vite, Rollup, and esbuild. @@ -89,6 +89,7 @@ export interface Options { transformer?: 'oxc' | 'swc' | 'typescript' /** Only for typescript transformer */ transformOptions?: TranspileOptions + ignoreErrors?: boolean } ``` diff --git a/src/core/options.ts b/src/core/options.ts index af64be2..4efc914 100644 --- a/src/core/options.ts +++ b/src/core/options.ts @@ -5,6 +5,7 @@ export type Options = { include?: FilterPattern exclude?: FilterPattern enforce?: 'pre' | 'post' | undefined + ignoreErrors?: boolean } & ( | { /** @@ -36,5 +37,6 @@ export function resolveOptions(options: Options): OptionsResolved { exclude: options.exclude || [/node_modules/], enforce: 'enforce' in options ? options.enforce : 'pre', transformer: options.transformer || 'oxc', + ignoreErrors: options.ignoreErrors || false, } } diff --git a/src/index.ts b/src/index.ts index 325f5a0..7b58e28 100644 --- a/src/index.ts +++ b/src/index.ts @@ -79,8 +79,12 @@ export const IsolatedDecl: UnpluginInstance = } const { sourceText, errors } = result if (errors.length) { - this.error(errors[0]) - return + if (options.ignoreErrors) { + this.warn(errors[0]) + } else { + this.error(errors[0]) + return + } } addOutput(id, sourceText) },