fork-ts-checker-webpack-plugin 6.3.5 → 7.0.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/README.md +25 -103
  2. package/lib/ForkTsCheckerWebpackPlugin.d.ts +11 -12
  3. package/lib/ForkTsCheckerWebpackPlugin.js +29 -49
  4. package/lib/ForkTsCheckerWebpackPluginConfiguration.d.ts +6 -8
  5. package/lib/ForkTsCheckerWebpackPluginConfiguration.js +3 -4
  6. package/lib/ForkTsCheckerWebpackPluginOptions.d.ts +4 -6
  7. package/lib/ForkTsCheckerWebpackPluginOptions.json +73 -111
  8. package/lib/ForkTsCheckerWebpackPluginState.d.ts +4 -4
  9. package/lib/ForkTsCheckerWebpackPluginState.js +1 -0
  10. package/lib/error/OperationCanceledError.js +1 -0
  11. package/lib/formatter/BasicFormatter.d.ts +1 -1
  12. package/lib/formatter/BasicFormatter.js +1 -0
  13. package/lib/formatter/CodeFrameFormatter.d.ts +1 -1
  14. package/lib/formatter/CodeFrameFormatter.js +2 -1
  15. package/lib/formatter/Formatter.d.ts +1 -1
  16. package/lib/formatter/FormatterConfiguration.d.ts +3 -3
  17. package/lib/formatter/FormatterConfiguration.js +21 -2
  18. package/lib/formatter/FormatterOptions.d.ts +11 -6
  19. package/lib/formatter/WebpackFormatter.d.ts +1 -1
  20. package/lib/formatter/WebpackFormatter.js +6 -6
  21. package/lib/formatter/index.d.ts +0 -1
  22. package/lib/formatter/index.js +16 -8
  23. package/lib/hooks/interceptDoneToGetWebpackDevServerTap.d.ts +3 -3
  24. package/lib/hooks/interceptDoneToGetWebpackDevServerTap.js +1 -0
  25. package/lib/hooks/pluginHooks.d.ts +13 -13
  26. package/lib/hooks/pluginHooks.js +1 -0
  27. package/lib/hooks/pluginPools.d.ts +4 -0
  28. package/lib/hooks/pluginPools.js +28 -0
  29. package/lib/hooks/tapAfterCompileToAddDependencies.d.ts +3 -3
  30. package/lib/hooks/tapAfterCompileToAddDependencies.js +1 -0
  31. package/lib/hooks/tapAfterCompileToGetIssues.d.ts +3 -3
  32. package/lib/hooks/tapAfterCompileToGetIssues.js +2 -1
  33. package/lib/hooks/tapAfterEnvironmentToPatchWatching.d.ts +2 -2
  34. package/lib/hooks/tapAfterEnvironmentToPatchWatching.js +4 -1
  35. package/lib/hooks/tapDoneToAsyncGetIssues.d.ts +3 -3
  36. package/lib/hooks/tapDoneToAsyncGetIssues.js +3 -2
  37. package/lib/hooks/tapErrorToLogMessage.d.ts +2 -2
  38. package/lib/hooks/tapErrorToLogMessage.js +4 -3
  39. package/lib/hooks/tapStartToConnectAndRunReporter.d.ts +4 -4
  40. package/lib/hooks/tapStartToConnectAndRunReporter.js +16 -11
  41. package/lib/hooks/tapStopToDisconnectReporter.d.ts +3 -3
  42. package/lib/hooks/tapStopToDisconnectReporter.js +1 -0
  43. package/lib/issue/Issue.d.ts +2 -3
  44. package/lib/issue/Issue.js +2 -3
  45. package/lib/issue/IssueConfiguration.d.ts +3 -3
  46. package/lib/issue/IssueConfiguration.js +1 -0
  47. package/lib/issue/IssueLocation.d.ts +2 -2
  48. package/lib/issue/IssueLocation.js +17 -2
  49. package/lib/issue/IssueMatch.d.ts +3 -3
  50. package/lib/issue/IssueMatch.js +3 -3
  51. package/lib/issue/IssueOptions.d.ts +2 -2
  52. package/lib/issue/IssuePosition.js +1 -0
  53. package/lib/issue/IssuePredicate.d.ts +1 -1
  54. package/lib/issue/IssuePredicate.js +1 -0
  55. package/lib/issue/IssueSeverity.js +1 -0
  56. package/lib/issue/IssueWebpackError.d.ts +3 -3
  57. package/lib/issue/IssueWebpackError.js +7 -5
  58. package/lib/issue/index.js +13 -6
  59. package/lib/logger/LoggerConfiguration.d.ts +3 -3
  60. package/lib/logger/LoggerConfiguration.js +2 -1
  61. package/lib/logger/LoggerFactory.d.ts +2 -2
  62. package/lib/logger/LoggerFactory.js +2 -1
  63. package/lib/logger/LoggerOptions.d.ts +2 -2
  64. package/lib/logger/PartialLogger.d.ts +1 -1
  65. package/lib/logger/PartialLogger.js +1 -0
  66. package/lib/logger/WebpackInfrastructureLogger.d.ts +2 -2
  67. package/lib/logger/WebpackInfrastructureLogger.js +1 -0
  68. package/lib/profile/Performance.js +1 -0
  69. package/lib/reporter/AggregatedReporter.d.ts +1 -1
  70. package/lib/reporter/AggregatedReporter.js +5 -4
  71. package/lib/reporter/FilesChange.d.ts +1 -1
  72. package/lib/reporter/FilesChange.js +2 -1
  73. package/lib/reporter/Report.d.ts +2 -2
  74. package/lib/reporter/Reporter.d.ts +3 -3
  75. package/lib/reporter/index.js +17 -7
  76. package/lib/reporter/reporter-rpc/ReporterRpcClient.d.ts +2 -2
  77. package/lib/reporter/reporter-rpc/ReporterRpcClient.js +7 -4
  78. package/lib/reporter/reporter-rpc/ReporterRpcProcedure.d.ts +8 -5
  79. package/lib/reporter/reporter-rpc/ReporterRpcProcedure.js +3 -0
  80. package/lib/reporter/reporter-rpc/ReporterRpcService.d.ts +2 -2
  81. package/lib/reporter/reporter-rpc/ReporterRpcService.js +5 -2
  82. package/lib/rpc/RpcClient.d.ts +2 -2
  83. package/lib/rpc/RpcClient.js +2 -1
  84. package/lib/rpc/RpcMessage.d.ts +1 -1
  85. package/lib/rpc/RpcMessage.js +3 -0
  86. package/lib/rpc/RpcMessageChannel.d.ts +1 -1
  87. package/lib/rpc/RpcMessageChannel.js +1 -0
  88. package/lib/rpc/RpcService.d.ts +2 -2
  89. package/lib/rpc/RpcService.js +1 -0
  90. package/lib/rpc/error/RpcMessagePortClosedError.js +1 -0
  91. package/lib/rpc/error/RpcRemoteError.js +1 -0
  92. package/lib/rpc/index.js +17 -7
  93. package/lib/rpc/rpc-ipc/RpcIpcMessageChannel.d.ts +1 -1
  94. package/lib/rpc/rpc-ipc/RpcIpcMessageChannel.js +1 -0
  95. package/lib/rpc/rpc-ipc/RpcIpcMessagePort.d.ts +2 -2
  96. package/lib/rpc/rpc-ipc/RpcIpcMessagePort.js +1 -0
  97. package/lib/rpc/rpc-ipc/error/RpcIpcMessagePortClosedError.js +1 -0
  98. package/lib/rpc/rpc-ipc/index.js +12 -5
  99. package/lib/typescript-reporter/TypeScriptConfigurationOverwrite.d.ts +1 -1
  100. package/lib/typescript-reporter/TypeScriptReporterConfiguration.d.ts +5 -5
  101. package/lib/typescript-reporter/TypeScriptReporterConfiguration.js +2 -0
  102. package/lib/typescript-reporter/TypeScriptReporterOptions.d.ts +4 -5
  103. package/lib/typescript-reporter/TypeScriptSupport.d.ts +1 -1
  104. package/lib/typescript-reporter/TypeScriptSupport.js +26 -11
  105. package/lib/typescript-reporter/extension/TypeScriptEmbeddedExtension.d.ts +1 -1
  106. package/lib/typescript-reporter/extension/TypeScriptEmbeddedExtension.js +2 -1
  107. package/lib/typescript-reporter/extension/TypeScriptExtension.d.ts +2 -2
  108. package/lib/typescript-reporter/extension/vue/TypeScriptVueExtension.d.ts +2 -2
  109. package/lib/typescript-reporter/extension/vue/TypeScriptVueExtension.js +4 -3
  110. package/lib/typescript-reporter/extension/vue/TypeScriptVueExtensionConfiguration.d.ts +1 -1
  111. package/lib/typescript-reporter/extension/vue/TypeScriptVueExtensionConfiguration.js +1 -0
  112. package/lib/typescript-reporter/extension/vue/TypeScriptVueExtensionSupport.d.ts +1 -1
  113. package/lib/typescript-reporter/extension/vue/TypeScriptVueExtensionSupport.js +1 -0
  114. package/lib/typescript-reporter/extension/vue/types/vue__compiler-sfc.d.ts +0 -1
  115. package/lib/typescript-reporter/file-system/FileSystem.d.ts +1 -1
  116. package/lib/typescript-reporter/file-system/MemFileSystem.d.ts +1 -1
  117. package/lib/typescript-reporter/file-system/MemFileSystem.js +2 -0
  118. package/lib/typescript-reporter/file-system/PassiveFileSystem.d.ts +1 -1
  119. package/lib/typescript-reporter/file-system/PassiveFileSystem.js +1 -0
  120. package/lib/typescript-reporter/file-system/RealFileSystem.d.ts +1 -1
  121. package/lib/typescript-reporter/file-system/RealFileSystem.js +2 -0
  122. package/lib/typescript-reporter/issue/TypeScriptIssueFactory.d.ts +1 -1
  123. package/lib/typescript-reporter/issue/TypeScriptIssueFactory.js +17 -5
  124. package/lib/typescript-reporter/profile/TypeScriptPerformance.d.ts +1 -1
  125. package/lib/typescript-reporter/profile/TypeScriptPerformance.js +1 -0
  126. package/lib/typescript-reporter/reporter/ControlledCompilerHost.d.ts +5 -0
  127. package/lib/typescript-reporter/reporter/ControlledCompilerHost.js +14 -0
  128. package/lib/typescript-reporter/reporter/ControlledTypeScriptSystem.d.ts +1 -1
  129. package/lib/typescript-reporter/reporter/ControlledTypeScriptSystem.js +7 -18
  130. package/lib/typescript-reporter/reporter/ControlledWatchCompilerHost.d.ts +2 -2
  131. package/lib/typescript-reporter/reporter/ControlledWatchCompilerHost.js +1 -0
  132. package/lib/typescript-reporter/reporter/ControlledWatchSolutionBuilderHost.d.ts +2 -2
  133. package/lib/typescript-reporter/reporter/ControlledWatchSolutionBuilderHost.js +1 -0
  134. package/lib/typescript-reporter/reporter/TypeScriptConfigurationParser.d.ts +2 -2
  135. package/lib/typescript-reporter/reporter/TypeScriptConfigurationParser.js +8 -2
  136. package/lib/typescript-reporter/reporter/TypeScriptReporter.d.ts +2 -2
  137. package/lib/typescript-reporter/reporter/TypeScriptReporter.js +42 -18
  138. package/lib/typescript-reporter/reporter/TypeScriptReporterRpcClient.d.ts +2 -2
  139. package/lib/typescript-reporter/reporter/TypeScriptReporterRpcClient.js +1 -0
  140. package/lib/typescript-reporter/reporter/TypeScriptReporterRpcService.js +2 -2
  141. package/lib/utils/async/pool.d.ts +1 -0
  142. package/lib/utils/async/pool.js +10 -0
  143. package/lib/utils/path/relativeToContext.d.ts +2 -0
  144. package/lib/utils/path/relativeToContext.js +16 -0
  145. package/lib/watch/InclusiveNodeWatchFileSystem.d.ts +5 -5
  146. package/lib/watch/InclusiveNodeWatchFileSystem.js +90 -92
  147. package/lib/watch/WatchFileSystem.d.ts +5 -22
  148. package/package.json +50 -67
  149. package/CHANGELOG.md +0 -318
  150. package/changelog.config.js +0 -36
  151. package/lib/eslint-reporter/EsLintReporterConfiguration.d.ts +0 -11
  152. package/lib/eslint-reporter/EsLintReporterConfiguration.js +0 -26
  153. package/lib/eslint-reporter/EsLintReporterOptions.d.ts +0 -8
  154. package/lib/eslint-reporter/EsLintReporterOptions.js +0 -2
  155. package/lib/eslint-reporter/assertEsLintSupport.d.ts +0 -3
  156. package/lib/eslint-reporter/assertEsLintSupport.js +0 -30
  157. package/lib/eslint-reporter/issue/EsLintIssueFactory.d.ts +0 -4
  158. package/lib/eslint-reporter/issue/EsLintIssueFactory.js +0 -32
  159. package/lib/eslint-reporter/reporter/EsLintReporter.d.ts +0 -4
  160. package/lib/eslint-reporter/reporter/EsLintReporter.js +0 -133
  161. package/lib/eslint-reporter/reporter/EsLintReporterRpcClient.d.ts +0 -4
  162. package/lib/eslint-reporter/reporter/EsLintReporterRpcClient.js +0 -13
  163. package/lib/eslint-reporter/reporter/EsLintReporterRpcService.d.ts +0 -1
  164. package/lib/eslint-reporter/reporter/EsLintReporterRpcService.js +0 -11
  165. package/lib/eslint-reporter/types/eslint.d.ts +0 -31
  166. package/lib/eslint-reporter/types/eslint.js +0 -2
  167. package/lib/formatter/FormatterFactory.d.ts +0 -13
  168. package/lib/formatter/FormatterFactory.js +0 -18
  169. package/lib/watch/CompilerWithWatchFileSystem.d.ts +0 -6
  170. package/lib/watch/CompilerWithWatchFileSystem.js +0 -2
