{"name":"rollup-plugin-typescript2","version":"0.37.0","description":"Seamless integration between Rollup and TypeScript. Now with errors.","main":"dist/rollup-plugin-typescript2.cjs.js","module":"dist/rollup-plugin-typescript2.es.js","jsnext:main":"dist/rollup-plugin-typescript2.es.js","types":"dist/index.d.ts","keywords":["rollup-plugin-typescript2","rollup-plugin-typescript","rollup-plugin","typescript","es2015","rollup","npm"],"license":"MIT","homepage":"https://github.com/ezolenko/rollup-plugin-typescript2","author":{"name":"@ezolenko"},"scripts":{"prebuild":"rimraf dist/*","build":"rimraf dist/* && rollup -c","watch":"rollup -c rollup.config.self.js -w ","build-self":"rimraf dist/* && rollup -c rollup.config.self.js","lint":"eslint .","test":"jest","test:watch":"jest --watch","test:coverage":"jest --coverage"},"dependencies":{"@rollup/pluginutils":"^4.1.2","find-cache-dir":"^3.3.2","fs-extra":"^10.0.0","semver":"^7.5.4","tslib":"^2.6.2"},"peerDependencies":{"rollup":">=1.26.3","typescript":">=2.4.0"},"devDependencies":{"@jest/globals":"^28.0.3","@rollup/plugin-commonjs":"^22.0.0","@rollup/plugin-node-resolve":"13.2.1","@types/find-cache-dir":"^2.0.0","@types/fs-extra":"8.0.1","@types/graphlib":"2.1.7","@types/jest":"^27.5.0","@types/lodash":"4.14.161","@types/node":"8.0.47","@types/object-hash":"1.3.3","@types/semver":"7.3.12","@typescript-eslint/eslint-plugin":"^6.7.3","@typescript-eslint/parser":"^6.7.3","colors":"1.4.0","eslint":"^8.50.0","graphlib":"2.1.8","jest":"^29.7.0","lodash":"4.17.21","object-hash":"3.0.0","rimraf":"3.0.2","rollup":"^2.70.2","rollup-plugin-re":"1.0.7","rollup-plugin-typescript2":"0.35.0","ts-jest":"^29.1.1","typescript":"^5.1.3"},"repository":{"type":"git","url":"git+https://github.com/ezolenko/rollup-plugin-typescript2.git"},"bugs":{"url":"https://github.com/ezolenko/rollup-plugin-typescript2/issues"},"_id":"rollup-plugin-typescript2@0.37.0","gitHead":"8a9350a2d595e8466e06850f5b5058fafa9b9abc","_nodeVersion":"21.5.0","_npmVersion":"10.2.4","dist":{"integrity":"sha512-S1r/4Ufi13Yg/chPlh4iSHWq2Zs/sIAodW5SKUoCQfy/DEQhkS2XRFEtv+NRq3iBO4WHHfqKtDPOC5lJTYm7OQ==","shasum":"7e244d7d0e321673a43bc723b6d0c81789627c4e","tarball":"http://registry-npm.ywwl.com/rollup-plugin-typescript2/download/rollup-plugin-typescript2-0.37.0.tgz","fileCount":33,"unpackedSize":4534830,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIAiVHizzV/fJy95M01If4q+gsOgCK9PJn2WR/UEopm8qAiA8yshCfsItI1W/sHI1ZsHnrXcigOpFSUuVWBpkMhBgqQ=="}],"size":799618,"noattachment":false,"key":"/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.37.0.tgz"},"_npmUser":{"name":"ezolenko","email":"zolenkoe@gmail.com"},"directories":{},"maintainers":[{"name":"ezolenko","email":"zolenkoe@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/rollup-plugin-typescript2_0.37.0_1774762452582_0.351821431918125"},"_hasShrinkwrap":false,"readme":"# rollup-plugin-typescript2\n\n[![npm-version](https://img.shields.io/npm/v/rollup-plugin-typescript2.svg?maxAge=259200)](https://npmjs.org/package/rollup-plugin-typescript2)\n[![npm-monthly-downloads](https://img.shields.io/npm/dm/rollup-plugin-typescript2.svg?maxAge=259200)](https://npmjs.org/package/rollup-plugin-typescript2)\n[![Node.js CI](https://github.com/ezolenko/rollup-plugin-typescript2/workflows/Node.js%20CI/badge.svg)](https://github.com/ezolenko/rollup-plugin-typescript2/actions?query=workflow%3A\"Node.js+CI\")\n\nRollup plugin for typescript with compiler errors.\n\nThis is a rewrite of the [original](https://github.com/rollup/rollup-plugin-typescript/tree/v0.8.1) `rollup-plugin-typescript`, starting and borrowing from [this fork](https://github.com/alexlur/rollup-plugin-typescript).\n\nThis version is somewhat slower than the original, but it will print out TypeScript syntactic and semantic diagnostic messages (the main reason for using TypeScript after all).\n\n## Installation\n\n```bash\n# with npm\nnpm install rollup-plugin-typescript2 typescript tslib --save-dev\n# with yarn\nyarn add rollup-plugin-typescript2 typescript tslib --dev\n```\n\n## Usage\n\n```js\n// rollup.config.js\nimport typescript from 'rollup-plugin-typescript2';\n\nexport default {\n\tinput: './main.ts',\n\n\tplugins: [\n\t\ttypescript(/*{ plugin options }*/)\n\t]\n}\n```\n\nThis plugin inherits all compiler options and file lists from your `tsconfig.json` file.\nIf your `tsconfig` has another name or another relative path from the root directory, see `tsconfigDefaults`, `tsconfig`, and `tsconfigOverride` options below.\nThis also allows for passing in different `tsconfig` files depending on your build target.\n\n### Some compiler options are forced\n\n* `noEmitHelpers`: false\n* `importHelpers`: true\n* `noResolve`: false\n* `noEmit`: false (Rollup controls emit)\n* `noEmitOnError`: false (Rollup controls emit. See [#254](https://github.com/ezolenko/rollup-plugin-typescript2/issues/254) and the `abortOnError` plugin option below)\n* `inlineSourceMap`: false (see [#71](https://github.com/ezolenko/rollup-plugin-typescript2/issues/71))\n* `outDir`: `./placeholder` in cache root (see [#83](https://github.com/ezolenko/rollup-plugin-typescript2/issues/83) and [Microsoft/TypeScript#24715](https://github.com/Microsoft/TypeScript/issues/24715))\n* `declarationDir`: Rollup's `output.file` or `output.dir` (*unless `useTsconfigDeclarationDir` is true in the plugin options*)\n* `allowNonTsExtensions`: true to let other plugins on the chain generate typescript; update plugin's `include` filter to pick them up (see [#111](https://github.com/ezolenko/rollup-plugin-typescript2/issues/111))\n\n### Some compiler options have more than one compatible value\n\n* `module`: defaults to `ES2015`. Other valid values are `ES2020`, `ES2022` and `ESNext` (required for dynamic imports, see [#54](https://github.com/ezolenko/rollup-plugin-typescript2/issues/54)).\n\n* `moduleResolution`: defaults to `node10` (same as `node`), but value from tsconfig is used if specified. Other valid (but mostly untested) values are `node16`, `nodenext` and `bundler`. If in doubt, use `node10`.\n\t* `classic` is [deprecated](https://www.typescriptlang.org/docs/handbook/module-resolution.html) and changed to `node10`. It also breaks this plugin, see [#12](https://github.com/ezolenko/rollup-plugin-typescript2/issues/12) and [#14](https://github.com/ezolenko/rollup-plugin-typescript2/issues/14).\n\n### Some options need additional configuration on plugin side\n\n* `allowJs`: lets TypeScript process JS files as well. If you use it, modify this plugin's `include` option to add `\"*.js+(|x)\", \"**/*.js+(|x)\"` (might also want to `exclude` `\"**/node_modules/**/*\"`, as it can slow down the build significantly).\n\n### Compatibility\n\n#### @rollup/plugin-node-resolve\n\nMust be before `rollup-plugin-typescript2` in the plugin list, especially when the `browser: true` option is used (see [#66](https://github.com/ezolenko/rollup-plugin-typescript2/issues/66)).\n\n#### @rollup/plugin-commonjs\n\nSee the explanation for `rollupCommonJSResolveHack` option below.\n\n#### @rollup/plugin-babel\n\nThis plugin transpiles code, but doesn't change file extensions. `@rollup/plugin-babel` only looks at code with these extensions [by default](https://github.com/rollup/plugins/tree/master/packages/babel#extensions): `.js,.jsx,.es6,.es,.mjs`. To workaround this, add `.ts` and `.tsx` to its list of extensions.\n\n```js\n// ...\nimport { DEFAULT_EXTENSIONS } from '@babel/core';\n// ...\n\tbabel({\n\t\textensions: [\n\t\t\t...DEFAULT_EXTENSIONS,\n\t\t\t'.ts',\n\t\t\t'.tsx'\n\t\t]\n\t}),\n// ...\n```\n\nSee [#108](https://github.com/ezolenko/rollup-plugin-typescript2/issues/108)\n\n### Plugin options\n\n* `cwd`: `string`\n\n\tThe current working directory. Defaults to `process.cwd()`.\n\n* `tsconfigDefaults`: `{}`\n\n\tThe object passed as `tsconfigDefaults` will be merged with the loaded `tsconfig.json`.\n\tThe final config passed to TypeScript will be the result of values in `tsconfigDefaults` replaced by values in the loaded `tsconfig.json`, replaced by values in `tsconfigOverride`, and then replaced by forced `compilerOptions` overrides on top of that (see above).\n\n\tFor simplicity and other tools' sake, try to minimize the usage of defaults and overrides and keep everything in a `tsconfig.json` file (`tsconfig`s can themselves be chained with [`extends`](https://www.typescriptlang.org/tsconfig#extends), so save some turtles).\n\n\t```js\n\tlet defaults = { compilerOptions: { declaration: true } };\n\tlet override = { compilerOptions: { declaration: false } };\n\n\t// ...\n\tplugins: [\n\t\ttypescript({\n\t\t\ttsconfigDefaults: defaults,\n\t\t\ttsconfig: \"tsconfig.json\",\n\t\t\ttsconfigOverride: override\n\t\t})\n\t]\n\t```\n\n\tThis is a [deep merge](https://lodash.com/docs/4.17.4#merge): objects are merged, arrays are merged by index, primitives are replaced, etc.\n\tIncrease `verbosity` to `3` and look for `parsed tsconfig` if you get something unexpected.\n\n* `tsconfig`: `undefined`\n\n\tPath to `tsconfig.json`.\n\tSet this if your `tsconfig` has another name or relative location from the project directory.\n\n\tBy default, will try to load `./tsconfig.json`, but will not fail if the file is missing, unless the value is explicitly set.\n\n* `tsconfigOverride`: `{}`\n\n\tSee `tsconfigDefaults`.\n\n* `check`: true\n\n\tSet to false to avoid doing any diagnostic checks on the code.\n\tSetting to false is sometimes referred to as `transpileOnly` by other TypeScript integrations.\n\n* `verbosity`: 1\n\n\t- 0 -- Error\n\t- 1 -- Warning\n\t- 2 -- Info\n\t- 3 -- Debug\n\n* `clean`: false\n\n\tSet to true to disable the cache and do a clean build.\n\tThis also wipes any existing cache.\n\n* `cacheRoot`: `node_modules/.cache/rollup-plugin-typescript2`\n\n\tPath to cache.\n\tDefaults to a folder in `node_modules`.\n\n* `include`: `[ \"*.ts{,x}\", \"**/*.ts{,x}\", \"**/*.cts\", \"**/*.mts\" ]`\n\n\tBy default compiles all `.ts` and `.tsx` files with TypeScript.\n\n* `exclude`: `[ \"*.d.ts\", \"**/*.d.ts\", \"**/*.d.cts\", \"**/*.d.mts\" ]`\n\n\tBut excludes type definitions.\n\n* `abortOnError`: true\n\n\tBail out on first syntactic or semantic error.\n\tIn some cases, setting this to false will result in an exception in Rollup itself (for example, unresolvable imports).\n\n* `rollupCommonJSResolveHack`: false\n\n\t_Deprecated_. OS native paths are now _always_ used since [`0.30.0`](https://github.com/ezolenko/rollup-plugin-typescript2/releases/0.30.0) (see [#251](https://github.com/ezolenko/rollup-plugin-typescript2/pull/251)), so this no longer has any effect -- as if it is always `true`.\n\n* `objectHashIgnoreUnknownHack`: false\n\n\tThe plugin uses your Rollup config as part of its cache key.\n\t`object-hash` is used to generate a hash, but it can have trouble with some uncommon types of elements.\n\tSetting this option to true will make `object-hash` ignore unknowns, at the cost of not invalidating the cache if ignored elements are changed.\n\n\tOnly enable this option if you need it (e.g. if you get `Error: Unknown object type \"xxx\"`) and make sure to run with `clean: true` once in a while and definitely before a release.\n\t(See [#105](https://github.com/ezolenko/rollup-plugin-typescript2/issues/105) and [#203](https://github.com/ezolenko/rollup-plugin-typescript2/pull/203))\n\n* `useTsconfigDeclarationDir`: false\n\n\tIf true, declaration files will be emitted in the [`declarationDir`](https://www.typescriptlang.org/tsconfig#declarationDir) given in the `tsconfig`.\n\tIf false, declaration files will be placed inside the destination directory given in the Rollup configuration.\n\n\tSet to false if any other Rollup plugins need access to declaration files.\n\n* `typescript`: peerDependency\n\n\tIf you'd like to use a different version of TS than the peerDependency, you can import a different TypeScript module and pass it in as `typescript: require(\"path/to/other/typescript\")`.\n\n\tYou can also use an alternative TypeScript implementation, such as [`ttypescript`](https://github.com/cevek/ttypescript), with this option.\n\n\tMust be TS 2.0+; things might break if the compiler interfaces changed enough from what the plugin was built against.\n\n* `transformers`: `undefined`\n\n\t**experimental**, TypeScript 2.4.1+\n\n\tTransformers will likely be available in `tsconfig` eventually, so this is not a stable interface (see [Microsoft/TypeScript#14419](https://github.com/Microsoft/TypeScript/issues/14419)).\n\n\tFor example, integrating [kimamula/ts-transformer-keys](https://github.com/kimamula/ts-transformer-keys):\n\n\t```js\n\tconst keysTransformer = require('ts-transformer-keys/transformer').default;\n\tconst transformer = (service) => ({\n  \t\tbefore: [ keysTransformer(service.getProgram()) ],\n  \t\tafter: []\n\t});\n\n\t// ...\n\tplugins: [\n\t\ttypescript({ transformers: [transformer] })\n\t]\n\t```\n\n### Declarations\n\nThis plugin respects [`declaration: true`](https://www.typescriptlang.org/tsconfig#declaration) in your `tsconfig.json` file.\nWhen set, it will emit `*.d.ts` files for your bundle.\nThe resulting file(s) can then be used with the `types` property in your `package.json` file as described [here](https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html).<br />\nBy default, the declaration files will be located in the same directory as the generated Rollup bundle.\nIf you want to override this behavior and instead use [`declarationDir`](https://www.typescriptlang.org/tsconfig#declarationDir), set `useTsconfigDeclarationDir: true` in the plugin options.\n\nThe above also applies to [`declarationMap: true`](https://www.typescriptlang.org/tsconfig#declarationMap) and `*.d.ts.map` files for your bundle.\n\nThis plugin also respects [`emitDeclarationOnly: true`](https://www.typescriptlang.org/tsconfig#emitDeclarationOnly) and will only emit declarations (and declaration maps, if enabled) if set in your `tsconfig.json`.\nIf you use `emitDeclarationOnly`, you will need another plugin to compile any TypeScript sources, such as `@rollup/plugin-babel`, `rollup-plugin-esbuild`, `rollup-plugin-swc`, etc.\nWhen composing Rollup plugins this way, `rollup-plugin-typescript2` will perform type-checking and declaration generation, while another plugin performs the TypeScript to JavaScript compilation.<br />\nSome scenarios where this can be particularly useful: you want to use Babel plugins on TypeScript source, or you want declarations and type-checking for your Vite builds (**NOTE**: this space has not been fully explored yet).\n\n### Watch mode\n\nThe way TypeScript handles type-only imports and ambient types effectively hides them from Rollup's watch mode, because import statements are not generated and changing them doesn't trigger a rebuild.\n\nOtherwise the plugin should work in watch mode. Make sure to run a normal build after watch session to catch any type errors.\n\n### Requirements\n\n* TypeScript `2.4+`\n* Rollup `1.26.3+`\n* Node `6.4.0+` (basic ES6 support)\n\n### Reporting bugs and Contributing\n\nSee [CONTRIBUTING.md](./CONTRIBUTING.md)\n","publish_time":1774762452840,"_cnpm_publish_time":1774762452840,"dist-tags":{"latest":"0.37.0"}}