├── .github └── workflows │ └── main.yml ├── .gitignore ├── .haxerc ├── .vscode ├── settings.json └── tasks.json ├── Build.hx ├── action.yml ├── build.hxml ├── build └── index.js ├── haxe_libraries └── hxnodejs.hxml ├── hxformat.json ├── package-lock.json ├── package.json └── src ├── Command.hx ├── Flixel.hx ├── Haxelib.hx ├── Main.hx ├── OpenFL.hx └── Tests.hx /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: [push, pull_request, workflow_dispatch, repository_dispatch] 4 | 5 | jobs: 6 | build: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v2 10 | - run: npm install 11 | - run: npm run build 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | externs 3 | build/haxe-output.js -------------------------------------------------------------------------------- /.haxerc: -------------------------------------------------------------------------------- 1 | { 2 | "version": "4.2.3", 3 | "resolveLibs": "scoped" 4 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "[haxe]": { 3 | "editor.formatOnSave": true, 4 | "editor.formatOnPaste": true, 5 | "editor.codeActionsOnSave": { 6 | "source.sortImports": true 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "hxml", 6 | "file": "build.hxml", 7 | "group": { 8 | "kind": "build", 9 | "isDefault": true 10 | } 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /Build.hx: -------------------------------------------------------------------------------- 1 | import haxe.macro.Compiler; 2 | import sys.io.File; 3 | 4 | function main() 5 | { 6 | trace("Running: ncc build build/haxe-output.js -o build"); 7 | Sys.command("ncc build build/haxe-output.js -o build"); 8 | 9 | final path = "build/index.js"; 10 | final file = File.getContent(path); 11 | if (file == null) 12 | { 13 | trace('No file named index.js found, creation unsuccesful'); 14 | } 15 | else if (file.indexOf('// Generated by Haxe') == 0) 16 | { 17 | trace('File index.js was not updated'); 18 | } 19 | else 20 | { 21 | trace('index.js created or updated, successfully'); 22 | final haxe = Compiler.getDefine("haxe"); 23 | File.saveContent(path, '// Generated by Haxe $haxe\n' + file); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: Setup Flixel 2 | description: Setup Flixel 3 | branding: 4 | icon: 'package' 5 | color: 'blue' 6 | inputs: 7 | haxe-version: 8 | description: 'Version of Haxe to install via lix' 9 | required: false 10 | lime-version: 11 | description: 'Version of Lime to use' 12 | required: false 13 | openfl-version: 14 | description: 'Version of Openfl to use' 15 | required: false 16 | flixel-versions: 17 | description: 'Version of Flixel libs to use' 18 | required: true 19 | test-location: 20 | description: 'The location of the unit tests' 21 | required: false 22 | target: 23 | description: 'Which target to use' 24 | required: true 25 | run-tests: 26 | description: 'Whether to run flixel tests' 27 | required: false 28 | default: "false" 29 | runs: 30 | using: 'node20' 31 | main: 'build/index.js' 32 | -------------------------------------------------------------------------------- /build.hxml: -------------------------------------------------------------------------------- 1 | -cp src 2 | -main Main 3 | -js build/haxe-output.js 4 | -dce full 5 | -lib hxnodejs 6 | -cp externs/actions-core 7 | -D analyzer-optimize 8 | -D js-es=6 9 | -cmd npm run build -------------------------------------------------------------------------------- /build/index.js: -------------------------------------------------------------------------------- 1 | // Generated by Haxe 4.2.3 2 | /******/ (() => { // webpackBootstrap 3 | /******/ var __webpack_modules__ = ({ 4 | 5 | /***/ 351: 6 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 7 | 8 | "use strict"; 9 | 10 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 11 | if (k2 === undefined) k2 = k; 12 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 13 | }) : (function(o, m, k, k2) { 14 | if (k2 === undefined) k2 = k; 15 | o[k2] = m[k]; 16 | })); 17 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 18 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 19 | }) : function(o, v) { 20 | o["default"] = v; 21 | }); 22 | var __importStar = (this && this.__importStar) || function (mod) { 23 | if (mod && mod.__esModule) return mod; 24 | var result = {}; 25 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 26 | __setModuleDefault(result, mod); 27 | return result; 28 | }; 29 | Object.defineProperty(exports, "__esModule", ({ value: true })); 30 | exports.issue = exports.issueCommand = void 0; 31 | const os = __importStar(__nccwpck_require__(37)); 32 | const utils_1 = __nccwpck_require__(278); 33 | /** 34 | * Commands 35 | * 36 | * Command Format: 37 | * ::name key=value,key=value::message 38 | * 39 | * Examples: 40 | * ::warning::This is the message 41 | * ::set-env name=MY_VAR::some value 42 | */ 43 | function issueCommand(command, properties, message) { 44 | const cmd = new Command(command, properties, message); 45 | process.stdout.write(cmd.toString() + os.EOL); 46 | } 47 | exports.issueCommand = issueCommand; 48 | function issue(name, message = '') { 49 | issueCommand(name, {}, message); 50 | } 51 | exports.issue = issue; 52 | const CMD_STRING = '::'; 53 | class Command { 54 | constructor(command, properties, message) { 55 | if (!command) { 56 | command = 'missing.command'; 57 | } 58 | this.command = command; 59 | this.properties = properties; 60 | this.message = message; 61 | } 62 | toString() { 63 | let cmdStr = CMD_STRING + this.command; 64 | if (this.properties && Object.keys(this.properties).length > 0) { 65 | cmdStr += ' '; 66 | let first = true; 67 | for (const key in this.properties) { 68 | if (this.properties.hasOwnProperty(key)) { 69 | const val = this.properties[key]; 70 | if (val) { 71 | if (first) { 72 | first = false; 73 | } 74 | else { 75 | cmdStr += ','; 76 | } 77 | cmdStr += `${key}=${escapeProperty(val)}`; 78 | } 79 | } 80 | } 81 | } 82 | cmdStr += `${CMD_STRING}${escapeData(this.message)}`; 83 | return cmdStr; 84 | } 85 | } 86 | function escapeData(s) { 87 | return utils_1.toCommandValue(s) 88 | .replace(/%/g, '%25') 89 | .replace(/\r/g, '%0D') 90 | .replace(/\n/g, '%0A'); 91 | } 92 | function escapeProperty(s) { 93 | return utils_1.toCommandValue(s) 94 | .replace(/%/g, '%25') 95 | .replace(/\r/g, '%0D') 96 | .replace(/\n/g, '%0A') 97 | .replace(/:/g, '%3A') 98 | .replace(/,/g, '%2C'); 99 | } 100 | //# sourceMappingURL=command.js.map 101 | 102 | /***/ }), 103 | 104 | /***/ 186: 105 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 106 | 107 | "use strict"; 108 | 109 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 110 | if (k2 === undefined) k2 = k; 111 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 112 | }) : (function(o, m, k, k2) { 113 | if (k2 === undefined) k2 = k; 114 | o[k2] = m[k]; 115 | })); 116 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 117 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 118 | }) : function(o, v) { 119 | o["default"] = v; 120 | }); 121 | var __importStar = (this && this.__importStar) || function (mod) { 122 | if (mod && mod.__esModule) return mod; 123 | var result = {}; 124 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 125 | __setModuleDefault(result, mod); 126 | return result; 127 | }; 128 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 129 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 130 | return new (P || (P = Promise))(function (resolve, reject) { 131 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 132 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 133 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 134 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 135 | }); 136 | }; 137 | Object.defineProperty(exports, "__esModule", ({ value: true })); 138 | 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; 139 | const command_1 = __nccwpck_require__(351); 140 | const file_command_1 = __nccwpck_require__(717); 141 | const utils_1 = __nccwpck_require__(278); 142 | const os = __importStar(__nccwpck_require__(37)); 143 | const path = __importStar(__nccwpck_require__(17)); 144 | const uuid_1 = __nccwpck_require__(840); 145 | const oidc_utils_1 = __nccwpck_require__(41); 146 | /** 147 | * The code to exit an action 148 | */ 149 | var ExitCode; 150 | (function (ExitCode) { 151 | /** 152 | * A code indicating that the action was successful 153 | */ 154 | ExitCode[ExitCode["Success"] = 0] = "Success"; 155 | /** 156 | * A code indicating that the action was a failure 157 | */ 158 | ExitCode[ExitCode["Failure"] = 1] = "Failure"; 159 | })(ExitCode = exports.ExitCode || (exports.ExitCode = {})); 160 | //----------------------------------------------------------------------- 161 | // Variables 162 | //----------------------------------------------------------------------- 163 | /** 164 | * Sets env variable for this action and future actions in the job 165 | * @param name the name of the variable to set 166 | * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify 167 | */ 168 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 169 | function exportVariable(name, val) { 170 | const convertedVal = utils_1.toCommandValue(val); 171 | process.env[name] = convertedVal; 172 | const filePath = process.env['GITHUB_ENV'] || ''; 173 | if (filePath) { 174 | const delimiter = `ghadelimiter_${uuid_1.v4()}`; 175 | // These should realistically never happen, but just in case someone finds a way to exploit uuid generation let's not allow keys or values that contain the delimiter. 176 | if (name.includes(delimiter)) { 177 | throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`); 178 | } 179 | if (convertedVal.includes(delimiter)) { 180 | throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`); 181 | } 182 | const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`; 183 | file_command_1.issueCommand('ENV', commandValue); 184 | } 185 | else { 186 | command_1.issueCommand('set-env', { name }, convertedVal); 187 | } 188 | } 189 | exports.exportVariable = exportVariable; 190 | /** 191 | * Registers a secret which will get masked from logs 192 | * @param secret value of the secret 193 | */ 194 | function setSecret(secret) { 195 | command_1.issueCommand('add-mask', {}, secret); 196 | } 197 | exports.setSecret = setSecret; 198 | /** 199 | * Prepends inputPath to the PATH (for this action and future actions) 200 | * @param inputPath 201 | */ 202 | function addPath(inputPath) { 203 | const filePath = process.env['GITHUB_PATH'] || ''; 204 | if (filePath) { 205 | file_command_1.issueCommand('PATH', inputPath); 206 | } 207 | else { 208 | command_1.issueCommand('add-path', {}, inputPath); 209 | } 210 | process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`; 211 | } 212 | exports.addPath = addPath; 213 | /** 214 | * Gets the value of an input. 215 | * Unless trimWhitespace is set to false in InputOptions, the value is also trimmed. 216 | * Returns an empty string if the value is not defined. 217 | * 218 | * @param name name of the input to get 219 | * @param options optional. See InputOptions. 220 | * @returns string 221 | */ 222 | function getInput(name, options) { 223 | const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || ''; 224 | if (options && options.required && !val) { 225 | throw new Error(`Input required and not supplied: ${name}`); 226 | } 227 | if (options && options.trimWhitespace === false) { 228 | return val; 229 | } 230 | return val.trim(); 231 | } 232 | exports.getInput = getInput; 233 | /** 234 | * Gets the values of an multiline input. Each value is also trimmed. 235 | * 236 | * @param name name of the input to get 237 | * @param options optional. See InputOptions. 238 | * @returns string[] 239 | * 240 | */ 241 | function getMultilineInput(name, options) { 242 | const inputs = getInput(name, options) 243 | .split('\n') 244 | .filter(x => x !== ''); 245 | return inputs; 246 | } 247 | exports.getMultilineInput = getMultilineInput; 248 | /** 249 | * Gets the input value of the boolean type in the YAML 1.2 "core schema" specification. 250 | * Support boolean input list: `true | True | TRUE | false | False | FALSE` . 251 | * The return value is also in boolean type. 252 | * ref: https://yaml.org/spec/1.2/spec.html#id2804923 253 | * 254 | * @param name name of the input to get 255 | * @param options optional. See InputOptions. 256 | * @returns boolean 257 | */ 258 | function getBooleanInput(name, options) { 259 | const trueValue = ['true', 'True', 'TRUE']; 260 | const falseValue = ['false', 'False', 'FALSE']; 261 | const val = getInput(name, options); 262 | if (trueValue.includes(val)) 263 | return true; 264 | if (falseValue.includes(val)) 265 | return false; 266 | throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` + 267 | `Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); 268 | } 269 | exports.getBooleanInput = getBooleanInput; 270 | /** 271 | * Sets the value of an output. 272 | * 273 | * @param name name of the output to set 274 | * @param value value to store. Non-string values will be converted to a string via JSON.stringify 275 | */ 276 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 277 | function setOutput(name, value) { 278 | process.stdout.write(os.EOL); 279 | command_1.issueCommand('set-output', { name }, value); 280 | } 281 | exports.setOutput = setOutput; 282 | /** 283 | * Enables or disables the echoing of commands into stdout for the rest of the step. 284 | * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set. 285 | * 286 | */ 287 | function setCommandEcho(enabled) { 288 | command_1.issue('echo', enabled ? 'on' : 'off'); 289 | } 290 | exports.setCommandEcho = setCommandEcho; 291 | //----------------------------------------------------------------------- 292 | // Results 293 | //----------------------------------------------------------------------- 294 | /** 295 | * Sets the action status to failed. 296 | * When the action exits it will be with an exit code of 1 297 | * @param message add error issue message 298 | */ 299 | function setFailed(message) { 300 | process.exitCode = ExitCode.Failure; 301 | error(message); 302 | } 303 | exports.setFailed = setFailed; 304 | //----------------------------------------------------------------------- 305 | // Logging Commands 306 | //----------------------------------------------------------------------- 307 | /** 308 | * Gets whether Actions Step Debug is on or not 309 | */ 310 | function isDebug() { 311 | return process.env['RUNNER_DEBUG'] === '1'; 312 | } 313 | exports.isDebug = isDebug; 314 | /** 315 | * Writes debug message to user log 316 | * @param message debug message 317 | */ 318 | function debug(message) { 319 | command_1.issueCommand('debug', {}, message); 320 | } 321 | exports.debug = debug; 322 | /** 323 | * Adds an error issue 324 | * @param message error issue message. Errors will be converted to string via toString() 325 | * @param properties optional properties to add to the annotation. 326 | */ 327 | function error(message, properties = {}) { 328 | command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); 329 | } 330 | exports.error = error; 331 | /** 332 | * Adds a warning issue 333 | * @param message warning issue message. Errors will be converted to string via toString() 334 | * @param properties optional properties to add to the annotation. 335 | */ 336 | function warning(message, properties = {}) { 337 | command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); 338 | } 339 | exports.warning = warning; 340 | /** 341 | * Adds a notice issue 342 | * @param message notice issue message. Errors will be converted to string via toString() 343 | * @param properties optional properties to add to the annotation. 344 | */ 345 | function notice(message, properties = {}) { 346 | command_1.issueCommand('notice', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); 347 | } 348 | exports.notice = notice; 349 | /** 350 | * Writes info to log with console.log. 351 | * @param message info message 352 | */ 353 | function info(message) { 354 | process.stdout.write(message + os.EOL); 355 | } 356 | exports.info = info; 357 | /** 358 | * Begin an output group. 359 | * 360 | * Output until the next `groupEnd` will be foldable in this group 361 | * 362 | * @param name The name of the output group 363 | */ 364 | function startGroup(name) { 365 | command_1.issue('group', name); 366 | } 367 | exports.startGroup = startGroup; 368 | /** 369 | * End an output group. 370 | */ 371 | function endGroup() { 372 | command_1.issue('endgroup'); 373 | } 374 | exports.endGroup = endGroup; 375 | /** 376 | * Wrap an asynchronous function call in a group. 377 | * 378 | * Returns the same type as the function itself. 379 | * 380 | * @param name The name of the group 381 | * @param fn The function to wrap in the group 382 | */ 383 | function group(name, fn) { 384 | return __awaiter(this, void 0, void 0, function* () { 385 | startGroup(name); 386 | let result; 387 | try { 388 | result = yield fn(); 389 | } 390 | finally { 391 | endGroup(); 392 | } 393 | return result; 394 | }); 395 | } 396 | exports.group = group; 397 | //----------------------------------------------------------------------- 398 | // Wrapper action state 399 | //----------------------------------------------------------------------- 400 | /** 401 | * Saves state for current action, the state can only be retrieved by this action's post job execution. 402 | * 403 | * @param name name of the state to store 404 | * @param value value to store. Non-string values will be converted to a string via JSON.stringify 405 | */ 406 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 407 | function saveState(name, value) { 408 | command_1.issueCommand('save-state', { name }, value); 409 | } 410 | exports.saveState = saveState; 411 | /** 412 | * Gets the value of an state set by this action's main execution. 413 | * 414 | * @param name name of the state to get 415 | * @returns string 416 | */ 417 | function getState(name) { 418 | return process.env[`STATE_${name}`] || ''; 419 | } 420 | exports.getState = getState; 421 | function getIDToken(aud) { 422 | return __awaiter(this, void 0, void 0, function* () { 423 | return yield oidc_utils_1.OidcClient.getIDToken(aud); 424 | }); 425 | } 426 | exports.getIDToken = getIDToken; 427 | /** 428 | * Summary exports 429 | */ 430 | var summary_1 = __nccwpck_require__(327); 431 | Object.defineProperty(exports, "summary", ({ enumerable: true, get: function () { return summary_1.summary; } })); 432 | /** 433 | * @deprecated use core.summary 434 | */ 435 | var summary_2 = __nccwpck_require__(327); 436 | Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } })); 437 | /** 438 | * Path exports 439 | */ 440 | var path_utils_1 = __nccwpck_require__(981); 441 | Object.defineProperty(exports, "toPosixPath", ({ enumerable: true, get: function () { return path_utils_1.toPosixPath; } })); 442 | Object.defineProperty(exports, "toWin32Path", ({ enumerable: true, get: function () { return path_utils_1.toWin32Path; } })); 443 | Object.defineProperty(exports, "toPlatformPath", ({ enumerable: true, get: function () { return path_utils_1.toPlatformPath; } })); 444 | //# sourceMappingURL=core.js.map 445 | 446 | /***/ }), 447 | 448 | /***/ 717: 449 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 450 | 451 | "use strict"; 452 | 453 | // For internal use, subject to change. 454 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 455 | if (k2 === undefined) k2 = k; 456 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 457 | }) : (function(o, m, k, k2) { 458 | if (k2 === undefined) k2 = k; 459 | o[k2] = m[k]; 460 | })); 461 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 462 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 463 | }) : function(o, v) { 464 | o["default"] = v; 465 | }); 466 | var __importStar = (this && this.__importStar) || function (mod) { 467 | if (mod && mod.__esModule) return mod; 468 | var result = {}; 469 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 470 | __setModuleDefault(result, mod); 471 | return result; 472 | }; 473 | Object.defineProperty(exports, "__esModule", ({ value: true })); 474 | exports.issueCommand = void 0; 475 | // We use any as a valid input type 476 | /* eslint-disable @typescript-eslint/no-explicit-any */ 477 | const fs = __importStar(__nccwpck_require__(147)); 478 | const os = __importStar(__nccwpck_require__(37)); 479 | const utils_1 = __nccwpck_require__(278); 480 | function issueCommand(command, message) { 481 | const filePath = process.env[`GITHUB_${command}`]; 482 | if (!filePath) { 483 | throw new Error(`Unable to find environment variable for file command ${command}`); 484 | } 485 | if (!fs.existsSync(filePath)) { 486 | throw new Error(`Missing file at path: ${filePath}`); 487 | } 488 | fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, { 489 | encoding: 'utf8' 490 | }); 491 | } 492 | exports.issueCommand = issueCommand; 493 | //# sourceMappingURL=file-command.js.map 494 | 495 | /***/ }), 496 | 497 | /***/ 41: 498 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 499 | 500 | "use strict"; 501 | 502 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 503 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 504 | return new (P || (P = Promise))(function (resolve, reject) { 505 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 506 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 507 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 508 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 509 | }); 510 | }; 511 | Object.defineProperty(exports, "__esModule", ({ value: true })); 512 | exports.OidcClient = void 0; 513 | const http_client_1 = __nccwpck_require__(255); 514 | const auth_1 = __nccwpck_require__(526); 515 | const core_1 = __nccwpck_require__(186); 516 | class OidcClient { 517 | static createHttpClient(allowRetry = true, maxRetry = 10) { 518 | const requestOptions = { 519 | allowRetries: allowRetry, 520 | maxRetries: maxRetry 521 | }; 522 | return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions); 523 | } 524 | static getRequestToken() { 525 | const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN']; 526 | if (!token) { 527 | throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable'); 528 | } 529 | return token; 530 | } 531 | static getIDTokenUrl() { 532 | const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL']; 533 | if (!runtimeUrl) { 534 | throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable'); 535 | } 536 | return runtimeUrl; 537 | } 538 | static getCall(id_token_url) { 539 | var _a; 540 | return __awaiter(this, void 0, void 0, function* () { 541 | const httpclient = OidcClient.createHttpClient(); 542 | const res = yield httpclient 543 | .getJson(id_token_url) 544 | .catch(error => { 545 | throw new Error(`Failed to get ID Token. \n 546 | Error Code : ${error.statusCode}\n 547 | Error Message: ${error.result.message}`); 548 | }); 549 | const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; 550 | if (!id_token) { 551 | throw new Error('Response json body do not have ID Token field'); 552 | } 553 | return id_token; 554 | }); 555 | } 556 | static getIDToken(audience) { 557 | return __awaiter(this, void 0, void 0, function* () { 558 | try { 559 | // New ID Token is requested from action service 560 | let id_token_url = OidcClient.getIDTokenUrl(); 561 | if (audience) { 562 | const encodedAudience = encodeURIComponent(audience); 563 | id_token_url = `${id_token_url}&audience=${encodedAudience}`; 564 | } 565 | core_1.debug(`ID token url is ${id_token_url}`); 566 | const id_token = yield OidcClient.getCall(id_token_url); 567 | core_1.setSecret(id_token); 568 | return id_token; 569 | } 570 | catch (error) { 571 | throw new Error(`Error message: ${error.message}`); 572 | } 573 | }); 574 | } 575 | } 576 | exports.OidcClient = OidcClient; 577 | //# sourceMappingURL=oidc-utils.js.map 578 | 579 | /***/ }), 580 | 581 | /***/ 981: 582 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 583 | 584 | "use strict"; 585 | 586 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 587 | if (k2 === undefined) k2 = k; 588 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 589 | }) : (function(o, m, k, k2) { 590 | if (k2 === undefined) k2 = k; 591 | o[k2] = m[k]; 592 | })); 593 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 594 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 595 | }) : function(o, v) { 596 | o["default"] = v; 597 | }); 598 | var __importStar = (this && this.__importStar) || function (mod) { 599 | if (mod && mod.__esModule) return mod; 600 | var result = {}; 601 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 602 | __setModuleDefault(result, mod); 603 | return result; 604 | }; 605 | Object.defineProperty(exports, "__esModule", ({ value: true })); 606 | exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = void 0; 607 | const path = __importStar(__nccwpck_require__(17)); 608 | /** 609 | * toPosixPath converts the given path to the posix form. On Windows, \\ will be 610 | * replaced with /. 611 | * 612 | * @param pth. Path to transform. 613 | * @return string Posix path. 614 | */ 615 | function toPosixPath(pth) { 616 | return pth.replace(/[\\]/g, '/'); 617 | } 618 | exports.toPosixPath = toPosixPath; 619 | /** 620 | * toWin32Path converts the given path to the win32 form. On Linux, / will be 621 | * replaced with \\. 622 | * 623 | * @param pth. Path to transform. 624 | * @return string Win32 path. 625 | */ 626 | function toWin32Path(pth) { 627 | return pth.replace(/[/]/g, '\\'); 628 | } 629 | exports.toWin32Path = toWin32Path; 630 | /** 631 | * toPlatformPath converts the given path to a platform-specific path. It does 632 | * this by replacing instances of / and \ with the platform-specific path 633 | * separator. 634 | * 635 | * @param pth The path to platformize. 636 | * @return string The platform-specific path. 637 | */ 638 | function toPlatformPath(pth) { 639 | return pth.replace(/[/\\]/g, path.sep); 640 | } 641 | exports.toPlatformPath = toPlatformPath; 642 | //# sourceMappingURL=path-utils.js.map 643 | 644 | /***/ }), 645 | 646 | /***/ 327: 647 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 648 | 649 | "use strict"; 650 | 651 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 652 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 653 | return new (P || (P = Promise))(function (resolve, reject) { 654 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 655 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 656 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 657 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 658 | }); 659 | }; 660 | Object.defineProperty(exports, "__esModule", ({ value: true })); 661 | exports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0; 662 | const os_1 = __nccwpck_require__(37); 663 | const fs_1 = __nccwpck_require__(147); 664 | const { access, appendFile, writeFile } = fs_1.promises; 665 | exports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY'; 666 | exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary'; 667 | class Summary { 668 | constructor() { 669 | this._buffer = ''; 670 | } 671 | /** 672 | * Finds the summary file path from the environment, rejects if env var is not found or file does not exist 673 | * Also checks r/w permissions. 674 | * 675 | * @returns step summary file path 676 | */ 677 | filePath() { 678 | return __awaiter(this, void 0, void 0, function* () { 679 | if (this._filePath) { 680 | return this._filePath; 681 | } 682 | const pathFromEnv = process.env[exports.SUMMARY_ENV_VAR]; 683 | if (!pathFromEnv) { 684 | throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`); 685 | } 686 | try { 687 | yield access(pathFromEnv, fs_1.constants.R_OK | fs_1.constants.W_OK); 688 | } 689 | catch (_a) { 690 | throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`); 691 | } 692 | this._filePath = pathFromEnv; 693 | return this._filePath; 694 | }); 695 | } 696 | /** 697 | * Wraps content in an HTML tag, adding any HTML attributes 698 | * 699 | * @param {string} tag HTML tag to wrap 700 | * @param {string | null} content content within the tag 701 | * @param {[attribute: string]: string} attrs key-value list of HTML attributes to add 702 | * 703 | * @returns {string} content wrapped in HTML element 704 | */ 705 | wrap(tag, content, attrs = {}) { 706 | const htmlAttrs = Object.entries(attrs) 707 | .map(([key, value]) => ` ${key}="${value}"`) 708 | .join(''); 709 | if (!content) { 710 | return `<${tag}${htmlAttrs}>`; 711 | } 712 | return `<${tag}${htmlAttrs}>${content}`; 713 | } 714 | /** 715 | * Writes text in the buffer to the summary buffer file and empties buffer. Will append by default. 716 | * 717 | * @param {SummaryWriteOptions} [options] (optional) options for write operation 718 | * 719 | * @returns {Promise} summary instance 720 | */ 721 | write(options) { 722 | return __awaiter(this, void 0, void 0, function* () { 723 | const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite); 724 | const filePath = yield this.filePath(); 725 | const writeFunc = overwrite ? writeFile : appendFile; 726 | yield writeFunc(filePath, this._buffer, { encoding: 'utf8' }); 727 | return this.emptyBuffer(); 728 | }); 729 | } 730 | /** 731 | * Clears the summary buffer and wipes the summary file 732 | * 733 | * @returns {Summary} summary instance 734 | */ 735 | clear() { 736 | return __awaiter(this, void 0, void 0, function* () { 737 | return this.emptyBuffer().write({ overwrite: true }); 738 | }); 739 | } 740 | /** 741 | * Returns the current summary buffer as a string 742 | * 743 | * @returns {string} string of summary buffer 744 | */ 745 | stringify() { 746 | return this._buffer; 747 | } 748 | /** 749 | * If the summary buffer is empty 750 | * 751 | * @returns {boolen} true if the buffer is empty 752 | */ 753 | isEmptyBuffer() { 754 | return this._buffer.length === 0; 755 | } 756 | /** 757 | * Resets the summary buffer without writing to summary file 758 | * 759 | * @returns {Summary} summary instance 760 | */ 761 | emptyBuffer() { 762 | this._buffer = ''; 763 | return this; 764 | } 765 | /** 766 | * Adds raw text to the summary buffer 767 | * 768 | * @param {string} text content to add 769 | * @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false) 770 | * 771 | * @returns {Summary} summary instance 772 | */ 773 | addRaw(text, addEOL = false) { 774 | this._buffer += text; 775 | return addEOL ? this.addEOL() : this; 776 | } 777 | /** 778 | * Adds the operating system-specific end-of-line marker to the buffer 779 | * 780 | * @returns {Summary} summary instance 781 | */ 782 | addEOL() { 783 | return this.addRaw(os_1.EOL); 784 | } 785 | /** 786 | * Adds an HTML codeblock to the summary buffer 787 | * 788 | * @param {string} code content to render within fenced code block 789 | * @param {string} lang (optional) language to syntax highlight code 790 | * 791 | * @returns {Summary} summary instance 792 | */ 793 | addCodeBlock(code, lang) { 794 | const attrs = Object.assign({}, (lang && { lang })); 795 | const element = this.wrap('pre', this.wrap('code', code), attrs); 796 | return this.addRaw(element).addEOL(); 797 | } 798 | /** 799 | * Adds an HTML list to the summary buffer 800 | * 801 | * @param {string[]} items list of items to render 802 | * @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false) 803 | * 804 | * @returns {Summary} summary instance 805 | */ 806 | addList(items, ordered = false) { 807 | const tag = ordered ? 'ol' : 'ul'; 808 | const listItems = items.map(item => this.wrap('li', item)).join(''); 809 | const element = this.wrap(tag, listItems); 810 | return this.addRaw(element).addEOL(); 811 | } 812 | /** 813 | * Adds an HTML table to the summary buffer 814 | * 815 | * @param {SummaryTableCell[]} rows table rows 816 | * 817 | * @returns {Summary} summary instance 818 | */ 819 | addTable(rows) { 820 | const tableBody = rows 821 | .map(row => { 822 | const cells = row 823 | .map(cell => { 824 | if (typeof cell === 'string') { 825 | return this.wrap('td', cell); 826 | } 827 | const { header, data, colspan, rowspan } = cell; 828 | const tag = header ? 'th' : 'td'; 829 | const attrs = Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan })); 830 | return this.wrap(tag, data, attrs); 831 | }) 832 | .join(''); 833 | return this.wrap('tr', cells); 834 | }) 835 | .join(''); 836 | const element = this.wrap('table', tableBody); 837 | return this.addRaw(element).addEOL(); 838 | } 839 | /** 840 | * Adds a collapsable HTML details element to the summary buffer 841 | * 842 | * @param {string} label text for the closed state 843 | * @param {string} content collapsable content 844 | * 845 | * @returns {Summary} summary instance 846 | */ 847 | addDetails(label, content) { 848 | const element = this.wrap('details', this.wrap('summary', label) + content); 849 | return this.addRaw(element).addEOL(); 850 | } 851 | /** 852 | * Adds an HTML image tag to the summary buffer 853 | * 854 | * @param {string} src path to the image you to embed 855 | * @param {string} alt text description of the image 856 | * @param {SummaryImageOptions} options (optional) addition image attributes 857 | * 858 | * @returns {Summary} summary instance 859 | */ 860 | addImage(src, alt, options) { 861 | const { width, height } = options || {}; 862 | const attrs = Object.assign(Object.assign({}, (width && { width })), (height && { height })); 863 | const element = this.wrap('img', null, Object.assign({ src, alt }, attrs)); 864 | return this.addRaw(element).addEOL(); 865 | } 866 | /** 867 | * Adds an HTML section heading element 868 | * 869 | * @param {string} text heading text 870 | * @param {number | string} [level=1] (optional) the heading level, default: 1 871 | * 872 | * @returns {Summary} summary instance 873 | */ 874 | addHeading(text, level) { 875 | const tag = `h${level}`; 876 | const allowedTag = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tag) 877 | ? tag 878 | : 'h1'; 879 | const element = this.wrap(allowedTag, text); 880 | return this.addRaw(element).addEOL(); 881 | } 882 | /** 883 | * Adds an HTML thematic break (
) to the summary buffer 884 | * 885 | * @returns {Summary} summary instance 886 | */ 887 | addSeparator() { 888 | const element = this.wrap('hr', null); 889 | return this.addRaw(element).addEOL(); 890 | } 891 | /** 892 | * Adds an HTML line break (
) to the summary buffer 893 | * 894 | * @returns {Summary} summary instance 895 | */ 896 | addBreak() { 897 | const element = this.wrap('br', null); 898 | return this.addRaw(element).addEOL(); 899 | } 900 | /** 901 | * Adds an HTML blockquote to the summary buffer 902 | * 903 | * @param {string} text quote text 904 | * @param {string} cite (optional) citation url 905 | * 906 | * @returns {Summary} summary instance 907 | */ 908 | addQuote(text, cite) { 909 | const attrs = Object.assign({}, (cite && { cite })); 910 | const element = this.wrap('blockquote', text, attrs); 911 | return this.addRaw(element).addEOL(); 912 | } 913 | /** 914 | * Adds an HTML anchor tag to the summary buffer 915 | * 916 | * @param {string} text link text/content 917 | * @param {string} href hyperlink 918 | * 919 | * @returns {Summary} summary instance 920 | */ 921 | addLink(text, href) { 922 | const element = this.wrap('a', text, { href }); 923 | return this.addRaw(element).addEOL(); 924 | } 925 | } 926 | const _summary = new Summary(); 927 | /** 928 | * @deprecated use `core.summary` 929 | */ 930 | exports.markdownSummary = _summary; 931 | exports.summary = _summary; 932 | //# sourceMappingURL=summary.js.map 933 | 934 | /***/ }), 935 | 936 | /***/ 278: 937 | /***/ ((__unused_webpack_module, exports) => { 938 | 939 | "use strict"; 940 | 941 | // We use any as a valid input type 942 | /* eslint-disable @typescript-eslint/no-explicit-any */ 943 | Object.defineProperty(exports, "__esModule", ({ value: true })); 944 | exports.toCommandProperties = exports.toCommandValue = void 0; 945 | /** 946 | * Sanitizes an input into a string so it can be passed into issueCommand safely 947 | * @param input input to sanitize into a string 948 | */ 949 | function toCommandValue(input) { 950 | if (input === null || input === undefined) { 951 | return ''; 952 | } 953 | else if (typeof input === 'string' || input instanceof String) { 954 | return input; 955 | } 956 | return JSON.stringify(input); 957 | } 958 | exports.toCommandValue = toCommandValue; 959 | /** 960 | * 961 | * @param annotationProperties 962 | * @returns The command properties to send with the actual annotation command 963 | * See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646 964 | */ 965 | function toCommandProperties(annotationProperties) { 966 | if (!Object.keys(annotationProperties).length) { 967 | return {}; 968 | } 969 | return { 970 | title: annotationProperties.title, 971 | file: annotationProperties.file, 972 | line: annotationProperties.startLine, 973 | endLine: annotationProperties.endLine, 974 | col: annotationProperties.startColumn, 975 | endColumn: annotationProperties.endColumn 976 | }; 977 | } 978 | exports.toCommandProperties = toCommandProperties; 979 | //# sourceMappingURL=utils.js.map 980 | 981 | /***/ }), 982 | 983 | /***/ 526: 984 | /***/ (function(__unused_webpack_module, exports) { 985 | 986 | "use strict"; 987 | 988 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 989 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 990 | return new (P || (P = Promise))(function (resolve, reject) { 991 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 992 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 993 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 994 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 995 | }); 996 | }; 997 | Object.defineProperty(exports, "__esModule", ({ value: true })); 998 | exports.PersonalAccessTokenCredentialHandler = exports.BearerCredentialHandler = exports.BasicCredentialHandler = void 0; 999 | class BasicCredentialHandler { 1000 | constructor(username, password) { 1001 | this.username = username; 1002 | this.password = password; 1003 | } 1004 | prepareRequest(options) { 1005 | if (!options.headers) { 1006 | throw Error('The request has no headers'); 1007 | } 1008 | options.headers['Authorization'] = `Basic ${Buffer.from(`${this.username}:${this.password}`).toString('base64')}`; 1009 | } 1010 | // This handler cannot handle 401 1011 | canHandleAuthentication() { 1012 | return false; 1013 | } 1014 | handleAuthentication() { 1015 | return __awaiter(this, void 0, void 0, function* () { 1016 | throw new Error('not implemented'); 1017 | }); 1018 | } 1019 | } 1020 | exports.BasicCredentialHandler = BasicCredentialHandler; 1021 | class BearerCredentialHandler { 1022 | constructor(token) { 1023 | this.token = token; 1024 | } 1025 | // currently implements pre-authorization 1026 | // TODO: support preAuth = false where it hooks on 401 1027 | prepareRequest(options) { 1028 | if (!options.headers) { 1029 | throw Error('The request has no headers'); 1030 | } 1031 | options.headers['Authorization'] = `Bearer ${this.token}`; 1032 | } 1033 | // This handler cannot handle 401 1034 | canHandleAuthentication() { 1035 | return false; 1036 | } 1037 | handleAuthentication() { 1038 | return __awaiter(this, void 0, void 0, function* () { 1039 | throw new Error('not implemented'); 1040 | }); 1041 | } 1042 | } 1043 | exports.BearerCredentialHandler = BearerCredentialHandler; 1044 | class PersonalAccessTokenCredentialHandler { 1045 | constructor(token) { 1046 | this.token = token; 1047 | } 1048 | // currently implements pre-authorization 1049 | // TODO: support preAuth = false where it hooks on 401 1050 | prepareRequest(options) { 1051 | if (!options.headers) { 1052 | throw Error('The request has no headers'); 1053 | } 1054 | options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`; 1055 | } 1056 | // This handler cannot handle 401 1057 | canHandleAuthentication() { 1058 | return false; 1059 | } 1060 | handleAuthentication() { 1061 | return __awaiter(this, void 0, void 0, function* () { 1062 | throw new Error('not implemented'); 1063 | }); 1064 | } 1065 | } 1066 | exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler; 1067 | //# sourceMappingURL=auth.js.map 1068 | 1069 | /***/ }), 1070 | 1071 | /***/ 255: 1072 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 1073 | 1074 | "use strict"; 1075 | 1076 | /* eslint-disable @typescript-eslint/no-explicit-any */ 1077 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 1078 | if (k2 === undefined) k2 = k; 1079 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 1080 | }) : (function(o, m, k, k2) { 1081 | if (k2 === undefined) k2 = k; 1082 | o[k2] = m[k]; 1083 | })); 1084 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 1085 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 1086 | }) : function(o, v) { 1087 | o["default"] = v; 1088 | }); 1089 | var __importStar = (this && this.__importStar) || function (mod) { 1090 | if (mod && mod.__esModule) return mod; 1091 | var result = {}; 1092 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 1093 | __setModuleDefault(result, mod); 1094 | return result; 1095 | }; 1096 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 1097 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 1098 | return new (P || (P = Promise))(function (resolve, reject) { 1099 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 1100 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 1101 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 1102 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 1103 | }); 1104 | }; 1105 | Object.defineProperty(exports, "__esModule", ({ value: true })); 1106 | exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0; 1107 | const http = __importStar(__nccwpck_require__(685)); 1108 | const https = __importStar(__nccwpck_require__(687)); 1109 | const pm = __importStar(__nccwpck_require__(835)); 1110 | const tunnel = __importStar(__nccwpck_require__(294)); 1111 | var HttpCodes; 1112 | (function (HttpCodes) { 1113 | HttpCodes[HttpCodes["OK"] = 200] = "OK"; 1114 | HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices"; 1115 | HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently"; 1116 | HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved"; 1117 | HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther"; 1118 | HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified"; 1119 | HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy"; 1120 | HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy"; 1121 | HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect"; 1122 | HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect"; 1123 | HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest"; 1124 | HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized"; 1125 | HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired"; 1126 | HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden"; 1127 | HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound"; 1128 | HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed"; 1129 | HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable"; 1130 | HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; 1131 | HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout"; 1132 | HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict"; 1133 | HttpCodes[HttpCodes["Gone"] = 410] = "Gone"; 1134 | HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests"; 1135 | HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError"; 1136 | HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented"; 1137 | HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway"; 1138 | HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable"; 1139 | HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout"; 1140 | })(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {})); 1141 | var Headers; 1142 | (function (Headers) { 1143 | Headers["Accept"] = "accept"; 1144 | Headers["ContentType"] = "content-type"; 1145 | })(Headers = exports.Headers || (exports.Headers = {})); 1146 | var MediaTypes; 1147 | (function (MediaTypes) { 1148 | MediaTypes["ApplicationJson"] = "application/json"; 1149 | })(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {})); 1150 | /** 1151 | * Returns the proxy URL, depending upon the supplied url and proxy environment variables. 1152 | * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com 1153 | */ 1154 | function getProxyUrl(serverUrl) { 1155 | const proxyUrl = pm.getProxyUrl(new URL(serverUrl)); 1156 | return proxyUrl ? proxyUrl.href : ''; 1157 | } 1158 | exports.getProxyUrl = getProxyUrl; 1159 | const HttpRedirectCodes = [ 1160 | HttpCodes.MovedPermanently, 1161 | HttpCodes.ResourceMoved, 1162 | HttpCodes.SeeOther, 1163 | HttpCodes.TemporaryRedirect, 1164 | HttpCodes.PermanentRedirect 1165 | ]; 1166 | const HttpResponseRetryCodes = [ 1167 | HttpCodes.BadGateway, 1168 | HttpCodes.ServiceUnavailable, 1169 | HttpCodes.GatewayTimeout 1170 | ]; 1171 | const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD']; 1172 | const ExponentialBackoffCeiling = 10; 1173 | const ExponentialBackoffTimeSlice = 5; 1174 | class HttpClientError extends Error { 1175 | constructor(message, statusCode) { 1176 | super(message); 1177 | this.name = 'HttpClientError'; 1178 | this.statusCode = statusCode; 1179 | Object.setPrototypeOf(this, HttpClientError.prototype); 1180 | } 1181 | } 1182 | exports.HttpClientError = HttpClientError; 1183 | class HttpClientResponse { 1184 | constructor(message) { 1185 | this.message = message; 1186 | } 1187 | readBody() { 1188 | return __awaiter(this, void 0, void 0, function* () { 1189 | return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () { 1190 | let output = Buffer.alloc(0); 1191 | this.message.on('data', (chunk) => { 1192 | output = Buffer.concat([output, chunk]); 1193 | }); 1194 | this.message.on('end', () => { 1195 | resolve(output.toString()); 1196 | }); 1197 | })); 1198 | }); 1199 | } 1200 | } 1201 | exports.HttpClientResponse = HttpClientResponse; 1202 | function isHttps(requestUrl) { 1203 | const parsedUrl = new URL(requestUrl); 1204 | return parsedUrl.protocol === 'https:'; 1205 | } 1206 | exports.isHttps = isHttps; 1207 | class HttpClient { 1208 | constructor(userAgent, handlers, requestOptions) { 1209 | this._ignoreSslError = false; 1210 | this._allowRedirects = true; 1211 | this._allowRedirectDowngrade = false; 1212 | this._maxRedirects = 50; 1213 | this._allowRetries = false; 1214 | this._maxRetries = 1; 1215 | this._keepAlive = false; 1216 | this._disposed = false; 1217 | this.userAgent = userAgent; 1218 | this.handlers = handlers || []; 1219 | this.requestOptions = requestOptions; 1220 | if (requestOptions) { 1221 | if (requestOptions.ignoreSslError != null) { 1222 | this._ignoreSslError = requestOptions.ignoreSslError; 1223 | } 1224 | this._socketTimeout = requestOptions.socketTimeout; 1225 | if (requestOptions.allowRedirects != null) { 1226 | this._allowRedirects = requestOptions.allowRedirects; 1227 | } 1228 | if (requestOptions.allowRedirectDowngrade != null) { 1229 | this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade; 1230 | } 1231 | if (requestOptions.maxRedirects != null) { 1232 | this._maxRedirects = Math.max(requestOptions.maxRedirects, 0); 1233 | } 1234 | if (requestOptions.keepAlive != null) { 1235 | this._keepAlive = requestOptions.keepAlive; 1236 | } 1237 | if (requestOptions.allowRetries != null) { 1238 | this._allowRetries = requestOptions.allowRetries; 1239 | } 1240 | if (requestOptions.maxRetries != null) { 1241 | this._maxRetries = requestOptions.maxRetries; 1242 | } 1243 | } 1244 | } 1245 | options(requestUrl, additionalHeaders) { 1246 | return __awaiter(this, void 0, void 0, function* () { 1247 | return this.request('OPTIONS', requestUrl, null, additionalHeaders || {}); 1248 | }); 1249 | } 1250 | get(requestUrl, additionalHeaders) { 1251 | return __awaiter(this, void 0, void 0, function* () { 1252 | return this.request('GET', requestUrl, null, additionalHeaders || {}); 1253 | }); 1254 | } 1255 | del(requestUrl, additionalHeaders) { 1256 | return __awaiter(this, void 0, void 0, function* () { 1257 | return this.request('DELETE', requestUrl, null, additionalHeaders || {}); 1258 | }); 1259 | } 1260 | post(requestUrl, data, additionalHeaders) { 1261 | return __awaiter(this, void 0, void 0, function* () { 1262 | return this.request('POST', requestUrl, data, additionalHeaders || {}); 1263 | }); 1264 | } 1265 | patch(requestUrl, data, additionalHeaders) { 1266 | return __awaiter(this, void 0, void 0, function* () { 1267 | return this.request('PATCH', requestUrl, data, additionalHeaders || {}); 1268 | }); 1269 | } 1270 | put(requestUrl, data, additionalHeaders) { 1271 | return __awaiter(this, void 0, void 0, function* () { 1272 | return this.request('PUT', requestUrl, data, additionalHeaders || {}); 1273 | }); 1274 | } 1275 | head(requestUrl, additionalHeaders) { 1276 | return __awaiter(this, void 0, void 0, function* () { 1277 | return this.request('HEAD', requestUrl, null, additionalHeaders || {}); 1278 | }); 1279 | } 1280 | sendStream(verb, requestUrl, stream, additionalHeaders) { 1281 | return __awaiter(this, void 0, void 0, function* () { 1282 | return this.request(verb, requestUrl, stream, additionalHeaders); 1283 | }); 1284 | } 1285 | /** 1286 | * Gets a typed object from an endpoint 1287 | * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise 1288 | */ 1289 | getJson(requestUrl, additionalHeaders = {}) { 1290 | return __awaiter(this, void 0, void 0, function* () { 1291 | additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 1292 | const res = yield this.get(requestUrl, additionalHeaders); 1293 | return this._processResponse(res, this.requestOptions); 1294 | }); 1295 | } 1296 | postJson(requestUrl, obj, additionalHeaders = {}) { 1297 | return __awaiter(this, void 0, void 0, function* () { 1298 | const data = JSON.stringify(obj, null, 2); 1299 | additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 1300 | additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 1301 | const res = yield this.post(requestUrl, data, additionalHeaders); 1302 | return this._processResponse(res, this.requestOptions); 1303 | }); 1304 | } 1305 | putJson(requestUrl, obj, additionalHeaders = {}) { 1306 | return __awaiter(this, void 0, void 0, function* () { 1307 | const data = JSON.stringify(obj, null, 2); 1308 | additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 1309 | additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 1310 | const res = yield this.put(requestUrl, data, additionalHeaders); 1311 | return this._processResponse(res, this.requestOptions); 1312 | }); 1313 | } 1314 | patchJson(requestUrl, obj, additionalHeaders = {}) { 1315 | return __awaiter(this, void 0, void 0, function* () { 1316 | const data = JSON.stringify(obj, null, 2); 1317 | additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 1318 | additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 1319 | const res = yield this.patch(requestUrl, data, additionalHeaders); 1320 | return this._processResponse(res, this.requestOptions); 1321 | }); 1322 | } 1323 | /** 1324 | * Makes a raw http request. 1325 | * All other methods such as get, post, patch, and request ultimately call this. 1326 | * Prefer get, del, post and patch 1327 | */ 1328 | request(verb, requestUrl, data, headers) { 1329 | return __awaiter(this, void 0, void 0, function* () { 1330 | if (this._disposed) { 1331 | throw new Error('Client has already been disposed.'); 1332 | } 1333 | const parsedUrl = new URL(requestUrl); 1334 | let info = this._prepareRequest(verb, parsedUrl, headers); 1335 | // Only perform retries on reads since writes may not be idempotent. 1336 | const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb) 1337 | ? this._maxRetries + 1 1338 | : 1; 1339 | let numTries = 0; 1340 | let response; 1341 | do { 1342 | response = yield this.requestRaw(info, data); 1343 | // Check if it's an authentication challenge 1344 | if (response && 1345 | response.message && 1346 | response.message.statusCode === HttpCodes.Unauthorized) { 1347 | let authenticationHandler; 1348 | for (const handler of this.handlers) { 1349 | if (handler.canHandleAuthentication(response)) { 1350 | authenticationHandler = handler; 1351 | break; 1352 | } 1353 | } 1354 | if (authenticationHandler) { 1355 | return authenticationHandler.handleAuthentication(this, info, data); 1356 | } 1357 | else { 1358 | // We have received an unauthorized response but have no handlers to handle it. 1359 | // Let the response return to the caller. 1360 | return response; 1361 | } 1362 | } 1363 | let redirectsRemaining = this._maxRedirects; 1364 | while (response.message.statusCode && 1365 | HttpRedirectCodes.includes(response.message.statusCode) && 1366 | this._allowRedirects && 1367 | redirectsRemaining > 0) { 1368 | const redirectUrl = response.message.headers['location']; 1369 | if (!redirectUrl) { 1370 | // if there's no location to redirect to, we won't 1371 | break; 1372 | } 1373 | const parsedRedirectUrl = new URL(redirectUrl); 1374 | if (parsedUrl.protocol === 'https:' && 1375 | parsedUrl.protocol !== parsedRedirectUrl.protocol && 1376 | !this._allowRedirectDowngrade) { 1377 | 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.'); 1378 | } 1379 | // we need to finish reading the response before reassigning response 1380 | // which will leak the open socket. 1381 | yield response.readBody(); 1382 | // strip authorization header if redirected to a different hostname 1383 | if (parsedRedirectUrl.hostname !== parsedUrl.hostname) { 1384 | for (const header in headers) { 1385 | // header names are case insensitive 1386 | if (header.toLowerCase() === 'authorization') { 1387 | delete headers[header]; 1388 | } 1389 | } 1390 | } 1391 | // let's make the request with the new redirectUrl 1392 | info = this._prepareRequest(verb, parsedRedirectUrl, headers); 1393 | response = yield this.requestRaw(info, data); 1394 | redirectsRemaining--; 1395 | } 1396 | if (!response.message.statusCode || 1397 | !HttpResponseRetryCodes.includes(response.message.statusCode)) { 1398 | // If not a retry code, return immediately instead of retrying 1399 | return response; 1400 | } 1401 | numTries += 1; 1402 | if (numTries < maxTries) { 1403 | yield response.readBody(); 1404 | yield this._performExponentialBackoff(numTries); 1405 | } 1406 | } while (numTries < maxTries); 1407 | return response; 1408 | }); 1409 | } 1410 | /** 1411 | * Needs to be called if keepAlive is set to true in request options. 1412 | */ 1413 | dispose() { 1414 | if (this._agent) { 1415 | this._agent.destroy(); 1416 | } 1417 | this._disposed = true; 1418 | } 1419 | /** 1420 | * Raw request. 1421 | * @param info 1422 | * @param data 1423 | */ 1424 | requestRaw(info, data) { 1425 | return __awaiter(this, void 0, void 0, function* () { 1426 | return new Promise((resolve, reject) => { 1427 | function callbackForResult(err, res) { 1428 | if (err) { 1429 | reject(err); 1430 | } 1431 | else if (!res) { 1432 | // If `err` is not passed, then `res` must be passed. 1433 | reject(new Error('Unknown error')); 1434 | } 1435 | else { 1436 | resolve(res); 1437 | } 1438 | } 1439 | this.requestRawWithCallback(info, data, callbackForResult); 1440 | }); 1441 | }); 1442 | } 1443 | /** 1444 | * Raw request with callback. 1445 | * @param info 1446 | * @param data 1447 | * @param onResult 1448 | */ 1449 | requestRawWithCallback(info, data, onResult) { 1450 | if (typeof data === 'string') { 1451 | if (!info.options.headers) { 1452 | info.options.headers = {}; 1453 | } 1454 | info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8'); 1455 | } 1456 | let callbackCalled = false; 1457 | function handleResult(err, res) { 1458 | if (!callbackCalled) { 1459 | callbackCalled = true; 1460 | onResult(err, res); 1461 | } 1462 | } 1463 | const req = info.httpModule.request(info.options, (msg) => { 1464 | const res = new HttpClientResponse(msg); 1465 | handleResult(undefined, res); 1466 | }); 1467 | let socket; 1468 | req.on('socket', sock => { 1469 | socket = sock; 1470 | }); 1471 | // If we ever get disconnected, we want the socket to timeout eventually 1472 | req.setTimeout(this._socketTimeout || 3 * 60000, () => { 1473 | if (socket) { 1474 | socket.end(); 1475 | } 1476 | handleResult(new Error(`Request timeout: ${info.options.path}`)); 1477 | }); 1478 | req.on('error', function (err) { 1479 | // err has statusCode property 1480 | // res should have headers 1481 | handleResult(err); 1482 | }); 1483 | if (data && typeof data === 'string') { 1484 | req.write(data, 'utf8'); 1485 | } 1486 | if (data && typeof data !== 'string') { 1487 | data.on('close', function () { 1488 | req.end(); 1489 | }); 1490 | data.pipe(req); 1491 | } 1492 | else { 1493 | req.end(); 1494 | } 1495 | } 1496 | /** 1497 | * Gets an http agent. This function is useful when you need an http agent that handles 1498 | * routing through a proxy server - depending upon the url and proxy environment variables. 1499 | * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com 1500 | */ 1501 | getAgent(serverUrl) { 1502 | const parsedUrl = new URL(serverUrl); 1503 | return this._getAgent(parsedUrl); 1504 | } 1505 | _prepareRequest(method, requestUrl, headers) { 1506 | const info = {}; 1507 | info.parsedUrl = requestUrl; 1508 | const usingSsl = info.parsedUrl.protocol === 'https:'; 1509 | info.httpModule = usingSsl ? https : http; 1510 | const defaultPort = usingSsl ? 443 : 80; 1511 | info.options = {}; 1512 | info.options.host = info.parsedUrl.hostname; 1513 | info.options.port = info.parsedUrl.port 1514 | ? parseInt(info.parsedUrl.port) 1515 | : defaultPort; 1516 | info.options.path = 1517 | (info.parsedUrl.pathname || '') + (info.parsedUrl.search || ''); 1518 | info.options.method = method; 1519 | info.options.headers = this._mergeHeaders(headers); 1520 | if (this.userAgent != null) { 1521 | info.options.headers['user-agent'] = this.userAgent; 1522 | } 1523 | info.options.agent = this._getAgent(info.parsedUrl); 1524 | // gives handlers an opportunity to participate 1525 | if (this.handlers) { 1526 | for (const handler of this.handlers) { 1527 | handler.prepareRequest(info.options); 1528 | } 1529 | } 1530 | return info; 1531 | } 1532 | _mergeHeaders(headers) { 1533 | if (this.requestOptions && this.requestOptions.headers) { 1534 | return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers || {})); 1535 | } 1536 | return lowercaseKeys(headers || {}); 1537 | } 1538 | _getExistingOrDefaultHeader(additionalHeaders, header, _default) { 1539 | let clientHeader; 1540 | if (this.requestOptions && this.requestOptions.headers) { 1541 | clientHeader = lowercaseKeys(this.requestOptions.headers)[header]; 1542 | } 1543 | return additionalHeaders[header] || clientHeader || _default; 1544 | } 1545 | _getAgent(parsedUrl) { 1546 | let agent; 1547 | const proxyUrl = pm.getProxyUrl(parsedUrl); 1548 | const useProxy = proxyUrl && proxyUrl.hostname; 1549 | if (this._keepAlive && useProxy) { 1550 | agent = this._proxyAgent; 1551 | } 1552 | if (this._keepAlive && !useProxy) { 1553 | agent = this._agent; 1554 | } 1555 | // if agent is already assigned use that agent. 1556 | if (agent) { 1557 | return agent; 1558 | } 1559 | const usingSsl = parsedUrl.protocol === 'https:'; 1560 | let maxSockets = 100; 1561 | if (this.requestOptions) { 1562 | maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets; 1563 | } 1564 | // This is `useProxy` again, but we need to check `proxyURl` directly for TypeScripts's flow analysis. 1565 | if (proxyUrl && proxyUrl.hostname) { 1566 | const agentOptions = { 1567 | maxSockets, 1568 | keepAlive: this._keepAlive, 1569 | proxy: Object.assign(Object.assign({}, ((proxyUrl.username || proxyUrl.password) && { 1570 | proxyAuth: `${proxyUrl.username}:${proxyUrl.password}` 1571 | })), { host: proxyUrl.hostname, port: proxyUrl.port }) 1572 | }; 1573 | let tunnelAgent; 1574 | const overHttps = proxyUrl.protocol === 'https:'; 1575 | if (usingSsl) { 1576 | tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp; 1577 | } 1578 | else { 1579 | tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp; 1580 | } 1581 | agent = tunnelAgent(agentOptions); 1582 | this._proxyAgent = agent; 1583 | } 1584 | // if reusing agent across request and tunneling agent isn't assigned create a new agent 1585 | if (this._keepAlive && !agent) { 1586 | const options = { keepAlive: this._keepAlive, maxSockets }; 1587 | agent = usingSsl ? new https.Agent(options) : new http.Agent(options); 1588 | this._agent = agent; 1589 | } 1590 | // if not using private agent and tunnel agent isn't setup then use global agent 1591 | if (!agent) { 1592 | agent = usingSsl ? https.globalAgent : http.globalAgent; 1593 | } 1594 | if (usingSsl && this._ignoreSslError) { 1595 | // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process 1596 | // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options 1597 | // we have to cast it to any and change it directly 1598 | agent.options = Object.assign(agent.options || {}, { 1599 | rejectUnauthorized: false 1600 | }); 1601 | } 1602 | return agent; 1603 | } 1604 | _performExponentialBackoff(retryNumber) { 1605 | return __awaiter(this, void 0, void 0, function* () { 1606 | retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber); 1607 | const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber); 1608 | return new Promise(resolve => setTimeout(() => resolve(), ms)); 1609 | }); 1610 | } 1611 | _processResponse(res, options) { 1612 | return __awaiter(this, void 0, void 0, function* () { 1613 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { 1614 | const statusCode = res.message.statusCode || 0; 1615 | const response = { 1616 | statusCode, 1617 | result: null, 1618 | headers: {} 1619 | }; 1620 | // not found leads to null obj returned 1621 | if (statusCode === HttpCodes.NotFound) { 1622 | resolve(response); 1623 | } 1624 | // get the result from the body 1625 | function dateTimeDeserializer(key, value) { 1626 | if (typeof value === 'string') { 1627 | const a = new Date(value); 1628 | if (!isNaN(a.valueOf())) { 1629 | return a; 1630 | } 1631 | } 1632 | return value; 1633 | } 1634 | let obj; 1635 | let contents; 1636 | try { 1637 | contents = yield res.readBody(); 1638 | if (contents && contents.length > 0) { 1639 | if (options && options.deserializeDates) { 1640 | obj = JSON.parse(contents, dateTimeDeserializer); 1641 | } 1642 | else { 1643 | obj = JSON.parse(contents); 1644 | } 1645 | response.result = obj; 1646 | } 1647 | response.headers = res.message.headers; 1648 | } 1649 | catch (err) { 1650 | // Invalid resource (contents not json); leaving result obj null 1651 | } 1652 | // note that 3xx redirects are handled by the http layer. 1653 | if (statusCode > 299) { 1654 | let msg; 1655 | // if exception/error in body, attempt to get better error 1656 | if (obj && obj.message) { 1657 | msg = obj.message; 1658 | } 1659 | else if (contents && contents.length > 0) { 1660 | // it may be the case that the exception is in the body message as string 1661 | msg = contents; 1662 | } 1663 | else { 1664 | msg = `Failed request: (${statusCode})`; 1665 | } 1666 | const err = new HttpClientError(msg, statusCode); 1667 | err.result = response.result; 1668 | reject(err); 1669 | } 1670 | else { 1671 | resolve(response); 1672 | } 1673 | })); 1674 | }); 1675 | } 1676 | } 1677 | exports.HttpClient = HttpClient; 1678 | const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); 1679 | //# sourceMappingURL=index.js.map 1680 | 1681 | /***/ }), 1682 | 1683 | /***/ 835: 1684 | /***/ ((__unused_webpack_module, exports) => { 1685 | 1686 | "use strict"; 1687 | 1688 | Object.defineProperty(exports, "__esModule", ({ value: true })); 1689 | exports.checkBypass = exports.getProxyUrl = void 0; 1690 | function getProxyUrl(reqUrl) { 1691 | const usingSsl = reqUrl.protocol === 'https:'; 1692 | if (checkBypass(reqUrl)) { 1693 | return undefined; 1694 | } 1695 | const proxyVar = (() => { 1696 | if (usingSsl) { 1697 | return process.env['https_proxy'] || process.env['HTTPS_PROXY']; 1698 | } 1699 | else { 1700 | return process.env['http_proxy'] || process.env['HTTP_PROXY']; 1701 | } 1702 | })(); 1703 | if (proxyVar) { 1704 | return new URL(proxyVar); 1705 | } 1706 | else { 1707 | return undefined; 1708 | } 1709 | } 1710 | exports.getProxyUrl = getProxyUrl; 1711 | function checkBypass(reqUrl) { 1712 | if (!reqUrl.hostname) { 1713 | return false; 1714 | } 1715 | const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || ''; 1716 | if (!noProxy) { 1717 | return false; 1718 | } 1719 | // Determine the request port 1720 | let reqPort; 1721 | if (reqUrl.port) { 1722 | reqPort = Number(reqUrl.port); 1723 | } 1724 | else if (reqUrl.protocol === 'http:') { 1725 | reqPort = 80; 1726 | } 1727 | else if (reqUrl.protocol === 'https:') { 1728 | reqPort = 443; 1729 | } 1730 | // Format the request hostname and hostname with port 1731 | const upperReqHosts = [reqUrl.hostname.toUpperCase()]; 1732 | if (typeof reqPort === 'number') { 1733 | upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`); 1734 | } 1735 | // Compare request host against noproxy 1736 | for (const upperNoProxyItem of noProxy 1737 | .split(',') 1738 | .map(x => x.trim().toUpperCase()) 1739 | .filter(x => x)) { 1740 | if (upperReqHosts.some(x => x === upperNoProxyItem)) { 1741 | return true; 1742 | } 1743 | } 1744 | return false; 1745 | } 1746 | exports.checkBypass = checkBypass; 1747 | //# sourceMappingURL=proxy.js.map 1748 | 1749 | /***/ }), 1750 | 1751 | /***/ 294: 1752 | /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { 1753 | 1754 | module.exports = __nccwpck_require__(219); 1755 | 1756 | 1757 | /***/ }), 1758 | 1759 | /***/ 219: 1760 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 1761 | 1762 | "use strict"; 1763 | 1764 | 1765 | var net = __nccwpck_require__(808); 1766 | var tls = __nccwpck_require__(404); 1767 | var http = __nccwpck_require__(685); 1768 | var https = __nccwpck_require__(687); 1769 | var events = __nccwpck_require__(361); 1770 | var assert = __nccwpck_require__(491); 1771 | var util = __nccwpck_require__(837); 1772 | 1773 | 1774 | exports.httpOverHttp = httpOverHttp; 1775 | exports.httpsOverHttp = httpsOverHttp; 1776 | exports.httpOverHttps = httpOverHttps; 1777 | exports.httpsOverHttps = httpsOverHttps; 1778 | 1779 | 1780 | function httpOverHttp(options) { 1781 | var agent = new TunnelingAgent(options); 1782 | agent.request = http.request; 1783 | return agent; 1784 | } 1785 | 1786 | function httpsOverHttp(options) { 1787 | var agent = new TunnelingAgent(options); 1788 | agent.request = http.request; 1789 | agent.createSocket = createSecureSocket; 1790 | agent.defaultPort = 443; 1791 | return agent; 1792 | } 1793 | 1794 | function httpOverHttps(options) { 1795 | var agent = new TunnelingAgent(options); 1796 | agent.request = https.request; 1797 | return agent; 1798 | } 1799 | 1800 | function httpsOverHttps(options) { 1801 | var agent = new TunnelingAgent(options); 1802 | agent.request = https.request; 1803 | agent.createSocket = createSecureSocket; 1804 | agent.defaultPort = 443; 1805 | return agent; 1806 | } 1807 | 1808 | 1809 | function TunnelingAgent(options) { 1810 | var self = this; 1811 | self.options = options || {}; 1812 | self.proxyOptions = self.options.proxy || {}; 1813 | self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; 1814 | self.requests = []; 1815 | self.sockets = []; 1816 | 1817 | self.on('free', function onFree(socket, host, port, localAddress) { 1818 | var options = toOptions(host, port, localAddress); 1819 | for (var i = 0, len = self.requests.length; i < len; ++i) { 1820 | var pending = self.requests[i]; 1821 | if (pending.host === options.host && pending.port === options.port) { 1822 | // Detect the request to connect same origin server, 1823 | // reuse the connection. 1824 | self.requests.splice(i, 1); 1825 | pending.request.onSocket(socket); 1826 | return; 1827 | } 1828 | } 1829 | socket.destroy(); 1830 | self.removeSocket(socket); 1831 | }); 1832 | } 1833 | util.inherits(TunnelingAgent, events.EventEmitter); 1834 | 1835 | TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) { 1836 | var self = this; 1837 | var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress)); 1838 | 1839 | if (self.sockets.length >= this.maxSockets) { 1840 | // We are over limit so we'll add it to the queue. 1841 | self.requests.push(options); 1842 | return; 1843 | } 1844 | 1845 | // If we are under maxSockets create a new one. 1846 | self.createSocket(options, function(socket) { 1847 | socket.on('free', onFree); 1848 | socket.on('close', onCloseOrRemove); 1849 | socket.on('agentRemove', onCloseOrRemove); 1850 | req.onSocket(socket); 1851 | 1852 | function onFree() { 1853 | self.emit('free', socket, options); 1854 | } 1855 | 1856 | function onCloseOrRemove(err) { 1857 | self.removeSocket(socket); 1858 | socket.removeListener('free', onFree); 1859 | socket.removeListener('close', onCloseOrRemove); 1860 | socket.removeListener('agentRemove', onCloseOrRemove); 1861 | } 1862 | }); 1863 | }; 1864 | 1865 | TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { 1866 | var self = this; 1867 | var placeholder = {}; 1868 | self.sockets.push(placeholder); 1869 | 1870 | var connectOptions = mergeOptions({}, self.proxyOptions, { 1871 | method: 'CONNECT', 1872 | path: options.host + ':' + options.port, 1873 | agent: false, 1874 | headers: { 1875 | host: options.host + ':' + options.port 1876 | } 1877 | }); 1878 | if (options.localAddress) { 1879 | connectOptions.localAddress = options.localAddress; 1880 | } 1881 | if (connectOptions.proxyAuth) { 1882 | connectOptions.headers = connectOptions.headers || {}; 1883 | connectOptions.headers['Proxy-Authorization'] = 'Basic ' + 1884 | new Buffer(connectOptions.proxyAuth).toString('base64'); 1885 | } 1886 | 1887 | debug('making CONNECT request'); 1888 | var connectReq = self.request(connectOptions); 1889 | connectReq.useChunkedEncodingByDefault = false; // for v0.6 1890 | connectReq.once('response', onResponse); // for v0.6 1891 | connectReq.once('upgrade', onUpgrade); // for v0.6 1892 | connectReq.once('connect', onConnect); // for v0.7 or later 1893 | connectReq.once('error', onError); 1894 | connectReq.end(); 1895 | 1896 | function onResponse(res) { 1897 | // Very hacky. This is necessary to avoid http-parser leaks. 1898 | res.upgrade = true; 1899 | } 1900 | 1901 | function onUpgrade(res, socket, head) { 1902 | // Hacky. 1903 | process.nextTick(function() { 1904 | onConnect(res, socket, head); 1905 | }); 1906 | } 1907 | 1908 | function onConnect(res, socket, head) { 1909 | connectReq.removeAllListeners(); 1910 | socket.removeAllListeners(); 1911 | 1912 | if (res.statusCode !== 200) { 1913 | debug('tunneling socket could not be established, statusCode=%d', 1914 | res.statusCode); 1915 | socket.destroy(); 1916 | var error = new Error('tunneling socket could not be established, ' + 1917 | 'statusCode=' + res.statusCode); 1918 | error.code = 'ECONNRESET'; 1919 | options.request.emit('error', error); 1920 | self.removeSocket(placeholder); 1921 | return; 1922 | } 1923 | if (head.length > 0) { 1924 | debug('got illegal response body from proxy'); 1925 | socket.destroy(); 1926 | var error = new Error('got illegal response body from proxy'); 1927 | error.code = 'ECONNRESET'; 1928 | options.request.emit('error', error); 1929 | self.removeSocket(placeholder); 1930 | return; 1931 | } 1932 | debug('tunneling connection has established'); 1933 | self.sockets[self.sockets.indexOf(placeholder)] = socket; 1934 | return cb(socket); 1935 | } 1936 | 1937 | function onError(cause) { 1938 | connectReq.removeAllListeners(); 1939 | 1940 | debug('tunneling socket could not be established, cause=%s\n', 1941 | cause.message, cause.stack); 1942 | var error = new Error('tunneling socket could not be established, ' + 1943 | 'cause=' + cause.message); 1944 | error.code = 'ECONNRESET'; 1945 | options.request.emit('error', error); 1946 | self.removeSocket(placeholder); 1947 | } 1948 | }; 1949 | 1950 | TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { 1951 | var pos = this.sockets.indexOf(socket) 1952 | if (pos === -1) { 1953 | return; 1954 | } 1955 | this.sockets.splice(pos, 1); 1956 | 1957 | var pending = this.requests.shift(); 1958 | if (pending) { 1959 | // If we have pending requests and a socket gets closed a new one 1960 | // needs to be created to take over in the pool for the one that closed. 1961 | this.createSocket(pending, function(socket) { 1962 | pending.request.onSocket(socket); 1963 | }); 1964 | } 1965 | }; 1966 | 1967 | function createSecureSocket(options, cb) { 1968 | var self = this; 1969 | TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { 1970 | var hostHeader = options.request.getHeader('host'); 1971 | var tlsOptions = mergeOptions({}, self.options, { 1972 | socket: socket, 1973 | servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host 1974 | }); 1975 | 1976 | // 0 is dummy port for v0.6 1977 | var secureSocket = tls.connect(0, tlsOptions); 1978 | self.sockets[self.sockets.indexOf(socket)] = secureSocket; 1979 | cb(secureSocket); 1980 | }); 1981 | } 1982 | 1983 | 1984 | function toOptions(host, port, localAddress) { 1985 | if (typeof host === 'string') { // since v0.10 1986 | return { 1987 | host: host, 1988 | port: port, 1989 | localAddress: localAddress 1990 | }; 1991 | } 1992 | return host; // for v0.11 or later 1993 | } 1994 | 1995 | function mergeOptions(target) { 1996 | for (var i = 1, len = arguments.length; i < len; ++i) { 1997 | var overrides = arguments[i]; 1998 | if (typeof overrides === 'object') { 1999 | var keys = Object.keys(overrides); 2000 | for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { 2001 | var k = keys[j]; 2002 | if (overrides[k] !== undefined) { 2003 | target[k] = overrides[k]; 2004 | } 2005 | } 2006 | } 2007 | } 2008 | return target; 2009 | } 2010 | 2011 | 2012 | var debug; 2013 | if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { 2014 | debug = function() { 2015 | var args = Array.prototype.slice.call(arguments); 2016 | if (typeof args[0] === 'string') { 2017 | args[0] = 'TUNNEL: ' + args[0]; 2018 | } else { 2019 | args.unshift('TUNNEL:'); 2020 | } 2021 | console.error.apply(console, args); 2022 | } 2023 | } else { 2024 | debug = function() {}; 2025 | } 2026 | exports.debug = debug; // for test 2027 | 2028 | 2029 | /***/ }), 2030 | 2031 | /***/ 840: 2032 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 2033 | 2034 | "use strict"; 2035 | 2036 | 2037 | Object.defineProperty(exports, "__esModule", ({ 2038 | value: true 2039 | })); 2040 | Object.defineProperty(exports, "v1", ({ 2041 | enumerable: true, 2042 | get: function () { 2043 | return _v.default; 2044 | } 2045 | })); 2046 | Object.defineProperty(exports, "v3", ({ 2047 | enumerable: true, 2048 | get: function () { 2049 | return _v2.default; 2050 | } 2051 | })); 2052 | Object.defineProperty(exports, "v4", ({ 2053 | enumerable: true, 2054 | get: function () { 2055 | return _v3.default; 2056 | } 2057 | })); 2058 | Object.defineProperty(exports, "v5", ({ 2059 | enumerable: true, 2060 | get: function () { 2061 | return _v4.default; 2062 | } 2063 | })); 2064 | Object.defineProperty(exports, "NIL", ({ 2065 | enumerable: true, 2066 | get: function () { 2067 | return _nil.default; 2068 | } 2069 | })); 2070 | Object.defineProperty(exports, "version", ({ 2071 | enumerable: true, 2072 | get: function () { 2073 | return _version.default; 2074 | } 2075 | })); 2076 | Object.defineProperty(exports, "validate", ({ 2077 | enumerable: true, 2078 | get: function () { 2079 | return _validate.default; 2080 | } 2081 | })); 2082 | Object.defineProperty(exports, "stringify", ({ 2083 | enumerable: true, 2084 | get: function () { 2085 | return _stringify.default; 2086 | } 2087 | })); 2088 | Object.defineProperty(exports, "parse", ({ 2089 | enumerable: true, 2090 | get: function () { 2091 | return _parse.default; 2092 | } 2093 | })); 2094 | 2095 | var _v = _interopRequireDefault(__nccwpck_require__(628)); 2096 | 2097 | var _v2 = _interopRequireDefault(__nccwpck_require__(409)); 2098 | 2099 | var _v3 = _interopRequireDefault(__nccwpck_require__(122)); 2100 | 2101 | var _v4 = _interopRequireDefault(__nccwpck_require__(120)); 2102 | 2103 | var _nil = _interopRequireDefault(__nccwpck_require__(332)); 2104 | 2105 | var _version = _interopRequireDefault(__nccwpck_require__(595)); 2106 | 2107 | var _validate = _interopRequireDefault(__nccwpck_require__(900)); 2108 | 2109 | var _stringify = _interopRequireDefault(__nccwpck_require__(950)); 2110 | 2111 | var _parse = _interopRequireDefault(__nccwpck_require__(746)); 2112 | 2113 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 2114 | 2115 | /***/ }), 2116 | 2117 | /***/ 569: 2118 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 2119 | 2120 | "use strict"; 2121 | 2122 | 2123 | Object.defineProperty(exports, "__esModule", ({ 2124 | value: true 2125 | })); 2126 | exports["default"] = void 0; 2127 | 2128 | var _crypto = _interopRequireDefault(__nccwpck_require__(113)); 2129 | 2130 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 2131 | 2132 | function md5(bytes) { 2133 | if (Array.isArray(bytes)) { 2134 | bytes = Buffer.from(bytes); 2135 | } else if (typeof bytes === 'string') { 2136 | bytes = Buffer.from(bytes, 'utf8'); 2137 | } 2138 | 2139 | return _crypto.default.createHash('md5').update(bytes).digest(); 2140 | } 2141 | 2142 | var _default = md5; 2143 | exports["default"] = _default; 2144 | 2145 | /***/ }), 2146 | 2147 | /***/ 332: 2148 | /***/ ((__unused_webpack_module, exports) => { 2149 | 2150 | "use strict"; 2151 | 2152 | 2153 | Object.defineProperty(exports, "__esModule", ({ 2154 | value: true 2155 | })); 2156 | exports["default"] = void 0; 2157 | var _default = '00000000-0000-0000-0000-000000000000'; 2158 | exports["default"] = _default; 2159 | 2160 | /***/ }), 2161 | 2162 | /***/ 746: 2163 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 2164 | 2165 | "use strict"; 2166 | 2167 | 2168 | Object.defineProperty(exports, "__esModule", ({ 2169 | value: true 2170 | })); 2171 | exports["default"] = void 0; 2172 | 2173 | var _validate = _interopRequireDefault(__nccwpck_require__(900)); 2174 | 2175 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 2176 | 2177 | function parse(uuid) { 2178 | if (!(0, _validate.default)(uuid)) { 2179 | throw TypeError('Invalid UUID'); 2180 | } 2181 | 2182 | let v; 2183 | const arr = new Uint8Array(16); // Parse ########-....-....-....-............ 2184 | 2185 | arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; 2186 | arr[1] = v >>> 16 & 0xff; 2187 | arr[2] = v >>> 8 & 0xff; 2188 | arr[3] = v & 0xff; // Parse ........-####-....-....-............ 2189 | 2190 | arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; 2191 | arr[5] = v & 0xff; // Parse ........-....-####-....-............ 2192 | 2193 | arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; 2194 | arr[7] = v & 0xff; // Parse ........-....-....-####-............ 2195 | 2196 | arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; 2197 | arr[9] = v & 0xff; // Parse ........-....-....-....-############ 2198 | // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes) 2199 | 2200 | arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff; 2201 | arr[11] = v / 0x100000000 & 0xff; 2202 | arr[12] = v >>> 24 & 0xff; 2203 | arr[13] = v >>> 16 & 0xff; 2204 | arr[14] = v >>> 8 & 0xff; 2205 | arr[15] = v & 0xff; 2206 | return arr; 2207 | } 2208 | 2209 | var _default = parse; 2210 | exports["default"] = _default; 2211 | 2212 | /***/ }), 2213 | 2214 | /***/ 814: 2215 | /***/ ((__unused_webpack_module, exports) => { 2216 | 2217 | "use strict"; 2218 | 2219 | 2220 | Object.defineProperty(exports, "__esModule", ({ 2221 | value: true 2222 | })); 2223 | exports["default"] = void 0; 2224 | var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; 2225 | exports["default"] = _default; 2226 | 2227 | /***/ }), 2228 | 2229 | /***/ 807: 2230 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 2231 | 2232 | "use strict"; 2233 | 2234 | 2235 | Object.defineProperty(exports, "__esModule", ({ 2236 | value: true 2237 | })); 2238 | exports["default"] = rng; 2239 | 2240 | var _crypto = _interopRequireDefault(__nccwpck_require__(113)); 2241 | 2242 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 2243 | 2244 | const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate 2245 | 2246 | let poolPtr = rnds8Pool.length; 2247 | 2248 | function rng() { 2249 | if (poolPtr > rnds8Pool.length - 16) { 2250 | _crypto.default.randomFillSync(rnds8Pool); 2251 | 2252 | poolPtr = 0; 2253 | } 2254 | 2255 | return rnds8Pool.slice(poolPtr, poolPtr += 16); 2256 | } 2257 | 2258 | /***/ }), 2259 | 2260 | /***/ 274: 2261 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 2262 | 2263 | "use strict"; 2264 | 2265 | 2266 | Object.defineProperty(exports, "__esModule", ({ 2267 | value: true 2268 | })); 2269 | exports["default"] = void 0; 2270 | 2271 | var _crypto = _interopRequireDefault(__nccwpck_require__(113)); 2272 | 2273 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 2274 | 2275 | function sha1(bytes) { 2276 | if (Array.isArray(bytes)) { 2277 | bytes = Buffer.from(bytes); 2278 | } else if (typeof bytes === 'string') { 2279 | bytes = Buffer.from(bytes, 'utf8'); 2280 | } 2281 | 2282 | return _crypto.default.createHash('sha1').update(bytes).digest(); 2283 | } 2284 | 2285 | var _default = sha1; 2286 | exports["default"] = _default; 2287 | 2288 | /***/ }), 2289 | 2290 | /***/ 950: 2291 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 2292 | 2293 | "use strict"; 2294 | 2295 | 2296 | Object.defineProperty(exports, "__esModule", ({ 2297 | value: true 2298 | })); 2299 | exports["default"] = void 0; 2300 | 2301 | var _validate = _interopRequireDefault(__nccwpck_require__(900)); 2302 | 2303 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 2304 | 2305 | /** 2306 | * Convert array of 16 byte values to UUID string format of the form: 2307 | * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX 2308 | */ 2309 | const byteToHex = []; 2310 | 2311 | for (let i = 0; i < 256; ++i) { 2312 | byteToHex.push((i + 0x100).toString(16).substr(1)); 2313 | } 2314 | 2315 | function stringify(arr, offset = 0) { 2316 | // Note: Be careful editing this code! It's been tuned for performance 2317 | // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 2318 | const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one 2319 | // of the following: 2320 | // - One or more input array values don't map to a hex octet (leading to 2321 | // "undefined" in the uuid) 2322 | // - Invalid input values for the RFC `version` or `variant` fields 2323 | 2324 | if (!(0, _validate.default)(uuid)) { 2325 | throw TypeError('Stringified UUID is invalid'); 2326 | } 2327 | 2328 | return uuid; 2329 | } 2330 | 2331 | var _default = stringify; 2332 | exports["default"] = _default; 2333 | 2334 | /***/ }), 2335 | 2336 | /***/ 628: 2337 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 2338 | 2339 | "use strict"; 2340 | 2341 | 2342 | Object.defineProperty(exports, "__esModule", ({ 2343 | value: true 2344 | })); 2345 | exports["default"] = void 0; 2346 | 2347 | var _rng = _interopRequireDefault(__nccwpck_require__(807)); 2348 | 2349 | var _stringify = _interopRequireDefault(__nccwpck_require__(950)); 2350 | 2351 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 2352 | 2353 | // **`v1()` - Generate time-based UUID** 2354 | // 2355 | // Inspired by https://github.com/LiosK/UUID.js 2356 | // and http://docs.python.org/library/uuid.html 2357 | let _nodeId; 2358 | 2359 | let _clockseq; // Previous uuid creation time 2360 | 2361 | 2362 | let _lastMSecs = 0; 2363 | let _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details 2364 | 2365 | function v1(options, buf, offset) { 2366 | let i = buf && offset || 0; 2367 | const b = buf || new Array(16); 2368 | options = options || {}; 2369 | let node = options.node || _nodeId; 2370 | let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not 2371 | // specified. We do this lazily to minimize issues related to insufficient 2372 | // system entropy. See #189 2373 | 2374 | if (node == null || clockseq == null) { 2375 | const seedBytes = options.random || (options.rng || _rng.default)(); 2376 | 2377 | if (node == null) { 2378 | // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) 2379 | node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; 2380 | } 2381 | 2382 | if (clockseq == null) { 2383 | // Per 4.2.2, randomize (14 bit) clockseq 2384 | clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; 2385 | } 2386 | } // UUID timestamps are 100 nano-second units since the Gregorian epoch, 2387 | // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so 2388 | // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' 2389 | // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. 2390 | 2391 | 2392 | let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock 2393 | // cycle to simulate higher resolution clock 2394 | 2395 | let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs) 2396 | 2397 | const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression 2398 | 2399 | if (dt < 0 && options.clockseq === undefined) { 2400 | clockseq = clockseq + 1 & 0x3fff; 2401 | } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new 2402 | // time interval 2403 | 2404 | 2405 | if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { 2406 | nsecs = 0; 2407 | } // Per 4.2.1.2 Throw error if too many uuids are requested 2408 | 2409 | 2410 | if (nsecs >= 10000) { 2411 | throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); 2412 | } 2413 | 2414 | _lastMSecs = msecs; 2415 | _lastNSecs = nsecs; 2416 | _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch 2417 | 2418 | msecs += 12219292800000; // `time_low` 2419 | 2420 | const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; 2421 | b[i++] = tl >>> 24 & 0xff; 2422 | b[i++] = tl >>> 16 & 0xff; 2423 | b[i++] = tl >>> 8 & 0xff; 2424 | b[i++] = tl & 0xff; // `time_mid` 2425 | 2426 | const tmh = msecs / 0x100000000 * 10000 & 0xfffffff; 2427 | b[i++] = tmh >>> 8 & 0xff; 2428 | b[i++] = tmh & 0xff; // `time_high_and_version` 2429 | 2430 | b[i++] = tmh >>> 24 & 0xf | 0x10; // include version 2431 | 2432 | b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) 2433 | 2434 | b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` 2435 | 2436 | b[i++] = clockseq & 0xff; // `node` 2437 | 2438 | for (let n = 0; n < 6; ++n) { 2439 | b[i + n] = node[n]; 2440 | } 2441 | 2442 | return buf || (0, _stringify.default)(b); 2443 | } 2444 | 2445 | var _default = v1; 2446 | exports["default"] = _default; 2447 | 2448 | /***/ }), 2449 | 2450 | /***/ 409: 2451 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 2452 | 2453 | "use strict"; 2454 | 2455 | 2456 | Object.defineProperty(exports, "__esModule", ({ 2457 | value: true 2458 | })); 2459 | exports["default"] = void 0; 2460 | 2461 | var _v = _interopRequireDefault(__nccwpck_require__(998)); 2462 | 2463 | var _md = _interopRequireDefault(__nccwpck_require__(569)); 2464 | 2465 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 2466 | 2467 | const v3 = (0, _v.default)('v3', 0x30, _md.default); 2468 | var _default = v3; 2469 | exports["default"] = _default; 2470 | 2471 | /***/ }), 2472 | 2473 | /***/ 998: 2474 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 2475 | 2476 | "use strict"; 2477 | 2478 | 2479 | Object.defineProperty(exports, "__esModule", ({ 2480 | value: true 2481 | })); 2482 | exports["default"] = _default; 2483 | exports.URL = exports.DNS = void 0; 2484 | 2485 | var _stringify = _interopRequireDefault(__nccwpck_require__(950)); 2486 | 2487 | var _parse = _interopRequireDefault(__nccwpck_require__(746)); 2488 | 2489 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 2490 | 2491 | function stringToBytes(str) { 2492 | str = unescape(encodeURIComponent(str)); // UTF8 escape 2493 | 2494 | const bytes = []; 2495 | 2496 | for (let i = 0; i < str.length; ++i) { 2497 | bytes.push(str.charCodeAt(i)); 2498 | } 2499 | 2500 | return bytes; 2501 | } 2502 | 2503 | const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; 2504 | exports.DNS = DNS; 2505 | const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'; 2506 | exports.URL = URL; 2507 | 2508 | function _default(name, version, hashfunc) { 2509 | function generateUUID(value, namespace, buf, offset) { 2510 | if (typeof value === 'string') { 2511 | value = stringToBytes(value); 2512 | } 2513 | 2514 | if (typeof namespace === 'string') { 2515 | namespace = (0, _parse.default)(namespace); 2516 | } 2517 | 2518 | if (namespace.length !== 16) { 2519 | throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)'); 2520 | } // Compute hash of namespace and value, Per 4.3 2521 | // Future: Use spread syntax when supported on all platforms, e.g. `bytes = 2522 | // hashfunc([...namespace, ... value])` 2523 | 2524 | 2525 | let bytes = new Uint8Array(16 + value.length); 2526 | bytes.set(namespace); 2527 | bytes.set(value, namespace.length); 2528 | bytes = hashfunc(bytes); 2529 | bytes[6] = bytes[6] & 0x0f | version; 2530 | bytes[8] = bytes[8] & 0x3f | 0x80; 2531 | 2532 | if (buf) { 2533 | offset = offset || 0; 2534 | 2535 | for (let i = 0; i < 16; ++i) { 2536 | buf[offset + i] = bytes[i]; 2537 | } 2538 | 2539 | return buf; 2540 | } 2541 | 2542 | return (0, _stringify.default)(bytes); 2543 | } // Function#name is not settable on some platforms (#270) 2544 | 2545 | 2546 | try { 2547 | generateUUID.name = name; // eslint-disable-next-line no-empty 2548 | } catch (err) {} // For CommonJS default export support 2549 | 2550 | 2551 | generateUUID.DNS = DNS; 2552 | generateUUID.URL = URL; 2553 | return generateUUID; 2554 | } 2555 | 2556 | /***/ }), 2557 | 2558 | /***/ 122: 2559 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 2560 | 2561 | "use strict"; 2562 | 2563 | 2564 | Object.defineProperty(exports, "__esModule", ({ 2565 | value: true 2566 | })); 2567 | exports["default"] = void 0; 2568 | 2569 | var _rng = _interopRequireDefault(__nccwpck_require__(807)); 2570 | 2571 | var _stringify = _interopRequireDefault(__nccwpck_require__(950)); 2572 | 2573 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 2574 | 2575 | function v4(options, buf, offset) { 2576 | options = options || {}; 2577 | 2578 | const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` 2579 | 2580 | 2581 | rnds[6] = rnds[6] & 0x0f | 0x40; 2582 | rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided 2583 | 2584 | if (buf) { 2585 | offset = offset || 0; 2586 | 2587 | for (let i = 0; i < 16; ++i) { 2588 | buf[offset + i] = rnds[i]; 2589 | } 2590 | 2591 | return buf; 2592 | } 2593 | 2594 | return (0, _stringify.default)(rnds); 2595 | } 2596 | 2597 | var _default = v4; 2598 | exports["default"] = _default; 2599 | 2600 | /***/ }), 2601 | 2602 | /***/ 120: 2603 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 2604 | 2605 | "use strict"; 2606 | 2607 | 2608 | Object.defineProperty(exports, "__esModule", ({ 2609 | value: true 2610 | })); 2611 | exports["default"] = void 0; 2612 | 2613 | var _v = _interopRequireDefault(__nccwpck_require__(998)); 2614 | 2615 | var _sha = _interopRequireDefault(__nccwpck_require__(274)); 2616 | 2617 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 2618 | 2619 | const v5 = (0, _v.default)('v5', 0x50, _sha.default); 2620 | var _default = v5; 2621 | exports["default"] = _default; 2622 | 2623 | /***/ }), 2624 | 2625 | /***/ 900: 2626 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 2627 | 2628 | "use strict"; 2629 | 2630 | 2631 | Object.defineProperty(exports, "__esModule", ({ 2632 | value: true 2633 | })); 2634 | exports["default"] = void 0; 2635 | 2636 | var _regex = _interopRequireDefault(__nccwpck_require__(814)); 2637 | 2638 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 2639 | 2640 | function validate(uuid) { 2641 | return typeof uuid === 'string' && _regex.default.test(uuid); 2642 | } 2643 | 2644 | var _default = validate; 2645 | exports["default"] = _default; 2646 | 2647 | /***/ }), 2648 | 2649 | /***/ 595: 2650 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 2651 | 2652 | "use strict"; 2653 | 2654 | 2655 | Object.defineProperty(exports, "__esModule", ({ 2656 | value: true 2657 | })); 2658 | exports["default"] = void 0; 2659 | 2660 | var _validate = _interopRequireDefault(__nccwpck_require__(900)); 2661 | 2662 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 2663 | 2664 | function version(uuid) { 2665 | if (!(0, _validate.default)(uuid)) { 2666 | throw TypeError('Invalid UUID'); 2667 | } 2668 | 2669 | return parseInt(uuid.substr(14, 1), 16); 2670 | } 2671 | 2672 | var _default = version; 2673 | exports["default"] = _default; 2674 | 2675 | /***/ }), 2676 | 2677 | /***/ 491: 2678 | /***/ ((module) => { 2679 | 2680 | "use strict"; 2681 | module.exports = require("assert"); 2682 | 2683 | /***/ }), 2684 | 2685 | /***/ 81: 2686 | /***/ ((module) => { 2687 | 2688 | "use strict"; 2689 | module.exports = require("child_process"); 2690 | 2691 | /***/ }), 2692 | 2693 | /***/ 113: 2694 | /***/ ((module) => { 2695 | 2696 | "use strict"; 2697 | module.exports = require("crypto"); 2698 | 2699 | /***/ }), 2700 | 2701 | /***/ 361: 2702 | /***/ ((module) => { 2703 | 2704 | "use strict"; 2705 | module.exports = require("events"); 2706 | 2707 | /***/ }), 2708 | 2709 | /***/ 147: 2710 | /***/ ((module) => { 2711 | 2712 | "use strict"; 2713 | module.exports = require("fs"); 2714 | 2715 | /***/ }), 2716 | 2717 | /***/ 685: 2718 | /***/ ((module) => { 2719 | 2720 | "use strict"; 2721 | module.exports = require("http"); 2722 | 2723 | /***/ }), 2724 | 2725 | /***/ 687: 2726 | /***/ ((module) => { 2727 | 2728 | "use strict"; 2729 | module.exports = require("https"); 2730 | 2731 | /***/ }), 2732 | 2733 | /***/ 808: 2734 | /***/ ((module) => { 2735 | 2736 | "use strict"; 2737 | module.exports = require("net"); 2738 | 2739 | /***/ }), 2740 | 2741 | /***/ 37: 2742 | /***/ ((module) => { 2743 | 2744 | "use strict"; 2745 | module.exports = require("os"); 2746 | 2747 | /***/ }), 2748 | 2749 | /***/ 17: 2750 | /***/ ((module) => { 2751 | 2752 | "use strict"; 2753 | module.exports = require("path"); 2754 | 2755 | /***/ }), 2756 | 2757 | /***/ 404: 2758 | /***/ ((module) => { 2759 | 2760 | "use strict"; 2761 | module.exports = require("tls"); 2762 | 2763 | /***/ }), 2764 | 2765 | /***/ 837: 2766 | /***/ ((module) => { 2767 | 2768 | "use strict"; 2769 | module.exports = require("util"); 2770 | 2771 | /***/ }) 2772 | 2773 | /******/ }); 2774 | /************************************************************************/ 2775 | /******/ // The module cache 2776 | /******/ var __webpack_module_cache__ = {}; 2777 | /******/ 2778 | /******/ // The require function 2779 | /******/ function __nccwpck_require__(moduleId) { 2780 | /******/ // Check if module is in cache 2781 | /******/ var cachedModule = __webpack_module_cache__[moduleId]; 2782 | /******/ if (cachedModule !== undefined) { 2783 | /******/ return cachedModule.exports; 2784 | /******/ } 2785 | /******/ // Create a new module (and put it into the cache) 2786 | /******/ var module = __webpack_module_cache__[moduleId] = { 2787 | /******/ // no module.id needed 2788 | /******/ // no module.loaded needed 2789 | /******/ exports: {} 2790 | /******/ }; 2791 | /******/ 2792 | /******/ // Execute the module function 2793 | /******/ var threw = true; 2794 | /******/ try { 2795 | /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nccwpck_require__); 2796 | /******/ threw = false; 2797 | /******/ } finally { 2798 | /******/ if(threw) delete __webpack_module_cache__[moduleId]; 2799 | /******/ } 2800 | /******/ 2801 | /******/ // Return the exports of the module 2802 | /******/ return module.exports; 2803 | /******/ } 2804 | /******/ 2805 | /************************************************************************/ 2806 | /******/ /* webpack/runtime/compat */ 2807 | /******/ 2808 | /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; 2809 | /******/ 2810 | /************************************************************************/ 2811 | var __webpack_exports__ = {}; 2812 | // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. 2813 | (() => { 2814 | // Generated by Haxe 4.3.6 2815 | (function ($global) { "use strict"; 2816 | function Command_runCallbackInDir(dir,func) { 2817 | let oldCwd = haxe_io_Path.addTrailingSlash(process.cwd()); 2818 | Command_cd(dir); 2819 | let result = func(); 2820 | Command_cd(oldCwd); 2821 | return result; 2822 | } 2823 | function Command_cd(dir) { 2824 | process.stdout.write(Std.string("cd " + dir)); 2825 | process.stdout.write("\n"); 2826 | if(!Command_dryRun) { 2827 | process.chdir(dir); 2828 | } 2829 | } 2830 | function Command_runUntilFailure(methods) { 2831 | let _g = 0; 2832 | while(_g < methods.length) if(methods[_g++]() != 0) { 2833 | return 1; 2834 | } 2835 | return 0; 2836 | } 2837 | function Command_runAll(methods) { 2838 | let result = 0; 2839 | let _g = 0; 2840 | while(_g < methods.length) if(methods[_g++]() != 0) { 2841 | result = 1; 2842 | } 2843 | return result; 2844 | } 2845 | function Command_runAllNamed(methods) { 2846 | let result = 0; 2847 | let _g = 0; 2848 | while(_g < methods.length) { 2849 | let method = methods[_g]; 2850 | ++_g; 2851 | if(!method.active) { 2852 | continue; 2853 | } 2854 | actions_Core.startGroup(method.name); 2855 | if(method.run() != 0) { 2856 | result = 1; 2857 | } 2858 | actions_Core.endGroup(); 2859 | } 2860 | return result; 2861 | } 2862 | function Command_run(cmd,args) { 2863 | let v = args == null ? "" : args.join(" "); 2864 | process.stdout.write(Std.string("> " + cmd + " " + v)); 2865 | process.stdout.write("\n"); 2866 | if(Command_dryRun) { 2867 | return 0; 2868 | } 2869 | if(args == null) { 2870 | return js_node_ChildProcess.spawnSync(cmd,{ shell : true, stdio : "inherit"}).status; 2871 | } else { 2872 | return js_node_ChildProcess.spawnSync(cmd,args,{ stdio : "inherit"}).status; 2873 | } 2874 | } 2875 | function Command_putEnv(s,v) { 2876 | process.stdout.write(Std.string("Sys.putEnv(\"" + s + "\", \"" + v + "\")")); 2877 | process.stdout.write("\n"); 2878 | if(!Command_dryRun) { 2879 | if(v == null) { 2880 | Reflect.deleteField(process.env,s); 2881 | } else { 2882 | process.env[s] = v; 2883 | } 2884 | } 2885 | } 2886 | function Flixel_buildProjects(target,args) { 2887 | return Haxelib_run(["flixel-tools","bp",target].concat(args)); 2888 | } 2889 | function Haxelib_run(args) { 2890 | return Command_run("haxelib",["run"].concat(args)); 2891 | } 2892 | function Haxelib_fromVersion(defaultUser,lib,version) { 2893 | if(version == null) { 2894 | return Haxelib_install(lib); 2895 | } else { 2896 | switch(version) { 2897 | case "":case "release": 2898 | return Haxelib_install(lib); 2899 | case "dev": 2900 | return Haxelib_git(defaultUser,lib); 2901 | default: 2902 | return Haxelib_install(lib,version); 2903 | } 2904 | } 2905 | } 2906 | function Haxelib_install(lib,version) { 2907 | let args = ["install",lib]; 2908 | if(version != null) { 2909 | args.push(version); 2910 | } 2911 | args.push("--quiet"); 2912 | args.push("--global"); 2913 | return Command_run("haxelib",args); 2914 | } 2915 | function Haxelib_git(user,haxelib,githubLib,branch,path) { 2916 | if(githubLib == null) { 2917 | githubLib = haxelib; 2918 | } 2919 | let args = ["git",haxelib,"https://github.com/" + user + "/" + githubLib]; 2920 | if(branch != null) { 2921 | args.push(branch); 2922 | } 2923 | if(path != null) { 2924 | args.push(path); 2925 | } 2926 | args.push("--quiet"); 2927 | args.push("--global"); 2928 | return Command_run("haxelib",args); 2929 | } 2930 | class HxOverrides { 2931 | static cca(s,index) { 2932 | let x = s.charCodeAt(index); 2933 | if(x != x) { 2934 | return undefined; 2935 | } 2936 | return x; 2937 | } 2938 | static now() { 2939 | return Date.now(); 2940 | } 2941 | } 2942 | HxOverrides.__name__ = true; 2943 | class haxe_io_Path { 2944 | static join(paths) { 2945 | let _g = []; 2946 | let _g1 = 0; 2947 | while(_g1 < paths.length) { 2948 | let v = paths[_g1]; 2949 | ++_g1; 2950 | if(v != null && v != "") { 2951 | _g.push(v); 2952 | } 2953 | } 2954 | if(_g.length == 0) { 2955 | return ""; 2956 | } 2957 | let path = _g[0]; 2958 | let _g2 = 1; 2959 | let _g3 = _g.length; 2960 | while(_g2 < _g3) { 2961 | path = haxe_io_Path.addTrailingSlash(path); 2962 | path += _g[_g2++]; 2963 | } 2964 | return haxe_io_Path.normalize(path); 2965 | } 2966 | static normalize(path) { 2967 | let slash = "/"; 2968 | path = path.split("\\").join(slash); 2969 | if(path == slash) { 2970 | return slash; 2971 | } 2972 | let target = []; 2973 | let _g = 0; 2974 | let _g1 = path.split(slash); 2975 | while(_g < _g1.length) { 2976 | let token = _g1[_g]; 2977 | ++_g; 2978 | if(token == ".." && target.length > 0 && target[target.length - 1] != "..") { 2979 | target.pop(); 2980 | } else if(token == "") { 2981 | if(target.length > 0 || HxOverrides.cca(path,0) == 47) { 2982 | target.push(token); 2983 | } 2984 | } else if(token != ".") { 2985 | target.push(token); 2986 | } 2987 | } 2988 | let acc_b = ""; 2989 | let colon = false; 2990 | let slashes = false; 2991 | let _g_offset = 0; 2992 | let _g_s = target.join(slash); 2993 | while(_g_offset < _g_s.length) { 2994 | let s = _g_s; 2995 | let index = _g_offset++; 2996 | let c = s.charCodeAt(index); 2997 | if(c >= 55296 && c <= 56319) { 2998 | c = c - 55232 << 10 | s.charCodeAt(index + 1) & 1023; 2999 | } 3000 | let c1 = c; 3001 | if(c1 >= 65536) { 3002 | ++_g_offset; 3003 | } 3004 | let c2 = c1; 3005 | switch(c2) { 3006 | case 47: 3007 | if(!colon) { 3008 | slashes = true; 3009 | } else { 3010 | let i = c2; 3011 | colon = false; 3012 | if(slashes) { 3013 | acc_b += "/"; 3014 | slashes = false; 3015 | } 3016 | acc_b += String.fromCodePoint(i); 3017 | } 3018 | break; 3019 | case 58: 3020 | acc_b += ":"; 3021 | colon = true; 3022 | break; 3023 | default: 3024 | let i = c2; 3025 | colon = false; 3026 | if(slashes) { 3027 | acc_b += "/"; 3028 | slashes = false; 3029 | } 3030 | acc_b += String.fromCodePoint(i); 3031 | } 3032 | } 3033 | return acc_b; 3034 | } 3035 | static addTrailingSlash(path) { 3036 | if(path.length == 0) { 3037 | return "/"; 3038 | } 3039 | let c1 = path.lastIndexOf("/"); 3040 | let c2 = path.lastIndexOf("\\"); 3041 | if(c1 < c2) { 3042 | if(c2 != path.length - 1) { 3043 | return path + "\\"; 3044 | } else { 3045 | return path; 3046 | } 3047 | } else if(c1 != path.length - 1) { 3048 | return path + "/"; 3049 | } else { 3050 | return path; 3051 | } 3052 | } 3053 | } 3054 | haxe_io_Path.__name__ = true; 3055 | class Std { 3056 | static string(s) { 3057 | return js_Boot.__string_rec(s,""); 3058 | } 3059 | } 3060 | Std.__name__ = true; 3061 | class js_Boot { 3062 | static __string_rec(o,s) { 3063 | if(o == null) { 3064 | return "null"; 3065 | } 3066 | if(s.length >= 5) { 3067 | return "<...>"; 3068 | } 3069 | let t = typeof(o); 3070 | if(t == "function" && (o.__name__ || o.__ename__)) { 3071 | t = "object"; 3072 | } 3073 | switch(t) { 3074 | case "function": 3075 | return ""; 3076 | case "object": 3077 | if(((o) instanceof Array)) { 3078 | let str = "["; 3079 | s += "\t"; 3080 | let _g = 0; 3081 | let _g1 = o.length; 3082 | while(_g < _g1) { 3083 | let i = _g++; 3084 | str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); 3085 | } 3086 | str += "]"; 3087 | return str; 3088 | } 3089 | let tostr; 3090 | try { 3091 | tostr = o.toString; 3092 | } catch( _g ) { 3093 | return "???"; 3094 | } 3095 | if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { 3096 | let s2 = o.toString(); 3097 | if(s2 != "[object Object]") { 3098 | return s2; 3099 | } 3100 | } 3101 | let str = "{\n"; 3102 | s += "\t"; 3103 | let hasp = o.hasOwnProperty != null; 3104 | let k = null; 3105 | for( k in o ) { 3106 | if(hasp && !o.hasOwnProperty(k)) { 3107 | continue; 3108 | } 3109 | if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { 3110 | continue; 3111 | } 3112 | if(str.length != 2) { 3113 | str += ", \n"; 3114 | } 3115 | str += s + k + " : " + js_Boot.__string_rec(o[k],s); 3116 | } 3117 | s = s.substring(1); 3118 | str += "\n" + s + "}"; 3119 | return str; 3120 | case "string": 3121 | return o; 3122 | default: 3123 | return String(o); 3124 | } 3125 | } 3126 | } 3127 | js_Boot.__name__ = true; 3128 | function Main_main() { 3129 | let limeVersion = actions_Core.getInput("lime-version"); 3130 | let openflVersion = actions_Core.getInput("openfl-version"); 3131 | let flixelVersions = actions_Core.getInput("flixel-versions"); 3132 | let testLocation = actions_Core.getInput("test-location"); 3133 | let target = actions_Core.getInput("target"); 3134 | let runTests = actions_Core.getInput("run-tests") == "true"; 3135 | actions_Core.startGroup("Installing Haxe Dependencies"); 3136 | let cmd = "sudo add-apt-repository ppa:haxe/snapshots -y"; 3137 | let cmd1 = "sudo apt-get install --fix-missing"; 3138 | let cmd2 = "sudo apt-get upgrade"; 3139 | let cmd3 = "sudo apt-get install neko -y"; 3140 | let limeVersion1 = limeVersion; 3141 | let openflVersion1 = openflVersion; 3142 | let flixelVersions1 = flixelVersions; 3143 | let target1 = target; 3144 | if(Command_runUntilFailure([function() { 3145 | return Command_run(cmd); 3146 | },function() { 3147 | return Command_run(cmd1); 3148 | },function() { 3149 | return Command_run(cmd2); 3150 | },function() { 3151 | return Command_run(cmd3); 3152 | },function() { 3153 | return Main_installHaxelibs(limeVersion1,openflVersion1,flixelVersions1); 3154 | },function() { 3155 | return Main_installHxcpp(target1); 3156 | }]) != 0) { 3157 | process.exit(1); 3158 | } 3159 | actions_Core.exportVariable("HAXELIB_REPO",Main_HaxelibRepo); 3160 | actions_Core.endGroup(); 3161 | actions_Core.startGroup("Listing Dependencies"); 3162 | Command_run("haxe -version"); 3163 | Command_run("neko -version"); 3164 | Command_run("haxelib version"); 3165 | Command_run("haxelib config"); 3166 | Command_run("haxelib fixrepo"); 3167 | Command_run("haxelib list"); 3168 | actions_Core.endGroup(); 3169 | if(runTests) { 3170 | actions_Core.startGroup("Test Preparation"); 3171 | if(testLocation == "local") { 3172 | Command_cd("tests"); 3173 | } else { 3174 | Command_cd(haxe_io_Path.join([Main_HaxelibRepo,"flixel/git/tests"])); 3175 | } 3176 | Command_putEnv("HXCPP_SILENT","1"); 3177 | Command_putEnv("HXCPP_COMPILE_CACHE",process.env["HOME"] + "/hxcpp_cache"); 3178 | Command_putEnv("HXCPP_CACHE_MB","5000"); 3179 | Command_putEnv("HXCPP_CATCH_SEGV","1"); 3180 | actions_Core.endGroup(); 3181 | let code = Command_runAllNamed(Tests_make(target)); 3182 | process.exit(code); 3183 | } 3184 | } 3185 | function Main_installHaxelibs(limeVersion,openflVersion,flixelVersions) { 3186 | let user = "GeoKureli"; 3187 | let haxelib = "munit"; 3188 | let githubLib = "MassiveUnit"; 3189 | let branch = "haxe4-3"; 3190 | let path = "src"; 3191 | let user1 = "GeoKureli"; 3192 | let haxelib1 = "hamcrest"; 3193 | let githubLib1 = "hamcrest-haxe"; 3194 | let branch1 = "master"; 3195 | let path1 = "src"; 3196 | let lib = "systools"; 3197 | let lib1 = "task"; 3198 | let lib2 = "poly2trihx"; 3199 | let lib3 = "nape-haxe4"; 3200 | let lib4 = "haxeui-core"; 3201 | let lib5 = "haxeui-flixel"; 3202 | let user2 = "HaxeFoundation"; 3203 | let haxelib2 = "hscript"; 3204 | let user3 = "larsiusprime"; 3205 | let haxelib3 = "firetongue"; 3206 | let user4 = "Geokureli"; 3207 | let haxelib4 = "spinehaxe"; 3208 | let githubLib2 = "spinehaxe"; 3209 | let branch2 = "haxe4.3.1"; 3210 | let user5 = "larsiusprime"; 3211 | let haxelib5 = "steamwrap"; 3212 | let defaultUser = "openfl"; 3213 | let lib6 = "lime"; 3214 | let version = limeVersion; 3215 | let defaultUser1 = "openfl"; 3216 | let lib7 = "openfl"; 3217 | let version1 = openflVersion; 3218 | let defaultUser2 = "HaxeFlixel"; 3219 | let lib8 = "flixel"; 3220 | let version2 = flixelVersions; 3221 | let defaultUser3 = "HaxeFlixel"; 3222 | let lib9 = "flixel-tools"; 3223 | let version3 = flixelVersions; 3224 | let defaultUser4 = "HaxeFlixel"; 3225 | let lib10 = "flixel-templates"; 3226 | let version4 = flixelVersions; 3227 | let defaultUser5 = "HaxeFlixel"; 3228 | let lib11 = "flixel-demos"; 3229 | let version5 = flixelVersions; 3230 | let defaultUser6 = "HaxeFlixel"; 3231 | let lib12 = "flixel-addons"; 3232 | let version6 = flixelVersions; 3233 | let defaultUser7 = "HaxeFlixel"; 3234 | let lib13 = "flixel-ui"; 3235 | let version7 = flixelVersions; 3236 | let libs = [function() { 3237 | return Haxelib_git(user,haxelib,githubLib,branch,path); 3238 | },function() { 3239 | return Haxelib_git(user1,haxelib1,githubLib1,branch1,path1); 3240 | },function() { 3241 | return Haxelib_install(lib); 3242 | },function() { 3243 | return Haxelib_install(lib1); 3244 | },function() { 3245 | return Haxelib_install(lib2); 3246 | },function() { 3247 | return Haxelib_install(lib3); 3248 | },function() { 3249 | return Haxelib_install(lib4); 3250 | },function() { 3251 | return Haxelib_install(lib5); 3252 | },function() { 3253 | return Haxelib_git(user2,haxelib2); 3254 | },function() { 3255 | return Haxelib_git(user3,haxelib3); 3256 | },function() { 3257 | return Haxelib_git(user4,haxelib4,githubLib2,branch2); 3258 | },function() { 3259 | return Haxelib_git(user5,haxelib5); 3260 | },function() { 3261 | return Haxelib_fromVersion(defaultUser,lib6,version); 3262 | },function() { 3263 | return Haxelib_fromVersion(defaultUser1,lib7,version1); 3264 | },function() { 3265 | return Haxelib_fromVersion(defaultUser2,lib8,version2); 3266 | },function() { 3267 | return Haxelib_fromVersion(defaultUser3,lib9,version3); 3268 | },function() { 3269 | return Haxelib_fromVersion(defaultUser4,lib10,version4); 3270 | },function() { 3271 | return Haxelib_fromVersion(defaultUser5,lib11,version5); 3272 | },function() { 3273 | return Haxelib_fromVersion(defaultUser6,lib12,version6); 3274 | },function() { 3275 | return Haxelib_fromVersion(defaultUser7,lib13,version7); 3276 | }]; 3277 | if(limeVersion == "dev") { 3278 | let lib = "format"; 3279 | libs.push(function() { 3280 | return Haxelib_install(lib); 3281 | }); 3282 | let lib1 = "hxp"; 3283 | libs.push(function() { 3284 | return Haxelib_install(lib1); 3285 | }); 3286 | } 3287 | return Command_runUntilFailure(libs); 3288 | } 3289 | function Main_installHxcpp(target) { 3290 | if(target != "cpp") { 3291 | return 0; 3292 | } 3293 | return Haxelib_install("hxcpp"); 3294 | } 3295 | Math.__name__ = true; 3296 | function OpenFL_build(path,target,define) { 3297 | return OpenFL_run("build",path,target,define); 3298 | } 3299 | function OpenFL_run(operation,path,target,define) { 3300 | let args = ["openfl",operation,path,target]; 3301 | if(define != null) { 3302 | args.push("-D" + define); 3303 | } 3304 | return Haxelib_run(args); 3305 | } 3306 | class Reflect { 3307 | static deleteField(o,field) { 3308 | if(!Object.prototype.hasOwnProperty.call(o,field)) { 3309 | return false; 3310 | } 3311 | delete(o[field]); 3312 | return true; 3313 | } 3314 | } 3315 | Reflect.__name__ = true; 3316 | function Tests_make(target) { 3317 | let target1 = target; 3318 | let target2 = target; 3319 | let tmp = function() { 3320 | return Tests_buildCoverageTests(target2); 3321 | }; 3322 | let target3 = target; 3323 | let tmp1 = function() { 3324 | return Tests_buildSwfVersionTests(target3); 3325 | }; 3326 | let target4 = target; 3327 | let tmp2 = function() { 3328 | return Tests_buildDemos(target4); 3329 | }; 3330 | let target5 = target; 3331 | let tmp3 = function() { 3332 | return Tests_buildSnippetsDemos(target5); 3333 | }; 3334 | return [{ name : "Running Unit Tests", run : function() { 3335 | return Tests_runUnitTests(target1); 3336 | }, active : true},{ name : "Building Coverage Tests", run : tmp, active : true},{ name : "Building SWF Version Tests", run : tmp1, active : target == "flash"},{ name : "Building flixel-demos", run : tmp2, active : true},{ name : "Building snippets.haxeflixel.com Demos", run : tmp3, active : target != "cpp"}]; 3337 | } 3338 | function Tests_runUnitTests(target) { 3339 | let args = ["munit","gen"]; 3340 | Command_runCallbackInDir("unit",function() { 3341 | return Haxelib_run(args); 3342 | }); 3343 | if(target == "cpp") { 3344 | process.stdout.write("Running unit tests...\n"); 3345 | process.stdout.write("\n"); 3346 | return OpenFL_run("test","unit",target,"travis"); 3347 | } else { 3348 | process.stdout.write(Std.string("Cannot run tests on " + target + ", building instead\n")); 3349 | process.stdout.write("\n"); 3350 | process.stdout.write("Building unit tests...\n"); 3351 | process.stdout.write("\n"); 3352 | return OpenFL_build("unit",target); 3353 | } 3354 | } 3355 | function Tests_buildCoverageTests(target) { 3356 | process.stdout.write("\nBuilding coverage tests...\n"); 3357 | process.stdout.write("\n"); 3358 | let path = "coverage"; 3359 | let target1 = target; 3360 | let define = "coverage1"; 3361 | let path1 = "coverage"; 3362 | let target2 = target; 3363 | let define1 = "coverage2"; 3364 | let path2 = "coverage"; 3365 | let target3 = target; 3366 | let define2 = "coverage3"; 3367 | return Command_runAll([function() { 3368 | return OpenFL_build(path,target1,define); 3369 | },function() { 3370 | return OpenFL_build(path1,target2,define1); 3371 | },function() { 3372 | return OpenFL_build(path2,target3,define2); 3373 | }]); 3374 | } 3375 | function Tests_buildDemos(target,demos,args) { 3376 | let tmp = args; 3377 | args = tmp != null ? tmp : []; 3378 | if(demos != null) { 3379 | let v = "\nBuilding " + demos.length + " demo(s)...\n"; 3380 | process.stdout.write(Std.string(v)); 3381 | process.stdout.write("\n"); 3382 | } else if(target == "cpp") { 3383 | demos = Tests_CppDemos; 3384 | let v = "\nSkipping some demos due to cpp build times\nBuilding " + demos.length + " demo(s)...\n"; 3385 | process.stdout.write(Std.string(v)); 3386 | process.stdout.write("\n"); 3387 | } else { 3388 | process.stdout.write("\nBuilding all demos...\n"); 3389 | process.stdout.write("\n"); 3390 | demos = []; 3391 | } 3392 | return Flixel_buildProjects(target,demos.concat(args)); 3393 | } 3394 | function Tests_buildSnippetsDemos(target) { 3395 | process.stdout.write("\nBuilding spnippets demos...\n"); 3396 | process.stdout.write("\n"); 3397 | Command_run("git",["clone","https://github.com/HaxeFlixel/snippets.haxeflixel.com"]); 3398 | return Flixel_buildProjects(target,["-dir","snippets.haxeflixel.com"]); 3399 | } 3400 | function Tests_buildSwfVersionTests(target) { 3401 | process.stdout.write("\nBuilding swf version tests...\n"); 3402 | process.stdout.write("\n"); 3403 | let path = "swfVersion/11"; 3404 | let target1 = target; 3405 | let path1 = "swfVersion/11_2"; 3406 | let target2 = target; 3407 | return Command_runAll([function() { 3408 | return OpenFL_build(path,target1); 3409 | },function() { 3410 | return OpenFL_build(path1,target2); 3411 | }]); 3412 | } 3413 | var actions_Core = __nccwpck_require__(186); 3414 | class haxe_iterators_ArrayIterator { 3415 | constructor(array) { 3416 | this.current = 0; 3417 | this.array = array; 3418 | } 3419 | hasNext() { 3420 | return this.current < this.array.length; 3421 | } 3422 | next() { 3423 | return this.array[this.current++]; 3424 | } 3425 | } 3426 | haxe_iterators_ArrayIterator.__name__ = true; 3427 | var js_node_ChildProcess = __nccwpck_require__(81); 3428 | if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { 3429 | HxOverrides.now = performance.now.bind(performance); 3430 | } 3431 | if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } 3432 | { 3433 | String.__name__ = true; 3434 | Array.__name__ = true; 3435 | } 3436 | js_Boot.__toStr = ({ }).toString; 3437 | var Command_dryRun = false; 3438 | var Main_HaxelibRepo = haxe_io_Path.join([process.env["HOME"],"haxe/haxelib"]); 3439 | var Tests_CppDemos = ["Mode","Flixius","MinimalistTD","TurnBasedRPG"]; 3440 | Main_main(); 3441 | })({}); 3442 | 3443 | })(); 3444 | 3445 | module.exports = __webpack_exports__; 3446 | /******/ })() 3447 | ; -------------------------------------------------------------------------------- /haxe_libraries/hxnodejs.hxml: -------------------------------------------------------------------------------- 1 | # @install: lix --silent download "haxelib:/hxnodejs#12.0.0" into hxnodejs/12.0.0/haxelib 2 | -cp ${HAXE_LIBCACHE}/hxnodejs/12.0.0/haxelib/src 3 | -D hxnodejs=12.0.0 4 | --macro allowPackage('sys') 5 | # should behave like other target defines and not be defined in macro context 6 | --macro define('nodejs') 7 | -------------------------------------------------------------------------------- /hxformat.json: -------------------------------------------------------------------------------- 1 | { 2 | "lineEnds": { 3 | "leftCurly": "both", 4 | "rightCurly": "both", 5 | "objectLiteralCurly": { 6 | "leftCurly": "after" 7 | } 8 | }, 9 | "sameLine": { 10 | "ifElse": "next", 11 | "doWhile": "next", 12 | "tryBody": "next", 13 | "tryCatch": "next" 14 | }, 15 | "indentation":{ 16 | "trailingWhitespace": true 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "setup-flixel", 3 | "lockfileVersion": 2, 4 | "requires": true, 5 | "packages": { 6 | "": { 7 | "hasInstallScript": true, 8 | "devDependencies": { 9 | "@actions/core": "^1.9.1", 10 | "@vercel/ncc": "^0.38.1", 11 | "dts2hx": "^0.15.3", 12 | "lix": "^15.10.1" 13 | } 14 | }, 15 | "node_modules/@actions/core": { 16 | "version": "1.9.1", 17 | "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.9.1.tgz", 18 | "integrity": "sha512-5ad+U2YGrmmiw6du20AQW5XuWo7UKN2052FjSV7MX+Wfjf8sCqcsZe62NfgHys4QI4/Y+vQvLKYL8jWtA1ZBTA==", 19 | "dev": true, 20 | "dependencies": { 21 | "@actions/http-client": "^2.0.1", 22 | "uuid": "^8.3.2" 23 | } 24 | }, 25 | "node_modules/@actions/http-client": { 26 | "version": "2.0.1", 27 | "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz", 28 | "integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==", 29 | "dev": true, 30 | "dependencies": { 31 | "tunnel": "^0.0.6" 32 | } 33 | }, 34 | "node_modules/@vercel/ncc": { 35 | "version": "0.38.1", 36 | "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.1.tgz", 37 | "integrity": "sha512-IBBb+iI2NLu4VQn3Vwldyi2QwaXt5+hTyh58ggAMoCGE6DJmPvwL3KPBWcJl1m9LYPChBLE980Jw+CS4Wokqxw==", 38 | "dev": true, 39 | "bin": { 40 | "ncc": "dist/ncc/cli.js" 41 | } 42 | }, 43 | "node_modules/dts2hx": { 44 | "version": "0.15.3", 45 | "resolved": "https://registry.npmjs.org/dts2hx/-/dts2hx-0.15.3.tgz", 46 | "integrity": "sha512-5CFCfCLPnKfxMSLBB8JVVkKdUX//DXx7+maabjr0JZlVlLsxXFR8oL/6RhN9ppIkA55rWypLE8288EY73nlHSg==", 47 | "dev": true, 48 | "dependencies": { 49 | "typescript": "3.7.4" 50 | }, 51 | "bin": { 52 | "dts2hx": "cli.js" 53 | } 54 | }, 55 | "node_modules/lix": { 56 | "version": "15.10.1", 57 | "resolved": "https://registry.npmjs.org/lix/-/lix-15.10.1.tgz", 58 | "integrity": "sha512-UZX+p4i+2ZSEyI6p2Yu1sfC0pRRFnFHDpNQ2+FqhxmBG8cCiHZkj+I8FqCK4AUuQ/VOPE/bK69JbWez+OG3zaA==", 59 | "dev": true, 60 | "hasInstallScript": true, 61 | "bin": { 62 | "haxe": "bin/haxeshim.js", 63 | "haxelib": "bin/haxelibshim.js", 64 | "lix": "bin/lix.js", 65 | "neko": "bin/nekoshim.js" 66 | } 67 | }, 68 | "node_modules/tunnel": { 69 | "version": "0.0.6", 70 | "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", 71 | "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", 72 | "dev": true, 73 | "engines": { 74 | "node": ">=0.6.11 <=0.7.0 || >=0.7.3" 75 | } 76 | }, 77 | "node_modules/typescript": { 78 | "version": "3.7.4", 79 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.4.tgz", 80 | "integrity": "sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw==", 81 | "dev": true, 82 | "bin": { 83 | "tsc": "bin/tsc", 84 | "tsserver": "bin/tsserver" 85 | }, 86 | "engines": { 87 | "node": ">=4.2.0" 88 | } 89 | }, 90 | "node_modules/uuid": { 91 | "version": "8.3.2", 92 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", 93 | "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", 94 | "dev": true, 95 | "bin": { 96 | "uuid": "dist/bin/uuid" 97 | } 98 | } 99 | }, 100 | "dependencies": { 101 | "@actions/core": { 102 | "version": "1.9.1", 103 | "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.9.1.tgz", 104 | "integrity": "sha512-5ad+U2YGrmmiw6du20AQW5XuWo7UKN2052FjSV7MX+Wfjf8sCqcsZe62NfgHys4QI4/Y+vQvLKYL8jWtA1ZBTA==", 105 | "dev": true, 106 | "requires": { 107 | "@actions/http-client": "^2.0.1", 108 | "uuid": "^8.3.2" 109 | } 110 | }, 111 | "@actions/http-client": { 112 | "version": "2.0.1", 113 | "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz", 114 | "integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==", 115 | "dev": true, 116 | "requires": { 117 | "tunnel": "^0.0.6" 118 | } 119 | }, 120 | "@vercel/ncc": { 121 | "version": "0.38.1", 122 | "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.1.tgz", 123 | "integrity": "sha512-IBBb+iI2NLu4VQn3Vwldyi2QwaXt5+hTyh58ggAMoCGE6DJmPvwL3KPBWcJl1m9LYPChBLE980Jw+CS4Wokqxw==", 124 | "dev": true 125 | }, 126 | "dts2hx": { 127 | "version": "0.15.3", 128 | "resolved": "https://registry.npmjs.org/dts2hx/-/dts2hx-0.15.3.tgz", 129 | "integrity": "sha512-5CFCfCLPnKfxMSLBB8JVVkKdUX//DXx7+maabjr0JZlVlLsxXFR8oL/6RhN9ppIkA55rWypLE8288EY73nlHSg==", 130 | "dev": true, 131 | "requires": { 132 | "typescript": "3.7.4" 133 | } 134 | }, 135 | "lix": { 136 | "version": "15.10.1", 137 | "resolved": "https://registry.npmjs.org/lix/-/lix-15.10.1.tgz", 138 | "integrity": "sha512-UZX+p4i+2ZSEyI6p2Yu1sfC0pRRFnFHDpNQ2+FqhxmBG8cCiHZkj+I8FqCK4AUuQ/VOPE/bK69JbWez+OG3zaA==", 139 | "dev": true 140 | }, 141 | "tunnel": { 142 | "version": "0.0.6", 143 | "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", 144 | "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", 145 | "dev": true 146 | }, 147 | "typescript": { 148 | "version": "3.7.4", 149 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.4.tgz", 150 | "integrity": "sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw==", 151 | "dev": true 152 | }, 153 | "uuid": { 154 | "version": "8.3.2", 155 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", 156 | "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", 157 | "dev": true 158 | } 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "devDependencies": { 3 | "@actions/core": "^1.9.1", 4 | "@vercel/ncc": "^0.38.1", 5 | "dts2hx": "^0.15.3", 6 | "lix": "^15.10.1" 7 | }, 8 | "scripts": { 9 | "postinstall": "lix download && dts2hx @actions/core -o externs", 10 | "build": "haxe --run Build" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Command.hx: -------------------------------------------------------------------------------- 1 | import actions.Core; 2 | 3 | enum abstract ExitCode(Int) from Int to Int { 4 | final Success = 0; 5 | final Failure = 1; 6 | } 7 | 8 | typedef NamedExecution = { 9 | final name:String; 10 | final run:() -> ExitCode; 11 | final active:Bool; 12 | } 13 | 14 | private final dryRun:Bool = false; 15 | 16 | function runInDir(dir:String, cmd:String, args:Array):ExitCode { 17 | return runCallbackInDir(dir, run.bind(cmd, args)); 18 | } 19 | 20 | function runCallbackInDir(dir:String, func:() -> ExitCode):ExitCode { 21 | final oldCwd = Sys.getCwd(); 22 | cd(dir); 23 | final result = func(); 24 | cd(oldCwd); 25 | return result; 26 | } 27 | 28 | function cd(dir:String) { 29 | Sys.println("cd " + dir); 30 | if (!dryRun) { 31 | Sys.setCwd(dir); 32 | } 33 | } 34 | 35 | function runUntilFailure(methods:Array<() -> ExitCode>):ExitCode { 36 | for (method in methods) { 37 | if (method() != Success) { 38 | return Failure; 39 | } 40 | } 41 | return Success; 42 | } 43 | 44 | function runAll(methods:Array<() -> ExitCode>):ExitCode { 45 | var result = Success; 46 | for (method in methods) { 47 | if (method() != Success) { 48 | result = Failure; 49 | } 50 | } 51 | return result; 52 | } 53 | 54 | function runAllNamed(methods:Array):ExitCode { 55 | var result = Success; 56 | for (method in methods) { 57 | if (!method.active) { 58 | continue; 59 | } 60 | Core.startGroup(method.name); 61 | if (method.run() != Success) { 62 | result = Failure; 63 | } 64 | Core.endGroup(); 65 | } 66 | return result; 67 | } 68 | 69 | function run(cmd:String, ?args:Array):ExitCode { 70 | Sys.println("> " + cmd + " " + (if (args == null) "" else args.join(" "))); 71 | if (dryRun) { 72 | return ExitCode.Success; 73 | } 74 | return Sys.command(cmd, args); 75 | } 76 | 77 | function putEnv(s:String, v:String) { 78 | Sys.println('Sys.putEnv("$s", "$v")'); 79 | if (!dryRun) { 80 | Sys.putEnv(s, v); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/Flixel.hx: -------------------------------------------------------------------------------- 1 | import Command.ExitCode; 2 | import OpenFL.Target; 3 | 4 | function buildProjects(target:Target, args:Array):ExitCode 5 | { 6 | return Haxelib.run(["flixel-tools", "bp", target].concat(args)); 7 | } 8 | -------------------------------------------------------------------------------- /src/Haxelib.hx: -------------------------------------------------------------------------------- 1 | import Command.ExitCode; 2 | import Main.LibVersion; 3 | 4 | function run(args:Array):ExitCode 5 | { 6 | return Command.run("haxelib", ["run"].concat(args)); 7 | } 8 | 9 | function fromVersion(defaultUser:String, lib:String, version:LibVersion):ExitCode 10 | { 11 | return switch (version) 12 | { 13 | case Dev: 14 | Haxelib.git(defaultUser, lib); 15 | case Release | "" | null: 16 | Haxelib.install(lib); 17 | case version: 18 | Haxelib.install(lib, cast version); 19 | } 20 | } 21 | 22 | function install(lib:String, ?version:String):ExitCode 23 | { 24 | final args = ["install", lib]; 25 | if (version != null) 26 | { 27 | args.push(version); 28 | } 29 | args.push("--quiet"); 30 | args.push("--global"); 31 | return Command.run("haxelib", args); 32 | } 33 | 34 | function git(user:String, haxelib:String, ?githubLib:String, ?branch:String, ?path:String):ExitCode 35 | { 36 | if (githubLib == null) 37 | { 38 | githubLib = haxelib; 39 | } 40 | final args = ["git", haxelib, 'https://github.com/$user/$githubLib']; 41 | if (branch != null) 42 | { 43 | args.push(branch); 44 | } 45 | if (path != null) 46 | { 47 | args.push(path); 48 | } 49 | args.push("--quiet"); 50 | args.push("--global"); 51 | return Command.run("haxelib", args); 52 | } 53 | -------------------------------------------------------------------------------- /src/Main.hx: -------------------------------------------------------------------------------- 1 | import Command; 2 | import OpenFL.Target; 3 | import actions.Core; 4 | import haxe.io.Path; 5 | import sys.FileSystem; 6 | import sys.io.File; 7 | 8 | using StringTools; 9 | 10 | enum abstract LibVersion(String) from String 11 | { 12 | final Dev = "dev"; 13 | final Release = "release"; 14 | } 15 | 16 | enum abstract TestLocation(String) from String 17 | { 18 | final Local = "local"; 19 | final Git = "git"; 20 | } 21 | 22 | private final HaxelibRepo = Path.join([Sys.getEnv("HOME"), "haxe/haxelib"]); 23 | 24 | function main() 25 | { 26 | final limeVersion:LibVersion = Core.getInput("lime-version"); 27 | final openflVersion:LibVersion = Core.getInput("openfl-version"); 28 | final flixelVersions:LibVersion = Core.getInput("flixel-versions"); 29 | final testLocation:TestLocation = Core.getInput("test-location"); 30 | final target:Target = Core.getInput("target"); 31 | final runTests:Bool = Core.getInput("run-tests") == "true"; 32 | 33 | Core.startGroup("Installing Haxe Dependencies"); 34 | final installationResult = runUntilFailure([ 35 | run.bind("sudo add-apt-repository ppa:haxe/snapshots -y"), // for nekotools 36 | run.bind("sudo apt-get install --fix-missing"), // for nekotools 37 | run.bind("sudo apt-get upgrade"), // for nekotools 38 | run.bind("sudo apt-get install neko -y"), // for nekotools 39 | // run.bind("haxelib install haxelib 4.0.3"), // 4.1.0 is failing on unit tests 40 | installHaxelibs.bind(limeVersion, openflVersion, flixelVersions), 41 | installHxcpp.bind(target) 42 | ]); 43 | if (installationResult != Success) 44 | { 45 | Sys.exit(Failure); 46 | } 47 | Core.exportVariable("HAXELIB_REPO", HaxelibRepo); 48 | Core.endGroup(); 49 | 50 | Core.startGroup("Listing Dependencies"); 51 | run("haxe -version"); 52 | run("neko -version"); 53 | run("haxelib version"); 54 | run("haxelib config"); 55 | run("haxelib fixrepo"); 56 | run("haxelib list"); 57 | Core.endGroup(); 58 | 59 | if (runTests) 60 | { 61 | Core.startGroup("Test Preparation"); 62 | 63 | if (testLocation == Local) 64 | // When testing changes to flixel, flixel is set to the dev version 65 | cd("tests"); 66 | else 67 | // otherwise use git version 68 | cd(Path.join([HaxelibRepo, "flixel/git/tests"])); 69 | 70 | putEnv("HXCPP_SILENT", "1"); 71 | putEnv("HXCPP_COMPILE_CACHE", Sys.getEnv("HOME") + "/hxcpp_cache"); 72 | putEnv("HXCPP_CACHE_MB", "5000"); 73 | putEnv("HXCPP_CATCH_SEGV", "1"); 74 | Core.endGroup(); 75 | 76 | Sys.exit(runAllNamed(Tests.make(target))); 77 | } 78 | } 79 | 80 | private function installHaxelibs(limeVersion:LibVersion, openflVersion:LibVersion, flixelVersions:LibVersion):ExitCode 81 | { 82 | final libs = [ 83 | // TODO: fix git version failing on nightly 84 | // Haxelib.git.bind("massive-oss", "munit", "MassiveUnit", "master", "src"), 85 | Haxelib.git.bind("GeoKureli", "munit", "MassiveUnit", "haxe4-3", "src"), 86 | Haxelib.git.bind("GeoKureli", "hamcrest", "hamcrest-haxe", "master", "src"), 87 | Haxelib.install.bind("systools"), 88 | Haxelib.install.bind("task"), 89 | Haxelib.install.bind("poly2trihx"), 90 | Haxelib.install.bind("nape-haxe4"), 91 | Haxelib.install.bind("haxeui-core"), 92 | Haxelib.install.bind("haxeui-flixel"), 93 | 94 | Haxelib.git.bind("HaxeFoundation", "hscript"), 95 | Haxelib.git.bind("larsiusprime", "firetongue"), 96 | Haxelib.git.bind("Geokureli", "spinehaxe", "spinehaxe", "haxe4.3.1"), 97 | Haxelib.git.bind("larsiusprime", "steamwrap"), 98 | 99 | Haxelib.fromVersion.bind("openfl", "lime", limeVersion), 100 | Haxelib.fromVersion.bind("openfl", "openfl", openflVersion), 101 | 102 | Haxelib.fromVersion.bind("HaxeFlixel", "flixel", flixelVersions), 103 | Haxelib.fromVersion.bind("HaxeFlixel", "flixel-tools", flixelVersions), 104 | Haxelib.fromVersion.bind("HaxeFlixel", "flixel-templates", flixelVersions), 105 | Haxelib.fromVersion.bind("HaxeFlixel", "flixel-demos", flixelVersions), 106 | Haxelib.fromVersion.bind("HaxeFlixel", "flixel-addons", flixelVersions), 107 | Haxelib.fromVersion.bind("HaxeFlixel", "flixel-ui", flixelVersions) 108 | ]; 109 | 110 | if (limeVersion == Dev) 111 | { 112 | // needed for git lime 113 | libs.push(Haxelib.install.bind("format")); 114 | libs.push(Haxelib.install.bind("hxp")); 115 | } 116 | return runUntilFailure(libs); 117 | } 118 | 119 | private function installHxcpp(target:Target):ExitCode 120 | { 121 | if (target != Cpp) 122 | { 123 | return Success; 124 | } 125 | 126 | return Haxelib.install("hxcpp"); 127 | 128 | // use git verison 129 | // final hxcppDir = Path.join([HaxelibRepo, "hxcpp/git/"]); 130 | // return runAll([ 131 | // Haxelib.git.bind("HaxeFoundation", "hxcpp"), 132 | // runInDir.bind(hxcppDir + "/tools/run", "haxe", ["compile.hxml"]), 133 | // runInDir.bind(hxcppDir + "/tools/hxcpp", "haxe", ["compile.hxml"]), 134 | // ]); 135 | } 136 | -------------------------------------------------------------------------------- /src/OpenFL.hx: -------------------------------------------------------------------------------- 1 | import Command.ExitCode; 2 | 3 | enum abstract Target(String) from String to String { 4 | final Flash = "flash"; 5 | final Neko = "neko"; 6 | final Cpp = "cpp"; 7 | final Html5 = "html5"; 8 | final Hl = "hl"; 9 | } 10 | 11 | function build(path:String, target:Target, ?define:String):ExitCode { 12 | return run("build", path, target, define); 13 | } 14 | 15 | function run(operation:String, path:String, target:Target, ?define:String):ExitCode { 16 | final args = ["openfl", operation, path, target]; 17 | if (define != null) { 18 | args.push('-D$define'); 19 | } 20 | return Haxelib.run(args); 21 | } 22 | -------------------------------------------------------------------------------- /src/Tests.hx: -------------------------------------------------------------------------------- 1 | import Command; 2 | import Main; 3 | import OpenFL.Target; 4 | 5 | private final CppDemos = ["Mode", "Flixius", "MinimalistTD", "TurnBasedRPG"]; 6 | 7 | function make(target):Array 8 | { 9 | return [ 10 | { 11 | name: "Running Unit Tests", 12 | run: runUnitTests.bind(target), 13 | active: true 14 | }, 15 | { 16 | name: "Building Coverage Tests", 17 | run: buildCoverageTests.bind(target), 18 | active: true 19 | }, 20 | { 21 | name: "Building SWF Version Tests", 22 | run: buildSwfVersionTests.bind(target), 23 | active: target == Flash 24 | }, 25 | { 26 | name: "Building flixel-demos", 27 | run: buildDemos.bind(target), 28 | active: true 29 | }, 30 | { 31 | name: "Building snippets.haxeflixel.com Demos", 32 | run: buildSnippetsDemos.bind(target), 33 | active: target != Cpp 34 | } 35 | ]; 36 | } 37 | 38 | private function runUnitTests(target:Target):ExitCode 39 | { 40 | runCallbackInDir("unit", Haxelib.run.bind(["munit", "gen"])); 41 | 42 | // can't run / display results without a browser, 43 | // this at least checks if the tests compile 44 | // also, neko fails randomly for some reason... (#2148) 45 | var runTests = target == Cpp; 46 | 47 | if (runTests) 48 | { 49 | Sys.println("Running unit tests...\n"); 50 | return OpenFL.run("test", "unit", target, "travis"); 51 | } 52 | else 53 | { 54 | Sys.println('Cannot run tests on $target, building instead\n'); 55 | Sys.println("Building unit tests...\n"); 56 | return OpenFL.build("unit", target); 57 | } 58 | } 59 | 60 | private function buildCoverageTests(target:Target):ExitCode 61 | { 62 | Sys.println("\nBuilding coverage tests...\n"); 63 | return runAll([ 64 | OpenFL.build.bind("coverage", target, "coverage1"), 65 | OpenFL.build.bind("coverage", target, "coverage2"), 66 | OpenFL.build.bind("coverage", target, "coverage3") 67 | ]); 68 | } 69 | 70 | private function buildDemos(target:Target, ?demos:Array, ?args:Array):ExitCode 71 | { 72 | args = args ?? []; 73 | if (demos != null) 74 | { 75 | Sys.println('\nBuilding ${demos.length} demo(s)...\n'); 76 | } 77 | else if (target == Cpp) 78 | { 79 | demos = CppDemos; 80 | Sys.println('\nSkipping some demos due to cpp build times\nBuilding ${demos.length} demo(s)...\n'); 81 | // args.push('-DHXCPP_COMPILE_CACHE=\'${Sys.getEnv("HOME") + "/hxcpp_cache"}\''); // Already added to env in Main 82 | } 83 | else 84 | { 85 | Sys.println('\nBuilding all demos...\n'); 86 | demos = []; 87 | } 88 | return Flixel.buildProjects(target, demos.concat(args)); 89 | } 90 | 91 | private function buildSnippetsDemos(target:Target):ExitCode 92 | { 93 | Sys.println("\nBuilding spnippets demos...\n"); 94 | run("git", ["clone", "https://github.com/HaxeFlixel/snippets.haxeflixel.com"]); 95 | 96 | return Flixel.buildProjects(target, ["-dir", "snippets.haxeflixel.com"]); 97 | } 98 | 99 | private function buildSwfVersionTests(target:Target):ExitCode 100 | { 101 | Sys.println("\nBuilding swf version tests...\n"); 102 | return runAll([ 103 | OpenFL.build.bind("swfVersion/11", target), 104 | OpenFL.build.bind("swfVersion/11_2", target) 105 | ]); 106 | } 107 | --------------------------------------------------------------------------------