fork-ts-checker-webpack-plugin 7.0.0-alpha.11 → 7.0.0-alpha.15

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.
Files changed (166) hide show
  1. package/README.md +39 -24
  2. package/lib/files-change.d.ts +2 -1
  3. package/lib/files-change.js +20 -13
  4. package/lib/formatter/{BasicFormatter.d.ts → basic-formatter.d.ts} +1 -1
  5. package/lib/formatter/{BasicFormatter.js → basic-formatter.js} +0 -0
  6. package/lib/formatter/{CodeFrameFormatter.d.ts → code-frame-formatter.d.ts} +1 -1
  7. package/lib/formatter/{CodeFrameFormatter.js → code-frame-formatter.js} +2 -2
  8. package/lib/formatter/formatter-config.d.ts +5 -0
  9. package/lib/formatter/{FormatterConfiguration.js → formatter-config.js} +8 -8
  10. package/lib/formatter/{FormatterOptions.d.ts → formatter-options.d.ts} +1 -1
  11. package/lib/{ForkTsCheckerWebpackPluginOptions.js → formatter/formatter-options.js} +0 -0
  12. package/lib/formatter/{Formatter.d.ts → formatter.d.ts} +0 -0
  13. package/lib/formatter/{Formatter.js → formatter.js} +0 -0
  14. package/lib/formatter/index.d.ts +6 -6
  15. package/lib/formatter/index.js +6 -6
  16. package/lib/formatter/{WebpackFormatter.d.ts → webpack-formatter.d.ts} +1 -1
  17. package/lib/formatter/{WebpackFormatter.js → webpack-formatter.js} +2 -2
  18. package/lib/hooks/intercept-done-to-get-dev-server-tap.d.ts +5 -0
  19. package/lib/hooks/{interceptDoneToGetWebpackDevServerTap.js → intercept-done-to-get-dev-server-tap.js} +4 -6
  20. package/lib/hooks/tap-after-compile-to-add-dependencies.d.ts +5 -0
  21. package/lib/hooks/{tapAfterCompileToAddDependencies.js → tap-after-compile-to-add-dependencies.js} +1 -1
  22. package/lib/hooks/tap-after-compile-to-get-issues.d.ts +5 -0
  23. package/lib/hooks/{tapAfterCompileToGetIssues.js → tap-after-compile-to-get-issues.js} +6 -6
  24. package/lib/hooks/{tapAfterEnvironmentToPatchWatching.d.ts → tap-after-environment-to-patch-watching.d.ts} +1 -1
  25. package/lib/hooks/{tapAfterEnvironmentToPatchWatching.js → tap-after-environment-to-patch-watching.js} +2 -2
  26. package/lib/hooks/tap-done-to-async-get-issues.d.ts +5 -0
  27. package/lib/hooks/{tapDoneToAsyncGetIssues.js → tap-done-to-async-get-issues.js} +15 -15
  28. package/lib/hooks/tap-error-to-log-message.d.ts +4 -0
  29. package/lib/hooks/{tapErrorToLogMessage.js → tap-error-to-log-message.js} +7 -7
  30. package/lib/hooks/{tapStartToRunWorkers.d.ts → tap-start-to-run-workers.d.ts} +4 -4
  31. package/lib/hooks/{tapStartToRunWorkers.js → tap-start-to-run-workers.js} +13 -13
  32. package/lib/hooks/{tapStopToTerminateWorkers.d.ts → tap-stop-to-terminate-workers.d.ts} +2 -2
  33. package/lib/hooks/{tapStopToTerminateWorkers.js → tap-stop-to-terminate-workers.js} +0 -0
  34. package/lib/index.d.ts +1 -1
  35. package/lib/index.js +2 -2
  36. package/lib/infrastructure-logger.d.ts +1 -2
  37. package/lib/issue/index.d.ts +3 -3
  38. package/lib/issue/index.js +3 -3
  39. package/lib/issue/issue-config.d.ts +8 -0
  40. package/lib/issue/issue-config.js +29 -0
  41. package/lib/issue/{IssueLocation.d.ts → issue-location.d.ts} +1 -1
  42. package/lib/issue/{IssueLocation.js → issue-location.js} +3 -3
  43. package/lib/issue/{IssueMatch.d.ts → issue-match.d.ts} +1 -1
  44. package/lib/issue/{IssueMatch.js → issue-match.js} +2 -2
  45. package/lib/issue/{IssueOptions.d.ts → issue-options.d.ts} +2 -2
  46. package/lib/{formatter/FormatterOptions.js → issue/issue-options.js} +0 -0
  47. package/lib/issue/{IssuePosition.d.ts → issue-position.d.ts} +0 -0
  48. package/lib/issue/{IssuePosition.js → issue-position.js} +0 -0
  49. package/lib/issue/{IssuePredicate.d.ts → issue-predicate.d.ts} +0 -0
  50. package/lib/issue/{IssuePredicate.js → issue-predicate.js} +0 -0
  51. package/lib/issue/{IssueSeverity.d.ts → issue-severity.d.ts} +0 -0
  52. package/lib/issue/{IssueSeverity.js → issue-severity.js} +0 -0
  53. package/lib/issue/{IssueWebpackError.d.ts → issue-webpack-error.d.ts} +1 -1
  54. package/lib/issue/{IssueWebpackError.js → issue-webpack-error.js} +4 -4
  55. package/lib/issue/{Issue.d.ts → issue.d.ts} +2 -2
  56. package/lib/issue/{Issue.js → issue.js} +5 -5
  57. package/lib/{logger/Logger.d.ts → logger.d.ts} +1 -2
  58. package/lib/{issue/IssueOptions.js → logger.js} +0 -0
  59. package/lib/plugin-config.d.ts +16 -0
  60. package/lib/plugin-config.js +17 -0
  61. package/lib/{hooks/pluginHooks.d.ts → plugin-hooks.d.ts} +6 -6
  62. package/lib/{hooks/pluginHooks.js → plugin-hooks.js} +8 -8
  63. package/lib/plugin-options.d.ts +13 -0
  64. package/lib/{logger/Logger.js → plugin-options.js} +0 -0
  65. package/lib/{ForkTsCheckerWebpackPluginOptions.json → plugin-options.json} +9 -44
  66. package/lib/{hooks/pluginPools.d.ts → plugin-pools.d.ts} +1 -1
  67. package/lib/{hooks/pluginPools.js → plugin-pools.js} +1 -1
  68. package/lib/{ForkTsCheckerWebpackPluginState.d.ts → plugin-state.d.ts} +2 -2
  69. package/lib/{ForkTsCheckerWebpackPluginState.js → plugin-state.js} +3 -3
  70. package/lib/{ForkTsCheckerWebpackPlugin.d.ts → plugin.d.ts} +2 -2
  71. package/lib/plugin.js +82 -0
  72. package/lib/{utils/rpc/expose.d.ts → rpc/expose-rpc.d.ts} +0 -0
  73. package/lib/{utils/rpc/expose.js → rpc/expose-rpc.js} +0 -0
  74. package/lib/rpc/index.d.ts +5 -0
  75. package/lib/{utils/rpc → rpc}/index.js +9 -9
  76. package/lib/{utils/rpc/error.d.ts → rpc/rpc-error.d.ts} +0 -0
  77. package/lib/{utils/rpc/error.js → rpc/rpc-error.js} +0 -0
  78. package/lib/{utils/rpc/worker.d.ts → rpc/rpc-worker.d.ts} +0 -0
  79. package/lib/{utils/rpc/worker.js → rpc/rpc-worker.js} +2 -2
  80. package/lib/{utils/rpc → rpc}/types.d.ts +0 -0
  81. package/lib/{utils/rpc → rpc}/types.js +0 -0
  82. package/lib/{utils/rpc/wrap.d.ts → rpc/wrap-rpc.d.ts} +0 -0
  83. package/lib/{utils/rpc/wrap.js → rpc/wrap-rpc.js} +2 -2
  84. package/lib/typescript/extension/{TypeScriptEmbeddedExtension.d.ts → type-script-embedded-extension.d.ts} +1 -1
  85. package/lib/typescript/extension/{TypeScriptEmbeddedExtension.js → type-script-embedded-extension.js} +0 -0
  86. package/lib/typescript/extension/{TypeScriptExtension.d.ts → type-script-extension.d.ts} +0 -0
  87. package/lib/{logger/LoggerOptions.js → typescript/extension/type-script-extension.js} +0 -0
  88. package/lib/typescript/extension/vue/type-script-vue-extension-config.d.ts +7 -0
  89. package/lib/typescript/extension/vue/{TypeScriptVueExtensionConfiguration.js → type-script-vue-extension-config.js} +3 -3
  90. package/lib/typescript/extension/vue/{TypeScriptVueExtensionOptions.d.ts → type-script-vue-extension-options.d.ts} +0 -0
  91. package/lib/typescript/{TypeScriptConfigurationOverwrite.js → extension/vue/type-script-vue-extension-options.js} +0 -0
  92. package/lib/typescript/extension/vue/type-script-vue-extension-support.d.ts +3 -0
  93. package/lib/typescript/extension/vue/{TypeScriptVueExtensionSupport.js → type-script-vue-extension-support.js} +2 -2
  94. package/lib/typescript/extension/vue/type-script-vue-extension.d.ts +4 -0
  95. package/lib/typescript/extension/vue/{TypeScriptVueExtension.js → type-script-vue-extension.js} +4 -4
  96. package/lib/typescript/{TypeScriptConfigurationOverwrite.d.ts → type-script-config-overwrite.d.ts} +2 -2
  97. package/lib/typescript/{TypeScriptDiagnosticsOptions.js → type-script-config-overwrite.js} +0 -0
  98. package/lib/typescript/{TypeScriptDiagnosticsOptions.d.ts → type-script-diagnostics-options.d.ts} +0 -0
  99. package/lib/typescript/{TypeScriptReporterOptions.js → type-script-diagnostics-options.js} +0 -0
  100. package/lib/typescript/type-script-support.d.ts +3 -0
  101. package/lib/typescript/{TypeScriptSupport.js → type-script-support.js} +8 -8
  102. package/lib/typescript/type-script-worker-config.d.ts +22 -0
  103. package/lib/typescript/{TypeScriptReporterConfiguration.js → type-script-worker-config.js} +5 -5
  104. package/lib/typescript/type-script-worker-options.d.ts +18 -0
  105. package/lib/typescript/{extension/TypeScriptExtension.js → type-script-worker-options.js} +0 -0
  106. package/lib/typescript/worker/get-dependencies-worker.js +1 -1
  107. package/lib/typescript/worker/get-issues-worker.js +2 -3
  108. package/lib/typescript/worker/lib/artifacts.js +2 -2
  109. package/lib/typescript/worker/lib/config.d.ts +2 -2
  110. package/lib/typescript/worker/lib/config.js +3 -6
  111. package/lib/typescript/worker/lib/dependencies.js +2 -2
  112. package/lib/typescript/worker/lib/extensions.d.ts +1 -1
  113. package/lib/typescript/worker/lib/extensions.js +2 -2
  114. package/lib/typescript/worker/lib/system.js +26 -13
  115. package/lib/typescript/worker/lib/worker-config.d.ts +2 -2
  116. package/lib/typescript/worker/lib/worker-config.js +1 -1
  117. package/lib/utils/async/{isPending.d.ts → is-pending.d.ts} +1 -1
  118. package/lib/utils/async/{isPending.js → is-pending.js} +2 -1
  119. package/lib/utils/async/wait.d.ts +1 -1
  120. package/lib/utils/async/wait.js +2 -1
  121. package/lib/utils/path/{forwardSlash.d.ts → forward-slash.d.ts} +1 -1
  122. package/lib/utils/path/{forwardSlash.js → forward-slash.js} +2 -1
  123. package/lib/utils/path/{relativeToContext.d.ts → relative-to-context.d.ts} +0 -0
  124. package/lib/utils/path/{relativeToContext.js → relative-to-context.js} +2 -2
  125. package/lib/watch/{InclusiveNodeWatchFileSystem.d.ts → inclusive-node-watch-file-system.d.ts} +6 -6
  126. package/lib/watch/{InclusiveNodeWatchFileSystem.js → inclusive-node-watch-file-system.js} +36 -4
  127. package/lib/watch/{WatchFileSystem.d.ts → watch-file-system.d.ts} +1 -1
  128. package/lib/{typescript/extension/vue/TypeScriptVueExtensionOptions.js → watch/watch-file-system.js} +0 -0
  129. package/package.json +8 -2
  130. package/lib/ForkTsCheckerWebpackPlugin.js +0 -84
  131. package/lib/ForkTsCheckerWebpackPluginConfiguration.d.ts +0 -15
  132. package/lib/ForkTsCheckerWebpackPluginConfiguration.js +0 -17
  133. package/lib/ForkTsCheckerWebpackPluginOptions.d.ts +0 -12
  134. package/lib/formatter/FormatterConfiguration.d.ts +0 -5
  135. package/lib/hooks/interceptDoneToGetWebpackDevServerTap.d.ts +0 -5
  136. package/lib/hooks/tapAfterCompileToAddDependencies.d.ts +0 -5
  137. package/lib/hooks/tapAfterCompileToGetIssues.d.ts +0 -5
  138. package/lib/hooks/tapDoneToAsyncGetIssues.d.ts +0 -5
  139. package/lib/hooks/tapErrorToLogMessage.d.ts +0 -4
  140. package/lib/issue/IssueConfiguration.d.ts +0 -8
  141. package/lib/issue/IssueConfiguration.js +0 -29
  142. package/lib/logger/LoggerConfiguration.d.ts +0 -10
  143. package/lib/logger/LoggerConfiguration.js +0 -12
  144. package/lib/logger/LoggerFactory.d.ts +0 -5
  145. package/lib/logger/LoggerFactory.js +0 -21
  146. package/lib/logger/LoggerOptions.d.ts +0 -8
  147. package/lib/logger/PartialLogger.d.ts +0 -4
  148. package/lib/logger/PartialLogger.js +0 -11
  149. package/lib/logger/WebpackInfrastructureLogger.d.ts +0 -4
  150. package/lib/logger/WebpackInfrastructureLogger.js +0 -13
  151. package/lib/typescript/TypeScriptReporterConfiguration.d.ts +0 -22
  152. package/lib/typescript/TypeScriptReporterOptions.d.ts +0 -18
  153. package/lib/typescript/TypeScriptSupport.d.ts +0 -3
  154. package/lib/typescript/extension/vue/TypeScriptVueExtension.d.ts +0 -4
  155. package/lib/typescript/extension/vue/TypeScriptVueExtensionConfiguration.d.ts +0 -7
  156. package/lib/typescript/extension/vue/TypeScriptVueExtensionSupport.d.ts +0 -3
  157. package/lib/utils/array/flatten.d.ts +0 -2
  158. package/lib/utils/array/flatten.js +0 -6
  159. package/lib/utils/array/intersect.d.ts +0 -2
  160. package/lib/utils/array/intersect.js +0 -6
  161. package/lib/utils/array/substract.d.ts +0 -2
  162. package/lib/utils/array/substract.js +0 -6
  163. package/lib/utils/array/unique.d.ts +0 -2
  164. package/lib/utils/array/unique.js +0 -6
  165. package/lib/utils/rpc/index.d.ts +0 -5
  166. package/lib/watch/WatchFileSystem.js +0 -2
