Socket
Socket
Sign inDemoInstall

fork-ts-checker-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
222
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fork-ts-checker-webpack-plugin - npm Package Compare versions

Comparing version 7.0.0 to 7.1.0

lib/formatter/stats-formatter.d.ts

12

lib/hooks/tap-done-to-async-get-issues.js

@@ -17,2 +17,3 @@ "use strict";

const chalk_1 = __importDefault(require("chalk"));
const stats_formatter_1 = require("../formatter/stats-formatter");
const webpack_formatter_1 = require("../formatter/webpack-formatter");

@@ -26,3 +27,3 @@ const infrastructure_logger_1 = require("../infrastructure-logger");

const hooks = (0, plugin_hooks_1.getPluginHooks)(compiler);
const { log, debug } = (0, infrastructure_logger_1.getInfrastructureLogger)(compiler);
const { debug } = (0, infrastructure_logger_1.getInfrastructureLogger)(compiler);
compiler.hooks.done.tap('ForkTsCheckerWebpackPlugin', (stats) => __awaiter(this, void 0, void 0, function* () {

@@ -38,3 +39,3 @@ if (stats.compilation.compiler !== compiler) {

hooks.waiting.call(stats.compilation);
config.logger.log(chalk_1.default.cyan('Issues checking in progress...'));
config.logger.log(chalk_1.default.cyan('Type-checking in progress...'));
}

@@ -64,5 +65,7 @@ else {

config.logger.error(issues.map((issue) => formatter(issue)).join('\n'));
// print stats of the compilation
config.logger.log((0, stats_formatter_1.statsFormatter)(issues, stats));
}
else {
config.logger.log(chalk_1.default.green('No issues found.'));
config.logger.log(chalk_1.default.green('No errors found.'));
}

@@ -84,7 +87,4 @@ // report issues to webpack-dev-server, if it's listening

}
if (stats.startTime) {
log(`Time: ${Math.round(Date.now() - stats.startTime).toString()} ms`);
}
}));
}
exports.tapDoneToAsyncGetIssues = tapDoneToAsyncGetIssues;

@@ -73,3 +73,3 @@ "use strict";

*/
ForkTsCheckerWebpackPlugin.version = '7.0.0'; // will be replaced by the @semantic-release/exec
ForkTsCheckerWebpackPlugin.version = '7.1.0'; // 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-dts' | 'write-references';
mode: 'readonly' | 'write-dts' | 'write-tsbuildinfo' | 'write-references';
diagnosticOptions: TypeScriptDiagnosticsOptions;