package/README.md CHANGED
@@ -14,17 +14,18 @@
14
14
 
15
15
  ## Features
16
16
 
17
- * Speeds up [TypeScript](https://github.com/Microsoft/TypeScript) type checking and [ESLint](https://eslint.org/) linting (by moving each to a separate process) 🏎
17
+ * Speeds up [TypeScript](https://github.com/Microsoft/TypeScript) type checking (by moving it to a separate process) 🏎
18
18
  * 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) ✨
19
19
  * Supports [Vue Single File Component](https://vuejs.org/v2/guide/single-file-components.html) ✅ 
20
20
  * Displays nice error messages with the [code frame](https://babeljs.io/docs/en/next/babel-code-frame.html) formatter 🌈
21
21
 
22
22
  ## Installation
23
23
 
24
- This plugin requires minimum **Node.js 10**, **Webpack 4**, **TypeScript 2.7** and optionally **ESLint 6**
24
+ This plugin requires **Node.js >=12.13.0+**, **Webpack ^5.11.0**, **TypeScript ^3.6.0**
25
+
26
+ * 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.
27
+ * 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.
25
28
 
26
- * If you depend on **Webpack 2**, **Webpack 3**, or **TSLint 4**, please use [version 3](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/tree/v3.1.1) of the plugin.
27
- * If you depend on **TypeScript >= 2.1** and **< 2.7** or you can't update to **Node 10**, please use [version 4](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/tree/v4.1.4) of the plugin.
28
29
  ```sh
29
30
  # with npm
30
31
  npm install --save-dev fork-ts-checker-webpack-plugin
@@ -62,9 +63,8 @@ module.exports = {
62
63
  };
63
64
  ```
64
65
 
65
- > Examples how to configure it with [babel-loader](https://github.com/babel/babel-loader), [ts-loader](https://github.com/TypeStrong/ts-loader),
66
- > [eslint](https://github.com/eslint/eslint) and [Visual Studio Code](https://code.visualstudio.com/) are in the
67
- > [**examples**](./examples) directory.
66
+ > Examples how to configure it with [babel-loader](https://github.com/babel/babel-loader), [ts-loader](https://github.com/TypeStrong/ts-loader)
67
+ > and [Visual Studio Code](https://code.visualstudio.com/) are in the [**examples**](./examples) directory.
68
68
 
69
69
  ## Modules resolution
70
70
 
@@ -75,57 +75,6 @@ It's very important to be aware that **this plugin uses [TypeScript](https://git
75
75
  >
76
76
  > To debug TypeScript's modules resolution, you can use `tsc --traceResolution` command.
77
77
 
78
- ## ESLint
79
-
80
- If you'd like to use ESLint with the plugin, ensure you have the relevant dependencies installed:
81
-
82
- ```sh
83
- # with npm
84
- npm install --save-dev eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin
85
-
86
- # with yarn
87
- yarn add --dev eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin
88
- ```
89
-
90
- Then set up ESLint in the plugin. This is the minimal configuration:
91
- ```js
92
- // webpack.config.js
93
- const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
94
-
95
- module.exports = {
96
- // ...the webpack configuration
97
- plugins: [
98
- new ForkTsCheckerWebpackPlugin({
99
- eslint: {
100
- files: './src/**/*.{ts,tsx,js,jsx}' // required - same as command `eslint ./src/**/*.{ts,tsx,js,jsx} --ext .ts,.tsx,.js,.jsx`
101
- }
102
- })
103
- ]
104
- };
105
- ```
106
-
107
- You should also have an ESLint configuration file in your root project directory.
108
- Here is a sample `.eslintrc.js` configuration for a TypeScript project:
109
-
110
- ```js
111
- module.exports = {
112
- parser: '@typescript-eslint/parser',
113
- parserOptions: {
114
- ecmaVersion: 2018,
115
- sourceType: 'module',
116
- },
117
- extends: [
118
- 'plugin:@typescript-eslint/recommended'
119
- ],
120
- rules: {
121
- // place to specify ESLint rules - can be used to overwrite rules specified from the extended configs
122
- // e.g. "@typescript-eslint/explicit-function-return-type": "off",
123
- }
124
- };
125
- ```
126
-
127
- There's a [good explanation on setting up TypeScript ESLint support by Robert Cooper](https://dev.to/robertcoopercode/using-eslint-and-prettier-in-a-typescript-project-53jb).
128
-
129
78
  ## Options
130
79
 
131
80
  This plugin uses [`cosmiconfig`](https://github.com/davidtheclark/cosmiconfig). This means that besides the plugin constructor,
@@ -139,11 +88,10 @@ Options passed to the plugin constructor will overwrite options from the cosmico
139
88
  | Name | Type | Default value | Description |
140
89
  | ----------------- | ---------------------------------- | ------------------------------------------------------------------ | ----------- |
141
90
  | `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. |
142
- | `typescript` | `object` or `boolean` | `true` | If a `boolean`, it enables/disables TypeScript checker. If an `object`, see [TypeScript options](#typescript-options). |
143
- | `eslint` | `object` | `undefined` | If `undefined`, it disables ESLint linter. If an `object`, see [ESLint options](#eslint-options). |
91
+ | `typescript` | `object` | `{}` | See [TypeScript options](#typescript-options). |
144
92
  | `issue` | `object` | `{}` | See [Issues options](#issues-options). |
145
93
  | `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 object: `{ type: 'codeframe', options: { <coderame options> } }`. |
146
- | `logger` | `object` | `{ infrastructure: 'silent', issues: 'console', devServer: true }` | Available loggers are `silent`, `console`, and `webpack-infrastructure`. Infrastructure logger prints additional information, issue logger prints `issues` in the `async` mode. If `devServer` is set to `false`, errors will not be reported to Webpack Dev Server. |
94
+ | `logger` | `object` | `{ infrastructure: 'silent', issues: 'console', devServer: true }` | Available loggers are `silent`, `console`, and `webpack-infrastructure`. Infrastructure logger prints additional information, issue logger prints `issues` in the `async` mode. If `devServer` is set to `false`, errors will not be reported to Webpack Dev Server. |
147
95
 
148
96
  ### TypeScript options
149
97
 
@@ -151,7 +99,6 @@ Options for the TypeScript checker (`typescript` option object).
151
99
 
152
100
  | Name | Type | Default value | Description |
153
101
  | -------------------- | --------- | -------------------------------------------------------------------------------------------------------------- | ----------- |
154
- | `enabled` | `boolean` | `true` | If `true`, it enables TypeScript checker. |
155
102
  | `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. |
156
103
  | `configFile` | `string` | `'tsconfig.json'` | Path to the `tsconfig.json` file (path relative to the `compiler.options.context` or absolute path) |
157
104
  | `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`. |
@@ -173,17 +120,6 @@ Options for the TypeScript checker extensions (`typescript.extensions` option ob
173
120
  | `vue.enabled` | `boolean` | `false` | Same as the `vue` option |
174
121
  | `vue.compiler` | `string` | `'vue-template-compiler'` | The package name of the compiler that will be used to parse `.vue` files. You can use `'nativescript-vue-template-compiler'` if you use [nativescript-vue](https://github.com/nativescript-vue/nativescript-vue) |
175
122
 
176
- ### ESLint options
177
-
178
- Options for the ESLint linter (`eslint` option object).
179
-
180
- | Name | Type | Default value | Description |
181
- | -------------------- | ---------------------- | ------------------------- | ----------- |
182
- | `enabled` | `boolean` | `false` | If `true`, it enables ESLint linter. If you set the `files` option, it will be `true` by default. |
183
- | `files` | `string` or `string[]` | This value is required | One or more [glob patterns](https://en.wikipedia.org/wiki/Glob_(programming)) to the files that should be linted. Works the same as the `eslint` command. |
184
- | `memoryLimit` | `number` | `2048` | Memory limit for the linter process in MB. If the process exits with the allocation failed error, try to increase this number. |
185
- | `options` | `object` | `{}` | [Options](https://eslint.org/docs/developer-guide/nodejs-api#cliengine) that can be used to initialize ESLint. |
186
-
187
123
  ### Issues options
188
124
 
189
125
  Options for the issues filtering (`issue` option object).
@@ -191,7 +127,6 @@ I could write some plain text explanation of these options but I think code will
191
127
 
192
128
  ```typescript
193
129
  interface Issue {
194
- origin: 'typescript' | 'eslint';
195
130
  severity: 'error' | 'warning';
196
131
  code: string;
197
132
  file?: string;
@@ -210,7 +145,7 @@ type IssueFilter = IssueMatch | IssuePredicate | (IssueMatch | IssuePredicate)[]
210
145
  <details>
211
146
  <summary>Expand example</summary>
212
147
 
213
- Include issues from the `src` directory, exclude eslint issues from `.spec.ts` files:
148
+ Include issues from the `src` directory, exclude issues from `.spec.ts` files:
214
149
 
215
150
  ```js
216
151
  module.exports = {
@@ -222,7 +157,7 @@ module.exports = {
222
157
  { file: '**/src/**/*' }
223
158
  ],
224
159
  exclude: [
225
- { origin: 'eslint', file: '**/*.spec.ts' }
160
+ { file: '**/*.spec.ts' }
226
161
  ]
227
162
  }
228
163
  })
@@ -362,37 +297,24 @@ When we call this method with a [webpack compiler instance](https://webpack.js.o
362
297
  [tapable](https://github.com/webpack/tapable) hooks where you can pass in your callbacks.
363
298
 
364
299
  ```js
365
- // ./src/webpack/MyWebpackPlugin.js
300
+ const webpack = require('webpack');
366
301
  const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
367
302
 
368
- class MyWebpackPlugin {
369
- apply(compiler) {
370
- const hooks = ForkTsCheckerWebpackPlugin.getCompilerHooks(compiler);
371
-
372
- // log some message on waiting
373
- hooks.waiting.tap('MyPlugin', () => {
374
- console.log('waiting for issues');
375
- });
376
- // don't show warnings
377
- hooks.issues.tap('MyPlugin', (issues) =>
378
- issues.filter((issue) => issue.severity === 'error')
379
- );
380
- }
381
- }
303
+ const compiler = webpack({
304
+ // ... webpack config
305
+ });
382
306
 
383
- module.exports = MyWebpackPlugin;
307
+ // optionally add the plugin to the compiler
308
+ // **don't do this if already added through configuration**
309
+ new ForkTsCheckerWebpackPlugin().apply(compiler);
384
310
 
385
- // webpack.config.js
386
- const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
387
- const MyWebpackPlugin = require('./src/webpack/MyWebpackPlugin');
311
+ // now get the plugin hooks from compiler
312
+ const hooks = ForkTsCheckerWebpackPlugin.getCompilerHooks(compiler);
388
313
 
389
- module.exports = {
390
- /* ... */
391
- plugins: [
392
- new ForkTsCheckerWebpackPlugin(),
393
- new MyWebpackPlugin()
394
- ]
395
- };
314
+ // say we want to show some message when plugin is waiting for issues results
315
+ hooks.waiting.tap('yourListenerName', () => {
316
+ console.log('waiting for issues');
317
+ });
396
318
  ```
397
319
 
398
320
  ## Typings
@@ -410,7 +332,7 @@ yarn add --dev @types/webpack
410
332
 
411
333
  ## Profiling types resolution
412
334
 
413
- Starting from TypeScript 4.1.0, you can profile long type checks by
335
+ Starting from TypeScript 4.1.0 (currently in beta), you can profile long type checks by
414
336
  setting "generateTrace" compiler option. This is an instruction from [microsoft/TypeScript#40063](https://github.com/microsoft/TypeScript/pull/40063):
415
337
 
416
338
  1. Set "generateTrace": "{folderName}" in your `tsconfig.json`
@@ -1,7 +1,6 @@
1
- import webpack from 'webpack';
2
- import { ForkTsCheckerWebpackPluginOptions } from './ForkTsCheckerWebpackPluginOptions';
3
- import { Pool } from './utils/async/pool';
4
- declare class ForkTsCheckerWebpackPlugin implements webpack.Plugin {
1
+ import type webpack from 'webpack';
2
+ import type { ForkTsCheckerWebpackPluginOptions } from './ForkTsCheckerWebpackPluginOptions';
3
+ declare class ForkTsCheckerWebpackPlugin {
5
4
  /**
6
5
  * Current version of the plugin
7
6
  */
@@ -9,20 +8,20 @@ declare class ForkTsCheckerWebpackPlugin implements webpack.Plugin {
9
8
  /**
10
9
  * Default pools for the plugin concurrency limit
11
10
  */
12
- static readonly issuesPool: Pool;
13
- static readonly dependenciesPool: Pool;
11
+ static readonly issuesPool: import("./utils/async/pool").Pool;
12
+ static readonly dependenciesPool: import("./utils/async/pool").Pool;
14
13
  /**
15
14
  * @deprecated Use ForkTsCheckerWebpackPlugin.issuesPool instead
16
15
  */
17
- static get pool(): Pool;
16
+ static readonly pool: import("./utils/async/pool").Pool;
18
17
  private readonly options;
19
18
  constructor(options?: ForkTsCheckerWebpackPluginOptions);
20
19
  static getCompilerHooks(compiler: webpack.Compiler): {
21
- start: import("tapable").AsyncSeriesWaterfallHook<import("./reporter/FilesChange").FilesChange, webpack.compilation.Compilation, any>;
22
- waiting: import("tapable").SyncHook<webpack.compilation.Compilation, any, any>;
23
- canceled: import("tapable").SyncHook<webpack.compilation.Compilation, any, any>;
24
- error: import("tapable").SyncHook<Error, webpack.compilation.Compilation, any>;
25
- issues: import("tapable").SyncWaterfallHook<import("./issue/Issue").Issue[], webpack.compilation.Compilation | undefined, void>;
20
+ start: import("tapable").AsyncSeriesWaterfallHook<[import("./reporter/FilesChange").FilesChange, webpack.Compilation], import("tapable").UnsetAdditionalOptions>;
21
+ waiting: import("tapable").SyncHook<[webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
22
+ canceled: import("tapable").SyncHook<[webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
23
+ error: import("tapable").SyncHook<[Error, webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
24
+ issues: import("tapable").SyncWaterfallHook<[import("./issue/Issue").Issue[], webpack.Compilation | undefined], void>;
26
25
  };
27
26
  apply(compiler: webpack.Compiler): void;
28
27
  }
@@ -3,42 +3,34 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const schema_utils_1 = __importDefault(require("schema-utils"));
6
+ exports.ForkTsCheckerWebpackPlugin = void 0;
7
7
  const cosmiconfig_1 = require("cosmiconfig");
8
8
  const deepmerge_1 = __importDefault(require("deepmerge"));
9
- const ForkTsCheckerWebpackPluginOptions_json_1 = __importDefault(require("./ForkTsCheckerWebpackPluginOptions.json"));
9
+ const schema_utils_1 = require("schema-utils");
10
+ // type only dependency
11
+ // eslint-disable-next-line node/no-extraneous-import
10
12
  const ForkTsCheckerWebpackPluginConfiguration_1 = require("./ForkTsCheckerWebpackPluginConfiguration");
13
+ const ForkTsCheckerWebpackPluginOptions_json_1 = __importDefault(require("./ForkTsCheckerWebpackPluginOptions.json"));
11
14
  const ForkTsCheckerWebpackPluginState_1 = require("./ForkTsCheckerWebpackPluginState");
12
- const reporter_1 = require("./reporter");
13
- const TypeScriptSupport_1 = require("./typescript-reporter/TypeScriptSupport");
14
- const TypeScriptReporterRpcClient_1 = require("./typescript-reporter/reporter/TypeScriptReporterRpcClient");
15
- const assertEsLintSupport_1 = require("./eslint-reporter/assertEsLintSupport");
16
- const EsLintReporterRpcClient_1 = require("./eslint-reporter/reporter/EsLintReporterRpcClient");
17
- const tapStartToConnectAndRunReporter_1 = require("./hooks/tapStartToConnectAndRunReporter");
18
- const tapStopToDisconnectReporter_1 = require("./hooks/tapStopToDisconnectReporter");
19
- const tapAfterCompileToAddDependencies_1 = require("./hooks/tapAfterCompileToAddDependencies");
20
- const tapErrorToLogMessage_1 = require("./hooks/tapErrorToLogMessage");
21
15
  const pluginHooks_1 = require("./hooks/pluginHooks");
16
+ const pluginPools_1 = require("./hooks/pluginPools");
17
+ const tapAfterCompileToAddDependencies_1 = require("./hooks/tapAfterCompileToAddDependencies");
22
18
  const tapAfterEnvironmentToPatchWatching_1 = require("./hooks/tapAfterEnvironmentToPatchWatching");
23
- const pool_1 = require("./utils/async/pool");
24
- const os_1 = __importDefault(require("os"));
19
+ const tapErrorToLogMessage_1 = require("./hooks/tapErrorToLogMessage");
20
+ const tapStartToConnectAndRunReporter_1 = require("./hooks/tapStartToConnectAndRunReporter");
21
+ const tapStopToDisconnectReporter_1 = require("./hooks/tapStopToDisconnectReporter");
22
+ const TypeScriptReporterRpcClient_1 = require("./typescript-reporter/reporter/TypeScriptReporterRpcClient");
23
+ const TypeScriptSupport_1 = require("./typescript-reporter/TypeScriptSupport");
25
24
  class ForkTsCheckerWebpackPlugin {
26
25
  constructor(options = {}) {
27
26
  const explorerSync = cosmiconfig_1.cosmiconfigSync('fork-ts-checker');
28
27
  const { config: externalOptions } = explorerSync.search() || {};
29
28
  // first validate options directly passed to the constructor
30
29
  const configuration = { name: 'ForkTsCheckerWebpackPlugin' };
31
- schema_utils_1.default(ForkTsCheckerWebpackPluginOptions_json_1.default, options, configuration);
30
+ schema_utils_1.validate(ForkTsCheckerWebpackPluginOptions_json_1.default, options, configuration);
32
31
  this.options = deepmerge_1.default(externalOptions || {}, options || {});
33
32
  // then validate merged options
34
- schema_utils_1.default(ForkTsCheckerWebpackPluginOptions_json_1.default, this.options, configuration);
35
- }
36
- /**
37
- * @deprecated Use ForkTsCheckerWebpackPlugin.issuesPool instead
38
- */
39
- static get pool() {
40
- // for backward compatibility
41
- return ForkTsCheckerWebpackPlugin.issuesPool;
33
+ schema_utils_1.validate(ForkTsCheckerWebpackPluginOptions_json_1.default, this.options, configuration);
42
34
  }
43
35
  static getCompilerHooks(compiler) {
44
36
  return pluginHooks_1.getForkTsCheckerWebpackPluginHooks(compiler);
@@ -46,39 +38,27 @@ class ForkTsCheckerWebpackPlugin {
46
38
  apply(compiler) {
47
39
  const configuration = ForkTsCheckerWebpackPluginConfiguration_1.createForkTsCheckerWebpackPluginConfiguration(compiler, this.options);
48
40
  const state = ForkTsCheckerWebpackPluginState_1.createForkTsCheckerWebpackPluginState();
49
- const issuesReporters = [];
50
- const dependenciesReporters = [];
51
- if (configuration.typescript.enabled) {
52
- TypeScriptSupport_1.assertTypeScriptSupport(configuration.typescript);
53
- issuesReporters.push(TypeScriptReporterRpcClient_1.createTypeScriptReporterRpcClient(configuration.typescript));
54
- dependenciesReporters.push(TypeScriptReporterRpcClient_1.createTypeScriptReporterRpcClient(configuration.typescript));
55
- }
56
- if (configuration.eslint.enabled) {
57
- assertEsLintSupport_1.assertEsLintSupport(configuration.eslint);
58
- issuesReporters.push(EsLintReporterRpcClient_1.createEsLintReporterRpcClient(configuration.eslint));
59
- dependenciesReporters.push(EsLintReporterRpcClient_1.createEsLintReporterRpcClient(configuration.eslint));
60
- }
61
- if (issuesReporters.length) {
62
- const issuesReporter = reporter_1.createAggregatedReporter(reporter_1.composeReporterRpcClients(issuesReporters));
63
- const dependenciesReporter = reporter_1.createAggregatedReporter(reporter_1.composeReporterRpcClients(dependenciesReporters));
64
- tapAfterEnvironmentToPatchWatching_1.tapAfterEnvironmentToPatchWatching(compiler, state);
65
- tapStartToConnectAndRunReporter_1.tapStartToConnectAndRunReporter(compiler, issuesReporter, dependenciesReporter, configuration, state);
66
- tapAfterCompileToAddDependencies_1.tapAfterCompileToAddDependencies(compiler, configuration, state);
67
- tapStopToDisconnectReporter_1.tapStopToDisconnectReporter(compiler, issuesReporter, dependenciesReporter, state);
68
- tapErrorToLogMessage_1.tapErrorToLogMessage(compiler, configuration);
69
- }
70
- else {
71
- throw new Error(`ForkTsCheckerWebpackPlugin is configured to not use any issue reporter. It's probably a configuration issue.`);
72
- }
41
+ TypeScriptSupport_1.assertTypeScriptSupport(configuration.typescript);
42
+ const issuesReporter = TypeScriptReporterRpcClient_1.createTypeScriptReporterRpcClient(configuration.typescript);
43
+ const dependenciesReporter = TypeScriptReporterRpcClient_1.createTypeScriptReporterRpcClient(configuration.typescript);
44
+ tapAfterEnvironmentToPatchWatching_1.tapAfterEnvironmentToPatchWatching(compiler, state);
45
+ tapStartToConnectAndRunReporter_1.tapStartToConnectAndRunReporter(compiler, issuesReporter, dependenciesReporter, configuration, state);
46
+ tapAfterCompileToAddDependencies_1.tapAfterCompileToAddDependencies(compiler, configuration, state);
47
+ tapStopToDisconnectReporter_1.tapStopToDisconnectReporter(compiler, issuesReporter, dependenciesReporter, state);
48
+ tapErrorToLogMessage_1.tapErrorToLogMessage(compiler, configuration);
73
49
  }
74
50
  }
75
51
  exports.ForkTsCheckerWebpackPlugin = ForkTsCheckerWebpackPlugin;
76
52
  /**
77
53
  * Current version of the plugin
78
54
  */
79
- ForkTsCheckerWebpackPlugin.version = '6.3.5'; // will be replaced by the @semantic-release/exec
55
+ ForkTsCheckerWebpackPlugin.version = '7.0.0-alpha.10'; // will be replaced by the @semantic-release/exec
80
56
  /**
81
57
  * Default pools for the plugin concurrency limit
82
58
  */
83
- ForkTsCheckerWebpackPlugin.issuesPool = pool_1.createPool(Math.max(1, os_1.default.cpus().length));
84
- ForkTsCheckerWebpackPlugin.dependenciesPool = pool_1.createPool(Math.max(1, os_1.default.cpus().length));
59
+ ForkTsCheckerWebpackPlugin.issuesPool = pluginPools_1.issuesPool;
60
+ ForkTsCheckerWebpackPlugin.dependenciesPool = pluginPools_1.dependenciesPool;
61
+ /**
62
+ * @deprecated Use ForkTsCheckerWebpackPlugin.issuesPool instead
63
+ */
64
+ ForkTsCheckerWebpackPlugin.pool = pluginPools_1.issuesPool;
@@ -1,14 +1,12 @@
1
- import webpack from 'webpack';
2
- import { ForkTsCheckerWebpackPluginOptions } from './ForkTsCheckerWebpackPluginOptions';
3
- import { IssueConfiguration } from './issue/IssueConfiguration';
4
- import { FormatterConfiguration } from './formatter';
5
- import { TypeScriptReporterConfiguration } from './typescript-reporter/TypeScriptReporterConfiguration';
6
- import { EsLintReporterConfiguration } from './eslint-reporter/EsLintReporterConfiguration';
7
- import { LoggerConfiguration } from './logger/LoggerConfiguration';
1
+ import type webpack from 'webpack';
2
+ import type { ForkTsCheckerWebpackPluginOptions } from './ForkTsCheckerWebpackPluginOptions';
3
+ import type { FormatterConfiguration } from './formatter';
4
+ import type { IssueConfiguration } from './issue/IssueConfiguration';
5
+ import type { LoggerConfiguration } from './logger/LoggerConfiguration';
6
+ import type { TypeScriptReporterConfiguration } from './typescript-reporter/TypeScriptReporterConfiguration';
8
7
  interface ForkTsCheckerWebpackPluginConfiguration {
9
8
  async: boolean;
10
9
  typescript: TypeScriptReporterConfiguration;
11
- eslint: EsLintReporterConfiguration;
12
10
  issue: IssueConfiguration;
13
11
  formatter: FormatterConfiguration;
14
12
  logger: LoggerConfiguration;
@@ -1,15 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const IssueConfiguration_1 = require("./issue/IssueConfiguration");
3
+ exports.createForkTsCheckerWebpackPluginConfiguration = void 0;
4
4
  const formatter_1 = require("./formatter");
5
- const TypeScriptReporterConfiguration_1 = require("./typescript-reporter/TypeScriptReporterConfiguration");
6
- const EsLintReporterConfiguration_1 = require("./eslint-reporter/EsLintReporterConfiguration");
5
+ const IssueConfiguration_1 = require("./issue/IssueConfiguration");
7
6
  const LoggerConfiguration_1 = require("./logger/LoggerConfiguration");
7
+ const TypeScriptReporterConfiguration_1 = require("./typescript-reporter/TypeScriptReporterConfiguration");
8
8
  function createForkTsCheckerWebpackPluginConfiguration(compiler, options = {}) {
9
9
  return {
10
10
  async: options.async === undefined ? compiler.options.mode === 'development' : options.async,
11
11
  typescript: TypeScriptReporterConfiguration_1.createTypeScriptReporterConfiguration(compiler, options.typescript),
12
- eslint: EsLintReporterConfiguration_1.createEsLintReporterConfiguration(compiler, options.eslint),
13
12
  issue: IssueConfiguration_1.createIssueConfiguration(compiler, options.issue),
14
13
  formatter: formatter_1.createFormatterConfiguration(options.formatter),
15
14
  logger: LoggerConfiguration_1.createLoggerConfiguration(compiler, options.logger),
@@ -1,12 +1,10 @@
1
- import { TypeScriptReporterOptions } from './typescript-reporter/TypeScriptReporterOptions';
2
- import { EsLintReporterOptions } from './eslint-reporter/EsLintReporterOptions';
3
- import { IssueOptions } from './issue/IssueOptions';
4
- import { FormatterOptions } from './formatter';
5
- import LoggerOptions from './logger/LoggerOptions';
1
+ import type { FormatterOptions } from './formatter';
2
+ import type { IssueOptions } from './issue/IssueOptions';
3
+ import type LoggerOptions from './logger/LoggerOptions';
4
+ import type { TypeScriptReporterOptions } from './typescript-reporter/TypeScriptReporterOptions';
6
5
  interface ForkTsCheckerWebpackPluginOptions {
7
6
  async?: boolean;
8
7
  typescript?: TypeScriptReporterOptions;
9
- eslint?: EsLintReporterOptions;
10
8
  formatter?: FormatterOptions;
11
9
  issue?: IssueOptions;
12
10
  logger?: LoggerOptions;