From addf644fffafb14d499a33984d261d4bfef1554d Mon Sep 17 00:00:00 2001 From: Vegar Ringdal Date: Sun, 1 Apr 2018 23:47:38 +0200 Subject: [PATCH] chore(all) new build 2.8.0 --- dist/commonjs/checker.js | 7 ++++--- dist/commonjs/checker.js.map | 2 +- dist/commonjs/index.js.map | 2 +- dist/commonjs/interfaces.js.map | 2 +- dist/commonjs/test.js.map | 2 +- dist/commonjs/worker.d.ts | 1 + dist/commonjs/worker.js.map | 2 +- 7 files changed, 10 insertions(+), 8 deletions(-) diff --git a/dist/commonjs/checker.js b/dist/commonjs/checker.js index 496e067..39e98cd 100644 --- a/dist/commonjs/checker.js +++ b/dist/commonjs/checker.js @@ -58,16 +58,17 @@ var Checker = (function () { this.lintFileResult = []; if (options.tsLint) { if (!tslint) { - this.writeText(chalk_1.default.red("\nMake sure to have " + chalk_1.default.bgRed("tslint") + " installed if you use the \"tsLint\" option:\n") + + this.writeText(chalk_1.default.red("\nMake sure to have " + chalk_1.default.bgWhiteBright('tslint') + " installed if you use the \"tsLint\" option:\n") + chalk_1.default.redBright('npm install --save-dev tslint\n\n')); - throw new Error("tslint not installed"); + throw new Error('tslint not installed'); } var fullPath = path.resolve(this.options.basePath, options.tsLint); var files = tslint.Linter.getFileNames(this.program); var tsLintConfiguration_1 = tslint.Configuration.findConfiguration(fullPath, this.options.basePath).results; this.lintFileResult = files.map(function (file) { - var fileContents = _this.program.getSourceFile(file).getFullText(); + var fileContents = _this.program.getSourceFile(file); + fileContents = fileContents ? fileContents.getFullText() : ''; var linter = new tslint.Linter(options.lintoptions, _this.program); linter.lint(file, fileContents, tsLintConfiguration_1); return linter.getResult(); diff --git a/dist/commonjs/checker.js.map b/dist/commonjs/checker.js.map index 961a881..86297df 100644 --- a/dist/commonjs/checker.js.map +++ b/dist/commonjs/checker.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/checker.ts"],"names":[],"mappings":";;AAAA,+BAAiC;AACjC,+BAA0B;AAC1B,2BAA6B;AAC7B,uB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tB,CAAC;YACK,IAAA,wDAGyC,EAFrD,cAAI,EACM,wBAAS,CACmC;YAChD,MAAM,CAAC;gBACH,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ;gBAC5B,IAAI,EAAE,IAAI,GAAG,CAAC;gBACd,OAAO,EAAE,EAAE,CAAC,4BAA4B,CAAC,IAAI,CAAC,WAAW,EAAE,qBAAQ,CAAC;gBACpE,IAAI,EAAE,SAAS,GAAG,CAAC;gBACnB,KAAK,EAAE,KAAK;gBACZ,QAAQ,EAAK,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAG;gBACpD,IAAI,EAAE,OAAK,IAAI,CAAC,IAAM;aACzB,CAAC;QACN,CAAC,CAAC,CAAC;IACX,CAAC;IACL,cAAC;AAAD,CAvdA,AAudC,IAAA;AAvdY,0BAAO","file":"checker.js","sourcesContent":["import * as ts from 'typescript';\nimport chalk from 'chalk';\nimport * as path from 'path';\nimport * as fs from 'fs';\n\nimport { IInternalTypeCheckerOptions, END_LINE, ITSLintError, ITSError } from './interfaces';\n\nimport * as TSLintTypes from 'tslint'; // Just use types\nlet tslint: typeof TSLintTypes | null;\ntry {\n tslint = require('tslint');\n} catch {\n tslint = null;\n // Do nothing\n}\n\nconst entries: any = require('object.entries');\n\nif (!Object.entries) {\n entries.shim();\n}\n\n\ntype TypeCheckError = ITSLintError | ITSError;\nfunction isTSError(error: TypeCheckError) {\n return (error).code !== undefined;\n}\n\nexport class Checker {\n\n // options that will be used when checking and printing results\n private options: IInternalTypeCheckerOptions;\n\n // typescript program\n private program: ts.Program;\n\n // time used to do typecheck/linting\n private elapsedInspectionTime: number;\n\n // type diagonstic returned by typescript\n private tsDiagnostics: ts.Diagnostic[];\n\n // lint result returned by tsLint\n private lintFileResult: TSLintTypes.LintResult[];\n\n\n constructor() {\n // nothing atm\n }\n\n\n public inspectCode(options: IInternalTypeCheckerOptions) {\n this.options = options;\n\n\n // parse it right away, no need to wait...\n const parseConfigHost: any = {\n fileExists: ts.sys.fileExists,\n readDirectory: ts.sys.readDirectory,\n readFile: ts.sys.readFile,\n useCaseSensitiveFileNames: true\n };\n\n // take the time\n let inspectionTimeStart = new Date().getTime();\n\n // get program and get diagnostics and store them diagnostics\n const parsed = ts.parseJsonConfigFileContent(this.options.tsConfigJsonContent, parseConfigHost, options.basePath || '.', undefined);\n this.program = ts.createProgram(parsed.fileNames, parsed.options, undefined, this.program);\n\n\n // get errors and tag them;\n this.tsDiagnostics = [];\n let optionsErrors = this.program.getOptionsDiagnostics().map((obj) => {\n // tag em so we know for later\n (obj)._type = 'options';\n return obj;\n });\n this.tsDiagnostics = this.tsDiagnostics.concat(optionsErrors);\n\n\n\n let globalErrors = this.program.getGlobalDiagnostics().map((obj) => {\n (obj)._type = 'global';\n return obj;\n });\n this.tsDiagnostics = this.tsDiagnostics.concat(globalErrors);\n\n\n\n let syntacticErrors = this.program.getSyntacticDiagnostics().map((obj) => {\n (obj)._type = 'syntactic';\n return obj;\n });\n this.tsDiagnostics = this.tsDiagnostics.concat(syntacticErrors);\n\n\n\n let semanticErrors = this.program.getSemanticDiagnostics().map((obj) => {\n (obj)._type = 'semantic';\n return obj;\n });\n this.tsDiagnostics = this.tsDiagnostics.concat(semanticErrors);\n\n\n // get tslint if json file is supplied\n this.lintFileResult = [];\n if (options.tsLint) {\n\n if (!tslint) {\n this.writeText(\n chalk.red(`\\nMake sure to have ${chalk.bgRed(\"tslint\")} installed if you use the \"tsLint\" option:\\n`) +\n chalk.redBright('npm install --save-dev tslint\\n\\n')\n );\n throw new Error(\"tslint not installed\");\n }\n\n // get full path\n let fullPath = path.resolve(this.options.basePath, options.tsLint);\n\n // gets the files, lint every file and store errors in lintResults\n let files = tslint.Linter.getFileNames(this.program);\n\n // get tslint configuration\n const tsLintConfiguration = tslint.Configuration.findConfiguration(fullPath, this.options.basePath).results;\n\n // lint the files\n this.lintFileResult =\n files.map(file => {\n // get content of file\n const fileContents = this.program.getSourceFile(file).getFullText();\n\n // create new linter using lint options and tsprogram\n const linter = new tslint!.Linter((options.lintoptions), this.program);\n\n // lint file using filename, filecontent, and tslint configuration\n linter.lint(file, fileContents, tsLintConfiguration);\n\n // return result\n return linter.getResult();\n }).filter((result) => {\n // only return the one with erros\n return result.errorCount ? true : false;\n });\n }\n\n // save elapsed check time\n this.elapsedInspectionTime = new Date().getTime() - inspectionTimeStart;\n }\n\n\n\n /**\n * print result\n *\n */\n public printResult(isWorker?: boolean) {\n\n // consts\n const print = this.writeText;\n const program = this.program;\n const options = this.options;\n\n // print header\n print(\n chalk.bgWhite(\n chalk.black(`${END_LINE}Typechecker plugin(${options.type}) ${options.name}`)\n ) +\n chalk.white(`.${END_LINE}`)\n );\n\n // print time\n print(\n chalk.grey(`Time:${new Date().toString()} ${END_LINE}`)\n );\n\n // get the lint errors messages\n let lintErrorMessages: TypeCheckError[] = this.processLintFiles();\n\n // loop diagnostics and get the errors messages\n let tsErrorMessages: TypeCheckError[] = this.processTsDiagnostics();\n\n // combine errors and print if any\n let combinedErrors: TypeCheckError[] = tsErrorMessages.concat(lintErrorMessages);\n\n // group by filename\n let groupedErrors: { [k: string]: TypeCheckError[] } = {};\n combinedErrors.forEach((error: TypeCheckError) => {\n if (!groupedErrors[error.fileName]) {\n groupedErrors[error.fileName] = [] as TypeCheckError[];\n }\n\n groupedErrors[error.fileName].push(error);\n });\n\n let allErrors = Object.entries(groupedErrors)\n .map(([fileName, errors]) => {\n const short = this.options.shortenFilenames;\n const fullFileName = path.resolve(fileName);\n const shortFileName = fullFileName.split(options.basePath).join('.');\n return chalk.white(`└── ${shortFileName}`) + END_LINE + errors.map((err: TypeCheckError) => {\n let text = chalk.red(' |');\n if (isTSError(err)) {\n text += chalk[err.color](` ${short ? shortFileName : fullFileName} (${err.line},${err.char}) `);\n text += chalk.white(`(${(err).category}`);\n text += chalk.white(`${(err).code})`);\n text += ' ' + (err).message;\n } else {\n text += chalk[err.color](` ${short ? shortFileName : fullFileName} (${err.line + 1},${err.char + 1}) `);\n text += chalk.white(`(${(err).ruleSeverity}:`);\n text += chalk.white(`${(err).ruleName})`);\n text += ' ' + (err).failure;\n }\n\n return text;\n }).join(END_LINE);\n });\n\n // print if any\n if (allErrors.length > 0) {\n // insert header\n allErrors.unshift(\n chalk.underline(`${END_LINE}File errors`) + chalk.white(':') // fix windows\n );\n print(allErrors.join(END_LINE));\n }\n\n // print option errors\n if (program.getOptionsDiagnostics().length) {\n print(chalk.underline(`${END_LINE}${END_LINE}Option errors`) + chalk.white(`:${END_LINE}`));\n let optionErrorsText = Object.entries(program.getOptionsDiagnostics())\n .map(([no, err]) => {\n let text = no + ':';\n let messageText = (err).messageText;\n if ((typeof messageText === 'object') && (messageText !== null)) {\n messageText = JSON.stringify(messageText);\n }\n text = chalk[options.yellowOnOptions ? 'yellow' : 'red']\n (`└── tsConfig: `);\n text += chalk.white(`(${(err).category}:`);\n text += chalk.white(`${(err).code})`);\n text += chalk.white(` ${messageText}`);\n return text;\n });\n print(optionErrorsText.join(END_LINE));\n }\n\n // print global errors\n // todo: this needs testing, how do I create a global error??\n /* try {\n if (program.getGlobalDiagnostics().length) {\n print(chalk.underline(`${END_LINE}${END_LINE}Global errors`) + chalk.white(`:${END_LINE}`));\n let optionErrorsText = Object.entries(program.getGlobalDiagnostics())\n .map(([no, err]) => {\n let text = no + ':';\n text = chalk[options.yellowOnGlobal ? 'yellow' : 'red']\n (`└── tsConfig: `);\n text += chalk.white(`(${(err).category}:`);\n text += chalk.white(`${(err).code})`);\n text += chalk.white(` ${(err).messageText}`);\n return text;\n });\n print(optionErrorsText.join(END_LINE));\n }\n } catch (err) {\n console.log(`Global error`);\n } */\n\n // time for summary >>>>>\n\n // get errors totals\n let optionsErrors = program.getOptionsDiagnostics().length;\n let globalErrors = program.getGlobalDiagnostics().length;\n let syntacticErrors = program.getSyntacticDiagnostics().length;\n let semanticErrors = program.getSemanticDiagnostics().length;\n let tsLintErrors = lintErrorMessages.length;\n let totalsErrors = optionsErrors + globalErrors + syntacticErrors + semanticErrors + tsLintErrors;\n\n\n\n // if errors, show user\n if (totalsErrors) {\n\n // write header\n print(\n chalk.underline(`${END_LINE}${END_LINE}Errors`) +\n chalk.white(`:${totalsErrors}${END_LINE}`)\n );\n\n print(\n chalk[optionsErrors ? options.yellowOnOptions ? 'yellow' : 'red' : 'white']\n (`└── Options: ${optionsErrors}${END_LINE}`)\n );\n\n print(\n chalk[globalErrors ? options.yellowOnGlobal ? 'yellow' : 'red' : 'white']\n (`└── Global: ${globalErrors}${END_LINE}`)\n );\n\n print(\n chalk[syntacticErrors ? options.yellowOnSyntactic ? 'yellow' : 'red' : 'white']\n (`└── Syntactic: ${syntacticErrors}${END_LINE}`)\n );\n\n print(\n chalk[semanticErrors ? options.yellowOnSemantic ? 'yellow' : 'red' : 'white']\n (`└── Semantic: ${semanticErrors}${END_LINE}`)\n );\n\n print(\n chalk[tsLintErrors ? options.yellowOnLint ? 'yellow' : 'red' : 'white']\n (`└── TsLint: ${tsLintErrors}${END_LINE}${END_LINE}`)\n );\n\n if (options.emit) {\n print(\n chalk.grey(`Skipping emit file${END_LINE}`)\n );\n }\n\n } else {\n // if there no errors, then also give some feedback about this, so they know its working\n print(\n chalk.grey(`All good, no errors :-)${END_LINE}`)\n );\n\n if (options.emit) {\n print(\n chalk.grey(`Getting ready to emit files${END_LINE}`)\n );\n try {\n if (options.clearOnEmit) {\n let outputFolder: any = program.getCompilerOptions().outDir;\n let deleteFolder = function (folder: string) {\n folder = path.join(folder);\n if (fs.existsSync(folder)) {\n fs.readdirSync(folder).forEach(function (file: string) {\n let curPath = folder + '/' + file;\n if (fs.lstatSync(curPath).isDirectory()) { // recurse\n deleteFolder(curPath);\n } else { // delete file\n fs.unlinkSync(curPath);\n }\n });\n fs.rmdirSync(folder);\n }\n };\n if (!outputFolder) {\n console.warn('output filder missing');\n } else {\n print(\n chalk.grey(`clearing output folder${END_LINE}`)\n );\n deleteFolder(outputFolder);\n print(\n chalk.grey(`Output folder cleared${END_LINE}`)\n );\n program.emit();\n print(\n chalk.grey(`Files emittet${END_LINE}`)\n );\n }\n } else {\n program.emit();\n print(\n chalk.grey(`Files emittet${END_LINE}`)\n );\n }\n } catch (error) {\n print(\n chalk.red(`emitting files failed${END_LINE}`)\n );\n }\n }\n }\n\n print(\n chalk.grey(`Typechecking time: ${this.elapsedInspectionTime}ms${END_LINE}`)\n );\n\n\n // final check how to end the checker, throw, exit or keep alive\n\n switch (true) {\n\n // if throwError is set then callback and quit\n case options.throwOnGlobal && globalErrors > 0:\n case options.throwOnOptions && optionsErrors > 0:\n case options.throwOnSemantic && semanticErrors > 0:\n case options.throwOnTsLint && tsLintErrors > 0:\n case options.throwOnSyntactic && syntacticErrors > 0:\n if (process.send) {\n process.send('error');\n } else {\n print(chalk.grey(`error typechecker${END_LINE}${END_LINE}`));\n }\n // exit with error\n process.exit(1);\n break;\n\n // if quit is set and its a worker, then post message and callback to main tread and tell its done\n case options.quit && isWorker:\n print(chalk.grey(`Quiting typechecker${END_LINE}${END_LINE}`));\n\n // since Im a worker I need to send back a message;\n (process).send('done');\n break;\n\n // if quit is set and not worker, then just post messeage\n case options.quit && !isWorker:\n print(chalk.grey(`Quiting typechecker${END_LINE}${END_LINE}`));\n break;\n\n // default action\n default:\n print(chalk.grey(`Keeping typechecker alive${END_LINE}${END_LINE}`));\n }\n\n return totalsErrors;\n\n }\n\n\n\n /**\n * write to screen helper\n *\n */\n private writeText(text: string) {\n ts.sys.write(text);\n }\n\n\n\n /**\n * loops lint failures and return pretty failure string ready to be printed\n *\n */\n private processLintFiles(): ITSLintError[] {\n const options = this.options;\n const erroredLintFiles = this.lintFileResult\n .filter((fileResult: TSLintTypes.LintResult) => fileResult.failures);\n const errors = erroredLintFiles\n .map(\n (fileResult: TSLintTypes.LintResult) =>\n fileResult.failures.map((failure: any) => ({\n fileName: failure.fileName,\n line: failure.startPosition.lineAndCharacter.line,\n char: failure.startPosition.lineAndCharacter.character,\n ruleSeverity: failure.ruleSeverity.charAt(0).toUpperCase() + failure.ruleSeverity.slice(1),\n ruleName: failure.ruleName,\n color: options.yellowOnLint ? 'yellow' : 'red',\n failure: failure.failure\n }))).reduce((acc, curr) => acc.concat(curr), []);\n return errors;\n }\n\n /**\n * loops ts failures and return pretty failure string ready to be printed\n *\n */\n private processTsDiagnostics(): ITSError[] {\n const options = this.options;\n return this.tsDiagnostics\n .filter((diag: any) => diag.file)\n .map((diag: any) => {\n // set color from options\n let color: string;\n switch (diag._type) {\n case 'options':\n color = options.yellowOnOptions ? 'yellow' : 'red';\n break;\n case 'global':\n color = options.yellowOnGlobal ? 'yellow' : 'red';\n break;\n case 'syntactic':\n color = options.yellowOnSyntactic ? 'yellow' : 'red';\n break;\n case 'semantic':\n color = options.yellowOnSemantic ? 'yellow' : 'red';\n break;\n default:\n color = 'red';\n }\n const {\n line,\n character\n } = diag.file.getLineAndCharacterOfPosition(diag.start);\n return {\n fileName: diag.file.fileName,\n line: line + 1, // `(${line + 1},${character + 1})`,\n message: ts.flattenDiagnosticMessageText(diag.messageText, END_LINE),\n char: character + 1,\n color: color,\n category: `${ts.DiagnosticCategory[diag.category]}:`,\n code: `TS${diag.code}`\n };\n });\n }\n}\n"],"sourceRoot":"src/"} \ No newline at end of file +{"version":3,"sources":["../src/checker.ts"],"names":[],"mappings":";;AAAA,+BAAiC;AACjC,+BAA0B;AAC1B,2BAA6B;AAC7B,uBAAyB;AAEzB,2CAA6F;AAG7F,IAAI,MAAiC,CAAC;AACtC,IAAI;IACA,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC9B;AAAC,WAAM;IACJ,MAAM,GAAG,IAAI,CAAC;CACjB;AAED,IAAM,OAAO,GAAQ,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAE/C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;IACjB,OAAO,CAAC,IAAI,EAAE,CAAC;CAClB;AAID,mBAAmB,KAAqB;IACpC,OAAkB,KAAM,CAAC,IAAI,KAAK,SAAS,CAAC;AAChD,C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,MAAM;gBACV;oBACI,KAAK,GAAG,KAAK,CAAC;aACrB;YACK,IAAA,wDAGiD,EAFnD,cAAI,EACJ,wBAAS,CAC2C;YACxD,OAAO;gBACH,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ;gBAC5B,IAAI,EAAE,IAAI,GAAG,CAAC;gBACd,OAAO,EAAE,EAAE,CAAC,4BAA4B,CAAC,IAAI,CAAC,WAAW,EAAE,qBAAQ,CAAC;gBACpE,IAAI,EAAE,SAAS,GAAG,CAAC;gBACnB,KAAK,EAAE,KAAK;gBACZ,QAAQ,EAAK,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAG;gBACpD,IAAI,EAAE,OAAK,IAAI,CAAC,IAAM;aACzB,CAAC;QACN,CAAC,CAAC,CAAC;IACX,CAAC;IACL,cAAC;AAAD,CAxdA,AAwdC,IAAA;AAxdY,0BAAO","file":"checker.js","sourcesContent":["import * as ts from 'typescript';\r\nimport chalk from 'chalk';\r\nimport * as path from 'path';\r\nimport * as fs from 'fs';\r\n\r\nimport { IInternalTypeCheckerOptions, END_LINE, ITSLintError, ITSError } from './interfaces';\r\n\r\nimport * as TSLintTypes from 'tslint'; // Just use types\r\nlet tslint: typeof TSLintTypes | null;\r\ntry {\r\n tslint = require('tslint');\r\n} catch {\r\n tslint = null;\r\n}\r\n\r\nconst entries: any = require('object.entries');\r\n\r\nif (!Object.entries) {\r\n entries.shim();\r\n}\r\n\r\n\r\ntype TypeCheckError = ITSLintError | ITSError;\r\nfunction isTSError(error: TypeCheckError) {\r\n return (error).code !== undefined;\r\n}\r\n\r\nexport class Checker {\r\n\r\n // options that will be used when checking and printing results\r\n private options: IInternalTypeCheckerOptions;\r\n\r\n // typescript program\r\n private program: ts.Program;\r\n\r\n // time used to do typecheck/linting\r\n private elapsedInspectionTime: number;\r\n\r\n // type diagonstic returned by typescript\r\n private tsDiagnostics: ts.Diagnostic[];\r\n\r\n // lint result returned by tsLint\r\n private lintFileResult: TSLintTypes.LintResult[];\r\n\r\n\r\n constructor() {\r\n // nothing atm\r\n }\r\n\r\n\r\n public inspectCode(options: IInternalTypeCheckerOptions) {\r\n this.options = options;\r\n\r\n\r\n // parse it right away, no need to wait...\r\n const parseConfigHost: any = {\r\n fileExists: ts.sys.fileExists,\r\n readDirectory: ts.sys.readDirectory,\r\n readFile: ts.sys.readFile,\r\n useCaseSensitiveFileNames: true\r\n };\r\n\r\n // take the time\r\n let inspectionTimeStart = new Date().getTime();\r\n\r\n // get program and get diagnostics and store them diagnostics\r\n const parsed = ts.parseJsonConfigFileContent(this.options.tsConfigJsonContent, parseConfigHost, options.basePath || '.', undefined);\r\n this.program = ts.createProgram(parsed.fileNames, parsed.options, undefined, this.program);\r\n\r\n\r\n // get errors and tag them;\r\n this.tsDiagnostics = [];\r\n let optionsErrors = this.program.getOptionsDiagnostics().map((obj) => {\r\n // tag em so we know for later\r\n (obj)._type = 'options';\r\n return obj;\r\n });\r\n this.tsDiagnostics = this.tsDiagnostics.concat(optionsErrors);\r\n\r\n\r\n\r\n let globalErrors = this.program.getGlobalDiagnostics().map((obj) => {\r\n (obj)._type = 'global';\r\n return obj;\r\n });\r\n this.tsDiagnostics = this.tsDiagnostics.concat(globalErrors);\r\n\r\n\r\n\r\n let syntacticErrors = this.program.getSyntacticDiagnostics().map((obj) => {\r\n (obj)._type = 'syntactic';\r\n return obj;\r\n });\r\n this.tsDiagnostics = this.tsDiagnostics.concat(syntacticErrors);\r\n\r\n\r\n\r\n let semanticErrors = this.program.getSemanticDiagnostics().map((obj) => {\r\n (obj)._type = 'semantic';\r\n return obj;\r\n });\r\n this.tsDiagnostics = this.tsDiagnostics.concat(semanticErrors);\r\n\r\n\r\n // get tslint if json file is supplied\r\n this.lintFileResult = [];\r\n if (options.tsLint) {\r\n\r\n if (!tslint) {\r\n this.writeText(\r\n chalk.red(`\\nMake sure to have ${chalk.bgWhiteBright('tslint')} installed if you use the \"tsLint\" option:\\n`) +\r\n chalk.redBright('npm install --save-dev tslint\\n\\n')\r\n );\r\n throw new Error('tslint not installed');\r\n }\r\n\r\n // get full path\r\n let fullPath = path.resolve(this.options.basePath, options.tsLint);\r\n\r\n // gets the files, lint every file and store errors in lintResults\r\n let files = tslint.Linter.getFileNames(this.program);\r\n\r\n // get tslint configuration\r\n const tsLintConfiguration = tslint.Configuration.findConfiguration(fullPath, this.options.basePath).results;\r\n\r\n // lint the files\r\n this.lintFileResult =\r\n files.map(file => {\r\n // get content of file\r\n let fileContents: any = this.program.getSourceFile(file);\r\n fileContents = fileContents ? fileContents.getFullText() : '';\r\n\r\n // create new linter using lint options and tsprogram\r\n const linter = new tslint!.Linter((options.lintoptions), this.program);\r\n\r\n // lint file using filename, filecontent, and tslint configuration\r\n linter.lint(file, fileContents, tsLintConfiguration);\r\n\r\n // return result\r\n return linter.getResult();\r\n }).filter((result) => {\r\n // only return the one with erros\r\n return result.errorCount ? true : false;\r\n });\r\n }\r\n\r\n // save elapsed check time\r\n this.elapsedInspectionTime = new Date().getTime() - inspectionTimeStart;\r\n }\r\n\r\n\r\n\r\n /**\r\n * print result\r\n *\r\n */\r\n public printResult(isWorker?: boolean) {\r\n\r\n // consts\r\n const print = this.writeText;\r\n const program = this.program;\r\n const options = this.options;\r\n\r\n // print header\r\n print(\r\n chalk.bgWhite(\r\n chalk.black(`${END_LINE}Typechecker plugin(${options.type}) ${options.name}`)\r\n ) +\r\n chalk.white(`.${END_LINE}`)\r\n );\r\n\r\n // print time\r\n print(\r\n chalk.grey(`Time:${new Date().toString()} ${END_LINE}`)\r\n );\r\n\r\n // get the lint errors messages\r\n let lintErrorMessages: TypeCheckError[] = this.processLintFiles();\r\n\r\n // loop diagnostics and get the errors messages\r\n let tsErrorMessages: TypeCheckError[] = this.processTsDiagnostics();\r\n\r\n // combine errors and print if any\r\n let combinedErrors: TypeCheckError[] = tsErrorMessages.concat(lintErrorMessages);\r\n\r\n // group by filename\r\n let groupedErrors: { [k: string]: TypeCheckError[] } = {};\r\n combinedErrors.forEach((error: TypeCheckError) => {\r\n if (!groupedErrors[error.fileName]) {\r\n groupedErrors[error.fileName] = [] as TypeCheckError[];\r\n }\r\n\r\n groupedErrors[error.fileName].push(error);\r\n });\r\n\r\n let allErrors = Object.entries(groupedErrors)\r\n .map(([fileName, errors]) => {\r\n const short = this.options.shortenFilenames;\r\n const fullFileName = path.resolve(fileName);\r\n const shortFileName = fullFileName.split(options.basePath).join('.');\r\n return chalk.white(`└── ${shortFileName}`) + END_LINE + errors.map((err: TypeCheckError) => {\r\n let text = chalk.red(' |');\r\n if (isTSError(err)) {\r\n text += chalk[err.color](` ${short ? shortFileName : fullFileName} (${err.line},${err.char}) `);\r\n text += chalk.white(`(${(err).category}`);\r\n text += chalk.white(`${(err).code})`);\r\n text += ' ' + (err).message;\r\n } else {\r\n text += chalk[err.color](` ${short ? shortFileName : fullFileName} (${err.line + 1},${err.char + 1}) `);\r\n text += chalk.white(`(${(err).ruleSeverity}:`);\r\n text += chalk.white(`${(err).ruleName})`);\r\n text += ' ' + (err).failure;\r\n }\r\n\r\n return text;\r\n }).join(END_LINE);\r\n });\r\n\r\n // print if any\r\n if (allErrors.length > 0) {\r\n // insert header\r\n allErrors.unshift(\r\n chalk.underline(`${END_LINE}File errors`) + chalk.white(':') // fix windows\r\n );\r\n print(allErrors.join(END_LINE));\r\n }\r\n\r\n // print option errors\r\n if (program.getOptionsDiagnostics().length) {\r\n print(chalk.underline(`${END_LINE}${END_LINE}Option errors`) + chalk.white(`:${END_LINE}`));\r\n let optionErrorsText = Object.entries(program.getOptionsDiagnostics())\r\n .map(([no, err]) => {\r\n let text = no + ':';\r\n let messageText = (err).messageText;\r\n if ((typeof messageText === 'object') && (messageText !== null)) {\r\n messageText = JSON.stringify(messageText);\r\n }\r\n text = chalk[options.yellowOnOptions ? 'yellow' : 'red']\r\n (`└── tsConfig: `);\r\n text += chalk.white(`(${(err).category}:`);\r\n text += chalk.white(`${(err).code})`);\r\n text += chalk.white(` ${messageText}`);\r\n return text;\r\n });\r\n print(optionErrorsText.join(END_LINE));\r\n }\r\n\r\n // print global errors\r\n // todo: this needs testing, how do I create a global error??\r\n /* try {\r\n if (program.getGlobalDiagnostics().length) {\r\n print(chalk.underline(`${END_LINE}${END_LINE}Global errors`) + chalk.white(`:${END_LINE}`));\r\n let optionErrorsText = Object.entries(program.getGlobalDiagnostics())\r\n .map(([no, err]) => {\r\n let text = no + ':';\r\n text = chalk[options.yellowOnGlobal ? 'yellow' : 'red']\r\n (`└── tsConfig: `);\r\n text += chalk.white(`(${(err).category}:`);\r\n text += chalk.white(`${(err).code})`);\r\n text += chalk.white(` ${(err).messageText}`);\r\n return text;\r\n });\r\n print(optionErrorsText.join(END_LINE));\r\n }\r\n } catch (err) {\r\n console.log(`Global error`);\r\n } */\r\n\r\n // time for summary >>>>>\r\n\r\n // get errors totals\r\n let optionsErrors = program.getOptionsDiagnostics().length;\r\n let globalErrors = program.getGlobalDiagnostics().length;\r\n let syntacticErrors = program.getSyntacticDiagnostics().length;\r\n let semanticErrors = program.getSemanticDiagnostics().length;\r\n let tsLintErrors = lintErrorMessages.length;\r\n let totalsErrors = optionsErrors + globalErrors + syntacticErrors + semanticErrors + tsLintErrors;\r\n\r\n\r\n\r\n // if errors, show user\r\n if (totalsErrors) {\r\n\r\n // write header\r\n print(\r\n chalk.underline(`${END_LINE}${END_LINE}Errors`) +\r\n chalk.white(`:${totalsErrors}${END_LINE}`)\r\n );\r\n\r\n print(\r\n chalk[optionsErrors ? options.yellowOnOptions ? 'yellow' : 'red' : 'white']\r\n (`└── Options: ${optionsErrors}${END_LINE}`)\r\n );\r\n\r\n print(\r\n chalk[globalErrors ? options.yellowOnGlobal ? 'yellow' : 'red' : 'white']\r\n (`└── Global: ${globalErrors}${END_LINE}`)\r\n );\r\n\r\n print(\r\n chalk[syntacticErrors ? options.yellowOnSyntactic ? 'yellow' : 'red' : 'white']\r\n (`└── Syntactic: ${syntacticErrors}${END_LINE}`)\r\n );\r\n\r\n print(\r\n chalk[semanticErrors ? options.yellowOnSemantic ? 'yellow' : 'red' : 'white']\r\n (`└── Semantic: ${semanticErrors}${END_LINE}`)\r\n );\r\n\r\n print(\r\n chalk[tsLintErrors ? options.yellowOnLint ? 'yellow' : 'red' : 'white']\r\n (`└── TsLint: ${tsLintErrors}${END_LINE}${END_LINE}`)\r\n );\r\n\r\n if (options.emit) {\r\n print(\r\n chalk.grey(`Skipping emit file${END_LINE}`)\r\n );\r\n }\r\n\r\n } else {\r\n // if there no errors, then also give some feedback about this, so they know its working\r\n print(\r\n chalk.grey(`All good, no errors :-)${END_LINE}`)\r\n );\r\n\r\n if (options.emit) {\r\n print(\r\n chalk.grey(`Getting ready to emit files${END_LINE}`)\r\n );\r\n try {\r\n if (options.clearOnEmit) {\r\n let outputFolder: any = program.getCompilerOptions().outDir;\r\n let deleteFolder = function (folder: string) {\r\n folder = path.join(folder);\r\n if (fs.existsSync(folder)) {\r\n fs.readdirSync(folder).forEach(function (file: string) {\r\n let curPath = folder + '/' + file;\r\n if (fs.lstatSync(curPath).isDirectory()) { // recurse\r\n deleteFolder(curPath);\r\n } else { // delete file\r\n fs.unlinkSync(curPath);\r\n }\r\n });\r\n fs.rmdirSync(folder);\r\n }\r\n };\r\n if (!outputFolder) {\r\n console.warn('output filder missing');\r\n } else {\r\n print(\r\n chalk.grey(`clearing output folder${END_LINE}`)\r\n );\r\n deleteFolder(outputFolder);\r\n print(\r\n chalk.grey(`Output folder cleared${END_LINE}`)\r\n );\r\n program.emit();\r\n print(\r\n chalk.grey(`Files emittet${END_LINE}`)\r\n );\r\n }\r\n } else {\r\n program.emit();\r\n print(\r\n chalk.grey(`Files emittet${END_LINE}`)\r\n );\r\n }\r\n } catch (error) {\r\n print(\r\n chalk.red(`emitting files failed${END_LINE}`)\r\n );\r\n }\r\n }\r\n }\r\n\r\n print(\r\n chalk.grey(`Typechecking time: ${this.elapsedInspectionTime}ms${END_LINE}`)\r\n );\r\n\r\n\r\n // final check how to end the checker, throw, exit or keep alive\r\n\r\n switch (true) {\r\n\r\n // if throwError is set then callback and quit\r\n case options.throwOnGlobal && globalErrors > 0:\r\n case options.throwOnOptions && optionsErrors > 0:\r\n case options.throwOnSemantic && semanticErrors > 0:\r\n case options.throwOnTsLint && tsLintErrors > 0:\r\n case options.throwOnSyntactic && syntacticErrors > 0:\r\n if (process.send) {\r\n process.send('error');\r\n } else {\r\n print(chalk.grey(`error typechecker${END_LINE}${END_LINE}`));\r\n }\r\n // exit with error\r\n process.exit(1);\r\n break;\r\n\r\n // if quit is set and its a worker, then post message and callback to main tread and tell its done\r\n case options.quit && isWorker:\r\n print(chalk.grey(`Quiting typechecker${END_LINE}${END_LINE}`));\r\n\r\n // since Im a worker I need to send back a message;\r\n (process).send('done');\r\n break;\r\n\r\n // if quit is set and not worker, then just post messeage\r\n case options.quit && !isWorker:\r\n print(chalk.grey(`Quiting typechecker${END_LINE}${END_LINE}`));\r\n break;\r\n\r\n // default action\r\n default:\r\n print(chalk.grey(`Keeping typechecker alive${END_LINE}${END_LINE}`));\r\n }\r\n\r\n return totalsErrors;\r\n\r\n }\r\n\r\n\r\n\r\n /**\r\n * write to screen helper\r\n *\r\n */\r\n private writeText(text: string) {\r\n ts.sys.write(text);\r\n }\r\n\r\n\r\n\r\n /**\r\n * loops lint failures and return pretty failure string ready to be printed\r\n *\r\n */\r\n private processLintFiles(): ITSLintError[] {\r\n const options = this.options;\r\n const erroredLintFiles = this.lintFileResult\r\n .filter((fileResult: TSLintTypes.LintResult) => fileResult.failures);\r\n const errors = erroredLintFiles\r\n .map(\r\n (fileResult: TSLintTypes.LintResult) =>\r\n fileResult.failures.map((failure: any) => ({\r\n fileName: failure.fileName,\r\n line: failure.startPosition.lineAndCharacter.line,\r\n char: failure.startPosition.lineAndCharacter.character,\r\n ruleSeverity: failure.ruleSeverity.charAt(0).toUpperCase() + failure.ruleSeverity.slice(1),\r\n ruleName: failure.ruleName,\r\n color: options.yellowOnLint ? 'yellow' : 'red',\r\n failure: failure.failure\r\n }))).reduce((acc, curr) => acc.concat(curr), []);\r\n return errors;\r\n }\r\n\r\n /**\r\n * loops ts failures and return pretty failure string ready to be printed\r\n *\r\n */\r\n private processTsDiagnostics(): ITSError[] {\r\n const options = this.options;\r\n return this.tsDiagnostics\r\n .filter((diag: any) => diag.file)\r\n .map((diag: any) => {\r\n // set color from options\r\n let color: string;\r\n switch (diag._type) {\r\n case 'options':\r\n color = options.yellowOnOptions ? 'yellow' : 'red';\r\n break;\r\n case 'global':\r\n color = options.yellowOnGlobal ? 'yellow' : 'red';\r\n break;\r\n case 'syntactic':\r\n color = options.yellowOnSyntactic ? 'yellow' : 'red';\r\n break;\r\n case 'semantic':\r\n color = options.yellowOnSemantic ? 'yellow' : 'red';\r\n break;\r\n default:\r\n color = 'red';\r\n }\r\n const {\r\n line,\r\n character\r\n } = diag.file.getLineAndCharacterOfPosition(diag.start);\r\n return {\r\n fileName: diag.file.fileName,\r\n line: line + 1, // `(${line + 1},${character + 1})`,\r\n message: ts.flattenDiagnosticMessageText(diag.messageText, END_LINE),\r\n char: character + 1,\r\n color: color,\r\n category: `${ts.DiagnosticCategory[diag.category]}:`,\r\n code: `TS${diag.code}`\r\n };\r\n });\r\n }\r\n}\r\n"],"sourceRoot":"src/"} \ No newline at end of file diff --git a/dist/commonjs/index.js.map b/dist/commonjs/index.js.map index 1dda112..6a3276e 100644 --- a/dist/commonjs/index.js.map +++ b/dist/commonjs/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;AAEA,qCAAuC;AACvC,2BAA6B;AAC7B,2CAAiI;AACjI,qCAAoC;AACpC,6BAA+B;AAC/B,+BAAiC;AACjC,+BAA0B;AAG1B;IASI,yBAAY,OAA4B;QACpC,IAAI,CAAC,OAAO,GAAG,IAAI,iBAAO,EAAE,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAGvB,IAAI,CAAC,SAAS,CAAC,eAAK,CAAC,MAAM,CAAI,IAAI,0BAAqB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G,KAAK,OAAO,CAAC,CAAC,CAAC;gBAGlB,KAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;gBACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACpB,CAAC;YAAC,IAAI,CAAC,CAAC;gBAEJ,EAAE,CAAC,CAAC,KAAI,CAAC,cAAc,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC;oBACjF,KAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;gBACpC,CAAC;gBAAC,IAAI,CAAC,CAAC;oBAEJ,KAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;oBACjC,KAAI,CAAC,UAAU,EAAE,CAAC;gBACtB,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAQO,mCAAS,GAAjB,UAAkB,IAAY;QAC1B,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAQO,iCAAO,GAAf,UAAgB,OAAe;QAC3B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;IACvH,CAAC;IAGL,sBAAC;AAAD,CA5SA,AA4SC,IAAA;AA5SY,0CAAe;AA+Sf,QAAA,UAAU,GAAG,UAAC,OAA4B;IACnD,MAAM,CAAC,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;AACxC,CAAC,CAAC","file":"index.js","sourcesContent":["// mostly a little from compiler API, gulp-typescript, tslint and a lot of failing :-)\n\nimport * as child from 'child_process';\nimport * as path from 'path';\nimport { ILintOptions, ITypeCheckerOptions, WorkerCommand, TypecheckerRunType, IInternalTypeCheckerOptions } from './interfaces';\nimport { Checker } from './checker';\nimport * as watch from 'watch';\nimport * as ts from 'typescript';\nimport chalk from 'chalk';\n\n\nexport class TypeHelperClass {\n private options: ITypeCheckerOptions;\n private worker: child.ChildProcess;\n private checker: Checker;\n private monitor: any;\n private watchTimeout: NodeJS.Timer;\n private isWorkerInspectPreformed: boolean;\n private workerCallback?: (errors: number) => void;\n\n constructor(options: ITypeCheckerOptions) {\n this.checker = new Checker();\n this.options = options;\n\n // configuration name\n this.writeText(chalk.yellow(`${'\\n'}Typechecker name: ${chalk.white(`${this.options.name}${'\\n'}`)}`));\n\n // get/set base path\n this.options.basePath = options.basePath ? path.resolve(process.cwd(), options.basePath) : process.cwd();\n this.writeText(chalk.yellow(`Typechecker basepath: ${chalk.white(`${this.options.basePath}${'\\n'}`)}`));\n\n // get name\n this.options.name = this.options.name ? ':' + this.options.name : '';\n\n // shorten filenames to de-clutter output?\n this.options.shortenFilenames = !!this.options.shortenFilenames;\n\n // tslint options\n let lintOp = this.options.lintoptions;\n this.options.lintoptions = lintOp ? lintOp : ({} as ILintOptions);\n\n // fix tslint options so tslint do not complain\n this.options.lintoptions = {\n fix: this.options.lintoptions.fix || false, // <- this can be useful to have\n formatter: 'json',\n formattersDirectory: this.options.lintoptions.formattersDirectory || null,\n rulesDirectory: this.options.lintoptions.rulesDirectory || null\n };\n\n // get tsconfig path and options\n let tsconf = this.getPath(options.tsConfig);\n (this.options).tsConfigJsonContent = require(tsconf);\n this.writeText(chalk.yellow(`Typechecker tsconfig: ${chalk.white(`${tsconf}${'\\n'}`)}`));\n\n // get tslint path and options\n if (options.tsLint) {\n let tsLint = this.getPath(options.tsLint);\n this.writeText(chalk.yellow(`Typechecker tsLint: ${chalk.white(`${tsLint}${'\\n'}`)}`));\n }\n }\n\n\n\n /**\n * Runs in own thread/works and quits\n *\n */\n public runAsync(callback?: (errors: number) => void): void {\n\n // set options, add if it need to quit and run type\n let options: IInternalTypeCheckerOptions = Object.assign(this.options, { quit: true, type: TypecheckerRunType.async });\n\n // set the worker callback\n this.workerCallback = callback;\n\n // create thread\n this.createThread();\n\n // inspect our code\n this.inspectCodeWithWorker(options);\n\n // call worker\n this.printResultWithWorker();\n }\n\n\n /**\n * Runs in sync and quits\n * Returns total errors\n */\n public runSync(): number {\n\n // set options, add if it need to quit and run type\n let options: IInternalTypeCheckerOptions = Object.assign(this.options, { quit: true, type: TypecheckerRunType.sync });\n\n // inspect our code\n this.checker.inspectCode(options);\n\n // print result to screen and return total errors\n return this.checker.printResult();\n }\n\n\n /**\n * Runs in async and return promise and callbacks and quits\n *\n */\n public runPromise(): Promise {\n\n // return promise so we can use it wrih then() or async/await\n return new Promise((resolve: Function, reject: Function) => {\n\n // wrap in try/catch so we can do reject if it fails\n try {\n\n // set options, add if it need to quit and run type\n let options: IInternalTypeCheckerOptions = Object.assign(this.options, { quit: true, type: TypecheckerRunType.promiseAsync });\n\n // set the worker callback\n this.workerCallback = (errors) => {\n resolve(errors);\n };\n\n // create thread\n this.createThread();\n\n // inspect our code\n this.inspectCodeWithWorker(options);\n\n // call worker\n this.printResultWithWorker();\n\n } catch (err) {\n reject(err);\n }\n });\n }\n\n\n\n /**\n * Creates thread/worker, starts watch on path and runs\n *\n */\n public runWatch(pathToWatch: string): void {\n\n // set options, add if it need to quit and run type\n let options: IInternalTypeCheckerOptions = Object.assign(this.options, { quit: false, type: TypecheckerRunType.watch });\n\n // const\n const write = this.writeText;\n const END_LINE = '\\n';\n\n // create thread and inspect code with worker\n this.createThread();\n this.inspectCodeWithWorker(options);\n\n // current basepath to watch\n let basePath = this.getPath(pathToWatch);\n\n watch.createMonitor(basePath, (monitor: any) => {\n\n // tell user what path we are watching\n write(chalk.yellow(`Typechecker watching: ${chalk.white(`${basePath}${END_LINE}`)}`));\n\n // on created file event\n monitor.on('created', (f: any /*, stat: any*/) => {\n write(END_LINE + chalk.yellow(`File created: ${f}${END_LINE}`));\n });\n\n // on changed file event\n monitor.on('changed', (f: any /*, curr: any, prev: any*/) => {\n\n // tell user about event\n write(END_LINE + chalk.yellow(`File changed: ${chalk.white(`${f}${END_LINE}`)}`));\n write(chalk.grey(`Calling typechecker${END_LINE}`));\n\n // have inside timeout, so we only run once when multible files are saved\n clearTimeout(this.watchTimeout);\n this.watchTimeout = setTimeout(() => {\n\n // inspect and print result\n this.inspectCodeWithWorker(options);\n this.printResultWithWorker();\n }, 500);\n\n });\n\n monitor.on('removed', (f: any /*, stat: any*/) => {\n\n // tell user about event\n write(END_LINE + chalk.yellow(`File removed: ${chalk.white(`${f}${END_LINE}`)}`));\n write(chalk.grey(`Calling typechecker${END_LINE}`));\n\n // have inside timeout, so we only run once when multible files are saved\n clearTimeout(this.watchTimeout);\n this.watchTimeout = setTimeout(() => {\n\n // inspect and print result\n this.inspectCodeWithWorker(options);\n this.printResultWithWorker();\n }, 500);\n\n });\n\n // set to class so we can stop it later if error is thrown\n this.monitor = monitor;\n });\n\n // print result, since its our first run\n this.printResultWithWorker();\n\n }\n\n\n /**\n * Kills worker and watch if started\n *\n */\n public killWorker(): void {\n if (this.worker) {\n this.worker.kill();\n }\n\n if (this.monitor) {\n this.monitor.stop();\n }\n }\n\n\n\n /**\n * Configure worker, internal function\n *\n */\n private inspectCodeWithWorker(options: ITypeCheckerOptions): void {\n this.worker.send({ type: WorkerCommand.inspectCode, options: options });\n\n // we set this so we can stop worker print from trying to run\n this.isWorkerInspectPreformed = true;\n }\n\n\n\n /**\n * Tells worker to do a typecheck\n *\n */\n private printResultWithWorker(): void {\n\n // have we inspected code?\n if (this.isWorkerInspectPreformed) {\n\n // all well, lets preform printout\n this.worker.send({ type: WorkerCommand.printResult, hasCallback: this.workerCallback != null });\n } else {\n this.writeText('You can not run pront before you have inspected code first');\n }\n }\n\n /**\n * Creates thread/worker\n *\n */\n private createThread(): void {\n\n // create worker fork\n this.worker = child.fork(path.join(__dirname, 'worker.js'), []);\n\n // listen for worker messages\n this.worker.on('message', (msg: any) => {\n\n if (msg === 'error') {\n\n // if error then exit\n this.writeText('error typechecker');\n process.exit(1);\n } else {\n\n if (this.workerCallback && msg && typeof msg === 'object' && msg.type === 'result') {\n this.workerCallback(msg.result);\n } else {\n // if not error, then just kill worker\n this.writeText('killing worker');\n this.killWorker();\n }\n }\n });\n }\n\n\n\n /**\n * Helper to write to cmd\n *\n */\n private writeText(text: string): void {\n ts.sys.write(text);\n }\n\n\n\n /**\n * gets path based on basepath being set\n *\n */\n private getPath(usePath: string): string {\n return this.options.basePath ? path.resolve(this.options.basePath, usePath) : path.resolve(process.cwd(), usePath);\n }\n\n\n}\n\n// return new typechecker\nexport const TypeHelper = (options: ITypeCheckerOptions): TypeHelperClass => {\n return new TypeHelperClass(options);\n};\n"],"sourceRoot":"src/"} \ No newline at end of file +{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;AAEA,qCAAuC;AACvC,2BAA6B;AAC7B,2CAAiI;AACjI,qCAAoC;AACpC,6BAA+B;AAC/B,+BAAiC;AACjC,+BAA0B;AAG1B;IASI,yBAAY,OAA4B;QACpC,IAAI,CAAC,OAAO,GAAG,IAAI,iBAAO,EAAE,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAGvB,IAAI,CAAC,SAAS,CAAC,eAAK,CAAC,MAAM,CAAI,IAAI,0BAAqB,eAAK,CAAC,KAAK,CAAC,KAAG,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAM,CAAG,CAAC,CAAC,CAAC;QAGvG,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;QACzG,IAAI,CAAC,SAAS,CAAC,eAAK,CAAC,MAAM,CAAC,2BAAyB,eAAK,CAAC,KAAK,CAAC,KAAG,IAAI,CAA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I,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;IACvH,CAAC;IAGL,sBAAC;AAAD,CA5SA,AA4SC,IAAA;AA5SY,0CAAe;AA+Sf,QAAA,UAAU,GAAG,UAAC,OAA4B;IACnD,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;AACxC,CAAC,CAAC","file":"index.js","sourcesContent":["// mostly a little from compiler API, gulp-typescript, tslint and a lot of failing :-)\r\n\r\nimport * as child from 'child_process';\r\nimport * as path from 'path';\r\nimport { ILintOptions, ITypeCheckerOptions, WorkerCommand, TypecheckerRunType, IInternalTypeCheckerOptions } from './interfaces';\r\nimport { Checker } from './checker';\r\nimport * as watch from 'watch';\r\nimport * as ts from 'typescript';\r\nimport chalk from 'chalk';\r\n\r\n\r\nexport class TypeHelperClass {\r\n private options: ITypeCheckerOptions;\r\n private worker: child.ChildProcess;\r\n private checker: Checker;\r\n private monitor: any;\r\n private watchTimeout: NodeJS.Timer;\r\n private isWorkerInspectPreformed: boolean;\r\n private workerCallback?: (errors: number) => void;\r\n\r\n constructor(options: ITypeCheckerOptions) {\r\n this.checker = new Checker();\r\n this.options = options;\r\n\r\n // configuration name\r\n this.writeText(chalk.yellow(`${'\\n'}Typechecker name: ${chalk.white(`${this.options.name}${'\\n'}`)}`));\r\n\r\n // get/set base path\r\n this.options.basePath = options.basePath ? path.resolve(process.cwd(), options.basePath) : process.cwd();\r\n this.writeText(chalk.yellow(`Typechecker basepath: ${chalk.white(`${this.options.basePath}${'\\n'}`)}`));\r\n\r\n // get name\r\n this.options.name = this.options.name ? ':' + this.options.name : '';\r\n\r\n // shorten filenames to de-clutter output?\r\n this.options.shortenFilenames = !!this.options.shortenFilenames;\r\n\r\n // tslint options\r\n let lintOp = this.options.lintoptions;\r\n this.options.lintoptions = lintOp ? lintOp : ({} as ILintOptions);\r\n\r\n // fix tslint options so tslint do not complain\r\n this.options.lintoptions = {\r\n fix: this.options.lintoptions.fix || false, // <- this can be useful to have\r\n formatter: 'json',\r\n formattersDirectory: this.options.lintoptions.formattersDirectory || null,\r\n rulesDirectory: this.options.lintoptions.rulesDirectory || null\r\n };\r\n\r\n // get tsconfig path and options\r\n let tsconf = this.getPath(options.tsConfig);\r\n (this.options).tsConfigJsonContent = require(tsconf);\r\n this.writeText(chalk.yellow(`Typechecker tsconfig: ${chalk.white(`${tsconf}${'\\n'}`)}`));\r\n\r\n // get tslint path and options\r\n if (options.tsLint) {\r\n let tsLint = this.getPath(options.tsLint);\r\n this.writeText(chalk.yellow(`Typechecker tsLint: ${chalk.white(`${tsLint}${'\\n'}`)}`));\r\n }\r\n }\r\n\r\n\r\n\r\n /**\r\n * Runs in own thread/works and quits\r\n *\r\n */\r\n public runAsync(callback?: (errors: number) => void): void {\r\n\r\n // set options, add if it need to quit and run type\r\n let options: IInternalTypeCheckerOptions = Object.assign(this.options, { quit: true, type: TypecheckerRunType.async });\r\n\r\n // set the worker callback\r\n this.workerCallback = callback;\r\n\r\n // create thread\r\n this.createThread();\r\n\r\n // inspect our code\r\n this.inspectCodeWithWorker(options);\r\n\r\n // call worker\r\n this.printResultWithWorker();\r\n }\r\n\r\n\r\n /**\r\n * Runs in sync and quits\r\n * Returns total errors\r\n */\r\n public runSync(): number {\r\n\r\n // set options, add if it need to quit and run type\r\n let options: IInternalTypeCheckerOptions = Object.assign(this.options, { quit: true, type: TypecheckerRunType.sync });\r\n\r\n // inspect our code\r\n this.checker.inspectCode(options);\r\n\r\n // print result to screen and return total errors\r\n return this.checker.printResult();\r\n }\r\n\r\n\r\n /**\r\n * Runs in async and return promise and callbacks and quits\r\n *\r\n */\r\n public runPromise(): Promise {\r\n\r\n // return promise so we can use it wrih then() or async/await\r\n return new Promise((resolve: Function, reject: Function) => {\r\n\r\n // wrap in try/catch so we can do reject if it fails\r\n try {\r\n\r\n // set options, add if it need to quit and run type\r\n let options: IInternalTypeCheckerOptions = Object.assign(this.options, { quit: true, type: TypecheckerRunType.promiseAsync });\r\n\r\n // set the worker callback\r\n this.workerCallback = (errors) => {\r\n resolve(errors);\r\n };\r\n\r\n // create thread\r\n this.createThread();\r\n\r\n // inspect our code\r\n this.inspectCodeWithWorker(options);\r\n\r\n // call worker\r\n this.printResultWithWorker();\r\n\r\n } catch (err) {\r\n reject(err);\r\n }\r\n });\r\n }\r\n\r\n\r\n\r\n /**\r\n * Creates thread/worker, starts watch on path and runs\r\n *\r\n */\r\n public runWatch(pathToWatch: string): void {\r\n\r\n // set options, add if it need to quit and run type\r\n let options: IInternalTypeCheckerOptions = Object.assign(this.options, { quit: false, type: TypecheckerRunType.watch });\r\n\r\n // const\r\n const write = this.writeText;\r\n const END_LINE = '\\n';\r\n\r\n // create thread and inspect code with worker\r\n this.createThread();\r\n this.inspectCodeWithWorker(options);\r\n\r\n // current basepath to watch\r\n let basePath = this.getPath(pathToWatch);\r\n\r\n watch.createMonitor(basePath, (monitor: any) => {\r\n\r\n // tell user what path we are watching\r\n write(chalk.yellow(`Typechecker watching: ${chalk.white(`${basePath}${END_LINE}`)}`));\r\n\r\n // on created file event\r\n monitor.on('created', (f: any /*, stat: any*/) => {\r\n write(END_LINE + chalk.yellow(`File created: ${f}${END_LINE}`));\r\n });\r\n\r\n // on changed file event\r\n monitor.on('changed', (f: any /*, curr: any, prev: any*/) => {\r\n\r\n // tell user about event\r\n write(END_LINE + chalk.yellow(`File changed: ${chalk.white(`${f}${END_LINE}`)}`));\r\n write(chalk.grey(`Calling typechecker${END_LINE}`));\r\n\r\n // have inside timeout, so we only run once when multible files are saved\r\n clearTimeout(this.watchTimeout);\r\n this.watchTimeout = setTimeout(() => {\r\n\r\n // inspect and print result\r\n this.inspectCodeWithWorker(options);\r\n this.printResultWithWorker();\r\n }, 500);\r\n\r\n });\r\n\r\n monitor.on('removed', (f: any /*, stat: any*/) => {\r\n\r\n // tell user about event\r\n write(END_LINE + chalk.yellow(`File removed: ${chalk.white(`${f}${END_LINE}`)}`));\r\n write(chalk.grey(`Calling typechecker${END_LINE}`));\r\n\r\n // have inside timeout, so we only run once when multible files are saved\r\n clearTimeout(this.watchTimeout);\r\n this.watchTimeout = setTimeout(() => {\r\n\r\n // inspect and print result\r\n this.inspectCodeWithWorker(options);\r\n this.printResultWithWorker();\r\n }, 500);\r\n\r\n });\r\n\r\n // set to class so we can stop it later if error is thrown\r\n this.monitor = monitor;\r\n });\r\n\r\n // print result, since its our first run\r\n this.printResultWithWorker();\r\n\r\n }\r\n\r\n\r\n /**\r\n * Kills worker and watch if started\r\n *\r\n */\r\n public killWorker(): void {\r\n if (this.worker) {\r\n this.worker.kill();\r\n }\r\n\r\n if (this.monitor) {\r\n this.monitor.stop();\r\n }\r\n }\r\n\r\n\r\n\r\n /**\r\n * Configure worker, internal function\r\n *\r\n */\r\n private inspectCodeWithWorker(options: ITypeCheckerOptions): void {\r\n this.worker.send({ type: WorkerCommand.inspectCode, options: options });\r\n\r\n // we set this so we can stop worker print from trying to run\r\n this.isWorkerInspectPreformed = true;\r\n }\r\n\r\n\r\n\r\n /**\r\n * Tells worker to do a typecheck\r\n *\r\n */\r\n private printResultWithWorker(): void {\r\n\r\n // have we inspected code?\r\n if (this.isWorkerInspectPreformed) {\r\n\r\n // all well, lets preform printout\r\n this.worker.send({ type: WorkerCommand.printResult, hasCallback: this.workerCallback != null });\r\n } else {\r\n this.writeText('You can not run pront before you have inspected code first');\r\n }\r\n }\r\n\r\n /**\r\n * Creates thread/worker\r\n *\r\n */\r\n private createThread(): void {\r\n\r\n // create worker fork\r\n this.worker = child.fork(path.join(__dirname, 'worker.js'), []);\r\n\r\n // listen for worker messages\r\n this.worker.on('message', (msg: any) => {\r\n\r\n if (msg === 'error') {\r\n\r\n // if error then exit\r\n this.writeText('error typechecker');\r\n process.exit(1);\r\n } else {\r\n\r\n if (this.workerCallback && msg && typeof msg === 'object' && msg.type === 'result') {\r\n this.workerCallback(msg.result);\r\n } else {\r\n // if not error, then just kill worker\r\n this.writeText('killing worker');\r\n this.killWorker();\r\n }\r\n }\r\n });\r\n }\r\n\r\n\r\n\r\n /**\r\n * Helper to write to cmd\r\n *\r\n */\r\n private writeText(text: string): void {\r\n ts.sys.write(text);\r\n }\r\n\r\n\r\n\r\n /**\r\n * gets path based on basepath being set\r\n *\r\n */\r\n private getPath(usePath: string): string {\r\n return this.options.basePath ? path.resolve(this.options.basePath, usePath) : path.resolve(process.cwd(), usePath);\r\n }\r\n\r\n\r\n}\r\n\r\n// return new typechecker\r\nexport const TypeHelper = (options: ITypeCheckerOptions): TypeHelperClass => {\r\n return new TypeHelperClass(options);\r\n};\r\n"],"sourceRoot":"src/"} \ No newline at end of file diff --git a/dist/commonjs/interfaces.js.map b/dist/commonjs/interfaces.js.map index 8223e75..710759e 100644 --- a/dist/commonjs/interfaces.js.map +++ b/dist/commonjs/interfaces.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/interfaces.ts"],"names":[],"mappings":";;AAkEA,IAAY,aAGX;AAHD,WAAY,aAAa;IACrB,+DAAW,CAAA;IACX,+DAAW,CAAA;AACf,CAAC,EAHW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAGxB;AAKD,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC1B,gDAAO,MAAa,UAAA,CAAA;IACpB,iDAAQ,OAAc,WAAA,CAAA;IACtB,iDAAQ,OAAc,WAAA,CAAA;IACtB,wDAAe,aAAoB,kBAAA,CAAA;AACvC,CAAC,EALW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAK7B;AAsBY,QAAA,QAAQ,GAAG,IAAI,CAAC","file":"interfaces.js","sourcesContent":["\n// options they can use to create the typechecker\nexport interface ITypeCheckerOptions {\n // base path\n basePath: string;\n\n // path to tsconfig file (from basepath)\n tsConfig: string;\n\n // throw options\n throwOnSyntactic?: boolean;\n throwOnSemantic?: boolean;\n throwOnTsLint?: boolean;\n throwOnGlobal?: boolean;\n throwOnOptions?: boolean;\n\n // color options\n yellowOnLint?: boolean;\n yellowOnOptions?: boolean;\n yellowOnGlobal?: boolean;\n yellowOnSemantic?: boolean;\n yellowOnSyntactic?: boolean;\n\n // path to tslint json (from basepath)\n tsLint?: string;\n\n // name that will be displayed on cmd echo\n name?: string;\n\n // lint options that can be passed in\n // todo: rename to lintOptions, but thats a breaking change, so will do that later\n lintoptions?: ILintOptions;\n\n // use shortened filenames in order to make output less cluttered\n shortenFilenames?: boolean;\n\n // emit files according to tsconfig file\n emit?: boolean;\n\n // output folder on emit\n clearOnEmit?: boolean;\n}\n\n// lint options,this is the same as tsLint uses all paths will be from basepath\nexport interface ILintOptions {\n fix?: boolean;\n formatter?: string;\n formattersDirectory?: string | null;\n rulesDirectory?: string | null;\n}\n\n// extended internal options, needed for some interal usage\nexport interface IInternalTypeCheckerOptions extends ITypeCheckerOptions {\n type: TypecheckerRunType;\n tsConfigJsonContent?: any;\n quit?: boolean;\n}\n\n// params used when calling worker to tell it what to do\nexport interface IWorkerOptions {\n type: WorkerCommand;\n options?: IInternalTypeCheckerOptions;\n hasCallback?: boolean;\n}\n\n// run options for worker\nexport enum WorkerCommand {\n inspectCode,\n printResult\n}\n\n\n\n// checkers run types (when generating cmd print)\nexport enum TypecheckerRunType {\n sync = 'syns' as any,\n async = 'async' as any,\n watch = 'watch' as any,\n promiseAsync = 'promisesync' as any\n}\n\nexport interface ITSLintError {\n fileName: string;\n line: number;\n char: number;\n failure: string;\n color: string;\n ruleSeverity: string;\n ruleName: string;\n}\n\nexport interface ITSError {\n fileName: string;\n line: number;\n char: number;\n message: string;\n color: string;\n category: string;\n code: string;\n}\n\nexport const END_LINE = '\\n';\n"],"sourceRoot":"src/"} \ No newline at end of file +{"version":3,"sources":["../src/interfaces.ts"],"names":[],"mappings":";;AAkEA,IAAY,aAGX;AAHD,WAAY,aAAa;IACrB,+DAAW,CAAA;IACX,+DAAW,CAAA;AACf,CAAC,EAHW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAGxB;AAKD,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC1B,gDAAO,MAAa,UAAA,CAAA;IACpB,iDAAQ,OAAc,WAAA,CAAA;IACtB,iDAAQ,OAAc,WAAA,CAAA;IACtB,wDAAe,aAAoB,kBAAA,CAAA;AACvC,CAAC,EALW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAK7B;AAsBY,QAAA,QAAQ,GAAG,IAAI,CAAC","file":"interfaces.js","sourcesContent":["\r\n// options they can use to create the typechecker\r\nexport interface ITypeCheckerOptions {\r\n // base path\r\n basePath: string;\r\n\r\n // path to tsconfig file (from basepath)\r\n tsConfig: string;\r\n\r\n // throw options\r\n throwOnSyntactic?: boolean;\r\n throwOnSemantic?: boolean;\r\n throwOnTsLint?: boolean;\r\n throwOnGlobal?: boolean;\r\n throwOnOptions?: boolean;\r\n\r\n // color options\r\n yellowOnLint?: boolean;\r\n yellowOnOptions?: boolean;\r\n yellowOnGlobal?: boolean;\r\n yellowOnSemantic?: boolean;\r\n yellowOnSyntactic?: boolean;\r\n\r\n // path to tslint json (from basepath)\r\n tsLint?: string;\r\n\r\n // name that will be displayed on cmd echo\r\n name?: string;\r\n\r\n // lint options that can be passed in\r\n // todo: rename to lintOptions, but thats a breaking change, so will do that later\r\n lintoptions?: ILintOptions;\r\n\r\n // use shortened filenames in order to make output less cluttered\r\n shortenFilenames?: boolean;\r\n\r\n // emit files according to tsconfig file\r\n emit?: boolean;\r\n\r\n // output folder on emit\r\n clearOnEmit?: boolean;\r\n}\r\n\r\n// lint options,this is the same as tsLint uses all paths will be from basepath\r\nexport interface ILintOptions {\r\n fix?: boolean;\r\n formatter?: string;\r\n formattersDirectory?: string | null;\r\n rulesDirectory?: string | null;\r\n}\r\n\r\n// extended internal options, needed for some interal usage\r\nexport interface IInternalTypeCheckerOptions extends ITypeCheckerOptions {\r\n type: TypecheckerRunType;\r\n tsConfigJsonContent?: any;\r\n quit?: boolean;\r\n}\r\n\r\n// params used when calling worker to tell it what to do\r\nexport interface IWorkerOptions {\r\n type: WorkerCommand;\r\n options?: IInternalTypeCheckerOptions;\r\n hasCallback?: boolean;\r\n}\r\n\r\n// run options for worker\r\nexport enum WorkerCommand {\r\n inspectCode,\r\n printResult\r\n}\r\n\r\n\r\n\r\n// checkers run types (when generating cmd print)\r\nexport enum TypecheckerRunType {\r\n sync = 'syns' as any,\r\n async = 'async' as any,\r\n watch = 'watch' as any,\r\n promiseAsync = 'promisesync' as any\r\n}\r\n\r\nexport interface ITSLintError {\r\n fileName: string;\r\n line: number;\r\n char: number;\r\n failure: string;\r\n color: string;\r\n ruleSeverity: string;\r\n ruleName: string;\r\n}\r\n\r\nexport interface ITSError {\r\n fileName: string;\r\n line: number;\r\n char: number;\r\n message: string;\r\n color: string;\r\n category: string;\r\n code: string;\r\n}\r\n\r\nexport const END_LINE = '\\n';\r\n"],"sourceRoot":"src/"} \ No newline at end of file diff --git a/dist/commonjs/test.js.map b/dist/commonjs/test.js.map index 00dfd10..842413e 100644 --- a/dist/commonjs/test.js.map +++ b/dist/commonjs/test.js.map @@ -1 +1 @@ -{"version":3,"sources":[],"names":[],"mappings":"","file":"test.js","sourcesContent":[],"sourceRoot":"src/"} \ No newline at end of file +{"version":3,"sources":["../src/test.ts"],"names":[],"mappings":"","file":"test.js","sourcesContent":["\r\n// just to get a few errors\r\n// let x: string = 1;\r\n// import * as child from 'child_process';\r\n\r\n"],"sourceRoot":"src/"} \ No newline at end of file diff --git a/dist/commonjs/worker.d.ts b/dist/commonjs/worker.d.ts index e69de29..cb0ff5c 100644 --- a/dist/commonjs/worker.d.ts +++ b/dist/commonjs/worker.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/dist/commonjs/worker.js.map b/dist/commonjs/worker.js.map index 26e62ce..850dc0e 100644 --- a/dist/commonjs/worker.js.map +++ b/dist/commonjs/worker.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/worker.ts"],"names":[],"mappings":";;AACA,qCAAoC;AACpC,2CAA6D;AAG7D,IAAI,OAAO,GAAG,IAAI,iBAAO,EAAE,CAAC;AAC5B,IAAI,WAAW,GAAG,KAAK,CAAC;AAExB,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,UAAU,GAAmB;IAG/C,WAAW,GAAG,GAAG,CAAC,WAAW,IAAI,KAAK,CAAC;IAEvC,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;QAGf,KAAK,0BAAa,CAAC,WAAW;YAC1B,EAAE,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;gBACd,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACrC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;YACzE,CAAC;YAED,KAAK,CAAC;QAGV,KAAK,0BAAa,CAAC,WAAW;YAC1B,IAAI,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YAEvC,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,IAAI,WAAW,CAAC,CAAC,CAAC;gBAC9B,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YACrD,CAAC;YAED,KAAK,CAAC;IACd,CAAC;AACL,CAAC,CAAC,CAAC","file":"worker.js","sourcesContent":["// typechecker\nimport { Checker } from './checker';\nimport { WorkerCommand, IWorkerOptions } from './interfaces';\n\n// create checker instance\nlet checker = new Checker();\nlet hasCallback = false;\n// listen for messages\nprocess.on('message', function (msg: IWorkerOptions) {\n\n // set if callback is awaited\n hasCallback = msg.hasCallback || false;\n\n switch (msg.type) {\n\n // tell checker to inspect code\n case WorkerCommand.inspectCode:\n if (msg.options) {\n checker.inspectCode(msg.options);\n } else {\n throw new Error('You tried to inspect code without ts/lint options');\n }\n\n break;\n\n // tell checker to print result\n case WorkerCommand.printResult:\n let result = checker.printResult(true);\n\n if (process.send && hasCallback) {\n process.send({ type: 'result', result: result });\n }\n\n break;\n }\n});\n"],"sourceRoot":"src/"} \ No newline at end of file +{"version":3,"sources":["../src/worker.ts"],"names":[],"mappings":";;AACA,qCAAoC;AACpC,2CAA6D;AAG7D,IAAI,OAAO,GAAG,IAAI,iBAAO,EAAE,CAAC;AAC5B,IAAI,WAAW,GAAG,KAAK,CAAC;AAExB,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,UAAU,GAAmB;IAG/C,WAAW,GAAG,GAAG,CAAC,WAAW,IAAI,KAAK,CAAC;IAEvC,QAAQ,GAAG,CAAC,IAAI,EAAE;QAGd,KAAK,0BAAa,CAAC,WAAW;YAC1B,IAAI,GAAG,CAAC,OAAO,EAAE;gBACb,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;aACpC;iBAAM;gBACH,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;aACxE;YAED,MAAM;QAGV,KAAK,0BAAa,CAAC,WAAW;YAC1B,IAAI,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YAEvC,IAAI,OAAO,CAAC,IAAI,IAAI,WAAW,EAAE;gBAC7B,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;aACpD;YAED,MAAM;KACb;AACL,CAAC,CAAC,CAAC","file":"worker.js","sourcesContent":["// typechecker\r\nimport { Checker } from './checker';\r\nimport { WorkerCommand, IWorkerOptions } from './interfaces';\r\n\r\n// create checker instance\r\nlet checker = new Checker();\r\nlet hasCallback = false;\r\n// listen for messages\r\nprocess.on('message', function (msg: IWorkerOptions) {\r\n\r\n // set if callback is awaited\r\n hasCallback = msg.hasCallback || false;\r\n\r\n switch (msg.type) {\r\n\r\n // tell checker to inspect code\r\n case WorkerCommand.inspectCode:\r\n if (msg.options) {\r\n checker.inspectCode(msg.options);\r\n } else {\r\n throw new Error('You tried to inspect code without ts/lint options');\r\n }\r\n\r\n break;\r\n\r\n // tell checker to print result\r\n case WorkerCommand.printResult:\r\n let result = checker.printResult(true);\r\n\r\n if (process.send && hasCallback) {\r\n process.send({ type: 'result', result: result });\r\n }\r\n\r\n break;\r\n }\r\n});\r\n"],"sourceRoot":"src/"} \ No newline at end of file