github.com/nektos/act@v0.2.63/pkg/runner/hashfiles/index.js (about) 1 /******/ (() => { // webpackBootstrap 2 /******/ var __webpack_modules__ = ({ 3 4 /***/ 2627: 5 /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 6 7 "use strict"; 8 9 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 10 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 11 return new (P || (P = Promise))(function (resolve, reject) { 12 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 13 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 14 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 15 step((generator = generator.apply(thisArg, _arguments || [])).next()); 16 }); 17 }; 18 var __asyncValues = (this && this.__asyncValues) || function (o) { 19 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 20 var m = o[Symbol.asyncIterator], i; 21 return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); 22 function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } 23 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } 24 }; 25 var __importStar = (this && this.__importStar) || function (mod) { 26 if (mod && mod.__esModule) return mod; 27 var result = {}; 28 if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 29 result["default"] = mod; 30 return result; 31 }; 32 Object.defineProperty(exports, "__esModule", ({ value: true })); 33 const crypto = __importStar(__nccwpck_require__(6113)); 34 const fs = __importStar(__nccwpck_require__(7147)); 35 const glob = __importStar(__nccwpck_require__(8090)); 36 const path = __importStar(__nccwpck_require__(1017)); 37 const stream = __importStar(__nccwpck_require__(2781)); 38 const util = __importStar(__nccwpck_require__(3837)); 39 function run() { 40 var e_1, _a; 41 return __awaiter(this, void 0, void 0, function* () { 42 // arg0 -> node 43 // arg1 -> hashFiles.js 44 // env[followSymbolicLinks] = true/null 45 // env[patterns] -> glob patterns 46 let followSymbolicLinks = false; 47 const matchPatterns = process.env.patterns || ''; 48 if (process.env.followSymbolicLinks === 'true') { 49 console.log('Follow symbolic links'); 50 followSymbolicLinks = true; 51 } 52 console.log(`Match Pattern: ${matchPatterns}`); 53 let hasMatch = false; 54 const githubWorkspace = process.cwd(); 55 const result = crypto.createHash('sha256'); 56 let count = 0; 57 const globber = yield glob.create(matchPatterns, { followSymbolicLinks }); 58 try { 59 for (var _b = __asyncValues(globber.globGenerator()), _c; _c = yield _b.next(), !_c.done;) { 60 const file = _c.value; 61 console.log(file); 62 if (!file.startsWith(`${githubWorkspace}${path.sep}`)) { 63 console.log(`Ignore '${file}' since it is not under GITHUB_WORKSPACE.`); 64 continue; 65 } 66 if (fs.statSync(file).isDirectory()) { 67 console.log(`Skip directory '${file}'.`); 68 continue; 69 } 70 const hash = crypto.createHash('sha256'); 71 const pipeline = util.promisify(stream.pipeline); 72 yield pipeline(fs.createReadStream(file), hash); 73 result.write(hash.digest()); 74 count++; 75 if (!hasMatch) { 76 hasMatch = true; 77 } 78 } 79 } 80 catch (e_1_1) { e_1 = { error: e_1_1 }; } 81 finally { 82 try { 83 if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b); 84 } 85 finally { if (e_1) throw e_1.error; } 86 } 87 result.end(); 88 if (hasMatch) { 89 console.log(`Found ${count} files to hash.`); 90 console.error(`__OUTPUT__${result.digest('hex')}__OUTPUT__`); 91 } 92 else { 93 console.error(`__OUTPUT____OUTPUT__`); 94 } 95 }); 96 } 97 run() 98 .then(out => { 99 console.log(out); 100 process.exit(0); 101 }) 102 .catch(err => { 103 console.error(err); 104 process.exit(1); 105 }); 106 107 108 /***/ }), 109 110 /***/ 7351: 111 /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 112 113 "use strict"; 114 115 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 116 if (k2 === undefined) k2 = k; 117 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 118 }) : (function(o, m, k, k2) { 119 if (k2 === undefined) k2 = k; 120 o[k2] = m[k]; 121 })); 122 var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 123 Object.defineProperty(o, "default", { enumerable: true, value: v }); 124 }) : function(o, v) { 125 o["default"] = v; 126 }); 127 var __importStar = (this && this.__importStar) || function (mod) { 128 if (mod && mod.__esModule) return mod; 129 var result = {}; 130 if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 131 __setModuleDefault(result, mod); 132 return result; 133 }; 134 Object.defineProperty(exports, "__esModule", ({ value: true })); 135 exports.issue = exports.issueCommand = void 0; 136 const os = __importStar(__nccwpck_require__(2037)); 137 const utils_1 = __nccwpck_require__(5278); 138 /** 139 * Commands 140 * 141 * Command Format: 142 * ::name key=value,key=value::message 143 * 144 * Examples: 145 * ::warning::This is the message 146 * ::set-env name=MY_VAR::some value 147 */ 148 function issueCommand(command, properties, message) { 149 const cmd = new Command(command, properties, message); 150 process.stdout.write(cmd.toString() + os.EOL); 151 } 152 exports.issueCommand = issueCommand; 153 function issue(name, message = '') { 154 issueCommand(name, {}, message); 155 } 156 exports.issue = issue; 157 const CMD_STRING = '::'; 158 class Command { 159 constructor(command, properties, message) { 160 if (!command) { 161 command = 'missing.command'; 162 } 163 this.command = command; 164 this.properties = properties; 165 this.message = message; 166 } 167 toString() { 168 let cmdStr = CMD_STRING + this.command; 169 if (this.properties && Object.keys(this.properties).length > 0) { 170 cmdStr += ' '; 171 let first = true; 172 for (const key in this.properties) { 173 if (this.properties.hasOwnProperty(key)) { 174 const val = this.properties[key]; 175 if (val) { 176 if (first) { 177 first = false; 178 } 179 else { 180 cmdStr += ','; 181 } 182 cmdStr += `${key}=${escapeProperty(val)}`; 183 } 184 } 185 } 186 } 187 cmdStr += `${CMD_STRING}${escapeData(this.message)}`; 188 return cmdStr; 189 } 190 } 191 function escapeData(s) { 192 return utils_1.toCommandValue(s) 193 .replace(/%/g, '%25') 194 .replace(/\r/g, '%0D') 195 .replace(/\n/g, '%0A'); 196 } 197 function escapeProperty(s) { 198 return utils_1.toCommandValue(s) 199 .replace(/%/g, '%25') 200 .replace(/\r/g, '%0D') 201 .replace(/\n/g, '%0A') 202 .replace(/:/g, '%3A') 203 .replace(/,/g, '%2C'); 204 } 205 //# sourceMappingURL=command.js.map 206 207 /***/ }), 208 209 /***/ 2186: 210 /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 211 212 "use strict"; 213 214 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 215 if (k2 === undefined) k2 = k; 216 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 217 }) : (function(o, m, k, k2) { 218 if (k2 === undefined) k2 = k; 219 o[k2] = m[k]; 220 })); 221 var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 222 Object.defineProperty(o, "default", { enumerable: true, value: v }); 223 }) : function(o, v) { 224 o["default"] = v; 225 }); 226 var __importStar = (this && this.__importStar) || function (mod) { 227 if (mod && mod.__esModule) return mod; 228 var result = {}; 229 if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 230 __setModuleDefault(result, mod); 231 return result; 232 }; 233 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 234 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 235 return new (P || (P = Promise))(function (resolve, reject) { 236 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 237 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 238 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 239 step((generator = generator.apply(thisArg, _arguments || [])).next()); 240 }); 241 }; 242 Object.defineProperty(exports, "__esModule", ({ value: true })); 243 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; 244 const command_1 = __nccwpck_require__(7351); 245 const file_command_1 = __nccwpck_require__(717); 246 const utils_1 = __nccwpck_require__(5278); 247 const os = __importStar(__nccwpck_require__(2037)); 248 const path = __importStar(__nccwpck_require__(1017)); 249 const uuid_1 = __nccwpck_require__(5840); 250 const oidc_utils_1 = __nccwpck_require__(8041); 251 /** 252 * The code to exit an action 253 */ 254 var ExitCode; 255 (function (ExitCode) { 256 /** 257 * A code indicating that the action was successful 258 */ 259 ExitCode[ExitCode["Success"] = 0] = "Success"; 260 /** 261 * A code indicating that the action was a failure 262 */ 263 ExitCode[ExitCode["Failure"] = 1] = "Failure"; 264 })(ExitCode = exports.ExitCode || (exports.ExitCode = {})); 265 //----------------------------------------------------------------------- 266 // Variables 267 //----------------------------------------------------------------------- 268 /** 269 * Sets env variable for this action and future actions in the job 270 * @param name the name of the variable to set 271 * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify 272 */ 273 // eslint-disable-next-line @typescript-eslint/no-explicit-any 274 function exportVariable(name, val) { 275 const convertedVal = utils_1.toCommandValue(val); 276 process.env[name] = convertedVal; 277 const filePath = process.env['GITHUB_ENV'] || ''; 278 if (filePath) { 279 const delimiter = `ghadelimiter_${uuid_1.v4()}`; 280 // 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. 281 if (name.includes(delimiter)) { 282 throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`); 283 } 284 if (convertedVal.includes(delimiter)) { 285 throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`); 286 } 287 const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`; 288 file_command_1.issueCommand('ENV', commandValue); 289 } 290 else { 291 command_1.issueCommand('set-env', { name }, convertedVal); 292 } 293 } 294 exports.exportVariable = exportVariable; 295 /** 296 * Registers a secret which will get masked from logs 297 * @param secret value of the secret 298 */ 299 function setSecret(secret) { 300 command_1.issueCommand('add-mask', {}, secret); 301 } 302 exports.setSecret = setSecret; 303 /** 304 * Prepends inputPath to the PATH (for this action and future actions) 305 * @param inputPath 306 */ 307 function addPath(inputPath) { 308 const filePath = process.env['GITHUB_PATH'] || ''; 309 if (filePath) { 310 file_command_1.issueCommand('PATH', inputPath); 311 } 312 else { 313 command_1.issueCommand('add-path', {}, inputPath); 314 } 315 process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`; 316 } 317 exports.addPath = addPath; 318 /** 319 * Gets the value of an input. 320 * Unless trimWhitespace is set to false in InputOptions, the value is also trimmed. 321 * Returns an empty string if the value is not defined. 322 * 323 * @param name name of the input to get 324 * @param options optional. See InputOptions. 325 * @returns string 326 */ 327 function getInput(name, options) { 328 const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || ''; 329 if (options && options.required && !val) { 330 throw new Error(`Input required and not supplied: ${name}`); 331 } 332 if (options && options.trimWhitespace === false) { 333 return val; 334 } 335 return val.trim(); 336 } 337 exports.getInput = getInput; 338 /** 339 * Gets the values of an multiline input. Each value is also trimmed. 340 * 341 * @param name name of the input to get 342 * @param options optional. See InputOptions. 343 * @returns string[] 344 * 345 */ 346 function getMultilineInput(name, options) { 347 const inputs = getInput(name, options) 348 .split('\n') 349 .filter(x => x !== ''); 350 return inputs; 351 } 352 exports.getMultilineInput = getMultilineInput; 353 /** 354 * Gets the input value of the boolean type in the YAML 1.2 "core schema" specification. 355 * Support boolean input list: `true | True | TRUE | false | False | FALSE` . 356 * The return value is also in boolean type. 357 * ref: https://yaml.org/spec/1.2/spec.html#id2804923 358 * 359 * @param name name of the input to get 360 * @param options optional. See InputOptions. 361 * @returns boolean 362 */ 363 function getBooleanInput(name, options) { 364 const trueValue = ['true', 'True', 'TRUE']; 365 const falseValue = ['false', 'False', 'FALSE']; 366 const val = getInput(name, options); 367 if (trueValue.includes(val)) 368 return true; 369 if (falseValue.includes(val)) 370 return false; 371 throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` + 372 `Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); 373 } 374 exports.getBooleanInput = getBooleanInput; 375 /** 376 * Sets the value of an output. 377 * 378 * @param name name of the output to set 379 * @param value value to store. Non-string values will be converted to a string via JSON.stringify 380 */ 381 // eslint-disable-next-line @typescript-eslint/no-explicit-any 382 function setOutput(name, value) { 383 process.stdout.write(os.EOL); 384 command_1.issueCommand('set-output', { name }, value); 385 } 386 exports.setOutput = setOutput; 387 /** 388 * Enables or disables the echoing of commands into stdout for the rest of the step. 389 * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set. 390 * 391 */ 392 function setCommandEcho(enabled) { 393 command_1.issue('echo', enabled ? 'on' : 'off'); 394 } 395 exports.setCommandEcho = setCommandEcho; 396 //----------------------------------------------------------------------- 397 // Results 398 //----------------------------------------------------------------------- 399 /** 400 * Sets the action status to failed. 401 * When the action exits it will be with an exit code of 1 402 * @param message add error issue message 403 */ 404 function setFailed(message) { 405 process.exitCode = ExitCode.Failure; 406 error(message); 407 } 408 exports.setFailed = setFailed; 409 //----------------------------------------------------------------------- 410 // Logging Commands 411 //----------------------------------------------------------------------- 412 /** 413 * Gets whether Actions Step Debug is on or not 414 */ 415 function isDebug() { 416 return process.env['RUNNER_DEBUG'] === '1'; 417 } 418 exports.isDebug = isDebug; 419 /** 420 * Writes debug message to user log 421 * @param message debug message 422 */ 423 function debug(message) { 424 command_1.issueCommand('debug', {}, message); 425 } 426 exports.debug = debug; 427 /** 428 * Adds an error issue 429 * @param message error issue message. Errors will be converted to string via toString() 430 * @param properties optional properties to add to the annotation. 431 */ 432 function error(message, properties = {}) { 433 command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); 434 } 435 exports.error = error; 436 /** 437 * Adds a warning issue 438 * @param message warning issue message. Errors will be converted to string via toString() 439 * @param properties optional properties to add to the annotation. 440 */ 441 function warning(message, properties = {}) { 442 command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); 443 } 444 exports.warning = warning; 445 /** 446 * Adds a notice issue 447 * @param message notice issue message. Errors will be converted to string via toString() 448 * @param properties optional properties to add to the annotation. 449 */ 450 function notice(message, properties = {}) { 451 command_1.issueCommand('notice', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); 452 } 453 exports.notice = notice; 454 /** 455 * Writes info to log with console.log. 456 * @param message info message 457 */ 458 function info(message) { 459 process.stdout.write(message + os.EOL); 460 } 461 exports.info = info; 462 /** 463 * Begin an output group. 464 * 465 * Output until the next `groupEnd` will be foldable in this group 466 * 467 * @param name The name of the output group 468 */ 469 function startGroup(name) { 470 command_1.issue('group', name); 471 } 472 exports.startGroup = startGroup; 473 /** 474 * End an output group. 475 */ 476 function endGroup() { 477 command_1.issue('endgroup'); 478 } 479 exports.endGroup = endGroup; 480 /** 481 * Wrap an asynchronous function call in a group. 482 * 483 * Returns the same type as the function itself. 484 * 485 * @param name The name of the group 486 * @param fn The function to wrap in the group 487 */ 488 function group(name, fn) { 489 return __awaiter(this, void 0, void 0, function* () { 490 startGroup(name); 491 let result; 492 try { 493 result = yield fn(); 494 } 495 finally { 496 endGroup(); 497 } 498 return result; 499 }); 500 } 501 exports.group = group; 502 //----------------------------------------------------------------------- 503 // Wrapper action state 504 //----------------------------------------------------------------------- 505 /** 506 * Saves state for current action, the state can only be retrieved by this action's post job execution. 507 * 508 * @param name name of the state to store 509 * @param value value to store. Non-string values will be converted to a string via JSON.stringify 510 */ 511 // eslint-disable-next-line @typescript-eslint/no-explicit-any 512 function saveState(name, value) { 513 command_1.issueCommand('save-state', { name }, value); 514 } 515 exports.saveState = saveState; 516 /** 517 * Gets the value of an state set by this action's main execution. 518 * 519 * @param name name of the state to get 520 * @returns string 521 */ 522 function getState(name) { 523 return process.env[`STATE_${name}`] || ''; 524 } 525 exports.getState = getState; 526 function getIDToken(aud) { 527 return __awaiter(this, void 0, void 0, function* () { 528 return yield oidc_utils_1.OidcClient.getIDToken(aud); 529 }); 530 } 531 exports.getIDToken = getIDToken; 532 /** 533 * Summary exports 534 */ 535 var summary_1 = __nccwpck_require__(1327); 536 Object.defineProperty(exports, "summary", ({ enumerable: true, get: function () { return summary_1.summary; } })); 537 /** 538 * @deprecated use core.summary 539 */ 540 var summary_2 = __nccwpck_require__(1327); 541 Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } })); 542 /** 543 * Path exports 544 */ 545 var path_utils_1 = __nccwpck_require__(2981); 546 Object.defineProperty(exports, "toPosixPath", ({ enumerable: true, get: function () { return path_utils_1.toPosixPath; } })); 547 Object.defineProperty(exports, "toWin32Path", ({ enumerable: true, get: function () { return path_utils_1.toWin32Path; } })); 548 Object.defineProperty(exports, "toPlatformPath", ({ enumerable: true, get: function () { return path_utils_1.toPlatformPath; } })); 549 //# sourceMappingURL=core.js.map 550 551 /***/ }), 552 553 /***/ 717: 554 /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 555 556 "use strict"; 557 558 // For internal use, subject to change. 559 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 560 if (k2 === undefined) k2 = k; 561 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 562 }) : (function(o, m, k, k2) { 563 if (k2 === undefined) k2 = k; 564 o[k2] = m[k]; 565 })); 566 var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 567 Object.defineProperty(o, "default", { enumerable: true, value: v }); 568 }) : function(o, v) { 569 o["default"] = v; 570 }); 571 var __importStar = (this && this.__importStar) || function (mod) { 572 if (mod && mod.__esModule) return mod; 573 var result = {}; 574 if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 575 __setModuleDefault(result, mod); 576 return result; 577 }; 578 Object.defineProperty(exports, "__esModule", ({ value: true })); 579 exports.issueCommand = void 0; 580 // We use any as a valid input type 581 /* eslint-disable @typescript-eslint/no-explicit-any */ 582 const fs = __importStar(__nccwpck_require__(7147)); 583 const os = __importStar(__nccwpck_require__(2037)); 584 const utils_1 = __nccwpck_require__(5278); 585 function issueCommand(command, message) { 586 const filePath = process.env[`GITHUB_${command}`]; 587 if (!filePath) { 588 throw new Error(`Unable to find environment variable for file command ${command}`); 589 } 590 if (!fs.existsSync(filePath)) { 591 throw new Error(`Missing file at path: ${filePath}`); 592 } 593 fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, { 594 encoding: 'utf8' 595 }); 596 } 597 exports.issueCommand = issueCommand; 598 //# sourceMappingURL=file-command.js.map 599 600 /***/ }), 601 602 /***/ 8041: 603 /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 604 605 "use strict"; 606 607 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 608 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 609 return new (P || (P = Promise))(function (resolve, reject) { 610 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 611 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 612 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 613 step((generator = generator.apply(thisArg, _arguments || [])).next()); 614 }); 615 }; 616 Object.defineProperty(exports, "__esModule", ({ value: true })); 617 exports.OidcClient = void 0; 618 const http_client_1 = __nccwpck_require__(6255); 619 const auth_1 = __nccwpck_require__(5526); 620 const core_1 = __nccwpck_require__(2186); 621 class OidcClient { 622 static createHttpClient(allowRetry = true, maxRetry = 10) { 623 const requestOptions = { 624 allowRetries: allowRetry, 625 maxRetries: maxRetry 626 }; 627 return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions); 628 } 629 static getRequestToken() { 630 const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN']; 631 if (!token) { 632 throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable'); 633 } 634 return token; 635 } 636 static getIDTokenUrl() { 637 const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL']; 638 if (!runtimeUrl) { 639 throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable'); 640 } 641 return runtimeUrl; 642 } 643 static getCall(id_token_url) { 644 var _a; 645 return __awaiter(this, void 0, void 0, function* () { 646 const httpclient = OidcClient.createHttpClient(); 647 const res = yield httpclient 648 .getJson(id_token_url) 649 .catch(error => { 650 throw new Error(`Failed to get ID Token. \n 651 Error Code : ${error.statusCode}\n 652 Error Message: ${error.result.message}`); 653 }); 654 const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; 655 if (!id_token) { 656 throw new Error('Response json body do not have ID Token field'); 657 } 658 return id_token; 659 }); 660 } 661 static getIDToken(audience) { 662 return __awaiter(this, void 0, void 0, function* () { 663 try { 664 // New ID Token is requested from action service 665 let id_token_url = OidcClient.getIDTokenUrl(); 666 if (audience) { 667 const encodedAudience = encodeURIComponent(audience); 668 id_token_url = `${id_token_url}&audience=${encodedAudience}`; 669 } 670 core_1.debug(`ID token url is ${id_token_url}`); 671 const id_token = yield OidcClient.getCall(id_token_url); 672 core_1.setSecret(id_token); 673 return id_token; 674 } 675 catch (error) { 676 throw new Error(`Error message: ${error.message}`); 677 } 678 }); 679 } 680 } 681 exports.OidcClient = OidcClient; 682 //# sourceMappingURL=oidc-utils.js.map 683 684 /***/ }), 685 686 /***/ 2981: 687 /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 688 689 "use strict"; 690 691 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 692 if (k2 === undefined) k2 = k; 693 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 694 }) : (function(o, m, k, k2) { 695 if (k2 === undefined) k2 = k; 696 o[k2] = m[k]; 697 })); 698 var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 699 Object.defineProperty(o, "default", { enumerable: true, value: v }); 700 }) : function(o, v) { 701 o["default"] = v; 702 }); 703 var __importStar = (this && this.__importStar) || function (mod) { 704 if (mod && mod.__esModule) return mod; 705 var result = {}; 706 if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 707 __setModuleDefault(result, mod); 708 return result; 709 }; 710 Object.defineProperty(exports, "__esModule", ({ value: true })); 711 exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = void 0; 712 const path = __importStar(__nccwpck_require__(1017)); 713 /** 714 * toPosixPath converts the given path to the posix form. On Windows, \\ will be 715 * replaced with /. 716 * 717 * @param pth. Path to transform. 718 * @return string Posix path. 719 */ 720 function toPosixPath(pth) { 721 return pth.replace(/[\\]/g, '/'); 722 } 723 exports.toPosixPath = toPosixPath; 724 /** 725 * toWin32Path converts the given path to the win32 form. On Linux, / will be 726 * replaced with \\. 727 * 728 * @param pth. Path to transform. 729 * @return string Win32 path. 730 */ 731 function toWin32Path(pth) { 732 return pth.replace(/[/]/g, '\\'); 733 } 734 exports.toWin32Path = toWin32Path; 735 /** 736 * toPlatformPath converts the given path to a platform-specific path. It does 737 * this by replacing instances of / and \ with the platform-specific path 738 * separator. 739 * 740 * @param pth The path to platformize. 741 * @return string The platform-specific path. 742 */ 743 function toPlatformPath(pth) { 744 return pth.replace(/[/\\]/g, path.sep); 745 } 746 exports.toPlatformPath = toPlatformPath; 747 //# sourceMappingURL=path-utils.js.map 748 749 /***/ }), 750 751 /***/ 1327: 752 /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 753 754 "use strict"; 755 756 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 757 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 758 return new (P || (P = Promise))(function (resolve, reject) { 759 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 760 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 761 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 762 step((generator = generator.apply(thisArg, _arguments || [])).next()); 763 }); 764 }; 765 Object.defineProperty(exports, "__esModule", ({ value: true })); 766 exports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0; 767 const os_1 = __nccwpck_require__(2037); 768 const fs_1 = __nccwpck_require__(7147); 769 const { access, appendFile, writeFile } = fs_1.promises; 770 exports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY'; 771 exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary'; 772 class Summary { 773 constructor() { 774 this._buffer = ''; 775 } 776 /** 777 * Finds the summary file path from the environment, rejects if env var is not found or file does not exist 778 * Also checks r/w permissions. 779 * 780 * @returns step summary file path 781 */ 782 filePath() { 783 return __awaiter(this, void 0, void 0, function* () { 784 if (this._filePath) { 785 return this._filePath; 786 } 787 const pathFromEnv = process.env[exports.SUMMARY_ENV_VAR]; 788 if (!pathFromEnv) { 789 throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`); 790 } 791 try { 792 yield access(pathFromEnv, fs_1.constants.R_OK | fs_1.constants.W_OK); 793 } 794 catch (_a) { 795 throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`); 796 } 797 this._filePath = pathFromEnv; 798 return this._filePath; 799 }); 800 } 801 /** 802 * Wraps content in an HTML tag, adding any HTML attributes 803 * 804 * @param {string} tag HTML tag to wrap 805 * @param {string | null} content content within the tag 806 * @param {[attribute: string]: string} attrs key-value list of HTML attributes to add 807 * 808 * @returns {string} content wrapped in HTML element 809 */ 810 wrap(tag, content, attrs = {}) { 811 const htmlAttrs = Object.entries(attrs) 812 .map(([key, value]) => ` ${key}="${value}"`) 813 .join(''); 814 if (!content) { 815 return `<${tag}${htmlAttrs}>`; 816 } 817 return `<${tag}${htmlAttrs}>${content}</${tag}>`; 818 } 819 /** 820 * Writes text in the buffer to the summary buffer file and empties buffer. Will append by default. 821 * 822 * @param {SummaryWriteOptions} [options] (optional) options for write operation 823 * 824 * @returns {Promise<Summary>} summary instance 825 */ 826 write(options) { 827 return __awaiter(this, void 0, void 0, function* () { 828 const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite); 829 const filePath = yield this.filePath(); 830 const writeFunc = overwrite ? writeFile : appendFile; 831 yield writeFunc(filePath, this._buffer, { encoding: 'utf8' }); 832 return this.emptyBuffer(); 833 }); 834 } 835 /** 836 * Clears the summary buffer and wipes the summary file 837 * 838 * @returns {Summary} summary instance 839 */ 840 clear() { 841 return __awaiter(this, void 0, void 0, function* () { 842 return this.emptyBuffer().write({ overwrite: true }); 843 }); 844 } 845 /** 846 * Returns the current summary buffer as a string 847 * 848 * @returns {string} string of summary buffer 849 */ 850 stringify() { 851 return this._buffer; 852 } 853 /** 854 * If the summary buffer is empty 855 * 856 * @returns {boolean} true if the buffer is empty 857 */ 858 isEmptyBuffer() { 859 return this._buffer.length === 0; 860 } 861 /** 862 * Resets the summary buffer without writing to summary file 863 * 864 * @returns {Summary} summary instance 865 */ 866 emptyBuffer() { 867 this._buffer = ''; 868 return this; 869 } 870 /** 871 * Adds raw text to the summary buffer 872 * 873 * @param {string} text content to add 874 * @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false) 875 * 876 * @returns {Summary} summary instance 877 */ 878 addRaw(text, addEOL = false) { 879 this._buffer += text; 880 return addEOL ? this.addEOL() : this; 881 } 882 /** 883 * Adds the operating system-specific end-of-line marker to the buffer 884 * 885 * @returns {Summary} summary instance 886 */ 887 addEOL() { 888 return this.addRaw(os_1.EOL); 889 } 890 /** 891 * Adds an HTML codeblock to the summary buffer 892 * 893 * @param {string} code content to render within fenced code block 894 * @param {string} lang (optional) language to syntax highlight code 895 * 896 * @returns {Summary} summary instance 897 */ 898 addCodeBlock(code, lang) { 899 const attrs = Object.assign({}, (lang && { lang })); 900 const element = this.wrap('pre', this.wrap('code', code), attrs); 901 return this.addRaw(element).addEOL(); 902 } 903 /** 904 * Adds an HTML list to the summary buffer 905 * 906 * @param {string[]} items list of items to render 907 * @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false) 908 * 909 * @returns {Summary} summary instance 910 */ 911 addList(items, ordered = false) { 912 const tag = ordered ? 'ol' : 'ul'; 913 const listItems = items.map(item => this.wrap('li', item)).join(''); 914 const element = this.wrap(tag, listItems); 915 return this.addRaw(element).addEOL(); 916 } 917 /** 918 * Adds an HTML table to the summary buffer 919 * 920 * @param {SummaryTableCell[]} rows table rows 921 * 922 * @returns {Summary} summary instance 923 */ 924 addTable(rows) { 925 const tableBody = rows 926 .map(row => { 927 const cells = row 928 .map(cell => { 929 if (typeof cell === 'string') { 930 return this.wrap('td', cell); 931 } 932 const { header, data, colspan, rowspan } = cell; 933 const tag = header ? 'th' : 'td'; 934 const attrs = Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan })); 935 return this.wrap(tag, data, attrs); 936 }) 937 .join(''); 938 return this.wrap('tr', cells); 939 }) 940 .join(''); 941 const element = this.wrap('table', tableBody); 942 return this.addRaw(element).addEOL(); 943 } 944 /** 945 * Adds a collapsable HTML details element to the summary buffer 946 * 947 * @param {string} label text for the closed state 948 * @param {string} content collapsable content 949 * 950 * @returns {Summary} summary instance 951 */ 952 addDetails(label, content) { 953 const element = this.wrap('details', this.wrap('summary', label) + content); 954 return this.addRaw(element).addEOL(); 955 } 956 /** 957 * Adds an HTML image tag to the summary buffer 958 * 959 * @param {string} src path to the image you to embed 960 * @param {string} alt text description of the image 961 * @param {SummaryImageOptions} options (optional) addition image attributes 962 * 963 * @returns {Summary} summary instance 964 */ 965 addImage(src, alt, options) { 966 const { width, height } = options || {}; 967 const attrs = Object.assign(Object.assign({}, (width && { width })), (height && { height })); 968 const element = this.wrap('img', null, Object.assign({ src, alt }, attrs)); 969 return this.addRaw(element).addEOL(); 970 } 971 /** 972 * Adds an HTML section heading element 973 * 974 * @param {string} text heading text 975 * @param {number | string} [level=1] (optional) the heading level, default: 1 976 * 977 * @returns {Summary} summary instance 978 */ 979 addHeading(text, level) { 980 const tag = `h${level}`; 981 const allowedTag = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tag) 982 ? tag 983 : 'h1'; 984 const element = this.wrap(allowedTag, text); 985 return this.addRaw(element).addEOL(); 986 } 987 /** 988 * Adds an HTML thematic break (<hr>) to the summary buffer 989 * 990 * @returns {Summary} summary instance 991 */ 992 addSeparator() { 993 const element = this.wrap('hr', null); 994 return this.addRaw(element).addEOL(); 995 } 996 /** 997 * Adds an HTML line break (<br>) to the summary buffer 998 * 999 * @returns {Summary} summary instance 1000 */ 1001 addBreak() { 1002 const element = this.wrap('br', null); 1003 return this.addRaw(element).addEOL(); 1004 } 1005 /** 1006 * Adds an HTML blockquote to the summary buffer 1007 * 1008 * @param {string} text quote text 1009 * @param {string} cite (optional) citation url 1010 * 1011 * @returns {Summary} summary instance 1012 */ 1013 addQuote(text, cite) { 1014 const attrs = Object.assign({}, (cite && { cite })); 1015 const element = this.wrap('blockquote', text, attrs); 1016 return this.addRaw(element).addEOL(); 1017 } 1018 /** 1019 * Adds an HTML anchor tag to the summary buffer 1020 * 1021 * @param {string} text link text/content 1022 * @param {string} href hyperlink 1023 * 1024 * @returns {Summary} summary instance 1025 */ 1026 addLink(text, href) { 1027 const element = this.wrap('a', text, { href }); 1028 return this.addRaw(element).addEOL(); 1029 } 1030 } 1031 const _summary = new Summary(); 1032 /** 1033 * @deprecated use `core.summary` 1034 */ 1035 exports.markdownSummary = _summary; 1036 exports.summary = _summary; 1037 //# sourceMappingURL=summary.js.map 1038 1039 /***/ }), 1040 1041 /***/ 5278: 1042 /***/ ((__unused_webpack_module, exports) => { 1043 1044 "use strict"; 1045 1046 // We use any as a valid input type 1047 /* eslint-disable @typescript-eslint/no-explicit-any */ 1048 Object.defineProperty(exports, "__esModule", ({ value: true })); 1049 exports.toCommandProperties = exports.toCommandValue = void 0; 1050 /** 1051 * Sanitizes an input into a string so it can be passed into issueCommand safely 1052 * @param input input to sanitize into a string 1053 */ 1054 function toCommandValue(input) { 1055 if (input === null || input === undefined) { 1056 return ''; 1057 } 1058 else if (typeof input === 'string' || input instanceof String) { 1059 return input; 1060 } 1061 return JSON.stringify(input); 1062 } 1063 exports.toCommandValue = toCommandValue; 1064 /** 1065 * 1066 * @param annotationProperties 1067 * @returns The command properties to send with the actual annotation command 1068 * See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646 1069 */ 1070 function toCommandProperties(annotationProperties) { 1071 if (!Object.keys(annotationProperties).length) { 1072 return {}; 1073 } 1074 return { 1075 title: annotationProperties.title, 1076 file: annotationProperties.file, 1077 line: annotationProperties.startLine, 1078 endLine: annotationProperties.endLine, 1079 col: annotationProperties.startColumn, 1080 endColumn: annotationProperties.endColumn 1081 }; 1082 } 1083 exports.toCommandProperties = toCommandProperties; 1084 //# sourceMappingURL=utils.js.map 1085 1086 /***/ }), 1087 1088 /***/ 8090: 1089 /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 1090 1091 "use strict"; 1092 1093 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 1094 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 1095 return new (P || (P = Promise))(function (resolve, reject) { 1096 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 1097 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 1098 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 1099 step((generator = generator.apply(thisArg, _arguments || [])).next()); 1100 }); 1101 }; 1102 Object.defineProperty(exports, "__esModule", ({ value: true })); 1103 const internal_globber_1 = __nccwpck_require__(8298); 1104 /** 1105 * Constructs a globber 1106 * 1107 * @param patterns Patterns separated by newlines 1108 * @param options Glob options 1109 */ 1110 function create(patterns, options) { 1111 return __awaiter(this, void 0, void 0, function* () { 1112 return yield internal_globber_1.DefaultGlobber.create(patterns, options); 1113 }); 1114 } 1115 exports.create = create; 1116 //# sourceMappingURL=glob.js.map 1117 1118 /***/ }), 1119 1120 /***/ 1026: 1121 /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 1122 1123 "use strict"; 1124 1125 Object.defineProperty(exports, "__esModule", ({ value: true })); 1126 const core = __nccwpck_require__(2186); 1127 /** 1128 * Returns a copy with defaults filled in. 1129 */ 1130 function getOptions(copy) { 1131 const result = { 1132 followSymbolicLinks: true, 1133 implicitDescendants: true, 1134 omitBrokenSymbolicLinks: true 1135 }; 1136 if (copy) { 1137 if (typeof copy.followSymbolicLinks === 'boolean') { 1138 result.followSymbolicLinks = copy.followSymbolicLinks; 1139 core.debug(`followSymbolicLinks '${result.followSymbolicLinks}'`); 1140 } 1141 if (typeof copy.implicitDescendants === 'boolean') { 1142 result.implicitDescendants = copy.implicitDescendants; 1143 core.debug(`implicitDescendants '${result.implicitDescendants}'`); 1144 } 1145 if (typeof copy.omitBrokenSymbolicLinks === 'boolean') { 1146 result.omitBrokenSymbolicLinks = copy.omitBrokenSymbolicLinks; 1147 core.debug(`omitBrokenSymbolicLinks '${result.omitBrokenSymbolicLinks}'`); 1148 } 1149 } 1150 return result; 1151 } 1152 exports.getOptions = getOptions; 1153 //# sourceMappingURL=internal-glob-options-helper.js.map 1154 1155 /***/ }), 1156 1157 /***/ 8298: 1158 /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 1159 1160 "use strict"; 1161 1162 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 1163 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 1164 return new (P || (P = Promise))(function (resolve, reject) { 1165 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 1166 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 1167 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 1168 step((generator = generator.apply(thisArg, _arguments || [])).next()); 1169 }); 1170 }; 1171 var __asyncValues = (this && this.__asyncValues) || function (o) { 1172 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 1173 var m = o[Symbol.asyncIterator], i; 1174 return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); 1175 function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } 1176 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } 1177 }; 1178 var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } 1179 var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) { 1180 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 1181 var g = generator.apply(thisArg, _arguments || []), i, q = []; 1182 return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; 1183 function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } 1184 function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } 1185 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } 1186 function fulfill(value) { resume("next", value); } 1187 function reject(value) { resume("throw", value); } 1188 function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } 1189 }; 1190 Object.defineProperty(exports, "__esModule", ({ value: true })); 1191 const core = __nccwpck_require__(2186); 1192 const fs = __nccwpck_require__(7147); 1193 const globOptionsHelper = __nccwpck_require__(1026); 1194 const path = __nccwpck_require__(1017); 1195 const patternHelper = __nccwpck_require__(9005); 1196 const internal_match_kind_1 = __nccwpck_require__(1063); 1197 const internal_pattern_1 = __nccwpck_require__(4536); 1198 const internal_search_state_1 = __nccwpck_require__(9117); 1199 const IS_WINDOWS = process.platform === 'win32'; 1200 class DefaultGlobber { 1201 constructor(options) { 1202 this.patterns = []; 1203 this.searchPaths = []; 1204 this.options = globOptionsHelper.getOptions(options); 1205 } 1206 getSearchPaths() { 1207 // Return a copy 1208 return this.searchPaths.slice(); 1209 } 1210 glob() { 1211 var e_1, _a; 1212 return __awaiter(this, void 0, void 0, function* () { 1213 const result = []; 1214 try { 1215 for (var _b = __asyncValues(this.globGenerator()), _c; _c = yield _b.next(), !_c.done;) { 1216 const itemPath = _c.value; 1217 result.push(itemPath); 1218 } 1219 } 1220 catch (e_1_1) { e_1 = { error: e_1_1 }; } 1221 finally { 1222 try { 1223 if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b); 1224 } 1225 finally { if (e_1) throw e_1.error; } 1226 } 1227 return result; 1228 }); 1229 } 1230 globGenerator() { 1231 return __asyncGenerator(this, arguments, function* globGenerator_1() { 1232 // Fill in defaults options 1233 const options = globOptionsHelper.getOptions(this.options); 1234 // Implicit descendants? 1235 const patterns = []; 1236 for (const pattern of this.patterns) { 1237 patterns.push(pattern); 1238 if (options.implicitDescendants && 1239 (pattern.trailingSeparator || 1240 pattern.segments[pattern.segments.length - 1] !== '**')) { 1241 patterns.push(new internal_pattern_1.Pattern(pattern.negate, pattern.segments.concat('**'))); 1242 } 1243 } 1244 // Push the search paths 1245 const stack = []; 1246 for (const searchPath of patternHelper.getSearchPaths(patterns)) { 1247 core.debug(`Search path '${searchPath}'`); 1248 // Exists? 1249 try { 1250 // Intentionally using lstat. Detection for broken symlink 1251 // will be performed later (if following symlinks). 1252 yield __await(fs.promises.lstat(searchPath)); 1253 } 1254 catch (err) { 1255 if (err.code === 'ENOENT') { 1256 continue; 1257 } 1258 throw err; 1259 } 1260 stack.unshift(new internal_search_state_1.SearchState(searchPath, 1)); 1261 } 1262 // Search 1263 const traversalChain = []; // used to detect cycles 1264 while (stack.length) { 1265 // Pop 1266 const item = stack.pop(); 1267 // Match? 1268 const match = patternHelper.match(patterns, item.path); 1269 const partialMatch = !!match || patternHelper.partialMatch(patterns, item.path); 1270 if (!match && !partialMatch) { 1271 continue; 1272 } 1273 // Stat 1274 const stats = yield __await(DefaultGlobber.stat(item, options, traversalChain) 1275 // Broken symlink, or symlink cycle detected, or no longer exists 1276 ); 1277 // Broken symlink, or symlink cycle detected, or no longer exists 1278 if (!stats) { 1279 continue; 1280 } 1281 // Directory 1282 if (stats.isDirectory()) { 1283 // Matched 1284 if (match & internal_match_kind_1.MatchKind.Directory) { 1285 yield yield __await(item.path); 1286 } 1287 // Descend? 1288 else if (!partialMatch) { 1289 continue; 1290 } 1291 // Push the child items in reverse 1292 const childLevel = item.level + 1; 1293 const childItems = (yield __await(fs.promises.readdir(item.path))).map(x => new internal_search_state_1.SearchState(path.join(item.path, x), childLevel)); 1294 stack.push(...childItems.reverse()); 1295 } 1296 // File 1297 else if (match & internal_match_kind_1.MatchKind.File) { 1298 yield yield __await(item.path); 1299 } 1300 } 1301 }); 1302 } 1303 /** 1304 * Constructs a DefaultGlobber 1305 */ 1306 static create(patterns, options) { 1307 return __awaiter(this, void 0, void 0, function* () { 1308 const result = new DefaultGlobber(options); 1309 if (IS_WINDOWS) { 1310 patterns = patterns.replace(/\r\n/g, '\n'); 1311 patterns = patterns.replace(/\r/g, '\n'); 1312 } 1313 const lines = patterns.split('\n').map(x => x.trim()); 1314 for (const line of lines) { 1315 // Empty or comment 1316 if (!line || line.startsWith('#')) { 1317 continue; 1318 } 1319 // Pattern 1320 else { 1321 result.patterns.push(new internal_pattern_1.Pattern(line)); 1322 } 1323 } 1324 result.searchPaths.push(...patternHelper.getSearchPaths(result.patterns)); 1325 return result; 1326 }); 1327 } 1328 static stat(item, options, traversalChain) { 1329 return __awaiter(this, void 0, void 0, function* () { 1330 // Note: 1331 // `stat` returns info about the target of a symlink (or symlink chain) 1332 // `lstat` returns info about a symlink itself 1333 let stats; 1334 if (options.followSymbolicLinks) { 1335 try { 1336 // Use `stat` (following symlinks) 1337 stats = yield fs.promises.stat(item.path); 1338 } 1339 catch (err) { 1340 if (err.code === 'ENOENT') { 1341 if (options.omitBrokenSymbolicLinks) { 1342 core.debug(`Broken symlink '${item.path}'`); 1343 return undefined; 1344 } 1345 throw new Error(`No information found for the path '${item.path}'. This may indicate a broken symbolic link.`); 1346 } 1347 throw err; 1348 } 1349 } 1350 else { 1351 // Use `lstat` (not following symlinks) 1352 stats = yield fs.promises.lstat(item.path); 1353 } 1354 // Note, isDirectory() returns false for the lstat of a symlink 1355 if (stats.isDirectory() && options.followSymbolicLinks) { 1356 // Get the realpath 1357 const realPath = yield fs.promises.realpath(item.path); 1358 // Fixup the traversal chain to match the item level 1359 while (traversalChain.length >= item.level) { 1360 traversalChain.pop(); 1361 } 1362 // Test for a cycle 1363 if (traversalChain.some((x) => x === realPath)) { 1364 core.debug(`Symlink cycle detected for path '${item.path}' and realpath '${realPath}'`); 1365 return undefined; 1366 } 1367 // Update the traversal chain 1368 traversalChain.push(realPath); 1369 } 1370 return stats; 1371 }); 1372 } 1373 } 1374 exports.DefaultGlobber = DefaultGlobber; 1375 //# sourceMappingURL=internal-globber.js.map 1376 1377 /***/ }), 1378 1379 /***/ 1063: 1380 /***/ ((__unused_webpack_module, exports) => { 1381 1382 "use strict"; 1383 1384 Object.defineProperty(exports, "__esModule", ({ value: true })); 1385 /** 1386 * Indicates whether a pattern matches a path 1387 */ 1388 var MatchKind; 1389 (function (MatchKind) { 1390 /** Not matched */ 1391 MatchKind[MatchKind["None"] = 0] = "None"; 1392 /** Matched if the path is a directory */ 1393 MatchKind[MatchKind["Directory"] = 1] = "Directory"; 1394 /** Matched if the path is a regular file */ 1395 MatchKind[MatchKind["File"] = 2] = "File"; 1396 /** Matched */ 1397 MatchKind[MatchKind["All"] = 3] = "All"; 1398 })(MatchKind = exports.MatchKind || (exports.MatchKind = {})); 1399 //# sourceMappingURL=internal-match-kind.js.map 1400 1401 /***/ }), 1402 1403 /***/ 1849: 1404 /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 1405 1406 "use strict"; 1407 1408 Object.defineProperty(exports, "__esModule", ({ value: true })); 1409 const assert = __nccwpck_require__(9491); 1410 const path = __nccwpck_require__(1017); 1411 const IS_WINDOWS = process.platform === 'win32'; 1412 /** 1413 * Similar to path.dirname except normalizes the path separators and slightly better handling for Windows UNC paths. 1414 * 1415 * For example, on Linux/macOS: 1416 * - `/ => /` 1417 * - `/hello => /` 1418 * 1419 * For example, on Windows: 1420 * - `C:\ => C:\` 1421 * - `C:\hello => C:\` 1422 * - `C: => C:` 1423 * - `C:hello => C:` 1424 * - `\ => \` 1425 * - `\hello => \` 1426 * - `\\hello => \\hello` 1427 * - `\\hello\world => \\hello\world` 1428 */ 1429 function dirname(p) { 1430 // Normalize slashes and trim unnecessary trailing slash 1431 p = safeTrimTrailingSeparator(p); 1432 // Windows UNC root, e.g. \\hello or \\hello\world 1433 if (IS_WINDOWS && /^\\\\[^\\]+(\\[^\\]+)?$/.test(p)) { 1434 return p; 1435 } 1436 // Get dirname 1437 let result = path.dirname(p); 1438 // Trim trailing slash for Windows UNC root, e.g. \\hello\world\ 1439 if (IS_WINDOWS && /^\\\\[^\\]+\\[^\\]+\\$/.test(result)) { 1440 result = safeTrimTrailingSeparator(result); 1441 } 1442 return result; 1443 } 1444 exports.dirname = dirname; 1445 /** 1446 * Roots the path if not already rooted. On Windows, relative roots like `\` 1447 * or `C:` are expanded based on the current working directory. 1448 */ 1449 function ensureAbsoluteRoot(root, itemPath) { 1450 assert(root, `ensureAbsoluteRoot parameter 'root' must not be empty`); 1451 assert(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`); 1452 // Already rooted 1453 if (hasAbsoluteRoot(itemPath)) { 1454 return itemPath; 1455 } 1456 // Windows 1457 if (IS_WINDOWS) { 1458 // Check for itemPath like C: or C:foo 1459 if (itemPath.match(/^[A-Z]:[^\\/]|^[A-Z]:$/i)) { 1460 let cwd = process.cwd(); 1461 assert(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`); 1462 // Drive letter matches cwd? Expand to cwd 1463 if (itemPath[0].toUpperCase() === cwd[0].toUpperCase()) { 1464 // Drive only, e.g. C: 1465 if (itemPath.length === 2) { 1466 // Preserve specified drive letter case (upper or lower) 1467 return `${itemPath[0]}:\\${cwd.substr(3)}`; 1468 } 1469 // Drive + path, e.g. C:foo 1470 else { 1471 if (!cwd.endsWith('\\')) { 1472 cwd += '\\'; 1473 } 1474 // Preserve specified drive letter case (upper or lower) 1475 return `${itemPath[0]}:\\${cwd.substr(3)}${itemPath.substr(2)}`; 1476 } 1477 } 1478 // Different drive 1479 else { 1480 return `${itemPath[0]}:\\${itemPath.substr(2)}`; 1481 } 1482 } 1483 // Check for itemPath like \ or \foo 1484 else if (normalizeSeparators(itemPath).match(/^\\$|^\\[^\\]/)) { 1485 const cwd = process.cwd(); 1486 assert(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`); 1487 return `${cwd[0]}:\\${itemPath.substr(1)}`; 1488 } 1489 } 1490 assert(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`); 1491 // Otherwise ensure root ends with a separator 1492 if (root.endsWith('/') || (IS_WINDOWS && root.endsWith('\\'))) { 1493 // Intentionally empty 1494 } 1495 else { 1496 // Append separator 1497 root += path.sep; 1498 } 1499 return root + itemPath; 1500 } 1501 exports.ensureAbsoluteRoot = ensureAbsoluteRoot; 1502 /** 1503 * On Linux/macOS, true if path starts with `/`. On Windows, true for paths like: 1504 * `\\hello\share` and `C:\hello` (and using alternate separator). 1505 */ 1506 function hasAbsoluteRoot(itemPath) { 1507 assert(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`); 1508 // Normalize separators 1509 itemPath = normalizeSeparators(itemPath); 1510 // Windows 1511 if (IS_WINDOWS) { 1512 // E.g. \\hello\share or C:\hello 1513 return itemPath.startsWith('\\\\') || /^[A-Z]:\\/i.test(itemPath); 1514 } 1515 // E.g. /hello 1516 return itemPath.startsWith('/'); 1517 } 1518 exports.hasAbsoluteRoot = hasAbsoluteRoot; 1519 /** 1520 * On Linux/macOS, true if path starts with `/`. On Windows, true for paths like: 1521 * `\`, `\hello`, `\\hello\share`, `C:`, and `C:\hello` (and using alternate separator). 1522 */ 1523 function hasRoot(itemPath) { 1524 assert(itemPath, `isRooted parameter 'itemPath' must not be empty`); 1525 // Normalize separators 1526 itemPath = normalizeSeparators(itemPath); 1527 // Windows 1528 if (IS_WINDOWS) { 1529 // E.g. \ or \hello or \\hello 1530 // E.g. C: or C:\hello 1531 return itemPath.startsWith('\\') || /^[A-Z]:/i.test(itemPath); 1532 } 1533 // E.g. /hello 1534 return itemPath.startsWith('/'); 1535 } 1536 exports.hasRoot = hasRoot; 1537 /** 1538 * Removes redundant slashes and converts `/` to `\` on Windows 1539 */ 1540 function normalizeSeparators(p) { 1541 p = p || ''; 1542 // Windows 1543 if (IS_WINDOWS) { 1544 // Convert slashes on Windows 1545 p = p.replace(/\//g, '\\'); 1546 // Remove redundant slashes 1547 const isUnc = /^\\\\+[^\\]/.test(p); // e.g. \\hello 1548 return (isUnc ? '\\' : '') + p.replace(/\\\\+/g, '\\'); // preserve leading \\ for UNC 1549 } 1550 // Remove redundant slashes 1551 return p.replace(/\/\/+/g, '/'); 1552 } 1553 exports.normalizeSeparators = normalizeSeparators; 1554 /** 1555 * Normalizes the path separators and trims the trailing separator (when safe). 1556 * For example, `/foo/ => /foo` but `/ => /` 1557 */ 1558 function safeTrimTrailingSeparator(p) { 1559 // Short-circuit if empty 1560 if (!p) { 1561 return ''; 1562 } 1563 // Normalize separators 1564 p = normalizeSeparators(p); 1565 // No trailing slash 1566 if (!p.endsWith(path.sep)) { 1567 return p; 1568 } 1569 // Check '/' on Linux/macOS and '\' on Windows 1570 if (p === path.sep) { 1571 return p; 1572 } 1573 // On Windows check if drive root. E.g. C:\ 1574 if (IS_WINDOWS && /^[A-Z]:\\$/i.test(p)) { 1575 return p; 1576 } 1577 // Otherwise trim trailing slash 1578 return p.substr(0, p.length - 1); 1579 } 1580 exports.safeTrimTrailingSeparator = safeTrimTrailingSeparator; 1581 //# sourceMappingURL=internal-path-helper.js.map 1582 1583 /***/ }), 1584 1585 /***/ 6836: 1586 /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 1587 1588 "use strict"; 1589 1590 Object.defineProperty(exports, "__esModule", ({ value: true })); 1591 const assert = __nccwpck_require__(9491); 1592 const path = __nccwpck_require__(1017); 1593 const pathHelper = __nccwpck_require__(1849); 1594 const IS_WINDOWS = process.platform === 'win32'; 1595 /** 1596 * Helper class for parsing paths into segments 1597 */ 1598 class Path { 1599 /** 1600 * Constructs a Path 1601 * @param itemPath Path or array of segments 1602 */ 1603 constructor(itemPath) { 1604 this.segments = []; 1605 // String 1606 if (typeof itemPath === 'string') { 1607 assert(itemPath, `Parameter 'itemPath' must not be empty`); 1608 // Normalize slashes and trim unnecessary trailing slash 1609 itemPath = pathHelper.safeTrimTrailingSeparator(itemPath); 1610 // Not rooted 1611 if (!pathHelper.hasRoot(itemPath)) { 1612 this.segments = itemPath.split(path.sep); 1613 } 1614 // Rooted 1615 else { 1616 // Add all segments, while not at the root 1617 let remaining = itemPath; 1618 let dir = pathHelper.dirname(remaining); 1619 while (dir !== remaining) { 1620 // Add the segment 1621 const basename = path.basename(remaining); 1622 this.segments.unshift(basename); 1623 // Truncate the last segment 1624 remaining = dir; 1625 dir = pathHelper.dirname(remaining); 1626 } 1627 // Remainder is the root 1628 this.segments.unshift(remaining); 1629 } 1630 } 1631 // Array 1632 else { 1633 // Must not be empty 1634 assert(itemPath.length > 0, `Parameter 'itemPath' must not be an empty array`); 1635 // Each segment 1636 for (let i = 0; i < itemPath.length; i++) { 1637 let segment = itemPath[i]; 1638 // Must not be empty 1639 assert(segment, `Parameter 'itemPath' must not contain any empty segments`); 1640 // Normalize slashes 1641 segment = pathHelper.normalizeSeparators(itemPath[i]); 1642 // Root segment 1643 if (i === 0 && pathHelper.hasRoot(segment)) { 1644 segment = pathHelper.safeTrimTrailingSeparator(segment); 1645 assert(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`); 1646 this.segments.push(segment); 1647 } 1648 // All other segments 1649 else { 1650 // Must not contain slash 1651 assert(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`); 1652 this.segments.push(segment); 1653 } 1654 } 1655 } 1656 } 1657 /** 1658 * Converts the path to it's string representation 1659 */ 1660 toString() { 1661 // First segment 1662 let result = this.segments[0]; 1663 // All others 1664 let skipSlash = result.endsWith(path.sep) || (IS_WINDOWS && /^[A-Z]:$/i.test(result)); 1665 for (let i = 1; i < this.segments.length; i++) { 1666 if (skipSlash) { 1667 skipSlash = false; 1668 } 1669 else { 1670 result += path.sep; 1671 } 1672 result += this.segments[i]; 1673 } 1674 return result; 1675 } 1676 } 1677 exports.Path = Path; 1678 //# sourceMappingURL=internal-path.js.map 1679 1680 /***/ }), 1681 1682 /***/ 9005: 1683 /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 1684 1685 "use strict"; 1686 1687 Object.defineProperty(exports, "__esModule", ({ value: true })); 1688 const pathHelper = __nccwpck_require__(1849); 1689 const internal_match_kind_1 = __nccwpck_require__(1063); 1690 const IS_WINDOWS = process.platform === 'win32'; 1691 /** 1692 * Given an array of patterns, returns an array of paths to search. 1693 * Duplicates and paths under other included paths are filtered out. 1694 */ 1695 function getSearchPaths(patterns) { 1696 // Ignore negate patterns 1697 patterns = patterns.filter(x => !x.negate); 1698 // Create a map of all search paths 1699 const searchPathMap = {}; 1700 for (const pattern of patterns) { 1701 const key = IS_WINDOWS 1702 ? pattern.searchPath.toUpperCase() 1703 : pattern.searchPath; 1704 searchPathMap[key] = 'candidate'; 1705 } 1706 const result = []; 1707 for (const pattern of patterns) { 1708 // Check if already included 1709 const key = IS_WINDOWS 1710 ? pattern.searchPath.toUpperCase() 1711 : pattern.searchPath; 1712 if (searchPathMap[key] === 'included') { 1713 continue; 1714 } 1715 // Check for an ancestor search path 1716 let foundAncestor = false; 1717 let tempKey = key; 1718 let parent = pathHelper.dirname(tempKey); 1719 while (parent !== tempKey) { 1720 if (searchPathMap[parent]) { 1721 foundAncestor = true; 1722 break; 1723 } 1724 tempKey = parent; 1725 parent = pathHelper.dirname(tempKey); 1726 } 1727 // Include the search pattern in the result 1728 if (!foundAncestor) { 1729 result.push(pattern.searchPath); 1730 searchPathMap[key] = 'included'; 1731 } 1732 } 1733 return result; 1734 } 1735 exports.getSearchPaths = getSearchPaths; 1736 /** 1737 * Matches the patterns against the path 1738 */ 1739 function match(patterns, itemPath) { 1740 let result = internal_match_kind_1.MatchKind.None; 1741 for (const pattern of patterns) { 1742 if (pattern.negate) { 1743 result &= ~pattern.match(itemPath); 1744 } 1745 else { 1746 result |= pattern.match(itemPath); 1747 } 1748 } 1749 return result; 1750 } 1751 exports.match = match; 1752 /** 1753 * Checks whether to descend further into the directory 1754 */ 1755 function partialMatch(patterns, itemPath) { 1756 return patterns.some(x => !x.negate && x.partialMatch(itemPath)); 1757 } 1758 exports.partialMatch = partialMatch; 1759 //# sourceMappingURL=internal-pattern-helper.js.map 1760 1761 /***/ }), 1762 1763 /***/ 4536: 1764 /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 1765 1766 "use strict"; 1767 1768 Object.defineProperty(exports, "__esModule", ({ value: true })); 1769 const assert = __nccwpck_require__(9491); 1770 const os = __nccwpck_require__(2037); 1771 const path = __nccwpck_require__(1017); 1772 const pathHelper = __nccwpck_require__(1849); 1773 const minimatch_1 = __nccwpck_require__(3973); 1774 const internal_match_kind_1 = __nccwpck_require__(1063); 1775 const internal_path_1 = __nccwpck_require__(6836); 1776 const IS_WINDOWS = process.platform === 'win32'; 1777 class Pattern { 1778 constructor(patternOrNegate, segments) { 1779 /** 1780 * Indicates whether matches should be excluded from the result set 1781 */ 1782 this.negate = false; 1783 // Pattern overload 1784 let pattern; 1785 if (typeof patternOrNegate === 'string') { 1786 pattern = patternOrNegate.trim(); 1787 } 1788 // Segments overload 1789 else { 1790 // Convert to pattern 1791 segments = segments || []; 1792 assert(segments.length, `Parameter 'segments' must not empty`); 1793 const root = Pattern.getLiteral(segments[0]); 1794 assert(root && pathHelper.hasAbsoluteRoot(root), `Parameter 'segments' first element must be a root path`); 1795 pattern = new internal_path_1.Path(segments).toString().trim(); 1796 if (patternOrNegate) { 1797 pattern = `!${pattern}`; 1798 } 1799 } 1800 // Negate 1801 while (pattern.startsWith('!')) { 1802 this.negate = !this.negate; 1803 pattern = pattern.substr(1).trim(); 1804 } 1805 // Normalize slashes and ensures absolute root 1806 pattern = Pattern.fixupPattern(pattern); 1807 // Segments 1808 this.segments = new internal_path_1.Path(pattern).segments; 1809 // Trailing slash indicates the pattern should only match directories, not regular files 1810 this.trailingSeparator = pathHelper 1811 .normalizeSeparators(pattern) 1812 .endsWith(path.sep); 1813 pattern = pathHelper.safeTrimTrailingSeparator(pattern); 1814 // Search path (literal path prior to the first glob segment) 1815 let foundGlob = false; 1816 const searchSegments = this.segments 1817 .map(x => Pattern.getLiteral(x)) 1818 .filter(x => !foundGlob && !(foundGlob = x === '')); 1819 this.searchPath = new internal_path_1.Path(searchSegments).toString(); 1820 // Root RegExp (required when determining partial match) 1821 this.rootRegExp = new RegExp(Pattern.regExpEscape(searchSegments[0]), IS_WINDOWS ? 'i' : ''); 1822 // Create minimatch 1823 const minimatchOptions = { 1824 dot: true, 1825 nobrace: true, 1826 nocase: IS_WINDOWS, 1827 nocomment: true, 1828 noext: true, 1829 nonegate: true 1830 }; 1831 pattern = IS_WINDOWS ? pattern.replace(/\\/g, '/') : pattern; 1832 this.minimatch = new minimatch_1.Minimatch(pattern, minimatchOptions); 1833 } 1834 /** 1835 * Matches the pattern against the specified path 1836 */ 1837 match(itemPath) { 1838 // Last segment is globstar? 1839 if (this.segments[this.segments.length - 1] === '**') { 1840 // Normalize slashes 1841 itemPath = pathHelper.normalizeSeparators(itemPath); 1842 // Append a trailing slash. Otherwise Minimatch will not match the directory immediately 1843 // preceding the globstar. For example, given the pattern `/foo/**`, Minimatch returns 1844 // false for `/foo` but returns true for `/foo/`. Append a trailing slash to handle that quirk. 1845 if (!itemPath.endsWith(path.sep)) { 1846 // Note, this is safe because the constructor ensures the pattern has an absolute root. 1847 // For example, formats like C: and C:foo on Windows are resolved to an aboslute root. 1848 itemPath = `${itemPath}${path.sep}`; 1849 } 1850 } 1851 else { 1852 // Normalize slashes and trim unnecessary trailing slash 1853 itemPath = pathHelper.safeTrimTrailingSeparator(itemPath); 1854 } 1855 // Match 1856 if (this.minimatch.match(itemPath)) { 1857 return this.trailingSeparator ? internal_match_kind_1.MatchKind.Directory : internal_match_kind_1.MatchKind.All; 1858 } 1859 return internal_match_kind_1.MatchKind.None; 1860 } 1861 /** 1862 * Indicates whether the pattern may match descendants of the specified path 1863 */ 1864 partialMatch(itemPath) { 1865 // Normalize slashes and trim unnecessary trailing slash 1866 itemPath = pathHelper.safeTrimTrailingSeparator(itemPath); 1867 // matchOne does not handle root path correctly 1868 if (pathHelper.dirname(itemPath) === itemPath) { 1869 return this.rootRegExp.test(itemPath); 1870 } 1871 return this.minimatch.matchOne(itemPath.split(IS_WINDOWS ? /\\+/ : /\/+/), this.minimatch.set[0], true); 1872 } 1873 /** 1874 * Escapes glob patterns within a path 1875 */ 1876 static globEscape(s) { 1877 return (IS_WINDOWS ? s : s.replace(/\\/g, '\\\\')) // escape '\' on Linux/macOS 1878 .replace(/(\[)(?=[^/]+\])/g, '[[]') // escape '[' when ']' follows within the path segment 1879 .replace(/\?/g, '[?]') // escape '?' 1880 .replace(/\*/g, '[*]'); // escape '*' 1881 } 1882 /** 1883 * Normalizes slashes and ensures absolute root 1884 */ 1885 static fixupPattern(pattern) { 1886 // Empty 1887 assert(pattern, 'pattern cannot be empty'); 1888 // Must not contain `.` segment, unless first segment 1889 // Must not contain `..` segment 1890 const literalSegments = new internal_path_1.Path(pattern).segments.map(x => Pattern.getLiteral(x)); 1891 assert(literalSegments.every((x, i) => (x !== '.' || i === 0) && x !== '..'), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`); 1892 // Must not contain globs in root, e.g. Windows UNC path \\foo\b*r 1893 assert(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`); 1894 // Normalize slashes 1895 pattern = pathHelper.normalizeSeparators(pattern); 1896 // Replace leading `.` segment 1897 if (pattern === '.' || pattern.startsWith(`.${path.sep}`)) { 1898 pattern = Pattern.globEscape(process.cwd()) + pattern.substr(1); 1899 } 1900 // Replace leading `~` segment 1901 else if (pattern === '~' || pattern.startsWith(`~${path.sep}`)) { 1902 const homedir = os.homedir(); 1903 assert(homedir, 'Unable to determine HOME directory'); 1904 assert(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`); 1905 pattern = Pattern.globEscape(homedir) + pattern.substr(1); 1906 } 1907 // Replace relative drive root, e.g. pattern is C: or C:foo 1908 else if (IS_WINDOWS && 1909 (pattern.match(/^[A-Z]:$/i) || pattern.match(/^[A-Z]:[^\\]/i))) { 1910 let root = pathHelper.ensureAbsoluteRoot('C:\\dummy-root', pattern.substr(0, 2)); 1911 if (pattern.length > 2 && !root.endsWith('\\')) { 1912 root += '\\'; 1913 } 1914 pattern = Pattern.globEscape(root) + pattern.substr(2); 1915 } 1916 // Replace relative root, e.g. pattern is \ or \foo 1917 else if (IS_WINDOWS && (pattern === '\\' || pattern.match(/^\\[^\\]/))) { 1918 let root = pathHelper.ensureAbsoluteRoot('C:\\dummy-root', '\\'); 1919 if (!root.endsWith('\\')) { 1920 root += '\\'; 1921 } 1922 pattern = Pattern.globEscape(root) + pattern.substr(1); 1923 } 1924 // Otherwise ensure absolute root 1925 else { 1926 pattern = pathHelper.ensureAbsoluteRoot(Pattern.globEscape(process.cwd()), pattern); 1927 } 1928 return pathHelper.normalizeSeparators(pattern); 1929 } 1930 /** 1931 * Attempts to unescape a pattern segment to create a literal path segment. 1932 * Otherwise returns empty string. 1933 */ 1934 static getLiteral(segment) { 1935 let literal = ''; 1936 for (let i = 0; i < segment.length; i++) { 1937 const c = segment[i]; 1938 // Escape 1939 if (c === '\\' && !IS_WINDOWS && i + 1 < segment.length) { 1940 literal += segment[++i]; 1941 continue; 1942 } 1943 // Wildcard 1944 else if (c === '*' || c === '?') { 1945 return ''; 1946 } 1947 // Character set 1948 else if (c === '[' && i + 1 < segment.length) { 1949 let set = ''; 1950 let closed = -1; 1951 for (let i2 = i + 1; i2 < segment.length; i2++) { 1952 const c2 = segment[i2]; 1953 // Escape 1954 if (c2 === '\\' && !IS_WINDOWS && i2 + 1 < segment.length) { 1955 set += segment[++i2]; 1956 continue; 1957 } 1958 // Closed 1959 else if (c2 === ']') { 1960 closed = i2; 1961 break; 1962 } 1963 // Otherwise 1964 else { 1965 set += c2; 1966 } 1967 } 1968 // Closed? 1969 if (closed >= 0) { 1970 // Cannot convert 1971 if (set.length > 1) { 1972 return ''; 1973 } 1974 // Convert to literal 1975 if (set) { 1976 literal += set; 1977 i = closed; 1978 continue; 1979 } 1980 } 1981 // Otherwise fall thru 1982 } 1983 // Append 1984 literal += c; 1985 } 1986 return literal; 1987 } 1988 /** 1989 * Escapes regexp special characters 1990 * https://javascript.info/regexp-escaping 1991 */ 1992 static regExpEscape(s) { 1993 return s.replace(/[[\\^$.|?*+()]/g, '\\$&'); 1994 } 1995 } 1996 exports.Pattern = Pattern; 1997 //# sourceMappingURL=internal-pattern.js.map 1998 1999 /***/ }), 2000 2001 /***/ 9117: 2002 /***/ ((__unused_webpack_module, exports) => { 2003 2004 "use strict"; 2005 2006 Object.defineProperty(exports, "__esModule", ({ value: true })); 2007 class SearchState { 2008 constructor(path, level) { 2009 this.path = path; 2010 this.level = level; 2011 } 2012 } 2013 exports.SearchState = SearchState; 2014 //# sourceMappingURL=internal-search-state.js.map 2015 2016 /***/ }), 2017 2018 /***/ 5526: 2019 /***/ (function(__unused_webpack_module, exports) { 2020 2021 "use strict"; 2022 2023 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 2024 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 2025 return new (P || (P = Promise))(function (resolve, reject) { 2026 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 2027 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 2028 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 2029 step((generator = generator.apply(thisArg, _arguments || [])).next()); 2030 }); 2031 }; 2032 Object.defineProperty(exports, "__esModule", ({ value: true })); 2033 exports.PersonalAccessTokenCredentialHandler = exports.BearerCredentialHandler = exports.BasicCredentialHandler = void 0; 2034 class BasicCredentialHandler { 2035 constructor(username, password) { 2036 this.username = username; 2037 this.password = password; 2038 } 2039 prepareRequest(options) { 2040 if (!options.headers) { 2041 throw Error('The request has no headers'); 2042 } 2043 options.headers['Authorization'] = `Basic ${Buffer.from(`${this.username}:${this.password}`).toString('base64')}`; 2044 } 2045 // This handler cannot handle 401 2046 canHandleAuthentication() { 2047 return false; 2048 } 2049 handleAuthentication() { 2050 return __awaiter(this, void 0, void 0, function* () { 2051 throw new Error('not implemented'); 2052 }); 2053 } 2054 } 2055 exports.BasicCredentialHandler = BasicCredentialHandler; 2056 class BearerCredentialHandler { 2057 constructor(token) { 2058 this.token = token; 2059 } 2060 // currently implements pre-authorization 2061 // TODO: support preAuth = false where it hooks on 401 2062 prepareRequest(options) { 2063 if (!options.headers) { 2064 throw Error('The request has no headers'); 2065 } 2066 options.headers['Authorization'] = `Bearer ${this.token}`; 2067 } 2068 // This handler cannot handle 401 2069 canHandleAuthentication() { 2070 return false; 2071 } 2072 handleAuthentication() { 2073 return __awaiter(this, void 0, void 0, function* () { 2074 throw new Error('not implemented'); 2075 }); 2076 } 2077 } 2078 exports.BearerCredentialHandler = BearerCredentialHandler; 2079 class PersonalAccessTokenCredentialHandler { 2080 constructor(token) { 2081 this.token = token; 2082 } 2083 // currently implements pre-authorization 2084 // TODO: support preAuth = false where it hooks on 401 2085 prepareRequest(options) { 2086 if (!options.headers) { 2087 throw Error('The request has no headers'); 2088 } 2089 options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`; 2090 } 2091 // This handler cannot handle 401 2092 canHandleAuthentication() { 2093 return false; 2094 } 2095 handleAuthentication() { 2096 return __awaiter(this, void 0, void 0, function* () { 2097 throw new Error('not implemented'); 2098 }); 2099 } 2100 } 2101 exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler; 2102 //# sourceMappingURL=auth.js.map 2103 2104 /***/ }), 2105 2106 /***/ 6255: 2107 /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 2108 2109 "use strict"; 2110 2111 /* eslint-disable @typescript-eslint/no-explicit-any */ 2112 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 2113 if (k2 === undefined) k2 = k; 2114 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 2115 }) : (function(o, m, k, k2) { 2116 if (k2 === undefined) k2 = k; 2117 o[k2] = m[k]; 2118 })); 2119 var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 2120 Object.defineProperty(o, "default", { enumerable: true, value: v }); 2121 }) : function(o, v) { 2122 o["default"] = v; 2123 }); 2124 var __importStar = (this && this.__importStar) || function (mod) { 2125 if (mod && mod.__esModule) return mod; 2126 var result = {}; 2127 if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 2128 __setModuleDefault(result, mod); 2129 return result; 2130 }; 2131 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 2132 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 2133 return new (P || (P = Promise))(function (resolve, reject) { 2134 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 2135 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 2136 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 2137 step((generator = generator.apply(thisArg, _arguments || [])).next()); 2138 }); 2139 }; 2140 Object.defineProperty(exports, "__esModule", ({ value: true })); 2141 exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0; 2142 const http = __importStar(__nccwpck_require__(3685)); 2143 const https = __importStar(__nccwpck_require__(5687)); 2144 const pm = __importStar(__nccwpck_require__(9835)); 2145 const tunnel = __importStar(__nccwpck_require__(4294)); 2146 var HttpCodes; 2147 (function (HttpCodes) { 2148 HttpCodes[HttpCodes["OK"] = 200] = "OK"; 2149 HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices"; 2150 HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently"; 2151 HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved"; 2152 HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther"; 2153 HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified"; 2154 HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy"; 2155 HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy"; 2156 HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect"; 2157 HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect"; 2158 HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest"; 2159 HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized"; 2160 HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired"; 2161 HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden"; 2162 HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound"; 2163 HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed"; 2164 HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable"; 2165 HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; 2166 HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout"; 2167 HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict"; 2168 HttpCodes[HttpCodes["Gone"] = 410] = "Gone"; 2169 HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests"; 2170 HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError"; 2171 HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented"; 2172 HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway"; 2173 HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable"; 2174 HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout"; 2175 })(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {})); 2176 var Headers; 2177 (function (Headers) { 2178 Headers["Accept"] = "accept"; 2179 Headers["ContentType"] = "content-type"; 2180 })(Headers = exports.Headers || (exports.Headers = {})); 2181 var MediaTypes; 2182 (function (MediaTypes) { 2183 MediaTypes["ApplicationJson"] = "application/json"; 2184 })(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {})); 2185 /** 2186 * Returns the proxy URL, depending upon the supplied url and proxy environment variables. 2187 * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com 2188 */ 2189 function getProxyUrl(serverUrl) { 2190 const proxyUrl = pm.getProxyUrl(new URL(serverUrl)); 2191 return proxyUrl ? proxyUrl.href : ''; 2192 } 2193 exports.getProxyUrl = getProxyUrl; 2194 const HttpRedirectCodes = [ 2195 HttpCodes.MovedPermanently, 2196 HttpCodes.ResourceMoved, 2197 HttpCodes.SeeOther, 2198 HttpCodes.TemporaryRedirect, 2199 HttpCodes.PermanentRedirect 2200 ]; 2201 const HttpResponseRetryCodes = [ 2202 HttpCodes.BadGateway, 2203 HttpCodes.ServiceUnavailable, 2204 HttpCodes.GatewayTimeout 2205 ]; 2206 const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD']; 2207 const ExponentialBackoffCeiling = 10; 2208 const ExponentialBackoffTimeSlice = 5; 2209 class HttpClientError extends Error { 2210 constructor(message, statusCode) { 2211 super(message); 2212 this.name = 'HttpClientError'; 2213 this.statusCode = statusCode; 2214 Object.setPrototypeOf(this, HttpClientError.prototype); 2215 } 2216 } 2217 exports.HttpClientError = HttpClientError; 2218 class HttpClientResponse { 2219 constructor(message) { 2220 this.message = message; 2221 } 2222 readBody() { 2223 return __awaiter(this, void 0, void 0, function* () { 2224 return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () { 2225 let output = Buffer.alloc(0); 2226 this.message.on('data', (chunk) => { 2227 output = Buffer.concat([output, chunk]); 2228 }); 2229 this.message.on('end', () => { 2230 resolve(output.toString()); 2231 }); 2232 })); 2233 }); 2234 } 2235 } 2236 exports.HttpClientResponse = HttpClientResponse; 2237 function isHttps(requestUrl) { 2238 const parsedUrl = new URL(requestUrl); 2239 return parsedUrl.protocol === 'https:'; 2240 } 2241 exports.isHttps = isHttps; 2242 class HttpClient { 2243 constructor(userAgent, handlers, requestOptions) { 2244 this._ignoreSslError = false; 2245 this._allowRedirects = true; 2246 this._allowRedirectDowngrade = false; 2247 this._maxRedirects = 50; 2248 this._allowRetries = false; 2249 this._maxRetries = 1; 2250 this._keepAlive = false; 2251 this._disposed = false; 2252 this.userAgent = userAgent; 2253 this.handlers = handlers || []; 2254 this.requestOptions = requestOptions; 2255 if (requestOptions) { 2256 if (requestOptions.ignoreSslError != null) { 2257 this._ignoreSslError = requestOptions.ignoreSslError; 2258 } 2259 this._socketTimeout = requestOptions.socketTimeout; 2260 if (requestOptions.allowRedirects != null) { 2261 this._allowRedirects = requestOptions.allowRedirects; 2262 } 2263 if (requestOptions.allowRedirectDowngrade != null) { 2264 this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade; 2265 } 2266 if (requestOptions.maxRedirects != null) { 2267 this._maxRedirects = Math.max(requestOptions.maxRedirects, 0); 2268 } 2269 if (requestOptions.keepAlive != null) { 2270 this._keepAlive = requestOptions.keepAlive; 2271 } 2272 if (requestOptions.allowRetries != null) { 2273 this._allowRetries = requestOptions.allowRetries; 2274 } 2275 if (requestOptions.maxRetries != null) { 2276 this._maxRetries = requestOptions.maxRetries; 2277 } 2278 } 2279 } 2280 options(requestUrl, additionalHeaders) { 2281 return __awaiter(this, void 0, void 0, function* () { 2282 return this.request('OPTIONS', requestUrl, null, additionalHeaders || {}); 2283 }); 2284 } 2285 get(requestUrl, additionalHeaders) { 2286 return __awaiter(this, void 0, void 0, function* () { 2287 return this.request('GET', requestUrl, null, additionalHeaders || {}); 2288 }); 2289 } 2290 del(requestUrl, additionalHeaders) { 2291 return __awaiter(this, void 0, void 0, function* () { 2292 return this.request('DELETE', requestUrl, null, additionalHeaders || {}); 2293 }); 2294 } 2295 post(requestUrl, data, additionalHeaders) { 2296 return __awaiter(this, void 0, void 0, function* () { 2297 return this.request('POST', requestUrl, data, additionalHeaders || {}); 2298 }); 2299 } 2300 patch(requestUrl, data, additionalHeaders) { 2301 return __awaiter(this, void 0, void 0, function* () { 2302 return this.request('PATCH', requestUrl, data, additionalHeaders || {}); 2303 }); 2304 } 2305 put(requestUrl, data, additionalHeaders) { 2306 return __awaiter(this, void 0, void 0, function* () { 2307 return this.request('PUT', requestUrl, data, additionalHeaders || {}); 2308 }); 2309 } 2310 head(requestUrl, additionalHeaders) { 2311 return __awaiter(this, void 0, void 0, function* () { 2312 return this.request('HEAD', requestUrl, null, additionalHeaders || {}); 2313 }); 2314 } 2315 sendStream(verb, requestUrl, stream, additionalHeaders) { 2316 return __awaiter(this, void 0, void 0, function* () { 2317 return this.request(verb, requestUrl, stream, additionalHeaders); 2318 }); 2319 } 2320 /** 2321 * Gets a typed object from an endpoint 2322 * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise 2323 */ 2324 getJson(requestUrl, additionalHeaders = {}) { 2325 return __awaiter(this, void 0, void 0, function* () { 2326 additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 2327 const res = yield this.get(requestUrl, additionalHeaders); 2328 return this._processResponse(res, this.requestOptions); 2329 }); 2330 } 2331 postJson(requestUrl, obj, additionalHeaders = {}) { 2332 return __awaiter(this, void 0, void 0, function* () { 2333 const data = JSON.stringify(obj, null, 2); 2334 additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 2335 additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 2336 const res = yield this.post(requestUrl, data, additionalHeaders); 2337 return this._processResponse(res, this.requestOptions); 2338 }); 2339 } 2340 putJson(requestUrl, obj, additionalHeaders = {}) { 2341 return __awaiter(this, void 0, void 0, function* () { 2342 const data = JSON.stringify(obj, null, 2); 2343 additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 2344 additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 2345 const res = yield this.put(requestUrl, data, additionalHeaders); 2346 return this._processResponse(res, this.requestOptions); 2347 }); 2348 } 2349 patchJson(requestUrl, obj, additionalHeaders = {}) { 2350 return __awaiter(this, void 0, void 0, function* () { 2351 const data = JSON.stringify(obj, null, 2); 2352 additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 2353 additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 2354 const res = yield this.patch(requestUrl, data, additionalHeaders); 2355 return this._processResponse(res, this.requestOptions); 2356 }); 2357 } 2358 /** 2359 * Makes a raw http request. 2360 * All other methods such as get, post, patch, and request ultimately call this. 2361 * Prefer get, del, post and patch 2362 */ 2363 request(verb, requestUrl, data, headers) { 2364 return __awaiter(this, void 0, void 0, function* () { 2365 if (this._disposed) { 2366 throw new Error('Client has already been disposed.'); 2367 } 2368 const parsedUrl = new URL(requestUrl); 2369 let info = this._prepareRequest(verb, parsedUrl, headers); 2370 // Only perform retries on reads since writes may not be idempotent. 2371 const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb) 2372 ? this._maxRetries + 1 2373 : 1; 2374 let numTries = 0; 2375 let response; 2376 do { 2377 response = yield this.requestRaw(info, data); 2378 // Check if it's an authentication challenge 2379 if (response && 2380 response.message && 2381 response.message.statusCode === HttpCodes.Unauthorized) { 2382 let authenticationHandler; 2383 for (const handler of this.handlers) { 2384 if (handler.canHandleAuthentication(response)) { 2385 authenticationHandler = handler; 2386 break; 2387 } 2388 } 2389 if (authenticationHandler) { 2390 return authenticationHandler.handleAuthentication(this, info, data); 2391 } 2392 else { 2393 // We have received an unauthorized response but have no handlers to handle it. 2394 // Let the response return to the caller. 2395 return response; 2396 } 2397 } 2398 let redirectsRemaining = this._maxRedirects; 2399 while (response.message.statusCode && 2400 HttpRedirectCodes.includes(response.message.statusCode) && 2401 this._allowRedirects && 2402 redirectsRemaining > 0) { 2403 const redirectUrl = response.message.headers['location']; 2404 if (!redirectUrl) { 2405 // if there's no location to redirect to, we won't 2406 break; 2407 } 2408 const parsedRedirectUrl = new URL(redirectUrl); 2409 if (parsedUrl.protocol === 'https:' && 2410 parsedUrl.protocol !== parsedRedirectUrl.protocol && 2411 !this._allowRedirectDowngrade) { 2412 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.'); 2413 } 2414 // we need to finish reading the response before reassigning response 2415 // which will leak the open socket. 2416 yield response.readBody(); 2417 // strip authorization header if redirected to a different hostname 2418 if (parsedRedirectUrl.hostname !== parsedUrl.hostname) { 2419 for (const header in headers) { 2420 // header names are case insensitive 2421 if (header.toLowerCase() === 'authorization') { 2422 delete headers[header]; 2423 } 2424 } 2425 } 2426 // let's make the request with the new redirectUrl 2427 info = this._prepareRequest(verb, parsedRedirectUrl, headers); 2428 response = yield this.requestRaw(info, data); 2429 redirectsRemaining--; 2430 } 2431 if (!response.message.statusCode || 2432 !HttpResponseRetryCodes.includes(response.message.statusCode)) { 2433 // If not a retry code, return immediately instead of retrying 2434 return response; 2435 } 2436 numTries += 1; 2437 if (numTries < maxTries) { 2438 yield response.readBody(); 2439 yield this._performExponentialBackoff(numTries); 2440 } 2441 } while (numTries < maxTries); 2442 return response; 2443 }); 2444 } 2445 /** 2446 * Needs to be called if keepAlive is set to true in request options. 2447 */ 2448 dispose() { 2449 if (this._agent) { 2450 this._agent.destroy(); 2451 } 2452 this._disposed = true; 2453 } 2454 /** 2455 * Raw request. 2456 * @param info 2457 * @param data 2458 */ 2459 requestRaw(info, data) { 2460 return __awaiter(this, void 0, void 0, function* () { 2461 return new Promise((resolve, reject) => { 2462 function callbackForResult(err, res) { 2463 if (err) { 2464 reject(err); 2465 } 2466 else if (!res) { 2467 // If `err` is not passed, then `res` must be passed. 2468 reject(new Error('Unknown error')); 2469 } 2470 else { 2471 resolve(res); 2472 } 2473 } 2474 this.requestRawWithCallback(info, data, callbackForResult); 2475 }); 2476 }); 2477 } 2478 /** 2479 * Raw request with callback. 2480 * @param info 2481 * @param data 2482 * @param onResult 2483 */ 2484 requestRawWithCallback(info, data, onResult) { 2485 if (typeof data === 'string') { 2486 if (!info.options.headers) { 2487 info.options.headers = {}; 2488 } 2489 info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8'); 2490 } 2491 let callbackCalled = false; 2492 function handleResult(err, res) { 2493 if (!callbackCalled) { 2494 callbackCalled = true; 2495 onResult(err, res); 2496 } 2497 } 2498 const req = info.httpModule.request(info.options, (msg) => { 2499 const res = new HttpClientResponse(msg); 2500 handleResult(undefined, res); 2501 }); 2502 let socket; 2503 req.on('socket', sock => { 2504 socket = sock; 2505 }); 2506 // If we ever get disconnected, we want the socket to timeout eventually 2507 req.setTimeout(this._socketTimeout || 3 * 60000, () => { 2508 if (socket) { 2509 socket.end(); 2510 } 2511 handleResult(new Error(`Request timeout: ${info.options.path}`)); 2512 }); 2513 req.on('error', function (err) { 2514 // err has statusCode property 2515 // res should have headers 2516 handleResult(err); 2517 }); 2518 if (data && typeof data === 'string') { 2519 req.write(data, 'utf8'); 2520 } 2521 if (data && typeof data !== 'string') { 2522 data.on('close', function () { 2523 req.end(); 2524 }); 2525 data.pipe(req); 2526 } 2527 else { 2528 req.end(); 2529 } 2530 } 2531 /** 2532 * Gets an http agent. This function is useful when you need an http agent that handles 2533 * routing through a proxy server - depending upon the url and proxy environment variables. 2534 * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com 2535 */ 2536 getAgent(serverUrl) { 2537 const parsedUrl = new URL(serverUrl); 2538 return this._getAgent(parsedUrl); 2539 } 2540 _prepareRequest(method, requestUrl, headers) { 2541 const info = {}; 2542 info.parsedUrl = requestUrl; 2543 const usingSsl = info.parsedUrl.protocol === 'https:'; 2544 info.httpModule = usingSsl ? https : http; 2545 const defaultPort = usingSsl ? 443 : 80; 2546 info.options = {}; 2547 info.options.host = info.parsedUrl.hostname; 2548 info.options.port = info.parsedUrl.port 2549 ? parseInt(info.parsedUrl.port) 2550 : defaultPort; 2551 info.options.path = 2552 (info.parsedUrl.pathname || '') + (info.parsedUrl.search || ''); 2553 info.options.method = method; 2554 info.options.headers = this._mergeHeaders(headers); 2555 if (this.userAgent != null) { 2556 info.options.headers['user-agent'] = this.userAgent; 2557 } 2558 info.options.agent = this._getAgent(info.parsedUrl); 2559 // gives handlers an opportunity to participate 2560 if (this.handlers) { 2561 for (const handler of this.handlers) { 2562 handler.prepareRequest(info.options); 2563 } 2564 } 2565 return info; 2566 } 2567 _mergeHeaders(headers) { 2568 if (this.requestOptions && this.requestOptions.headers) { 2569 return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers || {})); 2570 } 2571 return lowercaseKeys(headers || {}); 2572 } 2573 _getExistingOrDefaultHeader(additionalHeaders, header, _default) { 2574 let clientHeader; 2575 if (this.requestOptions && this.requestOptions.headers) { 2576 clientHeader = lowercaseKeys(this.requestOptions.headers)[header]; 2577 } 2578 return additionalHeaders[header] || clientHeader || _default; 2579 } 2580 _getAgent(parsedUrl) { 2581 let agent; 2582 const proxyUrl = pm.getProxyUrl(parsedUrl); 2583 const useProxy = proxyUrl && proxyUrl.hostname; 2584 if (this._keepAlive && useProxy) { 2585 agent = this._proxyAgent; 2586 } 2587 if (this._keepAlive && !useProxy) { 2588 agent = this._agent; 2589 } 2590 // if agent is already assigned use that agent. 2591 if (agent) { 2592 return agent; 2593 } 2594 const usingSsl = parsedUrl.protocol === 'https:'; 2595 let maxSockets = 100; 2596 if (this.requestOptions) { 2597 maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets; 2598 } 2599 // This is `useProxy` again, but we need to check `proxyURl` directly for TypeScripts's flow analysis. 2600 if (proxyUrl && proxyUrl.hostname) { 2601 const agentOptions = { 2602 maxSockets, 2603 keepAlive: this._keepAlive, 2604 proxy: Object.assign(Object.assign({}, ((proxyUrl.username || proxyUrl.password) && { 2605 proxyAuth: `${proxyUrl.username}:${proxyUrl.password}` 2606 })), { host: proxyUrl.hostname, port: proxyUrl.port }) 2607 }; 2608 let tunnelAgent; 2609 const overHttps = proxyUrl.protocol === 'https:'; 2610 if (usingSsl) { 2611 tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp; 2612 } 2613 else { 2614 tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp; 2615 } 2616 agent = tunnelAgent(agentOptions); 2617 this._proxyAgent = agent; 2618 } 2619 // if reusing agent across request and tunneling agent isn't assigned create a new agent 2620 if (this._keepAlive && !agent) { 2621 const options = { keepAlive: this._keepAlive, maxSockets }; 2622 agent = usingSsl ? new https.Agent(options) : new http.Agent(options); 2623 this._agent = agent; 2624 } 2625 // if not using private agent and tunnel agent isn't setup then use global agent 2626 if (!agent) { 2627 agent = usingSsl ? https.globalAgent : http.globalAgent; 2628 } 2629 if (usingSsl && this._ignoreSslError) { 2630 // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process 2631 // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options 2632 // we have to cast it to any and change it directly 2633 agent.options = Object.assign(agent.options || {}, { 2634 rejectUnauthorized: false 2635 }); 2636 } 2637 return agent; 2638 } 2639 _performExponentialBackoff(retryNumber) { 2640 return __awaiter(this, void 0, void 0, function* () { 2641 retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber); 2642 const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber); 2643 return new Promise(resolve => setTimeout(() => resolve(), ms)); 2644 }); 2645 } 2646 _processResponse(res, options) { 2647 return __awaiter(this, void 0, void 0, function* () { 2648 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { 2649 const statusCode = res.message.statusCode || 0; 2650 const response = { 2651 statusCode, 2652 result: null, 2653 headers: {} 2654 }; 2655 // not found leads to null obj returned 2656 if (statusCode === HttpCodes.NotFound) { 2657 resolve(response); 2658 } 2659 // get the result from the body 2660 function dateTimeDeserializer(key, value) { 2661 if (typeof value === 'string') { 2662 const a = new Date(value); 2663 if (!isNaN(a.valueOf())) { 2664 return a; 2665 } 2666 } 2667 return value; 2668 } 2669 let obj; 2670 let contents; 2671 try { 2672 contents = yield res.readBody(); 2673 if (contents && contents.length > 0) { 2674 if (options && options.deserializeDates) { 2675 obj = JSON.parse(contents, dateTimeDeserializer); 2676 } 2677 else { 2678 obj = JSON.parse(contents); 2679 } 2680 response.result = obj; 2681 } 2682 response.headers = res.message.headers; 2683 } 2684 catch (err) { 2685 // Invalid resource (contents not json); leaving result obj null 2686 } 2687 // note that 3xx redirects are handled by the http layer. 2688 if (statusCode > 299) { 2689 let msg; 2690 // if exception/error in body, attempt to get better error 2691 if (obj && obj.message) { 2692 msg = obj.message; 2693 } 2694 else if (contents && contents.length > 0) { 2695 // it may be the case that the exception is in the body message as string 2696 msg = contents; 2697 } 2698 else { 2699 msg = `Failed request: (${statusCode})`; 2700 } 2701 const err = new HttpClientError(msg, statusCode); 2702 err.result = response.result; 2703 reject(err); 2704 } 2705 else { 2706 resolve(response); 2707 } 2708 })); 2709 }); 2710 } 2711 } 2712 exports.HttpClient = HttpClient; 2713 const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); 2714 //# sourceMappingURL=index.js.map 2715 2716 /***/ }), 2717 2718 /***/ 9835: 2719 /***/ ((__unused_webpack_module, exports) => { 2720 2721 "use strict"; 2722 2723 Object.defineProperty(exports, "__esModule", ({ value: true })); 2724 exports.checkBypass = exports.getProxyUrl = void 0; 2725 function getProxyUrl(reqUrl) { 2726 const usingSsl = reqUrl.protocol === 'https:'; 2727 if (checkBypass(reqUrl)) { 2728 return undefined; 2729 } 2730 const proxyVar = (() => { 2731 if (usingSsl) { 2732 return process.env['https_proxy'] || process.env['HTTPS_PROXY']; 2733 } 2734 else { 2735 return process.env['http_proxy'] || process.env['HTTP_PROXY']; 2736 } 2737 })(); 2738 if (proxyVar) { 2739 return new URL(proxyVar); 2740 } 2741 else { 2742 return undefined; 2743 } 2744 } 2745 exports.getProxyUrl = getProxyUrl; 2746 function checkBypass(reqUrl) { 2747 if (!reqUrl.hostname) { 2748 return false; 2749 } 2750 const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || ''; 2751 if (!noProxy) { 2752 return false; 2753 } 2754 // Determine the request port 2755 let reqPort; 2756 if (reqUrl.port) { 2757 reqPort = Number(reqUrl.port); 2758 } 2759 else if (reqUrl.protocol === 'http:') { 2760 reqPort = 80; 2761 } 2762 else if (reqUrl.protocol === 'https:') { 2763 reqPort = 443; 2764 } 2765 // Format the request hostname and hostname with port 2766 const upperReqHosts = [reqUrl.hostname.toUpperCase()]; 2767 if (typeof reqPort === 'number') { 2768 upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`); 2769 } 2770 // Compare request host against noproxy 2771 for (const upperNoProxyItem of noProxy 2772 .split(',') 2773 .map(x => x.trim().toUpperCase()) 2774 .filter(x => x)) { 2775 if (upperReqHosts.some(x => x === upperNoProxyItem)) { 2776 return true; 2777 } 2778 } 2779 return false; 2780 } 2781 exports.checkBypass = checkBypass; 2782 //# sourceMappingURL=proxy.js.map 2783 2784 /***/ }), 2785 2786 /***/ 9417: 2787 /***/ ((module) => { 2788 2789 "use strict"; 2790 2791 module.exports = balanced; 2792 function balanced(a, b, str) { 2793 if (a instanceof RegExp) a = maybeMatch(a, str); 2794 if (b instanceof RegExp) b = maybeMatch(b, str); 2795 2796 var r = range(a, b, str); 2797 2798 return r && { 2799 start: r[0], 2800 end: r[1], 2801 pre: str.slice(0, r[0]), 2802 body: str.slice(r[0] + a.length, r[1]), 2803 post: str.slice(r[1] + b.length) 2804 }; 2805 } 2806 2807 function maybeMatch(reg, str) { 2808 var m = str.match(reg); 2809 return m ? m[0] : null; 2810 } 2811 2812 balanced.range = range; 2813 function range(a, b, str) { 2814 var begs, beg, left, right, result; 2815 var ai = str.indexOf(a); 2816 var bi = str.indexOf(b, ai + 1); 2817 var i = ai; 2818 2819 if (ai >= 0 && bi > 0) { 2820 begs = []; 2821 left = str.length; 2822 2823 while (i >= 0 && !result) { 2824 if (i == ai) { 2825 begs.push(i); 2826 ai = str.indexOf(a, i + 1); 2827 } else if (begs.length == 1) { 2828 result = [ begs.pop(), bi ]; 2829 } else { 2830 beg = begs.pop(); 2831 if (beg < left) { 2832 left = beg; 2833 right = bi; 2834 } 2835 2836 bi = str.indexOf(b, i + 1); 2837 } 2838 2839 i = ai < bi && ai >= 0 ? ai : bi; 2840 } 2841 2842 if (begs.length) { 2843 result = [ left, right ]; 2844 } 2845 } 2846 2847 return result; 2848 } 2849 2850 2851 /***/ }), 2852 2853 /***/ 3717: 2854 /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { 2855 2856 var concatMap = __nccwpck_require__(6891); 2857 var balanced = __nccwpck_require__(9417); 2858 2859 module.exports = expandTop; 2860 2861 var escSlash = '\0SLASH'+Math.random()+'\0'; 2862 var escOpen = '\0OPEN'+Math.random()+'\0'; 2863 var escClose = '\0CLOSE'+Math.random()+'\0'; 2864 var escComma = '\0COMMA'+Math.random()+'\0'; 2865 var escPeriod = '\0PERIOD'+Math.random()+'\0'; 2866 2867 function numeric(str) { 2868 return parseInt(str, 10) == str 2869 ? parseInt(str, 10) 2870 : str.charCodeAt(0); 2871 } 2872 2873 function escapeBraces(str) { 2874 return str.split('\\\\').join(escSlash) 2875 .split('\\{').join(escOpen) 2876 .split('\\}').join(escClose) 2877 .split('\\,').join(escComma) 2878 .split('\\.').join(escPeriod); 2879 } 2880 2881 function unescapeBraces(str) { 2882 return str.split(escSlash).join('\\') 2883 .split(escOpen).join('{') 2884 .split(escClose).join('}') 2885 .split(escComma).join(',') 2886 .split(escPeriod).join('.'); 2887 } 2888 2889 2890 // Basically just str.split(","), but handling cases 2891 // where we have nested braced sections, which should be 2892 // treated as individual members, like {a,{b,c},d} 2893 function parseCommaParts(str) { 2894 if (!str) 2895 return ['']; 2896 2897 var parts = []; 2898 var m = balanced('{', '}', str); 2899 2900 if (!m) 2901 return str.split(','); 2902 2903 var pre = m.pre; 2904 var body = m.body; 2905 var post = m.post; 2906 var p = pre.split(','); 2907 2908 p[p.length-1] += '{' + body + '}'; 2909 var postParts = parseCommaParts(post); 2910 if (post.length) { 2911 p[p.length-1] += postParts.shift(); 2912 p.push.apply(p, postParts); 2913 } 2914 2915 parts.push.apply(parts, p); 2916 2917 return parts; 2918 } 2919 2920 function expandTop(str) { 2921 if (!str) 2922 return []; 2923 2924 // I don't know why Bash 4.3 does this, but it does. 2925 // Anything starting with {} will have the first two bytes preserved 2926 // but *only* at the top level, so {},a}b will not expand to anything, 2927 // but a{},b}c will be expanded to [a}c,abc]. 2928 // One could argue that this is a bug in Bash, but since the goal of 2929 // this module is to match Bash's rules, we escape a leading {} 2930 if (str.substr(0, 2) === '{}') { 2931 str = '\\{\\}' + str.substr(2); 2932 } 2933 2934 return expand(escapeBraces(str), true).map(unescapeBraces); 2935 } 2936 2937 function identity(e) { 2938 return e; 2939 } 2940 2941 function embrace(str) { 2942 return '{' + str + '}'; 2943 } 2944 function isPadded(el) { 2945 return /^-?0\d/.test(el); 2946 } 2947 2948 function lte(i, y) { 2949 return i <= y; 2950 } 2951 function gte(i, y) { 2952 return i >= y; 2953 } 2954 2955 function expand(str, isTop) { 2956 var expansions = []; 2957 2958 var m = balanced('{', '}', str); 2959 if (!m || /\$$/.test(m.pre)) return [str]; 2960 2961 var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); 2962 var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); 2963 var isSequence = isNumericSequence || isAlphaSequence; 2964 var isOptions = m.body.indexOf(',') >= 0; 2965 if (!isSequence && !isOptions) { 2966 // {a},b} 2967 if (m.post.match(/,.*\}/)) { 2968 str = m.pre + '{' + m.body + escClose + m.post; 2969 return expand(str); 2970 } 2971 return [str]; 2972 } 2973 2974 var n; 2975 if (isSequence) { 2976 n = m.body.split(/\.\./); 2977 } else { 2978 n = parseCommaParts(m.body); 2979 if (n.length === 1) { 2980 // x{{a,b}}y ==> x{a}y x{b}y 2981 n = expand(n[0], false).map(embrace); 2982 if (n.length === 1) { 2983 var post = m.post.length 2984 ? expand(m.post, false) 2985 : ['']; 2986 return post.map(function(p) { 2987 return m.pre + n[0] + p; 2988 }); 2989 } 2990 } 2991 } 2992 2993 // at this point, n is the parts, and we know it's not a comma set 2994 // with a single entry. 2995 2996 // no need to expand pre, since it is guaranteed to be free of brace-sets 2997 var pre = m.pre; 2998 var post = m.post.length 2999 ? expand(m.post, false) 3000 : ['']; 3001 3002 var N; 3003 3004 if (isSequence) { 3005 var x = numeric(n[0]); 3006 var y = numeric(n[1]); 3007 var width = Math.max(n[0].length, n[1].length) 3008 var incr = n.length == 3 3009 ? Math.abs(numeric(n[2])) 3010 : 1; 3011 var test = lte; 3012 var reverse = y < x; 3013 if (reverse) { 3014 incr *= -1; 3015 test = gte; 3016 } 3017 var pad = n.some(isPadded); 3018 3019 N = []; 3020 3021 for (var i = x; test(i, y); i += incr) { 3022 var c; 3023 if (isAlphaSequence) { 3024 c = String.fromCharCode(i); 3025 if (c === '\\') 3026 c = ''; 3027 } else { 3028 c = String(i); 3029 if (pad) { 3030 var need = width - c.length; 3031 if (need > 0) { 3032 var z = new Array(need + 1).join('0'); 3033 if (i < 0) 3034 c = '-' + z + c.slice(1); 3035 else 3036 c = z + c; 3037 } 3038 } 3039 } 3040 N.push(c); 3041 } 3042 } else { 3043 N = concatMap(n, function(el) { return expand(el, false) }); 3044 } 3045 3046 for (var j = 0; j < N.length; j++) { 3047 for (var k = 0; k < post.length; k++) { 3048 var expansion = pre + N[j] + post[k]; 3049 if (!isTop || isSequence || expansion) 3050 expansions.push(expansion); 3051 } 3052 } 3053 3054 return expansions; 3055 } 3056 3057 3058 3059 /***/ }), 3060 3061 /***/ 6891: 3062 /***/ ((module) => { 3063 3064 module.exports = function (xs, fn) { 3065 var res = []; 3066 for (var i = 0; i < xs.length; i++) { 3067 var x = fn(xs[i], i); 3068 if (isArray(x)) res.push.apply(res, x); 3069 else res.push(x); 3070 } 3071 return res; 3072 }; 3073 3074 var isArray = Array.isArray || function (xs) { 3075 return Object.prototype.toString.call(xs) === '[object Array]'; 3076 }; 3077 3078 3079 /***/ }), 3080 3081 /***/ 3973: 3082 /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { 3083 3084 module.exports = minimatch 3085 minimatch.Minimatch = Minimatch 3086 3087 var path = (function () { try { return __nccwpck_require__(1017) } catch (e) {}}()) || { 3088 sep: '/' 3089 } 3090 minimatch.sep = path.sep 3091 3092 var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} 3093 var expand = __nccwpck_require__(3717) 3094 3095 var plTypes = { 3096 '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, 3097 '?': { open: '(?:', close: ')?' }, 3098 '+': { open: '(?:', close: ')+' }, 3099 '*': { open: '(?:', close: ')*' }, 3100 '@': { open: '(?:', close: ')' } 3101 } 3102 3103 // any single thing other than / 3104 // don't need to escape / when using new RegExp() 3105 var qmark = '[^/]' 3106 3107 // * => any number of characters 3108 var star = qmark + '*?' 3109 3110 // ** when dots are allowed. Anything goes, except .. and . 3111 // not (^ or / followed by one or two dots followed by $ or /), 3112 // followed by anything, any number of times. 3113 var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' 3114 3115 // not a ^ or / followed by a dot, 3116 // followed by anything, any number of times. 3117 var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' 3118 3119 // characters that need to be escaped in RegExp. 3120 var reSpecials = charSet('().*{}+?[]^$\\!') 3121 3122 // "abc" -> { a:true, b:true, c:true } 3123 function charSet (s) { 3124 return s.split('').reduce(function (set, c) { 3125 set[c] = true 3126 return set 3127 }, {}) 3128 } 3129 3130 // normalizes slashes. 3131 var slashSplit = /\/+/ 3132 3133 minimatch.filter = filter 3134 function filter (pattern, options) { 3135 options = options || {} 3136 return function (p, i, list) { 3137 return minimatch(p, pattern, options) 3138 } 3139 } 3140 3141 function ext (a, b) { 3142 b = b || {} 3143 var t = {} 3144 Object.keys(a).forEach(function (k) { 3145 t[k] = a[k] 3146 }) 3147 Object.keys(b).forEach(function (k) { 3148 t[k] = b[k] 3149 }) 3150 return t 3151 } 3152 3153 minimatch.defaults = function (def) { 3154 if (!def || typeof def !== 'object' || !Object.keys(def).length) { 3155 return minimatch 3156 } 3157 3158 var orig = minimatch 3159 3160 var m = function minimatch (p, pattern, options) { 3161 return orig(p, pattern, ext(def, options)) 3162 } 3163 3164 m.Minimatch = function Minimatch (pattern, options) { 3165 return new orig.Minimatch(pattern, ext(def, options)) 3166 } 3167 m.Minimatch.defaults = function defaults (options) { 3168 return orig.defaults(ext(def, options)).Minimatch 3169 } 3170 3171 m.filter = function filter (pattern, options) { 3172 return orig.filter(pattern, ext(def, options)) 3173 } 3174 3175 m.defaults = function defaults (options) { 3176 return orig.defaults(ext(def, options)) 3177 } 3178 3179 m.makeRe = function makeRe (pattern, options) { 3180 return orig.makeRe(pattern, ext(def, options)) 3181 } 3182 3183 m.braceExpand = function braceExpand (pattern, options) { 3184 return orig.braceExpand(pattern, ext(def, options)) 3185 } 3186 3187 m.match = function (list, pattern, options) { 3188 return orig.match(list, pattern, ext(def, options)) 3189 } 3190 3191 return m 3192 } 3193 3194 Minimatch.defaults = function (def) { 3195 return minimatch.defaults(def).Minimatch 3196 } 3197 3198 function minimatch (p, pattern, options) { 3199 assertValidPattern(pattern) 3200 3201 if (!options) options = {} 3202 3203 // shortcut: comments match nothing. 3204 if (!options.nocomment && pattern.charAt(0) === '#') { 3205 return false 3206 } 3207 3208 return new Minimatch(pattern, options).match(p) 3209 } 3210 3211 function Minimatch (pattern, options) { 3212 if (!(this instanceof Minimatch)) { 3213 return new Minimatch(pattern, options) 3214 } 3215 3216 assertValidPattern(pattern) 3217 3218 if (!options) options = {} 3219 3220 pattern = pattern.trim() 3221 3222 // windows support: need to use /, not \ 3223 if (!options.allowWindowsEscape && path.sep !== '/') { 3224 pattern = pattern.split(path.sep).join('/') 3225 } 3226 3227 this.options = options 3228 this.set = [] 3229 this.pattern = pattern 3230 this.regexp = null 3231 this.negate = false 3232 this.comment = false 3233 this.empty = false 3234 this.partial = !!options.partial 3235 3236 // make the set of regexps etc. 3237 this.make() 3238 } 3239 3240 Minimatch.prototype.debug = function () {} 3241 3242 Minimatch.prototype.make = make 3243 function make () { 3244 var pattern = this.pattern 3245 var options = this.options 3246 3247 // empty patterns and comments match nothing. 3248 if (!options.nocomment && pattern.charAt(0) === '#') { 3249 this.comment = true 3250 return 3251 } 3252 if (!pattern) { 3253 this.empty = true 3254 return 3255 } 3256 3257 // step 1: figure out negation, etc. 3258 this.parseNegate() 3259 3260 // step 2: expand braces 3261 var set = this.globSet = this.braceExpand() 3262 3263 if (options.debug) this.debug = function debug() { console.error.apply(console, arguments) } 3264 3265 this.debug(this.pattern, set) 3266 3267 // step 3: now we have a set, so turn each one into a series of path-portion 3268 // matching patterns. 3269 // These will be regexps, except in the case of "**", which is 3270 // set to the GLOBSTAR object for globstar behavior, 3271 // and will not contain any / characters 3272 set = this.globParts = set.map(function (s) { 3273 return s.split(slashSplit) 3274 }) 3275 3276 this.debug(this.pattern, set) 3277 3278 // glob --> regexps 3279 set = set.map(function (s, si, set) { 3280 return s.map(this.parse, this) 3281 }, this) 3282 3283 this.debug(this.pattern, set) 3284 3285 // filter out everything that didn't compile properly. 3286 set = set.filter(function (s) { 3287 return s.indexOf(false) === -1 3288 }) 3289 3290 this.debug(this.pattern, set) 3291 3292 this.set = set 3293 } 3294 3295 Minimatch.prototype.parseNegate = parseNegate 3296 function parseNegate () { 3297 var pattern = this.pattern 3298 var negate = false 3299 var options = this.options 3300 var negateOffset = 0 3301 3302 if (options.nonegate) return 3303 3304 for (var i = 0, l = pattern.length 3305 ; i < l && pattern.charAt(i) === '!' 3306 ; i++) { 3307 negate = !negate 3308 negateOffset++ 3309 } 3310 3311 if (negateOffset) this.pattern = pattern.substr(negateOffset) 3312 this.negate = negate 3313 } 3314 3315 // Brace expansion: 3316 // a{b,c}d -> abd acd 3317 // a{b,}c -> abc ac 3318 // a{0..3}d -> a0d a1d a2d a3d 3319 // a{b,c{d,e}f}g -> abg acdfg acefg 3320 // a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg 3321 // 3322 // Invalid sets are not expanded. 3323 // a{2..}b -> a{2..}b 3324 // a{b}c -> a{b}c 3325 minimatch.braceExpand = function (pattern, options) { 3326 return braceExpand(pattern, options) 3327 } 3328 3329 Minimatch.prototype.braceExpand = braceExpand 3330 3331 function braceExpand (pattern, options) { 3332 if (!options) { 3333 if (this instanceof Minimatch) { 3334 options = this.options 3335 } else { 3336 options = {} 3337 } 3338 } 3339 3340 pattern = typeof pattern === 'undefined' 3341 ? this.pattern : pattern 3342 3343 assertValidPattern(pattern) 3344 3345 // Thanks to Yeting Li <https://github.com/yetingli> for 3346 // improving this regexp to avoid a ReDOS vulnerability. 3347 if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) { 3348 // shortcut. no need to expand. 3349 return [pattern] 3350 } 3351 3352 return expand(pattern) 3353 } 3354 3355 var MAX_PATTERN_LENGTH = 1024 * 64 3356 var assertValidPattern = function (pattern) { 3357 if (typeof pattern !== 'string') { 3358 throw new TypeError('invalid pattern') 3359 } 3360 3361 if (pattern.length > MAX_PATTERN_LENGTH) { 3362 throw new TypeError('pattern is too long') 3363 } 3364 } 3365 3366 // parse a component of the expanded set. 3367 // At this point, no pattern may contain "/" in it 3368 // so we're going to return a 2d array, where each entry is the full 3369 // pattern, split on '/', and then turned into a regular expression. 3370 // A regexp is made at the end which joins each array with an 3371 // escaped /, and another full one which joins each regexp with |. 3372 // 3373 // Following the lead of Bash 4.1, note that "**" only has special meaning 3374 // when it is the *only* thing in a path portion. Otherwise, any series 3375 // of * is equivalent to a single *. Globstar behavior is enabled by 3376 // default, and can be disabled by setting options.noglobstar. 3377 Minimatch.prototype.parse = parse 3378 var SUBPARSE = {} 3379 function parse (pattern, isSub) { 3380 assertValidPattern(pattern) 3381 3382 var options = this.options 3383 3384 // shortcuts 3385 if (pattern === '**') { 3386 if (!options.noglobstar) 3387 return GLOBSTAR 3388 else 3389 pattern = '*' 3390 } 3391 if (pattern === '') return '' 3392 3393 var re = '' 3394 var hasMagic = !!options.nocase 3395 var escaping = false 3396 // ? => one single character 3397 var patternListStack = [] 3398 var negativeLists = [] 3399 var stateChar 3400 var inClass = false 3401 var reClassStart = -1 3402 var classStart = -1 3403 // . and .. never match anything that doesn't start with ., 3404 // even when options.dot is set. 3405 var patternStart = pattern.charAt(0) === '.' ? '' // anything 3406 // not (start or / followed by . or .. followed by / or end) 3407 : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' 3408 : '(?!\\.)' 3409 var self = this 3410 3411 function clearStateChar () { 3412 if (stateChar) { 3413 // we had some state-tracking character 3414 // that wasn't consumed by this pass. 3415 switch (stateChar) { 3416 case '*': 3417 re += star 3418 hasMagic = true 3419 break 3420 case '?': 3421 re += qmark 3422 hasMagic = true 3423 break 3424 default: 3425 re += '\\' + stateChar 3426 break 3427 } 3428 self.debug('clearStateChar %j %j', stateChar, re) 3429 stateChar = false 3430 } 3431 } 3432 3433 for (var i = 0, len = pattern.length, c 3434 ; (i < len) && (c = pattern.charAt(i)) 3435 ; i++) { 3436 this.debug('%s\t%s %s %j', pattern, i, re, c) 3437 3438 // skip over any that are escaped. 3439 if (escaping && reSpecials[c]) { 3440 re += '\\' + c 3441 escaping = false 3442 continue 3443 } 3444 3445 switch (c) { 3446 /* istanbul ignore next */ 3447 case '/': { 3448 // completely not allowed, even escaped. 3449 // Should already be path-split by now. 3450 return false 3451 } 3452 3453 case '\\': 3454 clearStateChar() 3455 escaping = true 3456 continue 3457 3458 // the various stateChar values 3459 // for the "extglob" stuff. 3460 case '?': 3461 case '*': 3462 case '+': 3463 case '@': 3464 case '!': 3465 this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) 3466 3467 // all of those are literals inside a class, except that 3468 // the glob [!a] means [^a] in regexp 3469 if (inClass) { 3470 this.debug(' in class') 3471 if (c === '!' && i === classStart + 1) c = '^' 3472 re += c 3473 continue 3474 } 3475 3476 // if we already have a stateChar, then it means 3477 // that there was something like ** or +? in there. 3478 // Handle the stateChar, then proceed with this one. 3479 self.debug('call clearStateChar %j', stateChar) 3480 clearStateChar() 3481 stateChar = c 3482 // if extglob is disabled, then +(asdf|foo) isn't a thing. 3483 // just clear the statechar *now*, rather than even diving into 3484 // the patternList stuff. 3485 if (options.noext) clearStateChar() 3486 continue 3487 3488 case '(': 3489 if (inClass) { 3490 re += '(' 3491 continue 3492 } 3493 3494 if (!stateChar) { 3495 re += '\\(' 3496 continue 3497 } 3498 3499 patternListStack.push({ 3500 type: stateChar, 3501 start: i - 1, 3502 reStart: re.length, 3503 open: plTypes[stateChar].open, 3504 close: plTypes[stateChar].close 3505 }) 3506 // negation is (?:(?!js)[^/]*) 3507 re += stateChar === '!' ? '(?:(?!(?:' : '(?:' 3508 this.debug('plType %j %j', stateChar, re) 3509 stateChar = false 3510 continue 3511 3512 case ')': 3513 if (inClass || !patternListStack.length) { 3514 re += '\\)' 3515 continue 3516 } 3517 3518 clearStateChar() 3519 hasMagic = true 3520 var pl = patternListStack.pop() 3521 // negation is (?:(?!js)[^/]*) 3522 // The others are (?:<pattern>)<type> 3523 re += pl.close 3524 if (pl.type === '!') { 3525 negativeLists.push(pl) 3526 } 3527 pl.reEnd = re.length 3528 continue 3529 3530 case '|': 3531 if (inClass || !patternListStack.length || escaping) { 3532 re += '\\|' 3533 escaping = false 3534 continue 3535 } 3536 3537 clearStateChar() 3538 re += '|' 3539 continue 3540 3541 // these are mostly the same in regexp and glob 3542 case '[': 3543 // swallow any state-tracking char before the [ 3544 clearStateChar() 3545 3546 if (inClass) { 3547 re += '\\' + c 3548 continue 3549 } 3550 3551 inClass = true 3552 classStart = i 3553 reClassStart = re.length 3554 re += c 3555 continue 3556 3557 case ']': 3558 // a right bracket shall lose its special 3559 // meaning and represent itself in 3560 // a bracket expression if it occurs 3561 // first in the list. -- POSIX.2 2.8.3.2 3562 if (i === classStart + 1 || !inClass) { 3563 re += '\\' + c 3564 escaping = false 3565 continue 3566 } 3567 3568 // handle the case where we left a class open. 3569 // "[z-a]" is valid, equivalent to "\[z-a\]" 3570 // split where the last [ was, make sure we don't have 3571 // an invalid re. if so, re-walk the contents of the 3572 // would-be class to re-translate any characters that 3573 // were passed through as-is 3574 // TODO: It would probably be faster to determine this 3575 // without a try/catch and a new RegExp, but it's tricky 3576 // to do safely. For now, this is safe and works. 3577 var cs = pattern.substring(classStart + 1, i) 3578 try { 3579 RegExp('[' + cs + ']') 3580 } catch (er) { 3581 // not a valid class! 3582 var sp = this.parse(cs, SUBPARSE) 3583 re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' 3584 hasMagic = hasMagic || sp[1] 3585 inClass = false 3586 continue 3587 } 3588 3589 // finish up the class. 3590 hasMagic = true 3591 inClass = false 3592 re += c 3593 continue 3594 3595 default: 3596 // swallow any state char that wasn't consumed 3597 clearStateChar() 3598 3599 if (escaping) { 3600 // no need 3601 escaping = false 3602 } else if (reSpecials[c] 3603 && !(c === '^' && inClass)) { 3604 re += '\\' 3605 } 3606 3607 re += c 3608 3609 } // switch 3610 } // for 3611 3612 // handle the case where we left a class open. 3613 // "[abc" is valid, equivalent to "\[abc" 3614 if (inClass) { 3615 // split where the last [ was, and escape it 3616 // this is a huge pita. We now have to re-walk 3617 // the contents of the would-be class to re-translate 3618 // any characters that were passed through as-is 3619 cs = pattern.substr(classStart + 1) 3620 sp = this.parse(cs, SUBPARSE) 3621 re = re.substr(0, reClassStart) + '\\[' + sp[0] 3622 hasMagic = hasMagic || sp[1] 3623 } 3624 3625 // handle the case where we had a +( thing at the *end* 3626 // of the pattern. 3627 // each pattern list stack adds 3 chars, and we need to go through 3628 // and escape any | chars that were passed through as-is for the regexp. 3629 // Go through and escape them, taking care not to double-escape any 3630 // | chars that were already escaped. 3631 for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { 3632 var tail = re.slice(pl.reStart + pl.open.length) 3633 this.debug('setting tail', re, pl) 3634 // maybe some even number of \, then maybe 1 \, followed by a | 3635 tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { 3636 if (!$2) { 3637 // the | isn't already escaped, so escape it. 3638 $2 = '\\' 3639 } 3640 3641 // need to escape all those slashes *again*, without escaping the 3642 // one that we need for escaping the | character. As it works out, 3643 // escaping an even number of slashes can be done by simply repeating 3644 // it exactly after itself. That's why this trick works. 3645 // 3646 // I am sorry that you have to see this. 3647 return $1 + $1 + $2 + '|' 3648 }) 3649 3650 this.debug('tail=%j\n %s', tail, tail, pl, re) 3651 var t = pl.type === '*' ? star 3652 : pl.type === '?' ? qmark 3653 : '\\' + pl.type 3654 3655 hasMagic = true 3656 re = re.slice(0, pl.reStart) + t + '\\(' + tail 3657 } 3658 3659 // handle trailing things that only matter at the very end. 3660 clearStateChar() 3661 if (escaping) { 3662 // trailing \\ 3663 re += '\\\\' 3664 } 3665 3666 // only need to apply the nodot start if the re starts with 3667 // something that could conceivably capture a dot 3668 var addPatternStart = false 3669 switch (re.charAt(0)) { 3670 case '[': case '.': case '(': addPatternStart = true 3671 } 3672 3673 // Hack to work around lack of negative lookbehind in JS 3674 // A pattern like: *.!(x).!(y|z) needs to ensure that a name 3675 // like 'a.xyz.yz' doesn't match. So, the first negative 3676 // lookahead, has to look ALL the way ahead, to the end of 3677 // the pattern. 3678 for (var n = negativeLists.length - 1; n > -1; n--) { 3679 var nl = negativeLists[n] 3680 3681 var nlBefore = re.slice(0, nl.reStart) 3682 var nlFirst = re.slice(nl.reStart, nl.reEnd - 8) 3683 var nlLast = re.slice(nl.reEnd - 8, nl.reEnd) 3684 var nlAfter = re.slice(nl.reEnd) 3685 3686 nlLast += nlAfter 3687 3688 // Handle nested stuff like *(*.js|!(*.json)), where open parens 3689 // mean that we should *not* include the ) in the bit that is considered 3690 // "after" the negated section. 3691 var openParensBefore = nlBefore.split('(').length - 1 3692 var cleanAfter = nlAfter 3693 for (i = 0; i < openParensBefore; i++) { 3694 cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') 3695 } 3696 nlAfter = cleanAfter 3697 3698 var dollar = '' 3699 if (nlAfter === '' && isSub !== SUBPARSE) { 3700 dollar = '$' 3701 } 3702 var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast 3703 re = newRe 3704 } 3705 3706 // if the re is not "" at this point, then we need to make sure 3707 // it doesn't match against an empty path part. 3708 // Otherwise a/* will match a/, which it should not. 3709 if (re !== '' && hasMagic) { 3710 re = '(?=.)' + re 3711 } 3712 3713 if (addPatternStart) { 3714 re = patternStart + re 3715 } 3716 3717 // parsing just a piece of a larger pattern. 3718 if (isSub === SUBPARSE) { 3719 return [re, hasMagic] 3720 } 3721 3722 // skip the regexp for non-magical patterns 3723 // unescape anything in it, though, so that it'll be 3724 // an exact match against a file etc. 3725 if (!hasMagic) { 3726 return globUnescape(pattern) 3727 } 3728 3729 var flags = options.nocase ? 'i' : '' 3730 try { 3731 var regExp = new RegExp('^' + re + '$', flags) 3732 } catch (er) /* istanbul ignore next - should be impossible */ { 3733 // If it was an invalid regular expression, then it can't match 3734 // anything. This trick looks for a character after the end of 3735 // the string, which is of course impossible, except in multi-line 3736 // mode, but it's not a /m regex. 3737 return new RegExp('$.') 3738 } 3739 3740 regExp._glob = pattern 3741 regExp._src = re 3742 3743 return regExp 3744 } 3745 3746 minimatch.makeRe = function (pattern, options) { 3747 return new Minimatch(pattern, options || {}).makeRe() 3748 } 3749 3750 Minimatch.prototype.makeRe = makeRe 3751 function makeRe () { 3752 if (this.regexp || this.regexp === false) return this.regexp 3753 3754 // at this point, this.set is a 2d array of partial 3755 // pattern strings, or "**". 3756 // 3757 // It's better to use .match(). This function shouldn't 3758 // be used, really, but it's pretty convenient sometimes, 3759 // when you just want to work with a regex. 3760 var set = this.set 3761 3762 if (!set.length) { 3763 this.regexp = false 3764 return this.regexp 3765 } 3766 var options = this.options 3767 3768 var twoStar = options.noglobstar ? star 3769 : options.dot ? twoStarDot 3770 : twoStarNoDot 3771 var flags = options.nocase ? 'i' : '' 3772 3773 var re = set.map(function (pattern) { 3774 return pattern.map(function (p) { 3775 return (p === GLOBSTAR) ? twoStar 3776 : (typeof p === 'string') ? regExpEscape(p) 3777 : p._src 3778 }).join('\\\/') 3779 }).join('|') 3780 3781 // must match entire pattern 3782 // ending in a * or ** will make it less strict. 3783 re = '^(?:' + re + ')$' 3784 3785 // can match anything, as long as it's not this. 3786 if (this.negate) re = '^(?!' + re + ').*$' 3787 3788 try { 3789 this.regexp = new RegExp(re, flags) 3790 } catch (ex) /* istanbul ignore next - should be impossible */ { 3791 this.regexp = false 3792 } 3793 return this.regexp 3794 } 3795 3796 minimatch.match = function (list, pattern, options) { 3797 options = options || {} 3798 var mm = new Minimatch(pattern, options) 3799 list = list.filter(function (f) { 3800 return mm.match(f) 3801 }) 3802 if (mm.options.nonull && !list.length) { 3803 list.push(pattern) 3804 } 3805 return list 3806 } 3807 3808 Minimatch.prototype.match = function match (f, partial) { 3809 if (typeof partial === 'undefined') partial = this.partial 3810 this.debug('match', f, this.pattern) 3811 // short-circuit in the case of busted things. 3812 // comments, etc. 3813 if (this.comment) return false 3814 if (this.empty) return f === '' 3815 3816 if (f === '/' && partial) return true 3817 3818 var options = this.options 3819 3820 // windows: need to use /, not \ 3821 if (path.sep !== '/') { 3822 f = f.split(path.sep).join('/') 3823 } 3824 3825 // treat the test path as a set of pathparts. 3826 f = f.split(slashSplit) 3827 this.debug(this.pattern, 'split', f) 3828 3829 // just ONE of the pattern sets in this.set needs to match 3830 // in order for it to be valid. If negating, then just one 3831 // match means that we have failed. 3832 // Either way, return on the first hit. 3833 3834 var set = this.set 3835 this.debug(this.pattern, 'set', set) 3836 3837 // Find the basename of the path by looking for the last non-empty segment 3838 var filename 3839 var i 3840 for (i = f.length - 1; i >= 0; i--) { 3841 filename = f[i] 3842 if (filename) break 3843 } 3844 3845 for (i = 0; i < set.length; i++) { 3846 var pattern = set[i] 3847 var file = f 3848 if (options.matchBase && pattern.length === 1) { 3849 file = [filename] 3850 } 3851 var hit = this.matchOne(file, pattern, partial) 3852 if (hit) { 3853 if (options.flipNegate) return true 3854 return !this.negate 3855 } 3856 } 3857 3858 // didn't get any hits. this is success if it's a negative 3859 // pattern, failure otherwise. 3860 if (options.flipNegate) return false 3861 return this.negate 3862 } 3863 3864 // set partial to true to test if, for example, 3865 // "/a/b" matches the start of "/*/b/*/d" 3866 // Partial means, if you run out of file before you run 3867 // out of pattern, then that's fine, as long as all 3868 // the parts match. 3869 Minimatch.prototype.matchOne = function (file, pattern, partial) { 3870 var options = this.options 3871 3872 this.debug('matchOne', 3873 { 'this': this, file: file, pattern: pattern }) 3874 3875 this.debug('matchOne', file.length, pattern.length) 3876 3877 for (var fi = 0, 3878 pi = 0, 3879 fl = file.length, 3880 pl = pattern.length 3881 ; (fi < fl) && (pi < pl) 3882 ; fi++, pi++) { 3883 this.debug('matchOne loop') 3884 var p = pattern[pi] 3885 var f = file[fi] 3886 3887 this.debug(pattern, p, f) 3888 3889 // should be impossible. 3890 // some invalid regexp stuff in the set. 3891 /* istanbul ignore if */ 3892 if (p === false) return false 3893 3894 if (p === GLOBSTAR) { 3895 this.debug('GLOBSTAR', [pattern, p, f]) 3896 3897 // "**" 3898 // a/**/b/**/c would match the following: 3899 // a/b/x/y/z/c 3900 // a/x/y/z/b/c 3901 // a/b/x/b/x/c 3902 // a/b/c 3903 // To do this, take the rest of the pattern after 3904 // the **, and see if it would match the file remainder. 3905 // If so, return success. 3906 // If not, the ** "swallows" a segment, and try again. 3907 // This is recursively awful. 3908 // 3909 // a/**/b/**/c matching a/b/x/y/z/c 3910 // - a matches a 3911 // - doublestar 3912 // - matchOne(b/x/y/z/c, b/**/c) 3913 // - b matches b 3914 // - doublestar 3915 // - matchOne(x/y/z/c, c) -> no 3916 // - matchOne(y/z/c, c) -> no 3917 // - matchOne(z/c, c) -> no 3918 // - matchOne(c, c) yes, hit 3919 var fr = fi 3920 var pr = pi + 1 3921 if (pr === pl) { 3922 this.debug('** at the end') 3923 // a ** at the end will just swallow the rest. 3924 // We have found a match. 3925 // however, it will not swallow /.x, unless 3926 // options.dot is set. 3927 // . and .. are *never* matched by **, for explosively 3928 // exponential reasons. 3929 for (; fi < fl; fi++) { 3930 if (file[fi] === '.' || file[fi] === '..' || 3931 (!options.dot && file[fi].charAt(0) === '.')) return false 3932 } 3933 return true 3934 } 3935 3936 // ok, let's see if we can swallow whatever we can. 3937 while (fr < fl) { 3938 var swallowee = file[fr] 3939 3940 this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) 3941 3942 // XXX remove this slice. Just pass the start index. 3943 if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { 3944 this.debug('globstar found match!', fr, fl, swallowee) 3945 // found a match. 3946 return true 3947 } else { 3948 // can't swallow "." or ".." ever. 3949 // can only swallow ".foo" when explicitly asked. 3950 if (swallowee === '.' || swallowee === '..' || 3951 (!options.dot && swallowee.charAt(0) === '.')) { 3952 this.debug('dot detected!', file, fr, pattern, pr) 3953 break 3954 } 3955 3956 // ** swallows a segment, and continue. 3957 this.debug('globstar swallow a segment, and continue') 3958 fr++ 3959 } 3960 } 3961 3962 // no match was found. 3963 // However, in partial mode, we can't say this is necessarily over. 3964 // If there's more *pattern* left, then 3965 /* istanbul ignore if */ 3966 if (partial) { 3967 // ran out of file 3968 this.debug('\n>>> no match, partial?', file, fr, pattern, pr) 3969 if (fr === fl) return true 3970 } 3971 return false 3972 } 3973 3974 // something other than ** 3975 // non-magic patterns just have to match exactly 3976 // patterns with magic have been turned into regexps. 3977 var hit 3978 if (typeof p === 'string') { 3979 hit = f === p 3980 this.debug('string match', p, f, hit) 3981 } else { 3982 hit = f.match(p) 3983 this.debug('pattern match', p, f, hit) 3984 } 3985 3986 if (!hit) return false 3987 } 3988 3989 // Note: ending in / means that we'll get a final "" 3990 // at the end of the pattern. This can only match a 3991 // corresponding "" at the end of the file. 3992 // If the file ends in /, then it can only match a 3993 // a pattern that ends in /, unless the pattern just 3994 // doesn't have any more for it. But, a/b/ should *not* 3995 // match "a/b/*", even though "" matches against the 3996 // [^/]*? pattern, except in partial mode, where it might 3997 // simply not be reached yet. 3998 // However, a/b/ should still satisfy a/* 3999 4000 // now either we fell off the end of the pattern, or we're done. 4001 if (fi === fl && pi === pl) { 4002 // ran out of pattern and filename at the same time. 4003 // an exact hit! 4004 return true 4005 } else if (fi === fl) { 4006 // ran out of file, but still had pattern left. 4007 // this is ok if we're doing the match as part of 4008 // a glob fs traversal. 4009 return partial 4010 } else /* istanbul ignore else */ if (pi === pl) { 4011 // ran out of pattern, still have file left. 4012 // this is only acceptable if we're on the very last 4013 // empty segment of a file with a trailing slash. 4014 // a/* should match a/b/ 4015 return (fi === fl - 1) && (file[fi] === '') 4016 } 4017 4018 // should be unreachable. 4019 /* istanbul ignore next */ 4020 throw new Error('wtf?') 4021 } 4022 4023 // replace stuff like \* with * 4024 function globUnescape (s) { 4025 return s.replace(/\\(.)/g, '$1') 4026 } 4027 4028 function regExpEscape (s) { 4029 return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') 4030 } 4031 4032 4033 /***/ }), 4034 4035 /***/ 4294: 4036 /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { 4037 4038 module.exports = __nccwpck_require__(4219); 4039 4040 4041 /***/ }), 4042 4043 /***/ 4219: 4044 /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 4045 4046 "use strict"; 4047 4048 4049 var net = __nccwpck_require__(1808); 4050 var tls = __nccwpck_require__(4404); 4051 var http = __nccwpck_require__(3685); 4052 var https = __nccwpck_require__(5687); 4053 var events = __nccwpck_require__(2361); 4054 var assert = __nccwpck_require__(9491); 4055 var util = __nccwpck_require__(3837); 4056 4057 4058 exports.httpOverHttp = httpOverHttp; 4059 exports.httpsOverHttp = httpsOverHttp; 4060 exports.httpOverHttps = httpOverHttps; 4061 exports.httpsOverHttps = httpsOverHttps; 4062 4063 4064 function httpOverHttp(options) { 4065 var agent = new TunnelingAgent(options); 4066 agent.request = http.request; 4067 return agent; 4068 } 4069 4070 function httpsOverHttp(options) { 4071 var agent = new TunnelingAgent(options); 4072 agent.request = http.request; 4073 agent.createSocket = createSecureSocket; 4074 agent.defaultPort = 443; 4075 return agent; 4076 } 4077 4078 function httpOverHttps(options) { 4079 var agent = new TunnelingAgent(options); 4080 agent.request = https.request; 4081 return agent; 4082 } 4083 4084 function httpsOverHttps(options) { 4085 var agent = new TunnelingAgent(options); 4086 agent.request = https.request; 4087 agent.createSocket = createSecureSocket; 4088 agent.defaultPort = 443; 4089 return agent; 4090 } 4091 4092 4093 function TunnelingAgent(options) { 4094 var self = this; 4095 self.options = options || {}; 4096 self.proxyOptions = self.options.proxy || {}; 4097 self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; 4098 self.requests = []; 4099 self.sockets = []; 4100 4101 self.on('free', function onFree(socket, host, port, localAddress) { 4102 var options = toOptions(host, port, localAddress); 4103 for (var i = 0, len = self.requests.length; i < len; ++i) { 4104 var pending = self.requests[i]; 4105 if (pending.host === options.host && pending.port === options.port) { 4106 // Detect the request to connect same origin server, 4107 // reuse the connection. 4108 self.requests.splice(i, 1); 4109 pending.request.onSocket(socket); 4110 return; 4111 } 4112 } 4113 socket.destroy(); 4114 self.removeSocket(socket); 4115 }); 4116 } 4117 util.inherits(TunnelingAgent, events.EventEmitter); 4118 4119 TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) { 4120 var self = this; 4121 var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress)); 4122 4123 if (self.sockets.length >= this.maxSockets) { 4124 // We are over limit so we'll add it to the queue. 4125 self.requests.push(options); 4126 return; 4127 } 4128 4129 // If we are under maxSockets create a new one. 4130 self.createSocket(options, function(socket) { 4131 socket.on('free', onFree); 4132 socket.on('close', onCloseOrRemove); 4133 socket.on('agentRemove', onCloseOrRemove); 4134 req.onSocket(socket); 4135 4136 function onFree() { 4137 self.emit('free', socket, options); 4138 } 4139 4140 function onCloseOrRemove(err) { 4141 self.removeSocket(socket); 4142 socket.removeListener('free', onFree); 4143 socket.removeListener('close', onCloseOrRemove); 4144 socket.removeListener('agentRemove', onCloseOrRemove); 4145 } 4146 }); 4147 }; 4148 4149 TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { 4150 var self = this; 4151 var placeholder = {}; 4152 self.sockets.push(placeholder); 4153 4154 var connectOptions = mergeOptions({}, self.proxyOptions, { 4155 method: 'CONNECT', 4156 path: options.host + ':' + options.port, 4157 agent: false, 4158 headers: { 4159 host: options.host + ':' + options.port 4160 } 4161 }); 4162 if (options.localAddress) { 4163 connectOptions.localAddress = options.localAddress; 4164 } 4165 if (connectOptions.proxyAuth) { 4166 connectOptions.headers = connectOptions.headers || {}; 4167 connectOptions.headers['Proxy-Authorization'] = 'Basic ' + 4168 new Buffer(connectOptions.proxyAuth).toString('base64'); 4169 } 4170 4171 debug('making CONNECT request'); 4172 var connectReq = self.request(connectOptions); 4173 connectReq.useChunkedEncodingByDefault = false; // for v0.6 4174 connectReq.once('response', onResponse); // for v0.6 4175 connectReq.once('upgrade', onUpgrade); // for v0.6 4176 connectReq.once('connect', onConnect); // for v0.7 or later 4177 connectReq.once('error', onError); 4178 connectReq.end(); 4179 4180 function onResponse(res) { 4181 // Very hacky. This is necessary to avoid http-parser leaks. 4182 res.upgrade = true; 4183 } 4184 4185 function onUpgrade(res, socket, head) { 4186 // Hacky. 4187 process.nextTick(function() { 4188 onConnect(res, socket, head); 4189 }); 4190 } 4191 4192 function onConnect(res, socket, head) { 4193 connectReq.removeAllListeners(); 4194 socket.removeAllListeners(); 4195 4196 if (res.statusCode !== 200) { 4197 debug('tunneling socket could not be established, statusCode=%d', 4198 res.statusCode); 4199 socket.destroy(); 4200 var error = new Error('tunneling socket could not be established, ' + 4201 'statusCode=' + res.statusCode); 4202 error.code = 'ECONNRESET'; 4203 options.request.emit('error', error); 4204 self.removeSocket(placeholder); 4205 return; 4206 } 4207 if (head.length > 0) { 4208 debug('got illegal response body from proxy'); 4209 socket.destroy(); 4210 var error = new Error('got illegal response body from proxy'); 4211 error.code = 'ECONNRESET'; 4212 options.request.emit('error', error); 4213 self.removeSocket(placeholder); 4214 return; 4215 } 4216 debug('tunneling connection has established'); 4217 self.sockets[self.sockets.indexOf(placeholder)] = socket; 4218 return cb(socket); 4219 } 4220 4221 function onError(cause) { 4222 connectReq.removeAllListeners(); 4223 4224 debug('tunneling socket could not be established, cause=%s\n', 4225 cause.message, cause.stack); 4226 var error = new Error('tunneling socket could not be established, ' + 4227 'cause=' + cause.message); 4228 error.code = 'ECONNRESET'; 4229 options.request.emit('error', error); 4230 self.removeSocket(placeholder); 4231 } 4232 }; 4233 4234 TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { 4235 var pos = this.sockets.indexOf(socket) 4236 if (pos === -1) { 4237 return; 4238 } 4239 this.sockets.splice(pos, 1); 4240 4241 var pending = this.requests.shift(); 4242 if (pending) { 4243 // If we have pending requests and a socket gets closed a new one 4244 // needs to be created to take over in the pool for the one that closed. 4245 this.createSocket(pending, function(socket) { 4246 pending.request.onSocket(socket); 4247 }); 4248 } 4249 }; 4250 4251 function createSecureSocket(options, cb) { 4252 var self = this; 4253 TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { 4254 var hostHeader = options.request.getHeader('host'); 4255 var tlsOptions = mergeOptions({}, self.options, { 4256 socket: socket, 4257 servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host 4258 }); 4259 4260 // 0 is dummy port for v0.6 4261 var secureSocket = tls.connect(0, tlsOptions); 4262 self.sockets[self.sockets.indexOf(socket)] = secureSocket; 4263 cb(secureSocket); 4264 }); 4265 } 4266 4267 4268 function toOptions(host, port, localAddress) { 4269 if (typeof host === 'string') { // since v0.10 4270 return { 4271 host: host, 4272 port: port, 4273 localAddress: localAddress 4274 }; 4275 } 4276 return host; // for v0.11 or later 4277 } 4278 4279 function mergeOptions(target) { 4280 for (var i = 1, len = arguments.length; i < len; ++i) { 4281 var overrides = arguments[i]; 4282 if (typeof overrides === 'object') { 4283 var keys = Object.keys(overrides); 4284 for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { 4285 var k = keys[j]; 4286 if (overrides[k] !== undefined) { 4287 target[k] = overrides[k]; 4288 } 4289 } 4290 } 4291 } 4292 return target; 4293 } 4294 4295 4296 var debug; 4297 if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { 4298 debug = function() { 4299 var args = Array.prototype.slice.call(arguments); 4300 if (typeof args[0] === 'string') { 4301 args[0] = 'TUNNEL: ' + args[0]; 4302 } else { 4303 args.unshift('TUNNEL:'); 4304 } 4305 console.error.apply(console, args); 4306 } 4307 } else { 4308 debug = function() {}; 4309 } 4310 exports.debug = debug; // for test 4311 4312 4313 /***/ }), 4314 4315 /***/ 5840: 4316 /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 4317 4318 "use strict"; 4319 4320 4321 Object.defineProperty(exports, "__esModule", ({ 4322 value: true 4323 })); 4324 Object.defineProperty(exports, "v1", ({ 4325 enumerable: true, 4326 get: function () { 4327 return _v.default; 4328 } 4329 })); 4330 Object.defineProperty(exports, "v3", ({ 4331 enumerable: true, 4332 get: function () { 4333 return _v2.default; 4334 } 4335 })); 4336 Object.defineProperty(exports, "v4", ({ 4337 enumerable: true, 4338 get: function () { 4339 return _v3.default; 4340 } 4341 })); 4342 Object.defineProperty(exports, "v5", ({ 4343 enumerable: true, 4344 get: function () { 4345 return _v4.default; 4346 } 4347 })); 4348 Object.defineProperty(exports, "NIL", ({ 4349 enumerable: true, 4350 get: function () { 4351 return _nil.default; 4352 } 4353 })); 4354 Object.defineProperty(exports, "version", ({ 4355 enumerable: true, 4356 get: function () { 4357 return _version.default; 4358 } 4359 })); 4360 Object.defineProperty(exports, "validate", ({ 4361 enumerable: true, 4362 get: function () { 4363 return _validate.default; 4364 } 4365 })); 4366 Object.defineProperty(exports, "stringify", ({ 4367 enumerable: true, 4368 get: function () { 4369 return _stringify.default; 4370 } 4371 })); 4372 Object.defineProperty(exports, "parse", ({ 4373 enumerable: true, 4374 get: function () { 4375 return _parse.default; 4376 } 4377 })); 4378 4379 var _v = _interopRequireDefault(__nccwpck_require__(8628)); 4380 4381 var _v2 = _interopRequireDefault(__nccwpck_require__(6409)); 4382 4383 var _v3 = _interopRequireDefault(__nccwpck_require__(5122)); 4384 4385 var _v4 = _interopRequireDefault(__nccwpck_require__(9120)); 4386 4387 var _nil = _interopRequireDefault(__nccwpck_require__(5332)); 4388 4389 var _version = _interopRequireDefault(__nccwpck_require__(1595)); 4390 4391 var _validate = _interopRequireDefault(__nccwpck_require__(6900)); 4392 4393 var _stringify = _interopRequireDefault(__nccwpck_require__(8950)); 4394 4395 var _parse = _interopRequireDefault(__nccwpck_require__(2746)); 4396 4397 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 4398 4399 /***/ }), 4400 4401 /***/ 4569: 4402 /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 4403 4404 "use strict"; 4405 4406 4407 Object.defineProperty(exports, "__esModule", ({ 4408 value: true 4409 })); 4410 exports["default"] = void 0; 4411 4412 var _crypto = _interopRequireDefault(__nccwpck_require__(6113)); 4413 4414 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 4415 4416 function md5(bytes) { 4417 if (Array.isArray(bytes)) { 4418 bytes = Buffer.from(bytes); 4419 } else if (typeof bytes === 'string') { 4420 bytes = Buffer.from(bytes, 'utf8'); 4421 } 4422 4423 return _crypto.default.createHash('md5').update(bytes).digest(); 4424 } 4425 4426 var _default = md5; 4427 exports["default"] = _default; 4428 4429 /***/ }), 4430 4431 /***/ 5332: 4432 /***/ ((__unused_webpack_module, exports) => { 4433 4434 "use strict"; 4435 4436 4437 Object.defineProperty(exports, "__esModule", ({ 4438 value: true 4439 })); 4440 exports["default"] = void 0; 4441 var _default = '00000000-0000-0000-0000-000000000000'; 4442 exports["default"] = _default; 4443 4444 /***/ }), 4445 4446 /***/ 2746: 4447 /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 4448 4449 "use strict"; 4450 4451 4452 Object.defineProperty(exports, "__esModule", ({ 4453 value: true 4454 })); 4455 exports["default"] = void 0; 4456 4457 var _validate = _interopRequireDefault(__nccwpck_require__(6900)); 4458 4459 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 4460 4461 function parse(uuid) { 4462 if (!(0, _validate.default)(uuid)) { 4463 throw TypeError('Invalid UUID'); 4464 } 4465 4466 let v; 4467 const arr = new Uint8Array(16); // Parse ########-....-....-....-............ 4468 4469 arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; 4470 arr[1] = v >>> 16 & 0xff; 4471 arr[2] = v >>> 8 & 0xff; 4472 arr[3] = v & 0xff; // Parse ........-####-....-....-............ 4473 4474 arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; 4475 arr[5] = v & 0xff; // Parse ........-....-####-....-............ 4476 4477 arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; 4478 arr[7] = v & 0xff; // Parse ........-....-....-####-............ 4479 4480 arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; 4481 arr[9] = v & 0xff; // Parse ........-....-....-....-############ 4482 // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes) 4483 4484 arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff; 4485 arr[11] = v / 0x100000000 & 0xff; 4486 arr[12] = v >>> 24 & 0xff; 4487 arr[13] = v >>> 16 & 0xff; 4488 arr[14] = v >>> 8 & 0xff; 4489 arr[15] = v & 0xff; 4490 return arr; 4491 } 4492 4493 var _default = parse; 4494 exports["default"] = _default; 4495 4496 /***/ }), 4497 4498 /***/ 814: 4499 /***/ ((__unused_webpack_module, exports) => { 4500 4501 "use strict"; 4502 4503 4504 Object.defineProperty(exports, "__esModule", ({ 4505 value: true 4506 })); 4507 exports["default"] = void 0; 4508 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; 4509 exports["default"] = _default; 4510 4511 /***/ }), 4512 4513 /***/ 807: 4514 /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 4515 4516 "use strict"; 4517 4518 4519 Object.defineProperty(exports, "__esModule", ({ 4520 value: true 4521 })); 4522 exports["default"] = rng; 4523 4524 var _crypto = _interopRequireDefault(__nccwpck_require__(6113)); 4525 4526 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 4527 4528 const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate 4529 4530 let poolPtr = rnds8Pool.length; 4531 4532 function rng() { 4533 if (poolPtr > rnds8Pool.length - 16) { 4534 _crypto.default.randomFillSync(rnds8Pool); 4535 4536 poolPtr = 0; 4537 } 4538 4539 return rnds8Pool.slice(poolPtr, poolPtr += 16); 4540 } 4541 4542 /***/ }), 4543 4544 /***/ 5274: 4545 /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 4546 4547 "use strict"; 4548 4549 4550 Object.defineProperty(exports, "__esModule", ({ 4551 value: true 4552 })); 4553 exports["default"] = void 0; 4554 4555 var _crypto = _interopRequireDefault(__nccwpck_require__(6113)); 4556 4557 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 4558 4559 function sha1(bytes) { 4560 if (Array.isArray(bytes)) { 4561 bytes = Buffer.from(bytes); 4562 } else if (typeof bytes === 'string') { 4563 bytes = Buffer.from(bytes, 'utf8'); 4564 } 4565 4566 return _crypto.default.createHash('sha1').update(bytes).digest(); 4567 } 4568 4569 var _default = sha1; 4570 exports["default"] = _default; 4571 4572 /***/ }), 4573 4574 /***/ 8950: 4575 /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 4576 4577 "use strict"; 4578 4579 4580 Object.defineProperty(exports, "__esModule", ({ 4581 value: true 4582 })); 4583 exports["default"] = void 0; 4584 4585 var _validate = _interopRequireDefault(__nccwpck_require__(6900)); 4586 4587 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 4588 4589 /** 4590 * Convert array of 16 byte values to UUID string format of the form: 4591 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX 4592 */ 4593 const byteToHex = []; 4594 4595 for (let i = 0; i < 256; ++i) { 4596 byteToHex.push((i + 0x100).toString(16).substr(1)); 4597 } 4598 4599 function stringify(arr, offset = 0) { 4600 // Note: Be careful editing this code! It's been tuned for performance 4601 // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 4602 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 4603 // of the following: 4604 // - One or more input array values don't map to a hex octet (leading to 4605 // "undefined" in the uuid) 4606 // - Invalid input values for the RFC `version` or `variant` fields 4607 4608 if (!(0, _validate.default)(uuid)) { 4609 throw TypeError('Stringified UUID is invalid'); 4610 } 4611 4612 return uuid; 4613 } 4614 4615 var _default = stringify; 4616 exports["default"] = _default; 4617 4618 /***/ }), 4619 4620 /***/ 8628: 4621 /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 4622 4623 "use strict"; 4624 4625 4626 Object.defineProperty(exports, "__esModule", ({ 4627 value: true 4628 })); 4629 exports["default"] = void 0; 4630 4631 var _rng = _interopRequireDefault(__nccwpck_require__(807)); 4632 4633 var _stringify = _interopRequireDefault(__nccwpck_require__(8950)); 4634 4635 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 4636 4637 // **`v1()` - Generate time-based UUID** 4638 // 4639 // Inspired by https://github.com/LiosK/UUID.js 4640 // and http://docs.python.org/library/uuid.html 4641 let _nodeId; 4642 4643 let _clockseq; // Previous uuid creation time 4644 4645 4646 let _lastMSecs = 0; 4647 let _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details 4648 4649 function v1(options, buf, offset) { 4650 let i = buf && offset || 0; 4651 const b = buf || new Array(16); 4652 options = options || {}; 4653 let node = options.node || _nodeId; 4654 let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not 4655 // specified. We do this lazily to minimize issues related to insufficient 4656 // system entropy. See #189 4657 4658 if (node == null || clockseq == null) { 4659 const seedBytes = options.random || (options.rng || _rng.default)(); 4660 4661 if (node == null) { 4662 // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) 4663 node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; 4664 } 4665 4666 if (clockseq == null) { 4667 // Per 4.2.2, randomize (14 bit) clockseq 4668 clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; 4669 } 4670 } // UUID timestamps are 100 nano-second units since the Gregorian epoch, 4671 // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so 4672 // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' 4673 // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. 4674 4675 4676 let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock 4677 // cycle to simulate higher resolution clock 4678 4679 let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs) 4680 4681 const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression 4682 4683 if (dt < 0 && options.clockseq === undefined) { 4684 clockseq = clockseq + 1 & 0x3fff; 4685 } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new 4686 // time interval 4687 4688 4689 if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { 4690 nsecs = 0; 4691 } // Per 4.2.1.2 Throw error if too many uuids are requested 4692 4693 4694 if (nsecs >= 10000) { 4695 throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); 4696 } 4697 4698 _lastMSecs = msecs; 4699 _lastNSecs = nsecs; 4700 _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch 4701 4702 msecs += 12219292800000; // `time_low` 4703 4704 const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; 4705 b[i++] = tl >>> 24 & 0xff; 4706 b[i++] = tl >>> 16 & 0xff; 4707 b[i++] = tl >>> 8 & 0xff; 4708 b[i++] = tl & 0xff; // `time_mid` 4709 4710 const tmh = msecs / 0x100000000 * 10000 & 0xfffffff; 4711 b[i++] = tmh >>> 8 & 0xff; 4712 b[i++] = tmh & 0xff; // `time_high_and_version` 4713 4714 b[i++] = tmh >>> 24 & 0xf | 0x10; // include version 4715 4716 b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) 4717 4718 b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` 4719 4720 b[i++] = clockseq & 0xff; // `node` 4721 4722 for (let n = 0; n < 6; ++n) { 4723 b[i + n] = node[n]; 4724 } 4725 4726 return buf || (0, _stringify.default)(b); 4727 } 4728 4729 var _default = v1; 4730 exports["default"] = _default; 4731 4732 /***/ }), 4733 4734 /***/ 6409: 4735 /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 4736 4737 "use strict"; 4738 4739 4740 Object.defineProperty(exports, "__esModule", ({ 4741 value: true 4742 })); 4743 exports["default"] = void 0; 4744 4745 var _v = _interopRequireDefault(__nccwpck_require__(5998)); 4746 4747 var _md = _interopRequireDefault(__nccwpck_require__(4569)); 4748 4749 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 4750 4751 const v3 = (0, _v.default)('v3', 0x30, _md.default); 4752 var _default = v3; 4753 exports["default"] = _default; 4754 4755 /***/ }), 4756 4757 /***/ 5998: 4758 /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 4759 4760 "use strict"; 4761 4762 4763 Object.defineProperty(exports, "__esModule", ({ 4764 value: true 4765 })); 4766 exports["default"] = _default; 4767 exports.URL = exports.DNS = void 0; 4768 4769 var _stringify = _interopRequireDefault(__nccwpck_require__(8950)); 4770 4771 var _parse = _interopRequireDefault(__nccwpck_require__(2746)); 4772 4773 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 4774 4775 function stringToBytes(str) { 4776 str = unescape(encodeURIComponent(str)); // UTF8 escape 4777 4778 const bytes = []; 4779 4780 for (let i = 0; i < str.length; ++i) { 4781 bytes.push(str.charCodeAt(i)); 4782 } 4783 4784 return bytes; 4785 } 4786 4787 const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; 4788 exports.DNS = DNS; 4789 const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'; 4790 exports.URL = URL; 4791 4792 function _default(name, version, hashfunc) { 4793 function generateUUID(value, namespace, buf, offset) { 4794 if (typeof value === 'string') { 4795 value = stringToBytes(value); 4796 } 4797 4798 if (typeof namespace === 'string') { 4799 namespace = (0, _parse.default)(namespace); 4800 } 4801 4802 if (namespace.length !== 16) { 4803 throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)'); 4804 } // Compute hash of namespace and value, Per 4.3 4805 // Future: Use spread syntax when supported on all platforms, e.g. `bytes = 4806 // hashfunc([...namespace, ... value])` 4807 4808 4809 let bytes = new Uint8Array(16 + value.length); 4810 bytes.set(namespace); 4811 bytes.set(value, namespace.length); 4812 bytes = hashfunc(bytes); 4813 bytes[6] = bytes[6] & 0x0f | version; 4814 bytes[8] = bytes[8] & 0x3f | 0x80; 4815 4816 if (buf) { 4817 offset = offset || 0; 4818 4819 for (let i = 0; i < 16; ++i) { 4820 buf[offset + i] = bytes[i]; 4821 } 4822 4823 return buf; 4824 } 4825 4826 return (0, _stringify.default)(bytes); 4827 } // Function#name is not settable on some platforms (#270) 4828 4829 4830 try { 4831 generateUUID.name = name; // eslint-disable-next-line no-empty 4832 } catch (err) {} // For CommonJS default export support 4833 4834 4835 generateUUID.DNS = DNS; 4836 generateUUID.URL = URL; 4837 return generateUUID; 4838 } 4839 4840 /***/ }), 4841 4842 /***/ 5122: 4843 /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 4844 4845 "use strict"; 4846 4847 4848 Object.defineProperty(exports, "__esModule", ({ 4849 value: true 4850 })); 4851 exports["default"] = void 0; 4852 4853 var _rng = _interopRequireDefault(__nccwpck_require__(807)); 4854 4855 var _stringify = _interopRequireDefault(__nccwpck_require__(8950)); 4856 4857 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 4858 4859 function v4(options, buf, offset) { 4860 options = options || {}; 4861 4862 const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` 4863 4864 4865 rnds[6] = rnds[6] & 0x0f | 0x40; 4866 rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided 4867 4868 if (buf) { 4869 offset = offset || 0; 4870 4871 for (let i = 0; i < 16; ++i) { 4872 buf[offset + i] = rnds[i]; 4873 } 4874 4875 return buf; 4876 } 4877 4878 return (0, _stringify.default)(rnds); 4879 } 4880 4881 var _default = v4; 4882 exports["default"] = _default; 4883 4884 /***/ }), 4885 4886 /***/ 9120: 4887 /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 4888 4889 "use strict"; 4890 4891 4892 Object.defineProperty(exports, "__esModule", ({ 4893 value: true 4894 })); 4895 exports["default"] = void 0; 4896 4897 var _v = _interopRequireDefault(__nccwpck_require__(5998)); 4898 4899 var _sha = _interopRequireDefault(__nccwpck_require__(5274)); 4900 4901 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 4902 4903 const v5 = (0, _v.default)('v5', 0x50, _sha.default); 4904 var _default = v5; 4905 exports["default"] = _default; 4906 4907 /***/ }), 4908 4909 /***/ 6900: 4910 /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 4911 4912 "use strict"; 4913 4914 4915 Object.defineProperty(exports, "__esModule", ({ 4916 value: true 4917 })); 4918 exports["default"] = void 0; 4919 4920 var _regex = _interopRequireDefault(__nccwpck_require__(814)); 4921 4922 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 4923 4924 function validate(uuid) { 4925 return typeof uuid === 'string' && _regex.default.test(uuid); 4926 } 4927 4928 var _default = validate; 4929 exports["default"] = _default; 4930 4931 /***/ }), 4932 4933 /***/ 1595: 4934 /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 4935 4936 "use strict"; 4937 4938 4939 Object.defineProperty(exports, "__esModule", ({ 4940 value: true 4941 })); 4942 exports["default"] = void 0; 4943 4944 var _validate = _interopRequireDefault(__nccwpck_require__(6900)); 4945 4946 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 4947 4948 function version(uuid) { 4949 if (!(0, _validate.default)(uuid)) { 4950 throw TypeError('Invalid UUID'); 4951 } 4952 4953 return parseInt(uuid.substr(14, 1), 16); 4954 } 4955 4956 var _default = version; 4957 exports["default"] = _default; 4958 4959 /***/ }), 4960 4961 /***/ 9491: 4962 /***/ ((module) => { 4963 4964 "use strict"; 4965 module.exports = require("assert"); 4966 4967 /***/ }), 4968 4969 /***/ 6113: 4970 /***/ ((module) => { 4971 4972 "use strict"; 4973 module.exports = require("crypto"); 4974 4975 /***/ }), 4976 4977 /***/ 2361: 4978 /***/ ((module) => { 4979 4980 "use strict"; 4981 module.exports = require("events"); 4982 4983 /***/ }), 4984 4985 /***/ 7147: 4986 /***/ ((module) => { 4987 4988 "use strict"; 4989 module.exports = require("fs"); 4990 4991 /***/ }), 4992 4993 /***/ 3685: 4994 /***/ ((module) => { 4995 4996 "use strict"; 4997 module.exports = require("http"); 4998 4999 /***/ }), 5000 5001 /***/ 5687: 5002 /***/ ((module) => { 5003 5004 "use strict"; 5005 module.exports = require("https"); 5006 5007 /***/ }), 5008 5009 /***/ 1808: 5010 /***/ ((module) => { 5011 5012 "use strict"; 5013 module.exports = require("net"); 5014 5015 /***/ }), 5016 5017 /***/ 2037: 5018 /***/ ((module) => { 5019 5020 "use strict"; 5021 module.exports = require("os"); 5022 5023 /***/ }), 5024 5025 /***/ 1017: 5026 /***/ ((module) => { 5027 5028 "use strict"; 5029 module.exports = require("path"); 5030 5031 /***/ }), 5032 5033 /***/ 2781: 5034 /***/ ((module) => { 5035 5036 "use strict"; 5037 module.exports = require("stream"); 5038 5039 /***/ }), 5040 5041 /***/ 4404: 5042 /***/ ((module) => { 5043 5044 "use strict"; 5045 module.exports = require("tls"); 5046 5047 /***/ }), 5048 5049 /***/ 3837: 5050 /***/ ((module) => { 5051 5052 "use strict"; 5053 module.exports = require("util"); 5054 5055 /***/ }) 5056 5057 /******/ }); 5058 /************************************************************************/ 5059 /******/ // The module cache 5060 /******/ var __webpack_module_cache__ = {}; 5061 /******/ 5062 /******/ // The require function 5063 /******/ function __nccwpck_require__(moduleId) { 5064 /******/ // Check if module is in cache 5065 /******/ var cachedModule = __webpack_module_cache__[moduleId]; 5066 /******/ if (cachedModule !== undefined) { 5067 /******/ return cachedModule.exports; 5068 /******/ } 5069 /******/ // Create a new module (and put it into the cache) 5070 /******/ var module = __webpack_module_cache__[moduleId] = { 5071 /******/ // no module.id needed 5072 /******/ // no module.loaded needed 5073 /******/ exports: {} 5074 /******/ }; 5075 /******/ 5076 /******/ // Execute the module function 5077 /******/ var threw = true; 5078 /******/ try { 5079 /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nccwpck_require__); 5080 /******/ threw = false; 5081 /******/ } finally { 5082 /******/ if(threw) delete __webpack_module_cache__[moduleId]; 5083 /******/ } 5084 /******/ 5085 /******/ // Return the exports of the module 5086 /******/ return module.exports; 5087 /******/ } 5088 /******/ 5089 /************************************************************************/ 5090 /******/ /* webpack/runtime/compat */ 5091 /******/ 5092 /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; 5093 /******/ 5094 /************************************************************************/ 5095 /******/ 5096 /******/ // startup 5097 /******/ // Load entry module and return exports 5098 /******/ // This entry module is referenced by other modules so it can't be inlined 5099 /******/ var __webpack_exports__ = __nccwpck_require__(2627); 5100 /******/ module.exports = __webpack_exports__; 5101 /******/ 5102 /******/ })() 5103 ;