ts-checker-rspack-plugin 1.1.7 → 1.2.1

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 (100) hide show
  1. package/README.md +69 -22
  2. package/lib/getDependenciesWorker.js +652 -0
  3. package/lib/getIssuesWorker.js +1095 -0
  4. package/lib/index.js +972 -4
  5. package/lib/issue/issue-config.d.ts +2 -0
  6. package/lib/issue/issue-options.d.ts +2 -0
  7. package/lib/issue/issue-severity.d.ts +4 -4
  8. package/lib/plugin-state.d.ts +0 -1
  9. package/lib/plugin.d.ts +1 -1
  10. package/lib/rpc/rpc-worker.d.ts +0 -1
  11. package/lib/rpc/wrap-rpc.d.ts +0 -1
  12. package/lib/typescript/worker/get-issues-worker.d.ts +2 -2
  13. package/lib/typescript/worker/lib/config.d.ts +2 -2
  14. package/lib/typescript/worker/lib/diagnostics.d.ts +3 -3
  15. package/lib/typescript/worker/lib/file-system/file-system.d.ts +0 -1
  16. package/lib/utils/async/abort-error.d.ts +0 -1
  17. package/lib/utils/async/pool.d.ts +0 -1
  18. package/lib/watch/watch-file-system.d.ts +0 -1
  19. package/package.json +12 -11
  20. package/lib/files-change.js +0 -57
  21. package/lib/files-match.js +0 -2
  22. package/lib/formatter/basic-formatter.js +0 -13
  23. package/lib/formatter/code-frame-formatter.js +0 -32
  24. package/lib/formatter/formatter-config.js +0 -36
  25. package/lib/formatter/formatter-options.js +0 -2
  26. package/lib/formatter/formatter.js +0 -2
  27. package/lib/formatter/index.js +0 -22
  28. package/lib/formatter/stats-formatter.js +0 -30
  29. package/lib/formatter/types/babel__code-frame.js +0 -7
  30. package/lib/formatter/webpack-formatter.js +0 -32
  31. package/lib/hooks/intercept-done-to-get-dev-server-tap.js +0 -18
  32. package/lib/hooks/tap-after-compile-to-add-dependencies.js +0 -59
  33. package/lib/hooks/tap-after-compile-to-get-issues.js +0 -43
  34. package/lib/hooks/tap-after-environment-to-patch-watching.js +0 -22
  35. package/lib/hooks/tap-done-to-async-get-issues.js +0 -74
  36. package/lib/hooks/tap-error-to-log-message.js +0 -32
  37. package/lib/hooks/tap-start-to-run-workers.js +0 -122
  38. package/lib/hooks/tap-stop-to-terminate-workers.js +0 -26
  39. package/lib/infrastructure-logger.js +0 -14
  40. package/lib/issue/index.js +0 -19
  41. package/lib/issue/issue-config.js +0 -29
  42. package/lib/issue/issue-location.js +0 -22
  43. package/lib/issue/issue-match.js +0 -20
  44. package/lib/issue/issue-options.js +0 -2
  45. package/lib/issue/issue-position.js +0 -16
  46. package/lib/issue/issue-predicate.js +0 -11
  47. package/lib/issue/issue-severity.js +0 -12
  48. package/lib/issue/issue-webpack-error.js +0 -31
  49. package/lib/issue/issue.js +0 -41
  50. package/lib/logger.js +0 -2
  51. package/lib/plugin-config.js +0 -26
  52. package/lib/plugin-hooks.js +0 -45
  53. package/lib/plugin-options.js +0 -2
  54. package/lib/plugin-pools.js +0 -32
  55. package/lib/plugin-state.js +0 -17
  56. package/lib/plugin.js +0 -74
  57. package/lib/rpc/expose-rpc.js +0 -69
  58. package/lib/rpc/index.js +0 -12
  59. package/lib/rpc/rpc-error.js +0 -12
  60. package/lib/rpc/rpc-worker.js +0 -86
  61. package/lib/rpc/types.js +0 -2
  62. package/lib/rpc/wrap-rpc.js +0 -70
  63. package/lib/typescript/type-script-config-overwrite.js +0 -2
  64. package/lib/typescript/type-script-diagnostics-options.js +0 -2
  65. package/lib/typescript/type-script-support.js +0 -31
  66. package/lib/typescript/type-script-worker-config.js +0 -36
  67. package/lib/typescript/type-script-worker-options.js +0 -2
  68. package/lib/typescript/worker/get-dependencies-worker.js +0 -15
  69. package/lib/typescript/worker/get-issues-worker.js +0 -70
  70. package/lib/typescript/worker/lib/artifacts.js +0 -94
  71. package/lib/typescript/worker/lib/config.js +0 -162
  72. package/lib/typescript/worker/lib/dependencies.js +0 -84
  73. package/lib/typescript/worker/lib/diagnostics.js +0 -112
  74. package/lib/typescript/worker/lib/emit.js +0 -13
  75. package/lib/typescript/worker/lib/file-system/file-system.js +0 -2
  76. package/lib/typescript/worker/lib/file-system/mem-file-system.js +0 -81
  77. package/lib/typescript/worker/lib/file-system/passive-file-system.js +0 -68
  78. package/lib/typescript/worker/lib/file-system/real-file-system.js +0 -171
  79. package/lib/typescript/worker/lib/host/compiler-host.js +0 -17
  80. package/lib/typescript/worker/lib/host/watch-compiler-host.js +0 -32
  81. package/lib/typescript/worker/lib/host/watch-solution-builder-host.js +0 -53
  82. package/lib/typescript/worker/lib/performance.js +0 -29
  83. package/lib/typescript/worker/lib/program/program.js +0 -37
  84. package/lib/typescript/worker/lib/program/solution-builder.js +0 -39
  85. package/lib/typescript/worker/lib/program/watch-program.js +0 -51
  86. package/lib/typescript/worker/lib/system.js +0 -229
  87. package/lib/typescript/worker/lib/tracing.js +0 -27
  88. package/lib/typescript/worker/lib/tsbuildinfo.js +0 -96
  89. package/lib/typescript/worker/lib/typescript.js +0 -6
  90. package/lib/typescript/worker/lib/worker-config.js +0 -5
  91. package/lib/utils/async/abort-error.js +0 -15
  92. package/lib/utils/async/controlled-promise.js +0 -17
  93. package/lib/utils/async/is-pending.js +0 -10
  94. package/lib/utils/async/pool.js +0 -36
  95. package/lib/utils/async/wait.js +0 -7
  96. package/lib/utils/path/forward-slash.js +0 -15
  97. package/lib/utils/path/is-inside-another-path.js +0 -22
  98. package/lib/utils/path/relative-to-context.js +0 -16
  99. package/lib/watch/inclusive-node-watch-file-system.js +0 -183
  100. package/lib/watch/watch-file-system.js +0 -2
