fork-ts-checker-webpack-plugin 7.1.1 → 7.2.2

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,7 +83,7 @@ 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
89
  | Name | Type | Default value | Description |
@@ -92,7 +92,7 @@ Options passed to the plugin constructor will overwrite options from the cosmico
92
92
  | `typescript` | `object` | `{}` | See [TypeScript options](#typescript-options). |
93
93
  | `issue` | `object` | `{}` | See [Issues options](#issues-options). |
94
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. |
95
+ | `logger` | `{ log: function, error: function }` or `webpack-infrastructure` | `console` | Console-like object to print issues in `async` mode. |
96
96
  | `devServer` | `boolean` | `true` | If set to `false`, errors will not be reported to Webpack Dev Server. |
97
97
 
98
98
  ### TypeScript options
@@ -120,7 +120,7 @@ Options for the TypeScript checker extensions (`typescript.extensions` option ob
120
120
  |----------------|-----------------------|---------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
121
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
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) |
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
 
@@ -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:
@@ -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)).
@@ -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.1.1'; // will be replaced by the @semantic-release/exec
73
+ ForkTsCheckerWebpackPlugin.version = '7.2.2'; // will be replaced by the @semantic-release/exec
74
74
  /**
75
75
  * Default pools for the plugin concurrency limit
76
76
  */
@@ -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.1.1",
3
+ "version": "7.2.2",
4
4
  "description": "Runs typescript type checker and linter on separate process.",
5
5
  "keywords": [
6
6
  "webpack",
@@ -63,7 +63,7 @@
63
63
  "fs-extra": "^10.0.0",
64
64
  "memfs": "^3.4.1",
65
65
  "minimatch": "^3.0.4",
66
- "schema-utils": "4.0.0",
66
+ "schema-utils": "^3.1.1",
67
67
  "semver": "^7.3.5",
68
68
  "tapable": "^2.2.1"
69
69
  },