Socket
Socket
Sign inDemoInstall

fork-ts-checker-webpack-plugin

Package Overview
Dependencies
Maintainers
4
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 1.0.0-alpha.5 to 1.0.0-alpha.6

lib/NormalizedMessageFactories.d.ts

4

CHANGELOG.md

@@ -0,1 +1,5 @@

## v1.0.0-alpha.6
* [don't directly depend upon typescript](https://github.com/Realytics/fork-ts-checker-webpack-plugin/pull/208)
## v1.0.0-alpha.5

@@ -2,0 +6,0 @@

5

lib/ApiIncrementalChecker.d.ts
import * as ts from 'typescript';
import { RuleFailure } from 'tslint';
import { IncrementalCheckerInterface } from './IncrementalCheckerInterface';

@@ -6,2 +7,4 @@ import { CancellationToken } from './CancellationToken';

export declare class ApiIncrementalChecker implements IncrementalCheckerInterface {
private createNormalizedMessageFromDiagnostic;
private createNormalizedMessageFromRuleFailure;
private linterConfigFile;

@@ -15,3 +18,3 @@ private linterAutoFix;

private lastRemovedFiles;
constructor(typescript: typeof ts, programConfigFile: string, compilerOptions: ts.CompilerOptions, linterConfigFile: string | false, linterAutoFix: boolean, checkSyntacticErrors: boolean);
constructor(typescript: typeof ts, createNormalizedMessageFromDiagnostic: (diagnostic: ts.Diagnostic) => NormalizedMessage, createNormalizedMessageFromRuleFailure: (ruleFailure: RuleFailure) => NormalizedMessage, programConfigFile: string, compilerOptions: ts.CompilerOptions, linterConfigFile: string | false, linterAutoFix: boolean, checkSyntacticErrors: boolean);
private initLinterConfig;

@@ -18,0 +21,0 @@ private static loadLinterConfig;

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

class ApiIncrementalChecker {
constructor(typescript, programConfigFile, compilerOptions, linterConfigFile, linterAutoFix, checkSyntacticErrors) {
constructor(typescript, createNormalizedMessageFromDiagnostic, createNormalizedMessageFromRuleFailure, programConfigFile, compilerOptions, linterConfigFile, linterAutoFix, checkSyntacticErrors) {
this.createNormalizedMessageFromDiagnostic = createNormalizedMessageFromDiagnostic;
this.createNormalizedMessageFromRuleFailure = createNormalizedMessageFromRuleFailure;
this.linterConfigFile = linterConfigFile;

@@ -65,3 +67,3 @@ this.linterAutoFix = linterAutoFix;

this.lastRemovedFiles = diagnostics.removedFiles;
return NormalizedMessage_1.NormalizedMessage.deduplicate(diagnostics.results.map(NormalizedMessage_1.NormalizedMessage.createFromDiagnostic));
return NormalizedMessage_1.NormalizedMessage.deduplicate(diagnostics.results.map(this.createNormalizedMessageFromDiagnostic));
});

@@ -102,3 +104,3 @@ }

}
return NormalizedMessage_1.NormalizedMessage.deduplicate(allLints.map(NormalizedMessage_1.NormalizedMessage.createFromLint));
return NormalizedMessage_1.NormalizedMessage.deduplicate(allLints.map(this.createNormalizedMessageFromRuleFailure));
}

@@ -105,0 +107,0 @@ }

@@ -11,4 +11,2 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
// tslint:disable-next-line:no-implicit-dependencies
const ts = require("typescript"); // Imported for types alone
const LinkedList_1 = require("./LinkedList");

@@ -60,3 +58,3 @@ const VueProgram_1 = require("./VueProgram");

this.lastProcessing = initialCompile;
this.program = ts.createWatchProgram(this);
this.program = this.typescript.createWatchProgram(this);
const errors = yield initialCompile;

