-
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.
Showing
5 changed files
with
87 additions
and
1 deletion.
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 '@stacksjs/dtsx' | ||
import type { BunPlugin } from 'bun' | ||
import process from 'node:process' | ||
import { generate } from '@stacksjs/dtsx' | ||
|
||
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,11 @@ | ||
import type { DtsGenerationOption } from '@stacksjs/dtsx' | ||
import type { BunPlugin } from 'bun' | ||
import { generate } from '@stacksjs/dtsx' | ||
|
||
export declare function dts(options?: DtsGenerationOption): BunPlugin | ||
|
||
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,14 @@ | ||
import path from 'node:path' | ||
import { generate } from '../src' | ||
|
||
console.log('Generating output for reviewal...', path.join(__dirname, '..')) | ||
|
||
generate({ | ||
cwd: path.join(__dirname, '..'), | ||
root: path.join(__dirname, '..', 'fixtures/input'), | ||
outdir: path.join(__dirname, '..', 'fixtures/generated'), | ||
clean: true, | ||
tsconfigPath: path.join(__dirname, '..', 'tsconfig.json'), | ||
}) | ||
|
||
console.log('Generated') |
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
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