package/README.md CHANGED
@@ -119,45 +119,72 @@ Options for the TypeScript checker (`typescript` option object).
119
119
  ### Issues options
120
120
 
121
121
  Options for the issues filtering (`issue` option object).
122
- I could write some plain text explanation of these options but I think code will explain it better:
122
+
123
+ - **Type**:
123
124
 
124
125
  ```typescript
126
+ interface IssueOptions {
127
+ include?: IssuePredicateOption;
128
+ exclude?: IssuePredicateOption;
129
+ defaultSeverity?: 'auto' | 'warning' | 'error';
130
+ }
131
+
125
132
  interface Issue {
126
133
  severity: 'error' | 'warning';
127
134
  code: string;
135
+ // file field supports glob matching
128
136
  file?: string;
129
137
  }
130
138
 
131
- type IssueMatch = Partial<Issue>; // file field supports glob matching
139
+ type IssueMatch = Partial<Issue>;
132
140
  type IssuePredicate = (issue: Issue) => boolean;
133
- type IssueFilter = IssueMatch | IssuePredicate | (IssueMatch | IssuePredicate)[];
141
+ type IssuePredicateOption = IssuePredicate | IssueMatch | (IssuePredicate | IssueMatch)[];
134
142
  ```
135
143
 
136
- | Name | Type | Default value | Description |
137
- | --------- | ------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
138
- | `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. |
139
- | `exclude` | `IssueFilter` | `undefined` | Same as `include` but issues that match this predicate will be excluded. |
144
+ | Name | Type | Default value | Description |
145
+ | ----------------- | -------------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
146
+ | `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. |
147
+ | `exclude` | `IssueFilter` | `undefined` | Same as `include` but issues that match this predicate will be excluded. |
148
+ | `defaultSeverity` | `'auto' \| 'warning' \| 'error'` | `'auto'` | Controls how the plugin assigns the severity of emitted issues. |
149
+
150
+ `defaultSeverity` behavior:
151
+
152
+ - `auto`: Uses the default mapping based on the TypeScript diagnostic category (`Error` → `error`, `Warning` → `warning`).
153
+ - `warning`: Forces all issues to be emitted as warnings.
154
+ - `error`: Forces all issues to be emitted as errors.
140
155
 
