{"name":"unplugin-isolated-decl","version":"0.15.1","keywords":["unplugin","rollup","vite","esbuild","webpack"],"author":{"name":"三咲智子 Kevin Deng","email":"sxzz@sxzz.moe"},"license":"MIT","_id":"unplugin-isolated-decl@0.15.1","maintainers":[{"name":"sxzz","email":"sxzz@sxzz.moe"}],"homepage":"https://github.com/unplugin/unplugin-isolated-decl#readme","bugs":{"url":"https://github.com/unplugin/unplugin-isolated-decl/issues"},"dist":{"shasum":"a7fb4296120cb6f1a182376262746d506dab5e86","tarball":"http://registry-npm.ywwl.com/unplugin-isolated-decl/download/unplugin-isolated-decl-0.15.1.tgz","fileCount":23,"integrity":"sha512-v4se5MI4nRIUykKyv6GXPhjv1qh+0pr1/CPuQh1GKuhwGrEbWzCup5fWCXPmZF7L+eHdOpzBPFN+hWP83ea3PA==","signatures":[{"sig":"MEQCIBfElN9CpK9qH/w6JWYuGHbXTedbA9IfhVptM6MAwagGAiACTJ4A2kagGu6dWDFrDJVxX9yl+AedEHhlsNm9bvrRQA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/unplugin-isolated-decl@0.15.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":33132,"size":10174,"noattachment":false,"key":"/unplugin-isolated-decl/-/unplugin-isolated-decl-0.15.1.tgz"},"main":"./dist/index.js","type":"module","_from":"file:unplugin-isolated-decl-0.15.1.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20.18.0"},"exports":{".":"./dist/index.js","./*":"./*","./api":"./dist/api.js","./farm":"./dist/farm.js","./vite":"./dist/vite.js","./rollup":"./dist/rollup.js","./esbuild":"./dist/esbuild.js","./rolldown":"./dist/rolldown.js"},"funding":"https://github.com/sponsors/sxzz","scripts":{"dev":"tsdown --watch","lint":"eslint --cache .","test":"vitest","build":"tsdown","release":"bumpp","lint:fix":"pnpm run lint --fix","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:b63b7c99-44bd-4c7b-b9fe-0561c33800d8"}},"prettier":"@sxzz/prettier-config","_resolved":"/tmp/7af7f657b05a3a50a7ee8ad66d75e514/unplugin-isolated-decl-0.15.1.tgz","_integrity":"sha512-v4se5MI4nRIUykKyv6GXPhjv1qh+0pr1/CPuQh1GKuhwGrEbWzCup5fWCXPmZF7L+eHdOpzBPFN+hWP83ea3PA==","repository":{"url":"git+https://github.com/unplugin/unplugin-isolated-decl.git","type":"git"},"_npmVersion":"11.5.2","description":"A blazing-fast tool for generating isolated declarations.","directories":{},"resolutions":{"@changesets/cli":"-","unplugin-isolated-decl":"-"},"_nodeVersion":"22.18.0","dependencies":{"debug":"^4.4.1","unplugin":"^2.3.6","oxc-parser":">=0.82.1","magic-string":"^0.30.17","oxc-transform":">=0.82.1","unplugin-utils":"^0.2.5"},"publishConfig":{"access":"public"},"typesVersions":{"*":{"*":["./dist/*","./*"]}},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.20.4","vite":"^7.1.2","bumpp":"^10.2.3","eslint":"^9.33.0","rollup":"^4.46.2","tsdown":"^0.14.1","vitest":"^3.2.4","esbuild":"^0.25.9","publint":"^0.3.12","prettier":"^3.6.2","rolldown":"^1.0.0-beta.32","@swc/core":"^1.13.3","fast-glob":"^3.3.3","tinyglobby":"^0.2.14","typescript":"^5.9.2","@types/node":"^24.3.0","@farmfe/core":"^1.7.11","@types/debug":"^4.1.12","unplugin-oxc":"^0.5.0","@sxzz/test-utils":"^0.5.9","@oxc-project/types":"^0.82.1","@sxzz/eslint-config":"^7.1.2","@rollup/plugin-alias":"^5.1.1","@sxzz/prettier-config":"^2.2.3"},"peerDependencies":{"@swc/core":"^1.6.6","typescript":"^5.5.2"},"peerDependenciesMeta":{"@swc/core":{"optional":true},"typescript":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/unplugin-isolated-decl_0.15.1_1755420998475_0.2767031352048843","host":"s3://npm-registry-packages-npm-production"},"readme":"# unplugin-isolated-decl\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![JSR][jsr-src]][jsr-href]\n[![Unit Test][unit-test-src]][unit-test-href]\n\n⚡️ A blazing-fast tool for generating isolated declarations.\n\n## Features\n\n- 🚀 **Fast**: Generates `.d.ts` files significantly faster than `tsc`.\n- 🎨 **Transformer**: Support Oxc, SWC, and TypeScript transformer.\n- 📦 **Zero Config**: No configuration required, works out of the box.\n- ✨ **Bundler Support**: Works with Vite, Rollup, esbuild and Farm.\n\n> [!TIP]\n> For Rolldown users, you can use the [`rolldown-plugin-dts`](https://github.com/sxzz/rolldown-plugin-dts) for a more powerful and flexible solution.\n\n## Installation\n\n```bash\n# npm\nnpm i -D unplugin-isolated-decl\n\n# jsr\nnpx jsr add -D @unplugin/isolated-decl\n```\n\n## Usage\n\n<details>\n<summary>Vite</summary><br>\n\n```ts\n// vite.config.ts\nimport UnpluginIsolatedDecl from 'unplugin-isolated-decl/vite'\n\nexport default defineConfig({\n  plugins: [UnpluginIsolatedDecl()],\n})\n```\n\n<br></details>\n\n<details>\n<summary>Rollup</summary><br>\n\n```ts\n// rollup.config.js\nimport UnpluginIsolatedDecl from 'unplugin-isolated-decl/rollup'\n\nexport default {\n  plugins: [UnpluginIsolatedDecl()],\n}\n```\n\n<br></details>\n\n<details>\n<summary>Rolldown</summary><br>\n\n```ts\n// rolldown.config.js\nimport UnpluginIsolatedDecl from 'unplugin-isolated-decl/rolldown'\n\nexport default {\n  plugins: [UnpluginIsolatedDecl()],\n}\n```\n\n<br></details>\n\n<details>\n<summary>esbuild</summary><br>\n\n```ts\n// esbuild.config.js\nimport { build } from 'esbuild'\n\nbuild({\n  plugins: [require('unplugin-isolated-decl/esbuild')()],\n})\n```\n\n<br></details>\n\n<details>\n<summary>Farm</summary><br>\n\n```ts\n// farm.config.ts\nimport UnpluginIsolatedDecl from 'unplugin-isolated-decl/farm'\n\nexport default defineConfig({\n  plugins: [UnpluginIsolatedDecl()],\n})\n```\n\n<br></details>\n\n## Options\n\n```ts\nexport interface Options {\n  include?: FilterPattern\n  exclude?: FilterPattern\n  enforce?: 'pre' | 'post' | undefined\n  /**\n   * You should install the transformer manually if you are not using oxc.\n   * swc: @swc/core\n   * typescript: typescript\n   *\n   * @default oxc\n   */\n  transformer?: 'oxc' | 'swc' | 'typescript'\n  /**\n   * Whether to generate declaration source maps.\n   *\n   * Supported by `typescript` and `oxc` transformer only.\n   *\n   * @link https://www.typescriptlang.org/tsconfig/#declarationMap\n   */\n  sourceMap?: boolean\n\n  transformOptions?: TranspileOptions\n  ignoreErrors?: boolean\n  /** An extra directory layer for output files. */\n  extraOutdir?: string\n\n  rewriteImports?: (\n    id: string,\n    importer: string,\n  ) => string | void | null | undefined\n}\n```\n\n### `rewriteImports`\n\nRewrite imports in `.d.ts` files. (esbuild support is not available)\n\nHere is an example of rewriting imports on Rollup:\n\n```js\n// rollup.config.js\nimport alias from '@rollup/plugin-alias'\n\nexport default {\n  // ...\n  plugins: [\n    alias({ entries: [{ find: '~', replacement: '.' }] }),\n    UnpluginIsolatedDecl({\n      rewriteImports(id, importer) {\n        if (id[0] === '~') return `.${id.slice(1)}`\n      },\n    }),\n    // ...\n  ],\n}\n```\n\n### `patchCjsDefaultExport`\n\nPatch `export default` in `.d.cts` to `export =`\n\n---\n\n> [!NOTE]\n> For the exhaustive set of options check [options](src/core/options.ts)\n\n## Sponsors\n\n<p align=\"center\">\n  <a href=\"https://cdn.jsdelivr.net/gh/sxzz/sponsors/sponsors.svg\">\n    <img src='https://cdn.jsdelivr.net/gh/sxzz/sponsors/sponsors.svg'/>\n  </a>\n</p>\n\n## License\n\n[MIT](./LICENSE) License © 2024-PRESENT [Kevin Deng](https://github.com/sxzz)\n\n<!-- Badges -->\n\n[npm-version-src]: https://img.shields.io/npm/v/unplugin-isolated-decl.svg\n[npm-version-href]: https://npmjs.com/package/unplugin-isolated-decl\n[npm-downloads-src]: https://img.shields.io/npm/dm/unplugin-isolated-decl\n[npm-downloads-href]: https://www.npmcharts.com/compare/unplugin-isolated-decl?interval=30\n[jsr-src]: https://jsr.io/badges/@unplugin/isolated-decl\n[jsr-href]: https://jsr.io/@unplugin/isolated-decl\n[unit-test-src]: https://github.com/unplugin/unplugin-isolated-decl/actions/workflows/unit-test.yml/badge.svg\n[unit-test-href]: https://github.com/unplugin/unplugin-isolated-decl/actions/workflows/unit-test.yml\n","publish_time":1755420998657,"_cnpm_publish_time":1755420998657,"dist-tags":{"latest":"0.17.0"}}