0.6.8 • Published 8 months ago

unplugin-isolated-decl v0.6.8

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

unplugin-isolated-decl npm

Unit Test

⚡️ A blazing-fast tool for generating isolated declarations.

Features

  • 🚀 Fast: Generates .d.ts files significantly faster than tsc.
  • 🎨 Transformer: Support Oxc, SWC, and TypeScript transformer.
  • 📦 Zero Config: No configuration required, works out of the box.
  • Bundler Support: Works with Vite, Rollup, and esbuild.

Installation

npm i -D unplugin-isolated-decl

Usage

// vite.config.ts
import UnpluginIsolatedDecl from 'unplugin-isolated-decl/vite'

export default defineConfig({
  plugins: [UnpluginIsolatedDecl()],
})

// rollup.config.js
import UnpluginIsolatedDecl from 'unplugin-isolated-decl/rollup'

export default {
  plugins: [UnpluginIsolatedDecl()],
}

// rolldown.config.js
import UnpluginIsolatedDecl from 'unplugin-isolated-decl/rolldown'

export default {
  plugins: [UnpluginIsolatedDecl()],
}

// esbuild.config.js
import { build } from 'esbuild'

build({
  plugins: [require('unplugin-isolated-decl/esbuild')()],
})

Options

export interface Options {
  include?: FilterPattern
  exclude?: FilterPattern
  enforce?: 'pre' | 'post' | undefined
  /**
   * You need to install one of the supported transformers yourself.
   * @default typescript
   */
  transformer?: 'oxc' | 'swc' | 'typescript'
  /** Only for typescript transformer */
  transformOptions?: TranspileOptions
  ignoreErrors?: boolean

  /** An extra directory layer for output files. */
  extraOutdir?: string
  /** Automatically add `.js` extension to resolve in `Node16` + ESM mode. */
  autoAddExts?: boolean
}

autoAddExts

Automatically add .js extension to resolve in Node 16+ ESM mode.

// index.d.ts
import {} from './foo'

With autoAddExts, it will be transformed to:

// index.d.ts
import {} from './foo.js'

patchCjsDefaultExport

Patch export default in .d.cts to export =


!NOTE For the exhaustive set of options check options

Sponsors

License

MIT License © 2024-PRESENT 三咲智子

0.6.8

8 months ago

0.6.7

8 months ago

0.6.6

9 months ago

0.6.3

9 months ago

0.6.2

9 months ago

0.6.5

9 months ago

0.6.4

9 months ago

0.5.0

9 months ago

0.6.1

9 months ago

0.5.2

9 months ago

0.6.0

9 months ago

0.5.1

9 months ago

0.4.7

10 months ago

0.4.6

10 months ago

0.4.5

10 months ago

0.4.4

10 months ago

0.4.3

10 months ago

0.4.2

10 months ago

0.4.1

12 months ago

0.4.0

12 months ago

0.3.0

12 months ago

0.2.0

12 months ago

0.1.0

12 months ago

0.0.1-beta.2

12 months ago

0.0.1-beta.1

12 months ago