ts-checker-rspack-plugin 1.1.1 → 1.1.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.
package/README.md
CHANGED
|
@@ -42,11 +42,10 @@ pnpm add -D ts-checker-rspack-plugin
|
|
|
42
42
|
The minimal Rspack config with [builtin:swc-loader](https://rspack.dev/guide/features/builtin-swc-loader).
|
|
43
43
|
|
|
44
44
|
```js
|
|
45
|
-
// rspack.config.
|
|
46
|
-
|
|
45
|
+
// rspack.config.mjs
|
|
46
|
+
import { TsCheckerRspackPlugin } from 'ts-checker-rspack-plugin';
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
context: __dirname, // to automatically find tsconfig.json
|
|
48
|
+
export default {
|
|
50
49
|
entry: './src/index.ts',
|
|
51
50
|
resolve: {
|
|
52
51
|
extensions: ['.ts', '.tsx', '.js'],
|
|
@@ -67,12 +66,17 @@ module.exports = {
|
|
|
67
66
|
],
|
|
68
67
|
},
|
|
69
68
|
plugins: [new TsCheckerRspackPlugin()],
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
};
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
If you are using CommonJS:
|
|
73
|
+
|
|
74
|
+
```js
|
|
75
|
+
// rspack.config.js
|
|
76
|
+
const { TsCheckerRspackPlugin } = require('ts-checker-rspack-plugin');
|
|
77
|
+
|
|
78
|
+
module.exports = {
|
|
79
|
+
plugins: [new TsCheckerRspackPlugin()],
|
|
76
80
|
};
|
|
77
81
|
```
|
|
78
82
|
|
|
@@ -94,7 +98,7 @@ Rspack's modules resolution**. It means that you have to setup `tsconfig.json` c
|
|
|
94
98
|
| `issue` | `object` | `{}` | See [Issues options](#issues-options). |
|
|
95
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' }`. |
|
|
96
100
|
| `logger` | `{ log: function, error: function }` or `webpack-infrastructure` | `console` | Console-like object to print issues in `async` mode. |
|
|
97
|
-
| `devServer` | `boolean` | `true` | If set to `false`, errors will not be reported to Dev Server and displayed in the error overlay.
|
|
101
|
+
| `devServer` | `boolean` | `true` | If set to `false`, errors will not be reported to Dev Server and displayed in the error overlay. |
|
|
98
102
|
|
|
99
103
|
### TypeScript options
|
|
100
104
|
|
|
@@ -56,7 +56,7 @@ function tapDoneToAsyncGetIssues(compiler, config, state) {
|
|
|
56
56
|
config.logger.log((0, stats_formatter_1.statsFormatter)(issues, stats));
|
|
57
57
|
}
|
|
58
58
|
else {
|
|
59
|
-
config.logger.log(picocolors_1.default.green('No errors found.'));
|
|
59
|
+
config.logger.log(picocolors_1.default.green('No TypeScript errors found.'));
|
|
60
60
|
}
|
|
61
61
|
// report issues to dev-server (overlay), if it's listening
|
|
62
62
|
// skip reporting if there are no issues, to avoid an extra hot reload
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Compiler } from '@rspack/core';
|
|
2
2
|
import type { TsCheckerRspackPluginState } from '../plugin-state';
|
|
3
3
|
import type { WatchFileSystem } from './watch-file-system';
|
|
4
|
+
export declare function createIsIgnored(ignored: string | RegExp | (string | RegExp)[] | undefined, excluded: string[]): (path: string) => boolean;
|
|
4
5
|
declare class InclusiveNodeWatchFileSystem implements WatchFileSystem {
|
|
5
6
|
private watchFileSystem;
|
|
6
7
|
private compiler;
|
|
@@ -3,16 +3,33 @@ 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
|
-
exports.InclusiveNodeWatchFileSystem = void 0;
|
|
6
|
+
exports.InclusiveNodeWatchFileSystem = exports.createIsIgnored = void 0;
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
const chokidar_1 = __importDefault(require("chokidar"));
|
|
9
9
|
const minimatch_1 = require("minimatch");
|
|
10
|
+
const is_glob_1 = __importDefault(require("is-glob"));
|
|
10
11
|
const files_change_1 = require("../files-change");
|
|
11
12
|
const infrastructure_logger_1 = require("../infrastructure-logger");
|
|
12
13
|
const is_inside_another_path_1 = require("../utils/path/is-inside-another-path");
|
|
13
14
|
const BUILTIN_IGNORED_DIRS = ['.git'];
|
|
14
15
|
function createIsIgnored(ignored, excluded) {
|
|
15
16
|
const ignoredPatterns = ignored ? (Array.isArray(ignored) ? ignored : [ignored]) : [];
|
|
17
|
+
const filteredExcluded = excluded.filter((pattern) => {
|
|
18
|
+
// Use `minimatch` to check if the path is a glob pattern.
|
|
19
|
+
if ((0, is_glob_1.default)(pattern)) {
|
|
20
|
+
// Append `/**` to the pattern to align minimatch's behavior
|
|
21
|
+
// with the `exclude` option in tsconfig.json.
|
|
22
|
+
const shouldAppendStar = pattern.includes('**') && !pattern.endsWith('*');
|
|
23
|
+
if (shouldAppendStar) {
|
|
24
|
+
ignoredPatterns.push(pattern.endsWith('/') ? `${pattern}**` : `${pattern}/**`);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
ignoredPatterns.push(pattern);
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
return true;
|
|
32
|
+
});
|
|
16
33
|
const ignoredFunctions = ignoredPatterns.map((pattern) => {
|
|
17
34
|
// ensure patterns are valid - see https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues/594
|
|
18
35
|
if (typeof pattern === 'string') {
|
|
@@ -26,12 +43,13 @@ function createIsIgnored(ignored, excluded) {
|
|
|
26
43
|
return () => false;
|
|
27
44
|
}
|
|
28
45
|
});
|
|
29
|
-
ignoredFunctions.push((path) =>
|
|
46
|
+
ignoredFunctions.push((path) => filteredExcluded.some((excludedPath) => (0, is_inside_another_path_1.isInsideAnotherPath)(excludedPath, path)));
|
|
30
47
|
ignoredFunctions.push((path) => BUILTIN_IGNORED_DIRS.some((ignoredDir) => path.includes(`/${ignoredDir}/`) || path.includes(`\\${ignoredDir}\\`)));
|
|
31
48
|
return function isIgnored(path) {
|
|
32
49
|
return ignoredFunctions.some((ignoredFunction) => ignoredFunction(path));
|
|
33
50
|
};
|
|
34
51
|
}
|
|
52
|
+
exports.createIsIgnored = createIsIgnored;
|
|
35
53
|
class InclusiveNodeWatchFileSystem {
|
|
36
54
|
get watcher() {
|
|
37
55
|
return this.watchFileSystem.watcher || this.watchFileSystem.wfs?.watcher;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-checker-rspack-plugin",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Runs typescript type checker and linter on separate process.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rspack",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"@babel/code-frame": "^7.16.7",
|
|
37
37
|
"@rspack/lite-tapable": "^1.0.0",
|
|
38
38
|
"chokidar": "^3.5.3",
|
|
39
|
+
"is-glob": "^4.0.3",
|
|
39
40
|
"memfs": "^4.14.0",
|
|
40
41
|
"minimatch": "^9.0.5",
|
|
41
42
|
"picocolors": "^1.1.1"
|
|
@@ -53,6 +54,7 @@
|
|
|
53
54
|
"@jest/console": "^27.0.0",
|
|
54
55
|
"@rspack/core": "^1.1.3",
|
|
55
56
|
"@types/babel__code-frame": "^7.0.3",
|
|
57
|
+
"@types/is-glob": "^4.0.4",
|
|
56
58
|
"@types/jest": "^27.4.0",
|
|
57
59
|
"@types/mock-fs": "^4.13.1",
|
|
58
60
|
"@types/node": "^16.4.13",
|