Skip to content

Commit 2261be2

Browse files
committed
types: add types
1 parent 70855f1 commit 2261be2

7 files changed

Lines changed: 79 additions & 0 deletions

File tree

src/types/args.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export interface Args {
2+
config?: string
3+
c?: string
4+
}

src/types/build.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export interface BuildStats {
2+
time: {
3+
start: number
4+
end: number
5+
}
6+
size: number
7+
files: string[]
8+
}
9+
10+
// Auto-generated
11+
export * from '../build.js'

src/types/entries.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import type { OutputOptions } from 'rollup'
2+
import type { BuildPlugins } from './plugins.js'
3+
4+
export interface EntriesOptions {
5+
input: string
6+
output: string
7+
format?: OutputOptions['format']
8+
externals?: (string | RegExp)[]
9+
banner?: OutputOptions['banner']
10+
footer?: OutputOptions['footer']
11+
minify?: boolean
12+
tsconfig?: string
13+
plugins?: BuildPlugins
14+
}

src/types/hooks.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import type { Options } from './options.js'
2+
3+
export interface BuildHooks {
4+
'build:before'?: (options?: Options) => void | Promise<void>
5+
'build:done'?: (options?: Options) => void | Promise<void>
6+
}

src/types/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export * from './args.js'
2+
export * from './hooks.js'
3+
export * from './plugins.js'
4+
export * from './entries.js'
5+
export * from './options.js'
6+
export * from './build.js'

src/types/options.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import type { EntriesOptions } from './entries.js'
2+
import type { BuildHooks } from './hooks.js'
3+
4+
export interface Options {
5+
entries: (string | EntriesOptions)[]
6+
/**
7+
* Specifies the output directory for production bundle.
8+
*
9+
* @default 'dist'
10+
*/
11+
outDir?: string
12+
/**
13+
* Specifies the module IDs, or regular expressions to match module IDs,
14+
* that should remain external to the bundle.
15+
*
16+
* @default [/^node:/, /^@types/, /^@rollup/, /^rollup/, ...packageDependencies]
17+
*/
18+
externals?: (string | RegExp)[]
19+
/**
20+
* Provides a powerful hooking system to further expand build mode.
21+
*
22+
* @default undefined
23+
*/
24+
hooks?: BuildHooks
25+
}

src/types/plugins.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import type { RollupReplaceOptions } from '@rollup/plugin-replace'
2+
import type { RollupJsonOptions } from '@rollup/plugin-json'
3+
import type { RollupNodeResolveOptions } from '@rollup/plugin-node-resolve'
4+
import type { TransformOptions as EsbuildOptions } from 'esbuild'
5+
import type { Options as DtsOptions } from 'rollup-plugin-dts'
6+
7+
export interface BuildPlugins {
8+
esbuild?: EsbuildOptions
9+
dts?: DtsOptions
10+
resolve?: RollupNodeResolveOptions | true
11+
json?: RollupJsonOptions | true
12+
replace?: RollupReplaceOptions
13+
}

0 commit comments

Comments
 (0)