├── .github ├── dependabot.yml └── workflows │ └── node.js.yml ├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── compile.ts ├── examples └── ttypescript │ ├── src │ ├── bar.ts │ └── index.ts │ └── tsconfig.json ├── package-lock.json ├── package.json ├── src ├── index.ts └── transform.ts ├── test ├── fixture │ ├── bar.ts │ ├── bar2.ts │ └── foo.ts └── transform.test.ts └── tsconfig.json /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "npm" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "daily" 12 | -------------------------------------------------------------------------------- /.github/workflows/node.js.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions 3 | 4 | name: Node.js CI 5 | 6 | on: 7 | push: 8 | branches: [ master ] 9 | pull_request: 10 | branches: [ master ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | strategy: 18 | matrix: 19 | node-version: [10.x, 12.x, 14.x] 20 | 21 | steps: 22 | - uses: actions/checkout@v2 23 | - name: Use Node.js ${{ matrix.node-version }} 24 | uses: actions/setup-node@v1 25 | with: 26 | node-version: ${{ matrix.node-version }} 27 | - run: npm ci 28 | - run: npm run build --if-present 29 | - run: npm test 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # nyc test coverage 18 | .nyc_output 19 | 20 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 21 | .grunt 22 | 23 | # node-waf configuration 24 | .lock-wscript 25 | 26 | # Compiled binary addons (http://nodejs.org/api/addons.html) 27 | build/Release 28 | 29 | # Dependency directories 30 | node_modules 31 | jspm_packages 32 | 33 | # Optional npm cache directory 34 | .npm 35 | 36 | # Optional REPL history 37 | .node_repl_history 38 | 39 | test/fixture/*.js 40 | test/fixture/*.d.ts 41 | dist/ 42 | examples/**/*.js 43 | examples/**/*.d.ts -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | test -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright 2018 Dropbox 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ts-transform-import-path-rewrite 2 | 3 | ![build status](https://travis-ci.org/dropbox/ts-transform-import-path-rewrite.svg?branch=master) 4 | 5 | This is a TypeScript AST Transformer that allows you to rewrite import path in output JS & `d.ts` files accordingly. The primary use case for this is to mitigate different build system import structure, such as relative vs absolute `import` and aliasing output `import` paths. 6 | 7 | ## Usage 8 | 9 | ### ttypescript 10 | Example for ttypescript usage is in `examples/ttypescript`. Run `npx ttsc`. 11 | 12 | ### Compiler Wrapper 13 | First of all, you need some level of familiarity with the [TypeScript Compiler API](https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API). 14 | 15 | `compile.ts` & tests should have examples of how this works. The available options are: 16 | 17 | ### `projectBaseDir: string` 18 | This is the base directory of your project folder. This is primarily used to determine the correct path when rewriting relative `import` to `absolute` import. 19 | 20 | ### `project?: string` 21 | Project name to rewrite relative `import` to. For example: 22 | ```ts 23 | import foo from './foo' 24 | // Becomes 25 | import foo from 'my-project-name/foo' 26 | ``` 27 | 28 | ### `rewrite?(importPath: string, sourceFilePath: string): string` 29 | Custom rewrite function to rewrite any `import` path we encounter to any new `import` path. 30 | 31 | ### `alias?: Record` 32 | Alias regex map to replace, e.g: 33 | ```json 34 | { 35 | "^(foo)$": "external/$1" 36 | } 37 | ``` 38 | 39 | ## License 40 | 41 | Copyright (c) 2018 Dropbox, Inc. 42 | 43 | Licensed under the Apache License, Version 2.0 (the "License"); 44 | you may not use this file except in compliance with the License. 45 | You may obtain a copy of the License at 46 | 47 | http://www.apache.org/licenses/LICENSE-2.0 48 | 49 | Unless required by applicable law or agreed to in writing, software 50 | distributed under the License is distributed on an "AS IS" BASIS, 51 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 52 | See the License for the specific language governing permissions and 53 | limitations under the License. 54 | -------------------------------------------------------------------------------- /compile.ts: -------------------------------------------------------------------------------- 1 | import * as ts from "typescript"; 2 | import { sync as globSync } from "glob"; 3 | import { 4 | transform as dtsPathTransform, 5 | Opts as PathTransformOpts 6 | } from "./src"; 7 | 8 | declare module "fs-extra" { 9 | export function outputJsonSync(file: string, data: any, opts?: {}): void; 10 | } 11 | const CJS_CONFIG: ts.CompilerOptions = { 12 | experimentalDecorators: true, 13 | jsx: ts.JsxEmit.React, 14 | module: ts.ModuleKind.ESNext, 15 | moduleResolution: ts.ModuleResolutionKind.NodeJs, 16 | noEmitOnError: false, 17 | noUnusedLocals: true, 18 | noUnusedParameters: true, 19 | stripInternal: true, 20 | declaration: true, 21 | baseUrl: __dirname, 22 | target: ts.ScriptTarget.ES2015 23 | }; 24 | 25 | export default function compile( 26 | input: string, 27 | transformOpts: PathTransformOpts, 28 | options: ts.CompilerOptions = CJS_CONFIG 29 | ) { 30 | const files = globSync(input); 31 | const compilerHost = ts.createCompilerHost(options); 32 | const program = ts.createProgram(files, options, compilerHost); 33 | 34 | const msgs = {}; 35 | 36 | let emitResult = program.emit(undefined, undefined, undefined, undefined, { 37 | after: [ 38 | dtsPathTransform(transformOpts) as ts.TransformerFactory 39 | ], 40 | afterDeclarations: [dtsPathTransform(transformOpts)] 41 | }); 42 | 43 | let allDiagnostics = ts 44 | .getPreEmitDiagnostics(program) 45 | .concat(emitResult.diagnostics); 46 | 47 | allDiagnostics.forEach(diagnostic => { 48 | let { line, character } = diagnostic.file.getLineAndCharacterOfPosition( 49 | diagnostic.start 50 | ); 51 | let message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"); 52 | console.log( 53 | `${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}` 54 | ); 55 | }); 56 | 57 | return msgs; 58 | } 59 | -------------------------------------------------------------------------------- /examples/ttypescript/src/bar.ts: -------------------------------------------------------------------------------- 1 | export const dummy = 1; 2 | export const dummy2 = 2; -------------------------------------------------------------------------------- /examples/ttypescript/src/index.ts: -------------------------------------------------------------------------------- 1 | import { dummy } from "./bar"; 2 | import * as fsExtra from "fs-extra"; 3 | export function dummyFs(fn: string) { 4 | fsExtra.readFileSync(fn); 5 | } 6 | export const dummy1 = dummy + 1; 7 | export const readFile = fsExtra.readFile; 8 | export {dummy2} from './bar' 9 | export * from './bar' -------------------------------------------------------------------------------- /examples/ttypescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "esnext", 4 | "declaration": true, 5 | "plugins": [ 6 | { 7 | "transform": "../../", 8 | "import": "transform", 9 | "alias": { 10 | "^(fs-extra)$": "external/$1" 11 | }, 12 | "after": true, 13 | "afterDeclarations": true, 14 | "type": "config" 15 | }, 16 | ] 17 | } 18 | } -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ts-transform-import-path-rewrite", 3 | "version": "0.3.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "@types/chai": { 8 | "version": "4.2.14", 9 | "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.14.tgz", 10 | "integrity": "sha512-G+ITQPXkwTrslfG5L/BksmbLUA0M1iybEsmCWPqzSxsRRhJZimBKJkoMi8fr/CPygPTj4zO5pJH7I2/cm9M7SQ==", 11 | "dev": true 12 | }, 13 | "@types/fs-extra": { 14 | "version": "9.0.4", 15 | "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.4.tgz", 16 | "integrity": "sha512-50GO5ez44lxK5MDH90DYHFFfqxH7+fTqEEnvguQRzJ/tY9qFrMSHLiYHite+F3SNmf7+LHC1eMXojuD+E3Qcyg==", 17 | "dev": true, 18 | "requires": { 19 | "@types/node": "*" 20 | } 21 | }, 22 | "@types/glob": { 23 | "version": "7.1.3", 24 | "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.3.tgz", 25 | "integrity": "sha512-SEYeGAIQIQX8NN6LDKprLjbrd5dARM5EXsd8GI/A5l0apYI1fGMWgPHSe4ZKL4eozlAyI+doUE9XbYS4xCkQ1w==", 26 | "dev": true, 27 | "requires": { 28 | "@types/minimatch": "*", 29 | "@types/node": "*" 30 | } 31 | }, 32 | "@types/minimatch": { 33 | "version": "3.0.3", 34 | "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", 35 | "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", 36 | "dev": true 37 | }, 38 | "@types/mocha": { 39 | "version": "8.0.4", 40 | "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.0.4.tgz", 41 | "integrity": "sha512-M4BwiTJjHmLq6kjON7ZoI2JMlBvpY3BYSdiP6s/qCT3jb1s9/DeJF0JELpAxiVSIxXDzfNKe+r7yedMIoLbknQ==", 42 | "dev": true 43 | }, 44 | "@types/node": { 45 | "version": "14.14.9", 46 | "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.9.tgz", 47 | "integrity": "sha512-JsoLXFppG62tWTklIoO4knA+oDTYsmqWxHRvd4lpmfQRNhX6osheUOWETP2jMoV/2bEHuMra8Pp3Dmo/stBFcw==", 48 | "dev": true 49 | }, 50 | "@ungap/promise-all-settled": { 51 | "version": "1.1.2", 52 | "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", 53 | "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", 54 | "dev": true 55 | }, 56 | "ansi-colors": { 57 | "version": "4.1.1", 58 | "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", 59 | "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", 60 | "dev": true 61 | }, 62 | "ansi-regex": { 63 | "version": "3.0.0", 64 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", 65 | "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", 66 | "dev": true 67 | }, 68 | "ansi-styles": { 69 | "version": "4.3.0", 70 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", 71 | "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", 72 | "dev": true, 73 | "requires": { 74 | "color-convert": "^2.0.1" 75 | } 76 | }, 77 | "anymatch": { 78 | "version": "3.1.1", 79 | "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", 80 | "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", 81 | "dev": true, 82 | "requires": { 83 | "normalize-path": "^3.0.0", 84 | "picomatch": "^2.0.4" 85 | } 86 | }, 87 | "arg": { 88 | "version": "4.1.3", 89 | "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", 90 | "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", 91 | "dev": true 92 | }, 93 | "argparse": { 94 | "version": "1.0.10", 95 | "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", 96 | "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", 97 | "dev": true, 98 | "requires": { 99 | "sprintf-js": "~1.0.2" 100 | } 101 | }, 102 | "assertion-error": { 103 | "version": "1.1.0", 104 | "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", 105 | "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", 106 | "dev": true 107 | }, 108 | "at-least-node": { 109 | "version": "1.0.0", 110 | "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", 111 | "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", 112 | "dev": true 113 | }, 114 | "balanced-match": { 115 | "version": "1.0.0", 116 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", 117 | "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", 118 | "dev": true 119 | }, 120 | "binary-extensions": { 121 | "version": "2.1.0", 122 | "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz", 123 | "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==", 124 | "dev": true 125 | }, 126 | "brace-expansion": { 127 | "version": "1.1.11", 128 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 129 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 130 | "dev": true, 131 | "requires": { 132 | "balanced-match": "^1.0.0", 133 | "concat-map": "0.0.1" 134 | } 135 | }, 136 | "braces": { 137 | "version": "3.0.2", 138 | "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", 139 | "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", 140 | "dev": true, 141 | "requires": { 142 | "fill-range": "^7.0.1" 143 | } 144 | }, 145 | "browser-stdout": { 146 | "version": "1.3.1", 147 | "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", 148 | "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", 149 | "dev": true 150 | }, 151 | "buffer-from": { 152 | "version": "1.1.1", 153 | "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", 154 | "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", 155 | "dev": true 156 | }, 157 | "camelcase": { 158 | "version": "5.3.1", 159 | "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", 160 | "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", 161 | "dev": true 162 | }, 163 | "chai": { 164 | "version": "4.2.0", 165 | "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", 166 | "integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==", 167 | "dev": true, 168 | "requires": { 169 | "assertion-error": "^1.1.0", 170 | "check-error": "^1.0.2", 171 | "deep-eql": "^3.0.1", 172 | "get-func-name": "^2.0.0", 173 | "pathval": "^1.1.0", 174 | "type-detect": "^4.0.5" 175 | } 176 | }, 177 | "chalk": { 178 | "version": "4.1.0", 179 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", 180 | "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", 181 | "dev": true, 182 | "requires": { 183 | "ansi-styles": "^4.1.0", 184 | "supports-color": "^7.1.0" 185 | } 186 | }, 187 | "check-error": { 188 | "version": "1.0.2", 189 | "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", 190 | "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", 191 | "dev": true 192 | }, 193 | "chokidar": { 194 | "version": "3.4.3", 195 | "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.3.tgz", 196 | "integrity": "sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ==", 197 | "dev": true, 198 | "requires": { 199 | "anymatch": "~3.1.1", 200 | "braces": "~3.0.2", 201 | "fsevents": "~2.1.2", 202 | "glob-parent": "~5.1.0", 203 | "is-binary-path": "~2.1.0", 204 | "is-glob": "~4.0.1", 205 | "normalize-path": "~3.0.0", 206 | "readdirp": "~3.5.0" 207 | } 208 | }, 209 | "cliui": { 210 | "version": "5.0.0", 211 | "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", 212 | "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", 213 | "dev": true, 214 | "requires": { 215 | "string-width": "^3.1.0", 216 | "strip-ansi": "^5.2.0", 217 | "wrap-ansi": "^5.1.0" 218 | }, 219 | "dependencies": { 220 | "ansi-regex": { 221 | "version": "4.1.0", 222 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", 223 | "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", 224 | "dev": true 225 | }, 226 | "string-width": { 227 | "version": "3.1.0", 228 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", 229 | "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", 230 | "dev": true, 231 | "requires": { 232 | "emoji-regex": "^7.0.1", 233 | "is-fullwidth-code-point": "^2.0.0", 234 | "strip-ansi": "^5.1.0" 235 | } 236 | }, 237 | "strip-ansi": { 238 | "version": "5.2.0", 239 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", 240 | "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", 241 | "dev": true, 242 | "requires": { 243 | "ansi-regex": "^4.1.0" 244 | } 245 | } 246 | } 247 | }, 248 | "color-convert": { 249 | "version": "2.0.1", 250 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", 251 | "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", 252 | "dev": true, 253 | "requires": { 254 | "color-name": "~1.1.4" 255 | } 256 | }, 257 | "color-name": { 258 | "version": "1.1.4", 259 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", 260 | "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", 261 | "dev": true 262 | }, 263 | "concat-map": { 264 | "version": "0.0.1", 265 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 266 | "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", 267 | "dev": true 268 | }, 269 | "concat-stream": { 270 | "version": "1.6.2", 271 | "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", 272 | "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", 273 | "dev": true, 274 | "requires": { 275 | "buffer-from": "^1.0.0", 276 | "inherits": "^2.0.3", 277 | "readable-stream": "^2.2.2", 278 | "typedarray": "^0.0.6" 279 | } 280 | }, 281 | "core-util-is": { 282 | "version": "1.0.2", 283 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", 284 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", 285 | "dev": true 286 | }, 287 | "cross-spawn": { 288 | "version": "5.1.0", 289 | "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", 290 | "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", 291 | "dev": true, 292 | "requires": { 293 | "lru-cache": "^4.0.1", 294 | "shebang-command": "^1.2.0", 295 | "which": "^1.2.9" 296 | } 297 | }, 298 | "debug": { 299 | "version": "4.2.0", 300 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", 301 | "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", 302 | "dev": true, 303 | "requires": { 304 | "ms": "2.1.2" 305 | } 306 | }, 307 | "decamelize": { 308 | "version": "1.2.0", 309 | "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", 310 | "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", 311 | "dev": true 312 | }, 313 | "deep-eql": { 314 | "version": "3.0.1", 315 | "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", 316 | "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", 317 | "dev": true, 318 | "requires": { 319 | "type-detect": "^4.0.0" 320 | } 321 | }, 322 | "diff": { 323 | "version": "4.0.2", 324 | "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", 325 | "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", 326 | "dev": true 327 | }, 328 | "emoji-regex": { 329 | "version": "7.0.3", 330 | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", 331 | "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", 332 | "dev": true 333 | }, 334 | "escape-string-regexp": { 335 | "version": "4.0.0", 336 | "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", 337 | "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", 338 | "dev": true 339 | }, 340 | "esprima": { 341 | "version": "4.0.1", 342 | "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", 343 | "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", 344 | "dev": true 345 | }, 346 | "fill-range": { 347 | "version": "7.0.1", 348 | "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", 349 | "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", 350 | "dev": true, 351 | "requires": { 352 | "to-regex-range": "^5.0.1" 353 | } 354 | }, 355 | "find-up": { 356 | "version": "5.0.0", 357 | "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", 358 | "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", 359 | "dev": true, 360 | "requires": { 361 | "locate-path": "^6.0.0", 362 | "path-exists": "^4.0.0" 363 | } 364 | }, 365 | "flat": { 366 | "version": "5.0.2", 367 | "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", 368 | "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", 369 | "dev": true 370 | }, 371 | "fs-extra": { 372 | "version": "9.0.1", 373 | "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.1.tgz", 374 | "integrity": "sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ==", 375 | "dev": true, 376 | "requires": { 377 | "at-least-node": "^1.0.0", 378 | "graceful-fs": "^4.2.0", 379 | "jsonfile": "^6.0.1", 380 | "universalify": "^1.0.0" 381 | } 382 | }, 383 | "fs.realpath": { 384 | "version": "1.0.0", 385 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 386 | "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", 387 | "dev": true 388 | }, 389 | "fsevents": { 390 | "version": "2.1.3", 391 | "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", 392 | "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", 393 | "dev": true, 394 | "optional": true 395 | }, 396 | "get-caller-file": { 397 | "version": "2.0.5", 398 | "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", 399 | "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", 400 | "dev": true 401 | }, 402 | "get-func-name": { 403 | "version": "2.0.0", 404 | "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", 405 | "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", 406 | "dev": true 407 | }, 408 | "glob": { 409 | "version": "7.1.6", 410 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", 411 | "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", 412 | "dev": true, 413 | "requires": { 414 | "fs.realpath": "^1.0.0", 415 | "inflight": "^1.0.4", 416 | "inherits": "2", 417 | "minimatch": "^3.0.4", 418 | "once": "^1.3.0", 419 | "path-is-absolute": "^1.0.0" 420 | } 421 | }, 422 | "glob-parent": { 423 | "version": "5.1.1", 424 | "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", 425 | "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", 426 | "dev": true, 427 | "requires": { 428 | "is-glob": "^4.0.1" 429 | } 430 | }, 431 | "graceful-fs": { 432 | "version": "4.2.4", 433 | "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", 434 | "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", 435 | "dev": true 436 | }, 437 | "growl": { 438 | "version": "1.10.5", 439 | "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", 440 | "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", 441 | "dev": true 442 | }, 443 | "has-flag": { 444 | "version": "4.0.0", 445 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", 446 | "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", 447 | "dev": true 448 | }, 449 | "he": { 450 | "version": "1.2.0", 451 | "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", 452 | "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", 453 | "dev": true 454 | }, 455 | "inflight": { 456 | "version": "1.0.6", 457 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 458 | "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", 459 | "dev": true, 460 | "requires": { 461 | "once": "^1.3.0", 462 | "wrappy": "1" 463 | } 464 | }, 465 | "inherits": { 466 | "version": "2.0.3", 467 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 468 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", 469 | "dev": true 470 | }, 471 | "is-binary-path": { 472 | "version": "2.1.0", 473 | "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", 474 | "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", 475 | "dev": true, 476 | "requires": { 477 | "binary-extensions": "^2.0.0" 478 | } 479 | }, 480 | "is-extglob": { 481 | "version": "2.1.1", 482 | "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", 483 | "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", 484 | "dev": true 485 | }, 486 | "is-fullwidth-code-point": { 487 | "version": "2.0.0", 488 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", 489 | "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", 490 | "dev": true 491 | }, 492 | "is-glob": { 493 | "version": "4.0.1", 494 | "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", 495 | "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", 496 | "dev": true, 497 | "requires": { 498 | "is-extglob": "^2.1.1" 499 | } 500 | }, 501 | "is-number": { 502 | "version": "7.0.0", 503 | "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", 504 | "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", 505 | "dev": true 506 | }, 507 | "is-plain-obj": { 508 | "version": "2.1.0", 509 | "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", 510 | "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", 511 | "dev": true 512 | }, 513 | "isarray": { 514 | "version": "1.0.0", 515 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", 516 | "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", 517 | "dev": true 518 | }, 519 | "isexe": { 520 | "version": "2.0.0", 521 | "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", 522 | "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", 523 | "dev": true 524 | }, 525 | "js-yaml": { 526 | "version": "3.14.0", 527 | "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", 528 | "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", 529 | "dev": true, 530 | "requires": { 531 | "argparse": "^1.0.7", 532 | "esprima": "^4.0.0" 533 | } 534 | }, 535 | "jsonfile": { 536 | "version": "6.0.1", 537 | "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.0.1.tgz", 538 | "integrity": "sha512-jR2b5v7d2vIOust+w3wtFKZIfpC2pnRmFAhAC/BuweZFQR8qZzxH1OyrQ10HmdVYiXWkYUqPVsz91cG7EL2FBg==", 539 | "dev": true, 540 | "requires": { 541 | "graceful-fs": "^4.1.6", 542 | "universalify": "^1.0.0" 543 | } 544 | }, 545 | "locate-path": { 546 | "version": "6.0.0", 547 | "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", 548 | "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", 549 | "dev": true, 550 | "requires": { 551 | "p-locate": "^5.0.0" 552 | } 553 | }, 554 | "log-symbols": { 555 | "version": "4.0.0", 556 | "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", 557 | "integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==", 558 | "dev": true, 559 | "requires": { 560 | "chalk": "^4.0.0" 561 | } 562 | }, 563 | "lru-cache": { 564 | "version": "4.1.4", 565 | "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.4.tgz", 566 | "integrity": "sha512-EPstzZ23znHUVLKj+lcXO1KvZkrlw+ZirdwvOmnAnA/1PB4ggyXJ77LRkCqkff+ShQ+cqoxCxLQOh4cKITO5iA==", 567 | "dev": true, 568 | "requires": { 569 | "pseudomap": "^1.0.2", 570 | "yallist": "^3.0.2" 571 | } 572 | }, 573 | "make-error": { 574 | "version": "1.3.6", 575 | "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", 576 | "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", 577 | "dev": true 578 | }, 579 | "minimatch": { 580 | "version": "3.0.4", 581 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", 582 | "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", 583 | "dev": true, 584 | "requires": { 585 | "brace-expansion": "^1.1.7" 586 | } 587 | }, 588 | "mocha": { 589 | "version": "8.2.1", 590 | "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.2.1.tgz", 591 | "integrity": "sha512-cuLBVfyFfFqbNR0uUKbDGXKGk+UDFe6aR4os78XIrMQpZl/nv7JYHcvP5MFIAb374b2zFXsdgEGwmzMtP0Xg8w==", 592 | "dev": true, 593 | "requires": { 594 | "@ungap/promise-all-settled": "1.1.2", 595 | "ansi-colors": "4.1.1", 596 | "browser-stdout": "1.3.1", 597 | "chokidar": "3.4.3", 598 | "debug": "4.2.0", 599 | "diff": "4.0.2", 600 | "escape-string-regexp": "4.0.0", 601 | "find-up": "5.0.0", 602 | "glob": "7.1.6", 603 | "growl": "1.10.5", 604 | "he": "1.2.0", 605 | "js-yaml": "3.14.0", 606 | "log-symbols": "4.0.0", 607 | "minimatch": "3.0.4", 608 | "ms": "2.1.2", 609 | "nanoid": "3.1.12", 610 | "serialize-javascript": "5.0.1", 611 | "strip-json-comments": "3.1.1", 612 | "supports-color": "7.2.0", 613 | "which": "2.0.2", 614 | "wide-align": "1.1.3", 615 | "workerpool": "6.0.2", 616 | "yargs": "13.3.2", 617 | "yargs-parser": "13.1.2", 618 | "yargs-unparser": "2.0.0" 619 | }, 620 | "dependencies": { 621 | "which": { 622 | "version": "2.0.2", 623 | "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", 624 | "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", 625 | "dev": true, 626 | "requires": { 627 | "isexe": "^2.0.0" 628 | } 629 | } 630 | } 631 | }, 632 | "ms": { 633 | "version": "2.1.2", 634 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 635 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", 636 | "dev": true 637 | }, 638 | "nanoid": { 639 | "version": "3.1.12", 640 | "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.12.tgz", 641 | "integrity": "sha512-1qstj9z5+x491jfiC4Nelk+f8XBad7LN20PmyWINJEMRSf3wcAjAWysw1qaA8z6NSKe2sjq1hRSDpBH5paCb6A==", 642 | "dev": true 643 | }, 644 | "normalize-path": { 645 | "version": "3.0.0", 646 | "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", 647 | "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", 648 | "dev": true 649 | }, 650 | "once": { 651 | "version": "1.4.0", 652 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 653 | "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", 654 | "dev": true, 655 | "requires": { 656 | "wrappy": "1" 657 | } 658 | }, 659 | "os-shim": { 660 | "version": "0.1.3", 661 | "resolved": "https://registry.npmjs.org/os-shim/-/os-shim-0.1.3.tgz", 662 | "integrity": "sha1-a2LDeRz3kJ6jXtRuF2WLtBfLORc=", 663 | "dev": true 664 | }, 665 | "p-limit": { 666 | "version": "3.0.2", 667 | "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.0.2.tgz", 668 | "integrity": "sha512-iwqZSOoWIW+Ew4kAGUlN16J4M7OB3ysMLSZtnhmqx7njIHFPlxWBX8xo3lVTyFVq6mI/lL9qt2IsN1sHwaxJkg==", 669 | "dev": true, 670 | "requires": { 671 | "p-try": "^2.0.0" 672 | } 673 | }, 674 | "p-locate": { 675 | "version": "5.0.0", 676 | "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", 677 | "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", 678 | "dev": true, 679 | "requires": { 680 | "p-limit": "^3.0.2" 681 | } 682 | }, 683 | "p-try": { 684 | "version": "2.2.0", 685 | "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", 686 | "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", 687 | "dev": true 688 | }, 689 | "path-exists": { 690 | "version": "4.0.0", 691 | "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", 692 | "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", 693 | "dev": true 694 | }, 695 | "path-is-absolute": { 696 | "version": "1.0.1", 697 | "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 698 | "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", 699 | "dev": true 700 | }, 701 | "pathval": { 702 | "version": "1.1.0", 703 | "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", 704 | "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", 705 | "dev": true 706 | }, 707 | "picomatch": { 708 | "version": "2.2.2", 709 | "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", 710 | "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", 711 | "dev": true 712 | }, 713 | "pre-commit": { 714 | "version": "1.2.2", 715 | "resolved": "https://registry.npmjs.org/pre-commit/-/pre-commit-1.2.2.tgz", 716 | "integrity": "sha1-287g7p3nI15X95xW186UZBpp7sY=", 717 | "dev": true, 718 | "requires": { 719 | "cross-spawn": "^5.0.1", 720 | "spawn-sync": "^1.0.15", 721 | "which": "1.2.x" 722 | } 723 | }, 724 | "prettier": { 725 | "version": "2.2.0", 726 | "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.0.tgz", 727 | "integrity": "sha512-yYerpkvseM4iKD/BXLYUkQV5aKt4tQPqaGW6EsZjzyu0r7sVZZNPJW4Y8MyKmicp6t42XUPcBVA+H6sB3gqndw==", 728 | "dev": true 729 | }, 730 | "process-nextick-args": { 731 | "version": "2.0.0", 732 | "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", 733 | "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", 734 | "dev": true 735 | }, 736 | "pseudomap": { 737 | "version": "1.0.2", 738 | "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", 739 | "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", 740 | "dev": true 741 | }, 742 | "randombytes": { 743 | "version": "2.1.0", 744 | "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", 745 | "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", 746 | "dev": true, 747 | "requires": { 748 | "safe-buffer": "^5.1.0" 749 | } 750 | }, 751 | "readable-stream": { 752 | "version": "2.3.6", 753 | "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", 754 | "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", 755 | "dev": true, 756 | "requires": { 757 | "core-util-is": "~1.0.0", 758 | "inherits": "~2.0.3", 759 | "isarray": "~1.0.0", 760 | "process-nextick-args": "~2.0.0", 761 | "safe-buffer": "~5.1.1", 762 | "string_decoder": "~1.1.1", 763 | "util-deprecate": "~1.0.1" 764 | } 765 | }, 766 | "readdirp": { 767 | "version": "3.5.0", 768 | "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", 769 | "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", 770 | "dev": true, 771 | "requires": { 772 | "picomatch": "^2.2.1" 773 | } 774 | }, 775 | "require-directory": { 776 | "version": "2.1.1", 777 | "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", 778 | "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", 779 | "dev": true 780 | }, 781 | "require-main-filename": { 782 | "version": "2.0.0", 783 | "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", 784 | "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", 785 | "dev": true 786 | }, 787 | "safe-buffer": { 788 | "version": "5.1.2", 789 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 790 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", 791 | "dev": true 792 | }, 793 | "serialize-javascript": { 794 | "version": "5.0.1", 795 | "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-5.0.1.tgz", 796 | "integrity": "sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA==", 797 | "dev": true, 798 | "requires": { 799 | "randombytes": "^2.1.0" 800 | } 801 | }, 802 | "set-blocking": { 803 | "version": "2.0.0", 804 | "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", 805 | "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", 806 | "dev": true 807 | }, 808 | "shebang-command": { 809 | "version": "1.2.0", 810 | "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", 811 | "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", 812 | "dev": true, 813 | "requires": { 814 | "shebang-regex": "^1.0.0" 815 | } 816 | }, 817 | "shebang-regex": { 818 | "version": "1.0.0", 819 | "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", 820 | "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", 821 | "dev": true 822 | }, 823 | "source-map": { 824 | "version": "0.6.1", 825 | "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", 826 | "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", 827 | "dev": true 828 | }, 829 | "source-map-support": { 830 | "version": "0.5.19", 831 | "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", 832 | "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", 833 | "dev": true, 834 | "requires": { 835 | "buffer-from": "^1.0.0", 836 | "source-map": "^0.6.0" 837 | } 838 | }, 839 | "spawn-sync": { 840 | "version": "1.0.15", 841 | "resolved": "https://registry.npmjs.org/spawn-sync/-/spawn-sync-1.0.15.tgz", 842 | "integrity": "sha1-sAeZVX63+wyDdsKdROih6mfldHY=", 843 | "dev": true, 844 | "requires": { 845 | "concat-stream": "^1.4.7", 846 | "os-shim": "^0.1.2" 847 | } 848 | }, 849 | "sprintf-js": { 850 | "version": "1.0.3", 851 | "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", 852 | "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", 853 | "dev": true 854 | }, 855 | "string-width": { 856 | "version": "2.1.1", 857 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", 858 | "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", 859 | "dev": true, 860 | "requires": { 861 | "is-fullwidth-code-point": "^2.0.0", 862 | "strip-ansi": "^4.0.0" 863 | } 864 | }, 865 | "string_decoder": { 866 | "version": "1.1.1", 867 | "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", 868 | "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", 869 | "dev": true, 870 | "requires": { 871 | "safe-buffer": "~5.1.0" 872 | } 873 | }, 874 | "strip-ansi": { 875 | "version": "4.0.0", 876 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", 877 | "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", 878 | "dev": true, 879 | "requires": { 880 | "ansi-regex": "^3.0.0" 881 | } 882 | }, 883 | "strip-json-comments": { 884 | "version": "3.1.1", 885 | "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", 886 | "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", 887 | "dev": true 888 | }, 889 | "supports-color": { 890 | "version": "7.2.0", 891 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", 892 | "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", 893 | "dev": true, 894 | "requires": { 895 | "has-flag": "^4.0.0" 896 | } 897 | }, 898 | "to-regex-range": { 899 | "version": "5.0.1", 900 | "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", 901 | "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", 902 | "dev": true, 903 | "requires": { 904 | "is-number": "^7.0.0" 905 | } 906 | }, 907 | "ts-node": { 908 | "version": "9.0.0", 909 | "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.0.0.tgz", 910 | "integrity": "sha512-/TqB4SnererCDR/vb4S/QvSZvzQMJN8daAslg7MeaiHvD8rDZsSfXmNeNumyZZzMned72Xoq/isQljYSt8Ynfg==", 911 | "dev": true, 912 | "requires": { 913 | "arg": "^4.1.0", 914 | "diff": "^4.0.1", 915 | "make-error": "^1.1.1", 916 | "source-map-support": "^0.5.17", 917 | "yn": "3.1.1" 918 | } 919 | }, 920 | "ttypescript": { 921 | "version": "2.5.2", 922 | "resolved": "https://registry.npmjs.org/ttypescript/-/ttypescript-2.5.2.tgz", 923 | "integrity": "sha1-OGsVZnh/DOtIhiUt3tR9EA5ufTs=", 924 | "dev": true 925 | }, 926 | "type-detect": { 927 | "version": "4.0.8", 928 | "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", 929 | "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", 930 | "dev": true 931 | }, 932 | "typedarray": { 933 | "version": "0.0.6", 934 | "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", 935 | "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", 936 | "dev": true 937 | }, 938 | "typescript": { 939 | "version": "4.1.2", 940 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.2.tgz", 941 | "integrity": "sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ==" 942 | }, 943 | "universalify": { 944 | "version": "1.0.0", 945 | "resolved": "https://registry.npmjs.org/universalify/-/universalify-1.0.0.tgz", 946 | "integrity": "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==", 947 | "dev": true 948 | }, 949 | "util-deprecate": { 950 | "version": "1.0.2", 951 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 952 | "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", 953 | "dev": true 954 | }, 955 | "which": { 956 | "version": "1.2.14", 957 | "resolved": "https://registry.npmjs.org/which/-/which-1.2.14.tgz", 958 | "integrity": "sha1-mofEN48D6CfOyvGs31bHNsAcFOU=", 959 | "dev": true, 960 | "requires": { 961 | "isexe": "^2.0.0" 962 | } 963 | }, 964 | "which-module": { 965 | "version": "2.0.0", 966 | "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", 967 | "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", 968 | "dev": true 969 | }, 970 | "wide-align": { 971 | "version": "1.1.3", 972 | "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", 973 | "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", 974 | "dev": true, 975 | "requires": { 976 | "string-width": "^1.0.2 || 2" 977 | } 978 | }, 979 | "workerpool": { 980 | "version": "6.0.2", 981 | "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.0.2.tgz", 982 | "integrity": "sha512-DSNyvOpFKrNusaaUwk+ej6cBj1bmhLcBfj80elGk+ZIo5JSkq+unB1dLKEOcNfJDZgjGICfhQ0Q5TbP0PvF4+Q==", 983 | "dev": true 984 | }, 985 | "wrap-ansi": { 986 | "version": "5.1.0", 987 | "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", 988 | "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", 989 | "dev": true, 990 | "requires": { 991 | "ansi-styles": "^3.2.0", 992 | "string-width": "^3.0.0", 993 | "strip-ansi": "^5.0.0" 994 | }, 995 | "dependencies": { 996 | "ansi-regex": { 997 | "version": "4.1.0", 998 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", 999 | "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", 1000 | "dev": true 1001 | }, 1002 | "ansi-styles": { 1003 | "version": "3.2.1", 1004 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", 1005 | "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", 1006 | "dev": true, 1007 | "requires": { 1008 | "color-convert": "^1.9.0" 1009 | } 1010 | }, 1011 | "color-convert": { 1012 | "version": "1.9.3", 1013 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", 1014 | "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", 1015 | "dev": true, 1016 | "requires": { 1017 | "color-name": "1.1.3" 1018 | } 1019 | }, 1020 | "color-name": { 1021 | "version": "1.1.3", 1022 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", 1023 | "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", 1024 | "dev": true 1025 | }, 1026 | "string-width": { 1027 | "version": "3.1.0", 1028 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", 1029 | "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", 1030 | "dev": true, 1031 | "requires": { 1032 | "emoji-regex": "^7.0.1", 1033 | "is-fullwidth-code-point": "^2.0.0", 1034 | "strip-ansi": "^5.1.0" 1035 | } 1036 | }, 1037 | "strip-ansi": { 1038 | "version": "5.2.0", 1039 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", 1040 | "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", 1041 | "dev": true, 1042 | "requires": { 1043 | "ansi-regex": "^4.1.0" 1044 | } 1045 | } 1046 | } 1047 | }, 1048 | "wrappy": { 1049 | "version": "1.0.2", 1050 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 1051 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", 1052 | "dev": true 1053 | }, 1054 | "y18n": { 1055 | "version": "4.0.0", 1056 | "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", 1057 | "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", 1058 | "dev": true 1059 | }, 1060 | "yallist": { 1061 | "version": "3.0.3", 1062 | "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", 1063 | "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==", 1064 | "dev": true 1065 | }, 1066 | "yargs": { 1067 | "version": "13.3.2", 1068 | "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", 1069 | "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", 1070 | "dev": true, 1071 | "requires": { 1072 | "cliui": "^5.0.0", 1073 | "find-up": "^3.0.0", 1074 | "get-caller-file": "^2.0.1", 1075 | "require-directory": "^2.1.1", 1076 | "require-main-filename": "^2.0.0", 1077 | "set-blocking": "^2.0.0", 1078 | "string-width": "^3.0.0", 1079 | "which-module": "^2.0.0", 1080 | "y18n": "^4.0.0", 1081 | "yargs-parser": "^13.1.2" 1082 | }, 1083 | "dependencies": { 1084 | "ansi-regex": { 1085 | "version": "4.1.0", 1086 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", 1087 | "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", 1088 | "dev": true 1089 | }, 1090 | "find-up": { 1091 | "version": "3.0.0", 1092 | "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", 1093 | "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", 1094 | "dev": true, 1095 | "requires": { 1096 | "locate-path": "^3.0.0" 1097 | } 1098 | }, 1099 | "locate-path": { 1100 | "version": "3.0.0", 1101 | "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", 1102 | "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", 1103 | "dev": true, 1104 | "requires": { 1105 | "p-locate": "^3.0.0", 1106 | "path-exists": "^3.0.0" 1107 | } 1108 | }, 1109 | "p-limit": { 1110 | "version": "2.3.0", 1111 | "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", 1112 | "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", 1113 | "dev": true, 1114 | "requires": { 1115 | "p-try": "^2.0.0" 1116 | } 1117 | }, 1118 | "p-locate": { 1119 | "version": "3.0.0", 1120 | "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", 1121 | "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", 1122 | "dev": true, 1123 | "requires": { 1124 | "p-limit": "^2.0.0" 1125 | } 1126 | }, 1127 | "path-exists": { 1128 | "version": "3.0.0", 1129 | "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", 1130 | "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", 1131 | "dev": true 1132 | }, 1133 | "string-width": { 1134 | "version": "3.1.0", 1135 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", 1136 | "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", 1137 | "dev": true, 1138 | "requires": { 1139 | "emoji-regex": "^7.0.1", 1140 | "is-fullwidth-code-point": "^2.0.0", 1141 | "strip-ansi": "^5.1.0" 1142 | } 1143 | }, 1144 | "strip-ansi": { 1145 | "version": "5.2.0", 1146 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", 1147 | "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", 1148 | "dev": true, 1149 | "requires": { 1150 | "ansi-regex": "^4.1.0" 1151 | } 1152 | } 1153 | } 1154 | }, 1155 | "yargs-parser": { 1156 | "version": "13.1.2", 1157 | "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", 1158 | "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", 1159 | "dev": true, 1160 | "requires": { 1161 | "camelcase": "^5.0.0", 1162 | "decamelize": "^1.2.0" 1163 | } 1164 | }, 1165 | "yargs-unparser": { 1166 | "version": "2.0.0", 1167 | "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", 1168 | "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", 1169 | "dev": true, 1170 | "requires": { 1171 | "camelcase": "^6.0.0", 1172 | "decamelize": "^4.0.0", 1173 | "flat": "^5.0.2", 1174 | "is-plain-obj": "^2.1.0" 1175 | }, 1176 | "dependencies": { 1177 | "camelcase": { 1178 | "version": "6.2.0", 1179 | "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", 1180 | "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", 1181 | "dev": true 1182 | }, 1183 | "decamelize": { 1184 | "version": "4.0.0", 1185 | "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", 1186 | "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", 1187 | "dev": true 1188 | } 1189 | } 1190 | }, 1191 | "yn": { 1192 | "version": "3.1.1", 1193 | "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", 1194 | "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", 1195 | "dev": true 1196 | } 1197 | } 1198 | } 1199 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ts-transform-import-path-rewrite", 3 | "version": "0.3.0", 4 | "description": "TS AST transformer to rewrite import path", 5 | "main": "dist/index.js", 6 | "scripts": { 7 | "test": "rm -rf test/fixture/*.js && tsc && mocha --require ts-node/register test/*.test.ts", 8 | "prettier": "prettier --print-width=120 --tab-width=4 --single-quote --trailing-comma=es5 --no-semi --parser=typescript --write 'src/**/*.ts*' || true", 9 | "prepublishOnly": "tsc", 10 | "semantic-release": "semantic-release" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/dropbox/ts-transform-import-path-rewrite.git" 15 | }, 16 | "keywords": [ 17 | "typescript", 18 | "ast", 19 | "compiler", 20 | "import", 21 | "es6", 22 | "path", 23 | "rewrite", 24 | "transformer" 25 | ], 26 | "author": "Long Ho ", 27 | "license": "Apache-2.0", 28 | "bugs": { 29 | "url": "https://github.com/dropbox/ts-transform-import-path-rewrite/issues" 30 | }, 31 | "homepage": "https://github.com/dropbox/ts-transform-import-path-rewrite#readme", 32 | "dependencies": { 33 | "typescript": "^4.1.2" 34 | }, 35 | "devDependencies": { 36 | "@types/chai": "^4.2.14", 37 | "@types/fs-extra": "^9.0.4", 38 | "@types/glob": "^7.1.1", 39 | "@types/mocha": "^8.0.4", 40 | "@types/node": "^14.14.9", 41 | "chai": "^4.2.0", 42 | "fs-extra": "^9.0.1", 43 | "glob": "^7.1.3", 44 | "mocha": "^8.2.1", 45 | "pre-commit": "^1.2.2", 46 | "prettier": "^2.2.0", 47 | "ts-node": "^9.0.0", 48 | "ttypescript": "^2.5.2" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './transform' 2 | -------------------------------------------------------------------------------- /src/transform.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * AST Transformer to rewrite any ImportDeclaration paths. 3 | * This is typically used to rewrite relative imports into absolute imports 4 | * and mitigate import path differences w/ metaserver 5 | */ 6 | import * as ts from 'typescript' 7 | import { resolve, dirname } from 'path' 8 | 9 | export interface Opts { 10 | projectBaseDir?: string 11 | project?: string 12 | rewrite?(importPath: string, sourceFilePath: string): string 13 | alias?: Record 14 | } 15 | 16 | /** 17 | * Rewrite relative import to absolute import or trigger 18 | * rewrite callback 19 | * 20 | * @param {string} importPath import path 21 | * @param {ts.SourceFile} sf Source file 22 | * @param {Opts} opts 23 | * @returns 24 | */ 25 | function rewritePath(importPath: string, sf: ts.SourceFile, opts: Opts, regexps: Record) { 26 | const aliases = Object.keys(regexps) 27 | for (const alias of aliases) { 28 | const regex = regexps[alias] 29 | if (regexps[alias].test(importPath)) { 30 | return importPath.replace(regex, opts.alias[alias]) 31 | } 32 | } 33 | 34 | if (typeof opts.rewrite === 'function') { 35 | const newImportPath = opts.rewrite(importPath, sf.fileName) 36 | if (newImportPath) { 37 | return newImportPath 38 | } 39 | } 40 | 41 | if (opts.project && opts.projectBaseDir && importPath.startsWith('.')) { 42 | const path = resolve(dirname(sf.fileName), importPath).split(opts.projectBaseDir)[1] 43 | return `${opts.project}${path}` 44 | } 45 | 46 | return importPath 47 | } 48 | 49 | function isDynamicImport(node: ts.Node): node is ts.CallExpression { 50 | return ts.isCallExpression(node) && node.expression.kind === ts.SyntaxKind.ImportKeyword 51 | } 52 | 53 | function importExportVisitor( 54 | ctx: ts.TransformationContext, 55 | sf: ts.SourceFile, 56 | opts: Opts = { projectBaseDir: '' }, 57 | regexps: Record 58 | ) { 59 | const visitor: ts.Visitor = (node: ts.Node): ts.Node => { 60 | let importPath: string 61 | if ((ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) && node.moduleSpecifier) { 62 | const importPathWithQuotes = node.moduleSpecifier.getText(sf) 63 | importPath = importPathWithQuotes.substr(1, importPathWithQuotes.length - 2) 64 | } else if (isDynamicImport(node)) { 65 | const importPathWithQuotes = node.arguments[0].getText(sf) 66 | importPath = importPathWithQuotes.substr(1, importPathWithQuotes.length - 2) 67 | } else if ( 68 | ts.isImportTypeNode(node) && 69 | ts.isLiteralTypeNode(node.argument) && 70 | ts.isStringLiteral(node.argument.literal) 71 | ) { 72 | importPath = node.argument.literal.text // `.text` instead of `getText` bc this node doesn't map to sf (it's generated d.ts) 73 | } 74 | 75 | if (importPath) { 76 | const rewrittenPath = rewritePath(importPath, sf, opts, regexps) 77 | 78 | // Only rewrite relative path 79 | if (rewrittenPath !== importPath) { 80 | if (ts.isImportDeclaration(node)) { 81 | return ctx.factory.updateImportDeclaration( 82 | node, 83 | node.decorators, 84 | node.modifiers, 85 | node.importClause, 86 | ctx.factory.createStringLiteral(rewrittenPath) 87 | ); 88 | } else if (ts.isExportDeclaration(node)) { 89 | return ctx.factory.updateExportDeclaration( 90 | node, 91 | node.decorators, 92 | node.modifiers, 93 | node.isTypeOnly, 94 | node.exportClause, 95 | ctx.factory.createStringLiteral(rewrittenPath) 96 | ); 97 | } else if (isDynamicImport(node)) { 98 | return ctx.factory.updateCallExpression( 99 | node, 100 | node.expression, 101 | node.typeArguments, 102 | ctx.factory.createNodeArray([ 103 | ctx.factory.createStringLiteral(rewrittenPath), 104 | ]) 105 | ); 106 | } else if (ts.isImportTypeNode(node)) { 107 | return ctx.factory.updateImportTypeNode( 108 | node, 109 | ts.createLiteralTypeNode( 110 | ts.createStringLiteral(rewrittenPath) 111 | ), 112 | node.qualifier, 113 | node.typeArguments, 114 | node.isTypeOf 115 | ); 116 | } 117 | } 118 | return node; 119 | } 120 | return ts.visitEachChild(node, visitor, ctx) 121 | } 122 | 123 | return visitor 124 | } 125 | 126 | export function transform(opts: Opts): ts.TransformerFactory { 127 | const { alias = {} } = opts 128 | const regexps: Record = Object.keys(alias).reduce( 129 | (all, regexString) => { 130 | all[regexString] = new RegExp(regexString, 'gi') 131 | return all 132 | }, 133 | {} as Record 134 | ) 135 | return (ctx: ts.TransformationContext): ts.Transformer => { 136 | return (sf: ts.SourceFile) => ts.visitNode(sf, importExportVisitor(ctx, sf, opts, regexps)) 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /test/fixture/bar.ts: -------------------------------------------------------------------------------- 1 | export const dummy = 1; 2 | export const dummy2 = 2; -------------------------------------------------------------------------------- /test/fixture/bar2.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dropbox/ts-transform-import-path-rewrite/4eb9fa95c3e9d8fdc7fd0b8b5ea41e28de12cb61/test/fixture/bar2.ts -------------------------------------------------------------------------------- /test/fixture/foo.ts: -------------------------------------------------------------------------------- 1 | import { dummy } from "./bar"; 2 | import * as fsExtra from "fs-extra"; 3 | import {sync} from 'glob' 4 | import {hasMagic} from 'glob' 5 | export function dummyFs(fn: string) { 6 | fsExtra.readFileSync(fn); 7 | return import("./bar") 8 | } 9 | export const dummy1 = dummy + 1; 10 | export const readFile = fsExtra.readFile; 11 | export const globSync = sync 12 | export const hasMagic1 = hasMagic 13 | export {dummy2} from './bar' 14 | export * from './bar' 15 | export {dummyBar2} from './bar2' -------------------------------------------------------------------------------- /test/transform.test.ts: -------------------------------------------------------------------------------- 1 | import compile from "../compile"; 2 | import { resolve } from "path"; 3 | import { expect } from "chai"; 4 | import { Opts as PathTransformOpts } from "../src"; 5 | import { readFile } from "fs-extra"; 6 | 7 | const opts: PathTransformOpts = { 8 | projectBaseDir: resolve(__dirname, ".."), 9 | project: "dummy-project", 10 | rewrite(importPath) { 11 | if (importPath.startsWith("fs-extra")) { 12 | return "rewritten/fs-extra"; 13 | } 14 | }, 15 | alias: { 16 | '\.\/bar2': 'relative', 17 | '^(glob)$': 'external/$1' 18 | } 19 | }; 20 | 21 | describe("import path rewrite should work", function() { 22 | this.timeout(5000); 23 | beforeEach(function() { 24 | compile(resolve(__dirname, "fixture/foo.ts"), opts); 25 | }); 26 | it("in js output", function() { 27 | return readFile(resolve(__dirname, "fixture/foo.js"), "utf8").then(content => { 28 | expect(content).to.equal( 29 | `import { dummy } from "dummy-project/test/fixture/bar"; 30 | import * as fsExtra from "rewritten/fs-extra"; 31 | import { sync } from "external/glob"; 32 | import { hasMagic } from "external/glob"; 33 | export function dummyFs(fn) { 34 | fsExtra.readFileSync(fn); 35 | return import("dummy-project/test/fixture/bar"); 36 | } 37 | export const dummy1 = dummy + 1; 38 | export const readFile = fsExtra.readFile; 39 | export const globSync = sync; 40 | export const hasMagic1 = hasMagic; 41 | export { dummy2 } from "dummy-project/test/fixture/bar"; 42 | export * from "dummy-project/test/fixture/bar"; 43 | export { dummyBar2 } from "relative"; 44 | ` 45 | ) 46 | }); 47 | }); 48 | it("in d.ts output", function() { 49 | return readFile(resolve(__dirname, "fixture/foo.d.ts"), "utf8").then(content => { 50 | expect(content).to.contain( 51 | 'import * as fsExtra from "rewritten/fs-extra";' 52 | ); 53 | expect(content).to.contain( 54 | 'export { dummy2 } from "dummy-project/test/fixture/bar";' 55 | ); 56 | expect(content).to.contain( 57 | 'export * from "dummy-project/test/fixture/bar";' 58 | ); 59 | }); 60 | }); 61 | it('should prioritize alias over relative resolution', function () { 62 | return readFile(resolve(__dirname, "fixture/foo.d.ts"), "utf8").then(content => { 63 | expect(content).to.contain( 64 | 'export { dummyBar2 } from "relative";' 65 | ); 66 | }); 67 | }) 68 | }); 69 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "compilerOptions": { 4 | "target": "es6", 5 | "module": "commonjs", 6 | "declaration": true, 7 | "experimentalDecorators": true, 8 | "moduleResolution": "node", 9 | "noUnusedLocals": true, 10 | "noUnusedParameters": true, 11 | "stripInternal": true, 12 | "jsx": "react", 13 | "noImplicitAny": true, 14 | "outDir": "dist" 15 | }, 16 | "include": [ 17 | "src/**/*" 18 | ], 19 | "exclude": [ 20 | "node_modules", 21 | "dist" 22 | ] 23 | } 24 | --------------------------------------------------------------------------------