fork-ts-checker-webpack-plugin
Advanced tools
Comparing version 7.0.0-alpha.14 to 7.0.0-alpha.15
@@ -132,5 +132,6 @@ { | ||
"write-tsbuildinfo", | ||
"write-dts", | ||
"write-references" | ||
], | ||
"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" | ||
"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" | ||
}, | ||
@@ -137,0 +138,0 @@ "compilerOptions": { |
@@ -73,3 +73,3 @@ "use strict"; | ||
*/ | ||
ForkTsCheckerWebpackPlugin.version = '7.0.0-alpha.14'; // will be replaced by the @semantic-release/exec | ||
ForkTsCheckerWebpackPlugin.version = '7.0.0-alpha.15'; // will be replaced by the @semantic-release/exec | ||
/** | ||
@@ -76,0 +76,0 @@ * Default pools for the plugin concurrency limit |
@@ -13,3 +13,3 @@ import type webpack from 'webpack'; | ||
context: string; | ||
mode: 'readonly' | 'write-tsbuildinfo' | 'write-references'; | ||
mode: 'readonly' | 'write-tsbuildinfo' | 'write-dts' | 'write-references'; | ||
diagnosticOptions: TypeScriptDiagnosticsOptions; | ||
@@ -16,0 +16,0 @@ extensions: { |
@@ -10,3 +10,3 @@ import type { TypeScriptVueExtensionOptions } from './extension/vue/type-script-vue-extension-options'; | ||
build?: boolean; | ||
mode?: 'readonly' | 'write-tsbuildinfo' | 'write-references'; | ||
mode?: 'readonly' | 'write-tsbuildinfo' | 'write-dts' | 'write-references'; | ||
diagnosticOptions?: Partial<TypeScriptDiagnosticsOptions>; | ||
@@ -13,0 +13,0 @@ extensions?: { |
@@ -27,5 +27,5 @@ "use strict"; | ||
system_1.system.invalidateCache(); | ||
dependencies_1.invalidateDependencies(); | ||
if (config_1.didConfigFileChanged({ changedFiles, deletedFiles })) { | ||
config_1.invalidateConfig(); | ||
dependencies_1.invalidateDependencies(); | ||
artifacts_1.invalidateArtifacts(); | ||
@@ -39,3 +39,2 @@ diagnostics_1.invalidateDiagnostics(); | ||
else if (config_1.didRootFilesChanged()) { | ||
dependencies_1.invalidateDependencies(); | ||
artifacts_1.invalidateArtifacts(); | ||
@@ -42,0 +41,0 @@ watch_program_1.invalidateWatchProgramRootFileNames(); |
@@ -37,3 +37,6 @@ "use strict"; | ||
const ignoredPaths = ['/node_modules/.', '/.git', '/.#']; | ||
exports.system = Object.assign(Object.assign({}, typescript_1.typescript.sys), { useCaseSensitiveFileNames: true, fileExists(path) { | ||
exports.system = Object.assign(Object.assign({}, typescript_1.typescript.sys), { useCaseSensitiveFileNames: true, realpath(path) { | ||
return getReadFileSystem(path).realPath(path); | ||
}, | ||
fileExists(path) { | ||
const stats = getReadFileSystem(path).readStats(path); | ||
@@ -196,4 +199,15 @@ return !!stats && stats.isFile(); | ||
function getReadFileSystem(path) { | ||
if (!isInitialRun && (mode === 'readonly' || mode === 'write-tsbuildinfo') && isArtifact(path)) { | ||
return mem_file_system_1.memFileSystem; | ||
if ((mode === 'readonly' || mode === 'write-tsbuildinfo') && isArtifact(path)) { | ||
if (isInitialRun && !mem_file_system_1.memFileSystem.exists(path) && passive_file_system_1.passiveFileSystem.exists(path)) { | ||
// copy file to memory on initial run | ||
const stats = passive_file_system_1.passiveFileSystem.readStats(path); | ||
if (stats === null || stats === void 0 ? void 0 : stats.isFile()) { | ||
const content = passive_file_system_1.passiveFileSystem.readFile(path); | ||
if (content) { | ||
mem_file_system_1.memFileSystem.writeFile(path, content); | ||
mem_file_system_1.memFileSystem.updateTimes(path, stats.atime, stats.mtime); | ||
} | ||
} | ||
return mem_file_system_1.memFileSystem; | ||
} | ||
} | ||
@@ -204,3 +218,5 @@ return passive_file_system_1.passiveFileSystem; | ||
if (mode === 'write-references' || | ||
(mode === 'write-tsbuildinfo' && path.endsWith('.tsbuildinfo'))) { | ||
(mode === 'write-tsbuildinfo' && path.endsWith('.tsbuildinfo')) || | ||
(mode === 'write-dts' && | ||
['.tsbuildinfo', '.d.ts', '.d.ts.map'].some((suffix) => path.endsWith(suffix)))) { | ||
return real_file_system_1.realFileSystem; | ||
@@ -207,0 +223,0 @@ } |
{ | ||
"name": "fork-ts-checker-webpack-plugin", | ||
"version": "7.0.0-alpha.14", | ||
"version": "7.0.0-alpha.15", | ||
"description": "Runs typescript type checker and linter on separate process.", | ||
@@ -73,4 +73,10 @@ "keywords": [ | ||
"typescript": ">3.6.0", | ||
"webpack": "^5.11.0" | ||
"webpack": "^5.11.0", | ||
"vue-template-compiler": "*" | ||
}, | ||
"peerDependenciesMeta": { | ||
"vue-template-compiler": { | ||
"optional": true | ||
} | ||
}, | ||
"devDependencies": { | ||
@@ -77,0 +83,0 @@ "@commitlint/config-conventional": "^13.1.0", |
@@ -109,3 +109,3 @@ <div align="center"> | ||
| `build` | `boolean` | `false` | The equivalent of the `--build` flag for the `tsc` command. | | ||
| `mode` | `'readonly'` or `'write-tsbuildinfo'` or `'write-references'` | `'write-tsbuildinfo'` | If you use the `babel-loader`, it's recommended to use `write-references` mode to improve initial compilation time. If you use `ts-loader`, it's recommended to use `write-tsbuildinfo` mode to not overwrite files emitted by the `ts-loader`. | | ||
| `mode` | `'readonly'` or `'write-tsbuildinfo'` or `'write-dts'` or `'write-references'` | `'write-tsbuildinfo'` | If you use the `babel-loader`, it's recommended to use `write-references` mode to improve initial compilation time. If you use `ts-loader`, it's recommended to use `write-tsbuildinfo` mode to not overwrite files emitted by the `ts-loader`. If you use `ts-loader` with `transpileOnly` flag set to `true`, use `'write-dts` to emit the type definition files. | | ||
| `diagnosticOptions` | `object` | `{ syntactic: false, semantic: true, declaration: false, global: false }` | Settings to select which diagnostics do we want to perform. | | ||
@@ -303,20 +303,33 @@ | `extensions` | `object` | `{}` | See [TypeScript extensions options](#typescript-extensions-options). | | ||
```js | ||
const webpack = require('webpack'); | ||
// ./src/webpack/MyWebpackPlugin.js | ||
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); | ||
const compiler = webpack({ | ||
// ... webpack config | ||
}); | ||
class MyWebpackPlugin { | ||
apply(compiler) { | ||
const hooks = ForkTsCheckerWebpackPlugin.getCompilerHooks(compiler); | ||
// optionally add the plugin to the compiler | ||
// **don't do this if already added through configuration** | ||
new ForkTsCheckerWebpackPlugin().apply(compiler); | ||
// log some message on waiting | ||
hooks.waiting.tap('MyPlugin', () => { | ||
console.log('waiting for issues'); | ||
}); | ||
// don't show warnings | ||
hooks.issues.tap('MyPlugin', (issues) => | ||
issues.filter((issue) => issue.severity === 'error') | ||
); | ||
} | ||
} | ||
// now get the plugin hooks from compiler | ||
const hooks = ForkTsCheckerWebpackPlugin.getCompilerHooks(compiler); | ||
module.exports = MyWebpackPlugin; | ||
// say we want to show some message when plugin is waiting for issues results | ||
hooks.waiting.tap('yourListenerName', () => { | ||
console.log('waiting for issues'); | ||
}); | ||
// webpack.config.js | ||
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); | ||
const MyWebpackPlugin = require('./src/webpack/MyWebpackPlugin'); | ||
module.exports = { | ||
/* ... */ | ||
plugins: [ | ||
new ForkTsCheckerWebpackPlugin(), | ||
new MyWebpackPlugin() | ||
] | ||
}; | ||
``` | ||
@@ -339,3 +352,3 @@ | ||
Starting from TypeScript 4.1.0 (currently in beta), you can profile long type checks by | ||
Starting from TypeScript 4.1.0, you can profile long type checks by | ||
setting "generateTrace" compiler option. This is an instruction from [microsoft/TypeScript#40063](https://github.com/microsoft/TypeScript/pull/40063): | ||
@@ -342,0 +355,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
214452
4221
376
15