fork-ts-checker-webpack-plugin 7.0.0 → 7.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.
package/README.md CHANGED
@@ -70,7 +70,7 @@ module.exports = {
70
70
  ## Modules resolution
71
71
 
72
72
  It's very important to be aware that **this plugin uses [TypeScript](https://github.com/Microsoft/TypeScript)'s, not
73
- [webpack](https://github.com/webpack/webpack)'s modules resolution**. It means that you have to setup `tsconfig.json` correctly.
73
+ [webpack](https://github.com/webpack/webpack)'s modules resolution**. It means that you have to setup `tsconfig.json` correctly.
74
74
 
75
75
  > It's because of the performance - with TypeScript's module resolution we don't have to wait for webpack to compile files.
76
76
  >
@@ -83,44 +83,44 @@ you can place your configuration in the:
83
83
  * `"fork-ts-checker"` field in the `package.json`
84
84
  * `.fork-ts-checkerrc` file in JSON or YAML format
85
85
  * `fork-ts-checker.config.js` file exporting a JS object
86
-
86
+
87
87
  Options passed to the plugin constructor will overwrite options from the cosmiconfig (using [deepmerge](https://github.com/TehShrike/deepmerge)).
88
88
 
89
- | Name | Type | Default value | Description |
90
- | ----------------- | ------------------------------------ | ----------------------------------------- | ----------- |
91
- | `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. |
92
- | `typescript` | `object` | `{}` | See [TypeScript options](#typescript-options). |
93
- | `issue` | `object` | `{}` | See [Issues options](#issues-options). |
94
- | `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> } }`. |
95
- | `logger` | `{ log: function, error: function }` | `console` | Console-like object to print issues in `async` mode. |
96
- | `devServer` | `boolean` | `true` | If set to `false`, errors will not be reported to Webpack Dev Server. |
89
+ | Name | Type | Default value | Description |
90
+ |--------------|--------------------------------------|-------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
91
+ | `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. |
92
+ | `typescript` | `object` | `{}` | See [TypeScript options](#typescript-options). |
93
+ | `issue` | `object` | `{}` | See [Issues options](#issues-options). |
94
+ | `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> } }`. |
95
+ | `logger` | `{ log: function, error: function }` or `webpack-infrastructure` | `console` | Console-like object to print issues in `async` mode. |
96
+ | `devServer` | `boolean` | `true` | If set to `false`, errors will not be reported to Webpack Dev Server. |
97
97
 
98
98
  ### TypeScript options
99
99
 
100
100
  Options for the TypeScript checker (`typescript` option object).
101
101
 
102
- | Name | Type | Default value | Description |
103
- | -------------------- | --------- | -------------------------------------------------------------------------------------------------------------- | ----------- |
104
- | `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. |
105
- | `configFile` | `string` | `'tsconfig.json'` | Path to the `tsconfig.json` file (path relative to the `compiler.options.context` or absolute path) |
106
- | `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`. |
107
- | `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 `fork-ts-checker-webpack-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`. |
108
- | `build` | `boolean` | `false` | The equivalent of the `--build` flag for the `tsc` command. |
109
- | `mode` | `'readonly'` or `'write-tsbuildinfo'` or `'write-dts'` or `'write-references'` | `'write-tsbuildinfo'` | If you use the `babel-loader`, it's recommended to use `write-references` mode to improve initial compilation time. If you use `ts-loader`, it's recommended to use `write-tsbuildinfo` mode to not overwrite files emitted by the `ts-loader`. If you use `ts-loader` with `transpileOnly` flag set to `true`, use `'write-dts` to emit the type definition files. |
110
- | `diagnosticOptions` | `object` | `{ syntactic: false, semantic: true, declaration: false, global: false }` | Settings to select which diagnostics do we want to perform. |
111
- | `extensions` | `object` | `{}` | See [TypeScript extensions options](#typescript-extensions-options). |
112
- | `profile` | `boolean` | `false` | Measures and prints timings related to the TypeScript performance. |
113
- | `typescriptPath` | `string` | `require.resolve('typescript')` | If supplied this is a custom path where TypeScript can be found. |
102
+ | Name | Type | Default value | Description |
103
+ |---------------------|--------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
104
+ | `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. |
105
+ | `configFile` | `string` | `'tsconfig.json'` | Path to the `tsconfig.json` file (path relative to the `compiler.options.context` or absolute path) |
106
+ | `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`. |
107
+ | `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 `fork-ts-checker-webpack-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`. |
108
+ | `build` | `boolean` | `false` | The equivalent of the `--build` flag for the `tsc` command. |
109
+ | `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`). |
110
+ | `diagnosticOptions` | `object` | `{ syntactic: false, semantic: true, declaration: false, global: false }` | Settings to select which diagnostics do we want to perform. |
111
+ | `extensions` | `object` | `{}` | See [TypeScript extensions options](#typescript-extensions-options). |
112
+ | `profile` | `boolean` | `false` | Measures and prints timings related to the TypeScript performance. |
113
+ | `typescriptPath` | `string` | `require.resolve('typescript')` | If supplied this is a custom path where TypeScript can be found. |
114
114
 
115
115
  #### TypeScript extensions options
116
116
 
117
117
  Options for the TypeScript checker extensions (`typescript.extensions` option object).
118
118
 
119
- | Name | Type | Default value | Description |
120
- | -------------------- | --------------------- | ------------------------- | ----------- |
121
- | `vue` | `object` or `boolean` | `false` | If `true`, it enables Vue [Single File Component](https://vuejs.org/v2/guide/single-file-components.html) support. |
122
- | `vue.enabled` | `boolean` | `false` | Same as the `vue` option |
123
- | `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) |
119
+ | Name | Type | Default value | Description |
120
+ |----------------|-----------------------|---------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
121
+ | `vue` | `object` or `boolean` | `false` | If `true`, it enables Vue [Single File Component](https://vuejs.org/v2/guide/single-file-components.html) support. |
122
+ | `vue.enabled` | `boolean` | `false` | Same as the `vue` option |
123
+ | `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) |
124
124
 
125
125
  ### Issues options
126
126
 
@@ -139,10 +139,10 @@ type IssuePredicate = (issue: Issue) => boolean;
139
139
  type IssueFilter = IssueMatch | IssuePredicate | (IssueMatch | IssuePredicate)[];
140
140
  ```
141
141
 
142
- | Name | Type | Default value | Description |
143
- | --------- | ------------- | ------------- | ----------- |
142
+ | Name | Type | Default value | Description |
143
+ |-----------|---------------|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|
144
144
  | `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. |
145
- | `exclude` | `IssueFilter` | `undefined` | Same as `include` but issues that match this predicate will be excluded. |
145
+ | `exclude` | `IssueFilter` | `undefined` | Same as `include` but issues that match this predicate will be excluded. |
146
146
 
147
147
  <details>
148
148
  <summary>Expand example</summary>
@@ -184,11 +184,11 @@ To enable Vue.js support, follow these steps:
184
184
  ```sh
185
185
  # with npm
186
186
  npm install --save vue vue-class-component
187
- npm install --save-dev vue-loader ts-loader css-loader vue-template-compiler
187
+ npm install --save-dev vue-loader ts-loader css-loader vue-template-compiler
188
188
 
189
189
  # with yarn
190
190
  yarn add vue vue-class-component
191
- yarn add --dev vue-loader ts-loader css-loader vue-template-compiler
191
+ yarn add --dev vue-loader ts-loader css-loader vue-template-compiler
192
192
  ```
193
193
 
194
194
  2. Add `tsconfig.json` configuration:
@@ -286,13 +286,13 @@ declare module "*.vue" {
286
286
 
287
287
  This plugin provides some custom webpack hooks:
288
288
 
289
- | Hook key | Type | Params | Description |
290
- | ---------- | -------------------------- | --------------------- | ----------- |
289
+ | Hook key | Type | Params | Description |
290
+ |------------|----------------------------|-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
291
291
  | `start` | `AsyncSeriesWaterfallHook` | `change, compilation` | Starts issues checking for a compilation. It's an async waterfall hook, so you can modify the list of changed and removed files or delay the start of the service. |
292
- | `waiting` | `SyncHook` | `compilation` | Waiting for the issues checking. |
293
- | `canceled` | `SyncHook` | `compilation` | Issues checking for the compilation has been canceled. |
294
- | `error` | `SyncHook` | `compilation` | An error occurred during issues checking. |
295
- | `issues` | `SyncWaterfallHook` | `issues, compilation` | Issues have been received and will be reported. It's a waterfall hook, so you can modify the list of received issues. |
292
+ | `waiting` | `SyncHook` | `compilation` | Waiting for the issues checking. |
293
+ | `canceled` | `SyncHook` | `compilation` | Issues checking for the compilation has been canceled. |
294
+ | `error` | `SyncHook` | `compilation` | An error occurred during issues checking. |
295
+ | `issues` | `SyncWaterfallHook` | `issues, compilation` | Issues have been received and will be reported. It's a waterfall hook, so you can modify the list of received issues. |
296
296
 
297
297
  To access plugin hooks and tap into the event, we need to use the `getCompilerHooks` static method.
298
298
  When we call this method with a [webpack compiler instance](https://webpack.js.org/api/node/), it returns the object with
@@ -311,7 +311,7 @@ class MyWebpackPlugin {
311
311
  console.log('waiting for issues');
312
312
  });
313
313
  // don't show warnings
314
- hooks.issues.tap('MyPlugin', (issues) =>
314
+ hooks.issues.tap('MyPlugin', (issues) =>
315
315
  issues.filter((issue) => issue.severity === 'error')
316
316
  );
317
317
  }
@@ -335,7 +335,7 @@ module.exports = {
335
335
  ## Typings
336
336
 
337
337
  To use the plugin typings, you have to install `@types/webpack`. It's not included by default to not collide with your
338
- existing typings (`@types/webpack` imports `@types/node`). [It's an old TypeScript issue](https://github.com/microsoft/TypeScript/issues/18588),
338
+ existing typings (`@types/webpack` imports `@types/node`). [It's an old TypeScript issue](https://github.com/microsoft/TypeScript/issues/18588),
339
339
  the alternative is to set `skipLibCheck: true` in the `compilerOptions` 😉
340
340
  ```sh
341
341
  # with npm
@@ -351,7 +351,7 @@ Starting from TypeScript 4.1.0, you can profile long type checks by
351
351
  setting "generateTrace" compiler option. This is an instruction from [microsoft/TypeScript#40063](https://github.com/microsoft/TypeScript/pull/40063):
352
352
 
353
353
  1. Set "generateTrace": "{folderName}" in your `tsconfig.json`
354
- 2. Look in the resulting folder. If you used build mode, there will be a `legend.json` telling you what went where.
354
+ 2. Look in the resulting folder. If you used build mode, there will be a `legend.json` telling you what went where.
355
355
  Otherwise, there will be `trace.json` file and `types.json` files.
356
356
  3. Navigate to [edge://tracing](edge://tracing) or [chrome://tracing](chrome://tracing) and load `trace.json`
357
357
  4. Expand Process 1 with the little triangle in the left sidebar
@@ -361,7 +361,7 @@ setting "generateTrace" compiler option. This is an instruction from [microsoft/
361
361
 
362
362
 
363
363
  ## Related projects
364
-
364
+
365
365
  * [`ts-loader`](https://github.com/TypeStrong/ts-loader) - TypeScript loader for webpack.
366
366
  * [`babel-loader`](https://github.com/babel/babel-loader) - Alternative TypeScript loader for webpack.
367
367
  * [`fork-ts-checker-notifier-webpack-plugin`](https://github.com/johnnyreilly/fork-ts-checker-notifier-webpack-plugin) - Notifies about build status using system notifications (similar to the [webpack-notifier](https://github.com/Turbo87/webpack-notifier)).
@@ -373,3 +373,4 @@ This plugin was created in [Realytics](https://www.realytics.io/) in 2017. Thank
373
373
  ## License
374
374
 
375
375
  MIT License
376
+
@@ -0,0 +1,3 @@
1
+ import type { Stats } from 'webpack';
2
+ import type { Issue } from '../issue';
3
+ export declare function statsFormatter(issues: Issue[], stats: Stats): string;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.statsFormatter = void 0;
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ // mimics webpack's stats summary formatter
9
+ function statsFormatter(issues, stats) {
10
+ const errorsNumber = issues.filter((issue) => issue.severity === 'error').length;
11
+ const warningsNumber = issues.filter((issue) => issue.severity === 'warning').length;
12
+ const errorsFormatted = errorsNumber
13
+ ? chalk_1.default.red.bold(`${errorsNumber} ${errorsNumber === 1 ? 'error' : 'errors'}`)
14
+ : '';
15
+ const warningsFormatted = warningsNumber
16
+ ? chalk_1.default.yellow.bold(`${warningsNumber} ${warningsNumber === 1 ? 'warning' : 'warnings'}`)
17
+ : '';
18
+ const timeFormatted = Math.round(Date.now() - stats.startTime);
19
+ return [
20
+ 'Found ',
21
+ errorsFormatted,
22
+ errorsFormatted && warningsFormatted ? ' and ' : '',
23
+ warningsFormatted,
24
+ ` in ${timeFormatted} ms`,
25
+ '.',
26
+ ].join('');
27
+ }
28
+ exports.statsFormatter = statsFormatter;
@@ -14,6 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.tapDoneToAsyncGetIssues = void 0;
16
16
  const chalk_1 = __importDefault(require("chalk"));
17
+ const stats_formatter_1 = require("../formatter/stats-formatter");
17
18
  const webpack_formatter_1 = require("../formatter/webpack-formatter");
18
19
  const infrastructure_logger_1 = require("../infrastructure-logger");
19
20
  const issue_webpack_error_1 = require("../issue/issue-webpack-error");
@@ -22,7 +23,7 @@ const is_pending_1 = require("../utils/async/is-pending");
22
23
  const wait_1 = require("../utils/async/wait");
23
24
  function tapDoneToAsyncGetIssues(compiler, config, state) {
24
25
  const hooks = (0, plugin_hooks_1.getPluginHooks)(compiler);
25
- const { log, debug } = (0, infrastructure_logger_1.getInfrastructureLogger)(compiler);
26
+ const { debug } = (0, infrastructure_logger_1.getInfrastructureLogger)(compiler);
26
27
  compiler.hooks.done.tap('ForkTsCheckerWebpackPlugin', (stats) => __awaiter(this, void 0, void 0, function* () {
27
28
  if (stats.compilation.compiler !== compiler) {
28
29
  // run only for the compiler that the plugin was registered for
@@ -33,7 +34,7 @@ function tapDoneToAsyncGetIssues(compiler, config, state) {
33
34
  try {
34
35
  if (yield (0, is_pending_1.isPending)(issuesPromise)) {
35
36
  hooks.waiting.call(stats.compilation);
36
- config.logger.log(chalk_1.default.cyan('Issues checking in progress...'));
37
+ config.logger.log(chalk_1.default.cyan('Type-checking in progress...'));
37
38
  }
38
39
  else {
39
40
  // wait 10ms to log issues after webpack stats
@@ -58,9 +59,11 @@ function tapDoneToAsyncGetIssues(compiler, config, state) {
58
59
  if (issues.length) {
59
60
  // follow webpack's approach - one process.write to stderr with all errors and warnings
60
61
  config.logger.error(issues.map((issue) => formatter(issue)).join('\n'));
62
+ // print stats of the compilation
63
+ config.logger.log((0, stats_formatter_1.statsFormatter)(issues, stats));
61
64
  }
62
65
  else {
63
- config.logger.log(chalk_1.default.green('No issues found.'));
66
+ config.logger.log(chalk_1.default.green('No errors found.'));
64
67
  }
65
68
  // report issues to webpack-dev-server, if it's listening
66
69
  // skip reporting if there are no issues, to avoid an extra hot reload
@@ -77,9 +80,6 @@ function tapDoneToAsyncGetIssues(compiler, config, state) {
77
80
  debug('Sending issues to the webpack-dev-server.');
78
81
  state.webpackDevServerDoneTap.fn(stats);
79
82
  }
80
- if (stats.startTime) {
81
- log(`Time: ${Math.round(Date.now() - stats.startTime).toString()} ms`);
82
- }
83
83
  }));
84
84
  }
85
85
  exports.tapDoneToAsyncGetIssues = tapDoneToAsyncGetIssues;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createPluginConfig = void 0;
4
4
  const formatter_1 = require("./formatter");
5
+ const infrastructure_logger_1 = require("./infrastructure-logger");
5
6
  const issue_config_1 = require("./issue/issue-config");
6
7
  const type_script_worker_config_1 = require("./typescript/type-script-worker-config");
7
8
  function createPluginConfig(compiler, options = {}) {
@@ -10,7 +11,15 @@ function createPluginConfig(compiler, options = {}) {
10
11
  typescript: (0, type_script_worker_config_1.createTypeScriptWorkerConfig)(compiler, options.typescript),
11
12
  issue: (0, issue_config_1.createIssueConfig)(compiler, options.issue),
12
13
  formatter: (0, formatter_1.createFormatterConfig)(options.formatter),
13
- logger: options.logger || console,
14
+ logger: options.logger === 'webpack-infrastructure'
15
+ ? (() => {
16
+ const { info, error } = (0, infrastructure_logger_1.getInfrastructureLogger)(compiler);
17
+ return {
18
+ log: info,
19
+ error,
20
+ };
21
+ })()
22
+ : options.logger || console,
14
23
  devServer: options.devServer !== false,
15
24
  };
16
25
  }
@@ -7,7 +7,7 @@ interface ForkTsCheckerWebpackPluginOptions {
7
7
  typescript?: TypeScriptWorkerOptions;
8
8
  formatter?: FormatterOptions;
9
9
  issue?: IssueOptions;
10
- logger?: Logger;
10
+ logger?: Logger | 'webpack-infrastructure';
11
11
  devServer?: boolean;
12
12
  }
13
13
  export { ForkTsCheckerWebpackPluginOptions };
@@ -39,26 +39,18 @@
39
39
  "additionalProperties": true
40
40
  }
41
41
  },
42
- "required": [
43
- "type"
44
- ]
42
+ "required": ["type"]
45
43
  },
46
44
  "FormatterType": {
47
45
  "type": "string",
48
- "enum": [
49
- "basic",
50
- "codeframe"
51
- ]
46
+ "enum": ["basic", "codeframe"]
52
47
  },
53
48
  "IssueMatch": {
54
49
  "type": "object",
55
50
  "properties": {
56
51
  "severity": {
57
52
  "type": "string",
58
- "enum": [
59
- "error",
60
- "warning"
61
- ]
53
+ "enum": ["error", "warning"]
62
54
  },
63
55
  "code": {
64
56
  "type": "string"
@@ -95,15 +87,23 @@
95
87
  ]
96
88
  },
97
89
  "Logger": {
98
- "type": "object",
99
- "properties": {
100
- "error": {
101
- "instanceof": "Function"
90
+ "oneOf": [
91
+ {
92
+ "type": "object",
93
+ "properties": {
94
+ "error": {
95
+ "instanceof": "Function"
96
+ },
97
+ "log": {
98
+ "instanceof": "Function"
99
+ }
100
+ }
102
101
  },
103
- "log": {
104
- "instanceof": "Function"
102
+ {
103
+ "type": "string",
104
+ "enum": ["webpack-infrastructure"]
105
105
  }
106
- }
106
+ ]
107
107
  },
108
108
  "TypeScriptOptions": {
109
109
  "type": "object",
@@ -126,12 +126,7 @@
126
126
  },
127
127
  "mode": {
128
128
  "type": "string",
129
- "enum": [
130
- "readonly",
131
- "write-tsbuildinfo",
132
- "write-dts",
133
- "write-references"
134
- ],
129
+ "enum": ["readonly", "write-tsbuildinfo", "write-dts", "write-references"],
135
130
  "description": "`readonly` keeps all emitted files in memory, `write-tsbuildinfo` which writes only .tsbuildinfo files, `write-dts` writes .tsbuildinfo and type definition files, and `write-references` which writes both .tsbuildinfo and referenced projects output"
136
131
  },
137
132
  "compilerOptions": {
package/lib/plugin.js CHANGED
@@ -70,7 +70,7 @@ exports.ForkTsCheckerWebpackPlugin = ForkTsCheckerWebpackPlugin;
70
70
  /**
71
71
  * Current version of the plugin
72
72
  */
73
- ForkTsCheckerWebpackPlugin.version = '7.0.0'; // will be replaced by the @semantic-release/exec
73
+ ForkTsCheckerWebpackPlugin.version = '7.2.1'; // will be replaced by the @semantic-release/exec
74
74
  /**
75
75
  * Default pools for the plugin concurrency limit
76
76
  */
@@ -10,7 +10,7 @@ interface TypeScriptWorkerConfig {
10
10
  configOverwrite: TypeScriptConfigOverwrite;
11
11
  build: boolean;
12
12
  context: string;
13
- mode: 'readonly' | 'write-tsbuildinfo' | 'write-dts' | 'write-references';
13
+ mode: 'readonly' | 'write-dts' | 'write-tsbuildinfo' | 'write-references';
14
14
  diagnosticOptions: TypeScriptDiagnosticsOptions;
15
15
  extensions: {
16
16
  vue: TypeScriptVueExtensionConfig;
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createTypeScriptWorkerConfig = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
- const semver_1 = __importDefault(require("semver"));
9
8
  const type_script_vue_extension_config_1 = require("./extension/vue/type-script-vue-extension-config");
10
9
  function createTypeScriptWorkerConfig(compiler, options) {
11
10
  let configFile = typeof options === 'object' ? options.configFile || 'tsconfig.json' : 'tsconfig.json';
@@ -15,16 +14,7 @@ function createTypeScriptWorkerConfig(compiler, options) {
15
14
  : path_1.default.resolve(compiler.options.context || process.cwd(), configFile));
16
15
  const optionsAsObject = typeof options === 'object' ? options : {};
17
16
  const typescriptPath = optionsAsObject.typescriptPath || require.resolve('typescript');
18
- const defaultCompilerOptions = {
19
- skipLibCheck: true,
20
- sourceMap: false,
21
- inlineSourceMap: false,
22
- };
23
- // eslint-disable-next-line @typescript-eslint/no-var-requires
24
- if (semver_1.default.gte(require(typescriptPath).version, '2.9.0')) {
25
- defaultCompilerOptions.declarationMap = false;
26
- }
27
- return Object.assign(Object.assign({ enabled: options !== false, memoryLimit: 2048, build: false, mode: 'write-tsbuildinfo', profile: false }, optionsAsObject), { configFile: configFile, configOverwrite: Object.assign(Object.assign({}, (optionsAsObject.configOverwrite || {})), { compilerOptions: Object.assign(Object.assign({}, defaultCompilerOptions), ((optionsAsObject.configOverwrite || {}).compilerOptions || {})) }), context: optionsAsObject.context || path_1.default.dirname(configFile), extensions: {
17
+ return Object.assign(Object.assign({ enabled: options !== false, memoryLimit: 2048, build: false, mode: optionsAsObject.build ? 'write-tsbuildinfo' : 'readonly', profile: false }, optionsAsObject), { configFile: configFile, configOverwrite: optionsAsObject.configOverwrite || {}, context: optionsAsObject.context || path_1.default.dirname(configFile), extensions: {
28
18
  vue: (0, type_script_vue_extension_config_1.createTypeScriptVueExtensionConfig)(optionsAsObject.extensions ? optionsAsObject.extensions.vue : undefined),
29
19
  }, diagnosticOptions: Object.assign({ syntactic: false, semantic: true, declaration: false, global: false }, (optionsAsObject.diagnosticOptions || {})), typescriptPath: typescriptPath });
30
20
  }
@@ -1,5 +1,5 @@
1
1
  import type { FilesChange } from '../../files-change';
2
2
  import type { FilesMatch } from '../../files-match';
3
- declare const getDependenciesWorker: ({ changedFiles, deletedFiles, }: FilesChange) => FilesMatch;
3
+ declare const getDependenciesWorker: (change: FilesChange) => FilesMatch;
4
4
  export declare type GetDependenciesWorker = typeof getDependenciesWorker;
5
5
  export {};
@@ -4,15 +4,12 @@ const rpc_1 = require("../../rpc");
4
4
  const config_1 = require("./lib/config");
5
5
  const dependencies_1 = require("./lib/dependencies");
6
6
  const system_1 = require("./lib/system");
7
- const getDependenciesWorker = ({ changedFiles = [], deletedFiles = [], }) => {
7
+ const getDependenciesWorker = (change) => {
8
8
  system_1.system.invalidateCache();
9
- if ((0, config_1.didConfigFileChanged)({ changedFiles, deletedFiles })) {
9
+ if ((0, config_1.didConfigFileChanged)(change) || (0, config_1.didDependenciesProbablyChanged)((0, dependencies_1.getDependencies)(), change)) {
10
10
  (0, config_1.invalidateConfig)();
11
11
  (0, dependencies_1.invalidateDependencies)();
12
12
  }
13
- else if ((0, config_1.didRootFilesChanged)()) {
14
- (0, dependencies_1.invalidateDependencies)();
15
- }
16
13
  return (0, dependencies_1.getDependencies)();
17
14
  };
18
15
  (0, rpc_1.exposeRpc)(getDependenciesWorker);
@@ -1,5 +1,5 @@
1
1
  import type { FilesChange } from '../../files-change';
2
2
  import type { Issue } from '../../issue';
3
- declare const getIssuesWorker: ({ changedFiles, deletedFiles }: FilesChange, watching: boolean) => Promise<Issue[]>;
3
+ declare const getIssuesWorker: (change: FilesChange, watching: boolean) => Promise<Issue[]>;
4
4
  export declare type GetIssuesWorker = typeof getIssuesWorker;
5
5
  export {};
@@ -22,11 +22,12 @@ const system_1 = require("./lib/system");
22
22
  const tracing_1 = require("./lib/tracing");
23
23
  const tsbuildinfo_1 = require("./lib/tsbuildinfo");
24
24
  const worker_config_1 = require("./lib/worker-config");
25
- const getIssuesWorker = ({ changedFiles = [], deletedFiles = [] }, watching) => __awaiter(void 0, void 0, void 0, function* () {
25
+ const getIssuesWorker = (change, watching) => __awaiter(void 0, void 0, void 0, function* () {
26
+ var _a, _b;
26
27
  system_1.system.invalidateCache();
27
- (0, dependencies_1.invalidateDependencies)();
28
- if ((0, config_1.didConfigFileChanged)({ changedFiles, deletedFiles })) {
28
+ if ((0, config_1.didConfigFileChanged)(change)) {
29
29
  (0, config_1.invalidateConfig)();
30
+ (0, dependencies_1.invalidateDependencies)();
30
31
  (0, artifacts_1.invalidateArtifacts)();
31
32
  (0, diagnostics_1.invalidateDiagnostics)();
32
33
  (0, program_1.invalidateProgram)(true);
@@ -34,10 +35,14 @@ const getIssuesWorker = ({ changedFiles = [], deletedFiles = [] }, watching) =>
34
35
  (0, solution_builder_1.invalidateSolutionBuilder)(true);
35
36
  (0, tsbuildinfo_1.invalidateTsBuildInfo)();
36
37
  }
37
- else if ((0, config_1.didRootFilesChanged)()) {
38
+ else if ((0, config_1.didDependenciesProbablyChanged)((0, dependencies_1.getDependencies)(), change)) {
39
+ (0, config_1.invalidateConfig)();
40
+ (0, dependencies_1.invalidateDependencies)();
38
41
  (0, artifacts_1.invalidateArtifacts)();
39
- (0, watch_program_1.invalidateWatchProgramRootFileNames)();
40
- (0, solution_builder_1.invalidateSolutionBuilder)();
42
+ if ((0, config_1.didRootFilesChanged)()) {
43
+ (0, watch_program_1.invalidateWatchProgramRootFileNames)();
44
+ (0, solution_builder_1.invalidateSolutionBuilder)();
45
+ }
41
46
  }
42
47
  (0, artifacts_1.registerArtifacts)();
43
48
  (0, performance_1.enablePerformanceIfNeeded)();
@@ -57,11 +62,11 @@ const getIssuesWorker = ({ changedFiles = [], deletedFiles = [] }, watching) =>
57
62
  (0, program_1.useProgram)();
58
63
  }
59
64
  // simulate file system events
60
- changedFiles.forEach((changedFile) => {
65
+ (_a = change.changedFiles) === null || _a === void 0 ? void 0 : _a.forEach((changedFile) => {
61
66
  system_1.system === null || system_1.system === void 0 ? void 0 : system_1.system.invokeFileChanged(changedFile);
62
67
  });
63
- deletedFiles.forEach((removedFile) => {
64
- system_1.system === null || system_1.system === void 0 ? void 0 : system_1.system.invokeFileDeleted(removedFile);
68
+ (_b = change.deletedFiles) === null || _b === void 0 ? void 0 : _b.forEach((deletedFile) => {
69
+ system_1.system === null || system_1.system === void 0 ? void 0 : system_1.system.invokeFileDeleted(deletedFile);
65
70
  });
66
71
  // wait for all queued events to be processed
67
72
  yield system_1.system.waitForQueued();
@@ -1,8 +1,8 @@
1
1
  import type * as ts from 'typescript';
2
2
  import type { FilesChange } from '../../../files-change';
3
+ import type { FilesMatch } from '../../../files-match';
3
4
  import type { Issue } from '../../../issue';
4
- import type { TypeScriptConfigOverwrite } from '../../type-script-config-overwrite';
5
- export declare function parseConfig(configFileName: string, configFileContext: string, configOverwriteJSON?: TypeScriptConfigOverwrite): ts.ParsedCommandLine;
5
+ export declare function parseConfig(configFileName: string, configFileContext: string): ts.ParsedCommandLine;
6
6
  export declare function getParseConfigIssues(): Issue[];
7
7
  export declare function getParsedConfig(force?: boolean): ts.ParsedCommandLine;
8
8
  export declare function parseNextConfig(): readonly [ts.ParsedCommandLine | undefined, ts.ParsedCommandLine];
@@ -11,4 +11,5 @@ export declare function getConfigFilePathFromCompilerOptions(compilerOptions: ts
11
11
  export declare function getConfigFilePathFromProgram(program: ts.Program): string;
12
12
  export declare function getConfigFilePathFromBuilderProgram(builderProgram: ts.BuilderProgram): string;
13
13
  export declare function didConfigFileChanged({ changedFiles, deletedFiles }: FilesChange): boolean;
14
+ export declare function didDependenciesProbablyChanged(dependencies: FilesMatch, { changedFiles, deletedFiles }: FilesChange): boolean;
14
15
  export declare function didRootFilesChanged(): boolean | undefined;
@@ -19,7 +19,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
19
19
  return result;
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.didRootFilesChanged = exports.didConfigFileChanged = exports.getConfigFilePathFromBuilderProgram = exports.getConfigFilePathFromProgram = exports.getConfigFilePathFromCompilerOptions = exports.invalidateConfig = exports.parseNextConfig = exports.getParsedConfig = exports.getParseConfigIssues = exports.parseConfig = void 0;
22
+ exports.didRootFilesChanged = exports.didDependenciesProbablyChanged = exports.didConfigFileChanged = exports.getConfigFilePathFromBuilderProgram = exports.getConfigFilePathFromProgram = exports.getConfigFilePathFromCompilerOptions = exports.invalidateConfig = exports.parseNextConfig = exports.getParsedConfig = exports.getParseConfigIssues = exports.parseConfig = void 0;
23
23
  const path = __importStar(require("path"));
24
24
  const forward_slash_1 = require("../../../utils/path/forward-slash");
25
25
  const diagnostics_1 = require("./diagnostics");
@@ -38,12 +38,43 @@ for (const extension of extensions_1.extensions) {
38
38
  parseConfigFileHost = extension.extendParseConfigFileHost(parseConfigFileHost);
39
39
  }
40
40
  }
41
- function parseConfig(configFileName, configFileContext, configOverwriteJSON = {}) {
41
+ function getUserProvidedConfigOverwrite() {
42
+ return worker_config_1.config.configOverwrite || {};
43
+ }
44
+ function getImplicitConfigOverwrite() {
45
+ const baseCompilerOptionsOverwrite = {
46
+ skipLibCheck: true,
47
+ sourceMap: false,
48
+ inlineSourceMap: false,
49
+ };
50
+ switch (worker_config_1.config.mode) {
51
+ case 'write-dts':
52
+ return {
53
+ compilerOptions: Object.assign(Object.assign({}, baseCompilerOptionsOverwrite), { declaration: true, emitDeclarationOnly: true, noEmit: false }),
54
+ };
55
+ case 'write-tsbuildinfo':
56
+ case 'write-references':
57
+ return {
58
+ compilerOptions: Object.assign(Object.assign({}, baseCompilerOptionsOverwrite), { declaration: true, emitDeclarationOnly: false, noEmit: false }),
59
+ };
60
+ }
61
+ return {
62
+ compilerOptions: baseCompilerOptionsOverwrite,
63
+ };
64
+ }
65
+ function applyConfigOverwrite(baseConfig, ...overwriteConfigs) {
66
+ let config = baseConfig;
67
+ for (const overwriteConfig of overwriteConfigs) {
68
+ config = Object.assign(Object.assign(Object.assign({}, (config || {})), (overwriteConfig || {})), { compilerOptions: Object.assign(Object.assign({}, ((config === null || config === void 0 ? void 0 : config.compilerOptions) || {})), ((overwriteConfig === null || overwriteConfig === void 0 ? void 0 : overwriteConfig.compilerOptions) || {})) });
69
+ }
70
+ return config;
71
+ }
72
+ function parseConfig(configFileName, configFileContext) {
42
73
  const configFilePath = (0, forward_slash_1.forwardSlash)(configFileName);
43
- const parsedConfigFileJSON = typescript_1.typescript.readConfigFile(configFilePath, parseConfigFileHost.readFile);
44
- const overwrittenConfigFileJSON = Object.assign(Object.assign(Object.assign({}, (parsedConfigFileJSON.config || {})), configOverwriteJSON), { compilerOptions: Object.assign(Object.assign({}, ((parsedConfigFileJSON.config || {}).compilerOptions || {})), (configOverwriteJSON.compilerOptions || {})) });
45
- const parsedConfigFile = typescript_1.typescript.parseJsonConfigFileContent(overwrittenConfigFileJSON, parseConfigFileHost, configFileContext);
46
- return Object.assign(Object.assign({}, parsedConfigFile), { options: Object.assign(Object.assign({}, parsedConfigFile.options), { configFilePath: configFilePath }), errors: parsedConfigFileJSON.error ? [parsedConfigFileJSON.error] : parsedConfigFile.errors });
74
+ const { config: baseConfig, error: readConfigError } = typescript_1.typescript.readConfigFile(configFilePath, parseConfigFileHost.readFile);
75
+ const overwrittenConfig = applyConfigOverwrite(baseConfig || {}, getImplicitConfigOverwrite(), getUserProvidedConfigOverwrite());
76
+ const parsedConfigFile = typescript_1.typescript.parseJsonConfigFileContent(overwrittenConfig, parseConfigFileHost, configFileContext);
77
+ return Object.assign(Object.assign({}, parsedConfigFile), { options: Object.assign(Object.assign({}, parsedConfigFile.options), { configFilePath: configFilePath }), errors: readConfigError ? [readConfigError] : parsedConfigFile.errors });
47
78
  }
48
79
  exports.parseConfig = parseConfig;
49
80
  function getParseConfigIssues() {
@@ -58,19 +89,8 @@ function getParseConfigIssues() {
58
89
  exports.getParseConfigIssues = getParseConfigIssues;
59
90
  function getParsedConfig(force = false) {
60
91
  if (!parsedConfig || force) {
61
- parseConfigDiagnostics = [];
62
- parsedConfig = parseConfig(worker_config_1.config.configFile, worker_config_1.config.context, worker_config_1.config.configOverwrite);
63
- const configFilePath = (0, forward_slash_1.forwardSlash)(worker_config_1.config.configFile);
64
- const parsedConfigFileJSON = typescript_1.typescript.readConfigFile(configFilePath, parseConfigFileHost.readFile);
65
- const overwrittenConfigFileJSON = Object.assign(Object.assign(Object.assign({}, (parsedConfigFileJSON.config || {})), worker_config_1.config.configOverwrite), { compilerOptions: Object.assign(Object.assign({}, ((parsedConfigFileJSON.config || {}).compilerOptions || {})), (worker_config_1.config.configOverwrite.compilerOptions || {})) });
66
- parsedConfig = typescript_1.typescript.parseJsonConfigFileContent(overwrittenConfigFileJSON, parseConfigFileHost, worker_config_1.config.context);
67
- parsedConfig.options.configFilePath = configFilePath;
68
- parsedConfig.errors = parsedConfigFileJSON.error
69
- ? [parsedConfigFileJSON.error]
70
- : parsedConfig.errors;
71
- if (parsedConfig.errors) {
72
- parseConfigDiagnostics.push(...parsedConfig.errors);
73
- }
92
+ parsedConfig = parseConfig(worker_config_1.config.configFile, worker_config_1.config.context);
93
+ parseConfigDiagnostics = parsedConfig.errors || [];
74
94
  }
75
95
  return parsedConfig;
76
96
  }
@@ -104,6 +124,12 @@ function didConfigFileChanged({ changedFiles = [], deletedFiles = [] }) {
104
124
  .includes(path.normalize(worker_config_1.config.configFile));
105
125
  }
106
126
  exports.didConfigFileChanged = didConfigFileChanged;
127
+ function didDependenciesProbablyChanged(dependencies, { changedFiles = [], deletedFiles = [] }) {
128
+ const didSomeDependencyHasBeenAdded = changedFiles.some((changeFile) => !dependencies.files.includes(changeFile));
129
+ const didSomeDependencyHasBeenDeleted = deletedFiles.some((deletedFile) => dependencies.files.includes(deletedFile));
130
+ return didSomeDependencyHasBeenAdded || didSomeDependencyHasBeenDeleted;
131
+ }
132
+ exports.didDependenciesProbablyChanged = didDependenciesProbablyChanged;
107
133
  function didRootFilesChanged() {
108
134
  const [prevConfig, nextConfig] = parseNextConfig();
109
135
  return (prevConfig && JSON.stringify(prevConfig.fileNames) !== JSON.stringify(nextConfig.fileNames));
@@ -0,0 +1,2 @@
1
+ import type * as ts from 'typescript';
2
+ export declare function emitDtsIfNeeded(program: ts.Program | ts.BuilderProgram): void;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.emitDtsIfNeeded = void 0;
4
+ const config_1 = require("./config");
5
+ const worker_config_1 = require("./worker-config");
6
+ function emitDtsIfNeeded(program) {
7
+ const parsedConfig = (0, config_1.getParsedConfig)();
8
+ if (worker_config_1.config.mode === 'write-dts' && parsedConfig.options.declaration) {
9
+ // emit .d.ts files only
10
+ program.emit(undefined, undefined, undefined, true);
11
+ }
12
+ }
13
+ exports.emitDtsIfNeeded = emitDtsIfNeeded;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.invalidateProgram = exports.useProgram = void 0;
4
4
  const config_1 = require("../config");
5
5
  const diagnostics_1 = require("../diagnostics");
6
+ const emit_1 = require("../emit");
6
7
  const compiler_host_1 = require("../host/compiler-host");
7
8
  const typescript_1 = require("../typescript");
8
9
  let compilerHost;
@@ -21,6 +22,7 @@ function useProgram() {
21
22
  });
22
23
  }
23
24
  (0, diagnostics_1.updateDiagnostics)((0, config_1.getConfigFilePathFromProgram)(program), (0, diagnostics_1.getDiagnosticsOfProgram)(program));
25
+ (0, emit_1.emitDtsIfNeeded)(program);
24
26
  }
25
27
  exports.useProgram = useProgram;
26
28
  function invalidateProgram(withHost = false) {
@@ -4,6 +4,7 @@ exports.invalidateWatchProgramRootFileNames = exports.invalidateWatchProgram = e
4
4
  const config_1 = require("../config");
5
5
  const dependencies_1 = require("../dependencies");
6
6
  const diagnostics_1 = require("../diagnostics");
7
+ const emit_1 = require("../emit");
7
8
  const watch_compiler_host_1 = require("../host/watch-compiler-host");
8
9
  const tracing_1 = require("../tracing");
9
10
  const tsbuildinfo_1 = require("../tsbuildinfo");
@@ -21,6 +22,7 @@ function useWatchProgram() {
21
22
  return typescript_1.typescript.createSemanticDiagnosticsBuilderProgram(rootNames, compilerOptions, host, oldProgram, configFileParsingDiagnostics, projectReferences);
22
23
  }, undefined, undefined, (builderProgram) => {
23
24
  (0, diagnostics_1.updateDiagnostics)((0, config_1.getConfigFilePathFromBuilderProgram)(builderProgram), (0, diagnostics_1.getDiagnosticsOfProgram)(builderProgram));
25
+ (0, emit_1.emitDtsIfNeeded)(builderProgram);
24
26
  (0, tsbuildinfo_1.emitTsBuildInfoIfNeeded)(builderProgram);
25
27
  (0, tracing_1.stopTracingIfNeeded)(builderProgram);
26
28
  });
@@ -108,13 +108,13 @@ exports.system = Object.assign(Object.assign({}, typescript_1.typescript.sys), {
108
108
  });
109
109
  },
110
110
  invokeFileCreated(path) {
111
- const normalizedPath = real_file_system_1.realFileSystem.normalizePath(path);
111
+ const normalizedPath = normalizeAndResolvePath(path);
112
112
  invokeFileWatchers(path, typescript_1.typescript.FileWatcherEventKind.Created);
113
113
  invokeDirectoryWatchers(normalizedPath);
114
114
  deletedFiles.set(normalizedPath, false);
115
115
  },
116
116
  invokeFileChanged(path) {
117
- const normalizedPath = real_file_system_1.realFileSystem.normalizePath(path);
117
+ const normalizedPath = normalizeAndResolvePath(path);
118
118
  if (deletedFiles.get(normalizedPath) || !fileWatcherCallbacksMap.has(normalizedPath)) {
119
119
  invokeFileWatchers(path, typescript_1.typescript.FileWatcherEventKind.Created);
120
120
  invokeDirectoryWatchers(normalizedPath);
@@ -125,7 +125,7 @@ exports.system = Object.assign(Object.assign({}, typescript_1.typescript.sys), {
125
125
  }
126
126
  },
127
127
  invokeFileDeleted(path) {
128
- const normalizedPath = real_file_system_1.realFileSystem.normalizePath(path);
128
+ const normalizedPath = normalizeAndResolvePath(path);
129
129
  if (!deletedFiles.get(normalizedPath)) {
130
130
  invokeFileWatchers(path, typescript_1.typescript.FileWatcherEventKind.Deleted);
131
131
  invokeDirectoryWatchers(path);
@@ -141,7 +141,7 @@ exports.system = Object.assign(Object.assign({}, typescript_1.typescript.sys), {
141
141
  artifacts = nextArtifacts;
142
142
  } });
143
143
  function createWatcher(watchersMap, path, callback) {
144
- const normalizedPath = real_file_system_1.realFileSystem.normalizePath(path);
144
+ const normalizedPath = normalizeAndResolvePath(path);
145
145
  const watchers = watchersMap.get(normalizedPath) || [];
146
146
  const nextWatchers = [...watchers, callback];
147
147
  watchersMap.set(normalizedPath, nextWatchers);
@@ -159,7 +159,7 @@ function createWatcher(watchersMap, path, callback) {
159
159
  };
160
160
  }
161
161
  function invokeFileWatchers(path, event) {
162
- const normalizedPath = real_file_system_1.realFileSystem.normalizePath(path);
162
+ const normalizedPath = normalizeAndResolvePath(path);
163
163
  if (normalizedPath.endsWith('.js')) {
164
164
  // trigger relevant .d.ts file watcher - handles the case, when we have webpack watcher
165
165
  // that points to a symlinked package
@@ -172,7 +172,7 @@ function invokeFileWatchers(path, event) {
172
172
  }
173
173
  }
174
174
  function invokeDirectoryWatchers(path) {
175
- const normalizedPath = real_file_system_1.realFileSystem.normalizePath(path);
175
+ const normalizedPath = normalizeAndResolvePath(path);
176
176
  const directory = (0, path_1.dirname)(normalizedPath);
177
177
  if (ignoredPaths.some((ignoredPath) => (0, forward_slash_1.forwardSlash)(normalizedPath).includes(ignoredPath))) {
178
178
  return;
@@ -189,6 +189,16 @@ function invokeDirectoryWatchers(path) {
189
189
  }
190
190
  });
191
191
  }
192
+ function normalizeAndResolvePath(path) {
193
+ let normalizedPath = real_file_system_1.realFileSystem.normalizePath(path);
194
+ try {
195
+ normalizedPath = real_file_system_1.realFileSystem.realPath(normalizedPath);
196
+ }
197
+ catch (error) {
198
+ // ignore error - maybe file doesn't exist
199
+ }
200
+ return normalizedPath;
201
+ }
192
202
  function isArtifact(path) {
193
203
  return ((artifacts.dirs.some((dir) => path.includes(dir)) ||
194
204
  artifacts.files.some((file) => path === file)) &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fork-ts-checker-webpack-plugin",
3
- "version": "7.0.0",
3
+ "version": "7.2.1",
4
4
  "description": "Runs typescript type checker and linter on separate process.",
5
5
  "keywords": [
6
6
  "webpack",
@@ -107,7 +107,7 @@
107
107
  "jest": "^27.4.7",
108
108
  "jest-circus": "^27.4.6",
109
109
  "jest-environment-node": "^27.4.6",
110
- "json-schema": "^0.3.0",
110
+ "json-schema": "^0.4.0",
111
111
  "karton": "^0.4.1",
112
112
  "lint-staged": "^11.1.2",
113
113
  "mock-fs": "^5.1.2",