ts-checker-rspack-plugin 1.0.0-beta.1 → 1.0.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.
- package/README.md +26 -19
- package/lib/formatter/basic-formatter.js +2 -2
- package/lib/formatter/stats-formatter.js +3 -3
- package/lib/formatter/webpack-formatter.js +6 -6
- package/lib/hooks/tap-done-to-async-get-issues.js +4 -3
- package/lib/hooks/tap-error-to-log-message.js +3 -3
- package/lib/issue/issue-match.js +2 -2
- package/lib/issue/issue-webpack-error.d.ts +1 -2
- package/lib/issue/issue-webpack-error.js +1 -25
- package/lib/plugin.d.ts +0 -1
- package/lib/plugin.js +3 -2
- package/lib/typescript/type-script-support.js +0 -36
- package/lib/typescript/type-script-worker-config.js +1 -1
- package/lib/watch/inclusive-node-watch-file-system.js +2 -2
- package/package.json +8 -13
package/README.md
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ts-checker-rspack-plugin
|
|
2
2
|
|
|
3
3
|
Rspack plugin that runs TypeScript type checker on a separate process.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
<p>
|
|
6
|
+
<a href="https://npmjs.com/package/ts-checker-rspack-plugin">
|
|
7
|
+
<img src="https://img.shields.io/npm/v/ts-checker-rspack-plugin?style=flat-square&colorA=564341&colorB=EDED91" alt="npm version" />
|
|
8
|
+
</a>
|
|
9
|
+
<img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="license" />
|
|
10
|
+
<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
|
+
</p>
|
|
7
12
|
|
|
8
13
|
## Credits
|
|
9
14
|
|
|
@@ -17,9 +22,11 @@ Big thanks to `fork-ts-checker-webpack-plugin` creators and contributors for the
|
|
|
17
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) ✨
|
|
18
23
|
- Displays nice error messages with the [code frame](https://babeljs.io/docs/en/next/babel-code-frame.html) formatter 🌈
|
|
19
24
|
|
|
25
|
+
💡 For Rsbuild projects, use [@rsbuild/plugin-type-check](https://github.com/rspack-contrib/rsbuild-plugin-type-check) to get out-of-the-box experience.
|
|
26
|
+
|
|
20
27
|
## Installation
|
|
21
28
|
|
|
22
|
-
This plugin requires **Node.js >=
|
|
29
|
+
This plugin requires **Node.js >=16.0.0+**, **Rspack ^1.0.0**, **TypeScript ^3.8.0**
|
|
23
30
|
|
|
24
31
|
```sh
|
|
25
32
|
# with npm
|
|
@@ -32,7 +39,7 @@ yarn add -D ts-checker-rspack-plugin
|
|
|
32
39
|
pnpm add -D ts-checker-rspack-plugin
|
|
33
40
|
```
|
|
34
41
|
|
|
35
|
-
The minimal
|
|
42
|
+
The minimal Rspack config with [builtin:swc-loader](https://rspack.dev/guide/features/builtin-swc-loader).
|
|
36
43
|
|
|
37
44
|
```js
|
|
38
45
|
// rspack.config.js
|
|
@@ -48,11 +55,14 @@ module.exports = {
|
|
|
48
55
|
rules: [
|
|
49
56
|
{
|
|
50
57
|
test: /\.tsx?$/,
|
|
51
|
-
loader: '
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
loader: 'builtin:swc-loader',
|
|
59
|
+
options: {
|
|
60
|
+
jsc: {
|
|
61
|
+
parser: {
|
|
62
|
+
syntax: 'typescript',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
56
66
|
},
|
|
57
67
|
],
|
|
58
68
|
},
|
|
@@ -66,9 +76,6 @@ module.exports = {
|
|
|
66
76
|
};
|
|
67
77
|
```
|
|
68
78
|
|
|
69
|
-
> Examples how to configure it with [babel-loader](https://github.com/babel/babel-loader), [ts-loader](https://github.com/TypeStrong/ts-loader)
|
|
70
|
-
> and [Visual Studio Code](https://code.visualstudio.com/) are in the [**examples**](./examples) directory.
|
|
71
|
-
|
|
72
79
|
## Modules resolution
|
|
73
80
|
|
|
74
81
|
It's very important to be aware that **this plugin uses [TypeScript](https://github.com/Microsoft/TypeScript)'s, not
|
|
@@ -95,7 +102,7 @@ Options for the TypeScript checker (`typescript` option object).
|
|
|
95
102
|
|
|
96
103
|
| Name | Type | Default value | Description |
|
|
97
104
|
| ------------------- | ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
98
|
-
| `memoryLimit` | `number` | `
|
|
105
|
+
| `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. |
|
|
99
106
|
| `configFile` | `string` | `'tsconfig.json'` | Path to the `tsconfig.json` file (path relative to the `compiler.options.context` or absolute path) |
|
|
100
107
|
| `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`. |
|
|
101
108
|
| `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`. |
|
|
@@ -165,10 +172,10 @@ When we call this method with a [Rspack compiler instance](https://rspack.dev/ap
|
|
|
165
172
|
[tapable](https://github.com/webpack/tapable) hooks where you can pass in your callbacks.
|
|
166
173
|
|
|
167
174
|
```js
|
|
168
|
-
// ./src/
|
|
175
|
+
// ./src/rspack/MyRspackPlugin.js
|
|
169
176
|
const { TsCheckerRspackPlugin } = require('ts-checker-rspack-plugin');
|
|
170
177
|
|
|
171
|
-
class
|
|
178
|
+
class MyRspackPlugin {
|
|
172
179
|
apply(compiler) {
|
|
173
180
|
const hooks = TsCheckerRspackPlugin.getCompilerHooks(compiler);
|
|
174
181
|
|
|
@@ -181,15 +188,15 @@ class MyWebpackPlugin {
|
|
|
181
188
|
}
|
|
182
189
|
}
|
|
183
190
|
|
|
184
|
-
module.exports =
|
|
191
|
+
module.exports = MyRspackPlugin;
|
|
185
192
|
|
|
186
193
|
// rspack.config.js
|
|
187
194
|
const { TsCheckerRspackPlugin } = require('ts-checker-rspack-plugin');
|
|
188
|
-
const
|
|
195
|
+
const MyRspackPlugin = require('./src/rspack/MyRspackPlugin');
|
|
189
196
|
|
|
190
197
|
module.exports = {
|
|
191
198
|
/* ... */
|
|
192
|
-
plugins: [new TsCheckerRspackPlugin(), new
|
|
199
|
+
plugins: [new TsCheckerRspackPlugin(), new MyRspackPlugin()],
|
|
193
200
|
};
|
|
194
201
|
```
|
|
195
202
|
|
|
@@ -4,10 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createBasicFormatter = void 0;
|
|
7
|
-
const
|
|
7
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
8
8
|
function createBasicFormatter() {
|
|
9
9
|
return function basicFormatter(issue) {
|
|
10
|
-
return
|
|
10
|
+
return picocolors_1.default.gray(issue.code + ': ') + issue.message;
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
exports.createBasicFormatter = createBasicFormatter;
|
|
@@ -4,16 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.statsFormatter = void 0;
|
|
7
|
-
const
|
|
7
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
8
8
|
// mimics webpack's stats summary formatter
|
|
9
9
|
function statsFormatter(issues, stats) {
|
|
10
10
|
const errorsNumber = issues.filter((issue) => issue.severity === 'error').length;
|
|
11
11
|
const warningsNumber = issues.filter((issue) => issue.severity === 'warning').length;
|
|
12
12
|
const errorsFormatted = errorsNumber
|
|
13
|
-
?
|
|
13
|
+
? picocolors_1.default.bold(picocolors_1.default.red(`${errorsNumber} ${errorsNumber === 1 ? 'error' : 'errors'}`))
|
|
14
14
|
: '';
|
|
15
15
|
const warningsFormatted = warningsNumber
|
|
16
|
-
?
|
|
16
|
+
? picocolors_1.default.bold(picocolors_1.default.yellow(`${warningsNumber} ${warningsNumber === 1 ? 'warning' : 'warnings'}`))
|
|
17
17
|
: '';
|
|
18
18
|
const timeFormatted = stats.startTime ? Math.round(Date.now() - stats.startTime) : 0;
|
|
19
19
|
return [
|
|
@@ -6,26 +6,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.createWebpackFormatter = void 0;
|
|
7
7
|
const os_1 = __importDefault(require("os"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const
|
|
9
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
10
10
|
const issue_1 = require("../issue");
|
|
11
11
|
const forward_slash_1 = require("../utils/path/forward-slash");
|
|
12
12
|
const relative_to_context_1 = require("../utils/path/relative-to-context");
|
|
13
13
|
function createWebpackFormatter(formatter, pathType) {
|
|
14
14
|
// mimics webpack error formatter
|
|
15
15
|
return function webpackFormatter(issue) {
|
|
16
|
-
const color = issue.severity === 'warning' ?
|
|
16
|
+
const color = issue.severity === 'warning' ? picocolors_1.default.yellow : picocolors_1.default.red;
|
|
17
17
|
const severity = issue.severity.toUpperCase();
|
|
18
18
|
if (issue.file) {
|
|
19
|
-
let location =
|
|
19
|
+
let location = picocolors_1.default.bold(pathType === 'absolute'
|
|
20
20
|
? (0, forward_slash_1.forwardSlash)(path_1.default.resolve(issue.file))
|
|
21
21
|
: (0, relative_to_context_1.relativeToContext)(issue.file, process.cwd()));
|
|
22
22
|
if (issue.location) {
|
|
23
|
-
location += `:${
|
|
23
|
+
location += `:${picocolors_1.default.bold(picocolors_1.default.green((0, issue_1.formatIssueLocation)(issue.location)))}`;
|
|
24
24
|
}
|
|
25
|
-
return [`${color(severity)} in ${location}`, formatter(issue), ''].join(os_1.default.EOL);
|
|
25
|
+
return [`${picocolors_1.default.bold(color(severity))} in ${location}`, formatter(issue), ''].join(os_1.default.EOL);
|
|
26
26
|
}
|
|
27
27
|
else {
|
|
28
|
-
return [`${color(severity)} in ` + formatter(issue), ''].join(os_1.default.EOL);
|
|
28
|
+
return [`${picocolors_1.default.bold(color(severity))} in ` + formatter(issue), ''].join(os_1.default.EOL);
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
}
|
|
@@ -13,7 +13,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.tapDoneToAsyncGetIssues = void 0;
|
|
16
|
-
const
|
|
16
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
17
|
+
;
|
|
17
18
|
const stats_formatter_1 = require("../formatter/stats-formatter");
|
|
18
19
|
const webpack_formatter_1 = require("../formatter/webpack-formatter");
|
|
19
20
|
const infrastructure_logger_1 = require("../infrastructure-logger");
|
|
@@ -34,7 +35,7 @@ function tapDoneToAsyncGetIssues(compiler, config, state) {
|
|
|
34
35
|
try {
|
|
35
36
|
if (yield (0, is_pending_1.isPending)(issuesPromise)) {
|
|
36
37
|
hooks.waiting.call(stats.compilation);
|
|
37
|
-
config.logger.log(
|
|
38
|
+
config.logger.log(picocolors_1.default.cyan('Type-checking in progress...'));
|
|
38
39
|
}
|
|
39
40
|
else {
|
|
40
41
|
// wait 10ms to log issues after webpack stats
|
|
@@ -64,7 +65,7 @@ function tapDoneToAsyncGetIssues(compiler, config, state) {
|
|
|
64
65
|
config.logger.log((0, stats_formatter_1.statsFormatter)(issues, stats));
|
|
65
66
|
}
|
|
66
67
|
else {
|
|
67
|
-
config.logger.log(
|
|
68
|
+
config.logger.log(picocolors_1.default.green('No errors found.'));
|
|
68
69
|
}
|
|
69
70
|
// report issues to webpack-dev-server, if it's listening
|
|
70
71
|
// skip reporting if there are no issues, to avoid an extra hot reload
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.tapErrorToLogMessage = void 0;
|
|
7
|
-
const
|
|
7
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
8
8
|
const plugin_hooks_1 = require("../plugin-hooks");
|
|
9
9
|
const rpc_1 = require("../rpc");
|
|
10
10
|
const abort_error_1 = require("../utils/async/abort-error");
|
|
@@ -17,12 +17,12 @@ function tapErrorToLogMessage(compiler, config) {
|
|
|
17
17
|
config.logger.error(String(error));
|
|
18
18
|
if (error instanceof rpc_1.RpcExitError) {
|
|
19
19
|
if (error.signal === 'SIGINT') {
|
|
20
|
-
config.logger.error(
|
|
20
|
+
config.logger.error(picocolors_1.default.red('Issues checking service interrupted - If running in a docker container, this may be caused ' +
|
|
21
21
|
"by the container running out of memory. If so, try increasing the container's memory limit " +
|
|
22
22
|
'or lowering the `memoryLimit` value in the TsCheckerRspackPlugin configuration.'));
|
|
23
23
|
}
|
|
24
24
|
else {
|
|
25
|
-
config.logger.error(
|
|
25
|
+
config.logger.error(picocolors_1.default.red('Issues checking service aborted - probably out of memory. ' +
|
|
26
26
|
'Check the `memoryLimit` option in the TsCheckerRspackPlugin configuration.\n' +
|
|
27
27
|
"If increasing the memory doesn't solve the issue, it's most probably a bug in the TypeScript."));
|
|
28
28
|
}
|
package/lib/issue/issue-match.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createIssuePredicateFromIssueMatch = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const minimatch_1 =
|
|
8
|
+
const minimatch_1 = require("minimatch");
|
|
9
9
|
const forward_slash_1 = require("../utils/path/forward-slash");
|
|
10
10
|
function createIssuePredicateFromIssueMatch(context, match) {
|
|
11
11
|
return (issue) => {
|
|
@@ -13,7 +13,7 @@ function createIssuePredicateFromIssueMatch(context, match) {
|
|
|
13
13
|
const matchesCode = !match.code || match.code === issue.code;
|
|
14
14
|
const matchesFile = !issue.file ||
|
|
15
15
|
(!!issue.file &&
|
|
16
|
-
(!match.file || (0, minimatch_1.
|
|
16
|
+
(!match.file || (0, minimatch_1.minimatch)((0, forward_slash_1.forwardSlash)(path_1.default.relative(context, issue.file)), match.file)));
|
|
17
17
|
return matchesSeverity && matchesCode && matchesFile;
|
|
18
18
|
};
|
|
19
19
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import * as rspack from '@rspack/core';
|
|
2
1
|
import type { FormatterPathType } from '../formatter';
|
|
3
2
|
import type { Issue } from './issue';
|
|
4
|
-
declare class IssueWebpackError extends
|
|
3
|
+
declare class IssueWebpackError extends Error {
|
|
5
4
|
readonly issue: Issue;
|
|
6
5
|
readonly hideStack = true;
|
|
7
6
|
file?: string;
|
|
@@ -1,38 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
28
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
6
|
exports.IssueWebpackError = void 0;
|
|
30
7
|
const path_1 = __importDefault(require("path"));
|
|
31
|
-
const rspack = __importStar(require("@rspack/core"));
|
|
32
8
|
const forward_slash_1 = require("../utils/path/forward-slash");
|
|
33
9
|
const relative_to_context_1 = require("../utils/path/relative-to-context");
|
|
34
10
|
const issue_location_1 = require("./issue-location");
|
|
35
|
-
class IssueWebpackError extends
|
|
11
|
+
class IssueWebpackError extends Error {
|
|
36
12
|
constructor(message, pathType, issue) {
|
|
37
13
|
super(message);
|
|
38
14
|
this.issue = issue;
|
package/lib/plugin.d.ts
CHANGED
package/lib/plugin.js
CHANGED
|
@@ -36,6 +36,8 @@ const plugin_pools_1 = require("./plugin-pools");
|
|
|
36
36
|
const plugin_state_1 = require("./plugin-state");
|
|
37
37
|
const rpc_1 = require("./rpc");
|
|
38
38
|
const type_script_support_1 = require("./typescript/type-script-support");
|
|
39
|
+
const node_fs_1 = require("node:fs");
|
|
40
|
+
const pkgJson = JSON.parse((0, node_fs_1.readFileSync)(path.join(__dirname, '../package.json'), 'utf-8'));
|
|
39
41
|
class TsCheckerRspackPlugin {
|
|
40
42
|
constructor(options = {}) {
|
|
41
43
|
this.options = options;
|
|
@@ -59,9 +61,8 @@ class TsCheckerRspackPlugin {
|
|
|
59
61
|
exports.TsCheckerRspackPlugin = TsCheckerRspackPlugin;
|
|
60
62
|
/**
|
|
61
63
|
* Current version of the plugin
|
|
62
|
-
* TODO: use `define` to replace it
|
|
63
64
|
*/
|
|
64
|
-
TsCheckerRspackPlugin.version =
|
|
65
|
+
TsCheckerRspackPlugin.version = pkgJson.version;
|
|
65
66
|
/**
|
|
66
67
|
* Default pools for the plugin concurrency limit
|
|
67
68
|
*/
|
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
@@ -29,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
6
|
exports.assertTypeScriptSupport = void 0;
|
|
30
7
|
const os_1 = __importDefault(require("os"));
|
|
31
8
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
32
|
-
const semver = __importStar(require("semver"));
|
|
33
9
|
function assertTypeScriptSupport(config) {
|
|
34
10
|
let typescriptVersion;
|
|
35
11
|
try {
|
|
@@ -42,18 +18,6 @@ function assertTypeScriptSupport(config) {
|
|
|
42
18
|
if (!typescriptVersion) {
|
|
43
19
|
throw new Error('When you use TsCheckerRspackPlugin with typescript reporter enabled, you must install `typescript` package.');
|
|
44
20
|
}
|
|
45
|
-
if (semver.lt(typescriptVersion, '3.6.0')) {
|
|
46
|
-
throw new Error([
|
|
47
|
-
`TsCheckerRspackPlugin cannot use the current typescript version of ${typescriptVersion}.`,
|
|
48
|
-
'The minimum required version is 3.6.0.',
|
|
49
|
-
].join(os_1.default.EOL));
|
|
50
|
-
}
|
|
51
|
-
if (config.build && semver.lt(typescriptVersion, '3.8.0')) {
|
|
52
|
-
throw new Error([
|
|
53
|
-
`TsCheckerRspackPlugin doesn't support build option for the current typescript version of ${typescriptVersion}.`,
|
|
54
|
-
'The minimum required version is 3.8.0.',
|
|
55
|
-
].join(os_1.default.EOL));
|
|
56
|
-
}
|
|
57
21
|
if (!node_fs_1.default.existsSync(config.configFile)) {
|
|
58
22
|
throw new Error([
|
|
59
23
|
`Cannot find the "${config.configFile}" file.`,
|
|
@@ -13,6 +13,6 @@ function createTypeScriptWorkerConfig(compiler, options) {
|
|
|
13
13
|
: path_1.default.resolve(compiler.options.context || process.cwd(), configFile));
|
|
14
14
|
const optionsAsObject = typeof options === 'object' ? options : {};
|
|
15
15
|
const typescriptPath = optionsAsObject.typescriptPath || require.resolve('typescript');
|
|
16
|
-
return Object.assign(Object.assign({ enabled: Boolean(options) || options === undefined, memoryLimit:
|
|
16
|
+
return Object.assign(Object.assign({ enabled: Boolean(options) || options === undefined, memoryLimit: 8192, build: false, mode: optionsAsObject.build ? 'write-tsbuildinfo' : 'readonly', profile: false }, optionsAsObject), { configFile: configFile, configOverwrite: optionsAsObject.configOverwrite || {}, context: optionsAsObject.context || path_1.default.dirname(configFile), diagnosticOptions: Object.assign({ syntactic: false, semantic: true, declaration: false, global: false }, (optionsAsObject.diagnosticOptions || {})), typescriptPath: typescriptPath });
|
|
17
17
|
}
|
|
18
18
|
exports.createTypeScriptWorkerConfig = createTypeScriptWorkerConfig;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.InclusiveNodeWatchFileSystem = void 0;
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
const chokidar_1 = __importDefault(require("chokidar"));
|
|
9
|
-
const minimatch_1 =
|
|
9
|
+
const minimatch_1 = require("minimatch");
|
|
10
10
|
const files_change_1 = require("../files-change");
|
|
11
11
|
const infrastructure_logger_1 = require("../infrastructure-logger");
|
|
12
12
|
const is_inside_another_path_1 = require("../utils/path/is-inside-another-path");
|
|
@@ -16,7 +16,7 @@ function createIsIgnored(ignored, excluded) {
|
|
|
16
16
|
const ignoredFunctions = ignoredPatterns.map((pattern) => {
|
|
17
17
|
// ensure patterns are valid - see https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues/594
|
|
18
18
|
if (typeof pattern === 'string') {
|
|
19
|
-
return (path) => (0, minimatch_1.
|
|
19
|
+
return (path) => (0, minimatch_1.minimatch)(path, pattern);
|
|
20
20
|
}
|
|
21
21
|
else if (pattern instanceof RegExp) {
|
|
22
22
|
return (path) => pattern.test(path);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-checker-rspack-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Runs typescript type checker and linter on separate process.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rspack",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"lint": "echo lint",
|
|
27
27
|
"test": "pnpm build && pnpm test:unit && pnpm test:e2e",
|
|
28
28
|
"test:unit": "cross-env jest --config=test/unit/jest.config.js",
|
|
29
|
-
"test:e2e": "
|
|
29
|
+
"test:e2e": "cd test/e2e && pnpm test",
|
|
30
|
+
"test:e2e:setup": "cd test/e2e && pnpm run setup",
|
|
30
31
|
"precommit": "pnpm build && pnpm test:unit",
|
|
31
32
|
"prepare": "husky install && pnpm build",
|
|
32
33
|
"bump": "npx bumpp"
|
|
@@ -34,34 +35,28 @@
|
|
|
34
35
|
"dependencies": {
|
|
35
36
|
"@babel/code-frame": "^7.16.7",
|
|
36
37
|
"@rspack/lite-tapable": "^1.0.0",
|
|
37
|
-
"chalk": "^4.1.2",
|
|
38
38
|
"chokidar": "^3.5.3",
|
|
39
39
|
"memfs": "^4.14.0",
|
|
40
|
-
"minimatch": "^
|
|
41
|
-
"
|
|
40
|
+
"minimatch": "^9.0.5",
|
|
41
|
+
"picocolors": "^1.1.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@rspack/core": "^1.0.0",
|
|
45
|
-
"typescript": "
|
|
45
|
+
"typescript": ">=3.8.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@jest/console": "^27.0.0",
|
|
49
49
|
"@rspack/core": "^1.1.3",
|
|
50
50
|
"@types/babel__code-frame": "^7.0.3",
|
|
51
|
-
"@types/cross-spawn": "^6.0.2",
|
|
52
51
|
"@types/jest": "^27.4.0",
|
|
53
|
-
"@types/minimatch": "^3.0.5",
|
|
54
52
|
"@types/mock-fs": "^4.13.1",
|
|
55
53
|
"@types/node": "^16.4.13",
|
|
56
|
-
"@types/rimraf": "^3.0.2",
|
|
57
|
-
"@types/semver": "^7.3.9",
|
|
58
54
|
"cross-env": "^7.0.3",
|
|
59
55
|
"husky": "^7.0.4",
|
|
60
56
|
"jest": "^27.4.7",
|
|
61
57
|
"jest-circus": "^27.4.6",
|
|
62
58
|
"jest-environment-node": "^27.4.6",
|
|
63
59
|
"jest-runner": "^27.0.0",
|
|
64
|
-
"karton": "^0.4.1",
|
|
65
60
|
"mock-fs": "^5.1.2",
|
|
66
61
|
"prettier": "^2.5.1",
|
|
67
62
|
"rimraf": "^3.0.2",
|
|
@@ -70,11 +65,11 @@
|
|
|
70
65
|
"typescript": "^4.5.5"
|
|
71
66
|
},
|
|
72
67
|
"engines": {
|
|
73
|
-
"node": ">=16.0.0"
|
|
74
|
-
"pnpm": ">=1.0.0"
|
|
68
|
+
"node": ">=16.0.0"
|
|
75
69
|
},
|
|
76
70
|
"publishConfig": {
|
|
77
71
|
"access": "public",
|
|
72
|
+
"provenance": true,
|
|
78
73
|
"registry": "https://registry.npmjs.org/"
|
|
79
74
|
},
|
|
80
75
|
"packageManager": "pnpm@9.14.2"
|