{"name":"fork-ts-checker-webpack-plugin","version":"9.1.1","keywords":["webpack","plugin","typescript","typecheck","ts-loader","webpack","fork","fast"],"author":{"name":"Piotr Oleś","email":"piotrek.oles@gmail.com"},"license":"MIT","_id":"fork-ts-checker-webpack-plugin@9.1.1","maintainers":[{"name":"piotr-oles","email":"piotrek.oles@gmail.com"}],"contributors":[{"url":"https://github.com/piotr-oles","name":"Piotr Oleś","email":"piotrek.oles@gmail.com"},{"url":"https://johnnyreilly.com","name":"John Reilly","email":"johnny_reilly@hotmail.com"}],"homepage":"https://github.com/TypeStrong/fork-ts-checker-webpack-plugin#readme","bugs":{"url":"https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues"},"dist":{"shasum":"0e3a342ba799bdecd6f272bdc781c7358a76bbb5","tarball":"http://registry-npm.ywwl.com/fork-ts-checker-webpack-plugin/download/fork-ts-checker-webpack-plugin-9.1.1.tgz","fileCount":168,"integrity":"sha512-n/8xNu7kj77qBSN1RvIj2Vu0TtYQYs1urDZq5mrUWQ5qS+F/Y4/NM7ewduyvxX6DzCJlQK8UJAEtrimQoV/9Jw==","signatures":[{"sig":"MEUCIQCQ2OP/cdf8iuU6mvzV6F8VB6kWn9mEwtLYN3EENRLSTgIgLKDIeVbVnmaeqJWw/67KetJwV1fDJ0+FREWyJpZvvng=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQDHQRiUWNpUf9oLJF2jX3g2Y8cT8/pTNMAdD/czMLWGuAIgYQlmN+LlUgYhyHvOhbpfjNApmg3e5QvCQ2LOHaqmhwc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/fork-ts-checker-webpack-plugin@9.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":211569,"size":44740,"noattachment":false,"key":"/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-9.1.1.tgz"},"main":"lib/index.js","types":"lib/index.d.ts","config":{"commitizen":{"path":"cz-conventional-changelog"}},"engines":{"node":">=14.21.3"},"gitHead":"d0dc6dd857f4fcc9348d8eeccdbd5afd2be449eb","scripts":{"lint":"cross-env eslint ./src ./test --ext .ts","test":"npm run build && npm run test:unit && npm run test:e2e","build":"cross-env rimraf lib && cross-env tsc --version && cross-env tsc","commit":"cross-env git-cz","prepare":"husky install","test:e2e":"npm pack && cross-env jest --config=test/e2e/jest.config.js --ci -i -b","test:unit":"cross-env jest --config=test/unit/jest.config.js","semantic-release":"semantic-release"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"ab33c4a7-3c99-4c7a-b52d-1c1ae2c6a0c1"}},"commitlint":{"extends":["@commitlint/config-conventional"]},"repository":{"url":"git+https://github.com/TypeStrong/fork-ts-checker-webpack-plugin.git","type":"git"},"_npmVersion":"11.21.2","description":"Runs typescript type checker and linter on separate process.","directories":{},"lint-staged":{"*.ts":"eslint --fix"},"_nodeVersion":"26.13.1","dependencies":{"chalk":"^4.1.2","memfs":"^3.4.1","semver":"^7.3.5","tapable":"^2.2.1","chokidar":"^4.0.1","fs-extra":"^10.0.0","deepmerge":"^4.2.2","minimatch":"^3.0.4","cosmiconfig":"^8.2.0","schema-utils":"^3.1.1","@babel/code-frame":"^7.16.7","node-abort-controller":"^3.0.1"},"_hasShrinkwrap":false,"packageManager":"npm@11.21.2","devDependencies":{"jest":"^27.4.7","husky":"^7.0.4","eslint":"^8.8.0","git-cz":"^4.8.0","karton":"^0.4.1","rimraf":"^3.0.2","ts-jest":"^27.1.3","webpack":"^5.67.0","prettier":"^2.5.1","cross-env":"^7.0.3","commitlint":"^16.1.0","strip-ansi":"^6.0.0","typescript":"^4.5.5","@types/jest":"^27.4.0","@types/node":"^16.4.13","jest-circus":"^27.4.6","json-schema":"^0.4.0","lint-staged":"^11.1.2","@types/rimraf":"^3.0.2","@types/semver":"^7.3.9","@types/fs-extra":"^9.0.13","@types/minimatch":"^3.0.5","semantic-release":"^25.0.9","@yarnpkg/cli-dist":"4.7.0","@types/cross-spawn":"^6.0.2","@types/json-schema":"^7.0.9","eslint-plugin-node":"^11.1.0","eslint-plugin-import":"^2.25.4","@semantic-release/npm":"^13.2.0","jest-environment-node":"^27.4.6","@semantic-release/exec":"^7.1.0","eslint-plugin-prettier":"^4.0.0","@semantic-release/github":"^12.0.11","@types/babel__code-frame":"^7.0.3","@typescript-eslint/parser":"^5.10.1","@commitlint/config-conventional":"^16.0.0","@typescript-eslint/eslint-plugin":"^5.10.1","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/release-notes-generator":"^14.1.1"},"peerDependencies":{"webpack":"^5.11.0","typescript":">3.6.0"},"_npmOperationalInternal":{"tmp":"tmp/fork-ts-checker-webpack-plugin_9.1.1_1794818816231_0.8569170073018232","host":"s3://npm-registry-packages-npm-production"},"readme":"[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)\n\n<div align=\"center\">\n\n<img alt=\"\" width=\"300\" src=\"./media/logo.svg\" />\n<h1>Fork TS Checker Webpack Plugin</h1>\n<p>Webpack plugin that runs TypeScript type checker on a separate process.</p>\n\n[![npm version](https://img.shields.io/npm/v/fork-ts-checker-webpack-plugin.svg)](https://www.npmjs.com/package/fork-ts-checker-webpack-plugin)\n[![build status](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/workflows/CI/CD/badge.svg?branch=main&event=push)](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/actions?query=branch%3Amain+event%3Apush)\n[![downloads](http://img.shields.io/npm/dm/fork-ts-checker-webpack-plugin.svg)](https://npmjs.org/package/fork-ts-checker-webpack-plugin)\n[![commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n\n</div>\n\n## Features\n\n * Speeds up [TypeScript](https://github.com/Microsoft/TypeScript) type checking (by moving it to a separate process) 🏎\n * Supports modern TypeScript features like [project references](https://www.typescriptlang.org/docs/handbook/project-references.html) and [incremental mode](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#faster-subsequent-builds-with-the---incremental-flag) ✨\n * Displays nice error messages with the [code frame](https://babeljs.io/docs/en/next/babel-code-frame.html) formatter 🌈\n\n## Installation\n\nThis plugin requires **Node.js >=14.0.0+**, **Webpack ^5.11.0**, **TypeScript ^3.6.0**\n\n* If you depend on **TypeScript 2.1 - 2.6.2**, please use [version 4](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/tree/v4.1.4) of the plugin.\n* If you depend on **Webpack 4**, **TypeScript 2.7 - 3.5.3** or **ESLint** feature, please use [version 6](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/tree/v6.2.6) of the plugin.\n* If you depend on **Node.js 12**, please use [version 8](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/tree/v8.0.0) of the plugin.\n* If you need Vue.js support, please use [version 6](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/tree/v6.5.2) of ths plugin\n\n```sh\n# with npm\nnpm install --save-dev fork-ts-checker-webpack-plugin\n\n# with yarn\nyarn add --dev fork-ts-checker-webpack-plugin\n\n# with pnpm\npnpm add -D fork-ts-checker-webpack-plugin\n```\n\nThe minimal webpack config (with [ts-loader](https://github.com/TypeStrong/ts-loader))\n\n```js\n// webpack.config.js\nconst ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');\n\nmodule.exports = {\n  context: __dirname, // to automatically find tsconfig.json\n  entry: './src/index.ts',\n  resolve: {\n    extensions: [\".ts\", \".tsx\", \".js\"],\n  },\n  module: {\n    rules: [\n      {\n        test: /\\.tsx?$/,\n        loader: 'ts-loader',\n        // add transpileOnly option if you use ts-loader < 9.3.0 \n        // options: {\n        //   transpileOnly: true\n        // }\n      }\n    ]\n  },\n  plugins: [new ForkTsCheckerWebpackPlugin()],\n  watchOptions: {\n    // for some systems, watching many files can result in a lot of CPU or memory usage\n    // https://webpack.js.org/configuration/watch/#watchoptionsignored\n    // don't use this pattern, if you have a monorepo with linked packages\n    ignored: /node_modules/,\n  },\n};\n```\n\n> Examples how to configure it with [babel-loader](https://github.com/babel/babel-loader), [ts-loader](https://github.com/TypeStrong/ts-loader)\n> and [Visual Studio Code](https://code.visualstudio.com/) are in the [**examples**](./examples) directory.\n\n## Modules resolution\n\nIt's very important to be aware that **this plugin uses [TypeScript](https://github.com/Microsoft/TypeScript)'s, not\n[webpack](https://github.com/webpack/webpack)'s modules resolution**. It means that you have to setup `tsconfig.json` correctly.\n\n> It's because of the performance - with TypeScript's module resolution we don't have to wait for webpack to compile files.\n>\n> To debug TypeScript's modules resolution, you can use `tsc --traceResolution` command.\n\n## Options\n\nThis plugin uses [`cosmiconfig`](https://github.com/davidtheclark/cosmiconfig). This means that besides the plugin constructor,\nyou can place your configuration in the:\n * `\"fork-ts-checker\"` field in the `package.json`\n * `.fork-ts-checkerrc` file in JSON or YAML format\n * `fork-ts-checker.config.js` file exporting a JS object\n\nOptions passed to the plugin constructor will overwrite options from the cosmiconfig (using [deepmerge](https://github.com/TehShrike/deepmerge)).\n\n| Name         | Type                                 | Default value                             | Description                                                                                                                                                                                                                                                                                                                   |\n|--------------|--------------------------------------|-------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `async`      | `boolean`                            | `compiler.options.mode === 'development'` | If `true`, reports issues **after** webpack's compilation is done. Thanks to that it doesn't block the compilation. Used only in the `watch` mode.                                                                                                                                                                            |\n| `typescript` | `object`                             | `{}`                                      | See [TypeScript options](#typescript-options).                                                                                                                                                                                                                                                                                |\n| `issue`      | `object`                             | `{}`                                      | See [Issues options](#issues-options).                                                                                                                                                                                                                                                                                        |\n| `formatter`  | `string` or `object` or `function`   | `codeframe`                               | Available formatters are `basic`, `codeframe` and a custom `function`. To [configure](https://babeljs.io/docs/en/babel-code-frame#options) `codeframe` formatter, pass: `{ type: 'codeframe', options: { <coderame options> } }`. To use absolute file path, pass: `{ type: 'codeframe', pathType: 'absolute' }`. |\n| `logger`     | `{ log: function, error: function }` or `webpack-infrastructure` | `console`     | Console-like object to print issues in `async` mode.                                                                                                                                                                                                                                                                          |\n| `devServer`  | `boolean`                            | `true`                                    | If set to `false`, errors will not be reported to Webpack Dev Server.                                                                                                                                                                                                                                                         |\n\n### TypeScript options\n\nOptions for the TypeScript checker (`typescript` option object).\n\n| Name                | Type                                                                           | Default value                                                                                                  | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |\n|---------------------|--------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `memoryLimit`       | `number`                                                                       | `2048`                                                                                                         | Memory limit for the checker process in MB. If the process exits with the allocation failed error, try to increase this number.                                                                                                                                                                                                                                                                                                                                                                                                                                                |\n| `configFile`        | `string`                                                                       | `'tsconfig.json'`                                                                                              | Path to the `tsconfig.json` file (path relative to the `compiler.options.context` or absolute path)                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |\n| `configOverwrite`   | `object`                                                                       | `{ compilerOptions: { skipLibCheck: true, sourceMap: false, inlineSourceMap: false, declarationMap: false } }` | This configuration will overwrite configuration from the `tsconfig.json` file. Supported fields are: `extends`, `compilerOptions`, `include`, `exclude`, `files`, and `references`.                                                                                                                                                                                                                                                                                                                                                                                            |\n| `context`           | `string`                                                                       | `dirname(configuration.configFile)`                                                                            | The base path for finding files specified in the `tsconfig.json`. Same as the `context` option from the [ts-loader](https://github.com/TypeStrong/ts-loader#context). Useful if you want to keep your `tsconfig.json` in an external package. Keep in mind that **not** having a `tsconfig.json` in your project root can cause different behaviour between `fork-ts-checker-webpack-plugin` and `tsc`. When using editors like `VS Code` it is advised to add a `tsconfig.json` file to the root of the project and extend the config file referenced in option `configFile`. |\n| `build`             | `boolean`                                                                      | `false`                                                                                                        | The equivalent of the `--build` flag for the `tsc` command.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |\n| `mode`              | `'readonly'` or `'write-dts'` or `'write-tsbuildinfo'` or `'write-references'` | `build === true ? 'write-tsbuildinfo' ? 'readonly'`                                                            | Use `readonly` if you don't want to write anything on the disk, `write-dts` to write only `.d.ts` files, `write-tsbuildinfo` to write only `.tsbuildinfo` files, `write-references` to write both `.js` and `.d.ts` files of project references (last 2 modes requires `build: true`).                                                                                                                                                                                                                                                                                         |\n| `diagnosticOptions` | `object`                                                                       | `{ syntactic: false, semantic: true, declaration: false, global: false }`                                      | Settings to select which diagnostics do we want to perform.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |\n| `profile`           | `boolean`                                                                      | `false`                                                                                                        | Measures and prints timings related to the TypeScript performance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |\n| `typescriptPath`    | `string`                                                                       | `require.resolve('typescript')`                                                                                | If supplied this is a custom path where TypeScript can be found.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n\n### Issues options\n\nOptions for the issues filtering (`issue` option object).\nI could write some plain text explanation of these options but I think code will explain it better:\n\n```typescript\ninterface Issue {\n  severity: 'error' | 'warning';\n  code: string;\n  file?: string;\n}\n\ntype IssueMatch = Partial<Issue>; // file field supports glob matching\ntype IssuePredicate = (issue: Issue) => boolean;\ntype IssueFilter = IssueMatch | IssuePredicate | (IssueMatch | IssuePredicate)[];\n```\n\n| Name      | Type          | Default value | Description                                                                                                                                                |\n|-----------|---------------|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `include` | `IssueFilter` | `undefined`   | If `object`, defines issue properties that should be [matched](src/issue/issue-match.ts). If `function`, acts as a predicate where `issue` is an argument. |\n| `exclude` | `IssueFilter` | `undefined`   | Same as `include` but issues that match this predicate will be excluded.                                                                                   |\n\n<details>\n<summary>Expand example</summary>\n\nInclude issues from the `src` directory, exclude issues from `.spec.ts` files:\n\n```js\nmodule.exports = {\n  // ...the webpack configuration\n  plugins: [\n    new ForkTsCheckerWebpackPlugin({\n      issue: {\n        include: [\n          { file: '**/src/**/*' }\n        ],\n        exclude: [\n          { file: '**/*.spec.ts' }\n        ]\n      }\n    })\n  ]\n};\n```\n\n</details>\n\n## Plugin hooks\n\nThis plugin provides some custom webpack hooks:\n\n| Hook key   | Type                       | Params                | Description                                                                                                                                                        |\n|------------|----------------------------|-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `start`    | `AsyncSeriesWaterfallHook` | `change, compilation` | Starts issues checking for a compilation. It's an async waterfall hook, so you can modify the list of changed and removed files or delay the start of the service. |\n| `waiting`  | `SyncHook`                 | `compilation`         | Waiting for the issues checking.                                                                                                                                   |\n| `canceled` | `SyncHook`                 | `compilation`         | Issues checking for the compilation has been canceled.                                                                                                             |\n| `error`    | `SyncHook`                 | `compilation`         | An error occurred during issues checking.                                                                                                                          |\n| `issues`   | `SyncWaterfallHook`        | `issues, compilation` | Issues have been received and will be reported. It's a waterfall hook, so you can modify the list of received issues.                                              |\n\nTo access plugin hooks and tap into the event, we need to use the `getCompilerHooks` static method.\nWhen we call this method with a [webpack compiler instance](https://webpack.js.org/api/node/), it returns the object with\n[tapable](https://github.com/webpack/tapable) hooks where you can pass in your callbacks.\n\n```js\n// ./src/webpack/MyWebpackPlugin.js\nconst ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');\n\nclass MyWebpackPlugin {\n  apply(compiler) {\n    const hooks = ForkTsCheckerWebpackPlugin.getCompilerHooks(compiler);\n\n    // log some message on waiting\n    hooks.waiting.tap('MyPlugin', () => {\n      console.log('waiting for issues');\n    });\n    // don't show warnings\n    hooks.issues.tap('MyPlugin', (issues) =>\n      issues.filter((issue) => issue.severity === 'error')\n    );\n  }\n}\n\nmodule.exports = MyWebpackPlugin;\n\n// webpack.config.js\nconst ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');\nconst MyWebpackPlugin = require('./src/webpack/MyWebpackPlugin');\n\nmodule.exports = {\n  /* ... */\n  plugins: [\n    new ForkTsCheckerWebpackPlugin(),\n    new MyWebpackPlugin()\n  ]\n};\n```\n\n## Profiling types resolution\n\nWhen using TypeScript 4.3.0 or newer you can profile long type checks by\nsetting \"generateTrace\" compiler option. This is an instruction from [microsoft/TypeScript#40063](https://github.com/microsoft/TypeScript/pull/40063):\n\n1. Set \"generateTrace\": \"{folderName}\" in your `tsconfig.json` (under `compilerOptions`)\n2. Look in the resulting folder. If you used build mode, there will be a `legend.json` telling you what went where.\n   Otherwise, there will be `trace.json` file and `types.json` files.\n3. Navigate to [edge://tracing](edge://tracing) or [chrome://tracing](chrome://tracing) and load `trace.json`\n4. Expand Process 1 with the little triangle in the left sidebar\n5. Click on different blocks to see their payloads in the bottom pane\n6. Open `types.json` in an editor\n7. When you see a type ID in the tracing output, go-to-line {id} to find data about that type\n\n## Enabling incremental mode\n\nYou must both set \"incremental\": true in your `tsconfig.json` (under `compilerOptions`) and also specify mode: 'write-references' in `ForkTsCheckerWebpackPlugin` settings.\n\n\n## Related projects\n\n * [`ts-loader`](https://github.com/TypeStrong/ts-loader) - TypeScript loader for webpack.\n * [`babel-loader`](https://github.com/babel/babel-loader) - Alternative TypeScript loader for webpack.\n * [`fork-ts-checker-notifier-webpack-plugin`](https://github.com/johnnyreilly/fork-ts-checker-notifier-webpack-plugin) - Notifies about build status using system notifications (similar to the [webpack-notifier](https://github.com/Turbo87/webpack-notifier)).\n\n## Credits\n\nThis plugin was created in [Realytics](https://www.realytics.io/) in 2017. Thank you for supporting Open Source.\n\n## License\n\nMIT License\n\n","publish_time":1794818816296,"_cnpm_publish_time":1794818816296,"dist-tags":{"alpha":"7.0.0-alpha.16","beta":"5.0.0-beta.7","latest":"9.2.0","next":"1.0.0-alpha.10","release-6.5.x":"6.5.3"}}