├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── LICENSE ├── README.md ├── bin └── ts-interface-builder ├── lib ├── index.ts ├── macro.ts └── macro │ ├── RequirementRegistry.ts │ ├── compileTypeSuite.ts │ ├── errors.ts │ ├── getCallPaths.ts │ └── getGetArgValue.ts ├── macro.d.ts ├── macro.js ├── package-lock.json ├── package.json ├── test ├── fixtures │ ├── array-ti.ts │ ├── array.ts │ ├── ignore-generics-ti.ts │ ├── ignore-generics.ts │ ├── ignore-index-signature-ti.ts │ ├── ignore-index-signature.ts │ ├── imports-child-a.ts │ ├── imports-child-b.ts │ ├── imports-child-c.ts │ ├── imports-child-d.ts │ ├── imports-parent-shallow-ti.ts │ ├── imports-parent-ti.ts │ ├── imports-parent.ts │ ├── index-signature-ti.ts │ ├── index-signature.ts │ ├── intersection-ti.ts │ ├── intersection.ts │ ├── macro-error-compiling.ts │ ├── macro-error-evaluating-arguments.ts │ ├── macro-error-reference-not-called.ts │ ├── macro-locals.js │ ├── macro-locals.ts │ ├── macro-options.js │ ├── macro-options.ts │ ├── promises-ti.ts │ ├── promises.ts │ ├── sample-ti.ts │ ├── sample.ts │ ├── to-javascript-ti.cjs.js │ ├── to-javascript-ti.esm.js │ └── to-javascript.ts ├── mocha.opts ├── test_index.ts ├── test_macro.ts └── tsconfig.json ├── tsconfig.json └── tslint.json /.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | 3 | # Logs 4 | logs 5 | *.log 6 | npm-debug.log* 7 | yarn-debug.log* 8 | yarn-error.log* 9 | 10 | # Runtime data 11 | pids 12 | *.pid 13 | *.seed 14 | *.pid.lock 15 | 16 | # Directory for instrumented libs generated by jscoverage/JSCover 17 | lib-cov 18 | 19 | # Coverage directory used by tools like istanbul 20 | coverage 21 | 22 | # nyc test coverage 23 | .nyc_output 24 | 25 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 26 | .grunt 27 | 28 | # Bower dependency directory (https://bower.io/) 29 | bower_components 30 | 31 | # node-waf configuration 32 | .lock-wscript 33 | 34 | # Compiled binary addons (http://nodejs.org/api/addons.html) 35 | build/Release 36 | 37 | # Dependency directories 38 | /node_modules/ 39 | jspm_packages/ 40 | 41 | # Typescript v1 declaration files 42 | typings/ 43 | 44 | # Optional npm cache directory 45 | .npm 46 | 47 | # Optional eslint cache 48 | .eslintcache 49 | 50 | # Optional REPL history 51 | .node_repl_history 52 | 53 | # Output of 'npm pack' 54 | *.tgz 55 | 56 | # Yarn Integrity file 57 | .yarn-integrity 58 | 59 | # dotenv environment variables file 60 | .env 61 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | sudo: false 3 | node_js: 4 | - 10 5 | - 12 6 | - 14 7 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## v0.3.3 (2022-02-06) 2 | - Add support for `bigint` type. 3 | 4 | ## v0.3.1 (2021-10-11) 5 | - Add support for rest types in tuples, and for the type `unknown`. 6 | 7 | ## v0.3.0 (2021-02-21) 8 | - Adds support for index signatures. 9 | 10 | ## v0.2.3 (2020-11-23) 11 | - Adds babel macros getTypeSuite() and getCheckers(). 12 | - Adds support for `-c` (`--changed-only`) option. 13 | - Support globs in command-line arguments. 14 | 15 | ## v0.2.2 (2020-05-18) 16 | - Adds support for intersection of types. 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ts-interface-builder 2 | 3 | [![Build Status](https://travis-ci.org/gristlabs/ts-interface-builder.svg?branch=master)](https://travis-ci.org/gristlabs/ts-interface-builder) 4 | [![npm version](https://badge.fury.io/js/ts-interface-builder.svg)](https://badge.fury.io/js/ts-interface-builder) 5 | 6 | > Compile TypeScript interfaces into a description that allows runtime validation. 7 | 8 | This tool runs at build time to create runtime validators from TypeScript 9 | interfaces. It allows validating data, such as parsed JSON objects received 10 | over the network, or parsed JSON or YAML files, to check if they satisfy a 11 | TypeScript interface, and to produce informative error messages if they do not. 12 | 13 | ## Installation 14 | 15 | ``` 16 | npm install --save-dev ts-interface-builder 17 | npm install --save ts-interface-checker 18 | ``` 19 | 20 | ## Usage 21 | 22 | This module works together with [ts-interface-checker](https://github.com/gristlabs/ts-interface-checker) module. You use 23 | `ts-interface-builder` in a build step that converts some TypeScript interfaces 24 | to a new TypeScript or JavaScript file (with `-ti.ts` or `-ti.js` extension) that provides a runtime 25 | description of the interface. You then use `ts-interface-checker` in your 26 | program to create validator functions from this runtime description. 27 | 28 | ``` 29 | `npm bin`/ts-interface-builder [options] 30 | ``` 31 | 32 | By default, produces `-ti.ts` file for each input file, which has 33 | runtime definitions for all types in the input file. For example, if you have a 34 | TypeScript file that defines some types: 35 | 36 | ```typescript 37 | // foo.ts 38 | interface Square { 39 | size: number; 40 | color?: string; 41 | } 42 | ``` 43 | 44 | Then you can generate code for runtime checks with: 45 | ```bash 46 | `npm bin`/ts-interface-builder foo.ts 47 | ``` 48 | 49 | It produces a file like this: 50 | ```typescript 51 | // foo-ti.ts 52 | import * as t from "ts-interface-checker"; 53 | 54 | export const Square = t.iface([], { 55 | "size": "number", 56 | "color": t.opt("string"), 57 | }); 58 | 59 | const exportedTypeSuite: t.ITypeSuite = { 60 | Square, 61 | }; 62 | export default exportedTypeSuite; 63 | ``` 64 | 65 | See [ts-interface-checker](https://github.com/gristlabs/ts-interface-checker) module for how to use this file in your program. 66 | 67 | ## Limitations 68 | This module currently does not support generics, except Promises. Promises are supported by unwrapping `Promise` to simply `T`. 69 | -------------------------------------------------------------------------------- /bin/ts-interface-builder: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require('../dist/index.js').main(); 3 | -------------------------------------------------------------------------------- /lib/index.ts: -------------------------------------------------------------------------------- 1 | // tslint:disable:no-console 2 | 3 | import * as commander from "commander"; 4 | import * as fs from "fs"; 5 | import * as glob from "glob"; 6 | import * as path from "path"; 7 | import * as ts from "typescript"; 8 | 9 | // Default format to use for `format` option 10 | const defaultFormat = "ts" 11 | // Default suffix appended to generated files. Abbreviation for "ts-interface". 12 | const defaultSuffix = "-ti"; 13 | // Default header prepended to the generated module. 14 | const defaultHeader = 15 | `/** 16 | * This module was automatically generated by \`ts-interface-builder\` 17 | */ 18 | `; 19 | const ignoreNode = ""; 20 | 21 | export interface ICompilerOptions { 22 | format?: "ts" | "js:esm" | "js:cjs" 23 | ignoreGenerics?: boolean; 24 | ignoreIndexSignature?: boolean; 25 | inlineImports?: boolean; 26 | } 27 | 28 | // The main public interface is `Compiler.compile`. 29 | export class Compiler { 30 | public static compile( 31 | filePath: string, 32 | options: ICompilerOptions = {}, 33 | ): string { 34 | const createProgramOptions = {target: ts.ScriptTarget.Latest, module: ts.ModuleKind.CommonJS}; 35 | const program = ts.createProgram([filePath], createProgramOptions); 36 | const checker = program.getTypeChecker(); 37 | const topNode = program.getSourceFile(filePath); 38 | if (!topNode) { 39 | throw new Error(`Can't process ${filePath}: ${collectDiagnostics(program)}`); 40 | } 41 | options = {format: defaultFormat, ignoreGenerics: false, ignoreIndexSignature: false, inlineImports: false, ...options} 42 | return new Compiler(checker, options, topNode).compileNode(topNode); 43 | } 44 | 45 | private exportedNames: string[] = []; 46 | 47 | constructor(private checker: ts.TypeChecker, private options: ICompilerOptions, private topNode: ts.SourceFile) {} 48 | 49 | private getName(id: ts.Node): string { 50 | const symbol = this.checker.getSymbolAtLocation(id); 51 | return symbol ? symbol.getName() : "unknown"; 52 | } 53 | 54 | private indent(content: string): string { 55 | return content.replace(/\n/g, "\n "); 56 | } 57 | private compileNode(node: ts.Node): string { 58 | switch (node.kind) { 59 | case ts.SyntaxKind.Identifier: return this._compileIdentifier(node as ts.Identifier); 60 | case ts.SyntaxKind.Parameter: return this._compileParameterDeclaration(node as ts.ParameterDeclaration); 61 | case ts.SyntaxKind.PropertySignature: return this._compilePropertySignature(node as ts.PropertySignature); 62 | case ts.SyntaxKind.MethodSignature: return this._compileMethodSignature(node as ts.MethodSignature); 63 | case ts.SyntaxKind.TypeReference: return this._compileTypeReferenceNode(node as ts.TypeReferenceNode); 64 | case ts.SyntaxKind.FunctionType: return this._compileFunctionTypeNode(node as ts.FunctionTypeNode); 65 | case ts.SyntaxKind.TypeLiteral: return this._compileTypeLiteralNode(node as ts.TypeLiteralNode); 66 | case ts.SyntaxKind.ArrayType: return this._compileArrayTypeNode(node as ts.ArrayTypeNode); 67 | case ts.SyntaxKind.TupleType: return this._compileTupleTypeNode(node as ts.TupleTypeNode); 68 | case ts.SyntaxKind.RestType: return this._compileRestTypeNode(node as ts.RestTypeNode); 69 | case ts.SyntaxKind.UnionType: return this._compileUnionTypeNode(node as ts.UnionTypeNode); 70 | case ts.SyntaxKind.IntersectionType: return this._compileIntersectionTypeNode(node as ts.IntersectionTypeNode); 71 | case ts.SyntaxKind.LiteralType: return this._compileLiteralTypeNode(node as ts.LiteralTypeNode); 72 | case ts.SyntaxKind.OptionalType: return this._compileOptionalTypeNode(node as ts.OptionalTypeNode); 73 | case ts.SyntaxKind.EnumDeclaration: return this._compileEnumDeclaration(node as ts.EnumDeclaration); 74 | case ts.SyntaxKind.InterfaceDeclaration: 75 | return this._compileInterfaceDeclaration(node as ts.InterfaceDeclaration); 76 | case ts.SyntaxKind.TypeAliasDeclaration: 77 | return this._compileTypeAliasDeclaration(node as ts.TypeAliasDeclaration); 78 | case ts.SyntaxKind.ExpressionWithTypeArguments: 79 | return this._compileExpressionWithTypeArguments(node as ts.ExpressionWithTypeArguments); 80 | case ts.SyntaxKind.ParenthesizedType: 81 | return this._compileParenthesizedTypeNode(node as ts.ParenthesizedTypeNode); 82 | case ts.SyntaxKind.ExportDeclaration: 83 | case ts.SyntaxKind.ImportDeclaration: 84 | return this._compileImportDeclaration(node as ts.ImportDeclaration); 85 | case ts.SyntaxKind.SourceFile: return this._compileSourceFile(node as ts.SourceFile); 86 | case ts.SyntaxKind.AnyKeyword: return '"any"'; 87 | case ts.SyntaxKind.NumberKeyword: return '"number"'; 88 | case ts.SyntaxKind.ObjectKeyword: return '"object"'; 89 | case ts.SyntaxKind.BooleanKeyword: return '"boolean"'; 90 | case ts.SyntaxKind.StringKeyword: return '"string"'; 91 | case ts.SyntaxKind.SymbolKeyword: return '"symbol"'; 92 | case ts.SyntaxKind.ThisKeyword: return '"this"'; 93 | case ts.SyntaxKind.VoidKeyword: return '"void"'; 94 | case ts.SyntaxKind.UndefinedKeyword: return '"undefined"'; 95 | case ts.SyntaxKind.UnknownKeyword: return '"unknown"'; 96 | case ts.SyntaxKind.NullKeyword: return '"null"'; 97 | case ts.SyntaxKind.NeverKeyword: return '"never"'; 98 | case ts.SyntaxKind.BigIntKeyword: return '"bigint"'; 99 | case ts.SyntaxKind.IndexSignature: 100 | return this._compileIndexSignatureDeclaration(node as ts.IndexSignatureDeclaration); 101 | } 102 | // Skip top-level statements that we haven't handled. 103 | if (ts.isSourceFile(node.parent!)) { return ""; } 104 | throw new Error(`Node ${ts.SyntaxKind[node.kind]} not supported by ts-interface-builder: ` + 105 | node.getText()); 106 | } 107 | 108 | private compileOptType(typeNode: ts.Node|undefined): string { 109 | return typeNode ? this.compileNode(typeNode) : '"any"'; 110 | } 111 | 112 | private _compileIdentifier(node: ts.Identifier): string { 113 | return `"${node.getText()}"`; 114 | } 115 | private _compileParameterDeclaration(node: ts.ParameterDeclaration): string { 116 | const name = this.getName(node.name); 117 | const isOpt = node.questionToken ? ", true" : ""; 118 | return `t.param("${name}", ${this.compileOptType(node.type)}${isOpt})`; 119 | } 120 | private _compilePropertySignature(node: ts.PropertySignature): string { 121 | const name = this.getName(node.name); 122 | const prop = this.compileOptType(node.type); 123 | const value = node.questionToken ? `t.opt(${prop})` : prop; 124 | return `"${name}": ${value}`; 125 | } 126 | private _compileMethodSignature(node: ts.MethodSignature): string { 127 | const name = this.getName(node.name); 128 | const params = node.parameters.map(this.compileNode, this); 129 | const items = [this.compileOptType(node.type)].concat(params); 130 | return `"${name}": t.func(${items.join(", ")})`; 131 | } 132 | private _compileTypeReferenceNode(node: ts.TypeReferenceNode): string { 133 | if (!node.typeArguments) { 134 | if (node.typeName.kind === ts.SyntaxKind.QualifiedName) { 135 | const typeNode = this.checker.getTypeFromTypeNode(node); 136 | if (typeNode.flags & ts.TypeFlags.EnumLiteral) { 137 | return `t.enumlit("${node.typeName.left.getText()}", "${node.typeName.right.getText()}")`; 138 | } 139 | } 140 | return `"${node.typeName.getText()}"`; 141 | } else if (node.typeName.getText() === "Promise") { 142 | // Unwrap Promises. 143 | return this.compileNode(node.typeArguments[0]); 144 | } else if (node.typeName.getText() === "Array") { 145 | return `t.array(${this.compileNode(node.typeArguments[0])})`; 146 | } else if (this.options.ignoreGenerics) { 147 | return '"any"'; 148 | } else { 149 | throw new Error(`Generics are not yet supported by ts-interface-builder: ` + node.getText()); 150 | } 151 | } 152 | private _compileFunctionTypeNode(node: ts.FunctionTypeNode): string { 153 | const params = node.parameters.map(this.compileNode, this); 154 | const items = [this.compileOptType(node.type)].concat(params); 155 | return `t.func(${items.join(", ")})`; 156 | } 157 | private _compileTypeLiteralNode(node: ts.TypeLiteralNode): string { 158 | const members = node.members 159 | .map(n => this.compileNode(n)) 160 | .filter(n => n !== ignoreNode) 161 | .map(n => " " + this.indent(n) + ",\n"); 162 | return `t.iface([], {\n${members.join("")}})`; 163 | } 164 | private _compileArrayTypeNode(node: ts.ArrayTypeNode): string { 165 | return `t.array(${this.compileNode(node.elementType)})`; 166 | } 167 | private _compileTupleTypeNode(node: ts.TupleTypeNode): string { 168 | const members = node.elementTypes.map(this.compileNode, this); 169 | return `t.tuple(${members.join(", ")})`; 170 | } 171 | private _compileRestTypeNode(node: ts.RestTypeNode): string { 172 | if (node.parent.kind != ts.SyntaxKind.TupleType) { 173 | throw new Error("Rest type currently only supported in tuples"); 174 | } 175 | return `t.rest(${this.compileNode(node.type)})`; 176 | } 177 | private _compileUnionTypeNode(node: ts.UnionTypeNode): string { 178 | const members = node.types.map(this.compileNode, this); 179 | return `t.union(${members.join(", ")})`; 180 | } 181 | private _compileIntersectionTypeNode(node: ts.IntersectionTypeNode): string { 182 | const members = node.types.map(this.compileNode, this); 183 | return `t.intersection(${members.join(", ")})`; 184 | } 185 | private _compileLiteralTypeNode(node: ts.LiteralTypeNode): string { 186 | return `t.lit(${node.getText()})`; 187 | } 188 | private _compileOptionalTypeNode(node: ts.OptionalTypeNode): string { 189 | return `t.opt(${this.compileNode(node.type)})`; 190 | } 191 | private _compileEnumDeclaration(node: ts.EnumDeclaration): string { 192 | const name = this.getName(node.name); 193 | const members: string[] = node.members.map(m => 194 | ` "${this.getName(m.name)}": ${getTextOfConstantValue(this.checker.getConstantValue(m))},\n`); 195 | this.exportedNames.push(name); 196 | return this._formatExport(name, `t.enumtype({\n${members.join("")}})`); 197 | } 198 | private _compileInterfaceDeclaration(node: ts.InterfaceDeclaration): string { 199 | const name = this.getName(node.name); 200 | const members = node.members 201 | .map(n => this.compileNode(n)) 202 | .filter(n => n !== ignoreNode) 203 | .map(n => " " + this.indent(n) + ",\n"); 204 | const extend: string[] = []; 205 | if (node.heritageClauses) { 206 | for (const h of node.heritageClauses) { 207 | extend.push(...h.types.map(this.compileNode, this)); 208 | } 209 | } 210 | this.exportedNames.push(name); 211 | return this._formatExport(name, `t.iface([${extend.join(", ")}], {\n${members.join("")}})`) 212 | } 213 | private _compileTypeAliasDeclaration(node: ts.TypeAliasDeclaration): string { 214 | const name = this.getName(node.name); 215 | this.exportedNames.push(name); 216 | const compiled = this.compileNode(node.type); 217 | // Turn string literals into explicit `name` nodes, as expected by ITypeSuite. 218 | const fullType = compiled.startsWith('"') ? `t.name(${compiled})` : compiled; 219 | return this._formatExport(name, fullType) 220 | } 221 | private _compileExpressionWithTypeArguments(node: ts.ExpressionWithTypeArguments): string { 222 | return this.compileNode(node.expression); 223 | } 224 | private _compileParenthesizedTypeNode(node: ts.ParenthesizedTypeNode): string { 225 | return this.compileNode(node.type); 226 | } 227 | private _compileImportDeclaration(node: ts.ImportDeclaration): string { 228 | if (this.options.inlineImports) { 229 | const importedSym = this.checker.getSymbolAtLocation(node.moduleSpecifier); 230 | if (importedSym && importedSym.declarations) { 231 | // this._compileSourceFile will get called on every imported file when traversing imports. 232 | // it's important to check that _compileSourceFile is being run against the topNode 233 | // before adding the file wrapper for this reason. 234 | return importedSym.declarations.map(declaration => this.compileNode(declaration)).join(""); 235 | } 236 | } 237 | return ''; 238 | } 239 | private _compileSourceFileStatements(node: ts.SourceFile): string { 240 | return node.statements.map(this.compileNode, this).filter((s) => s).join("\n\n"); 241 | } 242 | private _compileSourceFile(node: ts.SourceFile): string { 243 | // for imported source files, skip the wrapper 244 | if (node !== this.topNode) { 245 | return this._compileSourceFileStatements(node); 246 | } 247 | // wrap the top node with a default export 248 | if (this.options.format === "js:cjs") { 249 | return `const t = require("ts-interface-checker");\n\n` + 250 | "module.exports = {\n" + 251 | this._compileSourceFileStatements(node) + "\n" + 252 | "};\n" 253 | } 254 | const prefix = `import * as t from "ts-interface-checker";\n` + 255 | (this.options.format === "ts" ? "// tslint:disable:object-literal-key-quotes\n" : "") + 256 | "\n"; 257 | return prefix + 258 | this._compileSourceFileStatements(node) + "\n\n" + 259 | "const exportedTypeSuite" + (this.options.format === "ts" ? ": t.ITypeSuite" : "") + " = {\n" + 260 | this.exportedNames.map((n) => ` ${n},\n`).join("") + 261 | "};\n" + 262 | "export default exportedTypeSuite;\n"; 263 | } 264 | private _compileIndexSignatureDeclaration(node: ts.IndexSignatureDeclaration): string { 265 | // This option is supported for backward compatibility. 266 | if (this.options.ignoreIndexSignature) { 267 | return ignoreNode; 268 | } 269 | 270 | if (!node.type) { throw new Error(`Node ${ts.SyntaxKind[node.kind]} must have a type`); } 271 | const type = this.compileNode(node.type); 272 | return `[t.indexKey]: ${type}`; 273 | } 274 | private _formatExport(name: string, expression: string): string { 275 | return this.options.format === "js:cjs" 276 | ? ` ${name}: ${this.indent(expression)},` 277 | : `export const ${name} = ${expression};`; 278 | } 279 | } 280 | 281 | function getTextOfConstantValue(value: string | number | undefined): string { 282 | // Typescript has methods to escape values, but doesn't seem to expose them at all. Here I am 283 | // casting `ts` to access this private member rather than implementing my own. 284 | return value === undefined ? "undefined" : (ts as any).getTextOfConstantValue(value); 285 | } 286 | 287 | function collectDiagnostics(program: ts.Program) { 288 | const diagnostics = ts.getPreEmitDiagnostics(program); 289 | return ts.formatDiagnostics(diagnostics, { 290 | getCurrentDirectory() { return process.cwd(); }, 291 | getCanonicalFileName(fileName: string) { return fileName; }, 292 | getNewLine() { return "\n"; }, 293 | }); 294 | } 295 | 296 | function needsUpdate(srcPath: string, outPath: string): boolean { 297 | if (!fs.existsSync(outPath)) { 298 | return true; 299 | } 300 | 301 | const lastBuildTime = fs.statSync(outPath).mtime; 302 | const lastCodeTime = fs.statSync(srcPath).mtime; 303 | 304 | return lastBuildTime < lastCodeTime; 305 | } 306 | 307 | /** 308 | * Main entry point when used from the command line. 309 | */ 310 | export function main() { 311 | commander 312 | .description("Create runtime validator module from TypeScript interfaces") 313 | .usage("[options] ") 314 | .option("--format ", `Format to use for output; options are 'ts' (default), 'js:esm', 'js:cjs'`) 315 | .option("-g, --ignore-generics", `Ignores generics`) 316 | .option("-i, --ignore-index-signature", `Ignores index signature`) 317 | .option("--inline-imports", `Traverses the full import tree and inlines all types into output`) 318 | .option("-s, --suffix ", `Suffix to append to generated files (default ${defaultSuffix})`, defaultSuffix) 319 | .option("-o, --outDir ", `Directory for output files; same as source file if omitted`) 320 | .option("-v, --verbose", "Produce verbose output") 321 | .option("-c, --changed-only", "Skip the build if the output file exists with a newer timestamp") 322 | .parse(process.argv); 323 | 324 | const files: string[] = commander.args; 325 | const verbose: boolean = commander.verbose; 326 | const changedOnly: boolean = commander.changedOnly; 327 | const suffix: string = commander.suffix; 328 | const outDir: string|undefined = commander.outDir; 329 | const options: ICompilerOptions = { 330 | format: commander.format || defaultFormat, 331 | ignoreGenerics: commander.ignoreGenerics, 332 | ignoreIndexSignature: commander.ignoreIndexSignature, 333 | inlineImports: commander.inlineImports, 334 | }; 335 | 336 | if (files.length === 0) { 337 | commander.outputHelp(); 338 | process.exit(1); 339 | return; 340 | } 341 | 342 | // perform expansion and find all matching files ourselves 343 | const globFiles = ([] as string[]).concat(...files.map(p => glob.sync(p))); 344 | 345 | for (const filePath of globFiles) { 346 | // Read and parse the source file. 347 | const ext = path.extname(filePath); 348 | const dir = outDir || path.dirname(filePath); 349 | const outPath = path.join(dir, path.basename(filePath, ext) + suffix + (options.format === "ts" ? ".ts" : ".js")); 350 | 351 | if (changedOnly && !needsUpdate(filePath, outPath)) { 352 | if (verbose) { 353 | console.log(`Skipping ${filePath} because ${outPath} is newer`); 354 | } 355 | continue; 356 | } 357 | 358 | if (verbose) { 359 | console.log(`Compiling ${filePath} -> ${outPath}`); 360 | } 361 | const generatedCode = defaultHeader + Compiler.compile(filePath, options); 362 | fs.writeFileSync(outPath, generatedCode); 363 | } 364 | } 365 | -------------------------------------------------------------------------------- /lib/macro.ts: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | import * as path from "path"; 3 | import { createMacro, MacroHandler } from "babel-plugin-macros"; 4 | import { NodePath, types } from "@babel/core"; // typescript types ONLY 5 | import { ICompilerOptions } from "./index"; 6 | import { getCallPaths } from "./macro/getCallPaths"; 7 | import { RequirementRegistry } from "./macro/RequirementRegistry"; 8 | import { getGetArgValue } from "./macro/getGetArgValue"; 9 | import { compileTypeSuite, ICompilerArgs } from "./macro/compileTypeSuite"; 10 | import { macroInternalError } from "./macro/errors"; 11 | 12 | const tsInterfaceCheckerIdentifier = "t"; 13 | const onceIdentifier = "once"; 14 | 15 | /** 16 | * This macro handler is called for each file that imports the macro module. 17 | * `params.references` is an object where each key is the name of a variable imported from the macro module, 18 | * and each value is an array of references to that that variable. 19 | * Said references come in the form of Babel `NodePath`s, 20 | * which have AST (Abstract Syntax Tree) data and methods for manipulating it. 21 | * For more info: https://github.com/kentcdodds/babel-plugin-macros/blob/master/other/docs/author.md#function-api 22 | * 23 | * This macro handler needs to replace each call to `getTypeSuite` or `getCheckers` 24 | * with the code that fulfills that function's behavior as documented in `macro.d.ts` (in root of repo). 25 | */ 26 | const macroHandler: MacroHandler = (params) => { 27 | const { references, babel, state } = params; 28 | const callPaths = getCallPaths(references); 29 | const somePath = callPaths.getTypeSuite[0] || callPaths.getCheckers[0]; 30 | if (!somePath) { 31 | return; 32 | } 33 | const programPath = somePath.findParent((path) => path.isProgram())!; 34 | 35 | const registry = new RequirementRegistry(); 36 | const toReplace = [ 37 | ...callPaths.getTypeSuite.map((callPath, index) => { 38 | const compilerArgs = getCompilerArgs(callPath, "getTypeSuite", index); 39 | const typeSuiteId = registry.requireTypeSuite(compilerArgs); 40 | return { callPath, id: typeSuiteId }; 41 | }), 42 | ...callPaths.getCheckers.map((callPath, index) => { 43 | const compilerArgs = getCompilerArgs(callPath, "getCheckers", index); 44 | const checkerSuiteId = registry.requireCheckerSuite(compilerArgs); 45 | return { callPath, id: checkerSuiteId }; 46 | }), 47 | ]; 48 | 49 | // Begin mutations 50 | 51 | programPath.scope.rename(tsInterfaceCheckerIdentifier); 52 | programPath.scope.rename(onceIdentifier); 53 | toReplace.forEach(({ callPath, id }) => { 54 | scopeRenameRecursive(callPath.scope, id); 55 | }); 56 | 57 | const toPrepend = ` 58 | import * as ${tsInterfaceCheckerIdentifier} from "ts-interface-checker"; 59 | function ${onceIdentifier}(fn) { 60 | var result; 61 | return function () { 62 | return result || (result = fn()); 63 | }; 64 | } 65 | ${registry.typeSuites 66 | .map( 67 | ({ compilerArgs, id }) => ` 68 | var ${id} = ${onceIdentifier}(function(){ 69 | return ${compileTypeSuite(compilerArgs)}; 70 | }); 71 | ` 72 | ) 73 | .join("")} 74 | ${registry.checkerSuites 75 | .map( 76 | ({ typeSuiteId, id }) => ` 77 | var ${id} = ${onceIdentifier}(function(){ 78 | return ${tsInterfaceCheckerIdentifier}.createCheckers(${typeSuiteId}()); 79 | }); 80 | ` 81 | ) 82 | .join("")} 83 | `; 84 | parseStatements(toPrepend).reverse().forEach(prependProgramStatement); 85 | 86 | const { identifier, callExpression } = babel.types; 87 | toReplace.forEach(({ callPath, id }) => { 88 | callPath.replaceWith(callExpression(identifier(id), [])); 89 | }); 90 | 91 | // Done mutations (only helper functions below) 92 | 93 | function getCompilerArgs( 94 | callPath: NodePath, 95 | functionName: string, 96 | callIndex: number 97 | ): ICompilerArgs { 98 | const callDescription = `${functionName} call ${callIndex + 1}`; 99 | const getArgValue = getGetArgValue(callPath, callDescription); 100 | 101 | const basename = getArgValue(0) || path.basename(state.filename); 102 | const file = path.resolve(state.filename, "..", basename); 103 | 104 | // Get the user config passed to us by babel-plugin-macros, for use as default options 105 | // Note: `config` property is missing in `babelPluginMacros.MacroParams` type definition 106 | const defaultOptions = (params as any).config; 107 | const options = { 108 | ...(defaultOptions || {}), 109 | ...(getArgValue(1) || {}), 110 | format: "js:cjs", 111 | } as ICompilerOptions; 112 | 113 | return [file, options]; 114 | } 115 | 116 | function scopeRenameRecursive(scope: NodePath["scope"], oldName: string) { 117 | scope.rename(oldName); 118 | if (scope.parent) { 119 | scopeRenameRecursive(scope.parent, oldName); 120 | } 121 | } 122 | 123 | function parseStatements(code: string) { 124 | const parsed = babel.parse(code, { configFile: false }); 125 | if (!parsed || parsed.type !== "File") throw macroInternalError(); 126 | return parsed.program.body; 127 | } 128 | 129 | function prependProgramStatement(statement: types.Statement) { 130 | (programPath.get("body.0") as NodePath).insertBefore(statement); 131 | } 132 | }; 133 | 134 | const macroParams = { configName: "ts-interface-builder" }; 135 | 136 | export const macro = () => createMacro(macroHandler, macroParams); 137 | -------------------------------------------------------------------------------- /lib/macro/RequirementRegistry.ts: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | import { isDeepStrictEqual } from "util"; 3 | import { ICompilerArgs } from "./compileTypeSuite"; 4 | 5 | export interface IRequiredTypeSuite { 6 | compilerArgs: ICompilerArgs; 7 | id: string; 8 | } 9 | 10 | export interface IRequiredCheckerSuite { 11 | typeSuiteId: string; 12 | id: string; 13 | } 14 | 15 | export class RequirementRegistry { 16 | public typeSuites: IRequiredTypeSuite[] = []; 17 | public checkerSuites: IRequiredCheckerSuite[] = []; 18 | 19 | public requireTypeSuite(compilerArgs: ICompilerArgs): string { 20 | let index = this.typeSuites.findIndex((typeSuite) => 21 | isDeepStrictEqual(typeSuite.compilerArgs, compilerArgs) 22 | ); 23 | if (index === -1) { 24 | index = this.typeSuites.length; 25 | this.typeSuites.push({ 26 | compilerArgs, 27 | id: `typeSuite${index}`, 28 | }); 29 | } 30 | return this.typeSuites[index].id; 31 | } 32 | 33 | public requireCheckerSuite(compilerArgs: ICompilerArgs): string { 34 | const typeSuiteId = this.requireTypeSuite(compilerArgs); 35 | let index = this.checkerSuites.findIndex( 36 | (checkerSuite) => checkerSuite.typeSuiteId === typeSuiteId 37 | ); 38 | if (index === -1) { 39 | index = this.checkerSuites.length; 40 | this.checkerSuites.push({ 41 | typeSuiteId, 42 | id: `checkerSuite${index}`, 43 | }); 44 | } 45 | return this.checkerSuites[index].id; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /lib/macro/compileTypeSuite.ts: -------------------------------------------------------------------------------- 1 | import { Compiler, ICompilerOptions } from "../index"; 2 | import { macroError, macroInternalError } from "./errors"; 3 | 4 | export type ICompilerArgs = [string, ICompilerOptions]; 5 | 6 | export function compileTypeSuite(args: ICompilerArgs): string { 7 | let compiled: string | undefined; 8 | const [file, options] = args; 9 | const optionsString = JSON.stringify(options); 10 | const context = `compiling file ${file} with options ${optionsString}`; 11 | try { 12 | compiled = Compiler.compile(file, options); 13 | } catch (error) { 14 | throw macroError(`Error ${context}: ${error.name}: ${error.message}`); 15 | } 16 | /* 17 | Here we have `compiled` in "js:cjs" format. 18 | From this string we need to extract the type suite expression that is exported. 19 | The format is expected to have only two statements: 20 | 1. a cjs-style import statement which defines `t`, e.g. `const t = require("ts-interface-checker")` 21 | 2. beginning on 3rd line, a cjs-style export statement that starts with `module.exports = ` and ends with `;\n` 22 | */ 23 | const exportStatement = compiled.split("\n").slice(2).join("\n"); 24 | const prefix = "module.exports = "; 25 | const postfix = ";\n"; 26 | if ( 27 | !exportStatement.startsWith(prefix) || 28 | !exportStatement.endsWith(postfix) 29 | ) { 30 | throw macroInternalError( 31 | `Unexpected output format from Compiler (${context})` 32 | ); 33 | } 34 | return exportStatement.slice(prefix.length, -postfix.length); 35 | } 36 | -------------------------------------------------------------------------------- /lib/macro/errors.ts: -------------------------------------------------------------------------------- 1 | import {MacroError} from "babel-plugin-macros"; 2 | 3 | export function macroError(message: string): MacroError { 4 | return new MacroError(`ts-interface-builder/macro: ${message}`); 5 | } 6 | 7 | export function macroInternalError(message?: string): MacroError { 8 | return macroError(`Internal Error: ${message || "Check stack trace"}`); 9 | } 10 | -------------------------------------------------------------------------------- /lib/macro/getCallPaths.ts: -------------------------------------------------------------------------------- 1 | import { References } from "babel-plugin-macros"; 2 | import { NodePath, types } from "@babel/core"; // typescript types ONLY 3 | import { macroError } from "./errors"; 4 | 5 | export function getCallPaths({ 6 | getTypeSuite = [], 7 | getCheckers = [], 8 | ...rest 9 | }: References) { 10 | const restKeys = Object.keys(rest); 11 | if (restKeys.length) { 12 | throw macroError( 13 | `Reference(s) to unknown export(s): ${restKeys.join(", ")}` 14 | ); 15 | } 16 | const callPaths = { 17 | getTypeSuite: [] as NodePath[], 18 | getCheckers: [] as NodePath[], 19 | }; 20 | getTypeSuite.forEach((path, index) => { 21 | if (!path.parentPath.isCallExpression()) { 22 | throw macroError( 23 | `Reference ${index + 1} to getTypeSuite not used for a call expression` 24 | ); 25 | } 26 | callPaths.getTypeSuite.push(path.parentPath); 27 | }); 28 | getCheckers.forEach((path, index) => { 29 | if (!path.parentPath.isCallExpression()) { 30 | throw macroError( 31 | `Reference ${index + 1} to getCheckers not used for a call expression` 32 | ); 33 | } 34 | callPaths.getCheckers.push(path.parentPath); 35 | }); 36 | return callPaths; 37 | } 38 | -------------------------------------------------------------------------------- /lib/macro/getGetArgValue.ts: -------------------------------------------------------------------------------- 1 | import { NodePath, types } from "@babel/core"; // typescript types ONLY 2 | import { macroError, macroInternalError } from "./errors"; 3 | 4 | export function getGetArgValue( 5 | callPath: NodePath, 6 | callDescription: string 7 | ) { 8 | const argPaths = callPath.get("arguments"); 9 | if (!Array.isArray(argPaths)) throw macroInternalError(); 10 | return (argIndex: number): any => { 11 | const argPath = argPaths[argIndex]; 12 | if (!argPath) { 13 | return null; 14 | } 15 | const { confident, value } = argPath.evaluate(); 16 | if (!confident) { 17 | /** 18 | * TODO: Could not get following line to work: 19 | * const lineSuffix = argPath.node.loc ? ` on line ${argPath.node.loc.start.line}` : "" 20 | * Line number displayed is for the intermediary js produced by typescript. 21 | * Even with `inputSourceMap: true`, Babel doesn't seem to parse inline sourcemaps in input. 22 | * Maybe babel-plugin-macros doesn't support "input -> TS -> babel -> output" pipeline? 23 | * Or maybe I'm doing that pipeline wrong? 24 | */ 25 | throw macroError( 26 | `Unable to evaluate argument ${argIndex + 1} of ${callDescription}` 27 | ); 28 | } 29 | return value; 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /macro.d.ts: -------------------------------------------------------------------------------- 1 | import { ICompilerOptions } from "." 2 | import { ICheckerSuite, ITypeSuite } from "ts-interface-checker" 3 | 4 | /** 5 | * Returns a type suite compiled from the given module with the given compiler options 6 | * @param modulePath - Relative path to the target module (defaults to the module in which the function is called) 7 | * @param options - Compiler options 8 | */ 9 | export declare function getTypeSuite (modulePath?: string, options?: ICompilerOptions): ITypeSuite 10 | 11 | /** 12 | * Returns a checker suite created from a type suite compiled from the given module with the given compiler options 13 | * @param modulePath - Relative path to the target module (defaults to the module in which the function is called) 14 | * @param options - Compiler options 15 | */ 16 | export declare function getCheckers (modulePath?: string, options?: ICompilerOptions): ICheckerSuite 17 | -------------------------------------------------------------------------------- /macro.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./dist/macro.js").macro() 2 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ts-interface-builder", 3 | "version": "0.3.3", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "@babel/code-frame": { 8 | "version": "7.10.4", 9 | "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", 10 | "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", 11 | "dev": true, 12 | "requires": { 13 | "@babel/highlight": "^7.10.4" 14 | } 15 | }, 16 | "@babel/core": { 17 | "version": "7.12.8", 18 | "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.12.8.tgz", 19 | "integrity": "sha512-ra28JXL+5z73r1IC/t+FT1ApXU5LsulFDnTDntNfLQaScJUJmcHL5Qxm/IWanCToQk3bPWQo5bflbplU5r15pg==", 20 | "dev": true, 21 | "requires": { 22 | "@babel/code-frame": "^7.10.4", 23 | "@babel/generator": "^7.12.5", 24 | "@babel/helper-module-transforms": "^7.12.1", 25 | "@babel/helpers": "^7.12.5", 26 | "@babel/parser": "^7.12.7", 27 | "@babel/template": "^7.12.7", 28 | "@babel/traverse": "^7.12.8", 29 | "@babel/types": "^7.12.7", 30 | "convert-source-map": "^1.7.0", 31 | "debug": "^4.1.0", 32 | "gensync": "^1.0.0-beta.1", 33 | "json5": "^2.1.2", 34 | "lodash": "^4.17.19", 35 | "resolve": "^1.3.2", 36 | "semver": "^5.4.1", 37 | "source-map": "^0.5.0" 38 | } 39 | }, 40 | "@babel/generator": { 41 | "version": "7.12.5", 42 | "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.12.5.tgz", 43 | "integrity": "sha512-m16TQQJ8hPt7E+OS/XVQg/7U184MLXtvuGbCdA7na61vha+ImkyyNM/9DDA0unYCVZn3ZOhng+qz48/KBOT96A==", 44 | "dev": true, 45 | "requires": { 46 | "@babel/types": "^7.12.5", 47 | "jsesc": "^2.5.1", 48 | "source-map": "^0.5.0" 49 | } 50 | }, 51 | "@babel/helper-function-name": { 52 | "version": "7.10.4", 53 | "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz", 54 | "integrity": "sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ==", 55 | "dev": true, 56 | "requires": { 57 | "@babel/helper-get-function-arity": "^7.10.4", 58 | "@babel/template": "^7.10.4", 59 | "@babel/types": "^7.10.4" 60 | } 61 | }, 62 | "@babel/helper-get-function-arity": { 63 | "version": "7.10.4", 64 | "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz", 65 | "integrity": "sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A==", 66 | "dev": true, 67 | "requires": { 68 | "@babel/types": "^7.10.4" 69 | } 70 | }, 71 | "@babel/helper-member-expression-to-functions": { 72 | "version": "7.12.7", 73 | "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.12.7.tgz", 74 | "integrity": "sha512-DCsuPyeWxeHgh1Dus7APn7iza42i/qXqiFPWyBDdOFtvS581JQePsc1F/nD+fHrcswhLlRc2UpYS1NwERxZhHw==", 75 | "dev": true, 76 | "requires": { 77 | "@babel/types": "^7.12.7" 78 | } 79 | }, 80 | "@babel/helper-module-imports": { 81 | "version": "7.12.5", 82 | "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.12.5.tgz", 83 | "integrity": "sha512-SR713Ogqg6++uexFRORf/+nPXMmWIn80TALu0uaFb+iQIUoR7bOC7zBWyzBs5b3tBBJXuyD0cRu1F15GyzjOWA==", 84 | "dev": true, 85 | "requires": { 86 | "@babel/types": "^7.12.5" 87 | } 88 | }, 89 | "@babel/helper-module-transforms": { 90 | "version": "7.12.1", 91 | "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.12.1.tgz", 92 | "integrity": "sha512-QQzehgFAZ2bbISiCpmVGfiGux8YVFXQ0abBic2Envhej22DVXV9nCFaS5hIQbkyo1AdGb+gNME2TSh3hYJVV/w==", 93 | "dev": true, 94 | "requires": { 95 | "@babel/helper-module-imports": "^7.12.1", 96 | "@babel/helper-replace-supers": "^7.12.1", 97 | "@babel/helper-simple-access": "^7.12.1", 98 | "@babel/helper-split-export-declaration": "^7.11.0", 99 | "@babel/helper-validator-identifier": "^7.10.4", 100 | "@babel/template": "^7.10.4", 101 | "@babel/traverse": "^7.12.1", 102 | "@babel/types": "^7.12.1", 103 | "lodash": "^4.17.19" 104 | } 105 | }, 106 | "@babel/helper-optimise-call-expression": { 107 | "version": "7.12.7", 108 | "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.12.7.tgz", 109 | "integrity": "sha512-I5xc9oSJ2h59OwyUqjv95HRyzxj53DAubUERgQMrpcCEYQyToeHA+NEcUEsVWB4j53RDeskeBJ0SgRAYHDBckw==", 110 | "dev": true, 111 | "requires": { 112 | "@babel/types": "^7.12.7" 113 | } 114 | }, 115 | "@babel/helper-replace-supers": { 116 | "version": "7.12.5", 117 | "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.12.5.tgz", 118 | "integrity": "sha512-5YILoed0ZyIpF4gKcpZitEnXEJ9UoDRki1Ey6xz46rxOzfNMAhVIJMoune1hmPVxh40LRv1+oafz7UsWX+vyWA==", 119 | "dev": true, 120 | "requires": { 121 | "@babel/helper-member-expression-to-functions": "^7.12.1", 122 | "@babel/helper-optimise-call-expression": "^7.10.4", 123 | "@babel/traverse": "^7.12.5", 124 | "@babel/types": "^7.12.5" 125 | } 126 | }, 127 | "@babel/helper-simple-access": { 128 | "version": "7.12.1", 129 | "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.12.1.tgz", 130 | "integrity": "sha512-OxBp7pMrjVewSSC8fXDFrHrBcJATOOFssZwv16F3/6Xtc138GHybBfPbm9kfiqQHKhYQrlamWILwlDCeyMFEaA==", 131 | "dev": true, 132 | "requires": { 133 | "@babel/types": "^7.12.1" 134 | } 135 | }, 136 | "@babel/helper-split-export-declaration": { 137 | "version": "7.11.0", 138 | "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz", 139 | "integrity": "sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg==", 140 | "dev": true, 141 | "requires": { 142 | "@babel/types": "^7.11.0" 143 | } 144 | }, 145 | "@babel/helper-validator-identifier": { 146 | "version": "7.10.4", 147 | "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", 148 | "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", 149 | "dev": true 150 | }, 151 | "@babel/helpers": { 152 | "version": "7.12.5", 153 | "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.12.5.tgz", 154 | "integrity": "sha512-lgKGMQlKqA8meJqKsW6rUnc4MdUk35Ln0ATDqdM1a/UpARODdI4j5Y5lVfUScnSNkJcdCRAaWkspykNoFg9sJA==", 155 | "dev": true, 156 | "requires": { 157 | "@babel/template": "^7.10.4", 158 | "@babel/traverse": "^7.12.5", 159 | "@babel/types": "^7.12.5" 160 | } 161 | }, 162 | "@babel/highlight": { 163 | "version": "7.10.4", 164 | "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", 165 | "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==", 166 | "dev": true, 167 | "requires": { 168 | "@babel/helper-validator-identifier": "^7.10.4", 169 | "chalk": "^2.0.0", 170 | "js-tokens": "^4.0.0" 171 | } 172 | }, 173 | "@babel/parser": { 174 | "version": "7.12.7", 175 | "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.12.7.tgz", 176 | "integrity": "sha512-oWR02Ubp4xTLCAqPRiNIuMVgNO5Aif/xpXtabhzW2HWUD47XJsAB4Zd/Rg30+XeQA3juXigV7hlquOTmwqLiwg==", 177 | "dev": true 178 | }, 179 | "@babel/runtime": { 180 | "version": "7.12.5", 181 | "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.5.tgz", 182 | "integrity": "sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg==", 183 | "dev": true, 184 | "requires": { 185 | "regenerator-runtime": "^0.13.4" 186 | } 187 | }, 188 | "@babel/template": { 189 | "version": "7.12.7", 190 | "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.12.7.tgz", 191 | "integrity": "sha512-GkDzmHS6GV7ZeXfJZ0tLRBhZcMcY0/Lnb+eEbXDBfCAcZCjrZKe6p3J4we/D24O9Y8enxWAg1cWwof59yLh2ow==", 192 | "dev": true, 193 | "requires": { 194 | "@babel/code-frame": "^7.10.4", 195 | "@babel/parser": "^7.12.7", 196 | "@babel/types": "^7.12.7" 197 | } 198 | }, 199 | "@babel/traverse": { 200 | "version": "7.12.8", 201 | "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.8.tgz", 202 | "integrity": "sha512-EIRQXPTwFEGRZyu6gXbjfpNORN1oZvwuzJbxcXjAgWV0iqXYDszN1Hx3FVm6YgZfu1ZQbCVAk3l+nIw95Xll9Q==", 203 | "dev": true, 204 | "requires": { 205 | "@babel/code-frame": "^7.10.4", 206 | "@babel/generator": "^7.12.5", 207 | "@babel/helper-function-name": "^7.10.4", 208 | "@babel/helper-split-export-declaration": "^7.11.0", 209 | "@babel/parser": "^7.12.7", 210 | "@babel/types": "^7.12.7", 211 | "debug": "^4.1.0", 212 | "globals": "^11.1.0", 213 | "lodash": "^4.17.19" 214 | } 215 | }, 216 | "@babel/types": { 217 | "version": "7.12.7", 218 | "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz", 219 | "integrity": "sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ==", 220 | "dev": true, 221 | "requires": { 222 | "@babel/helper-validator-identifier": "^7.10.4", 223 | "lodash": "^4.17.19", 224 | "to-fast-properties": "^2.0.0" 225 | } 226 | }, 227 | "@types/babel-plugin-macros": { 228 | "version": "2.8.4", 229 | "resolved": "https://registry.npmjs.org/@types/babel-plugin-macros/-/babel-plugin-macros-2.8.4.tgz", 230 | "integrity": "sha512-Fi2GPlNuqaw6oIa3kQSyJx7NiUw9X1XU9af28L4nu+klsDLJyBYoIRIshQW/BQ7/N4R0vPcfyZEZLrVYRoVsfg==", 231 | "dev": true, 232 | "requires": { 233 | "@types/babel__core": "*" 234 | } 235 | }, 236 | "@types/babel__core": { 237 | "version": "7.1.12", 238 | "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.12.tgz", 239 | "integrity": "sha512-wMTHiiTiBAAPebqaPiPDLFA4LYPKr6Ph0Xq/6rq1Ur3v66HXyG+clfR9CNETkD7MQS8ZHvpQOtA53DLws5WAEQ==", 240 | "dev": true, 241 | "requires": { 242 | "@babel/parser": "^7.1.0", 243 | "@babel/types": "^7.0.0", 244 | "@types/babel__generator": "*", 245 | "@types/babel__template": "*", 246 | "@types/babel__traverse": "*" 247 | } 248 | }, 249 | "@types/babel__generator": { 250 | "version": "7.6.2", 251 | "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.2.tgz", 252 | "integrity": "sha512-MdSJnBjl+bdwkLskZ3NGFp9YcXGx5ggLpQQPqtgakVhsWK0hTtNYhjpZLlWQTviGTvF8at+Bvli3jV7faPdgeQ==", 253 | "dev": true, 254 | "requires": { 255 | "@babel/types": "^7.0.0" 256 | } 257 | }, 258 | "@types/babel__template": { 259 | "version": "7.4.0", 260 | "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.0.tgz", 261 | "integrity": "sha512-NTPErx4/FiPCGScH7foPyr+/1Dkzkni+rHiYHHoTjvwou7AQzJkNeD60A9CXRy+ZEN2B1bggmkTMCDb+Mv5k+A==", 262 | "dev": true, 263 | "requires": { 264 | "@babel/parser": "^7.1.0", 265 | "@babel/types": "^7.0.0" 266 | } 267 | }, 268 | "@types/babel__traverse": { 269 | "version": "7.0.15", 270 | "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.0.15.tgz", 271 | "integrity": "sha512-Pzh9O3sTK8V6I1olsXpCfj2k/ygO2q1X0vhhnDrEQyYLHZesWz+zMZMVcwXLCYf0U36EtmyYaFGPfXlTtDHe3A==", 272 | "dev": true, 273 | "requires": { 274 | "@babel/types": "^7.3.0" 275 | } 276 | }, 277 | "@types/fs-extra": { 278 | "version": "4.0.11", 279 | "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-4.0.11.tgz", 280 | "integrity": "sha512-iHm/nBVmMR/VJQn/xCSwZ6C/qfm1Tgsh2IrCCinAsF+mlHDGpV+vLR/EA6xezBXpv0/amDOaqxa8f2TVxBQyog==", 281 | "dev": true, 282 | "requires": { 283 | "@types/node": "*" 284 | } 285 | }, 286 | "@types/glob": { 287 | "version": "7.1.3", 288 | "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.3.tgz", 289 | "integrity": "sha512-SEYeGAIQIQX8NN6LDKprLjbrd5dARM5EXsd8GI/A5l0apYI1fGMWgPHSe4ZKL4eozlAyI+doUE9XbYS4xCkQ1w==", 290 | "dev": true, 291 | "requires": { 292 | "@types/minimatch": "*", 293 | "@types/node": "*" 294 | } 295 | }, 296 | "@types/minimatch": { 297 | "version": "3.0.3", 298 | "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", 299 | "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", 300 | "dev": true 301 | }, 302 | "@types/mocha": { 303 | "version": "5.2.7", 304 | "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.7.tgz", 305 | "integrity": "sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==", 306 | "dev": true 307 | }, 308 | "@types/node": { 309 | "version": "8.10.66", 310 | "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.66.tgz", 311 | "integrity": "sha512-tktOkFUA4kXx2hhhrB8bIFb5TbwzS4uOhKEmwiD+NoiL0qtP2OQ9mFldbgD4dV1djrlBYP6eBuQZiWjuHUpqFw==", 312 | "dev": true 313 | }, 314 | "@types/parse-json": { 315 | "version": "4.0.0", 316 | "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", 317 | "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", 318 | "dev": true 319 | }, 320 | "@types/strip-bom": { 321 | "version": "3.0.0", 322 | "resolved": "https://registry.npmjs.org/@types/strip-bom/-/strip-bom-3.0.0.tgz", 323 | "integrity": "sha1-FKjsOVbC6B7bdSB5CuzyHCkK69I=", 324 | "dev": true 325 | }, 326 | "@types/strip-json-comments": { 327 | "version": "0.0.30", 328 | "resolved": "https://registry.npmjs.org/@types/strip-json-comments/-/strip-json-comments-0.0.30.tgz", 329 | "integrity": "sha512-7NQmHra/JILCd1QqpSzl8+mJRc8ZHz3uDm8YV1Ks9IhK0epEiTw8aIErbvH9PI+6XbqhyIQy3462nEsn7UVzjQ==", 330 | "dev": true 331 | }, 332 | "ansi-colors": { 333 | "version": "3.2.3", 334 | "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", 335 | "integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==", 336 | "dev": true 337 | }, 338 | "ansi-regex": { 339 | "version": "3.0.0", 340 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", 341 | "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", 342 | "dev": true 343 | }, 344 | "ansi-styles": { 345 | "version": "3.2.1", 346 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", 347 | "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", 348 | "dev": true, 349 | "requires": { 350 | "color-convert": "^1.9.0" 351 | } 352 | }, 353 | "argparse": { 354 | "version": "1.0.10", 355 | "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", 356 | "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", 357 | "dev": true, 358 | "requires": { 359 | "sprintf-js": "~1.0.2" 360 | } 361 | }, 362 | "arrify": { 363 | "version": "1.0.1", 364 | "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", 365 | "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", 366 | "dev": true 367 | }, 368 | "babel-plugin-macros": { 369 | "version": "2.8.0", 370 | "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-2.8.0.tgz", 371 | "integrity": "sha512-SEP5kJpfGYqYKpBrj5XU3ahw5p5GOHJ0U5ssOSQ/WBVdwkD2Dzlce95exQTs3jOVWPPKLBN2rlEWkCK7dSmLvg==", 372 | "dev": true, 373 | "requires": { 374 | "@babel/runtime": "^7.7.2", 375 | "cosmiconfig": "^6.0.0", 376 | "resolve": "^1.12.0" 377 | } 378 | }, 379 | "balanced-match": { 380 | "version": "1.0.0", 381 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", 382 | "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" 383 | }, 384 | "brace-expansion": { 385 | "version": "1.1.11", 386 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 387 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 388 | "requires": { 389 | "balanced-match": "^1.0.0", 390 | "concat-map": "0.0.1" 391 | } 392 | }, 393 | "browser-stdout": { 394 | "version": "1.3.1", 395 | "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", 396 | "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", 397 | "dev": true 398 | }, 399 | "buffer-from": { 400 | "version": "1.1.1", 401 | "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", 402 | "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", 403 | "dev": true 404 | }, 405 | "call-bind": { 406 | "version": "1.0.0", 407 | "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.0.tgz", 408 | "integrity": "sha512-AEXsYIyyDY3MCzbwdhzG3Jx1R0J2wetQyUynn6dYHAO+bg8l1k7jwZtRv4ryryFs7EP+NDlikJlVe59jr0cM2w==", 409 | "dev": true, 410 | "requires": { 411 | "function-bind": "^1.1.1", 412 | "get-intrinsic": "^1.0.0" 413 | } 414 | }, 415 | "callsites": { 416 | "version": "3.1.0", 417 | "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", 418 | "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", 419 | "dev": true 420 | }, 421 | "camelcase": { 422 | "version": "5.3.1", 423 | "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", 424 | "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", 425 | "dev": true 426 | }, 427 | "chalk": { 428 | "version": "2.4.2", 429 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", 430 | "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", 431 | "dev": true, 432 | "requires": { 433 | "ansi-styles": "^3.2.1", 434 | "escape-string-regexp": "^1.0.5", 435 | "supports-color": "^5.3.0" 436 | } 437 | }, 438 | "cliui": { 439 | "version": "5.0.0", 440 | "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", 441 | "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", 442 | "dev": true, 443 | "requires": { 444 | "string-width": "^3.1.0", 445 | "strip-ansi": "^5.2.0", 446 | "wrap-ansi": "^5.1.0" 447 | }, 448 | "dependencies": { 449 | "ansi-regex": { 450 | "version": "4.1.0", 451 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", 452 | "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", 453 | "dev": true 454 | }, 455 | "string-width": { 456 | "version": "3.1.0", 457 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", 458 | "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", 459 | "dev": true, 460 | "requires": { 461 | "emoji-regex": "^7.0.1", 462 | "is-fullwidth-code-point": "^2.0.0", 463 | "strip-ansi": "^5.1.0" 464 | } 465 | }, 466 | "strip-ansi": { 467 | "version": "5.2.0", 468 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", 469 | "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", 470 | "dev": true, 471 | "requires": { 472 | "ansi-regex": "^4.1.0" 473 | } 474 | } 475 | } 476 | }, 477 | "color-convert": { 478 | "version": "1.9.3", 479 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", 480 | "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", 481 | "dev": true, 482 | "requires": { 483 | "color-name": "1.1.3" 484 | } 485 | }, 486 | "color-name": { 487 | "version": "1.1.3", 488 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", 489 | "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", 490 | "dev": true 491 | }, 492 | "commander": { 493 | "version": "2.20.3", 494 | "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", 495 | "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" 496 | }, 497 | "concat-map": { 498 | "version": "0.0.1", 499 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 500 | "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" 501 | }, 502 | "convert-source-map": { 503 | "version": "1.7.0", 504 | "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", 505 | "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", 506 | "dev": true, 507 | "requires": { 508 | "safe-buffer": "~5.1.1" 509 | } 510 | }, 511 | "cosmiconfig": { 512 | "version": "6.0.0", 513 | "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz", 514 | "integrity": "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==", 515 | "dev": true, 516 | "requires": { 517 | "@types/parse-json": "^4.0.0", 518 | "import-fresh": "^3.1.0", 519 | "parse-json": "^5.0.0", 520 | "path-type": "^4.0.0", 521 | "yaml": "^1.7.2" 522 | } 523 | }, 524 | "debug": { 525 | "version": "4.3.1", 526 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", 527 | "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", 528 | "dev": true, 529 | "requires": { 530 | "ms": "2.1.2" 531 | } 532 | }, 533 | "decamelize": { 534 | "version": "1.2.0", 535 | "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", 536 | "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", 537 | "dev": true 538 | }, 539 | "define-properties": { 540 | "version": "1.1.3", 541 | "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", 542 | "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", 543 | "dev": true, 544 | "requires": { 545 | "object-keys": "^1.0.12" 546 | } 547 | }, 548 | "diff": { 549 | "version": "3.5.0", 550 | "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", 551 | "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", 552 | "dev": true 553 | }, 554 | "emoji-regex": { 555 | "version": "7.0.3", 556 | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", 557 | "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", 558 | "dev": true 559 | }, 560 | "error-ex": { 561 | "version": "1.3.2", 562 | "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", 563 | "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", 564 | "dev": true, 565 | "requires": { 566 | "is-arrayish": "^0.2.1" 567 | } 568 | }, 569 | "es-abstract": { 570 | "version": "1.17.7", 571 | "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", 572 | "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", 573 | "dev": true, 574 | "requires": { 575 | "es-to-primitive": "^1.2.1", 576 | "function-bind": "^1.1.1", 577 | "has": "^1.0.3", 578 | "has-symbols": "^1.0.1", 579 | "is-callable": "^1.2.2", 580 | "is-regex": "^1.1.1", 581 | "object-inspect": "^1.8.0", 582 | "object-keys": "^1.1.1", 583 | "object.assign": "^4.1.1", 584 | "string.prototype.trimend": "^1.0.1", 585 | "string.prototype.trimstart": "^1.0.1" 586 | }, 587 | "dependencies": { 588 | "object.assign": { 589 | "version": "4.1.2", 590 | "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", 591 | "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", 592 | "dev": true, 593 | "requires": { 594 | "call-bind": "^1.0.0", 595 | "define-properties": "^1.1.3", 596 | "has-symbols": "^1.0.1", 597 | "object-keys": "^1.1.1" 598 | } 599 | } 600 | } 601 | }, 602 | "es-to-primitive": { 603 | "version": "1.2.1", 604 | "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", 605 | "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", 606 | "dev": true, 607 | "requires": { 608 | "is-callable": "^1.1.4", 609 | "is-date-object": "^1.0.1", 610 | "is-symbol": "^1.0.2" 611 | } 612 | }, 613 | "escape-string-regexp": { 614 | "version": "1.0.5", 615 | "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", 616 | "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", 617 | "dev": true 618 | }, 619 | "esprima": { 620 | "version": "4.0.1", 621 | "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", 622 | "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", 623 | "dev": true 624 | }, 625 | "find-up": { 626 | "version": "3.0.0", 627 | "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", 628 | "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", 629 | "dev": true, 630 | "requires": { 631 | "locate-path": "^3.0.0" 632 | } 633 | }, 634 | "flat": { 635 | "version": "4.1.1", 636 | "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.1.tgz", 637 | "integrity": "sha512-FmTtBsHskrU6FJ2VxCnsDb84wu9zhmO3cUX2kGFb5tuwhfXxGciiT0oRY+cck35QmG+NmGh5eLz6lLCpWTqwpA==", 638 | "dev": true, 639 | "requires": { 640 | "is-buffer": "~2.0.3" 641 | } 642 | }, 643 | "fs-extra": { 644 | "version": "4.0.3", 645 | "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", 646 | "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", 647 | "requires": { 648 | "graceful-fs": "^4.1.2", 649 | "jsonfile": "^4.0.0", 650 | "universalify": "^0.1.0" 651 | } 652 | }, 653 | "fs.realpath": { 654 | "version": "1.0.0", 655 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 656 | "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" 657 | }, 658 | "function-bind": { 659 | "version": "1.1.1", 660 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", 661 | "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", 662 | "dev": true 663 | }, 664 | "gensync": { 665 | "version": "1.0.0-beta.2", 666 | "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", 667 | "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", 668 | "dev": true 669 | }, 670 | "get-caller-file": { 671 | "version": "2.0.5", 672 | "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", 673 | "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", 674 | "dev": true 675 | }, 676 | "get-intrinsic": { 677 | "version": "1.0.1", 678 | "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.0.1.tgz", 679 | "integrity": "sha512-ZnWP+AmS1VUaLgTRy47+zKtjTxz+0xMpx3I52i+aalBK1QP19ggLF3Db89KJX7kjfOfP2eoa01qc++GwPgufPg==", 680 | "dev": true, 681 | "requires": { 682 | "function-bind": "^1.1.1", 683 | "has": "^1.0.3", 684 | "has-symbols": "^1.0.1" 685 | } 686 | }, 687 | "glob": { 688 | "version": "7.1.6", 689 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", 690 | "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", 691 | "requires": { 692 | "fs.realpath": "^1.0.0", 693 | "inflight": "^1.0.4", 694 | "inherits": "2", 695 | "minimatch": "^3.0.4", 696 | "once": "^1.3.0", 697 | "path-is-absolute": "^1.0.0" 698 | } 699 | }, 700 | "globals": { 701 | "version": "11.12.0", 702 | "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", 703 | "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", 704 | "dev": true 705 | }, 706 | "graceful-fs": { 707 | "version": "4.2.4", 708 | "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", 709 | "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==" 710 | }, 711 | "growl": { 712 | "version": "1.10.5", 713 | "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", 714 | "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", 715 | "dev": true 716 | }, 717 | "has": { 718 | "version": "1.0.3", 719 | "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", 720 | "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", 721 | "dev": true, 722 | "requires": { 723 | "function-bind": "^1.1.1" 724 | } 725 | }, 726 | "has-flag": { 727 | "version": "3.0.0", 728 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", 729 | "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", 730 | "dev": true 731 | }, 732 | "has-symbols": { 733 | "version": "1.0.1", 734 | "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", 735 | "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", 736 | "dev": true 737 | }, 738 | "he": { 739 | "version": "1.2.0", 740 | "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", 741 | "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", 742 | "dev": true 743 | }, 744 | "homedir-polyfill": { 745 | "version": "1.0.3", 746 | "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", 747 | "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==", 748 | "dev": true, 749 | "requires": { 750 | "parse-passwd": "^1.0.0" 751 | } 752 | }, 753 | "import-fresh": { 754 | "version": "3.2.2", 755 | "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.2.tgz", 756 | "integrity": "sha512-cTPNrlvJT6twpYy+YmKUKrTSjWFs3bjYjAhCwm+z4EOCubZxAuO+hHpRN64TqjEaYSHs7tJAE0w1CKMGmsG/lw==", 757 | "dev": true, 758 | "requires": { 759 | "parent-module": "^1.0.0", 760 | "resolve-from": "^4.0.0" 761 | } 762 | }, 763 | "inflight": { 764 | "version": "1.0.6", 765 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 766 | "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", 767 | "requires": { 768 | "once": "^1.3.0", 769 | "wrappy": "1" 770 | } 771 | }, 772 | "inherits": { 773 | "version": "2.0.4", 774 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 775 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" 776 | }, 777 | "is-arrayish": { 778 | "version": "0.2.1", 779 | "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", 780 | "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", 781 | "dev": true 782 | }, 783 | "is-buffer": { 784 | "version": "2.0.5", 785 | "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", 786 | "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", 787 | "dev": true 788 | }, 789 | "is-callable": { 790 | "version": "1.2.2", 791 | "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.2.tgz", 792 | "integrity": "sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA==", 793 | "dev": true 794 | }, 795 | "is-core-module": { 796 | "version": "2.1.0", 797 | "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.1.0.tgz", 798 | "integrity": "sha512-YcV7BgVMRFRua2FqQzKtTDMz8iCuLEyGKjr70q8Zm1yy2qKcurbFEd79PAdHV77oL3NrAaOVQIbMmiHQCHB7ZA==", 799 | "dev": true, 800 | "requires": { 801 | "has": "^1.0.3" 802 | } 803 | }, 804 | "is-date-object": { 805 | "version": "1.0.2", 806 | "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", 807 | "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", 808 | "dev": true 809 | }, 810 | "is-fullwidth-code-point": { 811 | "version": "2.0.0", 812 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", 813 | "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", 814 | "dev": true 815 | }, 816 | "is-regex": { 817 | "version": "1.1.1", 818 | "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz", 819 | "integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==", 820 | "dev": true, 821 | "requires": { 822 | "has-symbols": "^1.0.1" 823 | } 824 | }, 825 | "is-symbol": { 826 | "version": "1.0.3", 827 | "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", 828 | "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", 829 | "dev": true, 830 | "requires": { 831 | "has-symbols": "^1.0.1" 832 | } 833 | }, 834 | "isexe": { 835 | "version": "2.0.0", 836 | "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", 837 | "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", 838 | "dev": true 839 | }, 840 | "js-tokens": { 841 | "version": "4.0.0", 842 | "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", 843 | "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", 844 | "dev": true 845 | }, 846 | "js-yaml": { 847 | "version": "3.13.1", 848 | "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", 849 | "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", 850 | "dev": true, 851 | "requires": { 852 | "argparse": "^1.0.7", 853 | "esprima": "^4.0.0" 854 | } 855 | }, 856 | "jsesc": { 857 | "version": "2.5.2", 858 | "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", 859 | "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", 860 | "dev": true 861 | }, 862 | "json-parse-even-better-errors": { 863 | "version": "2.3.1", 864 | "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", 865 | "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", 866 | "dev": true 867 | }, 868 | "json5": { 869 | "version": "2.1.3", 870 | "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz", 871 | "integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==", 872 | "dev": true, 873 | "requires": { 874 | "minimist": "^1.2.5" 875 | } 876 | }, 877 | "jsonfile": { 878 | "version": "4.0.0", 879 | "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", 880 | "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", 881 | "requires": { 882 | "graceful-fs": "^4.1.6" 883 | } 884 | }, 885 | "lines-and-columns": { 886 | "version": "1.1.6", 887 | "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", 888 | "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", 889 | "dev": true 890 | }, 891 | "locate-path": { 892 | "version": "3.0.0", 893 | "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", 894 | "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", 895 | "dev": true, 896 | "requires": { 897 | "p-locate": "^3.0.0", 898 | "path-exists": "^3.0.0" 899 | } 900 | }, 901 | "lodash": { 902 | "version": "4.17.20", 903 | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", 904 | "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", 905 | "dev": true 906 | }, 907 | "log-symbols": { 908 | "version": "2.2.0", 909 | "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", 910 | "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", 911 | "dev": true, 912 | "requires": { 913 | "chalk": "^2.0.1" 914 | } 915 | }, 916 | "make-error": { 917 | "version": "1.3.6", 918 | "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", 919 | "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", 920 | "dev": true 921 | }, 922 | "minimatch": { 923 | "version": "3.0.4", 924 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", 925 | "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", 926 | "requires": { 927 | "brace-expansion": "^1.1.7" 928 | } 929 | }, 930 | "minimist": { 931 | "version": "1.2.5", 932 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", 933 | "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", 934 | "dev": true 935 | }, 936 | "mkdirp": { 937 | "version": "0.5.4", 938 | "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.4.tgz", 939 | "integrity": "sha512-iG9AK/dJLtJ0XNgTuDbSyNS3zECqDlAhnQW4CsNxBG3LQJBbHmRX1egw39DmtOdCAqY+dKXV+sgPgilNWUKMVw==", 940 | "dev": true, 941 | "requires": { 942 | "minimist": "^1.2.5" 943 | } 944 | }, 945 | "mocha": { 946 | "version": "6.2.3", 947 | "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.2.3.tgz", 948 | "integrity": "sha512-0R/3FvjIGH3eEuG17ccFPk117XL2rWxatr81a57D+r/x2uTYZRbdZ4oVidEUMh2W2TJDa7MdAb12Lm2/qrKajg==", 949 | "dev": true, 950 | "requires": { 951 | "ansi-colors": "3.2.3", 952 | "browser-stdout": "1.3.1", 953 | "debug": "3.2.6", 954 | "diff": "3.5.0", 955 | "escape-string-regexp": "1.0.5", 956 | "find-up": "3.0.0", 957 | "glob": "7.1.3", 958 | "growl": "1.10.5", 959 | "he": "1.2.0", 960 | "js-yaml": "3.13.1", 961 | "log-symbols": "2.2.0", 962 | "minimatch": "3.0.4", 963 | "mkdirp": "0.5.4", 964 | "ms": "2.1.1", 965 | "node-environment-flags": "1.0.5", 966 | "object.assign": "4.1.0", 967 | "strip-json-comments": "2.0.1", 968 | "supports-color": "6.0.0", 969 | "which": "1.3.1", 970 | "wide-align": "1.1.3", 971 | "yargs": "13.3.2", 972 | "yargs-parser": "13.1.2", 973 | "yargs-unparser": "1.6.0" 974 | }, 975 | "dependencies": { 976 | "debug": { 977 | "version": "3.2.6", 978 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", 979 | "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", 980 | "dev": true, 981 | "requires": { 982 | "ms": "^2.1.1" 983 | } 984 | }, 985 | "glob": { 986 | "version": "7.1.3", 987 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", 988 | "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", 989 | "dev": true, 990 | "requires": { 991 | "fs.realpath": "^1.0.0", 992 | "inflight": "^1.0.4", 993 | "inherits": "2", 994 | "minimatch": "^3.0.4", 995 | "once": "^1.3.0", 996 | "path-is-absolute": "^1.0.0" 997 | } 998 | }, 999 | "ms": { 1000 | "version": "2.1.1", 1001 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", 1002 | "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", 1003 | "dev": true 1004 | }, 1005 | "supports-color": { 1006 | "version": "6.0.0", 1007 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", 1008 | "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", 1009 | "dev": true, 1010 | "requires": { 1011 | "has-flag": "^3.0.0" 1012 | } 1013 | } 1014 | } 1015 | }, 1016 | "ms": { 1017 | "version": "2.1.2", 1018 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 1019 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", 1020 | "dev": true 1021 | }, 1022 | "node-environment-flags": { 1023 | "version": "1.0.5", 1024 | "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.5.tgz", 1025 | "integrity": "sha512-VNYPRfGfmZLx0Ye20jWzHUjyTW/c+6Wq+iLhDzUI4XmhrDd9l/FozXV3F2xOaXjvp0co0+v1YSR3CMP6g+VvLQ==", 1026 | "dev": true, 1027 | "requires": { 1028 | "object.getownpropertydescriptors": "^2.0.3", 1029 | "semver": "^5.7.0" 1030 | } 1031 | }, 1032 | "object-inspect": { 1033 | "version": "1.8.0", 1034 | "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz", 1035 | "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==", 1036 | "dev": true 1037 | }, 1038 | "object-keys": { 1039 | "version": "1.1.1", 1040 | "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", 1041 | "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", 1042 | "dev": true 1043 | }, 1044 | "object.assign": { 1045 | "version": "4.1.0", 1046 | "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", 1047 | "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", 1048 | "dev": true, 1049 | "requires": { 1050 | "define-properties": "^1.1.2", 1051 | "function-bind": "^1.1.1", 1052 | "has-symbols": "^1.0.0", 1053 | "object-keys": "^1.0.11" 1054 | } 1055 | }, 1056 | "object.getownpropertydescriptors": { 1057 | "version": "2.1.0", 1058 | "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz", 1059 | "integrity": "sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg==", 1060 | "dev": true, 1061 | "requires": { 1062 | "define-properties": "^1.1.3", 1063 | "es-abstract": "^1.17.0-next.1" 1064 | } 1065 | }, 1066 | "once": { 1067 | "version": "1.4.0", 1068 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 1069 | "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", 1070 | "requires": { 1071 | "wrappy": "1" 1072 | } 1073 | }, 1074 | "p-limit": { 1075 | "version": "2.3.0", 1076 | "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", 1077 | "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", 1078 | "dev": true, 1079 | "requires": { 1080 | "p-try": "^2.0.0" 1081 | } 1082 | }, 1083 | "p-locate": { 1084 | "version": "3.0.0", 1085 | "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", 1086 | "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", 1087 | "dev": true, 1088 | "requires": { 1089 | "p-limit": "^2.0.0" 1090 | } 1091 | }, 1092 | "p-try": { 1093 | "version": "2.2.0", 1094 | "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", 1095 | "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", 1096 | "dev": true 1097 | }, 1098 | "parent-module": { 1099 | "version": "1.0.1", 1100 | "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", 1101 | "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", 1102 | "dev": true, 1103 | "requires": { 1104 | "callsites": "^3.0.0" 1105 | } 1106 | }, 1107 | "parse-json": { 1108 | "version": "5.1.0", 1109 | "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.1.0.tgz", 1110 | "integrity": "sha512-+mi/lmVVNKFNVyLXV31ERiy2CY5E1/F6QtJFEzoChPRwwngMNXRDQ9GJ5WdE2Z2P4AujsOi0/+2qHID68KwfIQ==", 1111 | "dev": true, 1112 | "requires": { 1113 | "@babel/code-frame": "^7.0.0", 1114 | "error-ex": "^1.3.1", 1115 | "json-parse-even-better-errors": "^2.3.0", 1116 | "lines-and-columns": "^1.1.6" 1117 | } 1118 | }, 1119 | "parse-passwd": { 1120 | "version": "1.0.0", 1121 | "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", 1122 | "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=", 1123 | "dev": true 1124 | }, 1125 | "path-exists": { 1126 | "version": "3.0.0", 1127 | "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", 1128 | "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", 1129 | "dev": true 1130 | }, 1131 | "path-is-absolute": { 1132 | "version": "1.0.1", 1133 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 1134 | "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" 1135 | }, 1136 | "path-parse": { 1137 | "version": "1.0.6", 1138 | "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", 1139 | "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", 1140 | "dev": true 1141 | }, 1142 | "path-type": { 1143 | "version": "4.0.0", 1144 | "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", 1145 | "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", 1146 | "dev": true 1147 | }, 1148 | "regenerator-runtime": { 1149 | "version": "0.13.7", 1150 | "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz", 1151 | "integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==", 1152 | "dev": true 1153 | }, 1154 | "require-directory": { 1155 | "version": "2.1.1", 1156 | "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", 1157 | "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", 1158 | "dev": true 1159 | }, 1160 | "require-main-filename": { 1161 | "version": "2.0.0", 1162 | "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", 1163 | "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", 1164 | "dev": true 1165 | }, 1166 | "resolve": { 1167 | "version": "1.19.0", 1168 | "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", 1169 | "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", 1170 | "dev": true, 1171 | "requires": { 1172 | "is-core-module": "^2.1.0", 1173 | "path-parse": "^1.0.6" 1174 | } 1175 | }, 1176 | "resolve-from": { 1177 | "version": "4.0.0", 1178 | "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", 1179 | "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", 1180 | "dev": true 1181 | }, 1182 | "safe-buffer": { 1183 | "version": "5.1.2", 1184 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 1185 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", 1186 | "dev": true 1187 | }, 1188 | "semver": { 1189 | "version": "5.7.1", 1190 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", 1191 | "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", 1192 | "dev": true 1193 | }, 1194 | "set-blocking": { 1195 | "version": "2.0.0", 1196 | "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", 1197 | "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", 1198 | "dev": true 1199 | }, 1200 | "source-map": { 1201 | "version": "0.5.7", 1202 | "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", 1203 | "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", 1204 | "dev": true 1205 | }, 1206 | "source-map-support": { 1207 | "version": "0.5.19", 1208 | "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", 1209 | "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", 1210 | "dev": true, 1211 | "requires": { 1212 | "buffer-from": "^1.0.0", 1213 | "source-map": "^0.6.0" 1214 | }, 1215 | "dependencies": { 1216 | "source-map": { 1217 | "version": "0.6.1", 1218 | "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", 1219 | "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", 1220 | "dev": true 1221 | } 1222 | } 1223 | }, 1224 | "sprintf-js": { 1225 | "version": "1.0.3", 1226 | "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", 1227 | "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", 1228 | "dev": true 1229 | }, 1230 | "string-width": { 1231 | "version": "2.1.1", 1232 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", 1233 | "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", 1234 | "dev": true, 1235 | "requires": { 1236 | "is-fullwidth-code-point": "^2.0.0", 1237 | "strip-ansi": "^4.0.0" 1238 | } 1239 | }, 1240 | "string.prototype.trimend": { 1241 | "version": "1.0.3", 1242 | "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.3.tgz", 1243 | "integrity": "sha512-ayH0pB+uf0U28CtjlLvL7NaohvR1amUvVZk+y3DYb0Ey2PUV5zPkkKy9+U1ndVEIXO8hNg18eIv9Jntbii+dKw==", 1244 | "dev": true, 1245 | "requires": { 1246 | "call-bind": "^1.0.0", 1247 | "define-properties": "^1.1.3" 1248 | } 1249 | }, 1250 | "string.prototype.trimstart": { 1251 | "version": "1.0.3", 1252 | "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.3.tgz", 1253 | "integrity": "sha512-oBIBUy5lea5tt0ovtOFiEQaBkoBBkyJhZXzJYrSmDo5IUUqbOPvVezuRs/agBIdZ2p2Eo1FD6bD9USyBLfl3xg==", 1254 | "dev": true, 1255 | "requires": { 1256 | "call-bind": "^1.0.0", 1257 | "define-properties": "^1.1.3" 1258 | } 1259 | }, 1260 | "strip-ansi": { 1261 | "version": "4.0.0", 1262 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", 1263 | "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", 1264 | "dev": true, 1265 | "requires": { 1266 | "ansi-regex": "^3.0.0" 1267 | } 1268 | }, 1269 | "strip-bom": { 1270 | "version": "3.0.0", 1271 | "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", 1272 | "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", 1273 | "dev": true 1274 | }, 1275 | "strip-json-comments": { 1276 | "version": "2.0.1", 1277 | "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", 1278 | "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", 1279 | "dev": true 1280 | }, 1281 | "supports-color": { 1282 | "version": "5.5.0", 1283 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", 1284 | "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", 1285 | "dev": true, 1286 | "requires": { 1287 | "has-flag": "^3.0.0" 1288 | } 1289 | }, 1290 | "to-fast-properties": { 1291 | "version": "2.0.0", 1292 | "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", 1293 | "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", 1294 | "dev": true 1295 | }, 1296 | "ts-interface-checker": { 1297 | "version": "1.0.0", 1298 | "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-1.0.0.tgz", 1299 | "integrity": "sha512-yUeWbFBDiwPodNqrqpvQpGWheL6PvNu2/pVAb9yy2vzdkkflCgwVA4U2akByPCXzYTum3/5/nB92yKuiLpSo/Q==", 1300 | "dev": true 1301 | }, 1302 | "ts-node": { 1303 | "version": "4.1.0", 1304 | "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-4.1.0.tgz", 1305 | "integrity": "sha512-xcZH12oVg9PShKhy3UHyDmuDLV3y7iKwX25aMVPt1SIXSuAfWkFiGPEkg+th8R4YKW/QCxDoW7lJdb15lx6QWg==", 1306 | "dev": true, 1307 | "requires": { 1308 | "arrify": "^1.0.0", 1309 | "chalk": "^2.3.0", 1310 | "diff": "^3.1.0", 1311 | "make-error": "^1.1.1", 1312 | "minimist": "^1.2.0", 1313 | "mkdirp": "^0.5.1", 1314 | "source-map-support": "^0.5.0", 1315 | "tsconfig": "^7.0.0", 1316 | "v8flags": "^3.0.0", 1317 | "yn": "^2.0.0" 1318 | } 1319 | }, 1320 | "tsconfig": { 1321 | "version": "7.0.0", 1322 | "resolved": "https://registry.npmjs.org/tsconfig/-/tsconfig-7.0.0.tgz", 1323 | "integrity": "sha512-vZXmzPrL+EmC4T/4rVlT2jNVMWCi/O4DIiSj3UHg1OE5kCKbk4mfrXc6dZksLgRM/TZlKnousKH9bbTazUWRRw==", 1324 | "dev": true, 1325 | "requires": { 1326 | "@types/strip-bom": "^3.0.0", 1327 | "@types/strip-json-comments": "0.0.30", 1328 | "strip-bom": "^3.0.0", 1329 | "strip-json-comments": "^2.0.0" 1330 | } 1331 | }, 1332 | "typescript": { 1333 | "version": "3.9.7", 1334 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz", 1335 | "integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==" 1336 | }, 1337 | "universalify": { 1338 | "version": "0.1.2", 1339 | "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", 1340 | "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" 1341 | }, 1342 | "v8flags": { 1343 | "version": "3.2.0", 1344 | "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.2.0.tgz", 1345 | "integrity": "sha512-mH8etigqMfiGWdeXpaaqGfs6BndypxusHHcv2qSHyZkGEznCd/qAXCWWRzeowtL54147cktFOC4P5y+kl8d8Jg==", 1346 | "dev": true, 1347 | "requires": { 1348 | "homedir-polyfill": "^1.0.1" 1349 | } 1350 | }, 1351 | "which": { 1352 | "version": "1.3.1", 1353 | "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", 1354 | "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", 1355 | "dev": true, 1356 | "requires": { 1357 | "isexe": "^2.0.0" 1358 | } 1359 | }, 1360 | "which-module": { 1361 | "version": "2.0.0", 1362 | "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", 1363 | "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", 1364 | "dev": true 1365 | }, 1366 | "wide-align": { 1367 | "version": "1.1.3", 1368 | "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", 1369 | "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", 1370 | "dev": true, 1371 | "requires": { 1372 | "string-width": "^1.0.2 || 2" 1373 | } 1374 | }, 1375 | "wrap-ansi": { 1376 | "version": "5.1.0", 1377 | "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", 1378 | "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", 1379 | "dev": true, 1380 | "requires": { 1381 | "ansi-styles": "^3.2.0", 1382 | "string-width": "^3.0.0", 1383 | "strip-ansi": "^5.0.0" 1384 | }, 1385 | "dependencies": { 1386 | "ansi-regex": { 1387 | "version": "4.1.0", 1388 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", 1389 | "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", 1390 | "dev": true 1391 | }, 1392 | "string-width": { 1393 | "version": "3.1.0", 1394 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", 1395 | "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", 1396 | "dev": true, 1397 | "requires": { 1398 | "emoji-regex": "^7.0.1", 1399 | "is-fullwidth-code-point": "^2.0.0", 1400 | "strip-ansi": "^5.1.0" 1401 | } 1402 | }, 1403 | "strip-ansi": { 1404 | "version": "5.2.0", 1405 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", 1406 | "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", 1407 | "dev": true, 1408 | "requires": { 1409 | "ansi-regex": "^4.1.0" 1410 | } 1411 | } 1412 | } 1413 | }, 1414 | "wrappy": { 1415 | "version": "1.0.2", 1416 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 1417 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" 1418 | }, 1419 | "y18n": { 1420 | "version": "4.0.0", 1421 | "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", 1422 | "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", 1423 | "dev": true 1424 | }, 1425 | "yaml": { 1426 | "version": "1.10.0", 1427 | "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.0.tgz", 1428 | "integrity": "sha512-yr2icI4glYaNG+KWONODapy2/jDdMSDnrONSjblABjD9B4Z5LgiircSt8m8sRZFNi08kG9Sm0uSHtEmP3zaEGg==", 1429 | "dev": true 1430 | }, 1431 | "yargs": { 1432 | "version": "13.3.2", 1433 | "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", 1434 | "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", 1435 | "dev": true, 1436 | "requires": { 1437 | "cliui": "^5.0.0", 1438 | "find-up": "^3.0.0", 1439 | "get-caller-file": "^2.0.1", 1440 | "require-directory": "^2.1.1", 1441 | "require-main-filename": "^2.0.0", 1442 | "set-blocking": "^2.0.0", 1443 | "string-width": "^3.0.0", 1444 | "which-module": "^2.0.0", 1445 | "y18n": "^4.0.0", 1446 | "yargs-parser": "^13.1.2" 1447 | }, 1448 | "dependencies": { 1449 | "ansi-regex": { 1450 | "version": "4.1.0", 1451 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", 1452 | "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", 1453 | "dev": true 1454 | }, 1455 | "string-width": { 1456 | "version": "3.1.0", 1457 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", 1458 | "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", 1459 | "dev": true, 1460 | "requires": { 1461 | "emoji-regex": "^7.0.1", 1462 | "is-fullwidth-code-point": "^2.0.0", 1463 | "strip-ansi": "^5.1.0" 1464 | } 1465 | }, 1466 | "strip-ansi": { 1467 | "version": "5.2.0", 1468 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", 1469 | "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", 1470 | "dev": true, 1471 | "requires": { 1472 | "ansi-regex": "^4.1.0" 1473 | } 1474 | } 1475 | } 1476 | }, 1477 | "yargs-parser": { 1478 | "version": "13.1.2", 1479 | "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", 1480 | "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", 1481 | "dev": true, 1482 | "requires": { 1483 | "camelcase": "^5.0.0", 1484 | "decamelize": "^1.2.0" 1485 | } 1486 | }, 1487 | "yargs-unparser": { 1488 | "version": "1.6.0", 1489 | "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.0.tgz", 1490 | "integrity": "sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw==", 1491 | "dev": true, 1492 | "requires": { 1493 | "flat": "^4.1.0", 1494 | "lodash": "^4.17.15", 1495 | "yargs": "^13.3.0" 1496 | } 1497 | }, 1498 | "yn": { 1499 | "version": "2.0.0", 1500 | "resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz", 1501 | "integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=", 1502 | "dev": true 1503 | } 1504 | } 1505 | } 1506 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ts-interface-builder", 3 | "version": "0.3.3", 4 | "description": "Compile TypeScript interfaces into a description that allows runtime validation", 5 | "main": "dist/index", 6 | "typings": "dist/index", 7 | "bin": { 8 | "ts-interface-builder": "bin/ts-interface-builder" 9 | }, 10 | "scripts": { 11 | "build": "tsc", 12 | "watch": "tsc -w", 13 | "test-only": "mocha 'test/*.ts'", 14 | "test": "npm run build && npm run test-only", 15 | "prepack": "npm run test" 16 | }, 17 | "keywords": [ 18 | "typescript", 19 | "ts", 20 | "interface", 21 | "type", 22 | "validate", 23 | "validator", 24 | "check", 25 | "babel-plugin-macros" 26 | ], 27 | "author": "Dmitry S, Grist Labs", 28 | "contributors": [ 29 | "Matthew Francis Brunetti (https://github.com/zenflow)" 30 | ], 31 | "license": "Apache-2.0", 32 | "repository": { 33 | "type": "git", 34 | "url": "https://github.com/gristlabs/ts-interface-builder" 35 | }, 36 | "bugs": { 37 | "url": "https://github.com/gristlabs/ts-interface-builder/issues" 38 | }, 39 | "files": [ 40 | "dist", 41 | "bin", 42 | "macro.js", 43 | "macro.d.ts" 44 | ], 45 | "dependencies": { 46 | "commander": "^2.12.2", 47 | "fs-extra": "^4.0.3", 48 | "typescript": "^3.0.0", 49 | "glob": "^7.1.6" 50 | }, 51 | "devDependencies": { 52 | "@babel/core": "^7.10.5", 53 | "@types/babel-plugin-macros": "^2.8.2", 54 | "@types/fs-extra": "^4.0.5", 55 | "@types/glob": "^7.1.3", 56 | "@types/mocha": "^5.2.7", 57 | "@types/node": "^8.10.66", 58 | "babel-plugin-macros": "^2.8.0", 59 | "fs-extra": "^4.0.3", 60 | "mocha": "^6.2.0", 61 | "ts-interface-checker": "^1.0.0", 62 | "ts-node": "^4.0.1" 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /test/fixtures/array-ti.ts: -------------------------------------------------------------------------------- 1 | import * as t from "ts-interface-checker"; 2 | // tslint:disable:object-literal-key-quotes 3 | 4 | export const IMyArrayContainer = t.iface([], { 5 | "myArray": t.array("number"), 6 | "myArray2": t.array(t.iface([], { 7 | "foo": "string", 8 | "bar": "number", 9 | })), 10 | "myArray3": t.array("number"), 11 | "myArray4": t.tuple("number"), 12 | "myArray5": t.tuple("number", "number"), 13 | "myArray6": t.tuple("number", t.union("number", "undefined")), 14 | "myArray7": t.tuple("number", t.opt("number")), 15 | }); 16 | 17 | const exportedTypeSuite: t.ITypeSuite = { 18 | IMyArrayContainer, 19 | }; 20 | export default exportedTypeSuite; 21 | -------------------------------------------------------------------------------- /test/fixtures/array.ts: -------------------------------------------------------------------------------- 1 | export interface IMyArrayContainer { 2 | myArray: Array; 3 | myArray2: Array<{foo: string, bar: number}>; 4 | myArray3: number[]; 5 | myArray4: [number]; 6 | myArray5: [number, number]; 7 | myArray6: [number, number | undefined]; 8 | myArray7: [number, number?]; 9 | } 10 | -------------------------------------------------------------------------------- /test/fixtures/ignore-generics-ti.ts: -------------------------------------------------------------------------------- 1 | import * as t from "ts-interface-checker"; 2 | // tslint:disable:object-literal-key-quotes 3 | 4 | export const ITest = t.iface([], { 5 | "myGeneric": "any", 6 | }); 7 | 8 | export const IMyType = t.iface([], { 9 | "value": "T", 10 | }); 11 | 12 | const exportedTypeSuite: t.ITypeSuite = { 13 | ITest, 14 | IMyType, 15 | }; 16 | export default exportedTypeSuite; 17 | -------------------------------------------------------------------------------- /test/fixtures/ignore-generics.ts: -------------------------------------------------------------------------------- 1 | export interface ITest { 2 | myGeneric: IMyType; 3 | } 4 | 5 | export interface IMyType { 6 | value: T; 7 | } 8 | -------------------------------------------------------------------------------- /test/fixtures/ignore-index-signature-ti.ts: -------------------------------------------------------------------------------- 1 | import * as t from "ts-interface-checker"; 2 | // tslint:disable:object-literal-key-quotes 3 | 4 | export const ITest = t.iface([], { 5 | }); 6 | 7 | export const INestedLiteralIndexSignature = t.iface([], { 8 | "nestedIndexSignature": t.iface([], { 9 | }), 10 | }); 11 | 12 | const exportedTypeSuite: t.ITypeSuite = { 13 | ITest, 14 | INestedLiteralIndexSignature, 15 | }; 16 | export default exportedTypeSuite; 17 | -------------------------------------------------------------------------------- /test/fixtures/ignore-index-signature.ts: -------------------------------------------------------------------------------- 1 | export interface ITest { 2 | [extra: string]: any; 3 | } 4 | 5 | export interface INestedLiteralIndexSignature { 6 | nestedIndexSignature: { 7 | [key: string]: string | number | boolean; 8 | } 9 | } -------------------------------------------------------------------------------- /test/fixtures/imports-child-a.ts: -------------------------------------------------------------------------------- 1 | export interface TypeA {}; 2 | -------------------------------------------------------------------------------- /test/fixtures/imports-child-b.ts: -------------------------------------------------------------------------------- 1 | export interface TypeB { }; 2 | 3 | // import and export on separate lines 4 | import { TypeC } from './imports-child-c'; 5 | export { TypeC }; 6 | 7 | // inline export shorthand 8 | export { TypeD } from './imports-child-d'; 9 | -------------------------------------------------------------------------------- /test/fixtures/imports-child-c.ts: -------------------------------------------------------------------------------- 1 | export interface TypeC {}; 2 | -------------------------------------------------------------------------------- /test/fixtures/imports-child-d.ts: -------------------------------------------------------------------------------- 1 | export interface TypeD {}; 2 | -------------------------------------------------------------------------------- /test/fixtures/imports-parent-shallow-ti.ts: -------------------------------------------------------------------------------- 1 | import * as t from "ts-interface-checker"; 2 | // tslint:disable:object-literal-key-quotes 3 | 4 | export const TypeAll = t.iface([], { 5 | "a": "TypeA", 6 | "b": "TypeB", 7 | "c": "TypeC", 8 | "d": "TypeD", 9 | }); 10 | 11 | const exportedTypeSuite: t.ITypeSuite = { 12 | TypeAll, 13 | }; 14 | export default exportedTypeSuite; 15 | -------------------------------------------------------------------------------- /test/fixtures/imports-parent-ti.ts: -------------------------------------------------------------------------------- 1 | import * as t from "ts-interface-checker"; 2 | // tslint:disable:object-literal-key-quotes 3 | 4 | export const TypeA = t.iface([], { 5 | }); 6 | 7 | export const TypeB = t.iface([], { 8 | }); 9 | 10 | export const TypeC = t.iface([], { 11 | }); 12 | 13 | export const TypeD = t.iface([], { 14 | }); 15 | 16 | export const TypeAll = t.iface([], { 17 | "a": "TypeA", 18 | "b": "TypeB", 19 | "c": "TypeC", 20 | "d": "TypeD", 21 | }); 22 | 23 | const exportedTypeSuite: t.ITypeSuite = { 24 | TypeA, 25 | TypeB, 26 | TypeC, 27 | TypeD, 28 | TypeAll, 29 | }; 30 | export default exportedTypeSuite; 31 | -------------------------------------------------------------------------------- /test/fixtures/imports-parent.ts: -------------------------------------------------------------------------------- 1 | import { TypeA } from './imports-child-a'; 2 | import { TypeB, TypeC, TypeD } from './imports-child-b'; 3 | 4 | export interface TypeAll { 5 | a: TypeA, 6 | b: TypeB, 7 | c: TypeC, 8 | d: TypeD 9 | } -------------------------------------------------------------------------------- /test/fixtures/index-signature-ti.ts: -------------------------------------------------------------------------------- 1 | import * as t from "ts-interface-checker"; 2 | // tslint:disable:object-literal-key-quotes 3 | 4 | export const SquareConfig = t.iface([], { 5 | "color": "string", 6 | "width": t.opt("number"), 7 | [t.indexKey]: "any", 8 | }); 9 | 10 | export const IndexSignatures = t.iface([], { 11 | "data": t.iface([], { 12 | [t.indexKey]: t.array("number"), 13 | }), 14 | }); 15 | 16 | export const CellValue = t.union("number", "string", "boolean", "null", t.tuple("string", t.rest(t.array("unknown")))); 17 | 18 | export const RowRecord = t.iface([], { 19 | "id": "number", 20 | [t.indexKey]: "CellValue", 21 | }); 22 | 23 | const exportedTypeSuite: t.ITypeSuite = { 24 | SquareConfig, 25 | IndexSignatures, 26 | CellValue, 27 | RowRecord, 28 | }; 29 | export default exportedTypeSuite; 30 | -------------------------------------------------------------------------------- /test/fixtures/index-signature.ts: -------------------------------------------------------------------------------- 1 | export interface SquareConfig { 2 | color: string; 3 | width?: number; 4 | [propName: string]: any; 5 | } 6 | 7 | export interface IndexSignatures { 8 | data: {[index: number]: number[]}; 9 | } 10 | 11 | export type CellValue = number|string|boolean|null|[string, ...unknown[]]; 12 | 13 | export interface RowRecord { 14 | id: number; 15 | [colId: string]: CellValue; 16 | } 17 | -------------------------------------------------------------------------------- /test/fixtures/intersection-ti.ts: -------------------------------------------------------------------------------- 1 | import * as t from "ts-interface-checker"; 2 | // tslint:disable:object-literal-key-quotes 3 | 4 | export const Wheels = t.iface([], { 5 | "numWheels": "number", 6 | }); 7 | 8 | export const Doors = t.iface([], { 9 | "numDoors": "number", 10 | }); 11 | 12 | export const Car = t.intersection("Wheels", "Doors"); 13 | 14 | export const House = t.intersection("Doors", t.iface([], { 15 | "numRooms": "number", 16 | }), "object"); 17 | 18 | const exportedTypeSuite: t.ITypeSuite = { 19 | Wheels, 20 | Doors, 21 | Car, 22 | House, 23 | }; 24 | export default exportedTypeSuite; 25 | -------------------------------------------------------------------------------- /test/fixtures/intersection.ts: -------------------------------------------------------------------------------- 1 | interface Wheels { 2 | numWheels: number 3 | } 4 | 5 | interface Doors { 6 | numDoors: number 7 | } 8 | 9 | export type Car = Wheels & Doors 10 | 11 | export type House = Doors & { 12 | numRooms: number 13 | } & object 14 | -------------------------------------------------------------------------------- /test/fixtures/macro-error-compiling.ts: -------------------------------------------------------------------------------- 1 | import { getCheckers } from "../../macro"; 2 | 3 | getCheckers("./ignore-generics.ts"); 4 | -------------------------------------------------------------------------------- /test/fixtures/macro-error-evaluating-arguments.ts: -------------------------------------------------------------------------------- 1 | import { join } from "path"; 2 | import { getCheckers } from "../../macro"; 3 | 4 | getCheckers(join(__dirname, "foo.ts")); 5 | -------------------------------------------------------------------------------- /test/fixtures/macro-error-reference-not-called.ts: -------------------------------------------------------------------------------- 1 | import { getCheckers } from "../../macro"; 2 | 3 | const foo = getCheckers; 4 | 5 | foo("foo.ts"); 6 | -------------------------------------------------------------------------------- /test/fixtures/macro-locals.js: -------------------------------------------------------------------------------- 1 | import * as t from "ts-interface-checker"; 2 | 3 | function once(fn) { 4 | var result; 5 | return function () { 6 | return result || (result = fn()); 7 | }; 8 | } 9 | 10 | var typeSuite0 = once(function () { 11 | return { 12 | LocalInterface: t.iface([], { 13 | "foo": "number" 14 | }) 15 | }; 16 | }); 17 | var checkerSuite0 = once(function () { 18 | return t.createCheckers(typeSuite0()); 19 | }); 20 | var _t = null; 21 | export { _t as t }; 22 | var _once = null; 23 | export { _once as once }; 24 | 25 | var _typeSuite = typeSuite0(); 26 | 27 | export { _typeSuite as typeSuite0 }; 28 | export function getTypeSuite0() { 29 | var _typeSuite2 = typeSuite0(); 30 | 31 | return _typeSuite2; 32 | } 33 | 34 | var _checkerSuite = checkerSuite0(); 35 | 36 | export { _checkerSuite as checkerSuite0 }; 37 | export function getCheckerSuite0() { 38 | var _checkerSuite2 = checkerSuite0(); 39 | 40 | return _checkerSuite2; 41 | } -------------------------------------------------------------------------------- /test/fixtures/macro-locals.ts: -------------------------------------------------------------------------------- 1 | import { getTypeSuite, getCheckers } from "../../macro"; 2 | 3 | export const t = null; 4 | export const once = null; 5 | 6 | // @ts-ignore-rule 7 | interface LocalInterface { 8 | // does not need to be exported 9 | foo: number; 10 | } 11 | 12 | export const typeSuite0 = getTypeSuite(undefined, { inlineImports: false }); 13 | 14 | export function getTypeSuite0() { 15 | const typeSuite0 = getTypeSuite(undefined, { inlineImports: false }); 16 | return typeSuite0; 17 | } 18 | 19 | export const checkerSuite0 = getCheckers(undefined, { inlineImports: false }); 20 | 21 | export function getCheckerSuite0() { 22 | const checkerSuite0 = getCheckers(undefined, { inlineImports: false }); 23 | return checkerSuite0; 24 | } 25 | -------------------------------------------------------------------------------- /test/fixtures/macro-options.js: -------------------------------------------------------------------------------- 1 | import * as t from "ts-interface-checker"; 2 | 3 | function once(fn) { 4 | var result; 5 | return function () { 6 | return result || (result = fn()); 7 | }; 8 | } 9 | 10 | var typeSuite0 = once(function () { 11 | return { 12 | TypeA: t.iface([], {}), 13 | TypeB: t.iface([], {}), 14 | TypeC: t.iface([], {}), 15 | TypeD: t.iface([], {}), 16 | TypeAll: t.iface([], { 17 | "a": "TypeA", 18 | "b": "TypeB", 19 | "c": "TypeC", 20 | "d": "TypeD" 21 | }) 22 | }; 23 | }); 24 | var typeSuite1 = once(function () { 25 | return { 26 | TypeAll: t.iface([], { 27 | "a": "TypeA", 28 | "b": "TypeB", 29 | "c": "TypeC", 30 | "d": "TypeD" 31 | }) 32 | }; 33 | }); 34 | var checkerSuite0 = once(function () { 35 | return t.createCheckers(typeSuite0()); 36 | }); 37 | var checkerSuite1 = once(function () { 38 | return t.createCheckers(typeSuite1()); 39 | }); 40 | // Note: default options defined in babel plugin options in ../test_macro.ts 41 | var dir = "."; 42 | var file = dir + "/imports-parent.ts"; 43 | export var checkersUsingDefaultOptions = checkerSuite0(); 44 | export var checkersWithInlineOptions = checkerSuite1(); -------------------------------------------------------------------------------- /test/fixtures/macro-options.ts: -------------------------------------------------------------------------------- 1 | import { getCheckers } from "../../macro"; 2 | // Note: default options defined in babel plugin options in ../test_macro.ts 3 | 4 | const dir = "."; 5 | const file = `${dir}/imports-parent.ts`; 6 | 7 | export const checkersUsingDefaultOptions = getCheckers(file); 8 | 9 | export const checkersWithInlineOptions = getCheckers(file, { 10 | inlineImports: false, 11 | }); 12 | -------------------------------------------------------------------------------- /test/fixtures/promises-ti.ts: -------------------------------------------------------------------------------- 1 | import * as t from "ts-interface-checker"; 2 | // tslint:disable:object-literal-key-quotes 3 | 4 | export const ILRUCache = t.iface([], { 5 | "capacity": "number", 6 | "isReady": "boolean", 7 | "set": t.func("boolean", t.param("item", "ICacheItem"), t.param("overwrite", "boolean", true)), 8 | "get": t.func("ICacheItem", t.param("key", "string")), 9 | }); 10 | 11 | const exportedTypeSuite: t.ITypeSuite = { 12 | ILRUCache, 13 | }; 14 | export default exportedTypeSuite; 15 | -------------------------------------------------------------------------------- /test/fixtures/promises.ts: -------------------------------------------------------------------------------- 1 | interface ILRUCache { 2 | capacity: number; 3 | isReady: Promise; 4 | set(item: ICacheItem, overwrite?: boolean): Promise; 5 | get(key: string): Promise; 6 | } 7 | -------------------------------------------------------------------------------- /test/fixtures/sample-ti.ts: -------------------------------------------------------------------------------- 1 | import * as t from "ts-interface-checker"; 2 | // tslint:disable:object-literal-key-quotes 3 | 4 | export const ICacheItem = t.iface([], { 5 | "key": "string", 6 | "value": "any", 7 | "size": "number", 8 | "tag": t.opt("string"), 9 | }); 10 | 11 | export const ILRUCache = t.iface([], { 12 | "capacity": "number", 13 | "set": t.func("boolean", t.param("item", "ICacheItem"), t.param("overwrite", "boolean", true)), 14 | "get": t.func("ICacheItem", t.param("key", "string")), 15 | }); 16 | 17 | export const MyType = t.union("boolean", "number", "ILRUCache"); 18 | 19 | export const NumberAlias = t.name("number"); 20 | 21 | export const NumberAlias2 = t.name("NumberAlias"); 22 | 23 | export const SomeEnum = t.enumtype({ 24 | "Foo": 0, 25 | "Bar": 1, 26 | }); 27 | 28 | export const Direction = t.enumtype({ 29 | "Up": 1, 30 | "Down": 2, 31 | "Left": 17, 32 | "Right": 18, 33 | }); 34 | 35 | export const DirectionStr = t.enumtype({ 36 | "Up": "UP", 37 | "Down": "DOWN", 38 | "Left": "LEFT", 39 | "Right": "RIGHT", 40 | }); 41 | 42 | export const BooleanLikeHeterogeneousEnum = t.enumtype({ 43 | "No": 0, 44 | "Yes": "YES", 45 | }); 46 | 47 | export const EnumComputed = t.enumtype({ 48 | "Foo": 0, 49 | "Bar": 17, 50 | "Baz": 16, 51 | }); 52 | 53 | export const AnimalFlags = t.enumtype({ 54 | "None": 0, 55 | "HasClaws": 1, 56 | "CanFly": 2, 57 | "EatsFish": 4, 58 | "Endangered": 8, 59 | }); 60 | 61 | export const ISampling = t.iface(["ICacheItem"], { 62 | "xstring": "string", 63 | "xstring2": "string", 64 | "xany": "any", 65 | "xnumber": "number", 66 | "xnumber2": t.opt("number"), 67 | "xNumberAlias": "NumberAlias", 68 | "xNumberAlias2": "NumberAlias2", 69 | "xnull": "null", 70 | "xMyType": "MyType", 71 | "xarray": t.array("string"), 72 | "xarray2": t.array("MyType"), 73 | "xtuple": t.tuple("string", "number"), 74 | "xunion": t.union("number", "null"), 75 | "xparen": t.union("number", "string"), 76 | "xiface": t.iface([], { 77 | "foo": "string", 78 | "bar": "number", 79 | }), 80 | "xliteral": t.union(t.lit("foo"), t.lit("ba\"r"), t.lit(3)), 81 | "xfunc": t.func("number", t.param("price", "number"), t.param("quantity", "number")), 82 | "xfunc2": t.func("number", t.param("price", "number"), t.param("quantity", "number", true)), 83 | "xDirection": "Direction", 84 | "xDirectionStr": "DirectionStr", 85 | "xDirUp": t.union(t.enumlit("Direction", "Up"), t.enumlit("Direction", "Left")), 86 | "xDirStrLeft": t.enumlit("DirectionStr", "Left"), 87 | "ximplicit": "any", 88 | "ximplicitFunc": t.func("number", t.param("price", "any")), 89 | "ximplicitFunc2": t.func("any", t.param("price", "any")), 90 | }); 91 | 92 | const exportedTypeSuite: t.ITypeSuite = { 93 | ICacheItem, 94 | ILRUCache, 95 | MyType, 96 | NumberAlias, 97 | NumberAlias2, 98 | SomeEnum, 99 | Direction, 100 | DirectionStr, 101 | BooleanLikeHeterogeneousEnum, 102 | EnumComputed, 103 | AnimalFlags, 104 | ISampling, 105 | }; 106 | export default exportedTypeSuite; 107 | -------------------------------------------------------------------------------- /test/fixtures/sample.ts: -------------------------------------------------------------------------------- 1 | interface ICacheItem { 2 | key: string; 3 | value: any; 4 | size: number; 5 | tag?: string; 6 | } 7 | 8 | interface ILRUCache { 9 | capacity: number; 10 | set(item: ICacheItem, overwrite?: boolean): boolean; 11 | get(key: string): ICacheItem; 12 | } 13 | 14 | type MyType = boolean | number | ILRUCache; 15 | 16 | export type NumberAlias = number; 17 | export type NumberAlias2 = NumberAlias; 18 | 19 | export function foo() { 20 | process.stdout.write("bar\n"); 21 | } 22 | 23 | // A few enum kinds. 24 | export enum SomeEnum { Foo, Bar } 25 | export enum Direction { Up = 1, Down, Left = 17, Right } 26 | export enum DirectionStr { 27 | Up = "UP", 28 | Down = "DOWN", 29 | Left = "LEFT", 30 | Right = "RIGHT", 31 | } 32 | export enum BooleanLikeHeterogeneousEnum { No = 0, Yes = "YES" } 33 | export enum EnumComputed { Foo, Bar = Direction.Left, Baz = Bar - 1 } 34 | export enum AnimalFlags { 35 | None = 0, 36 | HasClaws = 1 << 0, 37 | CanFly = 1 << 1, 38 | EatsFish = 1 << 2, 39 | Endangered = 1 << 3 40 | } 41 | 42 | // random comment. 43 | export interface ISampling extends ICacheItem { 44 | xstring: string; 45 | "xstring2": string; 46 | xany: any; 47 | xnumber: number; 48 | xnumber2?: number; 49 | xNumberAlias: NumberAlias; 50 | xNumberAlias2: NumberAlias2; 51 | xnull: null; 52 | /* more random comments */ 53 | xMyType: MyType; 54 | xarray: string[]; 55 | xarray2: MyType[]; 56 | xtuple: [string, number]; 57 | xunion: number | null; 58 | xparen: (number|string); // parenthesized type 59 | xiface: { foo: string; bar: number }; 60 | xliteral: "foo" | "ba\"r" | 3; 61 | xfunc: (price: number, quantity: number) => number; 62 | xfunc2(price: number, quantity?: number): number; 63 | xDirection: Direction; 64 | xDirectionStr: DirectionStr; 65 | // Ensure we support enum constants, often used for discriminated unions. 66 | xDirUp: Direction.Up | Direction.Left; 67 | xDirStrLeft: DirectionStr.Left; 68 | 69 | // Ensure that omitted type parameters are seen as "any", without causing errors. 70 | ximplicit; 71 | ximplicitFunc: (price) => number; 72 | ximplicitFunc2(price); 73 | } 74 | -------------------------------------------------------------------------------- /test/fixtures/to-javascript-ti.cjs.js: -------------------------------------------------------------------------------- 1 | const t = require("ts-interface-checker"); 2 | 3 | module.exports = { 4 | SomeInterface: t.iface([], { 5 | "foo": "number", 6 | }), 7 | 8 | SomeEnum: t.enumtype({ 9 | "Foo": 0, 10 | }), 11 | 12 | SomeAlias: t.name("number"), 13 | }; 14 | -------------------------------------------------------------------------------- /test/fixtures/to-javascript-ti.esm.js: -------------------------------------------------------------------------------- 1 | import * as t from "ts-interface-checker"; 2 | 3 | export const SomeInterface = t.iface([], { 4 | "foo": "number", 5 | }); 6 | 7 | export const SomeEnum = t.enumtype({ 8 | "Foo": 0, 9 | }); 10 | 11 | export const SomeAlias = t.name("number"); 12 | 13 | const exportedTypeSuite = { 14 | SomeInterface, 15 | SomeEnum, 16 | SomeAlias, 17 | }; 18 | export default exportedTypeSuite; 19 | -------------------------------------------------------------------------------- /test/fixtures/to-javascript.ts: -------------------------------------------------------------------------------- 1 | export interface SomeInterface { 2 | foo: number 3 | } 4 | 5 | export enum SomeEnum { Foo } 6 | 7 | export type SomeAlias = number; 8 | -------------------------------------------------------------------------------- /test/mocha.opts: -------------------------------------------------------------------------------- 1 | --require ts-node/register 2 | -------------------------------------------------------------------------------- /test/test_index.ts: -------------------------------------------------------------------------------- 1 | import * as assert from "assert"; 2 | import {readFile} from "fs-extra"; 3 | import {join} from "path"; 4 | import {Compiler} from "../lib/index"; 5 | 6 | const fixtures = join(__dirname, "fixtures"); 7 | 8 | describe("ts-interface-builder", () => { 9 | it("should compile interface to runtime code", async () => { 10 | const output = await Compiler.compile(join(fixtures, "sample.ts")); 11 | const expected = await readFile(join(fixtures, "sample-ti.ts"), {encoding: "utf8"}); 12 | assert.deepEqual(output, expected); 13 | }); 14 | 15 | it("should strip out promises", async () => { 16 | const output = await Compiler.compile(join(fixtures, "promises.ts")); 17 | const expected = await readFile(join(fixtures, "promises-ti.ts"), {encoding: "utf8"}); 18 | assert.deepEqual(output, expected); 19 | }); 20 | 21 | it("should ignore generics", async () => { 22 | const output = await Compiler.compile(join(fixtures, "ignore-generics.ts"), 23 | {ignoreGenerics: true}); 24 | const expected = await readFile(join(fixtures, "ignore-generics-ti.ts"), {encoding: "utf8"}); 25 | assert.deepEqual(output, expected); 26 | }); 27 | 28 | it("should support index signature", async () => { 29 | const output = await Compiler.compile(join(fixtures, "index-signature.ts")); 30 | const expected = await readFile(join(fixtures, "index-signature-ti.ts"), {encoding: "utf8"}); 31 | assert.deepEqual(output, expected); 32 | }); 33 | 34 | it("should ignore index signature if requested", async () => { 35 | const output = await Compiler.compile(join(fixtures, "ignore-index-signature.ts"), 36 | {ignoreIndexSignature: true}); 37 | const expected = await readFile(join(fixtures, "ignore-index-signature-ti.ts"), {encoding: "utf8"}); 38 | assert.deepEqual(output, expected); 39 | }); 40 | 41 | it("should compile Array", async () => { 42 | const output = await Compiler.compile(join(fixtures, "array.ts")); 43 | const expected = await readFile(join(fixtures, "array-ti.ts"), {encoding: "utf8"}); 44 | assert.deepEqual(output, expected); 45 | }); 46 | 47 | it("should compile intersection types", async() => { 48 | const output = await Compiler.compile(join(fixtures, "intersection.ts")); 49 | const expected = await readFile(join(fixtures, "intersection-ti.ts"), {encoding: "utf8"}); 50 | assert.deepEqual(output, expected); 51 | }) 52 | 53 | it("should inline imports", async () => { 54 | const output = await Compiler.compile(join(fixtures, "imports-parent.ts"), 55 | {inlineImports: true}); 56 | const expected = await readFile(join(fixtures, "imports-parent-ti.ts"), { encoding: "utf8" }); 57 | assert.deepEqual(output, expected); 58 | }); 59 | 60 | it("should not inline imports when option is not set", async () => { 61 | const output = await Compiler.compile(join(fixtures, "imports-parent.ts")); 62 | const expected = await readFile(join(fixtures, "imports-parent-shallow-ti.ts"), { encoding: "utf8" }); 63 | assert.deepEqual(output, expected); 64 | }); 65 | 66 | it("should compile to JS in esm module format", async () => { 67 | const output = await Compiler.compile(join(fixtures, "to-javascript.ts"), 68 | {format: 'js:esm'}); 69 | const expected = await readFile(join(fixtures, "to-javascript-ti.esm.js"), {encoding: "utf8"}); 70 | assert.equal(output, expected); 71 | }); 72 | 73 | it("should compile to JS in cjs module format", async () => { 74 | const output = await Compiler.compile(join(fixtures, "to-javascript.ts"), 75 | {format: 'js:cjs'}); 76 | const expected = await readFile(join(fixtures, "to-javascript-ti.cjs.js"), {encoding: "utf8"}); 77 | assert.equal(output, expected); 78 | }); 79 | }); 80 | -------------------------------------------------------------------------------- /test/test_macro.ts: -------------------------------------------------------------------------------- 1 | const UPDATE_SNAPSHOTS = false; 2 | 3 | import * as assert from "assert"; 4 | import { readFile, writeFile } from "fs-extra"; 5 | import { join } from "path"; 6 | import * as ts from "typescript"; 7 | import * as babel from "@babel/core"; 8 | import * as macroPlugin from "babel-plugin-macros"; 9 | 10 | const fixtures = join(__dirname, "fixtures"); 11 | 12 | async function snapshot(output: string, snapshotFile: string) { 13 | if (UPDATE_SNAPSHOTS) { 14 | await writeFile(join(fixtures, snapshotFile), output); 15 | } else { 16 | const snapshot = ( 17 | await readFile(join(fixtures, snapshotFile), { encoding: "utf8" }) 18 | ).trim(); 19 | assert.equal(output, snapshot); 20 | } 21 | } 22 | 23 | describe("ts-interface-builder/macro", () => { 24 | it("locals", async function () { 25 | this.timeout(5000); 26 | const file = join(fixtures, "macro-locals.ts"); 27 | const output = babelCompile( 28 | tsCompile(await readFile(file, { encoding: "utf8" })), 29 | file 30 | ); 31 | await snapshot(output, "macro-locals.js"); 32 | }); 33 | it("options", async function () { 34 | this.timeout(5000); 35 | const file = join(fixtures, "macro-options.ts"); 36 | const output = babelCompile( 37 | tsCompile(await readFile(file, { encoding: "utf8" })), 38 | file 39 | ); 40 | await snapshot(output, "macro-options.js"); 41 | }); 42 | it("error reference not called", async function () { 43 | const file = join(fixtures, "macro-error-reference-not-called.ts"); 44 | const tsOutput = tsCompile(await readFile(file, { encoding: "utf8" })); 45 | assert.throws(() => babelCompile(tsOutput, file), { 46 | name: "MacroError", 47 | message: `${file}: ts-interface-builder/macro: Reference 1 to getCheckers not used for a call expression`, 48 | } as any); 49 | }); 50 | it("error evaluating arguments", async function () { 51 | const file = join(fixtures, "macro-error-evaluating-arguments.ts"); 52 | const tsOutput = tsCompile(await readFile(file, { encoding: "utf8" })); 53 | assert.throws(() => babelCompile(tsOutput, file), { 54 | name: "MacroError", 55 | message: `${file}: ts-interface-builder/macro: Unable to evaluate argument 1 of getCheckers call 1`, 56 | } as any); 57 | }); 58 | it("error compiling", async function () { 59 | this.timeout(5000); 60 | const file = join(fixtures, "macro-error-compiling.ts"); 61 | const tsOutput = tsCompile(await readFile(file, { encoding: "utf8" })); 62 | const errorCompilingFile = join(fixtures, "ignore-generics.ts"); 63 | assert.throws(() => babelCompile(tsOutput, file), { 64 | name: "MacroError", 65 | message: `${file}: ts-interface-builder/macro: ` + 66 | `Error compiling file ${errorCompilingFile} with options {"inlineImports":true,"format":"js:cjs"}: ` + 67 | `Error: Generics are not yet supported by ts-interface-builder: IMyType`, 68 | } as any); 69 | }); 70 | }); 71 | 72 | function tsCompile(code: string): string { 73 | const compilerOptions: ts.CompilerOptions = { 74 | module: ts.ModuleKind.ES2015, 75 | inlineSourceMap: true, 76 | }; 77 | const { outputText, diagnostics } = ts.transpileModule(code, { 78 | compilerOptions, 79 | }); 80 | if (diagnostics && diagnostics.length) { 81 | throw new Error( 82 | "Got diagnostic errors: " + JSON.stringify(diagnostics, null, 2) 83 | ); 84 | } 85 | return outputText; 86 | } 87 | 88 | function babelCompile(code: string, filename: string): string { 89 | return babel.transform(code, { 90 | babelrc: false, 91 | plugins: [ 92 | [macroPlugin, { "ts-interface-builder": { inlineImports: true } }], 93 | ], 94 | filename, 95 | // Note: Type definitions for @babel/core's TransformOptions.inputSourceMap is wrong; see https://babeljs.io/docs/en/options#source-map-options 96 | inputSourceMap: true as any, 97 | })!.code!; 98 | } 99 | -------------------------------------------------------------------------------- /test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "strict": true, 5 | "noUnusedLocals": true, 6 | "module": "commonjs", 7 | "baseUrl": ".", 8 | "outDir": "dist", 9 | "declaration": true 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "strict": true, 5 | "noUnusedLocals": true, 6 | "module": "commonjs", 7 | "baseUrl": ".", 8 | "outDir": "dist", 9 | "declaration": true 10 | }, 11 | "files": [ 12 | "lib/index.ts", 13 | "lib/macro.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": [ 4 | "tslint:recommended" 5 | ], 6 | "jsRules": {}, 7 | "rules": { 8 | "object-literal-sort-keys": false 9 | }, 10 | "rulesDirectory": [] 11 | } 12 | --------------------------------------------------------------------------------