
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
bun-plugin-dtsx
Advanced tools
A Bun Bundler plugin that auto generates your DTS types extremely fast.
A Bun Bundler plugin for automatic TypeScript declaration file generation using dtsx.
bun add bun-plugin-dtsx -d
# or
npm install bun-plugin-dtsx --save-dev
// build.ts
import { dts } from 'bun-plugin-dtsx'
await Bun.build({
entrypoints: ['src/index.ts'],
outdir: 'dist',
plugins: [
dts({
// Options
}),
],
})
| Option | Type | Default | Description |
|---|---|---|---|
trigger | 'build' | 'watch' | 'both' | 'build' | When to generate declarations |
entryPointsOnly | boolean | true | Only generate for entry points |
declarationDir | string | Bun outdir | Output directory for declarations |
bundle | boolean | false | Bundle all declarations into one file |
bundleOutput | string | 'index.d.ts' | Bundled output filename |
exclude | (string | RegExp)[] | [] | Patterns to exclude |
include | (string | RegExp)[] | [] | Patterns to include |
emitOnError | boolean | true | Emit even with type errors |
import { dts } from 'bun-plugin-dtsx'
await Bun.build({
entrypoints: ['src/index.ts'],
outdir: 'dist',
plugins: [dts()],
})
import { dts } from 'bun-plugin-dtsx'
await Bun.build({
entrypoints: ['src/index.ts'],
outdir: 'dist',
plugins: [
dts({
bundle: true,
bundleOutput: 'types.d.ts',
}),
],
})
import { dts } from 'bun-plugin-dtsx'
await Bun.build({
entrypoints: ['src/index.ts', 'src/utils.ts'],
outdir: 'dist',
plugins: [
dts({
entryPointsOnly: true,
}),
],
})
import { dts } from 'bun-plugin-dtsx'
await Bun.build({
entrypoints: ['src/index.ts'],
outdir: 'dist',
plugins: [
dts({
onStart: () => {
console.log('Starting declaration generation...')
},
onSuccess: (stats) => {
console.log(`Generated ${stats.totalFiles} files in ${stats.totalTime}ms`)
},
onError: (error) => {
console.error('Failed to generate declarations:', error.message)
},
}),
],
})
import { dts } from 'bun-plugin-dtsx'
await Bun.build({
entrypoints: ['src/index.ts'],
outdir: 'dist',
plugins: [
dts({
include: [/src\/lib/],
exclude: ['test', /\.spec\.ts$/],
}),
],
})
import { dts } from 'bun-plugin-dtsx'
await Bun.build({
entrypoints: ['src/index.ts'],
outdir: 'dist',
plugins: [
dts({
declarationDir: 'types',
}),
],
})
MIT
FAQs
A Bun Bundler plugin that auto generates your DTS types extremely fast.
The npm package bun-plugin-dtsx receives a total of 67,309 weekly downloads. As such, bun-plugin-dtsx popularity was classified as popular.
We found that bun-plugin-dtsx demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.