ts-checker-rspack-plugin 1.5.1 → 1.5.3

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 (3) hide show
  1. package/README.md +440 -85
  2. package/lib/index.js +8 -8
  3. package/package.json +10 -9
package/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  # ts-checker-rspack-plugin
2
2
 
3
- Rspack plugin that runs TypeScript type checker on a separate process.
4
-
5
3
  <p>
6
4
  <a href="https://npmjs.com/package/ts-checker-rspack-plugin">
7
5
  <img src="https://img.shields.io/npm/v/ts-checker-rspack-plugin?style=flat-square&colorA=564341&colorB=EDED91" alt="npm version" />
@@ -10,33 +8,32 @@ Rspack plugin that runs TypeScript type checker on a separate process.
10
8
  <a href="https://npmcharts.com/compare/ts-checker-rspack-plugin?minimal=true"><img src="https://img.shields.io/npm/dm/ts-checker-rspack-plugin.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="downloads" /></a>
11
9
  </p>
12
10
 
13
- ## Credits
14
-
15
- This plugin is forked from [TypeStrong/fork-ts-checker-webpack-plugin](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin), which is created by [Piotr Oleś](https://github.com/piotr-oles). See the original project's [LICENSE](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/blob/main/LICENSE).
16
-
17
- Big thanks to `fork-ts-checker-webpack-plugin` creators and contributors for their great work. ❤️
11
+ Rspack plugin that runs TypeScript type checker on a separate process.
18
12
 
19
13
  ## Features
20
14
 
21
15
  - Speeds up [TypeScript](https://github.com/Microsoft/TypeScript) type checking (by moving it to a separate process) 🏎
22
- - 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) ✨
16
+ - Supports modern TypeScript features like
17
+ [project references](https://www.typescriptlang.org/docs/handbook/project-references.html) and
18
+ [incremental mode](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#faster-subsequent-builds-with-the---incremental-flag) ✨
23
19
  - Displays nice error messages with the [code frame](https://babeljs.io/docs/en/next/babel-code-frame.html) formatter 🌈
24
20
 
25
- 💡 For Rsbuild projects, use [@rsbuild/plugin-type-check](https://github.com/rstackjs/rsbuild-plugin-type-check) to get out-of-the-box experience.
21
+ 💡 For Rsbuild projects, use [@rsbuild/plugin-type-check](https://github.com/rstackjs/rsbuild-plugin-type-check)
22
+ to get out-of-the-box experience.
26
23
 
27
24
  ## Installation
28
25
 
29
- This plugin requires **Node.js >=16.0.0+**, **Rspack ^1.0.0**, **TypeScript ^3.8.0**
26
+ This plugin requires **Rspack ^1.0.0**, **TypeScript ^3.8.0**
30
27
 
31
28
  ```sh
29
+ # with pnpm
30
+ pnpm add -D ts-checker-rspack-plugin
31
+
32
32
  # with npm
33
33
  npm install -D ts-checker-rspack-plugin
34
34
 
35
35
  # with yarn
36
36
  yarn add -D ts-checker-rspack-plugin
37
-
38
- # with pnpm
39
- pnpm add -D ts-checker-rspack-plugin
40
37
  ```
41
38
 
42
39
  The minimal Rspack config with [builtin:swc-loader](https://rspack.rs/guide/features/builtin-swc-loader).
@@ -56,11 +53,7 @@ export default {
56
53
  test: /\.tsx?$/,
57
54
  loader: 'builtin:swc-loader',
58
55
  options: {
59
- jsc: {
60
- parser: {
61
- syntax: 'typescript',
62
- },
63
- },
56
+ detectSyntax: 'auto',
64
57
  },
65
58
  },
66
59
  ],
@@ -89,90 +82,424 @@ Rspack's modules resolution**. It means that you have to setup `tsconfig.json` c
89
82
  >
90
83
  > To debug TypeScript's modules resolution, you can use `tsc --traceResolution` command.
91
84
 
92
- ## Options
93
-
94
- | Name | Type | Default value | Description |
95
- | ------------ | ---------------------------------------------------------------- | ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
96
- | `async` | `boolean` | `compiler.options.mode === 'development'` | If `true`, reports issues **after** Rspack's compilation is done. Thanks to that it doesn't block the compilation. Used only in the `watch` mode. |
97
- | `typescript` | `object` | `{}` | See [TypeScript options](#typescript-options). |
98
- | `issue` | `object` | `{}` | See [Issues options](#issues-options). |
99
- | `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' }`. |
100
- | `logger` | `{ log: function, error: function }` or `webpack-infrastructure` | `console` | Console-like object to print issues in `async` mode. |
101
- | `devServer` | `boolean` | `true` | If set to `false`, errors will not be reported to Dev Server and displayed in the error overlay. |
85
+ ## TypeScript 7+ support
102
86
 
103
- ### TypeScript options
87
+ [`typescript.tsgo`](#tsgo) uses the native checker included in TypeScript >= 7. It can reduce type-checking time on large projects.
104
88
 
105
- Options for the TypeScript checker (`typescript` option object).
89
+ When the configured or default installed `typescript` package is major version 7 or higher, the plugin enables `typescript.tsgo` automatically and runs the native executable from that package.
106
90
 
107
- | Name | Type | Default value | Description |
108
- | ------------------- | ------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
109
- | `memoryLimit` | `number` | `8192` | Memory limit for the checker process in MB. If the process exits with the allocation failed error, try to increase this number. |
110
- | `configFile` | `string` | `'tsconfig.json'` | Path to the `tsconfig.json` file (path relative to the `compiler.options.context` or absolute path) |
111
- | `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`. |
112
- | `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 `ts-checker-rspack-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`. |
113
- | `build` | `boolean` | `false` | The equivalent of the `--build` flag for the `tsc` command. |
114
- | `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`). |
115
- | `diagnosticOptions` | `object` | `{ syntactic: false, semantic: true, declaration: false, global: false }` | Settings to select which diagnostics do we want to perform. |
116
- | `profile` | `boolean` | `false` | Measures and prints timings related to the TypeScript performance. |
117
- | `resolveRoot` | `string` | `undefined` | Root used to resolve the default TypeScript package. Relative paths are resolved from `compiler.options.context`. Only used when `typescriptPath` is not set. |
118
- | `typescriptPath` | `string` | `require.resolve('typescript/package.json')` for TypeScript 7+, `require.resolve('@typescript/native-preview/package.json')` when `tsgo` falls back to preview, otherwise `require.resolve('typescript')` | Custom TypeScript path. In `tsgo` mode, use an absolute path to `typescript/package.json` or `@typescript/native-preview/package.json`. |
119
- | `tsgo` | `boolean` | `true` when TypeScript 7+ is detected, otherwise `false` | Enables experimental TypeScript Go support. The plugin runs the TypeScript Go checker binary in a child process. |
91
+ The default package detection uses [`typescript.resolveRoot`](#resolveroot) when it is set.
120
92
 
121
- ### TypeScript Go support
93
+ When `typescript.tsgo: true` is set without a custom [`typescriptPath`](#typescriptpath) and TypeScript 7+ is not installed, the plugin falls back to `@typescript/native-preview` for compatibility.
122
94
 
123
- `typescript.tsgo` can reduce type-checking time by about 5-10x, especially on large projects, by using the Go implementation of TypeScript. It enables experimental [typescript-go](https://github.com/microsoft/typescript-go) support through TypeScript 7+ or [`@typescript/native-preview`](https://www.npmjs.com/package/@typescript/native-preview).
95
+ If the checker output cannot be parsed safely, the raw output is printed and the build fails when it exits with errors.
124
96
 
125
- When the configured or default installed `typescript` package is major version 7 or higher, the plugin enables `typescript.tsgo` automatically and runs the TypeScript Go executable from that package. The default package detection uses `typescript.resolveRoot` when it is set. When `typescript.tsgo: true` is set without a custom `typescriptPath` and TypeScript 7+ is not installed, the plugin falls back to `@typescript/native-preview`.
97
+ Supported options include:
126
98
 
127
- In this mode, the plugin runs the TypeScript Go binary in a child process, parses its diagnostics, and reports them through the existing issue formatter when possible. If the output cannot be parsed safely, the raw output is printed and the build fails when it exits with errors.
99
+ - [`typescript.configFile`](#configfile)
100
+ - [`typescript.context`](#context)
101
+ - [`typescript.build`](#build)
102
+ - `typescript.resolveRoot`
103
+ - `typescript.typescriptPath`
104
+ - [`async`](#async)
105
+ - [`logger`](#logger)
128
106
 
129
- Supported options include `typescript.configFile`, `typescript.context`, `typescript.build`, `typescript.resolveRoot`, `typescript.typescriptPath`, `async`, and `logger`. It also supports `tsconfig.json` compiler options used by `tsgo`, including `incremental` and `composite`.
107
+ It also supports `tsconfig.json` compiler options used by `tsgo`,
108
+ including `incremental` and `composite`.
130
109
 
131
- Install TypeScript 7.0 RC to enable `tsgo` automatically:
110
+ Install TypeScript >= 7.0.0 to enable `tsgo` automatically:
132
111
 
133
112
  ```sh
134
113
  # with npm
135
- npm install -D typescript@rc
114
+ npm install -D typescript@latest
136
115
 
137
116
  # with yarn
138
- yarn add -D typescript@rc
117
+ yarn add -D typescript@latest
139
118
 
140
119
  # with pnpm
141
- pnpm add -D typescript@rc
120
+ pnpm add -D typescript@latest
142
121
  ```
143
122
 
144
- Or install `@typescript/native-preview` and enable `tsgo` explicitly:
123
+ > The `@typescript/native-preview` path is kept only for compatibility. New setups should use TypeScript 7+ from the standard `typescript` package.
145
124
 
146
- ```sh
147
- # with npm
148
- npm install -D @typescript/native-preview
125
+ Limitations:
149
126
 
150
- # with yarn
151
- yarn add -D @typescript/native-preview
127
+ - [`issue.include`](#include), [`issue.exclude`](#exclude), and [`issue.defaultSeverity`](#defaultseverity) only apply to diagnostics whose checker output can be matched by `file`, `line`, `column`, `code`, and `message`.
128
+ - [`typescript.configOverwrite`](#configoverwrite), [`typescript.diagnosticOptions`](#diagnosticoptions), and [`typescript.profile`](#profile) are not supported.
129
+ - TypeScript API-based formatting or filesystem output rewrites are not supported.
130
+ - Plugin-controlled declaration or reference emit modes such as `write-dts` and `write-references` are not supported. `tsgo` always runs with `--noEmit`.
131
+ - This integration may change when TypeScript provides a stable JavaScript API for the native checker.
152
132
 
153
- # with pnpm
154
- pnpm add -D @typescript/native-preview
133
+ ## Options
134
+
135
+ ### async
136
+
137
+ Controls whether type checking blocks watch mode compilation.
138
+
139
+ - When `true`, issues are reported after Rspack finishes compiling.
140
+ - When `false`, issues are added to the compilation before it finishes.
141
+
142
+ Used only in the watch mode.
143
+
144
+ - **Type:** `boolean`
145
+ - **Default:** `compiler.options.mode === 'development'`
146
+ - **Example:**
147
+
148
+ Block watch mode compilation until type checking finishes:
149
+
150
+ ```js
151
+ new TsCheckerRspackPlugin({
152
+ async: false,
153
+ });
155
154
  ```
156
155
 
156
+ ### typescript
157
+
158
+ Options passed to the TypeScript checker.
159
+
160
+ See [TypeScript options](#typescript-options).
161
+
162
+ - **Type:** `object`
163
+ - **Default:** `{}`
164
+ - **Example:**
165
+
166
+ Use a separate TypeScript config for type checking:
167
+
157
168
  ```js
158
169
  new TsCheckerRspackPlugin({
159
170
  typescript: {
160
- tsgo: true,
171
+ configFile: './tsconfig.build.json',
161
172
  },
162
173
  });
163
174
  ```
164
175
 
165
- > The `@typescript/native-preview` usage is deprecated and kept only for compatibility. We recommend installing `typescript@rc` to use `tsgo`.
176
+ ### issue
166
177
 
167
- Limitations:
178
+ Options for filtering emitted issues and overriding their severity.
168
179
 
169
- - `issue.include`, `issue.exclude`, and `issue.defaultSeverity` only apply to diagnostics whose `tsgo` output can be matched by `file`, `line`, `column`, `code`, and `message`.
170
- - `typescript.configOverwrite`, `typescript.diagnosticOptions`, and `typescript.profile` are not supported.
171
- - TypeScript API-based formatting or filesystem output rewrites are not supported.
172
- - Plugin-controlled declaration or reference emit modes such as `write-dts` and `write-references` are not supported; `tsgo` always runs with `--noEmit`.
173
- - This integration may change when TypeScript provides a stable JavaScript API for `tsgo`.
180
+ See [Issues options](#issues-options).
181
+
182
+ - **Type:** `object`
183
+ - **Default:** `{}`
184
+ - **Example:**
185
+
186
+ Only report issues from the `src` directory:
187
+
188
+ ```js
189
+ new TsCheckerRspackPlugin({
190
+ issue: {
191
+ include: [{ file: '**/src/**/*' }],
192
+ },
193
+ });
194
+ ```
195
+
196
+ ### formatter
197
+
198
+ Controls how issues are formatted in terminal output and Rspack errors.
199
+
200
+ Available formatters are `basic`, `codeframe` and a custom `function`.
201
+
202
+ - **Type:** `string` or `object` or `function`
203
+ - **Default:** `codeframe`
204
+ - **Example:**
205
+
206
+ Use the basic formatter:
207
+
208
+ ```js
209
+ new TsCheckerRspackPlugin({
210
+ formatter: 'basic',
211
+ });
212
+ ```
213
+
214
+ To [configure](https://babeljs.io/docs/en/babel-code-frame#options) `codeframe` formatter,
215
+ pass: `{ type: 'codeframe', options: { <codeframe options> } }`.
216
+
217
+ To use absolute file path, pass: `{ type: 'codeframe', pathType: 'absolute' }`.
218
+
219
+ ### logger
220
+
221
+ Console-like object used to print async-mode progress, statistics and formatted issues.
222
+
223
+ Use `webpack-infrastructure` to print through Rspack's infrastructure logger.
224
+
225
+ - **Type:** `{ log: function, error: function }` or `webpack-infrastructure`
226
+ - **Default:** `console`
227
+ - **Example:**
228
+
229
+ Use a custom logger object:
230
+
231
+ ```js
232
+ new TsCheckerRspackPlugin({
233
+ logger: {
234
+ log(message) {
235
+ console.log(message);
236
+ },
237
+ error(message) {
238
+ console.error(message);
239
+ },
240
+ },
241
+ });
242
+ ```
243
+
244
+ ### devServer
245
+
246
+ Controls whether async mode issues are sent to the dev server error overlay.
247
+
248
+ When `false`, issues are still logged but are not injected into the overlay.
249
+
250
+ - **Type:** `boolean`
251
+ - **Default:** `true`
252
+ - **Example:**
253
+
254
+ Disable the dev server error overlay integration:
255
+
256
+ ```js
257
+ new TsCheckerRspackPlugin({
258
+ devServer: false,
259
+ });
260
+ ```
261
+
262
+ ## TypeScript options
263
+
264
+ Options for the TypeScript checker (`typescript` option object).
265
+
266
+ ### memoryLimit
267
+
268
+ Memory limit for the checker worker process in MB.
269
+
270
+ If the process exits with an allocation error, try to increase this number.
271
+
272
+ - **Type:** `number`
273
+ - **Default:** `8192`
274
+ - **Example:**
275
+
276
+ Limit the checker process to 4096 MB:
277
+
278
+ ```js
279
+ new TsCheckerRspackPlugin({
280
+ typescript: {
281
+ memoryLimit: 4096,
282
+ },
283
+ });
284
+ ```
285
+
286
+ ### configFile
287
+
288
+ Path to the TypeScript config file.
289
+
290
+ Relative paths are resolved from `compiler.options.context`.
291
+
292
+ - **Type:** `string`
293
+ - **Default:** `'tsconfig.json'`
294
+ - **Example:**
295
+
296
+ Use a non-default TypeScript config file:
297
+
298
+ ```js
299
+ new TsCheckerRspackPlugin({
300
+ typescript: {
301
+ configFile: './tsconfig.build.json',
302
+ },
303
+ });
304
+ ```
305
+
306
+ ### configOverwrite
307
+
308
+ Configuration merged into the loaded `tsconfig.json`.
309
+
310
+ The checker applies implicit compiler option overrides first, then merges this object.
311
+
312
+ Supported fields are: `extends`, `compilerOptions`, `include`, `exclude`, `files`, and `references`.
313
+
314
+ - **Type:** `object`
315
+ - **Default:** `{}`
316
+ - **Example:**
317
+
318
+ Check only files under `src`:
319
+
320
+ ```js
321
+ new TsCheckerRspackPlugin({
322
+ typescript: {
323
+ configOverwrite: {
324
+ include: ['src'],
325
+ },
326
+ },
327
+ });
328
+ ```
174
329
 
175
- ### Issues options
330
+ ### context
331
+
332
+ Base path used when parsing files, include, exclude and references from the TypeScript config.
333
+
334
+ Useful if you want to keep your `tsconfig.json` in an external package.
335
+
336
+ Keep in mind that **not** having a `tsconfig.json` in your project root can cause different behavior between `ts-checker-rspack-plugin` and `tsc`.
337
+
338
+ 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`.
339
+
340
+ - **Type:** `string`
341
+ - **Default:** `dirname(configuration.configFile)`
342
+ - **Example:**
343
+
344
+ Resolve config file entries from the current package root:
345
+
346
+ ```js
347
+ new TsCheckerRspackPlugin({
348
+ typescript: {
349
+ configFile: './config/tsconfig.json',
350
+ context: import.meta.dirname,
351
+ },
352
+ });
353
+ ```
354
+
355
+ ### build
356
+
357
+ Runs TypeScript in project build mode, equivalent to `tsc --build`.
358
+
359
+ - **Type:** `boolean`
360
+ - **Default:** `false`
361
+ - **Example:**
362
+
363
+ Enable TypeScript build mode:
364
+
365
+ ```js
366
+ new TsCheckerRspackPlugin({
367
+ typescript: {
368
+ build: true,
369
+ },
370
+ });
371
+ ```
372
+
373
+ ### mode
374
+
375
+ Controls which TypeScript output artifacts the plugin is allowed to write to disk:
376
+
377
+ - `readonly` if you don't want to write anything on the disk
378
+ - `write-dts` to write only `.d.ts` files
379
+ - `write-tsbuildinfo` to write only `.tsbuildinfo` files
380
+ - `write-references` to write both `.js` and `.d.ts` files of project references
381
+
382
+ `write-tsbuildinfo` and `write-references` require `build: true`.
383
+
384
+ - **Type:** `'readonly'` or `'write-dts'` or `'write-tsbuildinfo'` or `'write-references'`
385
+ - **Default:** `build === true ? 'write-tsbuildinfo' : 'readonly'`
386
+ - **Example:**
387
+
388
+ Write only `.tsbuildinfo` files in build mode:
389
+
390
+ ```js
391
+ new TsCheckerRspackPlugin({
392
+ typescript: {
393
+ build: true,
394
+ mode: 'write-tsbuildinfo',
395
+ },
396
+ });
397
+ ```
398
+
399
+ ### diagnosticOptions
400
+
401
+ Selects which TypeScript diagnostic categories the checker collects.
402
+
403
+ - **Type:** `object`
404
+ - **Default:** `{ syntactic: false, semantic: true, declaration: false, global: false }`
405
+ - **Example:**
406
+
407
+ Enable syntactic diagnostics in addition to semantic diagnostics:
408
+
409
+ ```js
410
+ new TsCheckerRspackPlugin({
411
+ typescript: {
412
+ diagnosticOptions: {
413
+ syntactic: true,
414
+ semantic: true,
415
+ },
416
+ },
417
+ });
418
+ ```
419
+
420
+ ### profile
421
+
422
+ Enables TypeScript performance measurements and prints them as a table.
423
+
424
+ - **Type:** `boolean`
425
+ - **Default:** `false`
426
+ - **Example:**
427
+
428
+ Print TypeScript performance timings:
429
+
430
+ ```js
431
+ new TsCheckerRspackPlugin({
432
+ typescript: {
433
+ profile: true,
434
+ },
435
+ });
436
+ ```
437
+
438
+ ### resolveRoot
439
+
440
+ Directory used to resolve the default TypeScript package.
441
+
442
+ Relative paths are resolved from `compiler.options.context`. Only used when `typescriptPath` is not set.
443
+
444
+ - **Type:** `string`
445
+ - **Default:** `undefined`
446
+ - **Example:**
447
+
448
+ Resolve TypeScript from the current package root:
449
+
450
+ ```js
451
+ new TsCheckerRspackPlugin({
452
+ typescript: {
453
+ resolveRoot: import.meta.dirname,
454
+ },
455
+ });
456
+ ```
457
+
458
+ ### typescriptPath
459
+
460
+ Custom TypeScript path.
461
+
462
+ - Without `tsgo`, point to the TypeScript package entry.
463
+ - In `tsgo` mode, use an absolute path to the TypeScript 7+ `package.json`
464
+
465
+ - **Type:** `string`
466
+ - **Default:**
467
+ - `require.resolve('typescript/package.json')` for TypeScript 7+
468
+ - otherwise `require.resolve('typescript')`
469
+ - **Example:**
470
+
471
+ Use the installed `typescript` package with the JavaScript checker:
472
+
473
+ ```js
474
+ new TsCheckerRspackPlugin({
475
+ typescript: {
476
+ tsgo: false,
477
+ typescriptPath: require.resolve('typescript'),
478
+ },
479
+ });
480
+ ```
481
+
482
+ ### tsgo
483
+
484
+ Enables the native TypeScript checker.
485
+
486
+ When unset, the plugin enables it automatically when TypeScript 7+ is detected.
487
+
488
+ - **Type:** `boolean`
489
+ - **Default:** `true` when TypeScript 7+ is detected, otherwise `false`
490
+ - **Example:**
491
+
492
+ Force the native checker on:
493
+
494
+ ```js
495
+ new TsCheckerRspackPlugin({
496
+ typescript: {
497
+ tsgo: true,
498
+ },
499
+ });
500
+ ```
501
+
502
+ ## Issues options
176
503
 
177
504
  Options for the issues filtering (`issue` option object).
178
505
 
@@ -197,41 +524,60 @@ type IssuePredicate = (issue: Issue) => boolean;
197
524
  type IssuePredicateOption = IssuePredicate | IssueMatch | (IssuePredicate | IssueMatch)[];
198
525
  ```
199
526
 
200
- | Name | Type | Default value | Description |
201
- | ----------------- | -------------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
202
- | `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. |
203
- | `exclude` | `IssueFilter` | `undefined` | Same as `include` but issues that match this predicate will be excluded. |
204
- | `defaultSeverity` | `'auto' \| 'warning' \| 'error'` | `'auto'` | Controls how the plugin assigns the severity of emitted issues. |
527
+ ### include
205
528
 
206
- `defaultSeverity` behavior:
529
+ Limits reported issues to those matching the provided issue match object or predicate.
207
530
 
208
- - `auto`: Uses the default mapping based on the TypeScript diagnostic category (`Error` → `error`, `Warning` → `warning`).
209
- - `warning`: Forces all issues to be emitted as warnings.
210
- - `error`: Forces all issues to be emitted as errors.
531
+ - If `object`, defines issue properties that should be [matched](src/issue/issue-match.ts).
532
+ - If `function`, acts as a predicate where `issue` is an argument.
211
533
 
212
- - **Example**:
534
+ - **Type:** `IssueFilter`
535
+ - **Default:** `undefined`
536
+ - **Example:**
213
537
 
214
- Include issues from the `src` directory, exclude issues from `.spec.ts` files:
538
+ Only report issues from the `src` directory:
215
539
 
216
540
  ```js
217
541
  new TsCheckerRspackPlugin({
218
542
  issue: {
219
543
  include: [{ file: '**/src/**/*' }],
220
- exclude: [{ file: '**/*.spec.ts' }],
221
544
  },
222
545
  });
223
546
  ```
224
547
 
225
- Exclude files under `/node_modules/` using `file:`:
548
+ ### exclude
549
+
550
+ Excludes issues matching the provided issue match object or predicate.
551
+
552
+ - **Type:** `IssueFilter`
553
+ - **Default:** `undefined`
554
+ - **Example:**
555
+
556
+ Exclude issues from `.spec.ts` files:
226
557
 
227
558
  ```js
228
559
  new TsCheckerRspackPlugin({
229
560
  issue: {
230
- exclude: [({ file = '' }) => /[\\/]some-folder[\\/]/.test(file)],
561
+ exclude: [{ file: '**/*.spec.ts' }],
231
562
  },
232
563
  });
233
564
  ```
234
565
 
566
+ ### defaultSeverity
567
+
568
+ Controls how the plugin assigns the severity of emitted issues.
569
+
570
+ - **Type:** `'auto' | 'warning' | 'error'`
571
+ - **Default:** `'auto'`
572
+
573
+ `defaultSeverity` behavior:
574
+
575
+ - `auto`: Uses the default mapping based on the TypeScript diagnostic category (`Error` → `error`, `Warning` → `warning`).
576
+ - `warning`: Forces all issues to be emitted as warnings.
577
+ - `error`: Forces all issues to be emitted as errors.
578
+
579
+ - **Example:**
580
+
235
581
  Force all issues to be emitted as warnings and do not break the build:
236
582
 
237
583
  ```js
@@ -289,8 +635,9 @@ module.exports = {
289
635
 
290
636
  ## Profiling types resolution
291
637
 
292
- When using TypeScript 4.3.0 or newer you can profile long type checks by
293
- setting "generateTrace" compiler option. This is an instruction from [microsoft/TypeScript#40063](https://github.com/microsoft/TypeScript/pull/40063):
638
+ When using TypeScript 4.3.0 or newer you can profile long type checks by setting "generateTrace" compiler option.
639
+
640
+ This is an instruction from [microsoft/TypeScript#40063](https://github.com/microsoft/TypeScript/pull/40063):
294
641
 
295
642
  1. Set "generateTrace": "{folderName}" in your `tsconfig.json` (under `compilerOptions`)
296
643
  2. Look in the resulting folder. If you used build mode, there will be a `legend.json` telling you what went where.
@@ -360,6 +707,14 @@ new TsCheckerRspackPlugin({
360
707
  });
361
708
  ```
362
709
 
710
+ ## Credits
711
+
712
+ This plugin is forked from [TypeStrong/fork-ts-checker-webpack-plugin](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin),
713
+ which is created by [Piotr Oleś](https://github.com/piotr-oles).
714
+ See the original project's [LICENSE](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/blob/main/LICENSE).
715
+
716
+ Big thanks to `fork-ts-checker-webpack-plugin` creators and contributors for their great work. ❤️
717
+
363
718
  ## License
364
719
 
365
720
  MIT License
package/lib/index.js CHANGED
@@ -3677,7 +3677,8 @@ var __webpack_exports__ = {};
3677
3677
  register: (tap)=>{
3678
3678
  if ([
3679
3679
  'webpack-dev-server',
3680
- 'rsbuild-dev-server'
3680
+ 'rsbuild-dev-server',
3681
+ 'rspack-dev-server'
3681
3682
  ].includes(tap.name) && 'sync' === tap.type && config.devServer) {
3682
3683
  debug('Intercepting dev-server tap.');
3683
3684
  state.DevServerDoneTap = tap;
@@ -3726,7 +3727,7 @@ var __webpack_exports__ = {};
3726
3727
  const TYPESCRIPT_PREVIEW_PACKAGE_JSON = `${TYPESCRIPT_PREVIEW_PACKAGE}/package.json`;
3727
3728
  function resolveTypeScriptGoPackageJsonPath(config) {
3728
3729
  if (!external_node_path_default().isAbsolute(config.typescriptPath) || 'package.json' !== external_node_path_default().basename(config.typescriptPath)) throw new Error("The typescriptPath option must be an absolute path to a package.json file when tsgo is enabled.");
3729
- if (!config.tsgoPackage) throw new Error(`The typescriptPath option must point to "${TYPESCRIPT_PREVIEW_PACKAGE_JSON}" or "${TYPESCRIPT_PACKAGE}@rc".`);
3730
+ if (!config.tsgoPackage) throw new Error(`The typescriptPath option must point to "${TYPESCRIPT_PREVIEW_PACKAGE_JSON}" or "${TYPESCRIPT_PACKAGE}@>=7".`);
3730
3731
  return config.typescriptPath;
3731
3732
  }
3732
3733
  async function resolveTypeScriptGoNativeExecutablePath(packageJsonPath, packageName) {
@@ -3734,7 +3735,7 @@ var __webpack_exports__ = {};
3734
3735
  const getExePathUrl = (0, external_node_url_namespaceObject.pathToFileURL)(getExePathPath).href;
3735
3736
  const getExePathModule = await import(getExePathUrl);
3736
3737
  const getExePath = getExePathModule.default || getExePathModule.getExePath;
3737
- if ('function' != typeof getExePath) throw new Error(`Cannot resolve the typescript-go executable from "${packageName}".`);
3738
+ if ('function' != typeof getExePath) throw new Error(`Cannot resolve the native TypeScript executable from "${packageName}".`);
3738
3739
  const executablePath = getExePath();
3739
3740
  if ('string' != typeof executablePath || !external_node_fs_default().existsSync(executablePath)) throw new Error('Executable not found');
3740
3741
  return executablePath;
@@ -3887,7 +3888,7 @@ var __webpack_exports__ = {};
3887
3888
  callback();
3888
3889
  };
3889
3890
  const abort = ()=>{
3890
- childProcess.kill('SIGTERM');
3891
+ childProcess.kill('SIGKILL');
3891
3892
  finish(()=>reject(new AbortError()));
3892
3893
  };
3893
3894
  signal?.addEventListener('abort', abort, {
@@ -4184,11 +4185,10 @@ var __webpack_exports__ = {};
4184
4185
  }
4185
4186
  function createTypeScriptGoSupportError(config, error) {
4186
4187
  const message = [
4187
- `When you enable TsCheckerRspackPlugin with \`typescript.tsgo\`, you must install \`${TYPESCRIPT_PACKAGE}@rc\` or \`${TYPESCRIPT_PREVIEW_PACKAGE}\` package.`
4188
+ `\`typescript.tsgo\` requires \`${TYPESCRIPT_PACKAGE}\` >= 7.0.0 or legacy \`${TYPESCRIPT_PREVIEW_PACKAGE}\`.`
4188
4189
  ];
4189
- if (!isDefaultTypeScriptGoPath(config.typescriptPath)) message.push(`If you set \`typescript.typescriptPath\`, it must be an absolute path to \`${TYPESCRIPT_PACKAGE_JSON}\` from \`${TYPESCRIPT_PACKAGE}@rc\` or \`${TYPESCRIPT_PREVIEW_PACKAGE_JSON}\`.`);
4190
- if (error instanceof Error && error.message) message.push(`Failed to resolve the tsgo executable: ${error.message}`);
4191
- message.push(`You can install it with \`npm add ${TYPESCRIPT_PACKAGE}@rc -D\` or \`npm add ${TYPESCRIPT_PREVIEW_PACKAGE} -D\`.`);
4190
+ if (!isDefaultTypeScriptGoPath(config.typescriptPath)) message.push(`\`typescript.typescriptPath\` must be an absolute path to \`${TYPESCRIPT_PACKAGE_JSON}\` or \`${TYPESCRIPT_PREVIEW_PACKAGE_JSON}\`.`);
4191
+ if (error instanceof Error && error.message) message.push(`Failed to resolve the native TypeScript executable: ${error.message}`);
4192
4192
  return new Error(message.join(external_node_os_default().EOL));
4193
4193
  }
4194
4194
  function assertTypeScriptGoSupport(config) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-checker-rspack-plugin",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "description": "Runs typescript type checker and linter on separate process.",
5
5
  "keywords": [
6
6
  "rspack",
@@ -25,26 +25,27 @@
25
25
  "dependencies": {
26
26
  "@rspack/lite-tapable": "^1.1.2",
27
27
  "chokidar": "^3.6.0",
28
- "memfs": "^4.57.7",
28
+ "memfs": "^4.64.0",
29
29
  "picocolors": "^1.1.1"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@babel/code-frame": "^7.29.7",
33
- "@rslib/core": "^0.22.1",
34
- "@rslint/core": "^0.6.1",
35
- "@rspack/core": "^2.0.8",
36
- "@rstest/core": "^0.10.4",
33
+ "@rslib/core": "^0.23.2",
34
+ "@rslint/core": "^0.7.0",
35
+ "@rspack/core": "^2.1.4",
36
+ "@rstackjs/test-utils": "^0.2.0",
37
+ "@rstest/core": "^0.11.2",
37
38
  "@types/babel__code-frame": "^7.27.0",
38
39
  "@types/is-glob": "^4.0.4",
39
40
  "@types/mock-fs": "^4.13.4",
40
- "@types/node": "^24.13.2",
41
- "@typescript/native-preview": "7.0.0-dev.20260613.1",
41
+ "@types/node": "^24.13.3",
42
+ "@typescript/native-preview": "7.0.0-dev.20260707.2",
42
43
  "cross-env": "^10.1.0",
43
44
  "husky": "^9.1.7",
44
45
  "is-glob": "^4.0.3",
45
46
  "minimatch": "^10.2.5",
46
47
  "mock-fs": "^5.5.0",
47
- "prettier": "^3.8.4",
48
+ "prettier": "^3.9.5",
48
49
  "strip-ansi": "^7.2.0",
49
50
  "typescript": "^6.0.3"
50
51
  },