Showing preview only (1,351K chars total). Download the full file or copy to clipboard to get everything.
Repository: google/zx
Branch: main
Commit: 98531fcf3455
Files: 168
Total size: 1.3 MB
Directory structure:
gitextract_tzwf6ncx/
├── .commitlintrc
├── .gitattributes
├── .github/
│ ├── FUNDING.yml
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug.yml
│ │ └── idea.yml
│ ├── PULL_REQUEST_TEMPLATE.md
│ ├── SECURITY.md
│ ├── codeql/
│ │ └── codeql-config.yml
│ ├── pages/
│ │ └── index.html
│ └── workflows/
│ ├── codeql.yml
│ ├── dev-publish.yml
│ ├── docs.yml
│ ├── jsr-publish.yml
│ ├── osv.yml
│ ├── publish.yml
│ ├── test.yml
│ └── zizmor.yml
├── .gitignore
├── .node_version
├── .nycrc
├── .prettierignore
├── .size-limit.json
├── LICENSE
├── README.md
├── build/
│ ├── 3rd-party-licenses
│ ├── cli.cjs
│ ├── cli.d.ts
│ ├── cli.js
│ ├── core.cjs
│ ├── core.d.ts
│ ├── core.js
│ ├── deno.js
│ ├── deps.cjs
│ ├── deps.d.ts
│ ├── error.d.ts
│ ├── esblib.cjs
│ ├── globals.cjs
│ ├── globals.d.ts
│ ├── globals.js
│ ├── goods.d.ts
│ ├── index.cjs
│ ├── index.d.ts
│ ├── index.js
│ ├── internals.cjs
│ ├── internals.d.ts
│ ├── log.d.ts
│ ├── md.d.ts
│ ├── util.cjs
│ ├── util.d.ts
│ ├── vendor-core.cjs
│ ├── vendor-core.d.ts
│ ├── vendor-extra.cjs
│ ├── vendor-extra.d.ts
│ ├── vendor.cjs
│ ├── vendor.d.ts
│ └── versions.d.ts
├── dcr/
│ └── Dockerfile
├── docs/
│ ├── .gitignore
│ ├── .vitepress/
│ │ ├── config.mts
│ │ └── theme/
│ │ ├── MyLayout.vue
│ │ ├── MyOxygen.vue
│ │ ├── custom.css
│ │ └── index.js
│ ├── api.md
│ ├── architecture.md
│ ├── cli.md
│ ├── configuration.md
│ ├── contribution.md
│ ├── faq.md
│ ├── getting-started.md
│ ├── index.md
│ ├── known-issues.md
│ ├── lite.md
│ ├── markdown.md
│ ├── migration-from-v7.md
│ ├── process-output.md
│ ├── process-promise.md
│ ├── quotes.md
│ ├── setup.md
│ ├── shell.md
│ ├── typescript.md
│ └── versions.md
├── examples/
│ ├── background-process.mjs
│ ├── backup-github.mjs
│ ├── fetch-weather.mjs
│ ├── hello.mjs
│ ├── interactive.mjs
│ └── parallel.mjs
├── lefthook.yml
├── man/
│ └── zx.1
├── package.json
├── scripts/
│ ├── build-clean.mjs
│ ├── build-dts.mjs
│ ├── build-js.mjs
│ ├── build-jsr.mjs
│ ├── build-pkgjson-lite.mjs
│ ├── build-pkgjson-main.mjs
│ ├── build-tests.mjs
│ ├── build-versions.mjs
│ ├── deno.polyfill.js
│ └── import-meta-url.polyfill.js
├── src/
│ ├── cli.ts
│ ├── core.ts
│ ├── deps.ts
│ ├── error.ts
│ ├── globals-jsr.ts
│ ├── globals.ts
│ ├── goods.ts
│ ├── index.ts
│ ├── internals.ts
│ ├── log.ts
│ ├── md.ts
│ ├── repl.ts
│ ├── util.ts
│ ├── vendor-core.ts
│ ├── vendor-extra.ts
│ ├── vendor.ts
│ └── versions.ts
├── test/
│ ├── all.test.js
│ ├── bench/
│ │ └── buf-join.mjs
│ ├── cli.test.js
│ ├── core.test.js
│ ├── deps.test.js
│ ├── error.test.ts
│ ├── export.test.js
│ ├── extra.test.js
│ ├── fixtures/
│ │ ├── argv.mjs
│ │ ├── copyright.txt
│ │ ├── echo.http
│ │ ├── exit-code.mjs
│ │ ├── filename-dirname.mjs
│ │ ├── interactive.mjs
│ │ ├── js-project/
│ │ │ ├── package.json
│ │ │ └── script.js
│ │ ├── markdown-crlf.md
│ │ ├── markdown.md
│ │ ├── md.http
│ │ ├── no-extension
│ │ ├── no-extension.mjs
│ │ ├── non-std-ext.zx
│ │ ├── require.mjs
│ │ ├── server.mjs
│ │ └── ts-project/
│ │ ├── package.json
│ │ ├── script.ts
│ │ └── tsconfig.json
│ ├── global.test.js
│ ├── goods.test.ts
│ ├── index.test.js
│ ├── it/
│ │ ├── build-dcr.test.js
│ │ ├── build-jsr.test.js
│ │ └── build-npm.test.js
│ ├── log.test.ts
│ ├── md.test.ts
│ ├── smoke/
│ │ ├── bun.test.js
│ │ ├── deno.test.js
│ │ ├── node.test.cjs
│ │ ├── node.test.mjs
│ │ ├── ts.test.ts
│ │ ├── tsconfig.json
│ │ ├── tsconfig.test.json
│ │ └── win32.test.js
│ ├── util.test.js
│ └── vendor.test.js
├── test-d/
│ ├── core.test-d.ts
│ ├── globals.test-d.ts
│ └── goods.test-d.ts
├── tsconfig.json
└── zizmor.yml
================================================
FILE CONTENTS
================================================
================================================
FILE: .commitlintrc
================================================
{
"extends": [
"@commitlint/config-conventional"
],
"rules": {
"type-enum": [
2,
"always",
[
"build",
"ci",
"chore",
"docs",
"feat",
"fix",
"perf",
"refactor",
"revert",
"style",
"test"
]
],
}
}
================================================
FILE: .gitattributes
================================================
test/fixtures/markdown-crlf.md eol=crlf
build/** linguist-language=txt
================================================
FILE: .github/FUNDING.yml
================================================
github: antonmedv
================================================
FILE: .github/ISSUE_TEMPLATE/bug.yml
================================================
name: Bug Report
description: File a bug report.
title: '[Bug]: '
labels: ['bug']
assignees:
- antongolub
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: textarea
id: what-happened
attributes:
label: What happened?
placeholder: Tell us what you see.
value: 'A bug happened!'
validations:
required: true
- type: textarea
id: what-expected
attributes:
label: How it should work?
description: Also tell us, what did you expect to happen?
value: "Here's how it should work..."
validations:
required: true
- type: textarea
id: steps-to-reproduce
attributes:
label: How to reproduce the bug?
description: Show an example.
value: 'Step-by-step instructions to reproduce the behavior. Code snippet, gist or issue-demo repository are helpful'
validations:
required: true
- type: input
id: version
attributes:
label: Version
description: What zx version are you running?
placeholder: e.g. 0.0.0
validations:
required: true
- type: dropdown
id: os
attributes:
label: What's OS kind?
multiple: true
options:
- Linux
- Mac
- Windows
- type: dropdown
id: runtime
attributes:
label: What JS runtime is used?
multiple: true
options:
- Node.js
- Deno
- Bun
- GraalVM
- type: input
id: runtime-version
attributes:
label: Runtime Version
description: What JS runtime version are you running?
placeholder: e.g. 0.0.0
- type: textarea
id: logs
attributes:
label: Error stack / relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: shell
- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/google/zx?tab=coc-ov-file).
options:
- label: I agree to follow this project's Code of Conduct
required: true
================================================
FILE: .github/ISSUE_TEMPLATE/idea.yml
================================================
name: Feature Request
description: Idea, feature request or proposal.
title: '[Idea]: '
labels: ['feature']
assignees:
- antonmedv
body:
- type: markdown
attributes:
value: |
Thanks for sharing your vision!
- type: textarea
id: idea
attributes:
label: What's your idea?
placeholder: Tell us what you'd like to add or improve.
value: 'A new shiny feature!'
validations:
required: true
- type: textarea
id: why
attributes:
label: Why is that needed? How it may be useful?
placeholder: What problem does it solve?.
value: 'It will make something easier because...'
validations:
required: true
- type: textarea
id: demo
attributes:
label: Maybe you have a demo or example?
value: 'API sketch, code snippet'
render: ts
validations:
required: false
================================================
FILE: .github/PULL_REQUEST_TEMPLATE.md
================================================
<!-- It's a good idea to open an issue first for discussion. -->
Fixes #issue / suggests an improvement
<!-- Usage demo -->
```ts
import {$} from 'zx'
```
- [ ] **Setup** Set the latest Node.js LTS version.
- [ ] **Build**: I’ve run `npm build` before committing and verified the bundle updates correctly.
- [ ] **Tests**: I’ve `run test` and confirmed all tests succeed. Added tests to cover my changes if needed.
- [ ] **Docs**: I’ve added or updated relevant documentation as needed.
- [ ] **Sign** Commits have [verified signatures](https://docs.github.com/en/enterprise-cloud@latest/authentication/managing-commit-signature-verification/about-commit-signature-verification) and follow [conventinal commits spec](https://www.conventionalcommits.org/en/v1.0.0/)
- [ ] **CoC**: My changes follow [the project’s coding guidelines and Code of Conduct](https://github.com/google/zx?tab=coc-ov-file).
- [ ] **Review**: This PR represents original work and is not solely generated by AI tools.
================================================
FILE: .github/SECURITY.md
================================================
# Security Policy
## Supported Versions
| Version | Status | Comment |
|---------|--------------------|-----------------------------------------------------------------------|
| 8.x | :white_check_mark: | |
| 7.x | :warning: | Bugs, vulnerabilities, compatibility enhancements, performance issues |
| 6.x | :warning: | Critical bugs and vulnerability fixes |
| < 6.0 | :x: | **No longer supported**, please consider upgrade options |
## Reporting a Vulnerability
Please use https://g.co/vulnz to report security vulnerabilities.
We use https://g.co/vulnz for our intake and triage. For valid issues we will do coordination and disclosure here on
GitHub (including using a GitHub Security Advisory when necessary).
The Google Security Team will process your report within a day, and respond within a week (although it will depend on the severity of your report).
================================================
FILE: .github/codeql/codeql-config.yml
================================================
paths:
- .github
- docs
- examples
- man
- src
- scripts
- test
- test-d
paths-ignore:
- build
================================================
FILE: .github/pages/index.html
================================================
Here be dragons
================================================
FILE: .github/workflows/codeql.yml
================================================
name: 'CodeQL Advanced'
on:
push:
branches: ['main']
pull_request:
branches: ['main']
schedule:
- cron: '28 6 * * 3'
permissions: {}
jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: 60
permissions:
# required for all workflows
security-events: write
# required to fetch internal or private CodeQL packs
packages: read
# only required for workflows in private repositories
actions: read
contents: read
strategy:
fail-fast: false
matrix:
include:
- language: javascript-typescript
build-mode: none
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
config-file: ./.github/codeql/codeql-config.yml
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
- if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: '/language:${{matrix.language}}'
================================================
FILE: .github/workflows/dev-publish.yml
================================================
name: Dev Publish
on:
workflow_dispatch:
permissions: {}
env:
npm_config_audit: false
npm_config_fund: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/setup-node@v6
with:
node-version: 24
cache: 'npm'
- run: npm ci
- run: npm test
env:
FORCE_COLOR: 3
- uses: actions/upload-artifact@v6
with:
name: build-${{ github.run_id }}
path: |
build
jsr.json
package.json
package-lite.json
package-main.json
retention-days: 1
version:
runs-on: ubuntu-latest
outputs:
v: ${{ steps.ref.outputs.ZX_VERSION }}
lite: ${{ steps.ref.outputs.ZX_VERSION }}-lite
dev: ${{ steps.ref.outputs.ZX_VERSION }}-dev.${{ steps.ref.outputs.SHA_SHORT }}
lite-dev: ${{ steps.ref.outputs.ZX_VERSION }}-lite-dev.${{ steps.ref.outputs.SHA_SHORT }}
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- id: ref
run: |
echo SHA_SHORT=$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT
echo ZX_VERSION=$(jq -r '.version' package.json) >> $GITHUB_OUTPUT
npm-publish:
needs: [build, version]
runs-on: ubuntu-latest
permissions:
checks: read
statuses: write
contents: write
packages: write
id-token: write
env:
GOOGLE_NPM_REGISTRY: wombat-dressing-room.appspot.com
GOOGLE_NPM_TOKEN: ${{ secrets.AUTH_TOKEN }}
GH_NPM_REGISTRY: npm.pkg.github.com
GH_NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ZX_VERSION: ${{ needs.version.outputs.v }}
ZX_DEV_VERSION: ${{ needs.version.outputs.dev }}
ZX_LITE_DEV_VERSION: ${{ needs.version.outputs.lite-dev }}
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/setup-node@v6
with:
node-version: 24
cache: 'npm'
- name: Configure npmrc
run: |
echo "//${{ env.GOOGLE_NPM_REGISTRY }}/:_authToken=$GOOGLE_NPM_TOKEN" >> .npmrc
echo "//${{ env.GH_NPM_REGISTRY }}/:_authToken=$GH_NPM_TOKEN" >> .npmrc
- uses: actions/download-artifact@v7
with:
name: build-${{ github.run_id }}
- name: pushing lite snapshot to ${{ env.GOOGLE_NPM_REGISTRY }}
run: |
mv -f package-lite.json package.json
cat <<< $(jq '.version="${ZX_LITE_DEV_VERSION}"' package.json) > package.json
npm publish --provenance --access=public --no-git-tag-version --tag dev --registry https://${{ env.GOOGLE_NPM_REGISTRY }}
- name: pushing to ${{ env.GOOGLE_NPM_REGISTRY }}
run: |
mv -f package-main.json package.json
cat <<< $(jq '.version="${ZX_DEV_VERSION}"' package.json) > package.json
npm publish --provenance --access=public --no-git-tag-version --tag dev --registry https://${{ env.GOOGLE_NPM_REGISTRY }}
- name: pushing to ${{ env.GH_NPM_REGISTRY }}
run: |
cat <<< $(jq '.name="@${{ github.repository }}"' package.json) > package.json
npm publish --no-git-tag-version --access=public --tag dev --registry https://${{ env.GH_NPM_REGISTRY }}
jsr-publish:
needs: [build, version]
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
env:
ZX_DEV_VERSION: ${{ needs.version.outputs.dev }}
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/setup-node@v6
with:
node-version: 24
cache: 'npm'
- uses: actions/download-artifact@v7
with:
name: build-${{ github.run_id }}
- name: pushing to jsr.io
run: |
cat <<< $(jq '.version="${ZX_DEV_VERSION}"' jsr.json) > jsr.json
npx jsr publish --allow-dirty
# https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-docker-images
docker-publish:
needs: [build, version]
runs-on: ubuntu-latest
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
attestations: write
id-token: write
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
ZX_DEV_VERSION: ${{ needs.version.outputs.dev }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/download-artifact@v7
with:
name: build-${{ github.run_id }}
# Uses the `docker/login-action` action to log in to the Container registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
- name: Log in to the Container registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha
type=semver,pattern={{version}},value=v${{ env.ZX_DEV_VERSION }}
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see [Usage](https://github.com/docker/build-push-action#usage) in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker image
id: push
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 #v6.18.0
with:
context: ./
file: ./dcr/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see [Using artifact attestations to establish provenance for builds](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds).
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v3
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
================================================
FILE: .github/workflows/docs.yml
================================================
name: Deploy docs
on:
workflow_dispatch:
release:
types: [created]
concurrency:
group: 'pages'
cancel-in-progress: false
permissions: {}
env:
npm_config_audit: false
npm_config_fund: false
npm_config_save: false
npm_config_package_lock: false
jobs:
deploy:
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
persist-credentials: false
ref: main
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Install deps
run: npm ci
- name: Add additional deps
run: npm i @rollup/rollup-linux-x64-gnu@4.46.4
- name: Build docs
run: npm run docs:build
- name: Upload artifact
uses: actions/upload-pages-artifact@v4.0.0
with:
path: 'docs/build'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
================================================
FILE: .github/workflows/jsr-publish.yml
================================================
name: JSR Manual Publish
on:
workflow_dispatch:
permissions: {}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/setup-node@v6
with:
node-version: 24
cache: 'npm'
- run: npm ci
- run: npm test
env:
FORCE_COLOR: 3
- uses: actions/upload-artifact@v6
with:
name: build-${{ github.run_id }}
path: |
build
jsr.json
retention-days: 1
jsr-publish:
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/setup-node@v6
with:
node-version: 24
cache: 'npm'
- uses: actions/download-artifact@v7
with:
name: build-${{ github.run_id }}
- name: Get zx version info
run: |
echo SHA_SHORT=$(git rev-parse --short HEAD) >> $GITHUB_ENV
echo ZX_VERSION=$(jq -r '.version' jsr.json) >> $GITHUB_ENV
- name: pushing to jsr.io
run: |
cat <<< $(jq '.version="${ZX_VERSION}-dev.${SHA_SHORT}"' jsr.json) > jsr.json
npx jsr publish --allow-dirty
================================================
FILE: .github/workflows/osv.yml
================================================
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# A sample workflow which sets up periodic OSV-Scanner scanning for vulnerabilities,
# in addition to a PR check which fails if new vulnerabilities are introduced.
#
# For more examples and options, including how to ignore specific vulnerabilities,
# see https://google.github.io/osv-scanner/github-action/
name: OSV-Scanner
permissions: {}
on:
pull_request:
branches: ['main']
merge_group:
branches: ['main']
schedule:
- cron: '45 6 * * 5'
push:
branches: ['main']
jobs:
scan-scheduled:
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
permissions:
security-events: write
contents: read
actions: read
uses: 'google/osv-scanner-action/.github/workflows/osv-scanner-reusable.yml@e92b5d07338d4f0ba0981dffed17c48976ca4730' # v2.2.3
with:
# Example of specifying custom arguments
scan-args: |-
-r
./
scan-pr:
if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
permissions:
security-events: write
contents: read
actions: read
uses: 'google/osv-scanner-action/.github/workflows/osv-scanner-reusable-pr.yml@e92b5d07338d4f0ba0981dffed17c48976ca4730' # v2.2.3
with:
# Example of specifying custom arguments
scan-args: |-
-r
./
================================================
FILE: .github/workflows/publish.yml
================================================
name: Publish
on:
workflow_dispatch:
release:
types: [created]
permissions: {}
env:
npm_config_audit: false
npm_config_fund: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/setup-node@v6
with:
node-version: 24
cache: 'npm'
- name: Compare release tag with package.json
if: github.event_name == 'release'
run: |
RELEASE_VERSION=${GITHUB_REF#refs/tags/}
PKG_VERSION=$(node -p "require('./package.json').version")
echo "Release tag: $RELEASE_VERSION"
echo "package.json: $PKG_VERSION"
[ "$RELEASE_VERSION" = "$PKG_VERSION" ] || { echo "❌ Mismatch"; exit 1; }
- run: npm ci
- run: npm test
env:
FORCE_COLOR: 3
- uses: actions/upload-artifact@v6
with:
name: build-${{ github.run_id }}
path: |
build
jsr.json
package.json
package-lite.json
package-main.json
retention-days: 1
version:
runs-on: ubuntu-latest
outputs:
v: ${{ steps.ref.outputs.ZX_VERSION }}
lite: ${{ steps.ref.outputs.ZX_VERSION }}-lite
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- id: ref
run: |
echo SHA_SHORT=$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT
echo ZX_VERSION=$(jq -r '.version' package.json) >> $GITHUB_OUTPUT
npm-publish:
needs: [build, version]
runs-on: ubuntu-latest
permissions:
checks: read
statuses: write
contents: write
packages: write
id-token: write
env:
GOOGLE_NPM_REGISTRY: wombat-dressing-room.appspot.com
GOOGLE_NPM_TOKEN: ${{ secrets.AUTH_TOKEN }}
GH_NPM_REGISTRY: npm.pkg.github.com
GH_NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ZX_VERSION: ${{ needs.version.outputs.v }}
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/setup-node@v6
with:
node-version: 24
cache: 'npm'
- name: Configure npmrc
run: |
echo "//${{ env.GOOGLE_NPM_REGISTRY }}/:_authToken=$GOOGLE_NPM_TOKEN" >> .npmrc
echo "//${{ env.GH_NPM_REGISTRY }}/:_authToken=$GH_NPM_TOKEN" >> .npmrc
- uses: actions/download-artifact@v7
with:
name: build-${{ github.run_id }}
- name: pushing to ${{ env.GOOGLE_NPM_REGISTRY }}
run: |
mv -f package-main.json package.json
npm publish --provenance --access=public --registry https://${{ env.GOOGLE_NPM_REGISTRY }}
- name: pushing to ${{ env.GH_NPM_REGISTRY }}
run: |
cat <<< $(jq '.name="@${{ github.repository }}"' package.json) > package.json
npm publish --no-git-tag-version --access=public --registry https://${{ env.GH_NPM_REGISTRY }}
- name: pushing lite snapshot to ${{ env.GOOGLE_NPM_REGISTRY }}
run: |
mv -f package-lite.json package.json
npm publish --provenance --access=public --no-git-tag-version --tag lite --registry https://${{ env.GOOGLE_NPM_REGISTRY }}
jsr-publish:
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/setup-node@v6
with:
node-version: 24
cache: 'npm'
- uses: actions/download-artifact@v7
with:
name: build-${{ github.run_id }}
- name: pushing to jsr.io
run: npx jsr publish --allow-dirty
docker-publish:
needs: [build, version]
runs-on: ubuntu-latest
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
ZX_VERSION: ${{ needs.version.outputs.v }}
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/download-artifact@v7
with:
name: build-${{ github.run_id }}
- name: Log in to the Container registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha
type=semver,pattern={{version}},value=v${{ env.ZX_VERSION }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 #v6.18.0
with:
context: ./
file: ./dcr/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v3
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
================================================
FILE: .github/workflows/test.yml
================================================
name: Test
on:
push:
pull_request:
schedule:
- cron: '0 12 */4 * *'
permissions:
contents: read
env:
npm_config_audit: false
npm_config_fund: false
npm_config_save: false
npm_config_package_lock: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Use Node.js 24
uses: actions/setup-node@v6
with:
node-version: 24
cache: 'npm'
- run: npm ci
- run: |
npm run build
cd build && ls -l
- uses: actions/upload-artifact@v6
with:
name: build
path: |
build
jsr.json
package.json
package-lite.json
package-main.json
retention-days: 1
checks:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
fetch-depth: ${{ github.event_name == 'pull_request' && '15' || '1' }} # to ensure we have enough history for commitlint
- name: Use Node.js 24
uses: actions/setup-node@v6
with:
node-version: 24
cache: 'npm'
- uses: actions/download-artifact@v7
with:
name: build
- run: npm ci
- name: Format
run: npm run fmt:check
- name: License
run: npm run test:license
- name: Size
run: npm run test:size
- name: Dep audit
run: npm run test:audit
- name: Circular
run: npm run test:circular
- name: Bundles
run: npm run test:npm
timeout-minutes: 1
- name: JSR dry-run
run: npm run test:jsr
- name: Conventional Commits
if: github.event_name == 'pull_request'
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: npx commitlint --from "$BASE_SHA" --to "$HEAD_SHA" --verbose
test:
needs: build
runs-on: ubuntu-latest
env:
FORCE_COLOR: 3
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Use Node.js 24
uses: actions/setup-node@v6
with:
node-version: 24
cache: 'npm'
- uses: actions/download-artifact@v7
with:
name: build
- run: npm ci
- name: Unit tests
run: npm run test:coverage
timeout-minutes: 1
- name: Type tests
run: npm run test:types
docker-test:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/download-artifact@v7
with:
name: build
- run: |
npm run build:dcr
npm run test:dcr
smoke-win32-node16:
strategy:
matrix:
os: [windows-2022, windows-2025]
name: smoke-${{ matrix.os }}-node16
runs-on: ${{ matrix.os }}
needs: build
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Use Node.js 16
uses: actions/setup-node@v6
with:
node-version: 16
cache: 'npm'
- uses: actions/download-artifact@v7
with:
name: build
- run: npm run test:smoke:win32
timeout-minutes: 2
env:
FORCE_COLOR: 3
smoke-bun:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Setup Bun
uses: antongolub/action-setup-bun@f0b9f339a7ce9ba1174a58484e4dc9bbd6f7b133 # v1.13.2
- uses: actions/download-artifact@v7
with:
name: build
- run: |
bun test ./test/smoke/bun.test.js
bun ./test/smoke/ts.test.ts
timeout-minutes: 1
env:
FORCE_COLOR: 3
smoke-deno:
runs-on: ubuntu-latest
needs: build
name: smoke-deno${{ matrix.deno-version }}
strategy:
matrix:
deno-version: [1, 2]
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Setup Deno
uses: denoland/setup-deno@909cc5acb0fdd60627fb858598759246509fa755 # v2.0.2
with:
deno-version: ${{ matrix.deno-version }}
- run: deno install npm:types/node npm:types/fs-extra
- uses: actions/download-artifact@v7
with:
name: build
- run: deno test --allow-read --allow-sys --allow-env --allow-run ./test/smoke/deno.test.js
timeout-minutes: 1
env:
FORCE_COLOR: 3
smoke-node:
runs-on: ubuntu-latest
needs: build
name: smoke-node${{ matrix.node-version }}
strategy:
matrix:
node-version: [12, 14, 16, 18, 20, 22, 24, 25-nightly]
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- uses: actions/download-artifact@v7
with:
name: build
- name: cjs smoke test
run: npm run test:smoke:cjs
- name: mjs smoke test
run: npm run test:smoke:mjs
- name: strip-types
if: matrix.node-version >= 22
run: npm run test:smoke:strip-types
smoke-graal:
needs: build
runs-on: ubuntu-latest
name: smoke-graal${{ matrix.version }}
strategy:
matrix:
version: [17, 20]
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: graalvm/setup-graalvm@54b4f5a65c1a84b2fdfdc2078fe43df32819e4b1 # v1.4.4
with:
java-version: ${{ matrix.version }}
distribution: 'graalvm-community'
components: 'nodejs'
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v7
with:
name: build
- name: smoke tests
run: |
which node
node -v
npm run test:smoke:cjs
smoke-ts:
runs-on: ubuntu-latest
needs: build
name: smoke-ts${{ matrix.ts }}
strategy:
matrix:
ts: [4, 5, rc, next]
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Use Node.js 24
uses: actions/setup-node@v6
with:
node-version: 24
cache: 'npm'
- name: Install deps
run: npm ci
- name: Install TypeScript ${{ matrix.ts }}
run: npm i --force typescript@${{ matrix.ts }}
- name: Override @types/node
if: matrix.ts == 4
run: npm i --force @types/node@24.2.0
- uses: actions/download-artifact@v7
with:
name: build
- name: tsc
run: npm run test:smoke:tsc
- name: tsx
run: npm run test:smoke:tsx
- name: ts-node
run: npm run test:smoke:ts-node
================================================
FILE: .github/workflows/zizmor.yml
================================================
name: Zizmor
on:
push:
branches: ['main']
pull_request:
branches: ['**']
permissions: {}
jobs:
zizmor:
name: zizmor
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Install the latest version of uv
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b #v7.2.0
with:
enable-cache: false
- name: Run zizmor
run: uvx zizmor@1.22.0 .github/workflows -v -p --min-severity=medium
================================================
FILE: .gitignore
================================================
node_modules/
coverage/
package/
reports/
docs/.vitepress/cache/
yarn.lock
pnpm-lock.yaml
temp
test/fixtures/ts-project/build/
jsr.json
.npmrc
package-lite.json
package-main.json
================================================
FILE: .node_version
================================================
24
================================================
FILE: .nycrc
================================================
{
"reporter": ["html", "text"],
"lines": 98,
"branches": "90",
"statements": "98",
"exclude": [
"build/deno.js",
"build/vendor-extra.cjs",
"build/vendor-core.cjs",
"build/esblib.cjs",
"test/**",
"scripts",
"src/util.ts",
"src/core.ts",
"src/index.ts",
"src/vendor-extra.ts"
]
}
================================================
FILE: .prettierignore
================================================
node_modules/
build/
coverage/
package/
reports/
package-lock.json
yarn.lock
*.md
================================================
FILE: .size-limit.json
================================================
[
{
"name": "zx-lite",
"path": [
"build/3rd-party-licenses",
"build/core.cjs",
"build/core.d.ts",
"build/core.js",
"build/deno.js",
"build/error.d.ts",
"build/esblib.cjs",
"build/internals.cjs",
"build/internals.d.ts",
"build/log.d.ts",
"build/util.cjs",
"build/util.d.ts",
"build/vendor-core.cjs",
"build/vendor-core.d.ts",
"README.md",
"LICENSE"
],
"limit": "128.85 kB",
"brotli": false,
"gzip": false
},
{
"name": "js parts",
"path": [
"build/*.cjs",
"build/cli.js",
"build/core.js",
"build/index.js",
"build/globals.js",
"build/deno.js"
],
"limit": "850.20 kB",
"brotli": false,
"gzip": false
},
{
"name": "libdefs",
"path": "build/*.d.ts",
"limit": "44.55 kB",
"brotli": false,
"gzip": false
},
{
"name": "vendor",
"path": "build/vendor-*.{cjs,d.ts}",
"limit": "803.10 kB",
"brotli": false,
"gzip": false
},
{
"name": "all",
"path": [
"build/3rd-party-licenses",
"build/*.cjs",
"build/*.d.ts",
"build/cli.js",
"build/core.js",
"build/index.js",
"build/globals.js",
"build/deno.js",
"man/*",
"README.md",
"LICENSE"
],
"limit": "911.85 kB",
"brotli": false,
"gzip": false
}
]
================================================
FILE: LICENSE
================================================
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.
================================================
FILE: README.md
================================================
<h1><img src="https://google.github.io/zx/img/logo.svg" alt="Zx logo" height="32" width="28" valign="middle"> zx</h1>
```js
#!/usr/bin/env zx
await $`cat package.json | grep name`
const branch = await $`git branch --show-current`
await $`dep deploy --branch=${branch}`
await Promise.all([
$`sleep 1; echo 1`,
$`sleep 2; echo 2`,
$`sleep 3; echo 3`,
])
const name = 'foo bar'
await $`mkdir /tmp/${name}`
```
Bash is great, but when it comes to writing more complex scripts,
many people prefer a more convenient programming language.
JavaScript is a perfect choice, but the Node.js standard library
requires additional hassle before using. No compromise, take the best of both. The `zx` package provides
useful cross-platform wrappers around `child_process`, escapes arguments and
gives sensible defaults.
## Install
```bash
npm install zx
```
All setup options: [zx/setup](https://google.github.io/zx/setup).
See also [**zx@lite**](https://google.github.io/zx/lite).
## Usage
* [Documentation at google.github.io/zx/](https://google.github.io/zx/)
* [Code examples](https://github.com/google/zx/tree/main/examples)
## Compatibility
* Linux, macOS, or Windows
* JavaScript Runtime:
* Node.js >= 12.17.0
* Bun >= 1.0.0
* Deno 1.x, 2.x
* GraalVM Node.js
* Some kind of [bash or PowerShell](https://google.github.io/zx/shell)
* [Both CJS or ESM](https://google.github.io/zx/setup#hybrid) modules in [JS or TS](https://google.github.io/zx/typescript)
## See also
- 🔥 [crow.watch](https://crow.watch) — a computing-focused community, link aggregation and discussion, [join](http://crow.watch/join/zx).
## License
[Apache-2.0](LICENSE)
Disclaimer: _This is not an officially supported Google product._
================================================
FILE: build/3rd-party-licenses
================================================
THIRD PARTY LICENSES
@nodelib/fs.scandir@2.1.5
<unknown>
https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.scandir
MIT
@nodelib/fs.stat@2.0.5
<unknown>
https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.stat
MIT
@nodelib/fs.walk@1.2.8
<unknown>
https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.walk
MIT
@sindresorhus/merge-streams@4.0.0
Sindre Sorhus <sindresorhus@gmail.com>
sindresorhus/merge-streams
MIT
@webpod/ps@1.0.0
<unknown>
git://github.com/webpod/ps.git
MIT
braces@3.0.3
Jon Schlinkert (https://github.com/jonschlinkert)
micromatch/braces
MIT
chalk@5.6.2
<unknown>
chalk/chalk
MIT
create-require@1.1.1
Maël Nison <nison.mael@gmail.com>, Paul Soporan <paul.soporan@gmail.com>, Pooya Parsa <pyapar@gmail.com>
nuxt-contrib/create-require
MIT
envapi@0.2.3
Anton Golub <antongolub@antongolub.com>
git+https://github.com/webpod/envapi.git
MIT
fast-glob@3.3.3
Denis Malinochkin <undefined>
mrmlnc/fast-glob
MIT
fastq@1.20.1
Matteo Collina <hello@matteocollina.com>
git+https://github.com/mcollina/fastq.git
ISC
fill-range@7.1.1
Jon Schlinkert (https://github.com/jonschlinkert)
jonschlinkert/fill-range
MIT
fs-extra@11.3.3
JP Richardson <jprichardson@gmail.com>
https://github.com/jprichardson/node-fs-extra
MIT
glob-parent@5.1.2
Gulp Team <team@gulpjs.com> (https://gulpjs.com/)
gulpjs/glob-parent
ISC
globby@16.1.1
Sindre Sorhus <sindresorhus@gmail.com>
sindresorhus/globby
MIT
graceful-fs@4.2.11
<unknown>
https://github.com/isaacs/node-graceful-fs
ISC
is-glob@4.0.3
Jon Schlinkert (https://github.com/jonschlinkert)
micromatch/is-glob
MIT
is-path-inside@4.0.0
Sindre Sorhus <sindresorhus@gmail.com>
sindresorhus/is-path-inside
MIT
isexe@4.0.0
Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)
https://github.com/isaacs/isexe
BlueOak-1.0.0
jsonfile@6.2.0
JP Richardson <jprichardson@gmail.com>
git@github.com:jprichardson/node-jsonfile.git
MIT
maml.js@0.0.3
Anton Medvedev <anton@medv.io>
git+https://github.com/maml-dev/maml.js.git
MIT
merge2@1.4.1
<unknown>
git@github.com:teambition/merge2.git
MIT
micromatch@4.0.8
Jon Schlinkert (https://github.com/jonschlinkert)
micromatch/micromatch
MIT
node-fetch-native@1.6.7
<unknown>
unjs/node-fetch-native
MIT
picomatch@2.3.1
Jon Schlinkert (https://github.com/jonschlinkert)
micromatch/picomatch
MIT
run-parallel@1.2.0
Feross Aboukhadijeh <feross@feross.org>
git://github.com/feross/run-parallel.git
MIT
to-regex-range@5.0.1
Jon Schlinkert (https://github.com/jonschlinkert)
micromatch/to-regex-range
MIT
unicorn-magic@0.4.0
Sindre Sorhus <sindresorhus@gmail.com>
sindresorhus/unicorn-magic
MIT
which@6.0.1
GitHub Inc.
git+https://github.com/npm/node-which.git
ISC
yaml@2.8.2
Eemeli Aro <eemeli@gmail.com>
github:eemeli/yaml
ISC
zurk@0.11.10
Anton Golub <antongolub@antongolub.com>
git+https://github.com/webpod/zurk.git
MIT
================================================
FILE: build/cli.cjs
================================================
#!/usr/bin/env node
"use strict";
const {
__export,
__toESM,
__toCommonJS,
__async
} = require('./esblib.cjs');
const import_meta_url =
typeof document === 'undefined'
? new (require('url').URL)('file:' + __filename).href
: (document.currentScript && document.currentScript.src) ||
new URL('main.js', document.baseURI).href
// src/cli.ts
var cli_exports = {};
__export(cli_exports, {
argv: () => argv,
autorun: () => autorun,
injectGlobalRequire: () => injectGlobalRequire,
isMain: () => isMain,
main: () => main,
normalizeExt: () => normalizeExt,
printUsage: () => printUsage,
transformMarkdown: () => transformMarkdown
});
module.exports = __toCommonJS(cli_exports);
var import_node_url = __toESM(require("url"), 1);
var import_node_process2 = __toESM(require("process"), 1);
var import_index = require("./index.cjs");
var import_deps = require("./deps.cjs");
// src/repl.ts
var import_node_process = __toESM(require("process"), 1);
var import_node_repl = __toESM(require("repl"), 1);
var import_node_util = require("util");
var import_core = require("./core.cjs");
var _a;
var HISTORY = (_a = import_node_process.default.env.ZX_REPL_HISTORY) != null ? _a : import_core.path.join(import_core.os.homedir(), ".zx_repl_history");
function startRepl() {
return __async(this, arguments, function* (history = HISTORY) {
import_core.defaults.verbose = false;
const r = import_node_repl.default.start({
prompt: import_core.chalk.greenBright.bold("\u276F "),
useGlobal: true,
preview: false,
writer(output) {
return output instanceof import_core.ProcessOutput ? output.toString().trimEnd() : (0, import_node_util.inspect)(output, { colors: true });
}
});
r.setupHistory(history, () => {
});
});
}
// src/cli.ts
var import_util2 = require("./util.cjs");
// src/md.ts
var import_util = require("./util.cjs");
function transformMarkdown(buf) {
var _a2;
const out = [];
const tabRe = /^( +|\t)/;
const fenceRe = new RegExp("^(?<indent> {0,3})(?<fence>(`{3,20}|~{3,20}))(?:(?<js>js|javascript|ts|typescript)|(?<bash>sh|shell|bash)|.*)$");
let state = "root";
let prevEmpty = true;
let fenceChar = "";
let stripRe = null;
let endRe = /^$/;
let linePrefix = "";
let closeOut = "";
const isEnd = (s) => fenceChar !== "" && endRe.test(s);
for (const line of (0, import_util.bufToString)(buf).split(/\r\n|[\n\r\u2028\u2029]/)) {
switch (state) {
case "root": {
const g = (_a2 = line.match(fenceRe)) == null ? void 0 : _a2.groups;
if (g == null ? void 0 : g.fence) {
fenceChar = g.fence[0];
stripRe = g.indent ? new RegExp(`^ {0,${g.indent.length}}`) : null;
endRe = new RegExp(`^ {0,3}${fenceChar}{${g.fence.length},}[ \\t]*$`);
if (g.js) {
out.push("");
linePrefix = "";
closeOut = "";
} else if (g.bash) {
out.push("await $`");
linePrefix = "";
closeOut = "`";
} else {
out.push("");
linePrefix = "// ";
closeOut = "";
}
state = "fence";
prevEmpty = false;
break;
}
if (prevEmpty && tabRe.test(line)) {
out.push(line);
state = "tab";
continue;
}
prevEmpty = line === "";
out.push("// " + line);
continue;
}
case "tab":
if (line === "") out.push("");
else if (tabRe.test(line)) out.push(line);
else {
out.push("// " + line);
state = "root";
}
prevEmpty = line === "";
break;
case "fence":
if (isEnd(line)) {
out.push(closeOut);
state = "root";
prevEmpty = true;
fenceChar = "";
} else {
const s = stripRe ? line.replace(stripRe, "") : line;
out.push(linePrefix + s);
prevEmpty = false;
}
break;
}
}
return out.join("\n");
}
// src/cli.ts
var import_vendor = require("./vendor.cjs");
var import_meta = {};
var EXT = ".mjs";
var EXT_RE = /^\.[mc]?[jt]sx?$/;
var argv = (0, import_index.parseArgv)(import_node_process2.default.argv.slice(2), {
default: (0, import_index.resolveDefaults)({ ["prefer-local"]: false }, "ZX_", import_node_process2.default.env, /* @__PURE__ */ new Set(["env", "install", "registry"])),
// exclude 'prefer-local' to let minimist infer the type
string: ["shell", "prefix", "postfix", "eval", "cwd", "ext", "registry", "env"],
boolean: ["version", "help", "quiet", "verbose", "install", "repl", "experimental"],
alias: { e: "eval", i: "install", v: "version", h: "help", l: "prefer-local", "env-file": "env" },
stopEarly: true,
parseBoolean: true,
camelCase: true
});
autorun(import_meta);
function autorun(meta) {
if (meta && isMain(meta))
main().catch((err) => {
if (err instanceof import_index.ProcessOutput) {
console.error("Error:", err.message);
} else {
console.error(err);
}
import_node_process2.default.exitCode = 1;
});
}
function printUsage() {
console.log(`
${import_index.chalk.bold("zx " + import_index.VERSION)}
A tool for writing better scripts
${import_index.chalk.bold("Usage")}
zx [options] <script>
${import_index.chalk.bold("Options")}
--quiet suppress any outputs
--verbose enable verbose mode
--shell=<path> custom shell binary
--prefix=<command> prefix all commands
--postfix=<command> postfix all commands
--prefer-local, -l prefer locally installed packages and binaries
--cwd=<path> set current directory
--eval=<js>, -e evaluate script
--ext=<.mjs> script extension
--install, -i install dependencies
--registry=<URL> npm registry, defaults to https://registry.npmjs.org/
--version, -v print current zx version
--help, -h print help
--repl start repl
--env=<path> path to env file
--experimental enables experimental features (deprecated)
${import_index.chalk.italic("Full documentation:")} ${import_index.chalk.underline(import_index.Fail.DOCS_URL)}
`);
}
function main() {
return __async(this, null, function* () {
var _a2;
if (argv.version) {
console.log(import_index.VERSION);
return;
}
if (argv.help) {
printUsage();
return;
}
if (argv.cwd) import_index.$.cwd = argv.cwd;
if (argv.env) {
const envfile = import_index.path.resolve((_a2 = import_index.$.cwd) != null ? _a2 : import_node_process2.default.cwd(), argv.env);
import_index.dotenv.config(envfile);
(0, import_index.resolveDefaults)();
}
if (argv.verbose) import_index.$.verbose = true;
if (argv.quiet) import_index.$.quiet = true;
if (argv.shell) import_index.$.shell = argv.shell;
if (argv.prefix) import_index.$.prefix = argv.prefix;
if (argv.postfix) import_index.$.postfix = argv.postfix;
if (argv.preferLocal) import_index.$.preferLocal = argv.preferLocal;
yield require("./globals.cjs");
if (argv.repl) {
yield startRepl();
return;
}
argv.ext = normalizeExt(argv.ext);
const { script, scriptPath, tempPath } = yield readScript();
yield runScript(script, scriptPath, tempPath);
});
}
var rmrf = (p) => {
var _a2;
if (!p) return;
((_a2 = lstat(p)) == null ? void 0 : _a2.isSymbolicLink()) ? import_index.fs.unlinkSync(p) : import_index.fs.rmSync(p, { force: true, recursive: true });
};
function runScript(script, scriptPath, tempPath) {
return __async(this, null, function* () {
let nmLink = "";
const rmTemp = () => {
rmrf(tempPath);
rmrf(nmLink);
};
try {
if (tempPath) {
scriptPath = tempPath;
yield import_index.fs.writeFile(tempPath, script);
}
const cwd = import_index.path.dirname(scriptPath);
if (typeof argv.preferLocal === "string") {
nmLink = linkNodeModules(cwd, argv.preferLocal);
}
if (argv.install) {
yield (0, import_deps.installDeps)((0, import_deps.parseDeps)(script), cwd, argv.registry);
}
injectGlobalRequire(scriptPath);
import_node_process2.default.once("exit", rmTemp);
yield import(import_node_url.default.pathToFileURL(scriptPath).toString());
} finally {
rmTemp();
}
});
}
function linkNodeModules(cwd, external) {
const nm = "node_modules";
const alias = import_index.path.resolve(cwd, nm);
const target = import_index.path.basename(external) === nm ? import_index.path.resolve(external) : import_index.path.resolve(external, nm);
const aliasStat = lstat(alias);
const targetStat = lstat(target);
if (!(targetStat == null ? void 0 : targetStat.isDirectory()))
throw new import_index.Fail(
`Can't link node_modules: ${target} doesn't exist or is not a directory`
);
if ((aliasStat == null ? void 0 : aliasStat.isDirectory()) && alias !== target)
throw new import_index.Fail(`Can't link node_modules: ${alias} already exists`);
if (aliasStat) return "";
import_index.fs.symlinkSync(target, alias, "junction");
return alias;
}
function lstat(p) {
try {
return import_index.fs.lstatSync(p);
} catch (e) {
}
}
function readScript() {
return __async(this, null, function* () {
const [firstArg] = argv._;
let script = "";
let scriptPath = "";
let tempPath = "";
let argSlice = 1;
if (argv.eval) {
argSlice = 0;
script = argv.eval;
tempPath = getFilepath(import_index.$.cwd, "zx", argv.ext);
} else if (!firstArg || firstArg === "-") {
script = yield readScriptFromStdin();
tempPath = getFilepath(import_index.$.cwd, "zx", argv.ext);
if (script.length === 0) {
printUsage();
import_node_process2.default.exitCode = 1;
throw new import_index.Fail("No script provided");
}
} else if (/^https?:/.test(firstArg)) {
const { name, ext: ext2 = argv.ext } = import_index.path.parse(new URL(firstArg).pathname);
script = yield readScriptFromHttp(firstArg);
tempPath = getFilepath(import_index.$.cwd, name, ext2);
} else {
script = yield import_index.fs.readFile(firstArg, "utf8");
scriptPath = firstArg.startsWith("file:") ? import_node_url.default.fileURLToPath(firstArg) : import_index.path.resolve(firstArg);
}
const { ext, base, dir } = import_index.path.parse(tempPath || scriptPath);
if (ext === "" || argv.ext && !EXT_RE.test(ext)) {
tempPath = getFilepath(dir, base);
}
if (ext === ".md") {
script = transformMarkdown(script);
tempPath = getFilepath(dir, base, EXT);
}
if (argSlice) (0, import_index.updateArgv)(argv._.slice(argSlice));
return { script, scriptPath, tempPath };
});
}
function readScriptFromStdin() {
return __async(this, null, function* () {
return import_node_process2.default.stdin.isTTY ? "" : (0, import_index.stdin)();
});
}
function readScriptFromHttp(remote) {
return __async(this, null, function* () {
const res = yield (0, import_index.fetch)(remote);
if (!res.ok) {
console.error(`Error: Can't get ${remote}`);
import_node_process2.default.exitCode = 1;
throw new import_index.Fail(`Failed to fetch remote script: ${remote} (${res.status})`);
}
return res.text();
});
}
function injectGlobalRequire(origin) {
const __filename = import_index.path.resolve(origin);
const __dirname = import_index.path.dirname(__filename);
const require2 = (0, import_vendor.createRequire)(origin);
Object.assign(globalThis, { __filename, __dirname, require: require2 });
}
function isMain(meta = import_meta_url, scriptpath = import_node_process2.default.argv[1]) {
if (typeof meta === "string") {
if (meta.startsWith("file:")) {
const modulePath = import_node_url.default.fileURLToPath(meta).replace(/\.\w+$/, "");
const mainPath = import_index.fs.realpathSync(scriptpath).replace(/\.\w+$/, "");
return mainPath === modulePath;
}
return false;
}
return !!meta.main;
}
function normalizeExt(ext) {
return ext ? import_index.path.parse(`foo.${ext}`).ext : ext;
}
function getFilepath(cwd = ".", name = "zx", _ext) {
const ext = _ext || argv.ext || EXT;
return [
name + ext,
name + "-" + (0, import_util2.randomId)() + ext
].map((f) => import_index.path.resolve(import_node_process2.default.cwd(), cwd, f)).find((f) => !import_index.fs.existsSync(f));
}
/* c8 ignore next 100 */
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
argv,
autorun,
injectGlobalRequire,
isMain,
main,
normalizeExt,
printUsage,
transformMarkdown
});
================================================
FILE: build/cli.d.ts
================================================
#!/usr/bin/env node
import { type minimist } from './vendor.js';
export { transformMarkdown } from './md.js';
export declare const argv: minimist.ParsedArgs;
export declare function autorun(meta: ImportMeta): void;
export declare function printUsage(): void;
export declare function main(): Promise<void>;
export declare function injectGlobalRequire(origin: string): void;
export declare function isMain(meta?: ImportMeta['url'] | ImportMeta, scriptpath?: string): boolean;
export declare function normalizeExt(ext?: string): string | undefined;
================================================
FILE: build/cli.js
================================================
#!/usr/bin/env node
"use strict";
import "./deno.js"
import * as __module__ from "./cli.cjs"
const {
argv,
autorun,
injectGlobalRequire,
isMain,
main,
normalizeExt,
printUsage,
transformMarkdown
} = globalThis.Deno ? globalThis.require("./cli.cjs") : __module__
export {
argv,
autorun,
injectGlobalRequire,
isMain,
main,
normalizeExt,
printUsage,
transformMarkdown
}
autorun(import.meta)
================================================
FILE: build/core.cjs
================================================
"use strict";
const {
__spreadValues,
__spreadProps,
__export,
__toESM,
__toCommonJS,
__async,
__await,
__asyncGenerator,
__yieldStar,
__forAwait
} = require('./esblib.cjs');
// src/core.ts
var core_exports = {};
__export(core_exports, {
$: () => $,
Fail: () => Fail,
ProcessOutput: () => ProcessOutput,
ProcessPromise: () => ProcessPromise,
bus: () => import_internals.bus,
cd: () => cd,
chalk: () => import_vendor_core3.chalk,
defaults: () => defaults,
kill: () => kill,
log: () => log,
os: () => os,
path: () => import_node_path.default,
ps: () => import_vendor_core3.ps,
quote: () => import_util2.quote,
quotePowerShell: () => import_util2.quotePowerShell,
resolveDefaults: () => resolveDefaults,
syncProcessCwd: () => syncProcessCwd,
useBash: () => useBash,
usePowerShell: () => usePowerShell,
usePwsh: () => usePwsh,
which: () => import_vendor_core3.which,
within: () => within
});
module.exports = __toCommonJS(core_exports);
var import_node_async_hooks = require("async_hooks");
var import_node_buffer = require("buffer");
var import_node_child_process = __toESM(require("child_process"), 1);
var import_node_events = require("events");
var import_node_fs = __toESM(require("fs"), 1);
var import_node_os = require("os");
var import_node_process2 = __toESM(require("process"), 1);
var import_node_util2 = require("util");
// src/error.ts
var EXIT_CODES = {
2: "Misuse of shell builtins",
126: "Invoked command cannot execute",
127: "Command not found",
128: "Invalid exit argument",
129: "Hangup",
130: "Interrupt",
131: "Quit and dump core",
132: "Illegal instruction",
133: "Trace/breakpoint trap",
134: "Process aborted",
135: 'Bus error: "access to undefined portion of memory object"',
136: 'Floating point exception: "erroneous arithmetic operation"',
137: "Kill (terminate immediately)",
138: "User-defined 1",
139: "Segmentation violation",
140: "User-defined 2",
141: "Write to pipe with no one reading",
142: "Signal raised by alarm",
143: "Termination (request to terminate)",
145: "Child process terminated, stopped (or continued*)",
146: "Continue if stopped",
147: "Stop executing temporarily",
148: "Terminal stop signal",
149: 'Background process attempting to read from tty ("in")',
150: 'Background process attempting to write to tty ("out")',
151: "Urgent data available on socket",
152: "CPU time limit exceeded",
153: "File size limit exceeded",
154: 'Signal raised by timer counting virtual time: "virtual timer expired"',
155: "Profiling timer expired",
157: "Pollable event",
159: "Bad syscall"
};
var ERRNO_CODES = {
0: "Success",
1: "Not super-user",
2: "No such file or directory",
3: "No such process",
4: "Interrupted system call",
5: "I/O error",
6: "No such device or address",
7: "Arg list too long",
8: "Exec format error",
9: "Bad file number",
10: "No children",
11: "No more processes",
12: "Not enough core",
13: "Permission denied",
14: "Bad address",
15: "Block device required",
16: "Mount device busy",
17: "File exists",
18: "Cross-device link",
19: "No such device",
20: "Not a directory",
21: "Is a directory",
22: "Invalid argument",
23: "Too many open files in system",
24: "Too many open files",
25: "Not a typewriter",
26: "Text file busy",
27: "File too large",
28: "No space left on device",
29: "Illegal seek",
30: "Read only file system",
31: "Too many links",
32: "Broken pipe",
33: "Math arg out of domain of func",
34: "Math result not representable",
35: "File locking deadlock error",
36: "File or path name too long",
37: "No record locks available",
38: "Function not implemented",
39: "Directory not empty",
40: "Too many symbolic links",
42: "No message of desired type",
43: "Identifier removed",
44: "Channel number out of range",
45: "Level 2 not synchronized",
46: "Level 3 halted",
47: "Level 3 reset",
48: "Link number out of range",
49: "Protocol driver not attached",
50: "No CSI structure available",
51: "Level 2 halted",
52: "Invalid exchange",
53: "Invalid request descriptor",
54: "Exchange full",
55: "No anode",
56: "Invalid request code",
57: "Invalid slot",
59: "Bad font file fmt",
60: "Device not a stream",
61: "No data (for no delay io)",
62: "Timer expired",
63: "Out of streams resources",
64: "Machine is not on the network",
65: "Package not installed",
66: "The object is remote",
67: "The link has been severed",
68: "Advertise error",
69: "Srmount error",
70: "Communication error on send",
71: "Protocol error",
72: "Multihop attempted",
73: "Cross mount point (not really error)",
74: "Trying to read unreadable message",
75: "Value too large for defined data type",
76: "Given log. name not unique",
77: "f.d. invalid for this operation",
78: "Remote address changed",
79: "Can access a needed shared lib",
80: "Accessing a corrupted shared lib",
81: ".lib section in a.out corrupted",
82: "Attempting to link in too many libs",
83: "Attempting to exec a shared library",
84: "Illegal byte sequence",
86: "Streams pipe error",
87: "Too many users",
88: "Socket operation on non-socket",
89: "Destination address required",
90: "Message too long",
91: "Protocol wrong type for socket",
92: "Protocol not available",
93: "Unknown protocol",
94: "Socket type not supported",
95: "Not supported",
96: "Protocol family not supported",
97: "Address family not supported by protocol family",
98: "Address already in use",
99: "Address not available",
100: "Network interface is not configured",
101: "Network is unreachable",
102: "Connection reset by network",
103: "Connection aborted",
104: "Connection reset by peer",
105: "No buffer space available",
106: "Socket is already connected",
107: "Socket is not connected",
108: "Can't send after socket shutdown",
109: "Too many references",
110: "Connection timed out",
111: "Connection refused",
112: "Host is down",
113: "Host is unreachable",
114: "Socket already connected",
115: "Connection already in progress",
116: "Stale file handle",
122: "Quota exceeded",
123: "No medium (in tape drive)",
125: "Operation canceled",
130: "Previous owner died",
131: "State not recoverable"
};
var DOCS_URL = "https://google.github.io/zx";
var _Fail = class _Fail extends Error {
static formatExitMessage(code, signal, stderr, from, details = "") {
if (code == 0 && signal == null) return `exit code: ${code}`;
const codeInfo = _Fail.getExitCodeInfo(code);
let message = `${stderr}
at ${from}
exit code: ${code}${codeInfo ? " (" + codeInfo + ")" : ""}`;
if (signal != null) message += `
signal: ${signal}`;
if (details) message += `
details:
${details}`;
return message;
}
static formatErrorMessage(err, from) {
return `${err.message}
errno: ${err.errno} (${_Fail.getErrnoMessage(err.errno)})
code: ${err.code}
at ${from}`;
}
static formatErrorDetails(lines = [], lim = 20) {
if (lines.length < lim) return lines.join("\n");
let errors = lines.filter((l) => /(fail|error|not ok|exception)/i.test(l));
if (errors.length === 0) errors = lines;
return errors.slice(0, lim).join("\n") + (errors.length > lim ? "\n..." : "");
}
static getExitCodeInfo(exitCode) {
return EXIT_CODES[exitCode];
}
static getCallerLocationFromString(stackString = "unknown") {
const lines = stackString.split(/^\s*(at\s)?/m).filter((s) => s == null ? void 0 : s.includes(":"));
const i = lines.findIndex((l) => l.includes("Proxy.set"));
const offset = i < 0 ? i : i + 2;
return (lines.find((l) => l.includes("file://")) || lines[offset] || stackString).trim();
}
static getCallerLocation(err = new Error("zx error")) {
return _Fail.getCallerLocationFromString(err.stack);
}
static getErrnoMessage(errno) {
return ERRNO_CODES[-errno] || "Unknown error";
}
};
_Fail.DOCS_URL = DOCS_URL;
_Fail.EXIT_CODES = EXIT_CODES;
_Fail.ERRNO_CODES = ERRNO_CODES;
var Fail = _Fail;
// src/log.ts
var import_vendor_core = require("./vendor-core.cjs");
var import_node_util = require("util");
var import_node_process = __toESM(require("process"), 1);
var formatters = {
cmd({ cmd }) {
return formatCmd(cmd);
},
stdout({ data }) {
return data;
},
stderr({ data }) {
return data;
},
custom({ data }) {
return data;
},
fetch(entry) {
const init = entry.init ? " " + (0, import_node_util.inspect)(entry.init) : "";
return `$ ${import_vendor_core.chalk.greenBright("fetch")} ${entry.url}${init}
`;
},
cd(entry) {
return `$ ${import_vendor_core.chalk.greenBright("cd")} ${entry.dir}
`;
},
retry(entry) {
const attempt = `Attempt: ${entry.attempt}${entry.total == Infinity ? "" : `/${entry.total}`}`;
const delay = entry.delay > 0 ? `; next in ${entry.delay}ms` : "";
return `${import_vendor_core.chalk.bgRed.white(" FAIL ")} ${attempt}${delay}
`;
},
end() {
return "";
},
kill() {
return "";
}
};
var log = function(entry) {
var _a;
if (!entry.verbose) return;
const stream = log.output || import_node_process.default.stderr;
const format = ((_a = log.formatters) == null ? void 0 : _a[entry.kind]) || formatters[entry.kind];
if (!format) return;
stream.write(format(entry));
};
var SPACE_RE = /\s/;
var SYNTAX = "()[]{}<>;:+|&=";
var CMD_BREAK = "|&;><";
var RESERVED_WORDS = /* @__PURE__ */ new Set([
"if",
"then",
"else",
"elif",
"fi",
"case",
"esac",
"for",
"select",
"while",
"until",
"do",
"done",
"in",
"EOF"
]);
function formatCmd(cmd) {
if (cmd == void 0) return import_vendor_core.chalk.grey("undefined");
let q = "";
let out = "$ ";
let buf = "";
let mode = "";
let pos = 0;
const cap = () => {
const word = buf.trim();
if (word) {
pos++;
if (mode === "syntax") {
if (CMD_BREAK.includes(word)) {
pos = 0;
}
out += import_vendor_core.chalk.red(buf);
} else if (mode === "quote" || mode === "dollar") {
out += import_vendor_core.chalk.yellowBright(buf);
} else if (RESERVED_WORDS.has(word)) {
out += import_vendor_core.chalk.cyanBright(buf);
} else if (pos === 1) {
out += import_vendor_core.chalk.greenBright(buf);
pos = Infinity;
} else {
out += buf;
}
} else {
out += buf;
}
mode = "";
buf = "";
};
for (const c of [...cmd]) {
if (!q) {
if (c === "$") {
cap();
mode = "dollar";
buf += c;
cap();
} else if (c === "'" || c === '"') {
cap();
mode = "quote";
q = c;
buf += c;
} else if (SPACE_RE.test(c)) {
cap();
buf += c;
} else if (SYNTAX.includes(c)) {
const isEnv = c === "=" && pos === 0;
isEnv && (pos = 1);
cap();
mode = "syntax";
buf += c;
cap();
isEnv && (pos = -1);
} else {
buf += c;
}
} else {
buf += c;
if (c === q) {
cap();
q = "";
}
}
}
cap();
return out.replace(/\n/g, import_vendor_core.chalk.reset("\n> ")) + "\n";
}
// src/core.ts
var import_vendor_core2 = require("./vendor-core.cjs");
var import_util = require("./util.cjs");
var import_internals = require("./internals.cjs");
var import_node_path = __toESM(require("path"), 1);
var os = __toESM(require("os"), 1);
var import_vendor_core3 = require("./vendor-core.cjs");
var import_util2 = require("./util.cjs");
var CWD = /* @__PURE__ */ Symbol("processCwd");
var SYNC = /* @__PURE__ */ Symbol("syncExec");
var EPF = /* @__PURE__ */ Symbol("end-piped-from");
var SHOT = /* @__PURE__ */ Symbol("snapshot");
var EOL = import_node_buffer.Buffer.from(import_node_os.EOL);
var BR_CC = "\n".charCodeAt(0);
var DLMTR = /\r?\n/;
var SIGTERM = "SIGTERM";
var ENV_PREFIX = "ZX_";
var ENV_OPTS = /* @__PURE__ */ new Set([
"cwd",
"preferLocal",
"detached",
"verbose",
"quiet",
"timeout",
"timeoutSignal",
"killSignal",
"prefix",
"postfix",
"shell"
]);
var defaults = resolveDefaults({
[CWD]: import_node_process2.default.cwd(),
[SYNC]: false,
verbose: false,
env: import_node_process2.default.env,
sync: false,
shell: true,
stdio: "pipe",
nothrow: false,
quiet: false,
detached: false,
preferLocal: false,
spawn: import_node_child_process.default.spawn,
spawnSync: import_node_child_process.default.spawnSync,
log,
kill,
killSignal: SIGTERM,
timeoutSignal: SIGTERM
});
var storage = new import_node_async_hooks.AsyncLocalStorage();
var getStore = () => storage.getStore() || defaults;
var getSnapshot = (opts, from, pieces, args) => __spreadProps(__spreadValues({}, opts), {
ac: opts.ac || new AbortController(),
ee: new import_node_events.EventEmitter(),
from,
pieces,
args,
cmd: ""
});
function within(callback) {
return storage.run(__spreadValues({}, getStore()), callback);
}
var $ = sync$(
function(pieces, ...args) {
const opts = getStore();
if (!Array.isArray(pieces))
return sync$(
function(...args2) {
return within(() => Object.assign($, opts, pieces).apply(this, args2));
},
() => $(__spreadProps(__spreadValues({}, pieces), { sync: true }))
);
const from = Fail.getCallerLocation();
const cb = () => cb[SHOT] = getSnapshot(opts, from, pieces, args);
const pp = new ProcessPromise(cb);
if (!pp.isHalted()) pp.run();
return pp.sync ? pp.output : pp;
},
() => $({ sync: true })
);
function sync$(fn, makeSync) {
return new Proxy(fn, {
get(t, key) {
if (key === "sync") return makeSync();
return Reflect.get(key in Function.prototype ? t : getStore(), key);
},
set(t, key, value) {
return Reflect.set(
key in Function.prototype ? t : getStore(),
key === "sync" ? SYNC : key,
value
);
}
});
}
var _ProcessPromise = class _ProcessPromise extends Promise {
constructor(executor) {
let resolve;
let reject;
super((...args) => {
;
[resolve = import_util.noop, reject = import_util.noop] = args;
executor(...args);
});
this._stage = "initial";
this._id = (0, import_util.randomId)();
this._piped = false;
this._stdin = new import_vendor_core2.VoidStream();
this._zurk = null;
this._output = null;
// Stream-like API
this.writable = true;
const snapshot = executor[SHOT];
if (snapshot) {
this._snapshot = snapshot;
this._resolve = resolve;
this._reject = reject;
if (snapshot.halt) this._stage = "halted";
try {
this.build();
} catch (err) {
this.finalize(ProcessOutput.fromError(err), true);
}
} else _ProcessPromise.disarm(this);
}
// prettier-ignore
build() {
const $2 = this._snapshot;
if (!$2.shell)
throw new Fail(`No shell is available: ${Fail.DOCS_URL}/shell`);
if (!$2.quote)
throw new Fail(`No quote function is defined: ${Fail.DOCS_URL}/quotes`);
if ($2.pieces.some((p) => p == null))
throw new Fail(`Malformed command at ${$2.from}`);
$2.cmd = (0, import_vendor_core2.buildCmd)(
$2.quote,
$2.pieces,
$2.args
);
if ($2[SYNC] && !(0, import_util.isString)($2.cmd))
throw new Fail("sync mode does not allow async command resolution");
}
run() {
var _a, _b;
_ProcessPromise.bus.runBack(this);
if (this.isRunning() || this.isSettled()) return this;
this._stage = "running";
const self = this;
const $2 = self._snapshot;
const { id, cwd } = self;
if (!import_node_fs.default.existsSync(cwd)) {
this.finalize(
ProcessOutput.fromError(
new Error(`The working directory '${cwd}' does not exist.`)
)
);
return this;
}
if ($2.preferLocal) {
const dirs = $2.preferLocal === true ? [$2.cwd, $2[CWD]] : [$2.preferLocal].flat();
$2.env = (0, import_util.preferLocalBin)($2.env, ...dirs);
}
this._zurk = (0, import_vendor_core2.exec)({
cmd: self.fullCmd,
cwd,
input: (_b = (_a = $2.input) == null ? void 0 : _a.stdout) != null ? _b : $2.input,
stdin: self._stdin,
sync: self.sync,
signal: self.signal,
shell: (0, import_util.isString)($2.shell) ? $2.shell : true,
id,
env: $2.env,
spawn: $2.spawn,
spawnSync: $2.spawnSync,
store: $2.store,
stdio: $2.stdio,
detached: $2.detached,
ee: $2.ee,
run(cb, ctx) {
return __async(this, null, function* () {
try {
if (!(0, import_util.isString)(self.cmd)) {
$2.cmd = yield self.cmd;
ctx.cmd = self.fullCmd;
}
cb();
} catch (error) {
self.finalize(ProcessOutput.fromError(error));
}
});
},
on: {
start: () => {
$2.log({ kind: "cmd", cmd: $2.cmd, cwd, verbose: self.isVerbose(), id });
self.timeout($2.timeout, $2.timeoutSignal);
},
stdout: (data) => {
$2.log({ kind: "stdout", data, verbose: !self._piped && self.isVerbose(), id });
},
stderr: (data) => {
$2.log({ kind: "stderr", data, verbose: !self.isQuiet(), id });
},
end: (data, c) => {
const { error: _error, status, signal: __signal, duration, ctx: { store } } = data;
const { stdout, stderr } = store;
const { cause, exitCode, signal: _signal } = self._breakerData || {};
const signal = _signal != null ? _signal : __signal;
const code = exitCode != null ? exitCode : status;
const error = cause != null ? cause : _error;
const output = new ProcessOutput({
code,
signal,
error,
duration,
store,
from: $2.from
});
$2.log({ kind: "end", signal, exitCode: code, duration, error, verbose: self.isVerbose(), id });
if (stdout.length && (0, import_util.getLast)((0, import_util.getLast)(stdout)) !== BR_CC) c.on.stdout(EOL, c);
if (stderr.length && (0, import_util.getLast)((0, import_util.getLast)(stderr)) !== BR_CC) c.on.stderr(EOL, c);
self.finalize(output);
}
}
});
return this;
}
break(exitCode, signal, cause) {
if (!this.isRunning()) return;
this._breakerData = { exitCode, signal, cause };
this.kill(signal);
}
finalize(output, legacy = false) {
if (this.isSettled()) return;
this._output = output;
_ProcessPromise.bus.unpipeBack(this);
if (output.ok || this.isNothrow()) {
this._stage = "fulfilled";
this._resolve(output);
} else {
this._stage = "rejected";
if (legacy) {
this._resolve(output);
throw output.cause || output;
}
this._reject(output);
if (this.sync) throw output;
}
}
abort(reason) {
if (this.isSettled()) throw new Fail("Too late to abort the process.");
if (this.signal !== this.ac.signal)
throw new Fail("The signal is controlled by another process.");
if (!this.child)
throw new Fail("Trying to abort a process without creating one.");
this.ac.abort(reason);
}
kill(signal) {
if (this.isSettled()) throw new Fail("Too late to kill the process.");
if (!this.child)
throw new Fail("Trying to kill a process without creating one.");
if (!this.pid) throw new Fail("The process pid is undefined.");
return $.kill(this.pid, signal || this._snapshot.killSignal || $.killSignal);
}
// Configurators
stdio(stdin, stdout = "pipe", stderr = "pipe") {
this._snapshot.stdio = Array.isArray(stdin) ? stdin : [stdin, stdout, stderr];
return this;
}
nothrow(v = true) {
this._snapshot.nothrow = v;
return this;
}
quiet(v = true) {
this._snapshot.quiet = v;
return this;
}
verbose(v = true) {
this._snapshot.verbose = v;
return this;
}
timeout(d = 0, signal = $.timeoutSignal) {
if (this.isSettled()) return this;
const $2 = this._snapshot;
$2.timeout = (0, import_util.parseDuration)(d);
$2.timeoutSignal = signal;
if (this._timeoutId) clearTimeout(this._timeoutId);
if ($2.timeout && this.isRunning()) {
this._timeoutId = setTimeout(() => this.kill($2.timeoutSignal), $2.timeout);
this.finally(() => clearTimeout(this._timeoutId)).catch(import_util.noop);
}
return this;
}
/**
* @deprecated Use $({halt: true})`cmd` instead.
*/
halt() {
return this;
}
// Getters
get id() {
return this._id;
}
get pid() {
var _a;
return (_a = this.child) == null ? void 0 : _a.pid;
}
get cwd() {
return this._snapshot.cwd || this._snapshot[CWD];
}
get cmd() {
return this._snapshot.cmd;
}
get fullCmd() {
const { prefix = "", postfix = "", cmd } = this._snapshot;
return prefix + cmd + postfix;
}
get child() {
var _a;
return (_a = this._zurk) == null ? void 0 : _a.child;
}
get stdin() {
var _a;
return (_a = this.child) == null ? void 0 : _a.stdin;
}
get stdout() {
var _a;
return (_a = this.child) == null ? void 0 : _a.stdout;
}
get stderr() {
var _a;
return (_a = this.child) == null ? void 0 : _a.stderr;
}
get exitCode() {
return this.then(
(o) => o.exitCode,
(o) => o.exitCode
);
}
get signal() {
return this._snapshot.signal || this.ac.signal;
}
get ac() {
return this._snapshot.ac;
}
get output() {
return this._output;
}
get stage() {
return this._stage;
}
get sync() {
return this._snapshot[SYNC];
}
get [Symbol.toStringTag]() {
return "ProcessPromise";
}
[Symbol.toPrimitive]() {
return this.toString();
}
// Output formatters
json() {
return this.then((o) => o.json());
}
text(encoding) {
return this.then((o) => o.text(encoding));
}
lines(delimiter) {
return this.then((o) => o.lines(delimiter));
}
buffer() {
return this.then((o) => o.buffer());
}
blob(type) {
return this.then((o) => o.blob(type));
}
// Status checkers
isQuiet() {
return this._snapshot.quiet;
}
isVerbose() {
return this._snapshot.verbose && !this.isQuiet();
}
isNothrow() {
return this._snapshot.nothrow;
}
isHalted() {
return this.stage === "halted" && !this.sync;
}
isSettled() {
return !!this.output;
}
isRunning() {
return this.stage === "running";
}
// Piping
// prettier-ignore
get pipe() {
const getPipeMethod = (kind) => this._pipe.bind(this, kind);
const stdout = getPipeMethod("stdout");
const stderr = getPipeMethod("stderr");
const stdall = getPipeMethod("stdall");
return Object.assign(stdout, { stdout, stderr, stdall });
}
unpipe(to) {
_ProcessPromise.bus.unpipe(this, to);
return this;
}
// prettier-ignore
_pipe(source, dest, ...args) {
if ((0, import_util.isString)(dest))
return this._pipe(source, import_node_fs.default.createWriteStream(dest));
if ((0, import_util.isStringLiteral)(dest, ...args))
return this._pipe(
source,
$({
halt: true,
signal: this.signal
})(dest, ...args)
);
const isP = dest instanceof _ProcessPromise;
if (isP && dest.isSettled()) throw new Fail("Cannot pipe to a settled process.");
if (!isP && dest.writableEnded) throw new Fail("Cannot pipe to a closed stream.");
this._piped = true;
_ProcessPromise.bus.pipe(this, dest);
const { ee } = this._snapshot;
const output = this.output;
const from = new import_vendor_core2.VoidStream();
const check = () => {
var _a;
return !!((_a = _ProcessPromise.bus.refs.get(this)) == null ? void 0 : _a.has(dest));
};
const end = () => {
if (!check()) return;
setImmediate(() => {
_ProcessPromise.bus.unpipe(this, dest);
_ProcessPromise.bus.sources(dest).length === 0 && from.end();
});
};
const fill = () => {
for (const chunk of this._zurk.store[source]) from.write(chunk);
};
const fillSettled = () => {
if (!output) return;
if (isP && !output.ok) dest.break(output.exitCode, output.signal, output.cause);
fill();
end();
};
if (!output) {
const onData = (chunk) => check() && from.write(chunk);
ee.once(source, () => {
fill();
ee.on(source, onData);
}).once("end", () => {
ee.removeListener(source, onData);
end();
});
}
if (isP) {
from.pipe(dest._stdin);
if (this.isHalted()) ee.once("start", () => dest.run());
else {
dest.run();
this.catch((e) => dest.break(e.exitCode, e.signal, e.cause));
}
fillSettled();
return dest;
}
from.once("end", () => dest.emit(EPF)).pipe(dest);
fillSettled();
return _ProcessPromise.promisifyStream(dest, this);
}
// Promise API
then(onfulfilled, onrejected) {
return super.then(onfulfilled, onrejected);
}
catch(onrejected) {
return super.catch(onrejected);
}
// Async iterator API
[Symbol.asyncIterator]() {
return __asyncGenerator(this, null, function* () {
const memo = [];
const dlmtr = this._snapshot.delimiter || $.delimiter || DLMTR;
for (const chunk of this._zurk.store.stdout) {
yield* __yieldStar((0, import_util.getLines)(chunk, memo, dlmtr));
}
try {
for (var iter = __forAwait(this.stdout || []), more, temp, error; more = !(temp = yield new __await(iter.next())).done; more = false) {
const chunk = temp.value;
yield* __yieldStar((0, import_util.getLines)(chunk, memo, dlmtr));
}
} catch (temp) {
error = [temp];
} finally {
try {
more && (temp = iter.return) && (yield new __await(temp.call(iter)));
} finally {
if (error)
throw error[0];
}
}
if (memo[0]) yield memo[0];
yield new __await(this);
});
}
emit(event, ...args) {
return this;
}
on(event, cb) {
this._stdin.on(event, cb);
return this;
}
once(event, cb) {
this._stdin.once(event, cb);
return this;
}
write(data, encoding, cb) {
this._stdin.write(data, encoding, cb);
return this;
}
end(chunk, cb) {
this._stdin.end(chunk, cb);
return this;
}
removeListener(event, cb) {
this._stdin.removeListener(event, cb);
return this;
}
// prettier-ignore
static disarm(p, toggle = true) {
Object.getOwnPropertyNames(_ProcessPromise.prototype).forEach((k) => {
if (k in Promise.prototype) return;
if (!toggle) {
Reflect.deleteProperty(p, k);
return;
}
Object.defineProperty(p, k, { configurable: true, get() {
throw new Fail("Inappropriate usage. Apply $ instead of direct instantiation.");
} });
});
}
};
// prettier-ignore
_ProcessPromise.bus = {
refs: /* @__PURE__ */ new Map(),
streams: /* @__PURE__ */ new WeakMap(),
pipe(from, to) {
const set = this.refs.get(from) || this.refs.set(from, /* @__PURE__ */ new Set()).get(from);
set.add(to);
},
unpipe(from, to) {
const set = this.refs.get(from);
if (!set) return;
if (to) set.delete(to);
if (set.size) return;
this.refs.delete(from);
from._piped = false;
},
unpipeBack(to, from) {
if (from) return this.unpipe(from, to);
for (const _from of this.refs.keys()) {
this.unpipe(_from, to);
}
},
runBack(p) {
var _a;
for (const from of this.sources(p)) {
if (from instanceof _ProcessPromise) from.run();
else (_a = this.streams.get(from)) == null ? void 0 : _a.run();
}
},
sources(p) {
const refs = [];
for (const [from, set] of this.refs.entries()) {
set.has(p) && refs.push(from);
}
return refs;
}
};
_ProcessPromise.promisifyStream = (stream, from) => {
const proxy = _ProcessPromise.bus.streams.get(stream) || (0, import_util.proxyOverride)(stream, {
then(res = import_util.noop, rej = import_util.noop) {
return new Promise((_res, _rej) => {
const end = () => _res(res((0, import_util.proxyOverride)(stream, from.output)));
stream.once("error", (e) => _rej(rej(e))).once("finish", end).once(EPF, end);
});
},
run() {
from.run();
},
pipe(...args) {
const dest = stream.pipe.apply(stream, args);
return dest instanceof _ProcessPromise ? dest : _ProcessPromise.promisifyStream(dest, from);
}
});
_ProcessPromise.bus.streams.set(stream, proxy);
return proxy;
};
var ProcessPromise = _ProcessPromise;
var _ProcessOutput = class _ProcessOutput extends Error {
// prettier-ignore
constructor(code = null, signal = null, stdout = "", stderr = "", stdall = "", message = "", duration = 0, error = null, from = "", store = { stdout: [stdout], stderr: [stderr], stdall: [stdall] }) {
super(message);
const dto = code !== null && typeof code === "object" ? code : { code, signal, duration, error, from, store };
Object.defineProperties(this, {
_dto: { value: dto, enumerable: false },
cause: { get() {
return dto.error;
}, enumerable: false },
stdout: { get: (0, import_util.once)(() => (0, import_util.bufArrJoin)(dto.store.stdout)) },
stderr: { get: (0, import_util.once)(() => (0, import_util.bufArrJoin)(dto.store.stderr)) },
stdall: { get: (0, import_util.once)(() => (0, import_util.bufArrJoin)(dto.store.stdall)) },
message: { get: (0, import_util.once)(
() => dto.error || message ? _ProcessOutput.getErrorMessage(dto.error || new Error(message), dto.from) : _ProcessOutput.getExitMessage(
dto.code,
dto.signal,
this.stderr,
dto.from,
this.stderr.trim() ? "" : _ProcessOutput.getErrorDetails(this.lines())
)
) }
});
}
get exitCode() {
return this._dto.code;
}
get signal() {
return this._dto.signal;
}
get duration() {
return this._dto.duration;
}
get [Symbol.toStringTag]() {
return "ProcessOutput";
}
get ok() {
return !this._dto.error && this.exitCode === 0;
}
json() {
return JSON.parse(this.stdall);
}
buffer() {
return import_node_buffer.Buffer.from(this.stdall);
}
blob(type = "text/plain") {
if (!globalThis.Blob)
throw new Fail(
"Blob is not supported in this environment. Provide a polyfill"
);
return new Blob([this.buffer()], { type });
}
text(encoding = "utf8") {
return encoding === "utf8" ? this.toString() : this.buffer().toString(encoding);
}
lines(delimiter) {
return (0, import_util.iteratorToArray)(this[Symbol.iterator](delimiter));
}
toString() {
return this.stdall;
}
valueOf() {
return this.stdall.trim();
}
[Symbol.toPrimitive]() {
return this.valueOf();
}
// prettier-ignore
*[Symbol.iterator](dlmtr = this._dto.delimiter || $.delimiter || DLMTR) {
const memo = [];
for (const chunk of this._dto.store.stdall) {
yield* __yieldStar((0, import_util.getLines)(chunk, memo, dlmtr));
}
if (memo[0]) yield memo[0];
}
[import_node_util2.inspect.custom]() {
const codeInfo = _ProcessOutput.getExitCodeInfo(this.exitCode);
return `ProcessOutput {
stdout: ${import_vendor_core2.chalk.green((0, import_node_util2.inspect)(this.stdout))},
stderr: ${import_vendor_core2.chalk.red((0, import_node_util2.inspect)(this.stderr))},
signal: ${(0, import_node_util2.inspect)(this.signal)},
exitCode: ${(this.ok ? import_vendor_core2.chalk.green : import_vendor_core2.chalk.red)(this.exitCode)}${codeInfo ? import_vendor_core2.chalk.grey(" (" + codeInfo + ")") : ""},
duration: ${this.duration}
}`;
}
static fromError(error) {
const output = new _ProcessOutput();
output._dto.error = error;
return output;
}
};
_ProcessOutput.getExitMessage = Fail.formatExitMessage;
_ProcessOutput.getErrorMessage = Fail.formatErrorMessage;
_ProcessOutput.getErrorDetails = Fail.formatErrorDetails;
_ProcessOutput.getExitCodeInfo = Fail.getExitCodeInfo;
var ProcessOutput = _ProcessOutput;
var useBash = () => setShell("bash", false);
var usePwsh = () => setShell("pwsh");
var usePowerShell = () => setShell("powershell.exe");
function setShell(n, ps3 = true) {
$.shell = import_vendor_core2.which.sync(n);
$.prefix = ps3 ? "" : "set -euo pipefail;";
$.postfix = ps3 ? "; exit $LastExitCode" : "";
$.quote = ps3 ? import_util.quotePowerShell : import_util.quote;
}
try {
const { shell, prefix, postfix } = $;
useBash();
if ((0, import_util.isString)(shell)) $.shell = shell;
if ((0, import_util.isString)(prefix)) $.prefix = prefix;
if ((0, import_util.isString)(postfix)) $.postfix = postfix;
} catch (err) {
}
var cwdSyncHook;
function syncProcessCwd(flag = true) {
cwdSyncHook = cwdSyncHook || (0, import_node_async_hooks.createHook)({
init: syncCwd,
before: syncCwd,
promiseResolve: syncCwd,
after: syncCwd,
destroy: syncCwd
});
if (flag) cwdSyncHook.enable();
else cwdSyncHook.disable();
}
function syncCwd() {
if ($[CWD] != import_node_process2.default.cwd()) import_node_process2.default.chdir($[CWD]);
}
function cd(dir) {
if (dir instanceof ProcessOutput) {
dir = dir.toString().trim();
}
$.log({ kind: "cd", dir, verbose: !$.quiet && $.verbose });
import_node_process2.default.chdir(dir);
$[CWD] = import_node_process2.default.cwd();
}
function kill(_0) {
return __async(this, arguments, function* (pid, signal = $.killSignal || SIGTERM) {
if (typeof pid !== "number" && typeof pid !== "string" || !/^\d+$/.test(pid))
throw new Fail(`Invalid pid: ${pid}`);
$.log({ kind: "kill", pid, signal, verbose: !$.quiet && $.verbose });
if (import_node_process2.default.platform === "win32" && (yield new Promise((resolve) => {
import_node_child_process.default.exec(`taskkill /pid ${pid} /t /f`, (err) => resolve(!err));
})))
return;
for (const p of yield import_vendor_core2.ps.tree({ pid, recursive: true })) {
try {
import_node_process2.default.kill(+p.pid, signal);
} catch (e) {
}
}
try {
import_node_process2.default.kill(-pid, signal);
} catch (e) {
try {
import_node_process2.default.kill(+pid, signal);
} catch (e2) {
}
}
});
}
function resolveDefaults(defs = defaults, prefix = ENV_PREFIX, env = import_node_process2.default.env, allowed = ENV_OPTS) {
return Object.entries(env).reduce((m, [k, v]) => {
if (v && k.startsWith(prefix)) {
const _k = (0, import_util.toCamelCase)(k.slice(prefix.length));
const _v = (0, import_util.parseBool)(v);
if (allowed.has(_k)) m[_k] = _v;
}
return m;
}, defs);
}
/* c8 ignore next 100 */
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
$,
Fail,
ProcessOutput,
ProcessPromise,
bus,
cd,
chalk,
defaults,
kill,
log,
os,
path,
ps,
quote,
quotePowerShell,
resolveDefaults,
syncProcessCwd,
useBash,
usePowerShell,
usePwsh,
which,
within
});
================================================
FILE: build/core.d.ts
================================================
/// <reference types="node" />
/// <reference types="fs-extra" />
import { Buffer } from 'node:buffer';
import cp, { type ChildProcess, type IOType, type StdioOptions } from 'node:child_process';
import { type Encoding } from 'node:crypto';
import { EventEmitter } from 'node:events';
import { type Readable, type Writable } from 'node:stream';
import { inspect } from 'node:util';
import { Fail } from './error.js';
import { log } from './log.js';
import { type TSpawnStore } from './vendor-core.js';
import { type Duration, quote } from './util.js';
export { bus } from './internals.js';
export { default as path } from 'node:path';
export * as os from 'node:os';
export { Fail } from './error.js';
export { log, type LogEntry } from './log.js';
export { chalk, which, ps } from './vendor-core.js';
export { type Duration, quote, quotePowerShell } from './util.js';
declare const CWD: unique symbol;
declare const SYNC: unique symbol;
declare const SHOT: unique symbol;
export interface Options {
[CWD]: string;
[SYNC]: boolean;
cwd?: string;
ac?: AbortController;
signal?: AbortSignal;
input?: string | Buffer | Readable | ProcessOutput | ProcessPromise;
timeout?: Duration;
timeoutSignal?: NodeJS.Signals;
stdio: StdioOptions;
verbose: boolean;
sync: boolean;
env: NodeJS.ProcessEnv;
shell: string | true;
nothrow: boolean;
prefix?: string;
postfix?: string;
quote?: typeof quote;
quiet: boolean;
detached: boolean;
preferLocal: boolean | string | string[];
spawn: typeof cp.spawn;
spawnSync: typeof cp.spawnSync;
store?: TSpawnStore;
log: typeof log;
kill: typeof kill;
killSignal?: NodeJS.Signals;
halt?: boolean;
delimiter?: string | RegExp;
}
type Snapshot = Options & {
from: string;
pieces: TemplateStringsArray;
args: string[];
cmd: string;
ee: EventEmitter;
ac: AbortController;
};
export declare const defaults: Options;
export declare function within<R>(callback: () => R): R;
export interface Shell<S = false, R = S extends true ? ProcessOutput : ProcessPromise> {
(pieces: TemplateStringsArray, ...args: any[]): R;
<O extends Partial<Options> = Partial<Options>, R = O extends {
sync: true;
} ? Shell<true> : Shell>(opts: O): R;
sync: {
(pieces: TemplateStringsArray, ...args: any[]): ProcessOutput;
(opts: Partial<Omit<Options, 'sync'>>): Shell<true>;
};
}
export type $ = Shell & Options;
export declare const $: $;
type ProcessStage = 'initial' | 'halted' | 'running' | 'fulfilled' | 'rejected';
type Resolve = (out: ProcessOutput) => void;
type Reject = (error: ProcessOutput | Error) => void;
type PromiseCallback = {
(resolve: Resolve, reject: Reject): void;
[SHOT]?: Snapshot;
};
type PromisifiedStream<D extends Writable = Writable> = D & PromiseLike<ProcessOutput & D> & {
run(): void;
};
type PipeAcceptor = Writable | ProcessPromise;
type PipeMethod = {
(dest: TemplateStringsArray, ...args: any[]): ProcessPromise;
(file: string): PromisifiedStream;
<D extends Writable>(dest: D): PromisifiedStream<D>;
<D extends ProcessPromise>(dest: D): D;
};
export declare class ProcessPromise extends Promise<ProcessOutput> {
private _stage;
private _id;
private _snapshot;
private _timeoutId?;
private _piped;
private _stdin;
private _zurk;
private _output;
private _resolve;
private _reject;
constructor(executor: PromiseCallback);
private build;
run(): this;
private _breakerData?;
private break;
private finalize;
abort(reason?: string): void;
kill(signal?: NodeJS.Signals | null): Promise<void>;
stdio(stdin: IOType | StdioOptions, stdout?: IOType, stderr?: IOType): this;
nothrow(v?: boolean): this;
quiet(v?: boolean): this;
verbose(v?: boolean): this;
timeout(d?: Duration, signal?: NodeJS.Signals | undefined): this;
/**
* @deprecated Use $({halt: true})`cmd` instead.
*/
halt(): this;
get id(): string;
get pid(): number | undefined;
get cwd(): string;
get cmd(): string;
get fullCmd(): string;
get child(): ChildProcess | undefined;
get stdin(): Writable;
get stdout(): Readable;
get stderr(): Readable;
get exitCode(): Promise<number | null>;
get signal(): AbortSignal;
get ac(): AbortController;
get output(): ProcessOutput | null;
get stage(): ProcessStage;
get sync(): boolean;
get [Symbol.toStringTag](): string;
[Symbol.toPrimitive](): string;
json<T = any>(): Promise<T>;
text(encoding?: Encoding): Promise<string>;
lines(delimiter?: Options['delimiter']): Promise<string[]>;
buffer(): Promise<Buffer>;
blob(type?: string): Promise<Blob>;
isQuiet(): boolean;
isVerbose(): boolean;
isNothrow(): boolean;
isHalted(): boolean;
private isSettled;
private isRunning;
get pipe(): PipeMethod & {
[key in keyof TSpawnStore]: PipeMethod;
};
unpipe(to?: PipeAcceptor): this;
private _pipe;
private static bus;
private static promisifyStream;
then<R = ProcessOutput, E = ProcessOutput>(onfulfilled?: ((value: ProcessOutput) => PromiseLike<R> | R) | undefined | null, onrejected?: ((reason: ProcessOutput) => PromiseLike<E> | E) | undefined | null): Promise<R | E>;
catch<T = ProcessOutput>(onrejected?: ((reason: ProcessOutput) => PromiseLike<T> | T) | undefined | null): Promise<ProcessOutput | T>;
[Symbol.asyncIterator](): AsyncIterator<string>;
private writable;
private emit;
private on;
private once;
private write;
private end;
private removeListener;
private static disarm;
}
type ProcessDto = {
code: number | null;
signal: NodeJS.Signals | null;
duration: number;
error: any;
from: string;
store: TSpawnStore;
delimiter?: string | RegExp;
};
export declare class ProcessOutput extends Error {
private readonly _dto;
cause: Error | null;
message: string;
stdout: string;
stderr: string;
stdall: string;
constructor(dto: ProcessDto);
constructor(code?: number | null, signal?: NodeJS.Signals | null, stdout?: string, stderr?: string, stdall?: string, message?: string, duration?: number);
get exitCode(): number | null;
get signal(): NodeJS.Signals | null;
get duration(): number;
get [Symbol.toStringTag](): string;
get ok(): boolean;
json<T = any>(): T;
buffer(): Buffer;
blob(type?: string): Blob;
text(encoding?: Encoding): string;
lines(delimiter?: string | RegExp): string[];
toString(): string;
valueOf(): string;
[Symbol.toPrimitive](): string;
[Symbol.iterator](dlmtr?: Options['delimiter']): Iterator<string>;
[inspect.custom](): string;
static getExitMessage: typeof Fail.formatExitMessage;
static getErrorMessage: typeof Fail.formatErrorMessage;
static getErrorDetails: typeof Fail.formatErrorDetails;
static getExitCodeInfo: typeof Fail.getExitCodeInfo;
static fromError(error: Error): ProcessOutput;
}
export declare const useBash: () => void;
export declare const usePwsh: () => void;
export declare const usePowerShell: () => void;
export declare function syncProcessCwd(flag?: boolean): void;
export declare function cd(dir: string | ProcessOutput): void;
export declare function kill(pid: number | `${number}`, signal?: NodeJS.Signals): Promise<void>;
export declare function resolveDefaults(defs?: Options, prefix?: string, env?: NodeJS.ProcessEnv, allowed?: Set<string>): Options;
================================================
FILE: build/core.js
================================================
"use strict";
import "./deno.js"
import * as __module__ from "./core.cjs"
const {
$,
Fail,
ProcessOutput,
ProcessPromise,
bus,
cd,
chalk,
defaults,
kill,
log,
os,
path,
ps,
quote,
quotePowerShell,
resolveDefaults,
syncProcessCwd,
useBash,
usePowerShell,
usePwsh,
which,
within
} = globalThis.Deno ? globalThis.require("./core.cjs") : __module__
export {
$,
Fail,
ProcessOutput,
ProcessPromise,
bus,
cd,
chalk,
defaults,
kill,
log,
os,
path,
ps,
quote,
quotePowerShell,
resolveDefaults,
syncProcessCwd,
useBash,
usePowerShell,
usePwsh,
which,
within
}
================================================
FILE: build/deno.js
================================================
import { createRequire } from 'node:module'
import * as process from 'node:process'
// prettier-ignore
if (globalThis.Deno) {
globalThis.require = createRequire(import.meta.url)
globalThis.__filename = new URL(import.meta.url).pathname
globalThis.__dirname = new URL('.', import.meta.url).pathname
globalThis.module = new Proxy({}, { set() { return true } })
const p = globalThis.process = globalThis.process || process
p.version || (p.version = 'v18.0.0')
p.version || (p.version = { node: '18.0.0' })
p.env || (p.env = globalThis.Deno.env.toObject())
p.argv || (p.argv = [globalThis.Deno.execPath(), globalThis.Deno.mainModule.replace('file://', ''), ...globalThis.Deno.args])
}
================================================
FILE: build/deps.cjs
================================================
"use strict";
const {
__export,
__toCommonJS,
__async
} = require('./esblib.cjs');
// src/deps.ts
var deps_exports = {};
__export(deps_exports, {
installDeps: () => installDeps,
parseDeps: () => parseDeps
});
module.exports = __toCommonJS(deps_exports);
var import_node_module = require("module");
var import_index = require("./index.cjs");
var import_vendor = require("./vendor.cjs");
function installDeps(dependencies, prefix, registry, installerType = "npm") {
return __async(this, null, function* () {
const installer = installers[installerType];
const packages = Object.entries(dependencies).map(
([name, version]) => `${name}@${version}`
);
if (packages.length === 0) return;
if (!installer) {
throw new import_index.Fail(
`Unsupported installer type: ${installerType}. Supported types: ${Object.keys(installers).join(", ")}`
);
}
yield (0, import_index.spinner)(
`${installerType} i ${packages.join(" ")}`,
() => installer({ packages, prefix, registry })
);
});
}
var installers = {
npm: (_0) => __async(null, [_0], function* ({ packages, prefix, registry }) {
const flags = [
"--no-save",
"--no-audit",
"--no-fund",
prefix && `--prefix=${prefix}`,
registry && `--registry=${registry}`
].filter(Boolean);
yield import_index.$`npm install ${flags} ${packages}`.nothrow();
})
};
var builtins = new Set(import_node_module.builtinModules);
var nameRe = new RegExp("^(?<name>(@[a-z\\d-~][\\w-.~]*\\/)?[a-z\\d-~][\\w-.~]*)\\/?.*$", "i");
var versionRe = new RegExp("^@(?<version>[~^]?(v?[\\dx*]+([-.][\\d*a-z-]+)*))", "i");
function parseDeps(content) {
return (0, import_vendor.depseek)(content + "\n", { comments: true }).reduce((m, { type, value }, i, list) => {
if (type === "dep") {
const meta = list[i + 1];
const name = parsePackageName(value);
const version = (meta == null ? void 0 : meta.type) === "comment" && parseVersion(meta == null ? void 0 : meta.value.trim()) || "latest";
if (name) m[name] = version;
}
return m;
}, {});
}
function parsePackageName(path) {
var _a, _b;
if (!path) return;
const name = (_b = (_a = nameRe.exec(path)) == null ? void 0 : _a.groups) == null ? void 0 : _b.name;
if (name && !builtins.has(name)) return name;
}
function parseVersion(line) {
var _a, _b;
return ((_b = (_a = versionRe.exec(line)) == null ? void 0 : _a.groups) == null ? void 0 : _b.version) || "latest";
}
/* c8 ignore next 100 */
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
installDeps,
parseDeps
});
================================================
FILE: build/deps.d.ts
================================================
/**
* Install npm dependencies
* @param dependencies object of dependencies
* @param prefix path to the directory where npm should install the dependencies
* @param registry custom npm registry URL when installing dependencies
* @param installerType package manager: npm, yarn, pnpm, bun, etc.
*/
export declare function installDeps(dependencies: Record<string, string>, prefix?: string, registry?: string, installerType?: string): Promise<void>;
export declare function parseDeps(content: string): Record<string, string>;
================================================
FILE: build/error.d.ts
================================================
export declare class Fail extends Error {
static DOCS_URL: string;
static EXIT_CODES: Record<number, string>;
static ERRNO_CODES: Record<number, string>;
static formatExitMessage(code: number | null, signal: NodeJS.Signals | null, stderr: string, from: string, details?: string): string;
static formatErrorMessage(err: NodeJS.ErrnoException, from: string): string;
static formatErrorDetails(lines?: string[], lim?: number): string;
static getExitCodeInfo(exitCode: number | null): string | undefined;
static getCallerLocationFromString(stackString?: string): string;
static getCallerLocation(err?: Error): string;
static getErrnoMessage(errno?: number): string;
}
================================================
FILE: build/esblib.cjs
================================================
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x2) => x2.done ? resolve(x2.value) : Promise.resolve(x2.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
var __typeError = (msg) => {
throw TypeError(msg);
};
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __await = function(promise, isYieldStar) {
this[0] = promise;
this[1] = isYieldStar;
};
var __asyncGenerator = (__this, __arguments, generator) => {
var resume = (k2, v2, yes, no) => {
try {
var x2 = generator[k2](v2), isAwait = (v2 = x2.value) instanceof __await, done = x2.done;
Promise.resolve(isAwait ? v2[0] : v2).then((y) => isAwait ? resume(k2 === "return" ? k2 : "next", v2[1] ? { done: y.done, value: y.value } : y, yes, no) : yes({ value: y, done })).catch((e) => resume("throw", e, yes, no));
} catch (e) {
no(e);
}
}, method = (k2) => it[k2] = (x2) => new Promise((yes, no) => resume(k2, x2, yes, no)), it = {};
return generator = generator.apply(__this, __arguments), it[__knownSymbol("asyncIterator")] = () => it, method("next"), method("throw"), method("return"), it;
};
var __yieldStar = (value) => {
var obj = value[__knownSymbol("asyncIterator")], isAwait = false, method, it = {};
if (obj == null) {
obj = value[__knownSymbol("iterator")]();
method = (k2) => it[k2] = (x2) => obj[k2](x2);
} else {
obj = obj.call(value);
method = (k2) => it[k2] = (v2) => {
if (isAwait) {
isAwait = false;
if (k2 === "throw") throw v2;
return v2;
}
isAwait = true;
return {
done: false,
value: new __await(new Promise((resolve) => {
var x2 = obj[k2](v2);
if (!(x2 instanceof Object)) __typeError("Object expected");
resolve(x2);
}), 1)
};
};
}
return it[__knownSymbol("iterator")] = () => it, method("next"), "throw" in obj ? method("throw") : it.throw = (x2) => {
throw x2;
}, "return" in obj && method("return"), it;
};
var __forAwait = (obj, it, method) => (it = obj[__knownSymbol("asyncIterator")]) ? it.call(obj) : (obj = obj[__knownSymbol("iterator")](), it = {}, method = (key, fn) => (fn = obj[key]) && (it[key] = (arg) => new Promise((yes, no, done) => (arg = fn.call(obj, arg), done = arg.done, Promise.resolve(arg.value).then((value) => yes({ value, done }), no)))), method("next"), method("return"), it);
var __pow = Math.pow;
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
module.exports = {
__create,
__defProp,
__getOwnPropDesc,
__getOwnPropNames,
__getProtoOf,
__hasOwnProp,
__export,
__copyProps,
__toESM,
__toCommonJS,
__async,
__defProps,
__getOwnPropDescs,
__getOwnPropSymbols,
__propIsEnum,
__knownSymbol,
__typeError,
__defNormalProp,
__spreadValues,
__spreadProps,
__await,
__asyncGenerator,
__yieldStar,
__forAwait,
__pow,
__reExport,
__commonJS,
__esm,
__accessCheck,
__privateGet,
__privateAdd,
__privateSet
};
================================================
FILE: build/globals.cjs
================================================
"use strict";
const {
__toESM
} = require('./esblib.cjs');
// src/globals.ts
var _ = __toESM(require("./index.cjs"), 1);
Object.assign(globalThis, _);
================================================
FILE: build/globals.d.ts
================================================
import * as _ from './index.js';
declare global {
type ProcessPromise = _.ProcessPromise;
type ProcessOutput = _.ProcessOutput;
var ProcessPromise: typeof _.ProcessPromise;
var ProcessOutput: typeof _.ProcessOutput;
var $: typeof _.$;
var argv: typeof _.argv;
var cd: typeof _.cd;
var chalk: typeof _.chalk;
var defaults: typeof _.defaults;
var dotenv: typeof _.dotenv;
var echo: typeof _.echo;
var expBackoff: typeof _.expBackoff;
var fs: typeof _.fs;
var glob: typeof _.glob;
var globby: typeof _.globby;
var kill: typeof _.kill;
var log: typeof _.log;
var minimist: typeof _.minimist;
var nothrow: typeof _.nothrow;
var os: typeof _.os;
var parseArgv: typeof _.parseArgv;
var path: typeof _.path;
var ps: typeof _.ps;
var question: typeof _.question;
var quiet: typeof _.quiet;
var quote: typeof _.quote;
var quotePowerShell: typeof _.quotePowerShell;
var resolveDefaults: typeof _.resolveDefaults;
var retry: typeof _.retry;
var sleep: typeof _.sleep;
var spinner: typeof _.spinner;
var stdin: typeof _.stdin;
var syncProcessCwd: typeof _.syncProcessCwd;
var tempdir: typeof _.tempdir;
var tempfile: typeof _.tempfile;
var tmpdir: typeof _.tempdir;
var tmpfile: typeof _.tempfile;
var updateArgv: typeof _.updateArgv;
var usePowerShell: typeof _.usePowerShell;
var usePwsh: typeof _.usePwsh;
var useBash: typeof _.useBash;
var version: typeof _.version;
var VERSION: typeof _.VERSION;
var which: typeof _.which;
var within: typeof _.within;
var YAML: typeof _.YAML;
}
================================================
FILE: build/globals.js
================================================
"use strict";
import "./deno.js"
import * as __module__ from "./globals.cjs"
const {
} = globalThis.Deno ? globalThis.require("./globals.cjs") : __module__
export {
}
================================================
FILE: build/goods.d.ts
================================================
import { Buffer } from 'node:buffer';
import { Readable } from 'node:stream';
import { type Mode } from 'node:fs';
import { type ProcessPromise } from './core.js';
import { type Duration } from './util.js';
import { type RequestInfo, type RequestInit, minimist } from './vendor.js';
export { versions } from './versions.js';
export declare function tempdir(prefix?: string, mode?: Mode): string;
export declare function tempfile(name?: string, data?: string | Buffer, mode?: Mode): string;
export { tempdir as tmpdir, tempfile as tmpfile };
type ArgvOpts = minimist.Opts & {
camelCase?: boolean;
parseBoolean?: boolean;
};
export declare const parseArgv: (args?: string[], opts?: ArgvOpts, defs?: Record<string, any>) => minimist.ParsedArgs;
export declare function updateArgv(args?: string[], opts?: ArgvOpts): void;
export declare const argv: minimist.ParsedArgs;
export declare function sleep(duration: Duration): Promise<void>;
export declare function fetch(url: RequestInfo, init?: RequestInit): Promise<Response> & {
pipe: {
(dest: TemplateStringsArray, ...args: any[]): ProcessPromise;
<D>(dest: D): D;
};
};
export declare function echo(...args: any[]): void;
export declare function question(query?: string, { choices, input, output, }?: {
choices?: string[];
input?: NodeJS.ReadStream;
output?: NodeJS.WriteStream;
}): Promise<string>;
export declare function stdin(stream?: Readable): Promise<string>;
export declare function retry<T>(count: number, callback: () => T): Promise<T>;
export declare function retry<T>(count: number, duration: Duration | Generator<number>, callback: () => T): Promise<T>;
export declare function expBackoff(max?: Duration, delay?: Duration): Generator<number, void, unknown>;
export declare function spinner<T>(callback: () => T): Promise<T>;
export declare function spinner<T>(title: string, callback: () => T): Promise<T>;
================================================
FILE: build/index.cjs
================================================
"use strict";
const {
__pow,
__export,
__reExport,
__toESM,
__toCommonJS,
__async,
__forAwait
} = require('./esblib.cjs');
// src/index.ts
var index_exports = {};
__export(index_exports, {
MAML: () => import_vendor2.MAML,
VERSION: () => VERSION,
YAML: () => import_vendor2.YAML,
argv: () => argv,
dotenv: () => import_vendor2.dotenv,
echo: () => echo,
expBackoff: () => expBackoff,
fetch: () => fetch,
fs: () => import_vendor2.fs,
glob: () => import_vendor2.glob,
globby: () => import_vendor2.glob,
minimist: () => import_vendor2.minimist,
nothrow: () => nothrow,
parseArgv: () => parseArgv,
question: () => question,
quiet: () => quiet,
retry: () => retry,
sleep: () => sleep,
spinner: () => spinner,
stdin: () => stdin,
tempdir: () => tempdir,
tempfile: () => tempfile,
tmpdir: () => tempdir,
tmpfile: () => tempfile,
updateArgv: () => updateArgv,
version: () => version,
versions: () => versions
});
module.exports = __toCommonJS(index_exports);
var import_core2 = require("./core.cjs");
// src/goods.ts
var import_node_buffer = require("buffer");
var import_node_process = __toESM(require("process"), 1);
var import_node_readline = require("readline");
var import_node_stream = require("stream");
var import_core = require("./core.cjs");
var import_util = require("./util.cjs");
var import_vendor = require("./vendor.cjs");
// src/versions.ts
var versions = {
zx: "8.9.0",
chalk: "5.6.2",
depseek: "0.4.3",
dotenv: "0.2.3",
fetch: "1.6.7",
fs: "11.3.3",
glob: "16.1.1",
minimist: "1.2.8",
ps: "1.0.0",
which: "6.0.1",
yaml: "2.8.2"
};
// src/goods.ts
function tempdir(prefix = `zx-${(0, import_util.randomId)()}`, mode) {
const dirpath = import_core.path.join(import_core.os.tmpdir(), prefix);
import_vendor.fs.mkdirSync(dirpath, { recursive: true, mode });
return dirpath;
}
function tempfile(name, data, mode) {
const filepath = name ? import_core.path.join(tempdir(), name) : import_core.path.join(import_core.os.tmpdir(), `zx-${(0, import_util.randomId)()}`);
if (data === void 0) import_vendor.fs.closeSync(import_vendor.fs.openSync(filepath, "w", mode));
else import_vendor.fs.writeFileSync(filepath, data, { mode });
return filepath;
}
var parseArgv = (args = import_node_process.default.argv.slice(2), opts = {}, defs = {}) => Object.entries((0, import_vendor.minimist)(args, opts)).reduce(
(m, [k, v]) => {
const kTrans = opts.camelCase ? import_util.toCamelCase : import_util.identity;
const vTrans = opts.parseBoolean ? import_util.parseBool : import_util.identity;
const [_k, _v] = k === "--" || k === "_" ? [k, v] : [kTrans(k), vTrans(v)];
m[_k] = _v;
return m;
},
defs
);
function updateArgv(args, opts) {
for (const k in argv) delete argv[k];
parseArgv(args, opts, argv);
}
var argv = parseArgv();
function sleep(duration) {
return new Promise((resolve) => {
setTimeout(resolve, (0, import_util.parseDuration)(duration));
});
}
var responseToReadable = (response, rs) => {
var _a;
const reader = (_a = response.body) == null ? void 0 : _a.getReader();
if (!reader) {
rs.push(null);
return rs;
}
rs._read = () => __async(null, null, function* () {
const result = yield reader.read();
rs.push(result.done ? null : import_node_buffer.Buffer.from(result.value));
});
return rs;
};
function fetch(url, init) {
import_core.$.log({ kind: "fetch", url, init, verbose: !import_core.$.quiet && import_core.$.verbose });
const p = (0, import_vendor.nodeFetch)(url, init);
return Object.assign(p, {
pipe(dest, ...args) {
const rs = new import_node_stream.Readable();
const _dest = (0, import_util.isStringLiteral)(dest, ...args) ? (0, import_core.$)({
halt: true,
signal: init == null ? void 0 : init.signal
})(dest, ...args) : dest;
p.then(
(r) => {
var _a;
return responseToReadable(r, rs).pipe((_a = _dest.run) == null ? void 0 : _a.call(_dest));
},
(err) => {
var _a;
return (_a = _dest.abort) == null ? void 0 : _a.call(_dest, err);
}
);
return _dest;
}
});
}
function echo(pieces, ...args) {
const msg = (0, import_util.isStringLiteral)(pieces, ...args) ? args.map((a, i) => pieces[i] + stringify(a)).join("") + (0, import_util.getLast)(pieces) : [pieces, ...args].map(stringify).join(" ");
console.log(msg);
}
function stringify(arg) {
return arg instanceof import_core.ProcessOutput ? arg.toString().trimEnd() : `${arg}`;
}
function question(_0) {
return __async(this, arguments, function* (query, {
choices,
input = import_node_process.default.stdin,
output = import_node_process.default.stdout
} = {}) {
const completer = Array.isArray(choices) ? (line) => {
const hits = choices.filter((c) => c.startsWith(line));
return [hits.length ? hits : choices, line];
} : void 0;
const rl = (0, import_node_readline.createInterface)({
input,
output,
terminal: true,
completer
});
return new Promise(
(resolve) => rl.question(query != null ? query : "", (answer) => {
rl.close();
resolve(answer);
})
);
});
}
function stdin() {
return __async(this, arguments, function* (stream = import_node_process.default.stdin) {
let buf = "";
try {
for (var iter = __forAwait(stream.setEncoding("utf8")), more, temp, error; more = !(temp = yield iter.next()).done; more = false) {
const chunk = temp.value;
buf += chunk;
}
} catch (temp) {
error = [temp];
} finally {
try {
more && (temp = iter.return) && (yield temp.call(iter));
} finally {
if (error)
throw error[0];
}
}
return buf;
});
}
function retry(count, d, cb) {
return __async(this, null, function* () {
if (typeof d === "function") return retry(count, 0, d);
if (!cb) throw new import_core.Fail("Callback is required for retry");
const total = count;
const gen = typeof d === "object" ? d : (function* (d2) {
while (true) yield d2;
})((0, import_util.parseDuration)(d));
let attempt = 0;
let lastErr;
while (count-- > 0) {
attempt++;
try {
return yield cb();
} catch (err) {
lastErr = err;
const delay = gen.next().value;
import_core.$.log({
kind: "retry",
total,
attempt,
delay,
exception: err,
verbose: !import_core.$.quiet && import_core.$.verbose,
error: `FAIL Attempt: ${attempt}/${total}, next: ${delay}`
// legacy
});
if (delay > 0) yield sleep(delay);
}
}
throw lastErr;
});
}
function* expBackoff(max = "60s", delay = "100ms") {
const maxMs = (0, import_util.parseDuration)(max);
const randMs = (0, import_util.parseDuration)(delay);
let n = 0;
while (true) {
yield Math.min(randMs * __pow(2, n++), maxMs);
}
}
function spinner(title, callback) {
return __async(this, null, function* () {
if (typeof title === "function") return spinner("", title);
if (import_core.$.quiet || import_node_process.default.env.CI) return callback();
let i = 0;
const stream = import_core.$.log.output || import_node_process.default.stderr;
const spin = () => stream.write(` ${"\u280B\u2819\u2839\u2838\u283C\u2834\u2826\u2827\u2807\u280F"[i++ % 10]} ${title}\r`);
return (0, import_core.within)(() => __async(null, null, function* () {
import_core.$.verbose = false;
const id = setInterval(spin, 100);
try {
return yield callback();
} finally {
clearInterval(id);
stream.write(" ".repeat((import_node_process.default.stdout.columns || 1) - 1) + "\r");
}
}));
});
}
// src/index.ts
__reExport(index_exports, require("./core.cjs"), module.exports);
var import_vendor2 = require("./vendor.cjs");
import_core2.bus.lock();
var VERSION = versions.zx || "0.0.0";
var version = VERSION;
function nothrow(promise) {
return promise.nothrow();
}
function quiet(promise) {
return promise.quiet();
}
/* c8 ignore next 100 */
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
MAML,
VERSION,
YAML,
argv,
dotenv,
echo,
expBackoff,
fetch,
fs,
glob,
globby,
minimist,
nothrow,
parseArgv,
question,
quiet,
retry,
sleep,
spinner,
stdin,
tempdir,
tempfile,
tmpdir,
tmpfile,
updateArgv,
version,
versions,
...require("./core.cjs")
});
================================================
FILE: build/index.d.ts
================================================
/// <reference types="node" />
/// <reference types="fs-extra" />
import { type ProcessPromise } from './core.js';
export * from './core.js';
export * from './goods.js';
export { minimist, dotenv, fs, YAML, MAML, glob, glob as globby, } from './vendor.js';
export declare const VERSION: string;
export declare const version: string;
/**
* @deprecated Use $`cmd`.nothrow() instead.
*/
export declare function nothrow(promise: ProcessPromise): ProcessPromise;
/**
* @deprecated Use $`cmd`.quiet() instead.
*/
export declare function quiet(promise: ProcessPromise): ProcessPromise;
================================================
FILE: build/index.js
================================================
"use strict";
import "./deno.js"
import * as __module__ from "./index.cjs"
const {
MAML,
VERSION,
YAML,
argv,
dotenv,
echo,
expBackoff,
fetch,
fs,
glob,
globby,
minimist,
nothrow,
parseArgv,
question,
quiet,
retry,
sleep,
spinner,
stdin,
tempdir,
tempfile,
tmpdir,
tmpfile,
updateArgv,
version,
versions,
$,
Fail,
ProcessOutput,
ProcessPromise,
bus,
cd,
chalk,
defaults,
kill,
log,
os,
path,
ps,
quote,
quotePowerShell,
resolveDefaults,
syncProcessCwd,
useBash,
usePowerShell,
usePwsh,
which,
within
} = globalThis.Deno ? globalThis.require("./index.cjs") : __module__
export {
MAML,
VERSION,
YAML,
argv,
dotenv,
echo,
expBackoff,
fetch,
fs,
glob,
globby,
minimist,
nothrow,
parseArgv,
question,
quiet,
retry,
sleep,
spinner,
stdin,
tempdir,
tempfile,
tmpdir,
tmpfile,
updateArgv,
version,
versions,
$,
Fail,
ProcessOutput,
ProcessPromise,
bus,
cd,
chalk,
defaults,
kill,
log,
os,
path,
ps,
quote,
quotePowerShell,
resolveDefaults,
syncProcessCwd,
useBash,
usePowerShell,
usePwsh,
which,
within
}
================================================
FILE: build/internals.cjs
================================================
"use strict";
const {
__export,
__toCommonJS
} = require('./esblib.cjs');
// src/internals.ts
var internals_exports = {};
__export(internals_exports, {
bus: () => bus
});
module.exports = __toCommonJS(internals_exports);
var locked = false;
var lock = () => locked = true;
var store = /* @__PURE__ */ new Map();
var override = store.set.bind(store);
function wrap(name, api) {
if (locked) throw new Error("bus is locked");
override(name, api);
return new Proxy(api, {
get(_, key) {
var _a, _b;
return store.get(name)[key] || ((_b = (_a = store.get(name)) == null ? void 0 : _a.default) == null ? void 0 : _b[key]);
},
apply(_, self, args) {
return store.get(name).apply(self, args);
}
});
}
var bus = {
override,
wrap,
lock
};
/* c8 ignore next 100 */
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
bus
});
================================================
FILE: build/internals.d.ts
================================================
declare function wrap<T extends object>(name: string, api: T): T;
/**
* @internal
* @private
* @protected
*/
export declare const bus: {
override: (key: string, value: any) => Map<string, any>;
wrap: typeof wrap;
lock: () => void;
};
export {};
================================================
FILE: build/log.d.ts
================================================
import { type RequestInfo, type RequestInit } from './vendor-core.js';
import { type Buffer } from 'node:buffer';
export type LogEntry = {
verbose?: boolean;
} & ({
kind: 'cmd';
cmd: string;
cwd: string;
id: string;
} | {
kind: 'stdout';
data: Buffer;
id: string;
} | {
kind: 'stderr';
data: Buffer;
id: string;
} | {
kind: 'end';
exitCode: number | null;
signal: NodeJS.Signals | null;
duration: number;
error: null | Error;
id: string;
} | {
kind: 'cd';
dir: string;
} | {
kind: 'fetch';
url: RequestInfo;
init?: RequestInit;
} | {
kind: 'retry';
attempt: number;
total: number;
delay: number;
exception: unknown;
error?: string;
} | {
kind: 'custom';
data: any;
} | {
kind: 'kill';
pid: number | `${number}`;
signal: NodeJS.Signals | null;
});
type LogFormatters = {
[key in LogEntry['kind']]: (entry: Extract<LogEntry, {
kind: key;
}>) => string | Buffer;
};
type Log = {
(entry: LogEntry): void;
formatters?: Partial<LogFormatters>;
output?: NodeJS.WriteStream;
};
export declare const log: Log;
export declare function formatCmd(cmd: string): string;
export {};
================================================
FILE: build/md.d.ts
================================================
import { type Buffer } from 'node:buffer';
export declare function transformMarkdown(buf: Buffer | string): string;
================================================
FILE: build/util.cjs
================================================
"use strict";
const {
__spreadValues,
__spreadProps,
__export,
__toESM,
__toCommonJS
} = require('./esblib.cjs');
// src/util.ts
var util_exports = {};
__export(util_exports, {
bufArrJoin: () => bufArrJoin,
bufToString: () => bufToString,
getLast: () => getLast,
getLines: () => getLines,
identity: () => identity,
isString: () => isString,
isStringLiteral: () => import_vendor_core.isStringLiteral,
iteratorToArray: () => iteratorToArray,
noop: () => noop,
once: () => once,
parseBool: () => parseBool,
parseDuration: () => parseDuration,
preferLocalBin: () => preferLocalBin,
proxyOverride: () => proxyOverride,
quote: () => quote,
quotePowerShell: () => quotePowerShell,
randomId: () => randomId,
toCamelCase: () => toCamelCase
});
module.exports = __toCommonJS(util_exports);
var import_node_path = __toESM(require("path"), 1);
var import_node_process = __toESM(require("process"), 1);
var import_vendor_core = require("./vendor-core.cjs");
function noop() {
}
function identity(v) {
return v;
}
function randomId() {
return Math.random().toString(36).slice(2);
}
function isString(obj) {
return typeof obj === "string";
}
var utf8Decoder = new TextDecoder("utf-8");
var bufToString = (buf) => isString(buf) ? buf : utf8Decoder.decode(buf);
var bufArrJoin = (arr) => arr.reduce((acc, buf) => acc + bufToString(buf), "");
var getLast = (arr) => arr[arr.length - 1];
function preferLocalBin(env, ...dirs) {
const pathKey = import_node_process.default.platform === "win32" ? Object.keys(env).reverse().find((key) => key.toUpperCase() === "PATH") || "Path" : "PATH";
const pathValue = dirs.map(
(c) => c && [
import_node_path.default.resolve(c, "node_modules", ".bin"),
import_node_path.default.resolve(c)
]
).flat().concat(env[pathKey]).filter(Boolean).join(import_node_path.default.delimiter);
return __spreadProps(__spreadValues({}, env), {
[pathKey]: pathValue
});
}
function quote(arg) {
if (arg === "") return `$''`;
if (/^[\w/.\-+@:=,%]+$/.test(arg)) return arg;
return `$'` + arg.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/\f/g, "\\f").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t").replace(/\v/g, "\\v").replace(/\0/g, "\\0") + `'`;
}
function quotePowerShell(arg) {
if (arg === "") return `''`;
if (/^[\w/.\-@:=,+%]+$/.test(arg)) return arg;
return `'` + arg.replace(/'/g, "''") + `'`;
}
function parseDuration(d) {
if (typeof d === "number") {
if (isNaN(d) || d < 0) throw new Error(`Invalid duration: "${d}".`);
return d;
}
const [m, v, u] = d.match(/^(\d+)(m?s?)$/) || [];
if (!m) throw new Error(`Unknown duration: "${d}".`);
return +v * ({ s: 1e3, ms: 1, m: 6e4 }[u] || 1);
}
var once = (fn) => {
let called = false;
let result;
return (...args) => called ? result : (called = true, result = fn(...args));
};
var proxyOverride = (origin, ...fallbacks) => new Proxy(origin, {
get(target, key) {
var _a, _b;
return (_b = (_a = fallbacks.find((f) => key in f)) == null ? void 0 : _a[key]) != null ? _b : Reflect.get(target, key);
}
});
var toCamelCase = (str) => str.toLowerCase().replace(/([a-z])[_-]+([a-z])/g, (_, p1, p2) => p1 + p2.toUpperCase());
var parseBool = (v) => v === "true" || v !== "false" && v;
var getLines = (chunk, next, delimiter) => {
const lines = ((next.pop() || "") + bufToString(chunk)).split(delimiter);
next.push(lines.pop());
return lines;
};
var iteratorToArray = (it) => {
const arr = [];
let entry;
while (!(entry = it.next()).done) arr.push(entry.value);
return arr;
};
/* c8 ignore next 100 */
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
bufArrJoin,
bufToString,
getLast,
getLines,
identity,
isString,
isStringLiteral,
iteratorToArray,
noop,
once,
parseBool,
parseDuration,
preferLocalBin,
proxyOverride,
quote,
quotePowerShell,
randomId,
toCamelCase
});
================================================
FILE: build/util.d.ts
================================================
import { type Buffer } from 'node:buffer';
import { type TSpawnStore } from './vendor-core.js';
export { isStringLiteral } from './vendor-core.js';
export declare function noop(): void;
export declare function identity<T>(v: T): T;
export declare function randomId(): string;
export declare function isString(obj: any): obj is string;
export declare const bufToString: (buf: Buffer | string) => string;
export declare const bufArrJoin: (arr: TSpawnStore[keyof TSpawnStore]) => string;
export declare const getLast: <T>(arr: {
length: number;
[i: number]: any;
}) => T;
export declare function preferLocalBin(env: NodeJS.ProcessEnv, ...dirs: (string | undefined)[]): {
[x: string]: string | undefined;
TZ?: string | undefined;
};
export declare function quote(arg: string): string;
export declare function quotePowerShell(arg: string): string;
export type Duration = number | `${number}` | `${number}m` | `${number}s` | `${number}ms`;
export declare function parseDuration(d: Duration): number;
export declare const once: <T extends (...args: any[]) => any>(fn: T) => (...args: Parameters<T>) => ReturnType<T>;
export declare const proxyOverride: <T extends object>(origin: T, ...fallbacks: any) => T;
export declare const toCamelCase: (str: string) => string;
export declare const parseBool: (v: string) => boolean | string;
export declare const getLines: (chunk: Buffer | string, next: (string | undefined)[], delimiter: string | RegExp) => string[];
export declare const iteratorToArray: <T>(it: Iterator<T>) => T[];
================================================
FILE: build/vendor-core.cjs
================================================
"use strict";
const {
__create,
__spreadValues,
__spreadProps,
__commonJS,
__export,
__toESM,
__toCommonJS,
__async
} = require('./esblib.cjs');
// node_modules/isexe/dist/commonjs/index.min.js
var require_index_min = __commonJS({
"node_modules/isexe/dist/commonjs/index.min.js"(exports2) {
"use strict";
var a = (t, e) => () => (e || t((e = { exports: {} }).exports, e), e.exports);
var _ = a((i) => {
"use strict";
Object.defineProperty(i, "__esModule", { value: true });
i.sync = i.isexe = void 0;
var M = require("fs"), x = require("fs").promises, q = (_0, ..._1) => __async(null, [_0, ..._1], function* (t, e = {}) {
let { ignoreErrors: r = false } = e;
try {
return d(yield (0, x.stat)(t), e);
} catch (s) {
let n = s;
if (r || n.code === "EACCES") return false;
throw n;
}
});
i.isexe = q;
var m = (t, e = {}) => {
let { ignoreErrors: r = false } = e;
try {
return d((0, M.statSync)(t), e);
} catch (s) {
let n = s;
if (r || n.code === "EACCES") return false;
throw n;
}
};
i.sync = m;
var d = (t, e) => t.isFile() && A(t, e), A = (t, e) => {
var _a, _b, _c, _d, _e, _f, _g, _h;
let r = (_b = e.uid) != null ? _b : (_a = process.getuid) == null ? void 0 : _a.call(process), s = (_e = (_d = e.groups) != null ? _d : (_c = process.getgroups) == null ? void 0 : _c.call(process)) != null ? _e : [], n = (_h = (_g = e.gid) != null ? _g : (_f = process.getgid) == null ? void 0 : _f.call(process)) != null ? _h : s[0];
if (r === void 0 || n === void 0) throw new Error("cannot get uid or gid");
let u = /* @__PURE__ */ new Set([n, ...s]), c = t.mode, S = t.uid, P = t.gid, f = parseInt("100", 8), l = parseInt("010", 8), j = parseInt("001", 8), C = f | l;
return !!(c & j || c & l && u.has(P) || c & f && S === r || c & C && r === 0);
};
});
var g2 = a((o) => {
"use strict";
Object.defineProperty(o, "__esModule", { value: true });
o.sync = o.isexe = void 0;
var T = require("fs"), I = require("fs").promises, D = require("path"), F = (_0, ..._1) => __async(null, [_0, ..._1], function* (t, e = {}) {
let { ignoreErrors: r = false } = e;
try {
return y(yield (0, I.stat)(t), t, e);
} catch (s) {
let n = s;
if (r || n.code === "EACCES") return false;
throw n;
}
});
o.isexe = F;
var L = (t, e = {}) => {
let { ignoreErrors: r = false } = e;
try {
return y((0, T.statSync)(t), t, e);
} catch (s) {
let n = s;
if (r || n.code === "EACCES") return false;
throw n;
}
};
o.sync = L;
var B = (t, e) => {
let { pathExt: r = process.env.PATHEXT || "" } = e, s = r.split(D.delimiter);
if (s.indexOf("") !== -1) return true;
for (let n of s) {
let u = n.toLowerCase(), c = t.substring(t.length - u.length).toLowerCase();
if (u && c === u) return true;
}
return false;
}, y = (t, e, r) => t.isFile() && B(e, r);
});
var p = a((h) => {
"use strict";
Object.defineProperty(h, "__esModule", { value: true });
});
var v = exports2 && exports2.__createBinding || (Object.create ? (function(t, e, r, s) {
s === void 0 && (s = r);
var n = Object.getOwnPropertyDescriptor(e, r);
(!n || ("get" in n ? !e.__esModule : n.writable || n.configurable)) && (n = { enumerable: true, get: function() {
return e[r];
} }), Object.defineProperty(t, s, n);
}) : (function(t, e, r, s) {
s === void 0 && (s = r), t[s] = e[r];
}));
var G = exports2 && exports2.__setModuleDefault || (Object.create ? (function(t, e) {
Object.defineProperty(t, "default", { enumerable: true, value: e });
}) : function(t, e) {
t.default = e;
});
var w = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
var t = function(e) {
return t = Object.getOwnPropertyNames || function(r) {
var s = [];
for (var n in r) Object.prototype.hasOwnProperty.call(r, n) && (s[s.length] = n);
return s;
}, t(e);
};
return function(e) {
if (e && e.__esModule) return e;
var r = {};
if (e != null) for (var s = t(e), n = 0; n < s.length; n++) s[n] !== "default" && v(r, e, s[n]);
return G(r, e), r;
};
})();
var X = exports2 && exports2.__exportStar || function(t, e) {
for (var r in t) r !== "default" && !Object.prototype.hasOwnProperty.call(e, r) && v(e, t, r);
};
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.sync = exports2.isexe = exports2.posix = exports2.win32 = void 0;
var E = w(_());
exports2.posix = E;
var O = w(g2());
exports2.win32 = O;
X(p(), exports2);
var H = process.env._ISEXE_TEST_PLATFORM_ || process.platform;
var b = H === "win32" ? O : E;
exports2.isexe = b.isexe;
exports2.sync = b.sync;
}
});
// node_modules/which/lib/index.js
var require_lib = __commonJS({
"node_modules/which/lib/index.js"(exports2, module2) {
"use strict";
var { isexe, sync: isexeSync } = require_index_min();
var { join, delimiter, sep, posix } = require("path");
var isWindows = process.platform === "win32";
var rSlash = new RegExp(`[${posix.sep}${sep === posix.sep ? "" : sep}]`.replace(/(\\)/g, "\\$1"));
var rRel = new RegExp(`^\\.${rSlash.source}`);
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
var getPathInfo = (cmd, {
path: optPath = process.env.PATH,
pathExt: optPathExt = process.env.PATHEXT,
delimiter: optDelimiter = delimiter
}) => {
const pathEnv = cmd.match(rSlash) ? [""] : [
// windows always checks the cwd first
...isWindows ? [process.cwd()] : [],
...(optPath || /* istanbul ignore next: very unusual */
"").split(optDelimiter)
];
if (isWindows) {
const pathExtExe = optPathExt || [".EXE", ".CMD", ".BAT", ".COM"].join(optDelimiter);
const pathExt = pathExtExe.split(optDelimiter).flatMap((item) => [item, item.toLowerCase()]);
if (cmd.includes(".") && pathExt[0] !== "") {
pathExt.unshift("");
}
return { pathEnv, pathExt, pathExtExe };
}
return { pathEnv, pathExt: [""] };
};
var getPathPart = (raw, cmd) => {
const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "";
return prefix + join(pathPart, cmd);
};
var which2 = (_0, ..._1) => __async(null, [_0, ..._1], function* (cmd, opt = {}) {
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
const found = [];
for (const envPart of pathEnv) {
const p = getPathPart(envPart, cmd);
for (const ext of pathExt) {
const withExt = p + ext;
const is = yield isexe(withExt, { pathExt: pathExtExe, ignoreErrors: true });
if (is) {
if (!opt.all) {
return withExt;
}
found.push(withExt);
}
}
}
if (opt.all && found.length) {
return found;
}
if (opt.nothrow) {
return null;
}
throw getNotFoundError(cmd);
});
var whichSync = (cmd, opt = {}) => {
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
const found = [];
for (const pathEnvPart of pathEnv) {
const p = getPathPart(pathEnvPart, cmd);
for (const ext of pathExt) {
const withExt = p + ext;
const is = isexeSync(withExt, { pathExt: pathExtExe, ignoreErrors: true });
if (is) {
if (!opt.all) {
return withExt;
}
found.push(withExt);
}
}
}
if (opt.all && found.length) {
return found;
}
if (opt.nothrow) {
return null;
}
throw getNotFoundError(cmd);
};
module2.exports = which2;
which2.sync = whichSync;
}
});
// src/vendor-core.ts
var vendor_core_exports = {};
__export(vendor_core_exports, {
VoidStream: () => VoidStream,
buildCmd: () => buildCmd,
chalk: () => chalk2,
exec: () => exec,
isStringLiteral: () => isStringLiteral,
ps: () => ps,
which: () => which
});
module.exports = __toCommonJS(vendor_core_exports);
// node_modules/chalk/source/vendor/ansi-styles/index.js
var ANSI_BACKGROUND_OFFSET = 10;
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
var 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]
}
};
var modifierNames = Object.keys(styles.modifier);
var foregroundColorNames = Object.keys(styles.color);
var backgroundColorNames = Object.keys(styles.bgColor);
var colorNames = [...foregroundColorNames, ...backgroundColorNames];
function assembleStyles() {
const codes = /* @__PURE__ */ new Map();
for (const [groupName, group] of Object.entries(styles)) {
for (const [styleName, style] of Object.entries(group)) {
styles[styleName] = {
open: `\x1B[${style[0]}m`,
close: `\x1B[${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 = "\x1B[39m";
styles.bgColor.close = "\x1B[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);
Object.defineProperties(styles, {
rgbToAnsi256: {
value(red, green, blue) {
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 & 255,
integer >> 8 & 255,
integer & 255
/* 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;
}
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;
}
var ansiStyles = assembleStyles();
var ansi_styles_default = ansiStyles;
// node_modules/chalk/source/vendor/supports-color/index.js
var import_node_process = __toESM(require("process"), 1);
var import_node_os = __toESM(require("os"), 1);
var import_node_tty = __toESM(require("tty"), 1);
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : import_node_process.default.argv) {
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
const position = argv.indexOf(prefix + flag);
const terminatorPosition = argv.indexOf("--");
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
}
var { env } = import_node_process.default;
var flagForceColor;
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
flagForceColor = 0;
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
flagForceColor = 1;
}
function envForceColor() {
if ("FORCE_COLOR" in env) {
if (env.FORCE_COLOR === "true") {
return 1;
}
if (env.FORCE_COLOR === "false") {
return 0;
}
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
}
}
function translateLevel(level) {
if (level === 0) {
return false;
}
return {
level,
hasBasic: true,
has256: level >= 2,
has16m: level >= 3
};
}
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
const noFlagForceColor = envForceColor();
if (noFlagForceColor !== void 0) {
flagForceColor = noFlagForceColor;
}
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
if (forceColor === 0) {
return 0;
}
if (sniffFlags) {
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
return 3;
}
if (hasFlag("color=256")) {
return 2;
}
}
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
return 1;
}
if (haveStream && !streamIsTTY && forceColor === void 0) {
return 0;
}
const min = forceColor || 0;
if (env.TERM === "dumb") {
return min;
}
if (import_node_process.default.platform === "win32") {
const osRelease = import_node_os.default.release().split(".");
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
return Number(osRelease[2]) >= 14931 ? 3 : 2;
}
return 1;
}
if ("CI" in env) {
if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
return 3;
}
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
return 1;
}
return min;
}
if ("TEAMCITY_VERSION" in env) {
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
}
if (env.COLORTERM === "truecolor") {
return 3;
}
if (env.TERM === "xterm-kitty") {
return 3;
}
if (env.TERM === "xterm-ghostty") {
return 3;
}
if (env.TERM === "wezterm") {
return 3;
}
if ("TERM_PROGRAM" in env) {
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
switch (env.TERM_PROGRAM) {
case "iTerm.app": {
return version >= 3 ? 3 : 2;
}
case "Apple_Terminal": {
return 2;
}
}
}
if (/-256(color)?$/i.test(env.TERM)) {
return 2;
}
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
return 1;
}
if ("COLORTERM" in env) {
return 1;
}
return min;
}
function createSupportsColor(stream, options = {}) {
const level = _supportsColor(stream, __spreadValues({
streamIsTTY: stream && stream.isTTY
}, options));
return translateLevel(level);
}
var supportsColor = {
stdout: createSupportsColor({ isTTY: import_node_tty.default.isatty(1) }),
stderr: createSupportsColor({ isTTY: import_node_tty.default.isatty(2) })
};
var supports_color_default = supportsColor;
// node_modules/chalk/source/utilities.js
function stringReplaceAll(string, substring, replacer) {
let index = string.indexOf(substring);
if (index === -1) {
return string;
}
const substringLength = substring.length;
let endIndex = 0;
let returnValue = "";
do {
returnValue += string.slice(endIndex, index) + substring + replacer;
endIndex = index + substringLength;
index = string.indexOf(substring, endIndex);
} while (index !== -1);
returnValue += string.slice(endIndex);
return returnValue;
}
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
let endIndex = 0;
let returnValue = "";
do {
const gotCR = string[index - 1] === "\r";
returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
endIndex = index + 1;
index = string.indexOf("\n", endIndex);
} while (index !== -1);
returnValue += string.slice(endIndex);
return returnValue;
}
// node_modules/chalk/source/index.js
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
var GENERATOR = /* @__PURE__ */ Symbol("GENERATOR");
var STYLER = /* @__PURE__ */ Symbol("STYLER");
var IS_EMPTY = /* @__PURE__ */ Symbol("IS_EMPTY");
var levelMapping = [
"ansi",
"ansi",
"ansi256",
"ansi16m"
];
var styles2 = /* @__PURE__ */ Object.create(null);
var applyOptions = (object, options = {}) => {
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
throw new Error("The `level` option should be an integer from 0 to 3");
}
const colorLevel = stdoutColor ? stdoutColor.level : 0;
object.level = options.level === void 0 ? colorLevel : options.level;
};
var chalkFactory = (options) => {
const chalk3 = (...strings) => strings.join(" ");
applyOptions(chalk3, options);
Object.setPrototypeOf(chalk3, createChalk.prototype);
return chalk3;
};
function createChalk(options) {
return chalkFactory(options);
}
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
for (const [styleName, style] of Object.entries(ansi_styles_default)) {
styles2[styleName] = {
get() {
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
Object.defineProperty(this, styleName, { value: builder });
return builder;
}
};
}
styles2.visible = {
get() {
const builder = createBuilder(this, this[STYLER], true);
Object.defineProperty(this, "visible", { value: builder });
return builder;
}
};
var getModelAnsi = (model, level, type, ...arguments_) => {
if (model === "rgb") {
if (level === "ansi16m") {
return ansi_styles_default[type].ansi16m(...arguments_);
}
if (level === "ansi256") {
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
}
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
}
if (model === "hex") {
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
}
return ansi_styles_default[type][model](...arguments_);
};
var usedModels = ["rgb", "hex", "ansi256"];
for (const model of usedModels) {
styles2[model] = {
get() {
const { level } = this;
return function(...arguments_) {
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
return createBuilder(this, styler, this[IS_EMPTY]);
};
}
};
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
styles2[bgModel] = {
get() {
const { level } = this;
return function(...arguments_) {
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
return createBuilder(this, styler, this[IS_EMPTY]);
};
}
};
}
var proto = Object.defineProperties(() => {
}, __spreadProps(__spreadValues({}, styles2), {
level: {
enumerable: true,
get() {
return this[GENERATOR].level;
},
set(level) {
this[GENERATOR].level = level;
}
}
}));
var createStyler = (open, close, parent) => {
let openAll;
let closeAll;
if (parent === void 0) {
openAll = open;
closeAll = close;
} else {
openAll = parent.openAll + open;
closeAll = close + parent.closeAll;
}
return {
open,
close,
openAll,
closeAll,
parent
};
};
var createBuilder = (self, _styler, _isEmpty) => {
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
Object.setPrototypeOf(builder, proto);
builder[GENERATOR] = self;
builder[STYLER] = _styler;
builder[IS_EMPTY] = _isEmpty;
return builder;
};
var applyStyle = (self, string) => {
if (self.level <= 0 || !string) {
return self[IS_EMPTY] ? "" : string;
}
let styler = self[STYLER];
if (styler === void 0) {
return string;
}
const { openAll, closeAll } = styler;
if (string.includes("\x1B")) {
while (styler !== void 0) {
string = stringReplaceAll(string, styler.close, styler.open);
styler = styler.parent;
}
}
const lfIndex = string.indexOf("\n");
if (lfIndex !== -1) {
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
}
return openAll + string + closeAll;
};
Object.defineProperties(createChalk.prototype, styles2);
var chalk = createChalk();
var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
var source_default = chalk;
// src/vendor-core.ts
var import_which = __toESM(require_lib(), 1);
// node_modules/@webpod/ps/target/esm/index.mjs
var import_node_process4 = __toESM(require("process"), 1);
var import_node_fs = __toESM(require("fs"), 1);
var import_node_os2 = __toESM(require("os"), 1);
// node_modules/@webpod/ingrid/target/esm/index.mjs
var EOL = /\r?\n|\r|\n/;
var EMPTY = "-";
var parseLine = (line, sep = " ") => {
if (typeof line !== "string") throw new Error("parseLine: line must be a string");
const result = {
spaces: [],
words: []
};
const capture = () => {
if (word) {
result.words.push({
s,
e: s + word.length - 1,
w: word
});
word = "";
s = -1;
}
};
let bb;
let word = "";
let s = -1;
for (const i in [...line]) {
const prev = line[+i - 1];
const char = line[i];
if (bb) {
word += char;
if (char === bb && prev !== "\\") {
bb = void 0;
}
continue;
}
if (char === sep) {
result.spaces.push(+i);
capture();
continue;
}
if (s === -1) s = +i;
if (char === '"' || char === "'") bb = char;
word += char;
}
capture();
return result;
};
var parseLines = (input, sep) => input.split(EOL).filter(Boolean).map((l) => parseLine(l, sep));
var countWordsByIndex = ({ words }, index) => words.filter(({ e }) => e < index).length;
var getBorders = (lines) => lines[0].spaces.reduce((m, i) => {
const c = countWordsByIndex(lines[0], i);
if (lines.every((l) => l.spaces.includes(i) && c === countWordsByIndex(l, i))) {
m.push(i);
}
return m;
}, []);
var parseUnixGrid = (input) => {
const lines = parseLines(input);
const borders = getBorders(lines);
const _borders = [Number.NEGATIVE_INFINITY, ...borders, Number.POSITIVE_INFINITY];
const grid = [];
for (const { words } of lines) {
const row = [];
grid.push(row);
for (const n in words) {
const { w, s, e } = words[n];
for (const _b in _borders) {
const a = _borders[+_b];
const b = _borders[+_b + 1];
if (b === void 0) break;
const block = row[_b] || (row[_b] = []);
if (s > a && e < b) block.push(w);
}
}
}
return gridToData(grid);
};
var gridToData = (grid) => {
const data = [];
const [headers, ...body] = grid;
for (const row of body) {
const entry = {};
data.push(entry);
for (const i in headers) {
const keys = headers[i];
if (keys.length === 0) continue;
if (keys.length > row[i].length) {
throw new Error("Malformed grid: row has more columns than headers");
}
for (const k in keys) {
const key = keys[k];
const to = +k + 1 === keys.length ? Number.POSITIVE_INFINITY : +k + 1;
entry[key] = row[i].slice(+k, to);
}
}
}
return data;
};
var parseWinGrid = (input, debug = false) => {
const lines = input.split(/\r*\n+/).filter(Boolean);
const headline = lines.shift();
const headers = headline.trim().split(/\s\s+/);
const hl = headers.length;
const ll = headline.length;
if (debug) {
console.log("Headers:", headers);
console.log("Line lengths:", lines.map((l) => l.length));
}
if (lines.every((l) => ll / l.length < 2)) {
const spaces = Array.from({ length: ll }).map(
(_, i) => lines.every((l) => l[i] === " ")
);
const borders = spaces.reduce((m, v, i, a) => {
if (v && !a[i - 1]) m.push(i);
return m;
}, [0]);
const data2 = [];
debug && console.log("Borders:", borders);
for (const line of lines) {
const props = [];
for (const i in headers) {
const k = headers[i];
const s = borders[i];
const e = borders[+i + 1] || ll;
const v = line.slice(s, e).trim();
props.push([k, [v || EMPTY]]);
}
data2.push(Object.fromEntries(props));
}
return data2;
}
let w = "";
let p;
const body = input.slice(headline.length);
const vals = [];
const data = [];
const cap = (v) => {
const _v = w.trim() || (vals.length === 0 ? v : w.trim());
if (!_v) return;
vals.push(_v);
if (vals.length === hl) {
data.push(Object.fromEntries(headers.map((h, i) => [h, [vals[i]]])));
vals.length = 0;
}
w = "";
};
for (const c of body) {
w += c;
if (c === " ") {
if (p === "\n") {
cap(EMPTY);
} else if (p === " ") {
cap();
}
} else if (c === "\n") {
cap();
}
p = c;
}
cap();
return data;
};
var parsers = {
unix: parseUnixGrid,
win: parseWinGrid
};
var parse = (input, { format = "unix", debug = false } = {}) => {
const parser = parsers[format];
if (!parser) throw new Error(`unsupported format: ${format}`);
return parser(input, debug);
};
// node_modules/zurk/target/esm/spawn.mjs
var cp = __toESM(require("child_process"), 1);
var import_node_process3 = __toESM(require("process"), 1);
var import_node_events = __toESM(require("events"), 1);
var import_node_stream = require("stream");
// node_modules/zurk/target/esm/util.mjs
var import_node_process2 = __toESM(require("process"), 1);
var g = !import_node_process2.default.versions.deno && global || globalThis;
var immediate = g.setImmediate || ((f) => g.setTimeout(f, 0));
var noop = () => {
};
var randomId = () => Math.random().toString(36).slice(2);
var isPromiseLike = (value) => typeof (value == null ? void 0 : value.then) === "function";
var isStringLiteral = (pieces, ...rest) => {
var _a;
return (pieces == null ? void 0 : pieces.length) > 0 && ((_a = pieces.raw) == null ? void 0 : _a.length) === pieces.length && // Object.isFrozen(pieces) &&
rest.length + 1 === pieces.length;
};
var assign = (target, ...extras) => Object.defineProperties(target, extras.reduce((m, extra) => __spreadValues(__spreadValues({}, m), Object.fromEntries(Object.entries(Object.getOwnPropertyDescriptors(extra)).filter(([, v]) => !Object.prototype.hasOwnProperty.call(v, "value") || v.value !== void 0))), {}));
var buildCmd = (quote2, pieces, args, subs = substitute) => {
if (args.some(isPromiseLike))
return Promise.all(args).then((args2) => buildCmd(quote2, pieces, args2, subs));
let cmd = pieces[0], i = 0;
while (i < args.length) {
const s = Array.isArray(args[i]) ? args[i].map((x) => quote2(subs(x))).join(" ") : quote2(subs(args[i]));
cmd += s + pieces[++i];
}
return cmd;
};
var substitute = (arg) => typeof (arg == null ? void 0 : arg.stdout) === "string" ? arg.stdout.replace(/\n$/, "") : `${arg}`;
// node_modules/zurk/target/esm/spawn.mjs
var defaults = {
get id() {
return randomId();
},
cmd: "",
get cwd() {
return import_node_process3.default.cwd();
},
sync: false,
args: [],
input: null,
env: import_node_process3.default.env,
get ee() {
return new import_node_events.default();
},
get ac() {
return g.AbortController && new AbortController();
},
get signal() {
var _a;
return (_a = this.ac) == null ? void 0 : _a.signal;
},
on: {},
detached: import_node_process3.default.platform !== "win32",
shell: true,
spawn: cp.spawn,
spawnSync: cp.spawnSync,
spawnOpts: {},
get store() {
return createStore();
},
callback: noop,
get stdin() {
return new VoidStream();
},
get stdout() {
return new VoidStream();
},
get stderr() {
return new VoidStream();
},
stdio: ["pipe", "pipe", "pipe"],
run: immediate,
stack: ""
};
var normalizeCtx = (...ctxs) => assign(
__spreadValues({}, defaults),
{ get signal() {
var _a;
return (_a = this.ac) == null ? void 0 : _a.signal;
} },
...ctxs
);
var processInput = (child, input) => {
if (input && child.stdin && !child.stdin.destroyed) {
if (input instanceof import_node_stream.Readable) {
input.pipe(child.stdin);
} else {
child.stdin.write(input);
child.stdin.end();
}
}
};
var VoidStream = class extends import_node_stream.Transform {
_transform(chunk, _, cb) {
this.emit("data", chunk);
cb();
}
};
var buildSpawnOpts = ({ spawnOpts, stdio, cwd, shell, input, env: env2, detached, signal }) => __spreadProps(__spreadValues({}, spawnOpts), {
env: env2,
cwd,
stdio,
shell,
input,
windowsHide: true,
detached,
signal
});
var toggleListeners = (pos, ee, on = {}) => {
for (const [name, listener] of Object.entries(on)) {
ee[pos](name, listener);
}
if (pos === "on")
ee.once("end", () => toggleListeners("off", ee, on));
};
var createStore = () => ({
stdout: [],
stderr: [],
stdall: []
});
var invoke = (c) => {
var _a, _b;
const now = Date.now();
const stdio = [c.stdin, c.stdout, c.stderr];
const push = (kind, data) => {
c.store[kind].push(data);
c.store.stdall.push(data);
c.ee.emit(kind, data, c);
c.ee.emit("stdall", data, c);
};
try {
if (c.sync) {
toggleListeners("on", c.ee, c.on);
const opts = buildSpawnOpts(c);
const r = c.spawnSync(c.cmd, c.args, opts);
c.ee.emit("start", r, c);
if (((_a = r.stdout) == null ? void 0 : _a.length) > 0) {
c.stdout.write(r.stdout);
push("stdout", r.stdout);
}
if (((_b = r.stderr) == null ? void 0 : _b.length) > 0) {
c.stderr.write(r.stderr);
push("stderr", r.stderr);
}
c.callback(null, c.fulfilled = __spreadProps(__spreadValues({}, r), {
get stdout() {
return c.store.stdout.join("");
},
get stderr() {
return c.store.stderr.join("");
},
get stdall() {
return c.store.stdall.join("");
},
stdio,
duration: Date.now() - now,
ctx: c
}));
c.ee.emit("end", c.fulfilled, c);
} else {
c.run(() => {
var _a2, _b2, _c;
toggleListeners("on", c.ee, c.on);
let error = null;
let aborted = false;
const opts = buildSpawnOpts(c);
const child = c.spawn(c.cmd, c.args, opts);
const onAbort = (event) => {
if (opts.detached && child.pid) {
try {
import_node_process3.default.kill(-child.pid);
} catch (e) {
child.kill();
}
}
aborted = true;
c.ee.emit("abort", event, c);
};
c.child = child;
c.ee.emit("start", child, c);
(_a2 = opts.signal) == null ? void 0 : _a2.addEventListener("abort", onAbort);
processInput(child, c.input || c.stdin);
(_b2 = child.stdout) == null ? void 0 : _b2.on("data", (d) => {
push("stdout", d);
}).pipe(c.stdout);
(_c = child.stderr) == null ? void 0 : _c.on("data", (d) => {
push("stderr", d);
}).pipe(c.stderr);
child.once("error", (e) => {
error = e;
c.ee.emit("err", error, c);
}).once("exit", () => {
var _a3, _b3;
if (aborted) {
(_a3 = child.stdout) == null ? void 0 : _a3.destroy();
(_b3 = child.stderr) == null ? void 0 : _b3.destroy();
}
}).once("close", (status, signal) => {
var _a3;
c.fulfilled = {
error,
status,
signal,
get stdout() {
return c.store.stdout.join("");
},
get stderr() {
return c.store.stderr.join("");
},
get stdall() {
return c.store.stdall.join("");
},
stdio,
duration: Date.now() - now,
ctx: c
};
(_a3 = opts.signal) == null ? void 0 : _a3.removeEventListener("abort", onAbort);
c.callback(error, c.fulfilled);
c.ee.emit("end", c.fulfilled, c);
});
}, c);
}
} catch (error) {
c.callback(
error,
c.fulfilled = {
error,
status: null,
signal: null,
stdout: "",
stderr: "",
stdall: "",
stdio,
duration: Date.now() - now,
ctx: c
}
);
c.ee.emit("err", error, c);
c.ee.emit("end", c.fulfilled, c);
}
return c;
};
var exec = (ctx) => invoke(normalizeCtx(ctx));
// node_modules/@webpod/ps/target/esm/index.mjs
var IS_WIN = import_node_process4.default.platform === "win32";
var IS_WIN2025_PLUS = IS_WIN && Number.parseInt(import_node_os2.default.release().split(".")[2], 10) >= 26e3;
var LOOKUPS = {
wmic: {
cmd: "wmic process get ProcessId,ParentProcessId,CommandLine",
args: [],
parse(stdout) {
return parse(removeWmicPrefix(stdout), { format: "win" });
}
},
ps: {
cmd: "ps",
args: ["-lx"],
parse(stdout) {
return parse(stdout, { format: "unix" });
}
},
pwsh: {
cmd: "pwsh",
args: ["-NoProfile", "-Command", '"Get-CimInstance Win32_Process | Select-Object ProcessId,ParentProcessId,CommandLine | ConvertTo-Json -Compress"'],
parse(stdout) {
let arr = [];
try {
arr = JSON.parse(stdout);
} catch (e) {
return [];
}
return arr.map((p) => ({
ProcessId: [p.ProcessId + ""],
ParentProcessId: [p.ParentProcessId + ""],
CommandLine: p.CommandLine ? [p.CommandLine] : []
}));
}
}
};
var isBin = (f) => {
if (f === "") return false;
if (!f.includes("/") && !f.includes("\\")) return true;
if (f.length > 3 && f[0] === '"')
return f[f.length - 1] === '"' ? isBin(f.slice(1, -1)) : false;
try {
if (!import_node_fs.default.existsSync(f)) return false;
const stat = import_node_fs.default.lstatSync(f);
return stat.isFile() || stat.isSymbolicLink();
} catch (e) {
return false;
}
};
var lookup = (query = {}, cb = noop2) => _lookup({ query, cb, sync: false });
var lookupSync = (query = {}, cb = noop2) => _lookup({ query, cb, sync: true });
lookup.sync = lookupSync;
var _lookup = ({
query = {},
cb = noop2,
sync = false
}) => {
const pFactory = sync ? makePseudoDeferred.bind(null, []) : makeDeferred;
const { promise, resolve, reject } = pFactory();
const result = [];
const lookupFlow = IS_WIN ? IS_WIN2025_PLUS ? "pwsh" : "wmic" : "ps";
const {
parse: parse2,
cmd,
args
} = LOOKUPS[lookupFlow];
const callback = (err, { stdout }) => {
if (err) {
reject(err);
cb(err);
return;
}
result.push(...filterProcessList(normalizeOutput(parse2(stdout)), query));
resolve(result);
cb(null, result);
};
exec({
cmd,
args,
callback,
sync,
run(cb2) {
cb2();
}
});
return Object.assign(promise, result);
};
var filterProcessList = (processList, query = {}) => {
const pidList = (query.pid === void 0 ? [] : [query.pid].flat(1)).map((v) => v + "");
const filters = [
(p) => query.command ? new RegExp(query.command, "i").test(p.command) : true,
(p) => query.arguments ? new RegExp(query.arguments, "i").test(p.arguments.join(" ")) : true,
(p) => query.ppid ? query.ppid + "" === p.ppid : true
];
return processList.filter(
(p) => (pidList.length === 0 || pidList.includes(p.pid)) && filters.every((f) => f(p))
);
};
var removeWmicPrefix = (stdout) => {
const s = stdout.indexOf(LOOKUPS.wmic.cmd + import_node_os2.default.EOL);
const e = stdout.includes(">") ? stdout.trimEnd().lastIndexOf(import_node_os2.default.EOL) : stdout.length;
return (s > 0 ? stdout.slice(s + LOOKUPS.wmic.cmd.length, e) : stdout.slice(0, e)).trimStart();
};
var pickTree = (list, pid, recursive = false) => {
const children = list.filter((p) => p.ppid === pid + "");
return [
...children,
...children.flatMap((p) => recursive ? pickTree(list, p.pid, true) : [])
];
};
var _tree = ({
cb = noop2,
opts,
sync = false
}) => {
if (typeof opts === "string" || typeof opts === "number") {
return _tree({ opts: { pid: opts }, cb, sync });
}
const onError = (err) => cb(err);
const onData = (all) => {
if (opts === void 0) return all;
const { pid, recursive = false } = opts;
const list = pickTree(all, pid, recursive);
cb(null, list);
return list;
};
try {
const all = _lookup({ sync });
return sync ? onData(all) : all.then(onData, (err) => {
onError(err);
throw err;
});
} catch (err) {
onError(err);
return Promise.reject(err);
}
};
var tree = (opts, cb) => __async(null, null, function* () {
return _tree({ opts, cb });
});
var treeSync = (opts, cb) => _tree({ opts, cb, sync: true });
tree.sync = treeSync;
var kill = (pid, opts, next) => {
if (typeof opts == "function") {
return kill(pid, void 0, opts);
}
if (typeof opts == "string" || typeof opts == "number") {
return kill(pid, { signal: opts }, next);
}
const { promise, resolve, reject } = makeDeferred();
const {
timeout = 30,
signal = "SIGTERM"
} = opts || {};
try {
import_node_process4.default.kill(+pid, signal);
} catch (e) {
reject(e);
next == null ? void 0 : next(e);
return promise;
}
let checkConfident = 0;
let checkTimeoutTimer;
let checkIsTimeout = false;
const checkKilled = (finishCallback) => lookup({ pid }, (err, list = []) => {
if (checkIsTimeout) return;
if (err) {
clearTimeout(checkTimeoutTimer);
reject(err);
finishCallback == null ? void 0 : finishCallback(err, pid);
} else if (list.length > 0) {
checkConfident = checkConfident - 1 || 0;
checkKilled(finishCallback);
} else {
checkConfident++;
if (checkConfident === 5) {
clearTimeout(checkTimeoutTimer);
resolve(pid);
finishCallback == null ? void 0 : finishCallback(null, pid);
} else {
checkKilled(finishCallback);
}
}
});
if (next) {
checkKilled(next);
checkTimeoutTimer = setTimeout(() => {
checkIsTimeout = true;
next(new Error("Kill process timeout"));
}, timeout * 1e3);
} else {
resolve(pid);
}
return promise;
};
var normalizeOutput = (data) => data.reduce((m, d) => {
var _a, _b;
const pid = (_a = d.PID || d.ProcessId) == null ? void 0 : _a[0];
const ppid = (_b = d.PPID || d.ParentProcessId) == null ? void 0 : _b[0];
const _cmd = d.CMD || d.CommandLine || d.COMMAND || [];
const cmd = _cmd.length === 1 ? _cmd[0].split(/\s+/) : _cmd;
if (pid && cmd.length > 0) {
const c = cmd.findIndex((_v, i) => isBin(cmd.slice(0, i).join(" ")));
const command = (c === -1 ? cmd : cmd.slice(0, c)).join(" ");
const args = c === -1 ? [] : cmd.slice(c);
m.push({
pid,
ppid,
command,
arguments: args
});
}
return m;
}, []);
var makeDeferred = () => {
let resolve;
let reject;
const promise = new Promise((res, rej) => {
resolve = res;
reject = rej;
});
return { resolve, reject, promise };
};
var makePseudoDeferred = (r = {}) => ({
promise: r,
resolve: identity,
reject(e) {
throw e;
}
});
var noop2 = () => {
};
var identity = (v) => v;
var index_default = { kill, lookup, lookupSync, tree, treeSync };
// src/vendor-core.ts
var import_internals = require("./internals.cjs");
var chalk2 = import_internals.bus.wrap("chalk", source_default);
var which = import_internals.bus.wrap("which", import_which.default);
var ps = import_internals.bus.wrap("ps", index_default);
/* c8 ignore next 100 */
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
VoidStream,
buildCmd,
chalk,
exec,
isStringLiteral,
ps,
which
});
================================================
FILE: build/vendor-core.d.ts
================================================
// Generated by dts-bundle-generator v9.5.1
/// <reference types="node" />
import { Buffer } from 'node:buffer';
import * as cp from 'node:child_process';
import EventEmitter from 'node:events';
import { Readable, Transform, Writable } from 'node:stream';
type ColorSupportLevel = 0 | 1 | 2 | 3;
export interface ChalkInstance {
(...text: unknown[]): string;
/**
The color support for Chalk.
By default, color support is automatically detected based on the environment.
Levels:
- `0` - All colors disabled.
- `1` - Basic 16 colors support.
- `2` - ANSI 256 colors support.
- `3` - Truecolor 16 million colors support.
*/
level: ColorSupportLevel;
/**
Use RGB values to set text color.
@example
```
import chalk from 'chalk';
chalk.rgb(222, 173, 237);
```
*/
rgb: (red: number, green: number, blue: number) => this;
/**
Use HEX value to set text color.
@param color - Hexadecimal value representing the desired color.
@example
```
import chalk from 'chalk';
chalk.hex('#DEADED');
```
*/
hex: (color: string) => this;
/**
Use an [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
@example
```
import chalk from 'chalk';
chalk.ansi256(201);
```
*/
ansi256: (index: number) => this;
/**
Use RGB values to set background color.
@example
```
import chalk from 'chalk';
chalk.bgRgb(222, 173, 237);
```
*/
bgRgb: (red: number, green: number, blue: number) => this;
/**
Use HEX value to set background color.
@param color - Hexadecimal value representing the desired color.
@example
```
import chalk from 'chalk';
chalk.bgHex('#DEADED');
```
*/
bgHex: (color: string) => this;
/**
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set background color.
@example
```
import chalk from 'chalk';
chalk.bgAnsi256(201);
```
*/
bgAnsi256: (index: number) => this;
/**
Modifier: Reset the current style.
*/
readonly reset: this;
/**
Modifier: Make the text bold.
*/
readonly bold: this;
/**
Modifier: Make the text have lower opacity.
*/
readonly dim: this;
/**
Modifier: Make the text italic. *(Not widely supported)*
*/
readonly italic: this;
/**
Modifier: Put a horizontal line below the text. *(Not widely supported)*
*/
readonly underline: this;
/**
Modifier: Put a horizontal line above the text. *(Not widely supported)*
*/
readonly overline: this;
/**
Modifier: Invert background and foreground colors.
*/
readonly inverse: this;
/**
Modifier: Print the text but make it invisible.
*/
readonly hidden: this;
/**
Modifier: Puts a horizontal line through the center of the text. *(Not widely supported)*
*/
readonly strikethrough: this;
/**
Modifier: Print the text only when Chalk has a color level above zero.
Can be useful for things that are purely cosmetic.
*/
readonly visible: this;
readonly black: this;
readonly red: this;
readonly green: this;
readonly yellow: this;
readonly blue: this;
readonly magenta: this;
readonly cyan: this;
readonly white: this;
/*
Alias for `blackBright`.
*/
readonly gray: this;
/*
Alias for `blackBright`.
*/
readonly grey: this;
readonly blackBright: this;
readonly redBright: this;
readonly greenBright: this;
readonly yellowBright: this;
readonly blueBright: this;
readonly magentaBright: this;
readonly cyanBright: this;
readonly whiteBright: this;
readonly bgBlack: this;
readonly bgRed: this;
readonly bgGreen: this;
readonly bgYellow: this;
readonly bgBlue: this;
readonly bgMagenta: this;
readonly bgCyan: this;
readonly bgWhite: this;
/*
Alias for `bgBlackBright`.
*/
readonly bgGray: this;
/*
Alias for `bgBlackBright`.
*/
readonly bgGrey: this;
readonly bgBlackBright: this;
readonly bgRedBright: this;
readonly bgGreenBright: this;
readonly bgYellowBright: this;
readonly bgBlueBright: this;
readonly bgMagentaBright: this;
readonly bgCyanBright: this;
readonly bgWhiteBright: this;
}
declare const chalk: ChalkInstance;
type AppendNullIfNothrow<TOptions, TRet> = TOptions extends {
nothrow: infer TVal;
} ? TVal extends false ? TRet : TRet | null : TRet;
type TransformToArrayIfAll<TOptions, TRet> = TOptions extends {
all: infer TVal;
} ? TVal extends true ? readonly TRet[] : TVal extends false ? TRet : readonly TRet[] | TRet : TRet;
type ReturnType$1<TOptions> = AppendNullIfNothrow<TOptions, TransformToArrayIfAll<TOptions, string>>;
type Exact<T, U extends T> = {
[Key in keyof U]: Key extends keyof T ? U[Key] : never;
};
declare function which<TOptions extends which.Options>(cmd: string, options?: Exact<which.Options, TOptions>): Promise<ReturnType$1<Exact<which.Options, TOptions>>>;
declare namespace which {
/** Finds all instances of a specified executable in the PATH environment variable */
function sync<TOptions extends Options>(cmd: string, options?: Exact<Options, TOptions>): ReturnType$1<Exact<Options, TOptions>>;
/** Options for which() API */
interface Options {
/** If true, return all matches, instead of just the first one. Note that this means the function returns an array of strings instead of a single string. */
all?: boolean | undefined;
/** Use instead of the PATH environment variable. */
path?: string | undefined;
/** Use instead of the PATHEXT environment variable. */
pathExt?: string | undefined;
/** Use instead of the platform's native path separator. */
delimiter?: string | undefined;
/** If true, returns null when not found */
nothrow?: boolean | undefined;
}
}
type TPsLookupCallback = (err: any, processList?: TPsLookupEntry[]) => void;
type TPsLookupEntry = {
pid: string;
ppid?: string;
command: string;
arguments: string[];
};
type TPsLookupQuery = {
pid?: number | string | (string | number)[];
command?: string;
arguments?: string;
ppid?: number | string;
};
type TPsKillOptions = {
timeout?: number;
signal?: string | number | NodeJS.Signals;
};
type TPsNext = (err?: any, data?: any) => void;
type TPsTreeOpts = {
pid: string | number;
recursive?: boolean;
};
declare const _default: {
kill: (pid: string | number, opts?: TPsNext | TPsKillOptions | TPsKillOptions["signal"], next?: TPsNext) => Promise<void>;
lookup: {
(query?: TPsLookupQuery, cb?: TPsLookupCallback): Promise<TPsLookupEntry[]>;
sync: (query?: TPsLookupQuery, cb?: TPsLookupCallback) => TPsLookupEntry[];
};
lookupSync: (query?: TPsLookupQuery, cb?: TPsLookupCallback) => TPsLookupEntry[];
tree: {
(opts?: string | number | TPsTreeOpts | undefined, cb?: TPsLookupCallback): Promise<TPsLookupEntry[]>;
sync: (opts?: string | number | TPsTreeOpts | undefined, cb?: TPsLookupCallback) => TPsLookupEntry[];
};
treeSync: (opts?: string | number | TPsTreeOpts | undefined, cb?: TPsLookupCallback) => TPsLookupEntry[];
};
export declare const isStringLiteral: (pieces: any, ...rest: any[]) => pieces is TemplateStringsArray;
type TQuote = (input: string) => string;
export declare const buildCmd: (quote: TQuote, pieces: TemplateStringsArray, args: any[], subs?: TSubstitute) => string | Promise<string>;
type TSubstitute = (arg: any) => string;
type TSpawnError = any;
type TPushable<T = any> = {
push(...args: T[]): number;
};
type TJoinable = {
join(sep?: string): string;
};
type TReducible<T, R> = {
reduce<U>(fn: (acc: U, cur: T, i: number, arr: T[]) => U, init: U): R;
};
type TArrayLike<T> = Iterable<T> & TPushable<T> & TJoinable & TReducible<T, any> & {
length: number;
[i: number]: T | undefined;
};
type TSpawnStoreChunks = TArrayLike<string | Buffer>;
export type TSpawnStore = {
stdout: TSpawnStoreChunks;
stderr: TSpawnStoreChunks;
stdall: TSpawnStoreChunks;
};
type TSpawnResult = {
stderr: string;
stdout: string;
stdall: string;
stdio: [
Readable | Writable,
Writable,
Writable
];
status: number | null;
signal: NodeJS.Signals | null;
duration: number;
ctx: TSpawnCtxNormalized;
error?: TSpawnError;
child?: TChild;
};
type TSpawnListeners = {
start: (data: TChild, ctx: TSpawnCtxNormalized) => void;
stdout: (data: Buffer, ctx: TSpawnCtxNormalized) => void;
stderr: (data: Buffer, ctx: TSpawnCtxNormalized) => void;
stdall: (data: Buffer, ctx: TSpawnCtxNormalized) => void;
abort: (error: Event, ctx: TSpawnCtxNormalized) => void;
err: (error: Error, ctx: TSpawnCtxNormalized) => void;
end: (result: TSpawnResult, ctx: TSpawnCtxNormalized) => void;
};
type TSpawnCtx = Partial<Omit<TSpawnCtxNormalized, "child">>;
type TChild = ReturnType<typeof cp.spawn>;
type TInput = string | Buffer | Readable;
interface TSpawnCtxNormalized {
id: string;
cwd: string;
cmd: string;
sync: boolean;
args: ReadonlyArray<string>;
input: TInput | null;
stdio: cp.StdioOptions;
detached: boolean;
env: Record<string, string | undefined>;
ee: EventEmitter;
on: Partial<TSpawnListeners>;
ac: AbortController;
signal: AbortController["signal"];
shell: string | boolean | undefined;
spawn: typeof cp.spawn;
spawnSync: typeo
gitextract_tzwf6ncx/ ├── .commitlintrc ├── .gitattributes ├── .github/ │ ├── FUNDING.yml │ ├── ISSUE_TEMPLATE/ │ │ ├── bug.yml │ │ └── idea.yml │ ├── PULL_REQUEST_TEMPLATE.md │ ├── SECURITY.md │ ├── codeql/ │ │ └── codeql-config.yml │ ├── pages/ │ │ └── index.html │ └── workflows/ │ ├── codeql.yml │ ├── dev-publish.yml │ ├── docs.yml │ ├── jsr-publish.yml │ ├── osv.yml │ ├── publish.yml │ ├── test.yml │ └── zizmor.yml ├── .gitignore ├── .node_version ├── .nycrc ├── .prettierignore ├── .size-limit.json ├── LICENSE ├── README.md ├── build/ │ ├── 3rd-party-licenses │ ├── cli.cjs │ ├── cli.d.ts │ ├── cli.js │ ├── core.cjs │ ├── core.d.ts │ ├── core.js │ ├── deno.js │ ├── deps.cjs │ ├── deps.d.ts │ ├── error.d.ts │ ├── esblib.cjs │ ├── globals.cjs │ ├── globals.d.ts │ ├── globals.js │ ├── goods.d.ts │ ├── index.cjs │ ├── index.d.ts │ ├── index.js │ ├── internals.cjs │ ├── internals.d.ts │ ├── log.d.ts │ ├── md.d.ts │ ├── util.cjs │ ├── util.d.ts │ ├── vendor-core.cjs │ ├── vendor-core.d.ts │ ├── vendor-extra.cjs │ ├── vendor-extra.d.ts │ ├── vendor.cjs │ ├── vendor.d.ts │ └── versions.d.ts ├── dcr/ │ └── Dockerfile ├── docs/ │ ├── .gitignore │ ├── .vitepress/ │ │ ├── config.mts │ │ └── theme/ │ │ ├── MyLayout.vue │ │ ├── MyOxygen.vue │ │ ├── custom.css │ │ └── index.js │ ├── api.md │ ├── architecture.md │ ├── cli.md │ ├── configuration.md │ ├── contribution.md │ ├── faq.md │ ├── getting-started.md │ ├── index.md │ ├── known-issues.md │ ├── lite.md │ ├── markdown.md │ ├── migration-from-v7.md │ ├── process-output.md │ ├── process-promise.md │ ├── quotes.md │ ├── setup.md │ ├── shell.md │ ├── typescript.md │ └── versions.md ├── examples/ │ ├── background-process.mjs │ ├── backup-github.mjs │ ├── fetch-weather.mjs │ ├── hello.mjs │ ├── interactive.mjs │ └── parallel.mjs ├── lefthook.yml ├── man/ │ └── zx.1 ├── package.json ├── scripts/ │ ├── build-clean.mjs │ ├── build-dts.mjs │ ├── build-js.mjs │ ├── build-jsr.mjs │ ├── build-pkgjson-lite.mjs │ ├── build-pkgjson-main.mjs │ ├── build-tests.mjs │ ├── build-versions.mjs │ ├── deno.polyfill.js │ └── import-meta-url.polyfill.js ├── src/ │ ├── cli.ts │ ├── core.ts │ ├── deps.ts │ ├── error.ts │ ├── globals-jsr.ts │ ├── globals.ts │ ├── goods.ts │ ├── index.ts │ ├── internals.ts │ ├── log.ts │ ├── md.ts │ ├── repl.ts │ ├── util.ts │ ├── vendor-core.ts │ ├── vendor-extra.ts │ ├── vendor.ts │ └── versions.ts ├── test/ │ ├── all.test.js │ ├── bench/ │ │ └── buf-join.mjs │ ├── cli.test.js │ ├── core.test.js │ ├── deps.test.js │ ├── error.test.ts │ ├── export.test.js │ ├── extra.test.js │ ├── fixtures/ │ │ ├── argv.mjs │ │ ├── copyright.txt │ │ ├── echo.http │ │ ├── exit-code.mjs │ │ ├── filename-dirname.mjs │ │ ├── interactive.mjs │ │ ├── js-project/ │ │ │ ├── package.json │ │ │ └── script.js │ │ ├── markdown-crlf.md │ │ ├── markdown.md │ │ ├── md.http │ │ ├── no-extension │ │ ├── no-extension.mjs │ │ ├── non-std-ext.zx │ │ ├── require.mjs │ │ ├── server.mjs │ │ └── ts-project/ │ │ ├── package.json │ │ ├── script.ts │ │ └── tsconfig.json │ ├── global.test.js │ ├── goods.test.ts │ ├── index.test.js │ ├── it/ │ │ ├── build-dcr.test.js │ │ ├── build-jsr.test.js │ │ └── build-npm.test.js │ ├── log.test.ts │ ├── md.test.ts │ ├── smoke/ │ │ ├── bun.test.js │ │ ├── deno.test.js │ │ ├── node.test.cjs │ │ ├── node.test.mjs │ │ ├── ts.test.ts │ │ ├── tsconfig.json │ │ ├── tsconfig.test.json │ │ └── win32.test.js │ ├── util.test.js │ └── vendor.test.js ├── test-d/ │ ├── core.test-d.ts │ ├── globals.test-d.ts │ └── goods.test-d.ts ├── tsconfig.json └── zizmor.yml
SYMBOL INDEX (904 symbols across 38 files)
FILE: build/cli.cjs
function startRepl (line 42) | function startRepl() {
function transformMarkdown (line 63) | function transformMarkdown(buf) {
function autorun (line 152) | function autorun(meta) {
function printUsage (line 163) | function printUsage() {
function main (line 192) | function main() {
function runScript (line 230) | function runScript(script, scriptPath, tempPath) {
function linkNodeModules (line 257) | function linkNodeModules(cwd, external) {
function lstat (line 273) | function lstat(p) {
function readScript (line 279) | function readScript() {
function readScriptFromStdin (line 318) | function readScriptFromStdin() {
function readScriptFromHttp (line 323) | function readScriptFromHttp(remote) {
function injectGlobalRequire (line 334) | function injectGlobalRequire(origin) {
function isMain (line 340) | function isMain(meta = import_meta_url, scriptpath = import_node_process...
function normalizeExt (line 351) | function normalizeExt(ext) {
function getFilepath (line 354) | function getFilepath(cwd = ".", name = "zx", _ext) {
FILE: build/core.cjs
method formatExitMessage (line 210) | static formatExitMessage(code, signal, stderr, from, details = "") {
method formatErrorMessage (line 223) | static formatErrorMessage(err, from) {
method formatErrorDetails (line 229) | static formatErrorDetails(lines = [], lim = 20) {
method getExitCodeInfo (line 235) | static getExitCodeInfo(exitCode) {
method getCallerLocationFromString (line 238) | static getCallerLocationFromString(stackString = "unknown") {
method getCallerLocation (line 244) | static getCallerLocation(err = new Error("zx error")) {
method getErrnoMessage (line 247) | static getErrnoMessage(errno) {
method cmd (line 261) | cmd({ cmd }) {
method stdout (line 264) | stdout({ data }) {
method stderr (line 267) | stderr({ data }) {
method custom (line 270) | custom({ data }) {
method fetch (line 273) | fetch(entry) {
method cd (line 278) | cd(entry) {
method retry (line 282) | retry(entry) {
method end (line 288) | end() {
method kill (line 291) | kill() {
function formatCmd (line 323) | function formatCmd(cmd) {
function within (line 452) | function within(callback) {
function sync$ (line 473) | function sync$(fn, makeSync) {
method constructor (line 489) | constructor(executor) {
method build (line 519) | build() {
method run (line 535) | run() {
method break (line 619) | break(exitCode, signal, cause) {
method finalize (line 624) | finalize(output, legacy = false) {
method abort (line 641) | abort(reason) {
method kill (line 649) | kill(signal) {
method stdio (line 657) | stdio(stdin, stdout = "pipe", stderr = "pipe") {
method nothrow (line 661) | nothrow(v = true) {
method quiet (line 665) | quiet(v = true) {
method verbose (line 669) | verbose(v = true) {
method timeout (line 673) | timeout(d = 0, signal = $.timeoutSignal) {
method halt (line 688) | halt() {
method id (line 692) | get id() {
method pid (line 695) | get pid() {
method cwd (line 699) | get cwd() {
method cmd (line 702) | get cmd() {
method fullCmd (line 705) | get fullCmd() {
method child (line 709) | get child() {
method stdin (line 713) | get stdin() {
method stdout (line 717) | get stdout() {
method stderr (line 721) | get stderr() {
method exitCode (line 725) | get exitCode() {
method signal (line 731) | get signal() {
method ac (line 734) | get ac() {
method output (line 737) | get output() {
method stage (line 740) | get stage() {
method sync (line 743) | get sync() {
method [Symbol.toStringTag] (line 746) | get [Symbol.toStringTag]() {
method [Symbol.toPrimitive] (line 749) | [Symbol.toPrimitive]() {
method json (line 753) | json() {
method text (line 756) | text(encoding) {
method lines (line 759) | lines(delimiter) {
method buffer (line 762) | buffer() {
method blob (line 765) | blob(type) {
method isQuiet (line 769) | isQuiet() {
method isVerbose (line 772) | isVerbose() {
method isNothrow (line 775) | isNothrow() {
method isHalted (line 778) | isHalted() {
method isSettled (line 781) | isSettled() {
method isRunning (line 784) | isRunning() {
method pipe (line 789) | get pipe() {
method unpipe (line 796) | unpipe(to) {
method _pipe (line 801) | _pipe(source, dest, ...args) {
method then (line 865) | then(onfulfilled, onrejected) {
method catch (line 868) | catch(onrejected) {
method [Symbol.asyncIterator] (line 872) | [Symbol.asyncIterator]() {
method emit (line 898) | emit(event, ...args) {
method on (line 901) | on(event, cb) {
method once (line 905) | once(event, cb) {
method write (line 909) | write(data, encoding, cb) {
method end (line 913) | end(chunk, cb) {
method removeListener (line 917) | removeListener(event, cb) {
method disarm (line 922) | static disarm(p, toggle = true) {
method pipe (line 939) | pipe(from, to) {
method unpipe (line 943) | unpipe(from, to) {
method unpipeBack (line 951) | unpipeBack(to, from) {
method runBack (line 957) | runBack(p) {
method sources (line 964) | sources(p) {
method then (line 974) | then(res = import_util.noop, rej = import_util.noop) {
method run (line 980) | run() {
method pipe (line 983) | pipe(...args) {
method constructor (line 994) | constructor(code = null, signal = null, stdout = "", stderr = "", stdall...
method exitCode (line 1016) | get exitCode() {
method signal (line 1019) | get signal() {
method duration (line 1022) | get duration() {
method [Symbol.toStringTag] (line 1025) | get [Symbol.toStringTag]() {
method ok (line 1028) | get ok() {
method json (line 1031) | json() {
method buffer (line 1034) | buffer() {
method blob (line 1037) | blob(type = "text/plain") {
method text (line 1044) | text(encoding = "utf8") {
method lines (line 1047) | lines(delimiter) {
method toString (line 1050) | toString() {
method valueOf (line 1053) | valueOf() {
method [Symbol.toPrimitive] (line 1056) | [Symbol.toPrimitive]() {
method [Symbol.iterator] (line 1060) | *[Symbol.iterator](dlmtr = this._dto.delimiter || $.delimiter || DLMTR) {
method [import_node_util2.inspect.custom] (line 1067) | [import_node_util2.inspect.custom]() {
method fromError (line 1077) | static fromError(error) {
function setShell (line 1091) | function setShell(n, ps3 = true) {
function syncProcessCwd (line 1106) | function syncProcessCwd(flag = true) {
function syncCwd (line 1117) | function syncCwd() {
function cd (line 1120) | function cd(dir) {
function kill (line 1128) | function kill(_0) {
function resolveDefaults (line 1153) | function resolveDefaults(defs = defaults, prefix = ENV_PREFIX, env = imp...
FILE: build/core.d.ts
type Options (line 24) | interface Options {
type Snapshot (line 54) | type Snapshot = Options & {
type Shell (line 64) | interface Shell<S = false, R = S extends true ? ProcessOutput : ProcessP...
type $ (line 74) | type $ = Shell & Options;
type ProcessStage (line 76) | type ProcessStage = 'initial' | 'halted' | 'running' | 'fulfilled' | 're...
type Resolve (line 77) | type Resolve = (out: ProcessOutput) => void;
type Reject (line 78) | type Reject = (error: ProcessOutput | Error) => void;
type PromiseCallback (line 79) | type PromiseCallback = {
type PromisifiedStream (line 83) | type PromisifiedStream<D extends Writable = Writable> = D & PromiseLike<...
type PipeAcceptor (line 86) | type PipeAcceptor = Writable | ProcessPromise;
type PipeMethod (line 87) | type PipeMethod = {
class ProcessPromise (line 93) | class ProcessPromise extends Promise<ProcessOutput> {
type ProcessDto (line 168) | type ProcessDto = {
class ProcessOutput (line 177) | class ProcessOutput extends Error {
FILE: build/deno.js
method set (line 9) | set() { return true }
FILE: build/deps.cjs
function installDeps (line 19) | function installDeps(dependencies, prefix, registry, installerType = "np...
function parseDeps (line 52) | function parseDeps(content) {
function parsePackageName (line 63) | function parsePackageName(path) {
function parseVersion (line 69) | function parseVersion(line) {
FILE: build/error.d.ts
class Fail (line 1) | class Fail extends Error {
FILE: build/globals.d.ts
type ProcessPromise (line 3) | type ProcessPromise = _.ProcessPromise;
type ProcessOutput (line 4) | type ProcessOutput = _.ProcessOutput;
FILE: build/goods.d.ts
type ArgvOpts (line 11) | type ArgvOpts = minimist.Opts & {
FILE: build/index.cjs
function tempdir (line 72) | function tempdir(prefix = `zx-${(0, import_util.randomId)()}`, mode) {
function tempfile (line 77) | function tempfile(name, data, mode) {
function updateArgv (line 93) | function updateArgv(args, opts) {
function sleep (line 98) | function sleep(duration) {
function fetch (line 116) | function fetch(url, init) {
function echo (line 140) | function echo(pieces, ...args) {
function stringify (line 144) | function stringify(arg) {
function question (line 147) | function question(_0) {
function stdin (line 171) | function stdin() {
function retry (line 192) | function retry(count, d, cb) {
function spinner (line 233) | function spinner(title, callback) {
function nothrow (line 259) | function nothrow(promise) {
function quiet (line 262) | function quiet(promise) {
FILE: build/internals.cjs
function wrap (line 18) | function wrap(name, api) {
FILE: build/log.d.ts
type LogEntry (line 3) | type LogEntry = {
type LogFormatters (line 47) | type LogFormatters = {
type Log (line 52) | type Log = {
FILE: build/util.cjs
function noop (line 37) | function noop() {
function identity (line 39) | function identity(v) {
function randomId (line 42) | function randomId() {
function isString (line 45) | function isString(obj) {
function preferLocalBin (line 52) | function preferLocalBin(env, ...dirs) {
function quote (line 64) | function quote(arg) {
function quotePowerShell (line 69) | function quotePowerShell(arg) {
function parseDuration (line 74) | function parseDuration(d) {
method get (line 89) | get(target, key) {
FILE: build/util.d.ts
type Duration (line 20) | type Duration = number | `${number}` | `${number}m` | `${number}s` | `${...
FILE: build/vendor-core.cjs
method "node_modules/isexe/dist/commonjs/index.min.js" (line 16) | "node_modules/isexe/dist/commonjs/index.min.js"(exports2) {
method "node_modules/which/lib/index.js" (line 141) | "node_modules/which/lib/index.js"(exports2, module2) {
function assembleStyles (line 310) | function assembleStyles() {
function hasFlag (line 431) | function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : i...
function envForceColor (line 444) | function envForceColor() {
function translateLevel (line 455) | function translateLevel(level) {
function _supportsColor (line 466) | function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } =...
function createSupportsColor (line 546) | function createSupportsColor(stream, options = {}) {
function stringReplaceAll (line 559) | function stringReplaceAll(string, substring, replacer) {
function stringEncaseCRLFWithFirstIndex (line 575) | function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
function createChalk (line 613) | function createChalk(options) {
method get (line 619) | get() {
method get (line 627) | get() {
method get (line 651) | get() {
method get (line 661) | get() {
method get (line 674) | get() {
method set (line 677) | set(level) {
method id (line 946) | get id() {
method cwd (line 950) | get cwd() {
method ee (line 957) | get ee() {
method ac (line 960) | get ac() {
method signal (line 963) | get signal() {
method store (line 973) | get store() {
method stdin (line 977) | get stdin() {
method stdout (line 980) | get stdout() {
method stderr (line 983) | get stderr() {
method signal (line 992) | get signal() {
method _transform (line 1009) | _transform(chunk, _, cb) {
method stdout (line 1061) | get stdout() {
method stderr (line 1064) | get stderr() {
method stdall (line 1067) | get stdall() {
method stdout (line 1119) | get stdout() {
method stderr (line 1122) | get stderr() {
method stdall (line 1125) | get stdall() {
method parse (line 1167) | parse(stdout) {
method parse (line 1174) | parse(stdout) {
method parse (line 1181) | parse(stdout) {
method run (line 1241) | run(cb2) {
method reject (line 1386) | reject(e) {
FILE: build/vendor-core.d.ts
type ColorSupportLevel (line 10) | type ColorSupportLevel = 0 | 1 | 2 | 3;
type ChalkInstance (line 11) | interface ChalkInstance {
type AppendNullIfNothrow (line 187) | type AppendNullIfNothrow<TOptions, TRet> = TOptions extends {
type TransformToArrayIfAll (line 190) | type TransformToArrayIfAll<TOptions, TRet> = TOptions extends {
type ReturnType$1 (line 193) | type ReturnType$1<TOptions> = AppendNullIfNothrow<TOptions, TransformToA...
type Exact (line 194) | type Exact<T, U extends T> = {
type Options (line 202) | interface Options {
type TPsLookupCallback (line 215) | type TPsLookupCallback = (err: any, processList?: TPsLookupEntry[]) => v...
type TPsLookupEntry (line 216) | type TPsLookupEntry = {
type TPsLookupQuery (line 222) | type TPsLookupQuery = {
type TPsKillOptions (line 228) | type TPsKillOptions = {
type TPsNext (line 232) | type TPsNext = (err?: any, data?: any) => void;
type TPsTreeOpts (line 233) | type TPsTreeOpts = {
type TQuote (line 251) | type TQuote = (input: string) => string;
type TSubstitute (line 253) | type TSubstitute = (arg: any) => string;
type TSpawnError (line 254) | type TSpawnError = any;
type TPushable (line 255) | type TPushable<T = any> = {
type TJoinable (line 258) | type TJoinable = {
type TReducible (line 261) | type TReducible<T, R> = {
type TArrayLike (line 264) | type TArrayLike<T> = Iterable<T> & TPushable<T> & TJoinable & TReducible...
type TSpawnStoreChunks (line 268) | type TSpawnStoreChunks = TArrayLike<string | Buffer>;
type TSpawnStore (line 269) | type TSpawnStore = {
type TSpawnResult (line 274) | type TSpawnResult = {
type TSpawnListeners (line 290) | type TSpawnListeners = {
type TSpawnCtx (line 299) | type TSpawnCtx = Partial<Omit<TSpawnCtxNormalized, "child">>;
type TChild (line 300) | type TChild = ReturnType<typeof cp.spawn>;
type TInput (line 301) | type TInput = string | Buffer | Readable;
type TSpawnCtxNormalized (line 302) | interface TSpawnCtxNormalized {
class VoidStream (line 334) | class VoidStream extends Transform {
type RequestInfo (line 343) | type RequestInfo = Parameters<typeof globalThis.fetch>[0];
type RequestInit$1 (line 344) | type RequestInit$1 = Parameters<typeof globalThis.fetch>[1] & {
FILE: build/vendor-extra.cjs
method "node_modules/fast-glob/out/utils/array.js" (line 23) | "node_modules/fast-glob/out/utils/array.js"(exports2) {
method "node_modules/fast-glob/out/utils/errno.js" (line 50) | "node_modules/fast-glob/out/utils/errno.js"(exports2) {
method "node_modules/fast-glob/out/utils/fs.js" (line 63) | "node_modules/fast-glob/out/utils/fs.js"(exports2) {
method "node_modules/fast-glob/out/utils/path.js" (line 88) | "node_modules/fast-glob/out/utils/path.js"(exports2) {
method "node_modules/is-extglob/index.js" (line 141) | "node_modules/is-extglob/index.js"(exports2, module2) {
method "node_modules/is-glob/index.js" (line 159) | "node_modules/is-glob/index.js"(exports2, module2) {
method "node_modules/glob-parent/index.js" (line 291) | "node_modules/glob-parent/index.js"(exports2, module2) {
method "node_modules/braces/lib/utils.js" (line 320) | "node_modules/braces/lib/utils.js"(exports2) {
method "node_modules/braces/lib/stringify.js" (line 402) | "node_modules/braces/lib/stringify.js"(exports2, module2) {
method "node_modules/is-number/index.js" (line 433) | "node_modules/is-number/index.js"(exports2, module2) {
method "node_modules/to-regex-range/index.js" (line 449) | "node_modules/to-regex-range/index.js"(exports2, module2) {
method "node_modules/fill-range/index.js" (line 660) | "node_modules/fill-range/index.js"(exports2, module2) {
method "node_modules/braces/lib/compile.js" (line 854) | "node_modules/braces/lib/compile.js"(exports2, module2) {
method "node_modules/braces/lib/expand.js" (line 906) | "node_modules/braces/lib/expand.js"(exports2, module2) {
method "node_modules/braces/lib/constants.js" (line 1000) | "node_modules/braces/lib/constants.js"(exports2, module2) {
method "node_modules/braces/lib/parse.js" (line 1101) | "node_modules/braces/lib/parse.js"(exports2, module2) {
method "node_modules/braces/index.js" (line 1339) | "node_modules/braces/index.js"(exports2, module2) {
method "node_modules/picomatch/lib/constants.js" (line 1402) | "node_modules/picomatch/lib/constants.js"(exports2, module2) {
method "node_modules/picomatch/lib/utils.js" (line 1598) | "node_modules/picomatch/lib/utils.js"(exports2) {
method "node_modules/picomatch/lib/scan.js" (line 1659) | "node_modules/picomatch/lib/scan.js"(exports2, module2) {
method "node_modules/picomatch/lib/parse.js" (line 1989) | "node_modules/picomatch/lib/parse.js"(exports2, module2) {
method "node_modules/picomatch/lib/picomatch.js" (line 2762) | "node_modules/picomatch/lib/picomatch.js"(exports2, module2) {
method "node_modules/picomatch/index.js" (line 2903) | "node_modules/picomatch/index.js"(exports2, module2) {
method "node_modules/micromatch/index.js" (line 2911) | "node_modules/micromatch/index.js"(exports2, module2) {
method "node_modules/fast-glob/out/utils/pattern.js" (line 3072) | "node_modules/fast-glob/out/utils/pattern.js"(exports2) {
method "node_modules/merge2/index.js" (line 3237) | "node_modules/merge2/index.js"(exports2, module2) {
method "node_modules/fast-glob/out/utils/stream.js" (line 3356) | "node_modules/fast-glob/out/utils/stream.js"(exports2) {
method "node_modules/fast-glob/out/utils/string.js" (line 3379) | "node_modules/fast-glob/out/utils/string.js"(exports2) {
method "node_modules/fast-glob/out/utils/index.js" (line 3396) | "node_modules/fast-glob/out/utils/index.js"(exports2) {
method "node_modules/fast-glob/out/managers/tasks.js" (line 3419) | "node_modules/fast-glob/out/managers/tasks.js"(exports2) {
method "node_modules/@nodelib/fs.stat/out/providers/async.js" (line 3515) | "node_modules/@nodelib/fs.stat/out/providers/async.js"(exports2) {
method "node_modules/@nodelib/fs.stat/out/providers/sync.js" (line 3557) | "node_modules/@nodelib/fs.stat/out/providers/sync.js"(exports2) {
method "node_modules/@nodelib/fs.stat/out/adapters/fs.js" (line 3585) | "node_modules/@nodelib/fs.stat/out/adapters/fs.js"(exports2) {
method "node_modules/@nodelib/fs.stat/out/settings.js" (line 3608) | "node_modules/@nodelib/fs.stat/out/settings.js"(exports2) {
method "node_modules/@nodelib/fs.stat/out/index.js" (line 3630) | "node_modules/@nodelib/fs.stat/out/index.js"(exports2) {
method "node_modules/queue-microtask/index.js" (line 3662) | "node_modules/queue-microtask/index.js"(exports2, module2) {
method "node_modules/run-parallel/index.js" (line 3673) | "node_modules/run-parallel/index.js"(exports2, module2) {
method "node_modules/@nodelib/fs.scandir/out/constants.js" (line 3724) | "node_modules/@nodelib/fs.scandir/out/constants.js"(exports2) {
method "node_modules/@nodelib/fs.scandir/out/utils/fs.js" (line 3744) | "node_modules/@nodelib/fs.scandir/out/utils/fs.js"(exports2) {
method "node_modules/@nodelib/fs.scandir/out/utils/index.js" (line 3769) | "node_modules/@nodelib/fs.scandir/out/utils/index.js"(exports2) {
method "node_modules/@nodelib/fs.scandir/out/providers/common.js" (line 3780) | "node_modules/@nodelib/fs.scandir/out/providers/common.js"(exports2) {
method "node_modules/@nodelib/fs.scandir/out/providers/async.js" (line 3796) | "node_modules/@nodelib/fs.scandir/out/providers/async.js"(exports2) {
method "node_modules/@nodelib/fs.scandir/out/providers/sync.js" (line 3906) | "node_modules/@nodelib/fs.scandir/out/providers/sync.js"(exports2) {
method "node_modules/@nodelib/fs.scandir/out/adapters/fs.js" (line 3965) | "node_modules/@nodelib/fs.scandir/out/adapters/fs.js"(exports2) {
method "node_modules/@nodelib/fs.scandir/out/settings.js" (line 3990) | "node_modules/@nodelib/fs.scandir/out/settings.js"(exports2) {
method "node_modules/@nodelib/fs.scandir/out/index.js" (line 4020) | "node_modules/@nodelib/fs.scandir/out/index.js"(exports2) {
method "node_modules/reusify/reusify.js" (line 4052) | "node_modules/reusify/reusify.js"(exports2, module2) {
method "node_modules/fastq/queue.js" (line 4083) | "node_modules/fastq/queue.js"(exports2, module2) {
method "node_modules/@nodelib/fs.walk/out/readers/common.js" (line 4367) | "node_modules/@nodelib/fs.walk/out/readers/common.js"(exports2) {
method "node_modules/@nodelib/fs.walk/out/readers/reader.js" (line 4401) | "node_modules/@nodelib/fs.walk/out/readers/reader.js"(exports2) {
method "node_modules/@nodelib/fs.walk/out/readers/async.js" (line 4418) | "node_modules/@nodelib/fs.walk/out/readers/async.js"(exports2) {
method "node_modules/@nodelib/fs.walk/out/providers/async.js" (line 4521) | "node_modules/@nodelib/fs.walk/out/providers/async.js"(exports2) {
method "node_modules/@nodelib/fs.walk/out/providers/stream.js" (line 4557) | "node_modules/@nodelib/fs.walk/out/providers/stream.js"(exports2) {
method "node_modules/@nodelib/fs.walk/out/readers/sync.js" (line 4598) | "node_modules/@nodelib/fs.walk/out/readers/sync.js"(exports2) {
method "node_modules/@nodelib/fs.walk/out/providers/sync.js" (line 4662) | "node_modules/@nodelib/fs.walk/out/providers/sync.js"(exports2) {
method "node_modules/@nodelib/fs.walk/out/settings.js" (line 4682) | "node_modules/@nodelib/fs.walk/out/settings.js"(exports2) {
method "node_modules/@nodelib/fs.walk/out/index.js" (line 4714) | "node_modules/@nodelib/fs.walk/out/index.js"(exports2) {
method "node_modules/fast-glob/out/readers/reader.js" (line 4754) | "node_modules/fast-glob/out/readers/reader.js"(exports2) {
method "node_modules/fast-glob/out/readers/stream.js" (line 4793) | "node_modules/fast-glob/out/readers/stream.js"(exports2) {
method "node_modules/fast-glob/out/readers/async.js" (line 4850) | "node_modules/fast-glob/out/readers/async.js"(exports2) {
method "node_modules/fast-glob/out/providers/matchers/matcher.js" (line 4891) | "node_modules/fast-glob/out/providers/matchers/matcher.js"(exports2) {
method "node_modules/fast-glob/out/providers/matchers/partial.js" (line 4942) | "node_modules/fast-glob/out/providers/matchers/partial.js"(exports2) {
method "node_modules/fast-glob/out/providers/filters/deep.js" (line 4979) | "node_modules/fast-glob/out/providers/filters/deep.js"(exports2) {
method "node_modules/fast-glob/out/providers/filters/entry.js" (line 5044) | "node_modules/fast-glob/out/providers/filters/entry.js"(exports2) {
method "node_modules/fast-glob/out/providers/filters/error.js" (line 5132) | "node_modules/fast-glob/out/providers/filters/error.js"(exports2) {
method "node_modules/fast-glob/out/providers/transformers/entry.js" (line 5153) | "node_modules/fast-glob/out/providers/transformers/entry.js"(exports2) {
method "node_modules/fast-glob/out/providers/provider.js" (line 5185) | "node_modules/fast-glob/out/providers/provider.js"(exports2) {
method "node_modules/fast-glob/out/providers/async.js" (line 5239) | "node_modules/fast-glob/out/providers/async.js"(exports2) {
method "node_modules/fast-glob/out/providers/stream.js" (line 5270) | "node_modules/fast-glob/out/providers/stream.js"(exports2) {
method "node_modules/fast-glob/out/readers/sync.js" (line 5304) | "node_modules/fast-glob/out/readers/sync.js"(exports2) {
method "node_modules/fast-glob/out/providers/sync.js" (line 5352) | "node_modules/fast-glob/out/providers/sync.js"(exports2) {
method "node_modules/fast-glob/out/settings.js" (line 5381) | "node_modules/fast-glob/out/settings.js"(exports2) {
method "node_modules/fast-glob/out/index.js" (line 5441) | "node_modules/fast-glob/out/index.js"(exports2, module2) {
method "node_modules/ignore/index.js" (line 5544) | "node_modules/ignore/index.js"(exports2, module2) {
method "node_modules/universalify/index.js" (line 6002) | "node_modules/universalify/index.js"(exports2) {
method "node_modules/graceful-fs/polyfills.js" (line 6030) | "node_modules/graceful-fs/polyfills.js"(exports2, module2) {
method "node_modules/graceful-fs/legacy-streams.js" (line 6319) | "node_modules/graceful-fs/legacy-streams.js"(exports2, module2) {
method "node_modules/graceful-fs/clone.js" (line 6416) | "node_modules/graceful-fs/clone.js"(exports2, module2) {
method "node_modules/graceful-fs/graceful-fs.js" (line 6439) | "node_modules/graceful-fs/graceful-fs.js"(exports2, module2) {
method "node_modules/fs-extra/lib/fs/index.js" (line 6810) | "node_modules/fs-extra/lib/fs/index.js"(exports2) {
method "node_modules/fs-extra/lib/mkdirs/utils.js" (line 6926) | "node_modules/fs-extra/lib/mkdirs/utils.js"(exports2, module2) {
method "node_modules/fs-extra/lib/mkdirs/make-dir.js" (line 6944) | "node_modules/fs-extra/lib/mkdirs/make-dir.js"(exports2, module2) {
method "node_modules/fs-extra/lib/mkdirs/index.js" (line 6972) | "node_modules/fs-extra/lib/mkdirs/index.js"(exports2, module2) {
method "node_modules/fs-extra/lib/path-exists/index.js" (line 6991) | "node_modules/fs-extra/lib/path-exists/index.js"(exports2, module2) {
method "node_modules/fs-extra/lib/util/utimes.js" (line 7007) | "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) {
method "node_modules/fs-extra/lib/util/stat.js" (line 7043) | "node_modules/fs-extra/lib/util/stat.js"(exports2, module2) {
method "node_modules/fs-extra/lib/util/async.js" (line 7179) | "node_modules/fs-extra/lib/util/async.js"(exports2, module2) {
method "node_modules/fs-extra/lib/copy/copy.js" (line 7221) | "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) {
method "node_modules/fs-extra/lib/copy/copy-sync.js" (line 7361) | "node_modules/fs-extra/lib/copy/copy-sync.js"(exports2, module2) {
method "node_modules/fs-extra/lib/copy/index.js" (line 7499) | "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) {
method "node_modules/fs-extra/lib/remove/index.js" (line 7511) | "node_modules/fs-extra/lib/remove/index.js"(exports2, module2) {
method "node_modules/fs-extra/lib/empty/index.js" (line 7530) | "node_modules/fs-extra/lib/empty/index.js"(exports2, module2) {
method "node_modules/fs-extra/lib/ensure/file.js" (line 7571) | "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) {
method "node_modules/fs-extra/lib/ensure/link.js" (line 7632) | "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) {
method "node_modules/fs-extra/lib/ensure/symlink-paths.js" (line 7691) | "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) {
method "node_modules/fs-extra/lib/ensure/symlink-type.js" (line 7766) | "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) {
method "node_modules/fs-extra/lib/ensure/symlink.js" (line 7801) | "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) {
method "node_modules/fs-extra/lib/ensure/index.js" (line 7864) | "node_modules/fs-extra/lib/ensure/index.js"(exports2, module2) {
method "node_modules/jsonfile/utils.js" (line 7891) | "node_modules/jsonfile/utils.js"(exports2, module2) {
method "node_modules/jsonfile/index.js" (line 7908) | "node_modules/jsonfile/index.js"(exports2, module2) {
method "node_modules/fs-extra/lib/json/jsonfile.js" (line 7985) | "node_modules/fs-extra/lib/json/jsonfile.js"(exports2, module2) {
method "node_modules/fs-extra/lib/output-file/index.js" (line 8000) | "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) {
method "node_modules/fs-extra/lib/json/output-json.js" (line 8032) | "node_modules/fs-extra/lib/json/output-json.js"(exports2, module2) {
method "node_modules/fs-extra/lib/json/output-json-sync.js" (line 8048) | "node_modules/fs-extra/lib/json/output-json-sync.js"(exports2, module2) {
method "node_modules/fs-extra/lib/json/index.js" (line 8062) | "node_modules/fs-extra/lib/json/index.js"(exports2, module2) {
method "node_modules/fs-extra/lib/move/move.js" (line 8080) | "node_modules/fs-extra/lib/move/move.js"(exports2, module2) {
method "node_modules/fs-extra/lib/move/move-sync.js" (line 8138) | "node_modules/fs-extra/lib/move/move-sync.js"(exports2, module2) {
method "node_modules/fs-extra/lib/move/index.js" (line 8191) | "node_modules/fs-extra/lib/move/index.js"(exports2, module2) {
method "node_modules/fs-extra/lib/index.js" (line 8203) | "node_modules/fs-extra/lib/index.js"(exports2, module2) {
method "node_modules/create-require/create-require.js" (line 8211) | "node_modules/create-require/create-require.js"(exports2, module2) {
function f (line 8251) | function f(e) {
method "node_modules/node-fetch-native/dist/shared/node-fetch-native.DfbY2q-x.mjs" (line 8256) | "node_modules/node-fetch-native/dist/shared/node-fetch-native.DfbY2q-x.m...
function v (line 8270) | function v(u) {
function Z (line 8277) | function Z(u, a) {
method "node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs" (line 8327) | "node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs"() {
function Us (line 8456) | function Us(i) {
function Ns (line 8470) | function Ns() {
function Hs (line 10849) | function Hs() {
function Wn (line 10880) | function Wn(i, o3 = true) {
function Zs (line 10900) | function Zs(i, o3 = ut) {
function zn (line 10913) | function zn(i) {
function ol (line 10953) | function ol(i = []) {
function Ti (line 10962) | function Ti(i, o3 = false) {
function ll (line 10965) | function ll(i) {
function ul (line 10969) | function ul(i) {
function ct (line 10974) | function ct(i) {
function fl (line 10977) | function fl(i, { referrerURLCallback: o3, referrerOriginCallback: a } = ...
function cl (line 11006) | function cl(i) {
function pl (line 11012) | function pl() {
function Ai (line 11022) | function Ai(i, o3) {
function Rl (line 11149) | function Rl(i, o3) {
function W (line 11171) | function W(i) {
function ki (line 11175) | function ki(i) {
function ht (line 11182) | function ht(i, o3) {
function Wi (line 11190) | function Wi(i) {
function Tl (line 11197) | function Tl(i) {
function Cl (line 11203) | function Cl(i, o3) {
function qi (line 11219) | function qi(i) {
function Pl (line 11224) | function Pl(i, o3) {
function vl (line 11228) | function vl(i) {
function El (line 11231) | function El(i, o3) {
function Al (line 11234) | function Al(i, o3) {
function Oi (line 11237) | function Oi(i, o3) {
function Rr (line 11240) | function Rr(i) {
function Ot (line 11243) | function Ot(i) {
function Bl (line 11248) | function Bl(i) {
function ji (line 11267) | function ji(i, o3) {
function Li (line 11270) | function Li(i) {
function Pe (line 11278) | function Pe() {
function kl (line 11291) | function kl() {
function Wl (line 11295) | function Wl(i) {
function Di (line 11298) | function Di(i) {
function Ui (line 11303) | function Ui() {
method "node_modules/node-fetch-native/dist/node.mjs" (line 11309) | "node_modules/node-fetch-native/dist/node.mjs"() {
method "node_modules/minimist/index.js" (line 12079) | "node_modules/minimist/index.js"(exports2, module2) {
function mergeStreams (line 12324) | function mergeStreams(streams) {
method constructor (line 12352) | constructor() {
method add (line 12361) | add(stream) {
method remove (line 12381) | remove(stream) {
function toPath (line 12570) | function toPath(urlOrPath) {
function isPathInside (line 12585) | function isPathInside(childPath, parentPath) {
function slash (line 12593) | function slash(path5) {
function isCollection (line 13420) | function isCollection(node) {
function isNode (line 13429) | function isNode(node) {
function visit (line 13446) | function visit(node, visitor) {
function visit_ (line 13458) | function visit_(key, node, visitor, path5) {
function visitAsync (line 13494) | function visitAsync(node, visitor) {
function visitAsync_ (line 13508) | function visitAsync_(key, node, visitor, path5) {
function initVisitor (line 13546) | function initVisitor(visitor) {
function callVisitor (line 13564) | function callVisitor(key, node, visitor, path5) {
function replaceNode (line 13580) | function replaceNode(key, path5, node) {
method constructor (line 13608) | constructor(yaml, tags) {
method clone (line 13614) | clone() {
method atDocument (line 13623) | atDocument() {
method add (line 13644) | add(line, onError) {
method tagName (line 13690) | tagName(source, onError) {
method tagString (line 13728) | tagString(tag) {
method toString (line 13735) | toString(doc) {
function anchorIsValid (line 13761) | function anchorIsValid(anchor) {
function anchorNames (line 13769) | function anchorNames(root) {
function findNewAnchor (line 13779) | function findNewAnchor(prefix, exclude) {
function createNodeAnchors (line 13786) | function createNodeAnchors(doc, prefix) {
function applyReviver (line 13820) | function applyReviver(reviver, obj, key, val) {
function toJS (line 13864) | function toJS(value, arg, ctx) {
method constructor (line 13888) | constructor(type) {
method clone (line 13892) | clone() {
method toJS (line 13899) | toJS(doc, { mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {
method constructor (line 13920) | constructor(source) {
method resolve (line 13933) | resolve(doc, ctx) {
method toJSON (line 13957) | toJSON(_arg, ctx) {
method toString (line 13986) | toString(ctx, _onComment, _onChompKeep) {
function getAliasCount (line 14000) | function getAliasCount(doc, node, anchors) {
method constructor (line 14024) | constructor(value) {
method toJSON (line 14028) | toJSON(arg, ctx) {
method toString (line 14031) | toString() {
function findTagObject (line 14043) | function findTagObject(value, tagName, tags) {
function createNode (line 14057) | function createNode(value, tagName, ctx) {
function collectionFromPath (line 14113) | function collectionFromPath(schema4, path5, value) {
method constructor (line 14137) | constructor(type, schema4) {
method clone (line 14151) | clone(schema4) {
method addIn (line 14165) | addIn(path5, value) {
method deleteIn (line 14183) | deleteIn(path5) {
method getIn (line 14198) | getIn(path5, keepScalar) {
method hasAllNullValues (line 14206) | hasAllNullValues(allowScalar) {
method hasIn (line 14217) | hasIn(path5) {
method setIn (line 14228) | setIn(path5, value) {
function indentComment (line 14246) | function indentComment(comment, indent) {
function foldFlowLines (line 14257) | function foldFlowLines(text, indent, mode = "flow", { indentAtStart, lin...
function consumeMoreIndentedLines (line 14361) | function consumeMoreIndentedLines(text, i, indent) {
function lineLengthOverLimit (line 14387) | function lineLengthOverLimit(str, lineWidth, indentLength) {
function doubleQuotedString (line 14405) | function doubleQuotedString(value, ctx) {
function singleQuotedString (line 14485) | function singleQuotedString(value, ctx) {
function quotedString (line 14493) | function quotedString(value, ctx) {
function blockString (line 14516) | function blockString({ comment, type, value }, ctx, onComment, onChompKe...
function plainString (line 14591) | function plainString(item, ctx, onComment, onChompKeep) {
function stringifyString (line 14624) | function stringifyString(item, ctx, onComment, onChompKeep) {
function createStringifyContext (line 14659) | function createStringifyContext(doc, options) {
function getTagObject (line 14700) | function getTagObject(tags, item) {
function stringifyProps (line 14731) | function stringifyProps(node, tagObj, { anchors, doc }) {
function stringify (line 14746) | function stringify(item, ctx, onComment, onChompKeep) {
function stringifyPair (line 14777) | function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
function warn (line 14901) | function warn(logLevel, warning) {
function addMergeToJSMap (line 14920) | function addMergeToJSMap(ctx, map2, value) {
function mergeValue (line 14931) | function mergeValue(ctx, map2, value) {
function addPairToJSMap (line 14955) | function addPairToJSMap(ctx, map2, { key, value }) {
function stringifyKey (line 14982) | function stringifyKey(key, jsKey, ctx) {
function createPair (line 15008) | function createPair(key, value, ctx) {
method constructor (line 15014) | constructor(key, value = null) {
method clone (line 15019) | clone(schema4) {
method toJSON (line 15027) | toJSON(_, ctx) {
method toString (line 15031) | toString(ctx, onComment, onChompKeep) {
function stringifyCollection (line 15037) | function stringifyCollection(collection, ctx, options) {
function stringifyBlockCollection (line 15043) | function stringifyBlockCollection({ comment, items }, ctx, { blockItemPr...
function stringifyFlowCollection (line 15092) | function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent...
function addCommentBefore (line 15163) | function addCommentBefore({ indent, options: { commentString } }, lines,...
function findPair (line 15173) | function findPair(items, key) {
method tagName (line 15186) | static get tagName() {
method constructor (line 15189) | constructor(schema4) {
method from (line 15197) | static from(schema4, obj, ctx) {
method add (line 15226) | add(pair, overwrite) {
method delete (line 15254) | delete(key) {
method get (line 15261) | get(key, keepScalar) {
method has (line 15267) | has(key) {
method set (line 15270) | set(key, value) {
method toJSON (line 15278) | toJSON(_, ctx, Type) {
method toString (line 15286) | toString(ctx, onComment, onChompKeep) {
method resolve (line 15311) | resolve(map2, onError) {
method tagName (line 15321) | static get tagName() {
method constructor (line 15324) | constructor(schema4) {
method add (line 15328) | add(value) {
method delete (line 15339) | delete(key) {
method get (line 15346) | get(key, keepScalar) {
method has (line 15359) | has(key) {
method set (line 15370) | set(key, value) {
method toJSON (line 15380) | toJSON(_, ctx) {
method toString (line 15389) | toString(ctx, onComment, onChompKeep) {
method from (line 15400) | static from(schema4, obj, ctx) {
function asItemIndex (line 15416) | function asItemIndex(key) {
method resolve (line 15429) | resolve(seq2, onError) {
method stringify (line 15443) | stringify(item, ctx, onComment, onChompKeep) {
method stringify (line 15467) | stringify({ source, value }, ctx) {
function stringifyNumber (line 15478) | function stringifyNumber({ format, minFractionDigits, tag, value }) {
method stringify (line 15514) | stringify(node) {
method resolve (line 15524) | resolve(str) {
function intStringify (line 15537) | function intStringify(node, radix, prefix) {
function intIdentify2 (line 15586) | function intIdentify2(value) {
method resolve (line 15636) | resolve(str, onError) {
method resolve (line 15657) | resolve(src, onError) {
method stringify (line 15669) | stringify({ comment, type, value }, ctx, onComment, onChompKeep) {
function resolvePairs (line 15697) | function resolvePairs(seq2, onError) {
function createPairs (line 15724) | function createPairs(schema4, iterable, ctx) {
method constructor (line 15765) | constructor() {
method toJSON (line 15778) | toJSON(_, ctx) {
method from (line 15798) | static from(schema4, iterable, ctx) {
method resolve (line 15812) | resolve(seq2, onError) {
function boolStringify (line 15830) | function boolStringify({ value, source }, ctx) {
method stringify (line 15869) | stringify(node) {
method resolve (line 15879) | resolve(str) {
function intResolve2 (line 15894) | function intResolve2(str, offset, radix, { intAsBigInt }) {
function intStringify2 (line 15917) | function intStringify2(node, radix, prefix) {
method constructor (line 15963) | constructor(schema4) {
method add (line 15967) | add(key) {
method get (line 15983) | get(key, keepPair) {
method set (line 15987) | set(key, value) {
method toJSON (line 15997) | toJSON(_, ctx) {
method toString (line 16000) | toString(ctx, onComment, onChompKeep) {
method from (line 16008) | static from(schema4, iterable, ctx) {
method resolve (line 16028) | resolve(map2, onError) {
function parseSexagesimal (line 16041) | function parseSexagesimal(str, asBigInt) {
function stringifySexagesimal (line 16048) | function stringifySexagesimal(node) {
method resolve (line 16100) | resolve(str) {
function getTags (line 16183) | function getTags(customTags, schemaName, addMergeTag) {
method constructor (line 16221) | constructor({ compat, customTags, merge: merge2, resolveKnownTags, schem...
method clone (line 16232) | clone() {
function stringifyDocument (line 16240) | function stringifyDocument(doc, options) {
method constructor (line 16313) | constructor(value, replacer, options) {
method clone (line 16352) | clone() {
method add (line 16370) | add(value) {
method addIn (line 16375) | addIn(path5, value) {
method createAlias (line 16388) | createAlias(node, name) {
method createNode (line 16396) | createNode(value, replacer, options) {
method createPair (line 16436) | createPair(key, value, options = {}) {
method delete (line 16445) | delete(key) {
method deleteIn (line 16452) | deleteIn(path5) {
method get (line 16466) | get(key, keepScalar) {
method getIn (line 16474) | getIn(path5, keepScalar) {
method has (line 16482) | has(key) {
method hasIn (line 16488) | hasIn(path5) {
method set (line 16497) | set(key, value) {
method setIn (line 16508) | setIn(path5, value) {
method setSchema (line 16524) | setSchema(version, options = {}) {
method toJS (line 16562) | toJS({ json, jsonArg, mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {
method toJSON (line 16583) | toJSON(jsonArg, onAnchor) {
method toString (line 16587) | toString(options = {}) {
function assertCollection (line 16597) | function assertCollection(contents) {
method constructor (line 16605) | constructor(name, pos, code, message) {
method constructor (line 16614) | constructor(pos, code, message) {
method constructor (line 16619) | constructor(pos, code, message) {
function resolveProps (line 16660) | function resolveProps(tokens, { flow, indicator, next, offset, onError, ...
function containsNewline (line 16788) | function containsNewline(key) {
function flowIndentCheck (line 16824) | function flowIndentCheck(indent, fc, onError) {
function mapIncludes (line 16835) | function mapIncludes(ctx, items, search) {
function resolveBlockMap (line 16845) | function resolveBlockMap({ composeNode: composeNode2, composeEmptyNode: ...
function resolveBlockSeq (line 16941) | function resolveBlockSeq({ composeNode: composeNode2, composeEmptyNode: ...
function resolveEnd (line 16984) | function resolveEnd(end, offset, reqSpace, onError) {
function resolveFlowCollection (line 17023) | function resolveFlowCollection({ composeNode: composeNode2, composeEmpty...
function resolveCollection (line 17202) | function resolveCollection(CN2, ctx, token, onError, tagName, tag) {
function composeCollection (line 17213) | function composeCollection(CN2, ctx, token, props, onError) {
function resolveBlockScalar (line 17255) | function resolveBlockScalar(ctx, scalar, onError) {
function parseBlockScalarHeader (line 17359) | function parseBlockScalarHeader({ offset, props }, strict, onError) {
function splitLines (line 17419) | function splitLines(source) {
function resolveFlowScalar (line 17431) | function resolveFlowScalar(scalar, strict, onError) {
function plainValue (line 17468) | function plainValue(source, onError) {
function singleQuotedValue (line 17496) | function singleQuotedValue(source, onError) {
function foldLines (line 17501) | function foldLines(source) {
function doubleQuotedValue (line 17535) | function doubleQuotedValue(source, onError) {
function foldNewline (line 17582) | function foldNewline(source, offset) {
function parseCharCode (line 17630) | function parseCharCode(source, offset, length, onError) {
function composeScalar (line 17643) | function composeScalar(ctx, token, tagToken, onError) {
function findScalarTagByName (line 17676) | function findScalarTagByName(schema4, value, tagName, tagToken, onError) {
function findScalarTagByTest (line 17700) | function findScalarTagByTest({ atKey, directives, schema: schema4 }, val...
function emptyScalarPosition (line 17722) | function emptyScalarPosition(offset, before, pos) {
function composeNode (line 17747) | function composeNode(ctx, token, props, onError) {
function composeEmptyNode (line 17798) | function composeEmptyNode(ctx, offset, before, pos, { spaceBefore, comme...
function composeAlias (line 17819) | function composeAlias({ options }, { offset, source, end }, onError) {
function composeDoc (line 17834) | function composeDoc(options, directives, { offset, start, value, end }, ...
function getErrorPos (line 17867) | function getErrorPos(src) {
function parsePrelude (line 17875) | function parsePrelude(prelude) {
method constructor (line 17902) | constructor(options = {}) {
method decorate (line 17918) | decorate(doc, afterDoc) {
method streamInfo (line 17956) | streamInfo() {
method compose (line 17970) | *compose(tokens, forceDoc = false, endOffset = -1) {
method next (line 17976) | *next(token) {
method end (line 18041) | *end(forceDoc = false, endOffset = -1) {
function resolveAsScalar (line 18077) | function resolveAsScalar(token, strict = true, onError) {
function createScalarToken (line 18097) | function createScalarToken(value, context) {
function setScalarValue (line 18130) | function setScalarValue(token, value, context = {}) {
function setBlockScalarValue (line 18174) | function setBlockScalarValue(token, source) {
function addEndtoBlockProps (line 18198) | function addEndtoBlockProps(props, end) {
function setFlowScalarValue (line 18212) | function setFlowScalarValue(token, source, type) {
function stringifyToken (line 18252) | function stringifyToken(token) {
function stringifyItem (line 18291) | function stringifyItem({ start, key, sep, value }) {
function visit2 (line 18309) | function visit2(cst, visitor) {
function _visit (line 18336) | function _visit(path5, item, visitor) {
function prettyToken (line 18368) | function prettyToken(token) {
function tokenType (line 18382) | function tokenType(source) {
function isEmpty (line 18443) | function isEmpty(ch) {
method constructor (line 18461) | constructor() {
method lex (line 18480) | *lex(source, incomplete = false) {
method atLineEnd (line 18493) | atLineEnd() {
method charAt (line 18504) | charAt(n4) {
method continueScalar (line 18507) | continueScalar(offset) {
method getLine (line 18527) | getLine() {
method hasChars (line 18539) | hasChars(n4) {
method setNext (line 18542) | setNext(state) {
method peek (line 18549) | peek(n4) {
method parseNext (line 18552) | *parseNext(next) {
method parseStream (line 18572) | *parseStream() {
method parseLineStart (line 18613) | *parseLineStart() {
method parseBlockStart (line 18633) | *parseBlockStart() {
method parseDocument (line 18645) | *parseDocument() {
method parseFlowCollection (line 18685) | *parseFlowCollection() {
method parseQuotedScalar (line 18756) | *parseQuotedScalar() {
method parseBlockScalarHeader (line 18793) | *parseBlockScalarHeader() {
method parseBlockScalar (line 18808) | *parseBlockScalar() {
method parsePlainScalar (line 18880) | *parsePlainScalar() {
method pushCount (line 18921) | *pushCount(n4) {
method pushToIndex (line 18929) | *pushToIndex(i, allowEmpty) {
method pushIndicators (line 18939) | *pushIndicators() {
method pushTag (line 18963) | *pushTag() {
method pushNewline (line 18984) | *pushNewline() {
method pushSpaces (line 18993) | *pushSpaces(allowTabs) {
method pushUntil (line 19006) | *pushUntil(test) {
method constructor (line 19017) | constructor() {
function includesToken (line 19041) | function includesToken(list, type) {
function findNonEmptyIndex (line 19047) | function findNonEmptyIndex(list) {
function isFlowToken (line 19060) | function isFlowToken(token) {
function getPrevProps (line 19072) | function getPrevProps(parent) {
function getFirstKeyStartProps (line 19088) | function getFirstKeyStartProps(prev) {
function fixFlowSeqItems (line 19107) | function fixFlowSeqItems(fc) {
method constructor (line 19131) | constructor(onNewLine) {
method parse (line 19151) | *parse(source, incomplete = false) {
method next (line 19162) | *next(source) {
method end (line 19209) | *end() {
method sourceToken (line 19213) | get sourceToken() {
method step (line 19222) | *step() {
method peek (line 19257) | peek(n4) {
method pop (line 19260) | *pop(error) {
method stream (line 19333) | *stream() {
method document (line 19364) | *document(doc) {
method scalar (line 19396) | *scalar(scalar) {
method blockScalar (line 19418) | *blockScalar(scalar) {
method blockMap (line 19444) | *blockMap(map2) {
method blockSequence (line 19639) | *blockSequence(seq2) {
method flowCollection (line 19697) | *flowCollection(fc) {
method flowScalar (line 19783) | flowScalar(type) {
method startBlockValue (line 19798) | startBlockValue(parent) {
method atIndentedComment (line 19856) | atIndentedComment(start, indent) {
method documentEnd (line 19863) | *documentEnd(docEnd) {
method lineEnd (line 19873) | *lineEnd(token) {
function parseOptions (line 19901) | function parseOptions(options) {
function parseAllDocuments (line 19906) | function parseAllDocuments(source, options = {}) {
function parseDocument (line 19920) | function parseDocument(source, options = {}) {
function parse (line 19939) | function parse(src, reviver, options) {
function stringify3 (line 19958) | function stringify3(value, replacer, options) {
function parse2 (line 19993) | function parse2(source) {
function stringify4 (line 20340) | function stringify4(value) {
function doStringify (line 20343) | function doStringify(value, level) {
function doKeyStringify (line 20390) | function doKeyStringify(key) {
function getIndent (line 20393) | function getIndent(level) {
FILE: build/vendor-extra.d.ts
type ErrnoException (line 8) | type ErrnoException = NodeJS.ErrnoException;
type StatAsynchronousMethod (line 9) | type StatAsynchronousMethod = (path: string, callback: (error: ErrnoExce...
type StatSynchronousMethod (line 10) | type StatSynchronousMethod = (path: string) => fs.Stats;
type FileSystemAdapter (line 11) | interface FileSystemAdapter {
type Entry (line 17) | interface Entry {
type Stats (line 23) | type Stats = fs.Stats;
type ErrnoException$1 (line 24) | type ErrnoException$1 = NodeJS.ErrnoException;
type Dirent (line 25) | interface Dirent {
type ReaddirAsynchronousMethod (line 35) | interface ReaddirAsynchronousMethod {
type ReaddirSynchronousMethod (line 41) | interface ReaddirSynchronousMethod {
type FileSystemAdapter$1 (line 47) | type FileSystemAdapter$1 = FileSystemAdapter & {
type Entry$1 (line 51) | type Entry$1 = Entry;
type Entry$2 (line 52) | type Entry$2 = Entry$1;
type Pattern (line 53) | type Pattern = string;
type FileSystemAdapter$2 (line 54) | type FileSystemAdapter$2 = FileSystemAdapter$1;
type Options (line 55) | type Options = {
type Task (line 190) | type Task = {
type EntryObjectModePredicate (line 197) | type EntryObjectModePredicate = {
type EntryStatsPredicate (line 200) | type EntryStatsPredicate = {
type EntryObjectPredicate (line 203) | type EntryObjectPredicate = EntryObjectModePredicate | EntryStatsPredicate;
type Entry (line 208) | type Entry = Entry$2;
type FileSystemAdapter (line 211) | type FileSystemAdapter = FileSystemAdapter$2;
type GlobEntry (line 232) | type GlobEntry = FastGlob.Entry;
type GlobTask (line 233) | type GlobTask = {
type ExpandDirectoriesOption (line 237) | type ExpandDirectoriesOption = boolean | readonly string[] | {
type FastGlobOptionsWithoutCwd (line 241) | type FastGlobOptionsWithoutCwd = Omit<FastGlob.Options, "cwd">;
type Options$1 (line 242) | type Options$1 = {
type GitignoreOptions (line 316) | type GitignoreOptions = {
type GlobbyFilterFunction (line 368) | type GlobbyFilterFunction = (path: URL | string) => boolean;
type AsyncIterableReadable (line 369) | type AsyncIterableReadable<Value> = Omit<NodeJS.ReadableStream, typeof S...
type GlobbyStream (line 372) | type GlobbyStream = AsyncIterableReadable<string>;
type GlobbyEntryStream (line 373) | type GlobbyEntryStream = AsyncIterableReadable<GlobEntry>;
type TCodeRef (line 408) | type TCodeRef = {
type TOptsNormalized (line 413) | type TOptsNormalized = {
type TOpts (line 419) | type TOpts = Partial<TOptsNormalized>;
type Opts (line 425) | interface Opts {
type ParsedArgs (line 462) | interface ParsedArgs {
type YAML (line 496) | interface YAML {
type Opts (line 557) | interface Opts extends minimist.Opts {
type ParsedArgs (line 559) | interface ParsedArgs extends minimist.ParsedArgs {
FILE: examples/fetch-weather.mjs
function main (line 17) | async function main() {
FILE: scripts/build-js.mjs
method transform (line 112) | transform(contents, file) {
method transform (line 127) | transform(contents) {
method transform (line 135) | transform(contents) {
method transform (line 151) | transform(contents) {
method setup (line 183) | setup(build) {
function digestLicenses (line 196) | function digestLicenses(dirs) {
function entryPointsToRegexp (line 234) | function entryPointsToRegexp(entryPoints) {
function escapeRegExp (line 242) | function escapeRegExp(str) {
FILE: scripts/deno.polyfill.js
method set (line 9) | set() { return true }
FILE: src/cli.ts
constant EXT (line 42) | const EXT = '.mjs'
constant EXT_RE (line 43) | const EXT_RE = /^\.[mc]?[jt]sx?$/
function autorun (line 59) | function autorun(meta: ImportMeta): void {
function printUsage (line 72) | function printUsage() {
function main (line 103) | async function main(): Promise<void> {
function runScript (line 143) | async function runScript(
function linkNodeModules (line 176) | function linkNodeModules(cwd: string, external: string): string {
function lstat (line 198) | function lstat(p: string) {
function readScript (line 204) | async function readScript() {
function readScriptFromStdin (line 247) | async function readScriptFromStdin(): Promise<string> {
function readScriptFromHttp (line 251) | async function readScriptFromHttp(remote: string): Promise<string> {
function injectGlobalRequire (line 261) | function injectGlobalRequire(origin: string): void {
function isMain (line 268) | function isMain(
function normalizeExt (line 285) | function normalizeExt(ext?: string): string | undefined {
function getFilepath (line 290) | function getFilepath(cwd = '.', name = 'zx', _ext?: string): string {
FILE: src/core.ts
constant CWD (line 69) | const CWD = Symbol('processCwd')
constant SYNC (line 70) | const SYNC = Symbol('syncExec')
constant EPF (line 71) | const EPF = Symbol('end-piped-from')
constant SHOT (line 72) | const SHOT = Symbol('snapshot')
constant EOL (line 73) | const EOL = Buffer.from(_EOL)
constant BR_CC (line 74) | const BR_CC = '\n'.charCodeAt(0)
constant DLMTR (line 75) | const DLMTR = /\r?\n/
constant SIGTERM (line 76) | const SIGTERM = 'SIGTERM'
constant ENV_PREFIX (line 77) | const ENV_PREFIX = 'ZX_'
constant ENV_OPTS (line 78) | const ENV_OPTS: Set<string> = new Set([
type Options (line 93) | interface Options {
type Snapshot (line 125) | type Snapshot = Options & {
function within (line 174) | function within<R>(callback: () => R): R {
method get (line 220) | get(t, key) {
method set (line 224) | set(t, key, value) {
method run (line 350) | async run(cb, ctx){
method if (line 419) | if (this.isSettled()) return
method if (line 483) | if (this.isSettled()) return this
method cwd (line 512) | get cwd(): string {
method cmd (line 516) | get cmd(): string {
method fullCmd (line 520) | get fullCmd(): string {
method child (line 525) | get child(): ChildProcess | undefined {
method stdin (line 529) | get stdin(): Writable {
method stdout (line 533) | get stdout(): Readable {
method stderr (line 537) | get stderr(): Readable {
method exitCode (line 541) | get exitCode(): Promise<number | null> {
method signal (line 548) | get signal(): AbortSignal {
method ac (line 552) | get ac(): AbortController {
method output (line 556) | get output(): ProcessOutput | null {
method stage (line 560) | get stage(): ProcessStage {
method sync (line 564) | get sync(): boolean {
method [Symbol.toStringTag] (line 568) | override get [Symbol.toStringTag](): string {
method [Symbol.toPrimitive] (line 572) | [Symbol.toPrimitive](): string {
method json (line 577) | json<T = any>(): Promise<T> {
method text (line 581) | text(encoding?: Encoding): Promise<string> {
method lines (line 585) | lines(delimiter?: Options['delimiter']): Promise<string[]> {
method buffer (line 589) | buffer(): Promise<Buffer> {
method blob (line 593) | blob(type?: string): Promise<Blob> {
method isQuiet (line 598) | isQuiet(): boolean {
method isVerbose (line 602) | isVerbose(): boolean {
method isNothrow (line 606) | isNothrow(): boolean {
method isHalted (line 610) | isHalted(): boolean {
method isSettled (line 614) | private isSettled(): boolean {
method isRunning (line 618) | private isRunning(): boolean {
method pipe (line 624) | get pipe(): PipeMethod & {
method unpipe (line 634) | unpipe(to?: PipeAcceptor): this {
method _pipe (line 640) | private _pipe(source: keyof TSpawnStore, dest: PipeDest, ...args: any[])...
method pipe (line 714) | pipe(from: ProcessPromise, to: PipeAcceptor) {
method unpipe (line 718) | unpipe(from: ProcessPromise, to?: PipeAcceptor) {
method unpipeBack (line 726) | unpipeBack(to: ProcessPromise, from?: ProcessPromise) {
method runBack (line 732) | runBack(p: PipeAcceptor) {
method sources (line 738) | sources(p: PipeAcceptor): PipeAcceptor[] {
method then (line 754) | then(res: any = noop, rej: any = noop) {
method run (line 763) | run() {
method pipe (line 766) | pipe(...args: any) {
method get (line 850) | get() {
method constructor (line 885) | constructor(
method exitCode (line 922) | get exitCode(): number | null {
method signal (line 926) | get signal(): NodeJS.Signals | null {
method duration (line 930) | get duration(): number {
method [Symbol.toStringTag] (line 934) | get [Symbol.toStringTag](): string {
method ok (line 938) | get ok(): boolean {
method json (line 942) | json<T = any>(): T {
method buffer (line 946) | buffer(): Buffer {
method blob (line 950) | blob(type = 'text/plain'): Blob {
method text (line 958) | text(encoding: Encoding = 'utf8'): string {
method lines (line 964) | lines(delimiter?: string | RegExp): string[] {
method toString (line 968) | override toString(): string {
method valueOf (line 972) | override valueOf(): string {
method [Symbol.toPrimitive] (line 976) | [Symbol.toPrimitive](): string {
method [Symbol.iterator] (line 980) | *[Symbol.iterator](dlmtr: Options['delimiter'] = this._dto.delimiter || ...
method [inspect.custom] (line 989) | [inspect.custom](): string {
method fromError (line 1008) | static fromError(error: Error): ProcessOutput {
FILE: src/deps.ts
function installDeps (line 26) | async function installDeps(
type DepsInstaller (line 48) | type DepsInstaller = (opts: {
function parseDeps (line 72) | function parseDeps(content: string): Record<string, string> {
function parsePackageName (line 88) | function parsePackageName(path?: string): string | undefined {
function parseVersion (line 95) | function parseVersion(line: string) {
FILE: src/error.ts
constant EXIT_CODES (line 15) | const EXIT_CODES: Record<number, string> = {
constant ERRNO_CODES (line 50) | const ERRNO_CODES: Record<number, string> = {
constant DOCS_URL (line 172) | const DOCS_URL = 'https://google.github.io/zx'
class Fail (line 174) | class Fail extends Error {
method formatExitMessage (line 179) | static formatExitMessage(
method formatErrorMessage (line 200) | static formatErrorMessage(err: NodeJS.ErrnoException, from: string): s...
method formatErrorDetails (line 207) | static formatErrorDetails(lines: string[] = [], lim = 20): string {
method getExitCodeInfo (line 217) | static getExitCodeInfo(exitCode: number | null): string | undefined {
method getCallerLocationFromString (line 221) | static getCallerLocationFromString(stackString = 'unknown'): string {
method getCallerLocation (line 235) | static getCallerLocation(err: Error = new Error('zx error')): string {
method getErrnoMessage (line 239) | static getErrnoMessage(errno?: number): string {
FILE: src/globals.ts
type ProcessPromise (line 20) | type ProcessPromise = _.ProcessPromise
type ProcessOutput (line 21) | type ProcessOutput = _.ProcessOutput
FILE: src/goods.ts
function tempdir (line 49) | function tempdir(
function tempfile (line 59) | function tempfile(
type ArgvOpts (line 76) | type ArgvOpts = minimist.Opts & { camelCase?: boolean; parseBoolean?: bo...
function updateArgv (line 94) | function updateArgv(args?: string[], opts?: ArgvOpts) {
function sleep (line 101) | function sleep(duration: Duration): Promise<void> {
function fetch (line 120) | function fetch(
function echo (line 151) | function echo(pieces: TemplateStringsArray, ...args: any[]) {
function stringify (line 159) | function stringify(arg: any) {
function question (line 163) | async function question(
function stdin (line 197) | async function stdin(stream: Readable = process.stdin): Promise<string> {
function retry (line 211) | async function retry<T>(
function spinner (line 266) | async function spinner<T>(
FILE: src/index.ts
constant VERSION (line 32) | const VERSION: string = versions.zx || '0.0.0'
function nothrow (line 38) | function nothrow(promise: ProcessPromise): ProcessPromise {
function quiet (line 45) | function quiet(promise: ProcessPromise): ProcessPromise {
FILE: src/internals.ts
type TCallable (line 15) | type TCallable = (...args: any[]) => any
function wrap (line 22) | function wrap<T extends object>(name: string, api: T): T {
FILE: src/log.ts
type LogEntry (line 20) | type LogEntry = {
type LogFormatters (line 75) | type LogFormatters = {
method cmd (line 82) | cmd({ cmd }) {
method stdout (line 85) | stdout({ data }) {
method stderr (line 88) | stderr({ data }) {
method custom (line 91) | custom({ data }) {
method fetch (line 94) | fetch(entry) {
method cd (line 98) | cd(entry) {
method retry (line 101) | retry(entry) {
method end (line 107) | end() {
method kill (line 110) | kill() {
type Log (line 115) | type Log = {
constant SPACE_RE (line 132) | const SPACE_RE = /\s/
constant SYNTAX (line 133) | const SYNTAX = '()[]{}<>;:+|&='
constant CMD_BREAK (line 134) | const CMD_BREAK = '|&;><'
constant RESERVED_WORDS (line 135) | const RESERVED_WORDS = new Set([
function formatCmd (line 153) | function formatCmd(cmd: string): string {
FILE: src/md.ts
function transformMarkdown (line 18) | function transformMarkdown(buf: Buffer | string): string {
FILE: src/repl.ts
constant HISTORY (line 20) | const HISTORY =
function startRepl (line 23) | async function startRepl(history = HISTORY) {
FILE: src/util.ts
function noop (line 22) | function noop() {}
function identity (line 24) | function identity<T>(v: T): T {
function randomId (line 28) | function randomId() {
function isString (line 32) | function isString(obj: any) {
function preferLocalBin (line 46) | function preferLocalBin(
function quote (line 75) | function quote(arg: string): string {
function quotePowerShell (line 94) | function quotePowerShell(arg: string): string {
type Duration (line 101) | type Duration =
function parseDuration (line 108) | function parseDuration(d: Duration) {
method get (line 132) | get(target: any, key) {
FILE: src/vendor-core.ts
type RequestInfo (line 28) | type RequestInfo = Parameters<typeof globalThis.fetch>[0]
type RequestInit (line 29) | type RequestInit = Parameters<typeof globalThis.fetch>[1] & {
FILE: src/vendor-extra.ts
type YAML (line 73) | interface YAML {
constant YAML (line 129) | const YAML: typeof _YAML = wrap('YAML', _YAML)
constant MAML (line 130) | const MAML: typeof _maml = wrap('MAML', _maml)
type Opts (line 136) | interface Opts extends _minimist.Opts {}
type ParsedArgs (line 137) | interface ParsedArgs extends _minimist.ParsedArgs {}
FILE: test/bench/buf-join.mjs
constant STR (line 17) | const STR = 'a'.repeat(1024)
constant BUF (line 18) | const BUF = Buffer.from(STR)
constant BUF_ARR (line 19) | const BUF_ARR = new Array(128).fill(null).map(() => Buffer.from(STR))
constant STR_ARR (line 20) | const STR_ARR = new Array(128).fill(STR)
method buf_arr_map_decode_join (line 24) | buf_arr_map_decode_join() {
method buf_arr_reduce_decode (line 27) | buf_arr_reduce_decode() {
method buf_arr_reduce_to_string (line 30) | buf_arr_reduce_to_string() {
method buf_arr_for_decode (line 33) | buf_arr_for_decode() {
method buf_arr_while_decode (line 39) | buf_arr_while_decode() {
method buf_arr_join (line 48) | buf_arr_join() {
method buf_arr_concat_decode (line 51) | buf_arr_concat_decode() {
method str_arr_join (line 54) | str_arr_join() {
method str_arr_reduce (line 57) | str_arr_reduce() {
FILE: test/core.test.js
method spawn (line 336) | spawn() {
method transform (line 745) | transform(chunk, encoding, callback) {
method spawn (line 1196) | spawn() {
method toString (line 1675) | toString() {
function yes (line 1689) | function yes() {
FILE: test/goods.test.ts
function zx (line 44) | function zx(script) {
class Input (line 51) | class Input extends Duplex {
method constructor (line 52) | constructor() {
method _read (line 55) | _read() {}
method _write (line 56) | _write(chunk, encoding, callback) {
method _final (line 60) | _final() {
FILE: test/log.test.ts
method write (line 23) | write(s: string) {
Condensed preview — 168 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,389K chars).
[
{
"path": ".commitlintrc",
"chars": 327,
"preview": "{\n \"extends\": [\n \"@commitlint/config-conventional\"\n ],\n \"rules\": {\n \"type-enum\": [\n 2,\n \"always\",\n "
},
{
"path": ".gitattributes",
"chars": 70,
"preview": "test/fixtures/markdown-crlf.md eol=crlf\nbuild/** linguist-language=txt"
},
{
"path": ".github/FUNDING.yml",
"chars": 18,
"preview": "github: antonmedv\n"
},
{
"path": ".github/ISSUE_TEMPLATE/bug.yml",
"chars": 2255,
"preview": "name: Bug Report\ndescription: File a bug report.\ntitle: '[Bug]: '\nlabels: ['bug']\nassignees:\n - antongolub\nbody:\n - ty"
},
{
"path": ".github/ISSUE_TEMPLATE/idea.yml",
"chars": 883,
"preview": "name: Feature Request\ndescription: Idea, feature request or proposal.\ntitle: '[Idea]: '\nlabels: ['feature']\nassignees:\n "
},
{
"path": ".github/PULL_REQUEST_TEMPLATE.md",
"chars": 996,
"preview": "<!-- It's a good idea to open an issue first for discussion. -->\n\nFixes #issue / suggests an improvement\n\n<!-- Usage dem"
},
{
"path": ".github/SECURITY.md",
"chars": 1104,
"preview": "# Security Policy\n\n## Supported Versions\n| Version | Status | Comment "
},
{
"path": ".github/codeql/codeql-config.yml",
"chars": 113,
"preview": "paths:\n - .github\n - docs\n - examples\n - man\n - src\n - scripts\n - test\n - test-d\npaths-ignore:\n - build\n"
},
{
"path": ".github/pages/index.html",
"chars": 16,
"preview": "Here be dragons\n"
},
{
"path": ".github/workflows/codeql.yml",
"chars": 1616,
"preview": "name: 'CodeQL Advanced'\n\non:\n push:\n branches: ['main']\n pull_request:\n branches: ['main']\n schedule:\n - cro"
},
{
"path": ".github/workflows/dev-publish.yml",
"chars": 7639,
"preview": "name: Dev Publish\n\non:\n workflow_dispatch:\n\npermissions: {}\n\nenv:\n npm_config_audit: false\n npm_config_fund: false\n\nj"
},
{
"path": ".github/workflows/docs.yml",
"chars": 1110,
"preview": "name: Deploy docs\non:\n workflow_dispatch:\n release:\n types: [created]\n\nconcurrency:\n group: 'pages'\n cancel-in-pr"
},
{
"path": ".github/workflows/jsr-publish.yml",
"chars": 1352,
"preview": "name: JSR Manual Publish\n\non:\n workflow_dispatch:\n\npermissions: {}\n\njobs:\n build:\n runs-on: ubuntu-latest\n steps"
},
{
"path": ".github/workflows/osv.yml",
"chars": 1528,
"preview": "# This workflow uses actions that are not certified by GitHub.\n# They are provided by a third-party and are governed by\n"
},
{
"path": ".github/workflows/publish.yml",
"chars": 5708,
"preview": "name: Publish\n\non:\n workflow_dispatch:\n release:\n types: [created]\n\npermissions: {}\n\nenv:\n npm_config_audit: false"
},
{
"path": ".github/workflows/test.yml",
"chars": 7139,
"preview": "name: Test\n\non:\n push:\n pull_request:\n schedule:\n - cron: '0 12 */4 * *'\n\npermissions:\n contents: read\n\nenv:\n np"
},
{
"path": ".github/workflows/zizmor.yml",
"chars": 629,
"preview": "name: Zizmor\n\non:\n push:\n branches: ['main']\n pull_request:\n branches: ['**']\n\npermissions: {}\n\njobs:\n zizmor:\n"
},
{
"path": ".gitignore",
"chars": 179,
"preview": "node_modules/\ncoverage/\npackage/\nreports/\ndocs/.vitepress/cache/\nyarn.lock\npnpm-lock.yaml\ntemp\ntest/fixtures/ts-project/"
},
{
"path": ".node_version",
"chars": 2,
"preview": "24"
},
{
"path": ".nycrc",
"chars": 330,
"preview": "{\n \"reporter\": [\"html\", \"text\"],\n \"lines\": 98,\n \"branches\": \"90\",\n \"statements\": \"98\",\n \"exclude\": [\n \"build/den"
},
{
"path": ".prettierignore",
"chars": 82,
"preview": "node_modules/\nbuild/\ncoverage/\npackage/\nreports/\npackage-lock.json\nyarn.lock\n*.md\n"
},
{
"path": ".size-limit.json",
"chars": 1409,
"preview": "[\n {\n \"name\": \"zx-lite\",\n \"path\": [\n \"build/3rd-party-licenses\",\n \"build/core.cjs\",\n \"build/core.d"
},
{
"path": "LICENSE",
"chars": 11358,
"preview": "\n Apache License\n Version 2.0, January 2004\n "
},
{
"path": "README.md",
"chars": 1733,
"preview": "<h1><img src=\"https://google.github.io/zx/img/logo.svg\" alt=\"Zx logo\" height=\"32\" width=\"28\" valign=\"middle\"> zx</h1>\n\n`"
},
{
"path": "build/3rd-party-licenses",
"chars": 3033,
"preview": "THIRD PARTY LICENSES\n\n@nodelib/fs.scandir@2.1.5\n <unknown>\n https://github.com/nodelib/nodelib/tree/master/packages/fs"
},
{
"path": "build/cli.cjs",
"chars": 12815,
"preview": "#!/usr/bin/env node\n\"use strict\";\nconst {\n __export,\n __toESM,\n __toCommonJS,\n __async\n} = require('./esblib.cjs');\n"
},
{
"path": "build/cli.d.ts",
"chars": 546,
"preview": "#!/usr/bin/env node\nimport { type minimist } from './vendor.js';\nexport { transformMarkdown } from './md.js';\nexport dec"
},
{
"path": "build/cli.js",
"chars": 421,
"preview": "#!/usr/bin/env node\n\"use strict\";\nimport \"./deno.js\"\nimport * as __module__ from \"./cli.cjs\"\nconst {\n argv,\n autorun,\n"
},
{
"path": "build/core.cjs",
"chars": 35439,
"preview": "\"use strict\";\nconst {\n __spreadValues,\n __spreadProps,\n __export,\n __toESM,\n __toCommonJS,\n __async,\n __await,\n "
},
{
"path": "build/core.d.ts",
"chars": 7581,
"preview": "/// <reference types=\"node\" />\n/// <reference types=\"fs-extra\" />\n\nimport { Buffer } from 'node:buffer';\nimport cp, { ty"
},
{
"path": "build/core.js",
"chars": 640,
"preview": "\"use strict\";\nimport \"./deno.js\"\nimport * as __module__ from \"./core.cjs\"\nconst {\n $,\n Fail,\n ProcessOutput,\n Proces"
},
{
"path": "build/deno.js",
"chars": 701,
"preview": "import { createRequire } from 'node:module'\nimport * as process from 'node:process'\n\n// prettier-ignore\nif (globalThis.D"
},
{
"path": "build/deps.cjs",
"chars": 2643,
"preview": "\"use strict\";\nconst {\n __export,\n __toCommonJS,\n __async\n} = require('./esblib.cjs');\n\n\n// src/deps.ts\nvar deps_expor"
},
{
"path": "build/deps.d.ts",
"chars": 530,
"preview": "/**\n * Install npm dependencies\n * @param dependencies object of dependencies\n * @param prefix path to the directory wh"
},
{
"path": "build/error.d.ts",
"chars": 704,
"preview": "export declare class Fail extends Error {\n static DOCS_URL: string;\n static EXIT_CODES: Record<number, string>;\n "
},
{
"path": "build/esblib.cjs",
"chars": 6579,
"preview": "\nvar __create = Object.create;\n\nvar __defProp = Object.defineProperty;\n\nvar __getOwnPropDesc = Object.getOwnPropertyDesc"
},
{
"path": "build/globals.cjs",
"chars": 154,
"preview": "\"use strict\";\nconst {\n __toESM\n} = require('./esblib.cjs');\n\n\n// src/globals.ts\nvar _ = __toESM(require(\"./index.cjs\"),"
},
{
"path": "build/globals.d.ts",
"chars": 1656,
"preview": "import * as _ from './index.js';\ndeclare global {\n type ProcessPromise = _.ProcessPromise;\n type ProcessOutput = _"
},
{
"path": "build/globals.js",
"chars": 170,
"preview": "\"use strict\";\nimport \"./deno.js\"\nimport * as __module__ from \"./globals.cjs\"\nconst {\n\n} = globalThis.Deno ? globalThis.r"
},
{
"path": "build/goods.d.ts",
"chars": 1910,
"preview": "import { Buffer } from 'node:buffer';\nimport { Readable } from 'node:stream';\nimport { type Mode } from 'node:fs';\nimpor"
},
{
"path": "build/index.cjs",
"chars": 8596,
"preview": "\"use strict\";\nconst {\n __pow,\n __export,\n __reExport,\n __toESM,\n __toCommonJS,\n __async,\n __forAwait\n} = require("
},
{
"path": "build/index.d.ts",
"chars": 585,
"preview": "/// <reference types=\"node\" />\n/// <reference types=\"fs-extra\" />\n\nimport { type ProcessPromise } from './core.js';\nexpo"
},
{
"path": "build/index.js",
"chars": 1194,
"preview": "\"use strict\";\nimport \"./deno.js\"\nimport * as __module__ from \"./index.cjs\"\nconst {\n MAML,\n VERSION,\n YAML,\n argv,\n "
},
{
"path": "build/internals.cjs",
"chars": 904,
"preview": "\"use strict\";\nconst {\n __export,\n __toCommonJS\n} = require('./esblib.cjs');\n\n\n// src/internals.ts\nvar internals_export"
},
{
"path": "build/internals.d.ts",
"chars": 261,
"preview": "declare function wrap<T extends object>(name: string, api: T): T;\n/**\n * @internal\n * @private\n * @protected\n */\nexport "
},
{
"path": "build/log.d.ts",
"chars": 1228,
"preview": "import { type RequestInfo, type RequestInit } from './vendor-core.js';\nimport { type Buffer } from 'node:buffer';\nexport"
},
{
"path": "build/md.d.ts",
"chars": 116,
"preview": "import { type Buffer } from 'node:buffer';\nexport declare function transformMarkdown(buf: Buffer | string): string;\n"
},
{
"path": "build/util.cjs",
"chars": 3957,
"preview": "\"use strict\";\nconst {\n __spreadValues,\n __spreadProps,\n __export,\n __toESM,\n __toCommonJS\n} = require('./esblib.cjs"
},
{
"path": "build/util.d.ts",
"chars": 1535,
"preview": "import { type Buffer } from 'node:buffer';\nimport { type TSpawnStore } from './vendor-core.js';\nexport { isStringLiteral"
},
{
"path": "build/vendor-core.cjs",
"chars": 43165,
"preview": "\"use strict\";\nconst {\n __create,\n __spreadValues,\n __spreadProps,\n __commonJS,\n __export,\n __toESM,\n __toCommonJS"
},
{
"path": "build/vendor-core.d.ts",
"chars": 9973,
"preview": "// Generated by dts-bundle-generator v9.5.1\n\n/// <reference types=\"node\" />\n\nimport { Buffer } from 'node:buffer';\nimpor"
},
{
"path": "build/vendor-extra.cjs",
"chars": 732225,
"preview": "\"use strict\";\nconst {\n __spreadValues,\n __spreadProps,\n __esm,\n __commonJS,\n __export,\n __toESM,\n __toCommonJS,\n "
},
{
"path": "build/vendor-extra.d.ts",
"chars": 17715,
"preview": "// Generated by dts-bundle-generator v9.5.1\n\n/// <reference types=\"node\" />\n\nimport * as fs from 'fs';\nimport { URL as U"
},
{
"path": "build/vendor.cjs",
"chars": 505,
"preview": "\"use strict\";\nconst {\n __reExport,\n __toCommonJS\n} = require('./esblib.cjs');\n\n\n// src/vendor.ts\nvar vendor_exports = "
},
{
"path": "build/vendor.d.ts",
"chars": 136,
"preview": "/// <reference types=\"node\" />\n/// <reference types=\"fs-extra\" />\n\nexport * from './vendor-core.js';\nexport * from './ve"
},
{
"path": "build/versions.d.ts",
"chars": 55,
"preview": "export declare const versions: Record<string, string>;\n"
},
{
"path": "dcr/Dockerfile",
"chars": 213,
"preview": "FROM node:24-alpine\n\nRUN apk add --no-cache bash\n\nCOPY ../build /zx/build\nCOPY ../package.json /zx/package.json\nCOPY ../"
},
{
"path": "docs/.gitignore",
"chars": 16,
"preview": "/cache/\n/build/\n"
},
{
"path": "docs/.vitepress/config.mts",
"chars": 2869,
"preview": "import { defineConfig } from 'vitepress'\n\n// https://vitepress.dev/reference/site-config\nexport default defineConfig({\n "
},
{
"path": "docs/.vitepress/theme/MyLayout.vue",
"chars": 253,
"preview": "<script setup>\nimport DefaultTheme from 'vitepress/theme'\nimport MyOxygen from './MyOxygen.vue'\n\nconst { Layout } = Defa"
},
{
"path": "docs/.vitepress/theme/MyOxygen.vue",
"chars": 1070,
"preview": "<template>\n <!-- <div class=\"Oxygen\">-->\n <!-- <a href=\"https://webpod.dev/?from=zx-site\">-->\n <!-- <!&nd"
},
{
"path": "docs/.vitepress/theme/custom.css",
"chars": 524,
"preview": ":root {\n --vp-home-hero-name-color: transparent;\n --vp-home-hero-name-background: -webkit-linear-gradient(\n 120deg,"
},
{
"path": "docs/.vitepress/theme/index.js",
"chars": 240,
"preview": "import DefaultTheme from 'vitepress/theme'\nimport MyLayout from './MyLayout.vue'\nimport './custom.css'\n\nexport default {"
},
{
"path": "docs/api.md",
"chars": 9907,
"preview": "# API Reference\n\n## `$.sync`\nZx provides both synchronous and asynchronous command executions, returns [`ProcessOutput`]"
},
{
"path": "docs/architecture.md",
"chars": 12252,
"preview": "# The zx architecture\nThis section helps to better understand the `zx` concepts and logic, and will be useful for those "
},
{
"path": "docs/cli.md",
"chars": 4319,
"preview": "# CLI Usage\n\nZx provides a CLI for running scripts. It comes with the package and can be used as `zx` executable (if ref"
},
{
"path": "docs/configuration.md",
"chars": 3967,
"preview": "# Configuration\n\n## `$.shell`\n\nSpecifies what shell is used. Default is `which bash`.\n\n```js\n$.shell = '/usr/bin/bash'\n`"
},
{
"path": "docs/contribution.md",
"chars": 3170,
"preview": "# Contribution Guide\n\nzx is a fully [open-source project](https://github.com/google/zx), which is developing by the comm"
},
{
"path": "docs/faq.md",
"chars": 2843,
"preview": "# FAQ\n\n## Passing env variables\n\n```js\nprocess.env.FOO = 'bar'\nawait $`echo $FOO`\n```\n\n## Passing array of values\n\nWhen "
},
{
"path": "docs/getting-started.md",
"chars": 3211,
"preview": "# Getting Started\n\n## Overview\n\n```js\n#!/usr/bin/env zx\n\nawait $`cat package.json | grep name`\n\nconst branch = await $`g"
},
{
"path": "docs/index.md",
"chars": 556,
"preview": "---\n# https://vitepress.dev/reference/default-theme-home-page\nlayout: home\ntitleTemplate: google/zx\n\nhero:\n name: \"zx\"\n"
},
{
"path": "docs/known-issues.md",
"chars": 987,
"preview": "# Known Issues\n\n## Output gets truncated\n\nThis is a known issue with `console.log()` (see [nodejs/node#6379](https://git"
},
{
"path": "docs/lite.md",
"chars": 623,
"preview": "# zx@lite\n\nJust core functions without extras:\n* ~7x smaller than the full version\n* No CLI, no docs, no manpage assets "
},
{
"path": "docs/markdown.md",
"chars": 1401,
"preview": "# Markdown Scripts\n\nImagine a script with code blocks, formatted comments, schemas, illustrations, etc. [Markdown](https"
},
{
"path": "docs/migration-from-v7.md",
"chars": 1807,
"preview": "# Migration from v7 to v8\n\n[v8.0.0 release](https://github.com/google/zx/releases/tag/8.0.0) brought many features, impr"
},
{
"path": "docs/process-output.md",
"chars": 826,
"preview": "# Process Output\n\nRepresents a cmd execution result.\n\n```ts\nconst p = $`command` // ProcessPromise\nconst o = await p "
},
{
"path": "docs/process-promise.md",
"chars": 9467,
"preview": "# Process Promise\n\nThe `$` returns a `ProcessPromise` instance, which inherits native `Promise`. When resolved, it becom"
},
{
"path": "docs/quotes.md",
"chars": 2460,
"preview": "# Quotes\n\nBash supports various ways to quote arguments: single quotes, double quotes, and a bash-specific method using "
},
{
"path": "docs/setup.md",
"chars": 5223,
"preview": "# Setup\n\n## Requirements\n* Linux, macOS, or Windows\n* JavaScript Runtime:\n * Node.js >= 12.17.0\n * Bun >= 1.0.0\n * De"
},
{
"path": "docs/shell.md",
"chars": 1504,
"preview": "# Shell\n\n[Bash](https://en.wikipedia.org/wiki/Bash_(Unix_shell)) is a fundamental part of the Unix ecosystem, and it is "
},
{
"path": "docs/typescript.md",
"chars": 1549,
"preview": "# TypeScript\n\nzx is written in TypeScript and provides the corresponding libdefs out of the box. Types are TS 4+ compati"
},
{
"path": "docs/versions.md",
"chars": 1956,
"preview": "# Versions\n\nzx is distributed in several versions, each with its own set of features.\n\n* `@latest` represents the stable"
},
{
"path": "examples/background-process.mjs",
"chars": 792,
"preview": "#!/usr/bin/env zx\n\n// Copyright 2021 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n//"
},
{
"path": "examples/backup-github.mjs",
"chars": 1222,
"preview": "#!/usr/bin/env zx\n\n// Copyright 2021 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n//"
},
{
"path": "examples/fetch-weather.mjs",
"chars": 2933,
"preview": "#!/usr/bin/env zx\n\n// Copyright 2021 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n//"
},
{
"path": "examples/hello.mjs",
"chars": 650,
"preview": "#!/usr/bin/env zx\n\n// Copyright 2026 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n//"
},
{
"path": "examples/interactive.mjs",
"chars": 1333,
"preview": "#!/usr/bin/env zx\n\n// Copyright 2021 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n//"
},
{
"path": "examples/parallel.mjs",
"chars": 989,
"preview": "#!/usr/bin/env zx\n\n// Copyright 2021 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n//"
},
{
"path": "lefthook.yml",
"chars": 388,
"preview": "pre-commit:\n parallel: true\n commands:\n format:\n glob: '*.{js,ts,md,yml,yaml}'\n run: npm run fmt && git a"
},
{
"path": "man/zx.1",
"chars": 1027,
"preview": ".\\\" Manpage for zx.\n.TH man 8 \"06 Jul 2024\" \"8.x\" \"zx man page\"\n.SH NAME\nzx \\- the zx CLI\n.SH DESCRIPTION\nA tool for wri"
},
{
"path": "package.json",
"chars": 6525,
"preview": "{\n \"name\": \"zx\",\n \"version\": \"8.9.0\",\n \"description\": \"A tool for writing better scripts\",\n \"type\": \"module\",\n \"mai"
},
{
"path": "scripts/build-clean.mjs",
"chars": 930,
"preview": "#!/usr/bin/env node\n\n// Copyright 2025 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "scripts/build-dts.mjs",
"chars": 3808,
"preview": "#!/usr/bin/env node\n\n// Copyright 2024 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "scripts/build-js.mjs",
"chars": 7862,
"preview": "#!/usr/bin/env node\n\n// Copyright 2024 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "scripts/build-jsr.mjs",
"chars": 2165,
"preview": "// Copyright 2024 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "scripts/build-pkgjson-lite.mjs",
"chars": 2441,
"preview": "// Copyright 2024 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "scripts/build-pkgjson-main.mjs",
"chars": 1451,
"preview": "// Copyright 2024 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "scripts/build-tests.mjs",
"chars": 1996,
"preview": "#!/usr/bin/env node\n\n// Copyright 2024 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "scripts/build-versions.mjs",
"chars": 2030,
"preview": "#!/usr/bin/env node\n\n// Copyright 2025 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "scripts/deno.polyfill.js",
"chars": 701,
"preview": "import { createRequire } from 'node:module'\nimport * as process from 'node:process'\n\n// prettier-ignore\nif (globalThis.D"
},
{
"path": "scripts/import-meta-url.polyfill.js",
"chars": 228,
"preview": "const import_meta_url =\n typeof document === 'undefined'\n ? new (require('url').URL)('file:' + __filename).href\n "
},
{
"path": "src/cli.ts",
"chars": 8403,
"preview": "#!/usr/bin/env node\n\n// Copyright 2021 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "src/core.ts",
"chars": 29145,
"preview": "// Copyright 2021 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "src/deps.ts",
"chars": 3042,
"preview": "// Copyright 2021 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "src/error.ts",
"chars": 7733,
"preview": "// Copyright 2024 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "src/globals-jsr.ts",
"chars": 650,
"preview": "// Copyright 2025 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "src/globals.ts",
"chars": 2182,
"preview": "// Copyright 2022 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "src/goods.ts",
"chars": 7269,
"preview": "// Copyright 2022 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "src/index.ts",
"chars": 1235,
"preview": "// Copyright 2022 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "src/internals.ts",
"chars": 1255,
"preview": "// Copyright 2025 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "src/log.ts",
"chars": 4735,
"preview": "// Copyright 2025 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "src/md.ts",
"chars": 2757,
"preview": "// Copyright 2025 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "src/repl.ts",
"chars": 1244,
"preview": "// Copyright 2022 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "src/util.ts",
"chars": 4168,
"preview": "// Copyright 2022 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "src/vendor-core.ts",
"chars": 1235,
"preview": "// Copyright 2024 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "src/vendor-extra.ts",
"chars": 3837,
"preview": "// Copyright 2024 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "src/vendor.ts",
"chars": 656,
"preview": "// Copyright 2024 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "src/versions.ts",
"chars": 836,
"preview": "// Copyright 2026 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/all.test.js",
"chars": 882,
"preview": "// Copyright 2022 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/bench/buf-join.mjs",
"chars": 1663,
"preview": "// Copyright 2025 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/cli.test.js",
"chars": 14403,
"preview": "// Copyright 2022 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/core.test.js",
"chars": 52406,
"preview": "// Copyright 2021 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/deps.test.js",
"chars": 5937,
"preview": "// Copyright 2021 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/error.test.ts",
"chars": 4505,
"preview": "// Copyright 2024 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/export.test.js",
"chars": 37067,
"preview": "// Copyright 2026 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/extra.test.js",
"chars": 1437,
"preview": "// Copyright 2022 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/fixtures/argv.mjs",
"chars": 768,
"preview": "#!/usr/bin/env zx\n\n// Copyright 2021 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n//"
},
{
"path": "test/fixtures/copyright.txt",
"chars": 588,
"preview": "// Copyright YEAR Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/fixtures/echo.http",
"chars": 101,
"preview": "HTTP/1.1 200 OK\r\nContent-Type: text/javascript; charset=UTF-8\r\nContent-Length: 14\r\n\r\n$`echo 'test'`\r\n"
},
{
"path": "test/fixtures/exit-code.mjs",
"chars": 611,
"preview": "// Copyright 2021 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/fixtures/filename-dirname.mjs",
"chars": 737,
"preview": "// Copyright 2022 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/fixtures/interactive.mjs",
"chars": 806,
"preview": "#!/usr/bin/env zx\n\n// Copyright 2021 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n//"
},
{
"path": "test/fixtures/js-project/package.json",
"chars": 93,
"preview": "{\n \"private\": true,\n \"type\": \"module\",\n \"dependencies\": {\n \"zx\": \"file:../../..\"\n }\n}\n"
},
{
"path": "test/fixtures/js-project/script.js",
"chars": 607,
"preview": "// Copyright 2022 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/fixtures/markdown-crlf.md",
"chars": 31,
"preview": "```js\r\necho`Hello, world!`\r\n```"
},
{
"path": "test/fixtures/markdown.md",
"chars": 361,
"preview": "# Markdown\n\nignore\n\n>\n> ```\n> echo ignore\n> ```\n\n```js\nawait $`whoami`\nawait $`echo ${__dirname}`\n```\n\n~~~js\nawait $`ech"
},
{
"path": "test/fixtures/md.http",
"chars": 132,
"preview": "HTTP/1.1 200 OK\r\nContent-Type: plain/text; charset=UTF-8\r\nContent-Length: 15\r\nServer: netcat!\r\n\r\n# Title\r\n```js\r\n$`echo "
},
{
"path": "test/fixtures/no-extension",
"chars": 780,
"preview": "#!/usr/bin/env zx\n\n// Copyright 2021 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n//"
},
{
"path": "test/fixtures/no-extension.mjs",
"chars": 668,
"preview": "// Copyright 2022 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/fixtures/non-std-ext.zx",
"chars": 776,
"preview": "#!/usr/bin/env zx\n\n// Copyright 2024 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n//"
},
{
"path": "test/fixtures/require.mjs",
"chars": 751,
"preview": "// Copyright 2022 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/fixtures/server.mjs",
"chars": 1220,
"preview": "// Copyright 2025 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/fixtures/ts-project/package.json",
"chars": 121,
"preview": "{\n \"private\": true,\n \"type\": \"module\",\n \"dependencies\": {\n \"typescript\": \"^5.0.0\",\n \"zx\": \"file:../../..\"\n }\n}"
},
{
"path": "test/fixtures/ts-project/script.ts",
"chars": 700,
"preview": "// Copyright 2022 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/fixtures/ts-project/tsconfig.json",
"chars": 226,
"preview": "{\n \"compilerOptions\": {\n \"outDir\": \"./build\",\n \"target\": \"es2021\",\n \"module\": \"nodenext\",\n \"moduleResolutio"
},
{
"path": "test/global.test.js",
"chars": 1264,
"preview": "// Copyright 2021 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/goods.test.ts",
"chars": 12481,
"preview": "// Copyright 2021 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/index.test.js",
"chars": 2317,
"preview": "// Copyright 2024 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/it/build-dcr.test.js",
"chars": 1095,
"preview": "// Copyright 2025 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/it/build-jsr.test.js",
"chars": 1598,
"preview": "// Copyright 2024 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/it/build-npm.test.js",
"chars": 8521,
"preview": "// Copyright 2024 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/log.test.ts",
"chars": 5891,
"preview": "// Copyright 2025 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/md.test.ts",
"chars": 2597,
"preview": "// Copyright 2025 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/smoke/bun.test.js",
"chars": 1855,
"preview": "// Copyright 2024 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/smoke/deno.test.js",
"chars": 1003,
"preview": "// Copyright 2024 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/smoke/node.test.cjs",
"chars": 923,
"preview": "// Copyright 2024 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/smoke/node.test.mjs",
"chars": 2777,
"preview": "// Copyright 2024 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/smoke/ts.test.ts",
"chars": 1024,
"preview": "// Copyright 2024 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/smoke/tsconfig.json",
"chars": 323,
"preview": "{\n \"compilerOptions\": {\n \"target\": \"ES2021\",\n \"lib\": [\"ES2021\"],\n \"moduleResolution\": \"NodeNext\",\n \"module\""
},
{
"path": "test/smoke/tsconfig.test.json",
"chars": 241,
"preview": "{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"module\": \"node16\",\n \"esModuleInterop\": true,\n \"rootD"
},
{
"path": "test/smoke/win32.test.js",
"chars": 3409,
"preview": "// Copyright 2021 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/util.test.js",
"chars": 3959,
"preview": "// Copyright 2022 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test/vendor.test.js",
"chars": 2558,
"preview": "// Copyright 2024 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test-d/core.test-d.ts",
"chars": 2478,
"preview": "// Copyright 2022 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test-d/globals.test-d.ts",
"chars": 1005,
"preview": "// Copyright 2022 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "test-d/goods.test-d.ts",
"chars": 1012,
"preview": "// Copyright 2022 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
},
{
"path": "tsconfig.json",
"chars": 436,
"preview": "{\n \"compilerOptions\": {\n \"target\": \"ES2021\",\n \"lib\": [\"ES2021\"],\n \"rootDir\": \"./src\",\n \"moduleResolution\": "
},
{
"path": "zizmor.yml",
"chars": 145,
"preview": "rules:\n unpinned-uses:\n config:\n policies:\n '*': hash-pin\n 'actions/*': ref-pin\n 'github/c"
}
]
About this extraction
This page contains the full source code of the google/zx GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 168 files (1.3 MB), approximately 355.9k tokens, and a symbol index with 904 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.