6.1.1 • Published 26 days ago

rollup-plugin-dts v6.1.1

Weekly downloads
23,309
License
LGPL-3.0-only
Repository
github
Last release
26 days ago

rollup-plugin-dts

Build Status Coverage Status

This is a plugin that lets you roll-up your .d.ts definition files.

Usage

Install the package from npm:

$ npm install --save-dev rollup-plugin-dts

Add it to your rollup.config.js:

import { dts } from "rollup-plugin-dts";

const config = [
  // …
  {
    input: "./my-input/index.d.ts",
    output: [{ file: "dist/my-library.d.ts", format: "es" }],
    plugins: [dts()],
  },
];

export default config;

NOTE A 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 is suggested to avoid the error [!] TypeError: dts is not a function^1 in certain rollup config file implementations.

And then instruct typescript where to find your definitions inside your package.json:

  "types": "dist/my-library.d.ts",

NOTE that the plugin will automatically mark any external library (@types for example) as external, so those will be excluded from bundling.

Maintenance Mode

This project is in maintenance mode. That means there will be no more active feature development. There will still be occasional releases to maintain compatibility with future TypeScript releases. Pull Requests are always welcome, however reaction time on both Issues and PRs can be slow.

What to expect

While this plugin is fairly complete, it does not support all imaginable use-cases. In particular, the plugin works best with already existing .d.ts files generated by the typescript compiler from idiomatic code.

Working with .ts(x) or even .js(x) (when setting allowJs: true) does work, but is not recommended.

The plugin does its own import resolution through the typescript compiler, and usage together with other resolution plugins, such as node-resolve can lead to errors and is not recommended.

All external dependencies from node_modules are automatically excluded from bundling. This can be overridden using the respectExternal setting, but it is generally not recommended. While rollup of external @types generally works, it is not recommended.

Why?

Well, ideally TypeScript should just do all this itself, and it even has a proposal to do that. But there hasn’t been any progress in ~3 years.

Some projects, like rollup itself go the route of completely separating their public interfaces in a separate file.

Alternatives

See some discussions about some of these projects and their tradeoffs.

How does it work

License

The code is licensed under the copyleft LGPL-3.0. I have no intention to license this under any non-copyleft license.

^1: StackOverflow thread of issue ^2: Github issue

formbuilderpkgcatena-x-shared-components@visibly/vui@diagoriente/email-domain-levenshteinchomar-device-fingerprinting@backstage/cli@sankalpafernando/decorated-class-validator@peter.ingram/section-syesroad-npm-storybooktest-brandi-ysw@dmoulart/togeojson@adlib/libpcari-design@lib-cli/lib-compileffh-react-componentscfsvg@tarpit/abrahammini-vue-my-wu@ufjt-poc/bundlerca-button-tstyger-uilucson-test@medusa-frontends/cli@listee/uikitapp-rollup-cli@paescuj/unbuild@optic-builder/bundler-clisuperfast-coremui-react-chatjdpf-system-designdversiontestfindanherb-axios-module@everything-registry/sub-chunk-2680react-ada-componentsnative-flow-ui-v2mainssssmart-blog-generatorpeek-luckysheetartui-react-tailwindgordy-uigourmet-uigogoout_mars_loggl-react-component-librarykum-somi-react-ui-librarylaf-labs-clientkartheekkartheek_component_librarykartheekponde_comp_libkimeg-design-testlongto-blocklylocal-image-testkdpa-components2k-utils-zkomal_customcomponentkomekkokiban-design-systemkiss-codekz-messagelerna-button-compkyberutilslatest-final-buttonlatest-final-selectlavinbuttonlionconfiglyric-resolverlg-web-componentslib_build_prlhcomtemtslkl-builderlunar-react-libraryluao-rolluphairylibhar2languageshicperspiciatishetzner-cdkhrnet-modal-pluginhooks-thong-phanijk-trackerhy_rz_toolidesign-header-sidebarivanhristovcomponent1jordyfrijtersreactlibraryjiekinput-lerna-componenticosa-viewermaomi-clmars-rollup-testmedika-ui-componentsmini-fe-componentmobx-restmmq-uimodule2apipostfullmodule2apipostfulldatammsan-element-tiptapmodrinthjsmf-dts-generatormikauimengyang-utilsneki-react-componentsmychoice-sdk-test
6.1.1

26 days ago

6.1.0

8 months ago

5.3.1

11 months ago

6.0.1

10 months ago

6.0.0

10 months ago

6.0.2

9 months ago

5.3.0

1 year ago

5.2.0

1 year ago

5.1.1

1 year ago

5.1.0

1 year ago

4.2.3

2 years ago

5.0.0

2 years ago

4.2.2

2 years ago

4.2.1

2 years ago

4.2.0

2 years ago

4.1.0

2 years ago

4.0.1

3 years ago

4.0.0

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.4.14

4 years ago

1.4.13

4 years ago

1.4.12

4 years ago

1.4.11

4 years ago

1.4.10

4 years ago

1.4.9

4 years ago

1.4.8

4 years ago

1.4.7

4 years ago

1.4.6

4 years ago

1.4.5

4 years ago

1.4.4

4 years ago

1.4.3

4 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.0

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.13

5 years ago

1.1.12

5 years ago

1.1.11

5 years ago

1.1.10

5 years ago

1.1.9

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago

1.0.0-alpha.0

5 years ago

0.15.1

5 years ago

0.15.0

5 years ago

0.14.0

5 years ago

0.13.0

5 years ago

0.12.0

5 years ago

0.11.0

5 years ago

0.10.0

5 years ago

0.9.0

5 years ago

0.8.0

5 years ago

0.7.0

5 years ago

0.6.0

6 years ago

0.5.0

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago