Skip to content

Commit

Permalink
feat: ignore errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Jul 13, 2024
1 parent 178fe2d commit 3ebeba5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -89,6 +89,7 @@ export interface Options {
transformer?: 'oxc' | 'swc' | 'typescript'
/** Only for typescript transformer */
transformOptions?: TranspileOptions
ignoreErrors?: boolean
}
```

Expand Down
2 changes: 2 additions & 0 deletions src/core/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export type Options = {
include?: FilterPattern
exclude?: FilterPattern
enforce?: 'pre' | 'post' | undefined
ignoreErrors?: boolean
} & (
| {
/**
Expand Down Expand Up @@ -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,
}
}
8 changes: 6 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,12 @@ export const IsolatedDecl: UnpluginInstance<Options | undefined, false> =
}
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)
},
Expand Down

0 comments on commit 3ebeba5

Please sign in to comment.