├── .eslintrc.js ├── .flowconfig ├── .github ├── CODEOWNERS └── workflows │ ├── main.yml │ └── publish.yml ├── .gitignore ├── .husky ├── .gitignore ├── commit-msg └── pre-commit ├── .npmrc ├── .prettierignore ├── .prettierrc.json ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── SECURITY.md ├── babel.config.json ├── commitlint.config.js ├── demo ├── dev │ ├── index.htm │ └── index.jsx └── index.htm ├── dist ├── jsx-pragmatic-demo.js ├── jsx-pragmatic.js ├── jsx-pragmatic.min.js ├── jsx-pragmatic.min.js.map └── module │ ├── component │ ├── index.js │ ├── regex.js │ └── style.js │ ├── constants.js │ ├── index.js │ ├── node.js │ ├── renderers │ ├── dom.js │ ├── html.js │ ├── index.js │ ├── preact.js │ ├── react.js │ ├── regex.js │ └── text.js │ ├── types.js │ └── util.js ├── flow-typed └── npm │ ├── @commitlint │ ├── cli_vx.x.x.js │ └── config-conventional_vx.x.x.js │ ├── @krakenjs │ └── grumbler-scripts_vx.x.x.js │ ├── @octokit │ └── rest_v18.x.x.js │ ├── colors_v1.x.x.js │ ├── cross-env_vx.x.x.js │ ├── flow-bin_v0.x.x.js │ ├── fs-extra_v8.x.x.js │ ├── glob_v7.x.x.js │ ├── husky_vx.x.x.js │ ├── jest_v29.x.x.js │ ├── lint-staged_vx.x.x.js │ ├── md5_v2.x.x.js │ ├── mkdirp_v1.x.x.js │ ├── mocha_v4.x.x.js │ ├── node-stream-zip_v1.x.x.js │ ├── prettier_v1.x.x.js │ ├── prettier_vx.x.x.js │ ├── rimraf_v3.x.x.js │ ├── semver_v7.x.x.js │ ├── standard-version_vx.x.x.js │ └── yargs_v15.x.x.js ├── index.js ├── karma.conf.js ├── package.json ├── src ├── component │ ├── index.js │ ├── regex.jsx │ └── style.jsx ├── constants.js ├── index.js ├── node.js ├── renderers │ ├── dom.js │ ├── html.js │ ├── index.js │ ├── preact.js │ ├── react.js │ ├── regex.js │ └── text.js ├── types.js └── util.js ├── test ├── index.js ├── tests │ ├── dom.jsx │ ├── html.jsx │ ├── index.js │ ├── node.jsx │ ├── preact.jsx │ ├── react.jsx │ └── style.jsx └── util.js └── webpack.config.js /.eslintrc.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | module.exports = { 4 | extends: "@krakenjs/eslint-config-grumbler/eslintrc-browser", 5 | 6 | rules: { 7 | "react/display-name": "off", 8 | "react/button-has-type": "off", 9 | "react/prop-types": "off", 10 | "react/require-default-props": "off", 11 | }, 12 | 13 | overrides: [ 14 | { 15 | files: ["**/test/**/*"], 16 | rules: { 17 | "compat/compat": "off", 18 | "no-restricted-globals": "off", 19 | "promise/no-native": "off", 20 | }, 21 | }, 22 | ], 23 | }; 24 | -------------------------------------------------------------------------------- /.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | .*/node_modules/babel-plugin-flow-runtime 3 | .*/node_modules/flow-runtime 4 | .*/node_modules/npm 5 | .*/node_modules/eslint-plugin-compat 6 | .*/node_modules/jsonlint 7 | .*/node_modules/resolve 8 | .*/dist/module 9 | [include] 10 | [libs] 11 | flow-typed 12 | [options] 13 | module.file_ext=.js 14 | module.file_ext=.json 15 | module.file_ext=.jsx 16 | module.file_ext=.css 17 | module.file_ext=.scss 18 | module.name_mapper='^src\(.*\)$' -> '/src/\1' 19 | experimental.const_params=false 20 | esproposal.export_star_as=enable 21 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Owner for everything in the repo 2 | * @krakenjs/checkout-sdk 3 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | on: 3 | push: 4 | branches: 5 | - main 6 | pull_request: {} 7 | jobs: 8 | main: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: ⬇️ Checkout repo 12 | uses: actions/checkout@v2 13 | with: 14 | fetch-depth: 0 15 | 16 | - name: ⎔ Setup node 17 | uses: actions/setup-node@v2 18 | with: 19 | node-version: "14" 20 | registry-url: "https://registry.npmjs.org" 21 | 22 | - name: 📥 Download deps 23 | uses: bahmutov/npm-install@v1 24 | with: 25 | useLockFile: false 26 | 27 | - name: 👕 Lint commit messages 28 | uses: wagoid/commitlint-github-action@v4 29 | 30 | - name: ▶️ Run build script 31 | run: npm run build 32 | 33 | - name: ⬆️ Upload karma coverage report 34 | uses: codecov/codecov-action@v2 35 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: publish to npm 2 | on: workflow_dispatch 3 | jobs: 4 | main: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - name: ⬇️ Checkout repo 8 | uses: actions/checkout@v2 9 | with: 10 | fetch-depth: 0 11 | 12 | - name: ⎔ Setup node 13 | # sets up the .npmrc file to publish to npm 14 | uses: actions/setup-node@v2 15 | with: 16 | node-version: "14" 17 | registry-url: "https://registry.npmjs.org" 18 | 19 | - name: 📥 Download deps 20 | uses: bahmutov/npm-install@v1 21 | with: 22 | useLockFile: false 23 | 24 | - name: Configure git user 25 | run: | 26 | git config --global user.email ${{ github.actor }}@users.noreply.github.com 27 | git config --global user.name ${{ github.actor }} 28 | - name: Publish to npm 29 | run: npm run release 30 | env: 31 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 32 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | *.pid.lock 11 | 12 | # Directory for instrumented libs generated by jscoverage/JSCover 13 | lib-cov 14 | 15 | # Coverage directory used by tools like istanbul 16 | coverage 17 | 18 | # nyc test coverage 19 | .nyc_output 20 | 21 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 22 | .grunt 23 | 24 | # node-waf configuration 25 | .lock-wscript 26 | 27 | # Compiled binary addons (http://nodejs.org/api/addons.html) 28 | build/Release 29 | 30 | # Dependency directories 31 | node_modules 32 | jspm_packages 33 | 34 | # Optional npm cache directory 35 | .npm 36 | 37 | # Optional eslint cache 38 | .eslintcache 39 | 40 | # Optional REPL history 41 | .node_repl_history 42 | 43 | # Output of 'npm pack' 44 | *.tgz 45 | 46 | # Yarn Integrity file 47 | .yarn-integrity 48 | 49 | .idea 50 | 51 | .DS_Store 52 | -------------------------------------------------------------------------------- /.husky/.gitignore: -------------------------------------------------------------------------------- 1 | _ 2 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx --no -- commitlint --edit "$1" 5 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx lint-staged 5 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | registry=https://registry.npmjs.org/ 2 | save=false 3 | package-lock=false 4 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | build 2 | dist 3 | coverage 4 | flow-typed 5 | CHANGELOG.md 6 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. 4 | 5 | ### [3.1.1](https://github.com/krakenjs/jsx-pragmatic/compare/v3.1.0...v3.1.1) (2024-10-03) 6 | 7 | ## [3.1.0](https://github.com/krakenjs/jsx-pragmatic/compare/v3.0.0...v3.1.0) (2024-09-23) 8 | 9 | 10 | ### Features 11 | 12 | * commit flow-typed folder ([#37](https://github.com/krakenjs/jsx-pragmatic/issues/37)) ([170604c](https://github.com/krakenjs/jsx-pragmatic/commit/170604ca9c383308b2ce284b3806393577df1f20)) 13 | * upgrade to grumbler scripts 8 ([#33](https://github.com/krakenjs/jsx-pragmatic/issues/33)) ([e8e202e](https://github.com/krakenjs/jsx-pragmatic/commit/e8e202e3ea2978b125145dd3563097ab37e15ef8)) 14 | 15 | 16 | ### Bug Fixes 17 | 18 | * **iframe:** add empty srcdoc attribute to iframe elem if not exist ([#36](https://github.com/krakenjs/jsx-pragmatic/issues/36)) ([b21a468](https://github.com/krakenjs/jsx-pragmatic/commit/b21a46826fe3369ded96cbba6dfd44b955a87a34)) 19 | 20 | 21 | * **docs:** update github actions badge url ([3b4ed67](https://github.com/krakenjs/jsx-pragmatic/commit/3b4ed67cb0a95c06a6e4c6c10355ce1579eae10f)) 22 | * move devDependencies to [@krakenjs](https://github.com/krakenjs) scope ([#28](https://github.com/krakenjs/jsx-pragmatic/issues/28)) ([c21fe35](https://github.com/krakenjs/jsx-pragmatic/commit/c21fe356071e76e9e70d5ce220ccd41cb9f0fef4)) 23 | * remove quotes from publish ([d7d154a](https://github.com/krakenjs/jsx-pragmatic/commit/d7d154aaafc968c563c83ac8bd12dab3de4aa0ea)) 24 | * remove token from publish action ([00b0073](https://github.com/krakenjs/jsx-pragmatic/commit/00b0073e42aa4968ebe0ef7fe6400efd1f2be8aa)) 25 | * use prettier ([#30](https://github.com/krakenjs/jsx-pragmatic/issues/30)) ([4826e52](https://github.com/krakenjs/jsx-pragmatic/commit/4826e521d3b0c886a2c6063671ecd96d8cb9b66a)) 26 | 27 | ## [3.0.0](https://github.com/krakenjs/jsx-pragmatic/compare/v2.0.22...v3.0.0) (2022-02-28) 28 | 29 | 30 | ### ⚠ BREAKING CHANGES 31 | 32 | * move to krakenjs scope 33 | 34 | * commitlint and standard version setup ([6d9b587](https://github.com/krakenjs/jsx-pragmatic/commit/6d9b587b82736214e8c6c45a45bb414e02050c13)) 35 | * move to krakenjs scope ([b83a9b7](https://github.com/krakenjs/jsx-pragmatic/commit/b83a9b72c630cef9d42238a6a0288bf9cceb68b3)) 36 | * setup codecov and badges ([7ed15b4](https://github.com/krakenjs/jsx-pragmatic/commit/7ed15b4e3898a965c505536acec3e390de74bd4e)) 37 | * update license ([2e9741e](https://github.com/krakenjs/jsx-pragmatic/commit/2e9741e7c6abf123d95acddf8b2b0022377e56d5)) 38 | * upgrade to grumbler-scripts v5 ([03c8891](https://github.com/krakenjs/jsx-pragmatic/commit/03c88918e699b83063a95b70856e8a3651b088ab)) 39 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to jsx-pragmatic 2 | 3 | We are always looking for ways to make our modules better. Adding features and fixing bugs allows everyone who depends 4 | on this code to create better, more stable applications. 5 | Feel free to raise a pull request to us. Our team would review your proposed modifications and, if appropriate, merge 6 | your changes into our code. Ideas and other comments are also welcome. 7 | 8 | ## Getting Started 9 | 10 | 1. Create your own [fork](https://help.github.com/articles/fork-a-repo) of this [repository](../../fork). 11 | 12 | ```bash 13 | # Clone it 14 | $ git clone git@github.com:me/jsx-pragmatic.git 15 | 16 | # Change directory 17 | $ cd jsx-pragmatic 18 | 19 | # Add the upstream repo 20 | $ git remote add upstream git://github.com/krakenjs/jsx-pragmatic.git 21 | 22 | # Get the latest upstream changes 23 | $ git pull upstream 24 | 25 | # Install dependencies 26 | $ npm install 27 | 28 | # Run scripts to verify installation 29 | $ npm test 30 | $ npm run-script lint 31 | $ npm run-script cover 32 | ``` 33 | 34 | ## Making Changes 35 | 36 | 1. Make sure that your changes adhere to the current coding conventions used throughout the project, indentation, accurate comments, etc. 37 | 2. Lint your code regularly and ensure it passes prior to submitting a PR: 38 | `$ npm run lint`. 39 | 3. Ensure existing tests pass (`$ npm test`) and include test cases which fail without your change and succeed with it. 40 | 41 | ## Submitting Changes 42 | 43 | 1. Ensure that no errors are generated by ESLint. 44 | 2. Commit your changes in logical chunks, i.e. keep your changes small per single commit. 45 | 3. Locally merge (or rebase) the upstream branch into your topic branch: `$ git pull upstream && git merge`. 46 | 4. Push your topic branch up to your fork: `$ git push origin `. 47 | 5. Open a [Pull Request](https://help.github.com/articles/using-pull-requests) with a clear title and description. 48 | 49 | If you have any questions about contributing, please feel free to contact us by posting your questions on GitHub. 50 | 51 | Copyright 2016, MyCompany under [the Apache 2.0 license](LICENSE.txt). 52 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2016 MyCompany 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## JSX Pragmatic 2 | 3 | [![build status][build-badge]][build] 4 | [![code coverage][coverage-badge]][coverage] 5 | [![npm version][version-badge]][package] 6 | 7 | [build-badge]: https://img.shields.io/github/actions/workflow/status/krakenjs/jsx-pragmatic/main.yml?branch=main&logo=github&style=flat-square 8 | [build]: https://github.com/krakenjs/jsx-pragmatic/actions?query=workflow:build 9 | [coverage-badge]: https://img.shields.io/codecov/c/github/krakenjs/jsx-pragmatic.svg?style=flat-square 10 | [coverage]: https://codecov.io/github/krakenjs/jsx-pragmatic/ 11 | [version-badge]: https://img.shields.io/npm/v/jsx-pragmatic.svg?style=flat-square 12 | [package]: https://www.npmjs.com/package/jsx-pragmatic 13 | 14 | - Build JSX templates 15 | - Decide at runtime how you want to render them 16 | - Easily build custom renderers - render to HTML, DOM, or anything else! 17 | 18 | Because JSX is pretty useful, even without React! 19 | 20 | #### Build an abstract jsx component 21 | 22 | First we'll build a small component. We're not tying ourselves to any particular framework yet, or any render target. 23 | 24 | ```javascript 25 | /* @jsx node */ 26 | 27 | import { node } from "jsx-pragmatic"; 28 | 29 | function Login({ prefilledEmail }) { 30 | return ( 31 |
32 | 33 | 34 | 35 |
36 | ); 37 | } 38 | ``` 39 | 40 | #### Render on the server 41 | 42 | Let's say we're on the server-side, and we want to render the jsx to html to serve to a client. Just pass `html()` to the renderer: 43 | 44 | ```javascript 45 | /* @jsx node */ 46 | 47 | import { node, html } from "jsx-pragmatic"; 48 | import { Login } from "./components"; 49 | 50 | function render() { 51 | return ().render(html()); 52 | } 53 | ``` 54 | 55 | #### Render on the client 56 | 57 | Now let's render the same jsx template on the client-side, directly to a DOM element: 58 | 59 | ```javascript 60 | /* @jsx node */ 61 | 62 | import { node, dom } from "jsx-pragmatic"; 63 | import { Login } from "./components"; 64 | 65 | function render() { 66 | return ().render(dom()); 67 | } 68 | ``` 69 | 70 | #### Render in a React app 71 | 72 | Or if we're using the same component in React, we can render it as a React component: 73 | 74 | ```javascript 75 | /* @jsx node */ 76 | 77 | import { node, react } from "jsx-pragmatic"; 78 | import { Login } from "./components"; 79 | 80 | function render() { 81 | return ().render(react({ React })); 82 | } 83 | ``` 84 | 85 | #### Render in a Preact app 86 | 87 | Or if we're using the same component in Preact, we can render it as a Preact component: 88 | 89 | ```javascript 90 | /* @jsx node */ 91 | 92 | import { node, preact } from "jsx-pragmatic"; 93 | import { Login } from "./components"; 94 | 95 | function render() { 96 | return ().render(preact({ Preact })); 97 | } 98 | ``` 99 | 100 | ### Write your own renderer 101 | 102 | Renderers are just functions! 103 | 104 | - Write a factory like `customDom`. This will take some options and return our renderer. 105 | - Return a renderer which takes `name`, `props` and `children` and renders them in whatever way you want! 106 | 107 | This example renders the jsx directly to DOM elements: 108 | 109 | ```javascript 110 | /* @jsx node */ 111 | 112 | import { node, NODE_TYPE } from "jsx-pragmatic"; 113 | import { Login } from "./components"; 114 | 115 | function customDom({ removeScriptTags } = { removeScriptTags: false }) { 116 | let domRenderer = (node) => { 117 | if (node.type === NODE_TYPE.COMPONENT) { 118 | return node.renderComponent(domRenderer); 119 | } 120 | 121 | if (node.type === NODE_TYPE.TEXT) { 122 | return document.createTextNode(node.text); 123 | } 124 | 125 | if (node.type === NODE_TYPE.ELEMENT) { 126 | if (removeScriptTags && node.name === "script") { 127 | return; 128 | } 129 | 130 | let el = document.createElement(node.name); 131 | 132 | for (let [key, val] of Object.entries(node.props)) { 133 | el.setAttribute(key, val); 134 | } 135 | 136 | for (let child of node.children) { 137 | el.appendChild(child.render(domRenderer)); 138 | } 139 | 140 | return el; 141 | } 142 | }; 143 | 144 | return domRenderer; 145 | } 146 | ``` 147 | 148 | Then when you're ready to use your renderer, just pass it into `.render()` and pass any options you want to use to configure the renderer. 149 | 150 | ```javascript 151 | function render() { 152 | return ().render( 153 | customDom({ removeScriptTags: true }) 154 | ); 155 | } 156 | ``` 157 | 158 | ### Use Fragments 159 | 160 | You can either import `Fragment` from `jsx-pragmatic`: 161 | 162 | ```javascript 163 | /* @jsx node */ 164 | 165 | import { node, Fragment } from "jsx-pragmatic"; 166 | 167 | function Login({ prefilledEmail }) { 168 | return ( 169 | 170 | 171 | 172 | 173 | 174 | ); 175 | } 176 | ``` 177 | 178 | Or use the `@jsxFrag` comment, and the new `<>` `` syntax for Fragments, providing you're using Babel 7: 179 | 180 | ```javascript 181 | /* @jsx node */ 182 | /* @jsxFrag Fragment */ 183 | 184 | import { node, Fragment } from "jsx-pragmatic"; 185 | 186 | function Login({ prefilledEmail }) { 187 | return ( 188 | <> 189 | 190 | 191 | 192 | 193 | ); 194 | } 195 | ``` 196 | 197 | ### Why? 198 | 199 | [JSX](https://reactjs.org/docs/introducing-jsx.html) is a neat way of parsing and compiling templates to vanilla javascript. Right now most people use JSX with [React](https://reactjs.org/). But in reality, the technology is decoupled enough from React that it can be used to render anything: 200 | 201 | - HTML 202 | - XML 203 | - DOM Nodes 204 | 205 | This library helps you do that. 206 | 207 | ### Can't you do that with Babel? 208 | 209 | Yep, Babel provides a neat `pragma` [option](https://babeljs.io/docs/en/babel-plugin-transform-react-jsx#pragma) which lets you choose what your jsx is compiled to; if you don't want to use `React.createElement`, you can write your own pragma to convert the jsx to anything else. 210 | 211 | The only problem with that is, the decision of which pragma to use is made entirely at build-time. Let's say you have a template which needs to be: 212 | 213 | - Rendered as an html string on the server side. 214 | - Rendered directly as a DOM element in some client environments. 215 | - Rendered as a React component in other client environments. 216 | 217 | `jsx-pragmatic` helps you achieve that by allowing you decide when you render what your jsx should be transformed into. 218 | 219 | It also abstracts away some of the stuff in jsx that's a little tricky to deal with; like nested children arrays, dealing with basic element vs function components, and fragments -- leaving you to focus on the renderer logic. 220 | 221 | ## Quick Start 222 | 223 | #### Install 224 | 225 | ```bash 226 | npm install --save jsx-pragmatic 227 | ``` 228 | 229 | #### Getting Started 230 | 231 | - Fork the module 232 | - Run setup: `npm run setup` 233 | - Start editing code in `./src` and writing tests in `./tests` 234 | - `npm run build` 235 | 236 | #### Building 237 | 238 | ```bash 239 | npm run build 240 | ``` 241 | 242 | #### Tests 243 | 244 | - Edit tests in `./test/tests` 245 | - Run the tests: 246 | 247 | ```bash 248 | npm run test 249 | ``` 250 | 251 | #### Testing with different/multiple browsers 252 | 253 | ```bash 254 | npm run karma -- --browser=PhantomJS 255 | npm run karma -- --browser=Chrome 256 | npm run karma -- --browser=Safari 257 | npm run karma -- --browser=Firefox 258 | npm run karma -- --browser=PhantomJS,Chrome,Safari,Firefox 259 | ``` 260 | 261 | #### Keeping the browser open after tests 262 | 263 | ```bash 264 | npm run karma -- --browser=Chrome --keep-open 265 | ``` 266 | 267 | #### Publishing 268 | 269 | ##### Before you publish for the first time: 270 | 271 | - Delete the example code in `./src`, `./test/tests` and `./demo` 272 | - Edit the module name in `package.json` 273 | - Edit `README.md` and `CONTRIBUTING.md` 274 | 275 | ##### Then: 276 | 277 | - Publish your code: `npm run release` to add a patch 278 | - Or `npm run release:path`, `npm run release:minor`, `npm run release:major` 279 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | We take security very seriously and ask that you follow the following process. 4 | 5 | ## Contact us 6 | 7 | If you think you may have found a security bug we ask that you privately send the details to DL-PP-Kraken-Js@ebay.com. Please make sure to use a descriptive title in the email. 8 | 9 | ## Expectations 10 | 11 | We will generally get back to you within **24 hours**, but a more detailed response may take up to **48 hours**. If you feel we're not responding back in time, please send us a message _without detail_ on Twitter [@kraken_js](https://twitter.com/kraken_js). 12 | 13 | ## History 14 | 15 | No reported issues 16 | -------------------------------------------------------------------------------- /babel.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@krakenjs/babel-config-grumbler/babelrc-browser" 3 | } 4 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | /* eslint import/no-commonjs: off */ 3 | 4 | module.exports = { 5 | extends: ["@commitlint/config-conventional"], 6 | }; 7 | -------------------------------------------------------------------------------- /demo/dev/index.htm: -------------------------------------------------------------------------------- 1 | 2 | JSX Pragmatic Dev Demo 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /demo/dev/index.jsx: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | /* @jsx regex.node */ 3 | 4 | import { regex, Regex, RegexGroup, RegexText, RegexWord } from "../../src"; 5 | 6 | const email = "zombo.com@paypal.com"; 7 | 8 | const match = email.match( 9 | 10 | 11 | 12 | . 13 | 14 | 15 | @ 16 | 17 | paypal 18 | google 19 | $mail 20 | 21 | . 22 | 23 | com 24 | org 25 | net 26 | 27 | 28 | ); 29 | 30 | // eslint-disable-next-line no-console 31 | console.info(email, match); 32 | -------------------------------------------------------------------------------- /demo/index.htm: -------------------------------------------------------------------------------- 1 | 2 | MyLibrary Demo 3 | 4 | 5 | 6 | 7 | 8 | 13 | 14 | -------------------------------------------------------------------------------- /dist/jsx-pragmatic.min.js: -------------------------------------------------------------------------------- 1 | !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("pragmatic",[],r):"object"==typeof exports?exports.pragmatic=r():e.pragmatic=r()}("undefined"!=typeof self?self:this,(function(){return function(e){var r={};function n(t){if(r[t])return r[t].exports;var o=r[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=r,n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,r){if(1&r&&(e=n(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(n.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)n.d(t,o,function(r){return e[r]}.bind(null,o));return t},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,r){return{}.hasOwnProperty.call(e,r)},n.p="",n(n.s=0)}([function(e,r,n){"use strict";n.r(r),n.d(r,"ElementNode",(function(){return i})),n.d(r,"FragmentNode",(function(){return u})),n.d(r,"TextNode",(function(){return p})),n.d(r,"ComponentNode",(function(){return a})),n.d(r,"node",(function(){return s})),n.d(r,"Fragment",(function(){return h})),n.d(r,"text",(function(){return y})),n.d(r,"dom",(function(){return M})),n.d(r,"react",(function(){return O})),n.d(r,"html",(function(){return j})),n.d(r,"preact",(function(){return A})),n.d(r,"regex",(function(){return H})),n.d(r,"NODE_TYPE",(function(){return t})),n.d(r,"Style",(function(){return S})),n.d(r,"Regex",(function(){return U})),n.d(r,"RegexText",(function(){return G})),n.d(r,"RegexWord",(function(){return k})),n.d(r,"RegexCharacters",(function(){return F})),n.d(r,"RegexGroup",(function(){return W})),n.d(r,"RegexUnion",(function(){return $}));var t={ELEMENT:"element",TEXT:"text",COMPONENT:"component",FRAGMENT:"fragment"};function o(e,r){for(var n=[],t=0;t1?new u(r):void 0}(this.component(this.props,this.children));if(r)return r.render(e)},r.render=function(e){return e(this)},r.renderChildren=function(e){return o(this.children,e)},e}();function c(e){for(var r=[],n=0;n2?n-2:0),o=2;o=0||(o[n]=e[n]);return o}var C=["innerHTML","class"];function O(e){var r=(void 0===e?{}:e).React;if(!r)throw new Error("Must pass React library to react renderer");var n=function(e){if(e.type===t.COMPONENT)return r.createElement.apply(r,[function(){return e.renderComponent(n)||null},e.props].concat(e.renderChildren(n)));if(e.type===t.ELEMENT)return r.createElement.apply(r,[e.name,(o=e.props,i=o.innerHTML,b({dangerouslySetInnerHTML:i?{__html:i}:null,className:o.class},N(o,C)))].concat(e.renderChildren(n)));var o,i;if(e.type===t.TEXT)return e.text;throw new TypeError("Unhandleable node")};return n}var L={br:!0};function R(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}function j(){var e=function(r){if(r.type===t.COMPONENT)return[].concat(r.renderComponent(e)).join("");if(r.type===t.ELEMENT){var n=(i=r.props,(u=Object.keys(i).filter((function(e){var r=i[e];return"innerHTML"!==e&&("string"==typeof r||"number"==typeof r||!0===r)}))).length?" "+u.map((function(e){var r=i[e];if(!0===r)return""+R(e);if("string"!=typeof r&&"number"!=typeof r)throw new TypeError("Unexpected prop type: "+typeof r);return""===r?R(e):R(e)+'="'+R(r.toString())+'"'})).join(" "):"");if(L[r.name])return"<"+r.name+n+" />";var o="string"==typeof r.props.innerHTML?r.props.innerHTML:r.renderChildren(e).join("");return"<"+r.name+n+">"+o+""}var i,u;if(r.type===t.TEXT)return R(r.text);throw new TypeError("Unhandleable node: "+r.type)};return e}var P=["innerHTML"];function A(e){var r=(void 0===e?{}:e).Preact;if(!r)throw new Error("Must pass Preact library to react renderer");var n=function(e){if(e.type===t.COMPONENT)return r.h.apply(r,[function(){return e.renderComponent(n)||null},e.props].concat(e.renderChildren(n)));if(e.type===t.ELEMENT)return r.h.apply(r,[e.name,(o=e.props,i=o.innerHTML,b({dangerouslySetInnerHTML:i?{__html:i}:null},N(o,P)))].concat(e.renderChildren(n)));var o,i;if(e.type===t.TEXT)return e.text;throw new TypeError("Unhandleable node")};return n}function H(){var e=y();return function(r){return new RegExp(e(r))}}function S(e){var r=e.css,n=e.nonce,t=e.children;return s(h,null,s("style",{innerHTML:"string"==typeof r?r:r._getCss(),nonce:n}),t)}H.node=function(e,r){for(var n=arguments.length,t=new Array(n>2?n-2:0),o=2;o"),E.push.apply(E,r),E.push(")"),v(n)&&("number"==typeof n?E.push("{"+n+"}"):!0===n&&E.push("+")),(v(t)||v(o))&&E.push("{"+(t||"")+","+(o||"")+"}"),a&&E.push("?"),E}function $(e,r){for(var n=[],t=0,o=r=X("RegexGroup",r);t"); 80 | } 81 | result.push.apply(result, children); 82 | result.push(")"); 83 | if (isDefined(repeat)) { 84 | if (typeof repeat === "number") { 85 | result.push("{" + repeat + "}"); 86 | } else if (repeat === true) { 87 | result.push("+"); 88 | } 89 | } 90 | if (isDefined(repeatMin) || isDefined(repeatMax)) { 91 | result.push("{" + (repeatMin || "") + "," + (repeatMax || "") + "}"); 92 | } 93 | if (optional) { 94 | result.push("?"); 95 | } 96 | return result; 97 | } 98 | export function RegexUnion(props, children) { 99 | children = validateAndEscapeChildren("RegexGroup", children); 100 | var result = []; 101 | for (var _i4 = 0, _children4 = children; _i4 < _children4.length; _i4++) { 102 | var child = _children4[_i4]; 103 | result.push(child); 104 | result.push("|"); 105 | } 106 | result.pop(); 107 | return result; 108 | } -------------------------------------------------------------------------------- /dist/module/component/style.js: -------------------------------------------------------------------------------- 1 | import { Fragment, node } from "../node"; 2 | export function Style(_ref) { 3 | var css = _ref.css, 4 | nonce = _ref.nonce, 5 | children = _ref.children; 6 | return node(Fragment, null, node("style", { 7 | innerHTML: typeof css === "string" ? css : css._getCss(), 8 | nonce: nonce 9 | }), children); 10 | } -------------------------------------------------------------------------------- /dist/module/constants.js: -------------------------------------------------------------------------------- 1 | export var NODE_TYPE = { 2 | ELEMENT: "element", 3 | TEXT: "text", 4 | COMPONENT: "component", 5 | FRAGMENT: "fragment" 6 | }; -------------------------------------------------------------------------------- /dist/module/index.js: -------------------------------------------------------------------------------- 1 | export * from "./node"; 2 | export * from "./renderers"; 3 | export * from "./constants"; 4 | export * from "./component"; -------------------------------------------------------------------------------- /dist/module/node.js: -------------------------------------------------------------------------------- 1 | import { NODE_TYPE } from "./constants"; 2 | function _renderChildren(children, renderer) { 3 | var result = []; 4 | for (var _i2 = 0; _i2 < children.length; _i2++) { 5 | var child = children[_i2]; 6 | var renderedChild = child.render(renderer); 7 | if (!renderedChild) { 8 | continue; 9 | } else if (Array.isArray(renderedChild)) { 10 | for (var _i4 = 0; _i4 < renderedChild.length; _i4++) { 11 | var subchild = renderedChild[_i4]; 12 | if (subchild) { 13 | result.push(subchild); 14 | } 15 | } 16 | } else { 17 | result.push(renderedChild); 18 | } 19 | } 20 | return result; 21 | } 22 | export var ElementNode = function () { 23 | function ElementNode(name, props, children) { 24 | this.type = NODE_TYPE.ELEMENT; 25 | this.name = void 0; 26 | this.props = void 0; 27 | this.children = void 0; 28 | this.onRender = void 0; 29 | this.name = name; 30 | this.props = props || {}; 31 | this.children = children; 32 | var onRender = this.props.onRender; 33 | if (typeof onRender === "function") { 34 | this.onRender = onRender; 35 | delete props.onRender; 36 | } 37 | } 38 | var _proto = ElementNode.prototype; 39 | _proto.render = function render(renderer) { 40 | var el = renderer(this); 41 | if (this.onRender) { 42 | this.onRender(el); 43 | } 44 | return el; 45 | }; 46 | _proto.renderChildren = function renderChildren(renderer) { 47 | return _renderChildren(this.children, renderer); 48 | }; 49 | return ElementNode; 50 | }(); 51 | export var FragmentNode = function () { 52 | function FragmentNode(children) { 53 | this.type = NODE_TYPE.FRAGMENT; 54 | this.children = void 0; 55 | this.children = children; 56 | } 57 | var _proto2 = FragmentNode.prototype; 58 | _proto2.render = function render(renderer) { 59 | return _renderChildren(this.children, renderer); 60 | }; 61 | return FragmentNode; 62 | }(); 63 | export var TextNode = function () { 64 | function TextNode(text) { 65 | this.type = NODE_TYPE.TEXT; 66 | this.text = void 0; 67 | this.text = text; 68 | } 69 | var _proto3 = TextNode.prototype; 70 | _proto3.render = function render(renderer) { 71 | return renderer(this); 72 | }; 73 | return TextNode; 74 | }(); 75 | export var ComponentNode = function () { 76 | function ComponentNode(component, props, children) { 77 | this.type = NODE_TYPE.COMPONENT; 78 | this.component = void 0; 79 | this.props = void 0; 80 | this.children = void 0; 81 | this.component = component; 82 | this.props = props || {}; 83 | this.children = children; 84 | this.props.children = children; 85 | } 86 | var _proto4 = ComponentNode.prototype; 87 | _proto4.renderComponent = function renderComponent(renderer) { 88 | var child = normalizeChild(this.component(this.props, this.children)); 89 | if (child) { 90 | return child.render(renderer); 91 | } 92 | }; 93 | _proto4.render = function render(renderer) { 94 | return renderer(this); 95 | }; 96 | _proto4.renderChildren = function renderChildren(renderer) { 97 | return _renderChildren(this.children, renderer); 98 | }; 99 | return ComponentNode; 100 | }(); 101 | function normalizeChildren(children) { 102 | var result = []; 103 | for (var _i6 = 0; _i6 < children.length; _i6++) { 104 | var child = children[_i6]; 105 | if (!child) { 106 | continue; 107 | } else if (typeof child === "string" || typeof child === "number") { 108 | result.push(new TextNode(child.toString())); 109 | } else if (typeof child === "boolean") { 110 | continue; 111 | } else if (Array.isArray(child)) { 112 | for (var _i8 = 0, _normalizeChildren2 = normalizeChildren(child); _i8 < _normalizeChildren2.length; _i8++) { 113 | var subchild = _normalizeChildren2[_i8]; 114 | result.push(subchild); 115 | } 116 | } else if (child && (child.type === NODE_TYPE.ELEMENT || child.type === NODE_TYPE.TEXT || child.type === NODE_TYPE.COMPONENT)) { 117 | result.push(child); 118 | } else { 119 | throw new TypeError("Unrecognized node type: " + typeof child); 120 | } 121 | } 122 | return result; 123 | } 124 | function normalizeChild(child) { 125 | var children = normalizeChildren(Array.isArray(child) ? child : [child]); 126 | if (children.length === 1) { 127 | return children[0]; 128 | } else if (children.length > 1) { 129 | return new FragmentNode(children); 130 | } 131 | } 132 | export var node = function node(element, props) { 133 | for (var _len = arguments.length, children = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { 134 | children[_key - 2] = arguments[_key]; 135 | } 136 | children = normalizeChildren(children); 137 | if (typeof element === "string") { 138 | return new ElementNode(element, props, children); 139 | } 140 | if (typeof element === "function") { 141 | return new ComponentNode(element, props, children); 142 | } 143 | throw new TypeError("Expected jsx element to be a string or a function"); 144 | }; 145 | export var Fragment = function Fragment(props, children) { 146 | return children; 147 | }; -------------------------------------------------------------------------------- /dist/module/renderers/dom.js: -------------------------------------------------------------------------------- 1 | var _ELEMENT_DEFAULT_XML_, _ATTRIBUTE_DEFAULT_XM, _ADD_CHILDREN; 2 | import { ComponentNode, TextNode, ElementNode } from "../node"; 3 | import { NODE_TYPE } from "../constants"; 4 | import { uniqueID } from "../util"; 5 | var ELEMENT_TAG = { 6 | HTML: "html", 7 | IFRAME: "iframe", 8 | SCRIPT: "script", 9 | SVG: "svg", 10 | DEFAULT: "default" 11 | }; 12 | var ELEMENT_PROP = { 13 | ID: "id", 14 | INNER_HTML: "innerHTML", 15 | EL: "el", 16 | XLINK_HREF: "xlink:href" 17 | }; 18 | var ELEMENT_DEFAULT_XML_NAMESPACE = (_ELEMENT_DEFAULT_XML_ = {}, _ELEMENT_DEFAULT_XML_[ELEMENT_TAG.SVG] = "http://www.w3.org/2000/svg", _ELEMENT_DEFAULT_XML_); 19 | var ATTRIBUTE_DEFAULT_XML_NAMESPACE = (_ATTRIBUTE_DEFAULT_XM = {}, _ATTRIBUTE_DEFAULT_XM[ELEMENT_PROP.XLINK_HREF] = "http://www.w3.org/1999/xlink", _ATTRIBUTE_DEFAULT_XM); 20 | function fixScripts(el, doc) { 21 | if (doc === void 0) { 22 | doc = window.document; 23 | } 24 | for (var _i2 = 0, _el$querySelectorAll2 = el.querySelectorAll("script"); _i2 < _el$querySelectorAll2.length; _i2++) { 25 | var script = _el$querySelectorAll2[_i2]; 26 | var parentNode = script.parentNode; 27 | if (!parentNode) { 28 | continue; 29 | } 30 | var newScript = doc.createElement("script"); 31 | newScript.text = script.textContent; 32 | parentNode.replaceChild(newScript, script); 33 | } 34 | } 35 | function createElement(doc, node) { 36 | if (node.props[ELEMENT_PROP.EL]) { 37 | return node.props[ELEMENT_PROP.EL]; 38 | } else { 39 | return doc.createElement(node.name); 40 | } 41 | } 42 | function createElementWithXMLNamespace(doc, node, xmlNamespace) { 43 | return doc.createElementNS(xmlNamespace, node.name); 44 | } 45 | function createTextElement(doc, node) { 46 | return doc.createTextNode(node.text); 47 | } 48 | function addProps(el, node) { 49 | var props = node.props; 50 | for (var _i4 = 0, _Object$keys2 = Object.keys(props); _i4 < _Object$keys2.length; _i4++) { 51 | var prop = _Object$keys2[_i4]; 52 | var val = props[prop]; 53 | if (val === null || typeof val === "undefined" || prop === ELEMENT_PROP.EL || prop === ELEMENT_PROP.INNER_HTML) { 54 | continue; 55 | } 56 | if (prop.match(/^on[A-Z][a-z]/) && typeof val === "function") { 57 | el.addEventListener(prop.slice(2).toLowerCase(), val); 58 | } else if (typeof val === "string" || typeof val === "number") { 59 | var xmlNamespace = ATTRIBUTE_DEFAULT_XML_NAMESPACE[prop]; 60 | if (xmlNamespace) { 61 | el.setAttributeNS(xmlNamespace, prop, val.toString()); 62 | } else { 63 | el.setAttribute(prop, val.toString()); 64 | } 65 | } else if (typeof val === "boolean") { 66 | if (val === true) { 67 | el.setAttribute(prop, ""); 68 | } 69 | } 70 | } 71 | if (el.tagName.toLowerCase() === ELEMENT_TAG.IFRAME && !props.id) { 72 | el.setAttribute(ELEMENT_PROP.ID, "jsx-iframe-" + uniqueID()); 73 | } 74 | } 75 | var ADD_CHILDREN = (_ADD_CHILDREN = {}, _ADD_CHILDREN[ELEMENT_TAG.IFRAME] = function (el, node) { 76 | var firstChild = node.children[0]; 77 | if (node.children.length !== 1 || !(firstChild && firstChild.type === NODE_TYPE.ELEMENT) || firstChild.name !== ELEMENT_TAG.HTML) { 78 | throw new Error("Expected only single html element node as child of " + ELEMENT_TAG.IFRAME + " element"); 79 | } 80 | el.addEventListener("load", function () { 81 | var win = el.contentWindow; 82 | if (!win) { 83 | throw new Error("Expected frame to have contentWindow"); 84 | } 85 | var doc = win.document; 86 | var docElement = doc.documentElement; 87 | while (docElement.children && docElement.children.length) { 88 | docElement.removeChild(docElement.children[0]); 89 | } 90 | var child = firstChild.render(dom({ 91 | doc: doc 92 | })); 93 | while (child.children.length) { 94 | docElement.appendChild(child.children[0]); 95 | } 96 | }); 97 | }, _ADD_CHILDREN[ELEMENT_TAG.SCRIPT] = function (el, node) { 98 | var firstChild = node.children[0]; 99 | if (node.children.length !== 1 || !(firstChild && firstChild.type === NODE_TYPE.TEXT)) { 100 | throw new Error("Expected only single text node as child of " + ELEMENT_TAG.SCRIPT + " element"); 101 | } 102 | el.text = firstChild.text; 103 | }, _ADD_CHILDREN[ELEMENT_TAG.DEFAULT] = function (el, node, renderer) { 104 | for (var _i6 = 0, _node$renderChildren2 = node.renderChildren(renderer); _i6 < _node$renderChildren2.length; _i6++) { 105 | var child = _node$renderChildren2[_i6]; 106 | el.appendChild(child); 107 | } 108 | }, _ADD_CHILDREN); 109 | function addChildren(el, node, doc, renderer) { 110 | if (node.props.hasOwnProperty(ELEMENT_PROP.INNER_HTML)) { 111 | if (node.children.length) { 112 | throw new Error("Expected no children to be passed when " + ELEMENT_PROP.INNER_HTML + " prop is set"); 113 | } 114 | var html = node.props[ELEMENT_PROP.INNER_HTML]; 115 | if (typeof html !== "string") { 116 | throw new TypeError(ELEMENT_PROP.INNER_HTML + " prop must be string"); 117 | } 118 | if (node.name === ELEMENT_TAG.SCRIPT) { 119 | el.text = html; 120 | } else { 121 | el.innerHTML = html; 122 | fixScripts(el, doc); 123 | } 124 | } else { 125 | var addChildrenToElement = ADD_CHILDREN[node.name] || ADD_CHILDREN[ELEMENT_TAG.DEFAULT]; 126 | addChildrenToElement(el, node, renderer); 127 | } 128 | } 129 | var getDefaultDomOptions = function getDefaultDomOptions() { 130 | return {}; 131 | }; 132 | export function dom(opts) { 133 | if (opts === void 0) { 134 | opts = getDefaultDomOptions(); 135 | } 136 | var _opts = opts, 137 | _opts$doc = _opts.doc, 138 | doc = _opts$doc === void 0 ? document : _opts$doc; 139 | var _xmlNamespaceDomRenderer = function xmlNamespaceDomRenderer(node, xmlNamespace) { 140 | if (node.type === NODE_TYPE.COMPONENT) { 141 | return node.renderComponent(function (childNode) { 142 | return _xmlNamespaceDomRenderer(childNode, xmlNamespace); 143 | }); 144 | } 145 | if (node.type === NODE_TYPE.TEXT) { 146 | return createTextElement(doc, node); 147 | } 148 | if (node.type === NODE_TYPE.ELEMENT) { 149 | var el = createElementWithXMLNamespace(doc, node, xmlNamespace); 150 | addProps(el, node); 151 | addChildren(el, node, doc, function (childNode) { 152 | return _xmlNamespaceDomRenderer(childNode, xmlNamespace); 153 | }); 154 | return el; 155 | } 156 | throw new TypeError("Unhandleable node"); 157 | }; 158 | var _domRenderer = function domRenderer(node) { 159 | if (node.type === NODE_TYPE.COMPONENT) { 160 | return node.renderComponent(_domRenderer); 161 | } 162 | if (node.type === NODE_TYPE.TEXT) { 163 | return createTextElement(doc, node); 164 | } 165 | if (node.type === NODE_TYPE.ELEMENT) { 166 | var xmlNamespace = ELEMENT_DEFAULT_XML_NAMESPACE[node.name.toLowerCase()]; 167 | if (xmlNamespace) { 168 | return _xmlNamespaceDomRenderer(node, xmlNamespace); 169 | } 170 | var el = createElement(doc, node); 171 | addProps(el, node); 172 | addChildren(el, node, doc, _domRenderer); 173 | return el; 174 | } 175 | throw new TypeError("Unhandleable node"); 176 | }; 177 | return _domRenderer; 178 | } -------------------------------------------------------------------------------- /dist/module/renderers/html.js: -------------------------------------------------------------------------------- 1 | import { ComponentNode, TextNode, ElementNode } from "../node"; 2 | import { NODE_TYPE } from "../constants"; 3 | var ELEMENT_PROP = { 4 | INNER_HTML: "innerHTML" 5 | }; 6 | var SELF_CLOSING_TAGS = { 7 | br: true 8 | }; 9 | function htmlEncode(text) { 10 | return text.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """).replace(/'/g, "'").replace(/\//g, "/"); 11 | } 12 | function propsToHTML(props) { 13 | var keys = Object.keys(props).filter(function (key) { 14 | var val = props[key]; 15 | if (key === ELEMENT_PROP.INNER_HTML) { 16 | return false; 17 | } 18 | if (typeof val === "string" || typeof val === "number" || val === true) { 19 | return true; 20 | } 21 | return false; 22 | }); 23 | if (!keys.length) { 24 | return ""; 25 | } 26 | var pairs = keys.map(function (key) { 27 | var val = props[key]; 28 | if (val === true) { 29 | return "" + htmlEncode(key); 30 | } 31 | if (typeof val !== "string" && typeof val !== "number") { 32 | throw new TypeError("Unexpected prop type: " + typeof val); 33 | } 34 | if (val === "") { 35 | return htmlEncode(key); 36 | } 37 | return htmlEncode(key) + "=\"" + htmlEncode(val.toString()) + "\""; 38 | }); 39 | return " " + pairs.join(" "); 40 | } 41 | export function html() { 42 | var _htmlRenderer = function htmlRenderer(node) { 43 | if (node.type === NODE_TYPE.COMPONENT) { 44 | return [].concat(node.renderComponent(_htmlRenderer)).join(""); 45 | } 46 | if (node.type === NODE_TYPE.ELEMENT) { 47 | var renderedProps = propsToHTML(node.props); 48 | if (SELF_CLOSING_TAGS[node.name]) { 49 | return "<" + node.name + renderedProps + " />"; 50 | } else { 51 | var renderedChildren = typeof node.props[ELEMENT_PROP.INNER_HTML] === "string" ? node.props[ELEMENT_PROP.INNER_HTML] : node.renderChildren(_htmlRenderer).join(""); 52 | return "<" + node.name + renderedProps + ">" + renderedChildren + ""; 53 | } 54 | } 55 | if (node.type === NODE_TYPE.TEXT) { 56 | return htmlEncode(node.text); 57 | } 58 | throw new TypeError("Unhandleable node: " + node.type); 59 | }; 60 | return _htmlRenderer; 61 | } -------------------------------------------------------------------------------- /dist/module/renderers/index.js: -------------------------------------------------------------------------------- 1 | export * from "./text"; 2 | export * from "./dom"; 3 | export * from "./react"; 4 | export * from "./html"; 5 | export * from "./preact"; 6 | export * from "./regex"; -------------------------------------------------------------------------------- /dist/module/renderers/preact.js: -------------------------------------------------------------------------------- 1 | import _extends from "@babel/runtime/helpers/esm/extends"; 2 | import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; 3 | var _excluded = ["innerHTML"]; 4 | import { ComponentNode, TextNode, ElementNode } from "../node"; 5 | import { NODE_TYPE } from "../constants"; 6 | function mapPreactProps(props) { 7 | var innerHTML = props.innerHTML, 8 | remainingProps = _objectWithoutPropertiesLoose(props, _excluded); 9 | var dangerouslySetInnerHTML = innerHTML ? { 10 | __html: innerHTML 11 | } : null; 12 | return _extends({ 13 | dangerouslySetInnerHTML: dangerouslySetInnerHTML 14 | }, remainingProps); 15 | } 16 | export function preact(_temp) { 17 | var _ref = _temp === void 0 ? {} : _temp, 18 | Preact = _ref.Preact; 19 | if (!Preact) { 20 | throw new Error("Must pass Preact library to react renderer"); 21 | } 22 | var _reactRenderer = function reactRenderer(node) { 23 | if (node.type === NODE_TYPE.COMPONENT) { 24 | return Preact.h.apply(Preact, [function () { 25 | return node.renderComponent(_reactRenderer) || null; 26 | }, node.props].concat(node.renderChildren(_reactRenderer))); 27 | } 28 | if (node.type === NODE_TYPE.ELEMENT) { 29 | return Preact.h.apply(Preact, [node.name, mapPreactProps(node.props)].concat(node.renderChildren(_reactRenderer))); 30 | } 31 | if (node.type === NODE_TYPE.TEXT) { 32 | return node.text; 33 | } 34 | throw new TypeError("Unhandleable node"); 35 | }; 36 | return _reactRenderer; 37 | } -------------------------------------------------------------------------------- /dist/module/renderers/react.js: -------------------------------------------------------------------------------- 1 | import _extends from "@babel/runtime/helpers/esm/extends"; 2 | import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; 3 | var _excluded = ["innerHTML", "class"]; 4 | import { ComponentNode, TextNode, ElementNode } from "../node"; 5 | import { NODE_TYPE } from "../constants"; 6 | function mapReactProps(props) { 7 | var innerHTML = props.innerHTML, 8 | className = props.class, 9 | remainingProps = _objectWithoutPropertiesLoose(props, _excluded); 10 | var dangerouslySetInnerHTML = innerHTML ? { 11 | __html: innerHTML 12 | } : null; 13 | return _extends({ 14 | dangerouslySetInnerHTML: dangerouslySetInnerHTML, 15 | className: className 16 | }, remainingProps); 17 | } 18 | export function react(_temp) { 19 | var _ref = _temp === void 0 ? {} : _temp, 20 | React = _ref.React; 21 | if (!React) { 22 | throw new Error("Must pass React library to react renderer"); 23 | } 24 | var _reactRenderer = function reactRenderer(node) { 25 | if (node.type === NODE_TYPE.COMPONENT) { 26 | return React.createElement.apply(React, [function () { 27 | return node.renderComponent(_reactRenderer) || null; 28 | }, node.props].concat(node.renderChildren(_reactRenderer))); 29 | } 30 | if (node.type === NODE_TYPE.ELEMENT) { 31 | return React.createElement.apply(React, [node.name, mapReactProps(node.props)].concat(node.renderChildren(_reactRenderer))); 32 | } 33 | if (node.type === NODE_TYPE.TEXT) { 34 | return node.text; 35 | } 36 | throw new TypeError("Unhandleable node"); 37 | }; 38 | return _reactRenderer; 39 | } -------------------------------------------------------------------------------- /dist/module/renderers/regex.js: -------------------------------------------------------------------------------- 1 | import { node, ComponentNode, TextNode, ElementNode } from "../node"; 2 | import { text } from "./text"; 3 | export function regex() { 4 | var regexRenderer = text(); 5 | return function (nodeInstance) { 6 | return new RegExp(regexRenderer(nodeInstance)); 7 | }; 8 | } 9 | regex.node = function (el, props) { 10 | for (var _len = arguments.length, children = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { 11 | children[_key - 2] = arguments[_key]; 12 | } 13 | var nodeInstance = node.apply(void 0, [el, props].concat(children)); 14 | if (el.renderer) { 15 | return nodeInstance.render(el.renderer()); 16 | } 17 | return nodeInstance; 18 | }; -------------------------------------------------------------------------------- /dist/module/renderers/text.js: -------------------------------------------------------------------------------- 1 | import { ComponentNode, TextNode, ElementNode } from "../node"; 2 | import { NODE_TYPE } from "../constants"; 3 | export function text() { 4 | var _textRenderer = function textRenderer(node) { 5 | if (node.type === NODE_TYPE.COMPONENT) { 6 | return [].concat(node.renderComponent(_textRenderer)).join(""); 7 | } 8 | if (node.type === NODE_TYPE.ELEMENT) { 9 | throw new Error("Text renderer does not support basic elements"); 10 | } 11 | if (node.type === NODE_TYPE.TEXT) { 12 | return node.text; 13 | } 14 | throw new TypeError("Unhandleable node: " + node.type); 15 | }; 16 | return _textRenderer; 17 | } -------------------------------------------------------------------------------- /dist/module/types.js: -------------------------------------------------------------------------------- 1 | export var TYPES = true; -------------------------------------------------------------------------------- /dist/module/util.js: -------------------------------------------------------------------------------- 1 | var ALPHA_CHARS = "0123456789abcdef"; 2 | export function uniqueID() { 3 | return "xxxxxxxxxx".replace(/./g, function () { 4 | return ALPHA_CHARS.charAt(Math.floor(Math.random() * ALPHA_CHARS.length)); 5 | }); 6 | } 7 | export function isDefined(val) { 8 | return val !== null && typeof val !== "undefined"; 9 | } -------------------------------------------------------------------------------- /flow-typed/npm/@commitlint/cli_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: ee51b512fb7939980610e35462569242 2 | // flow-typed version: <>/@commitlint/cli_v^16.2.1/flow_v0.135.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * '@commitlint/cli' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module '@commitlint/cli' { 17 | declare module.exports: any; 18 | } 19 | -------------------------------------------------------------------------------- /flow-typed/npm/@commitlint/config-conventional_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 57351b40a8359ae26879210465f6b9da 2 | // flow-typed version: <>/@commitlint/config-conventional_v^16.2.1/flow_v0.135.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * '@commitlint/config-conventional' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module '@commitlint/config-conventional' { 17 | declare module.exports: any; 18 | } 19 | -------------------------------------------------------------------------------- /flow-typed/npm/@krakenjs/grumbler-scripts_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: f9d31b01ab7e20cccd0c7e6bc7415dc7 2 | // flow-typed version: <>/@krakenjs/grumbler-scripts_v^8.0.4/flow_v0.135.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * '@krakenjs/grumbler-scripts' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module '@krakenjs/grumbler-scripts' { 17 | declare module.exports: any; 18 | } 19 | -------------------------------------------------------------------------------- /flow-typed/npm/@octokit/rest_v18.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 6103021a6389a42ea8b41c577b3f91b3 2 | // flow-typed version: 79dc43986b/@octokit/rest_v18.x.x/flow_>=v0.83.x 3 | 4 | declare module '@octokit/rest' { 5 | /** 6 | * Octokit-specific request options which are ignored for the actual request, but can be used by Octokit or plugins to manipulate how the request is sent or how a response is handled 7 | */ 8 | declare type RequestRequestOptions = {| 9 | /** 10 | * Node only. Useful for custom proxy, certificate, or dns lookup. 11 | * 12 | * @see https://nodejs.org/api/http.html#http_class_http_agent 13 | */ 14 | agent?: mixed, 15 | /** 16 | * Custom replacement for built-in fetch method. Useful for testing or request hooks. 17 | */ 18 | fetch?: any, 19 | /** 20 | * Use an `AbortController` instance to cancel a request. In node you can only cancel streamed requests. 21 | */ 22 | signal?: any, 23 | /** 24 | * Node only. Request/response timeout in ms, it resets on redirect. 0 to disable (OS limit applies). `options.request.signal` is recommended instead. 25 | */ 26 | timeout?: number, 27 | [option: string]: any, 28 | |}; 29 | 30 | declare class Octokit { 31 | constructor(options?: {| 32 | authStrategy?: any, 33 | auth?: any, 34 | userAgent?: string, 35 | previews?: Array, 36 | baseUrl?: string, 37 | log?: {| 38 | debug?: (message: string) => mixed; 39 | info?: (message: string) => mixed; 40 | warn?: (message: string) => mixed; 41 | error?: (message: string) => mixed; 42 | |}, 43 | request?: RequestRequestOptions, 44 | timeZone?: string, 45 | [option: string]: any, 46 | |}): this; 47 | 48 | static VERSION: string; 49 | 50 | actions: {| [key: string]: any |}, 51 | activity: {| [key: string]: any |}, 52 | apps: {| [key: string]: any |}, 53 | auth: (...args: Array) => Promise<{| [key: string]: any |}>, 54 | billing: {| [key: string]: any |}, 55 | checks: {| [key: string]: any |}, 56 | codeScanning: {| [key: string]: any |}, 57 | codesOfConduct: {| [key: string]: any |}, 58 | emojis: {| [key: string]: any |}, 59 | enterpriseAdmin: {| [key: string]: any |}, 60 | gists: {| [key: string]: any |}, 61 | git: {| [key: string]: any |}, 62 | gitignore: {| [key: string]: any |}, 63 | graphql: (...args: Array) => any, 64 | hook: (...args: Array) => any, 65 | interactions: {| [key: string]: any |}, 66 | issues: {| [key: string]: any |}, 67 | licenses: {| [key: string]: any |}, 68 | log:{| [key: string]: any |}, 69 | markdown: {| [key: string]: any |}, 70 | meta: {| [key: string]: any |}, 71 | migrations: {| [key: string]: any |}, 72 | orgs: {| [key: string]: any |}, 73 | packages: {| [key: string]: any |}, 74 | paginate: (...args: Array) => any, 75 | projects: {| [key: string]: any |}, 76 | pulls: {| [key: string]: any |}, 77 | rateLimit: {| [key: string]: any |}, 78 | reactions: {| [key: string]: any |}, 79 | repos: { 80 | getContent: ({| 81 | owner: string, 82 | repo: string, 83 | path?: string, 84 | ref?: string, 85 | |}) => Promise<{| 86 | headers: {| [key: string]: any |}, 87 | status: number, 88 | url: string, 89 | data: Array<{| 90 | download_url: any, 91 | git_url: string, 92 | html_url: string, 93 | name: string, 94 | path: string, 95 | sha: string, 96 | size: number, 97 | type: string, 98 | url: string, 99 | _links: {| 100 | git: string, 101 | html: string, 102 | self: string, 103 | |} 104 | |}>, 105 | |}>, 106 | /** 107 | * This returns a list of releases, which does not include regular Git tags that have not been associated with a release. To get a list of Git tags, use the Repository Tags API. 108 | * 109 | * Information about published releases are available to everyone. Only users with push access will receive listings for draft releases. 110 | */ 111 | listReleases: ({| 112 | /** 113 | * The account owner of the repository. The name is not case sensitive. 114 | */ 115 | owner: string, 116 | /** 117 | * The name of the repository. The name is not case sensitive. 118 | */ 119 | repo: string, 120 | /** 121 | * The number of results per page (max 100). 122 | */ 123 | page?: number, 124 | /** 125 | * Page number of the results to fetch. 126 | */ 127 | per_page?: number, 128 | |}) => Promise<{| 129 | headers: {| [key: string]: any |}, 130 | status: number, 131 | url: string, 132 | data: Array<{| 133 | url: string, 134 | assets_url: string, 135 | upload_url: string, 136 | html_url: string, 137 | id: number, 138 | author: {| 139 | login: string, 140 | id: number, 141 | node_id: string, 142 | avatar_url: string, 143 | gravatar_id: string, 144 | url: string, 145 | html_url: string, 146 | followers_url: string, 147 | following_url: string, 148 | gists_url: string, 149 | starred_url: string, 150 | subscriptions_url: string, 151 | organizations_url: string, 152 | repos_url: string, 153 | events_url: string, 154 | received_events_url: string, 155 | type: string, 156 | site_admin: boolean, 157 | |}, 158 | node_id: string, 159 | tag_name: string, 160 | target_commitish: string, 161 | name: any, 162 | draft: boolean, 163 | prerelease: boolean, 164 | created_at: string, 165 | published_at: string, 166 | assets: Array, 167 | tarball_url: string, 168 | zipball_url: string, 169 | body: string, 170 | |}>, 171 | |}>, 172 | [key: string]: any, 173 | }, 174 | request: (...args: Array) => any, 175 | rest: {| [key: string]: any |}, 176 | search: {| [key: string]: any |}, 177 | secretScanning: {| [key: string]: any |}, 178 | teams: {| [key: string]: any |}, 179 | users: {| [key: string]: any |}, 180 | } 181 | 182 | declare module.exports: {| 183 | Octokit: typeof Octokit, 184 | |}; 185 | } 186 | -------------------------------------------------------------------------------- /flow-typed/npm/colors_v1.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 6c56e55f6af24f47c33f50f10270785f 2 | // flow-typed version: 590676b089/colors_v1.x.x/flow_>=v0.104.x 3 | 4 | declare module "colors" { 5 | declare type Color = { 6 | (text: string): string, 7 | strip: Color, 8 | stripColors: Color, 9 | black: Color, 10 | red: Color, 11 | green: Color, 12 | yellow: Color, 13 | blue: Color, 14 | magenta: Color, 15 | cyan: Color, 16 | white: Color, 17 | gray: Color, 18 | grey: Color, 19 | bgBlack: Color, 20 | bgRed: Color, 21 | bgGreen: Color, 22 | bgYellow: Color, 23 | bgBlue: Color, 24 | bgMagenta: Color, 25 | bgCyan: Color, 26 | bgWhite: Color, 27 | reset: Color, 28 | bold: Color, 29 | dim: Color, 30 | italic: Color, 31 | underline: Color, 32 | inverse: Color, 33 | hidden: Color, 34 | strikethrough: Color, 35 | rainbow: Color, 36 | zebra: Color, 37 | america: Color, 38 | trap: Color, 39 | random: Color, 40 | zalgo: Color, 41 | ... 42 | }; 43 | 44 | declare module.exports: { 45 | enabled: boolean, 46 | themes: {...}, 47 | enable(): void, 48 | disable(): void, 49 | setTheme(theme: {...}): void, 50 | strip: Color, 51 | stripColors: Color, 52 | black: Color, 53 | red: Color, 54 | green: Color, 55 | yellow: Color, 56 | blue: Color, 57 | magenta: Color, 58 | cyan: Color, 59 | white: Color, 60 | gray: Color, 61 | grey: Color, 62 | bgBlack: Color, 63 | bgRed: Color, 64 | bgGreen: Color, 65 | bgYellow: Color, 66 | bgBlue: Color, 67 | bgMagenta: Color, 68 | bgCyan: Color, 69 | bgWhite: Color, 70 | reset: Color, 71 | bold: Color, 72 | dim: Color, 73 | italic: Color, 74 | underline: Color, 75 | inverse: Color, 76 | hidden: Color, 77 | strikethrough: Color, 78 | rainbow: Color, 79 | zebra: Color, 80 | america: Color, 81 | trap: Color, 82 | random: Color, 83 | zalgo: Color, 84 | ... 85 | }; 86 | } 87 | 88 | declare module "colors/safe" { 89 | declare module.exports: $Exports<"colors">; 90 | } 91 | -------------------------------------------------------------------------------- /flow-typed/npm/cross-env_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 039eb7682e6f1879e2844cf344350b5c 2 | // flow-typed version: <>/cross-env_v^7.0.3/flow_v0.135.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'cross-env' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'cross-env' { 17 | declare module.exports: any; 18 | } 19 | -------------------------------------------------------------------------------- /flow-typed/npm/flow-bin_v0.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 28fdff7f110e1c75efab63ff205dda30 2 | // flow-typed version: c6154227d1/flow-bin_v0.x.x/flow_>=v0.104.x 3 | 4 | declare module "flow-bin" { 5 | declare module.exports: string; 6 | } 7 | -------------------------------------------------------------------------------- /flow-typed/npm/glob_v7.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: d2a519d7d007e9ba3e5bf2ac3ff76eca 2 | // flow-typed version: f243e51ed7/glob_v7.x.x/flow_>=v0.104.x 3 | 4 | declare module "glob" { 5 | declare type MinimatchOptions = {| 6 | debug?: boolean, 7 | nobrace?: boolean, 8 | noglobstar?: boolean, 9 | dot?: boolean, 10 | noext?: boolean, 11 | nocase?: boolean, 12 | nonull?: boolean, 13 | matchBase?: boolean, 14 | nocomment?: boolean, 15 | nonegate?: boolean, 16 | flipNegate?: boolean 17 | |}; 18 | 19 | declare type Options = {| 20 | ...MinimatchOptions, 21 | cwd?: string, 22 | root?: string, 23 | nomount?: boolean, 24 | mark?: boolean, 25 | nosort?: boolean, 26 | stat?: boolean, 27 | silent?: boolean, 28 | strict?: boolean, 29 | cache?: { [path: string]: boolean | "DIR" | "FILE" | $ReadOnlyArray, ... }, 30 | statCache?: { [path: string]: boolean | { isDirectory(): boolean, ... } | void, ... }, 31 | symlinks?: { [path: string]: boolean | void, ... }, 32 | realpathCache?: { [path: string]: string, ... }, 33 | sync?: boolean, 34 | nounique?: boolean, 35 | nodir?: boolean, 36 | ignore?: string | $ReadOnlyArray, 37 | follow?: boolean, 38 | realpath?: boolean, 39 | absolute?: boolean 40 | |}; 41 | 42 | /** 43 | * Called when an error occurs, or matches are found 44 | * err 45 | * matches: filenames found matching the pattern 46 | */ 47 | declare type CallBack = (err: ?Error, matches: Array) => void; 48 | 49 | declare class Glob extends events$EventEmitter { 50 | constructor(pattern: string): this; 51 | constructor(pattern: string, callback: CallBack): this; 52 | constructor(pattern: string, options: Options, callback: CallBack): this; 53 | 54 | minimatch: {...}; 55 | options: Options; 56 | aborted: boolean; 57 | cache: { [path: string]: boolean | "DIR" | "FILE" | $ReadOnlyArray, ... }; 58 | statCache: { [path: string]: boolean | { isDirectory(): boolean, ... } | void, ... }; 59 | symlinks: { [path: string]: boolean | void, ... }; 60 | realpathCache: { [path: string]: string, ... }; 61 | found: Array; 62 | 63 | pause(): void; 64 | resume(): void; 65 | abort(): void; 66 | } 67 | 68 | declare class GlobModule { 69 | Glob: Class; 70 | 71 | (pattern: string, callback: CallBack): void; 72 | (pattern: string, options: Options, callback: CallBack): void; 73 | 74 | hasMagic(pattern: string, options?: Options): boolean; 75 | sync(pattern: string, options?: Options): Array; 76 | } 77 | 78 | declare module.exports: GlobModule; 79 | } 80 | -------------------------------------------------------------------------------- /flow-typed/npm/husky_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 3f15389d4b64e16afbe5b322b0784ed7 2 | // flow-typed version: <>/husky_v^7.0.4/flow_v0.135.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'husky' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'husky' { 17 | declare module.exports: any; 18 | } 19 | -------------------------------------------------------------------------------- /flow-typed/npm/lint-staged_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 02e00596c36db1fd06eadf41e71f9865 2 | // flow-typed version: <>/lint-staged_v^12.4.0/flow_v0.135.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'lint-staged' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'lint-staged' { 17 | declare module.exports: any; 18 | } 19 | -------------------------------------------------------------------------------- /flow-typed/npm/md5_v2.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 198b480a6b35dbf3a74cb37d21258b00 2 | // flow-typed version: c6154227d1/md5_v2.x.x/flow_>=v0.104.x 3 | 4 | // @flow 5 | 6 | declare module "md5" { 7 | declare module.exports: ( 8 | message: string | Buffer, 9 | options?: { 10 | asString?: boolean, 11 | asBytes?: boolean, 12 | encoding?: string, 13 | ... 14 | } 15 | ) => string; 16 | } 17 | -------------------------------------------------------------------------------- /flow-typed/npm/mkdirp_v1.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 28ddcca31abd597a77830710de25f5fe 2 | // flow-typed version: a75473352d/mkdirp_v1.x.x/flow_>=v0.83.x 3 | 4 | declare module 'mkdirp' { 5 | import typeof { mkdir, stat } from 'fs'; 6 | 7 | declare type FsImplementation = { 8 | +mkdir?: mkdir, 9 | +stat?: stat, 10 | ... 11 | }; 12 | 13 | declare type Options = number | string | {| mode?: number; fs?: FsImplementation |}; 14 | 15 | declare type Callback = (err: ?Error, path: ?string) => void; 16 | 17 | declare module.exports: {| 18 | (path: string, options?: Options | Callback): Promise; 19 | sync(path: string, options?: Options): string | void; 20 | manual(path: string, options?: Options | Callback): Promise; 21 | manualSync(path: string, options?: Options): string | void; 22 | native(path: string, options?: Options | Callback): Promise; 23 | nativeSync(path: string, options?: Options): string | void; 24 | |}; 25 | } 26 | -------------------------------------------------------------------------------- /flow-typed/npm/mocha_v4.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 8b533a1271b4580048529f45ac3a3c68 2 | // flow-typed version: ba7bfb2fda/mocha_v4.x.x/flow_>=v0.104.x 3 | 4 | declare interface $npm$mocha$SetupOptions { 5 | slow?: number; 6 | timeout?: number; 7 | ui?: string; 8 | globals?: Array; 9 | reporter?: any; 10 | bail?: boolean; 11 | ignoreLeaks?: boolean; 12 | grep?: any; 13 | } 14 | 15 | declare type $npm$mocha$done = (error?: any) => any; 16 | 17 | // declare interface $npm$mocha$SuiteCallbackContext { 18 | // timeout(ms: number): void; 19 | // retries(n: number): void; 20 | // slow(ms: number): void; 21 | // } 22 | 23 | // declare interface $npm$mocha$TestCallbackContext { 24 | // skip(): void; 25 | // timeout(ms: number): void; 26 | // retries(n: number): void; 27 | // slow(ms: number): void; 28 | // [index: string]: any; 29 | // } 30 | 31 | declare interface $npm$mocha$Suite { 32 | parent: $npm$mocha$Suite; 33 | title: string; 34 | fullTitle(): string; 35 | } 36 | 37 | declare type $npm$mocha$ContextDefinition = {| 38 | (description: string, callback: (/* this: $npm$mocha$SuiteCallbackContext */) => void): $npm$mocha$Suite; 39 | only(description: string, callback: (/* this: $npm$mocha$SuiteCallbackContext */) => void): $npm$mocha$Suite; 40 | skip(description: string, callback: (/* this: $npm$mocha$SuiteCallbackContext */) => void): void; 41 | timeout(ms: number): void; 42 | |} 43 | 44 | declare type $npm$mocha$TestDefinition = {| 45 | (expectation: string, callback?: (/* this: $npm$mocha$TestCallbackContext, */ done: $npm$mocha$done) => mixed): $npm$mocha$Test; 46 | only(expectation: string, callback?: (/* this: $npm$mocha$TestCallbackContext, */ done: $npm$mocha$done) => mixed): $npm$mocha$Test; 47 | skip(expectation: string, callback?: (/* this: $npm$mocha$TestCallbackContext, */ done: $npm$mocha$done) => mixed): void; 48 | timeout(ms: number): void; 49 | state: 'failed' | 'passed'; 50 | |} 51 | 52 | declare interface $npm$mocha$Runner {} 53 | 54 | declare class $npm$mocha$BaseReporter { 55 | stats: { 56 | suites: number, 57 | tests: number, 58 | passes: number, 59 | pending: number, 60 | failures: number, 61 | ... 62 | }; 63 | 64 | constructor(runner: $npm$mocha$Runner): $npm$mocha$BaseReporter; 65 | } 66 | 67 | declare class $npm$mocha$DocReporter extends $npm$mocha$BaseReporter {} 68 | declare class $npm$mocha$DotReporter extends $npm$mocha$BaseReporter {} 69 | declare class $npm$mocha$HTMLReporter extends $npm$mocha$BaseReporter {} 70 | declare class $npm$mocha$HTMLCovReporter extends $npm$mocha$BaseReporter {} 71 | declare class $npm$mocha$JSONReporter extends $npm$mocha$BaseReporter {} 72 | declare class $npm$mocha$JSONCovReporter extends $npm$mocha$BaseReporter {} 73 | declare class $npm$mocha$JSONStreamReporter extends $npm$mocha$BaseReporter {} 74 | declare class $npm$mocha$LandingReporter extends $npm$mocha$BaseReporter {} 75 | declare class $npm$mocha$ListReporter extends $npm$mocha$BaseReporter {} 76 | declare class $npm$mocha$MarkdownReporter extends $npm$mocha$BaseReporter {} 77 | declare class $npm$mocha$MinReporter extends $npm$mocha$BaseReporter {} 78 | declare class $npm$mocha$NyanReporter extends $npm$mocha$BaseReporter {} 79 | declare class $npm$mocha$ProgressReporter extends $npm$mocha$BaseReporter { 80 | constructor(runner: $npm$mocha$Runner, options?: { 81 | open?: string, 82 | complete?: string, 83 | incomplete?: string, 84 | close?: string, 85 | ... 86 | }): $npm$mocha$ProgressReporter; 87 | } 88 | declare class $npm$mocha$SpecReporter extends $npm$mocha$BaseReporter {} 89 | declare class $npm$mocha$TAPReporter extends $npm$mocha$BaseReporter {} 90 | declare class $npm$mocha$XUnitReporter extends $npm$mocha$BaseReporter { 91 | constructor(runner: $npm$mocha$Runner, options?: any): $npm$mocha$XUnitReporter; 92 | } 93 | 94 | declare class $npm$mocha$Mocha { 95 | currentTest: $npm$mocha$TestDefinition; 96 | constructor(options?: { 97 | grep?: RegExp, 98 | ui?: string, 99 | reporter?: string, 100 | timeout?: number, 101 | reporterOptions?: any, 102 | slow?: number, 103 | bail?: boolean, 104 | ... 105 | }): $npm$mocha$Mocha; 106 | setup(options: $npm$mocha$SetupOptions): this; 107 | bail(value?: boolean): this; 108 | addFile(file: string): this; 109 | reporter(name: string): this; 110 | reporter(reporter: (runner: $npm$mocha$Runner, options: any) => any): this; 111 | ui(value: string): this; 112 | grep(value: string): this; 113 | grep(value: RegExp): this; 114 | invert(): this; 115 | ignoreLeaks(value: boolean): this; 116 | checkLeaks(): this; 117 | throwError(error: Error): void; 118 | growl(): this; 119 | globals(value: string): this; 120 | globals(values: Array): this; 121 | useColors(value: boolean): this; 122 | useInlineDiffs(value: boolean): this; 123 | timeout(value: number): this; 124 | slow(value: number): this; 125 | enableTimeouts(value: boolean): this; 126 | asyncOnly(value: boolean): this; 127 | noHighlighting(value: boolean): this; 128 | run(onComplete?: (failures: number) => void): $npm$mocha$Runner; 129 | 130 | static reporters: { 131 | Doc: $npm$mocha$DocReporter, 132 | Dot: $npm$mocha$DotReporter, 133 | HTML: $npm$mocha$HTMLReporter, 134 | HTMLCov: $npm$mocha$HTMLCovReporter, 135 | JSON: $npm$mocha$JSONReporter, 136 | JSONCov: $npm$mocha$JSONCovReporter, 137 | JSONStream: $npm$mocha$JSONStreamReporter, 138 | Landing: $npm$mocha$LandingReporter, 139 | List: $npm$mocha$ListReporter, 140 | Markdown: $npm$mocha$MarkdownReporter, 141 | Min: $npm$mocha$MinReporter, 142 | Nyan: $npm$mocha$NyanReporter, 143 | Progress: $npm$mocha$ProgressReporter, 144 | ... 145 | }; 146 | } 147 | 148 | // declare interface $npm$mocha$HookCallbackContext { 149 | // skip(): void; 150 | // timeout(ms: number): void; 151 | // [index: string]: any; 152 | // } 153 | 154 | declare interface $npm$mocha$Runnable { 155 | title: string; 156 | fn: Function; 157 | async: boolean; 158 | sync: boolean; 159 | timedOut: boolean; 160 | } 161 | 162 | declare interface $npm$mocha$Test extends $npm$mocha$Runnable { 163 | parent: $npm$mocha$Suite; 164 | pending: boolean; 165 | state: 'failed' | 'passed' | void; 166 | fullTitle(): string; 167 | } 168 | 169 | // declare interface $npm$mocha$BeforeAndAfterContext extends $npm$mocha$HookCallbackContext { 170 | // currentTest: $npm$mocha$Test; 171 | // } 172 | 173 | declare var mocha: $npm$mocha$Mocha; 174 | declare var describe: $npm$mocha$ContextDefinition; 175 | declare var xdescribe: $npm$mocha$ContextDefinition; 176 | declare var context: $npm$mocha$ContextDefinition; 177 | declare var suite: $npm$mocha$ContextDefinition; 178 | declare var it: $npm$mocha$TestDefinition; 179 | declare var xit: $npm$mocha$TestDefinition; 180 | declare var test: $npm$mocha$TestDefinition; 181 | declare var specify: $npm$mocha$TestDefinition; 182 | 183 | type Run = () => void; 184 | 185 | declare var run: Run; 186 | 187 | type Setup = (callback: (/* this: $npm$mocha$BeforeAndAfterContext, */ done: $npm$mocha$done) => mixed) => void; 188 | type Teardown = (callback: (/* this: $npm$mocha$BeforeAndAfterContext, */ done: $npm$mocha$done) => mixed) => void; 189 | type SuiteSetup = (callback: (/* this: $npm$mocha$HookCallbackContext, */ done: $npm$mocha$done) => mixed) => void; 190 | type SuiteTeardown = (callback: (/* this: $npm$mocha$HookCallbackContext, */ done: $npm$mocha$done) => mixed) => void; 191 | type Before = 192 | | (callback: (/* this: $npm$mocha$HookCallbackContext, */ done: $npm$mocha$done) => mixed) => void 193 | | (description: string, callback: (/* this: $npm$mocha$HookCallbackContext, */ done: $npm$mocha$done) => mixed) => void; 194 | type After = 195 | | (callback: (/* this: $npm$mocha$HookCallbackContext, */ done: $npm$mocha$done) => mixed) => void 196 | | (description: string, callback: (/* this: $npm$mocha$HookCallbackContext, */ done: $npm$mocha$done) => mixed) => void; 197 | type BeforeEach = 198 | | (callback: (/* this: $npm$mocha$BeforeAndAfterContext, */ done: $npm$mocha$done) => mixed) => void 199 | | (description: string, callback: (/* this: $npm$mocha$BeforeAndAfterContext, */ done: $npm$mocha$done) => mixed) => void; 200 | type AfterEach = 201 | | (callback: (/* this: $npm$mocha$BeforeAndAfterContext, */ done: $npm$mocha$done) => mixed) => void 202 | | (description: string, callback: (/* this: $npm$mocha$BeforeAndAfterContext, */ done: $npm$mocha$done) => mixed) => void; 203 | 204 | 205 | declare var setup: Setup; 206 | declare var teardown: Teardown; 207 | declare var suiteSetup: SuiteSetup; 208 | declare var suiteTeardown: SuiteTeardown; 209 | declare var before: Before 210 | declare var after: After; 211 | declare var beforeEach: BeforeEach; 212 | declare var afterEach: AfterEach; 213 | 214 | declare module "mocha" { 215 | declare export var mocha: $npm$mocha$TestDefinition; 216 | declare export var describe: $npm$mocha$ContextDefinition; 217 | declare export var xdescribe: $npm$mocha$ContextDefinition; 218 | declare export var context: $npm$mocha$ContextDefinition; 219 | declare export var suite: $npm$mocha$ContextDefinition; 220 | declare export var it: $npm$mocha$TestDefinition; 221 | declare export var xit: $npm$mocha$TestDefinition; 222 | declare export var test: $npm$mocha$TestDefinition; 223 | declare export var specify: $npm$mocha$TestDefinition; 224 | 225 | declare export var run: Run; 226 | 227 | declare export var setup: Setup; 228 | declare export var teardown: Teardown; 229 | declare export var suiteSetup: SuiteSetup; 230 | declare export var suiteTeardown: SuiteTeardown; 231 | declare export var before: Before; 232 | declare export var after: After; 233 | declare export var beforeEach: BeforeEach; 234 | declare export var afterEach: AfterEach; 235 | 236 | declare export default $npm$mocha$Mocha; 237 | } 238 | -------------------------------------------------------------------------------- /flow-typed/npm/node-stream-zip_v1.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: bd18604d0696d9e4ad0da443cf74273b 2 | // flow-typed version: 1ff21d416b/node-stream-zip_v1.x.x/flow_>=v0.104.x 3 | 4 | declare module 'node-stream-zip' { 5 | declare type StreamZipOptions = {| 6 | /** 7 | * File to read 8 | * @default undefined 9 | */ 10 | file?: string; 11 | 12 | /** 13 | * Alternatively, you can pass fd here 14 | * @default undefined 15 | */ 16 | fd?: number; 17 | 18 | /** 19 | * You will be able to work with entries inside zip archive, 20 | * otherwise the only way to access them is entry event 21 | * @default true 22 | */ 23 | storeEntries?: boolean; 24 | 25 | /** 26 | * By default, entry name is checked for malicious characters, like ../ or c:\123, 27 | * pass this flag to disable validation error 28 | * @default false 29 | */ 30 | skipEntryNameValidation?: boolean; 31 | 32 | /** 33 | * Filesystem read chunk size 34 | * @default automatic based on file size 35 | */ 36 | chunkSize?: number; 37 | 38 | /** 39 | * Encoding used to decode file names 40 | * @default UTF8 41 | */ 42 | nameEncoding?: string; 43 | |} 44 | 45 | declare type ZipEntry = {| 46 | /** 47 | * file name 48 | */ 49 | name: string; 50 | 51 | /** 52 | * true if it's a directory entry 53 | */ 54 | isDirectory: boolean; 55 | 56 | /** 57 | * true if it's a file entry, see also isDirectory 58 | */ 59 | isFile: boolean; 60 | 61 | /** 62 | * file comment 63 | */ 64 | comment: string; 65 | 66 | /** 67 | * if the file is encrypted 68 | */ 69 | encrypted: boolean; 70 | 71 | /** 72 | * version made by 73 | */ 74 | verMade: number; 75 | 76 | /** 77 | * version needed to extract 78 | */ 79 | version: number; 80 | 81 | /** 82 | * encrypt, decrypt flags 83 | */ 84 | flags: number; 85 | 86 | /** 87 | * compression method 88 | */ 89 | method: number; 90 | 91 | /** 92 | * modification time 93 | */ 94 | time: number; 95 | 96 | /** 97 | * uncompressed file crc-32 value 98 | */ 99 | crc: number; 100 | 101 | /** 102 | * compressed size 103 | */ 104 | compressedSize: number; 105 | 106 | /** 107 | * uncompressed size 108 | */ 109 | size: number; 110 | 111 | /** 112 | * volume number start 113 | */ 114 | diskStart: number; 115 | 116 | /** 117 | * internal file attributes 118 | */ 119 | inattr: number; 120 | 121 | /** 122 | * external file attributes 123 | */ 124 | attr: number; 125 | 126 | /** 127 | * LOC header offset 128 | */ 129 | offset: number; 130 | |} 131 | 132 | declare class StreamZipAsync { 133 | constructor(config: StreamZipOptions): this; 134 | 135 | entriesCount: Promise; 136 | comment: Promise; 137 | 138 | entry(name: string): Promise; 139 | entries(): Promise<{ [name: string]: ZipEntry }>; 140 | entryData(entry: string | ZipEntry): Promise; 141 | stream(entry: string | ZipEntry): Promise; 142 | extract(entry: string | ZipEntry | null, outPath: string): Promise; 143 | 144 | on(event: 'entry', handler: (entry: ZipEntry) => void): void; 145 | on(event: 'extract', handler: (entry: ZipEntry, outPath: string) => void): void; 146 | 147 | close(): Promise; 148 | } 149 | 150 | declare class StreamZip { 151 | constructor(config: StreamZipOptions): this; 152 | 153 | entriesCount: number; 154 | comment: string; 155 | 156 | on(event: 'error', handler: (error: any) => void): void; 157 | on(event: 'entry', handler: (entry: ZipEntry) => void): void; 158 | on(event: 'ready', handler: () => void): void; 159 | on(event: 'extract', handler: (entry: ZipEntry, outPath: string) => void): void; 160 | 161 | entry(name: string): ?ZipEntry; 162 | 163 | entries(): { [name: string]: ZipEntry }; 164 | 165 | stream( 166 | entry: string | ZipEntry, 167 | callback: (err: any | null, stream?: ReadableStream) => void 168 | ): void; 169 | 170 | entryDataSync(entry: string | ZipEntry): Buffer; 171 | 172 | openEntry( 173 | entry: string | ZipEntry, 174 | callback: (err: any | null, entry?: ZipEntry) => void, 175 | sync: boolean 176 | ): void; 177 | 178 | extract( 179 | entry: string | ZipEntry | null, 180 | outPath: string, 181 | callback: (err?: any, res?: number) => void 182 | ): void; 183 | 184 | close(callback?: (err?: any) => void): void; 185 | 186 | static async: Class; 187 | } 188 | 189 | declare module.exports: Class; 190 | } 191 | -------------------------------------------------------------------------------- /flow-typed/npm/prettier_v1.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: cfdc7e61e71ab8d32e882a236b798eaf 2 | // flow-typed version: 02d4f1d2c5/prettier_v1.x.x/flow_>=v0.104.x <=v0.200.x 3 | 4 | declare module "prettier" { 5 | declare export type AST = { [key: string]: any, ... }; 6 | declare export type Doc = { 7 | [key: string]: any, 8 | ... 9 | }; 10 | declare export type FastPath = { 11 | stack: any[], 12 | getName(): null | string | number | Symbol, 13 | getValue(): T, 14 | getNode(count?: number): null | T, 15 | getParentNode(count?: number): null | T, 16 | call(callback: (path: FastPath) => U, ...names: Array): U, 17 | each(callback: (path: FastPath) => void, ...names: Array): void, 18 | map(callback: (path: FastPath, index: number) => U, ...names: Array): U[], 19 | ... 20 | }; 21 | 22 | declare export type PrettierParserName = 23 | | "babylon" // deprecated 24 | | "babel" 25 | | "babel-flow" 26 | | "flow" 27 | | "typescript" 28 | | "postcss" // deprecated 29 | | "css" 30 | | "less" 31 | | "scss" 32 | | "json" 33 | | "json5" 34 | | "json-stringify" 35 | | "graphql" 36 | | "markdown" 37 | | "vue" 38 | | "html" 39 | | "angular" 40 | | "mdx" 41 | | "yaml"; 42 | 43 | declare export type PrettierParser = { 44 | [name: PrettierParserName]: (text: string, options?: { [key: string]: any, ... }) => AST, 45 | ... 46 | }; 47 | 48 | declare export type CustomParser = ( 49 | text: string, 50 | parsers: PrettierParser, 51 | options: Options 52 | ) => AST; 53 | 54 | declare export type Options = {| 55 | printWidth?: number, 56 | tabWidth?: number, 57 | useTabs?: boolean, 58 | semi?: boolean, 59 | singleQuote?: boolean, 60 | trailingComma?: "none" | "es5" | "all", 61 | bracketSpacing?: boolean, 62 | jsxBracketSameLine?: boolean, 63 | arrowParens?: "avoid" | "always", 64 | rangeStart?: number, 65 | rangeEnd?: number, 66 | parser?: PrettierParserName | CustomParser, 67 | filepath?: string, 68 | requirePragma?: boolean, 69 | insertPragma?: boolean, 70 | proseWrap?: "always" | "never" | "preserve", 71 | plugins?: Array 72 | |}; 73 | 74 | declare export type Plugin = { 75 | languages: SupportLanguage, 76 | parsers: { [parserName: string]: Parser, ... }, 77 | printers: { [astFormat: string]: Printer, ... }, 78 | options?: SupportOption[], 79 | ... 80 | }; 81 | 82 | declare export type Parser = { 83 | parse: ( 84 | text: string, 85 | parsers: { [parserName: string]: Parser, ... }, 86 | options: { [key: string]: any, ... } 87 | ) => AST, 88 | astFormat: string, 89 | hasPragma?: (text: string) => boolean, 90 | locStart: (node: any) => number, 91 | locEnd: (node: any) => number, 92 | preprocess?: (text: string, options: { [key: string]: any, ... }) => string, 93 | ... 94 | }; 95 | 96 | declare export type Printer = { 97 | print: ( 98 | path: FastPath<>, 99 | options: { [key: string]: any, ... }, 100 | print: (path: FastPath<>) => Doc 101 | ) => Doc, 102 | embed: ( 103 | path: FastPath<>, 104 | print: (path: FastPath<>) => Doc, 105 | textToDoc: (text: string, options: { [key: string]: any, ... }) => Doc, 106 | options: { [key: string]: any, ... } 107 | ) => ?Doc, 108 | insertPragma?: (text: string) => string, 109 | massageAstNode?: (node: any, newNode: any, parent: any) => any, 110 | hasPrettierIgnore?: (path: FastPath<>) => boolean, 111 | canAttachComment?: (node: any) => boolean, 112 | willPrintOwnComments?: (path: FastPath<>) => boolean, 113 | printComments?: (path: FastPath<>, print: (path: FastPath<>) => Doc, options: { [key: string]: any, ... }, needsSemi: boolean) => Doc, 114 | handleComments?: { 115 | ownLine?: (commentNode: any, text: string, options: { [key: string]: any, ... }, ast: any, isLastComment: boolean) => boolean, 116 | endOfLine?: (commentNode: any, text: string, options: { [key: string]: any, ... }, ast: any, isLastComment: boolean) => boolean, 117 | remaining?: (commentNode: any, text: string, options: { [key: string]: any, ... }, ast: any, isLastComment: boolean) => boolean, 118 | ... 119 | }, 120 | ... 121 | }; 122 | 123 | declare export type CursorOptions = {| 124 | cursorOffset: number, 125 | printWidth?: $PropertyType, 126 | tabWidth?: $PropertyType, 127 | useTabs?: $PropertyType, 128 | semi?: $PropertyType, 129 | singleQuote?: $PropertyType, 130 | trailingComma?: $PropertyType, 131 | bracketSpacing?: $PropertyType, 132 | jsxBracketSameLine?: $PropertyType, 133 | arrowParens?: $PropertyType, 134 | parser?: $PropertyType, 135 | filepath?: $PropertyType, 136 | requirePragma?: $PropertyType, 137 | insertPragma?: $PropertyType, 138 | proseWrap?: $PropertyType, 139 | plugins?: $PropertyType 140 | |}; 141 | 142 | declare export type CursorResult = {| 143 | formatted: string, 144 | cursorOffset: number 145 | |}; 146 | 147 | declare export type ResolveConfigOptions = {| 148 | useCache?: boolean, 149 | config?: string, 150 | editorconfig?: boolean 151 | |}; 152 | 153 | declare export type SupportLanguage = { 154 | name: string, 155 | since: string, 156 | parsers: Array, 157 | group?: string, 158 | tmScope: string, 159 | aceMode: string, 160 | codemirrorMode: string, 161 | codemirrorMimeType: string, 162 | aliases?: Array, 163 | extensions: Array, 164 | filenames?: Array, 165 | linguistLanguageId: number, 166 | vscodeLanguageIds: Array, 167 | ... 168 | }; 169 | 170 | declare export type SupportOption = {| 171 | since: string, 172 | type: "int" | "boolean" | "choice" | "path", 173 | deprecated?: string, 174 | redirect?: SupportOptionRedirect, 175 | description: string, 176 | oppositeDescription?: string, 177 | default: SupportOptionValue, 178 | range?: SupportOptionRange, 179 | choices?: SupportOptionChoice 180 | |}; 181 | 182 | declare export type SupportOptionRedirect = {| 183 | options: string, 184 | value: SupportOptionValue 185 | |}; 186 | 187 | declare export type SupportOptionRange = {| 188 | start: number, 189 | end: number, 190 | step: number 191 | |}; 192 | 193 | declare export type SupportOptionChoice = {| 194 | value: boolean | string, 195 | description?: string, 196 | since?: string, 197 | deprecated?: string, 198 | redirect?: SupportOptionValue 199 | |}; 200 | 201 | declare export type SupportOptionValue = number | boolean | string; 202 | 203 | declare export type SupportInfo = {| 204 | languages: Array, 205 | options: Array 206 | |}; 207 | 208 | declare export type FileInfo = {| 209 | ignored: boolean, 210 | inferredParser: PrettierParserName | null, 211 | |}; 212 | 213 | declare export type Prettier = {| 214 | format: (source: string, options?: Options) => string, 215 | check: (source: string, options?: Options) => boolean, 216 | formatWithCursor: (source: string, options: CursorOptions) => CursorResult, 217 | resolveConfig: { 218 | (filePath: string, options?: ResolveConfigOptions): Promise, 219 | sync(filePath: string, options?: ResolveConfigOptions): ?Options, 220 | ... 221 | }, 222 | clearConfigCache: () => void, 223 | getSupportInfo: (version?: string) => SupportInfo, 224 | getFileInfo: (filePath: string) => Promise 225 | |}; 226 | 227 | declare export default Prettier; 228 | } 229 | -------------------------------------------------------------------------------- /flow-typed/npm/prettier_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 93996c004bfe0cad85af74f873a8a9e2 2 | // flow-typed version: <>/prettier_v^2.6.2/flow_v0.135.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'prettier' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'prettier' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'prettier/bin-prettier' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'prettier/cli' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'prettier/doc' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'prettier/parser-angular' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'prettier/parser-babel' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'prettier/parser-espree' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'prettier/parser-flow' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'prettier/parser-glimmer' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'prettier/parser-graphql' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module 'prettier/parser-html' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module 'prettier/parser-markdown' { 66 | declare module.exports: any; 67 | } 68 | 69 | declare module 'prettier/parser-meriyah' { 70 | declare module.exports: any; 71 | } 72 | 73 | declare module 'prettier/parser-postcss' { 74 | declare module.exports: any; 75 | } 76 | 77 | declare module 'prettier/parser-typescript' { 78 | declare module.exports: any; 79 | } 80 | 81 | declare module 'prettier/parser-yaml' { 82 | declare module.exports: any; 83 | } 84 | 85 | declare module 'prettier/standalone' { 86 | declare module.exports: any; 87 | } 88 | 89 | declare module 'prettier/third-party' { 90 | declare module.exports: any; 91 | } 92 | 93 | // Filename aliases 94 | declare module 'prettier/bin-prettier.js' { 95 | declare module.exports: $Exports<'prettier/bin-prettier'>; 96 | } 97 | declare module 'prettier/cli.js' { 98 | declare module.exports: $Exports<'prettier/cli'>; 99 | } 100 | declare module 'prettier/doc.js' { 101 | declare module.exports: $Exports<'prettier/doc'>; 102 | } 103 | declare module 'prettier/index' { 104 | declare module.exports: $Exports<'prettier'>; 105 | } 106 | declare module 'prettier/index.js' { 107 | declare module.exports: $Exports<'prettier'>; 108 | } 109 | declare module 'prettier/parser-angular.js' { 110 | declare module.exports: $Exports<'prettier/parser-angular'>; 111 | } 112 | declare module 'prettier/parser-babel.js' { 113 | declare module.exports: $Exports<'prettier/parser-babel'>; 114 | } 115 | declare module 'prettier/parser-espree.js' { 116 | declare module.exports: $Exports<'prettier/parser-espree'>; 117 | } 118 | declare module 'prettier/parser-flow.js' { 119 | declare module.exports: $Exports<'prettier/parser-flow'>; 120 | } 121 | declare module 'prettier/parser-glimmer.js' { 122 | declare module.exports: $Exports<'prettier/parser-glimmer'>; 123 | } 124 | declare module 'prettier/parser-graphql.js' { 125 | declare module.exports: $Exports<'prettier/parser-graphql'>; 126 | } 127 | declare module 'prettier/parser-html.js' { 128 | declare module.exports: $Exports<'prettier/parser-html'>; 129 | } 130 | declare module 'prettier/parser-markdown.js' { 131 | declare module.exports: $Exports<'prettier/parser-markdown'>; 132 | } 133 | declare module 'prettier/parser-meriyah.js' { 134 | declare module.exports: $Exports<'prettier/parser-meriyah'>; 135 | } 136 | declare module 'prettier/parser-postcss.js' { 137 | declare module.exports: $Exports<'prettier/parser-postcss'>; 138 | } 139 | declare module 'prettier/parser-typescript.js' { 140 | declare module.exports: $Exports<'prettier/parser-typescript'>; 141 | } 142 | declare module 'prettier/parser-yaml.js' { 143 | declare module.exports: $Exports<'prettier/parser-yaml'>; 144 | } 145 | declare module 'prettier/standalone.js' { 146 | declare module.exports: $Exports<'prettier/standalone'>; 147 | } 148 | declare module 'prettier/third-party.js' { 149 | declare module.exports: $Exports<'prettier/third-party'>; 150 | } 151 | -------------------------------------------------------------------------------- /flow-typed/npm/rimraf_v3.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 31191d41b239d1242753bdea18136ae9 2 | // flow-typed version: 6ee04b16cf/rimraf_v3.x.x/flow_>=v0.104.x 3 | 4 | declare module 'rimraf' { 5 | declare type Options = { 6 | maxBusyTries?: number, 7 | emfileWait?: number, 8 | glob?: boolean, 9 | disableGlob?: boolean, 10 | ... 11 | }; 12 | 13 | declare type Callback = (err: ?Error, path: ?string) => void; 14 | 15 | declare module.exports: { 16 | (f: string, opts?: Options | Callback, callback?: Callback): void, 17 | sync(path: string, opts?: Options): void, 18 | ... 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /flow-typed/npm/semver_v7.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: bf6205896c200fb28700dfa8d29f2b8a 2 | // flow-typed version: 3d76504c27/semver_v7.x.x/flow_>=v0.104.x 3 | 4 | declare module "semver" { 5 | declare type Release = 6 | | "major" 7 | | "premajor" 8 | | "minor" 9 | | "preminor" 10 | | "patch" 11 | | "prepatch" 12 | | "prerelease"; 13 | 14 | // The supported comparators are taken from the source here: 15 | // https://github.com/npm/node-semver/blob/8bd070b550db2646362c9883c8d008d32f66a234/semver.js#L623 16 | declare type Operator = 17 | | "===" 18 | | "!==" 19 | | "==" 20 | | "=" 21 | | "" // Not sure why you would want this, but whatever. 22 | | "!=" 23 | | ">" 24 | | ">=" 25 | | "<" 26 | | "<="; 27 | 28 | declare class SemVer { 29 | build: Array; 30 | loose: ?boolean; 31 | major: number; 32 | minor: number; 33 | patch: number; 34 | prerelease: Array; 35 | raw: string; 36 | version: string; 37 | 38 | constructor(version: string | SemVer, options?: Options): SemVer; 39 | compare(other: string | SemVer): -1 | 0 | 1; 40 | compareMain(other: string | SemVer): -1 | 0 | 1; 41 | comparePre(other: string | SemVer): -1 | 0 | 1; 42 | compareBuild(other: string | SemVer): -1 | 0 | 1; 43 | format(): string; 44 | inc(release: Release, identifier: string): this; 45 | } 46 | 47 | declare class Comparator { 48 | options?: Options; 49 | operator: Operator; 50 | semver: SemVer; 51 | value: string; 52 | 53 | constructor(comp: string | Comparator, options?: Options): Comparator; 54 | parse(comp: string): void; 55 | test(version: string): boolean; 56 | } 57 | 58 | declare class Range { 59 | loose: ?boolean; 60 | raw: string; 61 | set: Array>; 62 | 63 | constructor(range: string | Range, options?: Options): Range; 64 | format(): string; 65 | parseRange(range: string): Array; 66 | test(version: string): boolean; 67 | toString(): string; 68 | } 69 | 70 | declare var SEMVER_SPEC_VERSION: string; 71 | declare var re: Array; 72 | declare var src: Array; 73 | 74 | declare type Options = { 75 | options?: Options, 76 | includePrerelease?: boolean, 77 | ... 78 | } | boolean; 79 | 80 | // Functions 81 | declare function valid(v: string | SemVer, options?: Options): string | null; 82 | declare function clean(v: string | SemVer, options?: Options): string | null; 83 | declare function inc( 84 | v: string | SemVer, 85 | release: Release, 86 | options?: Options, 87 | identifier?: string 88 | ): string | null; 89 | declare function inc( 90 | v: string | SemVer, 91 | release: Release, 92 | identifier: string 93 | ): string | null; 94 | declare function major(v: string | SemVer, options?: Options): number; 95 | declare function minor(v: string | SemVer, options?: Options): number; 96 | declare function patch(v: string | SemVer, options?: Options): number; 97 | declare function intersects(r1: string | SemVer, r2: string | SemVer, loose?: boolean): boolean; 98 | declare function minVersion(r: string | Range): Range | null; 99 | 100 | // Comparison 101 | declare function gt( 102 | v1: string | SemVer, 103 | v2: string | SemVer, 104 | options?: Options 105 | ): boolean; 106 | declare function gte( 107 | v1: string | SemVer, 108 | v2: string | SemVer, 109 | options?: Options 110 | ): boolean; 111 | declare function lt( 112 | v1: string | SemVer, 113 | v2: string | SemVer, 114 | options?: Options 115 | ): boolean; 116 | declare function lte( 117 | v1: string | SemVer, 118 | v2: string | SemVer, 119 | options?: Options 120 | ): boolean; 121 | declare function eq( 122 | v1: string | SemVer, 123 | v2: string | SemVer, 124 | options?: Options 125 | ): boolean; 126 | declare function neq( 127 | v1: string | SemVer, 128 | v2: string | SemVer, 129 | options?: Options 130 | ): boolean; 131 | declare function cmp( 132 | v1: string | SemVer, 133 | comparator: Operator, 134 | v2: string | SemVer, 135 | options?: Options 136 | ): boolean; 137 | declare function compare( 138 | v1: string | SemVer, 139 | v2: string | SemVer, 140 | options?: Options 141 | ): -1 | 0 | 1; 142 | declare function rcompare( 143 | v1: string | SemVer, 144 | v2: string | SemVer, 145 | options?: Options 146 | ): -1 | 0 | 1; 147 | declare function diff(v1: string | SemVer, v2: string | SemVer): ?Release; 148 | declare function intersects(comparator: Comparator): boolean; 149 | declare function sort( 150 | list: Array, 151 | options?: Options 152 | ): Array; 153 | declare function rsort( 154 | list: Array, 155 | options?: Options 156 | ): Array; 157 | declare function compareIdentifiers( 158 | v1: string | SemVer, 159 | v2: string | SemVer 160 | ): -1 | 0 | 1; 161 | declare function rcompareIdentifiers( 162 | v1: string | SemVer, 163 | v2: string | SemVer 164 | ): -1 | 0 | 1; 165 | 166 | // Ranges 167 | declare function validRange( 168 | range: string | Range, 169 | options?: Options 170 | ): string | null; 171 | declare function satisfies( 172 | version: string | SemVer, 173 | range: string | Range, 174 | options?: Options 175 | ): boolean; 176 | declare function maxSatisfying( 177 | versions: Array, 178 | range: string | Range, 179 | options?: Options 180 | ): string | SemVer | null; 181 | declare function minSatisfying( 182 | versions: Array, 183 | range: string | Range, 184 | options?: Options 185 | ): string | SemVer | null; 186 | declare function gtr( 187 | version: string | SemVer, 188 | range: string | Range, 189 | options?: Options 190 | ): boolean; 191 | declare function ltr( 192 | version: string | SemVer, 193 | range: string | Range, 194 | options?: Options 195 | ): boolean; 196 | declare function outside( 197 | version: string | SemVer, 198 | range: string | Range, 199 | hilo: ">" | "<", 200 | options?: Options 201 | ): boolean; 202 | declare function intersects( 203 | range: Range 204 | ): boolean; 205 | declare function simplifyRange( 206 | ranges: Array, 207 | range: string | Range, 208 | options?: Options, 209 | ): string | Range; 210 | declare function subset( 211 | sub: string | Range, 212 | dom: string | Range, 213 | options?: Options, 214 | ): boolean; 215 | 216 | // Coercion 217 | declare function coerce( 218 | version: string | SemVer, 219 | options?: Options 220 | ): ?SemVer 221 | 222 | // Not explicitly documented, or deprecated 223 | declare function parse(version: string, options?: Options): ?SemVer; 224 | declare function toComparators( 225 | range: string | Range, 226 | options?: Options 227 | ): Array>; 228 | } 229 | 230 | declare module "semver/preload" { 231 | declare module.exports: $Exports<"semver">; 232 | } 233 | -------------------------------------------------------------------------------- /flow-typed/npm/standard-version_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 84ff87a30bde022c60e59edfba5190b1 2 | // flow-typed version: <>/standard-version_v^9.3.2/flow_v0.135.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'standard-version' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'standard-version' { 17 | declare module.exports: any; 18 | } 19 | -------------------------------------------------------------------------------- /flow-typed/npm/yargs_v15.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: d538758c32ffc612a9c0d1262c22d161 2 | // flow-typed version: 3c81f4d103/yargs_v15.x.x/flow_>=v0.118.x <=v0.200.x 3 | 4 | declare module "yargs" { 5 | declare type Argv = { 6 | [key: string]: any, 7 | _: Array, 8 | $0: string, 9 | ... 10 | }; 11 | 12 | declare type Options = $Shape<{ 13 | alias: string | Array, 14 | array: boolean, 15 | boolean: boolean, 16 | choices: Array, 17 | coerce: (arg: {[key: string]: any, ...} | any) => mixed, 18 | config: boolean, 19 | configParser: (configPath: string) => { [key: string]: mixed, ... }, 20 | conflicts: string | Array | { [key: string]: string, ... }, 21 | count: boolean, 22 | default: mixed, 23 | defaultDescription: string, 24 | demandOption: boolean | string, 25 | desc: string, 26 | describe: string, 27 | description: string, 28 | global: boolean, 29 | group: string, 30 | implies: string | { [key: string]: string, ... }, 31 | nargs: number, 32 | normalize: boolean, 33 | number: boolean, 34 | required: boolean, 35 | requiresArg: boolean, 36 | skipValidation: boolean, 37 | string: boolean, 38 | type: "array" | "boolean" | "count" | "number" | "string", 39 | ... 40 | }>; 41 | 42 | declare type CommonModuleObject = {| 43 | command?: string | Array, 44 | aliases?: Array | string, 45 | builder?: { [key: string]: Options, ... } | ((yargsInstance: Yargs) => mixed), 46 | handler?: ((argv: Argv) => void) | ((argv: Argv) => Promise) 47 | |}; 48 | 49 | declare type ModuleObjectDesc = {| 50 | ...CommonModuleObject, 51 | desc?: string | false 52 | |}; 53 | 54 | declare type ModuleObjectDescribe = {| 55 | ...CommonModuleObject, 56 | describe?: string | false 57 | |}; 58 | 59 | declare type ModuleObjectDescription = {| 60 | ...CommonModuleObject, 61 | description?: string | false 62 | |}; 63 | 64 | declare type ModuleObject = 65 | | ModuleObjectDesc 66 | | ModuleObjectDescribe 67 | | ModuleObjectDescription; 68 | 69 | declare type MiddleWareCallback = 70 | | (argv: Argv, yargsInstance?: Yargs) => void 71 | | (argv: Argv, yargsInstance?: Yargs) => Promise; 72 | 73 | declare type Middleware = MiddleWareCallback | Array; 74 | 75 | declare class Yargs { 76 | (args: Array): Yargs; 77 | 78 | alias(key: string, alias: string): this; 79 | alias(alias: { [key: string]: string | Array, ... }): this; 80 | argv: Argv; 81 | array(key: string | Array): this; 82 | boolean(parameter: string | Array): this; 83 | check(fn: (argv: Argv, options: Array) => ?boolean): this; 84 | choices(key: string, allowed: Array): this; 85 | choices(allowed: { [key: string]: Array, ... }): this; 86 | coerce(key: string, fn: (value: any) => mixed): this; 87 | coerce(object: { [key: string]: (value: any) => mixed, ... }): this; 88 | coerce(keys: Array, fn: (value: any) => mixed): this; 89 | 90 | command( 91 | cmd: string | Array, 92 | desc: string | false, 93 | builder?: { [key: string]: Options, ... } | ((yargsInstance: Yargs) => mixed), 94 | handler?: Function 95 | ): this; 96 | 97 | command( 98 | cmd: string | Array, 99 | desc: string | false, 100 | module: ModuleObject 101 | ): this; 102 | 103 | command(module: ModuleObject): this; 104 | 105 | commandDir( 106 | directory: string, 107 | options?: { 108 | exclude?: string | Function, 109 | extensions?: Array, 110 | include?: string | Function, 111 | recurse?: boolean, 112 | visit?: Function, 113 | ... 114 | }, 115 | ): this; 116 | 117 | completion( 118 | cmd?: string, 119 | description?: string | false | ( 120 | current: string, 121 | argv: Argv, 122 | done: (compeltion: Array) => void 123 | ) => ?(Array | Promise>), 124 | fn?: ( 125 | current: string, 126 | argv: Argv, 127 | done: (completion: Array) => void 128 | ) => ?(Array | Promise>) 129 | ): this; 130 | 131 | config( 132 | key?: string, 133 | description?: string, 134 | parseFn?: (configPath: string) => { [key: string]: mixed, ... } 135 | ): this; 136 | config( 137 | key: string, 138 | parseFn?: (configPath: string) => { [key: string]: mixed, ... } 139 | ): this; 140 | config(config: { [key: string]: mixed, ... }): this; 141 | 142 | conflicts(key: string, value: string | Array): this; 143 | conflicts(keys: { [key: string]: string | Array, ... }): this; 144 | 145 | count(name: string): this; 146 | 147 | default(key: string, value: mixed, description?: string): this; 148 | default(defaults: { [key: string]: mixed, ... }): this; 149 | 150 | // Deprecated: use demandOption() and demandCommand() instead. 151 | demand(key: string, msg?: string | boolean): this; 152 | demand(count: number, max?: number, msg?: string | boolean): this; 153 | 154 | demandOption(key: string | Array, msg?: string | boolean): this; 155 | 156 | demandCommand(): this; 157 | demandCommand(min: number, minMsg?: string): this; 158 | demandCommand( 159 | min: number, 160 | max: number, 161 | minMsg?: string, 162 | maxMsg?: string 163 | ): this; 164 | 165 | describe(key: string, description: string): this; 166 | describe(describeObject: { [key: string]: string, ... }): this; 167 | 168 | detectLocale(shouldDetect: boolean): this; 169 | 170 | env(prefix?: string): this; 171 | 172 | epilog(text: string): this; 173 | epilogue(text: string): this; 174 | 175 | example(cmd: string, desc?: string): this; 176 | 177 | exitProcess(enable: boolean): this; 178 | 179 | fail(fn: (failureMessage: string, err: Error, yargs: Yargs) => mixed): this; 180 | 181 | getCompletion(args: Array, fn: () => void): this; 182 | 183 | global(globals: string | Array, isGlobal?: boolean): this; 184 | 185 | group(key: string | Array, groupName: string): this; 186 | 187 | help(option: boolean): this; 188 | 189 | help(option?: string, desc?: string): this; 190 | 191 | hide(key: string): this; 192 | 193 | implies(key: string, value: string | Array): this; 194 | implies(keys: { [key: string]: string | Array, ... }): this; 195 | 196 | locale( 197 | locale: | "de" 198 | | "en" 199 | | "es" 200 | | "fr" 201 | | "hi" 202 | | "hu" 203 | | "id" 204 | | "it" 205 | | "ja" 206 | | "ko" 207 | | "nb" 208 | | "pirate" 209 | | "pl" 210 | | "pt" 211 | | "pt_BR" 212 | | "ru" 213 | | "th" 214 | | "tr" 215 | | "zh_CN" 216 | ): this; 217 | locale(): string; 218 | 219 | middleware( 220 | middlewareCallbacks: Middleware, 221 | applyBeforeValidation?: boolean, 222 | ): this; 223 | 224 | nargs(key: string, count: number): this; 225 | 226 | normalize(key: string): this; 227 | 228 | number(key: string | Array): this; 229 | 230 | onFinishCommand(handler: () => mixed): this; 231 | 232 | option(key: string, options?: Options): this; 233 | option(optionMap: { [key: string]: Options, ... }): this; 234 | 235 | options(key: string, options?: Options): this; 236 | options(optionMap: { [key: string]: Options, ... }): this; 237 | 238 | parse( 239 | args?: string | Array, 240 | context?: { [key: string]: any, ... }, 241 | parseCallback?: (err: Error, argv: Argv, output?: string) => void 242 | ): Argv; 243 | parse( 244 | args?: string | Array, 245 | parseCallback?: (err: Error, argv: Argv, output?: string) => void 246 | ): Argv; 247 | 248 | parserConfiguration(configuration: {[key: string]: any, ...}): this; 249 | 250 | pkgConf(key: string, cwd?: string): this; 251 | 252 | positional(key: string, opt?: Options): this; 253 | 254 | recommendCommands(): this; 255 | 256 | // Alias of demand() 257 | require(key: string, msg: string | boolean): this; 258 | require(count: number, max?: number, msg?: string | boolean): this; 259 | 260 | requiresArg(key: string | Array): this; 261 | 262 | reset(): this; 263 | 264 | scriptName(name: string): this; 265 | 266 | showCompletionScript(): this; 267 | 268 | showHelp(consoleLevel?: "error" | "warn" | "log"): this; 269 | showHelp(printCallback: (usageData: string) => void): this; 270 | 271 | showHelpOnFail(enable: boolean, message?: string): this; 272 | 273 | strict(): this; 274 | 275 | skipValidation(key: string): this; 276 | 277 | strict(global?: boolean): this; 278 | 279 | string(key: string | Array): this; 280 | 281 | terminalWidth(): number; 282 | 283 | updateLocale(obj: { [key: string]: string, ... }): this; 284 | updateStrings(obj: { [key: string]: string, ... }): this; 285 | 286 | usage(message: string, opts?: { [key: string]: Options, ... }): this; 287 | 288 | version(): this; 289 | version(version: string | false): this; 290 | version(option: string | (() => string), version: string): this; 291 | version( 292 | option: string | (() => string), 293 | description: string | (() => string), 294 | version: string 295 | ): this; 296 | 297 | wrap(columns: number | null): this; 298 | } 299 | 300 | declare module.exports: Yargs; 301 | } 302 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | // $FlowFixMe 4 | module.exports = require("./dist/jsx-pragmatic"); // eslint-disable-line import/no-commonjs 5 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | /* eslint import/no-default-export: off */ 3 | 4 | import { getKarmaConfig } from "@krakenjs/karma-config-grumbler"; 5 | 6 | import { WEBPACK_CONFIG_TEST } from "./webpack.config"; 7 | 8 | export default function configKarma(karma: Object) { 9 | const karmaConfig = getKarmaConfig(karma, { 10 | basePath: __dirname, 11 | webpack: WEBPACK_CONFIG_TEST, 12 | }); 13 | 14 | karma.set(karmaConfig); 15 | } 16 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@krakenjs/jsx-pragmatic", 3 | "version": "3.1.1", 4 | "description": "Javascript module template.", 5 | "main": "index.js", 6 | "scripts": { 7 | "dev": "babel-node --plugins @babel/plugin-transform-modules-commonjs $(npm bin)/webpack-dev-server --config webpack.config.js --port 9000 --open-page demo/dev/index.htm --hot=false --inline=false", 8 | "setup": "npm install", 9 | "lint": "eslint src/ test/ *.js --ext .js,.jsx", 10 | "flow-typed": "rm -rf ./flow-typed && flow-typed install && flow-typed install react@6 && flow-typed install mocha@4", 11 | "flow": "flow", 12 | "format": "prettier --write --ignore-unknown .", 13 | "format:check": "prettier --check .", 14 | "karma": "cross-env NODE_ENV=test babel-node --plugins=transform-es2015-modules-commonjs ./node_modules/.bin/karma start", 15 | "babel": "babel src/ --out-dir dist/module", 16 | "webpack": "babel-node --plugins=transform-es2015-modules-commonjs ./node_modules/.bin/webpack --progress", 17 | "test": "npm run format:check && npm run lint && npm run flow && npm run karma", 18 | "build": "npm run test && npm run babel && npm run webpack", 19 | "clean": "rimraf dist coverage", 20 | "reinstall": "rimraf node_modules && npm install", 21 | "debug": "cross-env NODE_ENV=debug", 22 | "prepare": "husky install", 23 | "prerelease": "npm run clean && npm run build && git add dist && git commit -m 'ci: check in dist folder' || echo 'Nothing to distribute'", 24 | "release": "standard-version", 25 | "postrelease": "git push && git push --follow-tags && npm publish" 26 | }, 27 | "standard-version": { 28 | "types": [ 29 | { 30 | "type": "feat", 31 | "section": "Features" 32 | }, 33 | { 34 | "type": "fix", 35 | "section": "Bug Fixes" 36 | }, 37 | { 38 | "type": "chore", 39 | "hidden": false 40 | }, 41 | { 42 | "type": "docs", 43 | "hidden": false 44 | }, 45 | { 46 | "type": "style", 47 | "hidden": false 48 | }, 49 | { 50 | "type": "refactor", 51 | "hidden": false 52 | }, 53 | { 54 | "type": "perf", 55 | "hidden": false 56 | }, 57 | { 58 | "type": "test", 59 | "hidden": false 60 | }, 61 | { 62 | "type": "ci", 63 | "hidden": true 64 | } 65 | ] 66 | }, 67 | "files": [ 68 | "dist/", 69 | "src/" 70 | ], 71 | "browserslist": [ 72 | "IE >= 11", 73 | "chrome >= 27", 74 | "firefox >= 30", 75 | "safari >= 7", 76 | "opera >= 23" 77 | ], 78 | "repository": { 79 | "type": "git", 80 | "url": "git://github.com/krakenjs/jsx-pragmatic.git" 81 | }, 82 | "keywords": [ 83 | "template" 84 | ], 85 | "licenses": [ 86 | { 87 | "type": "Apache 2.0", 88 | "url": "http://www.apache.org/licenses/LICENSE-2.0.html" 89 | } 90 | ], 91 | "readmeFilename": "README.md", 92 | "devDependencies": { 93 | "@commitlint/cli": "^16.2.1", 94 | "@commitlint/config-conventional": "^16.2.1", 95 | "@krakenjs/grumbler-scripts": "^8.0.4", 96 | "cross-env": "^7.0.3", 97 | "flow-bin": "^0.135.0", 98 | "flow-typed": "^3.9.0", 99 | "husky": "^7.0.4", 100 | "jest": "^29.3.1", 101 | "lint-staged": "^12.4.0", 102 | "mocha": "^4.1.0", 103 | "prettier": "^2.6.2", 104 | "standard-version": "^9.3.2" 105 | }, 106 | "lint-staged": { 107 | "*": "prettier --write --ignore-unknown" 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /src/component/index.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | export * from "./style"; 4 | export * from "./regex"; 5 | -------------------------------------------------------------------------------- /src/component/regex.jsx: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | /** @jsx node */ 3 | 4 | import { type ChildType, type ChildrenType, TextNode } from "../node"; 5 | import { isDefined } from "../util"; 6 | import { NODE_TYPE } from "../constants"; 7 | import { regex } from "../renderers"; 8 | 9 | const escapeRegex = (text: string): string => { 10 | return text.replace(/[-[\]{}()*+?.,\\^$|#]/g, "\\$&"); 11 | }; 12 | 13 | const validateChildren = ( 14 | name: string, 15 | children: ?ChildrenType 16 | ): ChildrenType => { 17 | if (!children) { 18 | throw new Error(`Must pass children to ${name}`); 19 | } 20 | 21 | return children; 22 | }; 23 | 24 | const validateNoChildren = (name: string, children: ?ChildrenType) => { 25 | if (children && children.length) { 26 | throw new Error(`Must not pass children to ${name}`); 27 | } 28 | }; 29 | 30 | const validateAndEscapeChildren = ( 31 | name: string, 32 | children: ?ChildrenType 33 | ): ChildrenType => { 34 | children = validateChildren(name, children); 35 | 36 | return children.map((child) => { 37 | if (child.type === NODE_TYPE.TEXT) { 38 | return new TextNode(escapeRegex(child.text)); 39 | } 40 | 41 | return child; 42 | }); 43 | }; 44 | 45 | export type RegexOptions = {| 46 | exact?: boolean, 47 | |}; 48 | 49 | export function Regex( 50 | { exact = true }: RegexOptions, 51 | children?: ChildrenType 52 | ): ChildType { 53 | children = validateAndEscapeChildren("RegexGroup", children); 54 | 55 | if (!exact) { 56 | return children; 57 | } 58 | 59 | return ["^", ...children, "$"]; 60 | } 61 | 62 | Regex.renderer = regex; 63 | 64 | type RegexTextOptions = {||}; 65 | 66 | export function RegexText( 67 | props: RegexTextOptions, 68 | children?: ChildrenType 69 | ): ChildType { 70 | return validateAndEscapeChildren("RegexText", children); 71 | } 72 | 73 | type RegexWordOptions = {||}; 74 | 75 | export function RegexWord( 76 | props: RegexWordOptions, 77 | children?: ChildrenType 78 | ): ChildType { 79 | validateNoChildren("RegexWord", children); 80 | 81 | return "\\w+"; 82 | } 83 | 84 | type RegexCharactersOptions = {||}; 85 | 86 | export function RegexCharacters( 87 | props: RegexCharactersOptions, 88 | children?: ChildrenType 89 | ): ChildType { 90 | return ["[", ...validateAndEscapeChildren("RegexText", children), "]"]; 91 | } 92 | 93 | type RegexGroupOptions = {| 94 | optional?: boolean, 95 | repeat?: boolean | number, 96 | repeatMin?: number, 97 | repeatMax?: number, 98 | capture?: boolean, 99 | union?: boolean, 100 | name?: string, 101 | |}; 102 | 103 | export function RegexGroup( 104 | { 105 | repeat, 106 | repeatMin, 107 | repeatMax, 108 | name, 109 | optional = false, 110 | capture = true, 111 | union = false, 112 | }: RegexGroupOptions, 113 | children?: ChildrenType 114 | ): ChildType { 115 | children = validateAndEscapeChildren("RegexGroup", children); 116 | 117 | if (isDefined(repeat) && (isDefined(repeatMin) || isDefined(repeatMax))) { 118 | throw new Error(`repeat can not be used with repeatMin or repeatMax`); 119 | } 120 | 121 | if (name && !capture) { 122 | throw new Error(`Named groups must be captured`); 123 | } 124 | 125 | if (union) { 126 | const result = []; 127 | 128 | for (const child of children) { 129 | result.push(child); 130 | result.push(new TextNode("|")); 131 | } 132 | 133 | result.pop(); 134 | children = result; 135 | } 136 | 137 | const result = []; 138 | 139 | result.push(capture ? "(" : "(?:"); 140 | 141 | if (name) { 142 | result.push(`?<${escapeRegex(name)}>`); 143 | } 144 | 145 | result.push(...children); 146 | result.push(")"); 147 | 148 | if (isDefined(repeat)) { 149 | if (typeof repeat === "number") { 150 | result.push(`{${repeat}}`); 151 | } else if (repeat === true) { 152 | result.push(`+`); 153 | } 154 | } 155 | 156 | if (isDefined(repeatMin) || isDefined(repeatMax)) { 157 | result.push(`{${repeatMin || ""},${repeatMax || ""}}`); 158 | } 159 | 160 | if (optional) { 161 | result.push("?"); 162 | } 163 | 164 | return result; 165 | } 166 | 167 | type RegexUnionOptions = {||}; 168 | 169 | export function RegexUnion( 170 | props: RegexUnionOptions, 171 | children?: ChildrenType 172 | ): ChildType { 173 | children = validateAndEscapeChildren("RegexGroup", children); 174 | 175 | const result = []; 176 | 177 | for (const child of children) { 178 | result.push(child); 179 | result.push("|"); 180 | } 181 | 182 | result.pop(); 183 | 184 | return result; 185 | } 186 | -------------------------------------------------------------------------------- /src/component/style.jsx: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | /** @jsx node */ 3 | 4 | import { 5 | Fragment, 6 | node, 7 | type ChildType, 8 | type NullableChildrenType, 9 | } from "../node"; 10 | 11 | type StyleProps = {| 12 | css: string | {| _getCss: () => string |}, 13 | nonce?: ?string, 14 | children?: ?NullableChildrenType, 15 | |}; 16 | 17 | export function Style({ css, nonce, children }: StyleProps): ChildType { 18 | return ( 19 | 20 | 20 | ); 21 | 22 | jsxNode.render(html()); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /test/util.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | window.console.karma = function consoleKarma() { 4 | const karma = 5 | window.karma || 6 | (window.top && window.top.karma) || 7 | (window.opener && window.opener.karma); 8 | karma.log("debug", arguments); 9 | console.log.apply(console, arguments); // eslint-disable-line no-console 10 | }; 11 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | /* eslint import/no-nodejs-modules: off, import/no-default-export: off */ 3 | 4 | import type { WebpackConfig } from "@krakenjs/webpack-config-grumbler/index.flow"; 5 | import { getWebpackConfig } from "@krakenjs/webpack-config-grumbler"; 6 | 7 | const FILE_NAME = "jsx-pragmatic"; 8 | const MODULE_NAME = "pragmatic"; 9 | 10 | export const WEBPACK_CONFIG: WebpackConfig = getWebpackConfig({ 11 | filename: `${FILE_NAME}.js`, 12 | modulename: MODULE_NAME, 13 | minify: false, 14 | }); 15 | 16 | export const WEBPACK_CONFIG_MIN: WebpackConfig = getWebpackConfig({ 17 | filename: `${FILE_NAME}.min.js`, 18 | modulename: MODULE_NAME, 19 | minify: true, 20 | vars: { 21 | __MIN__: true, 22 | }, 23 | }); 24 | 25 | export const WEBPACK_CONFIG_TEST: WebpackConfig = getWebpackConfig({ 26 | modulename: MODULE_NAME, 27 | options: { 28 | devtool: "inline-source-map", 29 | }, 30 | vars: { 31 | __TEST__: true, 32 | }, 33 | }); 34 | 35 | export const WEBPACK_CONFIG_DEMO: WebpackConfig = getWebpackConfig({ 36 | entry: "./demo/dev/index.jsx", 37 | filename: `${FILE_NAME}-demo.js`, 38 | modulename: MODULE_NAME, 39 | minify: false, 40 | }); 41 | 42 | export default [WEBPACK_CONFIG, WEBPACK_CONFIG_MIN, WEBPACK_CONFIG_DEMO]; 43 | --------------------------------------------------------------------------------