@@ -16,0 +16,0 @@ extensions: {

@@ -8,3 +8,2 @@ "use strict";

const path_1 = __importDefault(require("path"));
const semver_1 = __importDefault(require("semver"));
const type_script_vue_extension_config_1 = require("./extension/vue/type-script-vue-extension-config");

@@ -19,12 +18,3 @@ function createTypeScriptWorkerConfig(compiler, options) {

const typescriptPath = optionsAsObject.typescriptPath || require.resolve('typescript');
const defaultCompilerOptions = {
skipLibCheck: true,
sourceMap: false,
inlineSourceMap: false,
};
// eslint-disable-next-line @typescript-eslint/no-var-requires
if (semver_1.default.gte(require(typescriptPath).version, '2.9.0')) {
defaultCompilerOptions.declarationMap = false;
}
return Object.assign(Object.assign({ enabled: options !== false, memoryLimit: 2048, build: false, mode: 'write-tsbuildinfo', profile: false }, optionsAsObject), { configFile: configFile, configOverwrite: Object.assign(Object.assign({}, (optionsAsObject.configOverwrite || {})), { compilerOptions: Object.assign(Object.assign({}, defaultCompilerOptions), ((optionsAsObject.configOverwrite || {}).compilerOptions || {})) }), context: optionsAsObject.context || path_1.default.dirname(configFile), extensions: {
return Object.assign(Object.assign({ enabled: options !== false, memoryLimit: 2048, build: false, mode: optionsAsObject.build ? 'write-tsbuildinfo' : 'readonly', profile: false }, optionsAsObject), { configFile: configFile, configOverwrite: optionsAsObject.configOverwrite || {}, context: optionsAsObject.context || path_1.default.dirname(configFile), extensions: {
vue: (0, type_script_vue_extension_config_1.createTypeScriptVueExtensionConfig)(optionsAsObject.extensions ? optionsAsObject.extensions.vue : undefined),

@@ -31,0 +21,0 @@ }, diagnosticOptions: Object.assign({ syntactic: false, semantic: true, declaration: false, global: false }, (optionsAsObject.diagnosticOptions || {})), typescriptPath: typescriptPath });

import type * as ts from 'typescript';
import type { FilesChange } from '../../../files-change';
import type { Issue } from '../../../issue';
import type { TypeScriptConfigOverwrite } from '../../type-script-config-overwrite';
export declare function parseConfig(configFileName: string, configFileContext: string, configOverwriteJSON?: TypeScriptConfigOverwrite): ts.ParsedCommandLine;
export declare function parseConfig(configFileName: string, configFileContext: string): ts.ParsedCommandLine;
export declare function getParseConfigIssues(): Issue[];

@@ -7,0 +6,0 @@ export declare function getParsedConfig(force?: boolean): ts.ParsedCommandLine;

@@ -41,8 +41,39 @@ "use strict";

}
function parseConfig(configFileName, configFileContext, configOverwriteJSON = {}) {
function getUserProvidedConfigOverwrite() {
return worker_config_1.config.configOverwrite || {};
}
function getImplicitConfigOverwrite() {
const baseCompilerOptionsOverwrite = {
skipLibCheck: true,
sourceMap: false,
inlineSourceMap: false,
};
switch (worker_config_1.config.mode) {
case 'write-dts':
return {
compilerOptions: Object.assign(Object.assign({}, baseCompilerOptionsOverwrite), { declaration: true, emitDeclarationOnly: true, noEmit: false }),
};
case 'write-tsbuildinfo':
case 'write-references':
return {
compilerOptions: Object.assign(Object.assign({}, baseCompilerOptionsOverwrite), { declaration: true, emitDeclarationOnly: false, noEmit: false }),
};
}
return {
compilerOptions: baseCompilerOptionsOverwrite,
};
}
function applyConfigOverwrite(baseConfig, ...overwriteConfigs) {
let config = baseConfig;
for (const overwriteConfig of overwriteConfigs) {
config = Object.assign(Object.assign(Object.assign({}, (config || {})), (overwriteConfig || {})), { compilerOptions: Object.assign(Object.assign({}, ((config === null || config === void 0 ? void 0 : config.compilerOptions) || {})), ((overwriteConfig === null || overwriteConfig === void 0 ? void 0 : overwriteConfig.compilerOptions) || {})) });
}
return config;
}
function parseConfig(configFileName, configFileContext) {
const configFilePath = (0, forward_slash_1.forwardSlash)(configFileName);
const parsedConfigFileJSON = typescript_1.typescript.readConfigFile(configFilePath, parseConfigFileHost.readFile);
const overwrittenConfigFileJSON = Object.assign(Object.assign(Object.assign({}, (parsedConfigFileJSON.config || {})), configOverwriteJSON), { compilerOptions: Object.assign(Object.assign({}, ((parsedConfigFileJSON.config || {}).compilerOptions || {})), (configOverwriteJSON.compilerOptions || {})) });
const parsedConfigFile = typescript_1.typescript.parseJsonConfigFileContent(overwrittenConfigFileJSON, parseConfigFileHost, configFileContext);
return Object.assign(Object.assign({}, parsedConfigFile), { options: Object.assign(Object.assign({}, parsedConfigFile.options), { configFilePath: configFilePath }), errors: parsedConfigFileJSON.error ? [parsedConfigFileJSON.error] : parsedConfigFile.errors });
const { config: baseConfig, error: readConfigError } = typescript_1.typescript.readConfigFile(configFilePath, parseConfigFileHost.readFile);
const overwrittenConfig = applyConfigOverwrite(baseConfig || {}, getImplicitConfigOverwrite(), getUserProvidedConfigOverwrite());
const parsedConfigFile = typescript_1.typescript.parseJsonConfigFileContent(overwrittenConfig, parseConfigFileHost, configFileContext);
return Object.assign(Object.assign({}, parsedConfigFile), { options: Object.assign(Object.assign({}, parsedConfigFile.options), { configFilePath: configFilePath }), errors: readConfigError ? [readConfigError] : parsedConfigFile.errors });
}

@@ -62,15 +93,4 @@ exports.parseConfig = parseConfig;

if (!parsedConfig || force) {
parseConfigDiagnostics = [];
parsedConfig = parseConfig(worker_config_1.config.configFile, worker_config_1.config.context, worker_config_1.config.configOverwrite);
const configFilePath = (0, forward_slash_1.forwardSlash)(worker_config_1.config.configFile);
const parsedConfigFileJSON = typescript_1.typescript.readConfigFile(configFilePath, parseConfigFileHost.readFile);
const overwrittenConfigFileJSON = Object.assign(Object.assign(Object.assign({}, (parsedConfigFileJSON.config || {})), worker_config_1.config.configOverwrite), { compilerOptions: Object.assign(Object.assign({}, ((parsedConfigFileJSON.config || {}).compilerOptions || {})), (worker_config_1.config.configOverwrite.compilerOptions || {})) });
parsedConfig = typescript_1.typescript.parseJsonConfigFileContent(overwrittenConfigFileJSON, parseConfigFileHost, worker_config_1.config.context);
parsedConfig.options.configFilePath = configFilePath;
parsedConfig.errors = parsedConfigFileJSON.error
? [parsedConfigFileJSON.error]
: parsedConfig.errors;
if (parsedConfig.errors) {
parseConfigDiagnostics.push(...parsedConfig.errors);
}
parsedConfig = parseConfig(worker_config_1.config.configFile, worker_config_1.config.context);
parseConfigDiagnostics = parsedConfig.errors || [];
}

@@ -77,0 +97,0 @@ return parsedConfig;

@@ -6,2 +6,3 @@ "use strict";

const diagnostics_1 = require("../diagnostics");
const emit_1 = require("../emit");
const compiler_host_1 = require("../host/compiler-host");

@@ -25,2 +26,3 @@ const typescript_1 = require("../typescript");

(0, diagnostics_1.updateDiagnostics)((0, config_1.getConfigFilePathFromProgram)(program), (0, diagnostics_1.getDiagnosticsOfProgram)(program));
(0, emit_1.emitDtsIfNeeded)(program);
}

@@ -27,0 +29,0 @@ exports.useProgram = useProgram;

@@ -7,2 +7,3 @@ "use strict";

const diagnostics_1 = require("../diagnostics");
const emit_1 = require("../emit");
const watch_compiler_host_1 = require("../host/watch-compiler-host");

@@ -25,2 +26,3 @@ const tracing_1 = require("../tracing");

(0, diagnostics_1.updateDiagnostics)((0, config_1.getConfigFilePathFromBuilderProgram)(builderProgram), (0, diagnostics_1.getDiagnosticsOfProgram)(builderProgram));
(0, emit_1.emitDtsIfNeeded)(builderProgram);
(0, tsbuildinfo_1.emitTsBuildInfoIfNeeded)(builderProgram);

@@ -27,0 +29,0 @@ (0, tracing_1.stopTracingIfNeeded)(builderProgram);

{
"name": "fork-ts-checker-webpack-plugin",
"version": "7.0.0",
"version": "7.1.0",
"description": "Runs typescript type checker and linter on separate process.",

@@ -110,3 +110,3 @@ "keywords": [

"jest-environment-node": "^27.4.6",
"json-schema": "^0.3.0",
"json-schema": "^0.4.0",
"karton": "^0.4.1",

@@ -113,0 +113,0 @@ "lint-staged": "^11.1.2",

@@ -89,10 +89,10 @@ <div align="center">

| Name | Type | Default value | Description |
| ----------------- | ------------------------------------ | ----------------------------------------- | ----------- |
| `async` | `boolean` | `compiler.options.mode === 'development'` | If `true`, reports issues **after** webpack's compilation is done. Thanks to that it doesn't block the compilation. Used only in the `watch` mode. |
| `typescript` | `object` | `{}` | See [TypeScript options](#typescript-options). |
| `issue` | `object` | `{}` | See [Issues options](#issues-options). |
| `formatter` | `string` or `object` or `function` | `codeframe` | Available formatters are `basic`, `codeframe` and a custom `function`. To [configure](https://babeljs.io/docs/en/babel-code-frame#options) `codeframe` formatter, pass object: `{ type: 'codeframe', options: { <coderame options> } }`. |
| `logger` | `{ log: function, error: function }` | `console` | Console-like object to print issues in `async` mode. |
| `devServer` | `boolean` | `true` | If set to `false`, errors will not be reported to Webpack Dev Server. |
| Name | Type | Default value | Description |
|--------------|--------------------------------------|-------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `async` | `boolean` | `compiler.options.mode === 'development'` | If `true`, reports issues **after** webpack's compilation is done. Thanks to that it doesn't block the compilation. Used only in the `watch` mode. |
| `typescript` | `object` | `{}` | See [TypeScript options](#typescript-options). |
| `issue` | `object` | `{}` | See [Issues options](#issues-options). |
| `formatter` | `string` or `object` or `function` | `codeframe` | Available formatters are `basic`, `codeframe` and a custom `function`. To [configure](https://babeljs.io/docs/en/babel-code-frame#options) `codeframe` formatter, pass object: `{ type: 'codeframe', options: { <coderame options> } }`. |
| `logger` | `{ log: function, error: function }` | `console` | Console-like object to print issues in `async` mode. |
| `devServer` | `boolean` | `true` | If set to `false`, errors will not be reported to Webpack Dev Server. |

@@ -103,14 +103,14 @@ ### TypeScript options

| Name | Type | Default value | Description |
| -------------------- | --------- | -------------------------------------------------------------------------------------------------------------- | ----------- |
| `memoryLimit` | `number` | `2048` | Memory limit for the checker process in MB. If the process exits with the allocation failed error, try to increase this number. |
| `configFile` | `string` | `'tsconfig.json'` | Path to the `tsconfig.json` file (path relative to the `compiler.options.context` or absolute path) |
| `configOverwrite` | `object` | `{ compilerOptions: { skipLibCheck: true, sourceMap: false, inlineSourceMap: false, declarationMap: false } }` | This configuration will overwrite configuration from the `tsconfig.json` file. Supported fields are: `extends`, `compilerOptions`, `include`, `exclude`, `files`, and `references`. |
| `context` | `string` | `dirname(configuration.configFile)` | The base path for finding files specified in the `tsconfig.json`. Same as the `context` option from the [ts-loader](https://github.com/TypeStrong/ts-loader#context). Useful if you want to keep your `tsconfig.json` in an external package. Keep in mind that **not** having a `tsconfig.json` in your project root can cause different behaviour between `fork-ts-checker-webpack-plugin` and `tsc`. When using editors like `VS Code` it is advised to add a `tsconfig.json` file to the root of the project and extend the config file referenced in option `configFile`. |
| `build` | `boolean` | `false` | The equivalent of the `--build` flag for the `tsc` command. |
| `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. |
| `extensions` | `object` | `{}` | See [TypeScript extensions options](#typescript-extensions-options). |
| `profile` | `boolean` | `false` | Measures and prints timings related to the TypeScript performance. |
| `typescriptPath` | `string` | `require.resolve('typescript')` | If supplied this is a custom path where TypeScript can be found. |
| Name | Type | Default value | Description |
|---------------------|--------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `memoryLimit` | `number` | `2048` | Memory limit for the checker process in MB. If the process exits with the allocation failed error, try to increase this number. |
| `configFile` | `string` | `'tsconfig.json'` | Path to the `tsconfig.json` file (path relative to the `compiler.options.context` or absolute path) |
| `configOverwrite` | `object` | `{ compilerOptions: { skipLibCheck: true, sourceMap: false, inlineSourceMap: false, declarationMap: false } }` | This configuration will overwrite configuration from the `tsconfig.json` file. Supported fields are: `extends`, `compilerOptions`, `include`, `exclude`, `files`, and `references`. |
| `context` | `string` | `dirname(configuration.configFile)` | The base path for finding files specified in the `tsconfig.json`. Same as the `context` option from the [ts-loader](https://github.com/TypeStrong/ts-loader#context). Useful if you want to keep your `tsconfig.json` in an external package. Keep in mind that **not** having a `tsconfig.json` in your project root can cause different behaviour between `fork-ts-checker-webpack-plugin` and `tsc`. When using editors like `VS Code` it is advised to add a `tsconfig.json` file to the root of the project and extend the config file referenced in option `configFile`. |
| `build` | `boolean` | `false` | The equivalent of the `--build` flag for the `tsc` command. |
| `mode` | `'readonly'` or `'write-dts'` or `'write-tsbuildinfo'` or `'write-references'` | `build === true ? 'write-tsbuildinfo' ? 'readonly'` | Use `readonly` if you don't want to write anything on the disk, `write-dts` to write only `.d.ts` files, `write-tsbuildinfo` to write only `.tsbuildinfo` files, `write-references` to write both `.js` and `.d.ts` files of project references (last 2 modes requires `build: true`). |
| `diagnosticOptions` | `object` | `{ syntactic: false, semantic: true, declaration: false, global: false }` | Settings to select which diagnostics do we want to perform. |
| `extensions` | `object` | `{}` | See [TypeScript extensions options](#typescript-extensions-options). |
| `profile` | `boolean` | `false` | Measures and prints timings related to the TypeScript performance. |
| `typescriptPath` | `string` | `require.resolve('typescript')` | If supplied this is a custom path where TypeScript can be found. |

@@ -121,7 +121,7 @@ #### TypeScript extensions options

| Name | Type | Default value | Description |
| -------------------- | --------------------- | ------------------------- | ----------- |
| `vue` | `object` or `boolean` | `false` | If `true`, it enables Vue [Single File Component](https://vuejs.org/v2/guide/single-file-components.html) support. |
| `vue.enabled` | `boolean` | `false` | Same as the `vue` option |
| `vue.compiler` | `string` | `'vue-template-compiler'` | The package name of the compiler that will be used to parse `.vue` files. You can use `'nativescript-vue-template-compiler'` if you use [nativescript-vue](https://github.com/nativescript-vue/nativescript-vue) |
| Name | Type | Default value | Description |
|----------------|-----------------------|---------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `vue` | `object` or `boolean` | `false` | If `true`, it enables Vue [Single File Component](https://vuejs.org/v2/guide/single-file-components.html) support. |
| `vue.enabled` | `boolean` | `false` | Same as the `vue` option |
| `vue.compiler` | `string` | `'vue-template-compiler'` | The package name of the compiler that will be used to parse `.vue` files. You can use `'nativescript-vue-template-compiler'` if you use [nativescript-vue](https://github.com/nativescript-vue/nativescript-vue) |

@@ -145,6 +145,6 @@ ### Issues options

| Name | Type | Default value | Description |
| --------- | ------------- | ------------- | ----------- |
| Name | Type | Default value | Description |
|-----------|---------------|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `include` | `IssueFilter` | `undefined` | If `object`, defines issue properties that should be [matched](src/issue/issue-match.ts). If `function`, acts as a predicate where `issue` is an argument. |
| `exclude` | `IssueFilter` | `undefined` | Same as `include` but issues that match this predicate will be excluded. |
| `exclude` | `IssueFilter` | `undefined` | Same as `include` but issues that match this predicate will be excluded. |

@@ -293,9 +293,9 @@ <details>

| Hook key | Type | Params | Description |
| ---------- | -------------------------- | --------------------- | ----------- |
| Hook key | Type | Params | Description |
|------------|----------------------------|-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `start` | `AsyncSeriesWaterfallHook` | `change, compilation` | Starts issues checking for a compilation. It's an async waterfall hook, so you can modify the list of changed and removed files or delay the start of the service. |
| `waiting` | `SyncHook` | `compilation` | Waiting for the issues checking. |
| `canceled` | `SyncHook` | `compilation` | Issues checking for the compilation has been canceled. |
| `error` | `SyncHook` | `compilation` | An error occurred during issues checking. |
| `issues` | `SyncWaterfallHook` | `issues, compilation` | Issues have been received and will be reported. It's a waterfall hook, so you can modify the list of received issues. |
| `waiting` | `SyncHook` | `compilation` | Waiting for the issues checking. |
| `canceled` | `SyncHook` | `compilation` | Issues checking for the compilation has been canceled. |
| `error` | `SyncHook` | `compilation` | An error occurred during issues checking. |
| `issues` | `SyncWaterfallHook` | `issues, compilation` | Issues have been received and will be reported. It's a waterfall hook, so you can modify the list of received issues. |

@@ -381,1 +381,2 @@ To access plugin hooks and tap into the event, we need to use the `getCompilerHooks` static method.

MIT License
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc