fork-ts-checker-webpack-plugin 9.2.0 → 10.0.0-alpha.1

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 (91) hide show
  1. package/README.md +23 -13
  2. package/lib/formatter/basic-formatter.js +2 -2
  3. package/lib/formatter/code-frame-formatter.d.ts +3 -2
  4. package/lib/formatter/code-frame-formatter.js +13 -3
  5. package/lib/formatter/formatter-config.js +2 -1
  6. package/lib/formatter/formatter-options.d.ts +1 -1
  7. package/lib/formatter/stats-formatter.js +3 -3
  8. package/lib/formatter/webpack-formatter.js +5 -9
  9. package/lib/hooks/report-issues.d.ts +8 -0
  10. package/lib/hooks/report-issues.js +22 -0
  11. package/lib/hooks/tap-after-compile-to-add-dependencies.js +3 -12
  12. package/lib/hooks/tap-after-compile-to-get-issues.js +6 -27
  13. package/lib/hooks/tap-done-to-async-get-issues.js +12 -32
  14. package/lib/hooks/tap-error-to-log-message.js +5 -7
  15. package/lib/hooks/tap-start-to-run-workers.js +12 -22
  16. package/lib/issue/issue-webpack-error.js +4 -11
  17. package/lib/plugin-options.json +4 -8
  18. package/lib/plugin-state.d.ts +0 -1
  19. package/lib/plugin.js +23 -23
  20. package/lib/rpc/expose-rpc.js +5 -14
  21. package/lib/rpc/rpc-error.js +2 -0
  22. package/lib/rpc/rpc-worker.d.ts +1 -1
  23. package/lib/rpc/rpc-worker.js +7 -7
  24. package/lib/rpc/wrap-rpc.js +3 -12
  25. package/lib/typescript/type-script-package.d.ts +4 -0
  26. package/lib/typescript/type-script-package.js +88 -0
  27. package/lib/typescript/type-script-support.js +8 -18
  28. package/lib/typescript/type-script-worker-config.d.ts +2 -3
  29. package/lib/typescript/type-script-worker-config.js +23 -2
  30. package/lib/typescript/type-script-worker-options.d.ts +4 -3
  31. package/lib/typescript/type-script-worker-options.js +4 -0
  32. package/lib/typescript/worker/get-dependencies-worker.js +15 -4
  33. package/lib/typescript/worker/get-issues-worker.d.ts +1 -1
  34. package/lib/typescript/worker/get-issues-worker.js +52 -64
  35. package/lib/typescript/worker/lib/api.d.ts +13 -0
  36. package/lib/typescript/worker/lib/api.js +62 -0
  37. package/lib/typescript/worker/lib/config.d.ts +13 -9
  38. package/lib/typescript/worker/lib/config.js +63 -63
  39. package/lib/typescript/worker/lib/dependencies.d.ts +6 -1
  40. package/lib/typescript/worker/lib/dependencies.js +168 -43
  41. package/lib/typescript/worker/lib/diagnostics.d.ts +5 -4
  42. package/lib/typescript/worker/lib/diagnostics.js +44 -50
  43. package/lib/typescript/worker/lib/in-memory-file-system.d.ts +14 -0
  44. package/lib/typescript/worker/lib/in-memory-file-system.js +140 -0
  45. package/lib/typescript/worker/lib/performance.d.ts +1 -2
  46. package/lib/typescript/worker/lib/performance.js +12 -19
  47. package/lib/typescript/worker/lib/program/program.d.ts +6 -2
  48. package/lib/typescript/worker/lib/program/program.js +135 -24
  49. package/lib/typescript/worker/lib/program/solution-builder.d.ts +3 -1
  50. package/lib/typescript/worker/lib/program/solution-builder.js +41 -24
  51. package/lib/typescript/worker/lib/typescript.d.ts +4 -2
  52. package/lib/typescript/worker/lib/typescript.js +69 -3
  53. package/lib/utils/async/abort-error.d.ts +0 -1
  54. package/lib/utils/async/abort-error.js +1 -1
  55. package/lib/utils/async/pool.d.ts +0 -1
  56. package/lib/utils/async/pool.js +12 -23
  57. package/lib/utils/deep-merge.d.ts +5 -0
  58. package/lib/utils/deep-merge.js +56 -0
  59. package/lib/utils/path/format-file-path.d.ts +3 -0
  60. package/lib/utils/path/format-file-path.js +15 -0
  61. package/lib/watch/inclusive-node-watch-file-system.d.ts +3 -0
  62. package/lib/watch/inclusive-node-watch-file-system.js +119 -111
  63. package/package.json +30 -38
  64. package/lib/formatter/types/babel__code-frame.d.ts +0 -21
  65. package/lib/formatter/types/babel__code-frame.js +0 -7
  66. package/lib/typescript/worker/lib/artifacts.d.ts +0 -4
  67. package/lib/typescript/worker/lib/artifacts.js +0 -103
  68. package/lib/typescript/worker/lib/emit.d.ts +0 -2
  69. package/lib/typescript/worker/lib/emit.js +0 -12
  70. package/lib/typescript/worker/lib/file-system/file-system.d.ts +0 -17
  71. package/lib/typescript/worker/lib/file-system/file-system.js +0 -2
  72. package/lib/typescript/worker/lib/file-system/mem-file-system.d.ts +0 -5
  73. package/lib/typescript/worker/lib/file-system/mem-file-system.js +0 -79
  74. package/lib/typescript/worker/lib/file-system/passive-file-system.d.ts +0 -5
  75. package/lib/typescript/worker/lib/file-system/passive-file-system.js +0 -65
  76. package/lib/typescript/worker/lib/file-system/real-file-system.d.ts +0 -5
  77. package/lib/typescript/worker/lib/file-system/real-file-system.js +0 -201
  78. package/lib/typescript/worker/lib/host/compiler-host.d.ts +0 -2
  79. package/lib/typescript/worker/lib/host/compiler-host.js +0 -9
  80. package/lib/typescript/worker/lib/host/watch-compiler-host.d.ts +0 -2
  81. package/lib/typescript/worker/lib/host/watch-compiler-host.js +0 -19
  82. package/lib/typescript/worker/lib/host/watch-solution-builder-host.d.ts +0 -2
  83. package/lib/typescript/worker/lib/host/watch-solution-builder-host.js +0 -46
  84. package/lib/typescript/worker/lib/program/watch-program.d.ts +0 -3
  85. package/lib/typescript/worker/lib/program/watch-program.js +0 -50
  86. package/lib/typescript/worker/lib/system.d.ts +0 -19
  87. package/lib/typescript/worker/lib/system.js +0 -232
  88. package/lib/typescript/worker/lib/tracing.d.ts +0 -4
  89. package/lib/typescript/worker/lib/tracing.js +0 -28
  90. package/lib/typescript/worker/lib/tsbuildinfo.d.ts +0 -4
  91. package/lib/typescript/worker/lib/tsbuildinfo.js +0 -105
