
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
bun-plugin-dtsx
Advanced tools
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 60,234 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.

Security News
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.