├── .eslintignore
├── .eslintrc.json
├── .gitattributes
├── .github
├── dependabot.yml
└── workflows
│ ├── check-dist.yml
│ ├── codeql-analysis.yml
│ └── test.yml
├── .gitignore
├── .prettierignore
├── .prettierrc.json
├── CODEOWNERS
├── DEVELOPING.md
├── LICENSE.md
├── README.md
├── __tests__
└── main.test.ts
├── action.yml
├── dist
├── index.js
├── index.js.map
├── licenses.txt
└── sourcemap-register.js
├── jest.config.js
├── package-lock.json
├── package.json
├── src
├── git.ts
├── main.ts
├── slither.ts
└── utils.ts
└── tsconfig.json
/.eslintignore:
--------------------------------------------------------------------------------
1 | dist/
2 | lib/
3 | node_modules/
4 | jest.config.js
5 |
--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "plugins": ["jest", "@typescript-eslint"],
3 | "extends": ["plugin:github/recommended"],
4 | "parser": "@typescript-eslint/parser",
5 | "parserOptions": {
6 | "ecmaVersion": 9,
7 | "sourceType": "module",
8 | "project": "./tsconfig.json"
9 | },
10 | "rules": {
11 | "i18n-text/no-en": "off",
12 | "eslint-comments/no-use": "off",
13 | "import/no-namespace": "off",
14 | "no-unused-vars": "off",
15 | "@typescript-eslint/no-unused-vars": "error",
16 | "@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
17 | "@typescript-eslint/no-require-imports": "error",
18 | "@typescript-eslint/array-type": "error",
19 | "@typescript-eslint/await-thenable": "error",
20 | "@typescript-eslint/ban-ts-comment": "error",
21 | "camelcase": "off",
22 | "@typescript-eslint/consistent-type-assertions": "error",
23 | "@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
24 | "@typescript-eslint/func-call-spacing": ["error", "never"],
25 | "@typescript-eslint/no-array-constructor": "error",
26 | "@typescript-eslint/no-empty-interface": "error",
27 | "@typescript-eslint/no-explicit-any": "error",
28 | "@typescript-eslint/no-extraneous-class": "error",
29 | "@typescript-eslint/no-for-in-array": "error",
30 | "@typescript-eslint/no-inferrable-types": "error",
31 | "@typescript-eslint/no-misused-new": "error",
32 | "@typescript-eslint/no-namespace": "error",
33 | "@typescript-eslint/no-non-null-assertion": "warn",
34 | "@typescript-eslint/no-unnecessary-qualifier": "error",
35 | "@typescript-eslint/no-unnecessary-type-assertion": "error",
36 | "@typescript-eslint/no-useless-constructor": "error",
37 | "@typescript-eslint/no-var-requires": "error",
38 | "@typescript-eslint/prefer-for-of": "warn",
39 | "@typescript-eslint/prefer-function-type": "warn",
40 | "@typescript-eslint/prefer-includes": "error",
41 | "@typescript-eslint/prefer-string-starts-ends-with": "error",
42 | "@typescript-eslint/promise-function-async": "error",
43 | "@typescript-eslint/require-array-sort-compare": "error",
44 | "@typescript-eslint/restrict-plus-operands": "error",
45 | "semi": "off",
46 | "@typescript-eslint/semi": ["error", "never"],
47 | "@typescript-eslint/type-annotation-spacing": "error",
48 | "@typescript-eslint/unbound-method": "error"
49 | },
50 | "env": {
51 | "node": true,
52 | "es6": true,
53 | "jest/globals": true
54 | }
55 | }
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | dist/** -diff linguist-generated=true
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: github-actions
4 | directory: /
5 | schedule:
6 | interval: weekly
7 |
8 | - package-ecosystem: npm
9 | directory: /
10 | schedule:
11 | interval: weekly
12 |
--------------------------------------------------------------------------------
/.github/workflows/check-dist.yml:
--------------------------------------------------------------------------------
1 | # `dist/index.js` is a special file in Actions.
2 | # When you reference an action with `uses:` in a workflow,
3 | # `index.js` is the code that will run.
4 | # For our project, we generate this file through a build process from other source files.
5 | # We need to make sure the checked-in `index.js` actually matches what we expect it to be.
6 | name: Check dist/
7 |
8 | on:
9 | push:
10 | branches:
11 | - main
12 | paths-ignore:
13 | - '**.md'
14 | pull_request:
15 | paths-ignore:
16 | - '**.md'
17 | workflow_dispatch:
18 |
19 | jobs:
20 | check-dist:
21 | runs-on: ubuntu-latest
22 |
23 | steps:
24 | - uses: actions/checkout@v3
25 |
26 | - name: Set Node.js 16.x
27 | uses: actions/setup-node@v3.6.0
28 | with:
29 | node-version: 16.x
30 |
31 | - name: Install dependencies
32 | run: npm ci
33 |
34 | - name: Rebuild the dist/ directory
35 | run: |
36 | npm run build
37 | npm run package
38 |
39 | - name: Compare the expected and actual dist/ directories
40 | run: |
41 | if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
42 | echo "Detected uncommitted changes after build. See status below:"
43 | git diff
44 | exit 1
45 | fi
46 | id: diff
47 |
48 | # If index.js was different than expected, upload the expected version as an artifact
49 | - uses: actions/upload-artifact@v3
50 | if: ${{ failure() && steps.diff.conclusion == 'failure' }}
51 | with:
52 | name: dist
53 | path: dist/
54 |
--------------------------------------------------------------------------------
/.github/workflows/codeql-analysis.yml:
--------------------------------------------------------------------------------
1 | # For most projects, this workflow file will not need changing; you simply need
2 | # to commit it to your repository.
3 | #
4 | # You may wish to alter this file to override the set of languages analyzed,
5 | # or to provide custom queries or build logic.
6 | #
7 | # ******** NOTE ********
8 | # We have attempted to detect the languages in your repository. Please check
9 | # the `language` matrix defined below to confirm you have the correct set of
10 | # supported CodeQL languages.
11 | #
12 | name: "CodeQL"
13 |
14 | on:
15 | push:
16 | branches: [ main ]
17 | pull_request:
18 | # The branches below must be a subset of the branches above
19 | branches: [ main ]
20 | schedule:
21 | - cron: '31 7 * * 3'
22 |
23 | jobs:
24 | analyze:
25 | name: Analyze
26 | runs-on: ubuntu-latest
27 | permissions:
28 | actions: read
29 | contents: read
30 | security-events: write
31 |
32 | strategy:
33 | fail-fast: false
34 | matrix:
35 | language: [ 'TypeScript' ]
36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37 | # Learn more about CodeQL language support at https://git.io/codeql-language-support
38 |
39 | steps:
40 | - name: Checkout repository
41 | uses: actions/checkout@v3
42 |
43 | # Initializes the CodeQL tools for scanning.
44 | - name: Initialize CodeQL
45 | uses: github/codeql-action/init@v2
46 | with:
47 | languages: ${{ matrix.language }}
48 | source-root: src
49 | # If you wish to specify custom queries, you can do so here or in a config file.
50 | # By default, queries listed here will override any specified in a config file.
51 | # Prefix the list here with "+" to use these queries and those in the config file.
52 | # queries: ./path/to/local/query, your-org/your-repo/queries@main
53 |
54 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
55 | # If this step fails, then you should remove it and run the build manually (see below)
56 | - name: Autobuild
57 | uses: github/codeql-action/autobuild@v2
58 |
59 | # ℹ️ Command-line programs to run using the OS shell.
60 | # 📚 https://git.io/JvXDl
61 |
62 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
63 | # and modify them (or add more) to build your code if your project
64 | # uses a compiled language
65 |
66 | #- run: |
67 | # make bootstrap
68 | # make release
69 |
70 | - name: Perform CodeQL Analysis
71 | uses: github/codeql-action/analyze@v2
72 |
--------------------------------------------------------------------------------
/.github/workflows/test.yml:
--------------------------------------------------------------------------------
1 | name: 'build-test'
2 | on: # rebuild any PRs and main branch changes
3 | pull_request:
4 | push:
5 | branches:
6 | - main
7 | - 'releases/*'
8 |
9 | jobs:
10 | build: # make sure build/ci work properly
11 | runs-on: ubuntu-latest
12 | steps:
13 | - uses: actions/checkout@v3
14 | - run: |
15 | npm install
16 | - run: |
17 | npm run all
18 | test: # make sure the action works on a clean machine without building
19 | runs-on: ubuntu-latest
20 | if: false
21 | steps:
22 | - uses: actions/checkout@v3
23 | - uses: ./
24 | with:
25 | milliseconds: 1000
26 |
--------------------------------------------------------------------------------
/.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/**/*
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | dist/
2 | lib/
3 | node_modules/
--------------------------------------------------------------------------------
/.prettierrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "printWidth": 80,
3 | "tabWidth": 2,
4 | "useTabs": false,
5 | "semi": false,
6 | "singleQuote": true,
7 | "trailingComma": "none",
8 | "bracketSpacing": false,
9 | "arrowParens": "avoid"
10 | }
11 |
--------------------------------------------------------------------------------
/CODEOWNERS:
--------------------------------------------------------------------------------
1 | * @elopez
2 |
--------------------------------------------------------------------------------
/DEVELOPING.md:
--------------------------------------------------------------------------------
1 | ## Development
2 |
3 | ### Code in Main
4 |
5 | > First, you'll need to have a reasonably modern version of `node` handy. This won't work with versions older than 9, for instance.
6 |
7 | Install the dependencies
8 | ```bash
9 | $ npm install
10 | ```
11 |
12 | Build the typescript and package it for distribution
13 | ```bash
14 | $ npm run build && npm run package
15 | ```
16 |
17 | Run the tests :heavy_check_mark:
18 | ```bash
19 | $ npm test
20 |
21 | PASS ./index.test.js
22 | ✓ throws invalid number (3ms)
23 | ✓ wait 500 ms (504ms)
24 | ✓ test runs (95ms)
25 |
26 | ...
27 | ```
28 |
29 | ### Publish to a distribution branch
30 |
31 | Actions are run from GitHub repos so we will checkin the packed dist folder.
32 |
33 | Then run [ncc](https://github.com/zeit/ncc) and push the results:
34 | ```bash
35 | $ npm run package
36 | $ git add dist
37 | $ git commit -a -m "prod dependencies"
38 | $ git push origin releases/v1
39 | ```
40 |
41 | Note: We recommend using the `--license` option for ncc, which will create a license file for all of the production node modules used in your project.
42 |
43 | Your action is now published! :rocket:
44 |
45 | See the [versioning documentation](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)
46 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | # License
2 |
3 | ## Slither documentation action
4 |
5 | GNU AFFERO GENERAL PUBLIC LICENSE
6 | Version 3, 19 November 2007
7 |
8 | Copyright (C) 2007 Free Software Foundation, Inc.
9 | Everyone is permitted to copy and distribute verbatim copies
10 | of this license document, but changing it is not allowed.
11 |
12 | Preamble
13 |
14 | The GNU Affero General Public License is a free, copyleft license for
15 | software and other kinds of works, specifically designed to ensure
16 | cooperation with the community in the case of network server software.
17 |
18 | The licenses for most software and other practical works are designed
19 | to take away your freedom to share and change the works. By contrast,
20 | our General Public Licenses are intended to guarantee your freedom to
21 | share and change all versions of a program--to make sure it remains free
22 | software for all its users.
23 |
24 | When we speak of free software, we are referring to freedom, not
25 | price. Our General Public Licenses are designed to make sure that you
26 | have the freedom to distribute copies of free software (and charge for
27 | them if you wish), that you receive source code or can get it if you
28 | want it, that you can change the software or use pieces of it in new
29 | free programs, and that you know you can do these things.
30 |
31 | Developers that use our General Public Licenses protect your rights
32 | with two steps: (1) assert copyright on the software, and (2) offer
33 | you this License which gives you legal permission to copy, distribute
34 | and/or modify the software.
35 |
36 | A secondary benefit of defending all users' freedom is that
37 | improvements made in alternate versions of the program, if they
38 | receive widespread use, become available for other developers to
39 | incorporate. Many developers of free software are heartened and
40 | encouraged by the resulting cooperation. However, in the case of
41 | software used on network servers, this result may fail to come about.
42 | The GNU General Public License permits making a modified version and
43 | letting the public access it on a server without ever releasing its
44 | source code to the public.
45 |
46 | The GNU Affero General Public License is designed specifically to
47 | ensure that, in such cases, the modified source code becomes available
48 | to the community. It requires the operator of a network server to
49 | provide the source code of the modified version running there to the
50 | users of that server. Therefore, public use of a modified version, on
51 | a publicly accessible server, gives the public access to the source
52 | code of the modified version.
53 |
54 | An older license, called the Affero General Public License and
55 | published by Affero, was designed to accomplish similar goals. This is
56 | a different license, not a version of the Affero GPL, but Affero has
57 | released a new version of the Affero GPL which permits relicensing under
58 | this license.
59 |
60 | The precise terms and conditions for copying, distribution and
61 | modification follow.
62 |
63 | TERMS AND CONDITIONS
64 |
65 | 0. Definitions.
66 |
67 | "This License" refers to version 3 of the GNU Affero General Public License.
68 |
69 | "Copyright" also means copyright-like laws that apply to other kinds of
70 | works, such as semiconductor masks.
71 |
72 | "The Program" refers to any copyrightable work licensed under this
73 | License. Each licensee is addressed as "you". "Licensees" and
74 | "recipients" may be individuals or organizations.
75 |
76 | To "modify" a work means to copy from or adapt all or part of the work
77 | in a fashion requiring copyright permission, other than the making of an
78 | exact copy. The resulting work is called a "modified version" of the
79 | earlier work or a work "based on" the earlier work.
80 |
81 | A "covered work" means either the unmodified Program or a work based
82 | on the Program.
83 |
84 | To "propagate" a work means to do anything with it that, without
85 | permission, would make you directly or secondarily liable for
86 | infringement under applicable copyright law, except executing it on a
87 | computer or modifying a private copy. Propagation includes copying,
88 | distribution (with or without modification), making available to the
89 | public, and in some countries other activities as well.
90 |
91 | To "convey" a work means any kind of propagation that enables other
92 | parties to make or receive copies. Mere interaction with a user through
93 | a computer network, with no transfer of a copy, is not conveying.
94 |
95 | An interactive user interface displays "Appropriate Legal Notices"
96 | to the extent that it includes a convenient and prominently visible
97 | feature that (1) displays an appropriate copyright notice, and (2)
98 | tells the user that there is no warranty for the work (except to the
99 | extent that warranties are provided), that licensees may convey the
100 | work under this License, and how to view a copy of this License. If
101 | the interface presents a list of user commands or options, such as a
102 | menu, a prominent item in the list meets this criterion.
103 |
104 | 1. Source Code.
105 |
106 | The "source code" for a work means the preferred form of the work
107 | for making modifications to it. "Object code" means any non-source
108 | form of a work.
109 |
110 | A "Standard Interface" means an interface that either is an official
111 | standard defined by a recognized standards body, or, in the case of
112 | interfaces specified for a particular programming language, one that
113 | is widely used among developers working in that language.
114 |
115 | The "System Libraries" of an executable work include anything, other
116 | than the work as a whole, that (a) is included in the normal form of
117 | packaging a Major Component, but which is not part of that Major
118 | Component, and (b) serves only to enable use of the work with that
119 | Major Component, or to implement a Standard Interface for which an
120 | implementation is available to the public in source code form. A
121 | "Major Component", in this context, means a major essential component
122 | (kernel, window system, and so on) of the specific operating system
123 | (if any) on which the executable work runs, or a compiler used to
124 | produce the work, or an object code interpreter used to run it.
125 |
126 | The "Corresponding Source" for a work in object code form means all
127 | the source code needed to generate, install, and (for an executable
128 | work) run the object code and to modify the work, including scripts to
129 | control those activities. However, it does not include the work's
130 | System Libraries, or general-purpose tools or generally available free
131 | programs which are used unmodified in performing those activities but
132 | which are not part of the work. For example, Corresponding Source
133 | includes interface definition files associated with source files for
134 | the work, and the source code for shared libraries and dynamically
135 | linked subprograms that the work is specifically designed to require,
136 | such as by intimate data communication or control flow between those
137 | subprograms and other parts of the work.
138 |
139 | The Corresponding Source need not include anything that users
140 | can regenerate automatically from other parts of the Corresponding
141 | Source.
142 |
143 | The Corresponding Source for a work in source code form is that
144 | same work.
145 |
146 | 2. Basic Permissions.
147 |
148 | All rights granted under this License are granted for the term of
149 | copyright on the Program, and are irrevocable provided the stated
150 | conditions are met. This License explicitly affirms your unlimited
151 | permission to run the unmodified Program. The output from running a
152 | covered work is covered by this License only if the output, given its
153 | content, constitutes a covered work. This License acknowledges your
154 | rights of fair use or other equivalent, as provided by copyright law.
155 |
156 | You may make, run and propagate covered works that you do not
157 | convey, without conditions so long as your license otherwise remains
158 | in force. You may convey covered works to others for the sole purpose
159 | of having them make modifications exclusively for you, or provide you
160 | with facilities for running those works, provided that you comply with
161 | the terms of this License in conveying all material for which you do
162 | not control copyright. Those thus making or running the covered works
163 | for you must do so exclusively on your behalf, under your direction
164 | and control, on terms that prohibit them from making any copies of
165 | your copyrighted material outside their relationship with you.
166 |
167 | Conveying under any other circumstances is permitted solely under
168 | the conditions stated below. Sublicensing is not allowed; section 10
169 | makes it unnecessary.
170 |
171 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
172 |
173 | No covered work shall be deemed part of an effective technological
174 | measure under any applicable law fulfilling obligations under article
175 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
176 | similar laws prohibiting or restricting circumvention of such
177 | measures.
178 |
179 | When you convey a covered work, you waive any legal power to forbid
180 | circumvention of technological measures to the extent such circumvention
181 | is effected by exercising rights under this License with respect to
182 | the covered work, and you disclaim any intention to limit operation or
183 | modification of the work as a means of enforcing, against the work's
184 | users, your or third parties' legal rights to forbid circumvention of
185 | technological measures.
186 |
187 | 4. Conveying Verbatim Copies.
188 |
189 | You may convey verbatim copies of the Program's source code as you
190 | receive it, in any medium, provided that you conspicuously and
191 | appropriately publish on each copy an appropriate copyright notice;
192 | keep intact all notices stating that this License and any
193 | non-permissive terms added in accord with section 7 apply to the code;
194 | keep intact all notices of the absence of any warranty; and give all
195 | recipients a copy of this License along with the Program.
196 |
197 | You may charge any price or no price for each copy that you convey,
198 | and you may offer support or warranty protection for a fee.
199 |
200 | 5. Conveying Modified Source Versions.
201 |
202 | You may convey a work based on the Program, or the modifications to
203 | produce it from the Program, in the form of source code under the
204 | terms of section 4, provided that you also meet all of these conditions:
205 |
206 | a) The work must carry prominent notices stating that you modified
207 | it, and giving a relevant date.
208 |
209 | b) The work must carry prominent notices stating that it is
210 | released under this License and any conditions added under section
211 | 7. This requirement modifies the requirement in section 4 to
212 | "keep intact all notices".
213 |
214 | c) You must license the entire work, as a whole, under this
215 | License to anyone who comes into possession of a copy. This
216 | License will therefore apply, along with any applicable section 7
217 | additional terms, to the whole of the work, and all its parts,
218 | regardless of how they are packaged. This License gives no
219 | permission to license the work in any other way, but it does not
220 | invalidate such permission if you have separately received it.
221 |
222 | d) If the work has interactive user interfaces, each must display
223 | Appropriate Legal Notices; however, if the Program has interactive
224 | interfaces that do not display Appropriate Legal Notices, your
225 | work need not make them do so.
226 |
227 | A compilation of a covered work with other separate and independent
228 | works, which are not by their nature extensions of the covered work,
229 | and which are not combined with it such as to form a larger program,
230 | in or on a volume of a storage or distribution medium, is called an
231 | "aggregate" if the compilation and its resulting copyright are not
232 | used to limit the access or legal rights of the compilation's users
233 | beyond what the individual works permit. Inclusion of a covered work
234 | in an aggregate does not cause this License to apply to the other
235 | parts of the aggregate.
236 |
237 | 6. Conveying Non-Source Forms.
238 |
239 | You may convey a covered work in object code form under the terms
240 | of sections 4 and 5, provided that you also convey the
241 | machine-readable Corresponding Source under the terms of this License,
242 | in one of these ways:
243 |
244 | a) Convey the object code in, or embodied in, a physical product
245 | (including a physical distribution medium), accompanied by the
246 | Corresponding Source fixed on a durable physical medium
247 | customarily used for software interchange.
248 |
249 | b) Convey the object code in, or embodied in, a physical product
250 | (including a physical distribution medium), accompanied by a
251 | written offer, valid for at least three years and valid for as
252 | long as you offer spare parts or customer support for that product
253 | model, to give anyone who possesses the object code either (1) a
254 | copy of the Corresponding Source for all the software in the
255 | product that is covered by this License, on a durable physical
256 | medium customarily used for software interchange, for a price no
257 | more than your reasonable cost of physically performing this
258 | conveying of source, or (2) access to copy the
259 | Corresponding Source from a network server at no charge.
260 |
261 | c) Convey individual copies of the object code with a copy of the
262 | written offer to provide the Corresponding Source. This
263 | alternative is allowed only occasionally and noncommercially, and
264 | only if you received the object code with such an offer, in accord
265 | with subsection 6b.
266 |
267 | d) Convey the object code by offering access from a designated
268 | place (gratis or for a charge), and offer equivalent access to the
269 | Corresponding Source in the same way through the same place at no
270 | further charge. You need not require recipients to copy the
271 | Corresponding Source along with the object code. If the place to
272 | copy the object code is a network server, the Corresponding Source
273 | may be on a different server (operated by you or a third party)
274 | that supports equivalent copying facilities, provided you maintain
275 | clear directions next to the object code saying where to find the
276 | Corresponding Source. Regardless of what server hosts the
277 | Corresponding Source, you remain obligated to ensure that it is
278 | available for as long as needed to satisfy these requirements.
279 |
280 | e) Convey the object code using peer-to-peer transmission, provided
281 | you inform other peers where the object code and Corresponding
282 | Source of the work are being offered to the general public at no
283 | charge under subsection 6d.
284 |
285 | A separable portion of the object code, whose source code is excluded
286 | from the Corresponding Source as a System Library, need not be
287 | included in conveying the object code work.
288 |
289 | A "User Product" is either (1) a "consumer product", which means any
290 | tangible personal property which is normally used for personal, family,
291 | or household purposes, or (2) anything designed or sold for incorporation
292 | into a dwelling. In determining whether a product is a consumer product,
293 | doubtful cases shall be resolved in favor of coverage. For a particular
294 | product received by a particular user, "normally used" refers to a
295 | typical or common use of that class of product, regardless of the status
296 | of the particular user or of the way in which the particular user
297 | actually uses, or expects or is expected to use, the product. A product
298 | is a consumer product regardless of whether the product has substantial
299 | commercial, industrial or non-consumer uses, unless such uses represent
300 | the only significant mode of use of the product.
301 |
302 | "Installation Information" for a User Product means any methods,
303 | procedures, authorization keys, or other information required to install
304 | and execute modified versions of a covered work in that User Product from
305 | a modified version of its Corresponding Source. The information must
306 | suffice to ensure that the continued functioning of the modified object
307 | code is in no case prevented or interfered with solely because
308 | modification has been made.
309 |
310 | If you convey an object code work under this section in, or with, or
311 | specifically for use in, a User Product, and the conveying occurs as
312 | part of a transaction in which the right of possession and use of the
313 | User Product is transferred to the recipient in perpetuity or for a
314 | fixed term (regardless of how the transaction is characterized), the
315 | Corresponding Source conveyed under this section must be accompanied
316 | by the Installation Information. But this requirement does not apply
317 | if neither you nor any third party retains the ability to install
318 | modified object code on the User Product (for example, the work has
319 | been installed in ROM).
320 |
321 | The requirement to provide Installation Information does not include a
322 | requirement to continue to provide support service, warranty, or updates
323 | for a work that has been modified or installed by the recipient, or for
324 | the User Product in which it has been modified or installed. Access to a
325 | network may be denied when the modification itself materially and
326 | adversely affects the operation of the network or violates the rules and
327 | protocols for communication across the network.
328 |
329 | Corresponding Source conveyed, and Installation Information provided,
330 | in accord with this section must be in a format that is publicly
331 | documented (and with an implementation available to the public in
332 | source code form), and must require no special password or key for
333 | unpacking, reading or copying.
334 |
335 | 7. Additional Terms.
336 |
337 | "Additional permissions" are terms that supplement the terms of this
338 | License by making exceptions from one or more of its conditions.
339 | Additional permissions that are applicable to the entire Program shall
340 | be treated as though they were included in this License, to the extent
341 | that they are valid under applicable law. If additional permissions
342 | apply only to part of the Program, that part may be used separately
343 | under those permissions, but the entire Program remains governed by
344 | this License without regard to the additional permissions.
345 |
346 | When you convey a copy of a covered work, you may at your option
347 | remove any additional permissions from that copy, or from any part of
348 | it. (Additional permissions may be written to require their own
349 | removal in certain cases when you modify the work.) You may place
350 | additional permissions on material, added by you to a covered work,
351 | for which you have or can give appropriate copyright permission.
352 |
353 | Notwithstanding any other provision of this License, for material you
354 | add to a covered work, you may (if authorized by the copyright holders of
355 | that material) supplement the terms of this License with terms:
356 |
357 | a) Disclaiming warranty or limiting liability differently from the
358 | terms of sections 15 and 16 of this License; or
359 |
360 | b) Requiring preservation of specified reasonable legal notices or
361 | author attributions in that material or in the Appropriate Legal
362 | Notices displayed by works containing it; or
363 |
364 | c) Prohibiting misrepresentation of the origin of that material, or
365 | requiring that modified versions of such material be marked in
366 | reasonable ways as different from the original version; or
367 |
368 | d) Limiting the use for publicity purposes of names of licensors or
369 | authors of the material; or
370 |
371 | e) Declining to grant rights under trademark law for use of some
372 | trade names, trademarks, or service marks; or
373 |
374 | f) Requiring indemnification of licensors and authors of that
375 | material by anyone who conveys the material (or modified versions of
376 | it) with contractual assumptions of liability to the recipient, for
377 | any liability that these contractual assumptions directly impose on
378 | those licensors and authors.
379 |
380 | All other non-permissive additional terms are considered "further
381 | restrictions" within the meaning of section 10. If the Program as you
382 | received it, or any part of it, contains a notice stating that it is
383 | governed by this License along with a term that is a further
384 | restriction, you may remove that term. If a license document contains
385 | a further restriction but permits relicensing or conveying under this
386 | License, you may add to a covered work material governed by the terms
387 | of that license document, provided that the further restriction does
388 | not survive such relicensing or conveying.
389 |
390 | If you add terms to a covered work in accord with this section, you
391 | must place, in the relevant source files, a statement of the
392 | additional terms that apply to those files, or a notice indicating
393 | where to find the applicable terms.
394 |
395 | Additional terms, permissive or non-permissive, may be stated in the
396 | form of a separately written license, or stated as exceptions;
397 | the above requirements apply either way.
398 |
399 | 8. Termination.
400 |
401 | You may not propagate or modify a covered work except as expressly
402 | provided under this License. Any attempt otherwise to propagate or
403 | modify it is void, and will automatically terminate your rights under
404 | this License (including any patent licenses granted under the third
405 | paragraph of section 11).
406 |
407 | However, if you cease all violation of this License, then your
408 | license from a particular copyright holder is reinstated (a)
409 | provisionally, unless and until the copyright holder explicitly and
410 | finally terminates your license, and (b) permanently, if the copyright
411 | holder fails to notify you of the violation by some reasonable means
412 | prior to 60 days after the cessation.
413 |
414 | Moreover, your license from a particular copyright holder is
415 | reinstated permanently if the copyright holder notifies you of the
416 | violation by some reasonable means, this is the first time you have
417 | received notice of violation of this License (for any work) from that
418 | copyright holder, and you cure the violation prior to 30 days after
419 | your receipt of the notice.
420 |
421 | Termination of your rights under this section does not terminate the
422 | licenses of parties who have received copies or rights from you under
423 | this License. If your rights have been terminated and not permanently
424 | reinstated, you do not qualify to receive new licenses for the same
425 | material under section 10.
426 |
427 | 9. Acceptance Not Required for Having Copies.
428 |
429 | You are not required to accept this License in order to receive or
430 | run a copy of the Program. Ancillary propagation of a covered work
431 | occurring solely as a consequence of using peer-to-peer transmission
432 | to receive a copy likewise does not require acceptance. However,
433 | nothing other than this License grants you permission to propagate or
434 | modify any covered work. These actions infringe copyright if you do
435 | not accept this License. Therefore, by modifying or propagating a
436 | covered work, you indicate your acceptance of this License to do so.
437 |
438 | 10. Automatic Licensing of Downstream Recipients.
439 |
440 | Each time you convey a covered work, the recipient automatically
441 | receives a license from the original licensors, to run, modify and
442 | propagate that work, subject to this License. You are not responsible
443 | for enforcing compliance by third parties with this License.
444 |
445 | An "entity transaction" is a transaction transferring control of an
446 | organization, or substantially all assets of one, or subdividing an
447 | organization, or merging organizations. If propagation of a covered
448 | work results from an entity transaction, each party to that
449 | transaction who receives a copy of the work also receives whatever
450 | licenses to the work the party's predecessor in interest had or could
451 | give under the previous paragraph, plus a right to possession of the
452 | Corresponding Source of the work from the predecessor in interest, if
453 | the predecessor has it or can get it with reasonable efforts.
454 |
455 | You may not impose any further restrictions on the exercise of the
456 | rights granted or affirmed under this License. For example, you may
457 | not impose a license fee, royalty, or other charge for exercise of
458 | rights granted under this License, and you may not initiate litigation
459 | (including a cross-claim or counterclaim in a lawsuit) alleging that
460 | any patent claim is infringed by making, using, selling, offering for
461 | sale, or importing the Program or any portion of it.
462 |
463 | 11. Patents.
464 |
465 | A "contributor" is a copyright holder who authorizes use under this
466 | License of the Program or a work on which the Program is based. The
467 | work thus licensed is called the contributor's "contributor version".
468 |
469 | A contributor's "essential patent claims" are all patent claims
470 | owned or controlled by the contributor, whether already acquired or
471 | hereafter acquired, that would be infringed by some manner, permitted
472 | by this License, of making, using, or selling its contributor version,
473 | but do not include claims that would be infringed only as a
474 | consequence of further modification of the contributor version. For
475 | purposes of this definition, "control" includes the right to grant
476 | patent sublicenses in a manner consistent with the requirements of
477 | this License.
478 |
479 | Each contributor grants you a non-exclusive, worldwide, royalty-free
480 | patent license under the contributor's essential patent claims, to
481 | make, use, sell, offer for sale, import and otherwise run, modify and
482 | propagate the contents of its contributor version.
483 |
484 | In the following three paragraphs, a "patent license" is any express
485 | agreement or commitment, however denominated, not to enforce a patent
486 | (such as an express permission to practice a patent or covenant not to
487 | sue for patent infringement). To "grant" such a patent license to a
488 | party means to make such an agreement or commitment not to enforce a
489 | patent against the party.
490 |
491 | If you convey a covered work, knowingly relying on a patent license,
492 | and the Corresponding Source of the work is not available for anyone
493 | to copy, free of charge and under the terms of this License, through a
494 | publicly available network server or other readily accessible means,
495 | then you must either (1) cause the Corresponding Source to be so
496 | available, or (2) arrange to deprive yourself of the benefit of the
497 | patent license for this particular work, or (3) arrange, in a manner
498 | consistent with the requirements of this License, to extend the patent
499 | license to downstream recipients. "Knowingly relying" means you have
500 | actual knowledge that, but for the patent license, your conveying the
501 | covered work in a country, or your recipient's use of the covered work
502 | in a country, would infringe one or more identifiable patents in that
503 | country that you have reason to believe are valid.
504 |
505 | If, pursuant to or in connection with a single transaction or
506 | arrangement, you convey, or propagate by procuring conveyance of, a
507 | covered work, and grant a patent license to some of the parties
508 | receiving the covered work authorizing them to use, propagate, modify
509 | or convey a specific copy of the covered work, then the patent license
510 | you grant is automatically extended to all recipients of the covered
511 | work and works based on it.
512 |
513 | A patent license is "discriminatory" if it does not include within
514 | the scope of its coverage, prohibits the exercise of, or is
515 | conditioned on the non-exercise of one or more of the rights that are
516 | specifically granted under this License. You may not convey a covered
517 | work if you are a party to an arrangement with a third party that is
518 | in the business of distributing software, under which you make payment
519 | to the third party based on the extent of your activity of conveying
520 | the work, and under which the third party grants, to any of the
521 | parties who would receive the covered work from you, a discriminatory
522 | patent license (a) in connection with copies of the covered work
523 | conveyed by you (or copies made from those copies), or (b) primarily
524 | for and in connection with specific products or compilations that
525 | contain the covered work, unless you entered into that arrangement,
526 | or that patent license was granted, prior to 28 March 2007.
527 |
528 | Nothing in this License shall be construed as excluding or limiting
529 | any implied license or other defenses to infringement that may
530 | otherwise be available to you under applicable patent law.
531 |
532 | 12. No Surrender of Others' Freedom.
533 |
534 | If conditions are imposed on you (whether by court order, agreement or
535 | otherwise) that contradict the conditions of this License, they do not
536 | excuse you from the conditions of this License. If you cannot convey a
537 | covered work so as to satisfy simultaneously your obligations under this
538 | License and any other pertinent obligations, then as a consequence you may
539 | not convey it at all. For example, if you agree to terms that obligate you
540 | to collect a royalty for further conveying from those to whom you convey
541 | the Program, the only way you could satisfy both those terms and this
542 | License would be to refrain entirely from conveying the Program.
543 |
544 | 13. Remote Network Interaction; Use with the GNU General Public License.
545 |
546 | Notwithstanding any other provision of this License, if you modify the
547 | Program, your modified version must prominently offer all users
548 | interacting with it remotely through a computer network (if your version
549 | supports such interaction) an opportunity to receive the Corresponding
550 | Source of your version by providing access to the Corresponding Source
551 | from a network server at no charge, through some standard or customary
552 | means of facilitating copying of software. This Corresponding Source
553 | shall include the Corresponding Source for any work covered by version 3
554 | of the GNU General Public License that is incorporated pursuant to the
555 | following paragraph.
556 |
557 | Notwithstanding any other provision of this License, you have
558 | permission to link or combine any covered work with a work licensed
559 | under version 3 of the GNU General Public License into a single
560 | combined work, and to convey the resulting work. The terms of this
561 | License will continue to apply to the part which is the covered work,
562 | but the work with which it is combined will remain governed by version
563 | 3 of the GNU General Public License.
564 |
565 | 14. Revised Versions of this License.
566 |
567 | The Free Software Foundation may publish revised and/or new versions of
568 | the GNU Affero General Public License from time to time. Such new versions
569 | will be similar in spirit to the present version, but may differ in detail to
570 | address new problems or concerns.
571 |
572 | Each version is given a distinguishing version number. If the
573 | Program specifies that a certain numbered version of the GNU Affero General
574 | Public License "or any later version" applies to it, you have the
575 | option of following the terms and conditions either of that numbered
576 | version or of any later version published by the Free Software
577 | Foundation. If the Program does not specify a version number of the
578 | GNU Affero General Public License, you may choose any version ever published
579 | by the Free Software Foundation.
580 |
581 | If the Program specifies that a proxy can decide which future
582 | versions of the GNU Affero General Public License can be used, that proxy's
583 | public statement of acceptance of a version permanently authorizes you
584 | to choose that version for the Program.
585 |
586 | Later license versions may give you additional or different
587 | permissions. However, no additional obligations are imposed on any
588 | author or copyright holder as a result of your choosing to follow a
589 | later version.
590 |
591 | 15. Disclaimer of Warranty.
592 |
593 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
594 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
595 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
596 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
597 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
598 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
599 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
600 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
601 |
602 | 16. Limitation of Liability.
603 |
604 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
605 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
606 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
607 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
608 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
609 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
610 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
611 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
612 | SUCH DAMAGES.
613 |
614 | 17. Interpretation of Sections 15 and 16.
615 |
616 | If the disclaimer of warranty and limitation of liability provided
617 | above cannot be given local legal effect according to their terms,
618 | reviewing courts shall apply local law that most closely approximates
619 | an absolute waiver of all civil liability in connection with the
620 | Program, unless a warranty or assumption of liability accompanies a
621 | copy of the Program in return for a fee.
622 |
623 | END OF TERMS AND CONDITIONS
624 |
625 | How to Apply These Terms to Your New Programs
626 |
627 | If you develop a new program, and you want it to be of the greatest
628 | possible use to the public, the best way to achieve this is to make it
629 | free software which everyone can redistribute and change under these terms.
630 |
631 | To do so, attach the following notices to the program. It is safest
632 | to attach them to the start of each source file to most effectively
633 | state the exclusion of warranty; and each file should have at least
634 | the "copyright" line and a pointer to where the full notice is found.
635 |
636 |
637 | Copyright (C)
638 |
639 | This program is free software: you can redistribute it and/or modify
640 | it under the terms of the GNU Affero General Public License as published
641 | by the Free Software Foundation, either version 3 of the License, or
642 | (at your option) any later version.
643 |
644 | This program is distributed in the hope that it will be useful,
645 | but WITHOUT ANY WARRANTY; without even the implied warranty of
646 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
647 | GNU Affero General Public License for more details.
648 |
649 | You should have received a copy of the GNU Affero General Public License
650 | along with this program. If not, see .
651 |
652 | Also add information on how to contact you by electronic and paper mail.
653 |
654 | If your software can interact with users remotely through a computer
655 | network, you should also make sure that it provides a way for users to
656 | get its source. For example, if your program is a web application, its
657 | interface could display a "Source" link that leads users to an archive
658 | of the code. There are many ways you could offer source, and different
659 | solutions will be better for different programs; see section 13 for the
660 | specific requirements.
661 |
662 | You should also get your employer (if you work as a programmer) or school,
663 | if any, to sign a "copyright disclaimer" for the program, if necessary.
664 | For more information on this, and how to apply and follow the GNU AGPL, see
665 | .
666 |
667 | ## Original template
668 |
669 | This action is based on the `actions/typescript-action` template published by
670 | GitHub. The template itself is available under the following license:
671 |
672 | The MIT License (MIT)
673 |
674 | Copyright (c) 2018 GitHub, Inc. and contributors
675 |
676 | Permission is hereby granted, free of charge, to any person obtaining a copy
677 | of this software and associated documentation files (the "Software"), to deal
678 | in the Software without restriction, including without limitation the rights
679 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
680 | copies of the Software, and to permit persons to whom the Software is
681 | furnished to do so, subject to the following conditions:
682 |
683 | The above copyright notice and this permission notice shall be included in
684 | all copies or substantial portions of the Software.
685 |
686 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
687 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
688 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
689 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
690 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
691 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
692 | THE SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Document with Slither
2 |
3 | Documenting your code can be tiresome. This action will help you write
4 | documentation for your code in pull requests using Slither and OpenAI. Just
5 | label your PR with `generate-docs` and the action will get it done!
6 |
7 | You can see an example repository integrating this action here:
8 | [crytic/slither-docs-demo](https://github.com/crytic/slither-docs-demo). An
9 | example [pull request](https://github.com/crytic/slither-docs-demo/pull/2)
10 | showing the workflow in action is also available on that repository.
11 |
12 | > **Note**
13 | >
14 | > As this action pushes the documentation to the same pull request branch, it
15 | > only works on pull requests from the same repository. If you trigger the
16 | > workflow on a pull request originating from a fork, it will display an error.
17 |
18 | ## Usage
19 |
20 | This action needs to be run on a `pull_request` event of type `labeled`. The
21 | workflow needs to have `contents: write` permissions (to push documentation
22 | commits to your PR) and `pull-requests: write` permissions (to untag and leave
23 | comments on your PR)
24 |
25 | You will also need an OpenAI API key. You can create one in the OpenAI website,
26 | by clicking on your profile picture, followed by the ["View API
27 | keys"](https://platform.openai.com/account/api-keys) link.
28 |
29 | > **Warning**
30 | >
31 | > This action will transmit code from your repository to OpenAI during normal
32 | > operation. Review OpenAI's terms of service and privacy policy to see how your
33 | > data will be processed, used, or stored.
34 |
35 | Once you have acquired your API key, store it as an Actions secret for the
36 | GitHub repository. You may follow the instructions in the [GitHub
37 | documentation](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository)
38 | to do so.
39 |
40 | > **Warning**
41 | >
42 | > The OpenAI API is a paid service. The requests that Slither performs to
43 | > OpenAI's API endpoints cost money. Make sure you trust all the contributors
44 | > with access to your repository, which may invoke this action with your API
45 | > key. Configure adequate cost limits and alerts in OpenAI to avoid unexpected
46 | > bills.
47 |
48 | ```yaml
49 | - name: Document with Slither
50 | uses: crytic/slither-docs-action@v0
51 | with:
52 | target: project
53 | openai-api-key: ${{ secrets.OPENAI_API_KEY }}
54 | ```
55 |
56 | ### Options
57 |
58 | | Key | Description
59 | |------------------|------------
60 | | `target` | The path to the root of the project to be documented by Slither. It can be a directory or a file, and it defaults to the repo root.
61 | | `openai-api-key` | The OpenAI API key.
62 | | `trigger-label` | The label used to trigger the action. `generate-docs` by default.
63 | | `slither-version`| The version of slither-analyzer to use. By default, the latest release in PyPI is used.
64 | | `solc-version` | The version of `solc` to use. **This only has an effect if you are not using a compilation framework for your project** -- i.e., if `target` is a standalone `.sol` file.
65 | | `github-token` | GitHub token, used to compute PR differences and push documentation. By default, it will use the workflow token, and there should be no need to override it.
66 |
67 | ## Examples
68 |
69 | These examples assume you have a valid OpenAI API key stored as a secret named
70 | `OPENAI_API_KEY` in your GitHub repository.
71 |
72 | ### Example: Hardhat
73 |
74 | ```yaml
75 | name: Document with Slither
76 |
77 | on:
78 | pull_request:
79 | types: [labeled]
80 | branches: [main]
81 |
82 | jobs:
83 | document:
84 | name: Document with Slither
85 | runs-on: ubuntu-latest
86 | if: contains(github.event.pull_request.labels.*.name, 'generate-docs')
87 | permissions:
88 | contents: write
89 | pull-requests: write
90 |
91 | steps:
92 | - name: Checkout code
93 | uses: actions/checkout@v3
94 |
95 | - name: Setup Node.js 16.x
96 | uses: actions/setup-node@v3
97 | with:
98 | node-version: 16
99 |
100 | - name: Install dependencies
101 | working-directory: project
102 | run: npm ci
103 |
104 | - name: Document with Slither
105 | uses: crytic/slither-docs-action@v0
106 | with:
107 | target: project
108 | openai-api-key: ${{ secrets.OPENAI_API_KEY }}
109 | ```
110 |
111 | ### Example: Foundry
112 |
113 | ```yaml
114 | name: Document with Slither
115 |
116 | on:
117 | pull_request:
118 | types: [labeled]
119 | branches: [main]
120 |
121 | jobs:
122 | document:
123 | name: Document with Slither
124 | runs-on: ubuntu-latest
125 | if: contains(github.event.pull_request.labels.*.name, 'generate-docs')
126 | permissions:
127 | contents: write
128 | pull-requests: write
129 |
130 | steps:
131 | - name: Checkout code
132 | uses: actions/checkout@v3
133 |
134 | - name: Install Foundry
135 | uses: foundry-rs/foundry-toolchain@v1
136 |
137 | - name: Document with Slither
138 | uses: crytic/slither-docs-action@v0
139 | with:
140 | target: project
141 | openai-api-key: ${{ secrets.OPENAI_API_KEY }}
142 | ```
143 |
--------------------------------------------------------------------------------
/__tests__/main.test.ts:
--------------------------------------------------------------------------------
1 | import * as process from 'process'
2 | import * as cp from 'child_process'
3 | import * as path from 'path'
4 | import {expect, test} from '@jest/globals'
5 |
6 | test('throws invalid number', async () => {
7 | const input = parseInt('foo', 10)
8 | //await expect(wait(input)).rejects.toThrow('milliseconds not a number')
9 | })
10 |
11 | test('wait 500 ms', async () => {
12 | const start = new Date()
13 | //await wait(500)
14 | const end = new Date()
15 | var delta = Math.abs(end.getTime() - start.getTime())
16 | //expect(delta).toBeGreaterThan(450)
17 | })
18 |
19 | // shows how the runner will run a javascript action with env / stdout protocol
20 | test('test runs', () => {
21 | process.env['INPUT_MILLISECONDS'] = '500'
22 | const np = process.execPath
23 | const ip = path.join(__dirname, '..', 'lib', 'main.js')
24 | const options: cp.ExecFileSyncOptions = {
25 | env: process.env
26 | }
27 | //console.log(cp.execFileSync(np, [ip], options).toString())
28 | })
29 |
--------------------------------------------------------------------------------
/action.yml:
--------------------------------------------------------------------------------
1 | name: 'Document with Slither'
2 | description: 'Generates documentation for your smart contracts using Slither and OpenAI'
3 | author: 'Trail of Bits'
4 | inputs:
5 | target:
6 | required: true
7 | description: 'Project target'
8 | default: '.'
9 | openai-api-key:
10 | required: true
11 | description: 'OpenAI API key'
12 | trigger-label:
13 | description: 'Label used to trigger the workflow. Will be removed once documentation is generated.'
14 | default: 'generate-docs'
15 | slither-version:
16 | description: 'Slither version to install. Defaults to the latest release on PyPI.'
17 | default: 'latest'
18 | solc-version:
19 | description: 'solc compiler version to install. Note that this is only used when target is a standalone Solidity code file or folder.'
20 | default: 'none'
21 | github-token:
22 | description: 'GitHub token, used to compute PR differences and push documentation.'
23 | default: ${{ github.token }}
24 | runs:
25 | using: 'node16'
26 | main: 'dist/index.js'
27 | branding:
28 | icon: 'book-open'
29 | color: 'red'
30 |
--------------------------------------------------------------------------------
/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/exec
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/github
26 | MIT
27 | The MIT License (MIT)
28 |
29 | Copyright 2019 GitHub
30 |
31 | 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:
32 |
33 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
34 |
35 | 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.
36 |
37 | @actions/http-client
38 | MIT
39 | Actions Http Client for Node.js
40 |
41 | Copyright (c) GitHub, Inc.
42 |
43 | All rights reserved.
44 |
45 | MIT License
46 |
47 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
48 | associated documentation files (the "Software"), to deal in the Software without restriction,
49 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
50 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
51 | subject to the following conditions:
52 |
53 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
54 |
55 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
56 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
57 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
58 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
59 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
60 |
61 |
62 | @actions/io
63 | MIT
64 | The MIT License (MIT)
65 |
66 | Copyright 2019 GitHub
67 |
68 | 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:
69 |
70 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
71 |
72 | 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.
73 |
74 | @octokit/auth-token
75 | MIT
76 | The MIT License
77 |
78 | Copyright (c) 2019 Octokit contributors
79 |
80 | Permission is hereby granted, free of charge, to any person obtaining a copy
81 | of this software and associated documentation files (the "Software"), to deal
82 | in the Software without restriction, including without limitation the rights
83 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
84 | copies of the Software, and to permit persons to whom the Software is
85 | furnished to do so, subject to the following conditions:
86 |
87 | The above copyright notice and this permission notice shall be included in
88 | all copies or substantial portions of the Software.
89 |
90 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
91 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
92 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
93 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
94 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
95 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
96 | THE SOFTWARE.
97 |
98 |
99 | @octokit/core
100 | MIT
101 | The MIT License
102 |
103 | Copyright (c) 2019 Octokit contributors
104 |
105 | Permission is hereby granted, free of charge, to any person obtaining a copy
106 | of this software and associated documentation files (the "Software"), to deal
107 | in the Software without restriction, including without limitation the rights
108 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
109 | copies of the Software, and to permit persons to whom the Software is
110 | furnished to do so, subject to the following conditions:
111 |
112 | The above copyright notice and this permission notice shall be included in
113 | all copies or substantial portions of the Software.
114 |
115 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
116 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
117 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
118 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
119 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
120 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
121 | THE SOFTWARE.
122 |
123 |
124 | @octokit/endpoint
125 | MIT
126 | The MIT License
127 |
128 | Copyright (c) 2018 Octokit contributors
129 |
130 | Permission is hereby granted, free of charge, to any person obtaining a copy
131 | of this software and associated documentation files (the "Software"), to deal
132 | in the Software without restriction, including without limitation the rights
133 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
134 | copies of the Software, and to permit persons to whom the Software is
135 | furnished to do so, subject to the following conditions:
136 |
137 | The above copyright notice and this permission notice shall be included in
138 | all copies or substantial portions of the Software.
139 |
140 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
141 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
142 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
143 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
144 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
145 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
146 | THE SOFTWARE.
147 |
148 |
149 | @octokit/graphql
150 | MIT
151 | The MIT License
152 |
153 | Copyright (c) 2018 Octokit contributors
154 |
155 | Permission is hereby granted, free of charge, to any person obtaining a copy
156 | of this software and associated documentation files (the "Software"), to deal
157 | in the Software without restriction, including without limitation the rights
158 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
159 | copies of the Software, and to permit persons to whom the Software is
160 | furnished to do so, subject to the following conditions:
161 |
162 | The above copyright notice and this permission notice shall be included in
163 | all copies or substantial portions of the Software.
164 |
165 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
166 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
167 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
168 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
169 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
170 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
171 | THE SOFTWARE.
172 |
173 |
174 | @octokit/plugin-paginate-rest
175 | MIT
176 | MIT License Copyright (c) 2019 Octokit contributors
177 |
178 | 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:
179 |
180 | The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
181 |
182 | 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.
183 |
184 |
185 | @octokit/plugin-rest-endpoint-methods
186 | MIT
187 | MIT License Copyright (c) 2019 Octokit contributors
188 |
189 | 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:
190 |
191 | The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
192 |
193 | 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.
194 |
195 |
196 | @octokit/request
197 | MIT
198 | The MIT License
199 |
200 | Copyright (c) 2018 Octokit contributors
201 |
202 | Permission is hereby granted, free of charge, to any person obtaining a copy
203 | of this software and associated documentation files (the "Software"), to deal
204 | in the Software without restriction, including without limitation the rights
205 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
206 | copies of the Software, and to permit persons to whom the Software is
207 | furnished to do so, subject to the following conditions:
208 |
209 | The above copyright notice and this permission notice shall be included in
210 | all copies or substantial portions of the Software.
211 |
212 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
213 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
214 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
215 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
216 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
217 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
218 | THE SOFTWARE.
219 |
220 |
221 | @octokit/request-error
222 | MIT
223 | The MIT License
224 |
225 | Copyright (c) 2019 Octokit contributors
226 |
227 | Permission is hereby granted, free of charge, to any person obtaining a copy
228 | of this software and associated documentation files (the "Software"), to deal
229 | in the Software without restriction, including without limitation the rights
230 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
231 | copies of the Software, and to permit persons to whom the Software is
232 | furnished to do so, subject to the following conditions:
233 |
234 | The above copyright notice and this permission notice shall be included in
235 | all copies or substantial portions of the Software.
236 |
237 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
238 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
239 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
240 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
241 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
242 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
243 | THE SOFTWARE.
244 |
245 |
246 | @vercel/ncc
247 | MIT
248 | Copyright 2018 ZEIT, Inc.
249 |
250 | 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:
251 |
252 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
253 |
254 | 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.
255 |
256 | before-after-hook
257 | Apache-2.0
258 | Apache License
259 | Version 2.0, January 2004
260 | http://www.apache.org/licenses/
261 |
262 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
263 |
264 | 1. Definitions.
265 |
266 | "License" shall mean the terms and conditions for use, reproduction,
267 | and distribution as defined by Sections 1 through 9 of this document.
268 |
269 | "Licensor" shall mean the copyright owner or entity authorized by
270 | the copyright owner that is granting the License.
271 |
272 | "Legal Entity" shall mean the union of the acting entity and all
273 | other entities that control, are controlled by, or are under common
274 | control with that entity. For the purposes of this definition,
275 | "control" means (i) the power, direct or indirect, to cause the
276 | direction or management of such entity, whether by contract or
277 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
278 | outstanding shares, or (iii) beneficial ownership of such entity.
279 |
280 | "You" (or "Your") shall mean an individual or Legal Entity
281 | exercising permissions granted by this License.
282 |
283 | "Source" form shall mean the preferred form for making modifications,
284 | including but not limited to software source code, documentation
285 | source, and configuration files.
286 |
287 | "Object" form shall mean any form resulting from mechanical
288 | transformation or translation of a Source form, including but
289 | not limited to compiled object code, generated documentation,
290 | and conversions to other media types.
291 |
292 | "Work" shall mean the work of authorship, whether in Source or
293 | Object form, made available under the License, as indicated by a
294 | copyright notice that is included in or attached to the work
295 | (an example is provided in the Appendix below).
296 |
297 | "Derivative Works" shall mean any work, whether in Source or Object
298 | form, that is based on (or derived from) the Work and for which the
299 | editorial revisions, annotations, elaborations, or other modifications
300 | represent, as a whole, an original work of authorship. For the purposes
301 | of this License, Derivative Works shall not include works that remain
302 | separable from, or merely link (or bind by name) to the interfaces of,
303 | the Work and Derivative Works thereof.
304 |
305 | "Contribution" shall mean any work of authorship, including
306 | the original version of the Work and any modifications or additions
307 | to that Work or Derivative Works thereof, that is intentionally
308 | submitted to Licensor for inclusion in the Work by the copyright owner
309 | or by an individual or Legal Entity authorized to submit on behalf of
310 | the copyright owner. For the purposes of this definition, "submitted"
311 | means any form of electronic, verbal, or written communication sent
312 | to the Licensor or its representatives, including but not limited to
313 | communication on electronic mailing lists, source code control systems,
314 | and issue tracking systems that are managed by, or on behalf of, the
315 | Licensor for the purpose of discussing and improving the Work, but
316 | excluding communication that is conspicuously marked or otherwise
317 | designated in writing by the copyright owner as "Not a Contribution."
318 |
319 | "Contributor" shall mean Licensor and any individual or Legal Entity
320 | on behalf of whom a Contribution has been received by Licensor and
321 | subsequently incorporated within the Work.
322 |
323 | 2. Grant of Copyright License. Subject to the terms and conditions of
324 | this License, each Contributor hereby grants to You a perpetual,
325 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
326 | copyright license to reproduce, prepare Derivative Works of,
327 | publicly display, publicly perform, sublicense, and distribute the
328 | Work and such Derivative Works in Source or Object form.
329 |
330 | 3. Grant of Patent License. Subject to the terms and conditions of
331 | this License, each Contributor hereby grants to You a perpetual,
332 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
333 | (except as stated in this section) patent license to make, have made,
334 | use, offer to sell, sell, import, and otherwise transfer the Work,
335 | where such license applies only to those patent claims licensable
336 | by such Contributor that are necessarily infringed by their
337 | Contribution(s) alone or by combination of their Contribution(s)
338 | with the Work to which such Contribution(s) was submitted. If You
339 | institute patent litigation against any entity (including a
340 | cross-claim or counterclaim in a lawsuit) alleging that the Work
341 | or a Contribution incorporated within the Work constitutes direct
342 | or contributory patent infringement, then any patent licenses
343 | granted to You under this License for that Work shall terminate
344 | as of the date such litigation is filed.
345 |
346 | 4. Redistribution. You may reproduce and distribute copies of the
347 | Work or Derivative Works thereof in any medium, with or without
348 | modifications, and in Source or Object form, provided that You
349 | meet the following conditions:
350 |
351 | (a) You must give any other recipients of the Work or
352 | Derivative Works a copy of this License; and
353 |
354 | (b) You must cause any modified files to carry prominent notices
355 | stating that You changed the files; and
356 |
357 | (c) You must retain, in the Source form of any Derivative Works
358 | that You distribute, all copyright, patent, trademark, and
359 | attribution notices from the Source form of the Work,
360 | excluding those notices that do not pertain to any part of
361 | the Derivative Works; and
362 |
363 | (d) If the Work includes a "NOTICE" text file as part of its
364 | distribution, then any Derivative Works that You distribute must
365 | include a readable copy of the attribution notices contained
366 | within such NOTICE file, excluding those notices that do not
367 | pertain to any part of the Derivative Works, in at least one
368 | of the following places: within a NOTICE text file distributed
369 | as part of the Derivative Works; within the Source form or
370 | documentation, if provided along with the Derivative Works; or,
371 | within a display generated by the Derivative Works, if and
372 | wherever such third-party notices normally appear. The contents
373 | of the NOTICE file are for informational purposes only and
374 | do not modify the License. You may add Your own attribution
375 | notices within Derivative Works that You distribute, alongside
376 | or as an addendum to the NOTICE text from the Work, provided
377 | that such additional attribution notices cannot be construed
378 | as modifying the License.
379 |
380 | You may add Your own copyright statement to Your modifications and
381 | may provide additional or different license terms and conditions
382 | for use, reproduction, or distribution of Your modifications, or
383 | for any such Derivative Works as a whole, provided Your use,
384 | reproduction, and distribution of the Work otherwise complies with
385 | the conditions stated in this License.
386 |
387 | 5. Submission of Contributions. Unless You explicitly state otherwise,
388 | any Contribution intentionally submitted for inclusion in the Work
389 | by You to the Licensor shall be under the terms and conditions of
390 | this License, without any additional terms or conditions.
391 | Notwithstanding the above, nothing herein shall supersede or modify
392 | the terms of any separate license agreement you may have executed
393 | with Licensor regarding such Contributions.
394 |
395 | 6. Trademarks. This License does not grant permission to use the trade
396 | names, trademarks, service marks, or product names of the Licensor,
397 | except as required for reasonable and customary use in describing the
398 | origin of the Work and reproducing the content of the NOTICE file.
399 |
400 | 7. Disclaimer of Warranty. Unless required by applicable law or
401 | agreed to in writing, Licensor provides the Work (and each
402 | Contributor provides its Contributions) on an "AS IS" BASIS,
403 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
404 | implied, including, without limitation, any warranties or conditions
405 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
406 | PARTICULAR PURPOSE. You are solely responsible for determining the
407 | appropriateness of using or redistributing the Work and assume any
408 | risks associated with Your exercise of permissions under this License.
409 |
410 | 8. Limitation of Liability. In no event and under no legal theory,
411 | whether in tort (including negligence), contract, or otherwise,
412 | unless required by applicable law (such as deliberate and grossly
413 | negligent acts) or agreed to in writing, shall any Contributor be
414 | liable to You for damages, including any direct, indirect, special,
415 | incidental, or consequential damages of any character arising as a
416 | result of this License or out of the use or inability to use the
417 | Work (including but not limited to damages for loss of goodwill,
418 | work stoppage, computer failure or malfunction, or any and all
419 | other commercial damages or losses), even if such Contributor
420 | has been advised of the possibility of such damages.
421 |
422 | 9. Accepting Warranty or Additional Liability. While redistributing
423 | the Work or Derivative Works thereof, You may choose to offer,
424 | and charge a fee for, acceptance of support, warranty, indemnity,
425 | or other liability obligations and/or rights consistent with this
426 | License. However, in accepting such obligations, You may act only
427 | on Your own behalf and on Your sole responsibility, not on behalf
428 | of any other Contributor, and only if You agree to indemnify,
429 | defend, and hold each Contributor harmless for any liability
430 | incurred by, or claims asserted against, such Contributor by reason
431 | of your accepting any such warranty or additional liability.
432 |
433 | END OF TERMS AND CONDITIONS
434 |
435 | APPENDIX: How to apply the Apache License to your work.
436 |
437 | To apply the Apache License to your work, attach the following
438 | boilerplate notice, with the fields enclosed by brackets "{}"
439 | replaced with your own identifying information. (Don't include
440 | the brackets!) The text should be enclosed in the appropriate
441 | comment syntax for the file format. We also recommend that a
442 | file or class name and description of purpose be included on the
443 | same "printed page" as the copyright notice for easier
444 | identification within third-party archives.
445 |
446 | Copyright 2018 Gregor Martynus and other contributors.
447 |
448 | Licensed under the Apache License, Version 2.0 (the "License");
449 | you may not use this file except in compliance with the License.
450 | You may obtain a copy of the License at
451 |
452 | http://www.apache.org/licenses/LICENSE-2.0
453 |
454 | Unless required by applicable law or agreed to in writing, software
455 | distributed under the License is distributed on an "AS IS" BASIS,
456 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
457 | See the License for the specific language governing permissions and
458 | limitations under the License.
459 |
460 |
461 | deprecation
462 | ISC
463 | The ISC License
464 |
465 | Copyright (c) Gregor Martynus and contributors
466 |
467 | Permission to use, copy, modify, and/or distribute this software for any
468 | purpose with or without fee is hereby granted, provided that the above
469 | copyright notice and this permission notice appear in all copies.
470 |
471 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
472 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
473 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
474 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
475 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
476 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
477 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
478 |
479 |
480 | is-plain-object
481 | MIT
482 | The MIT License (MIT)
483 |
484 | Copyright (c) 2014-2017, Jon Schlinkert.
485 |
486 | Permission is hereby granted, free of charge, to any person obtaining a copy
487 | of this software and associated documentation files (the "Software"), to deal
488 | in the Software without restriction, including without limitation the rights
489 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
490 | copies of the Software, and to permit persons to whom the Software is
491 | furnished to do so, subject to the following conditions:
492 |
493 | The above copyright notice and this permission notice shall be included in
494 | all copies or substantial portions of the Software.
495 |
496 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
497 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
498 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
499 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
500 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
501 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
502 | THE SOFTWARE.
503 |
504 |
505 | node-fetch
506 | MIT
507 | The MIT License (MIT)
508 |
509 | Copyright (c) 2016 David Frank
510 |
511 | Permission is hereby granted, free of charge, to any person obtaining a copy
512 | of this software and associated documentation files (the "Software"), to deal
513 | in the Software without restriction, including without limitation the rights
514 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
515 | copies of the Software, and to permit persons to whom the Software is
516 | furnished to do so, subject to the following conditions:
517 |
518 | The above copyright notice and this permission notice shall be included in all
519 | copies or substantial portions of the Software.
520 |
521 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
522 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
523 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
524 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
525 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
526 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
527 | SOFTWARE.
528 |
529 |
530 |
531 | once
532 | ISC
533 | The ISC License
534 |
535 | Copyright (c) Isaac Z. Schlueter and Contributors
536 |
537 | Permission to use, copy, modify, and/or distribute this software for any
538 | purpose with or without fee is hereby granted, provided that the above
539 | copyright notice and this permission notice appear in all copies.
540 |
541 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
542 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
543 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
544 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
545 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
546 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
547 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
548 |
549 |
550 | tr46
551 | MIT
552 |
553 | tunnel
554 | MIT
555 | The MIT License (MIT)
556 |
557 | Copyright (c) 2012 Koichi Kobayashi
558 |
559 | Permission is hereby granted, free of charge, to any person obtaining a copy
560 | of this software and associated documentation files (the "Software"), to deal
561 | in the Software without restriction, including without limitation the rights
562 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
563 | copies of the Software, and to permit persons to whom the Software is
564 | furnished to do so, subject to the following conditions:
565 |
566 | The above copyright notice and this permission notice shall be included in
567 | all copies or substantial portions of the Software.
568 |
569 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
570 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
571 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
572 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
573 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
574 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
575 | THE SOFTWARE.
576 |
577 |
578 | universal-user-agent
579 | ISC
580 | # [ISC License](https://spdx.org/licenses/ISC)
581 |
582 | Copyright (c) 2018, Gregor Martynus (https://github.com/gr2m)
583 |
584 | 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.
585 |
586 | 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.
587 |
588 |
589 | uuid
590 | MIT
591 | The MIT License (MIT)
592 |
593 | Copyright (c) 2010-2020 Robert Kieffer and other contributors
594 |
595 | 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:
596 |
597 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
598 |
599 | 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.
600 |
601 |
602 | webidl-conversions
603 | BSD-2-Clause
604 | # The BSD 2-Clause License
605 |
606 | Copyright (c) 2014, Domenic Denicola
607 | All rights reserved.
608 |
609 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
610 |
611 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
612 |
613 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
614 |
615 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
616 |
617 |
618 | whatwg-url
619 | MIT
620 | The MIT License (MIT)
621 |
622 | Copyright (c) 2015–2016 Sebastian Mayr
623 |
624 | Permission is hereby granted, free of charge, to any person obtaining a copy
625 | of this software and associated documentation files (the "Software"), to deal
626 | in the Software without restriction, including without limitation the rights
627 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
628 | copies of the Software, and to permit persons to whom the Software is
629 | furnished to do so, subject to the following conditions:
630 |
631 | The above copyright notice and this permission notice shall be included in
632 | all copies or substantial portions of the Software.
633 |
634 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
635 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
636 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
637 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
638 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
639 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
640 | THE SOFTWARE.
641 |
642 |
643 | wrappy
644 | ISC
645 | The ISC License
646 |
647 | Copyright (c) Isaac Z. Schlueter and Contributors
648 |
649 | Permission to use, copy, modify, and/or distribute this software for any
650 | purpose with or without fee is hereby granted, provided that the above
651 | copyright notice and this permission notice appear in all copies.
652 |
653 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
654 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
655 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
656 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
657 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
658 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
659 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
660 |
--------------------------------------------------------------------------------
/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 | testMatch: ['**/*.test.ts'],
5 | transform: {
6 | '^.+\\.ts$': 'ts-jest'
7 | },
8 | verbose: true
9 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "typescript-action",
3 | "version": "0.0.0",
4 | "private": true,
5 | "description": "TypeScript template action",
6 | "main": "lib/main.js",
7 | "scripts": {
8 | "build": "tsc",
9 | "format": "prettier --write '**/*.ts'",
10 | "format-check": "prettier --check '**/*.ts'",
11 | "lint": "eslint src/**/*.ts",
12 | "package": "ncc build --source-map --license licenses.txt",
13 | "test": "jest",
14 | "all": "npm run build && npm run format && npm run lint && npm run package && npm test"
15 | },
16 | "repository": {
17 | "type": "git",
18 | "url": "git+https://github.com/actions/typescript-action.git"
19 | },
20 | "keywords": [
21 | "actions",
22 | "node",
23 | "setup"
24 | ],
25 | "author": "",
26 | "license": "MIT",
27 | "dependencies": {
28 | "@actions/core": "^1.10.0",
29 | "@actions/exec": "^1.1.1",
30 | "@actions/github": "^5.1.1",
31 | "@actions/io": "^1.1.3",
32 | "uuid": "^9.0.0"
33 | },
34 | "devDependencies": {
35 | "@types/node": "^18.16.3",
36 | "@types/uuid": "^9.0.2",
37 | "@typescript-eslint/parser": "^5.62.0",
38 | "@vercel/ncc": "^0.36.1",
39 | "eslint": "^8.43.0",
40 | "eslint-plugin-github": "^4.8.0",
41 | "eslint-plugin-jest": "^27.2.3",
42 | "jest": "^29.5.0",
43 | "js-yaml": "^4.1.0",
44 | "prettier": "2.8.8",
45 | "ts-jest": "^29.1.0",
46 | "typescript": "^5.1.6"
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/git.ts:
--------------------------------------------------------------------------------
1 | import * as core from '@actions/core'
2 | import * as exec from '@actions/exec'
3 |
4 | const BOT_USERNAME = 'github-actions[bot]'
5 | const BOT_EMAIL = 'github-actions[bot]@users.noreply.github.com'
6 |
7 | export async function gitCheckoutRef(
8 | ref: string,
9 | recursive: boolean
10 | ): Promise {
11 | core.startGroup('Checkout PR branch')
12 | await exec.exec('git', ['fetch', 'origin', ref])
13 | await exec.exec('git', ['checkout', '-b', ref, '--track', `origin/${ref}`])
14 | if (recursive) {
15 | await exec.exec('git', ['submodule', 'update', '--init', '--recursive'])
16 | }
17 | core.endGroup()
18 | }
19 |
20 | export async function commitAndPush(files: string[]): Promise {
21 | core.startGroup('Commit changes and pull to PR')
22 | await exec.exec('git', ['config', 'user.email', BOT_EMAIL])
23 | await exec.exec('git', ['config', 'user.name', BOT_USERNAME])
24 | await exec.exec('git', ['add', '--all', '--', ...files])
25 | const changesForCommit = await exec.exec(
26 | 'git',
27 | ['diff', '--quiet', '--exit-code', '--staged'],
28 | {ignoreReturnCode: true}
29 | )
30 | if (changesForCommit !== 0) {
31 | await exec.exec('git', [
32 | 'commit',
33 | '-m',
34 | 'docs: add documentation generated with slither-documentation'
35 | ])
36 | await exec.exec('git', ['push'])
37 | }
38 | core.endGroup()
39 |
40 | return changesForCommit !== 0
41 | }
42 |
--------------------------------------------------------------------------------
/src/main.ts:
--------------------------------------------------------------------------------
1 | import * as core from '@actions/core'
2 | import * as git from './git'
3 | import * as github from '@actions/github'
4 | import * as slither from './slither'
5 |
6 | type Octokit = ReturnType
7 |
8 | function isContextValid(): boolean {
9 | return (
10 | github.context.eventName === 'pull_request' &&
11 | github.context.payload.action === 'labeled' &&
12 | github.context.payload.label.name === core.getInput('trigger-label')
13 | )
14 | }
15 |
16 | async function getChangedFiles(octokit: Octokit): Promise {
17 | const context = github.context
18 |
19 | const listFilesOptions = octokit.rest.pulls.listFiles.endpoint.merge({
20 | owner: context.repo.owner,
21 | repo: context.repo.repo,
22 | pull_number: context.issue.number
23 | })
24 | const listFilesResponse = await octokit.paginate<{filename: string}>(
25 | listFilesOptions
26 | )
27 | const changedFiles = listFilesResponse.map(f => f.filename)
28 | core.debug(`Changed files: ${changedFiles}`)
29 | return changedFiles
30 | }
31 |
32 | async function getPullRequestBranch(octokit: Octokit): Promise {
33 | const context = github.context
34 |
35 | const pullRequest = await octokit.rest.pulls.get({
36 | owner: context.repo.owner,
37 | repo: context.repo.repo,
38 | pull_number: context.issue.number
39 | })
40 |
41 | if (
42 | `${context.repo.owner}/${context.repo.repo}` !==
43 | pullRequest.data.head.repo?.full_name
44 | ) {
45 | return null
46 | }
47 | return pullRequest.data.head.ref
48 | }
49 |
50 | async function removeLabel(octokit: Octokit, label: string): Promise {
51 | const context = github.context
52 |
53 | await octokit.rest.issues.removeLabel({
54 | owner: context.repo.owner,
55 | repo: context.repo.repo,
56 | issue_number: context.issue.number,
57 | name: label
58 | })
59 | }
60 |
61 | async function alertStatus(octokit: Octokit, message: string): Promise {
62 | const context = github.context
63 |
64 | await octokit.rest.issues.createComment({
65 | issue_number: context.issue.number,
66 | owner: context.repo.owner,
67 | repo: context.repo.repo,
68 | body: message
69 | })
70 | }
71 |
72 | async function document(): Promise {
73 | const github_token = core.getInput('github-token')
74 | const openai_token = core.getInput('openai-api-key')
75 | const target = core.getInput('target')
76 | const solcVersion = core.getInput('solc-version')
77 | const slitherVersion = core.getInput('slither-version')
78 | const label = core.getInput('trigger-label')
79 | const octokit = github.getOctokit(github_token)
80 |
81 | const changed_files = await getChangedFiles(octokit)
82 | const changed_sol = changed_files.filter(f => f.endsWith('.sol'))
83 |
84 | if (changed_sol.length === 0) {
85 | core.debug('No code changed')
86 | return
87 | }
88 |
89 | const branch = await getPullRequestBranch(octokit)
90 | if (branch === null) {
91 | core.info('PR is not from this repo, cannot proceed')
92 | return
93 | }
94 |
95 | await slither.install(slitherVersion, solcVersion)
96 | await git.gitCheckoutRef(branch, true)
97 | await slither.runSlitherDocumentation(target, openai_token)
98 | const pushedChanges = await git.commitAndPush(changed_sol)
99 | await removeLabel(octokit, label)
100 |
101 | const message = pushedChanges
102 | ? 'Documentation was generated and pushed to the repository 🚀'
103 | : 'slither-documentation did not generate any changes 🤷'
104 | await alertStatus(octokit, message)
105 | }
106 |
107 | async function run(): Promise {
108 | try {
109 | if (isContextValid()) {
110 | await document()
111 | } else {
112 | core.setFailed(
113 | 'The action was ran on an event different than pull_request. This is unsupported,'
114 | )
115 | }
116 | } catch (error) {
117 | if (error instanceof Error) {
118 | const octokit = github.getOctokit(core.getInput('github-token'))
119 | await alertStatus(
120 | octokit,
121 | `An error occured 😔 ${error.message}\n\n` +
122 | 'Please review the GitHub Actions workflow execution for more details.'
123 | )
124 | core.setFailed(error.message)
125 | }
126 | }
127 | }
128 |
129 | run()
130 |
--------------------------------------------------------------------------------
/src/slither.ts:
--------------------------------------------------------------------------------
1 | import * as core from '@actions/core'
2 | import * as exec from '@actions/exec'
3 | import * as path from 'path'
4 |
5 | import {createTempDir} from './utils'
6 |
7 | export async function install(slither: string, solc: string): Promise {
8 | core.startGroup('Install Slither')
9 | const venv = await createTempDir()
10 | const exitCodeVenv = await exec.exec('python3', ['-m', 'venv', venv])
11 | if (exitCodeVenv !== 0) {
12 | throw new Error('Problem creating Python venv')
13 | }
14 |
15 | let slitherPackage = 'slither-analyzer'
16 | if (slither === 'latest') {
17 | // nothing
18 | } else if (/^\d+\.\d+\.\d+$/.test(slither)) {
19 | slitherPackage += `==${slither}`
20 | } else {
21 | slitherPackage += ` @ https://github.com/crytic/slither/archive/${slither}.tar.gz`
22 | }
23 |
24 | core.addPath(path.join(venv, 'bin'))
25 | const exitCodePip = await exec.exec('pip3', [
26 | 'install',
27 | '--quiet',
28 | slitherPackage,
29 | 'openai',
30 | 'solc-select'
31 | ])
32 | if (exitCodePip !== 0) {
33 | throw new Error('Problem installing Slither into venv')
34 | }
35 |
36 | if (solc !== '' && solc !== 'none') {
37 | const exitSolcSelect = await exec.exec('solc-select', [
38 | 'use',
39 | solc,
40 | '--always-install'
41 | ])
42 | if (exitSolcSelect !== 0) {
43 | throw new Error('Problem installing Slither into venv')
44 | }
45 | }
46 | core.endGroup()
47 | }
48 |
49 | export async function runSlitherDocumentation(
50 | target: string,
51 | openaiToken: string
52 | ): Promise {
53 | core.startGroup('Run slither-documentation')
54 | const options = {
55 | env: {...process.env, OPENAI_API_KEY: openaiToken}
56 | } as exec.ExecOptions
57 | const extraArgs = core.isDebug() ? ['--codex-log'] : []
58 | const output = await exec.getExecOutput(
59 | 'slither-documentation',
60 | [target, '--overwrite', '--force-answer-parsing', ...extraArgs],
61 | options
62 | )
63 |
64 | if (output.exitCode !== 0) {
65 | throw new Error('Problem executing slither-documentation')
66 | }
67 | core.endGroup()
68 |
69 | if (core.isDebug()) {
70 | core.startGroup('Show codex log')
71 | const logPath = path.join('crytic_export', 'codex')
72 | const displayed = await exec.exec('grep', ['-Hr', '.', logPath], {
73 | ignoreReturnCode: true
74 | })
75 | if (displayed !== 0) {
76 | core.warning('Log not found')
77 | }
78 | core.endGroup()
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/src/utils.ts:
--------------------------------------------------------------------------------
1 | import * as io from '@actions/io'
2 | import * as path from 'path'
3 | import {ok} from 'assert'
4 | import {v4 as uuidv4} from 'uuid'
5 |
6 | function getRunnerTempDir(): string {
7 | const tempDirectory = process.env['RUNNER_TEMP'] || ''
8 | ok(tempDirectory, 'Expected RUNNER_TEMP to be defined')
9 | return tempDirectory
10 | }
11 |
12 | export async function createTempDir(): Promise {
13 | const dest = path.join(getRunnerTempDir(), uuidv4())
14 | await io.mkdirP(dest)
15 | return dest
16 | }
17 |
--------------------------------------------------------------------------------
/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 | "exclude": ["node_modules", "**/*.test.ts"]
12 | }
13 |
--------------------------------------------------------------------------------