diff --git a/.editorconfig b/.editorconfig index d416e1c9e..192e956de 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,3 +8,6 @@ trim_trailing_whitespace = true [*.ts] indent_style = space indent_size = 2 + +[*.{yml,yaml}] +indent_size = 2 diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 1c514912c..f66079071 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -2,4 +2,4 @@ blank_issues_enabled: true contact_links: - name: Contact GitHub Support url: https://support.github.com/request - about: Contact Support + about: Contact Support diff --git a/.github/actions/check-codescanning-config/action.yml b/.github/actions/check-codescanning-config/action.yml index 0c65c3a41..bd680cc9f 100644 --- a/.github/actions/check-codescanning-config/action.yml +++ b/.github/actions/check-codescanning-config/action.yml @@ -1,7 +1,7 @@ name: Check Code-Scanning Config description: | - Checks the code scanning configuration file generated by the - action to ensure it contains the expected contents + Checks the code scanning configuration file generated by the + action to ensure it contains the expected contents inputs: languages: required: false @@ -52,7 +52,7 @@ runs: tools: ${{ inputs.tools }} db-location: ${{ runner.temp }}/codescanning-config-cli-test env: - CODEQL_ACTION_TEST_MODE: 'true' + CODEQL_ACTION_TEST_MODE: "true" - name: Install dependencies shell: bash @@ -62,7 +62,7 @@ runs: working-directory: ${{ github.action_path }} shell: bash env: - EXPECTED_CONFIG_FILE_CONTENTS: '${{ inputs.expected-config-file-contents }}' + EXPECTED_CONFIG_FILE_CONTENTS: "${{ inputs.expected-config-file-contents }}" run: ts-node ./index.ts "$RUNNER_TEMP/user-config.yaml" "$EXPECTED_CONFIG_FILE_CONTENTS" - name: Clean up shell: bash diff --git a/.github/actions/query-filter-test/action.yml b/.github/actions/query-filter-test/action.yml index f1dfc38bf..ab4f9286a 100644 --- a/.github/actions/query-filter-test/action.yml +++ b/.github/actions/query-filter-test/action.yml @@ -54,7 +54,7 @@ runs: - name: Check SARIF uses: ./../action/.github/actions/check-sarif with: - sarif-file: ${{ inputs.sarif-file }} + sarif-file: ${{ inputs.sarif-file }} queries-run: ${{ inputs.queries-run}} queries-not-run: ${{ inputs.queries-not-run}} - name: Cleanup after test diff --git a/.github/actions/release-branches/action.yml b/.github/actions/release-branches/action.yml index 7734411c7..3d08d43ec 100644 --- a/.github/actions/release-branches/action.yml +++ b/.github/actions/release-branches/action.yml @@ -1,11 +1,11 @@ -name: 'Release branches' -description: 'Determine branches for release & backport' +name: "Release branches" +description: "Determine branches for release & backport" inputs: major_version: - description: 'The version as extracted from the package.json file' + description: "The version as extracted from the package.json file" required: true latest_tag: - description: 'The most recent tag published to the repository' + description: "The most recent tag published to the repository" required: true outputs: backport_source_branch: diff --git a/.github/actions/release-initialise/action.yml b/.github/actions/release-initialise/action.yml index b734377a7..d0e99f4ed 100644 --- a/.github/actions/release-initialise/action.yml +++ b/.github/actions/release-initialise/action.yml @@ -1,17 +1,16 @@ -name: 'Prepare release job' -description: 'Prepare for updating a release branch' +name: "Prepare release job" +description: "Prepare for updating a release branch" runs: using: "composite" steps: - - name: Dump environment run: env shell: bash - name: Dump GitHub context env: - GITHUB_CONTEXT: '${{ toJson(github) }}' + GITHUB_CONTEXT: "${{ toJson(github) }}" run: echo "$GITHUB_CONTEXT" shell: bash @@ -19,7 +18,7 @@ runs: uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: 24 - cache: 'npm' + cache: "npm" - name: Install JavaScript dependencies shell: bash diff --git a/.github/workflows/__all-platform-bundle.yml b/.github/workflows/__all-platform-bundle.yml index 5f2a6fa86..22635a0d1 100644 --- a/.github/workflows/__all-platform-bundle.yml +++ b/.github/workflows/__all-platform-bundle.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: dotnet-version: @@ -29,7 +29,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" workflow_call: inputs: dotnet-version: @@ -41,7 +41,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" defaults: run: shell: bash @@ -84,8 +84,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'true' - setup-kotlin: 'true' + use-all-platform-bundle: "true" + setup-kotlin: "true" - id: init uses: ./../action/init with: diff --git a/.github/workflows/__analysis-kinds.yml b/.github/workflows/__analysis-kinds.yml index a0a14c8c5..f916bda40 100644 --- a/.github/workflows/__analysis-kinds.yml +++ b/.github/workflows/__analysis-kinds.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -73,8 +73,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init with: languages: javascript @@ -82,16 +82,16 @@ jobs: tools: ${{ steps.prepare-test.outputs.tools-url }} - uses: ./../action/analyze with: - output: '${{ runner.temp }}/results' + output: "${{ runner.temp }}/results" upload-database: false - post-processed-sarif-path: '${{ runner.temp }}/post-processed' + post-processed-sarif-path: "${{ runner.temp }}/post-processed" - name: Upload SARIF files uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: | analysis-kinds-${{ matrix.os }}-${{ matrix.version }}-${{ matrix.analysis-kinds }} - path: '${{ runner.temp }}/results/*.sarif' + path: "${{ runner.temp }}/results/*.sarif" retention-days: 7 - name: Upload post-processed SARIF @@ -99,7 +99,7 @@ jobs: with: name: | post-processed-${{ matrix.os }}-${{ matrix.version }}-${{ matrix.analysis-kinds }} - path: '${{ runner.temp }}/post-processed' + path: "${{ runner.temp }}/post-processed" retention-days: 7 if-no-files-found: error @@ -107,16 +107,16 @@ jobs: if: contains(matrix.analysis-kinds, 'code-scanning') uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: - SARIF_PATH: '${{ runner.temp }}/results/javascript.sarif' - EXPECT_PRESENT: 'false' + SARIF_PATH: "${{ runner.temp }}/results/javascript.sarif" + EXPECT_PRESENT: "false" with: script: ${{ env.CHECK_SCRIPT }} - name: Check quality query appears in quality SARIF if: contains(matrix.analysis-kinds, 'code-quality') uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: - SARIF_PATH: '${{ runner.temp }}/results/javascript.quality.sarif' - EXPECT_PRESENT: 'true' + SARIF_PATH: "${{ runner.temp }}/results/javascript.quality.sarif" + EXPECT_PRESENT: "true" with: script: ${{ env.CHECK_SCRIPT }} env: diff --git a/.github/workflows/__analyze-ref-input.yml b/.github/workflows/__analyze-ref-input.yml index 1e899b39a..e12f918e4 100644 --- a/.github/workflows/__analyze-ref-input.yml +++ b/.github/workflows/__analyze-ref-input.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: dotnet-version: @@ -29,7 +29,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" workflow_call: inputs: dotnet-version: @@ -41,7 +41,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" defaults: run: shell: bash @@ -80,8 +80,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init with: tools: ${{ steps.prepare-test.outputs.tools-url }} @@ -91,7 +91,7 @@ jobs: run: ./build.sh - uses: ./../action/analyze with: - ref: 'refs/heads/main' - sha: '5e235361806c361d4d3f8859e3c897658025a9a2' + ref: "refs/heads/main" + sha: "5e235361806c361d4d3f8859e3c897658025a9a2" env: CODEQL_ACTION_TEST_MODE: true diff --git a/.github/workflows/__autobuild-action.yml b/.github/workflows/__autobuild-action.yml index fcf5094e1..c9e495d0a 100644 --- a/.github/workflows/__autobuild-action.yml +++ b/.github/workflows/__autobuild-action.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: dotnet-version: @@ -69,8 +69,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init with: languages: csharp @@ -78,12 +78,12 @@ jobs: - uses: ./../action/autobuild env: # Explicitly disable the CLR tracer. - COR_ENABLE_PROFILING: '' - COR_PROFILER: '' - COR_PROFILER_PATH_64: '' - CORECLR_ENABLE_PROFILING: '' - CORECLR_PROFILER: '' - CORECLR_PROFILER_PATH_64: '' + COR_ENABLE_PROFILING: "" + COR_PROFILER: "" + COR_PROFILER_PATH_64: "" + CORECLR_ENABLE_PROFILING: "" + CORECLR_PROFILER: "" + CORECLR_PROFILER_PATH_64: "" - uses: ./../action/analyze - name: Check database run: | diff --git a/.github/workflows/__autobuild-direct-tracing-with-working-dir.yml b/.github/workflows/__autobuild-direct-tracing-with-working-dir.yml index d0830846a..b28b6a084 100644 --- a/.github/workflows/__autobuild-direct-tracing-with-working-dir.yml +++ b/.github/workflows/__autobuild-direct-tracing-with-working-dir.yml @@ -17,21 +17,21 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: java-version: type: string description: The version of Java to install required: false - default: '17' + default: "17" workflow_call: inputs: java-version: type: string description: The version of Java to install required: false - default: '17' + default: "17" defaults: run: shell: bash @@ -72,8 +72,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - name: Test setup run: | # Make sure that Gradle build succeeds in autobuild-dir ... diff --git a/.github/workflows/__autobuild-working-dir.yml b/.github/workflows/__autobuild-working-dir.yml index 489e4ed7d..930df5d7c 100644 --- a/.github/workflows/__autobuild-working-dir.yml +++ b/.github/workflows/__autobuild-working-dir.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -51,8 +51,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - name: Test setup run: | # Make sure that Gradle build succeeds in autobuild-dir ... diff --git a/.github/workflows/__build-mode-autobuild.yml b/.github/workflows/__build-mode-autobuild.yml index 2e8957336..e0e74bda1 100644 --- a/.github/workflows/__build-mode-autobuild.yml +++ b/.github/workflows/__build-mode-autobuild.yml @@ -17,21 +17,21 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: java-version: type: string description: The version of Java to install required: false - default: '17' + default: "17" workflow_call: inputs: java-version: type: string description: The version of Java to install required: false - default: '17' + default: "17" defaults: run: shell: bash @@ -80,8 +80,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - name: Set up Java test repo configuration run: | mv * .github ../action/tests/multi-language-repo/ @@ -92,7 +92,7 @@ jobs: id: init with: build-mode: autobuild - db-location: '${{ runner.temp }}/customDbLocation' + db-location: "${{ runner.temp }}/customDbLocation" languages: java tools: ${{ steps.prepare-test.outputs.tools-url }} diff --git a/.github/workflows/__build-mode-manual.yml b/.github/workflows/__build-mode-manual.yml index 14cdc5654..ecca03952 100644 --- a/.github/workflows/__build-mode-manual.yml +++ b/.github/workflows/__build-mode-manual.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: dotnet-version: @@ -29,7 +29,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" workflow_call: inputs: dotnet-version: @@ -41,7 +41,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" defaults: run: shell: bash @@ -80,13 +80,13 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init id: init with: build-mode: manual - db-location: '${{ runner.temp }}/customDbLocation' + db-location: "${{ runner.temp }}/customDbLocation" languages: java tools: ${{ steps.prepare-test.outputs.tools-url }} diff --git a/.github/workflows/__build-mode-none.yml b/.github/workflows/__build-mode-none.yml index 690e7fe38..c01ba2539 100644 --- a/.github/workflows/__build-mode-none.yml +++ b/.github/workflows/__build-mode-none.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -53,13 +53,13 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init id: init with: build-mode: none - db-location: '${{ runner.temp }}/customDbLocation' + db-location: "${{ runner.temp }}/customDbLocation" languages: java tools: ${{ steps.prepare-test.outputs.tools-url }} diff --git a/.github/workflows/__build-mode-rollback.yml b/.github/workflows/__build-mode-rollback.yml index 0e53ba195..e18b41156 100644 --- a/.github/workflows/__build-mode-rollback.yml +++ b/.github/workflows/__build-mode-rollback.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -51,8 +51,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - name: Set up Java test repo configuration run: | mv * .github ../action/tests/multi-language-repo/ @@ -63,7 +63,7 @@ jobs: id: init with: build-mode: none - db-location: '${{ runner.temp }}/customDbLocation' + db-location: "${{ runner.temp }}/customDbLocation" languages: java tools: ${{ steps.prepare-test.outputs.tools-url }} diff --git a/.github/workflows/__bundle-from-nightly.yml b/.github/workflows/__bundle-from-nightly.yml index 08fb84959..57b2503e6 100644 --- a/.github/workflows/__bundle-from-nightly.yml +++ b/.github/workflows/__bundle-from-nightly.yml @@ -3,7 +3,7 @@ # pr-checks/sync.sh # to regenerate this file. -name: 'PR Check - Bundle: From nightly' +name: "PR Check - Bundle: From nightly" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GO111MODULE: auto @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -36,7 +36,7 @@ jobs: include: - os: ubuntu-26.04 version: linked - name: 'Bundle: From nightly' + name: "Bundle: From nightly" if: github.triggering_actor != 'dependabot[bot]' permissions: contents: read @@ -51,8 +51,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - id: init uses: ./../action/init env: diff --git a/.github/workflows/__bundle-from-toolcache.yml b/.github/workflows/__bundle-from-toolcache.yml index 79245e665..23011be21 100644 --- a/.github/workflows/__bundle-from-toolcache.yml +++ b/.github/workflows/__bundle-from-toolcache.yml @@ -3,7 +3,7 @@ # pr-checks/sync.sh # to regenerate this file. -name: 'PR Check - Bundle: From toolcache' +name: "PR Check - Bundle: From toolcache" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GO111MODULE: auto @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -36,7 +36,7 @@ jobs: include: - os: ubuntu-26.04 version: toolcache - name: 'Bundle: From toolcache' + name: "Bundle: From toolcache" if: github.triggering_actor != 'dependabot[bot]' permissions: contents: read @@ -60,8 +60,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - name: Check toolcache contains CodeQL continue-on-error: true run: | diff --git a/.github/workflows/__bundle-toolcache.yml b/.github/workflows/__bundle-toolcache.yml index 3f7264820..fca833697 100644 --- a/.github/workflows/__bundle-toolcache.yml +++ b/.github/workflows/__bundle-toolcache.yml @@ -3,7 +3,7 @@ # pr-checks/sync.sh # to regenerate this file. -name: 'PR Check - Bundle: Caching checks' +name: "PR Check - Bundle: Caching checks" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GO111MODULE: auto @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -40,7 +40,7 @@ jobs: version: linked - os: windows-2025 version: linked - name: 'Bundle: Caching checks' + name: "Bundle: Caching checks" if: github.triggering_actor != 'dependabot[bot]' permissions: contents: read @@ -64,8 +64,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - name: Remove CodeQL from toolcache run: | cd ./../action diff --git a/.github/workflows/__cleanup-db-cluster-dir.yml b/.github/workflows/__cleanup-db-cluster-dir.yml index 904932ced..ce9ee41da 100644 --- a/.github/workflows/__cleanup-db-cluster-dir.yml +++ b/.github/workflows/__cleanup-db-cluster-dir.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -51,8 +51,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - name: Add a file to the database cluster directory run: | mkdir -p "${{ runner.temp }}/customDbLocation/javascript" @@ -62,7 +62,7 @@ jobs: id: init with: build-mode: none - db-location: '${{ runner.temp }}/customDbLocation' + db-location: "${{ runner.temp }}/customDbLocation" languages: javascript tools: ${{ steps.prepare-test.outputs.tools-url }} diff --git a/.github/workflows/__config-export.yml b/.github/workflows/__config-export.yml index 82ff82728..da9e743a6 100644 --- a/.github/workflows/__config-export.yml +++ b/.github/workflows/__config-export.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -53,8 +53,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init with: languages: javascript @@ -62,18 +62,18 @@ jobs: tools: ${{ steps.prepare-test.outputs.tools-url }} - uses: ./../action/analyze with: - output: '${{ runner.temp }}/results' + output: "${{ runner.temp }}/results" upload-database: false - name: Upload SARIF uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: config-export-${{ matrix.os }}-${{ matrix.version }}.sarif.json - path: '${{ runner.temp }}/results/javascript.sarif' + path: "${{ runner.temp }}/results/javascript.sarif" retention-days: 7 - name: Check config properties appear in SARIF uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: - SARIF_PATH: '${{ runner.temp }}/results/javascript.sarif' + SARIF_PATH: "${{ runner.temp }}/results/javascript.sarif" with: script: | const fs = require('fs'); diff --git a/.github/workflows/__config-input.yml b/.github/workflows/__config-input.yml index 8c4544a7a..03934bd43 100644 --- a/.github/workflows/__config-input.yml +++ b/.github/workflows/__config-input.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -60,8 +60,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - name: Copy queries into workspace run: | cp -a ../action/queries . diff --git a/.github/workflows/__cpp-deptrace-disabled.yml b/.github/workflows/__cpp-deptrace-disabled.yml index d84e32298..5f24cd8cf 100644 --- a/.github/workflows/__cpp-deptrace-disabled.yml +++ b/.github/workflows/__cpp-deptrace-disabled.yml @@ -3,7 +3,7 @@ # pr-checks/sync.sh # to regenerate this file. -name: 'PR Check - C/C++: disabling autoinstalling dependencies (Linux)' +name: "PR Check - C/C++: disabling autoinstalling dependencies (Linux)" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GO111MODULE: auto @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -40,7 +40,7 @@ jobs: version: default - os: ubuntu-26.04 version: nightly-latest - name: 'C/C++: disabling autoinstalling dependencies (Linux)' + name: "C/C++: disabling autoinstalling dependencies (Linux)" if: github.triggering_actor != 'dependabot[bot]' permissions: contents: read @@ -55,8 +55,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - name: Test setup run: | cp -a ../action/tests/cpp-autobuild autobuild-dir @@ -75,5 +75,5 @@ jobs: exit 1 fi env: - DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' + DOTNET_GENERATE_ASPNET_CERTIFICATE: "false" CODEQL_ACTION_TEST_MODE: true diff --git a/.github/workflows/__cpp-deptrace-enabled-on-macos.yml b/.github/workflows/__cpp-deptrace-enabled-on-macos.yml index cca23b089..c0794ee87 100644 --- a/.github/workflows/__cpp-deptrace-enabled-on-macos.yml +++ b/.github/workflows/__cpp-deptrace-enabled-on-macos.yml @@ -3,7 +3,7 @@ # pr-checks/sync.sh # to regenerate this file. -name: 'PR Check - C/C++: autoinstalling dependencies is skipped (macOS)' +name: "PR Check - C/C++: autoinstalling dependencies is skipped (macOS)" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GO111MODULE: auto @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -38,7 +38,7 @@ jobs: version: linked - os: macos-26 version: nightly-latest - name: 'C/C++: autoinstalling dependencies is skipped (macOS)' + name: "C/C++: autoinstalling dependencies is skipped (macOS)" if: github.triggering_actor != 'dependabot[bot]' permissions: contents: read @@ -53,8 +53,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - name: Test setup run: | cp -a ../action/tests/cpp-autobuild autobuild-dir @@ -75,5 +75,5 @@ jobs: exit 1 fi env: - DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' + DOTNET_GENERATE_ASPNET_CERTIFICATE: "false" CODEQL_ACTION_TEST_MODE: true diff --git a/.github/workflows/__cpp-deptrace-enabled.yml b/.github/workflows/__cpp-deptrace-enabled.yml index 51ce4401c..dd74b17d6 100644 --- a/.github/workflows/__cpp-deptrace-enabled.yml +++ b/.github/workflows/__cpp-deptrace-enabled.yml @@ -3,7 +3,7 @@ # pr-checks/sync.sh # to regenerate this file. -name: 'PR Check - C/C++: autoinstalling dependencies (Linux)' +name: "PR Check - C/C++: autoinstalling dependencies (Linux)" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GO111MODULE: auto @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -40,7 +40,7 @@ jobs: version: default - os: ubuntu-26.04 version: nightly-latest - name: 'C/C++: autoinstalling dependencies (Linux)' + name: "C/C++: autoinstalling dependencies (Linux)" if: github.triggering_actor != 'dependabot[bot]' permissions: contents: read @@ -55,8 +55,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - name: Test setup run: | cp -a ../action/tests/cpp-autobuild autobuild-dir @@ -75,5 +75,5 @@ jobs: exit 1 fi env: - DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' + DOTNET_GENERATE_ASPNET_CERTIFICATE: "false" CODEQL_ACTION_TEST_MODE: true diff --git a/.github/workflows/__diagnostics-export.yml b/.github/workflows/__diagnostics-export.yml index d6494ac78..58923dac7 100644 --- a/.github/workflows/__diagnostics-export.yml +++ b/.github/workflows/__diagnostics-export.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -62,8 +62,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init id: init with: @@ -82,18 +82,18 @@ jobs: --ready-for-status-page - uses: ./../action/analyze with: - output: '${{ runner.temp }}/results' + output: "${{ runner.temp }}/results" upload-database: false - name: Upload SARIF uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: diagnostics-export-${{ matrix.os }}-${{ matrix.version }}.sarif.json - path: '${{ runner.temp }}/results/javascript.sarif' + path: "${{ runner.temp }}/results/javascript.sarif" retention-days: 7 - name: Check diagnostics appear in SARIF env: - SARIF_PATH: '${{ runner.temp }}/results/javascript.sarif' + SARIF_PATH: "${{ runner.temp }}/results/javascript.sarif" run: | cd ../action npx tsx ./pr-checks/check-diagnostics.ts diff --git a/.github/workflows/__diagnostics-without-db.yml b/.github/workflows/__diagnostics-without-db.yml index 9a1c3d6d9..5fbd580cc 100644 --- a/.github/workflows/__diagnostics-without-db.yml +++ b/.github/workflows/__diagnostics-without-db.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -67,8 +67,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - name: Initialise failing analysis id: init uses: ./../action/init @@ -87,11 +87,11 @@ jobs: # `category` input. Without this step, that part of the init post-action would fail. if: false with: - category: '/test-codeql-version:${{ matrix.version }}' + category: "/test-codeql-version:${{ matrix.version }}" - name: Check diagnostics appear on disk env: - DIAGNOSTICS_DIR: '${{ runner.temp }}/codeql-action-temp-diagnostics/' + DIAGNOSTICS_DIR: "${{ runner.temp }}/codeql-action-temp-diagnostics/" run: | cd ../action npx tsx ./pr-checks/diagnostics-without-db.ts diff --git a/.github/workflows/__export-file-baseline-information.yml b/.github/workflows/__export-file-baseline-information.yml index 050012257..b4e9138fe 100644 --- a/.github/workflows/__export-file-baseline-information.yml +++ b/.github/workflows/__export-file-baseline-information.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: dotnet-version: @@ -29,7 +29,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" workflow_call: inputs: dotnet-version: @@ -41,7 +41,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" defaults: run: shell: bash @@ -84,8 +84,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init id: init with: @@ -100,12 +100,12 @@ jobs: run: ./build.sh - uses: ./../action/analyze with: - output: '${{ runner.temp }}/results' + output: "${{ runner.temp }}/results" - name: Upload SARIF uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: with-baseline-information-${{ matrix.os }}-${{ matrix.version }}.sarif.json - path: '${{ runner.temp }}/results/javascript.sarif' + path: "${{ runner.temp }}/results/javascript.sarif" retention-days: 7 - name: Check results run: | diff --git a/.github/workflows/__extractor-ram-threads.yml b/.github/workflows/__extractor-ram-threads.yml index 2275921b4..bf9343d8d 100644 --- a/.github/workflows/__extractor-ram-threads.yml +++ b/.github/workflows/__extractor-ram-threads.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -51,8 +51,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init with: languages: java diff --git a/.github/workflows/__global-proxy.yml b/.github/workflows/__global-proxy.yml index 0c68f0dd4..c2f9f8514 100644 --- a/.github/workflows/__global-proxy.yml +++ b/.github/workflows/__global-proxy.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -53,8 +53,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'false' + use-all-platform-bundle: "false" + setup-kotlin: "false" - name: Block direct internet access to force proxy usage run: | apt-get update -qq && apt-get install -y -qq iptables >/dev/null 2>&1 diff --git a/.github/workflows/__go-custom-queries.yml b/.github/workflows/__go-custom-queries.yml index db7acd1ac..95287af32 100644 --- a/.github/workflows/__go-custom-queries.yml +++ b/.github/workflows/__go-custom-queries.yml @@ -3,7 +3,7 @@ # pr-checks/sync.sh # to regenerate this file. -name: 'PR Check - Go: Custom queries' +name: "PR Check - Go: Custom queries" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GO111MODULE: auto @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: dotnet-version: @@ -29,7 +29,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" workflow_call: inputs: dotnet-version: @@ -41,7 +41,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" defaults: run: shell: bash @@ -58,7 +58,7 @@ jobs: version: linked - os: ubuntu-26.04 version: nightly-latest - name: 'Go: Custom queries' + name: "Go: Custom queries" if: github.triggering_actor != 'dependabot[bot]' permissions: contents: read @@ -82,8 +82,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init with: languages: go @@ -93,5 +93,5 @@ jobs: run: ./build.sh - uses: ./../action/analyze env: - DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' + DOTNET_GENERATE_ASPNET_CERTIFICATE: "false" CODEQL_ACTION_TEST_MODE: true diff --git a/.github/workflows/__go-indirect-tracing-workaround-diagnostic.yml b/.github/workflows/__go-indirect-tracing-workaround-diagnostic.yml index b570ae4a6..bee84bef9 100644 --- a/.github/workflows/__go-indirect-tracing-workaround-diagnostic.yml +++ b/.github/workflows/__go-indirect-tracing-workaround-diagnostic.yml @@ -3,7 +3,7 @@ # pr-checks/sync.sh # to regenerate this file. -name: 'PR Check - Go: diagnostic when Go is changed after init step' +name: "PR Check - Go: diagnostic when Go is changed after init step" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GO111MODULE: auto @@ -17,21 +17,21 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: go-version: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" workflow_call: inputs: go-version: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" defaults: run: shell: bash @@ -46,7 +46,7 @@ jobs: include: - os: ubuntu-26.04 version: default - name: 'Go: diagnostic when Go is changed after init step' + name: "Go: diagnostic when Go is changed after init step" if: github.triggering_actor != 'dependabot[bot]' permissions: contents: read @@ -66,8 +66,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init with: languages: go @@ -75,17 +75,17 @@ jobs: # Deliberately change Go after the `init` step - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: - go-version: '1.20' + go-version: "1.20" - name: Build code run: go build main.go - uses: ./../action/analyze with: - output: '${{ runner.temp }}/results' + output: "${{ runner.temp }}/results" upload-database: false - name: Check diagnostic appears in SARIF uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: - SARIF_PATH: '${{ runner.temp }}/results/go.sarif' + SARIF_PATH: "${{ runner.temp }}/results/go.sarif" with: script: | const fs = require('fs'); diff --git a/.github/workflows/__go-indirect-tracing-workaround-no-file-program.yml b/.github/workflows/__go-indirect-tracing-workaround-no-file-program.yml index 137583625..3b535ecb4 100644 --- a/.github/workflows/__go-indirect-tracing-workaround-no-file-program.yml +++ b/.github/workflows/__go-indirect-tracing-workaround-no-file-program.yml @@ -3,7 +3,7 @@ # pr-checks/sync.sh # to regenerate this file. -name: 'PR Check - Go: diagnostic when `file` is not installed' +name: "PR Check - Go: diagnostic when `file` is not installed" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GO111MODULE: auto @@ -17,21 +17,21 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: go-version: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" workflow_call: inputs: go-version: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" defaults: run: shell: bash @@ -46,7 +46,7 @@ jobs: include: - os: ubuntu-26.04 version: default - name: 'Go: diagnostic when `file` is not installed' + name: "Go: diagnostic when `file` is not installed" if: github.triggering_actor != 'dependabot[bot]' permissions: contents: read @@ -66,8 +66,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - name: Remove `file` program run: | echo $(which file) @@ -81,12 +81,12 @@ jobs: run: go build main.go - uses: ./../action/analyze with: - output: '${{ runner.temp }}/results' + output: "${{ runner.temp }}/results" upload-database: false - name: Check diagnostic appears in SARIF uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: - SARIF_PATH: '${{ runner.temp }}/results/go.sarif' + SARIF_PATH: "${{ runner.temp }}/results/go.sarif" with: script: | const fs = require('fs'); diff --git a/.github/workflows/__go-indirect-tracing-workaround.yml b/.github/workflows/__go-indirect-tracing-workaround.yml index 5296e5837..6a659f8eb 100644 --- a/.github/workflows/__go-indirect-tracing-workaround.yml +++ b/.github/workflows/__go-indirect-tracing-workaround.yml @@ -3,7 +3,7 @@ # pr-checks/sync.sh # to regenerate this file. -name: 'PR Check - Go: workaround for indirect tracing' +name: "PR Check - Go: workaround for indirect tracing" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GO111MODULE: auto @@ -17,21 +17,21 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: go-version: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" workflow_call: inputs: go-version: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" defaults: run: shell: bash @@ -46,7 +46,7 @@ jobs: include: - os: ubuntu-26.04 version: default - name: 'Go: workaround for indirect tracing' + name: "Go: workaround for indirect tracing" if: github.triggering_actor != 'dependabot[bot]' permissions: contents: read @@ -66,8 +66,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init with: languages: go diff --git a/.github/workflows/__go-tracing-autobuilder.yml b/.github/workflows/__go-tracing-autobuilder.yml index 2b7005698..3a12fe90f 100644 --- a/.github/workflows/__go-tracing-autobuilder.yml +++ b/.github/workflows/__go-tracing-autobuilder.yml @@ -3,7 +3,7 @@ # pr-checks/sync.sh # to regenerate this file. -name: 'PR Check - Go: tracing with autobuilder step' +name: "PR Check - Go: tracing with autobuilder step" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GO111MODULE: auto @@ -17,21 +17,21 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: go-version: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" workflow_call: inputs: go-version: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" defaults: run: shell: bash @@ -66,7 +66,7 @@ jobs: version: nightly-latest - os: macos-26 version: nightly-latest - name: 'Go: tracing with autobuilder step' + name: "Go: tracing with autobuilder step" if: github.triggering_actor != 'dependabot[bot]' permissions: contents: read @@ -86,8 +86,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init with: languages: go @@ -106,5 +106,5 @@ jobs: exit 1 fi env: - DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' + DOTNET_GENERATE_ASPNET_CERTIFICATE: "false" CODEQL_ACTION_TEST_MODE: true diff --git a/.github/workflows/__go-tracing-custom-build-steps.yml b/.github/workflows/__go-tracing-custom-build-steps.yml index cc14651de..798cb55c3 100644 --- a/.github/workflows/__go-tracing-custom-build-steps.yml +++ b/.github/workflows/__go-tracing-custom-build-steps.yml @@ -3,7 +3,7 @@ # pr-checks/sync.sh # to regenerate this file. -name: 'PR Check - Go: tracing with custom build steps' +name: "PR Check - Go: tracing with custom build steps" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GO111MODULE: auto @@ -17,21 +17,21 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: go-version: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" workflow_call: inputs: go-version: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" defaults: run: shell: bash @@ -66,7 +66,7 @@ jobs: version: nightly-latest - os: macos-26 version: nightly-latest - name: 'Go: tracing with custom build steps' + name: "Go: tracing with custom build steps" if: github.triggering_actor != 'dependabot[bot]' permissions: contents: read @@ -86,8 +86,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init with: languages: go diff --git a/.github/workflows/__go-tracing-legacy-workflow.yml b/.github/workflows/__go-tracing-legacy-workflow.yml index df62bf53c..92ed9dc2f 100644 --- a/.github/workflows/__go-tracing-legacy-workflow.yml +++ b/.github/workflows/__go-tracing-legacy-workflow.yml @@ -3,7 +3,7 @@ # pr-checks/sync.sh # to regenerate this file. -name: 'PR Check - Go: tracing with legacy workflow' +name: "PR Check - Go: tracing with legacy workflow" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GO111MODULE: auto @@ -17,21 +17,21 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: go-version: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" workflow_call: inputs: go-version: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" defaults: run: shell: bash @@ -66,7 +66,7 @@ jobs: version: nightly-latest - os: macos-26 version: nightly-latest - name: 'Go: tracing with legacy workflow' + name: "Go: tracing with legacy workflow" if: github.triggering_actor != 'dependabot[bot]' permissions: contents: read @@ -86,8 +86,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init with: languages: go @@ -100,5 +100,5 @@ jobs: exit 1 fi env: - DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' + DOTNET_GENERATE_ASPNET_CERTIFICATE: "false" CODEQL_ACTION_TEST_MODE: true diff --git a/.github/workflows/__go.yml b/.github/workflows/__go.yml index 3688dc6fd..e16be4009 100644 --- a/.github/workflows/__go.yml +++ b/.github/workflows/__go.yml @@ -19,10 +19,10 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" jobs: go-custom-queries: - name: 'Go: Custom queries' + name: "Go: Custom queries" permissions: contents: read security-events: read @@ -31,7 +31,7 @@ jobs: dotnet-version: ${{ inputs.dotnet-version }} go-version: ${{ inputs.go-version }} go-indirect-tracing-workaround-diagnostic: - name: 'Go: diagnostic when Go is changed after init step' + name: "Go: diagnostic when Go is changed after init step" permissions: contents: read security-events: read @@ -39,7 +39,7 @@ jobs: with: go-version: ${{ inputs.go-version }} go-indirect-tracing-workaround-no-file-program: - name: 'Go: diagnostic when `file` is not installed' + name: "Go: diagnostic when `file` is not installed" permissions: contents: read security-events: read @@ -47,7 +47,7 @@ jobs: with: go-version: ${{ inputs.go-version }} go-indirect-tracing-workaround: - name: 'Go: workaround for indirect tracing' + name: "Go: workaround for indirect tracing" permissions: contents: read security-events: read @@ -55,7 +55,7 @@ jobs: with: go-version: ${{ inputs.go-version }} go-tracing-autobuilder: - name: 'Go: tracing with autobuilder step' + name: "Go: tracing with autobuilder step" permissions: contents: read security-events: read @@ -63,7 +63,7 @@ jobs: with: go-version: ${{ inputs.go-version }} go-tracing-custom-build-steps: - name: 'Go: tracing with custom build steps' + name: "Go: tracing with custom build steps" permissions: contents: read security-events: read @@ -71,7 +71,7 @@ jobs: with: go-version: ${{ inputs.go-version }} go-tracing-legacy-workflow: - name: 'Go: tracing with legacy workflow' + name: "Go: tracing with legacy workflow" permissions: contents: read security-events: read diff --git a/.github/workflows/__init-with-registries.yml b/.github/workflows/__init-with-registries.yml index 2e36baddc..3a01c3e51 100644 --- a/.github/workflows/__init-with-registries.yml +++ b/.github/workflows/__init-with-registries.yml @@ -3,7 +3,7 @@ # pr-checks/sync.sh # to regenerate this file. -name: 'PR Check - Packaging: Download using registries' +name: "PR Check - Packaging: Download using registries" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GO111MODULE: auto @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -40,7 +40,7 @@ jobs: version: linked - os: ubuntu-26.04 version: nightly-latest - name: 'Packaging: Download using registries' + name: "Packaging: Download using registries" if: github.triggering_actor != 'dependabot[bot]' permissions: contents: read @@ -55,12 +55,12 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - name: Init with registries uses: ./../action/init with: - db-location: '${{ runner.temp }}/customDbLocation' + db-location: "${{ runner.temp }}/customDbLocation" tools: ${{ steps.prepare-test.outputs.tools-url }} config-file: ./.github/codeql/codeql-config-registries.yml languages: javascript diff --git a/.github/workflows/__javascript-source-root.yml b/.github/workflows/__javascript-source-root.yml index 08c68e6f9..703c6ed75 100644 --- a/.github/workflows/__javascript-source-root.yml +++ b/.github/workflows/__javascript-source-root.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -55,8 +55,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - name: Move codeql-action run: | mkdir ../new-source-root diff --git a/.github/workflows/__job-run-uuid-sarif.yml b/.github/workflows/__job-run-uuid-sarif.yml index 5d49830cd..4a76f8b95 100644 --- a/.github/workflows/__job-run-uuid-sarif.yml +++ b/.github/workflows/__job-run-uuid-sarif.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -51,8 +51,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init id: init with: @@ -60,12 +60,12 @@ jobs: tools: ${{ steps.prepare-test.outputs.tools-url }} - uses: ./../action/analyze with: - output: '${{ runner.temp }}/results' + output: "${{ runner.temp }}/results" - name: Upload SARIF uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: ${{ matrix.os }}-${{ matrix.version }}.sarif.json - path: '${{ runner.temp }}/results/javascript.sarif' + path: "${{ runner.temp }}/results/javascript.sarif" retention-days: 7 - name: Check results run: | diff --git a/.github/workflows/__language-aliases.yml b/.github/workflows/__language-aliases.yml index 1e5c17395..048441fd3 100644 --- a/.github/workflows/__language-aliases.yml +++ b/.github/workflows/__language-aliases.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -51,14 +51,14 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init with: languages: C#,java-kotlin,typescript tools: ${{ steps.prepare-test.outputs.tools-url }} - - name: 'Check languages' + - name: "Check languages" run: | expected_languages="csharp,java,javascript" actual_languages=$(jq -r '.languages | join(",")' "$RUNNER_TEMP"/config) diff --git a/.github/workflows/__linux-arm64.yml b/.github/workflows/__linux-arm64.yml index de045d895..02dab69f9 100644 --- a/.github/workflows/__linux-arm64.yml +++ b/.github/workflows/__linux-arm64.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: dotnet-version: @@ -29,7 +29,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" workflow_call: inputs: dotnet-version: @@ -41,7 +41,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" defaults: run: shell: bash @@ -80,8 +80,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init with: languages: ${{ env.LANGUAGES }} diff --git a/.github/workflows/__local-bundle.yml b/.github/workflows/__local-bundle.yml index bc384bdf1..e4b20c9b4 100644 --- a/.github/workflows/__local-bundle.yml +++ b/.github/workflows/__local-bundle.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: dotnet-version: @@ -29,7 +29,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" workflow_call: inputs: dotnet-version: @@ -41,7 +41,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" defaults: run: shell: bash @@ -80,8 +80,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - name: Fetch latest CodeQL bundle run: | wget https://github.com/github/codeql-action/releases/latest/download/codeql-bundle-linux64.tar.zst diff --git a/.github/workflows/__multi-language-autodetect.yml b/.github/workflows/__multi-language-autodetect.yml index f1028a6eb..41588c945 100644 --- a/.github/workflows/__multi-language-autodetect.yml +++ b/.github/workflows/__multi-language-autodetect.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: dotnet-version: @@ -29,7 +29,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" workflow_call: inputs: dotnet-version: @@ -41,7 +41,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" defaults: run: shell: bash @@ -114,8 +114,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - name: Install Python 3.13.15 for older CLI versions # Older CLI versions don't work with Python 3.13.16 or newer because their Python extractor # imports `importlib._bootstrap._ERR_MSG`, which those Python versions no longer define. @@ -123,7 +123,7 @@ jobs: if: matrix.version != 'nightly-latest' && matrix.version != 'linked' uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: - python-version: '3.13.15' + python-version: "3.13.15" - name: Use Xcode 16 # Only the older CodeQL CLI versions need Xcode 16, and these run on macOS 15. @@ -133,7 +133,7 @@ jobs: - uses: ./../action/init id: init with: - db-location: '${{ runner.temp }}/customDbLocation' + db-location: "${{ runner.temp }}/customDbLocation" languages: ${{ runner.os == 'Linux' && 'cpp,csharp,go,java,javascript,python,ruby' || '' }} tools: ${{ steps.prepare-test.outputs.tools-url }} diff --git a/.github/workflows/__overlay-init-fallback.yml b/.github/workflows/__overlay-init-fallback.yml index a2c320fb5..3cdcec371 100644 --- a/.github/workflows/__overlay-init-fallback.yml +++ b/.github/workflows/__overlay-init-fallback.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -53,8 +53,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init with: languages: actions # Any language without overlay support will do diff --git a/.github/workflows/__packaging-codescanning-config-inputs-js.yml b/.github/workflows/__packaging-codescanning-config-inputs-js.yml index 070d7e391..3b703bea5 100644 --- a/.github/workflows/__packaging-codescanning-config-inputs-js.yml +++ b/.github/workflows/__packaging-codescanning-config-inputs-js.yml @@ -3,7 +3,7 @@ # pr-checks/sync.sh # to regenerate this file. -name: 'PR Check - Packaging: Config and input passed to the CLI' +name: "PR Check - Packaging: Config and input passed to the CLI" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GO111MODULE: auto @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: dotnet-version: @@ -29,7 +29,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" workflow_call: inputs: dotnet-version: @@ -41,7 +41,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" defaults: run: shell: bash @@ -60,7 +60,7 @@ jobs: version: default - os: ubuntu-26.04 version: nightly-latest - name: 'Packaging: Config and input passed to the CLI' + name: "Packaging: Config and input passed to the CLI" if: github.triggering_actor != 'dependabot[bot]' permissions: contents: read @@ -93,11 +93,11 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init with: - config-file: '.github/codeql/codeql-config-packaging3.yml' + config-file: ".github/codeql/codeql-config-packaging3.yml" packs: +codeql-testing/codeql-pack1@1.0.0 languages: javascript tools: ${{ steps.prepare-test.outputs.tools-url }} @@ -105,7 +105,7 @@ jobs: run: ./build.sh - uses: ./../action/analyze with: - output: '${{ runner.temp }}/results' + output: "${{ runner.temp }}/results" upload-database: false - name: Check results diff --git a/.github/workflows/__packaging-config-inputs-js.yml b/.github/workflows/__packaging-config-inputs-js.yml index 3465616db..6a346631e 100644 --- a/.github/workflows/__packaging-config-inputs-js.yml +++ b/.github/workflows/__packaging-config-inputs-js.yml @@ -3,7 +3,7 @@ # pr-checks/sync.sh # to regenerate this file. -name: 'PR Check - Packaging: Config and input' +name: "PR Check - Packaging: Config and input" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GO111MODULE: auto @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: dotnet-version: @@ -29,7 +29,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" workflow_call: inputs: dotnet-version: @@ -41,7 +41,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" defaults: run: shell: bash @@ -60,7 +60,7 @@ jobs: version: default - os: ubuntu-26.04 version: nightly-latest - name: 'Packaging: Config and input' + name: "Packaging: Config and input" if: github.triggering_actor != 'dependabot[bot]' permissions: contents: read @@ -93,11 +93,11 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init with: - config-file: '.github/codeql/codeql-config-packaging3.yml' + config-file: ".github/codeql/codeql-config-packaging3.yml" packs: +codeql-testing/codeql-pack1@1.0.0 languages: javascript tools: ${{ steps.prepare-test.outputs.tools-url }} @@ -105,7 +105,7 @@ jobs: run: ./build.sh - uses: ./../action/analyze with: - output: '${{ runner.temp }}/results' + output: "${{ runner.temp }}/results" upload-database: false - name: Check results diff --git a/.github/workflows/__packaging-config-js.yml b/.github/workflows/__packaging-config-js.yml index 0e7b828c0..75f426c34 100644 --- a/.github/workflows/__packaging-config-js.yml +++ b/.github/workflows/__packaging-config-js.yml @@ -3,7 +3,7 @@ # pr-checks/sync.sh # to regenerate this file. -name: 'PR Check - Packaging: Config file' +name: "PR Check - Packaging: Config file" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GO111MODULE: auto @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: dotnet-version: @@ -29,7 +29,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" workflow_call: inputs: dotnet-version: @@ -41,7 +41,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" defaults: run: shell: bash @@ -60,7 +60,7 @@ jobs: version: default - os: ubuntu-26.04 version: nightly-latest - name: 'Packaging: Config file' + name: "Packaging: Config file" if: github.triggering_actor != 'dependabot[bot]' permissions: contents: read @@ -93,18 +93,18 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init with: - config-file: '.github/codeql/codeql-config-packaging.yml' + config-file: ".github/codeql/codeql-config-packaging.yml" languages: javascript tools: ${{ steps.prepare-test.outputs.tools-url }} - name: Build code run: ./build.sh - uses: ./../action/analyze with: - output: '${{ runner.temp }}/results' + output: "${{ runner.temp }}/results" upload-database: false - name: Check results diff --git a/.github/workflows/__packaging-inputs-js.yml b/.github/workflows/__packaging-inputs-js.yml index 80c792069..be72e2556 100644 --- a/.github/workflows/__packaging-inputs-js.yml +++ b/.github/workflows/__packaging-inputs-js.yml @@ -3,7 +3,7 @@ # pr-checks/sync.sh # to regenerate this file. -name: 'PR Check - Packaging: Action input' +name: "PR Check - Packaging: Action input" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GO111MODULE: auto @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: dotnet-version: @@ -29,7 +29,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" workflow_call: inputs: dotnet-version: @@ -41,7 +41,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" defaults: run: shell: bash @@ -60,7 +60,7 @@ jobs: version: default - os: ubuntu-26.04 version: nightly-latest - name: 'Packaging: Action input' + name: "Packaging: Action input" if: github.triggering_actor != 'dependabot[bot]' permissions: contents: read @@ -93,11 +93,11 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init with: - config-file: '.github/codeql/codeql-config-packaging2.yml' + config-file: ".github/codeql/codeql-config-packaging2.yml" languages: javascript packs: codeql-testing/codeql-pack1@1.0.0, codeql-testing/codeql-pack2, codeql-testing/codeql-pack3:other-query.ql tools: ${{ steps.prepare-test.outputs.tools-url }} @@ -105,7 +105,7 @@ jobs: run: ./build.sh - uses: ./../action/analyze with: - output: '${{ runner.temp }}/results' + output: "${{ runner.temp }}/results" - name: Check results uses: ./../action/.github/actions/check-sarif diff --git a/.github/workflows/__per-language-bundle-validation.yml b/.github/workflows/__per-language-bundle-validation.yml index cb6b1a773..3313ac010 100644 --- a/.github/workflows/__per-language-bundle-validation.yml +++ b/.github/workflows/__per-language-bundle-validation.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -95,8 +95,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - name: Remove CodeQL from toolcache run: | cd ./../action diff --git a/.github/workflows/__remote-config.yml b/.github/workflows/__remote-config.yml index 485a4904c..1f8b1f127 100644 --- a/.github/workflows/__remote-config.yml +++ b/.github/workflows/__remote-config.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: dotnet-version: @@ -29,7 +29,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" workflow_call: inputs: dotnet-version: @@ -41,7 +41,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" defaults: run: shell: bash @@ -82,8 +82,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init with: tools: ${{ steps.prepare-test.outputs.tools-url }} diff --git a/.github/workflows/__resolve-environment-action.yml b/.github/workflows/__resolve-environment-action.yml index 7a4e284d7..2d0ebd6fb 100644 --- a/.github/workflows/__resolve-environment-action.yml +++ b/.github/workflows/__resolve-environment-action.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -55,8 +55,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init with: languages: go,javascript-typescript diff --git a/.github/workflows/__ruby.yml b/.github/workflows/__ruby.yml index 833e49789..8ce015624 100644 --- a/.github/workflows/__ruby.yml +++ b/.github/workflows/__ruby.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -61,8 +61,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init with: languages: ruby diff --git a/.github/workflows/__rust.yml b/.github/workflows/__rust.yml index 83cdbf677..0e08f9919 100644 --- a/.github/workflows/__rust.yml +++ b/.github/workflows/__rust.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -59,8 +59,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init with: languages: rust diff --git a/.github/workflows/__split-workflow.yml b/.github/workflows/__split-workflow.yml index 0cb63b85c..b80d36819 100644 --- a/.github/workflows/__split-workflow.yml +++ b/.github/workflows/__split-workflow.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: dotnet-version: @@ -29,7 +29,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" workflow_call: inputs: dotnet-version: @@ -41,7 +41,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" defaults: run: shell: bash @@ -90,11 +90,11 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init with: - config-file: '.github/codeql/codeql-config-packaging3.yml' + config-file: ".github/codeql/codeql-config-packaging3.yml" packs: +codeql-testing/codeql-pack1@1.0.0 languages: javascript tools: ${{ steps.prepare-test.outputs.tools-url }} @@ -103,7 +103,7 @@ jobs: - uses: ./../action/analyze with: skip-queries: true - output: '${{ runner.temp }}/results' + output: "${{ runner.temp }}/results" upload-database: false - name: Assert No Results @@ -114,7 +114,7 @@ jobs: fi - uses: ./../action/analyze with: - output: '${{ runner.temp }}/results' + output: "${{ runner.temp }}/results" upload-database: false - name: Assert Results run: | diff --git a/.github/workflows/__start-proxy.yml b/.github/workflows/__start-proxy.yml index e6906cbc3..a636a1bf5 100644 --- a/.github/workflows/__start-proxy.yml +++ b/.github/workflows/__start-proxy.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -55,8 +55,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - name: Setup proxy for registries id: proxy uses: ./../action/start-proxy @@ -101,5 +101,5 @@ jobs: tools: ${{ steps.prepare-test.outputs.tools-url }} config-file: codeql-action@main:tests/multi-language-repo/.github/codeql/custom-queries.yml env: - CODEQL_ACTION_PROXY_API_REQUESTS: 'true' + CODEQL_ACTION_PROXY_API_REQUESTS: "true" CODEQL_ACTION_TEST_MODE: true diff --git a/.github/workflows/__submit-sarif-failure.yml b/.github/workflows/__submit-sarif-failure.yml index b7edd62fc..8eb219c9b 100644 --- a/.github/workflows/__submit-sarif-failure.yml +++ b/.github/workflows/__submit-sarif-failure.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -55,8 +55,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: ./init with: @@ -76,7 +76,7 @@ jobs: # `category` input. Without this step, that part of the init post-action would fail. if: false with: - category: '/test-codeql-version:${{ matrix.version }}' + category: "/test-codeql-version:${{ matrix.version }}" env: CODEQL_ACTION_EXPECT_UPLOAD_FAILED_SARIF: true CODEQL_ACTION_UPLOAD_FAILED_SARIF: true diff --git a/.github/workflows/__swift-autobuild.yml b/.github/workflows/__swift-autobuild.yml index 4ba28f348..cc67bfdb6 100644 --- a/.github/workflows/__swift-autobuild.yml +++ b/.github/workflows/__swift-autobuild.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -51,8 +51,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init id: init with: diff --git a/.github/workflows/__swift-custom-build.yml b/.github/workflows/__swift-custom-build.yml index c38f0daa1..1d1a8d9f1 100644 --- a/.github/workflows/__swift-custom-build.yml +++ b/.github/workflows/__swift-custom-build.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: dotnet-version: @@ -29,7 +29,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" workflow_call: inputs: dotnet-version: @@ -41,7 +41,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" defaults: run: shell: bash @@ -84,8 +84,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init id: init with: @@ -107,5 +107,5 @@ jobs: exit 1 fi env: - DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' + DOTNET_GENERATE_ASPNET_CERTIFICATE: "false" CODEQL_ACTION_TEST_MODE: true diff --git a/.github/workflows/__unset-environment.yml b/.github/workflows/__unset-environment.yml index 6ef214e70..77896566e 100644 --- a/.github/workflows/__unset-environment.yml +++ b/.github/workflows/__unset-environment.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: dotnet-version: @@ -29,7 +29,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" workflow_call: inputs: dotnet-version: @@ -41,7 +41,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" defaults: run: shell: bash @@ -82,8 +82,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init id: init with: diff --git a/.github/workflows/__unsupported-macos.yml b/.github/workflows/__unsupported-macos.yml index 5e388d1ec..f98bf6959 100644 --- a/.github/workflows/__unsupported-macos.yml +++ b/.github/workflows/__unsupported-macos.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: {} workflow_call: @@ -62,8 +62,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - name: Check xcode_select_link run: | readlink /private/var/db/xcode_select_link @@ -86,7 +86,7 @@ jobs: if: false uses: ./analyze with: - category: '/test-codeql-version:${{ matrix.version }}' + category: "/test-codeql-version:${{ matrix.version }}" env: CODEQL_ACTION_SKIP_GENERATE_FAILED_SARIF: false CODEQL_ACTION_SKIP_SARIF_UPLOAD: true @@ -114,7 +114,7 @@ jobs: - name: Install dependencies run: npm ci - name: Download workflow artifact - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: pattern: test-mode-sarif-* path: sarif diff --git a/.github/workflows/__upload-ref-sha-input.yml b/.github/workflows/__upload-ref-sha-input.yml index 079bc6597..f0f38c32e 100644 --- a/.github/workflows/__upload-ref-sha-input.yml +++ b/.github/workflows/__upload-ref-sha-input.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: dotnet-version: @@ -29,7 +29,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" workflow_call: inputs: dotnet-version: @@ -41,7 +41,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" defaults: run: shell: bash @@ -80,8 +80,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init with: tools: ${{ steps.prepare-test.outputs.tools-url }} @@ -92,12 +92,12 @@ jobs: # Generate some SARIF we can upload with the upload-sarif step - uses: ./../action/analyze with: - ref: 'refs/heads/main' - sha: '5e235361806c361d4d3f8859e3c897658025a9a2' + ref: "refs/heads/main" + sha: "5e235361806c361d4d3f8859e3c897658025a9a2" upload: never - uses: ./../action/upload-sarif with: - ref: 'refs/heads/main' - sha: '5e235361806c361d4d3f8859e3c897658025a9a2' + ref: "refs/heads/main" + sha: "5e235361806c361d4d3f8859e3c897658025a9a2" env: CODEQL_ACTION_TEST_MODE: true diff --git a/.github/workflows/__upload-sarif.yml b/.github/workflows/__upload-sarif.yml index c35fb3f59..a1f53bbbe 100644 --- a/.github/workflows/__upload-sarif.yml +++ b/.github/workflows/__upload-sarif.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: dotnet-version: @@ -29,7 +29,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" workflow_call: inputs: dotnet-version: @@ -41,7 +41,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" defaults: run: shell: bash @@ -87,8 +87,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - uses: ./../action/init with: tools: ${{ steps.prepare-test.outputs.tools-url }} @@ -99,8 +99,8 @@ jobs: # Generate some SARIF we can upload with the upload-sarif step - uses: ./../action/analyze with: - ref: 'refs/heads/main' - sha: '5e235361806c361d4d3f8859e3c897658025a9a2' + ref: "refs/heads/main" + sha: "5e235361806c361d4d3f8859e3c897658025a9a2" upload: never output: ${{ runner.temp }}/results @@ -109,15 +109,15 @@ jobs: uses: ./../action/upload-sarif id: upload-sarif with: - ref: 'refs/heads/main' - sha: '5e235361806c361d4d3f8859e3c897658025a9a2' + ref: "refs/heads/main" + sha: "5e235361806c361d4d3f8859e3c897658025a9a2" sarif_file: ${{ runner.temp }}/results category: | ${{ github.workflow }}:upload-sarif/analysis-kinds:${{ matrix.analysis-kinds }}/os:${{ matrix.os }}/version:${{ matrix.version }}/test:all-files/ - - name: 'Fail for missing output from `upload-sarif` step for `code-scanning`' + - name: "Fail for missing output from `upload-sarif` step for `code-scanning`" if: contains(matrix.analysis-kinds, 'code-scanning') && !(fromJSON(steps.upload-sarif.outputs.sarif-ids).code-scanning) run: exit 1 - - name: 'Fail for missing output from `upload-sarif` step for `code-quality`' + - name: "Fail for missing output from `upload-sarif` step for `code-quality`" if: contains(matrix.analysis-kinds, 'code-quality') && !(fromJSON(steps.upload-sarif.outputs.sarif-ids).code-quality) run: exit 1 @@ -126,12 +126,12 @@ jobs: id: upload-single-sarif-code-scanning if: contains(matrix.analysis-kinds, 'code-scanning') with: - ref: 'refs/heads/main' - sha: '5e235361806c361d4d3f8859e3c897658025a9a2' + ref: "refs/heads/main" + sha: "5e235361806c361d4d3f8859e3c897658025a9a2" sarif_file: ${{ runner.temp }}/results/javascript.sarif category: | ${{ github.workflow }}:upload-sarif/analysis-kinds:${{ matrix.analysis-kinds }}/os:${{ matrix.os }}/version:${{ matrix.version }}/test:single-code-scanning/ - - name: 'Fail for missing output from `upload-single-sarif-code-scanning` step' + - name: "Fail for missing output from `upload-single-sarif-code-scanning` step" if: contains(matrix.analysis-kinds, 'code-scanning') && !(fromJSON(steps.upload-single-sarif-code-scanning.outputs.sarif-ids).code-scanning) run: exit 1 - name: Upload single SARIF file for Code Quality @@ -139,12 +139,12 @@ jobs: id: upload-single-sarif-code-quality if: contains(matrix.analysis-kinds, 'code-quality') with: - ref: 'refs/heads/main' - sha: '5e235361806c361d4d3f8859e3c897658025a9a2' + ref: "refs/heads/main" + sha: "5e235361806c361d4d3f8859e3c897658025a9a2" sarif_file: ${{ runner.temp }}/results/javascript.quality.sarif category: | ${{ github.workflow }}:upload-sarif/analysis-kinds:${{ matrix.analysis-kinds }}/os:${{ matrix.os }}/version:${{ matrix.version }}/test:single-code-quality/ - - name: 'Fail for missing output from `upload-single-sarif-code-quality` step' + - name: "Fail for missing output from `upload-single-sarif-code-quality` step" if: contains(matrix.analysis-kinds, 'code-quality') && !(fromJSON(steps.upload-single-sarif-code-quality.outputs.sarif-ids).code-quality) run: exit 1 @@ -156,12 +156,12 @@ jobs: id: upload-single-non-sarif if: contains(matrix.analysis-kinds, 'code-scanning') with: - ref: 'refs/heads/main' - sha: '5e235361806c361d4d3f8859e3c897658025a9a2' + ref: "refs/heads/main" + sha: "5e235361806c361d4d3f8859e3c897658025a9a2" sarif_file: ${{ runner.temp }}/results/javascript.sarif.json category: | ${{ github.workflow }}:upload-sarif/analysis-kinds:${{ matrix.analysis-kinds }}/os:${{ matrix.os }}/version:${{ matrix.version }}/test:non-sarif/ - - name: 'Fail for missing output from `upload-single-non-sarif` step' + - name: "Fail for missing output from `upload-single-non-sarif` step" if: contains(matrix.analysis-kinds, 'code-scanning') && !(fromJSON(steps.upload-single-non-sarif.outputs.sarif-ids).code-scanning) run: exit 1 env: diff --git a/.github/workflows/__with-checkout-path.yml b/.github/workflows/__with-checkout-path.yml index d3c849c73..cef72ae57 100644 --- a/.github/workflows/__with-checkout-path.yml +++ b/.github/workflows/__with-checkout-path.yml @@ -17,7 +17,7 @@ on: types: - checks_requested schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: inputs: dotnet-version: @@ -29,7 +29,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" workflow_call: inputs: dotnet-version: @@ -41,7 +41,7 @@ on: type: string description: The version of Go to install required: false - default: '>=1.21.0' + default: ">=1.21.0" defaults: run: shell: bash @@ -81,8 +81,8 @@ jobs: uses: ./.github/actions/prepare-test with: version: ${{ matrix.version }} - use-all-platform-bundle: 'false' - setup-kotlin: 'true' + use-all-platform-bundle: "false" + setup-kotlin: "true" - name: Delete original checkout run: | # delete the original checkout so we don't accidentally use it. diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 451238b66..efbb246fc 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -8,7 +8,7 @@ on: types: [checks_requested] schedule: # Weekly on Sunday. - - cron: '30 1 * * 0' + - cron: "30 1 * * 0" workflow_dispatch: defaults: @@ -32,41 +32,41 @@ jobs: security-events: read steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - name: Set up default CodeQL bundle - id: setup-default - uses: ./setup-codeql - - name: Set up linked CodeQL bundle - id: setup-linked - uses: ./setup-codeql - with: - tools: linked - - name: Compare default and linked CodeQL bundle versions - id: compare - env: - CODEQL_DEFAULT: ${{ steps.setup-default.outputs.codeql-path }} - CODEQL_LINKED: ${{ steps.setup-linked.outputs.codeql-path }} - run: | - CODEQL_VERSION_DEFAULT="$("$CODEQL_DEFAULT" version --format terse)" - CODEQL_VERSION_LINKED="$("$CODEQL_LINKED" version --format terse)" - echo "Default CodeQL bundle version is $CODEQL_VERSION_DEFAULT" - echo "Linked CodeQL bundle version is $CODEQL_VERSION_LINKED" + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Set up default CodeQL bundle + id: setup-default + uses: ./setup-codeql + - name: Set up linked CodeQL bundle + id: setup-linked + uses: ./setup-codeql + with: + tools: linked + - name: Compare default and linked CodeQL bundle versions + id: compare + env: + CODEQL_DEFAULT: ${{ steps.setup-default.outputs.codeql-path }} + CODEQL_LINKED: ${{ steps.setup-linked.outputs.codeql-path }} + run: | + CODEQL_VERSION_DEFAULT="$("$CODEQL_DEFAULT" version --format terse)" + CODEQL_VERSION_LINKED="$("$CODEQL_LINKED" version --format terse)" + echo "Default CodeQL bundle version is $CODEQL_VERSION_DEFAULT" + echo "Linked CodeQL bundle version is $CODEQL_VERSION_LINKED" - # If we're running on a pull request, run with both bundles, even if `tools: linked` would - # be the same as `tools: null`. This allows us to make the job for each of the bundles a - # required status check. - # - # If we're running on push or schedule, then we can skip running with `tools: linked` when it would be - # the same as running with `tools: null`. - if [[ "$GITHUB_EVENT_NAME" != "pull_request" && "$GITHUB_EVENT_NAME" != "merge_group" && "$CODEQL_VERSION_DEFAULT" == "$CODEQL_VERSION_LINKED" ]]; then - VERSIONS_JSON='[null]' - else - VERSIONS_JSON='[null, "linked"]' - fi + # If we're running on a pull request, run with both bundles, even if `tools: linked` would + # be the same as `tools: null`. This allows us to make the job for each of the bundles a + # required status check. + # + # If we're running on push or schedule, then we can skip running with `tools: linked` when it would be + # the same as running with `tools: null`. + if [[ "$GITHUB_EVENT_NAME" != "pull_request" && "$GITHUB_EVENT_NAME" != "merge_group" && "$CODEQL_VERSION_DEFAULT" == "$CODEQL_VERSION_LINKED" ]]; then + VERSIONS_JSON='[null]' + else + VERSIONS_JSON='[null, "linked"]' + fi - # Output a JSON-encoded list with the distinct versions to test against. - echo "Suggested matrix config for analysis job: $VERSIONS_JSON" - echo "versions=${VERSIONS_JSON}" >> $GITHUB_OUTPUT + # Output a JSON-encoded list with the distinct versions to test against. + echo "Suggested matrix config for analysis job: $VERSIONS_JSON" + echo "versions=${VERSIONS_JSON}" >> $GITHUB_OUTPUT analyze-javascript: if: github.triggering_actor != 'dependabot[bot]' @@ -74,7 +74,13 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-22.04,ubuntu-24.04,windows-2022,windows-2025,macos-14-xlarge,macos-15-xlarge] + os: + - ubuntu-22.04 + - ubuntu-24.04 + - windows-2022 + - windows-2025 + - macos-14-xlarge + - macos-15-xlarge tools: ${{ fromJson(needs.check-codeql-versions.outputs.versions) }} runs-on: ${{ matrix.os }} @@ -83,26 +89,26 @@ jobs: security-events: write steps: - - name: Checkout - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - name: Initialize CodeQL - uses: ./init - id: init - with: - languages: javascript - config-file: ./.github/codeql/codeql-config-javascript.yml - tools: ${{ matrix.tools }} - # confirm steps.init.outputs.codeql-path points to the codeql binary - - name: Print CodeQL Version - run: > - "$CODEQL" version --format=json - env: - CODEQL: ${{steps.init.outputs.codeql-path}} - - name: Perform CodeQL Analysis - uses: ./analyze - with: - category: "/language:javascript" - upload: ${{ (matrix.os == 'ubuntu-24.04' && !matrix.tools && github.event_name != 'merge_group' && 'always' ) || 'never' }} + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Initialize CodeQL + uses: ./init + id: init + with: + languages: javascript + config-file: ./.github/codeql/codeql-config-javascript.yml + tools: ${{ matrix.tools }} + # confirm steps.init.outputs.codeql-path points to the codeql binary + - name: Print CodeQL Version + run: > + "$CODEQL" version --format=json + env: + CODEQL: ${{steps.init.outputs.codeql-path}} + - name: Perform CodeQL Analysis + uses: ./analyze + with: + category: "/language:javascript" + upload: ${{ (matrix.os == 'ubuntu-24.04' && !matrix.tools && github.event_name != 'merge_group' && 'always' ) || 'never' }} analyze-other: if: github.triggering_actor != 'dependabot[bot]' @@ -119,21 +125,21 @@ jobs: security-events: write steps: - - name: Checkout - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - name: Initialize CodeQL - uses: ./init - with: - languages: ${{ matrix.language }} - build-mode: none - config: > - paths-ignore: - - lib - - tests - queries: - - uses: security-and-quality - - name: Perform CodeQL Analysis - uses: ./analyze - with: - category: "/language:${{ matrix.language }}" - upload: ${{ (github.event_name != 'merge_group' && 'always') || 'never' }} + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Initialize CodeQL + uses: ./init + with: + languages: ${{ matrix.language }} + build-mode: none + config: > + paths-ignore: + - lib + - tests + queries: + - uses: security-and-quality + - name: Perform CodeQL Analysis + uses: ./analyze + with: + category: "/language:${{ matrix.language }}" + upload: ${{ (github.event_name != 'merge_group' && 'always') || 'never' }} diff --git a/.github/workflows/codescanning-config-cli.yml b/.github/workflows/codescanning-config-cli.yml index b1194460d..f2d819bbc 100644 --- a/.github/workflows/codescanning-config-cli.yml +++ b/.github/workflows/codescanning-config-cli.yml @@ -10,13 +10,13 @@ env: on: push: branches: - - main - - releases/v* + - main + - releases/v* pull_request: merge_group: types: [checks_requested] schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: concurrency: @@ -41,187 +41,187 @@ jobs: fail-fast: false matrix: include: - - os: ubuntu-26.04 - version: linked - - os: ubuntu-26.04 - version: default - - os: ubuntu-26.04 - version: nightly-latest + - os: ubuntu-26.04 + version: linked + - os: ubuntu-26.04 + version: default + - os: ubuntu-26.04 + version: nightly-latest # Code-Scanning config not created because environment variable is not set name: Code Scanning Configuration tests timeout-minutes: 45 runs-on: ${{ matrix.os }} steps: - - name: Check out repository - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Check out repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - name: Set up Node.js - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 - with: - node-version: 24 - cache: 'npm' + - name: Set up Node.js + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: 24 + cache: "npm" - - name: Install dependencies - run: npm ci + - name: Install dependencies + run: npm ci - - name: Prepare test - id: prepare-test - uses: ./.github/actions/prepare-test - with: - version: ${{ matrix.version }} + - name: Prepare test + id: prepare-test + uses: ./.github/actions/prepare-test + with: + version: ${{ matrix.version }} - - name: Empty file - uses: ./../action/.github/actions/check-codescanning-config - with: - expected-config-file-contents: "{}" - # Request multiple languages so later checks can reuse the combined bundle. - languages: javascript,python - tools: ${{ steps.prepare-test.outputs.tools-url }} + - name: Empty file + uses: ./../action/.github/actions/check-codescanning-config + with: + expected-config-file-contents: "{}" + # Request multiple languages so later checks can reuse the combined bundle. + languages: javascript,python + tools: ${{ steps.prepare-test.outputs.tools-url }} - - name: Packs from input - if: success() || failure() - uses: ./../action/.github/actions/check-codescanning-config - with: - expected-config-file-contents: | - { - "packs": ["codeql-testing/codeql-pack1@1.0.0", "codeql-testing/codeql-pack2" ] - } - languages: javascript - packs: codeql-testing/codeql-pack1@1.0.0, codeql-testing/codeql-pack2 - tools: ${{ steps.prepare-test.outputs.tools-url }} - - - name: Packs from input with + - if: success() || failure() - uses: ./../action/.github/actions/check-codescanning-config - with: - expected-config-file-contents: | - { - "packs": ["codeql-testing/codeql-pack1@1.0.0", "codeql-testing/codeql-pack2" ] - } - languages: javascript - packs: + codeql-testing/codeql-pack1@1.0.0, codeql-testing/codeql-pack2 - tools: ${{ steps.prepare-test.outputs.tools-url }} - - - name: Queries from input - if: success() || failure() - uses: ./../action/.github/actions/check-codescanning-config - with: - expected-config-file-contents: | - { - "queries": [{ "uses": "./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql" }] - } - languages: javascript - queries: ./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql - tools: ${{ steps.prepare-test.outputs.tools-url }} - - - name: Queries from input with + - if: success() || failure() - uses: ./../action/.github/actions/check-codescanning-config - with: - expected-config-file-contents: | - { - "queries": [{ "uses": "./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql" }] - } - languages: javascript - queries: + ./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql - tools: ${{ steps.prepare-test.outputs.tools-url }} - - - name: Queries and packs from input with + - if: success() || failure() - uses: ./../action/.github/actions/check-codescanning-config - with: - expected-config-file-contents: | - { - "queries": [{ "uses": "./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql" }], - "packs": ["codeql-testing/codeql-pack1@1.0.0", "codeql-testing/codeql-pack2" ] - } - languages: javascript - queries: + ./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql - packs: + codeql-testing/codeql-pack1@1.0.0, codeql-testing/codeql-pack2 - tools: ${{ steps.prepare-test.outputs.tools-url }} - - - name: Queries and packs from config - if: success() || failure() - uses: ./../action/.github/actions/check-codescanning-config - with: - expected-config-file-contents: | - { - "queries": [{ "uses": "./codeql-qlpacks/complex-javascript-qlpack/foo2/show_ifs.ql" }], - "packs": { - "javascript": ["codeql-testing/codeql-pack1@1.0.0", "codeql-testing/codeql-pack2" ] + - name: Packs from input + if: success() || failure() + uses: ./../action/.github/actions/check-codescanning-config + with: + expected-config-file-contents: | + { + "packs": ["codeql-testing/codeql-pack1@1.0.0", "codeql-testing/codeql-pack2" ] } - } - languages: javascript - config-file-test: .github/codeql/queries-and-packs-config.yml - tools: ${{ steps.prepare-test.outputs.tools-url }} + languages: javascript + packs: codeql-testing/codeql-pack1@1.0.0, codeql-testing/codeql-pack2 + tools: ${{ steps.prepare-test.outputs.tools-url }} - - name: Queries and packs from config overriden by input - if: success() || failure() - uses: ./../action/.github/actions/check-codescanning-config - with: - expected-config-file-contents: | - { - "queries": [{ "uses": "./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql" }], - "packs": ["codeql/javascript-queries"] - } - languages: javascript - queries: ./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql - packs: codeql/javascript-queries - config-file-test: .github/codeql/queries-and-packs-config.yml - tools: ${{ steps.prepare-test.outputs.tools-url }} + - name: Packs from input with + + if: success() || failure() + uses: ./../action/.github/actions/check-codescanning-config + with: + expected-config-file-contents: | + { + "packs": ["codeql-testing/codeql-pack1@1.0.0", "codeql-testing/codeql-pack2" ] + } + languages: javascript + packs: + codeql-testing/codeql-pack1@1.0.0, codeql-testing/codeql-pack2 + tools: ${{ steps.prepare-test.outputs.tools-url }} - - name: Queries and packs from config merging with input - if: success() || failure() - uses: ./../action/.github/actions/check-codescanning-config - with: - expected-config-file-contents: | - { - "packs": { - "javascript": ["codeql-testing/codeql-pack1@1.0.0", "codeql-testing/codeql-pack2", "codeql/javascript-queries" ] - }, - "queries": [ - { "uses": "./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql" }, - { "uses": "./codeql-qlpacks/complex-javascript-qlpack/foo2/show_ifs.ql" } - ] - } - languages: javascript - queries: + ./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql - packs: + codeql/javascript-queries - config-file-test: .github/codeql/queries-and-packs-config.yml - tools: ${{ steps.prepare-test.outputs.tools-url }} + - name: Queries from input + if: success() || failure() + uses: ./../action/.github/actions/check-codescanning-config + with: + expected-config-file-contents: | + { + "queries": [{ "uses": "./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql" }] + } + languages: javascript + queries: ./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql + tools: ${{ steps.prepare-test.outputs.tools-url }} - - name: Multi-language packs from config - if: success() || failure() - uses: ./../action/.github/actions/check-codescanning-config - with: - expected-config-file-contents: | - { - "packs": { - "javascript": ["codeql-testing/codeql-pack1@1.0.0", "codeql-testing/codeql-pack2" ], - "ruby": ["codeql/ruby-queries"] - }, - "queries": [ - { "uses": "./codeql-qlpacks/complex-javascript-qlpack/foo2/show_ifs.ql" } - ] - } - languages: javascript,ruby - config-file-test: .github/codeql/multi-language-packs-config.yml - tools: ${{ steps.prepare-test.outputs.tools-url }} + - name: Queries from input with + + if: success() || failure() + uses: ./../action/.github/actions/check-codescanning-config + with: + expected-config-file-contents: | + { + "queries": [{ "uses": "./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql" }] + } + languages: javascript + queries: + ./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql + tools: ${{ steps.prepare-test.outputs.tools-url }} - - name: Other config properties - if: success() || failure() - uses: ./../action/.github/actions/check-codescanning-config - with: - expected-config-file-contents: | - { - "name": "Config using all properties", - "packs": ["codeql/javascript-queries" ], - "disable-default-queries": true, - "paths-ignore": ["xxx"], - "paths": ["yyy"] - } - languages: javascript - packs: + codeql/javascript-queries - config-file-test: .github/codeql/other-config-properties.yml - tools: ${{ steps.prepare-test.outputs.tools-url }} + - name: Queries and packs from input with + + if: success() || failure() + uses: ./../action/.github/actions/check-codescanning-config + with: + expected-config-file-contents: | + { + "queries": [{ "uses": "./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql" }], + "packs": ["codeql-testing/codeql-pack1@1.0.0", "codeql-testing/codeql-pack2" ] + } + languages: javascript + queries: + ./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql + packs: + codeql-testing/codeql-pack1@1.0.0, codeql-testing/codeql-pack2 + tools: ${{ steps.prepare-test.outputs.tools-url }} + + - name: Queries and packs from config + if: success() || failure() + uses: ./../action/.github/actions/check-codescanning-config + with: + expected-config-file-contents: | + { + "queries": [{ "uses": "./codeql-qlpacks/complex-javascript-qlpack/foo2/show_ifs.ql" }], + "packs": { + "javascript": ["codeql-testing/codeql-pack1@1.0.0", "codeql-testing/codeql-pack2" ] + } + } + languages: javascript + config-file-test: .github/codeql/queries-and-packs-config.yml + tools: ${{ steps.prepare-test.outputs.tools-url }} + + - name: Queries and packs from config overriden by input + if: success() || failure() + uses: ./../action/.github/actions/check-codescanning-config + with: + expected-config-file-contents: | + { + "queries": [{ "uses": "./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql" }], + "packs": ["codeql/javascript-queries"] + } + languages: javascript + queries: ./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql + packs: codeql/javascript-queries + config-file-test: .github/codeql/queries-and-packs-config.yml + tools: ${{ steps.prepare-test.outputs.tools-url }} + + - name: Queries and packs from config merging with input + if: success() || failure() + uses: ./../action/.github/actions/check-codescanning-config + with: + expected-config-file-contents: | + { + "packs": { + "javascript": ["codeql-testing/codeql-pack1@1.0.0", "codeql-testing/codeql-pack2", "codeql/javascript-queries" ] + }, + "queries": [ + { "uses": "./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql" }, + { "uses": "./codeql-qlpacks/complex-javascript-qlpack/foo2/show_ifs.ql" } + ] + } + languages: javascript + queries: + ./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql + packs: + codeql/javascript-queries + config-file-test: .github/codeql/queries-and-packs-config.yml + tools: ${{ steps.prepare-test.outputs.tools-url }} + + - name: Multi-language packs from config + if: success() || failure() + uses: ./../action/.github/actions/check-codescanning-config + with: + expected-config-file-contents: | + { + "packs": { + "javascript": ["codeql-testing/codeql-pack1@1.0.0", "codeql-testing/codeql-pack2" ], + "ruby": ["codeql/ruby-queries"] + }, + "queries": [ + { "uses": "./codeql-qlpacks/complex-javascript-qlpack/foo2/show_ifs.ql" } + ] + } + languages: javascript,ruby + config-file-test: .github/codeql/multi-language-packs-config.yml + tools: ${{ steps.prepare-test.outputs.tools-url }} + + - name: Other config properties + if: success() || failure() + uses: ./../action/.github/actions/check-codescanning-config + with: + expected-config-file-contents: | + { + "name": "Config using all properties", + "packs": ["codeql/javascript-queries" ], + "disable-default-queries": true, + "paths-ignore": ["xxx"], + "paths": ["yyy"] + } + languages: javascript + packs: + codeql/javascript-queries + config-file-test: .github/codeql/other-config-properties.yml + tools: ${{ steps.prepare-test.outputs.tools-url }} diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 24564ecf4..81d88d1a7 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -64,7 +64,7 @@ jobs: npm ci - name: Verify compiled JS up to date - run: .github/workflows/script/check-js.sh + run: npx tsx pr-checks/check-unchanged.ts --language javascript - name: Run unit tests if: always() @@ -122,6 +122,9 @@ jobs: id: install-deps run: npm ci + - name: Verify YAML is correctly formatted + run: npx tsx pr-checks/check-unchanged.ts --language yaml + - name: Verify PR checks up to date if: ${{ !cancelled() && steps.install-deps.outcome == 'success' }} run: .github/workflows/script/verify-pr-checks.sh diff --git a/.github/workflows/publish-immutable-action.yml b/.github/workflows/publish-immutable-action.yml index 5e5623bb0..83485875c 100644 --- a/.github/workflows/publish-immutable-action.yml +++ b/.github/workflows/publish-immutable-action.yml @@ -1,10 +1,10 @@ -name: 'Publish Immutable Action Version' +name: "Publish Immutable Action Version" on: push: tags: # Match version tags, but not the major version tags. - - 'v[0-9]+.**' + - "v[0-9]+.**" defaults: run: diff --git a/.github/workflows/python312-windows.yml b/.github/workflows/python312-windows.yml index 303f54f1f..9ce50b8ff 100644 --- a/.github/workflows/python312-windows.yml +++ b/.github/workflows/python312-windows.yml @@ -8,7 +8,7 @@ on: types: [checks_requested] schedule: # Weekly on Monday. - - cron: '0 0 * * 1' + - cron: "0 0 * * 1" workflow_dispatch: concurrency: @@ -32,22 +32,22 @@ jobs: runs-on: windows-2025 steps: - - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 - with: - python-version: 3.12 + - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 + with: + python-version: 3.12 - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - name: Prepare test - uses: ./.github/actions/prepare-test - with: - version: default + - name: Prepare test + uses: ./.github/actions/prepare-test + with: + version: default - - name: Initialize CodeQL - uses: ./../action/init - with: - tools: linked - languages: python + - name: Initialize CodeQL + uses: ./../action/init + with: + tools: linked + languages: python - - name: Analyze - uses: ./../action/analyze + - name: Analyze + uses: ./../action/analyze diff --git a/.github/workflows/query-filters.yml b/.github/workflows/query-filters.yml index 745e84b2e..69ccd6c68 100644 --- a/.github/workflows/query-filters.yml +++ b/.github/workflows/query-filters.yml @@ -3,13 +3,13 @@ name: Query filters tests on: push: branches: - - main - - releases/v* + - main + - releases/v* pull_request: merge_group: types: [checks_requested] schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: concurrency: @@ -29,47 +29,47 @@ jobs: permissions: contents: read # This permission is needed to allow the GitHub Actions workflow to read the contents of the repository. steps: - - name: Check out repository - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Check out repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - name: Install Node.js - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 - with: - node-version: 24 - cache: npm + - name: Install Node.js + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: 24 + cache: npm - - name: Install dependencies - run: npm ci + - name: Install dependencies + run: npm ci - - name: Prepare test - id: prepare-test - uses: ./.github/actions/prepare-test - with: - version: linked + - name: Prepare test + id: prepare-test + uses: ./.github/actions/prepare-test + with: + version: linked - - name: Check SARIF for default queries with Single include, Single exclude - uses: ./../action/.github/actions/query-filter-test - with: - sarif-file: ${{ runner.temp }}/results/javascript.sarif - queries-run: js/zipslip - queries-not-run: js/path-injection - config-file: ./.github/codeql/codeql-config-query-filters1.yml - tools: ${{ steps.prepare-test.outputs.tools-url }} + - name: Check SARIF for default queries with Single include, Single exclude + uses: ./../action/.github/actions/query-filter-test + with: + sarif-file: ${{ runner.temp }}/results/javascript.sarif + queries-run: js/zipslip + queries-not-run: js/path-injection + config-file: ./.github/codeql/codeql-config-query-filters1.yml + tools: ${{ steps.prepare-test.outputs.tools-url }} - - name: Check SARIF for query packs with Single include, Single exclude - uses: ./../action/.github/actions/query-filter-test - with: - sarif-file: ${{ runner.temp }}/results/javascript.sarif - queries-run: js/zipslip,javascript/example/empty-or-one-block - queries-not-run: js/path-injection - config-file: ./.github/codeql/codeql-config-query-filters2.yml - tools: ${{ steps.prepare-test.outputs.tools-url }} + - name: Check SARIF for query packs with Single include, Single exclude + uses: ./../action/.github/actions/query-filter-test + with: + sarif-file: ${{ runner.temp }}/results/javascript.sarif + queries-run: js/zipslip,javascript/example/empty-or-one-block + queries-not-run: js/path-injection + config-file: ./.github/codeql/codeql-config-query-filters2.yml + tools: ${{ steps.prepare-test.outputs.tools-url }} - - name: Check SARIF for query packs and local queries with Single include, Single exclude - uses: ./../action/.github/actions/query-filter-test - with: - sarif-file: ${{ runner.temp }}/results/javascript.sarif - queries-run: js/zipslip,javascript/example/empty-or-one-block,inrepo-javascript-querypack/show-ifs - queries-not-run: js/path-injection,complex-python-querypack/show-ifs,complex-python-querypack/foo/bar/show-ifs - config-file: ./.github/codeql/codeql-config-query-filters3.yml - tools: ${{ steps.prepare-test.outputs.tools-url }} + - name: Check SARIF for query packs and local queries with Single include, Single exclude + uses: ./../action/.github/actions/query-filter-test + with: + sarif-file: ${{ runner.temp }}/results/javascript.sarif + queries-run: js/zipslip,javascript/example/empty-or-one-block,inrepo-javascript-querypack/show-ifs + queries-not-run: js/path-injection,complex-python-querypack/show-ifs,complex-python-querypack/foo/bar/show-ifs + config-file: ./.github/codeql/codeql-config-query-filters3.yml + tools: ${{ steps.prepare-test.outputs.tools-url }} diff --git a/.github/workflows/script/check-js.sh b/.github/workflows/script/check-js.sh deleted file mode 100755 index 57638dcf2..000000000 --- a/.github/workflows/script/check-js.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -set -eu - -# Sanity check that repo is clean to start with -if [ ! -z "$(git status --porcelain)" ]; then - # If we get a fail here then this workflow needs attention... - >&2 echo "Failed: Repo should be clean before testing!" - exit 1 -fi -# Wipe the lib directory in case there are extra unnecessary files in there -rm -rf lib -# Generate the JavaScript files -npm run-script build -# Check that repo is still clean -if [ ! -z "$(git status --porcelain)" ]; then - # If we get a fail here then the PR needs attention - >&2 echo "Failed: JavaScript files are not up to date. Run 'rm -rf lib && npm run-script build' to update" - git status - - echo "### Transpiled JS diff" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo '```diff' >> $GITHUB_STEP_SUMMARY - git diff --output="$RUNNER_TEMP/js.diff" - cat "$RUNNER_TEMP/js.diff" >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY - - # Reset bundled files to allow other checks to test for changes - git checkout lib - - # Fail this check - exit 1 -fi -echo "Success: JavaScript files are up to date" diff --git a/.github/workflows/test-codeql-bundle-all.yml b/.github/workflows/test-codeql-bundle-all.yml index cf63b1caa..9fae4b04a 100644 --- a/.github/workflows/test-codeql-bundle-all.yml +++ b/.github/workflows/test-codeql-bundle-all.yml @@ -1,17 +1,17 @@ -name: 'PR Check - CodeQL Bundle All' +name: "PR Check - CodeQL Bundle All" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GO111MODULE: auto on: push: branches: - - main - - releases/v* + - main + - releases/v* pull_request: merge_group: types: [checks_requested] schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" workflow_dispatch: concurrency: @@ -27,9 +27,9 @@ jobs: fail-fast: false matrix: include: - - os: ubuntu-26.04 - version: nightly-latest - name: 'CodeQL Bundle All' + - os: ubuntu-26.04 + version: nightly-latest + name: "CodeQL Bundle All" if: github.triggering_actor != 'dependabot[bot]' permissions: contents: read @@ -37,26 +37,26 @@ jobs: timeout-minutes: 45 runs-on: ${{ matrix.os }} steps: - - name: Check out repository - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - name: Prepare test - id: prepare-test - uses: ./.github/actions/prepare-test - with: - version: ${{ matrix.version }} - use-all-platform-bundle: true - - name: Install .NET - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 - with: - dotnet-version: '9.x' - - id: init - uses: ./../action/init - with: - # We manually exclude Swift from the languages list here, as it is not supported on Ubuntu - languages: cpp,csharp,go,java,javascript,python,ruby - tools: ${{ steps.prepare-test.outputs.tools-url }} - - name: Build code - run: ./build.sh - - uses: ./../action/analyze + - name: Check out repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Prepare test + id: prepare-test + uses: ./.github/actions/prepare-test + with: + version: ${{ matrix.version }} + use-all-platform-bundle: true + - name: Install .NET + uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 + with: + dotnet-version: "9.x" + - id: init + uses: ./../action/init + with: + # We manually exclude Swift from the languages list here, as it is not supported on Ubuntu + languages: cpp,csharp,go,java,javascript,python,ruby + tools: ${{ steps.prepare-test.outputs.tools-url }} + - name: Build code + run: ./build.sh + - uses: ./../action/analyze env: CODEQL_ACTION_TEST_MODE: true diff --git a/.github/workflows/update-bundle.yml b/.github/workflows/update-bundle.yml index d7d90b749..84aae2984 100644 --- a/.github/workflows/update-bundle.yml +++ b/.github/workflows/update-bundle.yml @@ -30,7 +30,7 @@ jobs: - name: Dump GitHub context env: - GITHUB_CONTEXT: '${{ toJson(github) }}' + GITHUB_CONTEXT: "${{ toJson(github) }}" run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -44,7 +44,7 @@ jobs: uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: 24 - cache: 'npm' + cache: "npm" - name: Install dependencies run: npm ci @@ -113,11 +113,12 @@ jobs: echo "CLI_VERSION=$cli_version" | tee -a "$GITHUB_ENV" echo "PR_URL=$pr_url" | tee -a "$GITHUB_ENV" - - name: Create changelog note + - name: Create changenote run: | npx tsx pr-checks/bundle-changelog.ts - - name: Push changelog note + - name: Push changenote run: | - git commit -am "Add changelog note" + git add unreleased-change-notes + git commit -m "Add changenote" git push diff --git a/.github/workflows/update-release-branch.yml b/.github/workflows/update-release-branch.yml index 6ceb30c42..098b9c8af 100644 --- a/.github/workflows/update-release-branch.yml +++ b/.github/workflows/update-release-branch.yml @@ -38,43 +38,43 @@ jobs: contents: write # needed to push commits pull-requests: write # needed to create pull request steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - fetch-depth: 0 # Need full history for calculation of diffs - - uses: ./.github/actions/release-initialise + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 # Need full history for calculation of diffs + - uses: ./.github/actions/release-initialise - # when the workflow has been manually triggered on main, - # we know that we definitely want the release branch to exist - - name: Ensure release branch exists - run: | - echo "MAJOR_VERSION ${MAJOR_VERSION}" - RELEASE_BRANCH=releases/${MAJOR_VERSION} - if git checkout $RELEASE_BRANCH > /dev/null 2>&1; then - echo "Branch $RELEASE_BRANCH already exists" - echo "" - else - echo "Creating $RELEASE_BRANCH branch" - git checkout -b ${RELEASE_BRANCH} ${LATEST_TAG} - git push --set-upstream origin ${RELEASE_BRANCH} - git branch --show-current - echo "" - fi - echo "Returning to branch: ${REF_NAME}" - git checkout ${REF_NAME} + # when the workflow has been manually triggered on main, + # we know that we definitely want the release branch to exist + - name: Ensure release branch exists + run: | + echo "MAJOR_VERSION ${MAJOR_VERSION}" + RELEASE_BRANCH=releases/${MAJOR_VERSION} + if git checkout $RELEASE_BRANCH > /dev/null 2>&1; then + echo "Branch $RELEASE_BRANCH already exists" + echo "" + else + echo "Creating $RELEASE_BRANCH branch" + git checkout -b ${RELEASE_BRANCH} ${LATEST_TAG} + git push --set-upstream origin ${RELEASE_BRANCH} + git branch --show-current + echo "" + fi + echo "Returning to branch: ${REF_NAME}" + git checkout ${REF_NAME} - - name: Update current release branch - if: github.event_name == 'workflow_dispatch' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - echo SOURCE_BRANCH=${REF_NAME} - echo TARGET_BRANCH=releases/${MAJOR_VERSION} - npx tsx ./pr-checks/update-release-branch.ts \ - --repository-nwo ${{ github.repository }} \ - --source-branch '${{ env.REF_NAME }}' \ - --target-branch 'releases/${{ env.MAJOR_VERSION }}' \ - --is-primary-release \ - --conductor ${GITHUB_ACTOR} + - name: Update current release branch + if: github.event_name == 'workflow_dispatch' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo SOURCE_BRANCH=${REF_NAME} + echo TARGET_BRANCH=releases/${MAJOR_VERSION} + npx tsx ./pr-checks/update-release-branch.ts \ + --repository-nwo ${{ github.repository }} \ + --source-branch '${{ env.REF_NAME }}' \ + --target-branch 'releases/${{ env.MAJOR_VERSION }}' \ + --is-primary-release \ + --conductor ${GITHUB_ACTOR} backport: name: "Create backport" @@ -94,28 +94,28 @@ jobs: contents: write # needed to push commits pull-requests: write # needed to create pull request steps: - - name: Generate token - uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 - id: app-token - with: - app-id: ${{ vars.AUTOMATION_APP_ID }} - private-key: ${{ secrets.AUTOMATION_PRIVATE_KEY }} + - name: Generate token + uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 + id: app-token + with: + app-id: ${{ vars.AUTOMATION_APP_ID }} + private-key: ${{ secrets.AUTOMATION_PRIVATE_KEY }} - - name: Checkout - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - fetch-depth: 0 # Need full history for calculation of diffs - token: ${{ steps.app-token.outputs.token }} - - uses: ./.github/actions/release-initialise + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 # Need full history for calculation of diffs + token: ${{ steps.app-token.outputs.token }} + - uses: ./.github/actions/release-initialise - - name: Update older release branch - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - echo SOURCE_BRANCH=${SOURCE_BRANCH} - echo TARGET_BRANCH=${TARGET_BRANCH} - npx tsx ./pr-checks/update-release-branch.ts \ - --repository-nwo ${{ github.repository }} \ - --source-branch ${SOURCE_BRANCH} \ - --target-branch ${TARGET_BRANCH} \ - --conductor ${GITHUB_ACTOR} + - name: Update older release branch + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo SOURCE_BRANCH=${SOURCE_BRANCH} + echo TARGET_BRANCH=${TARGET_BRANCH} + npx tsx ./pr-checks/update-release-branch.ts \ + --repository-nwo ${{ github.repository }} \ + --source-branch ${SOURCE_BRANCH} \ + --target-branch ${TARGET_BRANCH} \ + --conductor ${GITHUB_ACTOR} diff --git a/.github/workflows/update-supported-enterprise-server-versions.yml b/.github/workflows/update-supported-enterprise-server-versions.yml index 6510f11e2..90e3e991a 100644 --- a/.github/workflows/update-supported-enterprise-server-versions.yml +++ b/.github/workflows/update-supported-enterprise-server-versions.yml @@ -29,7 +29,7 @@ jobs: uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: 24 - cache: 'npm' + cache: "npm" - name: Install dependencies run: npm ci diff --git a/.vscode/settings.json b/.vscode/settings.json index 6f3139275..3413d182e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -15,7 +15,7 @@ "search.exclude": { "**/node_modules": true, "build": true, - "lib": true, + "lib": true }, // Installing a new Node package often triggers VS Code's git limit warnings as there is typically // an intermediate stage where many files are modified. This setting suppresses these warnings. @@ -26,4 +26,9 @@ "[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, + "[yaml]": { + "editor.tabSize": 2, + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "prettier.prettierPath": "./node_modules/prettier" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 933606449..b9c1382c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ See the [releases page](https://github.com/github/codeql-action/releases) for the relevant changes to the CodeQL CLI and language packs. +## 4.39.3 - 04 Nov 2026 + +- Fixed diff-informed alert filtering incorrectly removing alerts in changed files whose paths contain spaces, special characters, or non-ASCII characters. [#4283](https://github.com/github/codeql-action/pull/4283) + ## 4.39.2 - 03 Nov 2026 - Update default CodeQL bundle version to [2.27.4](https://github.com/github/codeql-action/releases/tag/codeql-bundle-v2.27.4). [#4284](https://github.com/github/codeql-action/pull/4284) diff --git a/action.yml b/action.yml index 87c4974ea..b410533be 100644 --- a/action.yml +++ b/action.yml @@ -1,10 +1,10 @@ -name: 'CodeQL: Stub' +name: "CodeQL: Stub" description: "Stub: Don't use this action directly. Read [the documentation](https://docs.github.com/en/code-security/code-scanning/introduction-to-code-scanning/about-code-scanning-with-codeql) instead." -author: 'GitHub' +author: "GitHub" runs: - using: 'composite' + using: "composite" steps: - - name: 'Stub' + - name: "Stub" run: | echo 'This is a stub. Read [the documentation](https://docs.github.com/en/code-security/code-scanning/introduction-to-code-scanning/about-code-scanning-with-codeql) instead.' exit 1 diff --git a/autobuild/action.yml b/autobuild/action.yml index dd8c9229d..54b9128b6 100644 --- a/autobuild/action.yml +++ b/autobuild/action.yml @@ -1,6 +1,6 @@ -name: 'CodeQL: Autobuild' -description: 'Attempt to automatically build the code. Only used for analyzing languages that require a build. Use the `build-mode: autobuild` input in the `init` action instead.' -author: 'GitHub' +name: "CodeQL: Autobuild" +description: "Attempt to automatically build the code. Only used for analyzing languages that require a build. Use the `build-mode: autobuild` input in the `init` action instead." +author: "GitHub" inputs: token: description: "GitHub token to use for authenticating with this instance of GitHub. The token needs the `security-events: write` permission." @@ -15,5 +15,10 @@ inputs: $GITHUB_WORKSPACE as its working directory. required: false runs: +<<<<<<< HEAD using: node20 main: '../lib/autobuild-entry.js' +======= + using: node24 + main: "../lib/autobuild-entry.js" +>>>>>>> origin/releases/v4 diff --git a/init/action.yml b/init/action.yml index 65bf67f1b..299bb9138 100644 --- a/init/action.yml +++ b/init/action.yml @@ -1,6 +1,6 @@ -name: 'CodeQL: Init' -description: 'Set up CodeQL' -author: 'GitHub' +name: "CodeQL: Init" +description: "Set up CodeQL" +author: "GitHub" inputs: tools: description: >- @@ -56,7 +56,7 @@ inputs: - `code-scanning`: The default, security-focused analysis. - `code-quality`: Analysis focused on code quality. This must be enabled in conjunction with `code-scanning`. - default: 'code-scanning' + default: "code-scanning" required: true token: description: GitHub token to use for authenticating with this instance of GitHub. To download custom packs from multiple registries, use the registries input. @@ -100,7 +100,7 @@ inputs: description: Comma-separated list of additional queries to run. By default, this overrides the same setting in a configuration file; prefix with "+" to use both sets of queries. required: false quality-queries: - description: '[Internal] DEPRECATED. Comma-separated list of code quality queries to run.' + description: "[Internal] DEPRECATED. Comma-separated list of code quality queries to run." required: false packs: description: >- @@ -140,7 +140,7 @@ inputs: This will result in more output being produced which may be useful when debugging certain issues. Debugging mode is enabled automatically when step debug logging is turned on. required: false - default: 'false' + default: "false" debug-artifact-name: description: >- The name of the artifact to store debugging information in. @@ -180,6 +180,12 @@ outputs: codeql-version: description: The version of the CodeQL binary used for analysis runs: +<<<<<<< HEAD using: node20 main: '../lib/init-entry.js' post: '../lib/init-post-entry.js' +======= + using: node24 + main: "../lib/init-entry.js" + post: "../lib/init-post-entry.js" +>>>>>>> origin/releases/v4 diff --git a/lib/entry-points.js b/lib/entry-points.js index 533b7c381..952c61541 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -134968,490 +134968,752 @@ var require_isPlainObject = __commonJS({ var require_index_min = __commonJS({ "node_modules/glob/dist/commonjs/index.min.js"(exports2) { "use strict"; - var R = (n, t) => () => (t || n((t = { exports: {} }).exports, t), t.exports); - var Ge = R((Y) => { + var x = (n, t) => () => { + try { + return t || n((t = { exports: {} }).exports, t), t.exports; + } catch (e) { + throw t = 0, e; + } + }; + var ls = x((tt) => { "use strict"; - Object.defineProperty(Y, "__esModule", { value: true }); - Y.range = Y.balanced = void 0; - var Gs = (n, t, e) => { - let s = n instanceof RegExp ? Ie(n, e) : n, i = t instanceof RegExp ? Ie(t, e) : t, r = s !== null && i != null && (0, Y.range)(s, i, e); + Object.defineProperty(tt, "__esModule", { value: true }); + tt.range = tt.balanced = void 0; + var di = (n, t, e) => { + let s = n instanceof RegExp ? as(n, e) : n, i = t instanceof RegExp ? as(t, e) : t, r = s !== null && i != null && (0, tt.range)(s, i, e); return r && { start: r[0], end: r[1], pre: e.slice(0, r[0]), body: e.slice(r[0] + s.length, r[1]), post: e.slice(r[1] + i.length) }; }; - Y.balanced = Gs; - var Ie = (n, t) => { + tt.balanced = di; + var as = (n, t) => { let e = t.match(n); return e ? e[0] : null; - }, zs = (n, t, e) => { - let s, i, r, h, o, a = e.indexOf(n), l = e.indexOf(t, a + 1), f = a; - if (a >= 0 && l > 0) { - if (n === t) return [a, l]; - for (s = [], r = e.length; f >= 0 && !o; ) { - if (f === a) s.push(f), a = e.indexOf(n, f + 1); + }, pi = (n, t, e) => { + let s, i, r, h, a, o = e.indexOf(n), l = e.indexOf(t, o + 1), c = o; + if (o >= 0 && l > 0) { + if (n === t) return [o, l]; + for (s = [], r = e.length; c >= 0 && !a; ) { + if (c === o) s.push(c), o = e.indexOf(n, c + 1); else if (s.length === 1) { - let c = s.pop(); - c !== void 0 && (o = [c, l]); - } else i = s.pop(), i !== void 0 && i < r && (r = i, h = l), l = e.indexOf(t, f + 1); - f = a < l && a >= 0 ? a : l; + let u = s.pop(); + u !== void 0 && (a = [u, l]); + } else i = s.pop(), i !== void 0 && i < r && (r = i, h = l), l = e.indexOf(t, c + 1); + c = o < l && o >= 0 ? o : l; } - s.length && h !== void 0 && (o = [r, h]); + s.length && h !== void 0 && (a = [r, h]); } - return o; + return a; }; - Y.range = zs; + tt.range = pi; }); - var Ke = R((it) => { + var ms = x((T) => { "use strict"; - Object.defineProperty(it, "__esModule", { value: true }); - it.EXPANSION_MAX = void 0; - it.expand = ei; - var ze = Ge(), Ue = "\0SLASH" + Math.random() + "\0", $e = "\0OPEN" + Math.random() + "\0", ue = "\0CLOSE" + Math.random() + "\0", qe = "\0COMMA" + Math.random() + "\0", He = "\0PERIOD" + Math.random() + "\0", Us = new RegExp(Ue, "g"), $s = new RegExp($e, "g"), qs = new RegExp(ue, "g"), Hs = new RegExp(qe, "g"), Vs = new RegExp(He, "g"), Ks = /\\\\/g, Xs = /\\{/g, Ys = /\\}/g, Js = /\\,/g, Zs = /\\./g; - it.EXPANSION_MAX = 1e5; - function ce(n) { + Object.defineProperty(T, "__esModule", { value: true }); + T.EXPANSION_MAX_REWRITES = T.EXPANSION_MAX_DEPTH = T.EXPANSION_MAX_LENGTH = T.EXPANSION_MAX = void 0; + T.expand = Mi; + var cs = ls(), us = "\0SLASH" + Math.random() + "\0", fs34 = "\0OPEN" + Math.random() + "\0", ve = "\0CLOSE" + Math.random() + "\0", ds = "\0COMMA" + Math.random() + "\0", ps = "\0PERIOD" + Math.random() + "\0", mi = new RegExp(us, "g"), gi = new RegExp(fs34, "g"), wi = new RegExp(ve, "g"), bi = new RegExp(ds, "g"), yi = new RegExp(ps, "g"), Si = /\\\\/g, vi = /\\{/g, _i = /\\}/g, Ei = /\\,/g, Oi = /\\\./g; + T.EXPANSION_MAX = 1e5; + T.EXPANSION_MAX_LENGTH = 4e6; + T.EXPANSION_MAX_DEPTH = 1e3; + T.EXPANSION_MAX_REWRITES = 1e3; + function be(n) { return isNaN(n) ? n.charCodeAt(0) : parseInt(n, 10); } - function Qs(n) { - return n.replace(Ks, Ue).replace(Xs, $e).replace(Ys, ue).replace(Js, qe).replace(Zs, He); + function Ci(n) { + return n.replace(Si, us).replace(vi, fs34).replace(_i, ve).replace(Ei, ds).replace(Oi, ps); } - function ti(n) { - return n.replace(Us, "\\").replace($s, "{").replace(qs, "}").replace(Hs, ",").replace(Vs, "."); + function Ai(n) { + return n.replace(mi, "\\").replace(gi, "{").replace(wi, "}").replace(bi, ",").replace(yi, "."); } - function Ve(n) { - if (!n) return [""]; - let t = [], e = (0, ze.balanced)("{", "}", n); - if (!e) return n.split(","); - let { pre: s, body: i, post: r } = e, h = s.split(","); - h[h.length - 1] += "{" + i + "}"; - let o = Ve(r); - return r.length && (h[h.length - 1] += o.shift(), h.push.apply(h, o)), t.push.apply(t, h), t; + function ye(n, t) { + for (let e = 0; e < t.length; e++) n.push(t[e]); } - function ei(n, t = {}) { + function ki(n) { + let t = [], e = ""; + for (; ; ) { + let s = (0, cs.balanced)("{", "}", n); + if (!s) { + let o = n.split(","); + return o[0] = e + o[0], ye(t, o), t; + } + let { pre: i, body: r, post: h } = s, a = i.split(","); + if (a[0] = e + a[0], a[a.length - 1] += "{" + r + "}", !h.length) return ye(t, a), t; + e = a.pop(), ye(t, a), n = h; + } + } + function Mi(n, t = {}) { if (!n) return []; - let { max: e = it.EXPANSION_MAX } = t; - return n.slice(0, 2) === "{}" && (n = "\\{\\}" + n.slice(2)), ht(Qs(n), e, true).map(ti); + let { max: e = T.EXPANSION_MAX, maxLength: s = T.EXPANSION_MAX_LENGTH, maxDepth: i = T.EXPANSION_MAX_DEPTH, maxRewrites: r = T.EXPANSION_MAX_REWRITES } = t; + return n.slice(0, 2) === "{}" && (n = "\\{\\}" + n.slice(2)), Se(Ci(n), e, s, i, 0, r, true).map(Ai); } - function si(n) { + function xi(n) { return "{" + n + "}"; } - function ii(n) { + function Ri(n) { return /^-?0\d/.test(n); } - function ri(n, t) { + function Pi(n, t) { return n <= t; } - function ni(n, t) { + function Ti(n, t) { return n >= t; } - function ht(n, t, e) { - let s = [], i = (0, ze.balanced)("{", "}", n); - if (!i) return [n]; - let r = i.pre, h = i.post.length ? ht(i.post, t, false) : [""]; - if (/\$$/.test(i.pre)) for (let o = 0; o < h.length && o < t; o++) { - let a = r + "{" + i.body + "}" + h[o]; - s.push(a); + function lt2(n, t, e, s, i, r) { + let h = [], a = 0; + for (let o = 0; o < n.length; o++) for (let l = 0; l < e.length; l++) { + if (h.length >= s) return h; + let c = n[o] + t + e[l]; + if (!(r && !c)) { + if (a + c.length > i) return h; + h.push(c), a += c.length; + } } - else { - let o = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body), a = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body), l = o || a, f = i.body.indexOf(",") >= 0; - if (!l && !f) return i.post.match(/,(?!,).*\}/) ? (n = i.pre + "{" + i.body + ue + i.post, ht(n, t, true)) : [n]; - let c; - if (l) c = i.body.split(/\.\./); - else if (c = Ve(i.body), c.length === 1 && c[0] !== void 0 && (c = ht(c[0], t, false).map(si), c.length === 1)) return h.map((u) => i.pre + c[0] + u); - let d; - if (l && c[0] !== void 0 && c[1] !== void 0) { - let u = ce(c[0]), m = ce(c[1]), p = Math.max(c[0].length, c[1].length), b = c.length === 3 && c[2] !== void 0 ? Math.abs(ce(c[2])) : 1, w = ri; - m < u && (b *= -1, w = ni); - let E = c.some(ii); - d = []; - for (let y = u; w(y, m); y += b) { - let S; - if (a) S = String.fromCharCode(y), S === "\\" && (S = ""); - else if (S = String(y), E) { - let B = p - S.length; - if (B > 0) { - let U = new Array(B + 1).join("0"); - y < 0 ? S = "-" + U + S.slice(1) : S = U + S; + return h; + } + function Fi(n, t, e, s) { + let i = n.split(/\.\./), r = []; + if (i[0] === void 0 || i[1] === void 0) return r; + let h = be(i[0]), a = be(i[1]), o = Math.max(i[0].length, i[1].length), l = i.length === 3 && i[2] !== void 0 ? Math.max(Math.abs(be(i[2])), 1) : 1, c = Pi; + a < h && (l *= -1, c = Ti); + let p = i.some(Ri), d = 0; + for (let g = h; c(g, a) && r.length < e; g += l) { + let f; + if (t) f = String.fromCharCode(g), f === "\\" && (f = ""); + else if (f = String(g), p) { + let b = o - f.length; + if (b > 0) { + let m = new Array(b + 1).join("0"); + g < 0 ? f = "-" + m + f.slice(1) : f = m + f; + } + } + if (d + f.length > s) break; + r.push(f), d += f.length; + } + return r; + } + function Se(n, t, e, s, i, r, h) { + if (i > s) return [n]; + let a = [""], o = 0, l = false, c = true; + for (; ; ) { + let u = (0, cs.balanced)("{", "}", n); + if (!u) return lt2(a, n, [""], t, e, l); + let p = u.pre; + if (/\$$/.test(p)) { + if (a = lt2(a, p + "{" + u.body + "}", [""], t, e, l && !u.post.length), c = false, !u.post.length) break; + n = u.post; + continue; + } + let d = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(u.body), g = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(u.body), f = d || g, b = u.body.indexOf(",") >= 0; + if (!f && !b) { + if (o < r && u.post.match(/,(?!,).*\}/)) { + o++, n = u.pre + "{" + u.body + ve + u.post, h = true; + continue; + } + return lt2(a, p + "{" + u.body + "}" + u.post, [""], t, e, l); + } + c && (l = h && !f, c = false); + let m; + if (f) m = Fi(u.body, g, t, e); + else { + let y = ki(u.body); + if (y.length === 1 && y[0] !== void 0 && (y = Se(y[0], t, e, s, i + 1, r, false).map(xi), y.length === 1)) { + if (a = lt2(a, p + y[0], [""], t, e, l && !u.post.length), !u.post.length) break; + n = u.post; + continue; + } + let _2 = l && !u.post.length && !p; + for (let S = 0; _2 && S < a.length; S++) a[S] && (_2 = false); + m = []; + let v = 0; + t: for (let S = 0; S < y.length; S++) { + let K = Se(y[S], t, e, s, i + 1, r, false); + for (let z = 0; z < K.length; z++) { + let $ = K[z]; + if (!(_2 && !$)) { + if (m.length >= t || v + $.length > e) break t; + m.push($), v += $.length; } } - d.push(S); } - } else { - d = []; - for (let u = 0; u < c.length; u++) d.push.apply(d, ht(c[u], t, false)); - } - for (let u = 0; u < d.length; u++) for (let m = 0; m < h.length && s.length < t; m++) { - let p = r + d[u] + h[m]; - (!e || l || p) && s.push(p); } + if (a = lt2(a, p, m, t, e, l && !u.post.length), !u.post.length) break; + n = u.post; } - return s; + return a; } }); - var Xe = R((Ct) => { + var gs = x((Tt) => { "use strict"; - Object.defineProperty(Ct, "__esModule", { value: true }); - Ct.assertValidPattern = void 0; - var hi = 1024 * 64, oi = (n) => { - if (typeof n != "string") throw new TypeError("invalid pattern"); - if (n.length > hi) throw new TypeError("pattern is too long"); - }; - Ct.assertValidPattern = oi; - }); - var Je = R((Rt) => { - "use strict"; - Object.defineProperty(Rt, "__esModule", { value: true }); - Rt.parseClass = void 0; - var ai = { "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true], "[:alpha:]": ["\\p{L}\\p{Nl}", true], "[:ascii:]": ["\\x00-\\x7f", false], "[:blank:]": ["\\p{Zs}\\t", true], "[:cntrl:]": ["\\p{Cc}", true], "[:digit:]": ["\\p{Nd}", true], "[:graph:]": ["\\p{Z}\\p{C}", true, true], "[:lower:]": ["\\p{Ll}", true], "[:print:]": ["\\p{C}", true], "[:punct:]": ["\\p{P}", true], "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true], "[:upper:]": ["\\p{Lu}", true], "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true], "[:xdigit:]": ["A-Fa-f0-9", false] }, ot = (n) => n.replace(/[[\]\\-]/g, "\\$&"), li = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), Ye = (n) => n.join(""), ci = (n, t) => { - let e = t; - if (n.charAt(e) !== "[") throw new Error("not in a brace expression"); - let s = [], i = [], r = e + 1, h = false, o = false, a = false, l = false, f = e, c = ""; - t: for (; r < n.length; ) { - let p = n.charAt(r); - if ((p === "!" || p === "^") && r === e + 1) { - l = true, r++; + Object.defineProperty(Tt, "__esModule", { value: true }); + Tt.parseClass = void 0; + var ji = { "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}"], "[:alpha:]": ["\\p{L}\\p{Nl}"], "[:ascii:]": ["\\x00-\\x7f"], "[:blank:]": ["\\p{Zs}\\t"], "[:cntrl:]": ["\\p{Cc}"], "[:digit:]": ["\\p{Nd}"], "[:graph:]": ["\\p{Z}\\p{C}", true], "[:lower:]": ["\\p{Ll}"], "[:print:]": ["\\p{C}", true], "[:punct:]": ["\\p{P}\\p{S}"], "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f"], "[:upper:]": ["\\p{Lu}"], "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}"], "[:xdigit:]": ["A-Fa-f0-9"] }, ct = (n) => n.replace(/[[\]\\-]/g, "\\$&"), _e2 = /$./, Di = (n, t, e = false, s) => { + let i = (m) => { + let y = s ? m.normalize(s) : m; + return [...y].length === 1 ? y : m; + }, r = t; + if (n.charAt(r) !== "[") throw new Error("not in a brace expression"); + let h = [], a = [], o = r + 1, l = false, c = false, u = false, p = r, d = ""; + t: for (; o < n.length; ) { + let m = String.fromCodePoint(n.codePointAt(o)); + if ((m === "!" || m === "^") && o === r + 1) { + u = true, o++; continue; } - if (p === "]" && h && !a) { - f = r + 1; + if (m === "]" && l && !c) { + p = o + 1; break; } - if (h = true, p === "\\" && !a) { - a = true, r++; + if (l = true, m === "\\" && !c) { + c = true, o++; continue; } - if (p === "[" && !a) { - for (let [b, [w, v, E]] of Object.entries(ai)) if (n.startsWith(b, r)) { - if (c) return ["$.", false, n.length - e, true]; - r += b.length, E ? i.push(w) : s.push(w), o = o || v; + if (m === "[" && !c) { + for (let [_2, [v, S]] of Object.entries(ji)) if (n.startsWith(_2, o)) { + if (d) return [_e2, n.length - r]; + o += _2.length, S ? a.push(v) : h.push(v); continue t; } } - if (a = false, c) { - p > c ? s.push(ot(c) + "-" + ot(p)) : p === c && s.push(ot(p)), c = "", r++; + c = false; + let y = i(m); + if (d) { + y.codePointAt(0) > d.codePointAt(0) ? h.push(ct(d) + "-" + ct(y)) : y === d && h.push(ct(y)), d = "", o += m.length; continue; } - if (n.startsWith("-]", r + 1)) { - s.push(ot(p + "-")), r += 2; + if (n.startsWith("-]", o + m.length)) { + h.push(ct(y + "-")), o += m.length + 1; continue; } - if (n.startsWith("-", r + 1)) { - c = p, r += 2; + if (n.startsWith("-", o + m.length)) { + d = y, o += m.length + 1; continue; } - s.push(ot(p)), r++; + h.push(ct(y)), o += m.length; } - if (f < r) return ["", false, 0, false]; - if (!s.length && !i.length) return ["$.", false, n.length - e, true]; - if (i.length === 0 && s.length === 1 && /^\\?.$/.test(s[0]) && !l) { - let p = s[0].length === 2 ? s[0].slice(-1) : s[0]; - return [li(p), false, f - e, false]; - } - let d = "[" + (l ? "^" : "") + Ye(s) + "]", u = "[" + (l ? "" : "^") + Ye(i) + "]"; - return [s.length && i.length ? "(" + d + "|" + u + ")" : s.length ? d : u, o, f - e, true]; + if (p < o) return [_e2, 0]; + if (!h.length && !a.length) return [_e2, n.length - r]; + let g = "[" + (u ? "^" : "") + h.join("") + "]", f = "[" + (u ? "" : "^") + a.join("") + "]", b = "^" + (h.length && a.length ? "(" + g + "|" + f + ")" : h.length ? g : f); + return [new RegExp(b, e ? "iu" : "u"), p - r]; }; - Rt.parseClass = ci; + Tt.parseClass = Di; }); - var kt = R((At) => { + var Cs = x((jt) => { "use strict"; - Object.defineProperty(At, "__esModule", { value: true }); - At.unescape = void 0; - var ui = (n, { windowsPathsNoEscape: t = false, magicalBraces: e = true } = {}) => e ? t ? n.replace(/\[([^\/\\])\]/g, "$1") : n.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1") : t ? n.replace(/\[([^\/\\{}])\]/g, "$1") : n.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, "$1$2").replace(/\\([^\/{}])/g, "$1"); - At.unescape = ui; - }); - var pe = R((Dt) => { - "use strict"; - Object.defineProperty(Dt, "__esModule", { value: true }); - Dt.AST = void 0; - var fi = Je(), Mt = kt(), di = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), Ze = (n) => di.has(n), pi = "(?!(?:^|/)\\.\\.?(?:$|/))", Pt = "(?!\\.)", mi = /* @__PURE__ */ new Set(["[", "."]), gi = /* @__PURE__ */ new Set(["..", "."]), wi = new Set("().*{}+?[]^$\\!"), bi = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), de = "[^/]", Qe = de + "*?", ts = de + "+?", fe = class n { - type; - #t; - #s; - #n = false; - #r = []; - #h; - #S; - #w; - #c = false; - #o; - #f; - #u = false; - constructor(t, e, s = {}) { - this.type = t, t && (this.#s = true), this.#h = e, this.#t = this.#h ? this.#h.#t : this, this.#o = this.#t === this ? s : this.#t.#o, this.#w = this.#t === this ? [] : this.#t.#w, t === "!" && !this.#t.#c && this.#w.push(this), this.#S = this.#h ? this.#h.#r.length : 0; + Object.defineProperty(jt, "__esModule", { value: true }); + jt.Matcher = void 0; + var Ni = gs(), Ee = { t: "match", id: 0 }, Li = "!?+*@", et = (n) => ({ t: "lit", ch: n }), Wi = (n) => n.replace(/[\\^$.*+?()[\]{}|/]/g, "\\$&"), Oe = (n) => new RegExp(`^${Wi(n)}$`, "iu"), Me = (n, t) => { + if (t === n.ch) return true; + if (!n.re) return false; + let e = t.charCodeAt(0); + if (e >= 128) return n.re.test(t); + let s = n.ascii ??= new Uint8Array(128); + return s[e] ||= n.re.test(t) ? 1 : 2, s[e] === 1; + }, Bi = (n, t, e, s) => { + let i = []; + for (let r = 0; r < n.length; ) { + let h = String.fromCodePoint(n.codePointAt(r)); + if (h === "\\") { + let a = n.codePointAt(r + 1), o = a === void 0 ? h : String.fromCodePoint(a); + i.push(et(o)), r += 1 + o.length; + continue; + } + if (h === "[") { + let [a, o] = (0, Ni.parseClass)(n, r, t, s); + if (o) { + i.push({ t: "class", re: a }), r += o; + continue; + } + } + if (!e && Li.includes(h) && n[r + 1] === "(") { + i.push({ t: "open", type: h }), r += 2; + continue; + } + i.push(!e && h === "|" ? { t: "bar" } : !e && h === ")" ? { t: "close" } : h === "*" ? { t: "star" } : h === "?" ? { t: "any" } : et(h)), r += h.length; } - get hasMagic() { - if (this.#s !== void 0) return this.#s; - for (let t of this.#r) if (typeof t != "string" && (t.type || t.hasMagic)) return this.#s = true; - return this.#s; + return i; + }, zi = (n) => { + let t = /* @__PURE__ */ new Map(), e = []; + return n.forEach((s, i) => { + s.t === "open" ? e.push(i) : s.t === "close" && e.length && t.set(e.pop(), i); + }), t; + }, Ss = (n, t, e, s, i) => { + let r = [], h = [r]; + for (let a = e; a < s; a++) { + let o = n[a], l = t.get(a); + if (o.t === "open" && l !== void 0) { + let c = Ss(n, t, a + 1, l, false); + r.push({ t: "ext", type: o.type, alts: c }), a = l; + } else o.t === "bar" && !i ? h.push(r = []) : o.t === "open" ? r.push(et(o.type), et("(")) : o.t === "bar" ? r.push(et("|")) : o.t === "close" ? r.push(et(")")) : r.push(o); + } + return h; + }, vs = (n, t) => { + let e = [], s = "", i = () => { + for (let r of s.normalize(t)) e.push(et(r)); + s = ""; + }; + for (let r of n) { + if (r.t === "lit") { + s += r.ch; + continue; + } + i(), e.push(r.t === "ext" ? { ...r, alts: r.alts.map((h) => vs(h, t)) } : r); + } + return i(), e; + }, Gi = (n, t) => { + let e = 1, s = (a) => ({ t: "split", id: e++, out: a }), i = (a, o) => a.reduceRight((l, c) => r(c, l), o), r = (a, o) => { + switch (a.t) { + case "lit": + let p = t ? Oe(a.ch) : void 0; + return { t: "lit", id: e++, ch: a.ch, re: p, next: o }; + case "any": + case "star": + return { t: a.t, id: e++, next: o }; + case "class": + return { t: "class", id: e++, re: a.re, next: o }; + } + let l = (p) => a.alts.map((d) => i(d, p)); + switch (a.type) { + case "@": + return s(l(o)); + case "?": + return s([o, ...l(o)]); + case "!": + return { t: "neg", id: e++, sub: s(l(Ee)), next: o }; + } + let c = s([]), u = s(l(c)); + return c.out.push(o, u), a.type === "*" ? c : u; + }; + return [i(n, Ee), e]; + }, Ii = (n) => { + let t = [], e = /* @__PURE__ */ new Set(), s = (r) => r.t === "match" ? "match" : String(r.id), i = (r, h) => { + if (r.t === "match" || e.has(r)) return; + e.add(r); + let a = (o) => t.push(`${h}${r.id}: ${o}`); + switch (r.t) { + case "split": + a(`split -> ${r.out.map(s).join(", ")}`); + for (let o of r.out) i(o, h); + return; + case "neg": + return a(`!(${s(r.sub)}) -> ${s(r.next)}`), i(r.sub, h + " "), i(r.next, h); + case "lit": + a(`${JSON.stringify(r.ch)} -> ${s(r.next)}`); + break; + case "class": + a(`${r.re} -> ${s(r.next)}`); + break; + default: + a(`${r.t === "any" ? "?" : "*"} -> ${s(r.next)}`); + } + i(r.next, h); + }; + return i(n, ""), [`start -> ${s(n)}`, ...t].join(` +`); + }, Ce = class { + gen; + threads = []; + match = false; + runs = []; + ids = []; + constructor(t) { + this.gen = t; + } + get dead() { + return !this.threads.length && !this.match && !this.runs.length; + } + }, _s2 = (n, t) => n.ids.length !== t.ids.length || n.runs.length !== t.runs.length || n.ids.some((e, s) => e !== t.ids[s]) ? false : n.runs.every((e) => t.runs.some((s) => s.neg === e.neg && _s2(s.state, e.state))), ws = (n) => ({ has: new Float64Array(n), seen: new Float64Array(n), gen: 0 }), ut = class { + dots; + dotStart; + #t; + constructor(t, e, s) { + this.dots = t, this.dotStart = e, this.#t = s; + } + state() { + return new Ce(++this.#t.gen); + } + done(t) { + return t.ids = t.threads.map((e) => e.id).sort((e, s) => e - s), t.match && t.ids.unshift(Ee.id), t; + } + #i(t, e) { + let { seen: s } = this.#t; + return s[e.id] === t.gen ? false : (s[e.id] = t.gen, true); + } + #e(t, e) { + let { has: s } = this.#t; + return s[e.id] === t.gen ? false : (s[e.id] = t.gen, t.threads.push(e), true); + } + restricted(t, e) { + return e && (this.dots || this.dotStart && t === 0); + } + add(t, e, s, i) { + switch (e.t) { + case "split": + if (!this.#i(t, e)) return; + for (let h of e.out) this.add(t, h, s, i); + return; + case "neg": + if (!this.#i(t, e)) return; + let r = this.state(); + return this.add(r, e.sub, s, false), this.done(r), this.addRun(t, { t: "run", neg: e, state: r }, s, i); + case "star": + if (this.restricted(s, i)) return; + this.#e(t, e) && this.add(t, e.next, s, i); + return; + case "match": + t.match = true; + return; + default: + this.#e(t, e); + } + } + addRun(t, e, s, i) { + for (let r of t.runs) if (r.neg === e.neg && _s2(r.state, e.state)) return; + t.runs.push(e), e.state.match || this.add(t, e.neg.next, s, i); + } + step(t, e, s, i) { + let r = this.state(); + for (let h of t.threads) switch (h.t) { + case "lit": + Me(h, e) && this.add(r, h.next, s + 1, i); + break; + case "any": + this.restricted(s, i) || this.add(r, h.next, s + 1, i); + break; + case "class": + !this.restricted(s, i) && h.re.test(e) && this.add(r, h.next, s + 1, i); + break; + case "star": + this.restricted(s, i) || this.add(r, h, s + 1, i); + } + if (!this.restricted(s, i)) for (let h of t.runs) { + if (h.state.dead) { + this.addRun(r, h, s + 1, i); + continue; + } + let a = this.step(h.state, e, s, false); + this.addRun(r, { t: "run", neg: h.neg, state: a }, s + 1, i); + } + return this.done(r); + } + }, Es = (n) => { + let t = n.ids.join(); + if (!n.runs.length) return t; + let e = n.runs.map((s) => `${s.neg.id}(${Es(s.state)})`); + return `${t}|${e.sort().join("|")}`; + }, Ui = 1 << 18, Ae = class { + #t; + #i = /* @__PURE__ */ new Map(); + #e = 0; + #h; + #n; + #d; + #c; + constructor(t, e) { + this.#t = t, this.#d = new ut(false, false, e), this.#c = new ut(false, true, e); + } + #p(t) { + return { state: t, match: t.match, dead: t.dead, next: /* @__PURE__ */ new Map() }; + } + #o(t) { + let e = Es(t), s = this.#i.get(e); + if (s) return s; + this.#e > Ui && this.#m(); + let i = this.#p(t); + return this.#i.set(e, i), this.#e += e.length + 1, i; + } + #m() { + this.#i.clear(), this.#e = 0, this.#h = void 0, this.#n = void 0; + } + start(t) { + if (t) { + if (this.#n) return this.#n; + let s = this.#c.state(); + return this.#c.add(s, this.#t, 0, true), this.#n = this.#p(this.#c.done(s)); + } + if (this.#h) return this.#h; + let e = this.#d.state(); + return this.#d.add(e, this.#t, 0, true), this.#h = this.#o(this.#d.done(e)); + } + next(t, e) { + let s = e.charCodeAt(0), i = s < 128 ? void 0 : t.next.get(e); + if (i) return i; + let r = t === this.#n ? this.#o(this.#c.step(t.state, e, 0, true)) : this.#o(this.#d.step(t.state, e, 1, true)); + return s < 128 ? (t.ascii || (t.ascii = new Array(128), this.#e += 128), t.ascii[s] = r) : t.next.set(e, r), this.#e++, r; + } + }, $i = (n) => { + let t = []; + for (let e = n; e.t !== "match"; e = e.next) { + if (e.t === "split" || e.t === "neg") return; + t.push(e); + } + return t; + }, qi = (n, t, e, s) => { + let i = 0, r = e, h = -1, a = 0; + for (; r < s; ) { + let o = n[i]; + if (o?.t === "star") { + h = i++, a = r; + continue; + } + let l = t[r]; + if (o && (o.t === "any" || o.t === "lit" && Me(o, l) || o.t === "class" && o.re.test(l))) { + i++, r++; + continue; + } + if (h === -1) return false; + i = h + 1, r = ++a; + } + for (; n[i]?.t === "star"; ) i++; + return i === n.length; + }, Os = (n) => { + let t = 0, e = 0; + for (let s of n) { + let [i, r] = Hi(s); + t += i, e += r; + } + return [t, e]; + }, Hi = (n) => { + if (n.t === "star") return [0, 1 / 0]; + if (n.t !== "ext") return [1, 1]; + if (n.type === "!") return [0, 1 / 0]; + let t = n.alts.map(Os), e = Math.min(...t.map((r) => r[0])), s = Math.max(...t.map((r) => r[1])), i = s === 0 ? 0 : 1 / 0; + return n.type === "@" ? [e, s] : n.type === "?" ? [0, s] : n.type === "*" ? [0, i] : [e, i]; + }, bs = (n, t, e) => { + for (let s = 0; s < n.length; s++) if (!Me(n[s], t[e + s])) return false; + return true; + }, Xi = /[/\ud800-\udfff]/, Ki = /[\ud800-\udfff]/, Ft = (n) => Ki.test(n) ? [...n] : n, ys = (n) => { + if (n.includes("/")) throw new Error("can only match a single path portion, got: " + n); + }, ke = class { + pattern; + options; + #t; + #i; + #e; + #h; + #n; + #d; + #c; + #p = false; + #o = 0; + #m = 1 / 0; + #a = []; + #l = []; + #r; + #w; + #_ = false; + #b; + #u; + constructor(t, e = {}) { + if (t.includes("/")) throw new Error("can only match a single path portion, got pattern: " + t); + this.pattern = t, this.options = e; + let { nocase: s = false, noext: i = false, normalize: r } = e; + this.#u = r === true ? "NFC" : r || void 0; + let h = /^[?*+@]\(\)$/.test(t), a = Bi(t, s, i || h, this.#u), [o] = Ss(a, zi(a), 0, a.length, true); + this.#u && (o = vs(o, this.#u)); + let [l, c] = Gi(o, s); + if (this.#t = l, this.#i = c, o.every((u) => u.t === "lit")) this.#n = o.map((u) => u.ch).join(""), s && (this.#d = Oe(this.#n)); + else { + let u = (g) => g.t !== "lit" ? void 0 : s ? { ch: g.ch, re: Oe(g.ch) } : { ch: g.ch }; + for (let g of o) { + let f = u(g); + if (!f) break; + this.#a.push(f); + } + for (let g = o.length - 1; g >= 0; g--) { + let f = u(o[g]); + if (!f) break; + this.#l.unshift(f); + } + this.#_ = !!(this.#a.length || this.#l.length), s || (this.#r = this.#a.map((g) => g.ch).join(""), this.#w = this.#l.map((g) => g.ch).join("")), this.#c = $i(this.#t)?.slice(this.#a.length, -this.#l.length || void 0), this.#p = !!this.#c?.every((g) => g.t === "star" || g.t === "any"); + let [p, d] = Os(o); + this.#o = p, this.#m = d; + } + } + test(t) { + return this.#u ? (ys(t), this.#v(t.normalize(this.#u))) : Xi.test(t) ? (ys(t), this.#v(t, [...t])) : this.#v(t, t); + } + testUnchecked(t) { + return this.#v(this.#u ? t.normalize(this.#u) : t); + } + #v(t, e) { + if (this.#n !== void 0) return this.#d ? this.#d.test(t) : t === this.#n; + let s = this.#o, i = this.#m; + if (e === void 0) { + let c = t.length, u = c + 1 >> 1; + if (c < s || u > i) return false; + (u < s || c > i) && (e = Ft(t)); + } + if (e !== void 0 && (e.length < s || e.length > i)) return false; + let r = this.#a.length; + if (this.#_) if (this.#r !== void 0 && this.#w !== void 0) { + if (!t.startsWith(this.#r) || !t.endsWith(this.#w)) return false; + } else { + e ??= Ft(t); + let c = e.length - this.#l.length; + if (!bs(this.#a, e, 0) || !bs(this.#l, e, c)) return false; + } + let h = !this.options.dot && t.startsWith("."); + if (this.#c) { + if (t === "." || t === ".." || h && !r) return false; + if (this.#p) return true; + e ??= Ft(t); + let c = e.length - this.#l.length; + return qi(this.#c, e, r, c); + } + if (e ??= Ft(t), t === "." || t === "..") { + this.#e ??= ws(this.#i); + let c = this.#h ??= new ut(true, false, this.#e), u = c.state(); + c.add(u, this.#t, 0, true); + let p = c.done(u); + for (let d = 0; d < e.length; d++) p = c.step(p, e[d], d, true); + return p.match; + } + this.#e ??= ws(this.#i); + let a = this.#b ??= new Ae(this.#t, this.#e), o = a.start(h), l = e === t; + for (let c = 0; c < e.length; c++) { + if (o.dead) return false; + let u = l ? t.charCodeAt(c) : e[c].charCodeAt(0); + o = o.ascii?.[u] ?? a.next(o, e[c]); + } + return o.match; } toString() { - return this.#f !== void 0 ? this.#f : this.type ? this.#f = this.type + "(" + this.#r.map((t) => String(t)).join("|") + ")" : this.#f = this.#r.map((t) => String(t)).join(""); - } - #a() { - if (this !== this.#t) throw new Error("should only call on root"); - if (this.#c) return this; - this.toString(), this.#c = true; - let t; - for (; t = this.#w.pop(); ) { - if (t.type !== "!") continue; - let e = t, s = e.#h; - for (; s; ) { - for (let i = e.#S + 1; !s.type && i < s.#r.length; i++) for (let r of t.#r) { - if (typeof r == "string") throw new Error("string part in extglob AST??"); - r.copyIn(s.#r[i]); - } - e = s, s = e.#h; - } - } - return this; - } - push(...t) { - for (let e of t) if (e !== "") { - if (typeof e != "string" && !(e instanceof n && e.#h === this)) throw new Error("invalid part: " + e); - this.#r.push(e); - } - } - toJSON() { - let t = this.type === null ? this.#r.slice().map((e) => typeof e == "string" ? e : e.toJSON()) : [this.type, ...this.#r.map((e) => e.toJSON())]; - return this.isStart() && !this.type && t.unshift([]), this.isEnd() && (this === this.#t || this.#t.#c && this.#h?.type === "!") && t.push({}), t; - } - isStart() { - if (this.#t === this) return true; - if (!this.#h?.isStart()) return false; - if (this.#S === 0) return true; - let t = this.#h; - for (let e = 0; e < this.#S; e++) { - let s = t.#r[e]; - if (!(s instanceof n && s.type === "!")) return false; - } - return true; - } - isEnd() { - if (this.#t === this || this.#h?.type === "!") return true; - if (!this.#h?.isEnd()) return false; - if (!this.type) return this.#h?.isEnd(); - let t = this.#h ? this.#h.#r.length : 0; - return this.#S === t - 1; - } - copyIn(t) { - typeof t == "string" ? this.push(t) : this.push(t.clone(this)); - } - clone(t) { - let e = new n(this.type, t); - for (let s of this.#r) e.copyIn(s); - return e; - } - static #i(t, e, s, i) { - let r = false, h = false, o = -1, a = false; - if (e.type === null) { - let u = s, m = ""; - for (; u < t.length; ) { - let p = t.charAt(u++); - if (r || p === "\\") { - r = !r, m += p; - continue; - } - if (h) { - u === o + 1 ? (p === "^" || p === "!") && (a = true) : p === "]" && !(u === o + 2 && a) && (h = false), m += p; - continue; - } else if (p === "[") { - h = true, o = u, a = false, m += p; - continue; - } - if (!i.noext && Ze(p) && t.charAt(u) === "(") { - e.push(m), m = ""; - let b = new n(p, e); - u = n.#i(t, b, u, i), e.push(b); - continue; - } - m += p; - } - return e.push(m), u; - } - let l = s + 1, f = new n(null, e), c = [], d = ""; - for (; l < t.length; ) { - let u = t.charAt(l++); - if (r || u === "\\") { - r = !r, d += u; - continue; - } - if (h) { - l === o + 1 ? (u === "^" || u === "!") && (a = true) : u === "]" && !(l === o + 2 && a) && (h = false), d += u; - continue; - } else if (u === "[") { - h = true, o = l, a = false, d += u; - continue; - } - if (Ze(u) && t.charAt(l) === "(") { - f.push(d), d = ""; - let m = new n(u, f); - f.push(m), l = n.#i(t, m, l, i); - continue; - } - if (u === "|") { - f.push(d), d = "", c.push(f), f = new n(null, e); - continue; - } - if (u === ")") return d === "" && e.#r.length === 0 && (e.#u = true), f.push(d), d = "", e.push(...c, f), l; - d += u; - } - return e.type = null, e.#s = void 0, e.#r = [t.substring(s - 1)], l; - } - static fromGlob(t, e = {}) { - let s = new n(null, void 0, e); - return n.#i(t, s, 0, e), s; - } - toMMPattern() { - if (this !== this.#t) return this.#t.toMMPattern(); - let t = this.toString(), [e, s, i, r] = this.toRegExpSource(); - if (!(i || this.#s || this.#o.nocase && !this.#o.nocaseMagicOnly && t.toUpperCase() !== t.toLowerCase())) return s; - let o = (this.#o.nocase ? "i" : "") + (r ? "u" : ""); - return Object.assign(new RegExp(`^${e}$`, o), { _src: e, _glob: t }); - } - get options() { - return this.#o; - } - toRegExpSource(t) { - let e = t ?? !!this.#o.dot; - if (this.#t === this && this.#a(), !this.type) { - let a = this.isStart() && this.isEnd() && !this.#r.some((u) => typeof u != "string"), l = this.#r.map((u) => { - let [m, p, b, w] = typeof u == "string" ? n.#v(u, this.#s, a) : u.toRegExpSource(t); - return this.#s = this.#s || b, this.#n = this.#n || w, m; - }).join(""), f = ""; - if (this.isStart() && typeof this.#r[0] == "string" && !(this.#r.length === 1 && gi.has(this.#r[0]))) { - let m = mi, p = e && m.has(l.charAt(0)) || l.startsWith("\\.") && m.has(l.charAt(2)) || l.startsWith("\\.\\.") && m.has(l.charAt(4)), b = !e && !t && m.has(l.charAt(0)); - f = p ? pi : b ? Pt : ""; - } - let c = ""; - return this.isEnd() && this.#t.#c && this.#h?.type === "!" && (c = "(?:$|\\/)"), [f + l + c, (0, Mt.unescape)(l), this.#s = !!this.#s, this.#n]; - } - let s = this.type === "*" || this.type === "+", i = this.type === "!" ? "(?:(?!(?:" : "(?:", r = this.#d(e); - if (this.isStart() && this.isEnd() && !r && this.type !== "!") { - let a = this.toString(); - return this.#r = [a], this.type = null, this.#s = void 0, [a, (0, Mt.unescape)(this.toString()), false, false]; - } - let h = !s || t || e || !Pt ? "" : this.#d(true); - h === r && (h = ""), h && (r = `(?:${r})(?:${h})*?`); - let o = ""; - if (this.type === "!" && this.#u) o = (this.isStart() && !e ? Pt : "") + ts; - else { - let a = this.type === "!" ? "))" + (this.isStart() && !e && !t ? Pt : "") + Qe + ")" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && h ? ")" : this.type === "*" && h ? ")?" : `)${this.type}`; - o = i + r + a; - } - return [o, (0, Mt.unescape)(r), this.#s = !!this.#s, this.#n]; - } - #d(t) { - return this.#r.map((e) => { - if (typeof e == "string") throw new Error("string type in extglob ast??"); - let [s, i, r, h] = e.toRegExpSource(t); - return this.#n = this.#n || h, s; - }).filter((e) => !(this.isStart() && this.isEnd()) || !!e).join("|"); - } - static #v(t, e, s = false) { - let i = false, r = "", h = false, o = false; - for (let a = 0; a < t.length; a++) { - let l = t.charAt(a); - if (i) { - i = false, r += (wi.has(l) ? "\\" : "") + l; - continue; - } - if (l === "*") { - if (o) continue; - o = true, r += s && /^[*]+$/.test(t) ? ts : Qe, e = true; - continue; - } else o = false; - if (l === "\\") { - a === t.length - 1 ? r += "\\\\" : i = true; - continue; - } - if (l === "[") { - let [f, c, d, u] = (0, fi.parseClass)(t, a); - if (d) { - r += f, h = h || c, a += d - 1, e = e || u; - continue; - } - } - if (l === "?") { - r += de, e = true; - continue; - } - r += bi(l); - } - return [r, (0, Mt.unescape)(t), !!e, h]; + return Ii(this.#t); } }; - Dt.AST = fe; + jt.Matcher = ke; }); - var me = R((Ft) => { + var As = x((Dt) => { "use strict"; - Object.defineProperty(Ft, "__esModule", { value: true }); - Ft.escape = void 0; - var yi = (n, { windowsPathsNoEscape: t = false, magicalBraces: e = false } = {}) => e ? t ? n.replace(/[?*()[\]{}]/g, "[$&]") : n.replace(/[?*()[\]\\{}]/g, "\\$&") : t ? n.replace(/[?*()[\]]/g, "[$&]") : n.replace(/[?*()[\]\\]/g, "\\$&"); - Ft.escape = yi; + Object.defineProperty(Dt, "__esModule", { value: true }); + Dt.assertValidPattern = void 0; + var Vi = 1024 * 64, Yi = (n) => { + if (typeof n != "string") throw new TypeError("invalid pattern"); + if (n.length > Vi) throw new TypeError("pattern is too long"); + }; + Dt.assertValidPattern = Yi; }); - var H = R((g) => { + var xe = x((Nt) => { "use strict"; - Object.defineProperty(g, "__esModule", { value: true }); - g.unescape = g.escape = g.AST = g.Minimatch = g.match = g.makeRe = g.braceExpand = g.defaults = g.filter = g.GLOBSTAR = g.sep = g.minimatch = void 0; - var Si = Ke(), jt = Xe(), is = pe(), vi = me(), Ei = kt(), _i = (n, t, e = {}) => ((0, jt.assertValidPattern)(t), !e.nocomment && t.charAt(0) === "#" ? false : new J(t, e).match(n)); - g.minimatch = _i; - var Oi = /^\*+([^+@!?\*\[\(]*)$/, xi = (n) => (t) => !t.startsWith(".") && t.endsWith(n), Ti = (n) => (t) => t.endsWith(n), Ci = (n) => (n = n.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(n)), Ri = (n) => (n = n.toLowerCase(), (t) => t.toLowerCase().endsWith(n)), Ai = /^\*+\.\*+$/, ki = (n) => !n.startsWith(".") && n.includes("."), Mi = (n) => n !== "." && n !== ".." && n.includes("."), Pi = /^\.\*+$/, Di = (n) => n !== "." && n !== ".." && n.startsWith("."), Fi = /^\*+$/, ji = (n) => n.length !== 0 && !n.startsWith("."), Ni = (n) => n.length !== 0 && n !== "." && n !== "..", Li = /^\?+([^+@!?\*\[\(]*)?$/, Wi = ([n, t = ""]) => { - let e = rs([n]); - return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e; - }, Bi = ([n, t = ""]) => { - let e = ns([n]); - return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e; - }, Ii = ([n, t = ""]) => { - let e = ns([n]); - return t ? (s) => e(s) && s.endsWith(t) : e; - }, Gi = ([n, t = ""]) => { - let e = rs([n]); - return t ? (s) => e(s) && s.endsWith(t) : e; - }, rs = ([n]) => { - let t = n.length; - return (e) => e.length === t && !e.startsWith("."); - }, ns = ([n]) => { - let t = n.length; - return (e) => e.length === t && e !== "." && e !== ".."; - }, hs = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", es = { win32: { sep: "\\" }, posix: { sep: "/" } }; - g.sep = hs === "win32" ? es.win32.sep : es.posix.sep; - g.minimatch.sep = g.sep; - g.GLOBSTAR = /* @__PURE__ */ Symbol("globstar **"); - g.minimatch.GLOBSTAR = g.GLOBSTAR; - var zi = "[^/]", Ui = zi + "*?", $i = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", qi = "(?:(?!(?:\\/|^)\\.).)*?", Hi = (n, t = {}) => (e) => (0, g.minimatch)(e, n, t); - g.filter = Hi; - g.minimatch.filter = g.filter; - var F = (n, t = {}) => Object.assign({}, n, t), Vi = (n) => { - if (!n || typeof n != "object" || !Object.keys(n).length) return g.minimatch; - let t = g.minimatch; - return Object.assign((s, i, r = {}) => t(s, i, F(n, r)), { Minimatch: class extends t.Minimatch { + Object.defineProperty(Nt, "__esModule", { value: true }); + Nt.escape = void 0; + var Zi = (n, { windowsPathsNoEscape: t = false, magicalBraces: e = false } = {}) => e ? t ? n.replace(/[?*()[\]{}]/g, "[$&]") : n.replace(/[?*()[\]\\{}]/g, "\\$&") : t ? n.replace(/[?*()[\]]/g, "[$&]") : n.replace(/[?*()[\]\\]/g, "\\$&"); + Nt.escape = Zi; + }); + var Re = x((Lt) => { + "use strict"; + Object.defineProperty(Lt, "__esModule", { value: true }); + Lt.unescape = void 0; + var Ji = (n, { windowsPathsNoEscape: t = false, magicalBraces: e = true } = {}) => e ? t ? n.replace(/\[([^/\\])\]/g, "$1") : n.replace(/((?!\\).|^)\[([^/\\])\]/g, "$1$2").replace(/\\([^/])/g, "$1") : t ? n.replace(/\[([^/\\{}])\]/g, "$1") : n.replace(/((?!\\).|^)\[([^/\\{}])\]/g, "$1$2").replace(/\\([^/{}])/g, "$1"); + Lt.unescape = Ji; + }); + var Y = x((w) => { + "use strict"; + Object.defineProperty(w, "__esModule", { value: true }); + w.unescape = w.escape = w.Minimatch = w.match = w.braceExpand = w.defaults = w.filter = w.GLOBSTAR = w.sep = w.minimatch = void 0; + var Qi = ms(), ks = Cs(), zt = As(), tr = xe(), er = Re(), sr = (n, t, e = {}) => ((0, zt.assertValidPattern)(t), !e.nocomment && t.charAt(0) === "#" ? false : new ht(t, e).match(n)); + w.minimatch = sr; + var Fs = typeof process == "object" && process ? process.env?.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", Ms = { win32: { sep: "\\" }, posix: { sep: "/" } }; + w.sep = Fs === "win32" ? Ms.win32.sep : Ms.posix.sep; + w.minimatch.sep = w.sep; + w.GLOBSTAR = /* @__PURE__ */ Symbol("globstar **"); + w.minimatch.GLOBSTAR = w.GLOBSTAR; + var ir = (n, t = {}) => (e) => (0, w.minimatch)(e, n, t); + w.filter = ir; + w.minimatch.filter = w.filter; + var q = (n, t = {}) => Object.assign({}, n, t), rr = (n) => { + if (!n || typeof n != "object" || !Object.keys(n).length) return w.minimatch; + let t = w.minimatch; + return Object.assign((s, i, r = {}) => t(s, i, q(n, r)), { Minimatch: class extends t.Minimatch { constructor(i, r = {}) { - super(i, F(n, r)); + super(i, q(n, r)); } static defaults(i) { - return t.defaults(F(n, i)).Minimatch; + return t.defaults(q(n, i)).Minimatch; } - }, AST: class extends t.AST { - constructor(i, r, h = {}) { - super(i, r, F(n, h)); - } - static fromGlob(i, r = {}) { - return t.AST.fromGlob(i, F(n, r)); - } - }, unescape: (s, i = {}) => t.unescape(s, F(n, i)), escape: (s, i = {}) => t.escape(s, F(n, i)), filter: (s, i = {}) => t.filter(s, F(n, i)), defaults: (s) => t.defaults(F(n, s)), makeRe: (s, i = {}) => t.makeRe(s, F(n, i)), braceExpand: (s, i = {}) => t.braceExpand(s, F(n, i)), match: (s, i, r = {}) => t.match(s, i, F(n, r)), sep: t.sep, GLOBSTAR: g.GLOBSTAR }); + }, unescape: (s, i = {}) => t.unescape(s, q(n, i)), escape: (s, i = {}) => t.escape(s, q(n, i)), filter: (s, i = {}) => t.filter(s, q(n, i)), defaults: (s) => t.defaults(q(n, s)), braceExpand: (s, i = {}) => t.braceExpand(s, q(n, i)), match: (s, i, r = {}) => t.match(s, i, q(n, r)), sep: t.sep, GLOBSTAR: w.GLOBSTAR }); }; - g.defaults = Vi; - g.minimatch.defaults = g.defaults; - var Ki = (n, t = {}) => ((0, jt.assertValidPattern)(n), t.nobrace || !/\{(?:(?!\{).)*\}/.test(n) ? [n] : (0, Si.expand)(n, { max: t.braceExpandMax })); - g.braceExpand = Ki; - g.minimatch.braceExpand = g.braceExpand; - var Xi = (n, t = {}) => new J(n, t).makeRe(); - g.makeRe = Xi; - g.minimatch.makeRe = g.makeRe; - var Yi = (n, t, e = {}) => { - let s = new J(t, e); + w.defaults = rr; + w.minimatch.defaults = w.defaults; + var nr = (n, t = {}) => ((0, zt.assertValidPattern)(n), t.nobrace || !/\{(?:(?!\{).)*\}/.test(n) ? [n] : (0, Qi.expand)(n, { max: t.braceExpandMax })); + w.braceExpand = nr; + w.minimatch.braceExpand = w.braceExpand; + var hr = (n, t, e = {}) => { + let s = new ht(t, e); return n = n.filter((i) => s.match(i)), s.options.nonull && !n.length && n.push(t), n; }; - g.match = Yi; - g.minimatch.match = g.match; - var ss = /[?*]|[+@!]\(.*?\)|\[|\]/, Ji = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), J = class { + w.match = hr; + w.minimatch.match = w.match; + var xs = /[?*]|[+@!]\(.*?\)|\[|\]/, js = (n, t) => { + let e = t + 1; + (n.charAt(e) === "!" || n.charAt(e) === "^") && e++; + let s = false; + for (; e < n.length; e++) { + let i = n.charAt(e); + if (i === "]" && s) return e; + s = true, i === "\\" && e++; + } + return -1; + }, or2 = (n, t) => { + if (!t && (n === "+()" || n === "@()")) return n; + let e = ""; + for (let s = 0; s < n.length; s++) { + let i = n.charAt(s); + if (i === "\\") e += n.charAt(++s) || i; + else { + if (i === "*" || i === "?") return; + if (i === "[") { + let r = js(n, s); + if (r === -1) { + e += i; + continue; + } + let h = n.slice(s + 1, r); + if (h.startsWith("\\") && (h = h.slice(1)), [...h].length !== 1 || "!^".includes(n.charAt(s + 1))) return; + e += h, s = r; + } else { + if (!t && "+@!".includes(i) && n.charAt(s + 1) === "(" && n.includes(")", s + 2)) return; + e += i; + } + } + } + return e; + }, ar = (n) => { + if (/^[?*+@]\(\)$/.test(n) || n.includes("[:")) return false; + let t = 0; + for (let e = 0; e < n.length; e++) { + let s = n.charAt(e); + if (s === "\\") { + if (++e === n.length) return false; + } else if (s === "[") { + let i = js(n, e); + i !== -1 && (e = i); + } else if ("+@!?*".includes(s) && n.charAt(e + 1) === "(") t++, e++; + else if (s === ")") { + if (!t--) return false; + } else if (s === "|" && !t) return false; + } + return !t; + }, Pe, Rs, V = (n, t) => typeof n == "string" ? t === n : t !== "" && n.testUnchecked(t), Ps = (n, t, e, s, i) => V(n, t) ? e : s !== void 0 && V(n, s) ? i : -1, je = (n) => n === "." || n === "..", Te = (n) => typeof n == "string" && /^[a-z]:$/i.test(n), Bt = (n) => typeof n == "string" && /^unc$/i.test(n), Fe = (n) => { + if (n[0] !== "" || n[1] !== "") return -1; + let t = n[2] !== "?" ? 2 : Bt(n[3]) ? 4 : -1, e = n[t], s = n[t + 1]; + return t !== -1 && e !== void 0 && e !== "" && e !== w.GLOBSTAR && s !== void 0 && s !== "" && s !== w.GLOBSTAR ? t : -1; + }, Wt = (n, t) => !je(n) && (t || !n.startsWith(".")), ft = (n, t, e, s, i) => { + for (let r = t; r < e; ) { + if (n.charCodeAt(r) === 46) { + if (!s) return true; + let a = n.charCodeAt(r + 1) === 46 ? r + 2 : r + 1; + if (a >= e || Gt(n.charCodeAt(a), i)) return true; + } + let h = De(n, r, i); + if (h === -1) return false; + for (r = h + 1; r < e && Gt(n.charCodeAt(r), i); ) r++; + } + return false; + }, Gt = (n, t) => t === "/" ? n === 47 : t === "\\" ? n === 92 : n === 47 || n === 92, De = (n, t, e) => { + if (e !== "both") return n.indexOf(e, t); + let s = n.indexOf("/", t), i = n.indexOf("\\", t); + return s === -1 ? i : i === -1 ? s : Math.min(s, i); + }, Ts = (n, t, e) => e !== "both" ? n.lastIndexOf(e, t) : Math.max(n.lastIndexOf("/", t), n.lastIndexOf("\\", t)), ht = class { options; set; pattern; @@ -135468,19 +135730,51 @@ var require_index_min = __commonJS({ isWindows; platform; windowsNoMagicRoot; - regexp; + maxGlobstarRecursion; + #t; + #i; + #e; + #h; + #n = []; + #d = []; + #c = []; + #p = /* @__PURE__ */ new Map(); + #o = /* @__PURE__ */ new WeakMap(); constructor(t, e = {}) { - (0, jt.assertValidPattern)(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || hs, this.isWindows = this.platform === "win32"; + (0, zt.assertValidPattern)(t), e = e || {}, this.options = e, this.maxGlobstarRecursion = e.maxGlobstarRecursion ?? 200, this.pattern = t, this.platform = e.platform || Fs, this.isWindows = this.platform === "win32"; let s = "allowWindowsEscape"; - this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e[s] === false, this.windowsPathsNoEscape && (this.pattern = this.pattern.replace(/\\/g, "/")), this.preserveMultipleSlashes = !!e.preserveMultipleSlashes, this.regexp = null, this.negate = false, this.nonegate = !!e.nonegate, this.comment = false, this.empty = false, this.partial = !!e.partial, this.nocase = !!this.options.nocase, this.windowsNoMagicRoot = e.windowsNoMagicRoot !== void 0 ? e.windowsNoMagicRoot : !!(this.isWindows && this.nocase), this.globSet = [], this.globParts = [], this.set = [], this.make(); + this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e[s] === false, this.windowsPathsNoEscape && (this.pattern = this.pattern.replace(/\\/g, "/")), this.preserveMultipleSlashes = !!e.preserveMultipleSlashes, this.negate = false, this.nonegate = !!e.nonegate, this.comment = false, this.empty = false, this.partial = !!e.partial, this.nocase = !!this.options.nocase, this.windowsNoMagicRoot = e.windowsNoMagicRoot !== void 0 ? e.windowsNoMagicRoot : !!(this.isWindows && this.nocase), this.globSet = [], this.globParts = [], this.set = [], this.#t = !this.preserveMultipleSlashes, this.#e = (e.optimizationLevel ?? 1) >= 2; + let i = e.normalize; + this.#h = i === true ? "NFC" : i || void 0, this.make(); + let r = this.set.map((h) => this.#a(h)); + this.#c = this.set.map((h, a) => this.#t && h.length - 1 > r[a]), this.#n = this.set.map((h, a) => { + let o = this.#c[a] ? h.length - 1 : h.length, l = h.slice(r[a] + 1, o).filter((c) => typeof c == "string" && !!c); + return [...new Set(l)]; + }), this.#i = this.#n.some((h) => h.length), this.#d = this.set.map((h, a) => { + let [o, l, c] = h; + if (this.#c[a] && h.length === 2 && o === w.GLOBSTAR && l !== w.GLOBSTAR) return "tail"; + if (this.#c[a] && e.matchBase && h.length === 1 && o !== w.GLOBSTAR && o !== "") return "base"; + if (!(!this.#t || r[a] !== -1)) { + if (h.length === 3 && o === w.GLOBSTAR && c === w.GLOBSTAR && l !== w.GLOBSTAR && l !== "" && this.maxGlobstarRecursion > 0) return "mid"; + if (h.length === 2 && l === w.GLOBSTAR && o !== w.GLOBSTAR && o !== "") return "head"; + } + }); + } + #m(t) { + return this.#h ? t.normalize(this.#h) : t; + } + #a(t) { + if (!this.isWindows) return -1; + if (Te(t[0])) return 0; + if (t[0] === "" && t[1] === "" && t[2] === "?" && Te(t[3])) return 3; + let s = Fe(t); + return s === -1 ? -1 : s + 1; } hasMagic() { if (this.options.magicalBraces && this.set.length > 1) return true; for (let t of this.set) for (let e of t) if (typeof e != "string") return true; return false; } - debug(...t) { - } make() { let t = this.pattern, e = this.options; if (!e.nocomment && t.charAt(0) === "#") { @@ -135491,25 +135785,50 @@ var require_index_min = __commonJS({ this.empty = true; return; } - this.parseNegate(), this.globSet = [...new Set(this.braceExpand())], e.debug && (this.debug = (...r) => console.error(...r)), this.debug(this.pattern, this.globSet); - let s = this.globSet.map((r) => this.slashSplit(r)); - this.globParts = this.preprocess(s), this.debug(this.pattern, this.globParts); - let i = this.globParts.map((r, h, o) => { + this.parseNegate(), this.globSet = [...new Set(this.braceExpand())]; + let s = this.globSet.map((r) => this.#S(r)); + this.globParts = this.preprocess(s); + let i = this.globParts.map((r, h, a) => { if (this.isWindows && this.windowsNoMagicRoot) { - let a = r[0] === "" && r[1] === "" && (r[2] === "?" || !ss.test(r[2])) && !ss.test(r[3]), l = /^[a-z]:/i.test(r[0]); - if (a) return [...r.slice(0, 4), ...r.slice(4).map((f) => this.parse(f))]; - if (l) return [r[0], ...r.slice(1).map((f) => this.parse(f))]; + let o = r[2] === "?" && Bt(r[3]) ? 6 : 4, l = r[0] === "" && r[1] === "" && (r[2] === "?" || !xs.test(r[2])) && r.slice(3, o).every((u) => !xs.test(u)), c = /^[a-z]:/i.test(r[0]); + if (l) return [...r.slice(0, o).map((u) => this.#m(u)), ...r.slice(o).map((u) => this.parse(u))]; + if (c) return [this.#m(r[0]), ...r.slice(1).map((u) => this.parse(u))]; } - return r.map((a) => this.parse(a)); + return r.map((o) => this.parse(o)); }); - if (this.debug(this.pattern, i), this.set = i.filter((r) => r.indexOf(false) === -1), this.isWindows) for (let r = 0; r < this.set.length; r++) { + if (this.set = i.filter((r) => r.indexOf(false) === -1), this.isWindows) for (let r = 0; r < this.set.length; r++) { let h = this.set[r]; - h[0] === "" && h[1] === "" && this.globParts[r][2] === "?" && typeof h[3] == "string" && /^[a-z]:$/i.test(h[3]) && (h[2] = "?"); + h[0] === "" && h[1] === "" && this.globParts[r][2] === "?" && (Te(h[3]) || Bt(this.globParts[r][3])) && (Bt(this.globParts[r][3]) && (h[3] = "UNC"), h[2] = "?"); + } + e.noext || this.mergeRows(); + } + mergeRows() { + let t = true; + for (; t; ) { + t = false; + let e = Math.max(0, ...this.set.map((s) => s.length)); + for (let s = 0; s < e; s++) { + let i = /* @__PURE__ */ new Map(); + this.set.forEach((h, a) => { + if (!(h[s] instanceof ks.Matcher) || !ar(this.globParts[a][s])) return; + let o = [...this.globParts[a]]; + o[s] = ""; + let l = `${h.length}/${o.join("/")}`, c = i.get(l); + c ? c.push(a) : i.set(l, [a]); + }); + let r = /* @__PURE__ */ new Set(); + for (let h of i.values()) { + if (h.length < 2) continue; + let [a, ...o] = h, c = `@(${h.map((u) => this.globParts[u][s]).join("|")})`; + this.globParts[a][s] = c, this.set[a][s] = this.parse(c); + for (let u of o) r.add(u); + } + r.size && (t = true, this.set = this.set.filter((h, a) => !r.has(a)), this.globParts = this.globParts.filter((h, a) => !r.has(a))); + } } - this.debug(this.pattern, this.set); } preprocess(t) { - if (this.options.noglobstar) for (let s = 0; s < t.length; s++) for (let i = 0; i < t[s].length; i++) t[s][i] === "**" && (t[s][i] = "*"); + if (this.options.noglobstar) for (let s of t) for (let i = 0; i < s.length; i++) s[i] === "**" && (s[i] = "*"); let { optimizationLevel: e = 1 } = this.options; return e >= 2 ? (t = this.firstPhasePreProcess(t), t = this.secondPhasePreProcess(t)) : e >= 1 ? t = this.levelOneOptimize(t) : t = this.adjascentGlobstarOptimize(t), t; } @@ -135525,67 +135844,150 @@ var require_index_min = __commonJS({ }); } levelOneOptimize(t) { - return t.map((e) => (e = e.reduce((s, i) => { - let r = s[s.length - 1]; - return i === "**" && r === "**" ? s : i === ".." && r && r !== ".." && r !== "." && r !== "**" ? (s.pop(), s) : (s.push(i), s); - }, []), e.length === 0 ? [""] : e)); + return t.map((e) => { + let s = this.#a(e) + 1; + return e = e.reduce((i, r) => { + let h = i[i.length - 1]; + return r === "**" && h === "**" ? i : r === ".." && i.length > s && h && h !== ".." && h !== "." && h !== "**" ? (i.pop(), i) : (i.push(r), i); + }, []), e.length === 0 ? [""] : e; + }); } - levelTwoFileOptimize(t) { - Array.isArray(t) || (t = this.slashSplit(t)); - let e = false; - do { - if (e = false, !this.preserveMultipleSlashes) { - for (let i = 1; i < t.length - 1; i++) { - let r = t[i]; - i === 1 && r === "" && t[0] === "" || (r === "." || r === "") && (e = true, t.splice(i, 1), i--); + #l(t) { + let e = !this.isWindows || !t.includes("\\") ? "/" : t.includes("/") ? "both" : "\\", s = this.#t ? 0 : -1, i = "", r = 0, h, a = 0, o = !!this.options.dot; + t: for (let l = 0; l < this.set.length; l++) { + let c = this.set[l], u = c[c.length - 1], p = s !== -1 && this.#c[l] && u !== w.GLOBSTAR; + if (p && s === 0) { + let f = Ts(t, t.length, e); + if (r = f + 1, i = t.slice(r), i === "" && f >= 0) { + let m = f; + for (; m > 0 && Gt(t.charCodeAt(m - 1), e); ) m--; + a = m === 0 ? 0 : Ts(t, m - 1, e) + 1, h = t.slice(a, m); } - t[0] === "." && t.length === 2 && (t[1] === "." || t[1] === "") && (e = true, t.pop()); + let b = this.#e && (je(i) || i === "" && h !== void 0 && je(h)); + s = b ? -1 : 1, p = !b; } - let s = 0; - for (; (s = t.indexOf("..", s + 1)) !== -1; ) { - let i = t[s - 1]; - i && i !== "." && i !== ".." && i !== "**" && (e = true, t.splice(s - 1, 2), s -= 2); + let d = -1; + if (p && typeof u == "string" && (d = Ps(u, i, r, h, a), d === -1)) continue; + if (this.#i) { + for (let f of this.#n[l]) if (!t.includes(f)) continue t; } - } while (e); - return t.length === 0 ? [""] : t; + if (p && typeof u == "object" && (d = Ps(u, i, r, h, a), d === -1)) continue; + let g = this.#d[l]; + if (g === "base" && p) return "yes"; + if (g === "tail" && p) { + if (this.#e && ft(t, 0, d, true, e)) return "maybe"; + if (!ft(t, 0, d, o, e)) return "yes"; + continue; + } + if (g === "mid" || g === "head") { + let f = this.#w(t, c, g === "head", o, e); + if (f !== "no") return f; + continue; + } + return "maybe"; + } + return "no"; + } + #r(t, e, s) { + let i = !!this.options.dot, r = t.length; + if (s === "head") { + if (r < 2 || !V(e[0], t[0])) return false; + for (let a = 1; a < r; a++) if (!Wt(t[a], i)) return false; + return true; + } + let h = e[1]; + if (s === "tail") { + let a = r - 1; + if (!V(h, t[a]) && (t[a] !== "" || r === 1 || !V(h, t[--a]))) return false; + for (let o = 0; o < a; o++) if (!Wt(t[o], i)) return false; + return true; + } + for (let a = 0; a < r; a++) { + if (V(h, t[a]) && a + 1 < r) { + let o = a + 1; + for (; o < r && Wt(t[o], i); ) o++; + if (o === r) return true; + } + if (!Wt(t[a], i)) return false; + } + return false; + } + #w(t, e, s, i, r) { + if (this.#e && ft(t, 0, t.length, true, r)) return "maybe"; + let h = e[s ? 0 : 1], a = 0; + for (let o = De(t, a, r); o !== -1; o = De(t, a, r)) { + let l = o + 1; + for (; l < t.length && Gt(t.charCodeAt(l), r); ) l++; + if ((typeof h == "string" ? o - a === h.length && t.startsWith(h, a) : o > a && h.testUnchecked(t.slice(a, o))) && !ft(t, l, t.length, i, r)) return "yes"; + if (s || ft(t, a, l, i, r)) return "no"; + a = l; + } + return "no"; + } + #_(t) { + let e = Pe; + return e?.f === t && e.isWindows === this.isWindows && e.preserveMultipleSlashes === this.preserveMultipleSlashes && e.normalize === this.#h ? e : void 0; + } + #b(t) { + let { isWindows: e, preserveMultipleSlashes: s } = this, i = this.#S(e ? t.split("\\").join("/") : t), r = this.#h; + return r && (i = i.map((h) => h.normalize(r))), Pe = { f: t, isWindows: e, preserveMultipleSlashes: s, normalize: r, parts: i }, Pe; + } + #u(t) { + let e = [...t], s = false; + do { + if (s = false, !this.preserveMultipleSlashes) { + for (let h = 1; h < e.length - 1; h++) { + let a = e[h]; + h === 1 && a === "" && e[0] === "" || (a === "." || a === "") && (s = true, e.splice(h, 1), h--); + } + e[0] === "." && e.length === 2 && (e[1] === "." || e[1] === "") && (s = true, e.pop()); + } + let i = this.#a(e) + 1, r = i; + for (; (r = e.indexOf("..", r + 1)) !== -1; ) { + let h = e[r - 1]; + h && h !== "." && h !== ".." && h !== "**" && (s = true, e.splice(r - 1, 2), r = Math.max(r - 2, i)); + } + } while (s); + return e.length === 0 ? [""] : e; } firstPhasePreProcess(t) { - let e = false; + let { braceExpandMax: e = 1e5 } = this.options, s = false; do { - e = false; - for (let s of t) { - let i = -1; - for (; (i = s.indexOf("**", i + 1)) !== -1; ) { - let h = i; - for (; s[h + 1] === "**"; ) h++; - h > i && s.splice(i + 1, h - i); - let o = s[i + 1], a = s[i + 2], l = s[i + 3]; - if (o !== ".." || !a || a === "." || a === ".." || !l || l === "." || l === "..") continue; - e = true, s.splice(i, 1); - let f = s.slice(0); - f[i] = "**", t.push(f), i--; + s = false; + for (let i of t) { + let r = -1; + for (; (r = i.indexOf("**", r + 1)) !== -1; ) { + let o = r; + for (; i[o + 1] === "**"; ) o++; + o > r && i.splice(r + 1, o - r); + let l = i[r + 1], c = i[r + 2], u = i[r + 3]; + if (l !== ".." || !c || c === "." || c === ".." || !u || u === "." || u === ".." || t.length >= e) continue; + s = true, i.splice(r, 1); + let p = i.slice(0); + p[r] = "**", t.push(p), r--; } if (!this.preserveMultipleSlashes) { - for (let h = 1; h < s.length - 1; h++) { - let o = s[h]; - h === 1 && o === "" && s[0] === "" || (o === "." || o === "") && (e = true, s.splice(h, 1), h--); + for (let o = 1; o < i.length - 1; o++) { + let l = i[o]; + o === 1 && l === "" && i[0] === "" || (l === "." || l === "") && (s = true, i.splice(o, 1), o--); } - s[0] === "." && s.length === 2 && (s[1] === "." || s[1] === "") && (e = true, s.pop()); + i[0] === "." && i.length === 2 && (i[1] === "." || i[1] === "") && (s = true, i.pop()); } - let r = 0; - for (; (r = s.indexOf("..", r + 1)) !== -1; ) { - let h = s[r - 1]; - if (h && h !== "." && h !== ".." && h !== "**") { - e = true; - let a = r === 1 && s[r + 1] === "**" ? ["."] : []; - s.splice(r - 1, 2, ...a), s.length === 0 && s.push(""), r -= 2; + let h = this.#a(i) + 1, a = h; + for (; (a = i.indexOf("..", a + 1)) !== -1; ) { + let o = i[a - 1]; + if (o && o !== "." && o !== ".." && o !== "**") { + s = true; + let c = a === 1 && i[a + 1] === "**" ? ["."] : []; + i.splice(a - 1, 2, ...c), i.length === 0 && i.push(""), a = Math.max(a - 2, h); } } } - } while (e); + } while (s); return t; } secondPhasePreProcess(t) { + if (t.length > 1e3) return t; for (let e = 0; e < t.length - 1; e++) for (let s = e + 1; s < t.length; s++) { let i = this.partsMatch(t[e], t[s], !this.preserveMultipleSlashes); if (i) { @@ -135596,16 +135998,16 @@ var require_index_min = __commonJS({ return t.filter((e) => e.length); } partsMatch(t, e, s = false) { - let i = 0, r = 0, h = [], o = ""; - for (; i < t.length && r < e.length; ) if (t[i] === e[r]) h.push(o === "b" ? e[r] : t[i]), i++, r++; + let i = 0, r = 0, h = [], a = ""; + for (; i < t.length && r < e.length; ) if (t[i] === e[r]) h.push(a === "b" ? e[r] : t[i]), i++, r++; else if (s && t[i] === "**" && e[r] === t[i + 1]) h.push(t[i]), i++; else if (s && e[r] === "**" && t[i] === e[r + 1]) h.push(e[r]), r++; else if (t[i] === "*" && e[r] && (this.options.dot || !e[r].startsWith(".")) && e[r] !== "**") { - if (o === "b") return false; - o = "a", h.push(t[i]), i++, r++; + if (a === "b") return false; + a = "a", h.push(t[i]), i++, r++; } else if (e[r] === "*" && t[i] && (this.options.dot || !t[i].startsWith(".")) && t[i] !== "**") { - if (o === "a") return false; - o = "b", h.push(e[r]), i++, r++; + if (a === "a") return false; + a = "b", h.push(e[r]), i++, r++; } else return false; return t.length === e.length && h; } @@ -135615,184 +136017,184 @@ var require_index_min = __commonJS({ for (let i = 0; i < t.length && t.charAt(i) === "!"; i++) e = !e, s++; s && (this.pattern = t.slice(s)), this.negate = e; } - matchOne(t, e, s = false) { - let i = this.options; - if (this.isWindows) { - let p = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), b = !p && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), w = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), v = !w && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), E = b ? 3 : p ? 0 : void 0, y = v ? 3 : w ? 0 : void 0; - if (typeof E == "number" && typeof y == "number") { - let [S, B] = [t[E], e[y]]; - S.toLowerCase() === B.toLowerCase() && (e[y] = S, y > E ? e = e.slice(y) : E > y && (t = t.slice(E))); + #v(t, e, s, i) { + let r = 0, h = 0, a = this.isWindows ? Fe(e) : -1, o = a === -1 ? -1 : Fe(s); + if (o !== -1) { + let l = s[o], c = s[o + 1]; + typeof l != "string" || typeof c != "string" ? (r = a, h = o) : e[a].toLowerCase() === l.toLowerCase() && e[a + 1].toLowerCase() === c.toLowerCase() && (r = a + 2, h = o + 2); + } else if (this.isWindows) { + let l = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), c = !l && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), u = typeof s[0] == "string" && /^[a-z]:$/i.test(s[0]), p = !u && s[0] === "" && s[1] === "" && s[2] === "?" && typeof s[3] == "string" && /^[a-z]:$/i.test(s[3]), d = c ? 3 : l ? 0 : void 0, g = p ? 3 : u ? 0 : void 0; + if (typeof d == "number" && typeof g == "number") { + let [f, b] = [t[d], s[g]]; + f.toLowerCase() === b.toLowerCase() && (h = g + 1, r = d + 1); } } - let { optimizationLevel: r = 1 } = this.options; - r >= 2 && (t = this.levelTwoFileOptimize(t)), this.debug("matchOne", this, { file: t, pattern: e }), this.debug("matchOne", t.length, e.length); - for (var h = 0, o = 0, a = t.length, l = e.length; h < a && o < l; h++, o++) { - this.debug("matchOne loop"); - var f = e[o], c = t[h]; - if (this.debug(e, f, c), f === false) return false; - if (f === g.GLOBSTAR) { - this.debug("GLOBSTAR", [e, f, c]); - var d = h, u = o + 1; - if (u === l) { - for (this.debug("** at the end"); h < a; h++) if (t[h] === "." || t[h] === ".." || !i.dot && t[h].charAt(0) === ".") return false; - return true; - } - for (; d < a; ) { - var m = t[d]; - if (this.debug(` -globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) return this.debug("globstar found match!", d, a, m), true; - if (m === "." || m === ".." || !i.dot && m.charAt(0) === ".") { - this.debug("dot detected!", t, d, e, u); - break; - } - this.debug("globstar swallow a segment, and continue"), d++; - } - return !!(s && (this.debug(` ->>> no match, partial?`, t, d, e, u), d === a)); - } - let p; - if (typeof f == "string" ? (p = c === f, this.debug("string match", f, c, p)) : (p = f.test(c), this.debug("pattern match", f, c, p)), !p) return false; + return t = e, s.includes(w.GLOBSTAR) ? this.#y(t, s, i, r, h) : this.#g(t, s, i, r, h); + } + #y(t, e, s, i, r) { + let { head: h, body: a, tail: o, segments: l } = this.#E(e, s, r); + if (h.length) { + let u = i + h.length; + if (!this.#g(t, h, s, i, 0, u)) return false; + i += h.length, r += h.length; } - if (h === a && o === l) return true; - if (h === a) return s; - if (o === l) return h === a - 1 && t[h] === ""; + let c = 0; + if (o.length) { + if (o.length + i > t.length) return false; + let u = t.length - o.length; + if (this.#g(t, o, s, u, 0)) c = o.length; + else { + if (t[t.length - 1] !== "" || i + o.length === t.length || (u--, !this.#g(t, o, s, u, 0))) return false; + c = o.length + 1; + } + } + if (!a.length) { + let u = !!c; + for (let p = i; p < t.length - c; p++) { + let d = String(t[p]); + if (u = true, d === "." || d === ".." || !this.options.dot && d.startsWith(".")) return false; + } + return s || u; + } + return !!this.#O(t, l, t.length - c, i, 0, s, 0, !!c, /* @__PURE__ */ new Set()); + } + #E(t, e, s) { + let i = this.#o.get(t); + i || (i = [], this.#o.set(t, i)); + let r = s * 2 + (e ? 1 : 0), h = i[r]; + if (h) return h; + let a = t.indexOf(w.GLOBSTAR, s), o = t.lastIndexOf(w.GLOBSTAR), l = t.slice(s, a), c = t.slice(a + 1, e ? void 0 : o), u = e ? [] : t.slice(o + 1), p = [[[], 0]], d = p[0], g = 0, f = [0]; + for (let m of c) m === w.GLOBSTAR ? (f.push(g), d = [[], 0], p.push(d)) : (d[0].push(m), g++); + p.forEach((m, y) => { + m[1] = g - f[y]; + }); + let b = { head: l, body: c, tail: u, segments: p }; + return i[r] = b, b; + } + #O(t, e, s, i, r, h, a, o, l) { + let c = e[r]; + if (!c) { + if (h) return i >= s || i === s - 1 && t[i] === ""; + for (let g = i; g < s; g++) { + o = true; + let f = t[g]; + if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false; + } + return o; + } + let [u, p] = c, d = h ? s : s - p; + for (; i <= d; ) { + let g = r * (t.length + 1) + i; + if (l.has(g)) return false; + if (l.add(g), this.#g(t, u, h, i, 0, i + u.length) && a < this.maxGlobstarRecursion) { + let m = this.#O(t, e, s, i + u.length, r + 1, h, a + 1, o, l); + if (m !== false) return m; + } + if (i === d) break; + let b = t[i]; + if (b === "." || b === ".." || !this.options.dot && b.startsWith(".")) return false; + i++; + } + return h || null; + } + #g(t, e, s, i, r, h = t.length) { + let a, o, l, c; + for (a = i, o = r, c = Math.min(h, t.length), l = e.length; a < c && o < l; a++, o++) { + let u = e[o], p = t[a]; + if (u === false || u === w.GLOBSTAR || !V(u, p)) return false; + } + if (a === c && o === l) return true; + if (a === c) return s; + if (o === l) return a === c - 1 && t[a] === ""; throw new Error("wtf?"); } braceExpand() { - return (0, g.braceExpand)(this.pattern, this.options); + return (0, w.braceExpand)(this.pattern, this.options); } parse(t) { - (0, jt.assertValidPattern)(t); + (0, zt.assertValidPattern)(t); let e = this.options; - if (t === "**") return g.GLOBSTAR; + if (t === "**") return w.GLOBSTAR; if (t === "") return ""; - let s, i = null; - (s = t.match(Fi)) ? i = e.dot ? Ni : ji : (s = t.match(Oi)) ? i = (e.nocase ? e.dot ? Ri : Ci : e.dot ? Ti : xi)(s[1]) : (s = t.match(Li)) ? i = (e.nocase ? e.dot ? Bi : Wi : e.dot ? Ii : Gi)(s) : (s = t.match(Ai)) ? i = e.dot ? Mi : ki : (s = t.match(Pi)) && (i = Di); - let r = is.AST.fromGlob(t, this.options).toMMPattern(); - return i && typeof r == "object" && Reflect.defineProperty(r, "test", { value: i }), r; + let { nocase: s, nocaseMagicOnly: i, noext: r = false, dot: h, normalize: a } = e, o = or2(t, r); + if (o !== void 0 && !(s && !i && t.toUpperCase() !== t.toLowerCase())) return this.#m(o); + let l = this.#p.get(t); + return l || (l = new ks.Matcher(t, { nocase: s, noext: r, dot: h, normalize: a }), this.#p.set(t, l)), l; } - makeRe() { - if (this.regexp || this.regexp === false) return this.regexp; - let t = this.set; - if (!t.length) return this.regexp = false, this.regexp; - let e = this.options, s = e.noglobstar ? Ui : e.dot ? $i : qi, i = new Set(e.nocase ? ["i"] : []), r = t.map((a) => { - let l = a.map((c) => { - if (c instanceof RegExp) for (let d of c.flags.split("")) i.add(d); - return typeof c == "string" ? Ji(c) : c === g.GLOBSTAR ? g.GLOBSTAR : c._src; - }); - l.forEach((c, d) => { - let u = l[d + 1], m = l[d - 1]; - c !== g.GLOBSTAR || m === g.GLOBSTAR || (m === void 0 ? u !== void 0 && u !== g.GLOBSTAR ? l[d + 1] = "(?:\\/|" + s + "\\/)?" + u : l[d] = s : u === void 0 ? l[d - 1] = m + "(?:\\/|\\/" + s + ")?" : u !== g.GLOBSTAR && (l[d - 1] = m + "(?:\\/|\\/" + s + "\\/)" + u, l[d + 1] = g.GLOBSTAR)); - }); - let f = l.filter((c) => c !== g.GLOBSTAR); - if (this.partial && f.length >= 1) { - let c = []; - for (let d = 1; d <= f.length; d++) c.push(f.slice(0, d).join("/")); - return "(?:" + c.join("|") + ")"; - } - return f.join("/"); - }).join("|"), [h, o] = t.length > 1 ? ["(?:", ")"] : ["", ""]; - r = "^" + h + r + o + "$", this.partial && (r = "^(?:\\/|" + h + r.slice(1, -1) + o + ")$"), this.negate && (r = "^(?!" + r + ").+$"); - try { - this.regexp = new RegExp(r, [...i].join("")); - } catch { - this.regexp = false; - } - return this.regexp; - } - slashSplit(t) { - return this.preserveMultipleSlashes ? t.split("/") : this.isWindows && /^\/\/[^\/]+/.test(t) ? ["", ...t.split(/\/+/)] : t.split(/\/+/); + #S(t) { + return this.preserveMultipleSlashes ? t.split("/") : this.isWindows && /^\/\/[^/]+/.test(t) ? ["", ...t.split(/\/+/)] : t.split(/\/+/); } match(t, e = this.partial) { - if (this.debug("match", t, this.pattern), this.comment) return false; + if (this.comment) return false; if (this.empty) return t === ""; if (t === "/" && e) return true; - let s = this.options; - this.isWindows && (t = t.split("\\").join("/")); - let i = this.slashSplit(t); - this.debug(this.pattern, "split", i); - let r = this.set; - this.debug(this.pattern, "set", r); - let h = i[i.length - 1]; - if (!h) for (let o = i.length - 2; !h && o >= 0; o--) h = i[o]; - for (let o = 0; o < r.length; o++) { - let a = r[o], l = i; - if (s.matchBase && a.length === 1 && (l = [h]), this.matchOne(l, a, e)) return s.flipNegate ? true : !this.negate; + let s = this.options, i = this.#_(t); + if (!i) { + if (!e && !this.#h && (this.#t || this.#i) && Rs !== t) { + Rs = t; + let l = this.#l(t); + if (l === "no") return s.flipNegate ? false : this.negate; + if (l === "yes") return s.flipNegate ? true : !this.negate; + } + i = this.#b(t); + } + let r = i.parts, h = this.#e ? i.resolved ??= this.#u(r) : r, a = this.set, o = r[r.length - 1]; + if (!o) for (let l = r.length - 2; !o && l >= 0; l--) o = r[l]; + for (let l = 0; l < a.length; l++) { + let c = a[l], u = e ? void 0 : this.#d[l]; + if (u === "base" ? V(c[0], o) : u ? this.#r(h, c, u) : s.matchBase && c.length === 1 ? this.#v([o], [o], c, e) : this.#v(r, h, c, e)) return s.flipNegate ? true : !this.negate; } return s.flipNegate ? false : this.negate; } static defaults(t) { - return g.minimatch.defaults(t).Minimatch; + return w.minimatch.defaults(t).Minimatch; } }; - g.Minimatch = J; - var Zi = pe(); - Object.defineProperty(g, "AST", { enumerable: true, get: function() { - return Zi.AST; + w.Minimatch = ht; + var lr = xe(); + Object.defineProperty(w, "escape", { enumerable: true, get: function() { + return lr.escape; } }); - var Qi = me(); - Object.defineProperty(g, "escape", { enumerable: true, get: function() { - return Qi.escape; + var cr2 = Re(); + Object.defineProperty(w, "unescape", { enumerable: true, get: function() { + return cr2.unescape; } }); - var tr = kt(); - Object.defineProperty(g, "unescape", { enumerable: true, get: function() { - return tr.unescape; - } }); - g.minimatch.AST = is.AST; - g.minimatch.Minimatch = J; - g.minimatch.escape = vi.escape; - g.minimatch.unescape = Ei.unescape; + w.minimatch.Minimatch = ht; + w.minimatch.escape = tr.escape; + w.minimatch.unescape = er.unescape; }); - var fs34 = R((Wt) => { + var zs = x((Ut) => { "use strict"; - Object.defineProperty(Wt, "__esModule", { value: true }); - Wt.LRUCache = void 0; - var er = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, as = /* @__PURE__ */ new Set(), ge = typeof process == "object" && process ? process : {}, ls = (n, t, e, s) => { - typeof ge.emitWarning == "function" ? ge.emitWarning(n, t, e, s) : console.error(`[${e}] ${t}: ${n}`); - }, Lt = globalThis.AbortController, os8 = globalThis.AbortSignal; - if (typeof Lt > "u") { - os8 = class { - onabort; - _onabort = []; - reason; - aborted = false; - addEventListener(e, s) { - this._onabort.push(s); - } - }, Lt = class { - constructor() { - t(); - } - signal = new os8(); - abort(e) { - if (!this.signal.aborted) { - this.signal.reason = e, this.signal.aborted = true; - for (let s of this.signal._onabort) s(e); - this.signal.onabort?.(e); - } - } - }; - let n = ge.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1", t = () => { - n && (n = false, ls("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", t)); - }; - } - var sr = (n) => !as.has(n), V = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n), cs = (n) => V(n) ? n <= Math.pow(2, 8) ? Uint8Array : n <= Math.pow(2, 16) ? Uint16Array : n <= Math.pow(2, 32) ? Uint32Array : n <= Number.MAX_SAFE_INTEGER ? Nt : null : null, Nt = class extends Array { + var Ns = (n, t) => () => (t || n((t = { exports: {} }).exports, t), t.exports), ur = Ns((n) => { + "use strict"; + Object.defineProperty(n, "__esModule", { value: true }), n.tracing = n.metrics = void 0; + var t = require("node:diagnostics_channel"); + n.metrics = (0, t.channel)("lru-cache:metrics"), n.tracing = (0, t.tracingChannel)("lru-cache"); + }), fr = Ns((n) => { + "use strict"; + Object.defineProperty(n, "__esModule", { value: true }), n.defaultPerf = void 0, n.defaultPerf = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date; + }); + Object.defineProperty(Ut, "__esModule", { value: true }); + Ut.LRUCache = void 0; + var O = ur(), dr = fr(), Ne = () => O.metrics.hasSubscribers || O.tracing.hasSubscribers, Ls = /* @__PURE__ */ new Set(), Ds = typeof process == "object" && process ? process : {}, pr = (n, t, e, s) => { + typeof Ds.emitWarning == "function" ? Ds.emitWarning(n, t, e, s) : console.error(`[${e}] ${t}: ${n}`); + }, mr = (n) => !Ls.has(n), Z = (n) => !!n && n === Math.floor(n) && n > 0 && isFinite(n), Ws = (n) => Z(n) ? n <= Math.pow(2, 8) ? Uint8Array : n <= Math.pow(2, 16) ? Uint16Array : n <= Math.pow(2, 32) ? Uint32Array : n <= Number.MAX_SAFE_INTEGER ? It : null : null, It = class extends Array { constructor(n) { super(n), this.fill(0); } - }, ir = class at { + }, gr = class dt { heap; length; static #t = false; static create(t) { - let e = cs(t); + let e = Ws(t); if (!e) return []; - at.#t = true; - let s = new at(t, e); - return at.#t = false, s; + dt.#t = true; + let s = new dt(t, e); + return dt.#t = false, s; } constructor(t, e) { - if (!at.#t) throw new TypeError("instantiate Stack using Stack.create(n)"); + if (!dt.#t) throw new TypeError("instantiate Stack using Stack.create(n)"); this.heap = new e(t), this.length = 0; } push(t) { @@ -135801,17 +136203,17 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur pop() { return this.heap[--this.length]; } - }, rr = class us { + }, wr = class Bs { #t; - #s; - #n; - #r; + #i; + #e; #h; - #S; - #w; + #n; + #d; #c; + #p; get perf() { - return this.#c; + return this.#p; } ttl; ttlResolution; @@ -135828,253 +136230,264 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur allowStaleOnFetchAbort; allowStaleOnFetchRejection; ignoreFetchAbort; + backgroundFetchSize; #o; - #f; - #u; + #m; #a; - #i; - #d; + #l; + #r; + #w; + #_; + #b; + #u; #v; #y; - #p; - #R; - #m; - #O; - #x; - #g; - #b; #E; - #T; - #e; - #F; + #O; + #g; + #S; + #C; + #M; + #s; + #P; static unsafeExposeInternals(t) { - return { starts: t.#x, ttls: t.#g, autopurgeTimers: t.#b, sizes: t.#O, keyMap: t.#u, keyList: t.#a, valList: t.#i, next: t.#d, prev: t.#v, get head() { - return t.#y; + return { starts: t.#O, ttls: t.#g, autopurgeTimers: t.#S, sizes: t.#E, keyMap: t.#a, keyList: t.#l, valList: t.#r, next: t.#w, prev: t.#_, get head() { + return t.#b; }, get tail() { - return t.#p; - }, free: t.#R, isBackgroundFetch: (e) => t.#l(e), backgroundFetch: (e, s, i, r) => t.#z(e, s, i, r), moveToTail: (e) => t.#N(e), indexes: (e) => t.#k(e), rindexes: (e) => t.#M(e), isStale: (e) => t.#_(e) }; + return t.#u; + }, free: t.#v, isBackgroundFetch: (e) => t.#f(e), backgroundFetch: (e, s, i, r) => t.#L(e, s, i, r), moveToTail: (e) => t.#K(e), indexes: (e) => t.#x(e), rindexes: (e) => t.#R(e), isStale: (e) => t.#A(e) }; } get max() { return this.#t; } get maxSize() { - return this.#s; + return this.#i; } get calculatedSize() { - return this.#f; + return this.#m; } get size() { return this.#o; } get fetchMethod() { - return this.#S; + return this.#d; } get memoMethod() { - return this.#w; + return this.#c; } get dispose() { - return this.#n; + return this.#e; } get onInsert() { - return this.#r; - } - get disposeAfter() { return this.#h; } + get disposeAfter() { + return this.#n; + } constructor(t) { - let { max: e = 0, ttl: s, ttlResolution: i = 1, ttlAutopurge: r, updateAgeOnGet: h, updateAgeOnHas: o, allowStale: a, dispose: l, onInsert: f, disposeAfter: c, noDisposeOnSet: d, noUpdateTTL: u, maxSize: m = 0, maxEntrySize: p = 0, sizeCalculation: b, fetchMethod: w, memoMethod: v, noDeleteOnFetchRejection: E, noDeleteOnStaleGet: y, allowStaleOnFetchRejection: S, allowStaleOnFetchAbort: B, ignoreFetchAbort: U, perf: et } = t; - if (et !== void 0 && typeof et?.now != "function") throw new TypeError("perf option must have a now() method if specified"); - if (this.#c = et ?? er, e !== 0 && !V(e)) throw new TypeError("max option must be a nonnegative integer"); - let st = e ? cs(e) : Array; - if (!st) throw new Error("invalid max value: " + e); - if (this.#t = e, this.#s = m, this.maxEntrySize = p || this.#s, this.sizeCalculation = b, this.sizeCalculation) { - if (!this.#s && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize"); + let { max: e = 0, ttl: s, ttlResolution: i = 1, ttlAutopurge: r, updateAgeOnGet: h, updateAgeOnHas: a, allowStale: o, dispose: l, onInsert: c, disposeAfter: u, noDisposeOnSet: p, noUpdateTTL: d, maxSize: g = 0, maxEntrySize: f = 0, sizeCalculation: b, fetchMethod: m, memoMethod: y, noDeleteOnFetchRejection: _2, noDeleteOnStaleGet: v, allowStaleOnFetchRejection: S, allowStaleOnFetchAbort: K, ignoreFetchAbort: z, backgroundFetchSize: $ = 1, perf: nt } = t; + if (this.backgroundFetchSize = $, nt !== void 0 && typeof nt?.now != "function") throw new TypeError("perf option must have a now() method if specified"); + if (this.#p = nt ?? dr.defaultPerf, e !== 0 && !Z(e)) throw new TypeError("max option must be a nonnegative integer"); + let ge = e ? Ws(e) : Array; + if (!ge) throw new Error("invalid max value: " + e); + if (this.#t = e, this.#i = g, this.maxEntrySize = f || this.#i, this.sizeCalculation = b, this.sizeCalculation) { + if (!this.#i && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize"); if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function"); } - if (v !== void 0 && typeof v != "function") throw new TypeError("memoMethod must be a function if defined"); - if (this.#w = v, w !== void 0 && typeof w != "function") throw new TypeError("fetchMethod must be a function if specified"); - if (this.#S = w, this.#T = !!w, this.#u = /* @__PURE__ */ new Map(), this.#a = new Array(e).fill(void 0), this.#i = new Array(e).fill(void 0), this.#d = new st(e), this.#v = new st(e), this.#y = 0, this.#p = 0, this.#R = ir.create(e), this.#o = 0, this.#f = 0, typeof l == "function" && (this.#n = l), typeof f == "function" && (this.#r = f), typeof c == "function" ? (this.#h = c, this.#m = []) : (this.#h = void 0, this.#m = void 0), this.#E = !!this.#n, this.#F = !!this.#r, this.#e = !!this.#h, this.noDisposeOnSet = !!d, this.noUpdateTTL = !!u, this.noDeleteOnFetchRejection = !!E, this.allowStaleOnFetchRejection = !!S, this.allowStaleOnFetchAbort = !!B, this.ignoreFetchAbort = !!U, this.maxEntrySize !== 0) { - if (this.#s !== 0 && !V(this.#s)) throw new TypeError("maxSize must be a positive integer if specified"); - if (!V(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified"); + if (y !== void 0 && typeof y != "function") throw new TypeError("memoMethod must be a function if defined"); + if (this.#c = y, m !== void 0 && typeof m != "function") throw new TypeError("fetchMethod must be a function if specified"); + if (this.#d = m, this.#M = !!m, this.#a = /* @__PURE__ */ new Map(), this.#l = Array.from({ length: e }).fill(void 0), this.#r = Array.from({ length: e }).fill(void 0), this.#w = new ge(e), this.#_ = new ge(e), this.#b = 0, this.#u = 0, this.#v = gr.create(e), this.#o = 0, this.#m = 0, typeof l == "function" && (this.#e = l), typeof c == "function" && (this.#h = c), typeof u == "function" ? (this.#n = u, this.#y = []) : (this.#n = void 0, this.#y = void 0), this.#C = !!this.#e, this.#P = !!this.#h, this.#s = !!this.#n, this.noDisposeOnSet = !!p, this.noUpdateTTL = !!d, this.noDeleteOnFetchRejection = !!_2, this.allowStaleOnFetchRejection = !!S, this.allowStaleOnFetchAbort = !!K, this.ignoreFetchAbort = !!z, this.maxEntrySize !== 0) { + if (this.#i !== 0 && !Z(this.#i)) throw new TypeError("maxSize must be a positive integer if specified"); + if (!Z(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified"); this.#$(); } - if (this.allowStale = !!a, this.noDeleteOnStaleGet = !!y, this.updateAgeOnGet = !!h, this.updateAgeOnHas = !!o, this.ttlResolution = V(i) || i === 0 ? i : 1, this.ttlAutopurge = !!r, this.ttl = s || 0, this.ttl) { - if (!V(this.ttl)) throw new TypeError("ttl must be a positive integer if specified"); - this.#P(); + if (this.allowStale = !!o, this.noDeleteOnStaleGet = !!v, this.updateAgeOnGet = !!h, this.updateAgeOnHas = !!a, this.ttlResolution = Z(i) || i === 0 ? i : 1, this.ttlAutopurge = !!r, this.ttl = s || 0, this.ttl) { + if (!Z(this.ttl)) throw new TypeError("ttl must be a positive integer if specified"); + this.#T(); } - if (this.#t === 0 && this.ttl === 0 && this.#s === 0) throw new TypeError("At least one of max, maxSize, or ttl is required"); - if (!this.ttlAutopurge && !this.#t && !this.#s) { - let le = "LRU_CACHE_UNBOUNDED"; - sr(le) && (as.add(le), ls("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", le, us)); + if (this.#t === 0 && this.ttl === 0 && this.#i === 0) throw new TypeError("At least one of max, maxSize, or ttl is required"); + if (!this.ttlAutopurge && !this.#t && !this.#i) { + let we = "LRU_CACHE_UNBOUNDED"; + mr(we) && (Ls.add(we), pr("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", we, Bs)); } } getRemainingTTL(t) { - return this.#u.has(t) ? 1 / 0 : 0; + return this.#a.has(t) ? 1 / 0 : 0; } - #P() { - let t = new Nt(this.#t), e = new Nt(this.#t); - this.#g = t, this.#x = e; - let s = this.ttlAutopurge ? new Array(this.#t) : void 0; - this.#b = s, this.#W = (h, o, a = this.#c.now()) => { - if (e[h] = o !== 0 ? a : 0, t[h] = o, s?.[h] && (clearTimeout(s[h]), s[h] = void 0), o !== 0 && s) { - let l = setTimeout(() => { - this.#_(h) && this.#A(this.#a[h], "expire"); - }, o + 1); - l.unref && l.unref(), s[h] = l; + #T() { + let t = new It(this.#t), e = new It(this.#t); + this.#g = t, this.#O = e; + let s = this.ttlAutopurge ? Array.from({ length: this.#t }) : void 0; + this.#S = s, this.#B = (o, l, c = this.#p.now()) => { + e[o] = l !== 0 ? c : 0, t[o] = l, i(o, l); + }, this.#k = (o) => { + e[o] = t[o] !== 0 ? this.#p.now() : 0, i(o, t[o]); + }; + let i = this.ttlAutopurge ? (o, l) => { + if (s?.[o] && (clearTimeout(s[o]), s[o] = void 0), l && l !== 0 && s) { + let c = setTimeout(() => { + this.#A(o) ? (this.#W(this.#l[o], "expire"), s[o] = void 0) : i(o, a(o)); + }, l + 1); + c.unref && c.unref(), s[o] = c; } - }, this.#C = (h) => { - e[h] = t[h] !== 0 ? this.#c.now() : 0; - }, this.#D = (h, o) => { - if (t[o]) { - let a = t[o], l = e[o]; - if (!a || !l) return; - h.ttl = a, h.start = l, h.now = i || r(); - let f = h.now - l; - h.remainingTTL = a - f; + } : () => { + }; + this.#F = (o, l) => { + if (t[l]) { + let c = t[l], u = e[l]; + if (!c || !u) return; + o.ttl = c, o.start = u, o.now = r || h(); + let p = o.now - u; + o.remainingTTL = c - p; } }; - let i = 0, r = () => { - let h = this.#c.now(); + let r = 0, h = () => { + let o = this.#p.now(); if (this.ttlResolution > 0) { - i = h; - let o = setTimeout(() => i = 0, this.ttlResolution); - o.unref && o.unref(); + r = o; + let l = setTimeout(() => r = 0, this.ttlResolution); + l.unref && l.unref(); } - return h; + return o; }; - this.getRemainingTTL = (h) => { - let o = this.#u.get(h); - if (o === void 0) return 0; - let a = t[o], l = e[o]; - if (!a || !l) return 1 / 0; - let f = (i || r()) - l; - return a - f; - }, this.#_ = (h) => { - let o = e[h], a = t[h]; - return !!a && !!o && (i || r()) - o > a; + this.getRemainingTTL = (o) => { + let l = this.#a.get(o); + return l === void 0 ? 0 : a(l); + }; + let a = (o) => { + let l = t[o], c = e[o]; + if (!l || !c) return 1 / 0; + let u = (r || h()) - c; + return l - u; + }; + this.#A = (o) => { + let l = e[o], c = t[o]; + return !!c && !!l && (r || h()) - l > c; }; } - #C = () => { + #k = () => { }; - #D = () => { + #F = () => { }; - #W = () => { + #B = () => { }; - #_ = () => false; + #A = () => false; #$() { - let t = new Nt(this.#t); - this.#f = 0, this.#O = t, this.#L = (e) => { - this.#f -= t[e], t[e] = 0; - }, this.#B = (e, s, i, r) => { - if (this.#l(s)) return 0; - if (!V(i)) if (r) { - if (typeof r != "function") throw new TypeError("sizeCalculation must be a function"); - if (i = r(s, e), !V(i)) throw new TypeError("sizeCalculation return invalid (expect positive integer)"); - } else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set."); + let t = new It(this.#t); + this.#m = 0, this.#E = t, this.#D = (e) => { + this.#m -= t[e], t[e] = 0; + }, this.#z = (e, s, i, r) => { + if (!Z(i)) { + if (this.#f(s)) return this.backgroundFetchSize; + if (r) { + if (typeof r != "function") throw new TypeError("sizeCalculation must be a function"); + if (i = r(s, e), !Z(i)) throw new TypeError("sizeCalculation return invalid (expect positive integer)"); + } else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set."); + } return i; }, this.#j = (e, s, i) => { - if (t[e] = s, this.#s) { - let r = this.#s - t[e]; - for (; this.#f > r; ) this.#G(true); + if (t[e] = s, this.#i) { + let r = this.#i - t[e]; + for (; this.#m > r; ) this.#U(true); } - this.#f += t[e], i && (i.entrySize = s, i.totalCalculatedSize = this.#f); + this.#m += t[e], i && (i.entrySize = s, i.totalCalculatedSize = this.#m); }; } - #L = (t) => { + #D = (t) => { }; #j = (t, e, s) => { }; - #B = (t, e, s, i) => { + #z = (t, e, s, i) => { if (s || i) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache"); return 0; }; - *#k({ allowStale: t = this.allowStale } = {}) { - if (this.#o) for (let e = this.#p; !(!this.#I(e) || ((t || !this.#_(e)) && (yield e), e === this.#y)); ) e = this.#v[e]; + *#x({ allowStale: t = this.allowStale } = {}) { + if (this.#o) for (let e = this.#u; this.#G(e) && ((t || !this.#A(e)) && (yield e), e !== this.#b); ) e = this.#_[e]; } - *#M({ allowStale: t = this.allowStale } = {}) { - if (this.#o) for (let e = this.#y; !(!this.#I(e) || ((t || !this.#_(e)) && (yield e), e === this.#p)); ) e = this.#d[e]; + *#R({ allowStale: t = this.allowStale } = {}) { + if (this.#o) for (let e = this.#b; this.#G(e) && ((t || !this.#A(e)) && (yield e), e !== this.#u); ) e = this.#w[e]; } - #I(t) { - return t !== void 0 && this.#u.get(this.#a[t]) === t; + #G(t) { + return t !== void 0 && this.#a.get(this.#l[t]) === t; } *entries() { - for (let t of this.#k()) this.#i[t] !== void 0 && this.#a[t] !== void 0 && !this.#l(this.#i[t]) && (yield [this.#a[t], this.#i[t]]); + for (let t of this.#x()) this.#r[t] !== void 0 && this.#l[t] !== void 0 && !this.#f(this.#r[t]) && (yield [this.#l[t], this.#r[t]]); } *rentries() { - for (let t of this.#M()) this.#i[t] !== void 0 && this.#a[t] !== void 0 && !this.#l(this.#i[t]) && (yield [this.#a[t], this.#i[t]]); + for (let t of this.#R()) this.#r[t] !== void 0 && this.#l[t] !== void 0 && !this.#f(this.#r[t]) && (yield [this.#l[t], this.#r[t]]); } *keys() { - for (let t of this.#k()) { - let e = this.#a[t]; - e !== void 0 && !this.#l(this.#i[t]) && (yield e); + for (let t of this.#x()) { + let e = this.#l[t]; + e !== void 0 && !this.#f(this.#r[t]) && (yield e); } } *rkeys() { - for (let t of this.#M()) { - let e = this.#a[t]; - e !== void 0 && !this.#l(this.#i[t]) && (yield e); + for (let t of this.#R()) { + let e = this.#l[t]; + e !== void 0 && !this.#f(this.#r[t]) && (yield e); } } *values() { - for (let t of this.#k()) this.#i[t] !== void 0 && !this.#l(this.#i[t]) && (yield this.#i[t]); + for (let t of this.#x()) this.#r[t] !== void 0 && !this.#f(this.#r[t]) && (yield this.#r[t]); } *rvalues() { - for (let t of this.#M()) this.#i[t] !== void 0 && !this.#l(this.#i[t]) && (yield this.#i[t]); + for (let t of this.#R()) this.#r[t] !== void 0 && !this.#f(this.#r[t]) && (yield this.#r[t]); } [Symbol.iterator]() { return this.entries(); } [Symbol.toStringTag] = "LRUCache"; find(t, e = {}) { - for (let s of this.#k()) { - let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i; - if (r !== void 0 && t(r, this.#a[s], this)) return this.get(this.#a[s], e); + for (let s of this.#x()) { + let i = this.#r[s], r = this.#f(i) ? i.__staleWhileFetching : i; + if (r !== void 0 && t(r, this.#l[s], this)) return this.#X(this.#l[s], e); } } forEach(t, e = this) { - for (let s of this.#k()) { - let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i; - r !== void 0 && t.call(e, r, this.#a[s], this); + for (let s of this.#x()) { + let i = this.#r[s], r = this.#f(i) ? i.__staleWhileFetching : i; + r !== void 0 && t.call(e, r, this.#l[s], this); } } rforEach(t, e = this) { - for (let s of this.#M()) { - let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i; - r !== void 0 && t.call(e, r, this.#a[s], this); + for (let s of this.#R()) { + let i = this.#r[s], r = this.#f(i) ? i.__staleWhileFetching : i; + r !== void 0 && t.call(e, r, this.#l[s], this); } } purgeStale() { let t = false; - for (let e of this.#M({ allowStale: true })) this.#_(e) && (this.#A(this.#a[e], "expire"), t = true); + for (let e of this.#R({ allowStale: true })) this.#A(e) && (this.#W(this.#l[e], "expire"), t = true); return t; } info(t) { - let e = this.#u.get(t); + let e = this.#a.get(t); if (e === void 0) return; - let s = this.#i[e], i = this.#l(s) ? s.__staleWhileFetching : s; + let s = this.#r[e], i = this.#f(s) ? s.__staleWhileFetching : s; if (i === void 0) return; let r = { value: i }; - if (this.#g && this.#x) { - let h = this.#g[e], o = this.#x[e]; - if (h && o) { - let a = h - (this.#c.now() - o); - r.ttl = a, r.start = Date.now(); + if (this.#g && this.#O) { + let h = this.#g[e], a = this.#O[e]; + if (h && a) { + let o = h - (this.#p.now() - a); + r.ttl = o, r.start = Date.now(); } } - return this.#O && (r.size = this.#O[e]), r; + return this.#E && (r.size = this.#E[e]), r; } dump() { let t = []; - for (let e of this.#k({ allowStale: true })) { - let s = this.#a[e], i = this.#i[e], r = this.#l(i) ? i.__staleWhileFetching : i; + for (let e of this.#x({ allowStale: true })) { + let s = this.#l[e], i = this.#r[e], r = this.#f(i) ? i.__staleWhileFetching : i; if (r === void 0 || s === void 0) continue; let h = { value: r }; - if (this.#g && this.#x) { + if (this.#g && this.#O) { h.ttl = this.#g[e]; - let o = this.#c.now() - this.#x[e]; - h.start = Math.floor(Date.now() - o); + let a = this.#p.now() - this.#O[e]; + h.start = Math.floor(Date.now() - a); } - this.#O && (h.size = this.#O[e]), t.unshift([s, h]); + this.#E && (h.size = this.#E[e]), t.unshift([s, h]); } return t; } @@ -136083,223 +136496,278 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur for (let [e, s] of t) { if (s.start) { let i = Date.now() - s.start; - s.start = this.#c.now() - i; + s.start = this.#p.now() - i; } - this.set(e, s.value, s); + this.#N(e, s.value, s); } } set(t, e, s = {}) { - if (e === void 0) return this.delete(t), this; - let { ttl: i = this.ttl, start: r, noDisposeOnSet: h = this.noDisposeOnSet, sizeCalculation: o = this.sizeCalculation, status: a } = s, { noUpdateTTL: l = this.noUpdateTTL } = s, f = this.#B(t, e, s.size || 0, o); - if (this.maxEntrySize && f > this.maxEntrySize) return a && (a.set = "miss", a.maxEntrySizeExceeded = true), this.#A(t, "set"), this; - let c = this.#o === 0 ? void 0 : this.#u.get(t); - if (c === void 0) c = this.#o === 0 ? this.#p : this.#R.length !== 0 ? this.#R.pop() : this.#o === this.#t ? this.#G(false) : this.#o, this.#a[c] = t, this.#i[c] = e, this.#u.set(t, c), this.#d[this.#p] = c, this.#v[c] = this.#p, this.#p = c, this.#o++, this.#j(c, f, a), a && (a.set = "add"), l = false, this.#F && this.#r?.(e, t, "add"); + let { status: i = O.metrics.hasSubscribers ? {} : void 0 } = s; + s.status = i, i && (i.op = "set", i.key = t, e !== void 0 && (i.value = e), i.cache = this); + let r = this.#N(t, e, s); + return i && O.metrics.hasSubscribers && O.metrics.publish(i), r; + } + #N(t, e, s, i) { + let { ttl: r = this.ttl, start: h, noDisposeOnSet: a = this.noDisposeOnSet, sizeCalculation: o = this.sizeCalculation, status: l } = s, c = this.#f(e); + if (e === void 0) return l && (l.set = "deleted"), this.delete(t), this; + let { noUpdateTTL: u = this.noUpdateTTL } = s; + l && !c && (l.value = e); + let p = this.#z(t, e, s.size || 0, o, l); + if (this.maxEntrySize && p > this.maxEntrySize) return this.#W(t, "set"), l && (l.set = "miss", l.maxEntrySizeExceeded = true), this; + let d = this.#o === 0 ? void 0 : this.#a.get(t); + if (d === void 0) d = this.#o === 0 ? this.#u : this.#v.length !== 0 ? this.#v.pop() : this.#o === this.#t ? this.#U(false) : this.#o, this.#l[d] = t, this.#r[d] = e, this.#a.set(t, d), this.#w[this.#u] = d, this.#_[d] = this.#u, this.#u = d, this.#o++, this.#j(d, p, l), l && (l.set = "add"), u = false, this.#P && !c && this.#h?.(e, t, "add"); else { - this.#N(c); - let d = this.#i[c]; - if (e !== d) { - if (this.#T && this.#l(d)) { - d.__abortController.abort(new Error("replaced")); - let { __staleWhileFetching: u } = d; - u !== void 0 && !h && (this.#E && this.#n?.(u, t, "set"), this.#e && this.#m?.push([u, t, "set"])); - } else h || (this.#E && this.#n?.(d, t, "set"), this.#e && this.#m?.push([d, t, "set"])); - if (this.#L(c), this.#j(c, f, a), this.#i[c] = e, a) { - a.set = "replace"; - let u = d && this.#l(d) ? d.__staleWhileFetching : d; - u !== void 0 && (a.oldValue = u); + this.#K(d); + let g = this.#r[d]; + if (e !== g) { + if (!a) if (this.#f(g)) { + g !== i && g.__abortController.abort(new Error("replaced")); + let { __staleWhileFetching: f } = g; + f !== void 0 && f !== e && (this.#C && this.#e?.(f, t, "set"), this.#s && this.#y?.push([f, t, "set"])); + } else this.#C && this.#e?.(g, t, "set"), this.#s && this.#y?.push([g, t, "set"]); + if (this.#D(d), this.#j(d, p, l), this.#r[d] = e, !c) { + let f = g && this.#f(g) ? g.__staleWhileFetching : g, b = f === void 0 ? "add" : e !== f ? "replace" : "update"; + l && (l.set = b, f !== void 0 && (l.oldValue = f)), this.#P && this.onInsert?.(e, t, b); } - } else a && (a.set = "update"); - this.#F && this.onInsert?.(e, t, e === d ? "update" : "replace"); + } else c || (l && (l.set = "update"), this.#P && this.onInsert?.(e, t, "update")); } - if (i !== 0 && !this.#g && this.#P(), this.#g && (l || this.#W(c, i, r), a && this.#D(a, c)), !h && this.#e && this.#m) { - let d = this.#m, u; - for (; u = d?.shift(); ) this.#h?.(...u); + if (r !== 0 && !this.#g && this.#T(), this.#g && (u || this.#B(d, r, h), l && this.#F(l, d)), !a && this.#s && this.#y) { + let g = this.#y, f; + for (; f = g?.shift(); ) this.#n?.(...f); } return this; } pop() { try { for (; this.#o; ) { - let t = this.#i[this.#y]; - if (this.#G(true), this.#l(t)) { + let t = this.#r[this.#b]; + if (this.#U(true), this.#f(t)) { if (t.__staleWhileFetching) return t.__staleWhileFetching; } else if (t !== void 0) return t; } } finally { - if (this.#e && this.#m) { - let t = this.#m, e; - for (; e = t?.shift(); ) this.#h?.(...e); + if (this.#s && this.#y) { + let t = this.#y, e; + for (; e = t?.shift(); ) this.#n?.(...e); } } } - #G(t) { - let e = this.#y, s = this.#a[e], i = this.#i[e]; - return this.#T && this.#l(i) ? i.__abortController.abort(new Error("evicted")) : (this.#E || this.#e) && (this.#E && this.#n?.(i, s, "evict"), this.#e && this.#m?.push([i, s, "evict"])), this.#L(e), this.#b?.[e] && (clearTimeout(this.#b[e]), this.#b[e] = void 0), t && (this.#a[e] = void 0, this.#i[e] = void 0, this.#R.push(e)), this.#o === 1 ? (this.#y = this.#p = 0, this.#R.length = 0) : this.#y = this.#d[e], this.#u.delete(s), this.#o--, e; + #U(t) { + let e = this.#b, s = this.#l[e], i = this.#r[e], r = this.#f(i); + r && i.__abortController.abort(new Error("evicted")); + let h = r ? i.__staleWhileFetching : i; + return (this.#C || this.#s) && h !== void 0 && (this.#C && this.#e?.(h, s, "evict"), this.#s && this.#y?.push([h, s, "evict"])), this.#D(e), this.#S?.[e] && (clearTimeout(this.#S[e]), this.#S[e] = void 0), t && (this.#l[e] = void 0, this.#r[e] = void 0, this.#v.push(e)), this.#o === 1 ? (this.#b = this.#u = 0, this.#v.length = 0) : this.#b = this.#w[e], this.#a.delete(s), this.#o--, e; } has(t, e = {}) { - let { updateAgeOnHas: s = this.updateAgeOnHas, status: i } = e, r = this.#u.get(t); + let { status: s = O.metrics.hasSubscribers ? {} : void 0 } = e; + e.status = s, s && (s.op = "has", s.key = t, s.cache = this); + let i = this.#V(t, e); + return O.metrics.hasSubscribers && O.metrics.publish(s), i; + } + #V(t, e = {}) { + let { updateAgeOnHas: s = this.updateAgeOnHas, status: i } = e, r = this.#a.get(t); if (r !== void 0) { - let h = this.#i[r]; - if (this.#l(h) && h.__staleWhileFetching === void 0) return false; - if (this.#_(r)) i && (i.has = "stale", this.#D(i, r)); - else return s && this.#C(r), i && (i.has = "hit", this.#D(i, r)), true; + let h = this.#r[r]; + if (this.#f(h) && h.__staleWhileFetching === void 0) return false; + if (this.#A(r)) i && (i.has = "stale", this.#F(i, r)); + else return s && this.#k(r), i && (i.has = "hit", this.#F(i, r)), true; } else i && (i.has = "miss"); return false; } peek(t, e = {}) { - let { allowStale: s = this.allowStale } = e, i = this.#u.get(t); - if (i === void 0 || !s && this.#_(i)) return; - let r = this.#i[i]; - return this.#l(r) ? r.__staleWhileFetching : r; + let { status: s = Ne() ? {} : void 0 } = e; + s && (s.op = "peek", s.key = t, s.cache = this), e.status = s; + let i = this.#q(t, e); + return O.metrics.hasSubscribers && O.metrics.publish(s), i; } - #z(t, e, s, i) { - let r = e === void 0 ? void 0 : this.#i[e]; - if (this.#l(r)) return r; - let h = new Lt(), { signal: o } = s; - o?.addEventListener("abort", () => h.abort(o.reason), { signal: h.signal }); - let a = { signal: h.signal, options: s, context: i }, l = (p, b = false) => { - let { aborted: w } = h.signal, v = s.ignoreFetchAbort && p !== void 0, E = s.ignoreFetchAbort || !!(s.allowStaleOnFetchAbort && p !== void 0); - if (s.status && (w && !b ? (s.status.fetchAborted = true, s.status.fetchError = h.signal.reason, v && (s.status.fetchAbortIgnored = true)) : s.status.fetchResolved = true), w && !v && !b) return c(h.signal.reason, E); - let y = u, S = this.#i[e]; - return (S === u || v && b && S === void 0) && (p === void 0 ? y.__staleWhileFetching !== void 0 ? this.#i[e] = y.__staleWhileFetching : this.#A(t, "fetch") : (s.status && (s.status.fetchUpdated = true), this.set(t, p, a.options))), p; - }, f = (p) => (s.status && (s.status.fetchRejected = true, s.status.fetchError = p), c(p, false)), c = (p, b) => { - let { aborted: w } = h.signal, v = w && s.allowStaleOnFetchAbort, E = v || s.allowStaleOnFetchRejection, y = E || s.noDeleteOnFetchRejection, S = u; - if (this.#i[e] === u && (!y || !b && S.__staleWhileFetching === void 0 ? this.#A(t, "fetch") : v || (this.#i[e] = S.__staleWhileFetching)), E) return s.status && S.__staleWhileFetching !== void 0 && (s.status.returnedStale = true), S.__staleWhileFetching; - if (S.__returned === S) throw p; - }, d = (p, b) => { - let w = this.#S?.(t, r, a); - w && w instanceof Promise && w.then((v) => p(v === void 0 ? void 0 : v), b), h.signal.addEventListener("abort", () => { - (!s.ignoreFetchAbort || s.allowStaleOnFetchAbort) && (p(void 0), s.allowStaleOnFetchAbort && (p = (v) => l(v, true))); - }); + #q(t, e) { + let { status: s, allowStale: i = this.allowStale } = e, r = this.#a.get(t); + if (r === void 0 || !i && this.#A(r)) { + s && (s.peek = r === void 0 ? "miss" : "stale"); + return; + } + let h = this.#r[r], a = this.#f(h) ? h.__staleWhileFetching : h; + return s && (a !== void 0 ? (s.peek = "hit", s.value = a) : s.peek = "miss"), a; + } + #L(t, e, s, i) { + let r = e === void 0 ? void 0 : this.#r[e]; + if (this.#f(r)) return r; + let h = new AbortController(), { signal: a } = s; + a?.addEventListener("abort", () => h.abort(a.reason), { signal: h.signal }); + let o = { signal: h.signal, options: s, context: i }, l = (f, b = false) => { + let { aborted: m } = h.signal, y = s.ignoreFetchAbort && f !== void 0, _2 = s.ignoreFetchAbort || !!(s.allowStaleOnFetchAbort && f !== void 0); + if (s.status && (m && !b ? (s.status.fetchAborted = true, s.status.fetchError = h.signal.reason, y && (s.status.fetchAbortIgnored = true)) : s.status.fetchResolved = true), m && !y && !b) return u(h.signal.reason, _2); + let v = d, S = this.#r[e]; + return (S === d || S === void 0 && y && b) && (f === void 0 ? v.__staleWhileFetching !== void 0 ? this.#r[e] = v.__staleWhileFetching : this.#W(t, "fetch") : (s.status && (s.status.fetchUpdated = true), this.#N(t, f, o.options, v))), f; + }, c = (f) => (s.status && (s.status.fetchRejected = true, s.status.fetchError = f), u(f, false)), u = (f, b) => { + let { aborted: m } = h.signal, y = m && s.allowStaleOnFetchAbort, _2 = y || s.allowStaleOnFetchRejection, v = _2 || s.noDeleteOnFetchRejection, S = d; + if (this.#r[e] === d && (!v || !b && S.__staleWhileFetching === void 0 ? this.#W(t, "fetch") : y || (this.#r[e] = S.__staleWhileFetching)), _2) return s.status && S.__staleWhileFetching !== void 0 && (s.status.returnedStale = true), S.__staleWhileFetching; + if (S.__returned === S) throw f; + }, p = (f, b) => { + let m = this.#d?.(t, r, o); + h.signal.addEventListener("abort", () => { + (!s.ignoreFetchAbort || s.allowStaleOnFetchAbort) && (f(void 0), s.allowStaleOnFetchAbort && (f = (y) => l(y, true))); + }), m && m instanceof Promise ? m.then((y) => f(y === void 0 ? void 0 : y), b) : m !== void 0 && f(m); }; s.status && (s.status.fetchDispatched = true); - let u = new Promise(d).then(l, f), m = Object.assign(u, { __abortController: h, __staleWhileFetching: r, __returned: void 0 }); - return e === void 0 ? (this.set(t, m, { ...a.options, status: void 0 }), e = this.#u.get(t)) : this.#i[e] = m, m; + let d = new Promise(p).then(l, c), g = Object.assign(d, { __abortController: h, __staleWhileFetching: r, __returned: void 0 }); + return e === void 0 ? (this.#N(t, g, { ...o.options, status: void 0 }), e = this.#a.get(t)) : this.#r[e] = g, g; } - #l(t) { - if (!this.#T) return false; + #f(t) { + if (!this.#M) return false; let e = t; - return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof Lt; + return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof AbortController; } - async fetch(t, e = {}) { - let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: r = this.noDeleteOnStaleGet, ttl: h = this.ttl, noDisposeOnSet: o = this.noDisposeOnSet, size: a = 0, sizeCalculation: l = this.sizeCalculation, noUpdateTTL: f = this.noUpdateTTL, noDeleteOnFetchRejection: c = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: d = this.allowStaleOnFetchRejection, ignoreFetchAbort: u = this.ignoreFetchAbort, allowStaleOnFetchAbort: m = this.allowStaleOnFetchAbort, context: p, forceRefresh: b = false, status: w, signal: v } = e; - if (!this.#T) return w && (w.fetch = "get"), this.get(t, { allowStale: s, updateAgeOnGet: i, noDeleteOnStaleGet: r, status: w }); - let E = { allowStale: s, updateAgeOnGet: i, noDeleteOnStaleGet: r, ttl: h, noDisposeOnSet: o, size: a, sizeCalculation: l, noUpdateTTL: f, noDeleteOnFetchRejection: c, allowStaleOnFetchRejection: d, allowStaleOnFetchAbort: m, ignoreFetchAbort: u, status: w, signal: v }, y = this.#u.get(t); - if (y === void 0) { - w && (w.fetch = "miss"); - let S = this.#z(t, y, E, p); + fetch(t, e = {}) { + let s = O.tracing.hasSubscribers, { status: i = Ne() ? {} : void 0 } = e; + e.status = i, i && e.context && (i.context = e.context); + let r = this.#H(t, e); + return i && s && (i.trace = true, O.tracing.tracePromise(() => r, i).catch(() => { + })), r; + } + async #H(t, e = {}) { + let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: r = this.noDeleteOnStaleGet, ttl: h = this.ttl, noDisposeOnSet: a = this.noDisposeOnSet, size: o = 0, sizeCalculation: l = this.sizeCalculation, noUpdateTTL: c = this.noUpdateTTL, noDeleteOnFetchRejection: u = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: p = this.allowStaleOnFetchRejection, ignoreFetchAbort: d = this.ignoreFetchAbort, allowStaleOnFetchAbort: g = this.allowStaleOnFetchAbort, context: f, forceRefresh: b = false, status: m, signal: y } = e; + if (m && (m.op = "fetch", m.key = t, b && (m.forceRefresh = true), m.cache = this), !this.#M) return m && (m.fetch = "get"), this.#X(t, { allowStale: s, updateAgeOnGet: i, noDeleteOnStaleGet: r, status: m }); + let _2 = { allowStale: s, updateAgeOnGet: i, noDeleteOnStaleGet: r, ttl: h, noDisposeOnSet: a, size: o, sizeCalculation: l, noUpdateTTL: c, noDeleteOnFetchRejection: u, allowStaleOnFetchRejection: p, allowStaleOnFetchAbort: g, ignoreFetchAbort: d, status: m, signal: y }, v = this.#a.get(t); + if (v === void 0) { + m && (m.fetch = "miss"); + let S = this.#L(t, v, _2, f); return S.__returned = S; } else { - let S = this.#i[y]; - if (this.#l(S)) { - let st = s && S.__staleWhileFetching !== void 0; - return w && (w.fetch = "inflight", st && (w.returnedStale = true)), st ? S.__staleWhileFetching : S.__returned = S; + let S = this.#r[v]; + if (this.#f(S)) { + let nt = s && S.__staleWhileFetching !== void 0; + return m && (m.fetch = "inflight", nt && (m.returnedStale = true)), nt ? S.__staleWhileFetching : S.__returned = S; } - let B = this.#_(y); - if (!b && !B) return w && (w.fetch = "hit"), this.#N(y), i && this.#C(y), w && this.#D(w, y), S; - let U = this.#z(t, y, E, p), et = U.__staleWhileFetching !== void 0 && s; - return w && (w.fetch = B ? "stale" : "refresh", et && B && (w.returnedStale = true)), et ? U.__staleWhileFetching : U.__returned = U; + let K = this.#A(v); + if (!b && !K) return m && (m.fetch = "hit"), this.#K(v), i && this.#k(v), m && this.#F(m, v), S; + let z = this.#L(t, v, _2, f), $ = z.__staleWhileFetching !== void 0 && s; + return m && (m.fetch = K ? "stale" : "refresh", $ && K && (m.returnedStale = true)), $ ? z.__staleWhileFetching : z.__returned = z; } } - async forceFetch(t, e = {}) { - let s = await this.fetch(t, e); + forceFetch(t, e = {}) { + let s = O.tracing.hasSubscribers, { status: i = Ne() ? {} : void 0 } = e; + e.status = i, i && e.context && (i.context = e.context); + let r = this.#I(t, e); + return i && s && (i.trace = true, O.tracing.tracePromise(() => r, i).catch(() => { + })), r; + } + async #I(t, e = {}) { + let s = await this.#H(t, e); if (s === void 0) throw new Error("fetch() returned undefined"); return s; } memo(t, e = {}) { - let s = this.#w; + let { status: s = O.metrics.hasSubscribers ? {} : void 0 } = e; + e.status = s, s && (s.op = "memo", s.key = t, e.context && (s.context = e.context), s.cache = this); + let i = this.#J(t, e); + return s && (s.value = i), O.metrics.hasSubscribers && O.metrics.publish(s), i; + } + #J(t, e = {}) { + let s = this.#c; if (!s) throw new Error("no memoMethod provided to constructor"); - let { context: i, forceRefresh: r, ...h } = e, o = this.get(t, h); - if (!r && o !== void 0) return o; - let a = s(t, o, { options: h, context: i }); - return this.set(t, a, h), a; + let { context: i, status: r, forceRefresh: h, ...a } = e; + r && h && (r.forceRefresh = true); + let o = this.#X(t, a), l = h || o === void 0; + if (r && (r.memo = l ? "miss" : "hit", l || (r.value = o)), !l) return o; + let c = s(t, o, { options: a, context: i }); + return r && (r.value = c), this.#N(t, c, a), c; } get(t, e = {}) { - let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: r = this.noDeleteOnStaleGet, status: h } = e, o = this.#u.get(t); - if (o !== void 0) { - let a = this.#i[o], l = this.#l(a); - return h && this.#D(h, o), this.#_(o) ? (h && (h.get = "stale"), l ? (h && s && a.__staleWhileFetching !== void 0 && (h.returnedStale = true), s ? a.__staleWhileFetching : void 0) : (r || this.#A(t, "expire"), h && s && (h.returnedStale = true), s ? a : void 0)) : (h && (h.get = "hit"), l ? a.__staleWhileFetching : (this.#N(o), i && this.#C(o), a)); - } else h && (h.get = "miss"); + let { status: s = O.metrics.hasSubscribers ? {} : void 0 } = e; + e.status = s, s && (s.op = "get", s.key = t, s.cache = this); + let i = this.#X(t, e); + return s && (i !== void 0 && (s.value = i), O.metrics.hasSubscribers && O.metrics.publish(s)), i; } - #U(t, e) { - this.#v[e] = t, this.#d[t] = e; + #X(t, e = {}) { + let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: r = this.noDeleteOnStaleGet, status: h } = e, a = this.#a.get(t); + if (a === void 0) { + h && (h.get = "miss"); + return; + } + let o = this.#r[a], l = this.#f(o); + return h && this.#F(h, a), this.#A(a) ? l ? (h && (h.get = "stale-fetching"), s && o.__staleWhileFetching !== void 0 ? (h && (h.returnedStale = true), o.__staleWhileFetching) : void 0) : (r || this.#W(t, "expire"), h && (h.get = "stale"), s ? (h && (h.returnedStale = true), o) : void 0) : (h && (h.get = l ? "fetching" : "hit"), this.#K(a), i && this.#k(a), l ? o.__staleWhileFetching : o); } - #N(t) { - t !== this.#p && (t === this.#y ? this.#y = this.#d[t] : this.#U(this.#v[t], this.#d[t]), this.#U(this.#p, t), this.#p = t); + #Y(t, e) { + this.#_[e] = t, this.#w[t] = e; + } + #K(t) { + t !== this.#u && (t === this.#b ? this.#b = this.#w[t] : this.#Y(this.#_[t], this.#w[t]), this.#Y(this.#u, t), this.#u = t); } delete(t) { - return this.#A(t, "delete"); + return this.#W(t, "delete"); } - #A(t, e) { + #W(t, e) { + O.metrics.hasSubscribers && O.metrics.publish({ op: "delete", delete: e, key: t, cache: this }); let s = false; if (this.#o !== 0) { - let i = this.#u.get(t); - if (i !== void 0) if (this.#b?.[i] && (clearTimeout(this.#b?.[i]), this.#b[i] = void 0), s = true, this.#o === 1) this.#q(e); + let i = this.#a.get(t); + if (i !== void 0) if (this.#S?.[i] && (clearTimeout(this.#S[i]), this.#S[i] = void 0), s = true, this.#o === 1) this.#Z(e); else { - this.#L(i); - let r = this.#i[i]; - if (this.#l(r) ? r.__abortController.abort(new Error("deleted")) : (this.#E || this.#e) && (this.#E && this.#n?.(r, t, e), this.#e && this.#m?.push([r, t, e])), this.#u.delete(t), this.#a[i] = void 0, this.#i[i] = void 0, i === this.#p) this.#p = this.#v[i]; - else if (i === this.#y) this.#y = this.#d[i]; + this.#D(i); + let r = this.#r[i]; + if (this.#f(r) ? r.__abortController.abort(new Error("deleted")) : (this.#C || this.#s) && (this.#C && this.#e?.(r, t, e), this.#s && this.#y?.push([r, t, e])), this.#a.delete(t), this.#l[i] = void 0, this.#r[i] = void 0, i === this.#u) this.#u = this.#_[i]; + else if (i === this.#b) this.#b = this.#w[i]; else { - let h = this.#v[i]; - this.#d[h] = this.#d[i]; - let o = this.#d[i]; - this.#v[o] = this.#v[i]; + let h = this.#_[i]; + this.#w[h] = this.#w[i]; + let a = this.#w[i]; + this.#_[a] = this.#_[i]; } - this.#o--, this.#R.push(i); + this.#o--, this.#v.push(i); } } - if (this.#e && this.#m?.length) { - let i = this.#m, r; - for (; r = i?.shift(); ) this.#h?.(...r); + if (this.#s && this.#y?.length) { + let i = this.#y, r; + for (; r = i?.shift(); ) this.#n?.(...r); } return s; } clear() { - return this.#q("delete"); + return this.#Z("delete"); } - #q(t) { - for (let e of this.#M({ allowStale: true })) { - let s = this.#i[e]; - if (this.#l(s)) s.__abortController.abort(new Error("deleted")); + #Z(t) { + for (let e of this.#R({ allowStale: true })) { + let s = this.#r[e]; + if (this.#f(s)) s.__abortController.abort(new Error("deleted")); else { - let i = this.#a[e]; - this.#E && this.#n?.(s, i, t), this.#e && this.#m?.push([s, i, t]); + let i = this.#l[e]; + this.#C && this.#e?.(s, i, t), this.#s && this.#y?.push([s, i, t]); } } - if (this.#u.clear(), this.#i.fill(void 0), this.#a.fill(void 0), this.#g && this.#x) { - this.#g.fill(0), this.#x.fill(0); - for (let e of this.#b ?? []) e !== void 0 && clearTimeout(e); - this.#b?.fill(void 0); + if (this.#a.clear(), this.#r.fill(void 0), this.#l.fill(void 0), this.#g && this.#O) { + this.#g.fill(0), this.#O.fill(0); + for (let e of this.#S ?? []) e !== void 0 && clearTimeout(e); + this.#S?.fill(void 0); } - if (this.#O && this.#O.fill(0), this.#y = 0, this.#p = 0, this.#R.length = 0, this.#f = 0, this.#o = 0, this.#e && this.#m) { - let e = this.#m, s; - for (; s = e?.shift(); ) this.#h?.(...s); + if (this.#E && this.#E.fill(0), this.#b = 0, this.#u = 0, this.#v.length = 0, this.#m = 0, this.#o = 0, this.#s && this.#y) { + let e = this.#y, s; + for (; s = e?.shift(); ) this.#n?.(...s); } } }; - Wt.LRUCache = rr; + Ut.LRUCache = wr; }); - var Oe = R((P) => { + var $e = x((j) => { "use strict"; - var nr = P && P.__importDefault || function(n) { + var br = j && j.__importDefault || function(n) { return n && n.__esModule ? n : { default: n }; }; - Object.defineProperty(P, "__esModule", { value: true }); - P.Minipass = P.isWritable = P.isReadable = P.isStream = void 0; - var ds = typeof process == "object" && process ? process : { stdout: null, stderr: null }, _e2 = require("node:events"), ws = nr(require("node:stream")), hr = require("node:string_decoder"), or2 = (n) => !!n && typeof n == "object" && (n instanceof qt || n instanceof ws.default || (0, P.isReadable)(n) || (0, P.isWritable)(n)); - P.isStream = or2; - var ar = (n) => !!n && typeof n == "object" && n instanceof _e2.EventEmitter && typeof n.pipe == "function" && n.pipe !== ws.default.Writable.prototype.pipe; - P.isReadable = ar; - var lr = (n) => !!n && typeof n == "object" && n instanceof _e2.EventEmitter && typeof n.write == "function" && typeof n.end == "function"; - P.isWritable = lr; - var $ = /* @__PURE__ */ Symbol("EOF"), q = /* @__PURE__ */ Symbol("maybeEmitEnd"), K = /* @__PURE__ */ Symbol("emittedEnd"), Bt = /* @__PURE__ */ Symbol("emittingEnd"), lt2 = /* @__PURE__ */ Symbol("emittedError"), It = /* @__PURE__ */ Symbol("closed"), ps = /* @__PURE__ */ Symbol("read"), Gt = /* @__PURE__ */ Symbol("flush"), ms = /* @__PURE__ */ Symbol("flushChunk"), L = /* @__PURE__ */ Symbol("encoding"), rt = /* @__PURE__ */ Symbol("decoder"), x = /* @__PURE__ */ Symbol("flowing"), ct = /* @__PURE__ */ Symbol("paused"), nt = /* @__PURE__ */ Symbol("resume"), T = /* @__PURE__ */ Symbol("buffer"), M = /* @__PURE__ */ Symbol("pipes"), C = /* @__PURE__ */ Symbol("bufferLength"), we = /* @__PURE__ */ Symbol("bufferPush"), zt = /* @__PURE__ */ Symbol("bufferShift"), k = /* @__PURE__ */ Symbol("objectMode"), O = /* @__PURE__ */ Symbol("destroyed"), be = /* @__PURE__ */ Symbol("error"), ye = /* @__PURE__ */ Symbol("emitData"), gs = /* @__PURE__ */ Symbol("emitEnd"), Se = /* @__PURE__ */ Symbol("emitEnd2"), I = /* @__PURE__ */ Symbol("async"), ve = /* @__PURE__ */ Symbol("abort"), Ut = /* @__PURE__ */ Symbol("aborted"), ut = /* @__PURE__ */ Symbol("signal"), Z = /* @__PURE__ */ Symbol("dataListeners"), D = /* @__PURE__ */ Symbol("discarded"), ft = (n) => Promise.resolve().then(n), cr2 = (n) => n(), ur = (n) => n === "end" || n === "finish" || n === "prefinish", fr = (n) => n instanceof ArrayBuffer || !!n && typeof n == "object" && n.constructor && n.constructor.name === "ArrayBuffer" && n.byteLength >= 0, dr = (n) => !Buffer.isBuffer(n) && ArrayBuffer.isView(n), $t = class { + Object.defineProperty(j, "__esModule", { value: true }); + j.Minipass = j.isWritable = j.isReadable = j.isStream = void 0; + var Gs = typeof process == "object" && process ? process : { stdout: null, stderr: null }, Ue = require("node:events"), qs = br(require("node:stream")), yr = require("node:string_decoder"), Sr = (n) => !!n && typeof n == "object" && (n instanceof Yt || n instanceof qs.default || (0, j.isReadable)(n) || (0, j.isWritable)(n)); + j.isStream = Sr; + var vr = (n) => !!n && typeof n == "object" && n instanceof Ue.EventEmitter && typeof n.pipe == "function" && n.pipe !== qs.default.Writable.prototype.pipe; + j.isReadable = vr; + var _r2 = (n) => !!n && typeof n == "object" && n instanceof Ue.EventEmitter && typeof n.write == "function" && typeof n.end == "function"; + j.isWritable = _r2; + var H = /* @__PURE__ */ Symbol("EOF"), X = /* @__PURE__ */ Symbol("maybeEmitEnd"), J = /* @__PURE__ */ Symbol("emittedEnd"), $t = /* @__PURE__ */ Symbol("emittingEnd"), pt = /* @__PURE__ */ Symbol("emittedError"), qt = /* @__PURE__ */ Symbol("closed"), Is = /* @__PURE__ */ Symbol("read"), Ht = /* @__PURE__ */ Symbol("flush"), Us = /* @__PURE__ */ Symbol("flushChunk"), W = /* @__PURE__ */ Symbol("encoding"), ot = /* @__PURE__ */ Symbol("decoder"), A = /* @__PURE__ */ Symbol("flowing"), mt = /* @__PURE__ */ Symbol("paused"), at = /* @__PURE__ */ Symbol("resume"), k = /* @__PURE__ */ Symbol("buffer"), F = /* @__PURE__ */ Symbol("pipes"), M = /* @__PURE__ */ Symbol("bufferLength"), Le = /* @__PURE__ */ Symbol("bufferPush"), Xt = /* @__PURE__ */ Symbol("bufferShift"), P = /* @__PURE__ */ Symbol("objectMode"), C = /* @__PURE__ */ Symbol("destroyed"), We = /* @__PURE__ */ Symbol("error"), Be = /* @__PURE__ */ Symbol("emitData"), $s = /* @__PURE__ */ Symbol("emitEnd"), ze = /* @__PURE__ */ Symbol("emitEnd2"), G = /* @__PURE__ */ Symbol("async"), Ge = /* @__PURE__ */ Symbol("abort"), Kt = /* @__PURE__ */ Symbol("aborted"), gt = /* @__PURE__ */ Symbol("signal"), st = /* @__PURE__ */ Symbol("dataListeners"), D = /* @__PURE__ */ Symbol("discarded"), wt = (n) => Promise.resolve().then(n), Er = (n) => n(), Or = (n) => n === "end" || n === "finish" || n === "prefinish", Cr = (n) => n instanceof ArrayBuffer || !!n && typeof n == "object" && n.constructor && n.constructor.name === "ArrayBuffer" && n.byteLength >= 0, Ar = (n) => !Buffer.isBuffer(n) && ArrayBuffer.isView(n), Vt = class { src; dest; opts; ondrain; constructor(t, e, s) { - this.src = t, this.dest = e, this.opts = s, this.ondrain = () => t[nt](), this.dest.on("drain", this.ondrain); + this.src = t, this.dest = e, this.opts = s, this.ondrain = () => t[at](), this.dest.on("drain", this.ondrain); } unpipe() { this.dest.removeListener("drain", this.ondrain); @@ -136309,47 +136777,47 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur end() { this.unpipe(), this.opts.end && this.dest.end(); } - }, Ee = class extends $t { + }, Ie = class extends Vt { unpipe() { this.src.removeListener("error", this.proxyErrors), super.unpipe(); } constructor(t, e, s) { super(t, e, s), this.proxyErrors = (i) => this.dest.emit("error", i), t.on("error", this.proxyErrors); } - }, pr = (n) => !!n.objectMode, mr = (n) => !n.objectMode && !!n.encoding && n.encoding !== "buffer", qt = class extends _e2.EventEmitter { - [x] = false; - [ct] = false; - [M] = []; - [T] = []; - [k]; - [L]; - [I]; - [rt]; - [$] = false; - [K] = false; - [Bt] = false; - [It] = false; - [lt2] = null; - [C] = 0; - [O] = false; - [ut]; - [Ut] = false; - [Z] = 0; + }, kr = (n) => !!n.objectMode, Mr = (n) => !n.objectMode && !!n.encoding && n.encoding !== "buffer", Yt = class extends Ue.EventEmitter { + [A] = false; + [mt] = false; + [F] = []; + [k] = []; + [P]; + [W]; + [G]; + [ot]; + [H] = false; + [J] = false; + [$t] = false; + [qt] = false; + [pt] = null; + [M] = 0; + [C] = false; + [gt]; + [Kt] = false; + [st] = 0; [D] = false; writable = true; readable = true; 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"); - pr(e) ? (this[k] = true, this[L] = null) : mr(e) ? (this[L] = e.encoding, this[k] = false) : (this[k] = false, this[L] = null), this[I] = !!e.async, this[rt] = this[L] ? new hr.StringDecoder(this[L]) : null, e && e.debugExposeBuffer === true && Object.defineProperty(this, "buffer", { get: () => this[T] }), e && e.debugExposePipes === true && Object.defineProperty(this, "pipes", { get: () => this[M] }); + kr(e) ? (this[P] = true, this[W] = null) : Mr(e) ? (this[W] = e.encoding, this[P] = false) : (this[P] = false, this[W] = null), this[G] = !!e.async, this[ot] = this[W] ? new yr.StringDecoder(this[W]) : null, e && e.debugExposeBuffer === true && Object.defineProperty(this, "buffer", { get: () => this[k] }), e && e.debugExposePipes === true && Object.defineProperty(this, "pipes", { get: () => this[F] }); let { signal: s } = e; - s && (this[ut] = s, s.aborted ? this[ve]() : s.addEventListener("abort", () => this[ve]())); + s && (this[gt] = s, s.aborted ? this[Ge]() : s.addEventListener("abort", () => this[Ge]())); } get bufferLength() { - return this[C]; + return this[M]; } get encoding() { - return this[L]; + return this[W]; } set encoding(t) { throw new Error("Encoding must be set at instantiation time"); @@ -136358,110 +136826,110 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur throw new Error("Encoding must be set at instantiation time"); } get objectMode() { - return this[k]; + return this[P]; } set objectMode(t) { throw new Error("objectMode must be set at instantiation time"); } get async() { - return this[I]; + return this[G]; } set async(t) { - this[I] = this[I] || !!t; + this[G] = this[G] || !!t; } - [ve]() { - this[Ut] = true, this.emit("abort", this[ut]?.reason), this.destroy(this[ut]?.reason); + [Ge]() { + this[Kt] = true, this.emit("abort", this[gt]?.reason), this.destroy(this[gt]?.reason); } get aborted() { - return this[Ut]; + return this[Kt]; } set aborted(t) { } write(t, e, s) { - if (this[Ut]) return false; - if (this[$]) throw new Error("write after end"); - if (this[O]) return this.emit("error", Object.assign(new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), true; + if (this[Kt]) return false; + if (this[H]) throw new Error("write after end"); + if (this[C]) return this.emit("error", Object.assign(new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), true; typeof e == "function" && (s = e, e = "utf8"), e || (e = "utf8"); - let i = this[I] ? ft : cr2; - if (!this[k] && !Buffer.isBuffer(t)) { - if (dr(t)) t = Buffer.from(t.buffer, t.byteOffset, t.byteLength); - else if (fr(t)) t = Buffer.from(t); + let i = this[G] ? wt : Er; + if (!this[P] && !Buffer.isBuffer(t)) { + if (Ar(t)) t = Buffer.from(t.buffer, t.byteOffset, t.byteLength); + else if (Cr(t)) t = Buffer.from(t); else if (typeof t != "string") throw new Error("Non-contiguous data written to non-objectMode stream"); } - return this[k] ? (this[x] && this[C] !== 0 && this[Gt](true), this[x] ? this.emit("data", t) : this[we](t), this[C] !== 0 && this.emit("readable"), s && i(s), this[x]) : t.length ? (typeof t == "string" && !(e === this[L] && !this[rt]?.lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[L] && (t = this[rt].write(t)), this[x] && this[C] !== 0 && this[Gt](true), this[x] ? this.emit("data", t) : this[we](t), this[C] !== 0 && this.emit("readable"), s && i(s), this[x]) : (this[C] !== 0 && this.emit("readable"), s && i(s), this[x]); + return this[P] ? (this[A] && this[M] !== 0 && this[Ht](true), this[A] ? this.emit("data", t) : this[Le](t), this[M] !== 0 && this.emit("readable"), s && i(s), this[A]) : t.length ? (typeof t == "string" && !(e === this[W] && !this[ot]?.lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[W] && (t = this[ot].write(t)), this[A] && this[M] !== 0 && this[Ht](true), this[A] ? this.emit("data", t) : this[Le](t), this[M] !== 0 && this.emit("readable"), s && i(s), this[A]) : (this[M] !== 0 && this.emit("readable"), s && i(s), this[A]); } read(t) { - if (this[O]) return null; - if (this[D] = false, this[C] === 0 || t === 0 || t && t > this[C]) return this[q](), null; - this[k] && (t = null), this[T].length > 1 && !this[k] && (this[T] = [this[L] ? this[T].join("") : Buffer.concat(this[T], this[C])]); - let e = this[ps](t || null, this[T][0]); - return this[q](), e; + if (this[C]) return null; + if (this[D] = false, this[M] === 0 || t === 0 || t && t > this[M]) return this[X](), null; + this[P] && (t = null), this[k].length > 1 && !this[P] && (this[k] = [this[W] ? this[k].join("") : Buffer.concat(this[k], this[M])]); + let e = this[Is](t || null, this[k][0]); + return this[X](), e; } - [ps](t, e) { - if (this[k]) this[zt](); + [Is](t, e) { + if (this[P]) this[Xt](); else { let s = e; - t === s.length || t === null ? this[zt]() : typeof s == "string" ? (this[T][0] = s.slice(t), e = s.slice(0, t), this[C] -= t) : (this[T][0] = s.subarray(t), e = s.subarray(0, t), this[C] -= t); + t === s.length || t === null ? this[Xt]() : typeof s == "string" ? (this[k][0] = s.slice(t), e = s.slice(0, t), this[M] -= t) : (this[k][0] = s.subarray(t), e = s.subarray(0, t), this[M] -= t); } - return this.emit("data", e), !this[T].length && !this[$] && this.emit("drain"), e; + return this.emit("data", e), !this[k].length && !this[H] && this.emit("drain"), e; } end(t, e, s) { - return typeof t == "function" && (s = t, t = void 0), typeof e == "function" && (s = e, e = "utf8"), t !== void 0 && this.write(t, e), s && this.once("end", s), this[$] = true, this.writable = false, (this[x] || !this[ct]) && this[q](), this; + return typeof t == "function" && (s = t, t = void 0), typeof e == "function" && (s = e, e = "utf8"), t !== void 0 && this.write(t, e), s && this.once("end", s), this[H] = true, this.writable = false, (this[A] || !this[mt]) && this[X](), this; } - [nt]() { - this[O] || (!this[Z] && !this[M].length && (this[D] = true), this[ct] = false, this[x] = true, this.emit("resume"), this[T].length ? this[Gt]() : this[$] ? this[q]() : this.emit("drain")); + [at]() { + this[C] || (!this[st] && !this[F].length && (this[D] = true), this[mt] = false, this[A] = true, this.emit("resume"), this[k].length ? this[Ht]() : this[H] ? this[X]() : this.emit("drain")); } resume() { - return this[nt](); + return this[at](); } pause() { - this[x] = false, this[ct] = true, this[D] = false; + this[A] = false, this[mt] = true, this[D] = false; } get destroyed() { - return this[O]; + return this[C]; } get flowing() { - return this[x]; + return this[A]; } get paused() { - return this[ct]; + return this[mt]; } - [we](t) { - this[k] ? this[C] += 1 : this[C] += t.length, this[T].push(t); + [Le](t) { + this[P] ? this[M] += 1 : this[M] += t.length, this[k].push(t); } - [zt]() { - return this[k] ? this[C] -= 1 : this[C] -= this[T][0].length, this[T].shift(); + [Xt]() { + return this[P] ? this[M] -= 1 : this[M] -= this[k][0].length, this[k].shift(); } - [Gt](t = false) { + [Ht](t = false) { do ; - while (this[ms](this[zt]()) && this[T].length); - !t && !this[T].length && !this[$] && this.emit("drain"); + while (this[Us](this[Xt]()) && this[k].length); + !t && !this[k].length && !this[H] && this.emit("drain"); } - [ms](t) { - return this.emit("data", t), this[x]; + [Us](t) { + return this.emit("data", t), this[A]; } pipe(t, e) { - if (this[O]) return t; + if (this[C]) return t; this[D] = false; - let s = this[K]; - return e = e || {}, t === ds.stdout || t === ds.stderr ? e.end = false : e.end = e.end !== false, e.proxyErrors = !!e.proxyErrors, s ? e.end && t.end() : (this[M].push(e.proxyErrors ? new Ee(this, t, e) : new $t(this, t, e)), this[I] ? ft(() => this[nt]()) : this[nt]()), t; + let s = this[J]; + return e = e || {}, t === Gs.stdout || t === Gs.stderr ? e.end = false : e.end = e.end !== false, e.proxyErrors = !!e.proxyErrors, s ? e.end && t.end() : (this[F].push(e.proxyErrors ? new Ie(this, t, e) : new Vt(this, t, e)), this[G] ? wt(() => this[at]()) : this[at]()), t; } unpipe(t) { - let e = this[M].find((s) => s.dest === t); - e && (this[M].length === 1 ? (this[x] && this[Z] === 0 && (this[x] = false), this[M] = []) : this[M].splice(this[M].indexOf(e), 1), e.unpipe()); + let e = this[F].find((s) => s.dest === t); + e && (this[F].length === 1 ? (this[A] && this[st] === 0 && (this[A] = false), this[F] = []) : this[F].splice(this[F].indexOf(e), 1), e.unpipe()); } addListener(t, e) { return this.on(t, e); } on(t, e) { let s = super.on(t, e); - if (t === "data") this[D] = false, this[Z]++, !this[M].length && !this[x] && this[nt](); - else if (t === "readable" && this[C] !== 0) super.emit("readable"); - else if (ur(t) && this[K]) super.emit(t), this.removeAllListeners(t); - else if (t === "error" && this[lt2]) { + if (t === "data") this[D] = false, this[st]++, !this[F].length && !this[A] && this[at](); + else if (t === "readable" && this[M] !== 0) super.emit("readable"); + else if (Or(t) && this[J]) super.emit(t), this.removeAllListeners(t); + else if (t === "error" && this[pt]) { let i = e; - this[I] ? ft(() => i.call(this, this[lt2])) : i.call(this, this[lt2]); + this[G] ? wt(() => i.call(this, this[pt])) : i.call(this, this[pt]); } return s; } @@ -136470,77 +136938,77 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur } off(t, e) { let s = super.off(t, e); - return t === "data" && (this[Z] = this.listeners("data").length, this[Z] === 0 && !this[D] && !this[M].length && (this[x] = false)), s; + return t === "data" && (this[st] = this.listeners("data").length, this[st] === 0 && !this[D] && !this[F].length && (this[A] = false)), s; } removeAllListeners(t) { let e = super.removeAllListeners(t); - return (t === "data" || t === void 0) && (this[Z] = 0, !this[D] && !this[M].length && (this[x] = false)), e; + return (t === "data" || t === void 0) && (this[st] = 0, !this[D] && !this[F].length && (this[A] = false)), e; } get emittedEnd() { - return this[K]; + return this[J]; } - [q]() { - !this[Bt] && !this[K] && !this[O] && this[T].length === 0 && this[$] && (this[Bt] = true, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[It] && this.emit("close"), this[Bt] = false); + [X]() { + !this[$t] && !this[J] && !this[C] && this[k].length === 0 && this[H] && (this[$t] = true, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[qt] && this.emit("close"), this[$t] = false); } emit(t, ...e) { let s = e[0]; - if (t !== "error" && t !== "close" && t !== O && this[O]) return false; - if (t === "data") return !this[k] && !s ? false : this[I] ? (ft(() => this[ye](s)), true) : this[ye](s); - if (t === "end") return this[gs](); + if (t !== "error" && t !== "close" && t !== C && this[C]) return false; + if (t === "data") return !this[P] && !s ? false : this[G] ? (wt(() => this[Be](s)), true) : this[Be](s); + if (t === "end") return this[$s](); if (t === "close") { - if (this[It] = true, !this[K] && !this[O]) return false; + if (this[qt] = true, !this[J] && !this[C]) return false; let r = super.emit("close"); return this.removeAllListeners("close"), r; } else if (t === "error") { - this[lt2] = s, super.emit(be, s); - let r = !this[ut] || this.listeners("error").length ? super.emit("error", s) : false; - return this[q](), r; + this[pt] = s, super.emit(We, s); + let r = !this[gt] || this.listeners("error").length ? super.emit("error", s) : false; + return this[X](), r; } else if (t === "resume") { let r = super.emit("resume"); - return this[q](), r; + return this[X](), r; } else if (t === "finish" || t === "prefinish") { let r = super.emit(t); return this.removeAllListeners(t), r; } let i = super.emit(t, ...e); - return this[q](), i; + return this[X](), i; } - [ye](t) { - for (let s of this[M]) s.dest.write(t) === false && this.pause(); + [Be](t) { + for (let s of this[F]) s.dest.write(t) === false && this.pause(); let e = this[D] ? false : super.emit("data", t); - return this[q](), e; + return this[X](), e; } - [gs]() { - return this[K] ? false : (this[K] = true, this.readable = false, this[I] ? (ft(() => this[Se]()), true) : this[Se]()); + [$s]() { + return this[J] ? false : (this[J] = true, this.readable = false, this[G] ? (wt(() => this[ze]()), true) : this[ze]()); } - [Se]() { - if (this[rt]) { - let e = this[rt].end(); + [ze]() { + if (this[ot]) { + let e = this[ot].end(); if (e) { - for (let s of this[M]) s.dest.write(e); + for (let s of this[F]) s.dest.write(e); this[D] || super.emit("data", e); } } - for (let e of this[M]) e.end(); + for (let e of this[F]) e.end(); let t = super.emit("end"); return this.removeAllListeners("end"), t; } async collect() { let t = Object.assign([], { dataLength: 0 }); - this[k] || (t.dataLength = 0); + this[P] || (t.dataLength = 0); let e = this.promise(); return this.on("data", (s) => { - t.push(s), this[k] || (t.dataLength += s.length); + t.push(s), this[P] || (t.dataLength += s.length); }), await e, t; } async concat() { - if (this[k]) throw new Error("cannot concat in objectMode"); + if (this[P]) throw new Error("cannot concat in objectMode"); let t = await this.collect(); - return this[L] ? t.join("") : Buffer.concat(t, t.dataLength); + return this[W] ? t.join("") : Buffer.concat(t, t.dataLength); } async promise() { return new Promise((t, e) => { - this.on(O, () => e(new Error("stream destroyed"))), this.on("error", (s) => e(s)), this.on("end", () => t()); + this.on(C, () => e(new Error("stream destroyed"))), this.on("error", (s) => e(s)), this.on("end", () => t()); }); } [Symbol.asyncIterator]() { @@ -136550,16 +137018,16 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur if (t) return e(); let i = this.read(); if (i !== null) return Promise.resolve({ done: false, value: i }); - if (this[$]) return e(); - let r, h, o = (c) => { - this.off("data", a), this.off("end", l), this.off(O, f), e(), h(c); - }, a = (c) => { - this.off("error", o), this.off("end", l), this.off(O, f), this.pause(), r({ value: c, done: !!this[$] }); + if (this[H]) return e(); + let r, h, a = (u) => { + this.off("data", o), this.off("end", l), this.off(C, c), e(), h(u); + }, o = (u) => { + this.off("error", a), this.off("end", l), this.off(C, c), this.pause(), r({ value: u, done: !!this[H] }); }, l = () => { - this.off("error", o), this.off("data", a), this.off(O, f), e(), r({ done: true, value: void 0 }); - }, f = () => o(new Error("stream destroyed")); - return new Promise((c, d) => { - h = d, r = c, this.once(O, f), this.once("error", o), this.once("end", l), this.once("data", a); + this.off("error", a), this.off("data", o), this.off(C, c), e(), r({ done: true, value: void 0 }); + }, c = () => a(new Error("stream destroyed")); + return new Promise((u, p) => { + h = p, r = u, this.once(C, c), this.once("error", a), this.once("end", l), this.once("data", o); }); }, throw: e, return: e, [Symbol.asyncIterator]() { return this; @@ -136568,31 +137036,31 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur } [Symbol.iterator]() { this[D] = false; - let t = false, e = () => (this.pause(), this.off(be, e), this.off(O, e), this.off("end", e), t = true, { done: true, value: void 0 }), s = () => { + let t = false, e = () => (this.pause(), this.off(We, e), this.off(C, e), this.off("end", e), t = true, { done: true, value: void 0 }), s = () => { if (t) return e(); let i = this.read(); return i === null ? e() : { done: false, value: i }; }; - return this.once("end", e), this.once(be, e), this.once(O, e), { next: s, throw: e, return: e, [Symbol.iterator]() { + return this.once("end", e), this.once(We, e), this.once(C, e), { next: s, throw: e, return: e, [Symbol.iterator]() { return this; }, [Symbol.dispose]: () => { } }; } destroy(t) { - if (this[O]) return t ? this.emit("error", t) : this.emit(O), this; - this[O] = true, this[D] = true, this[T].length = 0, this[C] = 0; + if (this[C]) return t ? this.emit("error", t) : this.emit(C), this; + this[C] = true, this[D] = true, this[k].length = 0, this[M] = 0; let e = this; - return typeof e.close == "function" && !this[It] && e.close(), t ? this.emit("error", t) : this.emit(O), this; + return typeof e.close == "function" && !this[qt] && e.close(), t ? this.emit("error", t) : this.emit(C), this; } static get isStream() { - return P.isStream; + return j.isStream; } }; - P.Minipass = qt; + j.Minipass = Yt; }); - var Ms = R((_2) => { + var ni = x((E) => { "use strict"; - var gr = _2 && _2.__createBinding || (Object.create ? (function(n, t, e, s) { + var xr = E && E.__createBinding || (Object.create ? (function(n, t, e, s) { s === void 0 && (s = e); var i = Object.getOwnPropertyDescriptor(t, e); (!i || ("get" in i ? !t.__esModule : i.writable || i.configurable)) && (i = { enumerable: true, get: function() { @@ -136600,41 +137068,50 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur } }), Object.defineProperty(n, s, i); }) : (function(n, t, e, s) { s === void 0 && (s = e), n[s] = t[e]; - })), wr = _2 && _2.__setModuleDefault || (Object.create ? (function(n, t) { + })), Rr = E && E.__setModuleDefault || (Object.create ? (function(n, t) { Object.defineProperty(n, "default", { enumerable: true, value: t }); }) : function(n, t) { n.default = t; - }), br = _2 && _2.__importStar || function(n) { - if (n && n.__esModule) return n; - var t = {}; - if (n != null) for (var e in n) e !== "default" && Object.prototype.hasOwnProperty.call(n, e) && gr(t, n, e); - return wr(t, n), t; - }; - Object.defineProperty(_2, "__esModule", { value: true }); - _2.PathScurry = _2.Path = _2.PathScurryDarwin = _2.PathScurryPosix = _2.PathScurryWin32 = _2.PathScurryBase = _2.PathPosix = _2.PathWin32 = _2.PathBase = _2.ChildrenCache = _2.ResolveCache = void 0; - var Qt = fs34(), Yt = require("node:path"), yr = require("node:url"), pt = require("fs"), Sr = br(require("node:fs")), vr = pt.realpathSync.native, Ht = require("node:fs/promises"), bs = Oe(), mt = { lstatSync: pt.lstatSync, readdir: pt.readdir, readdirSync: pt.readdirSync, readlinkSync: pt.readlinkSync, realpathSync: vr, promises: { lstat: Ht.lstat, readdir: Ht.readdir, readlink: Ht.readlink, realpath: Ht.realpath } }, _s2 = (n) => !n || n === mt || n === Sr ? mt : { ...mt, ...n, promises: { ...mt.promises, ...n.promises || {} } }, Os = /^\\\\\?\\([a-z]:)\\?$/i, Er = (n) => n.replace(/\//g, "\\").replace(Os, "$1\\"), _r2 = /[\\\/]/, N = 0, xs = 1, Ts = 2, G = 4, Cs = 6, Rs = 8, Q = 10, As = 12, j = 15, dt = ~j, xe = 16, ys = 32, gt = 64, W = 128, Vt = 256, Xt = 512, Ss = gt | W | Xt, Or = 1023, Te = (n) => n.isFile() ? Rs : n.isDirectory() ? G : n.isSymbolicLink() ? Q : n.isCharacterDevice() ? Ts : n.isBlockDevice() ? Cs : n.isSocket() ? As : n.isFIFO() ? xs : N, vs = new Qt.LRUCache({ max: 2 ** 12 }), wt = (n) => { - let t = vs.get(n); + }), Pr = E && E.__importStar || /* @__PURE__ */ (function() { + var n = function(t) { + return n = Object.getOwnPropertyNames || function(e) { + var s = []; + for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (s[s.length] = i); + return s; + }, n(t); + }; + return function(t) { + if (t && t.__esModule) return t; + var e = {}; + if (t != null) for (var s = n(t), i = 0; i < s.length; i++) s[i] !== "default" && xr(e, t, s[i]); + return Rr(e, t), e; + }; + })(); + Object.defineProperty(E, "__esModule", { value: true }); + E.PathScurry = E.Path = E.PathScurryDarwin = E.PathScurryPosix = E.PathScurryWin32 = E.PathScurryBase = E.PathPosix = E.PathWin32 = E.PathBase = E.ChildrenCache = E.ResolveCache = void 0; + var re = zs(), ee = require("node:path"), Tr = require("node:url"), yt = require("fs"), Fr = Pr(require("node:fs")), jr = yt.realpathSync.native, Zt = require("node:fs/promises"), Hs = $e(), St = { lstatSync: yt.lstatSync, readdir: yt.readdir, readdirSync: yt.readdirSync, readlinkSync: yt.readlinkSync, realpathSync: jr, promises: { lstat: Zt.lstat, readdir: Zt.readdir, readlink: Zt.readlink, realpath: Zt.realpath } }, Js = (n) => !n || n === St || n === Fr ? St : { ...St, ...n, promises: { ...St.promises, ...n.promises } }, Dr = /^\\\\\?\\([a-z]:)\\?$/i, Nr = /^\\\\\?\\UNC\\([^\\]+\\[^\\]+)\\?$/i, Lr = /^\\\\[^\\?]+\\[^\\]+$/, Xs = (n) => n.replace(/\//g, "\\").replace(Dr, "$1\\").replace(Nr, "\\\\$1\\").replace(Lr, "$&\\"), Wr = /^[\\/]{2}\?[\\/]unc[\\/][^\\/]+[\\/][^\\/]+(?:[\\/]|$)/i, Br = /^[\\/]{2}\?[\\/](?=[a-z]:)/i, zr = /^[\\/]{2}\?[\\/]unc(?=[\\/][^\\/]+[\\/][^\\/])/i, Gr = /[\\/]/, L = 0, Qs = 1, ti = 2, I = 4, ei = 6, si = 8, it = 10, ii = 12, N = 15, bt = ~N, qe = 16, Ks = 32, vt = 64, B = 128, Jt = 256, te = 512, Vs = vt | B | te, Ir = 1023, He = (n) => n.isFile() ? si : n.isDirectory() ? I : n.isSymbolicLink() ? it : n.isCharacterDevice() ? ti : n.isBlockDevice() ? ei : n.isSocket() ? ii : n.isFIFO() ? Qs : L, Ys = new re.LRUCache({ max: 2 ** 12 }), _t2 = (n) => { + let t = Ys.get(n); if (t) return t; let e = n.normalize("NFKD"); - return vs.set(n, e), e; - }, Es = new Qt.LRUCache({ max: 2 ** 12 }), Kt = (n) => { - let t = Es.get(n); + return Ys.set(n, e), e; + }, Zs = new re.LRUCache({ max: 2 ** 12 }), Qt = (n) => { + let t = Zs.get(n); if (t) return t; - let e = wt(n.toLowerCase()); - return Es.set(n, e), e; - }, bt = class extends Qt.LRUCache { + let e = _t2(n.toLowerCase()); + return Zs.set(n, e), e; + }, Et = class extends re.LRUCache { constructor() { super({ max: 256 }); } }; - _2.ResolveCache = bt; - var Jt = class extends Qt.LRUCache { + E.ResolveCache = Et; + var se = class extends re.LRUCache { constructor(t = 16 * 1024) { super({ maxSize: t, sizeCalculation: (e) => e.length + 1 }); } }; - _2.ChildrenCache = Jt; - var ks = /* @__PURE__ */ Symbol("PathScurry setAsCwd"), A = class { + E.ChildrenCache = se; + var ri = /* @__PURE__ */ Symbol("PathScurry setAsCwd"), R = class { name; root; roots; @@ -136642,141 +137119,144 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur nocase; isCWD = false; #t; - #s; + #i; get dev() { - return this.#s; + return this.#i; } - #n; + #e; get mode() { - return this.#n; - } - #r; - get nlink() { - return this.#r; + return this.#e; } #h; - get uid() { + get nlink() { return this.#h; } - #S; - get gid() { - return this.#S; + #n; + get uid() { + return this.#n; } - #w; - get rdev() { - return this.#w; + #d; + get gid() { + return this.#d; } #c; - get blksize() { + get rdev() { return this.#c; } + #p; + get blksize() { + return this.#p; + } #o; get ino() { return this.#o; } - #f; + #m; get size() { - return this.#f; - } - #u; - get blocks() { - return this.#u; + return this.#m; } #a; - get atimeMs() { + get blocks() { return this.#a; } - #i; - get mtimeMs() { - return this.#i; + #l; + get atimeMs() { + return this.#l; } - #d; + #r; + get mtimeMs() { + return this.#r; + } + #w; get ctimeMs() { - return this.#d; + return this.#w; + } + #_; + get birthtimeMs() { + return this.#_; + } + #b; + get atime() { + return this.#b; + } + #u; + get mtime() { + return this.#u; } #v; - get birthtimeMs() { + get ctime() { return this.#v; } #y; - get atime() { + get birthtime() { return this.#y; } - #p; - get mtime() { - return this.#p; - } - #R; - get ctime() { - return this.#R; - } - #m; - get birthtime() { - return this.#m; - } - #O; - #x; - #g; - #b; #E; - #T; - #e; - #F; - #P; + #O; + #g; + #S; #C; + #M; + #s; + #P; + #T; + #k; get parentPath() { return (this.parent || this).fullpath(); } get path() { return this.parentPath; } - constructor(t, e = N, s, i, r, h, o) { - this.name = t, this.#O = r ? Kt(t) : wt(t), this.#e = e & Or, this.nocase = r, this.roots = i, this.root = s || this, this.#F = h, this.#g = o.fullpath, this.#E = o.relative, this.#T = o.relativePosix, this.parent = o.parent, this.parent ? this.#t = this.parent.#t : this.#t = _s2(o.fs); + constructor(t, e = L, s, i, r, h, a) { + this.name = t, this.#E = r ? Qt(t) : _t2(t), this.#s = e & Ir, this.nocase = r, this.roots = i, this.root = s || this, this.#P = h, this.#g = a.fullpath, this.#C = a.relative, this.#M = a.relativePosix, this.parent = a.parent, this.parent ? this.#t = this.parent.#t : this.#t = Js(a.fs); + } + get fs() { + return this.#t; } depth() { - return this.#x !== void 0 ? this.#x : this.parent ? this.#x = this.parent.depth() + 1 : this.#x = 0; + return this.#O !== void 0 ? this.#O : this.parent ? this.#O = this.parent.depth() + 1 : this.#O = 0; } childrenCache() { - return this.#F; + return this.#P; } resolve(t) { if (!t) return this; let e = this.getRootString(t), i = t.substring(e.length).split(this.splitSep); - return e ? this.getRoot(e).#D(i) : this.#D(i); + return e ? this.getRoot(e).#F(i) : this.#F(i); } - #D(t) { + #F(t) { let e = this; for (let s of t) e = e.child(s); return e; } children() { - let t = this.#F.get(this); + let t = this.#P.get(this); if (t) return t; let e = Object.assign([], { provisional: 0 }); - return this.#F.set(this, e), this.#e &= ~xe, e; + return this.#P.set(this, e), this.#s &= ~qe, e; } child(t, e) { if (t === "" || t === ".") return this; if (t === "..") return this.parent || this; - let s = this.children(), i = this.nocase ? Kt(t) : wt(t); - for (let a of s) if (a.#O === i) return a; - let r = this.parent ? this.sep : "", h = this.#g ? this.#g + r + t : void 0, o = this.newChild(t, N, { ...e, parent: this, fullpath: h }); - return this.canReaddir() || (o.#e |= W), s.push(o), o; + let s = this.children(), i = this.nocase ? Qt(t) : _t2(t); + for (let o of s) if (o.#E === i) return o; + let r = this.parent ? this.sep : "", h = this.#g ? this.#g + r + t : void 0, a = this.newChild(t, L, { ...e, parent: this, fullpath: h }); + return this.canReaddir() || (a.#s |= B), s.push(a), a; } relative() { if (this.isCWD) return ""; - if (this.#E !== void 0) return this.#E; + if (this.#C !== void 0) return this.#C; let t = this.name, e = this.parent; - if (!e) return this.#E = this.name; + if (!e) return this.#C = this.name; let s = e.relative(); return s + (!s || !e.parent ? "" : this.sep) + t; } relativePosix() { if (this.sep === "/") return this.relative(); if (this.isCWD) return ""; - if (this.#T !== void 0) return this.#T; + if (this.#M !== void 0) return this.#M; let t = this.name, e = this.parent; - if (!e) return this.#T = this.fullpathPosix(); + if (!e) return this.#M = this.fullpathPosix(); let s = e.relativePosix(); return s + (!s || !e.parent ? "" : "/") + t; } @@ -136788,17 +137268,17 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur return this.#g = i; } fullpathPosix() { - if (this.#b !== void 0) return this.#b; - if (this.sep === "/") return this.#b = this.fullpath(); + if (this.#S !== void 0) return this.#S; + if (this.sep === "/") return this.#S = this.fullpath(); if (!this.parent) { let i = this.fullpath().replace(/\\/g, "/"); - return /^[a-z]:\//i.test(i) ? this.#b = `//?/${i}` : this.#b = i; + return /^[a-z]:\//i.test(i) ? this.#S = `//?/${i}` : this.#S = i; } let t = this.parent, e = t.fullpathPosix(), s = e + (!e || !t.parent ? "" : "/") + this.name; - return this.#b = s; + return this.#S = s; } isUnknown() { - return (this.#e & j) === N; + return (this.#s & N) === L; } isType(t) { return this[`is${t}`](); @@ -136807,152 +137287,152 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur return this.isUnknown() ? "Unknown" : this.isDirectory() ? "Directory" : this.isFile() ? "File" : this.isSymbolicLink() ? "SymbolicLink" : this.isFIFO() ? "FIFO" : this.isCharacterDevice() ? "CharacterDevice" : this.isBlockDevice() ? "BlockDevice" : this.isSocket() ? "Socket" : "Unknown"; } isFile() { - return (this.#e & j) === Rs; + return (this.#s & N) === si; } isDirectory() { - return (this.#e & j) === G; + return (this.#s & N) === I; } isCharacterDevice() { - return (this.#e & j) === Ts; + return (this.#s & N) === ti; } isBlockDevice() { - return (this.#e & j) === Cs; + return (this.#s & N) === ei; } isFIFO() { - return (this.#e & j) === xs; + return (this.#s & N) === Qs; } isSocket() { - return (this.#e & j) === As; + return (this.#s & N) === ii; } isSymbolicLink() { - return (this.#e & Q) === Q; + return (this.#s & it) === it; } lstatCached() { - return this.#e & ys ? this : void 0; + return this.#s & Ks ? this : void 0; } readlinkCached() { - return this.#P; + return this.#T; } realpathCached() { - return this.#C; + return this.#k; } readdirCached() { let t = this.children(); return t.slice(0, t.provisional); } canReadlink() { - if (this.#P) return true; + if (this.#T) return true; if (!this.parent) return false; - let t = this.#e & j; - return !(t !== N && t !== Q || this.#e & Vt || this.#e & W); + let t = this.#s & N; + return !(t !== L && t !== it || this.#s & Jt || this.#s & B); } calledReaddir() { - return !!(this.#e & xe); + return !!(this.#s & qe); } isENOENT() { - return !!(this.#e & W); + return !!(this.#s & B); } isNamed(t) { - return this.nocase ? this.#O === Kt(t) : this.#O === wt(t); + return this.nocase ? this.#E === Qt(t) : this.#E === _t2(t); } async readlink() { - let t = this.#P; + let t = this.#T; if (t) return t; if (this.canReadlink() && this.parent) try { let e = await this.#t.promises.readlink(this.fullpath()), s = (await this.parent.realpath())?.resolve(e); - if (s) return this.#P = s; + if (s) return this.#T = s; } catch (e) { - this.#M(e.code); + this.#R(e.code); return; } } readlinkSync() { - let t = this.#P; + let t = this.#T; if (t) return t; if (this.canReadlink() && this.parent) try { let e = this.#t.readlinkSync(this.fullpath()), s = this.parent.realpathSync()?.resolve(e); - if (s) return this.#P = s; + if (s) return this.#T = s; } catch (e) { - this.#M(e.code); + this.#R(e.code); return; } } - #W(t) { - this.#e |= xe; + #B(t) { + this.#s |= qe; for (let e = t.provisional; e < t.length; e++) { let s = t[e]; - s && s.#_(); + s && s.#A(); } } - #_() { - this.#e & W || (this.#e = (this.#e | W) & dt, this.#$()); + #A() { + this.#s & B || (this.#s = (this.#s | B) & bt, this.#$()); } #$() { let t = this.children(); t.provisional = 0; - for (let e of t) e.#_(); + for (let e of t) e.#A(); } - #L() { - this.#e |= Xt, this.#j(); + #D() { + this.#s |= te, this.#j(); } #j() { - if (this.#e & gt) return; - let t = this.#e; - (t & j) === G && (t &= dt), this.#e = t | gt, this.#$(); + if (this.#s & vt) return; + let t = this.#s; + (t & N) === I && (t &= bt), this.#s = t | vt, this.#$(); } - #B(t = "") { - t === "ENOTDIR" || t === "EPERM" ? this.#j() : t === "ENOENT" ? this.#_() : this.children().provisional = 0; + #z(t = "") { + t === "ENOTDIR" || t === "EPERM" ? this.#j() : t === "ENOENT" ? this.#A() : this.children().provisional = 0; } - #k(t = "") { - t === "ENOTDIR" ? this.parent.#j() : t === "ENOENT" && this.#_(); + #x(t = "") { + t === "ENOTDIR" ? this.parent.#j() : t === "ENOENT" && this.#A(); } - #M(t = "") { - let e = this.#e; - e |= Vt, t === "ENOENT" && (e |= W), (t === "EINVAL" || t === "UNKNOWN") && (e &= dt), this.#e = e, t === "ENOTDIR" && this.parent && this.parent.#j(); - } - #I(t, e) { - return this.#z(t, e) || this.#G(t, e); + #R(t = "") { + let e = this.#s; + e |= Jt, t === "ENOENT" && (e |= B), (t === "EINVAL" || t === "UNKNOWN") && (e &= bt), this.#s = e, t === "ENOTDIR" && this.parent && this.parent.#j(); } #G(t, e) { - let s = Te(t), i = this.newChild(t.name, s, { parent: this }), r = i.#e & j; - return r !== G && r !== Q && r !== N && (i.#e |= gt), e.unshift(i), e.provisional++, i; + return this.#U(t, e) || this.#N(t, e); } - #z(t, e) { + #N(t, e) { + let s = He(t), i = this.newChild(t.name, s, { parent: this }), r = i.#s & N; + return r !== I && r !== it && r !== L && (i.#s |= vt), e.unshift(i), e.provisional++, i; + } + #U(t, e) { for (let s = e.provisional; s < e.length; s++) { let i = e[s]; - if ((this.nocase ? Kt(t.name) : wt(t.name)) === i.#O) return this.#l(t, i, s, e); + if ((this.nocase ? Qt(t.name) : _t2(t.name)) === i.#E) return this.#V(t, i, s, e); } } - #l(t, e, s, i) { + #V(t, e, s, i) { let r = e.name; - return e.#e = e.#e & dt | Te(t), r !== t.name && (e.name = t.name), s !== i.provisional && (s === i.length - 1 ? i.pop() : i.splice(s, 1), i.unshift(e)), i.provisional++, e; + return e.#s = e.#s & bt | He(t), r !== t.name && (e.name = t.name), s !== i.provisional && (s === i.length - 1 ? i.pop() : i.splice(s, 1), i.unshift(e)), i.provisional++, e; } async lstat() { - if ((this.#e & W) === 0) try { - return this.#U(await this.#t.promises.lstat(this.fullpath())), this; + if ((this.#s & B) === 0) try { + return this.#q(await this.#t.promises.lstat(this.fullpath())), this; } catch (t) { - this.#k(t.code); + this.#x(t.code); } } lstatSync() { - if ((this.#e & W) === 0) try { - return this.#U(this.#t.lstatSync(this.fullpath())), this; + if ((this.#s & B) === 0) try { + return this.#q(this.#t.lstatSync(this.fullpath())), this; } catch (t) { - this.#k(t.code); + this.#x(t.code); } } - #U(t) { - let { atime: e, atimeMs: s, birthtime: i, birthtimeMs: r, blksize: h, blocks: o, ctime: a, ctimeMs: l, dev: f, gid: c, ino: d, mode: u, mtime: m, mtimeMs: p, nlink: b, rdev: w, size: v, uid: E } = t; - this.#y = e, this.#a = s, this.#m = i, this.#v = r, this.#c = h, this.#u = o, this.#R = a, this.#d = l, this.#s = f, this.#S = c, this.#o = d, this.#n = u, this.#p = m, this.#i = p, this.#r = b, this.#w = w, this.#f = v, this.#h = E; - let y = Te(t); - this.#e = this.#e & dt | y | ys, y !== N && y !== G && y !== Q && (this.#e |= gt); - } - #N = []; - #A = false; #q(t) { - this.#A = false; - let e = this.#N.slice(); - this.#N.length = 0, e.forEach((s) => s(null, t)); + let { atime: e, atimeMs: s, birthtime: i, birthtimeMs: r, blksize: h, blocks: a, ctime: o, ctimeMs: l, dev: c, gid: u, ino: p, mode: d, mtime: g, mtimeMs: f, nlink: b, rdev: m, size: y, uid: _2 } = t; + this.#b = e, this.#l = s, this.#y = i, this.#_ = r, this.#p = h, this.#a = a, this.#v = o, this.#w = l, this.#i = c, this.#d = u, this.#o = p, this.#e = d, this.#u = g, this.#r = f, this.#h = b, this.#c = m, this.#m = y, this.#n = _2; + let v = He(t); + this.#s = this.#s & bt | v | Ks, v !== L && v !== I && v !== it && (this.#s |= vt); + } + #L = []; + #f = false; + #H(t) { + this.#f = false; + let e = this.#L.slice(); + this.#L.length = 0, e.forEach((s) => s(null, t)); } readdirCB(t, e = false) { if (!this.canReaddir()) { @@ -136965,36 +137445,36 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur e ? t(null, r) : queueMicrotask(() => t(null, r)); return; } - if (this.#N.push(t), this.#A) return; - this.#A = true; + if (this.#L.push(t), this.#f) return; + this.#f = true; let i = this.fullpath(); this.#t.readdir(i, { withFileTypes: true }, (r, h) => { - if (r) this.#B(r.code), s.provisional = 0; + if (r) this.#z(r.code), s.provisional = 0; else { - for (let o of h) this.#I(o, s); - this.#W(s); + for (let a of h) this.#G(a, s); + this.#B(s); } - this.#q(s.slice(0, s.provisional)); + this.#H(s.slice(0, s.provisional)); }); } - #H; + #I; async readdir() { if (!this.canReaddir()) return []; let t = this.children(); if (this.calledReaddir()) return t.slice(0, t.provisional); let e = this.fullpath(); - if (this.#H) await this.#H; + if (this.#I) await this.#I; else { let s = () => { }; - this.#H = new Promise((i) => s = i); + this.#I = new Promise((i) => s = i); try { - for (let i of await this.#t.promises.readdir(e, { withFileTypes: true })) this.#I(i, t); - this.#W(t); + for (let i of await this.#t.promises.readdir(e, { withFileTypes: true })) this.#G(i, t); + this.#B(t); } catch (i) { - this.#B(i.code), t.provisional = 0; + this.#z(i.code), t.provisional = 0; } - this.#H = void 0, s(); + this.#I = void 0, s(); } return t.slice(0, t.provisional); } @@ -137004,75 +137484,75 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur if (this.calledReaddir()) return t.slice(0, t.provisional); let e = this.fullpath(); try { - for (let s of this.#t.readdirSync(e, { withFileTypes: true })) this.#I(s, t); - this.#W(t); + for (let s of this.#t.readdirSync(e, { withFileTypes: true })) this.#G(s, t); + this.#B(t); } catch (s) { - this.#B(s.code), t.provisional = 0; + this.#z(s.code), t.provisional = 0; } return t.slice(0, t.provisional); } canReaddir() { - if (this.#e & Ss) return false; - let t = j & this.#e; - return t === N || t === G || t === Q; + if (this.#s & Vs) return false; + let t = N & this.#s; + return t === L || t === I || t === it; } shouldWalk(t, e) { - return (this.#e & G) === G && !(this.#e & Ss) && !t.has(this) && (!e || e(this)); + return (this.#s & I) === I && !(this.#s & Vs) && !t.has(this) && (!e || e(this)); } async realpath() { - if (this.#C) return this.#C; - if (!((Xt | Vt | W) & this.#e)) try { + if (this.#k) return this.#k; + if (!((te | Jt | B) & this.#s)) try { let t = await this.#t.promises.realpath(this.fullpath()); - return this.#C = this.resolve(t); + return this.#k = this.resolve(t); } catch { - this.#L(); + this.#D(); } } realpathSync() { - if (this.#C) return this.#C; - if (!((Xt | Vt | W) & this.#e)) try { + if (this.#k) return this.#k; + if (!((te | Jt | B) & this.#s)) try { let t = this.#t.realpathSync(this.fullpath()); - return this.#C = this.resolve(t); + return this.#k = this.resolve(t); } catch { - this.#L(); + this.#D(); } } - [ks](t) { + [ri](t) { if (t === this) return; t.isCWD = false, this.isCWD = true; let e = /* @__PURE__ */ new Set([]), s = [], i = this; - for (; i && i.parent; ) e.add(i), i.#E = s.join(this.sep), i.#T = s.join("/"), i = i.parent, s.push(".."); - for (i = t; i && i.parent && !e.has(i); ) i.#E = void 0, i.#T = void 0, i = i.parent; + for (; i && i.parent; ) e.add(i), i.#C = s.join(this.sep), i.#M = s.join("/"), i = i.parent, s.push(".."); + for (i = t; i && i.parent && !e.has(i); ) i.#C = void 0, i.#M = void 0, i = i.parent; } }; - _2.PathBase = A; - var yt = class n extends A { + E.PathBase = R; + var Ot = class n extends R { sep = "\\"; - splitSep = _r2; - constructor(t, e = N, s, i, r, h, o) { - super(t, e, s, i, r, h, o); + splitSep = Gr; + constructor(t, e = L, s, i, r, h, a) { + super(t, e, s, i, r, h, a); } - newChild(t, e = N, s = {}) { + newChild(t, e = L, s = {}) { return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s); } getRootString(t) { - return Yt.win32.parse(t).root; + return Wr.exec(t)?.[0] ?? ee.win32.parse(t).root; } getRoot(t) { - if (t = Er(t.toUpperCase()), t === this.root.name) return this.root; + if (t = Xs(t.toUpperCase()), t === this.root.name || /^[\\/]$/.test(t)) return this.root; for (let [e, s] of Object.entries(this.roots)) if (this.sameRoot(t, e)) return this.roots[t] = s; - return this.roots[t] = new Et(t, this).root; + return this.roots[t] = new kt(t, { nocase: this.nocase, fs: this.fs }).root; } sameRoot(t, e = this.root.name) { - return t = t.toUpperCase().replace(/\//g, "\\").replace(Os, "$1\\"), t === e; + return Xs(t.toUpperCase()) === e; } }; - _2.PathWin32 = yt; - var St = class n extends A { + E.PathWin32 = Ot; + var Ct = class n extends R { splitSep = "/"; sep = "/"; - constructor(t, e = N, s, i, r, h, o) { - super(t, e, s, i, r, h, o); + constructor(t, e = L, s, i, r, h, a) { + super(t, e, s, i, r, h, a); } getRootString(t) { return t.startsWith("/") ? "/" : ""; @@ -137080,32 +137560,32 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur getRoot(t) { return this.root; } - newChild(t, e = N, s = {}) { + newChild(t, e = L, s = {}) { return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s); } }; - _2.PathPosix = St; - var vt = class { + E.PathPosix = Ct; + var At = class { root; rootPath; roots; cwd; #t; - #s; - #n; + #i; + #e; nocase; - #r; - constructor(t = process.cwd(), e, s, { nocase: i, childrenCacheSize: r = 16 * 1024, fs: h = mt } = {}) { - this.#r = _s2(h), (t instanceof URL || t.startsWith("file://")) && (t = (0, yr.fileURLToPath)(t)); - let o = e.resolve(t); - this.roots = /* @__PURE__ */ Object.create(null), this.rootPath = this.parseRootPath(o), this.#t = new bt(), this.#s = new bt(), this.#n = new Jt(r); - let a = o.substring(this.rootPath.length).split(s); - if (a.length === 1 && !a[0] && a.pop(), i === void 0) throw new TypeError("must provide nocase setting to PathScurryBase ctor"); - this.nocase = i, this.root = this.newRoot(this.#r), this.roots[this.rootPath] = this.root; - let l = this.root, f = a.length - 1, c = e.sep, d = this.rootPath, u = false; - for (let m of a) { - let p = f--; - l = l.child(m, { relative: new Array(p).fill("..").join(c), relativePosix: new Array(p).fill("..").join("/"), fullpath: d += (u ? "" : c) + m }), u = true; + #h; + constructor(t = process.cwd(), e, s, { nocase: i, childrenCacheSize: r = 16 * 1024, fs: h = St } = {}) { + this.#h = Js(h), (t instanceof URL || t.startsWith("file://")) && (t = (0, Tr.fileURLToPath)(t)); + let a = e.resolve(t); + this.roots = /* @__PURE__ */ Object.create(null), this.rootPath = this.parseRootPath(a), this.#t = new Et(), this.#i = new Et(), this.#e = new se(r); + let o = a.substring(this.rootPath.length).split(s); + if (o.length === 1 && !o[0] && o.pop(), i === void 0) throw new TypeError("must provide nocase setting to PathScurryBase ctor"); + this.nocase = i, this.root = this.newRoot(this.#h), this.roots[this.rootPath] = this.root; + let l = this.root, c = o.length - 1, u = e.sep, p = this.rootPath, d = false; + for (let g of o) { + let f = c--; + l = l.child(g, { relative: new Array(f).fill("..").join(u), relativePosix: new Array(f).fill("..").join("/"), fullpath: p += (d ? "" : u) + g }), d = true; } this.cwd = l; } @@ -137113,7 +137593,7 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur return typeof t == "string" && (t = this.cwd.resolve(t)), t.depth(); } childrenCache() { - return this.#n; + return this.#e; } resolve(...t) { let e = ""; @@ -137132,10 +137612,10 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur let h = t[r]; if (!(!h || h === ".") && (e = e ? `${h}/${e}` : h, this.isAbsolute(h))) break; } - let s = this.#s.get(e); + let s = this.#i.get(e); if (s !== void 0) return s; let i = this.cwd.resolve(e).fullpathPosix(); - return this.#s.set(e, i), i; + return this.#i.set(e, i), i; } relative(t = this.cwd) { return typeof t == "string" && (t = this.cwd.resolve(t)), t.relative(); @@ -137150,7 +137630,7 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur return typeof t == "string" && (t = this.cwd.resolve(t)), (t.parent || t).fullpath(); } async readdir(t = this.cwd, e = { withFileTypes: true }) { - typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof A || (e = t, t = this.cwd); + typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd); let { withFileTypes: s } = e; if (t.canReaddir()) { let i = await t.readdir(); @@ -137158,7 +137638,7 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur } else return []; } readdirSync(t = this.cwd, e = { withFileTypes: true }) { - typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof A || (e = t, t = this.cwd); + typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd); let { withFileTypes: s = true } = e; return t.canReaddir() ? s ? t.readdirSync() : t.readdirSync().map((i) => i.name) : []; } @@ -137169,275 +137649,279 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstatSync(); } async readlink(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) { - typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof A || (e = t.withFileTypes, t = this.cwd); + typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd); let s = await t.readlink(); return e ? s : s?.fullpath(); } readlinkSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) { - typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof A || (e = t.withFileTypes, t = this.cwd); + typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd); let s = t.readlinkSync(); return e ? s : s?.fullpath(); } async realpath(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) { - typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof A || (e = t.withFileTypes, t = this.cwd); + typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd); let s = await t.realpath(); return e ? s : s?.fullpath(); } realpathSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) { - typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof A || (e = t.withFileTypes, t = this.cwd); + typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd); let s = t.realpathSync(); return e ? s : s?.fullpath(); } async walk(t = this.cwd, e = {}) { - typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof A || (e = t, t = this.cwd); - let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: h } = e, o = []; - (!r || r(t)) && o.push(s ? t : t.fullpath()); - let a = /* @__PURE__ */ new Set(), l = (c, d) => { - a.add(c), c.readdirCB((u, m) => { - if (u) return d(u); - let p = m.length; - if (!p) return d(); + typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd); + let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: h } = e, a = []; + (!r || r(t)) && a.push(s ? t : t.fullpath()); + let o = /* @__PURE__ */ new Set(), l = (u, p) => { + o.add(u), u.readdirCB((d, g) => { + if (d) return p(d); + let f = g.length; + if (!f) return p(); let b = () => { - --p === 0 && d(); + --f === 0 && p(); }; - for (let w of m) (!r || r(w)) && o.push(s ? w : w.fullpath()), i && w.isSymbolicLink() ? w.realpath().then((v) => v?.isUnknown() ? v.lstat() : v).then((v) => v?.shouldWalk(a, h) ? l(v, b) : b()) : w.shouldWalk(a, h) ? l(w, b) : b(); + for (let m of g) (!r || r(m)) && a.push(s ? m : m.fullpath()), i && m.isSymbolicLink() ? m.realpath().then((y) => y?.isUnknown() ? y.lstat() : y).then((y) => y?.shouldWalk(o, h) ? l(y, b) : b()) : m.shouldWalk(o, h) ? l(m, b) : b(); }, true); - }, f = t; - return new Promise((c, d) => { - l(f, (u) => { - if (u) return d(u); - c(o); + }, c = t; + return new Promise((u, p) => { + l(c, (d) => { + if (d) return p(d); + u(a); }); }); } walkSync(t = this.cwd, e = {}) { - typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof A || (e = t, t = this.cwd); - let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: h } = e, o = []; - (!r || r(t)) && o.push(s ? t : t.fullpath()); - let a = /* @__PURE__ */ new Set([t]); - for (let l of a) { - let f = l.readdirSync(); - for (let c of f) { - (!r || r(c)) && o.push(s ? c : c.fullpath()); - let d = c; - if (c.isSymbolicLink()) { - if (!(i && (d = c.realpathSync()))) continue; - d.isUnknown() && d.lstatSync(); + typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd); + let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: h } = e, a = []; + (!r || r(t)) && a.push(s ? t : t.fullpath()); + let o = /* @__PURE__ */ new Set([t]); + for (let l of o) { + let c = l.readdirSync(); + for (let u of c) { + (!r || r(u)) && a.push(s ? u : u.fullpath()); + let p = u; + if (u.isSymbolicLink()) { + if (!(i && (p = u.realpathSync()))) continue; + p.isUnknown() && p.lstatSync(); } - d.shouldWalk(a, h) && a.add(d); + p.shouldWalk(o, h) && o.add(p); } } - return o; + return a; } [Symbol.asyncIterator]() { return this.iterate(); } iterate(t = this.cwd, e = {}) { - return typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof A || (e = t, t = this.cwd), this.stream(t, e)[Symbol.asyncIterator](); + return typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd), this.stream(t, e)[Symbol.asyncIterator](); } [Symbol.iterator]() { return this.iterateSync(); } *iterateSync(t = this.cwd, e = {}) { - typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof A || (e = t, t = this.cwd); + typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd); let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: h } = e; (!r || r(t)) && (yield s ? t : t.fullpath()); - let o = /* @__PURE__ */ new Set([t]); - for (let a of o) { - let l = a.readdirSync(); - for (let f of l) { - (!r || r(f)) && (yield s ? f : f.fullpath()); - let c = f; - if (f.isSymbolicLink()) { - if (!(i && (c = f.realpathSync()))) continue; - c.isUnknown() && c.lstatSync(); + let a = /* @__PURE__ */ new Set([t]); + for (let o of a) { + let l = o.readdirSync(); + for (let c of l) { + (!r || r(c)) && (yield s ? c : c.fullpath()); + let u = c; + if (c.isSymbolicLink()) { + if (!(i && (u = c.realpathSync()))) continue; + u.isUnknown() && u.lstatSync(); } - c.shouldWalk(o, h) && o.add(c); + u.shouldWalk(a, h) && a.add(u); } } } stream(t = this.cwd, e = {}) { - typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof A || (e = t, t = this.cwd); - let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: h } = e, o = new bs.Minipass({ objectMode: true }); - (!r || r(t)) && o.write(s ? t : t.fullpath()); - let a = /* @__PURE__ */ new Set(), l = [t], f = 0, c = () => { - let d = false; - for (; !d; ) { - let u = l.shift(); - if (!u) { - f === 0 && o.end(); + typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd); + let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: h } = e, a = new Hs.Minipass({ objectMode: true }); + (!r || r(t)) && a.write(s ? t : t.fullpath()); + let o = /* @__PURE__ */ new Set(), l = [t], c = 0, u = () => { + let p = false; + for (; !p; ) { + let d = l.shift(); + if (!d) { + c === 0 && a.end(); return; } - f++, a.add(u); - let m = (b, w, v = false) => { - if (b) return o.emit("error", b); - if (i && !v) { - let E = []; - for (let y of w) y.isSymbolicLink() && E.push(y.realpath().then((S) => S?.isUnknown() ? S.lstat() : S)); - if (E.length) { - Promise.all(E).then(() => m(null, w, true)); + c++, o.add(d); + let g = (b, m, y = false) => { + if (b) return a.emit("error", b); + if (i && !y) { + let _2 = []; + for (let v of m) v.isSymbolicLink() && _2.push(v.realpath().then((S) => S?.isUnknown() ? S.lstat() : S)); + if (_2.length) { + Promise.all(_2).then(() => g(null, m, true)); return; } } - for (let E of w) E && (!r || r(E)) && (o.write(s ? E : E.fullpath()) || (d = true)); - f--; - for (let E of w) { - let y = E.realpathCached() || E; - y.shouldWalk(a, h) && l.push(y); + for (let _2 of m) _2 && (!r || r(_2)) && (a.write(s ? _2 : _2.fullpath()) || (p = true)); + c--; + for (let _2 of m) { + let v = _2.realpathCached() || _2; + v.shouldWalk(o, h) && l.push(v); } - d && !o.flowing ? o.once("drain", c) : p || c(); - }, p = true; - u.readdirCB(m, true), p = false; + p && !a.flowing ? a.once("drain", u) : f || u(); + }, f = true; + d.readdirCB(g, true), f = false; } }; - return c(), o; + return u(), a; } streamSync(t = this.cwd, e = {}) { - typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof A || (e = t, t = this.cwd); - let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: h } = e, o = new bs.Minipass({ objectMode: true }), a = /* @__PURE__ */ new Set(); - (!r || r(t)) && o.write(s ? t : t.fullpath()); - let l = [t], f = 0, c = () => { - let d = false; - for (; !d; ) { - let u = l.shift(); - if (!u) { - f === 0 && o.end(); + typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd); + let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: h } = e, a = new Hs.Minipass({ objectMode: true }), o = /* @__PURE__ */ new Set(); + (!r || r(t)) && a.write(s ? t : t.fullpath()); + let l = [t], c = 0, u = () => { + let p = false; + for (; !p; ) { + let d = l.shift(); + if (!d) { + c === 0 && a.end(); return; } - f++, a.add(u); - let m = u.readdirSync(); - for (let p of m) (!r || r(p)) && (o.write(s ? p : p.fullpath()) || (d = true)); - f--; - for (let p of m) { - let b = p; - if (p.isSymbolicLink()) { - if (!(i && (b = p.realpathSync()))) continue; + c++, o.add(d); + let g = d.readdirSync(); + for (let f of g) (!r || r(f)) && (a.write(s ? f : f.fullpath()) || (p = true)); + c--; + for (let f of g) { + let b = f; + if (f.isSymbolicLink()) { + if (!(i && (b = f.realpathSync()))) continue; b.isUnknown() && b.lstatSync(); } - b.shouldWalk(a, h) && l.push(b); + b.shouldWalk(o, h) && l.push(b); } } - d && !o.flowing && o.once("drain", c); + p && !a.flowing && a.once("drain", u); }; - return c(), o; + return u(), a; } chdir(t = this.cwd) { let e = this.cwd; - this.cwd = typeof t == "string" ? this.cwd.resolve(t) : t, this.cwd[ks](e); + this.cwd = typeof t == "string" ? this.cwd.resolve(t) : t, this.cwd[ri](e); } }; - _2.PathScurryBase = vt; - var Et = class extends vt { + E.PathScurryBase = At; + var kt = class extends At { sep = "\\"; constructor(t = process.cwd(), e = {}) { let { nocase: s = true } = e; - super(t, Yt.win32, "\\", { ...e, nocase: s }), this.nocase = s; + typeof t == "string" && !t.startsWith("file://") && (t = t.replace(Br, "").replace(zr, "\\")), super(t, ee.win32, "\\", { ...e, nocase: s }), this.nocase = s; for (let i = this.cwd; i; i = i.parent) i.nocase = this.nocase; } parseRootPath(t) { - return Yt.win32.parse(t).root.toUpperCase(); + return ee.win32.parse(t).root.toUpperCase(); } newRoot(t) { - return new yt(this.rootPath, G, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t }); + return new Ot(this.rootPath, I, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t }); } isAbsolute(t) { return t.startsWith("/") || t.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(t); } }; - _2.PathScurryWin32 = Et; - var _t2 = class extends vt { + E.PathScurryWin32 = kt; + var Mt = class extends At { sep = "/"; constructor(t = process.cwd(), e = {}) { let { nocase: s = false } = e; - super(t, Yt.posix, "/", { ...e, nocase: s }), this.nocase = s; + super(t, ee.posix, "/", { ...e, nocase: s }), this.nocase = s; } parseRootPath(t) { return "/"; } newRoot(t) { - return new St(this.rootPath, G, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t }); + return new Ct(this.rootPath, I, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t }); } isAbsolute(t) { return t.startsWith("/"); } }; - _2.PathScurryPosix = _t2; - var Zt = class extends _t2 { + E.PathScurryPosix = Mt; + var ie = class extends Mt { constructor(t = process.cwd(), e = {}) { let { nocase: s = true } = e; super(t, { ...e, nocase: s }); } }; - _2.PathScurryDarwin = Zt; - _2.Path = process.platform === "win32" ? yt : St; - _2.PathScurry = process.platform === "win32" ? Et : process.platform === "darwin" ? Zt : _t2; + E.PathScurryDarwin = ie; + E.Path = process.platform === "win32" ? Ot : Ct; + E.PathScurry = process.platform === "win32" ? kt : process.platform === "darwin" ? ie : Mt; }); - var Re = R((te) => { + var Ke = x((ne) => { "use strict"; - Object.defineProperty(te, "__esModule", { value: true }); - te.Pattern = void 0; - var xr = H(), Tr = (n) => n.length >= 1, Cr = (n) => n.length >= 1, Rr = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom"), Ce = class n { + Object.defineProperty(ne, "__esModule", { value: true }); + ne.Pattern = void 0; + var Ur = Y(), $r = (n) => n.length >= 1, qr = (n) => n.length >= 1, Hr = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom"), Xe = class n { #t; - #s; - #n; + #i; + #e; length; - #r; #h; - #S; - #w; + #n; + #d; #c; + #p; #o; - #f = true; + #m = true; constructor(t, e, s, i) { - if (!Tr(t)) throw new TypeError("empty pattern list"); - if (!Cr(e)) throw new TypeError("empty glob list"); + if (!$r(t)) throw new TypeError("empty pattern list"); + if (!qr(e)) throw new TypeError("empty glob list"); if (e.length !== t.length) throw new TypeError("mismatched pattern list and glob list lengths"); if (this.length = t.length, s < 0 || s >= this.length) throw new TypeError("index out of range"); - if (this.#t = t, this.#s = e, this.#n = s, this.#r = i, this.#n === 0) { + if (this.#t = t, this.#i = e, this.#e = s, this.#h = i, this.#e === 0) { if (this.isUNC()) { - let [r, h, o, a, ...l] = this.#t, [f, c, d, u, ...m] = this.#s; - l[0] === "" && (l.shift(), m.shift()); - let p = [r, h, o, a, ""].join("/"), b = [f, c, d, u, ""].join("/"); - this.#t = [p, ...l], this.#s = [b, ...m], this.length = this.#t.length; + let r = this.#a() ? 6 : 4, h = this.#t.slice(0, r), a = this.#i.slice(0, r), o = this.#t.slice(r), l = this.#i.slice(r); + o[0] === "" && (o.shift(), l.shift()); + let c = [...h, ""].join("/"), u = [...a, ""].join("/"); + this.#t = [c, ...o], this.#i = [u, ...l], this.length = this.#t.length; } else if (this.isDrive() || this.isAbsolute()) { - let [r, ...h] = this.#t, [o, ...a] = this.#s; - h[0] === "" && (h.shift(), a.shift()); - let l = r + "/", f = o + "/"; - this.#t = [l, ...h], this.#s = [f, ...a], this.length = this.#t.length; + let [r, ...h] = this.#t, [a, ...o] = this.#i; + h[0] === "" && (h.shift(), o.shift()); + let l = `${r}/`, c = `${a}/`; + this.#t = [l, ...h], this.#i = [c, ...o], this.length = this.#t.length; } } } - [Rr]() { - return "Pattern <" + this.#s.slice(this.#n).join("/") + ">"; + [Hr]() { + return `Pattern <${this.#i.slice(this.#e).join("/")}>`; } pattern() { - return this.#t[this.#n]; + return this.#t[this.#e]; } isString() { - return typeof this.#t[this.#n] == "string"; + return typeof this.#t[this.#e] == "string"; } isGlobstar() { - return this.#t[this.#n] === xr.GLOBSTAR; + return this.#t[this.#e] === Ur.GLOBSTAR; } - isRegExp() { - return this.#t[this.#n] instanceof RegExp; + isMatcher() { + return typeof this.#t[this.#e] == "object"; } globString() { - return this.#S = this.#S || (this.#n === 0 ? this.isAbsolute() ? this.#s[0] + this.#s.slice(1).join("/") : this.#s.join("/") : this.#s.slice(this.#n).join("/")); + return this.#d = this.#d || (this.#e === 0 ? this.isAbsolute() ? this.#i[0] + this.#i.slice(1).join("/") : this.#i.join("/") : this.#i.slice(this.#e).join("/")); } hasMore() { - return this.length > this.#n + 1; + return this.length > this.#e + 1; } rest() { - return this.#h !== void 0 ? this.#h : this.hasMore() ? (this.#h = new n(this.#t, this.#s, this.#n + 1, this.#r), this.#h.#o = this.#o, this.#h.#c = this.#c, this.#h.#w = this.#w, this.#h) : this.#h = null; + return this.#n !== void 0 ? this.#n : this.hasMore() ? (this.#n = new n(this.#t, this.#i, this.#e + 1, this.#h), this.#n.#o = this.#o, this.#n.#p = this.#p, this.#n.#c = this.#c, this.#n) : this.#n = null; + } + #a() { + let t = this.#t; + return t[2] === "?" && typeof t[3] == "string" && /^unc$/i.test(t[3]); } isUNC() { - let t = this.#t; - return this.#c !== void 0 ? this.#c : this.#c = this.#r === "win32" && this.#n === 0 && t[0] === "" && t[1] === "" && typeof t[2] == "string" && !!t[2] && typeof t[3] == "string" && !!t[3]; + let t = this.#t, e = this.#a() ? 4 : 2; + return this.#p !== void 0 ? this.#p : this.#p = this.#h === "win32" && this.#e === 0 && t[0] === "" && t[1] === "" && typeof t[e] == "string" && !!t[e] && typeof t[e + 1] == "string" && !!t[e + 1]; } isDrive() { let t = this.#t; - return this.#w !== void 0 ? this.#w : this.#w = this.#r === "win32" && this.#n === 0 && this.length > 1 && typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]); + return this.#c !== void 0 ? this.#c : this.#c = this.#h === "win32" && this.#e === 0 && this.length > 1 && typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]); } isAbsolute() { let t = this.#t; @@ -137445,40 +137929,43 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur } root() { let t = this.#t[0]; - return typeof t == "string" && this.isAbsolute() && this.#n === 0 ? t : ""; + return typeof t == "string" && this.isAbsolute() && this.#e === 0 ? t : ""; } checkFollowGlobstar() { - return !(this.#n === 0 || !this.isGlobstar() || !this.#f); + return !(this.#e === 0 || !this.isGlobstar() || !this.#m); } markFollowGlobstar() { - return this.#n === 0 || !this.isGlobstar() || !this.#f ? false : (this.#f = false, true); + return this.#e === 0 || !this.isGlobstar() || !this.#m ? false : (this.#m = false, true); } }; - te.Pattern = Ce; + ne.Pattern = Xe; }); - var ke = R((ee) => { + var Ze = x((he) => { "use strict"; - Object.defineProperty(ee, "__esModule", { value: true }); - ee.Ignore = void 0; - var Ps = H(), Ar = Re(), kr = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", Ae = class { + Object.defineProperty(he, "__esModule", { value: true }); + he.Ignore = void 0; + var Ve = Y(), Xr = Ke(), Kr = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", Ye = class { relative; relativeChildren; absolute; absoluteChildren; platform; mmopts; - constructor(t, { nobrace: e, nocase: s, noext: i, noglobstar: r, platform: h = kr }) { - this.relative = [], this.absolute = [], this.relativeChildren = [], this.absoluteChildren = [], this.platform = h, this.mmopts = { dot: true, nobrace: e, nocase: s, noext: i, noglobstar: r, optimizationLevel: 2, platform: h, nocomment: true, nonegate: true }; - for (let o of t) this.add(o); + slashRoot; + constructor(t, { nobrace: e, nocase: s, noext: i, noglobstar: r, normalize: h, platform: a = Kr, root: o, windowsPathsNoEscape: l, allowWindowsEscape: c }, u) { + this.relative = [], this.absolute = [], this.relativeChildren = [], this.absoluteChildren = [], this.platform = a, l = !!l || c === false, this.mmopts = { dot: true, nobrace: e, nocase: s, noext: i, noglobstar: r, normalize: h, optimizationLevel: 2, platform: a, nocomment: true, nonegate: true, windowsPathsNoEscape: l }; + let p = u?.resolve(o ?? "/").fullpath() ?? "/"; + this.slashRoot = (0, Ve.escape)(p.replace(/\\/g, "/").replace(/\/$/, ""), { windowsPathsNoEscape: l }); + for (let d of t) this.add(d); } add(t) { - let e = new Ps.Minimatch(t, this.mmopts); + let e = new Ve.Minimatch(t, this.mmopts); for (let s = 0; s < e.set.length; s++) { let i = e.set[s], r = e.globParts[s]; if (!i || !r) throw new Error("invalid pattern object"); for (; i[0] === "." && r[0] === "."; ) i.shift(), r.shift(); - let h = new Ar.Pattern(i, r, 0, this.platform), o = new Ps.Minimatch(h.globString(), this.mmopts), a = r[r.length - 1] === "**", l = h.isAbsolute(); - l ? this.absolute.push(o) : this.relative.push(o), a && (l ? this.absoluteChildren.push(o) : this.relativeChildren.push(o)); + let h = new Xr.Pattern(i, r, 0, this.platform), a = h.root() === "/" ? `${this.slashRoot}/${h.rest()?.globString() ?? ""}` : h.globString(), o = new Ve.Minimatch(a, this.mmopts), l = r[r.length - 1] === "**", c = h.isAbsolute(); + c ? this.absolute.push(o) : this.relative.push(o), l && (c ? this.absoluteChildren.push(o) : this.relativeChildren.push(o)); } } ignored(t) { @@ -137488,47 +137975,51 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur return false; } childrenIgnored(t) { - let e = t.fullpath() + "/", s = (t.relative() || ".") + "/"; + let e = `${t.fullpath()}/`, s = `${t.relative() || "."}/`; for (let i of this.relativeChildren) if (i.match(s)) return true; for (let i of this.absoluteChildren) if (i.match(e)) return true; return false; } }; - ee.Ignore = Ae; + he.Ignore = Ye; }); - var Fs = R((z) => { + var oi = x((U) => { "use strict"; - Object.defineProperty(z, "__esModule", { value: true }); - z.Processor = z.SubWalks = z.MatchRecord = z.HasWalkedCache = void 0; - var Ds = H(), se = class n { + Object.defineProperty(U, "__esModule", { value: true }); + U.Processor = U.SubWalks = U.MatchRecord = U.HasWalkedCache = void 0; + var hi = Y(), oe = class n { + parent; store; - constructor(t = /* @__PURE__ */ new Map()) { - this.store = t; + constructor(t) { + this.parent = t; } copy() { - return new n(new Map(this.store)); + return new n(this); + } + #t(t) { + let e = this.store?.get(t); + return e || !this.parent ? e : this.parent.#t(t); } hasWalked(t, e) { - return this.store.get(t.fullpath())?.has(e.globString()); + return !!this.#t(t.fullpath())?.has(e.globString()); } storeWalked(t, e) { - let s = t.fullpath(), i = this.store.get(s); - i ? i.add(e.globString()) : this.store.set(s, /* @__PURE__ */ new Set([e.globString()])); + let s = t.fullpath(), i = this.#t(s); + i ? i.add(e.globString()) : (this.store ??= /* @__PURE__ */ new Map()).set(s, /* @__PURE__ */ new Set([e.globString()])); } }; - z.HasWalkedCache = se; - var ie = class { + U.HasWalkedCache = oe; + var ae = class n { + static ABSOLUTE = 2; + static IF_DIR = 1; store = /* @__PURE__ */ new Map(); add(t, e, s) { - let i = (e ? 2 : 0) | (s ? 1 : 0), r = this.store.get(t); + let i = (e ? n.ABSOLUTE : 0) | (s ? n.IF_DIR : 0), r = this.store.get(t); this.store.set(t, r === void 0 ? i : i & r); } - entries() { - return [...this.store.entries()].map(([t, e]) => [t, !!(e & 2), !!(e & 1)]); - } }; - z.MatchRecord = ie; - var re = class { + U.MatchRecord = ae; + var le = class { store = /* @__PURE__ */ new Map(); add(t, e) { if (!t.canReaddir()) return; @@ -137547,53 +138038,53 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur return [...this.store.keys()].filter((t) => t.canReaddir()); } }; - z.SubWalks = re; - var Me = class n { + U.SubWalks = le; + var Je = class n { hasWalkedCache; - matches = new ie(); - subwalks = new re(); + matches = new ae(); + subwalks = new le(); patterns; follow; dot; opts; constructor(t, e) { - this.opts = t, this.follow = !!t.follow, this.dot = !!t.dot, this.hasWalkedCache = e ? e.copy() : new se(); + this.opts = t, this.follow = !!t.follow, this.dot = !!t.dot, this.hasWalkedCache = e ? e.copy() : new oe(); } processPatterns(t, e) { this.patterns = e; let s = e.map((i) => [t, i]); for (let [i, r] of s) { this.hasWalkedCache.storeWalked(i, r); - let h = r.root(), o = r.isAbsolute() && this.opts.absolute !== false; + let h = r.root(), a = r.isAbsolute() && this.opts.absolute !== false; if (h) { i = i.resolve(h === "/" && this.opts.root !== void 0 ? this.opts.root : h); - let c = r.rest(); - if (c) r = c; + let u = r.rest(); + if (u) r = u; else { this.matches.add(i, true, false); continue; } } if (i.isENOENT()) continue; - let a, l, f = false; - for (; typeof (a = r.pattern()) == "string" && (l = r.rest()); ) i = i.resolve(a), r = l, f = true; - if (a = r.pattern(), l = r.rest(), f) { + let o, l, c = false; + for (; typeof (o = r.pattern()) == "string" && (l = r.rest()); ) i = i.resolve(o), r = l, c = true; + if (o = r.pattern(), l = r.rest(), c) { if (this.hasWalkedCache.hasWalked(i, r)) continue; this.hasWalkedCache.storeWalked(i, r); } - if (typeof a == "string") { - let c = a === ".." || a === "" || a === "."; - this.matches.add(i.resolve(a), o, c); + if (typeof o == "string") { + let u = o === ".." || o === "" || o === "."; + this.matches.add(i.resolve(o), a, u); continue; - } else if (a === Ds.GLOBSTAR) { + } else if (o === hi.GLOBSTAR) { (!i.isSymbolicLink() || this.follow || r.checkFollowGlobstar()) && this.subwalks.add(i, r); - let c = l?.pattern(), d = l?.rest(); - if (!l || (c === "" || c === ".") && !d) this.matches.add(i, o, c === "" || c === "."); - else if (c === "..") { - let u = i.parent || i; - d ? this.hasWalkedCache.hasWalked(u, d) || this.subwalks.add(u, d) : this.matches.add(u, o, true); + let u = l?.pattern(), p = l?.rest(); + if (!l || (u === "" || u === ".") && !p) this.matches.add(i, a, u === "" || u === "."); + else if (u === "..") { + let d = i.parent || i; + p ? this.hasWalkedCache.hasWalked(d, p) || this.subwalks.add(d, p) : this.matches.add(d, a, true); } - } else a instanceof RegExp && this.subwalks.add(i, r); + } else typeof o == "object" && this.subwalks.add(i, r); } return this; } @@ -137606,8 +138097,8 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur filterEntries(t, e) { let s = this.subwalks.get(t), i = this.child(); for (let r of e) for (let h of s) { - let o = h.isAbsolute(), a = h.pattern(), l = h.rest(); - a === Ds.GLOBSTAR ? i.testGlobstar(r, h, l, o) : a instanceof RegExp ? i.testRegExp(r, a, l, o) : i.testString(r, a, l, o); + let a = h.isAbsolute(), o = h.pattern(), l = h.rest(); + o === hi.GLOBSTAR ? i.testGlobstar(r, h, l, a) : typeof o == "object" ? i.testMatcher(r, o, l, a) : i.testString(r, o, l, a); } return i; } @@ -137618,23 +138109,23 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur else if (r === "..") { let h = t.parent || t; this.subwalks.add(h, s); - } else r instanceof RegExp && this.testRegExp(t, r, s.rest(), i); + } else typeof r == "object" && this.testMatcher(t, r, s.rest(), i); } } - testRegExp(t, e, s, i) { - e.test(t.name) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, false)); + testMatcher(t, e, s, i) { + e.testUnchecked(t.name) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, false)); } testString(t, e, s, i) { t.isNamed(e) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, false)); } }; - z.Processor = Me; + U.Processor = Je; }); - var Ls = R((X) => { + var li = x((Q) => { "use strict"; - Object.defineProperty(X, "__esModule", { value: true }); - X.GlobStream = X.GlobWalker = X.GlobUtil = void 0; - var Mr = Oe(), js = ke(), Ns = Fs(), Pr = (n, t) => typeof n == "string" ? new js.Ignore([n], t) : Array.isArray(n) ? new js.Ignore(n, t) : n, Ot = class { + Object.defineProperty(Q, "__esModule", { value: true }); + Q.GlobStream = Q.GlobWalker = Q.GlobUtil = void 0; + var Vr = $e(), ai = Ze(), Qe = oi(), { ABSOLUTE: ce, IF_DIR: ue } = Qe.MatchRecord, Yr = (n, t, e) => typeof n == "string" ? new ai.Ignore([n], t, e) : Array.isArray(n) ? new ai.Ignore(n, t, e) : n, xt = class { path; patterns; opts; @@ -137642,13 +138133,13 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur paused = false; aborted = false; #t = []; - #s; - #n; + #i; + #e; signal; maxDepth; includeChildMatches; constructor(t, e, s) { - if (this.patterns = t, this.path = e, this.opts = s, this.#n = !s.posix && s.platform === "win32" ? "\\" : "/", this.includeChildMatches = s.includeChildMatches !== false, (s.ignore || !this.includeChildMatches) && (this.#s = Pr(s.ignore ?? [], s), !this.includeChildMatches && typeof this.#s.add != "function")) { + if (this.patterns = t, this.path = e, this.opts = s, this.#e = !s.posix && s.platform === "win32" ? "\\" : "/", this.includeChildMatches = s.includeChildMatches !== false, (s.ignore || !this.includeChildMatches) && (this.#i = Yr(s.ignore ?? [], s, e), !this.includeChildMatches && typeof this.#i.add != "function")) { let i = "cannot ignore child matches, ignore lacks add() method."; throw new Error(i); } @@ -137656,11 +138147,11 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur this.#t.length = 0; })); } - #r(t) { - return this.seen.has(t) || !!this.#s?.ignored?.(t); - } #h(t) { - return !!this.#s?.childrenIgnored?.(t); + return this.seen.has(t) || !!this.#i?.ignored?.(t); + } + #n(t) { + return !!this.#i?.childrenIgnored?.(t); } pause() { this.paused = true; @@ -137672,55 +138163,57 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur for (; !this.paused && (t = this.#t.shift()); ) t(); } onResume(t) { - this.signal?.aborted || (this.paused ? this.#t.push(t) : t()); + this.paused ? this.#t.push(t) : t(); } async matchCheck(t, e) { if (e && this.opts.nodir) return; - let s; + let s, i; if (this.opts.realpath) { if (s = t.realpathCached() || await t.realpath(), !s) return; - t = s; + i = s; + } else i = t; + let h = i.isUnknown() || this.opts.stat ? await i.lstat() : i; + if (this.opts.follow && this.opts.nodir && h?.isSymbolicLink()) { + let a = await h.realpath(); + a && (a.isUnknown() || this.opts.stat) && await a.lstat(); } - let r = t.isUnknown() || this.opts.stat ? await t.lstat() : t; - if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) { - let h = await r.realpath(); - h && (h.isUnknown() || this.opts.stat) && await h.lstat(); - } - return this.matchCheckTest(r, e); + return this.matchCheckTest(h, e); } matchCheckTest(t, e) { - return t && (this.maxDepth === 1 / 0 || t.depth() <= this.maxDepth) && (!e || t.canReaddir()) && (!this.opts.nodir || !t.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !t.isSymbolicLink() || !t.realpathCached()?.isDirectory()) && !this.#r(t) ? t : void 0; + return t && (this.maxDepth === 1 / 0 || t.depth() <= this.maxDepth) && (!e || t.canReaddir()) && (!this.opts.nodir || !t.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !t.isSymbolicLink() || !t.realpathCached()?.isDirectory()) && !this.#h(t) ? t : void 0; } matchCheckSync(t, e) { if (e && this.opts.nodir) return; - let s; + let s, i; if (this.opts.realpath) { if (s = t.realpathCached() || t.realpathSync(), !s) return; - t = s; + i = s; + } else i = t; + let h = i.isUnknown() || this.opts.stat ? i.lstatSync() : i; + if (this.opts.follow && this.opts.nodir && h?.isSymbolicLink()) { + let a = h.realpathSync(); + a && (a?.isUnknown() || this.opts.stat) && a.lstatSync(); } - let r = t.isUnknown() || this.opts.stat ? t.lstatSync() : t; - if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) { - let h = r.realpathSync(); - h && (h?.isUnknown() || this.opts.stat) && h.lstatSync(); - } - return this.matchCheckTest(r, e); + return this.matchCheckTest(h, e); } matchFinish(t, e) { - if (this.#r(t)) return; - if (!this.includeChildMatches && this.#s?.add) { + this.#h(t) || this.#d(t, e); + } + #d(t, e) { + if (!this.includeChildMatches && this.#i?.add) { let r = `${t.relativePosix()}/**`; - this.#s.add(r); + this.#i.add(r); } let s = this.opts.absolute === void 0 ? e : this.opts.absolute; this.seen.add(t); - let i = this.opts.mark && t.isDirectory() ? this.#n : ""; + let i = this.opts.mark && t.isDirectory() ? this.#e : ""; if (this.opts.withFileTypes) this.matchEmit(t); else if (s) { let r = this.opts.posix ? t.fullpathPosix() : t.fullpath(); this.matchEmit(r + i); } else { - let r = this.opts.posix ? t.relativePosix() : t.relative(), h = this.opts.dotRelative && !r.startsWith(".." + this.#n) ? "." + this.#n : ""; - this.matchEmit(r ? h + r + i : "." + i); + let r = this.opts.posix ? t.relativePosix() : t.relative(), h = this.opts.dotRelative && !r.startsWith(`..${this.#e}`) ? `.${this.#e}` : ""; + this.matchEmit(r ? h + r + i : `.${i}`); } } async match(t, e, s) { @@ -137729,14 +138222,15 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur } matchSync(t, e, s) { let i = this.matchCheckSync(t, s); - i && this.matchFinish(i, e); + i && this.#d(i, e); } walkCB(t, e, s) { - this.signal?.aborted && s(), this.walkCB2(t, e, new Ns.Processor(this.opts), s); + if (this.signal?.aborted) return s(); + this.walkCB2(t, e, new Qe.Processor(this.opts), s); } walkCB2(t, e, s, i) { - if (this.#h(t)) return i(); - if (this.signal?.aborted && i(), this.paused) { + if (this.#n(t) || this.signal?.aborted) return i(); + if (this.paused) { this.onResume(() => this.walkCB2(t, e, s, i)); return; } @@ -137744,30 +138238,30 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur let r = 1, h = () => { --r === 0 && i(); }; - for (let [o, a, l] of s.matches.entries()) this.#r(o) || (r++, this.match(o, a, l).then(() => h())); - for (let o of s.subwalkTargets()) { - if (this.maxDepth !== 1 / 0 && o.depth() >= this.maxDepth) continue; + for (let [a, o] of s.matches.store) this.#h(a) || (r++, this.match(a, !!(o & ce), !!(o & ue)).then(() => h())); + for (let a of s.subwalkTargets()) { + if (this.maxDepth !== 1 / 0 && a.depth() >= this.maxDepth) continue; r++; - let a = o.readdirCached(); - o.calledReaddir() ? this.walkCB3(o, a, s, h) : o.readdirCB((l, f) => this.walkCB3(o, f, s, h), true); + let o = a.readdirCached(); + a.calledReaddir() ? this.walkCB3(a, o, s, h) : a.readdirCB((l, c) => this.walkCB3(a, c, s, h), true); } h(); } walkCB3(t, e, s, i) { - s = s.filterEntries(t, e); - let r = 1, h = () => { - --r === 0 && i(); + let r = s.filterEntries(t, e), h = 1, a = () => { + --h === 0 && i(); }; - for (let [o, a, l] of s.matches.entries()) this.#r(o) || (r++, this.match(o, a, l).then(() => h())); - for (let [o, a] of s.subwalks.entries()) r++, this.walkCB2(o, a, s.child(), h); - h(); + for (let [o, l] of r.matches.store) this.#h(o) || (h++, this.match(o, !!(l & ce), !!(l & ue)).then(() => a())); + for (let [o, l] of r.subwalks.entries()) h++, this.walkCB2(o, l, r.child(), a); + a(); } walkCBSync(t, e, s) { - this.signal?.aborted && s(), this.walkCB2Sync(t, e, new Ns.Processor(this.opts), s); + if (this.signal?.aborted) return s(); + this.walkCB2Sync(t, e, new Qe.Processor(this.opts), s); } walkCB2Sync(t, e, s, i) { - if (this.#h(t)) return i(); - if (this.signal?.aborted && i(), this.paused) { + if (this.#n(t) || this.signal?.aborted) return i(); + if (this.paused) { this.onResume(() => this.walkCB2Sync(t, e, s, i)); return; } @@ -137775,33 +138269,32 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur let r = 1, h = () => { --r === 0 && i(); }; - for (let [o, a, l] of s.matches.entries()) this.#r(o) || this.matchSync(o, a, l); - for (let o of s.subwalkTargets()) { - if (this.maxDepth !== 1 / 0 && o.depth() >= this.maxDepth) continue; + for (let [a, o] of s.matches.store) this.#h(a) || this.matchSync(a, !!(o & ce), !!(o & ue)); + for (let a of s.subwalkTargets()) { + if (this.maxDepth !== 1 / 0 && a.depth() >= this.maxDepth) continue; r++; - let a = o.readdirSync(); - this.walkCB3Sync(o, a, s, h); + let o = a.readdirSync(); + this.walkCB3Sync(a, o, s, h); } h(); } walkCB3Sync(t, e, s, i) { - s = s.filterEntries(t, e); - let r = 1, h = () => { - --r === 0 && i(); + let r = s.filterEntries(t, e), h = 1, a = () => { + --h === 0 && i(); }; - for (let [o, a, l] of s.matches.entries()) this.#r(o) || this.matchSync(o, a, l); - for (let [o, a] of s.subwalks.entries()) r++, this.walkCB2Sync(o, a, s.child(), h); - h(); + for (let [o, l] of r.matches.store) this.#h(o) || this.matchSync(o, !!(l & ce), !!(l & ue)); + for (let [o, l] of r.subwalks.entries()) h++, this.walkCB2Sync(o, l, r.child(), a); + a(); } }; - X.GlobUtil = Ot; - var Pe = class extends Ot { - matches = /* @__PURE__ */ new Set(); + Q.GlobUtil = xt; + var ts = class extends xt { + matches = []; constructor(t, e, s) { super(t, e, s); } matchEmit(t) { - this.matches.add(t); + this.matches.push(t); } async walk() { if (this.signal?.aborted) throw this.signal.reason; @@ -137818,11 +138311,11 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur }), this.matches; } }; - X.GlobWalker = Pe; - var De = class extends Ot { + Q.GlobWalker = ts; + var es = class extends xt { results; constructor(t, e, s) { - super(t, e, s), this.results = new Mr.Minipass({ signal: this.signal, objectMode: true }), this.results.on("drain", () => this.resume()), this.results.on("resume", () => this.resume()); + super(t, e, s), this.results = new Vr.Minipass({ signal: this.signal, objectMode: true }), this.results.on("drain", () => this.resume()), this.results.on("resume", () => this.resume()); } matchEmit(t) { this.results.write(t), this.results.flowing || this.pause(); @@ -137837,13 +138330,13 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => this.results.end()), this.results; } }; - X.GlobStream = De; + Q.GlobStream = es; }); - var je = R((oe) => { + var is = x((pe) => { "use strict"; - Object.defineProperty(oe, "__esModule", { value: true }); - oe.Glob = void 0; - var Dr = H(), Fr = require("node:url"), ne = Ms(), jr = Re(), he = Ls(), Nr = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", Fe = class { + Object.defineProperty(pe, "__esModule", { value: true }); + pe.Glob = void 0; + var Zr = Y(), Jr = require("node:url"), fe = ni(), Qr = Ke(), de = li(), tn = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", ss = class { absolute; cwd; root; @@ -137873,36 +138366,37 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur patterns; constructor(t, e) { if (!e) throw new TypeError("glob options required"); - if (this.withFileTypes = !!e.withFileTypes, this.signal = e.signal, this.follow = !!e.follow, this.dot = !!e.dot, this.dotRelative = !!e.dotRelative, this.nodir = !!e.nodir, this.mark = !!e.mark, e.cwd ? (e.cwd instanceof URL || e.cwd.startsWith("file://")) && (e.cwd = (0, Fr.fileURLToPath)(e.cwd)) : this.cwd = "", this.cwd = e.cwd || "", this.root = e.root, this.magicalBraces = !!e.magicalBraces, this.nobrace = !!e.nobrace, this.noext = !!e.noext, this.realpath = !!e.realpath, this.absolute = e.absolute, this.includeChildMatches = e.includeChildMatches !== false, this.noglobstar = !!e.noglobstar, this.matchBase = !!e.matchBase, this.maxDepth = typeof e.maxDepth == "number" ? e.maxDepth : 1 / 0, this.stat = !!e.stat, this.ignore = e.ignore, this.withFileTypes && this.absolute !== void 0) throw new Error("cannot set absolute and withFileTypes:true"); - if (typeof t == "string" && (t = [t]), this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === false, this.windowsPathsNoEscape && (t = t.map((a) => a.replace(/\\/g, "/"))), this.matchBase) { + if (this.withFileTypes = !!e.withFileTypes, this.signal = e.signal, this.follow = !!e.follow, this.dot = !!e.dot, this.dotRelative = !!e.dotRelative, this.nodir = !!e.nodir, this.mark = !!e.mark, e.cwd ? (e.cwd instanceof URL || e.cwd.startsWith("file://")) && (e.cwd = (0, Jr.fileURLToPath)(e.cwd)) : this.cwd = "", this.cwd = e.cwd || "", this.root = e.root, this.magicalBraces = !!e.magicalBraces, this.nobrace = !!e.nobrace, this.noext = !!e.noext, this.realpath = !!e.realpath, this.absolute = e.absolute, this.includeChildMatches = e.includeChildMatches !== false, this.noglobstar = !!e.noglobstar, this.matchBase = !!e.matchBase, this.maxDepth = typeof e.maxDepth == "number" ? e.maxDepth : 1 / 0, this.stat = !!e.stat, this.ignore = e.ignore, this.withFileTypes && this.absolute !== void 0) throw new Error("cannot set absolute and withFileTypes:true"); + let s = typeof t == "string" ? [t] : t; + if (this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === false, this.windowsPathsNoEscape && (s = s.map((l) => l.replace(/\\/g, "/"))), this.matchBase) { if (e.noglobstar) throw new TypeError("base matching requires globstar"); - t = t.map((a) => a.includes("/") ? a : `./**/${a}`); + s = s.map((l) => l.includes("/") ? l : `./**/${l}`); } - if (this.pattern = t, this.platform = e.platform || Nr, this.opts = { ...e, platform: this.platform }, e.scurry) { + if (this.pattern = s, this.platform = e.platform || tn, this.opts = { ...e, platform: this.platform }, e.scurry) { if (this.scurry = e.scurry, e.nocase !== void 0 && e.nocase !== e.scurry.nocase) throw new Error("nocase option contradicts provided scurry option"); } else { - let a = e.platform === "win32" ? ne.PathScurryWin32 : e.platform === "darwin" ? ne.PathScurryDarwin : e.platform ? ne.PathScurryPosix : ne.PathScurry; - this.scurry = new a(this.cwd, { nocase: e.nocase, fs: e.fs }); + let l = e.platform === "win32" ? fe.PathScurryWin32 : e.platform === "darwin" ? fe.PathScurryDarwin : e.platform ? fe.PathScurryPosix : fe.PathScurry; + this.scurry = new l(this.cwd, { nocase: e.nocase, fs: e.fs }); } this.nocase = this.scurry.nocase; - let s = this.platform === "darwin" || this.platform === "win32", i = { braceExpandMax: 1e4, ...e, dot: this.dot, matchBase: this.matchBase, nobrace: this.nobrace, nocase: this.nocase, nocaseMagicOnly: s, nocomment: true, noext: this.noext, nonegate: true, optimizationLevel: 2, platform: this.platform, windowsPathsNoEscape: this.windowsPathsNoEscape, debug: !!this.opts.debug }, r = this.pattern.map((a) => new Dr.Minimatch(a, i)), [h, o] = r.reduce((a, l) => (a[0].push(...l.set), a[1].push(...l.globParts), a), [[], []]); - this.patterns = h.map((a, l) => { - let f = o[l]; - if (!f) throw new Error("invalid pattern object"); - return new jr.Pattern(a, f, 0, this.platform); + let i = this.platform === "darwin" || this.platform === "win32", r = { braceExpandMax: 1e4, ...e, dot: this.dot, matchBase: this.matchBase, nobrace: this.nobrace, nocase: this.nocase, nocaseMagicOnly: i, nocomment: true, noext: this.noext, nonegate: true, optimizationLevel: 2, platform: this.platform, windowsPathsNoEscape: this.windowsPathsNoEscape }, h = this.pattern.map((l) => new Zr.Minimatch(l, r)), [a, o] = h.reduce((l, c) => (l[0].push(...c.set), l[1].push(...c.globParts), l), [[], []]); + this.patterns = a.map((l, c) => { + let u = o[c]; + if (!u) throw new Error("invalid pattern object"); + return new Qr.Pattern(l, u, 0, this.platform); }); } async walk() { - return [...await new he.GlobWalker(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).walk()]; + return await new de.GlobWalker(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).walk(); } walkSync() { - return [...new he.GlobWalker(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).walkSync()]; + return new de.GlobWalker(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).walkSync(); } stream() { - return new he.GlobStream(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).stream(); + return new de.GlobStream(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).stream(); } streamSync() { - return new he.GlobStream(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).streamSync(); + return new de.GlobStream(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).streamSync(); } iterateSync() { return this.streamSync()[Symbol.iterator](); @@ -137917,72 +138411,71 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur return this.iterate(); } }; - oe.Glob = Fe; + pe.Glob = ss; }); - var Ne = R((ae) => { + var rs = x((me) => { "use strict"; - Object.defineProperty(ae, "__esModule", { value: true }); - ae.hasMagic = void 0; - var Lr = H(), Wr = (n, t = {}) => { - Array.isArray(n) || (n = [n]); - for (let e of n) if (new Lr.Minimatch(e, t).hasMagic()) return true; + Object.defineProperty(me, "__esModule", { value: true }); + me.hasMagic = void 0; + var en = Y(), sn = (n, t = {}) => { + for (let e of Array.isArray(n) ? n : [n]) if (new en.Minimatch(e, t).hasMagic()) return true; return false; }; - ae.hasMagic = Wr; + me.hasMagic = sn; }); Object.defineProperty(exports2, "__esModule", { value: true }); exports2.glob = exports2.sync = exports2.iterate = exports2.iterateSync = exports2.stream = exports2.streamSync = exports2.Ignore = exports2.hasMagic = exports2.Glob = exports2.unescape = exports2.escape = void 0; - exports2.globStreamSync = xt; - exports2.globStream = Le; - exports2.globSync = We; - exports2.globIterateSync = Tt; - exports2.globIterate = Be; - var Ws = H(); - var tt = je(); - var Br = Ne(); - var Is = H(); + exports2.globStreamSync = Rt; + exports2.globStream = ns; + exports2.globSync = hs; + exports2.globIterateSync = Pt; + exports2.globIterate = os8; + var ci = Y(); + var rt = is(); + var rn = rs(); + var fi = Y(); Object.defineProperty(exports2, "escape", { enumerable: true, get: function() { - return Is.escape; + return fi.escape; } }); Object.defineProperty(exports2, "unescape", { enumerable: true, get: function() { - return Is.unescape; + return fi.unescape; } }); - var Ir = je(); + var nn = is(); Object.defineProperty(exports2, "Glob", { enumerable: true, get: function() { - return Ir.Glob; + return nn.Glob; } }); - var Gr = Ne(); + var hn = rs(); Object.defineProperty(exports2, "hasMagic", { enumerable: true, get: function() { - return Gr.hasMagic; + return hn.hasMagic; } }); - var zr = ke(); + var on = Ze(); Object.defineProperty(exports2, "Ignore", { enumerable: true, get: function() { - return zr.Ignore; + return on.Ignore; } }); - function xt(n, t = {}) { - return new tt.Glob(n, t).streamSync(); + function Rt(n, t = {}) { + return new rt.Glob(n, t).streamSync(); } - function Le(n, t = {}) { - return new tt.Glob(n, t).stream(); + function ns(n, t = {}) { + return new rt.Glob(n, t).stream(); } - function We(n, t = {}) { - return new tt.Glob(n, t).walkSync(); + function hs(n, t = {}) { + return new rt.Glob(n, t).walkSync(); } - async function Bs(n, t = {}) { - return new tt.Glob(n, t).walk(); + async function ui(n, t = {}) { + return new rt.Glob(n, t).walk(); } - function Tt(n, t = {}) { - return new tt.Glob(n, t).iterateSync(); + function Pt(n, t = {}) { + return new rt.Glob(n, t).iterateSync(); } - function Be(n, t = {}) { - return new tt.Glob(n, t).iterate(); + function os8(n, t = {}) { + return new rt.Glob(n, t).iterate(); } - exports2.streamSync = xt; - exports2.stream = Object.assign(Le, { sync: xt }); - exports2.iterateSync = Tt; - exports2.iterate = Object.assign(Be, { sync: Tt }); - exports2.sync = Object.assign(We, { stream: xt, iterate: Tt }); - exports2.glob = Object.assign(Bs, { glob: Bs, globSync: We, sync: exports2.sync, globStream: Le, stream: exports2.stream, globStreamSync: xt, streamSync: exports2.streamSync, globIterate: Be, iterate: exports2.iterate, globIterateSync: Tt, iterateSync: exports2.iterateSync, Glob: tt.Glob, hasMagic: Br.hasMagic, escape: Ws.escape, unescape: Ws.unescape }); + exports2.streamSync = Rt; + exports2.stream = Object.assign(ns, { sync: Rt }); + exports2.iterateSync = Pt; + exports2.iterate = Object.assign(os8, { sync: Pt }); + exports2.sync = Object.assign(hs, { stream: Rt, iterate: Pt }); + exports2.glob = Object.assign(ui, { glob: ui, globSync: hs, sync: exports2.sync, globStream: ns, stream: exports2.stream, globStreamSync: Rt, streamSync: exports2.streamSync, globIterate: os8, iterate: exports2.iterate, globIterateSync: Pt, iterateSync: exports2.iterateSync, Glob: rt.Glob, hasMagic: rn.hasMagic, escape: ci.escape, unescape: ci.unescape }); exports2.glob.glob = exports2.glob; } }); @@ -157611,10 +158104,18 @@ var require_cipherModes = __commonJS({ return false; } var len = output.length(); + if (len === 0) { + return true; + } var count = output.at(len - 1); - if (count > this.blockSize << 2) { + if (count === 0 || count > this.blockSize || count > len) { return false; } + for (var i = 2; i <= count; ++i) { + if (output.at(len - i) !== count) { + return false; + } + } output.truncate(count); return true; }; @@ -157676,10 +158177,18 @@ var require_cipherModes = __commonJS({ return false; } var len = output.length(); + if (len === 0) { + return true; + } var count = output.at(len - 1); - if (count > this.blockSize << 2) { + if (count === 0 || count > this.blockSize || count > len) { return false; } + for (var i = 2; i <= count; ++i) { + if (output.at(len - i) !== count) { + return false; + } + } output.truncate(count); return true; }; @@ -157937,11 +158446,14 @@ var require_cipherModes = __commonJS({ } else { additionalData = forge.util.createBuffer(); } - if ("tagLength" in options) { - this._tagLength = options.tagLength; + if (options.tagLength !== void 0 && options.tagLength !== null) { + this._tagLength = Number(options.tagLength); } else { this._tagLength = 128; } + if ([128, 120, 112, 104, 96, 64, 32].indexOf(this._tagLength) === -1) { + throw new Error("Invalid tag length."); + } this._tag = null; if (options.decrypt) { this._tag = forge.util.createBuffer(options.tag).getBytes(); @@ -158892,7 +159404,10 @@ var require_asn1 = __commonJS({ var subOptions = { // enforce strict mode to avoid parsing ASN.1 from plain data strict: true, - decodeBitStrings: true + // only decode one level of BIT STRINGs, nested decoding has + // quadratic cost due to copies for change detection + decodeBitStrings: false, + maxDepth: options.maxDepth }; var composed = _fromDer(bytes, remaining, depth + 1, subOptions); var used = start - bytes.length(); @@ -158996,12 +159511,16 @@ var require_asn1 = __commonJS({ asn1.oidToDer = function(oid) { var values = oid.split("."); var bytes = forge.util.createBuffer(); - bytes.putByte(40 * parseInt(values[0], 10) + parseInt(values[1], 10)); + var first = parseInt(values[0], 10); + var second = parseInt(values[1], 10); + if (!(first >= 0 && first <= 2 && second >= 0) || first < 2 && second > 39) { + throw new Error("Invalid OID; the first two arcs are out of range."); + } var last, valueBytes, value, b; - for (var i = 2; i < values.length; ++i) { + for (var i = 1; i < values.length; ++i) { last = true; valueBytes = []; - value = parseInt(values[i], 10); + value = i === 1 ? 40 * first + second : parseInt(values[i], 10); if (value > 4294967295) { throw new Error("OID value too large; max is 32-bits."); } @@ -159025,9 +159544,9 @@ var require_asn1 = __commonJS({ if (typeof bytes === "string") { bytes = forge.util.createBuffer(bytes); } - var b = bytes.getByte(); - oid = Math.floor(b / 40) + "." + b % 40; + var b; var value = 0; + var first = true; while (bytes.length() > 0) { if (value > 70368744177663) { throw new Error("OID value too large; max is 53-bits."); @@ -159037,7 +159556,13 @@ var require_asn1 = __commonJS({ if (b & 128) { value += b & 127; } else { - oid += "." + (value + b); + value += b; + if (first) { + oid = value < 80 ? Math.floor(value / 40) + "." + value % 40 : "2." + (value - 80); + first = false; + } else { + oid += "." + value; + } value = 0; } } @@ -159873,12 +160398,12 @@ var require_pem = __commonJS({ }; pem.decode = function(str) { var rval = []; - var rMessage = /\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g; - var rHeader = /([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/; + var messages = _pemMessageScanner(str); + var rHeader = /(?:^|[^\x21-\x7e])([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/; var rCRLF = /\r?\n/; var match2; while (true) { - match2 = rMessage.exec(str); + match2 = messages.next(); if (!match2) { break; } @@ -159901,7 +160426,7 @@ var require_pem = __commonJS({ var lines = match2[2].split(rCRLF); var li = 0; while (match2 && li < lines.length) { - var line = lines[li].replace(/\s+$/, ""); + var line = rtrim(lines[li]); for (var nl = li + 1; nl < lines.length; ++nl) { var next = lines[nl]; if (!/\s/.test(next[0])) { @@ -159979,6 +160504,140 @@ var require_pem = __commonJS({ function ltrim(str) { return str.replace(/^\s+/, ""); } + function rtrim(str) { + var end = str.length; + while (end > 0 && /\s/.test(str.charAt(end - 1))) { + --end; + } + return str.substring(0, end); + } + function _pemMessageScanner(str) { + var rBody = /[:A-Za-z0-9+\/=\s]/; + var rNotBody = /[^:A-Za-z0-9+\/=\s]/g; + var rNotHeader = /[^\x21-\x7e\s]/g; + var rLabel = /[A-Z0-9- ]/; + function indexOfRegex(regex, i) { + regex.lastIndex = i; + var match2 = regex.exec(str); + return match2 ? match2.index : str.length; + } + function labelAt(i) { + for (var j = i; j < str.length && rLabel.test(str.charAt(j)); ++j) { + if (j > i && str.substr(j, 5) === "-----") { + return str.substring(i, j); + } + } + return null; + } + function blankLineEnd(i) { + if (str.charAt(i) === "\r") { + ++i; + } + if (str.charAt(i) !== "\n") { + return -1; + } + if (str.charAt(++i) === "\r") { + ++i; + } + return str.charAt(i) === "\n" ? i + 1 : -1; + } + function firstBlankLine(start2, end2) { + for (var i = start2; i < end2; ++i) { + var v = blankLineEnd(i); + if (v !== -1 && v < end2) { + return i; + } + } + return -1; + } + var ends = {}; + for (var end = str.indexOf("-----END "); end !== -1; end = str.indexOf("-----END ", end + 1)) { + var endLabel = labelAt(end + 9); + var start = end; + while (start > 0 && rBody.test(str.charAt(start - 1))) { + --start; + } + var blank = firstBlankLine(start, end); + if (endLabel !== null && blank !== -1) { + var key = "$" + endLabel; + (ends[key] = ends[key] || []).push({ end, blank }); + } + } + var pos = 0; + var headerEnd = -1; + return { + next: function() { + var begin; + while ((begin = str.indexOf("-----BEGIN ", pos)) !== -1) { + pos = begin + 1; + var label = labelAt(begin + 11); + if (label === null) { + continue; + } + var q = begin + 16 + label.length; + var bodyEnd = indexOfRegex(rNotBody, q); + var bodyEndOk = str.substr(bodyEnd, 9) === "-----END " && labelAt(bodyEnd + 9) === label; + if (q > headerEnd) { + headerEnd = indexOfRegex(rNotHeader, q); + } + var later = null; + var list = ends["$" + label]; + if (list) { + var lo = 0; + var hi = list.length; + while (lo < hi) { + var mid = lo + hi >> 1; + if (list[mid].end > bodyEnd) { + hi = mid; + } else { + lo = mid + 1; + } + } + later = list[lo] || null; + } + var starts = []; + if (str.charAt(q) === "\r") { + if (str.charAt(q + 1) === "\n") { + starts.push(q + 2); + } + starts.push(q + 1); + } else if (str.charAt(q) === "\n") { + starts.push(q + 1); + } + starts.push(q); + for (var i = 0; i < starts.length; ++i) { + var t = starts[i]; + var blank2 = bodyEndOk ? firstBlankLine(t + 1, bodyEnd) : -1; + var end2 = bodyEnd; + if (blank2 === -1 && later) { + blank2 = later.blank; + end2 = later.end; + } + if (blank2 !== -1 && blank2 <= headerEnd) { + var v = blankLineEnd(blank2); + pos = end2 + 14 + label.length; + return [ + str.substring(begin, pos), + label, + str.substring(t, v), + str.substring(v, end2) + ]; + } + if (bodyEndOk && t < bodyEnd) { + pos = bodyEnd + 14 + label.length; + return [ + str.substring(begin, pos), + label, + void 0, + str.substring(t, bodyEnd) + ]; + } + } + } + return null; + } + }; + } } }); @@ -162416,7 +163075,7 @@ var require_jsbn = __commonJS({ return r; } function bnModInverse(m) { - if (this.signum() == 0) { + if (this.signum() <= 0 || m.signum() <= 0) { return BigInteger.ZERO; } var ac = m.isEven(); @@ -163295,6 +163954,41 @@ var require_rsa = __commonJS({ capture: "digest" }] }; + var _encodeDigestInfo = function(oid, digest, withParameters) { + var digestAlgorithm = [asn1.create( + asn1.Class.UNIVERSAL, + asn1.Type.OID, + false, + asn1.oidToDer(oid).getBytes() + )]; + if (withParameters) { + digestAlgorithm.push(asn1.create( + asn1.Class.UNIVERSAL, + asn1.Type.NULL, + false, + "" + )); + } + return asn1.toDer(asn1.create( + asn1.Class.UNIVERSAL, + asn1.Type.SEQUENCE, + true, + [ + asn1.create( + asn1.Class.UNIVERSAL, + asn1.Type.SEQUENCE, + true, + digestAlgorithm + ), + asn1.create( + asn1.Class.UNIVERSAL, + asn1.Type.OCTETSTRING, + false, + digest + ) + ] + )).getBytes(); + }; var emsaPkcs1v15encode = function(md2) { var oid; if (md2.algorithm in pki2.oids) { @@ -163798,6 +164492,13 @@ var require_rsa = __commonJS({ ); } } + var withParameters = _encodeDigestInfo(oid, capture.digest, true); + var withoutParameters = _encodeDigestInfo(oid, capture.digest, false); + if (d2.substring(0, withParameters.length) !== withParameters && d2.substring(0, withoutParameters.length) !== withoutParameters) { + throw new Error( + "ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value." + ); + } return digest2 === capture.digest; } }; @@ -164758,6 +165459,9 @@ var require_pbe = __commonJS({ }; pki2.pbe.generatePkcs12Key = function(password, salt, id, iter, n, md2) { var j, l; + if (!(iter >= 1)) { + throw new Error("PKCS#12 key derivation iteration count must be >= 1."); + } if (typeof md2 === "undefined" || md2 === null) { if (!("sha1" in forge.md)) { throw new Error('"sha1" hash algorithm unavailable.'); @@ -166043,6 +166747,7 @@ var require_x509 = __commonJS({ }; var _verifySignature = function(options) { var cert = options.certificate; + var publicKey = options.publicKey || cert.publicKey; var scheme; switch (cert.signatureOid) { case oids.sha1WithRSAEncryption: @@ -166080,7 +166785,7 @@ var require_x509 = __commonJS({ ); break; } - return cert.publicKey.verify( + return publicKey.verify( options.md.digest().getBytes(), options.signature, scheme @@ -166300,7 +167005,8 @@ var require_x509 = __commonJS({ } if (md2 !== null) { rval = _verifySignature({ - certificate: cert, + certificate: child, + publicKey: cert.publicKey, md: md2, signature: child.signature }); @@ -167535,10 +168241,7 @@ var require_x509 = __commonJS({ } } if (parent) { - var parents = parent; - if (!forge.util.isArray(parents)) { - parents = [parents]; - } + var parents = forge.util.isArray(parent) ? parent.slice() : [parent]; var verified = false; while (!verified && parents.length > 0) { parent = parents.shift(); @@ -167583,7 +168286,7 @@ var require_x509 = __commonJS({ } } if (error3 === null && (!first || chain.length === 0 && (!parent || selfSigned))) { - var bcExt = cert.getExtension("basicConstraints"); + var bcExt = cert.getExtension({ id: "2.5.29.19" }); var keyUsageExt = cert.getExtension("keyUsage"); if (keyUsageExt !== null) { if (!keyUsageExt.keyCertSign || bcExt === null) { @@ -167605,7 +168308,7 @@ var require_x509 = __commonJS({ error: pki2.certificateError.bad_certificate }; } - if (error3 === null && keyUsageExt !== null && "pathLenConstraint" in bcExt) { + if (error3 === null && bcExt !== null && "pathLenConstraint" in bcExt) { var pathLen = depth - 1; if (pathLen > bcExt.pathLenConstraint) { error3 = { @@ -167989,6 +168692,9 @@ var require_pkcs12 = __commonJS({ } var macSalt = new forge.util.ByteBuffer(capture.macSalt); var macIterations = "macIterations" in capture ? parseInt(forge.util.bytesToHex(capture.macIterations), 16) : 1; + if (!(macIterations >= 1)) { + throw new Error("PKCS#12 MAC iteration count must be >= 1."); + } var macKey = p12.generateKey( password, macSalt, @@ -169250,7 +169956,7 @@ var require_tls = __commonJS({ } }); } - if (c.serverCertificate === null) { + if (c.session.serverCertificate === null) { var error3 = { message: "No server certificate provided. Not enough security.", send: true, @@ -169274,8 +169980,8 @@ var require_tls = __commonJS({ error3.alert.description = ret; } } - return c.error(c, error3); } + return c.error(c, error3); } if (c.session.certificateRequest !== null) { record = tls.createRecord(c, { @@ -169531,7 +170237,7 @@ var require_tls = __commonJS({ var length = b.getInt16(); var payload = b.getBytes(length); if (type === tls.HeartbeatMessageType.heartbeat_request) { - if (c.handshaking || length > payload.length) { + if (c.handshakes === 0 || c.handshaking || length > payload.length) { return c.process(); } tls.queue(c, tls.createRecord(c, { @@ -170446,6 +171152,7 @@ var require_tls = __commonJS({ description: tls.Alert.Description.unexpected_message } }); + return rval; } } c2.record.ready = true; @@ -170510,24 +171217,48 @@ var require_tls = __commonJS({ tls.flush(c); } }; + var _processing = false; + var _processNext = false; + var _processRecord = function(c2) { + var rval = 0; + if (!c2.fail) { + if (c2.record !== null && c2.record.ready && c2.record.fragment.isEmpty()) { + c2.record = null; + } + if (c2.record === null) { + rval = _readRecordHeader(c2); + } + if (!c2.fail && c2.record !== null && !c2.record.ready) { + rval = _readRecord(c2); + } + if (!c2.fail && c2.record !== null && c2.record.ready) { + _update(c2, c2.record); + } + } + return rval; + }; c.process = function(data) { var rval = 0; if (data) { c.input.putBytes(data); } - if (!c.fail) { - if (c.record !== null && c.record.ready && c.record.fragment.isEmpty()) { - c.record = null; - } - if (c.record === null) { - rval = _readRecordHeader(c); - } - if (!c.fail && c.record !== null && !c.record.ready) { - rval = _readRecord(c); - } - if (!c.fail && c.record !== null && c.record.ready) { - _update(c, c.record); + if (_processing && typeof data === "undefined") { + _processNext = true; + return rval; + } + var processing = _processing; + var processNext = _processNext; + _processing = true; + _processNext = false; + try { + rval = _processRecord(c); + while (_processNext) { + _processNext = false; + _processRecord(c); } + } finally { + _processing = processing; + _processNext = processNext; } return rval; }; @@ -177993,7 +178724,7 @@ function getDiffRangesJsonFilePath(env = getEnv()) { return path2.join(getTemporaryDirectory(env), PR_DIFF_RANGE_JSON_FILENAME); } function getActionVersion() { - return "4.39.2"; + return "4.39.3"; } function getWorkflowEventName(env = getEnv()) { return env.getRequired("GITHUB_EVENT_NAME" /* GITHUB_EVENT_NAME */); @@ -186037,8 +186768,7 @@ async function setupDiffInformedQueryRun(logger2, checkoutPath) { ); } function diffRangeExtensionPackContents(ranges, checkoutPath) { - const header = ` -extensions: + const header = `extensions: - addsTo: pack: codeql/util extensible: restrictAlertsTo @@ -186047,7 +186777,7 @@ extensions: `; let data = ranges.map((range2) => { const filename = path16.join(checkoutPath, range2.path).replaceAll(path16.sep, "/"); - return ` - [${dump(filename, { forceQuotes: true, quoteStyle: "single" }).trim()}, ${range2.startLine}, ${range2.endLine}] + return ` - [${dump(filename, { forceQuotes: true, quoteStyle: "double" }).trim()}, ${range2.startLine}, ${range2.endLine}] `; }).join(""); if (!data) { @@ -188538,11 +189268,19 @@ function filterAlertsByDiffRange(logger2, sarifLog) { return locations.some((physicalLocation) => { const locationUri = physicalLocation?.artifactLocation?.uri; const locationStartLine = physicalLocation?.region?.startLine; - if (!locationUri || locationStartLine === void 0) { + if (typeof locationUri !== "string" || !locationUri || locationStartLine === void 0) { return false; } + let decodedLocationUri = locationUri; + try { + decodedLocationUri = decodeURIComponent(locationUri); + } catch { + logger2.debug( + `Failed to decode location URI "${locationUri}", comparing it as a raw path` + ); + } return diffRanges.some( - (range2) => range2.path === locationUri && (range2.startLine <= locationStartLine && range2.endLine >= locationStartLine || range2.startLine === 0 && range2.endLine === 0) + (range2) => (range2.path === decodedLocationUri || range2.path === locationUri) && (range2.startLine <= locationStartLine && range2.endLine >= locationStartLine || range2.startLine === 0 && range2.endLine === 0) ); }); }); diff --git a/package-lock.json b/package-lock.json index c1a68345a..ca703da54 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "codeql", - "version": "4.39.2", + "version": "4.39.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "codeql", - "version": "4.39.2", + "version": "4.39.3", "license": "MIT", "workspaces": [ "pr-checks" @@ -33,7 +33,7 @@ "js-yaml": "^5.5.0", "jsonschema": "1.5.0", "long": "^5.3.2", - "node-forge": "^1.4.0", + "node-forge": "^1.4.1", "semver": "^7.8.5", "undici": "^7.30.1", "uuid": "^14.0.3" @@ -59,9 +59,10 @@ "eslint-plugin-import-x": "^4.17.1", "eslint-plugin-jsdoc": "^65.4.0", "eslint-plugin-no-async-foreach": "^0.1.1", - "glob": "^13.0.6", + "glob": "^14.0.3", "globals": "^17.13.0", "nock": "^14.0.17", + "prettier": "^3.9.10", "sinon": "^22.1.0", "typescript": "^6.0.3", "typescript-eslint": "^8.72.0" @@ -1810,6 +1811,12 @@ "node": ">=18.0.0" } }, + "node_modules/@isaacs/nonrecursive-glob-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/nonrecursive-glob-match/-/nonrecursive-glob-match-1.0.2.tgz", + "integrity": "sha512-GJPHIgPPtFl+nLhFHyF0zZoFcOFLsZWbHFFzo+Zr+PWDXJbl9hHxb2w+9SiF2fHmLgKaXIpUzQo3SbBBZ9WObw==", + "license": "BlueOak-1.0.0" + }, "node_modules/@mapbox/node-pre-gyp": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-2.0.3.tgz", @@ -3523,7 +3530,6 @@ }, "node_modules/ansi-regex": { "version": "5.0.1", - "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -3533,7 +3539,6 @@ "version": "6.2.3", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", - "dev": true, "license": "MIT", "engines": { "node": ">=12" @@ -4438,7 +4443,6 @@ }, "node_modules/color-convert": { "version": "2.0.1", - "dev": true, "license": "MIT", "dependencies": { "color-name": "~1.1.4" @@ -4449,7 +4453,6 @@ }, "node_modules/color-name": { "version": "1.1.4", - "dev": true, "license": "MIT" }, "node_modules/comment-parser": { @@ -4574,7 +4577,6 @@ "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", - "dev": true, "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -4829,7 +4831,6 @@ }, "node_modules/emoji-regex": { "version": "8.0.0", - "dev": true, "license": "MIT" }, "node_modules/es-abstract": { @@ -6272,14 +6273,14 @@ } }, "node_modules/glob": { - "version": "13.0.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.6.tgz", - "integrity": "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw==", + "version": "14.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-14.0.3.tgz", + "integrity": "sha512-A1vjIwC3qpdCso45Iw127gnp7sPhqgY8lUQhDrArIs+GbmfaaVPFuoyy7WyLT9EPZCRZ7j7aLdwUhQmHWesEow==", "license": "BlueOak-1.0.0", "dependencies": { - "minimatch": "^10.2.2", + "minimatch": "^11.0.2", "minipass": "^7.1.3", - "path-scurry": "^2.0.2" + "path-scurry": "^3.0.0" }, "engines": { "node": "18 || 20 || >=22" @@ -6323,12 +6324,13 @@ } }, "node_modules/glob/node_modules/minimatch": { - "version": "10.2.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz", - "integrity": "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==", + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-11.0.2.tgz", + "integrity": "sha512-pWTgz5CN3tjqyZNSK2tePlSmu9IwM41q8yn8Usdqqwe9TIHh+9dEpLLjF4uApsfPEAZY71qtSiA2B2APEr+1Yw==", "license": "BlueOak-1.0.0", "dependencies": { - "brace-expansion": "^5.0.2" + "@isaacs/nonrecursive-glob-match": "^1.0.2", + "brace-expansion": "^5.0.12" }, "engines": { "node": "18 || 20 || >=22" @@ -6857,7 +6859,6 @@ }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", - "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -7168,7 +7169,6 @@ }, "node_modules/isexe": { "version": "2.0.0", - "dev": true, "license": "ISC" }, "node_modules/js-string-escape": { @@ -7478,9 +7478,9 @@ "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==" }, "node_modules/lru-cache": { - "version": "11.5.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.1.tgz", - "integrity": "sha512-RPimw/7aMdv2oqRrxKwvZXcPfwBrn/JZ2xYcY9Hus/6LaS3VOAKVWKWgNLCFSiOm1ESXinjsDlidVU7JlnCN2A==", + "version": "11.5.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", + "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", "license": "BlueOak-1.0.0", "engines": { "node": "20 || >=22" @@ -8198,9 +8198,9 @@ } }, "node_modules/node-forge": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.4.0.tgz", - "integrity": "sha512-LarFH0+6VfriEhqMMcLX2F7SwSXeWwnEAJEsYm5QKWchiVYVvJyV9v7UDvUv+w5HO23ZpQTXDv/GxdDdMyOuoQ==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.4.1.tgz", + "integrity": "sha512-w5/MfWaeMrpR/5ba6fZyAUTLSuE6aYz7H/3cYrqwZEmf5eQS3IaaLgJt4MBv7HglGFWmV22K8h4U18RJQmw/ow==", "license": "(BSD-3-Clause OR GPL-2.0)", "engines": { "node": ">= 6.13.0" @@ -8571,7 +8571,6 @@ }, "node_modules/path-key": { "version": "3.1.1", - "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -8583,9 +8582,9 @@ "license": "MIT" }, "node_modules/path-scurry": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.2.tgz", - "integrity": "sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-3.0.0.tgz", + "integrity": "sha512-1pTbQqH1wIwMi/eleQ5leFTTCkzFsPcgXNjwOA8YGGW/W4/kHT3dssE7Z6NH+zuqNLOzOB0uaD61yl7cAcVhgg==", "license": "BlueOak-1.0.0", "dependencies": { "lru-cache": "^11.0.0", @@ -8670,9 +8669,9 @@ } }, "node_modules/prettier": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.1.tgz", - "integrity": "sha512-G+YdqtITVZmOJje6QkXQWzl3fSfMxFwm1tjTyo9exhkmWSqC4Yhd1+lug++IlR2mvRVAxEDDWYkQdeSztajqgg==", + "version": "3.9.10", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.9.10.tgz", + "integrity": "sha512-skGHTH1Yb9QvaTC4hWnRTzEYtCpApF0UMBPz+t/0ZPzP8ihefo/btKd+QA7pUE0fEwA1SbS/NmhyEcstdXOIdA==", "dev": true, "license": "MIT", "bin": { @@ -9171,7 +9170,6 @@ }, "node_modules/shebang-command": { "version": "2.0.0", - "dev": true, "license": "MIT", "dependencies": { "shebang-regex": "^3.0.0" @@ -9182,7 +9180,6 @@ }, "node_modules/shebang-regex": { "version": "3.0.0", - "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -9268,7 +9265,6 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, "engines": { "node": ">=14" }, @@ -9455,7 +9451,6 @@ }, "node_modules/string-width": { "version": "4.2.3", - "dev": true, "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", @@ -9541,7 +9536,6 @@ }, "node_modules/strip-ansi": { "version": "6.0.1", - "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" @@ -10279,7 +10273,6 @@ }, "node_modules/which": { "version": "2.0.2", - "dev": true, "license": "ISC", "dependencies": { "isexe": "^2.0.0" @@ -10569,7 +10562,7 @@ "@octokit/core": "^7.0.8", "@octokit/plugin-paginate-rest": ">=16.0.0", "@octokit/plugin-rest-endpoint-methods": "^18.0.0", - "glob": "^13.0.6", + "glob": "^14.0.3", "lite-matter": "^0.1.2", "mdast-util-from-markdown": "^2.1.0", "semver": "^7.8.5", diff --git a/package.json b/package.json index 73d61b35d..8d917bf06 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,12 @@ { "name": "codeql", - "version": "4.39.2", + "version": "4.39.3", "private": true, "description": "CodeQL action", "scripts": { "_build_comment": "echo 'Run the full build so we typecheck the project and can reuse the transpiled files in npm test'", "build": "./scripts/check-node-modules.sh && npm run transpile && node build.mjs", + "format-yaml": "prettier --write --parser yaml '**/*.{yml,yaml}'", "lint": "eslint --report-unused-disable-directives --max-warnings=0 .", "lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif", "lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix", @@ -42,7 +43,7 @@ "js-yaml": "^5.5.0", "jsonschema": "1.5.0", "long": "^5.3.2", - "node-forge": "^1.4.0", + "node-forge": "^1.4.1", "semver": "^7.8.5", "undici": "^7.30.1", "uuid": "^14.0.3" @@ -68,9 +69,10 @@ "eslint-plugin-import-x": "^4.17.1", "eslint-plugin-jsdoc": "^65.4.0", "eslint-plugin-no-async-foreach": "^0.1.1", - "glob": "^13.0.6", + "glob": "^14.0.3", "globals": "^17.13.0", "nock": "^14.0.17", + "prettier": "^3.9.10", "sinon": "^22.1.0", "typescript": "^6.0.3", "typescript-eslint": "^8.72.0" @@ -94,7 +96,7 @@ "eslint-plugin-jsx-a11y": { "semver": ">=6.3.1" }, - "glob": "^13.0.6", + "glob": "^14.0.3", "undici": "^7.30.1" } } diff --git a/pr-checks/bundle-changelog.test.ts b/pr-checks/bundle-changelog.test.ts index fad06826a..448851507 100644 --- a/pr-checks/bundle-changelog.test.ts +++ b/pr-checks/bundle-changelog.test.ts @@ -10,17 +10,13 @@ import { afterEach, beforeEach, describe, it } from "node:test"; import { CLI_VERSION_ENV_VAR, + getChangenote, getCLIVersion, getPRNumber, getPRUrl, PR_URL_ENV_VAR, - updateChangelog, } from "./bundle-changelog"; -import { - EMPTY_CHANGELOG, - NO_CHANGES_STR, - UNRELEASED_PLACEHOLDER, -} from "./changelog"; +import { isValidChangenoteContent } from "./changelog/validate"; let testDir: string; @@ -85,58 +81,15 @@ describe("getPRNumber", async () => { }); }); -const testChangelog = `${EMPTY_CHANGELOG.trimEnd()} - -## 4.23.7 - -- Other change - -## 4.23.6 - -${NO_CHANGES_STR}`; - -const expectedChangelog = `# CodeQL Action Changelog - -## ${UNRELEASED_PLACEHOLDER} - -- Update default CodeQL bundle version to - -## 4.23.7 - -- Other change - -## 4.23.6 - -${NO_CHANGES_STR}`; - -describe("updateChangelog", async () => { - await it("removes `NO_CHANGES_STR` if present in [UNRELEASED] section", async () => { - const result = updateChangelog(EMPTY_CHANGELOG, ""); - assert.ok(!result.includes(NO_CHANGES_STR)); - }); - - await it("doesn't remove `NO_CHANGES_STR` if present in versioned section", async () => { - const result = updateChangelog( - EMPTY_CHANGELOG.replace(UNRELEASED_PLACEHOLDER, "1.2.3"), - "", +describe("getChangenote", async () => { + await it("returns a note linking to the bundle release and the PR", async () => { + assert.equal( + getChangenote("1.2.3", testPrUrl), + "- Update default CodeQL bundle version to [1.2.3](https://github.com/github/codeql-action/releases/tag/codeql-bundle-v1.2.3). [#42](https://github.com/github/codeql-action/pulls/42)\n", ); - assert.ok(result.includes(NO_CHANGES_STR)); }); - await it("throws if there are no sections", async () => { - assert.throws(() => { - updateChangelog( - "# CodeQL Action Changelog", - "- Update default CodeQL bundle version to", - ); - }); - }); - - await it("adds note at the end of the first section", async () => { - const result = updateChangelog( - testChangelog, - "- Update default CodeQL bundle version to", - ); - assert.deepEqual(result, expectedChangelog); + await it("returns valid changenote content", async () => { + assert.ok(isValidChangenoteContent(getChangenote("1.2.3", testPrUrl))); }); }); diff --git a/pr-checks/bundle-changelog.ts b/pr-checks/bundle-changelog.ts index 230b80fb8..8019c7090 100755 --- a/pr-checks/bundle-changelog.ts +++ b/pr-checks/bundle-changelog.ts @@ -1,17 +1,13 @@ #!/usr/bin/env npx tsx /** - * Updates the changelog with a change note for an updated CodeQL CLI bundle. + * Creates a changenote file for an update to the default CodeQL CLI bundle. */ import * as fs from "node:fs"; +import * as path from "node:path"; -import { - parseChangelog, - renderChangelog, - UNRELEASED_PLACEHOLDER, -} from "./changelog"; -import { CHANGELOG_FILE, CLI_BUNDLE_RELEASE_URL_PREFIX } from "./config"; +import { CHANGENOTES_DIR, CLI_BUNDLE_RELEASE_URL_PREFIX } from "./config"; import { getErrorMessage } from "./util"; export const CLI_VERSION_ENV_VAR = "CLI_VERSION"; @@ -58,42 +54,19 @@ export function getPRNumber(prUrl: string) { } /** - * Updates `changelog` by adding `changelogNote` to the first section. + * Returns the contents of the changenote file for an update to the default + * CodeQL CLI bundle. * - * @param contents The existing changelog contents. - * @param changelogNote The note to add to the first section. + * @param cliVersion The CodeQL CLI version of the new default bundle. + * @param prUrl The URL of the PR that updates the default bundle. + * @throws If the PR number can't be determined from `prUrl`. */ -export function updateChangelog(contents: string, changelogNote: string) { - // If the "[UNRELEASED]" section starts with "no user facing changes", remove that line. - contents = contents.replace( - `## ${UNRELEASED_PLACEHOLDER}\n\nNo user facing changes.`, - `## ${UNRELEASED_PLACEHOLDER}\n`, - ); +export function getChangenote(cliVersion: string, prUrl: string): string { + // The GitHub Release for the new bundle version. + const bundleReleaseUrl = `${CLI_BUNDLE_RELEASE_URL_PREFIX}${cliVersion}`; - const changelog = parseChangelog(contents); - - if (changelog.sections.length === 0) { - throw new Error("The changelog contains no existing sections."); - } - - // Add the changelog note to the bottom of the first section. - const firstSection = changelog.sections[0]; - const lastLine = firstSection.bodyLines.pop(); - - if (lastLine !== undefined && lastLine.trim() !== "") { - // We expect the last line to be empty. If it isn't for some reason, - // add it back. - firstSection.bodyLines.push(lastLine); - } - - firstSection.bodyLines.push(changelogNote); - - // If the last line is empty as expected, then add it back in after the new note. - if (lastLine?.trim() === "") { - firstSection.bodyLines.push(lastLine); - } - - return renderChangelog(changelog); + const prNumber = getPRNumber(prUrl); + return `- Update default CodeQL bundle version to [${cliVersion}](${bundleReleaseUrl}). [#${prNumber}](${prUrl})\n`; } function main() { @@ -101,22 +74,19 @@ function main() { const cliVersion = getCLIVersion(); const prUrl = getPRUrl(); - // The GitHub Release for the new bundle version. - const bundleReleaseUrl = `${CLI_BUNDLE_RELEASE_URL_PREFIX}${cliVersion}`; - - // Get the PR number from the PR URL. - const prNumber = getPRNumber(prUrl); - const changelogNote = `- Update default CodeQL bundle version to [${cliVersion}](${bundleReleaseUrl}). [#${prNumber}](${prUrl})`; - - let changelog = fs.readFileSync(CHANGELOG_FILE, "utf-8"); - - changelog = updateChangelog(changelog, changelogNote); - - fs.writeFileSync(CHANGELOG_FILE, changelog); + // Include the CLI version in the file name so that changenotes for + // different bundle updates don't conflict. + const changenotePath = path.join( + CHANGENOTES_DIR, + `update-bundle-${cliVersion}.md`, + ); + fs.writeFileSync(changenotePath, getChangenote(cliVersion, prUrl)); return 0; } catch (err) { - console.error(`Failed to bundle changelog: ${getErrorMessage(err)}`); + console.error( + `Failed to create changenote for bundle update: ${getErrorMessage(err)}`, + ); return -1; } } diff --git a/pr-checks/check-unchanged.ts b/pr-checks/check-unchanged.ts new file mode 100755 index 000000000..05ceb7ab4 --- /dev/null +++ b/pr-checks/check-unchanged.ts @@ -0,0 +1,153 @@ +#!/usr/bin/env npx tsx + +import * as fs from "node:fs"; +import * as path from "node:path"; +import { parseArgs } from "node:util"; + +import * as core from "@actions/core"; + +import { runCommand, runGit } from "./command"; +import { LIB_ROOT, PR_CHECKS_DIR, REPO_ROOT } from "./config"; +import { getErrorMessage } from "./util"; + +/** + * Checks whether the repo is clean by running `git status --porcelain`. + * If the repository is not clean, the changes are printed to stdout. + * + * @returns `true` if the repo is clean or `false` otherwise. + */ +function isRepoClean(): boolean { + const stdout = runGit(["status", "--porcelain"]); + + if (stdout === "") { + return true; + } + + console.log(stdout); + return false; +} + +/** + * Checks whether the repository is clean to begin with, then runs {@link body}, and finally + * checks if the repository is still clean. + * + * @param body The function to run. + * @returns `true` if the repo is clean or `false` otherwise. + */ +function checkUnchanged(body: () => void): boolean { + // Sanity check that repo is clean to start with + if (isRepoClean()) { + console.info("Repository is clean."); + } else { + // If we get a fail here then this workflow needs attention... + console.error("The repository contains uncomitted changes!"); + return false; + } + + body(); + + // Check that repo is still clean + const result = isRepoClean(); + if (result) { + console.info("Repository is still clean."); + } else { + console.info("Repository is now dirty."); + } + return result; +} + +/** + * Produces a full diff for the repository and adds it to the workflow job summary + * under the {@link summaryHeader} header. + */ +async function addDiffToSummary(summaryHeader: string) { + const diffFile = path.join( + process.env["RUNNER_TEMP"] ?? PR_CHECKS_DIR, + "summary.diff", + ); + + try { + runCommand("git", ["status"]); + runCommand("git", ["diff", `--output=${diffFile}`], { + execOptions: { cwd: REPO_ROOT }, + }); + + core.summary.addHeading(summaryHeader, 3); + core.summary.addCodeBlock(fs.readFileSync(diffFile, "utf-8"), "diff"); + await core.summary.write(); + + try { + fs.rmSync(diffFile); + } catch (err) { + console.warn( + `Failed to remove temporary diff file from '${diffFile}': ${getErrorMessage(err)}`, + ); + } + } catch (err) { + console.error( + `Failed to add full diff to summary for '${summaryHeader}': ${getErrorMessage(err)}`, + ); + } +} + +/** + * Rebuilds the JavaScript by cleaning up and running `npm run build`. + */ +function rebuildJavaScript() { + // Wipe the lib directory in case there are extra unnecessary files in there + console.info(`Removing ${LIB_ROOT}...`); + fs.rmSync(LIB_ROOT, { recursive: true, force: true }); + + // Generate the JavaScript files + runCommand("npm", ["run", "build"], { execOptions: { shell: true } }); +} + +/** + * Formats YAML files with `npm run format-yaml`. + */ +function formatYAML() { + runCommand("npm", ["run", "format-yaml"], { execOptions: { shell: true } }); +} + +async function main() { + const { values: options } = parseArgs({ + options: { language: { type: "string", default: "javascript" } }, + }); + console.info(`Checking that ${options.language} files are unchanged.`); + + if (options.language === "javascript") { + if (!checkUnchanged(rebuildJavaScript)) { + // If we get a fail here then the PR needs attention + console.error("Failed: JavaScript files are not up to date."); + console.error("Run 'rm -rf lib && npm run build' to update."); + + await addDiffToSummary("Transpiled JS diff"); + + // Reset bundled files to allow other checks to test for changes + runCommand("git", ["checkout", "lib"]); + + return 1; + } + + console.info("Success: JavaScript files are up to date"); + } else if (options.language === "yaml") { + if (!checkUnchanged(formatYAML)) { + // If we get a fail here then the PR needs attention + console.error("Failed: YAML files are not correctly formatted."); + console.error("Run 'npm run format-yaml' to format them."); + + await addDiffToSummary("YAML formatting changes"); + + return 1; + } + + console.info("Success: YAML files are correctly formatted"); + } else { + console.error(`Unknown language: ${options.language}`); + return 1; + } + + return 0; +} + +process.exit(await main()); diff --git a/pr-checks/checks/analyze-ref-input.yml b/pr-checks/checks/analyze-ref-input.yml index 683d40df9..16231cefe 100644 --- a/pr-checks/checks/analyze-ref-input.yml +++ b/pr-checks/checks/analyze-ref-input.yml @@ -14,5 +14,5 @@ steps: run: ./build.sh - uses: ./../action/analyze with: - ref: 'refs/heads/main' - sha: '5e235361806c361d4d3f8859e3c897658025a9a2' + ref: "refs/heads/main" + sha: "5e235361806c361d4d3f8859e3c897658025a9a2" diff --git a/pr-checks/checks/init-with-registries.yml b/pr-checks/checks/init-with-registries.yml index 69e2188de..ffa5f4d12 100644 --- a/pr-checks/checks/init-with-registries.yml +++ b/pr-checks/checks/init-with-registries.yml @@ -23,9 +23,9 @@ steps: config-file: ./.github/codeql/codeql-config-registries.yml languages: javascript registries: | - - url: "https://ghcr.io/v2/" - packages: "*/*" - token: "${{ secrets.GITHUB_TOKEN }}" + - url: "https://ghcr.io/v2/" + packages: "*/*" + token: "${{ secrets.GITHUB_TOKEN }}" - name: Verify packages installed run: | diff --git a/pr-checks/checks/overlay-init-fallback.yml b/pr-checks/checks/overlay-init-fallback.yml index 26d8c8567..48b9f19b1 100644 --- a/pr-checks/checks/overlay-init-fallback.yml +++ b/pr-checks/checks/overlay-init-fallback.yml @@ -6,7 +6,7 @@ versions: steps: - uses: ./../action/init with: - languages: actions # Any language without overlay support will do + languages: actions # Any language without overlay support will do tools: ${{ steps.prepare-test.outputs.tools-url }} env: CODEQL_OVERLAY_DATABASE_MODE: overlay-base diff --git a/pr-checks/checks/unsupported-macos.yml b/pr-checks/checks/unsupported-macos.yml index 5881b174a..f5388f1d6 100644 --- a/pr-checks/checks/unsupported-macos.yml +++ b/pr-checks/checks/unsupported-macos.yml @@ -48,7 +48,7 @@ validationJobs: installNode: true steps: - name: Download workflow artifact - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: pattern: test-mode-sarif-* path: sarif diff --git a/pr-checks/checks/upload-ref-sha-input.yml b/pr-checks/checks/upload-ref-sha-input.yml index 970082715..7a737c7de 100644 --- a/pr-checks/checks/upload-ref-sha-input.yml +++ b/pr-checks/checks/upload-ref-sha-input.yml @@ -15,10 +15,10 @@ steps: # Generate some SARIF we can upload with the upload-sarif step - uses: ./../action/analyze with: - ref: 'refs/heads/main' - sha: '5e235361806c361d4d3f8859e3c897658025a9a2' + ref: "refs/heads/main" + sha: "5e235361806c361d4d3f8859e3c897658025a9a2" upload: never - uses: ./../action/upload-sarif with: - ref: 'refs/heads/main' - sha: '5e235361806c361d4d3f8859e3c897658025a9a2' + ref: "refs/heads/main" + sha: "5e235361806c361d4d3f8859e3c897658025a9a2" diff --git a/pr-checks/checks/upload-sarif.yml b/pr-checks/checks/upload-sarif.yml index 8056a5179..205bdf0a2 100644 --- a/pr-checks/checks/upload-sarif.yml +++ b/pr-checks/checks/upload-sarif.yml @@ -19,8 +19,8 @@ steps: # Generate some SARIF we can upload with the upload-sarif step - uses: ./../action/analyze with: - ref: 'refs/heads/main' - sha: '5e235361806c361d4d3f8859e3c897658025a9a2' + ref: "refs/heads/main" + sha: "5e235361806c361d4d3f8859e3c897658025a9a2" upload: never output: ${{ runner.temp }}/results @@ -29,8 +29,8 @@ steps: uses: ./../action/upload-sarif id: upload-sarif with: - ref: 'refs/heads/main' - sha: '5e235361806c361d4d3f8859e3c897658025a9a2' + ref: "refs/heads/main" + sha: "5e235361806c361d4d3f8859e3c897658025a9a2" sarif_file: ${{ runner.temp }}/results category: | ${{ github.workflow }}:upload-sarif/analysis-kinds:${{ matrix.analysis-kinds }}/os:${{ matrix.os }}/version:${{ matrix.version }}/test:all-files/ @@ -46,8 +46,8 @@ steps: id: upload-single-sarif-code-scanning if: contains(matrix.analysis-kinds, 'code-scanning') with: - ref: 'refs/heads/main' - sha: '5e235361806c361d4d3f8859e3c897658025a9a2' + ref: "refs/heads/main" + sha: "5e235361806c361d4d3f8859e3c897658025a9a2" sarif_file: ${{ runner.temp }}/results/javascript.sarif category: | ${{ github.workflow }}:upload-sarif/analysis-kinds:${{ matrix.analysis-kinds }}/os:${{ matrix.os }}/version:${{ matrix.version }}/test:single-code-scanning/ @@ -59,8 +59,8 @@ steps: id: upload-single-sarif-code-quality if: contains(matrix.analysis-kinds, 'code-quality') with: - ref: 'refs/heads/main' - sha: '5e235361806c361d4d3f8859e3c897658025a9a2' + ref: "refs/heads/main" + sha: "5e235361806c361d4d3f8859e3c897658025a9a2" sarif_file: ${{ runner.temp }}/results/javascript.quality.sarif category: | ${{ github.workflow }}:upload-sarif/analysis-kinds:${{ matrix.analysis-kinds }}/os:${{ matrix.os }}/version:${{ matrix.version }}/test:single-code-quality/ @@ -76,8 +76,8 @@ steps: id: upload-single-non-sarif if: contains(matrix.analysis-kinds, 'code-scanning') with: - ref: 'refs/heads/main' - sha: '5e235361806c361d4d3f8859e3c897658025a9a2' + ref: "refs/heads/main" + sha: "5e235361806c361d4d3f8859e3c897658025a9a2" sarif_file: ${{ runner.temp }}/results/javascript.sarif.json category: | ${{ github.workflow }}:upload-sarif/analysis-kinds:${{ matrix.analysis-kinds }}/os:${{ matrix.os }}/version:${{ matrix.version }}/test:non-sarif/ diff --git a/pr-checks/command.ts b/pr-checks/command.ts new file mode 100644 index 000000000..459265c0d --- /dev/null +++ b/pr-checks/command.ts @@ -0,0 +1,81 @@ +import { execFileSync, ExecFileSyncOptions } from "node:child_process"; + +import { DryRunOption, REPO_ROOT } from "./config"; + +/** Options for {@link runCommand}. */ +export interface RunCommandOptions extends DryRunOption { + /** Options for `execFileSync`. */ + execOptions?: ExecFileSyncOptions; +} + +/** + * Runs a command, streaming output to the console by default. + * + * @param command The name of the command to run. + * @param args The arguments for the command. + * @throws When the process exits with a non-zero exit code. + * @param options How to run the command. + */ +export function runCommand( + command: string, + args: string[], + options?: RunCommandOptions, +) { + if (!options?.dryRun) { + console.log(`Running \`${command} ${args.join(" ")}\`.`); + return execFileSync(command, args, { + stdio: "inherit", + cwd: REPO_ROOT, + ...options?.execOptions, + }); + } else { + console.info( + `[DRY RUN] Would have executed '${command} ${args.join(" ")}'`, + ); + return ""; + } +} + +/** Options for {@link runGit}. */ +export interface RunGitOptions extends DryRunOption { + /** When true, non-zero exit codes will not throw. */ + allowNonZeroExitCode?: boolean; +} + +/** + * Runs `git` with the given `args` and returns the stdout. + * + * @param args - Arguments to pass to `git`. + * @param options - Optional settings. + * @throws If `git` does not exit successfully, unless + * `options.allowNonZeroExitCode` is `true`. + * @returns The trimmed stdout output. + */ +export function runGit(args: string[], options?: RunGitOptions): string { + const execOptions: ExecFileSyncOptions = { + encoding: "utf8", + stdio: ["pipe", "pipe", "pipe"], + }; + + try { + const result = runCommand("git", args, { + dryRun: options?.dryRun, + execOptions, + }) as string; + return result.trimEnd(); + } catch (error: unknown) { + if (options?.allowNonZeroExitCode) { + // execFileSync throws an object with `stdout` when the process exits + // with a non-zero code. + const execError = error as { stdout?: Buffer | string }; + if (typeof execError.stdout === "string") { + return execError.stdout.trimEnd(); + } + if (Buffer.isBuffer(execError.stdout)) { + return execError.stdout.toString("utf8").trimEnd(); + } + return ""; + } + throw error; + } +} diff --git a/pr-checks/config.ts b/pr-checks/config.ts index 876654a1c..a7228bb56 100644 --- a/pr-checks/config.ts +++ b/pr-checks/config.ts @@ -30,7 +30,13 @@ export const CHANGENOTES_DIR = path.join(REPO_ROOT, "unreleased-change-notes"); export const BUNDLE_METADATA_FILE = path.join(REPO_ROOT, "meta.json"); /** The `src` directory. */ -const SOURCE_ROOT = path.join(REPO_ROOT, "src"); +export const SOURCE_ROOT = path.join(REPO_ROOT, "src"); + +/** The `lib` directory. */ +export const LIB_ROOT = path.join(REPO_ROOT, "lib"); + +/** The path to `defaults.json`. */ +export const DEFAULTS_FILE = path.join(SOURCE_ROOT, "defaults.json"); /** The path to the built-in languages file. */ export const BUILTIN_LANGUAGES_FILE = path.join( diff --git a/pr-checks/package.json b/pr-checks/package.json index 0cfda051c..3ad65382f 100644 --- a/pr-checks/package.json +++ b/pr-checks/package.json @@ -14,7 +14,7 @@ "@octokit/core": "^7.0.8", "@octokit/plugin-paginate-rest": ">=16.0.0", "@octokit/plugin-rest-endpoint-methods": "^18.0.0", - "glob": "^13.0.6", + "glob": "^14.0.3", "lite-matter": "^0.1.2", "mdast-util-from-markdown": "^2.1.0", "semver": "^7.8.5", diff --git a/pr-checks/sync-back.test.ts b/pr-checks/sync-back.test.ts index 52d4c98f3..142487449 100755 --- a/pr-checks/sync-back.test.ts +++ b/pr-checks/sync-back.test.ts @@ -56,9 +56,18 @@ jobs: const result = scanGeneratedWorkflows(workflowDir); - assert.equal(result["actions/checkout"], "v4"); - assert.equal(result["actions/setup-node"], "v5"); - assert.equal(result["actions/setup-go"], "v6"); + assert.deepEqual( + result.actionVersions["actions/checkout"], + new Set(["v4"]), + ); + assert.deepEqual( + result.actionVersions["actions/setup-node"], + new Set(["v5"]), + ); + assert.deepEqual( + result.actionVersions["actions/setup-go"], + new Set(["v6"]), + ); }); await it("scanning workflows with version comments", () => { @@ -78,12 +87,18 @@ jobs: const result = scanGeneratedWorkflows(workflowDir); - assert.equal(result["actions/checkout"], "v4"); - assert.equal( - result["ruby/setup-ruby"], - "44511735964dcb71245e7e55f72539531f7bc0eb # v1.257.0", + assert.deepEqual( + result.actionVersions["actions/checkout"], + new Set(["v4"]), + ); + assert.deepEqual( + result.actionVersions["ruby/setup-ruby"], + new Set(["44511735964dcb71245e7e55f72539531f7bc0eb # v1.257.0"]), + ); + assert.deepEqual( + result.actionVersions["actions/setup-python"], + new Set(["v6 # Latest Python"]), ); - assert.equal(result["actions/setup-python"], "v6 # Latest Python"); }); await it("ignores local actions", () => { @@ -103,9 +118,15 @@ jobs: const result = scanGeneratedWorkflows(workflowDir); - assert.equal(result["actions/checkout"], "v4"); - assert.equal("./.github/actions/local-action" in result, false); - assert.equal("./another-local-action" in result, false); + assert.deepEqual( + result.actionVersions["actions/checkout"], + new Set(["v4"]), + ); + assert.equal( + "./.github/actions/local-action" in result.actionVersions, + false, + ); + assert.equal("./another-local-action" in result.actionVersions, false); }); }); @@ -128,8 +149,8 @@ const steps = [ fs.writeFileSync(syncTsPath, syncTsContent); const actionVersions = { - "actions/setup-node": "v5", - "actions/setup-go": "v6", + "actions/setup-node": new Set(["v5"]), + "actions/setup-go": new Set(["v6"]), }; const result = updateSyncTs(syncTsPath, actionVersions); @@ -155,7 +176,7 @@ const steps = [ fs.writeFileSync(syncTsPath, syncTsContent); const actionVersions = { - "actions/setup-node": "v5 # Latest version", + "actions/setup-node": new Set(["v5 # Latest version"]), }; const result = updateSyncTs(syncTsPath, actionVersions); @@ -182,7 +203,7 @@ const steps = [ fs.writeFileSync(syncTsPath, syncTsContent); const actionVersions = { - "actions/setup-node": "v5", + "actions/setup-node": new Set(["v5"]), }; const result = updateSyncTs(syncTsPath, actionVersions); @@ -206,7 +227,9 @@ const steps = [ fs.writeFileSync(syncTsPath, syncTsContent); const actionVersions = { - "actions/setup-node": "48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0", + "actions/setup-node": new Set([ + "48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0", + ]), }; const result = updateSyncTs(syncTsPath, actionVersions); @@ -244,8 +267,9 @@ steps: "actions/checkout": "v4", "actions/setup-node": "v5 # Latest", }; + const byWorkflow = { ["test.yml"]: actionVersions }; - const result = updateTemplateFiles(checksDir, actionVersions); + const result = updateTemplateFiles(checksDir, byWorkflow); assert.equal(result.length, 1); assert.ok(result.includes(templatePath)); @@ -269,8 +293,9 @@ steps: const actionVersions = { "ruby/setup-ruby": "55511735964dcb71245e7e55f72539531f7bc0eb # v1.257.0", }; + const byWorkflow = { ["test.yml"]: actionVersions }; - const result = updateTemplateFiles(checksDir, actionVersions); + const result = updateTemplateFiles(checksDir, byWorkflow); assert.equal(result.length, 1); const updatedContent = fs.readFileSync(templatePath, "utf8"); diff --git a/pr-checks/sync-back.ts b/pr-checks/sync-back.ts index 233621ea7..702886467 100755 --- a/pr-checks/sync-back.ts +++ b/pr-checks/sync-back.ts @@ -27,16 +27,39 @@ const CHECKS_DIR = path.join(PR_CHECKS_DIR, "checks"); const WORKFLOW_DIR = path.join(REPO_ROOT, ".github", "workflows"); const SYNC_TS_PATH = path.join(PR_CHECKS_DIR, "sync.ts"); +/** Type alias for action names. */ +type ActionName = string; + +/** Type alias for action versions. May include a comment. */ +type ActionVersion = string; + +/** Mappings of {@link ActionName}s to {@link ActionVersion}s. */ +type ActionVersions = Record; + +/** Mappings of workflow names to {@link ActionVersions}. */ +type ActionVersionsByWorkflow = Record; + +/** The result of {@link scanGeneratedWorkflows}. */ +type ScanWorkflowResult = { + /** A mapping of {@link ActionName}s to all encountered {@link ActionVersion}s. */ + actionVersions: Record>; + + /** A mapping of workflow names to {@link ActionVersions}. */ + actionVersionsByWorkflow: ActionVersionsByWorkflow; +}; + /** * Scan generated workflow files to extract the latest action versions. * * @param workflowDir - Path to .github/workflows directory - * @returns Map from action names to their latest versions (including comments) + * + * @returns A {@link ScanWorkflowResult} object containing information about the extracted action versions. */ export function scanGeneratedWorkflows( workflowDir: string, -): Record { - const actionVersions: Record = {}; +): ScanWorkflowResult { + const actionVersionsByWorkflow: ActionVersionsByWorkflow = {}; + const actionVersions: Record> = {}; const generatedFiles = fs .readdirSync(workflowDir) @@ -46,6 +69,10 @@ export function scanGeneratedWorkflows( for (const filePath of generatedFiles) { const content = fs.readFileSync(filePath, "utf8"); + // Get the basename of the workflow and drop the leading `__` from it. + const workflowName = path.basename(filePath).slice(2); + actionVersionsByWorkflow[workflowName] = {}; + // Find all action uses in the file, including potential comments // This pattern captures: action_name@version_with_possible_comment const pattern = /uses:\s+([^/\s]+\/[^@\s]+)@([^@\n]+)/g; @@ -57,13 +84,26 @@ export function scanGeneratedWorkflows( // Only track non-local actions (those with / but not starting with ./) if (!actionName.startsWith("./")) { - // Assume that version numbers are consistent (this should be the case on a Dependabot update PR) - actionVersions[actionName] = versionWithComment; + // Record the version of the action for this workflow. + actionVersionsByWorkflow[workflowName][actionName] = versionWithComment; + + // Record this version for the action so that we can write it to `sync.ts` if needed. + // Usually we'd expect there to be exactly one version per action across all workflows, + // but sometimes these can go out-of-sync if e.g. a workflow is added in a branch and a + // Dependabot PR is merged in the meantime that changes the version of an action that is + // used in the new workflow. Different versions of the same action across different + // workflows is not fundamentally a problem, but we may need to pick one for `sync.ts` + // so we warn there if we have multiple versions of an action. + if (actionVersions[actionName] === undefined) { + actionVersions[actionName] = new Set([versionWithComment]); + } else if (!actionVersions[actionName].has(versionWithComment)) { + actionVersions[actionName].add(versionWithComment); + } } } } - return actionVersions; + return { actionVersions, actionVersionsByWorkflow }; } /** @@ -79,7 +119,7 @@ export function scanGeneratedWorkflows( */ export function updateSyncTs( syncTsPath: string, - actionVersions: Record, + actionVersions: Record>, ): boolean { if (!fs.existsSync(syncTsPath)) { throw new Error(`Could not find ${syncTsPath}`); @@ -89,9 +129,18 @@ export function updateSyncTs( const originalContent = content; // Update hardcoded action versions - for (const [actionName, versionWithComment] of Object.entries( + for (const [actionName, versionsWithComments] of Object.entries( actionVersions, )) { + // We usually expect `versionsWithComments` to contain one version. If there are multiple, + // we arbitrarily pick one and warn about it. + const versionsWithCommentsArray = Array.from(versionsWithComments); + const versionWithComment = versionsWithCommentsArray[0]; + if (versionsWithComments.size > 1) { + console.warn( + `Inconsistent versions for ${actionName}. Arbitrarily picking '${versionWithComment}'. All found: ${versionsWithCommentsArray.join(", ")}`, + ); + } // Split the scanned value into the ref (e.g. a commit SHA) and the optional // trailing version comment (e.g. `v6.0.3`). const ref = versionWithComment.includes("#") @@ -138,12 +187,12 @@ export function updateSyncTs( * Update action versions in template files in pr-checks/checks/ * * @param checksDir - Path to pr-checks/checks directory - * @param actionVersions - Map of action names to versions (may include comments) + * @param actionVersionsByWorkflow - Map of workflows to maps of action names to versions (may include comments) * @returns List of files that were modified */ export function updateTemplateFiles( checksDir: string, - actionVersions: Record, + actionVersionsByWorkflow: ActionVersionsByWorkflow, ): string[] { const modifiedFiles: string[] = []; @@ -156,6 +205,16 @@ export function updateTemplateFiles( let content = fs.readFileSync(filePath, "utf8"); const originalContent = content; + const workflowName = path.basename(filePath); + const actionVersions = actionVersionsByWorkflow[workflowName]; + + if (actionVersions === undefined) { + console.info( + `Found no action versions for workflow template '${filePath}'.`, + ); + continue; + } + // Update action versions for (const [actionName, versionWithComment] of Object.entries( actionVersions, @@ -191,12 +250,15 @@ function main(): number { const verbose = values.verbose ?? false; console.info("Scanning generated workflows for latest action versions..."); - const actionVersions = scanGeneratedWorkflows(WORKFLOW_DIR); + const { actionVersions, actionVersionsByWorkflow } = + scanGeneratedWorkflows(WORKFLOW_DIR); if (verbose) { console.info("Found action versions:"); - for (const [action, version] of Object.entries(actionVersions)) { - console.info(` ${action}@${version}`); + for (const [action, versions] of Object.entries(actionVersions)) { + for (const version of versions) { + console.info(` ${action}@${version}`); + } } } @@ -215,7 +277,10 @@ function main(): number { } // Update template files - const templateModified = updateTemplateFiles(CHECKS_DIR, actionVersions); + const templateModified = updateTemplateFiles( + CHECKS_DIR, + actionVersionsByWorkflow, + ); modifiedFiles.push(...templateModified); if (modifiedFiles.length > 0) { diff --git a/pr-checks/sync.ts b/pr-checks/sync.ts index 0953816c2..ec8d5a57c 100755 --- a/pr-checks/sync.ts +++ b/pr-checks/sync.ts @@ -370,7 +370,7 @@ function writeYaml(filePath: string, workflow: any): void { }); const yamlStr = yaml.stringify(workflowDoc, { aliasDuplicateObjects: false, - singleQuote: true, + singleQuote: false, lineWidth: 0, }); fs.writeFileSync(filePath, stripTrailingWhitespace(header + yamlStr), "utf8"); @@ -595,16 +595,6 @@ function generateJob( // Extract the sequence of steps from the YAML document to persist as much formatting as possible. const specSteps = specDocument.get("steps") as yaml.YAMLSeq; - // A handful of workflow specifications use double quotes for values, while we generally use single quotes. - // This replaces double quotes with single quotes for consistency. - yaml.visit(specSteps, { - Scalar(_key, node) { - if (node.type === "QUOTE_DOUBLE") { - node.type = "QUOTE_SINGLE"; - } - }, - }); - // Add the generated steps in front of the ones from the specification. specSteps.items.unshift(...steps); @@ -802,7 +792,7 @@ function main(): void { } const cron = new yaml.Scalar("0 5 * * *"); - cron.type = yaml.Scalar.QUOTE_SINGLE; + cron.type = yaml.Scalar.QUOTE_DOUBLE; const workflow = { name: `PR Check - ${checkSpecification.name}`, diff --git a/pr-checks/update-release-branch.ts b/pr-checks/update-release-branch.ts index 9d46fd3ec..ca76603a3 100755 --- a/pr-checks/update-release-branch.ts +++ b/pr-checks/update-release-branch.ts @@ -18,18 +18,14 @@ * [--dry-run] */ -import { execFileSync, type ExecFileSyncOptions } from "node:child_process"; +import { execFileSync } from "node:child_process"; import { parseArgs } from "node:util"; import { type ApiClient, getApiClient } from "./api-client"; import * as changelog from "./changelog"; import { transferChangenotesToChangelog } from "./changenotes"; -import { - CHANGELOG_FILE, - CHANGENOTES_DIR, - DryRunOption, - REPO_ROOT, -} from "./config"; +import { runCommand, runGit } from "./command"; +import { CHANGELOG_FILE, CHANGENOTES_DIR } from "./config"; import { getCurrentVersion, replaceVersionInPackageJson, @@ -71,84 +67,6 @@ export function getGitHubToken(): string { throw new Error("Missing GitHub token. Set GITHUB_TOKEN or GH_TOKEN."); } -/** Options for {@link runCommand}. */ -export interface RunCommandOptions extends DryRunOption { - /** Options for `execFileSync`. */ - execOptions?: ExecFileSyncOptions; -} - -/** - * Runs a command, streaming output to the console by default. - * - * @param command The name of the command to run. - * @param args The arguments for the command. - * @throws When the process exits with a non-zero exit code. - * @param options How to run the command. - */ -export function runCommand( - command: string, - args: string[], - options?: RunCommandOptions, -) { - if (!options?.dryRun) { - console.log(`Running \`${command} ${args.join(" ")}\`.`); - return execFileSync(command, args, { - stdio: "inherit", - cwd: REPO_ROOT, - ...options?.execOptions, - }); - } else { - console.info( - `[DRY RUN] Would have executed '${command} ${args.join(" ")}'`, - ); - return ""; - } -} - -/** Options for {@link runGit}. */ -export interface RunGitOptions extends DryRunOption { - /** When true, non-zero exit codes will not throw. */ - allowNonZeroExitCode?: boolean; -} - -/** - * Runs `git` with the given `args` and returns the stdout. - * - * @param args - Arguments to pass to `git`. - * @param options - Optional settings. - * @throws If `git` does not exit successfully, unless - * `options.allowNonZeroExitCode` is `true`. - * @returns The trimmed stdout output. - */ -export function runGit(args: string[], options?: RunGitOptions): string { - const execOptions: ExecFileSyncOptions = { - encoding: "utf8", - stdio: ["pipe", "pipe", "pipe"], - }; - - try { - const result = runCommand("git", args, { - dryRun: options?.dryRun, - execOptions, - }) as string; - return result.trimEnd(); - } catch (error: unknown) { - if (options?.allowNonZeroExitCode) { - // execFileSync throws an object with `stdout` when the process exits - // with a non-zero code. - const execError = error as { stdout?: Buffer | string }; - if (typeof execError.stdout === "string") { - return execError.stdout.trimEnd(); - } - if (Buffer.isBuffer(execError.stdout)) { - return execError.stdout.toString("utf8").trimEnd(); - } - return ""; - } - throw error; - } -} - /** Returns true if the given branch exists on the origin remote. */ export function branchExistsOnRemote(branchName: string): boolean { const result = runGit(["ls-remote", "--heads", ORIGIN, branchName]); diff --git a/resolve-environment/action.yml b/resolve-environment/action.yml index 5a96a3620..770abfac9 100644 --- a/resolve-environment/action.yml +++ b/resolve-environment/action.yml @@ -1,6 +1,6 @@ -name: 'CodeQL: Resolve Build Environment' -description: '[Experimental] Attempt to infer a build environment suitable for automatic builds' -author: 'GitHub' +name: "CodeQL: Resolve Build Environment" +description: "[Experimental] Attempt to infer a build environment suitable for automatic builds" +author: "GitHub" inputs: token: description: "GitHub token to use for authenticating with this instance of GitHub. The token must be the built-in GitHub Actions token, and the workflow must have the `security-events: write` permission. Most of the time it is advisable to avoid specifying this input so that the workflow falls back to using the default value." @@ -21,5 +21,10 @@ outputs: environment: description: The inferred build environment configuration. runs: +<<<<<<< HEAD using: node20 main: '../lib/resolve-environment-entry.js' +======= + using: node24 + main: "../lib/resolve-environment-entry.js" +>>>>>>> origin/releases/v4 diff --git a/setup-codeql/action.yml b/setup-codeql/action.yml index 341cde315..c0ab481d2 100644 --- a/setup-codeql/action.yml +++ b/setup-codeql/action.yml @@ -1,6 +1,6 @@ -name: 'CodeQL: Setup' -description: 'Installs the CodeQL CLI' -author: 'GitHub' +name: "CodeQL: Setup" +description: "Installs the CodeQL CLI" +author: "GitHub" inputs: tools: description: >- @@ -33,7 +33,7 @@ inputs: suited to those analysis kinds. Available options are the same as for the `analysis-kinds` input on the `init` Action. - default: 'code-scanning' + default: "code-scanning" required: true token: description: GitHub token to use for authenticating with this instance of GitHub. @@ -51,5 +51,10 @@ outputs: codeql-version: description: The version of the CodeQL binary that was installed. runs: +<<<<<<< HEAD using: node20 main: '../lib/setup-codeql-entry.js' +======= + using: node24 + main: "../lib/setup-codeql-entry.js" +>>>>>>> origin/releases/v4 diff --git a/src/analyze-action.ts b/src/analyze-action.ts index 2127fd4cb..3c038e62d 100644 --- a/src/analyze-action.ts +++ b/src/analyze-action.ts @@ -59,13 +59,10 @@ import { postProcessAndUploadSarif } from "./upload-sarif"; import * as util from "./util"; interface AnalysisStatusReport - extends uploadLib.UploadStatusReport, - QueriesStatusReport {} + extends uploadLib.UploadStatusReport, QueriesStatusReport {} interface FinishStatusReport - extends StatusReportBase, - DatabaseCreationTimings, - AnalysisStatusReport { + extends StatusReportBase, DatabaseCreationTimings, AnalysisStatusReport { dependency_caching_upload_results?: DependencyCacheUploadStatusReport; database_upload_results: DatabaseUploadResult[]; } @@ -222,8 +219,8 @@ async function run(action: ActionState<["Base", "Logger", "Env", "Actions"]>) { const logger = action.logger; let uploadResults: - | Partial> - | undefined = undefined; + Partial> | undefined = + undefined; let runStats: QueriesStatusReport | undefined = undefined; let config: Config | undefined = undefined; let trapCacheUploadTime: number | undefined = undefined; diff --git a/src/analyze.ts b/src/analyze.ts index 2da347c13..692d2ef1d 100644 --- a/src/analyze.ts +++ b/src/analyze.ts @@ -54,7 +54,9 @@ type RunQueriesDurationStatusReport = { * The "builtin" designation is now outdated with the move to CLI config parsing: this is the time * taken to run _all_ the queries. */ - [L in BuiltInLanguageKey as `analyze_builtin_queries_${L}_duration_ms`]?: number; + [ + L in BuiltInLanguageKey as `analyze_builtin_queries_${L}_duration_ms` + ]?: number; }; type InterpretResultsDurationStatusReport = { @@ -63,8 +65,7 @@ type InterpretResultsDurationStatusReport = { }; export interface QueriesStatusReport - extends RunQueriesDurationStatusReport, - InterpretResultsDurationStatusReport { + extends RunQueriesDurationStatusReport, InterpretResultsDurationStatusReport { /** * Whether the analysis is diff-informed (in the sense that the action generates a diff-range data * extension for the analysis, regardless of whether the data extension is actually used by queries). @@ -319,8 +320,7 @@ export function diffRangeExtensionPackContents( ranges: DiffThunkRange[], checkoutPath: string, ): string { - const header = ` -extensions: + const header = `extensions: - addsTo: pack: codeql/util extensible: restrictAlertsTo @@ -341,7 +341,7 @@ extensions: // characters are escaped, and that the path is always rendered as a // quoted string on a single line. return ( - ` - [${yaml.dump(filename, { forceQuotes: true, quoteStyle: "single" }).trim()}, ` + + ` - [${yaml.dump(filename, { forceQuotes: true, quoteStyle: "double" }).trim()}, ` + `${range.startLine}, ${range.endLine}]\n` ); }) diff --git a/src/debug-artifacts.ts b/src/debug-artifacts.ts index 56497f14e..23a556654 100644 --- a/src/debug-artifacts.ts +++ b/src/debug-artifacts.ts @@ -276,9 +276,7 @@ export function getArtifactSuffix(matrix: string | undefined): string { // Enumerates different, possible outcomes for artifact uploads. export type UploadArtifactsResult = - | "no-artifacts-to-upload" - | "upload-successful" - | "upload-failed"; + "no-artifacts-to-upload" | "upload-successful" | "upload-failed"; /** * Uploads the specified files as a single workflow artifact. diff --git a/src/environment.ts b/src/environment.ts index 6b885a0fe..f3d38075e 100644 --- a/src/environment.ts +++ b/src/environment.ts @@ -240,10 +240,7 @@ export enum SystemEnvVar { /** A type representing all known environment variables. */ export type KnownEnvVar = - | EnvVar - | ActionsEnvVars - | RegistryProxyVars - | SystemEnvVar; + EnvVar | ActionsEnvVars | RegistryProxyVars | SystemEnvVar; /** * Gets an environment variable, but throws an error if it is not set. diff --git a/src/init-action-post.ts b/src/init-action-post.ts index 071137f54..5ae78637f 100644 --- a/src/init-action-post.ts +++ b/src/init-action-post.ts @@ -44,7 +44,8 @@ import { import { checkDiskUsage, checkGitHubVersionInRange, wrapError } from "./util"; interface InitPostStatusReport - extends StatusReportBase, + extends + StatusReportBase, initActionPostHelper.UploadFailedSarifResult, initActionPostHelper.JobStatusReport, initActionPostHelper.DependencyCachingUsageReport {} @@ -56,8 +57,7 @@ async function run(action: ActionState<["Base", "Logger", "Env"]>) { let config: Config | AbortedInitConfig | undefined; let uploadFailedSarifResult: - | initActionPostHelper.UploadFailedSarifResult - | undefined; + initActionPostHelper.UploadFailedSarifResult | undefined; let dependencyCachingUsage: DependencyCachingUsageReport | undefined; try { diff --git a/src/setup-codeql.test.ts b/src/setup-codeql.test.ts index 0b2cefc6f..a244501c3 100644 --- a/src/setup-codeql.test.ts +++ b/src/setup-codeql.test.ts @@ -1869,8 +1869,7 @@ async function runDownloadCodeQL( return { codeqlFolder, cleanupDiagnostic: diagnostic?.attributes as - | toolsDownload.ToolcacheCleanupResult - | undefined, + toolsDownload.ToolcacheCleanupResult | undefined, }; } diff --git a/src/start-proxy/types.ts b/src/start-proxy/types.ts index 17803e912..68bde2b4b 100644 --- a/src/start-proxy/types.ts +++ b/src/start-proxy/types.ts @@ -175,11 +175,7 @@ export const oidcSchemas = [ /** Represents all supported OIDC configurations. */ export type OIDC = - | AzureConfig - | AWSConfig - | JFrogConfig - | CloudsmithConfig - | GCPConfig; + AzureConfig | AWSConfig | JFrogConfig | CloudsmithConfig | GCPConfig; /** All authentication-related fields. */ export type AuthConfig = UsernamePassword | Token | OIDC; diff --git a/src/testdata/pr-diff-range.yml b/src/testdata/pr-diff-range.yml index 073b83198..24f02fbe3 100644 --- a/src/testdata/pr-diff-range.yml +++ b/src/testdata/pr-diff-range.yml @@ -1,8 +1,7 @@ - extensions: - addsTo: pack: codeql/util extensible: restrictAlertsTo checkPresence: false data: - - ['/checkout/path/main.js', 10, 20] + - ["/checkout/path/main.js", 10, 20] diff --git a/src/testing-utils.ts b/src/testing-utils.ts index 2b8e634e9..d3b495363 100644 --- a/src/testing-utils.ts +++ b/src/testing-utils.ts @@ -488,10 +488,10 @@ export interface AssertableTarget { } class CallableEnvBuilder< - Args extends readonly any[], - R, - Fs extends ReadonlyArray, - > + Args extends readonly any[], + R, + Fs extends ReadonlyArray, +> extends BaseEnvBuilder implements AssertableTarget { diff --git a/src/upload-lib.test.ts b/src/upload-lib.test.ts index 4738c07c6..028cce504 100644 --- a/src/upload-lib.test.ts +++ b/src/upload-lib.test.ts @@ -13,7 +13,11 @@ import * as diffUtils from "./diff-informed-analysis-utils"; import { getEnv } from "./environment"; import { Logger } from "./logging"; import * as sarif from "./sarif"; -import { RecordingLogger, setupTests } from "./testing-utils"; +import { + checkExpectedLogMessages, + RecordingLogger, + setupTests, +} from "./testing-utils"; import * as uploadLib from "./upload-lib"; import { UploadPayload } from "./upload-lib/types"; import { GitHubVariant, withTmpDir } from "./util"; @@ -1015,12 +1019,62 @@ for (const analysisKind of analyses.supportedAnalysisKinds) { ); } +function createMockSarifWithResults( + results: sarif.Result[], +): Partial { + return { + version: "2.1.0", + runs: [ + { + tool: { + driver: { + name: "test tool", + }, + }, + results, + }, + ], + }; +} + +function createMockResultWithUri( + uri: string, + startLine = 2, + relatedUri?: string, +): sarif.Result { + return { + ruleId: "test-rule", + message: { text: "test message" }, + locations: [ + { + physicalLocation: { + artifactLocation: { uri }, + region: { startLine }, + }, + }, + ], + ...(relatedUri + ? { + relatedLocations: [ + { + physicalLocation: { + artifactLocation: { uri: relatedUri }, + region: { startLine }, + }, + }, + ], + } + : {}), + }; +} + function runFilterAlertsByDiffRange( input: Partial, diffRanges: diffUtils.DiffThunkRange[], + logger: Logger = new RecordingLogger(), ): Partial { sinon.stub(diffUtils, "readDiffRangesJsonFile").returns(diffRanges); - return uploadLib.filterAlertsByDiffRange(new RecordingLogger(), input); + return uploadLib.filterAlertsByDiffRange(logger, input); } test.serial( @@ -1044,3 +1098,139 @@ test.serial( t.deepEqual(actualOutput, expectedOutput); }, ); + +for (const [filePath, uri] of [ + ["with space/board.js", "with%20space/board.js"], + ["src/[id]/board.js", "src/%5Bid%5D/board.js"], + ["src/file#1.js", "src/file%231.js"], + ["src/100%.js", "src/100%25.js"], + ["src/literal%20.js", "src/literal%2520.js"], + ["src/foo:bar.js", "src/foo%3Abar.js"], + ["src/caf\u00e9.js", "src/caf%C3%A9.js"], + ["src/caf\u00e9.js", "src/caf%c3%a9.js"], +]) { + test.serial( + `filterAlertsByDiffRange matches percent-encoded URI ${uri}`, + (t) => { + const matchingResult = createMockResultWithUri(uri); + const nonMatchingResult = createMockResultWithUri("other.js"); + const input = createMockSarifWithResults([ + matchingResult, + nonMatchingResult, + ]); + + const actualOutput = runFilterAlertsByDiffRange(input, [ + { path: filePath, startLine: 1, endLine: 3 }, + ]); + + t.deepEqual(actualOutput.runs?.[0].results, [matchingResult]); + }, + ); +} + +test.serial( + "filterAlertsByDiffRange filters out percent-encoded URI when outside diff line range", + (t) => { + const outOfRangeResult = createMockResultWithUri( + "with%20space/board.js", + 2, + ); + const inRangeResult = createMockResultWithUri("with%20space/board.js", 15); + const input = createMockSarifWithResults([outOfRangeResult, inRangeResult]); + const actualOutput = runFilterAlertsByDiffRange(input, [ + { path: "with space/board.js", startLine: 10, endLine: 20 }, + ]); + + t.deepEqual(actualOutput.runs?.[0].results, [inRangeResult]); + }, +); + +test.serial( + "filterAlertsByDiffRange filters out percent-encoded URI when path does not match", + (t) => { + const input = createMockSarifWithResults([ + createMockResultWithUri("with%20space/board.js"), + ]); + const actualOutput = runFilterAlertsByDiffRange(input, [ + { path: "other/board.js", startLine: 1, endLine: 3 }, + ]); + + t.deepEqual(actualOutput.runs?.[0].results, []); + }, +); + +test.serial( + "filterAlertsByDiffRange keeps alert when relatedLocations has a matching percent-encoded URI", + (t) => { + const matchingRelatedResult = createMockResultWithUri( + "src/promiseUtils.js", + 2, + "with%20space/ParseObject.js", + ); + const nonMatchingResult = createMockResultWithUri("other.js"); + const input = createMockSarifWithResults([ + matchingRelatedResult, + nonMatchingResult, + ]); + + const actualOutput = runFilterAlertsByDiffRange(input, [ + { path: "with space/ParseObject.js", startLine: 1, endLine: 3 }, + ]); + + t.deepEqual(actualOutput.runs?.[0].results, [matchingRelatedResult]); + }, +); + +for (const uri of ["dir%ZZ/board.js", "src/bad%.js", "src/bad%C3%28.js"]) { + test.serial( + `filterAlertsByDiffRange falls back to raw path for malformed URI ${uri}`, + (t) => { + const logger = new RecordingLogger(); + const matchingResult = createMockResultWithUri(uri); + const input = createMockSarifWithResults([matchingResult]); + const actualOutput = runFilterAlertsByDiffRange( + input, + [{ path: uri, startLine: 1, endLine: 3 }], + logger, + ); + + t.deepEqual(actualOutput.runs?.[0].results, [matchingResult]); + checkExpectedLogMessages(t, logger.messages, [ + `Failed to decode location URI "${uri}", comparing it as a raw path`, + ]); + }, + ); +} + +test.serial( + "filterAlertsByDiffRange filters out malformed URI when raw path does not match", + (t) => { + const logger = new RecordingLogger(); + const input = createMockSarifWithResults([ + createMockResultWithUri("dir%ZZ/board.js"), + ]); + const actualOutput = runFilterAlertsByDiffRange( + input, + [{ path: "src/different.js", startLine: 1, endLine: 3 }], + logger, + ); + + t.deepEqual(actualOutput.runs?.[0].results, []); + checkExpectedLogMessages(t, logger.messages, [ + 'Failed to decode location URI "dir%ZZ/board.js", comparing it as a raw path', + ]); + }, +); + +test.serial( + "filterAlertsByDiffRange matches raw unencoded path containing valid percent-encoding sequence", + (t) => { + const matchingResult = createMockResultWithUri("dir/100%20done.js"); + const input = createMockSarifWithResults([matchingResult]); + const actualOutput = runFilterAlertsByDiffRange(input, [ + { path: "dir/100%20done.js", startLine: 1, endLine: 3 }, + ]); + + t.deepEqual(actualOutput.runs?.[0].results, [matchingResult]); + }, +); diff --git a/src/upload-lib.ts b/src/upload-lib.ts index 4e97c1d1d..52f6fdba6 100644 --- a/src/upload-lib.ts +++ b/src/upload-lib.ts @@ -1099,9 +1099,21 @@ export function filterAlertsByDiffRange( return locations.some((physicalLocation) => { const locationUri = physicalLocation?.artifactLocation?.uri; const locationStartLine = physicalLocation?.region?.startLine; - if (!locationUri || locationStartLine === undefined) { + if ( + typeof locationUri !== "string" || + !locationUri || + locationStartLine === undefined + ) { return false; } + let decodedLocationUri = locationUri; + try { + decodedLocationUri = decodeURIComponent(locationUri); + } catch { + logger.debug( + `Failed to decode location URI "${locationUri}", comparing it as a raw path`, + ); + } // Alert filtering here replicates the same behavior as the restrictAlertsTo // extensible predicate in CodeQL. See the restrictAlertsTo documentation // https://codeql.github.com/codeql-standard-libraries/csharp/codeql/util/AlertFiltering.qll/predicate.AlertFiltering$restrictAlertsTo.3.html @@ -1109,7 +1121,8 @@ export function filterAlertsByDiffRange( // of an alert location. return diffRanges.some( (range) => - range.path === locationUri && + (range.path === decodedLocationUri || + range.path === locationUri) && ((range.startLine <= locationStartLine && range.endLine >= locationStartLine) || (range.startLine === 0 && range.endLine === 0)), diff --git a/src/upload-sarif-action.ts b/src/upload-sarif-action.ts index 0efbcdb40..033663fb7 100644 --- a/src/upload-sarif-action.ts +++ b/src/upload-sarif-action.ts @@ -29,8 +29,7 @@ import { } from "./util"; interface UploadSarifStatusReport - extends StatusReportBase, - upload_lib.UploadStatusReport {} + extends StatusReportBase, upload_lib.UploadStatusReport {} async function sendSuccessStatusReport( startedAt: Date, diff --git a/tests/multi-language-repo/.github/codeql/codeql-config-query-filters1.yml b/tests/multi-language-repo/.github/codeql/codeql-config-query-filters1.yml index 91a8dce37..fbd19b729 100644 --- a/tests/multi-language-repo/.github/codeql/codeql-config-query-filters1.yml +++ b/tests/multi-language-repo/.github/codeql/codeql-config-query-filters1.yml @@ -1,12 +1,12 @@ name: "Check SARIF for default queries with Single include, Single exclude" query-filters: -# This should run js/path-injection and js/zipslip -- include: - tags contain: + # This should run js/path-injection and js/zipslip + - include: + tags contain: - external/cwe/cwe-022 -# Removes js/path-injection -- exclude: - id: + # Removes js/path-injection + - exclude: + id: - js/path-injection diff --git a/tests/multi-language-repo/.github/codeql/codeql-config-query-filters2.yml b/tests/multi-language-repo/.github/codeql/codeql-config-query-filters2.yml index c0d686962..0bd794eb6 100644 --- a/tests/multi-language-repo/.github/codeql/codeql-config-query-filters2.yml +++ b/tests/multi-language-repo/.github/codeql/codeql-config-query-filters2.yml @@ -8,17 +8,17 @@ packs: - codeql-testing/codeql-pack1@1.0.0 query-filters: -# This should run js/path-injection and js/zipslip -- include: - tags contain: + # This should run js/path-injection and js/zipslip + - include: + tags contain: - external/cwe/cwe-022 -# Removes js/path-injection -- exclude: - id: + # Removes js/path-injection + - exclude: + id: - js/path-injection -# Query from extra pack -- include: - id: + # Query from extra pack + - include: + id: - javascript/example/empty-or-one-block diff --git a/tests/multi-language-repo/.github/codeql/codeql-config-query-filters3.yml b/tests/multi-language-repo/.github/codeql/codeql-config-query-filters3.yml index 619442d0f..26171f0bb 100644 --- a/tests/multi-language-repo/.github/codeql/codeql-config-query-filters3.yml +++ b/tests/multi-language-repo/.github/codeql/codeql-config-query-filters3.yml @@ -3,37 +3,36 @@ name: "Check SARIF for query packs and local queries with Single include, Single disable-default-queries: true queries: -# Local query + # Local query - name: Run an extra local query uses: ./codeql-qlpacks/javascript-qlpack/show_ifs.ql -# These queries are ignored + # These queries are ignored - name: Ignored queries uses: ./codeql-qlpacks/complex-python-qlpack/rootAndBar.qls - packs: javascript: - codeql/javascript-queries - codeql-testing/codeql-pack1@1.0.0 query-filters: -# This should run js/path-injection and js/zipslip -- include: - tags contain: - - external/cwe/cwe-022 + # This should run js/path-injection and js/zipslip + - include: + tags contain: + - external/cwe/cwe-022 -# Removes js/path-injection -- exclude: - id: - - js/path-injection + # Removes js/path-injection + - exclude: + id: + - js/path-injection -# Query from extra pack -- include: - id: - - javascript/example/empty-or-one-block + # Query from extra pack + - include: + id: + - javascript/example/empty-or-one-block -# Local query -- include: - id: - - inrepo-javascript-querypack/show-ifs + # Local query + - include: + id: + - inrepo-javascript-querypack/show-ifs diff --git a/tests/multi-language-repo/.github/codeql/custom-queries.yml b/tests/multi-language-repo/.github/codeql/custom-queries.yml index fc80426f7..0e9ff0ff4 100644 --- a/tests/multi-language-repo/.github/codeql/custom-queries.yml +++ b/tests/multi-language-repo/.github/codeql/custom-queries.yml @@ -3,22 +3,22 @@ name: Use custom queries disable-default-queries: true queries: -# Query suites + # Query suites - name: Select a query suite uses: ./codeql-qlpacks/complex-python-qlpack/rootAndBar.qls -# QL pack subset + # QL pack subset - name: Select a ql file uses: ./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql - name: Select a subfolder uses: ./codeql-qlpacks/complex-javascript-qlpack/foo - name: Select a folder with two subfolders uses: ./codeql-qlpacks/complex-javascript-qlpack/foo2 -# Inrepo QL pack + # Inrepo QL pack - name: Select an inrepo ql pack uses: ./codeql-qlpacks/csharp-qlpack - name: Java queries uses: ./codeql-qlpacks/java-qlpack -# External QL packs + # External QL packs - name: Go queries uses: codeql-testing/go-querypack@master - name: Cpp queries diff --git a/tests/multi-language-repo/codeql-qlpacks/complex-javascript-qlpack/qlpack.yml b/tests/multi-language-repo/codeql-qlpacks/complex-javascript-qlpack/qlpack.yml index 95acb04f0..2fc3910e2 100644 --- a/tests/multi-language-repo/codeql-qlpacks/complex-javascript-qlpack/qlpack.yml +++ b/tests/multi-language-repo/codeql-qlpacks/complex-javascript-qlpack/qlpack.yml @@ -1,3 +1,3 @@ name: complex-javascript-querypack version: 0.0.1 -libraryPathDependencies: codeql-javascript \ No newline at end of file +libraryPathDependencies: codeql-javascript diff --git a/tests/multi-language-repo/codeql-qlpacks/complex-python-qlpack/qlpack.yml b/tests/multi-language-repo/codeql-qlpacks/complex-python-qlpack/qlpack.yml index 349294dcf..129bb6078 100644 --- a/tests/multi-language-repo/codeql-qlpacks/complex-python-qlpack/qlpack.yml +++ b/tests/multi-language-repo/codeql-qlpacks/complex-python-qlpack/qlpack.yml @@ -1,3 +1,3 @@ name: inrepo-python-querypack version: 0.0.1 -libraryPathDependencies: codeql-python \ No newline at end of file +libraryPathDependencies: codeql-python diff --git a/tests/multi-language-repo/codeql-qlpacks/cpp-qlpack/qlpack.yml b/tests/multi-language-repo/codeql-qlpacks/cpp-qlpack/qlpack.yml index 7c2ea26cd..5890a8543 100644 --- a/tests/multi-language-repo/codeql-qlpacks/cpp-qlpack/qlpack.yml +++ b/tests/multi-language-repo/codeql-qlpacks/cpp-qlpack/qlpack.yml @@ -1,3 +1,3 @@ name: inrepo-cpp-querypack version: 0.0.1 -libraryPathDependencies: codeql-cpp \ No newline at end of file +libraryPathDependencies: codeql-cpp diff --git a/tests/multi-language-repo/codeql-qlpacks/csharp-qlpack/qlpack.yml b/tests/multi-language-repo/codeql-qlpacks/csharp-qlpack/qlpack.yml index 9a54e7e92..b917d2412 100644 --- a/tests/multi-language-repo/codeql-qlpacks/csharp-qlpack/qlpack.yml +++ b/tests/multi-language-repo/codeql-qlpacks/csharp-qlpack/qlpack.yml @@ -1,3 +1,3 @@ name: inrepo-csharp-querypack version: 0.0.1 -libraryPathDependencies: codeql-csharp \ No newline at end of file +libraryPathDependencies: codeql-csharp diff --git a/tests/multi-language-repo/codeql-qlpacks/go-qlpack/qlpack.yml b/tests/multi-language-repo/codeql-qlpacks/go-qlpack/qlpack.yml index 59ccb6881..2bfd0c9a8 100644 --- a/tests/multi-language-repo/codeql-qlpacks/go-qlpack/qlpack.yml +++ b/tests/multi-language-repo/codeql-qlpacks/go-qlpack/qlpack.yml @@ -1,3 +1,3 @@ name: inrepo-go-querypack version: 0.0.1 -libraryPathDependencies: codeql-go \ No newline at end of file +libraryPathDependencies: codeql-go diff --git a/tests/multi-language-repo/codeql-qlpacks/java-qlpack/qlpack.yml b/tests/multi-language-repo/codeql-qlpacks/java-qlpack/qlpack.yml index 06e8cae7d..86533bde3 100644 --- a/tests/multi-language-repo/codeql-qlpacks/java-qlpack/qlpack.yml +++ b/tests/multi-language-repo/codeql-qlpacks/java-qlpack/qlpack.yml @@ -1,3 +1,3 @@ name: inrepo-java-querypack version: 0.0.1 -libraryPathDependencies: codeql-java \ No newline at end of file +libraryPathDependencies: codeql-java diff --git a/tests/multi-language-repo/codeql-qlpacks/javascript-qlpack/qlpack.yml b/tests/multi-language-repo/codeql-qlpacks/javascript-qlpack/qlpack.yml index f6d5a7b6d..0715661b4 100644 --- a/tests/multi-language-repo/codeql-qlpacks/javascript-qlpack/qlpack.yml +++ b/tests/multi-language-repo/codeql-qlpacks/javascript-qlpack/qlpack.yml @@ -1,3 +1,3 @@ name: inrepo-javascript-querypack version: 0.0.1 -libraryPathDependencies: codeql-javascript \ No newline at end of file +libraryPathDependencies: codeql-javascript diff --git a/tests/multi-language-repo/codeql-qlpacks/python-qlpack/qlpack.yml b/tests/multi-language-repo/codeql-qlpacks/python-qlpack/qlpack.yml index 349294dcf..129bb6078 100644 --- a/tests/multi-language-repo/codeql-qlpacks/python-qlpack/qlpack.yml +++ b/tests/multi-language-repo/codeql-qlpacks/python-qlpack/qlpack.yml @@ -1,3 +1,3 @@ name: inrepo-python-querypack version: 0.0.1 -libraryPathDependencies: codeql-python \ No newline at end of file +libraryPathDependencies: codeql-python diff --git a/upload-sarif/action.yml b/upload-sarif/action.yml index 93a36e4f9..d56587e62 100644 --- a/upload-sarif/action.yml +++ b/upload-sarif/action.yml @@ -1,6 +1,6 @@ -name: 'Code Scanning : Upload SARIF' -description: 'Upload the analysis results' -author: 'GitHub' +name: "Code Scanning : Upload SARIF" +description: "Upload the analysis results" +author: "GitHub" inputs: sarif_file: description: | @@ -8,7 +8,7 @@ inputs: See https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/uploading-a-sarif-file-to-github#uploading-a-code-scanning-analysis-with-github-actions for information on the maximum number of results and maximum file size supported by code scanning. required: false - default: '../results' + default: "../results" checkout_path: description: "The path at which the analyzed repository was checked out. Used to relativize any absolute paths in the uploaded SARIF file." required: false @@ -41,6 +41,12 @@ outputs: { "code-scanning": "some-id", "code-quality": "some-other-id" } runs: +<<<<<<< HEAD using: node20 main: '../lib/upload-sarif-entry.js' post: '../lib/upload-sarif-post-entry.js' +======= + using: node24 + main: "../lib/upload-sarif-entry.js" + post: "../lib/upload-sarif-post-entry.js" +>>>>>>> origin/releases/v4