Compare commits

...

79 Commits

Author SHA1 Message Date
Michael B. Gale
5378192d25 Update changelog for v3.28.21 2025-07-28 16:10:50 +01:00
github-actions[bot]
23aee9a3fc Update supported GitHub Enterprise Server versions 2025-07-28 16:08:39 +01:00
Koen Vlaswinkel
07bb2b932c Update changelog and version for v3.28.20 2025-07-21 11:24:11 +02:00
Koen Vlaswinkel
f6c7f63bda Ignore pre-release parts when comparing GHES versions 2025-07-21 11:19:24 +02:00
Koen Vlaswinkel
6370c01206 Move comment to JSDoc 2025-07-21 11:19:07 +02:00
Koen Vlaswinkel
dd627a9af6 Fix parsing of GHES pre-release versions 2025-07-21 11:19:02 +02:00
Koen Vlaswinkel
bcdb4ecb96 Unconditionally disable combining SARIF files for GHES 3.18 2025-07-21 11:18:49 +02:00
Koen Vlaswinkel
c0809df981 Remove support for combining SARIF runs with non-unique categories 2025-07-21 11:18:34 +02:00
Chris Smowton
ff0a06e83c Merge pull request #2896 from github/update-v3.28.18-b86edfc27
Merge main into releases/v3
2025-05-16 11:14:47 +01:00
github-actions[bot]
a41e0844be Update changelog for v3.28.18 2025-05-16 09:36:50 +00:00
Chris Smowton
b86edfc27a Merge pull request #2893 from github/update-bundle/codeql-bundle-v2.21.3
Update default bundle to 2.21.3
2025-05-15 12:40:00 +01:00
Henry Mercer
e93b90025f Merge branch 'main' into update-bundle/codeql-bundle-v2.21.3 2025-05-14 19:57:41 +01:00
Henry Mercer
510dfa3460 Merge pull request #2894 from github/henrymercer/skip-validating-codeql-sarif
Skip validating SARIF produced by CodeQL
2025-05-14 19:55:03 +01:00
Henry Mercer
492d783245 Merge branch 'main' into henrymercer/skip-validating-codeql-sarif 2025-05-14 19:16:54 +01:00
Henry Mercer
83bdf3b7f9 Merge pull request #2859 from github/update-supported-enterprise-server-versions
Update supported GitHub Enterprise Server versions
2025-05-14 19:15:31 +01:00
Andrew Eisenberg
cffc916774 Merge pull request #2891 from austinpray-mixpanel/patch-1
Allow configuring CODEQL_THREADS with an env var
2025-05-14 14:00:23 -04:00
Henry Mercer
4420887272 Add deprecation warning for CodeQL 2.16.5 and earlier 2025-05-14 17:13:10 +01:00
Henry Mercer
4e178c5841 Update supported versions table in README 2025-05-14 17:12:44 +01:00
Henry Mercer
05446e4bbf Merge branch 'main' into update-supported-enterprise-server-versions 2025-05-14 16:58:40 +01:00
Austin Pray
bb9fc01aa6 Update CHANGELOG.md 2025-05-14 10:44:35 -05:00
Austin Pray
3dce55ac70 rebuild 2025-05-14 15:41:39 +00:00
github-actions[bot]
bacf5fe7c2 Rebuild 2025-05-14 14:23:08 +00:00
Henry Mercer
15f19ac220 Improve docstring
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-14 15:21:38 +01:00
Henry Mercer
f7ab654551 Add changelog note 2025-05-14 15:12:22 +01:00
Henry Mercer
2f70a988e7 Skip validating SARIF produced by CodeQL 2025-05-14 15:11:16 +01:00
Henry Mercer
f681ad69a7 Add utility function to get testing environment 2025-05-14 14:10:19 +01:00
github-actions[bot]
15447f393e Add changelog note 2025-05-13 22:28:13 +00:00
github-actions[bot]
ded79fc5fd Update default bundle to codeql-bundle-v2.21.3 2025-05-13 22:28:10 +00:00
Austin Pray
77ae18dc82 Revert "threads defaults to CODEQL_THREADS env var"
This reverts commit df7d681f04.
2025-05-13 22:19:47 +00:00
Austin Pray
df7d681f04 threads defaults to CODEQL_THREADS env var 2025-05-13 20:13:00 +00:00
Nick Fyson
15bce5bb14 Merge pull request #2892 from github/dependabot/npm_and_yarn/npm-9a9ecb9151
build(deps): bump the npm group across 1 directory with 4 updates
2025-05-13 11:35:20 +01:00
Nick Fyson
c64095f75e Merge pull request #2889 from github/dependabot/github_actions/actions-b37916a4ef
build(deps): bump the actions group with 2 updates
2025-05-13 11:16:24 +01:00
nickfyson
07dbe6f6f7 update generated workflows 2025-05-13 11:02:59 +01:00
github-actions[bot]
3d97729508 Update checked-in dependencies 2025-05-12 18:01:08 +00:00
dependabot[bot]
d5e9ae3f8b build(deps): bump the npm group across 1 directory with 4 updates
Bumps the npm group with 4 updates in the / directory: [semver](https://github.com/npm/node-semver), [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js), [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) and [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser).


Updates `semver` from 7.7.1 to 7.7.2
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v7.7.1...v7.7.2)

Updates `@eslint/js` from 9.25.1 to 9.26.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/commits/v9.26.0/packages/js)

Updates `@typescript-eslint/eslint-plugin` from 8.31.1 to 8.32.1
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.32.1/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 8.31.1 to 8.32.1
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.32.1/packages/parser)

---
updated-dependencies:
- dependency-name: semver
  dependency-version: 7.7.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@eslint/js"
  dependency-version: 9.26.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-version: 8.32.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: "@typescript-eslint/parser"
  dependency-version: 8.32.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-12 18:00:33 +00:00
