├── .github ├── dependabot.yml └── workflows │ ├── build.yml │ └── test.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── action.yml ├── dist └── index.js ├── package-lock.json ├── package.json ├── src ├── main.ts └── wait.ts └── tsconfig.json /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | # Maintain dependencies for GitHub Actions 4 | - package-ecosystem: 'github-actions' 5 | directory: '/' 6 | schedule: 7 | interval: 'daily' 8 | 9 | # Maintain dependencies for npm 10 | - package-ecosystem: 'npm' 11 | directory: '/' 12 | schedule: 13 | interval: 'daily' 14 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: 'Build' 2 | on: 3 | pull_request: 4 | push: 5 | paths-ignore: 6 | - '**.md' 7 | - '**.org' 8 | branches: 9 | - master 10 | workflow_dispatch: 11 | 12 | jobs: 13 | dist: 14 | runs-on: [ubuntu-latest] 15 | 16 | steps: 17 | - uses: actions/checkout@v4 18 | 19 | - run: npm install 20 | - run: npm run-script build 21 | 22 | - name: Set git config 23 | run: | 24 | git config user.name github-actions 25 | git config user.email github-actions@github.com 26 | 27 | - name: Push dist 28 | continue-on-error: true 29 | run: | 30 | git pull 31 | git add . 32 | git commit -m "Update dist" 33 | git push 34 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: 'CI' 2 | on: 3 | pull_request: 4 | push: 5 | paths-ignore: 6 | - '**.md' 7 | - '**.org' 8 | branches: 9 | - master 10 | workflow_dispatch: 11 | 12 | jobs: 13 | build: 14 | runs-on: ${{ matrix.os }} 15 | strategy: 16 | fail-fast: false 17 | matrix: 18 | os: [windows-latest, ubuntu-latest, macos-latest] 19 | eask_version: [0.9.5, snapshot] 20 | 21 | steps: 22 | - uses: actions/checkout@v4 23 | 24 | - uses: ./ 25 | with: 26 | version: ${{ matrix.eask_version }} 27 | 28 | - name: Check Eask version 29 | run: eask --version 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Dependency directory 2 | node_modules 3 | 4 | /lib/ 5 | 6 | # Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore 7 | # Logs 8 | logs 9 | *.log 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | lerna-debug.log* 14 | 15 | # Diagnostic reports (https://nodejs.org/api/report.html) 16 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 17 | 18 | # Runtime data 19 | pids 20 | *.pid 21 | *.seed 22 | *.pid.lock 23 | 24 | # Directory for instrumented libs generated by jscoverage/JSCover 25 | lib-cov 26 | 27 | # Coverage directory used by tools like istanbul 28 | coverage 29 | *.lcov 30 | 31 | # nyc test coverage 32 | .nyc_output 33 | 34 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 35 | .grunt 36 | 37 | # Bower dependency directory (https://bower.io/) 38 | bower_components 39 | 40 | # node-waf configuration 41 | .lock-wscript 42 | 43 | # Compiled binary addons (https://nodejs.org/api/addons.html) 44 | build/Release 45 | 46 | # Dependency directories 47 | jspm_packages/ 48 | 49 | # TypeScript v1 declaration files 50 | typings/ 51 | 52 | # TypeScript cache 53 | *.tsbuildinfo 54 | 55 | # Optional npm cache directory 56 | .npm 57 | 58 | # Optional eslint cache 59 | .eslintcache 60 | 61 | # Optional REPL history 62 | .node_repl_history 63 | 64 | # Output of 'npm pack' 65 | *.tgz 66 | 67 | # Yarn Integrity file 68 | .yarn-integrity 69 | 70 | # dotenv environment variables file 71 | .env 72 | .env.test 73 | 74 | # parcel-bundler cache (https://parceljs.org/) 75 | .cache 76 | 77 | # next.js build output 78 | .next 79 | 80 | # nuxt.js build output 81 | .nuxt 82 | 83 | # vuepress build output 84 | .vuepress/dist 85 | 86 | # Serverless directories 87 | .serverless/ 88 | 89 | # FuseBox cache 90 | .fusebox/ 91 | 92 | # DynamoDB Local files 93 | .dynamodb/ 94 | 95 | # OS metadata 96 | .DS_Store 97 | Thumbs.db 98 | 99 | # Ignore built ts files 100 | __tests__/runner/* 101 | lib/**/* -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. 6 | 7 | ## v3 (Unreleased) 8 | > Released N/A 9 | 10 | * Use binaries instead of npm (#86) 11 | * Stable with fallback version (#87) 12 | * fix: Use `.tar.gz` file (19a5cee88bed0c7705096da8eb42a45637faa010) 13 | 14 | ## v2 15 | > Released Mar 17, 2022 16 | 17 | * Print version information at the end of the actions 18 | 19 | ## v1 20 | > Released Mar 13, 2022 21 | 22 | * Initial release 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2022-2025 Shen, Jen-Chieh 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) 2 | [![Release](https://img.shields.io/github/release/emacs-eask/setup-eask.svg?logo=github)](https://github.com/emacs-eask/setup-eask/releases/latest) 3 | 4 | 5 | # setup-eask 6 | > Install Eask for Github Actions workflow 7 | 8 | [![CI](https://github.com/emacs-eask/setup-eask/actions/workflows/test.yml/badge.svg)](https://github.com/emacs-eask/setup-eask/actions/workflows/test.yml) 9 | [![Build](https://github.com/emacs-eask/setup-eask/actions/workflows/build.yml/badge.svg)](https://github.com/emacs-eask/setup-eask/actions/workflows/build.yml) 10 | 11 | ## 🔨 Usage 12 | 13 | ```yml 14 | jobs: 15 | build: 16 | runs-on: ubuntu-latest 17 | steps: 18 | ... 19 | 20 | # Install Emacs 21 | - uses: jcs090218/setup-emacs@master 22 | with: 23 | version: '27.2' 24 | 25 | # Install Eask 26 | - uses: emacs-eask/setup-eask@master 27 | with: 28 | version: 'snapshot' 29 | 30 | ... 31 | ``` 32 | 33 | This example is testing your package in below environment. 34 | 35 | * Emacs: `27.2` 36 | * Eask: `snapshot` (latest) 37 | 38 | ### 📇 Inputs 39 | 40 | | Name | Value | Default | Description | 41 | |:-------------|:-------|:-----------|:--------------------------------------------------------------------------------------------------| 42 | | version | string | `snapshot` | The version of [Eask][] to install, e.g. "0.0.8", or "snapshot" for a recent development version. | 43 | | architecture | string | `x64` | The target architecture (x64, arm64) of the [Eask][] CLI. | 44 | 45 | ## ⚜️ License 46 | 47 | Permission is hereby granted, free of charge, to any person obtaining a copy 48 | of this software and associated documentation files (the "Software"), to deal 49 | in the Software without restriction, including without limitation the rights 50 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 51 | copies of the Software, and to permit persons to whom the Software is 52 | furnished to do so, subject to the following conditions: 53 | 54 | The above copyright notice and this permission notice shall be included in all 55 | copies or substantial portions of the Software. 56 | 57 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 58 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 59 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 60 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 61 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 62 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 63 | SOFTWARE. 64 | 65 | See [`LICENSE`](./LICENSE) for details. 66 | 67 | 68 | 69 | 70 | [Eask]: https://github.com/emacs-eask/cli 71 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'Set up Eask' 2 | description: 'Install a specific Eask version for use in your workflow.' 3 | author: 'Shen, Jen-Chieh' 4 | inputs: 5 | version: 6 | description: 'The version of Eask to install, e.g. "0.0.8", or "snapshot" for a recent development version.' 7 | default: 'snapshot' 8 | architecture: 9 | description: 'The target architecture (x64, arm64) of the Eask-CLI.' 10 | default: 'x64' 11 | required: false 12 | 13 | runs: 14 | using: 'node20' 15 | main: 'dist/index.js' 16 | -------------------------------------------------------------------------------- /dist/index.js: -------------------------------------------------------------------------------- 1 | /******/ (() => { // webpackBootstrap 2 | /******/ var __webpack_modules__ = ({ 3 | 4 | /***/ 351: 5 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 6 | 7 | "use strict"; 8 | 9 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 10 | if (k2 === undefined) k2 = k; 11 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 12 | }) : (function(o, m, k, k2) { 13 | if (k2 === undefined) k2 = k; 14 | o[k2] = m[k]; 15 | })); 16 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 17 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 18 | }) : function(o, v) { 19 | o["default"] = v; 20 | }); 21 | var __importStar = (this && this.__importStar) || function (mod) { 22 | if (mod && mod.__esModule) return mod; 23 | var result = {}; 24 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 25 | __setModuleDefault(result, mod); 26 | return result; 27 | }; 28 | Object.defineProperty(exports, "__esModule", ({ value: true })); 29 | exports.issue = exports.issueCommand = void 0; 30 | const os = __importStar(__nccwpck_require__(37)); 31 | const utils_1 = __nccwpck_require__(278); 32 | /** 33 | * Commands 34 | * 35 | * Command Format: 36 | * ::name key=value,key=value::message 37 | * 38 | * Examples: 39 | * ::warning::This is the message 40 | * ::set-env name=MY_VAR::some value 41 | */ 42 | function issueCommand(command, properties, message) { 43 | const cmd = new Command(command, properties, message); 44 | process.stdout.write(cmd.toString() + os.EOL); 45 | } 46 | exports.issueCommand = issueCommand; 47 | function issue(name, message = '') { 48 | issueCommand(name, {}, message); 49 | } 50 | exports.issue = issue; 51 | const CMD_STRING = '::'; 52 | class Command { 53 | constructor(command, properties, message) { 54 | if (!command) { 55 | command = 'missing.command'; 56 | } 57 | this.command = command; 58 | this.properties = properties; 59 | this.message = message; 60 | } 61 | toString() { 62 | let cmdStr = CMD_STRING + this.command; 63 | if (this.properties && Object.keys(this.properties).length > 0) { 64 | cmdStr += ' '; 65 | let first = true; 66 | for (const key in this.properties) { 67 | if (this.properties.hasOwnProperty(key)) { 68 | const val = this.properties[key]; 69 | if (val) { 70 | if (first) { 71 | first = false; 72 | } 73 | else { 74 | cmdStr += ','; 75 | } 76 | cmdStr += `${key}=${escapeProperty(val)}`; 77 | } 78 | } 79 | } 80 | } 81 | cmdStr += `${CMD_STRING}${escapeData(this.message)}`; 82 | return cmdStr; 83 | } 84 | } 85 | function escapeData(s) { 86 | return utils_1.toCommandValue(s) 87 | .replace(/%/g, '%25') 88 | .replace(/\r/g, '%0D') 89 | .replace(/\n/g, '%0A'); 90 | } 91 | function escapeProperty(s) { 92 | return utils_1.toCommandValue(s) 93 | .replace(/%/g, '%25') 94 | .replace(/\r/g, '%0D') 95 | .replace(/\n/g, '%0A') 96 | .replace(/:/g, '%3A') 97 | .replace(/,/g, '%2C'); 98 | } 99 | //# sourceMappingURL=command.js.map 100 | 101 | /***/ }), 102 | 103 | /***/ 186: 104 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 105 | 106 | "use strict"; 107 | 108 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 109 | if (k2 === undefined) k2 = k; 110 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 111 | }) : (function(o, m, k, k2) { 112 | if (k2 === undefined) k2 = k; 113 | o[k2] = m[k]; 114 | })); 115 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 116 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 117 | }) : function(o, v) { 118 | o["default"] = v; 119 | }); 120 | var __importStar = (this && this.__importStar) || function (mod) { 121 | if (mod && mod.__esModule) return mod; 122 | var result = {}; 123 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 124 | __setModuleDefault(result, mod); 125 | return result; 126 | }; 127 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 128 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 129 | return new (P || (P = Promise))(function (resolve, reject) { 130 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 131 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 132 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 133 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 134 | }); 135 | }; 136 | Object.defineProperty(exports, "__esModule", ({ value: true })); 137 | exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0; 138 | const command_1 = __nccwpck_require__(351); 139 | const file_command_1 = __nccwpck_require__(717); 140 | const utils_1 = __nccwpck_require__(278); 141 | const os = __importStar(__nccwpck_require__(37)); 142 | const path = __importStar(__nccwpck_require__(17)); 143 | const oidc_utils_1 = __nccwpck_require__(41); 144 | /** 145 | * The code to exit an action 146 | */ 147 | var ExitCode; 148 | (function (ExitCode) { 149 | /** 150 | * A code indicating that the action was successful 151 | */ 152 | ExitCode[ExitCode["Success"] = 0] = "Success"; 153 | /** 154 | * A code indicating that the action was a failure 155 | */ 156 | ExitCode[ExitCode["Failure"] = 1] = "Failure"; 157 | })(ExitCode = exports.ExitCode || (exports.ExitCode = {})); 158 | //----------------------------------------------------------------------- 159 | // Variables 160 | //----------------------------------------------------------------------- 161 | /** 162 | * Sets env variable for this action and future actions in the job 163 | * @param name the name of the variable to set 164 | * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify 165 | */ 166 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 167 | function exportVariable(name, val) { 168 | const convertedVal = utils_1.toCommandValue(val); 169 | process.env[name] = convertedVal; 170 | const filePath = process.env['GITHUB_ENV'] || ''; 171 | if (filePath) { 172 | const delimiter = '_GitHubActionsFileCommandDelimeter_'; 173 | const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`; 174 | file_command_1.issueCommand('ENV', commandValue); 175 | } 176 | else { 177 | command_1.issueCommand('set-env', { name }, convertedVal); 178 | } 179 | } 180 | exports.exportVariable = exportVariable; 181 | /** 182 | * Registers a secret which will get masked from logs 183 | * @param secret value of the secret 184 | */ 185 | function setSecret(secret) { 186 | command_1.issueCommand('add-mask', {}, secret); 187 | } 188 | exports.setSecret = setSecret; 189 | /** 190 | * Prepends inputPath to the PATH (for this action and future actions) 191 | * @param inputPath 192 | */ 193 | function addPath(inputPath) { 194 | const filePath = process.env['GITHUB_PATH'] || ''; 195 | if (filePath) { 196 | file_command_1.issueCommand('PATH', inputPath); 197 | } 198 | else { 199 | command_1.issueCommand('add-path', {}, inputPath); 200 | } 201 | process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`; 202 | } 203 | exports.addPath = addPath; 204 | /** 205 | * Gets the value of an input. 206 | * Unless trimWhitespace is set to false in InputOptions, the value is also trimmed. 207 | * Returns an empty string if the value is not defined. 208 | * 209 | * @param name name of the input to get 210 | * @param options optional. See InputOptions. 211 | * @returns string 212 | */ 213 | function getInput(name, options) { 214 | const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || ''; 215 | if (options && options.required && !val) { 216 | throw new Error(`Input required and not supplied: ${name}`); 217 | } 218 | if (options && options.trimWhitespace === false) { 219 | return val; 220 | } 221 | return val.trim(); 222 | } 223 | exports.getInput = getInput; 224 | /** 225 | * Gets the values of an multiline input. Each value is also trimmed. 226 | * 227 | * @param name name of the input to get 228 | * @param options optional. See InputOptions. 229 | * @returns string[] 230 | * 231 | */ 232 | function getMultilineInput(name, options) { 233 | const inputs = getInput(name, options) 234 | .split('\n') 235 | .filter(x => x !== ''); 236 | return inputs; 237 | } 238 | exports.getMultilineInput = getMultilineInput; 239 | /** 240 | * Gets the input value of the boolean type in the YAML 1.2 "core schema" specification. 241 | * Support boolean input list: `true | True | TRUE | false | False | FALSE` . 242 | * The return value is also in boolean type. 243 | * ref: https://yaml.org/spec/1.2/spec.html#id2804923 244 | * 245 | * @param name name of the input to get 246 | * @param options optional. See InputOptions. 247 | * @returns boolean 248 | */ 249 | function getBooleanInput(name, options) { 250 | const trueValue = ['true', 'True', 'TRUE']; 251 | const falseValue = ['false', 'False', 'FALSE']; 252 | const val = getInput(name, options); 253 | if (trueValue.includes(val)) 254 | return true; 255 | if (falseValue.includes(val)) 256 | return false; 257 | throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` + 258 | `Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); 259 | } 260 | exports.getBooleanInput = getBooleanInput; 261 | /** 262 | * Sets the value of an output. 263 | * 264 | * @param name name of the output to set 265 | * @param value value to store. Non-string values will be converted to a string via JSON.stringify 266 | */ 267 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 268 | function setOutput(name, value) { 269 | process.stdout.write(os.EOL); 270 | command_1.issueCommand('set-output', { name }, value); 271 | } 272 | exports.setOutput = setOutput; 273 | /** 274 | * Enables or disables the echoing of commands into stdout for the rest of the step. 275 | * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set. 276 | * 277 | */ 278 | function setCommandEcho(enabled) { 279 | command_1.issue('echo', enabled ? 'on' : 'off'); 280 | } 281 | exports.setCommandEcho = setCommandEcho; 282 | //----------------------------------------------------------------------- 283 | // Results 284 | //----------------------------------------------------------------------- 285 | /** 286 | * Sets the action status to failed. 287 | * When the action exits it will be with an exit code of 1 288 | * @param message add error issue message 289 | */ 290 | function setFailed(message) { 291 | process.exitCode = ExitCode.Failure; 292 | error(message); 293 | } 294 | exports.setFailed = setFailed; 295 | //----------------------------------------------------------------------- 296 | // Logging Commands 297 | //----------------------------------------------------------------------- 298 | /** 299 | * Gets whether Actions Step Debug is on or not 300 | */ 301 | function isDebug() { 302 | return process.env['RUNNER_DEBUG'] === '1'; 303 | } 304 | exports.isDebug = isDebug; 305 | /** 306 | * Writes debug message to user log 307 | * @param message debug message 308 | */ 309 | function debug(message) { 310 | command_1.issueCommand('debug', {}, message); 311 | } 312 | exports.debug = debug; 313 | /** 314 | * Adds an error issue 315 | * @param message error issue message. Errors will be converted to string via toString() 316 | * @param properties optional properties to add to the annotation. 317 | */ 318 | function error(message, properties = {}) { 319 | command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); 320 | } 321 | exports.error = error; 322 | /** 323 | * Adds a warning issue 324 | * @param message warning issue message. Errors will be converted to string via toString() 325 | * @param properties optional properties to add to the annotation. 326 | */ 327 | function warning(message, properties = {}) { 328 | command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); 329 | } 330 | exports.warning = warning; 331 | /** 332 | * Adds a notice issue 333 | * @param message notice issue message. Errors will be converted to string via toString() 334 | * @param properties optional properties to add to the annotation. 335 | */ 336 | function notice(message, properties = {}) { 337 | command_1.issueCommand('notice', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); 338 | } 339 | exports.notice = notice; 340 | /** 341 | * Writes info to log with console.log. 342 | * @param message info message 343 | */ 344 | function info(message) { 345 | process.stdout.write(message + os.EOL); 346 | } 347 | exports.info = info; 348 | /** 349 | * Begin an output group. 350 | * 351 | * Output until the next `groupEnd` will be foldable in this group 352 | * 353 | * @param name The name of the output group 354 | */ 355 | function startGroup(name) { 356 | command_1.issue('group', name); 357 | } 358 | exports.startGroup = startGroup; 359 | /** 360 | * End an output group. 361 | */ 362 | function endGroup() { 363 | command_1.issue('endgroup'); 364 | } 365 | exports.endGroup = endGroup; 366 | /** 367 | * Wrap an asynchronous function call in a group. 368 | * 369 | * Returns the same type as the function itself. 370 | * 371 | * @param name The name of the group 372 | * @param fn The function to wrap in the group 373 | */ 374 | function group(name, fn) { 375 | return __awaiter(this, void 0, void 0, function* () { 376 | startGroup(name); 377 | let result; 378 | try { 379 | result = yield fn(); 380 | } 381 | finally { 382 | endGroup(); 383 | } 384 | return result; 385 | }); 386 | } 387 | exports.group = group; 388 | //----------------------------------------------------------------------- 389 | // Wrapper action state 390 | //----------------------------------------------------------------------- 391 | /** 392 | * Saves state for current action, the state can only be retrieved by this action's post job execution. 393 | * 394 | * @param name name of the state to store 395 | * @param value value to store. Non-string values will be converted to a string via JSON.stringify 396 | */ 397 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 398 | function saveState(name, value) { 399 | command_1.issueCommand('save-state', { name }, value); 400 | } 401 | exports.saveState = saveState; 402 | /** 403 | * Gets the value of an state set by this action's main execution. 404 | * 405 | * @param name name of the state to get 406 | * @returns string 407 | */ 408 | function getState(name) { 409 | return process.env[`STATE_${name}`] || ''; 410 | } 411 | exports.getState = getState; 412 | function getIDToken(aud) { 413 | return __awaiter(this, void 0, void 0, function* () { 414 | return yield oidc_utils_1.OidcClient.getIDToken(aud); 415 | }); 416 | } 417 | exports.getIDToken = getIDToken; 418 | /** 419 | * Summary exports 420 | */ 421 | var summary_1 = __nccwpck_require__(327); 422 | Object.defineProperty(exports, "summary", ({ enumerable: true, get: function () { return summary_1.summary; } })); 423 | /** 424 | * @deprecated use core.summary 425 | */ 426 | var summary_2 = __nccwpck_require__(327); 427 | Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } })); 428 | //# sourceMappingURL=core.js.map 429 | 430 | /***/ }), 431 | 432 | /***/ 717: 433 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 434 | 435 | "use strict"; 436 | 437 | // For internal use, subject to change. 438 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 439 | if (k2 === undefined) k2 = k; 440 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 441 | }) : (function(o, m, k, k2) { 442 | if (k2 === undefined) k2 = k; 443 | o[k2] = m[k]; 444 | })); 445 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 446 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 447 | }) : function(o, v) { 448 | o["default"] = v; 449 | }); 450 | var __importStar = (this && this.__importStar) || function (mod) { 451 | if (mod && mod.__esModule) return mod; 452 | var result = {}; 453 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 454 | __setModuleDefault(result, mod); 455 | return result; 456 | }; 457 | Object.defineProperty(exports, "__esModule", ({ value: true })); 458 | exports.issueCommand = void 0; 459 | // We use any as a valid input type 460 | /* eslint-disable @typescript-eslint/no-explicit-any */ 461 | const fs = __importStar(__nccwpck_require__(147)); 462 | const os = __importStar(__nccwpck_require__(37)); 463 | const utils_1 = __nccwpck_require__(278); 464 | function issueCommand(command, message) { 465 | const filePath = process.env[`GITHUB_${command}`]; 466 | if (!filePath) { 467 | throw new Error(`Unable to find environment variable for file command ${command}`); 468 | } 469 | if (!fs.existsSync(filePath)) { 470 | throw new Error(`Missing file at path: ${filePath}`); 471 | } 472 | fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, { 473 | encoding: 'utf8' 474 | }); 475 | } 476 | exports.issueCommand = issueCommand; 477 | //# sourceMappingURL=file-command.js.map 478 | 479 | /***/ }), 480 | 481 | /***/ 41: 482 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 483 | 484 | "use strict"; 485 | 486 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 487 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 488 | return new (P || (P = Promise))(function (resolve, reject) { 489 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 490 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 491 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 492 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 493 | }); 494 | }; 495 | Object.defineProperty(exports, "__esModule", ({ value: true })); 496 | exports.OidcClient = void 0; 497 | const http_client_1 = __nccwpck_require__(255); 498 | const auth_1 = __nccwpck_require__(526); 499 | const core_1 = __nccwpck_require__(186); 500 | class OidcClient { 501 | static createHttpClient(allowRetry = true, maxRetry = 10) { 502 | const requestOptions = { 503 | allowRetries: allowRetry, 504 | maxRetries: maxRetry 505 | }; 506 | return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions); 507 | } 508 | static getRequestToken() { 509 | const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN']; 510 | if (!token) { 511 | throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable'); 512 | } 513 | return token; 514 | } 515 | static getIDTokenUrl() { 516 | const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL']; 517 | if (!runtimeUrl) { 518 | throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable'); 519 | } 520 | return runtimeUrl; 521 | } 522 | static getCall(id_token_url) { 523 | var _a; 524 | return __awaiter(this, void 0, void 0, function* () { 525 | const httpclient = OidcClient.createHttpClient(); 526 | const res = yield httpclient 527 | .getJson(id_token_url) 528 | .catch(error => { 529 | throw new Error(`Failed to get ID Token. \n 530 | Error Code : ${error.statusCode}\n 531 | Error Message: ${error.result.message}`); 532 | }); 533 | const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; 534 | if (!id_token) { 535 | throw new Error('Response json body do not have ID Token field'); 536 | } 537 | return id_token; 538 | }); 539 | } 540 | static getIDToken(audience) { 541 | return __awaiter(this, void 0, void 0, function* () { 542 | try { 543 | // New ID Token is requested from action service 544 | let id_token_url = OidcClient.getIDTokenUrl(); 545 | if (audience) { 546 | const encodedAudience = encodeURIComponent(audience); 547 | id_token_url = `${id_token_url}&audience=${encodedAudience}`; 548 | } 549 | core_1.debug(`ID token url is ${id_token_url}`); 550 | const id_token = yield OidcClient.getCall(id_token_url); 551 | core_1.setSecret(id_token); 552 | return id_token; 553 | } 554 | catch (error) { 555 | throw new Error(`Error message: ${error.message}`); 556 | } 557 | }); 558 | } 559 | } 560 | exports.OidcClient = OidcClient; 561 | //# sourceMappingURL=oidc-utils.js.map 562 | 563 | /***/ }), 564 | 565 | /***/ 327: 566 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 567 | 568 | "use strict"; 569 | 570 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 571 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 572 | return new (P || (P = Promise))(function (resolve, reject) { 573 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 574 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 575 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 576 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 577 | }); 578 | }; 579 | Object.defineProperty(exports, "__esModule", ({ value: true })); 580 | exports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0; 581 | const os_1 = __nccwpck_require__(37); 582 | const fs_1 = __nccwpck_require__(147); 583 | const { access, appendFile, writeFile } = fs_1.promises; 584 | exports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY'; 585 | exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary'; 586 | class Summary { 587 | constructor() { 588 | this._buffer = ''; 589 | } 590 | /** 591 | * Finds the summary file path from the environment, rejects if env var is not found or file does not exist 592 | * Also checks r/w permissions. 593 | * 594 | * @returns step summary file path 595 | */ 596 | filePath() { 597 | return __awaiter(this, void 0, void 0, function* () { 598 | if (this._filePath) { 599 | return this._filePath; 600 | } 601 | const pathFromEnv = process.env[exports.SUMMARY_ENV_VAR]; 602 | if (!pathFromEnv) { 603 | throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`); 604 | } 605 | try { 606 | yield access(pathFromEnv, fs_1.constants.R_OK | fs_1.constants.W_OK); 607 | } 608 | catch (_a) { 609 | throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`); 610 | } 611 | this._filePath = pathFromEnv; 612 | return this._filePath; 613 | }); 614 | } 615 | /** 616 | * Wraps content in an HTML tag, adding any HTML attributes 617 | * 618 | * @param {string} tag HTML tag to wrap 619 | * @param {string | null} content content within the tag 620 | * @param {[attribute: string]: string} attrs key-value list of HTML attributes to add 621 | * 622 | * @returns {string} content wrapped in HTML element 623 | */ 624 | wrap(tag, content, attrs = {}) { 625 | const htmlAttrs = Object.entries(attrs) 626 | .map(([key, value]) => ` ${key}="${value}"`) 627 | .join(''); 628 | if (!content) { 629 | return `<${tag}${htmlAttrs}>`; 630 | } 631 | return `<${tag}${htmlAttrs}>${content}`; 632 | } 633 | /** 634 | * Writes text in the buffer to the summary buffer file and empties buffer. Will append by default. 635 | * 636 | * @param {SummaryWriteOptions} [options] (optional) options for write operation 637 | * 638 | * @returns {Promise} summary instance 639 | */ 640 | write(options) { 641 | return __awaiter(this, void 0, void 0, function* () { 642 | const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite); 643 | const filePath = yield this.filePath(); 644 | const writeFunc = overwrite ? writeFile : appendFile; 645 | yield writeFunc(filePath, this._buffer, { encoding: 'utf8' }); 646 | return this.emptyBuffer(); 647 | }); 648 | } 649 | /** 650 | * Clears the summary buffer and wipes the summary file 651 | * 652 | * @returns {Summary} summary instance 653 | */ 654 | clear() { 655 | return __awaiter(this, void 0, void 0, function* () { 656 | return this.emptyBuffer().write({ overwrite: true }); 657 | }); 658 | } 659 | /** 660 | * Returns the current summary buffer as a string 661 | * 662 | * @returns {string} string of summary buffer 663 | */ 664 | stringify() { 665 | return this._buffer; 666 | } 667 | /** 668 | * If the summary buffer is empty 669 | * 670 | * @returns {boolen} true if the buffer is empty 671 | */ 672 | isEmptyBuffer() { 673 | return this._buffer.length === 0; 674 | } 675 | /** 676 | * Resets the summary buffer without writing to summary file 677 | * 678 | * @returns {Summary} summary instance 679 | */ 680 | emptyBuffer() { 681 | this._buffer = ''; 682 | return this; 683 | } 684 | /** 685 | * Adds raw text to the summary buffer 686 | * 687 | * @param {string} text content to add 688 | * @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false) 689 | * 690 | * @returns {Summary} summary instance 691 | */ 692 | addRaw(text, addEOL = false) { 693 | this._buffer += text; 694 | return addEOL ? this.addEOL() : this; 695 | } 696 | /** 697 | * Adds the operating system-specific end-of-line marker to the buffer 698 | * 699 | * @returns {Summary} summary instance 700 | */ 701 | addEOL() { 702 | return this.addRaw(os_1.EOL); 703 | } 704 | /** 705 | * Adds an HTML codeblock to the summary buffer 706 | * 707 | * @param {string} code content to render within fenced code block 708 | * @param {string} lang (optional) language to syntax highlight code 709 | * 710 | * @returns {Summary} summary instance 711 | */ 712 | addCodeBlock(code, lang) { 713 | const attrs = Object.assign({}, (lang && { lang })); 714 | const element = this.wrap('pre', this.wrap('code', code), attrs); 715 | return this.addRaw(element).addEOL(); 716 | } 717 | /** 718 | * Adds an HTML list to the summary buffer 719 | * 720 | * @param {string[]} items list of items to render 721 | * @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false) 722 | * 723 | * @returns {Summary} summary instance 724 | */ 725 | addList(items, ordered = false) { 726 | const tag = ordered ? 'ol' : 'ul'; 727 | const listItems = items.map(item => this.wrap('li', item)).join(''); 728 | const element = this.wrap(tag, listItems); 729 | return this.addRaw(element).addEOL(); 730 | } 731 | /** 732 | * Adds an HTML table to the summary buffer 733 | * 734 | * @param {SummaryTableCell[]} rows table rows 735 | * 736 | * @returns {Summary} summary instance 737 | */ 738 | addTable(rows) { 739 | const tableBody = rows 740 | .map(row => { 741 | const cells = row 742 | .map(cell => { 743 | if (typeof cell === 'string') { 744 | return this.wrap('td', cell); 745 | } 746 | const { header, data, colspan, rowspan } = cell; 747 | const tag = header ? 'th' : 'td'; 748 | const attrs = Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan })); 749 | return this.wrap(tag, data, attrs); 750 | }) 751 | .join(''); 752 | return this.wrap('tr', cells); 753 | }) 754 | .join(''); 755 | const element = this.wrap('table', tableBody); 756 | return this.addRaw(element).addEOL(); 757 | } 758 | /** 759 | * Adds a collapsable HTML details element to the summary buffer 760 | * 761 | * @param {string} label text for the closed state 762 | * @param {string} content collapsable content 763 | * 764 | * @returns {Summary} summary instance 765 | */ 766 | addDetails(label, content) { 767 | const element = this.wrap('details', this.wrap('summary', label) + content); 768 | return this.addRaw(element).addEOL(); 769 | } 770 | /** 771 | * Adds an HTML image tag to the summary buffer 772 | * 773 | * @param {string} src path to the image you to embed 774 | * @param {string} alt text description of the image 775 | * @param {SummaryImageOptions} options (optional) addition image attributes 776 | * 777 | * @returns {Summary} summary instance 778 | */ 779 | addImage(src, alt, options) { 780 | const { width, height } = options || {}; 781 | const attrs = Object.assign(Object.assign({}, (width && { width })), (height && { height })); 782 | const element = this.wrap('img', null, Object.assign({ src, alt }, attrs)); 783 | return this.addRaw(element).addEOL(); 784 | } 785 | /** 786 | * Adds an HTML section heading element 787 | * 788 | * @param {string} text heading text 789 | * @param {number | string} [level=1] (optional) the heading level, default: 1 790 | * 791 | * @returns {Summary} summary instance 792 | */ 793 | addHeading(text, level) { 794 | const tag = `h${level}`; 795 | const allowedTag = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tag) 796 | ? tag 797 | : 'h1'; 798 | const element = this.wrap(allowedTag, text); 799 | return this.addRaw(element).addEOL(); 800 | } 801 | /** 802 | * Adds an HTML thematic break (
) to the summary buffer 803 | * 804 | * @returns {Summary} summary instance 805 | */ 806 | addSeparator() { 807 | const element = this.wrap('hr', null); 808 | return this.addRaw(element).addEOL(); 809 | } 810 | /** 811 | * Adds an HTML line break (
) to the summary buffer 812 | * 813 | * @returns {Summary} summary instance 814 | */ 815 | addBreak() { 816 | const element = this.wrap('br', null); 817 | return this.addRaw(element).addEOL(); 818 | } 819 | /** 820 | * Adds an HTML blockquote to the summary buffer 821 | * 822 | * @param {string} text quote text 823 | * @param {string} cite (optional) citation url 824 | * 825 | * @returns {Summary} summary instance 826 | */ 827 | addQuote(text, cite) { 828 | const attrs = Object.assign({}, (cite && { cite })); 829 | const element = this.wrap('blockquote', text, attrs); 830 | return this.addRaw(element).addEOL(); 831 | } 832 | /** 833 | * Adds an HTML anchor tag to the summary buffer 834 | * 835 | * @param {string} text link text/content 836 | * @param {string} href hyperlink 837 | * 838 | * @returns {Summary} summary instance 839 | */ 840 | addLink(text, href) { 841 | const element = this.wrap('a', text, { href }); 842 | return this.addRaw(element).addEOL(); 843 | } 844 | } 845 | const _summary = new Summary(); 846 | /** 847 | * @deprecated use `core.summary` 848 | */ 849 | exports.markdownSummary = _summary; 850 | exports.summary = _summary; 851 | //# sourceMappingURL=summary.js.map 852 | 853 | /***/ }), 854 | 855 | /***/ 278: 856 | /***/ ((__unused_webpack_module, exports) => { 857 | 858 | "use strict"; 859 | 860 | // We use any as a valid input type 861 | /* eslint-disable @typescript-eslint/no-explicit-any */ 862 | Object.defineProperty(exports, "__esModule", ({ value: true })); 863 | exports.toCommandProperties = exports.toCommandValue = void 0; 864 | /** 865 | * Sanitizes an input into a string so it can be passed into issueCommand safely 866 | * @param input input to sanitize into a string 867 | */ 868 | function toCommandValue(input) { 869 | if (input === null || input === undefined) { 870 | return ''; 871 | } 872 | else if (typeof input === 'string' || input instanceof String) { 873 | return input; 874 | } 875 | return JSON.stringify(input); 876 | } 877 | exports.toCommandValue = toCommandValue; 878 | /** 879 | * 880 | * @param annotationProperties 881 | * @returns The command properties to send with the actual annotation command 882 | * See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646 883 | */ 884 | function toCommandProperties(annotationProperties) { 885 | if (!Object.keys(annotationProperties).length) { 886 | return {}; 887 | } 888 | return { 889 | title: annotationProperties.title, 890 | file: annotationProperties.file, 891 | line: annotationProperties.startLine, 892 | endLine: annotationProperties.endLine, 893 | col: annotationProperties.startColumn, 894 | endColumn: annotationProperties.endColumn 895 | }; 896 | } 897 | exports.toCommandProperties = toCommandProperties; 898 | //# sourceMappingURL=utils.js.map 899 | 900 | /***/ }), 901 | 902 | /***/ 514: 903 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 904 | 905 | "use strict"; 906 | 907 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 908 | if (k2 === undefined) k2 = k; 909 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 910 | }) : (function(o, m, k, k2) { 911 | if (k2 === undefined) k2 = k; 912 | o[k2] = m[k]; 913 | })); 914 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 915 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 916 | }) : function(o, v) { 917 | o["default"] = v; 918 | }); 919 | var __importStar = (this && this.__importStar) || function (mod) { 920 | if (mod && mod.__esModule) return mod; 921 | var result = {}; 922 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 923 | __setModuleDefault(result, mod); 924 | return result; 925 | }; 926 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 927 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 928 | return new (P || (P = Promise))(function (resolve, reject) { 929 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 930 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 931 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 932 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 933 | }); 934 | }; 935 | Object.defineProperty(exports, "__esModule", ({ value: true })); 936 | exports.getExecOutput = exports.exec = void 0; 937 | const string_decoder_1 = __nccwpck_require__(576); 938 | const tr = __importStar(__nccwpck_require__(159)); 939 | /** 940 | * Exec a command. 941 | * Output will be streamed to the live console. 942 | * Returns promise with return code 943 | * 944 | * @param commandLine command to execute (can include additional args). Must be correctly escaped. 945 | * @param args optional arguments for tool. Escaping is handled by the lib. 946 | * @param options optional exec options. See ExecOptions 947 | * @returns Promise exit code 948 | */ 949 | function exec(commandLine, args, options) { 950 | return __awaiter(this, void 0, void 0, function* () { 951 | const commandArgs = tr.argStringToArray(commandLine); 952 | if (commandArgs.length === 0) { 953 | throw new Error(`Parameter 'commandLine' cannot be null or empty.`); 954 | } 955 | // Path to tool to execute should be first arg 956 | const toolPath = commandArgs[0]; 957 | args = commandArgs.slice(1).concat(args || []); 958 | const runner = new tr.ToolRunner(toolPath, args, options); 959 | return runner.exec(); 960 | }); 961 | } 962 | exports.exec = exec; 963 | /** 964 | * Exec a command and get the output. 965 | * Output will be streamed to the live console. 966 | * Returns promise with the exit code and collected stdout and stderr 967 | * 968 | * @param commandLine command to execute (can include additional args). Must be correctly escaped. 969 | * @param args optional arguments for tool. Escaping is handled by the lib. 970 | * @param options optional exec options. See ExecOptions 971 | * @returns Promise exit code, stdout, and stderr 972 | */ 973 | function getExecOutput(commandLine, args, options) { 974 | var _a, _b; 975 | return __awaiter(this, void 0, void 0, function* () { 976 | let stdout = ''; 977 | let stderr = ''; 978 | //Using string decoder covers the case where a mult-byte character is split 979 | const stdoutDecoder = new string_decoder_1.StringDecoder('utf8'); 980 | const stderrDecoder = new string_decoder_1.StringDecoder('utf8'); 981 | const originalStdoutListener = (_a = options === null || options === void 0 ? void 0 : options.listeners) === null || _a === void 0 ? void 0 : _a.stdout; 982 | const originalStdErrListener = (_b = options === null || options === void 0 ? void 0 : options.listeners) === null || _b === void 0 ? void 0 : _b.stderr; 983 | const stdErrListener = (data) => { 984 | stderr += stderrDecoder.write(data); 985 | if (originalStdErrListener) { 986 | originalStdErrListener(data); 987 | } 988 | }; 989 | const stdOutListener = (data) => { 990 | stdout += stdoutDecoder.write(data); 991 | if (originalStdoutListener) { 992 | originalStdoutListener(data); 993 | } 994 | }; 995 | const listeners = Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.listeners), { stdout: stdOutListener, stderr: stdErrListener }); 996 | const exitCode = yield exec(commandLine, args, Object.assign(Object.assign({}, options), { listeners })); 997 | //flush any remaining characters 998 | stdout += stdoutDecoder.end(); 999 | stderr += stderrDecoder.end(); 1000 | return { 1001 | exitCode, 1002 | stdout, 1003 | stderr 1004 | }; 1005 | }); 1006 | } 1007 | exports.getExecOutput = getExecOutput; 1008 | //# sourceMappingURL=exec.js.map 1009 | 1010 | /***/ }), 1011 | 1012 | /***/ 159: 1013 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 1014 | 1015 | "use strict"; 1016 | 1017 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 1018 | if (k2 === undefined) k2 = k; 1019 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 1020 | }) : (function(o, m, k, k2) { 1021 | if (k2 === undefined) k2 = k; 1022 | o[k2] = m[k]; 1023 | })); 1024 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 1025 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 1026 | }) : function(o, v) { 1027 | o["default"] = v; 1028 | }); 1029 | var __importStar = (this && this.__importStar) || function (mod) { 1030 | if (mod && mod.__esModule) return mod; 1031 | var result = {}; 1032 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 1033 | __setModuleDefault(result, mod); 1034 | return result; 1035 | }; 1036 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 1037 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 1038 | return new (P || (P = Promise))(function (resolve, reject) { 1039 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 1040 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 1041 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 1042 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 1043 | }); 1044 | }; 1045 | Object.defineProperty(exports, "__esModule", ({ value: true })); 1046 | exports.argStringToArray = exports.ToolRunner = void 0; 1047 | const os = __importStar(__nccwpck_require__(37)); 1048 | const events = __importStar(__nccwpck_require__(361)); 1049 | const child = __importStar(__nccwpck_require__(81)); 1050 | const path = __importStar(__nccwpck_require__(17)); 1051 | const io = __importStar(__nccwpck_require__(436)); 1052 | const ioUtil = __importStar(__nccwpck_require__(962)); 1053 | const timers_1 = __nccwpck_require__(512); 1054 | /* eslint-disable @typescript-eslint/unbound-method */ 1055 | const IS_WINDOWS = process.platform === 'win32'; 1056 | /* 1057 | * Class for running command line tools. Handles quoting and arg parsing in a platform agnostic way. 1058 | */ 1059 | class ToolRunner extends events.EventEmitter { 1060 | constructor(toolPath, args, options) { 1061 | super(); 1062 | if (!toolPath) { 1063 | throw new Error("Parameter 'toolPath' cannot be null or empty."); 1064 | } 1065 | this.toolPath = toolPath; 1066 | this.args = args || []; 1067 | this.options = options || {}; 1068 | } 1069 | _debug(message) { 1070 | if (this.options.listeners && this.options.listeners.debug) { 1071 | this.options.listeners.debug(message); 1072 | } 1073 | } 1074 | _getCommandString(options, noPrefix) { 1075 | const toolPath = this._getSpawnFileName(); 1076 | const args = this._getSpawnArgs(options); 1077 | let cmd = noPrefix ? '' : '[command]'; // omit prefix when piped to a second tool 1078 | if (IS_WINDOWS) { 1079 | // Windows + cmd file 1080 | if (this._isCmdFile()) { 1081 | cmd += toolPath; 1082 | for (const a of args) { 1083 | cmd += ` ${a}`; 1084 | } 1085 | } 1086 | // Windows + verbatim 1087 | else if (options.windowsVerbatimArguments) { 1088 | cmd += `"${toolPath}"`; 1089 | for (const a of args) { 1090 | cmd += ` ${a}`; 1091 | } 1092 | } 1093 | // Windows (regular) 1094 | else { 1095 | cmd += this._windowsQuoteCmdArg(toolPath); 1096 | for (const a of args) { 1097 | cmd += ` ${this._windowsQuoteCmdArg(a)}`; 1098 | } 1099 | } 1100 | } 1101 | else { 1102 | // OSX/Linux - this can likely be improved with some form of quoting. 1103 | // creating processes on Unix is fundamentally different than Windows. 1104 | // on Unix, execvp() takes an arg array. 1105 | cmd += toolPath; 1106 | for (const a of args) { 1107 | cmd += ` ${a}`; 1108 | } 1109 | } 1110 | return cmd; 1111 | } 1112 | _processLineBuffer(data, strBuffer, onLine) { 1113 | try { 1114 | let s = strBuffer + data.toString(); 1115 | let n = s.indexOf(os.EOL); 1116 | while (n > -1) { 1117 | const line = s.substring(0, n); 1118 | onLine(line); 1119 | // the rest of the string ... 1120 | s = s.substring(n + os.EOL.length); 1121 | n = s.indexOf(os.EOL); 1122 | } 1123 | return s; 1124 | } 1125 | catch (err) { 1126 | // streaming lines to console is best effort. Don't fail a build. 1127 | this._debug(`error processing line. Failed with error ${err}`); 1128 | return ''; 1129 | } 1130 | } 1131 | _getSpawnFileName() { 1132 | if (IS_WINDOWS) { 1133 | if (this._isCmdFile()) { 1134 | return process.env['COMSPEC'] || 'cmd.exe'; 1135 | } 1136 | } 1137 | return this.toolPath; 1138 | } 1139 | _getSpawnArgs(options) { 1140 | if (IS_WINDOWS) { 1141 | if (this._isCmdFile()) { 1142 | let argline = `/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`; 1143 | for (const a of this.args) { 1144 | argline += ' '; 1145 | argline += options.windowsVerbatimArguments 1146 | ? a 1147 | : this._windowsQuoteCmdArg(a); 1148 | } 1149 | argline += '"'; 1150 | return [argline]; 1151 | } 1152 | } 1153 | return this.args; 1154 | } 1155 | _endsWith(str, end) { 1156 | return str.endsWith(end); 1157 | } 1158 | _isCmdFile() { 1159 | const upperToolPath = this.toolPath.toUpperCase(); 1160 | return (this._endsWith(upperToolPath, '.CMD') || 1161 | this._endsWith(upperToolPath, '.BAT')); 1162 | } 1163 | _windowsQuoteCmdArg(arg) { 1164 | // for .exe, apply the normal quoting rules that libuv applies 1165 | if (!this._isCmdFile()) { 1166 | return this._uvQuoteCmdArg(arg); 1167 | } 1168 | // otherwise apply quoting rules specific to the cmd.exe command line parser. 1169 | // the libuv rules are generic and are not designed specifically for cmd.exe 1170 | // command line parser. 1171 | // 1172 | // for a detailed description of the cmd.exe command line parser, refer to 1173 | // http://stackoverflow.com/questions/4094699/how-does-the-windows-command-interpreter-cmd-exe-parse-scripts/7970912#7970912 1174 | // need quotes for empty arg 1175 | if (!arg) { 1176 | return '""'; 1177 | } 1178 | // determine whether the arg needs to be quoted 1179 | const cmdSpecialChars = [ 1180 | ' ', 1181 | '\t', 1182 | '&', 1183 | '(', 1184 | ')', 1185 | '[', 1186 | ']', 1187 | '{', 1188 | '}', 1189 | '^', 1190 | '=', 1191 | ';', 1192 | '!', 1193 | "'", 1194 | '+', 1195 | ',', 1196 | '`', 1197 | '~', 1198 | '|', 1199 | '<', 1200 | '>', 1201 | '"' 1202 | ]; 1203 | let needsQuotes = false; 1204 | for (const char of arg) { 1205 | if (cmdSpecialChars.some(x => x === char)) { 1206 | needsQuotes = true; 1207 | break; 1208 | } 1209 | } 1210 | // short-circuit if quotes not needed 1211 | if (!needsQuotes) { 1212 | return arg; 1213 | } 1214 | // the following quoting rules are very similar to the rules that by libuv applies. 1215 | // 1216 | // 1) wrap the string in quotes 1217 | // 1218 | // 2) double-up quotes - i.e. " => "" 1219 | // 1220 | // this is different from the libuv quoting rules. libuv replaces " with \", which unfortunately 1221 | // doesn't work well with a cmd.exe command line. 1222 | // 1223 | // note, replacing " with "" also works well if the arg is passed to a downstream .NET console app. 1224 | // for example, the command line: 1225 | // foo.exe "myarg:""my val""" 1226 | // is parsed by a .NET console app into an arg array: 1227 | // [ "myarg:\"my val\"" ] 1228 | // which is the same end result when applying libuv quoting rules. although the actual 1229 | // command line from libuv quoting rules would look like: 1230 | // foo.exe "myarg:\"my val\"" 1231 | // 1232 | // 3) double-up slashes that precede a quote, 1233 | // e.g. hello \world => "hello \world" 1234 | // hello\"world => "hello\\""world" 1235 | // hello\\"world => "hello\\\\""world" 1236 | // hello world\ => "hello world\\" 1237 | // 1238 | // technically this is not required for a cmd.exe command line, or the batch argument parser. 1239 | // the reasons for including this as a .cmd quoting rule are: 1240 | // 1241 | // a) this is optimized for the scenario where the argument is passed from the .cmd file to an 1242 | // external program. many programs (e.g. .NET console apps) rely on the slash-doubling rule. 1243 | // 1244 | // b) it's what we've been doing previously (by deferring to node default behavior) and we 1245 | // haven't heard any complaints about that aspect. 1246 | // 1247 | // note, a weakness of the quoting rules chosen here, is that % is not escaped. in fact, % cannot be 1248 | // escaped when used on the command line directly - even though within a .cmd file % can be escaped 1249 | // by using %%. 1250 | // 1251 | // the saving grace is, on the command line, %var% is left as-is if var is not defined. this contrasts 1252 | // the line parsing rules within a .cmd file, where if var is not defined it is replaced with nothing. 1253 | // 1254 | // one option that was explored was replacing % with ^% - i.e. %var% => ^%var^%. this hack would 1255 | // often work, since it is unlikely that var^ would exist, and the ^ character is removed when the 1256 | // variable is used. the problem, however, is that ^ is not removed when %* is used to pass the args 1257 | // to an external program. 1258 | // 1259 | // an unexplored potential solution for the % escaping problem, is to create a wrapper .cmd file. 1260 | // % can be escaped within a .cmd file. 1261 | let reverse = '"'; 1262 | let quoteHit = true; 1263 | for (let i = arg.length; i > 0; i--) { 1264 | // walk the string in reverse 1265 | reverse += arg[i - 1]; 1266 | if (quoteHit && arg[i - 1] === '\\') { 1267 | reverse += '\\'; // double the slash 1268 | } 1269 | else if (arg[i - 1] === '"') { 1270 | quoteHit = true; 1271 | reverse += '"'; // double the quote 1272 | } 1273 | else { 1274 | quoteHit = false; 1275 | } 1276 | } 1277 | reverse += '"'; 1278 | return reverse 1279 | .split('') 1280 | .reverse() 1281 | .join(''); 1282 | } 1283 | _uvQuoteCmdArg(arg) { 1284 | // Tool runner wraps child_process.spawn() and needs to apply the same quoting as 1285 | // Node in certain cases where the undocumented spawn option windowsVerbatimArguments 1286 | // is used. 1287 | // 1288 | // Since this function is a port of quote_cmd_arg from Node 4.x (technically, lib UV, 1289 | // see https://github.com/nodejs/node/blob/v4.x/deps/uv/src/win/process.c for details), 1290 | // pasting copyright notice from Node within this function: 1291 | // 1292 | // Copyright Joyent, Inc. and other Node contributors. All rights reserved. 1293 | // 1294 | // Permission is hereby granted, free of charge, to any person obtaining a copy 1295 | // of this software and associated documentation files (the "Software"), to 1296 | // deal in the Software without restriction, including without limitation the 1297 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 1298 | // sell copies of the Software, and to permit persons to whom the Software is 1299 | // furnished to do so, subject to the following conditions: 1300 | // 1301 | // The above copyright notice and this permission notice shall be included in 1302 | // all copies or substantial portions of the Software. 1303 | // 1304 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1305 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1306 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1307 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1308 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 1309 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 1310 | // IN THE SOFTWARE. 1311 | if (!arg) { 1312 | // Need double quotation for empty argument 1313 | return '""'; 1314 | } 1315 | if (!arg.includes(' ') && !arg.includes('\t') && !arg.includes('"')) { 1316 | // No quotation needed 1317 | return arg; 1318 | } 1319 | if (!arg.includes('"') && !arg.includes('\\')) { 1320 | // No embedded double quotes or backslashes, so I can just wrap 1321 | // quote marks around the whole thing. 1322 | return `"${arg}"`; 1323 | } 1324 | // Expected input/output: 1325 | // input : hello"world 1326 | // output: "hello\"world" 1327 | // input : hello""world 1328 | // output: "hello\"\"world" 1329 | // input : hello\world 1330 | // output: hello\world 1331 | // input : hello\\world 1332 | // output: hello\\world 1333 | // input : hello\"world 1334 | // output: "hello\\\"world" 1335 | // input : hello\\"world 1336 | // output: "hello\\\\\"world" 1337 | // input : hello world\ 1338 | // output: "hello world\\" - note the comment in libuv actually reads "hello world\" 1339 | // but it appears the comment is wrong, it should be "hello world\\" 1340 | let reverse = '"'; 1341 | let quoteHit = true; 1342 | for (let i = arg.length; i > 0; i--) { 1343 | // walk the string in reverse 1344 | reverse += arg[i - 1]; 1345 | if (quoteHit && arg[i - 1] === '\\') { 1346 | reverse += '\\'; 1347 | } 1348 | else if (arg[i - 1] === '"') { 1349 | quoteHit = true; 1350 | reverse += '\\'; 1351 | } 1352 | else { 1353 | quoteHit = false; 1354 | } 1355 | } 1356 | reverse += '"'; 1357 | return reverse 1358 | .split('') 1359 | .reverse() 1360 | .join(''); 1361 | } 1362 | _cloneExecOptions(options) { 1363 | options = options || {}; 1364 | const result = { 1365 | cwd: options.cwd || process.cwd(), 1366 | env: options.env || process.env, 1367 | silent: options.silent || false, 1368 | windowsVerbatimArguments: options.windowsVerbatimArguments || false, 1369 | failOnStdErr: options.failOnStdErr || false, 1370 | ignoreReturnCode: options.ignoreReturnCode || false, 1371 | delay: options.delay || 10000 1372 | }; 1373 | result.outStream = options.outStream || process.stdout; 1374 | result.errStream = options.errStream || process.stderr; 1375 | return result; 1376 | } 1377 | _getSpawnOptions(options, toolPath) { 1378 | options = options || {}; 1379 | const result = {}; 1380 | result.cwd = options.cwd; 1381 | result.env = options.env; 1382 | result['windowsVerbatimArguments'] = 1383 | options.windowsVerbatimArguments || this._isCmdFile(); 1384 | if (options.windowsVerbatimArguments) { 1385 | result.argv0 = `"${toolPath}"`; 1386 | } 1387 | return result; 1388 | } 1389 | /** 1390 | * Exec a tool. 1391 | * Output will be streamed to the live console. 1392 | * Returns promise with return code 1393 | * 1394 | * @param tool path to tool to exec 1395 | * @param options optional exec options. See ExecOptions 1396 | * @returns number 1397 | */ 1398 | exec() { 1399 | return __awaiter(this, void 0, void 0, function* () { 1400 | // root the tool path if it is unrooted and contains relative pathing 1401 | if (!ioUtil.isRooted(this.toolPath) && 1402 | (this.toolPath.includes('/') || 1403 | (IS_WINDOWS && this.toolPath.includes('\\')))) { 1404 | // prefer options.cwd if it is specified, however options.cwd may also need to be rooted 1405 | this.toolPath = path.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath); 1406 | } 1407 | // if the tool is only a file name, then resolve it from the PATH 1408 | // otherwise verify it exists (add extension on Windows if necessary) 1409 | this.toolPath = yield io.which(this.toolPath, true); 1410 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { 1411 | this._debug(`exec tool: ${this.toolPath}`); 1412 | this._debug('arguments:'); 1413 | for (const arg of this.args) { 1414 | this._debug(` ${arg}`); 1415 | } 1416 | const optionsNonNull = this._cloneExecOptions(this.options); 1417 | if (!optionsNonNull.silent && optionsNonNull.outStream) { 1418 | optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL); 1419 | } 1420 | const state = new ExecState(optionsNonNull, this.toolPath); 1421 | state.on('debug', (message) => { 1422 | this._debug(message); 1423 | }); 1424 | if (this.options.cwd && !(yield ioUtil.exists(this.options.cwd))) { 1425 | return reject(new Error(`The cwd: ${this.options.cwd} does not exist!`)); 1426 | } 1427 | const fileName = this._getSpawnFileName(); 1428 | const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName)); 1429 | let stdbuffer = ''; 1430 | if (cp.stdout) { 1431 | cp.stdout.on('data', (data) => { 1432 | if (this.options.listeners && this.options.listeners.stdout) { 1433 | this.options.listeners.stdout(data); 1434 | } 1435 | if (!optionsNonNull.silent && optionsNonNull.outStream) { 1436 | optionsNonNull.outStream.write(data); 1437 | } 1438 | stdbuffer = this._processLineBuffer(data, stdbuffer, (line) => { 1439 | if (this.options.listeners && this.options.listeners.stdline) { 1440 | this.options.listeners.stdline(line); 1441 | } 1442 | }); 1443 | }); 1444 | } 1445 | let errbuffer = ''; 1446 | if (cp.stderr) { 1447 | cp.stderr.on('data', (data) => { 1448 | state.processStderr = true; 1449 | if (this.options.listeners && this.options.listeners.stderr) { 1450 | this.options.listeners.stderr(data); 1451 | } 1452 | if (!optionsNonNull.silent && 1453 | optionsNonNull.errStream && 1454 | optionsNonNull.outStream) { 1455 | const s = optionsNonNull.failOnStdErr 1456 | ? optionsNonNull.errStream 1457 | : optionsNonNull.outStream; 1458 | s.write(data); 1459 | } 1460 | errbuffer = this._processLineBuffer(data, errbuffer, (line) => { 1461 | if (this.options.listeners && this.options.listeners.errline) { 1462 | this.options.listeners.errline(line); 1463 | } 1464 | }); 1465 | }); 1466 | } 1467 | cp.on('error', (err) => { 1468 | state.processError = err.message; 1469 | state.processExited = true; 1470 | state.processClosed = true; 1471 | state.CheckComplete(); 1472 | }); 1473 | cp.on('exit', (code) => { 1474 | state.processExitCode = code; 1475 | state.processExited = true; 1476 | this._debug(`Exit code ${code} received from tool '${this.toolPath}'`); 1477 | state.CheckComplete(); 1478 | }); 1479 | cp.on('close', (code) => { 1480 | state.processExitCode = code; 1481 | state.processExited = true; 1482 | state.processClosed = true; 1483 | this._debug(`STDIO streams have closed for tool '${this.toolPath}'`); 1484 | state.CheckComplete(); 1485 | }); 1486 | state.on('done', (error, exitCode) => { 1487 | if (stdbuffer.length > 0) { 1488 | this.emit('stdline', stdbuffer); 1489 | } 1490 | if (errbuffer.length > 0) { 1491 | this.emit('errline', errbuffer); 1492 | } 1493 | cp.removeAllListeners(); 1494 | if (error) { 1495 | reject(error); 1496 | } 1497 | else { 1498 | resolve(exitCode); 1499 | } 1500 | }); 1501 | if (this.options.input) { 1502 | if (!cp.stdin) { 1503 | throw new Error('child process missing stdin'); 1504 | } 1505 | cp.stdin.end(this.options.input); 1506 | } 1507 | })); 1508 | }); 1509 | } 1510 | } 1511 | exports.ToolRunner = ToolRunner; 1512 | /** 1513 | * Convert an arg string to an array of args. Handles escaping 1514 | * 1515 | * @param argString string of arguments 1516 | * @returns string[] array of arguments 1517 | */ 1518 | function argStringToArray(argString) { 1519 | const args = []; 1520 | let inQuotes = false; 1521 | let escaped = false; 1522 | let arg = ''; 1523 | function append(c) { 1524 | // we only escape double quotes. 1525 | if (escaped && c !== '"') { 1526 | arg += '\\'; 1527 | } 1528 | arg += c; 1529 | escaped = false; 1530 | } 1531 | for (let i = 0; i < argString.length; i++) { 1532 | const c = argString.charAt(i); 1533 | if (c === '"') { 1534 | if (!escaped) { 1535 | inQuotes = !inQuotes; 1536 | } 1537 | else { 1538 | append(c); 1539 | } 1540 | continue; 1541 | } 1542 | if (c === '\\' && escaped) { 1543 | append(c); 1544 | continue; 1545 | } 1546 | if (c === '\\' && inQuotes) { 1547 | escaped = true; 1548 | continue; 1549 | } 1550 | if (c === ' ' && !inQuotes) { 1551 | if (arg.length > 0) { 1552 | args.push(arg); 1553 | arg = ''; 1554 | } 1555 | continue; 1556 | } 1557 | append(c); 1558 | } 1559 | if (arg.length > 0) { 1560 | args.push(arg.trim()); 1561 | } 1562 | return args; 1563 | } 1564 | exports.argStringToArray = argStringToArray; 1565 | class ExecState extends events.EventEmitter { 1566 | constructor(options, toolPath) { 1567 | super(); 1568 | this.processClosed = false; // tracks whether the process has exited and stdio is closed 1569 | this.processError = ''; 1570 | this.processExitCode = 0; 1571 | this.processExited = false; // tracks whether the process has exited 1572 | this.processStderr = false; // tracks whether stderr was written to 1573 | this.delay = 10000; // 10 seconds 1574 | this.done = false; 1575 | this.timeout = null; 1576 | if (!toolPath) { 1577 | throw new Error('toolPath must not be empty'); 1578 | } 1579 | this.options = options; 1580 | this.toolPath = toolPath; 1581 | if (options.delay) { 1582 | this.delay = options.delay; 1583 | } 1584 | } 1585 | CheckComplete() { 1586 | if (this.done) { 1587 | return; 1588 | } 1589 | if (this.processClosed) { 1590 | this._setResult(); 1591 | } 1592 | else if (this.processExited) { 1593 | this.timeout = timers_1.setTimeout(ExecState.HandleTimeout, this.delay, this); 1594 | } 1595 | } 1596 | _debug(message) { 1597 | this.emit('debug', message); 1598 | } 1599 | _setResult() { 1600 | // determine whether there is an error 1601 | let error; 1602 | if (this.processExited) { 1603 | if (this.processError) { 1604 | error = new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`); 1605 | } 1606 | else if (this.processExitCode !== 0 && !this.options.ignoreReturnCode) { 1607 | error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`); 1608 | } 1609 | else if (this.processStderr && this.options.failOnStdErr) { 1610 | error = new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`); 1611 | } 1612 | } 1613 | // clear the timeout 1614 | if (this.timeout) { 1615 | clearTimeout(this.timeout); 1616 | this.timeout = null; 1617 | } 1618 | this.done = true; 1619 | this.emit('done', error, this.processExitCode); 1620 | } 1621 | static HandleTimeout(state) { 1622 | if (state.done) { 1623 | return; 1624 | } 1625 | if (!state.processClosed && state.processExited) { 1626 | const message = `The STDIO streams did not close within ${state.delay / 1627 | 1000} seconds of the exit event from process '${state.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`; 1628 | state._debug(message); 1629 | } 1630 | state._setResult(); 1631 | } 1632 | } 1633 | //# sourceMappingURL=toolrunner.js.map 1634 | 1635 | /***/ }), 1636 | 1637 | /***/ 526: 1638 | /***/ (function(__unused_webpack_module, exports) { 1639 | 1640 | "use strict"; 1641 | 1642 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 1643 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 1644 | return new (P || (P = Promise))(function (resolve, reject) { 1645 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 1646 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 1647 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 1648 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 1649 | }); 1650 | }; 1651 | Object.defineProperty(exports, "__esModule", ({ value: true })); 1652 | exports.PersonalAccessTokenCredentialHandler = exports.BearerCredentialHandler = exports.BasicCredentialHandler = void 0; 1653 | class BasicCredentialHandler { 1654 | constructor(username, password) { 1655 | this.username = username; 1656 | this.password = password; 1657 | } 1658 | prepareRequest(options) { 1659 | if (!options.headers) { 1660 | throw Error('The request has no headers'); 1661 | } 1662 | options.headers['Authorization'] = `Basic ${Buffer.from(`${this.username}:${this.password}`).toString('base64')}`; 1663 | } 1664 | // This handler cannot handle 401 1665 | canHandleAuthentication() { 1666 | return false; 1667 | } 1668 | handleAuthentication() { 1669 | return __awaiter(this, void 0, void 0, function* () { 1670 | throw new Error('not implemented'); 1671 | }); 1672 | } 1673 | } 1674 | exports.BasicCredentialHandler = BasicCredentialHandler; 1675 | class BearerCredentialHandler { 1676 | constructor(token) { 1677 | this.token = token; 1678 | } 1679 | // currently implements pre-authorization 1680 | // TODO: support preAuth = false where it hooks on 401 1681 | prepareRequest(options) { 1682 | if (!options.headers) { 1683 | throw Error('The request has no headers'); 1684 | } 1685 | options.headers['Authorization'] = `Bearer ${this.token}`; 1686 | } 1687 | // This handler cannot handle 401 1688 | canHandleAuthentication() { 1689 | return false; 1690 | } 1691 | handleAuthentication() { 1692 | return __awaiter(this, void 0, void 0, function* () { 1693 | throw new Error('not implemented'); 1694 | }); 1695 | } 1696 | } 1697 | exports.BearerCredentialHandler = BearerCredentialHandler; 1698 | class PersonalAccessTokenCredentialHandler { 1699 | constructor(token) { 1700 | this.token = token; 1701 | } 1702 | // currently implements pre-authorization 1703 | // TODO: support preAuth = false where it hooks on 401 1704 | prepareRequest(options) { 1705 | if (!options.headers) { 1706 | throw Error('The request has no headers'); 1707 | } 1708 | options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`; 1709 | } 1710 | // This handler cannot handle 401 1711 | canHandleAuthentication() { 1712 | return false; 1713 | } 1714 | handleAuthentication() { 1715 | return __awaiter(this, void 0, void 0, function* () { 1716 | throw new Error('not implemented'); 1717 | }); 1718 | } 1719 | } 1720 | exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler; 1721 | //# sourceMappingURL=auth.js.map 1722 | 1723 | /***/ }), 1724 | 1725 | /***/ 255: 1726 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 1727 | 1728 | "use strict"; 1729 | 1730 | /* eslint-disable @typescript-eslint/no-explicit-any */ 1731 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 1732 | if (k2 === undefined) k2 = k; 1733 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 1734 | }) : (function(o, m, k, k2) { 1735 | if (k2 === undefined) k2 = k; 1736 | o[k2] = m[k]; 1737 | })); 1738 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 1739 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 1740 | }) : function(o, v) { 1741 | o["default"] = v; 1742 | }); 1743 | var __importStar = (this && this.__importStar) || function (mod) { 1744 | if (mod && mod.__esModule) return mod; 1745 | var result = {}; 1746 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 1747 | __setModuleDefault(result, mod); 1748 | return result; 1749 | }; 1750 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 1751 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 1752 | return new (P || (P = Promise))(function (resolve, reject) { 1753 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 1754 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 1755 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 1756 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 1757 | }); 1758 | }; 1759 | Object.defineProperty(exports, "__esModule", ({ value: true })); 1760 | exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0; 1761 | const http = __importStar(__nccwpck_require__(685)); 1762 | const https = __importStar(__nccwpck_require__(687)); 1763 | const pm = __importStar(__nccwpck_require__(835)); 1764 | const tunnel = __importStar(__nccwpck_require__(294)); 1765 | var HttpCodes; 1766 | (function (HttpCodes) { 1767 | HttpCodes[HttpCodes["OK"] = 200] = "OK"; 1768 | HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices"; 1769 | HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently"; 1770 | HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved"; 1771 | HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther"; 1772 | HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified"; 1773 | HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy"; 1774 | HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy"; 1775 | HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect"; 1776 | HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect"; 1777 | HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest"; 1778 | HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized"; 1779 | HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired"; 1780 | HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden"; 1781 | HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound"; 1782 | HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed"; 1783 | HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable"; 1784 | HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; 1785 | HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout"; 1786 | HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict"; 1787 | HttpCodes[HttpCodes["Gone"] = 410] = "Gone"; 1788 | HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests"; 1789 | HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError"; 1790 | HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented"; 1791 | HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway"; 1792 | HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable"; 1793 | HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout"; 1794 | })(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {})); 1795 | var Headers; 1796 | (function (Headers) { 1797 | Headers["Accept"] = "accept"; 1798 | Headers["ContentType"] = "content-type"; 1799 | })(Headers = exports.Headers || (exports.Headers = {})); 1800 | var MediaTypes; 1801 | (function (MediaTypes) { 1802 | MediaTypes["ApplicationJson"] = "application/json"; 1803 | })(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {})); 1804 | /** 1805 | * Returns the proxy URL, depending upon the supplied url and proxy environment variables. 1806 | * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com 1807 | */ 1808 | function getProxyUrl(serverUrl) { 1809 | const proxyUrl = pm.getProxyUrl(new URL(serverUrl)); 1810 | return proxyUrl ? proxyUrl.href : ''; 1811 | } 1812 | exports.getProxyUrl = getProxyUrl; 1813 | const HttpRedirectCodes = [ 1814 | HttpCodes.MovedPermanently, 1815 | HttpCodes.ResourceMoved, 1816 | HttpCodes.SeeOther, 1817 | HttpCodes.TemporaryRedirect, 1818 | HttpCodes.PermanentRedirect 1819 | ]; 1820 | const HttpResponseRetryCodes = [ 1821 | HttpCodes.BadGateway, 1822 | HttpCodes.ServiceUnavailable, 1823 | HttpCodes.GatewayTimeout 1824 | ]; 1825 | const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD']; 1826 | const ExponentialBackoffCeiling = 10; 1827 | const ExponentialBackoffTimeSlice = 5; 1828 | class HttpClientError extends Error { 1829 | constructor(message, statusCode) { 1830 | super(message); 1831 | this.name = 'HttpClientError'; 1832 | this.statusCode = statusCode; 1833 | Object.setPrototypeOf(this, HttpClientError.prototype); 1834 | } 1835 | } 1836 | exports.HttpClientError = HttpClientError; 1837 | class HttpClientResponse { 1838 | constructor(message) { 1839 | this.message = message; 1840 | } 1841 | readBody() { 1842 | return __awaiter(this, void 0, void 0, function* () { 1843 | return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () { 1844 | let output = Buffer.alloc(0); 1845 | this.message.on('data', (chunk) => { 1846 | output = Buffer.concat([output, chunk]); 1847 | }); 1848 | this.message.on('end', () => { 1849 | resolve(output.toString()); 1850 | }); 1851 | })); 1852 | }); 1853 | } 1854 | } 1855 | exports.HttpClientResponse = HttpClientResponse; 1856 | function isHttps(requestUrl) { 1857 | const parsedUrl = new URL(requestUrl); 1858 | return parsedUrl.protocol === 'https:'; 1859 | } 1860 | exports.isHttps = isHttps; 1861 | class HttpClient { 1862 | constructor(userAgent, handlers, requestOptions) { 1863 | this._ignoreSslError = false; 1864 | this._allowRedirects = true; 1865 | this._allowRedirectDowngrade = false; 1866 | this._maxRedirects = 50; 1867 | this._allowRetries = false; 1868 | this._maxRetries = 1; 1869 | this._keepAlive = false; 1870 | this._disposed = false; 1871 | this.userAgent = userAgent; 1872 | this.handlers = handlers || []; 1873 | this.requestOptions = requestOptions; 1874 | if (requestOptions) { 1875 | if (requestOptions.ignoreSslError != null) { 1876 | this._ignoreSslError = requestOptions.ignoreSslError; 1877 | } 1878 | this._socketTimeout = requestOptions.socketTimeout; 1879 | if (requestOptions.allowRedirects != null) { 1880 | this._allowRedirects = requestOptions.allowRedirects; 1881 | } 1882 | if (requestOptions.allowRedirectDowngrade != null) { 1883 | this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade; 1884 | } 1885 | if (requestOptions.maxRedirects != null) { 1886 | this._maxRedirects = Math.max(requestOptions.maxRedirects, 0); 1887 | } 1888 | if (requestOptions.keepAlive != null) { 1889 | this._keepAlive = requestOptions.keepAlive; 1890 | } 1891 | if (requestOptions.allowRetries != null) { 1892 | this._allowRetries = requestOptions.allowRetries; 1893 | } 1894 | if (requestOptions.maxRetries != null) { 1895 | this._maxRetries = requestOptions.maxRetries; 1896 | } 1897 | } 1898 | } 1899 | options(requestUrl, additionalHeaders) { 1900 | return __awaiter(this, void 0, void 0, function* () { 1901 | return this.request('OPTIONS', requestUrl, null, additionalHeaders || {}); 1902 | }); 1903 | } 1904 | get(requestUrl, additionalHeaders) { 1905 | return __awaiter(this, void 0, void 0, function* () { 1906 | return this.request('GET', requestUrl, null, additionalHeaders || {}); 1907 | }); 1908 | } 1909 | del(requestUrl, additionalHeaders) { 1910 | return __awaiter(this, void 0, void 0, function* () { 1911 | return this.request('DELETE', requestUrl, null, additionalHeaders || {}); 1912 | }); 1913 | } 1914 | post(requestUrl, data, additionalHeaders) { 1915 | return __awaiter(this, void 0, void 0, function* () { 1916 | return this.request('POST', requestUrl, data, additionalHeaders || {}); 1917 | }); 1918 | } 1919 | patch(requestUrl, data, additionalHeaders) { 1920 | return __awaiter(this, void 0, void 0, function* () { 1921 | return this.request('PATCH', requestUrl, data, additionalHeaders || {}); 1922 | }); 1923 | } 1924 | put(requestUrl, data, additionalHeaders) { 1925 | return __awaiter(this, void 0, void 0, function* () { 1926 | return this.request('PUT', requestUrl, data, additionalHeaders || {}); 1927 | }); 1928 | } 1929 | head(requestUrl, additionalHeaders) { 1930 | return __awaiter(this, void 0, void 0, function* () { 1931 | return this.request('HEAD', requestUrl, null, additionalHeaders || {}); 1932 | }); 1933 | } 1934 | sendStream(verb, requestUrl, stream, additionalHeaders) { 1935 | return __awaiter(this, void 0, void 0, function* () { 1936 | return this.request(verb, requestUrl, stream, additionalHeaders); 1937 | }); 1938 | } 1939 | /** 1940 | * Gets a typed object from an endpoint 1941 | * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise 1942 | */ 1943 | getJson(requestUrl, additionalHeaders = {}) { 1944 | return __awaiter(this, void 0, void 0, function* () { 1945 | additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 1946 | const res = yield this.get(requestUrl, additionalHeaders); 1947 | return this._processResponse(res, this.requestOptions); 1948 | }); 1949 | } 1950 | postJson(requestUrl, obj, additionalHeaders = {}) { 1951 | return __awaiter(this, void 0, void 0, function* () { 1952 | const data = JSON.stringify(obj, null, 2); 1953 | additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 1954 | additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 1955 | const res = yield this.post(requestUrl, data, additionalHeaders); 1956 | return this._processResponse(res, this.requestOptions); 1957 | }); 1958 | } 1959 | putJson(requestUrl, obj, additionalHeaders = {}) { 1960 | return __awaiter(this, void 0, void 0, function* () { 1961 | const data = JSON.stringify(obj, null, 2); 1962 | additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 1963 | additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 1964 | const res = yield this.put(requestUrl, data, additionalHeaders); 1965 | return this._processResponse(res, this.requestOptions); 1966 | }); 1967 | } 1968 | patchJson(requestUrl, obj, additionalHeaders = {}) { 1969 | return __awaiter(this, void 0, void 0, function* () { 1970 | const data = JSON.stringify(obj, null, 2); 1971 | additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 1972 | additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 1973 | const res = yield this.patch(requestUrl, data, additionalHeaders); 1974 | return this._processResponse(res, this.requestOptions); 1975 | }); 1976 | } 1977 | /** 1978 | * Makes a raw http request. 1979 | * All other methods such as get, post, patch, and request ultimately call this. 1980 | * Prefer get, del, post and patch 1981 | */ 1982 | request(verb, requestUrl, data, headers) { 1983 | return __awaiter(this, void 0, void 0, function* () { 1984 | if (this._disposed) { 1985 | throw new Error('Client has already been disposed.'); 1986 | } 1987 | const parsedUrl = new URL(requestUrl); 1988 | let info = this._prepareRequest(verb, parsedUrl, headers); 1989 | // Only perform retries on reads since writes may not be idempotent. 1990 | const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb) 1991 | ? this._maxRetries + 1 1992 | : 1; 1993 | let numTries = 0; 1994 | let response; 1995 | do { 1996 | response = yield this.requestRaw(info, data); 1997 | // Check if it's an authentication challenge 1998 | if (response && 1999 | response.message && 2000 | response.message.statusCode === HttpCodes.Unauthorized) { 2001 | let authenticationHandler; 2002 | for (const handler of this.handlers) { 2003 | if (handler.canHandleAuthentication(response)) { 2004 | authenticationHandler = handler; 2005 | break; 2006 | } 2007 | } 2008 | if (authenticationHandler) { 2009 | return authenticationHandler.handleAuthentication(this, info, data); 2010 | } 2011 | else { 2012 | // We have received an unauthorized response but have no handlers to handle it. 2013 | // Let the response return to the caller. 2014 | return response; 2015 | } 2016 | } 2017 | let redirectsRemaining = this._maxRedirects; 2018 | while (response.message.statusCode && 2019 | HttpRedirectCodes.includes(response.message.statusCode) && 2020 | this._allowRedirects && 2021 | redirectsRemaining > 0) { 2022 | const redirectUrl = response.message.headers['location']; 2023 | if (!redirectUrl) { 2024 | // if there's no location to redirect to, we won't 2025 | break; 2026 | } 2027 | const parsedRedirectUrl = new URL(redirectUrl); 2028 | if (parsedUrl.protocol === 'https:' && 2029 | parsedUrl.protocol !== parsedRedirectUrl.protocol && 2030 | !this._allowRedirectDowngrade) { 2031 | throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.'); 2032 | } 2033 | // we need to finish reading the response before reassigning response 2034 | // which will leak the open socket. 2035 | yield response.readBody(); 2036 | // strip authorization header if redirected to a different hostname 2037 | if (parsedRedirectUrl.hostname !== parsedUrl.hostname) { 2038 | for (const header in headers) { 2039 | // header names are case insensitive 2040 | if (header.toLowerCase() === 'authorization') { 2041 | delete headers[header]; 2042 | } 2043 | } 2044 | } 2045 | // let's make the request with the new redirectUrl 2046 | info = this._prepareRequest(verb, parsedRedirectUrl, headers); 2047 | response = yield this.requestRaw(info, data); 2048 | redirectsRemaining--; 2049 | } 2050 | if (!response.message.statusCode || 2051 | !HttpResponseRetryCodes.includes(response.message.statusCode)) { 2052 | // If not a retry code, return immediately instead of retrying 2053 | return response; 2054 | } 2055 | numTries += 1; 2056 | if (numTries < maxTries) { 2057 | yield response.readBody(); 2058 | yield this._performExponentialBackoff(numTries); 2059 | } 2060 | } while (numTries < maxTries); 2061 | return response; 2062 | }); 2063 | } 2064 | /** 2065 | * Needs to be called if keepAlive is set to true in request options. 2066 | */ 2067 | dispose() { 2068 | if (this._agent) { 2069 | this._agent.destroy(); 2070 | } 2071 | this._disposed = true; 2072 | } 2073 | /** 2074 | * Raw request. 2075 | * @param info 2076 | * @param data 2077 | */ 2078 | requestRaw(info, data) { 2079 | return __awaiter(this, void 0, void 0, function* () { 2080 | return new Promise((resolve, reject) => { 2081 | function callbackForResult(err, res) { 2082 | if (err) { 2083 | reject(err); 2084 | } 2085 | else if (!res) { 2086 | // If `err` is not passed, then `res` must be passed. 2087 | reject(new Error('Unknown error')); 2088 | } 2089 | else { 2090 | resolve(res); 2091 | } 2092 | } 2093 | this.requestRawWithCallback(info, data, callbackForResult); 2094 | }); 2095 | }); 2096 | } 2097 | /** 2098 | * Raw request with callback. 2099 | * @param info 2100 | * @param data 2101 | * @param onResult 2102 | */ 2103 | requestRawWithCallback(info, data, onResult) { 2104 | if (typeof data === 'string') { 2105 | if (!info.options.headers) { 2106 | info.options.headers = {}; 2107 | } 2108 | info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8'); 2109 | } 2110 | let callbackCalled = false; 2111 | function handleResult(err, res) { 2112 | if (!callbackCalled) { 2113 | callbackCalled = true; 2114 | onResult(err, res); 2115 | } 2116 | } 2117 | const req = info.httpModule.request(info.options, (msg) => { 2118 | const res = new HttpClientResponse(msg); 2119 | handleResult(undefined, res); 2120 | }); 2121 | let socket; 2122 | req.on('socket', sock => { 2123 | socket = sock; 2124 | }); 2125 | // If we ever get disconnected, we want the socket to timeout eventually 2126 | req.setTimeout(this._socketTimeout || 3 * 60000, () => { 2127 | if (socket) { 2128 | socket.end(); 2129 | } 2130 | handleResult(new Error(`Request timeout: ${info.options.path}`)); 2131 | }); 2132 | req.on('error', function (err) { 2133 | // err has statusCode property 2134 | // res should have headers 2135 | handleResult(err); 2136 | }); 2137 | if (data && typeof data === 'string') { 2138 | req.write(data, 'utf8'); 2139 | } 2140 | if (data && typeof data !== 'string') { 2141 | data.on('close', function () { 2142 | req.end(); 2143 | }); 2144 | data.pipe(req); 2145 | } 2146 | else { 2147 | req.end(); 2148 | } 2149 | } 2150 | /** 2151 | * Gets an http agent. This function is useful when you need an http agent that handles 2152 | * routing through a proxy server - depending upon the url and proxy environment variables. 2153 | * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com 2154 | */ 2155 | getAgent(serverUrl) { 2156 | const parsedUrl = new URL(serverUrl); 2157 | return this._getAgent(parsedUrl); 2158 | } 2159 | _prepareRequest(method, requestUrl, headers) { 2160 | const info = {}; 2161 | info.parsedUrl = requestUrl; 2162 | const usingSsl = info.parsedUrl.protocol === 'https:'; 2163 | info.httpModule = usingSsl ? https : http; 2164 | const defaultPort = usingSsl ? 443 : 80; 2165 | info.options = {}; 2166 | info.options.host = info.parsedUrl.hostname; 2167 | info.options.port = info.parsedUrl.port 2168 | ? parseInt(info.parsedUrl.port) 2169 | : defaultPort; 2170 | info.options.path = 2171 | (info.parsedUrl.pathname || '') + (info.parsedUrl.search || ''); 2172 | info.options.method = method; 2173 | info.options.headers = this._mergeHeaders(headers); 2174 | if (this.userAgent != null) { 2175 | info.options.headers['user-agent'] = this.userAgent; 2176 | } 2177 | info.options.agent = this._getAgent(info.parsedUrl); 2178 | // gives handlers an opportunity to participate 2179 | if (this.handlers) { 2180 | for (const handler of this.handlers) { 2181 | handler.prepareRequest(info.options); 2182 | } 2183 | } 2184 | return info; 2185 | } 2186 | _mergeHeaders(headers) { 2187 | if (this.requestOptions && this.requestOptions.headers) { 2188 | return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers || {})); 2189 | } 2190 | return lowercaseKeys(headers || {}); 2191 | } 2192 | _getExistingOrDefaultHeader(additionalHeaders, header, _default) { 2193 | let clientHeader; 2194 | if (this.requestOptions && this.requestOptions.headers) { 2195 | clientHeader = lowercaseKeys(this.requestOptions.headers)[header]; 2196 | } 2197 | return additionalHeaders[header] || clientHeader || _default; 2198 | } 2199 | _getAgent(parsedUrl) { 2200 | let agent; 2201 | const proxyUrl = pm.getProxyUrl(parsedUrl); 2202 | const useProxy = proxyUrl && proxyUrl.hostname; 2203 | if (this._keepAlive && useProxy) { 2204 | agent = this._proxyAgent; 2205 | } 2206 | if (this._keepAlive && !useProxy) { 2207 | agent = this._agent; 2208 | } 2209 | // if agent is already assigned use that agent. 2210 | if (agent) { 2211 | return agent; 2212 | } 2213 | const usingSsl = parsedUrl.protocol === 'https:'; 2214 | let maxSockets = 100; 2215 | if (this.requestOptions) { 2216 | maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets; 2217 | } 2218 | // This is `useProxy` again, but we need to check `proxyURl` directly for TypeScripts's flow analysis. 2219 | if (proxyUrl && proxyUrl.hostname) { 2220 | const agentOptions = { 2221 | maxSockets, 2222 | keepAlive: this._keepAlive, 2223 | proxy: Object.assign(Object.assign({}, ((proxyUrl.username || proxyUrl.password) && { 2224 | proxyAuth: `${proxyUrl.username}:${proxyUrl.password}` 2225 | })), { host: proxyUrl.hostname, port: proxyUrl.port }) 2226 | }; 2227 | let tunnelAgent; 2228 | const overHttps = proxyUrl.protocol === 'https:'; 2229 | if (usingSsl) { 2230 | tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp; 2231 | } 2232 | else { 2233 | tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp; 2234 | } 2235 | agent = tunnelAgent(agentOptions); 2236 | this._proxyAgent = agent; 2237 | } 2238 | // if reusing agent across request and tunneling agent isn't assigned create a new agent 2239 | if (this._keepAlive && !agent) { 2240 | const options = { keepAlive: this._keepAlive, maxSockets }; 2241 | agent = usingSsl ? new https.Agent(options) : new http.Agent(options); 2242 | this._agent = agent; 2243 | } 2244 | // if not using private agent and tunnel agent isn't setup then use global agent 2245 | if (!agent) { 2246 | agent = usingSsl ? https.globalAgent : http.globalAgent; 2247 | } 2248 | if (usingSsl && this._ignoreSslError) { 2249 | // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process 2250 | // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options 2251 | // we have to cast it to any and change it directly 2252 | agent.options = Object.assign(agent.options || {}, { 2253 | rejectUnauthorized: false 2254 | }); 2255 | } 2256 | return agent; 2257 | } 2258 | _performExponentialBackoff(retryNumber) { 2259 | return __awaiter(this, void 0, void 0, function* () { 2260 | retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber); 2261 | const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber); 2262 | return new Promise(resolve => setTimeout(() => resolve(), ms)); 2263 | }); 2264 | } 2265 | _processResponse(res, options) { 2266 | return __awaiter(this, void 0, void 0, function* () { 2267 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { 2268 | const statusCode = res.message.statusCode || 0; 2269 | const response = { 2270 | statusCode, 2271 | result: null, 2272 | headers: {} 2273 | }; 2274 | // not found leads to null obj returned 2275 | if (statusCode === HttpCodes.NotFound) { 2276 | resolve(response); 2277 | } 2278 | // get the result from the body 2279 | function dateTimeDeserializer(key, value) { 2280 | if (typeof value === 'string') { 2281 | const a = new Date(value); 2282 | if (!isNaN(a.valueOf())) { 2283 | return a; 2284 | } 2285 | } 2286 | return value; 2287 | } 2288 | let obj; 2289 | let contents; 2290 | try { 2291 | contents = yield res.readBody(); 2292 | if (contents && contents.length > 0) { 2293 | if (options && options.deserializeDates) { 2294 | obj = JSON.parse(contents, dateTimeDeserializer); 2295 | } 2296 | else { 2297 | obj = JSON.parse(contents); 2298 | } 2299 | response.result = obj; 2300 | } 2301 | response.headers = res.message.headers; 2302 | } 2303 | catch (err) { 2304 | // Invalid resource (contents not json); leaving result obj null 2305 | } 2306 | // note that 3xx redirects are handled by the http layer. 2307 | if (statusCode > 299) { 2308 | let msg; 2309 | // if exception/error in body, attempt to get better error 2310 | if (obj && obj.message) { 2311 | msg = obj.message; 2312 | } 2313 | else if (contents && contents.length > 0) { 2314 | // it may be the case that the exception is in the body message as string 2315 | msg = contents; 2316 | } 2317 | else { 2318 | msg = `Failed request: (${statusCode})`; 2319 | } 2320 | const err = new HttpClientError(msg, statusCode); 2321 | err.result = response.result; 2322 | reject(err); 2323 | } 2324 | else { 2325 | resolve(response); 2326 | } 2327 | })); 2328 | }); 2329 | } 2330 | } 2331 | exports.HttpClient = HttpClient; 2332 | const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); 2333 | //# sourceMappingURL=index.js.map 2334 | 2335 | /***/ }), 2336 | 2337 | /***/ 835: 2338 | /***/ ((__unused_webpack_module, exports) => { 2339 | 2340 | "use strict"; 2341 | 2342 | Object.defineProperty(exports, "__esModule", ({ value: true })); 2343 | exports.checkBypass = exports.getProxyUrl = void 0; 2344 | function getProxyUrl(reqUrl) { 2345 | const usingSsl = reqUrl.protocol === 'https:'; 2346 | if (checkBypass(reqUrl)) { 2347 | return undefined; 2348 | } 2349 | const proxyVar = (() => { 2350 | if (usingSsl) { 2351 | return process.env['https_proxy'] || process.env['HTTPS_PROXY']; 2352 | } 2353 | else { 2354 | return process.env['http_proxy'] || process.env['HTTP_PROXY']; 2355 | } 2356 | })(); 2357 | if (proxyVar) { 2358 | return new URL(proxyVar); 2359 | } 2360 | else { 2361 | return undefined; 2362 | } 2363 | } 2364 | exports.getProxyUrl = getProxyUrl; 2365 | function checkBypass(reqUrl) { 2366 | if (!reqUrl.hostname) { 2367 | return false; 2368 | } 2369 | const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || ''; 2370 | if (!noProxy) { 2371 | return false; 2372 | } 2373 | // Determine the request port 2374 | let reqPort; 2375 | if (reqUrl.port) { 2376 | reqPort = Number(reqUrl.port); 2377 | } 2378 | else if (reqUrl.protocol === 'http:') { 2379 | reqPort = 80; 2380 | } 2381 | else if (reqUrl.protocol === 'https:') { 2382 | reqPort = 443; 2383 | } 2384 | // Format the request hostname and hostname with port 2385 | const upperReqHosts = [reqUrl.hostname.toUpperCase()]; 2386 | if (typeof reqPort === 'number') { 2387 | upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`); 2388 | } 2389 | // Compare request host against noproxy 2390 | for (const upperNoProxyItem of noProxy 2391 | .split(',') 2392 | .map(x => x.trim().toUpperCase()) 2393 | .filter(x => x)) { 2394 | if (upperReqHosts.some(x => x === upperNoProxyItem)) { 2395 | return true; 2396 | } 2397 | } 2398 | return false; 2399 | } 2400 | exports.checkBypass = checkBypass; 2401 | //# sourceMappingURL=proxy.js.map 2402 | 2403 | /***/ }), 2404 | 2405 | /***/ 962: 2406 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 2407 | 2408 | "use strict"; 2409 | 2410 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 2411 | if (k2 === undefined) k2 = k; 2412 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 2413 | }) : (function(o, m, k, k2) { 2414 | if (k2 === undefined) k2 = k; 2415 | o[k2] = m[k]; 2416 | })); 2417 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 2418 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 2419 | }) : function(o, v) { 2420 | o["default"] = v; 2421 | }); 2422 | var __importStar = (this && this.__importStar) || function (mod) { 2423 | if (mod && mod.__esModule) return mod; 2424 | var result = {}; 2425 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 2426 | __setModuleDefault(result, mod); 2427 | return result; 2428 | }; 2429 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 2430 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 2431 | return new (P || (P = Promise))(function (resolve, reject) { 2432 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 2433 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 2434 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 2435 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 2436 | }); 2437 | }; 2438 | var _a; 2439 | Object.defineProperty(exports, "__esModule", ({ value: true })); 2440 | exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rename = exports.readlink = exports.readdir = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0; 2441 | const fs = __importStar(__nccwpck_require__(147)); 2442 | const path = __importStar(__nccwpck_require__(17)); 2443 | _a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink; 2444 | exports.IS_WINDOWS = process.platform === 'win32'; 2445 | function exists(fsPath) { 2446 | return __awaiter(this, void 0, void 0, function* () { 2447 | try { 2448 | yield exports.stat(fsPath); 2449 | } 2450 | catch (err) { 2451 | if (err.code === 'ENOENT') { 2452 | return false; 2453 | } 2454 | throw err; 2455 | } 2456 | return true; 2457 | }); 2458 | } 2459 | exports.exists = exists; 2460 | function isDirectory(fsPath, useStat = false) { 2461 | return __awaiter(this, void 0, void 0, function* () { 2462 | const stats = useStat ? yield exports.stat(fsPath) : yield exports.lstat(fsPath); 2463 | return stats.isDirectory(); 2464 | }); 2465 | } 2466 | exports.isDirectory = isDirectory; 2467 | /** 2468 | * On OSX/Linux, true if path starts with '/'. On Windows, true for paths like: 2469 | * \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases). 2470 | */ 2471 | function isRooted(p) { 2472 | p = normalizeSeparators(p); 2473 | if (!p) { 2474 | throw new Error('isRooted() parameter "p" cannot be empty'); 2475 | } 2476 | if (exports.IS_WINDOWS) { 2477 | return (p.startsWith('\\') || /^[A-Z]:/i.test(p) // e.g. \ or \hello or \\hello 2478 | ); // e.g. C: or C:\hello 2479 | } 2480 | return p.startsWith('/'); 2481 | } 2482 | exports.isRooted = isRooted; 2483 | /** 2484 | * Best effort attempt to determine whether a file exists and is executable. 2485 | * @param filePath file path to check 2486 | * @param extensions additional file extensions to try 2487 | * @return if file exists and is executable, returns the file path. otherwise empty string. 2488 | */ 2489 | function tryGetExecutablePath(filePath, extensions) { 2490 | return __awaiter(this, void 0, void 0, function* () { 2491 | let stats = undefined; 2492 | try { 2493 | // test file exists 2494 | stats = yield exports.stat(filePath); 2495 | } 2496 | catch (err) { 2497 | if (err.code !== 'ENOENT') { 2498 | // eslint-disable-next-line no-console 2499 | console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`); 2500 | } 2501 | } 2502 | if (stats && stats.isFile()) { 2503 | if (exports.IS_WINDOWS) { 2504 | // on Windows, test for valid extension 2505 | const upperExt = path.extname(filePath).toUpperCase(); 2506 | if (extensions.some(validExt => validExt.toUpperCase() === upperExt)) { 2507 | return filePath; 2508 | } 2509 | } 2510 | else { 2511 | if (isUnixExecutable(stats)) { 2512 | return filePath; 2513 | } 2514 | } 2515 | } 2516 | // try each extension 2517 | const originalFilePath = filePath; 2518 | for (const extension of extensions) { 2519 | filePath = originalFilePath + extension; 2520 | stats = undefined; 2521 | try { 2522 | stats = yield exports.stat(filePath); 2523 | } 2524 | catch (err) { 2525 | if (err.code !== 'ENOENT') { 2526 | // eslint-disable-next-line no-console 2527 | console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`); 2528 | } 2529 | } 2530 | if (stats && stats.isFile()) { 2531 | if (exports.IS_WINDOWS) { 2532 | // preserve the case of the actual file (since an extension was appended) 2533 | try { 2534 | const directory = path.dirname(filePath); 2535 | const upperName = path.basename(filePath).toUpperCase(); 2536 | for (const actualName of yield exports.readdir(directory)) { 2537 | if (upperName === actualName.toUpperCase()) { 2538 | filePath = path.join(directory, actualName); 2539 | break; 2540 | } 2541 | } 2542 | } 2543 | catch (err) { 2544 | // eslint-disable-next-line no-console 2545 | console.log(`Unexpected error attempting to determine the actual case of the file '${filePath}': ${err}`); 2546 | } 2547 | return filePath; 2548 | } 2549 | else { 2550 | if (isUnixExecutable(stats)) { 2551 | return filePath; 2552 | } 2553 | } 2554 | } 2555 | } 2556 | return ''; 2557 | }); 2558 | } 2559 | exports.tryGetExecutablePath = tryGetExecutablePath; 2560 | function normalizeSeparators(p) { 2561 | p = p || ''; 2562 | if (exports.IS_WINDOWS) { 2563 | // convert slashes on Windows 2564 | p = p.replace(/\//g, '\\'); 2565 | // remove redundant slashes 2566 | return p.replace(/\\\\+/g, '\\'); 2567 | } 2568 | // remove redundant slashes 2569 | return p.replace(/\/\/+/g, '/'); 2570 | } 2571 | // on Mac/Linux, test the execute bit 2572 | // R W X R W X R W X 2573 | // 256 128 64 32 16 8 4 2 1 2574 | function isUnixExecutable(stats) { 2575 | return ((stats.mode & 1) > 0 || 2576 | ((stats.mode & 8) > 0 && stats.gid === process.getgid()) || 2577 | ((stats.mode & 64) > 0 && stats.uid === process.getuid())); 2578 | } 2579 | // Get the path of cmd.exe in windows 2580 | function getCmdPath() { 2581 | var _a; 2582 | return (_a = process.env['COMSPEC']) !== null && _a !== void 0 ? _a : `cmd.exe`; 2583 | } 2584 | exports.getCmdPath = getCmdPath; 2585 | //# sourceMappingURL=io-util.js.map 2586 | 2587 | /***/ }), 2588 | 2589 | /***/ 436: 2590 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 2591 | 2592 | "use strict"; 2593 | 2594 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 2595 | if (k2 === undefined) k2 = k; 2596 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 2597 | }) : (function(o, m, k, k2) { 2598 | if (k2 === undefined) k2 = k; 2599 | o[k2] = m[k]; 2600 | })); 2601 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 2602 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 2603 | }) : function(o, v) { 2604 | o["default"] = v; 2605 | }); 2606 | var __importStar = (this && this.__importStar) || function (mod) { 2607 | if (mod && mod.__esModule) return mod; 2608 | var result = {}; 2609 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 2610 | __setModuleDefault(result, mod); 2611 | return result; 2612 | }; 2613 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 2614 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 2615 | return new (P || (P = Promise))(function (resolve, reject) { 2616 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 2617 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 2618 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 2619 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 2620 | }); 2621 | }; 2622 | Object.defineProperty(exports, "__esModule", ({ value: true })); 2623 | exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0; 2624 | const assert_1 = __nccwpck_require__(491); 2625 | const childProcess = __importStar(__nccwpck_require__(81)); 2626 | const path = __importStar(__nccwpck_require__(17)); 2627 | const util_1 = __nccwpck_require__(837); 2628 | const ioUtil = __importStar(__nccwpck_require__(962)); 2629 | const exec = util_1.promisify(childProcess.exec); 2630 | const execFile = util_1.promisify(childProcess.execFile); 2631 | /** 2632 | * Copies a file or folder. 2633 | * Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js 2634 | * 2635 | * @param source source path 2636 | * @param dest destination path 2637 | * @param options optional. See CopyOptions. 2638 | */ 2639 | function cp(source, dest, options = {}) { 2640 | return __awaiter(this, void 0, void 0, function* () { 2641 | const { force, recursive, copySourceDirectory } = readCopyOptions(options); 2642 | const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null; 2643 | // Dest is an existing file, but not forcing 2644 | if (destStat && destStat.isFile() && !force) { 2645 | return; 2646 | } 2647 | // If dest is an existing directory, should copy inside. 2648 | const newDest = destStat && destStat.isDirectory() && copySourceDirectory 2649 | ? path.join(dest, path.basename(source)) 2650 | : dest; 2651 | if (!(yield ioUtil.exists(source))) { 2652 | throw new Error(`no such file or directory: ${source}`); 2653 | } 2654 | const sourceStat = yield ioUtil.stat(source); 2655 | if (sourceStat.isDirectory()) { 2656 | if (!recursive) { 2657 | throw new Error(`Failed to copy. ${source} is a directory, but tried to copy without recursive flag.`); 2658 | } 2659 | else { 2660 | yield cpDirRecursive(source, newDest, 0, force); 2661 | } 2662 | } 2663 | else { 2664 | if (path.relative(source, newDest) === '') { 2665 | // a file cannot be copied to itself 2666 | throw new Error(`'${newDest}' and '${source}' are the same file`); 2667 | } 2668 | yield copyFile(source, newDest, force); 2669 | } 2670 | }); 2671 | } 2672 | exports.cp = cp; 2673 | /** 2674 | * Moves a path. 2675 | * 2676 | * @param source source path 2677 | * @param dest destination path 2678 | * @param options optional. See MoveOptions. 2679 | */ 2680 | function mv(source, dest, options = {}) { 2681 | return __awaiter(this, void 0, void 0, function* () { 2682 | if (yield ioUtil.exists(dest)) { 2683 | let destExists = true; 2684 | if (yield ioUtil.isDirectory(dest)) { 2685 | // If dest is directory copy src into dest 2686 | dest = path.join(dest, path.basename(source)); 2687 | destExists = yield ioUtil.exists(dest); 2688 | } 2689 | if (destExists) { 2690 | if (options.force == null || options.force) { 2691 | yield rmRF(dest); 2692 | } 2693 | else { 2694 | throw new Error('Destination already exists'); 2695 | } 2696 | } 2697 | } 2698 | yield mkdirP(path.dirname(dest)); 2699 | yield ioUtil.rename(source, dest); 2700 | }); 2701 | } 2702 | exports.mv = mv; 2703 | /** 2704 | * Remove a path recursively with force 2705 | * 2706 | * @param inputPath path to remove 2707 | */ 2708 | function rmRF(inputPath) { 2709 | return __awaiter(this, void 0, void 0, function* () { 2710 | if (ioUtil.IS_WINDOWS) { 2711 | // Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another 2712 | // program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del. 2713 | // Check for invalid characters 2714 | // https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file 2715 | if (/[*"<>|]/.test(inputPath)) { 2716 | throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows'); 2717 | } 2718 | try { 2719 | const cmdPath = ioUtil.getCmdPath(); 2720 | if (yield ioUtil.isDirectory(inputPath, true)) { 2721 | yield exec(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, { 2722 | env: { inputPath } 2723 | }); 2724 | } 2725 | else { 2726 | yield exec(`${cmdPath} /s /c "del /f /a "%inputPath%""`, { 2727 | env: { inputPath } 2728 | }); 2729 | } 2730 | } 2731 | catch (err) { 2732 | // if you try to delete a file that doesn't exist, desired result is achieved 2733 | // other errors are valid 2734 | if (err.code !== 'ENOENT') 2735 | throw err; 2736 | } 2737 | // Shelling out fails to remove a symlink folder with missing source, this unlink catches that 2738 | try { 2739 | yield ioUtil.unlink(inputPath); 2740 | } 2741 | catch (err) { 2742 | // if you try to delete a file that doesn't exist, desired result is achieved 2743 | // other errors are valid 2744 | if (err.code !== 'ENOENT') 2745 | throw err; 2746 | } 2747 | } 2748 | else { 2749 | let isDir = false; 2750 | try { 2751 | isDir = yield ioUtil.isDirectory(inputPath); 2752 | } 2753 | catch (err) { 2754 | // if you try to delete a file that doesn't exist, desired result is achieved 2755 | // other errors are valid 2756 | if (err.code !== 'ENOENT') 2757 | throw err; 2758 | return; 2759 | } 2760 | if (isDir) { 2761 | yield execFile(`rm`, [`-rf`, `${inputPath}`]); 2762 | } 2763 | else { 2764 | yield ioUtil.unlink(inputPath); 2765 | } 2766 | } 2767 | }); 2768 | } 2769 | exports.rmRF = rmRF; 2770 | /** 2771 | * Make a directory. Creates the full path with folders in between 2772 | * Will throw if it fails 2773 | * 2774 | * @param fsPath path to create 2775 | * @returns Promise 2776 | */ 2777 | function mkdirP(fsPath) { 2778 | return __awaiter(this, void 0, void 0, function* () { 2779 | assert_1.ok(fsPath, 'a path argument must be provided'); 2780 | yield ioUtil.mkdir(fsPath, { recursive: true }); 2781 | }); 2782 | } 2783 | exports.mkdirP = mkdirP; 2784 | /** 2785 | * Returns path of a tool had the tool actually been invoked. Resolves via paths. 2786 | * If you check and the tool does not exist, it will throw. 2787 | * 2788 | * @param tool name of the tool 2789 | * @param check whether to check if tool exists 2790 | * @returns Promise path to tool 2791 | */ 2792 | function which(tool, check) { 2793 | return __awaiter(this, void 0, void 0, function* () { 2794 | if (!tool) { 2795 | throw new Error("parameter 'tool' is required"); 2796 | } 2797 | // recursive when check=true 2798 | if (check) { 2799 | const result = yield which(tool, false); 2800 | if (!result) { 2801 | if (ioUtil.IS_WINDOWS) { 2802 | throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`); 2803 | } 2804 | else { 2805 | throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`); 2806 | } 2807 | } 2808 | return result; 2809 | } 2810 | const matches = yield findInPath(tool); 2811 | if (matches && matches.length > 0) { 2812 | return matches[0]; 2813 | } 2814 | return ''; 2815 | }); 2816 | } 2817 | exports.which = which; 2818 | /** 2819 | * Returns a list of all occurrences of the given tool on the system path. 2820 | * 2821 | * @returns Promise the paths of the tool 2822 | */ 2823 | function findInPath(tool) { 2824 | return __awaiter(this, void 0, void 0, function* () { 2825 | if (!tool) { 2826 | throw new Error("parameter 'tool' is required"); 2827 | } 2828 | // build the list of extensions to try 2829 | const extensions = []; 2830 | if (ioUtil.IS_WINDOWS && process.env['PATHEXT']) { 2831 | for (const extension of process.env['PATHEXT'].split(path.delimiter)) { 2832 | if (extension) { 2833 | extensions.push(extension); 2834 | } 2835 | } 2836 | } 2837 | // if it's rooted, return it if exists. otherwise return empty. 2838 | if (ioUtil.isRooted(tool)) { 2839 | const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions); 2840 | if (filePath) { 2841 | return [filePath]; 2842 | } 2843 | return []; 2844 | } 2845 | // if any path separators, return empty 2846 | if (tool.includes(path.sep)) { 2847 | return []; 2848 | } 2849 | // build the list of directories 2850 | // 2851 | // Note, technically "where" checks the current directory on Windows. From a toolkit perspective, 2852 | // it feels like we should not do this. Checking the current directory seems like more of a use 2853 | // case of a shell, and the which() function exposed by the toolkit should strive for consistency 2854 | // across platforms. 2855 | const directories = []; 2856 | if (process.env.PATH) { 2857 | for (const p of process.env.PATH.split(path.delimiter)) { 2858 | if (p) { 2859 | directories.push(p); 2860 | } 2861 | } 2862 | } 2863 | // find all matches 2864 | const matches = []; 2865 | for (const directory of directories) { 2866 | const filePath = yield ioUtil.tryGetExecutablePath(path.join(directory, tool), extensions); 2867 | if (filePath) { 2868 | matches.push(filePath); 2869 | } 2870 | } 2871 | return matches; 2872 | }); 2873 | } 2874 | exports.findInPath = findInPath; 2875 | function readCopyOptions(options) { 2876 | const force = options.force == null ? true : options.force; 2877 | const recursive = Boolean(options.recursive); 2878 | const copySourceDirectory = options.copySourceDirectory == null 2879 | ? true 2880 | : Boolean(options.copySourceDirectory); 2881 | return { force, recursive, copySourceDirectory }; 2882 | } 2883 | function cpDirRecursive(sourceDir, destDir, currentDepth, force) { 2884 | return __awaiter(this, void 0, void 0, function* () { 2885 | // Ensure there is not a run away recursive copy 2886 | if (currentDepth >= 255) 2887 | return; 2888 | currentDepth++; 2889 | yield mkdirP(destDir); 2890 | const files = yield ioUtil.readdir(sourceDir); 2891 | for (const fileName of files) { 2892 | const srcFile = `${sourceDir}/${fileName}`; 2893 | const destFile = `${destDir}/${fileName}`; 2894 | const srcFileStat = yield ioUtil.lstat(srcFile); 2895 | if (srcFileStat.isDirectory()) { 2896 | // Recurse 2897 | yield cpDirRecursive(srcFile, destFile, currentDepth, force); 2898 | } 2899 | else { 2900 | yield copyFile(srcFile, destFile, force); 2901 | } 2902 | } 2903 | // Change the mode for the newly created directory 2904 | yield ioUtil.chmod(destDir, (yield ioUtil.stat(sourceDir)).mode); 2905 | }); 2906 | } 2907 | // Buffered file copy 2908 | function copyFile(srcFile, destFile, force) { 2909 | return __awaiter(this, void 0, void 0, function* () { 2910 | if ((yield ioUtil.lstat(srcFile)).isSymbolicLink()) { 2911 | // unlink/re-link it 2912 | try { 2913 | yield ioUtil.lstat(destFile); 2914 | yield ioUtil.unlink(destFile); 2915 | } 2916 | catch (e) { 2917 | // Try to override file permission 2918 | if (e.code === 'EPERM') { 2919 | yield ioUtil.chmod(destFile, '0666'); 2920 | yield ioUtil.unlink(destFile); 2921 | } 2922 | // other errors = it doesn't exist, no work to do 2923 | } 2924 | // Copy over symlink 2925 | const symlinkFull = yield ioUtil.readlink(srcFile); 2926 | yield ioUtil.symlink(symlinkFull, destFile, ioUtil.IS_WINDOWS ? 'junction' : null); 2927 | } 2928 | else if (!(yield ioUtil.exists(destFile)) || force) { 2929 | yield ioUtil.copyFile(srcFile, destFile); 2930 | } 2931 | }); 2932 | } 2933 | //# sourceMappingURL=io.js.map 2934 | 2935 | /***/ }), 2936 | 2937 | /***/ 294: 2938 | /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { 2939 | 2940 | module.exports = __nccwpck_require__(219); 2941 | 2942 | 2943 | /***/ }), 2944 | 2945 | /***/ 219: 2946 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 2947 | 2948 | "use strict"; 2949 | 2950 | 2951 | var net = __nccwpck_require__(808); 2952 | var tls = __nccwpck_require__(404); 2953 | var http = __nccwpck_require__(685); 2954 | var https = __nccwpck_require__(687); 2955 | var events = __nccwpck_require__(361); 2956 | var assert = __nccwpck_require__(491); 2957 | var util = __nccwpck_require__(837); 2958 | 2959 | 2960 | exports.httpOverHttp = httpOverHttp; 2961 | exports.httpsOverHttp = httpsOverHttp; 2962 | exports.httpOverHttps = httpOverHttps; 2963 | exports.httpsOverHttps = httpsOverHttps; 2964 | 2965 | 2966 | function httpOverHttp(options) { 2967 | var agent = new TunnelingAgent(options); 2968 | agent.request = http.request; 2969 | return agent; 2970 | } 2971 | 2972 | function httpsOverHttp(options) { 2973 | var agent = new TunnelingAgent(options); 2974 | agent.request = http.request; 2975 | agent.createSocket = createSecureSocket; 2976 | agent.defaultPort = 443; 2977 | return agent; 2978 | } 2979 | 2980 | function httpOverHttps(options) { 2981 | var agent = new TunnelingAgent(options); 2982 | agent.request = https.request; 2983 | return agent; 2984 | } 2985 | 2986 | function httpsOverHttps(options) { 2987 | var agent = new TunnelingAgent(options); 2988 | agent.request = https.request; 2989 | agent.createSocket = createSecureSocket; 2990 | agent.defaultPort = 443; 2991 | return agent; 2992 | } 2993 | 2994 | 2995 | function TunnelingAgent(options) { 2996 | var self = this; 2997 | self.options = options || {}; 2998 | self.proxyOptions = self.options.proxy || {}; 2999 | self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; 3000 | self.requests = []; 3001 | self.sockets = []; 3002 | 3003 | self.on('free', function onFree(socket, host, port, localAddress) { 3004 | var options = toOptions(host, port, localAddress); 3005 | for (var i = 0, len = self.requests.length; i < len; ++i) { 3006 | var pending = self.requests[i]; 3007 | if (pending.host === options.host && pending.port === options.port) { 3008 | // Detect the request to connect same origin server, 3009 | // reuse the connection. 3010 | self.requests.splice(i, 1); 3011 | pending.request.onSocket(socket); 3012 | return; 3013 | } 3014 | } 3015 | socket.destroy(); 3016 | self.removeSocket(socket); 3017 | }); 3018 | } 3019 | util.inherits(TunnelingAgent, events.EventEmitter); 3020 | 3021 | TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) { 3022 | var self = this; 3023 | var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress)); 3024 | 3025 | if (self.sockets.length >= this.maxSockets) { 3026 | // We are over limit so we'll add it to the queue. 3027 | self.requests.push(options); 3028 | return; 3029 | } 3030 | 3031 | // If we are under maxSockets create a new one. 3032 | self.createSocket(options, function(socket) { 3033 | socket.on('free', onFree); 3034 | socket.on('close', onCloseOrRemove); 3035 | socket.on('agentRemove', onCloseOrRemove); 3036 | req.onSocket(socket); 3037 | 3038 | function onFree() { 3039 | self.emit('free', socket, options); 3040 | } 3041 | 3042 | function onCloseOrRemove(err) { 3043 | self.removeSocket(socket); 3044 | socket.removeListener('free', onFree); 3045 | socket.removeListener('close', onCloseOrRemove); 3046 | socket.removeListener('agentRemove', onCloseOrRemove); 3047 | } 3048 | }); 3049 | }; 3050 | 3051 | TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { 3052 | var self = this; 3053 | var placeholder = {}; 3054 | self.sockets.push(placeholder); 3055 | 3056 | var connectOptions = mergeOptions({}, self.proxyOptions, { 3057 | method: 'CONNECT', 3058 | path: options.host + ':' + options.port, 3059 | agent: false, 3060 | headers: { 3061 | host: options.host + ':' + options.port 3062 | } 3063 | }); 3064 | if (options.localAddress) { 3065 | connectOptions.localAddress = options.localAddress; 3066 | } 3067 | if (connectOptions.proxyAuth) { 3068 | connectOptions.headers = connectOptions.headers || {}; 3069 | connectOptions.headers['Proxy-Authorization'] = 'Basic ' + 3070 | new Buffer(connectOptions.proxyAuth).toString('base64'); 3071 | } 3072 | 3073 | debug('making CONNECT request'); 3074 | var connectReq = self.request(connectOptions); 3075 | connectReq.useChunkedEncodingByDefault = false; // for v0.6 3076 | connectReq.once('response', onResponse); // for v0.6 3077 | connectReq.once('upgrade', onUpgrade); // for v0.6 3078 | connectReq.once('connect', onConnect); // for v0.7 or later 3079 | connectReq.once('error', onError); 3080 | connectReq.end(); 3081 | 3082 | function onResponse(res) { 3083 | // Very hacky. This is necessary to avoid http-parser leaks. 3084 | res.upgrade = true; 3085 | } 3086 | 3087 | function onUpgrade(res, socket, head) { 3088 | // Hacky. 3089 | process.nextTick(function() { 3090 | onConnect(res, socket, head); 3091 | }); 3092 | } 3093 | 3094 | function onConnect(res, socket, head) { 3095 | connectReq.removeAllListeners(); 3096 | socket.removeAllListeners(); 3097 | 3098 | if (res.statusCode !== 200) { 3099 | debug('tunneling socket could not be established, statusCode=%d', 3100 | res.statusCode); 3101 | socket.destroy(); 3102 | var error = new Error('tunneling socket could not be established, ' + 3103 | 'statusCode=' + res.statusCode); 3104 | error.code = 'ECONNRESET'; 3105 | options.request.emit('error', error); 3106 | self.removeSocket(placeholder); 3107 | return; 3108 | } 3109 | if (head.length > 0) { 3110 | debug('got illegal response body from proxy'); 3111 | socket.destroy(); 3112 | var error = new Error('got illegal response body from proxy'); 3113 | error.code = 'ECONNRESET'; 3114 | options.request.emit('error', error); 3115 | self.removeSocket(placeholder); 3116 | return; 3117 | } 3118 | debug('tunneling connection has established'); 3119 | self.sockets[self.sockets.indexOf(placeholder)] = socket; 3120 | return cb(socket); 3121 | } 3122 | 3123 | function onError(cause) { 3124 | connectReq.removeAllListeners(); 3125 | 3126 | debug('tunneling socket could not be established, cause=%s\n', 3127 | cause.message, cause.stack); 3128 | var error = new Error('tunneling socket could not be established, ' + 3129 | 'cause=' + cause.message); 3130 | error.code = 'ECONNRESET'; 3131 | options.request.emit('error', error); 3132 | self.removeSocket(placeholder); 3133 | } 3134 | }; 3135 | 3136 | TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { 3137 | var pos = this.sockets.indexOf(socket) 3138 | if (pos === -1) { 3139 | return; 3140 | } 3141 | this.sockets.splice(pos, 1); 3142 | 3143 | var pending = this.requests.shift(); 3144 | if (pending) { 3145 | // If we have pending requests and a socket gets closed a new one 3146 | // needs to be created to take over in the pool for the one that closed. 3147 | this.createSocket(pending, function(socket) { 3148 | pending.request.onSocket(socket); 3149 | }); 3150 | } 3151 | }; 3152 | 3153 | function createSecureSocket(options, cb) { 3154 | var self = this; 3155 | TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { 3156 | var hostHeader = options.request.getHeader('host'); 3157 | var tlsOptions = mergeOptions({}, self.options, { 3158 | socket: socket, 3159 | servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host 3160 | }); 3161 | 3162 | // 0 is dummy port for v0.6 3163 | var secureSocket = tls.connect(0, tlsOptions); 3164 | self.sockets[self.sockets.indexOf(socket)] = secureSocket; 3165 | cb(secureSocket); 3166 | }); 3167 | } 3168 | 3169 | 3170 | function toOptions(host, port, localAddress) { 3171 | if (typeof host === 'string') { // since v0.10 3172 | return { 3173 | host: host, 3174 | port: port, 3175 | localAddress: localAddress 3176 | }; 3177 | } 3178 | return host; // for v0.11 or later 3179 | } 3180 | 3181 | function mergeOptions(target) { 3182 | for (var i = 1, len = arguments.length; i < len; ++i) { 3183 | var overrides = arguments[i]; 3184 | if (typeof overrides === 'object') { 3185 | var keys = Object.keys(overrides); 3186 | for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { 3187 | var k = keys[j]; 3188 | if (overrides[k] !== undefined) { 3189 | target[k] = overrides[k]; 3190 | } 3191 | } 3192 | } 3193 | } 3194 | return target; 3195 | } 3196 | 3197 | 3198 | var debug; 3199 | if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { 3200 | debug = function() { 3201 | var args = Array.prototype.slice.call(arguments); 3202 | if (typeof args[0] === 'string') { 3203 | args[0] = 'TUNNEL: ' + args[0]; 3204 | } else { 3205 | args.unshift('TUNNEL:'); 3206 | } 3207 | console.error.apply(console, args); 3208 | } 3209 | } else { 3210 | debug = function() {}; 3211 | } 3212 | exports.debug = debug; // for test 3213 | 3214 | 3215 | /***/ }), 3216 | 3217 | /***/ 399: 3218 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 3219 | 3220 | "use strict"; 3221 | 3222 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 3223 | if (k2 === undefined) k2 = k; 3224 | var desc = Object.getOwnPropertyDescriptor(m, k); 3225 | if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { 3226 | desc = { enumerable: true, get: function() { return m[k]; } }; 3227 | } 3228 | Object.defineProperty(o, k2, desc); 3229 | }) : (function(o, m, k, k2) { 3230 | if (k2 === undefined) k2 = k; 3231 | o[k2] = m[k]; 3232 | })); 3233 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 3234 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 3235 | }) : function(o, v) { 3236 | o["default"] = v; 3237 | }); 3238 | var __importStar = (this && this.__importStar) || function (mod) { 3239 | if (mod && mod.__esModule) return mod; 3240 | var result = {}; 3241 | if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 3242 | __setModuleDefault(result, mod); 3243 | return result; 3244 | }; 3245 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 3246 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 3247 | return new (P || (P = Promise))(function (resolve, reject) { 3248 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 3249 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 3250 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 3251 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 3252 | }); 3253 | }; 3254 | var __importDefault = (this && this.__importDefault) || function (mod) { 3255 | return (mod && mod.__esModule) ? mod : { "default": mod }; 3256 | }; 3257 | Object.defineProperty(exports, "__esModule", ({ value: true })); 3258 | const core = __importStar(__nccwpck_require__(186)); 3259 | const exec = __importStar(__nccwpck_require__(514)); 3260 | const io = __importStar(__nccwpck_require__(436)); 3261 | const os = __importStar(__nccwpck_require__(37)); 3262 | const fs_1 = __importDefault(__nccwpck_require__(147)); 3263 | const https = __nccwpck_require__(687); 3264 | function getPlatform() { 3265 | switch (process.platform) { 3266 | case 'linux': return 'linux'; 3267 | case 'darwin': return 'macos'; 3268 | case 'win32': return 'win'; 3269 | } 3270 | return 'linux'; /* Default: linux */ 3271 | } 3272 | function getExt() { 3273 | switch (process.platform) { 3274 | case 'linux': 3275 | case 'darwin': return 'tar.gz'; 3276 | case 'win32': return 'zip'; 3277 | } 3278 | return 'tar.gz'; /* Default: linux */ 3279 | } 3280 | function run() { 3281 | return __awaiter(this, void 0, void 0, function* () { 3282 | try { 3283 | const PATH = process.env.PATH; 3284 | const home = os.homedir(); 3285 | const tmp = os.tmpdir(); 3286 | const version = core.getInput("version"); 3287 | const architecture = core.getInput("architecture"); 3288 | const platform = getPlatform(); 3289 | const ext = getExt(); 3290 | const archiveSuffix = `${platform}-${architecture}.${ext}`; // win-x64.zip 3291 | const archiveName = `eask_${version}_${archiveSuffix}`; // eask_0.7.10_win-x64.zip 3292 | core.startGroup("Fetch Eask"); 3293 | { 3294 | let downloadUrl = `https://github.com/emacs-eask/cli/releases/download/${version}/${archiveName}`; 3295 | if (version == 'snapshot') { 3296 | downloadUrl = `https://github.com/emacs-eask/binaries/raw/master/${archiveSuffix}`; 3297 | } 3298 | yield exec.exec('curl', [ 3299 | '-L', 3300 | downloadUrl, 3301 | '-o', 3302 | `${tmp}/${archiveName}` 3303 | ]); 3304 | fs_1.default.mkdirSync(`${tmp}/eask-${version}`); 3305 | /* Extraction */ 3306 | { 3307 | if (platform === 'win') 3308 | yield exec.exec('unzip', [`${tmp}/${archiveName}`, '-d', `${tmp}/eask-${version}`]); 3309 | else 3310 | yield exec.exec('tar', ['-xvzf', `${tmp}/${archiveName}`, '-C', `${tmp}/eask-${version}`]); 3311 | } 3312 | const options = { recursive: true, force: false }; 3313 | yield io.mv(`${tmp}/eask-${version}`, `${home}/eask-${version}`, options); 3314 | core.addPath(`${home}/eask-${version}`); 3315 | } 3316 | core.endGroup(); 3317 | // show Eask version 3318 | yield exec.exec('eask', ['--version']); 3319 | } 3320 | catch (error) { 3321 | let errorMsg = "Failed to do something exceptional"; 3322 | if (error instanceof Error) { 3323 | errorMsg = error.message; 3324 | } 3325 | core.setFailed(errorMsg); 3326 | } 3327 | }); 3328 | } 3329 | run(); 3330 | 3331 | 3332 | /***/ }), 3333 | 3334 | /***/ 491: 3335 | /***/ ((module) => { 3336 | 3337 | "use strict"; 3338 | module.exports = require("assert"); 3339 | 3340 | /***/ }), 3341 | 3342 | /***/ 81: 3343 | /***/ ((module) => { 3344 | 3345 | "use strict"; 3346 | module.exports = require("child_process"); 3347 | 3348 | /***/ }), 3349 | 3350 | /***/ 361: 3351 | /***/ ((module) => { 3352 | 3353 | "use strict"; 3354 | module.exports = require("events"); 3355 | 3356 | /***/ }), 3357 | 3358 | /***/ 147: 3359 | /***/ ((module) => { 3360 | 3361 | "use strict"; 3362 | module.exports = require("fs"); 3363 | 3364 | /***/ }), 3365 | 3366 | /***/ 685: 3367 | /***/ ((module) => { 3368 | 3369 | "use strict"; 3370 | module.exports = require("http"); 3371 | 3372 | /***/ }), 3373 | 3374 | /***/ 687: 3375 | /***/ ((module) => { 3376 | 3377 | "use strict"; 3378 | module.exports = require("https"); 3379 | 3380 | /***/ }), 3381 | 3382 | /***/ 808: 3383 | /***/ ((module) => { 3384 | 3385 | "use strict"; 3386 | module.exports = require("net"); 3387 | 3388 | /***/ }), 3389 | 3390 | /***/ 37: 3391 | /***/ ((module) => { 3392 | 3393 | "use strict"; 3394 | module.exports = require("os"); 3395 | 3396 | /***/ }), 3397 | 3398 | /***/ 17: 3399 | /***/ ((module) => { 3400 | 3401 | "use strict"; 3402 | module.exports = require("path"); 3403 | 3404 | /***/ }), 3405 | 3406 | /***/ 576: 3407 | /***/ ((module) => { 3408 | 3409 | "use strict"; 3410 | module.exports = require("string_decoder"); 3411 | 3412 | /***/ }), 3413 | 3414 | /***/ 512: 3415 | /***/ ((module) => { 3416 | 3417 | "use strict"; 3418 | module.exports = require("timers"); 3419 | 3420 | /***/ }), 3421 | 3422 | /***/ 404: 3423 | /***/ ((module) => { 3424 | 3425 | "use strict"; 3426 | module.exports = require("tls"); 3427 | 3428 | /***/ }), 3429 | 3430 | /***/ 837: 3431 | /***/ ((module) => { 3432 | 3433 | "use strict"; 3434 | module.exports = require("util"); 3435 | 3436 | /***/ }) 3437 | 3438 | /******/ }); 3439 | /************************************************************************/ 3440 | /******/ // The module cache 3441 | /******/ var __webpack_module_cache__ = {}; 3442 | /******/ 3443 | /******/ // The require function 3444 | /******/ function __nccwpck_require__(moduleId) { 3445 | /******/ // Check if module is in cache 3446 | /******/ var cachedModule = __webpack_module_cache__[moduleId]; 3447 | /******/ if (cachedModule !== undefined) { 3448 | /******/ return cachedModule.exports; 3449 | /******/ } 3450 | /******/ // Create a new module (and put it into the cache) 3451 | /******/ var module = __webpack_module_cache__[moduleId] = { 3452 | /******/ // no module.id needed 3453 | /******/ // no module.loaded needed 3454 | /******/ exports: {} 3455 | /******/ }; 3456 | /******/ 3457 | /******/ // Execute the module function 3458 | /******/ var threw = true; 3459 | /******/ try { 3460 | /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nccwpck_require__); 3461 | /******/ threw = false; 3462 | /******/ } finally { 3463 | /******/ if(threw) delete __webpack_module_cache__[moduleId]; 3464 | /******/ } 3465 | /******/ 3466 | /******/ // Return the exports of the module 3467 | /******/ return module.exports; 3468 | /******/ } 3469 | /******/ 3470 | /************************************************************************/ 3471 | /******/ /* webpack/runtime/compat */ 3472 | /******/ 3473 | /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; 3474 | /******/ 3475 | /************************************************************************/ 3476 | /******/ 3477 | /******/ // startup 3478 | /******/ // Load entry module and return exports 3479 | /******/ // This entry module is referenced by other modules so it can't be inlined 3480 | /******/ var __webpack_exports__ = __nccwpck_require__(399); 3481 | /******/ module.exports = __webpack_exports__; 3482 | /******/ 3483 | /******/ })() 3484 | ; -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "typescript-action", 3 | "version": "0.0.0", 4 | "lockfileVersion": 2, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "typescript-action", 9 | "version": "0.0.0", 10 | "license": "MIT", 11 | "dependencies": { 12 | "@actions/core": "^1.8.1", 13 | "@actions/exec": "^1.1.1", 14 | "@actions/io": "^1.1.2", 15 | "@actions/tool-cache": "^1.7.2" 16 | }, 17 | "devDependencies": { 18 | "@types/node": "^17.0.33", 19 | "@vercel/ncc": "^0.33.4", 20 | "typescript": "^4.6.4" 21 | } 22 | }, 23 | "node_modules/@actions/core": { 24 | "version": "1.8.1", 25 | "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.8.1.tgz", 26 | "integrity": "sha512-LuFg2O/+rRrYxrdafnqH9mx6ADszKzQAhDuEhhMQIh47tsXzWkW4wXY5zvscqJ4KDywyJX0LA0pAESPLUjZXvw==", 27 | "dependencies": { 28 | "@actions/http-client": "^2.0.0" 29 | } 30 | }, 31 | "node_modules/@actions/exec": { 32 | "version": "1.1.1", 33 | "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.1.tgz", 34 | "integrity": "sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==", 35 | "dependencies": { 36 | "@actions/io": "^1.0.1" 37 | } 38 | }, 39 | "node_modules/@actions/http-client": { 40 | "version": "2.0.0", 41 | "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.0.tgz", 42 | "integrity": "sha512-fm1+OPPey5ypgStT9K8zbBhICj4J4UV/TJIHDhuWlkb8KyJaAtjcZK184dTqul0dV0nPKX97FNtDXX20BTLXSA==" 43 | }, 44 | "node_modules/@actions/io": { 45 | "version": "1.1.2", 46 | "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.2.tgz", 47 | "integrity": "sha512-d+RwPlMp+2qmBfeLYPLXuSRykDIFEwdTA0MMxzS9kh4kvP1ftrc/9fzy6pX6qAjthdXruHQ6/6kjT/DNo5ALuw==" 48 | }, 49 | "node_modules/@actions/tool-cache": { 50 | "version": "1.7.2", 51 | "resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.7.2.tgz", 52 | "integrity": "sha512-GYlcgg/PK2RWBrGG2sFg6s7im3S94LMKuqAv8UPDq/pGTZbuEvmN4a95Fn1Z19OE+vt7UbUHeewOD5tEBT+4TQ==", 53 | "dependencies": { 54 | "@actions/core": "^1.2.6", 55 | "@actions/exec": "^1.0.0", 56 | "@actions/http-client": "^1.0.8", 57 | "@actions/io": "^1.1.1", 58 | "semver": "^6.1.0", 59 | "uuid": "^3.3.2" 60 | } 61 | }, 62 | "node_modules/@actions/tool-cache/node_modules/@actions/http-client": { 63 | "version": "1.0.11", 64 | "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz", 65 | "integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==", 66 | "dependencies": { 67 | "tunnel": "0.0.6" 68 | } 69 | }, 70 | "node_modules/@types/node": { 71 | "version": "17.0.33", 72 | "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.33.tgz", 73 | "integrity": "sha512-miWq2m2FiQZmaHfdZNcbpp9PuXg34W5JZ5CrJ/BaS70VuhoJENBEQybeiYSaPBRNq6KQGnjfEnc/F3PN++D+XQ==", 74 | "dev": true 75 | }, 76 | "node_modules/@vercel/ncc": { 77 | "version": "0.33.4", 78 | "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.33.4.tgz", 79 | "integrity": "sha512-ln18hs7dMffelP47tpkaR+V5Tj6coykNyxJrlcmCormPqRQjB/Gv4cu2FfBG+PMzIfdZp2CLDsrrB1NPU22Qhg==", 80 | "dev": true, 81 | "bin": { 82 | "ncc": "dist/ncc/cli.js" 83 | } 84 | }, 85 | "node_modules/semver": { 86 | "version": "6.3.0", 87 | "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", 88 | "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", 89 | "bin": { 90 | "semver": "bin/semver.js" 91 | } 92 | }, 93 | "node_modules/tunnel": { 94 | "version": "0.0.6", 95 | "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", 96 | "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", 97 | "engines": { 98 | "node": ">=0.6.11 <=0.7.0 || >=0.7.3" 99 | } 100 | }, 101 | "node_modules/typescript": { 102 | "version": "4.6.4", 103 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz", 104 | "integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==", 105 | "dev": true, 106 | "bin": { 107 | "tsc": "bin/tsc", 108 | "tsserver": "bin/tsserver" 109 | }, 110 | "engines": { 111 | "node": ">=4.2.0" 112 | } 113 | }, 114 | "node_modules/uuid": { 115 | "version": "3.4.0", 116 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", 117 | "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", 118 | "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", 119 | "bin": { 120 | "uuid": "bin/uuid" 121 | } 122 | } 123 | }, 124 | "dependencies": { 125 | "@actions/core": { 126 | "version": "1.8.1", 127 | "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.8.1.tgz", 128 | "integrity": "sha512-LuFg2O/+rRrYxrdafnqH9mx6ADszKzQAhDuEhhMQIh47tsXzWkW4wXY5zvscqJ4KDywyJX0LA0pAESPLUjZXvw==", 129 | "requires": { 130 | "@actions/http-client": "^2.0.0" 131 | } 132 | }, 133 | "@actions/exec": { 134 | "version": "1.1.1", 135 | "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.1.tgz", 136 | "integrity": "sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==", 137 | "requires": { 138 | "@actions/io": "^1.0.1" 139 | } 140 | }, 141 | "@actions/http-client": { 142 | "version": "2.0.0", 143 | "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.0.tgz", 144 | "integrity": "sha512-fm1+OPPey5ypgStT9K8zbBhICj4J4UV/TJIHDhuWlkb8KyJaAtjcZK184dTqul0dV0nPKX97FNtDXX20BTLXSA==" 145 | }, 146 | "@actions/io": { 147 | "version": "1.1.2", 148 | "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.2.tgz", 149 | "integrity": "sha512-d+RwPlMp+2qmBfeLYPLXuSRykDIFEwdTA0MMxzS9kh4kvP1ftrc/9fzy6pX6qAjthdXruHQ6/6kjT/DNo5ALuw==" 150 | }, 151 | "@actions/tool-cache": { 152 | "version": "1.7.2", 153 | "resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.7.2.tgz", 154 | "integrity": "sha512-GYlcgg/PK2RWBrGG2sFg6s7im3S94LMKuqAv8UPDq/pGTZbuEvmN4a95Fn1Z19OE+vt7UbUHeewOD5tEBT+4TQ==", 155 | "requires": { 156 | "@actions/core": "^1.2.6", 157 | "@actions/exec": "^1.0.0", 158 | "@actions/http-client": "^1.0.8", 159 | "@actions/io": "^1.1.1", 160 | "semver": "^6.1.0", 161 | "uuid": "^3.3.2" 162 | }, 163 | "dependencies": { 164 | "@actions/http-client": { 165 | "version": "1.0.11", 166 | "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz", 167 | "integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==", 168 | "requires": { 169 | "tunnel": "0.0.6" 170 | } 171 | } 172 | } 173 | }, 174 | "@types/node": { 175 | "version": "17.0.33", 176 | "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.33.tgz", 177 | "integrity": "sha512-miWq2m2FiQZmaHfdZNcbpp9PuXg34W5JZ5CrJ/BaS70VuhoJENBEQybeiYSaPBRNq6KQGnjfEnc/F3PN++D+XQ==", 178 | "dev": true 179 | }, 180 | "@vercel/ncc": { 181 | "version": "0.33.4", 182 | "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.33.4.tgz", 183 | "integrity": "sha512-ln18hs7dMffelP47tpkaR+V5Tj6coykNyxJrlcmCormPqRQjB/Gv4cu2FfBG+PMzIfdZp2CLDsrrB1NPU22Qhg==", 184 | "dev": true 185 | }, 186 | "semver": { 187 | "version": "6.3.0", 188 | "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", 189 | "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" 190 | }, 191 | "tunnel": { 192 | "version": "0.0.6", 193 | "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", 194 | "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" 195 | }, 196 | "typescript": { 197 | "version": "4.6.4", 198 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz", 199 | "integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==", 200 | "dev": true 201 | }, 202 | "uuid": { 203 | "version": "3.4.0", 204 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", 205 | "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" 206 | } 207 | } 208 | } 209 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "typescript-action", 3 | "version": "0.0.0", 4 | "private": true, 5 | "description": "TypeScript template action", 6 | "main": "dist/index.js", 7 | "scripts": { 8 | "build": "ncc build src/main.ts" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/actions/typescript-action.git" 13 | }, 14 | "keywords": [ 15 | "actions", 16 | "node", 17 | "setup" 18 | ], 19 | "author": "", 20 | "license": "MIT", 21 | "dependencies": { 22 | "@actions/core": "^1.8.1", 23 | "@actions/exec": "^1.1.1", 24 | "@actions/io": "^1.1.2", 25 | "@actions/tool-cache": "^1.7.2" 26 | }, 27 | "devDependencies": { 28 | "@types/node": "^17.0.33", 29 | "@vercel/ncc": "^0.33.4", 30 | "typescript": "^4.6.4" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import * as core from '@actions/core'; 2 | import * as exec from "@actions/exec"; 3 | import * as io from "@actions/io"; 4 | import * as tc from "@actions/tool-cache"; 5 | import * as os from 'os'; 6 | import fs from 'fs'; 7 | const https = require('https'); 8 | 9 | function getPlatform(): string { 10 | switch (process.platform) { 11 | case 'linux': return 'linux'; 12 | case 'darwin': return 'macos'; 13 | case 'win32': return 'win'; 14 | } 15 | return 'linux'; /* Default: linux */ 16 | } 17 | 18 | function getExt(): string { 19 | switch (process.platform) { 20 | case 'linux': 21 | case 'darwin': return 'tar.gz'; 22 | case 'win32': return 'zip'; 23 | } 24 | return 'tar.gz'; /* Default: linux */ 25 | } 26 | 27 | async function run(): Promise { 28 | try { 29 | const PATH = process.env.PATH; 30 | 31 | const home = os.homedir(); 32 | const tmp = os.tmpdir(); 33 | 34 | const version = core.getInput("version"); 35 | const architecture = core.getInput("architecture"); 36 | const platform = getPlatform(); 37 | 38 | const ext = getExt(); 39 | const archiveSuffix = `${platform}-${architecture}.${ext}`; // win-x64.zip 40 | const archiveName = `eask_${version}_${archiveSuffix}`; // eask_0.7.10_win-x64.zip 41 | 42 | core.startGroup("Fetch Eask"); 43 | { 44 | let downloadUrl = `https://github.com/emacs-eask/cli/releases/download/${version}/${archiveName}`; 45 | if (version == 'snapshot') { 46 | downloadUrl = `https://github.com/emacs-eask/binaries/raw/master/${archiveSuffix}`; 47 | } 48 | 49 | await exec.exec('curl', [ 50 | '-L', 51 | downloadUrl, 52 | '-o', 53 | `${tmp}/${archiveName}` 54 | ]); 55 | 56 | fs.mkdirSync(`${tmp}/eask-${version}`); 57 | /* Extraction */ 58 | { 59 | if (platform === 'win') 60 | await exec.exec('unzip', [`${tmp}/${archiveName}`, '-d', `${tmp}/eask-${version}`]); 61 | else 62 | await exec.exec('tar', ['-xvzf', `${tmp}/${archiveName}`, '-C', `${tmp}/eask-${version}`]); 63 | } 64 | const options = { recursive: true, force: false }; 65 | await io.mv(`${tmp}/eask-${version}`, `${home}/eask-${version}`, options); 66 | core.addPath(`${home}/eask-${version}`); 67 | } 68 | core.endGroup(); 69 | 70 | // show Eask version 71 | await exec.exec('eask', ['--version']); 72 | } catch (error) { 73 | let errorMsg = "Failed to do something exceptional"; 74 | if (error instanceof Error) { 75 | errorMsg = error.message; 76 | } 77 | core.setFailed(errorMsg); 78 | } 79 | } 80 | 81 | run(); 82 | -------------------------------------------------------------------------------- /src/wait.ts: -------------------------------------------------------------------------------- 1 | export async function wait(milliseconds: number): Promise { 2 | return new Promise(resolve => { 3 | if (isNaN(milliseconds)) { 4 | throw new Error('milliseconds not a number') 5 | } 6 | 7 | setTimeout(() => resolve('done!'), milliseconds) 8 | }) 9 | } 10 | -------------------------------------------------------------------------------- /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 | --------------------------------------------------------------------------------