{"_id":"@unjsio/rollup-plugin-dts","_rev":"2978253","name":"@unjsio/rollup-plugin-dts","description":"A rollup plugin that will bundle up your .d.ts definition files.","dist-tags":{"latest":"5.0.0-rc.1"},"maintainers":[{"name":"pi0","email":"pooya@pi0.ir"}],"time":{"modified":"2023-06-21T16:40:12.000Z","created":"2022-10-15T10:29:57.407Z","5.0.0-rc.1":"2022-10-15T10:29:57.407Z"},"users":{},"author":{"name":"Arpad Borsos","email":"arpad.borsos@googlemail.com"},"repository":{"type":"git","url":"git+https://github.com/Swatinem/rollup-plugin-dts.git"},"versions":{"5.0.0-rc.1":{"name":"@unjsio/rollup-plugin-dts","version":"5.0.0-rc.1","description":"A rollup plugin that will bundle up your .d.ts definition files.","keywords":["rollup-plugin","typescript","dts","@types"],"author":{"name":"Arpad Borsos","email":"arpad.borsos@googlemail.com"},"license":"LGPL-3.0","repository":{"type":"git","url":"git+https://github.com/Swatinem/rollup-plugin-dts.git"},"bugs":{"url":"https://github.com/Swatinem/rollup-plugin-dts/issues"},"funding":{"url":"https://github.com/sponsors/Swatinem"},"homepage":"https://github.com/Swatinem/rollup-plugin-dts#readme","engines":{"node":">=v14"},"type":"module","main":"./dist/rollup-plugin-dts.cjs","exports":{"types":"./dist/rollup-plugin-dts.d.ts","import":"./dist/rollup-plugin-dts.mjs","require":"./dist/rollup-plugin-dts.cjs"},"types":"./dist/rollup-plugin-dts.d.ts","sideEffects":false,"scripts":{"clean":"rimraf dist","prebuild":"npm run clean","build":"tsc && rollup --bundleConfigAsCjs -c .build/rollup.config.js","prepublishOnly":"npm run test","pretest":"npm run build","test":"c8 node .build/tests/index.js"},"prettier":{"printWidth":120,"trailingComma":"all"},"devDependencies":{"@types/babel__code-frame":"^7.0.3","@types/d3-drag":"^3.0.1","@types/estree":"1.0.0","@types/fs-extra":"^9.0.13","@types/node":"^18.11.0","@types/react":"^18.0.21","c8":"^7.12.0","fs-extra":"^10.1.0","rimraf":"^3.0.2","rollup":"3.1.0","typescript":"4.8.4"},"peerDependencies":{"rollup":"^3.0.0","typescript":"^4.1"},"optionalDependencies":{"@babel/code-frame":"^7.18.6"},"dependencies":{"magic-string":"^0.26.7","@babel/code-frame":"^7.18.6"},"gitHead":"4a547671d9337770c2189cd0fc8b90b036d8aa90","_id":"@unjsio/rollup-plugin-dts@5.0.0-rc.1","_nodeVersion":"16.17.0","_npmVersion":"8.15.0","dist":{"shasum":"c4d0d4b5eebebcfdb17dccc3158f2daed51e3cc4","size":43872,"noattachment":false,"key":"/@unjsio/rollup-plugin-dts/-/@unjsio/rollup-plugin-dts-5.0.0-rc.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@unjsio/rollup-plugin-dts/download/@unjsio/rollup-plugin-dts-5.0.0-rc.1.tgz"},"_npmUser":{"name":"pi0","email":"pyapar@gmail.com"},"directories":{},"maintainers":[{"name":"pi0","email":"pooya@pi0.ir"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rollup-plugin-dts_5.0.0-rc.1_1665829797200_0.48956053155140333"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-10-15T10:31:21.356Z","publish_time":1665829797407,"_cnpm_publish_time":1665829797407}},"readme":"# rollup-plugin-dts\n\n[![Build Status](https://github.com/Swatinem/rollup-plugin-dts/workflows/CI/badge.svg)](https://github.com/Swatinem/rollup-plugin-dts/actions?workflow=CI)\n[![Coverage Status](https://img.shields.io/codecov/c/github/Swatinem/rollup-plugin-dts.svg)](https://codecov.io/gh/Swatinem/rollup-plugin-dts)\n\nThis is a plugin that lets you roll-up your `.d.ts` definition files.\n\n## Usage\n\nInstall the package from `npm`:\n\n    $ npm install --save-dev rollup-plugin-dts\n\nAdd it to your `rollup.config.js`:\n\n```js\nimport dts from \"rollup-plugin-dts\";\n\nconst config = [\n  // …\n  {\n    input: \"./my-input/index.d.ts\",\n    output: [{ file: \"dist/my-library.d.ts\", format: \"es\" }],\n    plugins: [dts()],\n  },\n];\n\nexport default config;\n```\n\nAnd then instruct typescript where to find your definitions inside your `package.json`:\n\n```json\n  \"types\": \"dist/my-library.d.ts\",\n```\n\n**NOTE** that the plugin will automatically mark any external library\n(`@types` for example) as `external`, so those will be excluded from bundling.\n\n## What to expect\n\nWhile this plugin is fairly complete, it does not support all imaginable use-cases.\nIn particular, the plugin works best with already existing `.d.ts` files generated\nby the typescript compiler from idiomatic code.\n\nWorking with `.ts(x)` or even `.js(x)` (when setting `allowJs: true`) does work,\nbut is not recommended.\n\nThe plugin does its own import resolution through the typescript compiler, and\nusage together with other resolution plugins, such as `node-resolve` can lead\nto errors and is not recommended.\n\nAll external dependencies from `node_modules` are automatically excluded from\nbundling. This can be overridden using the `respectExternal` setting, but it is\ngenerally not recommended. While rollup of external `@types` generally works,\nit is not recommended.\n\n## Why?\n\nWell, ideally TypeScript should just do all this itself, and it even has a\n[proposal](https://github.com/Microsoft/TypeScript/issues/4433) to do that.\nBut there hasn’t been any progress in ~3 years.\n\nSome projects, like [rollup itself](https://github.com/rollup/rollup/blob/24fe07f39da8e4225f4bc4f797331930d8405ec2/src/rollup/types.d.ts)\ngo the route of completely separating their public interfaces in a separate file.\n\n## Alternatives\n\n- [API Extractor](https://api-extractor.com/)\n- [dts-bundle-generator](https://github.com/timocov/dts-bundle-generator)\n- [rollup-plugin-ts](https://github.com/wessberg/rollup-plugin-ts)\n- [tsc-prog](https://github.com/jeremyben/tsc-prog)\n\n[See](https://github.com/Swatinem/rollup-plugin-dts/issues/5)\n[some](https://github.com/Swatinem/rollup-plugin-dts/issues/13)\n[discussions](https://github.com/timocov/dts-bundle-generator/issues/68)\nabout some of these projects and their tradeoffs.\n\n## [How does it work](./docs/how-it-works.md)\n\n## License\n\nThe code is licensed under the copyleft **LGPL-3.0**. I have no intention to\nlicense this under any non-copyleft license.\n","_attachments":{},"homepage":"https://github.com/Swatinem/rollup-plugin-dts#readme","bugs":{"url":"https://github.com/Swatinem/rollup-plugin-dts/issues"},"license":"LGPL-3.0"}