fork-ts-checker-webpack-plugin 7.0.0-alpha.12 → 7.0.0-alpha.16

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 (65) hide show
  1. package/README.md +38 -23
  2. package/lib/formatter/code-frame-formatter.js +2 -2
  3. package/lib/formatter/formatter-config.js +2 -2
  4. package/lib/formatter/webpack-formatter.js +2 -2
  5. package/lib/hooks/intercept-done-to-get-dev-server-tap.js +2 -2
  6. package/lib/hooks/tap-after-compile-to-add-dependencies.js +1 -1
  7. package/lib/hooks/tap-after-compile-to-get-issues.js +2 -2
  8. package/lib/hooks/tap-after-environment-to-patch-watching.js +1 -1
  9. package/lib/hooks/tap-done-to-async-get-issues.js +8 -8
  10. package/lib/hooks/tap-error-to-log-message.js +4 -4
  11. package/lib/hooks/tap-start-to-run-workers.js +7 -7
  12. package/lib/hooks/tap-stop-to-terminate-workers.js +1 -1
  13. package/lib/issue/issue-config.js +4 -4
  14. package/lib/issue/issue-location.js +2 -2
  15. package/lib/issue/issue-match.js +1 -1
  16. package/lib/issue/issue-webpack-error.js +2 -2
  17. package/lib/issue/issue.js +3 -3
  18. package/lib/{logger/logger.d.ts → logger.d.ts} +1 -2
  19. package/lib/{logger/logger.js → logger.js} +0 -0
  20. package/lib/plugin-config.d.ts +3 -2
  21. package/lib/plugin-config.js +5 -5
  22. package/lib/plugin-hooks.d.ts +2 -2
  23. package/lib/plugin-options.d.ts +3 -2
  24. package/lib/plugin-options.json +9 -44
  25. package/lib/plugin-pools.js +2 -2
  26. package/lib/plugin.d.ts +1 -1
  27. package/lib/plugin.js +16 -16
  28. package/lib/rpc/rpc-worker.js +1 -1
  29. package/lib/typescript/extension/type-script-embedded-extension.js +2 -2
  30. package/lib/typescript/extension/vue/type-script-vue-extension-support.js +1 -1
  31. package/lib/typescript/extension/vue/type-script-vue-extension.js +1 -1
  32. package/lib/typescript/type-script-support.js +1 -1
  33. package/lib/typescript/type-script-worker-config.d.ts +1 -1
  34. package/lib/typescript/type-script-worker-config.js +1 -1
  35. package/lib/typescript/type-script-worker-options.d.ts +1 -1
  36. package/lib/typescript/worker/get-dependencies-worker.js +7 -7
  37. package/lib/typescript/worker/get-issues-worker.js +24 -25
  38. package/lib/typescript/worker/lib/artifacts.js +3 -3
  39. package/lib/typescript/worker/lib/config.js +3 -3
  40. package/lib/typescript/worker/lib/dependencies.js +2 -2
  41. package/lib/typescript/worker/lib/diagnostics.js +1 -1
  42. package/lib/typescript/worker/lib/extensions.js +1 -1
  43. package/lib/typescript/worker/lib/file-system/mem-file-system.js +2 -2
  44. package/lib/typescript/worker/lib/file-system/real-file-system.js +23 -23
  45. package/lib/typescript/worker/lib/host/watch-solution-builder-host.js +1 -1
  46. package/lib/typescript/worker/lib/program/program.js +3 -3
  47. package/lib/typescript/worker/lib/program/solution-builder.js +6 -6
  48. package/lib/typescript/worker/lib/program/watch-program.js +7 -7
  49. package/lib/typescript/worker/lib/system.js +27 -11
  50. package/lib/typescript/worker/lib/tracing.js +1 -1
  51. package/lib/typescript/worker/lib/tsbuildinfo.js +2 -2
  52. package/lib/typescript/worker/lib/worker-config.js +1 -1
  53. package/lib/utils/path/relative-to-context.js +1 -1
  54. package/lib/watch/inclusive-node-watch-file-system.js +10 -10
  55. package/package.json +39 -34
  56. package/lib/logger/logger-config.d.ts +0 -10
  57. package/lib/logger/logger-config.js +0 -12
  58. package/lib/logger/logger-factory.d.ts +0 -5
  59. package/lib/logger/logger-factory.js +0 -21
  60. package/lib/logger/logger-options.d.ts +0 -8
  61. package/lib/logger/logger-options.js +0 -2
  62. package/lib/logger/partial-logger.d.ts +0 -4
  63. package/lib/logger/partial-logger.js +0 -11
  64. package/lib/logger/webpack-infrastructure-logger.d.ts +0 -4
  65. package/lib/logger/webpack-infrastructure-logger.js +0 -13
