From d8b20051831a6ba6ac15a327169e4f6610af437f Mon Sep 17 00:00:00 2001 From: Corbyn Noble-May Date: Fri, 28 Nov 2025 10:42:02 +1300 Subject: [PATCH 01/30] Implement setup-node action with safe-chain --- .github/CODEOWNERS | 3 +- .github/dependabot.yml | 32 +-- .github/workflows/ci.yml | 61 ++-- .github/workflows/dependabot-automation.yml | 60 ++-- .github/workflows/lint-pr.yml | 20 +- .github/workflows/release.yml | 36 +-- README.md | 303 ++++++++++++++++++-- action.yaml | 82 ++++-- assert.sh | 238 +++++++-------- setup_repo.sh | 119 -------- 10 files changed, 565 insertions(+), 389 deletions(-) delete mode 100755 setup_repo.sh diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 1c9eaaa..3ba3af9 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,2 +1 @@ -# CHANGE_ME - set correct code owner -* @linz/step-enablement \ No newline at end of file +* @linz/step-security \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d9204fa..2b0e406 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,16 +1,16 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for all configuration options: -# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates - -version: 2 - -updates: - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: weekly - commit-message: - prefix: "fix(deps)" - cooldown: - default-days: 15 +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 + +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: weekly + commit-message: + prefix: "fix(deps)" + cooldown: + default-days: 15 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0df102f..ad4d526 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,25 +1,36 @@ -name: CI -on: - pull_request: - branches: [master] - -jobs: - test: - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - - # CHANGE_ME - implement automation test for the actual action - - name: invoke action - uses: ./ - with: - input1: foo - input2: bar - - - name: Verify the result - run: | - source assert.sh - assert_eq "foo" "$DUMMY_INPUT1" - assert_eq "bar" "$DUMMY_INPUT2" +name: CI +on: + pull_request: + branches: [master] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x, 20.x, 22.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: ./ + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: npm run build --if-present + - name: Test Safe Chains + run: | + set +e + npm install safe-chain-test + exitCode=$? + if [[ $exitCode -eq 1 ]]; then + echo "Failed to download malware test!" + else + exit 1 + fi + exit 0 + continue-on-error: true \ No newline at end of file diff --git a/.github/workflows/dependabot-automation.yml b/.github/workflows/dependabot-automation.yml index 65caa95..5deb943 100644 --- a/.github/workflows/dependabot-automation.yml +++ b/.github/workflows/dependabot-automation.yml @@ -1,30 +1,30 @@ -name: Dependabot automation - -on: pull_request - -permissions: - contents: write - pull-requests: write - -jobs: - dependabot: - runs-on: ubuntu-latest - if: github.actor == 'dependabot[bot]' - steps: - - name: Dependabot metadata - id: metadata - uses: dependabot/fetch-metadata@08eff52bf64351f401fb50d4972fa95b9f2c2d1b # v2.4.0 - with: - github-token: "${{ secrets.GITHUB_TOKEN }}" - - name: Approve PR - run: gh pr review --approve "$PR_URL" - env: - PR_URL: ${{ github.event.pull_request.html_url }} - GITHUB_TOKEN: ${{ secrets.STEP_GITHUB_ACTION_TOKEN }} - - name: Enable auto-merge for Dependabot PRs that doesn't include major version update - if: steps.metadata.outputs.update-type != 'version-update:semver-major' - run: gh pr merge --auto --squash "$PR_URL" - env: - PR_URL: ${{ github.event.pull_request.html_url }} - GITHUB_TOKEN: ${{ secrets.STEP_GITHUB_ACTION_TOKEN }} - +name: Dependabot automation + +on: pull_request + +permissions: + contents: write + pull-requests: write + +jobs: + dependabot: + runs-on: ubuntu-latest + if: github.actor == 'dependabot[bot]' + steps: + - name: Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@08eff52bf64351f401fb50d4972fa95b9f2c2d1b # v2.4.0 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: Approve PR + run: gh pr review --approve "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GITHUB_TOKEN: ${{ secrets.STEP_GITHUB_ACTION_TOKEN }} + - name: Enable auto-merge for Dependabot PRs that doesn't include major version update + if: steps.metadata.outputs.update-type != 'version-update:semver-major' + run: gh pr merge --auto --squash "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GITHUB_TOKEN: ${{ secrets.STEP_GITHUB_ACTION_TOKEN }} + diff --git a/.github/workflows/lint-pr.yml b/.github/workflows/lint-pr.yml index 4077efd..140a186 100644 --- a/.github/workflows/lint-pr.yml +++ b/.github/workflows/lint-pr.yml @@ -1,11 +1,11 @@ -name: "Lint PR" - -on: - pull_request: - types: ["opened", "edited", "reopened", "synchronize"] - -jobs: - pr-lint: - runs-on: ubuntu-latest - steps: +name: "Lint PR" + +on: + pull_request: + types: ["opened", "edited", "reopened", "synchronize"] + +jobs: + pr-lint: + runs-on: ubuntu-latest + steps: - uses: linz/action-pull-request-lint@7adb4bc59b59dc6e097de831c29a17c2c1338826 # v1.2.0 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cd7f008..36aea0a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,19 +1,19 @@ -name: release-please - -on: - push: - branches: - - master - -permissions: - contents: write - pull-requests: write - -jobs: - release-please: - runs-on: ubuntu-latest - steps: - - uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0 - with: - release-type: simple +name: release-please + +on: + push: + branches: + - master + +permissions: + contents: write + pull-requests: write + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0 + with: + release-type: simple token: ${{ secrets.STEP_GITHUB_ACTION_TOKEN }} \ No newline at end of file diff --git a/README.md b/README.md index d32c548..e1fc4e3 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,273 @@ -# template-github-action - -Template repo to kick start a composite Github action, providing the following features and configurations - -1. [Sample composite action](action.yaml) -2. [Sample CI workflow](.github/workflows/ci.yml) to test the sample action - - provided [assert.sh](assert.sh) to perform simple assertions in shell -3. [Repo setup script](setup_repo.sh) to configure the new repo -4. PR title linting to enforce that the PR titles follows [conventional commit standard](https://www.conventionalcommits.org/) -5. Configures dependabot to update any Github action dependencies -6. Dependabot automation workflow to automatically approve and squash merge dependabot PRs -7. Automated release with [release-please](https://github.com/googleapis/release-please-action) -8. Sample [CODEOWNERS](.github/CODEOWNERS) file - -## Template usage - -1. When creating a new repo - 1. Recommend to prefix the repo name with `action-`, e.g. `action-setup-playwright` - 2. Use the `Start with a template` option and select this repo as the template. - 3. Clone the new repo - 4. Make sure you have [Github CLI](https://github.com/cli/cli#installation) installed - 5. Open a bash terminal to the repo folder - 6. Run `./setup_repo.sh` to configure the repo settings. Note - this script self-deletes after successful run, commit - the deletion as the script would be no longer required. -2. Search for word `CHANGE_ME` and modify the code as needed. -3. Replace this README file with documentation for the new action. -4. Implement the new action and release it with release-please -5. Ask in Slack channel `#team-step-enablement` or `#help-github` to grant dependabot access to this new repo - 1. so that consumers of your new action can receive automated upgrades when new version is released - 2. this setting is at the bottom of this page https://github.com/organizations/linz/settings/security_analysis +# setup-node +[![basic-validation](https://github.com/actions/setup-node/actions/workflows/basic-validation.yml/badge.svg)](https://github.com/actions/setup-node/actions/workflows/basic-validation.yml) +[![versions](https://github.com/actions/setup-node/actions/workflows/versions.yml/badge.svg)](https://github.com/actions/setup-node/actions/workflows/versions.yml) +[![e2e-cache](https://github.com/actions/setup-node/actions/workflows/e2e-cache.yml/badge.svg?branch=main)](https://github.com/actions/setup-node/actions/workflows/e2e-cache.yml) +[![proxy](https://github.com/actions/setup-node/actions/workflows/proxy.yml/badge.svg)](https://github.com/actions/setup-node/actions/workflows/proxy.yml) + +This action wraps the [actions/setup-node](https://github.com/actions/setup-node) action and implements [Aikido Safe-Chain](https://github.com/AikidoSec/safe-chain) to fail install upon an attempt to install a malicious node package. Below is the [actions/setup-node](https://github.com/actions/setup-node) documentation as this action is a like-for-like replacement. + +This action provides the following functionality for GitHub Actions users: + +- Optionally downloading and caching distribution of the requested Node.js version, and adding it to the PATH +- Optionally caching npm/yarn/pnpm dependencies +- Registering problem matchers for error output +- Configuring authentication for GPR or npm + +## Breaking changes in V6 + +- Caching is now automatically enabled for npm projects when either the `devEngines.packageManager` field or the top-level `packageManager` field in `package.json` is set to `npm`. For other package managers, such as Yarn and pnpm, caching is disabled by default and must be configured manually using the `cache` input. + +- The `always-auth` input has been removed, as it is deprecated and will no longer be supported in future npm releases. To ensure your workflows continue to run without warnings or errors, please remove any references to `always-auth` from your configuration. + +## Breaking changes in V5 + +- Enabled caching by default with package manager detection if no cache input is provided. + > For workflows with elevated privileges or access to sensitive information, we recommend disabling automatic caching by setting `package-manager-cache: false` when caching is not needed for secure operation. + +- Upgraded action from node20 to node24. + > Make sure your runner is on version v2.327.1 or later to ensure compatibility with this release. [See Release Notes](https://github.com/actions/runner/releases/tag/v2.327.1) + +For more details, see the full release notes on the [releases page](https://github.com/actions/setup-node/releases/v5.0.0) + +## Usage + +See [action.yml](action.yml) + + +```yaml +- uses: actions/setup-node@v6 + with: + # Version Spec of the version to use in SemVer notation. + # It also admits such aliases as lts/*, latest, nightly and canary builds + # Examples: 12.x, 10.15.1, >=10.15.0, lts/Hydrogen, 16-nightly, latest, node + node-version: '' + + # File containing the version Spec of the version to use. Examples: package.json, .nvmrc, .node-version, .tool-versions. + # If node-version and node-version-file are both provided the action will use version from node-version. + node-version-file: '' + + # Set this option if you want the action to check for the latest available version + # that satisfies the version spec. + # It will only get affect for lts Nodejs versions (12.x, >=10.15.0, lts/Hydrogen). + # Default: false + check-latest: false + + # Target architecture for Node to use. Examples: x86, x64. Will use system architecture by default. + # Default: ''. The action use system architecture by default + architecture: '' + + # Used to pull node distributions from https://github.com/actions/node-versions. + # Since there's a default, this is typically not supplied by the user. + # When running this action on github.com, the default value is sufficient. + # When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting. + # + # We recommend using a service account with the least permissions necessary. Also + # when generating a new PAT, select the least scopes necessary. + # + # [Learn more about creating and using encrypted secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets) + # + # Default: ${{ github.server_url == 'https://github.com' && github.token || '' }} + token: '' + + # Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm. + # Package manager should be pre-installed + # Default: '' + cache: '' + + # Controls automatic caching for npm. By default, caching for npm is enabled if either the devEngines.packageManager field or the top-level packageManager field in package.json specifies npm and no explicit cache input is provided. + # To disable automatic caching for npm, set package-manager-cache to false. + # default: true + package-manager-cache: true + + # Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. + # It will generate hash from the target file for primary key. It works only If cache is specified. + # Supports wildcards or a list of file names for caching multiple dependencies. + # Default: '' + cache-dependency-path: '' + + # Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, + # and set up auth to read in from env.NODE_AUTH_TOKEN. + # Default: '' + registry-url: '' + + # Optional scope for authenticating against scoped registries. + # Will fall back to the repository owner when using the GitHub Packages registry (https://npm.pkg.github.com/). + # Default: '' + scope: '' + + # Optional mirror to download binaries from. + # Artifacts need to match the official Node.js + # Example: + # V8 Canaray Build: /download/v8-canary + # RC Build: /download/rc + # Official: Build /dist + # Nightly build: /download/nightly + # Default: '' + mirror: '' + + # Optional mirror token. + # The token will be used as a bearer token in the Authorization header + # Default: '' + mirror-token: '' +``` + + +**Basic:** + +```yaml +steps: +- uses: actions/checkout@v5 +- uses: actions/setup-node@v6 + with: + node-version: 24 +- run: npm ci +- run: npm test +``` + +The `node-version` input is optional. If not supplied, the node version from PATH will be used. However, it is recommended to always specify Node.js version and don't rely on the system one. + +The action will first check the local cache for a semver match. If unable to find a specific version in the cache, the action will attempt to download a version of Node.js. It will pull LTS versions from [node-versions releases](https://github.com/actions/node-versions/releases) and on miss or failure will fall back to the previous behavior of downloading directly from [node dist](https://nodejs.org/dist/). + +For information regarding locally cached versions of Node.js on GitHub hosted runners, check out [GitHub Actions Runner Images](https://github.com/actions/runner-images). + +### Supported version syntax + +The `node-version` input supports the Semantic Versioning Specification, for more detailed examples please refer to [the semver package documentation](https://github.com/npm/node-semver). + +Examples: + + - Major versions: `22`, `24` + - More specific versions: `20.19`, `22.17.1` , `24.8.0` + - NVM LTS syntax: `lts/iron`, `lts/jod`, `lts/*`, `lts/-n` + - Latest release: `*` or `latest`/`current`/`node` + +**Note:** Like the other values, `*` will get the latest [locally-cached Node.js version](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md#nodejs), or the latest version from [actions/node-versions](https://github.com/actions/node-versions/blob/main/versions-manifest.json), depending on the [`check-latest`](docs/advanced-usage.md#check-latest-version) input. + +`current`/`latest`/`node` always resolve to the latest [dist version](https://nodejs.org/dist/index.json). +That version is then downloaded from actions/node-versions if possible, or directly from Node.js if not. +Since it will not be cached always, there is possibility of hitting rate limit when downloading from dist + +### Checking in lockfiles + +It's **always** recommended to commit the lockfile of your package manager for security and performance reasons. For more information consult the "Working with lockfiles" section of the [Advanced usage](docs/advanced-usage.md#working-with-lockfiles) guide. + +## Caching global packages data + +The action has a built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/cache) under the hood for caching global packages data but requires less configuration settings. Supported package managers are `npm`, `yarn`, `pnpm` (v6.10+). The `cache` input is optional. + +The action defaults to search for the dependency file (`package-lock.json`, `npm-shrinkwrap.json` or `yarn.lock`) in the repository root, and uses its hash as a part of the cache key. Use `cache-dependency-path` for cases when multiple dependency files are used, or they are located in different subdirectories. + +**Note:** The action does not cache `node_modules` + +See the examples of using cache for `yarn`/`pnpm` and `cache-dependency-path` input in the [Advanced usage](docs/advanced-usage.md#caching-packages-data) guide. + +**Caching npm dependencies:** + +```yaml +steps: +- uses: actions/checkout@v5 +- uses: actions/setup-node@v6 + with: + node-version: 24 + cache: 'npm' +- run: npm ci +- run: npm test +``` + +**Caching npm dependencies in monorepos:** + +```yaml +steps: +- uses: actions/checkout@v5 +- uses: actions/setup-node@v6 + with: + node-version: 24 + cache: 'npm' + cache-dependency-path: subdir/package-lock.json +- run: npm ci +- run: npm test +``` + +Caching for npm dependencies is automatically enabled when your `package.json` contains either `devEngines.packageManager` field or top-level `packageManager` field set to `npm`, and no explicit cache input is provided. + +This behavior is controlled by the `package-manager-cache` input, which defaults to `true`. To turn off automatic caching, set `package-manager-cache` to `false`. + +```yaml +steps: +- uses: actions/checkout@v5 +- uses: actions/setup-node@v6 + with: + package-manager-cache: false +- run: npm ci +``` +> If your `package.json` file does not include a `packageManager` field set to `npm`, caching will be disabled unless you explicitly enable it. For workflows with elevated privileges or access to sensitive information, we recommend disabling automatic caching for npm by setting `package-manager-cache: false` when caching is not required for secure operation. + +## Matrix Testing + +```yaml +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + node: [ 20, 22, 24 ] + name: Node ${{ matrix.node }} sample + steps: + - uses: actions/checkout@v5 + - name: Setup node + uses: actions/setup-node@v6 + with: + node-version: ${{ matrix.node }} + - run: npm ci + - run: npm test +``` + +## Using `setup-node` on GHES + +`setup-node` comes pre-installed on the appliance with GHES if Actions is enabled. When dynamically downloading Nodejs distributions, `setup-node` downloads distributions from [`actions/node-versions`](https://github.com/actions/node-versions) on github.com (outside of the appliance). These calls to `actions/node-versions` are made via unauthenticated requests, which are limited to [60 requests per hour per IP](https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting). If more requests are made within the time frame, then you will start to see rate-limit errors during downloading that looks like: `##[error]API rate limit exceeded for...`. After that error the action will try to download versions directly from the official site, but it also can have rate limit so it's better to put token. + +To get a higher rate limit, you can [generate a personal access token on github.com](https://github.com/settings/tokens/new) and pass it as the `token` input for the action: + +```yaml +uses: actions/setup-node@v6 +with: + token: ${{ secrets.GH_DOTCOM_TOKEN }} + node-version: 24 +``` + +If the runner is not able to access github.com, any Nodejs versions requested during a workflow run must come from the runner's tool cache. See "[Setting up the tool cache on self-hosted runners without internet access](https://docs.github.com/en/enterprise-server@3.2/admin/github-actions/managing-access-to-actions-from-githubcom/setting-up-the-tool-cache-on-self-hosted-runners-without-internet-access)" for more information. + +## Advanced usage + + - [Check latest version](docs/advanced-usage.md#check-latest-version) + - [Using a node version file](docs/advanced-usage.md#node-version-file) + - [Using different architectures](docs/advanced-usage.md#architecture) + - [Using v8 canary versions](docs/advanced-usage.md#v8-canary-versions) + - [Using nightly versions](docs/advanced-usage.md#nightly-versions) + - [Using rc versions](docs/advanced-usage.md#rc-versions) + - [Caching packages data](docs/advanced-usage.md#caching-packages-data) + - [Using multiple operating systems and architectures](docs/advanced-usage.md#multiple-operating-systems-and-architectures) + - [Publishing to npmjs and GPR with npm](docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-npm) + - [Publishing to npmjs and GPR with yarn](docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-yarn) + - [Using private packages](docs/advanced-usage.md#use-private-packages) + +## Recommended permissions + +When using the `setup-node` action in your GitHub Actions workflow, it is recommended to set the following permissions to ensure proper functionality: + +```yaml +permissions: + contents: read # access to check out code and install dependencies +``` + +## License + +The scripts and documentation in this project are released under the [MIT License](LICENSE) + +## Contributions + +Contributions are welcome! See [Contributor's Guide](docs/contributors.md) + +## Code of Conduct + +:wave: Be nice. See [our code of conduct](CODE_OF_CONDUCT.md) diff --git a/action.yaml b/action.yaml index 60e86eb..6998ff6 100644 --- a/action.yaml +++ b/action.yaml @@ -1,20 +1,62 @@ -# CHANGE_ME - implement the actual action -name: dummy composite action - -inputs: - input1: - description: value to set to DUMMY_INPUT1 environment variable - input2: - description: value to set to DUMMY_INPUT2 environment variable - -runs: - using: composite - steps: - - name: Dummy step 1 - shell: bash - env: - INPUT1: ${{ inputs.input1 }} - INPUT2: ${{ inputs.input2 }} - run: | - echo "DUMMY_INPUT1=$INPUT1" >> $GITHUB_ENV - echo "DUMMY_INPUT2=$INPUT2" >> $GITHUB_ENV +name: Setup node build environment +description: | + Configure Aikido Safe-Chain and Node environment +inputs: + node-version: + description: 'Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0.' + node-version-file: + description: 'File containing the version Spec of the version to use. Examples: package.json, .nvmrc, .node-version, .tool-versions.' + architecture: + description: 'Target architecture for Node to use. Examples: x86, x64. Will use system architecture by default.' + check-latest: + description: 'Set this option if you want the action to check for the latest available version that satisfies the version spec.' + default: false + registry-url: + description: 'Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN.' + scope: + description: 'Optional scope for authenticating against scoped registries. Will fall back to the repository owner when using the GitHub Packages registry (https://npm.pkg.github.com/).' + token: + description: Used to pull node distributions from node-versions. Since there's a default, this is typically not supplied by the user. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting. + default: ${{ github.server_url == 'https://github.com' && github.token || '' }} + cache: + description: 'Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm.' + package-manager-cache: + description: 'Set to false to disable automatic caching. By default, caching is enabled when either devEngines.packageManager or the top-level packageManager field in package.json specifies npm as the package manager.' + default: true + cache-dependency-path: + description: 'Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies.' + mirror: + description: 'Used to specify an alternative mirror to downlooad Node.js binaries from' + mirror-token: + description: 'The token used as Authorization header when fetching from the mirror' +outputs: + cache-hit: + description: 'A boolean value to indicate if a cache was hit.' + node-version: + description: 'The installed node version.' + + +runs: + using: composite + steps: + - name: Setup Node.js + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 + with: + node-version: ${{ inputs.node-version }} + node-version-file: ${{ inputs.node-version-file }} + architecture: ${{ inputs.architecture }} + check-latest: ${{ inputs.check-latest }} + registry-url: ${{ inputs.registry-url }} + scope: ${{ inputs.scope }} + token: ${{ inputs.token }} + cache: ${{ inputs.cache }} + package-manager-cache: ${{ inputs.package-manager-cache }} + cache-dependency-path: ${{ inputs.cache-dependency-path }} + mirror: ${{ inputs.mirror }} + mirror-token: ${{ inputs.mirror-token }} + + - name: Setup Aikido Safe-Chain + shell: bash + run: | + npm i -g @aikidosec/safe-chain + safe-chain setup-ci diff --git a/assert.sh b/assert.sh index bc1b338..7655a8a 100644 --- a/assert.sh +++ b/assert.sh @@ -1,119 +1,119 @@ -#!/usr/bin/env bash -# copied from https://github.com/torokmark/assert.sh/blob/main/assert.sh - -##################################################################### -## -## title: Assert Extension -## -## description: -## Assert extension of shell (bash, ...) -## with the common assert functions -## Function list based on: -## http://junit.sourceforge.net/javadoc/org/junit/Assert.html -## Log methods : inspired by -## - https://natelandau.com/bash-scripting-utilities/ -## author: Mark Torok -## -## date: 07. Dec. 2016 -## -## license: MIT -## -##################################################################### - -if command -v tput &>/dev/null && tty -s; then - RED=$(tput setaf 1) - GREEN=$(tput setaf 2) - MAGENTA=$(tput setaf 5) - NORMAL=$(tput sgr0) - BOLD=$(tput bold) -else - RED=$(echo -en "\e[31m") - GREEN=$(echo -en "\e[32m") - MAGENTA=$(echo -en "\e[35m") - NORMAL=$(echo -en "\e[00m") - BOLD=$(echo -en "\e[01m") -fi - -log_header() { - printf "\n${BOLD}${MAGENTA}========== %s ==========${NORMAL}\n" "$@" >&2 -} - -log_success() { - printf "${GREEN}✔ %s${NORMAL}\n" "$@" >&2 -} - -log_failure() { - printf "${RED}✖ %s${NORMAL}\n" "$@" >&2 -} - -assert_eq() { - local expected="$1" - local actual="$2" - local msg="${3-}" - - if [ "$expected" == "$actual" ]; then - return 0 - else - [ "${#msg}" -gt 0 ] && log_failure "$expected == $actual :: $msg" || true - return 1 - fi -} - -assert_not_eq() { - local expected="$1" - local actual="$2" - local msg="${3-}" - - if [ ! "$expected" == "$actual" ]; then - return 0 - else - [ "${#msg}" -gt 0 ] && log_failure "$expected != $actual :: $msg" || true - return 1 - fi -} - -assert_true() { - local actual="$1" - local msg="${2-}" - - assert_eq true "$actual" "$msg" - return "$?" -} - -assert_false() { - local actual="$1" - local msg="${2-}" - - assert_eq false "$actual" "$msg" - return "$?" -} - -assert_empty() { - local actual=$1 - local msg="${2-}" - - assert_eq "" "$actual" "$msg" - return "$?" -} - -assert_contain() { - local haystack="$1" - local needle="${2-}" - local msg="${3-}" - - if [ -z "${needle:+x}" ]; then - return 0 - fi - - if [ -z "$haystack" ]; then - return 1 - fi - - if [ -z "${haystack##*$needle*}" ]; then - return 0 - else - [ "${#msg}" -gt 0 ] && log_failure "$haystack doesn't contain $needle :: $msg" || true - return 1 - fi -} - +#!/usr/bin/env bash +# copied from https://github.com/torokmark/assert.sh/blob/main/assert.sh + +##################################################################### +## +## title: Assert Extension +## +## description: +## Assert extension of shell (bash, ...) +## with the common assert functions +## Function list based on: +## http://junit.sourceforge.net/javadoc/org/junit/Assert.html +## Log methods : inspired by +## - https://natelandau.com/bash-scripting-utilities/ +## author: Mark Torok +## +## date: 07. Dec. 2016 +## +## license: MIT +## +##################################################################### + +if command -v tput &>/dev/null && tty -s; then + RED=$(tput setaf 1) + GREEN=$(tput setaf 2) + MAGENTA=$(tput setaf 5) + NORMAL=$(tput sgr0) + BOLD=$(tput bold) +else + RED=$(echo -en "\e[31m") + GREEN=$(echo -en "\e[32m") + MAGENTA=$(echo -en "\e[35m") + NORMAL=$(echo -en "\e[00m") + BOLD=$(echo -en "\e[01m") +fi + +log_header() { + printf "\n${BOLD}${MAGENTA}========== %s ==========${NORMAL}\n" "$@" >&2 +} + +log_success() { + printf "${GREEN}✔ %s${NORMAL}\n" "$@" >&2 +} + +log_failure() { + printf "${RED}✖ %s${NORMAL}\n" "$@" >&2 +} + +assert_eq() { + local expected="$1" + local actual="$2" + local msg="${3-}" + + if [ "$expected" == "$actual" ]; then + return 0 + else + [ "${#msg}" -gt 0 ] && log_failure "$expected == $actual :: $msg" || true + return 1 + fi +} + +assert_not_eq() { + local expected="$1" + local actual="$2" + local msg="${3-}" + + if [ ! "$expected" == "$actual" ]; then + return 0 + else + [ "${#msg}" -gt 0 ] && log_failure "$expected != $actual :: $msg" || true + return 1 + fi +} + +assert_true() { + local actual="$1" + local msg="${2-}" + + assert_eq true "$actual" "$msg" + return "$?" +} + +assert_false() { + local actual="$1" + local msg="${2-}" + + assert_eq false "$actual" "$msg" + return "$?" +} + +assert_empty() { + local actual=$1 + local msg="${2-}" + + assert_eq "" "$actual" "$msg" + return "$?" +} + +assert_contain() { + local haystack="$1" + local needle="${2-}" + local msg="${3-}" + + if [ -z "${needle:+x}" ]; then + return 0 + fi + + if [ -z "$haystack" ]; then + return 1 + fi + + if [ -z "${haystack##*$needle*}" ]; then + return 0 + else + [ "${#msg}" -gt 0 ] && log_failure "$haystack doesn't contain $needle :: $msg" || true + return 1 + fi +} + diff --git a/setup_repo.sh b/setup_repo.sh deleted file mode 100755 index 8c8c6ab..0000000 --- a/setup_repo.sh +++ /dev/null @@ -1,119 +0,0 @@ -#! /usr/bin/env bash -# This script sets up a GitHub repository with recommended settings. - -REPO_NAME_WITH_OWNER=$(gh repo view --json nameWithOwner -q '.nameWithOwner') - -read -p "Initialising repo setting for $REPO_NAME_WITH_OWNER. Continue (y/N)? " choice -case "$choice" in - y|Y ) echo "Proceeding...";; - * ) echo "Abort" && exit 1;; -esac - -echo "Configure basic repo settings..." -gh api \ - --silent \ - --method PATCH \ - -H "Accept: application/vnd.github+json" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - "/repos/$REPO_NAME_WITH_OWNER" \ - --input - <<< '{ - "has_wiki": false, - "allow_squash_merge": true, - "allow_merge_commit": false, - "allow_rebase_merge": false, - "allow_auto_merge": true, - "delete_branch_on_merge": true, - "use_squash_pr_title_as_default": true, - "squash_merge_commit_title": "PR_TITLE", - "squash_merge_commit_message": "PR_BODY" -}' - -echo "Enable Dependabot alerts..." -gh api \ - --method PUT \ - -H "Accept: application/vnd.github+json" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - "/repos/$REPO_NAME_WITH_OWNER/vulnerability-alerts" - -echo "Enable Dependabot security updates..." -gh api \ - --method PUT \ - -H "Accept: application/vnd.github+json" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - "/repos/$REPO_NAME_WITH_OWNER/automated-security-fixes" - -echo "Allow action in this repo to be accessible from repositories in the 'linz' organization..." -gh api \ - --method PUT \ - -H "Accept: application/vnd.github+json" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - "/repos/$REPO_NAME_WITH_OWNER/actions/permissions/access" \ - --input - <<< '{ - "access_level": "organization" -}' - -if gh ruleset list | grep --quiet "Default branch"; then - echo "Default branch ruleset already exists." -else - echo "Setup ruleset to protect default branch..." - # note - "integration_id": 15368 is 'Github Actions' - gh api \ - --method POST \ - -H "Accept: application/vnd.github+json" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - "/repos/$REPO_NAME_WITH_OWNER/rulesets" \ - --input - <<< '{ - "name": "Default branch", - "target": "branch", - "enforcement": "active", - "conditions": { - "ref_name": { - "include": [ - "~DEFAULT_BRANCH" - ], - "exclude": [] - } - }, - "rules": [ - { - "type": "deletion" - }, - { - "type": "non_fast_forward" - }, - { - "type": "pull_request", - "parameters": { - "allowed_merge_methods": ["squash"], - "dismiss_stale_reviews_on_push": true, - "require_code_owner_review": true, - "require_last_push_approval": true, - "required_approving_review_count": 1, - "required_review_thread_resolution": false - } - }, - { - "type": "required_status_checks", - "parameters": { - "strict_required_status_checks_policy": false, - "required_status_checks": [ - { - "context": "test", - "integration_id": 15368 - }, - { - "context": "pr-lint", - "integration_id": 15368 - } - ] - } - } - ] -}' -fi - -echo "✅ Repo settings applied." - -me=$(basename "$0") -rm "$me" -echo "✅ Deleted $me, you can commit this change to the repo as the script is no longer needed." \ No newline at end of file From 68529aa41d2d99218a43d1f8e9de8e8752c10505 Mon Sep 17 00:00:00 2001 From: Corbyn Noble-May Date: Fri, 28 Nov 2025 10:47:13 +1300 Subject: [PATCH 02/30] Assert in CI --- .github/workflows/ci.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad4d526..873898b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,10 +27,6 @@ jobs: set +e npm install safe-chain-test exitCode=$? - if [[ $exitCode -eq 1 ]]; then - echo "Failed to download malware test!" - else - exit 1 - fi + assert_eq "1" "$exitCode" exit 0 continue-on-error: true \ No newline at end of file From 20259e96354ece9f849fdc2c38c13050b6e5c1bf Mon Sep 17 00:00:00 2001 From: Corbyn Noble-May Date: Fri, 28 Nov 2025 10:53:41 +1300 Subject: [PATCH 03/30] Add node files for CI, update readme to reference new action --- README.md | 14 +++++++------- package-lock.json | 13 +++++++++++++ package.json | 20 ++++++++++++++++++++ 3 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 package-lock.json create mode 100644 package.json diff --git a/README.md b/README.md index e1fc4e3..0f83b65 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ See [action.yml](action.yml) ```yaml -- uses: actions/setup-node@v6 +- uses: linz/setup-node@XXX with: # Version Spec of the version to use in SemVer notation. # It also admits such aliases as lts/*, latest, nightly and canary builds @@ -117,7 +117,7 @@ See [action.yml](action.yml) ```yaml steps: - uses: actions/checkout@v5 -- uses: actions/setup-node@v6 +- uses: linz/setup-node@XXX with: node-version: 24 - run: npm ci @@ -166,7 +166,7 @@ See the examples of using cache for `yarn`/`pnpm` and `cache-dependency-path` in ```yaml steps: - uses: actions/checkout@v5 -- uses: actions/setup-node@v6 +- uses: linz/setup-node@XXX with: node-version: 24 cache: 'npm' @@ -179,7 +179,7 @@ steps: ```yaml steps: - uses: actions/checkout@v5 -- uses: actions/setup-node@v6 +- uses: linz/setup-node@XXX with: node-version: 24 cache: 'npm' @@ -195,7 +195,7 @@ This behavior is controlled by the `package-manager-cache` input, which defaults ```yaml steps: - uses: actions/checkout@v5 -- uses: actions/setup-node@v6 +- uses: linz/setup-node@XXX with: package-manager-cache: false - run: npm ci @@ -215,7 +215,7 @@ jobs: steps: - uses: actions/checkout@v5 - name: Setup node - uses: actions/setup-node@v6 + uses: linz/setup-node@XXX with: node-version: ${{ matrix.node }} - run: npm ci @@ -229,7 +229,7 @@ jobs: To get a higher rate limit, you can [generate a personal access token on github.com](https://github.com/settings/tokens/new) and pass it as the `token` input for the action: ```yaml -uses: actions/setup-node@v6 +uses: linz/setup-node@XXX with: token: ${{ secrets.GH_DOTCOM_TOKEN }} node-version: 24 diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..37b345e --- /dev/null +++ b/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "action-setup-node", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "action-setup-node", + "version": "1.0.0", + "license": "ISC" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..c89d5fc --- /dev/null +++ b/package.json @@ -0,0 +1,20 @@ +{ + "name": "action-setup-node", + "version": "1.0.0", + "description": "[![basic-validation](https://github.com/actions/setup-node/actions/workflows/basic-validation.yml/badge.svg)](https://github.com/actions/setup-node/actions/workflows/basic-validation.yml)\r [![versions](https://github.com/actions/setup-node/actions/workflows/versions.yml/badge.svg)](https://github.com/actions/setup-node/actions/workflows/versions.yml)\r [![e2e-cache](https://github.com/actions/setup-node/actions/workflows/e2e-cache.yml/badge.svg?branch=main)](https://github.com/actions/setup-node/actions/workflows/e2e-cache.yml)\r [![proxy](https://github.com/actions/setup-node/actions/workflows/proxy.yml/badge.svg)](https://github.com/actions/setup-node/actions/workflows/proxy.yml)", + "homepage": "https://github.com/linz/action-setup-node#readme", + "bugs": { + "url": "https://github.com/linz/action-setup-node/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/linz/action-setup-node.git" + }, + "license": "ISC", + "author": "", + "type": "commonjs", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + } +} From 82773a5f51b8303628954177c954dafae425bcf6 Mon Sep 17 00:00:00 2001 From: Corbyn Noble-May Date: Fri, 28 Nov 2025 13:15:10 +1300 Subject: [PATCH 04/30] Update readme --- README.md | 275 +----------------------------------------------------- 1 file changed, 2 insertions(+), 273 deletions(-) diff --git a/README.md b/README.md index 0f83b65..b048194 100644 --- a/README.md +++ b/README.md @@ -1,273 +1,2 @@ -# setup-node -[![basic-validation](https://github.com/actions/setup-node/actions/workflows/basic-validation.yml/badge.svg)](https://github.com/actions/setup-node/actions/workflows/basic-validation.yml) -[![versions](https://github.com/actions/setup-node/actions/workflows/versions.yml/badge.svg)](https://github.com/actions/setup-node/actions/workflows/versions.yml) -[![e2e-cache](https://github.com/actions/setup-node/actions/workflows/e2e-cache.yml/badge.svg?branch=main)](https://github.com/actions/setup-node/actions/workflows/e2e-cache.yml) -[![proxy](https://github.com/actions/setup-node/actions/workflows/proxy.yml/badge.svg)](https://github.com/actions/setup-node/actions/workflows/proxy.yml) - -This action wraps the [actions/setup-node](https://github.com/actions/setup-node) action and implements [Aikido Safe-Chain](https://github.com/AikidoSec/safe-chain) to fail install upon an attempt to install a malicious node package. Below is the [actions/setup-node](https://github.com/actions/setup-node) documentation as this action is a like-for-like replacement. - -This action provides the following functionality for GitHub Actions users: - -- Optionally downloading and caching distribution of the requested Node.js version, and adding it to the PATH -- Optionally caching npm/yarn/pnpm dependencies -- Registering problem matchers for error output -- Configuring authentication for GPR or npm - -## Breaking changes in V6 - -- Caching is now automatically enabled for npm projects when either the `devEngines.packageManager` field or the top-level `packageManager` field in `package.json` is set to `npm`. For other package managers, such as Yarn and pnpm, caching is disabled by default and must be configured manually using the `cache` input. - -- The `always-auth` input has been removed, as it is deprecated and will no longer be supported in future npm releases. To ensure your workflows continue to run without warnings or errors, please remove any references to `always-auth` from your configuration. - -## Breaking changes in V5 - -- Enabled caching by default with package manager detection if no cache input is provided. - > For workflows with elevated privileges or access to sensitive information, we recommend disabling automatic caching by setting `package-manager-cache: false` when caching is not needed for secure operation. - -- Upgraded action from node20 to node24. - > Make sure your runner is on version v2.327.1 or later to ensure compatibility with this release. [See Release Notes](https://github.com/actions/runner/releases/tag/v2.327.1) - -For more details, see the full release notes on the [releases page](https://github.com/actions/setup-node/releases/v5.0.0) - -## Usage - -See [action.yml](action.yml) - - -```yaml -- uses: linz/setup-node@XXX - with: - # Version Spec of the version to use in SemVer notation. - # It also admits such aliases as lts/*, latest, nightly and canary builds - # Examples: 12.x, 10.15.1, >=10.15.0, lts/Hydrogen, 16-nightly, latest, node - node-version: '' - - # File containing the version Spec of the version to use. Examples: package.json, .nvmrc, .node-version, .tool-versions. - # If node-version and node-version-file are both provided the action will use version from node-version. - node-version-file: '' - - # Set this option if you want the action to check for the latest available version - # that satisfies the version spec. - # It will only get affect for lts Nodejs versions (12.x, >=10.15.0, lts/Hydrogen). - # Default: false - check-latest: false - - # Target architecture for Node to use. Examples: x86, x64. Will use system architecture by default. - # Default: ''. The action use system architecture by default - architecture: '' - - # Used to pull node distributions from https://github.com/actions/node-versions. - # Since there's a default, this is typically not supplied by the user. - # When running this action on github.com, the default value is sufficient. - # When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting. - # - # We recommend using a service account with the least permissions necessary. Also - # when generating a new PAT, select the least scopes necessary. - # - # [Learn more about creating and using encrypted secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets) - # - # Default: ${{ github.server_url == 'https://github.com' && github.token || '' }} - token: '' - - # Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm. - # Package manager should be pre-installed - # Default: '' - cache: '' - - # Controls automatic caching for npm. By default, caching for npm is enabled if either the devEngines.packageManager field or the top-level packageManager field in package.json specifies npm and no explicit cache input is provided. - # To disable automatic caching for npm, set package-manager-cache to false. - # default: true - package-manager-cache: true - - # Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. - # It will generate hash from the target file for primary key. It works only If cache is specified. - # Supports wildcards or a list of file names for caching multiple dependencies. - # Default: '' - cache-dependency-path: '' - - # Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, - # and set up auth to read in from env.NODE_AUTH_TOKEN. - # Default: '' - registry-url: '' - - # Optional scope for authenticating against scoped registries. - # Will fall back to the repository owner when using the GitHub Packages registry (https://npm.pkg.github.com/). - # Default: '' - scope: '' - - # Optional mirror to download binaries from. - # Artifacts need to match the official Node.js - # Example: - # V8 Canaray Build: /download/v8-canary - # RC Build: /download/rc - # Official: Build /dist - # Nightly build: /download/nightly - # Default: '' - mirror: '' - - # Optional mirror token. - # The token will be used as a bearer token in the Authorization header - # Default: '' - mirror-token: '' -``` - - -**Basic:** - -```yaml -steps: -- uses: actions/checkout@v5 -- uses: linz/setup-node@XXX - with: - node-version: 24 -- run: npm ci -- run: npm test -``` - -The `node-version` input is optional. If not supplied, the node version from PATH will be used. However, it is recommended to always specify Node.js version and don't rely on the system one. - -The action will first check the local cache for a semver match. If unable to find a specific version in the cache, the action will attempt to download a version of Node.js. It will pull LTS versions from [node-versions releases](https://github.com/actions/node-versions/releases) and on miss or failure will fall back to the previous behavior of downloading directly from [node dist](https://nodejs.org/dist/). - -For information regarding locally cached versions of Node.js on GitHub hosted runners, check out [GitHub Actions Runner Images](https://github.com/actions/runner-images). - -### Supported version syntax - -The `node-version` input supports the Semantic Versioning Specification, for more detailed examples please refer to [the semver package documentation](https://github.com/npm/node-semver). - -Examples: - - - Major versions: `22`, `24` - - More specific versions: `20.19`, `22.17.1` , `24.8.0` - - NVM LTS syntax: `lts/iron`, `lts/jod`, `lts/*`, `lts/-n` - - Latest release: `*` or `latest`/`current`/`node` - -**Note:** Like the other values, `*` will get the latest [locally-cached Node.js version](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md#nodejs), or the latest version from [actions/node-versions](https://github.com/actions/node-versions/blob/main/versions-manifest.json), depending on the [`check-latest`](docs/advanced-usage.md#check-latest-version) input. - -`current`/`latest`/`node` always resolve to the latest [dist version](https://nodejs.org/dist/index.json). -That version is then downloaded from actions/node-versions if possible, or directly from Node.js if not. -Since it will not be cached always, there is possibility of hitting rate limit when downloading from dist - -### Checking in lockfiles - -It's **always** recommended to commit the lockfile of your package manager for security and performance reasons. For more information consult the "Working with lockfiles" section of the [Advanced usage](docs/advanced-usage.md#working-with-lockfiles) guide. - -## Caching global packages data - -The action has a built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/cache) under the hood for caching global packages data but requires less configuration settings. Supported package managers are `npm`, `yarn`, `pnpm` (v6.10+). The `cache` input is optional. - -The action defaults to search for the dependency file (`package-lock.json`, `npm-shrinkwrap.json` or `yarn.lock`) in the repository root, and uses its hash as a part of the cache key. Use `cache-dependency-path` for cases when multiple dependency files are used, or they are located in different subdirectories. - -**Note:** The action does not cache `node_modules` - -See the examples of using cache for `yarn`/`pnpm` and `cache-dependency-path` input in the [Advanced usage](docs/advanced-usage.md#caching-packages-data) guide. - -**Caching npm dependencies:** - -```yaml -steps: -- uses: actions/checkout@v5 -- uses: linz/setup-node@XXX - with: - node-version: 24 - cache: 'npm' -- run: npm ci -- run: npm test -``` - -**Caching npm dependencies in monorepos:** - -```yaml -steps: -- uses: actions/checkout@v5 -- uses: linz/setup-node@XXX - with: - node-version: 24 - cache: 'npm' - cache-dependency-path: subdir/package-lock.json -- run: npm ci -- run: npm test -``` - -Caching for npm dependencies is automatically enabled when your `package.json` contains either `devEngines.packageManager` field or top-level `packageManager` field set to `npm`, and no explicit cache input is provided. - -This behavior is controlled by the `package-manager-cache` input, which defaults to `true`. To turn off automatic caching, set `package-manager-cache` to `false`. - -```yaml -steps: -- uses: actions/checkout@v5 -- uses: linz/setup-node@XXX - with: - package-manager-cache: false -- run: npm ci -``` -> If your `package.json` file does not include a `packageManager` field set to `npm`, caching will be disabled unless you explicitly enable it. For workflows with elevated privileges or access to sensitive information, we recommend disabling automatic caching for npm by setting `package-manager-cache: false` when caching is not required for secure operation. - -## Matrix Testing - -```yaml -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - node: [ 20, 22, 24 ] - name: Node ${{ matrix.node }} sample - steps: - - uses: actions/checkout@v5 - - name: Setup node - uses: linz/setup-node@XXX - with: - node-version: ${{ matrix.node }} - - run: npm ci - - run: npm test -``` - -## Using `setup-node` on GHES - -`setup-node` comes pre-installed on the appliance with GHES if Actions is enabled. When dynamically downloading Nodejs distributions, `setup-node` downloads distributions from [`actions/node-versions`](https://github.com/actions/node-versions) on github.com (outside of the appliance). These calls to `actions/node-versions` are made via unauthenticated requests, which are limited to [60 requests per hour per IP](https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting). If more requests are made within the time frame, then you will start to see rate-limit errors during downloading that looks like: `##[error]API rate limit exceeded for...`. After that error the action will try to download versions directly from the official site, but it also can have rate limit so it's better to put token. - -To get a higher rate limit, you can [generate a personal access token on github.com](https://github.com/settings/tokens/new) and pass it as the `token` input for the action: - -```yaml -uses: linz/setup-node@XXX -with: - token: ${{ secrets.GH_DOTCOM_TOKEN }} - node-version: 24 -``` - -If the runner is not able to access github.com, any Nodejs versions requested during a workflow run must come from the runner's tool cache. See "[Setting up the tool cache on self-hosted runners without internet access](https://docs.github.com/en/enterprise-server@3.2/admin/github-actions/managing-access-to-actions-from-githubcom/setting-up-the-tool-cache-on-self-hosted-runners-without-internet-access)" for more information. - -## Advanced usage - - - [Check latest version](docs/advanced-usage.md#check-latest-version) - - [Using a node version file](docs/advanced-usage.md#node-version-file) - - [Using different architectures](docs/advanced-usage.md#architecture) - - [Using v8 canary versions](docs/advanced-usage.md#v8-canary-versions) - - [Using nightly versions](docs/advanced-usage.md#nightly-versions) - - [Using rc versions](docs/advanced-usage.md#rc-versions) - - [Caching packages data](docs/advanced-usage.md#caching-packages-data) - - [Using multiple operating systems and architectures](docs/advanced-usage.md#multiple-operating-systems-and-architectures) - - [Publishing to npmjs and GPR with npm](docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-npm) - - [Publishing to npmjs and GPR with yarn](docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-yarn) - - [Using private packages](docs/advanced-usage.md#use-private-packages) - -## Recommended permissions - -When using the `setup-node` action in your GitHub Actions workflow, it is recommended to set the following permissions to ensure proper functionality: - -```yaml -permissions: - contents: read # access to check out code and install dependencies -``` - -## License - -The scripts and documentation in this project are released under the [MIT License](LICENSE) - -## Contributions - -Contributions are welcome! See [Contributor's Guide](docs/contributors.md) - -## Code of Conduct - -:wave: Be nice. See [our code of conduct](CODE_OF_CONDUCT.md) +# action-setup-node +This action wraps the [actions/setup-node](https://github.com/actions/setup-node) action and implements [Aikido Safe-Chain](https://github.com/AikidoSec/safe-chain) to fail install upon an attempt to install a malicious node package. Please refer to the [actions/setup-node](https://github.com/actions/setup-node) documentation as this action is a like-for-like replacement, however, in all instances please use `linz/setup-node` rather than `actions/setup-node`. \ No newline at end of file From de795aa23508c108060d1dfd8cfaa733e2fea572 Mon Sep 17 00:00:00 2001 From: cnoble-may Date: Fri, 28 Nov 2025 13:38:43 +1300 Subject: [PATCH 05/30] Update README.md Co-authored-by: Jackie Weng <120340761+jackie-linz@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b048194..e43d05e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # action-setup-node -This action wraps the [actions/setup-node](https://github.com/actions/setup-node) action and implements [Aikido Safe-Chain](https://github.com/AikidoSec/safe-chain) to fail install upon an attempt to install a malicious node package. Please refer to the [actions/setup-node](https://github.com/actions/setup-node) documentation as this action is a like-for-like replacement, however, in all instances please use `linz/setup-node` rather than `actions/setup-node`. \ No newline at end of file +This action wraps the [actions/setup-node](https://github.com/actions/setup-node) action and implements [Aikido Safe-Chain](https://github.com/AikidoSec/safe-chain) to fail install upon an attempt to install a malicious node package. Please refer to the [actions/setup-node](https://github.com/actions/setup-node) documentation as this action is a like-for-like replacement, however, in all instances please use `linz/action-setup-node` rather than `actions/setup-node`. \ No newline at end of file From 3b9f209e507e9b48bf3fe62509c33f612646161e Mon Sep 17 00:00:00 2001 From: Corbyn Noble-May Date: Fri, 28 Nov 2025 14:36:18 +1300 Subject: [PATCH 06/30] Move CI test file to test dir --- .github/workflows/ci.yml | 6 + node_modules/.bin/aikido-bun | 16 + node_modules/.bin/aikido-bun.cmd | 17 + node_modules/.bin/aikido-bun.ps1 | 28 + node_modules/.bin/aikido-bunx | 16 + node_modules/.bin/aikido-bunx.cmd | 17 + node_modules/.bin/aikido-bunx.ps1 | 28 + node_modules/.bin/aikido-npm | 16 + node_modules/.bin/aikido-npm.cmd | 17 + node_modules/.bin/aikido-npm.ps1 | 28 + node_modules/.bin/aikido-npx | 16 + node_modules/.bin/aikido-npx.cmd | 17 + node_modules/.bin/aikido-npx.ps1 | 28 + node_modules/.bin/aikido-pnpm | 16 + node_modules/.bin/aikido-pnpm.cmd | 17 + node_modules/.bin/aikido-pnpm.ps1 | 28 + node_modules/.bin/aikido-pnpx | 16 + node_modules/.bin/aikido-pnpx.cmd | 17 + node_modules/.bin/aikido-pnpx.ps1 | 28 + node_modules/.bin/aikido-yarn | 16 + node_modules/.bin/aikido-yarn.cmd | 17 + node_modules/.bin/aikido-yarn.ps1 | 28 + node_modules/.bin/glob | 16 + node_modules/.bin/glob.cmd | 17 + node_modules/.bin/glob.ps1 | 28 + node_modules/.bin/node-which | 16 + node_modules/.bin/node-which.cmd | 17 + node_modules/.bin/node-which.ps1 | 28 + node_modules/.bin/safe-chain | 16 + node_modules/.bin/safe-chain.cmd | 17 + node_modules/.bin/safe-chain.ps1 | 28 + node_modules/.bin/semver | 16 + node_modules/.bin/semver.cmd | 17 + node_modules/.bin/semver.ps1 | 28 + node_modules/.package-lock.json | 1309 +++++ node_modules/@aikidosec/safe-chain/LICENSE | 674 +++ node_modules/@aikidosec/safe-chain/README.md | 149 + .../@aikidosec/safe-chain/bin/aikido-bun.js | 10 + .../@aikidosec/safe-chain/bin/aikido-bunx.js | 10 + .../@aikidosec/safe-chain/bin/aikido-npm.js | 10 + .../@aikidosec/safe-chain/bin/aikido-npx.js | 10 + .../@aikidosec/safe-chain/bin/aikido-pnpm.js | 10 + .../@aikidosec/safe-chain/bin/aikido-pnpx.js | 10 + .../@aikidosec/safe-chain/bin/aikido-yarn.js | 10 + .../@aikidosec/safe-chain/bin/safe-chain.js | 81 + .../docs/safe-package-manager-demo.gif | Bin 0 -> 28651 bytes .../docs/safe-package-manager-demo.png | Bin 0 -> 18054 bytes .../safe-chain/docs/shell-integration.md | 123 + .../@aikidosec/safe-chain/package.json | 51 + .../@aikidosec/safe-chain/src/api/aikido.js | 33 + .../@aikidosec/safe-chain/src/api/npmApi.js | 50 + .../safe-chain/src/config/cliArguments.js | 50 + .../safe-chain/src/config/configFile.js | 91 + .../safe-chain/src/config/settings.js | 14 + .../safe-chain/src/environment/environment.js | 14 + .../src/environment/userInteraction.js | 96 + .../@aikidosec/safe-chain/src/main.js | 68 + .../packagemanager/_shared/matchesCommand.js | 13 + .../bun/createBunPackageManager.js | 42 + .../packagemanager/currentPackageManager.js | 44 + .../npm/createPackageManager.js | 49 + .../commandArgumentScanner.js | 37 + .../npm/dependencyScanner/nullScanner.js | 6 + .../parsing/parsePackagesFromInstallArgs.js | 111 + .../src/packagemanager/npm/runNpmCommand.js | 49 + .../npm/utils/abbrevs-generated.js | 358 ++ .../src/packagemanager/npm/utils/cmd-list.js | 169 + .../packagemanager/npm/utils/npmCommands.js | 26 + .../npx/createPackageManager.js | 12 + .../commandArgumentScanner.js | 31 + .../npx/parsing/parsePackagesFromArguments.js | 108 + .../src/packagemanager/npx/runNpxCommand.js | 20 + .../pnpm/createPackageManager.js | 46 + .../commandArgumentScanner.js | 28 + .../parsing/parsePackagesFromArguments.js | 88 + .../src/packagemanager/pnpm/runPnpmCommand.js | 31 + .../yarn/createPackageManager.js | 33 + .../commandArgumentScanner.js | 28 + .../parsing/parsePackagesFromArguments.js | 104 + .../src/packagemanager/yarn/runYarnCommand.js | 53 + .../safe-chain/src/registryProxy/certUtils.js | 114 + .../src/registryProxy/mitmRequestHandler.js | 123 + .../src/registryProxy/parsePackageFromUrl.js | 48 + .../src/registryProxy/plainHttpProxy.js | 74 + .../src/registryProxy/registryProxy.js | 160 + .../src/registryProxy/tunnelRequestHandler.js | 123 + .../safe-chain/src/scanning/audit/index.js | 56 + .../safe-chain/src/scanning/index.js | 84 + .../src/scanning/malwareDatabase.js | 81 + .../src/shell-integration/helpers.js | 106 + .../templates/unix-wrapper.template.sh | 22 + .../templates/windows-wrapper.template.cmd | 24 + .../src/shell-integration/setup-ci.js | 123 + .../safe-chain/src/shell-integration/setup.js | 109 + .../src/shell-integration/shellDetection.js | 26 + .../startup-scripts/init-fish.fish | 70 + .../startup-scripts/init-posix.sh | 62 + .../startup-scripts/init-pwsh.ps1 | 88 + .../supported-shells/bash.js | 116 + .../supported-shells/fish.js | 69 + .../supported-shells/powershell.js | 65 + .../supported-shells/windowsPowershell.js | 65 + .../shell-integration/supported-shells/zsh.js | 69 + .../src/shell-integration/teardown.js | 61 + .../safe-chain/src/utils/safeSpawn.js | 100 + node_modules/@isaacs/cliui/LICENSE.txt | 14 + node_modules/@isaacs/cliui/README.md | 143 + node_modules/@isaacs/cliui/build/index.cjs | 317 ++ node_modules/@isaacs/cliui/build/index.d.cts | 43 + node_modules/@isaacs/cliui/build/lib/index.js | 302 ++ node_modules/@isaacs/cliui/index.mjs | 14 + node_modules/@isaacs/cliui/package.json | 86 + node_modules/@isaacs/fs-minipass/LICENSE | 15 + node_modules/@isaacs/fs-minipass/README.md | 71 + .../fs-minipass/dist/commonjs/index.d.ts | 118 + .../fs-minipass/dist/commonjs/index.d.ts.map | 1 + .../fs-minipass/dist/commonjs/index.js | 430 ++ .../fs-minipass/dist/commonjs/index.js.map | 1 + .../fs-minipass/dist/commonjs/package.json | 3 + .../@isaacs/fs-minipass/dist/esm/index.d.ts | 118 + .../fs-minipass/dist/esm/index.d.ts.map | 1 + .../@isaacs/fs-minipass/dist/esm/index.js | 420 ++ .../@isaacs/fs-minipass/dist/esm/index.js.map | 1 + .../@isaacs/fs-minipass/dist/esm/package.json | 3 + node_modules/@isaacs/fs-minipass/package.json | 72 + node_modules/@npmcli/agent/README.md | 40 + node_modules/@npmcli/agent/lib/agents.js | 206 + node_modules/@npmcli/agent/lib/dns.js | 53 + node_modules/@npmcli/agent/lib/errors.js | 61 + node_modules/@npmcli/agent/lib/index.js | 56 + node_modules/@npmcli/agent/lib/options.js | 86 + node_modules/@npmcli/agent/lib/proxy.js | 88 + node_modules/@npmcli/agent/package.json | 60 + node_modules/@npmcli/fs/LICENSE.md | 20 + node_modules/@npmcli/fs/README.md | 97 + .../@npmcli/fs/lib/common/get-options.js | 20 + node_modules/@npmcli/fs/lib/common/node.js | 9 + node_modules/@npmcli/fs/lib/cp/LICENSE | 15 + node_modules/@npmcli/fs/lib/cp/errors.js | 129 + node_modules/@npmcli/fs/lib/cp/index.js | 22 + node_modules/@npmcli/fs/lib/cp/polyfill.js | 428 ++ node_modules/@npmcli/fs/lib/index.js | 13 + node_modules/@npmcli/fs/lib/move-file.js | 78 + node_modules/@npmcli/fs/lib/readdir-scoped.js | 20 + node_modules/@npmcli/fs/lib/with-temp-dir.js | 39 + node_modules/@npmcli/fs/package.json | 54 + node_modules/@npmcli/redact/LICENSE | 21 + node_modules/@npmcli/redact/README.md | 42 + node_modules/@npmcli/redact/lib/deep-map.js | 71 + node_modules/@npmcli/redact/lib/error.js | 28 + node_modules/@npmcli/redact/lib/index.js | 44 + node_modules/@npmcli/redact/lib/matchers.js | 88 + node_modules/@npmcli/redact/lib/server.js | 59 + node_modules/@npmcli/redact/lib/utils.js | 202 + node_modules/@npmcli/redact/package.json | 52 + node_modules/@pkgjs/parseargs/.editorconfig | 14 + node_modules/@pkgjs/parseargs/CHANGELOG.md | 147 + node_modules/@pkgjs/parseargs/LICENSE | 201 + node_modules/@pkgjs/parseargs/README.md | 413 ++ .../parseargs/examples/is-default-value.js | 25 + .../parseargs/examples/limit-long-syntax.js | 35 + .../@pkgjs/parseargs/examples/negate.js | 43 + .../parseargs/examples/no-repeated-options.js | 31 + .../parseargs/examples/ordered-options.mjs | 41 + .../parseargs/examples/simple-hard-coded.js | 26 + node_modules/@pkgjs/parseargs/index.js | 396 ++ .../@pkgjs/parseargs/internal/errors.js | 47 + .../@pkgjs/parseargs/internal/primordials.js | 393 ++ .../@pkgjs/parseargs/internal/util.js | 14 + .../@pkgjs/parseargs/internal/validators.js | 89 + node_modules/@pkgjs/parseargs/package.json | 36 + node_modules/@pkgjs/parseargs/utils.js | 198 + node_modules/agent-base/LICENSE | 22 + node_modules/agent-base/README.md | 69 + node_modules/agent-base/dist/helpers.d.ts | 15 + node_modules/agent-base/dist/helpers.d.ts.map | 1 + node_modules/agent-base/dist/helpers.js | 66 + node_modules/agent-base/dist/helpers.js.map | 1 + node_modules/agent-base/dist/index.d.ts | 41 + node_modules/agent-base/dist/index.d.ts.map | 1 + node_modules/agent-base/dist/index.js | 178 + node_modules/agent-base/dist/index.js.map | 1 + node_modules/agent-base/package.json | 46 + node_modules/ansi-regex/index.d.ts | 33 + node_modules/ansi-regex/index.js | 14 + node_modules/ansi-regex/license | 9 + node_modules/ansi-regex/package.json | 61 + node_modules/ansi-regex/readme.md | 66 + node_modules/ansi-styles/index.d.ts | 236 + node_modules/ansi-styles/index.js | 223 + node_modules/ansi-styles/license | 9 + node_modules/ansi-styles/package.json | 54 + node_modules/ansi-styles/readme.md | 173 + .../balanced-match/.github/FUNDING.yml | 2 + node_modules/balanced-match/LICENSE.md | 21 + node_modules/balanced-match/README.md | 97 + node_modules/balanced-match/index.js | 62 + node_modules/balanced-match/package.json | 48 + .../brace-expansion/.github/FUNDING.yml | 2 + node_modules/brace-expansion/LICENSE | 21 + node_modules/brace-expansion/README.md | 135 + node_modules/brace-expansion/index.js | 203 + node_modules/brace-expansion/package.json | 49 + node_modules/cacache/LICENSE.md | 16 + node_modules/cacache/README.md | 715 +++ node_modules/cacache/lib/content/path.js | 29 + node_modules/cacache/lib/content/read.js | 165 + node_modules/cacache/lib/content/rm.js | 18 + node_modules/cacache/lib/content/write.js | 206 + node_modules/cacache/lib/entry-index.js | 336 ++ node_modules/cacache/lib/get.js | 170 + node_modules/cacache/lib/index.js | 42 + node_modules/cacache/lib/memoization.js | 72 + node_modules/cacache/lib/put.js | 80 + node_modules/cacache/lib/rm.js | 31 + node_modules/cacache/lib/util/glob.js | 7 + .../cacache/lib/util/hash-to-segments.js | 7 + node_modules/cacache/lib/util/tmp.js | 26 + node_modules/cacache/lib/verify.js | 258 + node_modules/cacache/package.json | 83 + node_modules/chalk/license | 9 + node_modules/chalk/package.json | 83 + node_modules/chalk/readme.md | 297 ++ node_modules/chalk/source/index.d.ts | 325 ++ node_modules/chalk/source/index.js | 225 + node_modules/chalk/source/utilities.js | 33 + .../source/vendor/ansi-styles/index.d.ts | 236 + .../chalk/source/vendor/ansi-styles/index.js | 223 + .../source/vendor/supports-color/browser.d.ts | 1 + .../source/vendor/supports-color/browser.js | 34 + .../source/vendor/supports-color/index.d.ts | 55 + .../source/vendor/supports-color/index.js | 182 + node_modules/chownr/LICENSE.md | 63 + node_modules/chownr/README.md | 3 + node_modules/chownr/dist/commonjs/index.d.ts | 3 + .../chownr/dist/commonjs/index.d.ts.map | 1 + node_modules/chownr/dist/commonjs/index.js | 93 + .../chownr/dist/commonjs/index.js.map | 1 + .../chownr/dist/commonjs/package.json | 3 + node_modules/chownr/dist/esm/index.d.ts | 3 + node_modules/chownr/dist/esm/index.d.ts.map | 1 + node_modules/chownr/dist/esm/index.js | 85 + node_modules/chownr/dist/esm/index.js.map | 1 + node_modules/chownr/dist/esm/package.json | 3 + node_modules/chownr/package.json | 69 + node_modules/cli-cursor/index.d.ts | 47 + node_modules/cli-cursor/index.js | 39 + node_modules/cli-cursor/license | 9 + node_modules/cli-cursor/package.json | 56 + node_modules/cli-cursor/readme.md | 39 + node_modules/cli-spinners/index.d.ts | 128 + node_modules/cli-spinners/index.js | 15 + node_modules/cli-spinners/license | 9 + node_modules/cli-spinners/package.json | 50 + node_modules/cli-spinners/readme.md | 54 + node_modules/cli-spinners/spinners.json | 1622 +++++++ node_modules/color-convert/CHANGELOG.md | 54 + node_modules/color-convert/LICENSE | 21 + node_modules/color-convert/README.md | 68 + node_modules/color-convert/conversions.js | 839 ++++ node_modules/color-convert/index.js | 81 + node_modules/color-convert/package.json | 48 + node_modules/color-convert/route.js | 97 + node_modules/color-name/LICENSE | 8 + node_modules/color-name/README.md | 11 + node_modules/color-name/index.js | 152 + node_modules/color-name/package.json | 28 + node_modules/cross-spawn/LICENSE | 21 + node_modules/cross-spawn/README.md | 89 + node_modules/cross-spawn/index.js | 39 + node_modules/cross-spawn/lib/enoent.js | 59 + node_modules/cross-spawn/lib/parse.js | 91 + node_modules/cross-spawn/lib/util/escape.js | 47 + .../cross-spawn/lib/util/readShebang.js | 23 + .../cross-spawn/lib/util/resolveCommand.js | 52 + node_modules/cross-spawn/package.json | 73 + node_modules/debug/LICENSE | 20 + node_modules/debug/README.md | 481 ++ node_modules/debug/package.json | 64 + node_modules/debug/src/browser.js | 272 ++ node_modules/debug/src/common.js | 292 ++ node_modules/debug/src/index.js | 10 + node_modules/debug/src/node.js | 263 + node_modules/eastasianwidth/README.md | 32 + node_modules/eastasianwidth/eastasianwidth.js | 311 ++ node_modules/eastasianwidth/package.json | 18 + node_modules/emoji-regex/LICENSE-MIT.txt | 20 + node_modules/emoji-regex/README.md | 137 + node_modules/emoji-regex/RGI_Emoji.d.ts | 5 + node_modules/emoji-regex/RGI_Emoji.js | 6 + .../emoji-regex/es2015/RGI_Emoji.d.ts | 5 + node_modules/emoji-regex/es2015/RGI_Emoji.js | 6 + node_modules/emoji-regex/es2015/index.d.ts | 5 + node_modules/emoji-regex/es2015/index.js | 6 + node_modules/emoji-regex/es2015/text.d.ts | 5 + node_modules/emoji-regex/es2015/text.js | 6 + node_modules/emoji-regex/index.d.ts | 5 + node_modules/emoji-regex/index.js | 6 + node_modules/emoji-regex/package.json | 52 + node_modules/emoji-regex/text.d.ts | 5 + node_modules/emoji-regex/text.js | 6 + node_modules/encoding/.prettierrc.js | 8 + node_modules/encoding/.travis.yml | 25 + node_modules/encoding/LICENSE | 16 + node_modules/encoding/README.md | 41 + node_modules/encoding/lib/encoding.js | 83 + node_modules/encoding/package.json | 18 + node_modules/encoding/test/test.js | 49 + node_modules/err-code/.editorconfig | 12 + node_modules/err-code/.eslintrc.json | 7 + node_modules/err-code/.travis.yml | 4 + node_modules/err-code/README.md | 70 + node_modules/err-code/bower.json | 30 + node_modules/err-code/index.js | 47 + node_modules/err-code/index.umd.js | 51 + node_modules/err-code/package.json | 34 + node_modules/err-code/test/.eslintrc.json | 5 + node_modules/err-code/test/test.js | 159 + node_modules/foreground-child/LICENSE | 15 + node_modules/foreground-child/README.md | 128 + .../dist/commonjs/all-signals.d.ts | 2 + .../dist/commonjs/all-signals.d.ts.map | 1 + .../dist/commonjs/all-signals.js | 58 + .../dist/commonjs/all-signals.js.map | 1 + .../foreground-child/dist/commonjs/index.d.ts | 58 + .../dist/commonjs/index.d.ts.map | 1 + .../foreground-child/dist/commonjs/index.js | 123 + .../dist/commonjs/index.js.map | 1 + .../dist/commonjs/package.json | 3 + .../dist/commonjs/proxy-signals.d.ts | 6 + .../dist/commonjs/proxy-signals.d.ts.map | 1 + .../dist/commonjs/proxy-signals.js | 38 + .../dist/commonjs/proxy-signals.js.map | 1 + .../dist/commonjs/watchdog.d.ts | 10 + .../dist/commonjs/watchdog.d.ts.map | 1 + .../dist/commonjs/watchdog.js | 50 + .../dist/commonjs/watchdog.js.map | 1 + .../dist/esm/all-signals.d.ts | 2 + .../dist/esm/all-signals.d.ts.map | 1 + .../foreground-child/dist/esm/all-signals.js | 52 + .../dist/esm/all-signals.js.map | 1 + .../foreground-child/dist/esm/index.d.ts | 58 + .../foreground-child/dist/esm/index.d.ts.map | 1 + .../foreground-child/dist/esm/index.js | 115 + .../foreground-child/dist/esm/index.js.map | 1 + .../foreground-child/dist/esm/package.json | 3 + .../dist/esm/proxy-signals.d.ts | 6 + .../dist/esm/proxy-signals.d.ts.map | 1 + .../dist/esm/proxy-signals.js | 34 + .../dist/esm/proxy-signals.js.map | 1 + .../foreground-child/dist/esm/watchdog.d.ts | 10 + .../dist/esm/watchdog.d.ts.map | 1 + .../foreground-child/dist/esm/watchdog.js | 46 + .../foreground-child/dist/esm/watchdog.js.map | 1 + node_modules/foreground-child/package.json | 106 + node_modules/fs-minipass/LICENSE | 15 + node_modules/fs-minipass/README.md | 70 + node_modules/fs-minipass/lib/index.js | 443 ++ node_modules/fs-minipass/package.json | 54 + node_modules/get-east-asian-width/index.d.ts | 60 + node_modules/get-east-asian-width/index.js | 30 + node_modules/get-east-asian-width/license | 9 + node_modules/get-east-asian-width/lookup.js | 403 ++ .../get-east-asian-width/package.json | 70 + node_modules/get-east-asian-width/readme.md | 65 + node_modules/glob/LICENSE | 15 + node_modules/glob/README.md | 1265 +++++ node_modules/glob/dist/commonjs/glob.d.ts | 388 ++ node_modules/glob/dist/commonjs/glob.d.ts.map | 1 + node_modules/glob/dist/commonjs/glob.js | 247 + node_modules/glob/dist/commonjs/glob.js.map | 1 + .../glob/dist/commonjs/has-magic.d.ts | 14 + .../glob/dist/commonjs/has-magic.d.ts.map | 1 + node_modules/glob/dist/commonjs/has-magic.js | 27 + .../glob/dist/commonjs/has-magic.js.map | 1 + node_modules/glob/dist/commonjs/ignore.d.ts | 24 + .../glob/dist/commonjs/ignore.d.ts.map | 1 + node_modules/glob/dist/commonjs/ignore.js | 119 + node_modules/glob/dist/commonjs/ignore.js.map | 1 + node_modules/glob/dist/commonjs/index.d.ts | 97 + .../glob/dist/commonjs/index.d.ts.map | 1 + node_modules/glob/dist/commonjs/index.js | 68 + node_modules/glob/dist/commonjs/index.js.map | 1 + node_modules/glob/dist/commonjs/package.json | 3 + node_modules/glob/dist/commonjs/pattern.d.ts | 76 + .../glob/dist/commonjs/pattern.d.ts.map | 1 + node_modules/glob/dist/commonjs/pattern.js | 219 + .../glob/dist/commonjs/pattern.js.map | 1 + .../glob/dist/commonjs/processor.d.ts | 59 + .../glob/dist/commonjs/processor.d.ts.map | 1 + node_modules/glob/dist/commonjs/processor.js | 301 ++ .../glob/dist/commonjs/processor.js.map | 1 + node_modules/glob/dist/commonjs/walker.d.ts | 97 + .../glob/dist/commonjs/walker.d.ts.map | 1 + node_modules/glob/dist/commonjs/walker.js | 387 ++ node_modules/glob/dist/commonjs/walker.js.map | 1 + node_modules/glob/dist/esm/bin.d.mts | 3 + node_modules/glob/dist/esm/bin.d.mts.map | 1 + node_modules/glob/dist/esm/bin.mjs | 346 ++ node_modules/glob/dist/esm/bin.mjs.map | 1 + node_modules/glob/dist/esm/glob.d.ts | 388 ++ node_modules/glob/dist/esm/glob.d.ts.map | 1 + node_modules/glob/dist/esm/glob.js | 243 + node_modules/glob/dist/esm/glob.js.map | 1 + node_modules/glob/dist/esm/has-magic.d.ts | 14 + node_modules/glob/dist/esm/has-magic.d.ts.map | 1 + node_modules/glob/dist/esm/has-magic.js | 23 + node_modules/glob/dist/esm/has-magic.js.map | 1 + node_modules/glob/dist/esm/ignore.d.ts | 24 + node_modules/glob/dist/esm/ignore.d.ts.map | 1 + node_modules/glob/dist/esm/ignore.js | 115 + node_modules/glob/dist/esm/ignore.js.map | 1 + node_modules/glob/dist/esm/index.d.ts | 97 + node_modules/glob/dist/esm/index.d.ts.map | 1 + node_modules/glob/dist/esm/index.js | 55 + node_modules/glob/dist/esm/index.js.map | 1 + node_modules/glob/dist/esm/package.json | 3 + node_modules/glob/dist/esm/pattern.d.ts | 76 + node_modules/glob/dist/esm/pattern.d.ts.map | 1 + node_modules/glob/dist/esm/pattern.js | 215 + node_modules/glob/dist/esm/pattern.js.map | 1 + node_modules/glob/dist/esm/processor.d.ts | 59 + node_modules/glob/dist/esm/processor.d.ts.map | 1 + node_modules/glob/dist/esm/processor.js | 294 ++ node_modules/glob/dist/esm/processor.js.map | 1 + node_modules/glob/dist/esm/walker.d.ts | 97 + node_modules/glob/dist/esm/walker.d.ts.map | 1 + node_modules/glob/dist/esm/walker.js | 381 ++ node_modules/glob/dist/esm/walker.js.map | 1 + node_modules/glob/package.json | 99 + node_modules/hosted-git-info/LICENSE | 13 + node_modules/hosted-git-info/README.md | 138 + node_modules/hosted-git-info/lib/from-url.js | 122 + node_modules/hosted-git-info/lib/hosts.js | 231 + node_modules/hosted-git-info/lib/index.js | 227 + node_modules/hosted-git-info/lib/parse-url.js | 78 + node_modules/hosted-git-info/package.json | 61 + node_modules/http-cache-semantics/LICENSE | 9 + node_modules/http-cache-semantics/README.md | 268 ++ node_modules/http-cache-semantics/index.js | 928 ++++ .../http-cache-semantics/package.json | 22 + node_modules/http-proxy-agent/LICENSE | 22 + node_modules/http-proxy-agent/README.md | 44 + node_modules/http-proxy-agent/dist/index.d.ts | 44 + .../http-proxy-agent/dist/index.d.ts.map | 1 + node_modules/http-proxy-agent/dist/index.js | 148 + .../http-proxy-agent/dist/index.js.map | 1 + node_modules/http-proxy-agent/package.json | 47 + node_modules/https-proxy-agent/LICENSE | 22 + node_modules/https-proxy-agent/README.md | 70 + .../https-proxy-agent/dist/index.d.ts | 47 + .../https-proxy-agent/dist/index.d.ts.map | 1 + node_modules/https-proxy-agent/dist/index.js | 180 + .../https-proxy-agent/dist/index.js.map | 1 + .../dist/parse-proxy-response.d.ts | 15 + .../dist/parse-proxy-response.d.ts.map | 1 + .../dist/parse-proxy-response.js | 101 + .../dist/parse-proxy-response.js.map | 1 + node_modules/https-proxy-agent/package.json | 50 + .../iconv-lite/.github/dependabot.yml | 11 + .../iconv-lite/.idea/codeStyles/Project.xml | 47 + .../.idea/codeStyles/codeStyleConfig.xml | 5 + node_modules/iconv-lite/.idea/iconv-lite.iml | 12 + .../inspectionProfiles/Project_Default.xml | 6 + node_modules/iconv-lite/.idea/modules.xml | 8 + node_modules/iconv-lite/.idea/vcs.xml | 6 + node_modules/iconv-lite/Changelog.md | 212 + node_modules/iconv-lite/LICENSE | 21 + node_modules/iconv-lite/README.md | 130 + .../iconv-lite/encodings/dbcs-codec.js | 597 +++ .../iconv-lite/encodings/dbcs-data.js | 188 + node_modules/iconv-lite/encodings/index.js | 23 + node_modules/iconv-lite/encodings/internal.js | 198 + .../iconv-lite/encodings/sbcs-codec.js | 72 + .../encodings/sbcs-data-generated.js | 451 ++ .../iconv-lite/encodings/sbcs-data.js | 179 + .../encodings/tables/big5-added.json | 122 + .../iconv-lite/encodings/tables/cp936.json | 264 + .../iconv-lite/encodings/tables/cp949.json | 273 ++ .../iconv-lite/encodings/tables/cp950.json | 177 + .../iconv-lite/encodings/tables/eucjp.json | 182 + .../encodings/tables/gb18030-ranges.json | 1 + .../encodings/tables/gbk-added.json | 56 + .../iconv-lite/encodings/tables/shiftjis.json | 125 + node_modules/iconv-lite/encodings/utf16.js | 197 + node_modules/iconv-lite/encodings/utf32.js | 319 ++ node_modules/iconv-lite/encodings/utf7.js | 290 ++ node_modules/iconv-lite/lib/bom-handling.js | 52 + node_modules/iconv-lite/lib/index.d.ts | 41 + node_modules/iconv-lite/lib/index.js | 180 + node_modules/iconv-lite/lib/streams.js | 109 + node_modules/iconv-lite/package.json | 44 + node_modules/imurmurhash/README.md | 122 + node_modules/imurmurhash/imurmurhash.js | 138 + node_modules/imurmurhash/imurmurhash.min.js | 12 + node_modules/imurmurhash/package.json | 40 + node_modules/ip-address/LICENSE | 19 + node_modules/ip-address/README.md | 105 + .../ip-address/dist/address-error.d.ts | 5 + .../ip-address/dist/address-error.d.ts.map | 1 + node_modules/ip-address/dist/address-error.js | 12 + .../ip-address/dist/address-error.js.map | 1 + node_modules/ip-address/dist/common.d.ts | 15 + node_modules/ip-address/dist/common.d.ts.map | 1 + node_modules/ip-address/dist/common.js | 46 + node_modules/ip-address/dist/common.js.map | 1 + node_modules/ip-address/dist/ip-address.d.ts | 8 + .../ip-address/dist/ip-address.d.ts.map | 1 + node_modules/ip-address/dist/ip-address.js | 35 + .../ip-address/dist/ip-address.js.map | 1 + node_modules/ip-address/dist/ipv4.d.ts | 209 + node_modules/ip-address/dist/ipv4.d.ts.map | 1 + node_modules/ip-address/dist/ipv4.js | 360 ++ node_modules/ip-address/dist/ipv4.js.map | 1 + node_modules/ip-address/dist/ipv6.d.ts | 428 ++ node_modules/ip-address/dist/ipv6.d.ts.map | 1 + node_modules/ip-address/dist/ipv6.js | 1003 ++++ node_modules/ip-address/dist/ipv6.js.map | 1 + .../ip-address/dist/v4/constants.d.ts | 5 + .../ip-address/dist/v4/constants.d.ts.map | 1 + node_modules/ip-address/dist/v4/constants.js | 8 + .../ip-address/dist/v4/constants.js.map | 1 + .../ip-address/dist/v6/constants.d.ts | 45 + .../ip-address/dist/v6/constants.d.ts.map | 1 + node_modules/ip-address/dist/v6/constants.js | 76 + .../ip-address/dist/v6/constants.js.map | 1 + node_modules/ip-address/dist/v6/helpers.d.ts | 18 + .../ip-address/dist/v6/helpers.d.ts.map | 1 + node_modules/ip-address/dist/v6/helpers.js | 45 + .../ip-address/dist/v6/helpers.js.map | 1 + .../dist/v6/regular-expressions.d.ts | 6 + .../dist/v6/regular-expressions.d.ts.map | 1 + .../ip-address/dist/v6/regular-expressions.js | 95 + .../dist/v6/regular-expressions.js.map | 1 + node_modules/ip-address/package.json | 78 + node_modules/ip-address/src/address-error.ts | 11 + node_modules/ip-address/src/common.ts | 55 + node_modules/ip-address/src/ip-address.ts | 7 + node_modules/ip-address/src/ipv4.ts | 394 ++ node_modules/ip-address/src/ipv6.ts | 1212 +++++ node_modules/ip-address/src/v4/constants.ts | 7 + node_modules/ip-address/src/v6/constants.ts | 79 + node_modules/ip-address/src/v6/helpers.ts | 48 + .../ip-address/src/v6/regular-expressions.ts | 94 + .../is-fullwidth-code-point/index.d.ts | 17 + node_modules/is-fullwidth-code-point/index.js | 50 + node_modules/is-fullwidth-code-point/license | 9 + .../is-fullwidth-code-point/package.json | 42 + .../is-fullwidth-code-point/readme.md | 39 + node_modules/is-interactive/index.d.ts | 25 + node_modules/is-interactive/index.js | 7 + node_modules/is-interactive/license | 9 + node_modules/is-interactive/package.json | 41 + node_modules/is-interactive/readme.md | 52 + node_modules/is-unicode-supported/index.d.ts | 12 + node_modules/is-unicode-supported/index.js | 21 + node_modules/is-unicode-supported/license | 9 + .../is-unicode-supported/package.json | 47 + node_modules/is-unicode-supported/readme.md | 35 + node_modules/isexe/.npmignore | 2 + node_modules/isexe/LICENSE | 15 + node_modules/isexe/README.md | 51 + node_modules/isexe/index.js | 57 + node_modules/isexe/mode.js | 41 + node_modules/isexe/package.json | 31 + node_modules/isexe/test/basic.js | 221 + node_modules/isexe/windows.js | 42 + node_modules/jackspeak/LICENSE.md | 55 + node_modules/jackspeak/README.md | 357 ++ .../jackspeak/dist/commonjs/index.d.ts | 315 ++ .../jackspeak/dist/commonjs/index.d.ts.map | 1 + node_modules/jackspeak/dist/commonjs/index.js | 1010 ++++ .../jackspeak/dist/commonjs/index.js.map | 1 + .../jackspeak/dist/commonjs/package.json | 3 + .../dist/commonjs/parse-args-cjs.cjs.map | 1 + .../dist/commonjs/parse-args-cjs.d.cts.map | 1 + .../jackspeak/dist/commonjs/parse-args.d.ts | 4 + .../jackspeak/dist/commonjs/parse-args.js | 50 + node_modules/jackspeak/dist/esm/index.d.ts | 315 ++ .../jackspeak/dist/esm/index.d.ts.map | 1 + node_modules/jackspeak/dist/esm/index.js | 1000 ++++ node_modules/jackspeak/dist/esm/index.js.map | 1 + node_modules/jackspeak/dist/esm/package.json | 3 + .../jackspeak/dist/esm/parse-args.d.ts | 4 + .../jackspeak/dist/esm/parse-args.d.ts.map | 1 + node_modules/jackspeak/dist/esm/parse-args.js | 26 + .../jackspeak/dist/esm/parse-args.js.map | 1 + node_modules/jackspeak/package.json | 95 + node_modules/jsonparse/.npmignore | 1 + node_modules/jsonparse/LICENSE | 24 + node_modules/jsonparse/README.markdown | 11 + node_modules/jsonparse/bench.js | 26 + .../jsonparse/examples/twitterfeed.js | 30 + node_modules/jsonparse/jsonparse.js | 413 ++ node_modules/jsonparse/package.json | 22 + node_modules/jsonparse/samplejson/basic.json | 167 + node_modules/jsonparse/samplejson/basic2.json | 180 + node_modules/jsonparse/test/big-token.js | 24 + node_modules/jsonparse/test/boundary.js | 110 + node_modules/jsonparse/test/offset.js | 67 + node_modules/jsonparse/test/primitives.js | 57 + node_modules/jsonparse/test/surrogate.js | 26 + node_modules/jsonparse/test/unvalid.js | 15 + node_modules/jsonparse/test/utf8.js | 38 + node_modules/log-symbols/browser.js | 8 + node_modules/log-symbols/index.d.ts | 22 + node_modules/log-symbols/index.js | 20 + node_modules/log-symbols/license | 9 + .../is-unicode-supported/index.d.ts | 12 + .../is-unicode-supported/index.js | 17 + .../node_modules/is-unicode-supported/license | 9 + .../is-unicode-supported/package.json | 43 + .../is-unicode-supported/readme.md | 35 + node_modules/log-symbols/package.json | 57 + node_modules/log-symbols/readme.md | 39 + node_modules/lru-cache/LICENSE | 15 + node_modules/lru-cache/README.md | 331 ++ .../lru-cache/dist/commonjs/index.d.ts | 1277 +++++ .../lru-cache/dist/commonjs/index.d.ts.map | 1 + node_modules/lru-cache/dist/commonjs/index.js | 1546 ++++++ .../lru-cache/dist/commonjs/index.js.map | 1 + .../lru-cache/dist/commonjs/index.min.js | 2 + .../lru-cache/dist/commonjs/index.min.js.map | 7 + .../lru-cache/dist/commonjs/package.json | 3 + node_modules/lru-cache/dist/esm/index.d.ts | 1277 +++++ .../lru-cache/dist/esm/index.d.ts.map | 1 + node_modules/lru-cache/dist/esm/index.js | 1542 ++++++ node_modules/lru-cache/dist/esm/index.js.map | 1 + node_modules/lru-cache/dist/esm/index.min.js | 2 + .../lru-cache/dist/esm/index.min.js.map | 7 + node_modules/lru-cache/dist/esm/package.json | 3 + node_modules/lru-cache/package.json | 116 + node_modules/make-fetch-happen/LICENSE | 16 + node_modules/make-fetch-happen/README.md | 364 ++ .../make-fetch-happen/lib/cache/entry.js | 471 ++ .../make-fetch-happen/lib/cache/errors.js | 11 + .../make-fetch-happen/lib/cache/index.js | 49 + .../make-fetch-happen/lib/cache/key.js | 17 + .../make-fetch-happen/lib/cache/policy.js | 161 + node_modules/make-fetch-happen/lib/fetch.js | 118 + node_modules/make-fetch-happen/lib/index.js | 41 + node_modules/make-fetch-happen/lib/options.js | 59 + .../make-fetch-happen/lib/pipeline.js | 41 + node_modules/make-fetch-happen/lib/remote.js | 132 + node_modules/make-fetch-happen/package.json | 74 + node_modules/mimic-function/index.d.ts | 52 + node_modules/mimic-function/index.js | 72 + node_modules/mimic-function/license | 9 + node_modules/mimic-function/package.json | 49 + node_modules/mimic-function/readme.md | 80 + node_modules/minimatch/LICENSE | 15 + node_modules/minimatch/README.md | 454 ++ .../dist/commonjs/assert-valid-pattern.d.ts | 2 + .../commonjs/assert-valid-pattern.d.ts.map | 1 + .../dist/commonjs/assert-valid-pattern.js | 14 + .../dist/commonjs/assert-valid-pattern.js.map | 1 + node_modules/minimatch/dist/commonjs/ast.d.ts | 20 + .../minimatch/dist/commonjs/ast.d.ts.map | 1 + node_modules/minimatch/dist/commonjs/ast.js | 592 +++ .../minimatch/dist/commonjs/ast.js.map | 1 + .../dist/commonjs/brace-expressions.d.ts | 8 + .../dist/commonjs/brace-expressions.d.ts.map | 1 + .../dist/commonjs/brace-expressions.js | 152 + .../dist/commonjs/brace-expressions.js.map | 1 + .../minimatch/dist/commonjs/escape.d.ts | 12 + .../minimatch/dist/commonjs/escape.d.ts.map | 1 + .../minimatch/dist/commonjs/escape.js | 22 + .../minimatch/dist/commonjs/escape.js.map | 1 + .../minimatch/dist/commonjs/index.d.ts | 94 + .../minimatch/dist/commonjs/index.d.ts.map | 1 + node_modules/minimatch/dist/commonjs/index.js | 1017 ++++ .../minimatch/dist/commonjs/index.js.map | 1 + .../minimatch/dist/commonjs/package.json | 3 + .../minimatch/dist/commonjs/unescape.d.ts | 17 + .../minimatch/dist/commonjs/unescape.d.ts.map | 1 + .../minimatch/dist/commonjs/unescape.js | 24 + .../minimatch/dist/commonjs/unescape.js.map | 1 + .../dist/esm/assert-valid-pattern.d.ts | 2 + .../dist/esm/assert-valid-pattern.d.ts.map | 1 + .../dist/esm/assert-valid-pattern.js | 10 + .../dist/esm/assert-valid-pattern.js.map | 1 + node_modules/minimatch/dist/esm/ast.d.ts | 20 + node_modules/minimatch/dist/esm/ast.d.ts.map | 1 + node_modules/minimatch/dist/esm/ast.js | 588 +++ node_modules/minimatch/dist/esm/ast.js.map | 1 + .../minimatch/dist/esm/brace-expressions.d.ts | 8 + .../dist/esm/brace-expressions.d.ts.map | 1 + .../minimatch/dist/esm/brace-expressions.js | 148 + .../dist/esm/brace-expressions.js.map | 1 + node_modules/minimatch/dist/esm/escape.d.ts | 12 + .../minimatch/dist/esm/escape.d.ts.map | 1 + node_modules/minimatch/dist/esm/escape.js | 18 + node_modules/minimatch/dist/esm/escape.js.map | 1 + node_modules/minimatch/dist/esm/index.d.ts | 94 + .../minimatch/dist/esm/index.d.ts.map | 1 + node_modules/minimatch/dist/esm/index.js | 1001 ++++ node_modules/minimatch/dist/esm/index.js.map | 1 + node_modules/minimatch/dist/esm/package.json | 3 + node_modules/minimatch/dist/esm/unescape.d.ts | 17 + .../minimatch/dist/esm/unescape.d.ts.map | 1 + node_modules/minimatch/dist/esm/unescape.js | 20 + .../minimatch/dist/esm/unescape.js.map | 1 + node_modules/minimatch/package.json | 82 + node_modules/minipass-collect/LICENSE | 15 + node_modules/minipass-collect/README.md | 48 + node_modules/minipass-collect/index.js | 71 + node_modules/minipass-collect/package.json | 30 + node_modules/minipass-fetch/LICENSE | 28 + node_modules/minipass-fetch/README.md | 29 + .../minipass-fetch/lib/abort-error.js | 17 + node_modules/minipass-fetch/lib/blob.js | 97 + node_modules/minipass-fetch/lib/body.js | 350 ++ .../minipass-fetch/lib/fetch-error.js | 32 + node_modules/minipass-fetch/lib/headers.js | 267 + node_modules/minipass-fetch/lib/index.js | 376 ++ node_modules/minipass-fetch/lib/request.js | 282 ++ node_modules/minipass-fetch/lib/response.js | 90 + node_modules/minipass-fetch/package.json | 70 + node_modules/minipass-flush/LICENSE | 15 + node_modules/minipass-flush/README.md | 47 + node_modules/minipass-flush/index.js | 39 + .../node_modules/minipass/LICENSE | 15 + .../node_modules/minipass/README.md | 728 +++ .../node_modules/minipass/index.d.ts | 155 + .../node_modules/minipass/index.js | 649 +++ .../node_modules/minipass/package.json | 56 + .../node_modules/yallist/LICENSE | 15 + .../node_modules/yallist/README.md | 204 + .../node_modules/yallist/iterator.js | 8 + .../node_modules/yallist/package.json | 29 + .../node_modules/yallist/yallist.js | 426 ++ node_modules/minipass-flush/package.json | 39 + node_modules/minipass-pipeline/LICENSE | 15 + node_modules/minipass-pipeline/README.md | 69 + node_modules/minipass-pipeline/index.js | 128 + .../node_modules/minipass/LICENSE | 15 + .../node_modules/minipass/README.md | 728 +++ .../node_modules/minipass/index.d.ts | 155 + .../node_modules/minipass/index.js | 649 +++ .../node_modules/minipass/package.json | 56 + .../node_modules/yallist/LICENSE | 15 + .../node_modules/yallist/README.md | 204 + .../node_modules/yallist/iterator.js | 8 + .../node_modules/yallist/package.json | 29 + .../node_modules/yallist/yallist.js | 426 ++ node_modules/minipass-pipeline/package.json | 29 + node_modules/minipass-sized/.npmignore | 22 + node_modules/minipass-sized/LICENSE | 15 + node_modules/minipass-sized/README.md | 28 + node_modules/minipass-sized/index.js | 67 + .../node_modules/minipass/LICENSE | 15 + .../node_modules/minipass/README.md | 728 +++ .../node_modules/minipass/index.d.ts | 155 + .../node_modules/minipass/index.js | 649 +++ .../node_modules/minipass/package.json | 56 + .../node_modules/yallist/LICENSE | 15 + .../node_modules/yallist/README.md | 204 + .../node_modules/yallist/iterator.js | 8 + .../node_modules/yallist/package.json | 29 + .../node_modules/yallist/yallist.js | 426 ++ node_modules/minipass-sized/package-lock.json | 3464 +++++++++++++ node_modules/minipass-sized/package.json | 39 + node_modules/minipass-sized/test/basic.js | 83 + node_modules/minipass/LICENSE | 15 + node_modules/minipass/README.md | 825 ++++ .../minipass/dist/commonjs/index.d.ts | 549 +++ .../minipass/dist/commonjs/index.d.ts.map | 1 + node_modules/minipass/dist/commonjs/index.js | 1028 ++++ .../minipass/dist/commonjs/index.js.map | 1 + .../minipass/dist/commonjs/package.json | 3 + node_modules/minipass/dist/esm/index.d.ts | 549 +++ node_modules/minipass/dist/esm/index.d.ts.map | 1 + node_modules/minipass/dist/esm/index.js | 1018 ++++ node_modules/minipass/dist/esm/index.js.map | 1 + node_modules/minipass/dist/esm/package.json | 3 + node_modules/minipass/package.json | 82 + node_modules/minizlib/LICENSE | 26 + node_modules/minizlib/README.md | 64 + .../minizlib/dist/commonjs/constants.d.ts | 2 + .../minizlib/dist/commonjs/constants.d.ts.map | 1 + .../minizlib/dist/commonjs/constants.js | 123 + .../minizlib/dist/commonjs/constants.js.map | 1 + .../minizlib/dist/commonjs/index.d.ts | 99 + .../minizlib/dist/commonjs/index.d.ts.map | 1 + node_modules/minizlib/dist/commonjs/index.js | 416 ++ .../minizlib/dist/commonjs/index.js.map | 1 + .../minizlib/dist/commonjs/package.json | 3 + node_modules/minizlib/dist/esm/constants.d.ts | 2 + .../minizlib/dist/esm/constants.d.ts.map | 1 + node_modules/minizlib/dist/esm/constants.js | 117 + .../minizlib/dist/esm/constants.js.map | 1 + node_modules/minizlib/dist/esm/index.d.ts | 99 + node_modules/minizlib/dist/esm/index.d.ts.map | 1 + node_modules/minizlib/dist/esm/index.js | 363 ++ node_modules/minizlib/dist/esm/index.js.map | 1 + node_modules/minizlib/dist/esm/package.json | 3 + node_modules/minizlib/package.json | 80 + node_modules/ms/index.js | 162 + node_modules/ms/license.md | 21 + node_modules/ms/package.json | 38 + node_modules/ms/readme.md | 59 + node_modules/negotiator/HISTORY.md | 114 + node_modules/negotiator/LICENSE | 24 + node_modules/negotiator/README.md | 212 + node_modules/negotiator/index.js | 83 + node_modules/negotiator/lib/charset.js | 169 + node_modules/negotiator/lib/encoding.js | 205 + node_modules/negotiator/lib/language.js | 179 + node_modules/negotiator/lib/mediaType.js | 294 ++ node_modules/negotiator/package.json | 43 + node_modules/node-forge/CHANGELOG.md | 412 ++ node_modules/node-forge/LICENSE | 331 ++ node_modules/node-forge/README.md | 2071 ++++++++ node_modules/node-forge/dist/forge.all.min.js | 2 + .../node-forge/dist/forge.all.min.js.map | 1 + node_modules/node-forge/dist/forge.min.js | 2 + node_modules/node-forge/dist/forge.min.js.map | 1 + .../node-forge/dist/prime.worker.min.js | 2 + .../node-forge/dist/prime.worker.min.js.map | 1 + node_modules/node-forge/flash/README.md | 48 + node_modules/node-forge/flash/package.json | 28 + .../node-forge/flash/swf/SocketPool.swf | Bin 0 -> 21162 bytes node_modules/node-forge/lib/aes.js | 1091 +++++ .../node-forge/lib/aesCipherSuites.js | 282 ++ node_modules/node-forge/lib/asn1-validator.js | 91 + node_modules/node-forge/lib/asn1.js | 1434 ++++++ node_modules/node-forge/lib/baseN.js | 186 + node_modules/node-forge/lib/cipher.js | 230 + node_modules/node-forge/lib/cipherModes.js | 999 ++++ node_modules/node-forge/lib/des.js | 496 ++ node_modules/node-forge/lib/ed25519.js | 1072 +++++ node_modules/node-forge/lib/forge.js | 13 + node_modules/node-forge/lib/form.js | 149 + node_modules/node-forge/lib/hmac.js | 146 + node_modules/node-forge/lib/http.js | 1346 ++++++ node_modules/node-forge/lib/index.all.js | 16 + node_modules/node-forge/lib/index.js | 33 + node_modules/node-forge/lib/jsbn.js | 1264 +++++ node_modules/node-forge/lib/kem.js | 168 + node_modules/node-forge/lib/log.js | 319 ++ node_modules/node-forge/lib/md.all.js | 13 + node_modules/node-forge/lib/md.js | 11 + node_modules/node-forge/lib/md5.js | 289 ++ node_modules/node-forge/lib/mgf.js | 12 + node_modules/node-forge/lib/mgf1.js | 57 + node_modules/node-forge/lib/oids.js | 179 + node_modules/node-forge/lib/pbe.js | 1023 ++++ node_modules/node-forge/lib/pbkdf2.js | 211 + node_modules/node-forge/lib/pem.js | 237 + node_modules/node-forge/lib/pkcs1.js | 276 ++ node_modules/node-forge/lib/pkcs12.js | 1074 +++++ node_modules/node-forge/lib/pkcs7.js | 1260 +++++ node_modules/node-forge/lib/pkcs7asn1.js | 410 ++ node_modules/node-forge/lib/pki.js | 102 + node_modules/node-forge/lib/prime.js | 297 ++ node_modules/node-forge/lib/prime.worker.js | 168 + node_modules/node-forge/lib/prng.js | 419 ++ node_modules/node-forge/lib/pss.js | 241 + node_modules/node-forge/lib/random.js | 191 + node_modules/node-forge/lib/rc2.js | 410 ++ node_modules/node-forge/lib/rsa.js | 1949 ++++++++ node_modules/node-forge/lib/sha1.js | 319 ++ node_modules/node-forge/lib/sha256.js | 327 ++ node_modules/node-forge/lib/sha512.js | 561 +++ node_modules/node-forge/lib/socket.js | 287 ++ node_modules/node-forge/lib/ssh.js | 236 + node_modules/node-forge/lib/tls.js | 4282 +++++++++++++++++ node_modules/node-forge/lib/tlssocket.js | 249 + node_modules/node-forge/lib/util.js | 2652 ++++++++++ node_modules/node-forge/lib/x509.js | 3242 +++++++++++++ node_modules/node-forge/lib/xhr.js | 738 +++ node_modules/node-forge/package.json | 123 + node_modules/npm-package-arg/LICENSE | 15 + node_modules/npm-package-arg/README.md | 104 + node_modules/npm-package-arg/lib/npa.js | 481 ++ node_modules/npm-package-arg/package.json | 61 + node_modules/npm-registry-fetch/LICENSE.md | 20 + node_modules/npm-registry-fetch/README.md | 616 +++ node_modules/npm-registry-fetch/lib/auth.js | 181 + .../npm-registry-fetch/lib/check-response.js | 108 + .../npm-registry-fetch/lib/default-opts.js | 19 + node_modules/npm-registry-fetch/lib/errors.js | 80 + node_modules/npm-registry-fetch/lib/index.js | 247 + .../npm-registry-fetch/lib/json-stream.js | 223 + node_modules/npm-registry-fetch/package.json | 68 + node_modules/onetime/index.d.ts | 59 + node_modules/onetime/index.js | 41 + node_modules/onetime/license | 9 + node_modules/onetime/package.json | 49 + node_modules/onetime/readme.md | 88 + node_modules/ora/index.d.ts | 332 ++ node_modules/ora/index.js | 424 ++ node_modules/ora/license | 9 + .../node_modules/emoji-regex/LICENSE-MIT.txt | 20 + .../ora/node_modules/emoji-regex/README.md | 107 + .../ora/node_modules/emoji-regex/index.d.ts | 3 + .../ora/node_modules/emoji-regex/index.js | 4 + .../ora/node_modules/emoji-regex/index.mjs | 4 + .../ora/node_modules/emoji-regex/package.json | 45 + .../ora/node_modules/string-width/index.d.ts | 39 + .../ora/node_modules/string-width/index.js | 82 + .../ora/node_modules/string-width/license | 9 + .../node_modules/string-width/package.json | 64 + .../ora/node_modules/string-width/readme.md | 66 + node_modules/ora/package.json | 64 + node_modules/ora/readme.md | 329 ++ node_modules/p-map/index.d.ts | 155 + node_modules/p-map/index.js | 283 ++ node_modules/p-map/license | 9 + node_modules/p-map/package.json | 57 + node_modules/p-map/readme.md | 169 + .../package-json-from-dist/LICENSE.md | 63 + node_modules/package-json-from-dist/README.md | 110 + .../dist/commonjs/index.d.ts | 89 + .../dist/commonjs/index.d.ts.map | 1 + .../dist/commonjs/index.js | 134 + .../dist/commonjs/index.js.map | 1 + .../dist/commonjs/package.json | 3 + .../dist/esm/index.d.ts | 89 + .../dist/esm/index.d.ts.map | 1 + .../package-json-from-dist/dist/esm/index.js | 129 + .../dist/esm/index.js.map | 1 + .../dist/esm/package.json | 3 + .../package-json-from-dist/package.json | 68 + node_modules/path-key/index.d.ts | 40 + node_modules/path-key/index.js | 16 + node_modules/path-key/license | 9 + node_modules/path-key/package.json | 39 + node_modules/path-key/readme.md | 61 + node_modules/path-scurry/LICENSE.md | 55 + node_modules/path-scurry/README.md | 636 +++ .../path-scurry/dist/commonjs/index.d.ts | 1116 +++++ .../path-scurry/dist/commonjs/index.d.ts.map | 1 + .../path-scurry/dist/commonjs/index.js | 2014 ++++++++ .../path-scurry/dist/commonjs/index.js.map | 1 + .../path-scurry/dist/commonjs/package.json | 3 + node_modules/path-scurry/dist/esm/index.d.ts | 1116 +++++ .../path-scurry/dist/esm/index.d.ts.map | 1 + node_modules/path-scurry/dist/esm/index.js | 1979 ++++++++ .../path-scurry/dist/esm/index.js.map | 1 + .../path-scurry/dist/esm/package.json | 3 + node_modules/path-scurry/package.json | 89 + node_modules/proc-log/LICENSE | 15 + node_modules/proc-log/README.md | 226 + node_modules/proc-log/lib/index.js | 153 + node_modules/proc-log/package.json | 46 + node_modules/promise-retry/.editorconfig | 15 + node_modules/promise-retry/.jshintrc | 64 + node_modules/promise-retry/.travis.yml | 4 + node_modules/promise-retry/LICENSE | 19 + node_modules/promise-retry/README.md | 94 + node_modules/promise-retry/index.js | 52 + node_modules/promise-retry/package.json | 37 + node_modules/promise-retry/test/test.js | 263 + node_modules/restore-cursor/index.d.ts | 15 + node_modules/restore-cursor/index.js | 15 + node_modules/restore-cursor/license | 9 + node_modules/restore-cursor/package.json | 57 + node_modules/restore-cursor/readme.md | 21 + node_modules/retry/.npmignore | 3 + node_modules/retry/.travis.yml | 15 + node_modules/retry/License | 21 + node_modules/retry/Makefile | 18 + node_modules/retry/README.md | 227 + node_modules/retry/equation.gif | Bin 0 -> 1209 bytes node_modules/retry/example/dns.js | 31 + node_modules/retry/example/stop.js | 40 + node_modules/retry/index.js | 1 + node_modules/retry/lib/retry.js | 100 + node_modules/retry/lib/retry_operation.js | 158 + node_modules/retry/package.json | 32 + node_modules/retry/test/common.js | 10 + .../retry/test/integration/test-forever.js | 24 + .../test/integration/test-retry-operation.js | 258 + .../retry/test/integration/test-retry-wrap.js | 101 + .../retry/test/integration/test-timeouts.js | 69 + node_modules/safer-buffer/LICENSE | 21 + node_modules/safer-buffer/Porting-Buffer.md | 268 ++ node_modules/safer-buffer/Readme.md | 156 + node_modules/safer-buffer/dangerous.js | 58 + node_modules/safer-buffer/package.json | 34 + node_modules/safer-buffer/safer.js | 77 + node_modules/safer-buffer/tests.js | 406 ++ node_modules/semver/LICENSE | 15 + node_modules/semver/README.md | 664 +++ node_modules/semver/bin/semver.js | 191 + node_modules/semver/classes/comparator.js | 143 + node_modules/semver/classes/index.js | 7 + node_modules/semver/classes/range.js | 556 +++ node_modules/semver/classes/semver.js | 319 ++ node_modules/semver/functions/clean.js | 8 + node_modules/semver/functions/cmp.js | 54 + node_modules/semver/functions/coerce.js | 62 + .../semver/functions/compare-build.js | 9 + .../semver/functions/compare-loose.js | 5 + node_modules/semver/functions/compare.js | 7 + node_modules/semver/functions/diff.js | 60 + node_modules/semver/functions/eq.js | 5 + node_modules/semver/functions/gt.js | 5 + node_modules/semver/functions/gte.js | 5 + node_modules/semver/functions/inc.js | 21 + node_modules/semver/functions/lt.js | 5 + node_modules/semver/functions/lte.js | 5 + node_modules/semver/functions/major.js | 5 + node_modules/semver/functions/minor.js | 5 + node_modules/semver/functions/neq.js | 5 + node_modules/semver/functions/parse.js | 18 + node_modules/semver/functions/patch.js | 5 + node_modules/semver/functions/prerelease.js | 8 + node_modules/semver/functions/rcompare.js | 5 + node_modules/semver/functions/rsort.js | 5 + node_modules/semver/functions/satisfies.js | 12 + node_modules/semver/functions/sort.js | 5 + node_modules/semver/functions/valid.js | 8 + node_modules/semver/index.js | 91 + node_modules/semver/internal/constants.js | 37 + node_modules/semver/internal/debug.js | 11 + node_modules/semver/internal/identifiers.js | 25 + node_modules/semver/internal/lrucache.js | 42 + node_modules/semver/internal/parse-options.js | 17 + node_modules/semver/internal/re.js | 223 + node_modules/semver/package.json | 78 + node_modules/semver/preload.js | 4 + node_modules/semver/range.bnf | 16 + node_modules/semver/ranges/gtr.js | 6 + node_modules/semver/ranges/intersects.js | 9 + node_modules/semver/ranges/ltr.js | 6 + node_modules/semver/ranges/max-satisfying.js | 27 + node_modules/semver/ranges/min-satisfying.js | 26 + node_modules/semver/ranges/min-version.js | 63 + node_modules/semver/ranges/outside.js | 82 + node_modules/semver/ranges/simplify.js | 49 + node_modules/semver/ranges/subset.js | 249 + node_modules/semver/ranges/to-comparators.js | 10 + node_modules/semver/ranges/valid.js | 13 + node_modules/shebang-command/index.js | 19 + node_modules/shebang-command/license | 9 + node_modules/shebang-command/package.json | 34 + node_modules/shebang-command/readme.md | 34 + node_modules/shebang-regex/index.d.ts | 22 + node_modules/shebang-regex/index.js | 2 + node_modules/shebang-regex/license | 9 + node_modules/shebang-regex/package.json | 35 + node_modules/shebang-regex/readme.md | 33 + node_modules/signal-exit/LICENSE.txt | 16 + node_modules/signal-exit/README.md | 74 + .../signal-exit/dist/cjs/browser.d.ts | 12 + .../signal-exit/dist/cjs/browser.d.ts.map | 1 + node_modules/signal-exit/dist/cjs/browser.js | 10 + .../signal-exit/dist/cjs/browser.js.map | 1 + node_modules/signal-exit/dist/cjs/index.d.ts | 48 + .../signal-exit/dist/cjs/index.d.ts.map | 1 + node_modules/signal-exit/dist/cjs/index.js | 279 ++ .../signal-exit/dist/cjs/index.js.map | 1 + .../signal-exit/dist/cjs/package.json | 3 + .../signal-exit/dist/cjs/signals.d.ts | 29 + .../signal-exit/dist/cjs/signals.d.ts.map | 1 + node_modules/signal-exit/dist/cjs/signals.js | 42 + .../signal-exit/dist/cjs/signals.js.map | 1 + .../signal-exit/dist/mjs/browser.d.ts | 12 + .../signal-exit/dist/mjs/browser.d.ts.map | 1 + node_modules/signal-exit/dist/mjs/browser.js | 4 + .../signal-exit/dist/mjs/browser.js.map | 1 + node_modules/signal-exit/dist/mjs/index.d.ts | 48 + .../signal-exit/dist/mjs/index.d.ts.map | 1 + node_modules/signal-exit/dist/mjs/index.js | 275 ++ .../signal-exit/dist/mjs/index.js.map | 1 + .../signal-exit/dist/mjs/package.json | 3 + .../signal-exit/dist/mjs/signals.d.ts | 29 + .../signal-exit/dist/mjs/signals.d.ts.map | 1 + node_modules/signal-exit/dist/mjs/signals.js | 39 + .../signal-exit/dist/mjs/signals.js.map | 1 + node_modules/signal-exit/package.json | 106 + node_modules/smart-buffer/.prettierrc.yaml | 5 + node_modules/smart-buffer/.travis.yml | 13 + node_modules/smart-buffer/LICENSE | 20 + node_modules/smart-buffer/README.md | 633 +++ .../smart-buffer/build/smartbuffer.js | 1233 +++++ .../smart-buffer/build/smartbuffer.js.map | 1 + node_modules/smart-buffer/build/utils.js | 108 + node_modules/smart-buffer/build/utils.js.map | 1 + node_modules/smart-buffer/docs/CHANGELOG.md | 70 + node_modules/smart-buffer/docs/README_v3.md | 367 ++ node_modules/smart-buffer/docs/ROADMAP.md | 0 node_modules/smart-buffer/package.json | 79 + .../smart-buffer/typings/smartbuffer.d.ts | 755 +++ node_modules/smart-buffer/typings/utils.d.ts | 66 + node_modules/socks-proxy-agent/LICENSE | 22 + node_modules/socks-proxy-agent/README.md | 50 + .../socks-proxy-agent/dist/index.d.ts | 27 + .../socks-proxy-agent/dist/index.d.ts.map | 1 + node_modules/socks-proxy-agent/dist/index.js | 195 + .../socks-proxy-agent/dist/index.js.map | 1 + node_modules/socks-proxy-agent/package.json | 142 + node_modules/socks/.eslintrc.cjs | 11 + node_modules/socks/.prettierrc.yaml | 7 + node_modules/socks/LICENSE | 20 + node_modules/socks/README.md | 686 +++ .../socks/build/client/socksclient.js | 793 +++ .../socks/build/client/socksclient.js.map | 1 + node_modules/socks/build/common/constants.js | 108 + .../socks/build/common/constants.js.map | 1 + node_modules/socks/build/common/helpers.js | 167 + .../socks/build/common/helpers.js.map | 1 + .../socks/build/common/receivebuffer.js | 43 + .../socks/build/common/receivebuffer.js.map | 1 + node_modules/socks/build/common/util.js | 25 + node_modules/socks/build/common/util.js.map | 1 + node_modules/socks/build/index.js | 18 + node_modules/socks/build/index.js.map | 1 + node_modules/socks/docs/examples/index.md | 17 + .../examples/javascript/associateExample.md | 90 + .../docs/examples/javascript/bindExample.md | 83 + .../examples/javascript/connectExample.md | 258 + .../examples/typescript/associateExample.md | 93 + .../docs/examples/typescript/bindExample.md | 86 + .../examples/typescript/connectExample.md | 265 + node_modules/socks/docs/index.md | 5 + node_modules/socks/docs/migratingFromV1.md | 86 + node_modules/socks/package.json | 58 + .../socks/typings/client/socksclient.d.ts | 162 + .../socks/typings/common/constants.d.ts | 151 + .../socks/typings/common/helpers.d.ts | 17 + .../socks/typings/common/receivebuffer.d.ts | 12 + node_modules/socks/typings/common/util.d.ts | 14 + node_modules/socks/typings/index.d.ts | 1 + node_modules/ssri/LICENSE.md | 16 + node_modules/ssri/README.md | 528 ++ node_modules/ssri/lib/index.js | 580 +++ node_modules/ssri/package.json | 66 + node_modules/stdin-discarder/index.d.ts | 13 + node_modules/stdin-discarder/index.js | 59 + node_modules/stdin-discarder/license | 9 + node_modules/stdin-discarder/package.json | 42 + node_modules/stdin-discarder/readme.md | 37 + node_modules/string-width-cjs/index.d.ts | 29 + node_modules/string-width-cjs/index.js | 47 + node_modules/string-width-cjs/license | 9 + .../node_modules/ansi-regex/index.d.ts | 37 + .../node_modules/ansi-regex/index.js | 10 + .../node_modules/ansi-regex/license | 9 + .../node_modules/ansi-regex/package.json | 55 + .../node_modules/ansi-regex/readme.md | 78 + .../node_modules/emoji-regex/LICENSE-MIT.txt | 20 + .../node_modules/emoji-regex/README.md | 73 + .../node_modules/emoji-regex/es2015/index.js | 6 + .../node_modules/emoji-regex/es2015/text.js | 6 + .../node_modules/emoji-regex/index.d.ts | 23 + .../node_modules/emoji-regex/index.js | 6 + .../node_modules/emoji-regex/package.json | 50 + .../node_modules/emoji-regex/text.js | 6 + .../node_modules/strip-ansi/index.d.ts | 17 + .../node_modules/strip-ansi/index.js | 4 + .../node_modules/strip-ansi/license | 9 + .../node_modules/strip-ansi/package.json | 54 + .../node_modules/strip-ansi/readme.md | 46 + node_modules/string-width-cjs/package.json | 56 + node_modules/string-width-cjs/readme.md | 50 + node_modules/string-width/index.d.ts | 29 + node_modules/string-width/index.js | 54 + node_modules/string-width/license | 9 + node_modules/string-width/package.json | 59 + node_modules/string-width/readme.md | 67 + node_modules/strip-ansi-cjs/index.d.ts | 17 + node_modules/strip-ansi-cjs/index.js | 4 + node_modules/strip-ansi-cjs/license | 9 + .../node_modules/ansi-regex/index.d.ts | 37 + .../node_modules/ansi-regex/index.js | 10 + .../node_modules/ansi-regex/license | 9 + .../node_modules/ansi-regex/package.json | 55 + .../node_modules/ansi-regex/readme.md | 78 + node_modules/strip-ansi-cjs/package.json | 54 + node_modules/strip-ansi-cjs/readme.md | 46 + node_modules/strip-ansi/index.d.ts | 15 + node_modules/strip-ansi/index.js | 14 + node_modules/strip-ansi/license | 9 + node_modules/strip-ansi/package.json | 59 + node_modules/strip-ansi/readme.md | 37 + node_modules/tar/LICENSE.md | 55 + node_modules/tar/README.md | 1145 +++++ node_modules/tar/dist/commonjs/create.d.ts | 3 + .../tar/dist/commonjs/create.d.ts.map | 1 + node_modules/tar/dist/commonjs/create.js | 83 + node_modules/tar/dist/commonjs/create.js.map | 1 + node_modules/tar/dist/commonjs/cwd-error.d.ts | 8 + .../tar/dist/commonjs/cwd-error.d.ts.map | 1 + node_modules/tar/dist/commonjs/cwd-error.js | 18 + .../tar/dist/commonjs/cwd-error.js.map | 1 + node_modules/tar/dist/commonjs/extract.d.ts | 3 + .../tar/dist/commonjs/extract.d.ts.map | 1 + node_modules/tar/dist/commonjs/extract.js | 78 + node_modules/tar/dist/commonjs/extract.js.map | 1 + .../tar/dist/commonjs/get-write-flag.d.ts | 2 + .../tar/dist/commonjs/get-write-flag.d.ts.map | 1 + .../tar/dist/commonjs/get-write-flag.js | 29 + .../tar/dist/commonjs/get-write-flag.js.map | 1 + node_modules/tar/dist/commonjs/header.d.ts | 55 + .../tar/dist/commonjs/header.d.ts.map | 1 + node_modules/tar/dist/commonjs/header.js | 315 ++ node_modules/tar/dist/commonjs/header.js.map | 1 + node_modules/tar/dist/commonjs/index.d.ts | 20 + node_modules/tar/dist/commonjs/index.d.ts.map | 1 + node_modules/tar/dist/commonjs/index.js | 54 + node_modules/tar/dist/commonjs/index.js.map | 1 + .../tar/dist/commonjs/large-numbers.d.ts | 5 + .../tar/dist/commonjs/large-numbers.d.ts.map | 1 + .../tar/dist/commonjs/large-numbers.js | 99 + .../tar/dist/commonjs/large-numbers.js.map | 1 + node_modules/tar/dist/commonjs/list.d.ts | 7 + node_modules/tar/dist/commonjs/list.d.ts.map | 1 + node_modules/tar/dist/commonjs/list.js | 140 + node_modules/tar/dist/commonjs/list.js.map | 1 + .../tar/dist/commonjs/make-command.d.ts | 49 + .../tar/dist/commonjs/make-command.d.ts.map | 1 + .../tar/dist/commonjs/make-command.js | 61 + .../tar/dist/commonjs/make-command.js.map | 1 + node_modules/tar/dist/commonjs/mkdir.d.ts | 26 + node_modules/tar/dist/commonjs/mkdir.d.ts.map | 1 + node_modules/tar/dist/commonjs/mkdir.js | 188 + node_modules/tar/dist/commonjs/mkdir.js.map | 1 + node_modules/tar/dist/commonjs/mode-fix.d.ts | 2 + .../tar/dist/commonjs/mode-fix.d.ts.map | 1 + node_modules/tar/dist/commonjs/mode-fix.js | 29 + .../tar/dist/commonjs/mode-fix.js.map | 1 + .../tar/dist/commonjs/normalize-unicode.d.ts | 2 + .../dist/commonjs/normalize-unicode.d.ts.map | 1 + .../tar/dist/commonjs/normalize-unicode.js | 34 + .../dist/commonjs/normalize-unicode.js.map | 1 + .../dist/commonjs/normalize-windows-path.d.ts | 2 + .../commonjs/normalize-windows-path.d.ts.map | 1 + .../dist/commonjs/normalize-windows-path.js | 12 + .../commonjs/normalize-windows-path.js.map | 1 + node_modules/tar/dist/commonjs/options.d.ts | 621 +++ .../tar/dist/commonjs/options.d.ts.map | 1 + node_modules/tar/dist/commonjs/options.js | 66 + node_modules/tar/dist/commonjs/options.js.map | 1 + node_modules/tar/dist/commonjs/pack.d.ts | 103 + node_modules/tar/dist/commonjs/pack.d.ts.map | 1 + node_modules/tar/dist/commonjs/pack.js | 494 ++ node_modules/tar/dist/commonjs/pack.js.map | 1 + node_modules/tar/dist/commonjs/package.json | 3 + node_modules/tar/dist/commonjs/parse.d.ts | 88 + node_modules/tar/dist/commonjs/parse.d.ts.map | 1 + node_modules/tar/dist/commonjs/parse.js | 620 +++ node_modules/tar/dist/commonjs/parse.js.map | 1 + .../tar/dist/commonjs/path-reservations.d.ts | 11 + .../dist/commonjs/path-reservations.d.ts.map | 1 + .../tar/dist/commonjs/path-reservations.js | 170 + .../dist/commonjs/path-reservations.js.map | 1 + node_modules/tar/dist/commonjs/pax.d.ts | 28 + node_modules/tar/dist/commonjs/pax.d.ts.map | 1 + node_modules/tar/dist/commonjs/pax.js | 158 + node_modules/tar/dist/commonjs/pax.js.map | 1 + .../tar/dist/commonjs/read-entry.d.ts | 38 + .../tar/dist/commonjs/read-entry.d.ts.map | 1 + node_modules/tar/dist/commonjs/read-entry.js | 140 + .../tar/dist/commonjs/read-entry.js.map | 1 + node_modules/tar/dist/commonjs/replace.d.ts | 2 + .../tar/dist/commonjs/replace.d.ts.map | 1 + node_modules/tar/dist/commonjs/replace.js | 232 + node_modules/tar/dist/commonjs/replace.js.map | 1 + .../dist/commonjs/strip-absolute-path.d.ts | 2 + .../commonjs/strip-absolute-path.d.ts.map | 1 + .../tar/dist/commonjs/strip-absolute-path.js | 29 + .../dist/commonjs/strip-absolute-path.js.map | 1 + .../dist/commonjs/strip-trailing-slashes.d.ts | 2 + .../commonjs/strip-trailing-slashes.d.ts.map | 1 + .../dist/commonjs/strip-trailing-slashes.js | 18 + .../commonjs/strip-trailing-slashes.js.map | 1 + .../tar/dist/commonjs/symlink-error.d.ts | 9 + .../tar/dist/commonjs/symlink-error.d.ts.map | 1 + .../tar/dist/commonjs/symlink-error.js | 19 + .../tar/dist/commonjs/symlink-error.js.map | 1 + node_modules/tar/dist/commonjs/types.d.ts | 7 + node_modules/tar/dist/commonjs/types.d.ts.map | 1 + node_modules/tar/dist/commonjs/types.js | 50 + node_modules/tar/dist/commonjs/types.js.map | 1 + node_modules/tar/dist/commonjs/unpack.d.ts | 96 + .../tar/dist/commonjs/unpack.d.ts.map | 1 + node_modules/tar/dist/commonjs/unpack.js | 871 ++++ node_modules/tar/dist/commonjs/unpack.js.map | 1 + node_modules/tar/dist/commonjs/update.d.ts | 2 + .../tar/dist/commonjs/update.d.ts.map | 1 + node_modules/tar/dist/commonjs/update.js | 33 + node_modules/tar/dist/commonjs/update.js.map | 1 + .../tar/dist/commonjs/warn-method.d.ts | 26 + .../tar/dist/commonjs/warn-method.d.ts.map | 1 + node_modules/tar/dist/commonjs/warn-method.js | 31 + .../tar/dist/commonjs/warn-method.js.map | 1 + node_modules/tar/dist/commonjs/winchars.d.ts | 3 + .../tar/dist/commonjs/winchars.d.ts.map | 1 + node_modules/tar/dist/commonjs/winchars.js | 14 + .../tar/dist/commonjs/winchars.js.map | 1 + .../tar/dist/commonjs/write-entry.d.ts | 133 + .../tar/dist/commonjs/write-entry.d.ts.map | 1 + node_modules/tar/dist/commonjs/write-entry.js | 689 +++ .../tar/dist/commonjs/write-entry.js.map | 1 + node_modules/tar/dist/esm/create.d.ts | 3 + node_modules/tar/dist/esm/create.d.ts.map | 1 + node_modules/tar/dist/esm/create.js | 77 + node_modules/tar/dist/esm/create.js.map | 1 + node_modules/tar/dist/esm/cwd-error.d.ts | 8 + node_modules/tar/dist/esm/cwd-error.d.ts.map | 1 + node_modules/tar/dist/esm/cwd-error.js | 14 + node_modules/tar/dist/esm/cwd-error.js.map | 1 + node_modules/tar/dist/esm/extract.d.ts | 3 + node_modules/tar/dist/esm/extract.d.ts.map | 1 + node_modules/tar/dist/esm/extract.js | 49 + node_modules/tar/dist/esm/extract.js.map | 1 + node_modules/tar/dist/esm/get-write-flag.d.ts | 2 + .../tar/dist/esm/get-write-flag.d.ts.map | 1 + node_modules/tar/dist/esm/get-write-flag.js | 23 + .../tar/dist/esm/get-write-flag.js.map | 1 + node_modules/tar/dist/esm/header.d.ts | 55 + node_modules/tar/dist/esm/header.d.ts.map | 1 + node_modules/tar/dist/esm/header.js | 288 ++ node_modules/tar/dist/esm/header.js.map | 1 + node_modules/tar/dist/esm/index.d.ts | 20 + node_modules/tar/dist/esm/index.d.ts.map | 1 + node_modules/tar/dist/esm/index.js | 20 + node_modules/tar/dist/esm/index.js.map | 1 + node_modules/tar/dist/esm/large-numbers.d.ts | 5 + .../tar/dist/esm/large-numbers.d.ts.map | 1 + node_modules/tar/dist/esm/large-numbers.js | 94 + .../tar/dist/esm/large-numbers.js.map | 1 + node_modules/tar/dist/esm/list.d.ts | 7 + node_modules/tar/dist/esm/list.d.ts.map | 1 + node_modules/tar/dist/esm/list.js | 110 + node_modules/tar/dist/esm/list.js.map | 1 + node_modules/tar/dist/esm/make-command.d.ts | 49 + .../tar/dist/esm/make-command.d.ts.map | 1 + node_modules/tar/dist/esm/make-command.js | 57 + node_modules/tar/dist/esm/make-command.js.map | 1 + node_modules/tar/dist/esm/mkdir.d.ts | 26 + node_modules/tar/dist/esm/mkdir.d.ts.map | 1 + node_modules/tar/dist/esm/mkdir.js | 180 + node_modules/tar/dist/esm/mkdir.js.map | 1 + node_modules/tar/dist/esm/mode-fix.d.ts | 2 + node_modules/tar/dist/esm/mode-fix.d.ts.map | 1 + node_modules/tar/dist/esm/mode-fix.js | 25 + node_modules/tar/dist/esm/mode-fix.js.map | 1 + .../tar/dist/esm/normalize-unicode.d.ts | 2 + .../tar/dist/esm/normalize-unicode.d.ts.map | 1 + .../tar/dist/esm/normalize-unicode.js | 30 + .../tar/dist/esm/normalize-unicode.js.map | 1 + .../tar/dist/esm/normalize-windows-path.d.ts | 2 + .../dist/esm/normalize-windows-path.d.ts.map | 1 + .../tar/dist/esm/normalize-windows-path.js | 9 + .../dist/esm/normalize-windows-path.js.map | 1 + node_modules/tar/dist/esm/options.d.ts | 621 +++ node_modules/tar/dist/esm/options.d.ts.map | 1 + node_modules/tar/dist/esm/options.js | 54 + node_modules/tar/dist/esm/options.js.map | 1 + node_modules/tar/dist/esm/pack.d.ts | 103 + node_modules/tar/dist/esm/pack.d.ts.map | 1 + node_modules/tar/dist/esm/pack.js | 462 ++ node_modules/tar/dist/esm/pack.js.map | 1 + node_modules/tar/dist/esm/package.json | 3 + node_modules/tar/dist/esm/parse.d.ts | 88 + node_modules/tar/dist/esm/parse.d.ts.map | 1 + node_modules/tar/dist/esm/parse.js | 616 +++ node_modules/tar/dist/esm/parse.js.map | 1 + .../tar/dist/esm/path-reservations.d.ts | 11 + .../tar/dist/esm/path-reservations.d.ts.map | 1 + .../tar/dist/esm/path-reservations.js | 166 + .../tar/dist/esm/path-reservations.js.map | 1 + node_modules/tar/dist/esm/pax.d.ts | 28 + node_modules/tar/dist/esm/pax.d.ts.map | 1 + node_modules/tar/dist/esm/pax.js | 154 + node_modules/tar/dist/esm/pax.js.map | 1 + node_modules/tar/dist/esm/read-entry.d.ts | 38 + node_modules/tar/dist/esm/read-entry.d.ts.map | 1 + node_modules/tar/dist/esm/read-entry.js | 136 + node_modules/tar/dist/esm/read-entry.js.map | 1 + node_modules/tar/dist/esm/replace.d.ts | 2 + node_modules/tar/dist/esm/replace.d.ts.map | 1 + node_modules/tar/dist/esm/replace.js | 226 + node_modules/tar/dist/esm/replace.js.map | 1 + .../tar/dist/esm/strip-absolute-path.d.ts | 2 + .../tar/dist/esm/strip-absolute-path.d.ts.map | 1 + .../tar/dist/esm/strip-absolute-path.js | 25 + .../tar/dist/esm/strip-absolute-path.js.map | 1 + .../tar/dist/esm/strip-trailing-slashes.d.ts | 2 + .../dist/esm/strip-trailing-slashes.d.ts.map | 1 + .../tar/dist/esm/strip-trailing-slashes.js | 14 + .../dist/esm/strip-trailing-slashes.js.map | 1 + node_modules/tar/dist/esm/symlink-error.d.ts | 9 + .../tar/dist/esm/symlink-error.d.ts.map | 1 + node_modules/tar/dist/esm/symlink-error.js | 15 + .../tar/dist/esm/symlink-error.js.map | 1 + node_modules/tar/dist/esm/types.d.ts | 7 + node_modules/tar/dist/esm/types.d.ts.map | 1 + node_modules/tar/dist/esm/types.js | 45 + node_modules/tar/dist/esm/types.js.map | 1 + node_modules/tar/dist/esm/unpack.d.ts | 96 + node_modules/tar/dist/esm/unpack.d.ts.map | 1 + node_modules/tar/dist/esm/unpack.js | 840 ++++ node_modules/tar/dist/esm/unpack.js.map | 1 + node_modules/tar/dist/esm/update.d.ts | 2 + node_modules/tar/dist/esm/update.d.ts.map | 1 + node_modules/tar/dist/esm/update.js | 30 + node_modules/tar/dist/esm/update.js.map | 1 + node_modules/tar/dist/esm/warn-method.d.ts | 26 + .../tar/dist/esm/warn-method.d.ts.map | 1 + node_modules/tar/dist/esm/warn-method.js | 27 + node_modules/tar/dist/esm/warn-method.js.map | 1 + node_modules/tar/dist/esm/winchars.d.ts | 3 + node_modules/tar/dist/esm/winchars.d.ts.map | 1 + node_modules/tar/dist/esm/winchars.js | 9 + node_modules/tar/dist/esm/winchars.js.map | 1 + node_modules/tar/dist/esm/write-entry.d.ts | 133 + .../tar/dist/esm/write-entry.d.ts.map | 1 + node_modules/tar/dist/esm/write-entry.js | 657 +++ node_modules/tar/dist/esm/write-entry.js.map | 1 + node_modules/tar/package.json | 326 ++ node_modules/unique-filename/LICENSE | 5 + node_modules/unique-filename/README.md | 34 + node_modules/unique-filename/lib/index.js | 7 + node_modules/unique-filename/package.json | 53 + node_modules/unique-slug/LICENSE | 15 + node_modules/unique-slug/README.md | 19 + node_modules/unique-slug/lib/index.js | 11 + node_modules/unique-slug/package.json | 49 + .../validate-npm-package-name/LICENSE | 6 + .../validate-npm-package-name/README.md | 120 + .../validate-npm-package-name/lib/index.js | 110 + .../validate-npm-package-name/package.json | 61 + node_modules/which/CHANGELOG.md | 166 + node_modules/which/LICENSE | 15 + node_modules/which/README.md | 54 + node_modules/which/bin/node-which | 52 + node_modules/which/package.json | 43 + node_modules/which/which.js | 125 + node_modules/wrap-ansi-cjs/index.js | 216 + node_modules/wrap-ansi-cjs/license | 9 + .../node_modules/ansi-regex/index.d.ts | 37 + .../node_modules/ansi-regex/index.js | 10 + .../node_modules/ansi-regex/license | 9 + .../node_modules/ansi-regex/package.json | 55 + .../node_modules/ansi-regex/readme.md | 78 + .../node_modules/ansi-styles/index.d.ts | 345 ++ .../node_modules/ansi-styles/index.js | 163 + .../node_modules/ansi-styles/license | 9 + .../node_modules/ansi-styles/package.json | 56 + .../node_modules/ansi-styles/readme.md | 152 + .../node_modules/emoji-regex/LICENSE-MIT.txt | 20 + .../node_modules/emoji-regex/README.md | 73 + .../node_modules/emoji-regex/es2015/index.js | 6 + .../node_modules/emoji-regex/es2015/text.js | 6 + .../node_modules/emoji-regex/index.d.ts | 23 + .../node_modules/emoji-regex/index.js | 6 + .../node_modules/emoji-regex/package.json | 50 + .../node_modules/emoji-regex/text.js | 6 + .../node_modules/string-width/index.d.ts | 29 + .../node_modules/string-width/index.js | 47 + .../node_modules/string-width/license | 9 + .../node_modules/string-width/package.json | 56 + .../node_modules/string-width/readme.md | 50 + .../node_modules/strip-ansi/index.d.ts | 17 + .../node_modules/strip-ansi/index.js | 4 + .../node_modules/strip-ansi/license | 9 + .../node_modules/strip-ansi/package.json | 54 + .../node_modules/strip-ansi/readme.md | 46 + node_modules/wrap-ansi-cjs/package.json | 62 + node_modules/wrap-ansi-cjs/readme.md | 91 + node_modules/wrap-ansi/index.d.ts | 41 + node_modules/wrap-ansi/index.js | 214 + node_modules/wrap-ansi/license | 9 + node_modules/wrap-ansi/package.json | 69 + node_modules/wrap-ansi/readme.md | 91 + node_modules/yallist/LICENSE.md | 63 + node_modules/yallist/README.md | 205 + node_modules/yallist/dist/commonjs/index.d.ts | 39 + .../yallist/dist/commonjs/index.d.ts.map | 1 + node_modules/yallist/dist/commonjs/index.js | 384 ++ .../yallist/dist/commonjs/index.js.map | 1 + .../yallist/dist/commonjs/package.json | 3 + node_modules/yallist/dist/esm/index.d.ts | 39 + node_modules/yallist/dist/esm/index.d.ts.map | 1 + node_modules/yallist/dist/esm/index.js | 379 ++ node_modules/yallist/dist/esm/index.js.map | 1 + node_modules/yallist/dist/esm/package.json | 3 + node_modules/yallist/package.json | 68 + package-lock.json => test/package-lock.json | 0 package.json => test/package.json | 0 1485 files changed, 167084 insertions(+) create mode 100644 node_modules/.bin/aikido-bun create mode 100644 node_modules/.bin/aikido-bun.cmd create mode 100644 node_modules/.bin/aikido-bun.ps1 create mode 100644 node_modules/.bin/aikido-bunx create mode 100644 node_modules/.bin/aikido-bunx.cmd create mode 100644 node_modules/.bin/aikido-bunx.ps1 create mode 100644 node_modules/.bin/aikido-npm create mode 100644 node_modules/.bin/aikido-npm.cmd create mode 100644 node_modules/.bin/aikido-npm.ps1 create mode 100644 node_modules/.bin/aikido-npx create mode 100644 node_modules/.bin/aikido-npx.cmd create mode 100644 node_modules/.bin/aikido-npx.ps1 create mode 100644 node_modules/.bin/aikido-pnpm create mode 100644 node_modules/.bin/aikido-pnpm.cmd create mode 100644 node_modules/.bin/aikido-pnpm.ps1 create mode 100644 node_modules/.bin/aikido-pnpx create mode 100644 node_modules/.bin/aikido-pnpx.cmd create mode 100644 node_modules/.bin/aikido-pnpx.ps1 create mode 100644 node_modules/.bin/aikido-yarn create mode 100644 node_modules/.bin/aikido-yarn.cmd create mode 100644 node_modules/.bin/aikido-yarn.ps1 create mode 100644 node_modules/.bin/glob create mode 100644 node_modules/.bin/glob.cmd create mode 100644 node_modules/.bin/glob.ps1 create mode 100644 node_modules/.bin/node-which create mode 100644 node_modules/.bin/node-which.cmd create mode 100644 node_modules/.bin/node-which.ps1 create mode 100644 node_modules/.bin/safe-chain create mode 100644 node_modules/.bin/safe-chain.cmd create mode 100644 node_modules/.bin/safe-chain.ps1 create mode 100644 node_modules/.bin/semver create mode 100644 node_modules/.bin/semver.cmd create mode 100644 node_modules/.bin/semver.ps1 create mode 100644 node_modules/.package-lock.json create mode 100644 node_modules/@aikidosec/safe-chain/LICENSE create mode 100644 node_modules/@aikidosec/safe-chain/README.md create mode 100644 node_modules/@aikidosec/safe-chain/bin/aikido-bun.js create mode 100644 node_modules/@aikidosec/safe-chain/bin/aikido-bunx.js create mode 100644 node_modules/@aikidosec/safe-chain/bin/aikido-npm.js create mode 100644 node_modules/@aikidosec/safe-chain/bin/aikido-npx.js create mode 100644 node_modules/@aikidosec/safe-chain/bin/aikido-pnpm.js create mode 100644 node_modules/@aikidosec/safe-chain/bin/aikido-pnpx.js create mode 100644 node_modules/@aikidosec/safe-chain/bin/aikido-yarn.js create mode 100644 node_modules/@aikidosec/safe-chain/bin/safe-chain.js create mode 100644 node_modules/@aikidosec/safe-chain/docs/safe-package-manager-demo.gif create mode 100644 node_modules/@aikidosec/safe-chain/docs/safe-package-manager-demo.png create mode 100644 node_modules/@aikidosec/safe-chain/docs/shell-integration.md create mode 100644 node_modules/@aikidosec/safe-chain/package.json create mode 100644 node_modules/@aikidosec/safe-chain/src/api/aikido.js create mode 100644 node_modules/@aikidosec/safe-chain/src/api/npmApi.js create mode 100644 node_modules/@aikidosec/safe-chain/src/config/cliArguments.js create mode 100644 node_modules/@aikidosec/safe-chain/src/config/configFile.js create mode 100644 node_modules/@aikidosec/safe-chain/src/config/settings.js create mode 100644 node_modules/@aikidosec/safe-chain/src/environment/environment.js create mode 100644 node_modules/@aikidosec/safe-chain/src/environment/userInteraction.js create mode 100644 node_modules/@aikidosec/safe-chain/src/main.js create mode 100644 node_modules/@aikidosec/safe-chain/src/packagemanager/_shared/matchesCommand.js create mode 100644 node_modules/@aikidosec/safe-chain/src/packagemanager/bun/createBunPackageManager.js create mode 100644 node_modules/@aikidosec/safe-chain/src/packagemanager/currentPackageManager.js create mode 100644 node_modules/@aikidosec/safe-chain/src/packagemanager/npm/createPackageManager.js create mode 100644 node_modules/@aikidosec/safe-chain/src/packagemanager/npm/dependencyScanner/commandArgumentScanner.js create mode 100644 node_modules/@aikidosec/safe-chain/src/packagemanager/npm/dependencyScanner/nullScanner.js create mode 100644 node_modules/@aikidosec/safe-chain/src/packagemanager/npm/parsing/parsePackagesFromInstallArgs.js create mode 100644 node_modules/@aikidosec/safe-chain/src/packagemanager/npm/runNpmCommand.js create mode 100644 node_modules/@aikidosec/safe-chain/src/packagemanager/npm/utils/abbrevs-generated.js create mode 100644 node_modules/@aikidosec/safe-chain/src/packagemanager/npm/utils/cmd-list.js create mode 100644 node_modules/@aikidosec/safe-chain/src/packagemanager/npm/utils/npmCommands.js create mode 100644 node_modules/@aikidosec/safe-chain/src/packagemanager/npx/createPackageManager.js create mode 100644 node_modules/@aikidosec/safe-chain/src/packagemanager/npx/dependencyScanner/commandArgumentScanner.js create mode 100644 node_modules/@aikidosec/safe-chain/src/packagemanager/npx/parsing/parsePackagesFromArguments.js create mode 100644 node_modules/@aikidosec/safe-chain/src/packagemanager/npx/runNpxCommand.js create mode 100644 node_modules/@aikidosec/safe-chain/src/packagemanager/pnpm/createPackageManager.js create mode 100644 node_modules/@aikidosec/safe-chain/src/packagemanager/pnpm/dependencyScanner/commandArgumentScanner.js create mode 100644 node_modules/@aikidosec/safe-chain/src/packagemanager/pnpm/parsing/parsePackagesFromArguments.js create mode 100644 node_modules/@aikidosec/safe-chain/src/packagemanager/pnpm/runPnpmCommand.js create mode 100644 node_modules/@aikidosec/safe-chain/src/packagemanager/yarn/createPackageManager.js create mode 100644 node_modules/@aikidosec/safe-chain/src/packagemanager/yarn/dependencyScanner/commandArgumentScanner.js create mode 100644 node_modules/@aikidosec/safe-chain/src/packagemanager/yarn/parsing/parsePackagesFromArguments.js create mode 100644 node_modules/@aikidosec/safe-chain/src/packagemanager/yarn/runYarnCommand.js create mode 100644 node_modules/@aikidosec/safe-chain/src/registryProxy/certUtils.js create mode 100644 node_modules/@aikidosec/safe-chain/src/registryProxy/mitmRequestHandler.js create mode 100644 node_modules/@aikidosec/safe-chain/src/registryProxy/parsePackageFromUrl.js create mode 100644 node_modules/@aikidosec/safe-chain/src/registryProxy/plainHttpProxy.js create mode 100644 node_modules/@aikidosec/safe-chain/src/registryProxy/registryProxy.js create mode 100644 node_modules/@aikidosec/safe-chain/src/registryProxy/tunnelRequestHandler.js create mode 100644 node_modules/@aikidosec/safe-chain/src/scanning/audit/index.js create mode 100644 node_modules/@aikidosec/safe-chain/src/scanning/index.js create mode 100644 node_modules/@aikidosec/safe-chain/src/scanning/malwareDatabase.js create mode 100644 node_modules/@aikidosec/safe-chain/src/shell-integration/helpers.js create mode 100644 node_modules/@aikidosec/safe-chain/src/shell-integration/path-wrappers/templates/unix-wrapper.template.sh create mode 100644 node_modules/@aikidosec/safe-chain/src/shell-integration/path-wrappers/templates/windows-wrapper.template.cmd create mode 100644 node_modules/@aikidosec/safe-chain/src/shell-integration/setup-ci.js create mode 100644 node_modules/@aikidosec/safe-chain/src/shell-integration/setup.js create mode 100644 node_modules/@aikidosec/safe-chain/src/shell-integration/shellDetection.js create mode 100644 node_modules/@aikidosec/safe-chain/src/shell-integration/startup-scripts/init-fish.fish create mode 100644 node_modules/@aikidosec/safe-chain/src/shell-integration/startup-scripts/init-posix.sh create mode 100644 node_modules/@aikidosec/safe-chain/src/shell-integration/startup-scripts/init-pwsh.ps1 create mode 100644 node_modules/@aikidosec/safe-chain/src/shell-integration/supported-shells/bash.js create mode 100644 node_modules/@aikidosec/safe-chain/src/shell-integration/supported-shells/fish.js create mode 100644 node_modules/@aikidosec/safe-chain/src/shell-integration/supported-shells/powershell.js create mode 100644 node_modules/@aikidosec/safe-chain/src/shell-integration/supported-shells/windowsPowershell.js create mode 100644 node_modules/@aikidosec/safe-chain/src/shell-integration/supported-shells/zsh.js create mode 100644 node_modules/@aikidosec/safe-chain/src/shell-integration/teardown.js create mode 100644 node_modules/@aikidosec/safe-chain/src/utils/safeSpawn.js create mode 100644 node_modules/@isaacs/cliui/LICENSE.txt create mode 100644 node_modules/@isaacs/cliui/README.md create mode 100644 node_modules/@isaacs/cliui/build/index.cjs create mode 100644 node_modules/@isaacs/cliui/build/index.d.cts create mode 100644 node_modules/@isaacs/cliui/build/lib/index.js create mode 100644 node_modules/@isaacs/cliui/index.mjs create mode 100644 node_modules/@isaacs/cliui/package.json create mode 100644 node_modules/@isaacs/fs-minipass/LICENSE create mode 100644 node_modules/@isaacs/fs-minipass/README.md create mode 100644 node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts create mode 100644 node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts.map create mode 100644 node_modules/@isaacs/fs-minipass/dist/commonjs/index.js create mode 100644 node_modules/@isaacs/fs-minipass/dist/commonjs/index.js.map create mode 100644 node_modules/@isaacs/fs-minipass/dist/commonjs/package.json create mode 100644 node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts create mode 100644 node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts.map create mode 100644 node_modules/@isaacs/fs-minipass/dist/esm/index.js create mode 100644 node_modules/@isaacs/fs-minipass/dist/esm/index.js.map create mode 100644 node_modules/@isaacs/fs-minipass/dist/esm/package.json create mode 100644 node_modules/@isaacs/fs-minipass/package.json create mode 100644 node_modules/@npmcli/agent/README.md create mode 100644 node_modules/@npmcli/agent/lib/agents.js create mode 100644 node_modules/@npmcli/agent/lib/dns.js create mode 100644 node_modules/@npmcli/agent/lib/errors.js create mode 100644 node_modules/@npmcli/agent/lib/index.js create mode 100644 node_modules/@npmcli/agent/lib/options.js create mode 100644 node_modules/@npmcli/agent/lib/proxy.js create mode 100644 node_modules/@npmcli/agent/package.json create mode 100644 node_modules/@npmcli/fs/LICENSE.md create mode 100644 node_modules/@npmcli/fs/README.md create mode 100644 node_modules/@npmcli/fs/lib/common/get-options.js create mode 100644 node_modules/@npmcli/fs/lib/common/node.js create mode 100644 node_modules/@npmcli/fs/lib/cp/LICENSE create mode 100644 node_modules/@npmcli/fs/lib/cp/errors.js create mode 100644 node_modules/@npmcli/fs/lib/cp/index.js create mode 100644 node_modules/@npmcli/fs/lib/cp/polyfill.js create mode 100644 node_modules/@npmcli/fs/lib/index.js create mode 100644 node_modules/@npmcli/fs/lib/move-file.js create mode 100644 node_modules/@npmcli/fs/lib/readdir-scoped.js create mode 100644 node_modules/@npmcli/fs/lib/with-temp-dir.js create mode 100644 node_modules/@npmcli/fs/package.json create mode 100644 node_modules/@npmcli/redact/LICENSE create mode 100644 node_modules/@npmcli/redact/README.md create mode 100644 node_modules/@npmcli/redact/lib/deep-map.js create mode 100644 node_modules/@npmcli/redact/lib/error.js create mode 100644 node_modules/@npmcli/redact/lib/index.js create mode 100644 node_modules/@npmcli/redact/lib/matchers.js create mode 100644 node_modules/@npmcli/redact/lib/server.js create mode 100644 node_modules/@npmcli/redact/lib/utils.js create mode 100644 node_modules/@npmcli/redact/package.json create mode 100644 node_modules/@pkgjs/parseargs/.editorconfig create mode 100644 node_modules/@pkgjs/parseargs/CHANGELOG.md create mode 100644 node_modules/@pkgjs/parseargs/LICENSE create mode 100644 node_modules/@pkgjs/parseargs/README.md create mode 100644 node_modules/@pkgjs/parseargs/examples/is-default-value.js create mode 100644 node_modules/@pkgjs/parseargs/examples/limit-long-syntax.js create mode 100644 node_modules/@pkgjs/parseargs/examples/negate.js create mode 100644 node_modules/@pkgjs/parseargs/examples/no-repeated-options.js create mode 100644 node_modules/@pkgjs/parseargs/examples/ordered-options.mjs create mode 100644 node_modules/@pkgjs/parseargs/examples/simple-hard-coded.js create mode 100644 node_modules/@pkgjs/parseargs/index.js create mode 100644 node_modules/@pkgjs/parseargs/internal/errors.js create mode 100644 node_modules/@pkgjs/parseargs/internal/primordials.js create mode 100644 node_modules/@pkgjs/parseargs/internal/util.js create mode 100644 node_modules/@pkgjs/parseargs/internal/validators.js create mode 100644 node_modules/@pkgjs/parseargs/package.json create mode 100644 node_modules/@pkgjs/parseargs/utils.js create mode 100644 node_modules/agent-base/LICENSE create mode 100644 node_modules/agent-base/README.md create mode 100644 node_modules/agent-base/dist/helpers.d.ts create mode 100644 node_modules/agent-base/dist/helpers.d.ts.map create mode 100644 node_modules/agent-base/dist/helpers.js create mode 100644 node_modules/agent-base/dist/helpers.js.map create mode 100644 node_modules/agent-base/dist/index.d.ts create mode 100644 node_modules/agent-base/dist/index.d.ts.map create mode 100644 node_modules/agent-base/dist/index.js create mode 100644 node_modules/agent-base/dist/index.js.map create mode 100644 node_modules/agent-base/package.json create mode 100644 node_modules/ansi-regex/index.d.ts create mode 100644 node_modules/ansi-regex/index.js create mode 100644 node_modules/ansi-regex/license create mode 100644 node_modules/ansi-regex/package.json create mode 100644 node_modules/ansi-regex/readme.md create mode 100644 node_modules/ansi-styles/index.d.ts create mode 100644 node_modules/ansi-styles/index.js create mode 100644 node_modules/ansi-styles/license create mode 100644 node_modules/ansi-styles/package.json create mode 100644 node_modules/ansi-styles/readme.md create mode 100644 node_modules/balanced-match/.github/FUNDING.yml create mode 100644 node_modules/balanced-match/LICENSE.md create mode 100644 node_modules/balanced-match/README.md create mode 100644 node_modules/balanced-match/index.js create mode 100644 node_modules/balanced-match/package.json create mode 100644 node_modules/brace-expansion/.github/FUNDING.yml create mode 100644 node_modules/brace-expansion/LICENSE create mode 100644 node_modules/brace-expansion/README.md create mode 100644 node_modules/brace-expansion/index.js create mode 100644 node_modules/brace-expansion/package.json create mode 100644 node_modules/cacache/LICENSE.md create mode 100644 node_modules/cacache/README.md create mode 100644 node_modules/cacache/lib/content/path.js create mode 100644 node_modules/cacache/lib/content/read.js create mode 100644 node_modules/cacache/lib/content/rm.js create mode 100644 node_modules/cacache/lib/content/write.js create mode 100644 node_modules/cacache/lib/entry-index.js create mode 100644 node_modules/cacache/lib/get.js create mode 100644 node_modules/cacache/lib/index.js create mode 100644 node_modules/cacache/lib/memoization.js create mode 100644 node_modules/cacache/lib/put.js create mode 100644 node_modules/cacache/lib/rm.js create mode 100644 node_modules/cacache/lib/util/glob.js create mode 100644 node_modules/cacache/lib/util/hash-to-segments.js create mode 100644 node_modules/cacache/lib/util/tmp.js create mode 100644 node_modules/cacache/lib/verify.js create mode 100644 node_modules/cacache/package.json create mode 100644 node_modules/chalk/license create mode 100644 node_modules/chalk/package.json create mode 100644 node_modules/chalk/readme.md create mode 100644 node_modules/chalk/source/index.d.ts create mode 100644 node_modules/chalk/source/index.js create mode 100644 node_modules/chalk/source/utilities.js create mode 100644 node_modules/chalk/source/vendor/ansi-styles/index.d.ts create mode 100644 node_modules/chalk/source/vendor/ansi-styles/index.js create mode 100644 node_modules/chalk/source/vendor/supports-color/browser.d.ts create mode 100644 node_modules/chalk/source/vendor/supports-color/browser.js create mode 100644 node_modules/chalk/source/vendor/supports-color/index.d.ts create mode 100644 node_modules/chalk/source/vendor/supports-color/index.js create mode 100644 node_modules/chownr/LICENSE.md create mode 100644 node_modules/chownr/README.md create mode 100644 node_modules/chownr/dist/commonjs/index.d.ts create mode 100644 node_modules/chownr/dist/commonjs/index.d.ts.map create mode 100644 node_modules/chownr/dist/commonjs/index.js create mode 100644 node_modules/chownr/dist/commonjs/index.js.map create mode 100644 node_modules/chownr/dist/commonjs/package.json create mode 100644 node_modules/chownr/dist/esm/index.d.ts create mode 100644 node_modules/chownr/dist/esm/index.d.ts.map create mode 100644 node_modules/chownr/dist/esm/index.js create mode 100644 node_modules/chownr/dist/esm/index.js.map create mode 100644 node_modules/chownr/dist/esm/package.json create mode 100644 node_modules/chownr/package.json create mode 100644 node_modules/cli-cursor/index.d.ts create mode 100644 node_modules/cli-cursor/index.js create mode 100644 node_modules/cli-cursor/license create mode 100644 node_modules/cli-cursor/package.json create mode 100644 node_modules/cli-cursor/readme.md create mode 100644 node_modules/cli-spinners/index.d.ts create mode 100644 node_modules/cli-spinners/index.js create mode 100644 node_modules/cli-spinners/license create mode 100644 node_modules/cli-spinners/package.json create mode 100644 node_modules/cli-spinners/readme.md create mode 100644 node_modules/cli-spinners/spinners.json create mode 100644 node_modules/color-convert/CHANGELOG.md create mode 100644 node_modules/color-convert/LICENSE create mode 100644 node_modules/color-convert/README.md create mode 100644 node_modules/color-convert/conversions.js create mode 100644 node_modules/color-convert/index.js create mode 100644 node_modules/color-convert/package.json create mode 100644 node_modules/color-convert/route.js create mode 100644 node_modules/color-name/LICENSE create mode 100644 node_modules/color-name/README.md create mode 100644 node_modules/color-name/index.js create mode 100644 node_modules/color-name/package.json create mode 100644 node_modules/cross-spawn/LICENSE create mode 100644 node_modules/cross-spawn/README.md create mode 100644 node_modules/cross-spawn/index.js create mode 100644 node_modules/cross-spawn/lib/enoent.js create mode 100644 node_modules/cross-spawn/lib/parse.js create mode 100644 node_modules/cross-spawn/lib/util/escape.js create mode 100644 node_modules/cross-spawn/lib/util/readShebang.js create mode 100644 node_modules/cross-spawn/lib/util/resolveCommand.js create mode 100644 node_modules/cross-spawn/package.json create mode 100644 node_modules/debug/LICENSE create mode 100644 node_modules/debug/README.md create mode 100644 node_modules/debug/package.json create mode 100644 node_modules/debug/src/browser.js create mode 100644 node_modules/debug/src/common.js create mode 100644 node_modules/debug/src/index.js create mode 100644 node_modules/debug/src/node.js create mode 100644 node_modules/eastasianwidth/README.md create mode 100644 node_modules/eastasianwidth/eastasianwidth.js create mode 100644 node_modules/eastasianwidth/package.json create mode 100644 node_modules/emoji-regex/LICENSE-MIT.txt create mode 100644 node_modules/emoji-regex/README.md create mode 100644 node_modules/emoji-regex/RGI_Emoji.d.ts create mode 100644 node_modules/emoji-regex/RGI_Emoji.js create mode 100644 node_modules/emoji-regex/es2015/RGI_Emoji.d.ts create mode 100644 node_modules/emoji-regex/es2015/RGI_Emoji.js create mode 100644 node_modules/emoji-regex/es2015/index.d.ts create mode 100644 node_modules/emoji-regex/es2015/index.js create mode 100644 node_modules/emoji-regex/es2015/text.d.ts create mode 100644 node_modules/emoji-regex/es2015/text.js create mode 100644 node_modules/emoji-regex/index.d.ts create mode 100644 node_modules/emoji-regex/index.js create mode 100644 node_modules/emoji-regex/package.json create mode 100644 node_modules/emoji-regex/text.d.ts create mode 100644 node_modules/emoji-regex/text.js create mode 100644 node_modules/encoding/.prettierrc.js create mode 100644 node_modules/encoding/.travis.yml create mode 100644 node_modules/encoding/LICENSE create mode 100644 node_modules/encoding/README.md create mode 100644 node_modules/encoding/lib/encoding.js create mode 100644 node_modules/encoding/package.json create mode 100644 node_modules/encoding/test/test.js create mode 100644 node_modules/err-code/.editorconfig create mode 100644 node_modules/err-code/.eslintrc.json create mode 100644 node_modules/err-code/.travis.yml create mode 100644 node_modules/err-code/README.md create mode 100644 node_modules/err-code/bower.json create mode 100644 node_modules/err-code/index.js create mode 100644 node_modules/err-code/index.umd.js create mode 100644 node_modules/err-code/package.json create mode 100644 node_modules/err-code/test/.eslintrc.json create mode 100644 node_modules/err-code/test/test.js create mode 100644 node_modules/foreground-child/LICENSE create mode 100644 node_modules/foreground-child/README.md create mode 100644 node_modules/foreground-child/dist/commonjs/all-signals.d.ts create mode 100644 node_modules/foreground-child/dist/commonjs/all-signals.d.ts.map create mode 100644 node_modules/foreground-child/dist/commonjs/all-signals.js create mode 100644 node_modules/foreground-child/dist/commonjs/all-signals.js.map create mode 100644 node_modules/foreground-child/dist/commonjs/index.d.ts create mode 100644 node_modules/foreground-child/dist/commonjs/index.d.ts.map create mode 100644 node_modules/foreground-child/dist/commonjs/index.js create mode 100644 node_modules/foreground-child/dist/commonjs/index.js.map create mode 100644 node_modules/foreground-child/dist/commonjs/package.json create mode 100644 node_modules/foreground-child/dist/commonjs/proxy-signals.d.ts create mode 100644 node_modules/foreground-child/dist/commonjs/proxy-signals.d.ts.map create mode 100644 node_modules/foreground-child/dist/commonjs/proxy-signals.js create mode 100644 node_modules/foreground-child/dist/commonjs/proxy-signals.js.map create mode 100644 node_modules/foreground-child/dist/commonjs/watchdog.d.ts create mode 100644 node_modules/foreground-child/dist/commonjs/watchdog.d.ts.map create mode 100644 node_modules/foreground-child/dist/commonjs/watchdog.js create mode 100644 node_modules/foreground-child/dist/commonjs/watchdog.js.map create mode 100644 node_modules/foreground-child/dist/esm/all-signals.d.ts create mode 100644 node_modules/foreground-child/dist/esm/all-signals.d.ts.map create mode 100644 node_modules/foreground-child/dist/esm/all-signals.js create mode 100644 node_modules/foreground-child/dist/esm/all-signals.js.map create mode 100644 node_modules/foreground-child/dist/esm/index.d.ts create mode 100644 node_modules/foreground-child/dist/esm/index.d.ts.map create mode 100644 node_modules/foreground-child/dist/esm/index.js create mode 100644 node_modules/foreground-child/dist/esm/index.js.map create mode 100644 node_modules/foreground-child/dist/esm/package.json create mode 100644 node_modules/foreground-child/dist/esm/proxy-signals.d.ts create mode 100644 node_modules/foreground-child/dist/esm/proxy-signals.d.ts.map create mode 100644 node_modules/foreground-child/dist/esm/proxy-signals.js create mode 100644 node_modules/foreground-child/dist/esm/proxy-signals.js.map create mode 100644 node_modules/foreground-child/dist/esm/watchdog.d.ts create mode 100644 node_modules/foreground-child/dist/esm/watchdog.d.ts.map create mode 100644 node_modules/foreground-child/dist/esm/watchdog.js create mode 100644 node_modules/foreground-child/dist/esm/watchdog.js.map create mode 100644 node_modules/foreground-child/package.json create mode 100644 node_modules/fs-minipass/LICENSE create mode 100644 node_modules/fs-minipass/README.md create mode 100644 node_modules/fs-minipass/lib/index.js create mode 100644 node_modules/fs-minipass/package.json create mode 100644 node_modules/get-east-asian-width/index.d.ts create mode 100644 node_modules/get-east-asian-width/index.js create mode 100644 node_modules/get-east-asian-width/license create mode 100644 node_modules/get-east-asian-width/lookup.js create mode 100644 node_modules/get-east-asian-width/package.json create mode 100644 node_modules/get-east-asian-width/readme.md create mode 100644 node_modules/glob/LICENSE create mode 100644 node_modules/glob/README.md create mode 100644 node_modules/glob/dist/commonjs/glob.d.ts create mode 100644 node_modules/glob/dist/commonjs/glob.d.ts.map create mode 100644 node_modules/glob/dist/commonjs/glob.js create mode 100644 node_modules/glob/dist/commonjs/glob.js.map create mode 100644 node_modules/glob/dist/commonjs/has-magic.d.ts create mode 100644 node_modules/glob/dist/commonjs/has-magic.d.ts.map create mode 100644 node_modules/glob/dist/commonjs/has-magic.js create mode 100644 node_modules/glob/dist/commonjs/has-magic.js.map create mode 100644 node_modules/glob/dist/commonjs/ignore.d.ts create mode 100644 node_modules/glob/dist/commonjs/ignore.d.ts.map create mode 100644 node_modules/glob/dist/commonjs/ignore.js create mode 100644 node_modules/glob/dist/commonjs/ignore.js.map create mode 100644 node_modules/glob/dist/commonjs/index.d.ts create mode 100644 node_modules/glob/dist/commonjs/index.d.ts.map create mode 100644 node_modules/glob/dist/commonjs/index.js create mode 100644 node_modules/glob/dist/commonjs/index.js.map create mode 100644 node_modules/glob/dist/commonjs/package.json create mode 100644 node_modules/glob/dist/commonjs/pattern.d.ts create mode 100644 node_modules/glob/dist/commonjs/pattern.d.ts.map create mode 100644 node_modules/glob/dist/commonjs/pattern.js create mode 100644 node_modules/glob/dist/commonjs/pattern.js.map create mode 100644 node_modules/glob/dist/commonjs/processor.d.ts create mode 100644 node_modules/glob/dist/commonjs/processor.d.ts.map create mode 100644 node_modules/glob/dist/commonjs/processor.js create mode 100644 node_modules/glob/dist/commonjs/processor.js.map create mode 100644 node_modules/glob/dist/commonjs/walker.d.ts create mode 100644 node_modules/glob/dist/commonjs/walker.d.ts.map create mode 100644 node_modules/glob/dist/commonjs/walker.js create mode 100644 node_modules/glob/dist/commonjs/walker.js.map create mode 100644 node_modules/glob/dist/esm/bin.d.mts create mode 100644 node_modules/glob/dist/esm/bin.d.mts.map create mode 100644 node_modules/glob/dist/esm/bin.mjs create mode 100644 node_modules/glob/dist/esm/bin.mjs.map create mode 100644 node_modules/glob/dist/esm/glob.d.ts create mode 100644 node_modules/glob/dist/esm/glob.d.ts.map create mode 100644 node_modules/glob/dist/esm/glob.js create mode 100644 node_modules/glob/dist/esm/glob.js.map create mode 100644 node_modules/glob/dist/esm/has-magic.d.ts create mode 100644 node_modules/glob/dist/esm/has-magic.d.ts.map create mode 100644 node_modules/glob/dist/esm/has-magic.js create mode 100644 node_modules/glob/dist/esm/has-magic.js.map create mode 100644 node_modules/glob/dist/esm/ignore.d.ts create mode 100644 node_modules/glob/dist/esm/ignore.d.ts.map create mode 100644 node_modules/glob/dist/esm/ignore.js create mode 100644 node_modules/glob/dist/esm/ignore.js.map create mode 100644 node_modules/glob/dist/esm/index.d.ts create mode 100644 node_modules/glob/dist/esm/index.d.ts.map create mode 100644 node_modules/glob/dist/esm/index.js create mode 100644 node_modules/glob/dist/esm/index.js.map create mode 100644 node_modules/glob/dist/esm/package.json create mode 100644 node_modules/glob/dist/esm/pattern.d.ts create mode 100644 node_modules/glob/dist/esm/pattern.d.ts.map create mode 100644 node_modules/glob/dist/esm/pattern.js create mode 100644 node_modules/glob/dist/esm/pattern.js.map create mode 100644 node_modules/glob/dist/esm/processor.d.ts create mode 100644 node_modules/glob/dist/esm/processor.d.ts.map create mode 100644 node_modules/glob/dist/esm/processor.js create mode 100644 node_modules/glob/dist/esm/processor.js.map create mode 100644 node_modules/glob/dist/esm/walker.d.ts create mode 100644 node_modules/glob/dist/esm/walker.d.ts.map create mode 100644 node_modules/glob/dist/esm/walker.js create mode 100644 node_modules/glob/dist/esm/walker.js.map create mode 100644 node_modules/glob/package.json create mode 100644 node_modules/hosted-git-info/LICENSE create mode 100644 node_modules/hosted-git-info/README.md create mode 100644 node_modules/hosted-git-info/lib/from-url.js create mode 100644 node_modules/hosted-git-info/lib/hosts.js create mode 100644 node_modules/hosted-git-info/lib/index.js create mode 100644 node_modules/hosted-git-info/lib/parse-url.js create mode 100644 node_modules/hosted-git-info/package.json create mode 100644 node_modules/http-cache-semantics/LICENSE create mode 100644 node_modules/http-cache-semantics/README.md create mode 100644 node_modules/http-cache-semantics/index.js create mode 100644 node_modules/http-cache-semantics/package.json create mode 100644 node_modules/http-proxy-agent/LICENSE create mode 100644 node_modules/http-proxy-agent/README.md create mode 100644 node_modules/http-proxy-agent/dist/index.d.ts create mode 100644 node_modules/http-proxy-agent/dist/index.d.ts.map create mode 100644 node_modules/http-proxy-agent/dist/index.js create mode 100644 node_modules/http-proxy-agent/dist/index.js.map create mode 100644 node_modules/http-proxy-agent/package.json create mode 100644 node_modules/https-proxy-agent/LICENSE create mode 100644 node_modules/https-proxy-agent/README.md create mode 100644 node_modules/https-proxy-agent/dist/index.d.ts create mode 100644 node_modules/https-proxy-agent/dist/index.d.ts.map create mode 100644 node_modules/https-proxy-agent/dist/index.js create mode 100644 node_modules/https-proxy-agent/dist/index.js.map create mode 100644 node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts create mode 100644 node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts.map create mode 100644 node_modules/https-proxy-agent/dist/parse-proxy-response.js create mode 100644 node_modules/https-proxy-agent/dist/parse-proxy-response.js.map create mode 100644 node_modules/https-proxy-agent/package.json create mode 100644 node_modules/iconv-lite/.github/dependabot.yml create mode 100644 node_modules/iconv-lite/.idea/codeStyles/Project.xml create mode 100644 node_modules/iconv-lite/.idea/codeStyles/codeStyleConfig.xml create mode 100644 node_modules/iconv-lite/.idea/iconv-lite.iml create mode 100644 node_modules/iconv-lite/.idea/inspectionProfiles/Project_Default.xml create mode 100644 node_modules/iconv-lite/.idea/modules.xml create mode 100644 node_modules/iconv-lite/.idea/vcs.xml create mode 100644 node_modules/iconv-lite/Changelog.md create mode 100644 node_modules/iconv-lite/LICENSE create mode 100644 node_modules/iconv-lite/README.md create mode 100644 node_modules/iconv-lite/encodings/dbcs-codec.js create mode 100644 node_modules/iconv-lite/encodings/dbcs-data.js create mode 100644 node_modules/iconv-lite/encodings/index.js create mode 100644 node_modules/iconv-lite/encodings/internal.js create mode 100644 node_modules/iconv-lite/encodings/sbcs-codec.js create mode 100644 node_modules/iconv-lite/encodings/sbcs-data-generated.js create mode 100644 node_modules/iconv-lite/encodings/sbcs-data.js create mode 100644 node_modules/iconv-lite/encodings/tables/big5-added.json create mode 100644 node_modules/iconv-lite/encodings/tables/cp936.json create mode 100644 node_modules/iconv-lite/encodings/tables/cp949.json create mode 100644 node_modules/iconv-lite/encodings/tables/cp950.json create mode 100644 node_modules/iconv-lite/encodings/tables/eucjp.json create mode 100644 node_modules/iconv-lite/encodings/tables/gb18030-ranges.json create mode 100644 node_modules/iconv-lite/encodings/tables/gbk-added.json create mode 100644 node_modules/iconv-lite/encodings/tables/shiftjis.json create mode 100644 node_modules/iconv-lite/encodings/utf16.js create mode 100644 node_modules/iconv-lite/encodings/utf32.js create mode 100644 node_modules/iconv-lite/encodings/utf7.js create mode 100644 node_modules/iconv-lite/lib/bom-handling.js create mode 100644 node_modules/iconv-lite/lib/index.d.ts create mode 100644 node_modules/iconv-lite/lib/index.js create mode 100644 node_modules/iconv-lite/lib/streams.js create mode 100644 node_modules/iconv-lite/package.json create mode 100644 node_modules/imurmurhash/README.md create mode 100644 node_modules/imurmurhash/imurmurhash.js create mode 100644 node_modules/imurmurhash/imurmurhash.min.js create mode 100644 node_modules/imurmurhash/package.json create mode 100644 node_modules/ip-address/LICENSE create mode 100644 node_modules/ip-address/README.md create mode 100644 node_modules/ip-address/dist/address-error.d.ts create mode 100644 node_modules/ip-address/dist/address-error.d.ts.map create mode 100644 node_modules/ip-address/dist/address-error.js create mode 100644 node_modules/ip-address/dist/address-error.js.map create mode 100644 node_modules/ip-address/dist/common.d.ts create mode 100644 node_modules/ip-address/dist/common.d.ts.map create mode 100644 node_modules/ip-address/dist/common.js create mode 100644 node_modules/ip-address/dist/common.js.map create mode 100644 node_modules/ip-address/dist/ip-address.d.ts create mode 100644 node_modules/ip-address/dist/ip-address.d.ts.map create mode 100644 node_modules/ip-address/dist/ip-address.js create mode 100644 node_modules/ip-address/dist/ip-address.js.map create mode 100644 node_modules/ip-address/dist/ipv4.d.ts create mode 100644 node_modules/ip-address/dist/ipv4.d.ts.map create mode 100644 node_modules/ip-address/dist/ipv4.js create mode 100644 node_modules/ip-address/dist/ipv4.js.map create mode 100644 node_modules/ip-address/dist/ipv6.d.ts create mode 100644 node_modules/ip-address/dist/ipv6.d.ts.map create mode 100644 node_modules/ip-address/dist/ipv6.js create mode 100644 node_modules/ip-address/dist/ipv6.js.map create mode 100644 node_modules/ip-address/dist/v4/constants.d.ts create mode 100644 node_modules/ip-address/dist/v4/constants.d.ts.map create mode 100644 node_modules/ip-address/dist/v4/constants.js create mode 100644 node_modules/ip-address/dist/v4/constants.js.map create mode 100644 node_modules/ip-address/dist/v6/constants.d.ts create mode 100644 node_modules/ip-address/dist/v6/constants.d.ts.map create mode 100644 node_modules/ip-address/dist/v6/constants.js create mode 100644 node_modules/ip-address/dist/v6/constants.js.map create mode 100644 node_modules/ip-address/dist/v6/helpers.d.ts create mode 100644 node_modules/ip-address/dist/v6/helpers.d.ts.map create mode 100644 node_modules/ip-address/dist/v6/helpers.js create mode 100644 node_modules/ip-address/dist/v6/helpers.js.map create mode 100644 node_modules/ip-address/dist/v6/regular-expressions.d.ts create mode 100644 node_modules/ip-address/dist/v6/regular-expressions.d.ts.map create mode 100644 node_modules/ip-address/dist/v6/regular-expressions.js create mode 100644 node_modules/ip-address/dist/v6/regular-expressions.js.map create mode 100644 node_modules/ip-address/package.json create mode 100644 node_modules/ip-address/src/address-error.ts create mode 100644 node_modules/ip-address/src/common.ts create mode 100644 node_modules/ip-address/src/ip-address.ts create mode 100644 node_modules/ip-address/src/ipv4.ts create mode 100644 node_modules/ip-address/src/ipv6.ts create mode 100644 node_modules/ip-address/src/v4/constants.ts create mode 100644 node_modules/ip-address/src/v6/constants.ts create mode 100644 node_modules/ip-address/src/v6/helpers.ts create mode 100644 node_modules/ip-address/src/v6/regular-expressions.ts create mode 100644 node_modules/is-fullwidth-code-point/index.d.ts create mode 100644 node_modules/is-fullwidth-code-point/index.js create mode 100644 node_modules/is-fullwidth-code-point/license create mode 100644 node_modules/is-fullwidth-code-point/package.json create mode 100644 node_modules/is-fullwidth-code-point/readme.md create mode 100644 node_modules/is-interactive/index.d.ts create mode 100644 node_modules/is-interactive/index.js create mode 100644 node_modules/is-interactive/license create mode 100644 node_modules/is-interactive/package.json create mode 100644 node_modules/is-interactive/readme.md create mode 100644 node_modules/is-unicode-supported/index.d.ts create mode 100644 node_modules/is-unicode-supported/index.js create mode 100644 node_modules/is-unicode-supported/license create mode 100644 node_modules/is-unicode-supported/package.json create mode 100644 node_modules/is-unicode-supported/readme.md create mode 100644 node_modules/isexe/.npmignore create mode 100644 node_modules/isexe/LICENSE create mode 100644 node_modules/isexe/README.md create mode 100644 node_modules/isexe/index.js create mode 100644 node_modules/isexe/mode.js create mode 100644 node_modules/isexe/package.json create mode 100644 node_modules/isexe/test/basic.js create mode 100644 node_modules/isexe/windows.js create mode 100644 node_modules/jackspeak/LICENSE.md create mode 100644 node_modules/jackspeak/README.md create mode 100644 node_modules/jackspeak/dist/commonjs/index.d.ts create mode 100644 node_modules/jackspeak/dist/commonjs/index.d.ts.map create mode 100644 node_modules/jackspeak/dist/commonjs/index.js create mode 100644 node_modules/jackspeak/dist/commonjs/index.js.map create mode 100644 node_modules/jackspeak/dist/commonjs/package.json create mode 100644 node_modules/jackspeak/dist/commonjs/parse-args-cjs.cjs.map create mode 100644 node_modules/jackspeak/dist/commonjs/parse-args-cjs.d.cts.map create mode 100644 node_modules/jackspeak/dist/commonjs/parse-args.d.ts create mode 100644 node_modules/jackspeak/dist/commonjs/parse-args.js create mode 100644 node_modules/jackspeak/dist/esm/index.d.ts create mode 100644 node_modules/jackspeak/dist/esm/index.d.ts.map create mode 100644 node_modules/jackspeak/dist/esm/index.js create mode 100644 node_modules/jackspeak/dist/esm/index.js.map create mode 100644 node_modules/jackspeak/dist/esm/package.json create mode 100644 node_modules/jackspeak/dist/esm/parse-args.d.ts create mode 100644 node_modules/jackspeak/dist/esm/parse-args.d.ts.map create mode 100644 node_modules/jackspeak/dist/esm/parse-args.js create mode 100644 node_modules/jackspeak/dist/esm/parse-args.js.map create mode 100644 node_modules/jackspeak/package.json create mode 100644 node_modules/jsonparse/.npmignore create mode 100644 node_modules/jsonparse/LICENSE create mode 100644 node_modules/jsonparse/README.markdown create mode 100644 node_modules/jsonparse/bench.js create mode 100644 node_modules/jsonparse/examples/twitterfeed.js create mode 100644 node_modules/jsonparse/jsonparse.js create mode 100644 node_modules/jsonparse/package.json create mode 100644 node_modules/jsonparse/samplejson/basic.json create mode 100644 node_modules/jsonparse/samplejson/basic2.json create mode 100644 node_modules/jsonparse/test/big-token.js create mode 100644 node_modules/jsonparse/test/boundary.js create mode 100644 node_modules/jsonparse/test/offset.js create mode 100644 node_modules/jsonparse/test/primitives.js create mode 100644 node_modules/jsonparse/test/surrogate.js create mode 100644 node_modules/jsonparse/test/unvalid.js create mode 100644 node_modules/jsonparse/test/utf8.js create mode 100644 node_modules/log-symbols/browser.js create mode 100644 node_modules/log-symbols/index.d.ts create mode 100644 node_modules/log-symbols/index.js create mode 100644 node_modules/log-symbols/license create mode 100644 node_modules/log-symbols/node_modules/is-unicode-supported/index.d.ts create mode 100644 node_modules/log-symbols/node_modules/is-unicode-supported/index.js create mode 100644 node_modules/log-symbols/node_modules/is-unicode-supported/license create mode 100644 node_modules/log-symbols/node_modules/is-unicode-supported/package.json create mode 100644 node_modules/log-symbols/node_modules/is-unicode-supported/readme.md create mode 100644 node_modules/log-symbols/package.json create mode 100644 node_modules/log-symbols/readme.md create mode 100644 node_modules/lru-cache/LICENSE create mode 100644 node_modules/lru-cache/README.md create mode 100644 node_modules/lru-cache/dist/commonjs/index.d.ts create mode 100644 node_modules/lru-cache/dist/commonjs/index.d.ts.map create mode 100644 node_modules/lru-cache/dist/commonjs/index.js create mode 100644 node_modules/lru-cache/dist/commonjs/index.js.map create mode 100644 node_modules/lru-cache/dist/commonjs/index.min.js create mode 100644 node_modules/lru-cache/dist/commonjs/index.min.js.map create mode 100644 node_modules/lru-cache/dist/commonjs/package.json create mode 100644 node_modules/lru-cache/dist/esm/index.d.ts create mode 100644 node_modules/lru-cache/dist/esm/index.d.ts.map create mode 100644 node_modules/lru-cache/dist/esm/index.js create mode 100644 node_modules/lru-cache/dist/esm/index.js.map create mode 100644 node_modules/lru-cache/dist/esm/index.min.js create mode 100644 node_modules/lru-cache/dist/esm/index.min.js.map create mode 100644 node_modules/lru-cache/dist/esm/package.json create mode 100644 node_modules/lru-cache/package.json create mode 100644 node_modules/make-fetch-happen/LICENSE create mode 100644 node_modules/make-fetch-happen/README.md create mode 100644 node_modules/make-fetch-happen/lib/cache/entry.js create mode 100644 node_modules/make-fetch-happen/lib/cache/errors.js create mode 100644 node_modules/make-fetch-happen/lib/cache/index.js create mode 100644 node_modules/make-fetch-happen/lib/cache/key.js create mode 100644 node_modules/make-fetch-happen/lib/cache/policy.js create mode 100644 node_modules/make-fetch-happen/lib/fetch.js create mode 100644 node_modules/make-fetch-happen/lib/index.js create mode 100644 node_modules/make-fetch-happen/lib/options.js create mode 100644 node_modules/make-fetch-happen/lib/pipeline.js create mode 100644 node_modules/make-fetch-happen/lib/remote.js create mode 100644 node_modules/make-fetch-happen/package.json create mode 100644 node_modules/mimic-function/index.d.ts create mode 100644 node_modules/mimic-function/index.js create mode 100644 node_modules/mimic-function/license create mode 100644 node_modules/mimic-function/package.json create mode 100644 node_modules/mimic-function/readme.md create mode 100644 node_modules/minimatch/LICENSE create mode 100644 node_modules/minimatch/README.md create mode 100644 node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts create mode 100644 node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map create mode 100644 node_modules/minimatch/dist/commonjs/assert-valid-pattern.js create mode 100644 node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map create mode 100644 node_modules/minimatch/dist/commonjs/ast.d.ts create mode 100644 node_modules/minimatch/dist/commonjs/ast.d.ts.map create mode 100644 node_modules/minimatch/dist/commonjs/ast.js create mode 100644 node_modules/minimatch/dist/commonjs/ast.js.map create mode 100644 node_modules/minimatch/dist/commonjs/brace-expressions.d.ts create mode 100644 node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map create mode 100644 node_modules/minimatch/dist/commonjs/brace-expressions.js create mode 100644 node_modules/minimatch/dist/commonjs/brace-expressions.js.map create mode 100644 node_modules/minimatch/dist/commonjs/escape.d.ts create mode 100644 node_modules/minimatch/dist/commonjs/escape.d.ts.map create mode 100644 node_modules/minimatch/dist/commonjs/escape.js create mode 100644 node_modules/minimatch/dist/commonjs/escape.js.map create mode 100644 node_modules/minimatch/dist/commonjs/index.d.ts create mode 100644 node_modules/minimatch/dist/commonjs/index.d.ts.map create mode 100644 node_modules/minimatch/dist/commonjs/index.js create mode 100644 node_modules/minimatch/dist/commonjs/index.js.map create mode 100644 node_modules/minimatch/dist/commonjs/package.json create mode 100644 node_modules/minimatch/dist/commonjs/unescape.d.ts create mode 100644 node_modules/minimatch/dist/commonjs/unescape.d.ts.map create mode 100644 node_modules/minimatch/dist/commonjs/unescape.js create mode 100644 node_modules/minimatch/dist/commonjs/unescape.js.map create mode 100644 node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts create mode 100644 node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map create mode 100644 node_modules/minimatch/dist/esm/assert-valid-pattern.js create mode 100644 node_modules/minimatch/dist/esm/assert-valid-pattern.js.map create mode 100644 node_modules/minimatch/dist/esm/ast.d.ts create mode 100644 node_modules/minimatch/dist/esm/ast.d.ts.map create mode 100644 node_modules/minimatch/dist/esm/ast.js create mode 100644 node_modules/minimatch/dist/esm/ast.js.map create mode 100644 node_modules/minimatch/dist/esm/brace-expressions.d.ts create mode 100644 node_modules/minimatch/dist/esm/brace-expressions.d.ts.map create mode 100644 node_modules/minimatch/dist/esm/brace-expressions.js create mode 100644 node_modules/minimatch/dist/esm/brace-expressions.js.map create mode 100644 node_modules/minimatch/dist/esm/escape.d.ts create mode 100644 node_modules/minimatch/dist/esm/escape.d.ts.map create mode 100644 node_modules/minimatch/dist/esm/escape.js create mode 100644 node_modules/minimatch/dist/esm/escape.js.map create mode 100644 node_modules/minimatch/dist/esm/index.d.ts create mode 100644 node_modules/minimatch/dist/esm/index.d.ts.map create mode 100644 node_modules/minimatch/dist/esm/index.js create mode 100644 node_modules/minimatch/dist/esm/index.js.map create mode 100644 node_modules/minimatch/dist/esm/package.json create mode 100644 node_modules/minimatch/dist/esm/unescape.d.ts create mode 100644 node_modules/minimatch/dist/esm/unescape.d.ts.map create mode 100644 node_modules/minimatch/dist/esm/unescape.js create mode 100644 node_modules/minimatch/dist/esm/unescape.js.map create mode 100644 node_modules/minimatch/package.json create mode 100644 node_modules/minipass-collect/LICENSE create mode 100644 node_modules/minipass-collect/README.md create mode 100644 node_modules/minipass-collect/index.js create mode 100644 node_modules/minipass-collect/package.json create mode 100644 node_modules/minipass-fetch/LICENSE create mode 100644 node_modules/minipass-fetch/README.md create mode 100644 node_modules/minipass-fetch/lib/abort-error.js create mode 100644 node_modules/minipass-fetch/lib/blob.js create mode 100644 node_modules/minipass-fetch/lib/body.js create mode 100644 node_modules/minipass-fetch/lib/fetch-error.js create mode 100644 node_modules/minipass-fetch/lib/headers.js create mode 100644 node_modules/minipass-fetch/lib/index.js create mode 100644 node_modules/minipass-fetch/lib/request.js create mode 100644 node_modules/minipass-fetch/lib/response.js create mode 100644 node_modules/minipass-fetch/package.json create mode 100644 node_modules/minipass-flush/LICENSE create mode 100644 node_modules/minipass-flush/README.md create mode 100644 node_modules/minipass-flush/index.js create mode 100644 node_modules/minipass-flush/node_modules/minipass/LICENSE create mode 100644 node_modules/minipass-flush/node_modules/minipass/README.md create mode 100644 node_modules/minipass-flush/node_modules/minipass/index.d.ts create mode 100644 node_modules/minipass-flush/node_modules/minipass/index.js create mode 100644 node_modules/minipass-flush/node_modules/minipass/package.json create mode 100644 node_modules/minipass-flush/node_modules/yallist/LICENSE create mode 100644 node_modules/minipass-flush/node_modules/yallist/README.md create mode 100644 node_modules/minipass-flush/node_modules/yallist/iterator.js create mode 100644 node_modules/minipass-flush/node_modules/yallist/package.json create mode 100644 node_modules/minipass-flush/node_modules/yallist/yallist.js create mode 100644 node_modules/minipass-flush/package.json create mode 100644 node_modules/minipass-pipeline/LICENSE create mode 100644 node_modules/minipass-pipeline/README.md create mode 100644 node_modules/minipass-pipeline/index.js create mode 100644 node_modules/minipass-pipeline/node_modules/minipass/LICENSE create mode 100644 node_modules/minipass-pipeline/node_modules/minipass/README.md create mode 100644 node_modules/minipass-pipeline/node_modules/minipass/index.d.ts create mode 100644 node_modules/minipass-pipeline/node_modules/minipass/index.js create mode 100644 node_modules/minipass-pipeline/node_modules/minipass/package.json create mode 100644 node_modules/minipass-pipeline/node_modules/yallist/LICENSE create mode 100644 node_modules/minipass-pipeline/node_modules/yallist/README.md create mode 100644 node_modules/minipass-pipeline/node_modules/yallist/iterator.js create mode 100644 node_modules/minipass-pipeline/node_modules/yallist/package.json create mode 100644 node_modules/minipass-pipeline/node_modules/yallist/yallist.js create mode 100644 node_modules/minipass-pipeline/package.json create mode 100644 node_modules/minipass-sized/.npmignore create mode 100644 node_modules/minipass-sized/LICENSE create mode 100644 node_modules/minipass-sized/README.md create mode 100644 node_modules/minipass-sized/index.js create mode 100644 node_modules/minipass-sized/node_modules/minipass/LICENSE create mode 100644 node_modules/minipass-sized/node_modules/minipass/README.md create mode 100644 node_modules/minipass-sized/node_modules/minipass/index.d.ts create mode 100644 node_modules/minipass-sized/node_modules/minipass/index.js create mode 100644 node_modules/minipass-sized/node_modules/minipass/package.json create mode 100644 node_modules/minipass-sized/node_modules/yallist/LICENSE create mode 100644 node_modules/minipass-sized/node_modules/yallist/README.md create mode 100644 node_modules/minipass-sized/node_modules/yallist/iterator.js create mode 100644 node_modules/minipass-sized/node_modules/yallist/package.json create mode 100644 node_modules/minipass-sized/node_modules/yallist/yallist.js create mode 100644 node_modules/minipass-sized/package-lock.json create mode 100644 node_modules/minipass-sized/package.json create mode 100644 node_modules/minipass-sized/test/basic.js create mode 100644 node_modules/minipass/LICENSE create mode 100644 node_modules/minipass/README.md create mode 100644 node_modules/minipass/dist/commonjs/index.d.ts create mode 100644 node_modules/minipass/dist/commonjs/index.d.ts.map create mode 100644 node_modules/minipass/dist/commonjs/index.js create mode 100644 node_modules/minipass/dist/commonjs/index.js.map create mode 100644 node_modules/minipass/dist/commonjs/package.json create mode 100644 node_modules/minipass/dist/esm/index.d.ts create mode 100644 node_modules/minipass/dist/esm/index.d.ts.map create mode 100644 node_modules/minipass/dist/esm/index.js create mode 100644 node_modules/minipass/dist/esm/index.js.map create mode 100644 node_modules/minipass/dist/esm/package.json create mode 100644 node_modules/minipass/package.json create mode 100644 node_modules/minizlib/LICENSE create mode 100644 node_modules/minizlib/README.md create mode 100644 node_modules/minizlib/dist/commonjs/constants.d.ts create mode 100644 node_modules/minizlib/dist/commonjs/constants.d.ts.map create mode 100644 node_modules/minizlib/dist/commonjs/constants.js create mode 100644 node_modules/minizlib/dist/commonjs/constants.js.map create mode 100644 node_modules/minizlib/dist/commonjs/index.d.ts create mode 100644 node_modules/minizlib/dist/commonjs/index.d.ts.map create mode 100644 node_modules/minizlib/dist/commonjs/index.js create mode 100644 node_modules/minizlib/dist/commonjs/index.js.map create mode 100644 node_modules/minizlib/dist/commonjs/package.json create mode 100644 node_modules/minizlib/dist/esm/constants.d.ts create mode 100644 node_modules/minizlib/dist/esm/constants.d.ts.map create mode 100644 node_modules/minizlib/dist/esm/constants.js create mode 100644 node_modules/minizlib/dist/esm/constants.js.map create mode 100644 node_modules/minizlib/dist/esm/index.d.ts create mode 100644 node_modules/minizlib/dist/esm/index.d.ts.map create mode 100644 node_modules/minizlib/dist/esm/index.js create mode 100644 node_modules/minizlib/dist/esm/index.js.map create mode 100644 node_modules/minizlib/dist/esm/package.json create mode 100644 node_modules/minizlib/package.json create mode 100644 node_modules/ms/index.js create mode 100644 node_modules/ms/license.md create mode 100644 node_modules/ms/package.json create mode 100644 node_modules/ms/readme.md create mode 100644 node_modules/negotiator/HISTORY.md create mode 100644 node_modules/negotiator/LICENSE create mode 100644 node_modules/negotiator/README.md create mode 100644 node_modules/negotiator/index.js create mode 100644 node_modules/negotiator/lib/charset.js create mode 100644 node_modules/negotiator/lib/encoding.js create mode 100644 node_modules/negotiator/lib/language.js create mode 100644 node_modules/negotiator/lib/mediaType.js create mode 100644 node_modules/negotiator/package.json create mode 100644 node_modules/node-forge/CHANGELOG.md create mode 100644 node_modules/node-forge/LICENSE create mode 100644 node_modules/node-forge/README.md create mode 100644 node_modules/node-forge/dist/forge.all.min.js create mode 100644 node_modules/node-forge/dist/forge.all.min.js.map create mode 100644 node_modules/node-forge/dist/forge.min.js create mode 100644 node_modules/node-forge/dist/forge.min.js.map create mode 100644 node_modules/node-forge/dist/prime.worker.min.js create mode 100644 node_modules/node-forge/dist/prime.worker.min.js.map create mode 100644 node_modules/node-forge/flash/README.md create mode 100644 node_modules/node-forge/flash/package.json create mode 100644 node_modules/node-forge/flash/swf/SocketPool.swf create mode 100644 node_modules/node-forge/lib/aes.js create mode 100644 node_modules/node-forge/lib/aesCipherSuites.js create mode 100644 node_modules/node-forge/lib/asn1-validator.js create mode 100644 node_modules/node-forge/lib/asn1.js create mode 100644 node_modules/node-forge/lib/baseN.js create mode 100644 node_modules/node-forge/lib/cipher.js create mode 100644 node_modules/node-forge/lib/cipherModes.js create mode 100644 node_modules/node-forge/lib/des.js create mode 100644 node_modules/node-forge/lib/ed25519.js create mode 100644 node_modules/node-forge/lib/forge.js create mode 100644 node_modules/node-forge/lib/form.js create mode 100644 node_modules/node-forge/lib/hmac.js create mode 100644 node_modules/node-forge/lib/http.js create mode 100644 node_modules/node-forge/lib/index.all.js create mode 100644 node_modules/node-forge/lib/index.js create mode 100644 node_modules/node-forge/lib/jsbn.js create mode 100644 node_modules/node-forge/lib/kem.js create mode 100644 node_modules/node-forge/lib/log.js create mode 100644 node_modules/node-forge/lib/md.all.js create mode 100644 node_modules/node-forge/lib/md.js create mode 100644 node_modules/node-forge/lib/md5.js create mode 100644 node_modules/node-forge/lib/mgf.js create mode 100644 node_modules/node-forge/lib/mgf1.js create mode 100644 node_modules/node-forge/lib/oids.js create mode 100644 node_modules/node-forge/lib/pbe.js create mode 100644 node_modules/node-forge/lib/pbkdf2.js create mode 100644 node_modules/node-forge/lib/pem.js create mode 100644 node_modules/node-forge/lib/pkcs1.js create mode 100644 node_modules/node-forge/lib/pkcs12.js create mode 100644 node_modules/node-forge/lib/pkcs7.js create mode 100644 node_modules/node-forge/lib/pkcs7asn1.js create mode 100644 node_modules/node-forge/lib/pki.js create mode 100644 node_modules/node-forge/lib/prime.js create mode 100644 node_modules/node-forge/lib/prime.worker.js create mode 100644 node_modules/node-forge/lib/prng.js create mode 100644 node_modules/node-forge/lib/pss.js create mode 100644 node_modules/node-forge/lib/random.js create mode 100644 node_modules/node-forge/lib/rc2.js create mode 100644 node_modules/node-forge/lib/rsa.js create mode 100644 node_modules/node-forge/lib/sha1.js create mode 100644 node_modules/node-forge/lib/sha256.js create mode 100644 node_modules/node-forge/lib/sha512.js create mode 100644 node_modules/node-forge/lib/socket.js create mode 100644 node_modules/node-forge/lib/ssh.js create mode 100644 node_modules/node-forge/lib/tls.js create mode 100644 node_modules/node-forge/lib/tlssocket.js create mode 100644 node_modules/node-forge/lib/util.js create mode 100644 node_modules/node-forge/lib/x509.js create mode 100644 node_modules/node-forge/lib/xhr.js create mode 100644 node_modules/node-forge/package.json create mode 100644 node_modules/npm-package-arg/LICENSE create mode 100644 node_modules/npm-package-arg/README.md create mode 100644 node_modules/npm-package-arg/lib/npa.js create mode 100644 node_modules/npm-package-arg/package.json create mode 100644 node_modules/npm-registry-fetch/LICENSE.md create mode 100644 node_modules/npm-registry-fetch/README.md create mode 100644 node_modules/npm-registry-fetch/lib/auth.js create mode 100644 node_modules/npm-registry-fetch/lib/check-response.js create mode 100644 node_modules/npm-registry-fetch/lib/default-opts.js create mode 100644 node_modules/npm-registry-fetch/lib/errors.js create mode 100644 node_modules/npm-registry-fetch/lib/index.js create mode 100644 node_modules/npm-registry-fetch/lib/json-stream.js create mode 100644 node_modules/npm-registry-fetch/package.json create mode 100644 node_modules/onetime/index.d.ts create mode 100644 node_modules/onetime/index.js create mode 100644 node_modules/onetime/license create mode 100644 node_modules/onetime/package.json create mode 100644 node_modules/onetime/readme.md create mode 100644 node_modules/ora/index.d.ts create mode 100644 node_modules/ora/index.js create mode 100644 node_modules/ora/license create mode 100644 node_modules/ora/node_modules/emoji-regex/LICENSE-MIT.txt create mode 100644 node_modules/ora/node_modules/emoji-regex/README.md create mode 100644 node_modules/ora/node_modules/emoji-regex/index.d.ts create mode 100644 node_modules/ora/node_modules/emoji-regex/index.js create mode 100644 node_modules/ora/node_modules/emoji-regex/index.mjs create mode 100644 node_modules/ora/node_modules/emoji-regex/package.json create mode 100644 node_modules/ora/node_modules/string-width/index.d.ts create mode 100644 node_modules/ora/node_modules/string-width/index.js create mode 100644 node_modules/ora/node_modules/string-width/license create mode 100644 node_modules/ora/node_modules/string-width/package.json create mode 100644 node_modules/ora/node_modules/string-width/readme.md create mode 100644 node_modules/ora/package.json create mode 100644 node_modules/ora/readme.md create mode 100644 node_modules/p-map/index.d.ts create mode 100644 node_modules/p-map/index.js create mode 100644 node_modules/p-map/license create mode 100644 node_modules/p-map/package.json create mode 100644 node_modules/p-map/readme.md create mode 100644 node_modules/package-json-from-dist/LICENSE.md create mode 100644 node_modules/package-json-from-dist/README.md create mode 100644 node_modules/package-json-from-dist/dist/commonjs/index.d.ts create mode 100644 node_modules/package-json-from-dist/dist/commonjs/index.d.ts.map create mode 100644 node_modules/package-json-from-dist/dist/commonjs/index.js create mode 100644 node_modules/package-json-from-dist/dist/commonjs/index.js.map create mode 100644 node_modules/package-json-from-dist/dist/commonjs/package.json create mode 100644 node_modules/package-json-from-dist/dist/esm/index.d.ts create mode 100644 node_modules/package-json-from-dist/dist/esm/index.d.ts.map create mode 100644 node_modules/package-json-from-dist/dist/esm/index.js create mode 100644 node_modules/package-json-from-dist/dist/esm/index.js.map create mode 100644 node_modules/package-json-from-dist/dist/esm/package.json create mode 100644 node_modules/package-json-from-dist/package.json create mode 100644 node_modules/path-key/index.d.ts create mode 100644 node_modules/path-key/index.js create mode 100644 node_modules/path-key/license create mode 100644 node_modules/path-key/package.json create mode 100644 node_modules/path-key/readme.md create mode 100644 node_modules/path-scurry/LICENSE.md create mode 100644 node_modules/path-scurry/README.md create mode 100644 node_modules/path-scurry/dist/commonjs/index.d.ts create mode 100644 node_modules/path-scurry/dist/commonjs/index.d.ts.map create mode 100644 node_modules/path-scurry/dist/commonjs/index.js create mode 100644 node_modules/path-scurry/dist/commonjs/index.js.map create mode 100644 node_modules/path-scurry/dist/commonjs/package.json create mode 100644 node_modules/path-scurry/dist/esm/index.d.ts create mode 100644 node_modules/path-scurry/dist/esm/index.d.ts.map create mode 100644 node_modules/path-scurry/dist/esm/index.js create mode 100644 node_modules/path-scurry/dist/esm/index.js.map create mode 100644 node_modules/path-scurry/dist/esm/package.json create mode 100644 node_modules/path-scurry/package.json create mode 100644 node_modules/proc-log/LICENSE create mode 100644 node_modules/proc-log/README.md create mode 100644 node_modules/proc-log/lib/index.js create mode 100644 node_modules/proc-log/package.json create mode 100644 node_modules/promise-retry/.editorconfig create mode 100644 node_modules/promise-retry/.jshintrc create mode 100644 node_modules/promise-retry/.travis.yml create mode 100644 node_modules/promise-retry/LICENSE create mode 100644 node_modules/promise-retry/README.md create mode 100644 node_modules/promise-retry/index.js create mode 100644 node_modules/promise-retry/package.json create mode 100644 node_modules/promise-retry/test/test.js create mode 100644 node_modules/restore-cursor/index.d.ts create mode 100644 node_modules/restore-cursor/index.js create mode 100644 node_modules/restore-cursor/license create mode 100644 node_modules/restore-cursor/package.json create mode 100644 node_modules/restore-cursor/readme.md create mode 100644 node_modules/retry/.npmignore create mode 100644 node_modules/retry/.travis.yml create mode 100644 node_modules/retry/License create mode 100644 node_modules/retry/Makefile create mode 100644 node_modules/retry/README.md create mode 100644 node_modules/retry/equation.gif create mode 100644 node_modules/retry/example/dns.js create mode 100644 node_modules/retry/example/stop.js create mode 100644 node_modules/retry/index.js create mode 100644 node_modules/retry/lib/retry.js create mode 100644 node_modules/retry/lib/retry_operation.js create mode 100644 node_modules/retry/package.json create mode 100644 node_modules/retry/test/common.js create mode 100644 node_modules/retry/test/integration/test-forever.js create mode 100644 node_modules/retry/test/integration/test-retry-operation.js create mode 100644 node_modules/retry/test/integration/test-retry-wrap.js create mode 100644 node_modules/retry/test/integration/test-timeouts.js create mode 100644 node_modules/safer-buffer/LICENSE create mode 100644 node_modules/safer-buffer/Porting-Buffer.md create mode 100644 node_modules/safer-buffer/Readme.md create mode 100644 node_modules/safer-buffer/dangerous.js create mode 100644 node_modules/safer-buffer/package.json create mode 100644 node_modules/safer-buffer/safer.js create mode 100644 node_modules/safer-buffer/tests.js create mode 100644 node_modules/semver/LICENSE create mode 100644 node_modules/semver/README.md create mode 100644 node_modules/semver/bin/semver.js create mode 100644 node_modules/semver/classes/comparator.js create mode 100644 node_modules/semver/classes/index.js create mode 100644 node_modules/semver/classes/range.js create mode 100644 node_modules/semver/classes/semver.js create mode 100644 node_modules/semver/functions/clean.js create mode 100644 node_modules/semver/functions/cmp.js create mode 100644 node_modules/semver/functions/coerce.js create mode 100644 node_modules/semver/functions/compare-build.js create mode 100644 node_modules/semver/functions/compare-loose.js create mode 100644 node_modules/semver/functions/compare.js create mode 100644 node_modules/semver/functions/diff.js create mode 100644 node_modules/semver/functions/eq.js create mode 100644 node_modules/semver/functions/gt.js create mode 100644 node_modules/semver/functions/gte.js create mode 100644 node_modules/semver/functions/inc.js create mode 100644 node_modules/semver/functions/lt.js create mode 100644 node_modules/semver/functions/lte.js create mode 100644 node_modules/semver/functions/major.js create mode 100644 node_modules/semver/functions/minor.js create mode 100644 node_modules/semver/functions/neq.js create mode 100644 node_modules/semver/functions/parse.js create mode 100644 node_modules/semver/functions/patch.js create mode 100644 node_modules/semver/functions/prerelease.js create mode 100644 node_modules/semver/functions/rcompare.js create mode 100644 node_modules/semver/functions/rsort.js create mode 100644 node_modules/semver/functions/satisfies.js create mode 100644 node_modules/semver/functions/sort.js create mode 100644 node_modules/semver/functions/valid.js create mode 100644 node_modules/semver/index.js create mode 100644 node_modules/semver/internal/constants.js create mode 100644 node_modules/semver/internal/debug.js create mode 100644 node_modules/semver/internal/identifiers.js create mode 100644 node_modules/semver/internal/lrucache.js create mode 100644 node_modules/semver/internal/parse-options.js create mode 100644 node_modules/semver/internal/re.js create mode 100644 node_modules/semver/package.json create mode 100644 node_modules/semver/preload.js create mode 100644 node_modules/semver/range.bnf create mode 100644 node_modules/semver/ranges/gtr.js create mode 100644 node_modules/semver/ranges/intersects.js create mode 100644 node_modules/semver/ranges/ltr.js create mode 100644 node_modules/semver/ranges/max-satisfying.js create mode 100644 node_modules/semver/ranges/min-satisfying.js create mode 100644 node_modules/semver/ranges/min-version.js create mode 100644 node_modules/semver/ranges/outside.js create mode 100644 node_modules/semver/ranges/simplify.js create mode 100644 node_modules/semver/ranges/subset.js create mode 100644 node_modules/semver/ranges/to-comparators.js create mode 100644 node_modules/semver/ranges/valid.js create mode 100644 node_modules/shebang-command/index.js create mode 100644 node_modules/shebang-command/license create mode 100644 node_modules/shebang-command/package.json create mode 100644 node_modules/shebang-command/readme.md create mode 100644 node_modules/shebang-regex/index.d.ts create mode 100644 node_modules/shebang-regex/index.js create mode 100644 node_modules/shebang-regex/license create mode 100644 node_modules/shebang-regex/package.json create mode 100644 node_modules/shebang-regex/readme.md create mode 100644 node_modules/signal-exit/LICENSE.txt create mode 100644 node_modules/signal-exit/README.md create mode 100644 node_modules/signal-exit/dist/cjs/browser.d.ts create mode 100644 node_modules/signal-exit/dist/cjs/browser.d.ts.map create mode 100644 node_modules/signal-exit/dist/cjs/browser.js create mode 100644 node_modules/signal-exit/dist/cjs/browser.js.map create mode 100644 node_modules/signal-exit/dist/cjs/index.d.ts create mode 100644 node_modules/signal-exit/dist/cjs/index.d.ts.map create mode 100644 node_modules/signal-exit/dist/cjs/index.js create mode 100644 node_modules/signal-exit/dist/cjs/index.js.map create mode 100644 node_modules/signal-exit/dist/cjs/package.json create mode 100644 node_modules/signal-exit/dist/cjs/signals.d.ts create mode 100644 node_modules/signal-exit/dist/cjs/signals.d.ts.map create mode 100644 node_modules/signal-exit/dist/cjs/signals.js create mode 100644 node_modules/signal-exit/dist/cjs/signals.js.map create mode 100644 node_modules/signal-exit/dist/mjs/browser.d.ts create mode 100644 node_modules/signal-exit/dist/mjs/browser.d.ts.map create mode 100644 node_modules/signal-exit/dist/mjs/browser.js create mode 100644 node_modules/signal-exit/dist/mjs/browser.js.map create mode 100644 node_modules/signal-exit/dist/mjs/index.d.ts create mode 100644 node_modules/signal-exit/dist/mjs/index.d.ts.map create mode 100644 node_modules/signal-exit/dist/mjs/index.js create mode 100644 node_modules/signal-exit/dist/mjs/index.js.map create mode 100644 node_modules/signal-exit/dist/mjs/package.json create mode 100644 node_modules/signal-exit/dist/mjs/signals.d.ts create mode 100644 node_modules/signal-exit/dist/mjs/signals.d.ts.map create mode 100644 node_modules/signal-exit/dist/mjs/signals.js create mode 100644 node_modules/signal-exit/dist/mjs/signals.js.map create mode 100644 node_modules/signal-exit/package.json create mode 100644 node_modules/smart-buffer/.prettierrc.yaml create mode 100644 node_modules/smart-buffer/.travis.yml create mode 100644 node_modules/smart-buffer/LICENSE create mode 100644 node_modules/smart-buffer/README.md create mode 100644 node_modules/smart-buffer/build/smartbuffer.js create mode 100644 node_modules/smart-buffer/build/smartbuffer.js.map create mode 100644 node_modules/smart-buffer/build/utils.js create mode 100644 node_modules/smart-buffer/build/utils.js.map create mode 100644 node_modules/smart-buffer/docs/CHANGELOG.md create mode 100644 node_modules/smart-buffer/docs/README_v3.md create mode 100644 node_modules/smart-buffer/docs/ROADMAP.md create mode 100644 node_modules/smart-buffer/package.json create mode 100644 node_modules/smart-buffer/typings/smartbuffer.d.ts create mode 100644 node_modules/smart-buffer/typings/utils.d.ts create mode 100644 node_modules/socks-proxy-agent/LICENSE create mode 100644 node_modules/socks-proxy-agent/README.md create mode 100644 node_modules/socks-proxy-agent/dist/index.d.ts create mode 100644 node_modules/socks-proxy-agent/dist/index.d.ts.map create mode 100644 node_modules/socks-proxy-agent/dist/index.js create mode 100644 node_modules/socks-proxy-agent/dist/index.js.map create mode 100644 node_modules/socks-proxy-agent/package.json create mode 100644 node_modules/socks/.eslintrc.cjs create mode 100644 node_modules/socks/.prettierrc.yaml create mode 100644 node_modules/socks/LICENSE create mode 100644 node_modules/socks/README.md create mode 100644 node_modules/socks/build/client/socksclient.js create mode 100644 node_modules/socks/build/client/socksclient.js.map create mode 100644 node_modules/socks/build/common/constants.js create mode 100644 node_modules/socks/build/common/constants.js.map create mode 100644 node_modules/socks/build/common/helpers.js create mode 100644 node_modules/socks/build/common/helpers.js.map create mode 100644 node_modules/socks/build/common/receivebuffer.js create mode 100644 node_modules/socks/build/common/receivebuffer.js.map create mode 100644 node_modules/socks/build/common/util.js create mode 100644 node_modules/socks/build/common/util.js.map create mode 100644 node_modules/socks/build/index.js create mode 100644 node_modules/socks/build/index.js.map create mode 100644 node_modules/socks/docs/examples/index.md create mode 100644 node_modules/socks/docs/examples/javascript/associateExample.md create mode 100644 node_modules/socks/docs/examples/javascript/bindExample.md create mode 100644 node_modules/socks/docs/examples/javascript/connectExample.md create mode 100644 node_modules/socks/docs/examples/typescript/associateExample.md create mode 100644 node_modules/socks/docs/examples/typescript/bindExample.md create mode 100644 node_modules/socks/docs/examples/typescript/connectExample.md create mode 100644 node_modules/socks/docs/index.md create mode 100644 node_modules/socks/docs/migratingFromV1.md create mode 100644 node_modules/socks/package.json create mode 100644 node_modules/socks/typings/client/socksclient.d.ts create mode 100644 node_modules/socks/typings/common/constants.d.ts create mode 100644 node_modules/socks/typings/common/helpers.d.ts create mode 100644 node_modules/socks/typings/common/receivebuffer.d.ts create mode 100644 node_modules/socks/typings/common/util.d.ts create mode 100644 node_modules/socks/typings/index.d.ts create mode 100644 node_modules/ssri/LICENSE.md create mode 100644 node_modules/ssri/README.md create mode 100644 node_modules/ssri/lib/index.js create mode 100644 node_modules/ssri/package.json create mode 100644 node_modules/stdin-discarder/index.d.ts create mode 100644 node_modules/stdin-discarder/index.js create mode 100644 node_modules/stdin-discarder/license create mode 100644 node_modules/stdin-discarder/package.json create mode 100644 node_modules/stdin-discarder/readme.md create mode 100644 node_modules/string-width-cjs/index.d.ts create mode 100644 node_modules/string-width-cjs/index.js create mode 100644 node_modules/string-width-cjs/license create mode 100644 node_modules/string-width-cjs/node_modules/ansi-regex/index.d.ts create mode 100644 node_modules/string-width-cjs/node_modules/ansi-regex/index.js create mode 100644 node_modules/string-width-cjs/node_modules/ansi-regex/license create mode 100644 node_modules/string-width-cjs/node_modules/ansi-regex/package.json create mode 100644 node_modules/string-width-cjs/node_modules/ansi-regex/readme.md create mode 100644 node_modules/string-width-cjs/node_modules/emoji-regex/LICENSE-MIT.txt create mode 100644 node_modules/string-width-cjs/node_modules/emoji-regex/README.md create mode 100644 node_modules/string-width-cjs/node_modules/emoji-regex/es2015/index.js create mode 100644 node_modules/string-width-cjs/node_modules/emoji-regex/es2015/text.js create mode 100644 node_modules/string-width-cjs/node_modules/emoji-regex/index.d.ts create mode 100644 node_modules/string-width-cjs/node_modules/emoji-regex/index.js create mode 100644 node_modules/string-width-cjs/node_modules/emoji-regex/package.json create mode 100644 node_modules/string-width-cjs/node_modules/emoji-regex/text.js create mode 100644 node_modules/string-width-cjs/node_modules/strip-ansi/index.d.ts create mode 100644 node_modules/string-width-cjs/node_modules/strip-ansi/index.js create mode 100644 node_modules/string-width-cjs/node_modules/strip-ansi/license create mode 100644 node_modules/string-width-cjs/node_modules/strip-ansi/package.json create mode 100644 node_modules/string-width-cjs/node_modules/strip-ansi/readme.md create mode 100644 node_modules/string-width-cjs/package.json create mode 100644 node_modules/string-width-cjs/readme.md create mode 100644 node_modules/string-width/index.d.ts create mode 100644 node_modules/string-width/index.js create mode 100644 node_modules/string-width/license create mode 100644 node_modules/string-width/package.json create mode 100644 node_modules/string-width/readme.md create mode 100644 node_modules/strip-ansi-cjs/index.d.ts create mode 100644 node_modules/strip-ansi-cjs/index.js create mode 100644 node_modules/strip-ansi-cjs/license create mode 100644 node_modules/strip-ansi-cjs/node_modules/ansi-regex/index.d.ts create mode 100644 node_modules/strip-ansi-cjs/node_modules/ansi-regex/index.js create mode 100644 node_modules/strip-ansi-cjs/node_modules/ansi-regex/license create mode 100644 node_modules/strip-ansi-cjs/node_modules/ansi-regex/package.json create mode 100644 node_modules/strip-ansi-cjs/node_modules/ansi-regex/readme.md create mode 100644 node_modules/strip-ansi-cjs/package.json create mode 100644 node_modules/strip-ansi-cjs/readme.md create mode 100644 node_modules/strip-ansi/index.d.ts create mode 100644 node_modules/strip-ansi/index.js create mode 100644 node_modules/strip-ansi/license create mode 100644 node_modules/strip-ansi/package.json create mode 100644 node_modules/strip-ansi/readme.md create mode 100644 node_modules/tar/LICENSE.md create mode 100644 node_modules/tar/README.md create mode 100644 node_modules/tar/dist/commonjs/create.d.ts create mode 100644 node_modules/tar/dist/commonjs/create.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/create.js create mode 100644 node_modules/tar/dist/commonjs/create.js.map create mode 100644 node_modules/tar/dist/commonjs/cwd-error.d.ts create mode 100644 node_modules/tar/dist/commonjs/cwd-error.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/cwd-error.js create mode 100644 node_modules/tar/dist/commonjs/cwd-error.js.map create mode 100644 node_modules/tar/dist/commonjs/extract.d.ts create mode 100644 node_modules/tar/dist/commonjs/extract.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/extract.js create mode 100644 node_modules/tar/dist/commonjs/extract.js.map create mode 100644 node_modules/tar/dist/commonjs/get-write-flag.d.ts create mode 100644 node_modules/tar/dist/commonjs/get-write-flag.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/get-write-flag.js create mode 100644 node_modules/tar/dist/commonjs/get-write-flag.js.map create mode 100644 node_modules/tar/dist/commonjs/header.d.ts create mode 100644 node_modules/tar/dist/commonjs/header.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/header.js create mode 100644 node_modules/tar/dist/commonjs/header.js.map create mode 100644 node_modules/tar/dist/commonjs/index.d.ts create mode 100644 node_modules/tar/dist/commonjs/index.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/index.js create mode 100644 node_modules/tar/dist/commonjs/index.js.map create mode 100644 node_modules/tar/dist/commonjs/large-numbers.d.ts create mode 100644 node_modules/tar/dist/commonjs/large-numbers.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/large-numbers.js create mode 100644 node_modules/tar/dist/commonjs/large-numbers.js.map create mode 100644 node_modules/tar/dist/commonjs/list.d.ts create mode 100644 node_modules/tar/dist/commonjs/list.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/list.js create mode 100644 node_modules/tar/dist/commonjs/list.js.map create mode 100644 node_modules/tar/dist/commonjs/make-command.d.ts create mode 100644 node_modules/tar/dist/commonjs/make-command.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/make-command.js create mode 100644 node_modules/tar/dist/commonjs/make-command.js.map create mode 100644 node_modules/tar/dist/commonjs/mkdir.d.ts create mode 100644 node_modules/tar/dist/commonjs/mkdir.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/mkdir.js create mode 100644 node_modules/tar/dist/commonjs/mkdir.js.map create mode 100644 node_modules/tar/dist/commonjs/mode-fix.d.ts create mode 100644 node_modules/tar/dist/commonjs/mode-fix.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/mode-fix.js create mode 100644 node_modules/tar/dist/commonjs/mode-fix.js.map create mode 100644 node_modules/tar/dist/commonjs/normalize-unicode.d.ts create mode 100644 node_modules/tar/dist/commonjs/normalize-unicode.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/normalize-unicode.js create mode 100644 node_modules/tar/dist/commonjs/normalize-unicode.js.map create mode 100644 node_modules/tar/dist/commonjs/normalize-windows-path.d.ts create mode 100644 node_modules/tar/dist/commonjs/normalize-windows-path.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/normalize-windows-path.js create mode 100644 node_modules/tar/dist/commonjs/normalize-windows-path.js.map create mode 100644 node_modules/tar/dist/commonjs/options.d.ts create mode 100644 node_modules/tar/dist/commonjs/options.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/options.js create mode 100644 node_modules/tar/dist/commonjs/options.js.map create mode 100644 node_modules/tar/dist/commonjs/pack.d.ts create mode 100644 node_modules/tar/dist/commonjs/pack.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/pack.js create mode 100644 node_modules/tar/dist/commonjs/pack.js.map create mode 100644 node_modules/tar/dist/commonjs/package.json create mode 100644 node_modules/tar/dist/commonjs/parse.d.ts create mode 100644 node_modules/tar/dist/commonjs/parse.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/parse.js create mode 100644 node_modules/tar/dist/commonjs/parse.js.map create mode 100644 node_modules/tar/dist/commonjs/path-reservations.d.ts create mode 100644 node_modules/tar/dist/commonjs/path-reservations.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/path-reservations.js create mode 100644 node_modules/tar/dist/commonjs/path-reservations.js.map create mode 100644 node_modules/tar/dist/commonjs/pax.d.ts create mode 100644 node_modules/tar/dist/commonjs/pax.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/pax.js create mode 100644 node_modules/tar/dist/commonjs/pax.js.map create mode 100644 node_modules/tar/dist/commonjs/read-entry.d.ts create mode 100644 node_modules/tar/dist/commonjs/read-entry.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/read-entry.js create mode 100644 node_modules/tar/dist/commonjs/read-entry.js.map create mode 100644 node_modules/tar/dist/commonjs/replace.d.ts create mode 100644 node_modules/tar/dist/commonjs/replace.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/replace.js create mode 100644 node_modules/tar/dist/commonjs/replace.js.map create mode 100644 node_modules/tar/dist/commonjs/strip-absolute-path.d.ts create mode 100644 node_modules/tar/dist/commonjs/strip-absolute-path.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/strip-absolute-path.js create mode 100644 node_modules/tar/dist/commonjs/strip-absolute-path.js.map create mode 100644 node_modules/tar/dist/commonjs/strip-trailing-slashes.d.ts create mode 100644 node_modules/tar/dist/commonjs/strip-trailing-slashes.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/strip-trailing-slashes.js create mode 100644 node_modules/tar/dist/commonjs/strip-trailing-slashes.js.map create mode 100644 node_modules/tar/dist/commonjs/symlink-error.d.ts create mode 100644 node_modules/tar/dist/commonjs/symlink-error.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/symlink-error.js create mode 100644 node_modules/tar/dist/commonjs/symlink-error.js.map create mode 100644 node_modules/tar/dist/commonjs/types.d.ts create mode 100644 node_modules/tar/dist/commonjs/types.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/types.js create mode 100644 node_modules/tar/dist/commonjs/types.js.map create mode 100644 node_modules/tar/dist/commonjs/unpack.d.ts create mode 100644 node_modules/tar/dist/commonjs/unpack.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/unpack.js create mode 100644 node_modules/tar/dist/commonjs/unpack.js.map create mode 100644 node_modules/tar/dist/commonjs/update.d.ts create mode 100644 node_modules/tar/dist/commonjs/update.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/update.js create mode 100644 node_modules/tar/dist/commonjs/update.js.map create mode 100644 node_modules/tar/dist/commonjs/warn-method.d.ts create mode 100644 node_modules/tar/dist/commonjs/warn-method.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/warn-method.js create mode 100644 node_modules/tar/dist/commonjs/warn-method.js.map create mode 100644 node_modules/tar/dist/commonjs/winchars.d.ts create mode 100644 node_modules/tar/dist/commonjs/winchars.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/winchars.js create mode 100644 node_modules/tar/dist/commonjs/winchars.js.map create mode 100644 node_modules/tar/dist/commonjs/write-entry.d.ts create mode 100644 node_modules/tar/dist/commonjs/write-entry.d.ts.map create mode 100644 node_modules/tar/dist/commonjs/write-entry.js create mode 100644 node_modules/tar/dist/commonjs/write-entry.js.map create mode 100644 node_modules/tar/dist/esm/create.d.ts create mode 100644 node_modules/tar/dist/esm/create.d.ts.map create mode 100644 node_modules/tar/dist/esm/create.js create mode 100644 node_modules/tar/dist/esm/create.js.map create mode 100644 node_modules/tar/dist/esm/cwd-error.d.ts create mode 100644 node_modules/tar/dist/esm/cwd-error.d.ts.map create mode 100644 node_modules/tar/dist/esm/cwd-error.js create mode 100644 node_modules/tar/dist/esm/cwd-error.js.map create mode 100644 node_modules/tar/dist/esm/extract.d.ts create mode 100644 node_modules/tar/dist/esm/extract.d.ts.map create mode 100644 node_modules/tar/dist/esm/extract.js create mode 100644 node_modules/tar/dist/esm/extract.js.map create mode 100644 node_modules/tar/dist/esm/get-write-flag.d.ts create mode 100644 node_modules/tar/dist/esm/get-write-flag.d.ts.map create mode 100644 node_modules/tar/dist/esm/get-write-flag.js create mode 100644 node_modules/tar/dist/esm/get-write-flag.js.map create mode 100644 node_modules/tar/dist/esm/header.d.ts create mode 100644 node_modules/tar/dist/esm/header.d.ts.map create mode 100644 node_modules/tar/dist/esm/header.js create mode 100644 node_modules/tar/dist/esm/header.js.map create mode 100644 node_modules/tar/dist/esm/index.d.ts create mode 100644 node_modules/tar/dist/esm/index.d.ts.map create mode 100644 node_modules/tar/dist/esm/index.js create mode 100644 node_modules/tar/dist/esm/index.js.map create mode 100644 node_modules/tar/dist/esm/large-numbers.d.ts create mode 100644 node_modules/tar/dist/esm/large-numbers.d.ts.map create mode 100644 node_modules/tar/dist/esm/large-numbers.js create mode 100644 node_modules/tar/dist/esm/large-numbers.js.map create mode 100644 node_modules/tar/dist/esm/list.d.ts create mode 100644 node_modules/tar/dist/esm/list.d.ts.map create mode 100644 node_modules/tar/dist/esm/list.js create mode 100644 node_modules/tar/dist/esm/list.js.map create mode 100644 node_modules/tar/dist/esm/make-command.d.ts create mode 100644 node_modules/tar/dist/esm/make-command.d.ts.map create mode 100644 node_modules/tar/dist/esm/make-command.js create mode 100644 node_modules/tar/dist/esm/make-command.js.map create mode 100644 node_modules/tar/dist/esm/mkdir.d.ts create mode 100644 node_modules/tar/dist/esm/mkdir.d.ts.map create mode 100644 node_modules/tar/dist/esm/mkdir.js create mode 100644 node_modules/tar/dist/esm/mkdir.js.map create mode 100644 node_modules/tar/dist/esm/mode-fix.d.ts create mode 100644 node_modules/tar/dist/esm/mode-fix.d.ts.map create mode 100644 node_modules/tar/dist/esm/mode-fix.js create mode 100644 node_modules/tar/dist/esm/mode-fix.js.map create mode 100644 node_modules/tar/dist/esm/normalize-unicode.d.ts create mode 100644 node_modules/tar/dist/esm/normalize-unicode.d.ts.map create mode 100644 node_modules/tar/dist/esm/normalize-unicode.js create mode 100644 node_modules/tar/dist/esm/normalize-unicode.js.map create mode 100644 node_modules/tar/dist/esm/normalize-windows-path.d.ts create mode 100644 node_modules/tar/dist/esm/normalize-windows-path.d.ts.map create mode 100644 node_modules/tar/dist/esm/normalize-windows-path.js create mode 100644 node_modules/tar/dist/esm/normalize-windows-path.js.map create mode 100644 node_modules/tar/dist/esm/options.d.ts create mode 100644 node_modules/tar/dist/esm/options.d.ts.map create mode 100644 node_modules/tar/dist/esm/options.js create mode 100644 node_modules/tar/dist/esm/options.js.map create mode 100644 node_modules/tar/dist/esm/pack.d.ts create mode 100644 node_modules/tar/dist/esm/pack.d.ts.map create mode 100644 node_modules/tar/dist/esm/pack.js create mode 100644 node_modules/tar/dist/esm/pack.js.map create mode 100644 node_modules/tar/dist/esm/package.json create mode 100644 node_modules/tar/dist/esm/parse.d.ts create mode 100644 node_modules/tar/dist/esm/parse.d.ts.map create mode 100644 node_modules/tar/dist/esm/parse.js create mode 100644 node_modules/tar/dist/esm/parse.js.map create mode 100644 node_modules/tar/dist/esm/path-reservations.d.ts create mode 100644 node_modules/tar/dist/esm/path-reservations.d.ts.map create mode 100644 node_modules/tar/dist/esm/path-reservations.js create mode 100644 node_modules/tar/dist/esm/path-reservations.js.map create mode 100644 node_modules/tar/dist/esm/pax.d.ts create mode 100644 node_modules/tar/dist/esm/pax.d.ts.map create mode 100644 node_modules/tar/dist/esm/pax.js create mode 100644 node_modules/tar/dist/esm/pax.js.map create mode 100644 node_modules/tar/dist/esm/read-entry.d.ts create mode 100644 node_modules/tar/dist/esm/read-entry.d.ts.map create mode 100644 node_modules/tar/dist/esm/read-entry.js create mode 100644 node_modules/tar/dist/esm/read-entry.js.map create mode 100644 node_modules/tar/dist/esm/replace.d.ts create mode 100644 node_modules/tar/dist/esm/replace.d.ts.map create mode 100644 node_modules/tar/dist/esm/replace.js create mode 100644 node_modules/tar/dist/esm/replace.js.map create mode 100644 node_modules/tar/dist/esm/strip-absolute-path.d.ts create mode 100644 node_modules/tar/dist/esm/strip-absolute-path.d.ts.map create mode 100644 node_modules/tar/dist/esm/strip-absolute-path.js create mode 100644 node_modules/tar/dist/esm/strip-absolute-path.js.map create mode 100644 node_modules/tar/dist/esm/strip-trailing-slashes.d.ts create mode 100644 node_modules/tar/dist/esm/strip-trailing-slashes.d.ts.map create mode 100644 node_modules/tar/dist/esm/strip-trailing-slashes.js create mode 100644 node_modules/tar/dist/esm/strip-trailing-slashes.js.map create mode 100644 node_modules/tar/dist/esm/symlink-error.d.ts create mode 100644 node_modules/tar/dist/esm/symlink-error.d.ts.map create mode 100644 node_modules/tar/dist/esm/symlink-error.js create mode 100644 node_modules/tar/dist/esm/symlink-error.js.map create mode 100644 node_modules/tar/dist/esm/types.d.ts create mode 100644 node_modules/tar/dist/esm/types.d.ts.map create mode 100644 node_modules/tar/dist/esm/types.js create mode 100644 node_modules/tar/dist/esm/types.js.map create mode 100644 node_modules/tar/dist/esm/unpack.d.ts create mode 100644 node_modules/tar/dist/esm/unpack.d.ts.map create mode 100644 node_modules/tar/dist/esm/unpack.js create mode 100644 node_modules/tar/dist/esm/unpack.js.map create mode 100644 node_modules/tar/dist/esm/update.d.ts create mode 100644 node_modules/tar/dist/esm/update.d.ts.map create mode 100644 node_modules/tar/dist/esm/update.js create mode 100644 node_modules/tar/dist/esm/update.js.map create mode 100644 node_modules/tar/dist/esm/warn-method.d.ts create mode 100644 node_modules/tar/dist/esm/warn-method.d.ts.map create mode 100644 node_modules/tar/dist/esm/warn-method.js create mode 100644 node_modules/tar/dist/esm/warn-method.js.map create mode 100644 node_modules/tar/dist/esm/winchars.d.ts create mode 100644 node_modules/tar/dist/esm/winchars.d.ts.map create mode 100644 node_modules/tar/dist/esm/winchars.js create mode 100644 node_modules/tar/dist/esm/winchars.js.map create mode 100644 node_modules/tar/dist/esm/write-entry.d.ts create mode 100644 node_modules/tar/dist/esm/write-entry.d.ts.map create mode 100644 node_modules/tar/dist/esm/write-entry.js create mode 100644 node_modules/tar/dist/esm/write-entry.js.map create mode 100644 node_modules/tar/package.json create mode 100644 node_modules/unique-filename/LICENSE create mode 100644 node_modules/unique-filename/README.md create mode 100644 node_modules/unique-filename/lib/index.js create mode 100644 node_modules/unique-filename/package.json create mode 100644 node_modules/unique-slug/LICENSE create mode 100644 node_modules/unique-slug/README.md create mode 100644 node_modules/unique-slug/lib/index.js create mode 100644 node_modules/unique-slug/package.json create mode 100644 node_modules/validate-npm-package-name/LICENSE create mode 100644 node_modules/validate-npm-package-name/README.md create mode 100644 node_modules/validate-npm-package-name/lib/index.js create mode 100644 node_modules/validate-npm-package-name/package.json create mode 100644 node_modules/which/CHANGELOG.md create mode 100644 node_modules/which/LICENSE create mode 100644 node_modules/which/README.md create mode 100644 node_modules/which/bin/node-which create mode 100644 node_modules/which/package.json create mode 100644 node_modules/which/which.js create mode 100644 node_modules/wrap-ansi-cjs/index.js create mode 100644 node_modules/wrap-ansi-cjs/license create mode 100644 node_modules/wrap-ansi-cjs/node_modules/ansi-regex/index.d.ts create mode 100644 node_modules/wrap-ansi-cjs/node_modules/ansi-regex/index.js create mode 100644 node_modules/wrap-ansi-cjs/node_modules/ansi-regex/license create mode 100644 node_modules/wrap-ansi-cjs/node_modules/ansi-regex/package.json create mode 100644 node_modules/wrap-ansi-cjs/node_modules/ansi-regex/readme.md create mode 100644 node_modules/wrap-ansi-cjs/node_modules/ansi-styles/index.d.ts create mode 100644 node_modules/wrap-ansi-cjs/node_modules/ansi-styles/index.js create mode 100644 node_modules/wrap-ansi-cjs/node_modules/ansi-styles/license create mode 100644 node_modules/wrap-ansi-cjs/node_modules/ansi-styles/package.json create mode 100644 node_modules/wrap-ansi-cjs/node_modules/ansi-styles/readme.md create mode 100644 node_modules/wrap-ansi-cjs/node_modules/emoji-regex/LICENSE-MIT.txt create mode 100644 node_modules/wrap-ansi-cjs/node_modules/emoji-regex/README.md create mode 100644 node_modules/wrap-ansi-cjs/node_modules/emoji-regex/es2015/index.js create mode 100644 node_modules/wrap-ansi-cjs/node_modules/emoji-regex/es2015/text.js create mode 100644 node_modules/wrap-ansi-cjs/node_modules/emoji-regex/index.d.ts create mode 100644 node_modules/wrap-ansi-cjs/node_modules/emoji-regex/index.js create mode 100644 node_modules/wrap-ansi-cjs/node_modules/emoji-regex/package.json create mode 100644 node_modules/wrap-ansi-cjs/node_modules/emoji-regex/text.js create mode 100644 node_modules/wrap-ansi-cjs/node_modules/string-width/index.d.ts create mode 100644 node_modules/wrap-ansi-cjs/node_modules/string-width/index.js create mode 100644 node_modules/wrap-ansi-cjs/node_modules/string-width/license create mode 100644 node_modules/wrap-ansi-cjs/node_modules/string-width/package.json create mode 100644 node_modules/wrap-ansi-cjs/node_modules/string-width/readme.md create mode 100644 node_modules/wrap-ansi-cjs/node_modules/strip-ansi/index.d.ts create mode 100644 node_modules/wrap-ansi-cjs/node_modules/strip-ansi/index.js create mode 100644 node_modules/wrap-ansi-cjs/node_modules/strip-ansi/license create mode 100644 node_modules/wrap-ansi-cjs/node_modules/strip-ansi/package.json create mode 100644 node_modules/wrap-ansi-cjs/node_modules/strip-ansi/readme.md create mode 100644 node_modules/wrap-ansi-cjs/package.json create mode 100644 node_modules/wrap-ansi-cjs/readme.md create mode 100644 node_modules/wrap-ansi/index.d.ts create mode 100644 node_modules/wrap-ansi/index.js create mode 100644 node_modules/wrap-ansi/license create mode 100644 node_modules/wrap-ansi/package.json create mode 100644 node_modules/wrap-ansi/readme.md create mode 100644 node_modules/yallist/LICENSE.md create mode 100644 node_modules/yallist/README.md create mode 100644 node_modules/yallist/dist/commonjs/index.d.ts create mode 100644 node_modules/yallist/dist/commonjs/index.d.ts.map create mode 100644 node_modules/yallist/dist/commonjs/index.js create mode 100644 node_modules/yallist/dist/commonjs/index.js.map create mode 100644 node_modules/yallist/dist/commonjs/package.json create mode 100644 node_modules/yallist/dist/esm/index.d.ts create mode 100644 node_modules/yallist/dist/esm/index.d.ts.map create mode 100644 node_modules/yallist/dist/esm/index.js create mode 100644 node_modules/yallist/dist/esm/index.js.map create mode 100644 node_modules/yallist/dist/esm/package.json create mode 100644 node_modules/yallist/package.json rename package-lock.json => test/package-lock.json (100%) rename package.json => test/package.json (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 873898b..a7eea41 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,11 @@ jobs: runs-on: ubuntu-latest + defaults: + run: + shell: bash + working-directory: ./test + strategy: matrix: node-version: [18.x, 20.x, 22.x] @@ -20,6 +25,7 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'npm' + cache-dependency-path: './test' - run: npm ci - run: npm run build --if-present - name: Test Safe Chains diff --git a/node_modules/.bin/aikido-bun b/node_modules/.bin/aikido-bun new file mode 100644 index 0000000..b9cfefd --- /dev/null +++ b/node_modules/.bin/aikido-bun @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../@aikidosec/safe-chain/bin/aikido-bun.js" "$@" +else + exec node "$basedir/../@aikidosec/safe-chain/bin/aikido-bun.js" "$@" +fi diff --git a/node_modules/.bin/aikido-bun.cmd b/node_modules/.bin/aikido-bun.cmd new file mode 100644 index 0000000..d86c100 --- /dev/null +++ b/node_modules/.bin/aikido-bun.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\@aikidosec\safe-chain\bin\aikido-bun.js" %* diff --git a/node_modules/.bin/aikido-bun.ps1 b/node_modules/.bin/aikido-bun.ps1 new file mode 100644 index 0000000..b7c4f24 --- /dev/null +++ b/node_modules/.bin/aikido-bun.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-bun.js" $args + } else { + & "$basedir/node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-bun.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-bun.js" $args + } else { + & "node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-bun.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/aikido-bunx b/node_modules/.bin/aikido-bunx new file mode 100644 index 0000000..eeb1212 --- /dev/null +++ b/node_modules/.bin/aikido-bunx @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../@aikidosec/safe-chain/bin/aikido-bunx.js" "$@" +else + exec node "$basedir/../@aikidosec/safe-chain/bin/aikido-bunx.js" "$@" +fi diff --git a/node_modules/.bin/aikido-bunx.cmd b/node_modules/.bin/aikido-bunx.cmd new file mode 100644 index 0000000..7b1f9ca --- /dev/null +++ b/node_modules/.bin/aikido-bunx.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\@aikidosec\safe-chain\bin\aikido-bunx.js" %* diff --git a/node_modules/.bin/aikido-bunx.ps1 b/node_modules/.bin/aikido-bunx.ps1 new file mode 100644 index 0000000..376d8cc --- /dev/null +++ b/node_modules/.bin/aikido-bunx.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-bunx.js" $args + } else { + & "$basedir/node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-bunx.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-bunx.js" $args + } else { + & "node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-bunx.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/aikido-npm b/node_modules/.bin/aikido-npm new file mode 100644 index 0000000..7b71283 --- /dev/null +++ b/node_modules/.bin/aikido-npm @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../@aikidosec/safe-chain/bin/aikido-npm.js" "$@" +else + exec node "$basedir/../@aikidosec/safe-chain/bin/aikido-npm.js" "$@" +fi diff --git a/node_modules/.bin/aikido-npm.cmd b/node_modules/.bin/aikido-npm.cmd new file mode 100644 index 0000000..d5675f7 --- /dev/null +++ b/node_modules/.bin/aikido-npm.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\@aikidosec\safe-chain\bin\aikido-npm.js" %* diff --git a/node_modules/.bin/aikido-npm.ps1 b/node_modules/.bin/aikido-npm.ps1 new file mode 100644 index 0000000..600eb85 --- /dev/null +++ b/node_modules/.bin/aikido-npm.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-npm.js" $args + } else { + & "$basedir/node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-npm.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-npm.js" $args + } else { + & "node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-npm.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/aikido-npx b/node_modules/.bin/aikido-npx new file mode 100644 index 0000000..c774fd6 --- /dev/null +++ b/node_modules/.bin/aikido-npx @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../@aikidosec/safe-chain/bin/aikido-npx.js" "$@" +else + exec node "$basedir/../@aikidosec/safe-chain/bin/aikido-npx.js" "$@" +fi diff --git a/node_modules/.bin/aikido-npx.cmd b/node_modules/.bin/aikido-npx.cmd new file mode 100644 index 0000000..d269f93 --- /dev/null +++ b/node_modules/.bin/aikido-npx.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\@aikidosec\safe-chain\bin\aikido-npx.js" %* diff --git a/node_modules/.bin/aikido-npx.ps1 b/node_modules/.bin/aikido-npx.ps1 new file mode 100644 index 0000000..5cf1d75 --- /dev/null +++ b/node_modules/.bin/aikido-npx.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-npx.js" $args + } else { + & "$basedir/node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-npx.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-npx.js" $args + } else { + & "node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-npx.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/aikido-pnpm b/node_modules/.bin/aikido-pnpm new file mode 100644 index 0000000..fc0ddd5 --- /dev/null +++ b/node_modules/.bin/aikido-pnpm @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../@aikidosec/safe-chain/bin/aikido-pnpm.js" "$@" +else + exec node "$basedir/../@aikidosec/safe-chain/bin/aikido-pnpm.js" "$@" +fi diff --git a/node_modules/.bin/aikido-pnpm.cmd b/node_modules/.bin/aikido-pnpm.cmd new file mode 100644 index 0000000..3e567c3 --- /dev/null +++ b/node_modules/.bin/aikido-pnpm.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\@aikidosec\safe-chain\bin\aikido-pnpm.js" %* diff --git a/node_modules/.bin/aikido-pnpm.ps1 b/node_modules/.bin/aikido-pnpm.ps1 new file mode 100644 index 0000000..f258fb4 --- /dev/null +++ b/node_modules/.bin/aikido-pnpm.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-pnpm.js" $args + } else { + & "$basedir/node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-pnpm.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-pnpm.js" $args + } else { + & "node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-pnpm.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/aikido-pnpx b/node_modules/.bin/aikido-pnpx new file mode 100644 index 0000000..d7deb67 --- /dev/null +++ b/node_modules/.bin/aikido-pnpx @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../@aikidosec/safe-chain/bin/aikido-pnpx.js" "$@" +else + exec node "$basedir/../@aikidosec/safe-chain/bin/aikido-pnpx.js" "$@" +fi diff --git a/node_modules/.bin/aikido-pnpx.cmd b/node_modules/.bin/aikido-pnpx.cmd new file mode 100644 index 0000000..8d949e0 --- /dev/null +++ b/node_modules/.bin/aikido-pnpx.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\@aikidosec\safe-chain\bin\aikido-pnpx.js" %* diff --git a/node_modules/.bin/aikido-pnpx.ps1 b/node_modules/.bin/aikido-pnpx.ps1 new file mode 100644 index 0000000..02fc0af --- /dev/null +++ b/node_modules/.bin/aikido-pnpx.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-pnpx.js" $args + } else { + & "$basedir/node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-pnpx.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-pnpx.js" $args + } else { + & "node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-pnpx.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/aikido-yarn b/node_modules/.bin/aikido-yarn new file mode 100644 index 0000000..1f85b8e --- /dev/null +++ b/node_modules/.bin/aikido-yarn @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../@aikidosec/safe-chain/bin/aikido-yarn.js" "$@" +else + exec node "$basedir/../@aikidosec/safe-chain/bin/aikido-yarn.js" "$@" +fi diff --git a/node_modules/.bin/aikido-yarn.cmd b/node_modules/.bin/aikido-yarn.cmd new file mode 100644 index 0000000..73873cd --- /dev/null +++ b/node_modules/.bin/aikido-yarn.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\@aikidosec\safe-chain\bin\aikido-yarn.js" %* diff --git a/node_modules/.bin/aikido-yarn.ps1 b/node_modules/.bin/aikido-yarn.ps1 new file mode 100644 index 0000000..b293bbf --- /dev/null +++ b/node_modules/.bin/aikido-yarn.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-yarn.js" $args + } else { + & "$basedir/node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-yarn.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-yarn.js" $args + } else { + & "node$exe" "$basedir/../@aikidosec/safe-chain/bin/aikido-yarn.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/glob b/node_modules/.bin/glob new file mode 100644 index 0000000..6fbc4bb --- /dev/null +++ b/node_modules/.bin/glob @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../glob/dist/esm/bin.mjs" "$@" +else + exec node "$basedir/../glob/dist/esm/bin.mjs" "$@" +fi diff --git a/node_modules/.bin/glob.cmd b/node_modules/.bin/glob.cmd new file mode 100644 index 0000000..3c1d48a --- /dev/null +++ b/node_modules/.bin/glob.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\glob\dist\esm\bin.mjs" %* diff --git a/node_modules/.bin/glob.ps1 b/node_modules/.bin/glob.ps1 new file mode 100644 index 0000000..71ac2b2 --- /dev/null +++ b/node_modules/.bin/glob.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../glob/dist/esm/bin.mjs" $args + } else { + & "$basedir/node$exe" "$basedir/../glob/dist/esm/bin.mjs" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../glob/dist/esm/bin.mjs" $args + } else { + & "node$exe" "$basedir/../glob/dist/esm/bin.mjs" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/node-which b/node_modules/.bin/node-which new file mode 100644 index 0000000..b49b03f --- /dev/null +++ b/node_modules/.bin/node-which @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../which/bin/node-which" "$@" +else + exec node "$basedir/../which/bin/node-which" "$@" +fi diff --git a/node_modules/.bin/node-which.cmd b/node_modules/.bin/node-which.cmd new file mode 100644 index 0000000..8738aed --- /dev/null +++ b/node_modules/.bin/node-which.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\which\bin\node-which" %* diff --git a/node_modules/.bin/node-which.ps1 b/node_modules/.bin/node-which.ps1 new file mode 100644 index 0000000..cfb09e8 --- /dev/null +++ b/node_modules/.bin/node-which.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../which/bin/node-which" $args + } else { + & "$basedir/node$exe" "$basedir/../which/bin/node-which" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../which/bin/node-which" $args + } else { + & "node$exe" "$basedir/../which/bin/node-which" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/safe-chain b/node_modules/.bin/safe-chain new file mode 100644 index 0000000..15eb861 --- /dev/null +++ b/node_modules/.bin/safe-chain @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../@aikidosec/safe-chain/bin/safe-chain.js" "$@" +else + exec node "$basedir/../@aikidosec/safe-chain/bin/safe-chain.js" "$@" +fi diff --git a/node_modules/.bin/safe-chain.cmd b/node_modules/.bin/safe-chain.cmd new file mode 100644 index 0000000..1d747c2 --- /dev/null +++ b/node_modules/.bin/safe-chain.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\@aikidosec\safe-chain\bin\safe-chain.js" %* diff --git a/node_modules/.bin/safe-chain.ps1 b/node_modules/.bin/safe-chain.ps1 new file mode 100644 index 0000000..880aa72 --- /dev/null +++ b/node_modules/.bin/safe-chain.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../@aikidosec/safe-chain/bin/safe-chain.js" $args + } else { + & "$basedir/node$exe" "$basedir/../@aikidosec/safe-chain/bin/safe-chain.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../@aikidosec/safe-chain/bin/safe-chain.js" $args + } else { + & "node$exe" "$basedir/../@aikidosec/safe-chain/bin/safe-chain.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/semver b/node_modules/.bin/semver new file mode 100644 index 0000000..97c5327 --- /dev/null +++ b/node_modules/.bin/semver @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../semver/bin/semver.js" "$@" +else + exec node "$basedir/../semver/bin/semver.js" "$@" +fi diff --git a/node_modules/.bin/semver.cmd b/node_modules/.bin/semver.cmd new file mode 100644 index 0000000..9913fa9 --- /dev/null +++ b/node_modules/.bin/semver.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\semver\bin\semver.js" %* diff --git a/node_modules/.bin/semver.ps1 b/node_modules/.bin/semver.ps1 new file mode 100644 index 0000000..314717a --- /dev/null +++ b/node_modules/.bin/semver.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args + } else { + & "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../semver/bin/semver.js" $args + } else { + & "node$exe" "$basedir/../semver/bin/semver.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json new file mode 100644 index 0000000..7b98579 --- /dev/null +++ b/node_modules/.package-lock.json @@ -0,0 +1,1309 @@ +{ + "name": "action-setup-node", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/@aikidosec/safe-chain": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/@aikidosec/safe-chain/-/safe-chain-1.1.7.tgz", + "integrity": "sha512-U6cshGzFVM48XIgpqvnP3WnLWhgX5zCVt0aAxKx/5vzMnTfxtaZaPhXr7OCwstb25t5Q5uzTBci5shHbH+NZow==", + "license": "AGPL-3.0-or-later", + "dependencies": { + "chalk": "5.4.1", + "https-proxy-agent": "7.0.6", + "make-fetch-happen": "14.0.3", + "node-forge": "1.3.1", + "npm-registry-fetch": "18.0.2", + "ora": "8.2.0", + "semver": "7.7.2" + }, + "bin": { + "aikido-bun": "bin/aikido-bun.js", + "aikido-bunx": "bin/aikido-bunx.js", + "aikido-npm": "bin/aikido-npm.js", + "aikido-npx": "bin/aikido-npx.js", + "aikido-pnpm": "bin/aikido-pnpm.js", + "aikido-pnpx": "bin/aikido-pnpx.js", + "aikido-yarn": "bin/aikido-yarn.js", + "safe-chain": "bin/safe-chain.js" + } + }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@isaacs/fs-minipass": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz", + "integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==", + "license": "ISC", + "dependencies": { + "minipass": "^7.0.4" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@npmcli/agent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@npmcli/agent/-/agent-3.0.0.tgz", + "integrity": "sha512-S79NdEgDQd/NGCay6TCoVzXSj74skRZIKJcpJjC5lOq34SZzyI6MqtiiWoiVWoVrTcGjNeC4ipbh1VIHlpfF5Q==", + "license": "ISC", + "dependencies": { + "agent-base": "^7.1.0", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.1", + "lru-cache": "^10.0.1", + "socks-proxy-agent": "^8.0.3" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/@npmcli/fs": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-4.0.0.tgz", + "integrity": "sha512-/xGlezI6xfGO9NwuJlnwz/K14qD1kCSAGtacBHnGzeAIuJGazcp45KP5NuyARXoKb7cwulAGWVsbeSxdG/cb0Q==", + "license": "ISC", + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/@npmcli/redact": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@npmcli/redact/-/redact-3.2.2.tgz", + "integrity": "sha512-7VmYAmk4csGv08QzrDKScdzn11jHPFGyqJW39FyPgPuAp3zIaUmuCo1yxw9aGs+NEJuTGQ9Gwqpt93vtJubucg==", + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/ansi-regex": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", + "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "license": "MIT" + }, + "node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/cacache": { + "version": "19.0.1", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-19.0.1.tgz", + "integrity": "sha512-hdsUxulXCi5STId78vRVYEtDAjq99ICAUktLTeTYsLoTE6Z8dS0c8pWNCxwdrk9YfJeobDZc2Y186hD/5ZQgFQ==", + "license": "ISC", + "dependencies": { + "@npmcli/fs": "^4.0.0", + "fs-minipass": "^3.0.0", + "glob": "^10.2.2", + "lru-cache": "^10.0.1", + "minipass": "^7.0.3", + "minipass-collect": "^2.0.1", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "p-map": "^7.0.2", + "ssri": "^12.0.0", + "tar": "^7.4.3", + "unique-filename": "^4.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/chalk": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.4.1.tgz", + "integrity": "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==", + "license": "MIT", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chownr": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz", + "integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==", + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/cli-cursor": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-5.0.0.tgz", + "integrity": "sha512-aCj4O5wKyszjMmDT4tZj93kxyydN/K5zPWSCe6/0AV/AA1pqe5ZBIw0a2ZfPQV7lL5/yb5HsUreJ6UFAF1tEQw==", + "license": "MIT", + "dependencies": { + "restore-cursor": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-spinners": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", + "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", + "license": "MIT", + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "license": "MIT" + }, + "node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "license": "MIT" + }, + "node_modules/encoding": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", + "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", + "license": "MIT", + "optional": true, + "dependencies": { + "iconv-lite": "^0.6.2" + } + }, + "node_modules/err-code": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", + "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==", + "license": "MIT" + }, + "node_modules/foreground-child": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", + "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.6", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/fs-minipass": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-3.0.3.tgz", + "integrity": "sha512-XUBA9XClHbnJWSfBzjkm6RvPsyg3sryZt06BEQoXcF7EK/xpGaQYJgQKDJSUH5SGZ76Y7pFx1QBnXz09rU5Fbw==", + "license": "ISC", + "dependencies": { + "minipass": "^7.0.3" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/get-east-asian-width": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.4.0.tgz", + "integrity": "sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/glob": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", + "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/hosted-git-info": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-8.1.0.tgz", + "integrity": "sha512-Rw/B2DNQaPBICNXEm8balFz9a6WpZrkCGpcWFpy7nCj+NyhSdqXipmfvtmWt9xGfp0wZnBxB+iVpLmQMYt47Tw==", + "license": "ISC", + "dependencies": { + "lru-cache": "^10.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/http-cache-semantics": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.2.0.tgz", + "integrity": "sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ==", + "license": "BSD-2-Clause" + }, + "node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "license": "MIT", + "optional": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/ip-address": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.1.0.tgz", + "integrity": "sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q==", + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-interactive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-2.0.0.tgz", + "integrity": "sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-unicode-supported": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-2.1.0.tgz", + "integrity": "sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "license": "ISC" + }, + "node_modules/jackspeak": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==", + "engines": [ + "node >= 0.2.0" + ], + "license": "MIT" + }, + "node_modules/log-symbols": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-6.0.0.tgz", + "integrity": "sha512-i24m8rpwhmPIS4zscNzK6MSEhk0DUWa/8iYQWxhffV8jkI4Phvs3F+quL5xvS0gdQR0FyTCMMH33Y78dDTzzIw==", + "license": "MIT", + "dependencies": { + "chalk": "^5.3.0", + "is-unicode-supported": "^1.3.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-symbols/node_modules/is-unicode-supported": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz", + "integrity": "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "license": "ISC" + }, + "node_modules/make-fetch-happen": { + "version": "14.0.3", + "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-14.0.3.tgz", + "integrity": "sha512-QMjGbFTP0blj97EeidG5hk/QhKQ3T4ICckQGLgz38QF7Vgbk6e6FTARN8KhKxyBbWn8R0HU+bnw8aSoFPD4qtQ==", + "license": "ISC", + "dependencies": { + "@npmcli/agent": "^3.0.0", + "cacache": "^19.0.1", + "http-cache-semantics": "^4.1.1", + "minipass": "^7.0.2", + "minipass-fetch": "^4.0.0", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "negotiator": "^1.0.0", + "proc-log": "^5.0.0", + "promise-retry": "^2.0.1", + "ssri": "^12.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/mimic-function": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/mimic-function/-/mimic-function-5.0.1.tgz", + "integrity": "sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "license": "ISC", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/minipass-collect": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-2.0.1.tgz", + "integrity": "sha512-D7V8PO9oaz7PWGLbCACuI1qEOsq7UKfLotx/C0Aet43fCUB/wfQ7DYeq2oR/svFJGYDHPr38SHATeaj/ZoKHKw==", + "license": "ISC", + "dependencies": { + "minipass": "^7.0.3" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/minipass-fetch": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-4.0.1.tgz", + "integrity": "sha512-j7U11C5HXigVuutxebFadoYBbd7VSdZWggSe64NVdvWNBqGAiXPL2QVCehjmw7lY1oF9gOllYbORh+hiNgfPgQ==", + "license": "MIT", + "dependencies": { + "minipass": "^7.0.3", + "minipass-sized": "^1.0.3", + "minizlib": "^3.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "optionalDependencies": { + "encoding": "^0.1.13" + } + }, + "node_modules/minipass-flush": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz", + "integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==", + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/minipass-flush/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-flush/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "license": "ISC" + }, + "node_modules/minipass-pipeline": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz", + "integrity": "sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==", + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-pipeline/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-pipeline/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "license": "ISC" + }, + "node_modules/minipass-sized": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-1.0.3.tgz", + "integrity": "sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==", + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-sized/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-sized/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "license": "ISC" + }, + "node_modules/minizlib": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.1.0.tgz", + "integrity": "sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==", + "license": "MIT", + "dependencies": { + "minipass": "^7.1.2" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/node-forge": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", + "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==", + "license": "(BSD-3-Clause OR GPL-2.0)", + "engines": { + "node": ">= 6.13.0" + } + }, + "node_modules/npm-package-arg": { + "version": "12.0.2", + "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-12.0.2.tgz", + "integrity": "sha512-f1NpFjNI9O4VbKMOlA5QoBq/vSQPORHcTZ2feJpFkTHJ9eQkdlmZEKSjcAhxTGInC7RlEyScT9ui67NaOsjFWA==", + "license": "ISC", + "dependencies": { + "hosted-git-info": "^8.0.0", + "proc-log": "^5.0.0", + "semver": "^7.3.5", + "validate-npm-package-name": "^6.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm-registry-fetch": { + "version": "18.0.2", + "resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-18.0.2.tgz", + "integrity": "sha512-LeVMZBBVy+oQb5R6FDV9OlJCcWDU+al10oKpe+nsvcHnG24Z3uM3SvJYKfGJlfGjVU8v9liejCrUR/M5HO5NEQ==", + "license": "ISC", + "dependencies": { + "@npmcli/redact": "^3.0.0", + "jsonparse": "^1.3.1", + "make-fetch-happen": "^14.0.0", + "minipass": "^7.0.2", + "minipass-fetch": "^4.0.0", + "minizlib": "^3.0.1", + "npm-package-arg": "^12.0.0", + "proc-log": "^5.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/onetime": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-7.0.0.tgz", + "integrity": "sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==", + "license": "MIT", + "dependencies": { + "mimic-function": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/ora/-/ora-8.2.0.tgz", + "integrity": "sha512-weP+BZ8MVNnlCm8c0Qdc1WSWq4Qn7I+9CJGm7Qali6g44e/PUzbjNqJX5NJ9ljlNMosfJvg1fKEGILklK9cwnw==", + "license": "MIT", + "dependencies": { + "chalk": "^5.3.0", + "cli-cursor": "^5.0.0", + "cli-spinners": "^2.9.2", + "is-interactive": "^2.0.0", + "is-unicode-supported": "^2.0.0", + "log-symbols": "^6.0.0", + "stdin-discarder": "^0.2.2", + "string-width": "^7.2.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/emoji-regex": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz", + "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==", + "license": "MIT" + }, + "node_modules/ora/node_modules/string-width": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-map": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-7.0.4.tgz", + "integrity": "sha512-tkAQEw8ysMzmkhgw8k+1U/iPhWNhykKnSk4Rd5zLoPJCuJaGRPo6YposrZgaxHKzDHdDWWZvE/Sk7hsL2X/CpQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "license": "BlueOak-1.0.0" + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/proc-log": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-5.0.0.tgz", + "integrity": "sha512-Azwzvl90HaF0aCz1JrDdXQykFakSSNPaPoiZ9fm5qJIMHioDZEi7OAdRwSm6rSoPtY3Qutnm3L7ogmg3dc+wbQ==", + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/promise-retry": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz", + "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==", + "license": "MIT", + "dependencies": { + "err-code": "^2.0.2", + "retry": "^0.12.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/restore-cursor": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-5.1.0.tgz", + "integrity": "sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==", + "license": "MIT", + "dependencies": { + "onetime": "^7.0.0", + "signal-exit": "^4.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT", + "optional": true + }, + "node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "license": "MIT", + "engines": { + "node": ">= 6.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks": { + "version": "2.8.7", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.7.tgz", + "integrity": "sha512-HLpt+uLy/pxB+bum/9DzAgiKS8CX1EvbWxI4zlmgGCExImLdiad2iCwXT5Z4c9c3Eq8rP2318mPW2c+QbtjK8A==", + "license": "MIT", + "dependencies": { + "ip-address": "^10.0.1", + "smart-buffer": "^4.2.0" + }, + "engines": { + "node": ">= 10.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks-proxy-agent": { + "version": "8.0.5", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.5.tgz", + "integrity": "sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "^4.3.4", + "socks": "^2.8.3" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/ssri": { + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-12.0.0.tgz", + "integrity": "sha512-S7iGNosepx9RadX82oimUkvr0Ct7IjJbEbs4mJcTxst8um95J3sDYU1RBEOvdu6oL1Wek2ODI5i4MAw+dZ6cAQ==", + "license": "ISC", + "dependencies": { + "minipass": "^7.0.3" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/stdin-discarder": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/stdin-discarder/-/stdin-discarder-0.2.2.tgz", + "integrity": "sha512-UhDfHmA92YAlNnCfhmq0VeNL5bDbiZGg7sZ2IvPsXubGkiNa9EC+tUTsjBRsYUAz87btI6/1wf4XoVvQ3uRnmQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/string-width-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", + "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/tar": { + "version": "7.5.2", + "resolved": "https://registry.npmjs.org/tar/-/tar-7.5.2.tgz", + "integrity": "sha512-7NyxrTE4Anh8km8iEy7o0QYPs+0JKBTj5ZaqHg6B39erLg0qYXN3BijtShwbsNSvQ+LN75+KV+C4QR/f6Gwnpg==", + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/fs-minipass": "^4.0.0", + "chownr": "^3.0.0", + "minipass": "^7.1.2", + "minizlib": "^3.1.0", + "yallist": "^5.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/unique-filename": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-4.0.0.tgz", + "integrity": "sha512-XSnEewXmQ+veP7xX2dS5Q4yZAvO40cBN2MWkJ7D/6sW4Dg6wYBNwM1Vrnz1FhH5AdeLIlUXRI9e28z1YZi71NQ==", + "license": "ISC", + "dependencies": { + "unique-slug": "^5.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/unique-slug": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-5.0.0.tgz", + "integrity": "sha512-9OdaqO5kwqR+1kVgHAhsp5vPNU0hnxRa26rBFNfNgM7M6pNtgzeBn3s/xbyCQL3dcjzOatcef6UUHpB/6MaETg==", + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/validate-npm-package-name": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-6.0.2.tgz", + "integrity": "sha512-IUoow1YUtvoBBC06dXs8bR8B9vuA3aJfmQNKMoaPG/OFsPmoQvw8xh+6Ye25Gx9DQhoEom3Pcu9MKHerm/NpUQ==", + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/wrap-ansi-cjs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yallist": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz", + "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==", + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + } + } + } +} diff --git a/node_modules/@aikidosec/safe-chain/LICENSE b/node_modules/@aikidosec/safe-chain/LICENSE new file mode 100644 index 0000000..6b2b0ad --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/LICENSE @@ -0,0 +1,674 @@ +This program is offered under a commercial and under the AGPL license. +You can be released from the requirements of the AGPL license by purchasing +a commercial license. Buying such a license is mandatory as soon as you +develop commercial activities involving Zen by Aikido software without +disclosing the source code of your own applications. These activities include +but are not limited to: offering paid services to customers in a web application +or shipping Aikido with a closed source product. + +For more information, please contact Aikido Security at this +address: support@aikido.dev or create an account at https://app.aikido.dev. + +For AGPL licensing, see below. + +GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. \ No newline at end of file diff --git a/node_modules/@aikidosec/safe-chain/README.md b/node_modules/@aikidosec/safe-chain/README.md new file mode 100644 index 0000000..e385ec4 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/README.md @@ -0,0 +1,149 @@ +# Aikido Safe Chain + +The Aikido Safe Chain **prevents developers from installing malware** on their workstations through npm, npx, yarn, pnpm, pnpx, bun, and bunx. It's **free** to use and does not require any token. + +The Aikido Safe Chain wraps around the [npm cli](https://github.com/npm/cli), [npx](https://github.com/npm/cli/blob/latest/docs/content/commands/npx.md), [yarn](https://yarnpkg.com/), [pnpm](https://pnpm.io/), [pnpx](https://pnpm.io/cli/dlx), [bun](https://bun.sh/), and [bunx](https://bun.sh/docs/cli/bunx) to provide extra checks before installing new packages. This tool will detect when a package contains malware and prompt you to exit, preventing npm, npx, yarn, pnpm, pnpx, bun, or bunx from downloading or running the malware. + +![demo](./docs/safe-package-manager-demo.png) + +Aikido Safe Chain works on Node.js version 18 and above and supports the following package managers: + +- ✅ **npm** +- ✅ **npx** +- ✅ **yarn** +- ✅ **pnpm** +- ✅ **pnpx** +- ✅ **bun** +- ✅ **bunx** + +# Usage + +## Installation + +Installing the Aikido Safe Chain is easy. You just need 3 simple steps: + +1. **Install the Aikido Safe Chain package globally** using npm: + ```shell + npm install -g @aikidosec/safe-chain + ``` +2. **Setup the shell integration** by running: + ```shell + safe-chain setup + ``` +3. **❗Restart your terminal** to start using the Aikido Safe Chain. + - This step is crucial as it ensures that the shell aliases for npm, npx, yarn, pnpm, pnpx, bun, and bunx are loaded correctly. If you do not restart your terminal, the aliases will not be available. +4. **Verify the installation** by running: + ```shell + npm install safe-chain-test + ``` + - The output should show that Aikido Safe Chain is blocking the installation of this package as it is flagged as malware. + +When running `npm`, `npx`, `yarn`, `pnpm`, `pnpx`, `bun`, or `bunx` commands, the Aikido Safe Chain will automatically check for malware in the packages you are trying to install. If any malware is detected, it will prompt you to exit the command. + +You can check the installed version by running: + +```shell +safe-chain --version +``` + +## How it works + +The Aikido Safe Chain works by running a lightweight proxy server that intercepts package downloads from the npm registry. When you run npm, npx, yarn, pnpm, pnpx, bun, or bunx commands, all package downloads are routed through this local proxy, which verifies packages in real-time against **[Aikido Intel - Open Sources Threat Intelligence](https://intel.aikido.dev/?tab=malware)**. If malware is detected in any package (including deep dependencies), the proxy blocks the download before the malicious code reaches your machine. + +The Aikido Safe Chain integrates with your shell to provide a seamless experience when using npm, npx, yarn, pnpm, pnpx, bun, and bunx commands. It sets up aliases for these commands so that they are wrapped by the Aikido Safe Chain commands, which manage the proxy server before executing the original commands. We currently support: + +- ✅ **Bash** +- ✅ **Zsh** +- ✅ **Fish** +- ✅ **PowerShell** +- ✅ **PowerShell Core** + +More information about the shell integration can be found in the [shell integration documentation](docs/shell-integration.md). + +## Uninstallation + +To uninstall the Aikido Safe Chain, you can run the following command: + +1. **Remove all aliases from your shell** by running: + ```shell + safe-chain teardown + ``` +2. **Uninstall the Aikido Safe Chain package** using npm: + ```shell + npm uninstall -g @aikidosec/safe-chain + ``` +3. **❗Restart your terminal** to remove the aliases. + +# Configuration + +## Logging + +You can control the output from Aikido Safe Chain using the `--safe-chain-logging` flag: + +- `--safe-chain-logging=silent` - Suppresses all Aikido Safe Chain output except when malware is blocked. The package manager output is written to stdout as normal, and Safe Chain only writes a short message if it has blocked malware and causes the process to exit. + +Example usage: + +```shell +npm install express --safe-chain-logging=silent +``` + +# Usage in CI/CD + +You can protect your CI/CD pipelines from malicious packages by integrating Aikido Safe Chain into your build process. This ensures that any packages installed during your automated builds are checked for malware before installation. + +For optimal protection in CI/CD environments, we recommend using **npm >= 10.4.0** as it provides full dependency tree scanning. Other package managers currently offer limited scanning of install command arguments only. + +## Setup + +To use Aikido Safe Chain in CI/CD environments, run the following command after installing the package: + +```shell +safe-chain setup-ci +``` + +This automatically configures your CI environment to use Aikido Safe Chain for all package manager commands. + +## Supported Platforms + +- ✅ **GitHub Actions** +- ✅ **Azure Pipelines** + +## GitHub Actions Example + +```yaml +- name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "22" + cache: "npm" + +- name: Setup safe-chain + run: | + npm i -g @aikidosec/safe-chain + safe-chain setup-ci + +- name: Install dependencies + run: | + npm ci +``` + +## Azure DevOps Example + +```yaml +- task: NodeTool@0 + inputs: + versionSpec: "22.x" + displayName: "Install Node.js" + +- script: | + npm i -g @aikidosec/safe-chain + safe-chain setup-ci + displayName: "Install safe chain" + +- script: | + npm ci + displayName: "npm install and build" +``` + +After setup, all subsequent package manager commands in your CI pipeline will automatically be protected by Aikido Safe Chain's malware detection. diff --git a/node_modules/@aikidosec/safe-chain/bin/aikido-bun.js b/node_modules/@aikidosec/safe-chain/bin/aikido-bun.js new file mode 100644 index 0000000..01e3972 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/bin/aikido-bun.js @@ -0,0 +1,10 @@ +#!/usr/bin/env node + +import { main } from "../src/main.js"; +import { initializePackageManager } from "../src/packagemanager/currentPackageManager.js"; + +const packageManagerName = "bun"; +initializePackageManager(packageManagerName); +var exitCode = await main(process.argv.slice(2)); + +process.exit(exitCode); diff --git a/node_modules/@aikidosec/safe-chain/bin/aikido-bunx.js b/node_modules/@aikidosec/safe-chain/bin/aikido-bunx.js new file mode 100644 index 0000000..fb378e5 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/bin/aikido-bunx.js @@ -0,0 +1,10 @@ +#!/usr/bin/env node + +import { main } from "../src/main.js"; +import { initializePackageManager } from "../src/packagemanager/currentPackageManager.js"; + +const packageManagerName = "bunx"; +initializePackageManager(packageManagerName); +var exitCode = await main(process.argv.slice(2)); + +process.exit(exitCode); diff --git a/node_modules/@aikidosec/safe-chain/bin/aikido-npm.js b/node_modules/@aikidosec/safe-chain/bin/aikido-npm.js new file mode 100644 index 0000000..0e9f302 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/bin/aikido-npm.js @@ -0,0 +1,10 @@ +#!/usr/bin/env node + +import { main } from "../src/main.js"; +import { initializePackageManager } from "../src/packagemanager/currentPackageManager.js"; + +const packageManagerName = "npm"; +initializePackageManager(packageManagerName); +var exitCode = await main(process.argv.slice(2)); + +process.exit(exitCode); diff --git a/node_modules/@aikidosec/safe-chain/bin/aikido-npx.js b/node_modules/@aikidosec/safe-chain/bin/aikido-npx.js new file mode 100644 index 0000000..d3dfdd6 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/bin/aikido-npx.js @@ -0,0 +1,10 @@ +#!/usr/bin/env node + +import { main } from "../src/main.js"; +import { initializePackageManager } from "../src/packagemanager/currentPackageManager.js"; + +const packageManagerName = "npx"; +initializePackageManager(packageManagerName); +var exitCode = await main(process.argv.slice(2)); + +process.exit(exitCode); diff --git a/node_modules/@aikidosec/safe-chain/bin/aikido-pnpm.js b/node_modules/@aikidosec/safe-chain/bin/aikido-pnpm.js new file mode 100644 index 0000000..0a06217 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/bin/aikido-pnpm.js @@ -0,0 +1,10 @@ +#!/usr/bin/env node + +import { main } from "../src/main.js"; +import { initializePackageManager } from "../src/packagemanager/currentPackageManager.js"; + +const packageManagerName = "pnpm"; +initializePackageManager(packageManagerName); +var exitCode = await main(process.argv.slice(2)); + +process.exit(exitCode); diff --git a/node_modules/@aikidosec/safe-chain/bin/aikido-pnpx.js b/node_modules/@aikidosec/safe-chain/bin/aikido-pnpx.js new file mode 100644 index 0000000..cdb6504 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/bin/aikido-pnpx.js @@ -0,0 +1,10 @@ +#!/usr/bin/env node + +import { main } from "../src/main.js"; +import { initializePackageManager } from "../src/packagemanager/currentPackageManager.js"; + +const packageManagerName = "pnpx"; +initializePackageManager(packageManagerName); +var exitCode = await main(process.argv.slice(2)); + +process.exit(exitCode); diff --git a/node_modules/@aikidosec/safe-chain/bin/aikido-yarn.js b/node_modules/@aikidosec/safe-chain/bin/aikido-yarn.js new file mode 100644 index 0000000..fd87606 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/bin/aikido-yarn.js @@ -0,0 +1,10 @@ +#!/usr/bin/env node + +import { main } from "../src/main.js"; +import { initializePackageManager } from "../src/packagemanager/currentPackageManager.js"; + +const packageManagerName = "yarn"; +initializePackageManager(packageManagerName); +var exitCode = await main(process.argv.slice(2)); + +process.exit(exitCode); diff --git a/node_modules/@aikidosec/safe-chain/bin/safe-chain.js b/node_modules/@aikidosec/safe-chain/bin/safe-chain.js new file mode 100644 index 0000000..ad88c08 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/bin/safe-chain.js @@ -0,0 +1,81 @@ +#!/usr/bin/env node + +import chalk from "chalk"; +import { createRequire } from "module"; +import { ui } from "../src/environment/userInteraction.js"; +import { setup } from "../src/shell-integration/setup.js"; +import { teardown } from "../src/shell-integration/teardown.js"; +import { setupCi } from "../src/shell-integration/setup-ci.js"; + +if (process.argv.length < 3) { + ui.writeError("No command provided. Please provide a command to execute."); + ui.emptyLine(); + writeHelp(); + process.exit(1); +} + +const command = process.argv[2]; + +if (command === "help" || command === "--help" || command === "-h") { + writeHelp(); + process.exit(0); +} + +if (command === "setup") { + setup(); +} else if (command === "teardown") { + teardown(); +} else if (command === "setup-ci") { + setupCi(); +} else if (command === "--version" || command === "-v" || command === "-v") { + ui.writeInformation(`Current safe-chain version: ${getVersion()}`); +} else { + ui.writeError(`Unknown command: ${command}.`); + ui.emptyLine(); + + writeHelp(); + + process.exit(1); +} + +function writeHelp() { + ui.writeInformation( + chalk.bold("Usage: ") + chalk.cyan("safe-chain ") + ); + ui.emptyLine(); + ui.writeInformation( + `Available commands: ${chalk.cyan("setup")}, ${chalk.cyan( + "teardown" + )}, ${chalk.cyan("setup-ci")}, ${chalk.cyan("help")}, ${chalk.cyan( + "--version" + )}` + ); + ui.emptyLine(); + ui.writeInformation( + `- ${chalk.cyan( + "safe-chain setup" + )}: This will setup your shell to wrap safe-chain around npm, npx, yarn, pnpm, pnpx, bun and bunx.` + ); + ui.writeInformation( + `- ${chalk.cyan( + "safe-chain teardown" + )}: This will remove safe-chain aliases from your shell configuration.` + ); + ui.writeInformation( + `- ${chalk.cyan( + "safe-chain setup-ci" + )}: This will setup safe-chain for CI environments by creating shims and modifying the PATH.` + ); + ui.writeInformation( + `- ${chalk.cyan( + "safe-chain --version" + )} (or ${chalk.cyan("-v")}): Display the current version of safe-chain.` + ); + ui.emptyLine(); +} + +function getVersion() { + const require = createRequire(import.meta.url); + const packageJson = require("../package.json"); + return packageJson.version; +} diff --git a/node_modules/@aikidosec/safe-chain/docs/safe-package-manager-demo.gif b/node_modules/@aikidosec/safe-chain/docs/safe-package-manager-demo.gif new file mode 100644 index 0000000000000000000000000000000000000000..9d22d8c7dac3faf04c4e59eac6d1737a90e4c2b4 GIT binary patch literal 28651 zcmeFZcUaTywk?_lB%y^+3_bKJgkF^pigZF1Y0^XlRFEPdN<#01CS7_*rAe3Gi&PN- zl_CmOnu>tr;?s@J#e;ocKf#3VicfMneIp#<%=xQq}IATB;;19s> z9}s|+0?0@Q1VTZQtRMw(5SSLi1)@M(P{M(5Fe_Y>11<)o22)d0yHSJXXbhEUD0yk& zP6(7D0|Pyh7Q_T*WMTv{)3UJMc+6@^!FGm~jWvvoL!bRBhy!q+!?c=%VvO6Kf{*Jh zpFKZ6|0N-RF)=X;ab9l;p<)StDk*Up8EGdujEj7TyS&eYeBe8U2pVOeva&Kv1;c*c z)mqJ64`)xUAx)>LqM@lFq*JD+r$?u+X{K+lfTu#6uqm0}GBYR}T-5lzXg#*Vp&1Zw}EnJ;Jx3#CJr=UuM96@80eB{(#-c zpzNNYkHL3>#e>lvcQZQgzQu=xw}-suA^1xYZpRZIj1s@y4Ap84U3wb29u^kX6gJlv z_VF-$s3CIVT9o+5s3+;sw*ajSrJa2x?E5?@xGZkQkkt zSZ_?yBaxC0Qx_P(pntS?b6cIX41b4-w#x|A1|2^H=gm)D=SnsJEc2k zJ~uCSG4EL7LE7~PX@q=&SW)KfV!z_z;`!qJnvxcyvedD%mBz|$_3E6P)$Y|b)mI-q zAU?`^`}m}zcIa zCuze^h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318YNXaS~DGLil>a`?@h>>j7_BsnBNi5 zU+Fah{e53k!Wmy?aK^{lZQ7cjZGuQ&Vq)_`B9kjlo(3Mev*QV$qGMOyKW8JI3M|8J zfQ#q09%oagnH!juJc~tmt4JBqjIBAaxe0C0J4OHI@7fEcVeyT23RJz_+ z(baV)ce{{=W>p)_;y1DD_%sRsPWVl{%E%;?Ds*5O+?k{hnkfju` z>Z(8B6o$>>1s4XoqMERCXj-?GL6~(4J-f zHJox$lF3-Ln>B5H+XMOtDuH$`g8?a(b86;cWhI&=QHt_~we;Ax5pOTz$>4sr zi@~M(|)j$7l(LeU{pLqXMr2kAN z_CM$FpYQ!I%7A0}fAREB*70BF@K0`c9@+5*?eGKIgvr5U82tY-5YplbVih6=0sjZF Cbtl*W literal 0 HcmV?d00001 diff --git a/node_modules/@aikidosec/safe-chain/docs/shell-integration.md b/node_modules/@aikidosec/safe-chain/docs/shell-integration.md new file mode 100644 index 0000000..4a6ac99 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/docs/shell-integration.md @@ -0,0 +1,123 @@ +# Shell Integration + +## Overview + +The shell integration automatically wraps common package manager commands (`npm`, `npx`, `yarn`, `pnpm`, `pnpx`, `bun`, `bunx`) with Aikido's security scanning functionality. This is achieved by sourcing startup scripts that define shell functions to wrap these commands with their Aikido-protected equivalents. + +## Supported Shells + +Aikido Safe Chain supports integration with the following shells. + +| Shell | Startup File | +| ---------------------- | ---------------------------- | +| **Bash** | `~/.bashrc` | +| **Zsh** | `~/.zshrc` | +| **Fish** | `~/.config/fish/config.fish` | +| **PowerShell Core** | `$PROFILE` | +| **Windows PowerShell** | `$PROFILE` | + +## Setup Commands + +### Setup Shell Integration + +```bash +safe-chain setup +``` + +This command: + +- Copies necessary startup scripts to Safe Chain's installation directory (`~/.safe-chain/scripts`) +- Detects all supported shells on your system +- Sources each shell's startup file to add Safe Chain functions for `npm`, `npx`, `yarn`, `pnpm`, `pnpx`, `bun`, and `bunx` + +❗ After running this command, **you must restart your terminal** for the changes to take effect. This ensures that the startup scripts are sourced correctly. + +### Remove Shell Integration + +```bash +safe-chain teardown +``` + +This command: + +- Detects all supported shells on your system +- Removes the Safe Chain scripts from each shell's startup file, restoring the original commands + +❗ After running this command, **you must restart your terminal** to restore the original commands. + +## File Locations + +The system modifies the following files to source Safe Chain startup scripts: + +### Unix/Linux/macOS + +- **Bash**: `~/.bashrc` +- **Zsh**: `~/.zshrc` +- **Fish**: `~/.config/fish/config.fish` +- **PowerShell Core**: `$PROFILE` (usually `~/.config/powershell/profile.ps1`) + +### Windows + +- **PowerShell**: Determined by `$PROFILE` variable +- **PowerShell Core**: Also determined by `$PROFILE` variable + +## Troubleshooting + +### Common Issues + +**Shell functions not working after setup:** + +- Make sure to restart your terminal +- Check that the startup file was modified to source Safe Chain scripts +- Check the sourced file exists at `~/.safe-chain/scripts/` +- Verify your shell is reading the correct startup file + +**Getting 'command not found: aikido-npm' error:** + +This means the shell functions are working but the Aikido commands aren't installed or available in your PATH: + +- Make sure Aikido Safe Chain is properly installed on your system +- Verify the `aikido-npm`, `aikido-npx`, `aikido-yarn`, `aikido-pnpm`, `aikido-pnpx`, `aikido-bun`, and `aikido-bunx` commands exist +- Check that these commands are in your system's PATH + +### Manual Verification + +To verify the integration is working, follow these steps: + +1. **Check if startup scripts were sourced in your shell startup file:** + + - **For Bash**: Open `~/.bashrc` in your text editor + - **For Zsh**: Open `~/.zshrc` in your text editor + - **For Fish**: Open `~/.config/fish/config.fish` in your text editor + - **For PowerShell**: Open your PowerShell profile file (run `$PROFILE` in PowerShell to see the path) + + Look for lines that source the Safe Chain startup scripts from `~/.safe-chain/scripts/` + +2. **Test that shell functions are active in your terminal:** + + After restarting your terminal, run these commands: + + - `npm --version` - Should show output from the Aikido-wrapped version + - `type npm` - Should show that `npm` is a function + +3. **If you need to remove the integration manually:** + + Edit the same startup file from step 1 and delete any lines that source Safe Chain scripts from `~/.safe-chain/scripts/`. + +## Manual Setup + +For advanced users who prefer manual configuration, you can create wrapper functions directly in your shell's startup file. Shell functions take precedence over commands in PATH, so defining an `npm` function will intercept all `npm` calls: + +```bash +# Example for Bash/Zsh +npm() { + if command -v aikido-npm > /dev/null 2>&1; then + aikido-npm "$@" + else + echo "Warning: safe-chain is not installed. npm will run without protection." + command npm "$@" + fi +} +``` + +Repeat this pattern for `npx`, `yarn`, `pnpm`, `pnpx`, `bun`, and `bunx` using their respective `aikido-*` commands. After adding these functions, restart your terminal to apply the changes. diff --git a/node_modules/@aikidosec/safe-chain/package.json b/node_modules/@aikidosec/safe-chain/package.json new file mode 100644 index 0000000..c3ebd58 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/package.json @@ -0,0 +1,51 @@ +{ + "name": "@aikidosec/safe-chain", + "version": "1.1.7", + "scripts": { + "test": "node --test --experimental-test-module-mocks 'src/**/*.spec.js'", + "test:watch": "node --test --watch --experimental-test-module-mocks 'src/**/*.spec.js'", + "lint": "oxlint --deny-warnings" + }, + "bin": { + "aikido-npm": "bin/aikido-npm.js", + "aikido-npx": "bin/aikido-npx.js", + "aikido-yarn": "bin/aikido-yarn.js", + "aikido-pnpm": "bin/aikido-pnpm.js", + "aikido-pnpx": "bin/aikido-pnpx.js", + "aikido-bun": "bin/aikido-bun.js", + "aikido-bunx": "bin/aikido-bunx.js", + "safe-chain": "bin/safe-chain.js" + }, + "type": "module", + "exports": { + ".": { + "default": "./src/main.js" + }, + "./scanning": { + "default": "./src/scanning/audit/index.js" + } + }, + "keywords": [], + "author": "Aikido Security", + "license": "AGPL-3.0-or-later", + "description": "The Aikido Safe Chain wraps around the [npm cli](https://github.com/npm/cli), [npx](https://github.com/npm/cli/blob/latest/docs/content/commands/npx.md), [yarn](https://yarnpkg.com/), [pnpm](https://pnpm.io/), [pnpx](https://pnpm.io/cli/dlx), [bun](https://bun.sh/), and [bunx](https://bun.sh/docs/cli/bunx) to provide extra checks before installing new packages. This tool will detect when a package contains malware and prompt you to exit, preventing npm, npx, yarn, pnpm, pnpx, bun, or bunx from downloading or running the malware.", + "dependencies": { + "chalk": "5.4.1", + "https-proxy-agent": "7.0.6", + "make-fetch-happen": "14.0.3", + "node-forge": "1.3.1", + "npm-registry-fetch": "18.0.2", + "ora": "8.2.0", + "semver": "7.7.2" + }, + "main": "src/main.js", + "bugs": { + "url": "https://github.com/AikidoSec/safe-chain/issues" + }, + "homepage": "https://github.com/AikidoSec/safe-chain#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/AikidoSec/safe-chain.git", + "directory": "packages/safe-chain" + } +} diff --git a/node_modules/@aikidosec/safe-chain/src/api/aikido.js b/node_modules/@aikidosec/safe-chain/src/api/aikido.js new file mode 100644 index 0000000..c9eeea0 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/api/aikido.js @@ -0,0 +1,33 @@ +import fetch from "make-fetch-happen"; + +const malwareDatabaseUrl = + "https://malware-list.aikido.dev/malware_predictions.json"; + +export async function fetchMalwareDatabase() { + const response = await fetch(malwareDatabaseUrl); + if (!response.ok) { + throw new Error(`Error fetching malware database: ${response.statusText}`); + } + + try { + let malwareDatabase = await response.json(); + return { + malwareDatabase: malwareDatabase, + version: response.headers.get("etag") || undefined, + }; + } catch (error) { + throw new Error(`Error parsing malware database: ${error.message}`); + } +} + +export async function fetchMalwareDatabaseVersion() { + const response = await fetch(malwareDatabaseUrl, { + method: "HEAD", + }); + if (!response.ok) { + throw new Error( + `Error fetching malware database version: ${response.statusText}` + ); + } + return response.headers.get("etag") || undefined; +} diff --git a/node_modules/@aikidosec/safe-chain/src/api/npmApi.js b/node_modules/@aikidosec/safe-chain/src/api/npmApi.js new file mode 100644 index 0000000..deb917d --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/api/npmApi.js @@ -0,0 +1,50 @@ +import * as semver from "semver"; +import * as npmFetch from "npm-registry-fetch"; + +export async function resolvePackageVersion(packageName, versionRange) { + if (!versionRange) { + versionRange = "latest"; + } + + if (semver.valid(versionRange)) { + // The version is a fixed version, no need to resolve + return versionRange; + } + + const packageInfo = await getPackageInfo(packageName); + if (!packageInfo) { + // It is possible that no version is found (could be a private package, or a package that doesn't exist) + // In this case, we return null to indicate that we couldn't resolve the version + return null; + } + + const distTags = packageInfo["dist-tags"]; + if (distTags && distTags[versionRange]) { + // If the version range is a dist-tag, return the version associated with that tag + // e.g., "latest", "next", etc. + return distTags[versionRange]; + } + + if (!packageInfo.versions) { + return null; + } + + // If the version range is not a dist-tag, we need to resolve the highest version matching the range. + // This is useful for ranges like "^1.0.0" or "~2.3.4". + const availableVersions = Object.keys(packageInfo.versions); + const resolvedVersion = semver.maxSatisfying(availableVersions, versionRange); + if (resolvedVersion) { + return resolvedVersion; + } + + // Nothing matched the range, return null + return null; +} + +async function getPackageInfo(packageName) { + try { + return await npmFetch.json(packageName); + } catch { + return null; + } +} diff --git a/node_modules/@aikidosec/safe-chain/src/config/cliArguments.js b/node_modules/@aikidosec/safe-chain/src/config/cliArguments.js new file mode 100644 index 0000000..f234bbb --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/config/cliArguments.js @@ -0,0 +1,50 @@ +const state = { + loggingLevel: undefined, +}; + +const SAFE_CHAIN_ARG_PREFIX = "--safe-chain-"; + +export function initializeCliArguments(args) { + // Reset state on each call + state.loggingLevel = undefined; + + const safeChainArgs = []; + const remainingArgs = []; + + for (const arg of args) { + if (arg.toLowerCase().startsWith(SAFE_CHAIN_ARG_PREFIX)) { + safeChainArgs.push(arg); + } else { + remainingArgs.push(arg); + } + } + + setLoggingLevel(safeChainArgs); + + return remainingArgs; +} + +function getLastArgEqualsValue(args, prefix) { + for (var i = args.length - 1; i >= 0; i--) { + const arg = args[i]; + if (arg.toLowerCase().startsWith(prefix)) { + return arg.substring(prefix.length); + } + } + + return undefined; +} + +function setLoggingLevel(args) { + const safeChainLoggingArg = SAFE_CHAIN_ARG_PREFIX + "logging="; + + const level = getLastArgEqualsValue(args, safeChainLoggingArg); + if (!level) { + return; + } + state.loggingLevel = level.toLowerCase(); +} + +export function getLoggingLevel() { + return state.loggingLevel; +} diff --git a/node_modules/@aikidosec/safe-chain/src/config/configFile.js b/node_modules/@aikidosec/safe-chain/src/config/configFile.js new file mode 100644 index 0000000..2feb307 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/config/configFile.js @@ -0,0 +1,91 @@ +import fs from "fs"; +import path from "path"; +import os from "os"; +import { ui } from "../environment/userInteraction.js"; + +export function getScanTimeout() { + const config = readConfigFile(); + return ( + parseInt(process.env.AIKIDO_SCAN_TIMEOUT_MS) || config.scanTimeout || 10000 // Default to 10 seconds + ); +} + +export function writeDatabaseToLocalCache(data, version) { + try { + const databasePath = getDatabasePath(); + const versionPath = getDatabaseVersionPath(); + + fs.writeFileSync(databasePath, JSON.stringify(data)); + fs.writeFileSync(versionPath, version.toString()); + } catch { + ui.writeWarning( + "Failed to write malware database to local cache, next time the database will be fetched from the server again." + ); + } +} + +export function readDatabaseFromLocalCache() { + try { + const databasePath = getDatabasePath(); + if (!fs.existsSync(databasePath)) { + return { + malwareDatabase: null, + version: null, + }; + } + const data = fs.readFileSync(databasePath, "utf8"); + const malwareDatabase = JSON.parse(data); + const versionPath = getDatabaseVersionPath(); + let version = null; + if (fs.existsSync(versionPath)) { + version = fs.readFileSync(versionPath, "utf8").trim(); + } + return { + malwareDatabase: malwareDatabase, + version: version, + }; + } catch { + ui.writeWarning( + "Failed to read malware database from local cache. Continuing without local cache." + ); + return { + malwareDatabase: null, + version: null, + }; + } +} + +function readConfigFile() { + const configFilePath = getConfigFilePath(); + + if (!fs.existsSync(configFilePath)) { + return {}; + } + + const data = fs.readFileSync(configFilePath, "utf8"); + return JSON.parse(data); +} + +function getDatabasePath() { + const aikidoDir = getAikidoDirectory(); + return path.join(aikidoDir, "malwareDatabase.json"); +} + +function getDatabaseVersionPath() { + const aikidoDir = getAikidoDirectory(); + return path.join(aikidoDir, "version.txt"); +} + +function getConfigFilePath() { + return path.join(getAikidoDirectory(), "config.json"); +} + +function getAikidoDirectory() { + const homeDir = os.homedir(); + const aikidoDir = path.join(homeDir, ".aikido"); + + if (!fs.existsSync(aikidoDir)) { + fs.mkdirSync(aikidoDir, { recursive: true }); + } + return aikidoDir; +} diff --git a/node_modules/@aikidosec/safe-chain/src/config/settings.js b/node_modules/@aikidosec/safe-chain/src/config/settings.js new file mode 100644 index 0000000..ad150b2 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/config/settings.js @@ -0,0 +1,14 @@ +import * as cliArguments from "./cliArguments.js"; + +export function getLoggingLevel() { + const level = cliArguments.getLoggingLevel(); + + if (level === LOGGING_SILENT) { + return LOGGING_SILENT; + } + + return LOGGING_NORMAL; +} + +export const LOGGING_SILENT = "silent"; +export const LOGGING_NORMAL = "normal"; diff --git a/node_modules/@aikidosec/safe-chain/src/environment/environment.js b/node_modules/@aikidosec/safe-chain/src/environment/environment.js new file mode 100644 index 0000000..5211328 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/environment/environment.js @@ -0,0 +1,14 @@ +export function isCi() { + const ciEnvironments = [ + "CI", + "TF_BUILD", // Azure devops does not set CI, but TF_BUILD + ]; + + for (const env of ciEnvironments) { + if (process.env[env]) { + return true; + } + } + + return false; +} diff --git a/node_modules/@aikidosec/safe-chain/src/environment/userInteraction.js b/node_modules/@aikidosec/safe-chain/src/environment/userInteraction.js new file mode 100644 index 0000000..e1a4f93 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/environment/userInteraction.js @@ -0,0 +1,96 @@ +// oxlint-disable no-console +import chalk from "chalk"; +import ora from "ora"; +import { isCi } from "./environment.js"; +import { getLoggingLevel, LOGGING_SILENT } from "../config/settings.js"; + +function isSilentMode() { + return getLoggingLevel() === LOGGING_SILENT; +} + +function emptyLine() { + if (isSilentMode()) return; + + writeInformation(""); +} + +function writeInformation(message, ...optionalParams) { + if (isSilentMode()) return; + + console.log(message, ...optionalParams); +} + +function writeWarning(message, ...optionalParams) { + if (isSilentMode()) return; + + if (!isCi()) { + message = chalk.yellow(message); + } + console.warn(message, ...optionalParams); +} + +function writeError(message, ...optionalParams) { + if (!isCi()) { + message = chalk.red(message); + } + console.error(message, ...optionalParams); +} + +function writeExitWithoutInstallingMaliciousPackages() { + let message = "Safe-chain: Exiting without installing malicious packages."; + if (!isCi()) { + message = chalk.red(message); + } + console.error(message); +} + +function startProcess(message) { + if (isSilentMode()) { + return { + succeed: () => {}, + fail: () => {}, + stop: () => {}, + setText: () => {}, + }; + } + + if (isCi()) { + return { + succeed: (message) => { + writeInformation(message); + }, + fail: (message) => { + writeError(message); + }, + stop: () => {}, + setText: (message) => { + writeInformation(message); + }, + }; + } else { + const spinner = ora(message).start(); + return { + succeed: (message) => { + spinner.succeed(message); + }, + fail: (message) => { + spinner.fail(message); + }, + stop: () => { + spinner.stop(); + }, + setText: (message) => { + spinner.text = message; + }, + }; + } +} + +export const ui = { + writeInformation, + writeWarning, + writeError, + writeExitWithoutInstallingMaliciousPackages, + emptyLine, + startProcess, +}; diff --git a/node_modules/@aikidosec/safe-chain/src/main.js b/node_modules/@aikidosec/safe-chain/src/main.js new file mode 100644 index 0000000..c3af410 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/main.js @@ -0,0 +1,68 @@ +#!/usr/bin/env node + +import { scanCommand, shouldScanCommand } from "./scanning/index.js"; +import { ui } from "./environment/userInteraction.js"; +import { getPackageManager } from "./packagemanager/currentPackageManager.js"; +import { initializeCliArguments } from "./config/cliArguments.js"; +import { createSafeChainProxy } from "./registryProxy/registryProxy.js"; +import chalk from "chalk"; + +export async function main(args) { + const proxy = createSafeChainProxy(); + await proxy.startServer(); + + // Global error handlers to log unhandled errors + process.on("uncaughtException", (error) => { + ui.writeError(`Safe-chain: Uncaught exception: ${error.message}`); + ui.writeVerbose(`Stack trace: ${error.stack}`); + process.exit(1); + }); + + process.on("unhandledRejection", (reason) => { + ui.writeError(`Safe-chain: Unhandled promise rejection: ${reason}`); + if (reason instanceof Error) { + ui.writeVerbose(`Stack trace: ${reason.stack}`); + } + process.exit(1); + }); + + try { + // This parses all the --safe-chain arguments and removes them from the args array + args = initializeCliArguments(args); + + if (shouldScanCommand(args)) { + const commandScanResult = await scanCommand(args); + + // Returning the exit code back to the caller allows the promise + // to be awaited in the bin files and return the correct exit code + if (commandScanResult !== 0) { + return commandScanResult; + } + } + + const packageManagerResult = await getPackageManager().runCommand(args); + + if (!proxy.verifyNoMaliciousPackages()) { + return 1; + } + + ui.emptyLine(); + ui.writeInformation( + `${chalk.green( + "✔" + )} Safe-chain: Command completed, no malicious packages found.` + ); + + // Returning the exit code back to the caller allows the promise + // to be awaited in the bin files and return the correct exit code + return packageManagerResult.status; + } catch (error) { + ui.writeError("Failed to check for malicious packages:", error.message); + + // Returning the exit code back to the caller allows the promise + // to be awaited in the bin files and return the correct exit code + return 1; + } finally { + await proxy.stopServer(); + } +} diff --git a/node_modules/@aikidosec/safe-chain/src/packagemanager/_shared/matchesCommand.js b/node_modules/@aikidosec/safe-chain/src/packagemanager/_shared/matchesCommand.js new file mode 100644 index 0000000..d72caca --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/packagemanager/_shared/matchesCommand.js @@ -0,0 +1,13 @@ +export function matchesCommand(args, ...commandArgs) { + if (args.length < commandArgs.length) { + return false; + } + + for (var i = 0; i < commandArgs.length; i++) { + if (args[i].toLowerCase() !== commandArgs[i].toLowerCase()) { + return false; + } + } + + return true; +} diff --git a/node_modules/@aikidosec/safe-chain/src/packagemanager/bun/createBunPackageManager.js b/node_modules/@aikidosec/safe-chain/src/packagemanager/bun/createBunPackageManager.js new file mode 100644 index 0000000..14faa5f --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/packagemanager/bun/createBunPackageManager.js @@ -0,0 +1,42 @@ +import { ui } from "../../environment/userInteraction.js"; +import { safeSpawn } from "../../utils/safeSpawn.js"; +import { mergeSafeChainProxyEnvironmentVariables } from "../../registryProxy/registryProxy.js"; + +export function createBunPackageManager() { + return { + runCommand: (args) => runBunCommand("bun", args), + + // For bun, we use the proxy-only approach to block package downloads, + // so we don't need to analyze commands. + isSupportedCommand: () => false, + getDependencyUpdatesForCommand: () => [], + }; +} + +export function createBunxPackageManager() { + return { + runCommand: (args) => runBunCommand("bunx", args), + + // For bunx, we use the proxy-only approach to block package downloads, + // so we don't need to analyze commands. + isSupportedCommand: () => false, + getDependencyUpdatesForCommand: () => [], + }; +} + +async function runBunCommand(command, args) { + try { + const result = await safeSpawn(command, args, { + stdio: "inherit", + env: mergeSafeChainProxyEnvironmentVariables(process.env), + }); + return { status: result.status }; + } catch (error) { + if (error.status) { + return { status: error.status }; + } else { + ui.writeError("Error executing command:", error.message); + return { status: 1 }; + } + } +} diff --git a/node_modules/@aikidosec/safe-chain/src/packagemanager/currentPackageManager.js b/node_modules/@aikidosec/safe-chain/src/packagemanager/currentPackageManager.js new file mode 100644 index 0000000..2f019a1 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/packagemanager/currentPackageManager.js @@ -0,0 +1,44 @@ +import { + createBunPackageManager, + createBunxPackageManager, +} from "./bun/createBunPackageManager.js"; +import { createNpmPackageManager } from "./npm/createPackageManager.js"; +import { createNpxPackageManager } from "./npx/createPackageManager.js"; +import { + createPnpmPackageManager, + createPnpxPackageManager, +} from "./pnpm/createPackageManager.js"; +import { createYarnPackageManager } from "./yarn/createPackageManager.js"; + +const state = { + packageManagerName: null, +}; + +export function initializePackageManager(packageManagerName) { + if (packageManagerName === "npm") { + state.packageManagerName = createNpmPackageManager(); + } else if (packageManagerName === "npx") { + state.packageManagerName = createNpxPackageManager(); + } else if (packageManagerName === "yarn") { + state.packageManagerName = createYarnPackageManager(); + } else if (packageManagerName === "pnpm") { + state.packageManagerName = createPnpmPackageManager(); + } else if (packageManagerName === "pnpx") { + state.packageManagerName = createPnpxPackageManager(); + } else if (packageManagerName === "bun") { + state.packageManagerName = createBunPackageManager(); + } else if (packageManagerName === "bunx") { + state.packageManagerName = createBunxPackageManager(); + } else { + throw new Error("Unsupported package manager: " + packageManagerName); + } + + return state.packageManagerName; +} + +export function getPackageManager() { + if (!state.packageManagerName) { + throw new Error("Package manager not initialized."); + } + return state.packageManagerName; +} diff --git a/node_modules/@aikidosec/safe-chain/src/packagemanager/npm/createPackageManager.js b/node_modules/@aikidosec/safe-chain/src/packagemanager/npm/createPackageManager.js new file mode 100644 index 0000000..731f406 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/packagemanager/npm/createPackageManager.js @@ -0,0 +1,49 @@ +import { commandArgumentScanner } from "./dependencyScanner/commandArgumentScanner.js"; +import { nullScanner } from "./dependencyScanner/nullScanner.js"; +import { runNpm } from "./runNpmCommand.js"; +import { + getNpmCommandForArgs, + npmInstallCommand, + npmUpdateCommand, + npmExecCommand, +} from "./utils/npmCommands.js"; + +export function createNpmPackageManager() { + function isSupportedCommand(args) { + const scanner = findDependencyScannerForCommand( + commandScannerMapping, + args + ); + return scanner.shouldScan(args); + } + + function getDependencyUpdatesForCommand(args) { + const scanner = findDependencyScannerForCommand( + commandScannerMapping, + args + ); + return scanner.scan(args); + } + + return { + runCommand: runNpm, + isSupportedCommand, + getDependencyUpdatesForCommand, + }; +} + +const commandScannerMapping = { + [npmInstallCommand]: commandArgumentScanner(), + [npmUpdateCommand]: commandArgumentScanner(), + [npmExecCommand]: commandArgumentScanner({ ignoreDryRun: true }), // exec command doesn't support dry-run +}; + +function findDependencyScannerForCommand(scanners, args) { + const command = getNpmCommandForArgs(args); + if (!command) { + return nullScanner(); + } + + const scanner = scanners[command]; + return scanner ? scanner : nullScanner(); +} diff --git a/node_modules/@aikidosec/safe-chain/src/packagemanager/npm/dependencyScanner/commandArgumentScanner.js b/node_modules/@aikidosec/safe-chain/src/packagemanager/npm/dependencyScanner/commandArgumentScanner.js new file mode 100644 index 0000000..ae05f6d --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/packagemanager/npm/dependencyScanner/commandArgumentScanner.js @@ -0,0 +1,37 @@ +import { resolvePackageVersion } from "../../../api/npmApi.js"; +import { parsePackagesFromInstallArgs } from "../parsing/parsePackagesFromInstallArgs.js"; +import { hasDryRunArg } from "../utils/npmCommands.js"; + +export function commandArgumentScanner(opts) { + const ignoreDryRun = opts?.ignoreDryRun ?? false; + + return { + scan: (args) => scanDependencies(args), + shouldScan: (args) => shouldScanDependencies(args, ignoreDryRun), + }; +} +function scanDependencies(args) { + return checkChangesFromArgs(args); +} + +function shouldScanDependencies(args, ignoreDryRun) { + return ignoreDryRun || !hasDryRunArg(args); +} + +export async function checkChangesFromArgs(args) { + const changes = []; + const packageUpdates = parsePackagesFromInstallArgs(args); + + for (const packageUpdate of packageUpdates) { + var exactVersion = await resolvePackageVersion( + packageUpdate.name, + packageUpdate.version + ); + if (exactVersion) { + packageUpdate.version = exactVersion; + } + + changes.push({ ...packageUpdate, type: "add" }); + } + return changes; +} diff --git a/node_modules/@aikidosec/safe-chain/src/packagemanager/npm/dependencyScanner/nullScanner.js b/node_modules/@aikidosec/safe-chain/src/packagemanager/npm/dependencyScanner/nullScanner.js new file mode 100644 index 0000000..a7b2ffd --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/packagemanager/npm/dependencyScanner/nullScanner.js @@ -0,0 +1,6 @@ +export function nullScanner() { + return { + scan: () => [], + shouldScan: () => false, + }; +} diff --git a/node_modules/@aikidosec/safe-chain/src/packagemanager/npm/parsing/parsePackagesFromInstallArgs.js b/node_modules/@aikidosec/safe-chain/src/packagemanager/npm/parsing/parsePackagesFromInstallArgs.js new file mode 100644 index 0000000..e731240 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/packagemanager/npm/parsing/parsePackagesFromInstallArgs.js @@ -0,0 +1,111 @@ +export function parsePackagesFromInstallArgs(args) { + const changes = []; + let defaultTag = "latest"; + + // Skip first argument (install command) + for (let i = 1; i < args.length; i++) { + const arg = args[i]; + const npmOption = getNpmOption(arg); + + if (npmOption) { + // If the option has a parameter, skip the next argument as well + i += npmOption.numberOfParameters; + + // it a tag is specified, set the default tag + if (npmOption.name === "--tag") { + defaultTag = args[i]; + } + + continue; + } + + const packageDetails = parsePackagename(arg); + if (packageDetails) { + changes.push(packageDetails); + continue; + } + } + + for (const change of changes) { + if (!change.version) { + change.version = defaultTag; + } + } + + return changes; +} + +function getNpmOption(arg) { + if (isNpmOptionWithParameter(arg)) { + return { + name: arg, + numberOfParameters: 1, + }; + } + + // Arguments starting with "-" or "--" are considered npm options + if (arg.startsWith("-")) { + return { + name: arg, + numberOfParameters: 0, + }; + } + + return undefined; +} + +function isNpmOptionWithParameter(arg) { + const optionsWithParameters = [ + "--access", + "--auth-type", + "--cache", + "--fetch-retries", + "--fetch-retry-mintimeout", + "--fetch-retry-maxtimeout", + "--fetch-retry-factor", + "--fetch-timeout", + "--https-proxy", + "--include", + "--location", + "--lockfile-version", + "--loglevel", + "--omit", + "--proxy", + "--registry", + "--replace-registry-host", + "--tag", + "--user-config", + "--workspace", + ]; + + return optionsWithParameters.includes(arg); +} + +function parsePackagename(arg) { + arg = removeAlias(arg); + const lastAtIndex = arg.lastIndexOf("@"); + + let name, version; + // The index of the last "@" should be greater than 0 + // If the index is 0, it means the package name starts with "@" (eg: "@vercel/otel") + if (lastAtIndex > 0) { + name = arg.slice(0, lastAtIndex); + version = arg.slice(lastAtIndex + 1); + } else { + name = arg; + version = null; + } + + return { + name, + version, + }; +} + +function removeAlias(arg) { + const aliasIndex = arg.indexOf("@npm:"); + if (aliasIndex !== -1) { + return arg.slice(aliasIndex + 5); + } + return arg; +} diff --git a/node_modules/@aikidosec/safe-chain/src/packagemanager/npm/runNpmCommand.js b/node_modules/@aikidosec/safe-chain/src/packagemanager/npm/runNpmCommand.js new file mode 100644 index 0000000..26a4a9d --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/packagemanager/npm/runNpmCommand.js @@ -0,0 +1,49 @@ +import { ui } from "../../environment/userInteraction.js"; +import { safeSpawn } from "../../utils/safeSpawn.js"; +import { mergeSafeChainProxyEnvironmentVariables } from "../../registryProxy/registryProxy.js"; + +export async function runNpm(args) { + try { + const result = await safeSpawn("npm", args, { + stdio: "inherit", + env: mergeSafeChainProxyEnvironmentVariables(process.env), + }); + return { status: result.status }; + } catch (error) { + if (error.status) { + return { status: error.status }; + } else { + ui.writeError("Error executing command:", error.message); + return { status: 1 }; + } + } +} + +export async function dryRunNpmCommandAndOutput(args) { + try { + const result = await safeSpawn( + "npm", + [...args, "--ignore-scripts", "--dry-run"], + { + stdio: "pipe", + env: mergeSafeChainProxyEnvironmentVariables(process.env), + } + ); + return { + status: result.status, + output: result.status === 0 ? result.stdout : result.stderr, + }; + } catch (error) { + if (error.status) { + const output = + error.stdout?.toString() ?? + error.stderr?.toString() ?? + error.message ?? + ""; + return { status: error.status, output }; + } else { + ui.writeError("Error executing command:", error.message); + return { status: 1 }; + } + } +} diff --git a/node_modules/@aikidosec/safe-chain/src/packagemanager/npm/utils/abbrevs-generated.js b/node_modules/@aikidosec/safe-chain/src/packagemanager/npm/utils/abbrevs-generated.js new file mode 100644 index 0000000..204ffa7 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/packagemanager/npm/utils/abbrevs-generated.js @@ -0,0 +1,358 @@ +// This was ran with the abbrev package to generate the abbrevs object below +// console.log(abbrev(commands.concat(Object.keys(aliases)))); +export const abbrevs = { + ac: "access", + acc: "access", + acce: "access", + acces: "access", + access: "access", + add: "add", + "add-": "add-user", + "add-u": "add-user", + "add-us": "add-user", + "add-use": "add-user", + "add-user": "add-user", + addu: "adduser", + addus: "adduser", + adduse: "adduser", + adduser: "adduser", + aud: "audit", + audi: "audit", + audit: "audit", + aut: "author", + auth: "author", + autho: "author", + author: "author", + b: "bugs", + bu: "bugs", + bug: "bugs", + bugs: "bugs", + c: "c", + ca: "cache", + cac: "cache", + cach: "cache", + cache: "cache", + ci: "ci", + cit: "cit", + "clean-install": "clean-install", + "clean-install-": "clean-install-test", + "clean-install-t": "clean-install-test", + "clean-install-te": "clean-install-test", + "clean-install-tes": "clean-install-test", + "clean-install-test": "clean-install-test", + com: "completion", + comp: "completion", + compl: "completion", + comple: "completion", + complet: "completion", + completi: "completion", + completio: "completion", + completion: "completion", + con: "config", + conf: "config", + confi: "config", + config: "config", + cr: "create", + cre: "create", + crea: "create", + creat: "create", + create: "create", + dd: "ddp", + ddp: "ddp", + ded: "dedupe", + dedu: "dedupe", + dedup: "dedupe", + dedupe: "dedupe", + dep: "deprecate", + depr: "deprecate", + depre: "deprecate", + deprec: "deprecate", + depreca: "deprecate", + deprecat: "deprecate", + deprecate: "deprecate", + dif: "diff", + diff: "diff", + "dist-tag": "dist-tag", + "dist-tags": "dist-tags", + docs: "docs", + doct: "doctor", + docto: "doctor", + doctor: "doctor", + ed: "edit", + edi: "edit", + edit: "edit", + exe: "exec", + exec: "exec", + expla: "explain", + explai: "explain", + explain: "explain", + explo: "explore", + explor: "explore", + explore: "explore", + find: "find", + "find-": "find-dupes", + "find-d": "find-dupes", + "find-du": "find-dupes", + "find-dup": "find-dupes", + "find-dupe": "find-dupes", + "find-dupes": "find-dupes", + fu: "fund", + fun: "fund", + fund: "fund", + g: "get", + ge: "get", + get: "get", + help: "help", + "help-": "help-search", + "help-s": "help-search", + "help-se": "help-search", + "help-sea": "help-search", + "help-sear": "help-search", + "help-searc": "help-search", + "help-search": "help-search", + hl: "hlep", + hle: "hlep", + hlep: "hlep", + ho: "home", + hom: "home", + home: "home", + i: "i", + ic: "ic", + in: "in", + inf: "info", + info: "info", + ini: "init", + init: "init", + inn: "innit", + inni: "innit", + innit: "innit", + ins: "ins", + inst: "inst", + insta: "insta", + instal: "instal", + install: "install", + "install-ci": "install-ci-test", + "install-ci-": "install-ci-test", + "install-ci-t": "install-ci-test", + "install-ci-te": "install-ci-test", + "install-ci-tes": "install-ci-test", + "install-ci-test": "install-ci-test", + "install-cl": "install-clean", + "install-cle": "install-clean", + "install-clea": "install-clean", + "install-clean": "install-clean", + "install-t": "install-test", + "install-te": "install-test", + "install-tes": "install-test", + "install-test": "install-test", + isnt: "isnt", + isnta: "isnta", + isntal: "isntal", + isntall: "isntall", + "isntall-": "isntall-clean", + "isntall-c": "isntall-clean", + "isntall-cl": "isntall-clean", + "isntall-cle": "isntall-clean", + "isntall-clea": "isntall-clean", + "isntall-clean": "isntall-clean", + iss: "issues", + issu: "issues", + issue: "issues", + issues: "issues", + it: "it", + la: "la", + lin: "link", + link: "link", + lis: "list", + list: "list", + ll: "ll", + ln: "ln", + logi: "login", + login: "login", + logo: "logout", + logou: "logout", + logout: "logout", + ls: "ls", + og: "ogr", + ogr: "ogr", + or: "org", + org: "org", + ou: "outdated", + out: "outdated", + outd: "outdated", + outda: "outdated", + outdat: "outdated", + outdate: "outdated", + outdated: "outdated", + ow: "owner", + own: "owner", + owne: "owner", + owner: "owner", + pa: "pack", + pac: "pack", + pack: "pack", + pi: "ping", + pin: "ping", + ping: "ping", + pk: "pkg", + pkg: "pkg", + pre: "prefix", + pref: "prefix", + prefi: "prefix", + prefix: "prefix", + pro: "profile", + prof: "profile", + profi: "profile", + profil: "profile", + profile: "profile", + pru: "prune", + prun: "prune", + prune: "prune", + pu: "publish", + pub: "publish", + publ: "publish", + publi: "publish", + publis: "publish", + publish: "publish", + q: "query", + qu: "query", + que: "query", + quer: "query", + query: "query", + r: "r", + rb: "rb", + reb: "rebuild", + rebu: "rebuild", + rebui: "rebuild", + rebuil: "rebuild", + rebuild: "rebuild", + rem: "remove", + remo: "remove", + remov: "remove", + remove: "remove", + rep: "repo", + repo: "repo", + res: "restart", + rest: "restart", + resta: "restart", + restar: "restart", + restart: "restart", + rm: "rm", + ro: "root", + roo: "root", + root: "root", + rum: "rum", + run: "run", + "run-": "run-script", + "run-s": "run-script", + "run-sc": "run-script", + "run-scr": "run-script", + "run-scri": "run-script", + "run-scrip": "run-script", + "run-script": "run-script", + s: "s", + sb: "sbom", + sbo: "sbom", + sbom: "sbom", + se: "se", + sea: "search", + sear: "search", + searc: "search", + search: "search", + set: "set", + sho: "show", + show: "show", + shr: "shrinkwrap", + shri: "shrinkwrap", + shrin: "shrinkwrap", + shrink: "shrinkwrap", + shrinkw: "shrinkwrap", + shrinkwr: "shrinkwrap", + shrinkwra: "shrinkwrap", + shrinkwrap: "shrinkwrap", + si: "sit", + sit: "sit", + star: "star", + stars: "stars", + start: "start", + sto: "stop", + stop: "stop", + t: "t", + tea: "team", + team: "team", + tes: "test", + test: "test", + to: "token", + tok: "token", + toke: "token", + token: "token", + ts: "tst", + tst: "tst", + ud: "udpate", + udp: "udpate", + udpa: "udpate", + udpat: "udpate", + udpate: "udpate", + un: "un", + und: "undeprecate", + unde: "undeprecate", + undep: "undeprecate", + undepr: "undeprecate", + undepre: "undeprecate", + undeprec: "undeprecate", + undepreca: "undeprecate", + undeprecat: "undeprecate", + undeprecate: "undeprecate", + uni: "uninstall", + unin: "uninstall", + unins: "uninstall", + uninst: "uninstall", + uninsta: "uninstall", + uninstal: "uninstall", + uninstall: "uninstall", + unl: "unlink", + unli: "unlink", + unlin: "unlink", + unlink: "unlink", + unp: "unpublish", + unpu: "unpublish", + unpub: "unpublish", + unpubl: "unpublish", + unpubli: "unpublish", + unpublis: "unpublish", + unpublish: "unpublish", + uns: "unstar", + unst: "unstar", + unsta: "unstar", + unstar: "unstar", + up: "up", + upd: "update", + upda: "update", + updat: "update", + update: "update", + upg: "upgrade", + upgr: "upgrade", + upgra: "upgrade", + upgrad: "upgrade", + upgrade: "upgrade", + ur: "urn", + urn: "urn", + v: "v", + veri: "verison", + veris: "verison", + veriso: "verison", + verison: "verison", + vers: "version", + versi: "version", + versio: "version", + version: "version", + vi: "view", + vie: "view", + view: "view", + who: "whoami", + whoa: "whoami", + whoam: "whoami", + whoami: "whoami", + why: "why", + x: "x", +}; diff --git a/node_modules/@aikidosec/safe-chain/src/packagemanager/npm/utils/cmd-list.js b/node_modules/@aikidosec/safe-chain/src/packagemanager/npm/utils/cmd-list.js new file mode 100644 index 0000000..6e67520 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/packagemanager/npm/utils/cmd-list.js @@ -0,0 +1,169 @@ +// Based on https://github.com/npm/cli/blob/latest/lib/utils/cmd-list.js + +import { abbrevs } from "./abbrevs-generated.js"; + +const commands = [ + "access", + "adduser", + "audit", + "bugs", + "cache", + "ci", + "completion", + "config", + "dedupe", + "deprecate", + "diff", + "dist-tag", + "docs", + "doctor", + "edit", + "exec", + "explain", + "explore", + "find-dupes", + "fund", + "get", + "help", + "help-search", + "init", + "install", + "install-ci-test", + "install-test", + "link", + "ll", + "login", + "logout", + "ls", + "org", + "outdated", + "owner", + "pack", + "ping", + "pkg", + "prefix", + "profile", + "prune", + "publish", + "query", + "rebuild", + "repo", + "restart", + "root", + "run", + "sbom", + "search", + "set", + "shrinkwrap", + "star", + "stars", + "start", + "stop", + "team", + "test", + "token", + "undeprecate", + "uninstall", + "unpublish", + "unstar", + "update", + "version", + "view", + "whoami", +]; + +// These must resolve to an entry in commands +const aliases = { + // aliases + author: "owner", + home: "docs", + issues: "bugs", + info: "view", + show: "view", + find: "search", + add: "install", + unlink: "uninstall", + remove: "uninstall", + rm: "uninstall", + r: "uninstall", + + // short names for common things + un: "uninstall", + rb: "rebuild", + list: "ls", + ln: "link", + create: "init", + i: "install", + it: "install-test", + cit: "install-ci-test", + up: "update", + c: "config", + s: "search", + se: "search", + tst: "test", + t: "test", + ddp: "dedupe", + v: "view", + "run-script": "run", + "clean-install": "ci", + "clean-install-test": "install-ci-test", + x: "exec", + why: "explain", + la: "ll", + verison: "version", + ic: "ci", + + // typos + innit: "init", + // manually abbrev so that install-test doesn't make insta stop working + in: "install", + ins: "install", + inst: "install", + insta: "install", + instal: "install", + isnt: "install", + isnta: "install", + isntal: "install", + isntall: "install", + "install-clean": "ci", + "isntall-clean": "ci", + hlep: "help", + "dist-tags": "dist-tag", + upgrade: "update", + udpate: "update", + rum: "run", + sit: "install-ci-test", + urn: "run", + ogr: "org", + "add-user": "adduser", +}; + +export function deref(c) { + if (!c) { + return; + } + + // Translate camelCase to snake-case (i.e. installTest to install-test) + if (c.match(/[A-Z]/)) { + c = c.replace(/([A-Z])/g, (m) => "-" + m.toLowerCase()); + } + + // if they asked for something exactly we are done + if (commands.includes(c)) { + return c; + } + + // if they asked for a direct alias + if (aliases[c]) { + return aliases[c]; + } + + // first deref the abbrev, if there is one + // then resolve any aliases + // so `npm install-cl` will resolve to `install-clean` then to `ci` + let a = abbrevs[c]; + while (aliases[a]) { + a = aliases[a]; + } + return a; +} diff --git a/node_modules/@aikidosec/safe-chain/src/packagemanager/npm/utils/npmCommands.js b/node_modules/@aikidosec/safe-chain/src/packagemanager/npm/utils/npmCommands.js new file mode 100644 index 0000000..3096144 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/packagemanager/npm/utils/npmCommands.js @@ -0,0 +1,26 @@ +import { deref } from "./cmd-list.js"; + +export function getNpmCommandForArgs(args) { + if (args.length === 0) { + return null; + } + + const argCommand = deref(args[0]); + if (!argCommand) { + return null; + } + + return argCommand; +} + +export function hasDryRunArg(args) { + return args.some((arg) => arg === "--dry-run"); +} + +export const npmInstallCommand = "install"; +export const npmCiCommand = "ci"; +export const npmInstallTestCommand = "install-test"; +export const npmInstallCiTestCommand = "install-ci-test"; +export const npmUpdateCommand = "update"; +export const npmAuditCommand = "audit"; +export const npmExecCommand = "exec"; diff --git a/node_modules/@aikidosec/safe-chain/src/packagemanager/npx/createPackageManager.js b/node_modules/@aikidosec/safe-chain/src/packagemanager/npx/createPackageManager.js new file mode 100644 index 0000000..a3319fa --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/packagemanager/npx/createPackageManager.js @@ -0,0 +1,12 @@ +import { commandArgumentScanner } from "./dependencyScanner/commandArgumentScanner.js"; +import { runNpx } from "./runNpxCommand.js"; + +export function createNpxPackageManager() { + const scanner = commandArgumentScanner(); + + return { + runCommand: runNpx, + isSupportedCommand: (args) => scanner.shouldScan(args), + getDependencyUpdatesForCommand: (args) => scanner.scan(args), + }; +} diff --git a/node_modules/@aikidosec/safe-chain/src/packagemanager/npx/dependencyScanner/commandArgumentScanner.js b/node_modules/@aikidosec/safe-chain/src/packagemanager/npx/dependencyScanner/commandArgumentScanner.js new file mode 100644 index 0000000..16328cb --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/packagemanager/npx/dependencyScanner/commandArgumentScanner.js @@ -0,0 +1,31 @@ +import { resolvePackageVersion } from "../../../api/npmApi.js"; +import { parsePackagesFromArguments } from "../parsing/parsePackagesFromArguments.js"; + +export function commandArgumentScanner() { + return { + scan: (args) => scanDependencies(args), + shouldScan: () => true, // all npx commands need to be scanned, npx doesn't have dry-run + }; +} +function scanDependencies(args) { + return checkChangesFromArgs(args); +} + +export async function checkChangesFromArgs(args) { + const changes = []; + const packageUpdates = parsePackagesFromArguments(args); + + for (const packageUpdate of packageUpdates) { + var exactVersion = await resolvePackageVersion( + packageUpdate.name, + packageUpdate.version + ); + if (exactVersion) { + packageUpdate.version = exactVersion; + } + + changes.push({ ...packageUpdate, type: "add" }); + } + + return changes; +} diff --git a/node_modules/@aikidosec/safe-chain/src/packagemanager/npx/parsing/parsePackagesFromArguments.js b/node_modules/@aikidosec/safe-chain/src/packagemanager/npx/parsing/parsePackagesFromArguments.js new file mode 100644 index 0000000..efc8d81 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/packagemanager/npx/parsing/parsePackagesFromArguments.js @@ -0,0 +1,108 @@ +export function parsePackagesFromArguments(args) { + let defaultTag = "latest"; + + for (let i = 0; i < args.length; i++) { + const arg = args[i]; + const option = getOption(arg); + + if (option) { + // If the option has a parameter, skip the next argument as well + i += option.numberOfParameters; + + continue; + } + + const packageDetails = parsePackagename(arg, defaultTag); + if (packageDetails) { + return [packageDetails]; + } + } + + return []; +} + +function getOption(arg) { + if (isOptionWithParameter(arg)) { + return { + name: arg, + numberOfParameters: 1, + }; + } + + // Arguments starting with "-" or "--" are considered options + // except for "--package=" which contains the package name + if (arg.startsWith("-") && !arg.startsWith("--package=")) { + return { + name: arg, + numberOfParameters: 0, + }; + } + + return undefined; +} + +function isOptionWithParameter(arg) { + const optionsWithParameters = [ + "--access", + "--auth-type", + "--cache", + "--fetch-retries", + "--fetch-retry-mintimeout", + "--fetch-retry-maxtimeout", + "--fetch-retry-factor", + "--fetch-timeout", + "--https-proxy", + "--include", + "--location", + "--lockfile-version", + "--loglevel", + "--omit", + "--proxy", + "--registry", + "--replace-registry-host", + "--tag", + "--user-config", + "--workspace", + ]; + + return optionsWithParameters.includes(arg); +} + +function parsePackagename(arg, defaultTag) { + // format can be --package=name@version + // in that case, we need to remove the --package= part + if (arg.startsWith("--package=")) { + arg = arg.slice(10); + } + + arg = removeAlias(arg); + + // Split at the last "@" to separate the package name and version + const lastAtIndex = arg.lastIndexOf("@"); + + let name, version; + // The index of the last "@" should be greater than 0 + // If the index is 0, it means the package name starts with "@" (eg: "@vercel/otel") + if (lastAtIndex > 0) { + name = arg.slice(0, lastAtIndex); + version = arg.slice(lastAtIndex + 1); + } else { + name = arg; + version = defaultTag; // No tag specified (eg: "http-server"), use the default tag + } + + return { + name, + version, + }; +} + +function removeAlias(arg) { + // removes the alias. + // Eg.: server@npm:http-server@latest becomes http-server@latest + const aliasIndex = arg.indexOf("@npm:"); + if (aliasIndex !== -1) { + return arg.slice(aliasIndex + 5); + } + return arg; +} diff --git a/node_modules/@aikidosec/safe-chain/src/packagemanager/npx/runNpxCommand.js b/node_modules/@aikidosec/safe-chain/src/packagemanager/npx/runNpxCommand.js new file mode 100644 index 0000000..b8896b7 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/packagemanager/npx/runNpxCommand.js @@ -0,0 +1,20 @@ +import { ui } from "../../environment/userInteraction.js"; +import { safeSpawn } from "../../utils/safeSpawn.js"; +import { mergeSafeChainProxyEnvironmentVariables } from "../../registryProxy/registryProxy.js"; + +export async function runNpx(args) { + try { + const result = await safeSpawn("npx", args, { + stdio: "inherit", + env: mergeSafeChainProxyEnvironmentVariables(process.env), + }); + return { status: result.status }; + } catch (error) { + if (error.status) { + return { status: error.status }; + } else { + ui.writeError("Error executing command:", error.message); + return { status: 1 }; + } + } +} diff --git a/node_modules/@aikidosec/safe-chain/src/packagemanager/pnpm/createPackageManager.js b/node_modules/@aikidosec/safe-chain/src/packagemanager/pnpm/createPackageManager.js new file mode 100644 index 0000000..15cb628 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/packagemanager/pnpm/createPackageManager.js @@ -0,0 +1,46 @@ +import { matchesCommand } from "../_shared/matchesCommand.js"; +import { commandArgumentScanner } from "./dependencyScanner/commandArgumentScanner.js"; +import { runPnpmCommand } from "./runPnpmCommand.js"; + +const scanner = commandArgumentScanner(); + +export function createPnpmPackageManager() { + return { + runCommand: (args) => runPnpmCommand(args, "pnpm"), + isSupportedCommand: (args) => + matchesCommand(args, "add") || + matchesCommand(args, "update") || + matchesCommand(args, "upgrade") || + matchesCommand(args, "up") || + matchesCommand(args, "install") || + matchesCommand(args, "i") || + // dlx does not always come in the first position + // eg: pnpm --package=yo --package=generator-webapp dlx yo webapp + // documentation: https://pnpm.io/cli/dlx#--package-name + args.includes("dlx"), + getDependencyUpdatesForCommand: (args) => + getDependencyUpdatesForCommand(args, false), + }; +} + +export function createPnpxPackageManager() { + return { + runCommand: (args) => runPnpmCommand(args, "pnpx"), + isSupportedCommand: () => true, + getDependencyUpdatesForCommand: (args) => + getDependencyUpdatesForCommand(args, true), + }; +} + +function getDependencyUpdatesForCommand(args, isPnpx) { + if (isPnpx) { + return scanner.scan(args); + } + if (args.includes("dlx")) { + // dlx is not always the first argument (eg: `pnpm --package=yo --package=generator-webapp dlx yo webapp`) + // so we need to filter it out instead of slicing the array + // documentation: https://pnpm.io/cli/dlx#--package-name + return scanner.scan(args.filter((arg) => arg !== "dlx")); + } + return scanner.scan(args.slice(1)); +} diff --git a/node_modules/@aikidosec/safe-chain/src/packagemanager/pnpm/dependencyScanner/commandArgumentScanner.js b/node_modules/@aikidosec/safe-chain/src/packagemanager/pnpm/dependencyScanner/commandArgumentScanner.js new file mode 100644 index 0000000..c184b38 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/packagemanager/pnpm/dependencyScanner/commandArgumentScanner.js @@ -0,0 +1,28 @@ +import { resolvePackageVersion } from "../../../api/npmApi.js"; +import { parsePackagesFromArguments } from "../parsing/parsePackagesFromArguments.js"; + +export function commandArgumentScanner() { + return { + scan: (args) => scanDependencies(args), + shouldScan: () => true, // There's no dry run for pnpm, so we always scan + }; +} + +async function scanDependencies(args) { + const changes = []; + const packageUpdates = parsePackagesFromArguments(args); + + for (const packageUpdate of packageUpdates) { + var exactVersion = await resolvePackageVersion( + packageUpdate.name, + packageUpdate.version + ); + if (exactVersion) { + packageUpdate.version = exactVersion; + } + + changes.push({ ...packageUpdate, type: "add" }); + } + + return changes; +} diff --git a/node_modules/@aikidosec/safe-chain/src/packagemanager/pnpm/parsing/parsePackagesFromArguments.js b/node_modules/@aikidosec/safe-chain/src/packagemanager/pnpm/parsing/parsePackagesFromArguments.js new file mode 100644 index 0000000..d0383c2 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/packagemanager/pnpm/parsing/parsePackagesFromArguments.js @@ -0,0 +1,88 @@ +export function parsePackagesFromArguments(args) { + const changes = []; + let defaultTag = "latest"; + + for (let i = 0; i < args.length; i++) { + const arg = args[i]; + const option = getOption(arg); + + if (option) { + // If the option has a parameter, skip the next argument as well + i += option.numberOfParameters; + + continue; + } + + const packageDetails = parsePackagename(arg, defaultTag); + if (packageDetails) { + changes.push(packageDetails); + } + } + + return changes; +} + +function getOption(arg) { + if (isOptionWithParameter(arg)) { + return { + name: arg, + numberOfParameters: 1, + }; + } + + // Arguments starting with "-" or "--" are considered options + // except for "--package=" which contains the package name + if (arg.startsWith("-") && !arg.startsWith("--package=")) { + return { + name: arg, + numberOfParameters: 0, + }; + } + + return undefined; +} + +function isOptionWithParameter(arg) { + const optionsWithParameters = ["--C", "--dir"]; + + return optionsWithParameters.includes(arg); +} + +function parsePackagename(arg, defaultTag) { + // format can be --package=name@version + // in that case, we need to remove the --package= part + if (arg.startsWith("--package=")) { + arg = arg.slice(10); + } + + arg = removeAlias(arg); + + // Split at the last "@" to separate the package name and version + const lastAtIndex = arg.lastIndexOf("@"); + + let name, version; + // The index of the last "@" should be greater than 0 + // If the index is 0, it means the package name starts with "@" (eg: "@aikidosec/package-name") + if (lastAtIndex > 0) { + name = arg.slice(0, lastAtIndex); + version = arg.slice(lastAtIndex + 1); + } else { + name = arg; + version = defaultTag; // No tag specified (eg: "http-server"), use the default tag + } + + return { + name, + version, + }; +} + +function removeAlias(arg) { + // removes the alias. + // Eg.: server@npm:http-server@latest becomes http-server@latest + const aliasIndex = arg.indexOf("@npm:"); + if (aliasIndex !== -1) { + return arg.slice(aliasIndex + 5); + } + return arg; +} diff --git a/node_modules/@aikidosec/safe-chain/src/packagemanager/pnpm/runPnpmCommand.js b/node_modules/@aikidosec/safe-chain/src/packagemanager/pnpm/runPnpmCommand.js new file mode 100644 index 0000000..794d6e3 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/packagemanager/pnpm/runPnpmCommand.js @@ -0,0 +1,31 @@ +import { ui } from "../../environment/userInteraction.js"; +import { mergeSafeChainProxyEnvironmentVariables } from "../../registryProxy/registryProxy.js"; +import { safeSpawn } from "../../utils/safeSpawn.js"; + +export async function runPnpmCommand(args, toolName = "pnpm") { + try { + let result; + if (toolName === "pnpm") { + result = await safeSpawn("pnpm", args, { + stdio: "inherit", + env: mergeSafeChainProxyEnvironmentVariables(process.env), + }); + } else if (toolName === "pnpx") { + result = await safeSpawn("pnpx", args, { + stdio: "inherit", + env: mergeSafeChainProxyEnvironmentVariables(process.env), + }); + } else { + throw new Error(`Unsupported tool name for aikido-pnpm: ${toolName}`); + } + + return { status: result.status }; + } catch (error) { + if (error.status) { + return { status: error.status }; + } else { + ui.writeError("Error executing command:", error.message); + return { status: 1 }; + } + } +} diff --git a/node_modules/@aikidosec/safe-chain/src/packagemanager/yarn/createPackageManager.js b/node_modules/@aikidosec/safe-chain/src/packagemanager/yarn/createPackageManager.js new file mode 100644 index 0000000..f49c763 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/packagemanager/yarn/createPackageManager.js @@ -0,0 +1,33 @@ +import { commandArgumentScanner } from "./dependencyScanner/commandArgumentScanner.js"; +import { runYarnCommand } from "./runYarnCommand.js"; + +const scanner = commandArgumentScanner(); + +export function createYarnPackageManager() { + return { + runCommand: runYarnCommand, + isSupportedCommand: (args) => + matchesCommand(args, "add") || + matchesCommand(args, "global", "add") || + matchesCommand(args, "install") || + matchesCommand(args, "up") || + matchesCommand(args, "upgrade") || + matchesCommand(args, "global", "upgrade") || + matchesCommand(args, "dlx"), + getDependencyUpdatesForCommand: (args) => scanner.scan(args), + }; +} + +function matchesCommand(args, ...commandArgs) { + if (args.length < commandArgs.length) { + return false; + } + + for (var i = 0; i < commandArgs.length; i++) { + if (args[i].toLowerCase() !== commandArgs[i].toLowerCase()) { + return false; + } + } + + return true; +} diff --git a/node_modules/@aikidosec/safe-chain/src/packagemanager/yarn/dependencyScanner/commandArgumentScanner.js b/node_modules/@aikidosec/safe-chain/src/packagemanager/yarn/dependencyScanner/commandArgumentScanner.js new file mode 100644 index 0000000..f5bdd9f --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/packagemanager/yarn/dependencyScanner/commandArgumentScanner.js @@ -0,0 +1,28 @@ +import { resolvePackageVersion } from "../../../api/npmApi.js"; +import { parsePackagesFromArguments } from "../parsing/parsePackagesFromArguments.js"; + +export function commandArgumentScanner() { + return { + scan: (args) => scanDependencies(args), + shouldScan: () => true, // There's no dry run for yarn, so we always scan + }; +} + +async function scanDependencies(args) { + const changes = []; + const packageUpdates = parsePackagesFromArguments(args); + + for (const packageUpdate of packageUpdates) { + var exactVersion = await resolvePackageVersion( + packageUpdate.name, + packageUpdate.version + ); + if (exactVersion) { + packageUpdate.version = exactVersion; + } + + changes.push({ ...packageUpdate, type: "add" }); + } + + return changes; +} diff --git a/node_modules/@aikidosec/safe-chain/src/packagemanager/yarn/parsing/parsePackagesFromArguments.js b/node_modules/@aikidosec/safe-chain/src/packagemanager/yarn/parsing/parsePackagesFromArguments.js new file mode 100644 index 0000000..7b0255e --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/packagemanager/yarn/parsing/parsePackagesFromArguments.js @@ -0,0 +1,104 @@ +export function parsePackagesFromArguments(args) { + const changes = []; + let defaultTag = "latest"; + + for (let i = 1; i < args.length; i++) { + const arg = args[i]; + const option = getOption(arg); + + if (option) { + // If the option has a parameter, skip the next argument as well + i += option.numberOfParameters; + + continue; + } + + const packageDetails = parsePackagename(arg, defaultTag); + if (packageDetails) { + changes.push(packageDetails); + } + } + + return changes; +} + +function getOption(arg) { + if (isOptionWithParameter(arg)) { + return { + name: arg, + numberOfParameters: 1, + }; + } + + // Arguments starting with "-" or "--" are considered options + // except for "--package=" which contains the package name + if (arg.startsWith("-")) { + return { + name: arg, + numberOfParameters: 0, + }; + } + + return undefined; +} + +function isOptionWithParameter(arg) { + const optionsWithParameters = [ + "--use-yarnrc", + "--link-folder", + "--global-folder", + "--modules-folder", + "--preferred-cache-folder", + "--cache-folder", + "--mutex", + "--cwd", + "--proxy", + "--https-proxy", + "--registry", + "--network-concurrency", + "--network-timeout", + "--scripts-prepend-node-path", + "--otp", + ]; + + return optionsWithParameters.includes(arg); +} + +function parsePackagename(arg, defaultTag) { + // format can be --package=name@version + // in that case, we need to remove the --package= part + if (arg.startsWith("--package=")) { + arg = arg.slice(10); + } + + arg = removeAlias(arg); + + // Split at the last "@" to separate the package name and version + const lastAtIndex = arg.lastIndexOf("@"); + + let name, version; + // The index of the last "@" should be greater than 0 + // If the index is 0, it means the package name starts with "@" (eg: "@vercel/otel") + if (lastAtIndex > 0) { + name = arg.slice(0, lastAtIndex); + version = arg.slice(lastAtIndex + 1); + } else { + name = arg; + version = defaultTag; // No tag specified (eg: "http-server"), use the default tag + } + + return { + name, + version, + }; +} + +function removeAlias(arg) { + // removes the alias. + // Eg.: server@npm:http-server@latest becomes http-server@latest + const aliasIndex = arg.indexOf("@npm:"); + if (aliasIndex !== -1) { + return arg.slice(aliasIndex + 5); + } + return arg; +} diff --git a/node_modules/@aikidosec/safe-chain/src/packagemanager/yarn/runYarnCommand.js b/node_modules/@aikidosec/safe-chain/src/packagemanager/yarn/runYarnCommand.js new file mode 100644 index 0000000..65c27a0 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/packagemanager/yarn/runYarnCommand.js @@ -0,0 +1,53 @@ +import { ui } from "../../environment/userInteraction.js"; +import { safeSpawn } from "../../utils/safeSpawn.js"; +import { mergeSafeChainProxyEnvironmentVariables } from "../../registryProxy/registryProxy.js"; + +export async function runYarnCommand(args) { + try { + const env = mergeSafeChainProxyEnvironmentVariables(process.env); + await fixYarnProxyEnvironmentVariables(env); + + const result = await safeSpawn("yarn", args, { + stdio: "inherit", + env, + }); + return { status: result.status }; + } catch (error) { + if (error.status) { + return { status: error.status }; + } else { + ui.writeError("Error executing command:", error.message); + return { status: 1 }; + } + } +} + +async function fixYarnProxyEnvironmentVariables(env) { + // Yarn ignores standard proxy environment variable HTTPS_PROXY + // It does respect NODE_EXTRA_CA_CERTS for custom CA certificates though. + // Don't use YARN_HTTPS_CA_FILE_PATH though, as it causes to ignore all system CAs + + // Yarn v2/v3 and v4+ use different environment variables for proxy and CA certs + // When setting all variables, yarn returns an error about conflicting variables + // - v2/v3: "Usage Error: Unrecognized or legacy configuration settings found: httpsCaFilePath" + // - v4+: "Usage Error: Unrecognized or legacy configuration settings found: caFilePath" + + const version = await yarnVersion(); + const majorVersion = parseInt(version.split(".")[0]); + + if (majorVersion >= 4) { + env.YARN_HTTPS_PROXY = env.HTTPS_PROXY; + } else if (majorVersion === 2 || majorVersion === 3) { + env.YARN_HTTPS_PROXY = env.HTTPS_PROXY; + } +} + +async function yarnVersion() { + const result = await safeSpawn("yarn", ["--version"], { + stdio: "pipe", + }); + if (result.status !== 0) { + throw new Error("Failed to get yarn version"); + } + return result.stdout.trim(); +} diff --git a/node_modules/@aikidosec/safe-chain/src/registryProxy/certUtils.js b/node_modules/@aikidosec/safe-chain/src/registryProxy/certUtils.js new file mode 100644 index 0000000..d5d414c --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/registryProxy/certUtils.js @@ -0,0 +1,114 @@ +import forge from "node-forge"; +import path from "path"; +import fs from "fs"; +import os from "os"; + +const certFolder = path.join(os.homedir(), ".safe-chain", "certs"); +const ca = loadCa(); + +const certCache = new Map(); + +export function getCaCertPath() { + return path.join(certFolder, "ca-cert.pem"); +} + +export function generateCertForHost(hostname) { + let existingCert = certCache.get(hostname); + if (existingCert) { + return existingCert; + } + + const keys = forge.pki.rsa.generateKeyPair(2048); + const cert = forge.pki.createCertificate(); + cert.publicKey = keys.publicKey; + cert.serialNumber = "01"; + cert.validity.notBefore = new Date(); + cert.validity.notAfter = new Date(); + cert.validity.notAfter.setHours(cert.validity.notBefore.getHours() + 1); + + const attrs = [{ name: "commonName", value: hostname }]; + cert.setSubject(attrs); + cert.setIssuer(ca.certificate.subject.attributes); + cert.setExtensions([ + { + name: "subjectAltName", + altNames: [ + { + type: 2, // DNS + value: hostname, + }, + ], + }, + { + name: "keyUsage", + digitalSignature: true, + keyEncipherment: true, + }, + ]); + cert.sign(ca.privateKey, forge.md.sha256.create()); + + const result = { + privateKey: forge.pki.privateKeyToPem(keys.privateKey), + certificate: forge.pki.certificateToPem(cert), + }; + + certCache.set(hostname, result); + + return result; +} + +function loadCa() { + const keyPath = path.join(certFolder, "ca-key.pem"); + const certPath = path.join(certFolder, "ca-cert.pem"); + + if (fs.existsSync(keyPath) && fs.existsSync(certPath)) { + const privateKeyPem = fs.readFileSync(keyPath, "utf8"); + const certPem = fs.readFileSync(certPath, "utf8"); + const privateKey = forge.pki.privateKeyFromPem(privateKeyPem); + const certificate = forge.pki.certificateFromPem(certPem); + + // Don't return a cert that is valid for less than 1 hour + const oneHourFromNow = new Date(Date.now() + 60 * 60 * 1000); + if (certificate.validity.notAfter > oneHourFromNow) { + return { privateKey, certificate }; + } + } + + const { privateKey, certificate } = generateCa(); + fs.mkdirSync(certFolder, { recursive: true }); + fs.writeFileSync(keyPath, forge.pki.privateKeyToPem(privateKey)); + fs.writeFileSync(certPath, forge.pki.certificateToPem(certificate)); + return { privateKey, certificate }; +} + +function generateCa() { + const keys = forge.pki.rsa.generateKeyPair(2048); + const cert = forge.pki.createCertificate(); + cert.publicKey = keys.publicKey; + cert.serialNumber = "01"; + cert.validity.notBefore = new Date(); + cert.validity.notAfter = new Date(); + cert.validity.notAfter.setDate(cert.validity.notBefore.getDate() + 1); + + const attrs = [{ name: "commonName", value: "safe-chain proxy" }]; + cert.setSubject(attrs); + cert.setIssuer(attrs); + cert.setExtensions([ + { + name: "basicConstraints", + cA: true, + }, + { + name: "keyUsage", + keyCertSign: true, + digitalSignature: true, + keyEncipherment: true, + }, + ]); + cert.sign(keys.privateKey, forge.md.sha256.create()); + + return { + privateKey: keys.privateKey, + certificate: cert, + }; +} diff --git a/node_modules/@aikidosec/safe-chain/src/registryProxy/mitmRequestHandler.js b/node_modules/@aikidosec/safe-chain/src/registryProxy/mitmRequestHandler.js new file mode 100644 index 0000000..fe8998e --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/registryProxy/mitmRequestHandler.js @@ -0,0 +1,123 @@ +import https from "https"; +import { generateCertForHost } from "./certUtils.js"; +import { HttpsProxyAgent } from "https-proxy-agent"; +import { ui } from "../environment/userInteraction.js"; + +export function mitmConnect(req, clientSocket, isAllowed) { + const { hostname } = new URL(`http://${req.url}`); + + clientSocket.on("error", () => { + // NO-OP + // This can happen if the client TCP socket sends RST instead of FIN. + // Not subscribing to 'close' event will cause node to throw and crash. + }); + + const server = createHttpsServer(hostname, isAllowed); + + server.on("error", (err) => { + ui.writeError(`Safe-chain: HTTPS server error: ${err.message}`); + if (!clientSocket.headersSent) { + clientSocket.end("HTTP/1.1 502 Bad Gateway\r\n\r\n"); + } else if (clientSocket.writable) { + clientSocket.end(); + } + }); + + // Establish the connection + clientSocket.write("HTTP/1.1 200 Connection Established\r\n\r\n"); + + // Hand off the socket to the HTTPS server + server.emit("connection", clientSocket); +} + +function createHttpsServer(hostname, isAllowed) { + const cert = generateCertForHost(hostname); + + async function handleRequest(req, res) { + const pathAndQuery = getRequestPathAndQuery(req.url); + const targetUrl = `https://${hostname}${pathAndQuery}`; + + if (!(await isAllowed(targetUrl))) { + res.writeHead(403, "Forbidden - blocked by safe-chain"); + res.end("Blocked by safe-chain"); + return; + } + + // Collect request body + forwardRequest(req, hostname, res); + } + + const server = https.createServer( + { + key: cert.privateKey, + cert: cert.certificate, + }, + handleRequest + ); + + return server; +} + +function getRequestPathAndQuery(url) { + if (url.startsWith("http://") || url.startsWith("https://")) { + const parsedUrl = new URL(url); + return parsedUrl.pathname + parsedUrl.search + parsedUrl.hash; + } + return url; +} + +function forwardRequest(req, hostname, res) { + const proxyReq = createProxyRequest(hostname, req, res); + + proxyReq.on("error", () => { + res.writeHead(502); + res.end("Bad Gateway"); + }); + + req.on("error", (err) => { + ui.writeError(`Safe-chain: Error reading client request: ${err.message}`); + proxyReq.destroy(); + }); + + req.on("data", (chunk) => { + proxyReq.write(chunk); + }); + + req.on("end", () => { + proxyReq.end(); + }); +} + +function createProxyRequest(hostname, req, res) { + const options = { + hostname: hostname, + port: 443, + path: req.url, + method: req.method, + headers: { ...req.headers }, + }; + + delete options.headers.host; + + const httpsProxy = process.env.HTTPS_PROXY || process.env.https_proxy; + if (httpsProxy) { + options.agent = new HttpsProxyAgent(httpsProxy); + } + + const proxyReq = https.request(options, (proxyRes) => { + proxyRes.on("error", (err) => { + ui.writeError( + `Safe-chain: Error reading upstream response: ${err.message}` + ); + if (!res.headersSent) { + res.writeHead(502); + res.end("Bad Gateway"); + } + }); + + res.writeHead(proxyRes.statusCode, proxyRes.headers); + proxyRes.pipe(res); + }); + + return proxyReq; +} diff --git a/node_modules/@aikidosec/safe-chain/src/registryProxy/parsePackageFromUrl.js b/node_modules/@aikidosec/safe-chain/src/registryProxy/parsePackageFromUrl.js new file mode 100644 index 0000000..7368b35 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/registryProxy/parsePackageFromUrl.js @@ -0,0 +1,48 @@ +export const knownRegistries = ["registry.npmjs.org", "registry.yarnpkg.com"]; + +export function parsePackageFromUrl(url) { + let packageName, version, registry; + + for (const knownRegistry of knownRegistries) { + if (url.includes(knownRegistry)) { + registry = knownRegistry; + break; + } + } + + if (!registry || !url.endsWith(".tgz")) { + return { packageName, version }; + } + + const registryIndex = url.indexOf(registry); + const afterRegistry = url.substring(registryIndex + registry.length + 1); // +1 to skip the slash + + const separatorIndex = afterRegistry.indexOf("/-/"); + if (separatorIndex === -1) { + return { packageName, version }; + } + + packageName = afterRegistry.substring(0, separatorIndex); + const filename = afterRegistry.substring( + separatorIndex + 3, + afterRegistry.length - 4 + ); // Remove /-/ and .tgz + + // Extract version from filename + // For scoped packages like @babel/core, the filename is core-7.21.4.tgz + // For regular packages like lodash, the filename is lodash-4.17.21.tgz + if (packageName.startsWith("@")) { + const scopedPackageName = packageName.substring( + packageName.lastIndexOf("/") + 1 + ); + if (filename.startsWith(scopedPackageName + "-")) { + version = filename.substring(scopedPackageName.length + 1); + } + } else { + if (filename.startsWith(packageName + "-")) { + version = filename.substring(packageName.length + 1); + } + } + + return { packageName, version }; +} diff --git a/node_modules/@aikidosec/safe-chain/src/registryProxy/plainHttpProxy.js b/node_modules/@aikidosec/safe-chain/src/registryProxy/plainHttpProxy.js new file mode 100644 index 0000000..ac3dc69 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/registryProxy/plainHttpProxy.js @@ -0,0 +1,74 @@ +import * as http from "http"; +import * as https from "https"; + +export function handleHttpProxyRequest(req, res) { + const url = new URL(req.url); + + // The protocol for the plainHttpProxy should usually only be http: + // but when the client for some reason sends an https: request directly + // instead of using the CONNECT method, we should handle it gracefully. + let protocol; + if (url.protocol === "http:") { + protocol = http; + } else if (url.protocol === "https:") { + protocol = https; + } else { + res.writeHead(502); + res.end(`Bad Gateway: Unsupported protocol ${url.protocol}`); + return; + } + + const proxyRequest = protocol + .request( + req.url, + { method: req.method, headers: req.headers }, + (proxyRes) => { + res.writeHead(proxyRes.statusCode, proxyRes.headers); + proxyRes.pipe(res); + + proxyRes.on("error", () => { + // Proxy response stream error + // Clean up client response stream + if (res.writable) { + res.end(); + } + }); + + proxyRes.on("close", () => { + // Clean up if the proxy response stream closes + if (res.writable) { + res.end(); + } + }); + } + ) + .on("error", (err) => { + if (!res.headersSent) { + res.writeHead(502); + res.end(`Bad Gateway: ${err.message}`); + } else { + // Headers already sent, just destroy the response + res.destroy(); + } + }); + + req.on("error", () => { + // Client request stream error + // Abort the proxy request + proxyRequest.destroy(); + }); + + res.on("error", () => { + // Client response stream error (client disconnected) + // Clean up proxy streams + proxyRequest.destroy(); + }); + + res.on("close", () => { + // Client disconnected + // Abort the proxy request to avoid unnecessary work + proxyRequest.destroy(); + }); + + req.pipe(proxyRequest); +} diff --git a/node_modules/@aikidosec/safe-chain/src/registryProxy/registryProxy.js b/node_modules/@aikidosec/safe-chain/src/registryProxy/registryProxy.js new file mode 100644 index 0000000..887fd47 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/registryProxy/registryProxy.js @@ -0,0 +1,160 @@ +import * as http from "http"; +import { tunnelRequest } from "./tunnelRequestHandler.js"; +import { mitmConnect } from "./mitmRequestHandler.js"; +import { handleHttpProxyRequest } from "./plainHttpProxy.js"; +import { getCaCertPath } from "./certUtils.js"; +import { auditChanges } from "../scanning/audit/index.js"; +import { knownRegistries, parsePackageFromUrl } from "./parsePackageFromUrl.js"; +import { ui } from "../environment/userInteraction.js"; +import chalk from "chalk"; + +const SERVER_STOP_TIMEOUT_MS = 1000; +const state = { + port: null, + blockedRequests: [], +}; + +export function createSafeChainProxy() { + const server = createProxyServer(); + + return { + startServer: () => startServer(server), + stopServer: () => stopServer(server), + verifyNoMaliciousPackages, + }; +} + +function getSafeChainProxyEnvironmentVariables() { + if (!state.port) { + return {}; + } + + return { + HTTPS_PROXY: `http://localhost:${state.port}`, + GLOBAL_AGENT_HTTP_PROXY: `http://localhost:${state.port}`, + NODE_EXTRA_CA_CERTS: getCaCertPath(), + }; +} + +export function mergeSafeChainProxyEnvironmentVariables(env) { + const proxyEnv = getSafeChainProxyEnvironmentVariables(); + + for (const key of Object.keys(env)) { + // If we were to simply copy all env variables, we might overwrite + // the proxy settings set by safe-chain when casing varies (e.g. http_proxy vs HTTP_PROXY) + // So we only copy the variable if it's not already set in a different case + const upperKey = key.toUpperCase(); + + if (!proxyEnv[upperKey]) { + proxyEnv[key] = env[key]; + } + } + + return proxyEnv; +} + +function createProxyServer() { + const server = http.createServer( + // This handles direct HTTP requests (non-CONNECT requests) + // This is normally http-only traffic, but we also handle + // https for clients that don't properly use CONNECT + handleHttpProxyRequest + ); + + // This handles HTTPS requests via the CONNECT method + server.on("connect", handleConnect); + + return server; +} + +function startServer(server) { + return new Promise((resolve, reject) => { + // Passing port 0 makes the OS assign an available port + server.listen(0, () => { + const address = server.address(); + if (address && typeof address === "object") { + state.port = address.port; + resolve(); + } else { + reject(new Error("Failed to start proxy server")); + } + }); + + server.on("error", (err) => { + reject(err); + }); + }); +} + +function stopServer(server) { + return new Promise((resolve) => { + try { + server.close(() => { + resolve(); + }); + } catch { + resolve(); + } + setTimeout(() => resolve(), SERVER_STOP_TIMEOUT_MS); + }); +} + +function handleConnect(req, clientSocket, head) { + // CONNECT method is used for HTTPS requests + // It establishes a tunnel to the server identified by the request URL + + if (knownRegistries.some((reg) => req.url.includes(reg))) { + // For npm and yarn registries, we want to intercept and inspect the traffic + // so we can block packages with malware + mitmConnect(req, clientSocket, isAllowedUrl); + } else { + // For other hosts, just tunnel the request to the destination tcp socket + tunnelRequest(req, clientSocket, head); + } +} + +async function isAllowedUrl(url) { + const { packageName, version } = parsePackageFromUrl(url); + + // packageName and version are undefined when the URL is not a package download + // In that case, we can allow the request to proceed + if (!packageName || !version) { + return true; + } + + const auditResult = await auditChanges([ + { name: packageName, version, type: "add" }, + ]); + + if (!auditResult.isAllowed) { + state.blockedRequests.push({ packageName, version, url }); + return false; + } + + return true; +} + +function verifyNoMaliciousPackages() { + if (state.blockedRequests.length === 0) { + // No malicious packages were blocked, so nothing to block + return true; + } + + ui.emptyLine(); + + ui.writeInformation( + `Safe-chain: ${chalk.bold( + `blocked ${state.blockedRequests.length} malicious package downloads` + )}:` + ); + + for (const req of state.blockedRequests) { + ui.writeInformation(` - ${req.packageName}@${req.version} (${req.url})`); + } + + ui.emptyLine(); + ui.writeExitWithoutInstallingMaliciousPackages(); + ui.emptyLine(); + + return false; +} diff --git a/node_modules/@aikidosec/safe-chain/src/registryProxy/tunnelRequestHandler.js b/node_modules/@aikidosec/safe-chain/src/registryProxy/tunnelRequestHandler.js new file mode 100644 index 0000000..5c764f5 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/registryProxy/tunnelRequestHandler.js @@ -0,0 +1,123 @@ +import * as net from "net"; +import { ui } from "../environment/userInteraction.js"; + +export function tunnelRequest(req, clientSocket, head) { + const httpsProxy = process.env.HTTPS_PROXY || process.env.https_proxy; + + if (httpsProxy) { + // If an HTTPS proxy is set, tunnel the request via the proxy + // This is the system proxy, not the safe-chain proxy + // The package manager will run via the safe-chain proxy + // The safe-chain proxy will then send the request to the system proxy + // Typical flow: package manager -> safe-chain proxy -> system proxy -> destination + + // There are 2 processes involved in this: + // 1. Safe-chain process: has HTTPS_PROXY set to system proxy + // 2. Package manager process: has HTTPS_PROXY set to safe-chain proxy + + tunnelRequestViaProxy(req, clientSocket, head, httpsProxy); + } else { + tunnelRequestToDestination(req, clientSocket, head); + } +} + +function tunnelRequestToDestination(req, clientSocket, head) { + const { port, hostname } = new URL(`http://${req.url}`); + + const serverSocket = net.connect(port || 443, hostname, () => { + clientSocket.write("HTTP/1.1 200 Connection Established\r\n\r\n"); + serverSocket.write(head); + serverSocket.pipe(clientSocket); + clientSocket.pipe(serverSocket); + }); + + clientSocket.on("error", () => { + // This can happen if the client TCP socket sends RST instead of FIN. + // Not subscribing to 'error' event will cause node to throw and crash. + if (serverSocket.writable) { + serverSocket.end(); + } + }); + + serverSocket.on("error", (err) => { + ui.writeError( + `Safe-chain: error connecting to ${hostname}:${port} - ${err.message}` + ); + if (clientSocket.writable) { + clientSocket.end("HTTP/1.1 502 Bad Gateway\r\n\r\n"); + } + }); +} + +function tunnelRequestViaProxy(req, clientSocket, head, proxyUrl) { + const { port, hostname } = new URL(`http://${req.url}`); + const proxy = new URL(proxyUrl); + + // Connect to proxy server + const proxySocket = net.connect({ + host: proxy.hostname, + port: proxy.port, + }); + + proxySocket.on("connect", () => { + // Send CONNECT request to proxy + const connectRequest = [ + `CONNECT ${hostname}:${port || 443} HTTP/1.1`, + `Host: ${hostname}:${port || 443}`, + "", + "", + ].join("\r\n"); + + proxySocket.write(connectRequest); + }); + + let isConnected = false; + proxySocket.once("data", (data) => { + const response = data.toString(); + + // Check if CONNECT succeeded (HTTP/1.1 200) + if (response.startsWith("HTTP/1.1 200")) { + isConnected = true; + clientSocket.write("HTTP/1.1 200 Connection Established\r\n\r\n"); + proxySocket.write(head); + proxySocket.pipe(clientSocket); + clientSocket.pipe(proxySocket); + } else { + ui.writeError( + `Safe-chain: proxy CONNECT failed: ${response.split("\r\n")[0]}` + ); + if (clientSocket.writable) { + clientSocket.end("HTTP/1.1 502 Bad Gateway\r\n\r\n"); + } + if (proxySocket.writable) { + proxySocket.end(); + } + } + }); + + proxySocket.on("error", (err) => { + if (!isConnected) { + ui.writeError( + `Safe-chain: error connecting to proxy ${proxy.hostname}:${ + proxy.port || 8080 + } - ${err.message}` + ); + if (clientSocket.writable) { + clientSocket.end("HTTP/1.1 502 Bad Gateway\r\n\r\n"); + } + } else { + ui.writeError( + `Safe-chain: proxy socket error after connection - ${err.message}` + ); + if (clientSocket.writable) { + clientSocket.end(); + } + } + }); + + clientSocket.on("error", () => { + if (proxySocket.writable) { + proxySocket.end(); + } + }); +} diff --git a/node_modules/@aikidosec/safe-chain/src/scanning/audit/index.js b/node_modules/@aikidosec/safe-chain/src/scanning/audit/index.js new file mode 100644 index 0000000..215bfa0 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/scanning/audit/index.js @@ -0,0 +1,56 @@ +import { + MALWARE_STATUS_MALWARE, + openMalwareDatabase, +} from "../malwareDatabase.js"; + +export async function auditChanges(changes) { + const allowedChanges = []; + const disallowedChanges = []; + + var malwarePackages = await getPackagesWithMalware( + changes.filter( + (change) => change.type === "add" || change.type === "change" + ) + ); + + for (const change of changes) { + const malwarePackage = malwarePackages.find( + (pkg) => pkg.name === change.name && pkg.version === change.version + ); + + if (malwarePackage) { + disallowedChanges.push({ ...change, reason: malwarePackage.status }); + } else { + allowedChanges.push(change); + } + } + + const auditResults = { + allowedChanges, + disallowedChanges, + isAllowed: disallowedChanges.length === 0, + }; + + return auditResults; +} + +async function getPackagesWithMalware(changes) { + if (changes.length === 0) { + return []; + } + + const malwareDb = await openMalwareDatabase(); + let allVulnerablePackages = []; + + for (const change of changes) { + if (malwareDb.isMalware(change.name, change.version)) { + allVulnerablePackages.push({ + name: change.name, + version: change.version, + status: MALWARE_STATUS_MALWARE, + }); + } + } + + return allVulnerablePackages; +} diff --git a/node_modules/@aikidosec/safe-chain/src/scanning/index.js b/node_modules/@aikidosec/safe-chain/src/scanning/index.js new file mode 100644 index 0000000..969c994 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/scanning/index.js @@ -0,0 +1,84 @@ +import { auditChanges } from "./audit/index.js"; +import { getScanTimeout } from "../config/configFile.js"; +import { setTimeout } from "timers/promises"; +import chalk from "chalk"; +import { getPackageManager } from "../packagemanager/currentPackageManager.js"; +import { ui } from "../environment/userInteraction.js"; + +export function shouldScanCommand(args) { + if (!args || args.length === 0) { + return false; + } + + return getPackageManager().isSupportedCommand(args); +} + +export async function scanCommand(args) { + if (!shouldScanCommand(args)) { + return []; + } + + let timedOut = false; + + const spinner = ui.startProcess( + "Safe-chain: Scanning for malicious packages..." + ); + let audit; + + await Promise.race([ + (async () => { + try { + const packageManager = getPackageManager(); + const changes = await packageManager.getDependencyUpdatesForCommand( + args + ); + + if (timedOut) { + return; + } + + if (changes.length > 0) { + spinner.setText( + `Safe-chain: Scanning ${changes.length} package(s)...` + ); + } + + audit = await auditChanges(changes); + } catch (error) { + spinner.fail(`Safe-chain: Error while scanning.`); + throw error; + } + })(), + setTimeout(getScanTimeout()).then(() => { + timedOut = true; + }), + ]); + + if (timedOut) { + spinner.fail("Safe-chain: Timeout exceeded while scanning."); + throw new Error("Timeout exceeded while scanning npm install command."); + } + + if (!audit || audit.isAllowed) { + spinner.stop(); + return 0; + } else { + printMaliciousChanges(audit.disallowedChanges, spinner); + onMalwareFound(); + return 1; + } +} + +function printMaliciousChanges(changes, spinner) { + spinner.fail("Safe-chain: " + chalk.bold("Malicious changes detected:")); + + for (const change of changes) { + ui.writeInformation(` - ${change.name}@${change.version}`); + } +} + +function onMalwareFound() { + ui.emptyLine(); + ui.writeExitWithoutInstallingMaliciousPackages(); + ui.emptyLine(); +} diff --git a/node_modules/@aikidosec/safe-chain/src/scanning/malwareDatabase.js b/node_modules/@aikidosec/safe-chain/src/scanning/malwareDatabase.js new file mode 100644 index 0000000..1cb781b --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/scanning/malwareDatabase.js @@ -0,0 +1,81 @@ +import { + fetchMalwareDatabase, + fetchMalwareDatabaseVersion, +} from "../api/aikido.js"; +import { + readDatabaseFromLocalCache, + writeDatabaseToLocalCache, +} from "../config/configFile.js"; +import { ui } from "../environment/userInteraction.js"; + +let cachedMalwareDatabase = null; + +export async function openMalwareDatabase() { + if (cachedMalwareDatabase) { + return cachedMalwareDatabase; + } + + const malwareDatabase = await getMalwareDatabase(); + + function getPackageStatus(name, version) { + const packageData = malwareDatabase.find( + (pkg) => + pkg.package_name === name && + (pkg.version === version || pkg.version === "*") + ); + + if (!packageData) { + return MALWARE_STATUS_OK; + } + + return packageData.reason; + } + + // This implicitely caches the malware database + // that's closed over by the getPackageStatus function + cachedMalwareDatabase = { + getPackageStatus, + isMalware: (name, version) => { + const status = getPackageStatus(name, version); + return isMalwareStatus(status); + }, + }; + return cachedMalwareDatabase; +} + +async function getMalwareDatabase() { + const { malwareDatabase: cachedDatabase, version: cachedVersion } = + readDatabaseFromLocalCache(); + + try { + if (cachedDatabase) { + const currentVersion = await fetchMalwareDatabaseVersion(); + if (cachedVersion === currentVersion) { + return cachedDatabase; + } + } + + const { malwareDatabase, version } = await fetchMalwareDatabase(); + writeDatabaseToLocalCache(malwareDatabase, version); + + return malwareDatabase; + } catch (error) { + if (cachedDatabase) { + ui.writeWarning( + "Failed to fetch the latest malware database. Using cached version." + ); + return cachedDatabase; + } + throw error; + } +} + +function isMalwareStatus(status) { + let malwareStatus = status.toUpperCase(); + return malwareStatus === MALWARE_STATUS_MALWARE; +} + +export const MALWARE_STATUS_OK = "OK"; +export const MALWARE_STATUS_MALWARE = "MALWARE"; +export const MALWARE_STATUS_TELEMETRY = "TELEMETRY"; +export const MALWARE_STATUS_PROTESTWARE = "PROTESTWARE"; diff --git a/node_modules/@aikidosec/safe-chain/src/shell-integration/helpers.js b/node_modules/@aikidosec/safe-chain/src/shell-integration/helpers.js new file mode 100644 index 0000000..2345022 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/shell-integration/helpers.js @@ -0,0 +1,106 @@ +import { spawnSync } from "child_process"; +import * as os from "os"; +import fs from "fs"; +import path from "path"; + +export const knownAikidoTools = [ + { tool: "npm", aikidoCommand: "aikido-npm" }, + { tool: "npx", aikidoCommand: "aikido-npx" }, + { tool: "yarn", aikidoCommand: "aikido-yarn" }, + { tool: "pnpm", aikidoCommand: "aikido-pnpm" }, + { tool: "pnpx", aikidoCommand: "aikido-pnpx" }, + { tool: "bun", aikidoCommand: "aikido-bun" }, + { tool: "bunx", aikidoCommand: "aikido-bunx" }, + // When adding a new tool here, also update the documentation for the new tool in the README.md +]; + +/** + * Returns a formatted string listing all supported package managers. + * Example: "npm, npx, yarn, pnpm, and pnpx commands" + */ +export function getPackageManagerList() { + const tools = knownAikidoTools.map((t) => t.tool); + if (tools.length <= 1) { + return `${tools[0] || ""} commands`; + } + if (tools.length === 2) { + return `${tools[0]} and ${tools[1]} commands`; + } + const lastTool = tools.pop(); + return `${tools.join(", ")}, and ${lastTool} commands`; +} + +export function doesExecutableExistOnSystem(executableName) { + if (os.platform() === "win32") { + const result = spawnSync("where", [executableName], { stdio: "ignore" }); + return result.status === 0; + } else { + const result = spawnSync("which", [executableName], { stdio: "ignore" }); + return result.status === 0; + } +} + +export function removeLinesMatchingPattern(filePath, pattern, eol) { + if (!fs.existsSync(filePath)) { + return; + } + + eol = eol || os.EOL; + + const fileContent = fs.readFileSync(filePath, "utf-8"); + const lines = fileContent.split(/\r?\n|\r|\u2028|\u2029/); + const updatedLines = lines.filter((line) => !shouldRemoveLine(line, pattern)); + fs.writeFileSync(filePath, updatedLines.join(eol), "utf-8"); +} + +const maxLineLength = 100; +function shouldRemoveLine(line, pattern) { + const isPatternMatch = pattern.test(line); + + if (!isPatternMatch) { + return false; + } + + if (line.length > maxLineLength) { + // safe-chain only adds lines shorter than maxLineLength + // so if the line is longer, it must be from a different + // source and could be dangerous to remove + return false; + } + + if ( + line.includes("\n") || + line.includes("\r") || + line.includes("\u2028") || + line.includes("\u2029") + ) { + // If the line contains newlines, something has gone wrong in splitting + // \u2028 and \u2029 are Unicode line separator characters (line and paragraph separators) + return false; + } + + return true; +} + +export function addLineToFile(filePath, line, eol) { + createFileIfNotExists(filePath); + + eol = eol || os.EOL; + + const fileContent = fs.readFileSync(filePath, "utf-8"); + const updatedContent = fileContent + eol + line + eol; + fs.writeFileSync(filePath, updatedContent, "utf-8"); +} + +function createFileIfNotExists(filePath) { + if (fs.existsSync(filePath)) { + return; + } + + const dir = path.dirname(filePath); + if (!fs.existsSync(dir)) { + fs.mkdirSync(dir, { recursive: true }); + } + + fs.writeFileSync(filePath, "", "utf-8"); +} diff --git a/node_modules/@aikidosec/safe-chain/src/shell-integration/path-wrappers/templates/unix-wrapper.template.sh b/node_modules/@aikidosec/safe-chain/src/shell-integration/path-wrappers/templates/unix-wrapper.template.sh new file mode 100644 index 0000000..6e6d826 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/shell-integration/path-wrappers/templates/unix-wrapper.template.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# Generated wrapper for {{PACKAGE_MANAGER}} by safe-chain +# This wrapper intercepts {{PACKAGE_MANAGER}} calls for non-interactive environments + +# Function to remove shim from PATH (POSIX-compliant) +remove_shim_from_path() { + echo "$PATH" | sed "s|$HOME/.safe-chain/shims:||g" +} + +if command -v {{AIKIDO_COMMAND}} >/dev/null 2>&1; then + # Remove shim directory from PATH when calling {{AIKIDO_COMMAND}} to prevent infinite loops + PATH=$(remove_shim_from_path) exec {{AIKIDO_COMMAND}} "$@" +else + # Dynamically find original {{PACKAGE_MANAGER}} (excluding this shim directory) + original_cmd=$(PATH=$(remove_shim_from_path) command -v {{PACKAGE_MANAGER}}) + if [ -n "$original_cmd" ]; then + exec "$original_cmd" "$@" + else + echo "Error: Could not find original {{PACKAGE_MANAGER}}" >&2 + exit 1 + fi +fi \ No newline at end of file diff --git a/node_modules/@aikidosec/safe-chain/src/shell-integration/path-wrappers/templates/windows-wrapper.template.cmd b/node_modules/@aikidosec/safe-chain/src/shell-integration/path-wrappers/templates/windows-wrapper.template.cmd new file mode 100644 index 0000000..b7a65fa --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/shell-integration/path-wrappers/templates/windows-wrapper.template.cmd @@ -0,0 +1,24 @@ +@echo off +REM Generated wrapper for {{PACKAGE_MANAGER}} by safe-chain +REM This wrapper intercepts {{PACKAGE_MANAGER}} calls for non-interactive environments + +REM Remove shim directory from PATH to prevent infinite loops +set "SHIM_DIR=%USERPROFILE%\.safe-chain\shims" +call set "CLEAN_PATH=%%PATH:%SHIM_DIR%;=%%" + +REM Check if aikido command is available with clean PATH +set "PATH=%CLEAN_PATH%" & where {{AIKIDO_COMMAND}} >nul 2>&1 +if %errorlevel%==0 ( + REM Call aikido command with clean PATH + set "PATH=%CLEAN_PATH%" & {{AIKIDO_COMMAND}} %* +) else ( + REM Find the original command with clean PATH + for /f "tokens=*" %%i in ('set "PATH=%CLEAN_PATH%" ^& where {{PACKAGE_MANAGER}} 2^>nul') do ( + "%%i" %* + goto :eof + ) + + REM If we get here, original command was not found + echo Error: Could not find original {{PACKAGE_MANAGER}} >&2 + exit /b 1 +) \ No newline at end of file diff --git a/node_modules/@aikidosec/safe-chain/src/shell-integration/setup-ci.js b/node_modules/@aikidosec/safe-chain/src/shell-integration/setup-ci.js new file mode 100644 index 0000000..0449ac4 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/shell-integration/setup-ci.js @@ -0,0 +1,123 @@ +import chalk from "chalk"; +import { ui } from "../environment/userInteraction.js"; +import { knownAikidoTools, getPackageManagerList } from "./helpers.js"; +import fs from "fs"; +import os from "os"; +import path from "path"; +import { fileURLToPath } from "url"; + +/** + * Loops over the detected shells and calls the setup function for each. + */ +export async function setupCi() { + ui.writeInformation( + chalk.bold("Setting up shell aliases.") + + ` This will wrap safe-chain around ${getPackageManagerList()}.` + ); + ui.emptyLine(); + + const shimsDir = path.join(os.homedir(), ".safe-chain", "shims"); + // Create the shims directory if it doesn't exist + if (!fs.existsSync(shimsDir)) { + fs.mkdirSync(shimsDir, { recursive: true }); + } + + createShims(shimsDir); + ui.writeInformation(`Created shims in ${shimsDir}`); + modifyPathForCi(shimsDir); + ui.writeInformation(`Added shims directory to PATH for CI environments.`); +} + +function createUnixShims(shimsDir) { + // Read the template file + const __filename = fileURLToPath(import.meta.url); + const __dirname = path.dirname(__filename); + const templatePath = path.resolve( + __dirname, + "path-wrappers", + "templates", + "unix-wrapper.template.sh" + ); + + if (!fs.existsSync(templatePath)) { + ui.writeError(`Template file not found: ${templatePath}`); + return; + } + + const template = fs.readFileSync(templatePath, "utf-8"); + + // Create a shim for each tool + for (const toolInfo of knownAikidoTools) { + const shimContent = template + .replaceAll("{{PACKAGE_MANAGER}}", toolInfo.tool) + .replaceAll("{{AIKIDO_COMMAND}}", toolInfo.aikidoCommand); + + const shimPath = path.join(shimsDir, toolInfo.tool); + fs.writeFileSync(shimPath, shimContent, "utf-8"); + + // Make the shim executable on Unix systems + fs.chmodSync(shimPath, 0o755); + } + + ui.writeInformation( + `Created ${knownAikidoTools.length} Unix shim(s) in ${shimsDir}` + ); +} + +function createWindowsShims(shimsDir) { + // Read the template file + const __filename = fileURLToPath(import.meta.url); + const __dirname = path.dirname(__filename); + const templatePath = path.resolve( + __dirname, + "path-wrappers", + "templates", + "windows-wrapper.template.cmd" + ); + + if (!fs.existsSync(templatePath)) { + ui.writeError(`Windows template file not found: ${templatePath}`); + return; + } + + const template = fs.readFileSync(templatePath, "utf-8"); + + // Create a shim for each tool + for (const toolInfo of knownAikidoTools) { + const shimContent = template + .replaceAll("{{PACKAGE_MANAGER}}", toolInfo.tool) + .replaceAll("{{AIKIDO_COMMAND}}", toolInfo.aikidoCommand); + + const shimPath = path.join(shimsDir, `${toolInfo.tool}.cmd`); + fs.writeFileSync(shimPath, shimContent, "utf-8"); + } + + ui.writeInformation( + `Created ${knownAikidoTools.length} Windows shim(s) in ${shimsDir}` + ); +} + +function createShims(shimsDir) { + if (os.platform() === "win32") { + createWindowsShims(shimsDir); + } else { + createUnixShims(shimsDir); + } +} + +function modifyPathForCi(shimsDir) { + if (process.env.GITHUB_PATH) { + // In GitHub Actions, append the shims directory to GITHUB_PATH + fs.appendFileSync(process.env.GITHUB_PATH, shimsDir + os.EOL, "utf-8"); + ui.writeInformation( + `Added shims directory to GITHUB_PATH for GitHub Actions.` + ); + } + + if (process.env.TF_BUILD) { + // In Azure Pipelines, prepending the path is done via a logging command: + // ##vso[task.prependpath]/path/to/add + // Logging this to stdout will cause the Azure Pipelines agent to pick it up + ui.writeInformation("##vso[task.prependpath]" + shimsDir); + } +} diff --git a/node_modules/@aikidosec/safe-chain/src/shell-integration/setup.js b/node_modules/@aikidosec/safe-chain/src/shell-integration/setup.js new file mode 100644 index 0000000..afa96e8 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/shell-integration/setup.js @@ -0,0 +1,109 @@ +import chalk from "chalk"; +import { ui } from "../environment/userInteraction.js"; +import { detectShells } from "./shellDetection.js"; +import { knownAikidoTools, getPackageManagerList } from "./helpers.js"; +import fs from "fs"; +import os from "os"; +import path from "path"; +import { fileURLToPath } from "url"; + +/** + * Loops over the detected shells and calls the setup function for each. + */ +export async function setup() { + ui.writeInformation( + chalk.bold("Setting up shell aliases.") + + ` This will wrap safe-chain around ${getPackageManagerList()}.` + ); + ui.emptyLine(); + + copyStartupFiles(); + + try { + const shells = detectShells(); + if (shells.length === 0) { + ui.writeError("No supported shells detected. Cannot set up aliases."); + return; + } + + ui.writeInformation( + `Detected ${shells.length} supported shell(s): ${shells + .map((shell) => chalk.bold(shell.name)) + .join(", ")}.` + ); + + let updatedCount = 0; + for (const shell of shells) { + if (setupShell(shell)) { + updatedCount++; + } + } + + if (updatedCount > 0) { + ui.emptyLine(); + ui.writeInformation(`Please restart your terminal to apply the changes.`); + } + } catch (error) { + ui.writeError( + `Failed to set up shell aliases: ${error.message}. Please check your shell configuration.` + ); + return; + } +} + +/** + * Calls the setup function for the given shell and reports the result. + */ +function setupShell(shell) { + let success = false; + let error; + try { + shell.teardown(knownAikidoTools); // First, tear down to prevent duplicate aliases + success = shell.setup(knownAikidoTools); + } catch (err) { + success = false; + error = err; + } + + if (success) { + ui.writeInformation( + `${chalk.bold("- " + shell.name + ":")} ${chalk.green( + "Setup successful" + )}` + ); + } else { + ui.writeError( + `${chalk.bold("- " + shell.name + ":")} ${chalk.red( + "Setup failed" + )}. Please check your ${shell.name} configuration.` + ); + if (error) { + let message = ` Error: ${error.message}`; + if (error.code) { + message += ` (code: ${error.code})`; + } + ui.writeError(message); + } + } + + return success; +} + +function copyStartupFiles() { + const startupFiles = ["init-posix.sh", "init-pwsh.ps1", "init-fish.fish"]; + + for (const file of startupFiles) { + const targetDir = path.join(os.homedir(), ".safe-chain", "scripts"); + const targetPath = path.join(os.homedir(), ".safe-chain", "scripts", file); + + if (!fs.existsSync(targetDir)) { + fs.mkdirSync(targetDir, { recursive: true }); + } + + // Use absolute path for source + const __filename = fileURLToPath(import.meta.url); + const __dirname = path.dirname(__filename); + const sourcePath = path.resolve(__dirname, "startup-scripts", file); + fs.copyFileSync(sourcePath, targetPath); + } +} diff --git a/node_modules/@aikidosec/safe-chain/src/shell-integration/shellDetection.js b/node_modules/@aikidosec/safe-chain/src/shell-integration/shellDetection.js new file mode 100644 index 0000000..d868f6f --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/shell-integration/shellDetection.js @@ -0,0 +1,26 @@ +import zsh from "./supported-shells/zsh.js"; +import bash from "./supported-shells/bash.js"; +import powershell from "./supported-shells/powershell.js"; +import windowsPowershell from "./supported-shells/windowsPowershell.js"; +import fish from "./supported-shells/fish.js"; +import { ui } from "../environment/userInteraction.js"; + +export function detectShells() { + let possibleShells = [zsh, bash, powershell, windowsPowershell, fish]; + let availableShells = []; + + try { + for (const shell of possibleShells) { + if (shell.isInstalled()) { + availableShells.push(shell); + } + } + } catch (error) { + ui.writeError( + `We were not able to detect which shells are installed on your system. Please check your shell configuration. Error: ${error.message}` + ); + return []; + } + + return availableShells; +} diff --git a/node_modules/@aikidosec/safe-chain/src/shell-integration/startup-scripts/init-fish.fish b/node_modules/@aikidosec/safe-chain/src/shell-integration/startup-scripts/init-fish.fish new file mode 100644 index 0000000..29d6bf3 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/shell-integration/startup-scripts/init-fish.fish @@ -0,0 +1,70 @@ +function printSafeChainWarning + set original_cmd $argv[1] + + # Fish equivalent of ANSI color codes: yellow background, black text for "Warning:" + set_color -b yellow black + printf "Warning:" + set_color normal + printf " safe-chain is not available to protect you from installing malware. %s will run without it.\n" $original_cmd + + # Cyan text for the install command + printf "Install safe-chain by using " + set_color cyan + printf "npm install -g @aikidosec/safe-chain" + set_color normal + printf ".\n" +end + +function wrapSafeChainCommand + set original_cmd $argv[1] + set aikido_cmd $argv[2] + set cmd_args $argv[3..-1] + + if type -q $aikido_cmd + # If the aikido command is available, just run it with the provided arguments + $aikido_cmd $cmd_args + else + # If the aikido command is not available, print a warning and run the original command + printSafeChainWarning $original_cmd + command $original_cmd $cmd_args + end +end + +function npx + wrapSafeChainCommand "npx" "aikido-npx" $argv +end + +function yarn + wrapSafeChainCommand "yarn" "aikido-yarn" $argv +end + +function pnpm + wrapSafeChainCommand "pnpm" "aikido-pnpm" $argv +end + +function pnpx + wrapSafeChainCommand "pnpx" "aikido-pnpx" $argv +end + +function bun + wrapSafeChainCommand "bun" "aikido-bun" $argv +end + +function bunx + wrapSafeChainCommand "bunx" "aikido-bunx" $argv +end + +function npm + # If args is just -v or --version and nothing else, just run the `npm -v` command + # This is because nvm uses this to check the version of npm + set argc (count $argv) + if test $argc -eq 1 + switch $argv[1] + case "-v" "--version" + command npm $argv + return + end + end + + wrapSafeChainCommand "npm" "aikido-npm" $argv +end diff --git a/node_modules/@aikidosec/safe-chain/src/shell-integration/startup-scripts/init-posix.sh b/node_modules/@aikidosec/safe-chain/src/shell-integration/startup-scripts/init-posix.sh new file mode 100644 index 0000000..353c6c0 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/shell-integration/startup-scripts/init-posix.sh @@ -0,0 +1,62 @@ + +function printSafeChainWarning() { + # \033[43;30m is used to set the background color to yellow and text color to black + # \033[0m is used to reset the text formatting + printf "\033[43;30mWarning:\033[0m safe-chain is not available to protect you from installing malware. %s will run without it.\n" "$1" + # \033[36m is used to set the text color to cyan + printf "Install safe-chain by using \033[36mnpm install -g @aikidosec/safe-chain\033[0m.\n" +} + +function wrapSafeChainCommand() { + local original_cmd="$1" + local aikido_cmd="$2" + + # Remove the first 2 arguments (original_cmd and aikido_cmd) from $@ + # so that "$@" now contains only the arguments passed to the original command + shift 2 + + if command -v "$aikido_cmd" > /dev/null 2>&1; then + # If the aikido command is available, just run it with the provided arguments + "$aikido_cmd" "$@" + else + # If the aikido command is not available, print a warning and run the original command + printSafeChainWarning "$original_cmd" + + command "$original_cmd" "$@" + fi +} + +function npx() { + wrapSafeChainCommand "npx" "aikido-npx" "$@" +} + +function yarn() { + wrapSafeChainCommand "yarn" "aikido-yarn" "$@" +} + +function pnpm() { + wrapSafeChainCommand "pnpm" "aikido-pnpm" "$@" +} + +function pnpx() { + wrapSafeChainCommand "pnpx" "aikido-pnpx" "$@" +} + +function bun() { + wrapSafeChainCommand "bun" "aikido-bun" "$@" +} + +function bunx() { + wrapSafeChainCommand "bunx" "aikido-bunx" "$@" +} + +function npm() { + if [[ "$1" == "-v" || "$1" == "--version" ]] && [[ $# -eq 1 ]]; then + # If args is just -v or --version and nothing else, just run the npm version command + # This is because nvm uses this to check the version of npm + command npm "$@" + return + fi + + wrapSafeChainCommand "npm" "aikido-npm" "$@" +} diff --git a/node_modules/@aikidosec/safe-chain/src/shell-integration/startup-scripts/init-pwsh.ps1 b/node_modules/@aikidosec/safe-chain/src/shell-integration/startup-scripts/init-pwsh.ps1 new file mode 100644 index 0000000..a449405 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/shell-integration/startup-scripts/init-pwsh.ps1 @@ -0,0 +1,88 @@ +function Write-SafeChainWarning { + param([string]$Command) + + # PowerShell equivalent of ANSI color codes: yellow background, black text for "Warning:" + Write-Host "Warning:" -BackgroundColor Yellow -ForegroundColor Black -NoNewline + Write-Host " safe-chain is not available to protect you from installing malware. $Command will run without it." + + # Cyan text for the install command + Write-Host "Install safe-chain by using " -NoNewline + Write-Host "npm install -g @aikidosec/safe-chain" -ForegroundColor Cyan -NoNewline + Write-Host "." +} + +function Test-CommandAvailable { + param([string]$Command) + + try { + Get-Command $Command -ErrorAction Stop | Out-Null + return $true + } + catch { + return $false + } +} + +function Invoke-RealCommand { + param( + [string]$Command, + [string[]]$Arguments + ) + + # Find the real executable to avoid calling our wrapped functions + $realCommand = Get-Command -Name $Command -CommandType Application | Select-Object -First 1 + if ($realCommand) { + & $realCommand.Source @Arguments + } +} + +function Invoke-WrappedCommand { + param( + [string]$OriginalCmd, + [string]$AikidoCmd, + [string[]]$Arguments + ) + + if (Test-CommandAvailable $AikidoCmd) { + & $AikidoCmd @Arguments + } + else { + Write-SafeChainWarning $OriginalCmd + Invoke-RealCommand $OriginalCmd $Arguments + } +} + +function npx { + Invoke-WrappedCommand "npx" "aikido-npx" $args +} + +function yarn { + Invoke-WrappedCommand "yarn" "aikido-yarn" $args +} + +function pnpm { + Invoke-WrappedCommand "pnpm" "aikido-pnpm" $args +} + +function pnpx { + Invoke-WrappedCommand "pnpx" "aikido-pnpx" $args +} + +function bun { + Invoke-WrappedCommand "bun" "aikido-bun" $args +} + +function bunx { + Invoke-WrappedCommand "bunx" "aikido-bunx" $args +} + +function npm { + # If args is just -v or --version and nothing else, just run the npm version command + # This is because nvm uses this to check the version of npm + if (($args.Length -eq 1) -and (($args[0] -eq "-v") -or ($args[0] -eq "--version"))) { + Invoke-RealCommand "npm" $args + return + } + + Invoke-WrappedCommand "npm" "aikido-npm" $args +} diff --git a/node_modules/@aikidosec/safe-chain/src/shell-integration/supported-shells/bash.js b/node_modules/@aikidosec/safe-chain/src/shell-integration/supported-shells/bash.js new file mode 100644 index 0000000..6038f95 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/shell-integration/supported-shells/bash.js @@ -0,0 +1,116 @@ +import { + addLineToFile, + doesExecutableExistOnSystem, + removeLinesMatchingPattern, +} from "../helpers.js"; +import { execSync, spawnSync } from "child_process"; +import * as os from "os"; + +const shellName = "Bash"; +const executableName = "bash"; +const startupFileCommand = "echo ~/.bashrc"; +const eol = "\n"; // When bash runs on Windows (e.g., Git Bash or WSL), it expects LF line endings. + +function isInstalled() { + return doesExecutableExistOnSystem(executableName); +} + +function teardown(tools) { + const startupFile = getStartupFile(); + + for (const { tool } of tools) { + // Remove any existing alias for the tool + removeLinesMatchingPattern( + startupFile, + new RegExp(`^alias\\s+${tool}=`), + eol + ); + } + + // Removes the line that sources the safe-chain bash initialization script (~/.aikido/scripts/init-posix.sh) + removeLinesMatchingPattern( + startupFile, + /^source\s+~\/\.safe-chain\/scripts\/init-posix\.sh/, + eol + ); + + return true; +} + +function setup() { + const startupFile = getStartupFile(); + + addLineToFile( + startupFile, + `source ~/.safe-chain/scripts/init-posix.sh # Safe-chain bash initialization script`, + eol + ); + + return true; +} + +function getStartupFile() { + try { + var path = execSync(startupFileCommand, { + encoding: "utf8", + shell: executableName, + }).trim(); + + return windowsFixPath(path); + } catch (error) { + throw new Error( + `Command failed: ${startupFileCommand}. Error: ${error.message}` + ); + } +} + +function windowsFixPath(path) { + try { + if (os.platform() !== "win32") { + return path; + } + + // On windows cygwin bash, paths are returned in format /c/user/..., but we need it in format C:\user\... + // To convert, the cygpath -w command can be used to convert to the desired format. + // Cygpath only exists on Cygwin, so we first check if the command is available. + // If it is, we use it to convert the path. + if (hasCygpath()) { + return cygpathw(path); + } + + return path; + } catch { + return path; + } +} + +function hasCygpath() { + try { + var result = spawnSync("where", ["cygpath"], { shell: executableName }); + return result.status === 0; + } catch { + return false; + } +} + +function cygpathw(path) { + try { + var result = spawnSync("cygpath", ["-w", path], { + encoding: "utf8", + shell: executableName, + }); + if (result.status === 0) { + return result.stdout.trim(); + } + return path; + } catch { + return path; + } +} + +export default { + name: shellName, + isInstalled, + setup, + teardown, +}; diff --git a/node_modules/@aikidosec/safe-chain/src/shell-integration/supported-shells/fish.js b/node_modules/@aikidosec/safe-chain/src/shell-integration/supported-shells/fish.js new file mode 100644 index 0000000..4c39ba6 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/shell-integration/supported-shells/fish.js @@ -0,0 +1,69 @@ +import { + addLineToFile, + doesExecutableExistOnSystem, + removeLinesMatchingPattern, +} from "../helpers.js"; +import { execSync } from "child_process"; + +const shellName = "Fish"; +const executableName = "fish"; +const startupFileCommand = "echo ~/.config/fish/config.fish"; +const eol = "\n"; // When fish runs on Windows (e.g., Git Bash or WSL), it expects LF line endings. + +function isInstalled() { + return doesExecutableExistOnSystem(executableName); +} + +function teardown(tools) { + const startupFile = getStartupFile(); + + for (const { tool } of tools) { + // Remove any existing alias for the tool + removeLinesMatchingPattern( + startupFile, + new RegExp(`^alias\\s+${tool}\\s+`), + eol + ); + } + + // Removes the line that sources the safe-chain fish initialization script (~/.safe-chain/scripts/init-fish.fish) + removeLinesMatchingPattern( + startupFile, + /^source\s+~\/\.safe-chain\/scripts\/init-fish\.fish/, + eol + ); + + return true; +} + +function setup() { + const startupFile = getStartupFile(); + + addLineToFile( + startupFile, + `source ~/.safe-chain/scripts/init-fish.fish # Safe-chain Fish initialization script`, + eol + ); + + return true; +} + +function getStartupFile() { + try { + return execSync(startupFileCommand, { + encoding: "utf8", + shell: executableName, + }).trim(); + } catch (error) { + throw new Error( + `Command failed: ${startupFileCommand}. Error: ${error.message}` + ); + } +} + +export default { + name: shellName, + isInstalled, + setup, + teardown, +}; diff --git a/node_modules/@aikidosec/safe-chain/src/shell-integration/supported-shells/powershell.js b/node_modules/@aikidosec/safe-chain/src/shell-integration/supported-shells/powershell.js new file mode 100644 index 0000000..47524c2 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/shell-integration/supported-shells/powershell.js @@ -0,0 +1,65 @@ +import { + addLineToFile, + doesExecutableExistOnSystem, + removeLinesMatchingPattern, +} from "../helpers.js"; +import { execSync } from "child_process"; + +const shellName = "PowerShell Core"; +const executableName = "pwsh"; +const startupFileCommand = "echo $PROFILE"; + +function isInstalled() { + return doesExecutableExistOnSystem(executableName); +} + +function teardown(tools) { + const startupFile = getStartupFile(); + + for (const { tool } of tools) { + // Remove any existing alias for the tool + removeLinesMatchingPattern( + startupFile, + new RegExp(`^Set-Alias\\s+${tool}\\s+`) + ); + } + + // Remove the line that sources the safe-chain PowerShell initialization script + removeLinesMatchingPattern( + startupFile, + /^\.\s+["']?\$HOME[/\\].safe-chain[/\\]scripts[/\\]init-pwsh\.ps1["']?/ + ); + + return true; +} + +function setup() { + const startupFile = getStartupFile(); + + addLineToFile( + startupFile, + `. "$HOME\\.safe-chain\\scripts\\init-pwsh.ps1" # Safe-chain PowerShell initialization script` + ); + + return true; +} + +function getStartupFile() { + try { + return execSync(startupFileCommand, { + encoding: "utf8", + shell: executableName, + }).trim(); + } catch (error) { + throw new Error( + `Command failed: ${startupFileCommand}. Error: ${error.message}` + ); + } +} + +export default { + name: shellName, + isInstalled, + setup, + teardown, +}; diff --git a/node_modules/@aikidosec/safe-chain/src/shell-integration/supported-shells/windowsPowershell.js b/node_modules/@aikidosec/safe-chain/src/shell-integration/supported-shells/windowsPowershell.js new file mode 100644 index 0000000..03ff7f8 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/shell-integration/supported-shells/windowsPowershell.js @@ -0,0 +1,65 @@ +import { + addLineToFile, + doesExecutableExistOnSystem, + removeLinesMatchingPattern, +} from "../helpers.js"; +import { execSync } from "child_process"; + +const shellName = "Windows PowerShell"; +const executableName = "powershell"; +const startupFileCommand = "echo $PROFILE"; + +function isInstalled() { + return doesExecutableExistOnSystem(executableName); +} + +function teardown(tools) { + const startupFile = getStartupFile(); + + for (const { tool } of tools) { + // Remove any existing alias for the tool + removeLinesMatchingPattern( + startupFile, + new RegExp(`^Set-Alias\\s+${tool}\\s+`) + ); + } + + // Remove the line that sources the safe-chain PowerShell initialization script + removeLinesMatchingPattern( + startupFile, + /^\.\s+["']?\$HOME[/\\].safe-chain[/\\]scripts[/\\]init-pwsh\.ps1["']?/ + ); + + return true; +} + +function setup() { + const startupFile = getStartupFile(); + + addLineToFile( + startupFile, + `. "$HOME\\.safe-chain\\scripts\\init-pwsh.ps1" # Safe-chain PowerShell initialization script` + ); + + return true; +} + +function getStartupFile() { + try { + return execSync(startupFileCommand, { + encoding: "utf8", + shell: executableName, + }).trim(); + } catch (error) { + throw new Error( + `Command failed: ${startupFileCommand}. Error: ${error.message}` + ); + } +} + +export default { + name: shellName, + isInstalled, + setup, + teardown, +}; diff --git a/node_modules/@aikidosec/safe-chain/src/shell-integration/supported-shells/zsh.js b/node_modules/@aikidosec/safe-chain/src/shell-integration/supported-shells/zsh.js new file mode 100644 index 0000000..b90f769 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/shell-integration/supported-shells/zsh.js @@ -0,0 +1,69 @@ +import { + addLineToFile, + doesExecutableExistOnSystem, + removeLinesMatchingPattern, +} from "../helpers.js"; +import { execSync } from "child_process"; + +const shellName = "Zsh"; +const executableName = "zsh"; +const startupFileCommand = "echo ${ZDOTDIR:-$HOME}/.zshrc"; +const eol = "\n"; // When zsh runs on Windows (e.g., Git Bash or WSL), it expects LF line endings. + +function isInstalled() { + return doesExecutableExistOnSystem(executableName); +} + +function teardown(tools) { + const startupFile = getStartupFile(); + + for (const { tool } of tools) { + // Remove any existing alias for the tool + removeLinesMatchingPattern( + startupFile, + new RegExp(`^alias\\s+${tool}=`), + eol + ); + } + + // Removes the line that sources the safe-chain zsh initialization script (~/.aikido/scripts/init-posix.sh) + removeLinesMatchingPattern( + startupFile, + /^source\s+~\/\.safe-chain\/scripts\/init-posix\.sh/, + eol + ); + + return true; +} + +function setup() { + const startupFile = getStartupFile(); + + addLineToFile( + startupFile, + `source ~/.safe-chain/scripts/init-posix.sh # Safe-chain Zsh initialization script`, + eol + ); + + return true; +} + +function getStartupFile() { + try { + return execSync(startupFileCommand, { + encoding: "utf8", + shell: executableName, + }).trim(); + } catch (error) { + throw new Error( + `Command failed: ${startupFileCommand}. Error: ${error.message}` + ); + } +} + +export default { + name: shellName, + isInstalled, + setup, + teardown, +}; diff --git a/node_modules/@aikidosec/safe-chain/src/shell-integration/teardown.js b/node_modules/@aikidosec/safe-chain/src/shell-integration/teardown.js new file mode 100644 index 0000000..d6b1277 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/shell-integration/teardown.js @@ -0,0 +1,61 @@ +import chalk from "chalk"; +import { ui } from "../environment/userInteraction.js"; +import { detectShells } from "./shellDetection.js"; +import { knownAikidoTools, getPackageManagerList } from "./helpers.js"; + +export async function teardown() { + ui.writeInformation( + chalk.bold("Removing shell aliases.") + + ` This will remove safe-chain aliases for ${getPackageManagerList()}.` + ); + ui.emptyLine(); + + try { + const shells = detectShells(); + if (shells.length === 0) { + ui.writeError("No supported shells detected. Cannot remove aliases."); + return; + } + + ui.writeInformation( + `Detected ${shells.length} supported shell(s): ${shells + .map((shell) => chalk.bold(shell.name)) + .join(", ")}.` + ); + + let updatedCount = 0; + for (const shell of shells) { + let success = false; + try { + success = shell.teardown(knownAikidoTools); + } catch { + success = false; + } + + if (success) { + ui.writeInformation( + `${chalk.bold("- " + shell.name + ":")} ${chalk.green( + "Teardown successful" + )}` + ); + updatedCount++; + } else { + ui.writeError( + `${chalk.bold("- " + shell.name + ":")} ${chalk.red( + "Teardown failed" + )}. Please check your ${shell.name} configuration.` + ); + } + } + + if (updatedCount > 0) { + ui.emptyLine(); + ui.writeInformation(`Please restart your terminal to apply the changes.`); + } + } catch (error) { + ui.writeError( + `Failed to remove shell aliases: ${error.message}. Please check your shell configuration.` + ); + return; + } +} diff --git a/node_modules/@aikidosec/safe-chain/src/utils/safeSpawn.js b/node_modules/@aikidosec/safe-chain/src/utils/safeSpawn.js new file mode 100644 index 0000000..c398ac2 --- /dev/null +++ b/node_modules/@aikidosec/safe-chain/src/utils/safeSpawn.js @@ -0,0 +1,100 @@ +import { spawn, execSync } from "child_process"; +import os from "os"; + +function sanitizeShellArgument(arg) { + // If argument contains shell metacharacters, wrap in double quotes + // and escape characters that are special even inside double quotes + if (hasShellMetaChars(arg)) { + // Inside double quotes, we need to escape: " $ ` \ + return '"' + escapeDoubleQuoteContent(arg) + '"'; + } + return arg; +} + +function hasShellMetaChars(arg) { + // Shell metacharacters that need escaping + // These characters have special meaning in shells and need to be quoted + // Whenever one of these characters is present, we should quote the argument + // Characters: space, ", &, ', |, ;, <, >, (, ), $, `, \, !, *, ?, [, ], {, }, ~, # + const shellMetaChars = /[ "&'|;<>()$`\\!*?[\]{}~#]/; + return shellMetaChars.test(arg); +} + +function escapeDoubleQuoteContent(arg) { + // Escape special characters for shell safety + // This escapes ", $, `, and \ by prefixing them with a backslash + return arg.replace(/(["`$\\])/g, "\\$1"); +} + +function buildCommand(command, args) { + if (args.length === 0) { + return command; + } + + const escapedArgs = args.map(sanitizeShellArgument); + + return `${command} ${escapedArgs.join(" ")}`; +} + +function resolveCommandPath(command) { + // command will be "npm", "yarn", etc. + // Use 'command -v' to find the full path + const fullPath = execSync(`command -v ${command}`, { + encoding: "utf8", + shell: true, + }).trim(); + + if (!fullPath) { + throw new Error(`Command not found: ${command}`); + } + + return fullPath; +} + +export async function safeSpawn(command, args, options = {}) { + // The command is always one of our supported package managers. + // It should always be alphanumeric or _ or - + // Reject any command names with suspicious characters + if (!/^[a-zA-Z0-9_-]+$/.test(command)) { + throw new Error(`Invalid command name: ${command}`); + } + + return new Promise((resolve, reject) => { + // Windows requires shell: true because .bat and .cmd files are not executable + // without a terminal. On Unix/macOS, we resolve the full path first, then use + // array args (safer, no escaping needed). + // See: https://nodejs.org/api/child_process.html#child_processspawncommand-args-options + let child; + if (os.platform() === "win32") { + const fullCommand = buildCommand(command, args); + child = spawn(fullCommand, { ...options, shell: true }); + } else { + const fullPath = resolveCommandPath(command); + child = spawn(fullPath, args, options); + } + + // When stdio is piped, we need to collect the output + let stdout = ""; + let stderr = ""; + + child.stdout?.on("data", (data) => { + stdout += data.toString(); + }); + + child.stderr?.on("data", (data) => { + stderr += data.toString(); + }); + + child.on("close", (code) => { + resolve({ + status: code, + stdout: stdout, + stderr: stderr, + }); + }); + + child.on("error", (error) => { + reject(error); + }); + }); +} diff --git a/node_modules/@isaacs/cliui/LICENSE.txt b/node_modules/@isaacs/cliui/LICENSE.txt new file mode 100644 index 0000000..c7e2747 --- /dev/null +++ b/node_modules/@isaacs/cliui/LICENSE.txt @@ -0,0 +1,14 @@ +Copyright (c) 2015, Contributors + +Permission to use, copy, modify, and/or distribute this software +for any purpose with or without fee is hereby granted, provided +that the above copyright notice and this permission notice +appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE +LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES +OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@isaacs/cliui/README.md b/node_modules/@isaacs/cliui/README.md new file mode 100644 index 0000000..4880642 --- /dev/null +++ b/node_modules/@isaacs/cliui/README.md @@ -0,0 +1,143 @@ +# @isaacs/cliui + +Temporary fork of [cliui](http://npm.im/cliui). + +![ci](https://github.com/yargs/cliui/workflows/ci/badge.svg) +[![NPM version](https://img.shields.io/npm/v/cliui.svg)](https://www.npmjs.com/package/cliui) +[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) +![nycrc config on GitHub](https://img.shields.io/nycrc/yargs/cliui) + +easily create complex multi-column command-line-interfaces. + +## Example + +```js +const ui = require('cliui')() + +ui.div('Usage: $0 [command] [options]') + +ui.div({ + text: 'Options:', + padding: [2, 0, 1, 0] +}) + +ui.div( + { + text: "-f, --file", + width: 20, + padding: [0, 4, 0, 4] + }, + { + text: "the file to load." + + chalk.green("(if this description is long it wraps).") + , + width: 20 + }, + { + text: chalk.red("[required]"), + align: 'right' + } +) + +console.log(ui.toString()) +``` + +## Deno/ESM Support + +As of `v7` `cliui` supports [Deno](https://github.com/denoland/deno) and +[ESM](https://nodejs.org/api/esm.html#esm_ecmascript_modules): + +```typescript +import cliui from "https://deno.land/x/cliui/deno.ts"; + +const ui = cliui({}) + +ui.div('Usage: $0 [command] [options]') + +ui.div({ + text: 'Options:', + padding: [2, 0, 1, 0] +}) + +ui.div({ + text: "-f, --file", + width: 20, + padding: [0, 4, 0, 4] +}) + +console.log(ui.toString()) +``` + + + +## Layout DSL + +cliui exposes a simple layout DSL: + +If you create a single `ui.div`, passing a string rather than an +object: + +* `\n`: characters will be interpreted as new rows. +* `\t`: characters will be interpreted as new columns. +* `\s`: characters will be interpreted as padding. + +**as an example...** + +```js +var ui = require('./')({ + width: 60 +}) + +ui.div( + 'Usage: node ./bin/foo.js\n' + + ' \t provide a regex\n' + + ' \t provide a glob\t [required]' +) + +console.log(ui.toString()) +``` + +**will output:** + +```shell +Usage: node ./bin/foo.js + provide a regex + provide a glob [required] +``` + +## Methods + +```js +cliui = require('cliui') +``` + +### cliui({width: integer}) + +Specify the maximum width of the UI being generated. +If no width is provided, cliui will try to get the current window's width and use it, and if that doesn't work, width will be set to `80`. + +### cliui({wrap: boolean}) + +Enable or disable the wrapping of text in a column. + +### cliui.div(column, column, column) + +Create a row with any number of columns, a column +can either be a string, or an object with the following +options: + +* **text:** some text to place in the column. +* **width:** the width of a column. +* **align:** alignment, `right` or `center`. +* **padding:** `[top, right, bottom, left]`. +* **border:** should a border be placed around the div? + +### cliui.span(column, column, column) + +Similar to `div`, except the next row will be appended without +a new line being created. + +### cliui.resetOutput() + +Resets the UI elements of the current cliui instance, maintaining the values +set for `width` and `wrap`. diff --git a/node_modules/@isaacs/cliui/build/index.cjs b/node_modules/@isaacs/cliui/build/index.cjs new file mode 100644 index 0000000..aca2b85 --- /dev/null +++ b/node_modules/@isaacs/cliui/build/index.cjs @@ -0,0 +1,317 @@ +'use strict'; + +const align = { + right: alignRight, + center: alignCenter +}; +const top = 0; +const right = 1; +const bottom = 2; +const left = 3; +class UI { + constructor(opts) { + var _a; + this.width = opts.width; + /* c8 ignore start */ + this.wrap = (_a = opts.wrap) !== null && _a !== void 0 ? _a : true; + /* c8 ignore stop */ + this.rows = []; + } + span(...args) { + const cols = this.div(...args); + cols.span = true; + } + resetOutput() { + this.rows = []; + } + div(...args) { + if (args.length === 0) { + this.div(''); + } + if (this.wrap && this.shouldApplyLayoutDSL(...args) && typeof args[0] === 'string') { + return this.applyLayoutDSL(args[0]); + } + const cols = args.map(arg => { + if (typeof arg === 'string') { + return this.colFromString(arg); + } + return arg; + }); + this.rows.push(cols); + return cols; + } + shouldApplyLayoutDSL(...args) { + return args.length === 1 && typeof args[0] === 'string' && + /[\t\n]/.test(args[0]); + } + applyLayoutDSL(str) { + const rows = str.split('\n').map(row => row.split('\t')); + let leftColumnWidth = 0; + // simple heuristic for layout, make sure the + // second column lines up along the left-hand. + // don't allow the first column to take up more + // than 50% of the screen. + rows.forEach(columns => { + if (columns.length > 1 && mixin.stringWidth(columns[0]) > leftColumnWidth) { + leftColumnWidth = Math.min(Math.floor(this.width * 0.5), mixin.stringWidth(columns[0])); + } + }); + // generate a table: + // replacing ' ' with padding calculations. + // using the algorithmically generated width. + rows.forEach(columns => { + this.div(...columns.map((r, i) => { + return { + text: r.trim(), + padding: this.measurePadding(r), + width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined + }; + })); + }); + return this.rows[this.rows.length - 1]; + } + colFromString(text) { + return { + text, + padding: this.measurePadding(text) + }; + } + measurePadding(str) { + // measure padding without ansi escape codes + const noAnsi = mixin.stripAnsi(str); + return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length]; + } + toString() { + const lines = []; + this.rows.forEach(row => { + this.rowToString(row, lines); + }); + // don't display any lines with the + // hidden flag set. + return lines + .filter(line => !line.hidden) + .map(line => line.text) + .join('\n'); + } + rowToString(row, lines) { + this.rasterize(row).forEach((rrow, r) => { + let str = ''; + rrow.forEach((col, c) => { + const { width } = row[c]; // the width with padding. + const wrapWidth = this.negatePadding(row[c]); // the width without padding. + let ts = col; // temporary string used during alignment/padding. + if (wrapWidth > mixin.stringWidth(col)) { + ts += ' '.repeat(wrapWidth - mixin.stringWidth(col)); + } + // align the string within its column. + if (row[c].align && row[c].align !== 'left' && this.wrap) { + const fn = align[row[c].align]; + ts = fn(ts, wrapWidth); + if (mixin.stringWidth(ts) < wrapWidth) { + /* c8 ignore start */ + const w = width || 0; + /* c8 ignore stop */ + ts += ' '.repeat(w - mixin.stringWidth(ts) - 1); + } + } + // apply border and padding to string. + const padding = row[c].padding || [0, 0, 0, 0]; + if (padding[left]) { + str += ' '.repeat(padding[left]); + } + str += addBorder(row[c], ts, '| '); + str += ts; + str += addBorder(row[c], ts, ' |'); + if (padding[right]) { + str += ' '.repeat(padding[right]); + } + // if prior row is span, try to render the + // current row on the prior line. + if (r === 0 && lines.length > 0) { + str = this.renderInline(str, lines[lines.length - 1]); + } + }); + // remove trailing whitespace. + lines.push({ + text: str.replace(/ +$/, ''), + span: row.span + }); + }); + return lines; + } + // if the full 'source' can render in + // the target line, do so. + renderInline(source, previousLine) { + const match = source.match(/^ */); + /* c8 ignore start */ + const leadingWhitespace = match ? match[0].length : 0; + /* c8 ignore stop */ + const target = previousLine.text; + const targetTextWidth = mixin.stringWidth(target.trimEnd()); + if (!previousLine.span) { + return source; + } + // if we're not applying wrapping logic, + // just always append to the span. + if (!this.wrap) { + previousLine.hidden = true; + return target + source; + } + if (leadingWhitespace < targetTextWidth) { + return source; + } + previousLine.hidden = true; + return target.trimEnd() + ' '.repeat(leadingWhitespace - targetTextWidth) + source.trimStart(); + } + rasterize(row) { + const rrows = []; + const widths = this.columnWidths(row); + let wrapped; + // word wrap all columns, and create + // a data-structure that is easy to rasterize. + row.forEach((col, c) => { + // leave room for left and right padding. + col.width = widths[c]; + if (this.wrap) { + wrapped = mixin.wrap(col.text, this.negatePadding(col), { hard: true }).split('\n'); + } + else { + wrapped = col.text.split('\n'); + } + if (col.border) { + wrapped.unshift('.' + '-'.repeat(this.negatePadding(col) + 2) + '.'); + wrapped.push("'" + '-'.repeat(this.negatePadding(col) + 2) + "'"); + } + // add top and bottom padding. + if (col.padding) { + wrapped.unshift(...new Array(col.padding[top] || 0).fill('')); + wrapped.push(...new Array(col.padding[bottom] || 0).fill('')); + } + wrapped.forEach((str, r) => { + if (!rrows[r]) { + rrows.push([]); + } + const rrow = rrows[r]; + for (let i = 0; i < c; i++) { + if (rrow[i] === undefined) { + rrow.push(''); + } + } + rrow.push(str); + }); + }); + return rrows; + } + negatePadding(col) { + /* c8 ignore start */ + let wrapWidth = col.width || 0; + /* c8 ignore stop */ + if (col.padding) { + wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0); + } + if (col.border) { + wrapWidth -= 4; + } + return wrapWidth; + } + columnWidths(row) { + if (!this.wrap) { + return row.map(col => { + return col.width || mixin.stringWidth(col.text); + }); + } + let unset = row.length; + let remainingWidth = this.width; + // column widths can be set in config. + const widths = row.map(col => { + if (col.width) { + unset--; + remainingWidth -= col.width; + return col.width; + } + return undefined; + }); + // any unset widths should be calculated. + /* c8 ignore start */ + const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0; + /* c8 ignore stop */ + return widths.map((w, i) => { + if (w === undefined) { + return Math.max(unsetWidth, _minWidth(row[i])); + } + return w; + }); + } +} +function addBorder(col, ts, style) { + if (col.border) { + if (/[.']-+[.']/.test(ts)) { + return ''; + } + if (ts.trim().length !== 0) { + return style; + } + return ' '; + } + return ''; +} +// calculates the minimum width of +// a column, based on padding preferences. +function _minWidth(col) { + const padding = col.padding || []; + const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0); + if (col.border) { + return minWidth + 4; + } + return minWidth; +} +function getWindowWidth() { + /* c8 ignore start */ + if (typeof process === 'object' && process.stdout && process.stdout.columns) { + return process.stdout.columns; + } + return 80; +} +/* c8 ignore stop */ +function alignRight(str, width) { + str = str.trim(); + const strWidth = mixin.stringWidth(str); + if (strWidth < width) { + return ' '.repeat(width - strWidth) + str; + } + return str; +} +function alignCenter(str, width) { + str = str.trim(); + const strWidth = mixin.stringWidth(str); + /* c8 ignore start */ + if (strWidth >= width) { + return str; + } + /* c8 ignore stop */ + return ' '.repeat((width - strWidth) >> 1) + str; +} +let mixin; +function cliui(opts, _mixin) { + mixin = _mixin; + return new UI({ + /* c8 ignore start */ + width: (opts === null || opts === void 0 ? void 0 : opts.width) || getWindowWidth(), + wrap: opts === null || opts === void 0 ? void 0 : opts.wrap + /* c8 ignore stop */ + }); +} + +// Bootstrap cliui with CommonJS dependencies: +const stringWidth = require('string-width-cjs'); +const stripAnsi = require('strip-ansi-cjs'); +const wrap = require('wrap-ansi-cjs'); +function ui(opts) { + return cliui(opts, { + stringWidth, + stripAnsi, + wrap + }); +} + +module.exports = ui; diff --git a/node_modules/@isaacs/cliui/build/index.d.cts b/node_modules/@isaacs/cliui/build/index.d.cts new file mode 100644 index 0000000..4567f94 --- /dev/null +++ b/node_modules/@isaacs/cliui/build/index.d.cts @@ -0,0 +1,43 @@ +interface UIOptions { + width: number; + wrap?: boolean; + rows?: string[]; +} +interface Column { + text: string; + width?: number; + align?: "right" | "left" | "center"; + padding: number[]; + border?: boolean; +} +interface ColumnArray extends Array { + span: boolean; +} +interface Line { + hidden?: boolean; + text: string; + span?: boolean; +} +declare class UI { + width: number; + wrap: boolean; + rows: ColumnArray[]; + constructor(opts: UIOptions); + span(...args: ColumnArray): void; + resetOutput(): void; + div(...args: (Column | string)[]): ColumnArray; + private shouldApplyLayoutDSL; + private applyLayoutDSL; + private colFromString; + private measurePadding; + toString(): string; + rowToString(row: ColumnArray, lines: Line[]): Line[]; + // if the full 'source' can render in + // the target line, do so. + private renderInline; + private rasterize; + private negatePadding; + private columnWidths; +} +declare function ui(opts: UIOptions): UI; +export { ui as default }; diff --git a/node_modules/@isaacs/cliui/build/lib/index.js b/node_modules/@isaacs/cliui/build/lib/index.js new file mode 100644 index 0000000..587b5ec --- /dev/null +++ b/node_modules/@isaacs/cliui/build/lib/index.js @@ -0,0 +1,302 @@ +'use strict'; +const align = { + right: alignRight, + center: alignCenter +}; +const top = 0; +const right = 1; +const bottom = 2; +const left = 3; +export class UI { + constructor(opts) { + var _a; + this.width = opts.width; + /* c8 ignore start */ + this.wrap = (_a = opts.wrap) !== null && _a !== void 0 ? _a : true; + /* c8 ignore stop */ + this.rows = []; + } + span(...args) { + const cols = this.div(...args); + cols.span = true; + } + resetOutput() { + this.rows = []; + } + div(...args) { + if (args.length === 0) { + this.div(''); + } + if (this.wrap && this.shouldApplyLayoutDSL(...args) && typeof args[0] === 'string') { + return this.applyLayoutDSL(args[0]); + } + const cols = args.map(arg => { + if (typeof arg === 'string') { + return this.colFromString(arg); + } + return arg; + }); + this.rows.push(cols); + return cols; + } + shouldApplyLayoutDSL(...args) { + return args.length === 1 && typeof args[0] === 'string' && + /[\t\n]/.test(args[0]); + } + applyLayoutDSL(str) { + const rows = str.split('\n').map(row => row.split('\t')); + let leftColumnWidth = 0; + // simple heuristic for layout, make sure the + // second column lines up along the left-hand. + // don't allow the first column to take up more + // than 50% of the screen. + rows.forEach(columns => { + if (columns.length > 1 && mixin.stringWidth(columns[0]) > leftColumnWidth) { + leftColumnWidth = Math.min(Math.floor(this.width * 0.5), mixin.stringWidth(columns[0])); + } + }); + // generate a table: + // replacing ' ' with padding calculations. + // using the algorithmically generated width. + rows.forEach(columns => { + this.div(...columns.map((r, i) => { + return { + text: r.trim(), + padding: this.measurePadding(r), + width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined + }; + })); + }); + return this.rows[this.rows.length - 1]; + } + colFromString(text) { + return { + text, + padding: this.measurePadding(text) + }; + } + measurePadding(str) { + // measure padding without ansi escape codes + const noAnsi = mixin.stripAnsi(str); + return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length]; + } + toString() { + const lines = []; + this.rows.forEach(row => { + this.rowToString(row, lines); + }); + // don't display any lines with the + // hidden flag set. + return lines + .filter(line => !line.hidden) + .map(line => line.text) + .join('\n'); + } + rowToString(row, lines) { + this.rasterize(row).forEach((rrow, r) => { + let str = ''; + rrow.forEach((col, c) => { + const { width } = row[c]; // the width with padding. + const wrapWidth = this.negatePadding(row[c]); // the width without padding. + let ts = col; // temporary string used during alignment/padding. + if (wrapWidth > mixin.stringWidth(col)) { + ts += ' '.repeat(wrapWidth - mixin.stringWidth(col)); + } + // align the string within its column. + if (row[c].align && row[c].align !== 'left' && this.wrap) { + const fn = align[row[c].align]; + ts = fn(ts, wrapWidth); + if (mixin.stringWidth(ts) < wrapWidth) { + /* c8 ignore start */ + const w = width || 0; + /* c8 ignore stop */ + ts += ' '.repeat(w - mixin.stringWidth(ts) - 1); + } + } + // apply border and padding to string. + const padding = row[c].padding || [0, 0, 0, 0]; + if (padding[left]) { + str += ' '.repeat(padding[left]); + } + str += addBorder(row[c], ts, '| '); + str += ts; + str += addBorder(row[c], ts, ' |'); + if (padding[right]) { + str += ' '.repeat(padding[right]); + } + // if prior row is span, try to render the + // current row on the prior line. + if (r === 0 && lines.length > 0) { + str = this.renderInline(str, lines[lines.length - 1]); + } + }); + // remove trailing whitespace. + lines.push({ + text: str.replace(/ +$/, ''), + span: row.span + }); + }); + return lines; + } + // if the full 'source' can render in + // the target line, do so. + renderInline(source, previousLine) { + const match = source.match(/^ */); + /* c8 ignore start */ + const leadingWhitespace = match ? match[0].length : 0; + /* c8 ignore stop */ + const target = previousLine.text; + const targetTextWidth = mixin.stringWidth(target.trimEnd()); + if (!previousLine.span) { + return source; + } + // if we're not applying wrapping logic, + // just always append to the span. + if (!this.wrap) { + previousLine.hidden = true; + return target + source; + } + if (leadingWhitespace < targetTextWidth) { + return source; + } + previousLine.hidden = true; + return target.trimEnd() + ' '.repeat(leadingWhitespace - targetTextWidth) + source.trimStart(); + } + rasterize(row) { + const rrows = []; + const widths = this.columnWidths(row); + let wrapped; + // word wrap all columns, and create + // a data-structure that is easy to rasterize. + row.forEach((col, c) => { + // leave room for left and right padding. + col.width = widths[c]; + if (this.wrap) { + wrapped = mixin.wrap(col.text, this.negatePadding(col), { hard: true }).split('\n'); + } + else { + wrapped = col.text.split('\n'); + } + if (col.border) { + wrapped.unshift('.' + '-'.repeat(this.negatePadding(col) + 2) + '.'); + wrapped.push("'" + '-'.repeat(this.negatePadding(col) + 2) + "'"); + } + // add top and bottom padding. + if (col.padding) { + wrapped.unshift(...new Array(col.padding[top] || 0).fill('')); + wrapped.push(...new Array(col.padding[bottom] || 0).fill('')); + } + wrapped.forEach((str, r) => { + if (!rrows[r]) { + rrows.push([]); + } + const rrow = rrows[r]; + for (let i = 0; i < c; i++) { + if (rrow[i] === undefined) { + rrow.push(''); + } + } + rrow.push(str); + }); + }); + return rrows; + } + negatePadding(col) { + /* c8 ignore start */ + let wrapWidth = col.width || 0; + /* c8 ignore stop */ + if (col.padding) { + wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0); + } + if (col.border) { + wrapWidth -= 4; + } + return wrapWidth; + } + columnWidths(row) { + if (!this.wrap) { + return row.map(col => { + return col.width || mixin.stringWidth(col.text); + }); + } + let unset = row.length; + let remainingWidth = this.width; + // column widths can be set in config. + const widths = row.map(col => { + if (col.width) { + unset--; + remainingWidth -= col.width; + return col.width; + } + return undefined; + }); + // any unset widths should be calculated. + /* c8 ignore start */ + const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0; + /* c8 ignore stop */ + return widths.map((w, i) => { + if (w === undefined) { + return Math.max(unsetWidth, _minWidth(row[i])); + } + return w; + }); + } +} +function addBorder(col, ts, style) { + if (col.border) { + if (/[.']-+[.']/.test(ts)) { + return ''; + } + if (ts.trim().length !== 0) { + return style; + } + return ' '; + } + return ''; +} +// calculates the minimum width of +// a column, based on padding preferences. +function _minWidth(col) { + const padding = col.padding || []; + const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0); + if (col.border) { + return minWidth + 4; + } + return minWidth; +} +function getWindowWidth() { + /* c8 ignore start */ + if (typeof process === 'object' && process.stdout && process.stdout.columns) { + return process.stdout.columns; + } + return 80; +} +/* c8 ignore stop */ +function alignRight(str, width) { + str = str.trim(); + const strWidth = mixin.stringWidth(str); + if (strWidth < width) { + return ' '.repeat(width - strWidth) + str; + } + return str; +} +function alignCenter(str, width) { + str = str.trim(); + const strWidth = mixin.stringWidth(str); + /* c8 ignore start */ + if (strWidth >= width) { + return str; + } + /* c8 ignore stop */ + return ' '.repeat((width - strWidth) >> 1) + str; +} +let mixin; +export function cliui(opts, _mixin) { + mixin = _mixin; + return new UI({ + /* c8 ignore start */ + width: (opts === null || opts === void 0 ? void 0 : opts.width) || getWindowWidth(), + wrap: opts === null || opts === void 0 ? void 0 : opts.wrap + /* c8 ignore stop */ + }); +} diff --git a/node_modules/@isaacs/cliui/index.mjs b/node_modules/@isaacs/cliui/index.mjs new file mode 100644 index 0000000..5177519 --- /dev/null +++ b/node_modules/@isaacs/cliui/index.mjs @@ -0,0 +1,14 @@ +// Bootstrap cliui with ESM dependencies: +import { cliui } from './build/lib/index.js' + +import stringWidth from 'string-width' +import stripAnsi from 'strip-ansi' +import wrap from 'wrap-ansi' + +export default function ui (opts) { + return cliui(opts, { + stringWidth, + stripAnsi, + wrap + }) +} diff --git a/node_modules/@isaacs/cliui/package.json b/node_modules/@isaacs/cliui/package.json new file mode 100644 index 0000000..7a95253 --- /dev/null +++ b/node_modules/@isaacs/cliui/package.json @@ -0,0 +1,86 @@ +{ + "name": "@isaacs/cliui", + "version": "8.0.2", + "description": "easily create complex multi-column command-line-interfaces", + "main": "build/index.cjs", + "exports": { + ".": [ + { + "import": "./index.mjs", + "require": "./build/index.cjs" + }, + "./build/index.cjs" + ] + }, + "type": "module", + "module": "./index.mjs", + "scripts": { + "check": "standardx '**/*.ts' && standardx '**/*.js' && standardx '**/*.cjs'", + "fix": "standardx --fix '**/*.ts' && standardx --fix '**/*.js' && standardx --fix '**/*.cjs'", + "pretest": "rimraf build && tsc -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs", + "test": "c8 mocha ./test/*.cjs", + "test:esm": "c8 mocha ./test/**/*.mjs", + "postest": "check", + "coverage": "c8 report --check-coverage", + "precompile": "rimraf build", + "compile": "tsc", + "postcompile": "npm run build:cjs", + "build:cjs": "rollup -c", + "prepare": "npm run compile" + }, + "repository": "yargs/cliui", + "standard": { + "ignore": [ + "**/example/**" + ], + "globals": [ + "it" + ] + }, + "keywords": [ + "cli", + "command-line", + "layout", + "design", + "console", + "wrap", + "table" + ], + "author": "Ben Coe ", + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "devDependencies": { + "@types/node": "^14.0.27", + "@typescript-eslint/eslint-plugin": "^4.0.0", + "@typescript-eslint/parser": "^4.0.0", + "c8": "^7.3.0", + "chai": "^4.2.0", + "chalk": "^4.1.0", + "cross-env": "^7.0.2", + "eslint": "^7.6.0", + "eslint-plugin-import": "^2.22.0", + "eslint-plugin-node": "^11.1.0", + "gts": "^3.0.0", + "mocha": "^10.0.0", + "rimraf": "^3.0.2", + "rollup": "^2.23.1", + "rollup-plugin-ts": "^3.0.2", + "standardx": "^7.0.0", + "typescript": "^4.0.0" + }, + "files": [ + "build", + "index.mjs", + "!*.d.ts" + ], + "engines": { + "node": ">=12" + } +} diff --git a/node_modules/@isaacs/fs-minipass/LICENSE b/node_modules/@isaacs/fs-minipass/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@isaacs/fs-minipass/README.md b/node_modules/@isaacs/fs-minipass/README.md new file mode 100644 index 0000000..dac96e7 --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/README.md @@ -0,0 +1,71 @@ +# fs-minipass + +Filesystem streams based on [minipass](http://npm.im/minipass). + +4 classes are exported: + +- ReadStream +- ReadStreamSync +- WriteStream +- WriteStreamSync + +When using `ReadStreamSync`, all of the data is made available +immediately upon consuming the stream. Nothing is buffered in memory +when the stream is constructed. If the stream is piped to a writer, +then it will synchronously `read()` and emit data into the writer as +fast as the writer can consume it. (That is, it will respect +backpressure.) If you call `stream.read()` then it will read the +entire file and return the contents. + +When using `WriteStreamSync`, every write is flushed to the file +synchronously. If your writes all come in a single tick, then it'll +write it all out in a single tick. It's as synchronous as you are. + +The async versions work much like their node builtin counterparts, +with the exception of introducing significantly less Stream machinery +overhead. + +## USAGE + +It's just streams, you pipe them or read() them or write() to them. + +```js +import { ReadStream, WriteStream } from 'fs-minipass' +// or: const { ReadStream, WriteStream } = require('fs-minipass') +const readStream = new ReadStream('file.txt') +const writeStream = new WriteStream('output.txt') +writeStream.write('some file header or whatever\n') +readStream.pipe(writeStream) +``` + +## ReadStream(path, options) + +Path string is required, but somewhat irrelevant if an open file +descriptor is passed in as an option. + +Options: + +- `fd` Pass in a numeric file descriptor, if the file is already open. +- `readSize` The size of reads to do, defaults to 16MB +- `size` The size of the file, if known. Prevents zero-byte read() + call at the end. +- `autoClose` Set to `false` to prevent the file descriptor from being + closed when the file is done being read. + +## WriteStream(path, options) + +Path string is required, but somewhat irrelevant if an open file +descriptor is passed in as an option. + +Options: + +- `fd` Pass in a numeric file descriptor, if the file is already open. +- `mode` The mode to create the file with. Defaults to `0o666`. +- `start` The position in the file to start reading. If not + specified, then the file will start writing at position zero, and be + truncated by default. +- `autoClose` Set to `false` to prevent the file descriptor from being + closed when the stream is ended. +- `flags` Flags to use when opening the file. Irrelevant if `fd` is + passed in, since file won't be opened in that case. Defaults to + `'a'` if a `pos` is specified, or `'w'` otherwise. diff --git a/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts b/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts new file mode 100644 index 0000000..38e8ccd --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts @@ -0,0 +1,118 @@ +/// +/// +/// +import EE from 'events'; +import { Minipass } from 'minipass'; +declare const _autoClose: unique symbol; +declare const _close: unique symbol; +declare const _ended: unique symbol; +declare const _fd: unique symbol; +declare const _finished: unique symbol; +declare const _flags: unique symbol; +declare const _flush: unique symbol; +declare const _handleChunk: unique symbol; +declare const _makeBuf: unique symbol; +declare const _mode: unique symbol; +declare const _needDrain: unique symbol; +declare const _onerror: unique symbol; +declare const _onopen: unique symbol; +declare const _onread: unique symbol; +declare const _onwrite: unique symbol; +declare const _open: unique symbol; +declare const _path: unique symbol; +declare const _pos: unique symbol; +declare const _queue: unique symbol; +declare const _read: unique symbol; +declare const _readSize: unique symbol; +declare const _reading: unique symbol; +declare const _remain: unique symbol; +declare const _size: unique symbol; +declare const _write: unique symbol; +declare const _writing: unique symbol; +declare const _defaultFlag: unique symbol; +declare const _errored: unique symbol; +export type ReadStreamOptions = Minipass.Options & { + fd?: number; + readSize?: number; + size?: number; + autoClose?: boolean; +}; +export type ReadStreamEvents = Minipass.Events & { + open: [fd: number]; +}; +export declare class ReadStream extends Minipass { + [_errored]: boolean; + [_fd]?: number; + [_path]: string; + [_readSize]: number; + [_reading]: boolean; + [_size]: number; + [_remain]: number; + [_autoClose]: boolean; + constructor(path: string, opt: ReadStreamOptions); + get fd(): number | undefined; + get path(): string; + write(): void; + end(): void; + [_open](): void; + [_onopen](er?: NodeJS.ErrnoException | null, fd?: number): void; + [_makeBuf](): Buffer; + [_read](): void; + [_onread](er?: NodeJS.ErrnoException | null, br?: number, buf?: Buffer): void; + [_close](): void; + [_onerror](er: NodeJS.ErrnoException): void; + [_handleChunk](br: number, buf: Buffer): boolean; + emit(ev: Event, ...args: ReadStreamEvents[Event]): boolean; +} +export declare class ReadStreamSync extends ReadStream { + [_open](): void; + [_read](): void; + [_close](): void; +} +export type WriteStreamOptions = { + fd?: number; + autoClose?: boolean; + mode?: number; + captureRejections?: boolean; + start?: number; + flags?: string; +}; +export declare class WriteStream extends EE { + readable: false; + writable: boolean; + [_errored]: boolean; + [_writing]: boolean; + [_ended]: boolean; + [_queue]: Buffer[]; + [_needDrain]: boolean; + [_path]: string; + [_mode]: number; + [_autoClose]: boolean; + [_fd]?: number; + [_defaultFlag]: boolean; + [_flags]: string; + [_finished]: boolean; + [_pos]?: number; + constructor(path: string, opt: WriteStreamOptions); + emit(ev: string, ...args: any[]): boolean; + get fd(): number | undefined; + get path(): string; + [_onerror](er: NodeJS.ErrnoException): void; + [_open](): void; + [_onopen](er?: null | NodeJS.ErrnoException, fd?: number): void; + end(buf: string, enc?: BufferEncoding): this; + end(buf?: Buffer, enc?: undefined): this; + write(buf: string, enc?: BufferEncoding): boolean; + write(buf: Buffer, enc?: undefined): boolean; + [_write](buf: Buffer): void; + [_onwrite](er?: null | NodeJS.ErrnoException, bw?: number): void; + [_flush](): void; + [_close](): void; +} +export declare class WriteStreamSync extends WriteStream { + [_open](): void; + [_close](): void; + [_write](buf: Buffer): void; +} +export {}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts.map b/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts.map new file mode 100644 index 0000000..3e2c703 --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,OAAO,EAAE,MAAM,QAAQ,CA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;IAC7B,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAA;gBAEH,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,kBAAkB;IAoBjD,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE;IAU/B,IAAI,EAAE,uBAEL;IAED,IAAI,IAAI,WAEP;IAED,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,MAAM,CAAC,cAAc;IAMpC,CAAC,KAAK,CAAC;IAMP,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,cAAc,EAAE,EAAE,CAAC,EAAE,MAAM;IAoBxD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,cAAc,GAAG,IAAI;IAC5C,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,SAAS,GAAG,IAAI;IAoBxC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,cAAc,GAAG,OAAO;IACjD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,SAAS,GAAG,OAAO;IAsB5C,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM;IAWpB,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,cAAc,EAAE,EAAE,CAAC,EAAE,MAAM;IAwBzD,CAAC,MAAM,CAAC;IAgBR,CAAC,MAAM,CAAC;CAST;AAED,qBAAa,eAAgB,SAAQ,WAAW;IAC9C,CAAC,KAAK,CAAC,IAAI,IAAI;IAsBf,CAAC,MAAM,CAAC;IASR,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM;CAmBrB"} \ No newline at end of file diff --git a/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js b/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js new file mode 100644 index 0000000..2b3178c --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js @@ -0,0 +1,430 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.WriteStreamSync = exports.WriteStream = exports.ReadStreamSync = exports.ReadStream = void 0; +const events_1 = __importDefault(require("events")); +const fs_1 = __importDefault(require("fs")); +const minipass_1 = require("minipass"); +const writev = fs_1.default.writev; +const _autoClose = Symbol('_autoClose'); +const _close = Symbol('_close'); +const _ended = Symbol('_ended'); +const _fd = Symbol('_fd'); +const _finished = Symbol('_finished'); +const _flags = Symbol('_flags'); +const _flush = Symbol('_flush'); +const _handleChunk = Symbol('_handleChunk'); +const _makeBuf = Symbol('_makeBuf'); +const _mode = Symbol('_mode'); +const _needDrain = Symbol('_needDrain'); +const _onerror = Symbol('_onerror'); +const _onopen = Symbol('_onopen'); +const _onread = Symbol('_onread'); +const _onwrite = Symbol('_onwrite'); +const _open = Symbol('_open'); +const _path = Symbol('_path'); +const _pos = Symbol('_pos'); +const _queue = Symbol('_queue'); +const _read = Symbol('_read'); +const _readSize = Symbol('_readSize'); +const _reading = Symbol('_reading'); +const _remain = Symbol('_remain'); +const _size = Symbol('_size'); +const _write = Symbol('_write'); +const _writing = Symbol('_writing'); +const _defaultFlag = Symbol('_defaultFlag'); +const _errored = Symbol('_errored'); +class ReadStream extends minipass_1.Minipass { + [_errored] = false; + [_fd]; + [_path]; + [_readSize]; + [_reading] = false; + [_size]; + [_remain]; + [_autoClose]; + constructor(path, opt) { + opt = opt || {}; + super(opt); + this.readable = true; + this.writable = false; + if (typeof path !== 'string') { + throw new TypeError('path must be a string'); + } + this[_errored] = false; + this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined; + this[_path] = path; + this[_readSize] = opt.readSize || 16 * 1024 * 1024; + this[_reading] = false; + this[_size] = typeof opt.size === 'number' ? opt.size : Infinity; + this[_remain] = this[_size]; + this[_autoClose] = + typeof opt.autoClose === 'boolean' ? opt.autoClose : true; + if (typeof this[_fd] === 'number') { + this[_read](); + } + else { + this[_open](); + } + } + get fd() { + return this[_fd]; + } + get path() { + return this[_path]; + } + //@ts-ignore + write() { + throw new TypeError('this is a readable stream'); + } + //@ts-ignore + end() { + throw new TypeError('this is a readable stream'); + } + [_open]() { + fs_1.default.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd)); + } + [_onopen](er, fd) { + if (er) { + this[_onerror](er); + } + else { + this[_fd] = fd; + this.emit('open', fd); + this[_read](); + } + } + [_makeBuf]() { + return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain])); + } + [_read]() { + if (!this[_reading]) { + this[_reading] = true; + const buf = this[_makeBuf](); + /* c8 ignore start */ + if (buf.length === 0) { + return process.nextTick(() => this[_onread](null, 0, buf)); + } + /* c8 ignore stop */ + fs_1.default.read(this[_fd], buf, 0, buf.length, null, (er, br, b) => this[_onread](er, br, b)); + } + } + [_onread](er, br, buf) { + this[_reading] = false; + if (er) { + this[_onerror](er); + } + else if (this[_handleChunk](br, buf)) { + this[_read](); + } + } + [_close]() { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd]; + this[_fd] = undefined; + fs_1.default.close(fd, er => er ? this.emit('error', er) : this.emit('close')); + } + } + [_onerror](er) { + this[_reading] = true; + this[_close](); + this.emit('error', er); + } + [_handleChunk](br, buf) { + let ret = false; + // no effect if infinite + this[_remain] -= br; + if (br > 0) { + ret = super.write(br < buf.length ? buf.subarray(0, br) : buf); + } + if (br === 0 || this[_remain] <= 0) { + ret = false; + this[_close](); + super.end(); + } + return ret; + } + emit(ev, ...args) { + switch (ev) { + case 'prefinish': + case 'finish': + return false; + case 'drain': + if (typeof this[_fd] === 'number') { + this[_read](); + } + return false; + case 'error': + if (this[_errored]) { + return false; + } + this[_errored] = true; + return super.emit(ev, ...args); + default: + return super.emit(ev, ...args); + } + } +} +exports.ReadStream = ReadStream; +class ReadStreamSync extends ReadStream { + [_open]() { + let threw = true; + try { + this[_onopen](null, fs_1.default.openSync(this[_path], 'r')); + threw = false; + } + finally { + if (threw) { + this[_close](); + } + } + } + [_read]() { + let threw = true; + try { + if (!this[_reading]) { + this[_reading] = true; + do { + const buf = this[_makeBuf](); + /* c8 ignore start */ + const br = buf.length === 0 + ? 0 + : fs_1.default.readSync(this[_fd], buf, 0, buf.length, null); + /* c8 ignore stop */ + if (!this[_handleChunk](br, buf)) { + break; + } + } while (true); + this[_reading] = false; + } + threw = false; + } + finally { + if (threw) { + this[_close](); + } + } + } + [_close]() { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd]; + this[_fd] = undefined; + fs_1.default.closeSync(fd); + this.emit('close'); + } + } +} +exports.ReadStreamSync = ReadStreamSync; +class WriteStream extends events_1.default { + readable = false; + writable = true; + [_errored] = false; + [_writing] = false; + [_ended] = false; + [_queue] = []; + [_needDrain] = false; + [_path]; + [_mode]; + [_autoClose]; + [_fd]; + [_defaultFlag]; + [_flags]; + [_finished] = false; + [_pos]; + constructor(path, opt) { + opt = opt || {}; + super(opt); + this[_path] = path; + this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined; + this[_mode] = opt.mode === undefined ? 0o666 : opt.mode; + this[_pos] = typeof opt.start === 'number' ? opt.start : undefined; + this[_autoClose] = + typeof opt.autoClose === 'boolean' ? opt.autoClose : true; + // truncating makes no sense when writing into the middle + const defaultFlag = this[_pos] !== undefined ? 'r+' : 'w'; + this[_defaultFlag] = opt.flags === undefined; + this[_flags] = opt.flags === undefined ? defaultFlag : opt.flags; + if (this[_fd] === undefined) { + this[_open](); + } + } + emit(ev, ...args) { + if (ev === 'error') { + if (this[_errored]) { + return false; + } + this[_errored] = true; + } + return super.emit(ev, ...args); + } + get fd() { + return this[_fd]; + } + get path() { + return this[_path]; + } + [_onerror](er) { + this[_close](); + this[_writing] = true; + this.emit('error', er); + } + [_open]() { + fs_1.default.open(this[_path], this[_flags], this[_mode], (er, fd) => this[_onopen](er, fd)); + } + [_onopen](er, fd) { + if (this[_defaultFlag] && + this[_flags] === 'r+' && + er && + er.code === 'ENOENT') { + this[_flags] = 'w'; + this[_open](); + } + else if (er) { + this[_onerror](er); + } + else { + this[_fd] = fd; + this.emit('open', fd); + if (!this[_writing]) { + this[_flush](); + } + } + } + end(buf, enc) { + if (buf) { + //@ts-ignore + this.write(buf, enc); + } + this[_ended] = true; + // synthetic after-write logic, where drain/finish live + if (!this[_writing] && + !this[_queue].length && + typeof this[_fd] === 'number') { + this[_onwrite](null, 0); + } + return this; + } + write(buf, enc) { + if (typeof buf === 'string') { + buf = Buffer.from(buf, enc); + } + if (this[_ended]) { + this.emit('error', new Error('write() after end()')); + return false; + } + if (this[_fd] === undefined || this[_writing] || this[_queue].length) { + this[_queue].push(buf); + this[_needDrain] = true; + return false; + } + this[_writing] = true; + this[_write](buf); + return true; + } + [_write](buf) { + fs_1.default.write(this[_fd], buf, 0, buf.length, this[_pos], (er, bw) => this[_onwrite](er, bw)); + } + [_onwrite](er, bw) { + if (er) { + this[_onerror](er); + } + else { + if (this[_pos] !== undefined && typeof bw === 'number') { + this[_pos] += bw; + } + if (this[_queue].length) { + this[_flush](); + } + else { + this[_writing] = false; + if (this[_ended] && !this[_finished]) { + this[_finished] = true; + this[_close](); + this.emit('finish'); + } + else if (this[_needDrain]) { + this[_needDrain] = false; + this.emit('drain'); + } + } + } + } + [_flush]() { + if (this[_queue].length === 0) { + if (this[_ended]) { + this[_onwrite](null, 0); + } + } + else if (this[_queue].length === 1) { + this[_write](this[_queue].pop()); + } + else { + const iovec = this[_queue]; + this[_queue] = []; + writev(this[_fd], iovec, this[_pos], (er, bw) => this[_onwrite](er, bw)); + } + } + [_close]() { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd]; + this[_fd] = undefined; + fs_1.default.close(fd, er => er ? this.emit('error', er) : this.emit('close')); + } + } +} +exports.WriteStream = WriteStream; +class WriteStreamSync extends WriteStream { + [_open]() { + let fd; + // only wrap in a try{} block if we know we'll retry, to avoid + // the rethrow obscuring the error's source frame in most cases. + if (this[_defaultFlag] && this[_flags] === 'r+') { + try { + fd = fs_1.default.openSync(this[_path], this[_flags], this[_mode]); + } + catch (er) { + if (er?.code === 'ENOENT') { + this[_flags] = 'w'; + return this[_open](); + } + else { + throw er; + } + } + } + else { + fd = fs_1.default.openSync(this[_path], this[_flags], this[_mode]); + } + this[_onopen](null, fd); + } + [_close]() { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd]; + this[_fd] = undefined; + fs_1.default.closeSync(fd); + this.emit('close'); + } + } + [_write](buf) { + // throw the original, but try to close if it fails + let threw = true; + try { + this[_onwrite](null, fs_1.default.writeSync(this[_fd], buf, 0, buf.length, this[_pos])); + threw = false; + } + finally { + if (threw) { + try { + this[_close](); + } + catch { + // ok error + } + } + } + } +} +exports.WriteStreamSync = WriteStreamSync; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js.map b/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js.map new file mode 100644 index 0000000..caee495 --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,4CAAmB;AACnB,uCAAmC;AAEnC,MAAM,MAAM,GAAG,YAAE,CAAC,MAAM,CAAA;AAExB,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;AACvC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC/B,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;AACzB,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,CAAA;AACrC,MAAM,MAAM,GAAG,MAAM,CAAC,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C,KAAK,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;QAC1D,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;IACzB,CAAC;IAED,CAAC,MAAM,CAAC;QACN,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE,CAAC;YACtD,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAA;YACpB,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS,CAAA;YACrB,YAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;YAChB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QACpB,CAAC;IACH,CAAC;IAED,CAAC,MAAM,CAAC,CAAC,GAAW;QAClB,mDAAmD;QACnD,IAAI,KAAK,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC;YACH,IAAI,CAAC,QAAQ,CAAC,CACZ,IAAI,EACJ,YAAE,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAW,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAClE,CAAA;YACD,KAAK,GAAG,KAAK,CAAA;QACf,CAAC;gBAAS,CAAC;YACT,IAAI,KAAK,EAAE,CAAC;gBACV,IAAI,CAAC;oBACH,IAAI,CAAC,MAAM,CAAC,EAAE,CAAA;gBAChB,CAAC;gBAAC,MAAM,CAAC;oBACP,WAAW;gBACb,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAnDD,0CAmDC","sourcesContent":["import EE from 'events'\nimport fs from 'fs'\nimport { Minipass } from 'minipass'\n\nconst writev = fs.writev\n\nconst _autoClose = Symbol('_autoClose')\nconst _close = Symbol('_close')\nconst _ended = Symbol('_ended')\nconst _fd = Symbol('_fd')\nconst _finished = Symbol('_finished')\nconst _flags = Symbol('_flags')\nconst _flush = Symbol('_flush')\nconst _handleChunk = Symbol('_handleChunk')\nconst _makeBuf = Symbol('_makeBuf')\nconst _mode = Symbol('_mode')\nconst _needDrain = Symbol('_needDrain')\nconst _onerror = Symbol('_onerror')\nconst _onopen = Symbol('_onopen')\nconst _onread = Symbol('_onread')\nconst _onwrite = Symbol('_onwrite')\nconst _open = Symbol('_open')\nconst _path = Symbol('_path')\nconst _pos = Symbol('_pos')\nconst _queue = Symbol('_queue')\nconst _read = Symbol('_read')\nconst _readSize = Symbol('_readSize')\nconst _reading = Symbol('_reading')\nconst _remain = Symbol('_remain')\nconst _size = Symbol('_size')\nconst _write = Symbol('_write')\nconst _writing = Symbol('_writing')\nconst _defaultFlag = Symbol('_defaultFlag')\nconst _errored = Symbol('_errored')\n\nexport type ReadStreamOptions =\n Minipass.Options & {\n fd?: number\n readSize?: number\n size?: number\n autoClose?: boolean\n }\n\nexport type ReadStreamEvents = Minipass.Events & {\n open: [fd: number]\n}\n\nexport class ReadStream extends Minipass<\n Minipass.ContiguousData,\n Buffer,\n ReadStreamEvents\n> {\n [_errored]: boolean = false;\n [_fd]?: number;\n [_path]: string;\n [_readSize]: number;\n [_reading]: boolean = false;\n [_size]: number;\n [_remain]: number;\n [_autoClose]: boolean\n\n constructor(path: string, opt: ReadStreamOptions) {\n opt = opt || {}\n super(opt)\n\n this.readable = true\n this.writable = false\n\n if (typeof path !== 'string') {\n throw new TypeError('path must be a string')\n }\n\n this[_errored] = false\n this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined\n this[_path] = path\n this[_readSize] = opt.readSize || 16 * 1024 * 1024\n this[_reading] = false\n this[_size] = typeof opt.size === 'number' ? opt.size : Infinity\n this[_remain] = this[_size]\n this[_autoClose] =\n typeof opt.autoClose === 'boolean' ? opt.autoClose : true\n\n if (typeof this[_fd] === 'number') {\n this[_read]()\n } else {\n this[_open]()\n }\n }\n\n get fd() {\n return this[_fd]\n }\n\n get path() {\n return this[_path]\n }\n\n //@ts-ignore\n write() {\n throw new TypeError('this is a readable stream')\n }\n\n //@ts-ignore\n end() {\n throw new TypeError('this is a readable stream')\n }\n\n [_open]() {\n fs.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd))\n }\n\n [_onopen](er?: NodeJS.ErrnoException | null, fd?: number) {\n if (er) {\n this[_onerror](er)\n } else {\n this[_fd] = fd\n this.emit('open', fd as number)\n this[_read]()\n }\n }\n\n [_makeBuf]() {\n return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain]))\n }\n\n [_read]() {\n if (!this[_reading]) {\n this[_reading] = true\n const buf = this[_makeBuf]()\n /* c8 ignore start */\n if (buf.length === 0) {\n return process.nextTick(() => this[_onread](null, 0, buf))\n }\n /* c8 ignore stop */\n fs.read(this[_fd] as number, buf, 0, buf.length, null, (er, br, b) =>\n this[_onread](er, br, b),\n )\n }\n }\n\n [_onread](er?: NodeJS.ErrnoException | null, br?: number, buf?: Buffer) {\n this[_reading] = false\n if (er) {\n this[_onerror](er)\n } else if (this[_handleChunk](br as number, buf as Buffer)) {\n this[_read]()\n }\n }\n\n [_close]() {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = undefined\n fs.close(fd, er =>\n er ? this.emit('error', er) : this.emit('close'),\n )\n }\n }\n\n [_onerror](er: NodeJS.ErrnoException) {\n this[_reading] = true\n this[_close]()\n this.emit('error', er)\n }\n\n [_handleChunk](br: number, buf: Buffer) {\n let ret = false\n // no effect if infinite\n this[_remain] -= br\n if (br > 0) {\n ret = super.write(br < buf.length ? buf.subarray(0, br) : buf)\n }\n\n if (br === 0 || this[_remain] <= 0) {\n ret = false\n this[_close]()\n super.end()\n }\n\n return ret\n }\n\n emit(\n ev: Event,\n ...args: ReadStreamEvents[Event]\n ): boolean {\n switch (ev) {\n case 'prefinish':\n case 'finish':\n return false\n\n case 'drain':\n if (typeof this[_fd] === 'number') {\n this[_read]()\n }\n return false\n\n case 'error':\n if (this[_errored]) {\n return false\n }\n this[_errored] = true\n return super.emit(ev, ...args)\n\n default:\n return super.emit(ev, ...args)\n }\n }\n}\n\nexport class ReadStreamSync extends ReadStream {\n [_open]() {\n let threw = true\n try {\n this[_onopen](null, fs.openSync(this[_path], 'r'))\n threw = false\n } finally {\n if (threw) {\n this[_close]()\n }\n }\n }\n\n [_read]() {\n let threw = true\n try {\n if (!this[_reading]) {\n this[_reading] = true\n do {\n const buf = this[_makeBuf]()\n /* c8 ignore start */\n const br =\n buf.length === 0\n ? 0\n : fs.readSync(this[_fd] as number, buf, 0, buf.length, null)\n /* c8 ignore stop */\n if (!this[_handleChunk](br, buf)) {\n break\n }\n } while (true)\n this[_reading] = false\n }\n threw = false\n } finally {\n if (threw) {\n this[_close]()\n }\n }\n }\n\n [_close]() {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = undefined\n fs.closeSync(fd)\n this.emit('close')\n }\n }\n}\n\nexport type WriteStreamOptions = {\n fd?: number\n autoClose?: boolean\n mode?: number\n captureRejections?: boolean\n start?: number\n flags?: string\n}\n\nexport class WriteStream extends EE {\n readable: false = false\n writable: boolean = true;\n [_errored]: boolean = false;\n [_writing]: boolean = false;\n [_ended]: boolean = false;\n [_queue]: Buffer[] = [];\n [_needDrain]: boolean = false;\n [_path]: string;\n [_mode]: number;\n [_autoClose]: boolean;\n [_fd]?: number;\n [_defaultFlag]: boolean;\n [_flags]: string;\n [_finished]: boolean = false;\n [_pos]?: number\n\n constructor(path: string, opt: WriteStreamOptions) {\n opt = opt || {}\n super(opt)\n this[_path] = path\n this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined\n this[_mode] = opt.mode === undefined ? 0o666 : opt.mode\n this[_pos] = typeof opt.start === 'number' ? opt.start : undefined\n this[_autoClose] =\n typeof opt.autoClose === 'boolean' ? opt.autoClose : true\n\n // truncating makes no sense when writing into the middle\n const defaultFlag = this[_pos] !== undefined ? 'r+' : 'w'\n this[_defaultFlag] = opt.flags === undefined\n this[_flags] = opt.flags === undefined ? defaultFlag : opt.flags\n\n if (this[_fd] === undefined) {\n this[_open]()\n }\n }\n\n emit(ev: string, ...args: any[]) {\n if (ev === 'error') {\n if (this[_errored]) {\n return false\n }\n this[_errored] = true\n }\n return super.emit(ev, ...args)\n }\n\n get fd() {\n return this[_fd]\n }\n\n get path() {\n return this[_path]\n }\n\n [_onerror](er: NodeJS.ErrnoException) {\n this[_close]()\n this[_writing] = true\n this.emit('error', er)\n }\n\n [_open]() {\n fs.open(this[_path], this[_flags], this[_mode], (er, fd) =>\n this[_onopen](er, fd),\n )\n }\n\n [_onopen](er?: null | NodeJS.ErrnoException, fd?: number) {\n if (\n this[_defaultFlag] &&\n this[_flags] === 'r+' &&\n er &&\n er.code === 'ENOENT'\n ) {\n this[_flags] = 'w'\n this[_open]()\n } else if (er) {\n this[_onerror](er)\n } else {\n this[_fd] = fd\n this.emit('open', fd)\n if (!this[_writing]) {\n this[_flush]()\n }\n }\n }\n\n end(buf: string, enc?: BufferEncoding): this\n end(buf?: Buffer, enc?: undefined): this\n end(buf?: Buffer | string, enc?: BufferEncoding): this {\n if (buf) {\n //@ts-ignore\n this.write(buf, enc)\n }\n\n this[_ended] = true\n\n // synthetic after-write logic, where drain/finish live\n if (\n !this[_writing] &&\n !this[_queue].length &&\n typeof this[_fd] === 'number'\n ) {\n this[_onwrite](null, 0)\n }\n return this\n }\n\n write(buf: string, enc?: BufferEncoding): boolean\n write(buf: Buffer, enc?: undefined): boolean\n write(buf: Buffer | string, enc?: BufferEncoding): boolean {\n if (typeof buf === 'string') {\n buf = Buffer.from(buf, enc)\n }\n\n if (this[_ended]) {\n this.emit('error', new Error('write() after end()'))\n return false\n }\n\n if (this[_fd] === undefined || this[_writing] || this[_queue].length) {\n this[_queue].push(buf)\n this[_needDrain] = true\n return false\n }\n\n this[_writing] = true\n this[_write](buf)\n return true\n }\n\n [_write](buf: Buffer) {\n fs.write(\n this[_fd] as number,\n buf,\n 0,\n buf.length,\n this[_pos],\n (er, bw) => this[_onwrite](er, bw),\n )\n }\n\n [_onwrite](er?: null | NodeJS.ErrnoException, bw?: number) {\n if (er) {\n this[_onerror](er)\n } else {\n if (this[_pos] !== undefined && typeof bw === 'number') {\n this[_pos] += bw\n }\n if (this[_queue].length) {\n this[_flush]()\n } else {\n this[_writing] = false\n\n if (this[_ended] && !this[_finished]) {\n this[_finished] = true\n this[_close]()\n this.emit('finish')\n } else if (this[_needDrain]) {\n this[_needDrain] = false\n this.emit('drain')\n }\n }\n }\n }\n\n [_flush]() {\n if (this[_queue].length === 0) {\n if (this[_ended]) {\n this[_onwrite](null, 0)\n }\n } else if (this[_queue].length === 1) {\n this[_write](this[_queue].pop() as Buffer)\n } else {\n const iovec = this[_queue]\n this[_queue] = []\n writev(this[_fd] as number, iovec, this[_pos] as number, (er, bw) =>\n this[_onwrite](er, bw),\n )\n }\n }\n\n [_close]() {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = undefined\n fs.close(fd, er =>\n er ? this.emit('error', er) : this.emit('close'),\n )\n }\n }\n}\n\nexport class WriteStreamSync extends WriteStream {\n [_open](): void {\n let fd\n // only wrap in a try{} block if we know we'll retry, to avoid\n // the rethrow obscuring the error's source frame in most cases.\n if (this[_defaultFlag] && this[_flags] === 'r+') {\n try {\n fd = fs.openSync(this[_path], this[_flags], this[_mode])\n } catch (er) {\n if ((er as NodeJS.ErrnoException)?.code === 'ENOENT') {\n this[_flags] = 'w'\n return this[_open]()\n } else {\n throw er\n }\n }\n } else {\n fd = fs.openSync(this[_path], this[_flags], this[_mode])\n }\n\n this[_onopen](null, fd)\n }\n\n [_close]() {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = undefined\n fs.closeSync(fd)\n this.emit('close')\n }\n }\n\n [_write](buf: Buffer) {\n // throw the original, but try to close if it fails\n let threw = true\n try {\n this[_onwrite](\n null,\n fs.writeSync(this[_fd] as number, buf, 0, buf.length, this[_pos]),\n )\n threw = false\n } finally {\n if (threw) {\n try {\n this[_close]()\n } catch {\n // ok error\n }\n }\n }\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json b/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json new file mode 100644 index 0000000..5bbefff --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts b/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts new file mode 100644 index 0000000..54aebe1 --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts @@ -0,0 +1,118 @@ +/// +/// +/// +import EE from 'events'; +import { Minipass } from 'minipass'; +declare const _autoClose: unique symbol; +declare const _close: unique symbol; +declare const _ended: unique symbol; +declare const _fd: unique symbol; +declare const _finished: unique symbol; +declare const _flags: unique symbol; +declare const _flush: unique symbol; +declare const _handleChunk: unique symbol; +declare const _makeBuf: unique symbol; +declare const _mode: unique symbol; +declare const _needDrain: unique symbol; +declare const _onerror: unique symbol; +declare const _onopen: unique symbol; +declare const _onread: unique symbol; +declare const _onwrite: unique symbol; +declare const _open: unique symbol; +declare const _path: unique symbol; +declare const _pos: unique symbol; +declare const _queue: unique symbol; +declare const _read: unique symbol; +declare const _readSize: unique symbol; +declare const _reading: unique symbol; +declare const _remain: unique symbol; +declare const _size: unique symbol; +declare const _write: unique symbol; +declare const _writing: unique symbol; +declare const _defaultFlag: unique symbol; +declare const _errored: unique symbol; +export type ReadStreamOptions = Minipass.Options & { + fd?: number; + readSize?: number; + size?: number; + autoClose?: boolean; +}; +export type ReadStreamEvents = Minipass.Events & { + open: [fd: number]; +}; +export declare class ReadStream extends Minipass { + [_errored]: boolean; + [_fd]?: number; + [_path]: string; + [_readSize]: number; + [_reading]: boolean; + [_size]: number; + [_remain]: number; + [_autoClose]: boolean; + constructor(path: string, opt: ReadStreamOptions); + get fd(): number | undefined; + get path(): string; + write(): void; + end(): void; + [_open](): void; + [_onopen](er?: NodeJS.ErrnoException | null, fd?: number): void; + [_makeBuf](): Buffer; + [_read](): void; + [_onread](er?: NodeJS.ErrnoException | null, br?: number, buf?: Buffer): void; + [_close](): void; + [_onerror](er: NodeJS.ErrnoException): void; + [_handleChunk](br: number, buf: Buffer): boolean; + emit(ev: Event, ...args: ReadStreamEvents[Event]): boolean; +} +export declare class ReadStreamSync extends ReadStream { + [_open](): void; + [_read](): void; + [_close](): void; +} +export type WriteStreamOptions = { + fd?: number; + autoClose?: boolean; + mode?: number; + captureRejections?: boolean; + start?: number; + flags?: string; +}; +export declare class WriteStream extends EE { + readable: false; + writable: boolean; + [_errored]: boolean; + [_writing]: boolean; + [_ended]: boolean; + [_queue]: Buffer[]; + [_needDrain]: boolean; + [_path]: string; + [_mode]: number; + [_autoClose]: boolean; + [_fd]?: number; + [_defaultFlag]: boolean; + [_flags]: string; + [_finished]: boolean; + [_pos]?: number; + constructor(path: string, opt: WriteStreamOptions); + emit(ev: string, ...args: any[]): boolean; + get fd(): number | undefined; + get path(): string; + [_onerror](er: NodeJS.ErrnoException): void; + [_open](): void; + [_onopen](er?: null | NodeJS.ErrnoException, fd?: number): void; + end(buf: string, enc?: BufferEncoding): this; + end(buf?: Buffer, enc?: undefined): this; + write(buf: string, enc?: BufferEncoding): boolean; + write(buf: Buffer, enc?: undefined): boolean; + [_write](buf: Buffer): void; + [_onwrite](er?: null | NodeJS.ErrnoException, bw?: number): void; + [_flush](): void; + [_close](): void; +} +export declare class WriteStreamSync extends WriteStream { + [_open](): void; + [_close](): void; + [_write](buf: Buffer): void; +} +export {}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts.map b/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts.map new file mode 100644 index 0000000..3e2c703 --- /dev/null +++ b/node_modules/@isaacs/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,EAAE,MAAM;CAmBrB"} \ No newline at end of file diff --git a/node_modules/@isaacs/fs-minipass/dist/esm/index.js b/node_modules/@isaacs/fs-minipass/dist/esm/index.js new file mode 100644 index 0000000..287a0f6 --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/dist/esm/index.js @@ -0,0 +1,420 @@ +import EE from 'events'; +import fs from 'fs'; +import { Minipass } from 'minipass'; +const writev = fs.writev; +const _autoClose = Symbol('_autoClose'); +const _close = Symbol('_close'); +const _ended = Symbol('_ended'); +const _fd = Symbol('_fd'); +const _finished = Symbol('_finished'); +const _flags = Symbol('_flags'); +const _flush = Symbol('_flush'); +const _handleChunk = Symbol('_handleChunk'); +const _makeBuf = Symbol('_makeBuf'); +const _mode = Symbol('_mode'); +const _needDrain = Symbol('_needDrain'); +const _onerror = Symbol('_onerror'); +const _onopen = Symbol('_onopen'); +const _onread = Symbol('_onread'); +const _onwrite = Symbol('_onwrite'); +const _open = Symbol('_open'); +const _path = Symbol('_path'); +const _pos = Symbol('_pos'); +const _queue = Symbol('_queue'); +const _read = Symbol('_read'); +const _readSize = Symbol('_readSize'); +const _reading = Symbol('_reading'); +const _remain = Symbol('_remain'); +const _size = Symbol('_size'); +const _write = Symbol('_write'); +const _writing = Symbol('_writing'); +const _defaultFlag = Symbol('_defaultFlag'); +const _errored = Symbol('_errored'); +export class ReadStream extends Minipass { + [_errored] = false; + [_fd]; + [_path]; + [_readSize]; + [_reading] = false; + [_size]; + [_remain]; + [_autoClose]; + constructor(path, opt) { + opt = opt || {}; + super(opt); + this.readable = true; + this.writable = false; + if (typeof path !== 'string') { + throw new TypeError('path must be a string'); + } + this[_errored] = false; + this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined; + this[_path] = path; + this[_readSize] = opt.readSize || 16 * 1024 * 1024; + this[_reading] = false; + this[_size] = typeof opt.size === 'number' ? opt.size : Infinity; + this[_remain] = this[_size]; + this[_autoClose] = + typeof opt.autoClose === 'boolean' ? opt.autoClose : true; + if (typeof this[_fd] === 'number') { + this[_read](); + } + else { + this[_open](); + } + } + get fd() { + return this[_fd]; + } + get path() { + return this[_path]; + } + //@ts-ignore + write() { + throw new TypeError('this is a readable stream'); + } + //@ts-ignore + end() { + throw new TypeError('this is a readable stream'); + } + [_open]() { + fs.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd)); + } + [_onopen](er, fd) { + if (er) { + this[_onerror](er); + } + else { + this[_fd] = fd; + this.emit('open', fd); + this[_read](); + } + } + [_makeBuf]() { + return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain])); + } + [_read]() { + if (!this[_reading]) { + this[_reading] = true; + const buf = this[_makeBuf](); + /* c8 ignore start */ + if (buf.length === 0) { + return process.nextTick(() => this[_onread](null, 0, buf)); + } + /* c8 ignore stop */ + fs.read(this[_fd], buf, 0, buf.length, null, (er, br, b) => this[_onread](er, br, b)); + } + } + [_onread](er, br, buf) { + this[_reading] = false; + if (er) { + this[_onerror](er); + } + else if (this[_handleChunk](br, buf)) { + this[_read](); + } + } + [_close]() { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd]; + this[_fd] = undefined; + fs.close(fd, er => er ? this.emit('error', er) : this.emit('close')); + } + } + [_onerror](er) { + this[_reading] = true; + this[_close](); + this.emit('error', er); + } + [_handleChunk](br, buf) { + let ret = false; + // no effect if infinite + this[_remain] -= br; + if (br > 0) { + ret = super.write(br < buf.length ? buf.subarray(0, br) : buf); + } + if (br === 0 || this[_remain] <= 0) { + ret = false; + this[_close](); + super.end(); + } + return ret; + } + emit(ev, ...args) { + switch (ev) { + case 'prefinish': + case 'finish': + return false; + case 'drain': + if (typeof this[_fd] === 'number') { + this[_read](); + } + return false; + case 'error': + if (this[_errored]) { + return false; + } + this[_errored] = true; + return super.emit(ev, ...args); + default: + return super.emit(ev, ...args); + } + } +} +export class ReadStreamSync extends ReadStream { + [_open]() { + let threw = true; + try { + this[_onopen](null, fs.openSync(this[_path], 'r')); + threw = false; + } + finally { + if (threw) { + this[_close](); + } + } + } + [_read]() { + let threw = true; + try { + if (!this[_reading]) { + this[_reading] = true; + do { + const buf = this[_makeBuf](); + /* c8 ignore start */ + const br = buf.length === 0 + ? 0 + : fs.readSync(this[_fd], buf, 0, buf.length, null); + /* c8 ignore stop */ + if (!this[_handleChunk](br, buf)) { + break; + } + } while (true); + this[_reading] = false; + } + threw = false; + } + finally { + if (threw) { + this[_close](); + } + } + } + [_close]() { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd]; + this[_fd] = undefined; + fs.closeSync(fd); + this.emit('close'); + } + } +} +export class WriteStream extends EE { + readable = false; + writable = true; + [_errored] = false; + [_writing] = false; + [_ended] = false; + [_queue] = []; + [_needDrain] = false; + [_path]; + [_mode]; + [_autoClose]; + [_fd]; + [_defaultFlag]; + [_flags]; + [_finished] = false; + [_pos]; + constructor(path, opt) { + opt = opt || {}; + super(opt); + this[_path] = path; + this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined; + this[_mode] = opt.mode === undefined ? 0o666 : opt.mode; + this[_pos] = typeof opt.start === 'number' ? opt.start : undefined; + this[_autoClose] = + typeof opt.autoClose === 'boolean' ? opt.autoClose : true; + // truncating makes no sense when writing into the middle + const defaultFlag = this[_pos] !== undefined ? 'r+' : 'w'; + this[_defaultFlag] = opt.flags === undefined; + this[_flags] = opt.flags === undefined ? defaultFlag : opt.flags; + if (this[_fd] === undefined) { + this[_open](); + } + } + emit(ev, ...args) { + if (ev === 'error') { + if (this[_errored]) { + return false; + } + this[_errored] = true; + } + return super.emit(ev, ...args); + } + get fd() { + return this[_fd]; + } + get path() { + return this[_path]; + } + [_onerror](er) { + this[_close](); + this[_writing] = true; + this.emit('error', er); + } + [_open]() { + fs.open(this[_path], this[_flags], this[_mode], (er, fd) => this[_onopen](er, fd)); + } + [_onopen](er, fd) { + if (this[_defaultFlag] && + this[_flags] === 'r+' && + er && + er.code === 'ENOENT') { + this[_flags] = 'w'; + this[_open](); + } + else if (er) { + this[_onerror](er); + } + else { + this[_fd] = fd; + this.emit('open', fd); + if (!this[_writing]) { + this[_flush](); + } + } + } + end(buf, enc) { + if (buf) { + //@ts-ignore + this.write(buf, enc); + } + this[_ended] = true; + // synthetic after-write logic, where drain/finish live + if (!this[_writing] && + !this[_queue].length && + typeof this[_fd] === 'number') { + this[_onwrite](null, 0); + } + return this; + } + write(buf, enc) { + if (typeof buf === 'string') { + buf = Buffer.from(buf, enc); + } + if (this[_ended]) { + this.emit('error', new Error('write() after end()')); + return false; + } + if (this[_fd] === undefined || this[_writing] || this[_queue].length) { + this[_queue].push(buf); + this[_needDrain] = true; + return false; + } + this[_writing] = true; + this[_write](buf); + return true; + } + [_write](buf) { + fs.write(this[_fd], buf, 0, buf.length, this[_pos], (er, bw) => this[_onwrite](er, bw)); + } + [_onwrite](er, bw) { + if (er) { + this[_onerror](er); + } + else { + if (this[_pos] !== undefined && typeof bw === 'number') { + this[_pos] += bw; + } + if (this[_queue].length) { + this[_flush](); + } + else { + this[_writing] = false; + if (this[_ended] && !this[_finished]) { + this[_finished] = true; + this[_close](); + this.emit('finish'); + } + else if (this[_needDrain]) { + this[_needDrain] = false; + this.emit('drain'); + } + } + } + } + [_flush]() { + if (this[_queue].length === 0) { + if (this[_ended]) { + this[_onwrite](null, 0); + } + } + else if (this[_queue].length === 1) { + this[_write](this[_queue].pop()); + } + else { + const iovec = this[_queue]; + this[_queue] = []; + writev(this[_fd], iovec, this[_pos], (er, bw) => this[_onwrite](er, bw)); + } + } + [_close]() { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd]; + this[_fd] = undefined; + fs.close(fd, er => er ? this.emit('error', er) : this.emit('close')); + } + } +} +export class WriteStreamSync extends WriteStream { + [_open]() { + let fd; + // only wrap in a try{} block if we know we'll retry, to avoid + // the rethrow obscuring the error's source frame in most cases. + if (this[_defaultFlag] && this[_flags] === 'r+') { + try { + fd = fs.openSync(this[_path], this[_flags], this[_mode]); + } + catch (er) { + if (er?.code === 'ENOENT') { + this[_flags] = 'w'; + return this[_open](); + } + else { + throw er; + } + } + } + else { + fd = fs.openSync(this[_path], this[_flags], this[_mode]); + } + this[_onopen](null, fd); + } + [_close]() { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd]; + this[_fd] = undefined; + fs.closeSync(fd); + this.emit('close'); + } + } + [_write](buf) { + // throw the original, but try to close if it fails + let threw = true; + try { + this[_onwrite](null, fs.writeSync(this[_fd], buf, 0, buf.length, this[_pos])); + threw = false; + } + finally { + if (threw) { + try { + this[_close](); + } + catch { + // ok error + } + } + } + } +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@isaacs/fs-minipass/dist/esm/index.js.map b/node_modules/@isaacs/fs-minipass/dist/esm/index.js.map new file mode 100644 index 0000000..2ef8b14 --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/dist/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,QAAQ,CAAA;AACvB,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAEnC,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,CAAA;AAExB,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;AACvC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC/B,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;AACzB,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,CAAA;AACrC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC/B,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC/B,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAA;AAC3C,MAAM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B,CAAC;IAED,CAAC,MAAM,CAAC;QACN,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE,CAAC;YACtD,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAA;YACpB,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS,CAAA;YACrB,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;YAChB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QACpB,CAAC;IACH,CAAC;IAED,CAAC,MAAM,CAAC,CAAC,GAAW;QAClB,mDAAmD;QACnD,IAAI,KAAK,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC;YACH,IAAI,CAAC,QAAQ,CAAC,CACZ,IAAI,EACJ,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAW,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAClE,CAAA;YACD,KAAK,GAAG,KAAK,CAAA;QACf,CAAC;gBAAS,CAAC;YACT,IAAI,KAAK,EAAE,CAAC;gBACV,IAAI,CAAC;oBACH,IAAI,CAAC,MAAM,CAAC,EAAE,CAAA;gBAChB,CAAC;gBAAC,MAAM,CAAC;oBACP,WAAW;gBACb,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["import EE from 'events'\nimport fs from 'fs'\nimport { Minipass } from 'minipass'\n\nconst writev = fs.writev\n\nconst _autoClose = Symbol('_autoClose')\nconst _close = Symbol('_close')\nconst _ended = Symbol('_ended')\nconst _fd = Symbol('_fd')\nconst _finished = Symbol('_finished')\nconst _flags = Symbol('_flags')\nconst _flush = Symbol('_flush')\nconst _handleChunk = Symbol('_handleChunk')\nconst _makeBuf = Symbol('_makeBuf')\nconst _mode = Symbol('_mode')\nconst _needDrain = Symbol('_needDrain')\nconst _onerror = Symbol('_onerror')\nconst _onopen = Symbol('_onopen')\nconst _onread = Symbol('_onread')\nconst _onwrite = Symbol('_onwrite')\nconst _open = Symbol('_open')\nconst _path = Symbol('_path')\nconst _pos = Symbol('_pos')\nconst _queue = Symbol('_queue')\nconst _read = Symbol('_read')\nconst _readSize = Symbol('_readSize')\nconst _reading = Symbol('_reading')\nconst _remain = Symbol('_remain')\nconst _size = Symbol('_size')\nconst _write = Symbol('_write')\nconst _writing = Symbol('_writing')\nconst _defaultFlag = Symbol('_defaultFlag')\nconst _errored = Symbol('_errored')\n\nexport type ReadStreamOptions =\n Minipass.Options & {\n fd?: number\n readSize?: number\n size?: number\n autoClose?: boolean\n }\n\nexport type ReadStreamEvents = Minipass.Events & {\n open: [fd: number]\n}\n\nexport class ReadStream extends Minipass<\n Minipass.ContiguousData,\n Buffer,\n ReadStreamEvents\n> {\n [_errored]: boolean = false;\n [_fd]?: number;\n [_path]: string;\n [_readSize]: number;\n [_reading]: boolean = false;\n [_size]: number;\n [_remain]: number;\n [_autoClose]: boolean\n\n constructor(path: string, opt: ReadStreamOptions) {\n opt = opt || {}\n super(opt)\n\n this.readable = true\n this.writable = false\n\n if (typeof path !== 'string') {\n throw new TypeError('path must be a string')\n }\n\n this[_errored] = false\n this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined\n this[_path] = path\n this[_readSize] = opt.readSize || 16 * 1024 * 1024\n this[_reading] = false\n this[_size] = typeof opt.size === 'number' ? opt.size : Infinity\n this[_remain] = this[_size]\n this[_autoClose] =\n typeof opt.autoClose === 'boolean' ? opt.autoClose : true\n\n if (typeof this[_fd] === 'number') {\n this[_read]()\n } else {\n this[_open]()\n }\n }\n\n get fd() {\n return this[_fd]\n }\n\n get path() {\n return this[_path]\n }\n\n //@ts-ignore\n write() {\n throw new TypeError('this is a readable stream')\n }\n\n //@ts-ignore\n end() {\n throw new TypeError('this is a readable stream')\n }\n\n [_open]() {\n fs.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd))\n }\n\n [_onopen](er?: NodeJS.ErrnoException | null, fd?: number) {\n if (er) {\n this[_onerror](er)\n } else {\n this[_fd] = fd\n this.emit('open', fd as number)\n this[_read]()\n }\n }\n\n [_makeBuf]() {\n return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain]))\n }\n\n [_read]() {\n if (!this[_reading]) {\n this[_reading] = true\n const buf = this[_makeBuf]()\n /* c8 ignore start */\n if (buf.length === 0) {\n return process.nextTick(() => this[_onread](null, 0, buf))\n }\n /* c8 ignore stop */\n fs.read(this[_fd] as number, buf, 0, buf.length, null, (er, br, b) =>\n this[_onread](er, br, b),\n )\n }\n }\n\n [_onread](er?: NodeJS.ErrnoException | null, br?: number, buf?: Buffer) {\n this[_reading] = false\n if (er) {\n this[_onerror](er)\n } else if (this[_handleChunk](br as number, buf as Buffer)) {\n this[_read]()\n }\n }\n\n [_close]() {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = undefined\n fs.close(fd, er =>\n er ? this.emit('error', er) : this.emit('close'),\n )\n }\n }\n\n [_onerror](er: NodeJS.ErrnoException) {\n this[_reading] = true\n this[_close]()\n this.emit('error', er)\n }\n\n [_handleChunk](br: number, buf: Buffer) {\n let ret = false\n // no effect if infinite\n this[_remain] -= br\n if (br > 0) {\n ret = super.write(br < buf.length ? buf.subarray(0, br) : buf)\n }\n\n if (br === 0 || this[_remain] <= 0) {\n ret = false\n this[_close]()\n super.end()\n }\n\n return ret\n }\n\n emit(\n ev: Event,\n ...args: ReadStreamEvents[Event]\n ): boolean {\n switch (ev) {\n case 'prefinish':\n case 'finish':\n return false\n\n case 'drain':\n if (typeof this[_fd] === 'number') {\n this[_read]()\n }\n return false\n\n case 'error':\n if (this[_errored]) {\n return false\n }\n this[_errored] = true\n return super.emit(ev, ...args)\n\n default:\n return super.emit(ev, ...args)\n }\n }\n}\n\nexport class ReadStreamSync extends ReadStream {\n [_open]() {\n let threw = true\n try {\n this[_onopen](null, fs.openSync(this[_path], 'r'))\n threw = false\n } finally {\n if (threw) {\n this[_close]()\n }\n }\n }\n\n [_read]() {\n let threw = true\n try {\n if (!this[_reading]) {\n this[_reading] = true\n do {\n const buf = this[_makeBuf]()\n /* c8 ignore start */\n const br =\n buf.length === 0\n ? 0\n : fs.readSync(this[_fd] as number, buf, 0, buf.length, null)\n /* c8 ignore stop */\n if (!this[_handleChunk](br, buf)) {\n break\n }\n } while (true)\n this[_reading] = false\n }\n threw = false\n } finally {\n if (threw) {\n this[_close]()\n }\n }\n }\n\n [_close]() {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = undefined\n fs.closeSync(fd)\n this.emit('close')\n }\n }\n}\n\nexport type WriteStreamOptions = {\n fd?: number\n autoClose?: boolean\n mode?: number\n captureRejections?: boolean\n start?: number\n flags?: string\n}\n\nexport class WriteStream extends EE {\n readable: false = false\n writable: boolean = true;\n [_errored]: boolean = false;\n [_writing]: boolean = false;\n [_ended]: boolean = false;\n [_queue]: Buffer[] = [];\n [_needDrain]: boolean = false;\n [_path]: string;\n [_mode]: number;\n [_autoClose]: boolean;\n [_fd]?: number;\n [_defaultFlag]: boolean;\n [_flags]: string;\n [_finished]: boolean = false;\n [_pos]?: number\n\n constructor(path: string, opt: WriteStreamOptions) {\n opt = opt || {}\n super(opt)\n this[_path] = path\n this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined\n this[_mode] = opt.mode === undefined ? 0o666 : opt.mode\n this[_pos] = typeof opt.start === 'number' ? opt.start : undefined\n this[_autoClose] =\n typeof opt.autoClose === 'boolean' ? opt.autoClose : true\n\n // truncating makes no sense when writing into the middle\n const defaultFlag = this[_pos] !== undefined ? 'r+' : 'w'\n this[_defaultFlag] = opt.flags === undefined\n this[_flags] = opt.flags === undefined ? defaultFlag : opt.flags\n\n if (this[_fd] === undefined) {\n this[_open]()\n }\n }\n\n emit(ev: string, ...args: any[]) {\n if (ev === 'error') {\n if (this[_errored]) {\n return false\n }\n this[_errored] = true\n }\n return super.emit(ev, ...args)\n }\n\n get fd() {\n return this[_fd]\n }\n\n get path() {\n return this[_path]\n }\n\n [_onerror](er: NodeJS.ErrnoException) {\n this[_close]()\n this[_writing] = true\n this.emit('error', er)\n }\n\n [_open]() {\n fs.open(this[_path], this[_flags], this[_mode], (er, fd) =>\n this[_onopen](er, fd),\n )\n }\n\n [_onopen](er?: null | NodeJS.ErrnoException, fd?: number) {\n if (\n this[_defaultFlag] &&\n this[_flags] === 'r+' &&\n er &&\n er.code === 'ENOENT'\n ) {\n this[_flags] = 'w'\n this[_open]()\n } else if (er) {\n this[_onerror](er)\n } else {\n this[_fd] = fd\n this.emit('open', fd)\n if (!this[_writing]) {\n this[_flush]()\n }\n }\n }\n\n end(buf: string, enc?: BufferEncoding): this\n end(buf?: Buffer, enc?: undefined): this\n end(buf?: Buffer | string, enc?: BufferEncoding): this {\n if (buf) {\n //@ts-ignore\n this.write(buf, enc)\n }\n\n this[_ended] = true\n\n // synthetic after-write logic, where drain/finish live\n if (\n !this[_writing] &&\n !this[_queue].length &&\n typeof this[_fd] === 'number'\n ) {\n this[_onwrite](null, 0)\n }\n return this\n }\n\n write(buf: string, enc?: BufferEncoding): boolean\n write(buf: Buffer, enc?: undefined): boolean\n write(buf: Buffer | string, enc?: BufferEncoding): boolean {\n if (typeof buf === 'string') {\n buf = Buffer.from(buf, enc)\n }\n\n if (this[_ended]) {\n this.emit('error', new Error('write() after end()'))\n return false\n }\n\n if (this[_fd] === undefined || this[_writing] || this[_queue].length) {\n this[_queue].push(buf)\n this[_needDrain] = true\n return false\n }\n\n this[_writing] = true\n this[_write](buf)\n return true\n }\n\n [_write](buf: Buffer) {\n fs.write(\n this[_fd] as number,\n buf,\n 0,\n buf.length,\n this[_pos],\n (er, bw) => this[_onwrite](er, bw),\n )\n }\n\n [_onwrite](er?: null | NodeJS.ErrnoException, bw?: number) {\n if (er) {\n this[_onerror](er)\n } else {\n if (this[_pos] !== undefined && typeof bw === 'number') {\n this[_pos] += bw\n }\n if (this[_queue].length) {\n this[_flush]()\n } else {\n this[_writing] = false\n\n if (this[_ended] && !this[_finished]) {\n this[_finished] = true\n this[_close]()\n this.emit('finish')\n } else if (this[_needDrain]) {\n this[_needDrain] = false\n this.emit('drain')\n }\n }\n }\n }\n\n [_flush]() {\n if (this[_queue].length === 0) {\n if (this[_ended]) {\n this[_onwrite](null, 0)\n }\n } else if (this[_queue].length === 1) {\n this[_write](this[_queue].pop() as Buffer)\n } else {\n const iovec = this[_queue]\n this[_queue] = []\n writev(this[_fd] as number, iovec, this[_pos] as number, (er, bw) =>\n this[_onwrite](er, bw),\n )\n }\n }\n\n [_close]() {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = undefined\n fs.close(fd, er =>\n er ? this.emit('error', er) : this.emit('close'),\n )\n }\n }\n}\n\nexport class WriteStreamSync extends WriteStream {\n [_open](): void {\n let fd\n // only wrap in a try{} block if we know we'll retry, to avoid\n // the rethrow obscuring the error's source frame in most cases.\n if (this[_defaultFlag] && this[_flags] === 'r+') {\n try {\n fd = fs.openSync(this[_path], this[_flags], this[_mode])\n } catch (er) {\n if ((er as NodeJS.ErrnoException)?.code === 'ENOENT') {\n this[_flags] = 'w'\n return this[_open]()\n } else {\n throw er\n }\n }\n } else {\n fd = fs.openSync(this[_path], this[_flags], this[_mode])\n }\n\n this[_onopen](null, fd)\n }\n\n [_close]() {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = undefined\n fs.closeSync(fd)\n this.emit('close')\n }\n }\n\n [_write](buf: Buffer) {\n // throw the original, but try to close if it fails\n let threw = true\n try {\n this[_onwrite](\n null,\n fs.writeSync(this[_fd] as number, buf, 0, buf.length, this[_pos]),\n )\n threw = false\n } finally {\n if (threw) {\n try {\n this[_close]()\n } catch {\n // ok error\n }\n }\n }\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@isaacs/fs-minipass/dist/esm/package.json b/node_modules/@isaacs/fs-minipass/dist/esm/package.json new file mode 100644 index 0000000..3dbc1ca --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/@isaacs/fs-minipass/package.json b/node_modules/@isaacs/fs-minipass/package.json new file mode 100644 index 0000000..cc4576c --- /dev/null +++ b/node_modules/@isaacs/fs-minipass/package.json @@ -0,0 +1,72 @@ +{ + "name": "@isaacs/fs-minipass", + "version": "4.0.1", + "main": "./dist/commonjs/index.js", + "scripts": { + "prepare": "tshy", + "pretest": "npm run prepare", + "test": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "format": "prettier --write . --loglevel warn", + "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts" + }, + "keywords": [], + "author": "Isaac Z. Schlueter", + "license": "ISC", + "repository": { + "type": "git", + "url": "https://github.com/npm/fs-minipass.git" + }, + "description": "fs read and write streams based on minipass", + "dependencies": { + "minipass": "^7.0.4" + }, + "devDependencies": { + "@types/node": "^20.11.30", + "mutate-fs": "^2.1.1", + "prettier": "^3.2.5", + "tap": "^18.7.1", + "tshy": "^1.12.0", + "typedoc": "^0.25.12" + }, + "files": [ + "dist" + ], + "engines": { + "node": ">=18.0.0" + }, + "tshy": { + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts" + } + }, + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + } + }, + "types": "./dist/commonjs/index.d.ts", + "type": "module", + "prettier": { + "semi": false, + "printWidth": 75, + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "jsxSingleQuote": false, + "bracketSameLine": true, + "arrowParens": "avoid", + "endOfLine": "lf" + } +} diff --git a/node_modules/@npmcli/agent/README.md b/node_modules/@npmcli/agent/README.md new file mode 100644 index 0000000..a3a9105 --- /dev/null +++ b/node_modules/@npmcli/agent/README.md @@ -0,0 +1,40 @@ +## @npmcli/agent + +A pair of Agent implementations for nodejs that provide consistent keep-alives, granular timeouts, dns caching, and proxy support. + +### Usage + +```js +const { getAgent, HttpAgent } = require('@npmcli/agent') +const fetch = require('minipass-fetch') + +const main = async () => { + // if you know what agent you need, you can create one directly + const agent = new HttpAgent(agentOptions) + // or you can use the getAgent helper, it will determine and create an Agent + // instance for you as well as reuse that agent for new requests as appropriate + const agent = getAgent('https://registry.npmjs.org/npm', agentOptions) + // minipass-fetch is just an example, this will work for any http client that + // supports node's Agents + const res = await fetch('https://registry.npmjs.org/npm', { agent }) +} + +main() +``` + +### Options + +All options supported by the node Agent implementations are supported here, see [the docs](https://nodejs.org/api/http.html#new-agentoptions) for those. + +Options that have been added by this module include: + +- `family`: what tcp family to use, can be `4` for IPv4, `6` for IPv6 or `0` for both. +- `proxy`: a URL to a supported proxy, currently supports `HTTP CONNECT` based http/https proxies as well as socks4 and 5. +- `dns`: configuration for the built-in dns cache + - `ttl`: how long (in milliseconds) to keep cached dns entries, defaults to `5 * 60 * 100 (5 minutes)` + - `lookup`: optional function to override how dns lookups are performed, defaults to `require('dns').lookup` +- `timeouts`: a set of granular timeouts, all default to `0` + - `connection`: time between initiating connection and actually connecting + - `idle`: time between data packets (if a top level `timeout` is provided, it will be copied here) + - `response`: time between sending a request and receiving a response + - `transfer`: time between starting to receive a request and consuming the response fully diff --git a/node_modules/@npmcli/agent/lib/agents.js b/node_modules/@npmcli/agent/lib/agents.js new file mode 100644 index 0000000..c541b93 --- /dev/null +++ b/node_modules/@npmcli/agent/lib/agents.js @@ -0,0 +1,206 @@ +'use strict' + +const net = require('net') +const tls = require('tls') +const { once } = require('events') +const timers = require('timers/promises') +const { normalizeOptions, cacheOptions } = require('./options') +const { getProxy, getProxyAgent, proxyCache } = require('./proxy.js') +const Errors = require('./errors.js') +const { Agent: AgentBase } = require('agent-base') + +module.exports = class Agent extends AgentBase { + #options + #timeouts + #proxy + #noProxy + #ProxyAgent + + constructor (options = {}) { + const { timeouts, proxy, noProxy, ...normalizedOptions } = normalizeOptions(options) + + super(normalizedOptions) + + this.#options = normalizedOptions + this.#timeouts = timeouts + + if (proxy) { + this.#proxy = new URL(proxy) + this.#noProxy = noProxy + this.#ProxyAgent = getProxyAgent(proxy) + } + } + + get proxy () { + return this.#proxy ? { url: this.#proxy } : {} + } + + #getProxy (options) { + if (!this.#proxy) { + return + } + + const proxy = getProxy(`${options.protocol}//${options.host}:${options.port}`, { + proxy: this.#proxy, + noProxy: this.#noProxy, + }) + + if (!proxy) { + return + } + + const cacheKey = cacheOptions({ + ...options, + ...this.#options, + timeouts: this.#timeouts, + proxy, + }) + + if (proxyCache.has(cacheKey)) { + return proxyCache.get(cacheKey) + } + + let ProxyAgent = this.#ProxyAgent + if (Array.isArray(ProxyAgent)) { + ProxyAgent = this.isSecureEndpoint(options) ? ProxyAgent[1] : ProxyAgent[0] + } + + const proxyAgent = new ProxyAgent(proxy, { + ...this.#options, + socketOptions: { family: this.#options.family }, + }) + proxyCache.set(cacheKey, proxyAgent) + + return proxyAgent + } + + // takes an array of promises and races them against the connection timeout + // which will throw the necessary error if it is hit. This will return the + // result of the promise race. + async #timeoutConnection ({ promises, options, timeout }, ac = new AbortController()) { + if (timeout) { + const connectionTimeout = timers.setTimeout(timeout, null, { signal: ac.signal }) + .then(() => { + throw new Errors.ConnectionTimeoutError(`${options.host}:${options.port}`) + }).catch((err) => { + if (err.name === 'AbortError') { + return + } + throw err + }) + promises.push(connectionTimeout) + } + + let result + try { + result = await Promise.race(promises) + ac.abort() + } catch (err) { + ac.abort() + throw err + } + return result + } + + async connect (request, options) { + // if the connection does not have its own lookup function + // set, then use the one from our options + options.lookup ??= this.#options.lookup + + let socket + let timeout = this.#timeouts.connection + const isSecureEndpoint = this.isSecureEndpoint(options) + + const proxy = this.#getProxy(options) + if (proxy) { + // some of the proxies will wait for the socket to fully connect before + // returning so we have to await this while also racing it against the + // connection timeout. + const start = Date.now() + socket = await this.#timeoutConnection({ + options, + timeout, + promises: [proxy.connect(request, options)], + }) + // see how much time proxy.connect took and subtract it from + // the timeout + if (timeout) { + timeout = timeout - (Date.now() - start) + } + } else { + socket = (isSecureEndpoint ? tls : net).connect(options) + } + + socket.setKeepAlive(this.keepAlive, this.keepAliveMsecs) + socket.setNoDelay(this.keepAlive) + + const abortController = new AbortController() + const { signal } = abortController + + const connectPromise = socket[isSecureEndpoint ? 'secureConnecting' : 'connecting'] + ? once(socket, isSecureEndpoint ? 'secureConnect' : 'connect', { signal }) + : Promise.resolve() + + await this.#timeoutConnection({ + options, + timeout, + promises: [ + connectPromise, + once(socket, 'error', { signal }).then((err) => { + throw err[0] + }), + ], + }, abortController) + + if (this.#timeouts.idle) { + socket.setTimeout(this.#timeouts.idle, () => { + socket.destroy(new Errors.IdleTimeoutError(`${options.host}:${options.port}`)) + }) + } + + return socket + } + + addRequest (request, options) { + const proxy = this.#getProxy(options) + // it would be better to call proxy.addRequest here but this causes the + // http-proxy-agent to call its super.addRequest which causes the request + // to be added to the agent twice. since we only support 3 agents + // currently (see the required agents in proxy.js) we have manually + // checked that the only public methods we need to call are called in the + // next block. this could change in the future and presumably we would get + // failing tests until we have properly called the necessary methods on + // each of our proxy agents + if (proxy?.setRequestProps) { + proxy.setRequestProps(request, options) + } + + request.setHeader('connection', this.keepAlive ? 'keep-alive' : 'close') + + if (this.#timeouts.response) { + let responseTimeout + request.once('finish', () => { + setTimeout(() => { + request.destroy(new Errors.ResponseTimeoutError(request, this.#proxy)) + }, this.#timeouts.response) + }) + request.once('response', () => { + clearTimeout(responseTimeout) + }) + } + + if (this.#timeouts.transfer) { + let transferTimeout + request.once('response', (res) => { + setTimeout(() => { + res.destroy(new Errors.TransferTimeoutError(request, this.#proxy)) + }, this.#timeouts.transfer) + res.once('close', () => { + clearTimeout(transferTimeout) + }) + }) + } + + return super.addRequest(request, options) + } +} diff --git a/node_modules/@npmcli/agent/lib/dns.js b/node_modules/@npmcli/agent/lib/dns.js new file mode 100644 index 0000000..3c6946c --- /dev/null +++ b/node_modules/@npmcli/agent/lib/dns.js @@ -0,0 +1,53 @@ +'use strict' + +const { LRUCache } = require('lru-cache') +const dns = require('dns') + +// this is a factory so that each request can have its own opts (i.e. ttl) +// while still sharing the cache across all requests +const cache = new LRUCache({ max: 50 }) + +const getOptions = ({ + family = 0, + hints = dns.ADDRCONFIG, + all = false, + verbatim = undefined, + ttl = 5 * 60 * 1000, + lookup = dns.lookup, +}) => ({ + // hints and lookup are returned since both are top level properties to (net|tls).connect + hints, + lookup: (hostname, ...args) => { + const callback = args.pop() // callback is always last arg + const lookupOptions = args[0] ?? {} + + const options = { + family, + hints, + all, + verbatim, + ...(typeof lookupOptions === 'number' ? { family: lookupOptions } : lookupOptions), + } + + const key = JSON.stringify({ hostname, ...options }) + + if (cache.has(key)) { + const cached = cache.get(key) + return process.nextTick(callback, null, ...cached) + } + + lookup(hostname, options, (err, ...result) => { + if (err) { + return callback(err) + } + + cache.set(key, result, { ttl }) + return callback(null, ...result) + }) + }, +}) + +module.exports = { + cache, + getOptions, +} diff --git a/node_modules/@npmcli/agent/lib/errors.js b/node_modules/@npmcli/agent/lib/errors.js new file mode 100644 index 0000000..70475ae --- /dev/null +++ b/node_modules/@npmcli/agent/lib/errors.js @@ -0,0 +1,61 @@ +'use strict' + +class InvalidProxyProtocolError extends Error { + constructor (url) { + super(`Invalid protocol \`${url.protocol}\` connecting to proxy \`${url.host}\``) + this.code = 'EINVALIDPROXY' + this.proxy = url + } +} + +class ConnectionTimeoutError extends Error { + constructor (host) { + super(`Timeout connecting to host \`${host}\``) + this.code = 'ECONNECTIONTIMEOUT' + this.host = host + } +} + +class IdleTimeoutError extends Error { + constructor (host) { + super(`Idle timeout reached for host \`${host}\``) + this.code = 'EIDLETIMEOUT' + this.host = host + } +} + +class ResponseTimeoutError extends Error { + constructor (request, proxy) { + let msg = 'Response timeout ' + if (proxy) { + msg += `from proxy \`${proxy.host}\` ` + } + msg += `connecting to host \`${request.host}\`` + super(msg) + this.code = 'ERESPONSETIMEOUT' + this.proxy = proxy + this.request = request + } +} + +class TransferTimeoutError extends Error { + constructor (request, proxy) { + let msg = 'Transfer timeout ' + if (proxy) { + msg += `from proxy \`${proxy.host}\` ` + } + msg += `for \`${request.host}\`` + super(msg) + this.code = 'ETRANSFERTIMEOUT' + this.proxy = proxy + this.request = request + } +} + +module.exports = { + InvalidProxyProtocolError, + ConnectionTimeoutError, + IdleTimeoutError, + ResponseTimeoutError, + TransferTimeoutError, +} diff --git a/node_modules/@npmcli/agent/lib/index.js b/node_modules/@npmcli/agent/lib/index.js new file mode 100644 index 0000000..b33d6ea --- /dev/null +++ b/node_modules/@npmcli/agent/lib/index.js @@ -0,0 +1,56 @@ +'use strict' + +const { LRUCache } = require('lru-cache') +const { normalizeOptions, cacheOptions } = require('./options') +const { getProxy, proxyCache } = require('./proxy.js') +const dns = require('./dns.js') +const Agent = require('./agents.js') + +const agentCache = new LRUCache({ max: 20 }) + +const getAgent = (url, { agent, proxy, noProxy, ...options } = {}) => { + // false has meaning so this can't be a simple truthiness check + if (agent != null) { + return agent + } + + url = new URL(url) + + const proxyForUrl = getProxy(url, { proxy, noProxy }) + const normalizedOptions = { + ...normalizeOptions(options), + proxy: proxyForUrl, + } + + const cacheKey = cacheOptions({ + ...normalizedOptions, + secureEndpoint: url.protocol === 'https:', + }) + + if (agentCache.has(cacheKey)) { + return agentCache.get(cacheKey) + } + + const newAgent = new Agent(normalizedOptions) + agentCache.set(cacheKey, newAgent) + + return newAgent +} + +module.exports = { + getAgent, + Agent, + // these are exported for backwards compatability + HttpAgent: Agent, + HttpsAgent: Agent, + cache: { + proxy: proxyCache, + agent: agentCache, + dns: dns.cache, + clear: () => { + proxyCache.clear() + agentCache.clear() + dns.cache.clear() + }, + }, +} diff --git a/node_modules/@npmcli/agent/lib/options.js b/node_modules/@npmcli/agent/lib/options.js new file mode 100644 index 0000000..0bf53f7 --- /dev/null +++ b/node_modules/@npmcli/agent/lib/options.js @@ -0,0 +1,86 @@ +'use strict' + +const dns = require('./dns') + +const normalizeOptions = (opts) => { + const family = parseInt(opts.family ?? '0', 10) + const keepAlive = opts.keepAlive ?? true + + const normalized = { + // nodejs http agent options. these are all the defaults + // but kept here to increase the likelihood of cache hits + // https://nodejs.org/api/http.html#new-agentoptions + keepAliveMsecs: keepAlive ? 1000 : undefined, + maxSockets: opts.maxSockets ?? 15, + maxTotalSockets: Infinity, + maxFreeSockets: keepAlive ? 256 : undefined, + scheduling: 'fifo', + // then spread the rest of the options + ...opts, + // we already set these to their defaults that we want + family, + keepAlive, + // our custom timeout options + timeouts: { + // the standard timeout option is mapped to our idle timeout + // and then deleted below + idle: opts.timeout ?? 0, + connection: 0, + response: 0, + transfer: 0, + ...opts.timeouts, + }, + // get the dns options that go at the top level of socket connection + ...dns.getOptions({ family, ...opts.dns }), + } + + // remove timeout since we already used it to set our own idle timeout + delete normalized.timeout + + return normalized +} + +const createKey = (obj) => { + let key = '' + const sorted = Object.entries(obj).sort((a, b) => a[0] - b[0]) + for (let [k, v] of sorted) { + if (v == null) { + v = 'null' + } else if (v instanceof URL) { + v = v.toString() + } else if (typeof v === 'object') { + v = createKey(v) + } + key += `${k}:${v}:` + } + return key +} + +const cacheOptions = ({ secureEndpoint, ...options }) => createKey({ + secureEndpoint: !!secureEndpoint, + // socket connect options + family: options.family, + hints: options.hints, + localAddress: options.localAddress, + // tls specific connect options + strictSsl: secureEndpoint ? !!options.rejectUnauthorized : false, + ca: secureEndpoint ? options.ca : null, + cert: secureEndpoint ? options.cert : null, + key: secureEndpoint ? options.key : null, + // http agent options + keepAlive: options.keepAlive, + keepAliveMsecs: options.keepAliveMsecs, + maxSockets: options.maxSockets, + maxTotalSockets: options.maxTotalSockets, + maxFreeSockets: options.maxFreeSockets, + scheduling: options.scheduling, + // timeout options + timeouts: options.timeouts, + // proxy + proxy: options.proxy, +}) + +module.exports = { + normalizeOptions, + cacheOptions, +} diff --git a/node_modules/@npmcli/agent/lib/proxy.js b/node_modules/@npmcli/agent/lib/proxy.js new file mode 100644 index 0000000..6272e92 --- /dev/null +++ b/node_modules/@npmcli/agent/lib/proxy.js @@ -0,0 +1,88 @@ +'use strict' + +const { HttpProxyAgent } = require('http-proxy-agent') +const { HttpsProxyAgent } = require('https-proxy-agent') +const { SocksProxyAgent } = require('socks-proxy-agent') +const { LRUCache } = require('lru-cache') +const { InvalidProxyProtocolError } = require('./errors.js') + +const PROXY_CACHE = new LRUCache({ max: 20 }) + +const SOCKS_PROTOCOLS = new Set(SocksProxyAgent.protocols) + +const PROXY_ENV_KEYS = new Set(['https_proxy', 'http_proxy', 'proxy', 'no_proxy']) + +const PROXY_ENV = Object.entries(process.env).reduce((acc, [key, value]) => { + key = key.toLowerCase() + if (PROXY_ENV_KEYS.has(key)) { + acc[key] = value + } + return acc +}, {}) + +const getProxyAgent = (url) => { + url = new URL(url) + + const protocol = url.protocol.slice(0, -1) + if (SOCKS_PROTOCOLS.has(protocol)) { + return SocksProxyAgent + } + if (protocol === 'https' || protocol === 'http') { + return [HttpProxyAgent, HttpsProxyAgent] + } + + throw new InvalidProxyProtocolError(url) +} + +const isNoProxy = (url, noProxy) => { + if (typeof noProxy === 'string') { + noProxy = noProxy.split(',').map((p) => p.trim()).filter(Boolean) + } + + if (!noProxy || !noProxy.length) { + return false + } + + const hostSegments = url.hostname.split('.').reverse() + + return noProxy.some((no) => { + const noSegments = no.split('.').filter(Boolean).reverse() + if (!noSegments.length) { + return false + } + + for (let i = 0; i < noSegments.length; i++) { + if (hostSegments[i] !== noSegments[i]) { + return false + } + } + + return true + }) +} + +const getProxy = (url, { proxy, noProxy }) => { + url = new URL(url) + + if (!proxy) { + proxy = url.protocol === 'https:' + ? PROXY_ENV.https_proxy + : PROXY_ENV.https_proxy || PROXY_ENV.http_proxy || PROXY_ENV.proxy + } + + if (!noProxy) { + noProxy = PROXY_ENV.no_proxy + } + + if (!proxy || isNoProxy(url, noProxy)) { + return null + } + + return new URL(proxy) +} + +module.exports = { + getProxyAgent, + getProxy, + proxyCache: PROXY_CACHE, +} diff --git a/node_modules/@npmcli/agent/package.json b/node_modules/@npmcli/agent/package.json new file mode 100644 index 0000000..4d648fb --- /dev/null +++ b/node_modules/@npmcli/agent/package.json @@ -0,0 +1,60 @@ +{ + "name": "@npmcli/agent", + "version": "3.0.0", + "description": "the http/https agent used by the npm cli", + "main": "lib/index.js", + "scripts": { + "gencerts": "bash scripts/create-cert.sh", + "test": "tap", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run eslint -- --fix", + "snap": "tap", + "posttest": "npm run lint", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "author": "GitHub Inc.", + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/agent/issues" + }, + "homepage": "https://github.com/npm/agent#readme", + "files": [ + "bin/", + "lib/" + ], + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.1", + "publish": "true" + }, + "dependencies": { + "agent-base": "^7.1.0", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.1", + "lru-cache": "^10.0.1", + "socks-proxy-agent": "^8.0.3" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.1", + "minipass-fetch": "^3.0.3", + "nock": "^13.2.7", + "socksv5": "^0.0.6", + "tap": "^16.3.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/agent.git" + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/@npmcli/fs/LICENSE.md b/node_modules/@npmcli/fs/LICENSE.md new file mode 100644 index 0000000..5fc208f --- /dev/null +++ b/node_modules/@npmcli/fs/LICENSE.md @@ -0,0 +1,20 @@ + + +ISC License + +Copyright npm, Inc. + +Permission to use, copy, modify, and/or distribute this +software for any purpose with or without fee is hereby +granted, provided that the above copyright notice and this +permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND NPM DISCLAIMS ALL +WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO +EVENT SHALL NPM BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE +USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@npmcli/fs/README.md b/node_modules/@npmcli/fs/README.md new file mode 100644 index 0000000..ac42afe --- /dev/null +++ b/node_modules/@npmcli/fs/README.md @@ -0,0 +1,97 @@ +# @npmcli/fs + +polyfills, and extensions, of the core `fs` module. + +## Features + +- `fs.cp` polyfill for node < 16.7.0 +- `fs.withTempDir` added +- `fs.readdirScoped` added +- `fs.moveFile` added + +## `fs.withTempDir(root, fn, options) -> Promise` + +### Parameters + +- `root`: the directory in which to create the temporary directory +- `fn`: a function that will be called with the path to the temporary directory +- `options` + - `tmpPrefix`: a prefix to be used in the generated directory name + +### Usage + +The `withTempDir` function creates a temporary directory, runs the provided +function (`fn`), then removes the temporary directory and resolves or rejects +based on the result of `fn`. + +```js +const fs = require('@npmcli/fs') +const os = require('os') + +// this function will be called with the full path to the temporary directory +// it is called with `await` behind the scenes, so can be async if desired. +const myFunction = async (tempPath) => { + return 'done!' +} + +const main = async () => { + const result = await fs.withTempDir(os.tmpdir(), myFunction) + // result === 'done!' +} + +main() +``` + +## `fs.readdirScoped(root) -> Promise` + +### Parameters + +- `root`: the directory to read + +### Usage + +Like `fs.readdir` but handling `@org/module` dirs as if they were +a single entry. + +```javascript +const { readdirScoped } = require('@npmcli/fs') +const entries = await readdirScoped('node_modules') +// entries will be something like: ['a', '@org/foo', '@org/bar'] +``` + +## `fs.moveFile(source, dest, options) -> Promise` + +A fork of [move-file](https://github.com/sindresorhus/move-file) with +support for Common JS. + +### Highlights + +- Promise API. +- Supports moving a file across partitions and devices. +- Optionally prevent overwriting an existing file. +- Creates non-existent destination directories for you. +- Automatically recurses when source is a directory. + +### Parameters + +- `source`: File, or directory, you want to move. +- `dest`: Where you want the file or directory moved. +- `options` + - `overwrite` (`boolean`, default: `true`): Overwrite existing destination file(s). + +### Usage + +The built-in +[`fs.rename()`](https://nodejs.org/api/fs.html#fs_fs_rename_oldpath_newpath_callback) +is just a JavaScript wrapper for the C `rename(2)` function, which doesn't +support moving files across partitions or devices. This module is what you +would have expected `fs.rename()` to be. + +```js +const { moveFile } = require('@npmcli/fs'); + +(async () => { + await moveFile('source/unicorn.png', 'destination/unicorn.png'); + console.log('The file has been moved'); +})(); +``` diff --git a/node_modules/@npmcli/fs/lib/common/get-options.js b/node_modules/@npmcli/fs/lib/common/get-options.js new file mode 100644 index 0000000..cb5982f --- /dev/null +++ b/node_modules/@npmcli/fs/lib/common/get-options.js @@ -0,0 +1,20 @@ +// given an input that may or may not be an object, return an object that has +// a copy of every defined property listed in 'copy'. if the input is not an +// object, assign it to the property named by 'wrap' +const getOptions = (input, { copy, wrap }) => { + const result = {} + + if (input && typeof input === 'object') { + for (const prop of copy) { + if (input[prop] !== undefined) { + result[prop] = input[prop] + } + } + } else { + result[wrap] = input + } + + return result +} + +module.exports = getOptions diff --git a/node_modules/@npmcli/fs/lib/common/node.js b/node_modules/@npmcli/fs/lib/common/node.js new file mode 100644 index 0000000..4d13bc0 --- /dev/null +++ b/node_modules/@npmcli/fs/lib/common/node.js @@ -0,0 +1,9 @@ +const semver = require('semver') + +const satisfies = (range) => { + return semver.satisfies(process.version, range, { includePrerelease: true }) +} + +module.exports = { + satisfies, +} diff --git a/node_modules/@npmcli/fs/lib/cp/LICENSE b/node_modules/@npmcli/fs/lib/cp/LICENSE new file mode 100644 index 0000000..93546df --- /dev/null +++ b/node_modules/@npmcli/fs/lib/cp/LICENSE @@ -0,0 +1,15 @@ +(The MIT License) + +Copyright (c) 2011-2017 JP Richardson + +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: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +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. diff --git a/node_modules/@npmcli/fs/lib/cp/errors.js b/node_modules/@npmcli/fs/lib/cp/errors.js new file mode 100644 index 0000000..1cd1e05 --- /dev/null +++ b/node_modules/@npmcli/fs/lib/cp/errors.js @@ -0,0 +1,129 @@ +'use strict' +const { inspect } = require('util') + +// adapted from node's internal/errors +// https://github.com/nodejs/node/blob/c8a04049/lib/internal/errors.js + +// close copy of node's internal SystemError class. +class SystemError { + constructor (code, prefix, context) { + // XXX context.code is undefined in all constructors used in cp/polyfill + // that may be a bug copied from node, maybe the constructor should use + // `code` not `errno`? nodejs/node#41104 + let message = `${prefix}: ${context.syscall} returned ` + + `${context.code} (${context.message})` + + if (context.path !== undefined) { + message += ` ${context.path}` + } + if (context.dest !== undefined) { + message += ` => ${context.dest}` + } + + this.code = code + Object.defineProperties(this, { + name: { + value: 'SystemError', + enumerable: false, + writable: true, + configurable: true, + }, + message: { + value: message, + enumerable: false, + writable: true, + configurable: true, + }, + info: { + value: context, + enumerable: true, + configurable: true, + writable: false, + }, + errno: { + get () { + return context.errno + }, + set (value) { + context.errno = value + }, + enumerable: true, + configurable: true, + }, + syscall: { + get () { + return context.syscall + }, + set (value) { + context.syscall = value + }, + enumerable: true, + configurable: true, + }, + }) + + if (context.path !== undefined) { + Object.defineProperty(this, 'path', { + get () { + return context.path + }, + set (value) { + context.path = value + }, + enumerable: true, + configurable: true, + }) + } + + if (context.dest !== undefined) { + Object.defineProperty(this, 'dest', { + get () { + return context.dest + }, + set (value) { + context.dest = value + }, + enumerable: true, + configurable: true, + }) + } + } + + toString () { + return `${this.name} [${this.code}]: ${this.message}` + } + + [Symbol.for('nodejs.util.inspect.custom')] (_recurseTimes, ctx) { + return inspect(this, { + ...ctx, + getters: true, + customInspect: false, + }) + } +} + +function E (code, message) { + module.exports[code] = class NodeError extends SystemError { + constructor (ctx) { + super(code, message, ctx) + } + } +} + +E('ERR_FS_CP_DIR_TO_NON_DIR', 'Cannot overwrite directory with non-directory') +E('ERR_FS_CP_EEXIST', 'Target already exists') +E('ERR_FS_CP_EINVAL', 'Invalid src or dest') +E('ERR_FS_CP_FIFO_PIPE', 'Cannot copy a FIFO pipe') +E('ERR_FS_CP_NON_DIR_TO_DIR', 'Cannot overwrite non-directory with directory') +E('ERR_FS_CP_SOCKET', 'Cannot copy a socket file') +E('ERR_FS_CP_SYMLINK_TO_SUBDIRECTORY', 'Cannot overwrite symlink in subdirectory of self') +E('ERR_FS_CP_UNKNOWN', 'Cannot copy an unknown file type') +E('ERR_FS_EISDIR', 'Path is a directory') + +module.exports.ERR_INVALID_ARG_TYPE = class ERR_INVALID_ARG_TYPE extends Error { + constructor (name, expected, actual) { + super() + this.code = 'ERR_INVALID_ARG_TYPE' + this.message = `The ${name} argument must be ${expected}. Received ${typeof actual}` + } +} diff --git a/node_modules/@npmcli/fs/lib/cp/index.js b/node_modules/@npmcli/fs/lib/cp/index.js new file mode 100644 index 0000000..972ce7a --- /dev/null +++ b/node_modules/@npmcli/fs/lib/cp/index.js @@ -0,0 +1,22 @@ +const fs = require('fs/promises') +const getOptions = require('../common/get-options.js') +const node = require('../common/node.js') +const polyfill = require('./polyfill.js') + +// node 16.7.0 added fs.cp +const useNative = node.satisfies('>=16.7.0') + +const cp = async (src, dest, opts) => { + const options = getOptions(opts, { + copy: ['dereference', 'errorOnExist', 'filter', 'force', 'preserveTimestamps', 'recursive'], + }) + + // the polyfill is tested separately from this module, no need to hack + // process.version to try to trigger it just for coverage + // istanbul ignore next + return useNative + ? fs.cp(src, dest, options) + : polyfill(src, dest, options) +} + +module.exports = cp diff --git a/node_modules/@npmcli/fs/lib/cp/polyfill.js b/node_modules/@npmcli/fs/lib/cp/polyfill.js new file mode 100644 index 0000000..80eb10d --- /dev/null +++ b/node_modules/@npmcli/fs/lib/cp/polyfill.js @@ -0,0 +1,428 @@ +// this file is a modified version of the code in node 17.2.0 +// which is, in turn, a modified version of the fs-extra module on npm +// node core changes: +// - Use of the assert module has been replaced with core's error system. +// - All code related to the glob dependency has been removed. +// - Bring your own custom fs module is not currently supported. +// - Some basic code cleanup. +// changes here: +// - remove all callback related code +// - drop sync support +// - change assertions back to non-internal methods (see options.js) +// - throws ENOTDIR when rmdir gets an ENOENT for a path that exists in Windows +'use strict' + +const { + ERR_FS_CP_DIR_TO_NON_DIR, + ERR_FS_CP_EEXIST, + ERR_FS_CP_EINVAL, + ERR_FS_CP_FIFO_PIPE, + ERR_FS_CP_NON_DIR_TO_DIR, + ERR_FS_CP_SOCKET, + ERR_FS_CP_SYMLINK_TO_SUBDIRECTORY, + ERR_FS_CP_UNKNOWN, + ERR_FS_EISDIR, + ERR_INVALID_ARG_TYPE, +} = require('./errors.js') +const { + constants: { + errno: { + EEXIST, + EISDIR, + EINVAL, + ENOTDIR, + }, + }, +} = require('os') +const { + chmod, + copyFile, + lstat, + mkdir, + readdir, + readlink, + stat, + symlink, + unlink, + utimes, +} = require('fs/promises') +const { + dirname, + isAbsolute, + join, + parse, + resolve, + sep, + toNamespacedPath, +} = require('path') +const { fileURLToPath } = require('url') + +const defaultOptions = { + dereference: false, + errorOnExist: false, + filter: undefined, + force: true, + preserveTimestamps: false, + recursive: false, +} + +async function cp (src, dest, opts) { + if (opts != null && typeof opts !== 'object') { + throw new ERR_INVALID_ARG_TYPE('options', ['Object'], opts) + } + return cpFn( + toNamespacedPath(getValidatedPath(src)), + toNamespacedPath(getValidatedPath(dest)), + { ...defaultOptions, ...opts }) +} + +function getValidatedPath (fileURLOrPath) { + const path = fileURLOrPath != null && fileURLOrPath.href + && fileURLOrPath.origin + ? fileURLToPath(fileURLOrPath) + : fileURLOrPath + return path +} + +async function cpFn (src, dest, opts) { + // Warn about using preserveTimestamps on 32-bit node + // istanbul ignore next + if (opts.preserveTimestamps && process.arch === 'ia32') { + const warning = 'Using the preserveTimestamps option in 32-bit ' + + 'node is not recommended' + process.emitWarning(warning, 'TimestampPrecisionWarning') + } + const stats = await checkPaths(src, dest, opts) + const { srcStat, destStat } = stats + await checkParentPaths(src, srcStat, dest) + if (opts.filter) { + return handleFilter(checkParentDir, destStat, src, dest, opts) + } + return checkParentDir(destStat, src, dest, opts) +} + +async function checkPaths (src, dest, opts) { + const { 0: srcStat, 1: destStat } = await getStats(src, dest, opts) + if (destStat) { + if (areIdentical(srcStat, destStat)) { + throw new ERR_FS_CP_EINVAL({ + message: 'src and dest cannot be the same', + path: dest, + syscall: 'cp', + errno: EINVAL, + }) + } + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new ERR_FS_CP_DIR_TO_NON_DIR({ + message: `cannot overwrite directory ${src} ` + + `with non-directory ${dest}`, + path: dest, + syscall: 'cp', + errno: EISDIR, + }) + } + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new ERR_FS_CP_NON_DIR_TO_DIR({ + message: `cannot overwrite non-directory ${src} ` + + `with directory ${dest}`, + path: dest, + syscall: 'cp', + errno: ENOTDIR, + }) + } + } + + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new ERR_FS_CP_EINVAL({ + message: `cannot copy ${src} to a subdirectory of self ${dest}`, + path: dest, + syscall: 'cp', + errno: EINVAL, + }) + } + return { srcStat, destStat } +} + +function areIdentical (srcStat, destStat) { + return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && + destStat.dev === srcStat.dev +} + +function getStats (src, dest, opts) { + const statFunc = opts.dereference ? + (file) => stat(file, { bigint: true }) : + (file) => lstat(file, { bigint: true }) + return Promise.all([ + statFunc(src), + statFunc(dest).catch((err) => { + // istanbul ignore next: unsure how to cover. + if (err.code === 'ENOENT') { + return null + } + // istanbul ignore next: unsure how to cover. + throw err + }), + ]) +} + +async function checkParentDir (destStat, src, dest, opts) { + const destParent = dirname(dest) + const dirExists = await pathExists(destParent) + if (dirExists) { + return getStatsForCopy(destStat, src, dest, opts) + } + await mkdir(destParent, { recursive: true }) + return getStatsForCopy(destStat, src, dest, opts) +} + +function pathExists (dest) { + return stat(dest).then( + () => true, + // istanbul ignore next: not sure when this would occur + (err) => (err.code === 'ENOENT' ? false : Promise.reject(err))) +} + +// Recursively check if dest parent is a subdirectory of src. +// It works for all file types including symlinks since it +// checks the src and dest inodes. It starts from the deepest +// parent and stops once it reaches the src parent or the root path. +async function checkParentPaths (src, srcStat, dest) { + const srcParent = resolve(dirname(src)) + const destParent = resolve(dirname(dest)) + if (destParent === srcParent || destParent === parse(destParent).root) { + return + } + let destStat + try { + destStat = await stat(destParent, { bigint: true }) + } catch (err) { + // istanbul ignore else: not sure when this would occur + if (err.code === 'ENOENT') { + return + } + // istanbul ignore next: not sure when this would occur + throw err + } + if (areIdentical(srcStat, destStat)) { + throw new ERR_FS_CP_EINVAL({ + message: `cannot copy ${src} to a subdirectory of self ${dest}`, + path: dest, + syscall: 'cp', + errno: EINVAL, + }) + } + return checkParentPaths(src, srcStat, destParent) +} + +const normalizePathToArray = (path) => + resolve(path).split(sep).filter(Boolean) + +// Return true if dest is a subdir of src, otherwise false. +// It only checks the path strings. +function isSrcSubdir (src, dest) { + const srcArr = normalizePathToArray(src) + const destArr = normalizePathToArray(dest) + return srcArr.every((cur, i) => destArr[i] === cur) +} + +async function handleFilter (onInclude, destStat, src, dest, opts, cb) { + const include = await opts.filter(src, dest) + if (include) { + return onInclude(destStat, src, dest, opts, cb) + } +} + +function startCopy (destStat, src, dest, opts) { + if (opts.filter) { + return handleFilter(getStatsForCopy, destStat, src, dest, opts) + } + return getStatsForCopy(destStat, src, dest, opts) +} + +async function getStatsForCopy (destStat, src, dest, opts) { + const statFn = opts.dereference ? stat : lstat + const srcStat = await statFn(src) + // istanbul ignore else: can't portably test FIFO + if (srcStat.isDirectory() && opts.recursive) { + return onDir(srcStat, destStat, src, dest, opts) + } else if (srcStat.isDirectory()) { + throw new ERR_FS_EISDIR({ + message: `${src} is a directory (not copied)`, + path: src, + syscall: 'cp', + errno: EINVAL, + }) + } else if (srcStat.isFile() || + srcStat.isCharacterDevice() || + srcStat.isBlockDevice()) { + return onFile(srcStat, destStat, src, dest, opts) + } else if (srcStat.isSymbolicLink()) { + return onLink(destStat, src, dest) + } else if (srcStat.isSocket()) { + throw new ERR_FS_CP_SOCKET({ + message: `cannot copy a socket file: ${dest}`, + path: dest, + syscall: 'cp', + errno: EINVAL, + }) + } else if (srcStat.isFIFO()) { + throw new ERR_FS_CP_FIFO_PIPE({ + message: `cannot copy a FIFO pipe: ${dest}`, + path: dest, + syscall: 'cp', + errno: EINVAL, + }) + } + // istanbul ignore next: should be unreachable + throw new ERR_FS_CP_UNKNOWN({ + message: `cannot copy an unknown file type: ${dest}`, + path: dest, + syscall: 'cp', + errno: EINVAL, + }) +} + +function onFile (srcStat, destStat, src, dest, opts) { + if (!destStat) { + return _copyFile(srcStat, src, dest, opts) + } + return mayCopyFile(srcStat, src, dest, opts) +} + +async function mayCopyFile (srcStat, src, dest, opts) { + if (opts.force) { + await unlink(dest) + return _copyFile(srcStat, src, dest, opts) + } else if (opts.errorOnExist) { + throw new ERR_FS_CP_EEXIST({ + message: `${dest} already exists`, + path: dest, + syscall: 'cp', + errno: EEXIST, + }) + } +} + +async function _copyFile (srcStat, src, dest, opts) { + await copyFile(src, dest) + if (opts.preserveTimestamps) { + return handleTimestampsAndMode(srcStat.mode, src, dest) + } + return setDestMode(dest, srcStat.mode) +} + +async function handleTimestampsAndMode (srcMode, src, dest) { + // Make sure the file is writable before setting the timestamp + // otherwise open fails with EPERM when invoked with 'r+' + // (through utimes call) + if (fileIsNotWritable(srcMode)) { + await makeFileWritable(dest, srcMode) + return setDestTimestampsAndMode(srcMode, src, dest) + } + return setDestTimestampsAndMode(srcMode, src, dest) +} + +function fileIsNotWritable (srcMode) { + return (srcMode & 0o200) === 0 +} + +function makeFileWritable (dest, srcMode) { + return setDestMode(dest, srcMode | 0o200) +} + +async function setDestTimestampsAndMode (srcMode, src, dest) { + await setDestTimestamps(src, dest) + return setDestMode(dest, srcMode) +} + +function setDestMode (dest, srcMode) { + return chmod(dest, srcMode) +} + +async function setDestTimestamps (src, dest) { + // The initial srcStat.atime cannot be trusted + // because it is modified by the read(2) system call + // (See https://nodejs.org/api/fs.html#fs_stat_time_values) + const updatedSrcStat = await stat(src) + return utimes(dest, updatedSrcStat.atime, updatedSrcStat.mtime) +} + +function onDir (srcStat, destStat, src, dest, opts) { + if (!destStat) { + return mkDirAndCopy(srcStat.mode, src, dest, opts) + } + return copyDir(src, dest, opts) +} + +async function mkDirAndCopy (srcMode, src, dest, opts) { + await mkdir(dest) + await copyDir(src, dest, opts) + return setDestMode(dest, srcMode) +} + +async function copyDir (src, dest, opts) { + const dir = await readdir(src) + for (let i = 0; i < dir.length; i++) { + const item = dir[i] + const srcItem = join(src, item) + const destItem = join(dest, item) + const { destStat } = await checkPaths(srcItem, destItem, opts) + await startCopy(destStat, srcItem, destItem, opts) + } +} + +async function onLink (destStat, src, dest) { + let resolvedSrc = await readlink(src) + if (!isAbsolute(resolvedSrc)) { + resolvedSrc = resolve(dirname(src), resolvedSrc) + } + if (!destStat) { + return symlink(resolvedSrc, dest) + } + let resolvedDest + try { + resolvedDest = await readlink(dest) + } catch (err) { + // Dest exists and is a regular file or directory, + // Windows may throw UNKNOWN error. If dest already exists, + // fs throws error anyway, so no need to guard against it here. + // istanbul ignore next: can only test on windows + if (err.code === 'EINVAL' || err.code === 'UNKNOWN') { + return symlink(resolvedSrc, dest) + } + // istanbul ignore next: should not be possible + throw err + } + if (!isAbsolute(resolvedDest)) { + resolvedDest = resolve(dirname(dest), resolvedDest) + } + if (isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new ERR_FS_CP_EINVAL({ + message: `cannot copy ${resolvedSrc} to a subdirectory of self ` + + `${resolvedDest}`, + path: dest, + syscall: 'cp', + errno: EINVAL, + }) + } + // Do not copy if src is a subdir of dest since unlinking + // dest in this case would result in removing src contents + // and therefore a broken symlink would be created. + const srcStat = await stat(src) + if (srcStat.isDirectory() && isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new ERR_FS_CP_SYMLINK_TO_SUBDIRECTORY({ + message: `cannot overwrite ${resolvedDest} with ${resolvedSrc}`, + path: dest, + syscall: 'cp', + errno: EINVAL, + }) + } + return copyLink(resolvedSrc, dest) +} + +async function copyLink (resolvedSrc, dest) { + await unlink(dest) + return symlink(resolvedSrc, dest) +} + +module.exports = cp diff --git a/node_modules/@npmcli/fs/lib/index.js b/node_modules/@npmcli/fs/lib/index.js new file mode 100644 index 0000000..81c7463 --- /dev/null +++ b/node_modules/@npmcli/fs/lib/index.js @@ -0,0 +1,13 @@ +'use strict' + +const cp = require('./cp/index.js') +const withTempDir = require('./with-temp-dir.js') +const readdirScoped = require('./readdir-scoped.js') +const moveFile = require('./move-file.js') + +module.exports = { + cp, + withTempDir, + readdirScoped, + moveFile, +} diff --git a/node_modules/@npmcli/fs/lib/move-file.js b/node_modules/@npmcli/fs/lib/move-file.js new file mode 100644 index 0000000..d56e06d --- /dev/null +++ b/node_modules/@npmcli/fs/lib/move-file.js @@ -0,0 +1,78 @@ +const { dirname, join, resolve, relative, isAbsolute } = require('path') +const fs = require('fs/promises') + +const pathExists = async path => { + try { + await fs.access(path) + return true + } catch (er) { + return er.code !== 'ENOENT' + } +} + +const moveFile = async (source, destination, options = {}, root = true, symlinks = []) => { + if (!source || !destination) { + throw new TypeError('`source` and `destination` file required') + } + + options = { + overwrite: true, + ...options, + } + + if (!options.overwrite && await pathExists(destination)) { + throw new Error(`The destination file exists: ${destination}`) + } + + await fs.mkdir(dirname(destination), { recursive: true }) + + try { + await fs.rename(source, destination) + } catch (error) { + if (error.code === 'EXDEV' || error.code === 'EPERM') { + const sourceStat = await fs.lstat(source) + if (sourceStat.isDirectory()) { + const files = await fs.readdir(source) + await Promise.all(files.map((file) => + moveFile(join(source, file), join(destination, file), options, false, symlinks) + )) + } else if (sourceStat.isSymbolicLink()) { + symlinks.push({ source, destination }) + } else { + await fs.copyFile(source, destination) + } + } else { + throw error + } + } + + if (root) { + await Promise.all(symlinks.map(async ({ source: symSource, destination: symDestination }) => { + let target = await fs.readlink(symSource) + // junction symlinks in windows will be absolute paths, so we need to + // make sure they point to the symlink destination + if (isAbsolute(target)) { + target = resolve(symDestination, relative(symSource, target)) + } + // try to determine what the actual file is so we can create the correct + // type of symlink in windows + let targetStat = 'file' + try { + targetStat = await fs.stat(resolve(dirname(symSource), target)) + if (targetStat.isDirectory()) { + targetStat = 'junction' + } + } catch { + // targetStat remains 'file' + } + await fs.symlink( + target, + symDestination, + targetStat + ) + })) + await fs.rm(source, { recursive: true, force: true }) + } +} + +module.exports = moveFile diff --git a/node_modules/@npmcli/fs/lib/readdir-scoped.js b/node_modules/@npmcli/fs/lib/readdir-scoped.js new file mode 100644 index 0000000..cd601df --- /dev/null +++ b/node_modules/@npmcli/fs/lib/readdir-scoped.js @@ -0,0 +1,20 @@ +const { readdir } = require('fs/promises') +const { join } = require('path') + +const readdirScoped = async (dir) => { + const results = [] + + for (const item of await readdir(dir)) { + if (item.startsWith('@')) { + for (const scopedItem of await readdir(join(dir, item))) { + results.push(join(item, scopedItem)) + } + } else { + results.push(item) + } + } + + return results +} + +module.exports = readdirScoped diff --git a/node_modules/@npmcli/fs/lib/with-temp-dir.js b/node_modules/@npmcli/fs/lib/with-temp-dir.js new file mode 100644 index 0000000..0738ac4 --- /dev/null +++ b/node_modules/@npmcli/fs/lib/with-temp-dir.js @@ -0,0 +1,39 @@ +const { join, sep } = require('path') + +const getOptions = require('./common/get-options.js') +const { mkdir, mkdtemp, rm } = require('fs/promises') + +// create a temp directory, ensure its permissions match its parent, then call +// the supplied function passing it the path to the directory. clean up after +// the function finishes, whether it throws or not +const withTempDir = async (root, fn, opts) => { + const options = getOptions(opts, { + copy: ['tmpPrefix'], + }) + // create the directory + await mkdir(root, { recursive: true }) + + const target = await mkdtemp(join(`${root}${sep}`, options.tmpPrefix || '')) + let err + let result + + try { + result = await fn(target) + } catch (_err) { + err = _err + } + + try { + await rm(target, { force: true, recursive: true }) + } catch { + // ignore errors + } + + if (err) { + throw err + } + + return result +} + +module.exports = withTempDir diff --git a/node_modules/@npmcli/fs/package.json b/node_modules/@npmcli/fs/package.json new file mode 100644 index 0000000..e4063ec --- /dev/null +++ b/node_modules/@npmcli/fs/package.json @@ -0,0 +1,54 @@ +{ + "name": "@npmcli/fs", + "version": "4.0.0", + "description": "filesystem utilities for the npm cli", + "main": "lib/index.js", + "files": [ + "bin/", + "lib/" + ], + "scripts": { + "snap": "tap", + "test": "tap", + "npmclilint": "npmcli-lint", + "lint": "npm run eslint", + "lintfix": "npm run eslint -- --fix", + "posttest": "npm run lint", + "postsnap": "npm run lintfix --", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/fs.git" + }, + "keywords": [ + "npm", + "oss" + ], + "author": "GitHub Inc.", + "license": "ISC", + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.3", + "tap": "^16.0.1" + }, + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.3", + "publish": true + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/@npmcli/redact/LICENSE b/node_modules/@npmcli/redact/LICENSE new file mode 100644 index 0000000..c216441 --- /dev/null +++ b/node_modules/@npmcli/redact/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 npm + +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: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +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. diff --git a/node_modules/@npmcli/redact/README.md b/node_modules/@npmcli/redact/README.md new file mode 100644 index 0000000..31d896e --- /dev/null +++ b/node_modules/@npmcli/redact/README.md @@ -0,0 +1,42 @@ +# @npmcli/redact + +Redact sensitive npm information from output. + +## API + +This will redact `npm_` prefixed tokens and UUIDs from values. + +It will also replace passwords in stringified URLs. + +### `redact(string)` + +Redact values from a single value + +```js +const { redact } = require('@npmcli/redact') + +redact('https://user:pass@registry.npmjs.org/') +// https://user:***@registry.npmjs.org/ + +redact(`https://registry.npmjs.org/path/npm_${'a'.repeat('36')}`) +// https://registry.npmjs.org/path/npm_*** +``` + +### `redactLog(string | string[])` + +Redact values from a string or array of strings. + +This method will also split all strings on `\s` and `=` and iterate over them. + +```js +const { redactLog } = require('@npmcli/redact') + +redactLog([ + 'Something --x=https://user:pass@registry.npmjs.org/ foo bar', + '--url=http://foo:bar@registry.npmjs.org', +]) +// [ +// 'Something --x=https://user:***@registry.npmjs.org/ foo bar', +// '--url=http://foo:***@registry.npmjs.org/', +// ] +``` diff --git a/node_modules/@npmcli/redact/lib/deep-map.js b/node_modules/@npmcli/redact/lib/deep-map.js new file mode 100644 index 0000000..c14857c --- /dev/null +++ b/node_modules/@npmcli/redact/lib/deep-map.js @@ -0,0 +1,71 @@ +const { serializeError } = require('./error') + +const deepMap = (input, handler = v => v, path = ['$'], seen = new Set([input])) => { + // this is in an effort to maintain bole's error logging behavior + if (path.join('.') === '$' && input instanceof Error) { + return deepMap({ err: serializeError(input) }, handler, path, seen) + } + if (input instanceof Error) { + return deepMap(serializeError(input), handler, path, seen) + } + // allows for non-node js environments, sush as workers + if (typeof Buffer !== 'undefined' && input instanceof Buffer) { + return `[unable to log instanceof buffer]` + } + if (input instanceof Uint8Array) { + return `[unable to log instanceof Uint8Array]` + } + + if (Array.isArray(input)) { + const result = [] + for (let i = 0; i < input.length; i++) { + const element = input[i] + const elementPath = [...path, i] + if (element instanceof Object) { + if (!seen.has(element)) { // avoid getting stuck in circular reference + seen.add(element) + result.push(deepMap(handler(element, elementPath), handler, elementPath, seen)) + } + } else { + result.push(handler(element, elementPath)) + } + } + return result + } + + if (input === null) { + return null + } else if (typeof input === 'object' || typeof input === 'function') { + const result = {} + + for (const propertyName of Object.getOwnPropertyNames(input)) { + // skip logging internal properties + if (propertyName.startsWith('_')) { + continue + } + + try { + const property = input[propertyName] + const propertyPath = [...path, propertyName] + if (property instanceof Object) { + if (!seen.has(property)) { // avoid getting stuck in circular reference + seen.add(property) + result[propertyName] = deepMap( + handler(property, propertyPath), handler, propertyPath, seen + ) + } + } else { + result[propertyName] = handler(property, propertyPath) + } + } catch (err) { + // a getter may throw an error + result[propertyName] = `[error getting value: ${err.message}]` + } + } + return result + } + + return handler(input, path) +} + +module.exports = { deepMap } diff --git a/node_modules/@npmcli/redact/lib/error.js b/node_modules/@npmcli/redact/lib/error.js new file mode 100644 index 0000000..e374b39 --- /dev/null +++ b/node_modules/@npmcli/redact/lib/error.js @@ -0,0 +1,28 @@ +/** takes an error object and serializes it to a plan object */ +function serializeError (input) { + if (!(input instanceof Error)) { + if (typeof input === 'string') { + const error = new Error(`attempted to serialize a non-error, string String, "${input}"`) + return serializeError(error) + } + const error = new Error(`attempted to serialize a non-error, ${typeof input} ${input?.constructor?.name}`) + return serializeError(error) + } + // different error objects store status code differently + // AxiosError uses `status`, other services use `statusCode` + const statusCode = input.statusCode ?? input.status + // CAUTION: what we serialize here gets add to the size of logs + return { + errorType: input.errorType ?? input.constructor.name, + ...(input.message ? { message: input.message } : {}), + ...(input.stack ? { stack: input.stack } : {}), + // think of this as error code + ...(input.code ? { code: input.code } : {}), + // think of this as http status code + ...(statusCode ? { statusCode } : {}), + } +} + +module.exports = { + serializeError, +} diff --git a/node_modules/@npmcli/redact/lib/index.js b/node_modules/@npmcli/redact/lib/index.js new file mode 100644 index 0000000..9b10c7f --- /dev/null +++ b/node_modules/@npmcli/redact/lib/index.js @@ -0,0 +1,44 @@ +const matchers = require('./matchers') +const { redactUrlPassword } = require('./utils') + +const REPLACE = '***' + +const redact = (value) => { + if (typeof value !== 'string' || !value) { + return value + } + return redactUrlPassword(value, REPLACE) + .replace(matchers.NPM_SECRET.pattern, `npm_${REPLACE}`) + .replace(matchers.UUID.pattern, REPLACE) +} + +// split on \s|= similar to how nopt parses options +const splitAndRedact = (str) => { + // stateful regex, don't move out of this scope + const splitChars = /[\s=]/g + + let match = null + let result = '' + let index = 0 + while (match = splitChars.exec(str)) { + result += redact(str.slice(index, match.index)) + match[0] + index = splitChars.lastIndex + } + + return result + redact(str.slice(index)) +} + +// replaces auth info in an array of arguments or in a strings +const redactLog = (arg) => { + if (typeof arg === 'string') { + return splitAndRedact(arg) + } else if (Array.isArray(arg)) { + return arg.map((a) => typeof a === 'string' ? splitAndRedact(a) : a) + } + return arg +} + +module.exports = { + redact, + redactLog, +} diff --git a/node_modules/@npmcli/redact/lib/matchers.js b/node_modules/@npmcli/redact/lib/matchers.js new file mode 100644 index 0000000..854ba8e --- /dev/null +++ b/node_modules/@npmcli/redact/lib/matchers.js @@ -0,0 +1,88 @@ +const TYPE_REGEX = 'regex' +const TYPE_URL = 'url' +const TYPE_PATH = 'path' + +const NPM_SECRET = { + type: TYPE_REGEX, + pattern: /\b(npms?_)[a-zA-Z0-9]{36,48}\b/gi, + replacement: `[REDACTED_NPM_SECRET]`, +} + +const AUTH_HEADER = { + type: TYPE_REGEX, + pattern: /\b(Basic\s+|Bearer\s+)[\w+=\-.]+\b/gi, + replacement: `[REDACTED_AUTH_HEADER]`, +} + +const JSON_WEB_TOKEN = { + type: TYPE_REGEX, + pattern: /\b[A-Za-z0-9-_]{10,}(?!\.\d+\.)\.[A-Za-z0-9-_]{3,}\.[A-Za-z0-9-_]{20,}\b/gi, + replacement: `[REDACTED_JSON_WEB_TOKEN]`, +} + +const UUID = { + type: TYPE_REGEX, + pattern: /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi, + replacement: `[REDACTED_UUID]`, +} + +const URL_MATCHER = { + type: TYPE_REGEX, + pattern: /(?:https?|ftp):\/\/[^\s/"$.?#].[^\s"]*/gi, + replacement: '[REDACTED_URL]', +} + +const DEEP_HEADER_AUTHORIZATION = { + type: TYPE_PATH, + predicate: ({ path }) => path.endsWith('.headers.authorization'), + replacement: '[REDACTED_HEADER_AUTHORIZATION]', +} + +const DEEP_HEADER_SET_COOKIE = { + type: TYPE_PATH, + predicate: ({ path }) => path.endsWith('.headers.set-cookie'), + replacement: '[REDACTED_HEADER_SET_COOKIE]', +} + +const DEEP_HEADER_COOKIE = { + type: TYPE_PATH, + predicate: ({ path }) => path.endsWith('.headers.cookie'), + replacement: '[REDACTED_HEADER_COOKIE]', +} + +const REWRITE_REQUEST = { + type: TYPE_PATH, + predicate: ({ path }) => path.endsWith('.request'), + replacement: (input) => ({ + method: input?.method, + path: input?.path, + headers: input?.headers, + url: input?.url, + }), +} + +const REWRITE_RESPONSE = { + type: TYPE_PATH, + predicate: ({ path }) => path.endsWith('.response'), + replacement: (input) => ({ + data: input?.data, + status: input?.status, + headers: input?.headers, + }), +} + +module.exports = { + TYPE_REGEX, + TYPE_URL, + TYPE_PATH, + NPM_SECRET, + AUTH_HEADER, + JSON_WEB_TOKEN, + UUID, + URL_MATCHER, + DEEP_HEADER_AUTHORIZATION, + DEEP_HEADER_SET_COOKIE, + DEEP_HEADER_COOKIE, + REWRITE_REQUEST, + REWRITE_RESPONSE, +} diff --git a/node_modules/@npmcli/redact/lib/server.js b/node_modules/@npmcli/redact/lib/server.js new file mode 100644 index 0000000..555e37d --- /dev/null +++ b/node_modules/@npmcli/redact/lib/server.js @@ -0,0 +1,59 @@ +const { + AUTH_HEADER, + JSON_WEB_TOKEN, + NPM_SECRET, + DEEP_HEADER_AUTHORIZATION, + DEEP_HEADER_SET_COOKIE, + REWRITE_REQUEST, + REWRITE_RESPONSE, + DEEP_HEADER_COOKIE, +} = require('./matchers') + +const { + redactUrlMatcher, + redactUrlPasswordMatcher, + redactMatchers, +} = require('./utils') + +const { serializeError } = require('./error') + +const { deepMap } = require('./deep-map') + +const _redact = redactMatchers( + NPM_SECRET, + AUTH_HEADER, + JSON_WEB_TOKEN, + DEEP_HEADER_AUTHORIZATION, + DEEP_HEADER_SET_COOKIE, + DEEP_HEADER_COOKIE, + REWRITE_REQUEST, + REWRITE_RESPONSE, + redactUrlMatcher( + redactUrlPasswordMatcher() + ) +) + +const redact = (input) => deepMap(input, (value, path) => _redact(value, { path })) + +/** takes an error returns new error keeping some custom properties */ +function redactError (input) { + const { message, ...data } = serializeError(input) + const output = new Error(redact(message)) + return Object.assign(output, redact(data)) +} + +/** runs a function within try / catch and throws error wrapped in redactError */ +function redactThrow (func) { + if (typeof func !== 'function') { + throw new Error('redactThrow expects a function') + } + return async (...args) => { + try { + return await func(...args) + } catch (error) { + throw redactError(error) + } + } +} + +module.exports = { redact, redactError, redactThrow } diff --git a/node_modules/@npmcli/redact/lib/utils.js b/node_modules/@npmcli/redact/lib/utils.js new file mode 100644 index 0000000..8395ab2 --- /dev/null +++ b/node_modules/@npmcli/redact/lib/utils.js @@ -0,0 +1,202 @@ +const { + URL_MATCHER, + TYPE_URL, + TYPE_REGEX, + TYPE_PATH, +} = require('./matchers') + +/** + * creates a string of asterisks, + * this forces a minimum asterisk for security purposes + */ +const asterisk = (length = 0) => { + length = typeof length === 'string' ? length.length : length + if (length < 8) { + return '*'.repeat(8) + } + return '*'.repeat(length) +} + +/** + * escapes all special regex chars + * @see https://stackoverflow.com/a/9310752 + * @see https://github.com/tc39/proposal-regex-escaping + */ +const escapeRegExp = (text) => { + return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, `\\$&`) +} + +/** + * provieds a regex "or" of the url versions of a string + */ +const urlEncodeRegexGroup = (value) => { + const decoded = decodeURIComponent(value) + const encoded = encodeURIComponent(value) + const union = [...new Set([encoded, decoded, value])].map(escapeRegExp).join('|') + return union +} + +/** + * a tagged template literal that returns a regex ensures all variables are excaped + */ +const urlEncodeRegexTag = (strings, ...values) => { + let pattern = '' + for (let i = 0; i < values.length; i++) { + pattern += strings[i] + `(${urlEncodeRegexGroup(values[i])})` + } + pattern += strings[strings.length - 1] + return new RegExp(pattern) +} + +/** + * creates a matcher for redacting url hostname + */ +const redactUrlHostnameMatcher = ({ hostname, replacement } = {}) => ({ + type: TYPE_URL, + predicate: ({ url }) => url.hostname === hostname, + pattern: ({ url }) => { + return urlEncodeRegexTag`(^${url.protocol}//${url.username}:.+@)?${url.hostname}` + }, + replacement: `$1${replacement || asterisk()}`, +}) + +/** + * creates a matcher for redacting url search / query parameter values + */ +const redactUrlSearchParamsMatcher = ({ param, replacement } = {}) => ({ + type: TYPE_URL, + predicate: ({ url }) => url.searchParams.has(param), + pattern: ({ url }) => urlEncodeRegexTag`(${param}=)${url.searchParams.get(param)}`, + replacement: `$1${replacement || asterisk()}`, +}) + +/** creates a matcher for redacting the url password */ +const redactUrlPasswordMatcher = ({ replacement } = {}) => ({ + type: TYPE_URL, + predicate: ({ url }) => url.password, + pattern: ({ url }) => urlEncodeRegexTag`(^${url.protocol}//${url.username}:)${url.password}`, + replacement: `$1${replacement || asterisk()}`, +}) + +const redactUrlReplacement = (...matchers) => (subValue) => { + try { + const url = new URL(subValue) + return redactMatchers(...matchers)(subValue, { url }) + } catch (err) { + return subValue + } +} + +/** + * creates a matcher / submatcher for urls, this function allows you to first + * collect all urls within a larger string and then pass those urls to a + * submatcher + * + * @example + * console.log("this will first match all urls, then pass those urls to the password patcher") + * redactMatchers(redactUrlMatcher(redactUrlPasswordMatcher())) + * + * @example + * console.log( + * "this will assume you are passing in a string that is a url, and will redact the password" + * ) + * redactMatchers(redactUrlPasswordMatcher()) + * + */ +const redactUrlMatcher = (...matchers) => { + return { + ...URL_MATCHER, + replacement: redactUrlReplacement(...matchers), + } +} + +const matcherFunctions = { + [TYPE_REGEX]: (matcher) => (value) => { + if (typeof value === 'string') { + value = value.replace(matcher.pattern, matcher.replacement) + } + return value + }, + [TYPE_URL]: (matcher) => (value, ctx) => { + if (typeof value === 'string') { + try { + const url = ctx?.url || new URL(value) + const { predicate, pattern } = matcher + const predicateValue = predicate({ url }) + if (predicateValue) { + value = value.replace(pattern({ url }), matcher.replacement) + } + } catch (_e) { + return value + } + } + return value + }, + [TYPE_PATH]: (matcher) => (value, ctx) => { + const rawPath = ctx?.path + const path = rawPath.join('.').toLowerCase() + const { predicate, replacement } = matcher + const replace = typeof replacement === 'function' ? replacement : () => replacement + const shouldRun = predicate({ rawPath, path }) + if (shouldRun) { + value = replace(value, { rawPath, path }) + } + return value + }, +} + +/** converts a matcher to a function */ +const redactMatcher = (matcher) => { + return matcherFunctions[matcher.type](matcher) +} + +/** converts a series of matchers to a function */ +const redactMatchers = (...matchers) => (value, ctx) => { + const flatMatchers = matchers.flat() + return flatMatchers.reduce((result, matcher) => { + const fn = (typeof matcher === 'function') ? matcher : redactMatcher(matcher) + return fn(result, ctx) + }, value) +} + +/** + * replacement handler, keeping $1 (if it exists) and replacing the + * rest of the string with asterisks, maintaining string length + */ +const redactDynamicReplacement = () => (value, start) => { + if (typeof start === 'number') { + return asterisk(value) + } + return start + asterisk(value.substring(start.length).length) +} + +/** + * replacement handler, keeping $1 (if it exists) and replacing the + * rest of the string with a fixed number of asterisks + */ +const redactFixedReplacement = (length) => (_value, start) => { + if (typeof start === 'number') { + return asterisk(length) + } + return start + asterisk(length) +} + +const redactUrlPassword = (value, replacement) => { + return redactMatchers(redactUrlPasswordMatcher({ replacement }))(value) +} + +module.exports = { + asterisk, + escapeRegExp, + urlEncodeRegexGroup, + urlEncodeRegexTag, + redactUrlHostnameMatcher, + redactUrlSearchParamsMatcher, + redactUrlPasswordMatcher, + redactUrlMatcher, + redactUrlReplacement, + redactDynamicReplacement, + redactFixedReplacement, + redactMatchers, + redactUrlPassword, +} diff --git a/node_modules/@npmcli/redact/package.json b/node_modules/@npmcli/redact/package.json new file mode 100644 index 0000000..b507011 --- /dev/null +++ b/node_modules/@npmcli/redact/package.json @@ -0,0 +1,52 @@ +{ + "name": "@npmcli/redact", + "version": "3.2.2", + "description": "Redact sensitive npm information from output", + "main": "lib/index.js", + "exports": { + ".": "./lib/index.js", + "./server": "./lib/server.js", + "./package.json": "./package.json" + }, + "scripts": { + "test": "tap", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run eslint -- --fix", + "snap": "tap", + "posttest": "npm run lint", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "keywords": [], + "author": "GitHub Inc.", + "license": "ISC", + "files": [ + "bin/", + "lib/" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/npm/redact.git" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.24.3", + "publish": true + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ], + "timeout": 120 + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.24.3", + "tap": "^16.3.10" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } +} diff --git a/node_modules/@pkgjs/parseargs/.editorconfig b/node_modules/@pkgjs/parseargs/.editorconfig new file mode 100644 index 0000000..b140163 --- /dev/null +++ b/node_modules/@pkgjs/parseargs/.editorconfig @@ -0,0 +1,14 @@ +# EditorConfig is awesome: http://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Copied from Node.js to ease compatibility in PR. +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true +quote_type = single diff --git a/node_modules/@pkgjs/parseargs/CHANGELOG.md b/node_modules/@pkgjs/parseargs/CHANGELOG.md new file mode 100644 index 0000000..2adc7d3 --- /dev/null +++ b/node_modules/@pkgjs/parseargs/CHANGELOG.md @@ -0,0 +1,147 @@ +# Changelog + +## [0.11.0](https://github.com/pkgjs/parseargs/compare/v0.10.0...v0.11.0) (2022-10-08) + + +### Features + +* add `default` option parameter ([#142](https://github.com/pkgjs/parseargs/issues/142)) ([cd20847](https://github.com/pkgjs/parseargs/commit/cd20847a00b2f556aa9c085ac83b942c60868ec1)) + +## [0.10.0](https://github.com/pkgjs/parseargs/compare/v0.9.1...v0.10.0) (2022-07-21) + + +### Features + +* add parsed meta-data to returned properties ([#129](https://github.com/pkgjs/parseargs/issues/129)) ([91bfb4d](https://github.com/pkgjs/parseargs/commit/91bfb4d3f7b6937efab1b27c91c45d1205f1497e)) + +## [0.9.1](https://github.com/pkgjs/parseargs/compare/v0.9.0...v0.9.1) (2022-06-20) + + +### Bug Fixes + +* **runtime:** support node 14+ ([#135](https://github.com/pkgjs/parseargs/issues/135)) ([6a1c5a6](https://github.com/pkgjs/parseargs/commit/6a1c5a6f7cadf2f035e004027e2742e3c4ce554b)) + +## [0.9.0](https://github.com/pkgjs/parseargs/compare/v0.8.0...v0.9.0) (2022-05-23) + + +### ⚠ BREAKING CHANGES + +* drop handling of electron arguments (#121) + +### Code Refactoring + +* drop handling of electron arguments ([#121](https://github.com/pkgjs/parseargs/issues/121)) ([a2ffd53](https://github.com/pkgjs/parseargs/commit/a2ffd537c244a062371522b955acb45a404fc9f2)) + +## [0.8.0](https://github.com/pkgjs/parseargs/compare/v0.7.1...v0.8.0) (2022-05-16) + + +### ⚠ BREAKING CHANGES + +* switch type:string option arguments to greedy, but with error for suspect cases in strict mode (#88) +* positionals now opt-in when strict:true (#116) +* create result.values with null prototype (#111) + +### Features + +* create result.values with null prototype ([#111](https://github.com/pkgjs/parseargs/issues/111)) ([9d539c3](https://github.com/pkgjs/parseargs/commit/9d539c3d57f269c160e74e0656ad4fa84ff92ec2)) +* positionals now opt-in when strict:true ([#116](https://github.com/pkgjs/parseargs/issues/116)) ([3643338](https://github.com/pkgjs/parseargs/commit/364333826b746e8a7dc5505b4b22fd19ac51df3b)) +* switch type:string option arguments to greedy, but with error for suspect cases in strict mode ([#88](https://github.com/pkgjs/parseargs/issues/88)) ([c2b5e72](https://github.com/pkgjs/parseargs/commit/c2b5e72161991dfdc535909f1327cc9b970fe7e8)) + +### [0.7.1](https://github.com/pkgjs/parseargs/compare/v0.7.0...v0.7.1) (2022-04-15) + + +### Bug Fixes + +* resist pollution ([#106](https://github.com/pkgjs/parseargs/issues/106)) ([ecf2dec](https://github.com/pkgjs/parseargs/commit/ecf2dece0a9f2a76d789384d5d71c68ffe64022a)) + +## [0.7.0](https://github.com/pkgjs/parseargs/compare/v0.6.0...v0.7.0) (2022-04-13) + + +### Features + +* Add strict mode to parser ([#74](https://github.com/pkgjs/parseargs/issues/74)) ([8267d02](https://github.com/pkgjs/parseargs/commit/8267d02083a87b8b8a71fcce08348d1e031ea91c)) + +## [0.6.0](https://github.com/pkgjs/parseargs/compare/v0.5.0...v0.6.0) (2022-04-11) + + +### ⚠ BREAKING CHANGES + +* rework results to remove redundant `flags` property and store value true for boolean options (#83) +* switch to existing ERR_INVALID_ARG_VALUE (#97) + +### Code Refactoring + +* rework results to remove redundant `flags` property and store value true for boolean options ([#83](https://github.com/pkgjs/parseargs/issues/83)) ([be153db](https://github.com/pkgjs/parseargs/commit/be153dbed1d488cb7b6e27df92f601ba7337713d)) +* switch to existing ERR_INVALID_ARG_VALUE ([#97](https://github.com/pkgjs/parseargs/issues/97)) ([084a23f](https://github.com/pkgjs/parseargs/commit/084a23f9fde2da030b159edb1c2385f24579ce40)) + +## [0.5.0](https://github.com/pkgjs/parseargs/compare/v0.4.0...v0.5.0) (2022-04-10) + + +### ⚠ BREAKING CHANGES + +* Require type to be specified for each supplied option (#95) + +### Features + +* Require type to be specified for each supplied option ([#95](https://github.com/pkgjs/parseargs/issues/95)) ([02cd018](https://github.com/pkgjs/parseargs/commit/02cd01885b8aaa59f2db8308f2d4479e64340068)) + +## [0.4.0](https://github.com/pkgjs/parseargs/compare/v0.3.0...v0.4.0) (2022-03-12) + + +### ⚠ BREAKING CHANGES + +* parsing, revisit short option groups, add support for combined short and value (#75) +* restructure configuration to take options bag (#63) + +### Code Refactoring + +* parsing, revisit short option groups, add support for combined short and value ([#75](https://github.com/pkgjs/parseargs/issues/75)) ([a92600f](https://github.com/pkgjs/parseargs/commit/a92600fa6c214508ab1e016fa55879a314f541af)) +* restructure configuration to take options bag ([#63](https://github.com/pkgjs/parseargs/issues/63)) ([b412095](https://github.com/pkgjs/parseargs/commit/b4120957d90e809ee8b607b06e747d3e6a6b213e)) + +## [0.3.0](https://github.com/pkgjs/parseargs/compare/v0.2.0...v0.3.0) (2022-02-06) + + +### Features + +* **parser:** support short-option groups ([#59](https://github.com/pkgjs/parseargs/issues/59)) ([882067b](https://github.com/pkgjs/parseargs/commit/882067bc2d7cbc6b796f8e5a079a99bc99d4e6ba)) + +## [0.2.0](https://github.com/pkgjs/parseargs/compare/v0.1.1...v0.2.0) (2022-02-05) + + +### Features + +* basic support for shorts ([#50](https://github.com/pkgjs/parseargs/issues/50)) ([a2f36d7](https://github.com/pkgjs/parseargs/commit/a2f36d7da4145af1c92f76806b7fe2baf6beeceb)) + + +### Bug Fixes + +* always store value for a=b ([#43](https://github.com/pkgjs/parseargs/issues/43)) ([a85e8dc](https://github.com/pkgjs/parseargs/commit/a85e8dc06379fd2696ee195cc625de8fac6aee42)) +* support single dash as positional ([#49](https://github.com/pkgjs/parseargs/issues/49)) ([d795bf8](https://github.com/pkgjs/parseargs/commit/d795bf877d068fd67aec381f30b30b63f97109ad)) + +### [0.1.1](https://github.com/pkgjs/parseargs/compare/v0.1.0...v0.1.1) (2022-01-25) + + +### Bug Fixes + +* only use arrays in results for multiples ([#42](https://github.com/pkgjs/parseargs/issues/42)) ([c357584](https://github.com/pkgjs/parseargs/commit/c357584847912506319ed34a0840080116f4fd65)) + +## 0.1.0 (2022-01-22) + + +### Features + +* expand scenarios covered by default arguments for environments ([#20](https://github.com/pkgjs/parseargs/issues/20)) ([582ada7](https://github.com/pkgjs/parseargs/commit/582ada7be0eca3a73d6e0bd016e7ace43449fa4c)) +* update readme and include contributing guidelines ([8edd6fc](https://github.com/pkgjs/parseargs/commit/8edd6fc863cd705f6fac732724159ebe8065a2b0)) + + +### Bug Fixes + +* do not strip excess leading dashes on long option names ([#21](https://github.com/pkgjs/parseargs/issues/21)) ([f848590](https://github.com/pkgjs/parseargs/commit/f848590ebf3249ed5979ff47e003fa6e1a8ec5c0)) +* name & readme ([3f057c1](https://github.com/pkgjs/parseargs/commit/3f057c1b158a1bdbe878c64b57460c58e56e465f)) +* package.json values ([9bac300](https://github.com/pkgjs/parseargs/commit/9bac300e00cd76c77076bf9e75e44f8929512da9)) +* update readme name ([957d8d9](https://github.com/pkgjs/parseargs/commit/957d8d96e1dcb48297c0a14345d44c0123b2883e)) + + +### Build System + +* first release as minor ([421c6e2](https://github.com/pkgjs/parseargs/commit/421c6e2569a8668ad14fac5a5af5be60479a7571)) diff --git a/node_modules/@pkgjs/parseargs/LICENSE b/node_modules/@pkgjs/parseargs/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/node_modules/@pkgjs/parseargs/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/node_modules/@pkgjs/parseargs/README.md b/node_modules/@pkgjs/parseargs/README.md new file mode 100644 index 0000000..0a04192 --- /dev/null +++ b/node_modules/@pkgjs/parseargs/README.md @@ -0,0 +1,413 @@ + +# parseArgs + +[![Coverage][coverage-image]][coverage-url] + +Polyfill of `util.parseArgs()` + +## `util.parseArgs([config])` + + + +> Stability: 1 - Experimental + +* `config` {Object} Used to provide arguments for parsing and to configure + the parser. `config` supports the following properties: + * `args` {string\[]} array of argument strings. **Default:** `process.argv` + with `execPath` and `filename` removed. + * `options` {Object} Used to describe arguments known to the parser. + Keys of `options` are the long names of options and values are an + {Object} accepting the following properties: + * `type` {string} Type of argument, which must be either `boolean` or `string`. + * `multiple` {boolean} Whether this option can be provided multiple + times. If `true`, all values will be collected in an array. If + `false`, values for the option are last-wins. **Default:** `false`. + * `short` {string} A single character alias for the option. + * `default` {string | boolean | string\[] | boolean\[]} The default option + value when it is not set by args. It must be of the same type as the + the `type` property. When `multiple` is `true`, it must be an array. + * `strict` {boolean} Should an error be thrown when unknown arguments + are encountered, or when arguments are passed that do not match the + `type` configured in `options`. + **Default:** `true`. + * `allowPositionals` {boolean} Whether this command accepts positional + arguments. + **Default:** `false` if `strict` is `true`, otherwise `true`. + * `tokens` {boolean} Return the parsed tokens. This is useful for extending + the built-in behavior, from adding additional checks through to reprocessing + the tokens in different ways. + **Default:** `false`. + +* Returns: {Object} The parsed command line arguments: + * `values` {Object} A mapping of parsed option names with their {string} + or {boolean} values. + * `positionals` {string\[]} Positional arguments. + * `tokens` {Object\[] | undefined} See [parseArgs tokens](#parseargs-tokens) + section. Only returned if `config` includes `tokens: true`. + +Provides a higher level API for command-line argument parsing than interacting +with `process.argv` directly. Takes a specification for the expected arguments +and returns a structured object with the parsed options and positionals. + +```mjs +import { parseArgs } from 'node:util'; +const args = ['-f', '--bar', 'b']; +const options = { + foo: { + type: 'boolean', + short: 'f' + }, + bar: { + type: 'string' + } +}; +const { + values, + positionals +} = parseArgs({ args, options }); +console.log(values, positionals); +// Prints: [Object: null prototype] { foo: true, bar: 'b' } [] +``` + +```cjs +const { parseArgs } = require('node:util'); +const args = ['-f', '--bar', 'b']; +const options = { + foo: { + type: 'boolean', + short: 'f' + }, + bar: { + type: 'string' + } +}; +const { + values, + positionals +} = parseArgs({ args, options }); +console.log(values, positionals); +// Prints: [Object: null prototype] { foo: true, bar: 'b' } [] +``` + +`util.parseArgs` is experimental and behavior may change. Join the +conversation in [pkgjs/parseargs][] to contribute to the design. + +### `parseArgs` `tokens` + +Detailed parse information is available for adding custom behaviours by +specifying `tokens: true` in the configuration. +The returned tokens have properties describing: + +* all tokens + * `kind` {string} One of 'option', 'positional', or 'option-terminator'. + * `index` {number} Index of element in `args` containing token. So the + source argument for a token is `args[token.index]`. +* option tokens + * `name` {string} Long name of option. + * `rawName` {string} How option used in args, like `-f` of `--foo`. + * `value` {string | undefined} Option value specified in args. + Undefined for boolean options. + * `inlineValue` {boolean | undefined} Whether option value specified inline, + like `--foo=bar`. +* positional tokens + * `value` {string} The value of the positional argument in args (i.e. `args[index]`). +* option-terminator token + +The returned tokens are in the order encountered in the input args. Options +that appear more than once in args produce a token for each use. Short option +groups like `-xy` expand to a token for each option. So `-xxx` produces +three tokens. + +For example to use the returned tokens to add support for a negated option +like `--no-color`, the tokens can be reprocessed to change the value stored +for the negated option. + +```mjs +import { parseArgs } from 'node:util'; + +const options = { + 'color': { type: 'boolean' }, + 'no-color': { type: 'boolean' }, + 'logfile': { type: 'string' }, + 'no-logfile': { type: 'boolean' }, +}; +const { values, tokens } = parseArgs({ options, tokens: true }); + +// Reprocess the option tokens and overwrite the returned values. +tokens + .filter((token) => token.kind === 'option') + .forEach((token) => { + if (token.name.startsWith('no-')) { + // Store foo:false for --no-foo + const positiveName = token.name.slice(3); + values[positiveName] = false; + delete values[token.name]; + } else { + // Resave value so last one wins if both --foo and --no-foo. + values[token.name] = token.value ?? true; + } + }); + +const color = values.color; +const logfile = values.logfile ?? 'default.log'; + +console.log({ logfile, color }); +``` + +```cjs +const { parseArgs } = require('node:util'); + +const options = { + 'color': { type: 'boolean' }, + 'no-color': { type: 'boolean' }, + 'logfile': { type: 'string' }, + 'no-logfile': { type: 'boolean' }, +}; +const { values, tokens } = parseArgs({ options, tokens: true }); + +// Reprocess the option tokens and overwrite the returned values. +tokens + .filter((token) => token.kind === 'option') + .forEach((token) => { + if (token.name.startsWith('no-')) { + // Store foo:false for --no-foo + const positiveName = token.name.slice(3); + values[positiveName] = false; + delete values[token.name]; + } else { + // Resave value so last one wins if both --foo and --no-foo. + values[token.name] = token.value ?? true; + } + }); + +const color = values.color; +const logfile = values.logfile ?? 'default.log'; + +console.log({ logfile, color }); +``` + +Example usage showing negated options, and when an option is used +multiple ways then last one wins. + +```console +$ node negate.js +{ logfile: 'default.log', color: undefined } +$ node negate.js --no-logfile --no-color +{ logfile: false, color: false } +$ node negate.js --logfile=test.log --color +{ logfile: 'test.log', color: true } +$ node negate.js --no-logfile --logfile=test.log --color --no-color +{ logfile: 'test.log', color: false } +``` + +----- + + +## Table of Contents +- [`util.parseArgs([config])`](#utilparseargsconfig) +- [Scope](#scope) +- [Version Matchups](#version-matchups) +- [🚀 Getting Started](#-getting-started) +- [🙌 Contributing](#-contributing) +- [💡 `process.mainArgs` Proposal](#-processmainargs-proposal) + - [Implementation:](#implementation) +- [📃 Examples](#-examples) +- [F.A.Qs](#faqs) +- [Links & Resources](#links--resources) + +----- + +## Scope + +It is already possible to build great arg parsing modules on top of what Node.js provides; the prickly API is abstracted away by these modules. Thus, process.parseArgs() is not necessarily intended for library authors; it is intended for developers of simple CLI tools, ad-hoc scripts, deployed Node.js applications, and learning materials. + +It is exceedingly difficult to provide an API which would both be friendly to these Node.js users while being extensible enough for libraries to build upon. We chose to prioritize these use cases because these are currently not well-served by Node.js' API. + +---- + +## Version Matchups + +| Node.js | @pkgjs/parseArgs | +| -- | -- | +| [v18.3.0](https://nodejs.org/docs/latest-v18.x/api/util.html#utilparseargsconfig) | [v0.9.1](https://github.com/pkgjs/parseargs/tree/v0.9.1#utilparseargsconfig) | +| [v16.17.0](https://nodejs.org/dist/latest-v16.x/docs/api/util.html#utilparseargsconfig), [v18.7.0](https://nodejs.org/docs/latest-v18.x/api/util.html#utilparseargsconfig) | [0.10.0](https://github.com/pkgjs/parseargs/tree/v0.10.0#utilparseargsconfig) | + +---- + +## 🚀 Getting Started + +1. **Install dependencies.** + + ```bash + npm install + ``` + +2. **Open the index.js file and start editing!** + +3. **Test your code by calling parseArgs through our test file** + + ```bash + npm test + ``` + +---- + +## 🙌 Contributing + +Any person who wants to contribute to the initiative is welcome! Please first read the [Contributing Guide](CONTRIBUTING.md) + +Additionally, reading the [`Examples w/ Output`](#-examples-w-output) section of this document will be the best way to familiarize yourself with the target expected behavior for parseArgs() once it is fully implemented. + +This package was implemented using [tape](https://www.npmjs.com/package/tape) as its test harness. + +---- + +## 💡 `process.mainArgs` Proposal + +> Note: This can be moved forward independently of the `util.parseArgs()` proposal/work. + +### Implementation: + +```javascript +process.mainArgs = process.argv.slice(process._exec ? 1 : 2) +``` + +---- + +## 📃 Examples + +```js +const { parseArgs } = require('@pkgjs/parseargs'); +``` + +```js +const { parseArgs } = require('@pkgjs/parseargs'); +// specify the options that may be used +const options = { + foo: { type: 'string'}, + bar: { type: 'boolean' }, +}; +const args = ['--foo=a', '--bar']; +const { values, positionals } = parseArgs({ args, options }); +// values = { foo: 'a', bar: true } +// positionals = [] +``` + +```js +const { parseArgs } = require('@pkgjs/parseargs'); +// type:string & multiple +const options = { + foo: { + type: 'string', + multiple: true, + }, +}; +const args = ['--foo=a', '--foo', 'b']; +const { values, positionals } = parseArgs({ args, options }); +// values = { foo: [ 'a', 'b' ] } +// positionals = [] +``` + +```js +const { parseArgs } = require('@pkgjs/parseargs'); +// shorts +const options = { + foo: { + short: 'f', + type: 'boolean' + }, +}; +const args = ['-f', 'b']; +const { values, positionals } = parseArgs({ args, options, allowPositionals: true }); +// values = { foo: true } +// positionals = ['b'] +``` + +```js +const { parseArgs } = require('@pkgjs/parseargs'); +// unconfigured +const options = {}; +const args = ['-f', '--foo=a', '--bar', 'b']; +const { values, positionals } = parseArgs({ strict: false, args, options, allowPositionals: true }); +// values = { f: true, foo: 'a', bar: true } +// positionals = ['b'] +``` + +---- + +## F.A.Qs + +- Is `cmd --foo=bar baz` the same as `cmd baz --foo=bar`? + - yes +- Does the parser execute a function? + - no +- Does the parser execute one of several functions, depending on input? + - no +- Can subcommands take options that are distinct from the main command? + - no +- Does it output generated help when no options match? + - no +- Does it generated short usage? Like: `usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...]` + - no (no usage/help at all) +- Does the user provide the long usage text? For each option? For the whole command? + - no +- Do subcommands (if implemented) have their own usage output? + - no +- Does usage print if the user runs `cmd --help`? + - no +- Does it set `process.exitCode`? + - no +- Does usage print to stderr or stdout? + - N/A +- Does it check types? (Say, specify that an option is a boolean, number, etc.) + - no +- Can an option have more than one type? (string or false, for example) + - no +- Can the user define a type? (Say, `type: path` to call `path.resolve()` on the argument.) + - no +- Does a `--foo=0o22` mean 0, 22, 18, or "0o22"? + - `"0o22"` +- Does it coerce types? + - no +- Does `--no-foo` coerce to `--foo=false`? For all options? Only boolean options? + - no, it sets `{values:{'no-foo': true}}` +- Is `--foo` the same as `--foo=true`? Only for known booleans? Only at the end? + - no, they are not the same. There is no special handling of `true` as a value so it is just another string. +- Does it read environment variables? Ie, is `FOO=1 cmd` the same as `cmd --foo=1`? + - no +- Do unknown arguments raise an error? Are they parsed? Are they treated as positional arguments? + - no, they are parsed, not treated as positionals +- Does `--` signal the end of options? + - yes +- Is `--` included as a positional? + - no +- Is `program -- foo` the same as `program foo`? + - yes, both store `{positionals:['foo']}` +- Does the API specify whether a `--` was present/relevant? + - no +- Is `-bar` the same as `--bar`? + - no, `-bar` is a short option or options, with expansion logic that follows the + [Utility Syntax Guidelines in POSIX.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html). `-bar` expands to `-b`, `-a`, `-r`. +- Is `---foo` the same as `--foo`? + - no + - the first is a long option named `'-foo'` + - the second is a long option named `'foo'` +- Is `-` a positional? ie, `bash some-test.sh | tap -` + - yes + +## Links & Resources + +* [Initial Tooling Issue](https://github.com/nodejs/tooling/issues/19) +* [Initial Proposal](https://github.com/nodejs/node/pull/35015) +* [parseArgs Proposal](https://github.com/nodejs/node/pull/42675) + +[coverage-image]: https://img.shields.io/nycrc/pkgjs/parseargs +[coverage-url]: https://github.com/pkgjs/parseargs/blob/main/.nycrc +[pkgjs/parseargs]: https://github.com/pkgjs/parseargs diff --git a/node_modules/@pkgjs/parseargs/examples/is-default-value.js b/node_modules/@pkgjs/parseargs/examples/is-default-value.js new file mode 100644 index 0000000..0a67972 --- /dev/null +++ b/node_modules/@pkgjs/parseargs/examples/is-default-value.js @@ -0,0 +1,25 @@ +'use strict'; + +// This example shows how to understand if a default value is used or not. + +// 1. const { parseArgs } = require('node:util'); // from node +// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package +const { parseArgs } = require('..'); // in repo + +const options = { + file: { short: 'f', type: 'string', default: 'FOO' }, +}; + +const { values, tokens } = parseArgs({ options, tokens: true }); + +const isFileDefault = !tokens.some((token) => token.kind === 'option' && + token.name === 'file' +); + +console.log(values); +console.log(`Is the file option [${values.file}] the default value? ${isFileDefault}`); + +// Try the following: +// node is-default-value.js +// node is-default-value.js -f FILE +// node is-default-value.js --file FILE diff --git a/node_modules/@pkgjs/parseargs/examples/limit-long-syntax.js b/node_modules/@pkgjs/parseargs/examples/limit-long-syntax.js new file mode 100644 index 0000000..943e643 --- /dev/null +++ b/node_modules/@pkgjs/parseargs/examples/limit-long-syntax.js @@ -0,0 +1,35 @@ +'use strict'; + +// This is an example of using tokens to add a custom behaviour. +// +// Require the use of `=` for long options and values by blocking +// the use of space separated values. +// So allow `--foo=bar`, and not allow `--foo bar`. +// +// Note: this is not a common behaviour, most CLIs allow both forms. + +// 1. const { parseArgs } = require('node:util'); // from node +// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package +const { parseArgs } = require('..'); // in repo + +const options = { + file: { short: 'f', type: 'string' }, + log: { type: 'string' }, +}; + +const { values, tokens } = parseArgs({ options, tokens: true }); + +const badToken = tokens.find((token) => token.kind === 'option' && + token.value != null && + token.rawName.startsWith('--') && + !token.inlineValue +); +if (badToken) { + throw new Error(`Option value for '${badToken.rawName}' must be inline, like '${badToken.rawName}=VALUE'`); +} + +console.log(values); + +// Try the following: +// node limit-long-syntax.js -f FILE --log=LOG +// node limit-long-syntax.js --file FILE diff --git a/node_modules/@pkgjs/parseargs/examples/negate.js b/node_modules/@pkgjs/parseargs/examples/negate.js new file mode 100644 index 0000000..b663469 --- /dev/null +++ b/node_modules/@pkgjs/parseargs/examples/negate.js @@ -0,0 +1,43 @@ +'use strict'; + +// This example is used in the documentation. + +// How might I add my own support for --no-foo? + +// 1. const { parseArgs } = require('node:util'); // from node +// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package +const { parseArgs } = require('..'); // in repo + +const options = { + 'color': { type: 'boolean' }, + 'no-color': { type: 'boolean' }, + 'logfile': { type: 'string' }, + 'no-logfile': { type: 'boolean' }, +}; +const { values, tokens } = parseArgs({ options, tokens: true }); + +// Reprocess the option tokens and overwrite the returned values. +tokens + .filter((token) => token.kind === 'option') + .forEach((token) => { + if (token.name.startsWith('no-')) { + // Store foo:false for --no-foo + const positiveName = token.name.slice(3); + values[positiveName] = false; + delete values[token.name]; + } else { + // Resave value so last one wins if both --foo and --no-foo. + values[token.name] = token.value ?? true; + } + }); + +const color = values.color; +const logfile = values.logfile ?? 'default.log'; + +console.log({ logfile, color }); + +// Try the following: +// node negate.js +// node negate.js --no-logfile --no-color +// negate.js --logfile=test.log --color +// node negate.js --no-logfile --logfile=test.log --color --no-color diff --git a/node_modules/@pkgjs/parseargs/examples/no-repeated-options.js b/node_modules/@pkgjs/parseargs/examples/no-repeated-options.js new file mode 100644 index 0000000..0c32468 --- /dev/null +++ b/node_modules/@pkgjs/parseargs/examples/no-repeated-options.js @@ -0,0 +1,31 @@ +'use strict'; + +// This is an example of using tokens to add a custom behaviour. +// +// Throw an error if an option is used more than once. + +// 1. const { parseArgs } = require('node:util'); // from node +// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package +const { parseArgs } = require('..'); // in repo + +const options = { + ding: { type: 'boolean', short: 'd' }, + beep: { type: 'boolean', short: 'b' } +}; +const { values, tokens } = parseArgs({ options, tokens: true }); + +const seenBefore = new Set(); +tokens.forEach((token) => { + if (token.kind !== 'option') return; + if (seenBefore.has(token.name)) { + throw new Error(`option '${token.name}' used multiple times`); + } + seenBefore.add(token.name); +}); + +console.log(values); + +// Try the following: +// node no-repeated-options --ding --beep +// node no-repeated-options --beep -b +// node no-repeated-options -ddd diff --git a/node_modules/@pkgjs/parseargs/examples/ordered-options.mjs b/node_modules/@pkgjs/parseargs/examples/ordered-options.mjs new file mode 100644 index 0000000..8ab7367 --- /dev/null +++ b/node_modules/@pkgjs/parseargs/examples/ordered-options.mjs @@ -0,0 +1,41 @@ +// This is an example of using tokens to add a custom behaviour. +// +// This adds a option order check so that --some-unstable-option +// may only be used after --enable-experimental-options +// +// Note: this is not a common behaviour, the order of different options +// does not usually matter. + +import { parseArgs } from '../index.js'; + +function findTokenIndex(tokens, target) { + return tokens.findIndex((token) => token.kind === 'option' && + token.name === target + ); +} + +const experimentalName = 'enable-experimental-options'; +const unstableName = 'some-unstable-option'; + +const options = { + [experimentalName]: { type: 'boolean' }, + [unstableName]: { type: 'boolean' }, +}; + +const { values, tokens } = parseArgs({ options, tokens: true }); + +const experimentalIndex = findTokenIndex(tokens, experimentalName); +const unstableIndex = findTokenIndex(tokens, unstableName); +if (unstableIndex !== -1 && + ((experimentalIndex === -1) || (unstableIndex < experimentalIndex))) { + throw new Error(`'--${experimentalName}' must be specified before '--${unstableName}'`); +} + +console.log(values); + +/* eslint-disable max-len */ +// Try the following: +// node ordered-options.mjs +// node ordered-options.mjs --some-unstable-option +// node ordered-options.mjs --some-unstable-option --enable-experimental-options +// node ordered-options.mjs --enable-experimental-options --some-unstable-option diff --git a/node_modules/@pkgjs/parseargs/examples/simple-hard-coded.js b/node_modules/@pkgjs/parseargs/examples/simple-hard-coded.js new file mode 100644 index 0000000..eff04c2 --- /dev/null +++ b/node_modules/@pkgjs/parseargs/examples/simple-hard-coded.js @@ -0,0 +1,26 @@ +'use strict'; + +// This example is used in the documentation. + +// 1. const { parseArgs } = require('node:util'); // from node +// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package +const { parseArgs } = require('..'); // in repo + +const args = ['-f', '--bar', 'b']; +const options = { + foo: { + type: 'boolean', + short: 'f' + }, + bar: { + type: 'string' + } +}; +const { + values, + positionals +} = parseArgs({ args, options }); +console.log(values, positionals); + +// Try the following: +// node simple-hard-coded.js diff --git a/node_modules/@pkgjs/parseargs/index.js b/node_modules/@pkgjs/parseargs/index.js new file mode 100644 index 0000000..b1004c7 --- /dev/null +++ b/node_modules/@pkgjs/parseargs/index.js @@ -0,0 +1,396 @@ +'use strict'; + +const { + ArrayPrototypeForEach, + ArrayPrototypeIncludes, + ArrayPrototypeMap, + ArrayPrototypePush, + ArrayPrototypePushApply, + ArrayPrototypeShift, + ArrayPrototypeSlice, + ArrayPrototypeUnshiftApply, + ObjectEntries, + ObjectPrototypeHasOwnProperty: ObjectHasOwn, + StringPrototypeCharAt, + StringPrototypeIndexOf, + StringPrototypeSlice, + StringPrototypeStartsWith, +} = require('./internal/primordials'); + +const { + validateArray, + validateBoolean, + validateBooleanArray, + validateObject, + validateString, + validateStringArray, + validateUnion, +} = require('./internal/validators'); + +const { + kEmptyObject, +} = require('./internal/util'); + +const { + findLongOptionForShort, + isLoneLongOption, + isLoneShortOption, + isLongOptionAndValue, + isOptionValue, + isOptionLikeValue, + isShortOptionAndValue, + isShortOptionGroup, + useDefaultValueOption, + objectGetOwn, + optionsGetOwn, +} = require('./utils'); + +const { + codes: { + ERR_INVALID_ARG_VALUE, + ERR_PARSE_ARGS_INVALID_OPTION_VALUE, + ERR_PARSE_ARGS_UNKNOWN_OPTION, + ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL, + }, +} = require('./internal/errors'); + +function getMainArgs() { + // Work out where to slice process.argv for user supplied arguments. + + // Check node options for scenarios where user CLI args follow executable. + const execArgv = process.execArgv; + if (ArrayPrototypeIncludes(execArgv, '-e') || + ArrayPrototypeIncludes(execArgv, '--eval') || + ArrayPrototypeIncludes(execArgv, '-p') || + ArrayPrototypeIncludes(execArgv, '--print')) { + return ArrayPrototypeSlice(process.argv, 1); + } + + // Normally first two arguments are executable and script, then CLI arguments + return ArrayPrototypeSlice(process.argv, 2); +} + +/** + * In strict mode, throw for possible usage errors like --foo --bar + * + * @param {object} token - from tokens as available from parseArgs + */ +function checkOptionLikeValue(token) { + if (!token.inlineValue && isOptionLikeValue(token.value)) { + // Only show short example if user used short option. + const example = StringPrototypeStartsWith(token.rawName, '--') ? + `'${token.rawName}=-XYZ'` : + `'--${token.name}=-XYZ' or '${token.rawName}-XYZ'`; + const errorMessage = `Option '${token.rawName}' argument is ambiguous. +Did you forget to specify the option argument for '${token.rawName}'? +To specify an option argument starting with a dash use ${example}.`; + throw new ERR_PARSE_ARGS_INVALID_OPTION_VALUE(errorMessage); + } +} + +/** + * In strict mode, throw for usage errors. + * + * @param {object} config - from config passed to parseArgs + * @param {object} token - from tokens as available from parseArgs + */ +function checkOptionUsage(config, token) { + if (!ObjectHasOwn(config.options, token.name)) { + throw new ERR_PARSE_ARGS_UNKNOWN_OPTION( + token.rawName, config.allowPositionals); + } + + const short = optionsGetOwn(config.options, token.name, 'short'); + const shortAndLong = `${short ? `-${short}, ` : ''}--${token.name}`; + const type = optionsGetOwn(config.options, token.name, 'type'); + if (type === 'string' && typeof token.value !== 'string') { + throw new ERR_PARSE_ARGS_INVALID_OPTION_VALUE(`Option '${shortAndLong} ' argument missing`); + } + // (Idiomatic test for undefined||null, expecting undefined.) + if (type === 'boolean' && token.value != null) { + throw new ERR_PARSE_ARGS_INVALID_OPTION_VALUE(`Option '${shortAndLong}' does not take an argument`); + } +} + + +/** + * Store the option value in `values`. + * + * @param {string} longOption - long option name e.g. 'foo' + * @param {string|undefined} optionValue - value from user args + * @param {object} options - option configs, from parseArgs({ options }) + * @param {object} values - option values returned in `values` by parseArgs + */ +function storeOption(longOption, optionValue, options, values) { + if (longOption === '__proto__') { + return; // No. Just no. + } + + // We store based on the option value rather than option type, + // preserving the users intent for author to deal with. + const newValue = optionValue ?? true; + if (optionsGetOwn(options, longOption, 'multiple')) { + // Always store value in array, including for boolean. + // values[longOption] starts out not present, + // first value is added as new array [newValue], + // subsequent values are pushed to existing array. + // (note: values has null prototype, so simpler usage) + if (values[longOption]) { + ArrayPrototypePush(values[longOption], newValue); + } else { + values[longOption] = [newValue]; + } + } else { + values[longOption] = newValue; + } +} + +/** + * Store the default option value in `values`. + * + * @param {string} longOption - long option name e.g. 'foo' + * @param {string + * | boolean + * | string[] + * | boolean[]} optionValue - default value from option config + * @param {object} values - option values returned in `values` by parseArgs + */ +function storeDefaultOption(longOption, optionValue, values) { + if (longOption === '__proto__') { + return; // No. Just no. + } + + values[longOption] = optionValue; +} + +/** + * Process args and turn into identified tokens: + * - option (along with value, if any) + * - positional + * - option-terminator + * + * @param {string[]} args - from parseArgs({ args }) or mainArgs + * @param {object} options - option configs, from parseArgs({ options }) + */ +function argsToTokens(args, options) { + const tokens = []; + let index = -1; + let groupCount = 0; + + const remainingArgs = ArrayPrototypeSlice(args); + while (remainingArgs.length > 0) { + const arg = ArrayPrototypeShift(remainingArgs); + const nextArg = remainingArgs[0]; + if (groupCount > 0) + groupCount--; + else + index++; + + // Check if `arg` is an options terminator. + // Guideline 10 in https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html + if (arg === '--') { + // Everything after a bare '--' is considered a positional argument. + ArrayPrototypePush(tokens, { kind: 'option-terminator', index }); + ArrayPrototypePushApply( + tokens, ArrayPrototypeMap(remainingArgs, (arg) => { + return { kind: 'positional', index: ++index, value: arg }; + }) + ); + break; // Finished processing args, leave while loop. + } + + if (isLoneShortOption(arg)) { + // e.g. '-f' + const shortOption = StringPrototypeCharAt(arg, 1); + const longOption = findLongOptionForShort(shortOption, options); + let value; + let inlineValue; + if (optionsGetOwn(options, longOption, 'type') === 'string' && + isOptionValue(nextArg)) { + // e.g. '-f', 'bar' + value = ArrayPrototypeShift(remainingArgs); + inlineValue = false; + } + ArrayPrototypePush( + tokens, + { kind: 'option', name: longOption, rawName: arg, + index, value, inlineValue }); + if (value != null) ++index; + continue; + } + + if (isShortOptionGroup(arg, options)) { + // Expand -fXzy to -f -X -z -y + const expanded = []; + for (let index = 1; index < arg.length; index++) { + const shortOption = StringPrototypeCharAt(arg, index); + const longOption = findLongOptionForShort(shortOption, options); + if (optionsGetOwn(options, longOption, 'type') !== 'string' || + index === arg.length - 1) { + // Boolean option, or last short in group. Well formed. + ArrayPrototypePush(expanded, `-${shortOption}`); + } else { + // String option in middle. Yuck. + // Expand -abfFILE to -a -b -fFILE + ArrayPrototypePush(expanded, `-${StringPrototypeSlice(arg, index)}`); + break; // finished short group + } + } + ArrayPrototypeUnshiftApply(remainingArgs, expanded); + groupCount = expanded.length; + continue; + } + + if (isShortOptionAndValue(arg, options)) { + // e.g. -fFILE + const shortOption = StringPrototypeCharAt(arg, 1); + const longOption = findLongOptionForShort(shortOption, options); + const value = StringPrototypeSlice(arg, 2); + ArrayPrototypePush( + tokens, + { kind: 'option', name: longOption, rawName: `-${shortOption}`, + index, value, inlineValue: true }); + continue; + } + + if (isLoneLongOption(arg)) { + // e.g. '--foo' + const longOption = StringPrototypeSlice(arg, 2); + let value; + let inlineValue; + if (optionsGetOwn(options, longOption, 'type') === 'string' && + isOptionValue(nextArg)) { + // e.g. '--foo', 'bar' + value = ArrayPrototypeShift(remainingArgs); + inlineValue = false; + } + ArrayPrototypePush( + tokens, + { kind: 'option', name: longOption, rawName: arg, + index, value, inlineValue }); + if (value != null) ++index; + continue; + } + + if (isLongOptionAndValue(arg)) { + // e.g. --foo=bar + const equalIndex = StringPrototypeIndexOf(arg, '='); + const longOption = StringPrototypeSlice(arg, 2, equalIndex); + const value = StringPrototypeSlice(arg, equalIndex + 1); + ArrayPrototypePush( + tokens, + { kind: 'option', name: longOption, rawName: `--${longOption}`, + index, value, inlineValue: true }); + continue; + } + + ArrayPrototypePush(tokens, { kind: 'positional', index, value: arg }); + } + + return tokens; +} + +const parseArgs = (config = kEmptyObject) => { + const args = objectGetOwn(config, 'args') ?? getMainArgs(); + const strict = objectGetOwn(config, 'strict') ?? true; + const allowPositionals = objectGetOwn(config, 'allowPositionals') ?? !strict; + const returnTokens = objectGetOwn(config, 'tokens') ?? false; + const options = objectGetOwn(config, 'options') ?? { __proto__: null }; + // Bundle these up for passing to strict-mode checks. + const parseConfig = { args, strict, options, allowPositionals }; + + // Validate input configuration. + validateArray(args, 'args'); + validateBoolean(strict, 'strict'); + validateBoolean(allowPositionals, 'allowPositionals'); + validateBoolean(returnTokens, 'tokens'); + validateObject(options, 'options'); + ArrayPrototypeForEach( + ObjectEntries(options), + ({ 0: longOption, 1: optionConfig }) => { + validateObject(optionConfig, `options.${longOption}`); + + // type is required + const optionType = objectGetOwn(optionConfig, 'type'); + validateUnion(optionType, `options.${longOption}.type`, ['string', 'boolean']); + + if (ObjectHasOwn(optionConfig, 'short')) { + const shortOption = optionConfig.short; + validateString(shortOption, `options.${longOption}.short`); + if (shortOption.length !== 1) { + throw new ERR_INVALID_ARG_VALUE( + `options.${longOption}.short`, + shortOption, + 'must be a single character' + ); + } + } + + const multipleOption = objectGetOwn(optionConfig, 'multiple'); + if (ObjectHasOwn(optionConfig, 'multiple')) { + validateBoolean(multipleOption, `options.${longOption}.multiple`); + } + + const defaultValue = objectGetOwn(optionConfig, 'default'); + if (defaultValue !== undefined) { + let validator; + switch (optionType) { + case 'string': + validator = multipleOption ? validateStringArray : validateString; + break; + + case 'boolean': + validator = multipleOption ? validateBooleanArray : validateBoolean; + break; + } + validator(defaultValue, `options.${longOption}.default`); + } + } + ); + + // Phase 1: identify tokens + const tokens = argsToTokens(args, options); + + // Phase 2: process tokens into parsed option values and positionals + const result = { + values: { __proto__: null }, + positionals: [], + }; + if (returnTokens) { + result.tokens = tokens; + } + ArrayPrototypeForEach(tokens, (token) => { + if (token.kind === 'option') { + if (strict) { + checkOptionUsage(parseConfig, token); + checkOptionLikeValue(token); + } + storeOption(token.name, token.value, options, result.values); + } else if (token.kind === 'positional') { + if (!allowPositionals) { + throw new ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL(token.value); + } + ArrayPrototypePush(result.positionals, token.value); + } + }); + + // Phase 3: fill in default values for missing args + ArrayPrototypeForEach(ObjectEntries(options), ({ 0: longOption, + 1: optionConfig }) => { + const mustSetDefault = useDefaultValueOption(longOption, + optionConfig, + result.values); + if (mustSetDefault) { + storeDefaultOption(longOption, + objectGetOwn(optionConfig, 'default'), + result.values); + } + }); + + + return result; +}; + +module.exports = { + parseArgs, +}; diff --git a/node_modules/@pkgjs/parseargs/internal/errors.js b/node_modules/@pkgjs/parseargs/internal/errors.js new file mode 100644 index 0000000..e1b237b --- /dev/null +++ b/node_modules/@pkgjs/parseargs/internal/errors.js @@ -0,0 +1,47 @@ +'use strict'; + +class ERR_INVALID_ARG_TYPE extends TypeError { + constructor(name, expected, actual) { + super(`${name} must be ${expected} got ${actual}`); + this.code = 'ERR_INVALID_ARG_TYPE'; + } +} + +class ERR_INVALID_ARG_VALUE extends TypeError { + constructor(arg1, arg2, expected) { + super(`The property ${arg1} ${expected}. Received '${arg2}'`); + this.code = 'ERR_INVALID_ARG_VALUE'; + } +} + +class ERR_PARSE_ARGS_INVALID_OPTION_VALUE extends Error { + constructor(message) { + super(message); + this.code = 'ERR_PARSE_ARGS_INVALID_OPTION_VALUE'; + } +} + +class ERR_PARSE_ARGS_UNKNOWN_OPTION extends Error { + constructor(option, allowPositionals) { + const suggestDashDash = allowPositionals ? `. To specify a positional argument starting with a '-', place it at the end of the command after '--', as in '-- ${JSON.stringify(option)}` : ''; + super(`Unknown option '${option}'${suggestDashDash}`); + this.code = 'ERR_PARSE_ARGS_UNKNOWN_OPTION'; + } +} + +class ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL extends Error { + constructor(positional) { + super(`Unexpected argument '${positional}'. This command does not take positional arguments`); + this.code = 'ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL'; + } +} + +module.exports = { + codes: { + ERR_INVALID_ARG_TYPE, + ERR_INVALID_ARG_VALUE, + ERR_PARSE_ARGS_INVALID_OPTION_VALUE, + ERR_PARSE_ARGS_UNKNOWN_OPTION, + ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL, + } +}; diff --git a/node_modules/@pkgjs/parseargs/internal/primordials.js b/node_modules/@pkgjs/parseargs/internal/primordials.js new file mode 100644 index 0000000..63e23ab --- /dev/null +++ b/node_modules/@pkgjs/parseargs/internal/primordials.js @@ -0,0 +1,393 @@ +/* +This file is copied from https://github.com/nodejs/node/blob/v14.19.3/lib/internal/per_context/primordials.js +under the following license: + +Copyright Node.js contributors. All rights reserved. + +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: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +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. +*/ + +'use strict'; + +/* eslint-disable node-core/prefer-primordials */ + +// This file subclasses and stores the JS builtins that come from the VM +// so that Node.js's builtin modules do not need to later look these up from +// the global proxy, which can be mutated by users. + +// Use of primordials have sometimes a dramatic impact on performance, please +// benchmark all changes made in performance-sensitive areas of the codebase. +// See: https://github.com/nodejs/node/pull/38248 + +const primordials = {}; + +const { + defineProperty: ReflectDefineProperty, + getOwnPropertyDescriptor: ReflectGetOwnPropertyDescriptor, + ownKeys: ReflectOwnKeys, +} = Reflect; + +// `uncurryThis` is equivalent to `func => Function.prototype.call.bind(func)`. +// It is using `bind.bind(call)` to avoid using `Function.prototype.bind` +// and `Function.prototype.call` after it may have been mutated by users. +const { apply, bind, call } = Function.prototype; +const uncurryThis = bind.bind(call); +primordials.uncurryThis = uncurryThis; + +// `applyBind` is equivalent to `func => Function.prototype.apply.bind(func)`. +// It is using `bind.bind(apply)` to avoid using `Function.prototype.bind` +// and `Function.prototype.apply` after it may have been mutated by users. +const applyBind = bind.bind(apply); +primordials.applyBind = applyBind; + +// Methods that accept a variable number of arguments, and thus it's useful to +// also create `${prefix}${key}Apply`, which uses `Function.prototype.apply`, +// instead of `Function.prototype.call`, and thus doesn't require iterator +// destructuring. +const varargsMethods = [ + // 'ArrayPrototypeConcat' is omitted, because it performs the spread + // on its own for arrays and array-likes with a truthy + // @@isConcatSpreadable symbol property. + 'ArrayOf', + 'ArrayPrototypePush', + 'ArrayPrototypeUnshift', + // 'FunctionPrototypeCall' is omitted, since there's 'ReflectApply' + // and 'FunctionPrototypeApply'. + 'MathHypot', + 'MathMax', + 'MathMin', + 'StringPrototypeConcat', + 'TypedArrayOf', +]; + +function getNewKey(key) { + return typeof key === 'symbol' ? + `Symbol${key.description[7].toUpperCase()}${key.description.slice(8)}` : + `${key[0].toUpperCase()}${key.slice(1)}`; +} + +function copyAccessor(dest, prefix, key, { enumerable, get, set }) { + ReflectDefineProperty(dest, `${prefix}Get${key}`, { + value: uncurryThis(get), + enumerable + }); + if (set !== undefined) { + ReflectDefineProperty(dest, `${prefix}Set${key}`, { + value: uncurryThis(set), + enumerable + }); + } +} + +function copyPropsRenamed(src, dest, prefix) { + for (const key of ReflectOwnKeys(src)) { + const newKey = getNewKey(key); + const desc = ReflectGetOwnPropertyDescriptor(src, key); + if ('get' in desc) { + copyAccessor(dest, prefix, newKey, desc); + } else { + const name = `${prefix}${newKey}`; + ReflectDefineProperty(dest, name, desc); + if (varargsMethods.includes(name)) { + ReflectDefineProperty(dest, `${name}Apply`, { + // `src` is bound as the `this` so that the static `this` points + // to the object it was defined on, + // e.g.: `ArrayOfApply` gets a `this` of `Array`: + value: applyBind(desc.value, src), + }); + } + } + } +} + +function copyPropsRenamedBound(src, dest, prefix) { + for (const key of ReflectOwnKeys(src)) { + const newKey = getNewKey(key); + const desc = ReflectGetOwnPropertyDescriptor(src, key); + if ('get' in desc) { + copyAccessor(dest, prefix, newKey, desc); + } else { + const { value } = desc; + if (typeof value === 'function') { + desc.value = value.bind(src); + } + + const name = `${prefix}${newKey}`; + ReflectDefineProperty(dest, name, desc); + if (varargsMethods.includes(name)) { + ReflectDefineProperty(dest, `${name}Apply`, { + value: applyBind(value, src), + }); + } + } + } +} + +function copyPrototype(src, dest, prefix) { + for (const key of ReflectOwnKeys(src)) { + const newKey = getNewKey(key); + const desc = ReflectGetOwnPropertyDescriptor(src, key); + if ('get' in desc) { + copyAccessor(dest, prefix, newKey, desc); + } else { + const { value } = desc; + if (typeof value === 'function') { + desc.value = uncurryThis(value); + } + + const name = `${prefix}${newKey}`; + ReflectDefineProperty(dest, name, desc); + if (varargsMethods.includes(name)) { + ReflectDefineProperty(dest, `${name}Apply`, { + value: applyBind(value), + }); + } + } + } +} + +// Create copies of configurable value properties of the global object +[ + 'Proxy', + 'globalThis', +].forEach((name) => { + // eslint-disable-next-line no-restricted-globals + primordials[name] = globalThis[name]; +}); + +// Create copies of URI handling functions +[ + decodeURI, + decodeURIComponent, + encodeURI, + encodeURIComponent, +].forEach((fn) => { + primordials[fn.name] = fn; +}); + +// Create copies of the namespace objects +[ + 'JSON', + 'Math', + 'Proxy', + 'Reflect', +].forEach((name) => { + // eslint-disable-next-line no-restricted-globals + copyPropsRenamed(global[name], primordials, name); +}); + +// Create copies of intrinsic objects +[ + 'Array', + 'ArrayBuffer', + 'BigInt', + 'BigInt64Array', + 'BigUint64Array', + 'Boolean', + 'DataView', + 'Date', + 'Error', + 'EvalError', + 'Float32Array', + 'Float64Array', + 'Function', + 'Int16Array', + 'Int32Array', + 'Int8Array', + 'Map', + 'Number', + 'Object', + 'RangeError', + 'ReferenceError', + 'RegExp', + 'Set', + 'String', + 'Symbol', + 'SyntaxError', + 'TypeError', + 'URIError', + 'Uint16Array', + 'Uint32Array', + 'Uint8Array', + 'Uint8ClampedArray', + 'WeakMap', + 'WeakSet', +].forEach((name) => { + // eslint-disable-next-line no-restricted-globals + const original = global[name]; + primordials[name] = original; + copyPropsRenamed(original, primordials, name); + copyPrototype(original.prototype, primordials, `${name}Prototype`); +}); + +// Create copies of intrinsic objects that require a valid `this` to call +// static methods. +// Refs: https://www.ecma-international.org/ecma-262/#sec-promise.all +[ + 'Promise', +].forEach((name) => { + // eslint-disable-next-line no-restricted-globals + const original = global[name]; + primordials[name] = original; + copyPropsRenamedBound(original, primordials, name); + copyPrototype(original.prototype, primordials, `${name}Prototype`); +}); + +// Create copies of abstract intrinsic objects that are not directly exposed +// on the global object. +// Refs: https://tc39.es/ecma262/#sec-%typedarray%-intrinsic-object +[ + { name: 'TypedArray', original: Reflect.getPrototypeOf(Uint8Array) }, + { name: 'ArrayIterator', original: { + prototype: Reflect.getPrototypeOf(Array.prototype[Symbol.iterator]()), + } }, + { name: 'StringIterator', original: { + prototype: Reflect.getPrototypeOf(String.prototype[Symbol.iterator]()), + } }, +].forEach(({ name, original }) => { + primordials[name] = original; + // The static %TypedArray% methods require a valid `this`, but can't be bound, + // as they need a subclass constructor as the receiver: + copyPrototype(original, primordials, name); + copyPrototype(original.prototype, primordials, `${name}Prototype`); +}); + +/* eslint-enable node-core/prefer-primordials */ + +const { + ArrayPrototypeForEach, + FunctionPrototypeCall, + Map, + ObjectFreeze, + ObjectSetPrototypeOf, + Set, + SymbolIterator, + WeakMap, + WeakSet, +} = primordials; + +// Because these functions are used by `makeSafe`, which is exposed +// on the `primordials` object, it's important to use const references +// to the primordials that they use: +const createSafeIterator = (factory, next) => { + class SafeIterator { + constructor(iterable) { + this._iterator = factory(iterable); + } + next() { + return next(this._iterator); + } + [SymbolIterator]() { + return this; + } + } + ObjectSetPrototypeOf(SafeIterator.prototype, null); + ObjectFreeze(SafeIterator.prototype); + ObjectFreeze(SafeIterator); + return SafeIterator; +}; + +primordials.SafeArrayIterator = createSafeIterator( + primordials.ArrayPrototypeSymbolIterator, + primordials.ArrayIteratorPrototypeNext +); +primordials.SafeStringIterator = createSafeIterator( + primordials.StringPrototypeSymbolIterator, + primordials.StringIteratorPrototypeNext +); + +const copyProps = (src, dest) => { + ArrayPrototypeForEach(ReflectOwnKeys(src), (key) => { + if (!ReflectGetOwnPropertyDescriptor(dest, key)) { + ReflectDefineProperty( + dest, + key, + ReflectGetOwnPropertyDescriptor(src, key)); + } + }); +}; + +const makeSafe = (unsafe, safe) => { + if (SymbolIterator in unsafe.prototype) { + const dummy = new unsafe(); + let next; // We can reuse the same `next` method. + + ArrayPrototypeForEach(ReflectOwnKeys(unsafe.prototype), (key) => { + if (!ReflectGetOwnPropertyDescriptor(safe.prototype, key)) { + const desc = ReflectGetOwnPropertyDescriptor(unsafe.prototype, key); + if ( + typeof desc.value === 'function' && + desc.value.length === 0 && + SymbolIterator in (FunctionPrototypeCall(desc.value, dummy) ?? {}) + ) { + const createIterator = uncurryThis(desc.value); + next = next ?? uncurryThis(createIterator(dummy).next); + const SafeIterator = createSafeIterator(createIterator, next); + desc.value = function() { + return new SafeIterator(this); + }; + } + ReflectDefineProperty(safe.prototype, key, desc); + } + }); + } else { + copyProps(unsafe.prototype, safe.prototype); + } + copyProps(unsafe, safe); + + ObjectSetPrototypeOf(safe.prototype, null); + ObjectFreeze(safe.prototype); + ObjectFreeze(safe); + return safe; +}; +primordials.makeSafe = makeSafe; + +// Subclass the constructors because we need to use their prototype +// methods later. +// Defining the `constructor` is necessary here to avoid the default +// constructor which uses the user-mutable `%ArrayIteratorPrototype%.next`. +primordials.SafeMap = makeSafe( + Map, + class SafeMap extends Map { + constructor(i) { super(i); } // eslint-disable-line no-useless-constructor + } +); +primordials.SafeWeakMap = makeSafe( + WeakMap, + class SafeWeakMap extends WeakMap { + constructor(i) { super(i); } // eslint-disable-line no-useless-constructor + } +); +primordials.SafeSet = makeSafe( + Set, + class SafeSet extends Set { + constructor(i) { super(i); } // eslint-disable-line no-useless-constructor + } +); +primordials.SafeWeakSet = makeSafe( + WeakSet, + class SafeWeakSet extends WeakSet { + constructor(i) { super(i); } // eslint-disable-line no-useless-constructor + } +); + +ObjectSetPrototypeOf(primordials, null); +ObjectFreeze(primordials); + +module.exports = primordials; diff --git a/node_modules/@pkgjs/parseargs/internal/util.js b/node_modules/@pkgjs/parseargs/internal/util.js new file mode 100644 index 0000000..b9b8fe5 --- /dev/null +++ b/node_modules/@pkgjs/parseargs/internal/util.js @@ -0,0 +1,14 @@ +'use strict'; + +// This is a placeholder for util.js in node.js land. + +const { + ObjectCreate, + ObjectFreeze, +} = require('./primordials'); + +const kEmptyObject = ObjectFreeze(ObjectCreate(null)); + +module.exports = { + kEmptyObject, +}; diff --git a/node_modules/@pkgjs/parseargs/internal/validators.js b/node_modules/@pkgjs/parseargs/internal/validators.js new file mode 100644 index 0000000..b5ac4fb --- /dev/null +++ b/node_modules/@pkgjs/parseargs/internal/validators.js @@ -0,0 +1,89 @@ +'use strict'; + +// This file is a proxy of the original file located at: +// https://github.com/nodejs/node/blob/main/lib/internal/validators.js +// Every addition or modification to this file must be evaluated +// during the PR review. + +const { + ArrayIsArray, + ArrayPrototypeIncludes, + ArrayPrototypeJoin, +} = require('./primordials'); + +const { + codes: { + ERR_INVALID_ARG_TYPE + } +} = require('./errors'); + +function validateString(value, name) { + if (typeof value !== 'string') { + throw new ERR_INVALID_ARG_TYPE(name, 'String', value); + } +} + +function validateUnion(value, name, union) { + if (!ArrayPrototypeIncludes(union, value)) { + throw new ERR_INVALID_ARG_TYPE(name, `('${ArrayPrototypeJoin(union, '|')}')`, value); + } +} + +function validateBoolean(value, name) { + if (typeof value !== 'boolean') { + throw new ERR_INVALID_ARG_TYPE(name, 'Boolean', value); + } +} + +function validateArray(value, name) { + if (!ArrayIsArray(value)) { + throw new ERR_INVALID_ARG_TYPE(name, 'Array', value); + } +} + +function validateStringArray(value, name) { + validateArray(value, name); + for (let i = 0; i < value.length; i++) { + validateString(value[i], `${name}[${i}]`); + } +} + +function validateBooleanArray(value, name) { + validateArray(value, name); + for (let i = 0; i < value.length; i++) { + validateBoolean(value[i], `${name}[${i}]`); + } +} + +/** + * @param {unknown} value + * @param {string} name + * @param {{ + * allowArray?: boolean, + * allowFunction?: boolean, + * nullable?: boolean + * }} [options] + */ +function validateObject(value, name, options) { + const useDefaultOptions = options == null; + const allowArray = useDefaultOptions ? false : options.allowArray; + const allowFunction = useDefaultOptions ? false : options.allowFunction; + const nullable = useDefaultOptions ? false : options.nullable; + if ((!nullable && value === null) || + (!allowArray && ArrayIsArray(value)) || + (typeof value !== 'object' && ( + !allowFunction || typeof value !== 'function' + ))) { + throw new ERR_INVALID_ARG_TYPE(name, 'Object', value); + } +} + +module.exports = { + validateArray, + validateObject, + validateString, + validateStringArray, + validateUnion, + validateBoolean, + validateBooleanArray, +}; diff --git a/node_modules/@pkgjs/parseargs/package.json b/node_modules/@pkgjs/parseargs/package.json new file mode 100644 index 0000000..0bcc05c --- /dev/null +++ b/node_modules/@pkgjs/parseargs/package.json @@ -0,0 +1,36 @@ +{ + "name": "@pkgjs/parseargs", + "version": "0.11.0", + "description": "Polyfill of future proposal for `util.parseArgs()`", + "engines": { + "node": ">=14" + }, + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "scripts": { + "coverage": "c8 --check-coverage tape 'test/*.js'", + "test": "c8 tape 'test/*.js'", + "posttest": "eslint .", + "fix": "npm run posttest -- --fix" + }, + "repository": { + "type": "git", + "url": "git@github.com:pkgjs/parseargs.git" + }, + "keywords": [], + "author": "", + "license": "MIT", + "bugs": { + "url": "https://github.com/pkgjs/parseargs/issues" + }, + "homepage": "https://github.com/pkgjs/parseargs#readme", + "devDependencies": { + "c8": "^7.10.0", + "eslint": "^8.2.0", + "eslint-plugin-node-core": "iansu/eslint-plugin-node-core", + "tape": "^5.2.2" + } +} diff --git a/node_modules/@pkgjs/parseargs/utils.js b/node_modules/@pkgjs/parseargs/utils.js new file mode 100644 index 0000000..d7f420a --- /dev/null +++ b/node_modules/@pkgjs/parseargs/utils.js @@ -0,0 +1,198 @@ +'use strict'; + +const { + ArrayPrototypeFind, + ObjectEntries, + ObjectPrototypeHasOwnProperty: ObjectHasOwn, + StringPrototypeCharAt, + StringPrototypeIncludes, + StringPrototypeStartsWith, +} = require('./internal/primordials'); + +const { + validateObject, +} = require('./internal/validators'); + +// These are internal utilities to make the parsing logic easier to read, and +// add lots of detail for the curious. They are in a separate file to allow +// unit testing, although that is not essential (this could be rolled into +// main file and just tested implicitly via API). +// +// These routines are for internal use, not for export to client. + +/** + * Return the named property, but only if it is an own property. + */ +function objectGetOwn(obj, prop) { + if (ObjectHasOwn(obj, prop)) + return obj[prop]; +} + +/** + * Return the named options property, but only if it is an own property. + */ +function optionsGetOwn(options, longOption, prop) { + if (ObjectHasOwn(options, longOption)) + return objectGetOwn(options[longOption], prop); +} + +/** + * Determines if the argument may be used as an option value. + * @example + * isOptionValue('V') // returns true + * isOptionValue('-v') // returns true (greedy) + * isOptionValue('--foo') // returns true (greedy) + * isOptionValue(undefined) // returns false + */ +function isOptionValue(value) { + if (value == null) return false; + + // Open Group Utility Conventions are that an option-argument + // is the argument after the option, and may start with a dash. + return true; // greedy! +} + +/** + * Detect whether there is possible confusion and user may have omitted + * the option argument, like `--port --verbose` when `port` of type:string. + * In strict mode we throw errors if value is option-like. + */ +function isOptionLikeValue(value) { + if (value == null) return false; + + return value.length > 1 && StringPrototypeCharAt(value, 0) === '-'; +} + +/** + * Determines if `arg` is just a short option. + * @example '-f' + */ +function isLoneShortOption(arg) { + return arg.length === 2 && + StringPrototypeCharAt(arg, 0) === '-' && + StringPrototypeCharAt(arg, 1) !== '-'; +} + +/** + * Determines if `arg` is a lone long option. + * @example + * isLoneLongOption('a') // returns false + * isLoneLongOption('-a') // returns false + * isLoneLongOption('--foo') // returns true + * isLoneLongOption('--foo=bar') // returns false + */ +function isLoneLongOption(arg) { + return arg.length > 2 && + StringPrototypeStartsWith(arg, '--') && + !StringPrototypeIncludes(arg, '=', 3); +} + +/** + * Determines if `arg` is a long option and value in the same argument. + * @example + * isLongOptionAndValue('--foo') // returns false + * isLongOptionAndValue('--foo=bar') // returns true + */ +function isLongOptionAndValue(arg) { + return arg.length > 2 && + StringPrototypeStartsWith(arg, '--') && + StringPrototypeIncludes(arg, '=', 3); +} + +/** + * Determines if `arg` is a short option group. + * + * See Guideline 5 of the [Open Group Utility Conventions](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html). + * One or more options without option-arguments, followed by at most one + * option that takes an option-argument, should be accepted when grouped + * behind one '-' delimiter. + * @example + * isShortOptionGroup('-a', {}) // returns false + * isShortOptionGroup('-ab', {}) // returns true + * // -fb is an option and a value, not a short option group + * isShortOptionGroup('-fb', { + * options: { f: { type: 'string' } } + * }) // returns false + * isShortOptionGroup('-bf', { + * options: { f: { type: 'string' } } + * }) // returns true + * // -bfb is an edge case, return true and caller sorts it out + * isShortOptionGroup('-bfb', { + * options: { f: { type: 'string' } } + * }) // returns true + */ +function isShortOptionGroup(arg, options) { + if (arg.length <= 2) return false; + if (StringPrototypeCharAt(arg, 0) !== '-') return false; + if (StringPrototypeCharAt(arg, 1) === '-') return false; + + const firstShort = StringPrototypeCharAt(arg, 1); + const longOption = findLongOptionForShort(firstShort, options); + return optionsGetOwn(options, longOption, 'type') !== 'string'; +} + +/** + * Determine if arg is a short string option followed by its value. + * @example + * isShortOptionAndValue('-a', {}); // returns false + * isShortOptionAndValue('-ab', {}); // returns false + * isShortOptionAndValue('-fFILE', { + * options: { foo: { short: 'f', type: 'string' }} + * }) // returns true + */ +function isShortOptionAndValue(arg, options) { + validateObject(options, 'options'); + + if (arg.length <= 2) return false; + if (StringPrototypeCharAt(arg, 0) !== '-') return false; + if (StringPrototypeCharAt(arg, 1) === '-') return false; + + const shortOption = StringPrototypeCharAt(arg, 1); + const longOption = findLongOptionForShort(shortOption, options); + return optionsGetOwn(options, longOption, 'type') === 'string'; +} + +/** + * Find the long option associated with a short option. Looks for a configured + * `short` and returns the short option itself if a long option is not found. + * @example + * findLongOptionForShort('a', {}) // returns 'a' + * findLongOptionForShort('b', { + * options: { bar: { short: 'b' } } + * }) // returns 'bar' + */ +function findLongOptionForShort(shortOption, options) { + validateObject(options, 'options'); + const longOptionEntry = ArrayPrototypeFind( + ObjectEntries(options), + ({ 1: optionConfig }) => objectGetOwn(optionConfig, 'short') === shortOption + ); + return longOptionEntry?.[0] ?? shortOption; +} + +/** + * Check if the given option includes a default value + * and that option has not been set by the input args. + * + * @param {string} longOption - long option name e.g. 'foo' + * @param {object} optionConfig - the option configuration properties + * @param {object} values - option values returned in `values` by parseArgs + */ +function useDefaultValueOption(longOption, optionConfig, values) { + return objectGetOwn(optionConfig, 'default') !== undefined && + values[longOption] === undefined; +} + +module.exports = { + findLongOptionForShort, + isLoneLongOption, + isLoneShortOption, + isLongOptionAndValue, + isOptionValue, + isOptionLikeValue, + isShortOptionAndValue, + isShortOptionGroup, + useDefaultValueOption, + objectGetOwn, + optionsGetOwn, +}; diff --git a/node_modules/agent-base/LICENSE b/node_modules/agent-base/LICENSE new file mode 100644 index 0000000..008728c --- /dev/null +++ b/node_modules/agent-base/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2013 Nathan Rajlich + +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: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +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. \ No newline at end of file diff --git a/node_modules/agent-base/README.md b/node_modules/agent-base/README.md new file mode 100644 index 0000000..b8a86b9 --- /dev/null +++ b/node_modules/agent-base/README.md @@ -0,0 +1,69 @@ +agent-base +========== +### Turn a function into an [`http.Agent`][http.Agent] instance + +This module is a thin wrapper around the base `http.Agent` class. + +It provides an abstract class that must define a `connect()` function, +which is responsible for creating the underlying socket that the HTTP +client requests will use. + +The `connect()` function may return an arbitrary `Duplex` stream, or +another `http.Agent` instance to delegate the request to, and may be +asynchronous (by defining an `async` function). + +Instances of this agent can be used with the `http` and `https` +modules. To differentiate, the options parameter in the `connect()` +function includes a `secureEndpoint` property, which can be checked +to determine what type of socket should be returned. + +#### Some subclasses: + +Here are some more interesting uses of `agent-base`. +Send a pull request to list yours! + + * [`http-proxy-agent`][http-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTP endpoints + * [`https-proxy-agent`][https-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTPS endpoints + * [`pac-proxy-agent`][pac-proxy-agent]: A PAC file proxy `http.Agent` implementation for HTTP and HTTPS + * [`socks-proxy-agent`][socks-proxy-agent]: A SOCKS proxy `http.Agent` implementation for HTTP and HTTPS + +Example +------- + +Here's a minimal example that creates a new `net.Socket` or `tls.Socket` +based on the `secureEndpoint` property. This agent can be used with both +the `http` and `https` modules. + +```ts +import * as net from 'net'; +import * as tls from 'tls'; +import * as http from 'http'; +import { Agent } from 'agent-base'; + +class MyAgent extends Agent { + connect(req, opts) { + // `secureEndpoint` is true when using the "https" module + if (opts.secureEndpoint) { + return tls.connect(opts); + } else { + return net.connect(opts); + } + } +}); + +// Keep alive enabled means that `connect()` will only be +// invoked when a new connection needs to be created +const agent = new MyAgent({ keepAlive: true }); + +// Pass the `agent` option when creating the HTTP request +http.get('http://nodejs.org/api/', { agent }, (res) => { + console.log('"response" event!', res.headers); + res.pipe(process.stdout); +}); +``` + +[http-proxy-agent]: ../http-proxy-agent +[https-proxy-agent]: ../https-proxy-agent +[pac-proxy-agent]: ../pac-proxy-agent +[socks-proxy-agent]: ../socks-proxy-agent +[http.Agent]: https://nodejs.org/api/http.html#http_class_http_agent diff --git a/node_modules/agent-base/dist/helpers.d.ts b/node_modules/agent-base/dist/helpers.d.ts new file mode 100644 index 0000000..b468f23 --- /dev/null +++ b/node_modules/agent-base/dist/helpers.d.ts @@ -0,0 +1,15 @@ +/// +/// +/// +/// +/// +import * as http from 'http'; +import * as https from 'https'; +import type { Readable } from 'stream'; +export type ThenableRequest = http.ClientRequest & { + then: Promise['then']; +}; +export declare function toBuffer(stream: Readable): Promise; +export declare function json(stream: Readable): Promise; +export declare function req(url: string | URL, opts?: https.RequestOptions): ThenableRequest; +//# sourceMappingURL=helpers.d.ts.map \ No newline at end of file diff --git a/node_modules/agent-base/dist/helpers.d.ts.map b/node_modules/agent-base/dist/helpers.d.ts.map new file mode 100644 index 0000000..9479c9a --- /dev/null +++ b/node_modules/agent-base/dist/helpers.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAEvC,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,aAAa,GAAG;IAClD,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;CAC5C,CAAC;AAEF,wBAAsB,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAQhE;AAGD,wBAAsB,IAAI,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAUzD;AAED,wBAAgB,GAAG,CAClB,GAAG,EAAE,MAAM,GAAG,GAAG,EACjB,IAAI,GAAE,KAAK,CAAC,cAAmB,GAC7B,eAAe,CAcjB"} \ No newline at end of file diff --git a/node_modules/agent-base/dist/helpers.js b/node_modules/agent-base/dist/helpers.js new file mode 100644 index 0000000..ef3f920 --- /dev/null +++ b/node_modules/agent-base/dist/helpers.js @@ -0,0 +1,66 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.req = exports.json = exports.toBuffer = void 0; +const http = __importStar(require("http")); +const https = __importStar(require("https")); +async function toBuffer(stream) { + let length = 0; + const chunks = []; + for await (const chunk of stream) { + length += chunk.length; + chunks.push(chunk); + } + return Buffer.concat(chunks, length); +} +exports.toBuffer = toBuffer; +// eslint-disable-next-line @typescript-eslint/no-explicit-any +async function json(stream) { + const buf = await toBuffer(stream); + const str = buf.toString('utf8'); + try { + return JSON.parse(str); + } + catch (_err) { + const err = _err; + err.message += ` (input: ${str})`; + throw err; + } +} +exports.json = json; +function req(url, opts = {}) { + const href = typeof url === 'string' ? url : url.href; + const req = (href.startsWith('https:') ? https : http).request(url, opts); + const promise = new Promise((resolve, reject) => { + req + .once('response', resolve) + .once('error', reject) + .end(); + }); + req.then = promise.then.bind(promise); + return req; +} +exports.req = req; +//# sourceMappingURL=helpers.js.map \ No newline at end of file diff --git a/node_modules/agent-base/dist/helpers.js.map b/node_modules/agent-base/dist/helpers.js.map new file mode 100644 index 0000000..19df537 --- /dev/null +++ b/node_modules/agent-base/dist/helpers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,6CAA+B;AAOxB,KAAK,UAAU,QAAQ,CAAC,MAAgB;IAC9C,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE;QACjC,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC;QACvB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACnB;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACtC,CAAC;AARD,4BAQC;AAED,8DAA8D;AACvD,KAAK,UAAU,IAAI,CAAC,MAAgB;IAC1C,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,CAAC;IACnC,MAAM,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjC,IAAI;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;KACvB;IAAC,OAAO,IAAa,EAAE;QACvB,MAAM,GAAG,GAAG,IAAa,CAAC;QAC1B,GAAG,CAAC,OAAO,IAAI,YAAY,GAAG,GAAG,CAAC;QAClC,MAAM,GAAG,CAAC;KACV;AACF,CAAC;AAVD,oBAUC;AAED,SAAgB,GAAG,CAClB,GAAiB,EACjB,OAA6B,EAAE;IAE/B,MAAM,IAAI,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;IACtD,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAC7D,GAAG,EACH,IAAI,CACe,CAAC;IACrB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrE,GAAG;aACD,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC;aACzB,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC;aACrB,GAAG,EAAqB,CAAC;IAC5B,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtC,OAAO,GAAG,CAAC;AACZ,CAAC;AAjBD,kBAiBC"} \ No newline at end of file diff --git a/node_modules/agent-base/dist/index.d.ts b/node_modules/agent-base/dist/index.d.ts new file mode 100644 index 0000000..3660ea7 --- /dev/null +++ b/node_modules/agent-base/dist/index.d.ts @@ -0,0 +1,41 @@ +/// +/// +/// +/// +import * as net from 'net'; +import * as tls from 'tls'; +import * as http from 'http'; +import type { Duplex } from 'stream'; +export * from './helpers'; +interface HttpConnectOpts extends net.TcpNetConnectOpts { + secureEndpoint: false; + protocol?: string; +} +interface HttpsConnectOpts extends tls.ConnectionOptions { + secureEndpoint: true; + protocol?: string; + port: number; +} +export type AgentConnectOpts = HttpConnectOpts | HttpsConnectOpts; +declare const INTERNAL: unique symbol; +export declare abstract class Agent extends http.Agent { + private [INTERNAL]; + options: Partial; + keepAlive: boolean; + constructor(opts?: http.AgentOptions); + abstract connect(req: http.ClientRequest, options: AgentConnectOpts): Promise | Duplex | http.Agent; + /** + * Determine whether this is an `http` or `https` request. + */ + isSecureEndpoint(options?: AgentConnectOpts): boolean; + private incrementSockets; + private decrementSockets; + getName(options?: AgentConnectOpts): string; + createSocket(req: http.ClientRequest, options: AgentConnectOpts, cb: (err: Error | null, s?: Duplex) => void): void; + createConnection(): Duplex; + get defaultPort(): number; + set defaultPort(v: number); + get protocol(): string; + set protocol(v: string); +} +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/agent-base/dist/index.d.ts.map b/node_modules/agent-base/dist/index.d.ts.map new file mode 100644 index 0000000..c0f91ab --- /dev/null +++ b/node_modules/agent-base/dist/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,cAAc,WAAW,CAAC;AAE1B,UAAU,eAAgB,SAAQ,GAAG,CAAC,iBAAiB;IACtD,cAAc,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,gBAAiB,SAAQ,GAAG,CAAC,iBAAiB;IACvD,cAAc,EAAE,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,gBAAgB,GAAG,eAAe,GAAG,gBAAgB,CAAC;AAElE,QAAA,MAAM,QAAQ,eAAmC,CAAC;AAQlD,8BAAsB,KAAM,SAAQ,IAAI,CAAC,KAAK;IAC7C,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAgB;IAGlC,OAAO,EAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,GAAG,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACjE,SAAS,EAAG,OAAO,CAAC;gBAER,IAAI,CAAC,EAAE,IAAI,CAAC,YAAY;IAKpC,QAAQ,CAAC,OAAO,CACf,GAAG,EAAE,IAAI,CAAC,aAAa,EACvB,OAAO,EAAE,gBAAgB,GACvB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC,KAAK;IAErD;;OAEG;IACH,gBAAgB,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO;IAqCrD,OAAO,CAAC,gBAAgB;IAqBxB,OAAO,CAAC,gBAAgB;IAmBxB,OAAO,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,MAAM;IAU3C,YAAY,CACX,GAAG,EAAE,IAAI,CAAC,aAAa,EACvB,OAAO,EAAE,gBAAgB,EACzB,EAAE,EAAE,CAAC,GAAG,EAAE,KAAK,GAAG,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI;IAgC5C,gBAAgB,IAAI,MAAM;IAW1B,IAAI,WAAW,IAAI,MAAM,CAKxB;IAED,IAAI,WAAW,CAAC,CAAC,EAAE,MAAM,EAIxB;IAED,IAAI,QAAQ,IAAI,MAAM,CAKrB;IAED,IAAI,QAAQ,CAAC,CAAC,EAAE,MAAM,EAIrB;CACD"} \ No newline at end of file diff --git a/node_modules/agent-base/dist/index.js b/node_modules/agent-base/dist/index.js new file mode 100644 index 0000000..57ac852 --- /dev/null +++ b/node_modules/agent-base/dist/index.js @@ -0,0 +1,178 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Agent = void 0; +const net = __importStar(require("net")); +const http = __importStar(require("http")); +const https_1 = require("https"); +__exportStar(require("./helpers"), exports); +const INTERNAL = Symbol('AgentBaseInternalState'); +class Agent extends http.Agent { + constructor(opts) { + super(opts); + this[INTERNAL] = {}; + } + /** + * Determine whether this is an `http` or `https` request. + */ + isSecureEndpoint(options) { + if (options) { + // First check the `secureEndpoint` property explicitly, since this + // means that a parent `Agent` is "passing through" to this instance. + // eslint-disable-next-line @typescript-eslint/no-explicit-any + if (typeof options.secureEndpoint === 'boolean') { + return options.secureEndpoint; + } + // If no explicit `secure` endpoint, check if `protocol` property is + // set. This will usually be the case since using a full string URL + // or `URL` instance should be the most common usage. + if (typeof options.protocol === 'string') { + return options.protocol === 'https:'; + } + } + // Finally, if no `protocol` property was set, then fall back to + // checking the stack trace of the current call stack, and try to + // detect the "https" module. + const { stack } = new Error(); + if (typeof stack !== 'string') + return false; + return stack + .split('\n') + .some((l) => l.indexOf('(https.js:') !== -1 || + l.indexOf('node:https:') !== -1); + } + // In order to support async signatures in `connect()` and Node's native + // connection pooling in `http.Agent`, the array of sockets for each origin + // has to be updated synchronously. This is so the length of the array is + // accurate when `addRequest()` is next called. We achieve this by creating a + // fake socket and adding it to `sockets[origin]` and incrementing + // `totalSocketCount`. + incrementSockets(name) { + // If `maxSockets` and `maxTotalSockets` are both Infinity then there is no + // need to create a fake socket because Node.js native connection pooling + // will never be invoked. + if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) { + return null; + } + // All instances of `sockets` are expected TypeScript errors. The + // alternative is to add it as a private property of this class but that + // will break TypeScript subclassing. + if (!this.sockets[name]) { + // @ts-expect-error `sockets` is readonly in `@types/node` + this.sockets[name] = []; + } + const fakeSocket = new net.Socket({ writable: false }); + this.sockets[name].push(fakeSocket); + // @ts-expect-error `totalSocketCount` isn't defined in `@types/node` + this.totalSocketCount++; + return fakeSocket; + } + decrementSockets(name, socket) { + if (!this.sockets[name] || socket === null) { + return; + } + const sockets = this.sockets[name]; + const index = sockets.indexOf(socket); + if (index !== -1) { + sockets.splice(index, 1); + // @ts-expect-error `totalSocketCount` isn't defined in `@types/node` + this.totalSocketCount--; + if (sockets.length === 0) { + // @ts-expect-error `sockets` is readonly in `@types/node` + delete this.sockets[name]; + } + } + } + // In order to properly update the socket pool, we need to call `getName()` on + // the core `https.Agent` if it is a secureEndpoint. + getName(options) { + const secureEndpoint = this.isSecureEndpoint(options); + if (secureEndpoint) { + // @ts-expect-error `getName()` isn't defined in `@types/node` + return https_1.Agent.prototype.getName.call(this, options); + } + // @ts-expect-error `getName()` isn't defined in `@types/node` + return super.getName(options); + } + createSocket(req, options, cb) { + const connectOpts = { + ...options, + secureEndpoint: this.isSecureEndpoint(options), + }; + const name = this.getName(connectOpts); + const fakeSocket = this.incrementSockets(name); + Promise.resolve() + .then(() => this.connect(req, connectOpts)) + .then((socket) => { + this.decrementSockets(name, fakeSocket); + if (socket instanceof http.Agent) { + try { + // @ts-expect-error `addRequest()` isn't defined in `@types/node` + return socket.addRequest(req, connectOpts); + } + catch (err) { + return cb(err); + } + } + this[INTERNAL].currentSocket = socket; + // @ts-expect-error `createSocket()` isn't defined in `@types/node` + super.createSocket(req, options, cb); + }, (err) => { + this.decrementSockets(name, fakeSocket); + cb(err); + }); + } + createConnection() { + const socket = this[INTERNAL].currentSocket; + this[INTERNAL].currentSocket = undefined; + if (!socket) { + throw new Error('No socket was returned in the `connect()` function'); + } + return socket; + } + get defaultPort() { + return (this[INTERNAL].defaultPort ?? + (this.protocol === 'https:' ? 443 : 80)); + } + set defaultPort(v) { + if (this[INTERNAL]) { + this[INTERNAL].defaultPort = v; + } + } + get protocol() { + return (this[INTERNAL].protocol ?? + (this.isSecureEndpoint() ? 'https:' : 'http:')); + } + set protocol(v) { + if (this[INTERNAL]) { + this[INTERNAL].protocol = v; + } + } +} +exports.Agent = Agent; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/agent-base/dist/index.js.map b/node_modules/agent-base/dist/index.js.map new file mode 100644 index 0000000..5a0d2ad --- /dev/null +++ b/node_modules/agent-base/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAE3B,2CAA6B;AAC7B,iCAA4C;AAG5C,4CAA0B;AAe1B,MAAM,QAAQ,GAAG,MAAM,CAAC,wBAAwB,CAAC,CAAC;AAQlD,MAAsB,KAAM,SAAQ,IAAI,CAAC,KAAK;IAO7C,YAAY,IAAwB;QACnC,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;IACrB,CAAC;IAOD;;OAEG;IACH,gBAAgB,CAAC,OAA0B;QAC1C,IAAI,OAAO,EAAE;YACZ,mEAAmE;YACnE,qEAAqE;YACrE,8DAA8D;YAC9D,IAAI,OAAQ,OAAe,CAAC,cAAc,KAAK,SAAS,EAAE;gBACzD,OAAO,OAAO,CAAC,cAAc,CAAC;aAC9B;YAED,oEAAoE;YACpE,mEAAmE;YACnE,qDAAqD;YACrD,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE;gBACzC,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC;aACrC;SACD;QAED,gEAAgE;Q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;IAED,IAAI,QAAQ;QACX,OAAO,CACN,IAAI,CAAC,QAAQ,CAAC,CAAC,QAAQ;YACvB,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAC9C,CAAC;IACH,CAAC;IAED,IAAI,QAAQ,CAAC,CAAS;QACrB,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE;YACnB,IAAI,CAAC,QAAQ,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC;SAC5B;IACF,CAAC;CACD;AAlLD,sBAkLC"} \ No newline at end of file diff --git a/node_modules/agent-base/package.json b/node_modules/agent-base/package.json new file mode 100644 index 0000000..1b4964a --- /dev/null +++ b/node_modules/agent-base/package.json @@ -0,0 +1,46 @@ +{ + "name": "agent-base", + "version": "7.1.4", + "description": "Turn a function into an `http.Agent` instance", + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "files": [ + "dist" + ], + "repository": { + "type": "git", + "url": "https://github.com/TooTallNate/proxy-agents.git", + "directory": "packages/agent-base" + }, + "keywords": [ + "http", + "agent", + "base", + "barebones", + "https" + ], + "author": "Nathan Rajlich (http://n8.io/)", + "license": "MIT", + "devDependencies": { + "@types/debug": "^4.1.7", + "@types/jest": "^29.5.1", + "@types/node": "^14.18.45", + "@types/semver": "^7.3.13", + "@types/ws": "^6.0.4", + "async-listen": "^3.0.0", + "jest": "^29.5.0", + "ts-jest": "^29.1.0", + "typescript": "^5.0.4", + "ws": "^5.2.4", + "tsconfig": "0.0.0" + }, + "engines": { + "node": ">= 14" + }, + "scripts": { + "build": "tsc", + "test": "jest --env node --verbose --bail", + "lint": "eslint . --ext .ts", + "pack": "node ../../scripts/pack.mjs" + } +} \ No newline at end of file diff --git a/node_modules/ansi-regex/index.d.ts b/node_modules/ansi-regex/index.d.ts new file mode 100644 index 0000000..7d562e9 --- /dev/null +++ b/node_modules/ansi-regex/index.d.ts @@ -0,0 +1,33 @@ +export type Options = { + /** + Match only the first ANSI escape. + + @default false + */ + readonly onlyFirst: boolean; +}; + +/** +Regular expression for matching ANSI escape codes. + +@example +``` +import ansiRegex from 'ansi-regex'; + +ansiRegex().test('\u001B[4mcake\u001B[0m'); +//=> true + +ansiRegex().test('cake'); +//=> false + +'\u001B[4mcake\u001B[0m'.match(ansiRegex()); +//=> ['\u001B[4m', '\u001B[0m'] + +'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); +//=> ['\u001B[4m'] + +'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); +//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] +``` +*/ +export default function ansiRegex(options?: Options): RegExp; diff --git a/node_modules/ansi-regex/index.js b/node_modules/ansi-regex/index.js new file mode 100644 index 0000000..2cc5ca2 --- /dev/null +++ b/node_modules/ansi-regex/index.js @@ -0,0 +1,14 @@ +export default function ansiRegex({onlyFirst = false} = {}) { + // Valid string terminator sequences are BEL, ESC\, and 0x9c + const ST = '(?:\\u0007|\\u001B\\u005C|\\u009C)'; + + // OSC sequences only: ESC ] ... ST (non-greedy until the first ST) + const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`; + + // CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :) then final byte + const csi = '[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]'; + + const pattern = `${osc}|${csi}`; + + return new RegExp(pattern, onlyFirst ? undefined : 'g'); +} diff --git a/node_modules/ansi-regex/license b/node_modules/ansi-regex/license new file mode 100644 index 0000000..fa7ceba --- /dev/null +++ b/node_modules/ansi-regex/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +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: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +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. diff --git a/node_modules/ansi-regex/package.json b/node_modules/ansi-regex/package.json new file mode 100644 index 0000000..2efe9eb --- /dev/null +++ b/node_modules/ansi-regex/package.json @@ -0,0 +1,61 @@ +{ + "name": "ansi-regex", + "version": "6.2.2", + "description": "Regular expression for matching ANSI escape codes", + "license": "MIT", + "repository": "chalk/ansi-regex", + "funding": "https://github.com/chalk/ansi-regex?sponsor=1", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "types": "./index.d.ts", + "sideEffects": false, + "engines": { + "node": ">=12" + }, + "scripts": { + "test": "xo && ava && tsd", + "view-supported": "node fixtures/view-codes.js" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "text", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "pattern" + ], + "devDependencies": { + "ansi-escapes": "^5.0.0", + "ava": "^3.15.0", + "tsd": "^0.21.0", + "xo": "^0.54.2" + } +} diff --git a/node_modules/ansi-regex/readme.md b/node_modules/ansi-regex/readme.md new file mode 100644 index 0000000..4d3c415 --- /dev/null +++ b/node_modules/ansi-regex/readme.md @@ -0,0 +1,66 @@ +# ansi-regex + +> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) + +## Install + +```sh +npm install ansi-regex +``` + +## Usage + +```js +import ansiRegex from 'ansi-regex'; + +ansiRegex().test('\u001B[4mcake\u001B[0m'); +//=> true + +ansiRegex().test('cake'); +//=> false + +'\u001B[4mcake\u001B[0m'.match(ansiRegex()); +//=> ['\u001B[4m', '\u001B[0m'] + +'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); +//=> ['\u001B[4m'] + +'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); +//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] +``` + +## API + +### ansiRegex(options?) + +Returns a regex for matching ANSI escape codes. + +#### options + +Type: `object` + +##### onlyFirst + +Type: `boolean`\ +Default: `false` *(Matches any ANSI escape codes in a string)* + +Match only the first ANSI escape. + +## Important + +If you run the regex against untrusted user input in a server context, you should [give it a timeout](https://github.com/sindresorhus/super-regex). + +**I do not consider [ReDoS](https://blog.yossarian.net/2022/12/28/ReDoS-vulnerabilities-and-misaligned-incentives) a valid vulnerability for this package.** + +## FAQ + +### Why do you test for codes not in the ECMA 48 standard? + +Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them. + +On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out. + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) diff --git a/node_modules/ansi-styles/index.d.ts b/node_modules/ansi-styles/index.d.ts new file mode 100644 index 0000000..ee8bc27 --- /dev/null +++ b/node_modules/ansi-styles/index.d.ts @@ -0,0 +1,236 @@ +export type CSPair = { // eslint-disable-line @typescript-eslint/naming-convention + /** + The ANSI terminal control sequence for starting this style. + */ + readonly open: string; + + /** + The ANSI terminal control sequence for ending this style. + */ + readonly close: string; +}; + +export type ColorBase = { + /** + The ANSI terminal control sequence for ending this color. + */ + readonly close: string; + + ansi(code: number): string; + + ansi256(code: number): string; + + ansi16m(red: number, green: number, blue: number): string; +}; + +export type Modifier = { + /** + Resets the current color chain. + */ + readonly reset: CSPair; + + /** + Make text bold. + */ + readonly bold: CSPair; + + /** + Emitting only a small amount of light. + */ + readonly dim: CSPair; + + /** + Make text italic. (Not widely supported) + */ + readonly italic: CSPair; + + /** + Make text underline. (Not widely supported) + */ + readonly underline: CSPair; + + /** + Make text overline. + + Supported on VTE-based terminals, the GNOME terminal, mintty, and Git Bash. + */ + readonly overline: CSPair; + + /** + Inverse background and foreground colors. + */ + readonly inverse: CSPair; + + /** + Prints the text, but makes it invisible. + */ + readonly hidden: CSPair; + + /** + Puts a horizontal line through the center of the text. (Not widely supported) + */ + readonly strikethrough: CSPair; +}; + +export type ForegroundColor = { + readonly black: CSPair; + readonly red: CSPair; + readonly green: CSPair; + readonly yellow: CSPair; + readonly blue: CSPair; + readonly cyan: CSPair; + readonly magenta: CSPair; + readonly white: CSPair; + + /** + Alias for `blackBright`. + */ + readonly gray: CSPair; + + /** + Alias for `blackBright`. + */ + readonly grey: CSPair; + + readonly blackBright: CSPair; + readonly redBright: CSPair; + readonly greenBright: CSPair; + readonly yellowBright: CSPair; + readonly blueBright: CSPair; + readonly cyanBright: CSPair; + readonly magentaBright: CSPair; + readonly whiteBright: CSPair; +}; + +export type BackgroundColor = { + readonly bgBlack: CSPair; + readonly bgRed: CSPair; + readonly bgGreen: CSPair; + readonly bgYellow: CSPair; + readonly bgBlue: CSPair; + readonly bgCyan: CSPair; + readonly bgMagenta: CSPair; + readonly bgWhite: CSPair; + + /** + Alias for `bgBlackBright`. + */ + readonly bgGray: CSPair; + + /** + Alias for `bgBlackBright`. + */ + readonly bgGrey: CSPair; + + readonly bgBlackBright: CSPair; + readonly bgRedBright: CSPair; + readonly bgGreenBright: CSPair; + readonly bgYellowBright: CSPair; + readonly bgBlueBright: CSPair; + readonly bgCyanBright: CSPair; + readonly bgMagentaBright: CSPair; + readonly bgWhiteBright: CSPair; +}; + +export type ConvertColor = { + /** + Convert from the RGB color space to the ANSI 256 color space. + + @param red - (`0...255`) + @param green - (`0...255`) + @param blue - (`0...255`) + */ + rgbToAnsi256(red: number, green: number, blue: number): number; + + /** + Convert from the RGB HEX color space to the RGB color space. + + @param hex - A hexadecimal string containing RGB data. + */ + hexToRgb(hex: string): [red: number, green: number, blue: number]; + + /** + Convert from the RGB HEX color space to the ANSI 256 color space. + + @param hex - A hexadecimal string containing RGB data. + */ + hexToAnsi256(hex: string): number; + + /** + Convert from the ANSI 256 color space to the ANSI 16 color space. + + @param code - A number representing the ANSI 256 color. + */ + ansi256ToAnsi(code: number): number; + + /** + Convert from the RGB color space to the ANSI 16 color space. + + @param red - (`0...255`) + @param green - (`0...255`) + @param blue - (`0...255`) + */ + rgbToAnsi(red: number, green: number, blue: number): number; + + /** + Convert from the RGB HEX color space to the ANSI 16 color space. + + @param hex - A hexadecimal string containing RGB data. + */ + hexToAnsi(hex: string): number; +}; + +/** +Basic modifier names. +*/ +export type ModifierName = keyof Modifier; + +/** +Basic foreground color names. + +[More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support) +*/ +export type ForegroundColorName = keyof ForegroundColor; + +/** +Basic background color names. + +[More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support) +*/ +export type BackgroundColorName = keyof BackgroundColor; + +/** +Basic color names. The combination of foreground and background color names. + +[More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support) +*/ +export type ColorName = ForegroundColorName | BackgroundColorName; + +/** +Basic modifier names. +*/ +export const modifierNames: readonly ModifierName[]; + +/** +Basic foreground color names. +*/ +export const foregroundColorNames: readonly ForegroundColorName[]; + +/** +Basic background color names. +*/ +export const backgroundColorNames: readonly BackgroundColorName[]; + +/* +Basic color names. The combination of foreground and background color names. +*/ +export const colorNames: readonly ColorName[]; + +declare const ansiStyles: { + readonly modifier: Modifier; + readonly color: ColorBase & ForegroundColor; + readonly bgColor: ColorBase & BackgroundColor; + readonly codes: ReadonlyMap; +} & ForegroundColor & BackgroundColor & Modifier & ConvertColor; + +export default ansiStyles; diff --git a/node_modules/ansi-styles/index.js b/node_modules/ansi-styles/index.js new file mode 100644 index 0000000..eaa7bed --- /dev/null +++ b/node_modules/ansi-styles/index.js @@ -0,0 +1,223 @@ +const ANSI_BACKGROUND_OFFSET = 10; + +const wrapAnsi16 = (offset = 0) => code => `\u001B[${code + offset}m`; + +const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`; + +const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`; + +const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + overline: [53, 55], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29], + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + + // Bright color + blackBright: [90, 39], + gray: [90, 39], // Alias of `blackBright` + grey: [90, 39], // Alias of `blackBright` + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39], + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + + // Bright color + bgBlackBright: [100, 49], + bgGray: [100, 49], // Alias of `bgBlackBright` + bgGrey: [100, 49], // Alias of `bgBlackBright` + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49], + }, +}; + +export const modifierNames = Object.keys(styles.modifier); +export const foregroundColorNames = Object.keys(styles.color); +export const backgroundColorNames = Object.keys(styles.bgColor); +export const colorNames = [...foregroundColorNames, ...backgroundColorNames]; + +function assembleStyles() { + const codes = new Map(); + + for (const [groupName, group] of Object.entries(styles)) { + for (const [styleName, style] of Object.entries(group)) { + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m`, + }; + + group[styleName] = styles[styleName]; + + codes.set(style[0], style[1]); + } + + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false, + }); + } + + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false, + }); + + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; + + styles.color.ansi = wrapAnsi16(); + styles.color.ansi256 = wrapAnsi256(); + styles.color.ansi16m = wrapAnsi16m(); + styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET); + styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET); + styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET); + + // From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js + Object.defineProperties(styles, { + rgbToAnsi256: { + value(red, green, blue) { + // We use the extended greyscale palette here, with the exception of + // black and white. normal palette only has 4 greyscale shades. + if (red === green && green === blue) { + if (red < 8) { + return 16; + } + + if (red > 248) { + return 231; + } + + return Math.round(((red - 8) / 247) * 24) + 232; + } + + return 16 + + (36 * Math.round(red / 255 * 5)) + + (6 * Math.round(green / 255 * 5)) + + Math.round(blue / 255 * 5); + }, + enumerable: false, + }, + hexToRgb: { + value(hex) { + const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16)); + if (!matches) { + return [0, 0, 0]; + } + + let [colorString] = matches; + + if (colorString.length === 3) { + colorString = [...colorString].map(character => character + character).join(''); + } + + const integer = Number.parseInt(colorString, 16); + + return [ + /* eslint-disable no-bitwise */ + (integer >> 16) & 0xFF, + (integer >> 8) & 0xFF, + integer & 0xFF, + /* eslint-enable no-bitwise */ + ]; + }, + enumerable: false, + }, + hexToAnsi256: { + value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)), + enumerable: false, + }, + ansi256ToAnsi: { + value(code) { + if (code < 8) { + return 30 + code; + } + + if (code < 16) { + return 90 + (code - 8); + } + + let red; + let green; + let blue; + + if (code >= 232) { + red = (((code - 232) * 10) + 8) / 255; + green = red; + blue = red; + } else { + code -= 16; + + const remainder = code % 36; + + red = Math.floor(code / 36) / 5; + green = Math.floor(remainder / 6) / 5; + blue = (remainder % 6) / 5; + } + + const value = Math.max(red, green, blue) * 2; + + if (value === 0) { + return 30; + } + + // eslint-disable-next-line no-bitwise + let result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red)); + + if (value === 2) { + result += 60; + } + + return result; + }, + enumerable: false, + }, + rgbToAnsi: { + value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)), + enumerable: false, + }, + hexToAnsi: { + value: hex => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)), + enumerable: false, + }, + }); + + return styles; +} + +const ansiStyles = assembleStyles(); + +export default ansiStyles; diff --git a/node_modules/ansi-styles/license b/node_modules/ansi-styles/license new file mode 100644 index 0000000..fa7ceba --- /dev/null +++ b/node_modules/ansi-styles/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +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: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +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. diff --git a/node_modules/ansi-styles/package.json b/node_modules/ansi-styles/package.json new file mode 100644 index 0000000..16b508f --- /dev/null +++ b/node_modules/ansi-styles/package.json @@ -0,0 +1,54 @@ +{ + "name": "ansi-styles", + "version": "6.2.3", + "description": "ANSI escape codes for styling strings in the terminal", + "license": "MIT", + "repository": "chalk/ansi-styles", + "funding": "https://github.com/chalk/ansi-styles?sponsor=1", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "engines": { + "node": ">=12" + }, + "scripts": { + "test": "xo && ava && tsd", + "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "devDependencies": { + "ava": "^6.1.3", + "svg-term-cli": "^2.1.1", + "tsd": "^0.31.1", + "xo": "^0.58.0" + } +} diff --git a/node_modules/ansi-styles/readme.md b/node_modules/ansi-styles/readme.md new file mode 100644 index 0000000..6d04183 --- /dev/null +++ b/node_modules/ansi-styles/readme.md @@ -0,0 +1,173 @@ +# ansi-styles + +> [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal + +You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings. + +![](screenshot.png) + +## Install + +```sh +npm install ansi-styles +``` + +## Usage + +```js +import styles from 'ansi-styles'; + +console.log(`${styles.green.open}Hello world!${styles.green.close}`); + + +// Color conversion between 256/truecolor +// NOTE: When converting from truecolor to 256 colors, the original color +// may be degraded to fit the new color palette. This means terminals +// that do not support 16 million colors will best-match the +// original color. +console.log(`${styles.color.ansi(styles.rgbToAnsi(199, 20, 250))}Hello World${styles.color.close}`) +console.log(`${styles.color.ansi256(styles.rgbToAnsi256(199, 20, 250))}Hello World${styles.color.close}`) +console.log(`${styles.color.ansi16m(...styles.hexToRgb('#abcdef'))}Hello World${styles.color.close}`) +``` + +## API + +### `open` and `close` + +Each style has an `open` and `close` property. + +### `modifierNames`, `foregroundColorNames`, `backgroundColorNames`, and `colorNames` + +All supported style strings are exposed as an array of strings for convenience. `colorNames` is the combination of `foregroundColorNames` and `backgroundColorNames`. + +This can be useful if you need to validate input: + +```js +import {modifierNames, foregroundColorNames} from 'ansi-styles'; + +console.log(modifierNames.includes('bold')); +//=> true + +console.log(foregroundColorNames.includes('pink')); +//=> false +``` + +## Styles + +### Modifiers + +- `reset` +- `bold` +- `dim` +- `italic` *(Not widely supported)* +- `underline` +- `overline` *Supported on VTE-based terminals, the GNOME terminal, mintty, and Git Bash.* +- `inverse` +- `hidden` +- `strikethrough` *(Not widely supported)* + +### Colors + +- `black` +- `red` +- `green` +- `yellow` +- `blue` +- `magenta` +- `cyan` +- `white` +- `blackBright` (alias: `gray`, `grey`) +- `redBright` +- `greenBright` +- `yellowBright` +- `blueBright` +- `magentaBright` +- `cyanBright` +- `whiteBright` + +### Background colors + +- `bgBlack` +- `bgRed` +- `bgGreen` +- `bgYellow` +- `bgBlue` +- `bgMagenta` +- `bgCyan` +- `bgWhite` +- `bgBlackBright` (alias: `bgGray`, `bgGrey`) +- `bgRedBright` +- `bgGreenBright` +- `bgYellowBright` +- `bgBlueBright` +- `bgMagentaBright` +- `bgCyanBright` +- `bgWhiteBright` + +## Advanced usage + +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. + +- `styles.modifier` +- `styles.color` +- `styles.bgColor` + +###### Example + +```js +import styles from 'ansi-styles'; + +console.log(styles.color.green.open); +``` + +Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `styles.codes`, which returns a `Map` with the open codes as keys and close codes as values. + +###### Example + +```js +import styles from 'ansi-styles'; + +console.log(styles.codes.get(36)); +//=> 39 +``` + +## 16 / 256 / 16 million (TrueColor) support + +`ansi-styles` allows converting between various color formats and ANSI escapes, with support for 16, 256 and [16 million colors](https://gist.github.com/XVilka/8346728). + +The following color spaces are supported: + +- `rgb` +- `hex` +- `ansi256` +- `ansi` + +To use these, call the associated conversion function with the intended output, for example: + +```js +import styles from 'ansi-styles'; + +styles.color.ansi(styles.rgbToAnsi(100, 200, 15)); // RGB to 16 color ansi foreground code +styles.bgColor.ansi(styles.hexToAnsi('#C0FFEE')); // HEX to 16 color ansi foreground code + +styles.color.ansi256(styles.rgbToAnsi256(100, 200, 15)); // RGB to 256 color ansi foreground code +styles.bgColor.ansi256(styles.hexToAnsi256('#C0FFEE')); // HEX to 256 color ansi foreground code + +styles.color.ansi16m(100, 200, 15); // RGB to 16 million color foreground code +styles.bgColor.ansi16m(...styles.hexToRgb('#C0FFEE')); // Hex (RGB) to 16 million color foreground code +``` + +## Related + +- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + +## For enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of `ansi-styles` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-ansi-styles?utm_source=npm-ansi-styles&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/node_modules/balanced-match/.github/FUNDING.yml b/node_modules/balanced-match/.github/FUNDING.yml new file mode 100644 index 0000000..cea8b16 --- /dev/null +++ b/node_modules/balanced-match/.github/FUNDING.yml @@ -0,0 +1,2 @@ +tidelift: "npm/balanced-match" +patreon: juliangruber diff --git a/node_modules/balanced-match/LICENSE.md b/node_modules/balanced-match/LICENSE.md new file mode 100644 index 0000000..2cdc8e4 --- /dev/null +++ b/node_modules/balanced-match/LICENSE.md @@ -0,0 +1,21 @@ +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +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: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +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. diff --git a/node_modules/balanced-match/README.md b/node_modules/balanced-match/README.md new file mode 100644 index 0000000..d2a48b6 --- /dev/null +++ b/node_modules/balanced-match/README.md @@ -0,0 +1,97 @@ +# balanced-match + +Match balanced string pairs, like `{` and `}` or `` and ``. Supports regular expressions as well! + +[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match) +[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match) + +[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match) + +## Example + +Get the first matching pair of braces: + +```js +var balanced = require('balanced-match'); + +console.log(balanced('{', '}', 'pre{in{nested}}post')); +console.log(balanced('{', '}', 'pre{first}between{second}post')); +console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post')); +``` + +The matches are: + +```bash +$ node example.js +{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' } +{ start: 3, + end: 9, + pre: 'pre', + body: 'first', + post: 'between{second}post' } +{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' } +``` + +## API + +### var m = balanced(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +object with those keys: + +* **start** the index of the first match of `a` +* **end** the index of the matching `b` +* **pre** the preamble, `a` and `b` not included +* **body** the match, `a` and `b` not included +* **post** the postscript, `a` and `b` not included + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`. + +### var r = balanced.range(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +array with indexes: `[ , ]`. + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install balanced-match +``` + +## Security contact information + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +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: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +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. diff --git a/node_modules/balanced-match/index.js b/node_modules/balanced-match/index.js new file mode 100644 index 0000000..c67a646 --- /dev/null +++ b/node_modules/balanced-match/index.js @@ -0,0 +1,62 @@ +'use strict'; +module.exports = balanced; +function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + + var r = range(a, b, str); + + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; +} + +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} + +balanced.range = range; +function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; + + if (ai >= 0 && bi > 0) { + if(a===b) { + return [ai, bi]; + } + begs = []; + left = str.length; + + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [ begs.pop(), bi ]; + } else { + beg = begs.pop(); + if (beg < left) { + left = beg; + right = bi; + } + + bi = str.indexOf(b, i + 1); + } + + i = ai < bi && ai >= 0 ? ai : bi; + } + + if (begs.length) { + result = [ left, right ]; + } + } + + return result; +} diff --git a/node_modules/balanced-match/package.json b/node_modules/balanced-match/package.json new file mode 100644 index 0000000..ce6073e --- /dev/null +++ b/node_modules/balanced-match/package.json @@ -0,0 +1,48 @@ +{ + "name": "balanced-match", + "description": "Match balanced character pairs, like \"{\" and \"}\"", + "version": "1.0.2", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/balanced-match.git" + }, + "homepage": "https://github.com/juliangruber/balanced-match", + "main": "index.js", + "scripts": { + "test": "tape test/test.js", + "bench": "matcha test/bench.js" + }, + "devDependencies": { + "matcha": "^0.7.0", + "tape": "^4.6.0" + }, + "keywords": [ + "match", + "regexp", + "test", + "balanced", + "parse" + ], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + } +} diff --git a/node_modules/brace-expansion/.github/FUNDING.yml b/node_modules/brace-expansion/.github/FUNDING.yml new file mode 100644 index 0000000..79d1eaf --- /dev/null +++ b/node_modules/brace-expansion/.github/FUNDING.yml @@ -0,0 +1,2 @@ +tidelift: "npm/brace-expansion" +patreon: juliangruber diff --git a/node_modules/brace-expansion/LICENSE b/node_modules/brace-expansion/LICENSE new file mode 100644 index 0000000..de32266 --- /dev/null +++ b/node_modules/brace-expansion/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2013 Julian Gruber + +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: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +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. diff --git a/node_modules/brace-expansion/README.md b/node_modules/brace-expansion/README.md new file mode 100644 index 0000000..e55c583 --- /dev/null +++ b/node_modules/brace-expansion/README.md @@ -0,0 +1,135 @@ +# brace-expansion + +[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), +as known from sh/bash, in JavaScript. + +[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion) +[![downloads](https://img.shields.io/npm/dm/brace-expansion.svg)](https://www.npmjs.org/package/brace-expansion) +[![Greenkeeper badge](https://badges.greenkeeper.io/juliangruber/brace-expansion.svg)](https://greenkeeper.io/) + +[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion) + +## Example + +```js +var expand = require('brace-expansion'); + +expand('file-{a,b,c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('-v{,,}') +// => ['-v', '-v', '-v'] + +expand('file{0..2}.jpg') +// => ['file0.jpg', 'file1.jpg', 'file2.jpg'] + +expand('file-{a..c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('file{2..0}.jpg') +// => ['file2.jpg', 'file1.jpg', 'file0.jpg'] + +expand('file{0..4..2}.jpg') +// => ['file0.jpg', 'file2.jpg', 'file4.jpg'] + +expand('file-{a..e..2}.jpg') +// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg'] + +expand('file{00..10..5}.jpg') +// => ['file00.jpg', 'file05.jpg', 'file10.jpg'] + +expand('{{A..C},{a..c}}') +// => ['A', 'B', 'C', 'a', 'b', 'c'] + +expand('ppp{,config,oe{,conf}}') +// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf'] +``` + +## API + +```js +var expand = require('brace-expansion'); +``` + +### var expanded = expand(str) + +Return an array of all possible and valid expansions of `str`. If none are +found, `[str]` is returned. + +Valid expansions are: + +```js +/^(.*,)+(.+)?$/ +// {a,b,...} +``` + +A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +A numeric sequence from `x` to `y` inclusive, with optional increment. +If `x` or `y` start with a leading `0`, all the numbers will be padded +to have equal length. Negative numbers and backwards iteration work too. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +An alphabetic sequence from `x` to `y` inclusive, with optional increment. +`x` and `y` must be exactly one character, and if given, `incr` must be a +number. + +For compatibility reasons, the string `${` is not eligible for brace expansion. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install brace-expansion +``` + +## Contributors + +- [Julian Gruber](https://github.com/juliangruber) +- [Isaac Z. Schlueter](https://github.com/isaacs) + +## Sponsors + +This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)! + +Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)! + +## Security contact information + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +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: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +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. diff --git a/node_modules/brace-expansion/index.js b/node_modules/brace-expansion/index.js new file mode 100644 index 0000000..a27f81c --- /dev/null +++ b/node_modules/brace-expansion/index.js @@ -0,0 +1,203 @@ +var balanced = require('balanced-match'); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + // I don't know why Bash 4.3 does this, but it does. + // Anything starting with {} will have the first two bytes preserved + // but *only* at the top level, so {},a}b will not expand to anything, + // but a{},b}c will be expanded to [a}c,abc]. + // One could argue that this is a bug in Bash, but since the goal of + // this module is to match Bash's rules, we escape a leading {} + if (str.substr(0, 2) === '{}') { + str = '\\{\\}' + str.substr(2); + } + + return expand(escapeBraces(str), true).map(unescapeBraces); +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str, isTop) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m) return [str]; + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; + + if (/\$$/.test(m.pre)) { + for (var k = 0; k < post.length; k++) { + var expansion = pre+ '{' + m.body + '}' + post[k]; + expansions.push(expansion); + } + } else { + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(',') >= 0; + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,(?!,).*\}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = []; + + for (var j = 0; j < n.length; j++) { + N.push.apply(N, expand(n[j], false)); + } + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } + } + } + + return expansions; +} + diff --git a/node_modules/brace-expansion/package.json b/node_modules/brace-expansion/package.json new file mode 100644 index 0000000..c7eee34 --- /dev/null +++ b/node_modules/brace-expansion/package.json @@ -0,0 +1,49 @@ +{ + "name": "brace-expansion", + "description": "Brace expansion as known from sh/bash", + "version": "2.0.2", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/brace-expansion.git" + }, + "homepage": "https://github.com/juliangruber/brace-expansion", + "main": "index.js", + "scripts": { + "test": "tape test/*.js", + "gentest": "bash test/generate.sh", + "bench": "matcha test/perf/bench.js" + }, + "dependencies": { + "balanced-match": "^1.0.0" + }, + "devDependencies": { + "@c4312/matcha": "^1.3.1", + "tape": "^4.6.0" + }, + "keywords": [], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "publishConfig": { + "tag": "2.x" + } +} diff --git a/node_modules/cacache/LICENSE.md b/node_modules/cacache/LICENSE.md new file mode 100644 index 0000000..8d28acf --- /dev/null +++ b/node_modules/cacache/LICENSE.md @@ -0,0 +1,16 @@ +ISC License + +Copyright (c) npm, Inc. + +Permission to use, copy, modify, and/or distribute this software for +any purpose with or without fee is hereby granted, provided that the +above copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE COPYRIGHT HOLDER DISCLAIMS +ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE +USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/cacache/README.md b/node_modules/cacache/README.md new file mode 100644 index 0000000..67d3e3c --- /dev/null +++ b/node_modules/cacache/README.md @@ -0,0 +1,715 @@ +# cacache [![npm version](https://img.shields.io/npm/v/cacache.svg)](https://npm.im/cacache) [![license](https://img.shields.io/npm/l/cacache.svg)](https://npm.im/cacache) [![Travis](https://img.shields.io/travis/npm/cacache.svg)](https://travis-ci.org/npm/cacache) [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/npm/cacache?svg=true)](https://ci.appveyor.com/project/npm/cacache) [![Coverage Status](https://coveralls.io/repos/github/npm/cacache/badge.svg?branch=latest)](https://coveralls.io/github/npm/cacache?branch=latest) + +[`cacache`](https://github.com/npm/cacache) is a Node.js library for managing +local key and content address caches. It's really fast, really good at +concurrency, and it will never give you corrupted data, even if cache files +get corrupted or manipulated. + +On systems that support user and group settings on files, cacache will +match the `uid` and `gid` values to the folder where the cache lives, even +when running as `root`. + +It was written to be used as [npm](https://npm.im)'s local cache, but can +just as easily be used on its own. + +## Install + +`$ npm install --save cacache` + +## Table of Contents + +* [Example](#example) +* [Features](#features) +* [Contributing](#contributing) +* [API](#api) + * [Using localized APIs](#localized-api) + * Reading + * [`ls`](#ls) + * [`ls.stream`](#ls-stream) + * [`get`](#get-data) + * [`get.stream`](#get-stream) + * [`get.info`](#get-info) + * [`get.hasContent`](#get-hasContent) + * Writing + * [`put`](#put-data) + * [`put.stream`](#put-stream) + * [`rm.all`](#rm-all) + * [`rm.entry`](#rm-entry) + * [`rm.content`](#rm-content) + * [`index.compact`](#index-compact) + * [`index.insert`](#index-insert) + * Utilities + * [`clearMemoized`](#clear-memoized) + * [`tmp.mkdir`](#tmp-mkdir) + * [`tmp.withTmp`](#with-tmp) + * Integrity + * [Subresource Integrity](#integrity) + * [`verify`](#verify) + * [`verify.lastRun`](#verify-last-run) + +### Example + +```javascript +const cacache = require('cacache') +const fs = require('fs') + +const cachePath = '/tmp/my-toy-cache' +const key = 'my-unique-key-1234' + +// Cache it! Use `cachePath` as the root of the content cache +cacache.put(cachePath, key, '10293801983029384').then(integrity => { + console.log(`Saved content to ${cachePath}.`) +}) + +const destination = '/tmp/mytar.tgz' + +// Copy the contents out of the cache and into their destination! +// But this time, use stream instead! +cacache.get.stream( + cachePath, key +).pipe( + fs.createWriteStream(destination) +).on('finish', () => { + console.log('done extracting!') +}) + +// The same thing, but skip the key index. +cacache.get.byDigest(cachePath, integrityHash).then(data => { + fs.writeFile(destination, data, err => { + console.log('tarball data fetched based on its sha512sum and written out!') + }) +}) +``` + +### Features + +* Extraction by key or by content address (shasum, etc) +* [Subresource Integrity](#integrity) web standard support +* Multi-hash support - safely host sha1, sha512, etc, in a single cache +* Automatic content deduplication +* Fault tolerance (immune to corruption, partial writes, process races, etc) +* Consistency guarantees on read and write (full data verification) +* Lockless, high-concurrency cache access +* Streaming support +* Promise support +* Fast -- sub-millisecond reads and writes including verification +* Arbitrary metadata storage +* Garbage collection and additional offline verification +* Thorough test coverage +* There's probably a bloom filter in there somewhere. Those are cool, right? 🤔 + +### Contributing + +The cacache team enthusiastically welcomes contributions and project participation! There's a bunch of things you can do if you want to contribute! Please don't hesitate to jump in if you'd like to, or even ask us questions if something isn't clear. + +All participants and maintainers in this project are expected to follow [Code of Conduct](CODE_OF_CONDUCT.md), and just generally be excellent to each other. + +Please refer to the [Changelog](CHANGELOG.md) for project history details, too. + +Happy hacking! + +### API + +#### `> cacache.ls(cache) -> Promise` + +Lists info for all entries currently in the cache as a single large object. Each +entry in the object will be keyed by the unique index key, with corresponding +[`get.info`](#get-info) objects as the values. + +##### Example + +```javascript +cacache.ls(cachePath).then(console.log) +// Output +{ + 'my-thing': { + key: 'my-thing', + integrity: 'sha512-BaSe64/EnCoDED+HAsh==' + path: '.testcache/content/deadbeef', // joined with `cachePath` + time: 12345698490, + size: 4023948, + metadata: { + name: 'blah', + version: '1.2.3', + description: 'this was once a package but now it is my-thing' + } + }, + 'other-thing': { + key: 'other-thing', + integrity: 'sha1-ANothER+hasH=', + path: '.testcache/content/bada55', + time: 11992309289, + size: 111112 + } +} +``` + +#### `> cacache.ls.stream(cache) -> Readable` + +Lists info for all entries currently in the cache as a single large object. + +This works just like [`ls`](#ls), except [`get.info`](#get-info) entries are +returned as `'data'` events on the returned stream. + +##### Example + +```javascript +cacache.ls.stream(cachePath).on('data', console.log) +// Output +{ + key: 'my-thing', + integrity: 'sha512-BaSe64HaSh', + path: '.testcache/content/deadbeef', // joined with `cachePath` + time: 12345698490, + size: 13423, + metadata: { + name: 'blah', + version: '1.2.3', + description: 'this was once a package but now it is my-thing' + } +} + +{ + key: 'other-thing', + integrity: 'whirlpool-WoWSoMuchSupport', + path: '.testcache/content/bada55', + time: 11992309289, + size: 498023984029 +} + +{ + ... +} +``` + +#### `> cacache.get(cache, key, [opts]) -> Promise({data, metadata, integrity})` + +Returns an object with the cached data, digest, and metadata identified by +`key`. The `data` property of this object will be a `Buffer` instance that +presumably holds some data that means something to you. I'm sure you know what +to do with it! cacache just won't care. + +`integrity` is a [Subresource +Integrity](#integrity) +string. That is, a string that can be used to verify `data`, which looks like +`-`. + +If there is no content identified by `key`, or if the locally-stored data does +not pass the validity checksum, the promise will be rejected. + +A sub-function, `get.byDigest` may be used for identical behavior, except lookup +will happen by integrity hash, bypassing the index entirely. This version of the +function *only* returns `data` itself, without any wrapper. + +See: [options](#get-options) + +##### Note + +This function loads the entire cache entry into memory before returning it. If +you're dealing with Very Large data, consider using [`get.stream`](#get-stream) +instead. + +##### Example + +```javascript +// Look up by key +cache.get(cachePath, 'my-thing').then(console.log) +// Output: +{ + metadata: { + thingName: 'my' + }, + integrity: 'sha512-BaSe64HaSh', + data: Buffer#, + size: 9320 +} + +// Look up by digest +cache.get.byDigest(cachePath, 'sha512-BaSe64HaSh').then(console.log) +// Output: +Buffer# +``` + +#### `> cacache.get.stream(cache, key, [opts]) -> Readable` + +Returns a [Readable Stream](https://nodejs.org/api/stream.html#stream_readable_streams) of the cached data identified by `key`. + +If there is no content identified by `key`, or if the locally-stored data does +not pass the validity checksum, an error will be emitted. + +`metadata` and `integrity` events will be emitted before the stream closes, if +you need to collect that extra data about the cached entry. + +A sub-function, `get.stream.byDigest` may be used for identical behavior, +except lookup will happen by integrity hash, bypassing the index entirely. This +version does not emit the `metadata` and `integrity` events at all. + +See: [options](#get-options) + +##### Example + +```javascript +// Look up by key +cache.get.stream( + cachePath, 'my-thing' +).on('metadata', metadata => { + console.log('metadata:', metadata) +}).on('integrity', integrity => { + console.log('integrity:', integrity) +}).pipe( + fs.createWriteStream('./x.tgz') +) +// Outputs: +metadata: { ... } +integrity: 'sha512-SoMeDIGest+64==' + +// Look up by digest +cache.get.stream.byDigest( + cachePath, 'sha512-SoMeDIGest+64==' +).pipe( + fs.createWriteStream('./x.tgz') +) +``` + +#### `> cacache.get.info(cache, key) -> Promise` + +Looks up `key` in the cache index, returning information about the entry if +one exists. + +##### Fields + +* `key` - Key the entry was looked up under. Matches the `key` argument. +* `integrity` - [Subresource Integrity hash](#integrity) for the content this entry refers to. +* `path` - Filesystem path where content is stored, joined with `cache` argument. +* `time` - Timestamp the entry was first added on. +* `metadata` - User-assigned metadata associated with the entry/content. + +##### Example + +```javascript +cacache.get.info(cachePath, 'my-thing').then(console.log) + +// Output +{ + key: 'my-thing', + integrity: 'sha256-MUSTVERIFY+ALL/THINGS==' + path: '.testcache/content/deadbeef', + time: 12345698490, + size: 849234, + metadata: { + name: 'blah', + version: '1.2.3', + description: 'this was once a package but now it is my-thing' + } +} +``` + +#### `> cacache.get.hasContent(cache, integrity) -> Promise` + +Looks up a [Subresource Integrity hash](#integrity) in the cache. If content +exists for this `integrity`, it will return an object, with the specific single integrity hash +that was found in `sri` key, and the size of the found content as `size`. If no content exists for this integrity, it will return `false`. + +##### Example + +```javascript +cacache.get.hasContent(cachePath, 'sha256-MUSTVERIFY+ALL/THINGS==').then(console.log) + +// Output +{ + sri: { + source: 'sha256-MUSTVERIFY+ALL/THINGS==', + algorithm: 'sha256', + digest: 'MUSTVERIFY+ALL/THINGS==', + options: [] + }, + size: 9001 +} + +cacache.get.hasContent(cachePath, 'sha521-NOT+IN/CACHE==').then(console.log) + +// Output +false +``` + +##### Options + +##### `opts.integrity` +If present, the pre-calculated digest for the inserted content. If this option +is provided and does not match the post-insertion digest, insertion will fail +with an `EINTEGRITY` error. + +##### `opts.memoize` + +Default: null + +If explicitly truthy, cacache will read from memory and memoize data on bulk read. If `false`, cacache will read from disk data. Reader functions by default read from in-memory cache. + +##### `opts.size` +If provided, the data stream will be verified to check that enough data was +passed through. If there's more or less data than expected, insertion will fail +with an `EBADSIZE` error. + + +#### `> cacache.put(cache, key, data, [opts]) -> Promise` + +Inserts data passed to it into the cache. The returned Promise resolves with a +digest (generated according to [`opts.algorithms`](#optsalgorithms)) after the +cache entry has been successfully written. + +See: [options](#put-options) + +##### Example + +```javascript +fetch( + 'https://registry.npmjs.org/cacache/-/cacache-1.0.0.tgz' +).then(data => { + return cacache.put(cachePath, 'registry.npmjs.org|cacache@1.0.0', data) +}).then(integrity => { + console.log('integrity hash is', integrity) +}) +``` + +#### `> cacache.put.stream(cache, key, [opts]) -> Writable` + +Returns a [Writable +Stream](https://nodejs.org/api/stream.html#stream_writable_streams) that inserts +data written to it into the cache. Emits an `integrity` event with the digest of +written contents when it succeeds. + +See: [options](#put-options) + +##### Example + +```javascript +request.get( + 'https://registry.npmjs.org/cacache/-/cacache-1.0.0.tgz' +).pipe( + cacache.put.stream( + cachePath, 'registry.npmjs.org|cacache@1.0.0' + ).on('integrity', d => console.log(`integrity digest is ${d}`)) +) +``` + +##### Options + +##### `opts.metadata` + +Arbitrary metadata to be attached to the inserted key. + +##### `opts.size` + +If provided, the data stream will be verified to check that enough data was +passed through. If there's more or less data than expected, insertion will fail +with an `EBADSIZE` error. + +##### `opts.integrity` + +If present, the pre-calculated digest for the inserted content. If this option +is provided and does not match the post-insertion digest, insertion will fail +with an `EINTEGRITY` error. + +`algorithms` has no effect if this option is present. + +##### `opts.integrityEmitter` + +*Streaming only* If present, uses the provided event emitter as a source of +truth for both integrity and size. This allows use cases where integrity is +already being calculated outside of cacache to reuse that data instead of +calculating it a second time. + +The emitter must emit both the `'integrity'` and `'size'` events. + +NOTE: If this option is provided, you must verify that you receive the correct +integrity value yourself and emit an `'error'` event if there is a mismatch. +[ssri Integrity Streams](https://github.com/npm/ssri#integrity-stream) do this for you when given an expected integrity. + +##### `opts.algorithms` + +Default: ['sha512'] + +Hashing algorithms to use when calculating the [subresource integrity +digest](#integrity) +for inserted data. Can use any algorithm listed in `crypto.getHashes()` or +`'omakase'`/`'お任せします'` to pick a random hash algorithm on each insertion. You +may also use any anagram of `'modnar'` to use this feature. + +Currently only supports one algorithm at a time (i.e., an array length of +exactly `1`). Has no effect if `opts.integrity` is present. + +##### `opts.memoize` + +Default: null + +If provided, cacache will memoize the given cache insertion in memory, bypassing +any filesystem checks for that key or digest in future cache fetches. Nothing +will be written to the in-memory cache unless this option is explicitly truthy. + +If `opts.memoize` is an object or a `Map`-like (that is, an object with `get` +and `set` methods), it will be written to instead of the global memoization +cache. + +Reading from disk data can be forced by explicitly passing `memoize: false` to +the reader functions, but their default will be to read from memory. + +##### `opts.tmpPrefix` +Default: null + +Prefix to append on the temporary directory name inside the cache's tmp dir. + +#### `> cacache.rm.all(cache) -> Promise` + +Clears the entire cache. Mainly by blowing away the cache directory itself. + +##### Example + +```javascript +cacache.rm.all(cachePath).then(() => { + console.log('THE APOCALYPSE IS UPON US 😱') +}) +``` + +#### `> cacache.rm.entry(cache, key, [opts]) -> Promise` + +Alias: `cacache.rm` + +Removes the index entry for `key`. Content will still be accessible if +requested directly by content address ([`get.stream.byDigest`](#get-stream)). + +By default, this appends a new entry to the index with an integrity of `null`. +If `opts.removeFully` is set to `true` then the index file itself will be +physically deleted rather than appending a `null`. + +To remove the content itself (which might still be used by other entries), use +[`rm.content`](#rm-content). Or, to safely vacuum any unused content, use +[`verify`](#verify). + +##### Example + +```javascript +cacache.rm.entry(cachePath, 'my-thing').then(() => { + console.log('I did not like it anyway') +}) +``` + +#### `> cacache.rm.content(cache, integrity) -> Promise` + +Removes the content identified by `integrity`. Any index entries referring to it +will not be usable again until the content is re-added to the cache with an +identical digest. + +##### Example + +```javascript +cacache.rm.content(cachePath, 'sha512-SoMeDIGest/IN+BaSE64==').then(() => { + console.log('data for my-thing is gone!') +}) +``` + +#### `> cacache.index.compact(cache, key, matchFn, [opts]) -> Promise` + +Uses `matchFn`, which must be a synchronous function that accepts two entries +and returns a boolean indicating whether or not the two entries match, to +deduplicate all entries in the cache for the given `key`. + +If `opts.validateEntry` is provided, it will be called as a function with the +only parameter being a single index entry. The function must return a Boolean, +if it returns `true` the entry is considered valid and will be kept in the index, +if it returns `false` the entry will be removed from the index. + +If `opts.validateEntry` is not provided, however, every entry in the index will +be deduplicated and kept until the first `null` integrity is reached, removing +all entries that were written before the `null`. + +The deduplicated list of entries is both written to the index, replacing the +existing content, and returned in the Promise. + +#### `> cacache.index.insert(cache, key, integrity, opts) -> Promise` + +Writes an index entry to the cache for the given `key` without writing content. + +It is assumed if you are using this method, you have already stored the content +some other way and you only wish to add a new index to that content. The `metadata` +and `size` properties are read from `opts` and used as part of the index entry. + +Returns a Promise resolving to the newly added entry. + +#### `> cacache.clearMemoized()` + +Completely resets the in-memory entry cache. + +#### `> tmp.mkdir(cache, opts) -> Promise` + +Returns a unique temporary directory inside the cache's `tmp` dir. This +directory will use the same safe user assignment that all the other stuff use. + +Once the directory is made, it's the user's responsibility that all files +within are given the appropriate `gid`/`uid` ownership settings to match +the rest of the cache. If not, you can ask cacache to do it for you by +calling [`tmp.fix()`](#tmp-fix), which will fix all tmp directory +permissions. + +If you want automatic cleanup of this directory, use +[`tmp.withTmp()`](#with-tpm) + +See: [options](#tmp-options) + +##### Example + +```javascript +cacache.tmp.mkdir(cache).then(dir => { + fs.writeFile(path.join(dir, 'blablabla'), Buffer#<1234>, ...) +}) +``` + +#### `> tmp.fix(cache) -> Promise` + +Sets the `uid` and `gid` properties on all files and folders within the tmp +folder to match the rest of the cache. + +Use this after manually writing files into [`tmp.mkdir`](#tmp-mkdir) or +[`tmp.withTmp`](#with-tmp). + +##### Example + +```javascript +cacache.tmp.mkdir(cache).then(dir => { + writeFile(path.join(dir, 'file'), someData).then(() => { + // make sure we didn't just put a root-owned file in the cache + cacache.tmp.fix().then(() => { + // all uids and gids match now + }) + }) +}) +``` + +#### `> tmp.withTmp(cache, opts, cb) -> Promise` + +Creates a temporary directory with [`tmp.mkdir()`](#tmp-mkdir) and calls `cb` +with it. The created temporary directory will be removed when the return value +of `cb()` resolves, the tmp directory will be automatically deleted once that +promise completes. + +The same caveats apply when it comes to managing permissions for the tmp dir's +contents. + +See: [options](#tmp-options) + +##### Example + +```javascript +cacache.tmp.withTmp(cache, dir => { + return fs.writeFile(path.join(dir, 'blablabla'), 'blabla contents', { encoding: 'utf8' }) +}).then(() => { + // `dir` no longer exists +}) +``` + +##### Options + +##### `opts.tmpPrefix` +Default: null + +Prefix to append on the temporary directory name inside the cache's tmp dir. + +#### Subresource Integrity Digests + +For content verification and addressing, cacache uses strings following the +[Subresource +Integrity spec](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity). +That is, any time cacache expects an `integrity` argument or option, it +should be in the format `-`. + +One deviation from the current spec is that cacache will support any hash +algorithms supported by the underlying Node.js process. You can use +`crypto.getHashes()` to see which ones you can use. + +##### Generating Digests Yourself + +If you have an existing content shasum, they are generally formatted as a +hexadecimal string (that is, a sha1 would look like: +`5f5513f8822fdbe5145af33b64d8d970dcf95c6e`). In order to be compatible with +cacache, you'll need to convert this to an equivalent subresource integrity +string. For this example, the corresponding hash would be: +`sha1-X1UT+IIv2+UUWvM7ZNjZcNz5XG4=`. + +If you want to generate an integrity string yourself for existing data, you can +use something like this: + +```javascript +const crypto = require('crypto') +const hashAlgorithm = 'sha512' +const data = 'foobarbaz' + +const integrity = ( + hashAlgorithm + + '-' + + crypto.createHash(hashAlgorithm).update(data).digest('base64') +) +``` + +You can also use [`ssri`](https://npm.im/ssri) to have a richer set of functionality +around SRI strings, including generation, parsing, and translating from existing +hex-formatted strings. + +#### `> cacache.verify(cache, opts) -> Promise` + +Checks out and fixes up your cache: + +* Cleans up corrupted or invalid index entries. +* Custom entry filtering options. +* Garbage collects any content entries not referenced by the index. +* Checks integrity for all content entries and removes invalid content. +* Fixes cache ownership. +* Removes the `tmp` directory in the cache and all its contents. + +When it's done, it'll return an object with various stats about the verification +process, including amount of storage reclaimed, number of valid entries, number +of entries removed, etc. + +##### Options + +##### `opts.concurrency` + +Default: 20 + +Number of concurrently read files in the filesystem while doing clean up. + +##### `opts.filter` +Receives a formatted entry. Return false to remove it. +Note: might be called more than once on the same entry. + +##### `opts.log` +Custom logger function: +``` + log: { silly () {} } + log.silly('verify', 'verifying cache at', cache) +``` + +##### Example + +```sh +echo somegarbage >> $CACHEPATH/content/deadbeef +``` + +```javascript +cacache.verify(cachePath).then(stats => { + // deadbeef collected, because of invalid checksum. + console.log('cache is much nicer now! stats:', stats) +}) +``` + +#### `> cacache.verify.lastRun(cache) -> Promise` + +Returns a `Date` representing the last time `cacache.verify` was run on `cache`. + +##### Example + +```javascript +cacache.verify(cachePath).then(() => { + cacache.verify.lastRun(cachePath).then(lastTime => { + console.log('cacache.verify was last called on' + lastTime) + }) +}) +``` diff --git a/node_modules/cacache/lib/content/path.js b/node_modules/cacache/lib/content/path.js new file mode 100644 index 0000000..ad5a76a --- /dev/null +++ b/node_modules/cacache/lib/content/path.js @@ -0,0 +1,29 @@ +'use strict' + +const contentVer = require('../../package.json')['cache-version'].content +const hashToSegments = require('../util/hash-to-segments') +const path = require('path') +const ssri = require('ssri') + +// Current format of content file path: +// +// sha512-BaSE64Hex= -> +// ~/.my-cache/content-v2/sha512/ba/da/55deadbeefc0ffee +// +module.exports = contentPath + +function contentPath (cache, integrity) { + const sri = ssri.parse(integrity, { single: true }) + // contentPath is the *strongest* algo given + return path.join( + contentDir(cache), + sri.algorithm, + ...hashToSegments(sri.hexDigest()) + ) +} + +module.exports.contentDir = contentDir + +function contentDir (cache) { + return path.join(cache, `content-v${contentVer}`) +} diff --git a/node_modules/cacache/lib/content/read.js b/node_modules/cacache/lib/content/read.js new file mode 100644 index 0000000..5f6192c --- /dev/null +++ b/node_modules/cacache/lib/content/read.js @@ -0,0 +1,165 @@ +'use strict' + +const fs = require('fs/promises') +const fsm = require('fs-minipass') +const ssri = require('ssri') +const contentPath = require('./path') +const Pipeline = require('minipass-pipeline') + +module.exports = read + +const MAX_SINGLE_READ_SIZE = 64 * 1024 * 1024 +async function read (cache, integrity, opts = {}) { + const { size } = opts + const { stat, cpath, sri } = await withContentSri(cache, integrity, async (cpath, sri) => { + // get size + const stat = size ? { size } : await fs.stat(cpath) + return { stat, cpath, sri } + }) + + if (stat.size > MAX_SINGLE_READ_SIZE) { + return readPipeline(cpath, stat.size, sri, new Pipeline()).concat() + } + + const data = await fs.readFile(cpath, { encoding: null }) + + if (stat.size !== data.length) { + throw sizeError(stat.size, data.length) + } + + if (!ssri.checkData(data, sri)) { + throw integrityError(sri, cpath) + } + + return data +} + +const readPipeline = (cpath, size, sri, stream) => { + stream.push( + new fsm.ReadStream(cpath, { + size, + readSize: MAX_SINGLE_READ_SIZE, + }), + ssri.integrityStream({ + integrity: sri, + size, + }) + ) + return stream +} + +module.exports.stream = readStream +module.exports.readStream = readStream + +function readStream (cache, integrity, opts = {}) { + const { size } = opts + const stream = new Pipeline() + // Set all this up to run on the stream and then just return the stream + Promise.resolve().then(async () => { + const { stat, cpath, sri } = await withContentSri(cache, integrity, async (cpath, sri) => { + // get size + const stat = size ? { size } : await fs.stat(cpath) + return { stat, cpath, sri } + }) + + return readPipeline(cpath, stat.size, sri, stream) + }).catch(err => stream.emit('error', err)) + + return stream +} + +module.exports.copy = copy + +function copy (cache, integrity, dest) { + return withContentSri(cache, integrity, (cpath) => { + return fs.copyFile(cpath, dest) + }) +} + +module.exports.hasContent = hasContent + +async function hasContent (cache, integrity) { + if (!integrity) { + return false + } + + try { + return await withContentSri(cache, integrity, async (cpath, sri) => { + const stat = await fs.stat(cpath) + return { size: stat.size, sri, stat } + }) + } catch (err) { + if (err.code === 'ENOENT') { + return false + } + + if (err.code === 'EPERM') { + /* istanbul ignore else */ + if (process.platform !== 'win32') { + throw err + } else { + return false + } + } + } +} + +async function withContentSri (cache, integrity, fn) { + const sri = ssri.parse(integrity) + // If `integrity` has multiple entries, pick the first digest + // with available local data. + const algo = sri.pickAlgorithm() + const digests = sri[algo] + + if (digests.length <= 1) { + const cpath = contentPath(cache, digests[0]) + return fn(cpath, digests[0]) + } else { + // Can't use race here because a generic error can happen before + // a ENOENT error, and can happen before a valid result + const results = await Promise.all(digests.map(async (meta) => { + try { + return await withContentSri(cache, meta, fn) + } catch (err) { + if (err.code === 'ENOENT') { + return Object.assign( + new Error('No matching content found for ' + sri.toString()), + { code: 'ENOENT' } + ) + } + return err + } + })) + // Return the first non error if it is found + const result = results.find((r) => !(r instanceof Error)) + if (result) { + return result + } + + // Throw the No matching content found error + const enoentError = results.find((r) => r.code === 'ENOENT') + if (enoentError) { + throw enoentError + } + + // Throw generic error + throw results.find((r) => r instanceof Error) + } +} + +function sizeError (expected, found) { + /* eslint-disable-next-line max-len */ + const err = new Error(`Bad data size: expected inserted data to be ${expected} bytes, but got ${found} instead`) + err.expected = expected + err.found = found + err.code = 'EBADSIZE' + return err +} + +function integrityError (sri, path) { + const err = new Error(`Integrity verification failed for ${sri} (${path})`) + err.code = 'EINTEGRITY' + err.sri = sri + err.path = path + return err +} diff --git a/node_modules/cacache/lib/content/rm.js b/node_modules/cacache/lib/content/rm.js new file mode 100644 index 0000000..ce58d67 --- /dev/null +++ b/node_modules/cacache/lib/content/rm.js @@ -0,0 +1,18 @@ +'use strict' + +const fs = require('fs/promises') +const contentPath = require('./path') +const { hasContent } = require('./read') + +module.exports = rm + +async function rm (cache, integrity) { + const content = await hasContent(cache, integrity) + // ~pretty~ sure we can't end up with a content lacking sri, but be safe + if (content && content.sri) { + await fs.rm(contentPath(cache, content.sri), { recursive: true, force: true }) + return true + } else { + return false + } +} diff --git a/node_modules/cacache/lib/content/write.js b/node_modules/cacache/lib/content/write.js new file mode 100644 index 0000000..e7187ab --- /dev/null +++ b/node_modules/cacache/lib/content/write.js @@ -0,0 +1,206 @@ +'use strict' + +const events = require('events') + +const contentPath = require('./path') +const fs = require('fs/promises') +const { moveFile } = require('@npmcli/fs') +const { Minipass } = require('minipass') +const Pipeline = require('minipass-pipeline') +const Flush = require('minipass-flush') +const path = require('path') +const ssri = require('ssri') +const uniqueFilename = require('unique-filename') +const fsm = require('fs-minipass') + +module.exports = write + +// Cache of move operations in process so we don't duplicate +const moveOperations = new Map() + +async function write (cache, data, opts = {}) { + const { algorithms, size, integrity } = opts + + if (typeof size === 'number' && data.length !== size) { + throw sizeError(size, data.length) + } + + const sri = ssri.fromData(data, algorithms ? { algorithms } : {}) + if (integrity && !ssri.checkData(data, integrity, opts)) { + throw checksumError(integrity, sri) + } + + for (const algo in sri) { + const tmp = await makeTmp(cache, opts) + const hash = sri[algo].toString() + try { + await fs.writeFile(tmp.target, data, { flag: 'wx' }) + await moveToDestination(tmp, cache, hash, opts) + } finally { + if (!tmp.moved) { + await fs.rm(tmp.target, { recursive: true, force: true }) + } + } + } + return { integrity: sri, size: data.length } +} + +module.exports.stream = writeStream + +// writes proxied to the 'inputStream' that is passed to the Promise +// 'end' is deferred until content is handled. +class CacacheWriteStream extends Flush { + constructor (cache, opts) { + super() + this.opts = opts + this.cache = cache + this.inputStream = new Minipass() + this.inputStream.on('error', er => this.emit('error', er)) + this.inputStream.on('drain', () => this.emit('drain')) + this.handleContentP = null + } + + write (chunk, encoding, cb) { + if (!this.handleContentP) { + this.handleContentP = handleContent( + this.inputStream, + this.cache, + this.opts + ) + this.handleContentP.catch(error => this.emit('error', error)) + } + return this.inputStream.write(chunk, encoding, cb) + } + + flush (cb) { + this.inputStream.end(() => { + if (!this.handleContentP) { + const e = new Error('Cache input stream was empty') + e.code = 'ENODATA' + // empty streams are probably emitting end right away. + // defer this one tick by rejecting a promise on it. + return Promise.reject(e).catch(cb) + } + // eslint-disable-next-line promise/catch-or-return + this.handleContentP.then( + (res) => { + res.integrity && this.emit('integrity', res.integrity) + // eslint-disable-next-line promise/always-return + res.size !== null && this.emit('size', res.size) + cb() + }, + (er) => cb(er) + ) + }) + } +} + +function writeStream (cache, opts = {}) { + return new CacacheWriteStream(cache, opts) +} + +async function handleContent (inputStream, cache, opts) { + const tmp = await makeTmp(cache, opts) + try { + const res = await pipeToTmp(inputStream, cache, tmp.target, opts) + await moveToDestination( + tmp, + cache, + res.integrity, + opts + ) + return res + } finally { + if (!tmp.moved) { + await fs.rm(tmp.target, { recursive: true, force: true }) + } + } +} + +async function pipeToTmp (inputStream, cache, tmpTarget, opts) { + const outStream = new fsm.WriteStream(tmpTarget, { + flags: 'wx', + }) + + if (opts.integrityEmitter) { + // we need to create these all simultaneously since they can fire in any order + const [integrity, size] = await Promise.all([ + events.once(opts.integrityEmitter, 'integrity').then(res => res[0]), + events.once(opts.integrityEmitter, 'size').then(res => res[0]), + new Pipeline(inputStream, outStream).promise(), + ]) + return { integrity, size } + } + + let integrity + let size + const hashStream = ssri.integrityStream({ + integrity: opts.integrity, + algorithms: opts.algorithms, + size: opts.size, + }) + hashStream.on('integrity', i => { + integrity = i + }) + hashStream.on('size', s => { + size = s + }) + + const pipeline = new Pipeline(inputStream, hashStream, outStream) + await pipeline.promise() + return { integrity, size } +} + +async function makeTmp (cache, opts) { + const tmpTarget = uniqueFilename(path.join(cache, 'tmp'), opts.tmpPrefix) + await fs.mkdir(path.dirname(tmpTarget), { recursive: true }) + return { + target: tmpTarget, + moved: false, + } +} + +async function moveToDestination (tmp, cache, sri) { + const destination = contentPath(cache, sri) + const destDir = path.dirname(destination) + if (moveOperations.has(destination)) { + return moveOperations.get(destination) + } + moveOperations.set( + destination, + fs.mkdir(destDir, { recursive: true }) + .then(async () => { + await moveFile(tmp.target, destination, { overwrite: false }) + tmp.moved = true + return tmp.moved + }) + .catch(err => { + if (!err.message.startsWith('The destination file exists')) { + throw Object.assign(err, { code: 'EEXIST' }) + } + }).finally(() => { + moveOperations.delete(destination) + }) + + ) + return moveOperations.get(destination) +} + +function sizeError (expected, found) { + /* eslint-disable-next-line max-len */ + const err = new Error(`Bad data size: expected inserted data to be ${expected} bytes, but got ${found} instead`) + err.expected = expected + err.found = found + err.code = 'EBADSIZE' + return err +} + +function checksumError (expected, found) { + const err = new Error(`Integrity check failed: + Wanted: ${expected} + Found: ${found}`) + err.code = 'EINTEGRITY' + err.expected = expected + err.found = found + return err +} diff --git a/node_modules/cacache/lib/entry-index.js b/node_modules/cacache/lib/entry-index.js new file mode 100644 index 0000000..0e09b10 --- /dev/null +++ b/node_modules/cacache/lib/entry-index.js @@ -0,0 +1,336 @@ +'use strict' + +const crypto = require('crypto') +const { + appendFile, + mkdir, + readFile, + readdir, + rm, + writeFile, +} = require('fs/promises') +const { Minipass } = require('minipass') +const path = require('path') +const ssri = require('ssri') +const uniqueFilename = require('unique-filename') + +const contentPath = require('./content/path') +const hashToSegments = require('./util/hash-to-segments') +const indexV = require('../package.json')['cache-version'].index +const { moveFile } = require('@npmcli/fs') + +const lsStreamConcurrency = 5 + +module.exports.NotFoundError = class NotFoundError extends Error { + constructor (cache, key) { + super(`No cache entry for ${key} found in ${cache}`) + this.code = 'ENOENT' + this.cache = cache + this.key = key + } +} + +module.exports.compact = compact + +async function compact (cache, key, matchFn, opts = {}) { + const bucket = bucketPath(cache, key) + const entries = await bucketEntries(bucket) + const newEntries = [] + // we loop backwards because the bottom-most result is the newest + // since we add new entries with appendFile + for (let i = entries.length - 1; i >= 0; --i) { + const entry = entries[i] + // a null integrity could mean either a delete was appended + // or the user has simply stored an index that does not map + // to any content. we determine if the user wants to keep the + // null integrity based on the validateEntry function passed in options. + // if the integrity is null and no validateEntry is provided, we break + // as we consider the null integrity to be a deletion of everything + // that came before it. + if (entry.integrity === null && !opts.validateEntry) { + break + } + + // if this entry is valid, and it is either the first entry or + // the newEntries array doesn't already include an entry that + // matches this one based on the provided matchFn, then we add + // it to the beginning of our list + if ((!opts.validateEntry || opts.validateEntry(entry) === true) && + (newEntries.length === 0 || + !newEntries.find((oldEntry) => matchFn(oldEntry, entry)))) { + newEntries.unshift(entry) + } + } + + const newIndex = '\n' + newEntries.map((entry) => { + const stringified = JSON.stringify(entry) + const hash = hashEntry(stringified) + return `${hash}\t${stringified}` + }).join('\n') + + const setup = async () => { + const target = uniqueFilename(path.join(cache, 'tmp'), opts.tmpPrefix) + await mkdir(path.dirname(target), { recursive: true }) + return { + target, + moved: false, + } + } + + const teardown = async (tmp) => { + if (!tmp.moved) { + return rm(tmp.target, { recursive: true, force: true }) + } + } + + const write = async (tmp) => { + await writeFile(tmp.target, newIndex, { flag: 'wx' }) + await mkdir(path.dirname(bucket), { recursive: true }) + // we use @npmcli/move-file directly here because we + // want to overwrite the existing file + await moveFile(tmp.target, bucket) + tmp.moved = true + } + + // write the file atomically + const tmp = await setup() + try { + await write(tmp) + } finally { + await teardown(tmp) + } + + // we reverse the list we generated such that the newest + // entries come first in order to make looping through them easier + // the true passed to formatEntry tells it to keep null + // integrity values, if they made it this far it's because + // validateEntry returned true, and as such we should return it + return newEntries.reverse().map((entry) => formatEntry(cache, entry, true)) +} + +module.exports.insert = insert + +async function insert (cache, key, integrity, opts = {}) { + const { metadata, size, time } = opts + const bucket = bucketPath(cache, key) + const entry = { + key, + integrity: integrity && ssri.stringify(integrity), + time: time || Date.now(), + size, + metadata, + } + try { + await mkdir(path.dirname(bucket), { recursive: true }) + const stringified = JSON.stringify(entry) + // NOTE - Cleverness ahoy! + // + // This works because it's tremendously unlikely for an entry to corrupt + // another while still preserving the string length of the JSON in + // question. So, we just slap the length in there and verify it on read. + // + // Thanks to @isaacs for the whiteboarding session that ended up with + // this. + await appendFile(bucket, `\n${hashEntry(stringified)}\t${stringified}`) + } catch (err) { + if (err.code === 'ENOENT') { + return undefined + } + + throw err + } + return formatEntry(cache, entry) +} + +module.exports.find = find + +async function find (cache, key) { + const bucket = bucketPath(cache, key) + try { + const entries = await bucketEntries(bucket) + return entries.reduce((latest, next) => { + if (next && next.key === key) { + return formatEntry(cache, next) + } else { + return latest + } + }, null) + } catch (err) { + if (err.code === 'ENOENT') { + return null + } else { + throw err + } + } +} + +module.exports.delete = del + +function del (cache, key, opts = {}) { + if (!opts.removeFully) { + return insert(cache, key, null, opts) + } + + const bucket = bucketPath(cache, key) + return rm(bucket, { recursive: true, force: true }) +} + +module.exports.lsStream = lsStream + +function lsStream (cache) { + const indexDir = bucketDir(cache) + const stream = new Minipass({ objectMode: true }) + + // Set all this up to run on the stream and then just return the stream + Promise.resolve().then(async () => { + const { default: pMap } = await import('p-map') + const buckets = await readdirOrEmpty(indexDir) + await pMap(buckets, async (bucket) => { + const bucketPath = path.join(indexDir, bucket) + const subbuckets = await readdirOrEmpty(bucketPath) + await pMap(subbuckets, async (subbucket) => { + const subbucketPath = path.join(bucketPath, subbucket) + + // "/cachename//./*" + const subbucketEntries = await readdirOrEmpty(subbucketPath) + await pMap(subbucketEntries, async (entry) => { + const entryPath = path.join(subbucketPath, entry) + try { + const entries = await bucketEntries(entryPath) + // using a Map here prevents duplicate keys from showing up + // twice, I guess? + const reduced = entries.reduce((acc, entry) => { + acc.set(entry.key, entry) + return acc + }, new Map()) + // reduced is a map of key => entry + for (const entry of reduced.values()) { + const formatted = formatEntry(cache, entry) + if (formatted) { + stream.write(formatted) + } + } + } catch (err) { + if (err.code === 'ENOENT') { + return undefined + } + throw err + } + }, + { concurrency: lsStreamConcurrency }) + }, + { concurrency: lsStreamConcurrency }) + }, + { concurrency: lsStreamConcurrency }) + stream.end() + return stream + }).catch(err => stream.emit('error', err)) + + return stream +} + +module.exports.ls = ls + +async function ls (cache) { + const entries = await lsStream(cache).collect() + return entries.reduce((acc, xs) => { + acc[xs.key] = xs + return acc + }, {}) +} + +module.exports.bucketEntries = bucketEntries + +async function bucketEntries (bucket, filter) { + const data = await readFile(bucket, 'utf8') + return _bucketEntries(data, filter) +} + +function _bucketEntries (data) { + const entries = [] + data.split('\n').forEach((entry) => { + if (!entry) { + return + } + + const pieces = entry.split('\t') + if (!pieces[1] || hashEntry(pieces[1]) !== pieces[0]) { + // Hash is no good! Corruption or malice? Doesn't matter! + // EJECT EJECT + return + } + let obj + try { + obj = JSON.parse(pieces[1]) + } catch (_) { + // eslint-ignore-next-line no-empty-block + } + // coverage disabled here, no need to test with an entry that parses to something falsey + // istanbul ignore else + if (obj) { + entries.push(obj) + } + }) + return entries +} + +module.exports.bucketDir = bucketDir + +function bucketDir (cache) { + return path.join(cache, `index-v${indexV}`) +} + +module.exports.bucketPath = bucketPath + +function bucketPath (cache, key) { + const hashed = hashKey(key) + return path.join.apply( + path, + [bucketDir(cache)].concat(hashToSegments(hashed)) + ) +} + +module.exports.hashKey = hashKey + +function hashKey (key) { + return hash(key, 'sha256') +} + +module.exports.hashEntry = hashEntry + +function hashEntry (str) { + return hash(str, 'sha1') +} + +function hash (str, digest) { + return crypto + .createHash(digest) + .update(str) + .digest('hex') +} + +function formatEntry (cache, entry, keepAll) { + // Treat null digests as deletions. They'll shadow any previous entries. + if (!entry.integrity && !keepAll) { + return null + } + + return { + key: entry.key, + integrity: entry.integrity, + path: entry.integrity ? contentPath(cache, entry.integrity) : undefined, + size: entry.size, + time: entry.time, + metadata: entry.metadata, + } +} + +function readdirOrEmpty (dir) { + return readdir(dir).catch((err) => { + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') { + return [] + } + + throw err + }) +} diff --git a/node_modules/cacache/lib/get.js b/node_modules/cacache/lib/get.js new file mode 100644 index 0000000..80ec206 --- /dev/null +++ b/node_modules/cacache/lib/get.js @@ -0,0 +1,170 @@ +'use strict' + +const Collect = require('minipass-collect') +const { Minipass } = require('minipass') +const Pipeline = require('minipass-pipeline') + +const index = require('./entry-index') +const memo = require('./memoization') +const read = require('./content/read') + +async function getData (cache, key, opts = {}) { + const { integrity, memoize, size } = opts + const memoized = memo.get(cache, key, opts) + if (memoized && memoize !== false) { + return { + metadata: memoized.entry.metadata, + data: memoized.data, + integrity: memoized.entry.integrity, + size: memoized.entry.size, + } + } + + const entry = await index.find(cache, key, opts) + if (!entry) { + throw new index.NotFoundError(cache, key) + } + const data = await read(cache, entry.integrity, { integrity, size }) + if (memoize) { + memo.put(cache, entry, data, opts) + } + + return { + data, + metadata: entry.metadata, + size: entry.size, + integrity: entry.integrity, + } +} +module.exports = getData + +async function getDataByDigest (cache, key, opts = {}) { + const { integrity, memoize, size } = opts + const memoized = memo.get.byDigest(cache, key, opts) + if (memoized && memoize !== false) { + return memoized + } + + const res = await read(cache, key, { integrity, size }) + if (memoize) { + memo.put.byDigest(cache, key, res, opts) + } + return res +} +module.exports.byDigest = getDataByDigest + +const getMemoizedStream = (memoized) => { + const stream = new Minipass() + stream.on('newListener', function (ev, cb) { + ev === 'metadata' && cb(memoized.entry.metadata) + ev === 'integrity' && cb(memoized.entry.integrity) + ev === 'size' && cb(memoized.entry.size) + }) + stream.end(memoized.data) + return stream +} + +function getStream (cache, key, opts = {}) { + const { memoize, size } = opts + const memoized = memo.get(cache, key, opts) + if (memoized && memoize !== false) { + return getMemoizedStream(memoized) + } + + const stream = new Pipeline() + // Set all this up to run on the stream and then just return the stream + Promise.resolve().then(async () => { + const entry = await index.find(cache, key) + if (!entry) { + throw new index.NotFoundError(cache, key) + } + + stream.emit('metadata', entry.metadata) + stream.emit('integrity', entry.integrity) + stream.emit('size', entry.size) + stream.on('newListener', function (ev, cb) { + ev === 'metadata' && cb(entry.metadata) + ev === 'integrity' && cb(entry.integrity) + ev === 'size' && cb(entry.size) + }) + + const src = read.readStream( + cache, + entry.integrity, + { ...opts, size: typeof size !== 'number' ? entry.size : size } + ) + + if (memoize) { + const memoStream = new Collect.PassThrough() + memoStream.on('collect', data => memo.put(cache, entry, data, opts)) + stream.unshift(memoStream) + } + stream.unshift(src) + return stream + }).catch((err) => stream.emit('error', err)) + + return stream +} + +module.exports.stream = getStream + +function getStreamDigest (cache, integrity, opts = {}) { + const { memoize } = opts + const memoized = memo.get.byDigest(cache, integrity, opts) + if (memoized && memoize !== false) { + const stream = new Minipass() + stream.end(memoized) + return stream + } else { + const stream = read.readStream(cache, integrity, opts) + if (!memoize) { + return stream + } + + const memoStream = new Collect.PassThrough() + memoStream.on('collect', data => memo.put.byDigest( + cache, + integrity, + data, + opts + )) + return new Pipeline(stream, memoStream) + } +} + +module.exports.stream.byDigest = getStreamDigest + +function info (cache, key, opts = {}) { + const { memoize } = opts + const memoized = memo.get(cache, key, opts) + if (memoized && memoize !== false) { + return Promise.resolve(memoized.entry) + } else { + return index.find(cache, key) + } +} +module.exports.info = info + +async function copy (cache, key, dest, opts = {}) { + const entry = await index.find(cache, key, opts) + if (!entry) { + throw new index.NotFoundError(cache, key) + } + await read.copy(cache, entry.integrity, dest, opts) + return { + metadata: entry.metadata, + size: entry.size, + integrity: entry.integrity, + } +} + +module.exports.copy = copy + +async function copyByDigest (cache, key, dest, opts = {}) { + await read.copy(cache, key, dest, opts) + return key +} + +module.exports.copy.byDigest = copyByDigest + +module.exports.hasContent = read.hasContent diff --git a/node_modules/cacache/lib/index.js b/node_modules/cacache/lib/index.js new file mode 100644 index 0000000..c9b0da5 --- /dev/null +++ b/node_modules/cacache/lib/index.js @@ -0,0 +1,42 @@ +'use strict' + +const get = require('./get.js') +const put = require('./put.js') +const rm = require('./rm.js') +const verify = require('./verify.js') +const { clearMemoized } = require('./memoization.js') +const tmp = require('./util/tmp.js') +const index = require('./entry-index.js') + +module.exports.index = {} +module.exports.index.compact = index.compact +module.exports.index.insert = index.insert + +module.exports.ls = index.ls +module.exports.ls.stream = index.lsStream + +module.exports.get = get +module.exports.get.byDigest = get.byDigest +module.exports.get.stream = get.stream +module.exports.get.stream.byDigest = get.stream.byDigest +module.exports.get.copy = get.copy +module.exports.get.copy.byDigest = get.copy.byDigest +module.exports.get.info = get.info +module.exports.get.hasContent = get.hasContent + +module.exports.put = put +module.exports.put.stream = put.stream + +module.exports.rm = rm.entry +module.exports.rm.all = rm.all +module.exports.rm.entry = module.exports.rm +module.exports.rm.content = rm.content + +module.exports.clearMemoized = clearMemoized + +module.exports.tmp = {} +module.exports.tmp.mkdir = tmp.mkdir +module.exports.tmp.withTmp = tmp.withTmp + +module.exports.verify = verify +module.exports.verify.lastRun = verify.lastRun diff --git a/node_modules/cacache/lib/memoization.js b/node_modules/cacache/lib/memoization.js new file mode 100644 index 0000000..2ecc609 --- /dev/null +++ b/node_modules/cacache/lib/memoization.js @@ -0,0 +1,72 @@ +'use strict' + +const { LRUCache } = require('lru-cache') + +const MEMOIZED = new LRUCache({ + max: 500, + maxSize: 50 * 1024 * 1024, // 50MB + ttl: 3 * 60 * 1000, // 3 minutes + sizeCalculation: (entry, key) => key.startsWith('key:') ? entry.data.length : entry.length, +}) + +module.exports.clearMemoized = clearMemoized + +function clearMemoized () { + const old = {} + MEMOIZED.forEach((v, k) => { + old[k] = v + }) + MEMOIZED.clear() + return old +} + +module.exports.put = put + +function put (cache, entry, data, opts) { + pickMem(opts).set(`key:${cache}:${entry.key}`, { entry, data }) + putDigest(cache, entry.integrity, data, opts) +} + +module.exports.put.byDigest = putDigest + +function putDigest (cache, integrity, data, opts) { + pickMem(opts).set(`digest:${cache}:${integrity}`, data) +} + +module.exports.get = get + +function get (cache, key, opts) { + return pickMem(opts).get(`key:${cache}:${key}`) +} + +module.exports.get.byDigest = getDigest + +function getDigest (cache, integrity, opts) { + return pickMem(opts).get(`digest:${cache}:${integrity}`) +} + +class ObjProxy { + constructor (obj) { + this.obj = obj + } + + get (key) { + return this.obj[key] + } + + set (key, val) { + this.obj[key] = val + } +} + +function pickMem (opts) { + if (!opts || !opts.memoize) { + return MEMOIZED + } else if (opts.memoize.get && opts.memoize.set) { + return opts.memoize + } else if (typeof opts.memoize === 'object') { + return new ObjProxy(opts.memoize) + } else { + return MEMOIZED + } +} diff --git a/node_modules/cacache/lib/put.js b/node_modules/cacache/lib/put.js new file mode 100644 index 0000000..9fc932d --- /dev/null +++ b/node_modules/cacache/lib/put.js @@ -0,0 +1,80 @@ +'use strict' + +const index = require('./entry-index') +const memo = require('./memoization') +const write = require('./content/write') +const Flush = require('minipass-flush') +const { PassThrough } = require('minipass-collect') +const Pipeline = require('minipass-pipeline') + +const putOpts = (opts) => ({ + algorithms: ['sha512'], + ...opts, +}) + +module.exports = putData + +async function putData (cache, key, data, opts = {}) { + const { memoize } = opts + opts = putOpts(opts) + const res = await write(cache, data, opts) + const entry = await index.insert(cache, key, res.integrity, { ...opts, size: res.size }) + if (memoize) { + memo.put(cache, entry, data, opts) + } + + return res.integrity +} + +module.exports.stream = putStream + +function putStream (cache, key, opts = {}) { + const { memoize } = opts + opts = putOpts(opts) + let integrity + let size + let error + + let memoData + const pipeline = new Pipeline() + // first item in the pipeline is the memoizer, because we need + // that to end first and get the collected data. + if (memoize) { + const memoizer = new PassThrough().on('collect', data => { + memoData = data + }) + pipeline.push(memoizer) + } + + // contentStream is a write-only, not a passthrough + // no data comes out of it. + const contentStream = write.stream(cache, opts) + .on('integrity', (int) => { + integrity = int + }) + .on('size', (s) => { + size = s + }) + .on('error', (err) => { + error = err + }) + + pipeline.push(contentStream) + + // last but not least, we write the index and emit hash and size, + // and memoize if we're doing that + pipeline.push(new Flush({ + async flush () { + if (!error) { + const entry = await index.insert(cache, key, integrity, { ...opts, size }) + if (memoize && memoData) { + memo.put(cache, entry, memoData, opts) + } + pipeline.emit('integrity', integrity) + pipeline.emit('size', size) + } + }, + })) + + return pipeline +} diff --git a/node_modules/cacache/lib/rm.js b/node_modules/cacache/lib/rm.js new file mode 100644 index 0000000..a94760c --- /dev/null +++ b/node_modules/cacache/lib/rm.js @@ -0,0 +1,31 @@ +'use strict' + +const { rm } = require('fs/promises') +const glob = require('./util/glob.js') +const index = require('./entry-index') +const memo = require('./memoization') +const path = require('path') +const rmContent = require('./content/rm') + +module.exports = entry +module.exports.entry = entry + +function entry (cache, key, opts) { + memo.clearMemoized() + return index.delete(cache, key, opts) +} + +module.exports.content = content + +function content (cache, integrity) { + memo.clearMemoized() + return rmContent(cache, integrity) +} + +module.exports.all = all + +async function all (cache) { + memo.clearMemoized() + const paths = await glob(path.join(cache, '*(content-*|index-*)'), { silent: true, nosort: true }) + return Promise.all(paths.map((p) => rm(p, { recursive: true, force: true }))) +} diff --git a/node_modules/cacache/lib/util/glob.js b/node_modules/cacache/lib/util/glob.js new file mode 100644 index 0000000..8500c1c --- /dev/null +++ b/node_modules/cacache/lib/util/glob.js @@ -0,0 +1,7 @@ +'use strict' + +const { glob } = require('glob') +const path = require('path') + +const globify = (pattern) => pattern.split(path.win32.sep).join(path.posix.sep) +module.exports = (path, options) => glob(globify(path), options) diff --git a/node_modules/cacache/lib/util/hash-to-segments.js b/node_modules/cacache/lib/util/hash-to-segments.js new file mode 100644 index 0000000..445599b --- /dev/null +++ b/node_modules/cacache/lib/util/hash-to-segments.js @@ -0,0 +1,7 @@ +'use strict' + +module.exports = hashToSegments + +function hashToSegments (hash) { + return [hash.slice(0, 2), hash.slice(2, 4), hash.slice(4)] +} diff --git a/node_modules/cacache/lib/util/tmp.js b/node_modules/cacache/lib/util/tmp.js new file mode 100644 index 0000000..0bf5302 --- /dev/null +++ b/node_modules/cacache/lib/util/tmp.js @@ -0,0 +1,26 @@ +'use strict' + +const { withTempDir } = require('@npmcli/fs') +const fs = require('fs/promises') +const path = require('path') + +module.exports.mkdir = mktmpdir + +async function mktmpdir (cache, opts = {}) { + const { tmpPrefix } = opts + const tmpDir = path.join(cache, 'tmp') + await fs.mkdir(tmpDir, { recursive: true, owner: 'inherit' }) + // do not use path.join(), it drops the trailing / if tmpPrefix is unset + const target = `${tmpDir}${path.sep}${tmpPrefix || ''}` + return fs.mkdtemp(target, { owner: 'inherit' }) +} + +module.exports.withTmp = withTmp + +function withTmp (cache, opts, cb) { + if (!cb) { + cb = opts + opts = {} + } + return withTempDir(path.join(cache, 'tmp'), cb, opts) +} diff --git a/node_modules/cacache/lib/verify.js b/node_modules/cacache/lib/verify.js new file mode 100644 index 0000000..dcff3aa --- /dev/null +++ b/node_modules/cacache/lib/verify.js @@ -0,0 +1,258 @@ +'use strict' + +const { + mkdir, + readFile, + rm, + stat, + truncate, + writeFile, +} = require('fs/promises') +const contentPath = require('./content/path') +const fsm = require('fs-minipass') +const glob = require('./util/glob.js') +const index = require('./entry-index') +const path = require('path') +const ssri = require('ssri') + +const hasOwnProperty = (obj, key) => + Object.prototype.hasOwnProperty.call(obj, key) + +const verifyOpts = (opts) => ({ + concurrency: 20, + log: { silly () {} }, + ...opts, +}) + +module.exports = verify + +async function verify (cache, opts) { + opts = verifyOpts(opts) + opts.log.silly('verify', 'verifying cache at', cache) + + const steps = [ + markStartTime, + fixPerms, + garbageCollect, + rebuildIndex, + cleanTmp, + writeVerifile, + markEndTime, + ] + + const stats = {} + for (const step of steps) { + const label = step.name + const start = new Date() + const s = await step(cache, opts) + if (s) { + Object.keys(s).forEach((k) => { + stats[k] = s[k] + }) + } + const end = new Date() + if (!stats.runTime) { + stats.runTime = {} + } + stats.runTime[label] = end - start + } + stats.runTime.total = stats.endTime - stats.startTime + opts.log.silly( + 'verify', + 'verification finished for', + cache, + 'in', + `${stats.runTime.total}ms` + ) + return stats +} + +async function markStartTime () { + return { startTime: new Date() } +} + +async function markEndTime () { + return { endTime: new Date() } +} + +async function fixPerms (cache, opts) { + opts.log.silly('verify', 'fixing cache permissions') + await mkdir(cache, { recursive: true }) + return null +} + +// Implements a naive mark-and-sweep tracing garbage collector. +// +// The algorithm is basically as follows: +// 1. Read (and filter) all index entries ("pointers") +// 2. Mark each integrity value as "live" +// 3. Read entire filesystem tree in `content-vX/` dir +// 4. If content is live, verify its checksum and delete it if it fails +// 5. If content is not marked as live, rm it. +// +async function garbageCollect (cache, opts) { + opts.log.silly('verify', 'garbage collecting content') + const { default: pMap } = await import('p-map') + const indexStream = index.lsStream(cache) + const liveContent = new Set() + indexStream.on('data', (entry) => { + if (opts.filter && !opts.filter(entry)) { + return + } + + // integrity is stringified, re-parse it so we can get each hash + const integrity = ssri.parse(entry.integrity) + for (const algo in integrity) { + liveContent.add(integrity[algo].toString()) + } + }) + await new Promise((resolve, reject) => { + indexStream.on('end', resolve).on('error', reject) + }) + const contentDir = contentPath.contentDir(cache) + const files = await glob(path.join(contentDir, '**'), { + follow: false, + nodir: true, + nosort: true, + }) + const stats = { + verifiedContent: 0, + reclaimedCount: 0, + reclaimedSize: 0, + badContentCount: 0, + keptSize: 0, + } + await pMap( + files, + async (f) => { + const split = f.split(/[/\\]/) + const digest = split.slice(split.length - 3).join('') + const algo = split[split.length - 4] + const integrity = ssri.fromHex(digest, algo) + if (liveContent.has(integrity.toString())) { + const info = await verifyContent(f, integrity) + if (!info.valid) { + stats.reclaimedCount++ + stats.badContentCount++ + stats.reclaimedSize += info.size + } else { + stats.verifiedContent++ + stats.keptSize += info.size + } + } else { + // No entries refer to this content. We can delete. + stats.reclaimedCount++ + const s = await stat(f) + await rm(f, { recursive: true, force: true }) + stats.reclaimedSize += s.size + } + return stats + }, + { concurrency: opts.concurrency } + ) + return stats +} + +async function verifyContent (filepath, sri) { + const contentInfo = {} + try { + const { size } = await stat(filepath) + contentInfo.size = size + contentInfo.valid = true + await ssri.checkStream(new fsm.ReadStream(filepath), sri) + } catch (err) { + if (err.code === 'ENOENT') { + return { size: 0, valid: false } + } + if (err.code !== 'EINTEGRITY') { + throw err + } + + await rm(filepath, { recursive: true, force: true }) + contentInfo.valid = false + } + return contentInfo +} + +async function rebuildIndex (cache, opts) { + opts.log.silly('verify', 'rebuilding index') + const { default: pMap } = await import('p-map') + const entries = await index.ls(cache) + const stats = { + missingContent: 0, + rejectedEntries: 0, + totalEntries: 0, + } + const buckets = {} + for (const k in entries) { + /* istanbul ignore else */ + if (hasOwnProperty(entries, k)) { + const hashed = index.hashKey(k) + const entry = entries[k] + const excluded = opts.filter && !opts.filter(entry) + excluded && stats.rejectedEntries++ + if (buckets[hashed] && !excluded) { + buckets[hashed].push(entry) + } else if (buckets[hashed] && excluded) { + // skip + } else if (excluded) { + buckets[hashed] = [] + buckets[hashed]._path = index.bucketPath(cache, k) + } else { + buckets[hashed] = [entry] + buckets[hashed]._path = index.bucketPath(cache, k) + } + } + } + await pMap( + Object.keys(buckets), + (key) => { + return rebuildBucket(cache, buckets[key], stats, opts) + }, + { concurrency: opts.concurrency } + ) + return stats +} + +async function rebuildBucket (cache, bucket, stats) { + await truncate(bucket._path) + // This needs to be serialized because cacache explicitly + // lets very racy bucket conflicts clobber each other. + for (const entry of bucket) { + const content = contentPath(cache, entry.integrity) + try { + await stat(content) + await index.insert(cache, entry.key, entry.integrity, { + metadata: entry.metadata, + size: entry.size, + time: entry.time, + }) + stats.totalEntries++ + } catch (err) { + if (err.code === 'ENOENT') { + stats.rejectedEntries++ + stats.missingContent++ + } else { + throw err + } + } + } +} + +function cleanTmp (cache, opts) { + opts.log.silly('verify', 'cleaning tmp directory') + return rm(path.join(cache, 'tmp'), { recursive: true, force: true }) +} + +async function writeVerifile (cache, opts) { + const verifile = path.join(cache, '_lastverified') + opts.log.silly('verify', 'writing verifile to ' + verifile) + return writeFile(verifile, `${Date.now()}`) +} + +module.exports.lastRun = lastRun + +async function lastRun (cache) { + const data = await readFile(path.join(cache, '_lastverified'), { encoding: 'utf8' }) + return new Date(+data) +} diff --git a/node_modules/cacache/package.json b/node_modules/cacache/package.json new file mode 100644 index 0000000..ebb0f3f --- /dev/null +++ b/node_modules/cacache/package.json @@ -0,0 +1,83 @@ +{ + "name": "cacache", + "version": "19.0.1", + "cache-version": { + "content": "2", + "index": "5" + }, + "description": "Fast, fault-tolerant, cross-platform, disk-based, data-agnostic, content-addressable cache.", + "main": "lib/index.js", + "files": [ + "bin/", + "lib/" + ], + "scripts": { + "test": "tap", + "snap": "tap", + "coverage": "tap", + "test-docker": "docker run -it --rm --name pacotest -v \"$PWD\":/tmp -w /tmp node:latest npm test", + "lint": "npm run eslint", + "npmclilint": "npmcli-lint", + "lintfix": "npm run eslint -- --fix", + "postsnap": "npm run lintfix --", + "postlint": "template-oss-check", + "posttest": "npm run lint", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/cacache.git" + }, + "keywords": [ + "cache", + "caching", + "content-addressable", + "sri", + "sri hash", + "subresource integrity", + "cache", + "storage", + "store", + "file store", + "filesystem", + "disk cache", + "disk storage" + ], + "license": "ISC", + "dependencies": { + "@npmcli/fs": "^4.0.0", + "fs-minipass": "^3.0.0", + "glob": "^10.2.2", + "lru-cache": "^10.0.1", + "minipass": "^7.0.3", + "minipass-collect": "^2.0.1", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "p-map": "^7.0.2", + "ssri": "^12.0.0", + "tar": "^7.4.3", + "unique-filename": "^4.0.0" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.3", + "tap": "^16.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "windowsCI": false, + "version": "4.23.3", + "publish": "true" + }, + "author": "GitHub Inc.", + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/chalk/license b/node_modules/chalk/license new file mode 100644 index 0000000..fa7ceba --- /dev/null +++ b/node_modules/chalk/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +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: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +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. diff --git a/node_modules/chalk/package.json b/node_modules/chalk/package.json new file mode 100644 index 0000000..23b4ce3 --- /dev/null +++ b/node_modules/chalk/package.json @@ -0,0 +1,83 @@ +{ + "name": "chalk", + "version": "5.4.1", + "description": "Terminal string styling done right", + "license": "MIT", + "repository": "chalk/chalk", + "funding": "https://github.com/chalk/chalk?sponsor=1", + "type": "module", + "main": "./source/index.js", + "exports": "./source/index.js", + "imports": { + "#ansi-styles": "./source/vendor/ansi-styles/index.js", + "#supports-color": { + "node": "./source/vendor/supports-color/index.js", + "default": "./source/vendor/supports-color/browser.js" + } + }, + "types": "./source/index.d.ts", + "sideEffects": false, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "scripts": { + "test": "xo && c8 ava && tsd", + "bench": "matcha benchmark.js" + }, + "files": [ + "source", + "!source/index.test-d.ts" + ], + "keywords": [ + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "ansi", + "style", + "styles", + "tty", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "devDependencies": { + "@types/node": "^16.11.10", + "ava": "^3.15.0", + "c8": "^7.10.0", + "color-convert": "^2.0.1", + "execa": "^6.0.0", + "log-update": "^5.0.0", + "matcha": "^0.7.0", + "tsd": "^0.19.0", + "xo": "^0.57.0", + "yoctodelay": "^2.0.0" + }, + "xo": { + "rules": { + "unicorn/prefer-string-slice": "off", + "@typescript-eslint/consistent-type-imports": "off", + "@typescript-eslint/consistent-type-exports": "off", + "@typescript-eslint/consistent-type-definitions": "off", + "unicorn/expiring-todo-comments": "off" + } + }, + "c8": { + "reporter": [ + "text", + "lcov" + ], + "exclude": [ + "source/vendor" + ] + } +} diff --git a/node_modules/chalk/readme.md b/node_modules/chalk/readme.md new file mode 100644 index 0000000..5754e7c --- /dev/null +++ b/node_modules/chalk/readme.md @@ -0,0 +1,297 @@ +

+
+
+ Chalk +
+
+
+

+ +> Terminal string styling done right + +[![Coverage Status](https://codecov.io/gh/chalk/chalk/branch/main/graph/badge.svg)](https://codecov.io/gh/chalk/chalk) +[![npm dependents](https://badgen.net/npm/dependents/chalk)](https://www.npmjs.com/package/chalk?activeTab=dependents) +[![Downloads](https://badgen.net/npm/dt/chalk)](https://www.npmjs.com/package/chalk) + +![](media/screenshot.png) + +## Info + +- [Why not switch to a smaller coloring package?](https://github.com/chalk/chalk?tab=readme-ov-file#why-not-switch-to-a-smaller-coloring-package) +- See [yoctocolors](https://github.com/sindresorhus/yoctocolors) for a smaller alternative + +## Highlights + +- Expressive API +- Highly performant +- No dependencies +- Ability to nest styles +- [256/Truecolor color support](#256-and-truecolor-color-support) +- Auto-detects color support +- Doesn't extend `String.prototype` +- Clean and focused +- Actively maintained +- [Used by ~115,000 packages](https://www.npmjs.com/browse/depended/chalk) as of July 4, 2024 + +## Install + +```sh +npm install chalk +``` + +**IMPORTANT:** Chalk 5 is ESM. If you want to use Chalk with TypeScript or a build tool, you will probably want to use Chalk 4 for now. [Read more.](https://github.com/chalk/chalk/releases/tag/v5.0.0) + +## Usage + +```js +import chalk from 'chalk'; + +console.log(chalk.blue('Hello world!')); +``` + +Chalk comes with an easy to use composable API where you just chain and nest the styles you want. + +```js +import chalk from 'chalk'; + +const log = console.log; + +// Combine styled and normal strings +log(chalk.blue('Hello') + ' World' + chalk.red('!')); + +// Compose multiple styles using the chainable API +log(chalk.blue.bgRed.bold('Hello world!')); + +// Pass in multiple arguments +log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz')); + +// Nest styles +log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!')); + +// Nest styles of the same type even (color, underline, background) +log(chalk.green( + 'I am a green line ' + + chalk.blue.underline.bold('with a blue substring') + + ' that becomes green again!' +)); + +// ES2015 template literal +log(` +CPU: ${chalk.red('90%')} +RAM: ${chalk.green('40%')} +DISK: ${chalk.yellow('70%')} +`); + +// Use RGB colors in terminal emulators that support it. +log(chalk.rgb(123, 45, 67).underline('Underlined reddish color')); +log(chalk.hex('#DEADED').bold('Bold gray!')); +``` + +Easily define your own themes: + +```js +import chalk from 'chalk'; + +const error = chalk.bold.red; +const warning = chalk.hex('#FFA500'); // Orange color + +console.log(error('Error!')); +console.log(warning('Warning!')); +``` + +Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args): + +```js +import chalk from 'chalk'; + +const name = 'Sindre'; +console.log(chalk.green('Hello %s'), name); +//=> 'Hello Sindre' +``` + +## API + +### chalk.`