Skip to content

Commit

Permalink
fix: 整理rollup插件的导出形式
Browse files Browse the repository at this point in the history
  • Loading branch information
xuasir committed Feb 5, 2021
1 parent ab2eb86 commit 2618d8f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
14 changes: 4 additions & 10 deletions packages/cli-plugin-bundler-rollup/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import type { IPluginAPI } from '@xus/cli'
import { rollupSchema } from './options'
import RollupManager from './rollupManager'
import registerFn from './registerRollup'
export default registerFn

export default function (api: IPluginAPI): void {
// config validator
api.registerConfigValidator('rollup', rollupSchema)
// register bundler
api.registerBundler('rollup', new RollupManager())
}
export { createRollupPluginConfig } from './options'

// export types
export * from './types'
export { IRollupChain } from './rollupChian'
export { IRollupManager, createRollupChainFn } from './rollupManager'
export { IRollupManager } from './rollupManager'
3 changes: 3 additions & 0 deletions packages/cli-plugin-bundler-rollup/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ export function defaultRollupConfig(): RollupPluginConfig {
targets: ['esm-bundler', 'esm-browser', 'node', 'global']
}
}

export const createRollupPluginConfig = (config: Partial<RollupPluginConfig>) =>
config
10 changes: 10 additions & 0 deletions packages/cli-plugin-bundler-rollup/src/registerRollup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { IPluginAPI } from '@xus/cli'
import { rollupSchema } from './options'
import RollupManager from './rollupManager'

export default function (api: IPluginAPI): void {
// config validator
api.registerConfigValidator('rollup', rollupSchema)
// register bundler
api.registerBundler('rollup', new RollupManager())
}

0 comments on commit 2618d8f

Please sign in to comment.