@@ -34,7 +34,10 @@ const deletedFiles = new Map();
34
34
  const timeoutCallbacks = new Set();
35
35
  // based on the ts.ignorePaths
36
36
  const ignoredPaths = ['/node_modules/.', '/.git', '/.#'];
37
- exports.system = Object.assign(Object.assign({}, typescript_1.typescript.sys), { useCaseSensitiveFileNames: true, fileExists(path) {
37
+ exports.system = Object.assign(Object.assign({}, typescript_1.typescript.sys), { useCaseSensitiveFileNames: true, realpath(path) {
38
+ return getReadFileSystem(path).realPath(path);
39
+ },
40
+ fileExists(path) {
38
41
  const stats = getReadFileSystem(path).readStats(path);
39
42
  return !!stats && stats.isFile();
40
43
  },
@@ -65,7 +68,7 @@ exports.system = Object.assign(Object.assign({}, typescript_1.typescript.sys), {
65
68
  const dirents = getReadFileSystem(path).readDir(path);
66
69
  return dirents
67
70
  .filter((dirent) => dirent.isDirectory() ||
68
- (dirent.isSymbolicLink() && exports.system.directoryExists(path_1.join(path, dirent.name))))
71
+ (dirent.isSymbolicLink() && exports.system.directoryExists((0, path_1.join)(path, dirent.name))))
69
72
  .map((dirent) => dirent.name);
70
73
  },
71
74
  getModifiedTime(path) {
@@ -165,24 +168,24 @@ function invokeFileWatchers(path, event) {
165
168
  const fileWatcherCallbacks = fileWatcherCallbacksMap.get(normalizedPath);
166
169
  if (fileWatcherCallbacks) {
167
170
  // typescript expects normalized paths with posix forward slash
168
- fileWatcherCallbacks.forEach((fileWatcherCallback) => fileWatcherCallback(forward_slash_1.forwardSlash(normalizedPath), event));
171
+ fileWatcherCallbacks.forEach((fileWatcherCallback) => fileWatcherCallback((0, forward_slash_1.forwardSlash)(normalizedPath), event));
169
172
  }
170
173
  }
171
174
  function invokeDirectoryWatchers(path) {
172
175
  const normalizedPath = real_file_system_1.realFileSystem.normalizePath(path);
173
- const directory = path_1.dirname(normalizedPath);
174
- if (ignoredPaths.some((ignoredPath) => forward_slash_1.forwardSlash(normalizedPath).includes(ignoredPath))) {
176
+ const directory = (0, path_1.dirname)(normalizedPath);
177
+ if (ignoredPaths.some((ignoredPath) => (0, forward_slash_1.forwardSlash)(normalizedPath).includes(ignoredPath))) {
175
178
  return;
176
179
  }
177
180
  const directoryWatcherCallbacks = directoryWatcherCallbacksMap.get(directory);
178
181
  if (directoryWatcherCallbacks) {
179
- directoryWatcherCallbacks.forEach((directoryWatcherCallback) => directoryWatcherCallback(forward_slash_1.forwardSlash(normalizedPath)));
182
+ directoryWatcherCallbacks.forEach((directoryWatcherCallback) => directoryWatcherCallback((0, forward_slash_1.forwardSlash)(normalizedPath)));
180
183
  }
181
184
  recursiveDirectoryWatcherCallbacksMap.forEach((recursiveDirectoryWatcherCallbacks, watchedDirectory) => {
182
185
  if (watchedDirectory === directory ||
183
186
  (directory.startsWith(watchedDirectory) &&
184
- forward_slash_1.forwardSlash(directory)[watchedDirectory.length] === '/')) {
185
- recursiveDirectoryWatcherCallbacks.forEach((recursiveDirectoryWatcherCallback) => recursiveDirectoryWatcherCallback(forward_slash_1.forwardSlash(normalizedPath)));
187
+ (0, forward_slash_1.forwardSlash)(directory)[watchedDirectory.length] === '/')) {
188
+ recursiveDirectoryWatcherCallbacks.forEach((recursiveDirectoryWatcherCallback) => recursiveDirectoryWatcherCallback((0, forward_slash_1.forwardSlash)(normalizedPath)));
186
189
  }
187
190
  });
188
191
  }
@@ -192,14 +195,27 @@ function isArtifact(path) {
192
195
  artifacts.extensions.some((extension) => path.endsWith(extension)));
193
196
  }
194
197
  function getReadFileSystem(path) {
195
- if (!isInitialRun && (mode === 'readonly' || mode === 'write-tsbuildinfo') && isArtifact(path)) {
196
- return mem_file_system_1.memFileSystem;
198
+ if ((mode === 'readonly' || mode === 'write-tsbuildinfo') && isArtifact(path)) {
199
+ if (isInitialRun && !mem_file_system_1.memFileSystem.exists(path) && passive_file_system_1.passiveFileSystem.exists(path)) {
200
+ // copy file to memory on initial run
201
+ const stats = passive_file_system_1.passiveFileSystem.readStats(path);
202
+ if (stats === null || stats === void 0 ? void 0 : stats.isFile()) {
203
+ const content = passive_file_system_1.passiveFileSystem.readFile(path);
204
+ if (content) {
205
+ mem_file_system_1.memFileSystem.writeFile(path, content);
206
+ mem_file_system_1.memFileSystem.updateTimes(path, stats.atime, stats.mtime);
207
+ }
208
+ }
209
+ return mem_file_system_1.memFileSystem;
210
+ }
197
211
  }
198
212
  return passive_file_system_1.passiveFileSystem;
199
213
  }
200
214
  function getWriteFileSystem(path) {
201
215
  if (mode === 'write-references' ||
202
- (mode === 'write-tsbuildinfo' && path.endsWith('.tsbuildinfo'))) {
216
+ (mode === 'write-tsbuildinfo' && path.endsWith('.tsbuildinfo')) ||
217
+ (mode === 'write-dts' &&
218
+ ['.tsbuildinfo', '.d.ts', '.d.ts.map'].some((suffix) => path.endsWith(suffix)))) {
203
219
  return real_file_system_1.realFileSystem;
204
220
  }
205
221
  return passive_file_system_1.passiveFileSystem;
@@ -8,7 +8,7 @@ const worker_config_1 = require("./worker-config");
8
8
  const tracing = typescript_1.typescript.tracing;
9
9
  function startTracingIfNeeded(compilerOptions) {
10
10
  if (compilerOptions.generateTrace && tracing) {
11
- tracing.startTracing(config_1.getConfigFilePathFromCompilerOptions(compilerOptions), compilerOptions.generateTrace, worker_config_1.config.build);
11
+ tracing.startTracing((0, config_1.getConfigFilePathFromCompilerOptions)(compilerOptions), compilerOptions.generateTrace, worker_config_1.config.build);
12
12
  }
13
13
  }
14
14
  exports.startTracingIfNeeded = startTracingIfNeeded;
@@ -26,7 +26,7 @@ const system_1 = require("./system");
26
26
  const typescript_1 = require("./typescript");
27
27
  const worker_config_1 = require("./worker-config");
28
28
  function invalidateTsBuildInfo() {
29
- const parsedConfig = config_1.getParsedConfig();
29
+ const parsedConfig = (0, config_1.getParsedConfig)();
30
30
  // try to remove outdated .tsbuildinfo file for incremental mode
31
31
  if (typeof typescript_1.typescript.getTsBuildInfoEmitOutputFilePath === 'function' &&
32
32
  worker_config_1.config.mode !== 'readonly' &&
@@ -44,7 +44,7 @@ function invalidateTsBuildInfo() {
44
44
  }
45
45
  exports.invalidateTsBuildInfo = invalidateTsBuildInfo;
46
46
  function emitTsBuildInfoIfNeeded(builderProgram) {
47
- const parsedConfig = config_1.getParsedConfig();
47
+ const parsedConfig = (0, config_1.getParsedConfig)();
48
48
  if (worker_config_1.config.mode !== 'readonly' && parsedConfig && isIncrementalEnabled(parsedConfig.options)) {
49
49
  const program = builderProgram.getProgram();
50
50
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.config = void 0;
4
4
  const rpc_1 = require("../../../rpc");
5
- exports.config = rpc_1.getRpcWorkerData();
5
+ exports.config = (0, rpc_1.getRpcWorkerData)();
@@ -7,7 +7,7 @@ exports.relativeToContext = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const forward_slash_1 = require("./forward-slash");
9
9
  function relativeToContext(file, context) {
10
- let fileInContext = forward_slash_1.forwardSlash(path_1.default.relative(context, file));
10
+ let fileInContext = (0, forward_slash_1.forwardSlash)(path_1.default.relative(context, file));
11
11
  if (!fileInContext.startsWith('../')) {
12
12
  fileInContext = './' + fileInContext;
13
13
  }
@@ -15,7 +15,7 @@ function createIsIgnored(ignored, excluded) {
15
15
  const ignoredFunctions = ignoredPatterns.map((pattern) => {
16
16
  // ensure patterns are valid - see https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues/594
17
17
  if (typeof pattern === 'string') {
18
- return (path) => minimatch_1.default(path, pattern);
18
+ return (path) => (0, minimatch_1.default)(path, pattern);
19
19
  }
20
20
  else if (pattern instanceof RegExp) {
21
21
  return (path) => pattern.test(path);
@@ -39,8 +39,8 @@ class InclusiveNodeWatchFileSystem {
39
39
  this.paused = true;
40
40
  this.watch = (files, dirs, missing, startTime, options, callback, callbackUndelayed) => {
41
41
  var _a, _b, _c, _d;
42
- const { debug } = infrastructure_logger_1.getInfrastructureLogger(this.compiler);
43
- files_change_1.clearFilesChange(this.compiler);
42
+ const { debug } = (0, infrastructure_logger_1.getInfrastructureLogger)(this.compiler);
43
+ (0, files_change_1.clearFilesChange)(this.compiler);
44
44
  const isIgnored = createIsIgnored(options === null || options === void 0 ? void 0 : options.ignored, ((_a = this.pluginState.lastDependencies) === null || _a === void 0 ? void 0 : _a.excluded) || []);
45
45
  // use standard watch file system for files and missing
46
46
  const standardWatcher = this.watchFileSystem.watch(files, dirs, missing, startTime, options, callback, callbackUndelayed);
@@ -51,7 +51,7 @@ class InclusiveNodeWatchFileSystem {
51
51
  if (!isIgnored(file)) {
52
52
  debug('Detected file change', file);
53
53
  this.deletedFiles.delete(file);
54
- files_change_1.updateFilesChange(this.compiler, { changedFiles: [file] });
54
+ (0, files_change_1.updateFilesChange)(this.compiler, { changedFiles: [file] });
55
55
  }
56
56
  else {
57
57
  debug("Detected file change but it's ignored", file);
@@ -68,7 +68,7 @@ class InclusiveNodeWatchFileSystem {
68
68
  if (!isIgnored(file)) {
69
69
  debug('Detected file remove', file);
70
70
  this.deletedFiles.add(file);
71
- files_change_1.updateFilesChange(this.compiler, { deletedFiles: [file] });
71
+ (0, files_change_1.updateFilesChange)(this.compiler, { deletedFiles: [file] });
72
72
  }
73
73
  else {
74
74
  debug("Detected file remove but it's ignored", file);
@@ -103,7 +103,7 @@ class InclusiveNodeWatchFileSystem {
103
103
  if (this.paused) {
104
104
  return;
105
105
  }
106
- const extension = path_1.extname(file);
106
+ const extension = (0, path_1.extname)(file);
107
107
  const supportedExtensions = ((_a = this.pluginState.lastDependencies) === null || _a === void 0 ? void 0 : _a.extensions) || [];
108
108
  if (!supportedExtensions.includes(extension)) {
109
109
  debug('Detected new file add but extension is not supported', file);
@@ -111,7 +111,7 @@ class InclusiveNodeWatchFileSystem {
111
111
  }
112
112
  debug('Detected new file add', file);
113
113
  this.deletedFiles.delete(file);
114
- files_change_1.updateFilesChange(this.compiler, { changedFiles: [file] });
114
+ (0, files_change_1.updateFilesChange)(this.compiler, { changedFiles: [file] });
115
115
  (_b = this.watcher) === null || _b === void 0 ? void 0 : _b._onChange(dirToWatch, (stats === null || stats === void 0 ? void 0 : stats.mtimeMs) || (stats === null || stats === void 0 ? void 0 : stats.ctimeMs) || 1, file, 'rename');
116
116
  });
117
117
  dirWatcher.on('unlink', (file) => {
@@ -119,7 +119,7 @@ class InclusiveNodeWatchFileSystem {
119
119
  if (this.paused) {
120
120
  return;
121
121
  }
122
- const extension = path_1.extname(file);
122
+ const extension = (0, path_1.extname)(file);
123
123
  const supportedExtensions = ((_a = this.pluginState.lastDependencies) === null || _a === void 0 ? void 0 : _a.extensions) || [];
124
124
  if (!supportedExtensions.includes(extension)) {
125
125
  debug('Detected new file remove but extension is not supported', file);
@@ -131,14 +131,14 @@ class InclusiveNodeWatchFileSystem {
131
131
  }
132
132
  debug('Detected new file remove', file);
133
133
  this.deletedFiles.add(file);
134
- files_change_1.updateFilesChange(this.compiler, { deletedFiles: [file] });
134
+ (0, files_change_1.updateFilesChange)(this.compiler, { deletedFiles: [file] });
135
135
  (_b = this.watcher) === null || _b === void 0 ? void 0 : _b._onRemove(dirToWatch, file, 'rename');
136
136
  });
137
137
  this.dirsWatchers.set(dirToWatch, dirWatcher);
138
138
  });
139
139
  this.paused = false;
140
140
  return Object.assign(Object.assign({}, standardWatcher), { close: () => {
141
- files_change_1.clearFilesChange(this.compiler);
141
+ (0, files_change_1.clearFilesChange)(this.compiler);
142
142
  if (standardWatcher) {
143
143
  standardWatcher.close();
144
144
  }
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "fork-ts-checker-webpack-plugin",
3
- "version": "7.0.0-alpha.12",
3
+ "version": "7.0.0-alpha.16",
4
4
  "description": "Runs typescript type checker and linter on separate process.",
5
5
  "keywords": [
6
- "fast",
7
- "fork",
8
- "linter",
9
6
  "webpack",
10
7
  "plugin",
11
- "ts-loader",
12
8
  "typescript",
13
- "webpack"
9
+ "typecheck",
10
+ "ts-loader",
11
+ "webpack",
12
+ "fork",
13
+ "fast"
14
14
  ],
15
15
  "bugs": {
16
16
  "url": "https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues"
@@ -55,25 +55,30 @@
55
55
  }
56
56
  },
57
57
  "dependencies": {
58
- "@babel/code-frame": "^7.14.5",
58
+ "@babel/code-frame": "^7.16.7",
59
59
  "chalk": "^4.1.2",
60
- "chokidar": "^3.5.2",
61
- "cosmiconfig": "^7.0.0",
60
+ "chokidar": "^3.5.3",
61
+ "cosmiconfig": "^7.0.1",
62
62
  "deepmerge": "^4.2.2",
63
63
  "fs-extra": "^10.0.0",
64
- "glob": "^7.1.7",
65
- "memfs": "^3.2.2",
64
+ "memfs": "^3.4.1",
66
65
  "minimatch": "^3.0.4",
67
- "schema-utils": "3.1.1",
66
+ "schema-utils": "4.0.0",
68
67
  "semver": "^7.3.5",
69
- "tapable": "^2.0.0"
68
+ "tapable": "^2.2.1"
70
69
  },
71
70
  "peerDependencies": {
72
71
  "typescript": ">3.6.0",
73
- "webpack": "^5.11.0"
72
+ "webpack": "^5.11.0",
73
+ "vue-template-compiler": "*"
74
+ },
75
+ "peerDependenciesMeta": {
76
+ "vue-template-compiler": {
77
+ "optional": true
78
+ }
74
79
  },
75
80
  "devDependencies": {
76
- "@commitlint/config-conventional": "^13.1.0",
81
+ "@commitlint/config-conventional": "^16.0.0",
77
82
  "@semantic-release/commit-analyzer": "^8.0.1",
78
83
  "@semantic-release/exec": "^5.0.0",
79
84
  "@semantic-release/github": "^7.2.3",
@@ -81,38 +86,38 @@
81
86
  "@semantic-release/release-notes-generator": "^9.0.3",
82
87
  "@types/babel__code-frame": "^7.0.3",
83
88
  "@types/cross-spawn": "^6.0.2",
84
- "@types/fs-extra": "^9.0.12",
85
- "@types/jest": "^26.0.24",
89
+ "@types/fs-extra": "^9.0.13",
90
+ "@types/jest": "^27.4.0",
86
91
  "@types/json-schema": "^7.0.9",
87
92
  "@types/minimatch": "^3.0.5",
88
93
  "@types/mock-fs": "^4.13.1",
89
94
  "@types/node": "^16.4.13",
90
- "@types/rimraf": "^3.0.1",
91
- "@types/semver": "^7.3.8",
92
- "@typescript-eslint/eslint-plugin": "^5.1.0",
93
- "@typescript-eslint/parser": "^5.1.0",
94
- "commitlint": "^13.1.0",
95
+ "@types/rimraf": "^3.0.2",
96
+ "@types/semver": "^7.3.9",
97
+ "@typescript-eslint/eslint-plugin": "^5.10.1",
98
+ "@typescript-eslint/parser": "^5.10.1",
99
+ "commitlint": "^16.1.0",
95
100
  "cross-env": "^7.0.3",
96
- "eslint": "^7.32.0",
97
- "eslint-plugin-import": "^2.25.2",
101
+ "eslint": "^8.8.0",
102
+ "eslint-plugin-import": "^2.25.4",
98
103
  "eslint-plugin-node": "^11.1.0",
99
104
  "eslint-plugin-prettier": "^4.0.0",
100
- "git-cz": "^4.7.6",
101
- "husky": "^7.0.0",
102
- "jest": "^27.0.6",
103
- "jest-circus": "^27.0.6",
104
- "jest-environment-node": "^27.0.6",
105
+ "git-cz": "^4.8.0",
106
+ "husky": "^7.0.4",
107
+ "jest": "^27.4.7",
108
+ "jest-circus": "^27.4.6",
109
+ "jest-environment-node": "^27.4.6",
105
110
  "json-schema": "^0.3.0",
106
111
  "karton": "^0.4.1",
107
112
  "lint-staged": "^11.1.2",
108
- "mock-fs": "^5.0.0",
109
- "prettier": "^2.3.2",
113
+ "mock-fs": "^5.1.2",
114
+ "prettier": "^2.5.1",
110
115
  "rimraf": "^3.0.2",
111
116
  "semantic-release": "^17.4.4",
112
117
  "strip-ansi": "^6.0.0",
113
- "ts-jest": "^27.0.4",
114
- "typescript": "^4.3.5",
115
- "webpack": "^5.49.0"
118
+ "ts-jest": "^27.1.3",
119
+ "typescript": "^4.5.5",
120
+ "webpack": "^5.67.0"
116
121
  },
117
122
  "engines": {
118
123
  "node": ">=12.13.0",
@@ -1,10 +0,0 @@
1
- import type webpack from 'webpack';
2
- import type Logger from './logger';
3
- import type LoggerOptions from './logger-options';
4
- interface LoggerConfig {
5
- infrastructure: Logger;
6
- issues: Logger;
7
- devServer: boolean;
8
- }
9
- declare function createLoggerConfig(compiler: webpack.Compiler, options: LoggerOptions | undefined): LoggerConfig;
10
- export { LoggerConfig, createLoggerConfig };
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createLoggerConfig = void 0;
4
- const logger_factory_1 = require("./logger-factory");
5
- function createLoggerConfig(compiler, options) {
6
- return {
7
- infrastructure: logger_factory_1.createLogger((options && options.infrastructure) || 'webpack-infrastructure', compiler),
8
- issues: logger_factory_1.createLogger((options && options.issues) || 'console', compiler),
9
- devServer: (options === null || options === void 0 ? void 0 : options.devServer) !== false,
10
- };
11
- }
12
- exports.createLoggerConfig = createLoggerConfig;
@@ -1,5 +0,0 @@
1
- import type webpack from 'webpack';
2
- import type Logger from './logger';
3
- declare type LoggerType = 'console' | 'webpack-infrastructure' | 'silent';
4
- declare function createLogger(type: LoggerType | Logger, compiler: webpack.Compiler): Logger;
5
- export { createLogger, LoggerType };
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createLogger = void 0;
4
- const partial_logger_1 = require("./partial-logger");
5
- const webpack_infrastructure_logger_1 = require("./webpack-infrastructure-logger");
6
- function createLogger(type, compiler) {
7
- if (typeof type !== 'string') {
8
- return type;
9
- }
10
- switch (type) {
11
- case 'webpack-infrastructure':
12
- return (webpack_infrastructure_logger_1.createWebpackInfrastructureLogger(compiler) ||
13
- partial_logger_1.createPartialLogger(['log', 'error'], console));
14
- case 'silent':
15
- return partial_logger_1.createPartialLogger([], console);
16
- case 'console':
17
- default:
18
- return console;
19
- }
20
- }
21
- exports.createLogger = createLogger;
@@ -1,8 +0,0 @@
1
- import type Logger from './logger';
2
- import type { LoggerType } from './logger-factory';
3
- declare type LoggerOptions = {
4
- infrastructure?: LoggerType | Logger;
5
- issues?: LoggerType | Logger;
6
- devServer?: boolean;
7
- };
8
- export default LoggerOptions;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +0,0 @@
1
- import type Logger from './logger';
2
- declare type LoggerMethods = 'info' | 'log' | 'error';
3
- declare function createPartialLogger(methods: LoggerMethods[], logger: Logger): Logger;
4
- export { createPartialLogger };
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createPartialLogger = void 0;
4
- function createPartialLogger(methods, logger) {
5
- return {
6
- info: (message) => (methods.includes('info') ? logger.info(message) : undefined),
7
- log: (message) => (methods.includes('log') ? logger.log(message) : undefined),
8
- error: (message) => (methods.includes('error') ? logger.error(message) : undefined),
9
- };
10
- }
11
- exports.createPartialLogger = createPartialLogger;
@@ -1,4 +0,0 @@
1
- import type webpack from 'webpack';
2
- import type Logger from './logger';
3
- declare function createWebpackInfrastructureLogger(compiler: webpack.Compiler): Logger | undefined;
4
- export { createWebpackInfrastructureLogger };
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createWebpackInfrastructureLogger = void 0;
4
- function isInfrastructureLoggerProvider(candidate) {
5
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
- return !!candidate.getInfrastructureLogger;
7
- }
8
- function createWebpackInfrastructureLogger(compiler) {
9
- return isInfrastructureLoggerProvider(compiler)
10
- ? compiler.getInfrastructureLogger('ForkTsCheckerWebpackPlugin')
11
- : undefined;
12
- }
13
- exports.createWebpackInfrastructureLogger = createWebpackInfrastructureLogger;