Austin Pray
c41b278fa8 Allow configuring CODEQL_THREADS with an env var
ref https://github.com/github/codeql-action/issues/2890
2025-05-05 21:28:43 -05:00
dependabot[bot]
7657741c79 build(deps): bump the actions group with 2 updates
Bumps the actions group with 2 updates: [ruby/setup-ruby](https://github.com/ruby/setup-ruby) and [actions/create-github-app-token](https://github.com/actions/create-github-app-token).


Updates `ruby/setup-ruby` from 1.230.0 to 1.237.0
- [Release notes](https://github.com/ruby/setup-ruby/releases)
- [Changelog](https://github.com/ruby/setup-ruby/blob/master/release.rb)
- [Commits](e5ac7b085f...eaecf785f6)

Updates `actions/create-github-app-token` from 2.0.2 to 2.0.6
- [Release notes](https://github.com/actions/create-github-app-token/releases)
- [Commits](https://github.com/actions/create-github-app-token/compare/v2.0.2...v2.0.6)

---
updated-dependencies:
- dependency-name: ruby/setup-ruby
  dependency-version: 1.237.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: actions/create-github-app-token
  dependency-version: 2.0.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-05 18:27:10 +00:00
Nick Rolfe
5eb3ed6614 Merge pull request #2887 from github/mergeback/v3.28.17-to-main-60168efe
Mergeback v3.28.17 refs/heads/releases/v3 into main
2025-05-02 11:26:39 +01:00
github-actions[bot]
213a8a5a44 Update checked-in dependencies 2025-05-02 09:30:05 +00:00
github-actions[bot]
c46165d67e Update changelog and version after v3.28.17 2025-05-02 09:27:21 +00:00
Nick Rolfe
60168efe1c Merge pull request #2886 from github/update-v3.28.17-97a2bfd2a
Merge main into releases/v3
2025-05-02 10:26:47 +01:00
github-actions[bot]
0d5a3115da Update changelog for v3.28.17 2025-05-02 09:10:30 +00:00
Nick Rolfe
97a2bfd2a3 Merge pull request #2872 from github/update-bundle/codeql-bundle-v2.21.2
Update default bundle to 2.21.2
2025-05-01 13:31:16 +01:00
Nick Rolfe
9aba20e4c9 Merge branch 'main' into update-bundle/codeql-bundle-v2.21.2 2025-05-01 13:16:31 +01:00
Henry Mercer
81a9508deb Merge pull request #2876 from github/henrymercer/fix-diff-informed-multiple-analyze
Do not fail diff informed analyses when analyze is run twice in the same job
2025-05-01 13:07:58 +01:00
Henry Mercer
1569f4c145 Disable diff-informed queries in code scanning config tests 2025-05-01 12:14:34 +01:00
Henry Mercer
62fbeb66b3 Merge branch 'main' into henrymercer/fix-diff-informed-multiple-analyze 2025-05-01 12:05:02 +01:00
Henry Mercer
f122d1dc9e Address test failures from computing temporary directory too early
These relied on the RUNNER_TEMP environment variable that does not necessarily exist when running locally.
2025-05-01 12:01:22 +01:00
Henry Mercer
083772aae4 Do not fail diff informed analyses when analyze is run twice in the same job 2025-05-01 12:00:46 +01:00
Nick Rolfe
5db14d0471 Merge branch 'main' into update-bundle/codeql-bundle-v2.21.2 2025-05-01 10:28:59 +01:00
Andrew Eisenberg
40e16edda1 Merge pull request #2874 from github/aeisenberg/add-actions-telemetry
Add actions-specific telemetry fields
2025-04-30 08:02:38 -07:00
Andrew Eisenberg
3ca9a88941 Add actions-specific telemetry fields 2025-04-29 16:14:46 -07:00
Henry Mercer
ed51cb5abd Merge pull request #2873 from github/dependabot/npm_and_yarn/npm-a5e2fd638a
build(deps-dev): bump the npm group with 2 updates
2025-04-29 11:36:38 +01:00
Andrew Eisenberg
8ccb6b16a6 Merge pull request #2861 from github/dependabot/github_actions/actions-0553007f0f
build(deps): bump ruby/setup-ruby from 1.229.0 to 1.230.0 in the actions group
2025-04-29 03:21:43 -07:00
github-actions[bot]
1817a33c8b Update checked-in dependencies 2025-04-28 18:49:27 +00:00
dependabot[bot]
6893d12604 build(deps-dev): bump the npm group with 2 updates
Bumps the npm group with 2 updates: [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) and [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser).


Updates `@typescript-eslint/eslint-plugin` from 8.31.0 to 8.31.1
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.31.1/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 8.31.0 to 8.31.1
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.31.1/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-version: 8.31.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@typescript-eslint/parser"
  dependency-version: 8.31.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-28 18:48:49 +00:00
Henry Mercer
83605b3ce2 Merge pull request #2864 from github/dependabot/npm_and_yarn/npm-cac24ffe08
build(deps): bump the npm group across 1 directory with 7 updates
2025-04-28 18:34:13 +01:00
github-actions[bot]
6a3cfab0e9 Add changelog note 2025-04-28 15:20:43 +00:00
github-actions[bot]
4b7eecf8a7 Update default bundle to codeql-bundle-v2.21.2 2025-04-28 15:20:40 +00:00
Michael B. Gale
018ac1a585 Merge pull request #2834 from github/mbg/private-registry/goproxy
Go: Support `GOPROXY` via the Dependabot proxy
2025-04-28 11:11:41 +01:00
Michael B. Gale
6ad5d99ccc Add goproxy_server to LANGUAGE_TO_REGISTRY_TYPE 2025-04-25 16:56:36 +01:00
Michael B. Gale
f843d94177 Merge pull request #2869 from github/mbg/proxy/use-2.21.1-artifacts
Use proxy artifacts for `v2.21.1`
2025-04-25 16:50:50 +01:00
Michael B. Gale
2264a4ecc1 Merge branch 'main' into mbg/proxy/use-2.21.1-artifacts 2025-04-25 14:25:57 +01:00
Michael B. Gale
d3b65fcaf0 Merge pull request #2870 from github/mbg/ci/retire-ubuntu-20.04
Remove ubuntu-20.04 and add ubuntu-24.04
2025-04-25 14:25:40 +01:00
Michael B. Gale
eea52ddc4e Remove ubuntu-20.04 and add ubuntu-24.04 2025-04-25 13:03:25 +01:00
Michael B. Gale
6ef9b921b1 Use proxy artifacts for v2.21.1 2025-04-24 18:20:31 +01:00
Ian Lynagh
4ffa2364a0 Merge pull request #2867 from github/mergeback/v3.28.16-to-main-28deaeda
Mergeback v3.28.16 refs/heads/releases/v3 into main
2025-04-23 13:34:31 +01:00
github-actions[bot]
7e00290d34 Update checked-in dependencies 2025-04-23 12:17:11 +00:00
github-actions[bot]
259434501f Update changelog and version after v3.28.16 2025-04-23 12:10:49 +00:00
Ian Lynagh
28deaeda66 Merge pull request #2865 from github/update-v3.28.16-2a8cbadc0
Merge main into releases/v3
2025-04-23 13:10:18 +01:00
github-actions[bot]
03c5d71c11 Update changelog for v3.28.16 2025-04-23 10:40:48 +00:00
Ian Lynagh
2a8cbadc02 Merge pull request #2863 from github/update-bundle/codeql-bundle-v2.21.1
Update default bundle to 2.21.1
2025-04-22 12:30:12 +01:00
github-actions[bot]
95d52b7807 Update checked-in dependencies 2025-04-21 18:01:41 +00:00
dependabot[bot]
c9f0d30a86 build(deps): bump the npm group across 1 directory with 7 updates
Bumps the npm group with 7 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [@octokit/types](https://github.com/octokit/types.ts) | `13.10.0` | `14.0.0` |
| [long](https://github.com/dcodeIO/long.js) | `5.3.1` | `5.3.2` |
| [octokit](https://github.com/octokit/octokit.js) | `4.1.2` | `4.1.3` |
| [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js) | `9.24.0` | `9.25.1` |
| [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) | `8.29.0` | `8.31.0` |
| [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) | `8.29.0` | `8.31.0` |
| [nock](https://github.com/nock/nock) | `14.0.3` | `14.0.4` |



Updates `@octokit/types` from 13.10.0 to 14.0.0
- [Release notes](https://github.com/octokit/types.ts/releases)
- [Commits](https://github.com/octokit/types.ts/compare/v13.10.0...v14.0.0)

Updates `long` from 5.3.1 to 5.3.2
- [Release notes](https://github.com/dcodeIO/long.js/releases)
- [Commits](https://github.com/dcodeIO/long.js/compare/v5.3.1...v5.3.2)

Updates `octokit` from 4.1.2 to 4.1.3
- [Release notes](https://github.com/octokit/octokit.js/releases)
- [Commits](https://github.com/octokit/octokit.js/compare/v4.1.2...v4.1.3)

Updates `@eslint/js` from 9.24.0 to 9.25.1
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/commits/v9.25.1/packages/js)

Updates `@typescript-eslint/eslint-plugin` from 8.29.0 to 8.31.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.31.0/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 8.29.0 to 8.31.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.31.0/packages/parser)

Updates `nock` from 14.0.3 to 14.0.4
- [Release notes](https://github.com/nock/nock/releases)
- [Changelog](https://github.com/nock/nock/blob/main/CHANGELOG.md)
- [Commits](https://github.com/nock/nock/compare/v14.0.3...v14.0.4)

---
updated-dependencies:
- dependency-name: "@octokit/types"
  dependency-version: 14.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: npm
- dependency-name: long
  dependency-version: 5.3.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: octokit
  dependency-version: 4.1.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@eslint/js"
  dependency-version: 9.25.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-version: 8.31.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: "@typescript-eslint/parser"
  dependency-version: 8.31.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: nock
  dependency-version: 14.0.4
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-21 18:01:03 +00:00
github-actions[bot]
f76eaf51a6 Add changelog note 2025-04-16 16:54:18 +00:00
github-actions[bot]
e63b3f5166 Update default bundle to codeql-bundle-v2.21.1 2025-04-16 16:54:11 +00:00
Andrew Eisenberg
c0cffae534 Update checks file 2025-04-14 14:00:02 -07:00
dependabot[bot]
7eaba0dbc6 build(deps): bump ruby/setup-ruby in the actions group
Bumps the actions group with 1 update: [ruby/setup-ruby](https://github.com/ruby/setup-ruby).


Updates `ruby/setup-ruby` from 1.229.0 to 1.230.0
- [Release notes](https://github.com/ruby/setup-ruby/releases)
- [Changelog](https://github.com/ruby/setup-ruby/blob/master/release.rb)
- [Commits](354a1ad156...e5ac7b085f)

---
updated-dependencies:
- dependency-name: ruby/setup-ruby
  dependency-version: 1.230.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-14 17:57:59 +00:00
github-actions[bot]
d1c7d49753 Update supported GitHub Enterprise Server versions 2025-04-11 00:16:14 +00:00
835 changed files with 504010 additions and 5102 deletions

View File

@@ -46,7 +46,7 @@ jobs:
use-all-platform-bundle: 'false'
setup-kotlin: 'true'
- name: Set up Ruby
uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1.229.0
uses: ruby/setup-ruby@e5ac7b085f6e63d49c8973eb0c6e04d876b881f1 # v1.230.0
with:
ruby-version: 2.6
- name: Install Code Scanning integration

View File

@@ -75,7 +75,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04,ubuntu-22.04,windows-2019,windows-2022,macos-13,macos-14]
os: [ubuntu-22.04,ubuntu-24.04,windows-2019,windows-2022,macos-13,macos-14]
tools: ${{ fromJson(needs.check-codeql-versions.outputs.versions) }}
runs-on: ${{ matrix.os }}

View File

@@ -3,6 +3,9 @@
name: Code-Scanning config CLI tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Diff informed queries add an additional query filter which is not yet
# taken into account by these tests.
CODEQL_ACTION_DIFF_INFORMED_QUERIES: false
on:
push:

View File

@@ -168,7 +168,7 @@ jobs:
--draft
- name: Generate token
uses: actions/create-github-app-token@v2.0.2
uses: actions/create-github-app-token@v2.0.6
id: app-token
with:
app-id: ${{ vars.AUTOMATION_APP_ID }}

View File

@@ -124,7 +124,7 @@ jobs:
pull-requests: write # needed to create pull request
steps:
- name: Generate token
uses: actions/create-github-app-token@v2.0.2
uses: actions/create-github-app-token@v2.0.6
id: app-token
with:
app-id: ${{ vars.AUTOMATION_APP_ID }}

View File

@@ -2,10 +2,28 @@
See the [releases page](https://github.com/github/codeql-action/releases) for the relevant changes to the CodeQL CLI and language packs.
## [UNRELEASED]
## 3.28.21 - 28 July 2025
No user facing changes.
## 3.28.20 - 21 July 2025
- Remove support for combining SARIF files from a single upload for GHES 3.18, see [the changelog post](https://github.blog/changelog/2024-05-06-code-scanning-will-stop-combining-runs-from-a-single-upload/). [#2959](https://github.com/github/codeql-action/pull/2959)
## 3.28.18 - 16 May 2025
- Update default CodeQL bundle version to 2.21.3. [#2893](https://github.com/github/codeql-action/pull/2893)
- Skip validating SARIF produced by CodeQL for improved performance. [#2894](https://github.com/github/codeql-action/pull/2894)
- The number of threads and amount of RAM used by CodeQL can now be set via the `CODEQL_THREADS` and `CODEQL_RAM` runner environment variables. If set, these environment variables override the `threads` and `ram` inputs respectively. [#2891](https://github.com/github/codeql-action/pull/2891)
## 3.28.17 - 02 May 2025
- Update default CodeQL bundle version to 2.21.2. [#2872](https://github.com/github/codeql-action/pull/2872)
## 3.28.16 - 23 Apr 2025
- Update default CodeQL bundle version to 2.21.1. [#2863](https://github.com/github/codeql-action/pull/2863)
## 3.28.15 - 07 Apr 2025
- Fix bug where the action would fail if it tried to produce a debug artifact with more than 65535 files. [#2842](https://github.com/github/codeql-action/pull/2842)

View File

@@ -70,10 +70,11 @@ We typically release new minor versions of the CodeQL Action and Bundle when a n
| Minimum CodeQL Action | Minimum CodeQL Bundle Version | GitHub Environment | Notes |
|-----------------------|-------------------------------|--------------------|-------|
| `v3.26.6` | `2.18.4` | Enterprise Server 3.15 | |
| `v3.25.11` | `2.17.6` | Enterprise Server 3.14 | |
| `v3.24.11` | `2.16.6` | Enterprise Server 3.13 | |
| `v3.22.12` | `2.15.5` | Enterprise Server 3.12 | |
| `v3.28.12` | `2.20.7` | Enterprise Server 3.17 | |
| `v3.28.6` | `2.20.3` | Enterprise Server 3.16 | |
| `v3.28.6` | `2.20.3` | Enterprise Server 3.15 | |
| `v3.28.6` | `2.20.3` | Enterprise Server 3.14 | |
| `v3.28.6` | `2.20.3` | Enterprise Server 3.13 | |
See the full list of GHES release and deprecation dates at [GitHub Enterprise Server releases](https://docs.github.com/en/enterprise-server/admin/all-releases#releases-of-github-enterprise-server).

13
lib/analyze.js generated
View File

@@ -64,7 +64,6 @@ const logging_1 = require("./logging");
const repository_1 = require("./repository");
const tools_features_1 = require("./tools-features");
const tracer_config_1 = require("./tracer-config");
const upload_lib_1 = require("./upload-lib");
const util = __importStar(require("./util"));
const util_1 = require("./util");
class CodeQLAnalysisError extends Error {
@@ -343,7 +342,12 @@ function writeDiffRangeDataExtensionPack(logger, ranges) {
ranges = [{ path: "", startLine: 0, endLine: 0 }];
}
const diffRangeDir = path.join(actionsUtil.getTemporaryDirectory(), "pr-diff-range");
fs.mkdirSync(diffRangeDir);
// We expect the Actions temporary directory to already exist, so are mainly
// using `recursive: true` to avoid errors if the directory already exists,
// for example if the analyze Action is run multiple times in the same job.
// This is not really something that is supported, but we make use of it in
// tests.
fs.mkdirSync(diffRangeDir, { recursive: true });
fs.writeFileSync(path.join(diffRangeDir, "qlpack.yml"), `
name: codeql-action/pr-diff-range
version: 0.0.0
@@ -424,7 +428,7 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
logger.endGroup();
logger.info(analysisSummary);
if (await features.getValue(feature_flags_1.Feature.QaTelemetryEnabled)) {
const perQueryAlertCounts = getPerQueryAlertCounts(sarifFile, logger);
const perQueryAlertCounts = getPerQueryAlertCounts(sarifFile);
const perQueryAlertCountEventReport = {
event: "codeql database interpret-results",
started_at: startTimeInterpretResults.toISOString(),
@@ -452,8 +456,7 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
return await codeql.databaseInterpretResults(databasePath, queries, sarifFile, addSnippetsFlag, threadsFlag, enableDebugLogging ? "-vv" : "-v", sarifRunPropertyFlag, automationDetailsId, config, features);
}
/** Get an object with all queries and their counts parsed from a SARIF file path. */
function getPerQueryAlertCounts(sarifPath, log) {
(0, upload_lib_1.validateSarifFileSchema)(sarifPath, log);
function getPerQueryAlertCounts(sarifPath) {
const sarifObject = JSON.parse(fs.readFileSync(sarifPath, "utf8"));
// We do not need to compute fingerprints because we are not sending data based off of locations.
// Generate the query: alert count object

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
{ "maximumVersion": "3.17", "minimumVersion": "3.12" }
{ "maximumVersion": "3.18", "minimumVersion": "3.13" }

6
lib/codeql.js generated
View File

@@ -78,15 +78,15 @@ const CODEQL_MINIMUM_VERSION = "2.15.5";
/**
* This version will shortly become the oldest version of CodeQL that the Action will run with.
*/
const CODEQL_NEXT_MINIMUM_VERSION = "2.15.5";
const CODEQL_NEXT_MINIMUM_VERSION = "2.16.6";
/**
* This is the version of GHES that was most recently deprecated.
*/
const GHES_VERSION_MOST_RECENTLY_DEPRECATED = "3.11";
const GHES_VERSION_MOST_RECENTLY_DEPRECATED = "3.12";
/**
* This is the deprecation date for the version of GHES that was most recently deprecated.
*/
const GHES_MOST_RECENT_DEPRECATION_DATE = "2024-12-19";
const GHES_MOST_RECENT_DEPRECATION_DATE = "2025-04-03";
/** The CLI verbosity level to use for extraction in debug mode. */
const EXTRACTION_DEBUG_MODE_VERBOSITY = "progress++";
/*

View File

@@ -1,6 +1,6 @@
{
"bundleVersion": "codeql-bundle-v2.21.0",
"cliVersion": "2.21.0",
"priorBundleVersion": "codeql-bundle-v2.20.7",
"priorCliVersion": "2.20.7"
"bundleVersion": "codeql-bundle-v2.21.3",
"cliVersion": "2.21.3",
"priorBundleVersion": "codeql-bundle-v2.21.2",
"priorCliVersion": "2.21.2"
}

View File

@@ -57,42 +57,44 @@ function getJavaTempDependencyDir() {
/**
* Default caching configurations per language.
*/
const CODEQL_DEFAULT_CACHE_CONFIG = {
java: {
paths: [
// Maven
(0, path_1.join)(os.homedir(), ".m2", "repository"),
// Gradle
(0, path_1.join)(os.homedir(), ".gradle", "caches"),
// CodeQL Java build-mode: none
getJavaTempDependencyDir(),
],
hash: [
// Maven
"**/pom.xml",
// Gradle
"**/*.gradle*",
"**/gradle-wrapper.properties",
"buildSrc/**/Versions.kt",
"buildSrc/**/Dependencies.kt",
"gradle/*.versions.toml",
"**/versions.properties",
],
},
csharp: {
paths: [(0, path_1.join)(os.homedir(), ".nuget", "packages")],
hash: [
// NuGet
"**/packages.lock.json",
// Paket
"**/paket.lock",
],
},
go: {
paths: [(0, path_1.join)(os.homedir(), "go", "pkg", "mod")],
hash: ["**/go.sum"],
},
};
function getDefaultCacheConfig() {
return {
java: {
paths: [
// Maven
(0, path_1.join)(os.homedir(), ".m2", "repository"),
// Gradle
(0, path_1.join)(os.homedir(), ".gradle", "caches"),
// CodeQL Java build-mode: none
getJavaTempDependencyDir(),
],
hash: [
// Maven
"**/pom.xml",
// Gradle
"**/*.gradle*",
"**/gradle-wrapper.properties",
"buildSrc/**/Versions.kt",
"buildSrc/**/Dependencies.kt",
"gradle/*.versions.toml",
"**/versions.properties",
],
},
csharp: {
paths: [(0, path_1.join)(os.homedir(), ".nuget", "packages")],
hash: [
// NuGet
"**/packages.lock.json",
// Paket
"**/paket.lock",
],
},
go: {
paths: [(0, path_1.join)(os.homedir(), "go", "pkg", "mod")],
hash: ["**/go.sum"],
},
};
}
async function makeGlobber(patterns) {
return glob.create(patterns.join("\n"));
}
@@ -106,7 +108,7 @@ async function makeGlobber(patterns) {
async function downloadDependencyCaches(languages, logger) {
const restoredCaches = [];
for (const language of languages) {
const cacheConfig = CODEQL_DEFAULT_CACHE_CONFIG[language];
const cacheConfig = getDefaultCacheConfig()[language];
if (cacheConfig === undefined) {
logger.info(`Skipping download of dependency cache for ${language} as we have no caching configuration for it.`);
continue;
@@ -140,7 +142,7 @@ async function downloadDependencyCaches(languages, logger) {
*/
async function uploadDependencyCaches(config, logger) {
for (const language of config.languages) {
const cacheConfig = CODEQL_DEFAULT_CACHE_CONFIG[language];
const cacheConfig = getDefaultCacheConfig()[language];
if (cacheConfig === undefined) {
logger.info(`Skipping upload of dependency cache for ${language} as we have no caching configuration for it.`);
continue;

View File

@@ -1 +1 @@
{"version":3,"file":"dependency-caching.js","sourceRoot":"","sources":["../src/dependency-caching.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,4DAEC;AAqDD,4DAmDC;AAQD,wDAiEC;AAvND,uCAAyB;AACzB,+BAA4B;AAE5B,6DAA+C;AAC/C,oDAAsC;AAEtC,iDAAuD;AACvD,mDAAoD;AAEpD,+CAA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IAAI,YAAY,KAAK,SAAS,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1D,MAAM,GAAG,GAAG,MAAM,IAAI,YAAY,EAAE,CAAC;IACvC,CAAC;IAED,OAAO,GAAG,MAAM,IAAI,+BAA+B,IAAI,QAAQ,IAAI,QAAQ,GAAG,CAAC;AACjF,CAAC"}

6
lib/feature-flags.js generated
View File

@@ -61,6 +61,7 @@ var Feature;
Feature["CppBuildModeNone"] = "cpp_build_mode_none";
Feature["CppDependencyInstallation"] = "cpp_dependency_installation_enabled";
Feature["DiffInformedQueries"] = "diff_informed_queries";
Feature["DisableCombineSarifFiles"] = "disable_combine_sarif_files";
Feature["DisableCsharpBuildless"] = "disable_csharp_buildless";
Feature["DisableJavaBuildlessEnabled"] = "disable_java_buildless_enabled";
Feature["DisableKotlinAnalysisEnabled"] = "disable_kotlin_analysis_enabled";
@@ -98,6 +99,11 @@ exports.featureConfig = {
envVar: "CODEQL_ACTION_DIFF_INFORMED_QUERIES",
minimumVersion: "2.21.0",
},
[Feature.DisableCombineSarifFiles]: {
defaultValue: false,
envVar: "CODEQL_ACTION_DISABLE_COMBINE_SARIF_FILES",
minimumVersion: undefined,
},
[Feature.DisableCsharpBuildless]: {
defaultValue: false,
envVar: "CODEQL_ACTION_DISABLE_CSHARP_BUILDLESS",

File diff suppressed because one or more lines are too long

3
lib/init-action.js generated
View File

@@ -319,7 +319,8 @@ async function run() {
// for details.
core.exportVariable("CODEQL_RAM", process.env["CODEQL_RAM"] ||
(0, util_1.getMemoryFlagValue)((0, actions_util_1.getOptionalInput)("ram"), logger).toString());
core.exportVariable("CODEQL_THREADS", (0, util_1.getThreadsFlagValue)((0, actions_util_1.getOptionalInput)("threads"), logger).toString());
core.exportVariable("CODEQL_THREADS", process.env["CODEQL_THREADS"] ||
(0, util_1.getThreadsFlagValue)((0, actions_util_1.getOptionalInput)("threads"), logger).toString());
// Disable Kotlin extractor if feature flag set
if (await features.getValue(feature_flags_1.Feature.DisableKotlinAnalysisEnabled)) {
core.exportVariable("CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN", "true");

File diff suppressed because one or more lines are too long

View File

@@ -43,8 +43,8 @@ const logging_1 = require("./logging");
const start_proxy_1 = require("./start-proxy");
const util = __importStar(require("./util"));
const UPDATEJOB_PROXY = "update-job-proxy";
const UPDATEJOB_PROXY_VERSION = "v2.0.20241023203727";
const UPDATEJOB_PROXY_URL_PREFIX = "https://github.com/github/codeql-action/releases/download/codeql-bundle-v2.18.1/";
const UPDATEJOB_PROXY_VERSION = "v2.0.20250424171100";
const UPDATEJOB_PROXY_URL_PREFIX = "https://github.com/github/codeql-action/releases/download/codeql-bundle-v2.21.1/";
const KEY_SIZE = 2048;
const KEY_EXPIRY_YEARS = 2;
const CERT_SUBJECT = [

2
lib/start-proxy.js generated
View File

@@ -10,10 +10,10 @@ const LANGUAGE_TO_REGISTRY_TYPE = {
python: "python_index",
ruby: "rubygems_server",
rust: "cargo_registry",
go: "goproxy_server",
// We do not have an established proxy type for these languages, thus leaving empty.
actions: "",
cpp: "",
go: "",
swift: "",
};
// getCredentials returns registry credentials from action inputs.

View File

@@ -1 +1 @@
{"version":3,"file":"start-proxy.js","sourceRoot":"","sources":["../src/start-proxy.ts"],"names":[],"mappings":";;AA8BA,wCA2EC;AAzGD,2CAAsD;AAEtD,iCAA4C;AAW5C,MAAM,yBAAyB,GAA6B;IAC1D,IAAI,EAAE,kBAAkB;IACxB,MAAM,EAAE,YAAY;IACpB,UAAU,EAAE,cAAc;IAC1B,MAAM,EAAE,cAAc;IACtB,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,gBAAgB;IACtB,oFAAoF;IACpF,OAAO,EAAE,EAAE;IACX,GAAG,EAAE,EAAE;IACP,EAAE,EAAE,EAAE;IACN,KAAK,EAAE,EAAE;CACD,CAAC;AAEX,kEAAkE;AAClE,+DAA+D;AAC/D,gDAAgD;AAChD,SAAgB,cAAc,CAC5B,MAAc,EACd,e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AAO,GAAG,CAAC;AACb,CAAC"}

6
lib/status-report.js generated
View File

@@ -149,10 +149,10 @@ async function createStatusReportBase(actionName, status, actionStartedAt, confi
const runnerOs = (0, util_1.getRequiredEnvParam)("RUNNER_OS");
const codeQlCliVersion = (0, util_1.getCachedCodeQlVersion)();
const actionRef = process.env["GITHUB_ACTION_REF"] || "";
const testingEnvironment = process.env[environment_1.EnvVar.TESTING_ENVIRONMENT] || "";
const testingEnvironment = (0, util_1.getTestingEnvironment)();
// re-export the testing environment variable so that it is available to subsequent steps,
// even if it was only set for this step
if (testingEnvironment !== "") {
if (testingEnvironment) {
core.exportVariable(environment_1.EnvVar.TESTING_ENVIRONMENT, testingEnvironment);
}
const isSteadyStateDefaultSetupRun = process.env["CODE_SCANNING_IS_STEADY_STATE_DEFAULT_SETUP"] === "true";
@@ -173,7 +173,7 @@ async function createStatusReportBase(actionName, status, actionStartedAt, confi
started_at: workflowStartedAt,
status,
steady_state_default_setup: isSteadyStateDefaultSetupRun,
testing_environment: testingEnvironment,
testing_environment: testingEnvironment || "",
workflow_name: workflowName,
workflow_run_attempt: workflowRunAttempt,
workflow_run_id: workflowRunID,

File diff suppressed because one or more lines are too long

86
lib/upload-lib.js generated
View File

@@ -38,8 +38,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.InvalidSarifUploadError = void 0;
exports.shouldShowCombineSarifFilesDeprecationWarning = shouldShowCombineSarifFilesDeprecationWarning;
exports.throwIfCombineSarifFilesDisabled = throwIfCombineSarifFilesDisabled;
exports.populateRunAutomationDetails = populateRunAutomationDetails;
exports.findSarifFilesInDir = findSarifFilesInDir;
exports.readSarifFile = readSarifFile;
exports.validateSarifFileSchema = validateSarifFileSchema;
exports.buildPayload = buildPayload;
exports.uploadFiles = uploadFiles;
@@ -53,7 +55,6 @@ const zlib_1 = __importDefault(require("zlib"));
const core = __importStar(require("@actions/core"));
const file_url_1 = __importDefault(require("file-url"));
const jsonschema = __importStar(require("jsonschema"));
const semver = __importStar(require("semver"));
const actionsUtil = __importStar(require("./actions-util"));
const actions_util_1 = require("./actions-util");
const api = __importStar(require("./api-client"));
@@ -62,6 +63,7 @@ const codeql_1 = require("./codeql");
const config_utils_1 = require("./config-utils");
const diff_informed_analysis_utils_1 = require("./diff-informed-analysis-utils");
const environment_1 = require("./environment");
const feature_flags_1 = require("./feature-flags");
const fingerprints = __importStar(require("./fingerprints"));
const gitUtils = __importStar(require("./git-utils"));
const init_1 = require("./init");
@@ -135,7 +137,7 @@ function areAllRunsUnique(sarifObjects) {
async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects, githubVersion) {
// Do not show this warning on GHES versions before 3.14.0
if (githubVersion.type === util_1.GitHubVariant.GHES &&
semver.lt(githubVersion.version, "3.14.0")) {
(0, util_1.satisfiesGHESVersion)(githubVersion.version, "<3.14", true)) {
return false;
}
// Only give a deprecation warning when not all runs are unique and
@@ -143,6 +145,36 @@ async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects, githu
return (!areAllRunsUnique(sarifObjects) &&
!process.env.CODEQL_MERGE_SARIF_DEPRECATION_WARNING);
}
async function throwIfCombineSarifFilesDisabled(sarifObjects, features, githubVersion) {
if (!(await shouldDisableCombineSarifFiles(sarifObjects, features, githubVersion))) {
return;
}
// TODO: Update this changelog URL to the correct one when it's published.
const deprecationMoreInformationMessage = "For more information, see https://github.blog/changelog/2024-05-06-code-scanning-will-stop-combining-runs-from-a-single-upload";
throw new util_1.ConfigurationError(`The CodeQL Action does not support uploading multiple SARIF runs with the same category. Please update your workflow to upload a single run per category. ${deprecationMoreInformationMessage}`);
}
// Checks whether combining SARIF files should be disabled.
async function shouldDisableCombineSarifFiles(sarifObjects, features, githubVersion) {
if (githubVersion.type === util_1.GitHubVariant.GHES) {
// Never block on GHES versions before 3.18.
if ((0, util_1.satisfiesGHESVersion)(githubVersion.version, "<3.18", true)) {
return false;
}
}
else {
// Never block when the feature flag is disabled.
if (!(await features.getValue(feature_flags_1.Feature.DisableCombineSarifFiles))) {
return false;
}
}
if (areAllRunsUnique(sarifObjects)) {
// If all runs are unique, we can safely combine them.
return false;
}
// Combining SARIF files is not supported and Code Scanning will return an
// error if multiple runs with the same category are uploaded.
return true;
}
// Takes a list of paths to sarif files and combines them together using the
// CLI `github merge-results` command when all SARIF files are produced by
// CodeQL. Otherwise, it will fall back to combining the files in the action.
@@ -157,9 +189,10 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
});
const deprecationWarningMessage = gitHubVersion.type === util_1.GitHubVariant.GHES
? "and will be removed in GitHub Enterprise Server 3.18"
: "and will be removed on June 4, 2025";
: "and will be removed in July 2025";
const deprecationMoreInformationMessage = "For more information, see https://github.blog/changelog/2024-05-06-code-scanning-will-stop-combining-runs-from-a-single-upload";
if (!areAllRunsProducedByCodeQL(sarifObjects)) {
await throwIfCombineSarifFilesDisabled(sarifObjects, features, gitHubVersion);
logger.debug("Not all SARIF files were produced by CodeQL. Merging files in the action.");
if (await shouldShowCombineSarifFilesDeprecationWarning(sarifObjects, gitHubVersion)) {
logger.warning(`Uploading multiple SARIF runs with the same category is deprecated ${deprecationWarningMessage}. Please update your workflow to upload a single run per category. ${deprecationMoreInformationMessage}`);
@@ -191,6 +224,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
codeQL = initCodeQLResult.codeql;
}
if (!(await codeQL.supportsFeature(tools_features_1.ToolsFeature.SarifMergeRunsFromEqualCategory))) {
await throwIfCombineSarifFilesDisabled(sarifObjects, features, gitHubVersion);
logger.warning("The CodeQL CLI does not support merging SARIF files. Merging files in the action.");
if (await shouldShowCombineSarifFilesDeprecationWarning(sarifObjects, gitHubVersion)) {
logger.warning(`Uploading multiple CodeQL runs with the same category is deprecated ${deprecationWarningMessage} for CodeQL CLI 2.16.6 and earlier. Please update your CodeQL CLI version or update your workflow to set a distinct category for each CodeQL run. ${deprecationMoreInformationMessage}`);
@@ -324,17 +358,24 @@ function countResultsInSarif(sarif) {
}
return numResults;
}
// Validates that the given file path refers to a valid SARIF file.
// Throws an error if the file is invalid.
function validateSarifFileSchema(sarifFilePath, logger) {
logger.info(`Validating ${sarifFilePath}`);
let sarif;
function readSarifFile(sarifFilePath) {
try {
sarif = JSON.parse(fs.readFileSync(sarifFilePath, "utf8"));
return JSON.parse(fs.readFileSync(sarifFilePath, "utf8"));
}
catch (e) {
throw new InvalidSarifUploadError(`Invalid SARIF. JSON syntax error: ${(0, util_1.getErrorMessage)(e)}`);
}
}
// Validates the given SARIF object and throws an error if the SARIF object is invalid.
// The file path is only used in error messages to improve clarity.
function validateSarifFileSchema(sarif, sarifFilePath, logger) {
if (areAllRunsProducedByCodeQL([sarif]) &&
// We want to validate CodeQL SARIF in testing environments.
!util.getTestingEnvironment()) {
logger.debug(`Skipping SARIF schema validation for ${sarifFilePath} as all runs are produced by CodeQL.`);
return;
}
logger.info(`Validating ${sarifFilePath}`);
// eslint-disable-next-line @typescript-eslint/no-require-imports
const schema = require("../src/sarif-schema-2.1.0.json");
const result = new jsonschema.Validator().validate(sarif, schema);
@@ -402,27 +443,28 @@ function buildPayload(commitOid, ref, analysisKey, analysisName, zippedSarif, wo
return payloadObj;
}
/**
* Uploads a single SARIF file or a directory of SARIF files depending on what `sarifPath` refers
* Uploads a single SARIF file or a directory of SARIF files depending on what `inputSarifPath` refers
* to.
*/
async function uploadFiles(sarifPath, checkoutPath, category, features, logger) {
const sarifFiles = getSarifFilePaths(sarifPath);
async function uploadFiles(inputSarifPath, checkoutPath, category, features, logger) {
const sarifPaths = getSarifFilePaths(inputSarifPath);
logger.startGroup("Uploading results");
logger.info(`Processing sarif files: ${JSON.stringify(sarifFiles)}`);
logger.info(`Processing sarif files: ${JSON.stringify(sarifPaths)}`);
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
try {
let sarif;
if (sarifPaths.length > 1) {
// Validate that the files we were asked to upload are all valid SARIF files
for (const file of sarifFiles) {
validateSarifFileSchema(file, logger);
for (const sarifPath of sarifPaths) {
const parsedSarif = readSarifFile(sarifPath);
validateSarifFileSchema(parsedSarif, sarifPath, logger);
}
sarif = await combineSarifFilesUsingCLI(sarifPaths, gitHubVersion, features, logger);
}
catch (e) {
if (e instanceof SyntaxError) {
throw new InvalidSarifUploadError(e.message);
}
throw e;
else {
const sarifPath = sarifPaths[0];
sarif = readSarifFile(sarifPath);
validateSarifFileSchema(sarif, sarifPath, logger);
}
let sarif = await combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, logger);
sarif = filterAlertsByDiffRange(logger, sarif);
sarif = await fingerprints.addFingerprints(sarif, checkoutPath, logger);
const analysisKey = await api.getAnalysisKey();

File diff suppressed because one or more lines are too long

88
lib/upload-lib.test.js generated
View File

@@ -39,6 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
const ava_1 = __importDefault(require("ava"));
const feature_flags_1 = require("./feature-flags");
const logging_1 = require("./logging");
const testing_utils_1 = require("./testing-utils");
const uploadLib = __importStar(require("./upload-lib"));
@@ -49,11 +50,11 @@ ava_1.default.beforeEach(() => {
});
(0, ava_1.default)("validateSarifFileSchema - valid", (t) => {
const inputFile = `${__dirname}/../src/testdata/valid-sarif.sarif`;
t.notThrows(() => uploadLib.validateSarifFileSchema(inputFile, (0, logging_1.getRunnerLogger)(true)));
t.notThrows(() => uploadLib.validateSarifFileSchema(uploadLib.readSarifFile(inputFile), inputFile, (0, logging_1.getRunnerLogger)(true)));
});
(0, ava_1.default)("validateSarifFileSchema - invalid", (t) => {
const inputFile = `${__dirname}/../src/testdata/invalid-sarif.sarif`;
t.throws(() => uploadLib.validateSarifFileSchema(inputFile, (0, logging_1.getRunnerLogger)(true)));
t.throws(() => uploadLib.validateSarifFileSchema(uploadLib.readSarifFile(inputFile), inputFile, (0, logging_1.getRunnerLogger)(true)));
});
(0, ava_1.default)("validate correct payload used for push, PR merge commit, and PR head", async (t) => {
process.env["GITHUB_EVENT_NAME"] = "push";
@@ -202,7 +203,7 @@ ava_1.default.beforeEach(() => {
},
};
const sarifFile = `${__dirname}/../src/testdata/with-invalid-uri.sarif`;
uploadLib.validateSarifFileSchema(sarifFile, mockLogger);
uploadLib.validateSarifFileSchema(uploadLib.readSarifFile(sarifFile), sarifFile, mockLogger);
t.deepEqual(loggedMessages.length, 3);
t.deepEqual(loggedMessages[1], "Warning: 'not a valid URI' is not a valid URI in 'instance.runs[0].tool.driver.rules[0].helpUri'.", "Warning: 'not a valid URI' is not a valid URI in 'instance.runs[0].results[0].locations[0].physicalLocation.artifactLocation.uri'.");
});
@@ -223,6 +224,12 @@ ava_1.default.beforeEach(() => {
version: "3.14.0",
}));
});
(0, ava_1.default)("shouldShowCombineSarifFilesDeprecationWarning when on GHES 3.16 pre", async (t) => {
t.true(await uploadLib.shouldShowCombineSarifFilesDeprecationWarning([createMockSarif("abc", "def"), createMockSarif("abc", "def")], {
type: util_1.GitHubVariant.GHES,
version: "3.16.0.pre1",
}));
});
(0, ava_1.default)("shouldShowCombineSarifFilesDeprecationWarning with only 1 run", async (t) => {
t.false(await uploadLib.shouldShowCombineSarifFilesDeprecationWarning([createMockSarif("abc", "def")], {
type: util_1.GitHubVariant.DOTCOM,
@@ -244,6 +251,81 @@ ava_1.default.beforeEach(() => {
type: util_1.GitHubVariant.DOTCOM,
}));
});
(0, ava_1.default)("throwIfCombineSarifFilesDisabled when on dotcom with feature flag", async (t) => {
await t.throwsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("abc", "def")], (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.DisableCombineSarifFiles]), {
type: util_1.GitHubVariant.DOTCOM,
}), {
message: /The CodeQL Action does not support uploading multiple SARIF runs with the same category/,
});
});
(0, ava_1.default)("throwIfCombineSarifFilesDisabled when on dotcom without feature flag", async (t) => {
await t.notThrowsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("abc", "def")], (0, testing_utils_1.createFeatures)([]), {
type: util_1.GitHubVariant.DOTCOM,
}));
});
(0, ava_1.default)("throwIfCombineSarifFilesDisabled when on GHES 3.13", async (t) => {
await t.notThrowsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("abc", "def")], (0, testing_utils_1.createFeatures)([]), {
type: util_1.GitHubVariant.GHES,
version: "3.13.2",
}));
});
(0, ava_1.default)("throwIfCombineSarifFilesDisabled when on GHES 3.14", async (t) => {
await t.notThrowsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("abc", "def")], (0, testing_utils_1.createFeatures)([]), {
type: util_1.GitHubVariant.GHES,
version: "3.14.0",
}));
});
(0, ava_1.default)("throwIfCombineSarifFilesDisabled when on GHES 3.17", async (t) => {
await t.notThrowsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("abc", "def")], (0, testing_utils_1.createFeatures)([]), {
type: util_1.GitHubVariant.GHES,
version: "3.17.0",
}));
});
(0, ava_1.default)("throwIfCombineSarifFilesDisabled when on GHES 3.18 pre", async (t) => {
await t.throwsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("abc", "def")], (0, testing_utils_1.createFeatures)([]), {
type: util_1.GitHubVariant.GHES,
version: "3.18.0.pre1",
}), {
message: /The CodeQL Action does not support uploading multiple SARIF runs with the same category/,
});
});
(0, ava_1.default)("throwIfCombineSarifFilesDisabled when on GHES 3.18 alpha", async (t) => {
await t.throwsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("abc", "def")], (0, testing_utils_1.createFeatures)([]), {
type: util_1.GitHubVariant.GHES,
version: "3.18.0-alpha.1",
}), {
message: /The CodeQL Action does not support uploading multiple SARIF runs with the same category/,
});
});
(0, ava_1.default)("throwIfCombineSarifFilesDisabled when on GHES 3.18", async (t) => {
await t.throwsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("abc", "def")], (0, testing_utils_1.createFeatures)([]), {
type: util_1.GitHubVariant.GHES,
version: "3.18.0",
}), {
message: /The CodeQL Action does not support uploading multiple SARIF runs with the same category/,
});
});
(0, ava_1.default)("throwIfCombineSarifFilesDisabled with an invalid GHES version", async (t) => {
await t.notThrowsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("abc", "def")], (0, testing_utils_1.createFeatures)([]), {
type: util_1.GitHubVariant.GHES,
version: "foobar",
}));
});
(0, ava_1.default)("throwIfCombineSarifFilesDisabled with only 1 run", async (t) => {
await t.notThrowsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def")], (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.DisableCombineSarifFiles]), {
type: util_1.GitHubVariant.DOTCOM,
}));
});
(0, ava_1.default)("throwIfCombineSarifFilesDisabled with distinct categories", async (t) => {
await t.notThrowsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("def", "def")], (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.DisableCombineSarifFiles]), {
type: util_1.GitHubVariant.DOTCOM,
}));
});
(0, ava_1.default)("throwIfCombineSarifFilesDisabled with distinct tools", async (t) => {
await t.notThrowsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "abc"), createMockSarif("abc", "def")], (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.DisableCombineSarifFiles]), {
type: util_1.GitHubVariant.DOTCOM,
}));
});
(0, ava_1.default)("shouldConsiderConfigurationError correctly detects configuration errors", (t) => {
const error1 = [
"CodeQL analyses from advanced configurations cannot be processed when the default setup is enabled",

File diff suppressed because one or more lines are too long

38
lib/util.js generated
View File

@@ -62,6 +62,7 @@ exports.bundleDb = bundleDb;
exports.delay = delay;
exports.isGoodVersion = isGoodVersion;
exports.isInTestMode = isInTestMode;
exports.getTestingEnvironment = getTestingEnvironment;
exports.doesDirectoryExist = doesDirectoryExist;
exports.listFolder = listFolder;
exports.tryGetFolderBytes = tryGetFolderBytes;
@@ -76,6 +77,7 @@ exports.getErrorMessage = getErrorMessage;
exports.prettyPrintPack = prettyPrintPack;
exports.checkDiskUsage = checkDiskUsage;
exports.checkActionVersion = checkActionVersion;
exports.satisfiesGHESVersion = satisfiesGHESVersion;
exports.cloneObject = cloneObject;
exports.checkSipEnablement = checkSipEnablement;
exports.cleanUpGlob = cleanUpGlob;
@@ -577,15 +579,27 @@ async function delay(milliseconds, opts) {
function isGoodVersion(versionSpec) {
return !BROKEN_VERSIONS.includes(versionSpec);
}
/*
* Returns whether we are in test mode.
/**
* Returns whether we are in test mode. This is used by CodeQL Action PR checks.
*
* In test mode, we don't upload SARIF results or status reports to the GitHub API.
*/
function isInTestMode() {
return process.env[environment_1.EnvVar.TEST_MODE] === "true";
}
/*
/**
* Get the testing environment.
*
* This is set if the CodeQL Action is running in a non-production environment.
*/
function getTestingEnvironment() {
const testingEnvironment = process.env[environment_1.EnvVar.TESTING_ENVIRONMENT] || "";
if (testingEnvironment === "") {
return undefined;
}
return testingEnvironment;
}
/**
* Returns whether the path in the argument represents an existing directory.
*/
function doesDirectoryExist(dirPath) {
@@ -874,6 +888,24 @@ function checkActionVersion(version, githubVersion) {
}
}
}
/**
* This will check whether the given GitHub version satisfies the given range,
* taking into account that a range like >=3.18 will also match the GHES 3.18
* pre-release/RC versions.
*
* When the given `githubVersion` is not a GHES version, or if the version
* is invalid, this will return `defaultIfInvalid`.
*/
function satisfiesGHESVersion(ghesVersion, range, defaultIfInvalid) {
const semverVersion = semver.coerce(ghesVersion);
if (semverVersion === null) {
return defaultIfInvalid;
}
// We always drop the pre-release part of the version, since anything that
// applies to GHES 3.18.0 should also apply to GHES 3.18.0.pre1.
semverVersion.prerelease = [];
return semver.satisfies(semverVersion, range);
}
/**
* Supported build modes.
*

File diff suppressed because one or more lines are too long

4
lib/workflow.js generated
View File

@@ -51,7 +51,6 @@ const zlib_1 = __importDefault(require("zlib"));
const core = __importStar(require("@actions/core"));
const yaml = __importStar(require("js-yaml"));
const api = __importStar(require("./api-client"));
const environment_1 = require("./environment");
const util_1 = require("./util");
function toCodedErrors(errors) {
return Object.entries(errors).reduce((acc, [code, message]) => {
@@ -274,8 +273,7 @@ function getInputOrThrow(workflow, jobName, actionName, inputName, matrixVars) {
* This allows us to test workflow parsing functionality as a CodeQL Action PR check.
*/
function getAnalyzeActionName() {
if ((0, util_1.isInTestMode)() ||
process.env[environment_1.EnvVar.TESTING_ENVIRONMENT] === "codeql-action-pr-checks") {
if ((0, util_1.isInTestMode)() || (0, util_1.getTestingEnvironment)() === "codeql-action-pr-checks") {
return "./analyze";
}
else {

File diff suppressed because one or more lines are too long

713
node_modules/.package-lock.json generated vendored

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
MIT License Copyright (c) 2019 Octokit contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,65 @@
# types.ts
> Shared TypeScript definitions for Octokit projects
[![@latest](https://img.shields.io/npm/v/@octokit/types.svg)](https://www.npmjs.com/package/@octokit/types)
[![Build Status](https://github.com/octokit/types.ts/workflows/Test/badge.svg)](https://github.com/octokit/types.ts/actions?workflow=Test)
<!-- toc -->
- [Usage](#usage)
- [Examples](#examples)
- [Get parameter and response data types for a REST API endpoint](#get-parameter-and-response-data-types-for-a-rest-api-endpoint)
- [Get response types from endpoint methods](#get-response-types-from-endpoint-methods)
- [Contributing](#contributing)
- [License](#license)
<!-- tocstop -->
## Usage
See all exported types at https://octokit.github.io/types.ts
## Examples
### Get parameter and response data types for a REST API endpoint
```ts
import { Endpoints } from "@octokit/types";
type listUserReposParameters =
Endpoints["GET /repos/{owner}/{repo}"]["parameters"];
type listUserReposResponse = Endpoints["GET /repos/{owner}/{repo}"]["response"];
async function listRepos(
options: listUserReposParameters,
): listUserReposResponse["data"] {
// ...
}
```
### Get response types from endpoint methods
```ts
import {
GetResponseTypeFromEndpointMethod,
GetResponseDataTypeFromEndpointMethod,
} from "@octokit/types";
import { Octokit } from "@octokit/rest";
const octokit = new Octokit();
type CreateLabelResponseType = GetResponseTypeFromEndpointMethod<
typeof octokit.issues.createLabel
>;
type CreateLabelResponseDataType = GetResponseDataTypeFromEndpointMethod<
typeof octokit.issues.createLabel
>;
```
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md)
## License
[MIT](LICENSE)

View File

@@ -0,0 +1,31 @@
import type { EndpointOptions } from "./EndpointOptions.js";
import type { OctokitResponse } from "./OctokitResponse.js";
import type { RequestInterface } from "./RequestInterface.js";
import type { RequestParameters } from "./RequestParameters.js";
import type { Route } from "./Route.js";
/**
* Interface to implement complex authentication strategies for Octokit.
* An object Implementing the AuthInterface can directly be passed as the
* `auth` option in the Octokit constructor.
*
* For the official implementations of the most common authentication
* strategies, see https://github.com/octokit/auth.js
*/
export interface AuthInterface<AuthOptions extends any[], Authentication extends any> {
(...args: AuthOptions): Promise<Authentication>;
hook: {
/**
* Sends a request using the passed `request` instance
*
* @param {object} endpoint Must set `method` and `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
*/
<T = any>(request: RequestInterface, options: EndpointOptions): Promise<OctokitResponse<T>>;
/**
* Sends a request using the passed `request` instance
*
* @param {string} route Request method + URL. Example: `'GET /orgs/{org}'`
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
*/
<T = any>(request: RequestInterface, route: Route, parameters?: RequestParameters): Promise<OctokitResponse<T>>;
};
}

View File

@@ -0,0 +1,21 @@
import type { RequestHeaders } from "./RequestHeaders.js";
import type { RequestMethod } from "./RequestMethod.js";
import type { RequestParameters } from "./RequestParameters.js";
import type { Url } from "./Url.js";
/**
* The `.endpoint()` method is guaranteed to set all keys defined by RequestParameters
* as well as the method property.
*/
export type EndpointDefaults = RequestParameters & {
baseUrl: Url;
method: RequestMethod;
url?: Url;
headers: RequestHeaders & {
accept: string;
"user-agent": string;
};
mediaType: {
format: string;
previews?: string[];
};
};

View File

@@ -0,0 +1,65 @@
import type { EndpointDefaults } from "./EndpointDefaults.js";
import type { RequestOptions } from "./RequestOptions.js";
import type { RequestParameters } from "./RequestParameters.js";
import type { Route } from "./Route.js";
import type { Endpoints } from "./generated/Endpoints.js";
export interface EndpointInterface<D extends object = object> {
/**
* Transforms a GitHub REST API endpoint into generic request options
*
* @param {object} endpoint Must set `url` unless it's set defaults. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
*/
<O extends RequestParameters = RequestParameters>(options: O & {
method?: string;
} & ("url" extends keyof D ? {
url?: string;
} : {
url: string;
})): RequestOptions & Pick<D & O, keyof RequestOptions>;
/**
* Transforms a GitHub REST API endpoint into generic request options
*
* @param {string} route Request method + URL. Example: `'GET /orgs/{org}'`
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
*/
<R extends Route, P extends RequestParameters = R extends keyof Endpoints ? Endpoints[R]["parameters"] & RequestParameters : RequestParameters>(route: keyof Endpoints | R, parameters?: P): (R extends keyof Endpoints ? Endpoints[R]["request"] : RequestOptions) & Pick<P, keyof RequestOptions>;
/**
* Object with current default route and parameters
*/
DEFAULTS: D & EndpointDefaults;
/**
* Returns a new `endpoint` interface with new defaults
*/
defaults: <O extends RequestParameters = RequestParameters>(newDefaults: O) => EndpointInterface<D & O>;
merge: {
/**
* Merges current endpoint defaults with passed route and parameters,
* without transforming them into request options.
*
* @param {string} route Request method + URL. Example: `'GET /orgs/{org}'`
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
*
*/
<R extends Route, P extends RequestParameters = R extends keyof Endpoints ? Endpoints[R]["parameters"] & RequestParameters : RequestParameters>(route: keyof Endpoints | R, parameters?: P): D & (R extends keyof Endpoints ? Endpoints[R]["request"] & Endpoints[R]["parameters"] : EndpointDefaults) & P;
/**
* Merges current endpoint defaults with passed route and parameters,
* without transforming them into request options.
*
* @param {object} endpoint Must set `method` and `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
*/
<P extends RequestParameters = RequestParameters>(options: P): EndpointDefaults & D & P;
/**
* Returns current default options.
*
* @deprecated use endpoint.DEFAULTS instead
*/
(): D & EndpointDefaults;
};
/**
* Stateless method to turn endpoint options into request options.
* Calling `endpoint(options)` is the same as calling `endpoint.parse(endpoint.merge(options))`.
*
* @param {object} options `method`, `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
*/
parse: <O extends EndpointDefaults = EndpointDefaults>(options: O) => RequestOptions & Pick<O, keyof RequestOptions>;
}

View File

@@ -0,0 +1,7 @@
import type { RequestMethod } from "./RequestMethod.js";
import type { Url } from "./Url.js";
import type { RequestParameters } from "./RequestParameters.js";
export type EndpointOptions = RequestParameters & {
method: RequestMethod;
url: Url;
};

View File

@@ -0,0 +1,4 @@
/**
* Browser's fetch method (or compatible such as fetch-mock)
*/
export type Fetch = any;

View File

@@ -0,0 +1,5 @@
type Unwrap<T> = T extends Promise<infer U> ? U : T;
type AnyFunction = (...args: any[]) => any;
export type GetResponseTypeFromEndpointMethod<T extends AnyFunction> = Unwrap<ReturnType<T>>;
export type GetResponseDataTypeFromEndpointMethod<T extends AnyFunction> = Unwrap<ReturnType<T>>["data"];
export {};

View File

@@ -0,0 +1,17 @@
import type { ResponseHeaders } from "./ResponseHeaders.js";
import type { Url } from "./Url.js";
export interface OctokitResponse<T, S extends number = number> {
headers: ResponseHeaders;
/**
* http response code
*/
status: S;
/**
* URL of response after all redirects
*/
url: Url;
/**
* Response data as documented in the REST API reference documentation at https://docs.github.com/rest/reference
*/
data: T;
}

View File

@@ -0,0 +1,11 @@
export type RequestError = {
name: string;
status: number;
documentation_url: string;
errors?: Array<{
resource: string;
code: string;
field: string;
message?: string;
}>;
};

View File

@@ -0,0 +1,15 @@
export type RequestHeaders = {
/**
* Avoid setting `headers.accept`, use `mediaType.{format|previews}` option instead.
*/
accept?: string;
/**
* Use `authorization` to send authenticated request, remember `token ` / `bearer ` prefixes. Example: `token 1234567890abcdef1234567890abcdef12345678`
*/
authorization?: string;
/**
* `user-agent` is set do a default and can be overwritten as needed.
*/
"user-agent"?: string;
[header: string]: string | number | undefined;
};

View File

@@ -0,0 +1,34 @@
import type { EndpointInterface } from "./EndpointInterface.js";
import type { OctokitResponse } from "./OctokitResponse.js";
import type { RequestParameters } from "./RequestParameters.js";
import type { Route } from "./Route.js";
import type { Endpoints } from "./generated/Endpoints.js";
export interface RequestInterface<D extends object = object> {
/**
* Sends a request based on endpoint options
*
* @param {object} endpoint Must set `method` and `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
*/
<T = any, O extends RequestParameters = RequestParameters>(options: O & {
method?: string;
} & ("url" extends keyof D ? {
url?: string;
} : {
url: string;
})): Promise<OctokitResponse<T>>;
/**
* Sends a request based on endpoint options
*
* @param {string} route Request method + URL. Example: `'GET /orgs/{org}'`
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
*/
<R extends Route>(route: keyof Endpoints | R, options?: R extends keyof Endpoints ? Endpoints[R]["parameters"] & RequestParameters : RequestParameters): R extends keyof Endpoints ? Promise<Endpoints[R]["response"]> : Promise<OctokitResponse<any>>;
/**
* Returns a new `request` with updated route and parameters
*/
defaults: <O extends RequestParameters = RequestParameters>(newDefaults: O) => RequestInterface<D & O>;
/**
* Octokit endpoint API, see {@link https://github.com/octokit/endpoint.js|@octokit/endpoint}
*/
endpoint: EndpointInterface<D>;
}

View File

@@ -0,0 +1,4 @@
/**
* HTTP Verb supported by GitHub's REST API
*/
export type RequestMethod = "DELETE" | "GET" | "HEAD" | "PATCH" | "POST" | "PUT";

View File

@@ -0,0 +1,14 @@
import type { RequestHeaders } from "./RequestHeaders.js";
import type { RequestMethod } from "./RequestMethod.js";
import type { RequestRequestOptions } from "./RequestRequestOptions.js";
import type { Url } from "./Url.js";
/**
* Generic request options as they are returned by the `endpoint()` method
*/
export type RequestOptions = {
method: RequestMethod;
url: Url;
headers: RequestHeaders;
body?: any;
request?: RequestRequestOptions;
};

View File

@@ -0,0 +1,55 @@
import type { RequestRequestOptions } from "./RequestRequestOptions.js";
import type { RequestHeaders } from "./RequestHeaders.js";
import type { Url } from "./Url.js";
/**
* Parameters that can be passed into `request(route, parameters)` or `endpoint(route, parameters)` methods
*/
export type RequestParameters = {
/**
* Base URL to be used when a relative URL is passed, such as `/orgs/{org}`.
* If `baseUrl` is `https://enterprise.acme-inc.com/api/v3`, then the request
* will be sent to `https://enterprise.acme-inc.com/api/v3/orgs/{org}`.
*/
baseUrl?: Url;
/**
* HTTP headers. Use lowercase keys.
*/
headers?: RequestHeaders;
/**
* Media type options, see {@link https://developer.github.com/v3/media/|GitHub Developer Guide}
*/
mediaType?: {
/**
* `json` by default. Can be `raw`, `text`, `html`, `full`, `diff`, `patch`, `sha`, `base64`. Depending on endpoint
*/
format?: string;
/**
* Custom media type names of {@link https://docs.github.com/en/graphql/overview/schema-previews|GraphQL API Previews} without the `-preview` suffix.
* Example for single preview: `['squirrel-girl']`.
* Example for multiple previews: `['squirrel-girl', 'mister-fantastic']`.
*/
previews?: string[];
};
/**
* The name of the operation to execute.
* Required only if multiple operations are present in the query document.
*/
operationName?: string;
/**
* The GraphQL query string to be sent in the request.
* This is required and must contain a valid GraphQL document.
*/
query?: string;
/**
* Pass custom meta information for the request. The `request` object will be returned as is.
*/
request?: RequestRequestOptions;
/**
* Any additional parameter will be passed as follows
* 1. URL parameter if `':parameter'` or `{parameter}` is part of `url`
* 2. Query parameter if `method` is `'GET'` or `'HEAD'`
* 3. Request body if `parameter` is `'data'`
* 4. JSON in the request body in the form of `body[parameter]` unless `parameter` key is `'data'`
*/
[parameter: string]: unknown;
};

View File

@@ -0,0 +1,20 @@
import type { Fetch } from "./Fetch.js";
/**
* Octokit-specific request options which are ignored for the actual request, but can be used by Octokit or plugins to manipulate how the request is sent or how a response is handled
*/
export type RequestRequestOptions = {
/**
* Custom replacement for built-in fetch method. Useful for testing or request hooks.
*/
fetch?: Fetch;
/**
* Use an `AbortController` instance to cancel a request. In node you can only cancel streamed requests.
*/
signal?: AbortSignal;
/**
* If set to `false`, the response body will not be parsed and will be returned as a stream.
*/
parseSuccessResponseBody?: boolean;
redirect?: "follow" | "error" | "manual";
[option: string]: any;
};

View File

@@ -0,0 +1,21 @@
export type ResponseHeaders = {
"cache-control"?: string;
"content-length"?: number;
"content-type"?: string;
date?: string;
etag?: string;
"last-modified"?: string;
link?: string;
location?: string;
server?: string;
status?: string;
vary?: string;
"x-accepted-github-permissions"?: string;
"x-github-mediatype"?: string;
"x-github-request-id"?: string;
"x-oauth-scopes"?: string;
"x-ratelimit-limit"?: string;
"x-ratelimit-remaining"?: string;
"x-ratelimit-reset"?: string;
[header: string]: string | number | undefined;
};

View File

@@ -0,0 +1,4 @@
/**
* String consisting of an optional HTTP method and relative path or absolute URL. Examples: `'/orgs/{org}'`, `'PUT /orgs/{org}'`, `GET https://example.com/foo/bar`
*/
export type Route = string;

View File

@@ -0,0 +1,4 @@
import type { AuthInterface } from "./AuthInterface.js";
export interface StrategyInterface<StrategyOptions extends any[], AuthOptions extends any[], Authentication extends object> {
(...args: StrategyOptions): AuthInterface<AuthOptions, Authentication>;
}

View File

@@ -0,0 +1,4 @@
/**
* Relative or absolute URL. Examples: `'/orgs/{org}'`, `https://example.com/foo/bar`
*/
export type Url = string;

View File

@@ -0,0 +1 @@
export declare const VERSION = "13.10.0";

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,20 @@
export * from "./AuthInterface.js";
export * from "./EndpointDefaults.js";
export * from "./EndpointInterface.js";
export * from "./EndpointOptions.js";
export * from "./Fetch.js";
export * from "./OctokitResponse.js";
export * from "./RequestError.js";
export * from "./RequestHeaders.js";
export * from "./RequestInterface.js";
export * from "./RequestMethod.js";
export * from "./RequestOptions.js";
export * from "./RequestParameters.js";
export * from "./RequestRequestOptions.js";
export * from "./ResponseHeaders.js";
export * from "./Route.js";
export * from "./StrategyInterface.js";
export * from "./Url.js";
export * from "./VERSION.js";
export * from "./GetResponseTypeFromEndpointMethod.js";
export * from "./generated/Endpoints.js";

View File

@@ -0,0 +1,7 @@
Copyright 2020 Gregor Martynus
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,17 @@
# @octokit/openapi-types
> Generated TypeScript definitions based on GitHub's OpenAPI spec
This package is continuously updated based on [GitHub's OpenAPI specification](https://github.com/github/rest-api-description/)
## Usage
```ts
import { components } from "@octokit/openapi-types";
type Repository = components["schemas"]["full-repository"];
```
## License
[MIT](LICENSE)

View File

@@ -0,0 +1,21 @@
{
"name": "@octokit/openapi-types",
"description": "Generated TypeScript definitions based on GitHub's OpenAPI spec for api.github.com",
"repository": {
"type": "git",
"url": "https://github.com/octokit/openapi-types.ts.git",
"directory": "packages/openapi-types"
},
"publishConfig": {
"access": "public",
"provenance": true
},
"version": "24.2.0",
"main": "",
"types": "types.d.ts",
"author": "Gregor Martynus (https://twitter.com/gr2m)",
"license": "MIT",
"octokit": {
"openapi-version": "18.2.0"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,42 @@
{
"name": "@octokit/types",
"version": "13.10.0",
"publishConfig": {
"access": "public",
"provenance": true
},
"description": "Shared TypeScript definitions for Octokit projects",
"dependencies": {
"@octokit/openapi-types": "^24.2.0"
},
"repository": "github:octokit/types.ts",
"keywords": [
"github",
"api",
"sdk",
"toolkit",
"typescript"
],
"author": "Gregor Martynus (https://twitter.com/gr2m)",
"license": "MIT",
"devDependencies": {
"@octokit/tsconfig": "^4.0.0",
"github-openapi-graphql-query": "^4.5.0",
"handlebars": "^4.7.6",
"npm-run-all2": "^7.0.0",
"prettier": "^3.0.0",
"semantic-release": "^24.0.0",
"semantic-release-plugin-update-version-in-files": "^2.0.0",
"sort-keys": "^5.0.0",
"typedoc": "^0.26.0",
"typescript": "^5.0.0"
},
"octokit": {
"openapi-version": "18.2.0"
},
"files": [
"dist-types/**"
],
"types": "dist-types/index.d.ts",
"sideEffects": false
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -4688,9 +4688,12 @@ var sortCalcValues = (values = [], finalize = false) => {
operator = "";
}
}
resolvedValue = finalizedValues.join(" ");
resolvedValue = finalizedValues.join(" ").replace(/\+\s-/g, "- ");
} else {
resolvedValue = sortedValues.join(" ");
resolvedValue = sortedValues.join(" ").replace(/\+\s-/g, "- ");
}
if (resolvedValue.startsWith("(") && resolvedValue.endsWith(")") && resolvedValue.lastIndexOf("(") === 0 && resolvedValue.indexOf(")") === resolvedValue.length - 1) {
resolvedValue = resolvedValue.replace(/^\(/, "").replace(/\)$/, "");
}
return `${start}${resolvedValue}${end}`;
};
@@ -4889,6 +4892,9 @@ var cssCalc = (value, opt = {}) => {
resolvedValue = `calc(${resolvedValue})`;
}
}
if (format === VAL_SPEC && /\s[-+*/]\s/.test(resolvedValue) && !resolvedValue.includes("NaN")) {
resolvedValue = serializeCalc(resolvedValue, opt);
}
setCache(cacheKey, resolvedValue);
return resolvedValue;
};

File diff suppressed because one or more lines are too long

View File

@@ -633,9 +633,12 @@ const sortCalcValues = (values = [], finalize = false) => {
operator = "";
}
}
resolvedValue = finalizedValues.join(" ");
resolvedValue = finalizedValues.join(" ").replace(/\+\s-/g, "- ");
} else {
resolvedValue = sortedValues.join(" ");
resolvedValue = sortedValues.join(" ").replace(/\+\s-/g, "- ");
}
if (resolvedValue.startsWith("(") && resolvedValue.endsWith(")") && resolvedValue.lastIndexOf("(") === 0 && resolvedValue.indexOf(")") === resolvedValue.length - 1) {
resolvedValue = resolvedValue.replace(/^\(/, "").replace(/\)$/, "");
}
return `${start}${resolvedValue}${end}`;
};
@@ -834,6 +837,9 @@ const cssCalc = (value, opt = {}) => {
resolvedValue = `calc(${resolvedValue})`;
}
}
if (format === VAL_SPEC && /\s[-+*/]\s/.test(resolvedValue) && !resolvedValue.includes("NaN")) {
resolvedValue = serializeCalc(resolvedValue, opt);
}
setCache(cacheKey, resolvedValue);
return resolvedValue;
};

File diff suppressed because one or more lines are too long

View File

@@ -32,31 +32,30 @@
},
"./package.json": "./package.json"
},
"packageManager": "pnpm@10.6.1",
"packageManager": "pnpm@10.6.3",
"dependencies": {
"@csstools/css-calc": "^2.1.2",
"@csstools/css-color-parser": "^3.0.8",
"@csstools/css-calc": "^2.1.3",
"@csstools/css-color-parser": "^3.0.9",
"@csstools/css-parser-algorithms": "^3.0.4",
"@csstools/css-tokenizer": "^3.0.3",
"lru-cache": "^10.4.3"
},
"devDependencies": {
"@tanstack/vite-config": "^0.1.0",
"@vitest/coverage-istanbul": "^3.0.8",
"esbuild": "^0.25.0",
"eslint": "^9.22.0",
"eslint-plugin-import-x": "^4.6.1",
"@tanstack/vite-config": "^0.2.0",
"@vitest/coverage-istanbul": "^3.1.1",
"esbuild": "^0.25.2",
"eslint": "^9.25.0",
"eslint-plugin-regexp": "^2.7.0",
"globals": "^16.0.0",
"knip": "^5.45.0",
"knip": "^5.50.5",
"neostandard": "^0.12.1",
"prettier": "^3.5.3",
"publint": "^0.3.8",
"publint": "^0.3.12",
"rimraf": "^6.0.1",
"tsup": "^8.4.0",
"typescript": "^5.8.2",
"vite": "^6.2.1",
"vitest": "^3.0.8"
"typescript": "^5.8.3",
"vite": "^6.3.2",
"vitest": "^3.1.1"
},
"scripts": {
"build": "pnpm run clean && pnpm run test && pnpm run knip && pnpm run build:prod && pnpm run build:cjs && pnpm run build:browser && pnpm run publint",
@@ -72,5 +71,5 @@
"test:types": "tsc",
"test:unit": "vitest"
},
"version": "3.1.1"
"version": "3.1.3"
}

View File

@@ -694,9 +694,17 @@ export const sortCalcValues = (
operator = '';
}
}
resolvedValue = finalizedValues.join(' ');
resolvedValue = finalizedValues.join(' ').replace(/\+\s-/g, '- ');
} else {
resolvedValue = sortedValues.join(' ');
resolvedValue = sortedValues.join(' ').replace(/\+\s-/g, '- ');
}
if (
resolvedValue.startsWith('(') &&
resolvedValue.endsWith(')') &&
resolvedValue.lastIndexOf('(') === 0 &&
resolvedValue.indexOf(')') === resolvedValue.length - 1
) {
resolvedValue = resolvedValue.replace(/^\(/, '').replace(/\)$/, '');
}
return `${start}${resolvedValue}${end}`;
};
@@ -943,6 +951,13 @@ export const cssCalc = (value: string, opt: Options = {}): string => {
resolvedValue = `calc(${resolvedValue})`;
}
}
if (
format === VAL_SPEC &&
/\s[-+*/]\s/.test(resolvedValue) &&
!resolvedValue.includes('NaN')
) {
resolvedValue = serializeCalc(resolvedValue, opt);
}
setCache(cacheKey, resolvedValue);
return resolvedValue;
};

View File

@@ -1,9 +1,10 @@
# Changes to CSS Calc
### 2.1.2
### 2.1.3
_February 23, 2025_
_April 19, 2025_
- Update `random()` to correctly handle extremely large ranges or extremely tiny steps.
- Update `random()` to better handle floating point errors.
- Update `random()` to match the latest [specification](https://drafts.csswg.org/css-values-5/#randomness)
[Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md)

View File

@@ -1,7 +1,7 @@
# CSS Calc <img src="https://cssdb.org/images/css.svg" alt="for CSS" width="90" height="90" align="right">
[<img alt="npm version" src="https://img.shields.io/npm/v/@csstools/css-calc.svg" height="20">][npm-url]
[<img alt="Build Status" src="https://github.com/csstools/postcss-plugins/workflows/test/badge.svg" height="20">][cli-url]
[<img alt="Build Status" src="https://github.com/csstools/postcss-plugins/actions/workflows/test.yml/badge.svg?branch=main" height="20">][cli-url]
[<img alt="Discord" src="https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white">][discord]
Implemented from : https://drafts.csswg.org/css-values-4/ on 2023-02-17

File diff suppressed because one or more lines are too long

View File

@@ -40,9 +40,28 @@ export declare type conversionOptions = {
*/
rawPercentages?: boolean;
/**
* Seed the pseudo random number generator used in `random()`
* The values used to generate random value cache keys.
*/
randomSeed?: number;
randomCaching?: {
/**
* The name of the property the random function is used in.
*/
propertyName: string;
/**
* N is the index of the random function among other random functions in the same property value.
*/
propertyN: number;
/**
* An element ID identifying the element the style is being applied to.
* When omitted any `random()` call will not be computed.
*/
elementID: string;
/**
* A document ID identifying the Document the styles are from.
* When omitted any `random()` call will not be computed.
*/
documentID: string;
};
};
export declare type GlobalsWithStrings = Map<string, TokenDimension | TokenNumber | TokenPercentage | string>;

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
{
"name": "@csstools/css-calc",
"description": "Solve CSS math expressions",
"version": "2.1.2",
"version": "2.1.3",
"contributors": [
{
"name": "Antonio Laguna",

View File

@@ -1,11 +1,10 @@
# Changes to CSS Color Parser
### 3.0.8
### 3.0.9
_February 23, 2025_
_April 19, 2025_
- Use `Number.isNaN` instead of `NaN` for consistency.
- Updated [`@csstools/color-helpers`](https://github.com/csstools/postcss-plugins/tree/main/packages/color-helpers) to [`5.0.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/color-helpers/CHANGELOG.md#502) (patch)
- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`2.1.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#212) (patch)
- Drop the `max` keyword for `contrast-color( <color> )`
- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`2.1.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#213) (patch)
[Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser/CHANGELOG.md)

View File

@@ -1,7 +1,7 @@
# CSS Color Parser <img src="https://cssdb.org/images/css.svg" alt="for CSS" width="90" height="90" align="right">
[<img alt="npm version" src="https://img.shields.io/npm/v/@csstools/css-color-parser.svg" height="20">][npm-url]
[<img alt="Build Status" src="https://github.com/csstools/postcss-plugins/workflows/test/badge.svg" height="20">][cli-url]
[<img alt="Build Status" src="https://github.com/csstools/postcss-plugins/actions/workflows/test.yml/badge.svg?branch=main" height="20">][cli-url]
[<img alt="Discord" src="https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white">][discord]
## Usage

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
{
"name": "@csstools/css-color-parser",
"description": "Parse CSS color values",
"version": "3.0.8",
"version": "3.0.9",
"contributors": [
{
"name": "Antonio Laguna",
@@ -49,7 +49,7 @@
],
"dependencies": {
"@csstools/color-helpers": "^5.0.2",
"@csstools/css-calc": "^2.1.2"
"@csstools/css-calc": "^2.1.3"
},
"peerDependencies": {
"@csstools/css-parser-algorithms": "^3.0.4",

View File

@@ -30,8 +30,8 @@ Please use GitHub's Issues/PRs.
### Development Tools
- `npm test` runs tests and measures coverage.
- `npm run clean` removes the coverage result of `npm test` command.
- `npm run coverage` shows the coverage result of the last `npm test` command.
- `npm run test-coverage` runs tests and measures coverage.
- `npm run clean` removes the coverage result of `npm run test-coverage` command.
- `npm run coverage` shows the coverage result of the last `npm run test-coverage` command.
- `npm run lint` runs ESLint.
- `npm run watch` runs tests on each file change.

217
node_modules/@eslint-community/eslint-utils/index.d.mts generated vendored Normal file
View File

@@ -0,0 +1,217 @@
import * as eslint from 'eslint';
import { Rule, AST } from 'eslint';
import * as estree from 'estree';
declare const READ: unique symbol;
declare const CALL: unique symbol;
declare const CONSTRUCT: unique symbol;
declare const ESM: unique symbol;
declare class ReferenceTracker {
constructor(globalScope: Scope$2, options?: {
mode?: "legacy" | "strict" | undefined;
globalObjectNames?: string[] | undefined;
} | undefined);
private variableStack;
private globalScope;
private mode;
private globalObjectNames;
iterateGlobalReferences<T>(traceMap: TraceMap$2<T>): IterableIterator<TrackedReferences$2<T>>;
iterateCjsReferences<T_1>(traceMap: TraceMap$2<T_1>): IterableIterator<TrackedReferences$2<T_1>>;
iterateEsmReferences<T_2>(traceMap: TraceMap$2<T_2>): IterableIterator<TrackedReferences$2<T_2>>;
iteratePropertyReferences<T_3>(node: Expression, traceMap: TraceMap$2<T_3>): IterableIterator<TrackedReferences$2<T_3>>;
private _iterateVariableReferences;
private _iteratePropertyReferences;
private _iterateLhsReferences;
private _iterateImportReferences;
}
declare namespace ReferenceTracker {
export { READ };
export { CALL };
export { CONSTRUCT };
export { ESM };
}
type Scope$2 = eslint.Scope.Scope;
type Expression = estree.Expression;
type TraceMap$2<T> = TraceMap$1<T>;
type TrackedReferences$2<T> = TrackedReferences$1<T>;
type StaticValue$2 = StaticValueProvided$1 | StaticValueOptional$1;
type StaticValueProvided$1 = {
optional?: undefined;
value: unknown;
};
type StaticValueOptional$1 = {
optional?: true;
value: undefined;
};
type ReferenceTrackerOptions$1 = {
globalObjectNames?: string[];
mode?: "legacy" | "strict";
};
type TraceMap$1<T = unknown> = {
[i: string]: TraceMapObject<T>;
};
type TraceMapObject<T> = {
[i: string]: TraceMapObject<T>;
[CALL]?: T;
[CONSTRUCT]?: T;
[READ]?: T;
[ESM]?: boolean;
};
type TrackedReferences$1<T> = {
info: T;
node: Rule.Node;
path: string[];
type: typeof CALL | typeof CONSTRUCT | typeof READ;
};
type HasSideEffectOptions$1 = {
considerGetters?: boolean;
considerImplicitTypeConversion?: boolean;
};
type PunctuatorToken<Value extends string> = AST.Token & {
type: "Punctuator";
value: Value;
};
type ArrowToken$1 = PunctuatorToken<"=>">;
type CommaToken$1 = PunctuatorToken<",">;
type SemicolonToken$1 = PunctuatorToken<";">;
type ColonToken$1 = PunctuatorToken<":">;
type OpeningParenToken$1 = PunctuatorToken<"(">;
type ClosingParenToken$1 = PunctuatorToken<")">;
type OpeningBracketToken$1 = PunctuatorToken<"[">;
type ClosingBracketToken$1 = PunctuatorToken<"]">;
type OpeningBraceToken$1 = PunctuatorToken<"{">;
type ClosingBraceToken$1 = PunctuatorToken<"}">;
declare function findVariable(initialScope: Scope$1, nameOrNode: string | Identifier): Variable | null;
type Scope$1 = eslint.Scope.Scope;
type Variable = eslint.Scope.Variable;
type Identifier = estree.Identifier;
declare function getFunctionHeadLocation(node: FunctionNode$1, sourceCode: SourceCode$2): SourceLocation | null;
type SourceCode$2 = eslint.SourceCode;
type FunctionNode$1 = estree.Function;
type SourceLocation = estree.SourceLocation;
declare function getFunctionNameWithKind(node: FunctionNode, sourceCode?: eslint.SourceCode | undefined): string;
type FunctionNode = estree.Function;
declare function getInnermostScope(initialScope: Scope, node: Node$4): Scope;
type Scope = eslint.Scope.Scope;
type Node$4 = estree.Node;
declare function getPropertyName(node: MemberExpression | MethodDefinition | Property | PropertyDefinition, initialScope?: eslint.Scope.Scope | undefined): string | null | undefined;
type MemberExpression = estree.MemberExpression;
type MethodDefinition = estree.MethodDefinition;
type Property = estree.Property;
type PropertyDefinition = estree.PropertyDefinition;
declare function getStaticValue(node: Node$3, initialScope?: eslint.Scope.Scope | null | undefined): StaticValue$1 | null;
type StaticValue$1 = StaticValue$2;
type Node$3 = estree.Node;
declare function getStringIfConstant(node: Node$2, initialScope?: eslint.Scope.Scope | null | undefined): string | null;
type Node$2 = estree.Node;
declare function hasSideEffect(node: Node$1, sourceCode: SourceCode$1, options?: HasSideEffectOptions$1 | undefined): boolean;
type Node$1 = estree.Node;
type SourceCode$1 = eslint.SourceCode;
declare function isArrowToken(token: CommentOrToken): token is ArrowToken$1;
declare function isCommaToken(token: CommentOrToken): token is CommaToken$1;
declare function isSemicolonToken(token: CommentOrToken): token is SemicolonToken$1;
declare function isColonToken(token: CommentOrToken): token is ColonToken$1;
declare function isOpeningParenToken(token: CommentOrToken): token is OpeningParenToken$1;
declare function isClosingParenToken(token: CommentOrToken): token is ClosingParenToken$1;
declare function isOpeningBracketToken(token: CommentOrToken): token is OpeningBracketToken$1;
declare function isClosingBracketToken(token: CommentOrToken): token is ClosingBracketToken$1;
declare function isOpeningBraceToken(token: CommentOrToken): token is OpeningBraceToken$1;
declare function isClosingBraceToken(token: CommentOrToken): token is ClosingBraceToken$1;
declare function isCommentToken(token: CommentOrToken): token is estree.Comment;
declare function isNotArrowToken(arg0: CommentOrToken): boolean;
declare function isNotCommaToken(arg0: CommentOrToken): boolean;
declare function isNotSemicolonToken(arg0: CommentOrToken): boolean;
declare function isNotColonToken(arg0: CommentOrToken): boolean;
declare function isNotOpeningParenToken(arg0: CommentOrToken): boolean;
declare function isNotClosingParenToken(arg0: CommentOrToken): boolean;
declare function isNotOpeningBracketToken(arg0: CommentOrToken): boolean;
declare function isNotClosingBracketToken(arg0: CommentOrToken): boolean;
declare function isNotOpeningBraceToken(arg0: CommentOrToken): boolean;
declare function isNotClosingBraceToken(arg0: CommentOrToken): boolean;
declare function isNotCommentToken(arg0: CommentOrToken): boolean;
type Token = eslint.AST.Token;
type Comment = estree.Comment;
type CommentOrToken = Comment | Token;
declare function isParenthesized(timesOrNode: Node | number, nodeOrSourceCode: Node | SourceCode, optionalSourceCode?: eslint.SourceCode | undefined): boolean;
type Node = estree.Node;
type SourceCode = eslint.SourceCode;
declare class PatternMatcher {
constructor(pattern: RegExp, options?: {
escaped?: boolean | undefined;
} | undefined);
execAll(str: string): IterableIterator<RegExpExecArray>;
test(str: string): boolean;
[Symbol.replace](str: string, replacer: string | ((...strs: string[]) => string)): string;
}
declare namespace _default {
export { CALL };
export { CONSTRUCT };
export { ESM };
export { findVariable };
export { getFunctionHeadLocation };
export { getFunctionNameWithKind };
export { getInnermostScope };
export { getPropertyName };
export { getStaticValue };
export { getStringIfConstant };
export { hasSideEffect };
export { isArrowToken };
export { isClosingBraceToken };
export { isClosingBracketToken };
export { isClosingParenToken };
export { isColonToken };
export { isCommaToken };
export { isCommentToken };
export { isNotArrowToken };
export { isNotClosingBraceToken };
export { isNotClosingBracketToken };
export { isNotClosingParenToken };
export { isNotColonToken };
export { isNotCommaToken };
export { isNotCommentToken };
export { isNotOpeningBraceToken };
export { isNotOpeningBracketToken };
export { isNotOpeningParenToken };
export { isNotSemicolonToken };
export { isOpeningBraceToken };
export { isOpeningBracketToken };
export { isOpeningParenToken };
export { isParenthesized };
export { isSemicolonToken };
export { PatternMatcher };
export { READ };
export { ReferenceTracker };
}
type StaticValue = StaticValue$2;
type StaticValueOptional = StaticValueOptional$1;
type StaticValueProvided = StaticValueProvided$1;
type ReferenceTrackerOptions = ReferenceTrackerOptions$1;
type TraceMap<T> = TraceMap$1<T>;
type TrackedReferences<T> = TrackedReferences$1<T>;
type HasSideEffectOptions = HasSideEffectOptions$1;
type ArrowToken = ArrowToken$1;
type CommaToken = CommaToken$1;
type SemicolonToken = SemicolonToken$1;
type ColonToken = ColonToken$1;
type OpeningParenToken = OpeningParenToken$1;
type ClosingParenToken = ClosingParenToken$1;
type OpeningBracketToken = OpeningBracketToken$1;
type ClosingBracketToken = ClosingBracketToken$1;
type OpeningBraceToken = OpeningBraceToken$1;
type ClosingBraceToken = ClosingBraceToken$1;
export { ArrowToken, CALL, CONSTRUCT, ClosingBraceToken, ClosingBracketToken, ClosingParenToken, ColonToken, CommaToken, ESM, HasSideEffectOptions, OpeningBraceToken, OpeningBracketToken, OpeningParenToken, PatternMatcher, READ, ReferenceTracker, ReferenceTrackerOptions, SemicolonToken, StaticValue, StaticValueOptional, StaticValueProvided, TraceMap, TrackedReferences, _default as default, findVariable, getFunctionHeadLocation, getFunctionNameWithKind, getInnermostScope, getPropertyName, getStaticValue, getStringIfConstant, hasSideEffect, isArrowToken, isClosingBraceToken, isClosingBracketToken, isClosingParenToken, isColonToken, isCommaToken, isCommentToken, isNotArrowToken, isNotClosingBraceToken, isNotClosingBracketToken, isNotClosingParenToken, isNotColonToken, isNotCommaToken, isNotCommentToken, isNotOpeningBraceToken, isNotOpeningBracketToken, isNotOpeningParenToken, isNotSemicolonToken, isOpeningBraceToken, isOpeningBracketToken, isOpeningParenToken, isParenthesized, isSemicolonToken };

217
node_modules/@eslint-community/eslint-utils/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,217 @@
import * as eslint from 'eslint';
import { Rule, AST } from 'eslint';
import * as estree from 'estree';
declare const READ: unique symbol;
declare const CALL: unique symbol;
declare const CONSTRUCT: unique symbol;
declare const ESM: unique symbol;
declare class ReferenceTracker {
constructor(globalScope: Scope$2, options?: {
mode?: "legacy" | "strict" | undefined;
globalObjectNames?: string[] | undefined;
} | undefined);
private variableStack;
private globalScope;
private mode;
private globalObjectNames;
iterateGlobalReferences<T>(traceMap: TraceMap$2<T>): IterableIterator<TrackedReferences$2<T>>;
iterateCjsReferences<T_1>(traceMap: TraceMap$2<T_1>): IterableIterator<TrackedReferences$2<T_1>>;
iterateEsmReferences<T_2>(traceMap: TraceMap$2<T_2>): IterableIterator<TrackedReferences$2<T_2>>;
iteratePropertyReferences<T_3>(node: Expression, traceMap: TraceMap$2<T_3>): IterableIterator<TrackedReferences$2<T_3>>;
private _iterateVariableReferences;
private _iteratePropertyReferences;
private _iterateLhsReferences;
private _iterateImportReferences;
}
declare namespace ReferenceTracker {
export { READ };
export { CALL };
export { CONSTRUCT };
export { ESM };
}
type Scope$2 = eslint.Scope.Scope;
type Expression = estree.Expression;
type TraceMap$2<T> = TraceMap$1<T>;
type TrackedReferences$2<T> = TrackedReferences$1<T>;
type StaticValue$2 = StaticValueProvided$1 | StaticValueOptional$1;
type StaticValueProvided$1 = {
optional?: undefined;
value: unknown;
};
type StaticValueOptional$1 = {
optional?: true;
value: undefined;
};
type ReferenceTrackerOptions$1 = {
globalObjectNames?: string[];
mode?: "legacy" | "strict";
};
type TraceMap$1<T = unknown> = {
[i: string]: TraceMapObject<T>;
};
type TraceMapObject<T> = {
[i: string]: TraceMapObject<T>;
[CALL]?: T;
[CONSTRUCT]?: T;
[READ]?: T;
[ESM]?: boolean;
};
type TrackedReferences$1<T> = {
info: T;
node: Rule.Node;
path: string[];
type: typeof CALL | typeof CONSTRUCT | typeof READ;
};
type HasSideEffectOptions$1 = {
considerGetters?: boolean;
considerImplicitTypeConversion?: boolean;
};
type PunctuatorToken<Value extends string> = AST.Token & {
type: "Punctuator";
value: Value;
};
type ArrowToken$1 = PunctuatorToken<"=>">;
type CommaToken$1 = PunctuatorToken<",">;
type SemicolonToken$1 = PunctuatorToken<";">;
type ColonToken$1 = PunctuatorToken<":">;
type OpeningParenToken$1 = PunctuatorToken<"(">;
type ClosingParenToken$1 = PunctuatorToken<")">;
type OpeningBracketToken$1 = PunctuatorToken<"[">;
type ClosingBracketToken$1 = PunctuatorToken<"]">;
type OpeningBraceToken$1 = PunctuatorToken<"{">;
type ClosingBraceToken$1 = PunctuatorToken<"}">;
declare function findVariable(initialScope: Scope$1, nameOrNode: string | Identifier): Variable | null;
type Scope$1 = eslint.Scope.Scope;
type Variable = eslint.Scope.Variable;
type Identifier = estree.Identifier;
declare function getFunctionHeadLocation(node: FunctionNode$1, sourceCode: SourceCode$2): SourceLocation | null;
type SourceCode$2 = eslint.SourceCode;
type FunctionNode$1 = estree.Function;
type SourceLocation = estree.SourceLocation;
declare function getFunctionNameWithKind(node: FunctionNode, sourceCode?: eslint.SourceCode | undefined): string;
type FunctionNode = estree.Function;
declare function getInnermostScope(initialScope: Scope, node: Node$4): Scope;
type Scope = eslint.Scope.Scope;
type Node$4 = estree.Node;
declare function getPropertyName(node: MemberExpression | MethodDefinition | Property | PropertyDefinition, initialScope?: eslint.Scope.Scope | undefined): string | null | undefined;
type MemberExpression = estree.MemberExpression;
type MethodDefinition = estree.MethodDefinition;
type Property = estree.Property;
type PropertyDefinition = estree.PropertyDefinition;
declare function getStaticValue(node: Node$3, initialScope?: eslint.Scope.Scope | null | undefined): StaticValue$1 | null;
type StaticValue$1 = StaticValue$2;
type Node$3 = estree.Node;
declare function getStringIfConstant(node: Node$2, initialScope?: eslint.Scope.Scope | null | undefined): string | null;
type Node$2 = estree.Node;
declare function hasSideEffect(node: Node$1, sourceCode: SourceCode$1, options?: HasSideEffectOptions$1 | undefined): boolean;
type Node$1 = estree.Node;
type SourceCode$1 = eslint.SourceCode;
declare function isArrowToken(token: CommentOrToken): token is ArrowToken$1;
declare function isCommaToken(token: CommentOrToken): token is CommaToken$1;
declare function isSemicolonToken(token: CommentOrToken): token is SemicolonToken$1;
declare function isColonToken(token: CommentOrToken): token is ColonToken$1;
declare function isOpeningParenToken(token: CommentOrToken): token is OpeningParenToken$1;
declare function isClosingParenToken(token: CommentOrToken): token is ClosingParenToken$1;
declare function isOpeningBracketToken(token: CommentOrToken): token is OpeningBracketToken$1;
declare function isClosingBracketToken(token: CommentOrToken): token is ClosingBracketToken$1;
declare function isOpeningBraceToken(token: CommentOrToken): token is OpeningBraceToken$1;
declare function isClosingBraceToken(token: CommentOrToken): token is ClosingBraceToken$1;
declare function isCommentToken(token: CommentOrToken): token is estree.Comment;
declare function isNotArrowToken(arg0: CommentOrToken): boolean;
declare function isNotCommaToken(arg0: CommentOrToken): boolean;
declare function isNotSemicolonToken(arg0: CommentOrToken): boolean;
declare function isNotColonToken(arg0: CommentOrToken): boolean;
declare function isNotOpeningParenToken(arg0: CommentOrToken): boolean;
declare function isNotClosingParenToken(arg0: CommentOrToken): boolean;
declare function isNotOpeningBracketToken(arg0: CommentOrToken): boolean;
declare function isNotClosingBracketToken(arg0: CommentOrToken): boolean;
declare function isNotOpeningBraceToken(arg0: CommentOrToken): boolean;
declare function isNotClosingBraceToken(arg0: CommentOrToken): boolean;
declare function isNotCommentToken(arg0: CommentOrToken): boolean;
type Token = eslint.AST.Token;
type Comment = estree.Comment;
type CommentOrToken = Comment | Token;
declare function isParenthesized(timesOrNode: Node | number, nodeOrSourceCode: Node | SourceCode, optionalSourceCode?: eslint.SourceCode | undefined): boolean;
type Node = estree.Node;
type SourceCode = eslint.SourceCode;
declare class PatternMatcher {
constructor(pattern: RegExp, options?: {
escaped?: boolean | undefined;
} | undefined);
execAll(str: string): IterableIterator<RegExpExecArray>;
test(str: string): boolean;
[Symbol.replace](str: string, replacer: string | ((...strs: string[]) => string)): string;
}
declare namespace _default {
export { CALL };
export { CONSTRUCT };
export { ESM };
export { findVariable };
export { getFunctionHeadLocation };
export { getFunctionNameWithKind };
export { getInnermostScope };
export { getPropertyName };
export { getStaticValue };
export { getStringIfConstant };
export { hasSideEffect };
export { isArrowToken };
export { isClosingBraceToken };
export { isClosingBracketToken };
export { isClosingParenToken };
export { isColonToken };
export { isCommaToken };
export { isCommentToken };
export { isNotArrowToken };
export { isNotClosingBraceToken };
export { isNotClosingBracketToken };
export { isNotClosingParenToken };
export { isNotColonToken };
export { isNotCommaToken };
export { isNotCommentToken };
export { isNotOpeningBraceToken };
export { isNotOpeningBracketToken };
export { isNotOpeningParenToken };
export { isNotSemicolonToken };
export { isOpeningBraceToken };
export { isOpeningBracketToken };
export { isOpeningParenToken };
export { isParenthesized };
export { isSemicolonToken };
export { PatternMatcher };
export { READ };
export { ReferenceTracker };
}
type StaticValue = StaticValue$2;
type StaticValueOptional = StaticValueOptional$1;
type StaticValueProvided = StaticValueProvided$1;
type ReferenceTrackerOptions = ReferenceTrackerOptions$1;
type TraceMap<T> = TraceMap$1<T>;
type TrackedReferences<T> = TrackedReferences$1<T>;
type HasSideEffectOptions = HasSideEffectOptions$1;
type ArrowToken = ArrowToken$1;
type CommaToken = CommaToken$1;
type SemicolonToken = SemicolonToken$1;
type ColonToken = ColonToken$1;
type OpeningParenToken = OpeningParenToken$1;
type ClosingParenToken = ClosingParenToken$1;
type OpeningBracketToken = OpeningBracketToken$1;
type ClosingBracketToken = ClosingBracketToken$1;
type OpeningBraceToken = OpeningBraceToken$1;
type ClosingBraceToken = ClosingBraceToken$1;
export { ArrowToken, CALL, CONSTRUCT, ClosingBraceToken, ClosingBracketToken, ClosingParenToken, ColonToken, CommaToken, ESM, HasSideEffectOptions, OpeningBraceToken, OpeningBracketToken, OpeningParenToken, PatternMatcher, READ, ReferenceTracker, ReferenceTrackerOptions, SemicolonToken, StaticValue, StaticValueOptional, StaticValueProvided, TraceMap, TrackedReferences, _default as default, findVariable, getFunctionHeadLocation, getFunctionNameWithKind, getInnermostScope, getPropertyName, getStaticValue, getStringIfConstant, hasSideEffect, isArrowToken, isClosingBraceToken, isClosingBracketToken, isClosingParenToken, isColonToken, isCommaToken, isCommentToken, isNotArrowToken, isNotClosingBraceToken, isNotClosingBracketToken, isNotClosingParenToken, isNotColonToken, isNotCommaToken, isNotCommentToken, isNotOpeningBraceToken, isNotOpeningBracketToken, isNotOpeningParenToken, isNotSemicolonToken, isOpeningBraceToken, isOpeningBracketToken, isOpeningParenToken, isParenthesized, isSemicolonToken };

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{
"name": "@eslint-community/eslint-utils",
"version": "4.4.0",
"version": "4.7.0",
"description": "Utilities for ESLint plugins.",
"keywords": [
"eslint"
@@ -30,38 +30,53 @@
],
"scripts": {
"prebuild": "npm run -s clean",
"build": "rollup -c",
"clean": "rimraf .nyc_output coverage index.*",
"build": "npm run build:dts && npm run build:rollup",
"build:dts": "tsc -p tsconfig.build.json",
"build:rollup": "rollup -c",
"clean": "rimraf .nyc_output coverage index.* dist",
"coverage": "opener ./coverage/lcov-report/index.html",
"docs:build": "vitepress build docs",
"docs:watch": "vitepress dev docs",
"format": "npm run -s format:prettier -- --write",
"format:prettier": "prettier .",
"format:check": "npm run -s format:prettier -- --check",
"lint": "eslint .",
"test": "c8 mocha --reporter dot \"test/*.mjs\"",
"preversion": "npm test && npm run -s build",
"lint:eslint": "eslint .",
"lint:format": "npm run -s format:check",
"lint:installed-check": "installed-check -v -i installed-check -i npm-run-all2 -i knip -i rollup-plugin-dts",
"lint:knip": "knip",
"lint": "run-p lint:*",
"test-coverage": "c8 mocha --reporter dot \"test/*.mjs\"",
"test": "mocha --reporter dot \"test/*.mjs\"",
"preversion": "npm run test-coverage && npm run -s build",
"postversion": "git push && git push --tags",
"prewatch": "npm run -s clean",
"watch": "warun \"{src,test}/**/*.mjs\" -- npm run -s test:mocha"
},
"dependencies": {
"eslint-visitor-keys": "^3.3.0"
"eslint-visitor-keys": "^3.4.3"
},
"devDependencies": {
"@eslint-community/eslint-plugin-mysticatea": "^15.2.0",
"c8": "^7.12.0",
"dot-prop": "^6.0.1",
"eslint": "^8.28.0",
"@eslint-community/eslint-plugin-mysticatea": "^15.6.1",
"@types/eslint": "^9.6.1",
"@types/estree": "^1.0.7",
"@typescript-eslint/parser": "^5.62.0",
"@typescript-eslint/types": "^5.62.0",
"c8": "^8.0.1",
"dot-prop": "^7.2.0",
"eslint": "^8.57.1",
"installed-check": "^8.0.1",
"knip": "^5.33.3",
"mocha": "^9.2.2",
"npm-run-all": "^4.1.5",
"npm-run-all2": "^6.2.3",
"opener": "^1.5.2",
"prettier": "2.8.4",
"prettier": "2.8.8",
"rimraf": "^3.0.2",
"rollup": "^2.79.1",
"rollup": "^2.79.2",
"rollup-plugin-dts": "^4.2.3",
"rollup-plugin-sourcemaps": "^0.6.3",
"semver": "^7.3.8",
"vitepress": "^1.0.0-alpha.40",
"semver": "^7.6.3",
"typescript": "^4.9.5",
"vitepress": "^1.4.1",
"warun": "^1.0.0"
},
"peerDependencies": {
@@ -69,5 +84,6 @@
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
},
"funding": "https://opencollective.com/eslint"
}

4
node_modules/@eslint/js/README.md generated vendored
View File

@@ -8,8 +8,8 @@ The beginnings of separating out JavaScript-specific functionality from ESLint.
Right now, this plugin contains two configurations:
- `recommended` - enables the rules recommended by the ESLint team (the replacement for `"eslint:recommended"`)
- `all` - enables all ESLint rules (the replacement for `"eslint:all"`)
- `recommended` - enables the rules recommended by the ESLint team (the replacement for `"eslint:recommended"`)
- `all` - enables all ESLint rules (the replacement for `"eslint:all"`)
## Installation

View File

@@ -1,6 +1,6 @@
{
"name": "@eslint/js",
"version": "9.24.0",
"version": "9.26.0",
"description": "ESLint JavaScript language implementation",
"main": "./src/index.js",
"types": "./types/index.d.ts",

View File

@@ -104,6 +104,21 @@ You can respond to the intercepted HTTP request by constructing a Fetch API Resp
- Does **not** provide any request matching logic;
- Does **not** handle requests by default.
## Limitations
- Interceptors will hang indefinitely if you call `req.end()` in the `connect` event listener of the respective `socket`:
```ts
req.on('socket', (socket) => {
socket.on('connect', () => {
// ❌ While this is allowed in Node.js, this cannot be handled in Interceptors.
req.end()
})
})
```
> This limitation is intrinsic to the interception algorithm used by the library. In order for it to emit the `connect` event on the socket, the library must know if you've handled the request in any way (e.g. responded with a mocked response or errored it). For that, it emits the `request` event on the interceptor where you can handle the request. Since you can consume the request stream in the `request` event, it waits until the request body stream is complete (i.e. until `req.end()` is called). This creates a catch 22 that causes this limitation.
## Getting started
```bash

File diff suppressed because one or more lines are too long

View File

@@ -6,11 +6,12 @@ import {
import {
RequestController,
handleRequest
} from "./chunk-H5O73WD2.mjs";
} from "./chunk-L37TY7LC.mjs";
import {
FetchResponse,
IS_PATCHED_MODULE
} from "./chunk-FK37CTPH.mjs";
IS_PATCHED_MODULE,
setRawRequest
} from "./chunk-CNX33NZA.mjs";
import {
hasConfigurableGlobal
} from "./chunk-TX5GBTFY.mjs";
@@ -693,6 +694,7 @@ var XMLHttpRequestController = class {
}
});
define(fetchRequest, "headers", proxyHeaders);
setRawRequest(fetchRequest, this.request);
this.logger.info("converted request to a Fetch API Request!", fetchRequest);
return fetchRequest;
}
@@ -841,4 +843,4 @@ XMLHttpRequestInterceptor.interceptorSymbol = Symbol("xhr");
export {
XMLHttpRequestInterceptor
};
//# sourceMappingURL=chunk-E2WFHJX6.mjs.map
//# sourceMappingURL=chunk-7RPAMWJ6.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -97,9 +97,20 @@ var FetchResponse = _FetchResponse;
FetchResponse.STATUS_CODES_WITHOUT_BODY = [101, 103, 204, 205, 304];
FetchResponse.STATUS_CODES_WITH_REDIRECT = [301, 302, 303, 307, 308];
// src/getRawRequest.ts
var kRawRequest = Symbol("kRawRequest");
function getRawRequest(request) {
return Reflect.get(request, kRawRequest);
}
function setRawRequest(request, rawRequest) {
Reflect.set(request, kRawRequest, rawRequest);
}
export {
IS_PATCHED_MODULE,
canParseUrl,
FetchResponse
FetchResponse,
getRawRequest,
setRawRequest
};
//# sourceMappingURL=chunk-FK37CTPH.mjs.map
//# sourceMappingURL=chunk-CNX33NZA.mjs.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -39,12 +39,14 @@ var RequestController = class {
this[kResponsePromise].resolve(response);
}
/**
* Error this request with the given error.
* Error this request with the given reason.
*
* @example
* controller.errorWith()
* controller.errorWith(new Error('Oops!'))
* controller.errorWith({ message: 'Oops!'})
*/
errorWith(error) {
errorWith(reason) {
_outvariant.invariant.as(
InterceptorError,
!this[kRequestHandled],
@@ -53,7 +55,7 @@ var RequestController = class {
this.request.url
);
this[kRequestHandled] = true;
this[kResponsePromise].resolve(error);
this[kResponsePromise].resolve(reason);
}
};
kResponsePromise, kRequestHandled;
@@ -73,6 +75,11 @@ async function emitAsync(emitter, eventName, ...data) {
var _until = require('@open-draft/until');
// src/utils/isObject.ts
function isObject(value, loose = false) {
return loose ? Object.prototype.toString.call(value).startsWith("[object ") : Object.prototype.toString.call(value) === "[object Object]";
}
// src/utils/isPropertyAccessible.ts
function isPropertyAccessible(obj, key) {
try {
@@ -103,7 +110,10 @@ function createServerErrorResponse(body) {
);
}
function isResponseError(response) {
return isPropertyAccessible(response, "type") && response.type === "error";
return response != null && response instanceof Response && isPropertyAccessible(response, "type") && response.type === "error";
}
function isResponseLike(value) {
return isObject(value, true) && isPropertyAccessible(value, "status") && isPropertyAccessible(value, "statusText") && isPropertyAccessible(value, "bodyUsed");
}
// src/utils/isNodeLikeError.ts
@@ -122,12 +132,21 @@ async function handleRequest(options) {
const handleResponse = async (response) => {
if (response instanceof Error) {
options.onError(response);
} else if (isResponseError(response)) {
options.onRequestError(response);
} else {
await options.onResponse(response);
return true;
}
return true;
if (isResponseError(response)) {
options.onRequestError(response);
return true;
}
if (isResponseLike(response)) {
await options.onResponse(response);
return true;
}
if (isObject(response)) {
options.onError(response);
return true;
}
return false;
};
const handleResponseError = async (error) => {
if (error instanceof InterceptorError) {
@@ -165,7 +184,7 @@ async function handleRequest(options) {
}
}
const result = await _until.until.call(void 0, async () => {
const requestListtenersPromise = emitAsync(options.emitter, "request", {
const requestListenersPromise = emitAsync(options.emitter, "request", {
requestId: options.requestId,
request: options.request,
controller: options.controller
@@ -173,11 +192,10 @@ async function handleRequest(options) {
await Promise.race([
// Short-circuit the request handling promise if the request gets aborted.
requestAbortPromise,
requestListtenersPromise,
requestListenersPromise,
options.controller[kResponsePromise]
]);
const mockedResponse = await options.controller[kResponsePromise];
return mockedResponse;
return await options.controller[kResponsePromise];
});
if (requestAbortPromise.state === "rejected") {
options.onError(requestAbortPromise.rejectionReason);
@@ -225,4 +243,4 @@ async function handleRequest(options) {
exports.RequestController = RequestController; exports.emitAsync = emitAsync; exports.handleRequest = handleRequest;
//# sourceMappingURL=chunk-FGSEOIC4.js.map
//# sourceMappingURL=chunk-GTJ35JP4.js.map

Some files were not shown because too many files have changed in this diff Show More