├── .eslintrc.js ├── .github └── workflows │ └── check.yml ├── .gitignore ├── LICENSE ├── README.md ├── example.js ├── index.js ├── package-lock.json ├── package.json ├── src ├── apply-structured-template.js ├── apply-template.js ├── default-matcher.js ├── find-nodes.js ├── lazy-checked-clone.js ├── replace.js └── utilities.js └── test ├── .eslintrc.js ├── apply-structured-template.js ├── apply-template.js └── find-nodes.js /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: 'eslint:recommended', 3 | env: { 4 | es6: true, 5 | node: true, 6 | browser: false, 7 | }, 8 | parserOptions: { 9 | ecmaVersion: 2016, 10 | sourceType: 'script', 11 | }, 12 | rules: { 13 | 'arrow-parens': ['error', 'as-needed'], 14 | 'array-bracket-spacing': ['error', 'never'], 15 | 'brace-style': ['error', '1tbs'], 16 | 'camelcase': 'error', 17 | 'comma-dangle': ['error', 'always-multiline'], 18 | 'comma-spacing': ['error', { before: false, after: true }], 19 | 'comma-style': ['error', 'last'], 20 | 'computed-property-spacing': ['error', 'never'], 21 | 'consistent-return': 'error', 22 | 'consistent-this': ['error', 'self'], 23 | 'curly': ['error', 'multi-line'], 24 | 'dot-notation': 'error', 25 | 'eol-last': 'error', 26 | 'eqeqeq': ['error', 'smart'], 27 | 'guard-for-in': 'error', 28 | 'indent': ['error', 2, { SwitchCase: 1, VariableDeclarator: { var: 2, let: 2, const: 3 } }], 29 | 'key-spacing': ['error', { beforeColon: false, afterColon: true }], 30 | 'keyword-spacing': 'error', 31 | // 'max-len': ['warn', 120], 32 | 'no-alert': 'error', 33 | 'no-caller': 'error', 34 | 'no-catch-shadow': 'error', 35 | 'no-console': 'warn', 36 | 'no-else-return': 'error', 37 | 'no-empty': ['error', { allowEmptyCatch: true }], 38 | 'no-eval': 'error', 39 | 'no-extend-native': 'error', 40 | 'no-extra-bind': 'error', 41 | 'no-extra-parens': 'warn', 42 | 'no-fallthrough': 'error', 43 | 'no-floating-decimal': 'error', 44 | 'no-implied-eval': 'error', 45 | 'no-inner-declarations': ['error', 'both'], 46 | 'no-lonely-if': 'error', 47 | 'no-loop-func': 'error', 48 | 'no-mixed-spaces-and-tabs': 'error', 49 | 'no-multi-spaces': 'error', 50 | 'no-multiple-empty-lines': ['error', { max: 2 }], 51 | 'no-negated-condition': 'error', 52 | 'no-param-reassign': 'warn', 53 | 'no-redeclare': 'error', 54 | 'no-return-assign': 'error', 55 | 'no-self-compare': 'error', 56 | 'no-sequences': 'error', 57 | 'no-shadow': ['error', { builtinGlobals: true }], 58 | 'no-shadow-restricted-names': 'error', 59 | 'no-spaced-func': 'error', 60 | 'no-trailing-spaces': 'error', 61 | 'no-undef': 'error', 62 | 'no-undefined': 'error', 63 | 'no-underscore-dangle': 'off', 64 | 'no-unused-vars': ['error', { vars: 'all', args: 'after-used' }], 65 | 'no-use-before-define': ['error', 'nofunc'], 66 | 'no-useless-call': 'error', 67 | 'no-useless-escape': 'error', 68 | 'no-var': 'error', 69 | 'no-warning-comments': 'off', 70 | 'no-with': 'error', 71 | 'object-curly-spacing': ['error', 'always'], 72 | 'object-shorthand': ['error', 'always'], 73 | 'prefer-arrow-callback': ['error'], 74 | 'quotes': ['error', 'single'], 75 | 'semi': ['error', 'always'], 76 | 'semi-spacing': ['error', { before: false, after: true }], 77 | 'space-before-blocks': 'error', 78 | 'space-before-function-paren': ['error', { anonymous: 'always', named: 'never' }], 79 | 'space-in-parens': 'error', 80 | 'space-infix-ops': 'error', 81 | 'space-unary-ops': 'error', 82 | 'spaced-comment': ['warn', 'always', { block: { markers: ['!'], exceptions: ['*'] } }], 83 | 'strict': 'off', 84 | 'valid-jsdoc': 'warn', 85 | 'wrap-iife': ['error', 'outside'], 86 | 'yoda': ['error', 'never'], 87 | }, 88 | }; 89 | -------------------------------------------------------------------------------- /.github/workflows/check.yml: -------------------------------------------------------------------------------- 1 | name: check 2 | 3 | on: 4 | push: 5 | branches: 6 | - es2019 7 | pull_request: 8 | 9 | jobs: 10 | pre: 11 | name: Prerequisites 12 | if: github.event_name == 'pull_request' 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - name: Checkout 17 | uses: actions/checkout@v2 18 | with: 19 | fetch-depth: 0 20 | 21 | - name: Enforce CLA signature 22 | env: 23 | COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }} 24 | run: curl https://raw.githubusercontent.com/shapesecurity/CLA/HEAD/cla-check.sh | bash 25 | 26 | check: 27 | needs: pre 28 | if: | 29 | !cancelled() && !failure() 30 | runs-on: ubuntu-latest 31 | 32 | strategy: 33 | matrix: 34 | node: [14, 16, 18] 35 | 36 | name: Check - node ${{ matrix.node }} 37 | 38 | steps: 39 | - name: Checkout 40 | uses: actions/checkout@v2 41 | 42 | - name: Setup node 43 | uses: actions/setup-node@v2 44 | with: 45 | node-version: ${{ matrix.node }} 46 | 47 | - name: Install dependencies 48 | run: npm ci 49 | 50 | - name: Build 51 | run: npm run build 52 | 53 | - name: Lint 54 | run: npm run lint -- --quiet 55 | 56 | - name: Test 57 | run: npm test 58 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /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 [yyyy] [name of copyright owner] 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. 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Shift Template 2 | 3 | ## About 4 | 5 | This module provides a templating system based on [Shift format](https://github.com/shapesecurity/shift-spec) ASTs for JavaScript programs. 6 | 7 | 8 | ## Status 9 | 10 | [Stable](http://nodejs.org/api/documentation.html#documentation_stability_index). 11 | 12 | 13 | ## Installation 14 | 15 | ```sh 16 | npm install shift-template 17 | ``` 18 | 19 | 20 | ## Usage 21 | 22 | This module exports three functions: `findNodes`, `applyTemplate`, and `applyStructuredTemplate`. 23 | 24 | `findNodes` takes the output of `parse{Script,Module}WithLocation` from [shift-parser](https://github.com/shapesecurity/shift-parser-js) as run on a source text which has comments in a certain format before nodes of interest. An optional second parameter to `findNodes` allows customizing the comment format; by default it is `/*# name #*/` or `/*# name # type #*/`. It returns a list of objects of the form `{ name, node, comment }`, where the first property is a name given in a marker comment, the second is the node which follows that marker, and the third an object with metadata about the comment. 25 | 26 | For example, 27 | 28 | ```js 29 | let { parseScriptWithLocation } = require('shift-parser'); 30 | 31 | let src = ` 32 | a + /*# foo # IdentifierExpression #*/ b; 33 | 0 + /*# bar #*/ 1; 34 | `; 35 | 36 | let { tree, locations, comments } = parseScriptWithLocation(src); 37 | 38 | let names = findNodes({ tree, locations, comments }); 39 | 40 | console.log(names); 41 | /* 42 | [ 43 | { 44 | name: "foo", 45 | node: { 46 | type: "IdentifierExpression", 47 | name: "b", 48 | }, 49 | comment: { text, type, start, end }, 50 | }, 51 | { 52 | name: "bar", 53 | node: { 54 | type: "LiteralNumericExpression", 55 | value: 1, 56 | }, 57 | comment: { text, type, start, end }, 58 | }, 59 | ] 60 | */ 61 | ``` 62 | 63 | 64 | `applyTemplate` is a convenience function built on top of `findNodes` which takes source code annotated with marking comments as above and an object giving replacing functions for each marker. It returns an AST corresponding to that of the original source with all marked nodes replaced by the corresponding supplied replacement. 65 | 66 | For example, 67 | 68 | ```js 69 | let Shift = require('shift-ast/checked'); 70 | 71 | let src = ` 72 | a + /*# foo # IdentifierExpression #*/ b; 73 | 0 + /*# bar #*/ 1; 74 | `; 75 | 76 | 77 | let replaced = applyTemplate(src, { 78 | foo: node => new Shift.IdentifierExpression({ name: node.name + '_' }), 79 | bar: node => new Shift.LiteralNumericExpression({ value: node.value + 1 }), 80 | }); 81 | 82 | ``` 83 | produces an AST corresponding to the script 84 | ```js 85 | a + b_; 86 | 0 + 2; 87 | ``` 88 | 89 | The replacing functions are passed a node which has already had the template applied to its children, so you can safely replace both an inner node and its parent as long as the function generating a replacement for the parent uses its argument. 90 | 91 | A more sophisiticated example (a build-time implementation of an `autobind` class decorator) is in [example.js](example.js). 92 | 93 | 94 | `applyStructuredTemplate` extends the above by giving special meaning to labels of the form `if foo`, `unless foo`, and `for each foo of bar`. For `if` and `unless`, you should supply a property named `foo` holding a boolean in the second parameter. For `for each`, you should supply a property named `bar` holding a list of objects of the same shape as the full parameter. 95 | 96 | `if`-marked nodes are included as long as the condition is `true`; `unless` are included as long as it is `false`. These markers may only be included on nodes that are in an optional or list position in the AST. In the case of a list of optional nodes, omitting the node is treated as omitting the entry from the list, rather than putting in an empty value in the list. 97 | 98 | For `for each` nodes, the node will be included multiple times. Each time, the template will be evaluated using the values supplied in the corresponding list. The values may be referenced by prefixing their name with the variable name and `::`. The `for each` marker may only be included on nodes which are in list position in the AST. 99 | 100 | Multiple of these structural labels may be used on a single node. 101 | 102 | For example, 103 | 104 | ```js 105 | let Shift = require('shift-ast/checked'); 106 | 107 | let script = ` 108 | [ 109 | /*# if markerAtStart #*/ 110 | { prop: 'marker' }, 111 | /*# for each x of xs #*/ 112 | { prop: /*# x::prop #*/ null }, 113 | /*# unless markerAtStart #*/ 114 | { prop: 'marker' }, 115 | ] 116 | `; 117 | 118 | let templateValues = { 119 | markerAtStart: false, 120 | xs: [ 121 | { prop: () => new Shift.LiteralNumericExpression({ value: 1 }) }, 122 | { prop: () => new Shift.LiteralNumericExpression({ value: 2 }) }, 123 | { prop: () => new Shift.LiteralNumericExpression({ value: 3 }) }, 124 | ] 125 | }; 126 | 127 | let replaced = applyStructuredTemplate(script, templateValues); 128 | 129 | ``` 130 | produces an AST corresponding to the script 131 | ```js 132 | [ 133 | { prop: 1 }, 134 | { prop: 2 }, 135 | { prop: 3 }, 136 | { prop: 'marker' }, 137 | ] 138 | ``` 139 | 140 | ### Handling ambiguous markers 141 | 142 | It is possible for two nodes two start at exactly the same place. Often it suffices to resolve the ambiguity by specifying the type of the node of interest. However, it is possible for two nodes of the same type to start at exactly the same place, as in `a + b + c` (which has two BinaryExpression nodes starting at the beginning of the source). In these cases the outermost is picked. If there is no unique outermost node satisfying the type constraint, an error is thrown. 143 | 144 | 145 | ### Specifying comment format 146 | 147 | Both functions take an optional final argument which is an options bag. Currently it supports one option, `matcher`, which is a function for parsing comments. This function, if supplied, should take the text of a comment and return either `null` to indicate that the comment is not to be treated as marking a node or an object of type `{ name: string, predicate: Node => bool }` to indicate that it is to be treated as marking a node. The function supplied as `predicate` will be used to test nodes to see if they match the label: for example, the default matcher when given `/*# label # type #*/` returns `{ name: 'label', predicate: node => node.type === "type" }` and when given `/*# label #*/` returns `{ name: 'label', predicate: node => true }`. 148 | 149 | 150 | ### Nodes with multiple names, names with multiple nodes 151 | 152 | `findNodes` permits both nodes which have multiple names and names which occur multiple times. Depending on your application, you may wish to forbid one or both of these. 153 | 154 | If you just want to get a map from names to nodes, you can do 155 | ```js 156 | let names = findNodes(data); 157 | let map = new Map(namePairs.map(({ name, node }) => [name, node]); 158 | if (map.size < namePairs.length) { 159 | throw new TypeError('duplicate name'); 160 | } 161 | ``` 162 | 163 | 164 | `applyTemplate` forbids nodes which have multiple names, but allows names which occur multiple times. 165 | 166 | 167 | ### Validating correctness 168 | 169 | `applyTemplate` enforces that the tree it produces conforms to the types in the Shift specification. However, some such trees are not valid programs. It is the responsibility of the calling code to ensure it does not produce such a well-typed but invalid program, or to run both the `EarlyErrorChecker` from [shift-parser](https://github.com/shapesecurity/shift-parser-js/) and the Validator from [shift-validator](https://github.com/shapesecurity/shift-validator-js) to check for invalid programs. 170 | 171 | 172 | ## Contributing 173 | 174 | * Ensure you've signed the [CLA](https://github.com/shapesecurity/CLA/). 175 | * Open a Github issue with a description of your desired change. If one exists already, leave a message stating that you are working on it with the date you expect it to be complete. 176 | * Fork this repo, and clone the forked repo. 177 | * Install dependencies with `npm install`. 178 | * Build and test in your environment with `npm run build && npm test`. 179 | * Create a feature branch. Make your changes. Add tests. 180 | * Build and test in your environment with `npm run build && npm test`. 181 | * Make a commit that includes the text "fixes #*XX*" where *XX* is the Github issue. 182 | * Open a Pull Request on Github. 183 | 184 | 185 | ## License 186 | 187 | Copyright 2018 Shape Security, Inc. 188 | 189 | Licensed under the Apache License, Version 2.0 (the "License"); 190 | you may not use this file except in compliance with the License. 191 | You may obtain a copy of the License at 192 | 193 | http://www.apache.org/licenses/LICENSE-2.0 194 | 195 | Unless required by applicable law or agreed to in writing, software 196 | distributed under the License is distributed on an "AS IS" BASIS, 197 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 198 | See the License for the specific language governing permissions and 199 | limitations under the License. 200 | -------------------------------------------------------------------------------- /example.js: -------------------------------------------------------------------------------- 1 | // NB: you will need to `npm install --no-save shift-codegen` before running this file. 2 | 3 | 'use strict'; 4 | 5 | let Shift = require('shift-ast/checked'); 6 | let { default: codeGen, FormattedCodeGen } = require('shift-codegen'); 7 | 8 | let { applyTemplate } = require('.'); 9 | 10 | 11 | let nameTemplate = ' /*# access # StaticMemberAssignmentTarget #*/this.foo = (/*# access # StaticMemberExpression #*/ this.foo).bind(this);'; 12 | 13 | function bindClassMethods(klass) { 14 | // It would not be hard to handle these cases; I'm just really lazy 15 | if (klass.super !== null) { 16 | throw new TypeError('Unimplemented: classes with super'); 17 | } 18 | if (klass.elements.some(e => !e.isStatic && e.method.name.type === 'StaticPropertyName' && e.method.name.value === 'constructor')) { 19 | throw new TypeError('Unimplemented: classes with constructors'); 20 | } 21 | let boundNames = klass.elements 22 | .filter(e => !e.isStatic && e.method.type === 'Method' && e.method.name.type === 'StaticPropertyName' && e.method.name.value !== 'constructor') 23 | .map(e => e.method.name.value); 24 | let newCtor = new Shift.ClassElement({ 25 | isStatic: false, 26 | method: new Shift.Method({ 27 | isGenerator: false, 28 | name: new Shift.StaticPropertyName({ value: 'constructor' }), 29 | params: new Shift.FormalParameters({ items: [], rest: null }), 30 | body: new Shift.FunctionBody({ 31 | directives: [], 32 | statements: boundNames.map(name => applyTemplate(nameTemplate, { access: ({ type, object }) => new Shift[type]({ object, property: name }) }).statements[0]), 33 | }), 34 | }), 35 | }); 36 | return new Shift[klass.type]({ name: klass.name, super: klass.super, elements: [newCtor].concat(klass.elements) }); 37 | } 38 | 39 | function matchClassDecorator(text) { 40 | let match = text.match(/ *(@\w+) */); 41 | if (match === null) { 42 | return null; 43 | } 44 | return { name: match[1], predicate: node => node.type === 'ClassExpression' || node.type === 'ClassDeclaration' }; 45 | } 46 | 47 | 48 | let example = ` 49 | 50 | /* @autobind */ 51 | class A { 52 | onclick() { 53 | console.log(this); 54 | } 55 | 56 | trigger() { 57 | this.onclick(); 58 | } 59 | } 60 | 61 | /* @autobind */ 62 | class B { 63 | bar() { 64 | console.log(this); 65 | } 66 | } 67 | 68 | `; 69 | 70 | 71 | let replaced = applyTemplate(example, { '@autobind': bindClassMethods }, { matcher: matchClassDecorator }); 72 | 73 | console.log(codeGen(replaced, new FormattedCodeGen)); 74 | 75 | 76 | /* 77 | Output: 78 | 79 | ```js 80 | class A { 81 | constructor() { 82 | this.onclick = this.onclick.bind(this); 83 | this.trigger = this.trigger.bind(this); 84 | } 85 | onclick() { 86 | console.log(this); 87 | } 88 | trigger() { 89 | this.onclick(); 90 | } 91 | } 92 | class B { 93 | constructor() { 94 | this.bar = this.bar.bind(this); 95 | } 96 | bar() { 97 | console.log(this); 98 | } 99 | } 100 | ``` 101 | 102 | */ 103 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const findNodes = require('./src/find-nodes.js'); 4 | const applyTemplate = require('./src/apply-template.js'); 5 | const applyStructuredTemplate = require('./src/apply-structured-template.js'); 6 | const replace = require('./src/replace.js'); 7 | 8 | module.exports = { findNodes, replace, applyTemplate, applyStructuredTemplate }; 9 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "shift-template", 3 | "version": "2.0.0", 4 | "lockfileVersion": 2, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "shift-template", 9 | "version": "2.0.0", 10 | "license": "Apache-2.0", 11 | "dependencies": { 12 | "shift-ast": "7.0.0", 13 | "shift-parser": "8.0.0", 14 | "shift-reducer": "7.0.0", 15 | "shift-spec": "2019.0.0" 16 | }, 17 | "devDependencies": { 18 | "eslint": "^8.17.0", 19 | "mocha": "^10.0.0" 20 | } 21 | }, 22 | "node_modules/@eslint/eslintrc": { 23 | "version": "1.3.0", 24 | "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.0.tgz", 25 | "integrity": "sha512-UWW0TMTmk2d7hLcWD1/e2g5HDM/HQ3csaLSqXCfqwh4uNDuNqlaKWXmEsL4Cs41Z0KnILNvwbHAah3C2yt06kw==", 26 | "dev": true, 27 | "dependencies": { 28 | "ajv": "^6.12.4", 29 | "debug": "^4.3.2", 30 | "espree": "^9.3.2", 31 | "globals": "^13.15.0", 32 | "ignore": "^5.2.0", 33 | "import-fresh": "^3.2.1", 34 | "js-yaml": "^4.1.0", 35 | "minimatch": "^3.1.2", 36 | "strip-json-comments": "^3.1.1" 37 | }, 38 | "engines": { 39 | "node": "^12.22.0 || ^14.17.0 || >=16.0.0" 40 | } 41 | }, 42 | "node_modules/@humanwhocodes/config-array": { 43 | "version": "0.9.5", 44 | "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz", 45 | "integrity": "sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw==", 46 | "dev": true, 47 | "dependencies": { 48 | "@humanwhocodes/object-schema": "^1.2.1", 49 | "debug": "^4.1.1", 50 | "minimatch": "^3.0.4" 51 | }, 52 | "engines": { 53 | "node": ">=10.10.0" 54 | } 55 | }, 56 | "node_modules/@humanwhocodes/object-schema": { 57 | "version": "1.2.1", 58 | "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", 59 | "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", 60 | "dev": true 61 | }, 62 | "node_modules/@ungap/promise-all-settled": { 63 | "version": "1.1.2", 64 | "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", 65 | "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", 66 | "dev": true 67 | }, 68 | "node_modules/acorn": { 69 | "version": "8.7.1", 70 | "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz", 71 | "integrity": "sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==", 72 | "dev": true, 73 | "bin": { 74 | "acorn": "bin/acorn" 75 | }, 76 | "engines": { 77 | "node": ">=0.4.0" 78 | } 79 | }, 80 | "node_modules/acorn-jsx": { 81 | "version": "5.3.2", 82 | "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", 83 | "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", 84 | "dev": true, 85 | "peerDependencies": { 86 | "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" 87 | } 88 | }, 89 | "node_modules/ajv": { 90 | "version": "6.12.6", 91 | "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", 92 | "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", 93 | "dev": true, 94 | "dependencies": { 95 | "fast-deep-equal": "^3.1.1", 96 | "fast-json-stable-stringify": "^2.0.0", 97 | "json-schema-traverse": "^0.4.1", 98 | "uri-js": "^4.2.2" 99 | }, 100 | "funding": { 101 | "type": "github", 102 | "url": "https://github.com/sponsors/epoberezkin" 103 | } 104 | }, 105 | "node_modules/ansi-colors": { 106 | "version": "4.1.1", 107 | "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", 108 | "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", 109 | "dev": true, 110 | "engines": { 111 | "node": ">=6" 112 | } 113 | }, 114 | "node_modules/ansi-regex": { 115 | "version": "5.0.1", 116 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", 117 | "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", 118 | "dev": true, 119 | "engines": { 120 | "node": ">=8" 121 | } 122 | }, 123 | "node_modules/ansi-styles": { 124 | "version": "4.3.0", 125 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", 126 | "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", 127 | "dev": true, 128 | "dependencies": { 129 | "color-convert": "^2.0.1" 130 | }, 131 | "engines": { 132 | "node": ">=8" 133 | }, 134 | "funding": { 135 | "url": "https://github.com/chalk/ansi-styles?sponsor=1" 136 | } 137 | }, 138 | "node_modules/anymatch": { 139 | "version": "3.1.2", 140 | "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", 141 | "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", 142 | "dev": true, 143 | "dependencies": { 144 | "normalize-path": "^3.0.0", 145 | "picomatch": "^2.0.4" 146 | }, 147 | "engines": { 148 | "node": ">= 8" 149 | } 150 | }, 151 | "node_modules/argparse": { 152 | "version": "2.0.1", 153 | "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", 154 | "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", 155 | "dev": true 156 | }, 157 | "node_modules/balanced-match": { 158 | "version": "1.0.2", 159 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", 160 | "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", 161 | "dev": true 162 | }, 163 | "node_modules/binary-extensions": { 164 | "version": "2.2.0", 165 | "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", 166 | "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", 167 | "dev": true, 168 | "engines": { 169 | "node": ">=8" 170 | } 171 | }, 172 | "node_modules/brace-expansion": { 173 | "version": "1.1.11", 174 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 175 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 176 | "dev": true, 177 | "dependencies": { 178 | "balanced-match": "^1.0.0", 179 | "concat-map": "0.0.1" 180 | } 181 | }, 182 | "node_modules/braces": { 183 | "version": "3.0.2", 184 | "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", 185 | "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", 186 | "dev": true, 187 | "dependencies": { 188 | "fill-range": "^7.0.1" 189 | }, 190 | "engines": { 191 | "node": ">=8" 192 | } 193 | }, 194 | "node_modules/browser-stdout": { 195 | "version": "1.3.1", 196 | "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", 197 | "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", 198 | "dev": true 199 | }, 200 | "node_modules/callsites": { 201 | "version": "3.1.0", 202 | "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", 203 | "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", 204 | "dev": true, 205 | "engines": { 206 | "node": ">=6" 207 | } 208 | }, 209 | "node_modules/camelcase": { 210 | "version": "6.3.0", 211 | "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", 212 | "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", 213 | "dev": true, 214 | "engines": { 215 | "node": ">=10" 216 | }, 217 | "funding": { 218 | "url": "https://github.com/sponsors/sindresorhus" 219 | } 220 | }, 221 | "node_modules/chalk": { 222 | "version": "4.1.2", 223 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", 224 | "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", 225 | "dev": true, 226 | "dependencies": { 227 | "ansi-styles": "^4.1.0", 228 | "supports-color": "^7.1.0" 229 | }, 230 | "engines": { 231 | "node": ">=10" 232 | }, 233 | "funding": { 234 | "url": "https://github.com/chalk/chalk?sponsor=1" 235 | } 236 | }, 237 | "node_modules/chokidar": { 238 | "version": "3.5.3", 239 | "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", 240 | "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", 241 | "dev": true, 242 | "funding": [ 243 | { 244 | "type": "individual", 245 | "url": "https://paulmillr.com/funding/" 246 | } 247 | ], 248 | "dependencies": { 249 | "anymatch": "~3.1.2", 250 | "braces": "~3.0.2", 251 | "glob-parent": "~5.1.2", 252 | "is-binary-path": "~2.1.0", 253 | "is-glob": "~4.0.1", 254 | "normalize-path": "~3.0.0", 255 | "readdirp": "~3.6.0" 256 | }, 257 | "engines": { 258 | "node": ">= 8.10.0" 259 | }, 260 | "optionalDependencies": { 261 | "fsevents": "~2.3.2" 262 | } 263 | }, 264 | "node_modules/chokidar/node_modules/glob-parent": { 265 | "version": "5.1.2", 266 | "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", 267 | "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", 268 | "dev": true, 269 | "dependencies": { 270 | "is-glob": "^4.0.1" 271 | }, 272 | "engines": { 273 | "node": ">= 6" 274 | } 275 | }, 276 | "node_modules/cliui": { 277 | "version": "7.0.4", 278 | "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", 279 | "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", 280 | "dev": true, 281 | "dependencies": { 282 | "string-width": "^4.2.0", 283 | "strip-ansi": "^6.0.0", 284 | "wrap-ansi": "^7.0.0" 285 | } 286 | }, 287 | "node_modules/color-convert": { 288 | "version": "2.0.1", 289 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", 290 | "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", 291 | "dev": true, 292 | "dependencies": { 293 | "color-name": "~1.1.4" 294 | }, 295 | "engines": { 296 | "node": ">=7.0.0" 297 | } 298 | }, 299 | "node_modules/color-name": { 300 | "version": "1.1.4", 301 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", 302 | "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", 303 | "dev": true 304 | }, 305 | "node_modules/concat-map": { 306 | "version": "0.0.1", 307 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 308 | "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", 309 | "dev": true 310 | }, 311 | "node_modules/cross-spawn": { 312 | "version": "7.0.3", 313 | "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", 314 | "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", 315 | "dev": true, 316 | "dependencies": { 317 | "path-key": "^3.1.0", 318 | "shebang-command": "^2.0.0", 319 | "which": "^2.0.1" 320 | }, 321 | "engines": { 322 | "node": ">= 8" 323 | } 324 | }, 325 | "node_modules/debug": { 326 | "version": "4.3.4", 327 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", 328 | "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", 329 | "dev": true, 330 | "dependencies": { 331 | "ms": "2.1.2" 332 | }, 333 | "engines": { 334 | "node": ">=6.0" 335 | }, 336 | "peerDependenciesMeta": { 337 | "supports-color": { 338 | "optional": true 339 | } 340 | } 341 | }, 342 | "node_modules/decamelize": { 343 | "version": "4.0.0", 344 | "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", 345 | "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", 346 | "dev": true, 347 | "engines": { 348 | "node": ">=10" 349 | }, 350 | "funding": { 351 | "url": "https://github.com/sponsors/sindresorhus" 352 | } 353 | }, 354 | "node_modules/deep-is": { 355 | "version": "0.1.4", 356 | "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", 357 | "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", 358 | "dev": true 359 | }, 360 | "node_modules/diff": { 361 | "version": "5.0.0", 362 | "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", 363 | "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", 364 | "dev": true, 365 | "engines": { 366 | "node": ">=0.3.1" 367 | } 368 | }, 369 | "node_modules/doctrine": { 370 | "version": "3.0.0", 371 | "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", 372 | "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", 373 | "dev": true, 374 | "dependencies": { 375 | "esutils": "^2.0.2" 376 | }, 377 | "engines": { 378 | "node": ">=6.0.0" 379 | } 380 | }, 381 | "node_modules/emoji-regex": { 382 | "version": "8.0.0", 383 | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", 384 | "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", 385 | "dev": true 386 | }, 387 | "node_modules/escalade": { 388 | "version": "3.1.1", 389 | "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", 390 | "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", 391 | "dev": true, 392 | "engines": { 393 | "node": ">=6" 394 | } 395 | }, 396 | "node_modules/escape-string-regexp": { 397 | "version": "4.0.0", 398 | "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", 399 | "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", 400 | "dev": true, 401 | "engines": { 402 | "node": ">=10" 403 | }, 404 | "funding": { 405 | "url": "https://github.com/sponsors/sindresorhus" 406 | } 407 | }, 408 | "node_modules/eslint": { 409 | "version": "8.17.0", 410 | "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.17.0.tgz", 411 | "integrity": "sha512-gq0m0BTJfci60Fz4nczYxNAlED+sMcihltndR8t9t1evnU/azx53x3t2UHXC/uRjcbvRw/XctpaNygSTcQD+Iw==", 412 | "dev": true, 413 | "dependencies": { 414 | "@eslint/eslintrc": "^1.3.0", 415 | "@humanwhocodes/config-array": "^0.9.2", 416 | "ajv": "^6.10.0", 417 | "chalk": "^4.0.0", 418 | "cross-spawn": "^7.0.2", 419 | "debug": "^4.3.2", 420 | "doctrine": "^3.0.0", 421 | "escape-string-regexp": "^4.0.0", 422 | "eslint-scope": "^7.1.1", 423 | "eslint-utils": "^3.0.0", 424 | "eslint-visitor-keys": "^3.3.0", 425 | "espree": "^9.3.2", 426 | "esquery": "^1.4.0", 427 | "esutils": "^2.0.2", 428 | "fast-deep-equal": "^3.1.3", 429 | "file-entry-cache": "^6.0.1", 430 | "functional-red-black-tree": "^1.0.1", 431 | "glob-parent": "^6.0.1", 432 | "globals": "^13.15.0", 433 | "ignore": "^5.2.0", 434 | "import-fresh": "^3.0.0", 435 | "imurmurhash": "^0.1.4", 436 | "is-glob": "^4.0.0", 437 | "js-yaml": "^4.1.0", 438 | "json-stable-stringify-without-jsonify": "^1.0.1", 439 | "levn": "^0.4.1", 440 | "lodash.merge": "^4.6.2", 441 | "minimatch": "^3.1.2", 442 | "natural-compare": "^1.4.0", 443 | "optionator": "^0.9.1", 444 | "regexpp": "^3.2.0", 445 | "strip-ansi": "^6.0.1", 446 | "strip-json-comments": "^3.1.0", 447 | "text-table": "^0.2.0", 448 | "v8-compile-cache": "^2.0.3" 449 | }, 450 | "bin": { 451 | "eslint": "bin/eslint.js" 452 | }, 453 | "engines": { 454 | "node": "^12.22.0 || ^14.17.0 || >=16.0.0" 455 | }, 456 | "funding": { 457 | "url": "https://opencollective.com/eslint" 458 | } 459 | }, 460 | "node_modules/eslint-scope": { 461 | "version": "7.1.1", 462 | "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", 463 | "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", 464 | "dev": true, 465 | "dependencies": { 466 | "esrecurse": "^4.3.0", 467 | "estraverse": "^5.2.0" 468 | }, 469 | "engines": { 470 | "node": "^12.22.0 || ^14.17.0 || >=16.0.0" 471 | } 472 | }, 473 | "node_modules/eslint-utils": { 474 | "version": "3.0.0", 475 | "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", 476 | "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", 477 | "dev": true, 478 | "dependencies": { 479 | "eslint-visitor-keys": "^2.0.0" 480 | }, 481 | "engines": { 482 | "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" 483 | }, 484 | "funding": { 485 | "url": "https://github.com/sponsors/mysticatea" 486 | }, 487 | "peerDependencies": { 488 | "eslint": ">=5" 489 | } 490 | }, 491 | "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { 492 | "version": "2.1.0", 493 | "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", 494 | "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", 495 | "dev": true, 496 | "engines": { 497 | "node": ">=10" 498 | } 499 | }, 500 | "node_modules/eslint-visitor-keys": { 501 | "version": "3.3.0", 502 | "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", 503 | "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", 504 | "dev": true, 505 | "engines": { 506 | "node": "^12.22.0 || ^14.17.0 || >=16.0.0" 507 | } 508 | }, 509 | "node_modules/espree": { 510 | "version": "9.3.2", 511 | "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.2.tgz", 512 | "integrity": "sha512-D211tC7ZwouTIuY5x9XnS0E9sWNChB7IYKX/Xp5eQj3nFXhqmiUDB9q27y76oFl8jTg3pXcQx/bpxMfs3CIZbA==", 513 | "dev": true, 514 | "dependencies": { 515 | "acorn": "^8.7.1", 516 | "acorn-jsx": "^5.3.2", 517 | "eslint-visitor-keys": "^3.3.0" 518 | }, 519 | "engines": { 520 | "node": "^12.22.0 || ^14.17.0 || >=16.0.0" 521 | } 522 | }, 523 | "node_modules/esquery": { 524 | "version": "1.4.0", 525 | "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", 526 | "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", 527 | "dev": true, 528 | "dependencies": { 529 | "estraverse": "^5.1.0" 530 | }, 531 | "engines": { 532 | "node": ">=0.10" 533 | } 534 | }, 535 | "node_modules/esrecurse": { 536 | "version": "4.3.0", 537 | "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", 538 | "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", 539 | "dev": true, 540 | "dependencies": { 541 | "estraverse": "^5.2.0" 542 | }, 543 | "engines": { 544 | "node": ">=4.0" 545 | } 546 | }, 547 | "node_modules/estraverse": { 548 | "version": "5.3.0", 549 | "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", 550 | "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", 551 | "dev": true, 552 | "engines": { 553 | "node": ">=4.0" 554 | } 555 | }, 556 | "node_modules/esutils": { 557 | "version": "2.0.3", 558 | "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", 559 | "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", 560 | "dev": true, 561 | "engines": { 562 | "node": ">=0.10.0" 563 | } 564 | }, 565 | "node_modules/fast-deep-equal": { 566 | "version": "3.1.3", 567 | "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", 568 | "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", 569 | "dev": true 570 | }, 571 | "node_modules/fast-json-stable-stringify": { 572 | "version": "2.1.0", 573 | "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", 574 | "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", 575 | "dev": true 576 | }, 577 | "node_modules/fast-levenshtein": { 578 | "version": "2.0.6", 579 | "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", 580 | "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", 581 | "dev": true 582 | }, 583 | "node_modules/file-entry-cache": { 584 | "version": "6.0.1", 585 | "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", 586 | "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", 587 | "dev": true, 588 | "dependencies": { 589 | "flat-cache": "^3.0.4" 590 | }, 591 | "engines": { 592 | "node": "^10.12.0 || >=12.0.0" 593 | } 594 | }, 595 | "node_modules/fill-range": { 596 | "version": "7.0.1", 597 | "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", 598 | "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", 599 | "dev": true, 600 | "dependencies": { 601 | "to-regex-range": "^5.0.1" 602 | }, 603 | "engines": { 604 | "node": ">=8" 605 | } 606 | }, 607 | "node_modules/find-up": { 608 | "version": "5.0.0", 609 | "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", 610 | "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", 611 | "dev": true, 612 | "dependencies": { 613 | "locate-path": "^6.0.0", 614 | "path-exists": "^4.0.0" 615 | }, 616 | "engines": { 617 | "node": ">=10" 618 | }, 619 | "funding": { 620 | "url": "https://github.com/sponsors/sindresorhus" 621 | } 622 | }, 623 | "node_modules/flat": { 624 | "version": "5.0.2", 625 | "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", 626 | "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", 627 | "dev": true, 628 | "bin": { 629 | "flat": "cli.js" 630 | } 631 | }, 632 | "node_modules/flat-cache": { 633 | "version": "3.0.4", 634 | "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", 635 | "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", 636 | "dev": true, 637 | "dependencies": { 638 | "flatted": "^3.1.0", 639 | "rimraf": "^3.0.2" 640 | }, 641 | "engines": { 642 | "node": "^10.12.0 || >=12.0.0" 643 | } 644 | }, 645 | "node_modules/flatted": { 646 | "version": "3.2.5", 647 | "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz", 648 | "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", 649 | "dev": true 650 | }, 651 | "node_modules/fs.realpath": { 652 | "version": "1.0.0", 653 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 654 | "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", 655 | "dev": true 656 | }, 657 | "node_modules/fsevents": { 658 | "version": "2.3.2", 659 | "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", 660 | "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", 661 | "dev": true, 662 | "hasInstallScript": true, 663 | "optional": true, 664 | "os": [ 665 | "darwin" 666 | ], 667 | "engines": { 668 | "node": "^8.16.0 || ^10.6.0 || >=11.0.0" 669 | } 670 | }, 671 | "node_modules/functional-red-black-tree": { 672 | "version": "1.0.1", 673 | "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", 674 | "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", 675 | "dev": true 676 | }, 677 | "node_modules/get-caller-file": { 678 | "version": "2.0.5", 679 | "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", 680 | "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", 681 | "dev": true, 682 | "engines": { 683 | "node": "6.* || 8.* || >= 10.*" 684 | } 685 | }, 686 | "node_modules/glob": { 687 | "version": "7.2.0", 688 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", 689 | "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", 690 | "dev": true, 691 | "dependencies": { 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 | "engines": { 700 | "node": "*" 701 | }, 702 | "funding": { 703 | "url": "https://github.com/sponsors/isaacs" 704 | } 705 | }, 706 | "node_modules/glob-parent": { 707 | "version": "6.0.2", 708 | "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", 709 | "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", 710 | "dev": true, 711 | "dependencies": { 712 | "is-glob": "^4.0.3" 713 | }, 714 | "engines": { 715 | "node": ">=10.13.0" 716 | } 717 | }, 718 | "node_modules/globals": { 719 | "version": "13.15.0", 720 | "resolved": "https://registry.npmjs.org/globals/-/globals-13.15.0.tgz", 721 | "integrity": "sha512-bpzcOlgDhMG070Av0Vy5Owklpv1I6+j96GhUI7Rh7IzDCKLzboflLrrfqMu8NquDbiR4EOQk7XzJwqVJxicxog==", 722 | "dev": true, 723 | "dependencies": { 724 | "type-fest": "^0.20.2" 725 | }, 726 | "engines": { 727 | "node": ">=8" 728 | }, 729 | "funding": { 730 | "url": "https://github.com/sponsors/sindresorhus" 731 | } 732 | }, 733 | "node_modules/has-flag": { 734 | "version": "4.0.0", 735 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", 736 | "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", 737 | "dev": true, 738 | "engines": { 739 | "node": ">=8" 740 | } 741 | }, 742 | "node_modules/he": { 743 | "version": "1.2.0", 744 | "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", 745 | "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", 746 | "dev": true, 747 | "bin": { 748 | "he": "bin/he" 749 | } 750 | }, 751 | "node_modules/ignore": { 752 | "version": "5.2.0", 753 | "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", 754 | "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", 755 | "dev": true, 756 | "engines": { 757 | "node": ">= 4" 758 | } 759 | }, 760 | "node_modules/import-fresh": { 761 | "version": "3.3.0", 762 | "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", 763 | "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", 764 | "dev": true, 765 | "dependencies": { 766 | "parent-module": "^1.0.0", 767 | "resolve-from": "^4.0.0" 768 | }, 769 | "engines": { 770 | "node": ">=6" 771 | }, 772 | "funding": { 773 | "url": "https://github.com/sponsors/sindresorhus" 774 | } 775 | }, 776 | "node_modules/imurmurhash": { 777 | "version": "0.1.4", 778 | "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", 779 | "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", 780 | "dev": true, 781 | "engines": { 782 | "node": ">=0.8.19" 783 | } 784 | }, 785 | "node_modules/inflight": { 786 | "version": "1.0.6", 787 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 788 | "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", 789 | "dev": true, 790 | "dependencies": { 791 | "once": "^1.3.0", 792 | "wrappy": "1" 793 | } 794 | }, 795 | "node_modules/inherits": { 796 | "version": "2.0.4", 797 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 798 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", 799 | "dev": true 800 | }, 801 | "node_modules/is-binary-path": { 802 | "version": "2.1.0", 803 | "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", 804 | "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", 805 | "dev": true, 806 | "dependencies": { 807 | "binary-extensions": "^2.0.0" 808 | }, 809 | "engines": { 810 | "node": ">=8" 811 | } 812 | }, 813 | "node_modules/is-extglob": { 814 | "version": "2.1.1", 815 | "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", 816 | "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", 817 | "dev": true, 818 | "engines": { 819 | "node": ">=0.10.0" 820 | } 821 | }, 822 | "node_modules/is-fullwidth-code-point": { 823 | "version": "3.0.0", 824 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", 825 | "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", 826 | "dev": true, 827 | "engines": { 828 | "node": ">=8" 829 | } 830 | }, 831 | "node_modules/is-glob": { 832 | "version": "4.0.3", 833 | "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", 834 | "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", 835 | "dev": true, 836 | "dependencies": { 837 | "is-extglob": "^2.1.1" 838 | }, 839 | "engines": { 840 | "node": ">=0.10.0" 841 | } 842 | }, 843 | "node_modules/is-number": { 844 | "version": "7.0.0", 845 | "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", 846 | "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", 847 | "dev": true, 848 | "engines": { 849 | "node": ">=0.12.0" 850 | } 851 | }, 852 | "node_modules/is-plain-obj": { 853 | "version": "2.1.0", 854 | "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", 855 | "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", 856 | "dev": true, 857 | "engines": { 858 | "node": ">=8" 859 | } 860 | }, 861 | "node_modules/is-unicode-supported": { 862 | "version": "0.1.0", 863 | "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", 864 | "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", 865 | "dev": true, 866 | "engines": { 867 | "node": ">=10" 868 | }, 869 | "funding": { 870 | "url": "https://github.com/sponsors/sindresorhus" 871 | } 872 | }, 873 | "node_modules/isexe": { 874 | "version": "2.0.0", 875 | "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", 876 | "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", 877 | "dev": true 878 | }, 879 | "node_modules/js-yaml": { 880 | "version": "4.1.0", 881 | "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", 882 | "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", 883 | "dev": true, 884 | "dependencies": { 885 | "argparse": "^2.0.1" 886 | }, 887 | "bin": { 888 | "js-yaml": "bin/js-yaml.js" 889 | } 890 | }, 891 | "node_modules/json-schema-traverse": { 892 | "version": "0.4.1", 893 | "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", 894 | "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", 895 | "dev": true 896 | }, 897 | "node_modules/json-stable-stringify-without-jsonify": { 898 | "version": "1.0.1", 899 | "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", 900 | "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", 901 | "dev": true 902 | }, 903 | "node_modules/levn": { 904 | "version": "0.4.1", 905 | "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", 906 | "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", 907 | "dev": true, 908 | "dependencies": { 909 | "prelude-ls": "^1.2.1", 910 | "type-check": "~0.4.0" 911 | }, 912 | "engines": { 913 | "node": ">= 0.8.0" 914 | } 915 | }, 916 | "node_modules/locate-path": { 917 | "version": "6.0.0", 918 | "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", 919 | "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", 920 | "dev": true, 921 | "dependencies": { 922 | "p-locate": "^5.0.0" 923 | }, 924 | "engines": { 925 | "node": ">=10" 926 | }, 927 | "funding": { 928 | "url": "https://github.com/sponsors/sindresorhus" 929 | } 930 | }, 931 | "node_modules/lodash.merge": { 932 | "version": "4.6.2", 933 | "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", 934 | "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", 935 | "dev": true 936 | }, 937 | "node_modules/log-symbols": { 938 | "version": "4.1.0", 939 | "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", 940 | "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", 941 | "dev": true, 942 | "dependencies": { 943 | "chalk": "^4.1.0", 944 | "is-unicode-supported": "^0.1.0" 945 | }, 946 | "engines": { 947 | "node": ">=10" 948 | }, 949 | "funding": { 950 | "url": "https://github.com/sponsors/sindresorhus" 951 | } 952 | }, 953 | "node_modules/minimatch": { 954 | "version": "3.1.2", 955 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", 956 | "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", 957 | "dev": true, 958 | "dependencies": { 959 | "brace-expansion": "^1.1.7" 960 | }, 961 | "engines": { 962 | "node": "*" 963 | } 964 | }, 965 | "node_modules/mocha": { 966 | "version": "10.0.0", 967 | "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.0.0.tgz", 968 | "integrity": "sha512-0Wl+elVUD43Y0BqPZBzZt8Tnkw9CMUdNYnUsTfOM1vuhJVZL+kiesFYsqwBkEEuEixaiPe5ZQdqDgX2jddhmoA==", 969 | "dev": true, 970 | "dependencies": { 971 | "@ungap/promise-all-settled": "1.1.2", 972 | "ansi-colors": "4.1.1", 973 | "browser-stdout": "1.3.1", 974 | "chokidar": "3.5.3", 975 | "debug": "4.3.4", 976 | "diff": "5.0.0", 977 | "escape-string-regexp": "4.0.0", 978 | "find-up": "5.0.0", 979 | "glob": "7.2.0", 980 | "he": "1.2.0", 981 | "js-yaml": "4.1.0", 982 | "log-symbols": "4.1.0", 983 | "minimatch": "5.0.1", 984 | "ms": "2.1.3", 985 | "nanoid": "3.3.3", 986 | "serialize-javascript": "6.0.0", 987 | "strip-json-comments": "3.1.1", 988 | "supports-color": "8.1.1", 989 | "workerpool": "6.2.1", 990 | "yargs": "16.2.0", 991 | "yargs-parser": "20.2.4", 992 | "yargs-unparser": "2.0.0" 993 | }, 994 | "bin": { 995 | "_mocha": "bin/_mocha", 996 | "mocha": "bin/mocha.js" 997 | }, 998 | "engines": { 999 | "node": ">= 14.0.0" 1000 | }, 1001 | "funding": { 1002 | "type": "opencollective", 1003 | "url": "https://opencollective.com/mochajs" 1004 | } 1005 | }, 1006 | "node_modules/mocha/node_modules/brace-expansion": { 1007 | "version": "2.0.1", 1008 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", 1009 | "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", 1010 | "dev": true, 1011 | "dependencies": { 1012 | "balanced-match": "^1.0.0" 1013 | } 1014 | }, 1015 | "node_modules/mocha/node_modules/minimatch": { 1016 | "version": "5.0.1", 1017 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", 1018 | "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", 1019 | "dev": true, 1020 | "dependencies": { 1021 | "brace-expansion": "^2.0.1" 1022 | }, 1023 | "engines": { 1024 | "node": ">=10" 1025 | } 1026 | }, 1027 | "node_modules/mocha/node_modules/ms": { 1028 | "version": "2.1.3", 1029 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", 1030 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", 1031 | "dev": true 1032 | }, 1033 | "node_modules/mocha/node_modules/supports-color": { 1034 | "version": "8.1.1", 1035 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", 1036 | "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", 1037 | "dev": true, 1038 | "dependencies": { 1039 | "has-flag": "^4.0.0" 1040 | }, 1041 | "engines": { 1042 | "node": ">=10" 1043 | }, 1044 | "funding": { 1045 | "url": "https://github.com/chalk/supports-color?sponsor=1" 1046 | } 1047 | }, 1048 | "node_modules/ms": { 1049 | "version": "2.1.2", 1050 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 1051 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", 1052 | "dev": true 1053 | }, 1054 | "node_modules/multimap": { 1055 | "version": "1.0.2", 1056 | "resolved": "https://registry.npmjs.org/multimap/-/multimap-1.0.2.tgz", 1057 | "integrity": "sha1-aqdvwyM5BbqUi75MdNwsOgNW6zY=" 1058 | }, 1059 | "node_modules/nanoid": { 1060 | "version": "3.3.3", 1061 | "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", 1062 | "integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==", 1063 | "dev": true, 1064 | "bin": { 1065 | "nanoid": "bin/nanoid.cjs" 1066 | }, 1067 | "engines": { 1068 | "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" 1069 | } 1070 | }, 1071 | "node_modules/natural-compare": { 1072 | "version": "1.4.0", 1073 | "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", 1074 | "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", 1075 | "dev": true 1076 | }, 1077 | "node_modules/normalize-path": { 1078 | "version": "3.0.0", 1079 | "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", 1080 | "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", 1081 | "dev": true, 1082 | "engines": { 1083 | "node": ">=0.10.0" 1084 | } 1085 | }, 1086 | "node_modules/once": { 1087 | "version": "1.4.0", 1088 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 1089 | "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", 1090 | "dev": true, 1091 | "dependencies": { 1092 | "wrappy": "1" 1093 | } 1094 | }, 1095 | "node_modules/optionator": { 1096 | "version": "0.9.1", 1097 | "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", 1098 | "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", 1099 | "dev": true, 1100 | "dependencies": { 1101 | "deep-is": "^0.1.3", 1102 | "fast-levenshtein": "^2.0.6", 1103 | "levn": "^0.4.1", 1104 | "prelude-ls": "^1.2.1", 1105 | "type-check": "^0.4.0", 1106 | "word-wrap": "^1.2.3" 1107 | }, 1108 | "engines": { 1109 | "node": ">= 0.8.0" 1110 | } 1111 | }, 1112 | "node_modules/p-limit": { 1113 | "version": "3.1.0", 1114 | "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", 1115 | "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", 1116 | "dev": true, 1117 | "dependencies": { 1118 | "yocto-queue": "^0.1.0" 1119 | }, 1120 | "engines": { 1121 | "node": ">=10" 1122 | }, 1123 | "funding": { 1124 | "url": "https://github.com/sponsors/sindresorhus" 1125 | } 1126 | }, 1127 | "node_modules/p-locate": { 1128 | "version": "5.0.0", 1129 | "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", 1130 | "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", 1131 | "dev": true, 1132 | "dependencies": { 1133 | "p-limit": "^3.0.2" 1134 | }, 1135 | "engines": { 1136 | "node": ">=10" 1137 | }, 1138 | "funding": { 1139 | "url": "https://github.com/sponsors/sindresorhus" 1140 | } 1141 | }, 1142 | "node_modules/parent-module": { 1143 | "version": "1.0.1", 1144 | "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", 1145 | "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", 1146 | "dev": true, 1147 | "dependencies": { 1148 | "callsites": "^3.0.0" 1149 | }, 1150 | "engines": { 1151 | "node": ">=6" 1152 | } 1153 | }, 1154 | "node_modules/path-exists": { 1155 | "version": "4.0.0", 1156 | "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", 1157 | "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", 1158 | "dev": true, 1159 | "engines": { 1160 | "node": ">=8" 1161 | } 1162 | }, 1163 | "node_modules/path-is-absolute": { 1164 | "version": "1.0.1", 1165 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 1166 | "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", 1167 | "dev": true, 1168 | "engines": { 1169 | "node": ">=0.10.0" 1170 | } 1171 | }, 1172 | "node_modules/path-key": { 1173 | "version": "3.1.1", 1174 | "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", 1175 | "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", 1176 | "dev": true, 1177 | "engines": { 1178 | "node": ">=8" 1179 | } 1180 | }, 1181 | "node_modules/picomatch": { 1182 | "version": "2.3.1", 1183 | "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", 1184 | "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", 1185 | "dev": true, 1186 | "engines": { 1187 | "node": ">=8.6" 1188 | }, 1189 | "funding": { 1190 | "url": "https://github.com/sponsors/jonschlinkert" 1191 | } 1192 | }, 1193 | "node_modules/prelude-ls": { 1194 | "version": "1.2.1", 1195 | "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", 1196 | "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", 1197 | "dev": true, 1198 | "engines": { 1199 | "node": ">= 0.8.0" 1200 | } 1201 | }, 1202 | "node_modules/punycode": { 1203 | "version": "2.1.1", 1204 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", 1205 | "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", 1206 | "dev": true, 1207 | "engines": { 1208 | "node": ">=6" 1209 | } 1210 | }, 1211 | "node_modules/randombytes": { 1212 | "version": "2.1.0", 1213 | "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", 1214 | "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", 1215 | "dev": true, 1216 | "dependencies": { 1217 | "safe-buffer": "^5.1.0" 1218 | } 1219 | }, 1220 | "node_modules/readdirp": { 1221 | "version": "3.6.0", 1222 | "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", 1223 | "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", 1224 | "dev": true, 1225 | "dependencies": { 1226 | "picomatch": "^2.2.1" 1227 | }, 1228 | "engines": { 1229 | "node": ">=8.10.0" 1230 | } 1231 | }, 1232 | "node_modules/regexpp": { 1233 | "version": "3.2.0", 1234 | "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", 1235 | "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", 1236 | "dev": true, 1237 | "engines": { 1238 | "node": ">=8" 1239 | }, 1240 | "funding": { 1241 | "url": "https://github.com/sponsors/mysticatea" 1242 | } 1243 | }, 1244 | "node_modules/require-directory": { 1245 | "version": "2.1.1", 1246 | "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", 1247 | "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", 1248 | "dev": true, 1249 | "engines": { 1250 | "node": ">=0.10.0" 1251 | } 1252 | }, 1253 | "node_modules/resolve-from": { 1254 | "version": "4.0.0", 1255 | "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", 1256 | "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", 1257 | "dev": true, 1258 | "engines": { 1259 | "node": ">=4" 1260 | } 1261 | }, 1262 | "node_modules/rimraf": { 1263 | "version": "3.0.2", 1264 | "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", 1265 | "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", 1266 | "dev": true, 1267 | "dependencies": { 1268 | "glob": "^7.1.3" 1269 | }, 1270 | "bin": { 1271 | "rimraf": "bin.js" 1272 | }, 1273 | "funding": { 1274 | "url": "https://github.com/sponsors/isaacs" 1275 | } 1276 | }, 1277 | "node_modules/safe-buffer": { 1278 | "version": "5.2.1", 1279 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", 1280 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", 1281 | "dev": true, 1282 | "funding": [ 1283 | { 1284 | "type": "github", 1285 | "url": "https://github.com/sponsors/feross" 1286 | }, 1287 | { 1288 | "type": "patreon", 1289 | "url": "https://www.patreon.com/feross" 1290 | }, 1291 | { 1292 | "type": "consulting", 1293 | "url": "https://feross.org/support" 1294 | } 1295 | ] 1296 | }, 1297 | "node_modules/serialize-javascript": { 1298 | "version": "6.0.0", 1299 | "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", 1300 | "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", 1301 | "dev": true, 1302 | "dependencies": { 1303 | "randombytes": "^2.1.0" 1304 | } 1305 | }, 1306 | "node_modules/shebang-command": { 1307 | "version": "2.0.0", 1308 | "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", 1309 | "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", 1310 | "dev": true, 1311 | "dependencies": { 1312 | "shebang-regex": "^3.0.0" 1313 | }, 1314 | "engines": { 1315 | "node": ">=8" 1316 | } 1317 | }, 1318 | "node_modules/shebang-regex": { 1319 | "version": "3.0.0", 1320 | "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", 1321 | "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", 1322 | "dev": true, 1323 | "engines": { 1324 | "node": ">=8" 1325 | } 1326 | }, 1327 | "node_modules/shift-ast": { 1328 | "version": "7.0.0", 1329 | "resolved": "https://registry.npmjs.org/shift-ast/-/shift-ast-7.0.0.tgz", 1330 | "integrity": "sha512-O0INwsZa1XH/lMSf52udGnjNOxKBLxFiZHt0Ys3i6bqtwuGEA3eDR4+e0qJELIsCy8+BiTtlTgQzP76K1ehipQ==" 1331 | }, 1332 | "node_modules/shift-parser": { 1333 | "version": "8.0.0", 1334 | "resolved": "https://registry.npmjs.org/shift-parser/-/shift-parser-8.0.0.tgz", 1335 | "integrity": "sha512-IShW1wGhvA5e+SPNVQ+Dwi/Be6651F2jZc6wwYHbYW7PiswAYfvR/v3Q+CjjxsVCna5L6J5OtR6y+tkkCzvCfw==", 1336 | "dependencies": { 1337 | "multimap": "^1.0.2", 1338 | "shift-ast": "7.0.0", 1339 | "shift-reducer": "7.0.0", 1340 | "shift-regexp-acceptor": "3.0.0" 1341 | } 1342 | }, 1343 | "node_modules/shift-reducer": { 1344 | "version": "7.0.0", 1345 | "resolved": "https://registry.npmjs.org/shift-reducer/-/shift-reducer-7.0.0.tgz", 1346 | "integrity": "sha512-9igIDMHzp1+CkQZITGHM1sAd9jqMPV0vhqHuh8jlYumHSMIwsYcrDeo1tlpzNRUnfbEq1nLyh8Bf1YU8HGUE7g==", 1347 | "dependencies": { 1348 | "shift-ast": "7.0.0" 1349 | } 1350 | }, 1351 | "node_modules/shift-regexp-acceptor": { 1352 | "version": "3.0.0", 1353 | "resolved": "https://registry.npmjs.org/shift-regexp-acceptor/-/shift-regexp-acceptor-3.0.0.tgz", 1354 | "integrity": "sha512-98UKizBjHY6SjjLUr51YYw4rtR+vxjGFm8znqNsoahesAI8Y9+WVAyiBCxxkov1KSDhW0Wz8FwwUqHnlFnjdUg==", 1355 | "dependencies": { 1356 | "unicode-match-property-ecmascript": "1.0.4", 1357 | "unicode-match-property-value-ecmascript": "1.0.2", 1358 | "unicode-property-aliases-ecmascript": "1.0.4" 1359 | } 1360 | }, 1361 | "node_modules/shift-spec": { 1362 | "version": "2019.0.0", 1363 | "resolved": "https://registry.npmjs.org/shift-spec/-/shift-spec-2019.0.0.tgz", 1364 | "integrity": "sha512-vYfKl+afWPUj/wfr5T/+mdYvWx0nn8LY6hVdfZmFENdGEBpAfQyOTo4/5i+rs8mj+Jz4+0MnsP4vXagjEoHfEw==" 1365 | }, 1366 | "node_modules/string-width": { 1367 | "version": "4.2.3", 1368 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", 1369 | "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", 1370 | "dev": true, 1371 | "dependencies": { 1372 | "emoji-regex": "^8.0.0", 1373 | "is-fullwidth-code-point": "^3.0.0", 1374 | "strip-ansi": "^6.0.1" 1375 | }, 1376 | "engines": { 1377 | "node": ">=8" 1378 | } 1379 | }, 1380 | "node_modules/strip-ansi": { 1381 | "version": "6.0.1", 1382 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", 1383 | "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", 1384 | "dev": true, 1385 | "dependencies": { 1386 | "ansi-regex": "^5.0.1" 1387 | }, 1388 | "engines": { 1389 | "node": ">=8" 1390 | } 1391 | }, 1392 | "node_modules/strip-json-comments": { 1393 | "version": "3.1.1", 1394 | "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", 1395 | "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", 1396 | "dev": true, 1397 | "engines": { 1398 | "node": ">=8" 1399 | }, 1400 | "funding": { 1401 | "url": "https://github.com/sponsors/sindresorhus" 1402 | } 1403 | }, 1404 | "node_modules/supports-color": { 1405 | "version": "7.2.0", 1406 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", 1407 | "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", 1408 | "dev": true, 1409 | "dependencies": { 1410 | "has-flag": "^4.0.0" 1411 | }, 1412 | "engines": { 1413 | "node": ">=8" 1414 | } 1415 | }, 1416 | "node_modules/text-table": { 1417 | "version": "0.2.0", 1418 | "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", 1419 | "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", 1420 | "dev": true 1421 | }, 1422 | "node_modules/to-regex-range": { 1423 | "version": "5.0.1", 1424 | "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", 1425 | "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", 1426 | "dev": true, 1427 | "dependencies": { 1428 | "is-number": "^7.0.0" 1429 | }, 1430 | "engines": { 1431 | "node": ">=8.0" 1432 | } 1433 | }, 1434 | "node_modules/type-check": { 1435 | "version": "0.4.0", 1436 | "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", 1437 | "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", 1438 | "dev": true, 1439 | "dependencies": { 1440 | "prelude-ls": "^1.2.1" 1441 | }, 1442 | "engines": { 1443 | "node": ">= 0.8.0" 1444 | } 1445 | }, 1446 | "node_modules/type-fest": { 1447 | "version": "0.20.2", 1448 | "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", 1449 | "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", 1450 | "dev": true, 1451 | "engines": { 1452 | "node": ">=10" 1453 | }, 1454 | "funding": { 1455 | "url": "https://github.com/sponsors/sindresorhus" 1456 | } 1457 | }, 1458 | "node_modules/unicode-canonical-property-names-ecmascript": { 1459 | "version": "1.0.4", 1460 | "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", 1461 | "integrity": "sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ==", 1462 | "engines": { 1463 | "node": ">=4" 1464 | } 1465 | }, 1466 | "node_modules/unicode-match-property-ecmascript": { 1467 | "version": "1.0.4", 1468 | "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz", 1469 | "integrity": "sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg==", 1470 | "dependencies": { 1471 | "unicode-canonical-property-names-ecmascript": "^1.0.4", 1472 | "unicode-property-aliases-ecmascript": "^1.0.4" 1473 | }, 1474 | "engines": { 1475 | "node": ">=4" 1476 | } 1477 | }, 1478 | "node_modules/unicode-match-property-value-ecmascript": { 1479 | "version": "1.0.2", 1480 | "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.0.2.tgz", 1481 | "integrity": "sha512-Rx7yODZC1L/T8XKo/2kNzVAQaRE88AaMvI1EF/Xnj3GW2wzN6fop9DDWuFAKUVFH7vozkz26DzP0qyWLKLIVPQ==", 1482 | "engines": { 1483 | "node": ">=4" 1484 | } 1485 | }, 1486 | "node_modules/unicode-property-aliases-ecmascript": { 1487 | "version": "1.0.4", 1488 | "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.4.tgz", 1489 | "integrity": "sha512-2WSLa6OdYd2ng8oqiGIWnJqyFArvhn+5vgx5GTxMbUYjCYKUcuKS62YLFF0R/BDGlB1yzXjQOLtPAfHsgirEpg==", 1490 | "engines": { 1491 | "node": ">=4" 1492 | } 1493 | }, 1494 | "node_modules/uri-js": { 1495 | "version": "4.4.1", 1496 | "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", 1497 | "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", 1498 | "dev": true, 1499 | "dependencies": { 1500 | "punycode": "^2.1.0" 1501 | } 1502 | }, 1503 | "node_modules/v8-compile-cache": { 1504 | "version": "2.3.0", 1505 | "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", 1506 | "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", 1507 | "dev": true 1508 | }, 1509 | "node_modules/which": { 1510 | "version": "2.0.2", 1511 | "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", 1512 | "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", 1513 | "dev": true, 1514 | "dependencies": { 1515 | "isexe": "^2.0.0" 1516 | }, 1517 | "bin": { 1518 | "node-which": "bin/node-which" 1519 | }, 1520 | "engines": { 1521 | "node": ">= 8" 1522 | } 1523 | }, 1524 | "node_modules/word-wrap": { 1525 | "version": "1.2.3", 1526 | "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", 1527 | "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", 1528 | "dev": true, 1529 | "engines": { 1530 | "node": ">=0.10.0" 1531 | } 1532 | }, 1533 | "node_modules/workerpool": { 1534 | "version": "6.2.1", 1535 | "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", 1536 | "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==", 1537 | "dev": true 1538 | }, 1539 | "node_modules/wrap-ansi": { 1540 | "version": "7.0.0", 1541 | "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", 1542 | "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", 1543 | "dev": true, 1544 | "dependencies": { 1545 | "ansi-styles": "^4.0.0", 1546 | "string-width": "^4.1.0", 1547 | "strip-ansi": "^6.0.0" 1548 | }, 1549 | "engines": { 1550 | "node": ">=10" 1551 | }, 1552 | "funding": { 1553 | "url": "https://github.com/chalk/wrap-ansi?sponsor=1" 1554 | } 1555 | }, 1556 | "node_modules/wrappy": { 1557 | "version": "1.0.2", 1558 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 1559 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", 1560 | "dev": true 1561 | }, 1562 | "node_modules/y18n": { 1563 | "version": "5.0.8", 1564 | "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", 1565 | "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", 1566 | "dev": true, 1567 | "engines": { 1568 | "node": ">=10" 1569 | } 1570 | }, 1571 | "node_modules/yargs": { 1572 | "version": "16.2.0", 1573 | "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", 1574 | "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", 1575 | "dev": true, 1576 | "dependencies": { 1577 | "cliui": "^7.0.2", 1578 | "escalade": "^3.1.1", 1579 | "get-caller-file": "^2.0.5", 1580 | "require-directory": "^2.1.1", 1581 | "string-width": "^4.2.0", 1582 | "y18n": "^5.0.5", 1583 | "yargs-parser": "^20.2.2" 1584 | }, 1585 | "engines": { 1586 | "node": ">=10" 1587 | } 1588 | }, 1589 | "node_modules/yargs-parser": { 1590 | "version": "20.2.4", 1591 | "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", 1592 | "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", 1593 | "dev": true, 1594 | "engines": { 1595 | "node": ">=10" 1596 | } 1597 | }, 1598 | "node_modules/yargs-unparser": { 1599 | "version": "2.0.0", 1600 | "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", 1601 | "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", 1602 | "dev": true, 1603 | "dependencies": { 1604 | "camelcase": "^6.0.0", 1605 | "decamelize": "^4.0.0", 1606 | "flat": "^5.0.2", 1607 | "is-plain-obj": "^2.1.0" 1608 | }, 1609 | "engines": { 1610 | "node": ">=10" 1611 | } 1612 | }, 1613 | "node_modules/yocto-queue": { 1614 | "version": "0.1.0", 1615 | "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", 1616 | "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", 1617 | "dev": true, 1618 | "engines": { 1619 | "node": ">=10" 1620 | }, 1621 | "funding": { 1622 | "url": "https://github.com/sponsors/sindresorhus" 1623 | } 1624 | } 1625 | }, 1626 | "dependencies": { 1627 | "@eslint/eslintrc": { 1628 | "version": "1.3.0", 1629 | "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.0.tgz", 1630 | "integrity": "sha512-UWW0TMTmk2d7hLcWD1/e2g5HDM/HQ3csaLSqXCfqwh4uNDuNqlaKWXmEsL4Cs41Z0KnILNvwbHAah3C2yt06kw==", 1631 | "dev": true, 1632 | "requires": { 1633 | "ajv": "^6.12.4", 1634 | "debug": "^4.3.2", 1635 | "espree": "^9.3.2", 1636 | "globals": "^13.15.0", 1637 | "ignore": "^5.2.0", 1638 | "import-fresh": "^3.2.1", 1639 | "js-yaml": "^4.1.0", 1640 | "minimatch": "^3.1.2", 1641 | "strip-json-comments": "^3.1.1" 1642 | } 1643 | }, 1644 | "@humanwhocodes/config-array": { 1645 | "version": "0.9.5", 1646 | "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz", 1647 | "integrity": "sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw==", 1648 | "dev": true, 1649 | "requires": { 1650 | "@humanwhocodes/object-schema": "^1.2.1", 1651 | "debug": "^4.1.1", 1652 | "minimatch": "^3.0.4" 1653 | } 1654 | }, 1655 | "@humanwhocodes/object-schema": { 1656 | "version": "1.2.1", 1657 | "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", 1658 | "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", 1659 | "dev": true 1660 | }, 1661 | "@ungap/promise-all-settled": { 1662 | "version": "1.1.2", 1663 | "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", 1664 | "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", 1665 | "dev": true 1666 | }, 1667 | "acorn": { 1668 | "version": "8.7.1", 1669 | "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz", 1670 | "integrity": "sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==", 1671 | "dev": true 1672 | }, 1673 | "acorn-jsx": { 1674 | "version": "5.3.2", 1675 | "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", 1676 | "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", 1677 | "dev": true, 1678 | "requires": {} 1679 | }, 1680 | "ajv": { 1681 | "version": "6.12.6", 1682 | "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", 1683 | "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", 1684 | "dev": true, 1685 | "requires": { 1686 | "fast-deep-equal": "^3.1.1", 1687 | "fast-json-stable-stringify": "^2.0.0", 1688 | "json-schema-traverse": "^0.4.1", 1689 | "uri-js": "^4.2.2" 1690 | } 1691 | }, 1692 | "ansi-colors": { 1693 | "version": "4.1.1", 1694 | "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", 1695 | "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", 1696 | "dev": true 1697 | }, 1698 | "ansi-regex": { 1699 | "version": "5.0.1", 1700 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", 1701 | "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", 1702 | "dev": true 1703 | }, 1704 | "ansi-styles": { 1705 | "version": "4.3.0", 1706 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", 1707 | "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", 1708 | "dev": true, 1709 | "requires": { 1710 | "color-convert": "^2.0.1" 1711 | } 1712 | }, 1713 | "anymatch": { 1714 | "version": "3.1.2", 1715 | "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", 1716 | "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", 1717 | "dev": true, 1718 | "requires": { 1719 | "normalize-path": "^3.0.0", 1720 | "picomatch": "^2.0.4" 1721 | } 1722 | }, 1723 | "argparse": { 1724 | "version": "2.0.1", 1725 | "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", 1726 | "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", 1727 | "dev": true 1728 | }, 1729 | "balanced-match": { 1730 | "version": "1.0.2", 1731 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", 1732 | "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", 1733 | "dev": true 1734 | }, 1735 | "binary-extensions": { 1736 | "version": "2.2.0", 1737 | "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", 1738 | "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", 1739 | "dev": true 1740 | }, 1741 | "brace-expansion": { 1742 | "version": "1.1.11", 1743 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 1744 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 1745 | "dev": true, 1746 | "requires": { 1747 | "balanced-match": "^1.0.0", 1748 | "concat-map": "0.0.1" 1749 | } 1750 | }, 1751 | "braces": { 1752 | "version": "3.0.2", 1753 | "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", 1754 | "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", 1755 | "dev": true, 1756 | "requires": { 1757 | "fill-range": "^7.0.1" 1758 | } 1759 | }, 1760 | "browser-stdout": { 1761 | "version": "1.3.1", 1762 | "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", 1763 | "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", 1764 | "dev": true 1765 | }, 1766 | "callsites": { 1767 | "version": "3.1.0", 1768 | "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", 1769 | "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", 1770 | "dev": true 1771 | }, 1772 | "camelcase": { 1773 | "version": "6.3.0", 1774 | "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", 1775 | "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", 1776 | "dev": true 1777 | }, 1778 | "chalk": { 1779 | "version": "4.1.2", 1780 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", 1781 | "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", 1782 | "dev": true, 1783 | "requires": { 1784 | "ansi-styles": "^4.1.0", 1785 | "supports-color": "^7.1.0" 1786 | } 1787 | }, 1788 | "chokidar": { 1789 | "version": "3.5.3", 1790 | "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", 1791 | "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", 1792 | "dev": true, 1793 | "requires": { 1794 | "anymatch": "~3.1.2", 1795 | "braces": "~3.0.2", 1796 | "fsevents": "~2.3.2", 1797 | "glob-parent": "~5.1.2", 1798 | "is-binary-path": "~2.1.0", 1799 | "is-glob": "~4.0.1", 1800 | "normalize-path": "~3.0.0", 1801 | "readdirp": "~3.6.0" 1802 | }, 1803 | "dependencies": { 1804 | "glob-parent": { 1805 | "version": "5.1.2", 1806 | "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", 1807 | "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", 1808 | "dev": true, 1809 | "requires": { 1810 | "is-glob": "^4.0.1" 1811 | } 1812 | } 1813 | } 1814 | }, 1815 | "cliui": { 1816 | "version": "7.0.4", 1817 | "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", 1818 | "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", 1819 | "dev": true, 1820 | "requires": { 1821 | "string-width": "^4.2.0", 1822 | "strip-ansi": "^6.0.0", 1823 | "wrap-ansi": "^7.0.0" 1824 | } 1825 | }, 1826 | "color-convert": { 1827 | "version": "2.0.1", 1828 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", 1829 | "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", 1830 | "dev": true, 1831 | "requires": { 1832 | "color-name": "~1.1.4" 1833 | } 1834 | }, 1835 | "color-name": { 1836 | "version": "1.1.4", 1837 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", 1838 | "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", 1839 | "dev": true 1840 | }, 1841 | "concat-map": { 1842 | "version": "0.0.1", 1843 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 1844 | "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", 1845 | "dev": true 1846 | }, 1847 | "cross-spawn": { 1848 | "version": "7.0.3", 1849 | "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", 1850 | "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", 1851 | "dev": true, 1852 | "requires": { 1853 | "path-key": "^3.1.0", 1854 | "shebang-command": "^2.0.0", 1855 | "which": "^2.0.1" 1856 | } 1857 | }, 1858 | "debug": { 1859 | "version": "4.3.4", 1860 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", 1861 | "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", 1862 | "dev": true, 1863 | "requires": { 1864 | "ms": "2.1.2" 1865 | } 1866 | }, 1867 | "decamelize": { 1868 | "version": "4.0.0", 1869 | "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", 1870 | "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", 1871 | "dev": true 1872 | }, 1873 | "deep-is": { 1874 | "version": "0.1.4", 1875 | "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", 1876 | "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", 1877 | "dev": true 1878 | }, 1879 | "diff": { 1880 | "version": "5.0.0", 1881 | "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", 1882 | "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", 1883 | "dev": true 1884 | }, 1885 | "doctrine": { 1886 | "version": "3.0.0", 1887 | "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", 1888 | "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", 1889 | "dev": true, 1890 | "requires": { 1891 | "esutils": "^2.0.2" 1892 | } 1893 | }, 1894 | "emoji-regex": { 1895 | "version": "8.0.0", 1896 | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", 1897 | "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", 1898 | "dev": true 1899 | }, 1900 | "escalade": { 1901 | "version": "3.1.1", 1902 | "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", 1903 | "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", 1904 | "dev": true 1905 | }, 1906 | "escape-string-regexp": { 1907 | "version": "4.0.0", 1908 | "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", 1909 | "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", 1910 | "dev": true 1911 | }, 1912 | "eslint": { 1913 | "version": "8.17.0", 1914 | "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.17.0.tgz", 1915 | "integrity": "sha512-gq0m0BTJfci60Fz4nczYxNAlED+sMcihltndR8t9t1evnU/azx53x3t2UHXC/uRjcbvRw/XctpaNygSTcQD+Iw==", 1916 | "dev": true, 1917 | "requires": { 1918 | "@eslint/eslintrc": "^1.3.0", 1919 | "@humanwhocodes/config-array": "^0.9.2", 1920 | "ajv": "^6.10.0", 1921 | "chalk": "^4.0.0", 1922 | "cross-spawn": "^7.0.2", 1923 | "debug": "^4.3.2", 1924 | "doctrine": "^3.0.0", 1925 | "escape-string-regexp": "^4.0.0", 1926 | "eslint-scope": "^7.1.1", 1927 | "eslint-utils": "^3.0.0", 1928 | "eslint-visitor-keys": "^3.3.0", 1929 | "espree": "^9.3.2", 1930 | "esquery": "^1.4.0", 1931 | "esutils": "^2.0.2", 1932 | "fast-deep-equal": "^3.1.3", 1933 | "file-entry-cache": "^6.0.1", 1934 | "functional-red-black-tree": "^1.0.1", 1935 | "glob-parent": "^6.0.1", 1936 | "globals": "^13.15.0", 1937 | "ignore": "^5.2.0", 1938 | "import-fresh": "^3.0.0", 1939 | "imurmurhash": "^0.1.4", 1940 | "is-glob": "^4.0.0", 1941 | "js-yaml": "^4.1.0", 1942 | "json-stable-stringify-without-jsonify": "^1.0.1", 1943 | "levn": "^0.4.1", 1944 | "lodash.merge": "^4.6.2", 1945 | "minimatch": "^3.1.2", 1946 | "natural-compare": "^1.4.0", 1947 | "optionator": "^0.9.1", 1948 | "regexpp": "^3.2.0", 1949 | "strip-ansi": "^6.0.1", 1950 | "strip-json-comments": "^3.1.0", 1951 | "text-table": "^0.2.0", 1952 | "v8-compile-cache": "^2.0.3" 1953 | } 1954 | }, 1955 | "eslint-scope": { 1956 | "version": "7.1.1", 1957 | "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", 1958 | "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", 1959 | "dev": true, 1960 | "requires": { 1961 | "esrecurse": "^4.3.0", 1962 | "estraverse": "^5.2.0" 1963 | } 1964 | }, 1965 | "eslint-utils": { 1966 | "version": "3.0.0", 1967 | "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", 1968 | "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", 1969 | "dev": true, 1970 | "requires": { 1971 | "eslint-visitor-keys": "^2.0.0" 1972 | }, 1973 | "dependencies": { 1974 | "eslint-visitor-keys": { 1975 | "version": "2.1.0", 1976 | "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", 1977 | "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", 1978 | "dev": true 1979 | } 1980 | } 1981 | }, 1982 | "eslint-visitor-keys": { 1983 | "version": "3.3.0", 1984 | "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", 1985 | "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", 1986 | "dev": true 1987 | }, 1988 | "espree": { 1989 | "version": "9.3.2", 1990 | "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.2.tgz", 1991 | "integrity": "sha512-D211tC7ZwouTIuY5x9XnS0E9sWNChB7IYKX/Xp5eQj3nFXhqmiUDB9q27y76oFl8jTg3pXcQx/bpxMfs3CIZbA==", 1992 | "dev": true, 1993 | "requires": { 1994 | "acorn": "^8.7.1", 1995 | "acorn-jsx": "^5.3.2", 1996 | "eslint-visitor-keys": "^3.3.0" 1997 | } 1998 | }, 1999 | "esquery": { 2000 | "version": "1.4.0", 2001 | "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", 2002 | "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", 2003 | "dev": true, 2004 | "requires": { 2005 | "estraverse": "^5.1.0" 2006 | } 2007 | }, 2008 | "esrecurse": { 2009 | "version": "4.3.0", 2010 | "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", 2011 | "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", 2012 | "dev": true, 2013 | "requires": { 2014 | "estraverse": "^5.2.0" 2015 | } 2016 | }, 2017 | "estraverse": { 2018 | "version": "5.3.0", 2019 | "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", 2020 | "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", 2021 | "dev": true 2022 | }, 2023 | "esutils": { 2024 | "version": "2.0.3", 2025 | "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", 2026 | "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", 2027 | "dev": true 2028 | }, 2029 | "fast-deep-equal": { 2030 | "version": "3.1.3", 2031 | "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", 2032 | "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", 2033 | "dev": true 2034 | }, 2035 | "fast-json-stable-stringify": { 2036 | "version": "2.1.0", 2037 | "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", 2038 | "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", 2039 | "dev": true 2040 | }, 2041 | "fast-levenshtein": { 2042 | "version": "2.0.6", 2043 | "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", 2044 | "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", 2045 | "dev": true 2046 | }, 2047 | "file-entry-cache": { 2048 | "version": "6.0.1", 2049 | "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", 2050 | "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", 2051 | "dev": true, 2052 | "requires": { 2053 | "flat-cache": "^3.0.4" 2054 | } 2055 | }, 2056 | "fill-range": { 2057 | "version": "7.0.1", 2058 | "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", 2059 | "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", 2060 | "dev": true, 2061 | "requires": { 2062 | "to-regex-range": "^5.0.1" 2063 | } 2064 | }, 2065 | "find-up": { 2066 | "version": "5.0.0", 2067 | "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", 2068 | "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", 2069 | "dev": true, 2070 | "requires": { 2071 | "locate-path": "^6.0.0", 2072 | "path-exists": "^4.0.0" 2073 | } 2074 | }, 2075 | "flat": { 2076 | "version": "5.0.2", 2077 | "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", 2078 | "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", 2079 | "dev": true 2080 | }, 2081 | "flat-cache": { 2082 | "version": "3.0.4", 2083 | "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", 2084 | "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", 2085 | "dev": true, 2086 | "requires": { 2087 | "flatted": "^3.1.0", 2088 | "rimraf": "^3.0.2" 2089 | } 2090 | }, 2091 | "flatted": { 2092 | "version": "3.2.5", 2093 | "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz", 2094 | "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", 2095 | "dev": true 2096 | }, 2097 | "fs.realpath": { 2098 | "version": "1.0.0", 2099 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 2100 | "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", 2101 | "dev": true 2102 | }, 2103 | "fsevents": { 2104 | "version": "2.3.2", 2105 | "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", 2106 | "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", 2107 | "dev": true, 2108 | "optional": true 2109 | }, 2110 | "functional-red-black-tree": { 2111 | "version": "1.0.1", 2112 | "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", 2113 | "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", 2114 | "dev": true 2115 | }, 2116 | "get-caller-file": { 2117 | "version": "2.0.5", 2118 | "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", 2119 | "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", 2120 | "dev": true 2121 | }, 2122 | "glob": { 2123 | "version": "7.2.0", 2124 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", 2125 | "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", 2126 | "dev": true, 2127 | "requires": { 2128 | "fs.realpath": "^1.0.0", 2129 | "inflight": "^1.0.4", 2130 | "inherits": "2", 2131 | "minimatch": "^3.0.4", 2132 | "once": "^1.3.0", 2133 | "path-is-absolute": "^1.0.0" 2134 | } 2135 | }, 2136 | "glob-parent": { 2137 | "version": "6.0.2", 2138 | "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", 2139 | "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", 2140 | "dev": true, 2141 | "requires": { 2142 | "is-glob": "^4.0.3" 2143 | } 2144 | }, 2145 | "globals": { 2146 | "version": "13.15.0", 2147 | "resolved": "https://registry.npmjs.org/globals/-/globals-13.15.0.tgz", 2148 | "integrity": "sha512-bpzcOlgDhMG070Av0Vy5Owklpv1I6+j96GhUI7Rh7IzDCKLzboflLrrfqMu8NquDbiR4EOQk7XzJwqVJxicxog==", 2149 | "dev": true, 2150 | "requires": { 2151 | "type-fest": "^0.20.2" 2152 | } 2153 | }, 2154 | "has-flag": { 2155 | "version": "4.0.0", 2156 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", 2157 | "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", 2158 | "dev": true 2159 | }, 2160 | "he": { 2161 | "version": "1.2.0", 2162 | "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", 2163 | "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", 2164 | "dev": true 2165 | }, 2166 | "ignore": { 2167 | "version": "5.2.0", 2168 | "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", 2169 | "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", 2170 | "dev": true 2171 | }, 2172 | "import-fresh": { 2173 | "version": "3.3.0", 2174 | "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", 2175 | "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", 2176 | "dev": true, 2177 | "requires": { 2178 | "parent-module": "^1.0.0", 2179 | "resolve-from": "^4.0.0" 2180 | } 2181 | }, 2182 | "imurmurhash": { 2183 | "version": "0.1.4", 2184 | "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", 2185 | "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", 2186 | "dev": true 2187 | }, 2188 | "inflight": { 2189 | "version": "1.0.6", 2190 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 2191 | "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", 2192 | "dev": true, 2193 | "requires": { 2194 | "once": "^1.3.0", 2195 | "wrappy": "1" 2196 | } 2197 | }, 2198 | "inherits": { 2199 | "version": "2.0.4", 2200 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 2201 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", 2202 | "dev": true 2203 | }, 2204 | "is-binary-path": { 2205 | "version": "2.1.0", 2206 | "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", 2207 | "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", 2208 | "dev": true, 2209 | "requires": { 2210 | "binary-extensions": "^2.0.0" 2211 | } 2212 | }, 2213 | "is-extglob": { 2214 | "version": "2.1.1", 2215 | "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", 2216 | "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", 2217 | "dev": true 2218 | }, 2219 | "is-fullwidth-code-point": { 2220 | "version": "3.0.0", 2221 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", 2222 | "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", 2223 | "dev": true 2224 | }, 2225 | "is-glob": { 2226 | "version": "4.0.3", 2227 | "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", 2228 | "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", 2229 | "dev": true, 2230 | "requires": { 2231 | "is-extglob": "^2.1.1" 2232 | } 2233 | }, 2234 | "is-number": { 2235 | "version": "7.0.0", 2236 | "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", 2237 | "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", 2238 | "dev": true 2239 | }, 2240 | "is-plain-obj": { 2241 | "version": "2.1.0", 2242 | "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", 2243 | "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", 2244 | "dev": true 2245 | }, 2246 | "is-unicode-supported": { 2247 | "version": "0.1.0", 2248 | "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", 2249 | "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", 2250 | "dev": true 2251 | }, 2252 | "isexe": { 2253 | "version": "2.0.0", 2254 | "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", 2255 | "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", 2256 | "dev": true 2257 | }, 2258 | "js-yaml": { 2259 | "version": "4.1.0", 2260 | "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", 2261 | "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", 2262 | "dev": true, 2263 | "requires": { 2264 | "argparse": "^2.0.1" 2265 | } 2266 | }, 2267 | "json-schema-traverse": { 2268 | "version": "0.4.1", 2269 | "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", 2270 | "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", 2271 | "dev": true 2272 | }, 2273 | "json-stable-stringify-without-jsonify": { 2274 | "version": "1.0.1", 2275 | "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", 2276 | "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", 2277 | "dev": true 2278 | }, 2279 | "levn": { 2280 | "version": "0.4.1", 2281 | "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", 2282 | "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", 2283 | "dev": true, 2284 | "requires": { 2285 | "prelude-ls": "^1.2.1", 2286 | "type-check": "~0.4.0" 2287 | } 2288 | }, 2289 | "locate-path": { 2290 | "version": "6.0.0", 2291 | "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", 2292 | "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", 2293 | "dev": true, 2294 | "requires": { 2295 | "p-locate": "^5.0.0" 2296 | } 2297 | }, 2298 | "lodash.merge": { 2299 | "version": "4.6.2", 2300 | "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", 2301 | "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", 2302 | "dev": true 2303 | }, 2304 | "log-symbols": { 2305 | "version": "4.1.0", 2306 | "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", 2307 | "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", 2308 | "dev": true, 2309 | "requires": { 2310 | "chalk": "^4.1.0", 2311 | "is-unicode-supported": "^0.1.0" 2312 | } 2313 | }, 2314 | "minimatch": { 2315 | "version": "3.1.2", 2316 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", 2317 | "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", 2318 | "dev": true, 2319 | "requires": { 2320 | "brace-expansion": "^1.1.7" 2321 | } 2322 | }, 2323 | "mocha": { 2324 | "version": "10.0.0", 2325 | "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.0.0.tgz", 2326 | "integrity": "sha512-0Wl+elVUD43Y0BqPZBzZt8Tnkw9CMUdNYnUsTfOM1vuhJVZL+kiesFYsqwBkEEuEixaiPe5ZQdqDgX2jddhmoA==", 2327 | "dev": true, 2328 | "requires": { 2329 | "@ungap/promise-all-settled": "1.1.2", 2330 | "ansi-colors": "4.1.1", 2331 | "browser-stdout": "1.3.1", 2332 | "chokidar": "3.5.3", 2333 | "debug": "4.3.4", 2334 | "diff": "5.0.0", 2335 | "escape-string-regexp": "4.0.0", 2336 | "find-up": "5.0.0", 2337 | "glob": "7.2.0", 2338 | "he": "1.2.0", 2339 | "js-yaml": "4.1.0", 2340 | "log-symbols": "4.1.0", 2341 | "minimatch": "5.0.1", 2342 | "ms": "2.1.3", 2343 | "nanoid": "3.3.3", 2344 | "serialize-javascript": "6.0.0", 2345 | "strip-json-comments": "3.1.1", 2346 | "supports-color": "8.1.1", 2347 | "workerpool": "6.2.1", 2348 | "yargs": "16.2.0", 2349 | "yargs-parser": "20.2.4", 2350 | "yargs-unparser": "2.0.0" 2351 | }, 2352 | "dependencies": { 2353 | "brace-expansion": { 2354 | "version": "2.0.1", 2355 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", 2356 | "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", 2357 | "dev": true, 2358 | "requires": { 2359 | "balanced-match": "^1.0.0" 2360 | } 2361 | }, 2362 | "minimatch": { 2363 | "version": "5.0.1", 2364 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", 2365 | "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", 2366 | "dev": true, 2367 | "requires": { 2368 | "brace-expansion": "^2.0.1" 2369 | } 2370 | }, 2371 | "ms": { 2372 | "version": "2.1.3", 2373 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", 2374 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", 2375 | "dev": true 2376 | }, 2377 | "supports-color": { 2378 | "version": "8.1.1", 2379 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", 2380 | "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", 2381 | "dev": true, 2382 | "requires": { 2383 | "has-flag": "^4.0.0" 2384 | } 2385 | } 2386 | } 2387 | }, 2388 | "ms": { 2389 | "version": "2.1.2", 2390 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 2391 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", 2392 | "dev": true 2393 | }, 2394 | "multimap": { 2395 | "version": "1.0.2", 2396 | "resolved": "https://registry.npmjs.org/multimap/-/multimap-1.0.2.tgz", 2397 | "integrity": "sha1-aqdvwyM5BbqUi75MdNwsOgNW6zY=" 2398 | }, 2399 | "nanoid": { 2400 | "version": "3.3.3", 2401 | "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", 2402 | "integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==", 2403 | "dev": true 2404 | }, 2405 | "natural-compare": { 2406 | "version": "1.4.0", 2407 | "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", 2408 | "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", 2409 | "dev": true 2410 | }, 2411 | "normalize-path": { 2412 | "version": "3.0.0", 2413 | "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", 2414 | "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", 2415 | "dev": true 2416 | }, 2417 | "once": { 2418 | "version": "1.4.0", 2419 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 2420 | "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", 2421 | "dev": true, 2422 | "requires": { 2423 | "wrappy": "1" 2424 | } 2425 | }, 2426 | "optionator": { 2427 | "version": "0.9.1", 2428 | "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", 2429 | "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", 2430 | "dev": true, 2431 | "requires": { 2432 | "deep-is": "^0.1.3", 2433 | "fast-levenshtein": "^2.0.6", 2434 | "levn": "^0.4.1", 2435 | "prelude-ls": "^1.2.1", 2436 | "type-check": "^0.4.0", 2437 | "word-wrap": "^1.2.3" 2438 | } 2439 | }, 2440 | "p-limit": { 2441 | "version": "3.1.0", 2442 | "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", 2443 | "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", 2444 | "dev": true, 2445 | "requires": { 2446 | "yocto-queue": "^0.1.0" 2447 | } 2448 | }, 2449 | "p-locate": { 2450 | "version": "5.0.0", 2451 | "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", 2452 | "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", 2453 | "dev": true, 2454 | "requires": { 2455 | "p-limit": "^3.0.2" 2456 | } 2457 | }, 2458 | "parent-module": { 2459 | "version": "1.0.1", 2460 | "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", 2461 | "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", 2462 | "dev": true, 2463 | "requires": { 2464 | "callsites": "^3.0.0" 2465 | } 2466 | }, 2467 | "path-exists": { 2468 | "version": "4.0.0", 2469 | "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", 2470 | "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", 2471 | "dev": true 2472 | }, 2473 | "path-is-absolute": { 2474 | "version": "1.0.1", 2475 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 2476 | "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", 2477 | "dev": true 2478 | }, 2479 | "path-key": { 2480 | "version": "3.1.1", 2481 | "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", 2482 | "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", 2483 | "dev": true 2484 | }, 2485 | "picomatch": { 2486 | "version": "2.3.1", 2487 | "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", 2488 | "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", 2489 | "dev": true 2490 | }, 2491 | "prelude-ls": { 2492 | "version": "1.2.1", 2493 | "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", 2494 | "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", 2495 | "dev": true 2496 | }, 2497 | "punycode": { 2498 | "version": "2.1.1", 2499 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", 2500 | "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", 2501 | "dev": true 2502 | }, 2503 | "randombytes": { 2504 | "version": "2.1.0", 2505 | "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", 2506 | "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", 2507 | "dev": true, 2508 | "requires": { 2509 | "safe-buffer": "^5.1.0" 2510 | } 2511 | }, 2512 | "readdirp": { 2513 | "version": "3.6.0", 2514 | "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", 2515 | "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", 2516 | "dev": true, 2517 | "requires": { 2518 | "picomatch": "^2.2.1" 2519 | } 2520 | }, 2521 | "regexpp": { 2522 | "version": "3.2.0", 2523 | "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", 2524 | "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", 2525 | "dev": true 2526 | }, 2527 | "require-directory": { 2528 | "version": "2.1.1", 2529 | "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", 2530 | "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", 2531 | "dev": true 2532 | }, 2533 | "resolve-from": { 2534 | "version": "4.0.0", 2535 | "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", 2536 | "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", 2537 | "dev": true 2538 | }, 2539 | "rimraf": { 2540 | "version": "3.0.2", 2541 | "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", 2542 | "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", 2543 | "dev": true, 2544 | "requires": { 2545 | "glob": "^7.1.3" 2546 | } 2547 | }, 2548 | "safe-buffer": { 2549 | "version": "5.2.1", 2550 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", 2551 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", 2552 | "dev": true 2553 | }, 2554 | "serialize-javascript": { 2555 | "version": "6.0.0", 2556 | "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", 2557 | "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", 2558 | "dev": true, 2559 | "requires": { 2560 | "randombytes": "^2.1.0" 2561 | } 2562 | }, 2563 | "shebang-command": { 2564 | "version": "2.0.0", 2565 | "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", 2566 | "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", 2567 | "dev": true, 2568 | "requires": { 2569 | "shebang-regex": "^3.0.0" 2570 | } 2571 | }, 2572 | "shebang-regex": { 2573 | "version": "3.0.0", 2574 | "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", 2575 | "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", 2576 | "dev": true 2577 | }, 2578 | "shift-ast": { 2579 | "version": "7.0.0", 2580 | "resolved": "https://registry.npmjs.org/shift-ast/-/shift-ast-7.0.0.tgz", 2581 | "integrity": "sha512-O0INwsZa1XH/lMSf52udGnjNOxKBLxFiZHt0Ys3i6bqtwuGEA3eDR4+e0qJELIsCy8+BiTtlTgQzP76K1ehipQ==" 2582 | }, 2583 | "shift-parser": { 2584 | "version": "8.0.0", 2585 | "resolved": "https://registry.npmjs.org/shift-parser/-/shift-parser-8.0.0.tgz", 2586 | "integrity": "sha512-IShW1wGhvA5e+SPNVQ+Dwi/Be6651F2jZc6wwYHbYW7PiswAYfvR/v3Q+CjjxsVCna5L6J5OtR6y+tkkCzvCfw==", 2587 | "requires": { 2588 | "multimap": "^1.0.2", 2589 | "shift-ast": "7.0.0", 2590 | "shift-reducer": "7.0.0", 2591 | "shift-regexp-acceptor": "3.0.0" 2592 | } 2593 | }, 2594 | "shift-reducer": { 2595 | "version": "7.0.0", 2596 | "resolved": "https://registry.npmjs.org/shift-reducer/-/shift-reducer-7.0.0.tgz", 2597 | "integrity": "sha512-9igIDMHzp1+CkQZITGHM1sAd9jqMPV0vhqHuh8jlYumHSMIwsYcrDeo1tlpzNRUnfbEq1nLyh8Bf1YU8HGUE7g==", 2598 | "requires": { 2599 | "shift-ast": "7.0.0" 2600 | } 2601 | }, 2602 | "shift-regexp-acceptor": { 2603 | "version": "3.0.0", 2604 | "resolved": "https://registry.npmjs.org/shift-regexp-acceptor/-/shift-regexp-acceptor-3.0.0.tgz", 2605 | "integrity": "sha512-98UKizBjHY6SjjLUr51YYw4rtR+vxjGFm8znqNsoahesAI8Y9+WVAyiBCxxkov1KSDhW0Wz8FwwUqHnlFnjdUg==", 2606 | "requires": { 2607 | "unicode-match-property-ecmascript": "1.0.4", 2608 | "unicode-match-property-value-ecmascript": "1.0.2", 2609 | "unicode-property-aliases-ecmascript": "1.0.4" 2610 | } 2611 | }, 2612 | "shift-spec": { 2613 | "version": "2019.0.0", 2614 | "resolved": "https://registry.npmjs.org/shift-spec/-/shift-spec-2019.0.0.tgz", 2615 | "integrity": "sha512-vYfKl+afWPUj/wfr5T/+mdYvWx0nn8LY6hVdfZmFENdGEBpAfQyOTo4/5i+rs8mj+Jz4+0MnsP4vXagjEoHfEw==" 2616 | }, 2617 | "string-width": { 2618 | "version": "4.2.3", 2619 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", 2620 | "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", 2621 | "dev": true, 2622 | "requires": { 2623 | "emoji-regex": "^8.0.0", 2624 | "is-fullwidth-code-point": "^3.0.0", 2625 | "strip-ansi": "^6.0.1" 2626 | } 2627 | }, 2628 | "strip-ansi": { 2629 | "version": "6.0.1", 2630 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", 2631 | "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", 2632 | "dev": true, 2633 | "requires": { 2634 | "ansi-regex": "^5.0.1" 2635 | } 2636 | }, 2637 | "strip-json-comments": { 2638 | "version": "3.1.1", 2639 | "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", 2640 | "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", 2641 | "dev": true 2642 | }, 2643 | "supports-color": { 2644 | "version": "7.2.0", 2645 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", 2646 | "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", 2647 | "dev": true, 2648 | "requires": { 2649 | "has-flag": "^4.0.0" 2650 | } 2651 | }, 2652 | "text-table": { 2653 | "version": "0.2.0", 2654 | "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", 2655 | "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", 2656 | "dev": true 2657 | }, 2658 | "to-regex-range": { 2659 | "version": "5.0.1", 2660 | "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", 2661 | "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", 2662 | "dev": true, 2663 | "requires": { 2664 | "is-number": "^7.0.0" 2665 | } 2666 | }, 2667 | "type-check": { 2668 | "version": "0.4.0", 2669 | "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", 2670 | "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", 2671 | "dev": true, 2672 | "requires": { 2673 | "prelude-ls": "^1.2.1" 2674 | } 2675 | }, 2676 | "type-fest": { 2677 | "version": "0.20.2", 2678 | "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", 2679 | "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", 2680 | "dev": true 2681 | }, 2682 | "unicode-canonical-property-names-ecmascript": { 2683 | "version": "1.0.4", 2684 | "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", 2685 | "integrity": "sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ==" 2686 | }, 2687 | "unicode-match-property-ecmascript": { 2688 | "version": "1.0.4", 2689 | "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz", 2690 | "integrity": "sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg==", 2691 | "requires": { 2692 | "unicode-canonical-property-names-ecmascript": "^1.0.4", 2693 | "unicode-property-aliases-ecmascript": "^1.0.4" 2694 | } 2695 | }, 2696 | "unicode-match-property-value-ecmascript": { 2697 | "version": "1.0.2", 2698 | "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.0.2.tgz", 2699 | "integrity": "sha512-Rx7yODZC1L/T8XKo/2kNzVAQaRE88AaMvI1EF/Xnj3GW2wzN6fop9DDWuFAKUVFH7vozkz26DzP0qyWLKLIVPQ==" 2700 | }, 2701 | "unicode-property-aliases-ecmascript": { 2702 | "version": "1.0.4", 2703 | "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.4.tgz", 2704 | "integrity": "sha512-2WSLa6OdYd2ng8oqiGIWnJqyFArvhn+5vgx5GTxMbUYjCYKUcuKS62YLFF0R/BDGlB1yzXjQOLtPAfHsgirEpg==" 2705 | }, 2706 | "uri-js": { 2707 | "version": "4.4.1", 2708 | "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", 2709 | "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", 2710 | "dev": true, 2711 | "requires": { 2712 | "punycode": "^2.1.0" 2713 | } 2714 | }, 2715 | "v8-compile-cache": { 2716 | "version": "2.3.0", 2717 | "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", 2718 | "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", 2719 | "dev": true 2720 | }, 2721 | "which": { 2722 | "version": "2.0.2", 2723 | "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", 2724 | "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", 2725 | "dev": true, 2726 | "requires": { 2727 | "isexe": "^2.0.0" 2728 | } 2729 | }, 2730 | "word-wrap": { 2731 | "version": "1.2.3", 2732 | "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", 2733 | "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", 2734 | "dev": true 2735 | }, 2736 | "workerpool": { 2737 | "version": "6.2.1", 2738 | "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", 2739 | "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==", 2740 | "dev": true 2741 | }, 2742 | "wrap-ansi": { 2743 | "version": "7.0.0", 2744 | "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", 2745 | "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", 2746 | "dev": true, 2747 | "requires": { 2748 | "ansi-styles": "^4.0.0", 2749 | "string-width": "^4.1.0", 2750 | "strip-ansi": "^6.0.0" 2751 | } 2752 | }, 2753 | "wrappy": { 2754 | "version": "1.0.2", 2755 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 2756 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", 2757 | "dev": true 2758 | }, 2759 | "y18n": { 2760 | "version": "5.0.8", 2761 | "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", 2762 | "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", 2763 | "dev": true 2764 | }, 2765 | "yargs": { 2766 | "version": "16.2.0", 2767 | "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", 2768 | "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", 2769 | "dev": true, 2770 | "requires": { 2771 | "cliui": "^7.0.2", 2772 | "escalade": "^3.1.1", 2773 | "get-caller-file": "^2.0.5", 2774 | "require-directory": "^2.1.1", 2775 | "string-width": "^4.2.0", 2776 | "y18n": "^5.0.5", 2777 | "yargs-parser": "^20.2.2" 2778 | } 2779 | }, 2780 | "yargs-parser": { 2781 | "version": "20.2.4", 2782 | "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", 2783 | "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", 2784 | "dev": true 2785 | }, 2786 | "yargs-unparser": { 2787 | "version": "2.0.0", 2788 | "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", 2789 | "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", 2790 | "dev": true, 2791 | "requires": { 2792 | "camelcase": "^6.0.0", 2793 | "decamelize": "^4.0.0", 2794 | "flat": "^5.0.2", 2795 | "is-plain-obj": "^2.1.0" 2796 | } 2797 | }, 2798 | "yocto-queue": { 2799 | "version": "0.1.0", 2800 | "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", 2801 | "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", 2802 | "dev": true 2803 | } 2804 | } 2805 | } 2806 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "shift-template", 3 | "version": "2.0.0", 4 | "description": "Shift format AST-based template system for JavaScript", 5 | "author": "Shape Security", 6 | "homepage": "https://github.com/shapesecurity/shift-template-js", 7 | "repository": { 8 | "type": "git", 9 | "url": "https://github.com/shapesecurity/shift-template-js.git" 10 | }, 11 | "main": "index.js", 12 | "scripts": { 13 | "build": "exit 0", 14 | "lint": "eslint .", 15 | "test": "mocha --recursive test" 16 | }, 17 | "files": [ 18 | "index.js", 19 | "src" 20 | ], 21 | "license": "Apache-2.0", 22 | "dependencies": { 23 | "shift-ast": "7.0.0", 24 | "shift-parser": "8.0.0", 25 | "shift-reducer": "7.0.0", 26 | "shift-spec": "2019.0.0" 27 | }, 28 | "devDependencies": { 29 | "eslint": "^8.17.0", 30 | "mocha": "^10.0.0" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/apply-structured-template.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Shape Security, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 'use strict'; 18 | 19 | let { parseScriptWithLocation, parseModuleWithLocation, EarlyErrorChecker } = require('shift-parser'); 20 | let { thunkedReduce } = require('shift-reducer'); 21 | let spec = require('shift-spec'); 22 | let Shift = require('shift-ast/checked'); 23 | 24 | let defaultMatcher = require('./default-matcher.js'); 25 | let findNodes = require('./find-nodes.js'); 26 | let { isStatefulType } = require('./utilities.js'); 27 | 28 | 29 | let entries = Object.entries || (o => Object.keys(o).map(k => [k, o[k]])); // needed on node 6 30 | 31 | 32 | /* 33 | labels are of shape 34 | { type: 'bare', name: string } 35 | | { type: 'if', condition: string } 36 | | { type: 'unless', condition: string } 37 | | { type: 'loop', variable: string, values: string } 38 | 39 | templateValues is of shape 40 | [ name -> (node => node) | boolean | [templateValues] ] 41 | 42 | a 'bare' label must correspond to a `node => node` 43 | a 'if' label must correspond to a boolean 44 | a 'unless' label must correspond to a boolean 45 | a 'loop' (values) label must correspond to [templateValues] 46 | */ 47 | 48 | class ReduceStructured { 49 | constructor(nodeToLabels, templateValues) { 50 | this.nodeToLabels = nodeToLabels; 51 | this.templateValues = templateValues; 52 | this.currentNodeMayHaveStructuredLabel = false; 53 | } 54 | 55 | applyLabels(childThunk, remainingLabels) { // returns a list of nodes 56 | if (remainingLabels.length === 0) { 57 | this.currentNodeMayHaveStructuredLabel = true; 58 | return [childThunk()]; 59 | } 60 | let [head, ...tail] = remainingLabels; 61 | if (head.type === 'if' || head.type === 'unless') { 62 | let condition = this.templateValues.get(head.condition); 63 | if (typeof condition !== 'boolean') { 64 | throw new TypeError(`Condition ${JSON.stringify(head.condition)} not found`); 65 | } 66 | if (head.type === 'if' && !condition || head.type === 'unless' && condition) { 67 | return []; 68 | } 69 | return this.applyLabels(childThunk, tail); 70 | } 71 | if (head.type === 'loop') { 72 | let variable = head.variable; 73 | let values = this.templateValues.get(head.values); 74 | if (!Array.isArray(values)) { 75 | throw new TypeError(`Loop values ${JSON.stringify(head.values)} not found`); 76 | } 77 | let oldValues = this.templateValues; 78 | return [].concat.apply([], values.map(perIterationTemplateValues => { 79 | if (!(perIterationTemplateValues instanceof Map)) { 80 | perIterationTemplateValues = entries(perIterationTemplateValues); 81 | } 82 | let merged = new Map(oldValues); 83 | for (let [key, value] of perIterationTemplateValues) { 84 | let namespaced = variable + '::' + key; 85 | if (merged.has(namespaced)) { 86 | throw new TypeError(`Name ${JSON.stringify(namespaced)} already exists!`); 87 | } 88 | merged.set(namespaced, value); 89 | } 90 | this.templateValues = merged; 91 | let result = this.applyLabels(childThunk, tail); 92 | this.templateValues = oldValues; 93 | return result; 94 | })); 95 | } 96 | throw new Error('unreachable'); 97 | } 98 | } 99 | 100 | for (let [typeName, type] of entries(spec)) { 101 | ReduceStructured.prototype['reduce' + typeName] = function (node, data) { 102 | let labels = this.nodeToLabels.has(node) ? this.nodeToLabels.get(node) : []; 103 | 104 | if (!this.currentNodeMayHaveStructuredLabel && labels.some(l => l.type !== 'bare')) { 105 | let label = labels.find(l => l.type !== 'bare'); 106 | if (label.type === 'if' || label.type === 'unless') { 107 | throw new TypeError(`Node of type ${node.type} with condition ${JSON.stringify(label.condition)} is not in an omittable position`); 108 | } else if (label.type === 'loop') { 109 | throw new TypeError(`Node of type ${node.type} iterating over ${JSON.stringify(label.values)} is not in a loopable position`); 110 | } else { 111 | throw new Error('unreachable'); 112 | } 113 | } 114 | this.currentNodeMayHaveStructuredLabel = false; 115 | 116 | let transformed = new Shift[typeName](type.fields.reduce((acc, field) => { 117 | if (field.name === 'type') { 118 | return acc; 119 | } 120 | 121 | if (!isStatefulType(field.type)) { 122 | acc[field.name] = node[field.name]; 123 | return acc; 124 | } 125 | 126 | if (field.type.typeName === 'List') { 127 | // Either a list of node or a list of maybe(node) 128 | acc[field.name] = [].concat.apply([], data[field.name].map((childThunk, childIndex) => { 129 | if (childThunk === null) { 130 | return [null]; 131 | } 132 | let originalChild = node[field.name][childIndex]; 133 | let childLabels = this.nodeToLabels.has(originalChild) ? this.nodeToLabels.get(originalChild) : []; 134 | let structuredLabels = childLabels.filter(l => l.type !== 'bare'); 135 | return this.applyLabels(childThunk, structuredLabels); 136 | })); 137 | return acc; 138 | } 139 | 140 | if (field.type.typeName === 'Maybe') { 141 | // A maybe(node) 142 | let childThunk = data[field.name]; 143 | if (childThunk === null) { 144 | acc[field.name] = null; 145 | return acc; 146 | } 147 | let originalChild = node[field.name]; 148 | let childLabels = this.nodeToLabels.has(originalChild) ? this.nodeToLabels.get(originalChild) : []; 149 | let structuredLabels = childLabels.filter(l => l.type !== 'bare'); 150 | if (structuredLabels.some(l => l.type === 'loop')) { 151 | let label = structuredLabels.find(l => l.type === 'loop'); 152 | throw new TypeError(`Node of type ${node.type} iterating over ${JSON.stringify(label.values)} is not in a loopable position`); 153 | } 154 | let result = this.applyLabels(childThunk, structuredLabels); 155 | if (result.length === 0) { 156 | acc[field.name] = null; 157 | return acc; 158 | } 159 | if (result.length === 1) { 160 | acc[field.name] = result[0]; 161 | return acc; 162 | } 163 | throw new Error('unreachable'); 164 | } 165 | 166 | // Otherwise just a node 167 | acc[field.name] = data[field.name](); 168 | return acc; 169 | }, {})); 170 | 171 | 172 | let bareLabels = labels.filter(l => l.type === 'bare'); 173 | if (bareLabels.length > 1) { 174 | throw new TypeError(`Node has multiple labels: ${JSON.stringify(bareLabels[0].name)}, ${JSON.stringify(bareLabels[1].name)}`); 175 | } 176 | if (bareLabels.length === 0) { 177 | return transformed; 178 | } 179 | let replacer = this.templateValues.get(bareLabels[0].name); 180 | if (typeof replacer !== 'function') { 181 | throw new TypeError(`Replacer ${JSON.stringify(bareLabels[0].name)} not found`); 182 | } 183 | return replacer(transformed); 184 | }; 185 | } 186 | 187 | module.exports = function applyStructuredTemplate(src, templateValues, { matcher = defaultMatcher, isModule = false } = {}) { 188 | if (!(templateValues instanceof Map)) { 189 | templateValues = new Map(entries(templateValues)); 190 | } 191 | 192 | let { tree, locations, comments } = (isModule ? parseModuleWithLocation : parseScriptWithLocation)(src, { earlyErrors: false }); 193 | let names = findNodes({ tree, locations, comments }, { matcher }); 194 | 195 | let nodeToLabels = new Map; 196 | for (let { name, node } of names) { 197 | if (!nodeToLabels.has(node)) { 198 | nodeToLabels.set(node, []); 199 | } 200 | let labels = nodeToLabels.get(node); 201 | if (name.startsWith('if ')) { 202 | labels.push({ type: 'if', condition: name.substring('if '.length).trim() }); 203 | } else if (name.startsWith('unless ')) { 204 | labels.push({ type: 'unless', condition: name.substring('unless '.length).trim() }); 205 | } else if (name.startsWith('for each ')) { 206 | let split = name.substring('for each '.length).split(' of '); 207 | if (split.length !== 2) { 208 | throw new TypeError(`couldn't parse label ${JSON.stringify(name)}`); 209 | } 210 | labels.push({ type: 'loop', variable: split[0].trim(), values: split[1].trim() }); 211 | } else { 212 | labels.push({ type: 'bare', name }); 213 | } 214 | } 215 | 216 | let result = thunkedReduce(new ReduceStructured(nodeToLabels, templateValues), tree); 217 | let earlyErrors = EarlyErrorChecker.check(result); 218 | if (earlyErrors.length > 0) { 219 | throw new Error(`early error after rendering template: ${earlyErrors[0].message}`); 220 | } 221 | return result; 222 | }; 223 | -------------------------------------------------------------------------------- /src/apply-template.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Shape Security, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 'use strict'; 18 | 19 | let { parseScriptWithLocation, parseModuleWithLocation } = require('shift-parser'); 20 | 21 | let defaultMatcher = require('./default-matcher.js'); 22 | let findNodes = require('./find-nodes.js'); 23 | let replace = require('./replace.js'); 24 | 25 | 26 | module.exports = function applyTemplate(src, newNodes, { matcher = defaultMatcher, isModule = false } = {}) { 27 | // for now, newNodes is an object { [name]: node => node } 28 | // TODO allow other types: fn, string-keyed map 29 | 30 | let { tree, locations, comments } = (isModule ? parseModuleWithLocation : parseScriptWithLocation)(src); 31 | let names = findNodes({ tree, locations, comments }, { matcher }); 32 | let nodeToName = new Map(names.map(({ name, node }) => [node, name])); 33 | 34 | let getReplacement = (newNode, originalNode) => nodeToName.has(originalNode) ? newNodes[nodeToName.get(originalNode)](newNode) : void 0; 35 | 36 | 37 | // Begin sanity checks 38 | let foundNames = new Set(names.map(({ name }) => name)); 39 | let providedNames = new Set(Object.keys(newNodes)); 40 | 41 | if (nodeToName.size < names.length) { 42 | // We have a node with multiple names: find it so we can produce a useful error message, then throw 43 | // TODO we could just apply the transformation functions several times in sequence, I guess. Useful for annotation-alikes. 44 | for (let { name, node } of names) { 45 | if (nodeToName.get(node) !== name) { 46 | throw new TypeError(`One node has two names: ${name} and ${nodeToName.get(node)}`); 47 | } 48 | } 49 | throw new Error('unreachable'); 50 | } 51 | 52 | let extraNames = [...providedNames].filter(name => !foundNames.has(name)); 53 | if (extraNames.length > 0) { 54 | throw new TypeError(`Provided replacements for nodes named ${extraNames.map(name => `"${name}"`).join(', ')}, but no corresponding nodes were found`); 55 | } 56 | let missingNames = [...foundNames].filter(name => !providedNames.has(name)); 57 | if (missingNames.length > 0) { 58 | throw new TypeError(`Found nodes named ${missingNames.map(name => `"${name}"`).join(', ')}, but no corresponding replacements were provided`); 59 | } 60 | // End sanity checks 61 | 62 | return replace(tree, getReplacement); 63 | }; 64 | -------------------------------------------------------------------------------- /src/default-matcher.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Shape Security, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 'use strict'; 18 | 19 | let Shift = require('shift-ast/checked'); 20 | 21 | let validTypes = new Set(Object.keys(Shift)); 22 | 23 | module.exports = function defaultMatcher(text) { 24 | let match = text.match(/^# ([^#]+) (?:# ([^#]+) )?#$/); 25 | if (match === null) { 26 | if (text.match(/(^\s*#)|(#\s*$)/)) { 27 | throw new Error('This comment looks kind of like a template comment, but not precisely; this is probably a bug.'); 28 | } 29 | return null; 30 | } 31 | if (typeof match[2] === 'string') { 32 | let type = match[2]; 33 | if (!validTypes.has(type)) { 34 | throw new TypeError(`Unrecognized type "${type}"`); 35 | } 36 | return { name: match[1], predicate: node => node.type === type }; 37 | } 38 | return { name: match[1], predicate: () => true }; 39 | }; 40 | -------------------------------------------------------------------------------- /src/find-nodes.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Shape Security, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 'use strict'; 18 | 19 | let { reduce, ConcatReducer, adapt } = require('shift-reducer'); 20 | 21 | let defaultMatcher = require('./default-matcher.js'); 22 | 23 | 24 | let flatten = adapt((data, node) => [node].concat(data), new ConcatReducer); 25 | 26 | module.exports = function findNodes({ tree, locations, comments }, { matcher = defaultMatcher } = {}) { 27 | let markers = comments 28 | .map(comment => { 29 | let { text, start } = comment; 30 | let match = matcher(text); 31 | if (match === null) { 32 | return null; 33 | } 34 | return { start: start.offset, name: match.name, predicate: match.predicate, comment }; 35 | }) 36 | .filter(m => m !== null); 37 | 38 | if (markers.length === 0) { 39 | return []; 40 | } 41 | 42 | let nodes = reduce(flatten, tree); 43 | let nodesAndLocations = nodes 44 | .map(node => { 45 | if (!locations.has(node)) { 46 | if (node.type === 'BindingIdentifier' && node.name === '*default*') { 47 | return null; 48 | } 49 | throw new TypeError(`Missing location information for node ${JSON.stringify(node)}`); 50 | } 51 | let loc = locations.get(node); 52 | return { start: loc.start.offset, end: loc.end.offset, node }; 53 | }) 54 | .filter(i => i !== null) 55 | .sort((a, b) => a.start - b.start); 56 | 57 | let joinedByStart = nodesAndLocations.reduce((acc, { start, end, node }) => { 58 | if (acc.length === 0 || acc[acc.length - 1].start < start) { 59 | acc.push({ start, nodes: [{ end, node }] }); 60 | } else { 61 | // Otherwise starts are equal, because nodes are sorted by start index 62 | acc[acc.length - 1].nodes.push({ end, node }); 63 | } 64 | return acc; 65 | }, []); 66 | 67 | 68 | let out = []; 69 | 70 | let nodeWalker = joinedByStart[Symbol.iterator](); 71 | 72 | let currentBlockOfNodes = nodeWalker.next().value; // we know it's not empty; there is at least the program node itself 73 | for (let marker of markers) { 74 | while (currentBlockOfNodes.start < marker.start) { 75 | let ret = nodeWalker.next(); 76 | if (ret.done) { 77 | throw new TypeError(`Couldn't find node following marker ${marker.name}`); 78 | } 79 | currentBlockOfNodes = ret.value; 80 | } 81 | // At this point we know currentBlockOfNodes is the set of nodes which start immediately following the marker we're looking at. 82 | 83 | let ofCorrectType = currentBlockOfNodes.nodes.filter(({ node }) => marker.predicate(node)); 84 | if (ofCorrectType.length === 0) { 85 | throw new TypeError(`Couldn't find any nodes matching predicate for marker ${marker.name}`); 86 | } 87 | if (ofCorrectType.length === 1) { 88 | // common case 89 | out.push({ name: marker.name, node: ofCorrectType[0].node, comment: marker.comment }); 90 | } else { 91 | let outermostEnd = -1; 92 | let outermost = null; 93 | ofCorrectType.forEach(({ end, node }) => { 94 | if (end > outermostEnd) { 95 | outermostEnd = end; 96 | outermost = node; 97 | } 98 | }); 99 | ofCorrectType.forEach(({ end, node }) => { 100 | if (end === outermostEnd && node !== outermost) { 101 | throw new TypeError(`Marker ${marker.name} is ambiguous: could be 102 | ${JSON.stringify(outermost)} 103 | or 104 | ${JSON.stringify(node)}`); 105 | } 106 | }); 107 | out.push({ name: marker.name, node: outermost, comment: marker.comment }); 108 | } 109 | } 110 | return out; 111 | }; 112 | -------------------------------------------------------------------------------- /src/lazy-checked-clone.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Shape Security, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 'use strict'; 18 | 19 | // TODO consider generating this file 20 | 21 | // compare https://github.com/shapesecurity/shift-reducer-js/blob/dda9f5105b3a08e6ac070c2bd5361e44ca224fd3/scripts/build/generate-lazy-clone-reducer.js 22 | 23 | let spec = require('shift-spec'); 24 | let Shift = require('shift-ast/checked'); 25 | 26 | let { isNodeOrUnionOfNodes, isStatefulType } = require('./utilities.js'); 27 | 28 | 29 | function equals(type, a, b) { 30 | switch (type.typeName) { 31 | case 'Enum': 32 | case 'String': 33 | case 'Number': 34 | case 'Boolean': 35 | throw new Error('not reached'); 36 | case 'List': 37 | switch (type.argument.typeName) { 38 | case 'Enum': 39 | case 'String': 40 | case 'Number': 41 | case 'Boolean': 42 | throw new Error('not reached'); 43 | case 'List': 44 | throw new Error('unimplemented: lists of lists'); 45 | case 'Maybe': 46 | if (isNodeOrUnionOfNodes(type.argument.argument)) { 47 | return a.length === b.length && a.every((v, i) => v === b[i]); 48 | } 49 | throw new Error('unimplemented: list of maybe of ' + type.argument.argument); 50 | default: 51 | if (isNodeOrUnionOfNodes(type.argument)) { 52 | return a.length === b.length && a.every((v, i) => v === b[i]); 53 | } 54 | throw new Error('unimplemented: list of ' + type.argument); 55 | } 56 | case 'Maybe': 57 | if (isNodeOrUnionOfNodes(type.argument)) { 58 | return a === b; 59 | } 60 | throw new Error('unimplemented: maybe of ' + type.argument); 61 | default: 62 | if (isNodeOrUnionOfNodes(type)) { 63 | return a === b; 64 | } 65 | throw new Error('unimplemented: ' + type); 66 | } 67 | } 68 | 69 | 70 | class LazyCheckedCloneReducer {} 71 | 72 | // TODO replace loop with `LazyCheckedCloneReducer.prototype = Object.fromEntries(Object.entries(spec).map(...))` 73 | for (let typeName of Object.keys(spec)) { 74 | let type = spec[typeName]; 75 | let statefulFields = type.fields.filter(f => f.name !== 'type' && isStatefulType(f.type)); 76 | LazyCheckedCloneReducer.prototype['reduce' + typeName] = 77 | statefulFields.length === 0 78 | ? node => node 79 | : (node, data) => 80 | statefulFields.every(f => equals(f.type, node[f.name], data[f.name])) 81 | ? node 82 | : new Shift[typeName](type.fields.reduce( 83 | (acc, f) => { 84 | if (f.name === 'type') { 85 | return acc; 86 | } 87 | acc[f.name] = isStatefulType(f.type) ? data[f.name] : node[f.name]; 88 | return acc; 89 | }, {} 90 | )); // TODO Object.fromEntries, damn it 91 | } 92 | 93 | module.exports = LazyCheckedCloneReducer; 94 | -------------------------------------------------------------------------------- /src/replace.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Shape Security, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 'use strict'; 18 | 19 | let { reduce, adapt } = require('shift-reducer'); 20 | 21 | let LazyCheckedCloneReducer = require('./lazy-checked-clone.js'); 22 | 23 | module.exports = function replace(tree, getReplacement) { 24 | // getReplacement signals that it is not attempting to replace a given node by returning `undefined`. If it returns `null`, that's treated as an attempt to replace a Just(node) with a Nothing. 25 | let adapted = adapt((newNode, originalNode) => { 26 | let replacement = getReplacement(newNode, originalNode); 27 | if (typeof replacement !== 'undefined') { 28 | return replacement; 29 | } 30 | return newNode; 31 | }, new LazyCheckedCloneReducer); 32 | return reduce(adapted, tree); 33 | }; 34 | -------------------------------------------------------------------------------- /src/utilities.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Shape Security, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 'use strict'; 18 | 19 | let spec = require('shift-spec'); 20 | 21 | // TODO consider splitting these and the utilities from https://github.com/shapesecurity/shift-reducer-js/blob/es2016/scripts/lib/utilities.js into their own project 22 | function isNodeOrUnionOfNodes(type) { 23 | return type.typeName === 'Union' && type.arguments.every(isNodeOrUnionOfNodes) || {}.hasOwnProperty.call(spec, type.typeName); 24 | } 25 | 26 | function isStatefulType(type) { 27 | switch (type.typeName) { 28 | case 'Enum': 29 | case 'String': 30 | case 'Number': 31 | case 'Boolean': 32 | return false; 33 | case 'Maybe': 34 | case 'List': 35 | return isStatefulType(type.argument); 36 | case 'Union': 37 | return type.arguments.some(isStatefulType); 38 | default: 39 | if (isNodeOrUnionOfNodes(type)) { 40 | return true; 41 | } 42 | throw new Error('unimplemented: type ' + type); 43 | } 44 | } 45 | 46 | module.exports = { 47 | isNodeOrUnionOfNodes, 48 | isStatefulType, 49 | }; 50 | -------------------------------------------------------------------------------- /test/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: '../.eslintrc.js', 3 | env: { 4 | mocha: true, 5 | node: true, 6 | }, 7 | }; 8 | -------------------------------------------------------------------------------- /test/apply-structured-template.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Shape Security, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 'use strict'; 18 | 19 | const assert = require('assert'); 20 | 21 | const Shift = require('shift-ast/checked'); 22 | const { parseScriptWithLocation, parseModuleWithLocation } = require('shift-parser'); 23 | const { applyStructuredTemplate } = require('..'); 24 | 25 | 26 | // There's no good way to tell `assert.deepStrictEqual` we don't care about prototypes, so just kill them. 27 | function stripPrototypes(obj, seen = new WeakSet) { 28 | if (typeof obj !== 'object' || obj === null || seen.has(obj)) { 29 | return obj; 30 | } 31 | seen.add(obj); 32 | Object.setPrototypeOf(obj, null); 33 | for (const name of Reflect.ownKeys(obj)) { 34 | stripPrototypes(obj[name], seen); 35 | } 36 | return obj; 37 | } 38 | 39 | function checkSimpleApplication(source, replacement, expectedSource) { 40 | checkApplication(source, { label: () => replacement }, expectedSource); 41 | } 42 | 43 | function checkApplication(source, templateValues, expectedSource) { 44 | const expected = parseScriptWithLocation(expectedSource).tree; 45 | const actual = applyStructuredTemplate(source, templateValues); 46 | assert.deepStrictEqual(stripPrototypes(actual), stripPrototypes(expected)); 47 | } 48 | 49 | function fails(source, templateValues) { 50 | assert.throws(() => applyStructuredTemplate(source, templateValues)); 51 | } 52 | 53 | 54 | describe('applyStructuredTemplate', () => { 55 | it('basic template', () => { 56 | const source = 'a + /*# label #*/ b'; 57 | const expected = 'a + null'; 58 | checkSimpleApplication(source, new Shift.LiteralNullExpression, expected); 59 | }); 60 | 61 | it('if/unless', () => { 62 | const source = ' start; /*# if a #*/ a; /*# if b #*/ b; /*# unless c #*/ c; /*# unless d #*/ d; end; '; 63 | const expected = 'start; a; d; end;'; 64 | checkApplication(source, { a: true, b: false, c: true, d: false }, expected); 65 | }); 66 | 67 | it('for-each', () => { 68 | const source = '[start, /*# for each x of xs #*/ /*# x::node #*/ PLACEHOLDER, end]; '; 69 | const expected = '[start, 1, 2, 3, end]'; 70 | checkApplication(source, { xs: [1, 2, 3].map(v => ({ node: () => new Shift.LiteralNumericExpression({ value: v }) })) }, expected); 71 | }); 72 | 73 | it('maybe supports if', () => { 74 | const source = '(function /*# if includeName #*/ name(){}); (function /*# unless includeName #*/ name(){});'; 75 | const expected = '(function name(){}); (function(){});'; 76 | checkApplication(source, { includeName: true }, expected); 77 | }); 78 | 79 | it('maybe does not support for-each', () => { 80 | const source = '(function /*# for each x of xs #*/ name(){});'; 81 | fails(source, { xs: [] }); 82 | }); 83 | 84 | it('does not support if on mandatory nodes', () => { 85 | const source = '(function name /*# if foo #*/ (){});'; 86 | fails(source, { foo: true }); 87 | }); 88 | 89 | it('does not support for-each on mandatory nodes', () => { 90 | const source = '(function name /*# for each foo of foos #*/ (){});'; 91 | fails(source, { foos: [] }); 92 | }); 93 | 94 | it('nesting', () => { 95 | const source = ` 96 | f( 97 | /*# for each x of xs #*/ 98 | /*# if x::include #*/ 99 | /*# for each y of x::ys #*/ 100 | /*# y::arg #*/ a 101 | );`; 102 | const expected = 'f(a_1, a_2, a_5, a_6);'; 103 | const templateValues = { 104 | xs: [ 105 | { 106 | include: true, 107 | ys: 108 | [ 109 | { arg: node => ({ type: 'IdentifierExpression', name: node.name + '_1' }) }, 110 | { arg: node => ({ type: 'IdentifierExpression', name: node.name + '_2' }) }, 111 | ], 112 | }, 113 | { 114 | include: false, 115 | }, 116 | { 117 | include: true, 118 | ys: 119 | [ 120 | { arg: node => ({ type: 'IdentifierExpression', name: node.name + '_5' }) }, 121 | { arg: node => ({ type: 'IdentifierExpression', name: node.name + '_6' }) }, 122 | ], 123 | }, 124 | ], 125 | }; 126 | checkApplication(source, templateValues, expected); 127 | }); 128 | 129 | it('module', () => { 130 | const source = ' /*# if one #*/ import one from "bar"; /*# unless one #*/ import two from "bar";'; 131 | const expected = parseModuleWithLocation('import two from "bar";').tree; 132 | const templateValues = { one: false }; 133 | const actual = applyStructuredTemplate(source, templateValues, { isModule: true }); 134 | assert.deepStrictEqual(stripPrototypes(actual), stripPrototypes(expected)); 135 | }); 136 | 137 | it('early errors not enforced before rendering', () => { 138 | const source = ' /*# if test #*/ let a, a; '; 139 | const expected = ''; 140 | checkApplication(source, { test: false }, expected); 141 | }); 142 | 143 | it('early errors enforced after rendering', () => { 144 | const source = ' /*# if test #*/ let a, a; '; 145 | fails(source, { test: true }); 146 | }); 147 | }); 148 | -------------------------------------------------------------------------------- /test/apply-template.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Shape Security, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 'use strict'; 18 | 19 | const assert = require('assert'); 20 | 21 | const Shift = require('shift-ast/checked'); 22 | const { parseScriptWithLocation, parseModuleWithLocation } = require('shift-parser'); 23 | const { applyTemplate } = require('..'); 24 | 25 | 26 | // There's no good way to tell `assert.deepStrictEqual` we don't care about prototypes, so just kill them. 27 | function stripPrototypes(obj, seen = new WeakSet) { 28 | if (typeof obj !== 'object' || obj === null || seen.has(obj)) { 29 | return obj; 30 | } 31 | seen.add(obj); 32 | Object.setPrototypeOf(obj, null); 33 | for (const name of Reflect.ownKeys(obj)) { 34 | stripPrototypes(obj[name], seen); 35 | } 36 | return obj; 37 | } 38 | 39 | function checkSimpleApplication(source, replacement, expectedSource) { 40 | checkApplication(source, { label: () => replacement }, expectedSource); 41 | } 42 | 43 | function checkApplication(source, newNodes, expectedSource) { 44 | const expected = parseScriptWithLocation(expectedSource).tree; 45 | const actual = applyTemplate(source, newNodes); 46 | assert.deepStrictEqual(stripPrototypes(actual), stripPrototypes(expected)); 47 | } 48 | 49 | function fails(source, newNodes) { 50 | assert.throws(() => applyTemplate(source, newNodes)); 51 | } 52 | 53 | 54 | describe('applyTemplate', () => { 55 | it('simple', () => { 56 | const source = 'a + /*# label #*/ b'; 57 | const expected = 'a + null'; 58 | checkSimpleApplication(source, new Shift.LiteralNullExpression, expected); 59 | }); 60 | 61 | it('node based', () => { 62 | const source = ' /*# increment # LiteralNumericExpression #*/ 42 + /*# increment #*/ 128'; 63 | const expected = '43 + 129'; 64 | checkApplication(source, { increment: node => new Shift.LiteralNumericExpression({ value: node.value + 1 }) }, expected); 65 | }); 66 | 67 | it('module', () => { 68 | const source = 'import /*# label #*/ foo from "bar";'; 69 | const expected = parseModuleWithLocation('import baz from "bar";').tree; 70 | const newNodes = { label: () => new Shift.BindingIdentifier({ name: 'baz' }) }; 71 | const actual = applyTemplate(source, newNodes, { isModule: true }); 72 | assert.deepStrictEqual(stripPrototypes(actual), stripPrototypes(expected)); 73 | }); 74 | }); 75 | 76 | describe('applyTemplate failure cases', () => { 77 | it('multiple names', () => { 78 | const source = ' /*# one # LiteralNumericExpression #*/ /*# two # LiteralNumericExpression #*/ 42'; 79 | fails(source, { 80 | one: () => new Shift.LiteralNullExpression, 81 | two: () => new Shift.LiteralNullExpression, 82 | }); 83 | }); 84 | 85 | it('extra names', () => { 86 | const source = ' /*# one # LiteralNumericExpression #*/ 1 + /*# two # LiteralNumericExpression #*/ 2'; 87 | fails(source, { 88 | one: () => new Shift.LiteralNullExpression, 89 | two: () => new Shift.LiteralNullExpression, 90 | three: () => new Shift.LiteralNullExpression, 91 | }); 92 | }); 93 | 94 | it('missing names', () => { 95 | const source = ' /*# one # LiteralNumericExpression #*/ 1 + /*# two # LiteralNumericExpression #*/ 2'; 96 | fails(source, { 97 | one: () => new Shift.LiteralNullExpression, 98 | }); 99 | }); 100 | 101 | it('suspicious comment', () => { 102 | const source = 'a + /*# label # */ b'; 103 | fails(source, {}); 104 | }); 105 | }); 106 | -------------------------------------------------------------------------------- /test/find-nodes.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Shape Security, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 'use strict'; 18 | 19 | const assert = require('assert'); 20 | 21 | const { parseScriptWithLocation } = require('shift-parser'); 22 | const { findNodes } = require('..'); 23 | 24 | 25 | function fail(message) { 26 | throw new Error(message); 27 | } 28 | 29 | function fails(source) { 30 | const { tree, locations, comments } = parseScriptWithLocation(source); 31 | assert.throws(() => findNodes({ tree, locations, comments })); 32 | } 33 | 34 | function checkNode(source, getter) { 35 | checkNodes(source, [{ name: 'label', getter }]); 36 | } 37 | 38 | function checkNodes(source, expectedNames) { 39 | const { tree, locations, comments } = parseScriptWithLocation(source); 40 | const names = findNodes({ tree, locations, comments }); 41 | 42 | if (names.length < expectedNames.length) { 43 | fail('Too few labels found'); 44 | } 45 | if (names.length > expectedNames.length) { 46 | fail('Too many labels found'); 47 | } 48 | 49 | outer: for (const { name: expectedName, getter } of expectedNames) { 50 | const expectedNode = getter(tree); 51 | for (const { name, node } of names) { 52 | if (name === expectedName) { 53 | assert.strictEqual(node, expectedNode); 54 | continue outer; 55 | } 56 | } 57 | fail(`Couldn't find label "${expectedName}"`); 58 | } 59 | 60 | // assert sorted 61 | let prev = -1; 62 | for (const { comment } of names) { 63 | assert(prev < comment.start.offset); 64 | prev = comment.start.offset; 65 | } 66 | } 67 | 68 | describe('findNodes', () => { 69 | it('simple', () => { 70 | const source = 'a + /*# label #*/ b * c; // whee\n'; 71 | checkNode(source, t => t.statements[0].expression.right); 72 | }); 73 | 74 | it('single-line comment', () => { 75 | const source = ` 76 | //# label # 77 | class Foo {} 78 | `; 79 | checkNode(source, t => t.statements[0]); 80 | }); 81 | 82 | it('label type', () => { 83 | const source = 'a + /*# label # IdentifierExpression #*/ b * c;'; 84 | checkNode(source, t => t.statements[0].expression.right.left); 85 | }); 86 | 87 | it('label is outermost', () => { 88 | const sourceT = type => ` /*# label ${type}#*/ a + c + d;`; 89 | checkNode(sourceT(''), t => t.statements[0]); 90 | checkNode(sourceT('# BinaryExpression '), t => t.statements[0].expression); 91 | checkNode(sourceT('# IdentifierExpression '), t => t.statements[0].expression.left.left); 92 | }); 93 | 94 | it('multiple labels', () => { 95 | const source = ` 96 | a + /*# foo # IdentifierExpression #*/ b; 97 | 0 + /*# bar #*/ 1; 98 | `; 99 | 100 | checkNodes(source, [ 101 | { name: 'foo', getter: t => t.statements[0].expression.right }, 102 | { name: 'bar', getter: t => t.statements[1].expression.right }, 103 | ]); 104 | }); 105 | 106 | it('multiple labels on one node', () => { 107 | const source = 'a + /*# foo #*/ /*# bar #*/ b;'; 108 | 109 | checkNodes(source, [ 110 | { name: 'foo', getter: t => t.statements[0].expression.right }, 111 | { name: 'bar', getter: t => t.statements[0].expression.right }, 112 | ]); 113 | }); 114 | 115 | it('custom matcher', () => { 116 | const source = 'a + /*$ label $*/ b;'; 117 | const matcher = string => { 118 | let match = string.match(/^\$ ([^$]+) \$$/); 119 | if (match === null) { 120 | return null; 121 | } 122 | return { name: match[1], predicate: () => true }; 123 | }; 124 | const { tree, locations, comments } = parseScriptWithLocation(source); 125 | const names = findNodes({ tree, locations, comments }, { matcher }); 126 | 127 | assert.strictEqual(names.length, 1); 128 | const { name, node, comment } = names[0]; 129 | 130 | assert.strictEqual(name, 'label'); 131 | assert.strictEqual(node, tree.statements[0].expression.right); 132 | assert.strictEqual(comment, comments[0]); 133 | }); 134 | 135 | it('custom predicate', () => { 136 | const source = 'a + /*$ b $*/ b + /*$ c $*/ c + /*$ d $*/ (d + e);'; 137 | const matcher = string => { 138 | let match = string.match(/^\$ ([^$]+) \$$/); 139 | if (match === null) { 140 | return null; 141 | } 142 | return { name: match[1], predicate: node => node.type === 'IdentifierExpression' && node.name === match[1] }; 143 | }; 144 | 145 | const { tree, locations, comments } = parseScriptWithLocation(source); 146 | const names = findNodes({ tree, locations, comments }, { matcher }); 147 | 148 | assert.strictEqual(names.length, 3); 149 | const [b, c, d] = names; 150 | 151 | assert.strictEqual(b.name, 'b'); 152 | assert.strictEqual(b.node, tree.statements[0].expression.left.left.right); 153 | assert.strictEqual(b.comment, comments[0]); 154 | 155 | assert.strictEqual(c.name, 'c'); 156 | assert.strictEqual(c.node, tree.statements[0].expression.left.right); 157 | assert.strictEqual(c.comment, comments[1]); 158 | 159 | assert.strictEqual(d.name, 'd'); 160 | assert.strictEqual(d.node, tree.statements[0].expression.right.left); 161 | assert.strictEqual(d.comment, comments[2]); 162 | }); 163 | }); 164 | 165 | describe('findNodes failure cases', () => { 166 | it('wrong type', () => { 167 | fails('a + /*# label # IdentifierExpression #*/ 0;'); 168 | }); 169 | 170 | it('not a type', () => { 171 | fails('a + /*# label # NotIdentifierExpression #*/ 0;'); 172 | }); 173 | 174 | it('trailing label', () => { 175 | fails('a /*# label #*/'); 176 | }); 177 | 178 | it('ambiguous', () => { 179 | fails(' /*# label #*/ a'); // can be either the ExpressionStatement or the Expression 180 | }); 181 | 182 | it('missing location info', () => { 183 | const source = 'a + /*# label #*/ b'; 184 | const { tree } = parseScriptWithLocation(source); 185 | const { locations, comments } = parseScriptWithLocation(source); 186 | assert.throws(() => findNodes({ tree, locations, comments })); 187 | }); 188 | }); 189 | --------------------------------------------------------------------------------