diff --git a/.github/linters/.yaml-lint.yml b/.github/linters/.yaml-lint.yml
index fbf13559..a8ac7857 100644
--- a/.github/linters/.yaml-lint.yml
+++ b/.github/linters/.yaml-lint.yml
@@ -5,5 +5,8 @@ ignore:
- "**/tests/charts/**"
rules:
+ # Match Prettier, which formats inline comments with one separating space.
+ comments:
+ min-spaces-from-content: 1
line-length:
max: 170
diff --git a/.github/linters/actionlint.yml b/.github/linters/actionlint.yml
new file mode 100644
index 00000000..3e2774fa
--- /dev/null
+++ b/.github/linters/actionlint.yml
@@ -0,0 +1,15 @@
+# FIXME: Remove this scoped exception when Actionlint supports code-quality.
+# https://github.com/rhysd/actionlint/pull/674
+paths:
+ .github/workflows/__main-ci.yml:
+ ignore:
+ - ^unknown permission scope "code-quality"\.
+ .github/workflows/__pull-request-ci.yml:
+ ignore:
+ - ^unknown permission scope "code-quality"\.
+ .github/workflows/__release.yml:
+ ignore:
+ - ^unknown permission scope "code-quality"\.
+ .github/workflows/__shared-ci.yml:
+ ignore:
+ - ^unknown permission scope "code-quality"\.
diff --git a/.github/workflows/__commit-action-distributions.yml b/.github/workflows/__commit-action-distributions.yml
index dd0acb04..059b1515 100644
--- a/.github/workflows/__commit-action-distributions.yml
+++ b/.github/workflows/__commit-action-distributions.yml
@@ -2,21 +2,21 @@ name: Internal - Commit action distributions
on: # zizmor: ignore[dangerous-triggers] Trusted writer validates origin, actor, PR head and paths; it never executes PR code.
workflow_run:
- workflows: [Internal - Rebuild action distributions]
+ workflows: [Internal - Pull request - Continuous Integration]
types: [completed]
permissions: {}
jobs:
distributions:
- uses: hoverkraft-tech/ci-github-common/.github/workflows/action-distributions.yml@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1
+ uses: hoverkraft-tech/ci-github-common/.github/workflows/action-distributions.yml@f19f395c695e952a5b751b107db5a3e50807a74f # PR #701 (unreleased)
permissions:
actions: read
contents: read
pull-requests: read
with:
pull-request-authors: |
- ["dependabot", "renovate", {"login":"hoverkraft-bot[bot]","id":128996893,"branch-prefix":"renovate/"}]
+ ["dependabot", "renovate", "hoverkraft"]
github-app-client-id: ${{ vars.CI_BOT_APP_CLIENT_ID }}
secrets:
github-app-key: ${{ secrets.CI_BOT_APP_PRIVATE_KEY }}
diff --git a/.github/workflows/__greetings.yml b/.github/workflows/__greetings.yml
index 1d76f028..f48ad365 100644
--- a/.github/workflows/__greetings.yml
+++ b/.github/workflows/__greetings.yml
@@ -11,7 +11,7 @@ permissions: {}
jobs:
greetings:
- uses: hoverkraft-tech/ci-github-common/.github/workflows/greetings.yml@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1
+ uses: hoverkraft-tech/ci-github-common/.github/workflows/greetings.yml@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0
permissions:
contents: read
issues: write
diff --git a/.github/workflows/__main-ci.yml b/.github/workflows/__main-ci.yml
index a9bc2655..b589b38a 100644
--- a/.github/workflows/__main-ci.yml
+++ b/.github/workflows/__main-ci.yml
@@ -18,6 +18,7 @@ jobs:
ci:
uses: $/.github/workflows/__shared-ci.yml
permissions:
+ code-quality: write
actions: read
deployments: write
attestations: write
diff --git a/.github/workflows/__need-fix-to-issue.yml b/.github/workflows/__need-fix-to-issue.yml
index 4cf9872f..91d1331d 100644
--- a/.github/workflows/__need-fix-to-issue.yml
+++ b/.github/workflows/__need-fix-to-issue.yml
@@ -21,7 +21,7 @@ permissions: {}
jobs:
main:
- uses: hoverkraft-tech/ci-github-common/.github/workflows/need-fix-to-issue.yml@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1
+ uses: hoverkraft-tech/ci-github-common/.github/workflows/need-fix-to-issue.yml@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0
permissions:
contents: read
issues: write
diff --git a/.github/workflows/__pull-request-ci.yml b/.github/workflows/__pull-request-ci.yml
index 868c3d51..b7d9044d 100644
--- a/.github/workflows/__pull-request-ci.yml
+++ b/.github/workflows/__pull-request-ci.yml
@@ -16,6 +16,7 @@ jobs:
ci:
uses: $/.github/workflows/__shared-ci.yml
permissions:
+ code-quality: write
actions: read
deployments: write
attestations: write
diff --git a/.github/workflows/__rebuild-action-distributions.yml b/.github/workflows/__rebuild-action-distributions.yml
deleted file mode 100644
index c3d48c5d..00000000
--- a/.github/workflows/__rebuild-action-distributions.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-name: Internal - Rebuild action distributions
-
-on:
- pull_request:
- branches: [main]
-
-permissions: {}
-
-jobs:
- distributions:
- uses: hoverkraft-tech/ci-github-common/.github/workflows/action-distributions.yml@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1
- permissions:
- actions: read
- contents: read
- pull-requests: read
- with:
- pull-request-authors: |
- ["dependabot", "renovate", {"login":"hoverkraft-bot[bot]","id":128996893,"branch-prefix":"renovate/"}]
diff --git a/.github/workflows/__release.yml b/.github/workflows/__release.yml
index 434f8235..557e2d35 100644
--- a/.github/workflows/__release.yml
+++ b/.github/workflows/__release.yml
@@ -25,6 +25,7 @@ jobs:
if: github.ref_type == 'branch' && github.ref_name == github.event.repository.default_branch
uses: $/.github/workflows/__shared-ci.yml
permissions:
+ code-quality: write
actions: read
deployments: write
attestations: write
diff --git a/.github/workflows/__semantic-pull-request.yml b/.github/workflows/__semantic-pull-request.yml
index 6546ed69..2122f611 100644
--- a/.github/workflows/__semantic-pull-request.yml
+++ b/.github/workflows/__semantic-pull-request.yml
@@ -14,4 +14,4 @@ jobs:
main:
permissions:
contents: read
- uses: hoverkraft-tech/ci-github-common/.github/workflows/semantic-pull-request.yml@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1
+ uses: hoverkraft-tech/ci-github-common/.github/workflows/semantic-pull-request.yml@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0
diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml
index 40f45ed0..f9fe4624 100644
--- a/.github/workflows/__shared-ci.yml
+++ b/.github/workflows/__shared-ci.yml
@@ -10,14 +10,36 @@ on: # yamllint disable-line rule:truthy
permissions: {}
jobs:
- test-action-distributions:
- uses: hoverkraft-tech/ci-github-common/.github/workflows/test-action-distributions.yml@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1
+ continuous-integration:
+ name: CI (${{ matrix.directory }})
+ strategy:
+ fail-fast: false
+ matrix:
+ directory:
+ - actions/docker/promote-images
+ - actions/docker/prune-pull-requests-image-tags
+ - actions/docker/test-image
+ - actions/docker/verify-images
+ - actions/helm/generate-docs
+ - actions/helm/lint-chart
+ - actions/helm/prepare-chart
+ - actions/helm/prepare-release
+ - actions/helm/release-chart
+ - actions/helm/test-chart
+ uses: hoverkraft-tech/ci-github-nodejs/.github/workflows/continuous-integration.yml@ec682a1547aa7f917034bd62a833aac7e09709d1 # PR #624 (unreleased)
permissions:
+ actions: read
contents: read
+ packages: read
+ security-events: write
+ with:
+ working-directory: ${{ matrix.directory }}
+ code-ql: ${{ strategy.job-index == 0 && '{"languages":"javascript-typescript","config-file":".github/codeql/config.yml"}' || '' }}
+ dependency-review: ${{ strategy.job-index == 0 }}
lint:
name: linter
- uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1
+ uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0
permissions:
actions: read
contents: read
@@ -26,33 +48,12 @@ jobs:
pull-requests: write
security-events: write
statuses: write
- with:
- comment: false
-
- test-action-docker-promote-images:
- needs: lint
- uses: $/.github/workflows/__test-action-docker-promote-images.yml
- permissions:
- contents: read
- id-token: write
- packages: read
- pull-requests: write
- security-events: write
-
- test-action-docker-verify-images:
- needs: lint
- uses: $/.github/workflows/__test-action-docker-verify-images.yml
- permissions:
- contents: read
- id-token: write
- packages: read
- pull-requests: write
- security-events: write
test-action-docker-test-image:
needs: lint
uses: $/.github/workflows/__test-action-docker-test-image.yml
permissions:
+ actions: read
contents: read
id-token: write
packages: read
@@ -63,6 +64,7 @@ jobs:
needs: lint
uses: $/.github/workflows/__test-action-docker-build-image.yml
permissions:
+ actions: read
contents: read
packages: write
@@ -70,6 +72,7 @@ jobs:
needs: lint
uses: $/.github/workflows/__test-action-docker-create-images-manifests.yml
permissions:
+ actions: read
attestations: write
contents: read
id-token: write
@@ -81,12 +84,14 @@ jobs:
needs: lint
uses: $/.github/workflows/__test-action-docker-setup.yml
permissions:
+ actions: read
contents: read
test-action-docker-prune-pull-requests-image-tags:
needs: lint
uses: $/.github/workflows/__test-action-docker-prune-pull-requests-image-tags.yml
permissions:
+ actions: read
attestations: write
contents: read
id-token: write
@@ -99,24 +104,28 @@ jobs:
needs: lint
uses: $/.github/workflows/__test-action-get-image-metadata.yml
permissions:
+ actions: read
contents: read
test-action-action-get-image-name:
needs: lint
uses: $/.github/workflows/__test-action-get-image-name.yml
permissions:
+ actions: read
contents: read
test-action-helm-parse-chart-uri:
needs: lint
uses: $/.github/workflows/__test-action-helm-parse-chart-uri.yml
permissions:
+ actions: read
contents: read
test-action-helm-sign-chart:
needs: lint
uses: $/.github/workflows/__test-action-helm-sign-chart.yml
permissions:
+ actions: read
contents: read
id-token: write
packages: write
@@ -125,32 +134,14 @@ jobs:
needs: lint
uses: $/.github/workflows/__test-action-helm-update-chart-values.yml
permissions:
+ actions: read
contents: read
- test-action-helm-generate-docs:
- needs: lint
- uses: $/.github/workflows/__test-action-helm-generate-docs.yml
- permissions:
- contents: read
- id-token: write
- packages: read
- pull-requests: write
- security-events: write
-
test-action-helm-prepare-chart:
needs: lint
uses: $/.github/workflows/__test-action-helm-prepare-chart.yml
permissions:
- contents: read
- id-token: write
- packages: read
- pull-requests: write
- security-events: write
-
- test-action-helm-prepare-release:
- needs: lint
- uses: $/.github/workflows/__test-action-helm-prepare-release.yml
- permissions:
+ actions: read
contents: read
id-token: write
packages: read
@@ -161,6 +152,7 @@ jobs:
needs: lint
uses: $/.github/workflows/__test-action-helm-lint-chart.yml
permissions:
+ actions: read
contents: read
id-token: write
packages: read
@@ -171,6 +163,7 @@ jobs:
needs: lint
uses: $/.github/workflows/__test-action-helm-release-chart.yml
permissions:
+ actions: read
contents: read
id-token: write
packages: write
@@ -181,6 +174,7 @@ jobs:
needs: lint
uses: $/.github/workflows/__test-action-helm-test-chart.yml
permissions:
+ actions: read
attestations: write
contents: read
id-token: write
@@ -194,9 +188,9 @@ jobs:
needs: lint
uses: $/.github/workflows/__test-workflow-docker-build-images-building.yml
permissions:
+ actions: read
attestations: write
contents: read
- actions: read
deployments: write
id-token: write
issues: read
@@ -210,6 +204,7 @@ jobs:
needs: lint
uses: $/.github/workflows/__test-workflow-docker-build-images-caching.yml
permissions:
+ actions: read
attestations: write
contents: read
id-token: write
@@ -224,6 +219,7 @@ jobs:
needs: lint
uses: $/.github/workflows/__test-workflow-docker-build-images-multi-registry.yml
permissions:
+ actions: read
attestations: write
contents: read
id-token: write
@@ -238,6 +234,7 @@ jobs:
needs: lint
uses: $/.github/workflows/__test-workflow-docker-build-images-platforms-and-signing.yml
permissions:
+ actions: read
attestations: write
contents: read
id-token: write
@@ -252,6 +249,7 @@ jobs:
needs: lint
uses: $/.github/workflows/__test-workflow-docker-build-images-attestation.yml
permissions:
+ actions: read
attestations: write
contents: read
id-token: write
@@ -262,22 +260,67 @@ jobs:
CI_BOT_APP_PRIVATE_KEY: ${{ secrets.CI_BOT_APP_PRIVATE_KEY }}
reports:
+ if: always()
needs:
+ - continuous-integration
- lint
- - test-action-helm-generate-docs
+ - test-action-docker-test-image
+ - test-action-docker-build-image
+ - test-action-docker-create-images-manifests
+ - test-action-docker-setup
+ - test-action-docker-prune-pull-requests-image-tags
+ - test-action-get-image-metadata
+ - test-action-action-get-image-name
+ - test-action-helm-parse-chart-uri
+ - test-action-helm-sign-chart
+ - test-action-helm-update-chart-values
- test-action-helm-prepare-chart
- - test-action-helm-prepare-release
- test-action-helm-lint-chart
- - test-action-helm-test-chart
- test-action-helm-release-chart
- - test-action-docker-promote-images
- - test-action-docker-verify-images
- - test-action-docker-test-image
- - test-action-docker-prune-pull-requests-image-tags
- if: always()
- uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1
+ - test-action-helm-test-chart
+ - test-workflow-docker-build-images-building
+ - test-workflow-docker-build-images-caching
+ - test-workflow-docker-build-images-multi-registry
+ - test-workflow-docker-build-images-platforms-and-signing
+ - test-workflow-docker-build-images-attestation
+ uses: hoverkraft-tech/ci-github-common/.github/workflows/publish-ci-reports.yml@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0
permissions:
+ actions: read
contents: read
pull-requests: write
+ code-quality: write
+ id-token: write
+ security-events: write
+ with:
+ job-results: ${{ toJSON(needs) }}
+
+ complete:
+ name: CI complete
+ if: always()
+ needs:
+ - continuous-integration
+ - lint
+ - test-action-docker-test-image
+ - test-action-docker-build-image
+ - test-action-docker-create-images-manifests
+ - test-action-docker-setup
+ - test-action-docker-prune-pull-requests-image-tags
+ - test-action-get-image-metadata
+ - test-action-action-get-image-name
+ - test-action-helm-parse-chart-uri
+ - test-action-helm-sign-chart
+ - test-action-helm-update-chart-values
+ - test-action-helm-prepare-chart
+ - test-action-helm-lint-chart
+ - test-action-helm-release-chart
+ - test-action-helm-test-chart
+ - test-workflow-docker-build-images-building
+ - test-workflow-docker-build-images-caching
+ - test-workflow-docker-build-images-multi-registry
+ - test-workflow-docker-build-images-platforms-and-signing
+ - test-workflow-docker-build-images-attestation
+ - reports
+ uses: hoverkraft-tech/ci-github-common/.github/workflows/check-jobs.yml@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0
+ permissions: {}
with:
job-results: ${{ toJSON(needs) }}
diff --git a/.github/workflows/__stale.yml b/.github/workflows/__stale.yml
index 6f953353..75a300e8 100644
--- a/.github/workflows/__stale.yml
+++ b/.github/workflows/__stale.yml
@@ -9,7 +9,7 @@ permissions: {}
jobs:
main:
- uses: hoverkraft-tech/ci-github-common/.github/workflows/stale.yml@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1
+ uses: hoverkraft-tech/ci-github-common/.github/workflows/stale.yml@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0
permissions:
issues: write
pull-requests: write
diff --git a/.github/workflows/__test-action-docker-build-image.yml b/.github/workflows/__test-action-docker-build-image.yml
index efde85e5..ad07e984 100644
--- a/.github/workflows/__test-action-docker-build-image.yml
+++ b/.github/workflows/__test-action-docker-build-image.yml
@@ -9,6 +9,33 @@ permissions: {}
# jscpd:ignore-start
jobs:
+ local-build:
+ name: Load and inspect an image without publication credentials
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ persist-credentials: false
+ - id: build
+ uses: $/actions/docker/build-image
+ with:
+ push: "false"
+ oci-registry-password: ""
+ context: .
+ dockerfile: tests/application/Dockerfile
+ target: base
+ platform: linux/amd64
+ image: local-test
+ - name: Verify the exact local image and absence of promotion metadata
+ env:
+ IMAGE_ID: ${{ steps.build.outputs.image-id }}
+ BUILT_IMAGE: ${{ steps.build.outputs.built-image }}
+ run: |
+ test -z "$BUILT_IMAGE"
+ test "$(docker image inspect --format '{{.Id}}' "$IMAGE_ID")" = "$IMAGE_ID"
+
tests:
name: Test for "docker/build-image" action
runs-on: ubuntu-latest
@@ -179,7 +206,7 @@ jobs:
exit 1
fi
- if ! docker manifest inspect "$IMAGE"; then
+ if ! docker buildx imagetools inspect "$IMAGE"; then
echo "Failed to inspect $IMAGE"
exit 1
fi
@@ -265,7 +292,7 @@ jobs:
exit 1
fi
- if ! docker manifest inspect "$IMAGE"; then
+ if ! docker buildx imagetools inspect "$IMAGE"; then
echo "Failed to inspect $IMAGE"
exit 1
fi
@@ -363,7 +390,7 @@ jobs:
exit 1
fi
- if ! docker manifest inspect "$IMAGE"; then
+ if ! docker buildx imagetools inspect "$IMAGE"; then
echo "Failed to inspect $IMAGE"
exit 1
fi
@@ -442,7 +469,7 @@ jobs:
exit 1
fi
- if ! docker manifest inspect "$IMAGE"; then
+ if ! docker buildx imagetools inspect "$IMAGE"; then
echo "Failed to inspect $IMAGE"
exit 1
fi
diff --git a/.github/workflows/__test-action-docker-create-images-manifests.yml b/.github/workflows/__test-action-docker-create-images-manifests.yml
index f714632d..763060b0 100644
--- a/.github/workflows/__test-action-docker-create-images-manifests.yml
+++ b/.github/workflows/__test-action-docker-create-images-manifests.yml
@@ -296,7 +296,7 @@ jobs:
- name: Assert - Cloned tag exists in registry
run: |
- docker manifest inspect ghcr.io/hoverkraft-tech/ci-github-container/test-create-manifests-clone-tag:1.0.0 >/dev/null
+ docker buildx imagetools inspect ghcr.io/hoverkraft-tech/ci-github-container/test-create-manifests-clone-tag:1.0.0 >/dev/null
- name: Assert - Cloned image digest and tag
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
diff --git a/.github/workflows/__test-action-docker-promote-images.yml b/.github/workflows/__test-action-docker-promote-images.yml
deleted file mode 100644
index 640486ac..00000000
--- a/.github/workflows/__test-action-docker-promote-images.yml
+++ /dev/null
@@ -1,24 +0,0 @@
----
-name: Test for "docker/promote-images" action
-run-name: Test for "docker/promote-images" action
-
-on: # yamllint disable-line rule:truthy
- workflow_call:
-
-permissions: {}
-
-jobs:
- continuous-integration:
- uses: hoverkraft-tech/ci-github-nodejs/.github/workflows/continuous-integration.yml@191d7230d57982bfc11d57f68b005f386a6d7fbf # 3.1.1
- permissions:
- contents: read
- id-token: write
- packages: read
- pull-requests: write
- security-events: write
- with:
- working-directory: actions/docker/promote-images
- build: ""
- lint: ""
- code-ql: '{"languages":"typescript","config-file":".github/codeql/config.yml"}'
- test: '{"comment":false,"report-group":"test-action-docker-promote-images"}'
diff --git a/.github/workflows/__test-action-docker-prune-pull-requests-image-tags.yml b/.github/workflows/__test-action-docker-prune-pull-requests-image-tags.yml
index e5850f73..e5044205 100644
--- a/.github/workflows/__test-action-docker-prune-pull-requests-image-tags.yml
+++ b/.github/workflows/__test-action-docker-prune-pull-requests-image-tags.yml
@@ -11,25 +11,11 @@ env:
IMAGE_NAME: "test-prune-${{ github.run_number }}"
jobs:
- continuous-integration:
- uses: hoverkraft-tech/ci-github-nodejs/.github/workflows/continuous-integration.yml@191d7230d57982bfc11d57f68b005f386a6d7fbf # 3.1.1
- permissions:
- contents: read
- id-token: write
- packages: read
- pull-requests: write
- security-events: write
- with:
- working-directory: actions/docker/prune-pull-requests-image-tags
- build: ""
- lint: ""
- code-ql: '{"languages":"typescript","config-file":".github/codeql/config.yml"}'
- test: '{"comment":false,"report-group":"test-action-docker-prune-pull-requests-image-tags"}'
-
arrange-prepare-variables:
name: Arrange - Prepare variables
runs-on: ubuntu-latest
permissions:
+ actions: read
pull-requests: read
outputs:
tag: ${{ steps.prepare-variables.outputs.tag }}
@@ -86,6 +72,7 @@ jobs:
needs: arrange-prepare-variables
uses: $/.github/workflows/docker-build-images.yml
permissions:
+ actions: read
attestations: write
contents: read
id-token: write
@@ -113,6 +100,7 @@ jobs:
runs-on: ubuntu-latest
needs: [arrange-prepare-variables, arrange-build-images]
permissions:
+ actions: read
contents: read
packages: read
outputs:
@@ -207,6 +195,7 @@ jobs:
runs-on: ubuntu-latest
needs: [arrange-prepare-variables, arrange-build-images, arrange-verify]
permissions:
+ actions: read
packages: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@@ -354,7 +343,7 @@ jobs:
for IMAGE_TAG in $(echo "$BUILT_IMAGES" | jq -r --arg image_name "$IMAGE_NAME" '.[$image_name].images[]'); do
docker pull "$IMAGE_TAG"
- if ! MANIFEST=$(docker manifest inspect "$IMAGE_TAG"); then
+ if ! MANIFEST=$(docker buildx imagetools inspect --raw "$IMAGE_TAG"); then
echo "Failed to inspect manifest for image: ${IMAGE_TAG}"
exit 1
fi
@@ -365,7 +354,7 @@ jobs:
for DIGEST in $(echo "$MANIFEST" | jq -r '.manifests[].digest'); do
IMAGE_MANIFEST="ghcr.io/hoverkraft-tech/ci-github-container/$IMAGE_NAME@$DIGEST"
docker pull "$IMAGE_MANIFEST"
- if ! docker manifest inspect "$IMAGE_MANIFEST" > /dev/null; then
+ if ! docker buildx imagetools inspect "$IMAGE_MANIFEST" > /dev/null; then
echo "Failed to inspect manifest for image: ${IMAGE_MANIFEST}"
exit 1
fi
@@ -376,6 +365,7 @@ jobs:
needs: [arrange-prepare-variables, assert]
runs-on: "ubuntu-latest"
permissions:
+ actions: read
packages: write
if: always()
steps:
diff --git a/.github/workflows/__test-action-docker-test-image.yml b/.github/workflows/__test-action-docker-test-image.yml
index 8e4da0e0..bfae0e1b 100644
--- a/.github/workflows/__test-action-docker-test-image.yml
+++ b/.github/workflows/__test-action-docker-test-image.yml
@@ -2,38 +2,29 @@
name: Test for "docker/test-image" action
run-name: Test for "docker/test-image" action
-on: # yamllint disable-line rule:truthy
+on:
+ # yamllint disable-line rule:truthy
workflow_call:
permissions: {}
jobs:
- continuous-integration:
- uses: hoverkraft-tech/ci-github-nodejs/.github/workflows/continuous-integration.yml@191d7230d57982bfc11d57f68b005f386a6d7fbf # 3.1.1
- permissions:
- contents: read
- id-token: write
- packages: read
- pull-requests: write
- security-events: write
- with:
- working-directory: actions/docker/test-image
- build: ""
- lint: ""
- code-ql: '{"languages":"typescript","config-file":".github/codeql/config.yml"}'
- test: '{"comment":false,"report-group":"test-action-docker-test-image"}'
-
integration:
- name: Native ${{ matrix.engine }} lifecycle and reporting
+ name: Native ${{ matrix.suite }} lifecycle and reporting
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
+ actions: read
contents: read
packages: read
strategy:
fail-fast: false
matrix:
- engine: [testcontainers-node, goss]
+ include:
+ - engine: testcontainers-node
+ suite: testcontainers-node
+ - engine: goss
+ suite: goss-image
env:
IMAGE: ghcr.io/hoverkraft-tech/ci-github-container/application-test:0.1.0@sha256:e5cc91762bc2b09276ab2b56d88583dd11522cc80b61e63dac7b4ac0f0d04c77
steps:
@@ -53,6 +44,7 @@ jobs:
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
ENGINE: ${{ matrix.engine }}
+ SUITE: ${{ matrix.suite }}
with:
script: |
const fs = require('node:fs');
@@ -64,7 +56,7 @@ jobs:
fs.mkdirSync(root, {recursive: true});
for (const mode of ['success', 'failure', 'timeout']) {
const directory = path.join(root, mode);
- fs.cpSync(`tests/container-image/${process.env.ENGINE}`, directory, {recursive: true});
+ fs.cpSync(`tests/container-image/${process.env.SUITE}`, directory, {recursive: true});
if (mode === 'success') continue;
if (process.env.ENGINE === 'testcontainers-node') fs.writeFileSync(path.join(directory, mode), '');
else {
@@ -74,17 +66,34 @@ jobs:
}
}
await exec.exec('docker', ['pull', process.env.IMAGE]);
- const image = await exec.getExecOutput('docker', ['image', 'inspect', '--format', '{{.Id}}', process.env.IMAGE]);
+ let reference = process.env.IMAGE;
+ if (process.env.SUITE === 'goss-image') {
+ // Any accidental application startup fails. Direct Goss must retain USER.
+ fs.writeFileSync(path.join(root, 'Dockerfile'),
+ `FROM ${reference}\nUSER 10001:10001\nENTRYPOINT ["/bin/sh", "-c", "exit 97"]\n`);
+ const iid = path.join(root, 'image-id');
+ await exec.exec('docker', ['build', '--iidfile', iid, root]);
+ reference = fs.readFileSync(iid, 'utf8').trim();
+ }
+ core.setOutput('candidate', reference);
+ const image = await exec.getExecOutput('docker', ['image', 'inspect', '--format', '{{.Id}}', reference]);
core.setOutput('image-id', image.stdout.trim());
await exec.exec('docker', ['create', '--name', `caller-${id}`, '--label', `org.testcontainers.session-id=${id}`, image.stdout.trim()]);
- - name: Act - Validate registry candidate
+ - name: Act - Validate immutable candidate
id: passing
uses: $/actions/docker/test-image
with:
- image: ${{ env.IMAGE }}
+ image: ${{ steps.arrange.outputs.candidate }}
working-directory: ${{ steps.arrange.outputs.root }}/success
- report-group: test-action-docker-test-image
+
+ - name: Act - Let a Goss suite manage its application lifecycle
+ id: service
+ if: matrix.engine == 'goss'
+ uses: $/actions/docker/test-image
+ with:
+ image: ${{ env.IMAGE }}
+ working-directory: tests/container-image/goss
- name: Act - Retain native reports after a failing assertion
id: failing
@@ -93,7 +102,6 @@ jobs:
with:
image: ${{ steps.arrange.outputs.image-id }}
working-directory: ${{ steps.arrange.outputs.root }}/failure
- report-group: fixture-container-negative
- name: Act - Bound execution and clean resources after timeout
id: timeout
@@ -103,21 +111,9 @@ jobs:
image: ${{ steps.arrange.outputs.image-id }}
working-directory: ${{ steps.arrange.outputs.root }}/timeout
timeout: "10"
- report-group: fixture-container-negative
-
- - name: Act - Reject a short-lived image with Goss
- id: incompatible
- if: matrix.engine == 'goss'
- continue-on-error: true
- uses: $/actions/docker/test-image
- with:
- image: docker.io/library/hello-world:latest@sha256:1e4c05b897a751332ce85c7e9449da2d93514ea2dea6dbb0e2753c9e949b2bfa
- working-directory: ${{ steps.arrange.outputs.root }}/success
- timeout: "10"
- report-group: fixture-container-negative
- name: Download failed test reports
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
+ uses: hoverkraft-tech/ci-github-common/actions/download-artifact@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0
with:
artifact-ids: ${{ steps.failing.outputs.report-artifact-id }}
path: ${{ steps.arrange.outputs.root }}/download
@@ -127,9 +123,11 @@ jobs:
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
ENGINE: ${{ matrix.engine }}
+ CANDIDATE: ${{ steps.arrange.outputs.candidate }}
ROOT: ${{ steps.arrange.outputs.root }}
CALLER: ${{ steps.arrange.outputs.caller }}
PASSING: ${{ steps.passing.outputs.validation }}
+ SERVICE_RESULT: ${{ steps.service.outputs.validation }}
PASS_REPORT: ${{ steps.passing.outputs.report-artifact-id }}
FAIL_REPORT: ${{ steps.failing.outputs.report-artifact-id }}
FAIL_RESULT: ${{ steps.failing.outputs.validation }}
@@ -137,9 +135,6 @@ jobs:
TIMEOUT_RESULT: ${{ steps.timeout.outputs.validation }}
TIMEOUT_OUTCOME: ${{ steps.timeout.outcome }}
TIMEOUT_LOGS: ${{ steps.timeout.outputs.diagnostic-artifact-id }}
- INCOMPATIBLE_RESULT: ${{ steps.incompatible.outputs.validation }}
- INCOMPATIBLE_OUTCOME: ${{ steps.incompatible.outcome }}
- INCOMPATIBLE_LOGS: ${{ steps.incompatible.outputs.diagnostic-artifact-id }}
with:
script: |
const assert = require('node:assert/strict');
@@ -147,8 +142,8 @@ jobs:
const { pathToFileURL } = require('node:url');
const { Reports } = await import(pathToFileURL(path.resolve('actions/docker/test-image/dist/index.js')));
const result = JSON.parse(process.env.PASSING);
- assert.equal(result.image, process.env.IMAGE);
- assert.equal(result['identity-kind'], 'registry');
+ assert.equal(result.image, process.env.CANDIDATE);
+ assert.equal(result['identity-kind'], process.env.CANDIDATE.startsWith('sha256:') ? 'local' : 'registry');
assert.equal(result.engine, process.env.ENGINE);
assert.ok(result.tests.executed > 0);
assert.equal(process.env.FAIL_OUTCOME, 'failure');
@@ -158,16 +153,32 @@ jobs:
assert.ok(process.env.PASS_REPORT && process.env.FAIL_REPORT && process.env.TIMEOUT_LOGS);
assert.notEqual(process.env.PASS_REPORT, process.env.FAIL_REPORT);
if (process.env.ENGINE === 'goss') {
- assert.equal(process.env.INCOMPATIBLE_OUTCOME, 'failure');
- assert.equal(process.env.INCOMPATIBLE_RESULT, '');
- assert.ok(process.env.INCOMPATIBLE_LOGS);
+ const service = JSON.parse(process.env.SERVICE_RESULT);
+ assert.equal(service.engine, 'goss');
+ assert.equal(service.image, process.env.IMAGE);
+ assert.ok(service.tests.executed > 0);
}
+ const manifest = JSON.parse(require('node:fs').readFileSync(path.join(process.env.ROOT,'download','report.json'),'utf8'));
+ assert.equal(manifest.version, 1);
+ assert.equal(manifest.outcome, 'failure');
+ assert.deepEqual(manifest.errors, [], 'Failed assertions remain valid report evidence');
+ assert.ok(manifest.reports.some(report => report.kind === 'test' && report.summary.failed > 0));
+ assert.equal(manifest.subject.kind, 'image');
+ assert.equal(manifest.subject.digest, result['image-id']);
+ assert.equal(manifest.subject.engine, process.env.ENGINE);
+ assert.equal(manifest.subject.platform, result.platform);
+ assert.equal(manifest.project, path.relative(process.env.GITHUB_WORKSPACE, path.join(process.env.ROOT, 'failure')));
const files = await glob.create(`${process.env.ROOT}/download/**/*.xml`);
assert.ok((await files.glob()).some(file => new Reports(file).inspect().failed > 0));
await exec.exec('docker', ['container', 'inspect', process.env.CALLER]);
const containers = await exec.getExecOutput('docker', ['container', 'ls', '-aq', '--filter', 'label=io.hoverkraft.container-test']);
assert.equal(containers.stdout.trim(), '');
+ - name: Discard verified negative fixture results
+ uses: hoverkraft-tech/ci-github-common/actions/quality/discard-report-fixtures@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0
+ with:
+ artifact-ids: ${{ steps.failing.outputs.report-artifact-id }},${{ steps.timeout.outputs.report-artifact-id }}
+
- name: Clean caller fixture
if: ${{ always() && steps.arrange.outputs.root != '' }}
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
diff --git a/.github/workflows/__test-action-docker-verify-images.yml b/.github/workflows/__test-action-docker-verify-images.yml
deleted file mode 100644
index f1ebce97..00000000
--- a/.github/workflows/__test-action-docker-verify-images.yml
+++ /dev/null
@@ -1,24 +0,0 @@
----
-name: Test for "docker/verify-images" action
-run-name: Test for "docker/verify-images" action
-
-on: # yamllint disable-line rule:truthy
- workflow_call:
-
-permissions: {}
-
-jobs:
- continuous-integration:
- uses: hoverkraft-tech/ci-github-nodejs/.github/workflows/continuous-integration.yml@191d7230d57982bfc11d57f68b005f386a6d7fbf # 3.1.1
- permissions:
- contents: read
- id-token: write
- packages: read
- pull-requests: write
- security-events: write
- with:
- working-directory: actions/docker/verify-images
- build: ""
- lint: ""
- code-ql: '{"languages":"typescript","config-file":".github/codeql/config.yml"}'
- test: '{"comment":false,"report-group":"test-action-docker-verify-images"}'
diff --git a/.github/workflows/__test-action-helm-generate-docs.yml b/.github/workflows/__test-action-helm-generate-docs.yml
deleted file mode 100644
index 9228242f..00000000
--- a/.github/workflows/__test-action-helm-generate-docs.yml
+++ /dev/null
@@ -1,24 +0,0 @@
----
-name: Test for "helm/generate-docs" action
-run-name: Test for "helm/generate-docs" action
-
-on: # yamllint disable-line rule:truthy
- workflow_call:
-
-permissions: {}
-
-jobs:
- continuous-integration:
- uses: hoverkraft-tech/ci-github-nodejs/.github/workflows/continuous-integration.yml@191d7230d57982bfc11d57f68b005f386a6d7fbf # 3.1.1
- permissions:
- contents: read
- id-token: write
- packages: read
- pull-requests: write
- security-events: write
- with:
- working-directory: actions/helm/generate-docs
- build: ""
- lint: ""
- code-ql: '{"languages":"typescript","config-file":".github/codeql/config.yml"}'
- test: '{"comment":false,"report-group":"test-action-helm-generate-docs"}'
diff --git a/.github/workflows/__test-action-helm-lint-chart.yml b/.github/workflows/__test-action-helm-lint-chart.yml
index d68fa6e0..301f5a6a 100644
--- a/.github/workflows/__test-action-helm-lint-chart.yml
+++ b/.github/workflows/__test-action-helm-lint-chart.yml
@@ -8,25 +8,11 @@ on: # yamllint disable-line rule:truthy
permissions: {}
jobs:
- continuous-integration:
- uses: hoverkraft-tech/ci-github-nodejs/.github/workflows/continuous-integration.yml@191d7230d57982bfc11d57f68b005f386a6d7fbf # 3.1.1
- permissions:
- contents: read
- id-token: write
- packages: read
- pull-requests: write
- security-events: write
- with:
- working-directory: actions/helm/lint-chart
- build: ""
- lint: ""
- code-ql: '{"languages":"typescript","config-file":".github/codeql/config.yml"}'
- test: '{"comment":false,"report-group":"test-action-helm-lint-chart"}'
-
integration:
name: Lint prepared chart with Helm and chart-testing
runs-on: ubuntu-latest
permissions:
+ actions: read
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
diff --git a/.github/workflows/__test-action-helm-prepare-chart.yml b/.github/workflows/__test-action-helm-prepare-chart.yml
index d08408da..3ce1af76 100644
--- a/.github/workflows/__test-action-helm-prepare-chart.yml
+++ b/.github/workflows/__test-action-helm-prepare-chart.yml
@@ -8,25 +8,11 @@ on: # yamllint disable-line rule:truthy
permissions: {}
jobs:
- continuous-integration:
- uses: hoverkraft-tech/ci-github-nodejs/.github/workflows/continuous-integration.yml@191d7230d57982bfc11d57f68b005f386a6d7fbf # 3.1.1
- permissions:
- contents: read
- id-token: write
- packages: read
- pull-requests: write
- security-events: write
- with:
- working-directory: actions/helm/prepare-chart
- build: ""
- lint: ""
- code-ql: '{"languages":"typescript","config-file":".github/codeql/config.yml"}'
- test: '{"comment":false,"report-group":"test-action-helm-prepare-chart"}'
-
integration:
name: Prepare nested chart archives with Helm
runs-on: ubuntu-latest
permissions:
+ actions: read
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
diff --git a/.github/workflows/__test-action-helm-prepare-release.yml b/.github/workflows/__test-action-helm-prepare-release.yml
deleted file mode 100644
index 29f8a5a6..00000000
--- a/.github/workflows/__test-action-helm-prepare-release.yml
+++ /dev/null
@@ -1,24 +0,0 @@
----
-name: Test for "helm/prepare-release" action
-run-name: Test for "helm/prepare-release" action
-
-on: # yamllint disable-line rule:truthy
- workflow_call:
-
-permissions: {}
-
-jobs:
- continuous-integration:
- uses: hoverkraft-tech/ci-github-nodejs/.github/workflows/continuous-integration.yml@191d7230d57982bfc11d57f68b005f386a6d7fbf # 3.1.1
- permissions:
- contents: read
- id-token: write
- packages: read
- pull-requests: write
- security-events: write
- with:
- working-directory: actions/helm/prepare-release
- build: ""
- lint: ""
- code-ql: '{"languages":"typescript","config-file":".github/codeql/config.yml"}'
- test: '{"comment":false,"report-group":"test-action-helm-prepare-release"}'
diff --git a/.github/workflows/__test-action-helm-release-chart.yml b/.github/workflows/__test-action-helm-release-chart.yml
index 0c472595..5f68fcb2 100644
--- a/.github/workflows/__test-action-helm-release-chart.yml
+++ b/.github/workflows/__test-action-helm-release-chart.yml
@@ -8,25 +8,11 @@ on: # yamllint disable-line rule:truthy
permissions: {}
jobs:
- continuous-integration:
- uses: hoverkraft-tech/ci-github-nodejs/.github/workflows/continuous-integration.yml@191d7230d57982bfc11d57f68b005f386a6d7fbf # 3.1.1
- permissions:
- contents: read
- id-token: write
- packages: read
- pull-requests: write
- security-events: write
- with:
- working-directory: actions/helm/release-chart
- build: ""
- lint: ""
- code-ql: '{"languages":"typescript","config-file":".github/codeql/config.yml"}'
- test: '{"comment":false,"report-group":"test-action-helm-release-chart"}'
-
tests:
name: Test for "helm/release-chart" action with simple chart
runs-on: ubuntu-latest
permissions:
+ actions: read
contents: read
id-token: write
packages: write
diff --git a/.github/workflows/__test-action-helm-test-chart.yml b/.github/workflows/__test-action-helm-test-chart.yml
index 2bfc2834..a1adaafb 100644
--- a/.github/workflows/__test-action-helm-test-chart.yml
+++ b/.github/workflows/__test-action-helm-test-chart.yml
@@ -8,24 +8,10 @@ on: # yamllint disable-line rule:truthy
permissions: {}
jobs:
- continuous-integration:
- uses: hoverkraft-tech/ci-github-nodejs/.github/workflows/continuous-integration.yml@191d7230d57982bfc11d57f68b005f386a6d7fbf # 3.1.1
- permissions:
- contents: read
- id-token: write
- packages: read
- pull-requests: write
- security-events: write
- with:
- working-directory: actions/helm/test-chart
- build: ""
- lint: ""
- code-ql: '{"languages":"typescript","config-file":".github/codeql/config.yml"}'
- test: '{"comment":false,"report-group":"test-action-helm-test-chart"}'
-
build-test-images:
uses: $/.github/workflows/docker-build-images.yml
permissions:
+ actions: read
attestations: write
contents: read
id-token: write
@@ -53,6 +39,7 @@ jobs:
needs: build-test-images
runs-on: ubuntu-latest
permissions:
+ actions: read
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@@ -160,6 +147,7 @@ jobs:
needs: build-test-images
uses: $/.github/workflows/helm-chart-release.yml
permissions:
+ actions: read
contents: read
packages: write
id-token: write
@@ -179,6 +167,7 @@ jobs:
needs: test-release-workflow
runs-on: ubuntu-latest
permissions:
+ actions: read
contents: read
packages: read
steps:
diff --git a/.github/workflows/docker-build-images.yml b/.github/workflows/docker-build-images.yml
index cb52a6f9..921b74dc 100644
--- a/.github/workflows/docker-build-images.yml
+++ b/.github/workflows/docker-build-images.yml
@@ -433,7 +433,7 @@ jobs:
issues: read
packages: write
steps:
- - uses: hoverkraft-tech/ci-github-common/actions/checkout@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1
+ - uses: hoverkraft-tech/ci-github-common/actions/checkout@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0
with:
lfs: ${{ inputs.lfs }}
@@ -511,7 +511,7 @@ jobs:
# FIXME: Set built images infos in file to be uploaded as artifacts, because github action does not handle job outputs for matrix
# https://github.com/orgs/community/discussions/26639
- - uses: hoverkraft-tech/ci-github-common/actions/set-matrix-output@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1
+ - uses: hoverkraft-tech/ci-github-common/actions/set-matrix-output@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0
with:
artifact-name: ${{ needs.prepare-variables.outputs.artifact-name }}
value: ${{ steps.build.outputs.built-image }}
@@ -529,7 +529,7 @@ jobs:
built-images: ${{ steps.create-images-manifests.outputs.built-images }}
steps:
- id: get-matrix-outputs
- uses: hoverkraft-tech/ci-github-common/actions/get-matrix-outputs@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1
+ uses: hoverkraft-tech/ci-github-common/actions/get-matrix-outputs@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0
with:
artifact-name: ${{ needs.prepare-variables.outputs.artifact-name }}
diff --git a/.github/workflows/docker-promote-images.md b/.github/workflows/docker-promote-images.md
index d1e48664..29afee03 100644
--- a/.github/workflows/docker-promote-images.md
+++ b/.github/workflows/docker-promote-images.md
@@ -38,7 +38,7 @@ validate:
promote:
if: always()
needs: [candidates, validate, lint]
- uses: hoverkraft-tech/ci-github-container/.github/workflows/docker-promote-images.yml@7442ea53022a6365d3be7259634aaaf095bf5d3f
+ uses: hoverkraft-tech/ci-github-container/.github/workflows/docker-promote-images.yml@7442ea53022a6365d3be7259634aaaf095bf5d3f # 4.0.0
permissions:
actions: read
attestations: read
@@ -147,7 +147,7 @@ on:
permissions: {}
jobs:
docker-promote-images:
- uses: hoverkraft-tech/ci-github-container/.github/workflows/docker-promote-images.yml@7442ea53022a6365d3be7259634aaaf095bf5d3f # 4.0.0
+ uses: hoverkraft-tech/ci-github-container/.github/workflows/docker-promote-images.yml@92518e114a7c26c7cf11bec51f4c7ef6f10484c2 # feat/unified-ci-reports
permissions:
actions: read
attestations: read
diff --git a/.github/workflows/docker-promote-images.yml b/.github/workflows/docker-promote-images.yml
index de971574..1778e86b 100644
--- a/.github/workflows/docker-promote-images.yml
+++ b/.github/workflows/docker-promote-images.yml
@@ -23,7 +23,7 @@
# promote:
# if: always()
# needs: [candidates, validate, lint]
-# uses: hoverkraft-tech/ci-github-container/.github/workflows/docker-promote-images.yml@7442ea53022a6365d3be7259634aaaf095bf5d3f
+# uses: hoverkraft-tech/ci-github-container/.github/workflows/docker-promote-images.yml@7442ea53022a6365d3be7259634aaaf095bf5d3f # 4.0.0
# permissions:
# actions: read
# attestations: read
diff --git a/.github/workflows/prune-pull-requests-images-tags.yml b/.github/workflows/prune-pull-requests-images-tags.yml
index 4e02ecc6..e12a5f56 100644
--- a/.github/workflows/prune-pull-requests-images-tags.yml
+++ b/.github/workflows/prune-pull-requests-images-tags.yml
@@ -106,7 +106,7 @@ jobs:
packages: write
steps:
- id: is-organization-or-user
- uses: hoverkraft-tech/ci-github-common/actions/repository-owner-is-organization@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1
+ uses: hoverkraft-tech/ci-github-common/actions/repository-owner-is-organization@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0
- name: Wait for package visibility
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
diff --git a/Makefile b/Makefile
index 4d58cc74..f7cf4a6c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,10 @@
-.PHONY: help npm-update
+GIT_COMMON_DIR := $(shell git rev-parse --path-format=absolute --git-common-dir)
+
+SHELL := /bin/bash
+.DEFAULT_GOAL := help
+.PHONY: help lint lint-fix test-build-application test-ct-install setup test build check-distributions deps-audit ci
+
+ACTION_PACKAGES := $(sort $(patsubst %/package.json,%,$(shell find actions -name node_modules -prune -o -name dist -prune -o -name package.json -print)))
help: ## Display help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@@ -17,35 +23,6 @@ lint-fix: ## Execute linting and fix
-e FIX_BIOME_FORMAT=true \
)
-npm-audit-fix: ## Execute npm audit fix
- @set -uo pipefail; \
- overall_status=0; \
- packages="$$(find actions -type f -name package.json -not -path '*/node_modules/*' -not -path '*/dist/*' -print | sort)"; \
- echo "Running npm audit fix for package.json files under actions/ ..."; \
- for pkg in $$packages; do \
- pkg_dir="$$(dirname "$$pkg")"; \
- echo "---"; \
- npm install --prefix "$$pkg_dir"; \
- echo "npm audit fix in $$pkg_dir"; \
- if ! npm --prefix "$$pkg_dir" audit fix; then \
- overall_status=1; \
- fi; \
- done; \
- exit $$overall_status
-
-npm-update: ## Interactively update npm dependencies in action packages
- @set -eu; \
- packages="$$(find actions -type f -name package.json -not -path '*/node_modules/*' -not -path '*/dist/*' -print | sort)"; \
- for pkg in $$packages; do \
- pkg_dir="$$(dirname "$$pkg")"; \
- echo "Updating npm dependencies in $$pkg_dir"; \
- npx --yes npm-check-updates@latest --cwd "$$pkg_dir" --interactive --install always; \
- done
-
-ci: ## Execute CI tasks
- $(MAKE) npm-audit-fix || true
- $(MAKE) lint-fix
-
test-build-application: ## Build the test application image
@docker buildx build \
--push --platform linux/amd64,linux/arm64 \
@@ -76,16 +53,48 @@ test-ct-install: ## Run ct install to install the test application
helm repo remove valkey-io >/dev/null 2>&1 || true; \
ct install --config ct.yaml --namespace "$$NAMESPACE" --helm-extra-set-args "--set=namespace=$$NAMESPACE,image.registry=ghcr.io,image.repository=hoverkraft-tech/ci-github-container/application-test,image.tag=0.1.0,image.digest=,image.pullPolicy=IfNotPresent,application.healthCheckPath=/health/check"
+setup: ## Install locked action development dependencies
+ $(call run_npm_for_packages,ci --ignore-scripts --no-audit --no-fund)
+
+test: ## Run action source tests
+ $(call run_npm_for_packages,test)
+
+build: ## Rebuild action distributions where present
+ $(call run_npm_for_packages,run --if-present build)
+
+check-distributions: build ## Verify committed distributions match their source
+ @set -eu; changes="$$(git status --porcelain --untracked-files=all -- ':(glob)actions/**/dist/**')"; \
+ if [ -n "$$changes" ]; then \
+ printf '%s\n' "$$changes"; \
+ echo 'Run make build and commit the generated distributions.' >&2; \
+ exit 1; \
+ fi
+
+deps-audit: ## Check action dependencies without changing lockfiles
+ $(call run_npm_for_packages,audit)
+
+ci: ## Install dependencies and run checks without applying fixes
+ $(MAKE) setup
+ $(MAKE) test
+ $(MAKE) check-distributions
+ $(MAKE) lint
+
define run_linter
DEFAULT_WORKSPACE="$(CURDIR)"; \
- LINTER_IMAGE="linter:latest"; \
+ LINTER_IMAGE="ci-github-container-linter:local"; \
VOLUME="$$DEFAULT_WORKSPACE:$$DEFAULT_WORKSPACE"; \
+ DEFAULT_BRANCH="$$(git -C "$$DEFAULT_WORKSPACE" rev-parse --abbrev-ref HEAD)"; \
docker build --platform=linux/amd64 --build-arg UID=$(shell id -u) --build-arg GID=$(shell id -g) --tag $$LINTER_IMAGE .; \
docker run \
+ -v "$(GIT_COMMON_DIR):$(GIT_COMMON_DIR):ro" \
--platform=linux/amd64 \
-v $$VOLUME \
--rm \
+ -e RUN_LOCAL=true \
+ -e IGNORE_GITIGNORED_FILES=true \
+ -e USE_FIND_ALGORITHM=false \
-e DEFAULT_WORKSPACE="$$DEFAULT_WORKSPACE" \
+ -e DEFAULT_BRANCH="$$DEFAULT_BRANCH" \
-e FILTER_REGEX_INCLUDE="$(filter-out $@,$(MAKECMDGOALS))" \
$(1) \
$$LINTER_IMAGE
@@ -94,5 +103,14 @@ endef
#############################
# Argument fix workaround
#############################
+ifneq ($(filter lint lint-fix,$(firstword $(MAKECMDGOALS))),)
%:
@:
+endif
+
+define run_npm_for_packages
+ @set -eu; \
+ for directory in $(ACTION_PACKAGES); do \
+ npm --prefix "$$directory" $(1); \
+ done
+endef
diff --git a/README.md b/README.md
index d5535877..3b3f81ad 100644
--- a/README.md
+++ b/README.md
@@ -153,8 +153,10 @@ make ci # Run all CI checks
# Linting helpers
make lint # Run the dockerized Super Linter
make lint-fix # Attempt auto-fixes for lint findings
-make npm-audit-fix # Fix npm audit issues in action packages
-make npm-update # Interactively update npm dependencies in action packages
+make setup # Install locked action dependencies
+make test # Run action source tests
+make build # Rebuild action distributions
+make deps-audit # Inspect dependency advisories
# Container & Helm validation helpers
make test-build-application # Build and push the sample test application image
diff --git a/actions/docker/build-image/README.md b/actions/docker/build-image/README.md
index b2c82f85..b031a5a0 100644
--- a/actions/docker/build-image/README.md
+++ b/actions/docker/build-image/README.md
@@ -29,6 +29,10 @@ Action to build and push a "raw" image with Docker for a specific platform.
This action uses the Docker Buildx plugin to build the image.
It supports caching.
It returns the image digest URI, tags, and annotations, but does not handle it itself.
+Set `push: false` to load a single-platform image into the local Docker daemon.
+Use `image-id` with the [image test action](../test-image/README.md). Local builds
+skip registry authentication and produce no publishable `built-image` payload.
+Authenticate private base-image pulls before calling this action when needed.
## Build caches
@@ -78,8 +82,14 @@ permissions:
## Usage
````yaml
-- uses: hoverkraft-tech/ci-github-container/actions/docker/build-image@7442ea53022a6365d3be7259634aaaf095bf5d3f # 4.0.0
+- uses: hoverkraft-tech/ci-github-container/actions/docker/build-image@3473c05d91cce6e29c8bf688be5dfd51a533221c # feat/unified-ci-reports
with:
+ # Publish to the registry. When false, load the image locally for testing without publication.
+ # Incompatible with candidate, multi-platform and registry cache modes.
+ #
+ # Default: `true`
+ push: "true"
+
# OCI registry configuration used to pull, push and cache images.
# Accepts either a registry hostname string (default format) or a JSON object.
# JSON example: `{"pull":"docker.io","pull:private":"ghcr.io","push":"ghcr.io"}`
@@ -204,6 +214,8 @@ permissions:
| **Input** | **Description** | **Required** | **Default** |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------ | -------------------------------- |
+| **`push`** | Publish to the registry. When false, load the image locally for testing without publication. | **false** | `true` |
+| | Incompatible with candidate, multi-platform and registry cache modes. | | |
| **`oci-registry`** | OCI registry configuration used to pull, push and cache images. | **true** | `ghcr.io` |
| | Accepts either a registry hostname string (default format) or a JSON object. | | |
| | JSON example: `{"pull":"docker.io","pull:private":"ghcr.io","push":"ghcr.io"}` | | |
@@ -274,6 +286,7 @@ permissions:
| **Output** | **Description** |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| **`image-id`** | Exact local Docker image ID when push is false. It does not certify any registry digest. |
| **`built-image`** | Built image data. |
| | Example: |
| |
{
"name": "application",
"registry": "ghcr.io",
"repository": "my-org/my-repo/application",
"digest": "sha256:d31aa93410434ac9dcfc9179cac2cb1fd4d7c27f11527addc40299c7c675f49d",
"image": "ghcr.io/my-org/my-repo/application@sha256:d31aa93410434ac9dcfc9179cac2cb1fd4d7c27f11527addc40299c7c675f49d",
"tags": [
"pr-63-5222075",
"pr-63"
],
"annotations": {
"org.opencontainers.image.created": "2021-09-30T14:00:00Z",
"org.opencontainers.image.description": "Application image"
},
"platform": "linux/amd64",
"multi-platform": false
} |
diff --git a/actions/docker/build-image/action.yml b/actions/docker/build-image/action.yml
index bfa0979a..59f2d57e 100644
--- a/actions/docker/build-image/action.yml
+++ b/actions/docker/build-image/action.yml
@@ -5,6 +5,10 @@ description: |
This action uses the Docker Buildx plugin to build the image.
It supports caching.
It returns the image digest URI, tags, and annotations, but does not handle it itself.
+ Set `push: false` to load a single-platform image into the local Docker daemon.
+ Use `image-id` with the [image test action](../test-image/README.md). Local builds
+ skip registry authentication and produce no publishable `built-image` payload.
+ Authenticate private base-image pulls before calling this action when needed.
## Build caches
@@ -42,6 +46,12 @@ branding:
color: blue
inputs:
+ push:
+ description: |
+ Publish to the registry. When false, load the image locally for testing without publication.
+ Incompatible with candidate, multi-platform and registry cache modes.
+ default: "true"
+ required: false
oci-registry:
description: |
OCI registry configuration used to pull, push and cache images.
@@ -163,6 +173,9 @@ inputs:
required: false
outputs:
+ image-id:
+ description: Exact local Docker image ID when push is false. It does not certify any registry digest.
+ value: ${{ steps.local-image.outputs.image-id }}
built-image:
description: |
Built image data.
@@ -191,15 +204,29 @@ outputs:
runs:
using: "composite"
steps:
+ - name: Validate output mode
+ uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
+ env:
+ PUSH: ${{ inputs.push }}
+ CANDIDATE: ${{ inputs.candidate }}
+ MULTI_PLATFORM: ${{ inputs.multi-platform }}
+ CACHE_TYPE: ${{ inputs.cache-type }}
+ with:
+ script: |
+ if (!['true', 'false'].includes(process.env.PUSH)) throw new Error('push must be true or false.');
+ if (process.env.PUSH === 'false' && (process.env.CANDIDATE === 'true' || process.env.MULTI_PLATFORM === 'true' || process.env.CACHE_TYPE === 'registry')) {
+ throw new Error('Local builds cannot use candidate, multi-platform or registry cache modes.');
+ }
+
- id: slugify-platform
- uses: hoverkraft-tech/ci-github-common/actions/slugify@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1
+ uses: hoverkraft-tech/ci-github-common/actions/slugify@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0
with:
value: ${{ inputs.platform }}
- id: docker-setup
uses: $/actions/docker/setup
with:
- oci-registry: ${{ inputs.oci-registry }}
+ oci-registry: ${{ inputs.push != 'false' && inputs.oci-registry || '' }}
oci-registry-username: ${{ inputs.oci-registry-username }}
oci-registry-password: ${{ inputs.oci-registry-password }}
buildkitd-config-inline: ${{ inputs.buildkitd-config-inline }}
@@ -207,7 +234,7 @@ runs:
- id: metadata
uses: $/actions/docker/get-image-metadata
with:
- oci-registry: ${{ steps.docker-setup.outputs.push-registry }}
+ oci-registry: ${{ steps.docker-setup.outputs.push-registry || 'ghcr.io' }}
repository: ${{ inputs.repository }}
image: ${{ inputs.image }}
tag: ${{ inputs.tag }}
@@ -434,12 +461,30 @@ runs:
cache-to: ${{ steps.cache-inputs.outputs.cache-to }}
no-cache: ${{ steps.get-docker-config.outputs.cache-disabled }}
image-outputs: |
- ${{ steps.get-docker-config.outputs.multi-platform && 'type=image,push-by-digest=true,name-canonical=true,push=true' || 'type=image,push=true' }}
+ ${{ inputs.push == 'false' && 'type=docker' ||
+ steps.get-docker-config.outputs.multi-platform &&
+ 'type=image,push-by-digest=true,name-canonical=true,push=true' || 'type=image,push=true' }}
labels: ${{ steps.metadata.outputs.labels }}
annotations: ${{ steps.metadata.outputs.annotations }}
tags: ${{ steps.get-docker-config.outputs.multi-platform && steps.metadata.outputs.image || steps.metadata.outputs.tags }}
+ - id: local-image
+ if: inputs.push == 'false'
+ uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
+ env:
+ IMAGE_TAGS: ${{ steps.metadata.outputs.tags }}
+ with:
+ script: |
+ const tag = process.env.IMAGE_TAGS.split('\n').find(value => value.trim());
+ if (!tag) throw new Error('The local build did not produce an image tag.');
+ // Docker's containerd store may identify the image by its manifest, not its config digest.
+ const { stdout } = await exec.getExecOutput('docker', ['image', 'inspect', '--format', '{{.Id}}', tag.trim()]);
+ const imageId = stdout.trim();
+ if (!/^sha256:[a-f0-9]{64}$/.test(imageId)) throw new Error('Docker did not return an exact local image ID.');
+ core.setOutput('image-id', imageId);
+
- id: get-built-image
+ if: inputs.push != 'false'
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
BUILT_METADATA: ${{ steps.build.outputs.metadata }}
diff --git a/actions/docker/get-image-metadata/action.yml b/actions/docker/get-image-metadata/action.yml
index 9d4e3c56..8372cd4b 100644
--- a/actions/docker/get-image-metadata/action.yml
+++ b/actions/docker/get-image-metadata/action.yml
@@ -62,7 +62,7 @@ runs:
- id: get-issue-number
if: inputs.tag == '' && (github.event_name == 'pull_request' || github.event_name == 'pull_request_review' || github.event_name == 'issue_comment')
- uses: hoverkraft-tech/ci-github-common/actions/get-issue-number@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1
+ uses: hoverkraft-tech/ci-github-common/actions/get-issue-number@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0
- id: define-metadata-inputs
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
diff --git a/actions/docker/promote-images/package.json b/actions/docker/promote-images/package.json
index 868fa698..8ecfe2cc 100644
--- a/actions/docker/promote-images/package.json
+++ b/actions/docker/promote-images/package.json
@@ -7,8 +7,6 @@
},
"scripts": {
"test": "node --test",
- "test:watch": "node --test --watch",
- "pretest:ci": "node -e \"require('node:fs').mkdirSync('coverage', { recursive: true })\"",
- "test:ci": "node --experimental-test-coverage --test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=coverage/junit.xml --test-reporter=lcov --test-reporter-destination=coverage/lcov.info --test"
+ "test:watch": "node --test --watch"
}
}
diff --git a/actions/docker/prune-pull-requests-image-tags/action.yml b/actions/docker/prune-pull-requests-image-tags/action.yml
index 6475f84f..7b204017 100644
--- a/actions/docker/prune-pull-requests-image-tags/action.yml
+++ b/actions/docker/prune-pull-requests-image-tags/action.yml
@@ -48,7 +48,7 @@ runs:
image: ${{ inputs.image }}
- id: is-organization-or-user
- uses: hoverkraft-tech/ci-github-common/actions/repository-owner-is-organization@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1
+ uses: hoverkraft-tech/ci-github-common/actions/repository-owner-is-organization@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0
- id: get-tags-to-delete
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
diff --git a/actions/docker/prune-pull-requests-image-tags/package.json b/actions/docker/prune-pull-requests-image-tags/package.json
index 5f1309a8..a01f97d3 100644
--- a/actions/docker/prune-pull-requests-image-tags/package.json
+++ b/actions/docker/prune-pull-requests-image-tags/package.json
@@ -7,8 +7,6 @@
},
"scripts": {
"test": "node --test",
- "test:watch": "node --test --watch",
- "pretest:ci": "node -e \"require('node:fs').mkdirSync('coverage', { recursive: true })\"",
- "test:ci": "node --experimental-test-coverage --test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=coverage/junit.xml --test-reporter=lcov --test-reporter-destination=coverage/lcov.info --test"
+ "test:watch": "node --test --watch"
}
}
diff --git a/actions/docker/setup/README.md b/actions/docker/setup/README.md
index 7ae251c6..d3d3e1b6 100644
--- a/actions/docker/setup/README.md
+++ b/actions/docker/setup/README.md
@@ -31,9 +31,10 @@ Shared action to configure Docker tooling and OCI registry authentication.
## Usage
````yaml
-- uses: hoverkraft-tech/ci-github-container/actions/docker/setup@a5dc1ea7c1f4c2dffc3267c5be7304d01284f2ec # 4.2.1
+- uses: hoverkraft-tech/ci-github-container/actions/docker/setup@3473c05d91cce6e29c8bf688be5dfd51a533221c # feat/unified-ci-reports
with:
# OCI registry configuration used to pull, push and cache images.
+ # Set empty to configure Docker tooling without registry authentication.
# Accepts either a registry hostname string (default format) or a JSON object.
# JSON example: `{"pull":"docker.io","pull:private":"ghcr.io","push":"ghcr.io"}`
#
@@ -108,6 +109,7 @@ Shared action to configure Docker tooling and OCI registry authentication.
| **Input** | **Description** | **Required** | **Default** |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------ | ----------------------- |
| **`oci-registry`** | OCI registry configuration used to pull, push and cache images. | **true** | `ghcr.io` |
+| | Set empty to configure Docker tooling without registry authentication. | | |
| | Accepts either a registry hostname string (default format) or a JSON object. | | |
| | JSON example: `{"pull":"docker.io","pull:private":"ghcr.io","push":"ghcr.io"}` | | |
| **`oci-registry-username`** | Username configuration used to log against OCI registries. | **false** | - |
diff --git a/actions/docker/setup/action.yml b/actions/docker/setup/action.yml
index a2a96b91..bb647966 100644
--- a/actions/docker/setup/action.yml
+++ b/actions/docker/setup/action.yml
@@ -11,6 +11,7 @@ inputs:
oci-registry:
description: |
OCI registry configuration used to pull, push and cache images.
+ Set empty to configure Docker tooling without registry authentication.
Accepts either a registry hostname string (default format) or a JSON object.
JSON example: `{"pull":"docker.io","pull:private":"ghcr.io","push":"ghcr.io"}`
default: "ghcr.io"
@@ -328,6 +329,11 @@ runs:
return;
}
+ if (!process.env.REGISTRY_INPUT?.trim()) {
+ setOutputs({});
+ return;
+ }
+
const registryInput = normalizeRoleMapInput(registryInputName, `${process.env.REGISTRY_INPUT || ''}`);
let pushRegistry = '';
diff --git a/actions/docker/test-image/README.md b/actions/docker/test-image/README.md
index 7013ee7a..f8b33c71 100644
--- a/actions/docker/test-image/README.md
+++ b/actions/docker/test-image/README.md
@@ -13,10 +13,7 @@
[](https://github.com/marketplace/actions/docker---test-image)
[](https://github.com/hoverkraft-tech/ci-github-container/releases)
-[](http://choosealicense.com/licenses/mit/)
[](https://img.shields.io/github/stars/hoverkraft-tech/ci-github-container?style=social)
-[](https://github.com/hoverkraft-tech/ci-github-container/blob/main/CONTRIBUTING.md)
-
@@ -37,22 +34,46 @@ explicitly for mixed directories. A failed run never switches engines.
The released runner supplies Testcontainers and runs trusted suites as root with
Docker access. `TESTED_IMAGE_REF` is the resolved local image ID;
`TESTED_IMAGE_SOURCE` and `TESTED_IMAGE_PLATFORM` identify the original input and platform.
-- [Goss example](../../../tests/container-image/goss/goss.yaml): use `goss.yaml`
- and optional `goss_wait.yaml`. The image must stay running and provide `sh`;
- use Node for CLI or shell-less images. Goss keeps the image's user and entrypoint.
+- [Goss image example](../../../tests/container-image/goss-image/goss.yaml): use
+ `goss.yaml` to check installed tools, files, permissions or application imports.
+ Goss runs as the container's command and exits after the suite finishes.
+ It preserves the image's user, environment and working directory, without starting
+ the application or requiring its external services. Goss and the suite are mounted
+ read-only. Command assertions require `sh` in the image.
+- [Goss HTTP example](../../../tests/container-image/goss/goss.yaml): a native
+ `command` can call a [project-owned script](../../../tests/container-image/goss/check-http.sh)
+ that starts the application, waits for readiness, checks responses and stops it.
+ Keep these steps in the same script because Goss checks may run concurrently.
+ Consumers can adapt their Goss suites without switching to Testcontainers.
+ The suite owns application startup and cleanup; the action bounds execution and
+ removes its container. A separate `goss_wait.yaml` is rejected instead of silently ignored.
+
+Goss suites can include a [docker-args file](../../../tests/container-image/goss-image/docker-args)
+shared with local Docker execution. Put one complete option per line, without shell
+quoting or expansion; empty lines and lines starting with `#` are allowed. Supported
+options are `--read-only`, `--cap-drop=...`, `--security-opt=no-new-privileges` and
+`--tmpfs=/path:options`. `/goss` and `/goss-bin` are reserved for the suite and binary.
+Other options fail preparation so callers cannot replace the tested image, user,
+entrypoint, platform or cleanup labels. Testcontainers suites configure their own
+runtime through the native API and reject this file.
Native JUnit reports and diagnostics are retained for seven days, including after
failures. Missing, stale, invalid, empty or all-skipped results fail validation.
-Use the common `ci-reports` workflow with producer jobs in `needs`, `if: always()`
-and `job-results` set to the JSON representation of `needs`. Set `report-group` to the outer job ID.
-The action posts no PR comments and cleans only its own resources; cancellation
+Producer jobs require actions: read and contents: read, with Git and source checked out.
+Prepare a fresh directory before running the suite; validate and retain reports
+after execution. Call common `publish-ci-reports` once after all producer jobs using
+`job-results: toJSON(needs)`. A separate `CI complete` gate requires all producer
+jobs and report publication to succeed. No report plans or artifact IDs need forwarding.
+The action leaves annotations, summaries and comments to the terminal reporter and cleans only its own resources; cancellation
cleanup is best effort. Keep native suite cleanup in place.
`validation` is available only after successful execution, reporting and cleanup.
For promotion, forward the original producer entry matching the tested registry
digest and require every suite/platform job. Local image IDs and single-platform
checks do not certify a later push or an entire multi-platform index.
-See [ADR 0014](../../../docs/adr/0014-standardize-container-image-tests.md) for the contract.
+See [ADR 0014](../../../docs/adr/0014-standardize-container-image-tests.md) for image validation
+and [ADR 0016](../../../docs/adr/0016-register-native-container-reports.md) for reporting.
+[ADR 0018](../../../docs/adr/0018-let-goss-suites-own-application-startup.md) defines suite-owned startup.
Run the same suites locally from a checkout with Node.js 24+ and Docker. Set
`IMAGE_DIGEST_REFERENCE` to the candidate's digest reference; tool versions come
@@ -71,7 +92,7 @@ node actions/docker/test-image/bin/test-image.mjs \
## Usage
```yaml
-- uses: hoverkraft-tech/ci-github-container/actions/docker/test-image@a5dc1ea7c1f4c2dffc3267c5be7304d01284f2ec # 4.2.1
+- uses: hoverkraft-tech/ci-github-container/actions/docker/test-image@c9f519911d8da51954e46cc38598060a0c03aab4 # feat/unified-ci-reports
with:
# Fully qualified registry reference containing @sha256, or an exact local Docker sha256 image ID. Tag-only references are rejected.
# This input is required.
@@ -85,21 +106,23 @@ node actions/docker/test-image/bin/test-image.mjs \
# Default: `auto`
engine: auto
- # Requested Linux image platform (amd64 or arm64, optionally with variant). Defaults to the daemon's native platform. Configure compatible runners or emulation explicitly.
+ # Requested Linux image platform (amd64 or arm64, optionally with variant). Defaults to the daemon's native
+ # platform. Configure compatible runners or emulation explicitly.
platform: ""
- # Overall engine execution timeout in seconds, from 1 to 3600. Defaults to 300. Tool acquisition is separately bounded; Goss readiness is limited to 30 seconds or this timeout, whichever is shorter.
+ # Overall engine execution timeout in seconds, from 1 to 3600. Defaults to 300. Tool acquisition is
+ # separately bounded. Native suites define any readiness waits within this limit.
# Default: `300`
timeout: "300"
- # Optional native JUnit paths or globs, relative to working-directory or absolute, separated by newlines, commas or semicolons. Every explicit entry must match a new or changed report from this invocation. Defaults to the adapter's own JUnit report, which is always required for validation.
+ # Optional native JUnit paths or globs, relative to working-directory or absolute, separated by newlines,
+ # commas or semicolons. Every explicit entry must match a new or changed report from this invocation.
+ # Defaults to the adapter's own JUnit report, which is always required for validation.
report-file: ""
- # Report path mappings forwarded to the common parser. Defaults to mapping the Node runner suite path into working-directory. An explicit value replaces that mapping.
+ # Optional JSON object mapping native report source prefixes to repository-relative paths.
+ # Defaults to mapping the Node runner's /workspace/image prefix into working-directory.
path-mapping: ""
-
- # Outer calling job ID for consolidated ci-reports. Defaults to the current job ID. Use the job ID appearing in the reporting workflow's needs.
- report-group: ""
```
@@ -107,16 +130,20 @@ node actions/docker/test-image/bin/test-image.mjs \
## Inputs
-| **Input** | **Description** | **Required** | **Default** |
-| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------ | ----------- |
-| **`image`** | Fully qualified registry reference containing @sha256, or an exact local Docker sha256 image ID. Tag-only references are rejected. | **true** | - |
-| **`working-directory`** | Suite directory, absolute or relative to the repository root. | **false** | `.` |
-| **`engine`** | Test engine, auto, testcontainers-node or goss. Auto requires exactly one suite kind. | **false** | `auto` |
-| **`platform`** | Requested Linux image platform (amd64 or arm64, optionally with variant). Defaults to the daemon's native platform. Configure compatible runners or emulation explicitly. | **false** | - |
-| **`timeout`** | Overall engine execution timeout in seconds, from 1 to 3600. Defaults to 300. Tool acquisition is separately bounded; Goss readiness is limited to 30 seconds or this timeout, whichever is shorter. | **false** | `300` |
-| **`report-file`** | Optional native JUnit paths or globs, relative to working-directory or absolute, separated by newlines, commas or semicolons. Every explicit entry must match a new or changed report from this invocation. Defaults to the adapter's own JUnit report, which is always required for validation. | **false** | - |
-| **`path-mapping`** | Report path mappings forwarded to the common parser. Defaults to mapping the Node runner suite path into working-directory. An explicit value replaces that mapping. | **false** | - |
-| **`report-group`** | Outer calling job ID for consolidated ci-reports. Defaults to the current job ID. Use the job ID appearing in the reporting workflow's needs. | **false** | - |
+| **Input** | **Description** | **Required** | **Default** |
+| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- |
+| **`image`** | Fully qualified registry reference containing @sha256, or an exact local Docker sha256 image ID. Tag-only references are rejected. | **true** | - |
+| **`working-directory`** | Suite directory, absolute or relative to the repository root. | **false** | `.` |
+| **`engine`** | Test engine, auto, testcontainers-node or goss. Auto requires exactly one suite kind. | **false** | `auto` |
+| **`platform`** | Requested Linux image platform (amd64 or arm64, optionally with variant). Defaults to the daemon's native | **false** | - |
+| | platform. Configure compatible runners or emulation explicitly. | | |
+| **`timeout`** | Overall engine execution timeout in seconds, from 1 to 3600. Defaults to 300. Tool acquisition is | **false** | `300` |
+| | separately bounded. Native suites define any readiness waits within this limit. | | |
+| **`report-file`** | Optional native JUnit paths or globs, relative to working-directory or absolute, separated by newlines, | **false** | - |
+| | commas or semicolons. Every explicit entry must match a new or changed report from this invocation. | | |
+| | Defaults to the adapter's own JUnit report, which is always required for validation. | | |
+| **`path-mapping`** | Optional JSON object mapping native report source prefixes to repository-relative paths. | **false** | - |
+| | Defaults to mapping the Node runner's /workspace/image prefix into working-directory. | | |
@@ -125,36 +152,22 @@ node actions/docker/test-image/bin/test-image.mjs \
## Outputs
-| **Output** | **Description** |
-| ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| **`report-artifact-id`** | Native JUnit report artifact ID, including after failed tests. Empty when no valid report artifact is available. |
-| **`diagnostic-artifact-id`** | Engine and available container log artifact ID, including after failures and timeouts. |
-| **`validation`** | Successful image validation JSON with image identity, resolved engine, suite, observed platform, run/attempt, executed test counts and report/log paths. Empty on failure; a diagnostic artifact never establishes success. |
+| **Output** | **Description** |
+| ---------------------------- | ----------------------------------------------------------------------------------------------------- |
+| **`report-artifact-id`** | Native report bundle, including diagnostic metadata and available test reports after failures. |
+| **`diagnostic-artifact-id`** | Engine and available container log artifact ID, including after failures and timeouts. |
+| **`validation`** | Successful image validation JSON with image identity, resolved engine, suite, observed platform, |
+| | run/attempt, executed test counts and report/log paths. Empty on failure; a diagnostic artifact never |
+| | establishes success. |
-
-## Contributing
-
-Contributions are welcome! Please see the [contributing guidelines](https://github.com/hoverkraft-tech/ci-github-container/blob/main/CONTRIBUTING.md) for more details.
-
-
-## License
-
-This project is licensed under the MIT License.
-
-SPDX-License-Identifier: MIT
-
-Copyright © 2026 hoverkraft
-
-For more details, see the [license](http://choosealicense.com/licenses/mit/).
-
diff --git a/actions/docker/test-image/action.yml b/actions/docker/test-image/action.yml
index 8555f0e6..3a37fc74 100644
--- a/actions/docker/test-image/action.yml
+++ b/actions/docker/test-image/action.yml
@@ -15,22 +15,46 @@ description: |
The released runner supplies Testcontainers and runs trusted suites as root with
Docker access. `TESTED_IMAGE_REF` is the resolved local image ID;
`TESTED_IMAGE_SOURCE` and `TESTED_IMAGE_PLATFORM` identify the original input and platform.
- - [Goss example](../../../tests/container-image/goss/goss.yaml): use `goss.yaml`
- and optional `goss_wait.yaml`. The image must stay running and provide `sh`;
- use Node for CLI or shell-less images. Goss keeps the image's user and entrypoint.
+ - [Goss image example](../../../tests/container-image/goss-image/goss.yaml): use
+ `goss.yaml` to check installed tools, files, permissions or application imports.
+ Goss runs as the container's command and exits after the suite finishes.
+ It preserves the image's user, environment and working directory, without starting
+ the application or requiring its external services. Goss and the suite are mounted
+ read-only. Command assertions require `sh` in the image.
+ - [Goss HTTP example](../../../tests/container-image/goss/goss.yaml): a native
+ `command` can call a [project-owned script](../../../tests/container-image/goss/check-http.sh)
+ that starts the application, waits for readiness, checks responses and stops it.
+ Keep these steps in the same script because Goss checks may run concurrently.
+ Consumers can adapt their Goss suites without switching to Testcontainers.
+ The suite owns application startup and cleanup; the action bounds execution and
+ removes its container. A separate `goss_wait.yaml` is rejected instead of silently ignored.
+
+ Goss suites can include a [docker-args file](../../../tests/container-image/goss-image/docker-args)
+ shared with local Docker execution. Put one complete option per line, without shell
+ quoting or expansion; empty lines and lines starting with `#` are allowed. Supported
+ options are `--read-only`, `--cap-drop=...`, `--security-opt=no-new-privileges` and
+ `--tmpfs=/path:options`. `/goss` and `/goss-bin` are reserved for the suite and binary.
+ Other options fail preparation so callers cannot replace the tested image, user,
+ entrypoint, platform or cleanup labels. Testcontainers suites configure their own
+ runtime through the native API and reject this file.
Native JUnit reports and diagnostics are retained for seven days, including after
failures. Missing, stale, invalid, empty or all-skipped results fail validation.
- Use the common `ci-reports` workflow with producer jobs in `needs`, `if: always()`
- and `job-results` set to the JSON representation of `needs`. Set `report-group` to the outer job ID.
- The action posts no PR comments and cleans only its own resources; cancellation
+ Producer jobs require actions: read and contents: read, with Git and source checked out.
+ Prepare a fresh directory before running the suite; validate and retain reports
+ after execution. Call common `publish-ci-reports` once after all producer jobs using
+ `job-results: toJSON(needs)`. A separate `CI complete` gate requires all producer
+ jobs and report publication to succeed. No report plans or artifact IDs need forwarding.
+ The action leaves annotations, summaries and comments to the terminal reporter and cleans only its own resources; cancellation
cleanup is best effort. Keep native suite cleanup in place.
`validation` is available only after successful execution, reporting and cleanup.
For promotion, forward the original producer entry matching the tested registry
digest and require every suite/platform job. Local image IDs and single-platform
checks do not certify a later push or an entire multi-platform index.
- See [ADR 0014](../../../docs/adr/0014-standardize-container-image-tests.md) for the contract.
+ See [ADR 0014](../../../docs/adr/0014-standardize-container-image-tests.md) for image validation
+ and [ADR 0016](../../../docs/adr/0016-register-native-container-reports.md) for reporting.
+ [ADR 0018](../../../docs/adr/0018-let-goss-suites-own-application-startup.md) defines suite-owned startup.
Run the same suites locally from a checkout with Node.js 24+ and Docker. Set
`IMAGE_DIGEST_REFERENCE` to the candidate's digest reference; tool versions come
@@ -50,60 +74,63 @@ branding:
inputs:
image:
- description: Fully qualified registry reference containing @sha256, or an exact local Docker sha256 image ID. Tag-only references are rejected.
+ description:
+ Fully qualified registry reference containing @sha256, or an exact
+ local Docker sha256 image ID. Tag-only references are rejected.
required: true
working-directory:
description: Suite directory, absolute or relative to the repository root.
default: .
engine:
- description: Test engine, auto, testcontainers-node or goss. Auto requires exactly one suite kind.
+ description: Test engine, auto, testcontainers-node or goss. Auto requires
+ exactly one suite kind.
default: auto
platform:
- description: >-
+ description: |-
Requested Linux image platform (amd64 or arm64, optionally with variant). Defaults to the daemon's native
platform. Configure compatible runners or emulation explicitly.
default: ""
timeout:
- description: >-
- Overall engine execution timeout in seconds, from 1 to 3600. Defaults to 300. Tool acquisition is separately
- bounded; Goss readiness is limited to 30 seconds or this timeout, whichever is shorter.
+ description: |-
+ Overall engine execution timeout in seconds, from 1 to 3600. Defaults to 300. Tool acquisition is
+ separately bounded. Native suites define any readiness waits within this limit.
default: "300"
report-file:
- description: >-
- Optional native JUnit paths or globs, relative to working-directory or absolute, separated by newlines, commas
- or semicolons. Every explicit entry must match a new or changed report from this invocation. Defaults to the
- adapter's own JUnit report, which is always required for validation.
+ description: |-
+ Optional native JUnit paths or globs, relative to working-directory or absolute, separated by newlines,
+ commas or semicolons. Every explicit entry must match a new or changed report from this invocation.
+ Defaults to the adapter's own JUnit report, which is always required for validation.
default: ""
path-mapping:
- description: >-
- Report path mappings forwarded to the common parser. Defaults to mapping the Node runner suite path into
- working-directory. An explicit value replaces that mapping.
- default: ""
- report-group:
- description: Outer calling job ID for consolidated ci-reports. Defaults to the current job ID. Use the job ID appearing in the reporting workflow's needs.
+ description: |-
+ Optional JSON object mapping native report source prefixes to repository-relative paths.
+ Defaults to mapping the Node runner's /workspace/image prefix into working-directory.
default: ""
outputs:
report-artifact-id:
- description: Native JUnit report artifact ID, including after failed tests. Empty when no valid report artifact is available.
- value: ${{ steps.upload-reports.outputs.artifact-id }}
+ description:
+ Native report bundle, including diagnostic metadata and available
+ test reports after failures.
+ value: ${{ steps.reports.outputs.artifact-id }}
diagnostic-artifact-id:
- description: Engine and available container log artifact ID, including after failures and timeouts.
+ description: Engine and available container log artifact ID, including after
+ failures and timeouts.
value: ${{ steps.upload-diagnostics.outputs.artifact-id }}
validation:
- description: >-
- Successful image validation JSON with image identity, resolved engine, suite, observed platform, run/attempt,
- executed test counts and report/log paths. Empty on failure; a diagnostic artifact never establishes success.
+ description: |-
+ Successful image validation JSON with image identity, resolved engine, suite, observed platform,
+ run/attempt, executed test counts and report/log paths. Empty on failure; a diagnostic artifact never
+ establishes success.
value: ${{ steps.validation.outputs.result }}
runs:
using: composite
steps:
- id: directory
- uses: hoverkraft-tech/ci-github-common/actions/working-directory@af0bdd6313bd49aaf4a8a7f0de005fb0db856b03 # 4.3.3
+ uses: hoverkraft-tech/ci-github-common/actions/working-directory@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0
with:
working-directory: ${{ inputs.working-directory }}
-
- name: Prepare container tests
id: prepare
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
@@ -115,23 +142,36 @@ runs:
PLATFORM: ${{ inputs.platform }}
TEST_TIMEOUT: ${{ inputs.timeout }}
REPORT_FILE: ${{ inputs.report-file }}
- REPORT_GROUP: ${{ inputs.report-group || github.job }}
+ PATH_MAPPING: ${{ inputs.path-mapping }}
with:
script: |
const path = require('node:path');
const { pathToFileURL } = require('node:url');
- const { ContainerTest } = await import(pathToFileURL(path.join(process.env.ACTION_PATH, 'dist/index.js')));
+ const { ContainerTest, ContainerReports } = await import(pathToFileURL(path.join(process.env.ACTION_PATH, 'dist/index.js')));
const test = await ContainerTest.prepare({
workingDirectory: process.env.DIRECTORY, image: process.env.IMAGE,
engine: process.env.ENGINE, platform: process.env.PLATFORM,
timeout: process.env.TEST_TIMEOUT, reportFile: process.env.REPORT_FILE,
- reportGroup: process.env.REPORT_GROUP,
});
const { state } = test;
core.info(`Selected ${state.engine}: ${state.tests.join(', ')}`);
core.setOutput('state', path.join(state.directory, 'state.json'));
core.setOutput('diagnostics', path.join(state.directory, 'diagnostics'));
- core.setOutput('diagnostic-name', `container-test-${state.attempt}-${state.group}-${state.id}`);
+ core.setOutput('diagnostic-name', `container-test-${state.attempt}-${state.id}`);
+ await test.resolve();
+ core.setOutput('definition', new ContainerReports(test.state).reportDefinition(process.env.GITHUB_WORKSPACE, process.env.PATH_MAPPING));
+
+ - name: Prepare fresh report directory
+ id: prepare-reports
+ uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
+ with:
+ script: |
+ const fs = require('node:fs');
+ const path = require('node:path');
+ core.setOutput('report-directory', fs.mkdtempSync(path.join(process.env.RUNNER_TEMP, 'ci-reports-')));
+ core.setOutput('definition', process.env.REPORT_DEFINITION);
+ env:
+ REPORT_DEFINITION: ${{ steps.prepare.outputs.definition }}
- name: Run container tests
id: run
@@ -147,64 +187,24 @@ runs:
const tooling = JSON.parse(require('node:fs').readFileSync(path.join(process.env.ACTION_PATH, 'tooling.json')));
await ContainerTest.load(process.env.TEST_STATE).run(tooling);
- - name: Select current native reports
+ - name: Stage current native reports
id: select-reports
- if: ${{ !cancelled() && steps.prepare.outcome == 'success' && steps.run.outcome != 'skipped' }}
+ if: ${{ !cancelled() && steps.prepare-reports.outcome == 'success' }}
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
ACTION_PATH: ${{ github.action_path }}
TEST_STATE: ${{ steps.prepare.outputs.state }}
+ REPORT_DIRECTORY: ${{ steps.prepare-reports.outputs.report-directory }}
with:
script: |
const path = require('node:path');
const { pathToFileURL } = require('node:url');
- const { ContainerTest } = await import(pathToFileURL(path.join(process.env.ACTION_PATH, 'dist/index.js')));
+ const { ContainerTest, ContainerReports } = await import(pathToFileURL(path.join(process.env.ACTION_PATH, 'dist/index.js')));
const test = ContainerTest.load(process.env.TEST_STATE);
- const { state } = test;
- const files = await test.reportFiles();
- core.setOutput('files', files.join('\n'));
- core.setOutput('path-mapping', state.engine === 'testcontainers-node' ? `/workspace/image:${state.workingDirectory}` : '');
- core.setOutput('json', files);
- const source = `${state.imageId.slice(7, 19)}-${state.engine}-${state.platform.replaceAll('/', '-')}`;
- core.setOutput('name', `ci-reports-${state.attempt}-${state.group}-${source}-${state.id}`);
- core.setOutput('title', `Container tests: ${source}`);
-
- - name: Report container test results
- id: reports
- if: ${{ !cancelled() && steps.select-reports.outcome == 'success' }}
- uses: hoverkraft-tech/ci-github-common/actions/quality/parse-ci-reports@af0bdd6313bd49aaf4a8a7f0de005fb0db856b03 # 4.3.3
- with:
- working-directory: ${{ steps.directory.outputs.absolute-path }}
- report-paths: ${{ steps.select-reports.outputs.files }}
- report-name: ${{ steps.select-reports.outputs.title }}
- path-mapping: ${{ inputs.path-mapping || steps.select-reports.outputs.path-mapping }}
- output-format: annotations,summary,markdown
- fail-on-error: "true"
-
- - name: Prepare parsed report artifact
- id: report-artifact
- if: ${{ !cancelled() && steps.select-reports.outcome == 'success' && steps.reports.outputs.parsed-files != '' }}
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
- env:
- PARSED_FILES: ${{ steps.reports.outputs.parsed-files }}
- with:
- script: |
- const files = JSON.parse(process.env.PARSED_FILES);
- if (!files.length) throw new Error('No native test reports were parsed.');
- core.setOutput('files', files.join('\n'));
-
- - name: Upload native test reports
- id: upload-reports
- if: ${{ !cancelled() && steps.report-artifact.outputs.files != '' }}
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
- with:
- name: ${{ steps.select-reports.outputs.name }}
- path: ${{ steps.report-artifact.outputs.files }}
- include-hidden-files: true
- if-no-files-found: error
- retention-days: 7
+ core.setOutput('json', await new ContainerReports(test.state).stageReports(process.env.REPORT_DIRECTORY));
- name: Validate executed test cases
+ id: validate
if: ${{ !cancelled() && steps.select-reports.outcome == 'success' }}
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
@@ -215,12 +215,24 @@ runs:
script: |
const path = require('node:path');
const { pathToFileURL } = require('node:url');
- const { ContainerTest } = await import(pathToFileURL(path.join(process.env.ACTION_PATH, 'dist/index.js')));
- ContainerTest.load(process.env.TEST_STATE).result(JSON.parse(process.env.REPORT_FILES));
+ const { ContainerTest, ContainerReports } = await import(pathToFileURL(path.join(process.env.ACTION_PATH, 'dist/index.js')));
+ new ContainerReports(ContainerTest.load(process.env.TEST_STATE).state).result(JSON.parse(process.env.REPORT_FILES));
+
+ - name: Prepare and retain reports
+ id: reports
+ if: ${{ !cancelled() && steps.prepare-reports.outcome == 'success' }}
+ uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0
+ with:
+ definition: ${{ steps.prepare-reports.outputs.definition }}
+ directory: ${{ steps.prepare-reports.outputs.report-directory }}
+ outcome:
+ ${{ steps.run.outcome == 'success' && steps.select-reports.outcome ==
+ 'success' && steps.validate.outcome == 'success' && 'success' ||
+ 'failure' }}
- name: Clean owned resources and tool files
id: cleanup
- if: ${{ always() && steps.prepare.outcome == 'success' }}
+ if: ${{ always() && steps.prepare.outputs.state != '' }}
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
ACTION_PATH: ${{ github.action_path }}
@@ -234,7 +246,7 @@ runs:
- name: Retain container diagnostics
id: upload-diagnostics
- if: ${{ !cancelled() && steps.prepare.outcome == 'success' }}
+ if: ${{ !cancelled() && steps.prepare.outputs.state != '' }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: ${{ steps.prepare.outputs.diagnostic-name }}
@@ -253,5 +265,5 @@ runs:
script: |
const path = require('node:path');
const { pathToFileURL } = require('node:url');
- const { ContainerTest } = await import(pathToFileURL(path.join(process.env.ACTION_PATH, 'dist/index.js')));
- return ContainerTest.load(process.env.TEST_STATE).result(JSON.parse(process.env.REPORT_FILES));
+ const { ContainerTest, ContainerReports } = await import(pathToFileURL(path.join(process.env.ACTION_PATH, 'dist/index.js')));
+ return new ContainerReports(ContainerTest.load(process.env.TEST_STATE).state).result(JSON.parse(process.env.REPORT_FILES));
diff --git a/actions/docker/test-image/bin/test-image.mjs b/actions/docker/test-image/bin/test-image.mjs
index fdeb8bae..4c26cf22 100644
--- a/actions/docker/test-image/bin/test-image.mjs
+++ b/actions/docker/test-image/bin/test-image.mjs
@@ -1,7 +1,7 @@
#!/usr/bin/env node
import { readFileSync } from "node:fs";
import { parseArgs } from "node:util";
-import { ContainerTest } from "../dist/index.js";
+import { ContainerReports, ContainerTest } from "../dist/index.js";
const { values } = parseArgs({
options: {
@@ -36,7 +36,15 @@ try {
readFileSync(new URL("../tooling.json", import.meta.url)),
);
await test.run(tooling);
- console.log(JSON.stringify(test.result(await test.reportFiles()), null, 2));
+ console.log(
+ JSON.stringify(
+ new ContainerReports(test.state).result(
+ await new ContainerReports(test.state).reportFiles(),
+ ),
+ null,
+ 2,
+ ),
+ );
} catch (error) {
console.error(error.message);
process.exitCode = 1;
diff --git a/actions/docker/test-image/dist/index.js b/actions/docker/test-image/dist/index.js
index 1625b660..c30b75dc 100644
--- a/actions/docker/test-image/dist/index.js
+++ b/actions/docker/test-image/dist/index.js
@@ -26,105 +26,20 @@ var __webpack_exports__ = {};
// EXPORTS
__nccwpck_require__.d(__webpack_exports__, {
Vk: () => (/* reexport */ Configuration),
- MT: () => (/* binding */ ContainerTest),
+ d5: () => (/* reexport */ ContainerReports),
+ MT: () => (/* reexport */ ContainerTest),
eM: () => (/* reexport */ Reports),
di: () => (/* reexport */ Tooling)
});
-;// CONCATENATED MODULE: external "node:fs"
-const external_node_fs_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs");
-;// CONCATENATED MODULE: external "node:path"
-const external_node_path_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:path");
-;// CONCATENATED MODULE: external "node:child_process"
-const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:child_process");
-;// CONCATENATED MODULE: ./src/command.js
-
-
-
-class Command {
- constructor({ signal, timeout = 300_000 } = {}) {
- this.signal = signal;
- this.deadline = Date.now() + timeout;
- }
-
- async run(
- file,
- args,
- { cwd, env, log, stdoutFile, quiet = true, allowFailure = false } = {},
- ) {
- const remaining = this.deadline - Date.now();
- if (remaining <= 0 || this.signal?.aborted)
- throw new Error("Container test execution timed out or was cancelled.");
- const output = log ? (0,external_node_fs_namespaceObject.openSync)(log, "a", 0o600) : undefined;
- const report = stdoutFile ? (0,external_node_fs_namespaceObject.openSync)(stdoutFile, "w", 0o600) : undefined;
- try {
- return await new Promise((resolve, reject) => {
- const child = (0,external_node_child_process_namespaceObject.spawn)(file, args, {
- cwd,
- env: { ...process.env, ...env },
- detached: true,
- stdio: ["ignore", "pipe", "pipe"],
- });
- let text = "";
- let interrupted = false;
- let force;
- const kill = (signal) => {
- if (!child.pid) return;
- try {
- process.kill(-child.pid, signal);
- } catch (error) {
- if (error.code !== "ESRCH") reject(error);
- }
- };
- const terminate = () => {
- interrupted = true;
- if (!child.pid) return;
- kill("SIGTERM");
- force = setTimeout(() => kill("SIGKILL"), 5_000);
- force.unref();
- };
- const timer = setTimeout(terminate, remaining);
- timer.unref();
- this.signal?.addEventListener("abort", terminate, { once: true });
- const capture = (data, stderr) => {
- if (output !== undefined) (0,external_node_fs_namespaceObject.writeSync)(output, data);
- if (report !== undefined && !stderr) (0,external_node_fs_namespaceObject.writeSync)(report, data);
- if (!quiet && (stderr || report === undefined))
- (stderr ? process.stderr : process.stdout).write(data);
- if (!stderr && text.length < 2_000_000) text += data.toString();
- };
- child.stdout.on("data", (data) => capture(data, false));
- child.stderr.on("data", (data) => capture(data, true));
- child.on("error", reject);
- child.on("close", (code, signal) => {
- clearTimeout(timer);
- clearTimeout(force);
- this.signal?.removeEventListener("abort", terminate);
- if (interrupted) kill("SIGKILL");
- if (interrupted)
- return reject(
- new Error("Container test execution timed out or was cancelled."),
- );
- if (code !== 0 && !allowFailure)
- return reject(
- new Error(
- `${file} exited with ${code ?? signal}. See the engine log for diagnostics.`,
- ),
- );
- resolve({ code, stdout: text });
- });
- });
- } finally {
- if (output !== undefined) (0,external_node_fs_namespaceObject.closeSync)(output);
- if (report !== undefined) (0,external_node_fs_namespaceObject.closeSync)(report);
- }
- }
-}
-
;// CONCATENATED MODULE: external "node:crypto"
const external_node_crypto_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:crypto");
+;// CONCATENATED MODULE: external "node:fs"
+const external_node_fs_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs");
;// CONCATENATED MODULE: external "node:os"
const external_node_os_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:os");
+;// CONCATENATED MODULE: external "node:path"
+const external_node_path_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:path");
;// CONCATENATED MODULE: ./node_modules/fast-xml-parser/src/util.js
@@ -7421,7 +7336,7 @@ class XMLParser {
return XmlNode.getMetaDataSymbol();
}
}
-;// CONCATENATED MODULE: ./src/reports.js
+;// CONCATENATED MODULE: ./src/Reports.js
@@ -7532,7 +7447,7 @@ class Reports {
}
}
-;// CONCATENATED MODULE: ./src/configuration.js
+;// CONCATENATED MODULE: ./src/Configuration.js
@@ -7603,6 +7518,42 @@ class Configuration {
return [os, normalized, variant].filter(Boolean).join("/");
}
+ static dockerArgs(directory) {
+ const file = external_node_path_namespaceObject.join(directory, "docker-args");
+ if (!(0,external_node_fs_namespaceObject.existsSync)(file)) return [];
+ const args = (0,external_node_fs_namespaceObject.readFileSync)(file, "utf8")
+ .split(/\r?\n/)
+ .map((line) => line.trim())
+ .filter((line) => line && !line.startsWith("#"));
+ for (const arg of args) {
+ if (
+ arg === "--read-only" ||
+ /^--cap-drop=[A-Z_]+$/.test(arg) ||
+ /^--security-opt=no-new-privileges(?:=true)?$/.test(arg)
+ )
+ continue;
+ const tmpfs = /^--tmpfs=(\/[a-zA-Z0-9_./-]+):([a-zA-Z0-9_,=.-]+)$/.exec(
+ arg,
+ );
+ if (tmpfs) {
+ const target = tmpfs[1];
+ if (
+ target === external_node_path_namespaceObject.posix.normalize(target) &&
+ target !== "/" &&
+ target !== "/goss-bin" &&
+ !target.startsWith("/goss-bin/") &&
+ target !== "/goss" &&
+ !target.startsWith("/goss/")
+ )
+ continue;
+ }
+ throw new Error(
+ `Unsupported docker-args entry: ${arg}. Use --read-only, --cap-drop=..., --security-opt=no-new-privileges or --tmpfs=/path:options; /goss and /goss-bin are reserved.`,
+ );
+ }
+ return args;
+ }
+
async prepare() {
const { inputs, environment } = this;
const workingDirectory = (0,external_node_fs_namespaceObject.realpathSync)(inputs.workingDirectory || ".");
@@ -7618,6 +7569,21 @@ class Configuration {
workingDirectory,
inputs.engine || "auto",
);
+ const dockerArgs = Configuration.dockerArgs(workingDirectory);
+ if (
+ selection.engine !== "goss" &&
+ (0,external_node_fs_namespaceObject.existsSync)(external_node_path_namespaceObject.join(workingDirectory, "docker-args"))
+ )
+ throw new Error(
+ "docker-args applies only to Goss suites; configure Testcontainers in the native suite.",
+ );
+ if (
+ selection.engine === "goss" &&
+ (0,external_node_fs_namespaceObject.existsSync)(external_node_path_namespaceObject.join(workingDirectory, "goss_wait.yaml"))
+ )
+ throw new Error(
+ "goss_wait.yaml is not executed. Keep startup, readiness and cleanup in a goss.yaml command or script, then remove this file.",
+ );
const timeout = String(inputs.timeout || "300");
if (!/^[1-9][0-9]*$/.test(timeout) || Number(timeout) > 3600)
throw new Error("timeout must be an integer from 1 to 3600 seconds.");
@@ -7628,11 +7594,6 @@ class Configuration {
throw new Error(
"platform must be linux/amd64 or linux/arm64, optionally with a variant.",
);
- const group = inputs.reportGroup || environment.GITHUB_JOB || "local";
- if (!/^[\w-]+$/.test(group))
- throw new Error(
- "report-group must be a job ID containing letters, numbers, underscores or hyphens.",
- );
const baseline = {};
if (inputs.reportFile)
for (const file of await Reports.select(
@@ -7649,6 +7610,7 @@ class Configuration {
(0,external_node_fs_namespaceObject.mkdirSync)(external_node_path_namespaceObject.join(directory, child));
return {
...selection,
+ dockerArgs,
image: inputs.image,
identityKind,
workingDirectory,
@@ -7656,7 +7618,6 @@ class Configuration {
id,
timeout: Number(timeout),
requestedPlatform: inputs.platform || "",
- group,
attempt: environment.GITHUB_RUN_ATTEMPT || "1",
run: environment.GITHUB_RUN_ID || "local",
reportFile: inputs.reportFile || "",
@@ -7668,134 +7629,223 @@ class Configuration {
}
}
-;// CONCATENATED MODULE: ./src/tooling.js
+;// CONCATENATED MODULE: ./src/ContainerReports.js
-class Tooling {
- constructor(manifest) {
- this.manifest = manifest;
+class ContainerReports {
+ constructor(state) {
+ this.state = state;
+ }
+ reportDefinition(workspace, mapping) {
+ const { state } = this;
+ if (!state.imageId || !state.platform)
+ throw new Error("Resolve the image before registering its test reports.");
+ const project =
+ external_node_path_namespaceObject.relative((0,external_node_fs_namespaceObject.realpathSync)(workspace), state.workingDirectory)
+ .split(external_node_path_namespaceObject.sep)
+ .join("/") || ".";
+ return {
+ name: "Container image tests",
+ project,
+ variant: {
+ engine: state.engine,
+ platform: state.platform,
+ },
+ subject: {
+ kind: "image",
+ name: state.image,
+ digest: state.imageId,
+ engine: state.engine,
+ platform: state.platform,
+ },
+ reports: [
+ { kind: "test", pattern: "junit.xml" },
+ ...(state.reportFile
+ ? [{ kind: "test", pattern: "additional/*.xml", optional: true }]
+ : []),
+ ],
+ "path-mapping": mapping
+ ? JSON.parse(mapping)
+ : state.engine === "testcontainers-node"
+ ? { "/workspace/image": project }
+ : {},
+ };
}
- static async download(url) {
- const response = await fetch(url, { signal: AbortSignal.timeout(30_000) });
- if (!response.ok)
- throw new Error(`Tool download failed (${response.status}): ${url}`);
- const bytes = Buffer.from(await response.arrayBuffer());
- if (bytes.length > 40_000_000)
- throw new Error("Unexpectedly large tool download.");
- return bytes;
+ async stageReports(directory) {
+ const copy = (source, destination) => {
+ if (!(0,external_node_fs_namespaceObject.lstatSync)(source).isFile())
+ throw new Error(
+ "Native reports must be regular files without symlinks.",
+ );
+ Reports.fingerprint(source);
+ (0,external_node_fs_namespaceObject.copyFileSync)(source, destination);
+ };
+ // Keep the engine's evidence even if an additional required report is missing.
+ if ((0,external_node_fs_namespaceObject.existsSync)(this.state.junit))
+ copy(this.state.junit, external_node_path_namespaceObject.join(directory, "junit.xml"));
+ const files = await this.reportFiles();
+ const additional = files.filter(
+ (file) => external_node_path_namespaceObject.resolve(file) !== external_node_path_namespaceObject.resolve(this.state.junit),
+ );
+ if (additional.length) (0,external_node_fs_namespaceObject.mkdirSync)(external_node_path_namespaceObject.join(directory, "additional"));
+ for (const [index, file] of additional.entries())
+ copy(file, external_node_path_namespaceObject.join(directory, "additional", `${index}.xml`));
+ return files;
}
- static verify(bytes, checksums, filename) {
- const line = checksums
- .trim()
- .split("\n")
- .find((entry) => entry.trim().endsWith(filename));
- const expected = line?.trim().split(/\s+/)[0];
- if (
- !/^[a-f0-9]{64}$/.test(expected || "") ||
- (0,external_node_crypto_namespaceObject.createHash)("sha256").update(bytes).digest("hex") !== expected
- )
- throw new Error(`SHA-256 verification failed for ${filename}`);
+ async reportFiles() {
+ const { state } = this;
+ const files = state.reportFile
+ ? await Reports.select(state.workingDirectory, state.reportFile)
+ : [state.junit];
+ for (const file of files) {
+ if (!(0,external_node_fs_namespaceObject.existsSync)(file))
+ throw new Error(`Missing native test report: ${file}`);
+ if (state.baseline[file] === Reports.fingerprint(file))
+ throw new Error(`Stale report from before this invocation: ${file}`);
+ new Reports(file).inspect();
+ }
+ return files;
}
- async goss(state, command) {
- const version = this.manifest.gossVersion;
- if (!/^v\d+\.\d+\.\d+$/.test(version))
- throw new Error("Invalid pinned Goss version.");
- const architecture =
- state.platform.split("/")[1] === "amd64" ? "x86_64" : "arm64";
- const archive = `goss_${version.slice(1)}_linux_${architecture}.tar.gz`;
- const base = `https://github.com/goss-org/goss/releases/download/${version}`;
- const [binary, sums, script, scriptSum] = await Promise.all([
- Tooling.download(`${base}/${archive}`),
- Tooling.download(`${base}/goss_${version.slice(1)}_SHA256SUMS`),
- Tooling.download(`${base}/dgoss`),
- Tooling.download(`${base}/dgoss.sha256`),
- ]);
- Tooling.verify(binary, sums.toString(), archive);
- Tooling.verify(script, scriptSum.toString(), "dgoss");
- const directory = external_node_path_namespaceObject.join(state.directory, "tools");
- const tarball = external_node_path_namespaceObject.join(directory, archive);
- (0,external_node_fs_namespaceObject.writeFileSync)(tarball, binary, { mode: 0o600 });
- (0,external_node_fs_namespaceObject.writeFileSync)(external_node_path_namespaceObject.join(directory, "dgoss"), script, { mode: 0o700 });
- await command.run("tar", [
- "--extract",
- "--gzip",
- "--file",
- tarball,
- "--directory",
- directory,
- "--no-same-owner",
- "--no-same-permissions",
- "goss",
- ]);
- (0,external_node_fs_namespaceObject.chmodSync)(external_node_path_namespaceObject.join(directory, "goss"), 0o700);
- return directory;
+ result(files) {
+ const { state } = this;
+ if (!state.succeeded || !state.executed)
+ throw new Error("Container tests did not succeed.");
+ Reports.validate([state.junit]);
+ const counts = Reports.validate(files, state.baseline);
+ return {
+ image: state.image,
+ "identity-kind": state.identityKind,
+ "image-id": state.imageId,
+ engine: state.engine,
+ suite: state.workingDirectory,
+ platform: state.platform,
+ "daemon-platform": state.daemonPlatform,
+ run: state.run,
+ attempt: state.attempt,
+ tests: counts,
+ reports: files,
+ logs: external_node_path_namespaceObject.join(state.directory, "diagnostics"),
+ };
}
}
-;// CONCATENATED MODULE: ./src/index.js
-
-
-
-
-
-
-
-
-
-const ownerLabel = "io.hoverkraft.container-test";
-const sessionLabel = "org.testcontainers.session-id";
-
-class ContainerTest {
- constructor(state) {
- this.state = state;
- }
+;// CONCATENATED MODULE: external "node:child_process"
+const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:child_process");
+;// CONCATENATED MODULE: ./src/Command.js
- static async prepare(inputs, environment) {
- const test = new ContainerTest(
- await new Configuration(inputs, environment).prepare(),
- );
- test.save();
- return test;
- }
- static load(file) {
- const state = JSON.parse((0,external_node_fs_namespaceObject.readFileSync)(file, "utf8"));
- if (
- !/^[a-f0-9-]{36}$/.test(state.id) ||
- external_node_path_namespaceObject.join(state.directory, "state.json") !== external_node_path_namespaceObject.resolve(file)
- )
- throw new Error("Invalid container test state.");
- return new ContainerTest(state);
- }
- save() {
- const { state } = this;
- (0,external_node_fs_namespaceObject.writeFileSync)(
- external_node_path_namespaceObject.join(state.directory, "state.json"),
- JSON.stringify(state),
- { mode: 0o600 },
- );
+class Command {
+ constructor({ signal, timeout = 300_000 } = {}) {
+ this.signal = signal;
+ this.deadline = Date.now() + timeout;
}
- async docker(command, args, options = {}) {
- const { state } = this;
- return command.run(
- "docker",
- [...(state.socket ? ["--host", `unix://${state.socket}`] : []), ...args],
- { log: state.log, ...options },
- );
+ async run(
+ file,
+ args,
+ { cwd, env, log, stdoutFile, quiet = true, allowFailure = false } = {},
+ ) {
+ const remaining = this.deadline - Date.now();
+ if (remaining <= 0 || this.signal?.aborted)
+ throw new Error("Container test execution timed out or was cancelled.");
+ const output = log ? (0,external_node_fs_namespaceObject.openSync)(log, "a", 0o600) : undefined;
+ const report = stdoutFile ? (0,external_node_fs_namespaceObject.openSync)(stdoutFile, "w", 0o600) : undefined;
+ try {
+ return await new Promise((resolve, reject) => {
+ const child = (0,external_node_child_process_namespaceObject.spawn)(file, args, {
+ cwd,
+ env: { ...process.env, ...env },
+ detached: true,
+ stdio: ["ignore", "pipe", "pipe"],
+ });
+ let text = "";
+ let interrupted = false;
+ let force;
+ const kill = (signal) => {
+ if (!child.pid) return;
+ try {
+ process.kill(-child.pid, signal);
+ } catch (error) {
+ if (error.code !== "ESRCH") reject(error);
+ }
+ };
+ const terminate = () => {
+ interrupted = true;
+ if (!child.pid) return;
+ kill("SIGTERM");
+ force = setTimeout(() => kill("SIGKILL"), 5_000);
+ force.unref();
+ };
+ const timer = setTimeout(terminate, remaining);
+ timer.unref();
+ this.signal?.addEventListener("abort", terminate, { once: true });
+ const capture = (data, stderr) => {
+ if (output !== undefined) (0,external_node_fs_namespaceObject.writeSync)(output, data);
+ if (report !== undefined && !stderr) (0,external_node_fs_namespaceObject.writeSync)(report, data);
+ if (!quiet && (stderr || report === undefined))
+ (stderr ? process.stderr : process.stdout).write(data);
+ if (!stderr && text.length < 2_000_000) text += data.toString();
+ };
+ child.stdout.on("data", (data) => capture(data, false));
+ child.stderr.on("data", (data) => capture(data, true));
+ child.on("error", reject);
+ child.on("close", (code, signal) => {
+ clearTimeout(timer);
+ clearTimeout(force);
+ this.signal?.removeEventListener("abort", terminate);
+ if (interrupted) kill("SIGKILL");
+ if (interrupted)
+ return reject(
+ new Error("Container test execution timed out or was cancelled."),
+ );
+ if (code !== 0 && !allowFailure)
+ return reject(
+ new Error(
+ `${file} exited with ${code ?? signal}. See the engine log for diagnostics.`,
+ ),
+ );
+ resolve({ code, stdout: text });
+ });
+ });
+ } finally {
+ if (output !== undefined) (0,external_node_fs_namespaceObject.closeSync)(output);
+ if (report !== undefined) (0,external_node_fs_namespaceObject.closeSync)(report);
+ }
}
+}
- async resolve(command) {
+;// CONCATENATED MODULE: ./src/DockerRuntime.js
+
+
+
+
+class DockerRuntime {
+ constructor(state) {
+ this.state = state;
+ }
+ get label() {
+ return `io.hoverkraft.container-test=${this.state.id}`;
+ }
+ async run(command, args, options = {}) {
+ const { state } = this;
+ return command.run(
+ "docker",
+ [...(state.socket ? ["--host", `unix://${state.socket}`] : []), ...args],
+ { log: state.log, ...options },
+ );
+ }
+
+ async resolve(command = new Command({ timeout: 180_000 })) {
const { state } = this;
let endpoint = process.env.DOCKER_HOST;
if (!endpoint || process.env.DOCKER_CONTEXT) {
- const context = await this.docker(command, ["context", "inspect"]);
+ const context = await this.run(command, ["context", "inspect"]);
endpoint = JSON.parse(context.stdout)[0]?.Endpoints?.docker?.Host;
}
if (!endpoint?.startsWith("unix://"))
@@ -7805,7 +7855,7 @@ class ContainerTest {
throw new Error("Docker endpoint is not a Unix socket.");
const info = JSON.parse(
(
- await this.docker(command, ["info", "--format", "{{json .}}"], {
+ await this.run(command, ["info", "--format", "{{json .}}"], {
log: undefined,
})
).stdout,
@@ -7816,10 +7866,10 @@ class ContainerTest {
);
const expected = state.requestedPlatform || state.daemonPlatform;
if (state.identityKind === "registry")
- await this.docker(command, ["pull", "--platform", expected, state.image]);
+ await this.run(command, ["pull", "--platform", expected, state.image]);
const image = JSON.parse(
(
- await this.docker(command, ["image", "inspect", state.image], {
+ await this.run(command, ["image", "inspect", state.image], {
log: undefined,
})
).stdout,
@@ -7839,11 +7889,198 @@ class ContainerTest {
);
if (state.identityKind === "local" && state.image !== state.imageId)
throw new Error("Local image identity changed.");
- this.save();
}
+}
- async node(tooling, command) {
- const { state } = this;
+;// CONCATENATED MODULE: ./src/Tooling.js
+
+
+
+
+class Tooling {
+ constructor(manifest) {
+ this.manifest = manifest;
+ }
+
+ static async download(url) {
+ const response = await fetch(url, { signal: AbortSignal.timeout(30_000) });
+ if (!response.ok)
+ throw new Error(`Tool download failed (${response.status}): ${url}`);
+ const bytes = Buffer.from(await response.arrayBuffer());
+ if (bytes.length > 40_000_000)
+ throw new Error("Unexpectedly large tool download.");
+ return bytes;
+ }
+
+ static verify(bytes, checksums, filename) {
+ const line = checksums
+ .trim()
+ .split("\n")
+ .find((entry) => entry.trim().endsWith(filename));
+ const expected = line?.trim().split(/\s+/)[0];
+ if (
+ !/^[a-f0-9]{64}$/.test(expected || "") ||
+ (0,external_node_crypto_namespaceObject.createHash)("sha256").update(bytes).digest("hex") !== expected
+ )
+ throw new Error(`SHA-256 verification failed for ${filename}`);
+ }
+
+ async goss(state, command) {
+ const version = this.manifest.gossVersion;
+ if (!/^v\d+\.\d+\.\d+$/.test(version))
+ throw new Error("Invalid pinned Goss version.");
+ const architecture =
+ state.platform.split("/")[1] === "amd64" ? "x86_64" : "arm64";
+ const archive = `goss_${version.slice(1)}_linux_${architecture}.tar.gz`;
+ const base = `https://github.com/goss-org/goss/releases/download/${version}`;
+ const [binary, sums] = await Promise.all([
+ Tooling.download(`${base}/${archive}`),
+ Tooling.download(`${base}/goss_${version.slice(1)}_SHA256SUMS`),
+ ]);
+ Tooling.verify(binary, sums.toString(), archive);
+ const directory = external_node_path_namespaceObject.join(state.directory, "tools");
+ const tarball = external_node_path_namespaceObject.join(directory, archive);
+ (0,external_node_fs_namespaceObject.writeFileSync)(tarball, binary, { mode: 0o600 });
+ await command.run("tar", [
+ "--extract",
+ "--gzip",
+ "--file",
+ tarball,
+ "--directory",
+ directory,
+ "--no-same-owner",
+ "--no-same-permissions",
+ "goss",
+ ]);
+ // The tested image's user must be able to execute the read-only bind mount.
+ (0,external_node_fs_namespaceObject.chmodSync)(external_node_path_namespaceObject.join(directory, "goss"), 0o755);
+ return directory;
+ }
+}
+
+;// CONCATENATED MODULE: ./src/GossTest.js
+
+
+
+class GossTest {
+ constructor(runtime, tooling) {
+ this.runtime = runtime;
+ this.tooling = tooling;
+ }
+ async prepare(command) {
+ await new Tooling(this.tooling).goss(this.runtime.state, command);
+ }
+ async run(command) {
+ const { state } = this.runtime;
+ const directory = external_node_path_namespaceObject.join(state.directory, "tools");
+ await this.runtime.run(
+ command,
+ [
+ "run",
+ ...state.dockerArgs,
+ "--name",
+ state.runnerName,
+ "--label",
+ this.runtime.label,
+ "--platform",
+ state.platform,
+ "--volume",
+ `${external_node_path_namespaceObject.join(directory, "goss")}:/goss-bin:ro`,
+ "--volume",
+ `${state.workingDirectory}:/goss:ro`,
+ "--entrypoint",
+ "/goss-bin",
+ state.imageId,
+ "-g",
+ "/goss/goss.yaml",
+ "validate",
+ "--format",
+ "junit",
+ ],
+ { stdoutFile: state.junit, quiet: false },
+ );
+ }
+}
+
+;// CONCATENATED MODULE: ./src/OwnedResources.js
+
+
+
+/** Remove only resources bearing this invocation's ownership/session label. */
+class OwnedResources {
+ constructor(runtime) {
+ this.runtime = runtime;
+ }
+ async remove() {
+ const { state } = this.runtime;
+ if (!state.socket) return;
+ const command = new Command({ timeout: 45_000 });
+ for (const label of [
+ this.runtime.label,
+ `org.testcontainers.session-id=${state.id}`,
+ ]) {
+ const found = async (kind) =>
+ (
+ await this.runtime.run(command, [
+ kind,
+ "ls",
+ ...(kind === "container" ? ["--all"] : []),
+ "--quiet",
+ "--filter",
+ `label=${label}`,
+ ])
+ ).stdout
+ .trim()
+ .split("\n")
+ .filter(Boolean);
+ for (const id of await found("container")) {
+ await this.runtime.run(command, ["logs", id], {
+ log: external_node_path_namespaceObject.join(state.directory, "diagnostics", `${id}.log`),
+ allowFailure: true,
+ });
+ const removed = await this.runtime.run(
+ command,
+ ["container", "rm", "--force", "--volumes", id],
+ { allowFailure: true },
+ );
+ if (removed.code !== 0 && (await found("container")).includes(id))
+ throw new Error(`Could not remove owned container ${id}`);
+ }
+ for (const kind of ["network", "volume"]) {
+ const ids = await found(kind);
+ if (ids.length) {
+ await this.runtime.run(command, [kind, "rm", ...ids], {
+ allowFailure: true,
+ });
+ if ((await found(kind)).length)
+ throw new Error(`Could not remove owned ${kind} resources.`);
+ }
+ }
+ }
+ }
+}
+
+;// CONCATENATED MODULE: ./src/TestcontainersTest.js
+
+
+
+class TestcontainersTest {
+ constructor(runtime, tooling) {
+ this.runtime = runtime;
+ this.tooling = tooling;
+ }
+ async prepare(command) {
+ for (const image of [this.tooling.nodeRunner, this.tooling.reaper])
+ await this.runtime.run(command, [
+ "pull",
+ "--platform",
+ this.runtime.state.daemonPlatform,
+ image,
+ ]);
+ }
+ async run(command) {
+ const { state } = this.runtime;
+ const tooling = this.tooling;
const bootstrap = external_node_path_namespaceObject.join(state.directory, "tools", "session.mjs");
// Use the runner's public Testcontainers API. Each worker gets an exclusive
// resource session, even when upstream reuses another invocation's Ryuk.
@@ -7863,7 +8100,7 @@ reaper.sessionId = process.env.CI_CONTAINER_TEST_SESSION;
"--name",
state.runnerName,
"--label",
- `${ownerLabel}=${state.id}`,
+ this.runtime.label,
"--network",
"host",
"--user",
@@ -7899,54 +8136,56 @@ reaper.sessionId = process.env.CI_CONTAINER_TEST_SESSION;
`--test-timeout=${state.timeout * 1000}`,
...state.tests.map((file) => `/workspace/image/${file}`),
);
- await this.docker(command, args, { quiet: false });
+ await this.runtime.run(command, args, { quiet: false });
+ }
+}
+
+;// CONCATENATED MODULE: ./src/ContainerTest.js
+
+
+
+
+
+
+
+
+
+class ContainerTest {
+ constructor(state) {
+ this.state = state;
+ this.runtime = new DockerRuntime(state);
+ }
+ static async prepare(inputs, environment) {
+ const test = new ContainerTest(
+ await new Configuration(inputs, environment).prepare(),
+ );
+ test.save();
+ return test;
}
- async goss(command) {
+ static load(file) {
+ const state = JSON.parse((0,external_node_fs_namespaceObject.readFileSync)(file, "utf8"));
+ if (
+ !/^[a-f0-9-]{36}$/.test(state.id) ||
+ external_node_path_namespaceObject.join(state.directory, "state.json") !== external_node_path_namespaceObject.resolve(file)
+ )
+ throw new Error("Invalid container test state.");
+ return new ContainerTest(state);
+ }
+
+ save() {
const { state } = this;
- const directory = external_node_path_namespaceObject.join(state.directory, "tools");
- await command.run(
- "bash",
- [
- external_node_path_namespaceObject.join(directory, "dgoss"),
- "run",
- "--name",
- state.runnerName,
- "--label",
- `${ownerLabel}=${state.id}`,
- "--platform",
- state.platform,
- state.imageId,
- ],
- {
- cwd: state.workingDirectory,
- log: state.log,
- stdoutFile: state.junit,
- quiet: false,
- env: {
- DOCKER_HOST: `unix://${state.socket}`,
- DOCKER_CONTEXT: "",
- CONTAINER_RUNTIME: "docker",
- DEBUG: "",
- GOSS_PATH: external_node_path_namespaceObject.join(directory, "goss"),
- GOSS_FILES_PATH: state.workingDirectory,
- GOSS_FILE: "goss.yaml",
- GOSS_FILES_STRATEGY: "mount",
- GOSS_VARS: "",
- GOSS_ADDITIONAL_COPY_PATH: "",
- GOSS_OPTS: "--format junit",
- GOSS_WAIT_OPTS: `-r ${Math.min(30, state.timeout)}s -s 1s > /dev/null`,
- DGOSS_TEMP_DIR: directory,
- CONTAINER_LOG_OUTPUT: external_node_path_namespaceObject.join(
- state.directory,
- "diagnostics",
- "container.log",
- ),
- },
- },
+ (0,external_node_fs_namespaceObject.writeFileSync)(
+ external_node_path_namespaceObject.join(state.directory, "state.json"),
+ JSON.stringify(state),
+ { mode: 0o600 },
);
}
+ async resolve(command) {
+ await this.runtime.resolve(command);
+ this.save();
+ }
async run(tooling) {
const { state } = this;
const abort = new AbortController();
@@ -7956,30 +8195,24 @@ reaper.sessionId = process.env.CI_CONTAINER_TEST_SESSION;
let failure;
try {
const setup = new Command({ signal: abort.signal, timeout: 180_000 });
- await this.resolve(setup);
- if (state.engine === "testcontainers-node") {
- for (const image of [tooling.nodeRunner, tooling.reaper])
- await this.docker(setup, [
- "pull",
- "--platform",
- state.daemonPlatform,
- image,
- ]);
- } else await new Tooling(tooling).goss(state, setup);
+ if (!state.imageId) await this.resolve(setup);
+ const engine =
+ state.engine === "testcontainers-node"
+ ? new TestcontainersTest(this.runtime, tooling)
+ : new GossTest(this.runtime, tooling);
+ await engine.prepare(setup);
const execute = new Command({
signal: abort.signal,
timeout: state.timeout * 1000,
});
- if (state.engine === "testcontainers-node")
- await this.node(tooling, execute);
- else await this.goss(execute);
+ await engine.run(execute);
state.executed = true;
} catch (error) {
failure = error;
(0,external_node_fs_namespaceObject.appendFileSync)(state.log, `\n${error.message}\n`);
} finally {
try {
- await this.cleanup();
+ await new OwnedResources(this.runtime).remove();
} catch (error) {
failure = failure
? new AggregateError(
@@ -7997,94 +8230,9 @@ reaper.sessionId = process.env.CI_CONTAINER_TEST_SESSION;
return state;
}
- async cleanup() {
- const { state } = this;
- if (!state.socket) return;
- const command = new Command({ timeout: 45_000 });
- for (const label of [
- `${ownerLabel}=${state.id}`,
- `${sessionLabel}=${state.id}`,
- ]) {
- const found = async (kind) =>
- (
- await this.docker(command, [
- kind,
- "ls",
- ...(kind === "container" ? ["--all"] : []),
- "--quiet",
- "--filter",
- `label=${label}`,
- ])
- ).stdout
- .trim()
- .split("\n")
- .filter(Boolean);
- for (const id of await found("container")) {
- await this.docker(command, ["logs", id], {
- log: external_node_path_namespaceObject.join(state.directory, "diagnostics", `${id}.log`),
- allowFailure: true,
- });
- const removed = await this.docker(
- command,
- ["container", "rm", "--force", "--volumes", id],
- { allowFailure: true },
- );
- if (removed.code !== 0 && (await found("container")).includes(id))
- throw new Error(`Could not remove owned container ${id}`);
- }
- for (const kind of ["network", "volume"]) {
- const ids = await found(kind);
- if (ids.length) {
- await this.docker(command, [kind, "rm", ...ids], {
- allowFailure: true,
- });
- if ((await found(kind)).length)
- throw new Error(`Could not remove owned ${kind} resources.`);
- }
- }
- }
- }
-
- async reportFiles() {
- const { state } = this;
- const files = state.reportFile
- ? await Reports.select(state.workingDirectory, state.reportFile)
- : [state.junit];
- for (const file of files) {
- if (!(0,external_node_fs_namespaceObject.existsSync)(file))
- throw new Error(`Missing native test report: ${file}`);
- if (state.baseline[file] === Reports.fingerprint(file))
- throw new Error(`Stale report from before this invocation: ${file}`);
- new Reports(file).inspect();
- }
- return files;
- }
-
- result(files) {
- const { state } = this;
- if (!state.succeeded || !state.executed)
- throw new Error("Container tests did not succeed.");
- Reports.validate([state.junit]);
- const counts = Reports.validate(files, state.baseline);
- return {
- image: state.image,
- "identity-kind": state.identityKind,
- "image-id": state.imageId,
- engine: state.engine,
- suite: state.workingDirectory,
- platform: state.platform,
- "daemon-platform": state.daemonPlatform,
- run: state.run,
- attempt: state.attempt,
- tests: counts,
- reports: files,
- logs: external_node_path_namespaceObject.join(state.directory, "diagnostics"),
- };
- }
-
async finish() {
const { state } = this;
- await this.cleanup();
+ await new OwnedResources(this.runtime).remove();
(0,external_node_fs_namespaceObject.rmSync)(external_node_path_namespaceObject.join(state.directory, "tools"), {
recursive: true,
force: true,
@@ -8092,8 +8240,16 @@ reaper.sessionId = process.env.CI_CONTAINER_TEST_SESSION;
}
}
+;// CONCATENATED MODULE: ./src/index.js
+
+
+
+
+
+
var __webpack_exports__Configuration = __webpack_exports__.Vk;
+var __webpack_exports__ContainerReports = __webpack_exports__.d5;
var __webpack_exports__ContainerTest = __webpack_exports__.MT;
var __webpack_exports__Reports = __webpack_exports__.eM;
var __webpack_exports__Tooling = __webpack_exports__.di;
-export { __webpack_exports__Configuration as Configuration, __webpack_exports__ContainerTest as ContainerTest, __webpack_exports__Reports as Reports, __webpack_exports__Tooling as Tooling };
+export { __webpack_exports__Configuration as Configuration, __webpack_exports__ContainerReports as ContainerReports, __webpack_exports__ContainerTest as ContainerTest, __webpack_exports__Reports as Reports, __webpack_exports__Tooling as Tooling };
diff --git a/actions/docker/test-image/package.json b/actions/docker/test-image/package.json
index d0acbd46..dbde231e 100644
--- a/actions/docker/test-image/package.json
+++ b/actions/docker/test-image/package.json
@@ -13,11 +13,8 @@
},
"scripts": {
"build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && ncc build src/index.js --out dist --target es2022 --no-cache --license licenses.txt",
- "check:dist": "npm run build && git diff --exit-code -- dist && test -z \"$(git ls-files --others --exclude-standard -- dist)\"",
"test": "node --test src/*.test.js",
"test:watch": "node --test --watch src/*.test.js",
- "pretest:ci": "node -e \"require('node:fs').mkdirSync('coverage', { recursive: true })\"",
- "test:ci": "node --experimental-test-coverage --test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=coverage/junit.xml --test-reporter=lcov --test-reporter-destination=coverage/lcov.info --test src/*.test.js",
"test:distribution": "node --test src/contract.test.js"
}
}
diff --git a/actions/docker/test-image/src/command.js b/actions/docker/test-image/src/Command.js
similarity index 100%
rename from actions/docker/test-image/src/command.js
rename to actions/docker/test-image/src/Command.js
diff --git a/actions/docker/test-image/src/configuration.js b/actions/docker/test-image/src/Configuration.js
similarity index 73%
rename from actions/docker/test-image/src/configuration.js
rename to actions/docker/test-image/src/Configuration.js
index 56908705..9d85f944 100644
--- a/actions/docker/test-image/src/configuration.js
+++ b/actions/docker/test-image/src/Configuration.js
@@ -1,5 +1,6 @@
import { randomUUID } from "node:crypto";
import {
+ existsSync,
mkdirSync,
mkdtempSync,
readdirSync,
@@ -9,7 +10,7 @@ import {
} from "node:fs";
import { tmpdir } from "node:os";
import path from "node:path";
-import { Reports } from "./reports.js";
+import { Reports } from "./Reports.js";
export class Configuration {
constructor(inputs, environment = process.env) {
@@ -75,6 +76,42 @@ export class Configuration {
return [os, normalized, variant].filter(Boolean).join("/");
}
+ static dockerArgs(directory) {
+ const file = path.join(directory, "docker-args");
+ if (!existsSync(file)) return [];
+ const args = readFileSync(file, "utf8")
+ .split(/\r?\n/)
+ .map((line) => line.trim())
+ .filter((line) => line && !line.startsWith("#"));
+ for (const arg of args) {
+ if (
+ arg === "--read-only" ||
+ /^--cap-drop=[A-Z_]+$/.test(arg) ||
+ /^--security-opt=no-new-privileges(?:=true)?$/.test(arg)
+ )
+ continue;
+ const tmpfs = /^--tmpfs=(\/[a-zA-Z0-9_./-]+):([a-zA-Z0-9_,=.-]+)$/.exec(
+ arg,
+ );
+ if (tmpfs) {
+ const target = tmpfs[1];
+ if (
+ target === path.posix.normalize(target) &&
+ target !== "/" &&
+ target !== "/goss-bin" &&
+ !target.startsWith("/goss-bin/") &&
+ target !== "/goss" &&
+ !target.startsWith("/goss/")
+ )
+ continue;
+ }
+ throw new Error(
+ `Unsupported docker-args entry: ${arg}. Use --read-only, --cap-drop=..., --security-opt=no-new-privileges or --tmpfs=/path:options; /goss and /goss-bin are reserved.`,
+ );
+ }
+ return args;
+ }
+
async prepare() {
const { inputs, environment } = this;
const workingDirectory = realpathSync(inputs.workingDirectory || ".");
@@ -90,6 +127,21 @@ export class Configuration {
workingDirectory,
inputs.engine || "auto",
);
+ const dockerArgs = Configuration.dockerArgs(workingDirectory);
+ if (
+ selection.engine !== "goss" &&
+ existsSync(path.join(workingDirectory, "docker-args"))
+ )
+ throw new Error(
+ "docker-args applies only to Goss suites; configure Testcontainers in the native suite.",
+ );
+ if (
+ selection.engine === "goss" &&
+ existsSync(path.join(workingDirectory, "goss_wait.yaml"))
+ )
+ throw new Error(
+ "goss_wait.yaml is not executed. Keep startup, readiness and cleanup in a goss.yaml command or script, then remove this file.",
+ );
const timeout = String(inputs.timeout || "300");
if (!/^[1-9][0-9]*$/.test(timeout) || Number(timeout) > 3600)
throw new Error("timeout must be an integer from 1 to 3600 seconds.");
@@ -100,11 +152,6 @@ export class Configuration {
throw new Error(
"platform must be linux/amd64 or linux/arm64, optionally with a variant.",
);
- const group = inputs.reportGroup || environment.GITHUB_JOB || "local";
- if (!/^[\w-]+$/.test(group))
- throw new Error(
- "report-group must be a job ID containing letters, numbers, underscores or hyphens.",
- );
const baseline = {};
if (inputs.reportFile)
for (const file of await Reports.select(
@@ -121,6 +168,7 @@ export class Configuration {
mkdirSync(path.join(directory, child));
return {
...selection,
+ dockerArgs,
image: inputs.image,
identityKind,
workingDirectory,
@@ -128,7 +176,6 @@ export class Configuration {
id,
timeout: Number(timeout),
requestedPlatform: inputs.platform || "",
- group,
attempt: environment.GITHUB_RUN_ATTEMPT || "1",
run: environment.GITHUB_RUN_ID || "local",
reportFile: inputs.reportFile || "",
diff --git a/actions/docker/test-image/src/ContainerReports.js b/actions/docker/test-image/src/ContainerReports.js
new file mode 100644
index 00000000..7a7dd7aa
--- /dev/null
+++ b/actions/docker/test-image/src/ContainerReports.js
@@ -0,0 +1,110 @@
+import {
+ copyFileSync,
+ existsSync,
+ lstatSync,
+ mkdirSync,
+ realpathSync,
+} from "node:fs";
+import path from "node:path";
+import { Reports } from "./Reports.js";
+
+export class ContainerReports {
+ constructor(state) {
+ this.state = state;
+ }
+ reportDefinition(workspace, mapping) {
+ const { state } = this;
+ if (!state.imageId || !state.platform)
+ throw new Error("Resolve the image before registering its test reports.");
+ const project =
+ path
+ .relative(realpathSync(workspace), state.workingDirectory)
+ .split(path.sep)
+ .join("/") || ".";
+ return {
+ name: "Container image tests",
+ project,
+ variant: {
+ engine: state.engine,
+ platform: state.platform,
+ },
+ subject: {
+ kind: "image",
+ name: state.image,
+ digest: state.imageId,
+ engine: state.engine,
+ platform: state.platform,
+ },
+ reports: [
+ { kind: "test", pattern: "junit.xml" },
+ ...(state.reportFile
+ ? [{ kind: "test", pattern: "additional/*.xml", optional: true }]
+ : []),
+ ],
+ "path-mapping": mapping
+ ? JSON.parse(mapping)
+ : state.engine === "testcontainers-node"
+ ? { "/workspace/image": project }
+ : {},
+ };
+ }
+
+ async stageReports(directory) {
+ const copy = (source, destination) => {
+ if (!lstatSync(source).isFile())
+ throw new Error(
+ "Native reports must be regular files without symlinks.",
+ );
+ Reports.fingerprint(source);
+ copyFileSync(source, destination);
+ };
+ // Keep the engine's evidence even if an additional required report is missing.
+ if (existsSync(this.state.junit))
+ copy(this.state.junit, path.join(directory, "junit.xml"));
+ const files = await this.reportFiles();
+ const additional = files.filter(
+ (file) => path.resolve(file) !== path.resolve(this.state.junit),
+ );
+ if (additional.length) mkdirSync(path.join(directory, "additional"));
+ for (const [index, file] of additional.entries())
+ copy(file, path.join(directory, "additional", `${index}.xml`));
+ return files;
+ }
+
+ async reportFiles() {
+ const { state } = this;
+ const files = state.reportFile
+ ? await Reports.select(state.workingDirectory, state.reportFile)
+ : [state.junit];
+ for (const file of files) {
+ if (!existsSync(file))
+ throw new Error(`Missing native test report: ${file}`);
+ if (state.baseline[file] === Reports.fingerprint(file))
+ throw new Error(`Stale report from before this invocation: ${file}`);
+ new Reports(file).inspect();
+ }
+ return files;
+ }
+
+ result(files) {
+ const { state } = this;
+ if (!state.succeeded || !state.executed)
+ throw new Error("Container tests did not succeed.");
+ Reports.validate([state.junit]);
+ const counts = Reports.validate(files, state.baseline);
+ return {
+ image: state.image,
+ "identity-kind": state.identityKind,
+ "image-id": state.imageId,
+ engine: state.engine,
+ suite: state.workingDirectory,
+ platform: state.platform,
+ "daemon-platform": state.daemonPlatform,
+ run: state.run,
+ attempt: state.attempt,
+ tests: counts,
+ reports: files,
+ logs: path.join(state.directory, "diagnostics"),
+ };
+ }
+}
diff --git a/actions/docker/test-image/src/ContainerTest.js b/actions/docker/test-image/src/ContainerTest.js
new file mode 100644
index 00000000..5db990a9
--- /dev/null
+++ b/actions/docker/test-image/src/ContainerTest.js
@@ -0,0 +1,98 @@
+import { appendFileSync, readFileSync, rmSync, writeFileSync } from "node:fs";
+import path from "node:path";
+import { Command } from "./Command.js";
+import { Configuration } from "./Configuration.js";
+import { DockerRuntime } from "./DockerRuntime.js";
+import { GossTest } from "./GossTest.js";
+import { OwnedResources } from "./OwnedResources.js";
+import { TestcontainersTest } from "./TestcontainersTest.js";
+
+export class ContainerTest {
+ constructor(state) {
+ this.state = state;
+ this.runtime = new DockerRuntime(state);
+ }
+ static async prepare(inputs, environment) {
+ const test = new ContainerTest(
+ await new Configuration(inputs, environment).prepare(),
+ );
+ test.save();
+ return test;
+ }
+
+ static load(file) {
+ const state = JSON.parse(readFileSync(file, "utf8"));
+ if (
+ !/^[a-f0-9-]{36}$/.test(state.id) ||
+ path.join(state.directory, "state.json") !== path.resolve(file)
+ )
+ throw new Error("Invalid container test state.");
+ return new ContainerTest(state);
+ }
+
+ save() {
+ const { state } = this;
+ writeFileSync(
+ path.join(state.directory, "state.json"),
+ JSON.stringify(state),
+ { mode: 0o600 },
+ );
+ }
+
+ async resolve(command) {
+ await this.runtime.resolve(command);
+ this.save();
+ }
+ async run(tooling) {
+ const { state } = this;
+ const abort = new AbortController();
+ const cancel = () => abort.abort();
+ process.once("SIGTERM", cancel);
+ process.once("SIGINT", cancel);
+ let failure;
+ try {
+ const setup = new Command({ signal: abort.signal, timeout: 180_000 });
+ if (!state.imageId) await this.resolve(setup);
+ const engine =
+ state.engine === "testcontainers-node"
+ ? new TestcontainersTest(this.runtime, tooling)
+ : new GossTest(this.runtime, tooling);
+ await engine.prepare(setup);
+ const execute = new Command({
+ signal: abort.signal,
+ timeout: state.timeout * 1000,
+ });
+ await engine.run(execute);
+ state.executed = true;
+ } catch (error) {
+ failure = error;
+ appendFileSync(state.log, `\n${error.message}\n`);
+ } finally {
+ try {
+ await new OwnedResources(this.runtime).remove();
+ } catch (error) {
+ failure = failure
+ ? new AggregateError(
+ [failure, error],
+ `${failure.message} Cleanup also failed: ${error.message}`,
+ )
+ : error;
+ }
+ process.removeListener("SIGTERM", cancel);
+ process.removeListener("SIGINT", cancel);
+ state.succeeded = !failure;
+ this.save();
+ }
+ if (failure) throw failure;
+ return state;
+ }
+
+ async finish() {
+ const { state } = this;
+ await new OwnedResources(this.runtime).remove();
+ rmSync(path.join(state.directory, "tools"), {
+ recursive: true,
+ force: true,
+ });
+ }
+}
diff --git a/actions/docker/test-image/src/DockerRuntime.js b/actions/docker/test-image/src/DockerRuntime.js
new file mode 100644
index 00000000..417f32b0
--- /dev/null
+++ b/actions/docker/test-image/src/DockerRuntime.js
@@ -0,0 +1,70 @@
+import { statSync } from "node:fs";
+import { Command } from "./Command.js";
+import { Configuration } from "./Configuration.js";
+
+export class DockerRuntime {
+ constructor(state) {
+ this.state = state;
+ }
+ get label() {
+ return `io.hoverkraft.container-test=${this.state.id}`;
+ }
+ async run(command, args, options = {}) {
+ const { state } = this;
+ return command.run(
+ "docker",
+ [...(state.socket ? ["--host", `unix://${state.socket}`] : []), ...args],
+ { log: state.log, ...options },
+ );
+ }
+
+ async resolve(command = new Command({ timeout: 180_000 })) {
+ const { state } = this;
+ let endpoint = process.env.DOCKER_HOST;
+ if (!endpoint || process.env.DOCKER_CONTEXT) {
+ const context = await this.run(command, ["context", "inspect"]);
+ endpoint = JSON.parse(context.stdout)[0]?.Endpoints?.docker?.Host;
+ }
+ if (!endpoint?.startsWith("unix://"))
+ throw new Error("A local Unix Docker socket is required.");
+ state.socket = endpoint.slice("unix://".length);
+ if (!statSync(state.socket).isSocket())
+ throw new Error("Docker endpoint is not a Unix socket.");
+ const info = JSON.parse(
+ (
+ await this.run(command, ["info", "--format", "{{json .}}"], {
+ log: undefined,
+ })
+ ).stdout,
+ );
+ state.daemonPlatform = Configuration.platform(
+ info.OSType,
+ info.Architecture,
+ );
+ const expected = state.requestedPlatform || state.daemonPlatform;
+ if (state.identityKind === "registry")
+ await this.run(command, ["pull", "--platform", expected, state.image]);
+ const image = JSON.parse(
+ (
+ await this.run(command, ["image", "inspect", state.image], {
+ log: undefined,
+ })
+ ).stdout,
+ )[0];
+ state.imageId = image.Id;
+ state.platform = Configuration.platform(
+ image.Os,
+ image.Architecture,
+ image.Variant || "",
+ );
+ if (
+ state.platform !== expected &&
+ !state.platform.startsWith(`${expected}/`)
+ )
+ throw new Error(
+ `Image platform ${state.platform} does not match requested ${expected}.`,
+ );
+ if (state.identityKind === "local" && state.image !== state.imageId)
+ throw new Error("Local image identity changed.");
+ }
+}
diff --git a/actions/docker/test-image/src/GossTest.js b/actions/docker/test-image/src/GossTest.js
new file mode 100644
index 00000000..e2b66508
--- /dev/null
+++ b/actions/docker/test-image/src/GossTest.js
@@ -0,0 +1,42 @@
+import path from "node:path";
+import { Tooling } from "./Tooling.js";
+
+export class GossTest {
+ constructor(runtime, tooling) {
+ this.runtime = runtime;
+ this.tooling = tooling;
+ }
+ async prepare(command) {
+ await new Tooling(this.tooling).goss(this.runtime.state, command);
+ }
+ async run(command) {
+ const { state } = this.runtime;
+ const directory = path.join(state.directory, "tools");
+ await this.runtime.run(
+ command,
+ [
+ "run",
+ ...state.dockerArgs,
+ "--name",
+ state.runnerName,
+ "--label",
+ this.runtime.label,
+ "--platform",
+ state.platform,
+ "--volume",
+ `${path.join(directory, "goss")}:/goss-bin:ro`,
+ "--volume",
+ `${state.workingDirectory}:/goss:ro`,
+ "--entrypoint",
+ "/goss-bin",
+ state.imageId,
+ "-g",
+ "/goss/goss.yaml",
+ "validate",
+ "--format",
+ "junit",
+ ],
+ { stdoutFile: state.junit, quiet: false },
+ );
+ }
+}
diff --git a/actions/docker/test-image/src/OwnedResources.js b/actions/docker/test-image/src/OwnedResources.js
new file mode 100644
index 00000000..6dd33389
--- /dev/null
+++ b/actions/docker/test-image/src/OwnedResources.js
@@ -0,0 +1,56 @@
+import path from "node:path";
+import { Command } from "./Command.js";
+
+/** Remove only resources bearing this invocation's ownership/session label. */
+export class OwnedResources {
+ constructor(runtime) {
+ this.runtime = runtime;
+ }
+ async remove() {
+ const { state } = this.runtime;
+ if (!state.socket) return;
+ const command = new Command({ timeout: 45_000 });
+ for (const label of [
+ this.runtime.label,
+ `org.testcontainers.session-id=${state.id}`,
+ ]) {
+ const found = async (kind) =>
+ (
+ await this.runtime.run(command, [
+ kind,
+ "ls",
+ ...(kind === "container" ? ["--all"] : []),
+ "--quiet",
+ "--filter",
+ `label=${label}`,
+ ])
+ ).stdout
+ .trim()
+ .split("\n")
+ .filter(Boolean);
+ for (const id of await found("container")) {
+ await this.runtime.run(command, ["logs", id], {
+ log: path.join(state.directory, "diagnostics", `${id}.log`),
+ allowFailure: true,
+ });
+ const removed = await this.runtime.run(
+ command,
+ ["container", "rm", "--force", "--volumes", id],
+ { allowFailure: true },
+ );
+ if (removed.code !== 0 && (await found("container")).includes(id))
+ throw new Error(`Could not remove owned container ${id}`);
+ }
+ for (const kind of ["network", "volume"]) {
+ const ids = await found(kind);
+ if (ids.length) {
+ await this.runtime.run(command, [kind, "rm", ...ids], {
+ allowFailure: true,
+ });
+ if ((await found(kind)).length)
+ throw new Error(`Could not remove owned ${kind} resources.`);
+ }
+ }
+ }
+ }
+}
diff --git a/actions/docker/test-image/src/reports.js b/actions/docker/test-image/src/Reports.js
similarity index 100%
rename from actions/docker/test-image/src/reports.js
rename to actions/docker/test-image/src/Reports.js
diff --git a/actions/docker/test-image/src/TestcontainersTest.js b/actions/docker/test-image/src/TestcontainersTest.js
new file mode 100644
index 00000000..27214e90
--- /dev/null
+++ b/actions/docker/test-image/src/TestcontainersTest.js
@@ -0,0 +1,78 @@
+import { writeFileSync } from "node:fs";
+import path from "node:path";
+
+export class TestcontainersTest {
+ constructor(runtime, tooling) {
+ this.runtime = runtime;
+ this.tooling = tooling;
+ }
+ async prepare(command) {
+ for (const image of [this.tooling.nodeRunner, this.tooling.reaper])
+ await this.runtime.run(command, [
+ "pull",
+ "--platform",
+ this.runtime.state.daemonPlatform,
+ image,
+ ]);
+ }
+ async run(command) {
+ const { state } = this.runtime;
+ const tooling = this.tooling;
+ const bootstrap = path.join(state.directory, "tools", "session.mjs");
+ // Use the runner's public Testcontainers API. Each worker gets an exclusive
+ // resource session, even when upstream reuses another invocation's Ryuk.
+ writeFileSync(
+ bootstrap,
+ `import { createRequire } from 'node:module';
+const require = createRequire('/workspace/package.json');
+const { getContainerRuntimeClient, getReaper } = require('testcontainers');
+const reaper = await getReaper(await getContainerRuntimeClient());
+reaper.addSession(process.env.CI_CONTAINER_TEST_SESSION);
+reaper.sessionId = process.env.CI_CONTAINER_TEST_SESSION;
+`,
+ { mode: 0o600 },
+ );
+ const args = [
+ "run",
+ "--name",
+ state.runnerName,
+ "--label",
+ this.runtime.label,
+ "--network",
+ "host",
+ "--user",
+ "0:0",
+ "--volume",
+ `${state.socket}:/var/run/docker.sock`,
+ "--volume",
+ `${state.workingDirectory}:/workspace/image`,
+ "--volume",
+ `${path.join(state.directory, "reports")}:/reports`,
+ "--volume",
+ `${bootstrap}:/ci/session.mjs:ro`,
+ ];
+ const environment = {
+ CI: "true",
+ NODE_OPTIONS: "--import=/ci/session.mjs",
+ CI_CONTAINER_TEST_SESSION: state.id,
+ TESTED_IMAGE_REF: state.imageId,
+ TESTED_IMAGE_SOURCE: state.image,
+ TESTED_IMAGE_PLATFORM: state.platform,
+ TEST_JUNIT_REPORT_PATH: "/reports/junit.xml",
+ HOST_UID: String(process.getuid()),
+ HOST_GID: String(process.getgid()),
+ RYUK_CONTAINER_IMAGE: tooling.reaper,
+ DOCKER_HOST: "unix:///var/run/docker.sock",
+ TESTCONTAINERS_HOST_OVERRIDE: "127.0.0.1",
+ TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE: "/var/run/docker.sock",
+ };
+ for (const [name, value] of Object.entries(environment))
+ args.push("--env", `${name}=${value}`);
+ args.push(
+ tooling.nodeRunner,
+ `--test-timeout=${state.timeout * 1000}`,
+ ...state.tests.map((file) => `/workspace/image/${file}`),
+ );
+ await this.runtime.run(command, args, { quiet: false });
+ }
+}
diff --git a/actions/docker/test-image/src/tooling.js b/actions/docker/test-image/src/Tooling.js
similarity index 85%
rename from actions/docker/test-image/src/tooling.js
rename to actions/docker/test-image/src/Tooling.js
index 0b4e5192..f0d7b053 100644
--- a/actions/docker/test-image/src/tooling.js
+++ b/actions/docker/test-image/src/Tooling.js
@@ -38,18 +38,14 @@ export class Tooling {
state.platform.split("/")[1] === "amd64" ? "x86_64" : "arm64";
const archive = `goss_${version.slice(1)}_linux_${architecture}.tar.gz`;
const base = `https://github.com/goss-org/goss/releases/download/${version}`;
- const [binary, sums, script, scriptSum] = await Promise.all([
+ const [binary, sums] = await Promise.all([
Tooling.download(`${base}/${archive}`),
Tooling.download(`${base}/goss_${version.slice(1)}_SHA256SUMS`),
- Tooling.download(`${base}/dgoss`),
- Tooling.download(`${base}/dgoss.sha256`),
]);
Tooling.verify(binary, sums.toString(), archive);
- Tooling.verify(script, scriptSum.toString(), "dgoss");
const directory = path.join(state.directory, "tools");
const tarball = path.join(directory, archive);
writeFileSync(tarball, binary, { mode: 0o600 });
- writeFileSync(path.join(directory, "dgoss"), script, { mode: 0o700 });
await command.run("tar", [
"--extract",
"--gzip",
@@ -61,7 +57,8 @@ export class Tooling {
"--no-same-permissions",
"goss",
]);
- chmodSync(path.join(directory, "goss"), 0o700);
+ // The tested image's user must be able to execute the read-only bind mount.
+ chmodSync(path.join(directory, "goss"), 0o755);
return directory;
}
}
diff --git a/actions/docker/test-image/src/command.test.js b/actions/docker/test-image/src/command.test.js
index 981aea53..31899761 100644
--- a/actions/docker/test-image/src/command.test.js
+++ b/actions/docker/test-image/src/command.test.js
@@ -3,7 +3,7 @@ import { mkdtempSync, readFileSync, rmSync } from "node:fs";
import { tmpdir } from "node:os";
import path from "node:path";
import { test } from "node:test";
-import { Command } from "./command.js";
+import { Command } from "./Command.js";
test("retains command diagnostics while propagating a nonzero exit", async (t) => {
const directory = mkdtempSync(path.join(tmpdir(), "test-image-command-"));
diff --git a/actions/docker/test-image/src/contract.test.js b/actions/docker/test-image/src/contract.test.js
index 514def7f..277ed37b 100644
--- a/actions/docker/test-image/src/contract.test.js
+++ b/actions/docker/test-image/src/contract.test.js
@@ -5,6 +5,7 @@ import {
mkdtempSync,
readFileSync,
rmSync,
+ symlinkSync,
writeFileSync,
} from "node:fs";
import { tmpdir } from "node:os";
@@ -14,9 +15,8 @@ import { pathToFileURL } from "node:url";
const entrypoint =
process.env.ACTION_ENTRYPOINT || path.join(import.meta.dirname, "index.js");
-const { Configuration, ContainerTest, Reports, Tooling } = await import(
- pathToFileURL(entrypoint)
-);
+const { Configuration, ContainerTest, ContainerReports, Reports, Tooling } =
+ await import(pathToFileURL(entrypoint));
const image = `sha256:${"a".repeat(64)}`;
const passing =
'';
@@ -91,6 +91,73 @@ test("distinguishes registry manifests from local configuration IDs and rejects
assert.throws(() => Configuration.platform("windows", "amd64"), /Linux/);
});
+test("rejects a separate readiness file rather than silently skipping its checks", async (t) => {
+ const { root, directory } = fixture(t, {
+ "goss.yaml": "command: {}",
+ "goss_wait.yaml": "port: {}",
+ });
+ const inputs = { image, workingDirectory: directory };
+ const environment = { RUNNER_TEMP: root };
+ await assert.rejects(
+ new Configuration(inputs, environment).prepare(),
+ /goss_wait.yaml is not executed/,
+ );
+});
+
+test("accepts Goss security controls without allowing image, user, ownership or mount replacement", async (t) => {
+ const { root, directory } = fixture(t, { "goss.yaml": "command: {}" });
+ const file = path.join(directory, "docker-args");
+ const args = [
+ "--read-only",
+ "--cap-drop=ALL",
+ "--security-opt=no-new-privileges",
+ "--tmpfs=/certs:uid=10001,gid=10001,mode=0700",
+ ];
+ writeFileSync(
+ file,
+ `# Shared with local Docker execution\r\n\r\n${args.join("\r\n")}\r\n`,
+ );
+ const inputs = { image, workingDirectory: directory };
+ const environment = { RUNNER_TEMP: root };
+ assert.deepEqual(
+ (await new Configuration(inputs, environment).prepare()).dockerArgs,
+ args,
+ );
+ for (const arg of [
+ "--entrypoint=/bin/sh",
+ "--user=0",
+ "--name=caller",
+ "--label=io.hoverkraft.container-test=other",
+ "--platform=linux/arm64",
+ "--volume=/tmp:/goss",
+ "--privileged",
+ "--security-opt=seccomp=unconfined",
+ "--tmpfs=/:rw",
+ "--tmpfs=/goss:rw",
+ "--tmpfs=/goss/child:rw",
+ "--tmpfs=/goss-bin:rw",
+ "--tmpfs=/certs/../goss:rw",
+ "--tmpfs=//goss:rw",
+ "--tmpfs=/certs:rw\u0000",
+ "--cap-drop ALL",
+ "another-image",
+ "$(touch /tmp/unsafe)",
+ ]) {
+ writeFileSync(file, arg);
+ await assert.rejects(
+ new Configuration(inputs, environment).prepare(),
+ /Unsupported docker-args/,
+ );
+ }
+ writeFileSync(file, args.join("\n"));
+ rmSync(path.join(directory, "goss.yaml"));
+ writeFileSync(path.join(directory, "image.test.js"), "import 'node:test';");
+ await assert.rejects(
+ new Configuration(inputs, environment).prepare(),
+ /only to Goss/,
+ );
+});
+
test("rejects a repetitive invalid registry without blocking", () => {
const result = spawnSync(
process.execPath,
@@ -127,7 +194,6 @@ test("validates inputs before allocating state and assigns independent invocatio
{ timeout: "1.5" },
{ timeout: "3601" },
{ platform: "windows/amd64" },
- { reportGroup: "job/*" },
])
await assert.rejects(
new Configuration({ ...inputs, ...overrides }, environment).prepare(),
@@ -136,7 +202,6 @@ test("validates inputs before allocating state and assigns independent invocatio
const second = await ContainerTest.prepare(inputs, environment);
assert.notEqual(first.state.id, second.state.id);
assert.notEqual(first.state.directory, second.state.directory);
- assert.equal(first.state.group, "outer-test");
assert.equal(first.state.attempt, "2");
assert.equal(
ContainerTest.load(path.join(first.state.directory, "state.json")).state
@@ -172,6 +237,84 @@ test("requires fresh files for every explicit report selection and preserves ori
});
});
+test("registers the resolved image and maps native paths into the checked-out suite", async (t) => {
+ const { root, directory } = fixture(t, {
+ "image.test.js": "import 'node:test';",
+ });
+ const suite = await ContainerTest.prepare(
+ { image, workingDirectory: directory },
+ { RUNNER_TEMP: root },
+ );
+ assert.throws(
+ () => new ContainerReports(suite.state).reportDefinition(root),
+ /Resolve the image/,
+ );
+ Object.assign(suite.state, { imageId: image, platform: "linux/amd64" });
+ const definition = new ContainerReports(suite.state).reportDefinition(root);
+ assert.equal(definition.project, "suite with spaces");
+ assert.deepEqual(definition.subject, {
+ kind: "image",
+ name: image,
+ digest: image,
+ engine: "testcontainers-node",
+ platform: "linux/amd64",
+ });
+ assert.deepEqual(definition.reports, [
+ { kind: "test", pattern: "junit.xml" },
+ ]);
+ assert.deepEqual(definition["path-mapping"], {
+ "/workspace/image": "suite with spaces",
+ });
+ assert.deepEqual(
+ new ContainerReports(suite.state).reportDefinition(
+ root,
+ '{"/custom":"src"}',
+ )["path-mapping"],
+ { "/custom": "src" },
+ );
+});
+
+test("retains engine evidence when required extra reports are absent or stale, without duplicating it", async (t) => {
+ const { root, directory } = fixture(t, {
+ "goss.yaml": "command: {}",
+ "extra.xml": passing,
+ });
+ const suite = await ContainerTest.prepare(
+ { image, workingDirectory: directory, reportFile: "extra.xml" },
+ { RUNNER_TEMP: root },
+ );
+ const staged = path.join(root, "staged");
+ mkdirSync(staged);
+ writeFileSync(suite.state.junit, passing);
+ await assert.rejects(
+ new ContainerReports(suite.state).stageReports(staged),
+ /Stale/,
+ );
+ assert.equal(readFileSync(path.join(staged, "junit.xml"), "utf8"), passing);
+ rmSync(path.join(directory, "extra.xml"));
+ await assert.rejects(
+ new ContainerReports(suite.state).stageReports(staged),
+ /No current/,
+ );
+ const current = passing.replace("ready", "extra check");
+ writeFileSync(path.join(directory, "extra.xml"), current);
+ suite.state.reportFile += `;${suite.state.junit}`;
+ await new ContainerReports(suite.state).stageReports(staged);
+ assert.equal(
+ readFileSync(path.join(staged, "additional", "0.xml"), "utf8"),
+ current,
+ );
+ assert.throws(() => readFileSync(path.join(staged, "additional", "1.xml")), {
+ code: "ENOENT",
+ });
+ rmSync(suite.state.junit);
+ symlinkSync(path.join(directory, "extra.xml"), suite.state.junit);
+ await assert.rejects(
+ new ContainerReports(suite.state).stageReports(staged),
+ /without symlinks/,
+ );
+});
+
test("rejects malformed, non-JUnit, empty, skipped-only and failed validation results", (t) => {
const { directory } = fixture(t);
const file = path.join(directory, "junit.xml");
@@ -216,9 +359,12 @@ test("diagnostic reports never turn a failed invocation into promotion evidence"
);
const { state } = suite;
writeFileSync(state.junit, passing);
- const files = await suite.reportFiles();
+ const files = await new ContainerReports(suite.state).reportFiles();
assert.deepEqual(files, [state.junit]);
- assert.throws(() => suite.result(files), /did not succeed/);
+ assert.throws(
+ () => new ContainerReports(suite.state).result(files),
+ /did not succeed/,
+ );
Object.assign(state, {
succeeded: true,
executed: true,
@@ -226,7 +372,7 @@ test("diagnostic reports never turn a failed invocation into promotion evidence"
platform: "linux/amd64",
daemonPlatform: "linux/amd64",
});
- const result = suite.result(files);
+ const result = new ContainerReports(suite.state).result(files);
assert.equal(result.image, image);
assert.equal(result["identity-kind"], "local");
assert.equal(result.engine, "goss");
diff --git a/actions/docker/test-image/src/index.js b/actions/docker/test-image/src/index.js
index f7a676e1..248c68fa 100644
--- a/actions/docker/test-image/src/index.js
+++ b/actions/docker/test-image/src/index.js
@@ -1,360 +1,5 @@
-import {
- appendFileSync,
- existsSync,
- readFileSync,
- rmSync,
- statSync,
- writeFileSync,
-} from "node:fs";
-import path from "node:path";
-import { Command } from "./command.js";
-import { Configuration } from "./configuration.js";
-import { Reports } from "./reports.js";
-import { Tooling } from "./tooling.js";
-
-export { Configuration, Reports, Tooling };
-
-const ownerLabel = "io.hoverkraft.container-test";
-const sessionLabel = "org.testcontainers.session-id";
-
-export class ContainerTest {
- constructor(state) {
- this.state = state;
- }
-
- static async prepare(inputs, environment) {
- const test = new ContainerTest(
- await new Configuration(inputs, environment).prepare(),
- );
- test.save();
- return test;
- }
-
- static load(file) {
- const state = JSON.parse(readFileSync(file, "utf8"));
- if (
- !/^[a-f0-9-]{36}$/.test(state.id) ||
- path.join(state.directory, "state.json") !== path.resolve(file)
- )
- throw new Error("Invalid container test state.");
- return new ContainerTest(state);
- }
-
- save() {
- const { state } = this;
- writeFileSync(
- path.join(state.directory, "state.json"),
- JSON.stringify(state),
- { mode: 0o600 },
- );
- }
-
- async docker(command, args, options = {}) {
- const { state } = this;
- return command.run(
- "docker",
- [...(state.socket ? ["--host", `unix://${state.socket}`] : []), ...args],
- { log: state.log, ...options },
- );
- }
-
- async resolve(command) {
- const { state } = this;
- let endpoint = process.env.DOCKER_HOST;
- if (!endpoint || process.env.DOCKER_CONTEXT) {
- const context = await this.docker(command, ["context", "inspect"]);
- endpoint = JSON.parse(context.stdout)[0]?.Endpoints?.docker?.Host;
- }
- if (!endpoint?.startsWith("unix://"))
- throw new Error("A local Unix Docker socket is required.");
- state.socket = endpoint.slice("unix://".length);
- if (!statSync(state.socket).isSocket())
- throw new Error("Docker endpoint is not a Unix socket.");
- const info = JSON.parse(
- (
- await this.docker(command, ["info", "--format", "{{json .}}"], {
- log: undefined,
- })
- ).stdout,
- );
- state.daemonPlatform = Configuration.platform(
- info.OSType,
- info.Architecture,
- );
- const expected = state.requestedPlatform || state.daemonPlatform;
- if (state.identityKind === "registry")
- await this.docker(command, ["pull", "--platform", expected, state.image]);
- const image = JSON.parse(
- (
- await this.docker(command, ["image", "inspect", state.image], {
- log: undefined,
- })
- ).stdout,
- )[0];
- state.imageId = image.Id;
- state.platform = Configuration.platform(
- image.Os,
- image.Architecture,
- image.Variant || "",
- );
- if (
- state.platform !== expected &&
- !state.platform.startsWith(`${expected}/`)
- )
- throw new Error(
- `Image platform ${state.platform} does not match requested ${expected}.`,
- );
- if (state.identityKind === "local" && state.image !== state.imageId)
- throw new Error("Local image identity changed.");
- this.save();
- }
-
- async node(tooling, command) {
- const { state } = this;
- const bootstrap = path.join(state.directory, "tools", "session.mjs");
- // Use the runner's public Testcontainers API. Each worker gets an exclusive
- // resource session, even when upstream reuses another invocation's Ryuk.
- writeFileSync(
- bootstrap,
- `import { createRequire } from 'node:module';
-const require = createRequire('/workspace/package.json');
-const { getContainerRuntimeClient, getReaper } = require('testcontainers');
-const reaper = await getReaper(await getContainerRuntimeClient());
-reaper.addSession(process.env.CI_CONTAINER_TEST_SESSION);
-reaper.sessionId = process.env.CI_CONTAINER_TEST_SESSION;
-`,
- { mode: 0o600 },
- );
- const args = [
- "run",
- "--name",
- state.runnerName,
- "--label",
- `${ownerLabel}=${state.id}`,
- "--network",
- "host",
- "--user",
- "0:0",
- "--volume",
- `${state.socket}:/var/run/docker.sock`,
- "--volume",
- `${state.workingDirectory}:/workspace/image`,
- "--volume",
- `${path.join(state.directory, "reports")}:/reports`,
- "--volume",
- `${bootstrap}:/ci/session.mjs:ro`,
- ];
- const environment = {
- CI: "true",
- NODE_OPTIONS: "--import=/ci/session.mjs",
- CI_CONTAINER_TEST_SESSION: state.id,
- TESTED_IMAGE_REF: state.imageId,
- TESTED_IMAGE_SOURCE: state.image,
- TESTED_IMAGE_PLATFORM: state.platform,
- TEST_JUNIT_REPORT_PATH: "/reports/junit.xml",
- HOST_UID: String(process.getuid()),
- HOST_GID: String(process.getgid()),
- RYUK_CONTAINER_IMAGE: tooling.reaper,
- DOCKER_HOST: "unix:///var/run/docker.sock",
- TESTCONTAINERS_HOST_OVERRIDE: "127.0.0.1",
- TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE: "/var/run/docker.sock",
- };
- for (const [name, value] of Object.entries(environment))
- args.push("--env", `${name}=${value}`);
- args.push(
- tooling.nodeRunner,
- `--test-timeout=${state.timeout * 1000}`,
- ...state.tests.map((file) => `/workspace/image/${file}`),
- );
- await this.docker(command, args, { quiet: false });
- }
-
- async goss(command) {
- const { state } = this;
- const directory = path.join(state.directory, "tools");
- await command.run(
- "bash",
- [
- path.join(directory, "dgoss"),
- "run",
- "--name",
- state.runnerName,
- "--label",
- `${ownerLabel}=${state.id}`,
- "--platform",
- state.platform,
- state.imageId,
- ],
- {
- cwd: state.workingDirectory,
- log: state.log,
- stdoutFile: state.junit,
- quiet: false,
- env: {
- DOCKER_HOST: `unix://${state.socket}`,
- DOCKER_CONTEXT: "",
- CONTAINER_RUNTIME: "docker",
- DEBUG: "",
- GOSS_PATH: path.join(directory, "goss"),
- GOSS_FILES_PATH: state.workingDirectory,
- GOSS_FILE: "goss.yaml",
- GOSS_FILES_STRATEGY: "mount",
- GOSS_VARS: "",
- GOSS_ADDITIONAL_COPY_PATH: "",
- GOSS_OPTS: "--format junit",
- GOSS_WAIT_OPTS: `-r ${Math.min(30, state.timeout)}s -s 1s > /dev/null`,
- DGOSS_TEMP_DIR: directory,
- CONTAINER_LOG_OUTPUT: path.join(
- state.directory,
- "diagnostics",
- "container.log",
- ),
- },
- },
- );
- }
-
- async run(tooling) {
- const { state } = this;
- const abort = new AbortController();
- const cancel = () => abort.abort();
- process.once("SIGTERM", cancel);
- process.once("SIGINT", cancel);
- let failure;
- try {
- const setup = new Command({ signal: abort.signal, timeout: 180_000 });
- await this.resolve(setup);
- if (state.engine === "testcontainers-node") {
- for (const image of [tooling.nodeRunner, tooling.reaper])
- await this.docker(setup, [
- "pull",
- "--platform",
- state.daemonPlatform,
- image,
- ]);
- } else await new Tooling(tooling).goss(state, setup);
- const execute = new Command({
- signal: abort.signal,
- timeout: state.timeout * 1000,
- });
- if (state.engine === "testcontainers-node")
- await this.node(tooling, execute);
- else await this.goss(execute);
- state.executed = true;
- } catch (error) {
- failure = error;
- appendFileSync(state.log, `\n${error.message}\n`);
- } finally {
- try {
- await this.cleanup();
- } catch (error) {
- failure = failure
- ? new AggregateError(
- [failure, error],
- `${failure.message} Cleanup also failed: ${error.message}`,
- )
- : error;
- }
- process.removeListener("SIGTERM", cancel);
- process.removeListener("SIGINT", cancel);
- state.succeeded = !failure;
- this.save();
- }
- if (failure) throw failure;
- return state;
- }
-
- async cleanup() {
- const { state } = this;
- if (!state.socket) return;
- const command = new Command({ timeout: 45_000 });
- for (const label of [
- `${ownerLabel}=${state.id}`,
- `${sessionLabel}=${state.id}`,
- ]) {
- const found = async (kind) =>
- (
- await this.docker(command, [
- kind,
- "ls",
- ...(kind === "container" ? ["--all"] : []),
- "--quiet",
- "--filter",
- `label=${label}`,
- ])
- ).stdout
- .trim()
- .split("\n")
- .filter(Boolean);
- for (const id of await found("container")) {
- await this.docker(command, ["logs", id], {
- log: path.join(state.directory, "diagnostics", `${id}.log`),
- allowFailure: true,
- });
- const removed = await this.docker(
- command,
- ["container", "rm", "--force", "--volumes", id],
- { allowFailure: true },
- );
- if (removed.code !== 0 && (await found("container")).includes(id))
- throw new Error(`Could not remove owned container ${id}`);
- }
- for (const kind of ["network", "volume"]) {
- const ids = await found(kind);
- if (ids.length) {
- await this.docker(command, [kind, "rm", ...ids], {
- allowFailure: true,
- });
- if ((await found(kind)).length)
- throw new Error(`Could not remove owned ${kind} resources.`);
- }
- }
- }
- }
-
- async reportFiles() {
- const { state } = this;
- const files = state.reportFile
- ? await Reports.select(state.workingDirectory, state.reportFile)
- : [state.junit];
- for (const file of files) {
- if (!existsSync(file))
- throw new Error(`Missing native test report: ${file}`);
- if (state.baseline[file] === Reports.fingerprint(file))
- throw new Error(`Stale report from before this invocation: ${file}`);
- new Reports(file).inspect();
- }
- return files;
- }
-
- result(files) {
- const { state } = this;
- if (!state.succeeded || !state.executed)
- throw new Error("Container tests did not succeed.");
- Reports.validate([state.junit]);
- const counts = Reports.validate(files, state.baseline);
- return {
- image: state.image,
- "identity-kind": state.identityKind,
- "image-id": state.imageId,
- engine: state.engine,
- suite: state.workingDirectory,
- platform: state.platform,
- "daemon-platform": state.daemonPlatform,
- run: state.run,
- attempt: state.attempt,
- tests: counts,
- reports: files,
- logs: path.join(state.directory, "diagnostics"),
- };
- }
-
- async finish() {
- const { state } = this;
- await this.cleanup();
- rmSync(path.join(state.directory, "tools"), {
- recursive: true,
- force: true,
- });
- }
-}
+export { Configuration } from "./Configuration.js";
+export { ContainerReports } from "./ContainerReports.js";
+export { ContainerTest } from "./ContainerTest.js";
+export { Reports } from "./Reports.js";
+export { Tooling } from "./Tooling.js";
diff --git a/actions/docker/verify-images/package.json b/actions/docker/verify-images/package.json
index 77da4dcf..fe60ff3b 100644
--- a/actions/docker/verify-images/package.json
+++ b/actions/docker/verify-images/package.json
@@ -7,8 +7,6 @@
},
"scripts": {
"test": "node --test",
- "test:watch": "node --test --watch",
- "pretest:ci": "node -e \"require('node:fs').mkdirSync('coverage', { recursive: true })\"",
- "test:ci": "node --experimental-test-coverage --test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=coverage/junit.xml --test-reporter=lcov --test-reporter-destination=coverage/lcov.info --test"
+ "test:watch": "node --test --watch"
}
}
diff --git a/actions/helm/generate-docs/action.yml b/actions/helm/generate-docs/action.yml
index 270a4e9e..6da113d6 100644
--- a/actions/helm/generate-docs/action.yml
+++ b/actions/helm/generate-docs/action.yml
@@ -180,7 +180,7 @@ runs:
core.info(required ? 'Generate Helm documentation.' : 'Helm documentation inputs are unchanged since successful CI.');
- if: ${{ steps.changes.outputs.required == 'true' && (inputs.checkout-ref != '') }}
- uses: hoverkraft-tech/ci-github-common/actions/checkout@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1
+ uses: hoverkraft-tech/ci-github-common/actions/checkout@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0
with:
ref: ${{ inputs.checkout-ref }}
@@ -225,7 +225,7 @@ runs:
permission-contents: write
permission-pull-requests: write
- - uses: hoverkraft-tech/ci-github-common/actions/create-and-merge-pull-request@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1
+ - uses: hoverkraft-tech/ci-github-common/actions/create-and-merge-pull-request@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0
if: steps.changes.outputs.required == 'true'
id: create-and-merge-pull-request
with:
diff --git a/actions/helm/generate-docs/package.json b/actions/helm/generate-docs/package.json
index 7f078e2f..e8dbc703 100644
--- a/actions/helm/generate-docs/package.json
+++ b/actions/helm/generate-docs/package.json
@@ -31,11 +31,7 @@
"scripts": {
"test": "node --test",
"test:watch": "node --test --watch",
- "pretest:ci": "node -e \"require('node:fs').mkdirSync('coverage', { recursive: true })\"",
- "test:ci": "node --experimental-test-coverage --test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=coverage/junit.xml --test-reporter=lcov --test-reporter-destination=coverage/lcov.info --test",
- "build": "node build.mjs",
- "check:dist": "npm run build && git diff --exit-code -- dist && test -z \"$(git ls-files --others --exclude-standard -- dist)\"",
- "test:distribution": "node --test src/*.test.js"
+ "build": "node build.mjs"
},
"devDependencies": {
"@vercel/ncc": "0.45.0",
diff --git a/actions/helm/lint-chart/dist/index.js b/actions/helm/lint-chart/dist/index.js
index 6cd3c304..fd8bca18 100644
--- a/actions/helm/lint-chart/dist/index.js
+++ b/actions/helm/lint-chart/dist/index.js
@@ -8687,35 +8687,19 @@ __nccwpck_require__.d(__webpack_exports__, {
const external_node_crypto_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:crypto");
;// CONCATENATED MODULE: external "node:fs"
const external_node_fs_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs");
+var external_node_fs_namespaceObject_0 = /*#__PURE__*/__nccwpck_require__.t(external_node_fs_namespaceObject, 2);
;// CONCATENATED MODULE: external "node:path"
const external_node_path_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:path");
-;// CONCATENATED MODULE: external "events"
-const external_events_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("events");
-;// CONCATENATED MODULE: external "fs"
-const external_fs_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("fs");
-;// CONCATENATED MODULE: external "node:events"
-const external_node_events_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:events");
-;// CONCATENATED MODULE: external "node:stream"
-const external_node_stream_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:stream");
-;// CONCATENATED MODULE: external "node:string_decoder"
-const external_node_string_decoder_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:string_decoder");
-;// CONCATENATED MODULE: external "path"
-const external_path_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("path");
-;// CONCATENATED MODULE: external "assert"
-const external_assert_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("assert");
-// EXTERNAL MODULE: external "buffer"
-var external_buffer_ = __nccwpck_require__(181);
-;// CONCATENATED MODULE: external "zlib"
-const external_zlib_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("zlib");
-var external_zlib_namespaceObject_0 = /*#__PURE__*/__nccwpck_require__.t(external_zlib_namespaceObject, 2);
-;// CONCATENATED MODULE: external "node:assert"
-const external_node_assert_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:assert");
;// CONCATENATED MODULE: external "node:fs/promises"
const promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs/promises");
-;// CONCATENATED MODULE: ./node_modules/tar/dist/esm/index.min.js
-var zr=Object.defineProperty;var Ur=(s,t)=>{for(var e in t)zr(s,e,{get:t[e],enumerable:!0})};var Ds=typeof process=="object"&&process?process:{stdout:null,stderr:null},Wr=s=>!!s&&typeof s=="object"&&(s instanceof A||s instanceof external_node_stream_namespaceObject||Gr(s)||Zr(s)),Gr=s=>!!s&&typeof s=="object"&&s instanceof external_node_events_namespaceObject.EventEmitter&&typeof s.pipe=="function"&&s.pipe!==external_node_stream_namespaceObject.Writable.prototype.pipe,Zr=s=>!!s&&typeof s=="object"&&s instanceof external_node_events_namespaceObject.EventEmitter&&typeof s.write=="function"&&typeof s.end=="function",Q=Symbol("EOF"),J=Symbol("maybeEmitEnd"),nt=Symbol("emittedEnd"),De=Symbol("emittingEnd"),qt=Symbol("emittedError"),Ne=Symbol("closed"),Ns=Symbol("read"),Ae=Symbol("flush"),As=Symbol("flushChunk"),z=Symbol("encoding"),Mt=Symbol("decoder"),g=Symbol("flowing"),Qt=Symbol("paused"),Bt=Symbol("resume"),b=Symbol("buffer"),N=Symbol("pipes"),_=Symbol("bufferLength"),bi=Symbol("bufferPush"),Ie=Symbol("bufferShift"),L=Symbol("objectMode"),S=Symbol("destroyed"),_i=Symbol("error"),Oi=Symbol("emitData"),Is=Symbol("emitEnd"),Ti=Symbol("emitEnd2"),Z=Symbol("async"),xi=Symbol("abort"),Ce=Symbol("aborted"),Jt=Symbol("signal"),Rt=Symbol("dataListeners"),C=Symbol("discarded"),jt=s=>Promise.resolve().then(s),Yr=s=>s(),Kr=s=>s==="end"||s==="finish"||s==="prefinish",Vr=s=>s instanceof ArrayBuffer||!!s&&typeof s=="object"&&s.constructor&&s.constructor.name==="ArrayBuffer"&&s.byteLength>=0,$r=s=>!Buffer.isBuffer(s)&&ArrayBuffer.isView(s),Fe=class{src;dest;opts;ondrain;constructor(t,e,i){this.src=t,this.dest=e,this.opts=i,this.ondrain=()=>t[Bt](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Li=class extends Fe{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,i){super(t,e,i),this.proxyErrors=r=>this.dest.emit("error",r),t.on("error",this.proxyErrors)}},Xr=s=>!!s.objectMode,qr=s=>!s.objectMode&&!!s.encoding&&s.encoding!=="buffer",A=class extends external_node_events_namespaceObject.EventEmitter{[g]=!1;[Qt]=!1;[N]=[];[b]=[];[L];[z];[Z];[Mt];[Q]=!1;[nt]=!1;[De]=!1;[Ne]=!1;[qt]=null;[_]=0;[S]=!1;[Jt];[Ce]=!1;[Rt]=0;[C]=!1;writable=!0;readable=!0;constructor(...t){let e=t[0]||{};if(super(),e.objectMode&&typeof e.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Xr(e)?(this[L]=!0,this[z]=null):qr(e)?(this[z]=e.encoding,this[L]=!1):(this[L]=!1,this[z]=null),this[Z]=!!e.async,this[Mt]=this[z]?new external_node_string_decoder_namespaceObject.StringDecoder(this[z]):null,e&&e.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[b]}),e&&e.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[N]});let{signal:i}=e;i&&(this[Jt]=i,i.aborted?this[xi]():i.addEventListener("abort",()=>this[xi]()))}get bufferLength(){return this[_]}get encoding(){return this[z]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[L]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Z]}set async(t){this[Z]=this[Z]||!!t}[xi](){this[Ce]=!0,this.emit("abort",this[Jt]?.reason),this.destroy(this[Jt]?.reason)}get aborted(){return this[Ce]}set aborted(t){}write(t,e,i){if(this[Ce])return!1;if(this[Q])throw new Error("write after end");if(this[S])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof e=="function"&&(i=e,e="utf8"),e||(e="utf8");let r=this[Z]?jt:Yr;if(!this[L]&&!Buffer.isBuffer(t)){if($r(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(Vr(t))t=Buffer.from(t);else if(typeof t!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[L]?(this[g]&&this[_]!==0&&this[Ae](!0),this[g]?this.emit("data",t):this[bi](t),this[_]!==0&&this.emit("readable"),i&&r(i),this[g]):t.length?(typeof t=="string"&&!(e===this[z]&&!this[Mt]?.lastNeed)&&(t=Buffer.from(t,e)),Buffer.isBuffer(t)&&this[z]&&(t=this[Mt].write(t)),this[g]&&this[_]!==0&&this[Ae](!0),this[g]?this.emit("data",t):this[bi](t),this[_]!==0&&this.emit("readable"),i&&r(i),this[g]):(this[_]!==0&&this.emit("readable"),i&&r(i),this[g])}read(t){if(this[S])return null;if(this[C]=!1,this[_]===0||t===0||t&&t>this[_])return this[J](),null;this[L]&&(t=null),this[b].length>1&&!this[L]&&(this[b]=[this[z]?this[b].join(""):Buffer.concat(this[b],this[_])]);let e=this[Ns](t||null,this[b][0]);return this[J](),e}[Ns](t,e){if(this[L])this[Ie]();else{let i=e;t===i.length||t===null?this[Ie]():typeof i=="string"?(this[b][0]=i.slice(t),e=i.slice(0,t),this[_]-=t):(this[b][0]=i.subarray(t),e=i.subarray(0,t),this[_]-=t)}return this.emit("data",e),!this[b].length&&!this[Q]&&this.emit("drain"),e}end(t,e,i){return typeof t=="function"&&(i=t,t=void 0),typeof e=="function"&&(i=e,e="utf8"),t!==void 0&&this.write(t,e),i&&this.once("end",i),this[Q]=!0,this.writable=!1,(this[g]||!this[Qt])&&this[J](),this}[Bt](){this[S]||(!this[Rt]&&!this[N].length&&(this[C]=!0),this[Qt]=!1,this[g]=!0,this.emit("resume"),this[b].length?this[Ae]():this[Q]?this[J]():this.emit("drain"))}resume(){return this[Bt]()}pause(){this[g]=!1,this[Qt]=!0,this[C]=!1}get destroyed(){return this[S]}get flowing(){return this[g]}get paused(){return this[Qt]}[bi](t){this[L]?this[_]+=1:this[_]+=t.length,this[b].push(t)}[Ie](){return this[L]?this[_]-=1:this[_]-=this[b][0].length,this[b].shift()}[Ae](t=!1){do;while(this[As](this[Ie]())&&this[b].length);!t&&!this[b].length&&!this[Q]&&this.emit("drain")}[As](t){return this.emit("data",t),this[g]}pipe(t,e){if(this[S])return t;this[C]=!1;let i=this[nt];return e=e||{},t===Ds.stdout||t===Ds.stderr?e.end=!1:e.end=e.end!==!1,e.proxyErrors=!!e.proxyErrors,i?e.end&&t.end():(this[N].push(e.proxyErrors?new Li(this,t,e):new Fe(this,t,e)),this[Z]?jt(()=>this[Bt]()):this[Bt]()),t}unpipe(t){let e=this[N].find(i=>i.dest===t);e&&(this[N].length===1?(this[g]&&this[Rt]===0&&(this[g]=!1),this[N]=[]):this[N].splice(this[N].indexOf(e),1),e.unpipe())}addListener(t,e){return this.on(t,e)}on(t,e){let i=super.on(t,e);if(t==="data")this[C]=!1,this[Rt]++,!this[N].length&&!this[g]&&this[Bt]();else if(t==="readable"&&this[_]!==0)super.emit("readable");else if(Kr(t)&&this[nt])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[qt]){let r=e;this[Z]?jt(()=>r.call(this,this[qt])):r.call(this,this[qt])}return i}removeListener(t,e){return this.off(t,e)}off(t,e){let i=super.off(t,e);return t==="data"&&(this[Rt]=this.listeners("data").length,this[Rt]===0&&!this[C]&&!this[N].length&&(this[g]=!1)),i}removeAllListeners(t){let e=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[Rt]=0,!this[C]&&!this[N].length&&(this[g]=!1)),e}get emittedEnd(){return this[nt]}[J](){!this[De]&&!this[nt]&&!this[S]&&this[b].length===0&&this[Q]&&(this[De]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Ne]&&this.emit("close"),this[De]=!1)}emit(t,...e){let i=e[0];if(t!=="error"&&t!=="close"&&t!==S&&this[S])return!1;if(t==="data")return!this[L]&&!i?!1:this[Z]?(jt(()=>this[Oi](i)),!0):this[Oi](i);if(t==="end")return this[Is]();if(t==="close"){if(this[Ne]=!0,!this[nt]&&!this[S])return!1;let n=super.emit("close");return this.removeAllListeners("close"),n}else if(t==="error"){this[qt]=i,super.emit(_i,i);let n=!this[Jt]||this.listeners("error").length?super.emit("error",i):!1;return this[J](),n}else if(t==="resume"){let n=super.emit("resume");return this[J](),n}else if(t==="finish"||t==="prefinish"){let n=super.emit(t);return this.removeAllListeners(t),n}let r=super.emit(t,...e);return this[J](),r}[Oi](t){for(let i of this[N])i.dest.write(t)===!1&&this.pause();let e=this[C]?!1:super.emit("data",t);return this[J](),e}[Is](){return this[nt]?!1:(this[nt]=!0,this.readable=!1,this[Z]?(jt(()=>this[Ti]()),!0):this[Ti]())}[Ti](){if(this[Mt]){let e=this[Mt].end();if(e){for(let i of this[N])i.dest.write(e);this[C]||super.emit("data",e)}}for(let e of this[N])e.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[L]||(t.dataLength=0);let e=this.promise();return this.on("data",i=>{t.push(i),this[L]||(t.dataLength+=i.length)}),await e,t}async concat(){if(this[L])throw new Error("cannot concat in objectMode");let t=await this.collect();return this[z]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,e)=>{this.on(S,()=>e(new Error("stream destroyed"))),this.on("error",i=>e(i)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[C]=!1;let t=!1,e=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return e();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[Q])return e();let n,o,h=d=>{this.off("data",a),this.off("end",l),this.off(S,c),e(),o(d)},a=d=>{this.off("error",h),this.off("end",l),this.off(S,c),this.pause(),n({value:d,done:!!this[Q]})},l=()=>{this.off("error",h),this.off("data",a),this.off(S,c),e(),n({done:!0,value:void 0})},c=()=>h(new Error("stream destroyed"));return new Promise((d,y)=>{o=y,n=d,this.once(S,c),this.once("error",h),this.once("end",l),this.once("data",a)})},throw:e,return:e,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[C]=!1;let t=!1,e=()=>(this.pause(),this.off(_i,e),this.off(S,e),this.off("end",e),t=!0,{done:!0,value:void 0}),i=()=>{if(t)return e();let r=this.read();return r===null?e():{done:!1,value:r}};return this.once("end",e),this.once(_i,e),this.once(S,e),{next:i,throw:e,return:e,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(t){if(this[S])return t?this.emit("error",t):this.emit(S),this;this[S]=!0,this[C]=!0,this[b].length=0,this[_]=0;let e=this;return typeof e.close=="function"&&!this[Ne]&&e.close(),t?this.emit("error",t):this.emit(S),this}static get isStream(){return Wr}};var Jr=external_fs_namespaceObject.writev,ht=Symbol("_autoClose"),H=Symbol("_close"),te=Symbol("_ended"),m=Symbol("_fd"),Ni=Symbol("_finished"),tt=Symbol("_flags"),Ai=Symbol("_flush"),ki=Symbol("_handleChunk"),vi=Symbol("_makeBuf"),ie=Symbol("_mode"),ke=Symbol("_needDrain"),Ut=Symbol("_onerror"),Ht=Symbol("_onopen"),Ii=Symbol("_onread"),Pt=Symbol("_onwrite"),at=Symbol("_open"),U=Symbol("_path"),ot=Symbol("_pos"),Y=Symbol("_queue"),zt=Symbol("_read"),Ci=Symbol("_readSize"),j=Symbol("_reading"),ee=Symbol("_remain"),Fi=Symbol("_size"),ve=Symbol("_write"),gt=Symbol("_writing"),Me=Symbol("_defaultFlag"),bt=Symbol("_errored"),_t=class extends A{[bt]=!1;[m];[U];[Ci];[j]=!1;[Fi];[ee];[ht];constructor(t,e){if(e=e||{},super(e),this.readable=!0,this.writable=!1,typeof t!="string")throw new TypeError("path must be a string");this[bt]=!1,this[m]=typeof e.fd=="number"?e.fd:void 0,this[U]=t,this[Ci]=e.readSize||16*1024*1024,this[j]=!1,this[Fi]=typeof e.size=="number"?e.size:1/0,this[ee]=this[Fi],this[ht]=typeof e.autoClose=="boolean"?e.autoClose:!0,typeof this[m]=="number"?this[zt]():this[at]()}get fd(){return this[m]}get path(){return this[U]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[at](){external_fs_namespaceObject.open(this[U],"r",(t,e)=>this[Ht](t,e))}[Ht](t,e){t?this[Ut](t):(this[m]=e,this.emit("open",e),this[zt]())}[vi](){return Buffer.allocUnsafe(Math.min(this[Ci],this[ee]))}[zt](){if(!this[j]){this[j]=!0;let t=this[vi]();if(t.length===0)return process.nextTick(()=>this[Ii](null,0,t));external_fs_namespaceObject.read(this[m],t,0,t.length,null,(e,i,r)=>this[Ii](e,i,r))}}[Ii](t,e,i){this[j]=!1,t?this[Ut](t):this[ki](e,i)&&this[zt]()}[H](){if(this[ht]&&typeof this[m]=="number"){let t=this[m];this[m]=void 0,external_fs_namespaceObject.close(t,e=>e?this.emit("error",e):this.emit("close"))}}[Ut](t){this[j]=!0,this[H](),this.emit("error",t)}[ki](t,e){let i=!1;return this[ee]-=t,t>0&&(i=super.write(tthis[Ht](t,e))}[Ht](t,e){this[Me]&&this[tt]==="r+"&&t&&t.code==="ENOENT"?(this[tt]="w",this[at]()):t?this[Ut](t):(this[m]=e,this.emit("open",e),this[gt]||this[Ai]())}end(t,e){return t&&this.write(t,e),this[te]=!0,!this[gt]&&!this[Y].length&&typeof this[m]=="number"&&this[Pt](null,0),this}write(t,e){return typeof t=="string"&&(t=Buffer.from(t,e)),this[te]?(this.emit("error",new Error("write() after end()")),!1):this[m]===void 0||this[gt]||this[Y].length?(this[Y].push(t),this[ke]=!0,!1):(this[gt]=!0,this[ve](t),!0)}[ve](t){external_fs_namespaceObject.write(this[m],t,0,t.length,this[ot],(e,i)=>this[Pt](e,i))}[Pt](t,e){t?this[Ut](t):(this[ot]!==void 0&&typeof e=="number"&&(this[ot]+=e),this[Y].length?this[Ai]():(this[gt]=!1,this[te]&&!this[Ni]?(this[Ni]=!0,this[H](),this.emit("finish")):this[ke]&&(this[ke]=!1,this.emit("drain"))))}[Ai](){if(this[Y].length===0)this[te]&&this[Pt](null,0);else if(this[Y].length===1)this[ve](this[Y].pop());else{let t=this[Y];this[Y]=[],Jr(this[m],t,this[ot],(e,i)=>this[Pt](e,i))}}[H](){if(this[ht]&&typeof this[m]=="number"){let t=this[m];this[m]=void 0,external_fs_namespaceObject.close(t,e=>e?this.emit("error",e):this.emit("close"))}}},Wt=class extends et{[at](){let t;if(this[Me]&&this[tt]==="r+")try{t=external_fs_namespaceObject.openSync(this[U],this[tt],this[ie])}catch(e){if(e?.code==="ENOENT")return this[tt]="w",this[at]();throw e}else t=external_fs_namespaceObject.openSync(this[U],this[tt],this[ie]);this[Ht](null,t)}[H](){if(this[ht]&&typeof this[m]=="number"){let t=this[m];this[m]=void 0,external_fs_namespaceObject.closeSync(t),this.emit("close")}}[ve](t){let e=!0;try{this[Pt](null,external_fs_namespaceObject.writeSync(this[m],t,0,t.length,this[ot])),e=!1}finally{if(e)try{this[H]()}catch{}}}};var jr=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),Fs=s=>!!s.sync&&!!s.file,ks=s=>!s.sync&&!!s.file,vs=s=>!!s.sync&&!s.file,Ms=s=>!s.sync&&!s.file;var Bs=s=>!!s.file;var tn=s=>{let t=jr.get(s);return t||s},se=(s={})=>{if(!s)return{};let t={};for(let[e,i]of Object.entries(s)){let r=tn(e);t[r]=i}return t.chmod===void 0&&t.noChmod===!1&&(t.chmod=!0),delete t.noChmod,t};var K=(s,t,e,i,r)=>Object.assign((n=[],o,h)=>{Array.isArray(n)&&(o=n,n={}),typeof o=="function"&&(h=o,o=void 0),o=o?Array.from(o):[];let a=se(n);if(r?.(a,o),Fs(a)){if(typeof h=="function")throw new TypeError("callback not supported for sync tar functions");return s(a,o)}else if(ks(a)){let l=t(a,o);return h?l.then(()=>h(),h):l}else if(vs(a)){if(typeof h=="function")throw new TypeError("callback not supported for sync tar functions");return e(a,o)}else if(Ms(a)){if(typeof h=="function")throw new TypeError("callback only supported with file option");return i(a,o)}throw new Error("impossible options??")},{syncFile:s,asyncFile:t,syncNoFile:e,asyncNoFile:i,validate:r});var sn=external_zlib_namespaceObject.constants||{ZLIB_VERNUM:4736},M=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},sn));var rn=external_buffer_.Buffer.concat,zs=Object.getOwnPropertyDescriptor(external_buffer_.Buffer,"concat"),nn=s=>s,Bi=zs?.writable===!0||zs?.set!==void 0?s=>{external_buffer_.Buffer.concat=s?nn:rn}:s=>{},Tt=Symbol("_superWrite"),Gt=class extends Error{code;errno;constructor(t,e){super("zlib: "+t.message,{cause:t}),this.code=t.code,this.errno=t.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+t.message,Error.captureStackTrace(this,e??this.constructor)}get name(){return"ZlibError"}},Pi=Symbol("flushFlag"),re=class extends A{#t=!1;#i=!1;#s;#n;#r;#e;#o;get sawError(){return this.#t}get handle(){return this.#e}get flushFlag(){return this.#s}constructor(t,e){if(!t||typeof t!="object")throw new TypeError("invalid options for ZlibBase constructor");if(super(t),this.#s=t.flush??0,this.#n=t.finishFlush??0,this.#r=t.fullFlushFlag??0,typeof external_zlib_namespaceObject_0[e]!="function")throw new TypeError("Compression method not supported: "+e);try{this.#e=new external_zlib_namespaceObject_0[e](t)}catch(i){throw new Gt(i,this.constructor)}this.#o=i=>{this.#t||(this.#t=!0,this.close(),this.emit("error",i))},this.#e?.on("error",i=>this.#o(new Gt(i))),this.once("end",()=>this.close)}close(){this.#e&&(this.#e.close(),this.#e=void 0,this.emit("close"))}reset(){if(!this.#t)return external_assert_namespaceObject(this.#e,"zlib binding closed"),this.#e.reset?.()}flush(t){this.ended||(typeof t!="number"&&(t=this.#r),this.write(Object.assign(external_buffer_.Buffer.alloc(0),{[Pi]:t})))}end(t,e,i){return typeof t=="function"&&(i=t,e=void 0,t=void 0),typeof e=="function"&&(i=e,e=void 0),t&&(e?this.write(t,e):this.write(t)),this.flush(this.#n),this.#i=!0,super.end(i)}get ended(){return this.#i}[Tt](t){return super.write(t)}write(t,e,i){if(typeof e=="function"&&(i=e,e="utf8"),typeof t=="string"&&(t=external_buffer_.Buffer.from(t,e)),this.#t)return;external_assert_namespaceObject(this.#e,"zlib binding closed");let r=this.#e._handle,n=r.close;r.close=()=>{};let o=this.#e.close;this.#e.close=()=>{},Bi(!0);let h;try{let l=typeof t[Pi]=="number"?t[Pi]:this.#s;h=this.#e._processChunk(t,l),Bi(!1)}catch(l){Bi(!1),this.#o(new Gt(l,this.write))}finally{this.#e&&(this.#e._handle=r,r.close=n,this.#e.close=o,this.#e.removeAllListeners("error"))}this.#e&&this.#e.on("error",l=>this.#o(new Gt(l,this.write)));let a;if(h)if(Array.isArray(h)&&h.length>0){let l=h[0];a=this[Tt](external_buffer_.Buffer.from(l));for(let c=1;c{typeof r=="function"&&(n=r,r=this.flushFlag),this.flush(r),n?.()};try{this.handle.params(t,e)}finally{this.handle.flush=i}this.handle&&(this.#t=t,this.#i=e)}}}};var ze=class extends Pe{#t;constructor(t){super(t,"Gzip"),this.#t=t&&!!t.portable}[Tt](t){return this.#t?(this.#t=!1,t[9]=255,super[Tt](t)):super[Tt](t)}};var Ue=class extends Pe{constructor(t){super(t,"Unzip")}},He=class extends re{constructor(t,e){t=t||{},t.flush=t.flush||M.BROTLI_OPERATION_PROCESS,t.finishFlush=t.finishFlush||M.BROTLI_OPERATION_FINISH,t.fullFlushFlag=M.BROTLI_OPERATION_FLUSH,super(t,e)}},We=class extends He{constructor(t){super(t,"BrotliCompress")}},Ge=class extends He{constructor(t){super(t,"BrotliDecompress")}},Ze=class extends re{constructor(t,e){t=t||{},t.flush=t.flush||M.ZSTD_e_continue,t.finishFlush=t.finishFlush||M.ZSTD_e_end,t.fullFlushFlag=M.ZSTD_e_flush,super(t,e)}},Ye=class extends Ze{constructor(t){super(t,"ZstdCompress")}},Ke=class extends Ze{constructor(t){super(t,"ZstdDecompress")}};var Us=(s,t)=>{if(Number.isSafeInteger(s))s<0?an(s,t):hn(s,t);else throw Error("cannot encode number outside of javascript safe integer range");return t},hn=(s,t)=>{t[0]=128;for(var e=t.length;e>1;e--)t[e-1]=s&255,s=Math.floor(s/256)},an=(s,t)=>{t[0]=255;var e=!1;s=s*-1;for(var i=t.length;i>1;i--){var r=s&255;s=Math.floor(s/256),e?t[i-1]=Ws(r):r===0?t[i-1]=0:(e=!0,t[i-1]=Gs(r))}},Hs=s=>{let t=s[0],e=t===128?cn(s.subarray(1,s.length)):t===255?ln(s):null;if(e===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(e))throw Error("parsed number outside of javascript safe integer range");return e},ln=s=>{for(var t=s.length,e=0,i=!1,r=t-1;r>-1;r--){var n=Number(s[r]),o;i?o=Ws(n):n===0?o=n:(i=!0,o=Gs(n)),o!==0&&(e-=o*Math.pow(256,t-r-1))}return e},cn=s=>{for(var t=s.length,e=0,i=t-1;i>-1;i--){var r=Number(s[i]);r!==0&&(e+=r*Math.pow(256,t-i-1))}return e},Ws=s=>(255^s)&255,Gs=s=>(255^s)+1&255;var Hi={};Ur(Hi,{code:()=>Ve,isCode:()=>ne,isName:()=>dn,name:()=>oe,normalFsTypes:()=>Ui});var ne=s=>oe.has(s),dn=s=>Ve.has(s),Ui=new Set(["0","","1","2","3","4","5","6","7","D"]),oe=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),Ve=new Map(Array.from(oe).map(s=>[s[1],s[0]]));var un=s=>s===void 0||s<0?void 0:s,F=class{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#t="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(t,e=0,i,r){Buffer.isBuffer(t)?this.decode(t,e||0,i,r):t&&this.#i(t)}decode(t,e,i,r){if(e||(e=0),!t||!(t.length>=e+512))throw new Error("need 512 bytes for header");let n=xt(t,e+156,1),o=Ui.has(n),h=o?i:void 0,a=o?r:void 0;if(this.path=h?.path??xt(t,e,100),this.mode=h?.mode??a?.mode??lt(t,e+100,8),this.uid=h?.uid??a?.uid??lt(t,e+108,8),this.gid=h?.gid??a?.gid??lt(t,e+116,8),this.size=un(h?.size??a?.size??lt(t,e+124,12)),this.mtime=h?.mtime??a?.mtime??Wi(t,e+136,12),this.cksum=lt(t,e+148,12),a&&this.#i(a,!0),h&&this.#i(h),ne(n)&&(this.#t=n||"0"),this.#t==="0"&&this.path.slice(-1)==="/"&&(this.#t="5"),this.#t==="5"&&(this.size=0),this.linkpath=xt(t,e+157,100),t.subarray(e+257,e+265).toString()==="ustar\x0000")if(this.uname=h?.uname??a?.uname??xt(t,e+265,32),this.gname=h?.gname??a?.gname??xt(t,e+297,32),this.devmaj=h?.devmaj??a?.devmaj??lt(t,e+329,8)??0,this.devmin=h?.devmin??a?.devmin??lt(t,e+337,8)??0,t[e+475]!==0){let c=xt(t,e+345,155);this.path=c+"/"+this.path}else{let c=xt(t,e+345,130);c&&(this.path=c+"/"+this.path),this.atime=i?.atime??r?.atime??Wi(t,e+476,12),this.ctime=i?.ctime??r?.ctime??Wi(t,e+488,12)}let l=256;for(let c=e;c!(r==null||i==="size"&&Number(r)<0||i==="path"&&e||i==="linkpath"&&e||i==="global"))))}encode(t,e=0){if(t||(t=this.block=Buffer.alloc(512)),this.#t==="Unsupported"&&(this.#t="0"),!(t.length>=e+512))throw new Error("need 512 bytes for header");let i=this.ctime||this.atime?130:155,r=mn(this.path||"",i),n=r[0],o=r[1];this.needPax=!!r[2],this.needPax=Lt(t,e,100,n)||this.needPax,this.needPax=ct(t,e+100,8,this.mode)||this.needPax,this.needPax=ct(t,e+108,8,this.uid)||this.needPax,this.needPax=ct(t,e+116,8,this.gid)||this.needPax,this.needPax=ct(t,e+124,12,this.size)||this.needPax,this.needPax=Gi(t,e+136,12,this.mtime)||this.needPax,t[e+156]=Number(this.#t.codePointAt(0)),this.needPax=Lt(t,e+157,100,this.linkpath)||this.needPax,t.write("ustar\x0000",e+257,8),this.needPax=Lt(t,e+265,32,this.uname)||this.needPax,this.needPax=Lt(t,e+297,32,this.gname)||this.needPax,this.needPax=ct(t,e+329,8,this.devmaj)||this.needPax,this.needPax=ct(t,e+337,8,this.devmin)||this.needPax,this.needPax=Lt(t,e+345,i,o)||this.needPax,t[e+475]!==0?this.needPax=Lt(t,e+345,155,o)||this.needPax:(this.needPax=Lt(t,e+345,130,o)||this.needPax,this.needPax=Gi(t,e+476,12,this.atime)||this.needPax,this.needPax=Gi(t,e+488,12,this.ctime)||this.needPax);let h=256;for(let a=e;a{let i=s,r="",n,o=external_node_path_namespaceObject.posix.parse(s).root||".";if(Buffer.byteLength(i)<100)n=[i,r,!1];else{r=external_node_path_namespaceObject.posix.dirname(i),i=external_node_path_namespaceObject.posix.basename(i);do Buffer.byteLength(i)<=100&&Buffer.byteLength(r)<=t?n=[i,r,!1]:Buffer.byteLength(i)>100&&Buffer.byteLength(r)<=t?n=[i.slice(0,99),r,!0]:(i=external_node_path_namespaceObject.posix.join(external_node_path_namespaceObject.posix.basename(r),i),r=external_node_path_namespaceObject.posix.dirname(r));while(r!==o&&n===void 0);n||(n=[s.slice(0,99),"",!0])}return n},xt=(s,t,e)=>s.subarray(t,t+e).toString("utf8").replace(/\0.*/,""),Wi=(s,t,e)=>pn(lt(s,t,e)),pn=s=>s===void 0?void 0:new Date(s*1e3),lt=(s,t,e)=>Number(s[t])&128?Hs(s.subarray(t,t+e)):wn(s,t,e),En=s=>isNaN(s)?void 0:s,wn=(s,t,e)=>En(parseInt(s.subarray(t,t+e).toString("utf8").replace(/\0.*$/,"").trim(),8)),Sn={12:8589934591,8:2097151},ct=(s,t,e,i)=>i===void 0?!1:i>Sn[e]||i<0?(Us(i,s.subarray(t,t+e)),!0):(yn(s,t,e,i),!1),yn=(s,t,e,i)=>s.write(Rn(i,e),t,e,"ascii"),Rn=(s,t)=>gn(Math.floor(s).toString(8),t),gn=(s,t)=>(s.length===t-1?s:new Array(t-s.length-1).join("0")+s+" ")+"\0",Gi=(s,t,e,i)=>i===void 0?!1:ct(s,t,e,i.getTime()/1e3),bn=new Array(156).join("\0"),Lt=(s,t,e,i)=>i===void 0?!1:(s.write(i+bn,t,e,"utf8"),i.length!==Buffer.byteLength(i)||i.length>e);var ft=class s{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(t,e=!1){this.atime=t.atime,this.charset=t.charset,this.comment=t.comment,this.ctime=t.ctime,this.dev=t.dev,this.gid=t.gid,this.global=e,this.gname=t.gname,this.ino=t.ino,this.linkpath=t.linkpath,this.mtime=t.mtime,this.nlink=t.nlink,this.path=t.path,this.size=t.size,this.uid=t.uid,this.uname=t.uname}encode(){let t=this.encodeBody();if(t==="")return Buffer.allocUnsafe(0);let e=Buffer.byteLength(t),i=512*Math.ceil(1+e/512),r=Buffer.allocUnsafe(i);for(let n=0;n<512;n++)r[n]=0;new F({path:("PaxHeader/"+(0,external_node_path_namespaceObject.basename)(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:e,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(r),r.write(t,512,e,"utf8");for(let n=e+512;n=Math.pow(10,o)&&(o+=1),o+n+r}static parse(t,e,i=!1){return new s(On(Tn(t),e),i)}},On=(s,t)=>t?Object.assign({},t,s):s,Tn=s=>s.replace(/\n$/,"").split(`
-`).reduce(xn,Object.create(null)),xn=(s,t)=>{let e=parseInt(t,10);if(e!==Buffer.byteLength(t)+1)return s;t=t.slice((e+" ").length);let i=t.split("="),r=i.shift();if(!r)return s;let n=r.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),o=i.join("=").replace(/\0.*/,"");switch(n){case"path":case"linkpath":case"type":case"charset":case"comment":case"gname":case"uname":s[n]=o;break;case"ctime":case"atime":case"mtime":s[n]=new Date(Number(o)*1e3);break;case"size":let h=+o;h>=0&&(s[n]=h);break;case"gid":case"uid":case"dev":case"ino":case"nlink":case"mode":s[n]=+o;break}return s};var Ln=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,f=Ln!=="win32"?s=>String(s):s=>String(s).replaceAll(/\\/g,"/");var $e=class extends A{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(t,e,i){switch(super({}),this.pause(),this.extended=e,this.globalExtended=i,this.header=t,this.remain=t.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=t.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!t.path)throw new Error("no path provided for tar.ReadEntry");this.path=f(t.path),this.mode=t.mode,this.mode&&(this.mode=this.mode&4095),this.uid=t.uid,this.gid=t.gid,this.uname=t.uname,this.gname=t.gname,this.size=this.remain,this.mtime=t.mtime,this.atime=t.atime,this.ctime=t.ctime,this.linkpath=t.linkpath?f(t.linkpath):void 0,this.uname=t.uname,this.gname=t.gname,e&&this.#t(e),i&&this.#t(i,!0)}write(t){let e=t.length;if(e>this.blockRemain)throw new Error("writing more to entry than is appropriate");let i=this.remain,r=this.blockRemain;return this.remain=Math.max(0,i-e),this.blockRemain=Math.max(0,r-e),this.ignore?!0:i>=e?super.write(t):super.write(t.subarray(0,i))}#t(t,e=!1){t.path&&(t.path=f(t.path)),t.linkpath&&(t.linkpath=f(t.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(t).filter(([i,r])=>!(r==null||i==="path"&&e))))}};var Dt=(s,t,e,i={})=>{s.file&&(i.file=s.file),s.cwd&&(i.cwd=s.cwd),i.code=e instanceof Error&&e.code||t,i.tarCode=t,!s.strict&&i.recoverable!==!1?(e instanceof Error&&(i=Object.assign(e,i),e=e.message),s.emit("warn",t,e,i)):e instanceof Error?s.emit("error",Object.assign(e,i)):s.emit("error",Object.assign(new Error(`${t}: ${e}`),i))};var Nn=1024*1024,Xi=Buffer.from([31,139]),qi=Buffer.from([40,181,47,253]),An=Math.max(Xi.length,qi.length),B=Symbol("state"),Nt=Symbol("writeEntry"),it=Symbol("readEntry"),Zi=Symbol("nextEntry"),Zs=Symbol("processEntry"),V=Symbol("extendedHeader"),he=Symbol("globalExtendedHeader"),dt=Symbol("meta"),Ys=Symbol("emitMeta"),p=Symbol("buffer"),st=Symbol("queue"),ut=Symbol("ended"),Yi=Symbol("emittedEnd"),At=Symbol("emit"),w=Symbol("unzip"),Xe=Symbol("consumeChunk"),qe=Symbol("consumeChunkSub"),Ki=Symbol("consumeBody"),Ks=Symbol("consumeMeta"),Vs=Symbol("consumeHeader"),ae=Symbol("consuming"),Vi=Symbol("bufferConcat"),Qe=Symbol("maybeEnd"),Yt=Symbol("writing"),$=Symbol("aborted"),Je=Symbol("onDone"),It=Symbol("sawValidEntry"),je=Symbol("sawNullBlock"),ti=Symbol("sawEOF"),$s=Symbol("closeStream"),In=1e3,le=Symbol("compressedBytesRead"),$i=Symbol("decompressedBytesRead"),Xs=Symbol("checkDecompressionRatio"),Cn=()=>!0,rt=class extends external_events_namespaceObject.EventEmitter{file;strict;maxMetaEntrySize;filter;brotli;zstd;maxDecompressionRatio;writable=!0;readable=!1;[st]=[];[p];[it];[Nt];[B]="begin";[dt]="";[V];[he];[ut]=!1;[w];[$]=!1;[It];[je]=!1;[ti]=!1;[Yt]=!1;[ae]=!1;[Yi]=!1;[le]=0;[$i]=0;constructor(t={}){super(),this.file=t.file||"",this.on(Je,()=>{(this[B]==="begin"||this[It]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),t.ondone?this.on(Je,t.ondone):this.on(Je,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!t.strict,this.maxDecompressionRatio=typeof t.maxDecompressionRatio=="number"?t.maxDecompressionRatio:In,this.maxMetaEntrySize=t.maxMetaEntrySize||Nn,this.filter=typeof t.filter=="function"?t.filter:Cn;let e=t.file&&(t.file.endsWith(".tar.br")||t.file.endsWith(".tbr"));this.brotli=!(t.gzip||t.zstd)&&t.brotli!==void 0?t.brotli:e?void 0:!1;let i=t.file&&(t.file.endsWith(".tar.zst")||t.file.endsWith(".tzst"));this.zstd=!(t.gzip||t.brotli)&&t.zstd!==void 0?t.zstd:i?!0:void 0,this.on("end",()=>this[$s]()),typeof t.onwarn=="function"&&this.on("warn",t.onwarn),typeof t.onReadEntry=="function"&&this.on("entry",t.onReadEntry)}warn(t,e,i={}){Dt(this,t,e,i)}[Vs](t,e){this[It]===void 0&&(this[It]=!1);let i;try{i=new F(t,e,this[V],this[he])}catch(r){return this.warn("TAR_ENTRY_INVALID",r)}if(i.nullBlock)this[je]?(this[ti]=!0,this[B]==="begin"&&(this[B]="header"),this[At]("eof")):(this[je]=!0,this[At]("nullBlock"));else if(this[je]=!1,!i.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:i});else if(!i.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:i});else{let r=i.type;if(/^(Symbolic)?Link$/.test(r)&&!i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:i});else if(!/^(Symbolic)?Link$/.test(r)&&!/^(Global)?ExtendedHeader$/.test(r)&&i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:i});else{let n=this[Nt]=new $e(i,this[V],this[he]);if(!this[It])if(n.remain){let o=()=>{n.invalid||(this[It]=!0)};n.on("end",o)}else this[It]=!0;n.meta?n.size>this.maxMetaEntrySize?(n.ignore=!0,this[At]("ignoredEntry",n),this[B]="ignore",n.resume()):n.size>0&&(this[dt]="",n.on("data",o=>this[dt]+=o),this[B]="meta"):(this[V]=void 0,n.ignore=n.ignore||!this.filter(n.path,n),n.ignore?(this[At]("ignoredEntry",n),this[B]=n.remain?"ignore":"header",n.resume()):(n.remain?this[B]="body":(this[B]="header",n.end()),this[it]?this[st].push(n):(this[st].push(n),this[Zi]())))}}}[$s](){queueMicrotask(()=>this.emit("close"))}[Zs](t){let e=!0;if(!t)this[it]=void 0,e=!1;else if(Array.isArray(t)){let[i,...r]=t;this.emit(i,...r)}else this[it]=t,this.emit("entry",t),t.emittedEnd||(t.on("end",()=>this[Zi]()),e=!1);return e}[Zi](){do;while(this[Zs](this[st].shift()));if(this[st].length===0){let t=this[it];!t||t.flowing||t.size===t.remain?this[Yt]||this.emit("drain"):t.once("drain",()=>this.emit("drain"))}}[Ki](t,e){let i=this[Nt];if(!i)throw new Error("attempt to consume body without entry??");let r=i.blockRemain??0,n=r>=t.length&&e===0?t:t.subarray(e,e+r);return i.write(n),i.blockRemain||(this[B]="header",this[Nt]=void 0,i.end()),n.length}[Ks](t,e){let i=this[Nt],r=this[Ki](t,e);return!this[Nt]&&i&&this[Ys](i),r}[At](t,e,i){this[st].length===0&&!this[it]?this.emit(t,e,i):this[st].push([t,e,i])}[Ys](t){switch(this[At]("meta",this[dt]),t.type){case"ExtendedHeader":case"OldExtendedHeader":this[V]=ft.parse(this[dt],this[V],!1);break;case"GlobalExtendedHeader":this[he]=ft.parse(this[dt],this[he],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let e=this[V]??Object.create(null);this[V]=e,e.path=this[dt].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let e=this[V]||Object.create(null);this[V]=e,e.linkpath=this[dt].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+t.type)}}abort(t){if(!this[$]){if(this[w]){let e=this[w];e.write=()=>!0,e.end=()=>e,e.emit=()=>!1,e.destroy?.()}this[$]=!0,this.emit("abort",t),this.warn("TAR_ABORT",t,{recoverable:!1})}}[Xs](t){this[$i]+=t.length;let e=this[$i]/this[le];return e>this.maxDecompressionRatio?(this.abort(new Error(`max decompression ratio exceeded: ${e.toFixed(2)} > ${this.maxDecompressionRatio}`)),!1):!0}write(t,e,i){if(typeof e=="function"&&(i=e,e=void 0),typeof t=="string"&&(t=Buffer.from(t,typeof e=="string"?e:"utf8")),this[$])return i?.(),!1;if((this[w]===void 0||this.brotli===void 0&&this[w]===!1)&&t){if(this[p]&&(t=Buffer.concat([this[p],t]),this[p]=void 0),t.length{this[Xs](c)&&this[Xe](c)}),this[w].on("error",c=>{this[$]||this.abort(c)}),this[w].on("end",()=>{this[ut]=!0,this[Xe]()}),this[Yt]=!0,this[le]+=t.length;let l=!!this[w][a?"end":"write"](t);return this[Yt]=!1,i?.(),l}}this[Yt]=!0,this[w]?(this[le]+=t.length,this[w].write(t)):this[Xe](t),this[Yt]=!1;let n=this[st].length>0?!1:this[it]?this[it].flowing:!0;return!n&&this[st].length===0&&this[it]?.once("drain",()=>this.emit("drain")),i?.(),n}[Vi](t){t&&!this[$]&&(this[p]=this[p]?Buffer.concat([this[p],t]):t)}[Qe](){if(this[ut]&&!this[Yi]&&!this[$]&&!this[ae]){this[Yi]=!0;let t=this[Nt];if(t?.blockRemain){let e=this[p]?this[p].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${t.blockRemain} more bytes, only ${e} available)`,{entry:t}),this[p]&&t.write(this[p]),t.end()}this[At](Je)}}[Xe](t){if(this[ae]&&t)this[Vi](t);else if(!t&&!this[p])this[Qe]();else if(t){if(this[ae]=!0,this[p]){this[Vi](t);let e=this[p];this[p]=void 0,this[qe](e)}else this[qe](t);for(;this[p]&&this[p]?.length>=512&&!this[$]&&!this[ti];){let e=this[p];this[p]=void 0,this[qe](e)}this[ae]=!1}(!this[p]||this[ut])&&this[Qe]()}[qe](t){let e=0,i=t.length;for(;e+512<=i&&!this[$]&&!this[ti];)switch(this[B]){case"begin":case"header":this[Vs](t,e),e+=512;break;case"ignore":case"body":e+=this[Ki](t,e);break;case"meta":e+=this[Ks](t,e);break;default:throw new Error("invalid state: "+this[B])}e{let t=s.length-1,e=-1;for(;t>-1&&s.charAt(t)==="/";)e=t,t--;return e===-1?s:s.slice(0,e)};var vn=s=>{let t=s.onReadEntry;s.onReadEntry=t?e=>{t(e),e.resume()}:e=>e.resume()},Qi=(s,t)=>{let e=new Map(t.map(o=>[mt(o),!0])),i=s.filter,r=100,n=(o,h="",a=0)=>{if(a>=r)return e.set(o,!1),!1;let l=h||(0,external_path_namespaceObject.parse)(o).root||".",c;if(o===l)c=!1;else{let d=e.get(o);c=d!==void 0?d:n((0,external_path_namespaceObject.dirname)(o),l,a+1)}return e.set(o,c),c};s.filter=i?(o,h)=>i(o,h)&&n(mt(o)):o=>n(mt(o))},Mn=s=>{let t=new rt(s),e=s.file,i;try{i=external_node_fs_namespaceObject.openSync(e,"r");let r=external_node_fs_namespaceObject.fstatSync(i),n=s.maxReadSize||16*1024*1024;if(r.size{let e=new rt(s),i=s.maxReadSize||16*1024*1024,r=s.file;return new Promise((o,h)=>{e.on("error",h),e.on("end",o),external_node_fs_namespaceObject.stat(r,(a,l)=>{if(a)h(a);else{let c=new _t(r,{readSize:i,size:l.size});c.on("error",h),c.pipe(e)}})})},Ct=K(Mn,Bn,s=>new rt(s),s=>new rt(s),(s,t)=>{t?.length&&Qi(s,t),s.noResume||vn(s)});var Ji=(s,t,e)=>(s&=4095,e&&(s=(s|384)&-19),t&&(s&256&&(s|=64),s&32&&(s|=8),s&4&&(s|=1)),s);var{isAbsolute:zn,parse:qs}=external_node_path_namespaceObject.win32,ce=s=>{let t="",e=qs(s);for(;zn(s)||e.root;){let i=s.charAt(0)==="/"&&s.slice(0,4)!=="//?/"?"/":e.root;s=s.slice(i.length),t+=i,e=qs(s)}return[t,s]};var ei=["|","<",">","?",":"],ji=ei.map(s=>String.fromCodePoint(61440+Number(s.codePointAt(0)))),Un=new Map(ei.map((s,t)=>[s,ji[t]])),Hn=new Map(ji.map((s,t)=>[s,ei[t]])),ts=s=>ei.reduce((t,e)=>t.split(e).join(Un.get(e)),s),Qs=s=>ji.reduce((t,e)=>t.split(e).join(Hn.get(e)),s);var rr=(s,t)=>t?(s=f(s).replace(/^\.(\/|$)/,""),mt(t)+"/"+s):f(s),Wn=16*1024*1024,tr=Symbol("process"),er=Symbol("file"),ir=Symbol("directory"),is=Symbol("symlink"),sr=Symbol("hardlink"),fe=Symbol("header"),ii=Symbol("read"),ss=Symbol("lstat"),si=Symbol("onlstat"),rs=Symbol("onread"),ns=Symbol("onreadlink"),os=Symbol("openfile"),hs=Symbol("onopenfile"),pt=Symbol("close"),ri=Symbol("mode"),as=Symbol("awaitDrain"),es=Symbol("ondrain"),q=Symbol("prefix"),de=class extends A{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#t=!1;constructor(t,e={}){let i=se(e);super(),this.path=f(t),this.portable=!!i.portable,this.maxReadSize=i.maxReadSize||Wn,this.linkCache=i.linkCache||new Map,this.statCache=i.statCache||new Map,this.preservePaths=!!i.preservePaths,this.cwd=f(i.cwd||process.cwd()),this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.mtime=i.mtime,this.prefix=i.prefix?f(i.prefix):void 0,this.onWriteEntry=i.onWriteEntry,typeof i.onwarn=="function"&&this.on("warn",i.onwarn);let r=!1;if(!this.preservePaths){let[o,h]=ce(this.path);o&&typeof h=="string"&&(this.path=h,r=o)}this.win32=!!i.win32||process.platform==="win32",this.win32&&(this.path=Qs(this.path.replaceAll(/\\/g,"/")),t=t.replaceAll(/\\/g,"/")),this.absolute=f(i.absolute||external_path_namespaceObject.resolve(this.cwd,t)),this.path===""&&(this.path="./"),r&&this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute path`,{entry:this,path:r+this.path});let n=this.statCache.get(this.absolute);n?this[si](n):this[ss]()}warn(t,e,i={}){return Dt(this,t,e,i)}emit(t,...e){return t==="error"&&(this.#t=!0),super.emit(t,...e)}[ss](){external_fs_namespaceObject.lstat(this.absolute,(t,e)=>{if(t)return this.emit("error",t);this[si](e)})}[si](t){this.statCache.set(this.absolute,t),this.stat=t,t.isFile()||(t.size=0),this.type=Gn(t),this.emit("stat",t),this[tr]()}[tr](){switch(this.type){case"File":return this[er]();case"Directory":return this[ir]();case"SymbolicLink":return this[is]();default:return this.end()}}[ri](t){return Ji(t,this.type==="Directory",this.portable)}[q](t){return rr(t,this.prefix)}[fe](){if(!this.stat)throw new Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new F({path:this[q](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[q](this.linkpath):this.linkpath,mode:this[ri](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new ft({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[q](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[q](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let t=this.header?.block;if(!t)throw new Error("failed to encode header");super.write(t)}[ir](){if(!this.stat)throw new Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[fe](),this.end()}[is](){external_fs_namespaceObject.readlink(this.absolute,(t,e)=>{if(t)return this.emit("error",t);this[ns](e)})}[ns](t){this.linkpath=f(t),this[fe](),this.end()}[sr](t){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=f(external_path_namespaceObject.relative(this.cwd,t)),this.stat.size=0,this[fe](),this.end()}[er](){if(!this.stat)throw new Error("cannot create file entry without stat");if(this.stat.nlink>1){let t=`${this.stat.dev}:${this.stat.ino}`,e=this.linkCache.get(t);if(e?.indexOf(this.cwd)===0)return this[sr](e);this.linkCache.set(t,this.absolute)}if(this[fe](),this.stat.size===0)return this.end();this[os]()}[os](){external_fs_namespaceObject.open(this.absolute,"r",(t,e)=>{if(t)return this.emit("error",t);this[hs](e)})}[hs](t){if(this.fd=t,this.#t)return this[pt]();if(!this.stat)throw new Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let e=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(e),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[ii]()}[ii](){let{fd:t,buf:e,offset:i,length:r,pos:n}=this;if(t===void 0||e===void 0)throw new Error("cannot read file without first opening");external_fs_namespaceObject.read(t,e,i,r,n,(o,h)=>{if(o)return this[pt](()=>this.emit("error",o));this[rs](h)})}[pt](t=()=>{}){this.fd!==void 0&&external_fs_namespaceObject.close(this.fd,t)}[rs](t){if(t<=0&&this.remain>0){let r=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[pt](()=>this.emit("error",r))}if(t>this.remain){let r=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[pt](()=>this.emit("error",r))}if(!this.buf)throw new Error("should have created buffer prior to reading");if(t===this.remain)for(let r=t;rthis[es]())}[as](t){this.once("drain",t)}write(t,e,i){if(typeof e=="function"&&(i=e,e=void 0),typeof t=="string"&&(t=Buffer.from(t,typeof e=="string"?e:"utf8")),this.blockRemaint?this.emit("error",t):this.end());if(!this.buf)throw new Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[ii]()}},ni=class extends de{sync=!0;[ss](){this[si](external_fs_namespaceObject.lstatSync(this.absolute))}[is](){this[ns](external_fs_namespaceObject.readlinkSync(this.absolute))}[os](){this[hs](external_fs_namespaceObject.openSync(this.absolute,"r"))}[ii](){let t=!0;try{let{fd:e,buf:i,offset:r,length:n,pos:o}=this;if(e===void 0||i===void 0)throw new Error("fd and buf must be set in READ method");let h=external_fs_namespaceObject.readSync(e,i,r,n,o);this[rs](h),t=!1}finally{if(t)try{this[pt](()=>{})}catch{}}}[as](t){t()}[pt](t=()=>{}){this.fd!==void 0&&external_fs_namespaceObject.closeSync(this.fd),t()}},oi=class extends A{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(t,e,i={}){return Dt(this,t,e,i)}constructor(t,e={}){let i=se(e);super(),this.preservePaths=!!i.preservePaths,this.portable=!!i.portable,this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.onWriteEntry=i.onWriteEntry,this.readEntry=t;let{type:r}=t;if(r==="Unsupported")throw new Error("writing entry that should be ignored");this.type=r,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=i.prefix,this.path=f(t.path),this.mode=t.mode!==void 0?this[ri](t.mode):void 0,this.uid=this.portable?void 0:t.uid,this.gid=this.portable?void 0:t.gid,this.uname=this.portable?void 0:t.uname,this.gname=this.portable?void 0:t.gname,this.size=t.size,this.mtime=this.noMtime?void 0:i.mtime||t.mtime,this.atime=this.portable?void 0:t.atime,this.ctime=this.portable?void 0:t.ctime,this.linkpath=t.linkpath!==void 0?f(t.linkpath):void 0,typeof i.onwarn=="function"&&this.on("warn",i.onwarn);let n=!1;if(!this.preservePaths){let[h,a]=ce(this.path);h&&typeof a=="string"&&(this.path=a,n=h)}this.remain=t.size,this.blockRemain=t.startBlockSize,this.onWriteEntry?.(this),this.header=new F({path:this[q](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[q](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),n&&this.warn("TAR_ENTRY_INFO",`stripping ${n} from absolute path`,{entry:this,path:n+this.path}),this.header.encode()&&!this.noPax&&super.write(new ft({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[q](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[q](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let o=this.header?.block;if(!o)throw new Error("failed to encode header");super.write(o),t.pipe(this)}[q](t){return rr(t,this.prefix)}[ri](t){return Ji(t,this.type==="Directory",this.portable)}write(t,e,i){typeof e=="function"&&(i=e,e=void 0),typeof t=="string"&&(t=Buffer.from(t,typeof e=="string"?e:"utf8"));let r=t.length;if(r>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=r,super.write(t,i)}end(t,e,i){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof t=="function"&&(i=t,e=void 0,t=void 0),typeof e=="function"&&(i=e,e=void 0),typeof t=="string"&&(t=Buffer.from(t,e??"utf8")),i&&this.once("finish",i),t?super.end(t,i):super.end(i),this}},Gn=s=>s.isFile()?"File":s.isDirectory()?"Directory":s.isSymbolicLink()?"SymbolicLink":"Unsupported";var hi=class s{tail;head;length=0;static create(t=[]){return new s(t)}constructor(t=[]){for(let e of t)this.push(e)}*[Symbol.iterator](){for(let t=this.head;t;t=t.next)yield t.value}removeNode(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");let e=t.next,i=t.prev;return e&&(e.prev=i),i&&(i.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=i),this.length--,t.next=void 0,t.prev=void 0,t.list=void 0,e}unshiftNode(t){if(t===this.head)return;t.list&&t.list.removeNode(t);let e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}pushNode(t){if(t===this.tail)return;t.list&&t.list.removeNode(t);let e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}push(...t){for(let e=0,i=t.length;e1)i=e;else if(this.head)r=this.head.next,i=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var n=0;r;n++)i=t(i,r.value,n),r=r.next;return i}reduceReverse(t,e){let i,r=this.tail;if(arguments.length>1)i=e;else if(this.tail)r=this.tail.prev,i=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(let n=this.length-1;r;n--)i=t(i,r.value,n),r=r.prev;return i}toArray(){let t=new Array(this.length);for(let e=0,i=this.head;i;e++)t[e]=i.value,i=i.next;return t}toArrayReverse(){let t=new Array(this.length);for(let e=0,i=this.tail;i;e++)t[e]=i.value,i=i.prev;return t}slice(t=0,e=this.length){e<0&&(e+=this.length),t<0&&(t+=this.length);let i=new s;if(ethis.length&&(e=this.length);let r=this.head,n=0;for(n=0;r&&nthis.length&&(e=this.length);let r=this.length,n=this.tail;for(;n&&r>e;r--)n=n.prev;for(;n&&r>t;r--,n=n.prev)i.push(n.value);return i}splice(t,e=0,...i){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);let r=this.head;for(let o=0;r&&o1)throw new TypeError("gzip, brotli, zstd are mutually exclusive");if(t.gzip&&(typeof t.gzip!="object"&&(t.gzip={}),this.portable&&(t.gzip.portable=!0),this.zip=new ze(t.gzip)),t.brotli&&(typeof t.brotli!="object"&&(t.brotli={}),this.zip=new We(t.brotli)),t.zstd&&(typeof t.zstd!="object"&&(t.zstd={}),this.zip=new Ye(t.zstd)),!this.zip)throw new Error("impossible");let e=this.zip;e.on("data",i=>super.write(i)),e.on("end",()=>super.end()),e.on("drain",()=>this[fs]()),this.on("resume",()=>e.resume())}else this.on("drain",this[fs]);this.noDirRecurse=!!t.noDirRecurse,this.follow=!!t.follow,this.noMtime=!!t.noMtime,t.mtime&&(this.mtime=t.mtime),this.filter=typeof t.filter=="function"?t.filter:()=>!0,this[W]=new hi,this[G]=0,this.jobs=Number(t.jobs)||4,this[Ee]=!1,this[me]=!1}[lr](t){return super.write(t)}add(t){return this.write(t),this}end(t,e,i){return typeof t=="function"&&(i=t,t=void 0),typeof e=="function"&&(i=e,e=void 0),t&&this.add(t),this[me]=!0,this[Ft](),i&&i(),this}write(t){if(this[me])throw new Error("write after end");return typeof t=="string"?this[ci](t):this[or](t),this.flowing}[or](t){let e=f(external_path_namespaceObject.resolve(this.cwd,t.path));if(!this.filter(t.path,t))t.resume();else{let i=new pi(t.path,e);i.entry=new oi(t,this[cs](i)),i.entry.on("end",()=>this[ls](i)),this[G]+=1,this[W].push(i)}this[Ft]()}[ci](t){let e=f(external_path_namespaceObject.resolve(this.cwd,t));this[W].push(new pi(t,e)),this[Ft]()}[ds](t){t.pending=!0,this[G]+=1;let e=this.follow?"stat":"lstat";external_fs_namespaceObject[e](t.absolute,(i,r)=>{t.pending=!1,this[G]-=1,i?this.emit("error",i):this[li](t,r)})}[li](t,e){if(this.statCache.set(t.absolute,e),t.stat=e,!this.filter(t.path,e))t.ignore=!0;else if(e.isFile()&&e.nlink>1&&!this.linkCache.get(`${e.dev}:${e.ino}`)&&!this.sync)if(t===this[Et])this[ai](t);else{let i=`${e.dev}:${e.ino}`,r=this[pe].get(i);r?r.push(t):this[pe].set(i,[t]),t.pendingLink=!0,t.pending=!0}this[Ft]()}[us](t){t.pending=!0,this[G]+=1,external_fs_namespaceObject.readdir(t.absolute,(e,i)=>{if(t.pending=!1,this[G]-=1,e)return this.emit("error",e);this[fi](t,i)})}[fi](t,e){this.readdirCache.set(t.absolute,e),t.readdir=e,this[Ft]()}[Ft](){if(!this[Ee]){this[Ee]=!0;for(let t=this[W].head;t&&this[G]1){let i=`${e.dev}:${e.ino}`,r=this[pe].get(i);if(r){this[pe].delete(i);for(let n of r)n.pending=!1,this[ai](n)}}this[Ft]()}[ai](t){if(t.pending&&t.pendingLink&&t===this[Et]&&(t.pending=!1,t.pendingLink=!1),!t.pending){if(t.entry){t===this[Et]&&!t.piped&&this[di](t);return}if(!t.stat){let e=this.statCache.get(t.absolute);e?this[li](t,e):this[ds](t)}if(t.stat&&!t.ignore){if(!this.noDirRecurse&&t.stat.isDirectory()&&!t.readdir){let e=this.readdirCache.get(t.absolute);if(e?this[fi](t,e):this[us](t),!t.readdir)return}if(t.entry=this[hr](t),!t.entry){t.ignore=!0;return}t===this[Et]&&!t.piped&&this[di](t)}}}[cs](t){return{onwarn:(e,i,r)=>this.warn(e,i,r),noPax:this.noPax,cwd:this.cwd,absolute:t.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[hr](t){this[G]+=1;try{return new this[ui](t.path,this[cs](t)).on("end",()=>this[ls](t)).on("error",i=>this.emit("error",i))}catch(e){this.emit("error",e)}}[fs](){this[Et]&&this[Et].entry&&this[Et].entry.resume()}[di](t){t.piped=!0,t.readdir&&t.readdir.forEach(r=>{let n=t.path,o=n==="./"?"":n.replace(/\/*$/,"/");this[ci](o+r)});let e=t.entry,i=this.zip;if(!e)throw new Error("cannot pipe without source");i?e.on("data",r=>{i.write(r)||e.pause()}):e.on("data",r=>{super.write(r)||e.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(t,e,i={}){Dt(this,t,e,i)}},kt=class extends wt{sync=!0;constructor(t){super(t),this[ui]=ni}pause(){}resume(){}[ds](t){let e=this.follow?"statSync":"lstatSync";this[li](t,external_fs_namespaceObject[e](t.absolute))}[us](t){this[fi](t,external_fs_namespaceObject.readdirSync(t.absolute))}[di](t){let e=t.entry,i=this.zip;if(t.readdir&&t.readdir.forEach(r=>{let n=t.path,o=n==="./"?"":n.replace(/\/*$/,"/");this[ci](o+r)}),!e)throw new Error("Cannot pipe without source");i?e.on("data",r=>{i.write(r)}):e.on("data",r=>{super[lr](r)})}};var Vn=(s,t)=>{let e=new kt(s),i=new Wt(s.file,{mode:s.mode||438});e.pipe(i),fr(e,t)},$n=(s,t)=>{let e=new wt(s),i=new et(s.file,{mode:s.mode||438});e.pipe(i);let r=new Promise((n,o)=>{i.on("error",o),i.on("close",n),e.on("error",o)});return dr(e,t).catch(n=>e.emit("error",n)),r},fr=(s,t)=>{t.forEach(e=>{e.charAt(0)==="@"?Ct({file:external_node_path_namespaceObject.resolve(s.cwd,e.slice(1)),sync:!0,noResume:!0,onReadEntry:i=>s.add(i)}):s.add(e)}),s.end()},dr=async(s,t)=>{for(let e of t)e.charAt(0)==="@"?await Ct({file:external_node_path_namespaceObject.resolve(String(s.cwd),e.slice(1)),noResume:!0,onReadEntry:i=>{s.add(i)}}):s.add(e);s.end()},Xn=(s,t)=>{let e=new kt(s);return fr(e,t),e},qn=(s,t)=>{let e=new wt(s);return dr(e,t).catch(i=>e.emit("error",i)),e},Qn=K(Vn,$n,Xn,qn,(s,t)=>{if(!t?.length)throw new TypeError("no paths specified to add to archive")});var Jn=process.env.__FAKE_PLATFORM__||process.platform,Er=Jn==="win32",{O_CREAT:wr,O_NOFOLLOW:ur,O_TRUNC:Sr,O_WRONLY:yr}=external_fs_namespaceObject.constants,Rr=Number(process.env.__FAKE_FS_O_FILENAME__)||external_fs_namespaceObject.constants.UV_FS_O_FILEMAP||0,jn=Er&&!!Rr,to=512*1024,eo=Rr|Sr|wr|yr,mr=!Er&&typeof ur=="number"?ur|Sr|wr|yr:null,ms=mr!==null?()=>mr:jn?s=>s"w";var ps=(s,t,e)=>{try{return external_node_fs_namespaceObject.lchownSync(s,t,e)}catch(i){if(i?.code!=="ENOENT")throw i}},Ei=(s,t,e,i)=>{external_node_fs_namespaceObject.lchown(s,t,e,r=>{i(r&&r?.code!=="ENOENT"?r:null)})},io=(s,t,e,i,r)=>{if(t.isDirectory())Es(external_node_path_namespaceObject.resolve(s,t.name),e,i,n=>{if(n)return r(n);let o=external_node_path_namespaceObject.resolve(s,t.name);Ei(o,e,i,r)});else{let n=external_node_path_namespaceObject.resolve(s,t.name);Ei(n,e,i,r)}},Es=(s,t,e,i)=>{external_node_fs_namespaceObject.readdir(s,{withFileTypes:!0},(r,n)=>{if(r){if(r.code==="ENOENT")return i();if(r.code!=="ENOTDIR"&&r.code!=="ENOTSUP")return i(r)}if(r||!n.length)return Ei(s,t,e,i);let o=n.length,h=null,a=l=>{if(!h){if(l)return i(h=l);if(--o===0)return Ei(s,t,e,i)}};for(let l of n)io(s,l,t,e,a)})},so=(s,t,e,i)=>{t.isDirectory()&&ws(external_node_path_namespaceObject.resolve(s,t.name),e,i),ps(external_node_path_namespaceObject.resolve(s,t.name),e,i)},ws=(s,t,e)=>{let i;try{i=external_node_fs_namespaceObject.readdirSync(s,{withFileTypes:!0})}catch(r){let n=r;if(n?.code==="ENOENT")return;if(n?.code==="ENOTDIR"||n?.code==="ENOTSUP")return ps(s,t,e);throw n}for(let r of i)so(s,r,t,e);return ps(s,t,e)};var Se=class extends Error{path;code;syscall="chdir";constructor(t,e){super(`${e}: Cannot cd into '${t}'`),this.path=t,this.code=e}get name(){return"CwdError"}};var St=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(t,e){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=t,this.path=e}get name(){return"SymlinkError"}};var no=(s,t)=>{external_node_fs_namespaceObject.stat(s,(e,i)=>{(e||!i.isDirectory())&&(e=new Se(s,e?.code||"ENOTDIR")),t(e)})},gr=(s,t,e)=>{s=f(s);let i=t.umask??18,r=t.mode|448,n=(r&i)!==0,o=t.uid,h=t.gid,a=typeof o=="number"&&typeof h=="number"&&(o!==t.processUid||h!==t.processGid),l=t.preserve,c=t.unlink,d=f(t.cwd),y=(E,x)=>{E?e(E):x&&a?Es(x,o,h,Le=>y(Le)):n?external_node_fs_namespaceObject.chmod(s,r,e):e()};if(s===d)return no(s,y);if(l)return promises_namespaceObject.mkdir(s,{mode:r,recursive:!0}).then(E=>y(null,E??void 0),y);let D=f(external_node_path_namespaceObject.relative(d,s)).split("/");Ss(d,D,r,c,d,void 0,y)},Ss=(s,t,e,i,r,n,o)=>{if(t.length===0)return o(null,n);let h=t.shift(),a=f(external_node_path_namespaceObject.resolve(s+"/"+h));external_node_fs_namespaceObject.mkdir(a,e,br(a,t,e,i,r,n,o))},br=(s,t,e,i,r,n,o)=>h=>{h?external_node_fs_namespaceObject.lstat(s,(a,l)=>{if(a)a.path=a.path&&f(a.path),o(a);else if(l.isDirectory())Ss(s,t,e,i,r,n,o);else if(i)external_node_fs_namespaceObject.unlink(s,c=>{if(c)return o(c);external_node_fs_namespaceObject.mkdir(s,e,br(s,t,e,i,r,n,o))});else{if(l.isSymbolicLink())return o(new St(s,s+"/"+t.join("/")));o(h)}}):(n=n||s,Ss(s,t,e,i,r,n,o))},oo=s=>{let t=!1,e;try{t=external_node_fs_namespaceObject.statSync(s).isDirectory()}catch(i){e=i?.code}finally{if(!t)throw new Se(s,e??"ENOTDIR")}},_r=(s,t)=>{s=f(s);let e=t.umask??18,i=t.mode|448,r=(i&e)!==0,n=t.uid,o=t.gid,h=typeof n=="number"&&typeof o=="number"&&(n!==t.processUid||o!==t.processGid),a=t.preserve,l=t.unlink,c=f(t.cwd),d=E=>{E&&h&&ws(E,n,o),r&&external_node_fs_namespaceObject.chmodSync(s,i)};if(s===c)return oo(c),d();if(a)return d(external_node_fs_namespaceObject.mkdirSync(s,{mode:i,recursive:!0})??void 0);let T=f(external_node_path_namespaceObject.relative(c,s)).split("/"),D;for(let E=T.shift(),x=c;E&&(x+="/"+E);E=T.shift()){x=f(external_node_path_namespaceObject.resolve(x));try{external_node_fs_namespaceObject.mkdirSync(x,i),D=D||x}catch{let Le=external_node_fs_namespaceObject.lstatSync(x);if(Le.isDirectory())continue;if(l){external_node_fs_namespaceObject.unlinkSync(x),external_node_fs_namespaceObject.mkdirSync(x,i),D=D||x;continue}else if(Le.isSymbolicLink())return new St(x,x+"/"+T.join("/"))}}return d(D)};var ys=Object.create(null),Or=1e4,Vt=new Set,Tr=s=>{Vt.has(s)?Vt.delete(s):ys[s]=s.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"),Vt.add(s);let t=ys[s],e=Vt.size-Or;if(e>Or/10){for(let i of Vt)if(Vt.delete(i),delete ys[i],--e<=0)break}return t};var ho=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,ao=ho==="win32",lo=s=>s.split("/").slice(0,-1).reduce((e,i)=>{let r=e.at(-1);return r!==void 0&&(i=(0,external_node_path_namespaceObject.join)(r,i)),e.push(i||"/"),e},[]),yi=class{#t=new Map;#i=new Map;#s=new Set;reserve(t,e){t=ao?["win32 parallelization disabled"]:t.map(r=>mt((0,external_node_path_namespaceObject.join)(Tr(r))));let i=new Set(t.map(r=>lo(r)).reduce((r,n)=>r.concat(n)));this.#i.set(e,{dirs:i,paths:t});for(let r of t){let n=this.#t.get(r);n?n.push(e):this.#t.set(r,[e])}for(let r of i){let n=this.#t.get(r);if(!n)this.#t.set(r,[new Set([e])]);else{let o=n.at(-1);o instanceof Set?o.add(e):n.push(new Set([e]))}}return this.#r(e)}#n(t){let e=this.#i.get(t);if(!e)throw new Error("function does not have any path reservations");return{paths:e.paths.map(i=>this.#t.get(i)),dirs:[...e.dirs].map(i=>this.#t.get(i))}}check(t){let{paths:e,dirs:i}=this.#n(t);return e.every(r=>r&&r[0]===t)&&i.every(r=>r&&r[0]instanceof Set&&r[0].has(t))}#r(t){return this.#s.has(t)||!this.check(t)?!1:(this.#s.add(t),t(()=>this.#e(t)),!0)}#e(t){if(!this.#s.has(t))return!1;let e=this.#i.get(t);if(!e)throw new Error("invalid reservation");let{paths:i,dirs:r}=e,n=new Set;for(let o of i){let h=this.#t.get(o);if(!h||h?.[0]!==t)continue;let a=h[1];if(!a){this.#t.delete(o);continue}if(h.shift(),typeof a=="function")n.add(a);else for(let l of a)n.add(l)}for(let o of r){let h=this.#t.get(o),a=h?.[0];if(!(!h||!(a instanceof Set)))if(a.size===1&&h.length===1){this.#t.delete(o);continue}else if(a.size===1){h.shift();let l=h[0];typeof l=="function"&&n.add(l)}else a.delete(t)}return this.#s.delete(t),n.forEach(o=>this.#r(o)),!0}};var Lr=()=>process.umask();var Dr=Symbol("onEntry"),_s=Symbol("checkFs"),Nr=Symbol("checkFs2"),Os=Symbol("isReusable"),P=Symbol("makeFs"),Ts=Symbol("file"),xs=Symbol("directory"),gi=Symbol("link"),Ar=Symbol("symlink"),Ir=Symbol("hardlink"),Re=Symbol("ensureNoSymlink"),Cr=Symbol("unsupported"),Fr=Symbol("checkPath"),Rs=Symbol("stripAbsolutePath"),yt=Symbol("mkdir"),O=Symbol("onError"),Ri=Symbol("pending"),kr=Symbol("pend"),$t=Symbol("unpend"),gs=Symbol("ended"),bs=Symbol("maybeClose"),Ls=Symbol("skip"),ge=Symbol("doChown"),be=Symbol("uid"),_e=Symbol("gid"),Oe=Symbol("checkedCwd"),fo=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,Te=fo==="win32",uo=1024,mo=(s,t)=>{if(!Te)return external_node_fs_namespaceObject.unlink(s,t);let e=s+".DELETE."+(0,external_node_crypto_namespaceObject.randomBytes)(16).toString("hex");external_node_fs_namespaceObject.rename(s,e,i=>{if(i)return t(i);external_node_fs_namespaceObject.unlink(e,t)})},po=s=>{if(!Te)return external_node_fs_namespaceObject.unlinkSync(s);let t=s+".DELETE."+(0,external_node_crypto_namespaceObject.randomBytes)(16).toString("hex");external_node_fs_namespaceObject.renameSync(s,t),external_node_fs_namespaceObject.unlinkSync(t)},vr=(s,t,e)=>s!==void 0&&s===s>>>0?s:t!==void 0&&t===t>>>0?t:e,Xt=class extends rt{[gs]=!1;[Oe]=!1;[Ri]=0;reservations=new yi;transform;writable=!0;readable=!1;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(t={}){if(t.ondone=()=>{this[gs]=!0,this[bs]()},super(t),this.transform=t.transform,this.chmod=!!t.chmod,typeof t.uid=="number"||typeof t.gid=="number"){if(typeof t.uid!="number"||typeof t.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(t.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=t.uid,this.gid=t.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;this.preserveOwner=t.preserveOwner===void 0&&typeof t.uid!="number"?process.getuid?.()===0:!!t.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth=typeof t.maxDepth=="number"?t.maxDepth:uo,this.forceChown=t.forceChown===!0,this.win32=!!t.win32||Te,this.newer=!!t.newer,this.keep=!!t.keep,this.noMtime=!!t.noMtime,this.preservePaths=!!t.preservePaths,this.unlink=!!t.unlink,this.cwd=f(external_node_path_namespaceObject.resolve(t.cwd||process.cwd())),this.strip=Number(t.strip)||0,this.processUmask=this.chmod?typeof t.processUmask=="number"?t.processUmask:Lr():0,this.umask=typeof t.umask=="number"?t.umask:this.processUmask,this.dmode=t.dmode||511&~this.umask,this.fmode=t.fmode||438&~this.umask,this.on("entry",e=>this[Dr](e))}warn(t,e,i={}){return(t==="TAR_BAD_ARCHIVE"||t==="TAR_ABORT")&&(i.recoverable=!1),super.warn(t,e,i)}[bs](){this[gs]&&this[Ri]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[Rs](t,e){let i=t[e],{type:r}=t;if(!i||this.preservePaths)return!0;let[n,o]=ce(i),h=o.replaceAll(/\\/g,"/").split("/");if(h.includes("..")||Te&&/^[a-z]:\.\.$/i.test(h[0]??"")){if(e==="path"||r==="Link")return this.warn("TAR_ENTRY_ERROR",`${e} contains '..'`,{entry:t,[e]:i}),!1;let a=external_node_path_namespaceObject.posix.dirname(t.path),l=external_node_path_namespaceObject.posix.normalize(external_node_path_namespaceObject.posix.join(a,h.join("/")));if(l.startsWith("../")||l==="..")return this.warn("TAR_ENTRY_ERROR",`${e} escapes extraction directory`,{entry:t,[e]:i}),!1}return n&&(t[e]=String(o),this.warn("TAR_ENTRY_INFO",`stripping ${n} from absolute ${e}`,{entry:t,[e]:i})),!0}[Fr](t){let e=f(t.path),i=e.split("/");if(this.strip){if(i.length=this.strip)t.linkpath=r.slice(this.strip).join("/");else return!1}i.splice(0,this.strip),t.path=i.join("/")}if(isFinite(this.maxDepth)&&i.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:t,path:e,depth:i.length,maxDepth:this.maxDepth}),!1;if(!this[Rs](t,"path")||!this[Rs](t,"linkpath"))return!1;if(t.absolute=external_node_path_namespaceObject.isAbsolute(t.path)?f(external_node_path_namespaceObject.resolve(t.path)):f(external_node_path_namespaceObject.resolve(this.cwd,t.path)),!this.preservePaths&&typeof t.absolute=="string"&&t.absolute.indexOf(this.cwd+"/")!==0&&t.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:t,path:f(t.path),resolvedPath:t.absolute,cwd:this.cwd}),!1;if(t.absolute===this.cwd&&t.type!=="Directory"&&t.type!=="GNUDumpDir")return!1;if(this.win32){let{root:r}=external_node_path_namespaceObject.win32.parse(String(t.absolute));t.absolute=r+ts(String(t.absolute).slice(r.length));let{root:n}=external_node_path_namespaceObject.win32.parse(t.path);t.path=n+ts(t.path.slice(n.length))}return!0}[Dr](t){if(!this[Fr](t))return t.resume();switch(external_node_assert_namespaceObject.equal(typeof t.absolute,"string"),t.type){case"Directory":case"GNUDumpDir":t.mode&&(t.mode=t.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[_s](t);default:return this[Cr](t)}}[O](t,e){t.name==="CwdError"?this.emit("error",t):(this.warn("TAR_ENTRY_ERROR",t,{entry:e}),this[$t](),e.resume())}[yt](t,e,i){gr(f(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:e},i)}[ge](t){return this.forceChown||this.preserveOwner&&(typeof t.uid=="number"&&t.uid!==this.processUid||typeof t.gid=="number"&&t.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[be](t){return vr(this.uid,t.uid,this.processUid)}[_e](t){return vr(this.gid,t.gid,this.processGid)}[Ts](t,e){let i=typeof t.mode=="number"?t.mode&4095:this.fmode,r=new et(String(t.absolute),{flags:ms(t.size),mode:i,autoClose:!1});r.on("error",a=>{r.fd&&external_node_fs_namespaceObject.close(r.fd,()=>{}),r.write=()=>!0,this[O](a,t),e()});let n=1,o=a=>{if(a){r.fd&&external_node_fs_namespaceObject.close(r.fd,()=>{}),this[O](a,t),e();return}--n===0&&r.fd!==void 0&&external_node_fs_namespaceObject.close(r.fd,l=>{l?this[O](l,t):this[$t](),e()})};r.on("finish",()=>{let a=String(t.absolute),l=r.fd;if(typeof l=="number"&&t.mtime&&!this.noMtime){n++;let c=t.atime||new Date,d=t.mtime;external_node_fs_namespaceObject.futimes(l,c,d,y=>y?external_node_fs_namespaceObject.utimes(a,c,d,T=>o(T&&y)):o())}if(typeof l=="number"&&this[ge](t)){n++;let c=this[be](t),d=this[_e](t);typeof c=="number"&&typeof d=="number"&&external_node_fs_namespaceObject.fchown(l,c,d,y=>y?external_node_fs_namespaceObject.chown(a,c,d,T=>o(T&&y)):o())}o()});let h=this.transform&&this.transform(t)||t;h!==t&&(h.on("error",a=>{this[O](a,t),e()}),t.pipe(h)),h.pipe(r)}[xs](t,e){let i=typeof t.mode=="number"?t.mode&4095:this.dmode;this[yt](String(t.absolute),i,r=>{if(r){this[O](r,t),e();return}let n=1,o=()=>{--n===0&&(e(),this[$t](),t.resume())};t.mtime&&!this.noMtime&&(n++,external_node_fs_namespaceObject.utimes(String(t.absolute),t.atime||new Date,t.mtime,o)),this[ge](t)&&(n++,external_node_fs_namespaceObject.chown(String(t.absolute),Number(this[be](t)),Number(this[_e](t)),o)),o()})}[Cr](t){t.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${t.type}`,{entry:t}),t.resume()}[Ar](t,e){let i=f(external_node_path_namespaceObject.relative(this.cwd,external_node_path_namespaceObject.resolve(external_node_path_namespaceObject.dirname(String(t.absolute)),String(t.linkpath)))).split("/");this[Re](t,this.cwd,i,()=>this[gi](t,String(t.linkpath),"symlink",e),r=>{this[O](r,t),e()})}[Ir](t,e){let i=f(external_node_path_namespaceObject.resolve(this.cwd,String(t.linkpath))),r=f(String(t.linkpath)).split("/");this[Re](t,this.cwd,r,()=>this[gi](t,i,"link",e),n=>{this[O](n,t),e()})}[Re](t,e,i,r,n){let o=i.shift();if(this.preservePaths||o===void 0)return r();let h=external_node_path_namespaceObject.resolve(e,o);external_node_fs_namespaceObject.lstat(h,(a,l)=>{if(a)return r();if(l?.isSymbolicLink())return n(new St(h,external_node_path_namespaceObject.resolve(h,i.join("/"))));this[Re](t,h,i,r,n)})}[kr](){this[Ri]++}[$t](){this[Ri]--,this[bs]()}[Ls](t){this[$t](),t.resume()}[Os](t,e){return t.type==="File"&&!this.unlink&&e.isFile()&&e.nlink<=1&&!Te}[_s](t){this[kr]();let e=[t.path];t.linkpath&&e.push(t.linkpath),this.reservations.reserve(e,i=>this[Nr](t,i))}[Nr](t,e){let i=h=>{e(h)},r=()=>{this[yt](this.cwd,this.dmode,h=>{if(h){this[O](h,t),i();return}this[Oe]=!0,n()})},n=()=>{if(t.absolute!==this.cwd){let h=f(external_node_path_namespaceObject.dirname(String(t.absolute)));if(h!==this.cwd)return this[yt](h,this.dmode,a=>{if(a){this[O](a,t),i();return}o()})}o()},o=()=>{external_node_fs_namespaceObject.lstat(String(t.absolute),(h,a)=>{if(a&&(this.keep||this.newer&&a.mtime>(t.mtime??a.mtime))){this[Ls](t),i();return}if(h||this[Os](t,a))return this[P](null,t,i);if(a.isDirectory()){if(t.type==="Directory"){let l=this.chmod&&t.mode&&(a.mode&4095)!==t.mode,c=d=>this[P](d??null,t,i);return l?external_node_fs_namespaceObject.chmod(String(t.absolute),Number(t.mode),c):c()}if(t.absolute!==this.cwd)return external_node_fs_namespaceObject.rmdir(String(t.absolute),l=>this[P](l??null,t,i))}if(t.absolute===this.cwd)return this[P](null,t,i);mo(String(t.absolute),l=>this[P](l??null,t,i))})};this[Oe]?n():r()}[P](t,e,i){if(t){this[O](t,e),i();return}switch(e.type){case"File":case"OldFile":case"ContiguousFile":return this[Ts](e,i);case"Link":return this[Ir](e,i);case"SymbolicLink":return this[Ar](e,i);case"Directory":case"GNUDumpDir":return this[xs](e,i)}}[gi](t,e,i,r){external_node_fs_namespaceObject[i](e,String(t.absolute),n=>{n?this[O](n,t):(this[$t](),t.resume()),r()})}},ye=s=>{try{return[null,s()]}catch(t){return[t,null]}},xe=class extends Xt{sync=!0;[P](t,e){return super[P](t,e,()=>{})}[_s](t){if(!this[Oe]){let n=this[yt](this.cwd,this.dmode);if(n)return this[O](n,t);this[Oe]=!0}if(t.absolute!==this.cwd){let n=f(external_node_path_namespaceObject.dirname(String(t.absolute)));if(n!==this.cwd){let o=this[yt](n,this.dmode);if(o)return this[O](o,t)}}let[e,i]=ye(()=>external_node_fs_namespaceObject.lstatSync(String(t.absolute)));if(i&&(this.keep||this.newer&&i.mtime>(t.mtime??i.mtime)))return this[Ls](t);if(e||this[Os](t,i))return this[P](null,t);if(i.isDirectory()){if(t.type==="Directory"){let o=this.chmod&&t.mode&&(i.mode&4095)!==t.mode,[h]=o?ye(()=>{external_node_fs_namespaceObject.chmodSync(String(t.absolute),Number(t.mode))}):[];return this[P](h,t)}let[n]=ye(()=>external_node_fs_namespaceObject.rmdirSync(String(t.absolute)));this[P](n,t)}let[r]=t.absolute===this.cwd?[]:ye(()=>po(String(t.absolute)));this[P](r,t)}[Ts](t,e){let i=typeof t.mode=="number"?t.mode&4095:this.fmode,r=h=>{let a;try{external_node_fs_namespaceObject.closeSync(n)}catch(l){a=l}(h||a)&&this[O](h||a,t),e()},n;try{n=external_node_fs_namespaceObject.openSync(String(t.absolute),ms(t.size),i)}catch(h){return r(h)}let o=this.transform&&this.transform(t)||t;o!==t&&(o.on("error",h=>this[O](h,t)),t.pipe(o)),o.on("data",h=>{try{external_node_fs_namespaceObject.writeSync(n,h,0,h.length)}catch(a){r(a)}}),o.on("end",()=>{let h=null;if(t.mtime&&!this.noMtime){let a=t.atime||new Date,l=t.mtime;try{external_node_fs_namespaceObject.futimesSync(n,a,l)}catch(c){try{external_node_fs_namespaceObject.utimesSync(String(t.absolute),a,l)}catch{h=c}}}if(this[ge](t)){let a=this[be](t),l=this[_e](t);try{external_node_fs_namespaceObject.fchownSync(n,Number(a),Number(l))}catch(c){try{external_node_fs_namespaceObject.chownSync(String(t.absolute),Number(a),Number(l))}catch{h=h||c}}}r(h)})}[xs](t,e){let i=typeof t.mode=="number"?t.mode&4095:this.dmode,r=this[yt](String(t.absolute),i);if(r){this[O](r,t),e();return}if(t.mtime&&!this.noMtime)try{external_node_fs_namespaceObject.utimesSync(String(t.absolute),t.atime||new Date,t.mtime)}catch{}if(this[ge](t))try{external_node_fs_namespaceObject.chownSync(String(t.absolute),Number(this[be](t)),Number(this[_e](t)))}catch{}e(),t.resume()}[yt](t,e){try{return _r(f(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:e})}catch(i){return i}}[Re](t,e,i,r,n){if(this.preservePaths||i.length===0)return r();let o=e;for(let h of i){o=external_node_path_namespaceObject.resolve(o,h);let[a,l]=ye(()=>external_node_fs_namespaceObject.lstatSync(o));if(a)return r();if(l.isSymbolicLink())return n(new St(o,external_node_path_namespaceObject.resolve(e,i.join("/"))))}r()}[gi](t,e,i,r){let n=`${i}Sync`;try{external_node_fs_namespaceObject[n](e,String(t.absolute)),r(),t.resume()}catch(o){return this[O](o,t)}}};var Eo=s=>{let t=new xe(s),e=s.file,i=external_node_fs_namespaceObject.statSync(e),r=s.maxReadSize||16*1024*1024;new Be(e,{readSize:r,size:i.size}).pipe(t)},wo=(s,t)=>{let e=new Xt(s),i=s.maxReadSize||16*1024*1024,r=s.file;return new Promise((o,h)=>{e.on("error",h),e.on("close",o),external_node_fs_namespaceObject.stat(r,(a,l)=>{if(a)h(a);else{let c=new _t(r,{readSize:i,size:l.size});c.on("error",h),c.pipe(e)}})})},So=K(Eo,wo,s=>new xe(s),s=>new Xt(s),(s,t)=>{t?.length&&Qi(s,t)});var yo=(s,t)=>{let e=new kt(s),i=!0,r,n;try{try{r=external_node_fs_namespaceObject.openSync(s.file,"r+")}catch(a){if(a?.code==="ENOENT")r=external_node_fs_namespaceObject.openSync(s.file,"w+");else throw a}let o=external_node_fs_namespaceObject.fstatSync(r),h=Buffer.alloc(512);t:for(n=0;no.size)break;n+=l,s.mtimeCache&&a.mtime&&s.mtimeCache.set(String(a.path),a.mtime)}i=!1,Ro(s,e,n,r,t)}finally{if(i)try{external_node_fs_namespaceObject.closeSync(r)}catch{}}},Ro=(s,t,e,i,r)=>{let n=new Wt(s.file,{fd:i,start:e});t.pipe(n),bo(t,r)},go=(s,t)=>{t=Array.from(t);let e=new wt(s),i=(n,o,h)=>{let a=(T,D)=>{T?external_node_fs_namespaceObject.close(n,E=>h(T)):h(null,D)},l=0;if(o===0)return a(null,0);let c=0,d=Buffer.alloc(512),y=(T,D)=>{if(T||D===void 0)return a(T);if(c+=D,c<512&&D)return external_node_fs_namespaceObject.read(n,d,c,d.length-c,l+c,y);if(l===0&&d[0]===31&&d[1]===139)return a(new Error("cannot append to compressed archives"));if(c<512)return a(null,l);let E=new F(d);if(!E.cksumValid)return a(null,l);let x=512*Math.ceil((E.size??0)/512);if(l+x+512>o||(l+=x+512,l>=o))return a(null,l);s.mtimeCache&&E.mtime&&s.mtimeCache.set(String(E.path),E.mtime),c=0,external_node_fs_namespaceObject.read(n,d,0,512,l,y)};external_node_fs_namespaceObject.read(n,d,0,512,l,y)};return new Promise((n,o)=>{e.on("error",o);let h="r+",a=(l,c)=>{if(l&&l.code==="ENOENT"&&h==="r+")return h="w+",external_node_fs_namespaceObject.open(s.file,h,a);if(l||!c)return o(l);external_node_fs_namespaceObject.fstat(c,(d,y)=>{if(d)return external_node_fs_namespaceObject.close(c,()=>o(d));i(c,y.size,(T,D)=>{if(T)return o(T);let E=new et(s.file,{fd:c,start:D});e.pipe(E),E.on("error",o),E.on("close",n),_o(e,t)})})};external_node_fs_namespaceObject.open(s.file,h,a)})},bo=(s,t)=>{t.forEach(e=>{e.charAt(0)==="@"?Ct({file:external_node_path_namespaceObject.resolve(s.cwd,e.slice(1)),sync:!0,noResume:!0,onReadEntry:i=>s.add(i)}):s.add(e)}),s.end()},_o=async(s,t)=>{for(let e of t)e.charAt(0)==="@"?await Ct({file:external_node_path_namespaceObject.resolve(String(s.cwd),e.slice(1)),noResume:!0,onReadEntry:i=>s.add(i)}):s.add(e);s.end()},vt=K(yo,go,()=>{throw new TypeError("file is required")},()=>{throw new TypeError("file is required")},(s,t)=>{if(!Bs(s))throw new TypeError("file is required");if(s.gzip||s.brotli||s.zstd||s.file.endsWith(".br")||s.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!t?.length)throw new TypeError("no paths specified to add/replace")});var Oo=K(vt.syncFile,vt.asyncFile,vt.syncNoFile,vt.asyncNoFile,(s,t=[])=>{vt.validate?.(s,t),To(s)}),To=s=>{let t=s.filter;s.mtimeCache||(s.mtimeCache=new Map),s.filter=t?(e,i)=>t(e,i)&&!((s.mtimeCache?.get(e)??i.mtime??0)>(i.mtime??0)):(e,i)=>!((s.mtimeCache?.get(e)??i.mtime??0)>(i.mtime??0))};
+;// CONCATENATED MODULE: external "node:buffer"
+const external_node_buffer_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:buffer");
+;// CONCATENATED MODULE: external "node:zlib"
+const external_node_zlib_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:zlib");
+var external_node_zlib_namespaceObject_0 = /*#__PURE__*/__nccwpck_require__.t(external_node_zlib_namespaceObject, 2);
+;// CONCATENATED MODULE: ./node_modules/tar/dist/esm/server/index.min.js
+var Ti=Object.defineProperty;var zi=(i,e)=>{for(var t in e)Ti(i,t,{get:e[t],enumerable:!0})};var E=i=>ArrayBuffer.isView(i)&&i[Symbol.toStringTag]==="Uint8Array",it=i=>Object.prototype.toString.call(i)==="[object ArrayBuffer]",L=i=>typeof i?.size=="number"&&typeof i.stream=="function",Pe=i=>typeof i?.getReader=="function",Oi=new TextDecoder("utf-8",{ignoreBOM:!0}),Pi=new TextEncoder,A=i=>{let e=i.length;for(let t=0;t=55296&&s<=56319&&(i.charCodeAt(t+1)&64512)===56320?(e+=2,t++):e+=2)}return e},O=(i,e=0,t=i.length)=>{let s="";for(let n=e;n=128)return Oi.decode(i.subarray(e,t));s+=String.fromCharCode(r)}return s},Fe=(i,e,t,s)=>{let{written:n}=Pi.encodeInto(i,e.subarray(t,t+s));e.fill(0,t+n,t+s)},st=(i,e,t)=>{for(let s=0;s{if(Number.isSafeInteger(i))i<0?Ni(i,e):Fi(i,e);else throw Error("cannot encode number outside of javascript safe integer range");return e},Fi=(i,e)=>{e[0]=128;for(var t=e.length;t>1;t--)e[t-1]=i&255,i=Math.floor(i/256)},Ni=(i,e)=>{e[0]=255;var t=!1;i=i*-1;for(var s=e.length;s>1;s--){var n=i&255;i=Math.floor(i/256),t?e[s-1]=Rt(n):n===0?e[s-1]=0:(t=!0,e[s-1]=At(n))}},Et=i=>{let e=i[0],t=e===128?Li(i.subarray(1,i.length)):e===255?Ui(i):null;if(t===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(t))throw Error("parsed number outside of javascript safe integer range");return t},Ui=i=>{for(var e=i.length,t=0,s=!1,n=e-1;n>-1;n--){var r=Number(i[n]),o;s?o=Rt(r):r===0?o=r:(s=!0,o=At(r)),o!==0&&(t-=o*Math.pow(256,e-n-1))}return t},Li=i=>{for(var e=i.length,t=0,s=e-1;s>-1;s--){var n=Number(i[s]);n!==0&&(t+=n*Math.pow(256,e-s-1))}return t},Rt=i=>(255^i)&255,At=i=>(255^i)+1&255;var he=i=>{let e=i.charCodeAt(0)===47,t=[];for(let r of i.split("/"))r===""||r==="."||(r!==".."?t.push(r):t.length&&t[t.length-1]!==".."?t.pop():e||t.push(r));let s=t.length&&i.charCodeAt(i.length-1)===47,n=t.join("/")+(s?"/":"");return e?"/"+n:n||(i.endsWith("/")?"./":".")},j=(...i)=>he(i.filter(e=>e).join("/")),P=i=>{let e=i.length;for(;e>1&&i.charCodeAt(e-1)===47;)e--;let t=i.lastIndexOf("/",e-1);return t===-1?".":t===0?"/":t===1&&i.charCodeAt(0)===47?"//":i.slice(0,t)},le=i=>{let e=i.length;for(;e>0&&i.charCodeAt(e-1)===47;)e--;return i.slice(i.lastIndexOf("/",e-1)+1,e)},ie=i=>i.charCodeAt(0)===47,C=(...i)=>{let e="";for(let s=i.length-1;s>=0&&!ie(e);s--){let n=i[s];n&&(e=e?n+"/"+e:n)}let t=he(e);return t.length>1&&t.endsWith("/")?t.slice(0,-1):t},D=(i,e)=>{let t=C(i).split("/"),s=C(e).split("/");t[t.length-1]||t.pop(),s[s.length-1]||s.pop();let n=0;for(;n".."),...s.slice(n)].join("/")};var nt={};zi(nt,{code:()=>Ne,isCode:()=>de,isName:()=>Di,name:()=>pe,normalFsTypes:()=>Mi});var de=i=>pe.has(i),Di=i=>Ne.has(i),Mi=new Set(["0","","1","2","3","4","5","6","7","D"]),pe=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),Ne=new Map(Array.from(pe).map(i=>[i[1],i[0]]));var _i=i=>i===void 0||i<0?void 0:i,R=class{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#e="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(e,t=0,s,n){E(e)?this.decode(e,t||0,s,n):e&&this.#t(e)}decode(e,t,s,n){if(t||(t=0),!e||!(e.length>=t+512))throw new Error("need 512 bytes for header");let r=F(e,t+156,1),o=/^[xgXLK]$/.test(r),a=o?void 0:s,c=o?void 0:n;if(this.path=a?.path??F(e,t,100),this.mode=a?.mode??c?.mode??_(e,t+100,8),this.uid=a?.uid??c?.uid??_(e,t+108,8),this.gid=a?.gid??c?.gid??_(e,t+116,8),this.size=_i(a?.size??$i(e,t+124)),this.mtime=a?.mtime??c?.mtime??rt(e,t+136,12),this.cksum=_(e,t+148,12),c&&this.#t(c,!0),a&&this.#t(a),de(r)&&(this.#e=r||"0"),this.#e==="5"&&(this.size=0),this.#e==="0"&&this.path.slice(-1)==="/"&&(this.#e="5"),this.linkpath=F(e,t+157,100),O(e,t+257,t+263)==="ustar\0")if(this.uname=a?.uname??c?.uname??F(e,t+265,32),this.gname=a?.gname??c?.gname??F(e,t+297,32),this.devmaj=a?.devmaj??c?.devmaj??_(e,t+329,8)??0,this.devmin=a?.devmin??c?.devmin??_(e,t+337,8)??0,e[t+475]!==0){let l=F(e,t+345,155);this.path=l+"/"+this.path}else{let l=F(e,t+345,130);l&&(this.path=l+"/"+this.path),this.atime=s?.atime??n?.atime??rt(e,t+476,12),this.ctime=s?.ctime??n?.ctime??rt(e,t+488,12)}let h=256;for(let l=t;l!(n==null||s==="size"&&(t||Number(n)<0)||s==="path"&&t||s==="linkpath"&&t||s==="global"))))}encode(e,t=0){if(e||(e=this.block=new Uint8Array(512)),this.#e==="Unsupported"&&(this.#e="0"),!(e.length>=t+512))throw new Error("need 512 bytes for header");let s=this.ctime||this.atime?130:155,n=Ii(this.path||"",s),r=n[0],o=n[1];this.needPax=!!n[2],this.needPax=G(e,t,100,r)||this.needPax,this.needPax=M(e,t+100,8,this.mode)||this.needPax,this.needPax=M(e,t+108,8,this.uid)||this.needPax,this.needPax=M(e,t+116,8,this.gid)||this.needPax,this.needPax=M(e,t+124,12,this.size)||this.needPax,this.needPax=ot(e,t+136,12,this.mtime)||this.needPax,e[t+156]=Number(this.#e.codePointAt(0)),this.needPax=G(e,t+157,100,this.linkpath)||this.needPax,st("ustar\x0000",e,t+257),this.needPax=G(e,t+265,32,this.uname)||this.needPax,this.needPax=G(e,t+297,32,this.gname)||this.needPax,this.needPax=M(e,t+329,8,this.devmaj)||this.needPax,this.needPax=M(e,t+337,8,this.devmin)||this.needPax,this.needPax=G(e,t+345,s,o)||this.needPax,e[t+475]!==0?this.needPax=G(e,t+345,155,o)||this.needPax:(this.needPax=G(e,t+345,130,o)||this.needPax,this.needPax=ot(e,t+476,12,this.atime)||this.needPax,this.needPax=ot(e,t+488,12,this.ctime)||this.needPax);let a=256;for(let c=t;c{let s=i,n="",r,o=i.charAt(0)==="/"?"/":".";if(A(s)<100)r=[s,n,!1];else{n=P(s),s=le(s);do A(s)<=100&&A(n)<=e?r=[s,n,!1]:A(s)>100&&A(n)<=e?r=[s.slice(0,99),n,!0]:(s=j(le(n),s),n=P(n));while(n!==o&&r===void 0);r||(r=[i.slice(0,99),"",!0])}return r},F=(i,e,t)=>{let s=e,n=Math.min(e+t,i.length);for(;sBi(_(i,e,t)),Bi=i=>i===void 0?void 0:new Date(i*1e3),_=(i,e,t)=>Number(i[e])&128?Hi(i.subarray(e,e+t)):ji(i,e,t),Hi=i=>{try{return Et(i)}catch{return}},$i=(i,e)=>{if(Number(i[e])&128)return _(i,e,12);let t=F(i,e,12);return/^ *[0-7]* *$/.test(t)&&i.subarray(e+t.length,e+12).every(s=>s===0)?parseInt(t,8)||0:void 0},Wi=i=>isNaN(i)?void 0:i,ji=(i,e,t)=>Wi(parseInt(F(i,e,t).trim(),8)),Gi={12:8589934591,8:2097151},M=(i,e,t,s)=>s===void 0?!1:s>Gi[t]||s<0?(vt(s,i.subarray(e,e+t)),!0):(Yi(i,e,t,s),!1),Yi=(i,e,t,s)=>st(qi(s,t),i,e),qi=(i,e)=>Vi(Math.floor(i).toString(8),e),Vi=(i,e)=>(i.length===e-1?i:"0".repeat(e-i.length-2)+i+" ")+"\0",ot=(i,e,t,s)=>s===void 0?!1:M(i,e,t,s.getTime()/1e3),G=(i,e,t,s)=>s===void 0?!1:(Fe(s,i,e,t),s.length!==A(s)||s.length>t);var Tt=/^\d+$/,Y=class i{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(e,t=!1){this.atime=e.atime,this.charset=e.charset,this.comment=e.comment,this.ctime=e.ctime,this.dev=e.dev,this.gid=e.gid,this.global=t,this.gname=e.gname,this.ino=e.ino,this.linkpath=e.linkpath,this.mtime=e.mtime,this.nlink=e.nlink,this.path=e.path,this.size=e.size,this.uid=e.uid,this.uname=e.uname}encode(){let e=this.encodeBody();if(e==="")return new Uint8Array(0);let t=A(e),s=512*Math.ceil(1+t/512),n=new Uint8Array(s);return new R({path:("PaxHeader/"+le(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:t,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(n),Fe(e,n,512,t),n}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(e){if(this[e]===void 0)return"";let t=this[e],s=typeof t=="object"?t.getTime()/1e3:t,n=" "+(e==="dev"||e==="ino"||e==="nlink"?"SCHILY.":"")+e+"="+s+`
+`,r=A(n),o=Math.floor(Math.log(r)/Math.log(10))+1;return r+o>=Math.pow(10,o)&&(o+=1),o+r+n}static parse(e,t,s=!1){return i.parseBytes(new TextEncoder().encode(e),t,s)}static parseBytes(e,t,s=!1){return new i(Xi(Ki(e),t),s)}},Xi=(i,e)=>e?Object.assign({},e,i):i,Ki=i=>{let e=Object.create(null),t=0;for(;t=48&&i[s]<=57;)s++;let n=t+Number(O(i,t,s));if(s===t||i[s]!==32||n<=s+1||n>i.length||i[n-1]!==10)throw new Error("invalid PAX record");Zi(e,O(i,s+1,n-1)),t=n}return e},Zi=(i,e)=>{let t=e.split("=");if(t.length===1)throw new Error("invalid PAX record");let s=t.shift();if(!s)return i;let n=s.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),r=t.join("="),o=r.indexOf("\0"),a=o===-1?r:r.slice(0,o);switch(n){case"path":case"linkpath":case"type":case"charset":case"comment":case"gname":case"uname":i[n]=a;break;case"ctime":case"atime":case"mtime":let c=new Date(Number(a)*1e3);isNaN(c.getTime())||(i[n]=c);break;case"size":if(!Tt.test(r)||!Number.isSafeInteger(+r))throw new Error("invalid PAX size");i[n]=+r;break;case"gid":case"uid":case"dev":case"ino":case"nlink":case"mode":if(!Tt.test(a.trim()))break;let h=+a;if(!Number.isSafeInteger(h))break;i[n]=h;break}return i};var T={name:"gzip",headLength:2,detect:i=>i[0]===31&&i[1]===139,decompress:()=>new DecompressionStream("gzip"),compress:i=>{let e=new CompressionStream("gzip");if(!i?.portable)return e;let t=0;return{writable:e.writable,readable:e.readable.pipeThrough(new TransformStream({transform:(s,n)=>{t<=9&&t+s.length>9&&(s[9-t]=255),t+=s.length,n.enqueue(s)}}))}}};var zt={C:"cwd",f:"file",z:"gzip",P:"preservePaths",U:"unlink","strip-components":"strip",stripComponents:"strip","keep-newer":"newer",keepNewer:"newer","keep-newer-files":"newer",keepNewerFiles:"newer",k:"keep","keep-existing":"keep",keepExisting:"keep",m:"noMtime","no-mtime":"noMtime",p:"preserveOwner",L:"follow",h:"follow",onentry:"onEntry",onReadEntry:"onEntry"},y=i=>{let e=Object.assign(Object.create(null),i);for(let[t,s]of Object.entries(zt))e[t]!==void 0&&(e[s]??=e[t]),delete e[t];return e.noChmod===!1&&(e.chmod??=!0),delete e.noChmod,e};var N=i=>{if(i.length===1)return i[0].slice();let e=0;for(let n of i)e+=n.length;let t=new Uint8Array(e),s=0;for(let n of i)t.set(n,s),s+=n.length;return t};var k=(i,e)=>Object.assign(Object.create(null),i,e),q=(i,e,t)=>{if(e==null||e===0)return t;if(e===1/0||Number.isInteger(e)&&Number(e)>0)return e;throw new TypeError(`${i} must be a positive integer`)};var Ji=new Set(["File","OldFile","Link","SymbolicLink","CharacterDevice","BlockDevice","Directory","FIFO","ContiguousFile","GNUDumpDir"]),Ue=i=>i.replaceAll("\\","/"),V=class{header;extended;globalExtended;type;path;mode;uid;gid;uname;gname;size;mtime;atime;ctime;linkpath;devmaj;devmin;dev;ino;nlink;absolute;ignore;invalid=!1;unsupported=!1;constructor(e,t,s,n=!1){if(!e.path)throw new Error("no path provided for tar.ReadEntry");this.header=e,this.extended=t,this.globalExtended=s,this.type=e.type,this.ignore=!Ji.has(this.type),this.path=n?Ue(e.path):e.path,this.mode=e.mode&&e.mode&4095,this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,this.size=e.size??0,this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime;let r=this.type==="Link"||this.type==="SymbolicLink";this.linkpath=r&&e.linkpath?n?Ue(e.linkpath):e.linkpath:void 0,this.devmaj=e.devmaj,this.devmin=e.devmin,s&&this.#e(s),t&&(this.#e(t),t.path!=null&&(this.path=n?Ue(t.path):t.path),r&&t.linkpath!=null&&(this.linkpath=n?Ue(t.linkpath):t.linkpath))}#e(e){e.uid!=null&&(this.uid=e.uid),e.gid!=null&&(this.gid=e.gid),e.uname!=null&&(this.uname=e.uname),e.gname!=null&&(this.gname=e.gname),e.mtime!=null&&(this.mtime=e.mtime),e.atime!=null&&(this.atime=e.atime),e.ctime!=null&&(this.ctime=e.ctime),e.dev!=null&&(this.dev=e.dev),e.ino!=null&&(this.ino=e.ino),e.nlink!=null&&(this.nlink=e.nlink)}},Ot=new TextDecoder,Pt=i=>{let e="";for(let t of i)e+=Ot.decode(t,{stream:!0});return e+Ot.decode()},Ft=()=>new TypeError("Body has already been consumed"),fe=class extends V{#e;#t=!1;#i;constructor(e,t,s,n,r){super(e,t,s,n),this.#e=r}get bodyUsed(){return this.#t}get body(){if(this.#i)return this.#i;let e=!1;return this.#i=new ReadableStream({pull:async t=>{e||(this.#s(),e=!0);let[s]=await this.#n(1);s?t.enqueue(s):t.close()}},{highWaterMark:0})}#s(){if(this.#t)throw Ft();this.#t=!0}#r(e,t=1/0){let s=this.#e;for(;s&&e.length(i.file&&(s.file=i.file),s.code=typeof t=="object"&&t.code||e,s.tarCode=e,s),me=(i,e,t,s={})=>Object.assign(typeof t=="object"?t:new Error(`${e}: ${t}`),Nt(i,e,t,s)),S=(i,e,t,s={})=>{let n=Object.hasOwn(s,"recoverable")&&s.recoverable===!1;if(i.strict||n)throw me(i,e,t,s);Nt(i,e,t,s),typeof t=="object"&&(s=Object.assign(t,s),t=t.message),i.onwarn?.(e,t,s)};var Ut=0,X=1,Le=2,Ce=3,Lt=4,at={type:"entryEnd"},Qi={type:"end"},es=new Set(["ExtendedHeader","OldExtendedHeader","GlobalExtendedHeader","NextFileHasLongPath","NextFileHasLongLinkpath"]),ts=new Set(["Link","SymbolicLink","CharacterDevice","BlockDevice","FIFO","TapeVolumeHeader"]),Ct=i=>{let e=i.indexOf(0);return O(i,0,e===-1?i.length:e)},I=class{maxMetaEntrySize;position=0;offset=0;#e;#t;#i;#s=[];#r;#n=0;#a;#o=0;#c=Ut;#h;#p;#y;#x=0;#f=0;#l=0;#u;#w;#k;#E;#S=!1;#g;#b=!1;#m=!1;#v=0;constructor(e={},t){e=this.#e=k(e),this.maxMetaEntrySize=e.maxMetaEntrySize||1024*1024,this.#t=e.filter;let s=e.platform==="win32";this.#i=t??((n,r,o)=>new V(n,r,o,s))}warn(e,t,s){S(this.#e,e,t,s)}push(e){this.#S||this.#s.push(e)}end(){this.#S=!0}get bodyRemain(){let e=this.#r,t=this.#c;return t!==Le&&t!==Ce||this.#s.length||e&&this.#n=512)this.#n=t+512,l=this.#T(e,t);else{let d=this.#a??=new Uint8Array(512),p=Math.min(512-this.#o,s);if(d.set(e.subarray(t,t+p),this.#o),this.#n=t+p,this.#o+=p,this.#o<512)continue;this.#o=0,l=this.#T(d,0)}if(l)return l;continue}let r=this.#l,o=sX){let t=this.#h,s=(512-this.#l%512)%512,n=this.#l+s;this.#h=void 0,this.#y=void 0,this.#c=X,!t?.invalid&&!this.#b&&(this.#g=!0),this.#b=!1,this.#m=e===Le,this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${n} more bytes, only ${s} available)`,{entry:t,header:this.#p});return}return this.#m?(this.#m=!1,at):(this.#v===0&&(this.#v=1,(e===Ut||this.#g===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")),this.#v=2,Qi)}#T(e,t){this.offset+=512,this.#g===void 0&&(this.#g=!1);let s=this.#u,n=this.#w,r=this.#k;(n!==void 0||r!==void 0)&&(s=Object.assign(Object.create(null),s),s.path??=n,s.linkpath??=r);let o=new R(e,t,s,this.#E);if(o.nullBlock){this.#S=!0,this.#r=void 0,this.#s.length=0,this.#o=0,this.#c=X;return}let a=o.type,c=es.has(a);if(!o.cksumValid){this.#A(o,"checksum failure",!1);return}let h=O(e,t+257,t+265);e[t+345]&&h.startsWith("ustar")&&h[5]!=="\0"&&h!=="ustar \0"&&this.#d("prefix with an unknown ustar magic",o);let l=o.size;if(l===void 0&&this.#d("invalid size",o),(l&&ts.has(a)||a==="Directory"&&s?.size)&&this.#d(`${a} entry with a body`,o),l&&!c&&a!=="GNUDumpDir"&&o.path?.endsWith("/")&&this.#d("entry with a body and a directory name",o),!o.path&&!c){this.#A(o,"path is required",!0);return}if((a==="Link"||a==="SymbolicLink")&&!(s?.linkpath??o.linkpath)){this.#A(o,"linkpath required",!0);return}if(this.#p=o,this.#f=l,this.#l=512*Math.ceil(l/512),l||(this.#g=!0),c){l>this.maxMetaEntrySize&&this.#d(`${a} entry larger than maxMetaEntrySize`,o),(a==="NextFileHasLongPath"?n!==void 0:a==="NextFileHasLongLinkpath"?r!==void 0:a!=="GlobalExtendedHeader"&&this.#u)&&this.#d(`two ${a} entries for one entry`,o),this.#u&&a.startsWith("NextFile")&&this.#d(`${a} entry after a PAX header`,o),l>0&&(this.#y=new Uint8Array(l),this.#x=0,this.#c=Lt);return}this.#u=this.#w=this.#k=void 0;let d=this.#i(o,s,this.#E);return!d.ignore&&this.#t&&!this.#t(d.path,d)&&(d.ignore=!0),l?(this.#h=d,this.#c=d.ignore?Ce:Le):(this.#c=X,this.position=this.offset,this.#m=!d.ignore),{type:"entry",entry:d}}#A(e,t,s){this.#u=this.#w=this.#k=void 0;let n=s?e.size:0;n&&(this.#p=e,this.#f=n,this.#l=512*Math.ceil(n/512),this.#c=Ce,this.#b=!0),this.warn("TAR_ENTRY_INVALID",t,{header:e})}#d(e,t){throw this.#S=!0,this.#r=this.#y=void 0,this.#s.length=0,this.#o=0,this.#c=X,this.#v=2,me(this.#e,"TAR_BAD_ARCHIVE",e,{header:t,recoverable:!1})}#O(e){let t=this.#p,s=t.type;if(s==="NextFileHasLongPath"){this.#w=Ct(e);return}if(s==="NextFileHasLongLinkpath"){this.#k=Ct(e);return}let n=s==="GlobalExtendedHeader",r;try{r=Y.parseBytes(e,n?this.#E:void 0,n)}catch(o){this.#d(o.message,t)}if(!n){(r.path!==void 0&&this.#w!==void 0||r.linkpath!==void 0&&this.#k!==void 0)&&this.#d("PAX name after a GNU long name",t),this.#u=r;return}(r.size!==void 0||r.path!==void 0||r.linkpath!==void 0)&&this.#d("size or path in a global PAX header",t),this.#E=r}};var is=16*1024*1024,Dt=64*1024,ss=1024*1024,Me=Symbol.for("tar.readFile.skip"),De=class{pos=0;size=0;#e;#t=Dt;constructor(e){this.#e=q("maxReadSize",e,is)}next(){let e=Math.min(this.#t,this.#e,this.size-this.pos);return this.#t*=2,e}skip(e){return ethis.size?!1:(this.pos+=e,this.#t=Dt,!0)}};async function*ns(i,e,t){let s=await i.open(e,"r");try{t.size=(await s.stat()).size;for(let n;n=t.next();){let r=new Uint8Array(n),{bytesRead:o}=await s.read(r,0,n,t.pos);if(!o)break;t.pos+=o,yield o{})}}function*rs(i,e,t){let s=i.openSync(e,"r");try{t.size=i.fstatSync(s).size;for(let n;n=t.next();){let r=new Uint8Array(n),o=i.readSync(s,r,0,n,t.pos);if(!o)break;t.pos+=o,yield o{let s=new De(t);return Object.assign(ns(i,e,s),{[Me]:n=>s.skip(n)})},H=(i,e,t)=>{let s=new De(t);return Object.assign(rs(i,e,s),{[Me]:n=>s.skip(n)})};var ct=()=>{},ye=i=>Math.max(512,...i.map(e=>e.headLength)),os=i=>{try{let e=new R(i);return e.cksumValid||e.nullBlock}catch{return!1}},ge=(i,e,t="")=>i.find(s=>s.detect(e))??(os(e)?void 0:i.find(s=>s.extensions?.some(n=>t.endsWith(n)))),Mt=i=>typeof i.maxDecompressionRatio=="number"?i.maxDecompressionRatio:1e3,_e=(i,e)=>me(i,"TAR_ABORT",e,{recoverable:!1}),_t=(i,e,t)=>_e(i,new Error(`max decompression ratio exceeded: ${e.toFixed(2)} > ${t}`)),as=()=>new TypeError("The body of an entry cannot be read after a later entry"),we=class{parser;current;ended=!1;constructor(e){this.parser=e}entry(){if(this.current=void 0,this.ended)return null;for(let e;e=this.parser.next();){if(e.type==="end")return this.ended=!0,null;if(e.type==="entry"&&!e.entry.ignore)return this.current=e.entry}}body(e){if(e!==this.current)throw as();let t=this.parser.next();if(t)return t.type==="body"?t.data:(this.current=void 0,null)}},It=(i,e)=>{if(i.current)return;let t=i.parser.bodyRemain;t&&e[Me]?.(t)&&i.parser.skipBody()},cs=i=>{if(E(i))return[i].values();if(it(i))return[new Uint8Array(i)].values();if(L(i)&&(i=i.stream()),Pe(i)){let e=i.getReader();return{next:()=>e.read(),return:()=>e.cancel()}}return Symbol.asyncIterator in i?i[Symbol.asyncIterator]():i[Symbol.iterator]()},b=class{parser;#e;#t;#i;#s;#r;#n;#a=!1;constructor(e,t={}){t=k(t);let s=t.platform==="win32";this.parser=new I(t,(n,r,o)=>new fe(n,r,o,s,this)),this.#e=new we(this.parser),this.#t=t,this.#i=cs(e)}poll(){return this.#a?null:this.#e.entry()}readBody(e){return this.#e.body(e)}fill(){return this.#n??=this.#o()}async#o(){try{let e=this.#s??=await this.#c(this.#i),t=this.#r;this.#r=void 0,e===this.#i&&It(this.#e,e);let s=t?{value:t,done:!1}:await e.next();s.done?this.parser.end():this.parser.push(s.value)}finally{this.#n=void 0}}async#c(e){let t=this.#t,s=[...t.codecs??[],T],n=ye(s),r;for(;!r||r.length{try{for(;;){if(await d.ready,f)return;let m=r?{value:r,done:!1}:await e.next();if(r=void 0,f)return;if(m.done)return await d.close();a+=m.value.length,await d.write(m.value)}}catch(m){f||await d.abort(m).catch(ct)}})();let u=Mt(t);return{next:async()=>{let m=await p.read().catch(g=>{throw _e(t,g)});if(!m.done){c+=m.value.length;let g=c/a;if(g>u)throw _t(t,g,u)}return m},return:async()=>(f=!0,await p.cancel().catch(ct),await d.abort().catch(ct),await e.return?.(),{value:void 0,done:!0})}}async next(){try{for(;;){let e=this.poll();if(e)return{value:e,done:!1};if(e===null)break;await this.fill()}}catch(e){throw await this.return(),e}return this.return()}async return(){return this.#a||(this.#a=!0,this.#e.current=void 0,await(this.#s??this.#i).return?.()),{value:void 0,done:!0}}[Symbol.asyncIterator](){return this}},v=class{parser;#e;#t;#i;#s;#r;#n=!1;constructor(e,t={}){t=k(t);let s=t.platform==="win32";this.parser=new I(t,(n,r,o)=>new ue(n,r,o,s,this)),this.#e=new we(this.parser),this.#t=t,this.#i=E(e)?[e].values():it(e)?[new Uint8Array(e)].values():e[Symbol.iterator]()}readBody(e){for(;;){let t=this.#e.body(e);if(t!==void 0)return t;this.#a()}}#a(){let e=this.#s??=this.#o(this.#i),t=this.#r;this.#r=void 0,e===this.#i&&It(this.#e,e);let s=t?{value:t,done:!1}:e.next();s.done?this.parser.end():this.parser.push(s.value)}#o(e){let t=this.#t,s=[...t.codecs??[],T],n=ye(s),r,o;for(;(!r||r.lengthd)throw _t(t,f,d);return[p].values()}next(){try{for(;;){let e=this.#n?null:this.#e.entry();if(e)return{value:e,done:!1};if(e===null)break;this.#a()}}catch(e){throw this.return(),e}return this.return()}return(){return this.#n||(this.#n=!0,this.#e.current=void 0,(this.#s??this.#i).return?.()),{value:void 0,done:!0}}[Symbol.iterator](){return this}},ht=(i,e)=>new b(i,e),Bt=(i,e)=>new v(i,e);var Ht=(i,e,t)=>(i&=4095,t&&(i=(i|384)&-19),e&&(i&256&&(i|=64),i&32&&(i|=8),i&4&&(i|=1)),i);var Ie=["|","<",">","?",":"],lt=Ie.map(i=>String.fromCodePoint(61440+Number(i.codePointAt(0)))),hs=new Map(Ie.map((i,e)=>[i,lt[e]])),ls=new Map(lt.map((i,e)=>[i,Ie[e]])),dt=i=>Ie.reduce((e,t)=>e.split(t).join(hs.get(t)),i),$t=i=>lt.reduce((e,t)=>e.split(t).join(ls.get(t)),i);var K=i=>i===47||i===92,ds=i=>i>=65&&i<=90||i>=97&&i<=122,$=i=>{let e=i.length,t=0;if(K(i.charCodeAt(0))){if(t=1,K(i.charCodeAt(1))){let s=2,n=s;for(;sK(i.charCodeAt(0))||$(i).length===3,Be=(i,e)=>{let t=xe(e)?e:i+"/"+e,s=$(t);return s+C("/",t.slice(s.length)).slice(1)},jt=i=>{let e=$(i),t=P(i.slice(e.length));return t==="."?e:e+t};var He=i=>{let e="";for(let t;t=$(i);)i.charAt(0)==="/"&&i.slice(0,4)!=="//?/"&&(t="/"),i=i.slice(t.length),e+=t;return[e,i]};var $e=i=>new ReadableStream({pull:async e=>{let t=await i.next();t.done?e.close():e.enqueue(t.value)},cancel:async()=>{await i.return?.()}},{highWaterMark:0});var Z=i=>{let e=i.length-1,t=-1;for(;e>-1&&i.charAt(e)==="/";)t=e,e--;return t===-1?i:i.slice(0,t)};var ps=new TextEncoder,Gt=(i,e)=>e?Z(e)+"/"+i.replace(/^\.(\/|$)/,""):i,se=class{path;type;mode;uid;gid;uname;gname;size;mtime;atime;ctime;linkpath;dev;ino;nlink;body;absolute;header;constructor(e,t){if(e.type==="Unsupported")throw new Error("writing entry that should be ignored");if(typeof t=="string"&&(t=ps.encode(t)),this.path=e.path,this.type=e.type??"File",this.mode=e.mode,this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,e.size===void 0&&t!==void 0&&!E(t)&&!L(t))throw new TypeError("a stream body needs the size option");this.size=e.size??(E(t)?t.length:L(t)?t.size:0),this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime,this.linkpath=e.linkpath,this.dev=e.dev,this.ino=e.ino,this.nlink=e.nlink,this.body=t}encode(e={},t=new Uint8Array(512)){e=k(e);let s=Gt(this.path,e.prefix),n=this.type==="Link"&&this.linkpath!==void 0?Gt(this.linkpath,e.prefix):this.linkpath,{uid:r,gid:o,uname:a,gname:c,size:h,mtime:l,atime:d,ctime:p}=this;if(this.header=new R({path:s,linkpath:n,mode:this.mode,uid:r,gid:o,size:h,mtime:l,type:this.type,uname:a,gname:c,atime:d,ctime:p}),!this.header.encode(t)||e.noPax)return[t];let{dev:f,ino:w,nlink:u}=this;return[new Y({atime:d,ctime:p,gid:o,gname:c,mtime:l,path:s,linkpath:n,size:h,uid:r,uname:a,dev:f,ino:w,nlink:u}).encode(),t]}};var fs=16*1024*1024,z=()=>{},ke=i=>512*Math.ceil(i/512),J=i=>i.replaceAll("\\","/"),pt=i=>`${i.dev}:${i.ino}`,We={bigint:!0},us=({dev:i,ino:e})=>!Number.isSafeInteger(i)||!Number.isSafeInteger(e),je=(i,e)=>i.dev===e.dev&&i.ino===e.ino,ft=(i,e)=>Object.assign(new Error(i),{path:e,syscall:"read",code:"EOF"}),Kt=(i,e)=>ft(`encountered unexpected EOF: ${i} has fewer than the ${e} bytes of its stat`,i),Zt=(i,e)=>ft(`did not encounter expected EOF: ${i} has more than the ${e} bytes of its stat`,i),Jt=i=>i.absolute??i.path,ms=i=>Object.assign(new Error("writing more data than expected"),{path:Jt(i)}),Qt=i=>Symbol.asyncIterator in i||Symbol.iterator in i,ws=i=>typeof i.encode=="function",U=class{path;absolute;up;linkpath;ready;constructor(e,t){this.path=e,this.absolute=t}},Se=class{opt;fs;cwd;win32;maxReadSize;header;codec;codecOptions;ended=!1;head;tail;wake;#e=new Map;constructor(e,t){e=this.opt=k(e),this.fs=e.fs,this.win32=e.platform==="win32",this.maxReadSize=q("maxReadSize",e.maxReadSize,fs);let{prefix:s,noPax:n}=e;this.header={prefix:s&&this.win32?J(s):s,noPax:n};let r=e.cwd&&(this.win32?J(e.cwd):e.cwd);if(r&&!(this.win32?xe:ie)(r))throw new TypeError("cwd must be an absolute path");this.cwd=r&&this.#t(r,"");let o=e,a=["gzip","brotli","zstd","compress"].filter(h=>o[h]);if(a.length>1)throw new TypeError(`${a.join(", ")} are mutually exclusive`);let[c]=a;if(c){let h=e.compress,[l,d]=h?Array.isArray(h)?h:[h]:[[...e.codecs??[],T].find(p=>p.name===c),o[c]];if(!l?.[t])throw new TypeError(`no codec named ${l?.name??c} has a ${t} function`);this.codec=l,this.codecOptions={...typeof d=="object"?d:void 0,...l.name==="gzip"&&e.portable?{portable:!0}:void 0}}}#t(e,t){return this.win32?Be(e,t):C(e,t)}resolve(e){if(!this.cwd||!this.fs)throw new TypeError("a path needs the cwd and fs options");return this.#t(this.cwd,this.win32?J(e):e)}add(e){if(this.ended)throw new Error("write after end");if(typeof e!="string")this.push(e);else{let t=this.win32?J(e):e;this.push(new U(t||"./",this.resolve(t)))}return this}end(){return this.ended=!0,this.wake?.(),this}push(e){let t={item:e};this.tail?this.tail.next=t:this.head=t,this.tail=t,this.wake?.()}shift(){this.head=this.head?.next,this.head||(this.tail=void 0)}needsExact(e){return us(e)&&(e.isDirectory()?!!this.opt.follow:e.isFile()&&e.nlink>1)}plan(e,t,s){let{filter:n}=this.opt;if(!(n&&!n(e.path,t))){if(t.isDirectory()){for(let r=e.up;r;r=r.up)if(r.key===pt(s)){S(this.opt,"TAR_ENTRY_ERROR","directory is its own ancestor",{path:e.path,absolute:e.absolute});return}return"Directory"}if(t.isSymbolicLink())return"SymbolicLink";if(!t.isFile()){S(this.opt,"TAR_ENTRY_UNSUPPORTED","unsupported file type",{path:e.path,absolute:e.absolute});return}if(t.nlink>1){let r=pt(s),o=this.#e.get(r),a=this.cwd;if(o!==e.absolute&&o?.startsWith(a.endsWith("/")?a:a+"/"))return e.linkpath=D(a,o),"Link";this.#e.set(r,e.absolute)}return"File"}}children(e,t,s){let n=e.path==="./"?"":e.path.replace(/\/*$/,"/"),r=e.absolute.endsWith("/")?e.absolute:e.absolute+"/",o=this.opt.follow?{key:pt(s),up:e.up}:void 0;return[...t].sort().map(a=>{let c=new U(n+a,r+a);return c.up=o,c})}missing(e,t){if(t?.code!=="ENOENT")throw t;S(this.opt,"TAR_ENTRY_ERROR",t,{path:e.path,absolute:e.absolute})}changed(e,t){S(this.opt,"TAR_ENTRY_ERROR",t==="Directory"?"directory changed between lstat and readdir":"file changed between lstat and open",{path:e.path,absolute:e.absolute})}pathEntry(e,t,s,n,r){let{processUid:o,processUname:a=""}=this.opt,c=new se({path:e.path,type:s,mode:t.mode,uid:t.uid,gid:t.gid,uname:t.uid===o?a:"",size:s==="File"?t.size:0,mtime:t.mtime,atime:t.atime,ctime:t.ctime,linkpath:n&&this.win32?J(n):n,dev:t.dev,ino:t.ino,nlink:t.nlink},r);return c.absolute=e.absolute,this.#i(c,!0)}addedEntry(e){if(ws(e))return this.#i(e,!1);let{filter:t}=this.opt;if(!(t&&!t(e.path,e)))return this.#i(new se(e,e.body),!1)}#i(e,t){let{opt:s,win32:n}=this,r=e.type==="Directory";n&&!t&&(e.path=J(e.path),e.linkpath&&(e.linkpath=J(e.linkpath)));let[o,a]=s.preservePaths?["",e.path]:He(e.path);return e.path=a,t&&(n&&(e.path=$t(e.path)),e.path===""&&(e.path="./")),o&&S(s,"TAR_ENTRY_INFO",`stripping ${o} from absolute path`,{entry:e,path:o+e.path}),t&&r&&!e.path.endsWith("/")&&(e.path+="/"),s.portable&&(e.uid=e.gid=e.dev=e.ino=e.nlink=void 0,e.uname=e.gname=void 0,e.atime=e.ctime=void 0),e.mode!==void 0&&(e.mode=Ht(e.mode,r,!!s.portable)),e.mtime=s.noMtime||s.portable&&r?void 0:s.mtime||e.mtime,e}},Yt=async(i,e,t,s,n,r)=>{for(;tn-s)throw Zt(r,n);t+=o,s+=o}return s},qt=(i,e,t,s,n,r,o)=>{for(;sr-n)throw Zt(o,r);s+=a,n+=a}return n};async function*ys(i){if(E(i))yield i;else if(L(i)||Pe(i)){let e=(L(i)?i.stream():i).getReader();try{for(;;){let t=await e.read();if(t.done)break;yield t.value}}finally{await e.cancel().catch(z)}}else i&&(yield*i)}function*gs(i){if(E(i))yield i;else if(i&&Symbol.iterator in i)yield*i;else if(i)throw new TypeError("PackSync needs a body that is a string, a Uint8Array, or an iterable")}var ei=(i,e,t)=>{if(t.length>e)throw ms(i);return e-t.length},ti=(i,e)=>{if(e)throw ft("encountered unexpected EOF",Jt(i));return new Uint8Array(ke(i.size)-i.size)};async function*Vt(i){if(!i.size)return;let e=i.size;for await(let s of ys(i.body))e=ei(i,e,s),yield s;let t=ti(i,e);t.length&&(yield t)}function*Xt(i){if(!i.size)return;let e=i.size;for(let s of gs(i.body))e=ei(i,e,s),yield s;let t=ti(i,e);t.length&&(yield t)}var be=class extends Se{jobs;#e;#t=Promise.resolve();constructor(e={}){super(e,"compress"),this.jobs=q("jobs",this.opt.jobs,4)}async next(){let e=await(this.#e??=this.#i()).next();return e.done?{value:void 0,done:!0}:e}async return(){return this.end(),await this.#e?.return(),{value:void 0,done:!0}}[Symbol.asyncIterator](){return this}#i(){let{codec:e}=this;return e?.compress?this.#s(e.compress(this.codecOptions)):this.#r()}async*#s(e){let t=this.#r(),s,n=$e({next:()=>t.next().catch(r=>{throw s={er:r},n.cancel().catch(z),r})}).pipeThrough(e).getReader();try{for(;;){let r=await n.read();if(s)throw s.er;if(r.done)break;yield r.value}}finally{await n.cancel().catch(z),await t.return()}}async*#r(){try{for(;;){let e=this.head;if(!e){if(this.ended)break;await new Promise(s=>this.wake=s);continue}this.#n();let{item:t}=e;if(t instanceof U)yield*this.#c(t);else if(!Qt(t))yield*this.#p(t);else for await(let s of t)yield*this.#p(s);this.shift()}yield new Uint8Array(1024)}finally{for(let e=this.head;e;e=e.next){let{item:t}=e;if(!(t instanceof U)||!t.ready)break;await(await t.ready.catch(z))?.handle?.close().catch(z)}}}#n(){let e=this.fs,t=this.head;for(let s=0;t&&sr).then(([a,c])=>{let h=this.plan(n,a,c);return h&&{load:this.#o(e,n,a,c,h)}},a=>this.missing(n,a));this.#t=o.catch(z),n.ready=o.then(a=>a?.load),n.ready.catch(z)}}async#a(e,t){let{follow:s}=this.opt,n=await(s?e.stat(t):e.lstat(t)),r=this.needsExact(n)?await(s?e.stat(t,We):e.lstat(t,We)):n;return[n,r]}async#o(e,t,s,n,r){let{absolute:o}=t,{follow:a,noDirRecurse:c}=this.opt,h={stat:s,id:n,type:r};if(r==="SymbolicLink")h.linkpath=await e.readlink(o);else if(r==="Directory"&&!c)h.names=await e.readdir(o),h.changed=!a&&!je(s,await e.lstat(o));else if(r==="File"&&s.size){let l=await e.open(o,"r");try{let{size:d}=s,p=ke(d);!a&&!je(s,await l.stat())?h.changed=!0:p>this.maxReadSize?h.handle=l:(h.buf=new Uint8Array(512+p),await Yt(l,h.buf,512,0,d,o))}catch(d){throw await l.close().catch(z),d}h.handle||await l.close()}return h}async*#c(e){let t=await e.ready;if(!t)return;let{stat:s,id:n,type:r,names:o,buf:a,handle:c}=t;if(t.changed)return this.changed(e,r);let h=!1;try{let l=a?a.subarray(512,512+s.size):c&&this.#h(c,s.size,e.absolute),d=this.pathEntry(e,s,r,t.linkpath??e.linkpath,l);if(o)for(let f of this.children(e,o,n))this.push(f);await this.opt.onWriteEntry?.(d);let p=a&&d.body===l&&d.size===s.size;yield*d.encode(this.header,p?a:void 0),p||(yield*Vt(d)),h=!0}finally{if(c){t.handle=void 0;let l=c.close();await(h?l:l.catch(z))}}}async*#h(e,t,s){let n=ke(t);for(let r=0;rthis.maxReadSize?p=this.#r(s,f,g,n):(d=new Uint8Array(512+bt),qt(s,f,d,512,0,g,n),p=d.subarray(512,512+g))}let u=this.pathEntry(e,a,h,l,p);this.opt.onWriteEntry?.(u);let m=d&&u.body===p&&u.size===a.size;yield*u.encode(this.header,m?d:void 0),m||(yield*Xt(u)),w=!0}finally{if(f!==void 0&&!w)try{s.closeSync(f)}catch{}}f!==void 0&&s.closeSync(f)}*#r(e,t,s,n){let r=ke(s);for(let o=0;o{},ut=(i,e)=>{if(!e?.length)throw new TypeError("no paths specified to add to archive");if(i.file&&!i.fs)throw new TypeError("the file option needs the fs option")},ii=async(i,e,t,s)=>{for(let n=0;n{let s=new Uint8Array(Ge),n=0,r=async()=>{await ii(i,s,n,t),t+=n,n=0};for await(let o of e)(n+o.length>Ge||o.length>=Ee)&&await r(),o.length>=Ee?(await ii(i,o,o.length,t),t+=o.length):(s.set(o,n),n+=o.length);await r()},wt=(i,e,t,s)=>{let n=new Uint8Array(Ge),r=0,o=(a,c)=>{for(let h=0;hGe||a.length>=Ee)&&(o(n,r),r=0),a.length>=Ee?o(a,a.length):(n.set(a,r),r+=a.length);o(n,r)},ks=async(i,e,t,s)=>{let n=await e.open(t,"w",s),r=!1;try{await mt(n,i,0),r=!0}finally{let o=n.close();await(r?o:o.catch(xs))}},Ye=(i,e)=>{let{fs:t,strict:s,onwarn:n,codecs:r,platform:o}=i,a=new be(i);for(let c of e)if(typeof c!="string"||c.charAt(0)!=="@")a.add(c);else{let h=a.resolve(c.slice(1));a.add(new b(B(t,h,i.maxReadSize),{strict:s,onwarn:n,codecs:r,platform:o,file:h}))}return a.end()},yt=(i,e)=>{let{strict:t,onwarn:s,codecs:n,platform:r}=i,o=new ve(i);for(let a of e)if(typeof a!="string"||a.charAt(0)!=="@")o.add(a);else{let c=o.resolve(a.slice(1));o.add(new v(H(i.fs,c,i.maxReadSize),{strict:t,onwarn:s,codecs:n,platform:r,file:c}))}return o};function ne(i,e){let t=y(i);if(!t.file)return ut(t,e),$e(Ye(t,e));try{return ut(t,e),ks(Ye(t,e),t.fs,t.file,t.mode||438)}catch(s){return Promise.reject(s)}}function qe(i,e){let t=y(i);ut(t,e);let{file:s}=t,n=t.fs,r=yt(t,e);if(!s)return r;let o=n.openSync(s,"w",t.mode||438);try{wt(n,o,r,0)}catch(a){try{n.closeSync(o)}catch{}throw a}n.closeSync(o)}var Q=(i,e)=>{let t=new Set(i.map(o=>Z(o))),s=new Set(t),n=0;for(let o of t)n=Math.max(n,o.length);let r=o=>{let a=Z(o),c=a.charAt(0)==="/"?"/":".",h=!1;for(let l=a.length;l>0;l=a.lastIndexOf("/",l-1)){if(l>n)continue;let d=a.slice(0,l);if(!(d===c||!t.has(d))&&(h=!0,s.delete(d),!s.size))break}return h};return[(o,a)=>{let c=!e||e(o,a);return r(o)&&c},o=>{for(let a of s)S(o,"TAR_ENTRY_ERROR",`${a}: not found in archive`,{path:a})}]},si=()=>new TypeError("list needs input, or file and fs"),Ve=async(i,e)=>{let t=y(i),{input:s,file:n,fs:r,onEntry:o}=t,a=s??(n&&r?B(r,n,t.maxReadSize):void 0);if(!a)throw si();let[c,h]=e?.length?Q(e,t.filter):[];c&&(t.filter=c);let l=new b(a,t);try{for(;;){let d=l.poll();if(d===null)break;d===void 0?await l.fill():o&&await o(d)}}finally{await l.return()}h?.(t)},ni=(i,e)=>{let t=y(i),{input:s,file:n,fs:r,onEntry:o}=t,a=s??(n&&r?H(r,n,t.maxReadSize):void 0);if(!a)throw si();let[c,h]=e?.length?Q(e,t.filter):[];c&&(t.filter=c);let l=new v(a,t);for(let d of l)o?.(d);h?.(t)};var Ss=()=>{},ri=(i,e)=>{if(!i.file)throw new TypeError("file is required");if(!i.fs)throw new TypeError("the file option needs the fs option");let t=[...i.codecs??[],T];if(e?.length)return[t,...Q(e,i.filter)];if(i.filter)return[t,i.filter];throw new TypeError("no paths specified to delete")},oi=i=>`${i}.${Math.random().toString(36).slice(2)}.tmp`,gt=async(i,e)=>{let t=y(i),[s,n,r]=ri(t,e),{fs:o,file:a,filter:c,maxReadSize:h,...l}=t,d=new Uint8Array(ye(s)),p=0,f=await o.open(a,"r");try{for(let m=1;m>0&&p!n(m,g)},[new b(B(o,a,h),{...l,file:a})]),r?.(t),await o.rename(u,a)}catch(m){throw await o.unlink(u).catch(Ss),m}},ai=(i,e)=>{let t=y(i),[s,n,r]=ri(t,e),{fs:o,file:a,filter:c,maxReadSize:h,...l}=t,d=new Uint8Array(ye(s)),p=0,f=o.openSync(a,"r");try{for(let m=1;m>0&&p!n(m,g)},[new v(H(o,a,h),{...l,file:a})]),r?.(t),o.renameSync(u,a)}catch(m){try{o.unlinkSync(u)}catch{}throw m}};var re=class extends Error{path;code;syscall="chdir";constructor(e,t){super(`${t}: Cannot cd into '${e}'`),this.path=e,this.code=t}get name(){return"CwdError"}};var W=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(e,t){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=e,this.path=t}get name(){return"SymlinkError"}};var ci=i=>{let e=i.mode|448,{uid:t,gid:s}=i;return{mode:e,needChmod:(e&i.umask)!==0,owner:typeof t=="number"&&typeof s=="number"&&(t!==i.processUid||s!==i.processGid)?{uid:t,gid:s}:void 0}},hi=(i,e)=>i.endsWith("/")?i+e:i+"/"+e,li=(i,e)=>{let t=i.replaceAll("\\","/"),s=[e];for(let n=e.length;!t.endsWith(e.slice(0,n));){if(n=e.lastIndexOf("/",n-1),n<=0)return[e];s.push(e.slice(0,n))}return s},di=async(i,e,t)=>{let{mode:s,needChmod:n,owner:r}=ci(t),{cwd:o}=t,a=[];if(e===o){let c="ENOTDIR";if(!await i.stat(e).then(l=>l.isDirectory(),l=>(c=l?.code||c,!1)))throw new re(e,c)}else if(t.preserve){let c=await i.mkdir(e,{mode:s,recursive:!0});c&&(a=li(c,e))}else{let c=D(o,e).split("/"),h=o;for(let l=0;l{let{mode:s,needChmod:n,owner:r}=ci(t),{cwd:o}=t,a=[];if(e===o){let c="ENOTDIR",h=!1;try{h=i.statSync(e).isDirectory()}catch(l){c=l?.code||c}if(!h)throw new re(e,c)}else if(t.preserve){let c=i.mkdirSync(e,{mode:s,recursive:!0});c&&(a=li(c,e))}else{let c=D(o,e).split("/"),h=o;for(let l=0;l{if(i.length>bs)return i.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en");oe.has(i)?oe.delete(i):xt[i]=i.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"),oe.add(i);let e=xt[i],t=oe.size-fi;if(t>fi/10){for(let s of oe)if(oe.delete(s),delete xt[s],--t<=0)break}return e};var Re=class{#e={queue:[],name:""};#t=new Map;#i=new Set;#s;constructor(e=!1){this.#s=e}reserve(e,t){return new Promise((s,n)=>{let r=()=>{t().then(()=>{this.#a(r),s()},o=>{this.#a(r),n(o)})};this.#r(e,r)})}#r(e,t){let s=this.#e,n=new Set,r=new Set;for(let o of this.#s?["win32 parallelization disabled"]:e){let a=this.#s?o:Z(j(ui(o))),c=s;for(let h of a.split("/")){c!==s&&r.add(c);let l=c.kids??=new Map,d=l.get(h);d||l.set(h,d={queue:[],name:h,up:c}),c=d}n.add(c)}for(let o of n)r.delete(o);this.#t.set(t,{dirs:r,paths:n});for(let o of n)o.queue.push(t);for(let{queue:o}of r){let a=o[o.length-1];a instanceof Set?a.add(t):o.push(new Set([t]))}this.#n(t)}#n(e){let{paths:t,dirs:s}=this.#t.get(e);for(let n of t)if(n.queue[0]!==e)return;for(let{queue:n}of s){let r=n[0];if(!(r instanceof Set)||!r.has(e))return}this.#i.add(e),e()}#a(e){let{paths:t,dirs:s}=this.#t.get(e),n=new Set;for(let{queue:r}of t){r.shift();let o=r[0];if(typeof o=="function")n.add(o);else if(o)for(let a of o)n.add(a)}for(let{queue:r}of s){let o=r[0];o.size>1?o.delete(e):(r.shift(),r.length&&n.add(r[0]))}for(let r of t)for(;r.up&&!r.queue.length&&!r.kids?.size;)r.up.kids?.delete(r.name),r=r.up;this.#i.delete(e),this.#t.delete(e);for(let r of n)this.#n(r)}};var mi=(i,e)=>{if(!i)return()=>"w";let{O_CREAT:t,O_TRUNC:s,O_WRONLY:n,O_NOFOLLOW:r,UV_FS_O_FILEMAP:o}=i,a=s|t|n;if(!e){let h=typeof r=="number"?r|a:"w";return()=>h}if(!o)return()=>"w";let c=o|a;return h=>h<524288?c:"w"};var vs=1024,wi=32768,Es=16,Xe=new Set(["File","OldFile","ContiguousFile"]),ae=new Set(["Directory","GNUDumpDir"]),Rs=new Set(["Link","SymbolicLink"]),yi=(i,e,t)=>i!==void 0?i:e!==void 0&&e===e>>>0?e:t,Ae=class{opt;cwd;win32;strip;maxDepth;preservePaths;unlink;keep;newer;noMtime;chmod;uid;gid;preserveOwner;forceChown;processUid;processGid;processUmask;umask;dmode;fmode;writeFlag;resolve;dirname;fatal;constructor(e){let t=this.opt=k(e),s=this.win32=t.platform==="win32";if(this.resolve=s?Be:C,this.dirname=s?jt:P,typeof t.cwd!="string")throw new TypeError("cwd is required");let n=s?t.cwd.replaceAll("\\","/"):t.cwd;if(!(s?xe:ie)(n))throw new TypeError("cwd must be an absolute path");if(this.cwd=this.resolve(n,""),typeof t.uid=="number"||typeof t.gid=="number"){if(typeof t.uid!="number"||typeof t.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(t.uid!==t.uid>>>0||t.gid!==t.gid>>>0)throw new TypeError("uid and gid must be unsigned 32-bit integers");if(t.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=t.uid,this.gid=t.gid}this.processUid=t.processUid,this.processGid=t.processGid,this.preserveOwner=t.preserveOwner===void 0&&typeof t.uid!="number"?t.processUid===0:!!t.preserveOwner,this.forceChown=t.forceChown===!0,this.maxDepth=typeof t.maxDepth=="number"?t.maxDepth:vs,this.strip=Number(t.strip)||0,this.preservePaths=!!t.preservePaths,this.unlink=!!t.unlink,this.keep=!!t.keep,this.newer=!!t.newer,this.noMtime=!!t.noMtime,this.chmod=!!t.chmod,this.processUmask=this.chmod?typeof t.processUmask=="number"?t.processUmask:18:0,this.umask=typeof t.umask=="number"?t.umask:this.processUmask,this.dmode=t.dmode||511&~this.umask,this.fmode=t.fmode||438&~this.umask,this.writeFlag=mi(t.fs.constants,s)}warn(e,t,s={}){(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(s.recoverable=!1),s.cwd=this.cwd,S(this.opt,e,t,s)}readerOptions(){return k(this.opt,{strict:!1,onwarn:(e,t,s)=>this.warn(e,t,s)})}entryError(e,t){if(this.fatal?.error===e||e?.name==="CwdError")throw e;this.warn("TAR_ENTRY_ERROR",e,{entry:t})}fail(e){return this.fatal??={error:e},e}#e(e,t){let s=e[t];if(!s||this.preservePaths)return!0;let[n,r]=He(s),o=r.replaceAll("\\","/").split("/");if(o.includes("..")){if(t==="path"||e.type==="Link")return this.warn("TAR_ENTRY_ERROR",`${t} contains '..'`,{entry:e,[t]:s}),!1;let a=o.findIndex(l=>l!==".."&&l!=="."&&l!=="");if(a!==-1&&o.includes("..",a))return this.warn("TAR_ENTRY_ERROR",`${t} contains '..' after a path portion`,{entry:e,[t]:s}),!1;let c=P(he(e.path)),h=he(j(c,o.join("/")));if(h.startsWith("../")||h==="..")return this.warn("TAR_ENTRY_ERROR",`${t} escapes extraction directory`,{entry:e,[t]:s}),!1}return n&&(e[t]=r,this.warn("TAR_ENTRY_INFO",`stripping ${n} from absolute ${t}`,{entry:e,[t]:s})),!0}check(e){let t=e.path,s=t.split("/");if(this.strip){if(s.lengthc===""))return!1;e.path=s.join("/")}let{maxDepth:n}=this;if(isFinite(n)&&s.length>n)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:e,path:t,depth:s.length,maxDepth:n}),!1;let{linkpath:r}=e;if(r&&isFinite(n)&&r.split("/").length>n)return this.warn("TAR_ENTRY_ERROR","linkpath excessively deep",{entry:e,path:t,linkpath:r,maxDepth:n}),!1;for(let c of["path","linkpath"]){let{length:h}=e[c]??"";if(h>wi)return this.warn("TAR_ENTRY_ERROR",`${c} excessively long`,{entry:e,path:t,length:h,maxLength:wi}),!1}if(!this.#e(e,"path")||!this.#e(e,"linkpath"))return!1;let{cwd:o}=this,a=this.resolve(o,e.path);if(!this.preservePaths&&a!==o&&!a.startsWith(o.endsWith("/")?o:o+"/"))return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:e,path:e.path,resolvedPath:a,cwd:o}),!1;if(a===o&&!ae.has(e.type))return!1;if(this.win32){let c=$(a);a=c+dt(a.slice(c.length));let h=$(e.path);e.path=h+dt(e.path.slice(h.length))}if(e.absolute=a,typeof e.mode=="number"&&(e.mode&=511),ae.has(e.type))e.mode&&(e.mode|=448);else if(!Xe.has(e.type)&&!Rs.has(e.type))return e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),!1;return!0}reservedPaths(e){let{path:t,linkpath:s}=e;return s?[t,e.type==="SymbolicLink"&&!ie(s)?j(P(t),s):s]:[t]}mkdirOptions(e){return{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:e}}owner(e){let t=this.forceChown||this.preserveOwner&&(typeof e.uid=="number"&&e.uid!==this.processUid||typeof e.gid=="number"&&e.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid,s=yi(this.uid,e.uid,this.processUid),n=yi(this.gid,e.gid,this.processGid);return t&&typeof s=="number"&&typeof n=="number"?{uid:s,gid:n}:void 0}times(e){return e.mtime&&!this.noMtime?{atime:e.atime||new Date,mtime:e.mtime}:void 0}skip(e,t){return this.keep||this.newer&&t.mtime>(e.mtime??t.mtime)}isReusable(e,t){return e.type==="File"&&!this.unlink&&t.isFile()&&t.nlink<=1&&!this.win32}linkParts(e,t){let s=String(e.linkpath);return e.type==="Link"?s.split("/"):D(this.cwd,this.resolve(this.dirname(t),s)).split("/")}parentParts(e){let{cwd:t}=this,s=e===t?t:this.dirname(e);return s===t?[]:D(t,s).split("/")}symlinkError(e,t){return new W(e,this.resolve(this.cwd,t.join("/")))}},gi=i=>i+".DELETE."+Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,"0")).join(""),Te=class extends Ae{#e;#t;#i;#s=0;#r;#n=!1;#a;constructor(e){super(e),this.#e=this.opt.fs,this.#t=new Re(this.win32),this.#i=q("jobs",this.opt.jobs,Es)}async extract(e){let t=new b(e,this.readerOptions()),{onEntry:s}=this.opt,n=!!this.opt.transform;try{for(;!this.fatal;){let r=t.poll();if(r===null)break;if(r===void 0){await t.fill();continue}if(s&&await s(r),r.bodyUsed||!this.check(r))continue;let o=[],a=!n;if(a&&Xe.has(r.type))for(;;){let h=t.readBody(r);if(h===null)break;if(h===void 0){a=!1;break}o.push(h)}let c=this.#c(r,o,a?void 0:t);for(a||await c;this.#s>=this.#i;)await this.#o()}}catch(r){this.fail(r)}for(await t.return().catch(r=>this.fail(r));this.#s>0;)await this.#o();if(this.fatal){let{error:r}=this.fatal;throw r&&typeof r=="object"&&"tarCode"in r&&Object.assign(r,{cwd:this.cwd}),r}}#o(){return new Promise(e=>{this.#r=e})}#c(e,t,s){return this.#s++,this.#t.reserve(this.reservedPaths(e),async()=>{try{this.fatal||await this.#y(e,t,s)}catch(n){try{this.entryError(n,e)}catch(r){this.fail(r)}}this.#s--,this.#r?.()})}#h(e,t){return di(this.#e,e,this.mkdirOptions(t))}#p(){return this.#a??=this.#h(this.cwd,this.dmode).then(()=>{this.#n=!0},e=>{throw this.#a=void 0,e})}async#y(e,t,s){let n=this.#e,r=e.absolute,{cwd:o}=this;if(this.#n||await this.#p(),r!==o){let c=this.dirname(r);c!==o&&await this.#h(c,this.dmode)}let a=await n.lstat(r).catch(()=>{});if(!(a&&this.skip(e,a))){if(a&&!this.isReusable(e,a)&&(a.isDirectory()&&ae.has(e.type)?this.chmod&&e.mode&&(a.mode&4095)!==e.mode&&await n.chmod(r,e.mode):r!==o&&(a.isDirectory()?await n.rmdir(r):await this.#x(r))),Xe.has(e.type))return this.#u(e,r,t,s);if(ae.has(e.type))await this.#l(e,r);else{await this.#f(this.linkParts(e,r));let c=String(e.linkpath);e.type==="Link"?await n.link(this.resolve(o,c),r):await n.symlink(c,r)}await this.#f(this.parentParts(r))}}async#x(e){let t=this.#e;if(!this.win32)return t.unlink(e);let s=gi(e);await t.rename(e,s),await t.unlink(s)}async#f(e){if(this.preservePaths)return;let t=this.cwd;for(let s of e){t=this.resolve(t,s);let n=await this.#e.lstat(t).catch(()=>{});if(!n)return;if(n.isSymbolicLink())throw this.symlinkError(t,e)}}async#l(e,t){let s=this.#e;await this.#h(t,e.mode??this.dmode);let n=this.times(e);n&&await s.lutimes(t,n.atime,n.mtime).catch(()=>{});let r=this.owner(e);r&&await s.lchown(t,r.uid,r.gid).catch(()=>{})}async#u(e,t,s,n){let r=this.#e,o=await r.open(t,this.writeFlag(e.size),e.mode??this.fmode);try{if(await this.#f(this.parentParts(t)),n)await this.#w(e,s,n,o);else for(let h of s)await o.write(h);let a=this.times(e);if(a){let{atime:h,mtime:l}=a;await o.utimes(h,l).catch(async d=>{await r.utimes(t,h,l).catch(()=>{throw d})})}let c=this.owner(e);if(c){let{uid:h,gid:l}=c;await o.chown(h,l).catch(async d=>{await r.chown(t,h,l).catch(()=>{throw d})})}}catch(a){throw await o.close().catch(()=>{}),a}await o.close()}async#w(e,t,s,n){let r=0,o=async()=>{if(r{},m=>{w={error:m}})}finally{await f}if(w)throw w.error;return}let c=a.writable.getWriter(),h=a.readable.getReader(),l,d=async f=>{l??={error:f},await h.cancel(f).catch(()=>{}),await c.abort(f).catch(()=>{})},p=(async()=>{try{for(let f;f=await o();)await c.write(f);await c.close()}catch(f){await d(f)}})();try{for(;;){let{done:f,value:w}=await h.read();if(f)break;await n.write(w)}}catch(f){await d(f)}if(await p,l)throw l.error}},ze=class extends Ae{#e;#t=!1;constructor(e){super(e),this.#e=this.opt.fs}extract(e){let t=new v(e,this.readerOptions()),{onEntry:s}=this.opt;try{for(let n of t)if(s?.(n),!n.bodyUsed&&this.check(n))try{this.#s(n,t)}catch(r){this.entryError(r,n)}}catch(n){throw n&&typeof n=="object"&&"tarCode"in n&&Object.assign(n,{cwd:this.cwd}),n}}#i(e,t){pi(this.#e,e,this.mkdirOptions(t))}#s(e,t){let s=this.#e,n=e.absolute,{cwd:r}=this;if(this.#t||(this.#i(r,this.dmode),this.#t=!0),n!==r){let a=this.dirname(n);a!==r&&this.#i(a,this.dmode)}let o;try{o=s.lstatSync(n)}catch{}if(!(o&&this.skip(e,o))){if(o&&!this.isReusable(e,o)&&(o.isDirectory()&&ae.has(e.type)?this.chmod&&e.mode&&(o.mode&4095)!==e.mode&&s.chmodSync(n,e.mode):n!==r&&(o.isDirectory()?s.rmdirSync(n):this.#r(n))),Xe.has(e.type))return this.#o(e,n,t);if(ae.has(e.type))this.#a(e,n);else{this.#n(this.linkParts(e,n));let a=String(e.linkpath);e.type==="Link"?s.linkSync(this.resolve(r,a),n):s.symlinkSync(a,n)}this.#n(this.parentParts(n))}}#r(e){let t=this.#e;if(!this.win32)return t.unlinkSync(e);let s=gi(e);t.renameSync(e,s),t.unlinkSync(s)}#n(e){if(this.preservePaths)return;let t=this.cwd;for(let s of e){t=this.resolve(t,s);let n;try{n=this.#e.lstatSync(t)}catch{return}if(n.isSymbolicLink())throw this.symlinkError(t,e)}}#a(e,t){let s=this.#e;this.#i(t,e.mode??this.dmode);let n=this.times(e);if(n)try{s.lutimesSync(t,n.atime,n.mtime)}catch{}let r=this.owner(e);if(r)try{s.lchownSync(t,r.uid,r.gid)}catch{}}#o(e,t,s){let n=this.#e,r=n.openSync(t,this.writeFlag(e.size),e.mode??this.fmode);try{this.#n(this.parentParts(t));let o=this.opt.transform?.(e);for(;;){let h;try{h=s.readBody(e)}catch(l){throw this.fail(l)}if(!h)break;n.writeSync(r,o?o(h):h)}let a=this.times(e);if(a){let{atime:h,mtime:l}=a;try{n.futimesSync(r,h,l)}catch(d){try{n.utimesSync(t,h,l)}catch{throw d}}}let c=this.owner(e);if(c){let{uid:h,gid:l}=c;try{n.fchownSync(r,h,l)}catch(d){try{n.chownSync(t,h,l)}catch{throw d}}}}catch(o){try{n.closeSync(r)}catch{}throw o}n.closeSync(r)}};var xi=()=>new TypeError("extract needs input or file"),Ke=async(i,e)=>{let t=y(i),s=t.input??(t.file?B(t.fs,t.file,t.maxReadSize):void 0);if(!s)throw xi();let[n,r]=e?.length?Q(e,t.filter):[];n&&(t.filter=n),await new Te(t).extract(s),r?.(t)},ki=(i,e)=>{let t=y(i),s=t.input??(t.file?H(t.fs,t.file,t.maxReadSize):void 0);if(!s)throw xi();let[n,r]=e?.length?Q(e,t.filter):[];n&&(t.filter=n),new ze(t).extract(s),r?.(t)};var Si=(/* unused pure expression or super */ null && (64*1024)),bi={},As=()=>{},Ze=()=>new Error("cannot append to compressed archives"),vi=(i,e)=>{let{file:t}=i;if(!t)throw new TypeError("file is required");if(i.gzip||i.brotli||i.zstd||t.endsWith(".br")||t.endsWith(".tbr"))throw new TypeError(Ze().message);if(!e?.length)throw new TypeError("no paths specified to add/replace")},Oe=class{buf=new Uint8Array(Si);pos=0;#e;#t;#i;#s;constructor(e,t=[],s){this.#e=e,this.#i=[...t,T],this.#s=s,this.#t=new I({filter:()=>!1,onwarn:()=>{throw bi}})}get position(){return this.#t.position}get want(){return Math.min(Si,this.#e-this.pos)}push(e){let t=this.buf.subarray(0,e);if(this.pos===0&&this.#i.some(r=>r.detect(t)))throw Ze();let s=this.#t;this.pos+=e;let n=0;s.push(t);try{for(let r;r=s.next();){if(r.type!=="entry")return!1;let{entry:o}=r;if(n=s.offset+512*Math.ceil(o.size/512),n>this.#e)return!1;o.mtime&&this.#s?.set(o.path,o.mtime)}this.pos0&&this.pos{let t=y(i);vi(t,e);let{fs:s,file:n}=t,r=Ye(t,e);if(r.codec)throw new TypeError(Ze().message);let o=await s.open(n,"r+").catch(c=>{if(c?.code!=="ENOENT")throw c;return s.open(n,"w+",t.mode||438)}),a=!1;try{let{size:c}=await o.stat(),h=new Oe(c,t.codecs,t.mtimeCache);for(;h.push((await o.read(h.buf,0,h.want,h.pos)).bytesRead););await mt(o,r,h.position),a=!0}finally{let c=o.close();await(a?c:c.catch(As))}},Je=(i,e)=>{let t=y(i);vi(t,e);let{fs:s,file:n}=t,r=yt(t,e);if(r.codec)throw new TypeError(Ze().message);let o;try{o=s.openSync(n,"r+")}catch(a){if(a?.code!=="ENOENT")throw a;o=s.openSync(n,"w+",t.mode||438)}try{let{size:a}=s.fstatSync(o),c=new Oe(a,t.codecs,t.mtimeCache);for(;c.push(s.readSync(o,c.buf,0,c.want,c.pos)););wt(s,o,r,c.position)}catch(a){try{s.closeSync(o)}catch{}throw a}s.closeSync(o)};var Ts=(i,e)=>{let t=e.getTime(),s=i.getTime();return(t%1e3===0?s-s%1e3:s)>t},Ei=i=>{let{filter:e}=i,t=i.mtimeCache??new Map;return{...i,mtimeCache:t,filter:(s,n)=>{if(e&&!e(s,n))return!1;if("isDirectory"in n&&n.isDirectory())return!0;let r=t.get(s);return!r||!n.mtime||Ts(n.mtime,r)}}},Qe=(i,e)=>ce(Ei(i),e),Ri=(i,e)=>Je(Ei(i),e);var et=64*1024,tt=(i,e=!1,t)=>{let s,n,r=!1,o=!1,a,c,h=e?new Uint8Array(et):void 0,l=0,d=u=>new Promise(m=>{a=m,i.write(u,()=>m())}),p=async u=>{l&&await d(u.subarray(0,l)),l=0},f=()=>{o=!0,a?.(),c?.()},w=()=>{f(),i.destroy()};return i.pause(),i.on("data",u=>{t?.(u),t=void 0,r=!1,i.pause(),s.enqueue(u)}),i.on("end",()=>{o||s.close()}),i.on("error",u=>{s.error(u),n.error(u),f()}),i.on("close",f),{readable:new ReadableStream({start:u=>{s=u},pull:()=>{r=!0,c?.(),i.resume()},cancel:u=>{n.error(u),w()}},{highWaterMark:0}),writable:new WritableStream({start:u=>{n=u;let{signal:m}=u;m.addEventListener("abort",()=>{s.error(m.reason),w()})},write:async u=>{h?(l+u.length>et&&await p(h),u.length>et?await d(u):(h.set(u,l),l+=u.length)):await d(u),!r&&!o&&await new Promise(m=>c=m)},close:async()=>{h&&await p(h),await new Promise(u=>{a=u,i.end()})}})}},Fs=i=>i>=external_node_buffer_namespaceObject.constants.MAX_LENGTH?{}:{maxOutputLength:Math.max(1,Math.floor(i))},kt=(i,e,t,s,n)=>({...i,decompress:()=>tt(t({chunkSize:et})),compress:r=>tt(e(r),!0),decompressSync:(r,{maxOutputLength:o})=>{try{return n(r,Fs(o))}catch(a){throw a?.code!=="ERR_BUFFER_TOO_LARGE"?a:new Error(`max decompression ratio exceeded: the output is larger than ${o} bytes`)}},compressSync:s}),Ai=i=>{i[9]=255},St=(i=external_node_zlib_namespaceObject_0)=>{let{createBrotliCompress:e,createBrotliDecompress:t,brotliCompressSync:s,brotliDecompressSync:n,createZstdCompress:r,createZstdDecompress:o,zstdCompressSync:a,zstdDecompressSync:c}=i,l=[{...kt({name:"gzip",headLength:2,detect:d=>d[0]===31&&d[1]===139},i.createGzip,i.createGunzip,i.gzipSync,i.gunzipSync),compress:({portable:d,...p}={})=>tt(i.createGzip(p),!0,d?Ai:void 0),compressSync:(d,{portable:p,...f}={})=>{let w=i.gzipSync(d,f);return p&&Ai(w),w}}];return e&&t&&s&&n&&l.push(kt({name:"brotli",headLength:0,detect:()=>!1,extensions:[".tar.br",".tbr"]},e,t,s,n)),r&&o&&a&&c&&l.push(kt({name:"zstd",headLength:4,detect:d=>d[0]===40&&d[1]===181&&d[2]===47&&d[3]===253},r,o,a,c)),l};var ee=(/* unused pure expression or super */ null && (Us)),te=external_node_fs_namespaceObject_0,Cs=process.platform==="win32"?"win32":"posix",Ds=St(),x=(i,e,t)=>{let s=y(i);return s.fs??=e,s.platform??=Cs,s.codecs=[...s.codecs??[],...Ds],t&&(s.cwd=(0,external_node_path_namespaceObject.resolve)(s.cwd??""),s.processUid??=process.getuid?.(),s.processGid??=process.getgid?.(),s.processUname??=process.env.USER,s.chmod&&(s.processUmask??=process.umask())),s},vo=(i,e={})=>ht(i,x(e,ee,!1)),Eo=(i,e={})=>Bt(i,x(e,te,!1)),Ro=(i,e)=>Ve(x(i,ee,!1),e),Ao=(i,e)=>ni(x(i,te,!1),e),To=(i,e)=>Ke(x(i,ee,!0),e),zo=(i,e)=>ki(x(i,te,!0),e);function Oo(i,e){return ne(x(i,ee,!0),e)}function Po(i,e){return qe(x(i,te,!0),e)}var Fo=(i,e)=>ce(x(i,ee,!0),e),No=(i,e)=>Je(x(i,te,!0),e),Uo=(i,e)=>Qe(x(i,ee,!0),e),Lo=(i,e)=>Ri(x(i,te,!0),e),Co=(i,e)=>gt(x(i,ee,!1),e),Do=(i,e)=>ai(x(i,te,!1),e);
//# sourceMappingURL=index.min.js.map
// EXTERNAL MODULE: ./node_modules/yaml/dist/index.js
@@ -8732,11 +8716,10 @@ const checksum = (bytes) => (0,external_node_crypto_namespaceObject.createHash)(
function extractChart(archive, destination) {
const roots = new Set();
const files = new Set();
- Ct({
+ Ao({
file: archive,
- sync: true,
strict: true,
- onReadEntry(entry) {
+ onEntry(entry) {
const name = entry.path.replace(/\/$/, "");
const parts = name.split("/");
if (
@@ -8757,11 +8740,10 @@ function extractChart(archive, destination) {
throw new Error("Expected one root chart containing Chart.yaml.");
}
external_node_fs_namespaceObject.mkdirSync(destination);
- So({
+ zo({
file: archive,
cwd: destination,
strip: 1,
- sync: true,
strict: true,
});
}
diff --git a/actions/helm/lint-chart/package-lock.json b/actions/helm/lint-chart/package-lock.json
index 086732a2..f52cb49d 100644
--- a/actions/helm/lint-chart/package-lock.json
+++ b/actions/helm/lint-chart/package-lock.json
@@ -6,7 +6,7 @@
"": {
"name": "lint-chart",
"dependencies": {
- "tar": "^7.5.23",
+ "tar": "^8.0.5",
"yaml": "^2.9.1"
},
"devDependencies": {
@@ -16,18 +16,6 @@
"node": ">=24.0.0"
}
},
- "node_modules/@isaacs/fs-minipass": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz",
- "integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==",
- "license": "ISC",
- "dependencies": {
- "minipass": "^7.0.4"
- },
- "engines": {
- "node": ">=18.0.0"
- }
- },
"node_modules/@vercel/ncc": {
"version": "0.45.0",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.45.0.tgz",
@@ -38,59 +26,13 @@
"ncc": "dist/ncc/cli.js"
}
},
- "node_modules/chownr": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz",
- "integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==",
- "license": "BlueOak-1.0.0",
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/minipass": {
- "version": "7.1.3",
- "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz",
- "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==",
- "license": "BlueOak-1.0.0",
- "engines": {
- "node": ">=16 || 14 >=14.17"
- }
- },
- "node_modules/minizlib": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.1.0.tgz",
- "integrity": "sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==",
- "license": "MIT",
- "dependencies": {
- "minipass": "^7.1.2"
- },
- "engines": {
- "node": ">= 18"
- }
- },
"node_modules/tar": {
- "version": "7.5.23",
- "resolved": "https://registry.npmjs.org/tar/-/tar-7.5.23.tgz",
- "integrity": "sha512-lkukzdoGngZHJZXxW4S/E4Fp9ghTDlyZXrQGRNoJ/LXvDKcXUTq2sg5yQe74po7Voea6n/IN09+wE/QvJMiifA==",
- "license": "BlueOak-1.0.0",
- "dependencies": {
- "@isaacs/fs-minipass": "^4.0.0",
- "chownr": "^3.0.0",
- "minipass": "^7.1.2",
- "minizlib": "^3.1.0",
- "yallist": "^5.0.0"
- },
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/yallist": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz",
- "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==",
+ "version": "8.0.5",
+ "resolved": "https://registry.npmjs.org/tar/-/tar-8.0.5.tgz",
+ "integrity": "sha512-iYroSHv/iVs5Bfy7uXCZVTye64oecqEETP3jvxksDcJlf8E3hreHYyhT+Qu7b+JgniditLaQbk4ZujNAnPEX9w==",
"license": "BlueOak-1.0.0",
"engines": {
- "node": ">=18"
+ "node": ">=22"
}
},
"node_modules/yaml": {
diff --git a/actions/helm/lint-chart/package.json b/actions/helm/lint-chart/package.json
index 0a2c9111..e482973c 100644
--- a/actions/helm/lint-chart/package.json
+++ b/actions/helm/lint-chart/package.json
@@ -1,7 +1,7 @@
{
"name": "lint-chart",
"dependencies": {
- "tar": "^7.5.23",
+ "tar": "^8.0.5",
"yaml": "^2.9.1"
},
"devDependencies": {
@@ -9,12 +9,8 @@
},
"scripts": {
"build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && ncc build src/index.js --out dist --target es2022 --no-cache --license licenses.txt",
- "check:dist": "npm run build && git diff --exit-code -- dist && test -z \"$(git ls-files --others --exclude-standard -- dist)\"",
"test": "node --test",
- "test:ci": "node --experimental-test-coverage --test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=coverage/junit.xml --test-reporter=lcov --test-reporter-destination=coverage/lcov.info --test",
- "test:distribution": "node --test src/index.test.js",
- "test:watch": "node --test --watch",
- "pretest:ci": "node -e \"require('node:fs').mkdirSync('coverage', { recursive: true })\""
+ "test:watch": "node --test --watch"
},
"private": true,
"engines": {
diff --git a/actions/helm/lint-chart/src/index.js b/actions/helm/lint-chart/src/index.js
index 6777ef1b..9f702431 100644
--- a/actions/helm/lint-chart/src/index.js
+++ b/actions/helm/lint-chart/src/index.js
@@ -1,7 +1,7 @@
import { createHash } from "node:crypto";
import fs from "node:fs";
import path from "node:path";
-import { extract, list } from "tar";
+import { extractSync, listSync } from "tar";
import yaml from "yaml";
const checksum = (bytes) => createHash("sha256").update(bytes).digest("hex");
@@ -9,11 +9,10 @@ const checksum = (bytes) => createHash("sha256").update(bytes).digest("hex");
function extractChart(archive, destination) {
const roots = new Set();
const files = new Set();
- list({
+ listSync({
file: archive,
- sync: true,
strict: true,
- onReadEntry(entry) {
+ onEntry(entry) {
const name = entry.path.replace(/\/$/, "");
const parts = name.split("/");
if (
@@ -34,11 +33,10 @@ function extractChart(archive, destination) {
throw new Error("Expected one root chart containing Chart.yaml.");
}
fs.mkdirSync(destination);
- extract({
+ extractSync({
file: archive,
cwd: destination,
strip: 1,
- sync: true,
strict: true,
});
}
diff --git a/actions/helm/lint-chart/src/index.test.js b/actions/helm/lint-chart/src/index.test.js
index 89e1506a..f572b56a 100644
--- a/actions/helm/lint-chart/src/index.test.js
+++ b/actions/helm/lint-chart/src/index.test.js
@@ -5,7 +5,7 @@ import os from "node:os";
import path from "node:path";
import { test } from "node:test";
import { pathToFileURL } from "node:url";
-import { create } from "tar";
+import { createSync } from "tar";
const { lintChart } = await import(
process.env.ACTION_ENTRYPOINT
@@ -29,12 +29,11 @@ function fixture(t) {
fs.writeFileSync(path.join(chart, "values.yaml"), "replicaCount: 1\n");
const archive = path.join(directory, "prepared chart.tgz");
const pack = (files = ["source"]) => {
- create(
+ createSync(
{
file: archive,
cwd: directory,
gzip: true,
- sync: true,
preservePaths: true,
},
files,
@@ -165,12 +164,11 @@ test("rejects unsafe entries and ambiguous chart roots before extraction", async
);
fs.unlinkSync(path.join(f.chart, "link"));
fs.writeFileSync(path.join(f.directory, "unexpected.txt"), "caller-owned\n");
- create(
+ createSync(
{
file: f.archive,
cwd: f.chart,
gzip: true,
- sync: true,
preservePaths: true,
},
["../unexpected.txt"],
diff --git a/actions/helm/prepare-chart/package.json b/actions/helm/prepare-chart/package.json
index 048b8c24..f24dea49 100644
--- a/actions/helm/prepare-chart/package.json
+++ b/actions/helm/prepare-chart/package.json
@@ -8,12 +8,8 @@
},
"scripts": {
"build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && ncc build src/index.js --out dist --target es2022 --no-cache --license licenses.txt",
- "check:dist": "npm run build && git diff --exit-code -- dist && test -z \"$(git ls-files --others --exclude-standard -- dist)\"",
"test": "node --test",
- "test:ci": "node --experimental-test-coverage --test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=coverage/junit.xml --test-reporter=lcov --test-reporter-destination=coverage/lcov.info --test",
- "test:distribution": "node --test src/index.test.js",
- "test:watch": "node --test --watch",
- "pretest:ci": "node -e \"require('node:fs').mkdirSync('coverage', { recursive: true })\""
+ "test:watch": "node --test --watch"
},
"private": true,
"engines": {
diff --git a/actions/helm/prepare-release/action.yml b/actions/helm/prepare-release/action.yml
index 20d4f89c..f9f7aa5e 100644
--- a/actions/helm/prepare-release/action.yml
+++ b/actions/helm/prepare-release/action.yml
@@ -34,7 +34,7 @@ outputs:
runs:
using: composite
steps:
- - uses: hoverkraft-tech/ci-github-common/actions/checkout@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1
+ - uses: hoverkraft-tech/ci-github-common/actions/checkout@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0
with:
fetch-depth: "0"
diff --git a/actions/helm/prepare-release/package.json b/actions/helm/prepare-release/package.json
index be212865..c034ad3a 100644
--- a/actions/helm/prepare-release/package.json
+++ b/actions/helm/prepare-release/package.json
@@ -8,12 +8,8 @@
},
"scripts": {
"build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && ncc build src/index.js --out dist --target es2022 --no-cache --license licenses.txt",
- "check:dist": "npm run build && git diff --exit-code -- dist && test -z \"$(git ls-files --others --exclude-standard -- dist)\"",
"test": "node --test",
- "test:ci": "node --experimental-test-coverage --test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=coverage/junit.xml --test-reporter=lcov --test-reporter-destination=coverage/lcov.info --test",
- "test:distribution": "node --test src/index.test.js",
- "test:watch": "node --test --watch",
- "pretest:ci": "node -e \"require('node:fs').mkdirSync('coverage', { recursive: true })\""
+ "test:watch": "node --test --watch"
},
"private": true,
"engines": {
diff --git a/actions/helm/release-chart/package.json b/actions/helm/release-chart/package.json
index d9b65056..6856a35b 100644
--- a/actions/helm/release-chart/package.json
+++ b/actions/helm/release-chart/package.json
@@ -5,9 +5,7 @@
},
"scripts": {
"test": "node --test",
- "test:ci": "node --experimental-test-coverage --test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=coverage/junit.xml --test-reporter=lcov --test-reporter-destination=coverage/lcov.info --test",
- "test:watch": "node --test --watch",
- "pretest:ci": "node -e \"require('node:fs').mkdirSync('coverage', { recursive: true })\""
+ "test:watch": "node --test --watch"
},
"private": true,
"engines": {
diff --git a/actions/helm/test-chart/dist/index.js b/actions/helm/test-chart/dist/index.js
index 030844ce..fc7f2dd2 100644
--- a/actions/helm/test-chart/dist/index.js
+++ b/actions/helm/test-chart/dist/index.js
@@ -8688,35 +8688,19 @@ __nccwpck_require__.d(__webpack_exports__, {
const external_node_crypto_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:crypto");
;// CONCATENATED MODULE: external "node:fs"
const external_node_fs_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs");
+var external_node_fs_namespaceObject_0 = /*#__PURE__*/__nccwpck_require__.t(external_node_fs_namespaceObject, 2);
;// CONCATENATED MODULE: external "node:path"
const external_node_path_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:path");
-;// CONCATENATED MODULE: external "events"
-const external_events_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("events");
-;// CONCATENATED MODULE: external "fs"
-const external_fs_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("fs");
-;// CONCATENATED MODULE: external "node:events"
-const external_node_events_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:events");
-;// CONCATENATED MODULE: external "node:stream"
-const external_node_stream_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:stream");
-;// CONCATENATED MODULE: external "node:string_decoder"
-const external_node_string_decoder_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:string_decoder");
-;// CONCATENATED MODULE: external "path"
-const external_path_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("path");
-;// CONCATENATED MODULE: external "assert"
-const external_assert_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("assert");
-// EXTERNAL MODULE: external "buffer"
-var external_buffer_ = __nccwpck_require__(181);
-;// CONCATENATED MODULE: external "zlib"
-const external_zlib_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("zlib");
-var external_zlib_namespaceObject_0 = /*#__PURE__*/__nccwpck_require__.t(external_zlib_namespaceObject, 2);
-;// CONCATENATED MODULE: external "node:assert"
-const external_node_assert_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:assert");
;// CONCATENATED MODULE: external "node:fs/promises"
const promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs/promises");
-;// CONCATENATED MODULE: ./node_modules/tar/dist/esm/index.min.js
-var zr=Object.defineProperty;var Ur=(s,t)=>{for(var e in t)zr(s,e,{get:t[e],enumerable:!0})};var Ds=typeof process=="object"&&process?process:{stdout:null,stderr:null},Wr=s=>!!s&&typeof s=="object"&&(s instanceof A||s instanceof external_node_stream_namespaceObject||Gr(s)||Zr(s)),Gr=s=>!!s&&typeof s=="object"&&s instanceof external_node_events_namespaceObject.EventEmitter&&typeof s.pipe=="function"&&s.pipe!==external_node_stream_namespaceObject.Writable.prototype.pipe,Zr=s=>!!s&&typeof s=="object"&&s instanceof external_node_events_namespaceObject.EventEmitter&&typeof s.write=="function"&&typeof s.end=="function",Q=Symbol("EOF"),J=Symbol("maybeEmitEnd"),nt=Symbol("emittedEnd"),De=Symbol("emittingEnd"),qt=Symbol("emittedError"),Ne=Symbol("closed"),Ns=Symbol("read"),Ae=Symbol("flush"),As=Symbol("flushChunk"),z=Symbol("encoding"),Mt=Symbol("decoder"),g=Symbol("flowing"),Qt=Symbol("paused"),Bt=Symbol("resume"),b=Symbol("buffer"),N=Symbol("pipes"),_=Symbol("bufferLength"),bi=Symbol("bufferPush"),Ie=Symbol("bufferShift"),L=Symbol("objectMode"),S=Symbol("destroyed"),_i=Symbol("error"),Oi=Symbol("emitData"),Is=Symbol("emitEnd"),Ti=Symbol("emitEnd2"),Z=Symbol("async"),xi=Symbol("abort"),Ce=Symbol("aborted"),Jt=Symbol("signal"),Rt=Symbol("dataListeners"),C=Symbol("discarded"),jt=s=>Promise.resolve().then(s),Yr=s=>s(),Kr=s=>s==="end"||s==="finish"||s==="prefinish",Vr=s=>s instanceof ArrayBuffer||!!s&&typeof s=="object"&&s.constructor&&s.constructor.name==="ArrayBuffer"&&s.byteLength>=0,$r=s=>!Buffer.isBuffer(s)&&ArrayBuffer.isView(s),Fe=class{src;dest;opts;ondrain;constructor(t,e,i){this.src=t,this.dest=e,this.opts=i,this.ondrain=()=>t[Bt](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Li=class extends Fe{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,i){super(t,e,i),this.proxyErrors=r=>this.dest.emit("error",r),t.on("error",this.proxyErrors)}},Xr=s=>!!s.objectMode,qr=s=>!s.objectMode&&!!s.encoding&&s.encoding!=="buffer",A=class extends external_node_events_namespaceObject.EventEmitter{[g]=!1;[Qt]=!1;[N]=[];[b]=[];[L];[z];[Z];[Mt];[Q]=!1;[nt]=!1;[De]=!1;[Ne]=!1;[qt]=null;[_]=0;[S]=!1;[Jt];[Ce]=!1;[Rt]=0;[C]=!1;writable=!0;readable=!0;constructor(...t){let e=t[0]||{};if(super(),e.objectMode&&typeof e.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Xr(e)?(this[L]=!0,this[z]=null):qr(e)?(this[z]=e.encoding,this[L]=!1):(this[L]=!1,this[z]=null),this[Z]=!!e.async,this[Mt]=this[z]?new external_node_string_decoder_namespaceObject.StringDecoder(this[z]):null,e&&e.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[b]}),e&&e.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[N]});let{signal:i}=e;i&&(this[Jt]=i,i.aborted?this[xi]():i.addEventListener("abort",()=>this[xi]()))}get bufferLength(){return this[_]}get encoding(){return this[z]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[L]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Z]}set async(t){this[Z]=this[Z]||!!t}[xi](){this[Ce]=!0,this.emit("abort",this[Jt]?.reason),this.destroy(this[Jt]?.reason)}get aborted(){return this[Ce]}set aborted(t){}write(t,e,i){if(this[Ce])return!1;if(this[Q])throw new Error("write after end");if(this[S])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof e=="function"&&(i=e,e="utf8"),e||(e="utf8");let r=this[Z]?jt:Yr;if(!this[L]&&!Buffer.isBuffer(t)){if($r(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(Vr(t))t=Buffer.from(t);else if(typeof t!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[L]?(this[g]&&this[_]!==0&&this[Ae](!0),this[g]?this.emit("data",t):this[bi](t),this[_]!==0&&this.emit("readable"),i&&r(i),this[g]):t.length?(typeof t=="string"&&!(e===this[z]&&!this[Mt]?.lastNeed)&&(t=Buffer.from(t,e)),Buffer.isBuffer(t)&&this[z]&&(t=this[Mt].write(t)),this[g]&&this[_]!==0&&this[Ae](!0),this[g]?this.emit("data",t):this[bi](t),this[_]!==0&&this.emit("readable"),i&&r(i),this[g]):(this[_]!==0&&this.emit("readable"),i&&r(i),this[g])}read(t){if(this[S])return null;if(this[C]=!1,this[_]===0||t===0||t&&t>this[_])return this[J](),null;this[L]&&(t=null),this[b].length>1&&!this[L]&&(this[b]=[this[z]?this[b].join(""):Buffer.concat(this[b],this[_])]);let e=this[Ns](t||null,this[b][0]);return this[J](),e}[Ns](t,e){if(this[L])this[Ie]();else{let i=e;t===i.length||t===null?this[Ie]():typeof i=="string"?(this[b][0]=i.slice(t),e=i.slice(0,t),this[_]-=t):(this[b][0]=i.subarray(t),e=i.subarray(0,t),this[_]-=t)}return this.emit("data",e),!this[b].length&&!this[Q]&&this.emit("drain"),e}end(t,e,i){return typeof t=="function"&&(i=t,t=void 0),typeof e=="function"&&(i=e,e="utf8"),t!==void 0&&this.write(t,e),i&&this.once("end",i),this[Q]=!0,this.writable=!1,(this[g]||!this[Qt])&&this[J](),this}[Bt](){this[S]||(!this[Rt]&&!this[N].length&&(this[C]=!0),this[Qt]=!1,this[g]=!0,this.emit("resume"),this[b].length?this[Ae]():this[Q]?this[J]():this.emit("drain"))}resume(){return this[Bt]()}pause(){this[g]=!1,this[Qt]=!0,this[C]=!1}get destroyed(){return this[S]}get flowing(){return this[g]}get paused(){return this[Qt]}[bi](t){this[L]?this[_]+=1:this[_]+=t.length,this[b].push(t)}[Ie](){return this[L]?this[_]-=1:this[_]-=this[b][0].length,this[b].shift()}[Ae](t=!1){do;while(this[As](this[Ie]())&&this[b].length);!t&&!this[b].length&&!this[Q]&&this.emit("drain")}[As](t){return this.emit("data",t),this[g]}pipe(t,e){if(this[S])return t;this[C]=!1;let i=this[nt];return e=e||{},t===Ds.stdout||t===Ds.stderr?e.end=!1:e.end=e.end!==!1,e.proxyErrors=!!e.proxyErrors,i?e.end&&t.end():(this[N].push(e.proxyErrors?new Li(this,t,e):new Fe(this,t,e)),this[Z]?jt(()=>this[Bt]()):this[Bt]()),t}unpipe(t){let e=this[N].find(i=>i.dest===t);e&&(this[N].length===1?(this[g]&&this[Rt]===0&&(this[g]=!1),this[N]=[]):this[N].splice(this[N].indexOf(e),1),e.unpipe())}addListener(t,e){return this.on(t,e)}on(t,e){let i=super.on(t,e);if(t==="data")this[C]=!1,this[Rt]++,!this[N].length&&!this[g]&&this[Bt]();else if(t==="readable"&&this[_]!==0)super.emit("readable");else if(Kr(t)&&this[nt])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[qt]){let r=e;this[Z]?jt(()=>r.call(this,this[qt])):r.call(this,this[qt])}return i}removeListener(t,e){return this.off(t,e)}off(t,e){let i=super.off(t,e);return t==="data"&&(this[Rt]=this.listeners("data").length,this[Rt]===0&&!this[C]&&!this[N].length&&(this[g]=!1)),i}removeAllListeners(t){let e=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[Rt]=0,!this[C]&&!this[N].length&&(this[g]=!1)),e}get emittedEnd(){return this[nt]}[J](){!this[De]&&!this[nt]&&!this[S]&&this[b].length===0&&this[Q]&&(this[De]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Ne]&&this.emit("close"),this[De]=!1)}emit(t,...e){let i=e[0];if(t!=="error"&&t!=="close"&&t!==S&&this[S])return!1;if(t==="data")return!this[L]&&!i?!1:this[Z]?(jt(()=>this[Oi](i)),!0):this[Oi](i);if(t==="end")return this[Is]();if(t==="close"){if(this[Ne]=!0,!this[nt]&&!this[S])return!1;let n=super.emit("close");return this.removeAllListeners("close"),n}else if(t==="error"){this[qt]=i,super.emit(_i,i);let n=!this[Jt]||this.listeners("error").length?super.emit("error",i):!1;return this[J](),n}else if(t==="resume"){let n=super.emit("resume");return this[J](),n}else if(t==="finish"||t==="prefinish"){let n=super.emit(t);return this.removeAllListeners(t),n}let r=super.emit(t,...e);return this[J](),r}[Oi](t){for(let i of this[N])i.dest.write(t)===!1&&this.pause();let e=this[C]?!1:super.emit("data",t);return this[J](),e}[Is](){return this[nt]?!1:(this[nt]=!0,this.readable=!1,this[Z]?(jt(()=>this[Ti]()),!0):this[Ti]())}[Ti](){if(this[Mt]){let e=this[Mt].end();if(e){for(let i of this[N])i.dest.write(e);this[C]||super.emit("data",e)}}for(let e of this[N])e.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[L]||(t.dataLength=0);let e=this.promise();return this.on("data",i=>{t.push(i),this[L]||(t.dataLength+=i.length)}),await e,t}async concat(){if(this[L])throw new Error("cannot concat in objectMode");let t=await this.collect();return this[z]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,e)=>{this.on(S,()=>e(new Error("stream destroyed"))),this.on("error",i=>e(i)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[C]=!1;let t=!1,e=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return e();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[Q])return e();let n,o,h=d=>{this.off("data",a),this.off("end",l),this.off(S,c),e(),o(d)},a=d=>{this.off("error",h),this.off("end",l),this.off(S,c),this.pause(),n({value:d,done:!!this[Q]})},l=()=>{this.off("error",h),this.off("data",a),this.off(S,c),e(),n({done:!0,value:void 0})},c=()=>h(new Error("stream destroyed"));return new Promise((d,y)=>{o=y,n=d,this.once(S,c),this.once("error",h),this.once("end",l),this.once("data",a)})},throw:e,return:e,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[C]=!1;let t=!1,e=()=>(this.pause(),this.off(_i,e),this.off(S,e),this.off("end",e),t=!0,{done:!0,value:void 0}),i=()=>{if(t)return e();let r=this.read();return r===null?e():{done:!1,value:r}};return this.once("end",e),this.once(_i,e),this.once(S,e),{next:i,throw:e,return:e,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(t){if(this[S])return t?this.emit("error",t):this.emit(S),this;this[S]=!0,this[C]=!0,this[b].length=0,this[_]=0;let e=this;return typeof e.close=="function"&&!this[Ne]&&e.close(),t?this.emit("error",t):this.emit(S),this}static get isStream(){return Wr}};var Jr=external_fs_namespaceObject.writev,ht=Symbol("_autoClose"),H=Symbol("_close"),te=Symbol("_ended"),m=Symbol("_fd"),Ni=Symbol("_finished"),tt=Symbol("_flags"),Ai=Symbol("_flush"),ki=Symbol("_handleChunk"),vi=Symbol("_makeBuf"),ie=Symbol("_mode"),ke=Symbol("_needDrain"),Ut=Symbol("_onerror"),Ht=Symbol("_onopen"),Ii=Symbol("_onread"),Pt=Symbol("_onwrite"),at=Symbol("_open"),U=Symbol("_path"),ot=Symbol("_pos"),Y=Symbol("_queue"),zt=Symbol("_read"),Ci=Symbol("_readSize"),j=Symbol("_reading"),ee=Symbol("_remain"),Fi=Symbol("_size"),ve=Symbol("_write"),gt=Symbol("_writing"),Me=Symbol("_defaultFlag"),bt=Symbol("_errored"),_t=class extends A{[bt]=!1;[m];[U];[Ci];[j]=!1;[Fi];[ee];[ht];constructor(t,e){if(e=e||{},super(e),this.readable=!0,this.writable=!1,typeof t!="string")throw new TypeError("path must be a string");this[bt]=!1,this[m]=typeof e.fd=="number"?e.fd:void 0,this[U]=t,this[Ci]=e.readSize||16*1024*1024,this[j]=!1,this[Fi]=typeof e.size=="number"?e.size:1/0,this[ee]=this[Fi],this[ht]=typeof e.autoClose=="boolean"?e.autoClose:!0,typeof this[m]=="number"?this[zt]():this[at]()}get fd(){return this[m]}get path(){return this[U]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[at](){external_fs_namespaceObject.open(this[U],"r",(t,e)=>this[Ht](t,e))}[Ht](t,e){t?this[Ut](t):(this[m]=e,this.emit("open",e),this[zt]())}[vi](){return Buffer.allocUnsafe(Math.min(this[Ci],this[ee]))}[zt](){if(!this[j]){this[j]=!0;let t=this[vi]();if(t.length===0)return process.nextTick(()=>this[Ii](null,0,t));external_fs_namespaceObject.read(this[m],t,0,t.length,null,(e,i,r)=>this[Ii](e,i,r))}}[Ii](t,e,i){this[j]=!1,t?this[Ut](t):this[ki](e,i)&&this[zt]()}[H](){if(this[ht]&&typeof this[m]=="number"){let t=this[m];this[m]=void 0,external_fs_namespaceObject.close(t,e=>e?this.emit("error",e):this.emit("close"))}}[Ut](t){this[j]=!0,this[H](),this.emit("error",t)}[ki](t,e){let i=!1;return this[ee]-=t,t>0&&(i=super.write(tthis[Ht](t,e))}[Ht](t,e){this[Me]&&this[tt]==="r+"&&t&&t.code==="ENOENT"?(this[tt]="w",this[at]()):t?this[Ut](t):(this[m]=e,this.emit("open",e),this[gt]||this[Ai]())}end(t,e){return t&&this.write(t,e),this[te]=!0,!this[gt]&&!this[Y].length&&typeof this[m]=="number"&&this[Pt](null,0),this}write(t,e){return typeof t=="string"&&(t=Buffer.from(t,e)),this[te]?(this.emit("error",new Error("write() after end()")),!1):this[m]===void 0||this[gt]||this[Y].length?(this[Y].push(t),this[ke]=!0,!1):(this[gt]=!0,this[ve](t),!0)}[ve](t){external_fs_namespaceObject.write(this[m],t,0,t.length,this[ot],(e,i)=>this[Pt](e,i))}[Pt](t,e){t?this[Ut](t):(this[ot]!==void 0&&typeof e=="number"&&(this[ot]+=e),this[Y].length?this[Ai]():(this[gt]=!1,this[te]&&!this[Ni]?(this[Ni]=!0,this[H](),this.emit("finish")):this[ke]&&(this[ke]=!1,this.emit("drain"))))}[Ai](){if(this[Y].length===0)this[te]&&this[Pt](null,0);else if(this[Y].length===1)this[ve](this[Y].pop());else{let t=this[Y];this[Y]=[],Jr(this[m],t,this[ot],(e,i)=>this[Pt](e,i))}}[H](){if(this[ht]&&typeof this[m]=="number"){let t=this[m];this[m]=void 0,external_fs_namespaceObject.close(t,e=>e?this.emit("error",e):this.emit("close"))}}},Wt=class extends et{[at](){let t;if(this[Me]&&this[tt]==="r+")try{t=external_fs_namespaceObject.openSync(this[U],this[tt],this[ie])}catch(e){if(e?.code==="ENOENT")return this[tt]="w",this[at]();throw e}else t=external_fs_namespaceObject.openSync(this[U],this[tt],this[ie]);this[Ht](null,t)}[H](){if(this[ht]&&typeof this[m]=="number"){let t=this[m];this[m]=void 0,external_fs_namespaceObject.closeSync(t),this.emit("close")}}[ve](t){let e=!0;try{this[Pt](null,external_fs_namespaceObject.writeSync(this[m],t,0,t.length,this[ot])),e=!1}finally{if(e)try{this[H]()}catch{}}}};var jr=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),Fs=s=>!!s.sync&&!!s.file,ks=s=>!s.sync&&!!s.file,vs=s=>!!s.sync&&!s.file,Ms=s=>!s.sync&&!s.file;var Bs=s=>!!s.file;var tn=s=>{let t=jr.get(s);return t||s},se=(s={})=>{if(!s)return{};let t={};for(let[e,i]of Object.entries(s)){let r=tn(e);t[r]=i}return t.chmod===void 0&&t.noChmod===!1&&(t.chmod=!0),delete t.noChmod,t};var K=(s,t,e,i,r)=>Object.assign((n=[],o,h)=>{Array.isArray(n)&&(o=n,n={}),typeof o=="function"&&(h=o,o=void 0),o=o?Array.from(o):[];let a=se(n);if(r?.(a,o),Fs(a)){if(typeof h=="function")throw new TypeError("callback not supported for sync tar functions");return s(a,o)}else if(ks(a)){let l=t(a,o);return h?l.then(()=>h(),h):l}else if(vs(a)){if(typeof h=="function")throw new TypeError("callback not supported for sync tar functions");return e(a,o)}else if(Ms(a)){if(typeof h=="function")throw new TypeError("callback only supported with file option");return i(a,o)}throw new Error("impossible options??")},{syncFile:s,asyncFile:t,syncNoFile:e,asyncNoFile:i,validate:r});var sn=external_zlib_namespaceObject.constants||{ZLIB_VERNUM:4736},M=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},sn));var rn=external_buffer_.Buffer.concat,zs=Object.getOwnPropertyDescriptor(external_buffer_.Buffer,"concat"),nn=s=>s,Bi=zs?.writable===!0||zs?.set!==void 0?s=>{external_buffer_.Buffer.concat=s?nn:rn}:s=>{},Tt=Symbol("_superWrite"),Gt=class extends Error{code;errno;constructor(t,e){super("zlib: "+t.message,{cause:t}),this.code=t.code,this.errno=t.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+t.message,Error.captureStackTrace(this,e??this.constructor)}get name(){return"ZlibError"}},Pi=Symbol("flushFlag"),re=class extends A{#t=!1;#i=!1;#s;#n;#r;#e;#o;get sawError(){return this.#t}get handle(){return this.#e}get flushFlag(){return this.#s}constructor(t,e){if(!t||typeof t!="object")throw new TypeError("invalid options for ZlibBase constructor");if(super(t),this.#s=t.flush??0,this.#n=t.finishFlush??0,this.#r=t.fullFlushFlag??0,typeof external_zlib_namespaceObject_0[e]!="function")throw new TypeError("Compression method not supported: "+e);try{this.#e=new external_zlib_namespaceObject_0[e](t)}catch(i){throw new Gt(i,this.constructor)}this.#o=i=>{this.#t||(this.#t=!0,this.close(),this.emit("error",i))},this.#e?.on("error",i=>this.#o(new Gt(i))),this.once("end",()=>this.close)}close(){this.#e&&(this.#e.close(),this.#e=void 0,this.emit("close"))}reset(){if(!this.#t)return external_assert_namespaceObject(this.#e,"zlib binding closed"),this.#e.reset?.()}flush(t){this.ended||(typeof t!="number"&&(t=this.#r),this.write(Object.assign(external_buffer_.Buffer.alloc(0),{[Pi]:t})))}end(t,e,i){return typeof t=="function"&&(i=t,e=void 0,t=void 0),typeof e=="function"&&(i=e,e=void 0),t&&(e?this.write(t,e):this.write(t)),this.flush(this.#n),this.#i=!0,super.end(i)}get ended(){return this.#i}[Tt](t){return super.write(t)}write(t,e,i){if(typeof e=="function"&&(i=e,e="utf8"),typeof t=="string"&&(t=external_buffer_.Buffer.from(t,e)),this.#t)return;external_assert_namespaceObject(this.#e,"zlib binding closed");let r=this.#e._handle,n=r.close;r.close=()=>{};let o=this.#e.close;this.#e.close=()=>{},Bi(!0);let h;try{let l=typeof t[Pi]=="number"?t[Pi]:this.#s;h=this.#e._processChunk(t,l),Bi(!1)}catch(l){Bi(!1),this.#o(new Gt(l,this.write))}finally{this.#e&&(this.#e._handle=r,r.close=n,this.#e.close=o,this.#e.removeAllListeners("error"))}this.#e&&this.#e.on("error",l=>this.#o(new Gt(l,this.write)));let a;if(h)if(Array.isArray(h)&&h.length>0){let l=h[0];a=this[Tt](external_buffer_.Buffer.from(l));for(let c=1;c{typeof r=="function"&&(n=r,r=this.flushFlag),this.flush(r),n?.()};try{this.handle.params(t,e)}finally{this.handle.flush=i}this.handle&&(this.#t=t,this.#i=e)}}}};var ze=class extends Pe{#t;constructor(t){super(t,"Gzip"),this.#t=t&&!!t.portable}[Tt](t){return this.#t?(this.#t=!1,t[9]=255,super[Tt](t)):super[Tt](t)}};var Ue=class extends Pe{constructor(t){super(t,"Unzip")}},He=class extends re{constructor(t,e){t=t||{},t.flush=t.flush||M.BROTLI_OPERATION_PROCESS,t.finishFlush=t.finishFlush||M.BROTLI_OPERATION_FINISH,t.fullFlushFlag=M.BROTLI_OPERATION_FLUSH,super(t,e)}},We=class extends He{constructor(t){super(t,"BrotliCompress")}},Ge=class extends He{constructor(t){super(t,"BrotliDecompress")}},Ze=class extends re{constructor(t,e){t=t||{},t.flush=t.flush||M.ZSTD_e_continue,t.finishFlush=t.finishFlush||M.ZSTD_e_end,t.fullFlushFlag=M.ZSTD_e_flush,super(t,e)}},Ye=class extends Ze{constructor(t){super(t,"ZstdCompress")}},Ke=class extends Ze{constructor(t){super(t,"ZstdDecompress")}};var Us=(s,t)=>{if(Number.isSafeInteger(s))s<0?an(s,t):hn(s,t);else throw Error("cannot encode number outside of javascript safe integer range");return t},hn=(s,t)=>{t[0]=128;for(var e=t.length;e>1;e--)t[e-1]=s&255,s=Math.floor(s/256)},an=(s,t)=>{t[0]=255;var e=!1;s=s*-1;for(var i=t.length;i>1;i--){var r=s&255;s=Math.floor(s/256),e?t[i-1]=Ws(r):r===0?t[i-1]=0:(e=!0,t[i-1]=Gs(r))}},Hs=s=>{let t=s[0],e=t===128?cn(s.subarray(1,s.length)):t===255?ln(s):null;if(e===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(e))throw Error("parsed number outside of javascript safe integer range");return e},ln=s=>{for(var t=s.length,e=0,i=!1,r=t-1;r>-1;r--){var n=Number(s[r]),o;i?o=Ws(n):n===0?o=n:(i=!0,o=Gs(n)),o!==0&&(e-=o*Math.pow(256,t-r-1))}return e},cn=s=>{for(var t=s.length,e=0,i=t-1;i>-1;i--){var r=Number(s[i]);r!==0&&(e+=r*Math.pow(256,t-i-1))}return e},Ws=s=>(255^s)&255,Gs=s=>(255^s)+1&255;var Hi={};Ur(Hi,{code:()=>Ve,isCode:()=>ne,isName:()=>dn,name:()=>oe,normalFsTypes:()=>Ui});var ne=s=>oe.has(s),dn=s=>Ve.has(s),Ui=new Set(["0","","1","2","3","4","5","6","7","D"]),oe=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),Ve=new Map(Array.from(oe).map(s=>[s[1],s[0]]));var un=s=>s===void 0||s<0?void 0:s,F=class{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#t="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(t,e=0,i,r){Buffer.isBuffer(t)?this.decode(t,e||0,i,r):t&&this.#i(t)}decode(t,e,i,r){if(e||(e=0),!t||!(t.length>=e+512))throw new Error("need 512 bytes for header");let n=xt(t,e+156,1),o=Ui.has(n),h=o?i:void 0,a=o?r:void 0;if(this.path=h?.path??xt(t,e,100),this.mode=h?.mode??a?.mode??lt(t,e+100,8),this.uid=h?.uid??a?.uid??lt(t,e+108,8),this.gid=h?.gid??a?.gid??lt(t,e+116,8),this.size=un(h?.size??a?.size??lt(t,e+124,12)),this.mtime=h?.mtime??a?.mtime??Wi(t,e+136,12),this.cksum=lt(t,e+148,12),a&&this.#i(a,!0),h&&this.#i(h),ne(n)&&(this.#t=n||"0"),this.#t==="0"&&this.path.slice(-1)==="/"&&(this.#t="5"),this.#t==="5"&&(this.size=0),this.linkpath=xt(t,e+157,100),t.subarray(e+257,e+265).toString()==="ustar\x0000")if(this.uname=h?.uname??a?.uname??xt(t,e+265,32),this.gname=h?.gname??a?.gname??xt(t,e+297,32),this.devmaj=h?.devmaj??a?.devmaj??lt(t,e+329,8)??0,this.devmin=h?.devmin??a?.devmin??lt(t,e+337,8)??0,t[e+475]!==0){let c=xt(t,e+345,155);this.path=c+"/"+this.path}else{let c=xt(t,e+345,130);c&&(this.path=c+"/"+this.path),this.atime=i?.atime??r?.atime??Wi(t,e+476,12),this.ctime=i?.ctime??r?.ctime??Wi(t,e+488,12)}let l=256;for(let c=e;c!(r==null||i==="size"&&Number(r)<0||i==="path"&&e||i==="linkpath"&&e||i==="global"))))}encode(t,e=0){if(t||(t=this.block=Buffer.alloc(512)),this.#t==="Unsupported"&&(this.#t="0"),!(t.length>=e+512))throw new Error("need 512 bytes for header");let i=this.ctime||this.atime?130:155,r=mn(this.path||"",i),n=r[0],o=r[1];this.needPax=!!r[2],this.needPax=Lt(t,e,100,n)||this.needPax,this.needPax=ct(t,e+100,8,this.mode)||this.needPax,this.needPax=ct(t,e+108,8,this.uid)||this.needPax,this.needPax=ct(t,e+116,8,this.gid)||this.needPax,this.needPax=ct(t,e+124,12,this.size)||this.needPax,this.needPax=Gi(t,e+136,12,this.mtime)||this.needPax,t[e+156]=Number(this.#t.codePointAt(0)),this.needPax=Lt(t,e+157,100,this.linkpath)||this.needPax,t.write("ustar\x0000",e+257,8),this.needPax=Lt(t,e+265,32,this.uname)||this.needPax,this.needPax=Lt(t,e+297,32,this.gname)||this.needPax,this.needPax=ct(t,e+329,8,this.devmaj)||this.needPax,this.needPax=ct(t,e+337,8,this.devmin)||this.needPax,this.needPax=Lt(t,e+345,i,o)||this.needPax,t[e+475]!==0?this.needPax=Lt(t,e+345,155,o)||this.needPax:(this.needPax=Lt(t,e+345,130,o)||this.needPax,this.needPax=Gi(t,e+476,12,this.atime)||this.needPax,this.needPax=Gi(t,e+488,12,this.ctime)||this.needPax);let h=256;for(let a=e;a{let i=s,r="",n,o=external_node_path_namespaceObject.posix.parse(s).root||".";if(Buffer.byteLength(i)<100)n=[i,r,!1];else{r=external_node_path_namespaceObject.posix.dirname(i),i=external_node_path_namespaceObject.posix.basename(i);do Buffer.byteLength(i)<=100&&Buffer.byteLength(r)<=t?n=[i,r,!1]:Buffer.byteLength(i)>100&&Buffer.byteLength(r)<=t?n=[i.slice(0,99),r,!0]:(i=external_node_path_namespaceObject.posix.join(external_node_path_namespaceObject.posix.basename(r),i),r=external_node_path_namespaceObject.posix.dirname(r));while(r!==o&&n===void 0);n||(n=[s.slice(0,99),"",!0])}return n},xt=(s,t,e)=>s.subarray(t,t+e).toString("utf8").replace(/\0.*/,""),Wi=(s,t,e)=>pn(lt(s,t,e)),pn=s=>s===void 0?void 0:new Date(s*1e3),lt=(s,t,e)=>Number(s[t])&128?Hs(s.subarray(t,t+e)):wn(s,t,e),En=s=>isNaN(s)?void 0:s,wn=(s,t,e)=>En(parseInt(s.subarray(t,t+e).toString("utf8").replace(/\0.*$/,"").trim(),8)),Sn={12:8589934591,8:2097151},ct=(s,t,e,i)=>i===void 0?!1:i>Sn[e]||i<0?(Us(i,s.subarray(t,t+e)),!0):(yn(s,t,e,i),!1),yn=(s,t,e,i)=>s.write(Rn(i,e),t,e,"ascii"),Rn=(s,t)=>gn(Math.floor(s).toString(8),t),gn=(s,t)=>(s.length===t-1?s:new Array(t-s.length-1).join("0")+s+" ")+"\0",Gi=(s,t,e,i)=>i===void 0?!1:ct(s,t,e,i.getTime()/1e3),bn=new Array(156).join("\0"),Lt=(s,t,e,i)=>i===void 0?!1:(s.write(i+bn,t,e,"utf8"),i.length!==Buffer.byteLength(i)||i.length>e);var ft=class s{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(t,e=!1){this.atime=t.atime,this.charset=t.charset,this.comment=t.comment,this.ctime=t.ctime,this.dev=t.dev,this.gid=t.gid,this.global=e,this.gname=t.gname,this.ino=t.ino,this.linkpath=t.linkpath,this.mtime=t.mtime,this.nlink=t.nlink,this.path=t.path,this.size=t.size,this.uid=t.uid,this.uname=t.uname}encode(){let t=this.encodeBody();if(t==="")return Buffer.allocUnsafe(0);let e=Buffer.byteLength(t),i=512*Math.ceil(1+e/512),r=Buffer.allocUnsafe(i);for(let n=0;n<512;n++)r[n]=0;new F({path:("PaxHeader/"+(0,external_node_path_namespaceObject.basename)(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:e,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(r),r.write(t,512,e,"utf8");for(let n=e+512;n=Math.pow(10,o)&&(o+=1),o+n+r}static parse(t,e,i=!1){return new s(On(Tn(t),e),i)}},On=(s,t)=>t?Object.assign({},t,s):s,Tn=s=>s.replace(/\n$/,"").split(`
-`).reduce(xn,Object.create(null)),xn=(s,t)=>{let e=parseInt(t,10);if(e!==Buffer.byteLength(t)+1)return s;t=t.slice((e+" ").length);let i=t.split("="),r=i.shift();if(!r)return s;let n=r.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),o=i.join("=").replace(/\0.*/,"");switch(n){case"path":case"linkpath":case"type":case"charset":case"comment":case"gname":case"uname":s[n]=o;break;case"ctime":case"atime":case"mtime":s[n]=new Date(Number(o)*1e3);break;case"size":let h=+o;h>=0&&(s[n]=h);break;case"gid":case"uid":case"dev":case"ino":case"nlink":case"mode":s[n]=+o;break}return s};var Ln=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,f=Ln!=="win32"?s=>String(s):s=>String(s).replaceAll(/\\/g,"/");var $e=class extends A{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(t,e,i){switch(super({}),this.pause(),this.extended=e,this.globalExtended=i,this.header=t,this.remain=t.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=t.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!t.path)throw new Error("no path provided for tar.ReadEntry");this.path=f(t.path),this.mode=t.mode,this.mode&&(this.mode=this.mode&4095),this.uid=t.uid,this.gid=t.gid,this.uname=t.uname,this.gname=t.gname,this.size=this.remain,this.mtime=t.mtime,this.atime=t.atime,this.ctime=t.ctime,this.linkpath=t.linkpath?f(t.linkpath):void 0,this.uname=t.uname,this.gname=t.gname,e&&this.#t(e),i&&this.#t(i,!0)}write(t){let e=t.length;if(e>this.blockRemain)throw new Error("writing more to entry than is appropriate");let i=this.remain,r=this.blockRemain;return this.remain=Math.max(0,i-e),this.blockRemain=Math.max(0,r-e),this.ignore?!0:i>=e?super.write(t):super.write(t.subarray(0,i))}#t(t,e=!1){t.path&&(t.path=f(t.path)),t.linkpath&&(t.linkpath=f(t.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(t).filter(([i,r])=>!(r==null||i==="path"&&e))))}};var Dt=(s,t,e,i={})=>{s.file&&(i.file=s.file),s.cwd&&(i.cwd=s.cwd),i.code=e instanceof Error&&e.code||t,i.tarCode=t,!s.strict&&i.recoverable!==!1?(e instanceof Error&&(i=Object.assign(e,i),e=e.message),s.emit("warn",t,e,i)):e instanceof Error?s.emit("error",Object.assign(e,i)):s.emit("error",Object.assign(new Error(`${t}: ${e}`),i))};var Nn=1024*1024,Xi=Buffer.from([31,139]),qi=Buffer.from([40,181,47,253]),An=Math.max(Xi.length,qi.length),B=Symbol("state"),Nt=Symbol("writeEntry"),it=Symbol("readEntry"),Zi=Symbol("nextEntry"),Zs=Symbol("processEntry"),V=Symbol("extendedHeader"),he=Symbol("globalExtendedHeader"),dt=Symbol("meta"),Ys=Symbol("emitMeta"),p=Symbol("buffer"),st=Symbol("queue"),ut=Symbol("ended"),Yi=Symbol("emittedEnd"),At=Symbol("emit"),w=Symbol("unzip"),Xe=Symbol("consumeChunk"),qe=Symbol("consumeChunkSub"),Ki=Symbol("consumeBody"),Ks=Symbol("consumeMeta"),Vs=Symbol("consumeHeader"),ae=Symbol("consuming"),Vi=Symbol("bufferConcat"),Qe=Symbol("maybeEnd"),Yt=Symbol("writing"),$=Symbol("aborted"),Je=Symbol("onDone"),It=Symbol("sawValidEntry"),je=Symbol("sawNullBlock"),ti=Symbol("sawEOF"),$s=Symbol("closeStream"),In=1e3,le=Symbol("compressedBytesRead"),$i=Symbol("decompressedBytesRead"),Xs=Symbol("checkDecompressionRatio"),Cn=()=>!0,rt=class extends external_events_namespaceObject.EventEmitter{file;strict;maxMetaEntrySize;filter;brotli;zstd;maxDecompressionRatio;writable=!0;readable=!1;[st]=[];[p];[it];[Nt];[B]="begin";[dt]="";[V];[he];[ut]=!1;[w];[$]=!1;[It];[je]=!1;[ti]=!1;[Yt]=!1;[ae]=!1;[Yi]=!1;[le]=0;[$i]=0;constructor(t={}){super(),this.file=t.file||"",this.on(Je,()=>{(this[B]==="begin"||this[It]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),t.ondone?this.on(Je,t.ondone):this.on(Je,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!t.strict,this.maxDecompressionRatio=typeof t.maxDecompressionRatio=="number"?t.maxDecompressionRatio:In,this.maxMetaEntrySize=t.maxMetaEntrySize||Nn,this.filter=typeof t.filter=="function"?t.filter:Cn;let e=t.file&&(t.file.endsWith(".tar.br")||t.file.endsWith(".tbr"));this.brotli=!(t.gzip||t.zstd)&&t.brotli!==void 0?t.brotli:e?void 0:!1;let i=t.file&&(t.file.endsWith(".tar.zst")||t.file.endsWith(".tzst"));this.zstd=!(t.gzip||t.brotli)&&t.zstd!==void 0?t.zstd:i?!0:void 0,this.on("end",()=>this[$s]()),typeof t.onwarn=="function"&&this.on("warn",t.onwarn),typeof t.onReadEntry=="function"&&this.on("entry",t.onReadEntry)}warn(t,e,i={}){Dt(this,t,e,i)}[Vs](t,e){this[It]===void 0&&(this[It]=!1);let i;try{i=new F(t,e,this[V],this[he])}catch(r){return this.warn("TAR_ENTRY_INVALID",r)}if(i.nullBlock)this[je]?(this[ti]=!0,this[B]==="begin"&&(this[B]="header"),this[At]("eof")):(this[je]=!0,this[At]("nullBlock"));else if(this[je]=!1,!i.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:i});else if(!i.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:i});else{let r=i.type;if(/^(Symbolic)?Link$/.test(r)&&!i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:i});else if(!/^(Symbolic)?Link$/.test(r)&&!/^(Global)?ExtendedHeader$/.test(r)&&i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:i});else{let n=this[Nt]=new $e(i,this[V],this[he]);if(!this[It])if(n.remain){let o=()=>{n.invalid||(this[It]=!0)};n.on("end",o)}else this[It]=!0;n.meta?n.size>this.maxMetaEntrySize?(n.ignore=!0,this[At]("ignoredEntry",n),this[B]="ignore",n.resume()):n.size>0&&(this[dt]="",n.on("data",o=>this[dt]+=o),this[B]="meta"):(this[V]=void 0,n.ignore=n.ignore||!this.filter(n.path,n),n.ignore?(this[At]("ignoredEntry",n),this[B]=n.remain?"ignore":"header",n.resume()):(n.remain?this[B]="body":(this[B]="header",n.end()),this[it]?this[st].push(n):(this[st].push(n),this[Zi]())))}}}[$s](){queueMicrotask(()=>this.emit("close"))}[Zs](t){let e=!0;if(!t)this[it]=void 0,e=!1;else if(Array.isArray(t)){let[i,...r]=t;this.emit(i,...r)}else this[it]=t,this.emit("entry",t),t.emittedEnd||(t.on("end",()=>this[Zi]()),e=!1);return e}[Zi](){do;while(this[Zs](this[st].shift()));if(this[st].length===0){let t=this[it];!t||t.flowing||t.size===t.remain?this[Yt]||this.emit("drain"):t.once("drain",()=>this.emit("drain"))}}[Ki](t,e){let i=this[Nt];if(!i)throw new Error("attempt to consume body without entry??");let r=i.blockRemain??0,n=r>=t.length&&e===0?t:t.subarray(e,e+r);return i.write(n),i.blockRemain||(this[B]="header",this[Nt]=void 0,i.end()),n.length}[Ks](t,e){let i=this[Nt],r=this[Ki](t,e);return!this[Nt]&&i&&this[Ys](i),r}[At](t,e,i){this[st].length===0&&!this[it]?this.emit(t,e,i):this[st].push([t,e,i])}[Ys](t){switch(this[At]("meta",this[dt]),t.type){case"ExtendedHeader":case"OldExtendedHeader":this[V]=ft.parse(this[dt],this[V],!1);break;case"GlobalExtendedHeader":this[he]=ft.parse(this[dt],this[he],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let e=this[V]??Object.create(null);this[V]=e,e.path=this[dt].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let e=this[V]||Object.create(null);this[V]=e,e.linkpath=this[dt].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+t.type)}}abort(t){if(!this[$]){if(this[w]){let e=this[w];e.write=()=>!0,e.end=()=>e,e.emit=()=>!1,e.destroy?.()}this[$]=!0,this.emit("abort",t),this.warn("TAR_ABORT",t,{recoverable:!1})}}[Xs](t){this[$i]+=t.length;let e=this[$i]/this[le];return e>this.maxDecompressionRatio?(this.abort(new Error(`max decompression ratio exceeded: ${e.toFixed(2)} > ${this.maxDecompressionRatio}`)),!1):!0}write(t,e,i){if(typeof e=="function"&&(i=e,e=void 0),typeof t=="string"&&(t=Buffer.from(t,typeof e=="string"?e:"utf8")),this[$])return i?.(),!1;if((this[w]===void 0||this.brotli===void 0&&this[w]===!1)&&t){if(this[p]&&(t=Buffer.concat([this[p],t]),this[p]=void 0),t.length{this[Xs](c)&&this[Xe](c)}),this[w].on("error",c=>{this[$]||this.abort(c)}),this[w].on("end",()=>{this[ut]=!0,this[Xe]()}),this[Yt]=!0,this[le]+=t.length;let l=!!this[w][a?"end":"write"](t);return this[Yt]=!1,i?.(),l}}this[Yt]=!0,this[w]?(this[le]+=t.length,this[w].write(t)):this[Xe](t),this[Yt]=!1;let n=this[st].length>0?!1:this[it]?this[it].flowing:!0;return!n&&this[st].length===0&&this[it]?.once("drain",()=>this.emit("drain")),i?.(),n}[Vi](t){t&&!this[$]&&(this[p]=this[p]?Buffer.concat([this[p],t]):t)}[Qe](){if(this[ut]&&!this[Yi]&&!this[$]&&!this[ae]){this[Yi]=!0;let t=this[Nt];if(t?.blockRemain){let e=this[p]?this[p].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${t.blockRemain} more bytes, only ${e} available)`,{entry:t}),this[p]&&t.write(this[p]),t.end()}this[At](Je)}}[Xe](t){if(this[ae]&&t)this[Vi](t);else if(!t&&!this[p])this[Qe]();else if(t){if(this[ae]=!0,this[p]){this[Vi](t);let e=this[p];this[p]=void 0,this[qe](e)}else this[qe](t);for(;this[p]&&this[p]?.length>=512&&!this[$]&&!this[ti];){let e=this[p];this[p]=void 0,this[qe](e)}this[ae]=!1}(!this[p]||this[ut])&&this[Qe]()}[qe](t){let e=0,i=t.length;for(;e+512<=i&&!this[$]&&!this[ti];)switch(this[B]){case"begin":case"header":this[Vs](t,e),e+=512;break;case"ignore":case"body":e+=this[Ki](t,e);break;case"meta":e+=this[Ks](t,e);break;default:throw new Error("invalid state: "+this[B])}e{let t=s.length-1,e=-1;for(;t>-1&&s.charAt(t)==="/";)e=t,t--;return e===-1?s:s.slice(0,e)};var vn=s=>{let t=s.onReadEntry;s.onReadEntry=t?e=>{t(e),e.resume()}:e=>e.resume()},Qi=(s,t)=>{let e=new Map(t.map(o=>[mt(o),!0])),i=s.filter,r=100,n=(o,h="",a=0)=>{if(a>=r)return e.set(o,!1),!1;let l=h||(0,external_path_namespaceObject.parse)(o).root||".",c;if(o===l)c=!1;else{let d=e.get(o);c=d!==void 0?d:n((0,external_path_namespaceObject.dirname)(o),l,a+1)}return e.set(o,c),c};s.filter=i?(o,h)=>i(o,h)&&n(mt(o)):o=>n(mt(o))},Mn=s=>{let t=new rt(s),e=s.file,i;try{i=external_node_fs_namespaceObject.openSync(e,"r");let r=external_node_fs_namespaceObject.fstatSync(i),n=s.maxReadSize||16*1024*1024;if(r.size{let e=new rt(s),i=s.maxReadSize||16*1024*1024,r=s.file;return new Promise((o,h)=>{e.on("error",h),e.on("end",o),external_node_fs_namespaceObject.stat(r,(a,l)=>{if(a)h(a);else{let c=new _t(r,{readSize:i,size:l.size});c.on("error",h),c.pipe(e)}})})},Ct=K(Mn,Bn,s=>new rt(s),s=>new rt(s),(s,t)=>{t?.length&&Qi(s,t),s.noResume||vn(s)});var Ji=(s,t,e)=>(s&=4095,e&&(s=(s|384)&-19),t&&(s&256&&(s|=64),s&32&&(s|=8),s&4&&(s|=1)),s);var{isAbsolute:zn,parse:qs}=external_node_path_namespaceObject.win32,ce=s=>{let t="",e=qs(s);for(;zn(s)||e.root;){let i=s.charAt(0)==="/"&&s.slice(0,4)!=="//?/"?"/":e.root;s=s.slice(i.length),t+=i,e=qs(s)}return[t,s]};var ei=["|","<",">","?",":"],ji=ei.map(s=>String.fromCodePoint(61440+Number(s.codePointAt(0)))),Un=new Map(ei.map((s,t)=>[s,ji[t]])),Hn=new Map(ji.map((s,t)=>[s,ei[t]])),ts=s=>ei.reduce((t,e)=>t.split(e).join(Un.get(e)),s),Qs=s=>ji.reduce((t,e)=>t.split(e).join(Hn.get(e)),s);var rr=(s,t)=>t?(s=f(s).replace(/^\.(\/|$)/,""),mt(t)+"/"+s):f(s),Wn=16*1024*1024,tr=Symbol("process"),er=Symbol("file"),ir=Symbol("directory"),is=Symbol("symlink"),sr=Symbol("hardlink"),fe=Symbol("header"),ii=Symbol("read"),ss=Symbol("lstat"),si=Symbol("onlstat"),rs=Symbol("onread"),ns=Symbol("onreadlink"),os=Symbol("openfile"),hs=Symbol("onopenfile"),pt=Symbol("close"),ri=Symbol("mode"),as=Symbol("awaitDrain"),es=Symbol("ondrain"),q=Symbol("prefix"),de=class extends A{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#t=!1;constructor(t,e={}){let i=se(e);super(),this.path=f(t),this.portable=!!i.portable,this.maxReadSize=i.maxReadSize||Wn,this.linkCache=i.linkCache||new Map,this.statCache=i.statCache||new Map,this.preservePaths=!!i.preservePaths,this.cwd=f(i.cwd||process.cwd()),this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.mtime=i.mtime,this.prefix=i.prefix?f(i.prefix):void 0,this.onWriteEntry=i.onWriteEntry,typeof i.onwarn=="function"&&this.on("warn",i.onwarn);let r=!1;if(!this.preservePaths){let[o,h]=ce(this.path);o&&typeof h=="string"&&(this.path=h,r=o)}this.win32=!!i.win32||process.platform==="win32",this.win32&&(this.path=Qs(this.path.replaceAll(/\\/g,"/")),t=t.replaceAll(/\\/g,"/")),this.absolute=f(i.absolute||external_path_namespaceObject.resolve(this.cwd,t)),this.path===""&&(this.path="./"),r&&this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute path`,{entry:this,path:r+this.path});let n=this.statCache.get(this.absolute);n?this[si](n):this[ss]()}warn(t,e,i={}){return Dt(this,t,e,i)}emit(t,...e){return t==="error"&&(this.#t=!0),super.emit(t,...e)}[ss](){external_fs_namespaceObject.lstat(this.absolute,(t,e)=>{if(t)return this.emit("error",t);this[si](e)})}[si](t){this.statCache.set(this.absolute,t),this.stat=t,t.isFile()||(t.size=0),this.type=Gn(t),this.emit("stat",t),this[tr]()}[tr](){switch(this.type){case"File":return this[er]();case"Directory":return this[ir]();case"SymbolicLink":return this[is]();default:return this.end()}}[ri](t){return Ji(t,this.type==="Directory",this.portable)}[q](t){return rr(t,this.prefix)}[fe](){if(!this.stat)throw new Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new F({path:this[q](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[q](this.linkpath):this.linkpath,mode:this[ri](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new ft({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[q](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[q](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let t=this.header?.block;if(!t)throw new Error("failed to encode header");super.write(t)}[ir](){if(!this.stat)throw new Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[fe](),this.end()}[is](){external_fs_namespaceObject.readlink(this.absolute,(t,e)=>{if(t)return this.emit("error",t);this[ns](e)})}[ns](t){this.linkpath=f(t),this[fe](),this.end()}[sr](t){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=f(external_path_namespaceObject.relative(this.cwd,t)),this.stat.size=0,this[fe](),this.end()}[er](){if(!this.stat)throw new Error("cannot create file entry without stat");if(this.stat.nlink>1){let t=`${this.stat.dev}:${this.stat.ino}`,e=this.linkCache.get(t);if(e?.indexOf(this.cwd)===0)return this[sr](e);this.linkCache.set(t,this.absolute)}if(this[fe](),this.stat.size===0)return this.end();this[os]()}[os](){external_fs_namespaceObject.open(this.absolute,"r",(t,e)=>{if(t)return this.emit("error",t);this[hs](e)})}[hs](t){if(this.fd=t,this.#t)return this[pt]();if(!this.stat)throw new Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let e=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(e),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[ii]()}[ii](){let{fd:t,buf:e,offset:i,length:r,pos:n}=this;if(t===void 0||e===void 0)throw new Error("cannot read file without first opening");external_fs_namespaceObject.read(t,e,i,r,n,(o,h)=>{if(o)return this[pt](()=>this.emit("error",o));this[rs](h)})}[pt](t=()=>{}){this.fd!==void 0&&external_fs_namespaceObject.close(this.fd,t)}[rs](t){if(t<=0&&this.remain>0){let r=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[pt](()=>this.emit("error",r))}if(t>this.remain){let r=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[pt](()=>this.emit("error",r))}if(!this.buf)throw new Error("should have created buffer prior to reading");if(t===this.remain)for(let r=t;rthis[es]())}[as](t){this.once("drain",t)}write(t,e,i){if(typeof e=="function"&&(i=e,e=void 0),typeof t=="string"&&(t=Buffer.from(t,typeof e=="string"?e:"utf8")),this.blockRemaint?this.emit("error",t):this.end());if(!this.buf)throw new Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[ii]()}},ni=class extends de{sync=!0;[ss](){this[si](external_fs_namespaceObject.lstatSync(this.absolute))}[is](){this[ns](external_fs_namespaceObject.readlinkSync(this.absolute))}[os](){this[hs](external_fs_namespaceObject.openSync(this.absolute,"r"))}[ii](){let t=!0;try{let{fd:e,buf:i,offset:r,length:n,pos:o}=this;if(e===void 0||i===void 0)throw new Error("fd and buf must be set in READ method");let h=external_fs_namespaceObject.readSync(e,i,r,n,o);this[rs](h),t=!1}finally{if(t)try{this[pt](()=>{})}catch{}}}[as](t){t()}[pt](t=()=>{}){this.fd!==void 0&&external_fs_namespaceObject.closeSync(this.fd),t()}},oi=class extends A{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(t,e,i={}){return Dt(this,t,e,i)}constructor(t,e={}){let i=se(e);super(),this.preservePaths=!!i.preservePaths,this.portable=!!i.portable,this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.onWriteEntry=i.onWriteEntry,this.readEntry=t;let{type:r}=t;if(r==="Unsupported")throw new Error("writing entry that should be ignored");this.type=r,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=i.prefix,this.path=f(t.path),this.mode=t.mode!==void 0?this[ri](t.mode):void 0,this.uid=this.portable?void 0:t.uid,this.gid=this.portable?void 0:t.gid,this.uname=this.portable?void 0:t.uname,this.gname=this.portable?void 0:t.gname,this.size=t.size,this.mtime=this.noMtime?void 0:i.mtime||t.mtime,this.atime=this.portable?void 0:t.atime,this.ctime=this.portable?void 0:t.ctime,this.linkpath=t.linkpath!==void 0?f(t.linkpath):void 0,typeof i.onwarn=="function"&&this.on("warn",i.onwarn);let n=!1;if(!this.preservePaths){let[h,a]=ce(this.path);h&&typeof a=="string"&&(this.path=a,n=h)}this.remain=t.size,this.blockRemain=t.startBlockSize,this.onWriteEntry?.(this),this.header=new F({path:this[q](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[q](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),n&&this.warn("TAR_ENTRY_INFO",`stripping ${n} from absolute path`,{entry:this,path:n+this.path}),this.header.encode()&&!this.noPax&&super.write(new ft({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[q](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[q](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let o=this.header?.block;if(!o)throw new Error("failed to encode header");super.write(o),t.pipe(this)}[q](t){return rr(t,this.prefix)}[ri](t){return Ji(t,this.type==="Directory",this.portable)}write(t,e,i){typeof e=="function"&&(i=e,e=void 0),typeof t=="string"&&(t=Buffer.from(t,typeof e=="string"?e:"utf8"));let r=t.length;if(r>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=r,super.write(t,i)}end(t,e,i){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof t=="function"&&(i=t,e=void 0,t=void 0),typeof e=="function"&&(i=e,e=void 0),typeof t=="string"&&(t=Buffer.from(t,e??"utf8")),i&&this.once("finish",i),t?super.end(t,i):super.end(i),this}},Gn=s=>s.isFile()?"File":s.isDirectory()?"Directory":s.isSymbolicLink()?"SymbolicLink":"Unsupported";var hi=class s{tail;head;length=0;static create(t=[]){return new s(t)}constructor(t=[]){for(let e of t)this.push(e)}*[Symbol.iterator](){for(let t=this.head;t;t=t.next)yield t.value}removeNode(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");let e=t.next,i=t.prev;return e&&(e.prev=i),i&&(i.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=i),this.length--,t.next=void 0,t.prev=void 0,t.list=void 0,e}unshiftNode(t){if(t===this.head)return;t.list&&t.list.removeNode(t);let e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}pushNode(t){if(t===this.tail)return;t.list&&t.list.removeNode(t);let e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}push(...t){for(let e=0,i=t.length;e1)i=e;else if(this.head)r=this.head.next,i=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var n=0;r;n++)i=t(i,r.value,n),r=r.next;return i}reduceReverse(t,e){let i,r=this.tail;if(arguments.length>1)i=e;else if(this.tail)r=this.tail.prev,i=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(let n=this.length-1;r;n--)i=t(i,r.value,n),r=r.prev;return i}toArray(){let t=new Array(this.length);for(let e=0,i=this.head;i;e++)t[e]=i.value,i=i.next;return t}toArrayReverse(){let t=new Array(this.length);for(let e=0,i=this.tail;i;e++)t[e]=i.value,i=i.prev;return t}slice(t=0,e=this.length){e<0&&(e+=this.length),t<0&&(t+=this.length);let i=new s;if(ethis.length&&(e=this.length);let r=this.head,n=0;for(n=0;r&&nthis.length&&(e=this.length);let r=this.length,n=this.tail;for(;n&&r>e;r--)n=n.prev;for(;n&&r>t;r--,n=n.prev)i.push(n.value);return i}splice(t,e=0,...i){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);let r=this.head;for(let o=0;r&&o1)throw new TypeError("gzip, brotli, zstd are mutually exclusive");if(t.gzip&&(typeof t.gzip!="object"&&(t.gzip={}),this.portable&&(t.gzip.portable=!0),this.zip=new ze(t.gzip)),t.brotli&&(typeof t.brotli!="object"&&(t.brotli={}),this.zip=new We(t.brotli)),t.zstd&&(typeof t.zstd!="object"&&(t.zstd={}),this.zip=new Ye(t.zstd)),!this.zip)throw new Error("impossible");let e=this.zip;e.on("data",i=>super.write(i)),e.on("end",()=>super.end()),e.on("drain",()=>this[fs]()),this.on("resume",()=>e.resume())}else this.on("drain",this[fs]);this.noDirRecurse=!!t.noDirRecurse,this.follow=!!t.follow,this.noMtime=!!t.noMtime,t.mtime&&(this.mtime=t.mtime),this.filter=typeof t.filter=="function"?t.filter:()=>!0,this[W]=new hi,this[G]=0,this.jobs=Number(t.jobs)||4,this[Ee]=!1,this[me]=!1}[lr](t){return super.write(t)}add(t){return this.write(t),this}end(t,e,i){return typeof t=="function"&&(i=t,t=void 0),typeof e=="function"&&(i=e,e=void 0),t&&this.add(t),this[me]=!0,this[Ft](),i&&i(),this}write(t){if(this[me])throw new Error("write after end");return typeof t=="string"?this[ci](t):this[or](t),this.flowing}[or](t){let e=f(external_path_namespaceObject.resolve(this.cwd,t.path));if(!this.filter(t.path,t))t.resume();else{let i=new pi(t.path,e);i.entry=new oi(t,this[cs](i)),i.entry.on("end",()=>this[ls](i)),this[G]+=1,this[W].push(i)}this[Ft]()}[ci](t){let e=f(external_path_namespaceObject.resolve(this.cwd,t));this[W].push(new pi(t,e)),this[Ft]()}[ds](t){t.pending=!0,this[G]+=1;let e=this.follow?"stat":"lstat";external_fs_namespaceObject[e](t.absolute,(i,r)=>{t.pending=!1,this[G]-=1,i?this.emit("error",i):this[li](t,r)})}[li](t,e){if(this.statCache.set(t.absolute,e),t.stat=e,!this.filter(t.path,e))t.ignore=!0;else if(e.isFile()&&e.nlink>1&&!this.linkCache.get(`${e.dev}:${e.ino}`)&&!this.sync)if(t===this[Et])this[ai](t);else{let i=`${e.dev}:${e.ino}`,r=this[pe].get(i);r?r.push(t):this[pe].set(i,[t]),t.pendingLink=!0,t.pending=!0}this[Ft]()}[us](t){t.pending=!0,this[G]+=1,external_fs_namespaceObject.readdir(t.absolute,(e,i)=>{if(t.pending=!1,this[G]-=1,e)return this.emit("error",e);this[fi](t,i)})}[fi](t,e){this.readdirCache.set(t.absolute,e),t.readdir=e,this[Ft]()}[Ft](){if(!this[Ee]){this[Ee]=!0;for(let t=this[W].head;t&&this[G]1){let i=`${e.dev}:${e.ino}`,r=this[pe].get(i);if(r){this[pe].delete(i);for(let n of r)n.pending=!1,this[ai](n)}}this[Ft]()}[ai](t){if(t.pending&&t.pendingLink&&t===this[Et]&&(t.pending=!1,t.pendingLink=!1),!t.pending){if(t.entry){t===this[Et]&&!t.piped&&this[di](t);return}if(!t.stat){let e=this.statCache.get(t.absolute);e?this[li](t,e):this[ds](t)}if(t.stat&&!t.ignore){if(!this.noDirRecurse&&t.stat.isDirectory()&&!t.readdir){let e=this.readdirCache.get(t.absolute);if(e?this[fi](t,e):this[us](t),!t.readdir)return}if(t.entry=this[hr](t),!t.entry){t.ignore=!0;return}t===this[Et]&&!t.piped&&this[di](t)}}}[cs](t){return{onwarn:(e,i,r)=>this.warn(e,i,r),noPax:this.noPax,cwd:this.cwd,absolute:t.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[hr](t){this[G]+=1;try{return new this[ui](t.path,this[cs](t)).on("end",()=>this[ls](t)).on("error",i=>this.emit("error",i))}catch(e){this.emit("error",e)}}[fs](){this[Et]&&this[Et].entry&&this[Et].entry.resume()}[di](t){t.piped=!0,t.readdir&&t.readdir.forEach(r=>{let n=t.path,o=n==="./"?"":n.replace(/\/*$/,"/");this[ci](o+r)});let e=t.entry,i=this.zip;if(!e)throw new Error("cannot pipe without source");i?e.on("data",r=>{i.write(r)||e.pause()}):e.on("data",r=>{super.write(r)||e.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(t,e,i={}){Dt(this,t,e,i)}},kt=class extends wt{sync=!0;constructor(t){super(t),this[ui]=ni}pause(){}resume(){}[ds](t){let e=this.follow?"statSync":"lstatSync";this[li](t,external_fs_namespaceObject[e](t.absolute))}[us](t){this[fi](t,external_fs_namespaceObject.readdirSync(t.absolute))}[di](t){let e=t.entry,i=this.zip;if(t.readdir&&t.readdir.forEach(r=>{let n=t.path,o=n==="./"?"":n.replace(/\/*$/,"/");this[ci](o+r)}),!e)throw new Error("Cannot pipe without source");i?e.on("data",r=>{i.write(r)}):e.on("data",r=>{super[lr](r)})}};var Vn=(s,t)=>{let e=new kt(s),i=new Wt(s.file,{mode:s.mode||438});e.pipe(i),fr(e,t)},$n=(s,t)=>{let e=new wt(s),i=new et(s.file,{mode:s.mode||438});e.pipe(i);let r=new Promise((n,o)=>{i.on("error",o),i.on("close",n),e.on("error",o)});return dr(e,t).catch(n=>e.emit("error",n)),r},fr=(s,t)=>{t.forEach(e=>{e.charAt(0)==="@"?Ct({file:external_node_path_namespaceObject.resolve(s.cwd,e.slice(1)),sync:!0,noResume:!0,onReadEntry:i=>s.add(i)}):s.add(e)}),s.end()},dr=async(s,t)=>{for(let e of t)e.charAt(0)==="@"?await Ct({file:external_node_path_namespaceObject.resolve(String(s.cwd),e.slice(1)),noResume:!0,onReadEntry:i=>{s.add(i)}}):s.add(e);s.end()},Xn=(s,t)=>{let e=new kt(s);return fr(e,t),e},qn=(s,t)=>{let e=new wt(s);return dr(e,t).catch(i=>e.emit("error",i)),e},Qn=K(Vn,$n,Xn,qn,(s,t)=>{if(!t?.length)throw new TypeError("no paths specified to add to archive")});var Jn=process.env.__FAKE_PLATFORM__||process.platform,Er=Jn==="win32",{O_CREAT:wr,O_NOFOLLOW:ur,O_TRUNC:Sr,O_WRONLY:yr}=external_fs_namespaceObject.constants,Rr=Number(process.env.__FAKE_FS_O_FILENAME__)||external_fs_namespaceObject.constants.UV_FS_O_FILEMAP||0,jn=Er&&!!Rr,to=512*1024,eo=Rr|Sr|wr|yr,mr=!Er&&typeof ur=="number"?ur|Sr|wr|yr:null,ms=mr!==null?()=>mr:jn?s=>s"w";var ps=(s,t,e)=>{try{return external_node_fs_namespaceObject.lchownSync(s,t,e)}catch(i){if(i?.code!=="ENOENT")throw i}},Ei=(s,t,e,i)=>{external_node_fs_namespaceObject.lchown(s,t,e,r=>{i(r&&r?.code!=="ENOENT"?r:null)})},io=(s,t,e,i,r)=>{if(t.isDirectory())Es(external_node_path_namespaceObject.resolve(s,t.name),e,i,n=>{if(n)return r(n);let o=external_node_path_namespaceObject.resolve(s,t.name);Ei(o,e,i,r)});else{let n=external_node_path_namespaceObject.resolve(s,t.name);Ei(n,e,i,r)}},Es=(s,t,e,i)=>{external_node_fs_namespaceObject.readdir(s,{withFileTypes:!0},(r,n)=>{if(r){if(r.code==="ENOENT")return i();if(r.code!=="ENOTDIR"&&r.code!=="ENOTSUP")return i(r)}if(r||!n.length)return Ei(s,t,e,i);let o=n.length,h=null,a=l=>{if(!h){if(l)return i(h=l);if(--o===0)return Ei(s,t,e,i)}};for(let l of n)io(s,l,t,e,a)})},so=(s,t,e,i)=>{t.isDirectory()&&ws(external_node_path_namespaceObject.resolve(s,t.name),e,i),ps(external_node_path_namespaceObject.resolve(s,t.name),e,i)},ws=(s,t,e)=>{let i;try{i=external_node_fs_namespaceObject.readdirSync(s,{withFileTypes:!0})}catch(r){let n=r;if(n?.code==="ENOENT")return;if(n?.code==="ENOTDIR"||n?.code==="ENOTSUP")return ps(s,t,e);throw n}for(let r of i)so(s,r,t,e);return ps(s,t,e)};var Se=class extends Error{path;code;syscall="chdir";constructor(t,e){super(`${e}: Cannot cd into '${t}'`),this.path=t,this.code=e}get name(){return"CwdError"}};var St=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(t,e){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=t,this.path=e}get name(){return"SymlinkError"}};var no=(s,t)=>{external_node_fs_namespaceObject.stat(s,(e,i)=>{(e||!i.isDirectory())&&(e=new Se(s,e?.code||"ENOTDIR")),t(e)})},gr=(s,t,e)=>{s=f(s);let i=t.umask??18,r=t.mode|448,n=(r&i)!==0,o=t.uid,h=t.gid,a=typeof o=="number"&&typeof h=="number"&&(o!==t.processUid||h!==t.processGid),l=t.preserve,c=t.unlink,d=f(t.cwd),y=(E,x)=>{E?e(E):x&&a?Es(x,o,h,Le=>y(Le)):n?external_node_fs_namespaceObject.chmod(s,r,e):e()};if(s===d)return no(s,y);if(l)return promises_namespaceObject.mkdir(s,{mode:r,recursive:!0}).then(E=>y(null,E??void 0),y);let D=f(external_node_path_namespaceObject.relative(d,s)).split("/");Ss(d,D,r,c,d,void 0,y)},Ss=(s,t,e,i,r,n,o)=>{if(t.length===0)return o(null,n);let h=t.shift(),a=f(external_node_path_namespaceObject.resolve(s+"/"+h));external_node_fs_namespaceObject.mkdir(a,e,br(a,t,e,i,r,n,o))},br=(s,t,e,i,r,n,o)=>h=>{h?external_node_fs_namespaceObject.lstat(s,(a,l)=>{if(a)a.path=a.path&&f(a.path),o(a);else if(l.isDirectory())Ss(s,t,e,i,r,n,o);else if(i)external_node_fs_namespaceObject.unlink(s,c=>{if(c)return o(c);external_node_fs_namespaceObject.mkdir(s,e,br(s,t,e,i,r,n,o))});else{if(l.isSymbolicLink())return o(new St(s,s+"/"+t.join("/")));o(h)}}):(n=n||s,Ss(s,t,e,i,r,n,o))},oo=s=>{let t=!1,e;try{t=external_node_fs_namespaceObject.statSync(s).isDirectory()}catch(i){e=i?.code}finally{if(!t)throw new Se(s,e??"ENOTDIR")}},_r=(s,t)=>{s=f(s);let e=t.umask??18,i=t.mode|448,r=(i&e)!==0,n=t.uid,o=t.gid,h=typeof n=="number"&&typeof o=="number"&&(n!==t.processUid||o!==t.processGid),a=t.preserve,l=t.unlink,c=f(t.cwd),d=E=>{E&&h&&ws(E,n,o),r&&external_node_fs_namespaceObject.chmodSync(s,i)};if(s===c)return oo(c),d();if(a)return d(external_node_fs_namespaceObject.mkdirSync(s,{mode:i,recursive:!0})??void 0);let T=f(external_node_path_namespaceObject.relative(c,s)).split("/"),D;for(let E=T.shift(),x=c;E&&(x+="/"+E);E=T.shift()){x=f(external_node_path_namespaceObject.resolve(x));try{external_node_fs_namespaceObject.mkdirSync(x,i),D=D||x}catch{let Le=external_node_fs_namespaceObject.lstatSync(x);if(Le.isDirectory())continue;if(l){external_node_fs_namespaceObject.unlinkSync(x),external_node_fs_namespaceObject.mkdirSync(x,i),D=D||x;continue}else if(Le.isSymbolicLink())return new St(x,x+"/"+T.join("/"))}}return d(D)};var ys=Object.create(null),Or=1e4,Vt=new Set,Tr=s=>{Vt.has(s)?Vt.delete(s):ys[s]=s.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"),Vt.add(s);let t=ys[s],e=Vt.size-Or;if(e>Or/10){for(let i of Vt)if(Vt.delete(i),delete ys[i],--e<=0)break}return t};var ho=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,ao=ho==="win32",lo=s=>s.split("/").slice(0,-1).reduce((e,i)=>{let r=e.at(-1);return r!==void 0&&(i=(0,external_node_path_namespaceObject.join)(r,i)),e.push(i||"/"),e},[]),yi=class{#t=new Map;#i=new Map;#s=new Set;reserve(t,e){t=ao?["win32 parallelization disabled"]:t.map(r=>mt((0,external_node_path_namespaceObject.join)(Tr(r))));let i=new Set(t.map(r=>lo(r)).reduce((r,n)=>r.concat(n)));this.#i.set(e,{dirs:i,paths:t});for(let r of t){let n=this.#t.get(r);n?n.push(e):this.#t.set(r,[e])}for(let r of i){let n=this.#t.get(r);if(!n)this.#t.set(r,[new Set([e])]);else{let o=n.at(-1);o instanceof Set?o.add(e):n.push(new Set([e]))}}return this.#r(e)}#n(t){let e=this.#i.get(t);if(!e)throw new Error("function does not have any path reservations");return{paths:e.paths.map(i=>this.#t.get(i)),dirs:[...e.dirs].map(i=>this.#t.get(i))}}check(t){let{paths:e,dirs:i}=this.#n(t);return e.every(r=>r&&r[0]===t)&&i.every(r=>r&&r[0]instanceof Set&&r[0].has(t))}#r(t){return this.#s.has(t)||!this.check(t)?!1:(this.#s.add(t),t(()=>this.#e(t)),!0)}#e(t){if(!this.#s.has(t))return!1;let e=this.#i.get(t);if(!e)throw new Error("invalid reservation");let{paths:i,dirs:r}=e,n=new Set;for(let o of i){let h=this.#t.get(o);if(!h||h?.[0]!==t)continue;let a=h[1];if(!a){this.#t.delete(o);continue}if(h.shift(),typeof a=="function")n.add(a);else for(let l of a)n.add(l)}for(let o of r){let h=this.#t.get(o),a=h?.[0];if(!(!h||!(a instanceof Set)))if(a.size===1&&h.length===1){this.#t.delete(o);continue}else if(a.size===1){h.shift();let l=h[0];typeof l=="function"&&n.add(l)}else a.delete(t)}return this.#s.delete(t),n.forEach(o=>this.#r(o)),!0}};var Lr=()=>process.umask();var Dr=Symbol("onEntry"),_s=Symbol("checkFs"),Nr=Symbol("checkFs2"),Os=Symbol("isReusable"),P=Symbol("makeFs"),Ts=Symbol("file"),xs=Symbol("directory"),gi=Symbol("link"),Ar=Symbol("symlink"),Ir=Symbol("hardlink"),Re=Symbol("ensureNoSymlink"),Cr=Symbol("unsupported"),Fr=Symbol("checkPath"),Rs=Symbol("stripAbsolutePath"),yt=Symbol("mkdir"),O=Symbol("onError"),Ri=Symbol("pending"),kr=Symbol("pend"),$t=Symbol("unpend"),gs=Symbol("ended"),bs=Symbol("maybeClose"),Ls=Symbol("skip"),ge=Symbol("doChown"),be=Symbol("uid"),_e=Symbol("gid"),Oe=Symbol("checkedCwd"),fo=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,Te=fo==="win32",uo=1024,mo=(s,t)=>{if(!Te)return external_node_fs_namespaceObject.unlink(s,t);let e=s+".DELETE."+(0,external_node_crypto_namespaceObject.randomBytes)(16).toString("hex");external_node_fs_namespaceObject.rename(s,e,i=>{if(i)return t(i);external_node_fs_namespaceObject.unlink(e,t)})},po=s=>{if(!Te)return external_node_fs_namespaceObject.unlinkSync(s);let t=s+".DELETE."+(0,external_node_crypto_namespaceObject.randomBytes)(16).toString("hex");external_node_fs_namespaceObject.renameSync(s,t),external_node_fs_namespaceObject.unlinkSync(t)},vr=(s,t,e)=>s!==void 0&&s===s>>>0?s:t!==void 0&&t===t>>>0?t:e,Xt=class extends rt{[gs]=!1;[Oe]=!1;[Ri]=0;reservations=new yi;transform;writable=!0;readable=!1;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(t={}){if(t.ondone=()=>{this[gs]=!0,this[bs]()},super(t),this.transform=t.transform,this.chmod=!!t.chmod,typeof t.uid=="number"||typeof t.gid=="number"){if(typeof t.uid!="number"||typeof t.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(t.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=t.uid,this.gid=t.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;this.preserveOwner=t.preserveOwner===void 0&&typeof t.uid!="number"?process.getuid?.()===0:!!t.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth=typeof t.maxDepth=="number"?t.maxDepth:uo,this.forceChown=t.forceChown===!0,this.win32=!!t.win32||Te,this.newer=!!t.newer,this.keep=!!t.keep,this.noMtime=!!t.noMtime,this.preservePaths=!!t.preservePaths,this.unlink=!!t.unlink,this.cwd=f(external_node_path_namespaceObject.resolve(t.cwd||process.cwd())),this.strip=Number(t.strip)||0,this.processUmask=this.chmod?typeof t.processUmask=="number"?t.processUmask:Lr():0,this.umask=typeof t.umask=="number"?t.umask:this.processUmask,this.dmode=t.dmode||511&~this.umask,this.fmode=t.fmode||438&~this.umask,this.on("entry",e=>this[Dr](e))}warn(t,e,i={}){return(t==="TAR_BAD_ARCHIVE"||t==="TAR_ABORT")&&(i.recoverable=!1),super.warn(t,e,i)}[bs](){this[gs]&&this[Ri]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[Rs](t,e){let i=t[e],{type:r}=t;if(!i||this.preservePaths)return!0;let[n,o]=ce(i),h=o.replaceAll(/\\/g,"/").split("/");if(h.includes("..")||Te&&/^[a-z]:\.\.$/i.test(h[0]??"")){if(e==="path"||r==="Link")return this.warn("TAR_ENTRY_ERROR",`${e} contains '..'`,{entry:t,[e]:i}),!1;let a=external_node_path_namespaceObject.posix.dirname(t.path),l=external_node_path_namespaceObject.posix.normalize(external_node_path_namespaceObject.posix.join(a,h.join("/")));if(l.startsWith("../")||l==="..")return this.warn("TAR_ENTRY_ERROR",`${e} escapes extraction directory`,{entry:t,[e]:i}),!1}return n&&(t[e]=String(o),this.warn("TAR_ENTRY_INFO",`stripping ${n} from absolute ${e}`,{entry:t,[e]:i})),!0}[Fr](t){let e=f(t.path),i=e.split("/");if(this.strip){if(i.length=this.strip)t.linkpath=r.slice(this.strip).join("/");else return!1}i.splice(0,this.strip),t.path=i.join("/")}if(isFinite(this.maxDepth)&&i.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:t,path:e,depth:i.length,maxDepth:this.maxDepth}),!1;if(!this[Rs](t,"path")||!this[Rs](t,"linkpath"))return!1;if(t.absolute=external_node_path_namespaceObject.isAbsolute(t.path)?f(external_node_path_namespaceObject.resolve(t.path)):f(external_node_path_namespaceObject.resolve(this.cwd,t.path)),!this.preservePaths&&typeof t.absolute=="string"&&t.absolute.indexOf(this.cwd+"/")!==0&&t.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:t,path:f(t.path),resolvedPath:t.absolute,cwd:this.cwd}),!1;if(t.absolute===this.cwd&&t.type!=="Directory"&&t.type!=="GNUDumpDir")return!1;if(this.win32){let{root:r}=external_node_path_namespaceObject.win32.parse(String(t.absolute));t.absolute=r+ts(String(t.absolute).slice(r.length));let{root:n}=external_node_path_namespaceObject.win32.parse(t.path);t.path=n+ts(t.path.slice(n.length))}return!0}[Dr](t){if(!this[Fr](t))return t.resume();switch(external_node_assert_namespaceObject.equal(typeof t.absolute,"string"),t.type){case"Directory":case"GNUDumpDir":t.mode&&(t.mode=t.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[_s](t);default:return this[Cr](t)}}[O](t,e){t.name==="CwdError"?this.emit("error",t):(this.warn("TAR_ENTRY_ERROR",t,{entry:e}),this[$t](),e.resume())}[yt](t,e,i){gr(f(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:e},i)}[ge](t){return this.forceChown||this.preserveOwner&&(typeof t.uid=="number"&&t.uid!==this.processUid||typeof t.gid=="number"&&t.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[be](t){return vr(this.uid,t.uid,this.processUid)}[_e](t){return vr(this.gid,t.gid,this.processGid)}[Ts](t,e){let i=typeof t.mode=="number"?t.mode&4095:this.fmode,r=new et(String(t.absolute),{flags:ms(t.size),mode:i,autoClose:!1});r.on("error",a=>{r.fd&&external_node_fs_namespaceObject.close(r.fd,()=>{}),r.write=()=>!0,this[O](a,t),e()});let n=1,o=a=>{if(a){r.fd&&external_node_fs_namespaceObject.close(r.fd,()=>{}),this[O](a,t),e();return}--n===0&&r.fd!==void 0&&external_node_fs_namespaceObject.close(r.fd,l=>{l?this[O](l,t):this[$t](),e()})};r.on("finish",()=>{let a=String(t.absolute),l=r.fd;if(typeof l=="number"&&t.mtime&&!this.noMtime){n++;let c=t.atime||new Date,d=t.mtime;external_node_fs_namespaceObject.futimes(l,c,d,y=>y?external_node_fs_namespaceObject.utimes(a,c,d,T=>o(T&&y)):o())}if(typeof l=="number"&&this[ge](t)){n++;let c=this[be](t),d=this[_e](t);typeof c=="number"&&typeof d=="number"&&external_node_fs_namespaceObject.fchown(l,c,d,y=>y?external_node_fs_namespaceObject.chown(a,c,d,T=>o(T&&y)):o())}o()});let h=this.transform&&this.transform(t)||t;h!==t&&(h.on("error",a=>{this[O](a,t),e()}),t.pipe(h)),h.pipe(r)}[xs](t,e){let i=typeof t.mode=="number"?t.mode&4095:this.dmode;this[yt](String(t.absolute),i,r=>{if(r){this[O](r,t),e();return}let n=1,o=()=>{--n===0&&(e(),this[$t](),t.resume())};t.mtime&&!this.noMtime&&(n++,external_node_fs_namespaceObject.utimes(String(t.absolute),t.atime||new Date,t.mtime,o)),this[ge](t)&&(n++,external_node_fs_namespaceObject.chown(String(t.absolute),Number(this[be](t)),Number(this[_e](t)),o)),o()})}[Cr](t){t.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${t.type}`,{entry:t}),t.resume()}[Ar](t,e){let i=f(external_node_path_namespaceObject.relative(this.cwd,external_node_path_namespaceObject.resolve(external_node_path_namespaceObject.dirname(String(t.absolute)),String(t.linkpath)))).split("/");this[Re](t,this.cwd,i,()=>this[gi](t,String(t.linkpath),"symlink",e),r=>{this[O](r,t),e()})}[Ir](t,e){let i=f(external_node_path_namespaceObject.resolve(this.cwd,String(t.linkpath))),r=f(String(t.linkpath)).split("/");this[Re](t,this.cwd,r,()=>this[gi](t,i,"link",e),n=>{this[O](n,t),e()})}[Re](t,e,i,r,n){let o=i.shift();if(this.preservePaths||o===void 0)return r();let h=external_node_path_namespaceObject.resolve(e,o);external_node_fs_namespaceObject.lstat(h,(a,l)=>{if(a)return r();if(l?.isSymbolicLink())return n(new St(h,external_node_path_namespaceObject.resolve(h,i.join("/"))));this[Re](t,h,i,r,n)})}[kr](){this[Ri]++}[$t](){this[Ri]--,this[bs]()}[Ls](t){this[$t](),t.resume()}[Os](t,e){return t.type==="File"&&!this.unlink&&e.isFile()&&e.nlink<=1&&!Te}[_s](t){this[kr]();let e=[t.path];t.linkpath&&e.push(t.linkpath),this.reservations.reserve(e,i=>this[Nr](t,i))}[Nr](t,e){let i=h=>{e(h)},r=()=>{this[yt](this.cwd,this.dmode,h=>{if(h){this[O](h,t),i();return}this[Oe]=!0,n()})},n=()=>{if(t.absolute!==this.cwd){let h=f(external_node_path_namespaceObject.dirname(String(t.absolute)));if(h!==this.cwd)return this[yt](h,this.dmode,a=>{if(a){this[O](a,t),i();return}o()})}o()},o=()=>{external_node_fs_namespaceObject.lstat(String(t.absolute),(h,a)=>{if(a&&(this.keep||this.newer&&a.mtime>(t.mtime??a.mtime))){this[Ls](t),i();return}if(h||this[Os](t,a))return this[P](null,t,i);if(a.isDirectory()){if(t.type==="Directory"){let l=this.chmod&&t.mode&&(a.mode&4095)!==t.mode,c=d=>this[P](d??null,t,i);return l?external_node_fs_namespaceObject.chmod(String(t.absolute),Number(t.mode),c):c()}if(t.absolute!==this.cwd)return external_node_fs_namespaceObject.rmdir(String(t.absolute),l=>this[P](l??null,t,i))}if(t.absolute===this.cwd)return this[P](null,t,i);mo(String(t.absolute),l=>this[P](l??null,t,i))})};this[Oe]?n():r()}[P](t,e,i){if(t){this[O](t,e),i();return}switch(e.type){case"File":case"OldFile":case"ContiguousFile":return this[Ts](e,i);case"Link":return this[Ir](e,i);case"SymbolicLink":return this[Ar](e,i);case"Directory":case"GNUDumpDir":return this[xs](e,i)}}[gi](t,e,i,r){external_node_fs_namespaceObject[i](e,String(t.absolute),n=>{n?this[O](n,t):(this[$t](),t.resume()),r()})}},ye=s=>{try{return[null,s()]}catch(t){return[t,null]}},xe=class extends Xt{sync=!0;[P](t,e){return super[P](t,e,()=>{})}[_s](t){if(!this[Oe]){let n=this[yt](this.cwd,this.dmode);if(n)return this[O](n,t);this[Oe]=!0}if(t.absolute!==this.cwd){let n=f(external_node_path_namespaceObject.dirname(String(t.absolute)));if(n!==this.cwd){let o=this[yt](n,this.dmode);if(o)return this[O](o,t)}}let[e,i]=ye(()=>external_node_fs_namespaceObject.lstatSync(String(t.absolute)));if(i&&(this.keep||this.newer&&i.mtime>(t.mtime??i.mtime)))return this[Ls](t);if(e||this[Os](t,i))return this[P](null,t);if(i.isDirectory()){if(t.type==="Directory"){let o=this.chmod&&t.mode&&(i.mode&4095)!==t.mode,[h]=o?ye(()=>{external_node_fs_namespaceObject.chmodSync(String(t.absolute),Number(t.mode))}):[];return this[P](h,t)}let[n]=ye(()=>external_node_fs_namespaceObject.rmdirSync(String(t.absolute)));this[P](n,t)}let[r]=t.absolute===this.cwd?[]:ye(()=>po(String(t.absolute)));this[P](r,t)}[Ts](t,e){let i=typeof t.mode=="number"?t.mode&4095:this.fmode,r=h=>{let a;try{external_node_fs_namespaceObject.closeSync(n)}catch(l){a=l}(h||a)&&this[O](h||a,t),e()},n;try{n=external_node_fs_namespaceObject.openSync(String(t.absolute),ms(t.size),i)}catch(h){return r(h)}let o=this.transform&&this.transform(t)||t;o!==t&&(o.on("error",h=>this[O](h,t)),t.pipe(o)),o.on("data",h=>{try{external_node_fs_namespaceObject.writeSync(n,h,0,h.length)}catch(a){r(a)}}),o.on("end",()=>{let h=null;if(t.mtime&&!this.noMtime){let a=t.atime||new Date,l=t.mtime;try{external_node_fs_namespaceObject.futimesSync(n,a,l)}catch(c){try{external_node_fs_namespaceObject.utimesSync(String(t.absolute),a,l)}catch{h=c}}}if(this[ge](t)){let a=this[be](t),l=this[_e](t);try{external_node_fs_namespaceObject.fchownSync(n,Number(a),Number(l))}catch(c){try{external_node_fs_namespaceObject.chownSync(String(t.absolute),Number(a),Number(l))}catch{h=h||c}}}r(h)})}[xs](t,e){let i=typeof t.mode=="number"?t.mode&4095:this.dmode,r=this[yt](String(t.absolute),i);if(r){this[O](r,t),e();return}if(t.mtime&&!this.noMtime)try{external_node_fs_namespaceObject.utimesSync(String(t.absolute),t.atime||new Date,t.mtime)}catch{}if(this[ge](t))try{external_node_fs_namespaceObject.chownSync(String(t.absolute),Number(this[be](t)),Number(this[_e](t)))}catch{}e(),t.resume()}[yt](t,e){try{return _r(f(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:e})}catch(i){return i}}[Re](t,e,i,r,n){if(this.preservePaths||i.length===0)return r();let o=e;for(let h of i){o=external_node_path_namespaceObject.resolve(o,h);let[a,l]=ye(()=>external_node_fs_namespaceObject.lstatSync(o));if(a)return r();if(l.isSymbolicLink())return n(new St(o,external_node_path_namespaceObject.resolve(e,i.join("/"))))}r()}[gi](t,e,i,r){let n=`${i}Sync`;try{external_node_fs_namespaceObject[n](e,String(t.absolute)),r(),t.resume()}catch(o){return this[O](o,t)}}};var Eo=s=>{let t=new xe(s),e=s.file,i=external_node_fs_namespaceObject.statSync(e),r=s.maxReadSize||16*1024*1024;new Be(e,{readSize:r,size:i.size}).pipe(t)},wo=(s,t)=>{let e=new Xt(s),i=s.maxReadSize||16*1024*1024,r=s.file;return new Promise((o,h)=>{e.on("error",h),e.on("close",o),external_node_fs_namespaceObject.stat(r,(a,l)=>{if(a)h(a);else{let c=new _t(r,{readSize:i,size:l.size});c.on("error",h),c.pipe(e)}})})},So=K(Eo,wo,s=>new xe(s),s=>new Xt(s),(s,t)=>{t?.length&&Qi(s,t)});var yo=(s,t)=>{let e=new kt(s),i=!0,r,n;try{try{r=external_node_fs_namespaceObject.openSync(s.file,"r+")}catch(a){if(a?.code==="ENOENT")r=external_node_fs_namespaceObject.openSync(s.file,"w+");else throw a}let o=external_node_fs_namespaceObject.fstatSync(r),h=Buffer.alloc(512);t:for(n=0;no.size)break;n+=l,s.mtimeCache&&a.mtime&&s.mtimeCache.set(String(a.path),a.mtime)}i=!1,Ro(s,e,n,r,t)}finally{if(i)try{external_node_fs_namespaceObject.closeSync(r)}catch{}}},Ro=(s,t,e,i,r)=>{let n=new Wt(s.file,{fd:i,start:e});t.pipe(n),bo(t,r)},go=(s,t)=>{t=Array.from(t);let e=new wt(s),i=(n,o,h)=>{let a=(T,D)=>{T?external_node_fs_namespaceObject.close(n,E=>h(T)):h(null,D)},l=0;if(o===0)return a(null,0);let c=0,d=Buffer.alloc(512),y=(T,D)=>{if(T||D===void 0)return a(T);if(c+=D,c<512&&D)return external_node_fs_namespaceObject.read(n,d,c,d.length-c,l+c,y);if(l===0&&d[0]===31&&d[1]===139)return a(new Error("cannot append to compressed archives"));if(c<512)return a(null,l);let E=new F(d);if(!E.cksumValid)return a(null,l);let x=512*Math.ceil((E.size??0)/512);if(l+x+512>o||(l+=x+512,l>=o))return a(null,l);s.mtimeCache&&E.mtime&&s.mtimeCache.set(String(E.path),E.mtime),c=0,external_node_fs_namespaceObject.read(n,d,0,512,l,y)};external_node_fs_namespaceObject.read(n,d,0,512,l,y)};return new Promise((n,o)=>{e.on("error",o);let h="r+",a=(l,c)=>{if(l&&l.code==="ENOENT"&&h==="r+")return h="w+",external_node_fs_namespaceObject.open(s.file,h,a);if(l||!c)return o(l);external_node_fs_namespaceObject.fstat(c,(d,y)=>{if(d)return external_node_fs_namespaceObject.close(c,()=>o(d));i(c,y.size,(T,D)=>{if(T)return o(T);let E=new et(s.file,{fd:c,start:D});e.pipe(E),E.on("error",o),E.on("close",n),_o(e,t)})})};external_node_fs_namespaceObject.open(s.file,h,a)})},bo=(s,t)=>{t.forEach(e=>{e.charAt(0)==="@"?Ct({file:external_node_path_namespaceObject.resolve(s.cwd,e.slice(1)),sync:!0,noResume:!0,onReadEntry:i=>s.add(i)}):s.add(e)}),s.end()},_o=async(s,t)=>{for(let e of t)e.charAt(0)==="@"?await Ct({file:external_node_path_namespaceObject.resolve(String(s.cwd),e.slice(1)),noResume:!0,onReadEntry:i=>s.add(i)}):s.add(e);s.end()},vt=K(yo,go,()=>{throw new TypeError("file is required")},()=>{throw new TypeError("file is required")},(s,t)=>{if(!Bs(s))throw new TypeError("file is required");if(s.gzip||s.brotli||s.zstd||s.file.endsWith(".br")||s.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!t?.length)throw new TypeError("no paths specified to add/replace")});var Oo=K(vt.syncFile,vt.asyncFile,vt.syncNoFile,vt.asyncNoFile,(s,t=[])=>{vt.validate?.(s,t),To(s)}),To=s=>{let t=s.filter;s.mtimeCache||(s.mtimeCache=new Map),s.filter=t?(e,i)=>t(e,i)&&!((s.mtimeCache?.get(e)??i.mtime??0)>(i.mtime??0)):(e,i)=>!((s.mtimeCache?.get(e)??i.mtime??0)>(i.mtime??0))};
+;// CONCATENATED MODULE: external "node:buffer"
+const external_node_buffer_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:buffer");
+;// CONCATENATED MODULE: external "node:zlib"
+const external_node_zlib_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:zlib");
+var external_node_zlib_namespaceObject_0 = /*#__PURE__*/__nccwpck_require__.t(external_node_zlib_namespaceObject, 2);
+;// CONCATENATED MODULE: ./node_modules/tar/dist/esm/server/index.min.js
+var Ti=Object.defineProperty;var zi=(i,e)=>{for(var t in e)Ti(i,t,{get:e[t],enumerable:!0})};var E=i=>ArrayBuffer.isView(i)&&i[Symbol.toStringTag]==="Uint8Array",it=i=>Object.prototype.toString.call(i)==="[object ArrayBuffer]",L=i=>typeof i?.size=="number"&&typeof i.stream=="function",Pe=i=>typeof i?.getReader=="function",Oi=new TextDecoder("utf-8",{ignoreBOM:!0}),Pi=new TextEncoder,A=i=>{let e=i.length;for(let t=0;t=55296&&s<=56319&&(i.charCodeAt(t+1)&64512)===56320?(e+=2,t++):e+=2)}return e},O=(i,e=0,t=i.length)=>{let s="";for(let n=e;n=128)return Oi.decode(i.subarray(e,t));s+=String.fromCharCode(r)}return s},Fe=(i,e,t,s)=>{let{written:n}=Pi.encodeInto(i,e.subarray(t,t+s));e.fill(0,t+n,t+s)},st=(i,e,t)=>{for(let s=0;s{if(Number.isSafeInteger(i))i<0?Ni(i,e):Fi(i,e);else throw Error("cannot encode number outside of javascript safe integer range");return e},Fi=(i,e)=>{e[0]=128;for(var t=e.length;t>1;t--)e[t-1]=i&255,i=Math.floor(i/256)},Ni=(i,e)=>{e[0]=255;var t=!1;i=i*-1;for(var s=e.length;s>1;s--){var n=i&255;i=Math.floor(i/256),t?e[s-1]=Rt(n):n===0?e[s-1]=0:(t=!0,e[s-1]=At(n))}},Et=i=>{let e=i[0],t=e===128?Li(i.subarray(1,i.length)):e===255?Ui(i):null;if(t===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(t))throw Error("parsed number outside of javascript safe integer range");return t},Ui=i=>{for(var e=i.length,t=0,s=!1,n=e-1;n>-1;n--){var r=Number(i[n]),o;s?o=Rt(r):r===0?o=r:(s=!0,o=At(r)),o!==0&&(t-=o*Math.pow(256,e-n-1))}return t},Li=i=>{for(var e=i.length,t=0,s=e-1;s>-1;s--){var n=Number(i[s]);n!==0&&(t+=n*Math.pow(256,e-s-1))}return t},Rt=i=>(255^i)&255,At=i=>(255^i)+1&255;var he=i=>{let e=i.charCodeAt(0)===47,t=[];for(let r of i.split("/"))r===""||r==="."||(r!==".."?t.push(r):t.length&&t[t.length-1]!==".."?t.pop():e||t.push(r));let s=t.length&&i.charCodeAt(i.length-1)===47,n=t.join("/")+(s?"/":"");return e?"/"+n:n||(i.endsWith("/")?"./":".")},j=(...i)=>he(i.filter(e=>e).join("/")),P=i=>{let e=i.length;for(;e>1&&i.charCodeAt(e-1)===47;)e--;let t=i.lastIndexOf("/",e-1);return t===-1?".":t===0?"/":t===1&&i.charCodeAt(0)===47?"//":i.slice(0,t)},le=i=>{let e=i.length;for(;e>0&&i.charCodeAt(e-1)===47;)e--;return i.slice(i.lastIndexOf("/",e-1)+1,e)},ie=i=>i.charCodeAt(0)===47,C=(...i)=>{let e="";for(let s=i.length-1;s>=0&&!ie(e);s--){let n=i[s];n&&(e=e?n+"/"+e:n)}let t=he(e);return t.length>1&&t.endsWith("/")?t.slice(0,-1):t},D=(i,e)=>{let t=C(i).split("/"),s=C(e).split("/");t[t.length-1]||t.pop(),s[s.length-1]||s.pop();let n=0;for(;n".."),...s.slice(n)].join("/")};var nt={};zi(nt,{code:()=>Ne,isCode:()=>de,isName:()=>Di,name:()=>pe,normalFsTypes:()=>Mi});var de=i=>pe.has(i),Di=i=>Ne.has(i),Mi=new Set(["0","","1","2","3","4","5","6","7","D"]),pe=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),Ne=new Map(Array.from(pe).map(i=>[i[1],i[0]]));var _i=i=>i===void 0||i<0?void 0:i,R=class{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#e="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(e,t=0,s,n){E(e)?this.decode(e,t||0,s,n):e&&this.#t(e)}decode(e,t,s,n){if(t||(t=0),!e||!(e.length>=t+512))throw new Error("need 512 bytes for header");let r=F(e,t+156,1),o=/^[xgXLK]$/.test(r),a=o?void 0:s,c=o?void 0:n;if(this.path=a?.path??F(e,t,100),this.mode=a?.mode??c?.mode??_(e,t+100,8),this.uid=a?.uid??c?.uid??_(e,t+108,8),this.gid=a?.gid??c?.gid??_(e,t+116,8),this.size=_i(a?.size??$i(e,t+124)),this.mtime=a?.mtime??c?.mtime??rt(e,t+136,12),this.cksum=_(e,t+148,12),c&&this.#t(c,!0),a&&this.#t(a),de(r)&&(this.#e=r||"0"),this.#e==="5"&&(this.size=0),this.#e==="0"&&this.path.slice(-1)==="/"&&(this.#e="5"),this.linkpath=F(e,t+157,100),O(e,t+257,t+263)==="ustar\0")if(this.uname=a?.uname??c?.uname??F(e,t+265,32),this.gname=a?.gname??c?.gname??F(e,t+297,32),this.devmaj=a?.devmaj??c?.devmaj??_(e,t+329,8)??0,this.devmin=a?.devmin??c?.devmin??_(e,t+337,8)??0,e[t+475]!==0){let l=F(e,t+345,155);this.path=l+"/"+this.path}else{let l=F(e,t+345,130);l&&(this.path=l+"/"+this.path),this.atime=s?.atime??n?.atime??rt(e,t+476,12),this.ctime=s?.ctime??n?.ctime??rt(e,t+488,12)}let h=256;for(let l=t;l!(n==null||s==="size"&&(t||Number(n)<0)||s==="path"&&t||s==="linkpath"&&t||s==="global"))))}encode(e,t=0){if(e||(e=this.block=new Uint8Array(512)),this.#e==="Unsupported"&&(this.#e="0"),!(e.length>=t+512))throw new Error("need 512 bytes for header");let s=this.ctime||this.atime?130:155,n=Ii(this.path||"",s),r=n[0],o=n[1];this.needPax=!!n[2],this.needPax=G(e,t,100,r)||this.needPax,this.needPax=M(e,t+100,8,this.mode)||this.needPax,this.needPax=M(e,t+108,8,this.uid)||this.needPax,this.needPax=M(e,t+116,8,this.gid)||this.needPax,this.needPax=M(e,t+124,12,this.size)||this.needPax,this.needPax=ot(e,t+136,12,this.mtime)||this.needPax,e[t+156]=Number(this.#e.codePointAt(0)),this.needPax=G(e,t+157,100,this.linkpath)||this.needPax,st("ustar\x0000",e,t+257),this.needPax=G(e,t+265,32,this.uname)||this.needPax,this.needPax=G(e,t+297,32,this.gname)||this.needPax,this.needPax=M(e,t+329,8,this.devmaj)||this.needPax,this.needPax=M(e,t+337,8,this.devmin)||this.needPax,this.needPax=G(e,t+345,s,o)||this.needPax,e[t+475]!==0?this.needPax=G(e,t+345,155,o)||this.needPax:(this.needPax=G(e,t+345,130,o)||this.needPax,this.needPax=ot(e,t+476,12,this.atime)||this.needPax,this.needPax=ot(e,t+488,12,this.ctime)||this.needPax);let a=256;for(let c=t;c{let s=i,n="",r,o=i.charAt(0)==="/"?"/":".";if(A(s)<100)r=[s,n,!1];else{n=P(s),s=le(s);do A(s)<=100&&A(n)<=e?r=[s,n,!1]:A(s)>100&&A(n)<=e?r=[s.slice(0,99),n,!0]:(s=j(le(n),s),n=P(n));while(n!==o&&r===void 0);r||(r=[i.slice(0,99),"",!0])}return r},F=(i,e,t)=>{let s=e,n=Math.min(e+t,i.length);for(;sBi(_(i,e,t)),Bi=i=>i===void 0?void 0:new Date(i*1e3),_=(i,e,t)=>Number(i[e])&128?Hi(i.subarray(e,e+t)):ji(i,e,t),Hi=i=>{try{return Et(i)}catch{return}},$i=(i,e)=>{if(Number(i[e])&128)return _(i,e,12);let t=F(i,e,12);return/^ *[0-7]* *$/.test(t)&&i.subarray(e+t.length,e+12).every(s=>s===0)?parseInt(t,8)||0:void 0},Wi=i=>isNaN(i)?void 0:i,ji=(i,e,t)=>Wi(parseInt(F(i,e,t).trim(),8)),Gi={12:8589934591,8:2097151},M=(i,e,t,s)=>s===void 0?!1:s>Gi[t]||s<0?(vt(s,i.subarray(e,e+t)),!0):(Yi(i,e,t,s),!1),Yi=(i,e,t,s)=>st(qi(s,t),i,e),qi=(i,e)=>Vi(Math.floor(i).toString(8),e),Vi=(i,e)=>(i.length===e-1?i:"0".repeat(e-i.length-2)+i+" ")+"\0",ot=(i,e,t,s)=>s===void 0?!1:M(i,e,t,s.getTime()/1e3),G=(i,e,t,s)=>s===void 0?!1:(Fe(s,i,e,t),s.length!==A(s)||s.length>t);var Tt=/^\d+$/,Y=class i{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(e,t=!1){this.atime=e.atime,this.charset=e.charset,this.comment=e.comment,this.ctime=e.ctime,this.dev=e.dev,this.gid=e.gid,this.global=t,this.gname=e.gname,this.ino=e.ino,this.linkpath=e.linkpath,this.mtime=e.mtime,this.nlink=e.nlink,this.path=e.path,this.size=e.size,this.uid=e.uid,this.uname=e.uname}encode(){let e=this.encodeBody();if(e==="")return new Uint8Array(0);let t=A(e),s=512*Math.ceil(1+t/512),n=new Uint8Array(s);return new R({path:("PaxHeader/"+le(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:t,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(n),Fe(e,n,512,t),n}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(e){if(this[e]===void 0)return"";let t=this[e],s=typeof t=="object"?t.getTime()/1e3:t,n=" "+(e==="dev"||e==="ino"||e==="nlink"?"SCHILY.":"")+e+"="+s+`
+`,r=A(n),o=Math.floor(Math.log(r)/Math.log(10))+1;return r+o>=Math.pow(10,o)&&(o+=1),o+r+n}static parse(e,t,s=!1){return i.parseBytes(new TextEncoder().encode(e),t,s)}static parseBytes(e,t,s=!1){return new i(Xi(Ki(e),t),s)}},Xi=(i,e)=>e?Object.assign({},e,i):i,Ki=i=>{let e=Object.create(null),t=0;for(;t=48&&i[s]<=57;)s++;let n=t+Number(O(i,t,s));if(s===t||i[s]!==32||n<=s+1||n>i.length||i[n-1]!==10)throw new Error("invalid PAX record");Zi(e,O(i,s+1,n-1)),t=n}return e},Zi=(i,e)=>{let t=e.split("=");if(t.length===1)throw new Error("invalid PAX record");let s=t.shift();if(!s)return i;let n=s.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),r=t.join("="),o=r.indexOf("\0"),a=o===-1?r:r.slice(0,o);switch(n){case"path":case"linkpath":case"type":case"charset":case"comment":case"gname":case"uname":i[n]=a;break;case"ctime":case"atime":case"mtime":let c=new Date(Number(a)*1e3);isNaN(c.getTime())||(i[n]=c);break;case"size":if(!Tt.test(r)||!Number.isSafeInteger(+r))throw new Error("invalid PAX size");i[n]=+r;break;case"gid":case"uid":case"dev":case"ino":case"nlink":case"mode":if(!Tt.test(a.trim()))break;let h=+a;if(!Number.isSafeInteger(h))break;i[n]=h;break}return i};var T={name:"gzip",headLength:2,detect:i=>i[0]===31&&i[1]===139,decompress:()=>new DecompressionStream("gzip"),compress:i=>{let e=new CompressionStream("gzip");if(!i?.portable)return e;let t=0;return{writable:e.writable,readable:e.readable.pipeThrough(new TransformStream({transform:(s,n)=>{t<=9&&t+s.length>9&&(s[9-t]=255),t+=s.length,n.enqueue(s)}}))}}};var zt={C:"cwd",f:"file",z:"gzip",P:"preservePaths",U:"unlink","strip-components":"strip",stripComponents:"strip","keep-newer":"newer",keepNewer:"newer","keep-newer-files":"newer",keepNewerFiles:"newer",k:"keep","keep-existing":"keep",keepExisting:"keep",m:"noMtime","no-mtime":"noMtime",p:"preserveOwner",L:"follow",h:"follow",onentry:"onEntry",onReadEntry:"onEntry"},y=i=>{let e=Object.assign(Object.create(null),i);for(let[t,s]of Object.entries(zt))e[t]!==void 0&&(e[s]??=e[t]),delete e[t];return e.noChmod===!1&&(e.chmod??=!0),delete e.noChmod,e};var N=i=>{if(i.length===1)return i[0].slice();let e=0;for(let n of i)e+=n.length;let t=new Uint8Array(e),s=0;for(let n of i)t.set(n,s),s+=n.length;return t};var k=(i,e)=>Object.assign(Object.create(null),i,e),q=(i,e,t)=>{if(e==null||e===0)return t;if(e===1/0||Number.isInteger(e)&&Number(e)>0)return e;throw new TypeError(`${i} must be a positive integer`)};var Ji=new Set(["File","OldFile","Link","SymbolicLink","CharacterDevice","BlockDevice","Directory","FIFO","ContiguousFile","GNUDumpDir"]),Ue=i=>i.replaceAll("\\","/"),V=class{header;extended;globalExtended;type;path;mode;uid;gid;uname;gname;size;mtime;atime;ctime;linkpath;devmaj;devmin;dev;ino;nlink;absolute;ignore;invalid=!1;unsupported=!1;constructor(e,t,s,n=!1){if(!e.path)throw new Error("no path provided for tar.ReadEntry");this.header=e,this.extended=t,this.globalExtended=s,this.type=e.type,this.ignore=!Ji.has(this.type),this.path=n?Ue(e.path):e.path,this.mode=e.mode&&e.mode&4095,this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,this.size=e.size??0,this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime;let r=this.type==="Link"||this.type==="SymbolicLink";this.linkpath=r&&e.linkpath?n?Ue(e.linkpath):e.linkpath:void 0,this.devmaj=e.devmaj,this.devmin=e.devmin,s&&this.#e(s),t&&(this.#e(t),t.path!=null&&(this.path=n?Ue(t.path):t.path),r&&t.linkpath!=null&&(this.linkpath=n?Ue(t.linkpath):t.linkpath))}#e(e){e.uid!=null&&(this.uid=e.uid),e.gid!=null&&(this.gid=e.gid),e.uname!=null&&(this.uname=e.uname),e.gname!=null&&(this.gname=e.gname),e.mtime!=null&&(this.mtime=e.mtime),e.atime!=null&&(this.atime=e.atime),e.ctime!=null&&(this.ctime=e.ctime),e.dev!=null&&(this.dev=e.dev),e.ino!=null&&(this.ino=e.ino),e.nlink!=null&&(this.nlink=e.nlink)}},Ot=new TextDecoder,Pt=i=>{let e="";for(let t of i)e+=Ot.decode(t,{stream:!0});return e+Ot.decode()},Ft=()=>new TypeError("Body has already been consumed"),fe=class extends V{#e;#t=!1;#i;constructor(e,t,s,n,r){super(e,t,s,n),this.#e=r}get bodyUsed(){return this.#t}get body(){if(this.#i)return this.#i;let e=!1;return this.#i=new ReadableStream({pull:async t=>{e||(this.#s(),e=!0);let[s]=await this.#n(1);s?t.enqueue(s):t.close()}},{highWaterMark:0})}#s(){if(this.#t)throw Ft();this.#t=!0}#r(e,t=1/0){let s=this.#e;for(;s&&e.length(i.file&&(s.file=i.file),s.code=typeof t=="object"&&t.code||e,s.tarCode=e,s),me=(i,e,t,s={})=>Object.assign(typeof t=="object"?t:new Error(`${e}: ${t}`),Nt(i,e,t,s)),S=(i,e,t,s={})=>{let n=Object.hasOwn(s,"recoverable")&&s.recoverable===!1;if(i.strict||n)throw me(i,e,t,s);Nt(i,e,t,s),typeof t=="object"&&(s=Object.assign(t,s),t=t.message),i.onwarn?.(e,t,s)};var Ut=0,X=1,Le=2,Ce=3,Lt=4,at={type:"entryEnd"},Qi={type:"end"},es=new Set(["ExtendedHeader","OldExtendedHeader","GlobalExtendedHeader","NextFileHasLongPath","NextFileHasLongLinkpath"]),ts=new Set(["Link","SymbolicLink","CharacterDevice","BlockDevice","FIFO","TapeVolumeHeader"]),Ct=i=>{let e=i.indexOf(0);return O(i,0,e===-1?i.length:e)},I=class{maxMetaEntrySize;position=0;offset=0;#e;#t;#i;#s=[];#r;#n=0;#a;#o=0;#c=Ut;#h;#p;#y;#x=0;#f=0;#l=0;#u;#w;#k;#E;#S=!1;#g;#b=!1;#m=!1;#v=0;constructor(e={},t){e=this.#e=k(e),this.maxMetaEntrySize=e.maxMetaEntrySize||1024*1024,this.#t=e.filter;let s=e.platform==="win32";this.#i=t??((n,r,o)=>new V(n,r,o,s))}warn(e,t,s){S(this.#e,e,t,s)}push(e){this.#S||this.#s.push(e)}end(){this.#S=!0}get bodyRemain(){let e=this.#r,t=this.#c;return t!==Le&&t!==Ce||this.#s.length||e&&this.#n=512)this.#n=t+512,l=this.#T(e,t);else{let d=this.#a??=new Uint8Array(512),p=Math.min(512-this.#o,s);if(d.set(e.subarray(t,t+p),this.#o),this.#n=t+p,this.#o+=p,this.#o<512)continue;this.#o=0,l=this.#T(d,0)}if(l)return l;continue}let r=this.#l,o=sX){let t=this.#h,s=(512-this.#l%512)%512,n=this.#l+s;this.#h=void 0,this.#y=void 0,this.#c=X,!t?.invalid&&!this.#b&&(this.#g=!0),this.#b=!1,this.#m=e===Le,this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${n} more bytes, only ${s} available)`,{entry:t,header:this.#p});return}return this.#m?(this.#m=!1,at):(this.#v===0&&(this.#v=1,(e===Ut||this.#g===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")),this.#v=2,Qi)}#T(e,t){this.offset+=512,this.#g===void 0&&(this.#g=!1);let s=this.#u,n=this.#w,r=this.#k;(n!==void 0||r!==void 0)&&(s=Object.assign(Object.create(null),s),s.path??=n,s.linkpath??=r);let o=new R(e,t,s,this.#E);if(o.nullBlock){this.#S=!0,this.#r=void 0,this.#s.length=0,this.#o=0,this.#c=X;return}let a=o.type,c=es.has(a);if(!o.cksumValid){this.#A(o,"checksum failure",!1);return}let h=O(e,t+257,t+265);e[t+345]&&h.startsWith("ustar")&&h[5]!=="\0"&&h!=="ustar \0"&&this.#d("prefix with an unknown ustar magic",o);let l=o.size;if(l===void 0&&this.#d("invalid size",o),(l&&ts.has(a)||a==="Directory"&&s?.size)&&this.#d(`${a} entry with a body`,o),l&&!c&&a!=="GNUDumpDir"&&o.path?.endsWith("/")&&this.#d("entry with a body and a directory name",o),!o.path&&!c){this.#A(o,"path is required",!0);return}if((a==="Link"||a==="SymbolicLink")&&!(s?.linkpath??o.linkpath)){this.#A(o,"linkpath required",!0);return}if(this.#p=o,this.#f=l,this.#l=512*Math.ceil(l/512),l||(this.#g=!0),c){l>this.maxMetaEntrySize&&this.#d(`${a} entry larger than maxMetaEntrySize`,o),(a==="NextFileHasLongPath"?n!==void 0:a==="NextFileHasLongLinkpath"?r!==void 0:a!=="GlobalExtendedHeader"&&this.#u)&&this.#d(`two ${a} entries for one entry`,o),this.#u&&a.startsWith("NextFile")&&this.#d(`${a} entry after a PAX header`,o),l>0&&(this.#y=new Uint8Array(l),this.#x=0,this.#c=Lt);return}this.#u=this.#w=this.#k=void 0;let d=this.#i(o,s,this.#E);return!d.ignore&&this.#t&&!this.#t(d.path,d)&&(d.ignore=!0),l?(this.#h=d,this.#c=d.ignore?Ce:Le):(this.#c=X,this.position=this.offset,this.#m=!d.ignore),{type:"entry",entry:d}}#A(e,t,s){this.#u=this.#w=this.#k=void 0;let n=s?e.size:0;n&&(this.#p=e,this.#f=n,this.#l=512*Math.ceil(n/512),this.#c=Ce,this.#b=!0),this.warn("TAR_ENTRY_INVALID",t,{header:e})}#d(e,t){throw this.#S=!0,this.#r=this.#y=void 0,this.#s.length=0,this.#o=0,this.#c=X,this.#v=2,me(this.#e,"TAR_BAD_ARCHIVE",e,{header:t,recoverable:!1})}#O(e){let t=this.#p,s=t.type;if(s==="NextFileHasLongPath"){this.#w=Ct(e);return}if(s==="NextFileHasLongLinkpath"){this.#k=Ct(e);return}let n=s==="GlobalExtendedHeader",r;try{r=Y.parseBytes(e,n?this.#E:void 0,n)}catch(o){this.#d(o.message,t)}if(!n){(r.path!==void 0&&this.#w!==void 0||r.linkpath!==void 0&&this.#k!==void 0)&&this.#d("PAX name after a GNU long name",t),this.#u=r;return}(r.size!==void 0||r.path!==void 0||r.linkpath!==void 0)&&this.#d("size or path in a global PAX header",t),this.#E=r}};var is=16*1024*1024,Dt=64*1024,ss=1024*1024,Me=Symbol.for("tar.readFile.skip"),De=class{pos=0;size=0;#e;#t=Dt;constructor(e){this.#e=q("maxReadSize",e,is)}next(){let e=Math.min(this.#t,this.#e,this.size-this.pos);return this.#t*=2,e}skip(e){return ethis.size?!1:(this.pos+=e,this.#t=Dt,!0)}};async function*ns(i,e,t){let s=await i.open(e,"r");try{t.size=(await s.stat()).size;for(let n;n=t.next();){let r=new Uint8Array(n),{bytesRead:o}=await s.read(r,0,n,t.pos);if(!o)break;t.pos+=o,yield o{})}}function*rs(i,e,t){let s=i.openSync(e,"r");try{t.size=i.fstatSync(s).size;for(let n;n=t.next();){let r=new Uint8Array(n),o=i.readSync(s,r,0,n,t.pos);if(!o)break;t.pos+=o,yield o{let s=new De(t);return Object.assign(ns(i,e,s),{[Me]:n=>s.skip(n)})},H=(i,e,t)=>{let s=new De(t);return Object.assign(rs(i,e,s),{[Me]:n=>s.skip(n)})};var ct=()=>{},ye=i=>Math.max(512,...i.map(e=>e.headLength)),os=i=>{try{let e=new R(i);return e.cksumValid||e.nullBlock}catch{return!1}},ge=(i,e,t="")=>i.find(s=>s.detect(e))??(os(e)?void 0:i.find(s=>s.extensions?.some(n=>t.endsWith(n)))),Mt=i=>typeof i.maxDecompressionRatio=="number"?i.maxDecompressionRatio:1e3,_e=(i,e)=>me(i,"TAR_ABORT",e,{recoverable:!1}),_t=(i,e,t)=>_e(i,new Error(`max decompression ratio exceeded: ${e.toFixed(2)} > ${t}`)),as=()=>new TypeError("The body of an entry cannot be read after a later entry"),we=class{parser;current;ended=!1;constructor(e){this.parser=e}entry(){if(this.current=void 0,this.ended)return null;for(let e;e=this.parser.next();){if(e.type==="end")return this.ended=!0,null;if(e.type==="entry"&&!e.entry.ignore)return this.current=e.entry}}body(e){if(e!==this.current)throw as();let t=this.parser.next();if(t)return t.type==="body"?t.data:(this.current=void 0,null)}},It=(i,e)=>{if(i.current)return;let t=i.parser.bodyRemain;t&&e[Me]?.(t)&&i.parser.skipBody()},cs=i=>{if(E(i))return[i].values();if(it(i))return[new Uint8Array(i)].values();if(L(i)&&(i=i.stream()),Pe(i)){let e=i.getReader();return{next:()=>e.read(),return:()=>e.cancel()}}return Symbol.asyncIterator in i?i[Symbol.asyncIterator]():i[Symbol.iterator]()},b=class{parser;#e;#t;#i;#s;#r;#n;#a=!1;constructor(e,t={}){t=k(t);let s=t.platform==="win32";this.parser=new I(t,(n,r,o)=>new fe(n,r,o,s,this)),this.#e=new we(this.parser),this.#t=t,this.#i=cs(e)}poll(){return this.#a?null:this.#e.entry()}readBody(e){return this.#e.body(e)}fill(){return this.#n??=this.#o()}async#o(){try{let e=this.#s??=await this.#c(this.#i),t=this.#r;this.#r=void 0,e===this.#i&&It(this.#e,e);let s=t?{value:t,done:!1}:await e.next();s.done?this.parser.end():this.parser.push(s.value)}finally{this.#n=void 0}}async#c(e){let t=this.#t,s=[...t.codecs??[],T],n=ye(s),r;for(;!r||r.length{try{for(;;){if(await d.ready,f)return;let m=r?{value:r,done:!1}:await e.next();if(r=void 0,f)return;if(m.done)return await d.close();a+=m.value.length,await d.write(m.value)}}catch(m){f||await d.abort(m).catch(ct)}})();let u=Mt(t);return{next:async()=>{let m=await p.read().catch(g=>{throw _e(t,g)});if(!m.done){c+=m.value.length;let g=c/a;if(g>u)throw _t(t,g,u)}return m},return:async()=>(f=!0,await p.cancel().catch(ct),await d.abort().catch(ct),await e.return?.(),{value:void 0,done:!0})}}async next(){try{for(;;){let e=this.poll();if(e)return{value:e,done:!1};if(e===null)break;await this.fill()}}catch(e){throw await this.return(),e}return this.return()}async return(){return this.#a||(this.#a=!0,this.#e.current=void 0,await(this.#s??this.#i).return?.()),{value:void 0,done:!0}}[Symbol.asyncIterator](){return this}},v=class{parser;#e;#t;#i;#s;#r;#n=!1;constructor(e,t={}){t=k(t);let s=t.platform==="win32";this.parser=new I(t,(n,r,o)=>new ue(n,r,o,s,this)),this.#e=new we(this.parser),this.#t=t,this.#i=E(e)?[e].values():it(e)?[new Uint8Array(e)].values():e[Symbol.iterator]()}readBody(e){for(;;){let t=this.#e.body(e);if(t!==void 0)return t;this.#a()}}#a(){let e=this.#s??=this.#o(this.#i),t=this.#r;this.#r=void 0,e===this.#i&&It(this.#e,e);let s=t?{value:t,done:!1}:e.next();s.done?this.parser.end():this.parser.push(s.value)}#o(e){let t=this.#t,s=[...t.codecs??[],T],n=ye(s),r,o;for(;(!r||r.lengthd)throw _t(t,f,d);return[p].values()}next(){try{for(;;){let e=this.#n?null:this.#e.entry();if(e)return{value:e,done:!1};if(e===null)break;this.#a()}}catch(e){throw this.return(),e}return this.return()}return(){return this.#n||(this.#n=!0,this.#e.current=void 0,(this.#s??this.#i).return?.()),{value:void 0,done:!0}}[Symbol.iterator](){return this}},ht=(i,e)=>new b(i,e),Bt=(i,e)=>new v(i,e);var Ht=(i,e,t)=>(i&=4095,t&&(i=(i|384)&-19),e&&(i&256&&(i|=64),i&32&&(i|=8),i&4&&(i|=1)),i);var Ie=["|","<",">","?",":"],lt=Ie.map(i=>String.fromCodePoint(61440+Number(i.codePointAt(0)))),hs=new Map(Ie.map((i,e)=>[i,lt[e]])),ls=new Map(lt.map((i,e)=>[i,Ie[e]])),dt=i=>Ie.reduce((e,t)=>e.split(t).join(hs.get(t)),i),$t=i=>lt.reduce((e,t)=>e.split(t).join(ls.get(t)),i);var K=i=>i===47||i===92,ds=i=>i>=65&&i<=90||i>=97&&i<=122,$=i=>{let e=i.length,t=0;if(K(i.charCodeAt(0))){if(t=1,K(i.charCodeAt(1))){let s=2,n=s;for(;sK(i.charCodeAt(0))||$(i).length===3,Be=(i,e)=>{let t=xe(e)?e:i+"/"+e,s=$(t);return s+C("/",t.slice(s.length)).slice(1)},jt=i=>{let e=$(i),t=P(i.slice(e.length));return t==="."?e:e+t};var He=i=>{let e="";for(let t;t=$(i);)i.charAt(0)==="/"&&i.slice(0,4)!=="//?/"&&(t="/"),i=i.slice(t.length),e+=t;return[e,i]};var $e=i=>new ReadableStream({pull:async e=>{let t=await i.next();t.done?e.close():e.enqueue(t.value)},cancel:async()=>{await i.return?.()}},{highWaterMark:0});var Z=i=>{let e=i.length-1,t=-1;for(;e>-1&&i.charAt(e)==="/";)t=e,e--;return t===-1?i:i.slice(0,t)};var ps=new TextEncoder,Gt=(i,e)=>e?Z(e)+"/"+i.replace(/^\.(\/|$)/,""):i,se=class{path;type;mode;uid;gid;uname;gname;size;mtime;atime;ctime;linkpath;dev;ino;nlink;body;absolute;header;constructor(e,t){if(e.type==="Unsupported")throw new Error("writing entry that should be ignored");if(typeof t=="string"&&(t=ps.encode(t)),this.path=e.path,this.type=e.type??"File",this.mode=e.mode,this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,e.size===void 0&&t!==void 0&&!E(t)&&!L(t))throw new TypeError("a stream body needs the size option");this.size=e.size??(E(t)?t.length:L(t)?t.size:0),this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime,this.linkpath=e.linkpath,this.dev=e.dev,this.ino=e.ino,this.nlink=e.nlink,this.body=t}encode(e={},t=new Uint8Array(512)){e=k(e);let s=Gt(this.path,e.prefix),n=this.type==="Link"&&this.linkpath!==void 0?Gt(this.linkpath,e.prefix):this.linkpath,{uid:r,gid:o,uname:a,gname:c,size:h,mtime:l,atime:d,ctime:p}=this;if(this.header=new R({path:s,linkpath:n,mode:this.mode,uid:r,gid:o,size:h,mtime:l,type:this.type,uname:a,gname:c,atime:d,ctime:p}),!this.header.encode(t)||e.noPax)return[t];let{dev:f,ino:w,nlink:u}=this;return[new Y({atime:d,ctime:p,gid:o,gname:c,mtime:l,path:s,linkpath:n,size:h,uid:r,uname:a,dev:f,ino:w,nlink:u}).encode(),t]}};var fs=16*1024*1024,z=()=>{},ke=i=>512*Math.ceil(i/512),J=i=>i.replaceAll("\\","/"),pt=i=>`${i.dev}:${i.ino}`,We={bigint:!0},us=({dev:i,ino:e})=>!Number.isSafeInteger(i)||!Number.isSafeInteger(e),je=(i,e)=>i.dev===e.dev&&i.ino===e.ino,ft=(i,e)=>Object.assign(new Error(i),{path:e,syscall:"read",code:"EOF"}),Kt=(i,e)=>ft(`encountered unexpected EOF: ${i} has fewer than the ${e} bytes of its stat`,i),Zt=(i,e)=>ft(`did not encounter expected EOF: ${i} has more than the ${e} bytes of its stat`,i),Jt=i=>i.absolute??i.path,ms=i=>Object.assign(new Error("writing more data than expected"),{path:Jt(i)}),Qt=i=>Symbol.asyncIterator in i||Symbol.iterator in i,ws=i=>typeof i.encode=="function",U=class{path;absolute;up;linkpath;ready;constructor(e,t){this.path=e,this.absolute=t}},Se=class{opt;fs;cwd;win32;maxReadSize;header;codec;codecOptions;ended=!1;head;tail;wake;#e=new Map;constructor(e,t){e=this.opt=k(e),this.fs=e.fs,this.win32=e.platform==="win32",this.maxReadSize=q("maxReadSize",e.maxReadSize,fs);let{prefix:s,noPax:n}=e;this.header={prefix:s&&this.win32?J(s):s,noPax:n};let r=e.cwd&&(this.win32?J(e.cwd):e.cwd);if(r&&!(this.win32?xe:ie)(r))throw new TypeError("cwd must be an absolute path");this.cwd=r&&this.#t(r,"");let o=e,a=["gzip","brotli","zstd","compress"].filter(h=>o[h]);if(a.length>1)throw new TypeError(`${a.join(", ")} are mutually exclusive`);let[c]=a;if(c){let h=e.compress,[l,d]=h?Array.isArray(h)?h:[h]:[[...e.codecs??[],T].find(p=>p.name===c),o[c]];if(!l?.[t])throw new TypeError(`no codec named ${l?.name??c} has a ${t} function`);this.codec=l,this.codecOptions={...typeof d=="object"?d:void 0,...l.name==="gzip"&&e.portable?{portable:!0}:void 0}}}#t(e,t){return this.win32?Be(e,t):C(e,t)}resolve(e){if(!this.cwd||!this.fs)throw new TypeError("a path needs the cwd and fs options");return this.#t(this.cwd,this.win32?J(e):e)}add(e){if(this.ended)throw new Error("write after end");if(typeof e!="string")this.push(e);else{let t=this.win32?J(e):e;this.push(new U(t||"./",this.resolve(t)))}return this}end(){return this.ended=!0,this.wake?.(),this}push(e){let t={item:e};this.tail?this.tail.next=t:this.head=t,this.tail=t,this.wake?.()}shift(){this.head=this.head?.next,this.head||(this.tail=void 0)}needsExact(e){return us(e)&&(e.isDirectory()?!!this.opt.follow:e.isFile()&&e.nlink>1)}plan(e,t,s){let{filter:n}=this.opt;if(!(n&&!n(e.path,t))){if(t.isDirectory()){for(let r=e.up;r;r=r.up)if(r.key===pt(s)){S(this.opt,"TAR_ENTRY_ERROR","directory is its own ancestor",{path:e.path,absolute:e.absolute});return}return"Directory"}if(t.isSymbolicLink())return"SymbolicLink";if(!t.isFile()){S(this.opt,"TAR_ENTRY_UNSUPPORTED","unsupported file type",{path:e.path,absolute:e.absolute});return}if(t.nlink>1){let r=pt(s),o=this.#e.get(r),a=this.cwd;if(o!==e.absolute&&o?.startsWith(a.endsWith("/")?a:a+"/"))return e.linkpath=D(a,o),"Link";this.#e.set(r,e.absolute)}return"File"}}children(e,t,s){let n=e.path==="./"?"":e.path.replace(/\/*$/,"/"),r=e.absolute.endsWith("/")?e.absolute:e.absolute+"/",o=this.opt.follow?{key:pt(s),up:e.up}:void 0;return[...t].sort().map(a=>{let c=new U(n+a,r+a);return c.up=o,c})}missing(e,t){if(t?.code!=="ENOENT")throw t;S(this.opt,"TAR_ENTRY_ERROR",t,{path:e.path,absolute:e.absolute})}changed(e,t){S(this.opt,"TAR_ENTRY_ERROR",t==="Directory"?"directory changed between lstat and readdir":"file changed between lstat and open",{path:e.path,absolute:e.absolute})}pathEntry(e,t,s,n,r){let{processUid:o,processUname:a=""}=this.opt,c=new se({path:e.path,type:s,mode:t.mode,uid:t.uid,gid:t.gid,uname:t.uid===o?a:"",size:s==="File"?t.size:0,mtime:t.mtime,atime:t.atime,ctime:t.ctime,linkpath:n&&this.win32?J(n):n,dev:t.dev,ino:t.ino,nlink:t.nlink},r);return c.absolute=e.absolute,this.#i(c,!0)}addedEntry(e){if(ws(e))return this.#i(e,!1);let{filter:t}=this.opt;if(!(t&&!t(e.path,e)))return this.#i(new se(e,e.body),!1)}#i(e,t){let{opt:s,win32:n}=this,r=e.type==="Directory";n&&!t&&(e.path=J(e.path),e.linkpath&&(e.linkpath=J(e.linkpath)));let[o,a]=s.preservePaths?["",e.path]:He(e.path);return e.path=a,t&&(n&&(e.path=$t(e.path)),e.path===""&&(e.path="./")),o&&S(s,"TAR_ENTRY_INFO",`stripping ${o} from absolute path`,{entry:e,path:o+e.path}),t&&r&&!e.path.endsWith("/")&&(e.path+="/"),s.portable&&(e.uid=e.gid=e.dev=e.ino=e.nlink=void 0,e.uname=e.gname=void 0,e.atime=e.ctime=void 0),e.mode!==void 0&&(e.mode=Ht(e.mode,r,!!s.portable)),e.mtime=s.noMtime||s.portable&&r?void 0:s.mtime||e.mtime,e}},Yt=async(i,e,t,s,n,r)=>{for(;tn-s)throw Zt(r,n);t+=o,s+=o}return s},qt=(i,e,t,s,n,r,o)=>{for(;sr-n)throw Zt(o,r);s+=a,n+=a}return n};async function*ys(i){if(E(i))yield i;else if(L(i)||Pe(i)){let e=(L(i)?i.stream():i).getReader();try{for(;;){let t=await e.read();if(t.done)break;yield t.value}}finally{await e.cancel().catch(z)}}else i&&(yield*i)}function*gs(i){if(E(i))yield i;else if(i&&Symbol.iterator in i)yield*i;else if(i)throw new TypeError("PackSync needs a body that is a string, a Uint8Array, or an iterable")}var ei=(i,e,t)=>{if(t.length>e)throw ms(i);return e-t.length},ti=(i,e)=>{if(e)throw ft("encountered unexpected EOF",Jt(i));return new Uint8Array(ke(i.size)-i.size)};async function*Vt(i){if(!i.size)return;let e=i.size;for await(let s of ys(i.body))e=ei(i,e,s),yield s;let t=ti(i,e);t.length&&(yield t)}function*Xt(i){if(!i.size)return;let e=i.size;for(let s of gs(i.body))e=ei(i,e,s),yield s;let t=ti(i,e);t.length&&(yield t)}var be=class extends Se{jobs;#e;#t=Promise.resolve();constructor(e={}){super(e,"compress"),this.jobs=q("jobs",this.opt.jobs,4)}async next(){let e=await(this.#e??=this.#i()).next();return e.done?{value:void 0,done:!0}:e}async return(){return this.end(),await this.#e?.return(),{value:void 0,done:!0}}[Symbol.asyncIterator](){return this}#i(){let{codec:e}=this;return e?.compress?this.#s(e.compress(this.codecOptions)):this.#r()}async*#s(e){let t=this.#r(),s,n=$e({next:()=>t.next().catch(r=>{throw s={er:r},n.cancel().catch(z),r})}).pipeThrough(e).getReader();try{for(;;){let r=await n.read();if(s)throw s.er;if(r.done)break;yield r.value}}finally{await n.cancel().catch(z),await t.return()}}async*#r(){try{for(;;){let e=this.head;if(!e){if(this.ended)break;await new Promise(s=>this.wake=s);continue}this.#n();let{item:t}=e;if(t instanceof U)yield*this.#c(t);else if(!Qt(t))yield*this.#p(t);else for await(let s of t)yield*this.#p(s);this.shift()}yield new Uint8Array(1024)}finally{for(let e=this.head;e;e=e.next){let{item:t}=e;if(!(t instanceof U)||!t.ready)break;await(await t.ready.catch(z))?.handle?.close().catch(z)}}}#n(){let e=this.fs,t=this.head;for(let s=0;t&&sr).then(([a,c])=>{let h=this.plan(n,a,c);return h&&{load:this.#o(e,n,a,c,h)}},a=>this.missing(n,a));this.#t=o.catch(z),n.ready=o.then(a=>a?.load),n.ready.catch(z)}}async#a(e,t){let{follow:s}=this.opt,n=await(s?e.stat(t):e.lstat(t)),r=this.needsExact(n)?await(s?e.stat(t,We):e.lstat(t,We)):n;return[n,r]}async#o(e,t,s,n,r){let{absolute:o}=t,{follow:a,noDirRecurse:c}=this.opt,h={stat:s,id:n,type:r};if(r==="SymbolicLink")h.linkpath=await e.readlink(o);else if(r==="Directory"&&!c)h.names=await e.readdir(o),h.changed=!a&&!je(s,await e.lstat(o));else if(r==="File"&&s.size){let l=await e.open(o,"r");try{let{size:d}=s,p=ke(d);!a&&!je(s,await l.stat())?h.changed=!0:p>this.maxReadSize?h.handle=l:(h.buf=new Uint8Array(512+p),await Yt(l,h.buf,512,0,d,o))}catch(d){throw await l.close().catch(z),d}h.handle||await l.close()}return h}async*#c(e){let t=await e.ready;if(!t)return;let{stat:s,id:n,type:r,names:o,buf:a,handle:c}=t;if(t.changed)return this.changed(e,r);let h=!1;try{let l=a?a.subarray(512,512+s.size):c&&this.#h(c,s.size,e.absolute),d=this.pathEntry(e,s,r,t.linkpath??e.linkpath,l);if(o)for(let f of this.children(e,o,n))this.push(f);await this.opt.onWriteEntry?.(d);let p=a&&d.body===l&&d.size===s.size;yield*d.encode(this.header,p?a:void 0),p||(yield*Vt(d)),h=!0}finally{if(c){t.handle=void 0;let l=c.close();await(h?l:l.catch(z))}}}async*#h(e,t,s){let n=ke(t);for(let r=0;rthis.maxReadSize?p=this.#r(s,f,g,n):(d=new Uint8Array(512+bt),qt(s,f,d,512,0,g,n),p=d.subarray(512,512+g))}let u=this.pathEntry(e,a,h,l,p);this.opt.onWriteEntry?.(u);let m=d&&u.body===p&&u.size===a.size;yield*u.encode(this.header,m?d:void 0),m||(yield*Xt(u)),w=!0}finally{if(f!==void 0&&!w)try{s.closeSync(f)}catch{}}f!==void 0&&s.closeSync(f)}*#r(e,t,s,n){let r=ke(s);for(let o=0;o{},ut=(i,e)=>{if(!e?.length)throw new TypeError("no paths specified to add to archive");if(i.file&&!i.fs)throw new TypeError("the file option needs the fs option")},ii=async(i,e,t,s)=>{for(let n=0;n{let s=new Uint8Array(Ge),n=0,r=async()=>{await ii(i,s,n,t),t+=n,n=0};for await(let o of e)(n+o.length>Ge||o.length>=Ee)&&await r(),o.length>=Ee?(await ii(i,o,o.length,t),t+=o.length):(s.set(o,n),n+=o.length);await r()},wt=(i,e,t,s)=>{let n=new Uint8Array(Ge),r=0,o=(a,c)=>{for(let h=0;hGe||a.length>=Ee)&&(o(n,r),r=0),a.length>=Ee?o(a,a.length):(n.set(a,r),r+=a.length);o(n,r)},ks=async(i,e,t,s)=>{let n=await e.open(t,"w",s),r=!1;try{await mt(n,i,0),r=!0}finally{let o=n.close();await(r?o:o.catch(xs))}},Ye=(i,e)=>{let{fs:t,strict:s,onwarn:n,codecs:r,platform:o}=i,a=new be(i);for(let c of e)if(typeof c!="string"||c.charAt(0)!=="@")a.add(c);else{let h=a.resolve(c.slice(1));a.add(new b(B(t,h,i.maxReadSize),{strict:s,onwarn:n,codecs:r,platform:o,file:h}))}return a.end()},yt=(i,e)=>{let{strict:t,onwarn:s,codecs:n,platform:r}=i,o=new ve(i);for(let a of e)if(typeof a!="string"||a.charAt(0)!=="@")o.add(a);else{let c=o.resolve(a.slice(1));o.add(new v(H(i.fs,c,i.maxReadSize),{strict:t,onwarn:s,codecs:n,platform:r,file:c}))}return o};function ne(i,e){let t=y(i);if(!t.file)return ut(t,e),$e(Ye(t,e));try{return ut(t,e),ks(Ye(t,e),t.fs,t.file,t.mode||438)}catch(s){return Promise.reject(s)}}function qe(i,e){let t=y(i);ut(t,e);let{file:s}=t,n=t.fs,r=yt(t,e);if(!s)return r;let o=n.openSync(s,"w",t.mode||438);try{wt(n,o,r,0)}catch(a){try{n.closeSync(o)}catch{}throw a}n.closeSync(o)}var Q=(i,e)=>{let t=new Set(i.map(o=>Z(o))),s=new Set(t),n=0;for(let o of t)n=Math.max(n,o.length);let r=o=>{let a=Z(o),c=a.charAt(0)==="/"?"/":".",h=!1;for(let l=a.length;l>0;l=a.lastIndexOf("/",l-1)){if(l>n)continue;let d=a.slice(0,l);if(!(d===c||!t.has(d))&&(h=!0,s.delete(d),!s.size))break}return h};return[(o,a)=>{let c=!e||e(o,a);return r(o)&&c},o=>{for(let a of s)S(o,"TAR_ENTRY_ERROR",`${a}: not found in archive`,{path:a})}]},si=()=>new TypeError("list needs input, or file and fs"),Ve=async(i,e)=>{let t=y(i),{input:s,file:n,fs:r,onEntry:o}=t,a=s??(n&&r?B(r,n,t.maxReadSize):void 0);if(!a)throw si();let[c,h]=e?.length?Q(e,t.filter):[];c&&(t.filter=c);let l=new b(a,t);try{for(;;){let d=l.poll();if(d===null)break;d===void 0?await l.fill():o&&await o(d)}}finally{await l.return()}h?.(t)},ni=(i,e)=>{let t=y(i),{input:s,file:n,fs:r,onEntry:o}=t,a=s??(n&&r?H(r,n,t.maxReadSize):void 0);if(!a)throw si();let[c,h]=e?.length?Q(e,t.filter):[];c&&(t.filter=c);let l=new v(a,t);for(let d of l)o?.(d);h?.(t)};var Ss=()=>{},ri=(i,e)=>{if(!i.file)throw new TypeError("file is required");if(!i.fs)throw new TypeError("the file option needs the fs option");let t=[...i.codecs??[],T];if(e?.length)return[t,...Q(e,i.filter)];if(i.filter)return[t,i.filter];throw new TypeError("no paths specified to delete")},oi=i=>`${i}.${Math.random().toString(36).slice(2)}.tmp`,gt=async(i,e)=>{let t=y(i),[s,n,r]=ri(t,e),{fs:o,file:a,filter:c,maxReadSize:h,...l}=t,d=new Uint8Array(ye(s)),p=0,f=await o.open(a,"r");try{for(let m=1;m>0&&p!n(m,g)},[new b(B(o,a,h),{...l,file:a})]),r?.(t),await o.rename(u,a)}catch(m){throw await o.unlink(u).catch(Ss),m}},ai=(i,e)=>{let t=y(i),[s,n,r]=ri(t,e),{fs:o,file:a,filter:c,maxReadSize:h,...l}=t,d=new Uint8Array(ye(s)),p=0,f=o.openSync(a,"r");try{for(let m=1;m>0&&p!n(m,g)},[new v(H(o,a,h),{...l,file:a})]),r?.(t),o.renameSync(u,a)}catch(m){try{o.unlinkSync(u)}catch{}throw m}};var re=class extends Error{path;code;syscall="chdir";constructor(e,t){super(`${t}: Cannot cd into '${e}'`),this.path=e,this.code=t}get name(){return"CwdError"}};var W=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(e,t){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=e,this.path=t}get name(){return"SymlinkError"}};var ci=i=>{let e=i.mode|448,{uid:t,gid:s}=i;return{mode:e,needChmod:(e&i.umask)!==0,owner:typeof t=="number"&&typeof s=="number"&&(t!==i.processUid||s!==i.processGid)?{uid:t,gid:s}:void 0}},hi=(i,e)=>i.endsWith("/")?i+e:i+"/"+e,li=(i,e)=>{let t=i.replaceAll("\\","/"),s=[e];for(let n=e.length;!t.endsWith(e.slice(0,n));){if(n=e.lastIndexOf("/",n-1),n<=0)return[e];s.push(e.slice(0,n))}return s},di=async(i,e,t)=>{let{mode:s,needChmod:n,owner:r}=ci(t),{cwd:o}=t,a=[];if(e===o){let c="ENOTDIR";if(!await i.stat(e).then(l=>l.isDirectory(),l=>(c=l?.code||c,!1)))throw new re(e,c)}else if(t.preserve){let c=await i.mkdir(e,{mode:s,recursive:!0});c&&(a=li(c,e))}else{let c=D(o,e).split("/"),h=o;for(let l=0;l{let{mode:s,needChmod:n,owner:r}=ci(t),{cwd:o}=t,a=[];if(e===o){let c="ENOTDIR",h=!1;try{h=i.statSync(e).isDirectory()}catch(l){c=l?.code||c}if(!h)throw new re(e,c)}else if(t.preserve){let c=i.mkdirSync(e,{mode:s,recursive:!0});c&&(a=li(c,e))}else{let c=D(o,e).split("/"),h=o;for(let l=0;l{if(i.length>bs)return i.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en");oe.has(i)?oe.delete(i):xt[i]=i.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"),oe.add(i);let e=xt[i],t=oe.size-fi;if(t>fi/10){for(let s of oe)if(oe.delete(s),delete xt[s],--t<=0)break}return e};var Re=class{#e={queue:[],name:""};#t=new Map;#i=new Set;#s;constructor(e=!1){this.#s=e}reserve(e,t){return new Promise((s,n)=>{let r=()=>{t().then(()=>{this.#a(r),s()},o=>{this.#a(r),n(o)})};this.#r(e,r)})}#r(e,t){let s=this.#e,n=new Set,r=new Set;for(let o of this.#s?["win32 parallelization disabled"]:e){let a=this.#s?o:Z(j(ui(o))),c=s;for(let h of a.split("/")){c!==s&&r.add(c);let l=c.kids??=new Map,d=l.get(h);d||l.set(h,d={queue:[],name:h,up:c}),c=d}n.add(c)}for(let o of n)r.delete(o);this.#t.set(t,{dirs:r,paths:n});for(let o of n)o.queue.push(t);for(let{queue:o}of r){let a=o[o.length-1];a instanceof Set?a.add(t):o.push(new Set([t]))}this.#n(t)}#n(e){let{paths:t,dirs:s}=this.#t.get(e);for(let n of t)if(n.queue[0]!==e)return;for(let{queue:n}of s){let r=n[0];if(!(r instanceof Set)||!r.has(e))return}this.#i.add(e),e()}#a(e){let{paths:t,dirs:s}=this.#t.get(e),n=new Set;for(let{queue:r}of t){r.shift();let o=r[0];if(typeof o=="function")n.add(o);else if(o)for(let a of o)n.add(a)}for(let{queue:r}of s){let o=r[0];o.size>1?o.delete(e):(r.shift(),r.length&&n.add(r[0]))}for(let r of t)for(;r.up&&!r.queue.length&&!r.kids?.size;)r.up.kids?.delete(r.name),r=r.up;this.#i.delete(e),this.#t.delete(e);for(let r of n)this.#n(r)}};var mi=(i,e)=>{if(!i)return()=>"w";let{O_CREAT:t,O_TRUNC:s,O_WRONLY:n,O_NOFOLLOW:r,UV_FS_O_FILEMAP:o}=i,a=s|t|n;if(!e){let h=typeof r=="number"?r|a:"w";return()=>h}if(!o)return()=>"w";let c=o|a;return h=>h<524288?c:"w"};var vs=1024,wi=32768,Es=16,Xe=new Set(["File","OldFile","ContiguousFile"]),ae=new Set(["Directory","GNUDumpDir"]),Rs=new Set(["Link","SymbolicLink"]),yi=(i,e,t)=>i!==void 0?i:e!==void 0&&e===e>>>0?e:t,Ae=class{opt;cwd;win32;strip;maxDepth;preservePaths;unlink;keep;newer;noMtime;chmod;uid;gid;preserveOwner;forceChown;processUid;processGid;processUmask;umask;dmode;fmode;writeFlag;resolve;dirname;fatal;constructor(e){let t=this.opt=k(e),s=this.win32=t.platform==="win32";if(this.resolve=s?Be:C,this.dirname=s?jt:P,typeof t.cwd!="string")throw new TypeError("cwd is required");let n=s?t.cwd.replaceAll("\\","/"):t.cwd;if(!(s?xe:ie)(n))throw new TypeError("cwd must be an absolute path");if(this.cwd=this.resolve(n,""),typeof t.uid=="number"||typeof t.gid=="number"){if(typeof t.uid!="number"||typeof t.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(t.uid!==t.uid>>>0||t.gid!==t.gid>>>0)throw new TypeError("uid and gid must be unsigned 32-bit integers");if(t.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=t.uid,this.gid=t.gid}this.processUid=t.processUid,this.processGid=t.processGid,this.preserveOwner=t.preserveOwner===void 0&&typeof t.uid!="number"?t.processUid===0:!!t.preserveOwner,this.forceChown=t.forceChown===!0,this.maxDepth=typeof t.maxDepth=="number"?t.maxDepth:vs,this.strip=Number(t.strip)||0,this.preservePaths=!!t.preservePaths,this.unlink=!!t.unlink,this.keep=!!t.keep,this.newer=!!t.newer,this.noMtime=!!t.noMtime,this.chmod=!!t.chmod,this.processUmask=this.chmod?typeof t.processUmask=="number"?t.processUmask:18:0,this.umask=typeof t.umask=="number"?t.umask:this.processUmask,this.dmode=t.dmode||511&~this.umask,this.fmode=t.fmode||438&~this.umask,this.writeFlag=mi(t.fs.constants,s)}warn(e,t,s={}){(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(s.recoverable=!1),s.cwd=this.cwd,S(this.opt,e,t,s)}readerOptions(){return k(this.opt,{strict:!1,onwarn:(e,t,s)=>this.warn(e,t,s)})}entryError(e,t){if(this.fatal?.error===e||e?.name==="CwdError")throw e;this.warn("TAR_ENTRY_ERROR",e,{entry:t})}fail(e){return this.fatal??={error:e},e}#e(e,t){let s=e[t];if(!s||this.preservePaths)return!0;let[n,r]=He(s),o=r.replaceAll("\\","/").split("/");if(o.includes("..")){if(t==="path"||e.type==="Link")return this.warn("TAR_ENTRY_ERROR",`${t} contains '..'`,{entry:e,[t]:s}),!1;let a=o.findIndex(l=>l!==".."&&l!=="."&&l!=="");if(a!==-1&&o.includes("..",a))return this.warn("TAR_ENTRY_ERROR",`${t} contains '..' after a path portion`,{entry:e,[t]:s}),!1;let c=P(he(e.path)),h=he(j(c,o.join("/")));if(h.startsWith("../")||h==="..")return this.warn("TAR_ENTRY_ERROR",`${t} escapes extraction directory`,{entry:e,[t]:s}),!1}return n&&(e[t]=r,this.warn("TAR_ENTRY_INFO",`stripping ${n} from absolute ${t}`,{entry:e,[t]:s})),!0}check(e){let t=e.path,s=t.split("/");if(this.strip){if(s.lengthc===""))return!1;e.path=s.join("/")}let{maxDepth:n}=this;if(isFinite(n)&&s.length>n)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:e,path:t,depth:s.length,maxDepth:n}),!1;let{linkpath:r}=e;if(r&&isFinite(n)&&r.split("/").length>n)return this.warn("TAR_ENTRY_ERROR","linkpath excessively deep",{entry:e,path:t,linkpath:r,maxDepth:n}),!1;for(let c of["path","linkpath"]){let{length:h}=e[c]??"";if(h>wi)return this.warn("TAR_ENTRY_ERROR",`${c} excessively long`,{entry:e,path:t,length:h,maxLength:wi}),!1}if(!this.#e(e,"path")||!this.#e(e,"linkpath"))return!1;let{cwd:o}=this,a=this.resolve(o,e.path);if(!this.preservePaths&&a!==o&&!a.startsWith(o.endsWith("/")?o:o+"/"))return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:e,path:e.path,resolvedPath:a,cwd:o}),!1;if(a===o&&!ae.has(e.type))return!1;if(this.win32){let c=$(a);a=c+dt(a.slice(c.length));let h=$(e.path);e.path=h+dt(e.path.slice(h.length))}if(e.absolute=a,typeof e.mode=="number"&&(e.mode&=511),ae.has(e.type))e.mode&&(e.mode|=448);else if(!Xe.has(e.type)&&!Rs.has(e.type))return e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),!1;return!0}reservedPaths(e){let{path:t,linkpath:s}=e;return s?[t,e.type==="SymbolicLink"&&!ie(s)?j(P(t),s):s]:[t]}mkdirOptions(e){return{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:e}}owner(e){let t=this.forceChown||this.preserveOwner&&(typeof e.uid=="number"&&e.uid!==this.processUid||typeof e.gid=="number"&&e.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid,s=yi(this.uid,e.uid,this.processUid),n=yi(this.gid,e.gid,this.processGid);return t&&typeof s=="number"&&typeof n=="number"?{uid:s,gid:n}:void 0}times(e){return e.mtime&&!this.noMtime?{atime:e.atime||new Date,mtime:e.mtime}:void 0}skip(e,t){return this.keep||this.newer&&t.mtime>(e.mtime??t.mtime)}isReusable(e,t){return e.type==="File"&&!this.unlink&&t.isFile()&&t.nlink<=1&&!this.win32}linkParts(e,t){let s=String(e.linkpath);return e.type==="Link"?s.split("/"):D(this.cwd,this.resolve(this.dirname(t),s)).split("/")}parentParts(e){let{cwd:t}=this,s=e===t?t:this.dirname(e);return s===t?[]:D(t,s).split("/")}symlinkError(e,t){return new W(e,this.resolve(this.cwd,t.join("/")))}},gi=i=>i+".DELETE."+Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,"0")).join(""),Te=class extends Ae{#e;#t;#i;#s=0;#r;#n=!1;#a;constructor(e){super(e),this.#e=this.opt.fs,this.#t=new Re(this.win32),this.#i=q("jobs",this.opt.jobs,Es)}async extract(e){let t=new b(e,this.readerOptions()),{onEntry:s}=this.opt,n=!!this.opt.transform;try{for(;!this.fatal;){let r=t.poll();if(r===null)break;if(r===void 0){await t.fill();continue}if(s&&await s(r),r.bodyUsed||!this.check(r))continue;let o=[],a=!n;if(a&&Xe.has(r.type))for(;;){let h=t.readBody(r);if(h===null)break;if(h===void 0){a=!1;break}o.push(h)}let c=this.#c(r,o,a?void 0:t);for(a||await c;this.#s>=this.#i;)await this.#o()}}catch(r){this.fail(r)}for(await t.return().catch(r=>this.fail(r));this.#s>0;)await this.#o();if(this.fatal){let{error:r}=this.fatal;throw r&&typeof r=="object"&&"tarCode"in r&&Object.assign(r,{cwd:this.cwd}),r}}#o(){return new Promise(e=>{this.#r=e})}#c(e,t,s){return this.#s++,this.#t.reserve(this.reservedPaths(e),async()=>{try{this.fatal||await this.#y(e,t,s)}catch(n){try{this.entryError(n,e)}catch(r){this.fail(r)}}this.#s--,this.#r?.()})}#h(e,t){return di(this.#e,e,this.mkdirOptions(t))}#p(){return this.#a??=this.#h(this.cwd,this.dmode).then(()=>{this.#n=!0},e=>{throw this.#a=void 0,e})}async#y(e,t,s){let n=this.#e,r=e.absolute,{cwd:o}=this;if(this.#n||await this.#p(),r!==o){let c=this.dirname(r);c!==o&&await this.#h(c,this.dmode)}let a=await n.lstat(r).catch(()=>{});if(!(a&&this.skip(e,a))){if(a&&!this.isReusable(e,a)&&(a.isDirectory()&&ae.has(e.type)?this.chmod&&e.mode&&(a.mode&4095)!==e.mode&&await n.chmod(r,e.mode):r!==o&&(a.isDirectory()?await n.rmdir(r):await this.#x(r))),Xe.has(e.type))return this.#u(e,r,t,s);if(ae.has(e.type))await this.#l(e,r);else{await this.#f(this.linkParts(e,r));let c=String(e.linkpath);e.type==="Link"?await n.link(this.resolve(o,c),r):await n.symlink(c,r)}await this.#f(this.parentParts(r))}}async#x(e){let t=this.#e;if(!this.win32)return t.unlink(e);let s=gi(e);await t.rename(e,s),await t.unlink(s)}async#f(e){if(this.preservePaths)return;let t=this.cwd;for(let s of e){t=this.resolve(t,s);let n=await this.#e.lstat(t).catch(()=>{});if(!n)return;if(n.isSymbolicLink())throw this.symlinkError(t,e)}}async#l(e,t){let s=this.#e;await this.#h(t,e.mode??this.dmode);let n=this.times(e);n&&await s.lutimes(t,n.atime,n.mtime).catch(()=>{});let r=this.owner(e);r&&await s.lchown(t,r.uid,r.gid).catch(()=>{})}async#u(e,t,s,n){let r=this.#e,o=await r.open(t,this.writeFlag(e.size),e.mode??this.fmode);try{if(await this.#f(this.parentParts(t)),n)await this.#w(e,s,n,o);else for(let h of s)await o.write(h);let a=this.times(e);if(a){let{atime:h,mtime:l}=a;await o.utimes(h,l).catch(async d=>{await r.utimes(t,h,l).catch(()=>{throw d})})}let c=this.owner(e);if(c){let{uid:h,gid:l}=c;await o.chown(h,l).catch(async d=>{await r.chown(t,h,l).catch(()=>{throw d})})}}catch(a){throw await o.close().catch(()=>{}),a}await o.close()}async#w(e,t,s,n){let r=0,o=async()=>{if(r{},m=>{w={error:m}})}finally{await f}if(w)throw w.error;return}let c=a.writable.getWriter(),h=a.readable.getReader(),l,d=async f=>{l??={error:f},await h.cancel(f).catch(()=>{}),await c.abort(f).catch(()=>{})},p=(async()=>{try{for(let f;f=await o();)await c.write(f);await c.close()}catch(f){await d(f)}})();try{for(;;){let{done:f,value:w}=await h.read();if(f)break;await n.write(w)}}catch(f){await d(f)}if(await p,l)throw l.error}},ze=class extends Ae{#e;#t=!1;constructor(e){super(e),this.#e=this.opt.fs}extract(e){let t=new v(e,this.readerOptions()),{onEntry:s}=this.opt;try{for(let n of t)if(s?.(n),!n.bodyUsed&&this.check(n))try{this.#s(n,t)}catch(r){this.entryError(r,n)}}catch(n){throw n&&typeof n=="object"&&"tarCode"in n&&Object.assign(n,{cwd:this.cwd}),n}}#i(e,t){pi(this.#e,e,this.mkdirOptions(t))}#s(e,t){let s=this.#e,n=e.absolute,{cwd:r}=this;if(this.#t||(this.#i(r,this.dmode),this.#t=!0),n!==r){let a=this.dirname(n);a!==r&&this.#i(a,this.dmode)}let o;try{o=s.lstatSync(n)}catch{}if(!(o&&this.skip(e,o))){if(o&&!this.isReusable(e,o)&&(o.isDirectory()&&ae.has(e.type)?this.chmod&&e.mode&&(o.mode&4095)!==e.mode&&s.chmodSync(n,e.mode):n!==r&&(o.isDirectory()?s.rmdirSync(n):this.#r(n))),Xe.has(e.type))return this.#o(e,n,t);if(ae.has(e.type))this.#a(e,n);else{this.#n(this.linkParts(e,n));let a=String(e.linkpath);e.type==="Link"?s.linkSync(this.resolve(r,a),n):s.symlinkSync(a,n)}this.#n(this.parentParts(n))}}#r(e){let t=this.#e;if(!this.win32)return t.unlinkSync(e);let s=gi(e);t.renameSync(e,s),t.unlinkSync(s)}#n(e){if(this.preservePaths)return;let t=this.cwd;for(let s of e){t=this.resolve(t,s);let n;try{n=this.#e.lstatSync(t)}catch{return}if(n.isSymbolicLink())throw this.symlinkError(t,e)}}#a(e,t){let s=this.#e;this.#i(t,e.mode??this.dmode);let n=this.times(e);if(n)try{s.lutimesSync(t,n.atime,n.mtime)}catch{}let r=this.owner(e);if(r)try{s.lchownSync(t,r.uid,r.gid)}catch{}}#o(e,t,s){let n=this.#e,r=n.openSync(t,this.writeFlag(e.size),e.mode??this.fmode);try{this.#n(this.parentParts(t));let o=this.opt.transform?.(e);for(;;){let h;try{h=s.readBody(e)}catch(l){throw this.fail(l)}if(!h)break;n.writeSync(r,o?o(h):h)}let a=this.times(e);if(a){let{atime:h,mtime:l}=a;try{n.futimesSync(r,h,l)}catch(d){try{n.utimesSync(t,h,l)}catch{throw d}}}let c=this.owner(e);if(c){let{uid:h,gid:l}=c;try{n.fchownSync(r,h,l)}catch(d){try{n.chownSync(t,h,l)}catch{throw d}}}}catch(o){try{n.closeSync(r)}catch{}throw o}n.closeSync(r)}};var xi=()=>new TypeError("extract needs input or file"),Ke=async(i,e)=>{let t=y(i),s=t.input??(t.file?B(t.fs,t.file,t.maxReadSize):void 0);if(!s)throw xi();let[n,r]=e?.length?Q(e,t.filter):[];n&&(t.filter=n),await new Te(t).extract(s),r?.(t)},ki=(i,e)=>{let t=y(i),s=t.input??(t.file?H(t.fs,t.file,t.maxReadSize):void 0);if(!s)throw xi();let[n,r]=e?.length?Q(e,t.filter):[];n&&(t.filter=n),new ze(t).extract(s),r?.(t)};var Si=(/* unused pure expression or super */ null && (64*1024)),bi={},As=()=>{},Ze=()=>new Error("cannot append to compressed archives"),vi=(i,e)=>{let{file:t}=i;if(!t)throw new TypeError("file is required");if(i.gzip||i.brotli||i.zstd||t.endsWith(".br")||t.endsWith(".tbr"))throw new TypeError(Ze().message);if(!e?.length)throw new TypeError("no paths specified to add/replace")},Oe=class{buf=new Uint8Array(Si);pos=0;#e;#t;#i;#s;constructor(e,t=[],s){this.#e=e,this.#i=[...t,T],this.#s=s,this.#t=new I({filter:()=>!1,onwarn:()=>{throw bi}})}get position(){return this.#t.position}get want(){return Math.min(Si,this.#e-this.pos)}push(e){let t=this.buf.subarray(0,e);if(this.pos===0&&this.#i.some(r=>r.detect(t)))throw Ze();let s=this.#t;this.pos+=e;let n=0;s.push(t);try{for(let r;r=s.next();){if(r.type!=="entry")return!1;let{entry:o}=r;if(n=s.offset+512*Math.ceil(o.size/512),n>this.#e)return!1;o.mtime&&this.#s?.set(o.path,o.mtime)}this.pos0&&this.pos{let t=y(i);vi(t,e);let{fs:s,file:n}=t,r=Ye(t,e);if(r.codec)throw new TypeError(Ze().message);let o=await s.open(n,"r+").catch(c=>{if(c?.code!=="ENOENT")throw c;return s.open(n,"w+",t.mode||438)}),a=!1;try{let{size:c}=await o.stat(),h=new Oe(c,t.codecs,t.mtimeCache);for(;h.push((await o.read(h.buf,0,h.want,h.pos)).bytesRead););await mt(o,r,h.position),a=!0}finally{let c=o.close();await(a?c:c.catch(As))}},Je=(i,e)=>{let t=y(i);vi(t,e);let{fs:s,file:n}=t,r=yt(t,e);if(r.codec)throw new TypeError(Ze().message);let o;try{o=s.openSync(n,"r+")}catch(a){if(a?.code!=="ENOENT")throw a;o=s.openSync(n,"w+",t.mode||438)}try{let{size:a}=s.fstatSync(o),c=new Oe(a,t.codecs,t.mtimeCache);for(;c.push(s.readSync(o,c.buf,0,c.want,c.pos)););wt(s,o,r,c.position)}catch(a){try{s.closeSync(o)}catch{}throw a}s.closeSync(o)};var Ts=(i,e)=>{let t=e.getTime(),s=i.getTime();return(t%1e3===0?s-s%1e3:s)>t},Ei=i=>{let{filter:e}=i,t=i.mtimeCache??new Map;return{...i,mtimeCache:t,filter:(s,n)=>{if(e&&!e(s,n))return!1;if("isDirectory"in n&&n.isDirectory())return!0;let r=t.get(s);return!r||!n.mtime||Ts(n.mtime,r)}}},Qe=(i,e)=>ce(Ei(i),e),Ri=(i,e)=>Je(Ei(i),e);var et=64*1024,tt=(i,e=!1,t)=>{let s,n,r=!1,o=!1,a,c,h=e?new Uint8Array(et):void 0,l=0,d=u=>new Promise(m=>{a=m,i.write(u,()=>m())}),p=async u=>{l&&await d(u.subarray(0,l)),l=0},f=()=>{o=!0,a?.(),c?.()},w=()=>{f(),i.destroy()};return i.pause(),i.on("data",u=>{t?.(u),t=void 0,r=!1,i.pause(),s.enqueue(u)}),i.on("end",()=>{o||s.close()}),i.on("error",u=>{s.error(u),n.error(u),f()}),i.on("close",f),{readable:new ReadableStream({start:u=>{s=u},pull:()=>{r=!0,c?.(),i.resume()},cancel:u=>{n.error(u),w()}},{highWaterMark:0}),writable:new WritableStream({start:u=>{n=u;let{signal:m}=u;m.addEventListener("abort",()=>{s.error(m.reason),w()})},write:async u=>{h?(l+u.length>et&&await p(h),u.length>et?await d(u):(h.set(u,l),l+=u.length)):await d(u),!r&&!o&&await new Promise(m=>c=m)},close:async()=>{h&&await p(h),await new Promise(u=>{a=u,i.end()})}})}},Fs=i=>i>=external_node_buffer_namespaceObject.constants.MAX_LENGTH?{}:{maxOutputLength:Math.max(1,Math.floor(i))},kt=(i,e,t,s,n)=>({...i,decompress:()=>tt(t({chunkSize:et})),compress:r=>tt(e(r),!0),decompressSync:(r,{maxOutputLength:o})=>{try{return n(r,Fs(o))}catch(a){throw a?.code!=="ERR_BUFFER_TOO_LARGE"?a:new Error(`max decompression ratio exceeded: the output is larger than ${o} bytes`)}},compressSync:s}),Ai=i=>{i[9]=255},St=(i=external_node_zlib_namespaceObject_0)=>{let{createBrotliCompress:e,createBrotliDecompress:t,brotliCompressSync:s,brotliDecompressSync:n,createZstdCompress:r,createZstdDecompress:o,zstdCompressSync:a,zstdDecompressSync:c}=i,l=[{...kt({name:"gzip",headLength:2,detect:d=>d[0]===31&&d[1]===139},i.createGzip,i.createGunzip,i.gzipSync,i.gunzipSync),compress:({portable:d,...p}={})=>tt(i.createGzip(p),!0,d?Ai:void 0),compressSync:(d,{portable:p,...f}={})=>{let w=i.gzipSync(d,f);return p&&Ai(w),w}}];return e&&t&&s&&n&&l.push(kt({name:"brotli",headLength:0,detect:()=>!1,extensions:[".tar.br",".tbr"]},e,t,s,n)),r&&o&&a&&c&&l.push(kt({name:"zstd",headLength:4,detect:d=>d[0]===40&&d[1]===181&&d[2]===47&&d[3]===253},r,o,a,c)),l};var ee=(/* unused pure expression or super */ null && (Us)),te=external_node_fs_namespaceObject_0,Cs=process.platform==="win32"?"win32":"posix",Ds=St(),x=(i,e,t)=>{let s=y(i);return s.fs??=e,s.platform??=Cs,s.codecs=[...s.codecs??[],...Ds],t&&(s.cwd=(0,external_node_path_namespaceObject.resolve)(s.cwd??""),s.processUid??=process.getuid?.(),s.processGid??=process.getgid?.(),s.processUname??=process.env.USER,s.chmod&&(s.processUmask??=process.umask())),s},vo=(i,e={})=>ht(i,x(e,ee,!1)),Eo=(i,e={})=>Bt(i,x(e,te,!1)),Ro=(i,e)=>Ve(x(i,ee,!1),e),Ao=(i,e)=>ni(x(i,te,!1),e),To=(i,e)=>Ke(x(i,ee,!0),e),zo=(i,e)=>ki(x(i,te,!0),e);function Oo(i,e){return ne(x(i,ee,!0),e)}function Po(i,e){return qe(x(i,te,!0),e)}var Fo=(i,e)=>ce(x(i,ee,!0),e),No=(i,e)=>Je(x(i,te,!0),e),Uo=(i,e)=>Qe(x(i,ee,!0),e),Lo=(i,e)=>Ri(x(i,te,!0),e),Co=(i,e)=>gt(x(i,ee,!1),e),Do=(i,e)=>ai(x(i,te,!1),e);
//# sourceMappingURL=index.min.js.map
// EXTERNAL MODULE: ./node_modules/yaml/dist/index.js
@@ -8755,10 +8739,9 @@ function fingerprint(directory) {
function unpack(archive, destination) {
const entries = new Set();
const roots = new Set();
- So({
+ zo({
file: archive,
cwd: destination,
- sync: true,
strict: true,
filter(name, entry) {
const normalized = name.replace(/\/$/, "");
diff --git a/actions/helm/test-chart/package-lock.json b/actions/helm/test-chart/package-lock.json
index ebf27ade..24f2cbaa 100644
--- a/actions/helm/test-chart/package-lock.json
+++ b/actions/helm/test-chart/package-lock.json
@@ -6,7 +6,7 @@
"": {
"name": "test-chart",
"dependencies": {
- "tar": "^7.5.23",
+ "tar": "^8.0.5",
"yaml": "^2.9.1"
},
"devDependencies": {
@@ -16,18 +16,6 @@
"node": ">=24.0.0"
}
},
- "node_modules/@isaacs/fs-minipass": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz",
- "integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==",
- "license": "ISC",
- "dependencies": {
- "minipass": "^7.0.4"
- },
- "engines": {
- "node": ">=18.0.0"
- }
- },
"node_modules/@vercel/ncc": {
"version": "0.45.0",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.45.0.tgz",
@@ -38,59 +26,13 @@
"ncc": "dist/ncc/cli.js"
}
},
- "node_modules/chownr": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz",
- "integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==",
- "license": "BlueOak-1.0.0",
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/minipass": {
- "version": "7.1.3",
- "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz",
- "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==",
- "license": "BlueOak-1.0.0",
- "engines": {
- "node": ">=16 || 14 >=14.17"
- }
- },
- "node_modules/minizlib": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.1.0.tgz",
- "integrity": "sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==",
- "license": "MIT",
- "dependencies": {
- "minipass": "^7.1.2"
- },
- "engines": {
- "node": ">= 18"
- }
- },
"node_modules/tar": {
- "version": "7.5.23",
- "resolved": "https://registry.npmjs.org/tar/-/tar-7.5.23.tgz",
- "integrity": "sha512-lkukzdoGngZHJZXxW4S/E4Fp9ghTDlyZXrQGRNoJ/LXvDKcXUTq2sg5yQe74po7Voea6n/IN09+wE/QvJMiifA==",
- "license": "BlueOak-1.0.0",
- "dependencies": {
- "@isaacs/fs-minipass": "^4.0.0",
- "chownr": "^3.0.0",
- "minipass": "^7.1.2",
- "minizlib": "^3.1.0",
- "yallist": "^5.0.0"
- },
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/yallist": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz",
- "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==",
+ "version": "8.0.5",
+ "resolved": "https://registry.npmjs.org/tar/-/tar-8.0.5.tgz",
+ "integrity": "sha512-iYroSHv/iVs5Bfy7uXCZVTye64oecqEETP3jvxksDcJlf8E3hreHYyhT+Qu7b+JgniditLaQbk4ZujNAnPEX9w==",
"license": "BlueOak-1.0.0",
"engines": {
- "node": ">=18"
+ "node": ">=22"
}
},
"node_modules/yaml": {
diff --git a/actions/helm/test-chart/package.json b/actions/helm/test-chart/package.json
index be2e527e..db6f5a14 100644
--- a/actions/helm/test-chart/package.json
+++ b/actions/helm/test-chart/package.json
@@ -1,7 +1,7 @@
{
"name": "test-chart",
"dependencies": {
- "tar": "^7.5.23",
+ "tar": "^8.0.5",
"yaml": "^2.9.1"
},
"devDependencies": {
@@ -9,12 +9,8 @@
},
"scripts": {
"build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && ncc build src/index.js --out dist --target es2022 --no-cache --license licenses.txt",
- "check:dist": "npm run build && git diff --exit-code -- dist && test -z \"$(git ls-files --others --exclude-standard -- dist)\"",
"test": "node --test",
- "test:ci": "node --experimental-test-coverage --test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=coverage/junit.xml --test-reporter=lcov --test-reporter-destination=coverage/lcov.info --test",
- "test:distribution": "node --test src/index.test.js",
- "test:watch": "node --test --watch",
- "pretest:ci": "node -e \"require('node:fs').mkdirSync('coverage', { recursive: true })\""
+ "test:watch": "node --test --watch"
},
"private": true,
"engines": {
diff --git a/actions/helm/test-chart/src/index.js b/actions/helm/test-chart/src/index.js
index 48358ab3..e7c7f08e 100644
--- a/actions/helm/test-chart/src/index.js
+++ b/actions/helm/test-chart/src/index.js
@@ -1,7 +1,7 @@
import { createHash, randomUUID } from "node:crypto";
import fs from "node:fs";
import path from "node:path";
-import { extract } from "tar";
+import { extractSync } from "tar";
import yaml from "yaml";
const digest = (file) =>
@@ -32,10 +32,9 @@ function fingerprint(directory) {
function unpack(archive, destination) {
const entries = new Set();
const roots = new Set();
- extract({
+ extractSync({
file: archive,
cwd: destination,
- sync: true,
strict: true,
filter(name, entry) {
const normalized = name.replace(/\/$/, "");
diff --git a/actions/helm/test-chart/src/index.test.js b/actions/helm/test-chart/src/index.test.js
index 4b1bde81..7d000aaa 100644
--- a/actions/helm/test-chart/src/index.test.js
+++ b/actions/helm/test-chart/src/index.test.js
@@ -5,7 +5,7 @@ import os from "node:os";
import path from "node:path";
import { test } from "node:test";
import { pathToFileURL } from "node:url";
-import { create } from "tar";
+import { createSync } from "tar";
const { stageChart, installChart } = await import(
process.env.ACTION_ENTRYPOINT
@@ -33,7 +33,7 @@ function fixture(t) {
);
const archive = path.join(root, "prepared chart.tgz");
const pack = (files = ["application"]) => {
- create({ cwd: root, file: archive, gzip: true, sync: true }, files);
+ createSync({ cwd: root, file: archive, gzip: true }, files);
return sha(archive);
};
return {
@@ -182,11 +182,10 @@ test("rejects linked, duplicate and multi-root archive entries without touching
/unsafe/,
);
fs.unlinkSync(path.join(f.source, "link"));
- create(
+ createSync(
{
cwd: f.source,
file: f.archive,
- sync: true,
gzip: true,
preservePaths: true,
},
diff --git a/docs/adr/0014-standardize-container-image-tests.md b/docs/adr/0014-standardize-container-image-tests.md
index d6434c39..ce6cec3f 100644
--- a/docs/adr/0014-standardize-container-image-tests.md
+++ b/docs/adr/0014-standardize-container-image-tests.md
@@ -4,6 +4,11 @@ Date: 2026-11-26
Status: Accepted on 2026-11-26. Implementation is included in PR #1002.
+The report transfer and grouping decisions below are superseded by
+[ADR 0015](0015-unified-ci-report-bundles.md).
+The Goss execution and compatibility decisions are superseded by
+[ADR 0017](0017-run-goss-image-checks-directly.md).
+
## Context
Hoverkraft repositories repeat image selection, test execution, readiness checks,
diff --git a/docs/adr/0015-unified-ci-report-bundles.md b/docs/adr/0015-unified-ci-report-bundles.md
new file mode 100644
index 00000000..d5c72275
--- /dev/null
+++ b/docs/adr/0015-unified-ci-report-bundles.md
@@ -0,0 +1,32 @@
+# ADR 0015: Use the shared CI report bundle contract
+
+- Status: superseded by [ADR 0016](0016-register-native-container-reports.md)
+- Date: 2026-11-26
+- Supersedes: only report transfer and grouping in [ADR 0014](0014-standardize-container-image-tests.md)
+
+## Decision
+
+Use ci-github-common's record-ci-reports action for native parsing and artifact
+transfer. Forward the test action's report-plan output to the common ci-reports
+workflow. Calling job names no longer determine artifact discovery.
+
+Keep image digest, resolved image ID, engine, platform and suite in report metadata.
+This describes the execution; it is not a promotion result. Only the existing
+validation output establishes success, after strict native report checks and
+cleanup. Image resolution, engine execution, report freshness, timeouts and
+resource ownership stay in the container action.
+
+Copy selected reports into an action-owned publication directory so the shared
+recorder can enforce its file boundary. Logs remain a separate diagnostic artifact.
+
+## Consequences
+
+This replaces report-group with report-plan for advanced orchestration. Standalone
+jobs forward the action output. Matrix callers create a complete plan before
+execution instead of relying on GitHub's last successful matrix output.
+
+Internal repository unit tests retain the released reporting workflow until the
+shared reporting release is adopted. Container integration checks exercise the
+new action bundle and retain their lifecycle assertions.
+
+See [common reporting ADR and implementation](https://github.com/hoverkraft-tech/ci-github-common/pull/683).
diff --git a/docs/adr/0016-register-native-container-reports.md b/docs/adr/0016-register-native-container-reports.md
new file mode 100644
index 00000000..a5c4f1a9
--- /dev/null
+++ b/docs/adr/0016-register-native-container-reports.md
@@ -0,0 +1,40 @@
+# ADR 0016: Register native container test reports before execution
+
+- Status: accepted
+- Date: 2026-11-28
+- Supersedes: [ADR 0015](0015-unified-ci-report-bundles.md)
+
+## Context
+
+The common reporting contract now discovers actual job executions and their
+registrations. Consumers no longer build or forward report plans. Container tests
+must contribute to the same terminal report as language and repository checks.
+
+## Decision
+
+Resolve the immutable image, then register the expected native JUnit report before
+starting the test engine. Record the suite's repository path, engine, observed
+platform and resolved local image ID, alongside the original registry reference.
+
+Stage fresh native evidence in the common recorder's private directory and
+finalize it after success or failure. The engine's JUnit report remains mandatory,
+including when additional reports are selected. Missing additional reports,
+malformed results, skipped-only suites and failed commands still fail the action.
+The existing validation output is exposed only after reporting and cleanup succeed.
+
+One terminal common `ci-reports` call publishes annotations, a summary and selected
+comments. The container action publishes no separate feedback. Diagnostic artifacts
+and image-validation outputs retain their existing purpose. Neither diagnostic
+artifacts nor report registration establish promotion eligibility.
+
+## Consequences
+
+Remove `report-plan`; callers provide only the tested image and suite directory.
+Producer jobs require `actions: read` and `contents: read`. Explicit path mappings
+use a JSON object with repository-relative destinations.
+
+Existing Goss and Testcontainers integration cases cover success, retained failure,
+timeouts and resource ownership. The kube-certificates-syncer consumer exercises
+this producer with the terminal common reporter alongside its Python matrix.
+
+See [the common reporting contract](https://github.com/hoverkraft-tech/ci-github-common/pull/683).
diff --git a/docs/adr/0017-run-goss-image-checks-directly.md b/docs/adr/0017-run-goss-image-checks-directly.md
new file mode 100644
index 00000000..e4cc06ad
--- /dev/null
+++ b/docs/adr/0017-run-goss-image-checks-directly.md
@@ -0,0 +1,77 @@
+# ADR 0017: Run Goss image checks directly
+
+Date: 2026-11-28
+
+Status: Accepted. Supersedes the Goss execution and compatibility decisions in
+[ADR 0014](0014-standardize-container-image-tests.md).
+
+The two-mode API and dgoss execution decisions are superseded by
+[ADR 0018](0018-let-goss-suites-own-application-startup.md).
+
+## Context
+
+The kube-certificates-syncer image checks need to verify its installed Python
+application, runtime user, read-only filesystem and writable certificate volume.
+Starting the normal entrypoint connects to Kubernetes before those checks can run.
+The original Goss adapter always used dgoss, which requires the application to
+stay running. That unnecessarily restricted packaging checks to Testcontainers.
+
+Goss itself can execute as the container's command, run its native assertions and
+exit. It does not need a background application for filesystem or command checks.
+Service tests still need the normal application lifecycle and readiness support.
+
+## Decision
+
+Add `goss-mode` with two explicit values:
+
+- `image` is the default. Run the pinned, checksum-verified Goss binary directly
+ as the tested container's entrypoint. Mount the binary and suite read-only.
+ Preserve the image's user, environment and working directory. No application
+ process, idle wrapper or external application service is started by the adapter.
+- `service` retains upstream dgoss and the image's normal entrypoint. It supports
+ `goss_wait.yaml`, followed by the native assertions in `goss.yaml`.
+
+Reject `goss_wait.yaml` in image mode rather than silently ignoring readiness.
+Reject unsupported modes and service mode on a Testcontainers suite. The CLI
+exposes the same option as the action. Existing Goss service callers must set
+`goss-mode: service`; breaking changes are accepted for this rollout.
+
+A Goss suite may include a `docker-args` file with one complete Docker option per
+line. Initially support only the concrete consumer requirements: read-only root,
+dropped capabilities, no new privileges and tmpfs mounts. Reject options that
+replace the tested image, user, command, platform, ownership labels or reserved
+Goss mounts. Do not evaluate shell expressions. Local Make targets can pass the
+same file and native assertions to Docker without installing Node.js or Goss on
+the host. Testcontainers suites retain native runtime configuration.
+
+Keep the immutable image and observed platform contract. Include the Goss mode
+in the report variant and successful validation output, so packaging evidence is
+distinguishable from running-service evidence. Retain native JUnit and diagnostics
+on failure. Apply the existing timeout, cancellation and owned-resource cleanup
+to both modes. Central reporting continues to follow
+[ADR 0016](0016-register-native-container-reports.md).
+
+## Consequences and validation
+
+Image mode verifies packaging and commands, not production startup or integration
+with external services. Command assertions still require a shell. Use service
+mode for HTTP/readiness tests and Testcontainers for provisioned dependencies or
+more involved lifecycle scenarios. Avoid adding an arbitrary startup-command API
+or a dummy process solely to satisfy dgoss.
+
+Extend the existing action test workflow with a non-root image whose normal
+entrypoint exits unsuccessfully. Passing image-mode assertions prove that Goss
+runs directly and retains the intended user and security settings. Reuse the
+failure, timeout, native-report and caller-owned-resource checks for this mode.
+Keep existing Node and Goss service coverage. Unit tests cover invalid options
+and readiness/mode conflicts before Docker execution.
+
+Pilot the same Goss suite through kube-certificates-syncer CI and `make test-image`.
+This ADR defines acceptance requirements; execution evidence belongs to the PR.
+
+## References
+
+- [Consumer PR #25](https://github.com/hoverkraft-tech/kube-certificates-syncer/pull/25)
+- [Goss v0.4.10](https://github.com/goss-org/goss/releases/tag/v0.4.10)
+- [Goss command assertions](https://github.com/goss-org/goss/blob/v0.4.10/resource/command.go)
+- [dgoss lifecycle](https://github.com/goss-org/goss/blob/v0.4.10/extras/dgoss/dgoss)
diff --git a/docs/adr/0018-let-goss-suites-own-application-startup.md b/docs/adr/0018-let-goss-suites-own-application-startup.md
new file mode 100644
index 00000000..bb20c054
--- /dev/null
+++ b/docs/adr/0018-let-goss-suites-own-application-startup.md
@@ -0,0 +1,55 @@
+# ADR 0018: Let Goss suites own application startup
+
+Date: 2026-11-28
+
+Status: Accepted. Supersedes the two-mode API and dgoss execution decisions in
+[ADR 0017](0017-run-goss-image-checks-directly.md).
+
+## Context
+
+The syncer pilot needs Goss to check its packaged application without starting a
+Kubernetes worker. Other applications need HTTP or process checks after startup.
+These are concrete test requirements, but retaining dgoss added an execution mode
+without an identified consumer requiring that adapter. Consumers can also express
+application startup in their own native Goss suites.
+
+## Decision
+
+Keep `engine: auto`, `goss` and `testcontainers-node`. Remove `goss-mode` from the
+action, CLI, execution state and report metadata. Always execute the verified
+Goss binary directly as the image's command, preserving its user, environment and
+working directory. Remove the dgoss download and execution path.
+
+A Goss `command` may invoke a project-owned script that starts an application,
+waits for readiness, performs checks and stops its processes. Keep dependent steps
+together because Goss can evaluate separate resources concurrently. Bound readiness
+and command execution, and retain suite cleanup for success and failure. The
+action's overall timeout and owned-container cleanup remain the final boundary.
+Do not add another startup input or wrapper convention. Consumers choose their
+native suite structure and can keep Goss for service checks.
+
+Reject a separate `goss_wait.yaml` rather than silently dropping readiness checks.
+Suites must express that behavior through `goss.yaml` and any scripts it calls.
+Keep native JUnit reporting, immutable image identity, security controls and the
+Testcontainers adapter unchanged. Reports identify the suite and engine without
+classifying it into an execution mode.
+
+## Validation and consequences
+
+Reuse the direct-Goss and Testcontainers success, failure, timeout and ownership
+checks. Replace the dgoss HTTP fixture with a native Goss command and a small
+script that manages the existing HTTP image. Exercise that example once in the
+Goss job, without duplicating the complete lifecycle matrix for a second mode.
+The syncer pilot continues using the same suite through CI and `make test-image`.
+
+Consumers own application-specific startup and readiness. Goss does not provide
+ordering between separate resources, and the adapter does not start the normal
+image entrypoint automatically. Testcontainers remains available for suites that
+prefer its lifecycle APIs or provision additional containers; using it is optional.
+
+## References
+
+- [Goss command resources](https://github.com/goss-org/goss/blob/v0.4.10/resource/command.go)
+- [Goss concurrent validation](https://github.com/goss-org/goss/blob/v0.4.10/validate.go)
+- [Native HTTP suite](../../tests/container-image/goss/goss.yaml)
+- [HTTP lifecycle script](../../tests/container-image/goss/check-http.sh)
diff --git a/docs/development/action-distributions.md b/docs/development/action-distributions.md
index 013868e5..909e8342 100644
--- a/docs/development/action-distributions.md
+++ b/docs/development/action-distributions.md
@@ -1,60 +1,70 @@
-# Action distributions
-
-Bundled action packages declare `build`, `check:dist` and `test:distribution` in
-their own `package.json`. CI discovers these packages at the repository root or
-under `actions/`, including nested actions. Adding a package requires no path list
-in CI, rebuild callers, linter exclusions or Git attributes.
-
-Packages with maintained JavaScript use ES modules under `src/`, with `*.test.js` beside their
-source. Each package owns its lockfile and the `test`, `test:watch` and `test:ci`
-scripts. The CI script creates `coverage/` before writing LCOV and JUnit reports. Keep source
-tests, bundle checks and public-action integration checks in separate CI jobs.
-Follow the Common `parse-ci-reports` CI pattern: use the Node.js
-`continuous-integration` workflow for each package's `test:ci`, with explicit job
-permissions. Disable build and lint while keeping CodeQL with the repository
-config, dependency review and GitHub coverage enabled. Set `test.comment` to false
-and `test.report-group` to the outer calling job ID in `__shared-ci.yml`. One
-`ci-reports` job runs after the producers, including failures, and updates one
-coverage comment with separate figures per action. Test results and lint summaries
-are consolidated too; individual producer comments stay disabled.
-
-Dependency-free composite actions follow the same package and CI test pattern,
-and import ES modules directly from `src/` using `actions/github-script`. They do
-not need a bundle. Omit `build`, `check:dist` and `test:distribution` for these
-packages; distribution discovery selects only packages that declare the build
-and distribution check scripts.
-
-For bundled source or dependency changes, run these commands in the package directory:
+# Action development
+
+Use a supported Node.js version satisfying the action packages' engine requirements, npm and Docker.
+
+```sh
+make setup
+make test
+make build
+make lint
+```
+
+`make setup` installs locked action dependencies with lifecycle scripts disabled.
+`make test` runs source tests; `make build` runs each available build script.
+Commit source, lockfiles and complete generated `dist` directories together.
+`make ci` installs dependencies, tests, verifies committed distributions and lints.
+It fails on modified, staged, deleted or untracked distribution files and never
+applies dependency or lint fixes. Use `make lint-fix` explicitly for formatting.
+Use `make deps-audit` to inspect dependency advisories without rewriting lockfiles.
+
+For one action, use native commands from its directory:
```sh
npm ci --ignore-scripts
-npm run build
npm test
+npm run build
```
-Commit source, lockfile and the complete generated `dist` directory together.
-After staging generated output, `npm run check:dist` rebuilds it and rejects
-modified or untracked files. Do not edit bundles or license notices manually.
-
-The shared distribution test workflow runs `check:dist` and isolated bundle
-contract tests on a host and in a Node.js container. Each package's
-`test:distribution` script selects its own behavior tests. Those tests load
-`process.env.ACTION_ENTRYPOINT` when supplied, falling back to source locally.
-The shared test action supplies an isolated `dist/index.js`, clears external module
-lookup settings, propagates failures and removes the copy after every run.
-The documentation formatter uses esbuild to preserve caller config/plugin imports
-and ncc to collect dependency licenses; its package exposes the same build/check/test
-commands. See [ADR 0011](../adr/0011-skip-unchanged-helm-documentation.md#bundle-formatting-tools).
-
-No repository-level test runner is needed. Keep assertions for errors and
-caller-owned files in the action's tests; security checks remain enabled.
-
-Allowed dependency PRs use the shared
-[distribution automation](https://github.com/hoverkraft-tech/ci-github-common/blob/main/.github/workflows/action-distributions.md)
-to regenerate bundles and licenses in the same PR. Both the
-[build caller](../../.github/workflows/__rebuild-action-distributions.yml) and
-[commit caller](../../.github/workflows/__commit-action-distributions.yml) use
-package discovery from default-branch manifests and configure allowed authors.
-The shared guide owns App setup, Renovate author handling and recovery instructions.
-New packages must reach the default branch before the writer can update them;
-normal distribution CI validates them in their introducing PR.
+Run `build` only for packages that declare it. Keep each action's lockfile and
+build logic local, including license notices and required copied assets.
+Dependency-free helpers need no bundler. Use the existing dependency updater or
+native npm commands for intentional upgrades; fixture packages remain independent.
+
+## CI responsibilities
+
+Each action retains its dedicated integration workflow. Source tests use the
+Node.js test preset, which configures native reports and optional coverage.
+The normal package scripts supply test selection and coverage scope; packages
+do not repeat reporter commands or report paths.
+One outer `publish-ci-reports.yml` job publishes retained evidence. A separate
+completion gate checks producer and publication outcomes.
+
+One native GitHub matrix in `__shared-ci.yml` lists the action package directories
+and calls Node.js `continuous-integration.yml` for each. Add new packages to that
+list. The shared workflow runs source tests, optional lint and builds. It verifies committed distributions and
+executes isolated bundles on the host and in a Node container. Repository
+security checks run once. Keep test selection and coverage scope in the normal
+package script; CI adds reporters and retains native reports.
+
+Contract tests load `process.env.ACTION_ENTRYPOINT` when supplied and source
+otherwise. The isolation action defaults to the package's `test` script; declare
+`test:distribution` only to select a different suite. It clears external module
+lookup settings, propagates failures and removes its temporary copy on failure
+as well as success. Do not edit bundles or generated license notices manually.
+
+The documentation formatter keeps its specialized build for caller config/plugin
+imports and dependency licenses. See [ADR 0011](../adr/0011-skip-unchanged-helm-documentation.md#bundle-formatting-tools).
+
+## Automated dependency updates
+
+Normal CI builds each action and uploads its generated output before checking
+whether the committed distribution is stale. The
+[commit caller](../../.github/workflows/__commit-action-distributions.yml)
+listens to normal PR CI, validates artifacts for every affected package and
+commits them together. It never executes PR code. A failed stale-output check
+can trigger repair; a failed build supplies no artifact and cannot be published.
+
+See the [shared distribution guide](https://github.com/hoverkraft-tech/ci-github-common/blob/main/.github/workflows/action-distributions.md)
+for App setup, immutable author identities and recovery. New packages must reach
+the default branch before the writer can update them; ordinary distribution CI
+validates them in their introducing PR.
diff --git a/tests/container-image/goss-image/docker-args b/tests/container-image/goss-image/docker-args
new file mode 100644
index 00000000..f9f7677e
--- /dev/null
+++ b/tests/container-image/goss-image/docker-args
@@ -0,0 +1,4 @@
+--read-only
+--cap-drop=ALL
+--security-opt=no-new-privileges
+--tmpfs=/certs:uid=10001,gid=10001,mode=0700
diff --git a/tests/container-image/goss-image/goss.yaml b/tests/container-image/goss-image/goss.yaml
new file mode 100644
index 00000000..92e18617
--- /dev/null
+++ b/tests/container-image/goss-image/goss.yaml
@@ -0,0 +1,17 @@
+---
+command:
+ runtime-user:
+ exec: test "$(id -u):$(id -g)" = "10001:10001"
+ exit-status: 0
+ read-only-root:
+ exec: awk '$2 == "/" && $4 ~ /(^|,)ro(,|$)/ { found=1 } END { exit !found }' /proc/mounts
+ exit-status: 0
+ writable-volume:
+ exec: echo ok > /certs/smoke && test "$(cat /certs/smoke)" = ok
+ exit-status: 0
+ dropped-capabilities:
+ exec: awk '$1 == "CapEff:" { if ($2 != "0000000000000000") exit 1; found=1 } END { if (!found) exit 1 }' /proc/self/status
+ exit-status: 0
+ no-new-privileges:
+ exec: awk '$1 == "NoNewPrivs:" { if ($2 != "1") exit 1; found=1 } END { if (!found) exit 1 }' /proc/self/status
+ exit-status: 0
diff --git a/tests/container-image/goss/check-http.sh b/tests/container-image/goss/check-http.sh
new file mode 100755
index 00000000..0364ec64
--- /dev/null
+++ b/tests/container-image/goss/check-http.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+set -eu
+
+work=$(mktemp -d)
+service_pid=
+cleanup() {
+ status=$?
+ trap - EXIT
+ if [ -n "$service_pid" ]; then
+ kill "$service_pid" 2>/dev/null || true
+ wait "$service_pid" 2>/dev/null || true
+ fi
+ if [ "$status" -ne 0 ]; then cat "$work/service.log" >&2; fi
+ rm -rf "$work"
+ exit "$status"
+}
+trap cleanup EXIT
+trap 'exit 130' INT
+trap 'exit 143' TERM
+
+# Keep startup, readiness and HTTP checks together; Goss checks can run concurrently.
+/docker-entrypoint.sh nginx -g 'daemon off;' >"$work/service.log" 2>&1 &
+service_pid=$!
+curl --fail --silent --show-error --max-time 2 \
+ --retry 10 --retry-connrefused --retry-delay 1 --retry-max-time 10 \
+ --write-out '\nHTTP_STATUS=%{http_code}\n' \
+ "${1:-http://127.0.0.1:8080/health/check/}"
diff --git a/tests/container-image/goss/goss.yaml b/tests/container-image/goss/goss.yaml
index e3c93607..a2924e0d 100644
--- a/tests/container-image/goss/goss.yaml
+++ b/tests/container-image/goss/goss.yaml
@@ -1,12 +1,9 @@
---
-http:
- http://localhost:8080/health/check/:
- status: 200
- body:
- - OK
command:
- runtime-user:
- exec: id -u
+ http-health:
+ exec: sh /goss/check-http.sh
exit-status: 0
stdout:
- - "0"
+ - HTTP_STATUS=200
+ - OK
+ timeout: 20000
diff --git a/tests/container-image/goss/goss_wait.yaml b/tests/container-image/goss/goss_wait.yaml
deleted file mode 100644
index 5af70234..00000000
--- a/tests/container-image/goss/goss_wait.yaml
+++ /dev/null
@@ -1,4 +0,0 @@
----
-port:
- tcp:8080:
- listening: true