Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow not passing a config #59

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/esbuild.ts
@@ -1,3 +1,3 @@
import unplugin from '.'
import unplugin, { Options } from '.'

export default unplugin.esbuild
export default unplugin.esbuild as (options?: Options) => any;
2 changes: 1 addition & 1 deletion src/index.ts
Expand Up @@ -15,7 +15,7 @@ import { join } from 'pathe'

export { Options }

export default createUnplugin<Options>((opt, meta) => {
export default createUnplugin<Options>((opt = {}, meta) => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we do

Suggested change
export default createUnplugin<Options>((opt = {}, meta) => {
export default createUnplugin<Options | undefined>((opt = {}, meta) => {

and avoid changing al the src/*.ts entry files like esbuild, rollup, etc

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, it seems like this would create the correct type: https://github.com/unjs/unplugin/blob/main/src/types.ts#L69-L71

const options = resolveOptions(opt)
const ctx = createRoutesContext(options)

Expand Down
4 changes: 2 additions & 2 deletions src/rollup.ts
@@ -1,3 +1,3 @@
import unplugin from '.'
import unplugin, { Options } from '.'

export default unplugin.rollup
export default unplugin.rollup as (options?: Options) => any;
4 changes: 2 additions & 2 deletions src/vite.ts
@@ -1,3 +1,3 @@
import unplugin from '.'
import unplugin, { Options } from '.'

export default unplugin.vite
export default unplugin.vite as (options?: Options) => any;
4 changes: 2 additions & 2 deletions src/webpack.ts
@@ -1,3 +1,3 @@
import unplugin from '.'
import unplugin, { Options } from '.'

export default unplugin.webpack
export default unplugin.webpack as (options?: Options) => any;