├── .github ├── dependabot.yml └── workflows │ └── build-pdf.yml ├── .gitignore ├── .gitmodules ├── CONTRIBUTING.md ├── LICENSE ├── Makefile ├── appendix.adoc ├── bibliography.adoc ├── chapter1.adoc ├── chapter2.adoc ├── chapter3.adoc ├── contributors.adoc ├── dependencies ├── Gemfile ├── README.md ├── apt_packages.txt └── package.json ├── example.bib ├── external-debug-security.pdf ├── header.adoc ├── images ├── external_debug_dm.png ├── external_debug_protection.drawio ├── external_debug_trace.png ├── risc-v_logo.png ├── risc-v_logo.svg ├── riscv_privilege_modes.drawio └── riscv_privilege_modes.png ├── index.adoc ├── intro.adoc ├── node_modules ├── ansi-styles │ ├── package.json │ └── readme.md ├── array-back │ ├── LICENSE │ ├── README.hbs │ ├── README.md │ ├── dist │ │ └── index.js │ ├── index.mjs │ └── package.json ├── bytefield-svg │ ├── .clj-kondo │ │ ├── config.edn │ │ └── config.edn~ │ ├── .github │ │ ├── FUNDING.yml │ │ ├── ISSUE_TEMPLATE │ │ │ ├── bug_report.md │ │ │ └── feature_request.md │ │ ├── scripts │ │ │ ├── build_guide.sh │ │ │ └── build_guide.sh~ │ │ └── workflows │ │ │ └── guide.yml │ ├── .htmltest.yml │ ├── .htmltest.yml~ │ ├── .node-version │ ├── CHANGELOG.md │ ├── CODE_OF_CONDUCT.md │ ├── LICENSE │ ├── README.md │ ├── cli.js │ ├── deps.edn │ ├── doc │ │ ├── README.md │ │ ├── antora.yml │ │ ├── assets │ │ │ ├── DS-logo-github.png │ │ │ ├── sample-byte-field.png │ │ │ └── zulip-icon-circle.svg │ │ ├── github-actions.yml │ │ ├── local.yml │ │ └── modules │ │ │ └── ROOT │ │ │ ├── assets │ │ │ └── images │ │ │ │ └── DS-logo-bw-200-padded-left.png │ │ │ ├── nav.adoc │ │ │ ├── nav.adoc~ │ │ │ └── pages │ │ │ ├── attrs.adoc │ │ │ ├── funcs.adoc │ │ │ ├── intro.adoc │ │ │ └── values.adoc │ ├── extension.js │ ├── lib.js │ ├── package.json │ ├── shadow-cljs.edn │ ├── src │ │ └── org │ │ │ └── deepsymmetry │ │ │ └── bytefield │ │ │ ├── core.cljs │ │ │ └── macros.cljc │ └── test.edn ├── chalk │ ├── index.js │ ├── index.js.flow │ ├── license │ ├── package.json │ ├── readme.md │ ├── templates.js │ └── types │ │ └── index.d.ts ├── color-convert │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── conversions.js │ ├── index.js │ ├── package.json │ └── route.js ├── color-name │ ├── .eslintrc.json │ ├── .npmignore │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── package.json │ └── test.js ├── command-line-args │ ├── LICENSE │ ├── README.md │ ├── dist │ │ ├── index.js │ │ └── index.mjs │ ├── index.mjs │ ├── lib │ │ ├── argv-parser.mjs │ │ ├── argv-tools.mjs │ │ ├── option-definition.mjs │ │ ├── option-definitions.mjs │ │ ├── option-flag.mjs │ │ ├── option.mjs │ │ ├── output-grouped.mjs │ │ └── output.mjs │ └── package.json ├── command-line-usage │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── lib │ │ ├── chalk-format.js │ │ ├── section.js │ │ └── section │ │ │ ├── content.js │ │ │ └── option-list.js │ ├── node_modules │ │ ├── array-back │ │ │ ├── LICENSE │ │ │ ├── README.hbs │ │ │ ├── README.md │ │ │ ├── dist │ │ │ │ └── index.js │ │ │ ├── index.mjs │ │ │ └── package.json │ │ └── typical │ │ │ ├── LICENSE │ │ │ ├── README.hbs │ │ │ ├── README.md │ │ │ ├── dist │ │ │ └── index.js │ │ │ ├── index.mjs │ │ │ └── package.json │ └── package.json ├── deep-extend │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── lib │ │ └── deep-extend.js │ └── package.json ├── escape-string-regexp │ ├── index.js │ ├── license │ ├── package.json │ └── readme.md ├── find-replace │ ├── LICENSE │ ├── README.hbs │ ├── README.md │ ├── dist │ │ ├── index.js │ │ └── index.mjs │ ├── index.mjs │ └── package.json ├── has-flag │ ├── index.js │ ├── license │ ├── package.json │ └── readme.md ├── lodash.camelcase │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── reduce-flatten │ ├── .travis.yml │ ├── LICENSE │ ├── README.hbs │ ├── README.md │ ├── index.js │ ├── package.json │ └── test.js ├── supports-color │ ├── browser.js │ ├── index.js │ ├── license │ ├── package.json │ └── readme.md ├── table-layout │ ├── LICENSE │ ├── README.hbs │ ├── README.md │ ├── index.js │ ├── lib │ │ ├── ansi.js │ │ ├── cell.js │ │ ├── column.js │ │ ├── columns.js │ │ ├── padding.js │ │ └── rows.js │ ├── node_modules │ │ ├── array-back │ │ │ ├── LICENSE │ │ │ ├── README.hbs │ │ │ ├── README.md │ │ │ ├── dist │ │ │ │ └── index.js │ │ │ ├── index.mjs │ │ │ └── package.json │ │ └── typical │ │ │ ├── LICENSE │ │ │ ├── README.hbs │ │ │ ├── README.md │ │ │ ├── dist │ │ │ └── index.js │ │ │ ├── index.mjs │ │ │ └── package.json │ └── package.json ├── typical │ ├── LICENSE │ ├── README.hbs │ ├── README.md │ ├── dist │ │ └── index.js │ ├── index.mjs │ └── package.json └── wordwrapjs │ ├── LICENSE │ ├── README.hbs │ ├── README.md │ ├── index.js │ ├── node_modules │ └── typical │ │ ├── LICENSE │ │ ├── README.hbs │ │ ├── README.md │ │ ├── dist │ │ └── index.js │ │ ├── index.mjs │ │ └── package.json │ └── package.json ├── package-lock.json ├── package.json └── readme.adoc /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem 3 | version: 2 4 | updates: 5 | - package-ecosystem: gitsubmodule 6 | directory: / 7 | schedule: 8 | interval: daily 9 | -------------------------------------------------------------------------------- /.github/workflows/build-pdf.yml: -------------------------------------------------------------------------------- 1 | name: Create Specification Document 2 | 3 | # The workflow is triggered by pull request, push to main, and manual dispatch. 4 | on: 5 | workflow_dispatch: 6 | inputs: 7 | version: 8 | description: 'Release version, e.g. X.Y.Z:' 9 | required: true 10 | type: string 11 | revision_mark: 12 | description: 'Set revision mark as Draft, Release or Stable:' 13 | required: true 14 | type: string 15 | default: 'Draft' 16 | prerelease: 17 | description: 'Tag as a pre-release?' 18 | required: false 19 | type: boolean 20 | default: true 21 | draft: 22 | description: 'Create release as a draft?' 23 | required: false 24 | type: boolean 25 | default: false 26 | pull_request: 27 | push: 28 | branches: 29 | - main 30 | 31 | jobs: 32 | build: 33 | runs-on: ubuntu-latest 34 | 35 | steps: 36 | # Step 1: Checkout the repository 37 | - name: Checkout repository 38 | uses: actions/checkout@v3 39 | with: 40 | submodules: 'recursive' 41 | 42 | # Step 2: Pull the latest RISC-V Docs container image 43 | - name: Pull Container 44 | run: docker pull riscvintl/riscv-docs-base-container-image:latest 45 | 46 | # Step 3: Build Files 47 | - name: Build Files 48 | run: make 49 | env: 50 | VERSION: v${{ github.event.inputs.version }} 51 | REVMARK: ${{ github.event.inputs.revision_mark }} 52 | 53 | # Step 4: Upload the built PDF files as a single artifact 54 | - name: Upload Build Artifacts 55 | uses: actions/upload-artifact@v4 56 | with: 57 | name: Build Artifacts 58 | path: ${{ github.workspace }}/*.pdf 59 | retention-days: 30 60 | 61 | # Create Release 62 | - name: Create Release 63 | uses: softprops/action-gh-release@v1 64 | with: 65 | files: ${{ github.workspace }}/*.pdf 66 | tag_name: v${{ github.event.inputs.version }} 67 | name: Release ${{ github.event.inputs.version }} 68 | draft: ${{ github.event.inputs.draft }} 69 | prerelease: ${{ github.event.inputs.prerelease }} 70 | env: 71 | GITHUB_TOKEN: ${{ secrets.GHTOKEN }} 72 | if: github.event_name == 'workflow_dispatch' 73 | # This condition ensures this step only runs for workflow_dispatch events. 74 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pdf 2 | 3 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "docs-resources"] 2 | path = docs-resources 3 | url = https://github.com/riscv/docs-resources.git 4 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribution Guidelines 2 | 3 | As an open-source project, we appreciate and encourage community members to submit patches directly to the project. To maintain a well-organized development environment, we have established standards and methods for submitting changes. This document outlines the process for submitting patches to the project, ensuring that your contribution is swiftly incorporated into the codebase. 4 | 5 | # Licensing 6 | 7 | Licensing is crucial for open-source projects, as it guarantees that the software remains available under the conditions specified by the author. 8 | 9 | This project employs the Creative Commons Attribution 4.0 International license, which can be found in the LICENSE file within the project's repository. 10 | 11 | Licensing defines the rights granted to you as an author by the copyright holder. It is essential for contributors to fully understand and accept these licensing rights. In some cases, the copyright holder may not be the contributor, such as when the contributor is working on behalf of a company. 12 | 13 | # Developer Certificate of Origin (DCO) 14 | To uphold licensing criteria and demonstrate good faith, this project mandates adherence to the Developer Certificate of Origin (DCO) process. 15 | 16 | The DCO is an attestation appended to every contribution from each author. In the commit message of the contribution (explained in greater detail later in this document), the author adds a Signed-off-by statement, thereby accepting the DCO. 17 | 18 | When an author submits a patch, they affirm that they possess the right to submit the patch under the designated license. The DCO agreement is displayed below and at https://developercertificate.org. 19 | 20 | 21 | Developer's Certificate of Origin 1.1 22 | 23 | By making a contribution to this project, I certify that: 24 | 25 | (a) The contribution was created in whole or in part by me and I 26 | have the right to submit it under the open source license 27 | indicated in the file; or 28 | 29 | (b) The contribution is based upon previous work that, to the best 30 | of my knowledge, is covered under an appropriate open source 31 | license and I have the right under that license to submit that 32 | work with modifications, whether created in whole or in part 33 | by me, under the same open source license (unless I am 34 | permitted to submit under a different license), as indicated 35 | in the file; or 36 | 37 | (c) The contribution was provided directly to me by some other 38 | person who certified (a), (b), or (c), and I have not modified 39 | it. 40 | 41 | (d) I understand and agree that this project and the contribution 42 | are public and that a record of the contribution (including all 43 | personal information I submit with it, including my sign-off) is 44 | maintained indefinitely and may be redistributed consistent with 45 | this project or the open source license(s) involved. 46 | 47 | # DCO Sign-Off Methods 48 | The DCO necessitates the inclusion of a sign-off message in the following format for each commit within the pull request: 49 | 50 | Signed-off-by: Stephano Cetola 51 | 52 | Please use your real name in the sign-off message. 53 | 54 | You can manually add the DCO text to your commit body or include either -s or --signoff in your standard Git commit commands. If you forget to incorporate the sign-off, you can also amend a previous commit with the sign-off by executing git commit --amend -s. If you have already pushed your changes to GitHub, you will need to force push your branch afterward using git push -f. 55 | 56 | Note: 57 | 58 | Ensure that the name and email address associated with your GitHub account match the name and email address in the Signed-off-by line of your commit message. -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for RISC-V Doc Template 2 | # 3 | # This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 4 | # International License. To view a copy of this license, visit 5 | # http://creativecommons.org/licenses/by-sa/4.0/ or send a letter to 6 | # Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. 7 | # 8 | # SPDX-License-Identifier: CC-BY-SA-4.0 9 | # 10 | # Description: 11 | # 12 | # This Makefile is designed to automate the process of building and packaging 13 | # the Doc Template for RISC-V Extensions. 14 | 15 | DATE ?= $(shell date +%Y-%m-%d) 16 | VERSION ?= v0.7.1 17 | REVMARK ?= Draft 18 | DOCKER_RUN := docker run --rm -v ${PWD}:/build -w /build \ 19 | riscvintl/riscv-docs-base-container-image:latest 20 | 21 | HEADER_SOURCE := header.adoc 22 | PDF_RESULT := external-debug-security.pdf 23 | 24 | ASCIIDOCTOR_PDF := asciidoctor-pdf 25 | OPTIONS := --trace \ 26 | -a compress \ 27 | -a mathematical-format=svg \ 28 | -a revnumber=${VERSION} \ 29 | -a revremark=${REVMARK} \ 30 | -a revdate=${DATE} \ 31 | -a pdf-fontsdir=docs-resources/fonts \ 32 | -a pdf-style=docs-resources/themes/riscv-pdf.yml \ 33 | --failure-level=ERROR 34 | REQUIRES := --require=asciidoctor-bibtex \ 35 | --require=asciidoctor-diagram \ 36 | --require=asciidoctor-mathematical 37 | 38 | .PHONY: all build clean build-container build-no-container 39 | 40 | all: build 41 | 42 | build: 43 | @echo "Checking if Docker is available..." 44 | @if command -v docker >/dev/null 2>&1 ; then \ 45 | echo "Docker is available, building inside Docker container..."; \ 46 | $(MAKE) build-container; \ 47 | else \ 48 | echo "Docker is not available, building without Docker..."; \ 49 | $(MAKE) build-no-container; \ 50 | fi 51 | 52 | build-container: 53 | @echo "Starting build inside Docker container..." 54 | $(DOCKER_RUN) /bin/sh -c "$(ASCIIDOCTOR_PDF) $(OPTIONS) $(REQUIRES) --out-file=$(PDF_RESULT) $(HEADER_SOURCE)" 55 | @echo "Build completed successfully inside Docker container." 56 | 57 | build-no-container: 58 | @echo "Starting build..." 59 | $(ASCIIDOCTOR_PDF) $(OPTIONS) $(REQUIRES) --out-file=$(PDF_RESULT) $(HEADER_SOURCE) 60 | @echo "Build completed successfully." 61 | 62 | clean: 63 | @echo "Cleaning up generated files..." 64 | rm -f $(PDF_RESULT) 65 | @echo "Cleanup completed." 66 | -------------------------------------------------------------------------------- /appendix.adoc: -------------------------------------------------------------------------------- 1 | [appendix] 2 | == Theory of Operation 3 | 4 | This chapter explains the theory of operation for the External Debug Security Extension. The subsequent diagram illustrates the reference implementation of security control for the debug and trace, respectively. 5 | 6 | === Debug Security Control 7 | 8 | As outlined in the specification, the dedicated debug security policy for a hart is enforced by platform state `nsecdbg`, hart state `mdbgen`, and the `sdedbgalw` field inside the `msdcfg` CSR. Both the `nsecdbg` and `mdbgen` states can be accommodated in MMIO outside the harts, such as in the Debug Module registers, or implemented as fuses. 9 | 10 | The security control logic validates all debug requests and triggers (with action=1) firing/matching based on `nsecdbg`, `mdbgen`, and `sdedbgalw` against the privilege level of the hart. Debug requests that fail validation will either be dropped or kept pending. Additionally, the platform-specific external trigger inputs must obey platform constraints, which must be carefully handled by the platform implementation. 11 | 12 | When `nsecdbg` is set to 0, the validation process involves two actors, which may lead to a potential Time-of-Check Time-of-Use (TOCTOU) issue. To mitigate this, the implementation must ensure that both the validation and execution of debug requests occur under the same privilege level and the same debug security policy. Failing to do so may allow debug requests to bypass security controls. 13 | 14 | [[extdbg]] 15 | image::external_debug_dm.png[title="The debug security control",align="center"] 16 | 17 | When the external debugger is using `dcsr.step` or `icount` to step over an instruction that triggers a transition to a higher privilege level, the security control logic must check that the resulting privilege level is debuggable (see <>). If so, the hart will enter Debug Mode before the first instruction in the trap handler executes. If not, Debug Mode entry will remain pending until the hart returns to a debuggable privilege level. 18 | 19 | Similar to the scenario described in The RISC-V Debug Specification cite:[dbgspec] Appendix B.3, the trap handler might restart the instruction in case of page faults, emulated FPU instructions, or interrupts, which can result in single-stepping not passing an instruction. To help users, the external debugger should perform an extra step when the PC does not change during a regular step. 20 | 21 | Application-level debugging is primarily accomplished through self-hosted debugging, allowing the management of debug policies by supervisor domains. As a result, user-level debugging management is not addressed within this extension. 22 | 23 | === Trace Security Control 24 | 25 | Similar to debug security, trace is controlled by platform state `nsecdbg`, hart state `mtrcen`, and `sdetrcalw` in CSR `msdcfg` for each hart. The sec_inhibit sideband signal indicates the availability of trace to the trace encoder. 26 | 27 | image::external_debug_trace.png[title="The trace security control",align="center"] 28 | 29 | [appendix] 30 | == Execution Based Implementation with Sdsec 31 | 32 | In an execution-based implementation, the code executing the "park loop" can always run with M-mode privilege to access the memory and CSR. However, once execution is dispatched to an Abstract Command or the program buffer, the privilege level for accessing memory and CSR should be restricted to <>. 33 | 34 | To achieve this, a Debug Mode only state element (e.g., a field in a custom CSR) may be introduced to control the privilege level in Debug Mode. When the state is set to 1, Debug Mode allows M-mode privilege; when cleared to 0, it enforces the <>. The hardware sets this state to 1 upon entering the park loop and clears it to 0 by the final instruction of the park loop, right before execution is transferred to an Abstract Command or the program buffer. -------------------------------------------------------------------------------- /bibliography.adoc: -------------------------------------------------------------------------------- 1 | [bibliography] 2 | == Bibliography 3 | 4 | bibliography::[] 5 | -------------------------------------------------------------------------------- /chapter1.adoc: -------------------------------------------------------------------------------- 1 | [[threatmodel]] 2 | == External Debug Security Threat Model 3 | 4 | Modern SoC development involves several different actors who may not trust each other, resulting in the need to isolate actors' assets during the development and debugging phases. The current RISC-V Debug specification cite:[dbgspec] grants external debuggers the highest privilege in the system, regardless of the privilege level at which the target system is running. This leads to privilege escalation issues when multiple actors are present. 5 | 6 | For example, the owner of an SoC, who needs to debug their M-mode firmware, may be able to use the external debugger to bypass PMP lock (pmpcfg.L=1) and attack Boot ROM (the SoC creator's asset). 7 | 8 | Additionally, the RISC-V privilege architecture supports multiple software entities, or "supervisor domains," that do not trust each other. These supervisor domains are managed by a secure monitor running in M-mode, are isolated from each other by PMP/IOPMP, and may need different debug policies. The entity that owns the secure monitor wants to disable external debug when shipping the secure monitor; however, the entity that owns the supervisor domain needs to enable external debug to develop the supervisor domain. Since the external debugger is granted the highest privilege in the system, a malicious supervisor domain could compromise the M-mode secure monitor with the external debugger. 9 | 10 | -------------------------------------------------------------------------------- /contributors.adoc: -------------------------------------------------------------------------------- 1 | == Contributors 2 | 3 | [%hardbreaks] 4 | 5 | This RISC-V specification has been contributed to directly or indirectly by (in alphabetical order): Allen Baum, Aote Jin (editor), Beeman Strong, Gokhan Kaplayan, Greg Favor, Iain Robertson, Joe Xie (editor), Paul Donahue, Ravi Sahita, Robert Chyla, Tim Newsome, Ved Shanbhogue, Vicky Goode 6 | -------------------------------------------------------------------------------- /dependencies/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | gem 'asciidoctor' 3 | gem 'asciidoctor-bibtex' 4 | gem 'asciidoctor-diagram' 5 | gem 'asciidoctor-mathematical' 6 | gem 'asciidoctor-pdf' 7 | gem 'citeproc-ruby' 8 | gem 'coderay' 9 | gem 'csl-styles' 10 | gem 'json' 11 | gem 'pygments.rb' 12 | gem 'rghost' 13 | gem 'rouge' 14 | gem 'ruby_dev' 15 | -------------------------------------------------------------------------------- /dependencies/README.md: -------------------------------------------------------------------------------- 1 | Dependencies for the build environment for various package managers. Used in 2 | `.github/workflows/`. 3 | -------------------------------------------------------------------------------- /dependencies/apt_packages.txt: -------------------------------------------------------------------------------- 1 | bison 2 | build-essential 3 | python3-pip 4 | cmake 5 | curl 6 | flex 7 | fonts-lyx 8 | git 9 | graphviz 10 | default-jre 11 | libcairo2-dev 12 | libffi-dev 13 | libgdk-pixbuf2.0-dev 14 | libpango1.0-dev 15 | libxml2-dev 16 | libglib2.0-dev 17 | make 18 | pkg-config 19 | ruby 20 | ruby-dev 21 | libgif-dev 22 | libwebp-dev 23 | libzstd-dev 24 | ruby-full 25 | gem 26 | npm 27 | texlive-latex-base 28 | texlive-fonts-recommended 29 | texlive-fonts-extra 30 | texlive-latex-extra 31 | texlive-science 32 | -------------------------------------------------------------------------------- /dependencies/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "bytefield-svg": "^1.8.0", 4 | "wavedrom-cli": "^2.6.8" 5 | }, 6 | "name": "local", 7 | "version": "0.0.1" 8 | } 9 | -------------------------------------------------------------------------------- /example.bib: -------------------------------------------------------------------------------- 1 | 2 | @electronic{smmtt, 3 | title = {RISC-V Supervisor Domains Access Protection}, 4 | url = {https://github.com/riscv/riscv-smmtt} 5 | } 6 | @electronic{etrace, 7 | title = {RISC-V Efficient Trace for RISC-V}, 8 | url = {https://github.com/riscv-non-isa/riscv-trace-spec} 9 | } 10 | 11 | @electronic{ntrace, 12 | title = {RISC-V N-Trace (Nexus-based Trace) Specification}, 13 | url = {https://github.com/riscv-non-isa/tg-nexus-trace} 14 | } 15 | 16 | @electronic{dbgspec, 17 | title = {RISC-V Debug Specification}, 18 | url = {https://github.com/riscv/riscv-debug-spec} 19 | } 20 | 21 | @electronic{iopmp, 22 | title = {RISC-V IOPMP Architecture Specification}, 23 | url = {https://github.com/riscv-non-isa/iopmp-spec/releases} 24 | } 25 | 26 | @electronic{worldguard, 27 | title = {WorldGuard Specification}, 28 | url = {https://github.com/riscv-admin/security/blob/main/papers/worldguard%20proposal.pdf} 29 | } 30 | 31 | @electronic{smtdeleg, 32 | title = {RISC-V Trigger Delegation Specification}, 33 | url = {https://github.com/riscv/ft-trigger-delegation} 34 | } 35 | 36 | @electronic{smstateen, 37 | title = {RISC-V State Enable Extension}, 38 | url = {https://github.com/riscvarchive/riscv-state-enable} 39 | } -------------------------------------------------------------------------------- /external-debug-security.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riscv-non-isa/riscv-external-debug-security/def804c8a68a0211c21c8d9fb97ae5b526a5adff/external-debug-security.pdf -------------------------------------------------------------------------------- /header.adoc: -------------------------------------------------------------------------------- 1 | = RISC-V External Debug Security Specification 2 | :docgroup: RISC-V Task Group 3 | :description: RISC-V External Debug Security Specification 4 | :company: RISC-V.org 5 | :revdate: April 19, 2024 6 | :revnumber: 1.0 7 | :url-riscv: http://riscv.org 8 | :doctype: book 9 | :pdf-theme: docs-resources/themes/riscv-pdf.yml 10 | :pdf-fontsdir: ../src/resources/fonts/ 11 | :preface-title: Preamble 12 | :colophon: 13 | :pdf-theme: docs-resources/themes/riscv-pdf.yml 14 | :pdf-fontsdir: docs-resources/fonts/ 15 | :appendix-caption: Appendix 16 | :imagesdir: images 17 | :title-logo-image: image:risc-v_logo.svg[pdfwidth=3.25in,align=center] 18 | // Settings: 19 | :experimental: 20 | :reproducible: 21 | //:WaveDromEditorApp: app/wavedrom-editor.app 22 | :imagesoutdir: images 23 | //:bibtex-file: example.bib 24 | //:bibtex-order: alphabetical 25 | //:bibtex-style: apa 26 | :icons: font 27 | :lang: en 28 | :listing-caption: Listing 29 | :sectnums: 30 | :media: prepress 31 | :!show-link-uri: 32 | :toc: left 33 | :toclevels: 4 34 | :source-highlighter: pygments 35 | ifdef::backend-pdf[] 36 | :source-highlighter: coderay 37 | endif::[] 38 | :data-uri: 39 | :hide-uri-scheme: 40 | :stem: latexmath 41 | :footnote: 42 | :xrefstyle: short 43 | 44 | [WARNING] 45 | .This document is in the link:http://riscv.org/spec-state[Development state] 46 | ==== 47 | Expect potential changes. This draft specification is likely to evolve before 48 | it is accepted as a standard. Implementations based on this draft 49 | may not conform to the future standard. 50 | ==== 51 | 52 | [preface] 53 | == Copyright and license information 54 | This specification is licensed under the Creative Commons 55 | Attribution 4.0 International License (CC-BY 4.0). The full 56 | license text is available at 57 | https://creativecommons.org/licenses/by/4.0/. 58 | 59 | Copyright 2023-2024 by RISC-V International. 60 | 61 | [preface] 62 | include::contributors.adoc[] 63 | 64 | include::intro.adoc[] 65 | include::chapter1.adoc[] 66 | include::chapter2.adoc[] 67 | include::chapter3.adoc[] 68 | include::appendix.adoc[] 69 | 70 | // The index must precede the bibliography 71 | include::index.adoc[] 72 | include::bibliography.adoc[] -------------------------------------------------------------------------------- /images/external_debug_dm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riscv-non-isa/riscv-external-debug-security/def804c8a68a0211c21c8d9fb97ae5b526a5adff/images/external_debug_dm.png -------------------------------------------------------------------------------- /images/external_debug_trace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riscv-non-isa/riscv-external-debug-security/def804c8a68a0211c21c8d9fb97ae5b526a5adff/images/external_debug_trace.png -------------------------------------------------------------------------------- /images/risc-v_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riscv-non-isa/riscv-external-debug-security/def804c8a68a0211c21c8d9fb97ae5b526a5adff/images/risc-v_logo.png -------------------------------------------------------------------------------- /images/riscv_privilege_modes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riscv-non-isa/riscv-external-debug-security/def804c8a68a0211c21c8d9fb97ae5b526a5adff/images/riscv_privilege_modes.png -------------------------------------------------------------------------------- /index.adoc: -------------------------------------------------------------------------------- 1 | [index] 2 | == Index 3 | -------------------------------------------------------------------------------- /intro.adoc: -------------------------------------------------------------------------------- 1 | [[intro]] 2 | == Introduction 3 | Debugging and tracing are essential for developers to identify and rectify software and hardware issues, optimize performance, and ensure robust system functionality. The debugging and tracing extensions in the RISC-V ecosystem play a pivotal role in enabling these capabilities, allowing developers to monitor and control the execution of programs during the development, testing and production phases. However, the current RISC-V Debug specification grants the external debugger the highest privilege in the system, regardless of the privilege level at which the target system is running. It leads to privilege escalation issues when multiple actors are present. 4 | 5 | 6 | This specification defines <> and <> to address the above security issues in the current _The RISC-V Debug Specification_ cite:[dbgspec] and trace specifications cite:[etrace] cite:[ntrace]. 7 | 8 | A summary of the changes introduced by _The RISC-V External Debug Security Specification_ follows. 9 | 10 | - *Per-Hart Debug Control:* Introduce per-hart states to control whether external debug is allowed in M-mode and/or supervisor domains cite:[smmtt]. 11 | - *Per-Hart Trace Control:* Introduce per-hart states to control whether tracing is allowed in M-mode and/or supervisor domains. 12 | - *Non-secure debug:* Add a non-secure debug state to relax security constraints. 13 | - *Debug Mode entry:* An external debugger can only halt the hart and enter debug mode when debug is allowed in current privilege mode. 14 | - *Memory Access:* Memory access from a hart's point of view, using the Program Buffer or an Abstract Command, must be checked by the hart's memory protection mechanisms as if the hart is running at <>; memory access from the Debug Module using System Bus Access must be checked by a system memory protection mechanism, such as IOPMP or WorldGuard. 15 | - *Register Access:* Register access using the Program Buffer or an Abstract Command works as if the hart is running at <> instead of M-mode privilege level. The debug CSRs (`dcsr` and `dpc` ) are shadowed in supervisor domains while Smtdeleg cite:[smtdeleg] and Smstateen cite:[smstateen] extensions expose the trigger CSRs to supervisor domains. 16 | - *Triggers:* Triggers (with action=1) can only fire or match when external debug is allowed in the current privilege mode. 17 | 18 | === Terminology 19 | 20 | [cols="2*"] 21 | [cols="20%,80%"] 22 | |===================================================================================================================================================== 23 | | Abstract command | A high-level Debug Module operation used to interact with and control harts 24 | | Debug Access Privilege | The privilege with which an Abstract Command or instructions in the Program Buffer access hardware resources 25 | | Debug Mode | An additional privilege mode to support off-chip debugging 26 | | Hart | A RISC-V hardware thread 27 | | IOPMP | Input-Output Physical Memory Protection unit 28 | | M-mode | The highest privileged mode in the RISC-V privilege model 29 | | PMA | Physical Memory Attributes 30 | | PMP | Physical Memory Protection unit 31 | | Program buffer | A mechanism that allows the Debug Module to execute arbitrary instructions on a hart 32 | | Supervisor domain | An isolated supervisor execution context defined in RISC-V Supervisor Domains Access Protection cite:[smmtt] 33 | | Trace encoder | A piece of hardware that takes in instruction execution information from a RISC-V hart and transforms it into trace packets 34 | |===================================================================================================================================================== 35 | -------------------------------------------------------------------------------- /node_modules/ansi-styles/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ansi-styles", 3 | "version": "3.2.1", 4 | "description": "ANSI escape codes for styling strings in the terminal", 5 | "license": "MIT", 6 | "repository": "chalk/ansi-styles", 7 | "author": { 8 | "name": "Sindre Sorhus", 9 | "email": "sindresorhus@gmail.com", 10 | "url": "sindresorhus.com" 11 | }, 12 | "engines": { 13 | "node": ">=4" 14 | }, 15 | "scripts": { 16 | "test": "xo && ava", 17 | "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor" 18 | }, 19 | "files": [ 20 | "index.js" 21 | ], 22 | "keywords": [ 23 | "ansi", 24 | "styles", 25 | "color", 26 | "colour", 27 | "colors", 28 | "terminal", 29 | "console", 30 | "cli", 31 | "string", 32 | "tty", 33 | "escape", 34 | "formatting", 35 | "rgb", 36 | "256", 37 | "shell", 38 | "xterm", 39 | "log", 40 | "logging", 41 | "command-line", 42 | "text" 43 | ], 44 | "dependencies": { 45 | "color-convert": "^1.9.0" 46 | }, 47 | "devDependencies": { 48 | "ava": "*", 49 | "babel-polyfill": "^6.23.0", 50 | "svg-term-cli": "^2.1.1", 51 | "xo": "*" 52 | }, 53 | "ava": { 54 | "require": "babel-polyfill" 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /node_modules/ansi-styles/readme.md: -------------------------------------------------------------------------------- 1 | # ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles) 2 | 3 | > [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal 4 | 5 | You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings. 6 | 7 | 8 | 9 | 10 | ## Install 11 | 12 | ``` 13 | $ npm install ansi-styles 14 | ``` 15 | 16 | 17 | ## Usage 18 | 19 | ```js 20 | const style = require('ansi-styles'); 21 | 22 | console.log(`${style.green.open}Hello world!${style.green.close}`); 23 | 24 | 25 | // Color conversion between 16/256/truecolor 26 | // NOTE: If conversion goes to 16 colors or 256 colors, the original color 27 | // may be degraded to fit that color palette. This means terminals 28 | // that do not support 16 million colors will best-match the 29 | // original color. 30 | console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close); 31 | console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close); 32 | console.log(style.color.ansi16m.hex('#ABCDEF') + 'Hello world!' + style.color.close); 33 | ``` 34 | 35 | ## API 36 | 37 | Each style has an `open` and `close` property. 38 | 39 | 40 | ## Styles 41 | 42 | ### Modifiers 43 | 44 | - `reset` 45 | - `bold` 46 | - `dim` 47 | - `italic` *(Not widely supported)* 48 | - `underline` 49 | - `inverse` 50 | - `hidden` 51 | - `strikethrough` *(Not widely supported)* 52 | 53 | ### Colors 54 | 55 | - `black` 56 | - `red` 57 | - `green` 58 | - `yellow` 59 | - `blue` 60 | - `magenta` 61 | - `cyan` 62 | - `white` 63 | - `gray` ("bright black") 64 | - `redBright` 65 | - `greenBright` 66 | - `yellowBright` 67 | - `blueBright` 68 | - `magentaBright` 69 | - `cyanBright` 70 | - `whiteBright` 71 | 72 | ### Background colors 73 | 74 | - `bgBlack` 75 | - `bgRed` 76 | - `bgGreen` 77 | - `bgYellow` 78 | - `bgBlue` 79 | - `bgMagenta` 80 | - `bgCyan` 81 | - `bgWhite` 82 | - `bgBlackBright` 83 | - `bgRedBright` 84 | - `bgGreenBright` 85 | - `bgYellowBright` 86 | - `bgBlueBright` 87 | - `bgMagentaBright` 88 | - `bgCyanBright` 89 | - `bgWhiteBright` 90 | 91 | 92 | ## Advanced usage 93 | 94 | By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module. 95 | 96 | - `style.modifier` 97 | - `style.color` 98 | - `style.bgColor` 99 | 100 | ###### Example 101 | 102 | ```js 103 | console.log(style.color.green.open); 104 | ``` 105 | 106 | Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values. 107 | 108 | ###### Example 109 | 110 | ```js 111 | console.log(style.codes.get(36)); 112 | //=> 39 113 | ``` 114 | 115 | 116 | ## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728) 117 | 118 | `ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors. 119 | 120 | To use these, call the associated conversion function with the intended output, for example: 121 | 122 | ```js 123 | style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code 124 | style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code 125 | 126 | style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code 127 | style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code 128 | 129 | style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code 130 | style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code 131 | ``` 132 | 133 | 134 | ## Related 135 | 136 | - [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal 137 | 138 | 139 | ## Maintainers 140 | 141 | - [Sindre Sorhus](https://github.com/sindresorhus) 142 | - [Josh Junon](https://github.com/qix-) 143 | 144 | 145 | ## License 146 | 147 | MIT 148 | -------------------------------------------------------------------------------- /node_modules/array-back/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015-19 Lloyd Brookes <75pound@gmail.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/array-back/README.hbs: -------------------------------------------------------------------------------- 1 | [![view on npm](https://img.shields.io/npm/v/array-back.svg)](https://www.npmjs.org/package/array-back) 2 | [![npm module downloads](https://img.shields.io/npm/dt/array-back.svg)](https://www.npmjs.org/package/array-back) 3 | [![Build Status](https://travis-ci.org/75lb/array-back.svg?branch=master)](https://travis-ci.org/75lb/array-back) 4 | [![Coverage Status](https://coveralls.io/repos/github/75lb/array-back/badge.svg?branch=master)](https://coveralls.io/github/75lb/array-back?branch=master) 5 | [![Dependency Status](https://david-dm.org/75lb/array-back.svg)](https://david-dm.org/75lb/array-back) 6 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard) 7 | 8 | {{>main}} 9 | 10 | ### Load anywhere 11 | 12 | This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation. 13 | 14 | Node.js: 15 | 16 | ```js 17 | const arrayify = require('array-back') 18 | ``` 19 | 20 | Within Node.js with ECMAScript Module support enabled: 21 | 22 | ```js 23 | import arrayify from 'array-back' 24 | ``` 25 | 26 | Within an modern browser ECMAScript Module: 27 | 28 | ```js 29 | import arrayify from './node_modules/array-back/index.mjs' 30 | ``` 31 | 32 | Old browser (adds `window.arrayBack`): 33 | 34 | ```html 35 | 36 | ``` 37 | 38 | * * * 39 | 40 | © 2015-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown). 41 | -------------------------------------------------------------------------------- /node_modules/array-back/README.md: -------------------------------------------------------------------------------- 1 | [![view on npm](https://img.shields.io/npm/v/array-back.svg)](https://www.npmjs.org/package/array-back) 2 | [![npm module downloads](https://img.shields.io/npm/dt/array-back.svg)](https://www.npmjs.org/package/array-back) 3 | [![Build Status](https://travis-ci.org/75lb/array-back.svg?branch=master)](https://travis-ci.org/75lb/array-back) 4 | [![Coverage Status](https://coveralls.io/repos/github/75lb/array-back/badge.svg?branch=master)](https://coveralls.io/github/75lb/array-back?branch=master) 5 | [![Dependency Status](https://david-dm.org/75lb/array-back.svg)](https://david-dm.org/75lb/array-back) 6 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard) 7 | 8 | 9 | 10 | ## array-back 11 | Takes any input and guarantees an array back. 12 | 13 | - Converts array-like objects (e.g. `arguments`, `Set`) to a real array. 14 | - Converts `undefined` to an empty array. 15 | - Converts any another other, singular value (including `null`, objects and iterables other than `Set`) into an array containing that value. 16 | - Ignores input which is already an array. 17 | 18 | **Example** 19 | ```js 20 | > const arrayify = require('array-back') 21 | 22 | > arrayify(undefined) 23 | [] 24 | 25 | > arrayify(null) 26 | [ null ] 27 | 28 | > arrayify(0) 29 | [ 0 ] 30 | 31 | > arrayify([ 1, 2 ]) 32 | [ 1, 2 ] 33 | 34 | > arrayify(new Set([ 1, 2 ])) 35 | [ 1, 2 ] 36 | 37 | > function f(){ return arrayify(arguments); } 38 | > f(1,2,3) 39 | [ 1, 2, 3 ] 40 | ``` 41 | 42 | 43 | ### arrayify(input) ⇒ Array ⏏ 44 | **Kind**: Exported function 45 | 46 | | Param | Type | Description | 47 | | --- | --- | --- | 48 | | input | \* | The input value to convert to an array | 49 | 50 | 51 | ### Load anywhere 52 | 53 | This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation. 54 | 55 | Node.js: 56 | 57 | ```js 58 | const arrayify = require('array-back') 59 | ``` 60 | 61 | Within Node.js with ECMAScript Module support enabled: 62 | 63 | ```js 64 | import arrayify from 'array-back' 65 | ``` 66 | 67 | Within an modern browser ECMAScript Module: 68 | 69 | ```js 70 | import arrayify from './node_modules/array-back/index.mjs' 71 | ``` 72 | 73 | Old browser (adds `window.arrayBack`): 74 | 75 | ```html 76 | 77 | ``` 78 | 79 | * * * 80 | 81 | © 2015-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown). 82 | -------------------------------------------------------------------------------- /node_modules/array-back/dist/index.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 3 | typeof define === 'function' && define.amd ? define(factory) : 4 | (global = global || self, global.arrayBack = factory()); 5 | }(this, function () { 'use strict'; 6 | 7 | /** 8 | * Takes any input and guarantees an array back. 9 | * 10 | * - Converts array-like objects (e.g. `arguments`, `Set`) to a real array. 11 | * - Converts `undefined` to an empty array. 12 | * - Converts any another other, singular value (including `null`, objects and iterables other than `Set`) into an array containing that value. 13 | * - Ignores input which is already an array. 14 | * 15 | * @module array-back 16 | * @example 17 | * > const arrayify = require('array-back') 18 | * 19 | * > arrayify(undefined) 20 | * [] 21 | * 22 | * > arrayify(null) 23 | * [ null ] 24 | * 25 | * > arrayify(0) 26 | * [ 0 ] 27 | * 28 | * > arrayify([ 1, 2 ]) 29 | * [ 1, 2 ] 30 | * 31 | * > arrayify(new Set([ 1, 2 ])) 32 | * [ 1, 2 ] 33 | * 34 | * > function f(){ return arrayify(arguments); } 35 | * > f(1,2,3) 36 | * [ 1, 2, 3 ] 37 | */ 38 | 39 | function isObject (input) { 40 | return typeof input === 'object' && input !== null 41 | } 42 | 43 | function isArrayLike (input) { 44 | return isObject(input) && typeof input.length === 'number' 45 | } 46 | 47 | /** 48 | * @param {*} - The input value to convert to an array 49 | * @returns {Array} 50 | * @alias module:array-back 51 | */ 52 | function arrayify (input) { 53 | if (Array.isArray(input)) { 54 | return input 55 | } 56 | 57 | if (input === undefined) { 58 | return [] 59 | } 60 | 61 | if (isArrayLike(input) || input instanceof Set) { 62 | return Array.from(input) 63 | } 64 | 65 | return [ input ] 66 | } 67 | 68 | return arrayify; 69 | 70 | })); 71 | -------------------------------------------------------------------------------- /node_modules/array-back/index.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * Takes any input and guarantees an array back. 3 | * 4 | * - Converts array-like objects (e.g. `arguments`, `Set`) to a real array. 5 | * - Converts `undefined` to an empty array. 6 | * - Converts any another other, singular value (including `null`, objects and iterables other than `Set`) into an array containing that value. 7 | * - Ignores input which is already an array. 8 | * 9 | * @module array-back 10 | * @example 11 | * > const arrayify = require('array-back') 12 | * 13 | * > arrayify(undefined) 14 | * [] 15 | * 16 | * > arrayify(null) 17 | * [ null ] 18 | * 19 | * > arrayify(0) 20 | * [ 0 ] 21 | * 22 | * > arrayify([ 1, 2 ]) 23 | * [ 1, 2 ] 24 | * 25 | * > arrayify(new Set([ 1, 2 ])) 26 | * [ 1, 2 ] 27 | * 28 | * > function f(){ return arrayify(arguments); } 29 | * > f(1,2,3) 30 | * [ 1, 2, 3 ] 31 | */ 32 | 33 | function isObject (input) { 34 | return typeof input === 'object' && input !== null 35 | } 36 | 37 | function isArrayLike (input) { 38 | return isObject(input) && typeof input.length === 'number' 39 | } 40 | 41 | /** 42 | * @param {*} - The input value to convert to an array 43 | * @returns {Array} 44 | * @alias module:array-back 45 | */ 46 | function arrayify (input) { 47 | if (Array.isArray(input)) { 48 | return input 49 | } 50 | 51 | if (input === undefined) { 52 | return [] 53 | } 54 | 55 | if (isArrayLike(input) || input instanceof Set) { 56 | return Array.from(input) 57 | } 58 | 59 | return [ input ] 60 | } 61 | 62 | export default arrayify 63 | -------------------------------------------------------------------------------- /node_modules/array-back/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "array-back", 3 | "author": "Lloyd Brookes <75pound@gmail.com>", 4 | "version": "3.1.0", 5 | "description": "Guarantees an array back", 6 | "repository": "https://github.com/75lb/array-back.git", 7 | "license": "MIT", 8 | "main": "dist/index.js", 9 | "keywords": [ 10 | "to", 11 | "convert", 12 | "return", 13 | "array", 14 | "arrayify" 15 | ], 16 | "engines": { 17 | "node": ">=6" 18 | }, 19 | "files": [ 20 | "index.mjs", 21 | "dist/index.js" 22 | ], 23 | "scripts": { 24 | "test": "npm run test:esm && npm run test:js", 25 | "test:esm": "node --experimental-modules test.mjs", 26 | "test:js": "npm run dist:test && node dist/test.js", 27 | "docs": "jsdoc2md -t README.hbs index.mjs -c build/jsdoc.conf > README.md; echo", 28 | "cover": "nyc test-runner test.js && nyc report --reporter=text-lcov | coveralls", 29 | "dist": "rollup -c build/index.config.js", 30 | "dist:test": "rollup -c build/test.config.js", 31 | "lint": "standard **/*.mjs" 32 | }, 33 | "dependencies": {}, 34 | "devDependencies": { 35 | "coveralls": "^3.0.3", 36 | "jsdoc-to-markdown": "^4.0.1", 37 | "rollup": "^1.9.0", 38 | "test-runner": "^0.5.1" 39 | }, 40 | "standard": { 41 | "ignore": [ 42 | "dist", 43 | "build" 44 | ] 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /node_modules/bytefield-svg/.clj-kondo/config.edn: -------------------------------------------------------------------------------- 1 | {:linters {:missing-docstring {:level :warning} 2 | :unsorted-required-namespaces {:level :warning} 3 | :single-key-in {:level :warning} 4 | :unused-namespace {:exclude [clojure.set]}}} 5 | -------------------------------------------------------------------------------- /node_modules/bytefield-svg/.clj-kondo/config.edn~: -------------------------------------------------------------------------------- 1 | {:linters {:missing-docstring {:level :warning} 2 | :unsorted-required-namespaces {:level :warning} 3 | :single-key-in {:level :warning}}} 4 | -------------------------------------------------------------------------------- /node_modules/bytefield-svg/.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: Deep-Symmetry 2 | liberapay: deep-symmetry 3 | custom: "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LG5NLFL5T372W&source=url" 4 | -------------------------------------------------------------------------------- /node_modules/bytefield-svg/.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. `macOS 10.13.6`] 28 | - Java Version [e.g. `openjdk version "11.0.5" 2019-10-15 LTS`, if running from your own JDK] 29 | - Project Version [e.g. `0.4.2`] 30 | 31 | **Additional context** 32 | Add any other context about the problem here. 33 | -------------------------------------------------------------------------------- /node_modules/bytefield-svg/.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /node_modules/bytefield-svg/.github/scripts/build_guide.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e # Exit if any command fails. 4 | 5 | # There is no point in doing this if we lack the SSH key to publish the guide. 6 | if [ "$GUIDE_SSH_KEY" != "" ]; then 7 | 8 | # Set up node dependencies 9 | npm install 10 | 11 | # If we haven't already, build bytefield-svg so we can create the 12 | # example diagrams. 13 | if [ ! -f "lib.js" ] 14 | then 15 | npm run release 16 | fi 17 | 18 | # Use it to build the documentation site. 19 | npx antora --fetch doc/github-actions.yml 20 | 21 | # Make sure there are no broken links in the versions we care about. 22 | curl https://htmltest.wjdp.uk | bash 23 | bin/htmltest 24 | 25 | # Publish it to the right place on the Deep Symmetry web server. 26 | rsync -avz doc/build/site/ guides@deepsymmetry.org:/var/www/guides/bytefield-svg/ 27 | 28 | else 29 | echo "No SSH key present, not building user guide." 30 | fi 31 | -------------------------------------------------------------------------------- /node_modules/bytefield-svg/.github/scripts/build_guide.sh~: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # If we haven't already, build bytefield-svg so we can create the 4 | # example diagrams. 5 | if [ ! -f "lib.js" ] 6 | then 7 | npm run release 8 | fi 9 | 10 | # Use it to build the documentation site. 11 | npx antora --fetch doc/github-actions.yml 12 | -------------------------------------------------------------------------------- /node_modules/bytefield-svg/.github/workflows/guide.yml: -------------------------------------------------------------------------------- 1 | name: Build and publish the user guide 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | jobs: 9 | build_guide: 10 | name: Build user guide 11 | runs-on: ubuntu-latest 12 | if: "!contains(github.event.head_commit.message, '[skip ci]')" 13 | 14 | steps: 15 | - uses: actions/checkout@v3 16 | 17 | - name: Install SSH Key 18 | uses: shimataro/ssh-key-action@v2 19 | with: 20 | key: ${{ secrets.GUIDE_SSH_KEY }} 21 | known_hosts: 'deepsymmetry.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMKq8T1IXQHNYLgO715YbxTXoVxEsJcha9h1lxyOXpa' 22 | 23 | - name: Prepare Java 24 | uses: actions/setup-java@v3 25 | with: 26 | java-version: '17' 27 | distribution: 'corretto' 28 | 29 | - name: Install clojure tools 30 | uses: DeLaGuardo/setup-clojure@10.3 31 | with: 32 | # The value must indicate a particular version of the tool, or use 'latest' 33 | # to always provision the latest version 34 | cli: 1.11.1.1224 # Clojure CLI based on tools.deps 35 | 36 | - name: Cache clojure dependencies 37 | uses: actions/cache@v3 38 | with: 39 | path: | 40 | ~/.m2/repository 41 | ~/.gitlibs 42 | ~/.deps.clj 43 | # List all files containing dependencies: 44 | key: cljdeps-${{ hashFiles('deps.edn') }} 45 | restore-keys: cljdeps- 46 | 47 | - name: Cache htmltest results 48 | uses: actions/cache@v3 49 | with: 50 | path: tmp/.htmltest 51 | key: ${{ runner.os }}-htmltest 52 | 53 | - name: Build and publish user guide 54 | env: 55 | GUIDE_SSH_KEY: ${{ secrets.GUIDE_SSH_KEY }} 56 | run: bash .github/scripts/build_guide.sh 57 | -------------------------------------------------------------------------------- /node_modules/bytefield-svg/.htmltest.yml: -------------------------------------------------------------------------------- 1 | DirectoryPath: "doc/build/site" 2 | -------------------------------------------------------------------------------- /node_modules/bytefield-svg/.htmltest.yml~: -------------------------------------------------------------------------------- 1 | DirectoryPath: "doc/build/site" 2 | IgnoreDirs: 3 | - "0.5.4" 4 | - "0.6.0" 5 | - "0.6.1" 6 | - "0.6.2" 7 | - "0.6.3" 8 | IgnoreURLs: 9 | - "//opensource.org/licenses/" 10 | - "//liberapay.com/" 11 | -------------------------------------------------------------------------------- /node_modules/bytefield-svg/.node-version: -------------------------------------------------------------------------------- 1 | 16.8.0 2 | -------------------------------------------------------------------------------- /node_modules/bytefield-svg/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at james@deepsymmetry.org. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /node_modules/bytefield-svg/cli.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | // A simple command line interface for rendering diagrams from standard input or a file, 4 | // to standard output or a file. 5 | 6 | const generate = require('./lib.js'); // The bytefield-svg DSL interpreter and diagram generator 7 | const fs = require('fs'); // Used to read and write files if needed. 8 | const commandLineArgs = require('command-line-args'); 9 | const commandLineUsage = require('command-line-usage'); 10 | 11 | // Set up definitions and parse command-line arguments before deciding how to proceed. 12 | const optionDefinitions = [{ 13 | name: 'help', 14 | alias: 'h', 15 | type: Boolean, 16 | description: 'Display this usage guide.' 17 | }, 18 | { 19 | name: 'source', 20 | alias: 's', 21 | type: String, 22 | defaultOption: true, 23 | description: 'File from which to read the diagram source, defaults to standard in.' 24 | }, 25 | { 26 | name: 'output', 27 | alias: 'o', 28 | type: String, 29 | description: 'File to which to write the SVG diagram, defaults to standard out.' 30 | }, 31 | { 32 | name: 'embedded', 33 | alias: 'e', 34 | type: Boolean, 35 | description: 'Emit a simple tag suitable for embedding in an HTML document. ' + 36 | '(The default is to emit a full SVG file with XML version and namespaces.)' 37 | } 38 | ]; 39 | const options = commandLineArgs(optionDefinitions); 40 | 41 | // Show usage if the user asked for help. 42 | if (options.help) { 43 | const usage = commandLineUsage([{ 44 | header: 'bytefield-svg', 45 | content: `Generate byte field diagrams in SVG format from a Clojure-based 46 | domain-specific language. See the project home for the language 47 | definition and examples.` 48 | }, 49 | { 50 | header: 'Options', 51 | optionList: optionDefinitions 52 | }, 53 | { 54 | content: 'Project home: {underline https://github.com/Deep-Symmetry/bytefield-svg}' 55 | } 56 | ]); 57 | console.log(usage); 58 | } else { 59 | // Actually read the source and render a diagram. 60 | const source = fs.readFileSync(options.source || 0, 'UTF-8'); 61 | const diagram = generate(source, { 62 | "embedded": options.embedded 63 | }); 64 | if (options.output) { // We were asked to write to a specific file. 65 | fs.writeFileSync(options.output, diagram, "UTF-8"); 66 | } else { // Write to standard out. 67 | process.stdout.write(diagram); 68 | } 69 | } -------------------------------------------------------------------------------- /node_modules/bytefield-svg/deps.edn: -------------------------------------------------------------------------------- 1 | ;; Clojure dependency information and source location. 2 | {:deps {thheller/shadow-cljs {:mvn/version "2.21.0"} 3 | org.clojure/clojure {:mvn/version "1.11.1"} 4 | org.clojure/tools.reader {:mvn/version "1.3.6"} 5 | analemma/analemma {:mvn/version "1.1.0"} 6 | borkdude/sci {:git/url "https://github.com/borkdude/sci.git" 7 | :sha "26944ee9e1349fecd113ac6075bd66306ce3a6f8"}} 8 | :paths ["src"] 9 | :aliases {:outdated {:extra-deps {olical/depot {:mvn/version "1.8.4"}} 10 | :main-opts ["-m" "depot.outdated.main"]}}} 11 | -------------------------------------------------------------------------------- /node_modules/bytefield-svg/doc/README.md: -------------------------------------------------------------------------------- 1 | # User Guide 2 | 3 | This holds the source for the [user 4 | guide](https://bytefield-svg.deepsymmetry.org/) that explains how to 5 | use `bytefield-svg`. 6 | 7 | It is built by [Antora](https://antora.org) by Github Actions after 8 | commits to the `main` branch, which runs the appropriate 9 | [playbook](github-actions.yml) on the [component 10 | descriptor](antora.yml) and [source](modules/ROOT). 11 | 12 | ## Building Locally 13 | 14 | If you would like to build the documentation site in order to preview 15 | changes you are making, you can use an `npm` script to do it, because 16 | `npm` has already installed the dependencies needed for building the 17 | documentation site. 18 | 19 | To build the site, `cd` into the `bytefield-svg` repository and run 20 | the following commands: 21 | 22 | npm install 23 | npm run release 24 | npm run local-docs 25 | 26 | This will install the development dependencies needed for building the 27 | module and documentation site, and then build `bytefield-svg` itself, 28 | which is needed to render the example diagrams. 29 | 30 | Running that will result in building the documentation site in the 31 | `doc/build` subdirectory, based on the current source in your 32 | repository. You can view it by telling a browser to open 33 | `doc/build/site/index.html`. 34 | -------------------------------------------------------------------------------- /node_modules/bytefield-svg/doc/antora.yml: -------------------------------------------------------------------------------- 1 | name: bytefield-svg 2 | title: Byte Field SVG Builder 3 | version: ~ 4 | display_version: 'main' 5 | prerelease: true 6 | start_page: ROOT:intro.adoc 7 | asciidoc: 8 | attributes: 9 | icons: font 10 | experimental: '' 11 | page-copyright: 2020–2023 12 | page-pagination: '' 13 | nav: 14 | - modules/ROOT/nav.adoc 15 | -------------------------------------------------------------------------------- /node_modules/bytefield-svg/doc/assets/DS-logo-github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riscv-non-isa/riscv-external-debug-security/def804c8a68a0211c21c8d9fb97ae5b526a5adff/node_modules/bytefield-svg/doc/assets/DS-logo-github.png -------------------------------------------------------------------------------- /node_modules/bytefield-svg/doc/assets/sample-byte-field.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riscv-non-isa/riscv-external-debug-security/def804c8a68a0211c21c8d9fb97ae5b526a5adff/node_modules/bytefield-svg/doc/assets/sample-byte-field.png -------------------------------------------------------------------------------- /node_modules/bytefield-svg/doc/assets/zulip-icon-circle.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /node_modules/bytefield-svg/doc/github-actions.yml: -------------------------------------------------------------------------------- 1 | site: 2 | title: bytefield-svg 3 | url: https://bytefield-svg.deepsymmetry.org 4 | start_page: bytefield-svg::intro.adoc 5 | robots: allow 6 | keys: 7 | google_analytics: G-GH4TG5EH2Q 8 | urls: 9 | redirect_facility: httpd 10 | content: 11 | sources: 12 | - url: https://github.com/Deep-Symmetry/bytefield-svg.git 13 | branches: [main, guide-*] 14 | start_path: doc 15 | antora: 16 | extensions: 17 | - require: '@antora/lunr-extension' 18 | index_latest_only: true 19 | asciidoc: 20 | extensions: 21 | - "@djencks/asciidoctor-mathjax" 22 | - ./../extension.js 23 | ui: 24 | bundle: 25 | url: https://deepsymmetry.org/media/antora/ui-bundle-3-self.zip 26 | snapshot: true 27 | -------------------------------------------------------------------------------- /node_modules/bytefield-svg/doc/local.yml: -------------------------------------------------------------------------------- 1 | site: 2 | title: bytefield-svg 3 | url: https://bytefield-svg.deepsymmetry.org 4 | start_page: bytefield-svg::intro.adoc 5 | content: 6 | sources: 7 | - url: ./.. 8 | branches: HEAD 9 | start_path: doc 10 | antora: 11 | extensions: 12 | - require: '@antora/lunr-extension' 13 | index_latest_only: true 14 | asciidoc: 15 | extensions: 16 | - "@djencks/asciidoctor-mathjax" 17 | - ./../extension.js 18 | ui: 19 | bundle: 20 | url: https://deepsymmetry.org/media/antora/ui-bundle-3-self.zip 21 | snapshot: true 22 | -------------------------------------------------------------------------------- /node_modules/bytefield-svg/doc/modules/ROOT/assets/images/DS-logo-bw-200-padded-left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riscv-non-isa/riscv-external-debug-security/def804c8a68a0211c21c8d9fb97ae5b526a5adff/node_modules/bytefield-svg/doc/modules/ROOT/assets/images/DS-logo-bw-200-padded-left.png -------------------------------------------------------------------------------- /node_modules/bytefield-svg/doc/modules/ROOT/nav.adoc: -------------------------------------------------------------------------------- 1 | * xref:intro.adoc[Introduction] 2 | * xref:values.adoc[Predefined Values] 3 | * xref:attrs.adoc[Attributes] 4 | * xref:funcs.adoc[Functions] 5 | -------------------------------------------------------------------------------- /node_modules/bytefield-svg/doc/modules/ROOT/nav.adoc~: -------------------------------------------------------------------------------- 1 | * xref:startup.adoc[Mixer and CDJ Startup] 2 | * xref:beats.adoc[Tracking BPM and Beats] 3 | * xref:vcdj.adoc[Detailed Device Status] 4 | * xref:sync.adoc[Sync and Tempo Master] 5 | * xref:track_metadata.adoc[Track Metadata] 6 | * xref:menus.adoc[Menu Requests] 7 | * xref:mixer_integration.adoc[Mixer Integration] 8 | * xref:loading_tracks.adoc[Loading Tracks] 9 | * xref:media.adoc[Media Slot Queries] 10 | * xref:missing.adoc[What’s Missing?] 11 | * xref:rekordbox-export-analysis:ROOT:exports.adoc[_Database Exports_] 12 | -------------------------------------------------------------------------------- /node_modules/bytefield-svg/doc/modules/ROOT/pages/values.adoc: -------------------------------------------------------------------------------- 1 | = Predefined Values 2 | James Elliott 3 | 4 | There are a number of predefined values that control the default 5 | behavior of the functions you use to draw byte field diagrams. They 6 | are set up as variables before your code starts running, and as 7 | described in the <>, you can change 8 | their values using https://clojuredocs.org/clojure.core/def[Clojure’s 9 | `def`] mechanism. 10 | 11 | TIP: Unless you append a specific unit type to them, 12 | https://oreillymedia.github.io/Using_SVG/guide/units.html[distances 13 | and coordinates] in SVG are interpreted as “user units”, which default 14 | in these diagrams to pixels (as if you had added `px` after the 15 | number). 16 | 17 | [cols="1m,1m,3"] 18 | |=== 19 | |Variable |Default Value |Purpose 20 | 21 | |left-margin |40 |How far from the left edge of the diagram the first 22 | box begins. This default is large enough to accommodate the row 23 | address labels for all but extremely long byte fields. If you are 24 | drawing a single row (which won’t have a row label), it’s nice to set 25 | this to `1` so the diagram is centered. 26 | 27 | |right-margin |1 |How far from the right edge of the diagram the last 28 | box ends. This default is just large enough to make sure the box 29 | boundary doesn’t get clipped. You can make it bigger if you want to 30 | draw custom content there. 31 | 32 | |bottom-margin |1 |How far from the bottom edge of the diagram the 33 | last row of boxes ends. This default is just large enough to make 34 | sure the box boundaries don’t get clipped. You can make it bigger if 35 | you want to draw custom content there. 36 | 37 | | | | 38 | 39 | |box-width |40 |How much horizontal space each box takes up. 40 | 41 | |boxes-per-row |16 |How many boxes are drawn on a row before moving to 42 | the next row. The default is 16, so that the hexadecimal row labels 43 | increment by `10` and the diagram is a nice width. If you are drawing 44 | smaller structures you can reduce this. 45 | 46 | [[column-labels]] 47 | |column-labels |["0" "1" ... "f"] |A sequence whose elements are used 48 | as the actual text of each column header in order. Although you can 49 | change this globally by redefining this value, it is more common to 50 | simply pass a different sequence (often by transforming this one) as 51 | the `:labels` attribute when calling 52 | <>. 53 | 54 | |row-height |30 |How much vertical space a row of boxes takes up. 55 | 56 | |svg-attrs |{} |A map that can contain arbitrary 57 | https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute[SVG 58 | attributes] to be added to the top-level SVG element in the diagram. 59 | For example, if you want the entire diagram to have a solid white 60 | background color rather than its transparent default, you could: 61 | 62 | `(def svg-attrs {:style "background-color:white"})` 63 | 64 | | | | 65 | 66 | |named-attributes | |See the <>. 67 | 68 | [[row-header-fn]] 69 | |row-header-fn |default-row-header-fn |The function that is called to 70 | draw the row header when necessary. See the 71 | https://github.com/Deep-Symmetry/bytefield-svg/blob/master/src/org/deepsymmetry/bytefield/core.cljs[source] 72 | for more details (near the end of the file). 73 | 74 | |=== 75 | 76 | You can `def` any other variables that might be useful to your 77 | diagrams, perhaps in a shared include file, but they won’t affect the 78 | existing drawing functions the way these values do. 79 | -------------------------------------------------------------------------------- /node_modules/bytefield-svg/extension.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | // This file is used to build the documentation site using the compiled bytefield-svg 4 | // script to draw the sample diagrams. It will only work if the project has been built 5 | // first, following the instructions in README.md. 6 | 7 | const processor = require('./lib.js'); // The compiled byte field diagram generator. 8 | 9 | // Register as a block processor of type 'bytefield' 10 | module.exports = function (registry) { 11 | 12 | function toBlock(attrs, parent, source, line_info, self) { 13 | if (typeof attrs === 'object' && '$$smap' in attrs) { 14 | attrs = fromHash(attrs) 15 | } 16 | const doc = parent.getDocument() 17 | const subs = attrs.subs 18 | if (subs) { 19 | source = doc.$apply_subs(source, doc.$resolve_subs(subs)) 20 | } 21 | var svgText 22 | try { 23 | svgText = processor(source, { 24 | "embedded": true 25 | }) 26 | } catch (err) { 27 | console.log(`error after ${line_info}: ${err.toString()}`) 28 | svgText = `error after ${line_info}: ${err.toString()}` 29 | } 30 | const idAttr = attrs.id ? ` id="${attrs.id}"` : '' 31 | const classAttr = attrs.role ? `${attrs.role} imageblock bytefield` : `imageblock bytefield` 32 | const title_el = attrs.title ? `\n
${attrs.title}
` : '' 33 | const svgBlock = self.$create_pass_block( 34 | parent, 35 | `\n
${svgText}
${title_el}\n`, 36 | // eslint-disable-next-line no-undef 37 | Opal.hash({}) 38 | ) 39 | return svgBlock 40 | } 41 | 42 | registry.block(function () { 43 | const self = this 44 | self.named('bytefield') 45 | self.onContext(['listing', 'literal']) 46 | self.process(function (parent, reader, attrs) { 47 | const line_info = reader.$line_info() 48 | var source = reader.getLines().join('\n') 49 | return toBlock(attrs, parent, source, line_info, self) 50 | }) 51 | }) 52 | } 53 | -------------------------------------------------------------------------------- /node_modules/bytefield-svg/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bytefield-svg", 3 | "version": "1.10.0", 4 | "description": "Generate byte field diagrams in SVG format from a Clojure/EDN DSL", 5 | "main": "lib.js", 6 | "bin": "cli.js", 7 | "dependencies": { 8 | "command-line-args": "^5.1.1", 9 | "command-line-usage": "^6.1.3" 10 | }, 11 | "devDependencies": { 12 | "@antora/cli": "3.1.2", 13 | "@antora/site-generator": "3.1.2", 14 | "@antora/lunr-extension": "^1.0.0-alpha.8", 15 | "@djencks/asciidoctor-mathjax": "0.0.8", 16 | "shadow-cljs": "^2.21.0", 17 | "source-map-support": "^0.5.21" 18 | }, 19 | "scripts": { 20 | "build": "shadow-cljs compile lib", 21 | "release": "shadow-cljs release lib", 22 | "local-docs": "npx antora --fetch doc/local.yml", 23 | "test": "./cli.js test.edn >test.svg" 24 | }, 25 | "repository": { 26 | "type": "git", 27 | "url": "git+https://github.com/Deep-Symmetry/bytefield-svg.git" 28 | }, 29 | "keywords": [ 30 | "diagram", 31 | "svg", 32 | "clojure", 33 | "edn" 34 | ], 35 | "author": { 36 | "name": "James Elliott", 37 | "email": "james@deepsymmetry.org" 38 | }, 39 | "license": "EPL-2.0", 40 | "bugs": { 41 | "url": "https://github.com/Deep-Symmetry/bytefield-svg/issues" 42 | }, 43 | "homepage": "https://github.com/Deep-Symmetry/bytefield-svg#readme" 44 | } 45 | -------------------------------------------------------------------------------- /node_modules/bytefield-svg/shadow-cljs.edn: -------------------------------------------------------------------------------- 1 | ;; shadow-cljs configuration 2 | {:deps true 3 | :builds {:lib {:target :node-library 4 | :output-to "lib.js" 5 | :exports-var org.deepsymmetry.bytefield.core/generate}}} 6 | -------------------------------------------------------------------------------- /node_modules/bytefield-svg/src/org/deepsymmetry/bytefield/macros.cljc: -------------------------------------------------------------------------------- 1 | (ns org.deepsymmetry.bytefield.macros 2 | "The macros used by the bytefield generator.") 3 | 4 | (defmacro self-bind-symbols 5 | "Builds a map in which each of the supplied list of symbols is mapped 6 | to itself (minus any namespace that the symbol might have had)." 7 | [syms] 8 | (let [syms-without-ns (map (comp symbol name) syms)] 9 | `(zipmap '[~@syms-without-ns] ~syms))) 10 | -------------------------------------------------------------------------------- /node_modules/bytefield-svg/test.edn: -------------------------------------------------------------------------------- 1 | ;; This the source for the sample diagram illustrated in the project Read Me. 2 | 3 | ;; Some nice default background colors, used to distinguish header sections. 4 | (defattrs :bg-green {:fill "#a0ffa0"}) 5 | (defattrs :bg-yellow {:fill "#ffffa0"}) 6 | (defattrs :bg-pink {:fill "#ffb0a0"}) 7 | (defattrs :bg-cyan {:fill "#a0fafa"}) 8 | (defattrs :bg-purple {:fill "#e4b5f7"}) 9 | 10 | (defn draw-group-label-header 11 | "Creates a small borderless box used to draw the textual label headers 12 | used below the byte labels for remotedb message diagrams. 13 | Arguments are the number of columns to span and the text of the 14 | label." 15 | [span label] 16 | (draw-box (text label [:math {:font-size 12}]) {:span span 17 | :borders #{} 18 | :height 14})) 19 | 20 | (defn draw-remotedb-header 21 | "Generates the byte and field labels and standard header fields of a 22 | request or response message for the remotedb database server with 23 | the specified kind and args values." 24 | [kind args] 25 | (draw-column-headers) 26 | (draw-group-label-header 5 "start") 27 | (draw-group-label-header 5 "TxID") 28 | (draw-group-label-header 3 "type") 29 | (draw-group-label-header 2 "args") 30 | (draw-group-label-header 1 "tags") 31 | (next-row 18) 32 | 33 | (draw-box 0x11 :bg-green) 34 | (draw-box 0x872349ae [{:span 4} :bg-green]) 35 | (draw-box 0x11 :bg-yellow) 36 | (draw-box (text "TxID" :math) [{:span 4} :bg-yellow]) 37 | (draw-box 0x10 :bg-pink) 38 | (draw-box (hex-text kind 4 :bold) [{:span 2} :bg-pink]) 39 | (draw-box 0x0f :bg-cyan) 40 | (draw-box (hex-text args 2 :bold) :bg-cyan) 41 | (draw-box 0x14 :bg-purple) 42 | 43 | (draw-box (text "0000000c" :hex [[:plain {:font-weight "light" :font-size 16}] " (12)"]) 44 | [{:span 4} :bg-purple]) 45 | (draw-box (hex-text 6 2 :bold) [:box-first :bg-purple]) 46 | (doseq [val [6 6 3 6 6 6 6 3]] 47 | (draw-box (hex-text val 2 :bold) [:box-related :bg-purple])) 48 | (doseq [val [0 0]] 49 | (draw-box val [:box-related :bg-purple])) 50 | (draw-box 0 [:box-last :bg-purple])) 51 | 52 | ;; Figure 48: Cue point response message. 53 | 54 | (draw-remotedb-header 0x4702 9) 55 | 56 | (draw-box 0x11) 57 | (draw-box 0x2104 {:span 4}) 58 | (draw-box 0x11) 59 | (draw-box 0 {:span 4}) 60 | (draw-box 0x11) 61 | (wrap-svg [:a {:href "https://deepsymmetry.org" :target "_blank"}] 62 | (draw-box (text "length" [:math] [:sub 1]) {:span 4})) 63 | (draw-box 0x14) 64 | 65 | (wrap-link "https://google.com" 66 | (draw-box (text "length" [:math] [:sub 1]) {:span 4})) 67 | (wrap-link "https://clojure.org" {:target "_blank"} 68 | (draw-gap "Cue and loop point bytes")) 69 | 70 | (draw-box nil :box-below) 71 | (draw-box 0x11) 72 | (draw-box 0x36 {:span 4}) 73 | (draw-box 0x11) 74 | (draw-box (text "num" [:math] [:sub "hot"]) {:span 4}) 75 | (draw-box 0x11) 76 | (draw-box (text "num" [:math] [:sub "cue"]) {:span 4}) 77 | 78 | (draw-box 0x11) 79 | (draw-box (text "length" [:math] [:sub 2]) {:span 4}) 80 | (draw-box 0x14) 81 | (draw-box (text "length" [:math] [:sub 2]) {:span 4}) 82 | (draw-gap "Unknown bytes" {:min-label-columns 6}) 83 | (draw-bottom) 84 | -------------------------------------------------------------------------------- /node_modules/chalk/index.js.flow: -------------------------------------------------------------------------------- 1 | // @flow strict 2 | 3 | type TemplateStringsArray = $ReadOnlyArray; 4 | 5 | export type Level = $Values<{ 6 | None: 0, 7 | Basic: 1, 8 | Ansi256: 2, 9 | TrueColor: 3 10 | }>; 11 | 12 | export type ChalkOptions = {| 13 | enabled?: boolean, 14 | level?: Level 15 | |}; 16 | 17 | export type ColorSupport = {| 18 | level: Level, 19 | hasBasic: boolean, 20 | has256: boolean, 21 | has16m: boolean 22 | |}; 23 | 24 | export interface Chalk { 25 | (...text: string[]): string, 26 | (text: TemplateStringsArray, ...placeholders: string[]): string, 27 | constructor(options?: ChalkOptions): Chalk, 28 | enabled: boolean, 29 | level: Level, 30 | rgb(r: number, g: number, b: number): Chalk, 31 | hsl(h: number, s: number, l: number): Chalk, 32 | hsv(h: number, s: number, v: number): Chalk, 33 | hwb(h: number, w: number, b: number): Chalk, 34 | bgHex(color: string): Chalk, 35 | bgKeyword(color: string): Chalk, 36 | bgRgb(r: number, g: number, b: number): Chalk, 37 | bgHsl(h: number, s: number, l: number): Chalk, 38 | bgHsv(h: number, s: number, v: number): Chalk, 39 | bgHwb(h: number, w: number, b: number): Chalk, 40 | hex(color: string): Chalk, 41 | keyword(color: string): Chalk, 42 | 43 | +reset: Chalk, 44 | +bold: Chalk, 45 | +dim: Chalk, 46 | +italic: Chalk, 47 | +underline: Chalk, 48 | +inverse: Chalk, 49 | +hidden: Chalk, 50 | +strikethrough: Chalk, 51 | 52 | +visible: Chalk, 53 | 54 | +black: Chalk, 55 | +red: Chalk, 56 | +green: Chalk, 57 | +yellow: Chalk, 58 | +blue: Chalk, 59 | +magenta: Chalk, 60 | +cyan: Chalk, 61 | +white: Chalk, 62 | +gray: Chalk, 63 | +grey: Chalk, 64 | +blackBright: Chalk, 65 | +redBright: Chalk, 66 | +greenBright: Chalk, 67 | +yellowBright: Chalk, 68 | +blueBright: Chalk, 69 | +magentaBright: Chalk, 70 | +cyanBright: Chalk, 71 | +whiteBright: Chalk, 72 | 73 | +bgBlack: Chalk, 74 | +bgRed: Chalk, 75 | +bgGreen: Chalk, 76 | +bgYellow: Chalk, 77 | +bgBlue: Chalk, 78 | +bgMagenta: Chalk, 79 | +bgCyan: Chalk, 80 | +bgWhite: Chalk, 81 | +bgBlackBright: Chalk, 82 | +bgRedBright: Chalk, 83 | +bgGreenBright: Chalk, 84 | +bgYellowBright: Chalk, 85 | +bgBlueBright: Chalk, 86 | +bgMagentaBright: Chalk, 87 | +bgCyanBright: Chalk, 88 | +bgWhiteBrigh: Chalk, 89 | 90 | supportsColor: ColorSupport 91 | }; 92 | 93 | declare module.exports: Chalk; 94 | -------------------------------------------------------------------------------- /node_modules/chalk/license: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Sindre Sorhus (sindresorhus.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /node_modules/chalk/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chalk", 3 | "version": "2.4.2", 4 | "description": "Terminal string styling done right", 5 | "license": "MIT", 6 | "repository": "chalk/chalk", 7 | "engines": { 8 | "node": ">=4" 9 | }, 10 | "scripts": { 11 | "test": "xo && tsc --project types && flow --max-warnings=0 && nyc ava", 12 | "bench": "matcha benchmark.js", 13 | "coveralls": "nyc report --reporter=text-lcov | coveralls" 14 | }, 15 | "files": [ 16 | "index.js", 17 | "templates.js", 18 | "types/index.d.ts", 19 | "index.js.flow" 20 | ], 21 | "keywords": [ 22 | "color", 23 | "colour", 24 | "colors", 25 | "terminal", 26 | "console", 27 | "cli", 28 | "string", 29 | "str", 30 | "ansi", 31 | "style", 32 | "styles", 33 | "tty", 34 | "formatting", 35 | "rgb", 36 | "256", 37 | "shell", 38 | "xterm", 39 | "log", 40 | "logging", 41 | "command-line", 42 | "text" 43 | ], 44 | "dependencies": { 45 | "ansi-styles": "^3.2.1", 46 | "escape-string-regexp": "^1.0.5", 47 | "supports-color": "^5.3.0" 48 | }, 49 | "devDependencies": { 50 | "ava": "*", 51 | "coveralls": "^3.0.0", 52 | "execa": "^0.9.0", 53 | "flow-bin": "^0.68.0", 54 | "import-fresh": "^2.0.0", 55 | "matcha": "^0.7.0", 56 | "nyc": "^11.0.2", 57 | "resolve-from": "^4.0.0", 58 | "typescript": "^2.5.3", 59 | "xo": "*" 60 | }, 61 | "types": "types/index.d.ts", 62 | "xo": { 63 | "envs": [ 64 | "node", 65 | "mocha" 66 | ], 67 | "ignores": [ 68 | "test/_flow.js" 69 | ] 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /node_modules/chalk/templates.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; 3 | const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g; 4 | const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/; 5 | const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi; 6 | 7 | const ESCAPES = new Map([ 8 | ['n', '\n'], 9 | ['r', '\r'], 10 | ['t', '\t'], 11 | ['b', '\b'], 12 | ['f', '\f'], 13 | ['v', '\v'], 14 | ['0', '\0'], 15 | ['\\', '\\'], 16 | ['e', '\u001B'], 17 | ['a', '\u0007'] 18 | ]); 19 | 20 | function unescape(c) { 21 | if ((c[0] === 'u' && c.length === 5) || (c[0] === 'x' && c.length === 3)) { 22 | return String.fromCharCode(parseInt(c.slice(1), 16)); 23 | } 24 | 25 | return ESCAPES.get(c) || c; 26 | } 27 | 28 | function parseArguments(name, args) { 29 | const results = []; 30 | const chunks = args.trim().split(/\s*,\s*/g); 31 | let matches; 32 | 33 | for (const chunk of chunks) { 34 | if (!isNaN(chunk)) { 35 | results.push(Number(chunk)); 36 | } else if ((matches = chunk.match(STRING_REGEX))) { 37 | results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr)); 38 | } else { 39 | throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`); 40 | } 41 | } 42 | 43 | return results; 44 | } 45 | 46 | function parseStyle(style) { 47 | STYLE_REGEX.lastIndex = 0; 48 | 49 | const results = []; 50 | let matches; 51 | 52 | while ((matches = STYLE_REGEX.exec(style)) !== null) { 53 | const name = matches[1]; 54 | 55 | if (matches[2]) { 56 | const args = parseArguments(name, matches[2]); 57 | results.push([name].concat(args)); 58 | } else { 59 | results.push([name]); 60 | } 61 | } 62 | 63 | return results; 64 | } 65 | 66 | function buildStyle(chalk, styles) { 67 | const enabled = {}; 68 | 69 | for (const layer of styles) { 70 | for (const style of layer.styles) { 71 | enabled[style[0]] = layer.inverse ? null : style.slice(1); 72 | } 73 | } 74 | 75 | let current = chalk; 76 | for (const styleName of Object.keys(enabled)) { 77 | if (Array.isArray(enabled[styleName])) { 78 | if (!(styleName in current)) { 79 | throw new Error(`Unknown Chalk style: ${styleName}`); 80 | } 81 | 82 | if (enabled[styleName].length > 0) { 83 | current = current[styleName].apply(current, enabled[styleName]); 84 | } else { 85 | current = current[styleName]; 86 | } 87 | } 88 | } 89 | 90 | return current; 91 | } 92 | 93 | module.exports = (chalk, tmp) => { 94 | const styles = []; 95 | const chunks = []; 96 | let chunk = []; 97 | 98 | // eslint-disable-next-line max-params 99 | tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => { 100 | if (escapeChar) { 101 | chunk.push(unescape(escapeChar)); 102 | } else if (style) { 103 | const str = chunk.join(''); 104 | chunk = []; 105 | chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str)); 106 | styles.push({inverse, styles: parseStyle(style)}); 107 | } else if (close) { 108 | if (styles.length === 0) { 109 | throw new Error('Found extraneous } in Chalk template literal'); 110 | } 111 | 112 | chunks.push(buildStyle(chalk, styles)(chunk.join(''))); 113 | chunk = []; 114 | styles.pop(); 115 | } else { 116 | chunk.push(chr); 117 | } 118 | }); 119 | 120 | chunks.push(chunk.join('')); 121 | 122 | if (styles.length > 0) { 123 | const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`; 124 | throw new Error(errMsg); 125 | } 126 | 127 | return chunks.join(''); 128 | }; 129 | -------------------------------------------------------------------------------- /node_modules/chalk/types/index.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for Chalk 2 | // Definitions by: Thomas Sauer 3 | 4 | export const enum Level { 5 | None = 0, 6 | Basic = 1, 7 | Ansi256 = 2, 8 | TrueColor = 3 9 | } 10 | 11 | export interface ChalkOptions { 12 | enabled?: boolean; 13 | level?: Level; 14 | } 15 | 16 | export interface ChalkConstructor { 17 | new (options?: ChalkOptions): Chalk; 18 | (options?: ChalkOptions): Chalk; 19 | } 20 | 21 | export interface ColorSupport { 22 | level: Level; 23 | hasBasic: boolean; 24 | has256: boolean; 25 | has16m: boolean; 26 | } 27 | 28 | export interface Chalk { 29 | (...text: string[]): string; 30 | (text: TemplateStringsArray, ...placeholders: string[]): string; 31 | constructor: ChalkConstructor; 32 | enabled: boolean; 33 | level: Level; 34 | rgb(r: number, g: number, b: number): this; 35 | hsl(h: number, s: number, l: number): this; 36 | hsv(h: number, s: number, v: number): this; 37 | hwb(h: number, w: number, b: number): this; 38 | bgHex(color: string): this; 39 | bgKeyword(color: string): this; 40 | bgRgb(r: number, g: number, b: number): this; 41 | bgHsl(h: number, s: number, l: number): this; 42 | bgHsv(h: number, s: number, v: number): this; 43 | bgHwb(h: number, w: number, b: number): this; 44 | hex(color: string): this; 45 | keyword(color: string): this; 46 | 47 | readonly reset: this; 48 | readonly bold: this; 49 | readonly dim: this; 50 | readonly italic: this; 51 | readonly underline: this; 52 | readonly inverse: this; 53 | readonly hidden: this; 54 | readonly strikethrough: this; 55 | 56 | readonly visible: this; 57 | 58 | readonly black: this; 59 | readonly red: this; 60 | readonly green: this; 61 | readonly yellow: this; 62 | readonly blue: this; 63 | readonly magenta: this; 64 | readonly cyan: this; 65 | readonly white: this; 66 | readonly gray: this; 67 | readonly grey: this; 68 | readonly blackBright: this; 69 | readonly redBright: this; 70 | readonly greenBright: this; 71 | readonly yellowBright: this; 72 | readonly blueBright: this; 73 | readonly magentaBright: this; 74 | readonly cyanBright: this; 75 | readonly whiteBright: this; 76 | 77 | readonly bgBlack: this; 78 | readonly bgRed: this; 79 | readonly bgGreen: this; 80 | readonly bgYellow: this; 81 | readonly bgBlue: this; 82 | readonly bgMagenta: this; 83 | readonly bgCyan: this; 84 | readonly bgWhite: this; 85 | readonly bgBlackBright: this; 86 | readonly bgRedBright: this; 87 | readonly bgGreenBright: this; 88 | readonly bgYellowBright: this; 89 | readonly bgBlueBright: this; 90 | readonly bgMagentaBright: this; 91 | readonly bgCyanBright: this; 92 | readonly bgWhiteBright: this; 93 | } 94 | 95 | declare const chalk: Chalk & { supportsColor: ColorSupport }; 96 | 97 | export default chalk 98 | -------------------------------------------------------------------------------- /node_modules/color-convert/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 1.0.0 - 2016-01-07 2 | 3 | - Removed: unused speed test 4 | - Added: Automatic routing between previously unsupported conversions 5 | ([#27](https://github.com/Qix-/color-convert/pull/27)) 6 | - Removed: `xxx2xxx()` and `xxx2xxxRaw()` functions 7 | ([#27](https://github.com/Qix-/color-convert/pull/27)) 8 | - Removed: `convert()` class 9 | ([#27](https://github.com/Qix-/color-convert/pull/27)) 10 | - Changed: all functions to lookup dictionary 11 | ([#27](https://github.com/Qix-/color-convert/pull/27)) 12 | - Changed: `ansi` to `ansi256` 13 | ([#27](https://github.com/Qix-/color-convert/pull/27)) 14 | - Fixed: argument grouping for functions requiring only one argument 15 | ([#27](https://github.com/Qix-/color-convert/pull/27)) 16 | 17 | # 0.6.0 - 2015-07-23 18 | 19 | - Added: methods to handle 20 | [ANSI](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors) 16/256 colors: 21 | - rgb2ansi16 22 | - rgb2ansi 23 | - hsl2ansi16 24 | - hsl2ansi 25 | - hsv2ansi16 26 | - hsv2ansi 27 | - hwb2ansi16 28 | - hwb2ansi 29 | - cmyk2ansi16 30 | - cmyk2ansi 31 | - keyword2ansi16 32 | - keyword2ansi 33 | - ansi162rgb 34 | - ansi162hsl 35 | - ansi162hsv 36 | - ansi162hwb 37 | - ansi162cmyk 38 | - ansi162keyword 39 | - ansi2rgb 40 | - ansi2hsl 41 | - ansi2hsv 42 | - ansi2hwb 43 | - ansi2cmyk 44 | - ansi2keyword 45 | ([#18](https://github.com/harthur/color-convert/pull/18)) 46 | 47 | # 0.5.3 - 2015-06-02 48 | 49 | - Fixed: hsl2hsv does not return `NaN` anymore when using `[0,0,0]` 50 | ([#15](https://github.com/harthur/color-convert/issues/15)) 51 | 52 | --- 53 | 54 | Check out commit logs for older releases 55 | -------------------------------------------------------------------------------- /node_modules/color-convert/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2016 Heather Arthur 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /node_modules/color-convert/README.md: -------------------------------------------------------------------------------- 1 | # color-convert 2 | 3 | [![Build Status](https://travis-ci.org/Qix-/color-convert.svg?branch=master)](https://travis-ci.org/Qix-/color-convert) 4 | 5 | Color-convert is a color conversion library for JavaScript and node. 6 | It converts all ways between `rgb`, `hsl`, `hsv`, `hwb`, `cmyk`, `ansi`, `ansi16`, `hex` strings, and CSS `keyword`s (will round to closest): 7 | 8 | ```js 9 | var convert = require('color-convert'); 10 | 11 | convert.rgb.hsl(140, 200, 100); // [96, 48, 59] 12 | convert.keyword.rgb('blue'); // [0, 0, 255] 13 | 14 | var rgbChannels = convert.rgb.channels; // 3 15 | var cmykChannels = convert.cmyk.channels; // 4 16 | var ansiChannels = convert.ansi16.channels; // 1 17 | ``` 18 | 19 | # Install 20 | 21 | ```console 22 | $ npm install color-convert 23 | ``` 24 | 25 | # API 26 | 27 | Simply get the property of the _from_ and _to_ conversion that you're looking for. 28 | 29 | All functions have a rounded and unrounded variant. By default, return values are rounded. To get the unrounded (raw) results, simply tack on `.raw` to the function. 30 | 31 | All 'from' functions have a hidden property called `.channels` that indicates the number of channels the function expects (not including alpha). 32 | 33 | ```js 34 | var convert = require('color-convert'); 35 | 36 | // Hex to LAB 37 | convert.hex.lab('DEADBF'); // [ 76, 21, -2 ] 38 | convert.hex.lab.raw('DEADBF'); // [ 75.56213190997677, 20.653827952644754, -2.290532499330533 ] 39 | 40 | // RGB to CMYK 41 | convert.rgb.cmyk(167, 255, 4); // [ 35, 0, 98, 0 ] 42 | convert.rgb.cmyk.raw(167, 255, 4); // [ 34.509803921568626, 0, 98.43137254901961, 0 ] 43 | ``` 44 | 45 | ### Arrays 46 | All functions that accept multiple arguments also support passing an array. 47 | 48 | Note that this does **not** apply to functions that convert from a color that only requires one value (e.g. `keyword`, `ansi256`, `hex`, etc.) 49 | 50 | ```js 51 | var convert = require('color-convert'); 52 | 53 | convert.rgb.hex(123, 45, 67); // '7B2D43' 54 | convert.rgb.hex([123, 45, 67]); // '7B2D43' 55 | ``` 56 | 57 | ## Routing 58 | 59 | Conversions that don't have an _explicitly_ defined conversion (in [conversions.js](conversions.js)), but can be converted by means of sub-conversions (e.g. XYZ -> **RGB** -> CMYK), are automatically routed together. This allows just about any color model supported by `color-convert` to be converted to any other model, so long as a sub-conversion path exists. This is also true for conversions requiring more than one step in between (e.g. LCH -> **LAB** -> **XYZ** -> **RGB** -> Hex). 60 | 61 | Keep in mind that extensive conversions _may_ result in a loss of precision, and exist only to be complete. For a list of "direct" (single-step) conversions, see [conversions.js](conversions.js). 62 | 63 | # Contribute 64 | 65 | If there is a new model you would like to support, or want to add a direct conversion between two existing models, please send us a pull request. 66 | 67 | # License 68 | Copyright © 2011-2016, Heather Arthur and Josh Junon. Licensed under the [MIT License](LICENSE). 69 | -------------------------------------------------------------------------------- /node_modules/color-convert/index.js: -------------------------------------------------------------------------------- 1 | var conversions = require('./conversions'); 2 | var route = require('./route'); 3 | 4 | var convert = {}; 5 | 6 | var models = Object.keys(conversions); 7 | 8 | function wrapRaw(fn) { 9 | var wrappedFn = function (args) { 10 | if (args === undefined || args === null) { 11 | return args; 12 | } 13 | 14 | if (arguments.length > 1) { 15 | args = Array.prototype.slice.call(arguments); 16 | } 17 | 18 | return fn(args); 19 | }; 20 | 21 | // preserve .conversion property if there is one 22 | if ('conversion' in fn) { 23 | wrappedFn.conversion = fn.conversion; 24 | } 25 | 26 | return wrappedFn; 27 | } 28 | 29 | function wrapRounded(fn) { 30 | var wrappedFn = function (args) { 31 | if (args === undefined || args === null) { 32 | return args; 33 | } 34 | 35 | if (arguments.length > 1) { 36 | args = Array.prototype.slice.call(arguments); 37 | } 38 | 39 | var result = fn(args); 40 | 41 | // we're assuming the result is an array here. 42 | // see notice in conversions.js; don't use box types 43 | // in conversion functions. 44 | if (typeof result === 'object') { 45 | for (var len = result.length, i = 0; i < len; i++) { 46 | result[i] = Math.round(result[i]); 47 | } 48 | } 49 | 50 | return result; 51 | }; 52 | 53 | // preserve .conversion property if there is one 54 | if ('conversion' in fn) { 55 | wrappedFn.conversion = fn.conversion; 56 | } 57 | 58 | return wrappedFn; 59 | } 60 | 61 | models.forEach(function (fromModel) { 62 | convert[fromModel] = {}; 63 | 64 | Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels}); 65 | Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels}); 66 | 67 | var routes = route(fromModel); 68 | var routeModels = Object.keys(routes); 69 | 70 | routeModels.forEach(function (toModel) { 71 | var fn = routes[toModel]; 72 | 73 | convert[fromModel][toModel] = wrapRounded(fn); 74 | convert[fromModel][toModel].raw = wrapRaw(fn); 75 | }); 76 | }); 77 | 78 | module.exports = convert; 79 | -------------------------------------------------------------------------------- /node_modules/color-convert/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "color-convert", 3 | "description": "Plain color conversion functions", 4 | "version": "1.9.3", 5 | "author": "Heather Arthur ", 6 | "license": "MIT", 7 | "repository": "Qix-/color-convert", 8 | "scripts": { 9 | "pretest": "xo", 10 | "test": "node test/basic.js" 11 | }, 12 | "keywords": [ 13 | "color", 14 | "colour", 15 | "convert", 16 | "converter", 17 | "conversion", 18 | "rgb", 19 | "hsl", 20 | "hsv", 21 | "hwb", 22 | "cmyk", 23 | "ansi", 24 | "ansi16" 25 | ], 26 | "files": [ 27 | "index.js", 28 | "conversions.js", 29 | "css-keywords.js", 30 | "route.js" 31 | ], 32 | "xo": { 33 | "rules": { 34 | "default-case": 0, 35 | "no-inline-comments": 0, 36 | "operator-linebreak": 0 37 | } 38 | }, 39 | "devDependencies": { 40 | "chalk": "1.1.1", 41 | "xo": "0.11.2" 42 | }, 43 | "dependencies": { 44 | "color-name": "1.1.3" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /node_modules/color-convert/route.js: -------------------------------------------------------------------------------- 1 | var conversions = require('./conversions'); 2 | 3 | /* 4 | this function routes a model to all other models. 5 | 6 | all functions that are routed have a property `.conversion` attached 7 | to the returned synthetic function. This property is an array 8 | of strings, each with the steps in between the 'from' and 'to' 9 | color models (inclusive). 10 | 11 | conversions that are not possible simply are not included. 12 | */ 13 | 14 | function buildGraph() { 15 | var graph = {}; 16 | // https://jsperf.com/object-keys-vs-for-in-with-closure/3 17 | var models = Object.keys(conversions); 18 | 19 | for (var len = models.length, i = 0; i < len; i++) { 20 | graph[models[i]] = { 21 | // http://jsperf.com/1-vs-infinity 22 | // micro-opt, but this is simple. 23 | distance: -1, 24 | parent: null 25 | }; 26 | } 27 | 28 | return graph; 29 | } 30 | 31 | // https://en.wikipedia.org/wiki/Breadth-first_search 32 | function deriveBFS(fromModel) { 33 | var graph = buildGraph(); 34 | var queue = [fromModel]; // unshift -> queue -> pop 35 | 36 | graph[fromModel].distance = 0; 37 | 38 | while (queue.length) { 39 | var current = queue.pop(); 40 | var adjacents = Object.keys(conversions[current]); 41 | 42 | for (var len = adjacents.length, i = 0; i < len; i++) { 43 | var adjacent = adjacents[i]; 44 | var node = graph[adjacent]; 45 | 46 | if (node.distance === -1) { 47 | node.distance = graph[current].distance + 1; 48 | node.parent = current; 49 | queue.unshift(adjacent); 50 | } 51 | } 52 | } 53 | 54 | return graph; 55 | } 56 | 57 | function link(from, to) { 58 | return function (args) { 59 | return to(from(args)); 60 | }; 61 | } 62 | 63 | function wrapConversion(toModel, graph) { 64 | var path = [graph[toModel].parent, toModel]; 65 | var fn = conversions[graph[toModel].parent][toModel]; 66 | 67 | var cur = graph[toModel].parent; 68 | while (graph[cur].parent) { 69 | path.unshift(graph[cur].parent); 70 | fn = link(conversions[graph[cur].parent][cur], fn); 71 | cur = graph[cur].parent; 72 | } 73 | 74 | fn.conversion = path; 75 | return fn; 76 | } 77 | 78 | module.exports = function (fromModel) { 79 | var graph = deriveBFS(fromModel); 80 | var conversion = {}; 81 | 82 | var models = Object.keys(graph); 83 | for (var len = models.length, i = 0; i < len; i++) { 84 | var toModel = models[i]; 85 | var node = graph[toModel]; 86 | 87 | if (node.parent === null) { 88 | // no possible conversion, or this node is the source model. 89 | continue; 90 | } 91 | 92 | conversion[toModel] = wrapConversion(toModel, graph); 93 | } 94 | 95 | return conversion; 96 | }; 97 | 98 | -------------------------------------------------------------------------------- /node_modules/color-name/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "node": true, 5 | "commonjs": true, 6 | "es6": true 7 | }, 8 | "extends": "eslint:recommended", 9 | "rules": { 10 | "strict": 2, 11 | "indent": 0, 12 | "linebreak-style": 0, 13 | "quotes": 0, 14 | "semi": 0, 15 | "no-cond-assign": 1, 16 | "no-constant-condition": 1, 17 | "no-duplicate-case": 1, 18 | "no-empty": 1, 19 | "no-ex-assign": 1, 20 | "no-extra-boolean-cast": 1, 21 | "no-extra-semi": 1, 22 | "no-fallthrough": 1, 23 | "no-func-assign": 1, 24 | "no-global-assign": 1, 25 | "no-implicit-globals": 2, 26 | "no-inner-declarations": ["error", "functions"], 27 | "no-irregular-whitespace": 2, 28 | "no-loop-func": 1, 29 | "no-multi-str": 1, 30 | "no-mixed-spaces-and-tabs": 1, 31 | "no-proto": 1, 32 | "no-sequences": 1, 33 | "no-throw-literal": 1, 34 | "no-unmodified-loop-condition": 1, 35 | "no-useless-call": 1, 36 | "no-void": 1, 37 | "no-with": 2, 38 | "wrap-iife": 1, 39 | "no-redeclare": 1, 40 | "no-unused-vars": ["error", { "vars": "all", "args": "none" }], 41 | "no-sparse-arrays": 1 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /node_modules/color-name/.npmignore: -------------------------------------------------------------------------------- 1 | //this will affect all the git repos 2 | git config --global core.excludesfile ~/.gitignore 3 | 4 | 5 | //update files since .ignore won't if already tracked 6 | git rm --cached 7 | 8 | # Compiled source # 9 | ################### 10 | *.com 11 | *.class 12 | *.dll 13 | *.exe 14 | *.o 15 | *.so 16 | 17 | # Packages # 18 | ############ 19 | # it's better to unpack these files and commit the raw source 20 | # git has its own built in compression methods 21 | *.7z 22 | *.dmg 23 | *.gz 24 | *.iso 25 | *.jar 26 | *.rar 27 | *.tar 28 | *.zip 29 | 30 | # Logs and databases # 31 | ###################### 32 | *.log 33 | *.sql 34 | *.sqlite 35 | 36 | # OS generated files # 37 | ###################### 38 | .DS_Store 39 | .DS_Store? 40 | ._* 41 | .Spotlight-V100 42 | .Trashes 43 | # Icon? 44 | ehthumbs.db 45 | Thumbs.db 46 | .cache 47 | .project 48 | .settings 49 | .tmproj 50 | *.esproj 51 | nbproject 52 | 53 | # Numerous always-ignore extensions # 54 | ##################################### 55 | *.diff 56 | *.err 57 | *.orig 58 | *.rej 59 | *.swn 60 | *.swo 61 | *.swp 62 | *.vi 63 | *~ 64 | *.sass-cache 65 | *.grunt 66 | *.tmp 67 | 68 | # Dreamweaver added files # 69 | ########################### 70 | _notes 71 | dwsync.xml 72 | 73 | # Komodo # 74 | ########################### 75 | *.komodoproject 76 | .komodotools 77 | 78 | # Node # 79 | ##################### 80 | node_modules 81 | 82 | # Bower # 83 | ##################### 84 | bower_components 85 | 86 | # Folders to ignore # 87 | ##################### 88 | .hg 89 | .svn 90 | .CVS 91 | intermediate 92 | publish 93 | .idea 94 | .graphics 95 | _test 96 | _archive 97 | uploads 98 | tmp 99 | 100 | # Vim files to ignore # 101 | ####################### 102 | .VimballRecord 103 | .netrwhist 104 | 105 | bundle.* 106 | 107 | _demo -------------------------------------------------------------------------------- /node_modules/color-name/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright (c) 2015 Dmitry Ivanov 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /node_modules/color-name/README.md: -------------------------------------------------------------------------------- 1 | A JSON with color names and its values. Based on http://dev.w3.org/csswg/css-color/#named-colors. 2 | 3 | [![NPM](https://nodei.co/npm/color-name.png?mini=true)](https://nodei.co/npm/color-name/) 4 | 5 | 6 | ```js 7 | var colors = require('color-name'); 8 | colors.red //[255,0,0] 9 | ``` 10 | 11 | 12 | -------------------------------------------------------------------------------- /node_modules/color-name/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "color-name", 3 | "version": "1.1.3", 4 | "description": "A list of color names and its values", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "node test.js" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git@github.com:dfcreative/color-name.git" 12 | }, 13 | "keywords": [ 14 | "color-name", 15 | "color", 16 | "color-keyword", 17 | "keyword" 18 | ], 19 | "author": "DY ", 20 | "license": "MIT", 21 | "bugs": { 22 | "url": "https://github.com/dfcreative/color-name/issues" 23 | }, 24 | "homepage": "https://github.com/dfcreative/color-name" 25 | } 26 | -------------------------------------------------------------------------------- /node_modules/color-name/test.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | var names = require('./'); 4 | var assert = require('assert'); 5 | 6 | assert.deepEqual(names.red, [255,0,0]); 7 | assert.deepEqual(names.aliceblue, [240,248,255]); 8 | -------------------------------------------------------------------------------- /node_modules/command-line-args/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-22 Lloyd Brookes <75pound@gmail.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/command-line-args/lib/option-flag.mjs: -------------------------------------------------------------------------------- 1 | import Option from './option.mjs' 2 | 3 | class FlagOption extends Option { 4 | set (val) { 5 | super.set(true) 6 | } 7 | 8 | static create (def) { 9 | return new this(def) 10 | } 11 | } 12 | 13 | export default FlagOption 14 | -------------------------------------------------------------------------------- /node_modules/command-line-args/lib/option.mjs: -------------------------------------------------------------------------------- 1 | import arrayify from '../node_modules/array-back/index.mjs' 2 | import t from '../node_modules/typical/index.mjs' 3 | import Definition from './option-definition.mjs' 4 | const _value = new WeakMap() 5 | 6 | /** 7 | * Encapsulates behaviour (defined by an OptionDefinition) when setting values 8 | */ 9 | class Option { 10 | constructor (definition) { 11 | this.definition = new Definition(definition) 12 | this.state = null /* set or default */ 13 | this.resetToDefault() 14 | } 15 | 16 | get () { 17 | return _value.get(this) 18 | } 19 | 20 | set (val) { 21 | this._set(val, 'set') 22 | } 23 | 24 | _set (val, state) { 25 | const def = this.definition 26 | if (def.isMultiple()) { 27 | /* don't add null or undefined to a multiple */ 28 | if (val !== null && val !== undefined) { 29 | const arr = this.get() 30 | if (this.state === 'default') arr.length = 0 31 | arr.push(def.type(val)) 32 | this.state = state 33 | } 34 | } else { 35 | /* throw if already set on a singlar defaultOption */ 36 | if (!def.isMultiple() && this.state === 'set') { 37 | const err = new Error(`Singular option already set [${this.definition.name}=${this.get()}]`) 38 | err.name = 'ALREADY_SET' 39 | err.value = val 40 | err.optionName = def.name 41 | throw err 42 | } else if (val === null || val === undefined) { 43 | _value.set(this, val) 44 | // /* required to make 'partial: defaultOption with value equal to defaultValue 2' pass */ 45 | // if (!(def.defaultOption && !def.isMultiple())) { 46 | // this.state = state 47 | // } 48 | } else { 49 | _value.set(this, def.type(val)) 50 | this.state = state 51 | } 52 | } 53 | } 54 | 55 | resetToDefault () { 56 | if (t.isDefined(this.definition.defaultValue)) { 57 | if (this.definition.isMultiple()) { 58 | _value.set(this, arrayify(this.definition.defaultValue).slice()) 59 | } else { 60 | _value.set(this, this.definition.defaultValue) 61 | } 62 | } else { 63 | if (this.definition.isMultiple()) { 64 | _value.set(this, []) 65 | } else { 66 | _value.set(this, null) 67 | } 68 | } 69 | this.state = 'default' 70 | } 71 | 72 | static create (definition) { 73 | definition = new Definition(definition) 74 | if (definition.isBoolean()) { 75 | return FlagOption.create(definition) 76 | } else { 77 | return new this(definition) 78 | } 79 | } 80 | } 81 | 82 | class FlagOption extends Option { 83 | set (val) { 84 | super.set(true) 85 | } 86 | 87 | static create (def) { 88 | return new this(def) 89 | } 90 | } 91 | 92 | export default Option 93 | -------------------------------------------------------------------------------- /node_modules/command-line-args/lib/output-grouped.mjs: -------------------------------------------------------------------------------- 1 | import Output from './output.mjs' 2 | import arrayify from '../node_modules/array-back/index.mjs' 3 | import t from '../node_modules/typical/index.mjs' 4 | import camelCase from 'lodash.camelcase' 5 | 6 | class GroupedOutput extends Output { 7 | toObject (options) { 8 | const superOutputNoCamel = super.toObject({ skipUnknown: options.skipUnknown }) 9 | const superOutput = super.toObject(options) 10 | const unknown = superOutput._unknown 11 | delete superOutput._unknown 12 | const grouped = { 13 | _all: superOutput 14 | } 15 | if (unknown && unknown.length) grouped._unknown = unknown 16 | 17 | this.definitions.whereGrouped().forEach(def => { 18 | const name = options.camelCase ? camelCase(def.name) : def.name 19 | const outputValue = superOutputNoCamel[def.name] 20 | for (const groupName of arrayify(def.group)) { 21 | grouped[groupName] = grouped[groupName] || {} 22 | if (t.isDefined(outputValue)) { 23 | grouped[groupName][name] = outputValue 24 | } 25 | } 26 | }) 27 | 28 | this.definitions.whereNotGrouped().forEach(def => { 29 | const name = options.camelCase ? camelCase(def.name) : def.name 30 | const outputValue = superOutputNoCamel[def.name] 31 | if (t.isDefined(outputValue)) { 32 | if (!grouped._none) grouped._none = {} 33 | grouped._none[name] = outputValue 34 | } 35 | }) 36 | return grouped 37 | } 38 | } 39 | 40 | export default GroupedOutput 41 | -------------------------------------------------------------------------------- /node_modules/command-line-args/lib/output.mjs: -------------------------------------------------------------------------------- 1 | import Option from './option.mjs' 2 | import Definitions from './option-definitions.mjs' 3 | import camelCase from 'lodash.camelcase' 4 | 5 | /** 6 | * A map of { DefinitionNameString: Option }. By default, an Output has an `_unknown` property and any options with defaultValues. 7 | */ 8 | class Output extends Map { 9 | constructor (definitions) { 10 | super() 11 | /** 12 | * @type {OptionDefinitions} 13 | */ 14 | this.definitions = Definitions.from(definitions) 15 | 16 | /* by default, an Output has an `_unknown` property and any options with defaultValues */ 17 | this.set('_unknown', Option.create({ name: '_unknown', multiple: true })) 18 | for (const def of this.definitions.whereDefaultValueSet()) { 19 | this.set(def.name, Option.create(def)) 20 | } 21 | } 22 | 23 | toObject (options) { 24 | options = options || {} 25 | const output = {} 26 | for (const item of this) { 27 | const name = options.camelCase && item[0] !== '_unknown' ? camelCase(item[0]) : item[0] 28 | const option = item[1] 29 | if (name === '_unknown' && !option.get().length) continue 30 | output[name] = option.get() 31 | } 32 | 33 | if (options.skipUnknown) delete output._unknown 34 | return output 35 | } 36 | } 37 | 38 | export default Output 39 | -------------------------------------------------------------------------------- /node_modules/command-line-args/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "command-line-args", 3 | "version": "5.2.1", 4 | "description": "A mature, feature-complete library to parse command-line options.", 5 | "repository": "https://github.com/75lb/command-line-args", 6 | "scripts": { 7 | "test": "npm run dist && npm run test:js && npm run test:mjs", 8 | "test:js": "node dist/tests.js", 9 | "test:mjs": "node --experimental-modules test/tests.mjs", 10 | "test:ci": "npm run test:js", 11 | "docs": "jsdoc2md -c jsdoc.conf index.mjs > doc/API.md && jsdoc2md -c jsdoc.conf lib/option-definition.mjs > doc/option-definition.md", 12 | "cover": "nyc --reporter=text-lcov test-runner test/*.js test/internals/*.js | coveralls", 13 | "dist": "rollup index.mjs -f cjs -e 'lodash.camelcase' -o dist/index.js && rollup index.mjs -f esm -e 'lodash.camelcase' -o dist/index.mjs && rollup test/tests.mjs -f cjs -e 'test-runner,assert,lodash.camelcase' -o dist/tests.js" 14 | }, 15 | "main": "dist/index.js", 16 | "keywords": [ 17 | "argv", 18 | "parse", 19 | "argument", 20 | "args", 21 | "option", 22 | "options", 23 | "parser", 24 | "parsing", 25 | "cli", 26 | "command", 27 | "line" 28 | ], 29 | "author": "Lloyd Brookes <75pound@gmail.com>", 30 | "license": "MIT", 31 | "engines": { 32 | "node": ">=4.0.0" 33 | }, 34 | "files": [ 35 | "index.mjs", 36 | "lib", 37 | "dist/index.js", 38 | "dist/index.mjs" 39 | ], 40 | "devDependencies": { 41 | "coveralls": "^3.1.1", 42 | "jsdoc-to-markdown": "^7.1.1", 43 | "rollup": "~1.7.4", 44 | "test-runner": "^0.5.1" 45 | }, 46 | "dependencies": { 47 | "array-back": "^3.1.0", 48 | "find-replace": "^3.0.0", 49 | "lodash.camelcase": "^4.3.0", 50 | "typical": "^4.0.0" 51 | }, 52 | "standard": { 53 | "ignore": [ 54 | "dist" 55 | ], 56 | "envs": [] 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /node_modules/command-line-usage/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015-22 Lloyd Brookes <75pound@gmail.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/command-line-usage/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module command-line-usage 3 | */ 4 | 5 | /** 6 | * Generates a usage guide suitable for a command-line app. 7 | * @param {Section|Section[]} - One or more section objects ({@link module:command-line-usage~content} or {@link module:command-line-usage~optionList}). 8 | * @returns {string} 9 | * @alias module:command-line-usage 10 | */ 11 | function commandLineUsage (sections) { 12 | const arrayify = require('array-back') 13 | sections = arrayify(sections) 14 | if (sections.length) { 15 | const OptionList = require('./lib/section/option-list') 16 | const ContentSection = require('./lib/section/content') 17 | const output = sections.map(section => { 18 | if (section.optionList) { 19 | return new OptionList(section) 20 | } else { 21 | return new ContentSection(section) 22 | } 23 | }) 24 | return '\n' + output.join('\n') 25 | } else { 26 | return '' 27 | } 28 | } 29 | 30 | module.exports = commandLineUsage 31 | -------------------------------------------------------------------------------- /node_modules/command-line-usage/lib/chalk-format.js: -------------------------------------------------------------------------------- 1 | function chalkFormat (str) { 2 | if (str) { 3 | str = str.replace(/`/g, '\\`') 4 | const chalk = require('chalk') 5 | return chalk(Object.assign([], { raw: [str] })) 6 | } else { 7 | return '' 8 | } 9 | } 10 | 11 | module.exports = chalkFormat 12 | -------------------------------------------------------------------------------- /node_modules/command-line-usage/lib/section.js: -------------------------------------------------------------------------------- 1 | class Section { 2 | constructor () { 3 | this.lines = [] 4 | } 5 | 6 | add (lines) { 7 | if (lines) { 8 | const arrayify = require('array-back') 9 | arrayify(lines).forEach(line => this.lines.push(line)) 10 | } else { 11 | this.lines.push('') 12 | } 13 | } 14 | 15 | toString () { 16 | const os = require('os') 17 | return this.lines.join(os.EOL) 18 | } 19 | 20 | header (text) { 21 | const chalk = require('chalk') 22 | if (text) { 23 | this.add(chalk.underline.bold(text)) 24 | this.add() 25 | } 26 | } 27 | } 28 | 29 | module.exports = Section 30 | -------------------------------------------------------------------------------- /node_modules/command-line-usage/node_modules/array-back/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015-19 Lloyd Brookes <75pound@gmail.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/command-line-usage/node_modules/array-back/README.hbs: -------------------------------------------------------------------------------- 1 | [![view on npm](https://img.shields.io/npm/v/array-back.svg)](https://www.npmjs.org/package/array-back) 2 | [![npm module downloads](https://img.shields.io/npm/dt/array-back.svg)](https://www.npmjs.org/package/array-back) 3 | [![Build Status](https://travis-ci.org/75lb/array-back.svg?branch=master)](https://travis-ci.org/75lb/array-back) 4 | [![Coverage Status](https://coveralls.io/repos/github/75lb/array-back/badge.svg?branch=master)](https://coveralls.io/github/75lb/array-back?branch=master) 5 | [![Dependency Status](https://badgen.net/david/dep/75lb/array-back)](https://david-dm.org/75lb/array-back) 6 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard) 7 | 8 | {{>main}} 9 | 10 | ### Load anywhere 11 | 12 | This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation. 13 | 14 | Node.js: 15 | 16 | ```js 17 | const arrayify = require('array-back') 18 | ``` 19 | 20 | Within Node.js with ECMAScript Module support enabled: 21 | 22 | ```js 23 | import arrayify from 'array-back' 24 | ``` 25 | 26 | Within an modern browser ECMAScript Module: 27 | 28 | ```js 29 | import arrayify from './node_modules/array-back/index.mjs' 30 | ``` 31 | 32 | Old browser (adds `window.arrayBack`): 33 | 34 | ```html 35 | 36 | ``` 37 | 38 | * * * 39 | 40 | © 2015-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown). 41 | -------------------------------------------------------------------------------- /node_modules/command-line-usage/node_modules/array-back/README.md: -------------------------------------------------------------------------------- 1 | [![view on npm](https://img.shields.io/npm/v/array-back.svg)](https://www.npmjs.org/package/array-back) 2 | [![npm module downloads](https://img.shields.io/npm/dt/array-back.svg)](https://www.npmjs.org/package/array-back) 3 | [![Build Status](https://travis-ci.org/75lb/array-back.svg?branch=master)](https://travis-ci.org/75lb/array-back) 4 | [![Coverage Status](https://coveralls.io/repos/github/75lb/array-back/badge.svg?branch=master)](https://coveralls.io/github/75lb/array-back?branch=master) 5 | [![Dependency Status](https://badgen.net/david/dep/75lb/array-back)](https://david-dm.org/75lb/array-back) 6 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard) 7 | 8 | 9 | 10 | ## array-back 11 | Takes any input and guarantees an array back. 12 | 13 | - Converts array-like objects (e.g. `arguments`, `Set`) to a real array. 14 | - Converts `undefined` to an empty array. 15 | - Converts any another other, singular value (including `null`, objects and iterables other than `Set`) into an array containing that value. 16 | - Ignores input which is already an array. 17 | 18 | **Example** 19 | ```js 20 | > const arrayify = require('array-back') 21 | 22 | > arrayify(undefined) 23 | [] 24 | 25 | > arrayify(null) 26 | [ null ] 27 | 28 | > arrayify(0) 29 | [ 0 ] 30 | 31 | > arrayify([ 1, 2 ]) 32 | [ 1, 2 ] 33 | 34 | > arrayify(new Set([ 1, 2 ])) 35 | [ 1, 2 ] 36 | 37 | > function f(){ return arrayify(arguments); } 38 | > f(1,2,3) 39 | [ 1, 2, 3 ] 40 | ``` 41 | 42 | 43 | ### arrayify(input) ⇒ Array ⏏ 44 | **Kind**: Exported function 45 | 46 | | Param | Type | Description | 47 | | --- | --- | --- | 48 | | input | \* | The input value to convert to an array | 49 | 50 | 51 | ### Load anywhere 52 | 53 | This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation. 54 | 55 | Node.js: 56 | 57 | ```js 58 | const arrayify = require('array-back') 59 | ``` 60 | 61 | Within Node.js with ECMAScript Module support enabled: 62 | 63 | ```js 64 | import arrayify from 'array-back' 65 | ``` 66 | 67 | Within an modern browser ECMAScript Module: 68 | 69 | ```js 70 | import arrayify from './node_modules/array-back/index.mjs' 71 | ``` 72 | 73 | Old browser (adds `window.arrayBack`): 74 | 75 | ```html 76 | 77 | ``` 78 | 79 | * * * 80 | 81 | © 2015-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown). 82 | -------------------------------------------------------------------------------- /node_modules/command-line-usage/node_modules/array-back/dist/index.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 3 | typeof define === 'function' && define.amd ? define(factory) : 4 | (global = global || self, global.arrayBack = factory()); 5 | }(this, (function () { 'use strict'; 6 | 7 | /** 8 | * Takes any input and guarantees an array back. 9 | * 10 | * - Converts array-like objects (e.g. `arguments`, `Set`) to a real array. 11 | * - Converts `undefined` to an empty array. 12 | * - Converts any another other, singular value (including `null`, objects and iterables other than `Set`) into an array containing that value. 13 | * - Ignores input which is already an array. 14 | * 15 | * @module array-back 16 | * @example 17 | * > const arrayify = require('array-back') 18 | * 19 | * > arrayify(undefined) 20 | * [] 21 | * 22 | * > arrayify(null) 23 | * [ null ] 24 | * 25 | * > arrayify(0) 26 | * [ 0 ] 27 | * 28 | * > arrayify([ 1, 2 ]) 29 | * [ 1, 2 ] 30 | * 31 | * > arrayify(new Set([ 1, 2 ])) 32 | * [ 1, 2 ] 33 | * 34 | * > function f(){ return arrayify(arguments); } 35 | * > f(1,2,3) 36 | * [ 1, 2, 3 ] 37 | */ 38 | 39 | function isObject (input) { 40 | return typeof input === 'object' && input !== null 41 | } 42 | 43 | function isArrayLike (input) { 44 | return isObject(input) && typeof input.length === 'number' 45 | } 46 | 47 | /** 48 | * @param {*} - The input value to convert to an array 49 | * @returns {Array} 50 | * @alias module:array-back 51 | */ 52 | function arrayify (input) { 53 | if (Array.isArray(input)) { 54 | return input 55 | } 56 | 57 | if (input === undefined) { 58 | return [] 59 | } 60 | 61 | if (isArrayLike(input) || input instanceof Set) { 62 | return Array.from(input) 63 | } 64 | 65 | return [input] 66 | } 67 | 68 | return arrayify; 69 | 70 | }))); 71 | -------------------------------------------------------------------------------- /node_modules/command-line-usage/node_modules/array-back/index.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * Takes any input and guarantees an array back. 3 | * 4 | * - Converts array-like objects (e.g. `arguments`, `Set`) to a real array. 5 | * - Converts `undefined` to an empty array. 6 | * - Converts any another other, singular value (including `null`, objects and iterables other than `Set`) into an array containing that value. 7 | * - Ignores input which is already an array. 8 | * 9 | * @module array-back 10 | * @example 11 | * > const arrayify = require('array-back') 12 | * 13 | * > arrayify(undefined) 14 | * [] 15 | * 16 | * > arrayify(null) 17 | * [ null ] 18 | * 19 | * > arrayify(0) 20 | * [ 0 ] 21 | * 22 | * > arrayify([ 1, 2 ]) 23 | * [ 1, 2 ] 24 | * 25 | * > arrayify(new Set([ 1, 2 ])) 26 | * [ 1, 2 ] 27 | * 28 | * > function f(){ return arrayify(arguments); } 29 | * > f(1,2,3) 30 | * [ 1, 2, 3 ] 31 | */ 32 | 33 | function isObject (input) { 34 | return typeof input === 'object' && input !== null 35 | } 36 | 37 | function isArrayLike (input) { 38 | return isObject(input) && typeof input.length === 'number' 39 | } 40 | 41 | /** 42 | * @param {*} - The input value to convert to an array 43 | * @returns {Array} 44 | * @alias module:array-back 45 | */ 46 | function arrayify (input) { 47 | if (Array.isArray(input)) { 48 | return input 49 | } 50 | 51 | if (input === undefined) { 52 | return [] 53 | } 54 | 55 | if (isArrayLike(input) || input instanceof Set) { 56 | return Array.from(input) 57 | } 58 | 59 | return [input] 60 | } 61 | 62 | export default arrayify 63 | -------------------------------------------------------------------------------- /node_modules/command-line-usage/node_modules/array-back/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "array-back", 3 | "author": "Lloyd Brookes <75pound@gmail.com>", 4 | "version": "4.0.2", 5 | "description": "Guarantees an array back", 6 | "repository": "https://github.com/75lb/array-back.git", 7 | "license": "MIT", 8 | "main": "dist/index.js", 9 | "keywords": [ 10 | "to", 11 | "convert", 12 | "return", 13 | "array", 14 | "arrayify" 15 | ], 16 | "engines": { 17 | "node": ">=8" 18 | }, 19 | "files": [ 20 | "index.mjs", 21 | "dist/index.js" 22 | ], 23 | "scripts": { 24 | "test": "npm run dist && npm run test:esm && npm run test:web", 25 | "test:esm": "esm-runner test.mjs", 26 | "test:web": "web-runner test.mjs", 27 | "docs": "jsdoc2md -t README.hbs index.mjs -c jsdoc.conf > README.md", 28 | "dist": "rollup -f umd -n arrayBack -o dist/index.js index.mjs", 29 | "cover": "c8 npm run test:esm && c8 report --reporter=text-lcov | coveralls" 30 | }, 31 | "dependencies": {}, 32 | "devDependencies": { 33 | "@test-runner/web": "^0.2.1", 34 | "c8": "^6.0.1", 35 | "coveralls": "^3.0.7", 36 | "esm-runner": "^0.2.0", 37 | "isomorphic-assert": "^0.1.1", 38 | "jsdoc-to-markdown": "^5.0.2", 39 | "rollup": "^1.26.5" 40 | }, 41 | "standard": { 42 | "ignore": [ 43 | "dist" 44 | ] 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /node_modules/command-line-usage/node_modules/typical/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-19 Lloyd Brookes <75pound@gmail.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /node_modules/command-line-usage/node_modules/typical/README.hbs: -------------------------------------------------------------------------------- 1 | [![view on npm](http://img.shields.io/npm/v/typical.svg)](https://www.npmjs.org/package/typical) 2 | [![npm module downloads](http://img.shields.io/npm/dt/typical.svg)](https://www.npmjs.org/package/typical) 3 | [![Build Status](https://travis-ci.org/75lb/typical.svg?branch=master)](https://travis-ci.org/75lb/typical) 4 | [![Coverage Status](https://coveralls.io/repos/github/75lb/typical/badge.svg?branch=master)](https://coveralls.io/github/75lb/typical?branch=master) 5 | [![Dependency Status](https://badgen.net/david/dep/75lb/typical)](https://david-dm.org/75lb/typical) 6 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard) 7 | 8 | {{>main}} 9 | 10 | ## Load anywhere 11 | 12 | This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation. 13 | 14 | Node.js: 15 | 16 | ```js 17 | const typical = require('typical') 18 | ``` 19 | 20 | Within Node.js with ECMAScript Module support enabled: 21 | 22 | ```js 23 | import typical from 'typical' 24 | ``` 25 | 26 | Within a modern browser ECMAScript Module: 27 | 28 | ```js 29 | import typical from './node_modules/typical/index.mjs' 30 | ``` 31 | 32 | Old browser (adds `window.typical`): 33 | 34 | ```html 35 | 36 | ``` 37 | 38 | * * * 39 | 40 | © 2014-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown). 41 | -------------------------------------------------------------------------------- /node_modules/command-line-usage/node_modules/typical/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "typical", 3 | "author": "Lloyd Brookes <75pound@gmail.com>", 4 | "version": "5.2.0", 5 | "description": "Isomorphic, functional type-checking for Javascript", 6 | "repository": "https://github.com/75lb/typical", 7 | "license": "MIT", 8 | "main": "dist/index.js", 9 | "keywords": [ 10 | "type", 11 | "checking", 12 | "check", 13 | "value", 14 | "valid", 15 | "is", 16 | "number", 17 | "object", 18 | "plainobject", 19 | "array", 20 | "like", 21 | "defined", 22 | "string", 23 | "boolean", 24 | "function", 25 | "promise", 26 | "iterable", 27 | "class", 28 | "primitive", 29 | "isstring", 30 | "isclass", 31 | "isiterable", 32 | "isdefined", 33 | "isobject", 34 | "isomorphic" 35 | ], 36 | "engines": { 37 | "node": ">=8" 38 | }, 39 | "scripts": { 40 | "test": "npm run dist && npm run test:js && npm run test:esm", 41 | "test:all": "npm run test:js && npm run test:esm && npm run test:web", 42 | "test:js": "rollup test/*.mjs -f cjs -d tmp/test -e assert && test-runner tmp/test/test*.js", 43 | "test:esm": "esm-runner test/*.mjs", 44 | "test:web": "web-runner test/test.mjs", 45 | "test:v8": "rollup test/test.mjs test/test-default.mjs -f cjs -d tmp/testv8 && test-runner tmp/testv8/test*.js", 46 | "dist": "rollup index.mjs -f umd -n typical -o dist/index.js --exports named", 47 | "docs": "jsdoc2md -c jsdoc.conf -t README.hbs index.mjs > README.md; echo", 48 | "cover": "nyc npm test && nyc report --reporter=text-lcov | coveralls" 49 | }, 50 | "devDependencies": { 51 | "coveralls": "^3.0.7", 52 | "esm-runner": "^0.1.5", 53 | "jsdoc-to-markdown": "^5.0.2", 54 | "nyc": "^14.1.1", 55 | "rollup": "^1.25.1", 56 | "test-object-model": "^0.4.4", 57 | "test-runner": "^0.6.0" 58 | }, 59 | "files": [ 60 | "index.mjs", 61 | "dist/index.js" 62 | ] 63 | } 64 | -------------------------------------------------------------------------------- /node_modules/command-line-usage/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "command-line-usage", 3 | "author": "Lloyd Brookes <75pound@gmail.com>", 4 | "version": "6.1.3", 5 | "description": "Generates command-line usage information", 6 | "repository": "https://github.com/75lb/command-line-usage", 7 | "license": "MIT", 8 | "files": [ 9 | "lib/**/*.js", 10 | "index.js" 11 | ], 12 | "keywords": [ 13 | "terminal", 14 | "command line", 15 | "usage", 16 | "generator" 17 | ], 18 | "engines": { 19 | "node": ">=8.0.0" 20 | }, 21 | "scripts": { 22 | "docs": "jsdoc2md --no-gfm index.js lib/**/*.js > doc/api.md; echo", 23 | "test": "test-runner test/*.js", 24 | "cover": "nyc npm test && nyc report --reporter=text-lcov | coveralls" 25 | }, 26 | "dependencies": { 27 | "array-back": "^4.0.2", 28 | "chalk": "^2.4.2", 29 | "table-layout": "^1.0.2", 30 | "typical": "^5.2.0" 31 | }, 32 | "devDependencies": { 33 | "jsdoc-to-markdown": "^7.1.1", 34 | "test-runner": "^0.6.3" 35 | }, 36 | "standard": { 37 | "ignore": [ 38 | "example" 39 | ] 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /node_modules/deep-extend/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | Changelog 2 | ========= 3 | 4 | v0.6.0 5 | ------ 6 | 7 | - Updated "devDependencies" versions to fix vulnerability alerts 8 | - Dropped support of io.js and node.js v0.12.x and lower since new versions of 9 | "devDependencies" couldn't work with those old node.js versions 10 | (minimal supported version of node.js now is v4.0.0) 11 | 12 | v0.5.1 13 | ------ 14 | 15 | - Fix prototype pollution vulnerability (thanks to @mwakerman for the PR) 16 | - Avoid using deprecated Buffer API (thanks to @ChALkeR for the PR) 17 | 18 | v0.5.0 19 | ------ 20 | 21 | - Auto-testing provided by Travis CI; 22 | - Support older Node.JS versions (`v0.11.x` and `v0.10.x`); 23 | - Removed tests files from npm package. 24 | 25 | v0.4.2 26 | ------ 27 | 28 | - Fix for `null` as an argument. 29 | 30 | v0.4.1 31 | ------ 32 | 33 | - Removed test code from npm package 34 | ([see pull request #21](https://github.com/unclechu/node-deep-extend/pull/21)); 35 | - Increased minimal version of Node from `0.4.0` to `0.12.0` 36 | (because can't run tests on lesser version anyway). 37 | 38 | v0.4.0 39 | ------ 40 | 41 | - **WARNING!** Broken backward compatibility with `v0.3.x`; 42 | - Fixed bug with extending arrays instead of cloning; 43 | - Deep cloning for arrays; 44 | - Check for own property; 45 | - Fixed some documentation issues; 46 | - Strict JS mode. 47 | -------------------------------------------------------------------------------- /node_modules/deep-extend/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-2018, Viacheslav Lotsmanov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /node_modules/deep-extend/README.md: -------------------------------------------------------------------------------- 1 | Deep Extend 2 | =========== 3 | 4 | Recursive object extending. 5 | 6 | [![Build Status](https://api.travis-ci.org/unclechu/node-deep-extend.svg?branch=master)](https://travis-ci.org/unclechu/node-deep-extend) 7 | 8 | [![NPM](https://nodei.co/npm/deep-extend.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/deep-extend/) 9 | 10 | Install 11 | ------- 12 | 13 | ```bash 14 | $ npm install deep-extend 15 | ``` 16 | 17 | Usage 18 | ----- 19 | 20 | ```javascript 21 | var deepExtend = require('deep-extend'); 22 | var obj1 = { 23 | a: 1, 24 | b: 2, 25 | d: { 26 | a: 1, 27 | b: [], 28 | c: { test1: 123, test2: 321 } 29 | }, 30 | f: 5, 31 | g: 123, 32 | i: 321, 33 | j: [1, 2] 34 | }; 35 | var obj2 = { 36 | b: 3, 37 | c: 5, 38 | d: { 39 | b: { first: 'one', second: 'two' }, 40 | c: { test2: 222 } 41 | }, 42 | e: { one: 1, two: 2 }, 43 | f: [], 44 | g: (void 0), 45 | h: /abc/g, 46 | i: null, 47 | j: [3, 4] 48 | }; 49 | 50 | deepExtend(obj1, obj2); 51 | 52 | console.log(obj1); 53 | /* 54 | { a: 1, 55 | b: 3, 56 | d: 57 | { a: 1, 58 | b: { first: 'one', second: 'two' }, 59 | c: { test1: 123, test2: 222 } }, 60 | f: [], 61 | g: undefined, 62 | c: 5, 63 | e: { one: 1, two: 2 }, 64 | h: /abc/g, 65 | i: null, 66 | j: [3, 4] } 67 | */ 68 | ``` 69 | 70 | Unit testing 71 | ------------ 72 | 73 | ```bash 74 | $ npm test 75 | ``` 76 | 77 | Changelog 78 | --------- 79 | 80 | [CHANGELOG.md](./CHANGELOG.md) 81 | 82 | Any issues? 83 | ----------- 84 | 85 | Please, report about issues 86 | [here](https://github.com/unclechu/node-deep-extend/issues). 87 | 88 | License 89 | ------- 90 | 91 | [MIT](./LICENSE) 92 | -------------------------------------------------------------------------------- /node_modules/deep-extend/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./lib/deep-extend'); 2 | -------------------------------------------------------------------------------- /node_modules/deep-extend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "deep-extend", 3 | "description": "Recursive object extending", 4 | "license": "MIT", 5 | "version": "0.6.0", 6 | "homepage": "https://github.com/unclechu/node-deep-extend", 7 | "keywords": [ 8 | "deep-extend", 9 | "extend", 10 | "deep", 11 | "recursive", 12 | "xtend", 13 | "clone", 14 | "merge", 15 | "json" 16 | ], 17 | "licenses": [ 18 | { 19 | "type": "MIT", 20 | "url": "https://raw.githubusercontent.com/unclechu/node-deep-extend/master/LICENSE" 21 | } 22 | ], 23 | "repository": { 24 | "type": "git", 25 | "url": "git://github.com/unclechu/node-deep-extend.git" 26 | }, 27 | "author": "Viacheslav Lotsmanov ", 28 | "bugs": "https://github.com/unclechu/node-deep-extend/issues", 29 | "contributors": [ 30 | { 31 | "name": "Romain Prieto", 32 | "url": "https://github.com/rprieto" 33 | }, 34 | { 35 | "name": "Max Maximov", 36 | "url": "https://github.com/maxmaximov" 37 | }, 38 | { 39 | "name": "Marshall Bowers", 40 | "url": "https://github.com/maxdeviant" 41 | }, 42 | { 43 | "name": "Misha Wakerman", 44 | "url": "https://github.com/mwakerman" 45 | } 46 | ], 47 | "main": "lib/deep-extend.js", 48 | "engines": { 49 | "node": ">=4.0.0" 50 | }, 51 | "scripts": { 52 | "test": "./node_modules/.bin/mocha" 53 | }, 54 | "devDependencies": { 55 | "mocha": "5.2.0", 56 | "should": "13.2.1" 57 | }, 58 | "files": [ 59 | "index.js", 60 | "lib/" 61 | ] 62 | } 63 | -------------------------------------------------------------------------------- /node_modules/escape-string-regexp/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; 4 | 5 | module.exports = function (str) { 6 | if (typeof str !== 'string') { 7 | throw new TypeError('Expected a string'); 8 | } 9 | 10 | return str.replace(matchOperatorsRe, '\\$&'); 11 | }; 12 | -------------------------------------------------------------------------------- /node_modules/escape-string-regexp/license: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Sindre Sorhus (sindresorhus.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/escape-string-regexp/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "escape-string-regexp", 3 | "version": "1.0.5", 4 | "description": "Escape RegExp special characters", 5 | "license": "MIT", 6 | "repository": "sindresorhus/escape-string-regexp", 7 | "author": { 8 | "name": "Sindre Sorhus", 9 | "email": "sindresorhus@gmail.com", 10 | "url": "sindresorhus.com" 11 | }, 12 | "maintainers": [ 13 | "Sindre Sorhus (sindresorhus.com)", 14 | "Joshua Boy Nicolai Appelman (jbna.nl)" 15 | ], 16 | "engines": { 17 | "node": ">=0.8.0" 18 | }, 19 | "scripts": { 20 | "test": "xo && ava" 21 | }, 22 | "files": [ 23 | "index.js" 24 | ], 25 | "keywords": [ 26 | "escape", 27 | "regex", 28 | "regexp", 29 | "re", 30 | "regular", 31 | "expression", 32 | "string", 33 | "str", 34 | "special", 35 | "characters" 36 | ], 37 | "devDependencies": { 38 | "ava": "*", 39 | "xo": "*" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /node_modules/escape-string-regexp/readme.md: -------------------------------------------------------------------------------- 1 | # escape-string-regexp [![Build Status](https://travis-ci.org/sindresorhus/escape-string-regexp.svg?branch=master)](https://travis-ci.org/sindresorhus/escape-string-regexp) 2 | 3 | > Escape RegExp special characters 4 | 5 | 6 | ## Install 7 | 8 | ``` 9 | $ npm install --save escape-string-regexp 10 | ``` 11 | 12 | 13 | ## Usage 14 | 15 | ```js 16 | const escapeStringRegexp = require('escape-string-regexp'); 17 | 18 | const escapedString = escapeStringRegexp('how much $ for a unicorn?'); 19 | //=> 'how much \$ for a unicorn\?' 20 | 21 | new RegExp(escapedString); 22 | ``` 23 | 24 | 25 | ## License 26 | 27 | MIT © [Sindre Sorhus](http://sindresorhus.com) 28 | -------------------------------------------------------------------------------- /node_modules/find-replace/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015-19 Lloyd Brookes <75pound@gmail.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/find-replace/README.hbs: -------------------------------------------------------------------------------- 1 | [![view on npm](http://img.shields.io/npm/v/find-replace.svg)](https://www.npmjs.org/package/find-replace) 2 | [![npm module downloads](http://img.shields.io/npm/dt/find-replace.svg)](https://www.npmjs.org/package/find-replace) 3 | [![Build Status](https://travis-ci.org/75lb/find-replace.svg?branch=master)](https://travis-ci.org/75lb/find-replace) 4 | [![Dependency Status](https://david-dm.org/75lb/find-replace.svg)](https://david-dm.org/75lb/find-replace) 5 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard) 6 | 7 | {{>main}} 8 | 9 | * * * 10 | 11 | © 2015-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown). 12 | -------------------------------------------------------------------------------- /node_modules/find-replace/README.md: -------------------------------------------------------------------------------- 1 | [![view on npm](http://img.shields.io/npm/v/find-replace.svg)](https://www.npmjs.org/package/find-replace) 2 | [![npm module downloads](http://img.shields.io/npm/dt/find-replace.svg)](https://www.npmjs.org/package/find-replace) 3 | [![Build Status](https://travis-ci.org/75lb/find-replace.svg?branch=master)](https://travis-ci.org/75lb/find-replace) 4 | [![Dependency Status](https://david-dm.org/75lb/find-replace.svg)](https://david-dm.org/75lb/find-replace) 5 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard) 6 | 7 | 8 | 9 | ## find-replace 10 | Find and either replace or remove items in an array. 11 | 12 | **Example** 13 | ```js 14 | > const findReplace = require('find-replace') 15 | > const numbers = [ 1, 2, 3] 16 | 17 | > findReplace(numbers, n => n === 2, 'two') 18 | [ 1, 'two', 3 ] 19 | 20 | > findReplace(numbers, n => n === 2, [ 'two', 'zwei' ]) 21 | [ 1, [ 'two', 'zwei' ], 3 ] 22 | 23 | > findReplace(numbers, n => n === 2, 'two', 'zwei') 24 | [ 1, 'two', 'zwei', 3 ] 25 | 26 | > findReplace(numbers, n => n === 2) // no replacement, so remove 27 | [ 1, 3 ] 28 | ``` 29 | 30 | 31 | ### findReplace(array, testFn, [...replaceWith]) ⇒ array ⏏ 32 | **Kind**: Exported function 33 | 34 | | Param | Type | Description | 35 | | --- | --- | --- | 36 | | array | array | The input array | 37 | | testFn | testFn | A predicate function which, if returning `true` causes the current item to be operated on. | 38 | | [...replaceWith] | any | If specified, found values will be replaced with these values, else removed. | 39 | 40 | 41 | * * * 42 | 43 | © 2015-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown). 44 | -------------------------------------------------------------------------------- /node_modules/find-replace/dist/index.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 3 | typeof define === 'function' && define.amd ? define(factory) : 4 | (global = global || self, global.findReplace = factory()); 5 | }(this, function () { 'use strict'; 6 | 7 | /** 8 | * Takes any input and guarantees an array back. 9 | * 10 | * - converts array-like objects (e.g. `arguments`) to a real array 11 | * - converts `undefined` to an empty array 12 | * - converts any another other, singular value (including `null`) into an array containing that value 13 | * - ignores input which is already an array 14 | * 15 | * @module array-back 16 | * @example 17 | * > const arrayify = require('array-back') 18 | * 19 | * > arrayify(undefined) 20 | * [] 21 | * 22 | * > arrayify(null) 23 | * [ null ] 24 | * 25 | * > arrayify(0) 26 | * [ 0 ] 27 | * 28 | * > arrayify([ 1, 2 ]) 29 | * [ 1, 2 ] 30 | * 31 | * > function f(){ return arrayify(arguments); } 32 | * > f(1,2,3) 33 | * [ 1, 2, 3 ] 34 | */ 35 | 36 | function isObject (input) { 37 | return typeof input === 'object' && input !== null 38 | } 39 | 40 | function isArrayLike (input) { 41 | return isObject(input) && typeof input.length === 'number' 42 | } 43 | 44 | /** 45 | * @param {*} - the input value to convert to an array 46 | * @returns {Array} 47 | * @alias module:array-back 48 | */ 49 | function arrayify (input) { 50 | if (Array.isArray(input)) { 51 | return input 52 | } else { 53 | if (input === undefined) { 54 | return [] 55 | } else if (isArrayLike(input)) { 56 | return Array.prototype.slice.call(input) 57 | } else { 58 | return [ input ] 59 | } 60 | } 61 | } 62 | 63 | /** 64 | * Find and either replace or remove items in an array. 65 | * 66 | * @module find-replace 67 | * @example 68 | * > const findReplace = require('find-replace') 69 | * > const numbers = [ 1, 2, 3] 70 | * 71 | * > findReplace(numbers, n => n === 2, 'two') 72 | * [ 1, 'two', 3 ] 73 | * 74 | * > findReplace(numbers, n => n === 2, [ 'two', 'zwei' ]) 75 | * [ 1, [ 'two', 'zwei' ], 3 ] 76 | * 77 | * > findReplace(numbers, n => n === 2, 'two', 'zwei') 78 | * [ 1, 'two', 'zwei', 3 ] 79 | * 80 | * > findReplace(numbers, n => n === 2) // no replacement, so remove 81 | * [ 1, 3 ] 82 | */ 83 | 84 | /** 85 | * @param {array} - The input array 86 | * @param {testFn} - A predicate function which, if returning `true` causes the current item to be operated on. 87 | * @param [replaceWith] {...any} - If specified, found values will be replaced with these values, else removed. 88 | * @returns {array} 89 | * @alias module:find-replace 90 | */ 91 | function findReplace (array, testFn) { 92 | const found = []; 93 | const replaceWiths = arrayify(arguments); 94 | replaceWiths.splice(0, 2); 95 | 96 | arrayify(array).forEach((value, index) => { 97 | let expanded = []; 98 | replaceWiths.forEach(replaceWith => { 99 | if (typeof replaceWith === 'function') { 100 | expanded = expanded.concat(replaceWith(value)); 101 | } else { 102 | expanded.push(replaceWith); 103 | } 104 | }); 105 | 106 | if (testFn(value)) { 107 | found.push({ 108 | index: index, 109 | replaceWithValue: expanded 110 | }); 111 | } 112 | }); 113 | 114 | found.reverse().forEach(item => { 115 | const spliceArgs = [ item.index, 1 ].concat(item.replaceWithValue); 116 | array.splice.apply(array, spliceArgs); 117 | }); 118 | 119 | return array 120 | } 121 | 122 | return findReplace; 123 | 124 | })); 125 | -------------------------------------------------------------------------------- /node_modules/find-replace/dist/index.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * Takes any input and guarantees an array back. 3 | * 4 | * - converts array-like objects (e.g. `arguments`) to a real array 5 | * - converts `undefined` to an empty array 6 | * - converts any another other, singular value (including `null`) into an array containing that value 7 | * - ignores input which is already an array 8 | * 9 | * @module array-back 10 | * @example 11 | * > const arrayify = require('array-back') 12 | * 13 | * > arrayify(undefined) 14 | * [] 15 | * 16 | * > arrayify(null) 17 | * [ null ] 18 | * 19 | * > arrayify(0) 20 | * [ 0 ] 21 | * 22 | * > arrayify([ 1, 2 ]) 23 | * [ 1, 2 ] 24 | * 25 | * > function f(){ return arrayify(arguments); } 26 | * > f(1,2,3) 27 | * [ 1, 2, 3 ] 28 | */ 29 | 30 | function isObject (input) { 31 | return typeof input === 'object' && input !== null 32 | } 33 | 34 | function isArrayLike (input) { 35 | return isObject(input) && typeof input.length === 'number' 36 | } 37 | 38 | /** 39 | * @param {*} - the input value to convert to an array 40 | * @returns {Array} 41 | * @alias module:array-back 42 | */ 43 | function arrayify (input) { 44 | if (Array.isArray(input)) { 45 | return input 46 | } else { 47 | if (input === undefined) { 48 | return [] 49 | } else if (isArrayLike(input)) { 50 | return Array.prototype.slice.call(input) 51 | } else { 52 | return [ input ] 53 | } 54 | } 55 | } 56 | 57 | /** 58 | * Find and either replace or remove items in an array. 59 | * 60 | * @module find-replace 61 | * @example 62 | * > const findReplace = require('find-replace') 63 | * > const numbers = [ 1, 2, 3] 64 | * 65 | * > findReplace(numbers, n => n === 2, 'two') 66 | * [ 1, 'two', 3 ] 67 | * 68 | * > findReplace(numbers, n => n === 2, [ 'two', 'zwei' ]) 69 | * [ 1, [ 'two', 'zwei' ], 3 ] 70 | * 71 | * > findReplace(numbers, n => n === 2, 'two', 'zwei') 72 | * [ 1, 'two', 'zwei', 3 ] 73 | * 74 | * > findReplace(numbers, n => n === 2) // no replacement, so remove 75 | * [ 1, 3 ] 76 | */ 77 | 78 | /** 79 | * @param {array} - The input array 80 | * @param {testFn} - A predicate function which, if returning `true` causes the current item to be operated on. 81 | * @param [replaceWith] {...any} - If specified, found values will be replaced with these values, else removed. 82 | * @returns {array} 83 | * @alias module:find-replace 84 | */ 85 | function findReplace (array, testFn) { 86 | const found = []; 87 | const replaceWiths = arrayify(arguments); 88 | replaceWiths.splice(0, 2); 89 | 90 | arrayify(array).forEach((value, index) => { 91 | let expanded = []; 92 | replaceWiths.forEach(replaceWith => { 93 | if (typeof replaceWith === 'function') { 94 | expanded = expanded.concat(replaceWith(value)); 95 | } else { 96 | expanded.push(replaceWith); 97 | } 98 | }); 99 | 100 | if (testFn(value)) { 101 | found.push({ 102 | index: index, 103 | replaceWithValue: expanded 104 | }); 105 | } 106 | }); 107 | 108 | found.reverse().forEach(item => { 109 | const spliceArgs = [ item.index, 1 ].concat(item.replaceWithValue); 110 | array.splice.apply(array, spliceArgs); 111 | }); 112 | 113 | return array 114 | } 115 | 116 | export default findReplace; 117 | -------------------------------------------------------------------------------- /node_modules/find-replace/index.mjs: -------------------------------------------------------------------------------- 1 | import arrayify from './node_modules/array-back/index.mjs' 2 | 3 | /** 4 | * Find and either replace or remove items in an array. 5 | * 6 | * @module find-replace 7 | * @example 8 | * > const findReplace = require('find-replace') 9 | * > const numbers = [ 1, 2, 3] 10 | * 11 | * > findReplace(numbers, n => n === 2, 'two') 12 | * [ 1, 'two', 3 ] 13 | * 14 | * > findReplace(numbers, n => n === 2, [ 'two', 'zwei' ]) 15 | * [ 1, [ 'two', 'zwei' ], 3 ] 16 | * 17 | * > findReplace(numbers, n => n === 2, 'two', 'zwei') 18 | * [ 1, 'two', 'zwei', 3 ] 19 | * 20 | * > findReplace(numbers, n => n === 2) // no replacement, so remove 21 | * [ 1, 3 ] 22 | */ 23 | 24 | /** 25 | * @param {array} - The input array 26 | * @param {testFn} - A predicate function which, if returning `true` causes the current item to be operated on. 27 | * @param [replaceWith] {...any} - If specified, found values will be replaced with these values, else removed. 28 | * @returns {array} 29 | * @alias module:find-replace 30 | */ 31 | function findReplace (array, testFn) { 32 | const found = [] 33 | const replaceWiths = arrayify(arguments) 34 | replaceWiths.splice(0, 2) 35 | 36 | arrayify(array).forEach((value, index) => { 37 | let expanded = [] 38 | replaceWiths.forEach(replaceWith => { 39 | if (typeof replaceWith === 'function') { 40 | expanded = expanded.concat(replaceWith(value)) 41 | } else { 42 | expanded.push(replaceWith) 43 | } 44 | }) 45 | 46 | if (testFn(value)) { 47 | found.push({ 48 | index: index, 49 | replaceWithValue: expanded 50 | }) 51 | } 52 | }) 53 | 54 | found.reverse().forEach(item => { 55 | const spliceArgs = [ item.index, 1 ].concat(item.replaceWithValue) 56 | array.splice.apply(array, spliceArgs) 57 | }) 58 | 59 | return array 60 | } 61 | 62 | export default findReplace 63 | -------------------------------------------------------------------------------- /node_modules/find-replace/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "find-replace", 3 | "author": "Lloyd Brookes <75pound@gmail.com>", 4 | "version": "3.0.0", 5 | "description": "Find and either replace or remove items in an array", 6 | "repository": "https://github.com/75lb/find-replace.git", 7 | "license": "MIT", 8 | "main": "dist/index.js", 9 | "keywords": [ 10 | "find", 11 | "replace", 12 | "array", 13 | "remove", 14 | "splice" 15 | ], 16 | "engines": { 17 | "node": ">=4.0.0" 18 | }, 19 | "scripts": { 20 | "test": "test-runner test.js", 21 | "docs": "jsdoc2md -c jsdoc.conf -t README.hbs index.mjs > README.md; echo", 22 | "dist": "rollup index.mjs -f umd -n findReplace -o dist/index.js && rollup index.mjs -f esm -o dist/index.mjs" 23 | }, 24 | "devDependencies": { 25 | "jsdoc-to-markdown": "^4.0.1", 26 | "rollup": "^1.7.0", 27 | "test-runner": "^0.5.1" 28 | }, 29 | "dependencies": { 30 | "array-back": "^3.0.1" 31 | }, 32 | "files": [ 33 | "index.mjs", 34 | "dist" 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /node_modules/has-flag/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | module.exports = (flag, argv) => { 3 | argv = argv || process.argv; 4 | const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); 5 | const pos = argv.indexOf(prefix + flag); 6 | const terminatorPos = argv.indexOf('--'); 7 | return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos); 8 | }; 9 | -------------------------------------------------------------------------------- /node_modules/has-flag/license: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Sindre Sorhus (sindresorhus.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /node_modules/has-flag/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "has-flag", 3 | "version": "3.0.0", 4 | "description": "Check if argv has a specific flag", 5 | "license": "MIT", 6 | "repository": "sindresorhus/has-flag", 7 | "author": { 8 | "name": "Sindre Sorhus", 9 | "email": "sindresorhus@gmail.com", 10 | "url": "sindresorhus.com" 11 | }, 12 | "engines": { 13 | "node": ">=4" 14 | }, 15 | "scripts": { 16 | "test": "xo && ava" 17 | }, 18 | "files": [ 19 | "index.js" 20 | ], 21 | "keywords": [ 22 | "has", 23 | "check", 24 | "detect", 25 | "contains", 26 | "find", 27 | "flag", 28 | "cli", 29 | "command-line", 30 | "argv", 31 | "process", 32 | "arg", 33 | "args", 34 | "argument", 35 | "arguments", 36 | "getopt", 37 | "minimist", 38 | "optimist" 39 | ], 40 | "devDependencies": { 41 | "ava": "*", 42 | "xo": "*" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /node_modules/has-flag/readme.md: -------------------------------------------------------------------------------- 1 | # has-flag [![Build Status](https://travis-ci.org/sindresorhus/has-flag.svg?branch=master)](https://travis-ci.org/sindresorhus/has-flag) 2 | 3 | > Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag 4 | 5 | Correctly stops looking after an `--` argument terminator. 6 | 7 | 8 | ## Install 9 | 10 | ``` 11 | $ npm install has-flag 12 | ``` 13 | 14 | 15 | ## Usage 16 | 17 | ```js 18 | // foo.js 19 | const hasFlag = require('has-flag'); 20 | 21 | hasFlag('unicorn'); 22 | //=> true 23 | 24 | hasFlag('--unicorn'); 25 | //=> true 26 | 27 | hasFlag('f'); 28 | //=> true 29 | 30 | hasFlag('-f'); 31 | //=> true 32 | 33 | hasFlag('foo=bar'); 34 | //=> true 35 | 36 | hasFlag('foo'); 37 | //=> false 38 | 39 | hasFlag('rainbow'); 40 | //=> false 41 | ``` 42 | 43 | ``` 44 | $ node foo.js -f --unicorn --foo=bar -- --rainbow 45 | ``` 46 | 47 | 48 | ## API 49 | 50 | ### hasFlag(flag, [argv]) 51 | 52 | Returns a boolean for whether the flag exists. 53 | 54 | #### flag 55 | 56 | Type: `string` 57 | 58 | CLI flag to look for. The `--` prefix is optional. 59 | 60 | #### argv 61 | 62 | Type: `string[]`
63 | Default: `process.argv` 64 | 65 | CLI arguments. 66 | 67 | 68 | ## License 69 | 70 | MIT © [Sindre Sorhus](https://sindresorhus.com) 71 | -------------------------------------------------------------------------------- /node_modules/lodash.camelcase/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright jQuery Foundation and other contributors 2 | 3 | Based on Underscore.js, copyright Jeremy Ashkenas, 4 | DocumentCloud and Investigative Reporters & Editors 5 | 6 | This software consists of voluntary contributions made by many 7 | individuals. For exact contribution history, see the revision history 8 | available at https://github.com/lodash/lodash 9 | 10 | The following license applies to all parts of this software except as 11 | documented below: 12 | 13 | ==== 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining 16 | a copy of this software and associated documentation files (the 17 | "Software"), to deal in the Software without restriction, including 18 | without limitation the rights to use, copy, modify, merge, publish, 19 | distribute, sublicense, and/or sell copies of the Software, and to 20 | permit persons to whom the Software is furnished to do so, subject to 21 | the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be 24 | included in all copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 27 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 28 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 29 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 30 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 31 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 32 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 33 | 34 | ==== 35 | 36 | Copyright and related rights for sample code are waived via CC0. Sample 37 | code is defined as all source code displayed within the prose of the 38 | documentation. 39 | 40 | CC0: http://creativecommons.org/publicdomain/zero/1.0/ 41 | 42 | ==== 43 | 44 | Files located in the node_modules and vendor directories are externally 45 | maintained libraries used by this software which have their own 46 | licenses; we recommend you read them, as their terms may differ from the 47 | terms above. 48 | -------------------------------------------------------------------------------- /node_modules/lodash.camelcase/README.md: -------------------------------------------------------------------------------- 1 | # lodash.camelcase v4.3.0 2 | 3 | The [lodash](https://lodash.com/) method `_.camelCase` exported as a [Node.js](https://nodejs.org/) module. 4 | 5 | ## Installation 6 | 7 | Using npm: 8 | ```bash 9 | $ {sudo -H} npm i -g npm 10 | $ npm i --save lodash.camelcase 11 | ``` 12 | 13 | In Node.js: 14 | ```js 15 | var camelCase = require('lodash.camelcase'); 16 | ``` 17 | 18 | See the [documentation](https://lodash.com/docs#camelCase) or [package source](https://github.com/lodash/lodash/blob/4.3.0-npm-packages/lodash.camelcase) for more details. 19 | -------------------------------------------------------------------------------- /node_modules/lodash.camelcase/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lodash.camelcase", 3 | "version": "4.3.0", 4 | "description": "The lodash method `_.camelCase` exported as a module.", 5 | "homepage": "https://lodash.com/", 6 | "icon": "https://lodash.com/icon.svg", 7 | "license": "MIT", 8 | "keywords": "lodash-modularized, camelcase", 9 | "author": "John-David Dalton (http://allyoucanleet.com/)", 10 | "contributors": [ 11 | "John-David Dalton (http://allyoucanleet.com/)", 12 | "Blaine Bublitz (https://github.com/phated)", 13 | "Mathias Bynens (https://mathiasbynens.be/)" 14 | ], 15 | "repository": "lodash/lodash", 16 | "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } 17 | } 18 | -------------------------------------------------------------------------------- /node_modules/reduce-flatten/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 6 4 | - 7 5 | - 8 6 | - 9 7 | - 10 8 | -------------------------------------------------------------------------------- /node_modules/reduce-flatten/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016-18 Lloyd Brookes <75pound@gmail.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/reduce-flatten/README.hbs: -------------------------------------------------------------------------------- 1 | [![view on npm](http://img.shields.io/npm/v/reduce-flatten.svg)](https://www.npmjs.org/package/reduce-flatten) 2 | [![npm module downloads](http://img.shields.io/npm/dt/reduce-flatten.svg)](https://www.npmjs.org/package/reduce-flatten) 3 | [![Build Status](https://travis-ci.org/75lb/reduce-flatten.svg?branch=master)](https://travis-ci.org/75lb/reduce-flatten) 4 | [![Dependency Status](https://david-dm.org/75lb/reduce-flatten.svg)](https://david-dm.org/75lb/reduce-flatten) 5 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard) 6 | 7 | {{>main}} 8 | 9 | * * * 10 | 11 | © 2016-18 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown). 12 | -------------------------------------------------------------------------------- /node_modules/reduce-flatten/README.md: -------------------------------------------------------------------------------- 1 | [![view on npm](http://img.shields.io/npm/v/reduce-flatten.svg)](https://www.npmjs.org/package/reduce-flatten) 2 | [![npm module downloads](http://img.shields.io/npm/dt/reduce-flatten.svg)](https://www.npmjs.org/package/reduce-flatten) 3 | [![Build Status](https://travis-ci.org/75lb/reduce-flatten.svg?branch=master)](https://travis-ci.org/75lb/reduce-flatten) 4 | [![Dependency Status](https://david-dm.org/75lb/reduce-flatten.svg)](https://david-dm.org/75lb/reduce-flatten) 5 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard) 6 | 7 | 8 | 9 | ## reduce-flatten 10 | Flatten an array into the supplied array. 11 | 12 | **Example** 13 | ```js 14 | const flatten = require('reduce-flatten') 15 | ``` 16 | 17 | 18 | ### flatten() ⏏ 19 | **Kind**: Exported function 20 | **Example** 21 | ```js 22 | > numbers = [ 1, 2, [ 3, 4 ], 5 ] 23 | > numbers.reduce(flatten, []) 24 | [ 1, 2, 3, 4, 5 ] 25 | ``` 26 | 27 | * * * 28 | 29 | © 2016-18 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown). 30 | -------------------------------------------------------------------------------- /node_modules/reduce-flatten/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Flatten an array into the supplied array. 3 | * 4 | * @module reduce-flatten 5 | * @example 6 | * const flatten = require('reduce-flatten') 7 | */ 8 | module.exports = flatten 9 | 10 | /** 11 | * @alias module:reduce-flatten 12 | * @example 13 | * > numbers = [ 1, 2, [ 3, 4 ], 5 ] 14 | * > numbers.reduce(flatten, []) 15 | * [ 1, 2, 3, 4, 5 ] 16 | */ 17 | function flatten (prev, curr) { 18 | return prev.concat(curr) 19 | } 20 | -------------------------------------------------------------------------------- /node_modules/reduce-flatten/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "reduce-flatten", 3 | "author": "Lloyd Brookes <75pound@gmail.com>", 4 | "version": "2.0.0", 5 | "description": "Flatten an array into the supplied array.", 6 | "repository": "https://github.com/75lb/reduce-flatten.git", 7 | "license": "MIT", 8 | "keywords": [ 9 | "array", 10 | "reduce", 11 | "flatten" 12 | ], 13 | "engines": { 14 | "node": ">=6" 15 | }, 16 | "scripts": { 17 | "test": "test-runner test.js", 18 | "docs": "jsdoc2md -t README.hbs index.js > README.md; echo" 19 | }, 20 | "devDependencies": { 21 | "jsdoc-to-markdown": "^4.0.1", 22 | "test-runner": "^0.5.0" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /node_modules/reduce-flatten/test.js: -------------------------------------------------------------------------------- 1 | const flatten = require('./') 2 | const TestRunner = require('test-runner') 3 | const a = require('assert') 4 | 5 | const runner = new TestRunner() 6 | 7 | runner.test('flatten', function () { 8 | const numbers = [ 1, 2, [ 3, 4 ], 5 ] 9 | const result = numbers.reduce(flatten, []) 10 | a.deepStrictEqual(result, [ 1, 2, 3, 4, 5 ]) 11 | }) 12 | -------------------------------------------------------------------------------- /node_modules/supports-color/browser.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | module.exports = { 3 | stdout: false, 4 | stderr: false 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/supports-color/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const os = require('os'); 3 | const hasFlag = require('has-flag'); 4 | 5 | const env = process.env; 6 | 7 | let forceColor; 8 | if (hasFlag('no-color') || 9 | hasFlag('no-colors') || 10 | hasFlag('color=false')) { 11 | forceColor = false; 12 | } else if (hasFlag('color') || 13 | hasFlag('colors') || 14 | hasFlag('color=true') || 15 | hasFlag('color=always')) { 16 | forceColor = true; 17 | } 18 | if ('FORCE_COLOR' in env) { 19 | forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0; 20 | } 21 | 22 | function translateLevel(level) { 23 | if (level === 0) { 24 | return false; 25 | } 26 | 27 | return { 28 | level, 29 | hasBasic: true, 30 | has256: level >= 2, 31 | has16m: level >= 3 32 | }; 33 | } 34 | 35 | function supportsColor(stream) { 36 | if (forceColor === false) { 37 | return 0; 38 | } 39 | 40 | if (hasFlag('color=16m') || 41 | hasFlag('color=full') || 42 | hasFlag('color=truecolor')) { 43 | return 3; 44 | } 45 | 46 | if (hasFlag('color=256')) { 47 | return 2; 48 | } 49 | 50 | if (stream && !stream.isTTY && forceColor !== true) { 51 | return 0; 52 | } 53 | 54 | const min = forceColor ? 1 : 0; 55 | 56 | if (process.platform === 'win32') { 57 | // Node.js 7.5.0 is the first version of Node.js to include a patch to 58 | // libuv that enables 256 color output on Windows. Anything earlier and it 59 | // won't work. However, here we target Node.js 8 at minimum as it is an LTS 60 | // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows 61 | // release that supports 256 colors. Windows 10 build 14931 is the first release 62 | // that supports 16m/TrueColor. 63 | const osRelease = os.release().split('.'); 64 | if ( 65 | Number(process.versions.node.split('.')[0]) >= 8 && 66 | Number(osRelease[0]) >= 10 && 67 | Number(osRelease[2]) >= 10586 68 | ) { 69 | return Number(osRelease[2]) >= 14931 ? 3 : 2; 70 | } 71 | 72 | return 1; 73 | } 74 | 75 | if ('CI' in env) { 76 | if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') { 77 | return 1; 78 | } 79 | 80 | return min; 81 | } 82 | 83 | if ('TEAMCITY_VERSION' in env) { 84 | return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; 85 | } 86 | 87 | if (env.COLORTERM === 'truecolor') { 88 | return 3; 89 | } 90 | 91 | if ('TERM_PROGRAM' in env) { 92 | const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); 93 | 94 | switch (env.TERM_PROGRAM) { 95 | case 'iTerm.app': 96 | return version >= 3 ? 3 : 2; 97 | case 'Apple_Terminal': 98 | return 2; 99 | // No default 100 | } 101 | } 102 | 103 | if (/-256(color)?$/i.test(env.TERM)) { 104 | return 2; 105 | } 106 | 107 | if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { 108 | return 1; 109 | } 110 | 111 | if ('COLORTERM' in env) { 112 | return 1; 113 | } 114 | 115 | if (env.TERM === 'dumb') { 116 | return min; 117 | } 118 | 119 | return min; 120 | } 121 | 122 | function getSupportLevel(stream) { 123 | const level = supportsColor(stream); 124 | return translateLevel(level); 125 | } 126 | 127 | module.exports = { 128 | supportsColor: getSupportLevel, 129 | stdout: getSupportLevel(process.stdout), 130 | stderr: getSupportLevel(process.stderr) 131 | }; 132 | -------------------------------------------------------------------------------- /node_modules/supports-color/license: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Sindre Sorhus (sindresorhus.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /node_modules/supports-color/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "supports-color", 3 | "version": "5.5.0", 4 | "description": "Detect whether a terminal supports color", 5 | "license": "MIT", 6 | "repository": "chalk/supports-color", 7 | "author": { 8 | "name": "Sindre Sorhus", 9 | "email": "sindresorhus@gmail.com", 10 | "url": "sindresorhus.com" 11 | }, 12 | "engines": { 13 | "node": ">=4" 14 | }, 15 | "scripts": { 16 | "test": "xo && ava" 17 | }, 18 | "files": [ 19 | "index.js", 20 | "browser.js" 21 | ], 22 | "keywords": [ 23 | "color", 24 | "colour", 25 | "colors", 26 | "terminal", 27 | "console", 28 | "cli", 29 | "ansi", 30 | "styles", 31 | "tty", 32 | "rgb", 33 | "256", 34 | "shell", 35 | "xterm", 36 | "command-line", 37 | "support", 38 | "supports", 39 | "capability", 40 | "detect", 41 | "truecolor", 42 | "16m" 43 | ], 44 | "dependencies": { 45 | "has-flag": "^3.0.0" 46 | }, 47 | "devDependencies": { 48 | "ava": "^0.25.0", 49 | "import-fresh": "^2.0.0", 50 | "xo": "^0.20.0" 51 | }, 52 | "browser": "browser.js" 53 | } 54 | -------------------------------------------------------------------------------- /node_modules/supports-color/readme.md: -------------------------------------------------------------------------------- 1 | # supports-color [![Build Status](https://travis-ci.org/chalk/supports-color.svg?branch=master)](https://travis-ci.org/chalk/supports-color) 2 | 3 | > Detect whether a terminal supports color 4 | 5 | 6 | ## Install 7 | 8 | ``` 9 | $ npm install supports-color 10 | ``` 11 | 12 | 13 | ## Usage 14 | 15 | ```js 16 | const supportsColor = require('supports-color'); 17 | 18 | if (supportsColor.stdout) { 19 | console.log('Terminal stdout supports color'); 20 | } 21 | 22 | if (supportsColor.stdout.has256) { 23 | console.log('Terminal stdout supports 256 colors'); 24 | } 25 | 26 | if (supportsColor.stderr.has16m) { 27 | console.log('Terminal stderr supports 16 million colors (truecolor)'); 28 | } 29 | ``` 30 | 31 | 32 | ## API 33 | 34 | Returns an `Object` with a `stdout` and `stderr` property for testing either streams. Each property is an `Object`, or `false` if color is not supported. 35 | 36 | The `stdout`/`stderr` objects specifies a level of support for color through a `.level` property and a corresponding flag: 37 | 38 | - `.level = 1` and `.hasBasic = true`: Basic color support (16 colors) 39 | - `.level = 2` and `.has256 = true`: 256 color support 40 | - `.level = 3` and `.has16m = true`: Truecolor support (16 million colors) 41 | 42 | 43 | ## Info 44 | 45 | It obeys the `--color` and `--no-color` CLI flags. 46 | 47 | Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, add the environment variable `FORCE_COLOR=1` to forcefully enable color or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks. 48 | 49 | Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively. 50 | 51 | 52 | ## Related 53 | 54 | - [supports-color-cli](https://github.com/chalk/supports-color-cli) - CLI for this module 55 | - [chalk](https://github.com/chalk/chalk) - Terminal string styling done right 56 | 57 | 58 | ## Maintainers 59 | 60 | - [Sindre Sorhus](https://github.com/sindresorhus) 61 | - [Josh Junon](https://github.com/qix-) 62 | 63 | 64 | ## License 65 | 66 | MIT 67 | -------------------------------------------------------------------------------- /node_modules/table-layout/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015-21 Lloyd Brookes <75pound@gmail.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/table-layout/README.hbs: -------------------------------------------------------------------------------- 1 | [![view on npm](https://badgen.net/npm/v/table-layout)](https://www.npmjs.org/package/table-layout) 2 | [![npm module downloads](https://badgen.net/npm/dt/table-layout)](https://www.npmjs.org/package/table-layout) 3 | [![Gihub repo dependents](https://badgen.net/github/dependents-repo/75lb/table-layout)](https://github.com/75lb/table-layout/network/dependents?dependent_type=REPOSITORY) 4 | [![Gihub package dependents](https://badgen.net/github/dependents-pkg/75lb/table-layout)](https://github.com/75lb/table-layout/network/dependents?dependent_type=PACKAGE) 5 | [![Build Status](https://travis-ci.org/75lb/table-layout.svg?branch=master)](https://travis-ci.org/75lb/table-layout) 6 | [![Coverage Status](https://coveralls.io/repos/github/75lb/table-layout/badge.svg)](https://coveralls.io/github/75lb/table-layout) 7 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard) 8 | 9 | # table-layout 10 | 11 | Generates plain-text tables from JSON recordset input (array of objects). Useful for presenting text in column layout or data in table layout in text-based user interfaces. Also [available as a command-line tool](https://github.com/75lb/table-layout-cli). 12 | 13 | ## Synopsis 14 | 15 | Where input looks like this: 16 | 17 | ```json 18 | [ 19 | { 20 | "number": 15134, 21 | "title": "Coveralls has no source available ", 22 | "login": "ndelangen", 23 | "comments": 0 24 | }, 25 | { 26 | "number": 15133, 27 | "title": "Fixing --preserve-symlinks. Enhancing node to exploit.", 28 | "login": "phestermcs", 29 | "comments": 0 30 | }, 31 | { 32 | "number": 15131, 33 | "title": "Question - Confused about NPM's local installation philosophy", 34 | "login": "the1mills", 35 | "comments": 0 36 | }, 37 | { 38 | "number": 15130, 39 | "title": "Question - global npm cache directory if user is root?", 40 | "login": "ORESoftware", 41 | "comments": 0 42 | } 43 | ] 44 | ``` 45 | 46 | This code... 47 | 48 | ```js 49 | const Table = require('table-layout') 50 | const issues = require('./issues.json') 51 | const table = new Table(issues, { maxWidth: 60 }) 52 | console.log(table.toString()) 53 | ``` 54 | 55 | ...produces this output: 56 | 57 | ``` 58 | 15134 Coveralls has no source available ndelangen 0 59 | 15133 Fixing --preserve-symlinks. phestermcs 0 60 | Enhancing node to exploit. 61 | 15131 Question - Confused about NPM's the1mills 0 62 | local installation philosophy 63 | 15130 Question - global npm cache ORESoftware 0 64 | directory if user is root? 65 | 15127 how to installa gulp fontfacegen aramgreat 0 66 | on Windows 10 67 | 15097 Cannot install package from mastertinner 3 68 | tarball out of package.json entry 69 | generated by npm 70 | 15067 npm "SELF_SIGNED_CERT_IN_CHAIN" LegendsLyfe 3 71 | error when installing discord.js 72 | with .log 73 | ``` 74 | 75 | ## API Reference 76 | {{#module name="table-layout"}} 77 | {{>body~}} 78 | {{>member-index~}} 79 | {{>members~}} 80 | {{/module}} 81 | 82 | * * * 83 | 84 | © 2015-21 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown). 85 | -------------------------------------------------------------------------------- /node_modules/table-layout/lib/ansi.js: -------------------------------------------------------------------------------- 1 | const ansiEscapeSequence = /\u001b.*?m/g 2 | 3 | /** 4 | * @module ansi 5 | */ 6 | exports.remove = remove 7 | exports.has = has 8 | 9 | function remove (input) { 10 | return input.replace(ansiEscapeSequence, '') 11 | } 12 | 13 | function has (input) { 14 | return ansiEscapeSequence.test(input) 15 | } 16 | -------------------------------------------------------------------------------- /node_modules/table-layout/lib/cell.js: -------------------------------------------------------------------------------- 1 | const t = require('typical') 2 | 3 | const _value = new WeakMap() 4 | const _column = new WeakMap() 5 | 6 | class Cell { 7 | constructor (value, column) { 8 | this.value = value 9 | _column.set(this, column) 10 | } 11 | 12 | set value (val) { 13 | _value.set(this, val) 14 | } 15 | 16 | get value () { 17 | let cellValue = _value.get(this) 18 | if (typeof cellValue === 'function') cellValue = cellValue.call(_column.get(this)) 19 | if (cellValue === undefined) { 20 | cellValue = '' 21 | } else { 22 | cellValue = String(cellValue) 23 | } 24 | return cellValue 25 | } 26 | } 27 | 28 | module.exports = Cell 29 | -------------------------------------------------------------------------------- /node_modules/table-layout/lib/column.js: -------------------------------------------------------------------------------- 1 | const t = require('typical') 2 | const Padding = require('./padding') 3 | 4 | /** 5 | * @module column 6 | */ 7 | 8 | const _padding = new WeakMap() 9 | 10 | // setting any column property which is a factor of the width should trigger autoSize() 11 | 12 | /** 13 | * Represents a table column 14 | */ 15 | class Column { 16 | constructor (column) { 17 | /** 18 | * @type {string} 19 | */ 20 | if (t.isDefined(column.name)) this.name = column.name 21 | /** 22 | * @type {number} 23 | */ 24 | if (t.isDefined(column.width)) this.width = column.width 25 | if (t.isDefined(column.maxWidth)) this.maxWidth = column.maxWidth 26 | if (t.isDefined(column.minWidth)) this.minWidth = column.minWidth 27 | if (t.isDefined(column.noWrap)) this.noWrap = column.noWrap 28 | if (t.isDefined(column.break)) this.break = column.break 29 | if (t.isDefined(column.contentWrappable)) this.contentWrappable = column.contentWrappable 30 | if (t.isDefined(column.contentWidth)) this.contentWidth = column.contentWidth 31 | if (t.isDefined(column.minContentWidth)) this.minContentWidth = column.minContentWidth 32 | this.padding = column.padding || { left: ' ', right: ' ' } 33 | this.generatedWidth = null 34 | } 35 | 36 | set padding (padding) { 37 | _padding.set(this, new Padding(padding)) 38 | } 39 | get padding () { 40 | return _padding.get(this) 41 | } 42 | 43 | /** 44 | * the width of the content (excluding padding) after being wrapped 45 | */ 46 | get wrappedContentWidth () { 47 | return Math.max(this.generatedWidth - this.padding.length(), 0) 48 | } 49 | 50 | isResizable () { 51 | return !this.isFixed() 52 | } 53 | 54 | isFixed () { 55 | return t.isDefined(this.width) || this.noWrap || !this.contentWrappable 56 | } 57 | 58 | generateWidth () { 59 | this.generatedWidth = this.width || (this.contentWidth + this.padding.length()) 60 | } 61 | 62 | generateMinWidth () { 63 | this.minWidth = this.minContentWidth + this.padding.length() 64 | } 65 | } 66 | 67 | module.exports = Column 68 | -------------------------------------------------------------------------------- /node_modules/table-layout/lib/padding.js: -------------------------------------------------------------------------------- 1 | class Padding { 2 | constructor (padding) { 3 | this.left = padding.left 4 | this.right = padding.right 5 | } 6 | length () { 7 | return this.left.length + this.right.length 8 | } 9 | } 10 | 11 | /** 12 | @module padding 13 | */ 14 | module.exports = Padding 15 | -------------------------------------------------------------------------------- /node_modules/table-layout/lib/rows.js: -------------------------------------------------------------------------------- 1 | const arrayify = require('array-back') 2 | const Cell = require('./cell') 3 | const t = require('typical') 4 | 5 | /** 6 | * 7 | */ 8 | class Rows { 9 | constructor (rows, columns) { 10 | this.list = [] 11 | this.load(rows, columns) 12 | } 13 | 14 | load (rows, columns) { 15 | arrayify(rows).forEach(row => { 16 | this.list.push(new Map(objectToIterable(row, columns))) 17 | }) 18 | } 19 | 20 | static removeEmptyColumns (data) { 21 | const distinctColumnNames = data.reduce((columnNames, row) => { 22 | Object.keys(row).forEach(key => { 23 | if (columnNames.indexOf(key) === -1) columnNames.push(key) 24 | }) 25 | return columnNames 26 | }, []) 27 | 28 | const emptyColumns = distinctColumnNames.filter(columnName => { 29 | const hasValue = data.some(row => { 30 | const value = row[columnName] 31 | return (t.isDefined(value) && typeof value !== 'string') || (typeof value === 'string' && /\S+/.test(value)) 32 | }) 33 | return !hasValue 34 | }) 35 | 36 | return data.map(row => { 37 | emptyColumns.forEach(emptyCol => delete row[emptyCol]) 38 | return row 39 | }) 40 | } 41 | } 42 | 43 | function objectToIterable (row, columns) { 44 | return columns.list.map(column => { 45 | return [ column, new Cell(row[column.name], column) ] 46 | }) 47 | } 48 | 49 | /** 50 | * @module rows 51 | */ 52 | module.exports = Rows 53 | -------------------------------------------------------------------------------- /node_modules/table-layout/node_modules/array-back/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015-19 Lloyd Brookes <75pound@gmail.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/table-layout/node_modules/array-back/README.hbs: -------------------------------------------------------------------------------- 1 | [![view on npm](https://img.shields.io/npm/v/array-back.svg)](https://www.npmjs.org/package/array-back) 2 | [![npm module downloads](https://img.shields.io/npm/dt/array-back.svg)](https://www.npmjs.org/package/array-back) 3 | [![Build Status](https://travis-ci.org/75lb/array-back.svg?branch=master)](https://travis-ci.org/75lb/array-back) 4 | [![Coverage Status](https://coveralls.io/repos/github/75lb/array-back/badge.svg?branch=master)](https://coveralls.io/github/75lb/array-back?branch=master) 5 | [![Dependency Status](https://badgen.net/david/dep/75lb/array-back)](https://david-dm.org/75lb/array-back) 6 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard) 7 | 8 | {{>main}} 9 | 10 | ### Load anywhere 11 | 12 | This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation. 13 | 14 | Node.js: 15 | 16 | ```js 17 | const arrayify = require('array-back') 18 | ``` 19 | 20 | Within Node.js with ECMAScript Module support enabled: 21 | 22 | ```js 23 | import arrayify from 'array-back' 24 | ``` 25 | 26 | Within an modern browser ECMAScript Module: 27 | 28 | ```js 29 | import arrayify from './node_modules/array-back/index.mjs' 30 | ``` 31 | 32 | Old browser (adds `window.arrayBack`): 33 | 34 | ```html 35 | 36 | ``` 37 | 38 | * * * 39 | 40 | © 2015-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown). 41 | -------------------------------------------------------------------------------- /node_modules/table-layout/node_modules/array-back/README.md: -------------------------------------------------------------------------------- 1 | [![view on npm](https://img.shields.io/npm/v/array-back.svg)](https://www.npmjs.org/package/array-back) 2 | [![npm module downloads](https://img.shields.io/npm/dt/array-back.svg)](https://www.npmjs.org/package/array-back) 3 | [![Build Status](https://travis-ci.org/75lb/array-back.svg?branch=master)](https://travis-ci.org/75lb/array-back) 4 | [![Coverage Status](https://coveralls.io/repos/github/75lb/array-back/badge.svg?branch=master)](https://coveralls.io/github/75lb/array-back?branch=master) 5 | [![Dependency Status](https://badgen.net/david/dep/75lb/array-back)](https://david-dm.org/75lb/array-back) 6 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard) 7 | 8 | 9 | 10 | ## array-back 11 | Takes any input and guarantees an array back. 12 | 13 | - Converts array-like objects (e.g. `arguments`, `Set`) to a real array. 14 | - Converts `undefined` to an empty array. 15 | - Converts any another other, singular value (including `null`, objects and iterables other than `Set`) into an array containing that value. 16 | - Ignores input which is already an array. 17 | 18 | **Example** 19 | ```js 20 | > const arrayify = require('array-back') 21 | 22 | > arrayify(undefined) 23 | [] 24 | 25 | > arrayify(null) 26 | [ null ] 27 | 28 | > arrayify(0) 29 | [ 0 ] 30 | 31 | > arrayify([ 1, 2 ]) 32 | [ 1, 2 ] 33 | 34 | > arrayify(new Set([ 1, 2 ])) 35 | [ 1, 2 ] 36 | 37 | > function f(){ return arrayify(arguments); } 38 | > f(1,2,3) 39 | [ 1, 2, 3 ] 40 | ``` 41 | 42 | 43 | ### arrayify(input) ⇒ Array ⏏ 44 | **Kind**: Exported function 45 | 46 | | Param | Type | Description | 47 | | --- | --- | --- | 48 | | input | \* | The input value to convert to an array | 49 | 50 | 51 | ### Load anywhere 52 | 53 | This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation. 54 | 55 | Node.js: 56 | 57 | ```js 58 | const arrayify = require('array-back') 59 | ``` 60 | 61 | Within Node.js with ECMAScript Module support enabled: 62 | 63 | ```js 64 | import arrayify from 'array-back' 65 | ``` 66 | 67 | Within an modern browser ECMAScript Module: 68 | 69 | ```js 70 | import arrayify from './node_modules/array-back/index.mjs' 71 | ``` 72 | 73 | Old browser (adds `window.arrayBack`): 74 | 75 | ```html 76 | 77 | ``` 78 | 79 | * * * 80 | 81 | © 2015-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown). 82 | -------------------------------------------------------------------------------- /node_modules/table-layout/node_modules/array-back/dist/index.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 3 | typeof define === 'function' && define.amd ? define(factory) : 4 | (global = global || self, global.arrayBack = factory()); 5 | }(this, (function () { 'use strict'; 6 | 7 | /** 8 | * Takes any input and guarantees an array back. 9 | * 10 | * - Converts array-like objects (e.g. `arguments`, `Set`) to a real array. 11 | * - Converts `undefined` to an empty array. 12 | * - Converts any another other, singular value (including `null`, objects and iterables other than `Set`) into an array containing that value. 13 | * - Ignores input which is already an array. 14 | * 15 | * @module array-back 16 | * @example 17 | * > const arrayify = require('array-back') 18 | * 19 | * > arrayify(undefined) 20 | * [] 21 | * 22 | * > arrayify(null) 23 | * [ null ] 24 | * 25 | * > arrayify(0) 26 | * [ 0 ] 27 | * 28 | * > arrayify([ 1, 2 ]) 29 | * [ 1, 2 ] 30 | * 31 | * > arrayify(new Set([ 1, 2 ])) 32 | * [ 1, 2 ] 33 | * 34 | * > function f(){ return arrayify(arguments); } 35 | * > f(1,2,3) 36 | * [ 1, 2, 3 ] 37 | */ 38 | 39 | function isObject (input) { 40 | return typeof input === 'object' && input !== null 41 | } 42 | 43 | function isArrayLike (input) { 44 | return isObject(input) && typeof input.length === 'number' 45 | } 46 | 47 | /** 48 | * @param {*} - The input value to convert to an array 49 | * @returns {Array} 50 | * @alias module:array-back 51 | */ 52 | function arrayify (input) { 53 | if (Array.isArray(input)) { 54 | return input 55 | } 56 | 57 | if (input === undefined) { 58 | return [] 59 | } 60 | 61 | if (isArrayLike(input) || input instanceof Set) { 62 | return Array.from(input) 63 | } 64 | 65 | return [input] 66 | } 67 | 68 | return arrayify; 69 | 70 | }))); 71 | -------------------------------------------------------------------------------- /node_modules/table-layout/node_modules/array-back/index.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * Takes any input and guarantees an array back. 3 | * 4 | * - Converts array-like objects (e.g. `arguments`, `Set`) to a real array. 5 | * - Converts `undefined` to an empty array. 6 | * - Converts any another other, singular value (including `null`, objects and iterables other than `Set`) into an array containing that value. 7 | * - Ignores input which is already an array. 8 | * 9 | * @module array-back 10 | * @example 11 | * > const arrayify = require('array-back') 12 | * 13 | * > arrayify(undefined) 14 | * [] 15 | * 16 | * > arrayify(null) 17 | * [ null ] 18 | * 19 | * > arrayify(0) 20 | * [ 0 ] 21 | * 22 | * > arrayify([ 1, 2 ]) 23 | * [ 1, 2 ] 24 | * 25 | * > arrayify(new Set([ 1, 2 ])) 26 | * [ 1, 2 ] 27 | * 28 | * > function f(){ return arrayify(arguments); } 29 | * > f(1,2,3) 30 | * [ 1, 2, 3 ] 31 | */ 32 | 33 | function isObject (input) { 34 | return typeof input === 'object' && input !== null 35 | } 36 | 37 | function isArrayLike (input) { 38 | return isObject(input) && typeof input.length === 'number' 39 | } 40 | 41 | /** 42 | * @param {*} - The input value to convert to an array 43 | * @returns {Array} 44 | * @alias module:array-back 45 | */ 46 | function arrayify (input) { 47 | if (Array.isArray(input)) { 48 | return input 49 | } 50 | 51 | if (input === undefined) { 52 | return [] 53 | } 54 | 55 | if (isArrayLike(input) || input instanceof Set) { 56 | return Array.from(input) 57 | } 58 | 59 | return [input] 60 | } 61 | 62 | export default arrayify 63 | -------------------------------------------------------------------------------- /node_modules/table-layout/node_modules/array-back/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "array-back", 3 | "author": "Lloyd Brookes <75pound@gmail.com>", 4 | "version": "4.0.2", 5 | "description": "Guarantees an array back", 6 | "repository": "https://github.com/75lb/array-back.git", 7 | "license": "MIT", 8 | "main": "dist/index.js", 9 | "keywords": [ 10 | "to", 11 | "convert", 12 | "return", 13 | "array", 14 | "arrayify" 15 | ], 16 | "engines": { 17 | "node": ">=8" 18 | }, 19 | "files": [ 20 | "index.mjs", 21 | "dist/index.js" 22 | ], 23 | "scripts": { 24 | "test": "npm run dist && npm run test:esm && npm run test:web", 25 | "test:esm": "esm-runner test.mjs", 26 | "test:web": "web-runner test.mjs", 27 | "docs": "jsdoc2md -t README.hbs index.mjs -c jsdoc.conf > README.md", 28 | "dist": "rollup -f umd -n arrayBack -o dist/index.js index.mjs", 29 | "cover": "c8 npm run test:esm && c8 report --reporter=text-lcov | coveralls" 30 | }, 31 | "dependencies": {}, 32 | "devDependencies": { 33 | "@test-runner/web": "^0.2.1", 34 | "c8": "^6.0.1", 35 | "coveralls": "^3.0.7", 36 | "esm-runner": "^0.2.0", 37 | "isomorphic-assert": "^0.1.1", 38 | "jsdoc-to-markdown": "^5.0.2", 39 | "rollup": "^1.26.5" 40 | }, 41 | "standard": { 42 | "ignore": [ 43 | "dist" 44 | ] 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /node_modules/table-layout/node_modules/typical/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-19 Lloyd Brookes <75pound@gmail.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /node_modules/table-layout/node_modules/typical/README.hbs: -------------------------------------------------------------------------------- 1 | [![view on npm](http://img.shields.io/npm/v/typical.svg)](https://www.npmjs.org/package/typical) 2 | [![npm module downloads](http://img.shields.io/npm/dt/typical.svg)](https://www.npmjs.org/package/typical) 3 | [![Build Status](https://travis-ci.org/75lb/typical.svg?branch=master)](https://travis-ci.org/75lb/typical) 4 | [![Coverage Status](https://coveralls.io/repos/github/75lb/typical/badge.svg?branch=master)](https://coveralls.io/github/75lb/typical?branch=master) 5 | [![Dependency Status](https://badgen.net/david/dep/75lb/typical)](https://david-dm.org/75lb/typical) 6 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard) 7 | 8 | {{>main}} 9 | 10 | ## Load anywhere 11 | 12 | This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation. 13 | 14 | Node.js: 15 | 16 | ```js 17 | const typical = require('typical') 18 | ``` 19 | 20 | Within Node.js with ECMAScript Module support enabled: 21 | 22 | ```js 23 | import typical from 'typical' 24 | ``` 25 | 26 | Within a modern browser ECMAScript Module: 27 | 28 | ```js 29 | import typical from './node_modules/typical/index.mjs' 30 | ``` 31 | 32 | Old browser (adds `window.typical`): 33 | 34 | ```html 35 | 36 | ``` 37 | 38 | * * * 39 | 40 | © 2014-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown). 41 | -------------------------------------------------------------------------------- /node_modules/table-layout/node_modules/typical/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "typical", 3 | "author": "Lloyd Brookes <75pound@gmail.com>", 4 | "version": "5.2.0", 5 | "description": "Isomorphic, functional type-checking for Javascript", 6 | "repository": "https://github.com/75lb/typical", 7 | "license": "MIT", 8 | "main": "dist/index.js", 9 | "keywords": [ 10 | "type", 11 | "checking", 12 | "check", 13 | "value", 14 | "valid", 15 | "is", 16 | "number", 17 | "object", 18 | "plainobject", 19 | "array", 20 | "like", 21 | "defined", 22 | "string", 23 | "boolean", 24 | "function", 25 | "promise", 26 | "iterable", 27 | "class", 28 | "primitive", 29 | "isstring", 30 | "isclass", 31 | "isiterable", 32 | "isdefined", 33 | "isobject", 34 | "isomorphic" 35 | ], 36 | "engines": { 37 | "node": ">=8" 38 | }, 39 | "scripts": { 40 | "test": "npm run dist && npm run test:js && npm run test:esm", 41 | "test:all": "npm run test:js && npm run test:esm && npm run test:web", 42 | "test:js": "rollup test/*.mjs -f cjs -d tmp/test -e assert && test-runner tmp/test/test*.js", 43 | "test:esm": "esm-runner test/*.mjs", 44 | "test:web": "web-runner test/test.mjs", 45 | "test:v8": "rollup test/test.mjs test/test-default.mjs -f cjs -d tmp/testv8 && test-runner tmp/testv8/test*.js", 46 | "dist": "rollup index.mjs -f umd -n typical -o dist/index.js --exports named", 47 | "docs": "jsdoc2md -c jsdoc.conf -t README.hbs index.mjs > README.md; echo", 48 | "cover": "nyc npm test && nyc report --reporter=text-lcov | coveralls" 49 | }, 50 | "devDependencies": { 51 | "coveralls": "^3.0.7", 52 | "esm-runner": "^0.1.5", 53 | "jsdoc-to-markdown": "^5.0.2", 54 | "nyc": "^14.1.1", 55 | "rollup": "^1.25.1", 56 | "test-object-model": "^0.4.4", 57 | "test-runner": "^0.6.0" 58 | }, 59 | "files": [ 60 | "index.mjs", 61 | "dist/index.js" 62 | ] 63 | } 64 | -------------------------------------------------------------------------------- /node_modules/table-layout/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "table-layout", 3 | "author": "Lloyd Brookes <75pound@gmail.com>", 4 | "version": "1.0.2", 5 | "description": "Stylable text tables, handling ansi colour. Useful for console output.", 6 | "repository": "https://github.com/75lb/table-layout.git", 7 | "license": "MIT", 8 | "keywords": [ 9 | "wrap", 10 | "terminal", 11 | "data", 12 | "columns", 13 | "format", 14 | "json", 15 | "command line" 16 | ], 17 | "engines": { 18 | "node": ">=8.0.0" 19 | }, 20 | "scripts": { 21 | "test": "test-runner test/*.js", 22 | "docs": "jsdoc2md -t README.hbs index.js -p list --member-index-format list > README.md; echo", 23 | "cover": "nyc npm test && nyc report --reporter=text-lcov | coveralls" 24 | }, 25 | "dependencies": { 26 | "array-back": "^4.0.1", 27 | "deep-extend": "~0.6.0", 28 | "typical": "^5.2.0", 29 | "wordwrapjs": "^4.0.0" 30 | }, 31 | "devDependencies": { 32 | "coveralls": "^3.1.0", 33 | "jsdoc-to-markdown": "^7.0.0", 34 | "nyc": "^15.1.0", 35 | "test-runner": "^0.6.3" 36 | }, 37 | "files": [ 38 | "index.js", 39 | "lib/*.js" 40 | ] 41 | } 42 | -------------------------------------------------------------------------------- /node_modules/typical/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-19 Lloyd Brookes <75pound@gmail.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /node_modules/typical/README.hbs: -------------------------------------------------------------------------------- 1 | [![view on npm](http://img.shields.io/npm/v/typical.svg)](https://www.npmjs.org/package/typical) 2 | [![npm module downloads](http://img.shields.io/npm/dt/typical.svg)](https://www.npmjs.org/package/typical) 3 | [![Build Status](https://travis-ci.org/75lb/typical.svg?branch=master)](https://travis-ci.org/75lb/typical) 4 | [![Coverage Status](https://coveralls.io/repos/github/75lb/typical/badge.svg?branch=master)](https://coveralls.io/github/75lb/typical?branch=master) 5 | [![Dependency Status](https://badgen.net/david/dep/75lb/typical)](https://david-dm.org/75lb/typical) 6 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard) 7 | 8 | {{>main}} 9 | 10 | ## Load anywhere 11 | 12 | This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation. 13 | 14 | Node.js: 15 | 16 | ```js 17 | const typical = require('typical') 18 | ``` 19 | 20 | Within Node.js with ECMAScript Module support enabled: 21 | 22 | ```js 23 | import typical from 'typical' 24 | ``` 25 | 26 | Within a modern browser ECMAScript Module: 27 | 28 | ```js 29 | import typical from './node_modules/typical/index.mjs' 30 | ``` 31 | 32 | Old browser (adds `window.typical`): 33 | 34 | ```html 35 | 36 | ``` 37 | 38 | * * * 39 | 40 | © 2014-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown). 41 | -------------------------------------------------------------------------------- /node_modules/typical/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "typical", 3 | "author": "Lloyd Brookes <75pound@gmail.com>", 4 | "version": "4.0.0", 5 | "description": "Robust Javascript type-checking", 6 | "repository": "https://github.com/75lb/typical", 7 | "license": "MIT", 8 | "main": "dist/index.js", 9 | "keywords": [ 10 | "type", 11 | "checking", 12 | "check", 13 | "value", 14 | "valid", 15 | "is", 16 | "number", 17 | "object", 18 | "plainobject", 19 | "array", 20 | "like", 21 | "defined", 22 | "string", 23 | "boolean", 24 | "function", 25 | "promise", 26 | "iterable", 27 | "class", 28 | "primitive" 29 | ], 30 | "engines": { 31 | "node": ">=8" 32 | }, 33 | "scripts": { 34 | "test": "npm run test:js && npm run test:esm && npm run test:web", 35 | "test:js": "rollup test.mjs -f cjs -o dist/test.js && rollup test-v10.mjs -f cjs -o dist/test-v10.js && test-runner dist/test*.js", 36 | "test:esm": "esm-runner test*.mjs", 37 | "test:web": "web-runner test.mjs", 38 | "dist": "rollup index.mjs -f umd -n typical -o dist/index.js", 39 | "docs": "jsdoc2md -c jsdoc.conf -t README.hbs index.mjs > README.md; echo", 40 | "cover": "nyc --reporter=text-lcov test-runner test.js | coveralls" 41 | }, 42 | "devDependencies": { 43 | "@test-runner/web": "^0.1.4", 44 | "coveralls": "^3.0.3", 45 | "esm-runner": "^0.1.2", 46 | "jsdoc-to-markdown": "^4.0.1", 47 | "rollup": "^1.7.0", 48 | "test-object-model": "^0.3.8", 49 | "test-runner": "^0.6.0-14" 50 | }, 51 | "files": [ 52 | "index.mjs", 53 | "dist/index.js" 54 | ] 55 | } 56 | -------------------------------------------------------------------------------- /node_modules/wordwrapjs/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015-21 Lloyd Brookes <75pound@gmail.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/wordwrapjs/README.hbs: -------------------------------------------------------------------------------- 1 | [![view on npm](https://badgen.net/npm/v/wordwrapjs)](https://www.npmjs.org/package/wordwrapjs) 2 | [![npm module downloads](https://badgen.net/npm/dt/wordwrapjs)](https://www.npmjs.org/package/wordwrapjs) 3 | [![Gihub repo dependents](https://badgen.net/github/dependents-repo/75lb/wordwrapjs)](https://github.com/75lb/wordwrapjs/network/dependents?dependent_type=REPOSITORY) 4 | [![Gihub package dependents](https://badgen.net/github/dependents-pkg/75lb/wordwrapjs)](https://github.com/75lb/wordwrapjs/network/dependents?dependent_type=PACKAGE) 5 | [![Build Status](https://travis-ci.org/75lb/wordwrapjs.svg?branch=master)](https://travis-ci.org/75lb/wordwrapjs) 6 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard) 7 | 8 | # wordwrapjs 9 | 10 | Word wrapping, with a few features. 11 | 12 | - force-break option 13 | - wraps hypenated words 14 | - multilingual - wraps any language that uses whitespace for word separation. 15 | 16 | ## Synopsis 17 | 18 | Wrap some text in a 20 character column. 19 | 20 | ```js 21 | > wordwrap = require('wordwrapjs') 22 | 23 | > text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.' 24 | 25 | > result = wordwrap.wrap(text, { width: 20 }) 26 | ``` 27 | 28 | `result` now looks like this: 29 | ``` 30 | Lorem ipsum dolor 31 | sit amet, 32 | consectetur 33 | adipiscing elit, sed 34 | do eiusmod tempor 35 | incididunt ut labore 36 | et dolore magna 37 | aliqua. 38 | ``` 39 | 40 | By default, long words will not break. Unless you set the `break` option. 41 | ```js 42 | > url = 'https://github.com/75lb/wordwrapjs' 43 | 44 | > wrap.lines(url, { width: 18 }) 45 | [ 'https://github.com/75lb/wordwrapjs' ] 46 | 47 | > wrap.lines(url, { width: 18, break: true }) 48 | [ 'https://github.com', '/75lb/wordwrapjs' ] 49 | ``` 50 | 51 | ## API Reference 52 | 53 | {{#module name="wordwrapjs"}} 54 | {{>body~}} 55 | {{>member-index~}} 56 | {{>members~}} 57 | {{/module}} 58 | 59 | * * * 60 | 61 | © 2015-21 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown). 62 | -------------------------------------------------------------------------------- /node_modules/wordwrapjs/node_modules/typical/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-19 Lloyd Brookes <75pound@gmail.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /node_modules/wordwrapjs/node_modules/typical/README.hbs: -------------------------------------------------------------------------------- 1 | [![view on npm](http://img.shields.io/npm/v/typical.svg)](https://www.npmjs.org/package/typical) 2 | [![npm module downloads](http://img.shields.io/npm/dt/typical.svg)](https://www.npmjs.org/package/typical) 3 | [![Build Status](https://travis-ci.org/75lb/typical.svg?branch=master)](https://travis-ci.org/75lb/typical) 4 | [![Coverage Status](https://coveralls.io/repos/github/75lb/typical/badge.svg?branch=master)](https://coveralls.io/github/75lb/typical?branch=master) 5 | [![Dependency Status](https://badgen.net/david/dep/75lb/typical)](https://david-dm.org/75lb/typical) 6 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard) 7 | 8 | {{>main}} 9 | 10 | ## Load anywhere 11 | 12 | This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation. 13 | 14 | Node.js: 15 | 16 | ```js 17 | const typical = require('typical') 18 | ``` 19 | 20 | Within Node.js with ECMAScript Module support enabled: 21 | 22 | ```js 23 | import typical from 'typical' 24 | ``` 25 | 26 | Within a modern browser ECMAScript Module: 27 | 28 | ```js 29 | import typical from './node_modules/typical/index.mjs' 30 | ``` 31 | 32 | Old browser (adds `window.typical`): 33 | 34 | ```html 35 | 36 | ``` 37 | 38 | * * * 39 | 40 | © 2014-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown). 41 | -------------------------------------------------------------------------------- /node_modules/wordwrapjs/node_modules/typical/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "typical", 3 | "author": "Lloyd Brookes <75pound@gmail.com>", 4 | "version": "5.2.0", 5 | "description": "Isomorphic, functional type-checking for Javascript", 6 | "repository": "https://github.com/75lb/typical", 7 | "license": "MIT", 8 | "main": "dist/index.js", 9 | "keywords": [ 10 | "type", 11 | "checking", 12 | "check", 13 | "value", 14 | "valid", 15 | "is", 16 | "number", 17 | "object", 18 | "plainobject", 19 | "array", 20 | "like", 21 | "defined", 22 | "string", 23 | "boolean", 24 | "function", 25 | "promise", 26 | "iterable", 27 | "class", 28 | "primitive", 29 | "isstring", 30 | "isclass", 31 | "isiterable", 32 | "isdefined", 33 | "isobject", 34 | "isomorphic" 35 | ], 36 | "engines": { 37 | "node": ">=8" 38 | }, 39 | "scripts": { 40 | "test": "npm run dist && npm run test:js && npm run test:esm", 41 | "test:all": "npm run test:js && npm run test:esm && npm run test:web", 42 | "test:js": "rollup test/*.mjs -f cjs -d tmp/test -e assert && test-runner tmp/test/test*.js", 43 | "test:esm": "esm-runner test/*.mjs", 44 | "test:web": "web-runner test/test.mjs", 45 | "test:v8": "rollup test/test.mjs test/test-default.mjs -f cjs -d tmp/testv8 && test-runner tmp/testv8/test*.js", 46 | "dist": "rollup index.mjs -f umd -n typical -o dist/index.js --exports named", 47 | "docs": "jsdoc2md -c jsdoc.conf -t README.hbs index.mjs > README.md; echo", 48 | "cover": "nyc npm test && nyc report --reporter=text-lcov | coveralls" 49 | }, 50 | "devDependencies": { 51 | "coveralls": "^3.0.7", 52 | "esm-runner": "^0.1.5", 53 | "jsdoc-to-markdown": "^5.0.2", 54 | "nyc": "^14.1.1", 55 | "rollup": "^1.25.1", 56 | "test-object-model": "^0.4.4", 57 | "test-runner": "^0.6.0" 58 | }, 59 | "files": [ 60 | "index.mjs", 61 | "dist/index.js" 62 | ] 63 | } 64 | -------------------------------------------------------------------------------- /node_modules/wordwrapjs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "wordwrapjs", 3 | "author": "Lloyd Brookes <75pound@gmail.com>", 4 | "version": "4.0.1", 5 | "description": "Word-wrapping for javascript.", 6 | "repository": "https://github.com/75lb/wordwrapjs.git", 7 | "license": "MIT", 8 | "keywords": [ 9 | "word", 10 | "line", 11 | "wrap", 12 | "text", 13 | "columns", 14 | "wordwrap" 15 | ], 16 | "engines": { 17 | "node": ">=8.0.0" 18 | }, 19 | "scripts": { 20 | "test": "test-runner test.js", 21 | "docs": "jsdoc2md -t README.hbs index.js > README.md; echo" 22 | }, 23 | "devDependencies": { 24 | "jsdoc-to-markdown": "^7.0.0", 25 | "test-runner": "~0.6.3" 26 | }, 27 | "dependencies": { 28 | "reduce-flatten": "^2.0.0", 29 | "typical": "^5.2.0" 30 | }, 31 | "files": [ 32 | "index.js" 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "bytefield-svg": "^1.10.0" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /readme.adoc: -------------------------------------------------------------------------------- 1 | = External Debug Security 2 | 3 | == License 4 | 5 | This work is licensed under a Creative Commons Attribution 4.0 International License (CC-BY-4.0). For details, see the link:LICENSE[LICENSE] file. 6 | 7 | == Contributors 8 | 9 | The list of contributors to this specification is maintained in the link:contributors.adoc[contributors] file. 10 | 11 | For guidelines on how to contribute, refer to the link:CONTRIBUTING.md[CONTRIBUTING] file. 12 | 13 | == Building the Document 14 | 15 | === Prerequisites 16 | 17 | To build the document, you'll need the following tools installed on your system: 18 | 19 | * Make 20 | * asciiDoctor-pdf, asciidoctor-bibtex, asciidoctor-diagram and asciidoctor-mathematical 21 | * wavedrom 22 | * Docker 23 | 24 | === Cloning the Repository 25 | 26 | `git clone --recurse-submodules https://github.com/riscv-non-isa/riscv-external-debug-security` 27 | 28 | ==== Setting Environment Variables 29 | 30 | These variables can be overridden by setting environment variables on your system. Here's how you can do it in Linux and MacOS: 31 | 32 | ```bash 33 | export VERSION=v1.2.3 34 | export REVMARK=Release 35 | export PDF_RESULT=spec.pdf 36 | ``` 37 | 38 | === Building the Documentation 39 | 40 | To start the build process, run `cd ./riscv-external-debug-security && make build`. 41 | 42 | The Makefile script will check the availability of Docker on your system: 43 | 44 | * If Docker is available, the documentation will be built inside a Docker container using the image riscvintl/riscv-docs-base-container-image:latest. This ensures a consistent build environment across different systems. 45 | * If Docker is not available, the documentation will be built directly on your system using the installed tools. 46 | 47 | The documentation is generated from the AsciiDoctor source files in your project. The primary source file is specified by the `HEADER_SOURCE` variable in the Makefile. 48 | 49 | The build process utilizes several options, including theming and font settings, and generates a PDF document as output. 50 | 51 | === Cleaning up 52 | 53 | To clean up the generated files, run `make clean`. This will remove the generated PDF file. 54 | --------------------------------------------------------------------------------