@@ -33,134 +33,142 @@ function createIsIgnored(ignored, excluded) {
33
33
  };
34
34
  }
35
35
  class InclusiveNodeWatchFileSystem {
36
+ watchFileSystem;
37
+ compiler;
38
+ pluginState;
36
39
  get watcher() {
37
- var _a;
38
- return this.watchFileSystem.watcher || ((_a = this.watchFileSystem.wfs) === null || _a === void 0 ? void 0 : _a.watcher);
40
+ return this.watchFileSystem.watcher || this.watchFileSystem.wfs?.watcher;
39
41
  }
42
+ dirsWatchers;
43
+ paused = true;
44
+ deletedFiles;
40
45
  constructor(watchFileSystem, compiler, pluginState) {
41
46
  this.watchFileSystem = watchFileSystem;
42
47
  this.compiler = compiler;
43
48
  this.pluginState = pluginState;
44
- this.paused = true;
45
- this.watch = (files, dirs, missing, startTime, options, callback, callbackUndelayed) => {
46
- var _a, _b, _c, _d;
47
- const { debug } = (0, infrastructure_logger_1.getInfrastructureLogger)(this.compiler);
48
- (0, files_change_1.clearFilesChange)(this.compiler);
49
- const isIgnored = createIsIgnored(options === null || options === void 0 ? void 0 : options.ignored, ((_a = this.pluginState.lastDependencies) === null || _a === void 0 ? void 0 : _a.excluded) || []);
50
- // use standard watch file system for files and missing
51
- const standardWatcher = this.watchFileSystem.watch(files, dirs, missing, startTime, options, callback, callbackUndelayed);
52
- (_b = this.watcher) === null || _b === void 0 ? void 0 : _b.on('change', (file) => {
53
- if (typeof file !== 'string') {
49
+ this.dirsWatchers = new Map();
50
+ this.deletedFiles = new Set();
51
+ }
52
+ hasSupportedExtension(file) {
53
+ const supportedExtensions = this.pluginState.lastDependencies?.extensions || [];
54
+ return supportedExtensions.includes((0, path_1.extname)(file));
55
+ }
56
+ addChangedFile(file) {
57
+ this.deletedFiles.delete(file);
58
+ (0, files_change_1.updateFilesChange)(this.compiler, { changedFiles: [file] });
59
+ }
60
+ addDeletedFile(file) {
61
+ this.deletedFiles.add(file);
62
+ (0, files_change_1.updateFilesChange)(this.compiler, { deletedFiles: [file] });
63
+ }
64
+ watch = (files, dirs, missing, startTime, options, callback, callbackUndelayed) => {
65
+ const { debug } = (0, infrastructure_logger_1.getInfrastructureLogger)(this.compiler);
66
+ (0, files_change_1.clearFilesChange)(this.compiler);
67
+ const isIgnored = createIsIgnored(options?.ignored, this.pluginState.lastDependencies?.excluded || []);
68
+ // use standard watch file system for files and missing
69
+ const standardWatcher = this.watchFileSystem.watch(files, dirs, missing, startTime, options, callback, callbackUndelayed);
70
+ this.watcher?.on('change', (file) => {
71
+ if (typeof file !== 'string') {
72
+ return;
73
+ }
74
+ if (!isIgnored(file)) {
75
+ debug('Detected file change', file);
76
+ this.addChangedFile(file);
77
+ }
78
+ else {
79
+ debug("Detected file change but it's ignored", file);
80
+ }
81
+ });
82
+ this.watcher?.on('remove', (file) => {
83
+ if (typeof file !== 'string') {
84
+ return;
85
+ }
86
+ if (this.deletedFiles.has(file)) {
87
+ debug('Skipping duplicated remove event.');
88
+ return;
89
+ }
90
+ if (!isIgnored(file)) {
91
+ debug('Detected file remove', file);
92
+ this.addDeletedFile(file);
93
+ }
94
+ else {
95
+ debug("Detected file remove but it's ignored", file);
96
+ }
97
+ });
98
+ // calculate what to change
99
+ const prevDirs = Array.from(this.dirsWatchers.keys());
100
+ const nextDirs = Array.from(this.pluginState.lastDependencies?.dirs || []);
101
+ const dirsToUnwatch = prevDirs.filter((prevDir) => !nextDirs.includes(prevDir));
102
+ const dirsToWatch = nextDirs.filter((nextDir) => !prevDirs.includes(nextDir) && !isIgnored(nextDir));
103
+ // update dirs watcher
104
+ dirsToUnwatch.forEach((dirToUnwatch) => {
105
+ this.dirsWatchers.get(dirToUnwatch)?.close();
106
+ this.dirsWatchers.delete(dirToUnwatch);
107
+ });
108
+ dirsToWatch.forEach((dirToWatch) => {
109
+ const interval = typeof options?.poll === 'number' ? options.poll : undefined;
110
+ const dirWatcher = chokidar_1.default.watch(dirToWatch, {
111
+ ignoreInitial: true,
112
+ ignorePermissionErrors: true,
113
+ ignored: (path) => isIgnored(path),
114
+ usePolling: options?.poll ? true : undefined,
115
+ interval: interval,
116
+ binaryInterval: interval,
117
+ alwaysStat: true,
118
+ atomic: true,
119
+ awaitWriteFinish: true,
120
+ });
121
+ dirWatcher.on('add', (file, stats) => {
122
+ if (this.paused) {
54
123
  return;
55
124
  }
56
- if (!isIgnored(file)) {
57
- debug('Detected file change', file);
58
- this.deletedFiles.delete(file);
59
- (0, files_change_1.updateFilesChange)(this.compiler, { changedFiles: [file] });
60
- }
61
- else {
62
- debug("Detected file change but it's ignored", file);
125
+ if (!this.hasSupportedExtension(file)) {
126
+ debug('Detected new file add but extension is not supported', file);
127
+ return;
63
128
  }
129
+ debug('Detected new file add', file);
130
+ this.addChangedFile(file);
131
+ this.watcher?._onChange(dirToWatch, stats?.mtimeMs || stats?.ctimeMs || 1, file, 'rename');
64
132
  });
65
- (_c = this.watcher) === null || _c === void 0 ? void 0 : _c.on('remove', (file) => {
66
- if (typeof file !== 'string') {
133
+ dirWatcher.on('unlink', (file) => {
134
+ if (this.paused) {
67
135
  return;
68
136
  }
69
- if (this.deletedFiles.has(file)) {
70
- debug('Skipping duplicated remove event.');
137
+ if (!this.hasSupportedExtension(file)) {
138
+ debug('Detected new file remove but extension is not supported', file);
71
139
  return;
72
140
  }
73
- if (!isIgnored(file)) {
74
- debug('Detected file remove', file);
75
- this.deletedFiles.add(file);
76
- (0, files_change_1.updateFilesChange)(this.compiler, { deletedFiles: [file] });
77
- }
78
- else {
79
- debug("Detected file remove but it's ignored", file);
141
+ if (this.deletedFiles.has(file)) {
142
+ debug('Skipping duplicated unlink event.');
143
+ return;
80
144
  }
145
+ debug('Detected new file remove', file);
146
+ this.addDeletedFile(file);
147
+ this.watcher?._onRemove(dirToWatch, file, 'rename');
81
148
  });
82
- // calculate what to change
83
- const prevDirs = Array.from(this.dirsWatchers.keys());
84
- const nextDirs = Array.from(((_d = this.pluginState.lastDependencies) === null || _d === void 0 ? void 0 : _d.dirs) || []);
85
- const dirsToUnwatch = prevDirs.filter((prevDir) => !nextDirs.includes(prevDir));
86
- const dirsToWatch = nextDirs.filter((nextDir) => !prevDirs.includes(nextDir) && !isIgnored(nextDir));
87
- // update dirs watcher
88
- dirsToUnwatch.forEach((dirToUnwatch) => {
89
- var _a;
90
- (_a = this.dirsWatchers.get(dirToUnwatch)) === null || _a === void 0 ? void 0 : _a.close();
91
- this.dirsWatchers.delete(dirToUnwatch);
92
- });
93
- dirsToWatch.forEach((dirToWatch) => {
94
- const interval = typeof (options === null || options === void 0 ? void 0 : options.poll) === 'number' ? options.poll : undefined;
95
- const dirWatcher = chokidar_1.default.watch(dirToWatch, {
96
- ignoreInitial: true,
97
- ignorePermissionErrors: true,
98
- ignored: (path) => isIgnored(path),
99
- usePolling: (options === null || options === void 0 ? void 0 : options.poll) ? true : undefined,
100
- interval: interval,
101
- binaryInterval: interval,
102
- alwaysStat: true,
103
- atomic: true,
104
- awaitWriteFinish: true,
105
- });
106
- dirWatcher.on('add', (file, stats) => {
107
- var _a, _b;
108
- if (this.paused) {
109
- return;
110
- }
111
- const extension = (0, path_1.extname)(file);
112
- const supportedExtensions = ((_a = this.pluginState.lastDependencies) === null || _a === void 0 ? void 0 : _a.extensions) || [];
113
- if (!supportedExtensions.includes(extension)) {
114
- debug('Detected new file add but extension is not supported', file);
115
- return;
116
- }
117
- debug('Detected new file add', file);
118
- this.deletedFiles.delete(file);
119
- (0, files_change_1.updateFilesChange)(this.compiler, { changedFiles: [file] });
120
- (_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');
121
- });
122
- dirWatcher.on('unlink', (file) => {
123
- var _a, _b;
124
- if (this.paused) {
125
- return;
126
- }
127
- const extension = (0, path_1.extname)(file);
128
- const supportedExtensions = ((_a = this.pluginState.lastDependencies) === null || _a === void 0 ? void 0 : _a.extensions) || [];
129
- if (!supportedExtensions.includes(extension)) {
130
- debug('Detected new file remove but extension is not supported', file);
131
- return;
132
- }
133
- if (this.deletedFiles.has(file)) {
134
- debug('Skipping duplicated unlink event.');
135
- return;
136
- }
137
- debug('Detected new file remove', file);
138
- this.deletedFiles.add(file);
139
- (0, files_change_1.updateFilesChange)(this.compiler, { deletedFiles: [file] });
140
- (_b = this.watcher) === null || _b === void 0 ? void 0 : _b._onRemove(dirToWatch, file, 'rename');
149
+ this.dirsWatchers.set(dirToWatch, dirWatcher);
150
+ });
151
+ this.paused = false;
152
+ return {
153
+ ...standardWatcher,
154
+ close: () => {
155
+ (0, files_change_1.clearFilesChange)(this.compiler);
156
+ if (standardWatcher) {
157
+ standardWatcher.close();
158
+ }
159
+ this.dirsWatchers.forEach((dirWatcher) => {
160
+ dirWatcher?.close();
141
161
  });
142
- this.dirsWatchers.set(dirToWatch, dirWatcher);
143
- });
144
- this.paused = false;
145
- return Object.assign(Object.assign({}, standardWatcher), { close: () => {
146
- (0, files_change_1.clearFilesChange)(this.compiler);
147
- if (standardWatcher) {
148
- standardWatcher.close();
149
- }
150
- this.dirsWatchers.forEach((dirWatcher) => {
151
- dirWatcher === null || dirWatcher === void 0 ? void 0 : dirWatcher.close();
152
- });
153
- this.dirsWatchers.clear();
154
- this.paused = true;
155
- }, pause: () => {
156
- if (standardWatcher) {
157
- standardWatcher.pause();
158
- }
159
- this.paused = true;
160
- } });
162
+ this.dirsWatchers.clear();
163
+ this.paused = true;
164
+ },
165
+ pause: () => {
166
+ if (standardWatcher) {
167
+ standardWatcher.pause();
168
+ }
169
+ this.paused = true;
170
+ },
161
171
  };
162
- this.dirsWatchers = new Map();
163
- this.deletedFiles = new Set();
164
- }
172
+ };
165
173
  }
166
174
  exports.InclusiveNodeWatchFileSystem = InclusiveNodeWatchFileSystem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fork-ts-checker-webpack-plugin",
3
- "version": "9.2.0",
3
+ "version": "10.0.0-alpha.1",
4
4
  "description": "Runs typescript type checker and linter on separate process.",
5
5
  "keywords": [
6
6
  "webpack",
@@ -31,14 +31,16 @@
31
31
  "main": "lib/index.js",
32
32
  "types": "lib/index.d.ts",
33
33
  "scripts": {
34
- "build": "cross-env rimraf lib && cross-env tsc --version && cross-env tsc",
35
- "lint": "cross-env eslint ./src ./test",
34
+ "build": "node -e \"require('fs').rmSync('lib',{recursive:true,force:true})\" && tsc --version && tsc",
35
+ "lint": "tsc -p . --noEmit && tsc -p test --noEmit && oxlint src test",
36
36
  "test": "npm run build && npm run test:unit && npm run test:e2e",
37
- "test:unit": "cross-env jest --config=test/unit/jest.config.js",
38
- "test:e2e": "npm pack && cross-env jest --config=test/e2e/jest.config.js --ci -i -b",
39
- "commit": "cross-env git-cz",
37
+ "test:unit": "jest --config=test/unit/jest.config.js",
38
+ "test:e2e": "npm pack && jest --config=test/e2e/jest.config.js --ci -i -b",
39
+ "precommit": "lint-staged && npm run build && npm run test:unit",
40
+ "commit": "git-cz",
40
41
  "semantic-release": "semantic-release",
41
- "prepare": "husky"
42
+ "prepare": "husky",
43
+ "format:check": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\""
42
44
  },
43
45
  "commitlint": {
44
46
  "extends": [
@@ -46,7 +48,10 @@
46
48
  ]
47
49
  },
48
50
  "lint-staged": {
49
- "*.ts": "eslint --fix"
51
+ "*.ts": [
52
+ "oxlint --fix",
53
+ "prettier --write"
54
+ ]
50
55
  },
51
56
  "config": {
52
57
  "commitizen": {
@@ -54,64 +59,51 @@
54
59
  }
55
60
  },
56
61
  "dependencies": {
57
- "@babel/code-frame": "^7.29.7",
58
- "chalk": "^4.1.2",
59
- "chokidar": "^4.0.3",
60
- "cosmiconfig": "^9.0.2",
61
- "deepmerge": "^4.3.1",
62
- "fs-extra": "^11.4.1",
63
- "memfs": "^3.6.0",
64
- "minimatch": "^9.0.9",
65
- "node-abort-controller": "^3.0.1",
62
+ "@babel/code-frame": "^8.0.6",
63
+ "chokidar": "^6.0.0",
64
+ "cosmiconfig": "^10.0.1",
65
+ "minimatch": "^11.0.9",
66
+ "picocolors": "^1.1.1",
66
67
  "schema-utils": "^4.8.3",
67
68
  "semver": "^7.8.6",
68
69
  "tapable": "^2.3.4"
69
70
  },
70
71
  "peerDependencies": {
71
- "typescript": ">3.6.0",
72
+ "typescript": ">=7.1.0-beta",
72
73
  "webpack": "^5.11.0"
73
74
  },
74
75
  "devDependencies": {
75
- "@commitlint/config-conventional": "^20.5.3",
76
- "@eslint/js": "^9.39.5",
76
+ "@commitlint/config-conventional": "^21.2.4",
77
77
  "@semantic-release/commit-analyzer": "^13.0.1",
78
78
  "@semantic-release/exec": "^7.1.0",
79
79
  "@semantic-release/github": "^12.0.11",
80
80
  "@semantic-release/npm": "^13.2.0",
81
81
  "@semantic-release/release-notes-generator": "^14.1.1",
82
- "@types/babel__code-frame": "^7.0.3",
83
- "@types/fs-extra": "^11.0.4",
82
+ "@swc/core": "^1.16.22",
83
+ "@swc/jest": "^0.2.39",
84
84
  "@types/jest": "^30.0.0",
85
85
  "@types/json-schema": "^7.0.15",
86
86
  "@types/node": "^22.20.5",
87
87
  "@types/semver": "^7.8.0",
88
- "@typescript-eslint/eslint-plugin": "^8.72.2",
89
- "@typescript-eslint/parser": "^8.72.2",
90
- "@yarnpkg/cli-dist": "4.7.0",
91
- "commitlint": "^20.5.3",
92
- "cross-env": "^7.0.3",
93
- "eslint": "^9.39.5",
94
- "eslint-plugin-import": "^2.32.0",
95
- "eslint-plugin-n": "^17.24.0",
96
- "eslint-plugin-prettier": "^5.5.7",
88
+ "commitlint": "^21.2.4",
97
89
  "git-cz": "^4.9.0",
98
90
  "husky": "^9.1.7",
99
91
  "jest": "^30.5.2",
100
- "jest-circus": "^30.5.2",
101
92
  "jest-environment-node": "^30.5.2",
102
93
  "json-schema": "^0.4.0",
103
94
  "karton": "^0.4.1",
104
- "lint-staged": "^15.5.2",
95
+ "lint-staged": "^17.6.0",
96
+ "oxlint": "^1.93.0",
105
97
  "prettier": "^3.10.1",
106
- "rimraf": "^5.0.10",
107
98
  "semantic-release": "^25.0.9",
108
- "strip-ansi": "^6.0.0",
109
- "ts-jest": "^29.4.15",
110
- "typescript": "6.0.3",
99
+ "typescript": "7.1.0-beta",
111
100
  "webpack": "^5.112.2"
112
101
  },
102
+ "overrides": {
103
+ "typescript": "$typescript"
104
+ },
113
105
  "engines": {
114
- "node": ">=14.21.3"
106
+ "node": "^22.22.0 || >=24.11.0"
115
107
  },
116
108
  "packageManager": "npm@11.21.2"
117
109
  }
@@ -1,21 +0,0 @@
1
- export interface BabelCodeFrameOptions {
2
- /** Syntax highlight the code as JavaScript for terminals. default: false */
3
- highlightCode?: boolean;
4
- /** The number of lines to show above the error. default: 2 */
5
- linesAbove?: number;
6
- /** The number of lines to show below the error. default: 3 */
7
- linesBelow?: number;
8
- /**
9
- * Forcibly syntax highlight the code as JavaScript (for non-terminals);
10
- * overrides highlightCode.
11
- * default: false
12
- */
13
- forceColor?: boolean;
14
- /**
15
- * Pass in a string to be displayed inline (if possible) next to the
16
- * highlighted location in the code. If it can't be positioned inline,
17
- * it will be placed above the code frame.
18
- * default: nothing
19
- */
20
- message?: string;
21
- }
@@ -1,7 +0,0 @@
1
- "use strict";
2
- // Base on the type definitions for @babel/code-frame 7.0
3
- // Project: https://github.com/babel/babel/tree/main/packages/babel-code-frame, https://babeljs.io
4
- // Definitions by: Mohsen Azimi <https://github.com/mohsen1>
5
- // Forbes Lindesay <https://github.com/ForbesLindesay>
6
- // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
7
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +0,0 @@
1
- import type { FilesMatch } from '../../../files-match';
2
- export declare function getArtifacts(force?: boolean): FilesMatch;
3
- export declare function invalidateArtifacts(): void;
4
- export declare function registerArtifacts(): void;
@@ -1,103 +0,0 @@
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 () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.getArtifacts = getArtifacts;
37
- exports.invalidateArtifacts = invalidateArtifacts;
38
- exports.registerArtifacts = registerArtifacts;
39
- const path = __importStar(require("path"));
40
- const config_1 = require("./config");
41
- const system_1 = require("./system");
42
- const tsbuildinfo_1 = require("./tsbuildinfo");
43
- const typescript_1 = require("./typescript");
44
- const worker_config_1 = require("./worker-config");
45
- let artifacts;
46
- function getArtifacts(force = false) {
47
- if (!artifacts || force) {
48
- const parsedConfig = (0, config_1.getParsedConfig)();
49
- artifacts = getArtifactsWorker(parsedConfig, worker_config_1.config.context);
50
- }
51
- return artifacts;
52
- }
53
- function invalidateArtifacts() {
54
- artifacts = undefined;
55
- }
56
- function registerArtifacts() {
57
- system_1.system.setArtifacts(getArtifacts());
58
- }
59
- function getArtifactsWorker(parsedConfig, configFileContext, processedConfigFiles = []) {
60
- const files = new Set();
61
- const dirs = new Set();
62
- if (parsedConfig.fileNames.length > 0) {
63
- if (parsedConfig.options.outFile) {
64
- files.add(path.resolve(configFileContext, parsedConfig.options.outFile));
65
- }
66
- const tsBuildInfoPath = (0, tsbuildinfo_1.getTsBuildInfoEmitPath)(parsedConfig.options);
67
- if (tsBuildInfoPath) {
68
- files.add(path.resolve(configFileContext, tsBuildInfoPath));
69
- }
70
- if (parsedConfig.options.outDir) {
71
- dirs.add(path.resolve(configFileContext, parsedConfig.options.outDir));
72
- }
73
- }
74
- for (const projectReference of parsedConfig.projectReferences || []) {
75
- const configFile = typescript_1.typescript.resolveProjectReferencePath(projectReference);
76
- if (processedConfigFiles.includes(configFile)) {
77
- // handle circular dependencies
78
- continue;
79
- }
80
- const parsedConfig = (0, config_1.parseConfig)(configFile, path.dirname(configFile));
81
- const childArtifacts = getArtifactsWorker(parsedConfig, configFileContext, [
82
- ...processedConfigFiles,
83
- configFile,
84
- ]);
85
- childArtifacts.files.forEach((file) => {
86
- files.add(file);
87
- });
88
- childArtifacts.dirs.forEach((dir) => {
89
- dirs.add(dir);
90
- });
91
- }
92
- const extensions = [
93
- typescript_1.typescript.Extension.Dts,
94
- typescript_1.typescript.Extension.Js,
95
- typescript_1.typescript.Extension.TsBuildInfo,
96
- ];
97
- return {
98
- files: Array.from(files).map((file) => path.normalize(file)),
99
- dirs: Array.from(dirs).map((dir) => path.normalize(dir)),
100
- excluded: [],
101
- extensions,
102
- };
103
- }
@@ -1,2 +0,0 @@
1
- import type * as ts from 'typescript';
2
- export declare function emitDtsIfNeeded(program: ts.Program | ts.BuilderProgram): void;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.emitDtsIfNeeded = emitDtsIfNeeded;
4
- const config_1 = require("./config");
5
- const worker_config_1 = require("./worker-config");
6
- function emitDtsIfNeeded(program) {
7
- const parsedConfig = (0, config_1.getParsedConfig)();
8
- if (worker_config_1.config.mode === 'write-dts' && parsedConfig.options.declaration) {
9
- // emit .d.ts files only
10
- program.emit(undefined, undefined, undefined, true);
11
- }
12
- }
@@ -1,17 +0,0 @@
1
- import type { Dirent, Stats } from 'fs';
2
- /**
3
- * Interface to abstract file system implementation details.
4
- */
5
- export interface FileSystem {
6
- exists(path: string): boolean;
7
- readFile(path: string, encoding?: string): string | undefined;
8
- readDir(path: string): Dirent[];
9
- readStats(path: string): Stats | undefined;
10
- realPath(path: string): string;
11
- normalizePath(path: string): string;
12
- writeFile(path: string, data: string): void;
13
- deleteFile(path: string): void;
14
- createDir(path: string): void;
15
- updateTimes(path: string, atime: Date, mtime: Date): void;
16
- clearCache(): void;
17
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +0,0 @@
1
- import type { FileSystem } from './file-system';
2
- /**
3
- * It's an implementation of FileSystem interface which reads and writes to the in-memory file system.
4
- */
5
- export declare const memFileSystem: FileSystem;
@@ -1,79 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.memFileSystem = void 0;
4
- const path_1 = require("path");
5
- const memfs_1 = require("memfs");
6
- const real_file_system_1 = require("./real-file-system");
7
- /**
8
- * It's an implementation of FileSystem interface which reads and writes to the in-memory file system.
9
- */
10
- exports.memFileSystem = Object.assign(Object.assign({}, real_file_system_1.realFileSystem), { exists(path) {
11
- return exists(real_file_system_1.realFileSystem.realPath(path));
12
- },
13
- readFile(path, encoding) {
14
- return readFile(real_file_system_1.realFileSystem.realPath(path), encoding);
15
- },
16
- readDir(path) {
17
- return readDir(real_file_system_1.realFileSystem.realPath(path));
18
- },
19
- readStats(path) {
20
- return readStats(real_file_system_1.realFileSystem.realPath(path));
21
- },
22
- writeFile(path, data) {
23
- writeFile(real_file_system_1.realFileSystem.realPath(path), data);
24
- },
25
- deleteFile(path) {
26
- deleteFile(real_file_system_1.realFileSystem.realPath(path));
27
- },
28
- createDir(path) {
29
- createDir(real_file_system_1.realFileSystem.realPath(path));
30
- },
31
- updateTimes(path, atime, mtime) {
32
- updateTimes(real_file_system_1.realFileSystem.realPath(path), atime, mtime);
33
- },
34
- clearCache() {
35
- real_file_system_1.realFileSystem.clearCache();
36
- } });
37
- function exists(path) {
38
- return memfs_1.fs.existsSync(real_file_system_1.realFileSystem.normalizePath(path));
39
- }
40
- function readStats(path) {
41
- return exists(path) ? memfs_1.fs.statSync(real_file_system_1.realFileSystem.normalizePath(path)) : undefined;
42
- }
43
- function readFile(path, encoding) {
44
- const stats = readStats(path);
45
- if (stats && stats.isFile()) {
46
- return memfs_1.fs
47
- .readFileSync(real_file_system_1.realFileSystem.normalizePath(path), { encoding: encoding })
48
- .toString();
49
- }
50
- }
51
- function readDir(path) {
52
- const stats = readStats(path);
53
- if (stats && stats.isDirectory()) {
54
- // memfs has its own Dirent type, which lacks properties added in newer versions of Node.js
55
- return memfs_1.fs.readdirSync(real_file_system_1.realFileSystem.normalizePath(path), {
56
- withFileTypes: true,
57
- });
58
- }
59
- return [];
60
- }
61
- function createDir(path) {
62
- memfs_1.fs.mkdirSync(real_file_system_1.realFileSystem.normalizePath(path), { recursive: true });
63
- }
64
- function writeFile(path, data) {
65
- if (!exists((0, path_1.dirname)(path))) {
66
- createDir((0, path_1.dirname)(path));
67
- }
68
- memfs_1.fs.writeFileSync(real_file_system_1.realFileSystem.normalizePath(path), data);
69
- }
70
- function deleteFile(path) {
71
- if (exists(path)) {
72
- memfs_1.fs.unlinkSync(real_file_system_1.realFileSystem.normalizePath(path));
73
- }
74
- }
75
- function updateTimes(path, atime, mtime) {
76
- if (exists(path)) {
77
- memfs_1.fs.utimesSync(real_file_system_1.realFileSystem.normalizePath(path), atime, mtime);
78
- }
79
- }
@@ -1,5 +0,0 @@
1
- import type { FileSystem } from './file-system';
2
- /**
3
- * It's an implementation of FileSystem interface which reads from the real file system, but write to the in-memory file system.
4
- */
5
- export declare const passiveFileSystem: FileSystem;