{"name":"rollup-plugin-dts","version":"1.0.0-alpha.0","description":"An experiment to generate .d.ts rollup 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"},"homepage":"https://github.com/Swatinem/rollup-plugin-dts#readme","main":"dist/rollup-plugin-dts.js","module":"dist/rollup-plugin-dts.mjs","types":"dist/rollup-plugin-dts.d.ts","sideEffects":false,"scripts":{"clean":"rimraf dist","prebuild":"npm run clean","build":"tsc --project tsconfig.build.json && rollup -c","prepublishOnly":"npm run test && npm run build","test":"jest --runInBand"},"jest":{"preset":"ts-jest/presets/js-with-ts","collectCoverage":true,"coverageReporters":["html","json","text-summary"],"coveragePathIgnorePatterns":["tests","node_modules"],"testMatch":["**/?(*.)+(spec|test).(ts|tsx)"],"testPathIgnorePatterns":["/node_modules/","/testcases/"]},"prettier":{"printWidth":120,"trailingComma":"all"},"devDependencies":{"@types/babel__code-frame":"^7.0.1","@types/fs-extra":"^7.0.0","@types/jest":"^24.0.13","@types/node":"^12.0.4","@types/react":"^16.8.19","esm":"^3.2.25","fs-extra":"^8.0.1","jest":"^24.8.0","prettier":"^1.17.1","react":"^16.8.6","rollup":"^1.13.1","ts-jest":"^24.0.2","typescript":"3.5.1"},"peerDependencies":{"rollup":"^1.13.1","typescript":"^3.5.1"},"optionalDependencies":{"@babel/code-frame":"^7.0.0"},"readme":"# rollup-plugin-dts\n\n[![Build Status](https://img.shields.io/travis/Swatinem/rollup-plugin-dts.svg)](https://travis-ci.org/Swatinem/rollup-plugin-dts)\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 an **EXPERIMENT** to generate roll-upd `.d.ts` definition files from\nyour `.ts` files.\n\nIt is complete enough to generate\n[its own definition file](./src/__tests__/testcases/rollup-plugin-dts/expected.ts),\nand it is used successfully for [intl-codegen](https://github.com/eversport/intl-codegen) as well.\n\n## Usage\n\nInstall the package from `npm`:\n\n    $ npm install --save-dev tslib rollup rollup-plugin-dts\n\nCreate your `rollup.config.js`:\n\n```js\nimport resolve from \"rollup-plugin-node-resolve\";\n// NOTE: The plugin has two different modes:\n// * one to transpile `.ts -> .js`\n// * one to create `.ts -> .d.ts` bundles\nimport { ts, dts } from \"rollup-plugin-dts\";\n\nconst config = [\n  {\n    input: \"./src/index.ts\",\n    // NOTE: The first output is your transpiled typescript\n    output: [{ file: \"dist/my-library.js\", format: \"cjs\" }, { file: \"dist/my-library.mjs\", format: \"es\" }],\n\n    plugins: [\n      resolve({\n        jsnext: true,\n        extensions: [\".ts\"],\n      }),\n      ts(),\n    ],\n  },\n  {\n    input: \"./src/index.ts\",\n    // NOTE: The second output is your bundled `.d.ts` file\n    output: [{ file: \"dist/my-library.d.ts\", format: \"es\" }],\n\n    plugins: [dts()],\n  },\n];\n\nexport default config;\n```\n\nAnd then instruct node or other bundles where to find your code\n\n```json\n  \"main\": \"dist/my-library.js\",\n  \"module\": \"dist/my-library.mjs\",\n  \"types\": \"dist/my-library.d.ts\",\n```\n\n## Limitations / Known Bugs\n\nExporting namespaces currently does not work and will create invalid `.d.ts` files.\n\n```ts\nimport * as ns from \"./namespace\";\n\nexport { ns };\n```\n\nUsing `import * as` itself is not a problem and works fine on its own. It is the\n_re-export_ that breaks.\n\n---\n\nUsing inline imports either as namespace or with `external` modules.\n\n```ts\ninterface Foo {\n  namespace: import(\"./namespace\");\n  external: import(\"external\").Foo;\n}\n```\n\nUsing specific items from a local inline import, such as\n`import(\"./local\").Item`, works fine however.\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\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 all three of these projects and their tradeoffs.\n\nSurprisingly, all three projects struggle with similar edge-cases around\nnamespaces and inline imports, as documented [above](#limitations--known-bugs).\n\n## [How does it work](./docs/how-it-works.md)\n","readmeFilename":"README.md","gitHead":"7fc8d749f3b8641055037412eb64a68d9ca506af","dependencies":{"@babel/code-frame":"^7.0.0"},"_id":"rollup-plugin-dts@1.0.0-alpha.0","_nodeVersion":"11.15.0","_npmVersion":"6.9.0","_npmUser":{"name":"swatinem","email":"arpad.borsos@googlemail.com"},"dist":{"integrity":"sha512-q5m+gkYJ9waZjYxs5173iQ459633vWmQ5gnR2kxlpjYScm4nLHeK6hWrAAZh+czns38SJCw6Zgu5mouMSbBQ+A==","shasum":"0474ed7d4d821bfbc0f084eb99266b255b5bc0a6","tarball":"http://registry-npm.ywwl.com/rollup-plugin-dts/download/rollup-plugin-dts-1.0.0-alpha.0.tgz","fileCount":5,"unpackedSize":74540,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc9RIYCRA9TVsSAnZWagAAuTkP/34WtVYiAhAe4Y/MxQrD\ni1VG36LJU1v1fDtRqc4/M1zx2uKwuJHT0MbZRWlYNUKwl+6wtteJjMxVXlht\nSscFrpD6yEUr/vpiWPXNdWONY0POLGk198rXzgQy1BnZEmT3NRGWE0g1d0UI\noVZFdbcJvYADnud66+vG2oQ0ObncGXwojtigl25fPuOW0d3P6QdgCvkgeyCQ\nhotEBmb5ChZzNmnp31XW1UTeeoCeCKnOn+axJUdYL7IhzyvHx4+zZr68MJbL\nszsOBDQ9WcVbCz8VvCozYgKe0HqvA1XBjcG+5e5yggygvP8Nv1Jh/p66xLZr\nbmqdaEO1nGTAxtNESuj92kjDU4sabSbRnM7c0kKsGe/+5Gze7kW7JuSEF8tV\nx87yzj1r1MF2YZREKgTlzcTKpDnfY15RaoBIGaVKs2BTfmjYVTClJIfWQ5xe\n5iMvunz8XHJRZhZidxU3S6T5Xt0+iSuOykRA5wlLDzsh2An2Em7djA5mLSfJ\nJJIW/fK2YHfzoGN4H+qF1kteuPEw+Dk5CA9UnurC3w9E3LmvyH1rBzoQ7iV5\n9wkz15phCEa4QAXS+PAdfkOenyW98EctgoN/VjzcVYyAdcaQm22QAXrRp9hA\n8o7jc/gfBp9QLQREeRhWbng6wiKyRy20PQJvKpY4hpKuaOYGunGwsicm9N+4\nymrf\r\n=KtFp\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCkzSIvcHHmoJSRJaE10TfhQacX8XXuYwUKFhphZzwQTwIhAIxs1FWYx5lqmeXoFJgjU64o677hoQijrbbn2Smm3rFa"}],"size":15747,"noattachment":false,"key":"/rollup-plugin-dts/-/rollup-plugin-dts-1.0.0-alpha.0.tgz"},"maintainers":[{"name":"swatinem","email":"arpad.borsos@googlemail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rollup-plugin-dts_1.0.0-alpha.0_1559564824022_0.9658216089098701"},"_hasShrinkwrap":false,"publish_time":1559564824292,"_cnpm_publish_time":1559564824292,"dist-tags":{"latest":"6.5.1","next":"1.0.0-alpha.0"}}