├── .eslintignore ├── .eslintrc.js ├── .gitattributes ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── enhancement.md ├── dependabot.yml ├── pull_request_template.md └── workflows │ ├── action-testing.yml │ ├── release-action.yml │ └── unit-testing.yml ├── .gitignore ├── .nvmrc ├── .prettierignore ├── .prettierrc.json ├── CHANGELOG.md ├── LICENSE ├── README.md ├── __test__ └── input-helper.test.ts ├── action.yml ├── dist ├── index.js ├── index.js.map ├── licenses.txt └── sourcemap-register.js ├── jest.config.js ├── package-lock.json ├── package.json ├── src ├── action-inputs.ts ├── commits-info.ts ├── constants.ts ├── input-helper.ts └── main.ts ├── tsconfig.eslint.json └── tsconfig.json /.eslintignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | lib/ 3 | node_modules/ -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: [ 3 | "plugin:@typescript-eslint/recommended", 4 | "plugin:@typescript-eslint/recommended-requiring-type-checking", 5 | "plugin:jest/recommended" 6 | ], 7 | parser: "@typescript-eslint/parser", 8 | parserOptions: { 9 | project: "tsconfig.eslint.json", 10 | sourceType: "module", 11 | }, 12 | plugins: [ 13 | "jest", 14 | "@typescript-eslint", 15 | "eslint-plugin-deprecation", 16 | "eslint-plugin-import", 17 | ], 18 | rules: { 19 | "no-sequences": "error", 20 | "no-param-reassign": "error", 21 | "no-unused-labels": "error", 22 | "no-cond-assign": "error", 23 | "no-new-wrappers": "error", 24 | "constructor-super": "error", 25 | "no-duplicate-case": "error", 26 | "no-redeclare": "error", 27 | "no-shadow": [ 28 | "error", 29 | { 30 | hoist: "all", 31 | }, 32 | ], 33 | "no-empty": [ 34 | "error", 35 | { 36 | allowEmptyCatch: true, 37 | }, 38 | ], 39 | "no-invalid-this": "error", 40 | "no-unsafe-finally": "error", 41 | "no-var": "warn", 42 | "no-console": "off", 43 | "eqeqeq": ["warn", "always"], 44 | "prefer-const": "error", 45 | "deprecation/deprecation": "warn", 46 | "import/no-extraneous-dependencies": "error", 47 | "import/no-duplicates": "warn", 48 | "import/no-unassigned-import": "warn", 49 | "import/no-internal-modules": "off", 50 | "@typescript-eslint/adjacent-overload-signatures": "error", 51 | "@typescript-eslint/no-namespace": "error", 52 | "@typescript-eslint/triple-slash-reference": [ 53 | "error", 54 | { 55 | path: "always", 56 | types: "prefer-import", 57 | lib: "always", 58 | }, 59 | ], 60 | "@typescript-eslint/no-unnecessary-type-assertion": "error", 61 | "@typescript-eslint/no-floating-promises": "error", 62 | "@typescript-eslint/no-throw-literal": "error", 63 | "@typescript-eslint/no-confusing-void-expression": "error", 64 | "@typescript-eslint/no-empty-interface": "warn", 65 | "@typescript-eslint/prefer-for-of": "warn", 66 | "@typescript-eslint/unified-signatures": "warn", 67 | "@typescript-eslint/no-unsafe-assignment": "error" 68 | }, 69 | env: { 70 | "node": true, 71 | }, 72 | } -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Marks the files under dist folder as generated, therefore not acknowledging them in diffs and language counters in GitHub. 2 | # Check https://github.com/github/linguist#overrides for details. 3 | dist/** -diff linguist-generated=true -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # This is a comment. 2 | # Each line is a file pattern followed by one or more owners. 3 | 4 | * @adriangl -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help improve the action 4 | title: '' 5 | labels: bug 6 | assignees: adriangl 7 | 8 | --- 9 | 10 | **SW details (please complete the following information):** 11 | - Action Version [e.g. 1.0.0] 12 | 13 | **Summary and background of the bug** 14 | A clear and concise description of what the bug is. 15 | 16 | **Steps to reproduce** 17 | Steps to reproduce the behavior: 18 | 1. I set up the following configuration 19 | 2. I sync the strings 20 | 3. See error 21 | 22 | Also attach notes or stack traces if applicable. 23 | 24 | **Expected behavior** 25 | A clear and concise description of what you expected to happen. 26 | 27 | **Current behavior** 28 | The summary of what currently happens in your use case. 29 | 30 | **Additional context** 31 | Add any other context about the problem here. -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/enhancement.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Enhancement 3 | about: Create a report to propose new features and improvements 4 | title: '' 5 | labels: enhancement 6 | assignees: adriangl 7 | 8 | --- 9 | 10 | **Summary and context of the enhancement** 11 | A clear and concise description of what the enhancement is and why it 12 | should be added. 13 | 14 | **Suggested implementation** 15 | Add suggestions about how the enhancement should be implemented. 16 | 17 | **Additional documentation** 18 | Useful links to review the enhancement. -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | # Enable version updates for npm 4 | - package-ecosystem: "npm" 5 | # Look for `package.json` and `lock` files in the `root` directory 6 | directory: "/" 7 | # Check the npm registry for updates every month 8 | schedule: 9 | interval: "monthly" 10 | # Updates for Github Actions used in the repo 11 | - package-ecosystem: "github-actions" 12 | directory: "/" 13 | schedule: 14 | interval: "monthly" 15 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ### Github issue (delete if this does not apply) 2 | Resolves #change_me_issue_number 3 | 4 | ### PR's key points 5 | 6 | ### How to review this PR? 7 | 8 | ### Related Issues (delete if this does not apply) 9 | 10 | ### Definition of Done 11 | - [ ] Tests added (if new code is added) 12 | - [ ] There is no outcommented or debug code left -------------------------------------------------------------------------------- /.github/workflows/action-testing.yml: -------------------------------------------------------------------------------- 1 | name: Action testing 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - master 7 | - 'releases/*' 8 | 9 | jobs: 10 | # We need to do different set-ups if we run the job locally using act or being run in GitHub Actions 11 | # Check: https://github.com/nektos/act/issues/228 for details 12 | action-tests: 13 | name: Run the action against the base repo 14 | runs-on: ubuntu-latest 15 | steps: 16 | - name: 🏠 Checkout locally 17 | if: ${{ env.ACT }} 18 | uses: actions/checkout@v3 19 | with: 20 | path: check-new-commits-action 21 | - name: 💻 Checkout from GitHub 22 | if: ${{ !env.ACT }} 23 | uses: actions/checkout@v3 24 | - name: 🔄 Test the action with currrent repo content 25 | id: check-new-commits 26 | uses: ./ 27 | with: 28 | token: ${{ secrets.GITHUB_TOKEN }} 29 | branch: master 30 | seconds: 86400 # one day 31 | - if: ${{ steps.check-new-commits.outputs.has-new-commits == 'true' }} 32 | run: echo "You have ${{ steps.check-new-commits.outputs.new-commits-number }} new commit(s) ✅!" 33 | - if: ${{ steps.check-new-commits.outputs.has-new-commits != 'true' }} 34 | run: echo "You don't have new commits 🛑!" 35 | -------------------------------------------------------------------------------- /.github/workflows/release-action.yml: -------------------------------------------------------------------------------- 1 | name: Release Action version 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | cancel-previous-runs: 8 | name: Cancel previous runs 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: ⏹ Cancel Previous Runs 12 | uses: styfle/cancel-workflow-action@0.11.0 13 | with: 14 | access_token: ${{ secrets.GITHUB_TOKEN }} 15 | 16 | create-release: 17 | name: Create a release of the action 18 | runs-on: ubuntu-latest 19 | steps: 20 | - name: 💻 Checkout 21 | uses: actions/checkout@v3 22 | with: 23 | ref: master 24 | fetch-depth: 0 25 | - name: 🔨 Read .nvmrc 26 | id: read_nvmrc 27 | run: | 28 | echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT 29 | - name: 🔨 Setup node 30 | uses: actions/setup-node@v3.5.1 31 | with: 32 | node-version: ${{ steps.read_nvmrc.outputs.NODE_VERSION }} 33 | - name: 🔨 Get npm cache directory 34 | id: npm-cache 35 | run: | 36 | echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT 37 | - name: 🔨 Cache dependencies 38 | uses: actions/cache@v3.0.11 39 | with: 40 | path: ${{ steps.npm-cache.outputs.dir }} 41 | key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} 42 | restore-keys: | 43 | ${{ runner.os }}-node- 44 | - name: 🚧 Install dependencies 45 | run: npm ci 46 | - name: 📦 Package the binary release 47 | run: npm run all 48 | - name: 🏷 Create the binary release metadata 49 | id: create-tags 50 | run: | 51 | # We use the e-mail mentioned here: https://github.community/t/github-actions-bot-email-address/17204/6 52 | git config user.email "41898282+github-actions[bot]@users.noreply.github.com" 53 | git config user.name "github-actions" 54 | 55 | npm run release 56 | 57 | TAG=$(git describe --tags --abbrev=0) # Works since vX.Y.Z tags are annotated and won't pick the vX tags, which are not 58 | echo "tag=${TAG}" >> $GITHUB_OUTPUT # saved as output of the step 59 | - name: ⏫ Push changes to GitHub 60 | uses: ad-m/github-push-action@v0.6.0 61 | with: 62 | github_token: ${{ secrets.GITHUB_TOKEN }} 63 | branch: master 64 | tags: true 65 | force: true 66 | - name: 📝 Create changelog for GitHub release 67 | run: | 68 | # We first need to remove the header text, and then process it with rexreplace to obtain a proper release changelog 69 | # Reference: https://github.com/conventional-changelog/standard-version/issues/568 70 | tail -n +5 CHANGELOG.md | npx rexreplace "^.*?#+\s\[.*?\n.*?(?=\s*#+\s\[)" "_" -s -M -G -m -o > CHANGELOG-LATEST.md 71 | - name: 🚀 Create a release in GitHub 72 | id: create-gh-release 73 | uses: actions/create-release@v1 74 | env: 75 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 76 | with: 77 | tag_name: ${{ steps.create-tags.outputs.tag }} 78 | release_name: ${{ steps.create-tags.outputs.tag }} 79 | body_path: CHANGELOG-LATEST.md 80 | draft: false 81 | prerelease: false -------------------------------------------------------------------------------- /.github/workflows/unit-testing.yml: -------------------------------------------------------------------------------- 1 | name: Unit testing 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - master 7 | - 'releases/*' 8 | 9 | jobs: 10 | cancel-previous-runs: 11 | name: Cancel previous runs 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: ⏹ Cancel Previous Runs 15 | uses: styfle/cancel-workflow-action@0.11.0 16 | with: 17 | access_token: ${{ secrets.GITHUB_TOKEN }} 18 | 19 | unit-tests: 20 | name: Run unit tests in the project 21 | runs-on: ubuntu-latest 22 | steps: 23 | - name: 💻 Checkout 24 | uses: actions/checkout@v3 25 | - name: 🔨 Read .nvmrc 26 | id: read_nvmrc 27 | run: | 28 | echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT 29 | - name: 🔨 Setup node 30 | uses: actions/setup-node@v3.5.1 31 | with: 32 | node-version: ${{ steps.read_nvmrc.outputs.NODE_VERSION }} 33 | - name: 🔨 Get npm cache directory 34 | id: npm-cache 35 | run: | 36 | echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT 37 | - name: 🔨 Cache dependencies 38 | uses: actions/cache@v3.0.11 39 | with: 40 | path: ${{ steps.npm-cache.outputs.dir }} 41 | key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} 42 | restore-keys: | 43 | ${{ runner.os }}-node- 44 | - name: 🚧 Install dependencies 45 | run: npm ci 46 | - name: 🔄 Run tests 47 | run: npm test -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Dependency directory 2 | node_modules 3 | 4 | # Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | yarn-debug.log* 10 | yarn-error.log* 11 | lerna-debug.log* 12 | 13 | # Diagnostic reports (https://nodejs.org/api/report.html) 14 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 15 | 16 | # Runtime data 17 | pids 18 | *.pid 19 | *.seed 20 | *.pid.lock 21 | 22 | # Directory for instrumented libs generated by jscoverage/JSCover 23 | lib-cov 24 | 25 | # Coverage directory used by tools like istanbul 26 | coverage 27 | *.lcov 28 | 29 | # nyc test coverage 30 | .nyc_output 31 | 32 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 33 | .grunt 34 | 35 | # Bower dependency directory (https://bower.io/) 36 | bower_components 37 | 38 | # node-waf configuration 39 | .lock-wscript 40 | 41 | # Compiled binary addons (https://nodejs.org/api/addons.html) 42 | build/Release 43 | 44 | # Dependency directories 45 | jspm_packages/ 46 | 47 | # TypeScript v1 declaration files 48 | typings/ 49 | 50 | # TypeScript cache 51 | *.tsbuildinfo 52 | 53 | # Optional npm cache directory 54 | .npm 55 | 56 | # Optional eslint cache 57 | .eslintcache 58 | 59 | # Optional REPL history 60 | .node_repl_history 61 | 62 | # Output of 'npm pack' 63 | *.tgz 64 | 65 | # Yarn Integrity file 66 | .yarn-integrity 67 | 68 | # dotenv environment variables file 69 | .env 70 | .env.test 71 | 72 | # parcel-bundler cache (https://parceljs.org/) 73 | .cache 74 | 75 | # next.js build output 76 | .next 77 | 78 | # nuxt.js build output 79 | .nuxt 80 | 81 | # vuepress build output 82 | .vuepress/dist 83 | 84 | # Serverless directories 85 | .serverless/ 86 | 87 | # FuseBox cache 88 | .fusebox/ 89 | 90 | # DynamoDB Local files 91 | .dynamodb/ 92 | 93 | # OS metadata 94 | .DS_Store 95 | Thumbs.db 96 | 97 | # Ignore built ts files 98 | __tests__/runner/* 99 | lib/**/* 100 | 101 | # Environment variables file 102 | .env 103 | 104 | # GitHub Secrets file used by nektos/act 105 | .secrets 106 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 20.15.0 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # Ignore artifacts: 2 | lib 3 | build 4 | coverage -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 80, 3 | "tabWidth": 4, 4 | "useTabs": false, 5 | "semi": false, 6 | "singleQuote": false, 7 | "bracketSpacing": true, 8 | "arrowParens": "always" 9 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. 4 | 5 | ### [1.0.7](https://github.com/adriangl/check-new-commits-action/compare/v1.0.6...v1.0.7) (2024-07-09) 6 | 7 | ### [1.0.6](https://github.com/adriangl/check-new-commits-action/compare/v1.0.5...v1.0.6) (2023-02-12) 8 | 9 | ### [1.0.5](https://github.com/adriangl/check-new-commits-action/compare/v1.0.4...v1.0.5) (2022-12-27) 10 | 11 | ### [1.0.4](https://github.com/adriangl/check-new-commits-action/compare/v1.0.3...v1.0.4) (2022-12-27) 12 | 13 | ### [1.0.3](https://github.com/adriangl/check-new-commits-action/compare/v1.0.2...v1.0.3) (2021-02-15) 14 | 15 | ### [1.0.2](https://github.com/adriangl/check-new-commits-action/compare/v1.0.1...v1.0.2) (2021-02-01) 16 | 17 | ### [1.0.1](https://github.com/adriangl/check-new-commits-action/compare/v1.0.0...v1.0.1) (2021-01-06) 18 | 19 | ## 1.0.0 (2021-01-06) 20 | 21 | 22 | ### Features 23 | 24 | * Initial release ([1de649e](https://github.com/adriangl/check-new-commits-action/commit/1de649e9a81139d694ecd2f9366cc824aeb990b3)) 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Adrián García 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![check-new-commits-action status](https://github.com/adriangl/check-new-commits-action/workflows/Unit%20testing/badge.svg)](https://github.com/adriangl/check-new-commits-action/actions) 2 | 3 | # Check new commits action 4 | 5 | This action checks if new commits have been added to a branch in an specified time interval by checking the commits added using the GitHub REST API. 6 | 7 | ## Usage 8 | 9 | ```yaml 10 | - name: Check for new commits today 11 | id: check-new-commits 12 | uses: adriangl/check-new-commits-action@v1 13 | with: 14 | token: 'your_github_token' 15 | seconds: 86400 # One day in seconds 16 | branch: 'master' 17 | - name: Print something if new commits are found 18 | if: ${{ steps.check-new-commits.outputs.has-new-commits == 'true' }} 19 | run: echo "You have ${{ steps.check-new-commits.outputs.new-commits-number }} new commit(s) ✅!" 20 | - name: Print another thing if new commits couldn't be found 21 | if: ${{ steps.check-new-commits.outputs.has-new-commits != 'true' }} 22 | run: echo "You don't have new commits 🛑!" 23 | ``` 24 | 25 | ## Inputs 26 | These are all the possible inputs that the action works with: 27 | 28 | Attribute | Description 29 | ------------------------------|----------------------------------------- 30 | ```token``` | Access token used to access the GitHub API. You can either use the default 31 | ```seconds``` | (Optional) The seconds interval that the action will use to check if there have been new commits. 32 | ```branch``` | (Optional) The branch to check for new commits. When checking out the repository that triggered a workflow, this defaults to the reference or SHA for that event. Otherwise, uses the default branch. 33 | 34 | ## Outputs 35 | The action will dump data about the commits found in some output variables, which are: 36 | 37 | Attribute | Description 38 | ------------------------------|----------------------------------------- 39 | ```has-new-commits``` | Whether or not new commits have been found for the required time interval as a boolean value (true or false). 40 | ```new-commits-number``` | The number of new commits found for the given interval. It will be 0 if no new commits could be found. 41 | 42 | ## Development 43 | ### Installing the required tools 44 | * Install [nvm](https://github.com/nvm-sh/nvm#installing-and-updating). 45 | 46 | * Set-up `nvm` with: 47 | ```shell 48 | nvm install 49 | ``` 50 | 51 | * Install the dependencies with `npm`: 52 | ```shell 53 | npm install 54 | ``` 55 | ### Daily development workflow 56 | * Start your terminal session with: 57 | ```shell 58 | nvm use 59 | ``` 60 | 61 | * Check packages to upgrade with: 62 | ```shell 63 | npx ncu 64 | ``` 65 | 66 | * Update packages with: 67 | ```shell 68 | npm update 69 | ``` 70 | 71 | * When you add new features, build the TypeScript code: 72 | ```bash 73 | npm run build 74 | ``` 75 | 76 | * And then, run the unit tests: 77 | ```bash 78 | npm test 79 | ``` 80 | 81 | ### Testing the action locally 82 | * Install [Docker Desktop](https://www.docker.com/get-started). 83 | * Install [act](https://github.com/nektos/act). 84 | * Create a `.secrets` file in the root of the project with the following: 85 | ```shell 86 | GITHUB_TOKEN="a GitHub token with repo access" 87 | ``` 88 | * Create an `.env` file in the root of the project with the following content: 89 | ```shell 90 | ACT=true # Should be set by act automatically 91 | ``` 92 | * Run the test action with: 93 | ```shell 94 | npm run act 95 | ``` 96 | 97 | ## Publishing 98 | ### Package and test all the code 99 | * Run all checks in the project and package it: 100 | ```shell 101 | npm run all 102 | ``` 103 | ### Versioning 104 | * Use `standard-version` to generate releases and changelogs for the new version from conventional commits syntax: 105 | ```shell 106 | npm run release 107 | ``` 108 | * The script handles generating tags for the current release and for the current major release, as specified in the [versioning documentation](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md). 109 | 110 | ## No affiliation with GitHub Inc. 111 | GitHub are registered trademarks of GitHub, Inc. GitHub name used in this project are for identification purposes only. The project is not associated in any way with GitHub Inc. and is not an official solution of GitHub Inc. It was made available in order to facilitate the use of the site GitHub. 112 | 113 | ## License 114 | The scripts and documentation in this project are released under the [MIT License](LICENSE) 115 | 116 | ``` 117 | MIT License 118 | 119 | Copyright (c) 2020 Adrián García 120 | 121 | Permission is hereby granted, free of charge, to any person obtaining a copy 122 | of this software and associated documentation files (the "Software"), to deal 123 | in the Software without restriction, including without limitation the rights 124 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 125 | copies of the Software, and to permit persons to whom the Software is 126 | furnished to do so, subject to the following conditions: 127 | 128 | The above copyright notice and this permission notice shall be included in all 129 | copies or substantial portions of the Software. 130 | 131 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 132 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 133 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 134 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 135 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 136 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 137 | SOFTWARE. 138 | ``` 139 | -------------------------------------------------------------------------------- /__test__/input-helper.test.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access */ 2 | import * as core from "@actions/core" 3 | import * as github from "@actions/github" 4 | import * as inputHelper from "../src/input-helper" 5 | import { ActionInputs } from "../src/action-inputs" 6 | import { INPUT_BRANCH } from "../src/constants" 7 | 8 | // Inputs for mock @actions/core 9 | /* eslint-disable @typescript-eslint/no-explicit-any */ 10 | let inputs = {} as any 11 | 12 | // Shallow clone original @actions/github context 13 | const originalContext = { ...github.context } 14 | 15 | describe("input-helper tests", () => { 16 | beforeAll(() => { 17 | // Mock getInput 18 | jest.spyOn(core, "getInput").mockImplementation((name: string) => { 19 | return inputs[name] 20 | }) 21 | 22 | // Mock error/warning/info/debug 23 | jest.spyOn(core, "error").mockImplementation(jest.fn()) 24 | jest.spyOn(core, "warning").mockImplementation(jest.fn()) 25 | jest.spyOn(core, "info").mockImplementation(jest.fn()) 26 | jest.spyOn(core, "debug").mockImplementation(jest.fn()) 27 | 28 | // Mock github context 29 | jest.spyOn(github.context, "repo", "get").mockImplementation(() => { 30 | return { 31 | owner: "some-owner", 32 | repo: "some-repo", 33 | } 34 | }) 35 | github.context.ref = "refs/heads/some-refs" 36 | }) 37 | 38 | beforeEach(() => { 39 | // Reset inputs 40 | inputs = {} 41 | }) 42 | 43 | afterAll(() => { 44 | // Restore @actions/github context 45 | github.context.ref = originalContext.ref 46 | github.context.sha = originalContext.sha 47 | 48 | // Restore 49 | jest.restoreAllMocks() 50 | }) 51 | 52 | it("sets defaults", () => { 53 | const actionInputs: ActionInputs = inputHelper.getInputs() 54 | expect(actionInputs).toBeTruthy() 55 | expect(actionInputs.authToken).toBeFalsy() 56 | expect(actionInputs.branch).toBeTruthy() 57 | expect(actionInputs.seconds).toBeFalsy() 58 | }) 59 | 60 | it("unqualifies head ref", () => { 61 | const originalRef = github.context.ref 62 | try { 63 | github.context.ref = "refs/heads/some-qualified-ref" 64 | const actionInputs: ActionInputs = inputHelper.getInputs() 65 | expect(actionInputs).toBeTruthy() 66 | expect(actionInputs.branch).toBe("some-qualified-ref") 67 | } finally { 68 | github.context.ref = originalRef 69 | } 70 | }) 71 | 72 | it("does not allow tags ref", () => { 73 | const originalRef = github.context.ref 74 | try { 75 | github.context.ref = "refs/tags/some-tag" 76 | const t = () => { 77 | inputHelper.getInputs() 78 | } 79 | expect(t).toThrow() 80 | } finally { 81 | github.context.ref = originalRef 82 | } 83 | }) 84 | 85 | it("input branch overrides default branch", () => { 86 | inputs[INPUT_BRANCH] = "some-branch" 87 | const actionInputs: ActionInputs = inputHelper.getInputs() 88 | expect(actionInputs.branch).toBe("some-branch") 89 | }) 90 | }) 91 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'Check new commits' 2 | description: 'Checks if the given branch has new commits since a given time period' 3 | inputs: 4 | token: 5 | description: > 6 | Access token used to access the GitHub API. 7 | It is recommended to create a Personal Access Token with a limited access to repositories in order for this to work. 8 | required: true 9 | default: ${{ github.token }} 10 | seconds: 11 | description: > 12 | The seconds interval that the action will use to check if there have been new commits. 13 | required: true 14 | default: '86400' # One day 15 | branch: 16 | description: > 17 | The branch to check for new commits. 18 | When checking out the repository that triggered a workflow, this defaults to the reference or SHA for that event. 19 | Otherwise, uses the default branch. 20 | required: false 21 | outputs: 22 | has-new-commits: 23 | description: > 24 | Whether or not new commits have been found for the required time interval as a boolean value (true or false). 25 | new-commits-number: 26 | description: > 27 | The number of new commits found for the given interval. It will be 0 if no new commits could be found. 28 | runs: 29 | using: 'node20' 30 | main: 'dist/index.js' 31 | branding: 32 | icon: 'git-branch' 33 | color: 'orange' 34 | -------------------------------------------------------------------------------- /dist/licenses.txt: -------------------------------------------------------------------------------- 1 | @actions/core 2 | MIT 3 | The MIT License (MIT) 4 | 5 | Copyright 2019 GitHub 6 | 7 | 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: 8 | 9 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 12 | 13 | @actions/github 14 | MIT 15 | The MIT License (MIT) 16 | 17 | Copyright 2019 GitHub 18 | 19 | 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: 20 | 21 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | @actions/http-client 26 | MIT 27 | Actions Http Client for Node.js 28 | 29 | Copyright (c) GitHub, Inc. 30 | 31 | All rights reserved. 32 | 33 | MIT License 34 | 35 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 36 | associated documentation files (the "Software"), to deal in the Software without restriction, 37 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 38 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 39 | subject to the following conditions: 40 | 41 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 42 | 43 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 44 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 45 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 46 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 47 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 48 | 49 | 50 | @fastify/busboy 51 | MIT 52 | Copyright Brian White. All rights reserved. 53 | 54 | Permission is hereby granted, free of charge, to any person obtaining a copy 55 | of this software and associated documentation files (the "Software"), to 56 | deal in the Software without restriction, including without limitation the 57 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 58 | sell copies of the Software, and to permit persons to whom the Software is 59 | furnished to do so, subject to the following conditions: 60 | 61 | The above copyright notice and this permission notice shall be included in 62 | all copies or substantial portions of the Software. 63 | 64 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 65 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 66 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 67 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 68 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 69 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 70 | IN THE SOFTWARE. 71 | 72 | @octokit/auth-token 73 | MIT 74 | The MIT License 75 | 76 | Copyright (c) 2019 Octokit contributors 77 | 78 | Permission is hereby granted, free of charge, to any person obtaining a copy 79 | of this software and associated documentation files (the "Software"), to deal 80 | in the Software without restriction, including without limitation the rights 81 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 82 | copies of the Software, and to permit persons to whom the Software is 83 | furnished to do so, subject to the following conditions: 84 | 85 | The above copyright notice and this permission notice shall be included in 86 | all copies or substantial portions of the Software. 87 | 88 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 89 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 90 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 91 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 92 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 93 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 94 | THE SOFTWARE. 95 | 96 | 97 | @octokit/core 98 | MIT 99 | The MIT License 100 | 101 | Copyright (c) 2019 Octokit contributors 102 | 103 | Permission is hereby granted, free of charge, to any person obtaining a copy 104 | of this software and associated documentation files (the "Software"), to deal 105 | in the Software without restriction, including without limitation the rights 106 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 107 | copies of the Software, and to permit persons to whom the Software is 108 | furnished to do so, subject to the following conditions: 109 | 110 | The above copyright notice and this permission notice shall be included in 111 | all copies or substantial portions of the Software. 112 | 113 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 114 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 115 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 116 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 117 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 118 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 119 | THE SOFTWARE. 120 | 121 | 122 | @octokit/endpoint 123 | MIT 124 | The MIT License 125 | 126 | Copyright (c) 2018 Octokit contributors 127 | 128 | Permission is hereby granted, free of charge, to any person obtaining a copy 129 | of this software and associated documentation files (the "Software"), to deal 130 | in the Software without restriction, including without limitation the rights 131 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 132 | copies of the Software, and to permit persons to whom the Software is 133 | furnished to do so, subject to the following conditions: 134 | 135 | The above copyright notice and this permission notice shall be included in 136 | all copies or substantial portions of the Software. 137 | 138 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 139 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 140 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 141 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 142 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 143 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 144 | THE SOFTWARE. 145 | 146 | 147 | @octokit/graphql 148 | MIT 149 | The MIT License 150 | 151 | Copyright (c) 2018 Octokit contributors 152 | 153 | Permission is hereby granted, free of charge, to any person obtaining a copy 154 | of this software and associated documentation files (the "Software"), to deal 155 | in the Software without restriction, including without limitation the rights 156 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 157 | copies of the Software, and to permit persons to whom the Software is 158 | furnished to do so, subject to the following conditions: 159 | 160 | The above copyright notice and this permission notice shall be included in 161 | all copies or substantial portions of the Software. 162 | 163 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 164 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 165 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 166 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 167 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 168 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 169 | THE SOFTWARE. 170 | 171 | 172 | @octokit/plugin-paginate-rest 173 | MIT 174 | MIT License Copyright (c) 2019 Octokit contributors 175 | 176 | 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: 177 | 178 | The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. 179 | 180 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 181 | 182 | 183 | @octokit/plugin-rest-endpoint-methods 184 | MIT 185 | MIT License Copyright (c) 2019 Octokit contributors 186 | 187 | 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: 188 | 189 | The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. 190 | 191 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 192 | 193 | 194 | @octokit/request 195 | MIT 196 | The MIT License 197 | 198 | Copyright (c) 2018 Octokit contributors 199 | 200 | Permission is hereby granted, free of charge, to any person obtaining a copy 201 | of this software and associated documentation files (the "Software"), to deal 202 | in the Software without restriction, including without limitation the rights 203 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 204 | copies of the Software, and to permit persons to whom the Software is 205 | furnished to do so, subject to the following conditions: 206 | 207 | The above copyright notice and this permission notice shall be included in 208 | all copies or substantial portions of the Software. 209 | 210 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 211 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 212 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 213 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 214 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 215 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 216 | THE SOFTWARE. 217 | 218 | 219 | @octokit/request-error 220 | MIT 221 | The MIT License 222 | 223 | Copyright (c) 2019 Octokit contributors 224 | 225 | Permission is hereby granted, free of charge, to any person obtaining a copy 226 | of this software and associated documentation files (the "Software"), to deal 227 | in the Software without restriction, including without limitation the rights 228 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 229 | copies of the Software, and to permit persons to whom the Software is 230 | furnished to do so, subject to the following conditions: 231 | 232 | The above copyright notice and this permission notice shall be included in 233 | all copies or substantial portions of the Software. 234 | 235 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 236 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 237 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 238 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 239 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 240 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 241 | THE SOFTWARE. 242 | 243 | 244 | before-after-hook 245 | Apache-2.0 246 | Apache License 247 | Version 2.0, January 2004 248 | http://www.apache.org/licenses/ 249 | 250 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 251 | 252 | 1. Definitions. 253 | 254 | "License" shall mean the terms and conditions for use, reproduction, 255 | and distribution as defined by Sections 1 through 9 of this document. 256 | 257 | "Licensor" shall mean the copyright owner or entity authorized by 258 | the copyright owner that is granting the License. 259 | 260 | "Legal Entity" shall mean the union of the acting entity and all 261 | other entities that control, are controlled by, or are under common 262 | control with that entity. For the purposes of this definition, 263 | "control" means (i) the power, direct or indirect, to cause the 264 | direction or management of such entity, whether by contract or 265 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 266 | outstanding shares, or (iii) beneficial ownership of such entity. 267 | 268 | "You" (or "Your") shall mean an individual or Legal Entity 269 | exercising permissions granted by this License. 270 | 271 | "Source" form shall mean the preferred form for making modifications, 272 | including but not limited to software source code, documentation 273 | source, and configuration files. 274 | 275 | "Object" form shall mean any form resulting from mechanical 276 | transformation or translation of a Source form, including but 277 | not limited to compiled object code, generated documentation, 278 | and conversions to other media types. 279 | 280 | "Work" shall mean the work of authorship, whether in Source or 281 | Object form, made available under the License, as indicated by a 282 | copyright notice that is included in or attached to the work 283 | (an example is provided in the Appendix below). 284 | 285 | "Derivative Works" shall mean any work, whether in Source or Object 286 | form, that is based on (or derived from) the Work and for which the 287 | editorial revisions, annotations, elaborations, or other modifications 288 | represent, as a whole, an original work of authorship. For the purposes 289 | of this License, Derivative Works shall not include works that remain 290 | separable from, or merely link (or bind by name) to the interfaces of, 291 | the Work and Derivative Works thereof. 292 | 293 | "Contribution" shall mean any work of authorship, including 294 | the original version of the Work and any modifications or additions 295 | to that Work or Derivative Works thereof, that is intentionally 296 | submitted to Licensor for inclusion in the Work by the copyright owner 297 | or by an individual or Legal Entity authorized to submit on behalf of 298 | the copyright owner. For the purposes of this definition, "submitted" 299 | means any form of electronic, verbal, or written communication sent 300 | to the Licensor or its representatives, including but not limited to 301 | communication on electronic mailing lists, source code control systems, 302 | and issue tracking systems that are managed by, or on behalf of, the 303 | Licensor for the purpose of discussing and improving the Work, but 304 | excluding communication that is conspicuously marked or otherwise 305 | designated in writing by the copyright owner as "Not a Contribution." 306 | 307 | "Contributor" shall mean Licensor and any individual or Legal Entity 308 | on behalf of whom a Contribution has been received by Licensor and 309 | subsequently incorporated within the Work. 310 | 311 | 2. Grant of Copyright License. Subject to the terms and conditions of 312 | this License, each Contributor hereby grants to You a perpetual, 313 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 314 | copyright license to reproduce, prepare Derivative Works of, 315 | publicly display, publicly perform, sublicense, and distribute the 316 | Work and such Derivative Works in Source or Object form. 317 | 318 | 3. Grant of Patent License. Subject to the terms and conditions of 319 | this License, each Contributor hereby grants to You a perpetual, 320 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 321 | (except as stated in this section) patent license to make, have made, 322 | use, offer to sell, sell, import, and otherwise transfer the Work, 323 | where such license applies only to those patent claims licensable 324 | by such Contributor that are necessarily infringed by their 325 | Contribution(s) alone or by combination of their Contribution(s) 326 | with the Work to which such Contribution(s) was submitted. If You 327 | institute patent litigation against any entity (including a 328 | cross-claim or counterclaim in a lawsuit) alleging that the Work 329 | or a Contribution incorporated within the Work constitutes direct 330 | or contributory patent infringement, then any patent licenses 331 | granted to You under this License for that Work shall terminate 332 | as of the date such litigation is filed. 333 | 334 | 4. Redistribution. You may reproduce and distribute copies of the 335 | Work or Derivative Works thereof in any medium, with or without 336 | modifications, and in Source or Object form, provided that You 337 | meet the following conditions: 338 | 339 | (a) You must give any other recipients of the Work or 340 | Derivative Works a copy of this License; and 341 | 342 | (b) You must cause any modified files to carry prominent notices 343 | stating that You changed the files; and 344 | 345 | (c) You must retain, in the Source form of any Derivative Works 346 | that You distribute, all copyright, patent, trademark, and 347 | attribution notices from the Source form of the Work, 348 | excluding those notices that do not pertain to any part of 349 | the Derivative Works; and 350 | 351 | (d) If the Work includes a "NOTICE" text file as part of its 352 | distribution, then any Derivative Works that You distribute must 353 | include a readable copy of the attribution notices contained 354 | within such NOTICE file, excluding those notices that do not 355 | pertain to any part of the Derivative Works, in at least one 356 | of the following places: within a NOTICE text file distributed 357 | as part of the Derivative Works; within the Source form or 358 | documentation, if provided along with the Derivative Works; or, 359 | within a display generated by the Derivative Works, if and 360 | wherever such third-party notices normally appear. The contents 361 | of the NOTICE file are for informational purposes only and 362 | do not modify the License. You may add Your own attribution 363 | notices within Derivative Works that You distribute, alongside 364 | or as an addendum to the NOTICE text from the Work, provided 365 | that such additional attribution notices cannot be construed 366 | as modifying the License. 367 | 368 | You may add Your own copyright statement to Your modifications and 369 | may provide additional or different license terms and conditions 370 | for use, reproduction, or distribution of Your modifications, or 371 | for any such Derivative Works as a whole, provided Your use, 372 | reproduction, and distribution of the Work otherwise complies with 373 | the conditions stated in this License. 374 | 375 | 5. Submission of Contributions. Unless You explicitly state otherwise, 376 | any Contribution intentionally submitted for inclusion in the Work 377 | by You to the Licensor shall be under the terms and conditions of 378 | this License, without any additional terms or conditions. 379 | Notwithstanding the above, nothing herein shall supersede or modify 380 | the terms of any separate license agreement you may have executed 381 | with Licensor regarding such Contributions. 382 | 383 | 6. Trademarks. This License does not grant permission to use the trade 384 | names, trademarks, service marks, or product names of the Licensor, 385 | except as required for reasonable and customary use in describing the 386 | origin of the Work and reproducing the content of the NOTICE file. 387 | 388 | 7. Disclaimer of Warranty. Unless required by applicable law or 389 | agreed to in writing, Licensor provides the Work (and each 390 | Contributor provides its Contributions) on an "AS IS" BASIS, 391 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 392 | implied, including, without limitation, any warranties or conditions 393 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 394 | PARTICULAR PURPOSE. You are solely responsible for determining the 395 | appropriateness of using or redistributing the Work and assume any 396 | risks associated with Your exercise of permissions under this License. 397 | 398 | 8. Limitation of Liability. In no event and under no legal theory, 399 | whether in tort (including negligence), contract, or otherwise, 400 | unless required by applicable law (such as deliberate and grossly 401 | negligent acts) or agreed to in writing, shall any Contributor be 402 | liable to You for damages, including any direct, indirect, special, 403 | incidental, or consequential damages of any character arising as a 404 | result of this License or out of the use or inability to use the 405 | Work (including but not limited to damages for loss of goodwill, 406 | work stoppage, computer failure or malfunction, or any and all 407 | other commercial damages or losses), even if such Contributor 408 | has been advised of the possibility of such damages. 409 | 410 | 9. Accepting Warranty or Additional Liability. While redistributing 411 | the Work or Derivative Works thereof, You may choose to offer, 412 | and charge a fee for, acceptance of support, warranty, indemnity, 413 | or other liability obligations and/or rights consistent with this 414 | License. However, in accepting such obligations, You may act only 415 | on Your own behalf and on Your sole responsibility, not on behalf 416 | of any other Contributor, and only if You agree to indemnify, 417 | defend, and hold each Contributor harmless for any liability 418 | incurred by, or claims asserted against, such Contributor by reason 419 | of your accepting any such warranty or additional liability. 420 | 421 | END OF TERMS AND CONDITIONS 422 | 423 | APPENDIX: How to apply the Apache License to your work. 424 | 425 | To apply the Apache License to your work, attach the following 426 | boilerplate notice, with the fields enclosed by brackets "{}" 427 | replaced with your own identifying information. (Don't include 428 | the brackets!) The text should be enclosed in the appropriate 429 | comment syntax for the file format. We also recommend that a 430 | file or class name and description of purpose be included on the 431 | same "printed page" as the copyright notice for easier 432 | identification within third-party archives. 433 | 434 | Copyright 2018 Gregor Martynus and other contributors. 435 | 436 | Licensed under the Apache License, Version 2.0 (the "License"); 437 | you may not use this file except in compliance with the License. 438 | You may obtain a copy of the License at 439 | 440 | http://www.apache.org/licenses/LICENSE-2.0 441 | 442 | Unless required by applicable law or agreed to in writing, software 443 | distributed under the License is distributed on an "AS IS" BASIS, 444 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 445 | See the License for the specific language governing permissions and 446 | limitations under the License. 447 | 448 | 449 | deprecation 450 | ISC 451 | The ISC License 452 | 453 | Copyright (c) Gregor Martynus and contributors 454 | 455 | Permission to use, copy, modify, and/or distribute this software for any 456 | purpose with or without fee is hereby granted, provided that the above 457 | copyright notice and this permission notice appear in all copies. 458 | 459 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 460 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 461 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 462 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 463 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 464 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 465 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 466 | 467 | 468 | once 469 | ISC 470 | The ISC License 471 | 472 | Copyright (c) Isaac Z. Schlueter and Contributors 473 | 474 | Permission to use, copy, modify, and/or distribute this software for any 475 | purpose with or without fee is hereby granted, provided that the above 476 | copyright notice and this permission notice appear in all copies. 477 | 478 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 479 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 480 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 481 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 482 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 483 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 484 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 485 | 486 | 487 | tunnel 488 | MIT 489 | The MIT License (MIT) 490 | 491 | Copyright (c) 2012 Koichi Kobayashi 492 | 493 | Permission is hereby granted, free of charge, to any person obtaining a copy 494 | of this software and associated documentation files (the "Software"), to deal 495 | in the Software without restriction, including without limitation the rights 496 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 497 | copies of the Software, and to permit persons to whom the Software is 498 | furnished to do so, subject to the following conditions: 499 | 500 | The above copyright notice and this permission notice shall be included in 501 | all copies or substantial portions of the Software. 502 | 503 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 504 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 505 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 506 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 507 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 508 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 509 | THE SOFTWARE. 510 | 511 | 512 | undici 513 | MIT 514 | MIT License 515 | 516 | Copyright (c) Matteo Collina and Undici contributors 517 | 518 | Permission is hereby granted, free of charge, to any person obtaining a copy 519 | of this software and associated documentation files (the "Software"), to deal 520 | in the Software without restriction, including without limitation the rights 521 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 522 | copies of the Software, and to permit persons to whom the Software is 523 | furnished to do so, subject to the following conditions: 524 | 525 | The above copyright notice and this permission notice shall be included in all 526 | copies or substantial portions of the Software. 527 | 528 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 529 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 530 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 531 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 532 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 533 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 534 | SOFTWARE. 535 | 536 | 537 | universal-user-agent 538 | ISC 539 | # [ISC License](https://spdx.org/licenses/ISC) 540 | 541 | Copyright (c) 2018, Gregor Martynus (https://github.com/gr2m) 542 | 543 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 544 | 545 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 546 | 547 | 548 | uuid 549 | MIT 550 | The MIT License (MIT) 551 | 552 | Copyright (c) 2010-2020 Robert Kieffer and other contributors 553 | 554 | 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: 555 | 556 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 557 | 558 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 559 | 560 | 561 | wrappy 562 | ISC 563 | The ISC License 564 | 565 | Copyright (c) Isaac Z. Schlueter and Contributors 566 | 567 | Permission to use, copy, modify, and/or distribute this software for any 568 | purpose with or without fee is hereby granted, provided that the above 569 | copyright notice and this permission notice appear in all copies. 570 | 571 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 572 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 573 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 574 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 575 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 576 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 577 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 578 | -------------------------------------------------------------------------------- /dist/sourcemap-register.js: -------------------------------------------------------------------------------- 1 | (()=>{var e={650:e=>{var r=Object.prototype.toString;var n=typeof Buffer.alloc==="function"&&typeof Buffer.allocUnsafe==="function"&&typeof Buffer.from==="function";function isArrayBuffer(e){return r.call(e).slice(8,-1)==="ArrayBuffer"}function fromArrayBuffer(e,r,t){r>>>=0;var o=e.byteLength-r;if(o<0){throw new RangeError("'offset' is out of bounds")}if(t===undefined){t=o}else{t>>>=0;if(t>o){throw new RangeError("'length' is out of bounds")}}return n?Buffer.from(e.slice(r,r+t)):new Buffer(new Uint8Array(e.slice(r,r+t)))}function fromString(e,r){if(typeof r!=="string"||r===""){r="utf8"}if(!Buffer.isEncoding(r)){throw new TypeError('"encoding" must be a valid string encoding')}return n?Buffer.from(e,r):new Buffer(e,r)}function bufferFrom(e,r,t){if(typeof e==="number"){throw new TypeError('"value" argument must not be a number')}if(isArrayBuffer(e)){return fromArrayBuffer(e,r,t)}if(typeof e==="string"){return fromString(e,r)}return n?Buffer.from(e):new Buffer(e)}e.exports=bufferFrom},274:(e,r,n)=>{var t=n(339);var o=Object.prototype.hasOwnProperty;var i=typeof Map!=="undefined";function ArraySet(){this._array=[];this._set=i?new Map:Object.create(null)}ArraySet.fromArray=function ArraySet_fromArray(e,r){var n=new ArraySet;for(var t=0,o=e.length;t=0){return r}}else{var n=t.toSetString(e);if(o.call(this._set,n)){return this._set[n]}}throw new Error('"'+e+'" is not in the set.')};ArraySet.prototype.at=function ArraySet_at(e){if(e>=0&&e{var t=n(190);var o=5;var i=1<>1;return r?-n:n}r.encode=function base64VLQ_encode(e){var r="";var n;var i=toVLQSigned(e);do{n=i&a;i>>>=o;if(i>0){n|=u}r+=t.encode(n)}while(i>0);return r};r.decode=function base64VLQ_decode(e,r,n){var i=e.length;var s=0;var l=0;var c,p;do{if(r>=i){throw new Error("Expected more digits in base 64 VLQ value.")}p=t.decode(e.charCodeAt(r++));if(p===-1){throw new Error("Invalid base64 digit: "+e.charAt(r-1))}c=!!(p&u);p&=a;s=s+(p<{var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");r.encode=function(e){if(0<=e&&e{r.GREATEST_LOWER_BOUND=1;r.LEAST_UPPER_BOUND=2;function recursiveSearch(e,n,t,o,i,a){var u=Math.floor((n-e)/2)+e;var s=i(t,o[u],true);if(s===0){return u}else if(s>0){if(n-u>1){return recursiveSearch(u,n,t,o,i,a)}if(a==r.LEAST_UPPER_BOUND){return n1){return recursiveSearch(e,u,t,o,i,a)}if(a==r.LEAST_UPPER_BOUND){return u}else{return e<0?-1:e}}}r.search=function search(e,n,t,o){if(n.length===0){return-1}var i=recursiveSearch(-1,n.length,e,n,t,o||r.GREATEST_LOWER_BOUND);if(i<0){return-1}while(i-1>=0){if(t(n[i],n[i-1],true)!==0){break}--i}return i}},680:(e,r,n)=>{var t=n(339);function generatedPositionAfter(e,r){var n=e.generatedLine;var o=r.generatedLine;var i=e.generatedColumn;var a=r.generatedColumn;return o>n||o==n&&a>=i||t.compareByGeneratedPositionsInflated(e,r)<=0}function MappingList(){this._array=[];this._sorted=true;this._last={generatedLine:-1,generatedColumn:0}}MappingList.prototype.unsortedForEach=function MappingList_forEach(e,r){this._array.forEach(e,r)};MappingList.prototype.add=function MappingList_add(e){if(generatedPositionAfter(this._last,e)){this._last=e;this._array.push(e)}else{this._sorted=false;this._array.push(e)}};MappingList.prototype.toArray=function MappingList_toArray(){if(!this._sorted){this._array.sort(t.compareByGeneratedPositionsInflated);this._sorted=true}return this._array};r.H=MappingList},758:(e,r)=>{function swap(e,r,n){var t=e[r];e[r]=e[n];e[n]=t}function randomIntInRange(e,r){return Math.round(e+Math.random()*(r-e))}function doQuickSort(e,r,n,t){if(n{var t;var o=n(339);var i=n(345);var a=n(274).I;var u=n(449);var s=n(758).U;function SourceMapConsumer(e,r){var n=e;if(typeof e==="string"){n=o.parseSourceMapInput(e)}return n.sections!=null?new IndexedSourceMapConsumer(n,r):new BasicSourceMapConsumer(n,r)}SourceMapConsumer.fromSourceMap=function(e,r){return BasicSourceMapConsumer.fromSourceMap(e,r)};SourceMapConsumer.prototype._version=3;SourceMapConsumer.prototype.__generatedMappings=null;Object.defineProperty(SourceMapConsumer.prototype,"_generatedMappings",{configurable:true,enumerable:true,get:function(){if(!this.__generatedMappings){this._parseMappings(this._mappings,this.sourceRoot)}return this.__generatedMappings}});SourceMapConsumer.prototype.__originalMappings=null;Object.defineProperty(SourceMapConsumer.prototype,"_originalMappings",{configurable:true,enumerable:true,get:function(){if(!this.__originalMappings){this._parseMappings(this._mappings,this.sourceRoot)}return this.__originalMappings}});SourceMapConsumer.prototype._charIsMappingSeparator=function SourceMapConsumer_charIsMappingSeparator(e,r){var n=e.charAt(r);return n===";"||n===","};SourceMapConsumer.prototype._parseMappings=function SourceMapConsumer_parseMappings(e,r){throw new Error("Subclasses must implement _parseMappings")};SourceMapConsumer.GENERATED_ORDER=1;SourceMapConsumer.ORIGINAL_ORDER=2;SourceMapConsumer.GREATEST_LOWER_BOUND=1;SourceMapConsumer.LEAST_UPPER_BOUND=2;SourceMapConsumer.prototype.eachMapping=function SourceMapConsumer_eachMapping(e,r,n){var t=r||null;var i=n||SourceMapConsumer.GENERATED_ORDER;var a;switch(i){case SourceMapConsumer.GENERATED_ORDER:a=this._generatedMappings;break;case SourceMapConsumer.ORIGINAL_ORDER:a=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var u=this.sourceRoot;a.map((function(e){var r=e.source===null?null:this._sources.at(e.source);r=o.computeSourceURL(u,r,this._sourceMapURL);return{source:r,generatedLine:e.generatedLine,generatedColumn:e.generatedColumn,originalLine:e.originalLine,originalColumn:e.originalColumn,name:e.name===null?null:this._names.at(e.name)}}),this).forEach(e,t)};SourceMapConsumer.prototype.allGeneratedPositionsFor=function SourceMapConsumer_allGeneratedPositionsFor(e){var r=o.getArg(e,"line");var n={source:o.getArg(e,"source"),originalLine:r,originalColumn:o.getArg(e,"column",0)};n.source=this._findSourceIndex(n.source);if(n.source<0){return[]}var t=[];var a=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",o.compareByOriginalPositions,i.LEAST_UPPER_BOUND);if(a>=0){var u=this._originalMappings[a];if(e.column===undefined){var s=u.originalLine;while(u&&u.originalLine===s){t.push({line:o.getArg(u,"generatedLine",null),column:o.getArg(u,"generatedColumn",null),lastColumn:o.getArg(u,"lastGeneratedColumn",null)});u=this._originalMappings[++a]}}else{var l=u.originalColumn;while(u&&u.originalLine===r&&u.originalColumn==l){t.push({line:o.getArg(u,"generatedLine",null),column:o.getArg(u,"generatedColumn",null),lastColumn:o.getArg(u,"lastGeneratedColumn",null)});u=this._originalMappings[++a]}}}return t};r.SourceMapConsumer=SourceMapConsumer;function BasicSourceMapConsumer(e,r){var n=e;if(typeof e==="string"){n=o.parseSourceMapInput(e)}var t=o.getArg(n,"version");var i=o.getArg(n,"sources");var u=o.getArg(n,"names",[]);var s=o.getArg(n,"sourceRoot",null);var l=o.getArg(n,"sourcesContent",null);var c=o.getArg(n,"mappings");var p=o.getArg(n,"file",null);if(t!=this._version){throw new Error("Unsupported version: "+t)}if(s){s=o.normalize(s)}i=i.map(String).map(o.normalize).map((function(e){return s&&o.isAbsolute(s)&&o.isAbsolute(e)?o.relative(s,e):e}));this._names=a.fromArray(u.map(String),true);this._sources=a.fromArray(i,true);this._absoluteSources=this._sources.toArray().map((function(e){return o.computeSourceURL(s,e,r)}));this.sourceRoot=s;this.sourcesContent=l;this._mappings=c;this._sourceMapURL=r;this.file=p}BasicSourceMapConsumer.prototype=Object.create(SourceMapConsumer.prototype);BasicSourceMapConsumer.prototype.consumer=SourceMapConsumer;BasicSourceMapConsumer.prototype._findSourceIndex=function(e){var r=e;if(this.sourceRoot!=null){r=o.relative(this.sourceRoot,r)}if(this._sources.has(r)){return this._sources.indexOf(r)}var n;for(n=0;n1){v.source=l+_[1];l+=_[1];v.originalLine=i+_[2];i=v.originalLine;v.originalLine+=1;v.originalColumn=a+_[3];a=v.originalColumn;if(_.length>4){v.name=c+_[4];c+=_[4]}}m.push(v);if(typeof v.originalLine==="number"){d.push(v)}}}s(m,o.compareByGeneratedPositionsDeflated);this.__generatedMappings=m;s(d,o.compareByOriginalPositions);this.__originalMappings=d};BasicSourceMapConsumer.prototype._findMapping=function SourceMapConsumer_findMapping(e,r,n,t,o,a){if(e[n]<=0){throw new TypeError("Line must be greater than or equal to 1, got "+e[n])}if(e[t]<0){throw new TypeError("Column must be greater than or equal to 0, got "+e[t])}return i.search(e,r,o,a)};BasicSourceMapConsumer.prototype.computeColumnSpans=function SourceMapConsumer_computeColumnSpans(){for(var e=0;e=0){var t=this._generatedMappings[n];if(t.generatedLine===r.generatedLine){var i=o.getArg(t,"source",null);if(i!==null){i=this._sources.at(i);i=o.computeSourceURL(this.sourceRoot,i,this._sourceMapURL)}var a=o.getArg(t,"name",null);if(a!==null){a=this._names.at(a)}return{source:i,line:o.getArg(t,"originalLine",null),column:o.getArg(t,"originalColumn",null),name:a}}}return{source:null,line:null,column:null,name:null}};BasicSourceMapConsumer.prototype.hasContentsOfAllSources=function BasicSourceMapConsumer_hasContentsOfAllSources(){if(!this.sourcesContent){return false}return this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(e){return e==null}))};BasicSourceMapConsumer.prototype.sourceContentFor=function SourceMapConsumer_sourceContentFor(e,r){if(!this.sourcesContent){return null}var n=this._findSourceIndex(e);if(n>=0){return this.sourcesContent[n]}var t=e;if(this.sourceRoot!=null){t=o.relative(this.sourceRoot,t)}var i;if(this.sourceRoot!=null&&(i=o.urlParse(this.sourceRoot))){var a=t.replace(/^file:\/\//,"");if(i.scheme=="file"&&this._sources.has(a)){return this.sourcesContent[this._sources.indexOf(a)]}if((!i.path||i.path=="/")&&this._sources.has("/"+t)){return this.sourcesContent[this._sources.indexOf("/"+t)]}}if(r){return null}else{throw new Error('"'+t+'" is not in the SourceMap.')}};BasicSourceMapConsumer.prototype.generatedPositionFor=function SourceMapConsumer_generatedPositionFor(e){var r=o.getArg(e,"source");r=this._findSourceIndex(r);if(r<0){return{line:null,column:null,lastColumn:null}}var n={source:r,originalLine:o.getArg(e,"line"),originalColumn:o.getArg(e,"column")};var t=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",o.compareByOriginalPositions,o.getArg(e,"bias",SourceMapConsumer.GREATEST_LOWER_BOUND));if(t>=0){var i=this._originalMappings[t];if(i.source===n.source){return{line:o.getArg(i,"generatedLine",null),column:o.getArg(i,"generatedColumn",null),lastColumn:o.getArg(i,"lastGeneratedColumn",null)}}}return{line:null,column:null,lastColumn:null}};t=BasicSourceMapConsumer;function IndexedSourceMapConsumer(e,r){var n=e;if(typeof e==="string"){n=o.parseSourceMapInput(e)}var t=o.getArg(n,"version");var i=o.getArg(n,"sections");if(t!=this._version){throw new Error("Unsupported version: "+t)}this._sources=new a;this._names=new a;var u={line:-1,column:0};this._sections=i.map((function(e){if(e.url){throw new Error("Support for url field in sections not implemented.")}var n=o.getArg(e,"offset");var t=o.getArg(n,"line");var i=o.getArg(n,"column");if(t{var t=n(449);var o=n(339);var i=n(274).I;var a=n(680).H;function SourceMapGenerator(e){if(!e){e={}}this._file=o.getArg(e,"file",null);this._sourceRoot=o.getArg(e,"sourceRoot",null);this._skipValidation=o.getArg(e,"skipValidation",false);this._sources=new i;this._names=new i;this._mappings=new a;this._sourcesContents=null}SourceMapGenerator.prototype._version=3;SourceMapGenerator.fromSourceMap=function SourceMapGenerator_fromSourceMap(e){var r=e.sourceRoot;var n=new SourceMapGenerator({file:e.file,sourceRoot:r});e.eachMapping((function(e){var t={generated:{line:e.generatedLine,column:e.generatedColumn}};if(e.source!=null){t.source=e.source;if(r!=null){t.source=o.relative(r,t.source)}t.original={line:e.originalLine,column:e.originalColumn};if(e.name!=null){t.name=e.name}}n.addMapping(t)}));e.sources.forEach((function(t){var i=t;if(r!==null){i=o.relative(r,t)}if(!n._sources.has(i)){n._sources.add(i)}var a=e.sourceContentFor(t);if(a!=null){n.setSourceContent(t,a)}}));return n};SourceMapGenerator.prototype.addMapping=function SourceMapGenerator_addMapping(e){var r=o.getArg(e,"generated");var n=o.getArg(e,"original",null);var t=o.getArg(e,"source",null);var i=o.getArg(e,"name",null);if(!this._skipValidation){this._validateMapping(r,n,t,i)}if(t!=null){t=String(t);if(!this._sources.has(t)){this._sources.add(t)}}if(i!=null){i=String(i);if(!this._names.has(i)){this._names.add(i)}}this._mappings.add({generatedLine:r.line,generatedColumn:r.column,originalLine:n!=null&&n.line,originalColumn:n!=null&&n.column,source:t,name:i})};SourceMapGenerator.prototype.setSourceContent=function SourceMapGenerator_setSourceContent(e,r){var n=e;if(this._sourceRoot!=null){n=o.relative(this._sourceRoot,n)}if(r!=null){if(!this._sourcesContents){this._sourcesContents=Object.create(null)}this._sourcesContents[o.toSetString(n)]=r}else if(this._sourcesContents){delete this._sourcesContents[o.toSetString(n)];if(Object.keys(this._sourcesContents).length===0){this._sourcesContents=null}}};SourceMapGenerator.prototype.applySourceMap=function SourceMapGenerator_applySourceMap(e,r,n){var t=r;if(r==null){if(e.file==null){throw new Error("SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, "+'or the source map\'s "file" property. Both were omitted.')}t=e.file}var a=this._sourceRoot;if(a!=null){t=o.relative(a,t)}var u=new i;var s=new i;this._mappings.unsortedForEach((function(r){if(r.source===t&&r.originalLine!=null){var i=e.originalPositionFor({line:r.originalLine,column:r.originalColumn});if(i.source!=null){r.source=i.source;if(n!=null){r.source=o.join(n,r.source)}if(a!=null){r.source=o.relative(a,r.source)}r.originalLine=i.line;r.originalColumn=i.column;if(i.name!=null){r.name=i.name}}}var l=r.source;if(l!=null&&!u.has(l)){u.add(l)}var c=r.name;if(c!=null&&!s.has(c)){s.add(c)}}),this);this._sources=u;this._names=s;e.sources.forEach((function(r){var t=e.sourceContentFor(r);if(t!=null){if(n!=null){r=o.join(n,r)}if(a!=null){r=o.relative(a,r)}this.setSourceContent(r,t)}}),this)};SourceMapGenerator.prototype._validateMapping=function SourceMapGenerator_validateMapping(e,r,n,t){if(r&&typeof r.line!=="number"&&typeof r.column!=="number"){throw new Error("original.line and original.column are not numbers -- you probably meant to omit "+"the original mapping entirely and only map the generated position. If so, pass "+"null for the original mapping instead of an object with empty or null values.")}if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!r&&!n&&!t){return}else if(e&&"line"in e&&"column"in e&&r&&"line"in r&&"column"in r&&e.line>0&&e.column>=0&&r.line>0&&r.column>=0&&n){return}else{throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:n,original:r,name:t}))}};SourceMapGenerator.prototype._serializeMappings=function SourceMapGenerator_serializeMappings(){var e=0;var r=1;var n=0;var i=0;var a=0;var u=0;var s="";var l;var c;var p;var f;var g=this._mappings.toArray();for(var h=0,d=g.length;h0){if(!o.compareByGeneratedPositionsInflated(c,g[h-1])){continue}l+=","}}l+=t.encode(c.generatedColumn-e);e=c.generatedColumn;if(c.source!=null){f=this._sources.indexOf(c.source);l+=t.encode(f-u);u=f;l+=t.encode(c.originalLine-1-i);i=c.originalLine-1;l+=t.encode(c.originalColumn-n);n=c.originalColumn;if(c.name!=null){p=this._names.indexOf(c.name);l+=t.encode(p-a);a=p}}s+=l}return s};SourceMapGenerator.prototype._generateSourcesContent=function SourceMapGenerator_generateSourcesContent(e,r){return e.map((function(e){if(!this._sourcesContents){return null}if(r!=null){e=o.relative(r,e)}var n=o.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,n)?this._sourcesContents[n]:null}),this)};SourceMapGenerator.prototype.toJSON=function SourceMapGenerator_toJSON(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};if(this._file!=null){e.file=this._file}if(this._sourceRoot!=null){e.sourceRoot=this._sourceRoot}if(this._sourcesContents){e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)}return e};SourceMapGenerator.prototype.toString=function SourceMapGenerator_toString(){return JSON.stringify(this.toJSON())};r.h=SourceMapGenerator},351:(e,r,n)=>{var t;var o=n(591).h;var i=n(339);var a=/(\r?\n)/;var u=10;var s="$$$isSourceNode$$$";function SourceNode(e,r,n,t,o){this.children=[];this.sourceContents={};this.line=e==null?null:e;this.column=r==null?null:r;this.source=n==null?null:n;this.name=o==null?null:o;this[s]=true;if(t!=null)this.add(t)}SourceNode.fromStringWithSourceMap=function SourceNode_fromStringWithSourceMap(e,r,n){var t=new SourceNode;var o=e.split(a);var u=0;var shiftNextLine=function(){var e=getNextLine();var r=getNextLine()||"";return e+r;function getNextLine(){return u=0;r--){this.prepend(e[r])}}else if(e[s]||typeof e==="string"){this.children.unshift(e)}else{throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e)}return this};SourceNode.prototype.walk=function SourceNode_walk(e){var r;for(var n=0,t=this.children.length;n0){r=[];for(n=0;n{function getArg(e,r,n){if(r in e){return e[r]}else if(arguments.length===3){return n}else{throw new Error('"'+r+'" is a required argument.')}}r.getArg=getArg;var n=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;var t=/^data:.+\,.+$/;function urlParse(e){var r=e.match(n);if(!r){return null}return{scheme:r[1],auth:r[2],host:r[3],port:r[4],path:r[5]}}r.urlParse=urlParse;function urlGenerate(e){var r="";if(e.scheme){r+=e.scheme+":"}r+="//";if(e.auth){r+=e.auth+"@"}if(e.host){r+=e.host}if(e.port){r+=":"+e.port}if(e.path){r+=e.path}return r}r.urlGenerate=urlGenerate;function normalize(e){var n=e;var t=urlParse(e);if(t){if(!t.path){return e}n=t.path}var o=r.isAbsolute(n);var i=n.split(/\/+/);for(var a,u=0,s=i.length-1;s>=0;s--){a=i[s];if(a==="."){i.splice(s,1)}else if(a===".."){u++}else if(u>0){if(a===""){i.splice(s+1,u);u=0}else{i.splice(s,2);u--}}}n=i.join("/");if(n===""){n=o?"/":"."}if(t){t.path=n;return urlGenerate(t)}return n}r.normalize=normalize;function join(e,r){if(e===""){e="."}if(r===""){r="."}var n=urlParse(r);var o=urlParse(e);if(o){e=o.path||"/"}if(n&&!n.scheme){if(o){n.scheme=o.scheme}return urlGenerate(n)}if(n||r.match(t)){return r}if(o&&!o.host&&!o.path){o.host=r;return urlGenerate(o)}var i=r.charAt(0)==="/"?r:normalize(e.replace(/\/+$/,"")+"/"+r);if(o){o.path=i;return urlGenerate(o)}return i}r.join=join;r.isAbsolute=function(e){return e.charAt(0)==="/"||n.test(e)};function relative(e,r){if(e===""){e="."}e=e.replace(/\/$/,"");var n=0;while(r.indexOf(e+"/")!==0){var t=e.lastIndexOf("/");if(t<0){return r}e=e.slice(0,t);if(e.match(/^([^\/]+:\/)?\/*$/)){return r}++n}return Array(n+1).join("../")+r.substr(e.length+1)}r.relative=relative;var o=function(){var e=Object.create(null);return!("__proto__"in e)}();function identity(e){return e}function toSetString(e){if(isProtoString(e)){return"$"+e}return e}r.toSetString=o?identity:toSetString;function fromSetString(e){if(isProtoString(e)){return e.slice(1)}return e}r.fromSetString=o?identity:fromSetString;function isProtoString(e){if(!e){return false}var r=e.length;if(r<9){return false}if(e.charCodeAt(r-1)!==95||e.charCodeAt(r-2)!==95||e.charCodeAt(r-3)!==111||e.charCodeAt(r-4)!==116||e.charCodeAt(r-5)!==111||e.charCodeAt(r-6)!==114||e.charCodeAt(r-7)!==112||e.charCodeAt(r-8)!==95||e.charCodeAt(r-9)!==95){return false}for(var n=r-10;n>=0;n--){if(e.charCodeAt(n)!==36){return false}}return true}function compareByOriginalPositions(e,r,n){var t=strcmp(e.source,r.source);if(t!==0){return t}t=e.originalLine-r.originalLine;if(t!==0){return t}t=e.originalColumn-r.originalColumn;if(t!==0||n){return t}t=e.generatedColumn-r.generatedColumn;if(t!==0){return t}t=e.generatedLine-r.generatedLine;if(t!==0){return t}return strcmp(e.name,r.name)}r.compareByOriginalPositions=compareByOriginalPositions;function compareByGeneratedPositionsDeflated(e,r,n){var t=e.generatedLine-r.generatedLine;if(t!==0){return t}t=e.generatedColumn-r.generatedColumn;if(t!==0||n){return t}t=strcmp(e.source,r.source);if(t!==0){return t}t=e.originalLine-r.originalLine;if(t!==0){return t}t=e.originalColumn-r.originalColumn;if(t!==0){return t}return strcmp(e.name,r.name)}r.compareByGeneratedPositionsDeflated=compareByGeneratedPositionsDeflated;function strcmp(e,r){if(e===r){return 0}if(e===null){return 1}if(r===null){return-1}if(e>r){return 1}return-1}function compareByGeneratedPositionsInflated(e,r){var n=e.generatedLine-r.generatedLine;if(n!==0){return n}n=e.generatedColumn-r.generatedColumn;if(n!==0){return n}n=strcmp(e.source,r.source);if(n!==0){return n}n=e.originalLine-r.originalLine;if(n!==0){return n}n=e.originalColumn-r.originalColumn;if(n!==0){return n}return strcmp(e.name,r.name)}r.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated;function parseSourceMapInput(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}r.parseSourceMapInput=parseSourceMapInput;function computeSourceURL(e,r,n){r=r||"";if(e){if(e[e.length-1]!=="/"&&r[0]!=="/"){e+="/"}r=e+r}if(n){var t=urlParse(n);if(!t){throw new Error("sourceMapURL could not be parsed")}if(t.path){var o=t.path.lastIndexOf("/");if(o>=0){t.path=t.path.substring(0,o+1)}}r=join(urlGenerate(t),r)}return normalize(r)}r.computeSourceURL=computeSourceURL},997:(e,r,n)=>{n(591).h;r.SourceMapConsumer=n(952).SourceMapConsumer;n(351)},284:(e,r,n)=>{e=n.nmd(e);var t=n(997).SourceMapConsumer;var o=n(17);var i;try{i=n(147);if(!i.existsSync||!i.readFileSync){i=null}}catch(e){}var a=n(650);function dynamicRequire(e,r){return e.require(r)}var u=false;var s=false;var l=false;var c="auto";var p={};var f={};var g=/^data:application\/json[^,]+base64,/;var h=[];var d=[];function isInBrowser(){if(c==="browser")return true;if(c==="node")return false;return typeof window!=="undefined"&&typeof XMLHttpRequest==="function"&&!(window.require&&window.module&&window.process&&window.process.type==="renderer")}function hasGlobalProcessEventEmitter(){return typeof process==="object"&&process!==null&&typeof process.on==="function"}function globalProcessVersion(){if(typeof process==="object"&&process!==null){return process.version}else{return""}}function globalProcessStderr(){if(typeof process==="object"&&process!==null){return process.stderr}}function globalProcessExit(e){if(typeof process==="object"&&process!==null&&typeof process.exit==="function"){return process.exit(e)}}function handlerExec(e){return function(r){for(var n=0;n"}var n=this.getLineNumber();if(n!=null){r+=":"+n;var t=this.getColumnNumber();if(t){r+=":"+t}}}var o="";var i=this.getFunctionName();var a=true;var u=this.isConstructor();var s=!(this.isToplevel()||u);if(s){var l=this.getTypeName();if(l==="[object Object]"){l="null"}var c=this.getMethodName();if(i){if(l&&i.indexOf(l)!=0){o+=l+"."}o+=i;if(c&&i.indexOf("."+c)!=i.length-c.length-1){o+=" [as "+c+"]"}}else{o+=l+"."+(c||"")}}else if(u){o+="new "+(i||"")}else if(i){o+=i}else{o+=r;a=false}if(a){o+=" ("+r+")"}return o}function cloneCallSite(e){var r={};Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((function(n){r[n]=/^(?:is|get)/.test(n)?function(){return e[n].call(e)}:e[n]}));r.toString=CallSiteToString;return r}function wrapCallSite(e,r){if(r===undefined){r={nextPosition:null,curPosition:null}}if(e.isNative()){r.curPosition=null;return e}var n=e.getFileName()||e.getScriptNameOrSourceURL();if(n){var t=e.getLineNumber();var o=e.getColumnNumber()-1;var i=/^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/;var a=i.test(globalProcessVersion())?0:62;if(t===1&&o>a&&!isInBrowser()&&!e.isEval()){o-=a}var u=mapSourcePosition({source:n,line:t,column:o});r.curPosition=u;e=cloneCallSite(e);var s=e.getFunctionName;e.getFunctionName=function(){if(r.nextPosition==null){return s()}return r.nextPosition.name||s()};e.getFileName=function(){return u.source};e.getLineNumber=function(){return u.line};e.getColumnNumber=function(){return u.column+1};e.getScriptNameOrSourceURL=function(){return u.source};return e}var l=e.isEval()&&e.getEvalOrigin();if(l){l=mapEvalOrigin(l);e=cloneCallSite(e);e.getEvalOrigin=function(){return l};return e}return e}function prepareStackTrace(e,r){if(l){p={};f={}}var n=e.name||"Error";var t=e.message||"";var o=n+": "+t;var i={nextPosition:null,curPosition:null};var a=[];for(var u=r.length-1;u>=0;u--){a.push("\n at "+wrapCallSite(r[u],i));i.nextPosition=i.curPosition}i.curPosition=i.nextPosition=null;return o+a.reverse().join("")}function getErrorSource(e){var r=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(e.stack);if(r){var n=r[1];var t=+r[2];var o=+r[3];var a=p[n];if(!a&&i&&i.existsSync(n)){try{a=i.readFileSync(n,"utf8")}catch(e){a=""}}if(a){var u=a.split(/(?:\r\n|\r|\n)/)[t-1];if(u){return n+":"+t+"\n"+u+"\n"+new Array(o).join(" ")+"^"}}}return null}function printErrorAndExit(e){var r=getErrorSource(e);var n=globalProcessStderr();if(n&&n._handle&&n._handle.setBlocking){n._handle.setBlocking(true)}if(r){console.error();console.error(r)}console.error(e.stack);globalProcessExit(1)}function shimEmitUncaughtException(){var e=process.emit;process.emit=function(r){if(r==="uncaughtException"){var n=arguments[1]&&arguments[1].stack;var t=this.listeners(r).length>0;if(n&&!t){return printErrorAndExit(arguments[1])}}return e.apply(this,arguments)}}var S=h.slice(0);var _=d.slice(0);r.wrapCallSite=wrapCallSite;r.getErrorSource=getErrorSource;r.mapSourcePosition=mapSourcePosition;r.retrieveSourceMap=v;r.install=function(r){r=r||{};if(r.environment){c=r.environment;if(["node","browser","auto"].indexOf(c)===-1){throw new Error("environment "+c+" was unknown. Available options are {auto, browser, node}")}}if(r.retrieveFile){if(r.overrideRetrieveFile){h.length=0}h.unshift(r.retrieveFile)}if(r.retrieveSourceMap){if(r.overrideRetrieveSourceMap){d.length=0}d.unshift(r.retrieveSourceMap)}if(r.hookRequire&&!isInBrowser()){var n=dynamicRequire(e,"module");var t=n.prototype._compile;if(!t.__sourceMapSupport){n.prototype._compile=function(e,r){p[r]=e;f[r]=undefined;return t.call(this,e,r)};n.prototype._compile.__sourceMapSupport=true}}if(!l){l="emptyCacheBetweenOperations"in r?r.emptyCacheBetweenOperations:false}if(!u){u=true;Error.prepareStackTrace=prepareStackTrace}if(!s){var o="handleUncaughtExceptions"in r?r.handleUncaughtExceptions:true;try{var i=dynamicRequire(e,"worker_threads");if(i.isMainThread===false){o=false}}catch(e){}if(o&&hasGlobalProcessEventEmitter()){s=true;shimEmitUncaughtException()}}};r.resetRetrieveHandlers=function(){h.length=0;d.length=0;h=S.slice(0);d=_.slice(0);v=handlerExec(d);m=handlerExec(h)}},147:e=>{"use strict";e.exports=require("fs")},17:e=>{"use strict";e.exports=require("path")}};var r={};function __webpack_require__(n){var t=r[n];if(t!==undefined){return t.exports}var o=r[n]={id:n,loaded:false,exports:{}};var i=true;try{e[n](o,o.exports,__webpack_require__);i=false}finally{if(i)delete r[n]}o.loaded=true;return o.exports}(()=>{__webpack_require__.nmd=e=>{e.paths=[];if(!e.children)e.children=[];return e}})();if(typeof __webpack_require__!=="undefined")__webpack_require__.ab=__dirname+"/";var n={};(()=>{__webpack_require__(284).install()})();module.exports=n})(); -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | clearMocks: true, 3 | moduleFileExtensions: ['js', 'ts'], 4 | testEnvironment: 'node', 5 | testMatch: ['**/*.test.ts'], 6 | testRunner: 'jest-circus/runner', 7 | transform: { 8 | '^.+\\.ts$': 'ts-jest' 9 | }, 10 | verbose: true 11 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "check-new-commits", 3 | "version": "1.0.7", 4 | "description": "GitHub action that checks if there has been any new commit in a given time frame", 5 | "main": "lib/main.js", 6 | "scripts": { 7 | "postinstall": "npx -p husky husky-run install", 8 | "act": "act -j action-tests --secret-file .secrets --env-file .env", 9 | "clean": "rm -rf lib/*", 10 | "format": "prettier --write **/*.ts", 11 | "format-check": "prettier --check **/*.ts", 12 | "lint": "eslint **/*.ts", 13 | "build": "tsc", 14 | "package": "ncc build --source-map --license licenses.txt", 15 | "test": "jest", 16 | "all": "npm run clean && npm run build && npm run format && npm run lint && npm run package && npm test", 17 | "release": "standard-version", 18 | "postversion": "git push --follow-tags" 19 | }, 20 | "repository": { 21 | "type": "git", 22 | "url": "git+https://github.com/adriangl/check-new-commits-action.git" 23 | }, 24 | "keywords": [ 25 | "GitHub", 26 | "Actions", 27 | "TypeScript" 28 | ], 29 | "author": "Adrián García", 30 | "license": "MIT", 31 | "bugs": { 32 | "url": "https://github.com/adriangl/check-new-commits-action/issues" 33 | }, 34 | "homepage": "https://github.com/adriangl/check-new-commits-action#readme", 35 | "private": true, 36 | "husky": { 37 | "hooks": { 38 | "pre-commit": "lint-staged" 39 | } 40 | }, 41 | "lint-staged": { 42 | "*.ts": [ 43 | "eslint --fix", 44 | "prettier --write" 45 | ] 46 | }, 47 | "standard-version": { 48 | "scripts": { 49 | "posttag": "TAG=$(git describe --tags --abbrev=0); MAJOR_TAG=${TAG%%.*}; git tag -f $MAJOR_TAG" 50 | } 51 | }, 52 | "dependencies": { 53 | "@actions/core": "^1.10.1", 54 | "@actions/github": "^6.0.0" 55 | }, 56 | "devDependencies": { 57 | "@types/jest": "^29.5.12", 58 | "@typescript-eslint/eslint-plugin": "^7.16.0", 59 | "@typescript-eslint/parser": "^7.16.0", 60 | "@vercel/ncc": "^0.38.1", 61 | "eslint": "^8.5.6", 62 | "eslint-plugin-deprecation": "^3.0.0", 63 | "eslint-plugin-import": "^2.29.1", 64 | "eslint-plugin-jest": "^28.6.0", 65 | "husky": "^4.3.8", 66 | "jest": "^29.7.0", 67 | "jest-circus": "^29.7.0", 68 | "lint-staged": "^15.2.7", 69 | "pinst": "^3.0.0", 70 | "prettier": "^3.3.2", 71 | "standard-version": "^9.5.0", 72 | "ts-jest": "^29.2.0", 73 | "typescript": "^5.5.3", 74 | "npm-check-updates": "^16.14.20" 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/action-inputs.ts: -------------------------------------------------------------------------------- 1 | export interface ActionInputs { 2 | authToken: string 3 | seconds: number 4 | branch: string 5 | } 6 | -------------------------------------------------------------------------------- /src/commits-info.ts: -------------------------------------------------------------------------------- 1 | export class CommitsInfo { 2 | public constructor( 3 | readonly hasNewCommits: boolean, 4 | readonly newCommitsNumber: number, 5 | ) {} 6 | } 7 | -------------------------------------------------------------------------------- /src/constants.ts: -------------------------------------------------------------------------------- 1 | export const INPUT_TOKEN = "token" 2 | export const INPUT_SECONDS = "seconds" 3 | export const INPUT_BRANCH = "branch" 4 | 5 | export const OUTPUT_HAS_NEW_COMMITS = "has-new-commits" 6 | export const OUTPUT_NEW_COMMITS_NUMBER = "new-commits-number" 7 | 8 | export const REF_HEADS_PREFIX = "refs/heads/" 9 | export const REF_TAGS_PREFIX = "refs/tags/" 10 | -------------------------------------------------------------------------------- /src/input-helper.ts: -------------------------------------------------------------------------------- 1 | import * as core from "@actions/core" 2 | import * as github from "@actions/github" 3 | import { ActionInputs } from "./action-inputs" 4 | import { 5 | INPUT_TOKEN, 6 | INPUT_SECONDS, 7 | INPUT_BRANCH, 8 | REF_HEADS_PREFIX, 9 | REF_TAGS_PREFIX, 10 | } from "./constants" 11 | 12 | export function getInputs(): ActionInputs { 13 | const result = {} as unknown as ActionInputs 14 | 15 | result.authToken = getAuthToken() 16 | result.seconds = getSeconds() 17 | result.branch = getBranch() 18 | 19 | return result 20 | } 21 | 22 | function getAuthToken(): string { 23 | return core.getInput(INPUT_TOKEN) 24 | } 25 | 26 | function getSeconds(): number { 27 | return parseInt(core.getInput(INPUT_SECONDS)) 28 | } 29 | 30 | function getBranch(): string { 31 | let branch = core.getInput(INPUT_BRANCH) || github.context.ref 32 | 33 | if (branch.startsWith(REF_TAGS_PREFIX)) { 34 | // The ref is a tag, so we need to exit since the action is not compatible with a tag 35 | throw Error(`The specified branch ${branch} is a tag. Exiting...`) 36 | } else if (branch.startsWith(REF_HEADS_PREFIX)) { 37 | core.debug(`Stripping refs from ${branch}`) 38 | // This is a qualified name for a branch, so remove the qualifying stuff from it 39 | branch = branch.replace(REF_HEADS_PREFIX, "") 40 | } else { 41 | // The ref should be a branch, let's hope for the best 42 | core.debug(`The branch ${branch} is already formatted`) 43 | } 44 | 45 | return branch 46 | } 47 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | // Need imports like this so ncc doesn't complain: https://github.community/t/using-es6-modules-as-github-custom-action/126949 2 | import * as core from "@actions/core" 3 | import * as github from "@actions/github" 4 | import { CommitsInfo } from "./commits-info" 5 | import { OUTPUT_HAS_NEW_COMMITS, OUTPUT_NEW_COMMITS_NUMBER } from "./constants" 6 | import { getInputs } from "./input-helper" 7 | 8 | // most @actions toolkit packages have async methods 9 | async function run(): Promise { 10 | try { 11 | const inputs = getInputs() 12 | const owner = github.context.repo.owner 13 | const repo = github.context.repo.repo 14 | 15 | const hasNewCommitsInfo = await _hasNewCommits( 16 | inputs.authToken, 17 | inputs.seconds, 18 | owner, 19 | repo, 20 | inputs.branch, 21 | ) 22 | 23 | core.setOutput(OUTPUT_HAS_NEW_COMMITS, hasNewCommitsInfo.hasNewCommits) 24 | core.setOutput( 25 | OUTPUT_NEW_COMMITS_NUMBER, 26 | hasNewCommitsInfo.newCommitsNumber, 27 | ) 28 | } catch (e: unknown) { 29 | // Types of stuff caught in a catch clause must be 'unknown' and then be casted to the specific type 30 | // https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-0.html#unknown-on-catch-clause-bindings 31 | // https://ncjamieson.com/catching-unknowns/ 32 | if (e instanceof Error) { 33 | core.setFailed(e) 34 | } else { 35 | core.setFailed("Unknown error") 36 | } 37 | } 38 | } 39 | 40 | async function _hasNewCommits( 41 | authToken: string, 42 | seconds: number, 43 | owner: string, 44 | repo: string, 45 | branch: string, 46 | ): Promise { 47 | core.debug("Parameters:") 48 | core.debug(`authToken = ${authToken}`) 49 | core.debug(`seconds = ${seconds}`) 50 | core.debug(`owner = ${owner}`) 51 | core.debug(`repo = ${repo}`) 52 | core.debug(`branch = ${branch}`) 53 | 54 | core.info( 55 | `Checking if there has been commits in the last ${seconds} seconds...`, 56 | ) 57 | 58 | const currentDate = new Date() 59 | const commitCheckDate = new Date(currentDate.getTime() - seconds * 1000) 60 | 61 | // Get the latest commit in the branch 62 | const octokit = github.getOctokit(authToken) 63 | 64 | core.info(`Checking commits since ${commitCheckDate.toUTCString()}`) 65 | 66 | const { data: commitIterator } = await octokit.rest.repos.listCommits({ 67 | owner: owner, 68 | repo: repo, 69 | sha: branch, 70 | since: commitCheckDate.toISOString(), 71 | }) 72 | 73 | const commitList = Array.from(commitIterator.entries()) 74 | const commitNumber = commitList.length 75 | const hasNewCommits = commitNumber > 0 76 | 77 | core.info( 78 | `There has been ${commitNumber} new commit(s) in branch "${branch}" since ${commitCheckDate.toUTCString()}`, 79 | ) 80 | for (const commitData of commitList) { 81 | const commitInfo = commitData[1] 82 | core.info( 83 | `* ${commitInfo.commit.message.trim().split("\n", 1)[0]} by ${ 84 | commitInfo.commit.author?.name ?? "" 85 | } at ${new Date(commitInfo.commit.author?.date ?? 0).toUTCString()}`, 86 | ) 87 | } 88 | 89 | return new CommitsInfo(hasNewCommits, commitNumber) 90 | } 91 | 92 | void run() 93 | -------------------------------------------------------------------------------- /tsconfig.eslint.json: -------------------------------------------------------------------------------- 1 | { 2 | // extend your base config so you don't have to redefine your compilerOptions 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | // ensure that nobody can accidentally use this config for a build 6 | "noEmit": true 7 | }, 8 | "include": [ 9 | "src/**/*.ts", 10 | "__test__/**/*.ts", 11 | ] 12 | } -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ 4 | "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ 5 | "outDir": "./lib", /* Redirect output structure to the directory. */ 6 | "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ 7 | "strict": true, /* Enable all strict type-checking options. */ 8 | "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ 9 | "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ 10 | }, 11 | "include": [ 12 | "src/**/*.ts" 13 | ], 14 | "exclude": [ 15 | "node_modules", 16 | "lib" 17 | ] 18 | } --------------------------------------------------------------------------------