@@ -12,20 +12,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.tapStartToRunWorkers = void 0;
13
13
  const files_change_1 = require("../files-change");
14
14
  const infrastructure_logger_1 = require("../infrastructure-logger");
15
- const interceptDoneToGetWebpackDevServerTap_1 = require("./interceptDoneToGetWebpackDevServerTap");
16
- const pluginHooks_1 = require("./pluginHooks");
17
- const pluginPools_1 = require("./pluginPools");
18
- const tapAfterCompileToGetIssues_1 = require("./tapAfterCompileToGetIssues");
19
- const tapDoneToAsyncGetIssues_1 = require("./tapDoneToAsyncGetIssues");
15
+ const plugin_hooks_1 = require("../plugin-hooks");
16
+ const plugin_pools_1 = require("../plugin-pools");
17
+ const intercept_done_to_get_dev_server_tap_1 = require("./intercept-done-to-get-dev-server-tap");
18
+ const tap_after_compile_to_get_issues_1 = require("./tap-after-compile-to-get-issues");
19
+ const tap_done_to_async_get_issues_1 = require("./tap-done-to-async-get-issues");
20
20
  function tapStartToRunWorkers(compiler, getIssuesWorker, getDependenciesWorker, config, state) {
21
- const hooks = pluginHooks_1.getForkTsCheckerWebpackPluginHooks(compiler);
21
+ const hooks = plugin_hooks_1.getPluginHooks(compiler);
22
22
  const { log, debug } = infrastructure_logger_1.getInfrastructureLogger(compiler);
23
23
  compiler.hooks.run.tap('ForkTsCheckerWebpackPlugin', () => {
24
24
  if (!state.initialized) {
25
25
  debug('Initializing plugin for single run (not async).');
26
26
  state.initialized = true;
27
27
  state.watching = false;
28
- tapAfterCompileToGetIssues_1.tapAfterCompileToGetIssues(compiler, config, state);
28
+ tap_after_compile_to_get_issues_1.tapAfterCompileToGetIssues(compiler, config, state);
29
29
  }
30
30
  });
31
31
  compiler.hooks.watchRun.tap('ForkTsCheckerWebpackPlugin', () => __awaiter(this, void 0, void 0, function* () {
@@ -34,12 +34,12 @@ function tapStartToRunWorkers(compiler, getIssuesWorker, getDependenciesWorker,
34
34
  state.watching = true;
35
35
  if (config.async) {
36
36
  debug('Initializing plugin for watch run (async).');
37
- tapDoneToAsyncGetIssues_1.tapDoneToAsyncGetIssues(compiler, config, state);
38
- interceptDoneToGetWebpackDevServerTap_1.interceptDoneToGetWebpackDevServerTap(compiler, config, state);
37
+ tap_done_to_async_get_issues_1.tapDoneToAsyncGetIssues(compiler, config, state);
38
+ intercept_done_to_get_dev_server_tap_1.interceptDoneToGetDevServerTap(compiler, config, state);
39
39
  }
40
40
  else {
41
41
  debug('Initializing plugin for watch run (not async).');
42
- tapAfterCompileToGetIssues_1.tapAfterCompileToGetIssues(compiler, config, state);
42
+ tap_after_compile_to_get_issues_1.tapAfterCompileToGetIssues(compiler, config, state);
43
43
  }
44
44
  }
45
45
  }));
@@ -51,7 +51,7 @@ function tapStartToRunWorkers(compiler, getIssuesWorker, getDependenciesWorker,
51
51
  const iteration = ++state.iteration;
52
52
  let change = {};
53
53
  if (state.watching) {
54
- change = files_change_1.getFilesChange(compiler);
54
+ change = files_change_1.consumeFilesChange(compiler);
55
55
  log([
56
56
  'Calling reporter service for incremental check.',
57
57
  ` Changed files: ${JSON.stringify(change.changedFiles)}`,
@@ -63,7 +63,7 @@ function tapStartToRunWorkers(compiler, getIssuesWorker, getDependenciesWorker,
63
63
  }
64
64
  change = yield hooks.start.promise(change, compilation);
65
65
  debug(`Submitting the getIssuesWorker to the pool, iteration ${iteration}.`);
66
- state.issuesPromise = pluginPools_1.issuesPool.submit(() => __awaiter(this, void 0, void 0, function* () {
66
+ state.issuesPromise = plugin_pools_1.issuesPool.submit(() => __awaiter(this, void 0, void 0, function* () {
67
67
  try {
68
68
  debug(`Running the getIssuesWorker, iteration ${iteration}.`);
69
69
  return yield getIssuesWorker(change, state.watching);
@@ -77,7 +77,7 @@ function tapStartToRunWorkers(compiler, getIssuesWorker, getDependenciesWorker,
77
77
  }
78
78
  }));
79
79
  debug(`Submitting the getDependenciesWorker to the pool, iteration ${iteration}.`);
80
- state.dependenciesPromise = pluginPools_1.dependenciesPool.submit(() => __awaiter(this, void 0, void 0, function* () {
80
+ state.dependenciesPromise = plugin_pools_1.dependenciesPool.submit(() => __awaiter(this, void 0, void 0, function* () {
81
81
  try {
82
82
  debug(`Running the getDependenciesWorker, iteration ${iteration}.`);
83
83
  return yield getDependenciesWorker(change);
@@ -1,5 +1,5 @@
1
1
  import type webpack from 'webpack';
2
- import type { ForkTsCheckerWebpackPluginState } from '../ForkTsCheckerWebpackPluginState';
3
- import type { RpcWorker } from '../utils/rpc';
2
+ import type { ForkTsCheckerWebpackPluginState } from '../plugin-state';
3
+ import type { RpcWorker } from '../rpc';
4
4
  declare function tapStopToTerminateWorkers(compiler: webpack.Compiler, getIssuesWorker: RpcWorker, getDependenciesWorker: RpcWorker, state: ForkTsCheckerWebpackPluginState): void;
5
5
  export { tapStopToTerminateWorkers };
package/lib/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { ForkTsCheckerWebpackPlugin } from './ForkTsCheckerWebpackPlugin';
1
+ import { ForkTsCheckerWebpackPlugin } from './plugin';
2
2
  export = ForkTsCheckerWebpackPlugin;
package/lib/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
- const ForkTsCheckerWebpackPlugin_1 = require("./ForkTsCheckerWebpackPlugin");
3
- module.exports = ForkTsCheckerWebpackPlugin_1.ForkTsCheckerWebpackPlugin;
2
+ const plugin_1 = require("./plugin");
3
+ module.exports = plugin_1.ForkTsCheckerWebpackPlugin;
@@ -1,5 +1,5 @@
1
1
  import type webpack from 'webpack';
2
- interface InfrastructureLogger {
2
+ export interface InfrastructureLogger {
3
3
  log(...args: unknown[]): void;
4
4
  debug(...args: unknown[]): void;
5
5
  error(...args: unknown[]): void;
@@ -7,4 +7,3 @@ interface InfrastructureLogger {
7
7
  info(...args: unknown[]): void;
8
8
  }
9
9
  export declare function getInfrastructureLogger(compiler: webpack.Compiler): InfrastructureLogger;
10
- export {};
@@ -1,3 +1,3 @@
1
- export * from './Issue';
2
- export * from './IssueSeverity';
3
- export * from './IssueLocation';
1
+ export * from './issue';
2
+ export * from './issue-severity';
3
+ export * from './issue-location';
@@ -10,6 +10,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
10
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./Issue"), exports);
14
- __exportStar(require("./IssueSeverity"), exports);
15
- __exportStar(require("./IssueLocation"), exports);
13
+ __exportStar(require("./issue"), exports);
14
+ __exportStar(require("./issue-severity"), exports);
15
+ __exportStar(require("./issue-location"), exports);
@@ -0,0 +1,8 @@
1
+ import type webpack from 'webpack';
2
+ import type { IssueOptions } from './issue-options';
3
+ import type { IssuePredicate } from './issue-predicate';
4
+ interface IssueConfig {
5
+ predicate: IssuePredicate;
6
+ }
7
+ declare function createIssueConfig(compiler: webpack.Compiler, options: IssueOptions | undefined): IssueConfig;
8
+ export { IssueConfig, createIssueConfig };
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createIssueConfig = void 0;
4
+ const issue_match_1 = require("./issue-match");
5
+ const issue_predicate_1 = require("./issue-predicate");
6
+ function createIssuePredicateFromOption(context, option) {
7
+ if (Array.isArray(option)) {
8
+ return issue_predicate_1.composeIssuePredicates(option.map((option) => typeof option === 'function' ? option : issue_match_1.createIssuePredicateFromIssueMatch(context, option)));
9
+ }
10
+ return typeof option === 'function'
11
+ ? option
12
+ : issue_match_1.createIssuePredicateFromIssueMatch(context, option);
13
+ }
14
+ function createIssueConfig(compiler, options) {
15
+ const context = compiler.options.context || process.cwd();
16
+ if (!options) {
17
+ options = {};
18
+ }
19
+ const include = options.include
20
+ ? createIssuePredicateFromOption(context, options.include)
21
+ : issue_predicate_1.createTrivialIssuePredicate(true);
22
+ const exclude = options.exclude
23
+ ? createIssuePredicateFromOption(context, options.exclude)
24
+ : issue_predicate_1.createTrivialIssuePredicate(false);
25
+ return {
26
+ predicate: (issue) => include(issue) && !exclude(issue),
27
+ };
28
+ }
29
+ exports.createIssueConfig = createIssueConfig;
@@ -1,4 +1,4 @@
1
- import type { IssuePosition } from './IssuePosition';
1
+ import type { IssuePosition } from './issue-position';
2
2
  interface IssueLocation {
3
3
  start: IssuePosition;
4
4
  end: IssuePosition;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.formatIssueLocation = exports.compareIssueLocations = void 0;
4
- const IssuePosition_1 = require("./IssuePosition");
4
+ const issue_position_1 = require("./issue-position");
5
5
  function compareIssueLocations(locationA, locationB) {
6
6
  if (locationA === locationB) {
7
7
  return 0;
@@ -12,8 +12,8 @@ function compareIssueLocations(locationA, locationB) {
12
12
  if (!locationB) {
13
13
  return 1;
14
14
  }
15
- return (IssuePosition_1.compareIssuePositions(locationA.start, locationB.start) ||
16
- IssuePosition_1.compareIssuePositions(locationA.end, locationB.end));
15
+ return (issue_position_1.compareIssuePositions(locationA.start, locationB.start) ||
16
+ issue_position_1.compareIssuePositions(locationA.end, locationB.end));
17
17
  }
18
18
  exports.compareIssueLocations = compareIssueLocations;
19
19
  function formatIssueLocation({ start, end }) {
@@ -1,4 +1,4 @@
1
- import type { IssuePredicate } from './IssuePredicate';
1
+ import type { IssuePredicate } from './issue-predicate';
2
2
  import type { Issue } from './index';
3
3
  declare type IssueMatch = Partial<Pick<Issue, 'severity' | 'code' | 'file'>>;
4
4
  declare function createIssuePredicateFromIssueMatch(context: string, match: IssueMatch): IssuePredicate;
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createIssuePredicateFromIssueMatch = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const minimatch_1 = __importDefault(require("minimatch"));
9
- const forwardSlash_1 = __importDefault(require("../utils/path/forwardSlash"));
9
+ const forward_slash_1 = require("../utils/path/forward-slash");
10
10
  function createIssuePredicateFromIssueMatch(context, match) {
11
11
  return (issue) => {
12
12
  const matchesSeverity = !match.severity || match.severity === issue.severity;
13
13
  const matchesCode = !match.code || match.code === issue.code;
14
14
  const matchesFile = !issue.file ||
15
15
  (!!issue.file &&
16
- (!match.file || minimatch_1.default(forwardSlash_1.default(path_1.default.relative(context, issue.file)), match.file)));
16
+ (!match.file || minimatch_1.default(forward_slash_1.forwardSlash(path_1.default.relative(context, issue.file)), match.file)));
17
17
  return matchesSeverity && matchesCode && matchesFile;
18
18
  };
19
19
  }
@@ -1,5 +1,5 @@
1
- import type { IssueMatch } from './IssueMatch';
2
- import type { IssuePredicate } from './IssuePredicate';
1
+ import type { IssueMatch } from './issue-match';
2
+ import type { IssuePredicate } from './issue-predicate';
3
3
  declare type IssuePredicateOption = IssuePredicate | IssueMatch | (IssuePredicate | IssueMatch)[];
4
4
  interface IssueOptions {
5
5
  include?: IssuePredicateOption;
@@ -1,5 +1,5 @@
1
1
  import webpack from 'webpack';
2
- import type { Issue } from './Issue';
2
+ import type { Issue } from './issue';
3
3
  declare class IssueWebpackError extends webpack.WebpackError {
4
4
  readonly issue: Issue;
5
5
  readonly hideStack = true;
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.IssueWebpackError = void 0;
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
8
  const webpack_1 = __importDefault(require("webpack"));
9
- const relativeToContext_1 = require("../utils/path/relativeToContext");
10
- const IssueLocation_1 = require("./IssueLocation");
9
+ const relative_to_context_1 = require("../utils/path/relative-to-context");
10
+ const issue_location_1 = require("./issue-location");
11
11
  class IssueWebpackError extends webpack_1.default.WebpackError {
12
12
  constructor(message, issue) {
13
13
  super(message);
@@ -17,9 +17,9 @@ class IssueWebpackError extends webpack_1.default.WebpackError {
17
17
  // should be a NormalModule instance.
18
18
  // to avoid such a dependency, we do a workaround - error.file will contain formatted location instead
19
19
  if (issue.file) {
20
- this.file = relativeToContext_1.relativeToContext(issue.file, process.cwd());
20
+ this.file = relative_to_context_1.relativeToContext(issue.file, process.cwd());
21
21
  if (issue.location) {
22
- this.file += ` ${chalk_1.default.green.bold(IssueLocation_1.formatIssueLocation(issue.location))}`;
22
+ this.file += ` ${chalk_1.default.green.bold(issue_location_1.formatIssueLocation(issue.location))}`;
23
23
  }
24
24
  }
25
25
  Error.captureStackTrace(this, this.constructor);
@@ -1,5 +1,5 @@
1
- import type { IssueLocation } from './IssueLocation';
2
- import type { IssueSeverity } from './IssueSeverity';
1
+ import type { IssueLocation } from './issue-location';
2
+ import type { IssueSeverity } from './issue-severity';
3
3
  interface Issue {
4
4
  severity: IssueSeverity;
5
5
  code: string;
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deduplicateAndSortIssues = exports.isIssue = void 0;
4
- const IssueLocation_1 = require("./IssueLocation");
5
- const IssueSeverity_1 = require("./IssueSeverity");
4
+ const issue_location_1 = require("./issue-location");
5
+ const issue_severity_1 = require("./issue-severity");
6
6
  function isIssue(value) {
7
7
  return (!!value &&
8
8
  typeof value === 'object' &&
9
- IssueSeverity_1.isIssueSeverity(value.severity) &&
9
+ issue_severity_1.isIssueSeverity(value.severity) &&
10
10
  !!value.code &&
11
11
  !!value.message);
12
12
  }
@@ -24,9 +24,9 @@ function compareStrings(stringA, stringB) {
24
24
  return stringA.toString().localeCompare(stringB.toString());
25
25
  }
26
26
  function compareIssues(issueA, issueB) {
27
- return (IssueSeverity_1.compareIssueSeverities(issueA.severity, issueB.severity) ||
27
+ return (issue_severity_1.compareIssueSeverities(issueA.severity, issueB.severity) ||
28
28
  compareStrings(issueA.file, issueB.file) ||
29
- IssueLocation_1.compareIssueLocations(issueA.location, issueB.location) ||
29
+ issue_location_1.compareIssueLocations(issueA.location, issueB.location) ||
30
30
  compareStrings(issueA.code, issueB.code) ||
31
31
  compareStrings(issueA.message, issueB.message) ||
32
32
  0 /* EqualTo */);
@@ -1,6 +1,5 @@
1
1
  interface Logger {
2
- info: (message: string) => void;
3
2
  log: (message: string) => void;
4
3
  error: (message: string) => void;
5
4
  }
6
- export default Logger;
5
+ export { Logger };
File without changes
@@ -0,0 +1,16 @@
1
+ import type webpack from 'webpack';
2
+ import type { FormatterConfig } from './formatter';
3
+ import type { IssueConfig } from './issue/issue-config';
4
+ import type { Logger } from './logger';
5
+ import type { ForkTsCheckerWebpackPluginOptions } from './plugin-options';
6
+ import type { TypeScriptWorkerConfig } from './typescript/type-script-worker-config';
7
+ interface ForkTsCheckerWebpackPluginConfig {
8
+ async: boolean;
9
+ typescript: TypeScriptWorkerConfig;
10
+ issue: IssueConfig;
11
+ formatter: FormatterConfig;
12
+ logger: Logger;
13
+ devServer: boolean;
14
+ }
15
+ declare function createPluginConfig(compiler: webpack.Compiler, options?: ForkTsCheckerWebpackPluginOptions): ForkTsCheckerWebpackPluginConfig;
16
+ export { ForkTsCheckerWebpackPluginConfig, createPluginConfig };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createPluginConfig = void 0;
4
+ const formatter_1 = require("./formatter");
5
+ const issue_config_1 = require("./issue/issue-config");
6
+ const type_script_worker_config_1 = require("./typescript/type-script-worker-config");
7
+ function createPluginConfig(compiler, options = {}) {
8
+ return {
9
+ async: options.async === undefined ? compiler.options.mode === 'development' : options.async,
10
+ typescript: type_script_worker_config_1.createTypeScriptWorkerConfig(compiler, options.typescript),
11
+ issue: issue_config_1.createIssueConfig(compiler, options.issue),
12
+ formatter: formatter_1.createFormatterConfig(options.formatter),
13
+ logger: options.logger || console,
14
+ devServer: options.devServer !== false,
15
+ };
16
+ }
17
+ exports.createPluginConfig = createPluginConfig;
@@ -1,20 +1,20 @@
1
1
  import { SyncHook, SyncWaterfallHook, AsyncSeriesWaterfallHook } from 'tapable';
2
2
  import type * as webpack from 'webpack';
3
- import type { FilesChange } from '../files-change';
4
- import type { Issue } from '../issue';
5
- declare function createForkTsCheckerWebpackPluginHooks(): {
3
+ import type { FilesChange } from './files-change';
4
+ import type { Issue } from './issue';
5
+ declare function createPluginHooks(): {
6
6
  start: AsyncSeriesWaterfallHook<[FilesChange, webpack.Compilation], import("tapable").UnsetAdditionalOptions>;
7
7
  waiting: SyncHook<[webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
8
8
  canceled: SyncHook<[webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
9
9
  error: SyncHook<[Error, webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
10
10
  issues: SyncWaterfallHook<[Issue[], webpack.Compilation | undefined], void>;
11
11
  };
12
- declare type ForkTsCheckerWebpackPluginHooks = ReturnType<typeof createForkTsCheckerWebpackPluginHooks>;
13
- declare function getForkTsCheckerWebpackPluginHooks(compiler: webpack.Compiler | webpack.MultiCompiler): {
12
+ declare type ForkTsCheckerWebpackPluginHooks = ReturnType<typeof createPluginHooks>;
13
+ declare function getPluginHooks(compiler: webpack.Compiler | webpack.MultiCompiler): {
14
14
  start: AsyncSeriesWaterfallHook<[FilesChange, webpack.Compilation], import("tapable").UnsetAdditionalOptions>;
15
15
  waiting: SyncHook<[webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
16
16
  canceled: SyncHook<[webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
17
17
  error: SyncHook<[Error, webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
18
18
  issues: SyncWaterfallHook<[Issue[], webpack.Compilation | undefined], void>;
19
19
  };
20
- export { getForkTsCheckerWebpackPluginHooks, ForkTsCheckerWebpackPluginHooks };
20
+ export { getPluginHooks, ForkTsCheckerWebpackPluginHooks };
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getForkTsCheckerWebpackPluginHooks = void 0;
3
+ exports.getPluginHooks = void 0;
4
4
  const tapable_1 = require("tapable");
5
5
  const compilerHookMap = new WeakMap();
6
- function createForkTsCheckerWebpackPluginHooks() {
6
+ function createPluginHooks() {
7
7
  return {
8
8
  start: new tapable_1.AsyncSeriesWaterfallHook([
9
9
  'change',
@@ -18,28 +18,28 @@ function createForkTsCheckerWebpackPluginHooks() {
18
18
  ]),
19
19
  };
20
20
  }
21
- function forwardForkTsCheckerWebpackPluginHooks(source, target) {
21
+ function forwardPluginHooks(source, target) {
22
22
  source.start.tapPromise('ForkTsCheckerWebpackPlugin', target.start.promise);
23
23
  source.waiting.tap('ForkTsCheckerWebpackPlugin', target.waiting.call);
24
24
  source.canceled.tap('ForkTsCheckerWebpackPlugin', target.canceled.call);
25
25
  source.error.tap('ForkTsCheckerWebpackPlugin', target.error.call);
26
26
  source.issues.tap('ForkTsCheckerWebpackPlugin', target.issues.call);
27
27
  }
28
- function getForkTsCheckerWebpackPluginHooks(compiler) {
28
+ function getPluginHooks(compiler) {
29
29
  let hooks = compilerHookMap.get(compiler);
30
30
  if (hooks === undefined) {
31
- hooks = createForkTsCheckerWebpackPluginHooks();
31
+ hooks = createPluginHooks();
32
32
  compilerHookMap.set(compiler, hooks);
33
33
  // proxy hooks for multi-compiler
34
34
  if ('compilers' in compiler) {
35
35
  compiler.compilers.forEach((childCompiler) => {
36
- const childHooks = getForkTsCheckerWebpackPluginHooks(childCompiler);
36
+ const childHooks = getPluginHooks(childCompiler);
37
37
  if (hooks) {
38
- forwardForkTsCheckerWebpackPluginHooks(childHooks, hooks);
38
+ forwardPluginHooks(childHooks, hooks);
39
39
  }
40
40
  });
41
41
  }
42
42
  }
43
43
  return hooks;
44
44
  }
45
- exports.getForkTsCheckerWebpackPluginHooks = getForkTsCheckerWebpackPluginHooks;
45
+ exports.getPluginHooks = getPluginHooks;
@@ -0,0 +1,13 @@
1
+ import type { FormatterOptions } from './formatter';
2
+ import type { IssueOptions } from './issue/issue-options';
3
+ import type { Logger } from './logger';
4
+ import type { TypeScriptWorkerOptions } from './typescript/type-script-worker-options';
5
+ interface ForkTsCheckerWebpackPluginOptions {
6
+ async?: boolean;
7
+ typescript?: TypeScriptWorkerOptions;
8
+ formatter?: FormatterOptions;
9
+ issue?: IssueOptions;
10
+ logger?: Logger;
11
+ devServer?: boolean;
12
+ }
13
+ export { ForkTsCheckerWebpackPluginOptions };
File without changes
@@ -7,7 +7,7 @@
7
7
  "description": "When true, plugin will not block compilation to finish issues checking"
8
8
  },
9
9
  "typescript": {
10
- "$ref": "#/definitions/TypeScriptReporterOptions"
10
+ "$ref": "#/definitions/TypeScriptOptions"
11
11
  },
12
12
  "formatter": {
13
13
  "$ref": "#/definitions/FormatterOptions"
@@ -16,7 +16,11 @@
16
16
  "$ref": "#/definitions/IssueOptions"
17
17
  },
18
18
  "logger": {
19
- "$ref": "#/definitions/LoggerOptions"
19
+ "$ref": "#/definitions/Logger"
20
+ },
21
+ "devServer": {
22
+ "type": "boolean",
23
+ "description": "Enable reporting to Webpack Dev Server."
20
24
  }
21
25
  },
22
26
  "additionalProperties": false,
@@ -90,29 +94,18 @@
90
94
  }
91
95
  ]
92
96
  },
93
- "LoggerType": {
94
- "type": "string",
95
- "enum": [
96
- "console",
97
- "webpack-infrastructure",
98
- "silent"
99
- ]
100
- },
101
97
  "Logger": {
102
98
  "type": "object",
103
99
  "properties": {
104
100
  "error": {
105
101
  "instanceof": "Function"
106
102
  },
107
- "info": {
108
- "instanceof": "Function"
109
- },
110
103
  "log": {
111
104
  "instanceof": "Function"
112
105
  }
113
106
  }
114
107
  },
115
- "TypeScriptReporterOptions": {
108
+ "TypeScriptOptions": {
116
109
  "type": "object",
117
110
  "properties": {
118
111
  "memoryLimit": {
@@ -136,9 +129,10 @@
136
129
  "enum": [
137
130
  "readonly",
138
131
  "write-tsbuildinfo",
132
+ "write-dts",
139
133
  "write-references"
140
134
  ],
141
- "description": "`readonly` keeps all emitted files in memory, `write-tsbuildinfo` which writes only .tsbuildinfo files and `write-references` which writes both .tsbuildinfo and referenced projects output"
135
+ "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"
142
136
  },
143
137
  "compilerOptions": {
144
138
  "type": "object",
@@ -225,35 +219,6 @@
225
219
  "$ref": "#/definitions/IssuePredicateOption"
226
220
  }
227
221
  }
228
- },
229
- "LoggerOptions": {
230
- "type": "object",
231
- "properties": {
232
- "infrastructure": {
233
- "oneOf": [
234
- {
235
- "$ref": "#/definitions/LoggerType"
236
- },
237
- {
238
- "$ref": "#/definitions/Logger"
239
- }
240
- ]
241
- },
242
- "issues": {
243
- "oneOf": [
244
- {
245
- "$ref": "#/definitions/LoggerType"
246
- },
247
- {
248
- "$ref": "#/definitions/Logger"
249
- }
250
- ]
251
- },
252
- "devServer": {
253
- "type": "boolean",
254
- "description": "Enable reporting to Webpack Dev Server."
255
- }
256
- }
257
222
  }
258
223
  }
259
224
  }
@@ -1,4 +1,4 @@
1
- import type { Pool } from '../utils/async/pool';
1
+ import type { Pool } from './utils/async/pool';
2
2
  declare const issuesPool: Pool;
3
3
  declare const dependenciesPool: Pool;
4
4
  export { issuesPool, dependenciesPool };
@@ -21,7 +21,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.dependenciesPool = exports.issuesPool = void 0;
23
23
  const os = __importStar(require("os"));
24
- const pool_1 = require("../utils/async/pool");
24
+ const pool_1 = require("./utils/async/pool");
25
25
  const issuesPool = pool_1.createPool(Math.max(1, os.cpus().length));
26
26
  exports.issuesPool = issuesPool;
27
27
  const dependenciesPool = pool_1.createPool(Math.max(1, os.cpus().length));
@@ -10,5 +10,5 @@ interface ForkTsCheckerWebpackPluginState {
10
10
  iteration: number;
11
11
  webpackDevServerDoneTap: FullTap | undefined;
12
12
  }
13
- declare function createForkTsCheckerWebpackPluginState(): ForkTsCheckerWebpackPluginState;
14
- export { ForkTsCheckerWebpackPluginState, createForkTsCheckerWebpackPluginState };
13
+ declare function createPluginState(): ForkTsCheckerWebpackPluginState;
14
+ export { ForkTsCheckerWebpackPluginState, createPluginState };
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createForkTsCheckerWebpackPluginState = void 0;
4
- function createForkTsCheckerWebpackPluginState() {
3
+ exports.createPluginState = void 0;
4
+ function createPluginState() {
5
5
  return {
6
6
  issuesPromise: Promise.resolve(undefined),
7
7
  dependenciesPromise: Promise.resolve(undefined),
@@ -12,4 +12,4 @@ function createForkTsCheckerWebpackPluginState() {
12
12
  webpackDevServerDoneTap: undefined,
13
13
  };
14
14
  }
15
- exports.createForkTsCheckerWebpackPluginState = createForkTsCheckerWebpackPluginState;
15
+ exports.createPluginState = createPluginState;
@@ -1,5 +1,5 @@
1
1
  import type webpack from 'webpack';
2
- import type { ForkTsCheckerWebpackPluginOptions } from './ForkTsCheckerWebpackPluginOptions';
2
+ import type { ForkTsCheckerWebpackPluginOptions } from './plugin-options';
3
3
  declare class ForkTsCheckerWebpackPlugin {
4
4
  /**
5
5
  * Current version of the plugin
@@ -21,7 +21,7 @@ declare class ForkTsCheckerWebpackPlugin {
21
21
  waiting: import("tapable").SyncHook<[webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
22
22
  canceled: import("tapable").SyncHook<[webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
23
23
  error: import("tapable").SyncHook<[Error, webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
24
- issues: import("tapable").SyncWaterfallHook<[import("./issue/Issue").Issue[], webpack.Compilation | undefined], void>;
24
+ issues: import("tapable").SyncWaterfallHook<[import("./issue/issue").Issue[], webpack.Compilation | undefined], void>;
25
25
  };
26
26
  apply(compiler: webpack.Compiler): void;
27
27
  }