-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f7a9abd
commit e67e635
Showing
3 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import type { DtsGenerationOption } from '../../src/types' | ||
import type { BunPlugin } from 'bun' | ||
import process from 'node:process' | ||
import { generate } from '../../src/index' | ||
|
||
export function dts(options?: DtsGenerationOption): BunPlugin { | ||
return { | ||
name: 'bun-plugin-dtsx', | ||
|
||
async setup(build) { | ||
const cwd = options?.cwd ?? process.cwd() | ||
const root = options?.root ?? build.config.root | ||
const entrypoints = options?.entrypoints ?? build.config.entrypoints | ||
const outdir = options?.outdir ?? build.config.outdir | ||
const keepComments = options?.keepComments ?? true | ||
const clean = options?.clean ?? false | ||
const tsconfigPath = options?.tsconfigPath ?? './tsconfig.json' | ||
|
||
await generate({ | ||
...options, | ||
cwd, | ||
root, | ||
entrypoints, | ||
outdir, | ||
keepComments, | ||
clean, | ||
tsconfigPath, | ||
}) | ||
}, | ||
} | ||
} | ||
|
||
export { generate } | ||
|
||
export type { DtsGenerationOption } | ||
|
||
export default dts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import type { DtsGenerationOption } from '../../src/types' | ||
import type { BunPlugin } from 'bun' | ||
|
||
export function dts(options?: DtsGenerationOption): BunPlugin | ||
|
||
export function generate(options: DtsGenerationOption): Promise<void> | ||
|
||
export { DtsGenerationOption } | ||
|
||
export default dts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters