From e7cd057837bbdea77c6b0beed1dc9c63091c89e8 Mon Sep 17 00:00:00 2001 From: diefbell Date: Wed, 19 Oct 2022 15:03:16 +0100 Subject: [PATCH 1/6] Removed Chalk --- .gitignore | 2 ++ package.json | 50 +++++++++++++++++----------------- src/parser-engine.ts | 26 +++++++++--------- src/test.ts | 3 +++ src/tspath.ts | 14 +++++----- src/utils/color.ts | 64 ++++++++++++++++++++++++++++++++++++++++++++ src/utils/logger.ts | 20 +++++++------- yarn.lock | 17 ++++++++++++ 8 files changed, 142 insertions(+), 54 deletions(-) create mode 100644 src/test.ts create mode 100644 src/utils/color.ts diff --git a/.gitignore b/.gitignore index 6d74258..107ce06 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,8 @@ node_modules node_modules/ test/ +.vscode + # Logs logs *.log diff --git a/package.json b/package.json index 61669ff..fddbbc8 100644 --- a/package.json +++ b/package.json @@ -1,18 +1,18 @@ { - "name": "tspath", - "version": "2.5.4", - "description": "TypeScript path alias resolver, re-writes JS files with relative paths according to @paths specified in tsconfig", - "license": "LGPL-2.1", - "scripts": { - "copy": "copyfiles package.json lib", + "name": "tspath", + "version": "2.5.4", + "description": "TypeScript path alias resolver, re-writes JS files with relative paths according to @paths specified in tsconfig", + "license": "LGPL-2.1", + "scripts": { + "copy": "copyfiles package.json lib", "tspath": "node ./tspath.js" }, - "preferGlobal": true, + "preferGlobal": true, "main": "index.js", - "bin": { + "bin": { "tspath": "./tspath.js" }, - "keywords": [ + "keywords": [ "tspath", "relative", "path", @@ -21,26 +21,28 @@ "resolve", "alias" ], - "author": "Patrik Forsberg ", - "repository": { + "author": "Patrik Forsberg ", + "repository": { "type": "git", - "url": "git+https://github.com/duffman/tspath.git" + "url": "git+https://github.com/duffman/tspath.git" }, "devDependencies": { - "@types/chai": "^4.0.4", + "@types/chai": "^4.0.4", "@types/mocha": "^2.2.42", - "@types/node": "^8.0.25", - "chai": "^4.1.2", - "copyfiles": "^2.4.1", - "mocha": "^3.5.0", - "prettier": "^2.7.1" + "@types/node": "^8.0.25", + "@types/supports-color": "8.1.1", + "chai": "^4.1.2", + "copyfiles": "^2.4.1", + "mocha": "^3.5.0", + "prettier": "^2.7.1" }, - "dependencies": { - "chalk": "^2.3.0", - "escodegen": "^1.8.1", - "esprima": "^4.0.0", + "dependencies": { + "chalk": "^2.3.0", + "escodegen": "^1.8.1", + "esprima": "^4.0.0", "prompt-confirm": "^1.2.0", - "typescript": "^4.4.2", - "yargs": "^11.0.0" + "supports-color": "8.1.1", + "typescript": "^4.4.2", + "yargs": "^11.0.0" } } diff --git a/src/parser-engine.ts b/src/parser-engine.ts index 34b1d03..b8e92b4 100644 --- a/src/parser-engine.ts +++ b/src/parser-engine.ts @@ -22,9 +22,8 @@ =----------------------------------------------------------------= */ -let esprima = require("esprima"); -let escodegen = require("escodegen"); -let chalk = require("chalk"); +const esprima = require("esprima"); +const escodegen = require("escodegen"); import { Const } from "./tspath.const"; import { Logger } from "./utils/logger"; @@ -34,6 +33,7 @@ import { JsonCommentStripper } from "./utils/json-comment-stripper"; import { ProjectOptions } from "./project-options"; import * as fs from "fs"; import * as path from "path"; +import { bold, green, red, underline, yellow } from "./utils/color"; const log = console.log; const testRun = false; @@ -62,7 +62,7 @@ export class ParserEngine { public setProjectPath(projectPath: string): boolean { if (!Utils.isEmpty(projectPath) && !this.validateProjectPath(projectPath)) { - log(chalk.red.bold("Project Path \"" + chalk.underline(projectPath) + "\" is invalid!")); + log(red(bold(("Project Path \"" + underline(projectPath) + "\" is invalid!")))); return false; } @@ -92,7 +92,7 @@ export class ParserEngine { } if (!fs.existsSync(configFile)) { - log("TypeScript Compiler - Configuration file " + chalk.underline(Const.TS_CONFIG) + " is missing!"); + log("TypeScript Compiler - Configuration file " + underline(Const.TS_CONFIG) + " is missing!"); } return result; @@ -122,7 +122,7 @@ export class ParserEngine { console.time(PROCESS_TIME); if (!this.validateProjectPath(this.projectPath)) { - log(chalk.bold.red("Invalid project path!")); + log(bold(red("Invalid project path!"))); this.exit(10); } @@ -130,10 +130,10 @@ export class ParserEngine { let projectName = this.readProjectName(); if (!Utils.isEmpty(projectName)) { - log(chalk.yellow("Parsing project: ") + chalk.bold(projectName) + " " + chalk.underline(this.projectPath)); + log(yellow("Parsing project: ") + bold(projectName) + " " + underline(this.projectPath)); } else { - log(chalk.yellow.bold("Parsing project at: ") + "\"" + this.projectPath + "\""); + log(yellow(bold("Parsing project at: ") + "\"" + this.projectPath + "\"")); } this.distRoot = path.resolve(this.projectPath, this.projectOptions.outDir); @@ -167,11 +167,11 @@ export class ParserEngine { this.processFile(filename); } - log(chalk.bold("Total files processed:"), this.nrFilesProcessed); - log(chalk.bold("Total paths processed:"), this.nrPathsProcessed); + log(bold("Total files processed:"), this.nrFilesProcessed); + log(bold("Total paths processed:"), this.nrPathsProcessed); console.timeEnd(PROCESS_TIME); - log(chalk.bold.green("Project is prepared, now run it normally!")); + log(bold(green("Project is prepared, now run it normally!"))); } private shouldSkipFile(filename: string): boolean { @@ -313,7 +313,7 @@ export class ParserEngine { } } catch (error) { - log(chalk.bold.red("Unable to write file:"), filename); + log(bold(red("Unable to write file:")), filename); this.exit(); } } @@ -360,7 +360,7 @@ export class ParserEngine { for (let key in reqFields) { let field = reqFields[ key ]; if (Utils.isEmpty(field)) { - log(chalk.red.bold("Missing required field:") + " \"" + chalk.bold.underline(key) + "\""); + log(red(bold("Missing required field:")) + " \"" + bold(underline(key)) + "\""); this.exit(22); } } diff --git a/src/test.ts b/src/test.ts new file mode 100644 index 0000000..6109472 --- /dev/null +++ b/src/test.ts @@ -0,0 +1,3 @@ +import { bold, red, underline } from "./utils/color"; + +console.log(`This is some ${red("red")} text and this is ${bold("bold and " + underline("underlined") )} text!`); diff --git a/src/tspath.ts b/src/tspath.ts index 50e6257..e3e0108 100644 --- a/src/tspath.ts +++ b/src/tspath.ts @@ -24,11 +24,11 @@ =----------------------------------------------------------------= */ -let chalk = require("chalk"); -let log = console.log; -let Confirm = require("prompt-confirm"); -let yargs = require("yargs").argv; +const log = console.log; +const Confirm = require("prompt-confirm"); +const yargs = require("yargs").argv; +import { bold, red, yellow } from "./utils/color"; import { ParserEngine } from "./parser-engine"; import { Const } from "./tspath.const"; import { JsonFile } from "./utils/json-file"; @@ -40,7 +40,7 @@ export class TSPath { constructor() { const pkg: any = new JsonFile("package.json"); - log(chalk.yellow(`TSPath v${ Const.VERSION }`)); + log(yellow(`TSPath v${ Const.VERSION }`)); let filter = ["js"]; const force: boolean = yargs.force || yargs.f; const verbose: boolean = yargs.verbose || yargs.v; @@ -56,7 +56,7 @@ export class TSPath { } if (filter.length === 0) { - log(chalk.bold.red("File filter missing!")); + log(bold(red("File filter missing!"))); process.exit(23); } @@ -72,7 +72,7 @@ export class TSPath { } }); } else { - log(chalk.bold("No project root found!")); + log(bold("No project root found!")); } } diff --git a/src/utils/color.ts b/src/utils/color.ts new file mode 100644 index 0000000..206a8ae --- /dev/null +++ b/src/utils/color.ts @@ -0,0 +1,64 @@ +import * as supportsColor from "supports-color"; + +const ESCAPE = "\x1b["; + +const formatters = { + reset: "0m", + bold: "1m", + bold_reset: "22m", + underline: "4m", + underline_reset: "24m" +} + +const colors = { + "default": "39m", + "red": "31m", + "yellow": "33m", + "green": "32m", + "blue": "34m", + "magenta": "35m", + "cyan": "36m", + "red_bright": "91m" +} + +const ac = (str: string) => + supportsColor.stdout + ? ESCAPE + str + : ""; + +const RESET_ALL = ac(formatters.reset); + +// colors +const DEFAULT_COLOR = ac(colors.default); + +const RED = ac(colors.red); +export const red = (str: string) => `${RED}${str}${DEFAULT_COLOR}`; + +const RED_BRIGHT = ac(colors.red_bright); +export const redBright = (str: string) => `${RED_BRIGHT}${str}${DEFAULT_COLOR}`; + +const YELLOW = ac(colors.yellow); +export const yellow = (str: string) => `${YELLOW}${str}${DEFAULT_COLOR}`; + +const GREEN = ac(colors.green); +export const green = (str: string) => `${GREEN}${str}${DEFAULT_COLOR}`; + +const BLUE = ac(colors.blue); +export const blue = (str: string) => `${BLUE}${str}${DEFAULT_COLOR}`; + +const MAGENTA = ac(colors.magenta); +export const magenta = (str: string) => `${MAGENTA}${str}${DEFAULT_COLOR}`; + +const CYAN = ac(colors.cyan); +export const cyan = (str: string) => `${CYAN}${str}${DEFAULT_COLOR}`; + +// formatting +const BOLD = ac(formatters.bold); +const BOLD_RESET = ac(formatters.bold_reset) +export const bold = (str: string) => `${BOLD}${str}${BOLD_RESET}`; + +const UNDERLINE = ac(formatters.underline); +const UNDERLINE_RESET = ac(formatters.underline_reset); +export const underline = (str: string) => `${UNDERLINE}${str}${UNDERLINE_RESET}`; + + diff --git a/src/utils/logger.ts b/src/utils/logger.ts index a543805..b8544b3 100644 --- a/src/utils/logger.ts +++ b/src/utils/logger.ts @@ -1,9 +1,9 @@ +import { blue, bold, cyan, magenta, redBright, yellow } from "./color"; + /** * @author: Patrik Forsberg * @date: 2022-09-28 10:07 */ -import chalk from "chalk"; - const log = console.log; export class Logger { @@ -55,35 +55,35 @@ export class Logger { } public static logRed(logMessage: string, ...logData:any[]): void { - Logger.logBase(chalk.redBright, logMessage, logData); + Logger.logBase(redBright, logMessage, logData); } public static logYellow(logMessage: string, logData: any = ""): void { - log(chalk.yellow(logMessage), logData); + log(yellow(logMessage), logData); } public static logCyan(logMessage: string, logData: any = ""): void { if (logData) { - log(chalk.cyan(logMessage), logData); + log(cyan(logMessage), logData); } else { - log(chalk.cyan(logMessage)); + log(cyan(logMessage)); } } public static logText(logMessage: string, ...logText: string[]): void { let text = logText.join(" :: "); - log(chalk.bold.cyan(logMessage), `:: ${logText}`); + log(bold(cyan(logMessage)), `:: ${logText}`); } public static logBlue(logMessage: string, logData: any = ""): void { - console.log(chalk.blue(logMessage), logData); + console.log(blue(logMessage), logData); } public static logPurple(logMessage: string, logData: any = null): void { if (logData == null) { - log(chalk.magenta(logMessage)); + log(magenta(logMessage)); } else { - log(chalk.magenta(logMessage), logData); + log(magenta(logMessage), logData); } } } diff --git a/yarn.lock b/yarn.lock index eb8cbd4..8614119 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17,6 +17,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.66.tgz#dd035d409df322acc83dff62a602f12a5783bbb3" integrity sha512-tktOkFUA4kXx2hhhrB8bIFb5TbwzS4uOhKEmwiD+NoiL0qtP2OQ9mFldbgD4dV1djrlBYP6eBuQZiWjuHUpqFw== +"@types/supports-color@8.1.1": + version "8.1.1" + resolved "https://registry.yarnpkg.com/@types/supports-color/-/supports-color-8.1.1.tgz#1b44b1b096479273adf7f93c75fc4ecc40a61ee4" + integrity sha512-dPWnWsf+kzIG140B8z2w3fr5D03TLWbOAFQl45xUpI3vcizeXriNR5VYkWZ+WTMsUHqZ9Xlt3hrxGNANFyNQfw== + ansi-bgblack@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/ansi-bgblack/-/ansi-bgblack-0.1.1.tgz#a68ba5007887701b6aafbe3fa0dadfdfa8ee3ca2" @@ -706,6 +711,11 @@ has-flag@^3.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + he@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" @@ -1529,6 +1539,13 @@ supports-color@3.1.2: dependencies: has-flag "^1.0.0" +supports-color@8.1.1: + version "8.1.1" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" + integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== + dependencies: + has-flag "^4.0.0" + supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" From 2494e23a758df1da83fc5be5644d74558d70559f Mon Sep 17 00:00:00 2001 From: diefbell Date: Wed, 19 Oct 2022 22:47:25 +0100 Subject: [PATCH 2/6] Works for mappings outside source directory --- package.json | 5 +- src/parser-engine.ts | 137 +++++++++++++++++++++++-------------------- src/tspath.ts | 8 +-- yarn.lock | 7 ++- 4 files changed, 85 insertions(+), 72 deletions(-) diff --git a/package.json b/package.json index fddbbc8..7b052b2 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "license": "LGPL-2.1", "scripts": { "copy": "copyfiles package.json lib", - "tspath": "node ./tspath.js" + "tspath": "node ./tspath.js", + "watch": "tsc -w" }, "preferGlobal": true, "main": "index.js", @@ -39,7 +40,7 @@ "dependencies": { "chalk": "^2.3.0", "escodegen": "^1.8.1", - "esprima": "^4.0.0", + "esprima-next": "^5.8.4", "prompt-confirm": "^1.2.0", "supports-color": "8.1.1", "typescript": "^4.4.2", diff --git a/src/parser-engine.ts b/src/parser-engine.ts index b8e92b4..81b0cd9 100644 --- a/src/parser-engine.ts +++ b/src/parser-engine.ts @@ -22,18 +22,19 @@ =----------------------------------------------------------------= */ -const esprima = require("esprima"); const escodegen = require("escodegen"); -import { Const } from "./tspath.const"; -import { Logger } from "./utils/logger"; -import { PathUtils } from "./utils/path.utils"; -import { Utils } from "./utils/utils"; -import { JsonCommentStripper } from "./utils/json-comment-stripper"; -import { ProjectOptions } from "./project-options"; -import * as fs from "fs"; -import * as path from "path"; -import { bold, green, red, underline, yellow } from "./utils/color"; +import esprima from "esprima-next"; +import { Const } from "./tspath.const"; +import { Logger } from "./utils/logger"; +import { PathUtils } from "./utils/path.utils"; +import { Utils } from "./utils/utils"; +import { JsonCommentStripper } from "./utils/json-comment-stripper"; +import { ProjectOptions } from "./project-options"; +import * as fs from "fs"; +import * as path from "path"; +import { bold, green, red, underline, yellow } from "./utils/color"; +import type { Node, Program, ArgumentListElement } from "esprima-next"; const log = console.log; const testRun = false; @@ -42,6 +43,7 @@ export class ParserEngine { public projectPath: string; nrFilesProcessed: number = 0; + nrMappedPaths: number = 0; nrPathsProcessed: number = 0; srcRoot: string; basePath: string; @@ -167,8 +169,9 @@ export class ParserEngine { this.processFile(filename); } - log(bold("Total files processed:"), this.nrFilesProcessed); + log(bold("\nTotal files processed:"), this.nrFilesProcessed); log(bold("Total paths processed:"), this.nrPathsProcessed); + log(bold("Total mapped paths resolved:"), this.nrMappedPaths); console.timeEnd(PROCESS_TIME); log(bold(green("Project is prepared, now run it normally!"))); @@ -181,74 +184,73 @@ export class ParserEngine { /** * - * @param sourceFilename - * @param jsRequire - require in javascript source "require("jsRequire") + * @param sourceFilename - source file that the `require` statement was found in + * @param jsRequire - require in javascript source `require("jsRequire")` * @returns {string} */ getRelativePathForRequiredFile(sourceFilename: string, jsRequire: string) { - let options = this.projectOptions; + const options = this.projectOptions; + // absolute path of "baseUrl" specified in tsconfig.json + const baseUrl = path.join(this.projectPath, this.projectOptions.baseUrl); if (Const.DEBUG_MODE) { - console.log("getRelativePathForRequiredFile ::---", sourceFilename); + console.log("\ngetRelativePathForRequiredFile"); + console.log("\tsourceFilename == ", sourceFilename); + console.log("\tjsRequire == ", jsRequire); } - for (let alias in options.pathMappings) { - let mapping = options.pathMappings[ alias ]; + // iterate over all of the "paths" specified in tsconfig.json + for (const aliasRaw in options.pathMappings) { + // get the mapping of this alias + const mappingRaw = options.pathMappings[aliasRaw]; //TODO: Handle * properly - alias = Utils.stripWildcard(alias); - mapping = Utils.stripWildcard(mapping); + const alias = Utils.stripWildcard(aliasRaw); + const mapping = Utils.stripWildcard(mappingRaw); // 2018-06-02: Workaround for bug with same prefix Aliases e.g @db and @dbCore + // 2022-10-19: Workaround for if Unix paths are used on Windows machines (which they usually are) // Cut alias prefix for mapping comparison - let requirePrefix = jsRequire.substring(0, jsRequire.indexOf(path.sep)); - - if (requirePrefix == alias) { - let result = jsRequire.replace(alias, mapping); - Utils.replaceDoubleSlashes(result); + const requirePrefix = jsRequire.substring(0, jsRequire.indexOf(path.sep)) || jsRequire.substring(0, jsRequire.indexOf("/")); - let absoluteJsRequire = path.join(this.basePath, result); + // if no match, go to next alias + // N.B. Please use guard clauses, like this + if (requirePrefix !== alias) continue; - if (!fs.existsSync(`${ absoluteJsRequire }.js`)) { - const newResult = jsRequire.replace(alias, ""); - absoluteJsRequire = path.join(this.basePath, newResult); - } + this.nrMappedPaths++; - let sourceDir = path.dirname(sourceFilename); + // Path to required file relative to baseUrl (from tsconfig.json) + const requireMapped = jsRequire.replace(alias, mapping); + Utils.replaceDoubleSlashes(requireMapped); - if (Const.DEBUG_MODE) { - console.log("sourceDir == ", sourceDir); - console.log("absoluteJsRequire == ", absoluteJsRequire); - console.log("this.distRoot == ", this.distRoot); - console.log("sourceFilename == ", sourceFilename); - } + // let absoluteJsRequire = path.join(this.basePath, requireMapped); - const fromPath = path.dirname(sourceFilename); - const toPath = path.dirname(absoluteJsRequire + ".js"); + // idk what this is for but don't seem to need it rn + // if (!fs.existsSync(`${ absoluteJsRequire }.js`)) { + // const newResult = jsRequire.replace(alias, ""); + // absoluteJsRequire = path.join(this.basePath, newResult); + // } - let relativePath = PathUtils.getRelativePath(fromPath, toPath); + // directory of the source file + const sourceFileDir = path.dirname(sourceFilename); - /* - let relativePath = path.relative(fromPath, toPath); + // path of baseUrl (from tsconfig.json) relative to sourceFileDir + const pathToBase = PathUtils.getRelativePath(sourceFileDir, baseUrl); - if (!relativePath.trim().length) { - relativePath = "."; - } + // final path of required file relative to source file + const relativeJsRequire = path.join(pathToBase, requireMapped); - relativePath = Utils.ensureTrailingPathDelimiter(relativePath); - */ + if (Const.DEBUG_MODE) { + console.log("\tbaseUrl == ", baseUrl); + console.log("\tsourceFileDir == ", sourceFileDir); + console.log("\trequireMapped == ", requireMapped); + console.log("\trelativeJsRequire == ", relativeJsRequire) + // console.log("absoluteJsRequire == ", absoluteJsRequire); + } - // - // If the path does not start with .. it´ not a sub directory - // as in ../ or ..\ so assume it´ the same dir... - // - if (relativePath[ 0 ] !== ".") { - relativePath = "./" + relativePath; - } + jsRequire = relativeJsRequire; - jsRequire = relativePath + path.parse(absoluteJsRequire).base; - break; - } + break; } return jsRequire; @@ -258,19 +260,19 @@ export class ParserEngine { * Processes the filename specified in require("filename") * @param node * @param sourceFilename - * @returns {any} + * @returns */ - processJsRequire(node: any, sourceFilename: string): any { - let resultNode = node; - let requireInJsFile = Utils.safeGetAstNodeValue(node); + processJsRequire(node: ArgumentListElement, sourceFilename: string): ArgumentListElement { + let resultNode: ArgumentListElement = node; + const requireInJsFile = Utils.safeGetAstNodeValue(node); // // Only proceed if the "require" contains a full file path, not // single references like "inversify" // if (!Utils.isEmpty(requireInJsFile) && Utils.fileHavePath(requireInJsFile)) { - let relativePath = this.getRelativePathForRequiredFile(sourceFilename, requireInJsFile); - resultNode = { type: "Literal", value: relativePath, raw: relativePath }; + const relativePath = this.getRelativePathForRequiredFile(sourceFilename, requireInJsFile); + resultNode = { type: esprima.Syntax.Literal, value: relativePath, raw: relativePath }; this.nrPathsProcessed++; } @@ -287,7 +289,7 @@ export class ParserEngine { let scope = this; let inputSourceCode = fs.readFileSync(filename, Const.FILE_ENCODING); - let ast = null; + let ast: Program | null = null; try { ast = esprima.parse(inputSourceCode); //, { raw: true, tokens: true, range: true, comment: true }); @@ -299,7 +301,12 @@ export class ParserEngine { } this.traverseSynTree(ast, this, (node) => { - if (node != undefined && node.type == "CallExpression" && node.callee.name == "require") { + if ( + node != undefined + && node.type == "CallExpression" + && node.callee.type === "Identifier" + && node.callee.name == "require" + ) { node.arguments[ 0 ] = scope.processJsRequire(node.arguments[ 0 ], filename); } }); @@ -374,7 +381,7 @@ export class ParserEngine { * @param scope * @param func */ - private traverseSynTree(ast, scope, func): void { + private traverseSynTree(ast: Node, scope: ParserEngine, func: (a: Node) => void): void { func(ast); for (let key in ast) { if (ast.hasOwnProperty(key)) { diff --git a/src/tspath.ts b/src/tspath.ts index e3e0108..303bae6 100644 --- a/src/tspath.ts +++ b/src/tspath.ts @@ -29,10 +29,10 @@ const Confirm = require("prompt-confirm"); const yargs = require("yargs").argv; import { bold, red, yellow } from "./utils/color"; -import { ParserEngine } from "./parser-engine"; -import { Const } from "./tspath.const"; -import { JsonFile } from "./utils/json-file"; -import { ParentFileFinder } from "./utils/parent-file-finder"; +import { ParserEngine } from "./parser-engine"; +import { Const } from "./tspath.const"; +import { JsonFile } from "./utils/json-file"; +import { ParentFileFinder } from "./utils/parent-file-finder"; export class TSPath { private engine = new ParserEngine(); diff --git a/yarn.lock b/yarn.lock index 8614119..d600a52 100644 --- a/yarn.lock +++ b/yarn.lock @@ -576,7 +576,12 @@ escodegen@^1.8.1: optionalDependencies: source-map "~0.6.1" -esprima@^4.0.0, esprima@^4.0.1: +esprima-next@^5.8.4: + version "5.8.4" + resolved "https://registry.yarnpkg.com/esprima-next/-/esprima-next-5.8.4.tgz#9f82c8093a33da7207a4e8621e997c66878c145a" + integrity sha512-8nYVZ4ioIH4Msjb/XmhnBdz5WRRBaYqevKa1cv9nGJdCehMbzZCPNEEnqfLCZVetUVrUPEcb5IYyu1GG4hFqgg== + +esprima@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== From 7190759b6499d40586629ef56159def4e7e3ac5f Mon Sep 17 00:00:00 2001 From: diefbell Date: Wed, 19 Oct 2022 22:56:00 +0100 Subject: [PATCH 3/6] Added prettier --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 7b052b2..96e28e9 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "scripts": { "copy": "copyfiles package.json lib", "tspath": "node ./tspath.js", - "watch": "tsc -w" + "watch": "tsc -w", + "prettify": "prettier ./lib/**/*.js --write" }, "preferGlobal": true, "main": "index.js", From d9fbba2d6a34d954fc34b7fd44d3f7ecdd649c0b Mon Sep 17 00:00:00 2001 From: diefbell Date: Wed, 19 Oct 2022 23:17:12 +0100 Subject: [PATCH 4/6] Added eslint --- .eslintignore | 2 + .eslintrc.js | 25 ++ package.json | 18 +- src/parser-engine.ts | 3 +- src/tspath.const.ts | 10 +- src/tspath.ts | 4 +- src/utils/utils.ts | 2 +- tsconfig.json | 1 - yarn.lock | 757 ++++++++++++++++++++++++++++++++++++++++++- 9 files changed, 803 insertions(+), 19 deletions(-) create mode 100644 .eslintignore create mode 100644 .eslintrc.js diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..c6b18f2 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +lib/ +.eslintrc.js \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..ed3d6b8 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,25 @@ +/** @type {import("eslint").Linter.Config} */ +module.exports = { + parser: "@typescript-eslint/parser", + parserOptions: { + ecmaFeatures: { + jsx: true + }, + ecmaVersion: 2022, + sourceType: "module", + project: ["./tsconfig.json"] + }, + plugins: [ + "@typescript-eslint", + ], + extends: [ + "plugin:@typescript-eslint/recommended" + ], + rules: { + "prefer-const": "off", + "@typescript-eslint/no-inferrable-types": "warn", + "@typescript-eslint/no-empty-interface": "off", + "@typescript-eslint/no-empty-function": "off", + "@typescript-eslint/no-this-alias": "off" + } +}; diff --git a/package.json b/package.json index 96e28e9..40c57d0 100644 --- a/package.json +++ b/package.json @@ -3,11 +3,21 @@ "version": "2.5.4", "description": "TypeScript path alias resolver, re-writes JS files with relative paths according to @paths specified in tsconfig", "license": "LGPL-2.1", + "files": [ + "lib/", + "package.json", + "LICENSE" + ], "scripts": { "copy": "copyfiles package.json lib", "tspath": "node ./tspath.js", "watch": "tsc -w", - "prettify": "prettier ./lib/**/*.js --write" + "lint": "eslint .", + "prettify": "prettier ./lib/**/*.js --write", + "prebuild": "yarn lint", + "build": "tsc", + "postbuild": "yarn prettify", + "prepack": "yarn build" }, "preferGlobal": true, "main": "index.js", @@ -33,10 +43,14 @@ "@types/mocha": "^2.2.42", "@types/node": "^8.0.25", "@types/supports-color": "8.1.1", + "@typescript-eslint/eslint-plugin": "^5.40.1", + "@typescript-eslint/parser": "^5.40.1", "chai": "^4.1.2", "copyfiles": "^2.4.1", + "eslint": "^8.25.0", "mocha": "^3.5.0", - "prettier": "^2.7.1" + "prettier": "^2.7.1", + "typescript-eslint": "^0.0.1-alpha.0" }, "dependencies": { "chalk": "^2.3.0", diff --git a/src/parser-engine.ts b/src/parser-engine.ts index 81b0cd9..95ab40b 100644 --- a/src/parser-engine.ts +++ b/src/parser-engine.ts @@ -22,7 +22,7 @@ =----------------------------------------------------------------= */ -const escodegen = require("escodegen"); +import * as escodegen from "escodegen"; import esprima from "esprima-next"; import { Const } from "./tspath.const"; @@ -109,6 +109,7 @@ export class ParserEngine { let filename = path.resolve(this.projectPath, "package.json"); if (fs.existsSync(filename)) { + // eslint-disable-next-line @typescript-eslint/no-var-requires let json = require(filename); projectName = json.name; } diff --git a/src/tspath.const.ts b/src/tspath.const.ts index dd18790..c82db4c 100644 --- a/src/tspath.const.ts +++ b/src/tspath.const.ts @@ -1,7 +1,7 @@ -export namespace Const { - export const VERSION = "2.5.4"; - export const FILE_ENCODING = "UTF-8"; - export const TS_CONFIG = "tsconfig.json"; - export const DEBUG_MODE = false; +export const Const = { + VERSION: "2.5.4", + FILE_ENCODING: "UTF-8", + TS_CONFIG: "tsconfig.json", + DEBUG_MODE: false } diff --git a/src/tspath.ts b/src/tspath.ts index 303bae6..db09925 100644 --- a/src/tspath.ts +++ b/src/tspath.ts @@ -25,9 +25,9 @@ =----------------------------------------------------------------= */ const log = console.log; -const Confirm = require("prompt-confirm"); -const yargs = require("yargs").argv; +import * as Confirm from "prompt-confirm"; +import { argv as yargs } from "yargs"; import { bold, red, yellow } from "./utils/color"; import { ParserEngine } from "./parser-engine"; import { Const } from "./tspath.const"; diff --git a/src/utils/utils.ts b/src/utils/utils.ts index e72e6d9..e4feecd 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -22,7 +22,7 @@ =----------------------------------------------------------------= */ -let path = require("path"); +import * as path from "path"; export class Utils { /** diff --git a/tsconfig.json b/tsconfig.json index 6dde59f..0867929 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,7 +13,6 @@ "compactJs": true }, "include": [ - "./", "src/**/*" ], "exclude": [ diff --git a/yarn.lock b/yarn.lock index d600a52..be40f15 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,11 +2,71 @@ # yarn lockfile v1 +"@eslint/eslintrc@^1.3.3": + version "1.3.3" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.3.3.tgz#2b044ab39fdfa75b4688184f9e573ce3c5b0ff95" + integrity sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg== + dependencies: + ajv "^6.12.4" + debug "^4.3.2" + espree "^9.4.0" + globals "^13.15.0" + ignore "^5.2.0" + import-fresh "^3.2.1" + js-yaml "^4.1.0" + minimatch "^3.1.2" + strip-json-comments "^3.1.1" + +"@humanwhocodes/config-array@^0.10.5": + version "0.10.7" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.10.7.tgz#6d53769fd0c222767e6452e8ebda825c22e9f0dc" + integrity sha512-MDl6D6sBsaV452/QSdX+4CXIjZhIcI0PELsxUjk4U828yd58vk3bTIvk/6w5FY+4hIy9sLW0sfrV7K7Kc++j/w== + dependencies: + "@humanwhocodes/object-schema" "^1.2.1" + debug "^4.1.1" + minimatch "^3.0.4" + +"@humanwhocodes/module-importer@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" + integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== + +"@humanwhocodes/object-schema@^1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" + integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== + +"@nodelib/fs.scandir@2.1.5": + version "2.1.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" + integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== + dependencies: + "@nodelib/fs.stat" "2.0.5" + run-parallel "^1.1.9" + +"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" + integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== + +"@nodelib/fs.walk@^1.2.3": + version "1.2.8" + resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" + integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== + dependencies: + "@nodelib/fs.scandir" "2.1.5" + fastq "^1.6.0" + "@types/chai@^4.0.4": version "4.3.3" resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.3.tgz#3c90752792660c4b562ad73b3fbd68bf3bc7ae07" integrity sha512-hC7OMnszpxhZPduX+m+nrx+uFoLkWOMiR4oa/AZF3MuSETYTZmFfJAHqZEM8MVlvfG7BEUcgvtwoCTxBp6hm3g== +"@types/json-schema@^7.0.9": + version "7.0.11" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" + integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== + "@types/mocha@^2.2.42": version "2.2.48" resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.48.tgz#3523b126a0b049482e1c3c11877460f76622ffab" @@ -17,11 +77,118 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.66.tgz#dd035d409df322acc83dff62a602f12a5783bbb3" integrity sha512-tktOkFUA4kXx2hhhrB8bIFb5TbwzS4uOhKEmwiD+NoiL0qtP2OQ9mFldbgD4dV1djrlBYP6eBuQZiWjuHUpqFw== +"@types/semver@^7.3.12": + version "7.3.12" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.12.tgz#920447fdd78d76b19de0438b7f60df3c4a80bf1c" + integrity sha512-WwA1MW0++RfXmCr12xeYOOC5baSC9mSb0ZqCquFzKhcoF4TvHu5MKOuXsncgZcpVFhB1pXd5hZmM0ryAoCp12A== + "@types/supports-color@8.1.1": version "8.1.1" resolved "https://registry.yarnpkg.com/@types/supports-color/-/supports-color-8.1.1.tgz#1b44b1b096479273adf7f93c75fc4ecc40a61ee4" integrity sha512-dPWnWsf+kzIG140B8z2w3fr5D03TLWbOAFQl45xUpI3vcizeXriNR5VYkWZ+WTMsUHqZ9Xlt3hrxGNANFyNQfw== +"@typescript-eslint/eslint-plugin@^5.40.1": + version "5.40.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.40.1.tgz#3203a6ff396b1194083faaa6e5110c401201d7d5" + integrity sha512-FsWboKkWdytGiXT5O1/R9j37YgcjO8MKHSUmWnIEjVaz0krHkplPnYi7mwdb+5+cs0toFNQb0HIrN7zONdIEWg== + dependencies: + "@typescript-eslint/scope-manager" "5.40.1" + "@typescript-eslint/type-utils" "5.40.1" + "@typescript-eslint/utils" "5.40.1" + debug "^4.3.4" + ignore "^5.2.0" + regexpp "^3.2.0" + semver "^7.3.7" + tsutils "^3.21.0" + +"@typescript-eslint/parser@^5.40.1": + version "5.40.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.40.1.tgz#e7f8295dd8154d0d37d661ddd8e2f0ecfdee28dd" + integrity sha512-IK6x55va5w4YvXd4b3VrXQPldV9vQTxi5ov+g4pMANsXPTXOcfjx08CRR1Dfrcc51syPtXHF5bgLlMHYFrvQtg== + dependencies: + "@typescript-eslint/scope-manager" "5.40.1" + "@typescript-eslint/types" "5.40.1" + "@typescript-eslint/typescript-estree" "5.40.1" + debug "^4.3.4" + +"@typescript-eslint/scope-manager@5.40.1": + version "5.40.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.40.1.tgz#a7a5197dfd234622a2421ea590ee0ccc02e18dfe" + integrity sha512-jkn4xsJiUQucI16OLCXrLRXDZ3afKhOIqXs4R3O+M00hdQLKR58WuyXPZZjhKLFCEP2g+TXdBRtLQ33UfAdRUg== + dependencies: + "@typescript-eslint/types" "5.40.1" + "@typescript-eslint/visitor-keys" "5.40.1" + +"@typescript-eslint/type-utils@5.40.1": + version "5.40.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.40.1.tgz#091e4ce3bebbdb68f4980bae9dee2e4e1725f601" + integrity sha512-DLAs+AHQOe6n5LRraXiv27IYPhleF0ldEmx6yBqBgBLaNRKTkffhV1RPsjoJBhVup2zHxfaRtan8/YRBgYhU9Q== + dependencies: + "@typescript-eslint/typescript-estree" "5.40.1" + "@typescript-eslint/utils" "5.40.1" + debug "^4.3.4" + tsutils "^3.21.0" + +"@typescript-eslint/types@5.40.1": + version "5.40.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.40.1.tgz#de37f4f64de731ee454bb2085d71030aa832f749" + integrity sha512-Icg9kiuVJSwdzSQvtdGspOlWNjVDnF3qVIKXdJ103o36yRprdl3Ge5cABQx+csx960nuMF21v8qvO31v9t3OHw== + +"@typescript-eslint/typescript-estree@5.40.1": + version "5.40.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.40.1.tgz#9a7d25492f02c69882ce5e0cd1857b0c55645d72" + integrity sha512-5QTP/nW5+60jBcEPfXy/EZL01qrl9GZtbgDZtDPlfW5zj/zjNrdI2B5zMUHmOsfvOr2cWqwVdWjobCiHcedmQA== + dependencies: + "@typescript-eslint/types" "5.40.1" + "@typescript-eslint/visitor-keys" "5.40.1" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + semver "^7.3.7" + tsutils "^3.21.0" + +"@typescript-eslint/utils@5.40.1": + version "5.40.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.40.1.tgz#3204fb73a559d3b7bab7dc9d3c44487c2734a9ca" + integrity sha512-a2TAVScoX9fjryNrW6BZRnreDUszxqm9eQ9Esv8n5nXApMW0zeANUYlwh/DED04SC/ifuBvXgZpIK5xeJHQ3aw== + dependencies: + "@types/json-schema" "^7.0.9" + "@types/semver" "^7.3.12" + "@typescript-eslint/scope-manager" "5.40.1" + "@typescript-eslint/types" "5.40.1" + "@typescript-eslint/typescript-estree" "5.40.1" + eslint-scope "^5.1.1" + eslint-utils "^3.0.0" + semver "^7.3.7" + +"@typescript-eslint/visitor-keys@5.40.1": + version "5.40.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.1.tgz#f3d2bf5af192f4432b84cec6fdcb387193518754" + integrity sha512-A2DGmeZ+FMja0geX5rww+DpvILpwo1OsiQs0M+joPWJYsiEFBLsH0y1oFymPNul6Z5okSmHpP4ivkc2N0Cgfkw== + dependencies: + "@typescript-eslint/types" "5.40.1" + eslint-visitor-keys "^3.3.0" + +acorn-jsx@^5.3.2: + version "5.3.2" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" + integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== + +acorn@^8.8.0: + version "8.8.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.0.tgz#88c0187620435c7f6015803f5539dae05a9dbea8" + integrity sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w== + +ajv@^6.10.0, ajv@^6.12.4: + version "6.12.6" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" + integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + ansi-bgblack@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/ansi-bgblack/-/ansi-bgblack-0.1.1.tgz#a68ba5007887701b6aafbe3fa0dadfdfa8ee3ca2" @@ -238,7 +405,7 @@ ansi-styles@^3.2.1: dependencies: color-convert "^1.9.0" -ansi-styles@^4.0.0: +ansi-styles@^4.0.0, ansi-styles@^4.1.0: version "4.3.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== @@ -271,6 +438,11 @@ ansi-yellow@^0.1.1: dependencies: ansi-wrap "0.1.0" +argparse@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" + integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== + arr-flatten@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" @@ -283,6 +455,11 @@ arr-swap@^1.0.1: dependencies: is-number "^3.0.0" +array-union@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" + integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== + assertion-error@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b" @@ -301,11 +478,23 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" +braces@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + browser-stdout@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" integrity sha512-7Rfk377tpSM9TWBEeHs0FlDZGoAIei2V/4MdZJoFMBFAK6BqLpxAIUepGRHGdPFgGsLb02PXovC4qddyHvQqTg== +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + camelcase@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" @@ -333,6 +522,14 @@ chalk@^2.3.0: escape-string-regexp "^1.0.5" supports-color "^5.3.0" +chalk@^4.0.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + check-error@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" @@ -472,6 +669,15 @@ cross-spawn@^6.0.0: shebang-command "^1.2.0" which "^1.2.9" +cross-spawn@^7.0.2: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" + integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + debug@2.6.8: version "2.6.8" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc" @@ -493,6 +699,13 @@ debug@^3.0.1: dependencies: ms "^2.1.1" +debug@^4.1.1, debug@^4.3.2, debug@^4.3.4: + version "4.3.4" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== + dependencies: + ms "2.1.2" + decamelize@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -505,7 +718,7 @@ deep-eql@^3.0.1: dependencies: type-detect "^4.0.0" -deep-is@~0.1.3: +deep-is@^0.1.3, deep-is@~0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== @@ -537,6 +750,20 @@ diff@3.2.0: resolved "https://registry.yarnpkg.com/diff/-/diff-3.2.0.tgz#c9ce393a4b7cbd0b058a725c93df299027868ff9" integrity sha512-597ykPFhtJYaXqPq6fF7Vl1fXTKgPdLOntyxpmdzUOKiYGqK7zcnbplj5088+8qJnWdzXhyeau5iVr8HVo9dgg== +dir-glob@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" + integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== + dependencies: + path-type "^4.0.0" + +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" + emoji-regex@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" @@ -564,6 +791,11 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.5: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== +escape-string-regexp@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + escodegen@^1.8.1: version "1.14.3" resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.14.3.tgz#4e7b81fba61581dc97582ed78cab7f0e8d63f503" @@ -576,6 +808,92 @@ escodegen@^1.8.1: optionalDependencies: source-map "~0.6.1" +eslint-scope@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" + integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== + dependencies: + esrecurse "^4.3.0" + estraverse "^4.1.1" + +eslint-scope@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.1.1.tgz#fff34894c2f65e5226d3041ac480b4513a163642" + integrity sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw== + dependencies: + esrecurse "^4.3.0" + estraverse "^5.2.0" + +eslint-utils@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-3.0.0.tgz#8aebaface7345bb33559db0a1f13a1d2d48c3672" + integrity sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA== + dependencies: + eslint-visitor-keys "^2.0.0" + +eslint-visitor-keys@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" + integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== + +eslint-visitor-keys@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826" + integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== + +eslint@^8.25.0: + version "8.25.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.25.0.tgz#00eb962f50962165d0c4ee3327708315eaa8058b" + integrity sha512-DVlJOZ4Pn50zcKW5bYH7GQK/9MsoQG2d5eDH0ebEkE8PbgzTTmtt/VTH9GGJ4BfeZCpBLqFfvsjX35UacUL83A== + dependencies: + "@eslint/eslintrc" "^1.3.3" + "@humanwhocodes/config-array" "^0.10.5" + "@humanwhocodes/module-importer" "^1.0.1" + ajv "^6.10.0" + chalk "^4.0.0" + cross-spawn "^7.0.2" + debug "^4.3.2" + doctrine "^3.0.0" + escape-string-regexp "^4.0.0" + eslint-scope "^7.1.1" + eslint-utils "^3.0.0" + eslint-visitor-keys "^3.3.0" + espree "^9.4.0" + esquery "^1.4.0" + esutils "^2.0.2" + fast-deep-equal "^3.1.3" + file-entry-cache "^6.0.1" + find-up "^5.0.0" + glob-parent "^6.0.1" + globals "^13.15.0" + globby "^11.1.0" + grapheme-splitter "^1.0.4" + ignore "^5.2.0" + import-fresh "^3.0.0" + imurmurhash "^0.1.4" + is-glob "^4.0.0" + js-sdsl "^4.1.4" + js-yaml "^4.1.0" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.4.1" + lodash.merge "^4.6.2" + minimatch "^3.1.2" + natural-compare "^1.4.0" + optionator "^0.9.1" + regexpp "^3.2.0" + strip-ansi "^6.0.1" + strip-json-comments "^3.1.0" + text-table "^0.2.0" + +espree@^9.4.0: + version "9.4.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.4.0.tgz#cd4bc3d6e9336c433265fc0aa016fc1aaf182f8a" + integrity sha512-DQmnRpLj7f6TgN/NYb0MTzJXL+vJF9h3pHy4JhCIs3zwcgez8xmGg3sXHcEO97BrmO2OSvCwMdfdlyl+E9KjOw== + dependencies: + acorn "^8.8.0" + acorn-jsx "^5.3.2" + eslint-visitor-keys "^3.3.0" + esprima-next@^5.8.4: version "5.8.4" resolved "https://registry.yarnpkg.com/esprima-next/-/esprima-next-5.8.4.tgz#9f82c8093a33da7207a4e8621e997c66878c145a" @@ -586,11 +904,30 @@ esprima@^4.0.1: resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -estraverse@^4.2.0: +esquery@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5" + integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== + dependencies: + estraverse "^5.1.0" + +esrecurse@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" + integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== + dependencies: + estraverse "^5.2.0" + +estraverse@^4.1.1, estraverse@^4.2.0: version "4.3.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== +estraverse@^5.1.0, estraverse@^5.2.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" + integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== + esutils@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" @@ -616,11 +953,53 @@ extend-shallow@^2.0.1: dependencies: is-extendable "^0.1.0" -fast-levenshtein@~2.0.6: +fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== + +fast-glob@^3.2.9: + version "3.2.12" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80" + integrity sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.2" + merge2 "^1.3.0" + micromatch "^4.0.4" + +fast-json-stable-stringify@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== + +fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== +fastq@^1.6.0: + version "1.13.0" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.13.0.tgz#616760f88a7526bdfc596b7cab8c18938c36b98c" + integrity sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw== + dependencies: + reusify "^1.0.4" + +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== + dependencies: + flat-cache "^3.0.4" + +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + find-up@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" @@ -628,6 +1007,27 @@ find-up@^2.1.0: dependencies: locate-path "^2.0.0" +find-up@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + +flat-cache@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" + integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== + dependencies: + flatted "^3.1.0" + rimraf "^3.0.2" + +flatted@^3.1.0: + version "3.2.7" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787" + integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ== + for-in@^0.1.3: version "0.1.8" resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.8.tgz#d8773908e31256109952b1fdb9b3fa867d2775e1" @@ -672,6 +1072,20 @@ get-stream@^4.0.0: dependencies: pump "^3.0.0" +glob-parent@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" + integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== + dependencies: + is-glob "^4.0.1" + +glob-parent@^6.0.1: + version "6.0.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" + integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== + dependencies: + is-glob "^4.0.3" + glob@7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" @@ -684,7 +1098,7 @@ glob@7.1.1: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.0.5: +glob@^7.0.5, glob@^7.1.3: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== @@ -696,11 +1110,35 @@ glob@^7.0.5: once "^1.3.0" path-is-absolute "^1.0.0" +globals@^13.15.0: + version "13.17.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.17.0.tgz#902eb1e680a41da93945adbdcb5a9f361ba69bd4" + integrity sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw== + dependencies: + type-fest "^0.20.2" + +globby@^11.1.0: + version "11.1.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" + integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== + dependencies: + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.2.9" + ignore "^5.2.0" + merge2 "^1.4.1" + slash "^3.0.0" + "graceful-readlink@>= 1.0.0": version "1.0.1" resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" integrity sha512-8tLu60LgxF6XpdbK8OW3FA+IfTNBn1ZHGHKF4KQbEeSkajYw5PlYJcKluntgegDPTg8UkHjpet1T82vk6TQ68w== +grapheme-splitter@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz#9cf3a665c6247479896834af35cf1dbb4400767e" + integrity sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ== + growl@1.9.2: version "1.9.2" resolved "https://registry.yarnpkg.com/growl/-/growl-1.9.2.tgz#0ea7743715db8d8de2c5ede1775e1b45ac85c02f" @@ -726,6 +1164,24 @@ he@1.1.1: resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" integrity sha512-z/GDPjlRMNOa2XJiB4em8wJpuuBfrFOlYKTZxtpkdr1uPdibHI8rYA3MY0KDObpVyaes0e/aunid/t88ZI2EKA== +ignore@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a" + integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ== + +import-fresh@^3.0.0, import-fresh@^3.2.1: + version "3.3.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" + integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== + inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" @@ -805,6 +1261,11 @@ is-extendable@^0.1.0, is-extendable@^0.1.1: resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" integrity sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw== +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== + is-fullwidth-code-point@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" @@ -822,6 +1283,13 @@ is-fullwidth-code-point@^3.0.0: resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== +is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== + dependencies: + is-extglob "^2.1.1" + is-number@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" @@ -834,6 +1302,11 @@ is-number@^6.0.0: resolved "https://registry.yarnpkg.com/is-number/-/is-number-6.0.0.tgz#e6d15ad31fc262887cccf217ae5f9316f81b1995" integrity sha512-Wu1VHeILBK8KAWJUAiSZQX94GmOE45Rg6/538fKwiloUu21KncEkYGPqob2oSZ5mUT73vLGrHQjKw3KMPwfDzg== +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + is-plain-object@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" @@ -871,6 +1344,28 @@ isobject@^3.0.0, isobject@^3.0.1: resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" integrity sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg== +js-sdsl@^4.1.4: + version "4.1.5" + resolved "https://registry.yarnpkg.com/js-sdsl/-/js-sdsl-4.1.5.tgz#1ff1645e6b4d1b028cd3f862db88c9d887f26e2a" + integrity sha512-08bOAKweV2NUC1wqTtf3qZlnpOX/R2DU9ikpjOHs0H+ibQv3zpncVQg6um4uYtRtrwIX8M4Nh3ytK4HGlYAq7Q== + +js-yaml@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" + integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== + dependencies: + argparse "^2.0.1" + +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== + json3@3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1" @@ -912,6 +1407,14 @@ lcid@^2.0.0: dependencies: invert-kv "^2.0.0" +levn@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" + integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== + dependencies: + prelude-ls "^1.2.1" + type-check "~0.4.0" + levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" @@ -928,6 +1431,13 @@ locate-path@^2.0.0: p-locate "^2.0.0" path-exists "^3.0.0" +locate-path@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== + dependencies: + p-locate "^5.0.0" + lodash._baseassign@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz#8c38a099500f215ad09e59f1722fd0c52bfe0a4e" @@ -984,6 +1494,11 @@ lodash.keys@^3.0.0: lodash.isarguments "^3.0.0" lodash.isarray "^3.0.0" +lodash.merge@^4.6.2: + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== + log-ok@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/log-ok/-/log-ok-0.1.1.tgz#bea3dd36acd0b8a7240d78736b5b97c65444a334" @@ -1012,6 +1527,13 @@ loupe@^2.3.1: dependencies: get-func-name "^2.0.0" +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + dependencies: + yallist "^4.0.0" + map-age-cleaner@^0.1.1: version "0.1.3" resolved "https://registry.yarnpkg.com/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz#7d583a7306434c055fe474b0f45078e6e1b4b92a" @@ -1035,12 +1557,25 @@ mem@^4.0.0: mimic-fn "^2.0.0" p-is-promise "^2.0.0" +merge2@^1.3.0, merge2@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" + integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== + +micromatch@^4.0.4: + version "4.0.5" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" + integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== + dependencies: + braces "^3.0.2" + picomatch "^2.3.1" + mimic-fn@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== -minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.1.1: +minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== @@ -1095,6 +1630,11 @@ ms@2.0.0: resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A== +ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + ms@^2.1.1: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" @@ -1105,6 +1645,11 @@ mute-stream@0.0.7: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" integrity sha512-r65nCZhrbXXb6dXOACihYApHw2Q6pV0M3V0PSxd74N0+D8nzAdEAITq2oAjA1jVnKI+tGvEBUpqiMh0+rW6zDQ== +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== + nice-try@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" @@ -1165,6 +1710,18 @@ optionator@^0.8.1: type-check "~0.3.2" word-wrap "~1.2.3" +optionator@^0.9.1: + version "0.9.1" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499" + integrity sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw== + dependencies: + deep-is "^0.1.3" + fast-levenshtein "^2.0.6" + levn "^0.4.1" + prelude-ls "^1.2.1" + type-check "^0.4.0" + word-wrap "^1.2.3" + os-locale@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-3.1.0.tgz#a802a6ee17f24c10483ab9935719cef4ed16bf1a" @@ -1196,6 +1753,13 @@ p-limit@^1.1.0: dependencies: p-try "^1.0.0" +p-limit@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== + dependencies: + yocto-queue "^0.1.0" + p-locate@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" @@ -1203,16 +1767,35 @@ p-locate@^2.0.0: dependencies: p-limit "^1.1.0" +p-locate@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" + p-try@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" integrity sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww== +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + path-exists@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" integrity sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ== +path-exists@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== + path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" @@ -1223,16 +1806,36 @@ path-key@^2.0.0, path-key@^2.0.1: resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" integrity sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw== +path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + +path-type@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" + integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== + pathval@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.1.tgz#8534e77a77ce7ac5a2512ea21e0fdb8fcf6c3d8d" integrity sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ== +picomatch@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== + pointer-symbol@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/pointer-symbol/-/pointer-symbol-1.0.0.tgz#60f9110204ea7a929b62644a21315543cbb3d447" integrity sha512-pozTTFO3kG9HQWXCSTJkCgq4fBF8lUQf+5bLddTEW6v4zdjQhcBVfLmKzABEMJMA7s8jhzi0sgANIwdrf4kq+A== +prelude-ls@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" + integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== + prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" @@ -1321,6 +1924,16 @@ pump@^3.0.0: end-of-stream "^1.1.0" once "^1.3.1" +punycode@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== + +queue-microtask@^1.2.2: + version "1.2.3" + resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" + integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== + radio-symbol@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/radio-symbol/-/radio-symbol-2.0.0.tgz#7aa9bfc50485636d52dd76d6a8e631b290799ae1" @@ -1378,6 +1991,11 @@ readline-utils@^2.2.1, readline-utils@^2.2.3: strip-color "^0.1.0" window-size "^1.1.0" +regexpp@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" + integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== + require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" @@ -1388,6 +2006,30 @@ require-main-filename@^1.0.1: resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" integrity sha512-IqSUtOVP4ksd1C/ej5zeEh/BIP2ajqpn8c5x+q99gvcIG/Qf0cud5raVnE/Dwd0ua9TXYDoDc0RE5hBSdz22Ug== +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + +reusify@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" + integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== + +rimraf@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== + dependencies: + glob "^7.1.3" + +run-parallel@^1.1.9: + version "1.2.0" + resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" + integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== + dependencies: + queue-microtask "^1.2.2" + safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" @@ -1398,6 +2040,13 @@ semver@^5.5.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== +semver@^7.3.7: + version "7.3.8" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798" + integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A== + dependencies: + lru-cache "^6.0.0" + set-blocking@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" @@ -1440,16 +2089,33 @@ shebang-command@^1.2.0: dependencies: shebang-regex "^1.0.0" +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + shebang-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" integrity sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ== +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + signal-exit@^3.0.0: version "3.0.7" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== +slash@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== + source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" @@ -1532,6 +2198,11 @@ strip-eof@^1.0.0: resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" integrity sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q== +strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== + success-symbol@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/success-symbol/-/success-symbol-0.1.0.tgz#24022e486f3bf1cdca094283b769c472d3b72897" @@ -1558,6 +2229,13 @@ supports-color@^5.3.0: dependencies: has-flag "^3.0.0" +supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + terminal-paginator@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/terminal-paginator/-/terminal-paginator-2.0.2.tgz#967e66056f28fe8f55ba7c1eebfb7c3ef371c1d3" @@ -1567,6 +2245,11 @@ terminal-paginator@^2.0.2: extend-shallow "^2.0.1" log-utils "^0.2.1" +text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== + through2@^2.0.1: version "2.0.5" resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" @@ -1587,6 +2270,13 @@ to-object-path@^0.3.0: dependencies: kind-of "^3.0.2" +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + toggle-array@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/toggle-array/-/toggle-array-1.0.1.tgz#cbf5840792bd5097f33117ae824c932affe87d58" @@ -1594,6 +2284,25 @@ toggle-array@^1.0.1: dependencies: isobject "^3.0.0" +tslib@^1.8.1: + version "1.14.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" + integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== + +tsutils@^3.21.0: + version "3.21.0" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" + integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== + dependencies: + tslib "^1.8.1" + +type-check@^0.4.0, type-check@~0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" + integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== + dependencies: + prelude-ls "^1.2.1" + type-check@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" @@ -1606,6 +2315,16 @@ type-detect@^4.0.0, type-detect@^4.0.5: resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== +type-fest@^0.20.2: + version "0.20.2" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" + integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== + +typescript-eslint@^0.0.1-alpha.0: + version "0.0.1-alpha.0" + resolved "https://registry.yarnpkg.com/typescript-eslint/-/typescript-eslint-0.0.1-alpha.0.tgz#285d68a4e96588295cd436278801bcb6a6b916c1" + integrity sha512-1hNKM37dAWML/2ltRXupOq2uqcdRQyDFphl+341NTPXFLLLiDhErXx8VtaSLh3xP7SyHZdcCgpt9boYYVb3fQg== + typescript@^4.4.2: version "4.8.4" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6" @@ -1616,6 +2335,13 @@ untildify@^4.0.0: resolved "https://registry.yarnpkg.com/untildify/-/untildify-4.0.0.tgz#2bc947b953652487e4600949fb091e3ae8cd919b" integrity sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw== +uri-js@^4.2.2: + version "4.4.1" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" + integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== + dependencies: + punycode "^2.1.0" + util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" @@ -1638,6 +2364,13 @@ which@^1.2.9: dependencies: isexe "^2.0.0" +which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + window-size@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/window-size/-/window-size-1.1.1.tgz#9858586580ada78ab26ecd6978a6e03115c1af20" @@ -1646,7 +2379,7 @@ window-size@^1.1.0: define-property "^1.0.0" is-number "^3.0.0" -word-wrap@~1.2.3: +word-wrap@^1.2.3, word-wrap@~1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== @@ -1688,6 +2421,11 @@ y18n@^5.0.5: resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== +yallist@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== + yargs-parser@^20.2.2: version "20.2.9" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" @@ -1730,3 +2468,8 @@ yargs@^16.1.0: string-width "^4.2.0" y18n "^5.0.5" yargs-parser "^20.2.2" + +yocto-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== From b9a8e70363f7c4fd18ba9ce3b0f4258f1b474dc5 Mon Sep 17 00:00:00 2001 From: diefbell Date: Wed, 19 Oct 2022 23:20:10 +0100 Subject: [PATCH 5/6] Added Husky precommit hook for linting --- .husky/pre-commit | 4 ++++ package.json | 2 ++ yarn.lock | 5 +++++ 3 files changed, 11 insertions(+) create mode 100644 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..65981a5 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +yarn lint --max-warnings=0 diff --git a/package.json b/package.json index 40c57d0..0b88ffe 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "tspath": "node ./tspath.js", "watch": "tsc -w", "lint": "eslint .", + "prepare": "husky install", "prettify": "prettier ./lib/**/*.js --write", "prebuild": "yarn lint", "build": "tsc", @@ -48,6 +49,7 @@ "chai": "^4.1.2", "copyfiles": "^2.4.1", "eslint": "^8.25.0", + "husky": "^8.0.1", "mocha": "^3.5.0", "prettier": "^2.7.1", "typescript-eslint": "^0.0.1-alpha.0" diff --git a/yarn.lock b/yarn.lock index be40f15..4bdb74f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1164,6 +1164,11 @@ he@1.1.1: resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" integrity sha512-z/GDPjlRMNOa2XJiB4em8wJpuuBfrFOlYKTZxtpkdr1uPdibHI8rYA3MY0KDObpVyaes0e/aunid/t88ZI2EKA== +husky@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/husky/-/husky-8.0.1.tgz#511cb3e57de3e3190514ae49ed50f6bc3f50b3e9" + integrity sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw== + ignore@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a" From a91f8fa70736282395024ede5c11519dd0e75aa6 Mon Sep 17 00:00:00 2001 From: diefbell Date: Wed, 19 Oct 2022 23:49:32 +0100 Subject: [PATCH 6/6] Fixed typescript-eslint errors --- .eslintrc.js | 2 +- package.json | 1 + src/parser-engine.ts | 70 +++++++++++++++--------------- src/tspath.ts | 15 +++---- src/types/package.type.ts | 13 +++--- src/types/tsconfig.type.ts | 3 +- src/utils/color.ts | 2 +- src/utils/json-comment-stripper.ts | 14 +++--- src/utils/json-file.ts | 6 +-- src/utils/logger.ts | 26 +++++------ src/utils/parent-file-finder.ts | 7 ++- src/utils/utils.ts | 11 ++--- 12 files changed, 88 insertions(+), 82 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index ed3d6b8..8ca8716 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -16,7 +16,7 @@ module.exports = { "plugin:@typescript-eslint/recommended" ], rules: { - "prefer-const": "off", + "prefer-const": "warn", "@typescript-eslint/no-inferrable-types": "warn", "@typescript-eslint/no-empty-interface": "off", "@typescript-eslint/no-empty-function": "off", diff --git a/package.json b/package.json index 0b88ffe..d920670 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "tspath": "node ./tspath.js", "watch": "tsc -w", "lint": "eslint .", + "lint:fix": "eslint . --fix", "prepare": "husky install", "prettify": "prettier ./lib/**/*.js --write", "prebuild": "yarn lint", diff --git a/src/parser-engine.ts b/src/parser-engine.ts index 95ab40b..d9dfeff 100644 --- a/src/parser-engine.ts +++ b/src/parser-engine.ts @@ -33,8 +33,9 @@ import { JsonCommentStripper } from "./utils/json-comment-stripper"; import { ProjectOptions } from "./project-options"; import * as fs from "fs"; import * as path from "path"; -import { bold, green, red, underline, yellow } from "./utils/color"; -import type { Node, Program, ArgumentListElement } from "esprima-next"; +import type { TsconfigType } from "types/tsconfig.type"; +import { bold, green, red, underline, yellow } from "./utils/color"; +import type { Node, Program, ArgumentListElement, Literal } from "esprima-next"; const log = console.log; const testRun = false; @@ -42,21 +43,21 @@ const testRun = false; export class ParserEngine { public projectPath: string; - nrFilesProcessed: number = 0; - nrMappedPaths: number = 0; - nrPathsProcessed: number = 0; + nrFilesProcessed = 0; + nrMappedPaths = 0; + nrPathsProcessed = 0; srcRoot: string; basePath: string; distRoot: string; - compactMode: boolean = true; + compactMode = true; projectOptions: ProjectOptions; - tsConfig: any; + tsConfig: TsconfigType; fileFilter: Array; constructor() { } - public exit(code: number = 5) { + public exit(code = 5) { console.log("Terminating..."); process.exit(code); } @@ -106,11 +107,11 @@ export class ParserEngine { */ private readProjectName(): string { let projectName: string = null; - let filename = path.resolve(this.projectPath, "package.json"); + const filename = path.resolve(this.projectPath, "package.json"); if (fs.existsSync(filename)) { // eslint-disable-next-line @typescript-eslint/no-var-requires - let json = require(filename); + const json = require(filename); projectName = json.name; } @@ -130,7 +131,7 @@ export class ParserEngine { } this.projectOptions = this.readConfig(); - let projectName = this.readProjectName(); + const projectName = this.readProjectName(); if (!Utils.isEmpty(projectName)) { log(yellow("Parsing project: ") + bold(projectName) + " " + underline(this.projectPath)); @@ -142,7 +143,7 @@ export class ParserEngine { this.distRoot = path.resolve(this.projectPath, this.projectOptions.outDir); this.basePath = this.distRoot; - let tmpPath = path.resolve(this.distRoot, this.projectOptions.baseUrl); + const tmpPath = path.resolve(this.distRoot, this.projectOptions.baseUrl); // // If the baseUrl exist in the dist folder, the TS Compiler have re-used the src structure @@ -161,12 +162,12 @@ export class ParserEngine { console.log("Src path ::", this.srcRoot); } - let fileList = new Array(); + const fileList = new Array(); this.walkSync(this.distRoot, fileList, ".js"); for (let i = 0; i < fileList.length; i++) { - let filename = fileList[ i ]; + const filename = fileList[ i ]; this.processFile(filename); } @@ -220,9 +221,10 @@ export class ParserEngine { this.nrMappedPaths++; - // Path to required file relative to baseUrl (from tsconfig.json) - const requireMapped = jsRequire.replace(alias, mapping); - Utils.replaceDoubleSlashes(requireMapped); + const requireMapped = Utils.replaceDoubleSlashes( + // Path to required file relative to baseUrl (from tsconfig.json) + jsRequire.replace(alias, mapping) + ); // let absoluteJsRequire = path.join(this.basePath, requireMapped); @@ -265,7 +267,7 @@ export class ParserEngine { */ processJsRequire(node: ArgumentListElement, sourceFilename: string): ArgumentListElement { let resultNode: ArgumentListElement = node; - const requireInJsFile = Utils.safeGetAstNodeValue(node); + const requireInJsFile = Utils.safeGetAstNodeValue(node as Literal); // // Only proceed if the "require" contains a full file path, not @@ -288,8 +290,8 @@ export class ParserEngine { processFile(filename: string) { this.nrFilesProcessed++; - let scope = this; - let inputSourceCode = fs.readFileSync(filename, Const.FILE_ENCODING); + const scope = this; + const inputSourceCode = fs.readFileSync(filename, Const.FILE_ENCODING); let ast: Program | null = null; try { @@ -312,8 +314,8 @@ export class ParserEngine { } }); - let option = { comment: true, format: { compact: this.compactMode, quotes: "\"" } }; - let finalSource = escodegen.generate(ast, option); + const option = { comment: true, format: { compact: this.compactMode, quotes: "\"" } }; + const finalSource = escodegen.generate(ast, option); try { if (!testRun) { @@ -349,7 +351,7 @@ export class ParserEngine { fileName = path.resolve(this.projectPath, fileName); let fileData = fs.readFileSync(fileName, Const.FILE_ENCODING); - let jsonCS = new JsonCommentStripper(); + const jsonCS = new JsonCommentStripper(); fileData = jsonCS.stripComments(fileData); try { @@ -359,14 +361,14 @@ export class ParserEngine { Logger.error(`JSON parser failed for file "${fileName}"`); } - let compilerOpt = this.tsConfig.compilerOptions; + const compilerOpt = this.tsConfig.compilerOptions; - let reqFields = []; + const reqFields = []; reqFields[ "baseUrl" ] = compilerOpt.baseUrl; reqFields[ "outDir" ] = compilerOpt.outDir; - for (let key in reqFields) { - let field = reqFields[ key ]; + for (const key in reqFields) { + const field = reqFields[ key ]; if (Utils.isEmpty(field)) { log(red(bold("Missing required field:")) + " \"" + bold(underline(key)) + "\""); this.exit(22); @@ -384,9 +386,9 @@ export class ParserEngine { */ private traverseSynTree(ast: Node, scope: ParserEngine, func: (a: Node) => void): void { func(ast); - for (let key in ast) { + for (const key in ast) { if (ast.hasOwnProperty(key)) { - let child = ast[ key ]; + const child = ast[ key ]; if (typeof child === "object" && child !== null) { if (Array.isArray(child)) { @@ -422,20 +424,20 @@ export class ParserEngine { * @returns {Array} */ public walkSync(dir: string, filelist: Array, fileExtension?: string) { - let scope = this; - let files = fs.readdirSync(dir); + const scope = this; + const files = fs.readdirSync(dir); filelist = filelist || []; fileExtension = fileExtension === undefined ? "" : fileExtension; - for (let file of files) { + for (const file of files) { if (fs.statSync(path.join(dir, file)).isDirectory()) { filelist = this.walkSync(path.join(dir, file), filelist, fileExtension); } else { - let tmpExt = path.extname(file); + const tmpExt = path.extname(file); if (scope.matchExtension(tmpExt)) { - let fullFilename = path.join(dir, file); + const fullFilename = path.join(dir, file); filelist.push(fullFilename); } } diff --git a/src/tspath.ts b/src/tspath.ts index db09925..ce56731 100644 --- a/src/tspath.ts +++ b/src/tspath.ts @@ -31,25 +31,24 @@ import { argv as yargs } from "yargs"; import { bold, red, yellow } from "./utils/color"; import { ParserEngine } from "./parser-engine"; import { Const } from "./tspath.const"; -import { JsonFile } from "./utils/json-file"; import { ParentFileFinder } from "./utils/parent-file-finder"; export class TSPath { private engine = new ParserEngine(); constructor() { - const pkg: any = new JsonFile("package.json"); + // const pkg: any = new JsonFile("package.json"); log(yellow(`TSPath v${ Const.VERSION }`)); let filter = ["js"]; const force: boolean = yargs.force || yargs.f; - const verbose: boolean = yargs.verbose || yargs.v; - let projectPath = process.cwd(); - let compactOutput = !yargs.preserve; - let findResult = ParentFileFinder.findFile(projectPath, Const.TS_CONFIG); + // const verbose: boolean = yargs.verbose || yargs.v; + const projectPath = process.cwd(); + const compactOutput = !yargs.preserve; + const findResult = ParentFileFinder.findFile(projectPath, Const.TS_CONFIG); if (yargs.ext || yargs.filter) { - let argFilter = yargs.ext ? yargs.ext : yargs.filter; + const argFilter = yargs.ext ? yargs.ext : yargs.filter; filter = argFilter.split(",").map((ext) => { return ext.replace(/\s/g, ""); }); @@ -66,7 +65,7 @@ export class TSPath { if (force && findResult.fileFound) { this.processPath(findResult.path); } else if (findResult.fileFound) { - let confirm = new Confirm("Process project at: <" + findResult.path + "> ?").ask(answer => { + new Confirm("Process project at: <" + findResult.path + "> ?").ask((answer: boolean) => { if (answer) { this.processPath(findResult.path); } diff --git a/src/types/package.type.ts b/src/types/package.type.ts index 810d5e2..f776d42 100644 --- a/src/types/package.type.ts +++ b/src/types/package.type.ts @@ -10,12 +10,15 @@ export interface PackageType extends IJsonFile { version?: string; description?: string; license?: string; - scripts?: any; + scripts?: Record; preferGlobal?: boolean; - bin?: any; + bin?: Record; keywords?: string[]; author?: string; - repository?: any; - dependencies?: any; - devDependencies?: any; + repository?: { + type: string, + url: string + }; + dependencies?: Record; + devDependencies?: Record; } diff --git a/src/types/tsconfig.type.ts b/src/types/tsconfig.type.ts index 8f83efe..f518194 100644 --- a/src/types/tsconfig.type.ts +++ b/src/types/tsconfig.type.ts @@ -3,8 +3,9 @@ * @date: 2022-10-06 19:18 */ +import { ITSConfig } from "tspath.types"; import { IJsonFile } from "../utils/json-file"; export interface TsconfigType extends IJsonFile { - + compilerOptions: ITSConfig } diff --git a/src/utils/color.ts b/src/utils/color.ts index 206a8ae..93d27e2 100644 --- a/src/utils/color.ts +++ b/src/utils/color.ts @@ -26,7 +26,7 @@ const ac = (str: string) => ? ESCAPE + str : ""; -const RESET_ALL = ac(formatters.reset); +// const RESET_ALL = ac(formatters.reset); // colors const DEFAULT_COLOR = ac(colors.default); diff --git a/src/utils/json-comment-stripper.ts b/src/utils/json-comment-stripper.ts index e8eaa77..e224e8a 100644 --- a/src/utils/json-comment-stripper.ts +++ b/src/utils/json-comment-stripper.ts @@ -80,29 +80,29 @@ export class JsonCommentStripper { } parse(data: string): string { - let lineNum = 1; - let linePos = 1; + // let lineNum = 1; + // let linePos = 1; - let prevChar = ""; + // let prevChar = ""; let currChar = ""; let aheadChar = ""; let chunk = ""; for (let i = 0; i < data.length; i++) { - prevChar = currChar; + // prevChar = currChar; currChar = data[i]; aheadChar = data[i + 1]; - linePos++; + // linePos++; if (currChar == "\n") { if (this.inState(JsonParserState.InLineComment)) { this.setState(JsonParserState.None); } - linePos = 1; - lineNum++; + // linePos = 1; + // lineNum++; } // Allow block comments everywhere except in quotes diff --git a/src/utils/json-file.ts b/src/utils/json-file.ts index 92ea264..e758fb4 100644 --- a/src/utils/json-file.ts +++ b/src/utils/json-file.ts @@ -30,11 +30,11 @@ import { Const } from "../tspath.const"; import { Logger } from "./logger"; export interface IJsonFile { - rawData: any; + rawData: unknown; } export class JsonFile implements IJsonFile { - public rawData: any; + public rawData: unknown; constructor(filename: string) { try { @@ -52,7 +52,7 @@ export class JsonFile implements IJsonFile { * @param defVal * @returns {any} */ - public getProp(name: string, defVal?: any): any { + public getProp(name: string, defVal?: T): T { try { return this.rawData[name] as T; } catch (e) { diff --git a/src/utils/logger.ts b/src/utils/logger.ts index b8544b3..540a93d 100644 --- a/src/utils/logger.ts +++ b/src/utils/logger.ts @@ -7,15 +7,15 @@ import { blue, bold, cyan, magenta, redBright, yellow } from "./color"; const log = console.log; export class Logger { - public static log(...data: any[]): void { + public static log(...data: unknown[]): void { log(data); } - public static error(...data: any[]): void { + public static error(...data: unknown[]): void { console.error(data); } - public static logException(label: string, e?: Error | any): void { + public static logException(label: string, e?: Error | string | unknown): void { Logger.spit(2); if (e instanceof Error) { @@ -25,7 +25,7 @@ export class Logger { } } - public static pretty(doLog: boolean, label: string, obj: any): void { + public static pretty(doLog: boolean, label: string, obj: unknown): void { Logger.spit(2); Logger.log(doLog, label); Logger.log(doLog, "--"); @@ -40,10 +40,10 @@ export class Logger { } } - public static logBase(colorFunc: (data: any) => string, logMessage: string, ...logData:any[]): void { - let dataArr = new Array(); + public static logBase(colorFunc: (data: unknown) => string, logMessage: string, ...logData: (string | unknown)[]): void { + const dataArr = new Array(); - for (let obj of logData) { + for (const obj of logData) { let str = obj as string; if (typeof obj === "object") { str = JSON.stringify(obj); @@ -54,15 +54,15 @@ export class Logger { log(colorFunc(logMessage), colorFunc(dataArr.join(" ::: ") )); } - public static logRed(logMessage: string, ...logData:any[]): void { + public static logRed(logMessage: string, ...logData: unknown[]): void { Logger.logBase(redBright, logMessage, logData); } - public static logYellow(logMessage: string, logData: any = ""): void { + public static logYellow(logMessage: string, logData = ""): void { log(yellow(logMessage), logData); } - public static logCyan(logMessage: string, logData: any = ""): void { + public static logCyan(logMessage: string, logData = ""): void { if (logData) { log(cyan(logMessage), logData); } else { @@ -71,15 +71,15 @@ export class Logger { } public static logText(logMessage: string, ...logText: string[]): void { - let text = logText.join(" :: "); + // const text = logText.join(" :: "); log(bold(cyan(logMessage)), `:: ${logText}`); } - public static logBlue(logMessage: string, logData: any = ""): void { + public static logBlue(logMessage: string, logData = ""): void { console.log(blue(logMessage), logData); } - public static logPurple(logMessage: string, logData: any = null): void { + public static logPurple(logMessage: string, logData = null): void { if (logData == null) { log(magenta(logMessage)); } else { diff --git a/src/utils/parent-file-finder.ts b/src/utils/parent-file-finder.ts index a0049cc..83c5b90 100644 --- a/src/utils/parent-file-finder.ts +++ b/src/utils/parent-file-finder.ts @@ -32,7 +32,6 @@ import * as fs from "fs"; import * as path from "path"; -import { Const } from "../tspath.const"; import { Utils } from "./utils"; export class FileFindResult { @@ -52,9 +51,9 @@ export class ParentFileFinder { * @returns {FileFindResult} */ public static findFile(startPath: string, filename: string): FileFindResult { - let result = new FileFindResult(); - let sep = path.sep; - let parts = startPath.split(sep); + const result = new FileFindResult(); + const sep = path.sep; + const parts = startPath.split(sep); let tmpStr: string = sep; diff --git a/src/utils/utils.ts b/src/utils/utils.ts index e4feecd..1c7543c 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -22,6 +22,7 @@ =----------------------------------------------------------------= */ +import type { Literal } from "esprima-next"; import * as path from "path"; export class Utils { @@ -30,8 +31,8 @@ export class Utils { * @param node * @returns {string} */ - public static safeGetAstNodeValue(node: any): string { - if (Utils.isEmpty(node) || Utils.isEmpty(node.value)) { + public static safeGetAstNodeValue(node: Literal): string { + if (Utils.isEmpty(node) || Utils.isEmpty(node.value) || typeof node.value !== "string") { return ""; } else { return node.value; @@ -50,7 +51,7 @@ export class Utils { return; } - let pathSep = path.sep; + const pathSep = path.sep; if (searchPath.endsWith(pathSep) == false) { searchPath = searchPath + pathSep; } @@ -63,7 +64,7 @@ export class Utils { * @param part * @param trailingDelim */ - public static appendToPath(path: string, part: string, trailingDelim: boolean = true) { + public static appendToPath(path: string, part: string, trailingDelim = true) { Utils.ensureTrailingPathDelimiter(path); path += part; @@ -99,7 +100,7 @@ export class Utils { * @param filePath */ static replaceDoubleSlashes(filePath: string) { - filePath = path.normalize(filePath); + return path.normalize(filePath); } /** * Converts EFBBBF (UTF-8 BOM) to FEFF (UTF-16 BOM)