{"id":13452443,"url":"https://github.com/Swatinem/rollup-plugin-dts","last_synced_at":"2025-03-23T19:34:24.717Z","repository":{"id":39648997,"uuid":"157591991","full_name":"Swatinem/rollup-plugin-dts","owner":"Swatinem","description":"A rollup plugin to generate .d.ts rollup files for your typescript project","archived":false,"fork":false,"pushed_at":"2024-04-08T04:39:44.000Z","size":1664,"stargazers_count":775,"open_issues_count":6,"forks_count":61,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-14T15:51:20.462Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Swatinem.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":["Swatinem"]}},"created_at":"2018-11-14T18:21:58.000Z","updated_at":"2024-04-22T03:40:59.727Z","dependencies_parsed_at":"2023-02-12T19:16:02.734Z","dependency_job_id":"419e8551-cdb6-4c0e-97f7-29070a63fa4d","html_url":"https://github.com/Swatinem/rollup-plugin-dts","commit_stats":{"total_commits":491,"total_committers":43,"mean_commits":"11.418604651162791","dds":0.5234215885947047,"last_synced_commit":"f74e5a972cc613960aead51c4ff3415a7b3dce83"},"previous_names":[],"tags_count":73,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swatinem%2Frollup-plugin-dts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swatinem%2Frollup-plugin-dts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swatinem%2Frollup-plugin-dts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swatinem%2Frollup-plugin-dts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Swatinem","download_url":"https://codeload.github.com/Swatinem/rollup-plugin-dts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245159438,"owners_count":20570387,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T07:01:24.293Z","updated_at":"2025-03-23T19:34:23.925Z","avatar_url":"https://github.com/Swatinem.png","language":"TypeScript","funding_links":["https://github.com/sponsors/Swatinem"],"categories":["TypeScript","Plugins"],"sub_categories":["Transpilation"],"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\n**NOTE** A [default import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#default_import) of the plugin using `import dts from \"rollup-plugin-dts\";` is still supported for existing implementations of this package. However, a [named import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#named_import) is suggested to avoid the error `[!] TypeError: dts is not a function`[^1][^2] in certain rollup config file implementations.\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## Maintenance Mode\n\nThis project is in _maintenance mode_. That means there will be no more active feature development.\nThere will still be occasional releases to maintain compatibility with future TypeScript releases.\nPull Requests are always welcome, however reaction time on both Issues and PRs can be slow.\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\n[^1]: [StackOverflow thread](https://stackoverflow.com/questions/74255565/rollup-typescript-error-dts-is-not-a-function/74304876#74304876) of issue\n[^2]: [Github issue](https://github.com/Swatinem/rollup-plugin-dts/issues/247)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSwatinem%2Frollup-plugin-dts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSwatinem%2Frollup-plugin-dts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSwatinem%2Frollup-plugin-dts/lists"}