@depup/fork-ts-checker-webpack-plugin 9.1.0-depup.0

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 (169) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +42 -0
  3. package/changes.json +54 -0
  4. package/lib/files-change.d.ts +17 -0
  5. package/lib/files-change.js +57 -0
  6. package/lib/files-match.d.ts +7 -0
  7. package/lib/files-match.js +2 -0
  8. package/lib/formatter/basic-formatter.d.ts +3 -0
  9. package/lib/formatter/basic-formatter.js +13 -0
  10. package/lib/formatter/code-frame-formatter.d.ts +4 -0
  11. package/lib/formatter/code-frame-formatter.js +29 -0
  12. package/lib/formatter/formatter-config.d.ts +8 -0
  13. package/lib/formatter/formatter-config.js +36 -0
  14. package/lib/formatter/formatter-options.d.ts +14 -0
  15. package/lib/formatter/formatter-options.js +2 -0
  16. package/lib/formatter/formatter.d.ts +4 -0
  17. package/lib/formatter/formatter.js +2 -0
  18. package/lib/formatter/index.d.ts +6 -0
  19. package/lib/formatter/index.js +22 -0
  20. package/lib/formatter/stats-formatter.d.ts +3 -0
  21. package/lib/formatter/stats-formatter.js +28 -0
  22. package/lib/formatter/types/babel__code-frame.d.ts +21 -0
  23. package/lib/formatter/types/babel__code-frame.js +7 -0
  24. package/lib/formatter/webpack-formatter.d.ts +3 -0
  25. package/lib/formatter/webpack-formatter.js +32 -0
  26. package/lib/hooks/intercept-done-to-get-dev-server-tap.d.ts +5 -0
  27. package/lib/hooks/intercept-done-to-get-dev-server-tap.js +18 -0
  28. package/lib/hooks/tap-after-compile-to-add-dependencies.d.ts +5 -0
  29. package/lib/hooks/tap-after-compile-to-add-dependencies.js +31 -0
  30. package/lib/hooks/tap-after-compile-to-get-issues.d.ts +5 -0
  31. package/lib/hooks/tap-after-compile-to-get-issues.js +52 -0
  32. package/lib/hooks/tap-after-environment-to-patch-watching.d.ts +4 -0
  33. package/lib/hooks/tap-after-environment-to-patch-watching.js +22 -0
  34. package/lib/hooks/tap-done-to-async-get-issues.d.ts +5 -0
  35. package/lib/hooks/tap-done-to-async-get-issues.js +86 -0
  36. package/lib/hooks/tap-error-to-log-message.d.ts +4 -0
  37. package/lib/hooks/tap-error-to-log-message.js +32 -0
  38. package/lib/hooks/tap-start-to-run-workers.d.ts +8 -0
  39. package/lib/hooks/tap-start-to-run-workers.js +132 -0
  40. package/lib/hooks/tap-stop-to-terminate-workers.d.ts +5 -0
  41. package/lib/hooks/tap-stop-to-terminate-workers.js +26 -0
  42. package/lib/index.d.ts +2 -0
  43. package/lib/index.js +3 -0
  44. package/lib/infrastructure-logger.d.ts +9 -0
  45. package/lib/infrastructure-logger.js +14 -0
  46. package/lib/issue/index.d.ts +3 -0
  47. package/lib/issue/index.js +19 -0
  48. package/lib/issue/issue-config.d.ts +8 -0
  49. package/lib/issue/issue-config.js +29 -0
  50. package/lib/issue/issue-location.d.ts +8 -0
  51. package/lib/issue/issue-location.js +22 -0
  52. package/lib/issue/issue-match.d.ts +5 -0
  53. package/lib/issue/issue-match.js +20 -0
  54. package/lib/issue/issue-options.d.ts +8 -0
  55. package/lib/issue/issue-options.js +2 -0
  56. package/lib/issue/issue-position.d.ts +6 -0
  57. package/lib/issue/issue-position.js +16 -0
  58. package/lib/issue/issue-predicate.d.ts +5 -0
  59. package/lib/issue/issue-predicate.js +11 -0
  60. package/lib/issue/issue-severity.d.ts +4 -0
  61. package/lib/issue/issue-severity.js +12 -0
  62. package/lib/issue/issue-webpack-error.d.ts +9 -0
  63. package/lib/issue/issue-webpack-error.js +55 -0
  64. package/lib/issue/issue.d.ts +12 -0
  65. package/lib/issue/issue.js +41 -0
  66. package/lib/logger.d.ts +5 -0
  67. package/lib/logger.js +2 -0
  68. package/lib/plugin-config.d.ts +16 -0
  69. package/lib/plugin-config.js +26 -0
  70. package/lib/plugin-hooks.d.ts +20 -0
  71. package/lib/plugin-hooks.js +45 -0
  72. package/lib/plugin-options.d.ts +13 -0
  73. package/lib/plugin-options.js +2 -0
  74. package/lib/plugin-options.json +197 -0
  75. package/lib/plugin-pools.d.ts +4 -0
  76. package/lib/plugin-pools.js +32 -0
  77. package/lib/plugin-state.d.ts +18 -0
  78. package/lib/plugin-state.js +17 -0
  79. package/lib/plugin.d.ts +28 -0
  80. package/lib/plugin.js +86 -0
  81. package/lib/rpc/expose-rpc.d.ts +1 -0
  82. package/lib/rpc/expose-rpc.js +78 -0
  83. package/lib/rpc/index.d.ts +5 -0
  84. package/lib/rpc/index.js +12 -0
  85. package/lib/rpc/rpc-error.d.ts +6 -0
  86. package/lib/rpc/rpc-error.js +12 -0
  87. package/lib/rpc/rpc-worker.d.ts +13 -0
  88. package/lib/rpc/rpc-worker.js +83 -0
  89. package/lib/rpc/types.d.ts +19 -0
  90. package/lib/rpc/types.js +2 -0
  91. package/lib/rpc/wrap-rpc.d.ts +4 -0
  92. package/lib/rpc/wrap-rpc.js +79 -0
  93. package/lib/typescript/type-script-config-overwrite.d.ts +12 -0
  94. package/lib/typescript/type-script-config-overwrite.js +2 -0
  95. package/lib/typescript/type-script-diagnostics-options.d.ts +7 -0
  96. package/lib/typescript/type-script-diagnostics-options.js +2 -0
  97. package/lib/typescript/type-script-support.d.ts +3 -0
  98. package/lib/typescript/type-script-support.js +67 -0
  99. package/lib/typescript/type-script-worker-config.d.ts +17 -0
  100. package/lib/typescript/type-script-worker-config.js +18 -0
  101. package/lib/typescript/type-script-worker-options.d.ts +14 -0
  102. package/lib/typescript/type-script-worker-options.js +2 -0
  103. package/lib/typescript/worker/get-dependencies-worker.d.ts +5 -0
  104. package/lib/typescript/worker/get-dependencies-worker.js +15 -0
  105. package/lib/typescript/worker/get-issues-worker.d.ts +5 -0
  106. package/lib/typescript/worker/get-issues-worker.js +80 -0
  107. package/lib/typescript/worker/lib/artifacts.d.ts +4 -0
  108. package/lib/typescript/worker/lib/artifacts.js +94 -0
  109. package/lib/typescript/worker/lib/config.d.ts +15 -0
  110. package/lib/typescript/worker/lib/config.js +135 -0
  111. package/lib/typescript/worker/lib/dependencies.d.ts +3 -0
  112. package/lib/typescript/worker/lib/dependencies.js +85 -0
  113. package/lib/typescript/worker/lib/diagnostics.d.ts +7 -0
  114. package/lib/typescript/worker/lib/diagnostics.js +112 -0
  115. package/lib/typescript/worker/lib/emit.d.ts +2 -0
  116. package/lib/typescript/worker/lib/emit.js +13 -0
  117. package/lib/typescript/worker/lib/file-system/file-system.d.ts +18 -0
  118. package/lib/typescript/worker/lib/file-system/file-system.js +2 -0
  119. package/lib/typescript/worker/lib/file-system/mem-file-system.d.ts +5 -0
  120. package/lib/typescript/worker/lib/file-system/mem-file-system.js +78 -0
  121. package/lib/typescript/worker/lib/file-system/passive-file-system.d.ts +5 -0
  122. package/lib/typescript/worker/lib/file-system/passive-file-system.js +65 -0
  123. package/lib/typescript/worker/lib/file-system/real-file-system.d.ts +5 -0
  124. package/lib/typescript/worker/lib/file-system/real-file-system.js +191 -0
  125. package/lib/typescript/worker/lib/host/compiler-host.d.ts +2 -0
  126. package/lib/typescript/worker/lib/host/compiler-host.js +10 -0
  127. package/lib/typescript/worker/lib/host/watch-compiler-host.d.ts +2 -0
  128. package/lib/typescript/worker/lib/host/watch-compiler-host.js +20 -0
  129. package/lib/typescript/worker/lib/host/watch-solution-builder-host.d.ts +2 -0
  130. package/lib/typescript/worker/lib/host/watch-solution-builder-host.js +47 -0
  131. package/lib/typescript/worker/lib/performance.d.ts +3 -0
  132. package/lib/typescript/worker/lib/performance.js +32 -0
  133. package/lib/typescript/worker/lib/program/program.d.ts +2 -0
  134. package/lib/typescript/worker/lib/program/program.js +37 -0
  135. package/lib/typescript/worker/lib/program/solution-builder.d.ts +2 -0
  136. package/lib/typescript/worker/lib/program/solution-builder.js +39 -0
  137. package/lib/typescript/worker/lib/program/watch-program.d.ts +3 -0
  138. package/lib/typescript/worker/lib/program/watch-program.js +51 -0
  139. package/lib/typescript/worker/lib/system.d.ts +19 -0
  140. package/lib/typescript/worker/lib/system.js +232 -0
  141. package/lib/typescript/worker/lib/tracing.d.ts +4 -0
  142. package/lib/typescript/worker/lib/tracing.js +29 -0
  143. package/lib/typescript/worker/lib/tsbuildinfo.d.ts +4 -0
  144. package/lib/typescript/worker/lib/tsbuildinfo.js +96 -0
  145. package/lib/typescript/worker/lib/typescript.d.ts +2 -0
  146. package/lib/typescript/worker/lib/typescript.js +6 -0
  147. package/lib/typescript/worker/lib/worker-config.d.ts +2 -0
  148. package/lib/typescript/worker/lib/worker-config.js +5 -0
  149. package/lib/utils/async/abort-error.d.ts +6 -0
  150. package/lib/utils/async/abort-error.js +15 -0
  151. package/lib/utils/async/controlled-promise.d.ts +6 -0
  152. package/lib/utils/async/controlled-promise.js +17 -0
  153. package/lib/utils/async/is-pending.d.ts +2 -0
  154. package/lib/utils/async/is-pending.js +10 -0
  155. package/lib/utils/async/pool.d.ts +10 -0
  156. package/lib/utils/async/pool.js +47 -0
  157. package/lib/utils/async/wait.d.ts +2 -0
  158. package/lib/utils/async/wait.js +7 -0
  159. package/lib/utils/path/forward-slash.d.ts +6 -0
  160. package/lib/utils/path/forward-slash.js +15 -0
  161. package/lib/utils/path/is-inside-another-path.d.ts +2 -0
  162. package/lib/utils/path/is-inside-another-path.js +22 -0
  163. package/lib/utils/path/relative-to-context.d.ts +2 -0
  164. package/lib/utils/path/relative-to-context.js +16 -0
  165. package/lib/watch/inclusive-node-watch-file-system.d.ts +15 -0
  166. package/lib/watch/inclusive-node-watch-file-system.js +166 -0
  167. package/lib/watch/watch-file-system.d.ts +16 -0
  168. package/lib/watch/watch-file-system.js +2 -0
  169. package/package.json +182 -0
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deduplicateAndSortIssues = exports.isIssue = void 0;
4
+ const issue_location_1 = require("./issue-location");
5
+ const issue_severity_1 = require("./issue-severity");
6
+ function isIssue(value) {
7
+ return (!!value &&
8
+ typeof value === 'object' &&
9
+ (0, issue_severity_1.isIssueSeverity)(value.severity) &&
10
+ !!value.code &&
11
+ !!value.message);
12
+ }
13
+ exports.isIssue = isIssue;
14
+ function compareStrings(stringA, stringB) {
15
+ if (stringA === stringB) {
16
+ return 0;
17
+ }
18
+ if (stringA === undefined || stringA === null) {
19
+ return -1;
20
+ }
21
+ if (stringB === undefined || stringB === null) {
22
+ return 1;
23
+ }
24
+ return stringA.toString().localeCompare(stringB.toString());
25
+ }
26
+ function compareIssues(issueA, issueB) {
27
+ return ((0, issue_severity_1.compareIssueSeverities)(issueA.severity, issueB.severity) ||
28
+ compareStrings(issueA.file, issueB.file) ||
29
+ (0, issue_location_1.compareIssueLocations)(issueA.location, issueB.location) ||
30
+ compareStrings(issueA.code, issueB.code) ||
31
+ compareStrings(issueA.message, issueB.message) ||
32
+ 0 /* EqualTo */);
33
+ }
34
+ function equalsIssues(issueA, issueB) {
35
+ return compareIssues(issueA, issueB) === 0;
36
+ }
37
+ function deduplicateAndSortIssues(issues) {
38
+ const sortedIssues = issues.filter(isIssue).sort(compareIssues);
39
+ return sortedIssues.filter((issue, index) => index === 0 || !equalsIssues(issue, sortedIssues[index - 1]));
40
+ }
41
+ exports.deduplicateAndSortIssues = deduplicateAndSortIssues;
@@ -0,0 +1,5 @@
1
+ interface Logger {
2
+ log: (message: string) => void;
3
+ error: (message: string) => void;
4
+ }
5
+ export { Logger };
package/lib/logger.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
1
+ import type * as 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,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createPluginConfig = void 0;
4
+ const formatter_1 = require("./formatter");
5
+ const infrastructure_logger_1 = require("./infrastructure-logger");
6
+ const issue_config_1 = require("./issue/issue-config");
7
+ const type_script_worker_config_1 = require("./typescript/type-script-worker-config");
8
+ function createPluginConfig(compiler, options = {}) {
9
+ return {
10
+ async: options.async === undefined ? compiler.options.mode === 'development' : options.async,
11
+ typescript: (0, type_script_worker_config_1.createTypeScriptWorkerConfig)(compiler, options.typescript),
12
+ issue: (0, issue_config_1.createIssueConfig)(compiler, options.issue),
13
+ formatter: (0, formatter_1.createFormatterConfig)(options.formatter),
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,
23
+ devServer: options.devServer !== false,
24
+ };
25
+ }
26
+ exports.createPluginConfig = createPluginConfig;
@@ -0,0 +1,20 @@
1
+ import { SyncHook, SyncWaterfallHook, AsyncSeriesWaterfallHook } from 'tapable';
2
+ import type * as webpack from 'webpack';
3
+ import type { FilesChange } from './files-change';
4
+ import type { Issue } from './issue';
5
+ declare function createPluginHooks(): {
6
+ start: AsyncSeriesWaterfallHook<[FilesChange, webpack.Compilation], import("tapable").UnsetAdditionalOptions>;
7
+ waiting: SyncHook<[webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
8
+ canceled: SyncHook<[webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
9
+ error: SyncHook<[unknown, webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
10
+ issues: SyncWaterfallHook<[Issue[], webpack.Compilation | undefined], void>;
11
+ };
12
+ type ForkTsCheckerWebpackPluginHooks = ReturnType<typeof createPluginHooks>;
13
+ declare function getPluginHooks(compiler: webpack.Compiler | webpack.MultiCompiler): {
14
+ start: AsyncSeriesWaterfallHook<[FilesChange, webpack.Compilation], import("tapable").UnsetAdditionalOptions>;
15
+ waiting: SyncHook<[webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
16
+ canceled: SyncHook<[webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
17
+ error: SyncHook<[unknown, webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
18
+ issues: SyncWaterfallHook<[Issue[], webpack.Compilation | undefined], void>;
19
+ };
20
+ export { getPluginHooks, ForkTsCheckerWebpackPluginHooks };
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPluginHooks = void 0;
4
+ const tapable_1 = require("tapable");
5
+ const compilerHookMap = new WeakMap();
6
+ function createPluginHooks() {
7
+ return {
8
+ start: new tapable_1.AsyncSeriesWaterfallHook([
9
+ 'change',
10
+ 'compilation',
11
+ ]),
12
+ waiting: new tapable_1.SyncHook(['compilation']),
13
+ canceled: new tapable_1.SyncHook(['compilation']),
14
+ error: new tapable_1.SyncHook(['error', 'compilation']),
15
+ issues: new tapable_1.SyncWaterfallHook([
16
+ 'issues',
17
+ 'compilation',
18
+ ]),
19
+ };
20
+ }
21
+ function forwardPluginHooks(source, target) {
22
+ source.start.tapPromise('ForkTsCheckerWebpackPlugin', target.start.promise);
23
+ source.waiting.tap('ForkTsCheckerWebpackPlugin', target.waiting.call);
24
+ source.canceled.tap('ForkTsCheckerWebpackPlugin', target.canceled.call);
25
+ source.error.tap('ForkTsCheckerWebpackPlugin', target.error.call);
26
+ source.issues.tap('ForkTsCheckerWebpackPlugin', target.issues.call);
27
+ }
28
+ function getPluginHooks(compiler) {
29
+ let hooks = compilerHookMap.get(compiler);
30
+ if (hooks === undefined) {
31
+ hooks = createPluginHooks();
32
+ compilerHookMap.set(compiler, hooks);
33
+ // proxy hooks for multi-compiler
34
+ if ('compilers' in compiler) {
35
+ compiler.compilers.forEach((childCompiler) => {
36
+ const childHooks = getPluginHooks(childCompiler);
37
+ if (hooks) {
38
+ forwardPluginHooks(childHooks, hooks);
39
+ }
40
+ });
41
+ }
42
+ }
43
+ return hooks;
44
+ }
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 | 'webpack-infrastructure';
11
+ devServer?: boolean;
12
+ }
13
+ export { ForkTsCheckerWebpackPluginOptions };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,197 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "async": {
6
+ "type": "boolean",
7
+ "description": "When true, plugin will not block compilation to finish issues checking"
8
+ },
9
+ "typescript": {
10
+ "$ref": "#/definitions/TypeScriptOptions"
11
+ },
12
+ "formatter": {
13
+ "$ref": "#/definitions/FormatterOptions"
14
+ },
15
+ "issue": {
16
+ "$ref": "#/definitions/IssueOptions"
17
+ },
18
+ "logger": {
19
+ "$ref": "#/definitions/Logger"
20
+ },
21
+ "devServer": {
22
+ "type": "boolean",
23
+ "description": "Enable reporting to Webpack Dev Server."
24
+ }
25
+ },
26
+ "additionalProperties": false,
27
+ "definitions": {
28
+ "Formatter": {
29
+ "instanceof": "Function"
30
+ },
31
+ "ComplexFormatterPreferences": {
32
+ "type": "object",
33
+ "properties": {
34
+ "type": {
35
+ "$ref": "#/definitions/FormatterType"
36
+ },
37
+ "pathType": {
38
+ "$ref": "#/definitions/FormatterPathType"
39
+ },
40
+ "options": {
41
+ "type": "object",
42
+ "additionalProperties": true
43
+ }
44
+ },
45
+ "required": ["type"]
46
+ },
47
+ "FormatterType": {
48
+ "type": "string",
49
+ "enum": ["basic", "codeframe"]
50
+ },
51
+ "FormatterPathType": {
52
+ "type": "string",
53
+ "enum": ["relative", "absolute"]
54
+ },
55
+ "IssueMatch": {
56
+ "type": "object",
57
+ "properties": {
58
+ "severity": {
59
+ "type": "string",
60
+ "enum": ["error", "warning"]
61
+ },
62
+ "code": {
63
+ "type": "string"
64
+ },
65
+ "file": {
66
+ "type": "string"
67
+ }
68
+ }
69
+ },
70
+ "IssuePredicate": {
71
+ "instanceof": "Function"
72
+ },
73
+ "IssuePredicateOption": {
74
+ "oneOf": [
75
+ {
76
+ "$ref": "#/definitions/IssuePredicate"
77
+ },
78
+ {
79
+ "$ref": "#/definitions/IssueMatch"
80
+ },
81
+ {
82
+ "type": "array",
83
+ "items": {
84
+ "oneOf": [
85
+ {
86
+ "$ref": "#/definitions/IssuePredicate"
87
+ },
88
+ {
89
+ "$ref": "#/definitions/IssueMatch"
90
+ }
91
+ ]
92
+ }
93
+ }
94
+ ]
95
+ },
96
+ "Logger": {
97
+ "oneOf": [
98
+ {
99
+ "type": "object",
100
+ "properties": {
101
+ "error": {
102
+ "instanceof": "Function"
103
+ },
104
+ "log": {
105
+ "instanceof": "Function"
106
+ }
107
+ }
108
+ },
109
+ {
110
+ "type": "string",
111
+ "enum": ["webpack-infrastructure"]
112
+ }
113
+ ]
114
+ },
115
+ "TypeScriptOptions": {
116
+ "type": "object",
117
+ "properties": {
118
+ "memoryLimit": {
119
+ "type": "number",
120
+ "description": "Memory limit for TypeScript reporter process."
121
+ },
122
+ "configFile": {
123
+ "type": "string",
124
+ "description": "Path to tsconfig.json. By default plugin uses context or process.cwd() to localize tsconfig.json file."
125
+ },
126
+ "context": {
127
+ "type": "string",
128
+ "description": "The base path for finding files specified in the tsconfig.json. Same as context option from the ts-loader."
129
+ },
130
+ "build": {
131
+ "type": "boolean",
132
+ "description": "The equivalent of the `--build` flag from the `tsc`."
133
+ },
134
+ "mode": {
135
+ "type": "string",
136
+ "enum": ["readonly", "write-tsbuildinfo", "write-dts", "write-references"],
137
+ "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"
138
+ },
139
+ "compilerOptions": {
140
+ "type": "object",
141
+ "description": "Custom compilerOptions to be passed to the TypeScript compiler.",
142
+ "additionalProperties": true
143
+ },
144
+ "diagnosticOptions": {
145
+ "type": "object",
146
+ "description": "Types of diagnostics to be reported.",
147
+ "properties": {
148
+ "syntactic": {
149
+ "type": "boolean"
150
+ },
151
+ "semantic": {
152
+ "type": "boolean"
153
+ },
154
+ "declaration": {
155
+ "type": "boolean"
156
+ },
157
+ "global": {
158
+ "type": "boolean"
159
+ }
160
+ }
161
+ },
162
+ "profile": {
163
+ "type": "boolean",
164
+ "description": "Measures and prints timings related to the TypeScript performance."
165
+ },
166
+ "typescriptPath": {
167
+ "type": "string",
168
+ "description": "If supplied this is a custom path where TypeScript can be found."
169
+ }
170
+ }
171
+ },
172
+ "FormatterOptions": {
173
+ "oneOf": [
174
+ {
175
+ "$ref": "#/definitions/FormatterType"
176
+ },
177
+ {
178
+ "$ref": "#/definitions/ComplexFormatterPreferences"
179
+ },
180
+ {
181
+ "$ref": "#/definitions/Formatter"
182
+ }
183
+ ]
184
+ },
185
+ "IssueOptions": {
186
+ "type": "object",
187
+ "properties": {
188
+ "include": {
189
+ "$ref": "#/definitions/IssuePredicateOption"
190
+ },
191
+ "exclude": {
192
+ "$ref": "#/definitions/IssuePredicateOption"
193
+ }
194
+ }
195
+ }
196
+ }
197
+ }
@@ -0,0 +1,4 @@
1
+ import type { Pool } from './utils/async/pool';
2
+ declare const issuesPool: Pool;
3
+ declare const dependenciesPool: Pool;
4
+ export { issuesPool, dependenciesPool };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.dependenciesPool = exports.issuesPool = void 0;
27
+ const os = __importStar(require("os"));
28
+ const pool_1 = require("./utils/async/pool");
29
+ const issuesPool = (0, pool_1.createPool)(Math.max(1, os.cpus().length));
30
+ exports.issuesPool = issuesPool;
31
+ const dependenciesPool = (0, pool_1.createPool)(Math.max(1, os.cpus().length));
32
+ exports.dependenciesPool = dependenciesPool;
@@ -0,0 +1,18 @@
1
+ import type { AbortController } from 'node-abort-controller';
2
+ import type { FullTap } from 'tapable';
3
+ import type { FilesChange } from './files-change';
4
+ import type { FilesMatch } from './files-match';
5
+ import type { Issue } from './issue';
6
+ interface ForkTsCheckerWebpackPluginState {
7
+ issuesPromise: Promise<Issue[] | undefined>;
8
+ dependenciesPromise: Promise<FilesMatch | undefined>;
9
+ abortController: AbortController | undefined;
10
+ aggregatedFilesChange: FilesChange | undefined;
11
+ lastDependencies: FilesMatch | undefined;
12
+ watching: boolean;
13
+ initialized: boolean;
14
+ iteration: number;
15
+ webpackDevServerDoneTap: FullTap | undefined;
16
+ }
17
+ declare function createPluginState(): ForkTsCheckerWebpackPluginState;
18
+ export { ForkTsCheckerWebpackPluginState, createPluginState };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createPluginState = void 0;
4
+ function createPluginState() {
5
+ return {
6
+ issuesPromise: Promise.resolve(undefined),
7
+ dependenciesPromise: Promise.resolve(undefined),
8
+ abortController: undefined,
9
+ aggregatedFilesChange: undefined,
10
+ lastDependencies: undefined,
11
+ watching: false,
12
+ initialized: false,
13
+ iteration: 0,
14
+ webpackDevServerDoneTap: undefined,
15
+ };
16
+ }
17
+ exports.createPluginState = createPluginState;
@@ -0,0 +1,28 @@
1
+ import type * as webpack from 'webpack';
2
+ import type { ForkTsCheckerWebpackPluginOptions } from './plugin-options';
3
+ declare class ForkTsCheckerWebpackPlugin {
4
+ /**
5
+ * Current version of the plugin
6
+ */
7
+ static readonly version: string;
8
+ /**
9
+ * Default pools for the plugin concurrency limit
10
+ */
11
+ static readonly issuesPool: import("./utils/async/pool").Pool;
12
+ static readonly dependenciesPool: import("./utils/async/pool").Pool;
13
+ /**
14
+ * @deprecated Use ForkTsCheckerWebpackPlugin.issuesPool instead
15
+ */
16
+ static readonly pool: import("./utils/async/pool").Pool;
17
+ private readonly options;
18
+ constructor(options?: ForkTsCheckerWebpackPluginOptions);
19
+ static getCompilerHooks(compiler: webpack.Compiler): {
20
+ start: import("tapable").AsyncSeriesWaterfallHook<[import("./files-change").FilesChange, webpack.Compilation], import("tapable").UnsetAdditionalOptions>;
21
+ waiting: import("tapable").SyncHook<[webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
22
+ canceled: import("tapable").SyncHook<[webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
23
+ error: import("tapable").SyncHook<[unknown, webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
24
+ issues: import("tapable").SyncWaterfallHook<[import("./issue/issue").Issue[], webpack.Compilation | undefined], void>;
25
+ };
26
+ apply(compiler: webpack.Compiler): void;
27
+ }
28
+ export { ForkTsCheckerWebpackPlugin };
package/lib/plugin.js ADDED
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.ForkTsCheckerWebpackPlugin = void 0;
30
+ const path = __importStar(require("path"));
31
+ const cosmiconfig_1 = require("cosmiconfig");
32
+ const deepmerge_1 = __importDefault(require("deepmerge"));
33
+ const schema_utils_1 = require("schema-utils");
34
+ const tap_after_compile_to_add_dependencies_1 = require("./hooks/tap-after-compile-to-add-dependencies");
35
+ const tap_after_environment_to_patch_watching_1 = require("./hooks/tap-after-environment-to-patch-watching");
36
+ const tap_error_to_log_message_1 = require("./hooks/tap-error-to-log-message");
37
+ const tap_start_to_run_workers_1 = require("./hooks/tap-start-to-run-workers");
38
+ const tap_stop_to_terminate_workers_1 = require("./hooks/tap-stop-to-terminate-workers");
39
+ const plugin_config_1 = require("./plugin-config");
40
+ const plugin_hooks_1 = require("./plugin-hooks");
41
+ const plugin_options_json_1 = __importDefault(require("./plugin-options.json"));
42
+ const plugin_pools_1 = require("./plugin-pools");
43
+ const plugin_state_1 = require("./plugin-state");
44
+ const rpc_1 = require("./rpc");
45
+ const type_script_support_1 = require("./typescript/type-script-support");
46
+ class ForkTsCheckerWebpackPlugin {
47
+ constructor(options = {}) {
48
+ const explorerSync = (0, cosmiconfig_1.cosmiconfigSync)('fork-ts-checker');
49
+ const { config: externalOptions } = explorerSync.search() || {};
50
+ // first validate options directly passed to the constructor
51
+ const config = { name: 'ForkTsCheckerWebpackPlugin' };
52
+ (0, schema_utils_1.validate)(plugin_options_json_1.default, options, config);
53
+ this.options = (0, deepmerge_1.default)(externalOptions || {}, options || {});
54
+ // then validate merged options
55
+ (0, schema_utils_1.validate)(plugin_options_json_1.default, this.options, config);
56
+ }
57
+ static getCompilerHooks(compiler) {
58
+ return (0, plugin_hooks_1.getPluginHooks)(compiler);
59
+ }
60
+ apply(compiler) {
61
+ const config = (0, plugin_config_1.createPluginConfig)(compiler, this.options);
62
+ const state = (0, plugin_state_1.createPluginState)();
63
+ (0, type_script_support_1.assertTypeScriptSupport)(config.typescript);
64
+ const getIssuesWorker = (0, rpc_1.createRpcWorker)(path.resolve(__dirname, './typescript/worker/get-issues-worker.js'), config.typescript, config.typescript.memoryLimit);
65
+ const getDependenciesWorker = (0, rpc_1.createRpcWorker)(path.resolve(__dirname, './typescript/worker/get-dependencies-worker.js'), config.typescript);
66
+ (0, tap_after_environment_to_patch_watching_1.tapAfterEnvironmentToPatchWatching)(compiler, state);
67
+ (0, tap_start_to_run_workers_1.tapStartToRunWorkers)(compiler, getIssuesWorker, getDependenciesWorker, config, state);
68
+ (0, tap_after_compile_to_add_dependencies_1.tapAfterCompileToAddDependencies)(compiler, config, state);
69
+ (0, tap_stop_to_terminate_workers_1.tapStopToTerminateWorkers)(compiler, getIssuesWorker, getDependenciesWorker, state);
70
+ (0, tap_error_to_log_message_1.tapErrorToLogMessage)(compiler, config);
71
+ }
72
+ }
73
+ exports.ForkTsCheckerWebpackPlugin = ForkTsCheckerWebpackPlugin;
74
+ /**
75
+ * Current version of the plugin
76
+ */
77
+ ForkTsCheckerWebpackPlugin.version = '9.1.0'; // will be replaced by the @semantic-release/exec
78
+ /**
79
+ * Default pools for the plugin concurrency limit
80
+ */
81
+ ForkTsCheckerWebpackPlugin.issuesPool = plugin_pools_1.issuesPool;
82
+ ForkTsCheckerWebpackPlugin.dependenciesPool = plugin_pools_1.dependenciesPool;
83
+ /**
84
+ * @deprecated Use ForkTsCheckerWebpackPlugin.issuesPool instead
85
+ */
86
+ ForkTsCheckerWebpackPlugin.pool = plugin_pools_1.issuesPool;
@@ -0,0 +1 @@
1
+ export declare function exposeRpc(fn: (...args: any[]) => any): void;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.exposeRpc = void 0;
16
+ const process_1 = __importDefault(require("process"));
17
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
+ function exposeRpc(fn) {
19
+ const sendMessage = (message) => new Promise((resolve, reject) => {
20
+ if (!process_1.default.send) {
21
+ reject(new Error(`Process ${process_1.default.pid} doesn't have IPC channels`));
22
+ }
23
+ else if (!process_1.default.connected) {
24
+ reject(new Error(`Process ${process_1.default.pid} doesn't have open IPC channels`));
25
+ }
26
+ else {
27
+ process_1.default.send(message, undefined, undefined, (error) => {
28
+ if (error) {
29
+ reject(error);
30
+ }
31
+ else {
32
+ resolve(undefined);
33
+ }
34
+ });
35
+ }
36
+ });
37
+ const handleMessage = (message) => __awaiter(this, void 0, void 0, function* () {
38
+ if (message.type === 'call') {
39
+ if (!process_1.default.send) {
40
+ // process disconnected - skip
41
+ return;
42
+ }
43
+ let value;
44
+ let error;
45
+ try {
46
+ value = yield fn(...message.args);
47
+ }
48
+ catch (fnError) {
49
+ error = fnError;
50
+ }
51
+ try {
52
+ if (error) {
53
+ yield sendMessage({
54
+ type: 'reject',
55
+ id: message.id,
56
+ error,
57
+ });
58
+ }
59
+ else {
60
+ yield sendMessage({
61
+ type: 'resolve',
62
+ id: message.id,
63
+ value,
64
+ });
65
+ }
66
+ }
67
+ catch (sendError) {
68
+ // we can't send things back to the parent process - let's use stdout to communicate error
69
+ if (error) {
70
+ console.error(error);
71
+ }
72
+ console.error(sendError);
73
+ }
74
+ }
75
+ });
76
+ process_1.default.on('message', handleMessage);
77
+ }
78
+ exports.exposeRpc = exposeRpc;
@@ -0,0 +1,5 @@
1
+ export { exposeRpc } from './expose-rpc';
2
+ export { wrapRpc } from './wrap-rpc';
3
+ export { createRpcWorker, getRpcWorkerData, RpcWorker } from './rpc-worker';
4
+ export { RpcExitError } from './rpc-error';
5
+ export { RpcRemoteMethod } from './types';