fork-ts-checker-webpack-plugin 7.2.1 → 7.2.4

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
@@ -347,10 +347,10 @@ yarn add --dev @types/webpack
347
347
 
348
348
  ## Profiling types resolution
349
349
 
350
- Starting from TypeScript 4.1.0, you can profile long type checks by
350
+ When using TypeScript 4.3.0 or newer 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
- 1. Set "generateTrace": "{folderName}" in your `tsconfig.json`
353
+ 1. Set "generateTrace": "{folderName}" in your `tsconfig.json` (under `compilerOptions`)
354
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`
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.2.1'; // will be replaced by the @semantic-release/exec
73
+ ForkTsCheckerWebpackPlugin.version = '7.2.4'; // will be replaced by the @semantic-release/exec
74
74
  /**
75
75
  * Default pools for the plugin concurrency limit
76
76
  */
@@ -5,6 +5,7 @@ const config_1 = require("../config");
5
5
  const diagnostics_1 = require("../diagnostics");
6
6
  const emit_1 = require("../emit");
7
7
  const compiler_host_1 = require("../host/compiler-host");
8
+ const tracing_1 = require("../tracing");
8
9
  const typescript_1 = require("../typescript");
9
10
  let compilerHost;
10
11
  let program;
@@ -14,6 +15,7 @@ function useProgram() {
14
15
  compilerHost = (0, compiler_host_1.createCompilerHost)(parsedConfig);
15
16
  }
16
17
  if (!program) {
18
+ (0, tracing_1.startTracingIfNeeded)(parsedConfig.options);
17
19
  program = typescript_1.typescript.createProgram({
18
20
  rootNames: parsedConfig.fileNames,
19
21
  options: parsedConfig.options,
@@ -23,6 +25,7 @@ function useProgram() {
23
25
  }
24
26
  (0, diagnostics_1.updateDiagnostics)((0, config_1.getConfigFilePathFromProgram)(program), (0, diagnostics_1.getDiagnosticsOfProgram)(program));
25
27
  (0, emit_1.emitDtsIfNeeded)(program);
28
+ (0, tracing_1.stopTracingIfNeeded)(program);
26
29
  }
27
30
  exports.useProgram = useProgram;
28
31
  function invalidateProgram(withHost = false) {
@@ -1,4 +1,4 @@
1
1
  import type * as ts from 'typescript';
2
2
  export declare function startTracingIfNeeded(compilerOptions: ts.CompilerOptions): void;
3
- export declare function stopTracingIfNeeded(program: ts.BuilderProgram): void;
3
+ export declare function stopTracingIfNeeded(program: ts.Program | ts.BuilderProgram): void;
4
4
  export declare function dumpTracingLegendIfNeeded(): void;
@@ -5,24 +5,25 @@ const config_1 = require("./config");
5
5
  const typescript_1 = require("./typescript");
6
6
  const worker_config_1 = require("./worker-config");
7
7
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
- const tracing = typescript_1.typescript.tracing;
8
+ const traceableTypescript = typescript_1.typescript;
9
9
  function startTracingIfNeeded(compilerOptions) {
10
- if (compilerOptions.generateTrace && tracing) {
11
- tracing.startTracing((0, config_1.getConfigFilePathFromCompilerOptions)(compilerOptions), compilerOptions.generateTrace, worker_config_1.config.build);
10
+ if (typeof compilerOptions.generateTrace === 'string' &&
11
+ typeof traceableTypescript.startTracing === 'function') {
12
+ traceableTypescript.startTracing(worker_config_1.config.build ? 'build' : 'project', compilerOptions.generateTrace, (0, config_1.getConfigFilePathFromCompilerOptions)(compilerOptions));
12
13
  }
13
14
  }
14
15
  exports.startTracingIfNeeded = startTracingIfNeeded;
15
16
  function stopTracingIfNeeded(program) {
17
+ var _a;
16
18
  const compilerOptions = program.getCompilerOptions();
17
- if (compilerOptions.generateTrace && tracing) {
18
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
- tracing.stopTracing(program.getProgram().getTypeCatalog());
19
+ if (typeof compilerOptions.generateTrace === 'string' &&
20
+ typeof ((_a = traceableTypescript.tracing) === null || _a === void 0 ? void 0 : _a.stopTracing) === 'function') {
21
+ traceableTypescript.tracing.stopTracing();
20
22
  }
21
23
  }
22
24
  exports.stopTracingIfNeeded = stopTracingIfNeeded;
23
25
  function dumpTracingLegendIfNeeded() {
24
- if (tracing) {
25
- tracing.dumpLegend();
26
- }
26
+ var _a;
27
+ (_a = traceableTypescript.tracing) === null || _a === void 0 ? void 0 : _a.dumpLegend();
27
28
  }
28
29
  exports.dumpTracingLegendIfNeeded = dumpTracingLegendIfNeeded;
@@ -10,6 +10,8 @@ const minimatch_1 = __importDefault(require("minimatch"));
10
10
  const files_change_1 = require("../files-change");
11
11
  const infrastructure_logger_1 = require("../infrastructure-logger");
12
12
  const BUILTIN_IGNORED_DIRS = ['node_modules', '.git', '.yarn', '.pnp'];
13
+ // we ignore package.json file because of https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues/674
14
+ const BUILTIN_IGNORED_FILES = ['package.json'];
13
15
  function createIsIgnored(ignored, excluded) {
14
16
  const ignoredPatterns = ignored ? (Array.isArray(ignored) ? ignored : [ignored]) : [];
15
17
  const ignoredFunctions = ignoredPatterns.map((pattern) => {
@@ -27,6 +29,7 @@ function createIsIgnored(ignored, excluded) {
27
29
  });
28
30
  ignoredFunctions.push((path) => excluded.some((excludedPath) => path.startsWith(excludedPath)));
29
31
  ignoredFunctions.push((path) => BUILTIN_IGNORED_DIRS.some((ignoredDir) => path.includes(`/${ignoredDir}/`)));
32
+ ignoredFunctions.push((path) => BUILTIN_IGNORED_FILES.some((ignoredFile) => path.endsWith(`/${ignoredFile}`)));
30
33
  return function isIgnored(path) {
31
34
  return ignoredFunctions.some((ignoredFunction) => ignoredFunction(path));
32
35
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fork-ts-checker-webpack-plugin",
3
- "version": "7.2.1",
3
+ "version": "7.2.4",
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
  },