141
- <details>
142
- <summary>Expand example</summary>
156
+ - **Example**:
143
157
 
144
158
  Include issues from the `src` directory, exclude issues from `.spec.ts` files:
145
159
 
146
160
  ```js
147
- module.exports = {
148
- // ...the Rspack configuration
149
- plugins: [
150
- new TsCheckerRspackPlugin({
151
- issue: {
152
- include: [{ file: '**/src/**/*' }],
153
- exclude: [{ file: '**/*.spec.ts' }],
154
- },
155
- }),
156
- ],
157
- };
161
+ new TsCheckerRspackPlugin({
162
+ issue: {
163
+ include: [{ file: '**/src/**/*' }],
164
+ exclude: [{ file: '**/*.spec.ts' }],
165
+ },
166
+ });
158
167
  ```
159
168
 
160
- </details>
169
+ Exclude files under `/node_modules/` using `file:`:
170
+
171
+ ```js
172
+ new TsCheckerRspackPlugin({
173
+ issue: {
174
+ exclude: [({ file = '' }) => /[\\/]some-folder[\\/]/.test(file)],
175
+ },
176
+ });
177
+ ```
178
+
179
+ Force all issues to be emitted as warnings and do not break the build:
180
+
181
+ ```js
182
+ new TsCheckerRspackPlugin({
183
+ issue: {
184
+ defaultSeverity: 'warning',
185
+ },
186
+ });
187
+ ```
161
188
 
162
189
  ## Plugin hooks
163
190
 
@@ -220,7 +247,27 @@ setting "generateTrace" compiler option. This is an instruction from [microsoft/
220
247
 
221
248
  ## Enabling incremental mode
222
249
 
223
- You must both set "incremental": true in your `tsconfig.json` (under `compilerOptions`) and also specify mode: 'write-references' in `TsCheckerRspackPlugin` settings.
250
+ You must both set `"compilerOptions.incremental": true` in your `tsconfig.json` and also specify `build: true` in `TsCheckerRspackPlugin` settings.
251
+
252
+ - `tsconfig.json`:
253
+
254
+ ```diff
255
+ {
256
+ "compilerOptions": {
257
+ + "incremental": true,
258
+ }
259
+ }
260
+ ```
261
+
262
+ - `TsCheckerRspackPlugin` settings:
263
+
264
+ ```js
265
+ new TsCheckerRspackPlugin({
266
+ typescript: {
267
+ build: true,
268
+ },
269
+ });
270
+ ```
224
271
 
225
272
  ## Vue components
226
273