Compare commits

..

98 Commits

Author SHA1 Message Date
Edoardo Pirovano
89d78ba457 Merge pull request #729 from github/update-v1.0.13-4455bf8c
Merge main into v1
2021-09-06 12:49:34 +01:00
github-actions[bot]
e72d9f4a72 1.0.13 2021-09-06 09:02:00 +00:00
Andrew Eisenberg
4455bf8cd9 Merge pull request #723 from github/adityasharad/readme-indent
README: Minor formatting edits
2021-09-02 10:49:46 -07:00
Andrew Eisenberg
12300ac88e Merge branch 'main' into adityasharad/readme-indent 2021-09-01 21:03:17 -07:00
Aditya Sharad
11db623ba8 Merge pull request #724 from aeisenberg/aeisenberg/changelog
Update changelog
2021-09-01 16:35:44 -07:00
Andrew Eisenberg
3f515d3140 Update changelog 2021-09-01 15:58:18 -07:00
Aditya Sharad
a57642e1a0 README: Minor formatting edits 2021-09-01 15:56:15 -07:00
Andrew Eisenberg
62ef9f5eb2 Merge pull request #713 from github/aeisenberg/pr-check-names
Add names to all pr-checks
2021-09-01 15:47:24 -07:00
Andrew Eisenberg
e22a6cd3c9 Merge branch 'main' into aeisenberg/pr-check-names 2021-09-01 15:34:36 -07:00
Andrew Eisenberg
f9b0b9cb7b Merge pull request #715 from edoardopirovano/remove-old-loc
Remove old baseline LoC injection
2021-09-01 10:20:01 -07:00
Andrew Eisenberg
5fc16ebcf6 Merge branch 'main' into remove-old-loc 2021-09-01 09:49:28 -07:00
Andrew Eisenberg
7e2215bc92 Merge pull request #722 from github/esbena-patch-2
Fix typo in docstring
2021-09-01 08:47:47 -07:00
Andrew Eisenberg
3a016ebea8 Merge branch 'main' into remove-old-loc 2021-09-01 07:27:50 -07:00
Andrew Eisenberg
2ba7208ff2 Merge branch 'main' into aeisenberg/pr-check-names 2021-09-01 07:27:25 -07:00
Andrew Eisenberg
72399ae69a Merge branch 'main' into esbena-patch-2 2021-09-01 07:26:43 -07:00
Andrew Eisenberg
c0a58782b6 Merge pull request #721 from github/aeisenberg/update-pack-version
Update integration test pack versions
2021-08-31 21:47:11 -07:00
Andrew Eisenberg
d1ff4d6297 Try the nightly build for packaging integration tests 2021-08-31 19:21:37 -07:00
Andrew Eisenberg
80a6b3a41e Merge branch 'main' into remove-old-loc 2021-08-31 14:58:37 -07:00
Esben Sparre Andreasen
1c27c52804 Fix typo in docstring 2021-08-31 09:27:30 +02:00
Andrew Eisenberg
e833d6e84c Update integration test pack versions 2021-08-26 15:59:11 -07:00
Andrew Eisenberg
8a0c541e24 Merge branch 'main' into aeisenberg/pr-check-names 2021-08-26 10:05:30 -07:00
Andrew Eisenberg
e2d592dc8f Merge pull request #714 from github/aeisenberg/update-linguist
Upgrade linguist dependency
2021-08-26 10:04:42 -07:00
Edoardo Pirovano
2e71e02553 Remove old baseline LoC injection 2021-08-26 13:46:22 +01:00
Andrew Eisenberg
b29bf7b05a Upgrade linguist dependency
This version changes how it counts python heredoc. All heredoc is
counted as code.
2021-08-25 11:15:45 -07:00
Andrew Eisenberg
1785bbb7d8 Add names to all pr-checks 2021-08-25 10:38:25 -07:00
Edoardo Pirovano
a44b61d961 Merge pull request #707 from edoardopirovano/cli-version
Improve handling of CLI versions
2021-08-25 15:52:37 +01:00
Henry Mercer
a062fc9bf5 Merge branch 'main' into cli-version 2021-08-25 15:33:18 +01:00
Aditya Sharad
50de2e4d1e Merge pull request #712 from github/hmakholm/pr/2.6.0
Update CodeQL bundle to 20210824 / 2.6.0
2021-08-24 15:32:25 -07:00
Edoardo Pirovano
132e08a05f Bump version of testing pack 2021-08-24 23:18:22 +01:00
Henning Makholm
720884501a Update CodeQL bundle to 20210824 / 2.6.0 2021-08-24 23:06:42 +02:00
Edoardo Pirovano
fd45eac830 Address PR comments from @henrymercer 2021-08-18 16:39:00 +01:00
Edoardo Pirovano
e70ec1d70e Test against oldest supported version 2021-08-18 11:48:12 +01:00
Edoardo Pirovano
70d2efc353 Enforce a minimum version of CodeQL CLI 2021-08-18 11:48:12 +01:00
Edoardo Pirovano
fb77829455 Version flag usage of certain CLI flags 2021-08-18 09:44:49 +01:00
Edoardo Pirovano
4ba53e33d7 Cache result of codeql version 2021-08-18 09:26:33 +01:00
Edoardo Pirovano
f0a2954c12 Merge pull request #706 from iotbo/main
fix indentation error on README.md
2021-08-17 09:53:18 +01:00
iotboy
bf91ac91d4 fix indentation error on README.md 2021-08-17 15:52:11 +08:00
Edoardo Pirovano
e3151ae8df Merge pull request #703 from github/dependabot/npm_and_yarn/runner/webpack-5.50.0
Bump webpack from 5.48.0 to 5.50.0 in /runner
2021-08-16 11:53:47 +01:00
dependabot[bot]
a2f0227de2 Bump webpack from 5.48.0 to 5.50.0 in /runner
Bumps [webpack](https://github.com/webpack/webpack) from 5.48.0 to 5.50.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.48.0...v5.50.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-16 09:47:18 +00:00
Edoardo Pirovano
2639547a69 Merge pull request #705 from github/mergeback/v1.0.12-to-main-b0e70410
Mergeback v1.0.12 refs/heads/v1 into main
2021-08-16 10:46:00 +01:00
github-actions[bot]
e86cff2acb Update checked-in dependencies 2021-08-16 09:26:34 +00:00
github-actions[bot]
2eb8300e80 1.0.13 2021-08-16 09:20:05 +00:00
github-actions[bot]
78cda05e38 Update changelog and version after v1.0.12 2021-08-16 09:20:02 +00:00
Edoardo Pirovano
b0e70410b4 Merge pull request #704 from github/update-v1.0.12-01d17eaf
Merge main into v1
2021-08-16 10:19:26 +01:00
github-actions[bot]
3254fa5859 1.0.12 2021-08-16 09:02:11 +00:00
Edoardo Pirovano
01d17eaf42 Merge pull request #702 from github/pass-ram-flag
Pass `--ram` flag to `database finalize`
2021-08-12 18:25:43 +01:00
Edoardo Pirovano
0c4306b672 Pass --ram flag to database finalize 2021-08-12 18:12:28 +01:00
Henry Mercer
acd9964b7a Merge pull request #701 from github/henrymercer/brief-releasing-instructions
Add brief instructions on creating a release
2021-08-11 18:57:21 +01:00
Henry Mercer
bc33041cc2 Always run codeql (latest) job on PRs so we can make it required 2021-08-11 18:42:29 +01:00
Henry Mercer
c7203c94d9 Fix conditional in PR checks 2021-08-11 18:27:35 +01:00
Henry Mercer
7f1659f0d8 Merge branch 'main' into henrymercer/brief-releasing-instructions 2021-08-11 18:11:56 +01:00
Henry Mercer
962925a448 Merge pull request #700 from github/henrymercer/reduce-num-pr-check-jobs-on-push
Reduce the number of PR checks that are run on `push`
2021-08-11 18:11:44 +01:00
Henry Mercer
4e477f1b95 Add more details on the workflows involved in the release process 2021-08-11 18:11:25 +01:00
Henry Mercer
a068a286e6 Add brief instructions on creating a release 2021-08-11 17:50:47 +01:00
Henry Mercer
b19f1f91f0 Reduce the number of PR checks that are run on push
If we're running on push, then we can reintroduce the logic that skips
running with `tools: latest` when it would be the same as running with
`tools: null`.
2021-08-11 17:27:26 +01:00
Henry Mercer
f1c75fc816 Merge pull request #694 from github/dependabot/npm_and_yarn/typescript-eslint/parser-4.29.1
Bump @typescript-eslint/parser from 4.29.0 to 4.29.1
2021-08-11 16:14:07 +01:00
github-actions[bot]
1e0763ca30 Update checked-in dependencies 2021-08-11 14:28:28 +00:00
Henry Mercer
5fd8ca8122 Merge branch 'main' into dependabot/npm_and_yarn/typescript-eslint/parser-4.29.1 2021-08-11 15:12:11 +01:00
Edoardo Pirovano
873a76a1a7 Merge pull request #698 from github/dependabot/npm_and_yarn/eslint-plugin-github-4.2.0
Bump eslint-plugin-github from 4.1.5 to 4.2.0
2021-08-11 14:32:24 +01:00
github-actions[bot]
4a0d3378b1 Update checked-in dependencies 2021-08-11 13:02:43 +00:00
Henry Mercer
46043e8a9e Tweak linting rule changes brought in by eslint-plugin-github upgrade 2021-08-11 13:53:14 +01:00
dependabot[bot]
75aad219f8 Bump eslint-plugin-github from 4.1.5 to 4.2.0
Bumps [eslint-plugin-github](https://github.com/github/eslint-plugin-github) from 4.1.5 to 4.2.0.
- [Release notes](https://github.com/github/eslint-plugin-github/releases)
- [Commits](https://github.com/github/eslint-plugin-github/compare/v4.1.5...v4.2.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-github
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-11 12:52:58 +00:00
Henry Mercer
fe83f965e4 Merge pull request #692 from github/dependabot/npm_and_yarn/eslint-plugin-import-2.24.0
Bump eslint-plugin-import from 2.23.4 to 2.24.0
2021-08-11 13:50:45 +01:00
Henry Mercer
3ebf97724d Merge branch 'main' into dependabot/npm_and_yarn/eslint-plugin-import-2.24.0 2021-08-11 13:33:19 +01:00
Henry Mercer
0d884244be Merge pull request #699 from github/henrymercer/allow-latest-checks-to-be-required
Always run the `latest` tools PR checks so we can make them required
2021-08-11 13:32:02 +01:00
Henry Mercer
1263b9c651 Merge branch 'main' into henrymercer/allow-latest-checks-to-be-required 2021-08-11 13:17:37 +01:00
Henry Mercer
93c9da2c2e Reference exported names via import *.
Rather than via properties on default exports — see
https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-named-as-default-member.md
2021-08-11 13:17:04 +01:00
Henry Mercer
060eb52d32 Merge branch 'main' into dependabot/npm_and_yarn/eslint-plugin-import-2.24.0 2021-08-11 13:05:55 +01:00
Henry Mercer
8c8a933d75 Merge pull request #693 from github/dependabot/npm_and_yarn/ava/typescript-2.0.0
Bump @ava/typescript from 1.1.1 to 2.0.0
2021-08-11 13:01:56 +01:00
Henry Mercer
743d8dfb6e Always run the latest tools PR checks so we can make them required 2021-08-11 13:01:33 +01:00
Henry Mercer
75d42bea8d Add compile property to ava configuration
This is required with `@ava/typescript` v2
2021-08-11 12:23:19 +01:00
Henry Mercer
46ddfc6186 Merge branch 'main' into dependabot/npm_and_yarn/ava/typescript-2.0.0 2021-08-11 12:18:01 +01:00
Andrew Eisenberg
07fa17da87 Merge pull request #689 from github/aeisenberg/update-permissions
Updates the permissions block to be minimal
2021-08-09 15:12:02 -07:00
Andrew Eisenberg
61fb5d7202 Merge branch 'main' into aeisenberg/update-permissions 2021-08-09 14:56:35 -07:00
Aditya Sharad
89e4b4fff3 Merge pull request #697 from github/mergeback/v1.0.11-to-main-db7158f9
Mergeback v1.0.11 refs/heads/v1 into main
2021-08-09 14:36:43 -07:00
github-actions[bot]
9ad3f820af Update checked-in dependencies 2021-08-09 21:20:18 +00:00
github-actions[bot]
5ba154a3b4 1.0.12 2021-08-09 21:14:09 +00:00
github-actions[bot]
bb0eba15f5 Update changelog and version after v1.0.11 2021-08-09 21:14:08 +00:00
Aditya Sharad
db7158f9ba Merge pull request #696 from github/update-v1.0.11-20de0f01
Merge main into v1
2021-08-09 14:13:36 -07:00
github-actions[bot]
94013c25cf 1.0.11 2021-08-09 20:35:05 +00:00
Aditya Sharad
20de0f01a3 Merge pull request #691 from github/adityasharad/changelog-2.5.9
Changelog: Add note for CodeQL 2.5.9
2021-08-09 13:30:39 -07:00
Andrew Eisenberg
21753283b1 Updates the permissions block to be minimal
And adds a permissions block to the README.
2021-08-09 13:30:16 -07:00
Aditya Sharad
44c8bd3e63 Merge branch 'main' into adityasharad/changelog-2.5.9 2021-08-09 13:13:28 -07:00
github-actions[bot]
952b2690da Update checked-in dependencies 2021-08-09 19:50:05 +00:00
github-actions[bot]
d6a5bf5c1c Update checked-in dependencies 2021-08-09 19:49:49 +00:00
github-actions[bot]
068ade0b31 Update checked-in dependencies 2021-08-09 19:49:16 +00:00
dependabot[bot]
183487b717 Bump @typescript-eslint/parser from 4.29.0 to 4.29.1
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 4.29.0 to 4.29.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.29.1/packages/parser)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-09 19:48:52 +00:00
dependabot[bot]
38bb211981 Bump @ava/typescript from 1.1.1 to 2.0.0
Bumps [@ava/typescript](https://github.com/avajs/typescript) from 1.1.1 to 2.0.0.
- [Release notes](https://github.com/avajs/typescript/releases)
- [Commits](https://github.com/avajs/typescript/compare/v1.1.1...v2.0.0)

---
updated-dependencies:
- dependency-name: "@ava/typescript"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-09 19:48:14 +00:00
dependabot[bot]
a0ab4842b5 Bump eslint-plugin-import from 2.23.4 to 2.24.0
Bumps [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import) from 2.23.4 to 2.24.0.
- [Release notes](https://github.com/import-js/eslint-plugin-import/releases)
- [Changelog](https://github.com/import-js/eslint-plugin-import/blob/master/CHANGELOG.md)
- [Commits](https://github.com/import-js/eslint-plugin-import/compare/v2.23.4...v2.24.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-import
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-09 19:47:56 +00:00
Aditya Sharad
9e304b92ff Merge pull request #690 from github/revert-650-dependabot/npm_and_yarn/jsonschema-1.4.0
Revert "Bump jsonschema from 1.2.6 to 1.4.0"
2021-08-09 12:47:22 -07:00
Aditya Sharad
5e1d24657c Merge branch 'main' into revert-650-dependabot/npm_and_yarn/jsonschema-1.4.0 2021-08-09 12:31:16 -07:00
Aditya Sharad
2b6d86c672 Changelog: Add note for CodeQL 2.5.9 2021-08-09 12:30:03 -07:00
Aditya Sharad
5bcf9d9972 Merge pull request #687 from github/hmakholm/pr/2.5.9
Update CodeQL bundle to 20210809 / 2.5.9
2021-08-09 12:27:39 -07:00
Chuan-kai Lin
8068352efa Revert "Bump jsonschema from 1.2.6 to 1.4.0" 2021-08-09 12:03:58 -07:00
Aditya Sharad
bef7eecb10 Merge pull request #685 from adityasharad/tests/ruby-nightly
Add PR check job for Ruby beta
2021-08-09 12:03:23 -07:00
Henry Mercer
1df71f8baa Merge branch 'main' into hmakholm/pr/2.5.9 2021-08-09 18:28:53 +01:00
Aditya Sharad
53cfc95284 Add PR check job for Ruby beta
Add a separate job that analyses the multilanguage test repo's Ruby code.
For now, run this only with the latest released CodeQL build from defaults.json.
The cached builds and nightly builds don't support Ruby yet.

In future, we can update this and other PR checks to test a wider range of cases.
2021-08-09 08:42:02 -07:00
Henning Makholm
b22fb4674b Update CodeQL bundle to 20210809 / 2.5.9 2021-08-09 16:52:58 +02:00
320 changed files with 11262 additions and 6305 deletions

View File

@@ -14,11 +14,14 @@
], ],
"rules": { "rules": {
"filenames/match-regex": ["error", "^[a-z0-9-]+(\\.test)?$"], "filenames/match-regex": ["error", "^[a-z0-9-]+(\\.test)?$"],
"i18n-text/no-en": "off",
"import/extensions": "error", "import/extensions": "error",
"import/no-amd": "error", "import/no-amd": "error",
"import/no-commonjs": "error", "import/no-commonjs": "error",
"import/no-dynamic-require": "error", "import/no-dynamic-require": "error",
"import/no-extraneous-dependencies": ["error"], // Disable the rule that checks that devDependencies aren't imported since we use a single
// linting configuration file for both source and test code.
"import/no-extraneous-dependencies": ["error", {"devDependencies": true}],
"import/no-namespace": "off", "import/no-namespace": "off",
"import/no-unresolved": "error", "import/no-unresolved": "error",
"import/no-webpack-loader-syntax": "error", "import/no-webpack-loader-syntax": "error",
@@ -48,7 +51,8 @@
"@typescript-eslint/prefer-regexp-exec": "off", "@typescript-eslint/prefer-regexp-exec": "off",
"@typescript-eslint/require-await": "off", "@typescript-eslint/require-await": "off",
"@typescript-eslint/restrict-template-expressions": "off", "@typescript-eslint/restrict-template-expressions": "off",
"func-style": "off" "func-style": "off",
"sort-imports": "off"
} }
}] }]
} }

View File

@@ -17,8 +17,6 @@ jobs:
versions: ${{ steps.compare.outputs.versions }} versions: ${{ steps.compare.outputs.versions }}
permissions: permissions:
actions: read
contents: read
security-events: write security-events: write
steps: steps:
@@ -48,13 +46,19 @@ jobs:
CODEQL_VERSION_LATEST="$("$CODEQL_LATEST" version --format terse)" CODEQL_VERSION_LATEST="$("$CODEQL_LATEST" version --format terse)"
echo "Default CodeQL bundle version is $CODEQL_VERSION_DEFAULT" echo "Default CodeQL bundle version is $CODEQL_VERSION_DEFAULT"
echo "Latest CodeQL bundle version is $CODEQL_VERSION_LATEST" echo "Latest CodeQL bundle version is $CODEQL_VERSION_LATEST"
if [[ "$CODEQL_VERSION_DEFAULT" == "$CODEQL_VERSION_LATEST" ]]; then
# Just use `tools: null` to avoid duplication in the analysis job. # If we're running on a pull request, run with both bundles, even if `tools: latest` would
# be the same as `tools: null`. This allows us to make the job for each of the bundles a
# required status check.
#
# If we're running on push, then we can skip running with `tools: latest` when it would be
# the same as running with `tools: null`.
if [[ "$GITHUB_EVENT_NAME" != "pull_request" && "$CODEQL_VERSION_DEFAULT" == "$CODEQL_VERSION_LATEST" ]]; then
VERSIONS_JSON='[null]' VERSIONS_JSON='[null]'
else else
# Use both `tools: null` and `tools: latest` in the analysis job.
VERSIONS_JSON='[null, "latest"]' VERSIONS_JSON='[null, "latest"]'
fi fi
# Output a JSON-encoded list with the distinct versions to test against. # Output a JSON-encoded list with the distinct versions to test against.
echo "Suggested matrix config for analysis job: $VERSIONS_JSON" echo "Suggested matrix config for analysis job: $VERSIONS_JSON"
echo "::set-output name=versions::${VERSIONS_JSON}" echo "::set-output name=versions::${VERSIONS_JSON}"
@@ -68,8 +72,6 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
permissions: permissions:
actions: read
contents: read
security-events: write security-events: write
steps: steps:

View File

@@ -1,4 +1,4 @@
name: "PR checks" name: PR checks
env: env:
GO111MODULE: auto GO111MODULE: auto
@@ -14,6 +14,7 @@ on:
jobs: jobs:
lint-js: lint-js:
name: Lint
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@@ -26,10 +27,11 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Check generated JavaScript - name: Check generated JS
run: .github/workflows/script/check-js.sh run: .github/workflows/script/check-js.sh
check-node-modules: check-node-modules:
name: Check modules up to date
runs-on: macos-latest runs-on: macos-latest
steps: steps:
@@ -38,6 +40,7 @@ jobs:
run: .github/workflows/script/check-node-modules.sh run: .github/workflows/script/check-node-modules.sh
npm-test: npm-test:
name: Unit Test
needs: [check-js, check-node-modules] needs: [check-js, check-node-modules]
strategy: strategy:
matrix: matrix:
@@ -50,6 +53,7 @@ jobs:
run: npm run-script test run: npm run-script test
multi-language-repo_test-autodetect-languages: multi-language-repo_test-autodetect-languages:
name: Autodetect language (multi)
needs: [check-js, check-node-modules] needs: [check-js, check-node-modules]
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -107,6 +111,7 @@ jobs:
# Packaging test that runs against a javascript database # Packaging test that runs against a javascript database
# Specifying packs in the config file. # Specifying packs in the config file.
test-packaging-javascript-config: test-packaging-javascript-config:
name: Packaging Config JS
needs: [check-js, check-node-modules] needs: [check-js, check-node-modules]
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -123,6 +128,8 @@ jobs:
with: with:
config-file: ".github/codeql/codeql-config-packaging.yml" config-file: ".github/codeql/codeql-config-packaging.yml"
languages: javascript languages: javascript
# This version is known to worl with 0.1.0
tools: https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/codeql-bundle-20210831-manual/codeql-bundle.tar.gz
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
@@ -148,6 +155,7 @@ jobs:
# Packaging test that runs against a javascript database # Packaging test that runs against a javascript database
# Specifying packs as an input. # Specifying packs as an input.
test-packaging-javascript-inputs: test-packaging-javascript-inputs:
name: Packaging Inputs JS
needs: [check-js, check-node-modules] needs: [check-js, check-node-modules]
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -164,7 +172,9 @@ jobs:
with: with:
config-file: ".github/codeql/codeql-config-packaging2.yml" config-file: ".github/codeql/codeql-config-packaging2.yml"
languages: javascript languages: javascript
packs: dsp-testing/codeql-pack1@0.0.4, dsp-testing/codeql-pack2 packs: dsp-testing/codeql-pack1@0.1.0, dsp-testing/codeql-pack2
# This version is known to worl with 0.1.0
tools: https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/codeql-bundle-20210831-manual/codeql-bundle.tar.gz
- name: Build code - name: Build code
shell: bash shell: bash
@@ -191,6 +201,7 @@ jobs:
# Packaging test that runs against a javascript database # Packaging test that runs against a javascript database
# Specifying packs in the config file and inputs. # Specifying packs in the config file and inputs.
test-packaging-javascript-config-and-inputs: test-packaging-javascript-config-and-inputs:
name: Packaging Inputs and Config JS
needs: [check-js, check-node-modules] needs: [check-js, check-node-modules]
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -206,8 +217,10 @@ jobs:
- uses: ./../action/init - uses: ./../action/init
with: with:
config-file: ".github/codeql/codeql-config-packaging3.yml" config-file: ".github/codeql/codeql-config-packaging3.yml"
packs: +dsp-testing/codeql-pack1@0.0.4 packs: +dsp-testing/codeql-pack1@0.1.0
languages: javascript languages: javascript
# This version is known to worl with 0.1.0
tools: https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/codeql-bundle-20210831-manual/codeql-bundle.tar.gz
- name: Build code - name: Build code
shell: bash shell: bash
@@ -233,6 +246,7 @@ jobs:
# Tests a split workflow where database construction and query execution happen in different steps # Tests a split workflow where database construction and query execution happen in different steps
test-split-workflow: test-split-workflow:
name: Split workflow
needs: [check-js, check-node-modules] needs: [check-js, check-node-modules]
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -248,9 +262,10 @@ jobs:
- uses: ./../action/init - uses: ./../action/init
with: with:
config-file: ".github/codeql/codeql-config-packaging3.yml" config-file: ".github/codeql/codeql-config-packaging3.yml"
packs: +dsp-testing/codeql-pack1@0.0.4 packs: +dsp-testing/codeql-pack1@0.1.0
languages: javascript languages: javascript
tools: latest # This version is known to worl with 0.1.0
tools: https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/codeql-bundle-20210831-manual/codeql-bundle.tar.gz
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
@@ -287,12 +302,16 @@ jobs:
# Identify the CodeQL tool versions to integration test against. # Identify the CodeQL tool versions to integration test against.
check-codeql-versions: check-codeql-versions:
name: Check CodeQL Versions
needs: [check-js, check-node-modules] needs: [check-js, check-node-modules]
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
versions: ${{ steps.compare.outputs.versions }} versions: ${{ steps.compare.outputs.versions }}
nightly-url: ${{ steps.get-url.outputs.nightly-url }} nightly-url: ${{ steps.get-url.outputs.nightly-url }}
env:
# URL of the oldest release that we support, if this is being bumped then the constant
# CODEQL_MINIMUM_VERSION in the file codeql.ts should also be bumped to match this.
OLDEST_URL: https://github.com/github/codeql-action/releases/download/codeql-bundle-20201028/codeql-bundle.tar.gz
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Move codeql-action - name: Move codeql-action
@@ -336,32 +355,52 @@ jobs:
with: with:
tools: ${{ steps.get-url.outputs.nightly-url }} tools: ${{ steps.get-url.outputs.nightly-url }}
languages: javascript languages: javascript
- name: Remove empty database
# allows us to run init a fourth time
run: |
rm -rf "$RUNNER_TEMP/codeql_databases"
- name: Init with a CodeQL bundle from the oldest supported release
id: init-oldest
uses: ./../action/init
with:
tools: ${{ env.OLDEST_URL }}
languages: javascript
- name: Compare CodeQL bundle versions - name: Compare CodeQL bundle versions
id: compare id: compare
env: env:
CODEQL_DEFAULT: ${{ steps.init-default.outputs.codeql-path }} CODEQL_DEFAULT: ${{ steps.init-default.outputs.codeql-path }}
CODEQL_LATEST: ${{ steps.init-latest.outputs.codeql-path }} CODEQL_LATEST: ${{ steps.init-latest.outputs.codeql-path }}
CODEQL_NIGHTLY: ${{ steps.init-nightly.outputs.codeql-path }} CODEQL_NIGHTLY: ${{ steps.init-nightly.outputs.codeql-path }}
CODEQL_OLDEST: ${{ steps.init-oldest.outputs.codeql-path }}
NIGHTLY_URL: ${{ steps.get-url.outputs.nightly-url }} NIGHTLY_URL: ${{ steps.get-url.outputs.nightly-url }}
run: | run: |
CODEQL_VERSION_DEFAULT="$("$CODEQL_DEFAULT" version --format terse)" CODEQL_VERSION_DEFAULT="$("$CODEQL_DEFAULT" version --format terse)"
CODEQL_VERSION_LATEST="$("$CODEQL_LATEST" version --format terse)" CODEQL_VERSION_LATEST="$("$CODEQL_LATEST" version --format terse)"
CODEQL_VERSION_NIGHTLY="$("$CODEQL_NIGHTLY" version --format terse)" CODEQL_VERSION_NIGHTLY="$("$CODEQL_NIGHTLY" version --format terse)"
CODEQL_VERSION_OLDEST="$("$CODEQL_OLDEST" version --format terse)"
echo "Default CodeQL bundle version is $CODEQL_VERSION_DEFAULT" echo "Default CodeQL bundle version is $CODEQL_VERSION_DEFAULT"
echo "Latest CodeQL bundle version is $CODEQL_VERSION_LATEST" echo "Latest CodeQL bundle version is $CODEQL_VERSION_LATEST"
echo "Nightly CodeQL bundle version is $CODEQL_VERSION_NIGHTLY" echo "Nightly CodeQL bundle version is $CODEQL_VERSION_NIGHTLY"
if [[ "$CODEQL_VERSION_DEFAULT" == "$CODEQL_VERSION_LATEST" ]]; then echo "Oldest supported CodeQL bundle version is $CODEQL_VERSION_OLDEST"
# Skip `tools: latest` since it would be the same as `tools: null`
VERSIONS_JSON="[null, \"$NIGHTLY_URL\"]" # If we're running on a pull request, run each integration test with all four bundles, even
# if `tools: latest` would be the same as `tools: null`. This allows us to make the
# integration test job for each of the four bundles a required status check.
#
# If we're running on push, then we can skip running with `tools: latest` when it would be
# the same as running with `tools: null`.
if [[ "$GITHUB_EVENT_NAME" != "pull_request" && "$CODEQL_VERSION_DEFAULT" == "$CODEQL_VERSION_LATEST" ]]; then
VERSIONS_JSON="[null, \"$NIGHTLY_URL\", \"$OLDEST_URL\"]"
else else
# Run integration tests with all three bundles. VERSIONS_JSON="[null, \"$NIGHTLY_URL\", \"$OLDEST_URL\", \"latest\"]"
VERSIONS_JSON="[null, \"$NIGHTLY_URL\", \"latest\"]"
fi fi
# Output a JSON-encoded list with the distinct versions to test against. # Output a JSON-encoded list with the distinct versions to test against.
echo "Suggested matrix config for integration tests: $VERSIONS_JSON" echo "Suggested matrix config for integration tests: $VERSIONS_JSON"
echo "::set-output name=versions::${VERSIONS_JSON}" echo "::set-output name=versions::${VERSIONS_JSON}"
multi-language-repo_test-custom-queries-and-remote-config: multi-language-repo_test-custom-queries-and-remote-config:
name: Remote Config Custom Queries multi-language repo
needs: [check-js, check-node-modules, check-codeql-versions] needs: [check-js, check-node-modules, check-codeql-versions]
strategy: strategy:
fail-fast: false fail-fast: false
@@ -393,6 +432,7 @@ jobs:
# Currently is not possible to analyze Go in conjunction with other languages in macos # Currently is not possible to analyze Go in conjunction with other languages in macos
multi-language-repo_test-go-custom-queries: multi-language-repo_test-go-custom-queries:
name: Go custom queries multi-language repo
needs: [check-js, check-node-modules, check-codeql-versions] needs: [check-js, check-node-modules, check-codeql-versions]
strategy: strategy:
fail-fast: false fail-fast: false
@@ -427,6 +467,7 @@ jobs:
TEST_MODE: true TEST_MODE: true
go-custom-tracing: go-custom-tracing:
name: Go custom tracing
needs: [check-js, check-node-modules, check-codeql-versions] needs: [check-js, check-node-modules, check-codeql-versions]
strategy: strategy:
fail-fast: false fail-fast: false
@@ -462,6 +503,7 @@ jobs:
TEST_MODE: true TEST_MODE: true
go-custom-tracing-autobuild: go-custom-tracing-autobuild:
name: Go autobuild custom tracing
needs: [check-js, check-node-modules, check-codeql-versions] needs: [check-js, check-node-modules, check-codeql-versions]
strategy: strategy:
fail-fast: false fail-fast: false
@@ -497,7 +539,50 @@ jobs:
exit 1 exit 1
fi fi
# Ruby is in beta, so test it separately for now.
multi-language-repo_test-ruby:
name: Ruby multi-language
needs: [check-js, check-node-modules, check-codeql-versions]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
tools:
- latest
# TODO: Uncomment when nightly builds also support Ruby in beta.
# - ${{ needs.check-codeql-versions.outputs.nightly-url }}
runs-on: ${{ matrix.os }}
env:
CODEQL_ENABLE_EXPERIMENTAL_FEATURES: true
steps:
- uses: actions/checkout@v2
- name: Move codeql-action
shell: bash
run: |
mkdir ../action
mv * .github ../action/
mv ../action/tests/multi-language-repo/{*,.github} .
mv ../action/.github/workflows .github
- uses: ./../action/init
with:
languages: ruby
tools: ${{ matrix.tools }}
- uses: ./../action/analyze
id: analysis
env:
TEST_MODE: true
- name: Check database
shell: bash
run: |
RUBY_DB="${{ fromJson(steps.analysis.outputs.db-locations).ruby }}"
if [[ ! -d "$RUBY_DB" ]]; then
echo "Did not create a database for Ruby."
exit 1
fi
multi-language-repo_rubocop: multi-language-repo_rubocop:
name: Rubocop multi-language
needs: [check-js, check-node-modules] needs: [check-js, check-node-modules]
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -531,6 +616,7 @@ jobs:
TEST_MODE: true TEST_MODE: true
test-proxy: test-proxy:
name: Proxy
needs: [check-js, check-node-modules, check-codeql-versions] needs: [check-js, check-node-modules, check-codeql-versions]
strategy: strategy:
fail-fast: false fail-fast: false
@@ -565,6 +651,7 @@ jobs:
TEST_MODE: true TEST_MODE: true
runner-analyze-javascript-ubuntu: runner-analyze-javascript-ubuntu:
name: Runner ubuntu JS analyze
needs: [check-js, check-node-modules] needs: [check-js, check-node-modules]
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -592,6 +679,7 @@ jobs:
TEST_MODE: true TEST_MODE: true
runner-analyze-javascript-windows: runner-analyze-javascript-windows:
name: Runner windows JS analyze
needs: [check-js, check-node-modules] needs: [check-js, check-node-modules]
runs-on: windows-latest runs-on: windows-latest
@@ -615,6 +703,7 @@ jobs:
TEST_MODE: true TEST_MODE: true
runner-analyze-javascript-macos: runner-analyze-javascript-macos:
name: Runner macos JS analyze
needs: [check-js, check-node-modules] needs: [check-js, check-node-modules]
runs-on: macos-latest runs-on: macos-latest
@@ -638,6 +727,7 @@ jobs:
TEST_MODE: true TEST_MODE: true
runner-analyze-csharp-ubuntu: runner-analyze-csharp-ubuntu:
name: Runner ubuntu C# analyze
needs: [check-js, check-node-modules] needs: [check-js, check-node-modules]
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -674,6 +764,7 @@ jobs:
TEST_MODE: true TEST_MODE: true
runner-analyze-csharp-windows: runner-analyze-csharp-windows:
name: Runner windows C# analyze
needs: [check-js, check-node-modules] needs: [check-js, check-node-modules]
runs-on: windows-latest runs-on: windows-latest
@@ -713,6 +804,7 @@ jobs:
TEST_MODE: true TEST_MODE: true
runner-analyze-csharp-macos: runner-analyze-csharp-macos:
name: Runner macos C# analyze
needs: [check-js, check-node-modules] needs: [check-js, check-node-modules]
runs-on: macos-latest runs-on: macos-latest
@@ -751,6 +843,7 @@ jobs:
runner-analyze-csharp-autobuild-ubuntu: runner-analyze-csharp-autobuild-ubuntu:
name: Runner ubuntu autobuild C# analyze
needs: [check-js, check-node-modules] needs: [check-js, check-node-modules]
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -786,6 +879,7 @@ jobs:
TEST_MODE: true TEST_MODE: true
runner-analyze-csharp-autobuild-windows: runner-analyze-csharp-autobuild-windows:
name: Runner windows autobuild C# analyze
needs: [check-js, check-node-modules] needs: [check-js, check-node-modules]
runs-on: windows-latest runs-on: windows-latest
@@ -822,6 +916,7 @@ jobs:
TEST_MODE: true TEST_MODE: true
runner-analyze-csharp-autobuild-macos: runner-analyze-csharp-autobuild-macos:
name: Runner macos autobuild C# analyze
needs: [check-js, check-node-modules] needs: [check-js, check-node-modules]
runs-on: macos-latest runs-on: macos-latest
@@ -858,6 +953,7 @@ jobs:
TEST_MODE: true TEST_MODE: true
runner-upload-sarif: runner-upload-sarif:
name: Runner upload sarif
needs: [check-js, check-node-modules] needs: [check-js, check-node-modules]
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -879,6 +975,7 @@ jobs:
runner/dist/codeql-runner-linux upload --sarif-file src/testdata/empty-sarif.sarif --repository $GITHUB_REPOSITORY --commit $GITHUB_SHA --ref $GITHUB_REF --github-url $GITHUB_SERVER_URL --github-auth ${{ github.token }} runner/dist/codeql-runner-linux upload --sarif-file src/testdata/empty-sarif.sarif --repository $GITHUB_REPOSITORY --commit $GITHUB_SHA --ref $GITHUB_REF --github-url $GITHUB_SERVER_URL --github-auth ${{ github.token }}
multi-language-repo_test-local-codeql: multi-language-repo_test-local-codeql:
name: Local codeql multi-language repo
needs: [check-js, check-node-modules, check-codeql-versions] needs: [check-js, check-node-modules, check-codeql-versions]
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -899,6 +996,7 @@ jobs:
- uses: ./../action/analyze - uses: ./../action/analyze
test-javascript-source-root: test-javascript-source-root:
name: JS source root
needs: [check-js, check-node-modules] needs: [check-js, check-node-modules]
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@@ -1,8 +1,18 @@
# CodeQL Action and CodeQL Runner Changelog # CodeQL Action and CodeQL Runner Changelog
## [UNRELEASED] ## 1.0.13 - 06 Sep 2021
No user facing changes. - Update default CodeQL bundle version to 2.6.0. [#712](https://github.com/github/codeql-action/pull/712)
- Update baseline lines of code counter for python. All multi-line strings are counted as code. [#714](https://github.com/github/codeql-action/pull/714)
- Remove old baseline LoC injection [#715](https://github.com/github/codeql-action/pull/715)
## 1.0.12 - 16 Aug 2021
- Update README to include a sample permissions block. [#689](https://github.com/github/codeql-action/pull/689)
## 1.0.11 - 09 Aug 2021
- Update default CodeQL bundle version to 2.5.9. [#687](https://github.com/github/codeql-action/pull/687)
## 1.0.10 - 03 Aug 2021 ## 1.0.10 - 03 Aug 2021

View File

@@ -58,6 +58,20 @@ Here are a few things you can do that will increase the likelihood of your pull
- Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests. - Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests.
- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). - Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
## Releasing (write access required)
1. The first step of releasing a new version of the `codeql-action` is running the "Update release branch" workflow.
This workflow goes through the pull requests that have been merged to `main` since the last release, creates a changelog, then opens a pull request to merge the changes since the last release into the `v1` release branch.
A release is automatically started every Monday via a scheduled run of this workflow, however you can start a release manually by triggering a run via [workflow dispatch](https://github.com/github/codeql-action/actions/workflows/update-release-branch.yml).
1. The workflow run will open a pull request titled "Merge main into v1". Mark the pull request as [ready for review](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request#marking-a-pull-request-as-ready-for-review) to trigger the PR checks.
1. Review the checklist items in the pull request description.
Once you've checked off all but the last of these, approve the PR and automerge it.
1. When the "Merge main into v1" pull request is merged into the `v1` branch, the "Tag release and merge back" workflow will create a mergeback PR.
This mergeback incorporates the changelog updates into `main`, tags the release using the merge commit of the "Merge main into v1" pull request, and bumps the patch version of the CodeQL Action.
Approve the mergeback PR and automerge it. Once the mergeback has been merged into main, the release is complete.
## Resources ## Resources
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/) - [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)

View File

@@ -42,6 +42,14 @@ jobs:
# CodeQL runs on ubuntu-latest, windows-latest, and macos-latest # CodeQL runs on ubuntu-latest, windows-latest, and macos-latest
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
# required for all workflows
security-events: write
# only required for workflows in private repositories
actions: read
contents: read
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@v2
@@ -66,8 +74,8 @@ jobs:
# project uses a compiled language # project uses a compiled language
#- run: | #- run: |
# make bootstrap # make bootstrap
# make release # make release
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1 uses: github/codeql-action/analyze@v1
@@ -83,8 +91,8 @@ If you prefer to integrate this within an existing CI workflow, it should end up
# Here is where you build your code # Here is where you build your code
- run: | - run: |
make bootstrap make bootstrap
make release make release
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1 uses: github/codeql-action/analyze@v1

View File

@@ -26,7 +26,7 @@ const fs = __importStar(require("fs"));
const path = __importStar(require("path")); const path = __importStar(require("path"));
const ava_1 = __importDefault(require("ava")); const ava_1 = __importDefault(require("ava"));
const yaml = __importStar(require("js-yaml")); const yaml = __importStar(require("js-yaml"));
const sinon_1 = __importDefault(require("sinon")); const sinon = __importStar(require("sinon"));
const actionsutil = __importStar(require("./actions-util")); const actionsutil = __importStar(require("./actions-util"));
const testing_utils_1 = require("./testing-utils"); const testing_utils_1 = require("./testing-utils");
const util_1 = require("./util"); const util_1 = require("./util");
@@ -43,7 +43,7 @@ ava_1.default("getRef() returns merge PR ref if GITHUB_SHA still checked out", a
const currentSha = "a".repeat(40); const currentSha = "a".repeat(40);
process.env["GITHUB_REF"] = expectedRef; process.env["GITHUB_REF"] = expectedRef;
process.env["GITHUB_SHA"] = currentSha; process.env["GITHUB_SHA"] = currentSha;
const callback = sinon_1.default.stub(actionsutil, "getCommitOid"); const callback = sinon.stub(actionsutil, "getCommitOid");
callback.withArgs("HEAD").resolves(currentSha); callback.withArgs("HEAD").resolves(currentSha);
const actualRef = await actionsutil.getRef(); const actualRef = await actionsutil.getRef();
t.deepEqual(actualRef, expectedRef); t.deepEqual(actualRef, expectedRef);
@@ -54,7 +54,7 @@ ava_1.default("getRef() returns merge PR ref if GITHUB_REF still checked out but
process.env["GITHUB_REF"] = expectedRef; process.env["GITHUB_REF"] = expectedRef;
process.env["GITHUB_SHA"] = "b".repeat(40); process.env["GITHUB_SHA"] = "b".repeat(40);
const sha = "a".repeat(40); const sha = "a".repeat(40);
const callback = sinon_1.default.stub(actionsutil, "getCommitOid"); const callback = sinon.stub(actionsutil, "getCommitOid");
callback.withArgs("refs/remotes/pull/1/merge").resolves(sha); callback.withArgs("refs/remotes/pull/1/merge").resolves(sha);
callback.withArgs("HEAD").resolves(sha); callback.withArgs("HEAD").resolves(sha);
const actualRef = await actionsutil.getRef(); const actualRef = await actionsutil.getRef();
@@ -64,7 +64,7 @@ ava_1.default("getRef() returns merge PR ref if GITHUB_REF still checked out but
ava_1.default("getRef() returns head PR ref if GITHUB_REF no longer checked out", async (t) => { ava_1.default("getRef() returns head PR ref if GITHUB_REF no longer checked out", async (t) => {
process.env["GITHUB_REF"] = "refs/pull/1/merge"; process.env["GITHUB_REF"] = "refs/pull/1/merge";
process.env["GITHUB_SHA"] = "a".repeat(40); process.env["GITHUB_SHA"] = "a".repeat(40);
const callback = sinon_1.default.stub(actionsutil, "getCommitOid"); const callback = sinon.stub(actionsutil, "getCommitOid");
callback.withArgs("refs/pull/1/merge").resolves("a".repeat(40)); callback.withArgs("refs/pull/1/merge").resolves("a".repeat(40));
callback.withArgs("HEAD").resolves("b".repeat(40)); callback.withArgs("HEAD").resolves("b".repeat(40));
const actualRef = await actionsutil.getRef(); const actualRef = await actionsutil.getRef();

File diff suppressed because one or more lines are too long

5
lib/analyze-action.js generated
View File

@@ -64,9 +64,10 @@ async function run() {
}; };
const outputDir = actionsUtil.getRequiredInput("output"); const outputDir = actionsUtil.getRequiredInput("output");
const threads = util.getThreadsFlag(actionsUtil.getOptionalInput("threads"), logger); const threads = util.getThreadsFlag(actionsUtil.getOptionalInput("threads"), logger);
await analyze_1.runFinalize(outputDir, threads, config, logger); const memory = util.getMemoryFlag(actionsUtil.getOptionalInput("ram"));
await analyze_1.runFinalize(outputDir, threads, memory, config, logger);
if (actionsUtil.getRequiredInput("skip-queries") !== "true") { if (actionsUtil.getRequiredInput("skip-queries") !== "true") {
runStats = await analyze_1.runQueries(outputDir, util.getMemoryFlag(actionsUtil.getOptionalInput("ram")), util.getAddSnippetsFlag(actionsUtil.getRequiredInput("add-snippets")), threads, actionsUtil.getOptionalInput("category"), config, logger); runStats = await analyze_1.runQueries(outputDir, memory, util.getAddSnippetsFlag(actionsUtil.getRequiredInput("add-snippets")), threads, actionsUtil.getOptionalInput("category"), config, logger);
} }
if (actionsUtil.getOptionalInput("cleanup-level") !== "none") { if (actionsUtil.getOptionalInput("cleanup-level") !== "none") {
await analyze_1.runCleanup(config, actionsUtil.getOptionalInput("cleanup-level") || "brutal", logger); await analyze_1.runCleanup(config, actionsUtil.getOptionalInput("cleanup-level") || "brutal", logger);

View File

@@ -1 +1 @@
{"version":3,"file":"analyze-action.js","sourceRoot":"","sources":["../src/analyze-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,oDAAsC;AAEtC,4DAA8C;AAC9C,uCAMmB;AACnB,iDAAmD;AACnD,uDAAoD;AACpD,uCAA6C;AAC7C,6CAAkD;AAClD,yDAA2C;AAE3C,6CAA+B;AAE/B,8CAA8C;AAC9C,MAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAUvC,KAAK,UAAU,gBAAgB,CAC7B,SAAe,EACf,KAAuC,EACvC,KAAa;IAEb,MAAM,MAAM,GACV,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,wBAAwB,MAAK,SAAS,IAAI,KAAK,KAAK,SAAS;QAClE,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,SAAS,CAAC;IAChB,MAAM,gBAAgB,GAAG,MAAM,WAAW,CAAC,sBAAsB,CAC/D,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,EACd,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,CACb,CAAC;IACF,MAAM,YAAY,GAAuB;QACvC,GAAG,gBAAgB;QACnB,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC;KACjB,CAAC;IACF,MAAM,WAAW,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;AACnD,CAAC;AAED,KAAK,UAAU,GAAG;IAChB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,IAA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AAuB,QAAQ,MAAM,KAAK,CAAC,IAAI,EAAE,CAClD,CAAC;4BACF,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAC/C,CAAC;4BACF,IAAI,CAAC,QAAQ,EAAE,CAAC;yBACjB;6BAAM,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE;4BAC9B,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;yBAC7C;qBACF;gBACH,CAAC,CAAC;gBACF,YAAY,CAAC,aAAa,CAAC,CAAC;aAC7B;SACF;KACF;IAED,IAAI,QAAQ,IAAI,WAAW,EAAE;QAC3B,MAAM,gBAAgB,CAAC,SAAS,EAAE,EAAE,GAAG,QAAQ,EAAE,GAAG,WAAW,EAAE,CAAC,CAAC;KACpE;SAAM,IAAI,QAAQ,EAAE;QACnB,MAAM,gBAAgB,CAAC,SAAS,EAAE,EAAE,GAAG,QAAQ,EAAE,CAAC,CAAC;KACpD;SAAM;QACL,MAAM,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;KAC9C;AACH,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI;QACF,MAAM,GAAG,EAAE,CAAC;KACb;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CAAC,0BAA0B,KAAK,EAAE,CAAC,CAAC;QAClD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;KACpB;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}

32
lib/analyze.js generated
View File

@@ -67,7 +67,7 @@ async function createdDBForScannedLanguages(config, logger) {
// Insert the LGTM_INDEX_X env vars at this point so they are set when // Insert the LGTM_INDEX_X env vars at this point so they are set when
// we extract any scanned languages. // we extract any scanned languages.
analysisPaths.includeAndExcludeAnalysisPaths(config); analysisPaths.includeAndExcludeAnalysisPaths(config);
const codeql = codeql_1.getCodeQL(config.codeQLCmd); const codeql = await codeql_1.getCodeQL(config.codeQLCmd);
for (const language of config.languages) { for (const language of config.languages) {
if (languages_1.isScannedLanguage(language) && if (languages_1.isScannedLanguage(language) &&
!dbIsFinalized(config, language, logger)) { !dbIsFinalized(config, language, logger)) {
@@ -91,16 +91,16 @@ function dbIsFinalized(config, language, logger) {
return false; return false;
} }
} }
async function finalizeDatabaseCreation(config, threadsFlag, logger) { async function finalizeDatabaseCreation(config, threadsFlag, memoryFlag, logger) {
await createdDBForScannedLanguages(config, logger); await createdDBForScannedLanguages(config, logger);
const codeql = codeql_1.getCodeQL(config.codeQLCmd); const codeql = await codeql_1.getCodeQL(config.codeQLCmd);
for (const language of config.languages) { for (const language of config.languages) {
if (dbIsFinalized(config, language, logger)) { if (dbIsFinalized(config, language, logger)) {
logger.info(`There is already a finalized database for ${language} at the location where the CodeQL Action places databases, so we did not create one.`); logger.info(`There is already a finalized database for ${language} at the location where the CodeQL Action places databases, so we did not create one.`);
} }
else { else {
logger.startGroup(`Finalizing ${language}`); logger.startGroup(`Finalizing ${language}`);
await codeql.finalizeDatabase(util.getCodeQLDatabasePath(config, language), threadsFlag); await codeql.finalizeDatabase(util.getCodeQLDatabasePath(config, language), threadsFlag, memoryFlag);
logger.endGroup(); logger.endGroup();
} }
} }
@@ -130,7 +130,7 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
logger.info("And should not be used in production yet."); logger.info("And should not be used in production yet.");
logger.info("*************"); logger.info("*************");
logger.startGroup(`Downloading custom packs for ${language}`); logger.startGroup(`Downloading custom packs for ${language}`);
const codeql = codeql_1.getCodeQL(config.codeQLCmd); const codeql = await codeql_1.getCodeQL(config.codeQLCmd);
const results = await codeql.packDownload(packsWithVersion); const results = await codeql.packDownload(packsWithVersion);
logger.info(`Downloaded packs: ${results.packs logger.info(`Downloaded packs: ${results.packs
.map((r) => `${r.name}@${r.version || "latest"}`) .map((r) => `${r.name}@${r.version || "latest"}`)
@@ -183,7 +183,7 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
return statusReport; return statusReport;
async function runInterpretResults(language, queries, sarifFile) { async function runInterpretResults(language, queries, sarifFile) {
const databasePath = util.getCodeQLDatabasePath(config, language); const databasePath = util.getCodeQLDatabasePath(config, language);
const codeql = codeql_1.getCodeQL(config.codeQLCmd); const codeql = await codeql_1.getCodeQL(config.codeQLCmd);
return await codeql.databaseInterpretResults(databasePath, queries, sarifFile, addSnippetsFlag, threadsFlag, automationDetailsId); return await codeql.databaseInterpretResults(databasePath, queries, sarifFile, addSnippetsFlag, threadsFlag, automationDetailsId);
} }
async function runQueryGroup(language, type, querySuiteContents, searchPath) { async function runQueryGroup(language, type, querySuiteContents, searchPath) {
@@ -193,7 +193,7 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
const querySuitePath = `${databasePath}-queries-${type}.qls`; const querySuitePath = `${databasePath}-queries-${type}.qls`;
fs.writeFileSync(querySuitePath, querySuiteContents); fs.writeFileSync(querySuitePath, querySuiteContents);
logger.debug(`Query suite file for ${language}-${type}...\n${querySuiteContents}`); logger.debug(`Query suite file for ${language}-${type}...\n${querySuiteContents}`);
const codeql = codeql_1.getCodeQL(config.codeQLCmd); const codeql = await codeql_1.getCodeQL(config.codeQLCmd);
await codeql.databaseRunQueries(databasePath, searchPath, querySuitePath, memoryFlag, threadsFlag); await codeql.databaseRunQueries(databasePath, searchPath, querySuitePath, memoryFlag, threadsFlag);
logger.debug(`BQRS results produced for ${language} (queries: ${type})"`); logger.debug(`BQRS results produced for ${language} (queries: ${type})"`);
return querySuitePath; return querySuitePath;
@@ -213,17 +213,17 @@ function packWithVersionToQuerySuiteEntry(pack) {
} }
return text; return text;
} }
async function runFinalize(outputDir, threadsFlag, config, logger) { async function runFinalize(outputDir, threadsFlag, memoryFlag, config, logger) {
// Delete the tracer config env var to avoid tracing ourselves // Delete the tracer config env var to avoid tracing ourselves
delete process.env[sharedEnv.ODASA_TRACER_CONFIGURATION]; delete process.env[sharedEnv.ODASA_TRACER_CONFIGURATION];
fs.mkdirSync(outputDir, { recursive: true }); fs.mkdirSync(outputDir, { recursive: true });
await finalizeDatabaseCreation(config, threadsFlag, logger); await finalizeDatabaseCreation(config, threadsFlag, memoryFlag, logger);
} }
exports.runFinalize = runFinalize; exports.runFinalize = runFinalize;
async function runCleanup(config, cleanupLevel, logger) { async function runCleanup(config, cleanupLevel, logger) {
logger.startGroup("Cleaning up databases"); logger.startGroup("Cleaning up databases");
for (const language of config.languages) { for (const language of config.languages) {
const codeql = codeql_1.getCodeQL(config.codeQLCmd); const codeql = await codeql_1.getCodeQL(config.codeQLCmd);
const databasePath = util.getCodeQLDatabasePath(config, language); const databasePath = util.getCodeQLDatabasePath(config, language);
await codeql.databaseCleanup(databasePath, cleanupLevel); await codeql.databaseCleanup(databasePath, cleanupLevel);
} }
@@ -233,24 +233,14 @@ exports.runCleanup = runCleanup;
async function injectLinesOfCode(sarifFile, language, locPromise) { async function injectLinesOfCode(sarifFile, language, locPromise) {
var _a; var _a;
const lineCounts = await locPromise; const lineCounts = await locPromise;
const idPrefix = count_loc_1.getIdPrefix(language);
if (language in lineCounts) { if (language in lineCounts) {
const sarif = JSON.parse(fs.readFileSync(sarifFile, "utf8")); const sarif = JSON.parse(fs.readFileSync(sarifFile, "utf8"));
if (Array.isArray(sarif.runs)) { if (Array.isArray(sarif.runs)) {
for (const run of sarif.runs) { for (const run of sarif.runs) {
// Old style: Baseline is inserted when rule ID has suffix /summary/lines-of-code
const ruleId = `${idPrefix}/summary/lines-of-code`;
run.properties = run.properties || {}; run.properties = run.properties || {};
run.properties.metricResults = run.properties.metricResults || []; run.properties.metricResults = run.properties.metricResults || [];
const rule = run.properties.metricResults.find(
// the rule id can be in either of two places
(r) => { var _a; return r.ruleId === ruleId || ((_a = r.rule) === null || _a === void 0 ? void 0 : _a.id) === ruleId; });
// only add the baseline value if the rule already exists
if (rule) {
rule.baseline = lineCounts[language];
}
// New style: Baseline is inserted when matching rule has tag lines-of-code
for (const metric of run.properties.metricResults) { for (const metric of run.properties.metricResults) {
// Baseline is inserted when matching rule has tag lines-of-code
if (metric.rule && metric.rule.toolComponent) { if (metric.rule && metric.rule.toolComponent) {
const matchingRule = run.tool.extensions[metric.rule.toolComponent.index].rules[metric.rule.index]; const matchingRule = run.tool.extensions[metric.rule.toolComponent.index].rules[metric.rule.index];
if ((_a = matchingRule.properties.tags) === null || _a === void 0 ? void 0 : _a.includes("lines-of-code")) { if ((_a = matchingRule.properties.tags) === null || _a === void 0 ? void 0 : _a.includes("lines-of-code")) {

File diff suppressed because one or more lines are too long

54
lib/analyze.test.js generated
View File

@@ -27,10 +27,9 @@ const path = __importStar(require("path"));
const ava_1 = __importDefault(require("ava")); const ava_1 = __importDefault(require("ava"));
const yaml = __importStar(require("js-yaml")); const yaml = __importStar(require("js-yaml"));
const semver_1 = require("semver"); const semver_1 = require("semver");
const sinon_1 = __importDefault(require("sinon")); const sinon = __importStar(require("sinon"));
const analyze_1 = require("./analyze"); const analyze_1 = require("./analyze");
const codeql_1 = require("./codeql"); const codeql_1 = require("./codeql");
const count_loc_1 = require("./count-loc");
const count = __importStar(require("./count-loc")); const count = __importStar(require("./count-loc"));
const languages_1 = require("./languages"); const languages_1 = require("./languages");
const logging_1 = require("./logging"); const logging_1 = require("./logging");
@@ -46,7 +45,7 @@ ava_1.default("status report fields and search path setting", async (t) => {
obj[lang] = i + 1; obj[lang] = i + 1;
return obj; return obj;
}, {}); }, {});
sinon_1.default.stub(count, "countLoc").resolves(mockLinesOfCode); sinon.stub(count, "countLoc").resolves(mockLinesOfCode);
let searchPathsUsed = []; let searchPathsUsed = [];
return await util.withTmpDir(async (tmpDir) => { return await util.withTmpDir(async (tmpDir) => {
testing_utils_1.setupActionsVars(tmpDir, tmpDir); testing_utils_1.setupActionsVars(tmpDir, tmpDir);
@@ -76,31 +75,7 @@ ava_1.default("status report fields and search path setting", async (t) => {
databaseInterpretResults: async (_db, _queriesRun, sarifFile) => { databaseInterpretResults: async (_db, _queriesRun, sarifFile) => {
fs.writeFileSync(sarifFile, JSON.stringify({ fs.writeFileSync(sarifFile, JSON.stringify({
runs: [ runs: [
// variant 1 uses ruleId // references a rule with the lines-of-code tag, so baseline should be injected
{
properties: {
metricResults: [
{
ruleId: `${count_loc_1.getIdPrefix(language)}/summary/lines-of-code`,
value: 123,
},
],
},
},
// variant 2 uses rule.id
{
properties: {
metricResults: [
{
rule: {
id: `${count_loc_1.getIdPrefix(language)}/summary/lines-of-code`,
},
value: 123,
},
],
},
},
// variant 3 references a rule with the lines-of-code tag
{ {
tool: { tool: {
extensions: [ extensions: [
@@ -199,29 +174,12 @@ ava_1.default("status report fields and search path setting", async (t) => {
function verifyLineCounts(tmpDir) { function verifyLineCounts(tmpDir) {
// eslint-disable-next-line github/array-foreach // eslint-disable-next-line github/array-foreach
Object.keys(languages_1.Language).forEach((lang, i) => { Object.keys(languages_1.Language).forEach((lang, i) => {
verifyLineCountForFile(lang, path.join(tmpDir, `${lang}.sarif`), i + 1); verifyLineCountForFile(path.join(tmpDir, `${lang}.sarif`), i + 1);
}); });
} }
function verifyLineCountForFile(lang, filePath, lineCount) { function verifyLineCountForFile(filePath, lineCount) {
const idPrefix = count_loc_1.getIdPrefix(lang);
const sarif = JSON.parse(fs.readFileSync(filePath, "utf8")); const sarif = JSON.parse(fs.readFileSync(filePath, "utf8"));
t.deepEqual(sarif.runs[0].properties.metricResults, [ t.deepEqual(sarif.runs[0].properties.metricResults, [
{
ruleId: `${idPrefix}/summary/lines-of-code`,
value: 123,
baseline: lineCount,
},
]);
t.deepEqual(sarif.runs[1].properties.metricResults, [
{
rule: {
id: `${idPrefix}/summary/lines-of-code`,
},
value: 123,
baseline: lineCount,
},
]);
t.deepEqual(sarif.runs[2].properties.metricResults, [
{ {
rule: { rule: {
index: 0, index: 0,
@@ -234,7 +192,7 @@ ava_1.default("status report fields and search path setting", async (t) => {
}, },
]); ]);
// when the rule doesn't exist, it should not be added // when the rule doesn't exist, it should not be added
t.deepEqual(sarif.runs[3].properties.metricResults, []); t.deepEqual(sarif.runs[1].properties.metricResults, []);
} }
function verifyQuerySuites(tmpDir) { function verifyQuerySuites(tmpDir) {
const qlsContent = [ const qlsContent = [

File diff suppressed because one or more lines are too long

View File

@@ -24,7 +24,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const githubUtils = __importStar(require("@actions/github/lib/utils")); const githubUtils = __importStar(require("@actions/github/lib/utils"));
const ava_1 = __importDefault(require("ava")); const ava_1 = __importDefault(require("ava"));
const sinon_1 = __importDefault(require("sinon")); const sinon = __importStar(require("sinon"));
const api_client_1 = require("./api-client"); const api_client_1 = require("./api-client");
const testing_utils_1 = require("./testing-utils"); const testing_utils_1 = require("./testing-utils");
const util_1 = require("./util"); const util_1 = require("./util");
@@ -34,8 +34,8 @@ testing_utils_1.setupTests(ava_1.default);
let pluginStub; let pluginStub;
let githubStub; let githubStub;
ava_1.default.beforeEach(() => { ava_1.default.beforeEach(() => {
pluginStub = sinon_1.default.stub(githubUtils.GitHub, "plugin"); pluginStub = sinon.stub(githubUtils.GitHub, "plugin");
githubStub = sinon_1.default.stub(); githubStub = sinon.stub();
pluginStub.returns(githubStub); pluginStub.returns(githubStub);
util_1.initializeEnvironment(util_1.Mode.actions, pkg.version); util_1.initializeEnvironment(util_1.Mode.actions, pkg.version);
}); });

View File

@@ -1 +1 @@
{"version":3,"file":"api-client.test.js","sourceRoot":"","sources":["../src/api-client.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uEAAyD;AACzD,8CAA6C;AAC7C,kDAA0B;AAE1B,6CAA4C;AAC5C,mDAA6C;AAC7C,iCAAqD;AAErD,8CAA8C;AAC9C,MAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE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AAG,CAAC,OAAO,EAAE;KAC1C,CACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,aAAI,CAAC,oCAAoC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IACrD,MAAM,CACJ,CAAC,EACD;QACE,IAAI,EAAE,KAAK;QACX,GAAG,EAAE,qCAAqC;KAC3C,EACD,SAAS,EACT;QACE,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,wBAAwB;QACjC,SAAS,EAAE,iBAAiB,GAAG,CAAC,OAAO,EAAE;KAC1C,CACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,SAAS,MAAM,CACb,CAA4B,EAC5B,UAAe,EACf,aAAkB,EAClB,QAAa;IAEb,yBAAY,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IAExC,MAAM,aAAa,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACzC,iEAAiE;IACjE,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAC5B,CAAC,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACzC,CAAC"}

2
lib/autobuild.js generated
View File

@@ -25,7 +25,7 @@ function determineAutobuildLanguage(config, logger) {
exports.determineAutobuildLanguage = determineAutobuildLanguage; exports.determineAutobuildLanguage = determineAutobuildLanguage;
async function runAutobuild(language, config, logger) { async function runAutobuild(language, config, logger) {
logger.startGroup(`Attempting to automatically build ${language} code`); logger.startGroup(`Attempting to automatically build ${language} code`);
const codeQL = codeql_1.getCodeQL(config.codeQLCmd); const codeQL = await codeql_1.getCodeQL(config.codeQLCmd);
await codeQL.runAutobuild(language); await codeQL.runAutobuild(language);
logger.endGroup(); logger.endGroup();
} }

View File

@@ -1 +1 @@
{"version":3,"file":"autobuild.js","sourceRoot":"","sources":["../src/autobuild.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AAErC,2CAAyD;AAGzD,SAAgB,0BAA0B,CACxC,MAA2B,EAC3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IACrE,MAAM,QAAQ,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAEvC,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,CAAC,IAAI,CACT,iEAAiE,CAClE,CAAC;QACF,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,CAAC,KAAK,CAAC,sCAAsC,QAAQ,EAAE,CAAC,CAAC;IAE/D,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE;QACjC,MAAM,CAAC,OAAO,CACZ,oCAAoC,QAAQ,8BAA8B,kBAAkB;aACzF,KAAK,CAAC,CAAC,CAAC;aACR,IAAI,CAAC,OAAO,CAAC,uDAAuD,CACxE,CAAC;KACH;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AA7BD,gEA6BC;AAEM,KAAK,UAAU,YAAY,CAChC,QAAkB,EAClB,MAA2B,EAC3B,MAAc;IAEd,MAAM,CAAC,UAAU,CAAC,qCAAqC,QAAQ,OAAO,CAAC,CAAC;IACxE,MAAM,MAAM,GAAG,MAAM,kBAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACjD,MAAM,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IACpC,MAAM,CAAC,QAAQ,EAAE,CAAC;AACpB,CAAC;AATD,oCASC"}

64
lib/codeql.js generated
View File

@@ -51,6 +51,25 @@ exports.CommandInvocationError = CommandInvocationError;
let cachedCodeQL = undefined; let cachedCodeQL = undefined;
const CODEQL_BUNDLE_VERSION = defaults.bundleVersion; const CODEQL_BUNDLE_VERSION = defaults.bundleVersion;
const CODEQL_DEFAULT_ACTION_REPOSITORY = "github/codeql-action"; const CODEQL_DEFAULT_ACTION_REPOSITORY = "github/codeql-action";
/**
* The oldest version of CodeQL that the Action will run with. This should be
* at least three minor versions behind the current version. The version flags
* below can be used to conditionally enable certain features on versions newer
* than this. Please record the reason we cannot support an older version.
*
* Reason: Changes to how the tracing environment is set up.
*/
const CODEQL_MINIMUM_VERSION = "2.3.1";
/**
* Versions of CodeQL that version-flag certain functionality in the Action.
* For convenience, please keep these in descending order. Once a version
* flag is older than the oldest supported version above, it may be removed.
*/
const CODEQL_VERSION_RAM_FINALIZE = "2.5.8";
const CODEQL_VERSION_DIAGNOSTICS = "2.5.6";
const CODEQL_VERSION_METRICS = "2.5.5";
const CODEQL_VERSION_GROUP_RULES = "2.5.5";
const CODEQL_VERSION_SARIF_GROUP = "2.5.3";
function getCodeQLBundleName() { function getCodeQLBundleName() {
let platform; let platform;
if (process.platform === "win32") { if (process.platform === "win32") {
@@ -159,7 +178,7 @@ async function getCodeQLBundleDownloadURL(apiDetails, variant, logger) {
} }
return `https://github.com/${CODEQL_DEFAULT_ACTION_REPOSITORY}/releases/download/${CODEQL_BUNDLE_VERSION}/${codeQLBundleName}`; return `https://github.com/${CODEQL_DEFAULT_ACTION_REPOSITORY}/releases/download/${CODEQL_BUNDLE_VERSION}/${codeQLBundleName}`;
} }
async function setupCodeQL(codeqlURL, apiDetails, tempDir, toolCacheDir, variant, logger) { async function setupCodeQL(codeqlURL, apiDetails, tempDir, toolCacheDir, variant, logger, checkVersion) {
try { try {
// We use the special value of 'latest' to prioritize the version in the // We use the special value of 'latest' to prioritize the version in the
// defaults over any pinned cached version. // defaults over any pinned cached version.
@@ -227,7 +246,7 @@ async function setupCodeQL(codeqlURL, apiDetails, tempDir, toolCacheDir, variant
else if (process.platform !== "linux" && process.platform !== "darwin") { else if (process.platform !== "linux" && process.platform !== "darwin") {
throw new Error(`Unsupported platform: ${process.platform}`); throw new Error(`Unsupported platform: ${process.platform}`);
} }
cachedCodeQL = getCodeQLForCmd(codeqlCmd); cachedCodeQL = await getCodeQLForCmd(codeqlCmd, checkVersion);
return { codeql: cachedCodeQL, toolsVersion: codeqlURLVersion }; return { codeql: cachedCodeQL, toolsVersion: codeqlURLVersion };
} }
catch (e) { catch (e) {
@@ -259,9 +278,9 @@ exports.convertToSemVer = convertToSemVer;
/** /**
* Use the CodeQL executable located at the given path. * Use the CodeQL executable located at the given path.
*/ */
function getCodeQL(cmd) { async function getCodeQL(cmd) {
if (cachedCodeQL === undefined) { if (cachedCodeQL === undefined) {
cachedCodeQL = getCodeQLForCmd(cmd); cachedCodeQL = await getCodeQLForCmd(cmd, true);
} }
return cachedCodeQL; return cachedCodeQL;
} }
@@ -287,6 +306,7 @@ function resolveFunction(partialCodeql, methodName, defaultImplementation) {
function setCodeQL(partialCodeql) { function setCodeQL(partialCodeql) {
cachedCodeQL = { cachedCodeQL = {
getPath: resolveFunction(partialCodeql, "getPath", () => "/tmp/dummy-path"), getPath: resolveFunction(partialCodeql, "getPath", () => "/tmp/dummy-path"),
getVersion: resolveFunction(partialCodeql, "getVersion", () => new Promise((resolve) => resolve("1.0.0"))),
printVersion: resolveFunction(partialCodeql, "printVersion"), printVersion: resolveFunction(partialCodeql, "printVersion"),
getTracerEnv: resolveFunction(partialCodeql, "getTracerEnv"), getTracerEnv: resolveFunction(partialCodeql, "getTracerEnv"),
databaseInit: resolveFunction(partialCodeql, "databaseInit"), databaseInit: resolveFunction(partialCodeql, "databaseInit"),
@@ -318,11 +338,17 @@ function getCachedCodeQL() {
return cachedCodeQL; return cachedCodeQL;
} }
exports.getCachedCodeQL = getCachedCodeQL; exports.getCachedCodeQL = getCachedCodeQL;
function getCodeQLForCmd(cmd) { async function getCodeQLForCmd(cmd, checkVersion) {
return { let cachedVersion = undefined;
const codeql = {
getPath() { getPath() {
return cmd; return cmd;
}, },
async getVersion() {
if (cachedVersion === undefined)
cachedVersion = runTool(cmd, ["version", "--format=terse"]);
return await cachedVersion;
},
async printVersion() { async printVersion() {
await runTool(cmd, ["version", "--format=json"]); await runTool(cmd, ["version", "--format=json"]);
}, },
@@ -425,15 +451,18 @@ function getCodeQLForCmd(cmd) {
traceCommand, traceCommand,
], error_matcher_1.errorMatchers); ], error_matcher_1.errorMatchers);
}, },
async finalizeDatabase(databasePath, threadsFlag) { async finalizeDatabase(databasePath, threadsFlag, memoryFlag) {
await toolrunner_error_catcher_1.toolrunnerErrorCatcher(cmd, [ const args = [
"database", "database",
"finalize", "finalize",
"--finalize-dataset", "--finalize-dataset",
threadsFlag, threadsFlag,
...getExtraOptionsFromEnv(["database", "finalize"]), ...getExtraOptionsFromEnv(["database", "finalize"]),
databasePath, databasePath,
], error_matcher_1.errorMatchers); ];
if (await util.codeQlVersionAbove(this, CODEQL_VERSION_RAM_FINALIZE))
args.push(memoryFlag);
await toolrunner_error_catcher_1.toolrunnerErrorCatcher(cmd, args, error_matcher_1.errorMatchers);
}, },
async resolveLanguages() { async resolveLanguages() {
const codeqlArgs = ["resolve", "languages", "--format=json"]; const codeqlArgs = ["resolve", "languages", "--format=json"];
@@ -487,15 +516,19 @@ function getCodeQLForCmd(cmd) {
"interpret-results", "interpret-results",
threadsFlag, threadsFlag,
"--format=sarif-latest", "--format=sarif-latest",
"--print-diagnostics-summary",
"--print-metrics-summary",
"--sarif-group-rules-by-pack",
"-v", "-v",
`--output=${sarifFile}`, `--output=${sarifFile}`,
addSnippetsFlag, addSnippetsFlag,
...getExtraOptionsFromEnv(["database", "interpret-results"]), ...getExtraOptionsFromEnv(["database", "interpret-results"]),
]; ];
if (automationDetailsId !== undefined) { if (await util.codeQlVersionAbove(this, CODEQL_VERSION_DIAGNOSTICS))
codeqlArgs.push("--print-diagnostics-summary");
if (await util.codeQlVersionAbove(this, CODEQL_VERSION_METRICS))
codeqlArgs.push("--print-metrics-summary");
if (await util.codeQlVersionAbove(this, CODEQL_VERSION_GROUP_RULES))
codeqlArgs.push("--sarif-group-rules-by-pack");
if (automationDetailsId !== undefined &&
(await util.codeQlVersionAbove(this, CODEQL_VERSION_SARIF_GROUP))) {
codeqlArgs.push("--sarif-category", automationDetailsId); codeqlArgs.push("--sarif-category", automationDetailsId);
} }
codeqlArgs.push(databasePath, ...querySuitePaths); codeqlArgs.push(databasePath, ...querySuitePaths);
@@ -557,6 +590,11 @@ function getCodeQLForCmd(cmd) {
await new toolrunner.ToolRunner(cmd, args).exec(); await new toolrunner.ToolRunner(cmd, args).exec();
}, },
}; };
if (checkVersion &&
!(await util.codeQlVersionAbove(codeql, CODEQL_MINIMUM_VERSION))) {
throw new Error(`Expected a CodeQL CLI with version at least ${CODEQL_MINIMUM_VERSION} but got version ${await codeql.getVersion()}`);
}
return codeql;
} }
function packWithVersionToString(pack) { function packWithVersionToString(pack) {
return pack.version ? `${pack.packName}@${pack.version}` : pack.packName; return pack.version ? `${pack.packName}@${pack.version}` : pack.packName;

File diff suppressed because one or more lines are too long

20
lib/codeql.test.js generated
View File

@@ -53,7 +53,7 @@ ava_1.default("download codeql bundle cache", async (t) => {
nock_1.default("https://example.com") nock_1.default("https://example.com")
.get(`/download/codeql-bundle-${version}/codeql-bundle.tar.gz`) .get(`/download/codeql-bundle-${version}/codeql-bundle.tar.gz`)
.replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle.tar.gz`)); .replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle.tar.gz`));
await codeql.setupCodeQL(`https://example.com/download/codeql-bundle-${version}/codeql-bundle.tar.gz`, sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true)); await codeql.setupCodeQL(`https://example.com/download/codeql-bundle-${version}/codeql-bundle.tar.gz`, sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true), false);
t.assert(toolcache.find("CodeQL", `0.0.0-${version}`)); t.assert(toolcache.find("CodeQL", `0.0.0-${version}`));
} }
const cachedVersions = toolcache.findAllVersions("CodeQL"); const cachedVersions = toolcache.findAllVersions("CodeQL");
@@ -66,12 +66,12 @@ ava_1.default("download codeql bundle cache explicitly requested with pinned dif
nock_1.default("https://example.com") nock_1.default("https://example.com")
.get(`/download/codeql-bundle-20200601/codeql-bundle.tar.gz`) .get(`/download/codeql-bundle-20200601/codeql-bundle.tar.gz`)
.replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle-pinned.tar.gz`)); .replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle-pinned.tar.gz`));
await codeql.setupCodeQL("https://example.com/download/codeql-bundle-20200601/codeql-bundle.tar.gz", sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true)); await codeql.setupCodeQL("https://example.com/download/codeql-bundle-20200601/codeql-bundle.tar.gz", sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true), false);
t.assert(toolcache.find("CodeQL", "0.0.0-20200601")); t.assert(toolcache.find("CodeQL", "0.0.0-20200601"));
nock_1.default("https://example.com") nock_1.default("https://example.com")
.get(`/download/codeql-bundle-20200610/codeql-bundle.tar.gz`) .get(`/download/codeql-bundle-20200610/codeql-bundle.tar.gz`)
.replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle.tar.gz`)); .replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle.tar.gz`));
await codeql.setupCodeQL("https://example.com/download/codeql-bundle-20200610/codeql-bundle.tar.gz", sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true)); await codeql.setupCodeQL("https://example.com/download/codeql-bundle-20200610/codeql-bundle.tar.gz", sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true), false);
t.assert(toolcache.find("CodeQL", "0.0.0-20200610")); t.assert(toolcache.find("CodeQL", "0.0.0-20200610"));
}); });
}); });
@@ -81,9 +81,9 @@ ava_1.default("don't download codeql bundle cache with pinned different version
nock_1.default("https://example.com") nock_1.default("https://example.com")
.get(`/download/codeql-bundle-20200601/codeql-bundle.tar.gz`) .get(`/download/codeql-bundle-20200601/codeql-bundle.tar.gz`)
.replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle-pinned.tar.gz`)); .replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle-pinned.tar.gz`));
await codeql.setupCodeQL("https://example.com/download/codeql-bundle-20200601/codeql-bundle.tar.gz", sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true)); await codeql.setupCodeQL("https://example.com/download/codeql-bundle-20200601/codeql-bundle.tar.gz", sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true), false);
t.assert(toolcache.find("CodeQL", "0.0.0-20200601")); t.assert(toolcache.find("CodeQL", "0.0.0-20200601"));
await codeql.setupCodeQL(undefined, sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true)); await codeql.setupCodeQL(undefined, sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true), false);
const cachedVersions = toolcache.findAllVersions("CodeQL"); const cachedVersions = toolcache.findAllVersions("CodeQL");
t.is(cachedVersions.length, 1); t.is(cachedVersions.length, 1);
}); });
@@ -94,7 +94,7 @@ ava_1.default("download codeql bundle cache with different version cached (not p
nock_1.default("https://example.com") nock_1.default("https://example.com")
.get(`/download/codeql-bundle-20200601/codeql-bundle.tar.gz`) .get(`/download/codeql-bundle-20200601/codeql-bundle.tar.gz`)
.replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle.tar.gz`)); .replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle.tar.gz`));
await codeql.setupCodeQL("https://example.com/download/codeql-bundle-20200601/codeql-bundle.tar.gz", sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true)); await codeql.setupCodeQL("https://example.com/download/codeql-bundle-20200601/codeql-bundle.tar.gz", sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true), false);
t.assert(toolcache.find("CodeQL", "0.0.0-20200601")); t.assert(toolcache.find("CodeQL", "0.0.0-20200601"));
const platform = process.platform === "win32" const platform = process.platform === "win32"
? "win64" ? "win64"
@@ -104,7 +104,7 @@ ava_1.default("download codeql bundle cache with different version cached (not p
nock_1.default("https://github.com") nock_1.default("https://github.com")
.get(`/github/codeql-action/releases/download/${defaults.bundleVersion}/codeql-bundle-${platform}.tar.gz`) .get(`/github/codeql-action/releases/download/${defaults.bundleVersion}/codeql-bundle-${platform}.tar.gz`)
.replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle.tar.gz`)); .replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle.tar.gz`));
await codeql.setupCodeQL(undefined, sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true)); await codeql.setupCodeQL(undefined, sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true), false);
const cachedVersions = toolcache.findAllVersions("CodeQL"); const cachedVersions = toolcache.findAllVersions("CodeQL");
t.is(cachedVersions.length, 2); t.is(cachedVersions.length, 2);
}); });
@@ -115,7 +115,7 @@ ava_1.default('download codeql bundle cache with pinned different version cached
nock_1.default("https://example.com") nock_1.default("https://example.com")
.get(`/download/codeql-bundle-20200601/codeql-bundle.tar.gz`) .get(`/download/codeql-bundle-20200601/codeql-bundle.tar.gz`)
.replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle-pinned.tar.gz`)); .replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle-pinned.tar.gz`));
await codeql.setupCodeQL("https://example.com/download/codeql-bundle-20200601/codeql-bundle.tar.gz", sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true)); await codeql.setupCodeQL("https://example.com/download/codeql-bundle-20200601/codeql-bundle.tar.gz", sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true), false);
t.assert(toolcache.find("CodeQL", "0.0.0-20200601")); t.assert(toolcache.find("CodeQL", "0.0.0-20200601"));
const platform = process.platform === "win32" const platform = process.platform === "win32"
? "win64" ? "win64"
@@ -125,7 +125,7 @@ ava_1.default('download codeql bundle cache with pinned different version cached
nock_1.default("https://github.com") nock_1.default("https://github.com")
.get(`/github/codeql-action/releases/download/${defaults.bundleVersion}/codeql-bundle-${platform}.tar.gz`) .get(`/github/codeql-action/releases/download/${defaults.bundleVersion}/codeql-bundle-${platform}.tar.gz`)
.replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle.tar.gz`)); .replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle.tar.gz`));
await codeql.setupCodeQL("latest", sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true)); await codeql.setupCodeQL("latest", sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true), false);
const cachedVersions = toolcache.findAllVersions("CodeQL"); const cachedVersions = toolcache.findAllVersions("CodeQL");
t.is(cachedVersions.length, 2); t.is(cachedVersions.length, 2);
}); });
@@ -153,7 +153,7 @@ ava_1.default("download codeql bundle from github ae endpoint", async (t) => {
nock_1.default("https://example.githubenterprise.com") nock_1.default("https://example.githubenterprise.com")
.get(`/github/codeql-action/releases/download/${defaults.bundleVersion}/${codeQLBundleName}`) .get(`/github/codeql-action/releases/download/${defaults.bundleVersion}/${codeQLBundleName}`)
.replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle-pinned.tar.gz`)); .replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle-pinned.tar.gz`));
await codeql.setupCodeQL(undefined, sampleGHAEApiDetails, tmpDir, tmpDir, util.GitHubVariant.GHAE, logging_1.getRunnerLogger(true)); await codeql.setupCodeQL(undefined, sampleGHAEApiDetails, tmpDir, tmpDir, util.GitHubVariant.GHAE, logging_1.getRunnerLogger(true), false);
const cachedVersions = toolcache.findAllVersions("CodeQL"); const cachedVersions = toolcache.findAllVersions("CodeQL");
t.is(cachedVersions.length, 1); t.is(cachedVersions.length, 1);
}); });

File diff suppressed because one or more lines are too long

View File

@@ -27,7 +27,7 @@ const path = __importStar(require("path"));
const github = __importStar(require("@actions/github")); const github = __importStar(require("@actions/github"));
const ava_1 = __importDefault(require("ava")); const ava_1 = __importDefault(require("ava"));
const semver_1 = require("semver"); const semver_1 = require("semver");
const sinon_1 = __importDefault(require("sinon")); const sinon = __importStar(require("sinon"));
const api = __importStar(require("./api-client")); const api = __importStar(require("./api-client"));
const codeql_1 = require("./codeql"); const codeql_1 = require("./codeql");
const configUtils = __importStar(require("./config-utils")); const configUtils = __importStar(require("./config-utils"));
@@ -54,10 +54,10 @@ function mockGetContents(content) {
const response = { const response = {
data: content, data: content,
}; };
const spyGetContents = sinon_1.default const spyGetContents = sinon
.stub(client.repos, "getContent") .stub(client.repos, "getContent")
.resolves(response); .resolves(response);
sinon_1.default.stub(api, "getApiClient").value(() => client); sinon.stub(api, "getApiClient").value(() => client);
return spyGetContents; return spyGetContents;
} }
function mockListLanguages(languages) { function mockListLanguages(languages) {
@@ -69,8 +69,8 @@ function mockListLanguages(languages) {
for (const language of languages) { for (const language of languages) {
response.data[language] = 123; response.data[language] = 123;
} }
sinon_1.default.stub(client.repos, "listLanguages").resolves(response); sinon.stub(client.repos, "listLanguages").resolves(response);
sinon_1.default.stub(api, "getApiClient").value(() => client); sinon.stub(api, "getApiClient").value(() => client);
} }
ava_1.default("load empty config", async (t) => { ava_1.default("load empty config", async (t) => {
return await util.withTmpDir(async (tmpDir) => { return await util.withTmpDir(async (tmpDir) => {

File diff suppressed because one or more lines are too long

24
lib/count-loc.js generated
View File

@@ -1,9 +1,8 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.countLoc = exports.getIdPrefix = void 0; exports.countLoc = void 0;
const github_linguist_1 = require("github-linguist"); const github_linguist_1 = require("github-linguist");
const languages_1 = require("./languages"); const languages_1 = require("./languages");
const util_1 = require("./util");
// Map from linguist language names to language prefixes used in the action and codeql // Map from linguist language names to language prefixes used in the action and codeql
const linguistToMetrics = { const linguistToMetrics = {
c: languages_1.Language.cpp, c: languages_1.Language.cpp,
@@ -23,27 +22,6 @@ const nameToLinguist = Object.entries(linguistToMetrics).reduce((obj, [key, name
obj[name].push(key); obj[name].push(key);
return obj; return obj;
}, {}); }, {});
function getIdPrefix(language) {
switch (language) {
case languages_1.Language.cpp:
return "cpp";
case languages_1.Language.csharp:
return "cs";
case languages_1.Language.go:
return "go";
case languages_1.Language.java:
return "java";
case languages_1.Language.javascript:
return "js";
case languages_1.Language.python:
return "py";
case languages_1.Language.ruby:
return "rb";
default:
util_1.assertNever(language);
}
}
exports.getIdPrefix = getIdPrefix;
/** /**
* Count the lines of code of the specified language using the include * Count the lines of code of the specified language using the include
* and exclude glob paths. * and exclude glob paths.

View File

@@ -1 +1 @@
{"version":3,"file":"count-loc.js","sourceRoot":"","sources":["../src/count-loc.ts"],"names":[],"mappings":";;;AAAA,qDAAyC;AAEzC,2CAAuC;AAEvC,iCAAqC;AAKrC,sFAAsF;AACtF,MAAM,iBAAiB,GAA6B;IAClD,CAAC,EAAE,oBAAQ,CAAC,GAAG;IACf,KAAK,EAAE,oBAAQ,CAAC,GAAG;IACnB,IAAI,EAAE,oBAAQ,CAAC,MAAM;IACrB,EAAE,EAAE,oBAAQ,CAAC,EAAE;IACf,IAAI,EAAE,oBAAQ,CAAC,IAAI;IACnB,UAAU,EAAE,oBAAQ,CAAC,UAAU;IAC/B,MAAM,EAAE,oBAAQ,CAAC,MAAM;IACvB,IAAI,EAAE,oBAAQ,CAAC,IAAI;IACnB,UAAU,EAAE,oBAAQ,CAAC,UAAU;CAChC,CAAC;AAEF,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAC7D,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE;IACnB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QACd,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;KA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G,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QACpD,IAAI,eAAe,IAAI,WAAW,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;YAC5D,GAAG,CAAC,eAAe,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;SAC3D;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAA8B,CAC/B,CAAC;IAEF,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE;QAClC,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QACrC,KAAK,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;YAC1D,MAAM,CAAC,KAAK,CAAC,KAAK,QAAQ,KAAK,KAAK,EAAE,CAAC,CAAC;SACzC;KACF;SAAM;QACL,MAAM,CAAC,IAAI,CACT,2EAA2E;YACzE,gEAAgE;YAChE,4EAA4E;YAC5E,4EAA4E;YAC5E,2EAA2E;YAC3E,6EAA6E;YAC7E,2CAA2C,CAC9C,CAAC;KACH;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AA9CD,4BA8CC"}

View File

@@ -57,7 +57,7 @@ async function uploadDatabases(repositoryNwo, config, apiDetails, logger) {
} }
return; return;
} }
const codeql = codeql_1.getCodeQL(config.codeQLCmd); const codeql = await codeql_1.getCodeQL(config.codeQLCmd);
for (const language of config.languages) { for (const language of config.languages) {
// Bundle the database up into a single zip file // Bundle the database up into a single zip file
const databasePath = util.getCodeQLDatabasePath(config, language); const databasePath = util.getCodeQLDatabasePath(config, language);

View File

@@ -1 +1 @@
{"version":3,"file":"database-upload.js","sourceRoot":"","sources":["../src/database-upload.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AAEzB,4DAA8C;AAC9C,6CAA8D;AAC9D,qCAAqC;AAIrC,6CAA+B;AAEx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AAI;gBACxB,QAAQ;gBACR,IAAI,EAAE,OAAO;aACd,CACF,CAAC;YACF,MAAM,CAAC,KAAK,CAAC,sCAAsC,QAAQ,EAAE,CAAC,CAAC;SAChE;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACf,4CAA4C;YAC5C,MAAM,CAAC,OAAO,CAAC,iCAAiC,QAAQ,KAAK,CAAC,EAAE,CAAC,CAAC;SACnE;KACF;AACH,CAAC;AAtED,0CAsEC"}

View File

@@ -25,7 +25,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
const fs = __importStar(require("fs")); const fs = __importStar(require("fs"));
const github = __importStar(require("@actions/github")); const github = __importStar(require("@actions/github"));
const ava_1 = __importDefault(require("ava")); const ava_1 = __importDefault(require("ava"));
const sinon_1 = __importDefault(require("sinon")); const sinon = __importStar(require("sinon"));
const actionsUtil = __importStar(require("./actions-util")); const actionsUtil = __importStar(require("./actions-util"));
const apiClient = __importStar(require("./api-client")); const apiClient = __importStar(require("./api-client"));
const codeql_1 = require("./codeql"); const codeql_1 = require("./codeql");
@@ -83,7 +83,7 @@ function getRecordingLogger(messages) {
function mockHttpRequests(optInStatusCode, databaseUploadStatusCode) { function mockHttpRequests(optInStatusCode, databaseUploadStatusCode) {
// Passing an auth token is required, so we just use a dummy value // Passing an auth token is required, so we just use a dummy value
const client = github.getOctokit("123"); const client = github.getOctokit("123");
const requestSpy = sinon_1.default.stub(client, "request"); const requestSpy = sinon.stub(client, "request");
const optInSpy = requestSpy.withArgs("GET /repos/:owner/:repo/code-scanning/codeql/databases"); const optInSpy = requestSpy.withArgs("GET /repos/:owner/:repo/code-scanning/codeql/databases");
if (optInStatusCode < 300) { if (optInStatusCode < 300) {
optInSpy.resolves(undefined); optInSpy.resolves(undefined);
@@ -100,16 +100,16 @@ function mockHttpRequests(optInStatusCode, databaseUploadStatusCode) {
databaseUploadSpy.throws(new util_1.HTTPError("some error message", databaseUploadStatusCode)); databaseUploadSpy.throws(new util_1.HTTPError("some error message", databaseUploadStatusCode));
} }
} }
sinon_1.default.stub(apiClient, "getApiClient").value(() => client); sinon.stub(apiClient, "getApiClient").value(() => client);
} }
ava_1.default("Abort database upload if 'upload-database' input set to false", async (t) => { ava_1.default("Abort database upload if 'upload-database' input set to false", async (t) => {
await util_1.withTmpDir(async (tmpDir) => { await util_1.withTmpDir(async (tmpDir) => {
testing_utils_1.setupActionsVars(tmpDir, tmpDir); testing_utils_1.setupActionsVars(tmpDir, tmpDir);
sinon_1.default sinon
.stub(actionsUtil, "getRequiredInput") .stub(actionsUtil, "getRequiredInput")
.withArgs("upload-database") .withArgs("upload-database")
.returns("false"); .returns("false");
sinon_1.default.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true); sinon.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true);
const loggedMessages = []; const loggedMessages = [];
await database_upload_1.uploadDatabases(testRepoName, getTestConfig(tmpDir), testApiDetails, getRecordingLogger(loggedMessages)); await database_upload_1.uploadDatabases(testRepoName, getTestConfig(tmpDir), testApiDetails, getRecordingLogger(loggedMessages));
t.assert(loggedMessages.find((v) => v.type === "debug" && t.assert(loggedMessages.find((v) => v.type === "debug" &&
@@ -119,11 +119,11 @@ ava_1.default("Abort database upload if 'upload-database' input set to false", a
ava_1.default("Abort database upload if running against GHES", async (t) => { ava_1.default("Abort database upload if running against GHES", async (t) => {
await util_1.withTmpDir(async (tmpDir) => { await util_1.withTmpDir(async (tmpDir) => {
testing_utils_1.setupActionsVars(tmpDir, tmpDir); testing_utils_1.setupActionsVars(tmpDir, tmpDir);
sinon_1.default sinon
.stub(actionsUtil, "getRequiredInput") .stub(actionsUtil, "getRequiredInput")
.withArgs("upload-database") .withArgs("upload-database")
.returns("true"); .returns("true");
sinon_1.default.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true); sinon.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true);
const config = getTestConfig(tmpDir); const config = getTestConfig(tmpDir);
config.gitHubVersion = { type: util_1.GitHubVariant.GHES, version: "3.0" }; config.gitHubVersion = { type: util_1.GitHubVariant.GHES, version: "3.0" };
const loggedMessages = []; const loggedMessages = [];
@@ -135,11 +135,11 @@ ava_1.default("Abort database upload if running against GHES", async (t) => {
ava_1.default("Abort database upload if running against GHAE", async (t) => { ava_1.default("Abort database upload if running against GHAE", async (t) => {
await util_1.withTmpDir(async (tmpDir) => { await util_1.withTmpDir(async (tmpDir) => {
testing_utils_1.setupActionsVars(tmpDir, tmpDir); testing_utils_1.setupActionsVars(tmpDir, tmpDir);
sinon_1.default sinon
.stub(actionsUtil, "getRequiredInput") .stub(actionsUtil, "getRequiredInput")
.withArgs("upload-database") .withArgs("upload-database")
.returns("true"); .returns("true");
sinon_1.default.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true); sinon.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true);
const config = getTestConfig(tmpDir); const config = getTestConfig(tmpDir);
config.gitHubVersion = { type: util_1.GitHubVariant.GHAE }; config.gitHubVersion = { type: util_1.GitHubVariant.GHAE };
const loggedMessages = []; const loggedMessages = [];
@@ -151,11 +151,11 @@ ava_1.default("Abort database upload if running against GHAE", async (t) => {
ava_1.default("Abort database upload if not analyzing default branch", async (t) => { ava_1.default("Abort database upload if not analyzing default branch", async (t) => {
await util_1.withTmpDir(async (tmpDir) => { await util_1.withTmpDir(async (tmpDir) => {
testing_utils_1.setupActionsVars(tmpDir, tmpDir); testing_utils_1.setupActionsVars(tmpDir, tmpDir);
sinon_1.default sinon
.stub(actionsUtil, "getRequiredInput") .stub(actionsUtil, "getRequiredInput")
.withArgs("upload-database") .withArgs("upload-database")
.returns("true"); .returns("true");
sinon_1.default.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(false); sinon.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(false);
const loggedMessages = []; const loggedMessages = [];
await database_upload_1.uploadDatabases(testRepoName, getTestConfig(tmpDir), testApiDetails, getRecordingLogger(loggedMessages)); await database_upload_1.uploadDatabases(testRepoName, getTestConfig(tmpDir), testApiDetails, getRecordingLogger(loggedMessages));
t.assert(loggedMessages.find((v) => v.type === "debug" && t.assert(loggedMessages.find((v) => v.type === "debug" &&
@@ -165,11 +165,11 @@ ava_1.default("Abort database upload if not analyzing default branch", async (t)
ava_1.default("Abort database upload if opt-in request returns 404", async (t) => { ava_1.default("Abort database upload if opt-in request returns 404", async (t) => {
await util_1.withTmpDir(async (tmpDir) => { await util_1.withTmpDir(async (tmpDir) => {
testing_utils_1.setupActionsVars(tmpDir, tmpDir); testing_utils_1.setupActionsVars(tmpDir, tmpDir);
sinon_1.default sinon
.stub(actionsUtil, "getRequiredInput") .stub(actionsUtil, "getRequiredInput")
.withArgs("upload-database") .withArgs("upload-database")
.returns("true"); .returns("true");
sinon_1.default.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true); sinon.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true);
mockHttpRequests(404); mockHttpRequests(404);
codeql_1.setCodeQL({ codeql_1.setCodeQL({
async databaseBundle() { async databaseBundle() {
@@ -186,11 +186,11 @@ ava_1.default("Abort database upload if opt-in request returns 404", async (t) =
ava_1.default("Abort database upload if opt-in request fails with something other than 404", async (t) => { ava_1.default("Abort database upload if opt-in request fails with something other than 404", async (t) => {
await util_1.withTmpDir(async (tmpDir) => { await util_1.withTmpDir(async (tmpDir) => {
testing_utils_1.setupActionsVars(tmpDir, tmpDir); testing_utils_1.setupActionsVars(tmpDir, tmpDir);
sinon_1.default sinon
.stub(actionsUtil, "getRequiredInput") .stub(actionsUtil, "getRequiredInput")
.withArgs("upload-database") .withArgs("upload-database")
.returns("true"); .returns("true");
sinon_1.default.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true); sinon.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true);
mockHttpRequests(500); mockHttpRequests(500);
codeql_1.setCodeQL({ codeql_1.setCodeQL({
async databaseBundle() { async databaseBundle() {
@@ -207,11 +207,11 @@ ava_1.default("Abort database upload if opt-in request fails with something othe
ava_1.default("Don't crash if uploading a database fails", async (t) => { ava_1.default("Don't crash if uploading a database fails", async (t) => {
await util_1.withTmpDir(async (tmpDir) => { await util_1.withTmpDir(async (tmpDir) => {
testing_utils_1.setupActionsVars(tmpDir, tmpDir); testing_utils_1.setupActionsVars(tmpDir, tmpDir);
sinon_1.default sinon
.stub(actionsUtil, "getRequiredInput") .stub(actionsUtil, "getRequiredInput")
.withArgs("upload-database") .withArgs("upload-database")
.returns("true"); .returns("true");
sinon_1.default.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true); sinon.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true);
mockHttpRequests(204, 500); mockHttpRequests(204, 500);
codeql_1.setCodeQL({ codeql_1.setCodeQL({
async databaseBundle(_, outputFilePath) { async databaseBundle(_, outputFilePath) {
@@ -228,11 +228,11 @@ ava_1.default("Don't crash if uploading a database fails", async (t) => {
ava_1.default("Successfully uploading a database", async (t) => { ava_1.default("Successfully uploading a database", async (t) => {
await util_1.withTmpDir(async (tmpDir) => { await util_1.withTmpDir(async (tmpDir) => {
testing_utils_1.setupActionsVars(tmpDir, tmpDir); testing_utils_1.setupActionsVars(tmpDir, tmpDir);
sinon_1.default sinon
.stub(actionsUtil, "getRequiredInput") .stub(actionsUtil, "getRequiredInput")
.withArgs("upload-database") .withArgs("upload-database")
.returns("true"); .returns("true");
sinon_1.default.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true); sinon.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true);
mockHttpRequests(204, 201); mockHttpRequests(204, 201);
codeql_1.setCodeQL({ codeql_1.setCodeQL({
async databaseBundle(_, outputFilePath) { async databaseBundle(_, outputFilePath) {

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +1,3 @@
{ {
"bundleVersion": "codeql-bundle-20210726" "bundleVersion": "codeql-bundle-20210824"
} }

2
lib/init.js generated
View File

@@ -31,7 +31,7 @@ const tracer_config_1 = require("./tracer-config");
const util = __importStar(require("./util")); const util = __importStar(require("./util"));
async function initCodeQL(codeqlURL, apiDetails, tempDir, toolCacheDir, variant, logger) { async function initCodeQL(codeqlURL, apiDetails, tempDir, toolCacheDir, variant, logger) {
logger.startGroup("Setup CodeQL tools"); logger.startGroup("Setup CodeQL tools");
const { codeql, toolsVersion } = await codeql_1.setupCodeQL(codeqlURL, apiDetails, tempDir, toolCacheDir, variant, logger); const { codeql, toolsVersion } = await codeql_1.setupCodeQL(codeqlURL, apiDetails, tempDir, toolCacheDir, variant, logger, true);
await codeql.printVersion(); await codeql.printVersion();
logger.endGroup(); logger.endGroup();
return { codeql, toolsVersion }; return { codeql, toolsVersion };

View File

@@ -1 +1 @@
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,yEAA2D;AAC3D,kEAAoD;AAEpD,gEAAkD;AAElD,qCAA+C;AAC/C,4DAA8C;AAG9C,mDAAwE;AACxE,6CAA+B;AAExB,KAAK,UAAU,UAAU,CAC9B,SAA6B,EAC7B,UAA4B,EAC5B,OAAe,EACf,YAAoB,EACpB,OAA2B,EAC3B,MAAc;IAEd,MAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACxC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,oBAAW,CAChD,SAAS,EACT,UAAU,EACV,OAAO,EACP,YAAY,EACZ,OAAO,EACP,MAAM,CACP,CAAC;IACF,MAAM,MAAM,CAAC,YAAY,EAAE,CAAC;IAC5B,MAAM,CAAC,QAAQ,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;AAClC,CAAC;AApBD,gCAoBC;AAEM,KAAK,UAAU,UAAU,CAC9B,cAAkC,EAClC,YAAgC,EAChC,UAA8B,EAC9B,UAA8B,EAC9B,UAA8B,EAC9B,UAAyB,E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AC,CAAC,IAAI,EAAE,CAAC;SACX;KACF;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,CAAC,QAAQ,EAAE,CAAC;QAClB,MAAM,CAAC,OAAO,CACZ,gFAAgF,CAAC,IAAI;YACnF,qGAAqG;YACrG,oGAAoG;YACpG,iDAAiD,CACpD,CAAC;QACF,OAAO;KACR;IACD,MAAM,CAAC,QAAQ,EAAE,CAAC;AACpB,CAAC;AAtCD,8CAsCC"}

7
lib/runner.js generated
View File

@@ -136,7 +136,7 @@ program
util_1.checkGitHubVersionInRange(gitHubVersion, logger, util_1.Mode.runner); util_1.checkGitHubVersionInRange(gitHubVersion, logger, util_1.Mode.runner);
let codeql; let codeql;
if (cmd.codeqlPath !== undefined) { if (cmd.codeqlPath !== undefined) {
codeql = codeql_1.getCodeQL(cmd.codeqlPath); codeql = await codeql_1.getCodeQL(cmd.codeqlPath);
} }
else { else {
codeql = (await init_1.initCodeQL(undefined, apiDetails, tempDir, toolsDir, gitHubVersion.type, logger)).codeql; codeql = (await init_1.initCodeQL(undefined, apiDetails, tempDir, toolsDir, gitHubVersion.type, logger)).codeql;
@@ -259,8 +259,9 @@ program
}; };
const outputDir = cmd.outputDir || path.join(config.tempDir, "codeql-sarif"); const outputDir = cmd.outputDir || path.join(config.tempDir, "codeql-sarif");
const threads = util_1.getThreadsFlag(cmd.threads, logger); const threads = util_1.getThreadsFlag(cmd.threads, logger);
await analyze_1.runFinalize(outputDir, threads, config, logger); const memory = util_1.getMemoryFlag(cmd.ram);
await analyze_1.runQueries(outputDir, util_1.getMemoryFlag(cmd.ram), util_1.getAddSnippetsFlag(cmd.addSnippets), threads, cmd.category, config, logger); await analyze_1.runFinalize(outputDir, threads, memory, config, logger);
await analyze_1.runQueries(outputDir, memory, util_1.getAddSnippetsFlag(cmd.addSnippets), threads, cmd.category, config, logger);
if (!cmd.upload) { if (!cmd.upload) {
logger.info("Not uploading results"); logger.info("Not uploading results");
return; return;

File diff suppressed because one or more lines are too long

7
lib/testing-utils.js generated
View File

@@ -18,12 +18,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.setupActionsVars = exports.setupTests = void 0; exports.setupActionsVars = exports.setupTests = void 0;
const sinon_1 = __importDefault(require("sinon")); const sinon = __importStar(require("sinon"));
const CodeQL = __importStar(require("./codeql")); const CodeQL = __importStar(require("./codeql"));
function wrapOutput(context) { function wrapOutput(context) {
// Function signature taken from Socket.write. // Function signature taken from Socket.write.
@@ -79,7 +76,7 @@ function setupTests(test) {
process.stdout.write(t.context.testOutput); process.stdout.write(t.context.testOutput);
} }
// Undo any modifications made by sinon // Undo any modifications made by sinon
sinon_1.default.restore(); sinon.restore();
// Undo any modifications to the env // Undo any modifications to the env
process.env = t.context.env; process.env = t.context.env;
}); });

View File

@@ -1 +1 @@
{"version":3,"file":"testing-utils.js","sourceRoot":"","sources":["../src/testing-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,kDAA0B;AAE1B,iDAAmC;AASnC,SAAS,UAAU,CAAC,OAAoB;IACtC,8CAA8C;IAC9C,gCAAgC;IAChC,2EAA2E;IAC3E,2FAA2F;IAC3F,OAAO,CACL,KAA0B,EAC1B,QAAiB,EACjB,EAA0B,EACjB,EAAE;QACX,2CAA2C;QAC3C,IAAI,EAAE,KAAK,SAAS,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;YACtD,EAAE,GAAG,QAAQ,CAAC;YACd,QAAQ,GAAG,SAAS,CAAC;SACtB;QAED,oBAAoB;QACpB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,OAAO,CAAC,UAAU,IAAI,KAAK,CAAC;SAC7B;aAAM;YACL,OAAO,CAAC,UAAU,IAAI,IAA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EAAE,CAAC;QACnB,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;QAC/B,4BAA4B;QAC5B,0DAA0D;QAC1D,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;QAC7C,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;QAC7C,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE;YACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;SAC5C;QAED,uCAAuC;QACvC,KAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,oCAAoC;QACpC,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC;IAC9B,CAAC,CAAC,CAAC;AACL,CAAC;AAvCD,gCAuCC;AAED,yEAAyE;AACzE,sDAAsD;AACtD,SAAgB,gBAAgB,CAAC,OAAe,EAAE,QAAgB;IAChE,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,GAAG,QAAQ,CAAC;AAC9C,CAAC;AAHD,4CAGC"}

8
lib/util.js generated
View File

@@ -19,7 +19,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result; return result;
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.isHTTPError = exports.HTTPError = exports.getRequiredEnvParam = exports.isActions = exports.getMode = exports.initializeEnvironment = exports.Mode = exports.assertNever = exports.getGitHubAuth = exports.apiVersionInRange = exports.DisallowedAPIVersionReason = exports.checkGitHubVersionInRange = exports.getGitHubVersion = exports.GitHubVariant = exports.parseGitHubUrl = exports.getCodeQLDatabasePath = exports.getThreadsFlag = exports.getAddSnippetsFlag = exports.getMemoryFlag = exports.withTmpDir = exports.getToolNames = exports.getExtraOptionsEnvParam = exports.GITHUB_DOTCOM_URL = void 0; exports.codeQlVersionAbove = exports.isHTTPError = exports.HTTPError = exports.getRequiredEnvParam = exports.isActions = exports.getMode = exports.initializeEnvironment = exports.Mode = exports.assertNever = exports.getGitHubAuth = exports.apiVersionInRange = exports.DisallowedAPIVersionReason = exports.checkGitHubVersionInRange = exports.getGitHubVersion = exports.GitHubVariant = exports.parseGitHubUrl = exports.getCodeQLDatabasePath = exports.getThreadsFlag = exports.getAddSnippetsFlag = exports.getMemoryFlag = exports.withTmpDir = exports.getToolNames = exports.getExtraOptionsEnvParam = exports.GITHUB_DOTCOM_URL = void 0;
const fs = __importStar(require("fs")); const fs = __importStar(require("fs"));
const os = __importStar(require("os")); const os = __importStar(require("os"));
const path = __importStar(require("path")); const path = __importStar(require("path"));
@@ -129,7 +129,7 @@ function getAddSnippetsFlag(userInput) {
exports.getAddSnippetsFlag = getAddSnippetsFlag; exports.getAddSnippetsFlag = getAddSnippetsFlag;
/** /**
* Get the codeql `--threads` value specified for the `threads` input. * Get the codeql `--threads` value specified for the `threads` input.
* If not value was specified, all available threads will be used. * If no value was specified, all available threads will be used.
* *
* The value will be capped to the number of available CPUs. * The value will be capped to the number of available CPUs.
* *
@@ -432,4 +432,8 @@ function isHTTPError(arg) {
return (arg === null || arg === void 0 ? void 0 : arg.status) !== undefined && Number.isInteger(arg.status); return (arg === null || arg === void 0 ? void 0 : arg.status) !== undefined && Number.isInteger(arg.status);
} }
exports.isHTTPError = isHTTPError; exports.isHTTPError = isHTTPError;
async function codeQlVersionAbove(codeql, requiredVersion) {
return semver.gte(await codeql.getVersion(), requiredVersion);
}
exports.codeQlVersionAbove = codeQlVersionAbove;
//# sourceMappingURL=util.js.map //# sourceMappingURL=util.js.map

File diff suppressed because one or more lines are too long

6
lib/util.test.js generated
View File

@@ -27,7 +27,7 @@ const os = __importStar(require("os"));
const stream = __importStar(require("stream")); const stream = __importStar(require("stream"));
const github = __importStar(require("@actions/github")); const github = __importStar(require("@actions/github"));
const ava_1 = __importDefault(require("ava")); const ava_1 = __importDefault(require("ava"));
const sinon_1 = __importDefault(require("sinon")); const sinon = __importStar(require("sinon"));
const api = __importStar(require("./api-client")); const api = __importStar(require("./api-client"));
const logging_1 = require("./logging"); const logging_1 = require("./logging");
const testing_utils_1 = require("./testing-utils"); const testing_utils_1 = require("./testing-utils");
@@ -143,10 +143,10 @@ function mockGetMetaVersionHeader(versionHeader) {
"x-github-enterprise-version": versionHeader, "x-github-enterprise-version": versionHeader,
}, },
}; };
const spyGetContents = sinon_1.default const spyGetContents = sinon
.stub(client.meta, "get") .stub(client.meta, "get")
.resolves(response); .resolves(response);
sinon_1.default.stub(api, "getApiClient").value(() => client); sinon.stub(api, "getApiClient").value(() => client);
return spyGetContents; return spyGetContents;
} }
ava_1.default("getGitHubVersion", async (t) => { ava_1.default("getGitHubVersion", async (t) => {

File diff suppressed because one or more lines are too long

359
node_modules/.package-lock.json generated vendored
View File

@@ -1,6 +1,6 @@
{ {
"name": "codeql", "name": "codeql",
"version": "1.0.11", "version": "1.0.13",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
@@ -87,22 +87,28 @@
} }
}, },
"node_modules/@ava/typescript": { "node_modules/@ava/typescript": {
"version": "1.1.1", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/@ava/typescript/-/typescript-2.0.0.tgz",
"integrity": "sha512-sn+upcMk81AMrlnx/hb/9T7gCGuBfw7hi+p79NPSSQMvY2G64mOB7qRaDExiHiZfZ7FN9j7HwQeFhHZLGD/NWQ==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"escape-string-regexp": "^2.0.0" "escape-string-regexp": "^4.0.0",
"execa": "^5.0.0"
}, },
"engines": { "engines": {
"node": ">=10.18.0 <11 || >=12.14.0 <13 || >=13.5.0" "node": ">=12.22 <13 || >=14.16 <15 || >=15"
} }
}, },
"node_modules/@ava/typescript/node_modules/escape-string-regexp": { "node_modules/@ava/typescript/node_modules/escape-string-regexp": {
"version": "2.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
"integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
"dev": true, "dev": true,
"license": "MIT",
"engines": { "engines": {
"node": ">=8" "node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/@babel/code-frame": { "node_modules/@babel/code-frame": {
@@ -670,14 +676,14 @@
} }
}, },
"node_modules/@typescript-eslint/parser": { "node_modules/@typescript-eslint/parser": {
"version": "4.29.0", "version": "4.29.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.29.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.29.1.tgz",
"integrity": "sha512-+92YRNHFdXgq+GhWQPT2bmjX09X7EH36JfgN2/4wmhtwV/HPxozpCNst8jrWcngLtEVd/4zAwA6BKojAlf+YqA==", "integrity": "sha512-3fL5iN20hzX3Q4OkG7QEPFjZV2qsVGiDhEwwh+EkmE/w7oteiOvUNzmpu5eSwGJX/anCryONltJ3WDmAzAoCMg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@typescript-eslint/scope-manager": "4.29.0", "@typescript-eslint/scope-manager": "4.29.1",
"@typescript-eslint/types": "4.29.0", "@typescript-eslint/types": "4.29.1",
"@typescript-eslint/typescript-estree": "4.29.0", "@typescript-eslint/typescript-estree": "4.29.1",
"debug": "^4.3.1" "debug": "^4.3.1"
}, },
"engines": { "engines": {
@@ -697,13 +703,13 @@
} }
}, },
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": { "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": {
"version": "4.29.0", "version": "4.29.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.29.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.29.1.tgz",
"integrity": "sha512-HPq7XAaDMM3DpmuijxLV9Io8/6pQnliiXMQUcAdjpJJSR+fdmbD/zHCd7hMkjJn04UQtCQBtshgxClzg6NIS2w==", "integrity": "sha512-Hzv/uZOa9zrD/W5mftZa54Jd5Fed3tL6b4HeaOpwVSabJK8CJ+2MkDasnX/XK4rqP5ZTWngK1ZDeCi6EnxPQ7A==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@typescript-eslint/types": "4.29.0", "@typescript-eslint/types": "4.29.1",
"@typescript-eslint/visitor-keys": "4.29.0" "@typescript-eslint/visitor-keys": "4.29.1"
}, },
"engines": { "engines": {
"node": "^8.10.0 || ^10.13.0 || >=11.10.1" "node": "^8.10.0 || ^10.13.0 || >=11.10.1"
@@ -714,9 +720,9 @@
} }
}, },
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": { "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": {
"version": "4.29.0", "version": "4.29.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.29.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.29.1.tgz",
"integrity": "sha512-2YJM6XfWfi8pgU2HRhTp7WgRw78TCRO3dOmSpAvIQ8MOv4B46JD2chnhpNT7Jq8j0APlIbzO1Bach734xxUl4A==", "integrity": "sha512-Jj2yu78IRfw4nlaLtKjVaGaxh/6FhofmQ/j8v3NXmAiKafbIqtAPnKYrf0sbGjKdj0hS316J8WhnGnErbJ4RCA==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": "^8.10.0 || ^10.13.0 || >=11.10.1" "node": "^8.10.0 || ^10.13.0 || >=11.10.1"
@@ -727,13 +733,13 @@
} }
}, },
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": {
"version": "4.29.0", "version": "4.29.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.29.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.29.1.tgz",
"integrity": "sha512-8ZpNHDIOyqzzgZrQW9+xQ4k5hM62Xy2R4RPO3DQxMc5Rq5QkCdSpk/drka+DL9w6sXNzV5nrdlBmf8+x495QXQ==", "integrity": "sha512-lIkkrR9E4lwZkzPiRDNq0xdC3f2iVCUjw/7WPJ4S2Sl6C3nRWkeE1YXCQ0+KsiaQRbpY16jNaokdWnm9aUIsfw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@typescript-eslint/types": "4.29.0", "@typescript-eslint/types": "4.29.1",
"@typescript-eslint/visitor-keys": "4.29.0", "@typescript-eslint/visitor-keys": "4.29.1",
"debug": "^4.3.1", "debug": "^4.3.1",
"globby": "^11.0.3", "globby": "^11.0.3",
"is-glob": "^4.0.1", "is-glob": "^4.0.1",
@@ -754,12 +760,12 @@
} }
}, },
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": {
"version": "4.29.0", "version": "4.29.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.29.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.29.1.tgz",
"integrity": "sha512-LoaofO1C/jAJYs0uEpYMXfHboGXzOJeV118X4OsZu9f7rG7Pr9B3+4HTU8+err81rADa4xfQmAxnRnPAI2jp+Q==", "integrity": "sha512-zLqtjMoXvgdZY/PG6gqA73V8BjqPs4af1v2kiiETBObp+uC6gRYnJLmJHxC0QyUrrHDLJPIWNYxoBV3wbcRlag==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@typescript-eslint/types": "4.29.0", "@typescript-eslint/types": "4.29.1",
"eslint-visitor-keys": "^2.0.0" "eslint-visitor-keys": "^2.0.0"
}, },
"engines": { "engines": {
@@ -1698,6 +1704,20 @@
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
"dev": true "dev": true
}, },
"node_modules/cross-spawn": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
"dev": true,
"dependencies": {
"path-key": "^3.1.0",
"shebang-command": "^2.0.0",
"which": "^2.0.1"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/crypt": { "node_modules/crypt": {
"version": "0.0.2", "version": "0.0.2",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
@@ -2098,31 +2118,28 @@
} }
}, },
"node_modules/eslint-import-resolver-node": { "node_modules/eslint-import-resolver-node": {
"version": "0.3.4", "version": "0.3.5",
"resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.5.tgz",
"integrity": "sha512-XMoPKjSpXbkeJ7ZZ9icLnJMTY5Mc1kZbCakHquaFsXPpyWOwK0TK6CODO+0ca54UoM9LKOxyUNnoVZRl8TeaAg==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"debug": "^2.6.9", "debug": "^3.2.7",
"resolve": "^1.13.1" "resolve": "^1.20.0"
} }
}, },
"node_modules/eslint-import-resolver-node/node_modules/debug": { "node_modules/eslint-import-resolver-node/node_modules/debug": {
"version": "2.6.9", "version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"ms": "2.0.0" "ms": "^2.1.1"
} }
}, },
"node_modules/eslint-import-resolver-node/node_modules/ms": {
"version": "2.0.0",
"dev": true,
"license": "MIT"
},
"node_modules/eslint-module-utils": { "node_modules/eslint-module-utils": {
"version": "2.6.1", "version": "2.6.2",
"resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.1.tgz", "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.2.tgz",
"integrity": "sha512-ZXI9B8cxAJIH4nfkhTwcRTEAnrVfobYqwjWy/QMCZ8rHkZHFjf9yO4BzpiF9kCSfNlMG54eKigISHpX0+AaT4A==", "integrity": "sha512-QG8pcgThYOuqxupd06oYTZoNOGaUdTY1PqK+oS6ElF6vs4pBdk/aYxFVQQXzcrAqp9m7cl7lb2ubazX+g16k2Q==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"debug": "^3.2.7", "debug": "^3.2.7",
@@ -2253,16 +2270,19 @@
} }
}, },
"node_modules/eslint-plugin-github": { "node_modules/eslint-plugin-github": {
"version": "4.1.5", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-github/-/eslint-plugin-github-4.1.5.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-github/-/eslint-plugin-github-4.2.0.tgz",
"integrity": "sha512-fY+3C8914Efqzmb6ODvL0ZNjv8xxLkwmUasYZ189IY1gL7AxFE9CVED+MZA8B1e+OZtnfTdrQR036t5AYoun0A==", "integrity": "sha512-YAzCgSKFpZK7e3YVBKNmsVqHG5+/+cFWXKx8gi2zj96vlFA665mHRhHAMTNuPQmY22Lx4c5Xq26KIRiVLQMmqQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@typescript-eslint/eslint-plugin": "^4.20.0", "@typescript-eslint/eslint-plugin": "^4.20.0",
"@typescript-eslint/parser": "^4.20.0", "@typescript-eslint/parser": "^4.20.0",
"eslint-config-prettier": ">=8.0.0", "eslint-config-prettier": ">=8.0.0",
"eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-i18n-text": "^1.0.1",
"eslint-plugin-import": "^2.22.1", "eslint-plugin-import": "^2.22.1",
"eslint-plugin-no-only-tests": "^2.6.0",
"eslint-plugin-prettier": "^3.3.1", "eslint-plugin-prettier": "^3.3.1",
"eslint-rule-documentation": ">=1.0.0", "eslint-rule-documentation": ">=1.0.0",
"prettier": "^2.2.1", "prettier": "^2.2.1",
@@ -2275,18 +2295,27 @@
"eslint": "^7.23.0" "eslint": "^7.23.0"
} }
}, },
"node_modules/eslint-plugin-i18n-text": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-i18n-text/-/eslint-plugin-i18n-text-1.0.1.tgz",
"integrity": "sha512-3G3UetST6rdqhqW9SfcfzNYMpQXS7wNkJvp6dsXnjzGiku6Iu5hl3B0kmk6lIcFPwYjhQIY+tXVRtK9TlGT7RA==",
"dev": true,
"peerDependencies": {
"eslint": ">=5.0.0"
}
},
"node_modules/eslint-plugin-import": { "node_modules/eslint-plugin-import": {
"version": "2.23.4", "version": "2.24.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.23.4.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.24.0.tgz",
"integrity": "sha512-6/wP8zZRsnQFiR3iaPFgh5ImVRM1WN5NUWfTIRqwOdeiGJlBcSk82o1FEVq8yXmy4lkIzTo7YhHCIxlU/2HyEQ==", "integrity": "sha512-Kc6xqT9hiYi2cgybOc0I2vC9OgAYga5o/rAFinam/yF/t5uBqxQbauNPMC6fgb640T/89P0gFoO27FOilJ/Cqg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"array-includes": "^3.1.3", "array-includes": "^3.1.3",
"array.prototype.flat": "^1.2.4", "array.prototype.flat": "^1.2.4",
"debug": "^2.6.9", "debug": "^2.6.9",
"doctrine": "^2.1.0", "doctrine": "^2.1.0",
"eslint-import-resolver-node": "^0.3.4", "eslint-import-resolver-node": "^0.3.5",
"eslint-module-utils": "^2.6.1", "eslint-module-utils": "^2.6.2",
"find-up": "^2.0.0", "find-up": "^2.0.0",
"has": "^1.0.3", "has": "^1.0.3",
"is-core-module": "^2.4.0", "is-core-module": "^2.4.0",
@@ -2395,6 +2424,15 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/eslint-plugin-no-only-tests": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-no-only-tests/-/eslint-plugin-no-only-tests-2.6.0.tgz",
"integrity": "sha512-T9SmE/g6UV1uZo1oHAqOvL86XWl7Pl2EpRpnLI8g/bkJu+h7XBCB+1LnubRZ2CUQXj805vh4/CYZdnqtVaEo2Q==",
"dev": true,
"engines": {
"node": ">=4.0.0"
}
},
"node_modules/eslint-plugin-prettier": { "node_modules/eslint-plugin-prettier": {
"version": "3.4.0", "version": "3.4.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.4.0.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.4.0.tgz",
@@ -2521,19 +2559,6 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/eslint/node_modules/cross-spawn": {
"version": "7.0.3",
"dev": true,
"license": "MIT",
"dependencies": {
"path-key": "^3.1.0",
"shebang-command": "^2.0.0",
"which": "^2.0.1"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/eslint/node_modules/doctrine": { "node_modules/eslint/node_modules/doctrine": {
"version": "3.0.0", "version": "3.0.0",
"dev": true, "dev": true,
@@ -2586,33 +2611,6 @@
"js-yaml": "bin/js-yaml.js" "js-yaml": "bin/js-yaml.js"
} }
}, },
"node_modules/eslint/node_modules/path-key": {
"version": "3.1.1",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/eslint/node_modules/shebang-command": {
"version": "2.0.0",
"dev": true,
"license": "MIT",
"dependencies": {
"shebang-regex": "^3.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/eslint/node_modules/shebang-regex": {
"version": "3.0.0",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/eslint/node_modules/strip-json-comments": { "node_modules/eslint/node_modules/strip-json-comments": {
"version": "3.1.1", "version": "3.1.1",
"dev": true, "dev": true,
@@ -2635,20 +2633,6 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/eslint/node_modules/which": {
"version": "2.0.2",
"dev": true,
"license": "ISC",
"dependencies": {
"isexe": "^2.0.0"
},
"bin": {
"node-which": "bin/node-which"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/espree": { "node_modules/espree": {
"version": "7.3.1", "version": "7.3.1",
"resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz",
@@ -2741,6 +2725,41 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/execa": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
"integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==",
"dev": true,
"dependencies": {
"cross-spawn": "^7.0.3",
"get-stream": "^6.0.0",
"human-signals": "^2.1.0",
"is-stream": "^2.0.0",
"merge-stream": "^2.0.0",
"npm-run-path": "^4.0.1",
"onetime": "^5.1.2",
"signal-exit": "^3.0.3",
"strip-final-newline": "^2.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sindresorhus/execa?sponsor=1"
}
},
"node_modules/execa/node_modules/get-stream": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
"integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==",
"dev": true,
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/fast-deep-equal": { "node_modules/fast-deep-equal": {
"version": "3.1.3", "version": "3.1.3",
"license": "MIT" "license": "MIT"
@@ -2941,9 +2960,9 @@
} }
}, },
"node_modules/github-linguist": { "node_modules/github-linguist": {
"version": "2.4.3", "version": "2.4.4",
"resolved": "https://registry.npmjs.org/github-linguist/-/github-linguist-2.4.3.tgz", "resolved": "https://registry.npmjs.org/github-linguist/-/github-linguist-2.4.4.tgz",
"integrity": "sha512-hKWn1QQ+9oUyOIcUhPzi6AxTcAkYHg4OOwK79Pr05SBTFmdNr7GQkMDJabSGCZwu7SDhEb5YeUwUGqrUfyo7PA==", "integrity": "sha512-QSw/HfSTqA13t7eqNeGLd62ghnTsTQAUrJQKkUG100NZqqzpsKB9c7gH7lFaGU1ZWGmNSWfhG6q1Ok/xotOA/g==",
"dependencies": { "dependencies": {
"chalk": "^2.2.0", "chalk": "^2.2.0",
"commander": "^2.11.0", "commander": "^2.11.0",
@@ -3140,6 +3159,15 @@
"dev": true, "dev": true,
"license": "BSD-2-Clause" "license": "BSD-2-Clause"
}, },
"node_modules/human-signals": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",
"integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==",
"dev": true,
"engines": {
"node": ">=10.17.0"
}
},
"node_modules/ignore": { "node_modules/ignore": {
"version": "5.1.4", "version": "5.1.4",
"dev": true, "dev": true,
@@ -3490,6 +3518,18 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/is-stream": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
"integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
"dev": true,
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/is-string": { "node_modules/is-string": {
"version": "1.0.6", "version": "1.0.6",
"resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.6.tgz", "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.6.tgz",
@@ -3535,8 +3575,9 @@
}, },
"node_modules/isexe": { "node_modules/isexe": {
"version": "2.0.0", "version": "2.0.0",
"dev": true, "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
"license": "ISC" "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
"dev": true
}, },
"node_modules/isobject": { "node_modules/isobject": {
"version": "4.0.0", "version": "4.0.0",
@@ -3616,9 +3657,8 @@
} }
}, },
"node_modules/jsonschema": { "node_modules/jsonschema": {
"version": "1.4.0", "version": "1.2.6",
"resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.4.0.tgz", "license": "MIT",
"integrity": "sha512-/YgW6pRMr6M7C+4o8kS+B/2myEpHCrxO4PEWnqJNBFMjn7EWXqlQ4tGwL6xTHeRplwuZmcAncdvfOad1nT2yMw==",
"engines": { "engines": {
"node": "*" "node": "*"
} }
@@ -3929,6 +3969,12 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/merge-stream": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
"integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
"dev": true
},
"node_modules/merge2": { "node_modules/merge2": {
"version": "1.3.0", "version": "1.3.0",
"dev": true, "dev": true,
@@ -4058,6 +4104,18 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/npm-run-path": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
"integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
"dev": true,
"dependencies": {
"path-key": "^3.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/object-assign": { "node_modules/object-assign": {
"version": "4.1.1", "version": "4.1.1",
"license": "MIT", "license": "MIT",
@@ -4126,14 +4184,18 @@
} }
}, },
"node_modules/onetime": { "node_modules/onetime": {
"version": "5.1.0", "version": "5.1.2",
"resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
"integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"mimic-fn": "^2.1.0" "mimic-fn": "^2.1.0"
}, },
"engines": { "engines": {
"node": ">=6" "node": ">=6"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/optionator": { "node_modules/optionator": {
@@ -4362,6 +4424,15 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/path-key": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/path-parse": { "node_modules/path-parse": {
"version": "1.0.6", "version": "1.0.6",
"dev": true, "dev": true,
@@ -5103,10 +5174,32 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/signal-exit": { "node_modules/shebang-command": {
"version": "3.0.2", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
"dev": true, "dev": true,
"license": "ISC" "dependencies": {
"shebang-regex": "^3.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/shebang-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/signal-exit": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
"integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==",
"dev": true
}, },
"node_modules/sinon": { "node_modules/sinon": {
"version": "11.1.2", "version": "11.1.2",
@@ -5337,6 +5430,15 @@
"node": ">=4" "node": ">=4"
} }
}, },
"node_modules/strip-final-newline": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz",
"integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",
"dev": true,
"engines": {
"node": ">=6"
}
},
"node_modules/strip-json-comments": { "node_modules/strip-json-comments": {
"version": "2.0.1", "version": "2.0.1",
"dev": true, "dev": true,
@@ -5891,6 +5993,21 @@
"node": ">=6" "node": ">=6"
} }
}, },
"node_modules/which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"dev": true,
"dependencies": {
"isexe": "^2.0.0"
},
"bin": {
"node-which": "bin/node-which"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/which-boxed-primitive": { "node_modules/which-boxed-primitive": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz",

View File

@@ -1,6 +1,6 @@
# @ava/typescript # @ava/typescript
Adds rudimentary [TypeScript](https://www.typescriptlang.org/) support to [AVA](https://avajs.dev). Adds [TypeScript](https://www.typescriptlang.org/) support to [AVA](https://avajs.dev).
This is designed to work for projects that precompile TypeScript. It allows AVA to load the compiled JavaScript, while configuring AVA to treat the TypeScript files as test files. This is designed to work for projects that precompile TypeScript. It allows AVA to load the compiled JavaScript, while configuring AVA to treat the TypeScript files as test files.
@@ -24,7 +24,8 @@ Then, enable TypeScript support either in `package.json` or `ava.config.*`:
"typescript": { "typescript": {
"rewritePaths": { "rewritePaths": {
"src/": "build/" "src/": "build/"
} },
"compile": false
} }
} }
} }
@@ -32,6 +33,8 @@ Then, enable TypeScript support either in `package.json` or `ava.config.*`:
Both keys and values of the `rewritePaths` object must end with a `/`. Paths are relative to your project directory. Both keys and values of the `rewritePaths` object must end with a `/`. Paths are relative to your project directory.
You can enable compilation via the `compile` property. If `false`, AVA will assume you have already compiled your project. If set to `'tsc'`, AVA will run the TypeScript compiler before running your tests. This can be inefficient when using AVA in watch mode.
Output files are expected to have the `.js` extension. Output files are expected to have the `.js` extension.
AVA searches your entire project for `*.js`, `*.cjs`, `*.mjs` and `*.ts` files (or other extensions you've configured). It will ignore such files found in the `rewritePaths` targets (e.g. `build/`). If you use more specific paths, for instance `build/main/`, you may need to change AVA's `files` configuration to ignore other directories. AVA searches your entire project for `*.js`, `*.cjs`, `*.mjs` and `*.ts` files (or other extensions you've configured). It will ignore such files found in the `rewritePaths` targets (e.g. `build/`). If you use more specific paths, for instance `build/main/`, you may need to change AVA's `files` configuration to ignore other directories.

View File

@@ -1,56 +1,92 @@
'use strict'; 'use strict';
const path = require('path'); const path = require('path');
const escapeStringRegexp = require('escape-string-regexp'); const escapeStringRegexp = require('escape-string-regexp');
const execa = require('execa');
const pkg = require('./package.json'); const pkg = require('./package.json');
const help = `See https://github.com/avajs/typescript/blob/v${pkg.version}/README.md`;
function isPlainObject(x) { function isPlainObject(x) {
return x !== null && typeof x === 'object' && Reflect.getPrototypeOf(x) === Object.prototype; return x !== null && typeof x === 'object' && Reflect.getPrototypeOf(x) === Object.prototype;
} }
function isValidExtensions(extensions) { function validate(target, properties) {
return Array.isArray(extensions) && for (const key of Object.keys(properties)) {
extensions.length > 0 && const {required, isValid} = properties[key];
extensions.every(ext => typeof ext === 'string' && ext !== '') && const missing = !Reflect.has(target, key);
new Set(extensions).size === extensions.length;
}
function isValidRewritePaths(rewritePaths) { if (missing) {
if (!isPlainObject(rewritePaths)) { if (required) {
return false; throw new Error(`Missing '${key}' property in TypeScript configuration for AVA. ${help}`);
}
continue;
}
if (!isValid(target[key])) {
throw new Error(`Invalid '${key}' property in TypeScript configuration for AVA. ${help}`);
}
} }
return Object.entries(rewritePaths).every(([from, to]) => { for (const key of Object.keys(target)) {
return from.endsWith('/') && typeof to === 'string' && to.endsWith('/'); if (!Reflect.has(properties, key)) {
}); throw new Error(`Unexpected '${key}' property in TypeScript configuration for AVA. ${help}`);
}
}
} }
async function compileTypeScript(projectDir) {
return execa('tsc', ['--incremental'], {preferLocal: true, cwd: projectDir});
}
const configProperties = {
compile: {
required: true,
isValid(compile) {
return compile === false || compile === 'tsc';
}
},
rewritePaths: {
required: true,
isValid(rewritePaths) {
if (!isPlainObject(rewritePaths)) {
return false;
}
return Object.entries(rewritePaths).every(([from, to]) => {
return from.endsWith('/') && typeof to === 'string' && to.endsWith('/');
});
}
},
extensions: {
required: false,
isValid(extensions) {
return Array.isArray(extensions) &&
extensions.length > 0 &&
extensions.every(ext => typeof ext === 'string' && ext !== '') &&
new Set(extensions).size === extensions.length;
}
}
};
module.exports = ({negotiateProtocol}) => { module.exports = ({negotiateProtocol}) => {
const protocol = negotiateProtocol(['ava-3.2', 'ava-3'], {version: pkg.version}); const protocol = negotiateProtocol(['ava-3.2'], {version: pkg.version});
if (protocol === null) { if (protocol === null) {
return; return;
} }
return { return {
main({config}) { main({config}) {
let valid = false; if (!isPlainObject(config)) {
if (isPlainObject(config)) { throw new Error(`Unexpected Typescript configuration for AVA. ${help}`);
const keys = Object.keys(config);
if (keys.every(key => key === 'extensions' || key === 'rewritePaths')) {
valid =
(config.extensions === undefined || isValidExtensions(config.extensions)) &&
isValidRewritePaths(config.rewritePaths);
}
} }
if (!valid) { validate(config, configProperties);
throw new Error(`Unexpected Typescript configuration for AVA. See https://github.com/avajs/typescript/blob/v${pkg.version}/README.md for allowed values.`);
}
const { const {
extensions = ['ts'], extensions = ['ts'],
rewritePaths: relativeRewritePaths rewritePaths: relativeRewritePaths,
compile
} = config; } = config;
const rewritePaths = Object.entries(relativeRewritePaths).map(([from, to]) => [ const rewritePaths = Object.entries(relativeRewritePaths).map(([from, to]) => [
@@ -61,6 +97,10 @@ module.exports = ({negotiateProtocol}) => {
return { return {
async compile() { async compile() {
if (compile === 'tsc') {
await compileTypeScript(protocol.projectDir);
}
return { return {
extensions: extensions.slice(), extensions: extensions.slice(),
rewritePaths: rewritePaths.slice() rewritePaths: rewritePaths.slice()

View File

@@ -1,11 +1,13 @@
'use strict'; 'use strict';
const matchOperatorsRegex = /[|\\{}()[\]^$+*?.-]/g;
module.exports = string => { module.exports = string => {
if (typeof string !== 'string') { if (typeof string !== 'string') {
throw new TypeError('Expected a string'); throw new TypeError('Expected a string');
} }
return string.replace(matchOperatorsRegex, '\\$&'); // Escape characters with special meaning either inside or outside character sets.
// Use a simple backslash escape when its always valid, and a \unnnn escape when the simpler form would be disallowed by Unicode patterns stricter grammar.
return string
.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
.replace(/-/g, '\\x2d');
}; };

View File

@@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 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:

View File

@@ -1,20 +1,17 @@
{ {
"name": "escape-string-regexp", "name": "escape-string-regexp",
"version": "2.0.0", "version": "4.0.0",
"description": "Escape RegExp special characters", "description": "Escape RegExp special characters",
"license": "MIT", "license": "MIT",
"repository": "sindresorhus/escape-string-regexp", "repository": "sindresorhus/escape-string-regexp",
"funding": "https://github.com/sponsors/sindresorhus",
"author": { "author": {
"name": "Sindre Sorhus", "name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com", "email": "sindresorhus@gmail.com",
"url": "sindresorhus.com" "url": "https://sindresorhus.com"
}, },
"maintainers": [
"Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)",
"Joshua Boy Nicolai Appelman <joshua@jbna.nl> (jbna.nl)"
],
"engines": { "engines": {
"node": ">=8" "node": ">=10"
}, },
"scripts": { "scripts": {
"test": "xo && ava && tsd" "test": "xo && ava && tsd"
@@ -27,17 +24,15 @@
"escape", "escape",
"regex", "regex",
"regexp", "regexp",
"re",
"regular", "regular",
"expression", "expression",
"string", "string",
"str",
"special", "special",
"characters" "characters"
], ],
"devDependencies": { "devDependencies": {
"ava": "^1.4.1", "ava": "^1.4.1",
"tsd": "^0.7.2", "tsd": "^0.11.0",
"xo": "^0.24.0" "xo": "^0.28.3"
} }
} }

View File

@@ -2,14 +2,12 @@
> Escape RegExp special characters > Escape RegExp special characters
## Install ## Install
``` ```
$ npm install escape-string-regexp $ npm install escape-string-regexp
``` ```
## Usage ## Usage
```js ```js
@@ -23,7 +21,14 @@ new RegExp(escapedString);
You can also use this to escape a string that is inserted into the middle of a regex, for example, into a character class. You can also use this to escape a string that is inserted into the middle of a regex, for example, into a character class.
---
## License <div align="center">
<b>
MIT © [Sindre Sorhus](https://sindresorhus.com) <a href="https://tidelift.com/subscription/pkg/npm-escape-string-regexp?utm_source=npm-escape-string-regexp&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>

View File

@@ -1,9 +1,9 @@
{ {
"name": "@ava/typescript", "name": "@ava/typescript",
"version": "1.1.1", "version": "2.0.0",
"description": "TypeScript provider for AVA", "description": "TypeScript provider for AVA",
"engines": { "engines": {
"node": ">=10.18.0 <11 || >=12.14.0 <13 || >=13.5.0" "node": ">=12.22 <13 || >=14.16 <15 || >=15"
}, },
"files": [ "files": [
"index.js" "index.js"
@@ -16,25 +16,36 @@
"typescript" "typescript"
], ],
"scripts": { "scripts": {
"test": "xo && nyc ava" "test": "xo && c8 ava"
}, },
"dependencies": { "dependencies": {
"escape-string-regexp": "^2.0.0" "escape-string-regexp": "^4.0.0",
"execa": "^5.0.0"
}, },
"devDependencies": { "devDependencies": {
"ava": "^3.0.0", "ava": "^3.15.0",
"execa": "^4.0.0", "c8": "^7.7.1",
"nyc": "^15.0.0", "del": "^6.0.0",
"xo": "^0.25.3" "typescript": "^4.2.4",
"xo": "^0.38.2"
}, },
"nyc": { "c8": {
"reporter": [ "reporter": [
"html", "html",
"lcov", "lcov",
"text" "text"
] ]
}, },
"ava": {
"files": [
"!test/broken-fixtures/**"
],
"timeout": "60s"
},
"xo": { "xo": {
"ignores": [
"test/broken-fixtures"
],
"rules": { "rules": {
"import/order": "off" "import/order": "off"
} }

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09)
**Note:** Version bump only for package @typescript-eslint/parser
# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) # [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02)

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09)
**Note:** Version bump only for package @typescript-eslint/scope-manager
# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) # [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02)

View File

@@ -1,6 +1,6 @@
{ {
"name": "@typescript-eslint/scope-manager", "name": "@typescript-eslint/scope-manager",
"version": "4.29.0", "version": "4.29.1",
"description": "TypeScript scope analyser for ESLint", "description": "TypeScript scope analyser for ESLint",
"keywords": [ "keywords": [
"eslint", "eslint",
@@ -39,12 +39,12 @@
"typecheck": "tsc -p tsconfig.json --noEmit" "typecheck": "tsc -p tsconfig.json --noEmit"
}, },
"dependencies": { "dependencies": {
"@typescript-eslint/types": "4.29.0", "@typescript-eslint/types": "4.29.1",
"@typescript-eslint/visitor-keys": "4.29.0" "@typescript-eslint/visitor-keys": "4.29.1"
}, },
"devDependencies": { "devDependencies": {
"@types/glob": "*", "@types/glob": "*",
"@typescript-eslint/typescript-estree": "4.29.0", "@typescript-eslint/typescript-estree": "4.29.1",
"glob": "*", "glob": "*",
"jest-specific-snapshot": "*", "jest-specific-snapshot": "*",
"make-dir": "*", "make-dir": "*",
@@ -64,5 +64,5 @@
] ]
} }
}, },
"gitHead": "4d3ae1375d03c17d1ecd3c41952915a4dedd4828" "gitHead": "db78642ea3ebd794e7deef767fa2c5195ef7c04c"
} }

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09)
**Note:** Version bump only for package @typescript-eslint/types
# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) # [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02)

View File

@@ -1,6 +1,6 @@
{ {
"name": "@typescript-eslint/types", "name": "@typescript-eslint/types",
"version": "4.29.0", "version": "4.29.1",
"description": "Types for the TypeScript-ESTree AST spec", "description": "Types for the TypeScript-ESTree AST spec",
"keywords": [ "keywords": [
"eslint", "eslint",
@@ -52,5 +52,5 @@
"devDependencies": { "devDependencies": {
"typescript": "*" "typescript": "*"
}, },
"gitHead": "4d3ae1375d03c17d1ecd3c41952915a4dedd4828" "gitHead": "db78642ea3ebd794e7deef767fa2c5195ef7c04c"
} }

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09)
**Note:** Version bump only for package @typescript-eslint/typescript-estree
# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) # [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02)

View File

@@ -1,6 +1,6 @@
{ {
"name": "@typescript-eslint/typescript-estree", "name": "@typescript-eslint/typescript-estree",
"version": "4.29.0", "version": "4.29.1",
"description": "A parser that converts TypeScript source code into an ESTree compatible form", "description": "A parser that converts TypeScript source code into an ESTree compatible form",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
@@ -41,8 +41,8 @@
"typecheck": "tsc -p tsconfig.json --noEmit" "typecheck": "tsc -p tsconfig.json --noEmit"
}, },
"dependencies": { "dependencies": {
"@typescript-eslint/types": "4.29.0", "@typescript-eslint/types": "4.29.1",
"@typescript-eslint/visitor-keys": "4.29.0", "@typescript-eslint/visitor-keys": "4.29.1",
"debug": "^4.3.1", "debug": "^4.3.1",
"globby": "^11.0.3", "globby": "^11.0.3",
"is-glob": "^4.0.1", "is-glob": "^4.0.1",
@@ -59,7 +59,7 @@
"@types/is-glob": "*", "@types/is-glob": "*",
"@types/semver": "*", "@types/semver": "*",
"@types/tmp": "*", "@types/tmp": "*",
"@typescript-eslint/shared-fixtures": "4.29.0", "@typescript-eslint/shared-fixtures": "4.29.1",
"glob": "*", "glob": "*",
"jest-specific-snapshot": "*", "jest-specific-snapshot": "*",
"make-dir": "*", "make-dir": "*",
@@ -82,5 +82,5 @@
] ]
} }
}, },
"gitHead": "4d3ae1375d03c17d1ecd3c41952915a4dedd4828" "gitHead": "db78642ea3ebd794e7deef767fa2c5195ef7c04c"
} }

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09)
**Note:** Version bump only for package @typescript-eslint/visitor-keys
# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) # [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02)
**Note:** Version bump only for package @typescript-eslint/visitor-keys **Note:** Version bump only for package @typescript-eslint/visitor-keys

View File

@@ -1,6 +1,6 @@
{ {
"name": "@typescript-eslint/visitor-keys", "name": "@typescript-eslint/visitor-keys",
"version": "4.29.0", "version": "4.29.1",
"description": "Visitor keys used to help traverse the TypeScript-ESTree AST", "description": "Visitor keys used to help traverse the TypeScript-ESTree AST",
"keywords": [ "keywords": [
"eslint", "eslint",
@@ -38,7 +38,7 @@
"typecheck": "tsc -p tsconfig.json --noEmit" "typecheck": "tsc -p tsconfig.json --noEmit"
}, },
"dependencies": { "dependencies": {
"@typescript-eslint/types": "4.29.0", "@typescript-eslint/types": "4.29.1",
"eslint-visitor-keys": "^2.0.0" "eslint-visitor-keys": "^2.0.0"
}, },
"devDependencies": { "devDependencies": {
@@ -55,5 +55,5 @@
] ]
} }
}, },
"gitHead": "4d3ae1375d03c17d1ecd3c41952915a4dedd4828" "gitHead": "db78642ea3ebd794e7deef767fa2c5195ef7c04c"
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "@typescript-eslint/parser", "name": "@typescript-eslint/parser",
"version": "4.29.0", "version": "4.29.1",
"description": "An ESLint custom parser which leverages TypeScript ESTree", "description": "An ESLint custom parser which leverages TypeScript ESTree",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
@@ -44,14 +44,14 @@
"eslint": "^5.0.0 || ^6.0.0 || ^7.0.0" "eslint": "^5.0.0 || ^6.0.0 || ^7.0.0"
}, },
"dependencies": { "dependencies": {
"@typescript-eslint/scope-manager": "4.29.0", "@typescript-eslint/scope-manager": "4.29.1",
"@typescript-eslint/types": "4.29.0", "@typescript-eslint/types": "4.29.1",
"@typescript-eslint/typescript-estree": "4.29.0", "@typescript-eslint/typescript-estree": "4.29.1",
"debug": "^4.3.1" "debug": "^4.3.1"
}, },
"devDependencies": { "devDependencies": {
"@types/glob": "*", "@types/glob": "*",
"@typescript-eslint/experimental-utils": "4.29.0", "@typescript-eslint/experimental-utils": "4.29.1",
"glob": "*", "glob": "*",
"typescript": "*" "typescript": "*"
}, },
@@ -71,5 +71,5 @@
] ]
} }
}, },
"gitHead": "4d3ae1375d03c17d1ecd3c41952915a4dedd4828" "gitHead": "db78642ea3ebd794e7deef767fa2c5195ef7c04c"
} }

View File

@@ -1,63 +0,0 @@
# Change Log
All notable changes to this resolver will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
This change log adheres to standards from [Keep a CHANGELOG](http://keepachangelog.com).
## Unreleased
## v0.3.4 - 2020-06-16
### Added
- add `.node` extension ([#1663])
## v0.3.3 - 2020-01-10
### Changed
- [meta] copy LICENSE file to all npm packages on prepublish ([#1595], thanks [@opichals])
## v0.3.2 - 2018-01-05
### Added
- `.mjs` extension detected by default to support `experimental-modules` ([#939])
### Deps
- update `debug`, `resolve`
## v0.3.1 - 2017-06-23
### Changed
- bumped `debug` dep to match other packages
## v0.3.0 - 2016-12-15
### Changed
- bumped `resolve` to fix issues with Node builtins (thanks [@SkeLLLa] and [@ljharb])
### Fixed
- use `files` in `package.json` to ship only `index.js` ([#531], thanks for noticing [@lukeapage])
## v0.2.3 - 2016-08-20
### Added
- debug logging (use `DEBUG=eslint-plugin-import:resolver:node eslint [...]`)
## v0.2.2 - 2016-07-14
### Fixed
- Node resolver no longer declares the import plugin as a `peerDependency`. See [#437]
for a well-articulated and thoughtful expression of why this doesn't make sense.
Thanks [@jasonkarns] for the issue and the PR to fix it ([#438]).
Also, apologies to the others who expressed this before, but I never understood
what the problem was.😅
## v0.2.1
### Fixed
- find files with `.json` extensions (#333, thanks for noticing @jfmengels)
[#438]: https://github.com/benmosher/eslint-plugin-import/pull/438
[#1663]: https://github.com/benmosher/eslint-plugin-import/issues/1663
[#1595]: https://github.com/benmosher/eslint-plugin-import/pull/1595
[#939]: https://github.com/benmosher/eslint-plugin-import/issues/939
[#531]: https://github.com/benmosher/eslint-plugin-import/issues/531
[#437]: https://github.com/benmosher/eslint-plugin-import/issues/437
[@jasonkarns]: https://github.com/jasonkarns
[@lukeapage]: https://github.com/lukeapage
[@SkeLLLa]: https://github.com/SkeLLLa
[@ljharb]: https://github.com/ljharb
[@opichals]: https://github.com/opichals

View File

@@ -1,47 +1,51 @@
var resolve = require('resolve') 'use strict';
, path = require('path')
var log = require('debug')('eslint-plugin-import:resolver:node') const resolve = require('resolve');
const path = require('path');
exports.interfaceVersion = 2 const log = require('debug')('eslint-plugin-import:resolver:node');
exports.interfaceVersion = 2;
exports.resolve = function (source, file, config) { exports.resolve = function (source, file, config) {
log('Resolving:', source, 'from:', file) log('Resolving:', source, 'from:', file);
var resolvedPath let resolvedPath;
if (resolve.isCore(source)) { if (resolve.isCore(source)) {
log('resolved to core') log('resolved to core');
return { found: true, path: null } return { found: true, path: null };
} }
try { try {
resolvedPath = resolve.sync(source, opts(file, config)) resolvedPath = resolve.sync(source, opts(file, config));
log('Resolved to:', resolvedPath) log('Resolved to:', resolvedPath);
return { found: true, path: resolvedPath } return { found: true, path: resolvedPath };
} catch (err) { } catch (err) {
log('resolve threw error:', err) log('resolve threw error:', err);
return { found: false } return { found: false };
} }
} };
function opts(file, config) { function opts(file, config) {
return Object.assign({ return Object.assign({
// more closely matches Node (#333) // more closely matches Node (#333)
// plus 'mjs' for native modules! (#939) // plus 'mjs' for native modules! (#939)
extensions: ['.mjs', '.js', '.json', '.node'], extensions: ['.mjs', '.js', '.json', '.node'],
}, },
config, config,
{ {
// path.resolve will handle paths relative to CWD // path.resolve will handle paths relative to CWD
basedir: path.dirname(path.resolve(file)), basedir: path.dirname(path.resolve(file)),
packageFilter: packageFilter, packageFilter: packageFilter,
}) });
} }
function packageFilter(pkg) { function packageFilter(pkg) {
if (pkg['jsnext:main']) { if (pkg.module) {
pkg['main'] = pkg['jsnext:main'] pkg.main = pkg.module;
} else if (pkg['jsnext:main']) {
pkg.main = pkg['jsnext:main'];
} }
return pkg return pkg;
} }

View File

@@ -1 +0,0 @@
repo_token: SIAeZjKYlHK74rbcFvNHMUzjRiMpflxve

View File

@@ -1,11 +0,0 @@
{
"env": {
"browser": true,
"node": true
},
"rules": {
"no-console": 0,
"no-empty": [1, { "allowEmptyCatch": true }]
},
"extends": "eslint:recommended"
}

View File

@@ -1,9 +0,0 @@
support
test
examples
example
*.sock
dist
yarn.lock
coverage
bower.json

View File

@@ -1,14 +0,0 @@
language: node_js
node_js:
- "6"
- "5"
- "4"
install:
- make node_modules
script:
- make lint
- make test
- make coveralls

View File

@@ -1,4 +1,37 @@
3.1.0 / 2017-09-26
==================
* Add `DEBUG_HIDE_DATE` env var (#486)
* Remove ReDoS regexp in %o formatter (#504)
* Remove "component" from package.json
* Remove `component.json`
* Ignore package-lock.json
* Examples: fix colors printout
* Fix: browser detection
* Fix: spelling mistake (#496, @EdwardBetts)
3.0.1 / 2017-08-24
==================
* Fix: Disable colors in Edge and Internet Explorer (#489)
3.0.0 / 2017-08-08
==================
* Breaking: Remove DEBUG_FD (#406)
* Breaking: Use `Date#toISOString()` instead to `Date#toUTCString()` when output is not a TTY (#418)
* Breaking: Make millisecond timer namespace specific and allow 'always enabled' output (#408)
* Addition: document `enabled` flag (#465)
* Addition: add 256 colors mode (#481)
* Addition: `enabled()` updates existing debug instances, add `destroy()` function (#440)
* Update: component: update "ms" to v2.0.0
* Update: separate the Node and Browser tests in Travis-CI
* Update: refactor Readme, fixed documentation, added "Namespace Colors" section, redid screenshots
* Update: separate Node.js and web browser examples for organization
* Update: update "browserify" to v14.4.0
* Fix: fix Readme typo (#473)
2.6.9 / 2017-09-22 2.6.9 / 2017-09-22
================== ==================
@@ -27,7 +60,7 @@
2.6.4 / 2017-04-20 2.6.4 / 2017-04-20
================== ==================
* Fix: bug that would occure if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo) * Fix: bug that would occur if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo)
* Chore: ignore bower.json in npm installations. (#437, @joaovieira) * Chore: ignore bower.json in npm installations. (#437, @joaovieira)
* Misc: update "ms" to v0.7.3 (@tootallnate) * Misc: update "ms" to v0.7.3 (@tootallnate)

View File

@@ -1,50 +0,0 @@
# get Makefile directory name: http://stackoverflow.com/a/5982798/376773
THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
# BIN directory
BIN := $(THIS_DIR)/node_modules/.bin
# Path
PATH := node_modules/.bin:$(PATH)
SHELL := /bin/bash
# applications
NODE ?= $(shell which node)
YARN ?= $(shell which yarn)
PKG ?= $(if $(YARN),$(YARN),$(NODE) $(shell which npm))
BROWSERIFY ?= $(NODE) $(BIN)/browserify
.FORCE:
install: node_modules
node_modules: package.json
@NODE_ENV= $(PKG) install
@touch node_modules
lint: .FORCE
eslint browser.js debug.js index.js node.js
test-node: .FORCE
istanbul cover node_modules/mocha/bin/_mocha -- test/**.js
test-browser: .FORCE
mkdir -p dist
@$(BROWSERIFY) \
--standalone debug \
. > dist/debug.js
karma start --single-run
rimraf dist
test: .FORCE
concurrently \
"make test-node" \
"make test-browser"
coveralls:
cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
.PHONY: all install clean distclean

View File

@@ -2,11 +2,10 @@
[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) [![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers)
[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) [![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors)
<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png">
A tiny JavaScript debugging utility modelled after Node.js core's debugging
A tiny node.js debugging utility modelled after node core's debugging technique. technique. Works in Node.js and web browsers.
**Discussion around the V3 API is under way [here](https://github.com/visionmedia/debug/issues/370)**
## Installation ## Installation
@@ -18,7 +17,7 @@ $ npm install debug
`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. `debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole.
Example _app.js_: Example [_app.js_](./examples/node/app.js):
```js ```js
var debug = require('debug')('http') var debug = require('debug')('http')
@@ -27,7 +26,7 @@ var debug = require('debug')('http')
// fake app // fake app
debug('booting %s', name); debug('booting %o', name);
http.createServer(function(req, res){ http.createServer(function(req, res){
debug(req.method + ' ' + req.url); debug(req.method + ' ' + req.url);
@@ -41,81 +40,148 @@ http.createServer(function(req, res){
require('./worker'); require('./worker');
``` ```
Example _worker.js_: Example [_worker.js_](./examples/node/worker.js):
```js ```js
var debug = require('debug')('worker'); var a = require('debug')('worker:a')
, b = require('debug')('worker:b');
setInterval(function(){ function work() {
debug('doing some work'); a('doing lots of uninteresting work');
}, 1000); setTimeout(work, Math.random() * 1000);
}
work();
function workb() {
b('doing some work');
setTimeout(workb, Math.random() * 2000);
}
workb();
``` ```
The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples: The `DEBUG` environment variable is then used to enable these based on space or
comma-delimited names.
![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png) Here are some examples:
![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png) <img width="647" alt="screen shot 2017-08-08 at 12 53 04 pm" src="https://user-images.githubusercontent.com/71256/29091703-a6302cdc-7c38-11e7-8304-7c0b3bc600cd.png">
<img width="647" alt="screen shot 2017-08-08 at 12 53 38 pm" src="https://user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png">
<img width="647" alt="screen shot 2017-08-08 at 12 53 25 pm" src="https://user-images.githubusercontent.com/71256/29091701-a62ea114-7c38-11e7-826a-2692bedca740.png">
#### Windows note #### Windows command prompt notes
On Windows the environment variable is set using the `set` command. ##### CMD
```cmd On Windows the environment variable is set using the `set` command.
set DEBUG=*,-not_this
```
Note that PowerShell uses different syntax to set environment variables. ```cmd
set DEBUG=*,-not_this
```
```cmd Example:
$env:DEBUG = "*,-not_this"
``` ```cmd
set DEBUG=* & node app.js
```
##### PowerShell (VS Code default)
PowerShell uses different syntax to set environment variables.
```cmd
$env:DEBUG = "*,-not_this"
```
Example:
```cmd
$env:DEBUG='app';node app.js
```
Then, run the program to be debugged as usual. Then, run the program to be debugged as usual.
npm script example:
```js
"windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js",
```
## Namespace Colors
Every debug instance has a color generated for it based on its namespace name.
This helps when visually parsing the debug output to identify which debug instance
a debug line belongs to.
#### Node.js
In Node.js, colors are enabled when stderr is a TTY. You also _should_ install
the [`supports-color`](https://npmjs.org/supports-color) module alongside debug,
otherwise debug will only use a small handful of basic colors.
<img width="521" src="https://user-images.githubusercontent.com/71256/29092181-47f6a9e6-7c3a-11e7-9a14-1928d8a711cd.png">
#### Web Browser
Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
option. These are WebKit web inspectors, Firefox ([since version
31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
and the Firebug plugin for Firefox (any version).
<img width="524" src="https://user-images.githubusercontent.com/71256/29092033-b65f9f2e-7c39-11e7-8e32-f6f0d8e865c1.png">
## Millisecond diff ## Millisecond diff
When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png) <img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png">
When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below: When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below:
<img width="647" src="https://user-images.githubusercontent.com/71256/29091956-6bd78372-7c39-11e7-8c55-c948396d6edd.png">
![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png)
## Conventions ## Conventions
If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output.
## Wildcards ## Wildcards
The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. The `*` character may be used as a wildcard. Suppose for example your library has
debuggers named "connect:bodyParser", "connect:compress", "connect:session",
instead of listing all three with
`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do
`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:". You can also exclude specific debuggers by prefixing them with a "-" character.
For example, `DEBUG=*,-connect:*` would include all debuggers except those
starting with "connect:".
## Environment Variables ## Environment Variables
When running through Node.js, you can set a few environment variables that will When running through Node.js, you can set a few environment variables that will
change the behavior of the debug logging: change the behavior of the debug logging:
| Name | Purpose | | Name | Purpose |
|-----------|-------------------------------------------------| |-----------|-------------------------------------------------|
| `DEBUG` | Enables/disables specific debugging namespaces. | | `DEBUG` | Enables/disables specific debugging namespaces. |
| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). |
| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | | `DEBUG_COLORS`| Whether or not to use colors in the debug output. |
| `DEBUG_DEPTH` | Object inspection depth. | | `DEBUG_DEPTH` | Object inspection depth. |
| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | | `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
__Note:__ The environment variables beginning with `DEBUG_` end up being __Note:__ The environment variables beginning with `DEBUG_` end up being
converted into an Options object that gets used with `%o`/`%O` formatters. converted into an Options object that gets used with `%o`/`%O` formatters.
See the Node.js documentation for See the Node.js documentation for
[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) [`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)
for the complete list. for the complete list.
## Formatters ## Formatters
Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting.
Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. Below are the officially supported formatters: Below are the officially supported formatters:
| Formatter | Representation | | Formatter | Representation |
|-----------|----------------| |-----------|----------------|
@@ -126,9 +192,12 @@ Then, run the program to be debugged as usual.
| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | | `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. |
| `%%` | Single percent sign ('%'). This does not consume an argument. | | `%%` | Single percent sign ('%'). This does not consume an argument. |
### Custom formatters ### Custom formatters
You can add custom formatters by extending the `debug.formatters` object. For example, if you wanted to add support for rendering a Buffer as hex with `%h`, you could do something like: You can add custom formatters by extending the `debug.formatters` object.
For example, if you wanted to add support for rendering a Buffer as hex with
`%h`, you could do something like:
```js ```js
const createDebug = require('debug') const createDebug = require('debug')
@@ -142,14 +211,16 @@ debug('this is hex: %h', new Buffer('hello world'))
// foo this is hex: 68656c6c6f20776f726c6421 +0ms // foo this is hex: 68656c6c6f20776f726c6421 +0ms
``` ```
## Browser support
You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),
or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),
if you don't want to build it yourself.
Debug's enable state is currently persisted by `localStorage`. ## Browser Support
Consider the situation shown below where you have `worker:a` and `worker:b`,
and wish to debug both. You can enable this using `localStorage.debug`: You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),
or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),
if you don't want to build it yourself.
Debug's enable state is currently persisted by `localStorage`.
Consider the situation shown below where you have `worker:a` and `worker:b`,
and wish to debug both. You can enable this using `localStorage.debug`:
```js ```js
localStorage.debug = 'worker:*' localStorage.debug = 'worker:*'
@@ -170,23 +241,12 @@ setInterval(function(){
}, 1200); }, 1200);
``` ```
#### Web Inspector Colors
Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
option. These are WebKit web inspectors, Firefox ([since version
31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
and the Firebug plugin for Firefox (any version).
Colored output looks something like:
![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png)
## Output streams ## Output streams
By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:
Example _stdout.js_: Example [_stdout.js_](./examples/node/stdout.js):
```js ```js
var debug = require('debug'); var debug = require('debug');
@@ -208,6 +268,71 @@ error('now goes to stdout via console.info');
log('still goes to stdout, but via console.info now'); log('still goes to stdout, but via console.info now');
``` ```
## Extend
You can simply extend debugger
```js
const log = require('debug')('auth');
//creates new debug instance with extended namespace
const logSign = log.extend('sign');
const logLogin = log.extend('login');
log('hello'); // auth hello
logSign('hello'); //auth:sign hello
logLogin('hello'); //auth:login hello
```
## Set dynamically
You can also enable debug dynamically by calling the `enable()` method :
```js
let debug = require('debug');
console.log(1, debug.enabled('test'));
debug.enable('test');
console.log(2, debug.enabled('test'));
debug.disable();
console.log(3, debug.enabled('test'));
```
print :
```
1 false
2 true
3 false
```
Usage :
`enable(namespaces)`
`namespaces` can include modes separated by a colon and wildcards.
Note that calling `enable()` completely overrides previously set DEBUG variable :
```
$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))'
=> false
```
## Checking whether a debug target is enabled
After you've created a debug instance, you can determine whether or not it is
enabled by checking the `enabled` property:
```javascript
const debug = require('debug')('http');
if (debug.enabled) {
// do stuff...
}
```
You can also manually toggle this property to force the debug instance to be
enabled or disabled.
## Authors ## Authors
@@ -290,7 +415,7 @@ Become a sponsor and get your logo on our README on Github with a link to your s
(The MIT License) (The MIT License)
Copyright (c) 2014-2016 TJ Holowaychuk &lt;tj@vision-media.ca&gt; Copyright (c) 2014-2017 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the

View File

@@ -1,19 +0,0 @@
{
"name": "debug",
"repo": "visionmedia/debug",
"description": "small debugging utility",
"version": "2.6.9",
"keywords": [
"debug",
"log",
"debugger"
],
"main": "src/browser.js",
"scripts": [
"src/browser.js",
"src/debug.js"
],
"dependencies": {
"rauchg/ms.js": "0.7.1"
}
}

View File

@@ -1,70 +0,0 @@
// Karma configuration
// Generated on Fri Dec 16 2016 13:09:51 GMT+0000 (UTC)
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha', 'chai', 'sinon'],
// list of files / patterns to load in the browser
files: [
'dist/debug.js',
'test/*spec.js'
],
// list of files to exclude
exclude: [
'src/node.js'
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['PhantomJS'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
})
}

View File

@@ -1,6 +1,6 @@
{ {
"name": "debug", "name": "debug",
"version": "2.6.9", "version": "3.2.7",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git://github.com/visionmedia/debug.git" "url": "git://github.com/visionmedia/debug.git"
@@ -11,6 +11,13 @@
"log", "log",
"debugger" "debugger"
], ],
"files": [
"src",
"node.js",
"dist/debug.js",
"LICENSE",
"README.md"
],
"author": "TJ Holowaychuk <tj@vision-media.ca>", "author": "TJ Holowaychuk <tj@vision-media.ca>",
"contributors": [ "contributors": [
"Nathan Rajlich <nathan@tootallnate.net> (http://n8.io)", "Nathan Rajlich <nathan@tootallnate.net> (http://n8.io)",
@@ -18,32 +25,27 @@
], ],
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"ms": "2.0.0" "ms": "^2.1.1"
}, },
"devDependencies": { "devDependencies": {
"browserify": "9.0.3", "@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"browserify": "14.4.0",
"chai": "^3.5.0", "chai": "^3.5.0",
"concurrently": "^3.1.0", "concurrently": "^3.1.0",
"coveralls": "^2.11.15", "coveralls": "^3.0.2",
"eslint": "^3.12.1",
"istanbul": "^0.4.5", "istanbul": "^0.4.5",
"karma": "^1.3.0", "karma": "^3.0.0",
"karma-chai": "^0.1.0", "karma-chai": "^0.1.0",
"karma-mocha": "^1.3.0", "karma-mocha": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.2", "karma-phantomjs-launcher": "^1.0.2",
"karma-sinon": "^1.0.5", "mocha": "^5.2.0",
"mocha": "^3.2.0",
"mocha-lcov-reporter": "^1.2.0", "mocha-lcov-reporter": "^1.2.0",
"rimraf": "^2.5.4", "rimraf": "^2.5.4",
"sinon": "^1.17.6", "xo": "^0.23.0"
"sinon-chai": "^2.8.0"
}, },
"main": "./src/index.js", "main": "./src/index.js",
"browser": "./src/browser.js", "browser": "./src/browser.js",
"component": { "unpkg": "./dist/debug.js"
"scripts": {
"debug/index.js": "browser.js",
"debug/debug.js": "debug.js"
}
}
} }

View File

@@ -1,33 +1,23 @@
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
/* eslint-env browser */
/** /**
* This is the web browser implementation of `debug()`. * This is the web browser implementation of `debug()`.
*
* Expose `debug()` as the module.
*/ */
exports = module.exports = require('./debug');
exports.log = log; exports.log = log;
exports.formatArgs = formatArgs; exports.formatArgs = formatArgs;
exports.save = save; exports.save = save;
exports.load = load; exports.load = load;
exports.useColors = useColors; exports.useColors = useColors;
exports.storage = 'undefined' != typeof chrome exports.storage = localstorage();
&& 'undefined' != typeof chrome.storage
? chrome.storage.local
: localstorage();
/** /**
* Colors. * Colors.
*/ */
exports.colors = [ exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];
'lightseagreen',
'forestgreen',
'goldenrod',
'dodgerblue',
'darkorchid',
'crimson'
];
/** /**
* Currently only WebKit-based Web Inspectors, Firefox >= v31, * Currently only WebKit-based Web Inspectors, Firefox >= v31,
* and the Firebug extension (any Firefox version) are known * and the Firebug extension (any Firefox version) are known
@@ -35,79 +25,65 @@ exports.colors = [
* *
* TODO: add a `localStorage` variable to explicitly enable/disable colors * TODO: add a `localStorage` variable to explicitly enable/disable colors
*/ */
// eslint-disable-next-line complexity
function useColors() { function useColors() {
// NB: In an Electron preload script, document will be defined but not fully // NB: In an Electron preload script, document will be defined but not fully
// initialized. Since we know we're in Chrome, we'll just detect this case // initialized. Since we know we're in Chrome, we'll just detect this case
// explicitly // explicitly
if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') { if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
return true; return true;
} } // Internet Explorer and Edge do not support colors.
// is webkit? http://stackoverflow.com/a/16459606/376773
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
return false;
} // Is webkit? http://stackoverflow.com/a/16459606/376773
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
// is firebug? http://stackoverflow.com/a/398120/376773
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
// is firefox >= v31? typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
// double check webkit in userAgent just in case we are in a worker typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
} }
/**
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
*/
exports.formatters.j = function(v) {
try {
return JSON.stringify(v);
} catch (err) {
return '[UnexpectedJSONParseError]: ' + err.message;
}
};
/** /**
* Colorize log arguments if enabled. * Colorize log arguments if enabled.
* *
* @api public * @api public
*/ */
function formatArgs(args) { function formatArgs(args) {
var useColors = this.useColors; args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
args[0] = (useColors ? '%c' : '') if (!this.useColors) {
+ this.namespace return;
+ (useColors ? ' %c' : ' ') }
+ args[0]
+ (useColors ? '%c ' : ' ')
+ '+' + exports.humanize(this.diff);
if (!useColors) return;
var c = 'color: ' + this.color; var c = 'color: ' + this.color;
args.splice(1, 0, c, 'color: inherit') args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
// the final "%c" is somewhat tricky, because there could be other
// arguments passed either before or after the %c, so we need to // arguments passed either before or after the %c, so we need to
// figure out the correct index to insert the CSS into // figure out the correct index to insert the CSS into
var index = 0; var index = 0;
var lastC = 0; var lastC = 0;
args[0].replace(/%[a-zA-Z%]/g, function(match) { args[0].replace(/%[a-zA-Z%]/g, function (match) {
if ('%%' === match) return; if (match === '%%') {
return;
}
index++; index++;
if ('%c' === match) {
// we only are interested in the *last* %c if (match === '%c') {
// We only are interested in the *last* %c
// (the user may have provided their own) // (the user may have provided their own)
lastC = index; lastC = index;
} }
}); });
args.splice(lastC, 0, c); args.splice(lastC, 0, c);
} }
/** /**
* Invokes `console.log()` when available. * Invokes `console.log()` when available.
* No-op when `console.log` is not a "function". * No-op when `console.log` is not a "function".
@@ -115,14 +91,14 @@ function formatArgs(args) {
* @api public * @api public
*/ */
function log() {
// this hackery is required for IE8/9, where
// the `console.log` function doesn't have 'apply'
return 'object' === typeof console
&& console.log
&& Function.prototype.apply.call(console.log, console, arguments);
}
function log() {
var _console;
// This hackery is required for IE8/9, where
// the `console.log` function doesn't have 'apply'
return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
}
/** /**
* Save `namespaces`. * Save `namespaces`.
* *
@@ -130,16 +106,18 @@ function log() {
* @api private * @api private
*/ */
function save(namespaces) { function save(namespaces) {
try { try {
if (null == namespaces) { if (namespaces) {
exports.storage.removeItem('debug'); exports.storage.setItem('debug', namespaces);
} else { } else {
exports.storage.debug = namespaces; exports.storage.removeItem('debug');
} }
} catch(e) {} } catch (error) {// Swallow
// XXX (@Qix-) should we be logging these?
}
} }
/** /**
* Load `namespaces`. * Load `namespaces`.
* *
@@ -147,26 +125,23 @@ function save(namespaces) {
* @api private * @api private
*/ */
function load() { function load() {
var r; var r;
try {
r = exports.storage.debug;
} catch(e) {}
try {
r = exports.storage.getItem('debug');
} catch (error) {} // Swallow
// XXX (@Qix-) should we be logging these?
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
if (!r && typeof process !== 'undefined' && 'env' in process) { if (!r && typeof process !== 'undefined' && 'env' in process) {
r = process.env.DEBUG; r = process.env.DEBUG;
} }
return r; return r;
} }
/**
* Enable namespaces listed in `localStorage.debug` initially.
*/
exports.enable(load());
/** /**
* Localstorage attempts to return the localstorage. * Localstorage attempts to return the localstorage.
* *
@@ -178,8 +153,28 @@ exports.enable(load());
* @api private * @api private
*/ */
function localstorage() { function localstorage() {
try { try {
return window.localStorage; // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
} catch (e) {} // The Browser also has localStorage in the global context.
return localStorage;
} catch (error) {// Swallow
// XXX (@Qix-) should we be logging these?
}
} }
module.exports = require('./common')(exports);
var formatters = module.exports.formatters;
/**
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
*/
formatters.j = function (v) {
try {
return JSON.stringify(v);
} catch (error) {
return '[UnexpectedJSONParseError]: ' + error.message;
}
};

View File

@@ -0,0 +1,249 @@
"use strict";
/**
* This is the common logic for both the Node.js and web browser
* implementations of `debug()`.
*/
function setup(env) {
createDebug.debug = createDebug;
createDebug.default = createDebug;
createDebug.coerce = coerce;
createDebug.disable = disable;
createDebug.enable = enable;
createDebug.enabled = enabled;
createDebug.humanize = require('ms');
Object.keys(env).forEach(function (key) {
createDebug[key] = env[key];
});
/**
* Active `debug` instances.
*/
createDebug.instances = [];
/**
* The currently active debug mode names, and names to skip.
*/
createDebug.names = [];
createDebug.skips = [];
/**
* Map of special "%n" handling functions, for the debug "format" argument.
*
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
*/
createDebug.formatters = {};
/**
* Selects a color for a debug namespace
* @param {String} namespace The namespace string for the for the debug instance to be colored
* @return {Number|String} An ANSI color code for the given namespace
* @api private
*/
function selectColor(namespace) {
var hash = 0;
for (var i = 0; i < namespace.length; i++) {
hash = (hash << 5) - hash + namespace.charCodeAt(i);
hash |= 0; // Convert to 32bit integer
}
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
}
createDebug.selectColor = selectColor;
/**
* Create a debugger with the given `namespace`.
*
* @param {String} namespace
* @return {Function}
* @api public
*/
function createDebug(namespace) {
var prevTime;
function debug() {
// Disabled?
if (!debug.enabled) {
return;
}
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var self = debug; // Set `diff` timestamp
var curr = Number(new Date());
var ms = curr - (prevTime || curr);
self.diff = ms;
self.prev = prevTime;
self.curr = curr;
prevTime = curr;
args[0] = createDebug.coerce(args[0]);
if (typeof args[0] !== 'string') {
// Anything else let's inspect with %O
args.unshift('%O');
} // Apply any `formatters` transformations
var index = 0;
args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
// If we encounter an escaped % then don't increase the array index
if (match === '%%') {
return match;
}
index++;
var formatter = createDebug.formatters[format];
if (typeof formatter === 'function') {
var val = args[index];
match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
args.splice(index, 1);
index--;
}
return match;
}); // Apply env-specific formatting (colors, etc.)
createDebug.formatArgs.call(self, args);
var logFn = self.log || createDebug.log;
logFn.apply(self, args);
}
debug.namespace = namespace;
debug.enabled = createDebug.enabled(namespace);
debug.useColors = createDebug.useColors();
debug.color = selectColor(namespace);
debug.destroy = destroy;
debug.extend = extend; // Debug.formatArgs = formatArgs;
// debug.rawLog = rawLog;
// env-specific initialization logic for debug instances
if (typeof createDebug.init === 'function') {
createDebug.init(debug);
}
createDebug.instances.push(debug);
return debug;
}
function destroy() {
var index = createDebug.instances.indexOf(this);
if (index !== -1) {
createDebug.instances.splice(index, 1);
return true;
}
return false;
}
function extend(namespace, delimiter) {
return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
}
/**
* Enables a debug mode by namespaces. This can include modes
* separated by a colon and wildcards.
*
* @param {String} namespaces
* @api public
*/
function enable(namespaces) {
createDebug.save(namespaces);
createDebug.names = [];
createDebug.skips = [];
var i;
var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
var len = split.length;
for (i = 0; i < len; i++) {
if (!split[i]) {
// ignore empty strings
continue;
}
namespaces = split[i].replace(/\*/g, '.*?');
if (namespaces[0] === '-') {
createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
} else {
createDebug.names.push(new RegExp('^' + namespaces + '$'));
}
}
for (i = 0; i < createDebug.instances.length; i++) {
var instance = createDebug.instances[i];
instance.enabled = createDebug.enabled(instance.namespace);
}
}
/**
* Disable debug output.
*
* @api public
*/
function disable() {
createDebug.enable('');
}
/**
* Returns true if the given mode name is enabled, false otherwise.
*
* @param {String} name
* @return {Boolean}
* @api public
*/
function enabled(name) {
if (name[name.length - 1] === '*') {
return true;
}
var i;
var len;
for (i = 0, len = createDebug.skips.length; i < len; i++) {
if (createDebug.skips[i].test(name)) {
return false;
}
}
for (i = 0, len = createDebug.names.length; i < len; i++) {
if (createDebug.names[i].test(name)) {
return true;
}
}
return false;
}
/**
* Coerce `val`.
*
* @param {Mixed} val
* @return {Mixed}
* @api private
*/
function coerce(val) {
if (val instanceof Error) {
return val.stack || val.message;
}
return val;
}
createDebug.enable(createDebug.load());
return createDebug;
}
module.exports = setup;

View File

@@ -1,202 +0,0 @@
/**
* This is the common logic for both the Node.js and web browser
* implementations of `debug()`.
*
* Expose `debug()` as the module.
*/
exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
exports.coerce = coerce;
exports.disable = disable;
exports.enable = enable;
exports.enabled = enabled;
exports.humanize = require('ms');
/**
* The currently active debug mode names, and names to skip.
*/
exports.names = [];
exports.skips = [];
/**
* Map of special "%n" handling functions, for the debug "format" argument.
*
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
*/
exports.formatters = {};
/**
* Previous log timestamp.
*/
var prevTime;
/**
* Select a color.
* @param {String} namespace
* @return {Number}
* @api private
*/
function selectColor(namespace) {
var hash = 0, i;
for (i in namespace) {
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
hash |= 0; // Convert to 32bit integer
}
return exports.colors[Math.abs(hash) % exports.colors.length];
}
/**
* Create a debugger with the given `namespace`.
*
* @param {String} namespace
* @return {Function}
* @api public
*/
function createDebug(namespace) {
function debug() {
// disabled?
if (!debug.enabled) return;
var self = debug;
// set `diff` timestamp
var curr = +new Date();
var ms = curr - (prevTime || curr);
self.diff = ms;
self.prev = prevTime;
self.curr = curr;
prevTime = curr;
// turn the `arguments` into a proper Array
var args = new Array(arguments.length);
for (var i = 0; i < args.length; i++) {
args[i] = arguments[i];
}
args[0] = exports.coerce(args[0]);
if ('string' !== typeof args[0]) {
// anything else let's inspect with %O
args.unshift('%O');
}
// apply any `formatters` transformations
var index = 0;
args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
// if we encounter an escaped % then don't increase the array index
if (match === '%%') return match;
index++;
var formatter = exports.formatters[format];
if ('function' === typeof formatter) {
var val = args[index];
match = formatter.call(self, val);
// now we need to remove `args[index]` since it's inlined in the `format`
args.splice(index, 1);
index--;
}
return match;
});
// apply env-specific formatting (colors, etc.)
exports.formatArgs.call(self, args);
var logFn = debug.log || exports.log || console.log.bind(console);
logFn.apply(self, args);
}
debug.namespace = namespace;
debug.enabled = exports.enabled(namespace);
debug.useColors = exports.useColors();
debug.color = selectColor(namespace);
// env-specific initialization logic for debug instances
if ('function' === typeof exports.init) {
exports.init(debug);
}
return debug;
}
/**
* Enables a debug mode by namespaces. This can include modes
* separated by a colon and wildcards.
*
* @param {String} namespaces
* @api public
*/
function enable(namespaces) {
exports.save(namespaces);
exports.names = [];
exports.skips = [];
var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
var len = split.length;
for (var i = 0; i < len; i++) {
if (!split[i]) continue; // ignore empty strings
namespaces = split[i].replace(/\*/g, '.*?');
if (namespaces[0] === '-') {
exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
} else {
exports.names.push(new RegExp('^' + namespaces + '$'));
}
}
}
/**
* Disable debug output.
*
* @api public
*/
function disable() {
exports.enable('');
}
/**
* Returns true if the given mode name is enabled, false otherwise.
*
* @param {String} name
* @return {Boolean}
* @api public
*/
function enabled(name) {
var i, len;
for (i = 0, len = exports.skips.length; i < len; i++) {
if (exports.skips[i].test(name)) {
return false;
}
}
for (i = 0, len = exports.names.length; i < len; i++) {
if (exports.names[i].test(name)) {
return true;
}
}
return false;
}
/**
* Coerce `val`.
*
* @param {Mixed} val
* @return {Mixed}
* @api private
*/
function coerce(val) {
if (val instanceof Error) return val.stack || val.message;
return val;
}

View File

@@ -1,10 +1,12 @@
"use strict";
/** /**
* Detect Electron renderer process, which is node, but we should * Detect Electron renderer / nwjs process, which is node, but we should
* treat as a browser. * treat as a browser.
*/ */
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
if (typeof process !== 'undefined' && process.type === 'renderer') {
module.exports = require('./browser.js'); module.exports = require('./browser.js');
} else { } else {
module.exports = require('./node.js'); module.exports = require('./node.js');
} }

View File

@@ -1,15 +0,0 @@
module.exports = inspectorLog;
// black hole
const nullStream = new (require('stream').Writable)();
nullStream._write = () => {};
/**
* Outputs a `console.log()` to the Node.js Inspector console *only*.
*/
function inspectorLog() {
const stdout = console._stdout;
console._stdout = nullStream;
console.log.apply(console, arguments);
console._stdout = stdout;
}

View File

@@ -1,134 +1,112 @@
"use strict";
/** /**
* Module dependencies. * Module dependencies.
*/ */
var tty = require('tty'); var tty = require('tty');
var util = require('util');
var util = require('util');
/** /**
* This is the Node.js implementation of `debug()`. * This is the Node.js implementation of `debug()`.
*
* Expose `debug()` as the module.
*/ */
exports = module.exports = require('./debug');
exports.init = init; exports.init = init;
exports.log = log; exports.log = log;
exports.formatArgs = formatArgs; exports.formatArgs = formatArgs;
exports.save = save; exports.save = save;
exports.load = load; exports.load = load;
exports.useColors = useColors; exports.useColors = useColors;
/** /**
* Colors. * Colors.
*/ */
exports.colors = [6, 2, 3, 4, 5, 1]; exports.colors = [6, 2, 3, 4, 5, 1];
try {
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
// eslint-disable-next-line import/no-extraneous-dependencies
var supportsColor = require('supports-color');
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
exports.colors = [20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221];
}
} catch (error) {} // Swallow - we only care if `supports-color` is available; it doesn't have to be.
/** /**
* Build up the default `inspectOpts` object from the environment variables. * Build up the default `inspectOpts` object from the environment variables.
* *
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
*/ */
exports.inspectOpts = Object.keys(process.env).filter(function (key) { exports.inspectOpts = Object.keys(process.env).filter(function (key) {
return /^debug_/i.test(key); return /^debug_/i.test(key);
}).reduce(function (obj, key) { }).reduce(function (obj, key) {
// camel-case // Camel-case
var prop = key var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function (_, k) {
.substring(6) return k.toUpperCase();
.toLowerCase() }); // Coerce string value into JS value
.replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() });
// coerce string value into JS value
var val = process.env[key]; var val = process.env[key];
if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
else if (/^(no|off|false|disabled)$/i.test(val)) val = false; if (/^(yes|on|true|enabled)$/i.test(val)) {
else if (val === 'null') val = null; val = true;
else val = Number(val); } else if (/^(no|off|false|disabled)$/i.test(val)) {
val = false;
} else if (val === 'null') {
val = null;
} else {
val = Number(val);
}
obj[prop] = val; obj[prop] = val;
return obj; return obj;
}, {}); }, {});
/**
* The file descriptor to write the `debug()` calls to.
* Set the `DEBUG_FD` env variable to override with another value. i.e.:
*
* $ DEBUG_FD=3 node script.js 3>debug.log
*/
var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
if (1 !== fd && 2 !== fd) {
util.deprecate(function(){}, 'except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)')()
}
var stream = 1 === fd ? process.stdout :
2 === fd ? process.stderr :
createWritableStdioStream(fd);
/** /**
* Is stdout a TTY? Colored output is enabled when `true`. * Is stdout a TTY? Colored output is enabled when `true`.
*/ */
function useColors() { function useColors() {
return 'colors' in exports.inspectOpts return 'colors' in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
? Boolean(exports.inspectOpts.colors)
: tty.isatty(fd);
} }
/**
* Map %o to `util.inspect()`, all on a single line.
*/
exports.formatters.o = function(v) {
this.inspectOpts.colors = this.useColors;
return util.inspect(v, this.inspectOpts)
.split('\n').map(function(str) {
return str.trim()
}).join(' ');
};
/**
* Map %o to `util.inspect()`, allowing multiple lines if needed.
*/
exports.formatters.O = function(v) {
this.inspectOpts.colors = this.useColors;
return util.inspect(v, this.inspectOpts);
};
/** /**
* Adds ANSI color escape codes if enabled. * Adds ANSI color escape codes if enabled.
* *
* @api public * @api public
*/ */
function formatArgs(args) { function formatArgs(args) {
var name = this.namespace; var name = this.namespace,
var useColors = this.useColors; useColors = this.useColors;
if (useColors) { if (useColors) {
var c = this.color; var c = this.color;
var prefix = ' \u001b[3' + c + ';1m' + name + ' ' + '\u001b[0m'; var colorCode = "\x1B[3" + (c < 8 ? c : '8;5;' + c);
var prefix = " ".concat(colorCode, ";1m").concat(name, " \x1B[0m");
args[0] = prefix + args[0].split('\n').join('\n' + prefix); args[0] = prefix + args[0].split('\n').join('\n' + prefix);
args.push('\u001b[3' + c + 'm+' + exports.humanize(this.diff) + '\u001b[0m'); args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + "\x1B[0m");
} else { } else {
args[0] = new Date().toUTCString() args[0] = getDate() + name + ' ' + args[0];
+ ' ' + name + ' ' + args[0];
} }
} }
function getDate() {
if (exports.inspectOpts.hideDate) {
return '';
}
return new Date().toISOString() + ' ';
}
/** /**
* Invokes `util.format()` with the specified arguments and writes to `stream`. * Invokes `util.format()` with the specified arguments and writes to stderr.
*/ */
function log() {
return stream.write(util.format.apply(util, arguments) + '\n');
}
function log() {
return process.stderr.write(util.format.apply(util, arguments) + '\n');
}
/** /**
* Save `namespaces`. * Save `namespaces`.
* *
@@ -136,16 +114,16 @@ function log() {
* @api private * @api private
*/ */
function save(namespaces) { function save(namespaces) {
if (null == namespaces) { if (namespaces) {
process.env.DEBUG = namespaces;
} else {
// If you set a process.env field to null or undefined, it gets cast to the // If you set a process.env field to null or undefined, it gets cast to the
// string 'null' or 'undefined'. Just delete instead. // string 'null' or 'undefined'. Just delete instead.
delete process.env.DEBUG; delete process.env.DEBUG;
} else {
process.env.DEBUG = namespaces;
} }
} }
/** /**
* Load `namespaces`. * Load `namespaces`.
* *
@@ -153,78 +131,10 @@ function save(namespaces) {
* @api private * @api private
*/ */
function load() { function load() {
return process.env.DEBUG; return process.env.DEBUG;
} }
/**
* Copied from `node/src/node.js`.
*
* XXX: It's lame that node doesn't expose this API out-of-the-box. It also
* relies on the undocumented `tty_wrap.guessHandleType()` which is also lame.
*/
function createWritableStdioStream (fd) {
var stream;
var tty_wrap = process.binding('tty_wrap');
// Note stream._type is used for test-module-load-list.js
switch (tty_wrap.guessHandleType(fd)) {
case 'TTY':
stream = new tty.WriteStream(fd);
stream._type = 'tty';
// Hack to have stream not keep the event loop alive.
// See https://github.com/joyent/node/issues/1726
if (stream._handle && stream._handle.unref) {
stream._handle.unref();
}
break;
case 'FILE':
var fs = require('fs');
stream = new fs.SyncWriteStream(fd, { autoClose: false });
stream._type = 'fs';
break;
case 'PIPE':
case 'TCP':
var net = require('net');
stream = new net.Socket({
fd: fd,
readable: false,
writable: true
});
// FIXME Should probably have an option in net.Socket to create a
// stream from an existing fd which is writable only. But for now
// we'll just add this hack and set the `readable` member to false.
// Test: ./node test/fixtures/echo.js < /etc/passwd
stream.readable = false;
stream.read = null;
stream._type = 'pipe';
// FIXME Hack to have stream not keep the event loop alive.
// See https://github.com/joyent/node/issues/1726
if (stream._handle && stream._handle.unref) {
stream._handle.unref();
}
break;
default:
// Probably an error on in uv_guess_handle()
throw new Error('Implement me. Unknown stream file type!');
}
// For supporting legacy API we put the FD here.
stream.fd = fd;
stream._isStdio = true;
return stream;
}
/** /**
* Init logic for `debug` instances. * Init logic for `debug` instances.
* *
@@ -232,17 +142,36 @@ function createWritableStdioStream (fd) {
* differently for a particular `debug` instance. * differently for a particular `debug` instance.
*/ */
function init (debug) {
debug.inspectOpts = {};
function init(debug) {
debug.inspectOpts = {};
var keys = Object.keys(exports.inspectOpts); var keys = Object.keys(exports.inspectOpts);
for (var i = 0; i < keys.length; i++) { for (var i = 0; i < keys.length; i++) {
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
} }
} }
module.exports = require('./common')(exports);
var formatters = module.exports.formatters;
/** /**
* Enable namespaces listed in `process.env.DEBUG` initially. * Map %o to `util.inspect()`, all on a single line.
*/ */
exports.enable(load()); formatters.o = function (v) {
this.inspectOpts.colors = this.useColors;
return util.inspect(v, this.inspectOpts)
.split('\n')
.map(function (str) { return str.trim(); })
.join(' ');
};
/**
* Map %O to `util.inspect()`, allowing multiple lines if needed.
*/
formatters.O = function (v) {
this.inspectOpts.colors = this.useColors;
return util.inspect(v, this.inspectOpts);
};

View File

@@ -1,152 +0,0 @@
/**
* Helpers.
*/
var s = 1000;
var m = s * 60;
var h = m * 60;
var d = h * 24;
var y = d * 365.25;
/**
* Parse or format the given `val`.
*
* Options:
*
* - `long` verbose formatting [false]
*
* @param {String|Number} val
* @param {Object} [options]
* @throws {Error} throw an error if val is not a non-empty string or a number
* @return {String|Number}
* @api public
*/
module.exports = function(val, options) {
options = options || {};
var type = typeof val;
if (type === 'string' && val.length > 0) {
return parse(val);
} else if (type === 'number' && isNaN(val) === false) {
return options.long ? fmtLong(val) : fmtShort(val);
}
throw new Error(
'val is not a non-empty string or a valid number. val=' +
JSON.stringify(val)
);
};
/**
* Parse the given `str` and return milliseconds.
*
* @param {String} str
* @return {Number}
* @api private
*/
function parse(str) {
str = String(str);
if (str.length > 100) {
return;
}
var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(
str
);
if (!match) {
return;
}
var n = parseFloat(match[1]);
var type = (match[2] || 'ms').toLowerCase();
switch (type) {
case 'years':
case 'year':
case 'yrs':
case 'yr':
case 'y':
return n * y;
case 'days':
case 'day':
case 'd':
return n * d;
case 'hours':
case 'hour':
case 'hrs':
case 'hr':
case 'h':
return n * h;
case 'minutes':
case 'minute':
case 'mins':
case 'min':
case 'm':
return n * m;
case 'seconds':
case 'second':
case 'secs':
case 'sec':
case 's':
return n * s;
case 'milliseconds':
case 'millisecond':
case 'msecs':
case 'msec':
case 'ms':
return n;
default:
return undefined;
}
}
/**
* Short format for `ms`.
*
* @param {Number} ms
* @return {String}
* @api private
*/
function fmtShort(ms) {
if (ms >= d) {
return Math.round(ms / d) + 'd';
}
if (ms >= h) {
return Math.round(ms / h) + 'h';
}
if (ms >= m) {
return Math.round(ms / m) + 'm';
}
if (ms >= s) {
return Math.round(ms / s) + 's';
}
return ms + 'ms';
}
/**
* Long format for `ms`.
*
* @param {Number} ms
* @return {String}
* @api private
*/
function fmtLong(ms) {
return plural(ms, d, 'day') ||
plural(ms, h, 'hour') ||
plural(ms, m, 'minute') ||
plural(ms, s, 'second') ||
ms + ' ms';
}
/**
* Pluralization helper.
*/
function plural(ms, n, name) {
if (ms < n) {
return;
}
if (ms < n * 1.5) {
return Math.floor(ms / n) + ' ' + name;
}
return Math.ceil(ms / n) + ' ' + name + 's';
}

View File

@@ -1,37 +0,0 @@
{
"name": "ms",
"version": "2.0.0",
"description": "Tiny milisecond conversion utility",
"repository": "zeit/ms",
"main": "./index",
"files": [
"index.js"
],
"scripts": {
"precommit": "lint-staged",
"lint": "eslint lib/* bin/*",
"test": "mocha tests.js"
},
"eslintConfig": {
"extends": "eslint:recommended",
"env": {
"node": true,
"es6": true
}
},
"lint-staged": {
"*.js": [
"npm run lint",
"prettier --single-quote --write",
"git add"
]
},
"license": "MIT",
"devDependencies": {
"eslint": "3.19.0",
"expect.js": "0.3.1",
"husky": "0.13.3",
"lint-staged": "3.4.1",
"mocha": "3.4.1"
}
}

View File

@@ -1,51 +0,0 @@
# ms
[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms)
[![Slack Channel](http://zeit-slackin.now.sh/badge.svg)](https://zeit.chat/)
Use this package to easily convert various time formats to milliseconds.
## Examples
```js
ms('2 days') // 172800000
ms('1d') // 86400000
ms('10h') // 36000000
ms('2.5 hrs') // 9000000
ms('2h') // 7200000
ms('1m') // 60000
ms('5s') // 5000
ms('1y') // 31557600000
ms('100') // 100
```
### Convert from milliseconds
```js
ms(60000) // "1m"
ms(2 * 60000) // "2m"
ms(ms('10 hours')) // "10h"
```
### Time format written-out
```js
ms(60000, { long: true }) // "1 minute"
ms(2 * 60000, { long: true }) // "2 minutes"
ms(ms('10 hours'), { long: true }) // "10 hours"
```
## Features
- Works both in [node](https://nodejs.org) and in the browser.
- If a number is supplied to `ms`, a string with a unit is returned.
- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`).
- If you pass a string with a number and a valid unit, the number of equivalent ms is returned.
## Caught a bug?
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
2. Link the package to the global module directory: `npm link`
3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, node will now use your clone of ms!
As always, you can run the tests using: `npm test`

View File

@@ -1,6 +1,6 @@
{ {
"name": "eslint-import-resolver-node", "name": "eslint-import-resolver-node",
"version": "0.3.4", "version": "0.3.5",
"description": "Node default behavior import resolution plugin for eslint-plugin-import.", "description": "Node default behavior import resolution plugin for eslint-plugin-import.",
"main": "index.js", "main": "index.js",
"files": [ "files": [
@@ -14,7 +14,7 @@
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/benmosher/eslint-plugin-import" "url": "https://github.com/import-js/eslint-plugin-import"
}, },
"keywords": [ "keywords": [
"eslint", "eslint",
@@ -26,22 +26,17 @@
"author": "Ben Mosher (me@benmosher.com)", "author": "Ben Mosher (me@benmosher.com)",
"license": "MIT", "license": "MIT",
"bugs": { "bugs": {
"url": "https://github.com/benmosher/eslint-plugin-import/issues" "url": "https://github.com/import-js/eslint-plugin-import/issues"
}, },
"homepage": "https://github.com/benmosher/eslint-plugin-import", "homepage": "https://github.com/import-js/eslint-plugin-import",
"dependencies": { "dependencies": {
"debug": "^2.6.9", "debug": "^3.2.7",
"resolve": "^1.13.1" "resolve": "^1.20.0"
}, },
"devDependencies": { "devDependencies": {
"chai": "^3.5.0", "chai": "^3.5.0",
"coveralls": "^3.0.0", "coveralls": "^3.1.0",
"mocha": "^3.5.3", "mocha": "^3.5.3",
"nyc": "^11.7.1" "nyc": "^11.9.0"
},
"nyc": {
"exclude": [
"test/"
]
} }
} }

5
node_modules/eslint-module-utils/.eslintrc generated vendored Normal file
View File

@@ -0,0 +1,5 @@
{
"parserOptions": {
"ecmaVersion": 6,
},
}

View File

@@ -5,6 +5,11 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
## Unreleased ## Unreleased
## v2.6.2 - 2021-08-08
### Fixed
- Use `context.getPhysicalFilename()` when available (ESLint 7.28+) ([#2160], thanks [@pmcelhaney])
## v2.6.1 - 2021-05-13 ## v2.6.1 - 2021-05-13
### Fixed ### Fixed
@@ -85,33 +90,35 @@ Yanked due to critical issue with cache key resulting from #839.
### Fixed ### Fixed
- `unambiguous.test()` regex is now properly in multiline mode - `unambiguous.test()` regex is now properly in multiline mode
[#2026]: https://github.com/benmosher/eslint-plugin-import/pull/2026 [#2160]: https://github.com/import-js/eslint-plugin-import/pull/2160
[#1786]: https://github.com/benmosher/eslint-plugin-import/pull/1786 [#2026]: https://github.com/import-js/eslint-plugin-import/pull/2026
[#1671]: https://github.com/benmosher/eslint-plugin-import/pull/1671 [#1786]: https://github.com/import-js/eslint-plugin-import/pull/1786
[#1606]: https://github.com/benmosher/eslint-plugin-import/pull/1606 [#1671]: https://github.com/import-js/eslint-plugin-import/pull/1671
[#1602]: https://github.com/benmosher/eslint-plugin-import/pull/1602 [#1606]: https://github.com/import-js/eslint-plugin-import/pull/1606
[#1591]: https://github.com/benmosher/eslint-plugin-import/pull/1591 [#1602]: https://github.com/import-js/eslint-plugin-import/pull/1602
[#1551]: https://github.com/benmosher/eslint-plugin-import/pull/1551 [#1591]: https://github.com/import-js/eslint-plugin-import/pull/1591
[#1435]: https://github.com/benmosher/eslint-plugin-import/pull/1435 [#1551]: https://github.com/import-js/eslint-plugin-import/pull/1551
[#1409]: https://github.com/benmosher/eslint-plugin-import/pull/1409 [#1435]: https://github.com/import-js/eslint-plugin-import/pull/1435
[#1356]: https://github.com/benmosher/eslint-plugin-import/pull/1356 [#1409]: https://github.com/import-js/eslint-plugin-import/pull/1409
[#1290]: https://github.com/benmosher/eslint-plugin-import/pull/1290 [#1356]: https://github.com/import-js/eslint-plugin-import/pull/1356
[#1218]: https://github.com/benmosher/eslint-plugin-import/pull/1218 [#1290]: https://github.com/import-js/eslint-plugin-import/pull/1290
[#1166]: https://github.com/benmosher/eslint-plugin-import/issues/1166 [#1218]: https://github.com/import-js/eslint-plugin-import/pull/1218
[#1160]: https://github.com/benmosher/eslint-plugin-import/pull/1160 [#1166]: https://github.com/import-js/eslint-plugin-import/issues/1166
[#1035]: https://github.com/benmosher/eslint-plugin-import/issues/1035 [#1160]: https://github.com/import-js/eslint-plugin-import/pull/1160
[#599]: https://github.com/benmosher/eslint-plugin-import/pull/599 [#1035]: https://github.com/import-js/eslint-plugin-import/issues/1035
[#599]: https://github.com/import-js/eslint-plugin-import/pull/599
[@hulkish]: https://github.com/hulkish [@aladdin-add]: https://github.com/aladdin-add
[@timkraut]: https://github.com/timkraut
[@vikr01]: https://github.com/vikr01
[@bradzacher]: https://github.com/bradzacher
[@christophercurrie]: https://github.com/christophercurrie
[@brettz9]: https://github.com/brettz9
[@JounQin]: https://github.com/JounQin
[@arcanis]: https://github.com/arcanis [@arcanis]: https://github.com/arcanis
[@sompylasar]: https://github.com/sompylasar [@bradzacher]: https://github.com/bradzacher
[@brettz9]: https://github.com/brettz9
[@christophercurrie]: https://github.com/christophercurrie
[@hulkish]: https://github.com/hulkish
[@iamnapo]: https://github.com/iamnapo [@iamnapo]: https://github.com/iamnapo
[@JounQin]: https://github.com/JounQin
[@kaiyoma]: https://github.com/kaiyoma [@kaiyoma]: https://github.com/kaiyoma
[@manuth]: https://github.com/manuth [@manuth]: https://github.com/manuth
[@aladdin-add]: https://github.com/aladdin-add [@pmcelhaney]: https://github.com/pmcelhaney
[@sompylasar]: https://github.com/sompylasar
[@timkraut]: https://github.com/timkraut
[@vikr01]: https://github.com/vikr01

View File

@@ -1,6 +1,6 @@
{ {
"name": "eslint-module-utils", "name": "eslint-module-utils",
"version": "2.6.1", "version": "2.6.2",
"description": "Core utilities to support eslint-plugin-import and other module-related plugins.", "description": "Core utilities to support eslint-plugin-import and other module-related plugins.",
"engines": { "engines": {
"node": ">=4" "node": ">=4"
@@ -11,7 +11,7 @@
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/benmosher/eslint-plugin-import.git" "url": "git+https://github.com/import-js/eslint-plugin-import.git"
}, },
"keywords": [ "keywords": [
"eslint-plugin-import", "eslint-plugin-import",
@@ -22,9 +22,9 @@
"author": "Ben Mosher <me@benmosher.com>", "author": "Ben Mosher <me@benmosher.com>",
"license": "MIT", "license": "MIT",
"bugs": { "bugs": {
"url": "https://github.com/benmosher/eslint-plugin-import/issues" "url": "https://github.com/import-js/eslint-plugin-import/issues"
}, },
"homepage": "https://github.com/benmosher/eslint-plugin-import#readme", "homepage": "https://github.com/import-js/eslint-plugin-import#readme",
"dependencies": { "dependencies": {
"debug": "^3.2.7", "debug": "^3.2.7",
"pkg-dir": "^2.0.0" "pkg-dir": "^2.0.0"

View File

@@ -35,7 +35,7 @@ exports.default = function parse(path, content, context) {
// @typescript-eslint/parser will parse the entire project with typechecking if you provide // @typescript-eslint/parser will parse the entire project with typechecking if you provide
// "project" or "projects" in parserOptions. Removing these options means the parser will // "project" or "projects" in parserOptions. Removing these options means the parser will
// only parse one file in isolate mode, which is much, much faster. // only parse one file in isolate mode, which is much, much faster.
// https://github.com/benmosher/eslint-plugin-import/issues/1408#issuecomment-509298962 // https://github.com/import-js/eslint-plugin-import/issues/1408#issuecomment-509298962
delete parserOptions.project; delete parserOptions.project;
delete parserOptions.projects; delete parserOptions.projects;
@@ -52,11 +52,7 @@ exports.default = function parse(path, content, context) {
console.warn('Line ' + e.lineNumber + ', column ' + e.column + ': ' + e.message); console.warn('Line ' + e.lineNumber + ', column ' + e.column + ': ' + e.message);
} }
if (!ast || typeof ast !== 'object') { if (!ast || typeof ast !== 'object') {
console.warn( console.warn('`parseForESLint` from parser `' + parserPath + '` is invalid and will just be ignored');
'`parseForESLint` from parser `' +
parserPath +
'` is invalid and will just be ignored'
);
} else { } else {
return ast; return ast;
} }

View File

@@ -217,10 +217,7 @@ const erroredContexts = new Set();
*/ */
function resolve(p, context) { function resolve(p, context) {
try { try {
return relative( p return relative(p, context.getPhysicalFilename ? context.getPhysicalFilename() : context.getFilename(), context.settings);
, context.getFilename()
, context.settings
);
} catch (err) { } catch (err) {
if (!erroredContexts.has(context)) { if (!erroredContexts.has(context)) {
// The `err.stack` string starts with `err.name` followed by colon and `err.message`. // The `err.stack` string starts with `err.name` followed by colon and `err.message`.

View File

@@ -13,6 +13,14 @@ module.exports = {
'github/unescaped-html-literal': 'error', 'github/unescaped-html-literal': 'error',
'github/no-useless-passive': 'error', 'github/no-useless-passive': 'error',
'github/require-passive-events': 'error', 'github/require-passive-events': 'error',
'github/prefer-observers': 'error' 'github/prefer-observers': 'error',
'import/no-nodejs-modules': 'error',
'no-restricted-syntax': [
'error',
{
selector: "NewExpression[callee.name='URL'][arguments.length=1]",
message: 'Please pass in `window.location.origin` as the 2nd argument to `new URL()`'
}
]
} }
} }

View File

@@ -8,7 +8,7 @@ module.exports = {
env: { env: {
es6: true es6: true
}, },
plugins: ['github', 'prettier', 'eslint-comments', 'import'], plugins: ['github', 'prettier', 'eslint-comments', 'import', 'filenames', 'i18n-text', 'no-only-tests'],
rules: { rules: {
'constructor-super': 'error', 'constructor-super': 'error',
'eslint-comments/disable-enable-pair': 'off', 'eslint-comments/disable-enable-pair': 'off',
@@ -18,16 +18,20 @@ module.exports = {
'eslint-comments/no-unused-disable': 'error', 'eslint-comments/no-unused-disable': 'error',
'eslint-comments/no-unused-enable': 'error', 'eslint-comments/no-unused-enable': 'error',
'eslint-comments/no-use': ['error', {allow: ['eslint', 'eslint-disable-next-line', 'eslint-env', 'globals']}], 'eslint-comments/no-use': ['error', {allow: ['eslint', 'eslint-disable-next-line', 'eslint-env', 'globals']}],
'filenames/match-regex': ['error', '^[a-z0-9-]+(.d)?$'],
'func-style': ['error', 'declaration', {allowArrowFunctions: true}], 'func-style': ['error', 'declaration', {allowArrowFunctions: true}],
'github/array-foreach': 'error', 'github/array-foreach': 'error',
'github/no-implicit-buggy-globals': 'error', 'github/no-implicit-buggy-globals': 'error',
'github/no-then': 'error', 'github/no-then': 'error',
'i18n-text/no-en': ['error'],
'import/default': 'error', 'import/default': 'error',
'import/export': 'error', 'import/export': 'error',
'import/extensions': 'error',
'import/first': 'error', 'import/first': 'error',
'import/named': 'error', 'import/named': 'error',
'import/namespace': 'error', 'import/namespace': 'error',
'import/no-absolute-path': 'error', 'import/no-absolute-path': 'error',
'import/no-amd': 'error',
'import/no-anonymous-default-export': [ 'import/no-anonymous-default-export': [
'error', 'error',
{ {
@@ -39,12 +43,17 @@ module.exports = {
allowObject: true allowObject: true
} }
], ],
'import/no-commonjs': 'error',
'import/no-deprecated': 'error', 'import/no-deprecated': 'error',
'import/no-duplicates': 'error', 'import/no-duplicates': 'error',
'import/no-dynamic-require': 'error',
'import/no-extraneous-dependencies': [0, {devDependencies: false}],
'import/no-mutable-exports': 'error', 'import/no-mutable-exports': 'error',
'import/no-named-as-default': 'error', 'import/no-named-as-default': 'error',
'import/no-named-as-default-member': 'error', 'import/no-named-as-default-member': 'error',
'import/no-namespace': 'error', 'import/no-namespace': 'error',
'import/no-unresolved': 'error',
'import/no-webpack-loader-syntax': 'error',
'no-case-declarations': 'error', 'no-case-declarations': 'error',
'no-class-assign': 'error', 'no-class-assign': 'error',
'no-compare-neg-zero': 'error', 'no-compare-neg-zero': 'error',
@@ -76,10 +85,17 @@ module.exports = {
'no-new-symbol': 'error', 'no-new-symbol': 'error',
'no-obj-calls': 'error', 'no-obj-calls': 'error',
'no-octal': 'error', 'no-octal': 'error',
'no-only-tests/no-only-tests': [
'error',
{
block: ['describe', 'it', 'context', 'test', 'tape', 'fixture', 'serial', 'suite']
}
],
'no-redeclare': 'error', 'no-redeclare': 'error',
'no-regex-spaces': 'error', 'no-regex-spaces': 'error',
'no-return-assign': 'error', 'no-return-assign': 'error',
'no-self-assign': 'error', 'no-self-assign': 'error',
'no-sequences': ['error'],
'no-shadow': 'error', 'no-shadow': 'error',
'no-sparse-arrays': 'error', 'no-sparse-arrays': 'error',
'no-this-before-super': 'error', 'no-this-before-super': 'error',
@@ -94,6 +110,7 @@ module.exports = {
'no-useless-escape': 'error', 'no-useless-escape': 'error',
'no-var': 'error', 'no-var': 'error',
'object-shorthand': ['error', 'always', {avoidQuotes: true}], 'object-shorthand': ['error', 'always', {avoidQuotes: true}],
'one-var': ['error', 'never'],
'prefer-const': 'error', 'prefer-const': 'error',
'prefer-promise-reject-errors': 'error', 'prefer-promise-reject-errors': 'error',
'prefer-rest-params': 'error', 'prefer-rest-params': 'error',
@@ -101,6 +118,7 @@ module.exports = {
'prefer-template': 'error', 'prefer-template': 'error',
'prettier/prettier': 'error', 'prettier/prettier': 'error',
'require-yield': 'error', 'require-yield': 'error',
'sort-imports': 'error',
'use-isnan': 'error', 'use-isnan': 'error',
'valid-typeof': 'error', 'valid-typeof': 'error',
camelcase: ['error', {properties: 'always'}], camelcase: ['error', {properties: 'always'}],

View File

@@ -1,6 +1,6 @@
{ {
"name": "eslint-plugin-github", "name": "eslint-plugin-github",
"version": "4.1.5", "version": "4.2.0",
"description": "An opinionated collection of ESLint shared configs and rules used by GitHub.", "description": "An opinionated collection of ESLint shared configs and rules used by GitHub.",
"main": "lib/index.js", "main": "lib/index.js",
"entries": [ "entries": [
@@ -29,7 +29,10 @@
"@typescript-eslint/parser": "^4.20.0", "@typescript-eslint/parser": "^4.20.0",
"eslint-config-prettier": ">=8.0.0", "eslint-config-prettier": ">=8.0.0",
"eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-i18n-text": "^1.0.1",
"eslint-plugin-import": "^2.22.1", "eslint-plugin-import": "^2.22.1",
"eslint-plugin-no-only-tests": "^2.6.0",
"eslint-plugin-prettier": "^3.3.1", "eslint-plugin-prettier": "^3.3.1",
"eslint-rule-documentation": ">=1.0.0", "eslint-rule-documentation": ">=1.0.0",
"prettier": "^2.2.1", "prettier": "^2.2.1",

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