@@ -169,6 +167,6 @@ return {

this.tsHost.watchFile(path, (fileName, eventKind) => {
if (eventKind === ts.FileWatcherEventKind.Created) {
if (eventKind === this.typescript.FileWatcherEventKind.Created) {
this.knownFiles.add(fileName);
}
else if (eventKind === ts.FileWatcherEventKind.Deleted) {
else if (eventKind === this.typescript.FileWatcherEventKind.Deleted) {
this.knownFiles.delete(fileName);

@@ -175,0 +173,0 @@ }

import * as ts from 'typescript';
import { RuleFailure } from 'tslint';
import { NormalizedMessage } from './NormalizedMessage';

@@ -8,2 +9,4 @@ import { CancellationToken } from './CancellationToken';

private typescript;
private createNormalizedMessageFromDiagnostic;
private createNormalizedMessageFromRuleFailure;
private programConfigFile;

@@ -25,3 +28,3 @@ private compilerOptions;

private watcher?;
constructor(typescript: typeof ts, programConfigFile: string, compilerOptions: object, linterConfigFile: string | false, linterAutoFix: boolean, watchPaths: string[], workNumber?: number, workDivision?: number, checkSyntacticErrors?: boolean, vue?: boolean);
constructor(typescript: typeof ts, createNormalizedMessageFromDiagnostic: (diagnostic: ts.Diagnostic) => NormalizedMessage, createNormalizedMessageFromRuleFailure: (ruleFailure: RuleFailure) => NormalizedMessage, programConfigFile: string, compilerOptions: object, linterConfigFile: string | false, linterAutoFix: boolean, watchPaths: string[], workNumber?: number, workDivision?: number, checkSyntacticErrors?: boolean, vue?: boolean);
static loadProgramConfig(typescript: typeof ts, configFile: string, compilerOptions: object): ts.ParsedCommandLine;

@@ -28,0 +31,0 @@ private static loadLinterConfig;

@@ -13,4 +13,6 @@ "use strict";

class IncrementalChecker {
constructor(typescript, programConfigFile, compilerOptions, linterConfigFile, linterAutoFix, watchPaths, workNumber = 0, workDivision = 1, checkSyntacticErrors = false, vue = false) {
constructor(typescript, createNormalizedMessageFromDiagnostic, createNormalizedMessageFromRuleFailure, programConfigFile, compilerOptions, linterConfigFile, linterAutoFix, watchPaths, workNumber = 0, workDivision = 1, checkSyntacticErrors = false, vue = false) {
this.typescript = typescript;
this.createNormalizedMessageFromDiagnostic = createNormalizedMessageFromDiagnostic;
this.createNormalizedMessageFromRuleFailure = createNormalizedMessageFromRuleFailure;
this.programConfigFile = programConfigFile;

@@ -152,3 +154,3 @@ this.compilerOptions = compilerOptions;

// normalize and deduplicate diagnostics
return Promise.resolve(NormalizedMessage_1.NormalizedMessage.deduplicate(diagnostics.map(NormalizedMessage_1.NormalizedMessage.createFromDiagnostic)));
return Promise.resolve(NormalizedMessage_1.NormalizedMessage.deduplicate(diagnostics.map(this.createNormalizedMessageFromDiagnostic)));
}

@@ -204,3 +206,3 @@ getLints(cancellationToken) {

// normalize and deduplicate lints
return NormalizedMessage_1.NormalizedMessage.deduplicate(lints.map(NormalizedMessage_1.NormalizedMessage.createFromLint));
return NormalizedMessage_1.NormalizedMessage.deduplicate(lints.map(this.createNormalizedMessageFromRuleFailure));
}

@@ -207,0 +209,0 @@ }

@@ -1,5 +0,3 @@

import { Diagnostic } from 'typescript';
import { RuleFailure } from 'tslint';
declare type ErrorType = 'diagnostic' | 'lint';
declare type Severity = 'error' | 'warning';
export declare type ErrorType = 'diagnostic' | 'lint';
export declare type Severity = 'error' | 'warning';
interface NormalizedMessageJson {

@@ -27,4 +25,2 @@ type: ErrorType;

constructor(data: NormalizedMessageJson);
static createFromDiagnostic(diagnostic: Diagnostic): NormalizedMessage;
static createFromLint(lint: RuleFailure): NormalizedMessage;
static createFromJSON(json: NormalizedMessageJson): NormalizedMessage;

@@ -31,0 +27,0 @@ static compare(messageA: NormalizedMessage, messageB: NormalizedMessage): number;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const typescript_1 = require("typescript");
class NormalizedMessage {

@@ -14,38 +13,2 @@ constructor(data) {

}
// message types
static createFromDiagnostic(diagnostic) {
let file;
let line;
let character;
if (diagnostic.file) {
file = diagnostic.file.fileName;
if (diagnostic.start === undefined) {
throw new Error('Expected diagnostics to have start');
}
const position = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
line = position.line + 1;
character = position.character + 1;
}
return new NormalizedMessage({
type: NormalizedMessage.TYPE_DIAGNOSTIC,
code: diagnostic.code,
severity: typescript_1.DiagnosticCategory[diagnostic.category].toLowerCase(),
content: typescript_1.flattenDiagnosticMessageText(diagnostic.messageText, '\n'),
file,
line,
character
});
}
static createFromLint(lint) {
const position = lint.getStartPosition().getLineAndCharacter();
return new NormalizedMessage({
type: NormalizedMessage.TYPE_LINT,
code: lint.getRuleName(),
severity: lint.getRuleSeverity(),
content: lint.getFailure(),
file: lint.getFileName(),
line: position.line + 1,
character: position.character + 1
});
}
static createFromJSON(json) {

@@ -52,0 +15,0 @@ return new NormalizedMessage(json);

@@ -1,1 +0,4 @@

export {};
import * as ts from 'typescript';
import { NormalizedMessage } from './NormalizedMessage';
export declare const createNormalizedMessageFromDiagnostic: (diagnostic: ts.Diagnostic) => NormalizedMessage;
export declare const createNormalizedMessageFromRuleFailure: (lint: import("tslint").RuleFailure) => NormalizedMessage;

@@ -15,6 +15,10 @@ "use strict";

const ApiIncrementalChecker_1 = require("./ApiIncrementalChecker");
const NormalizedMessageFactories_1 = require("./NormalizedMessageFactories");
const typescript = require(process.env.TYPESCRIPT_PATH);
// message factories
exports.createNormalizedMessageFromDiagnostic = NormalizedMessageFactories_1.makeCreateNormalizedMessageFromDiagnostic(typescript);
exports.createNormalizedMessageFromRuleFailure = NormalizedMessageFactories_1.makeCreateNormalizedMessageFromRuleFailure();
const checker = process.env.USE_INCREMENTAL_API === 'true'
? new ApiIncrementalChecker_1.ApiIncrementalChecker(typescript, process.env.TSCONFIG, JSON.parse(process.env.COMPILER_OPTIONS), process.env.TSLINT === '' ? false : process.env.TSLINT, process.env.TSLINTAUTOFIX === 'true', process.env.CHECK_SYNTACTIC_ERRORS === 'true')
: new IncrementalChecker_1.IncrementalChecker(typescript, process.env.TSCONFIG, JSON.parse(process.env.COMPILER_OPTIONS), process.env.TSLINT === '' ? false : process.env.TSLINT, process.env.TSLINTAUTOFIX === 'true', process.env.WATCH === '' ? [] : process.env.WATCH.split('|'), parseInt(process.env.WORK_NUMBER, 10) || 0, parseInt(process.env.WORK_DIVISION, 10) || 1, process.env.CHECK_SYNTACTIC_ERRORS === 'true', process.env.VUE === 'true');
? new ApiIncrementalChecker_1.ApiIncrementalChecker(typescript, exports.createNormalizedMessageFromDiagnostic, exports.createNormalizedMessageFromRuleFailure, process.env.TSCONFIG, JSON.parse(process.env.COMPILER_OPTIONS), process.env.TSLINT === '' ? false : process.env.TSLINT, process.env.TSLINTAUTOFIX === 'true', process.env.CHECK_SYNTACTIC_ERRORS === 'true')
: new IncrementalChecker_1.IncrementalChecker(typescript, exports.createNormalizedMessageFromDiagnostic, exports.createNormalizedMessageFromRuleFailure, process.env.TSCONFIG, JSON.parse(process.env.COMPILER_OPTIONS), process.env.TSLINT === '' ? false : process.env.TSLINT, process.env.TSLINTAUTOFIX === 'true', process.env.WATCH === '' ? [] : process.env.WATCH.split('|'), parseInt(process.env.WORK_NUMBER, 10) || 0, parseInt(process.env.WORK_DIVISION, 10) || 1, process.env.CHECK_SYNTACTIC_ERRORS === 'true', process.env.VUE === 'true');
function run(cancellationToken) {

@@ -21,0 +25,0 @@ return __awaiter(this, void 0, void 0, function* () {

{
"name": "fork-ts-checker-webpack-plugin",
"version": "1.0.0-alpha.5",
"version": "1.0.0-alpha.6",
"description": "Runs typescript type checker and linter on separate process.",

@@ -76,2 +76,3 @@ "main": "lib/index.js",

"typescript": "^3.0.1",
"unixify": "^1.0.0",
"vue": "^2.5.16",

@@ -78,0 +79,0 @@ "vue-class-component": "^6.1.1",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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