diff options
author | 2022-11-19 11:11:44 +0100 | |
---|---|---|
committer | 2022-11-19 11:11:44 +0100 | |
commit | c35ff5710fcd1713f29ae50c261c6b9cd76726ce (patch) | |
tree | 1790a4c63a23c2ae4bd2cd566da8edc8f1716ebd /.github/workflows/check-recipe-version-bump/dist | |
parent | add RaphaelJenni as a contributor for code (#241) [skip ci] (diff) | |
download | ferdium-recipes-c35ff5710fcd1713f29ae50c261c6b9cd76726ce.tar.gz ferdium-recipes-c35ff5710fcd1713f29ae50c261c6b9cd76726ce.tar.zst ferdium-recipes-c35ff5710fcd1713f29ae50c261c6b9cd76726ce.zip |
ci: add recipe version bump check in PRs (#236)
Diffstat (limited to '.github/workflows/check-recipe-version-bump/dist')
3 files changed, 4341 insertions, 0 deletions
diff --git a/.github/workflows/check-recipe-version-bump/dist/index.js b/.github/workflows/check-recipe-version-bump/dist/index.js new file mode 100644 index 0000000..bccc451 --- /dev/null +++ b/.github/workflows/check-recipe-version-bump/dist/index.js | |||
@@ -0,0 +1,4241 @@ | |||
1 | import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module"; | ||
2 | /******/ var __webpack_modules__ = ({ | ||
3 | |||
4 | /***/ 410: | ||
5 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { | ||
6 | |||
7 | |||
8 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
9 | if (k2 === undefined) k2 = k; | ||
10 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
11 | }) : (function(o, m, k, k2) { | ||
12 | if (k2 === undefined) k2 = k; | ||
13 | o[k2] = m[k]; | ||
14 | })); | ||
15 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
16 | Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
17 | }) : function(o, v) { | ||
18 | o["default"] = v; | ||
19 | }); | ||
20 | var __importStar = (this && this.__importStar) || function (mod) { | ||
21 | if (mod && mod.__esModule) return mod; | ||
22 | var result = {}; | ||
23 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
24 | __setModuleDefault(result, mod); | ||
25 | return result; | ||
26 | }; | ||
27 | Object.defineProperty(exports, "__esModule", ({ value: true })); | ||
28 | exports.issue = exports.issueCommand = void 0; | ||
29 | const os = __importStar(__nccwpck_require__(37)); | ||
30 | const utils_1 = __nccwpck_require__(900); | ||
31 | /** | ||
32 | * Commands | ||
33 | * | ||
34 | * Command Format: | ||
35 | * ::name key=value,key=value::message | ||
36 | * | ||
37 | * Examples: | ||
38 | * ::warning::This is the message | ||
39 | * ::set-env name=MY_VAR::some value | ||
40 | */ | ||
41 | function issueCommand(command, properties, message) { | ||
42 | const cmd = new Command(command, properties, message); | ||
43 | process.stdout.write(cmd.toString() + os.EOL); | ||
44 | } | ||
45 | exports.issueCommand = issueCommand; | ||
46 | function issue(name, message = '') { | ||
47 | issueCommand(name, {}, message); | ||
48 | } | ||
49 | exports.issue = issue; | ||
50 | const CMD_STRING = '::'; | ||
51 | class Command { | ||
52 | constructor(command, properties, message) { | ||
53 | if (!command) { | ||
54 | command = 'missing.command'; | ||
55 | } | ||
56 | this.command = command; | ||
57 | this.properties = properties; | ||
58 | this.message = message; | ||
59 | } | ||
60 | toString() { | ||
61 | let cmdStr = CMD_STRING + this.command; | ||
62 | if (this.properties && Object.keys(this.properties).length > 0) { | ||
63 | cmdStr += ' '; | ||
64 | let first = true; | ||
65 | for (const key in this.properties) { | ||
66 | if (this.properties.hasOwnProperty(key)) { | ||
67 | const val = this.properties[key]; | ||
68 | if (val) { | ||
69 | if (first) { | ||
70 | first = false; | ||
71 | } | ||
72 | else { | ||
73 | cmdStr += ','; | ||
74 | } | ||
75 | cmdStr += `${key}=${escapeProperty(val)}`; | ||
76 | } | ||
77 | } | ||
78 | } | ||
79 | } | ||
80 | cmdStr += `${CMD_STRING}${escapeData(this.message)}`; | ||
81 | return cmdStr; | ||
82 | } | ||
83 | } | ||
84 | function escapeData(s) { | ||
85 | return utils_1.toCommandValue(s) | ||
86 | .replace(/%/g, '%25') | ||
87 | .replace(/\r/g, '%0D') | ||
88 | .replace(/\n/g, '%0A'); | ||
89 | } | ||
90 | function escapeProperty(s) { | ||
91 | return utils_1.toCommandValue(s) | ||
92 | .replace(/%/g, '%25') | ||
93 | .replace(/\r/g, '%0D') | ||
94 | .replace(/\n/g, '%0A') | ||
95 | .replace(/:/g, '%3A') | ||
96 | .replace(/,/g, '%2C'); | ||
97 | } | ||
98 | //# sourceMappingURL=command.js.map | ||
99 | |||
100 | /***/ }), | ||
101 | |||
102 | /***/ 954: | ||
103 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { | ||
104 | |||
105 | |||
106 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
107 | if (k2 === undefined) k2 = k; | ||
108 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
109 | }) : (function(o, m, k, k2) { | ||
110 | if (k2 === undefined) k2 = k; | ||
111 | o[k2] = m[k]; | ||
112 | })); | ||
113 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
114 | Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
115 | }) : function(o, v) { | ||
116 | o["default"] = v; | ||
117 | }); | ||
118 | var __importStar = (this && this.__importStar) || function (mod) { | ||
119 | if (mod && mod.__esModule) return mod; | ||
120 | var result = {}; | ||
121 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
122 | __setModuleDefault(result, mod); | ||
123 | return result; | ||
124 | }; | ||
125 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
126 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
127 | return new (P || (P = Promise))(function (resolve, reject) { | ||
128 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
129 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
130 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
131 | step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
132 | }); | ||
133 | }; | ||
134 | Object.defineProperty(exports, "__esModule", ({ value: true })); | ||
135 | 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; | ||
136 | const command_1 = __nccwpck_require__(410); | ||
137 | const file_command_1 = __nccwpck_require__(980); | ||
138 | const utils_1 = __nccwpck_require__(900); | ||
139 | const os = __importStar(__nccwpck_require__(37)); | ||
140 | const path = __importStar(__nccwpck_require__(17)); | ||
141 | const oidc_utils_1 = __nccwpck_require__(776); | ||
142 | /** | ||
143 | * The code to exit an action | ||
144 | */ | ||
145 | var ExitCode; | ||
146 | (function (ExitCode) { | ||
147 | /** | ||
148 | * A code indicating that the action was successful | ||
149 | */ | ||
150 | ExitCode[ExitCode["Success"] = 0] = "Success"; | ||
151 | /** | ||
152 | * A code indicating that the action was a failure | ||
153 | */ | ||
154 | ExitCode[ExitCode["Failure"] = 1] = "Failure"; | ||
155 | })(ExitCode = exports.ExitCode || (exports.ExitCode = {})); | ||
156 | //----------------------------------------------------------------------- | ||
157 | // Variables | ||
158 | //----------------------------------------------------------------------- | ||
159 | /** | ||
160 | * Sets env variable for this action and future actions in the job | ||
161 | * @param name the name of the variable to set | ||
162 | * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify | ||
163 | */ | ||
164 | // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
165 | function exportVariable(name, val) { | ||
166 | const convertedVal = utils_1.toCommandValue(val); | ||
167 | process.env[name] = convertedVal; | ||
168 | const filePath = process.env['GITHUB_ENV'] || ''; | ||
169 | if (filePath) { | ||
170 | return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val)); | ||
171 | } | ||
172 | command_1.issueCommand('set-env', { name }, convertedVal); | ||
173 | } | ||
174 | exports.exportVariable = exportVariable; | ||
175 | /** | ||
176 | * Registers a secret which will get masked from logs | ||
177 | * @param secret value of the secret | ||
178 | */ | ||
179 | function setSecret(secret) { | ||
180 | command_1.issueCommand('add-mask', {}, secret); | ||
181 | } | ||
182 | exports.setSecret = setSecret; | ||
183 | /** | ||
184 | * Prepends inputPath to the PATH (for this action and future actions) | ||
185 | * @param inputPath | ||
186 | */ | ||
187 | function addPath(inputPath) { | ||
188 | const filePath = process.env['GITHUB_PATH'] || ''; | ||
189 | if (filePath) { | ||
190 | file_command_1.issueFileCommand('PATH', inputPath); | ||
191 | } | ||
192 | else { | ||
193 | command_1.issueCommand('add-path', {}, inputPath); | ||
194 | } | ||
195 | process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`; | ||
196 | } | ||
197 | exports.addPath = addPath; | ||
198 | /** | ||
199 | * Gets the value of an input. | ||
200 | * Unless trimWhitespace is set to false in InputOptions, the value is also trimmed. | ||
201 | * Returns an empty string if the value is not defined. | ||
202 | * | ||
203 | * @param name name of the input to get | ||
204 | * @param options optional. See InputOptions. | ||
205 | * @returns string | ||
206 | */ | ||
207 | function getInput(name, options) { | ||
208 | const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || ''; | ||
209 | if (options && options.required && !val) { | ||
210 | throw new Error(`Input required and not supplied: ${name}`); | ||
211 | } | ||
212 | if (options && options.trimWhitespace === false) { | ||
213 | return val; | ||
214 | } | ||
215 | return val.trim(); | ||
216 | } | ||
217 | exports.getInput = getInput; | ||
218 | /** | ||
219 | * Gets the values of an multiline input. Each value is also trimmed. | ||
220 | * | ||
221 | * @param name name of the input to get | ||
222 | * @param options optional. See InputOptions. | ||
223 | * @returns string[] | ||
224 | * | ||
225 | */ | ||
226 | function getMultilineInput(name, options) { | ||
227 | const inputs = getInput(name, options) | ||
228 | .split('\n') | ||
229 | .filter(x => x !== ''); | ||
230 | if (options && options.trimWhitespace === false) { | ||
231 | return inputs; | ||
232 | } | ||
233 | return inputs.map(input => input.trim()); | ||
234 | } | ||
235 | exports.getMultilineInput = getMultilineInput; | ||
236 | /** | ||
237 | * Gets the input value of the boolean type in the YAML 1.2 "core schema" specification. | ||
238 | * Support boolean input list: `true | True | TRUE | false | False | FALSE` . | ||
239 | * The return value is also in boolean type. | ||
240 | * ref: https://yaml.org/spec/1.2/spec.html#id2804923 | ||
241 | * | ||
242 | * @param name name of the input to get | ||
243 | * @param options optional. See InputOptions. | ||
244 | * @returns boolean | ||
245 | */ | ||
246 | function getBooleanInput(name, options) { | ||
247 | const trueValue = ['true', 'True', 'TRUE']; | ||
248 | const falseValue = ['false', 'False', 'FALSE']; | ||
249 | const val = getInput(name, options); | ||
250 | if (trueValue.includes(val)) | ||
251 | return true; | ||
252 | if (falseValue.includes(val)) | ||
253 | return false; | ||
254 | throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` + | ||
255 | `Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); | ||
256 | } | ||
257 | exports.getBooleanInput = getBooleanInput; | ||
258 | /** | ||
259 | * Sets the value of an output. | ||
260 | * | ||
261 | * @param name name of the output to set | ||
262 | * @param value value to store. Non-string values will be converted to a string via JSON.stringify | ||
263 | */ | ||
264 | // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
265 | function setOutput(name, value) { | ||
266 | const filePath = process.env['GITHUB_OUTPUT'] || ''; | ||
267 | if (filePath) { | ||
268 | return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value)); | ||
269 | } | ||
270 | process.stdout.write(os.EOL); | ||
271 | command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value)); | ||
272 | } | ||
273 | exports.setOutput = setOutput; | ||
274 | /** | ||
275 | * Enables or disables the echoing of commands into stdout for the rest of the step. | ||
276 | * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set. | ||
277 | * | ||
278 | */ | ||
279 | function setCommandEcho(enabled) { | ||
280 | command_1.issue('echo', enabled ? 'on' : 'off'); | ||
281 | } | ||
282 | exports.setCommandEcho = setCommandEcho; | ||
283 | //----------------------------------------------------------------------- | ||
284 | // Results | ||
285 | //----------------------------------------------------------------------- | ||
286 | /** | ||
287 | * Sets the action status to failed. | ||
288 | * When the action exits it will be with an exit code of 1 | ||
289 | * @param message add error issue message | ||
290 | */ | ||
291 | function setFailed(message) { | ||
292 | process.exitCode = ExitCode.Failure; | ||
293 | error(message); | ||
294 | } | ||
295 | exports.setFailed = setFailed; | ||
296 | //----------------------------------------------------------------------- | ||
297 | // Logging Commands | ||
298 | //----------------------------------------------------------------------- | ||
299 | /** | ||
300 | * Gets whether Actions Step Debug is on or not | ||
301 | */ | ||
302 | function isDebug() { | ||
303 | return process.env['RUNNER_DEBUG'] === '1'; | ||
304 | } | ||
305 | exports.isDebug = isDebug; | ||
306 | /** | ||
307 | * Writes debug message to user log | ||
308 | * @param message debug message | ||
309 | */ | ||
310 | function debug(message) { | ||
311 | command_1.issueCommand('debug', {}, message); | ||
312 | } | ||
313 | exports.debug = debug; | ||
314 | /** | ||
315 | * Adds an error issue | ||
316 | * @param message error issue message. Errors will be converted to string via toString() | ||
317 | * @param properties optional properties to add to the annotation. | ||
318 | */ | ||
319 | function error(message, properties = {}) { | ||
320 | command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); | ||
321 | } | ||
322 | exports.error = error; | ||
323 | /** | ||
324 | * Adds a warning issue | ||
325 | * @param message warning issue message. Errors will be converted to string via toString() | ||
326 | * @param properties optional properties to add to the annotation. | ||
327 | */ | ||
328 | function warning(message, properties = {}) { | ||
329 | command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); | ||
330 | } | ||
331 | exports.warning = warning; | ||
332 | /** | ||
333 | * Adds a notice issue | ||
334 | * @param message notice issue message. Errors will be converted to string via toString() | ||
335 | * @param properties optional properties to add to the annotation. | ||
336 | */ | ||
337 | function notice(message, properties = {}) { | ||
338 | command_1.issueCommand('notice', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); | ||
339 | } | ||
340 | exports.notice = notice; | ||
341 | /** | ||
342 | * Writes info to log with console.log. | ||
343 | * @param message info message | ||
344 | */ | ||
345 | function info(message) { | ||
346 | process.stdout.write(message + os.EOL); | ||
347 | } | ||
348 | exports.info = info; | ||
349 | /** | ||
350 | * Begin an output group. | ||
351 | * | ||
352 | * Output until the next `groupEnd` will be foldable in this group | ||
353 | * | ||
354 | * @param name The name of the output group | ||
355 | */ | ||
356 | function startGroup(name) { | ||
357 | command_1.issue('group', name); | ||
358 | } | ||
359 | exports.startGroup = startGroup; | ||
360 | /** | ||
361 | * End an output group. | ||
362 | */ | ||
363 | function endGroup() { | ||
364 | command_1.issue('endgroup'); | ||
365 | } | ||
366 | exports.endGroup = endGroup; | ||
367 | /** | ||
368 | * Wrap an asynchronous function call in a group. | ||
369 | * | ||
370 | * Returns the same type as the function itself. | ||
371 | * | ||
372 | * @param name The name of the group | ||
373 | * @param fn The function to wrap in the group | ||
374 | */ | ||
375 | function group(name, fn) { | ||
376 | return __awaiter(this, void 0, void 0, function* () { | ||
377 | startGroup(name); | ||
378 | let result; | ||
379 | try { | ||
380 | result = yield fn(); | ||
381 | } | ||
382 | finally { | ||
383 | endGroup(); | ||
384 | } | ||
385 | return result; | ||
386 | }); | ||
387 | } | ||
388 | exports.group = group; | ||
389 | //----------------------------------------------------------------------- | ||
390 | // Wrapper action state | ||
391 | //----------------------------------------------------------------------- | ||
392 | /** | ||
393 | * Saves state for current action, the state can only be retrieved by this action's post job execution. | ||
394 | * | ||
395 | * @param name name of the state to store | ||
396 | * @param value value to store. Non-string values will be converted to a string via JSON.stringify | ||
397 | */ | ||
398 | // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
399 | function saveState(name, value) { | ||
400 | const filePath = process.env['GITHUB_STATE'] || ''; | ||
401 | if (filePath) { | ||
402 | return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value)); | ||
403 | } | ||
404 | command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value)); | ||
405 | } | ||
406 | exports.saveState = saveState; | ||
407 | /** | ||
408 | * Gets the value of an state set by this action's main execution. | ||
409 | * | ||
410 | * @param name name of the state to get | ||
411 | * @returns string | ||
412 | */ | ||
413 | function getState(name) { | ||
414 | return process.env[`STATE_${name}`] || ''; | ||
415 | } | ||
416 | exports.getState = getState; | ||
417 | function getIDToken(aud) { | ||
418 | return __awaiter(this, void 0, void 0, function* () { | ||
419 | return yield oidc_utils_1.OidcClient.getIDToken(aud); | ||
420 | }); | ||
421 | } | ||
422 | exports.getIDToken = getIDToken; | ||
423 | /** | ||
424 | * Summary exports | ||
425 | */ | ||
426 | var summary_1 = __nccwpck_require__(265); | ||
427 | Object.defineProperty(exports, "summary", ({ enumerable: true, get: function () { return summary_1.summary; } })); | ||
428 | /** | ||
429 | * @deprecated use core.summary | ||
430 | */ | ||
431 | var summary_2 = __nccwpck_require__(265); | ||
432 | Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } })); | ||
433 | /** | ||
434 | * Path exports | ||
435 | */ | ||
436 | var path_utils_1 = __nccwpck_require__(370); | ||
437 | Object.defineProperty(exports, "toPosixPath", ({ enumerable: true, get: function () { return path_utils_1.toPosixPath; } })); | ||
438 | Object.defineProperty(exports, "toWin32Path", ({ enumerable: true, get: function () { return path_utils_1.toWin32Path; } })); | ||
439 | Object.defineProperty(exports, "toPlatformPath", ({ enumerable: true, get: function () { return path_utils_1.toPlatformPath; } })); | ||
440 | //# sourceMappingURL=core.js.map | ||
441 | |||
442 | /***/ }), | ||
443 | |||
444 | /***/ 980: | ||
445 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { | ||
446 | |||
447 | |||
448 | // For internal use, subject to change. | ||
449 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
450 | if (k2 === undefined) k2 = k; | ||
451 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
452 | }) : (function(o, m, k, k2) { | ||
453 | if (k2 === undefined) k2 = k; | ||
454 | o[k2] = m[k]; | ||
455 | })); | ||
456 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
457 | Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
458 | }) : function(o, v) { | ||
459 | o["default"] = v; | ||
460 | }); | ||
461 | var __importStar = (this && this.__importStar) || function (mod) { | ||
462 | if (mod && mod.__esModule) return mod; | ||
463 | var result = {}; | ||
464 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
465 | __setModuleDefault(result, mod); | ||
466 | return result; | ||
467 | }; | ||
468 | Object.defineProperty(exports, "__esModule", ({ value: true })); | ||
469 | exports.prepareKeyValueMessage = exports.issueFileCommand = void 0; | ||
470 | // We use any as a valid input type | ||
471 | /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
472 | const fs = __importStar(__nccwpck_require__(147)); | ||
473 | const os = __importStar(__nccwpck_require__(37)); | ||
474 | const uuid_1 = __nccwpck_require__(66); | ||
475 | const utils_1 = __nccwpck_require__(900); | ||
476 | function issueFileCommand(command, message) { | ||
477 | const filePath = process.env[`GITHUB_${command}`]; | ||
478 | if (!filePath) { | ||
479 | throw new Error(`Unable to find environment variable for file command ${command}`); | ||
480 | } | ||
481 | if (!fs.existsSync(filePath)) { | ||
482 | throw new Error(`Missing file at path: ${filePath}`); | ||
483 | } | ||
484 | fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, { | ||
485 | encoding: 'utf8' | ||
486 | }); | ||
487 | } | ||
488 | exports.issueFileCommand = issueFileCommand; | ||
489 | function prepareKeyValueMessage(key, value) { | ||
490 | const delimiter = `ghadelimiter_${uuid_1.v4()}`; | ||
491 | const convertedValue = utils_1.toCommandValue(value); | ||
492 | // These should realistically never happen, but just in case someone finds a | ||
493 | // way to exploit uuid generation let's not allow keys or values that contain | ||
494 | // the delimiter. | ||
495 | if (key.includes(delimiter)) { | ||
496 | throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`); | ||
497 | } | ||
498 | if (convertedValue.includes(delimiter)) { | ||
499 | throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`); | ||
500 | } | ||
501 | return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`; | ||
502 | } | ||
503 | exports.prepareKeyValueMessage = prepareKeyValueMessage; | ||
504 | //# sourceMappingURL=file-command.js.map | ||
505 | |||
506 | /***/ }), | ||
507 | |||
508 | /***/ 776: | ||
509 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { | ||
510 | |||
511 | |||
512 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
513 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
514 | return new (P || (P = Promise))(function (resolve, reject) { | ||
515 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
516 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
517 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
518 | step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
519 | }); | ||
520 | }; | ||
521 | Object.defineProperty(exports, "__esModule", ({ value: true })); | ||
522 | exports.OidcClient = void 0; | ||
523 | const http_client_1 = __nccwpck_require__(706); | ||
524 | const auth_1 = __nccwpck_require__(336); | ||
525 | const core_1 = __nccwpck_require__(954); | ||
526 | class OidcClient { | ||
527 | static createHttpClient(allowRetry = true, maxRetry = 10) { | ||
528 | const requestOptions = { | ||
529 | allowRetries: allowRetry, | ||
530 | maxRetries: maxRetry | ||
531 | }; | ||
532 | return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions); | ||
533 | } | ||
534 | static getRequestToken() { | ||
535 | const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN']; | ||
536 | if (!token) { | ||
537 | throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable'); | ||
538 | } | ||
539 | return token; | ||
540 | } | ||
541 | static getIDTokenUrl() { | ||
542 | const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL']; | ||
543 | if (!runtimeUrl) { | ||
544 | throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable'); | ||
545 | } | ||
546 | return runtimeUrl; | ||
547 | } | ||
548 | static getCall(id_token_url) { | ||
549 | var _a; | ||
550 | return __awaiter(this, void 0, void 0, function* () { | ||
551 | const httpclient = OidcClient.createHttpClient(); | ||
552 | const res = yield httpclient | ||
553 | .getJson(id_token_url) | ||
554 | .catch(error => { | ||
555 | throw new Error(`Failed to get ID Token. \n | ||
556 | Error Code : ${error.statusCode}\n | ||
557 | Error Message: ${error.result.message}`); | ||
558 | }); | ||
559 | const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; | ||
560 | if (!id_token) { | ||
561 | throw new Error('Response json body do not have ID Token field'); | ||
562 | } | ||
563 | return id_token; | ||
564 | }); | ||
565 | } | ||
566 | static getIDToken(audience) { | ||
567 | return __awaiter(this, void 0, void 0, function* () { | ||
568 | try { | ||
569 | // New ID Token is requested from action service | ||
570 | let id_token_url = OidcClient.getIDTokenUrl(); | ||
571 | if (audience) { | ||
572 | const encodedAudience = encodeURIComponent(audience); | ||
573 | id_token_url = `${id_token_url}&audience=${encodedAudience}`; | ||
574 | } | ||
575 | core_1.debug(`ID token url is ${id_token_url}`); | ||
576 | const id_token = yield OidcClient.getCall(id_token_url); | ||
577 | core_1.setSecret(id_token); | ||
578 | return id_token; | ||
579 | } | ||
580 | catch (error) { | ||
581 | throw new Error(`Error message: ${error.message}`); | ||
582 | } | ||
583 | }); | ||
584 | } | ||
585 | } | ||
586 | exports.OidcClient = OidcClient; | ||
587 | //# sourceMappingURL=oidc-utils.js.map | ||
588 | |||
589 | /***/ }), | ||
590 | |||
591 | /***/ 370: | ||
592 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { | ||
593 | |||
594 | |||
595 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
596 | if (k2 === undefined) k2 = k; | ||
597 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
598 | }) : (function(o, m, k, k2) { | ||
599 | if (k2 === undefined) k2 = k; | ||
600 | o[k2] = m[k]; | ||
601 | })); | ||
602 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
603 | Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
604 | }) : function(o, v) { | ||
605 | o["default"] = v; | ||
606 | }); | ||
607 | var __importStar = (this && this.__importStar) || function (mod) { | ||
608 | if (mod && mod.__esModule) return mod; | ||
609 | var result = {}; | ||
610 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
611 | __setModuleDefault(result, mod); | ||
612 | return result; | ||
613 | }; | ||
614 | Object.defineProperty(exports, "__esModule", ({ value: true })); | ||
615 | exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = void 0; | ||
616 | const path = __importStar(__nccwpck_require__(17)); | ||
617 | /** | ||
618 | * toPosixPath converts the given path to the posix form. On Windows, \\ will be | ||
619 | * replaced with /. | ||
620 | * | ||
621 | * @param pth. Path to transform. | ||
622 | * @return string Posix path. | ||
623 | */ | ||
624 | function toPosixPath(pth) { | ||
625 | return pth.replace(/[\\]/g, '/'); | ||
626 | } | ||
627 | exports.toPosixPath = toPosixPath; | ||
628 | /** | ||
629 | * toWin32Path converts the given path to the win32 form. On Linux, / will be | ||
630 | * replaced with \\. | ||
631 | * | ||
632 | * @param pth. Path to transform. | ||
633 | * @return string Win32 path. | ||
634 | */ | ||
635 | function toWin32Path(pth) { | ||
636 | return pth.replace(/[/]/g, '\\'); | ||
637 | } | ||
638 | exports.toWin32Path = toWin32Path; | ||
639 | /** | ||
640 | * toPlatformPath converts the given path to a platform-specific path. It does | ||
641 | * this by replacing instances of / and \ with the platform-specific path | ||
642 | * separator. | ||
643 | * | ||
644 | * @param pth The path to platformize. | ||
645 | * @return string The platform-specific path. | ||
646 | */ | ||
647 | function toPlatformPath(pth) { | ||
648 | return pth.replace(/[/\\]/g, path.sep); | ||
649 | } | ||
650 | exports.toPlatformPath = toPlatformPath; | ||
651 | //# sourceMappingURL=path-utils.js.map | ||
652 | |||
653 | /***/ }), | ||
654 | |||
655 | /***/ 265: | ||
656 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { | ||
657 | |||
658 | |||
659 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
660 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
661 | return new (P || (P = Promise))(function (resolve, reject) { | ||
662 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
663 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
664 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
665 | step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
666 | }); | ||
667 | }; | ||
668 | Object.defineProperty(exports, "__esModule", ({ value: true })); | ||
669 | exports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0; | ||
670 | const os_1 = __nccwpck_require__(37); | ||
671 | const fs_1 = __nccwpck_require__(147); | ||
672 | const { access, appendFile, writeFile } = fs_1.promises; | ||
673 | exports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY'; | ||
674 | exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary'; | ||
675 | class Summary { | ||
676 | constructor() { | ||
677 | this._buffer = ''; | ||
678 | } | ||
679 | /** | ||
680 | * Finds the summary file path from the environment, rejects if env var is not found or file does not exist | ||
681 | * Also checks r/w permissions. | ||
682 | * | ||
683 | * @returns step summary file path | ||
684 | */ | ||
685 | filePath() { | ||
686 | return __awaiter(this, void 0, void 0, function* () { | ||
687 | if (this._filePath) { | ||
688 | return this._filePath; | ||
689 | } | ||
690 | const pathFromEnv = process.env[exports.SUMMARY_ENV_VAR]; | ||
691 | if (!pathFromEnv) { | ||
692 | throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`); | ||
693 | } | ||
694 | try { | ||
695 | yield access(pathFromEnv, fs_1.constants.R_OK | fs_1.constants.W_OK); | ||
696 | } | ||
697 | catch (_a) { | ||
698 | throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`); | ||
699 | } | ||
700 | this._filePath = pathFromEnv; | ||
701 | return this._filePath; | ||
702 | }); | ||
703 | } | ||
704 | /** | ||
705 | * Wraps content in an HTML tag, adding any HTML attributes | ||
706 | * | ||
707 | * @param {string} tag HTML tag to wrap | ||
708 | * @param {string | null} content content within the tag | ||
709 | * @param {[attribute: string]: string} attrs key-value list of HTML attributes to add | ||
710 | * | ||
711 | * @returns {string} content wrapped in HTML element | ||
712 | */ | ||
713 | wrap(tag, content, attrs = {}) { | ||
714 | const htmlAttrs = Object.entries(attrs) | ||
715 | .map(([key, value]) => ` ${key}="${value}"`) | ||
716 | .join(''); | ||
717 | if (!content) { | ||
718 | return `<${tag}${htmlAttrs}>`; | ||
719 | } | ||
720 | return `<${tag}${htmlAttrs}>${content}</${tag}>`; | ||
721 | } | ||
722 | /** | ||
723 | * Writes text in the buffer to the summary buffer file and empties buffer. Will append by default. | ||
724 | * | ||
725 | * @param {SummaryWriteOptions} [options] (optional) options for write operation | ||
726 | * | ||
727 | * @returns {Promise<Summary>} summary instance | ||
728 | */ | ||
729 | write(options) { | ||
730 | return __awaiter(this, void 0, void 0, function* () { | ||
731 | const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite); | ||
732 | const filePath = yield this.filePath(); | ||
733 | const writeFunc = overwrite ? writeFile : appendFile; | ||
734 | yield writeFunc(filePath, this._buffer, { encoding: 'utf8' }); | ||
735 | return this.emptyBuffer(); | ||
736 | }); | ||
737 | } | ||
738 | /** | ||
739 | * Clears the summary buffer and wipes the summary file | ||
740 | * | ||
741 | * @returns {Summary} summary instance | ||
742 | */ | ||
743 | clear() { | ||
744 | return __awaiter(this, void 0, void 0, function* () { | ||
745 | return this.emptyBuffer().write({ overwrite: true }); | ||
746 | }); | ||
747 | } | ||
748 | /** | ||
749 | * Returns the current summary buffer as a string | ||
750 | * | ||
751 | * @returns {string} string of summary buffer | ||
752 | */ | ||
753 | stringify() { | ||
754 | return this._buffer; | ||
755 | } | ||
756 | /** | ||
757 | * If the summary buffer is empty | ||
758 | * | ||
759 | * @returns {boolen} true if the buffer is empty | ||
760 | */ | ||
761 | isEmptyBuffer() { | ||
762 | return this._buffer.length === 0; | ||
763 | } | ||
764 | /** | ||
765 | * Resets the summary buffer without writing to summary file | ||
766 | * | ||
767 | * @returns {Summary} summary instance | ||
768 | */ | ||
769 | emptyBuffer() { | ||
770 | this._buffer = ''; | ||
771 | return this; | ||
772 | } | ||
773 | /** | ||
774 | * Adds raw text to the summary buffer | ||
775 | * | ||
776 | * @param {string} text content to add | ||
777 | * @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false) | ||
778 | * | ||
779 | * @returns {Summary} summary instance | ||
780 | */ | ||
781 | addRaw(text, addEOL = false) { | ||
782 | this._buffer += text; | ||
783 | return addEOL ? this.addEOL() : this; | ||
784 | } | ||
785 | /** | ||
786 | * Adds the operating system-specific end-of-line marker to the buffer | ||
787 | * | ||
788 | * @returns {Summary} summary instance | ||
789 | */ | ||
790 | addEOL() { | ||
791 | return this.addRaw(os_1.EOL); | ||
792 | } | ||
793 | /** | ||
794 | * Adds an HTML codeblock to the summary buffer | ||
795 | * | ||
796 | * @param {string} code content to render within fenced code block | ||
797 | * @param {string} lang (optional) language to syntax highlight code | ||
798 | * | ||
799 | * @returns {Summary} summary instance | ||
800 | */ | ||
801 | addCodeBlock(code, lang) { | ||
802 | const attrs = Object.assign({}, (lang && { lang })); | ||
803 | const element = this.wrap('pre', this.wrap('code', code), attrs); | ||
804 | return this.addRaw(element).addEOL(); | ||
805 | } | ||
806 | /** | ||
807 | * Adds an HTML list to the summary buffer | ||
808 | * | ||
809 | * @param {string[]} items list of items to render | ||
810 | * @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false) | ||
811 | * | ||
812 | * @returns {Summary} summary instance | ||
813 | */ | ||
814 | addList(items, ordered = false) { | ||
815 | const tag = ordered ? 'ol' : 'ul'; | ||
816 | const listItems = items.map(item => this.wrap('li', item)).join(''); | ||
817 | const element = this.wrap(tag, listItems); | ||
818 | return this.addRaw(element).addEOL(); | ||
819 | } | ||
820 | /** | ||
821 | * Adds an HTML table to the summary buffer | ||
822 | * | ||
823 | * @param {SummaryTableCell[]} rows table rows | ||
824 | * | ||
825 | * @returns {Summary} summary instance | ||
826 | */ | ||
827 | addTable(rows) { | ||
828 | const tableBody = rows | ||
829 | .map(row => { | ||
830 | const cells = row | ||
831 | .map(cell => { | ||
832 | if (typeof cell === 'string') { | ||
833 | return this.wrap('td', cell); | ||
834 | } | ||
835 | const { header, data, colspan, rowspan } = cell; | ||
836 | const tag = header ? 'th' : 'td'; | ||
837 | const attrs = Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan })); | ||
838 | return this.wrap(tag, data, attrs); | ||
839 | }) | ||
840 | .join(''); | ||
841 | return this.wrap('tr', cells); | ||
842 | }) | ||
843 | .join(''); | ||
844 | const element = this.wrap('table', tableBody); | ||
845 | return this.addRaw(element).addEOL(); | ||
846 | } | ||
847 | /** | ||
848 | * Adds a collapsable HTML details element to the summary buffer | ||
849 | * | ||
850 | * @param {string} label text for the closed state | ||
851 | * @param {string} content collapsable content | ||
852 | * | ||
853 | * @returns {Summary} summary instance | ||
854 | */ | ||
855 | addDetails(label, content) { | ||
856 | const element = this.wrap('details', this.wrap('summary', label) + content); | ||
857 | return this.addRaw(element).addEOL(); | ||
858 | } | ||
859 | /** | ||
860 | * Adds an HTML image tag to the summary buffer | ||
861 | * | ||
862 | * @param {string} src path to the image you to embed | ||
863 | * @param {string} alt text description of the image | ||
864 | * @param {SummaryImageOptions} options (optional) addition image attributes | ||
865 | * | ||
866 | * @returns {Summary} summary instance | ||
867 | */ | ||
868 | addImage(src, alt, options) { | ||
869 | const { width, height } = options || {}; | ||
870 | const attrs = Object.assign(Object.assign({}, (width && { width })), (height && { height })); | ||
871 | const element = this.wrap('img', null, Object.assign({ src, alt }, attrs)); | ||
872 | return this.addRaw(element).addEOL(); | ||
873 | } | ||
874 | /** | ||
875 | * Adds an HTML section heading element | ||
876 | * | ||
877 | * @param {string} text heading text | ||
878 | * @param {number | string} [level=1] (optional) the heading level, default: 1 | ||
879 | * | ||
880 | * @returns {Summary} summary instance | ||
881 | */ | ||
882 | addHeading(text, level) { | ||
883 | const tag = `h${level}`; | ||
884 | const allowedTag = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tag) | ||
885 | ? tag | ||
886 | : 'h1'; | ||
887 | const element = this.wrap(allowedTag, text); | ||
888 | return this.addRaw(element).addEOL(); | ||
889 | } | ||
890 | /** | ||
891 | * Adds an HTML thematic break (<hr>) to the summary buffer | ||
892 | * | ||
893 | * @returns {Summary} summary instance | ||
894 | */ | ||
895 | addSeparator() { | ||
896 | const element = this.wrap('hr', null); | ||
897 | return this.addRaw(element).addEOL(); | ||
898 | } | ||
899 | /** | ||
900 | * Adds an HTML line break (<br>) to the summary buffer | ||
901 | * | ||
902 | * @returns {Summary} summary instance | ||
903 | */ | ||
904 | addBreak() { | ||
905 | const element = this.wrap('br', null); | ||
906 | return this.addRaw(element).addEOL(); | ||
907 | } | ||
908 | /** | ||
909 | * Adds an HTML blockquote to the summary buffer | ||
910 | * | ||
911 | * @param {string} text quote text | ||
912 | * @param {string} cite (optional) citation url | ||
913 | * | ||
914 | * @returns {Summary} summary instance | ||
915 | */ | ||
916 | addQuote(text, cite) { | ||
917 | const attrs = Object.assign({}, (cite && { cite })); | ||
918 | const element = this.wrap('blockquote', text, attrs); | ||
919 | return this.addRaw(element).addEOL(); | ||
920 | } | ||
921 | /** | ||
922 | * Adds an HTML anchor tag to the summary buffer | ||
923 | * | ||
924 | * @param {string} text link text/content | ||
925 | * @param {string} href hyperlink | ||
926 | * | ||
927 | * @returns {Summary} summary instance | ||
928 | */ | ||
929 | addLink(text, href) { | ||
930 | const element = this.wrap('a', text, { href }); | ||
931 | return this.addRaw(element).addEOL(); | ||
932 | } | ||
933 | } | ||
934 | const _summary = new Summary(); | ||
935 | /** | ||
936 | * @deprecated use `core.summary` | ||
937 | */ | ||
938 | exports.markdownSummary = _summary; | ||
939 | exports.summary = _summary; | ||
940 | //# sourceMappingURL=summary.js.map | ||
941 | |||
942 | /***/ }), | ||
943 | |||
944 | /***/ 900: | ||
945 | /***/ ((__unused_webpack_module, exports) => { | ||
946 | |||
947 | |||
948 | // We use any as a valid input type | ||
949 | /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
950 | Object.defineProperty(exports, "__esModule", ({ value: true })); | ||
951 | exports.toCommandProperties = exports.toCommandValue = void 0; | ||
952 | /** | ||
953 | * Sanitizes an input into a string so it can be passed into issueCommand safely | ||
954 | * @param input input to sanitize into a string | ||
955 | */ | ||
956 | function toCommandValue(input) { | ||
957 | if (input === null || input === undefined) { | ||
958 | return ''; | ||
959 | } | ||
960 | else if (typeof input === 'string' || input instanceof String) { | ||
961 | return input; | ||
962 | } | ||
963 | return JSON.stringify(input); | ||
964 | } | ||
965 | exports.toCommandValue = toCommandValue; | ||
966 | /** | ||
967 | * | ||
968 | * @param annotationProperties | ||
969 | * @returns The command properties to send with the actual annotation command | ||
970 | * See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646 | ||
971 | */ | ||
972 | function toCommandProperties(annotationProperties) { | ||
973 | if (!Object.keys(annotationProperties).length) { | ||
974 | return {}; | ||
975 | } | ||
976 | return { | ||
977 | title: annotationProperties.title, | ||
978 | file: annotationProperties.file, | ||
979 | line: annotationProperties.startLine, | ||
980 | endLine: annotationProperties.endLine, | ||
981 | col: annotationProperties.startColumn, | ||
982 | endColumn: annotationProperties.endColumn | ||
983 | }; | ||
984 | } | ||
985 | exports.toCommandProperties = toCommandProperties; | ||
986 | //# sourceMappingURL=utils.js.map | ||
987 | |||
988 | /***/ }), | ||
989 | |||
990 | /***/ 82: | ||
991 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { | ||
992 | |||
993 | |||
994 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
995 | if (k2 === undefined) k2 = k; | ||
996 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
997 | }) : (function(o, m, k, k2) { | ||
998 | if (k2 === undefined) k2 = k; | ||
999 | o[k2] = m[k]; | ||
1000 | })); | ||
1001 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
1002 | Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
1003 | }) : function(o, v) { | ||
1004 | o["default"] = v; | ||
1005 | }); | ||
1006 | var __importStar = (this && this.__importStar) || function (mod) { | ||
1007 | if (mod && mod.__esModule) return mod; | ||
1008 | var result = {}; | ||
1009 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
1010 | __setModuleDefault(result, mod); | ||
1011 | return result; | ||
1012 | }; | ||
1013 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
1014 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
1015 | return new (P || (P = Promise))(function (resolve, reject) { | ||
1016 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
1017 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
1018 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
1019 | step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
1020 | }); | ||
1021 | }; | ||
1022 | Object.defineProperty(exports, "__esModule", ({ value: true })); | ||
1023 | exports.getExecOutput = exports.exec = void 0; | ||
1024 | const string_decoder_1 = __nccwpck_require__(576); | ||
1025 | const tr = __importStar(__nccwpck_require__(668)); | ||
1026 | /** | ||
1027 | * Exec a command. | ||
1028 | * Output will be streamed to the live console. | ||
1029 | * Returns promise with return code | ||
1030 | * | ||
1031 | * @param commandLine command to execute (can include additional args). Must be correctly escaped. | ||
1032 | * @param args optional arguments for tool. Escaping is handled by the lib. | ||
1033 | * @param options optional exec options. See ExecOptions | ||
1034 | * @returns Promise<number> exit code | ||
1035 | */ | ||
1036 | function exec(commandLine, args, options) { | ||
1037 | return __awaiter(this, void 0, void 0, function* () { | ||
1038 | const commandArgs = tr.argStringToArray(commandLine); | ||
1039 | if (commandArgs.length === 0) { | ||
1040 | throw new Error(`Parameter 'commandLine' cannot be null or empty.`); | ||
1041 | } | ||
1042 | // Path to tool to execute should be first arg | ||
1043 | const toolPath = commandArgs[0]; | ||
1044 | args = commandArgs.slice(1).concat(args || []); | ||
1045 | const runner = new tr.ToolRunner(toolPath, args, options); | ||
1046 | return runner.exec(); | ||
1047 | }); | ||
1048 | } | ||
1049 | exports.exec = exec; | ||
1050 | /** | ||
1051 | * Exec a command and get the output. | ||
1052 | * Output will be streamed to the live console. | ||
1053 | * Returns promise with the exit code and collected stdout and stderr | ||
1054 | * | ||
1055 | * @param commandLine command to execute (can include additional args). Must be correctly escaped. | ||
1056 | * @param args optional arguments for tool. Escaping is handled by the lib. | ||
1057 | * @param options optional exec options. See ExecOptions | ||
1058 | * @returns Promise<ExecOutput> exit code, stdout, and stderr | ||
1059 | */ | ||
1060 | function getExecOutput(commandLine, args, options) { | ||
1061 | var _a, _b; | ||
1062 | return __awaiter(this, void 0, void 0, function* () { | ||
1063 | let stdout = ''; | ||
1064 | let stderr = ''; | ||
1065 | //Using string decoder covers the case where a mult-byte character is split | ||
1066 | const stdoutDecoder = new string_decoder_1.StringDecoder('utf8'); | ||
1067 | const stderrDecoder = new string_decoder_1.StringDecoder('utf8'); | ||
1068 | const originalStdoutListener = (_a = options === null || options === void 0 ? void 0 : options.listeners) === null || _a === void 0 ? void 0 : _a.stdout; | ||
1069 | const originalStdErrListener = (_b = options === null || options === void 0 ? void 0 : options.listeners) === null || _b === void 0 ? void 0 : _b.stderr; | ||
1070 | const stdErrListener = (data) => { | ||
1071 | stderr += stderrDecoder.write(data); | ||
1072 | if (originalStdErrListener) { | ||
1073 | originalStdErrListener(data); | ||
1074 | } | ||
1075 | }; | ||
1076 | const stdOutListener = (data) => { | ||
1077 | stdout += stdoutDecoder.write(data); | ||
1078 | if (originalStdoutListener) { | ||
1079 | originalStdoutListener(data); | ||
1080 | } | ||
1081 | }; | ||
1082 | const listeners = Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.listeners), { stdout: stdOutListener, stderr: stdErrListener }); | ||
1083 | const exitCode = yield exec(commandLine, args, Object.assign(Object.assign({}, options), { listeners })); | ||
1084 | //flush any remaining characters | ||
1085 | stdout += stdoutDecoder.end(); | ||
1086 | stderr += stderrDecoder.end(); | ||
1087 | return { | ||
1088 | exitCode, | ||
1089 | stdout, | ||
1090 | stderr | ||
1091 | }; | ||
1092 | }); | ||
1093 | } | ||
1094 | exports.getExecOutput = getExecOutput; | ||
1095 | //# sourceMappingURL=exec.js.map | ||
1096 | |||
1097 | /***/ }), | ||
1098 | |||
1099 | /***/ 668: | ||
1100 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { | ||
1101 | |||
1102 | |||
1103 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
1104 | if (k2 === undefined) k2 = k; | ||
1105 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
1106 | }) : (function(o, m, k, k2) { | ||
1107 | if (k2 === undefined) k2 = k; | ||
1108 | o[k2] = m[k]; | ||
1109 | })); | ||
1110 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
1111 | Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
1112 | }) : function(o, v) { | ||
1113 | o["default"] = v; | ||
1114 | }); | ||
1115 | var __importStar = (this && this.__importStar) || function (mod) { | ||
1116 | if (mod && mod.__esModule) return mod; | ||
1117 | var result = {}; | ||
1118 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
1119 | __setModuleDefault(result, mod); | ||
1120 | return result; | ||
1121 | }; | ||
1122 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
1123 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
1124 | return new (P || (P = Promise))(function (resolve, reject) { | ||
1125 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
1126 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
1127 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
1128 | step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
1129 | }); | ||
1130 | }; | ||
1131 | Object.defineProperty(exports, "__esModule", ({ value: true })); | ||
1132 | exports.argStringToArray = exports.ToolRunner = void 0; | ||
1133 | const os = __importStar(__nccwpck_require__(37)); | ||
1134 | const events = __importStar(__nccwpck_require__(361)); | ||
1135 | const child = __importStar(__nccwpck_require__(81)); | ||
1136 | const path = __importStar(__nccwpck_require__(17)); | ||
1137 | const io = __importStar(__nccwpck_require__(157)); | ||
1138 | const ioUtil = __importStar(__nccwpck_require__(498)); | ||
1139 | const timers_1 = __nccwpck_require__(512); | ||
1140 | /* eslint-disable @typescript-eslint/unbound-method */ | ||
1141 | const IS_WINDOWS = process.platform === 'win32'; | ||
1142 | /* | ||
1143 | * Class for running command line tools. Handles quoting and arg parsing in a platform agnostic way. | ||
1144 | */ | ||
1145 | class ToolRunner extends events.EventEmitter { | ||
1146 | constructor(toolPath, args, options) { | ||
1147 | super(); | ||
1148 | if (!toolPath) { | ||
1149 | throw new Error("Parameter 'toolPath' cannot be null or empty."); | ||
1150 | } | ||
1151 | this.toolPath = toolPath; | ||
1152 | this.args = args || []; | ||
1153 | this.options = options || {}; | ||
1154 | } | ||
1155 | _debug(message) { | ||
1156 | if (this.options.listeners && this.options.listeners.debug) { | ||
1157 | this.options.listeners.debug(message); | ||
1158 | } | ||
1159 | } | ||
1160 | _getCommandString(options, noPrefix) { | ||
1161 | const toolPath = this._getSpawnFileName(); | ||
1162 | const args = this._getSpawnArgs(options); | ||
1163 | let cmd = noPrefix ? '' : '[command]'; // omit prefix when piped to a second tool | ||
1164 | if (IS_WINDOWS) { | ||
1165 | // Windows + cmd file | ||
1166 | if (this._isCmdFile()) { | ||
1167 | cmd += toolPath; | ||
1168 | for (const a of args) { | ||
1169 | cmd += ` ${a}`; | ||
1170 | } | ||
1171 | } | ||
1172 | // Windows + verbatim | ||
1173 | else if (options.windowsVerbatimArguments) { | ||
1174 | cmd += `"${toolPath}"`; | ||
1175 | for (const a of args) { | ||
1176 | cmd += ` ${a}`; | ||
1177 | } | ||
1178 | } | ||
1179 | // Windows (regular) | ||
1180 | else { | ||
1181 | cmd += this._windowsQuoteCmdArg(toolPath); | ||
1182 | for (const a of args) { | ||
1183 | cmd += ` ${this._windowsQuoteCmdArg(a)}`; | ||
1184 | } | ||
1185 | } | ||
1186 | } | ||
1187 | else { | ||
1188 | // OSX/Linux - this can likely be improved with some form of quoting. | ||
1189 | // creating processes on Unix is fundamentally different than Windows. | ||
1190 | // on Unix, execvp() takes an arg array. | ||
1191 | cmd += toolPath; | ||
1192 | for (const a of args) { | ||
1193 | cmd += ` ${a}`; | ||
1194 | } | ||
1195 | } | ||
1196 | return cmd; | ||
1197 | } | ||
1198 | _processLineBuffer(data, strBuffer, onLine) { | ||
1199 | try { | ||
1200 | let s = strBuffer + data.toString(); | ||
1201 | let n = s.indexOf(os.EOL); | ||
1202 | while (n > -1) { | ||
1203 | const line = s.substring(0, n); | ||
1204 | onLine(line); | ||
1205 | // the rest of the string ... | ||
1206 | s = s.substring(n + os.EOL.length); | ||
1207 | n = s.indexOf(os.EOL); | ||
1208 | } | ||
1209 | return s; | ||
1210 | } | ||
1211 | catch (err) { | ||
1212 | // streaming lines to console is best effort. Don't fail a build. | ||
1213 | this._debug(`error processing line. Failed with error ${err}`); | ||
1214 | return ''; | ||
1215 | } | ||
1216 | } | ||
1217 | _getSpawnFileName() { | ||
1218 | if (IS_WINDOWS) { | ||
1219 | if (this._isCmdFile()) { | ||
1220 | return process.env['COMSPEC'] || 'cmd.exe'; | ||
1221 | } | ||
1222 | } | ||
1223 | return this.toolPath; | ||
1224 | } | ||
1225 | _getSpawnArgs(options) { | ||
1226 | if (IS_WINDOWS) { | ||
1227 | if (this._isCmdFile()) { | ||
1228 | let argline = `/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`; | ||
1229 | for (const a of this.args) { | ||
1230 | argline += ' '; | ||
1231 | argline += options.windowsVerbatimArguments | ||
1232 | ? a | ||
1233 | : this._windowsQuoteCmdArg(a); | ||
1234 | } | ||
1235 | argline += '"'; | ||
1236 | return [argline]; | ||
1237 | } | ||
1238 | } | ||
1239 | return this.args; | ||
1240 | } | ||
1241 | _endsWith(str, end) { | ||
1242 | return str.endsWith(end); | ||
1243 | } | ||
1244 | _isCmdFile() { | ||
1245 | const upperToolPath = this.toolPath.toUpperCase(); | ||
1246 | return (this._endsWith(upperToolPath, '.CMD') || | ||
1247 | this._endsWith(upperToolPath, '.BAT')); | ||
1248 | } | ||
1249 | _windowsQuoteCmdArg(arg) { | ||
1250 | // for .exe, apply the normal quoting rules that libuv applies | ||
1251 | if (!this._isCmdFile()) { | ||
1252 | return this._uvQuoteCmdArg(arg); | ||
1253 | } | ||
1254 | // otherwise apply quoting rules specific to the cmd.exe command line parser. | ||
1255 | // the libuv rules are generic and are not designed specifically for cmd.exe | ||
1256 | // command line parser. | ||
1257 | // | ||
1258 | // for a detailed description of the cmd.exe command line parser, refer to | ||
1259 | // http://stackoverflow.com/questions/4094699/how-does-the-windows-command-interpreter-cmd-exe-parse-scripts/7970912#7970912 | ||
1260 | // need quotes for empty arg | ||
1261 | if (!arg) { | ||
1262 | return '""'; | ||
1263 | } | ||
1264 | // determine whether the arg needs to be quoted | ||
1265 | const cmdSpecialChars = [ | ||
1266 | ' ', | ||
1267 | '\t', | ||
1268 | '&', | ||
1269 | '(', | ||
1270 | ')', | ||
1271 | '[', | ||
1272 | ']', | ||
1273 | '{', | ||
1274 | '}', | ||
1275 | '^', | ||
1276 | '=', | ||
1277 | ';', | ||
1278 | '!', | ||
1279 | "'", | ||
1280 | '+', | ||
1281 | ',', | ||
1282 | '`', | ||
1283 | '~', | ||
1284 | '|', | ||
1285 | '<', | ||
1286 | '>', | ||
1287 | '"' | ||
1288 | ]; | ||
1289 | let needsQuotes = false; | ||
1290 | for (const char of arg) { | ||
1291 | if (cmdSpecialChars.some(x => x === char)) { | ||
1292 | needsQuotes = true; | ||
1293 | break; | ||
1294 | } | ||
1295 | } | ||
1296 | // short-circuit if quotes not needed | ||
1297 | if (!needsQuotes) { | ||
1298 | return arg; | ||
1299 | } | ||
1300 | // the following quoting rules are very similar to the rules that by libuv applies. | ||
1301 | // | ||
1302 | // 1) wrap the string in quotes | ||
1303 | // | ||
1304 | // 2) double-up quotes - i.e. " => "" | ||
1305 | // | ||
1306 | // this is different from the libuv quoting rules. libuv replaces " with \", which unfortunately | ||
1307 | // doesn't work well with a cmd.exe command line. | ||
1308 | // | ||
1309 | // note, replacing " with "" also works well if the arg is passed to a downstream .NET console app. | ||
1310 | // for example, the command line: | ||
1311 | // foo.exe "myarg:""my val""" | ||
1312 | // is parsed by a .NET console app into an arg array: | ||
1313 | // [ "myarg:\"my val\"" ] | ||
1314 | // which is the same end result when applying libuv quoting rules. although the actual | ||
1315 | // command line from libuv quoting rules would look like: | ||
1316 | // foo.exe "myarg:\"my val\"" | ||
1317 | // | ||
1318 | // 3) double-up slashes that precede a quote, | ||
1319 | // e.g. hello \world => "hello \world" | ||
1320 | // hello\"world => "hello\\""world" | ||
1321 | // hello\\"world => "hello\\\\""world" | ||
1322 | // hello world\ => "hello world\\" | ||
1323 | // | ||
1324 | // technically this is not required for a cmd.exe command line, or the batch argument parser. | ||
1325 | // the reasons for including this as a .cmd quoting rule are: | ||
1326 | // | ||
1327 | // a) this is optimized for the scenario where the argument is passed from the .cmd file to an | ||
1328 | // external program. many programs (e.g. .NET console apps) rely on the slash-doubling rule. | ||
1329 | // | ||
1330 | // b) it's what we've been doing previously (by deferring to node default behavior) and we | ||
1331 | // haven't heard any complaints about that aspect. | ||
1332 | // | ||
1333 | // note, a weakness of the quoting rules chosen here, is that % is not escaped. in fact, % cannot be | ||
1334 | // escaped when used on the command line directly - even though within a .cmd file % can be escaped | ||
1335 | // by using %%. | ||
1336 | // | ||
1337 | // the saving grace is, on the command line, %var% is left as-is if var is not defined. this contrasts | ||
1338 | // the line parsing rules within a .cmd file, where if var is not defined it is replaced with nothing. | ||
1339 | // | ||
1340 | // one option that was explored was replacing % with ^% - i.e. %var% => ^%var^%. this hack would | ||
1341 | // often work, since it is unlikely that var^ would exist, and the ^ character is removed when the | ||
1342 | // variable is used. the problem, however, is that ^ is not removed when %* is used to pass the args | ||
1343 | // to an external program. | ||
1344 | // | ||
1345 | // an unexplored potential solution for the % escaping problem, is to create a wrapper .cmd file. | ||
1346 | // % can be escaped within a .cmd file. | ||
1347 | let reverse = '"'; | ||
1348 | let quoteHit = true; | ||
1349 | for (let i = arg.length; i > 0; i--) { | ||
1350 | // walk the string in reverse | ||
1351 | reverse += arg[i - 1]; | ||
1352 | if (quoteHit && arg[i - 1] === '\\') { | ||
1353 | reverse += '\\'; // double the slash | ||
1354 | } | ||
1355 | else if (arg[i - 1] === '"') { | ||
1356 | quoteHit = true; | ||
1357 | reverse += '"'; // double the quote | ||
1358 | } | ||
1359 | else { | ||
1360 | quoteHit = false; | ||
1361 | } | ||
1362 | } | ||
1363 | reverse += '"'; | ||
1364 | return reverse | ||
1365 | .split('') | ||
1366 | .reverse() | ||
1367 | .join(''); | ||
1368 | } | ||
1369 | _uvQuoteCmdArg(arg) { | ||
1370 | // Tool runner wraps child_process.spawn() and needs to apply the same quoting as | ||
1371 | // Node in certain cases where the undocumented spawn option windowsVerbatimArguments | ||
1372 | // is used. | ||
1373 | // | ||
1374 | // Since this function is a port of quote_cmd_arg from Node 4.x (technically, lib UV, | ||
1375 | // see https://github.com/nodejs/node/blob/v4.x/deps/uv/src/win/process.c for details), | ||
1376 | // pasting copyright notice from Node within this function: | ||
1377 | // | ||
1378 | // Copyright Joyent, Inc. and other Node contributors. All rights reserved. | ||
1379 | // | ||
1380 | // Permission is hereby granted, free of charge, to any person obtaining a copy | ||
1381 | // of this software and associated documentation files (the "Software"), to | ||
1382 | // deal in the Software without restriction, including without limitation the | ||
1383 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | ||
1384 | // sell copies of the Software, and to permit persons to whom the Software is | ||
1385 | // furnished to do so, subject to the following conditions: | ||
1386 | // | ||
1387 | // The above copyright notice and this permission notice shall be included in | ||
1388 | // all copies or substantial portions of the Software. | ||
1389 | // | ||
1390 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
1391 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
1392 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
1393 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
1394 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
1395 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
1396 | // IN THE SOFTWARE. | ||
1397 | if (!arg) { | ||
1398 | // Need double quotation for empty argument | ||
1399 | return '""'; | ||
1400 | } | ||
1401 | if (!arg.includes(' ') && !arg.includes('\t') && !arg.includes('"')) { | ||
1402 | // No quotation needed | ||
1403 | return arg; | ||
1404 | } | ||
1405 | if (!arg.includes('"') && !arg.includes('\\')) { | ||
1406 | // No embedded double quotes or backslashes, so I can just wrap | ||
1407 | // quote marks around the whole thing. | ||
1408 | return `"${arg}"`; | ||
1409 | } | ||
1410 | // Expected input/output: | ||
1411 | // input : hello"world | ||
1412 | // output: "hello\"world" | ||
1413 | // input : hello""world | ||
1414 | // output: "hello\"\"world" | ||
1415 | // input : hello\world | ||
1416 | // output: hello\world | ||
1417 | // input : hello\\world | ||
1418 | // output: hello\\world | ||
1419 | // input : hello\"world | ||
1420 | // output: "hello\\\"world" | ||
1421 | // input : hello\\"world | ||
1422 | // output: "hello\\\\\"world" | ||
1423 | // input : hello world\ | ||
1424 | // output: "hello world\\" - note the comment in libuv actually reads "hello world\" | ||
1425 | // but it appears the comment is wrong, it should be "hello world\\" | ||
1426 | let reverse = '"'; | ||
1427 | let quoteHit = true; | ||
1428 | for (let i = arg.length; i > 0; i--) { | ||
1429 | // walk the string in reverse | ||
1430 | reverse += arg[i - 1]; | ||
1431 | if (quoteHit && arg[i - 1] === '\\') { | ||
1432 | reverse += '\\'; | ||
1433 | } | ||
1434 | else if (arg[i - 1] === '"') { | ||
1435 | quoteHit = true; | ||
1436 | reverse += '\\'; | ||
1437 | } | ||
1438 | else { | ||
1439 | quoteHit = false; | ||
1440 | } | ||
1441 | } | ||
1442 | reverse += '"'; | ||
1443 | return reverse | ||
1444 | .split('') | ||
1445 | .reverse() | ||
1446 | .join(''); | ||
1447 | } | ||
1448 | _cloneExecOptions(options) { | ||
1449 | options = options || {}; | ||
1450 | const result = { | ||
1451 | cwd: options.cwd || process.cwd(), | ||
1452 | env: options.env || process.env, | ||
1453 | silent: options.silent || false, | ||
1454 | windowsVerbatimArguments: options.windowsVerbatimArguments || false, | ||
1455 | failOnStdErr: options.failOnStdErr || false, | ||
1456 | ignoreReturnCode: options.ignoreReturnCode || false, | ||
1457 | delay: options.delay || 10000 | ||
1458 | }; | ||
1459 | result.outStream = options.outStream || process.stdout; | ||
1460 | result.errStream = options.errStream || process.stderr; | ||
1461 | return result; | ||
1462 | } | ||
1463 | _getSpawnOptions(options, toolPath) { | ||
1464 | options = options || {}; | ||
1465 | const result = {}; | ||
1466 | result.cwd = options.cwd; | ||
1467 | result.env = options.env; | ||
1468 | result['windowsVerbatimArguments'] = | ||
1469 | options.windowsVerbatimArguments || this._isCmdFile(); | ||
1470 | if (options.windowsVerbatimArguments) { | ||
1471 | result.argv0 = `"${toolPath}"`; | ||
1472 | } | ||
1473 | return result; | ||
1474 | } | ||
1475 | /** | ||
1476 | * Exec a tool. | ||
1477 | * Output will be streamed to the live console. | ||
1478 | * Returns promise with return code | ||
1479 | * | ||
1480 | * @param tool path to tool to exec | ||
1481 | * @param options optional exec options. See ExecOptions | ||
1482 | * @returns number | ||
1483 | */ | ||
1484 | exec() { | ||
1485 | return __awaiter(this, void 0, void 0, function* () { | ||
1486 | // root the tool path if it is unrooted and contains relative pathing | ||
1487 | if (!ioUtil.isRooted(this.toolPath) && | ||
1488 | (this.toolPath.includes('/') || | ||
1489 | (IS_WINDOWS && this.toolPath.includes('\\')))) { | ||
1490 | // prefer options.cwd if it is specified, however options.cwd may also need to be rooted | ||
1491 | this.toolPath = path.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath); | ||
1492 | } | ||
1493 | // if the tool is only a file name, then resolve it from the PATH | ||
1494 | // otherwise verify it exists (add extension on Windows if necessary) | ||
1495 | this.toolPath = yield io.which(this.toolPath, true); | ||
1496 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { | ||
1497 | this._debug(`exec tool: ${this.toolPath}`); | ||
1498 | this._debug('arguments:'); | ||
1499 | for (const arg of this.args) { | ||
1500 | this._debug(` ${arg}`); | ||
1501 | } | ||
1502 | const optionsNonNull = this._cloneExecOptions(this.options); | ||
1503 | if (!optionsNonNull.silent && optionsNonNull.outStream) { | ||
1504 | optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL); | ||
1505 | } | ||
1506 | const state = new ExecState(optionsNonNull, this.toolPath); | ||
1507 | state.on('debug', (message) => { | ||
1508 | this._debug(message); | ||
1509 | }); | ||
1510 | if (this.options.cwd && !(yield ioUtil.exists(this.options.cwd))) { | ||
1511 | return reject(new Error(`The cwd: ${this.options.cwd} does not exist!`)); | ||
1512 | } | ||
1513 | const fileName = this._getSpawnFileName(); | ||
1514 | const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName)); | ||
1515 | let stdbuffer = ''; | ||
1516 | if (cp.stdout) { | ||
1517 | cp.stdout.on('data', (data) => { | ||
1518 | if (this.options.listeners && this.options.listeners.stdout) { | ||
1519 | this.options.listeners.stdout(data); | ||
1520 | } | ||
1521 | if (!optionsNonNull.silent && optionsNonNull.outStream) { | ||
1522 | optionsNonNull.outStream.write(data); | ||
1523 | } | ||
1524 | stdbuffer = this._processLineBuffer(data, stdbuffer, (line) => { | ||
1525 | if (this.options.listeners && this.options.listeners.stdline) { | ||
1526 | this.options.listeners.stdline(line); | ||
1527 | } | ||
1528 | }); | ||
1529 | }); | ||
1530 | } | ||
1531 | let errbuffer = ''; | ||
1532 | if (cp.stderr) { | ||
1533 | cp.stderr.on('data', (data) => { | ||
1534 | state.processStderr = true; | ||
1535 | if (this.options.listeners && this.options.listeners.stderr) { | ||
1536 | this.options.listeners.stderr(data); | ||
1537 | } | ||
1538 | if (!optionsNonNull.silent && | ||
1539 | optionsNonNull.errStream && | ||
1540 | optionsNonNull.outStream) { | ||
1541 | const s = optionsNonNull.failOnStdErr | ||
1542 | ? optionsNonNull.errStream | ||
1543 | : optionsNonNull.outStream; | ||
1544 | s.write(data); | ||
1545 | } | ||
1546 | errbuffer = this._processLineBuffer(data, errbuffer, (line) => { | ||
1547 | if (this.options.listeners && this.options.listeners.errline) { | ||
1548 | this.options.listeners.errline(line); | ||
1549 | } | ||
1550 | }); | ||
1551 | }); | ||
1552 | } | ||
1553 | cp.on('error', (err) => { | ||
1554 | state.processError = err.message; | ||
1555 | state.processExited = true; | ||
1556 | state.processClosed = true; | ||
1557 | state.CheckComplete(); | ||
1558 | }); | ||
1559 | cp.on('exit', (code) => { | ||
1560 | state.processExitCode = code; | ||
1561 | state.processExited = true; | ||
1562 | this._debug(`Exit code ${code} received from tool '${this.toolPath}'`); | ||
1563 | state.CheckComplete(); | ||
1564 | }); | ||
1565 | cp.on('close', (code) => { | ||
1566 | state.processExitCode = code; | ||
1567 | state.processExited = true; | ||
1568 | state.processClosed = true; | ||
1569 | this._debug(`STDIO streams have closed for tool '${this.toolPath}'`); | ||
1570 | state.CheckComplete(); | ||
1571 | }); | ||
1572 | state.on('done', (error, exitCode) => { | ||
1573 | if (stdbuffer.length > 0) { | ||
1574 | this.emit('stdline', stdbuffer); | ||
1575 | } | ||
1576 | if (errbuffer.length > 0) { | ||
1577 | this.emit('errline', errbuffer); | ||
1578 | } | ||
1579 | cp.removeAllListeners(); | ||
1580 | if (error) { | ||
1581 | reject(error); | ||
1582 | } | ||
1583 | else { | ||
1584 | resolve(exitCode); | ||
1585 | } | ||
1586 | }); | ||
1587 | if (this.options.input) { | ||
1588 | if (!cp.stdin) { | ||
1589 | throw new Error('child process missing stdin'); | ||
1590 | } | ||
1591 | cp.stdin.end(this.options.input); | ||
1592 | } | ||
1593 | })); | ||
1594 | }); | ||
1595 | } | ||
1596 | } | ||
1597 | exports.ToolRunner = ToolRunner; | ||
1598 | /** | ||
1599 | * Convert an arg string to an array of args. Handles escaping | ||
1600 | * | ||
1601 | * @param argString string of arguments | ||
1602 | * @returns string[] array of arguments | ||
1603 | */ | ||
1604 | function argStringToArray(argString) { | ||
1605 | const args = []; | ||
1606 | let inQuotes = false; | ||
1607 | let escaped = false; | ||
1608 | let arg = ''; | ||
1609 | function append(c) { | ||
1610 | // we only escape double quotes. | ||
1611 | if (escaped && c !== '"') { | ||
1612 | arg += '\\'; | ||
1613 | } | ||
1614 | arg += c; | ||
1615 | escaped = false; | ||
1616 | } | ||
1617 | for (let i = 0; i < argString.length; i++) { | ||
1618 | const c = argString.charAt(i); | ||
1619 | if (c === '"') { | ||
1620 | if (!escaped) { | ||
1621 | inQuotes = !inQuotes; | ||
1622 | } | ||
1623 | else { | ||
1624 | append(c); | ||
1625 | } | ||
1626 | continue; | ||
1627 | } | ||
1628 | if (c === '\\' && escaped) { | ||
1629 | append(c); | ||
1630 | continue; | ||
1631 | } | ||
1632 | if (c === '\\' && inQuotes) { | ||
1633 | escaped = true; | ||
1634 | continue; | ||
1635 | } | ||
1636 | if (c === ' ' && !inQuotes) { | ||
1637 | if (arg.length > 0) { | ||
1638 | args.push(arg); | ||
1639 | arg = ''; | ||
1640 | } | ||
1641 | continue; | ||
1642 | } | ||
1643 | append(c); | ||
1644 | } | ||
1645 | if (arg.length > 0) { | ||
1646 | args.push(arg.trim()); | ||
1647 | } | ||
1648 | return args; | ||
1649 | } | ||
1650 | exports.argStringToArray = argStringToArray; | ||
1651 | class ExecState extends events.EventEmitter { | ||
1652 | constructor(options, toolPath) { | ||
1653 | super(); | ||
1654 | this.processClosed = false; // tracks whether the process has exited and stdio is closed | ||
1655 | this.processError = ''; | ||
1656 | this.processExitCode = 0; | ||
1657 | this.processExited = false; // tracks whether the process has exited | ||
1658 | this.processStderr = false; // tracks whether stderr was written to | ||
1659 | this.delay = 10000; // 10 seconds | ||
1660 | this.done = false; | ||
1661 | this.timeout = null; | ||
1662 | if (!toolPath) { | ||
1663 | throw new Error('toolPath must not be empty'); | ||
1664 | } | ||
1665 | this.options = options; | ||
1666 | this.toolPath = toolPath; | ||
1667 | if (options.delay) { | ||
1668 | this.delay = options.delay; | ||
1669 | } | ||
1670 | } | ||
1671 | CheckComplete() { | ||
1672 | if (this.done) { | ||
1673 | return; | ||
1674 | } | ||
1675 | if (this.processClosed) { | ||
1676 | this._setResult(); | ||
1677 | } | ||
1678 | else if (this.processExited) { | ||
1679 | this.timeout = timers_1.setTimeout(ExecState.HandleTimeout, this.delay, this); | ||
1680 | } | ||
1681 | } | ||
1682 | _debug(message) { | ||
1683 | this.emit('debug', message); | ||
1684 | } | ||
1685 | _setResult() { | ||
1686 | // determine whether there is an error | ||
1687 | let error; | ||
1688 | if (this.processExited) { | ||
1689 | if (this.processError) { | ||
1690 | error = new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`); | ||
1691 | } | ||
1692 | else if (this.processExitCode !== 0 && !this.options.ignoreReturnCode) { | ||
1693 | error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`); | ||
1694 | } | ||
1695 | else if (this.processStderr && this.options.failOnStdErr) { | ||
1696 | error = new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`); | ||
1697 | } | ||
1698 | } | ||
1699 | // clear the timeout | ||
1700 | if (this.timeout) { | ||
1701 | clearTimeout(this.timeout); | ||
1702 | this.timeout = null; | ||
1703 | } | ||
1704 | this.done = true; | ||
1705 | this.emit('done', error, this.processExitCode); | ||
1706 | } | ||
1707 | static HandleTimeout(state) { | ||
1708 | if (state.done) { | ||
1709 | return; | ||
1710 | } | ||
1711 | if (!state.processClosed && state.processExited) { | ||
1712 | const message = `The STDIO streams did not close within ${state.delay / | ||
1713 | 1000} seconds of the exit event from process '${state.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`; | ||
1714 | state._debug(message); | ||
1715 | } | ||
1716 | state._setResult(); | ||
1717 | } | ||
1718 | } | ||
1719 | //# sourceMappingURL=toolrunner.js.map | ||
1720 | |||
1721 | /***/ }), | ||
1722 | |||
1723 | /***/ 336: | ||
1724 | /***/ (function(__unused_webpack_module, exports) { | ||
1725 | |||
1726 | |||
1727 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
1728 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
1729 | return new (P || (P = Promise))(function (resolve, reject) { | ||
1730 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
1731 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
1732 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
1733 | step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
1734 | }); | ||
1735 | }; | ||
1736 | Object.defineProperty(exports, "__esModule", ({ value: true })); | ||
1737 | exports.PersonalAccessTokenCredentialHandler = exports.BearerCredentialHandler = exports.BasicCredentialHandler = void 0; | ||
1738 | class BasicCredentialHandler { | ||
1739 | constructor(username, password) { | ||
1740 | this.username = username; | ||
1741 | this.password = password; | ||
1742 | } | ||
1743 | prepareRequest(options) { | ||
1744 | if (!options.headers) { | ||
1745 | throw Error('The request has no headers'); | ||
1746 | } | ||
1747 | options.headers['Authorization'] = `Basic ${Buffer.from(`${this.username}:${this.password}`).toString('base64')}`; | ||
1748 | } | ||
1749 | // This handler cannot handle 401 | ||
1750 | canHandleAuthentication() { | ||
1751 | return false; | ||
1752 | } | ||
1753 | handleAuthentication() { | ||
1754 | return __awaiter(this, void 0, void 0, function* () { | ||
1755 | throw new Error('not implemented'); | ||
1756 | }); | ||
1757 | } | ||
1758 | } | ||
1759 | exports.BasicCredentialHandler = BasicCredentialHandler; | ||
1760 | class BearerCredentialHandler { | ||
1761 | constructor(token) { | ||
1762 | this.token = token; | ||
1763 | } | ||
1764 | // currently implements pre-authorization | ||
1765 | // TODO: support preAuth = false where it hooks on 401 | ||
1766 | prepareRequest(options) { | ||
1767 | if (!options.headers) { | ||
1768 | throw Error('The request has no headers'); | ||
1769 | } | ||
1770 | options.headers['Authorization'] = `Bearer ${this.token}`; | ||
1771 | } | ||
1772 | // This handler cannot handle 401 | ||
1773 | canHandleAuthentication() { | ||
1774 | return false; | ||
1775 | } | ||
1776 | handleAuthentication() { | ||
1777 | return __awaiter(this, void 0, void 0, function* () { | ||
1778 | throw new Error('not implemented'); | ||
1779 | }); | ||
1780 | } | ||
1781 | } | ||
1782 | exports.BearerCredentialHandler = BearerCredentialHandler; | ||
1783 | class PersonalAccessTokenCredentialHandler { | ||
1784 | constructor(token) { | ||
1785 | this.token = token; | ||
1786 | } | ||
1787 | // currently implements pre-authorization | ||
1788 | // TODO: support preAuth = false where it hooks on 401 | ||
1789 | prepareRequest(options) { | ||
1790 | if (!options.headers) { | ||
1791 | throw Error('The request has no headers'); | ||
1792 | } | ||
1793 | options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`; | ||
1794 | } | ||
1795 | // This handler cannot handle 401 | ||
1796 | canHandleAuthentication() { | ||
1797 | return false; | ||
1798 | } | ||
1799 | handleAuthentication() { | ||
1800 | return __awaiter(this, void 0, void 0, function* () { | ||
1801 | throw new Error('not implemented'); | ||
1802 | }); | ||
1803 | } | ||
1804 | } | ||
1805 | exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler; | ||
1806 | //# sourceMappingURL=auth.js.map | ||
1807 | |||
1808 | /***/ }), | ||
1809 | |||
1810 | /***/ 706: | ||
1811 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { | ||
1812 | |||
1813 | |||
1814 | /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
1815 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
1816 | if (k2 === undefined) k2 = k; | ||
1817 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
1818 | }) : (function(o, m, k, k2) { | ||
1819 | if (k2 === undefined) k2 = k; | ||
1820 | o[k2] = m[k]; | ||
1821 | })); | ||
1822 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
1823 | Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
1824 | }) : function(o, v) { | ||
1825 | o["default"] = v; | ||
1826 | }); | ||
1827 | var __importStar = (this && this.__importStar) || function (mod) { | ||
1828 | if (mod && mod.__esModule) return mod; | ||
1829 | var result = {}; | ||
1830 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
1831 | __setModuleDefault(result, mod); | ||
1832 | return result; | ||
1833 | }; | ||
1834 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
1835 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
1836 | return new (P || (P = Promise))(function (resolve, reject) { | ||
1837 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
1838 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
1839 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
1840 | step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
1841 | }); | ||
1842 | }; | ||
1843 | Object.defineProperty(exports, "__esModule", ({ value: true })); | ||
1844 | exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0; | ||
1845 | const http = __importStar(__nccwpck_require__(685)); | ||
1846 | const https = __importStar(__nccwpck_require__(687)); | ||
1847 | const pm = __importStar(__nccwpck_require__(531)); | ||
1848 | const tunnel = __importStar(__nccwpck_require__(125)); | ||
1849 | var HttpCodes; | ||
1850 | (function (HttpCodes) { | ||
1851 | HttpCodes[HttpCodes["OK"] = 200] = "OK"; | ||
1852 | HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices"; | ||
1853 | HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently"; | ||
1854 | HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved"; | ||
1855 | HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther"; | ||
1856 | HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified"; | ||
1857 | HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy"; | ||
1858 | HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy"; | ||
1859 | HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect"; | ||
1860 | HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect"; | ||
1861 | HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest"; | ||
1862 | HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized"; | ||
1863 | HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired"; | ||
1864 | HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden"; | ||
1865 | HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound"; | ||
1866 | HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed"; | ||
1867 | HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable"; | ||
1868 | HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; | ||
1869 | HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout"; | ||
1870 | HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict"; | ||
1871 | HttpCodes[HttpCodes["Gone"] = 410] = "Gone"; | ||
1872 | HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests"; | ||
1873 | HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError"; | ||
1874 | HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented"; | ||
1875 | HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway"; | ||
1876 | HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable"; | ||
1877 | HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout"; | ||
1878 | })(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {})); | ||
1879 | var Headers; | ||
1880 | (function (Headers) { | ||
1881 | Headers["Accept"] = "accept"; | ||
1882 | Headers["ContentType"] = "content-type"; | ||
1883 | })(Headers = exports.Headers || (exports.Headers = {})); | ||
1884 | var MediaTypes; | ||
1885 | (function (MediaTypes) { | ||
1886 | MediaTypes["ApplicationJson"] = "application/json"; | ||
1887 | })(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {})); | ||
1888 | /** | ||
1889 | * Returns the proxy URL, depending upon the supplied url and proxy environment variables. | ||
1890 | * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com | ||
1891 | */ | ||
1892 | function getProxyUrl(serverUrl) { | ||
1893 | const proxyUrl = pm.getProxyUrl(new URL(serverUrl)); | ||
1894 | return proxyUrl ? proxyUrl.href : ''; | ||
1895 | } | ||
1896 | exports.getProxyUrl = getProxyUrl; | ||
1897 | const HttpRedirectCodes = [ | ||
1898 | HttpCodes.MovedPermanently, | ||
1899 | HttpCodes.ResourceMoved, | ||
1900 | HttpCodes.SeeOther, | ||
1901 | HttpCodes.TemporaryRedirect, | ||
1902 | HttpCodes.PermanentRedirect | ||
1903 | ]; | ||
1904 | const HttpResponseRetryCodes = [ | ||
1905 | HttpCodes.BadGateway, | ||
1906 | HttpCodes.ServiceUnavailable, | ||
1907 | HttpCodes.GatewayTimeout | ||
1908 | ]; | ||
1909 | const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD']; | ||
1910 | const ExponentialBackoffCeiling = 10; | ||
1911 | const ExponentialBackoffTimeSlice = 5; | ||
1912 | class HttpClientError extends Error { | ||
1913 | constructor(message, statusCode) { | ||
1914 | super(message); | ||
1915 | this.name = 'HttpClientError'; | ||
1916 | this.statusCode = statusCode; | ||
1917 | Object.setPrototypeOf(this, HttpClientError.prototype); | ||
1918 | } | ||
1919 | } | ||
1920 | exports.HttpClientError = HttpClientError; | ||
1921 | class HttpClientResponse { | ||
1922 | constructor(message) { | ||
1923 | this.message = message; | ||
1924 | } | ||
1925 | readBody() { | ||
1926 | return __awaiter(this, void 0, void 0, function* () { | ||
1927 | return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () { | ||
1928 | let output = Buffer.alloc(0); | ||
1929 | this.message.on('data', (chunk) => { | ||
1930 | output = Buffer.concat([output, chunk]); | ||
1931 | }); | ||
1932 | this.message.on('end', () => { | ||
1933 | resolve(output.toString()); | ||
1934 | }); | ||
1935 | })); | ||
1936 | }); | ||
1937 | } | ||
1938 | } | ||
1939 | exports.HttpClientResponse = HttpClientResponse; | ||
1940 | function isHttps(requestUrl) { | ||
1941 | const parsedUrl = new URL(requestUrl); | ||
1942 | return parsedUrl.protocol === 'https:'; | ||
1943 | } | ||
1944 | exports.isHttps = isHttps; | ||
1945 | class HttpClient { | ||
1946 | constructor(userAgent, handlers, requestOptions) { | ||
1947 | this._ignoreSslError = false; | ||
1948 | this._allowRedirects = true; | ||
1949 | this._allowRedirectDowngrade = false; | ||
1950 | this._maxRedirects = 50; | ||
1951 | this._allowRetries = false; | ||
1952 | this._maxRetries = 1; | ||
1953 | this._keepAlive = false; | ||
1954 | this._disposed = false; | ||
1955 | this.userAgent = userAgent; | ||
1956 | this.handlers = handlers || []; | ||
1957 | this.requestOptions = requestOptions; | ||
1958 | if (requestOptions) { | ||
1959 | if (requestOptions.ignoreSslError != null) { | ||
1960 | this._ignoreSslError = requestOptions.ignoreSslError; | ||
1961 | } | ||
1962 | this._socketTimeout = requestOptions.socketTimeout; | ||
1963 | if (requestOptions.allowRedirects != null) { | ||
1964 | this._allowRedirects = requestOptions.allowRedirects; | ||
1965 | } | ||
1966 | if (requestOptions.allowRedirectDowngrade != null) { | ||
1967 | this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade; | ||
1968 | } | ||
1969 | if (requestOptions.maxRedirects != null) { | ||
1970 | this._maxRedirects = Math.max(requestOptions.maxRedirects, 0); | ||
1971 | } | ||
1972 | if (requestOptions.keepAlive != null) { | ||
1973 | this._keepAlive = requestOptions.keepAlive; | ||
1974 | } | ||
1975 | if (requestOptions.allowRetries != null) { | ||
1976 | this._allowRetries = requestOptions.allowRetries; | ||
1977 | } | ||
1978 | if (requestOptions.maxRetries != null) { | ||
1979 | this._maxRetries = requestOptions.maxRetries; | ||
1980 | } | ||
1981 | } | ||
1982 | } | ||
1983 | options(requestUrl, additionalHeaders) { | ||
1984 | return __awaiter(this, void 0, void 0, function* () { | ||
1985 | return this.request('OPTIONS', requestUrl, null, additionalHeaders || {}); | ||
1986 | }); | ||
1987 | } | ||
1988 | get(requestUrl, additionalHeaders) { | ||
1989 | return __awaiter(this, void 0, void 0, function* () { | ||
1990 | return this.request('GET', requestUrl, null, additionalHeaders || {}); | ||
1991 | }); | ||
1992 | } | ||
1993 | del(requestUrl, additionalHeaders) { | ||
1994 | return __awaiter(this, void 0, void 0, function* () { | ||
1995 | return this.request('DELETE', requestUrl, null, additionalHeaders || {}); | ||
1996 | }); | ||
1997 | } | ||
1998 | post(requestUrl, data, additionalHeaders) { | ||
1999 | return __awaiter(this, void 0, void 0, function* () { | ||
2000 | return this.request('POST', requestUrl, data, additionalHeaders || {}); | ||
2001 | }); | ||
2002 | } | ||
2003 | patch(requestUrl, data, additionalHeaders) { | ||
2004 | return __awaiter(this, void 0, void 0, function* () { | ||
2005 | return this.request('PATCH', requestUrl, data, additionalHeaders || {}); | ||
2006 | }); | ||
2007 | } | ||
2008 | put(requestUrl, data, additionalHeaders) { | ||
2009 | return __awaiter(this, void 0, void 0, function* () { | ||
2010 | return this.request('PUT', requestUrl, data, additionalHeaders || {}); | ||
2011 | }); | ||
2012 | } | ||
2013 | head(requestUrl, additionalHeaders) { | ||
2014 | return __awaiter(this, void 0, void 0, function* () { | ||
2015 | return this.request('HEAD', requestUrl, null, additionalHeaders || {}); | ||
2016 | }); | ||
2017 | } | ||
2018 | sendStream(verb, requestUrl, stream, additionalHeaders) { | ||
2019 | return __awaiter(this, void 0, void 0, function* () { | ||
2020 | return this.request(verb, requestUrl, stream, additionalHeaders); | ||
2021 | }); | ||
2022 | } | ||
2023 | /** | ||
2024 | * Gets a typed object from an endpoint | ||
2025 | * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise | ||
2026 | */ | ||
2027 | getJson(requestUrl, additionalHeaders = {}) { | ||
2028 | return __awaiter(this, void 0, void 0, function* () { | ||
2029 | additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); | ||
2030 | const res = yield this.get(requestUrl, additionalHeaders); | ||
2031 | return this._processResponse(res, this.requestOptions); | ||
2032 | }); | ||
2033 | } | ||
2034 | postJson(requestUrl, obj, additionalHeaders = {}) { | ||
2035 | return __awaiter(this, void 0, void 0, function* () { | ||
2036 | const data = JSON.stringify(obj, null, 2); | ||
2037 | additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); | ||
2038 | additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); | ||
2039 | const res = yield this.post(requestUrl, data, additionalHeaders); | ||
2040 | return this._processResponse(res, this.requestOptions); | ||
2041 | }); | ||
2042 | } | ||
2043 | putJson(requestUrl, obj, additionalHeaders = {}) { | ||
2044 | return __awaiter(this, void 0, void 0, function* () { | ||
2045 | const data = JSON.stringify(obj, null, 2); | ||
2046 | additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); | ||
2047 | additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); | ||
2048 | const res = yield this.put(requestUrl, data, additionalHeaders); | ||
2049 | return this._processResponse(res, this.requestOptions); | ||
2050 | }); | ||
2051 | } | ||
2052 | patchJson(requestUrl, obj, additionalHeaders = {}) { | ||
2053 | return __awaiter(this, void 0, void 0, function* () { | ||
2054 | const data = JSON.stringify(obj, null, 2); | ||
2055 | additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); | ||
2056 | additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); | ||
2057 | const res = yield this.patch(requestUrl, data, additionalHeaders); | ||
2058 | return this._processResponse(res, this.requestOptions); | ||
2059 | }); | ||
2060 | } | ||
2061 | /** | ||
2062 | * Makes a raw http request. | ||
2063 | * All other methods such as get, post, patch, and request ultimately call this. | ||
2064 | * Prefer get, del, post and patch | ||
2065 | */ | ||
2066 | request(verb, requestUrl, data, headers) { | ||
2067 | return __awaiter(this, void 0, void 0, function* () { | ||
2068 | if (this._disposed) { | ||
2069 | throw new Error('Client has already been disposed.'); | ||
2070 | } | ||
2071 | const parsedUrl = new URL(requestUrl); | ||
2072 | let info = this._prepareRequest(verb, parsedUrl, headers); | ||
2073 | // Only perform retries on reads since writes may not be idempotent. | ||
2074 | const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb) | ||
2075 | ? this._maxRetries + 1 | ||
2076 | : 1; | ||
2077 | let numTries = 0; | ||
2078 | let response; | ||
2079 | do { | ||
2080 | response = yield this.requestRaw(info, data); | ||
2081 | // Check if it's an authentication challenge | ||
2082 | if (response && | ||
2083 | response.message && | ||
2084 | response.message.statusCode === HttpCodes.Unauthorized) { | ||
2085 | let authenticationHandler; | ||
2086 | for (const handler of this.handlers) { | ||
2087 | if (handler.canHandleAuthentication(response)) { | ||
2088 | authenticationHandler = handler; | ||
2089 | break; | ||
2090 | } | ||
2091 | } | ||
2092 | if (authenticationHandler) { | ||
2093 | return authenticationHandler.handleAuthentication(this, info, data); | ||
2094 | } | ||
2095 | else { | ||
2096 | // We have received an unauthorized response but have no handlers to handle it. | ||
2097 | // Let the response return to the caller. | ||
2098 | return response; | ||
2099 | } | ||
2100 | } | ||
2101 | let redirectsRemaining = this._maxRedirects; | ||
2102 | while (response.message.statusCode && | ||
2103 | HttpRedirectCodes.includes(response.message.statusCode) && | ||
2104 | this._allowRedirects && | ||
2105 | redirectsRemaining > 0) { | ||
2106 | const redirectUrl = response.message.headers['location']; | ||
2107 | if (!redirectUrl) { | ||
2108 | // if there's no location to redirect to, we won't | ||
2109 | break; | ||
2110 | } | ||
2111 | const parsedRedirectUrl = new URL(redirectUrl); | ||
2112 | if (parsedUrl.protocol === 'https:' && | ||
2113 | parsedUrl.protocol !== parsedRedirectUrl.protocol && | ||
2114 | !this._allowRedirectDowngrade) { | ||
2115 | 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.'); | ||
2116 | } | ||
2117 | // we need to finish reading the response before reassigning response | ||
2118 | // which will leak the open socket. | ||
2119 | yield response.readBody(); | ||
2120 | // strip authorization header if redirected to a different hostname | ||
2121 | if (parsedRedirectUrl.hostname !== parsedUrl.hostname) { | ||
2122 | for (const header in headers) { | ||
2123 | // header names are case insensitive | ||
2124 | if (header.toLowerCase() === 'authorization') { | ||
2125 | delete headers[header]; | ||
2126 | } | ||
2127 | } | ||
2128 | } | ||
2129 | // let's make the request with the new redirectUrl | ||
2130 | info = this._prepareRequest(verb, parsedRedirectUrl, headers); | ||
2131 | response = yield this.requestRaw(info, data); | ||
2132 | redirectsRemaining--; | ||
2133 | } | ||
2134 | if (!response.message.statusCode || | ||
2135 | !HttpResponseRetryCodes.includes(response.message.statusCode)) { | ||
2136 | // If not a retry code, return immediately instead of retrying | ||
2137 | return response; | ||
2138 | } | ||
2139 | numTries += 1; | ||
2140 | if (numTries < maxTries) { | ||
2141 | yield response.readBody(); | ||
2142 | yield this._performExponentialBackoff(numTries); | ||
2143 | } | ||
2144 | } while (numTries < maxTries); | ||
2145 | return response; | ||
2146 | }); | ||
2147 | } | ||
2148 | /** | ||
2149 | * Needs to be called if keepAlive is set to true in request options. | ||
2150 | */ | ||
2151 | dispose() { | ||
2152 | if (this._agent) { | ||
2153 | this._agent.destroy(); | ||
2154 | } | ||
2155 | this._disposed = true; | ||
2156 | } | ||
2157 | /** | ||
2158 | * Raw request. | ||
2159 | * @param info | ||
2160 | * @param data | ||
2161 | */ | ||
2162 | requestRaw(info, data) { | ||
2163 | return __awaiter(this, void 0, void 0, function* () { | ||
2164 | return new Promise((resolve, reject) => { | ||
2165 | function callbackForResult(err, res) { | ||
2166 | if (err) { | ||
2167 | reject(err); | ||
2168 | } | ||
2169 | else if (!res) { | ||
2170 | // If `err` is not passed, then `res` must be passed. | ||
2171 | reject(new Error('Unknown error')); | ||
2172 | } | ||
2173 | else { | ||
2174 | resolve(res); | ||
2175 | } | ||
2176 | } | ||
2177 | this.requestRawWithCallback(info, data, callbackForResult); | ||
2178 | }); | ||
2179 | }); | ||
2180 | } | ||
2181 | /** | ||
2182 | * Raw request with callback. | ||
2183 | * @param info | ||
2184 | * @param data | ||
2185 | * @param onResult | ||
2186 | */ | ||
2187 | requestRawWithCallback(info, data, onResult) { | ||
2188 | if (typeof data === 'string') { | ||
2189 | if (!info.options.headers) { | ||
2190 | info.options.headers = {}; | ||
2191 | } | ||
2192 | info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8'); | ||
2193 | } | ||
2194 | let callbackCalled = false; | ||
2195 | function handleResult(err, res) { | ||
2196 | if (!callbackCalled) { | ||
2197 | callbackCalled = true; | ||
2198 | onResult(err, res); | ||
2199 | } | ||
2200 | } | ||
2201 | const req = info.httpModule.request(info.options, (msg) => { | ||
2202 | const res = new HttpClientResponse(msg); | ||
2203 | handleResult(undefined, res); | ||
2204 | }); | ||
2205 | let socket; | ||
2206 | req.on('socket', sock => { | ||
2207 | socket = sock; | ||
2208 | }); | ||
2209 | // If we ever get disconnected, we want the socket to timeout eventually | ||
2210 | req.setTimeout(this._socketTimeout || 3 * 60000, () => { | ||
2211 | if (socket) { | ||
2212 | socket.end(); | ||
2213 | } | ||
2214 | handleResult(new Error(`Request timeout: ${info.options.path}`)); | ||
2215 | }); | ||
2216 | req.on('error', function (err) { | ||
2217 | // err has statusCode property | ||
2218 | // res should have headers | ||
2219 | handleResult(err); | ||
2220 | }); | ||
2221 | if (data && typeof data === 'string') { | ||
2222 | req.write(data, 'utf8'); | ||
2223 | } | ||
2224 | if (data && typeof data !== 'string') { | ||
2225 | data.on('close', function () { | ||
2226 | req.end(); | ||
2227 | }); | ||
2228 | data.pipe(req); | ||
2229 | } | ||
2230 | else { | ||
2231 | req.end(); | ||
2232 | } | ||
2233 | } | ||
2234 | /** | ||
2235 | * Gets an http agent. This function is useful when you need an http agent that handles | ||
2236 | * routing through a proxy server - depending upon the url and proxy environment variables. | ||
2237 | * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com | ||
2238 | */ | ||
2239 | getAgent(serverUrl) { | ||
2240 | const parsedUrl = new URL(serverUrl); | ||
2241 | return this._getAgent(parsedUrl); | ||
2242 | } | ||
2243 | _prepareRequest(method, requestUrl, headers) { | ||
2244 | const info = {}; | ||
2245 | info.parsedUrl = requestUrl; | ||
2246 | const usingSsl = info.parsedUrl.protocol === 'https:'; | ||
2247 | info.httpModule = usingSsl ? https : http; | ||
2248 | const defaultPort = usingSsl ? 443 : 80; | ||
2249 | info.options = {}; | ||
2250 | info.options.host = info.parsedUrl.hostname; | ||
2251 | info.options.port = info.parsedUrl.port | ||
2252 | ? parseInt(info.parsedUrl.port) | ||
2253 | : defaultPort; | ||
2254 | info.options.path = | ||
2255 | (info.parsedUrl.pathname || '') + (info.parsedUrl.search || ''); | ||
2256 | info.options.method = method; | ||
2257 | info.options.headers = this._mergeHeaders(headers); | ||
2258 | if (this.userAgent != null) { | ||
2259 | info.options.headers['user-agent'] = this.userAgent; | ||
2260 | } | ||
2261 | info.options.agent = this._getAgent(info.parsedUrl); | ||
2262 | // gives handlers an opportunity to participate | ||
2263 | if (this.handlers) { | ||
2264 | for (const handler of this.handlers) { | ||
2265 | handler.prepareRequest(info.options); | ||
2266 | } | ||
2267 | } | ||
2268 | return info; | ||
2269 | } | ||
2270 | _mergeHeaders(headers) { | ||
2271 | if (this.requestOptions && this.requestOptions.headers) { | ||
2272 | return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers || {})); | ||
2273 | } | ||
2274 | return lowercaseKeys(headers || {}); | ||
2275 | } | ||
2276 | _getExistingOrDefaultHeader(additionalHeaders, header, _default) { | ||
2277 | let clientHeader; | ||
2278 | if (this.requestOptions && this.requestOptions.headers) { | ||
2279 | clientHeader = lowercaseKeys(this.requestOptions.headers)[header]; | ||
2280 | } | ||
2281 | return additionalHeaders[header] || clientHeader || _default; | ||
2282 | } | ||
2283 | _getAgent(parsedUrl) { | ||
2284 | let agent; | ||
2285 | const proxyUrl = pm.getProxyUrl(parsedUrl); | ||
2286 | const useProxy = proxyUrl && proxyUrl.hostname; | ||
2287 | if (this._keepAlive && useProxy) { | ||
2288 | agent = this._proxyAgent; | ||
2289 | } | ||
2290 | if (this._keepAlive && !useProxy) { | ||
2291 | agent = this._agent; | ||
2292 | } | ||
2293 | // if agent is already assigned use that agent. | ||
2294 | if (agent) { | ||
2295 | return agent; | ||
2296 | } | ||
2297 | const usingSsl = parsedUrl.protocol === 'https:'; | ||
2298 | let maxSockets = 100; | ||
2299 | if (this.requestOptions) { | ||
2300 | maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets; | ||
2301 | } | ||
2302 | // This is `useProxy` again, but we need to check `proxyURl` directly for TypeScripts's flow analysis. | ||
2303 | if (proxyUrl && proxyUrl.hostname) { | ||
2304 | const agentOptions = { | ||
2305 | maxSockets, | ||
2306 | keepAlive: this._keepAlive, | ||
2307 | proxy: Object.assign(Object.assign({}, ((proxyUrl.username || proxyUrl.password) && { | ||
2308 | proxyAuth: `${proxyUrl.username}:${proxyUrl.password}` | ||
2309 | })), { host: proxyUrl.hostname, port: proxyUrl.port }) | ||
2310 | }; | ||
2311 | let tunnelAgent; | ||
2312 | const overHttps = proxyUrl.protocol === 'https:'; | ||
2313 | if (usingSsl) { | ||
2314 | tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp; | ||
2315 | } | ||
2316 | else { | ||
2317 | tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp; | ||
2318 | } | ||
2319 | agent = tunnelAgent(agentOptions); | ||
2320 | this._proxyAgent = agent; | ||
2321 | } | ||
2322 | // if reusing agent across request and tunneling agent isn't assigned create a new agent | ||
2323 | if (this._keepAlive && !agent) { | ||
2324 | const options = { keepAlive: this._keepAlive, maxSockets }; | ||
2325 | agent = usingSsl ? new https.Agent(options) : new http.Agent(options); | ||
2326 | this._agent = agent; | ||
2327 | } | ||
2328 | // if not using private agent and tunnel agent isn't setup then use global agent | ||
2329 | if (!agent) { | ||
2330 | agent = usingSsl ? https.globalAgent : http.globalAgent; | ||
2331 | } | ||
2332 | if (usingSsl && this._ignoreSslError) { | ||
2333 | // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process | ||
2334 | // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options | ||
2335 | // we have to cast it to any and change it directly | ||
2336 | agent.options = Object.assign(agent.options || {}, { | ||
2337 | rejectUnauthorized: false | ||
2338 | }); | ||
2339 | } | ||
2340 | return agent; | ||
2341 | } | ||
2342 | _performExponentialBackoff(retryNumber) { | ||
2343 | return __awaiter(this, void 0, void 0, function* () { | ||
2344 | retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber); | ||
2345 | const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber); | ||
2346 | return new Promise(resolve => setTimeout(() => resolve(), ms)); | ||
2347 | }); | ||
2348 | } | ||
2349 | _processResponse(res, options) { | ||
2350 | return __awaiter(this, void 0, void 0, function* () { | ||
2351 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { | ||
2352 | const statusCode = res.message.statusCode || 0; | ||
2353 | const response = { | ||
2354 | statusCode, | ||
2355 | result: null, | ||
2356 | headers: {} | ||
2357 | }; | ||
2358 | // not found leads to null obj returned | ||
2359 | if (statusCode === HttpCodes.NotFound) { | ||
2360 | resolve(response); | ||
2361 | } | ||
2362 | // get the result from the body | ||
2363 | function dateTimeDeserializer(key, value) { | ||
2364 | if (typeof value === 'string') { | ||
2365 | const a = new Date(value); | ||
2366 | if (!isNaN(a.valueOf())) { | ||
2367 | return a; | ||
2368 | } | ||
2369 | } | ||
2370 | return value; | ||
2371 | } | ||
2372 | let obj; | ||
2373 | let contents; | ||
2374 | try { | ||
2375 | contents = yield res.readBody(); | ||
2376 | if (contents && contents.length > 0) { | ||
2377 | if (options && options.deserializeDates) { | ||
2378 | obj = JSON.parse(contents, dateTimeDeserializer); | ||
2379 | } | ||
2380 | else { | ||
2381 | obj = JSON.parse(contents); | ||
2382 | } | ||
2383 | response.result = obj; | ||
2384 | } | ||
2385 | response.headers = res.message.headers; | ||
2386 | } | ||
2387 | catch (err) { | ||
2388 | // Invalid resource (contents not json); leaving result obj null | ||
2389 | } | ||
2390 | // note that 3xx redirects are handled by the http layer. | ||
2391 | if (statusCode > 299) { | ||
2392 | let msg; | ||
2393 | // if exception/error in body, attempt to get better error | ||
2394 | if (obj && obj.message) { | ||
2395 | msg = obj.message; | ||
2396 | } | ||
2397 | else if (contents && contents.length > 0) { | ||
2398 | // it may be the case that the exception is in the body message as string | ||
2399 | msg = contents; | ||
2400 | } | ||
2401 | else { | ||
2402 | msg = `Failed request: (${statusCode})`; | ||
2403 | } | ||
2404 | const err = new HttpClientError(msg, statusCode); | ||
2405 | err.result = response.result; | ||
2406 | reject(err); | ||
2407 | } | ||
2408 | else { | ||
2409 | resolve(response); | ||
2410 | } | ||
2411 | })); | ||
2412 | }); | ||
2413 | } | ||
2414 | } | ||
2415 | exports.HttpClient = HttpClient; | ||
2416 | const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); | ||
2417 | //# sourceMappingURL=index.js.map | ||
2418 | |||
2419 | /***/ }), | ||
2420 | |||
2421 | /***/ 531: | ||
2422 | /***/ ((__unused_webpack_module, exports) => { | ||
2423 | |||
2424 | |||
2425 | Object.defineProperty(exports, "__esModule", ({ value: true })); | ||
2426 | exports.checkBypass = exports.getProxyUrl = void 0; | ||
2427 | function getProxyUrl(reqUrl) { | ||
2428 | const usingSsl = reqUrl.protocol === 'https:'; | ||
2429 | if (checkBypass(reqUrl)) { | ||
2430 | return undefined; | ||
2431 | } | ||
2432 | const proxyVar = (() => { | ||
2433 | if (usingSsl) { | ||
2434 | return process.env['https_proxy'] || process.env['HTTPS_PROXY']; | ||
2435 | } | ||
2436 | else { | ||
2437 | return process.env['http_proxy'] || process.env['HTTP_PROXY']; | ||
2438 | } | ||
2439 | })(); | ||
2440 | if (proxyVar) { | ||
2441 | return new URL(proxyVar); | ||
2442 | } | ||
2443 | else { | ||
2444 | return undefined; | ||
2445 | } | ||
2446 | } | ||
2447 | exports.getProxyUrl = getProxyUrl; | ||
2448 | function checkBypass(reqUrl) { | ||
2449 | if (!reqUrl.hostname) { | ||
2450 | return false; | ||
2451 | } | ||
2452 | const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || ''; | ||
2453 | if (!noProxy) { | ||
2454 | return false; | ||
2455 | } | ||
2456 | // Determine the request port | ||
2457 | let reqPort; | ||
2458 | if (reqUrl.port) { | ||
2459 | reqPort = Number(reqUrl.port); | ||
2460 | } | ||
2461 | else if (reqUrl.protocol === 'http:') { | ||
2462 | reqPort = 80; | ||
2463 | } | ||
2464 | else if (reqUrl.protocol === 'https:') { | ||
2465 | reqPort = 443; | ||
2466 | } | ||
2467 | // Format the request hostname and hostname with port | ||
2468 | const upperReqHosts = [reqUrl.hostname.toUpperCase()]; | ||
2469 | if (typeof reqPort === 'number') { | ||
2470 | upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`); | ||
2471 | } | ||
2472 | // Compare request host against noproxy | ||
2473 | for (const upperNoProxyItem of noProxy | ||
2474 | .split(',') | ||
2475 | .map(x => x.trim().toUpperCase()) | ||
2476 | .filter(x => x)) { | ||
2477 | if (upperReqHosts.some(x => x === upperNoProxyItem)) { | ||
2478 | return true; | ||
2479 | } | ||
2480 | } | ||
2481 | return false; | ||
2482 | } | ||
2483 | exports.checkBypass = checkBypass; | ||
2484 | //# sourceMappingURL=proxy.js.map | ||
2485 | |||
2486 | /***/ }), | ||
2487 | |||
2488 | /***/ 498: | ||
2489 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { | ||
2490 | |||
2491 | |||
2492 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
2493 | if (k2 === undefined) k2 = k; | ||
2494 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
2495 | }) : (function(o, m, k, k2) { | ||
2496 | if (k2 === undefined) k2 = k; | ||
2497 | o[k2] = m[k]; | ||
2498 | })); | ||
2499 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
2500 | Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
2501 | }) : function(o, v) { | ||
2502 | o["default"] = v; | ||
2503 | }); | ||
2504 | var __importStar = (this && this.__importStar) || function (mod) { | ||
2505 | if (mod && mod.__esModule) return mod; | ||
2506 | var result = {}; | ||
2507 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
2508 | __setModuleDefault(result, mod); | ||
2509 | return result; | ||
2510 | }; | ||
2511 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
2512 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
2513 | return new (P || (P = Promise))(function (resolve, reject) { | ||
2514 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
2515 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
2516 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
2517 | step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
2518 | }); | ||
2519 | }; | ||
2520 | var _a; | ||
2521 | Object.defineProperty(exports, "__esModule", ({ value: true })); | ||
2522 | exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rename = exports.readlink = exports.readdir = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0; | ||
2523 | const fs = __importStar(__nccwpck_require__(147)); | ||
2524 | const path = __importStar(__nccwpck_require__(17)); | ||
2525 | _a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink; | ||
2526 | exports.IS_WINDOWS = process.platform === 'win32'; | ||
2527 | function exists(fsPath) { | ||
2528 | return __awaiter(this, void 0, void 0, function* () { | ||
2529 | try { | ||
2530 | yield exports.stat(fsPath); | ||
2531 | } | ||
2532 | catch (err) { | ||
2533 | if (err.code === 'ENOENT') { | ||
2534 | return false; | ||
2535 | } | ||
2536 | throw err; | ||
2537 | } | ||
2538 | return true; | ||
2539 | }); | ||
2540 | } | ||
2541 | exports.exists = exists; | ||
2542 | function isDirectory(fsPath, useStat = false) { | ||
2543 | return __awaiter(this, void 0, void 0, function* () { | ||
2544 | const stats = useStat ? yield exports.stat(fsPath) : yield exports.lstat(fsPath); | ||
2545 | return stats.isDirectory(); | ||
2546 | }); | ||
2547 | } | ||
2548 | exports.isDirectory = isDirectory; | ||
2549 | /** | ||
2550 | * On OSX/Linux, true if path starts with '/'. On Windows, true for paths like: | ||
2551 | * \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases). | ||
2552 | */ | ||
2553 | function isRooted(p) { | ||
2554 | p = normalizeSeparators(p); | ||
2555 | if (!p) { | ||
2556 | throw new Error('isRooted() parameter "p" cannot be empty'); | ||
2557 | } | ||
2558 | if (exports.IS_WINDOWS) { | ||
2559 | return (p.startsWith('\\') || /^[A-Z]:/i.test(p) // e.g. \ or \hello or \\hello | ||
2560 | ); // e.g. C: or C:\hello | ||
2561 | } | ||
2562 | return p.startsWith('/'); | ||
2563 | } | ||
2564 | exports.isRooted = isRooted; | ||
2565 | /** | ||
2566 | * Best effort attempt to determine whether a file exists and is executable. | ||
2567 | * @param filePath file path to check | ||
2568 | * @param extensions additional file extensions to try | ||
2569 | * @return if file exists and is executable, returns the file path. otherwise empty string. | ||
2570 | */ | ||
2571 | function tryGetExecutablePath(filePath, extensions) { | ||
2572 | return __awaiter(this, void 0, void 0, function* () { | ||
2573 | let stats = undefined; | ||
2574 | try { | ||
2575 | // test file exists | ||
2576 | stats = yield exports.stat(filePath); | ||
2577 | } | ||
2578 | catch (err) { | ||
2579 | if (err.code !== 'ENOENT') { | ||
2580 | // eslint-disable-next-line no-console | ||
2581 | console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`); | ||
2582 | } | ||
2583 | } | ||
2584 | if (stats && stats.isFile()) { | ||
2585 | if (exports.IS_WINDOWS) { | ||
2586 | // on Windows, test for valid extension | ||
2587 | const upperExt = path.extname(filePath).toUpperCase(); | ||
2588 | if (extensions.some(validExt => validExt.toUpperCase() === upperExt)) { | ||
2589 | return filePath; | ||
2590 | } | ||
2591 | } | ||
2592 | else { | ||
2593 | if (isUnixExecutable(stats)) { | ||
2594 | return filePath; | ||
2595 | } | ||
2596 | } | ||
2597 | } | ||
2598 | // try each extension | ||
2599 | const originalFilePath = filePath; | ||
2600 | for (const extension of extensions) { | ||
2601 | filePath = originalFilePath + extension; | ||
2602 | stats = undefined; | ||
2603 | try { | ||
2604 | stats = yield exports.stat(filePath); | ||
2605 | } | ||
2606 | catch (err) { | ||
2607 | if (err.code !== 'ENOENT') { | ||
2608 | // eslint-disable-next-line no-console | ||
2609 | console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`); | ||
2610 | } | ||
2611 | } | ||
2612 | if (stats && stats.isFile()) { | ||
2613 | if (exports.IS_WINDOWS) { | ||
2614 | // preserve the case of the actual file (since an extension was appended) | ||
2615 | try { | ||
2616 | const directory = path.dirname(filePath); | ||
2617 | const upperName = path.basename(filePath).toUpperCase(); | ||
2618 | for (const actualName of yield exports.readdir(directory)) { | ||
2619 | if (upperName === actualName.toUpperCase()) { | ||
2620 | filePath = path.join(directory, actualName); | ||
2621 | break; | ||
2622 | } | ||
2623 | } | ||
2624 | } | ||
2625 | catch (err) { | ||
2626 | // eslint-disable-next-line no-console | ||
2627 | console.log(`Unexpected error attempting to determine the actual case of the file '${filePath}': ${err}`); | ||
2628 | } | ||
2629 | return filePath; | ||
2630 | } | ||
2631 | else { | ||
2632 | if (isUnixExecutable(stats)) { | ||
2633 | return filePath; | ||
2634 | } | ||
2635 | } | ||
2636 | } | ||
2637 | } | ||
2638 | return ''; | ||
2639 | }); | ||
2640 | } | ||
2641 | exports.tryGetExecutablePath = tryGetExecutablePath; | ||
2642 | function normalizeSeparators(p) { | ||
2643 | p = p || ''; | ||
2644 | if (exports.IS_WINDOWS) { | ||
2645 | // convert slashes on Windows | ||
2646 | p = p.replace(/\//g, '\\'); | ||
2647 | // remove redundant slashes | ||
2648 | return p.replace(/\\\\+/g, '\\'); | ||
2649 | } | ||
2650 | // remove redundant slashes | ||
2651 | return p.replace(/\/\/+/g, '/'); | ||
2652 | } | ||
2653 | // on Mac/Linux, test the execute bit | ||
2654 | // R W X R W X R W X | ||
2655 | // 256 128 64 32 16 8 4 2 1 | ||
2656 | function isUnixExecutable(stats) { | ||
2657 | return ((stats.mode & 1) > 0 || | ||
2658 | ((stats.mode & 8) > 0 && stats.gid === process.getgid()) || | ||
2659 | ((stats.mode & 64) > 0 && stats.uid === process.getuid())); | ||
2660 | } | ||
2661 | // Get the path of cmd.exe in windows | ||
2662 | function getCmdPath() { | ||
2663 | var _a; | ||
2664 | return (_a = process.env['COMSPEC']) !== null && _a !== void 0 ? _a : `cmd.exe`; | ||
2665 | } | ||
2666 | exports.getCmdPath = getCmdPath; | ||
2667 | //# sourceMappingURL=io-util.js.map | ||
2668 | |||
2669 | /***/ }), | ||
2670 | |||
2671 | /***/ 157: | ||
2672 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { | ||
2673 | |||
2674 | |||
2675 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
2676 | if (k2 === undefined) k2 = k; | ||
2677 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
2678 | }) : (function(o, m, k, k2) { | ||
2679 | if (k2 === undefined) k2 = k; | ||
2680 | o[k2] = m[k]; | ||
2681 | })); | ||
2682 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
2683 | Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
2684 | }) : function(o, v) { | ||
2685 | o["default"] = v; | ||
2686 | }); | ||
2687 | var __importStar = (this && this.__importStar) || function (mod) { | ||
2688 | if (mod && mod.__esModule) return mod; | ||
2689 | var result = {}; | ||
2690 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
2691 | __setModuleDefault(result, mod); | ||
2692 | return result; | ||
2693 | }; | ||
2694 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
2695 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
2696 | return new (P || (P = Promise))(function (resolve, reject) { | ||
2697 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
2698 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
2699 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
2700 | step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
2701 | }); | ||
2702 | }; | ||
2703 | Object.defineProperty(exports, "__esModule", ({ value: true })); | ||
2704 | exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0; | ||
2705 | const assert_1 = __nccwpck_require__(491); | ||
2706 | const childProcess = __importStar(__nccwpck_require__(81)); | ||
2707 | const path = __importStar(__nccwpck_require__(17)); | ||
2708 | const util_1 = __nccwpck_require__(837); | ||
2709 | const ioUtil = __importStar(__nccwpck_require__(498)); | ||
2710 | const exec = util_1.promisify(childProcess.exec); | ||
2711 | const execFile = util_1.promisify(childProcess.execFile); | ||
2712 | /** | ||
2713 | * Copies a file or folder. | ||
2714 | * Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js | ||
2715 | * | ||
2716 | * @param source source path | ||
2717 | * @param dest destination path | ||
2718 | * @param options optional. See CopyOptions. | ||
2719 | */ | ||
2720 | function cp(source, dest, options = {}) { | ||
2721 | return __awaiter(this, void 0, void 0, function* () { | ||
2722 | const { force, recursive, copySourceDirectory } = readCopyOptions(options); | ||
2723 | const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null; | ||
2724 | // Dest is an existing file, but not forcing | ||
2725 | if (destStat && destStat.isFile() && !force) { | ||
2726 | return; | ||
2727 | } | ||
2728 | // If dest is an existing directory, should copy inside. | ||
2729 | const newDest = destStat && destStat.isDirectory() && copySourceDirectory | ||
2730 | ? path.join(dest, path.basename(source)) | ||
2731 | : dest; | ||
2732 | if (!(yield ioUtil.exists(source))) { | ||
2733 | throw new Error(`no such file or directory: ${source}`); | ||
2734 | } | ||
2735 | const sourceStat = yield ioUtil.stat(source); | ||
2736 | if (sourceStat.isDirectory()) { | ||
2737 | if (!recursive) { | ||
2738 | throw new Error(`Failed to copy. ${source} is a directory, but tried to copy without recursive flag.`); | ||
2739 | } | ||
2740 | else { | ||
2741 | yield cpDirRecursive(source, newDest, 0, force); | ||
2742 | } | ||
2743 | } | ||
2744 | else { | ||
2745 | if (path.relative(source, newDest) === '') { | ||
2746 | // a file cannot be copied to itself | ||
2747 | throw new Error(`'${newDest}' and '${source}' are the same file`); | ||
2748 | } | ||
2749 | yield copyFile(source, newDest, force); | ||
2750 | } | ||
2751 | }); | ||
2752 | } | ||
2753 | exports.cp = cp; | ||
2754 | /** | ||
2755 | * Moves a path. | ||
2756 | * | ||
2757 | * @param source source path | ||
2758 | * @param dest destination path | ||
2759 | * @param options optional. See MoveOptions. | ||
2760 | */ | ||
2761 | function mv(source, dest, options = {}) { | ||
2762 | return __awaiter(this, void 0, void 0, function* () { | ||
2763 | if (yield ioUtil.exists(dest)) { | ||
2764 | let destExists = true; | ||
2765 | if (yield ioUtil.isDirectory(dest)) { | ||
2766 | // If dest is directory copy src into dest | ||
2767 | dest = path.join(dest, path.basename(source)); | ||
2768 | destExists = yield ioUtil.exists(dest); | ||
2769 | } | ||
2770 | if (destExists) { | ||
2771 | if (options.force == null || options.force) { | ||
2772 | yield rmRF(dest); | ||
2773 | } | ||
2774 | else { | ||
2775 | throw new Error('Destination already exists'); | ||
2776 | } | ||
2777 | } | ||
2778 | } | ||
2779 | yield mkdirP(path.dirname(dest)); | ||
2780 | yield ioUtil.rename(source, dest); | ||
2781 | }); | ||
2782 | } | ||
2783 | exports.mv = mv; | ||
2784 | /** | ||
2785 | * Remove a path recursively with force | ||
2786 | * | ||
2787 | * @param inputPath path to remove | ||
2788 | */ | ||
2789 | function rmRF(inputPath) { | ||
2790 | return __awaiter(this, void 0, void 0, function* () { | ||
2791 | if (ioUtil.IS_WINDOWS) { | ||
2792 | // Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another | ||
2793 | // program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del. | ||
2794 | // Check for invalid characters | ||
2795 | // https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file | ||
2796 | if (/[*"<>|]/.test(inputPath)) { | ||
2797 | throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows'); | ||
2798 | } | ||
2799 | try { | ||
2800 | const cmdPath = ioUtil.getCmdPath(); | ||
2801 | if (yield ioUtil.isDirectory(inputPath, true)) { | ||
2802 | yield exec(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, { | ||
2803 | env: { inputPath } | ||
2804 | }); | ||
2805 | } | ||
2806 | else { | ||
2807 | yield exec(`${cmdPath} /s /c "del /f /a "%inputPath%""`, { | ||
2808 | env: { inputPath } | ||
2809 | }); | ||
2810 | } | ||
2811 | } | ||
2812 | catch (err) { | ||
2813 | // if you try to delete a file that doesn't exist, desired result is achieved | ||
2814 | // other errors are valid | ||
2815 | if (err.code !== 'ENOENT') | ||
2816 | throw err; | ||
2817 | } | ||
2818 | // Shelling out fails to remove a symlink folder with missing source, this unlink catches that | ||
2819 | try { | ||
2820 | yield ioUtil.unlink(inputPath); | ||
2821 | } | ||
2822 | catch (err) { | ||
2823 | // if you try to delete a file that doesn't exist, desired result is achieved | ||
2824 | // other errors are valid | ||
2825 | if (err.code !== 'ENOENT') | ||
2826 | throw err; | ||
2827 | } | ||
2828 | } | ||
2829 | else { | ||
2830 | let isDir = false; | ||
2831 | try { | ||
2832 | isDir = yield ioUtil.isDirectory(inputPath); | ||
2833 | } | ||
2834 | catch (err) { | ||
2835 | // if you try to delete a file that doesn't exist, desired result is achieved | ||
2836 | // other errors are valid | ||
2837 | if (err.code !== 'ENOENT') | ||
2838 | throw err; | ||
2839 | return; | ||
2840 | } | ||
2841 | if (isDir) { | ||
2842 | yield execFile(`rm`, [`-rf`, `${inputPath}`]); | ||
2843 | } | ||
2844 | else { | ||
2845 | yield ioUtil.unlink(inputPath); | ||
2846 | } | ||
2847 | } | ||
2848 | }); | ||
2849 | } | ||
2850 | exports.rmRF = rmRF; | ||
2851 | /** | ||
2852 | * Make a directory. Creates the full path with folders in between | ||
2853 | * Will throw if it fails | ||
2854 | * | ||
2855 | * @param fsPath path to create | ||
2856 | * @returns Promise<void> | ||
2857 | */ | ||
2858 | function mkdirP(fsPath) { | ||
2859 | return __awaiter(this, void 0, void 0, function* () { | ||
2860 | assert_1.ok(fsPath, 'a path argument must be provided'); | ||
2861 | yield ioUtil.mkdir(fsPath, { recursive: true }); | ||
2862 | }); | ||
2863 | } | ||
2864 | exports.mkdirP = mkdirP; | ||
2865 | /** | ||
2866 | * Returns path of a tool had the tool actually been invoked. Resolves via paths. | ||
2867 | * If you check and the tool does not exist, it will throw. | ||
2868 | * | ||
2869 | * @param tool name of the tool | ||
2870 | * @param check whether to check if tool exists | ||
2871 | * @returns Promise<string> path to tool | ||
2872 | */ | ||
2873 | function which(tool, check) { | ||
2874 | return __awaiter(this, void 0, void 0, function* () { | ||
2875 | if (!tool) { | ||
2876 | throw new Error("parameter 'tool' is required"); | ||
2877 | } | ||
2878 | // recursive when check=true | ||
2879 | if (check) { | ||
2880 | const result = yield which(tool, false); | ||
2881 | if (!result) { | ||
2882 | if (ioUtil.IS_WINDOWS) { | ||
2883 | throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`); | ||
2884 | } | ||
2885 | else { | ||
2886 | throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`); | ||
2887 | } | ||
2888 | } | ||
2889 | return result; | ||
2890 | } | ||
2891 | const matches = yield findInPath(tool); | ||
2892 | if (matches && matches.length > 0) { | ||
2893 | return matches[0]; | ||
2894 | } | ||
2895 | return ''; | ||
2896 | }); | ||
2897 | } | ||
2898 | exports.which = which; | ||
2899 | /** | ||
2900 | * Returns a list of all occurrences of the given tool on the system path. | ||
2901 | * | ||
2902 | * @returns Promise<string[]> the paths of the tool | ||
2903 | */ | ||
2904 | function findInPath(tool) { | ||
2905 | return __awaiter(this, void 0, void 0, function* () { | ||
2906 | if (!tool) { | ||
2907 | throw new Error("parameter 'tool' is required"); | ||
2908 | } | ||
2909 | // build the list of extensions to try | ||
2910 | const extensions = []; | ||
2911 | if (ioUtil.IS_WINDOWS && process.env['PATHEXT']) { | ||
2912 | for (const extension of process.env['PATHEXT'].split(path.delimiter)) { | ||
2913 | if (extension) { | ||
2914 | extensions.push(extension); | ||
2915 | } | ||
2916 | } | ||
2917 | } | ||
2918 | // if it's rooted, return it if exists. otherwise return empty. | ||
2919 | if (ioUtil.isRooted(tool)) { | ||
2920 | const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions); | ||
2921 | if (filePath) { | ||
2922 | return [filePath]; | ||
2923 | } | ||
2924 | return []; | ||
2925 | } | ||
2926 | // if any path separators, return empty | ||
2927 | if (tool.includes(path.sep)) { | ||
2928 | return []; | ||
2929 | } | ||
2930 | // build the list of directories | ||
2931 | // | ||
2932 | // Note, technically "where" checks the current directory on Windows. From a toolkit perspective, | ||
2933 | // it feels like we should not do this. Checking the current directory seems like more of a use | ||
2934 | // case of a shell, and the which() function exposed by the toolkit should strive for consistency | ||
2935 | // across platforms. | ||
2936 | const directories = []; | ||
2937 | if (process.env.PATH) { | ||
2938 | for (const p of process.env.PATH.split(path.delimiter)) { | ||
2939 | if (p) { | ||
2940 | directories.push(p); | ||
2941 | } | ||
2942 | } | ||
2943 | } | ||
2944 | // find all matches | ||
2945 | const matches = []; | ||
2946 | for (const directory of directories) { | ||
2947 | const filePath = yield ioUtil.tryGetExecutablePath(path.join(directory, tool), extensions); | ||
2948 | if (filePath) { | ||
2949 | matches.push(filePath); | ||
2950 | } | ||
2951 | } | ||
2952 | return matches; | ||
2953 | }); | ||
2954 | } | ||
2955 | exports.findInPath = findInPath; | ||
2956 | function readCopyOptions(options) { | ||
2957 | const force = options.force == null ? true : options.force; | ||
2958 | const recursive = Boolean(options.recursive); | ||
2959 | const copySourceDirectory = options.copySourceDirectory == null | ||
2960 | ? true | ||
2961 | : Boolean(options.copySourceDirectory); | ||
2962 | return { force, recursive, copySourceDirectory }; | ||
2963 | } | ||
2964 | function cpDirRecursive(sourceDir, destDir, currentDepth, force) { | ||
2965 | return __awaiter(this, void 0, void 0, function* () { | ||
2966 | // Ensure there is not a run away recursive copy | ||
2967 | if (currentDepth >= 255) | ||
2968 | return; | ||
2969 | currentDepth++; | ||
2970 | yield mkdirP(destDir); | ||
2971 | const files = yield ioUtil.readdir(sourceDir); | ||
2972 | for (const fileName of files) { | ||
2973 | const srcFile = `${sourceDir}/${fileName}`; | ||
2974 | const destFile = `${destDir}/${fileName}`; | ||
2975 | const srcFileStat = yield ioUtil.lstat(srcFile); | ||
2976 | if (srcFileStat.isDirectory()) { | ||
2977 | // Recurse | ||
2978 | yield cpDirRecursive(srcFile, destFile, currentDepth, force); | ||
2979 | } | ||
2980 | else { | ||
2981 | yield copyFile(srcFile, destFile, force); | ||
2982 | } | ||
2983 | } | ||
2984 | // Change the mode for the newly created directory | ||
2985 | yield ioUtil.chmod(destDir, (yield ioUtil.stat(sourceDir)).mode); | ||
2986 | }); | ||
2987 | } | ||
2988 | // Buffered file copy | ||
2989 | function copyFile(srcFile, destFile, force) { | ||
2990 | return __awaiter(this, void 0, void 0, function* () { | ||
2991 | if ((yield ioUtil.lstat(srcFile)).isSymbolicLink()) { | ||
2992 | // unlink/re-link it | ||
2993 | try { | ||
2994 | yield ioUtil.lstat(destFile); | ||
2995 | yield ioUtil.unlink(destFile); | ||
2996 | } | ||
2997 | catch (e) { | ||
2998 | // Try to override file permission | ||
2999 | if (e.code === 'EPERM') { | ||
3000 | yield ioUtil.chmod(destFile, '0666'); | ||
3001 | yield ioUtil.unlink(destFile); | ||
3002 | } | ||
3003 | // other errors = it doesn't exist, no work to do | ||
3004 | } | ||
3005 | // Copy over symlink | ||
3006 | const symlinkFull = yield ioUtil.readlink(srcFile); | ||
3007 | yield ioUtil.symlink(symlinkFull, destFile, ioUtil.IS_WINDOWS ? 'junction' : null); | ||
3008 | } | ||
3009 | else if (!(yield ioUtil.exists(destFile)) || force) { | ||
3010 | yield ioUtil.copyFile(srcFile, destFile); | ||
3011 | } | ||
3012 | }); | ||
3013 | } | ||
3014 | //# sourceMappingURL=io.js.map | ||
3015 | |||
3016 | /***/ }), | ||
3017 | |||
3018 | /***/ 125: | ||
3019 | /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { | ||
3020 | |||
3021 | module.exports = __nccwpck_require__(680); | ||
3022 | |||
3023 | |||
3024 | /***/ }), | ||
3025 | |||
3026 | /***/ 680: | ||
3027 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { | ||
3028 | |||
3029 | |||
3030 | |||
3031 | var net = __nccwpck_require__(808); | ||
3032 | var tls = __nccwpck_require__(404); | ||
3033 | var http = __nccwpck_require__(685); | ||
3034 | var https = __nccwpck_require__(687); | ||
3035 | var events = __nccwpck_require__(361); | ||
3036 | var assert = __nccwpck_require__(491); | ||
3037 | var util = __nccwpck_require__(837); | ||
3038 | |||
3039 | |||
3040 | exports.httpOverHttp = httpOverHttp; | ||
3041 | exports.httpsOverHttp = httpsOverHttp; | ||
3042 | exports.httpOverHttps = httpOverHttps; | ||
3043 | exports.httpsOverHttps = httpsOverHttps; | ||
3044 | |||
3045 | |||
3046 | function httpOverHttp(options) { | ||
3047 | var agent = new TunnelingAgent(options); | ||
3048 | agent.request = http.request; | ||
3049 | return agent; | ||
3050 | } | ||
3051 | |||
3052 | function httpsOverHttp(options) { | ||
3053 | var agent = new TunnelingAgent(options); | ||
3054 | agent.request = http.request; | ||
3055 | agent.createSocket = createSecureSocket; | ||
3056 | agent.defaultPort = 443; | ||
3057 | return agent; | ||
3058 | } | ||
3059 | |||
3060 | function httpOverHttps(options) { | ||
3061 | var agent = new TunnelingAgent(options); | ||
3062 | agent.request = https.request; | ||
3063 | return agent; | ||
3064 | } | ||
3065 | |||
3066 | function httpsOverHttps(options) { | ||
3067 | var agent = new TunnelingAgent(options); | ||
3068 | agent.request = https.request; | ||
3069 | agent.createSocket = createSecureSocket; | ||
3070 | agent.defaultPort = 443; | ||
3071 | return agent; | ||
3072 | } | ||
3073 | |||
3074 | |||
3075 | function TunnelingAgent(options) { | ||
3076 | var self = this; | ||
3077 | self.options = options || {}; | ||
3078 | self.proxyOptions = self.options.proxy || {}; | ||
3079 | self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; | ||
3080 | self.requests = []; | ||
3081 | self.sockets = []; | ||
3082 | |||
3083 | self.on('free', function onFree(socket, host, port, localAddress) { | ||
3084 | var options = toOptions(host, port, localAddress); | ||
3085 | for (var i = 0, len = self.requests.length; i < len; ++i) { | ||
3086 | var pending = self.requests[i]; | ||
3087 | if (pending.host === options.host && pending.port === options.port) { | ||
3088 | // Detect the request to connect same origin server, | ||
3089 | // reuse the connection. | ||
3090 | self.requests.splice(i, 1); | ||
3091 | pending.request.onSocket(socket); | ||
3092 | return; | ||
3093 | } | ||
3094 | } | ||
3095 | socket.destroy(); | ||
3096 | self.removeSocket(socket); | ||
3097 | }); | ||
3098 | } | ||
3099 | util.inherits(TunnelingAgent, events.EventEmitter); | ||
3100 | |||
3101 | TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) { | ||
3102 | var self = this; | ||
3103 | var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress)); | ||
3104 | |||
3105 | if (self.sockets.length >= this.maxSockets) { | ||
3106 | // We are over limit so we'll add it to the queue. | ||
3107 | self.requests.push(options); | ||
3108 | return; | ||
3109 | } | ||
3110 | |||
3111 | // If we are under maxSockets create a new one. | ||
3112 | self.createSocket(options, function(socket) { | ||
3113 | socket.on('free', onFree); | ||
3114 | socket.on('close', onCloseOrRemove); | ||
3115 | socket.on('agentRemove', onCloseOrRemove); | ||
3116 | req.onSocket(socket); | ||
3117 | |||
3118 | function onFree() { | ||
3119 | self.emit('free', socket, options); | ||
3120 | } | ||
3121 | |||
3122 | function onCloseOrRemove(err) { | ||
3123 | self.removeSocket(socket); | ||
3124 | socket.removeListener('free', onFree); | ||
3125 | socket.removeListener('close', onCloseOrRemove); | ||
3126 | socket.removeListener('agentRemove', onCloseOrRemove); | ||
3127 | } | ||
3128 | }); | ||
3129 | }; | ||
3130 | |||
3131 | TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { | ||
3132 | var self = this; | ||
3133 | var placeholder = {}; | ||
3134 | self.sockets.push(placeholder); | ||
3135 | |||
3136 | var connectOptions = mergeOptions({}, self.proxyOptions, { | ||
3137 | method: 'CONNECT', | ||
3138 | path: options.host + ':' + options.port, | ||
3139 | agent: false, | ||
3140 | headers: { | ||
3141 | host: options.host + ':' + options.port | ||
3142 | } | ||
3143 | }); | ||
3144 | if (options.localAddress) { | ||
3145 | connectOptions.localAddress = options.localAddress; | ||
3146 | } | ||
3147 | if (connectOptions.proxyAuth) { | ||
3148 | connectOptions.headers = connectOptions.headers || {}; | ||
3149 | connectOptions.headers['Proxy-Authorization'] = 'Basic ' + | ||
3150 | new Buffer(connectOptions.proxyAuth).toString('base64'); | ||
3151 | } | ||
3152 | |||
3153 | debug('making CONNECT request'); | ||
3154 | var connectReq = self.request(connectOptions); | ||
3155 | connectReq.useChunkedEncodingByDefault = false; // for v0.6 | ||
3156 | connectReq.once('response', onResponse); // for v0.6 | ||
3157 | connectReq.once('upgrade', onUpgrade); // for v0.6 | ||
3158 | connectReq.once('connect', onConnect); // for v0.7 or later | ||
3159 | connectReq.once('error', onError); | ||
3160 | connectReq.end(); | ||
3161 | |||
3162 | function onResponse(res) { | ||
3163 | // Very hacky. This is necessary to avoid http-parser leaks. | ||
3164 | res.upgrade = true; | ||
3165 | } | ||
3166 | |||
3167 | function onUpgrade(res, socket, head) { | ||
3168 | // Hacky. | ||
3169 | process.nextTick(function() { | ||
3170 | onConnect(res, socket, head); | ||
3171 | }); | ||
3172 | } | ||
3173 | |||
3174 | function onConnect(res, socket, head) { | ||
3175 | connectReq.removeAllListeners(); | ||
3176 | socket.removeAllListeners(); | ||
3177 | |||
3178 | if (res.statusCode !== 200) { | ||
3179 | debug('tunneling socket could not be established, statusCode=%d', | ||
3180 | res.statusCode); | ||
3181 | socket.destroy(); | ||
3182 | var error = new Error('tunneling socket could not be established, ' + | ||
3183 | 'statusCode=' + res.statusCode); | ||
3184 | error.code = 'ECONNRESET'; | ||
3185 | options.request.emit('error', error); | ||
3186 | self.removeSocket(placeholder); | ||
3187 | return; | ||
3188 | } | ||
3189 | if (head.length > 0) { | ||
3190 | debug('got illegal response body from proxy'); | ||
3191 | socket.destroy(); | ||
3192 | var error = new Error('got illegal response body from proxy'); | ||
3193 | error.code = 'ECONNRESET'; | ||
3194 | options.request.emit('error', error); | ||
3195 | self.removeSocket(placeholder); | ||
3196 | return; | ||
3197 | } | ||
3198 | debug('tunneling connection has established'); | ||
3199 | self.sockets[self.sockets.indexOf(placeholder)] = socket; | ||
3200 | return cb(socket); | ||
3201 | } | ||
3202 | |||
3203 | function onError(cause) { | ||
3204 | connectReq.removeAllListeners(); | ||
3205 | |||
3206 | debug('tunneling socket could not be established, cause=%s\n', | ||
3207 | cause.message, cause.stack); | ||
3208 | var error = new Error('tunneling socket could not be established, ' + | ||
3209 | 'cause=' + cause.message); | ||
3210 | error.code = 'ECONNRESET'; | ||
3211 | options.request.emit('error', error); | ||
3212 | self.removeSocket(placeholder); | ||
3213 | } | ||
3214 | }; | ||
3215 | |||
3216 | TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { | ||
3217 | var pos = this.sockets.indexOf(socket) | ||
3218 | if (pos === -1) { | ||
3219 | return; | ||
3220 | } | ||
3221 | this.sockets.splice(pos, 1); | ||
3222 | |||
3223 | var pending = this.requests.shift(); | ||
3224 | if (pending) { | ||
3225 | // If we have pending requests and a socket gets closed a new one | ||
3226 | // needs to be created to take over in the pool for the one that closed. | ||
3227 | this.createSocket(pending, function(socket) { | ||
3228 | pending.request.onSocket(socket); | ||
3229 | }); | ||
3230 | } | ||
3231 | }; | ||
3232 | |||
3233 | function createSecureSocket(options, cb) { | ||
3234 | var self = this; | ||
3235 | TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { | ||
3236 | var hostHeader = options.request.getHeader('host'); | ||
3237 | var tlsOptions = mergeOptions({}, self.options, { | ||
3238 | socket: socket, | ||
3239 | servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host | ||
3240 | }); | ||
3241 | |||
3242 | // 0 is dummy port for v0.6 | ||
3243 | var secureSocket = tls.connect(0, tlsOptions); | ||
3244 | self.sockets[self.sockets.indexOf(socket)] = secureSocket; | ||
3245 | cb(secureSocket); | ||
3246 | }); | ||
3247 | } | ||
3248 | |||
3249 | |||
3250 | function toOptions(host, port, localAddress) { | ||
3251 | if (typeof host === 'string') { // since v0.10 | ||
3252 | return { | ||
3253 | host: host, | ||
3254 | port: port, | ||
3255 | localAddress: localAddress | ||
3256 | }; | ||
3257 | } | ||
3258 | return host; // for v0.11 or later | ||
3259 | } | ||
3260 | |||
3261 | function mergeOptions(target) { | ||
3262 | for (var i = 1, len = arguments.length; i < len; ++i) { | ||
3263 | var overrides = arguments[i]; | ||
3264 | if (typeof overrides === 'object') { | ||
3265 | var keys = Object.keys(overrides); | ||
3266 | for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { | ||
3267 | var k = keys[j]; | ||
3268 | if (overrides[k] !== undefined) { | ||
3269 | target[k] = overrides[k]; | ||
3270 | } | ||
3271 | } | ||
3272 | } | ||
3273 | } | ||
3274 | return target; | ||
3275 | } | ||
3276 | |||
3277 | |||
3278 | var debug; | ||
3279 | if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { | ||
3280 | debug = function() { | ||
3281 | var args = Array.prototype.slice.call(arguments); | ||
3282 | if (typeof args[0] === 'string') { | ||
3283 | args[0] = 'TUNNEL: ' + args[0]; | ||
3284 | } else { | ||
3285 | args.unshift('TUNNEL:'); | ||
3286 | } | ||
3287 | console.error.apply(console, args); | ||
3288 | } | ||
3289 | } else { | ||
3290 | debug = function() {}; | ||
3291 | } | ||
3292 | exports.debug = debug; // for test | ||
3293 | |||
3294 | |||
3295 | /***/ }), | ||
3296 | |||
3297 | /***/ 66: | ||
3298 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { | ||
3299 | |||
3300 | |||
3301 | |||
3302 | Object.defineProperty(exports, "__esModule", ({ | ||
3303 | value: true | ||
3304 | })); | ||
3305 | Object.defineProperty(exports, "v1", ({ | ||
3306 | enumerable: true, | ||
3307 | get: function () { | ||
3308 | return _v.default; | ||
3309 | } | ||
3310 | })); | ||
3311 | Object.defineProperty(exports, "v3", ({ | ||
3312 | enumerable: true, | ||
3313 | get: function () { | ||
3314 | return _v2.default; | ||
3315 | } | ||
3316 | })); | ||
3317 | Object.defineProperty(exports, "v4", ({ | ||
3318 | enumerable: true, | ||
3319 | get: function () { | ||
3320 | return _v3.default; | ||
3321 | } | ||
3322 | })); | ||
3323 | Object.defineProperty(exports, "v5", ({ | ||
3324 | enumerable: true, | ||
3325 | get: function () { | ||
3326 | return _v4.default; | ||
3327 | } | ||
3328 | })); | ||
3329 | Object.defineProperty(exports, "NIL", ({ | ||
3330 | enumerable: true, | ||
3331 | get: function () { | ||
3332 | return _nil.default; | ||
3333 | } | ||
3334 | })); | ||
3335 | Object.defineProperty(exports, "version", ({ | ||
3336 | enumerable: true, | ||
3337 | get: function () { | ||
3338 | return _version.default; | ||
3339 | } | ||
3340 | })); | ||
3341 | Object.defineProperty(exports, "validate", ({ | ||
3342 | enumerable: true, | ||
3343 | get: function () { | ||
3344 | return _validate.default; | ||
3345 | } | ||
3346 | })); | ||
3347 | Object.defineProperty(exports, "stringify", ({ | ||
3348 | enumerable: true, | ||
3349 | get: function () { | ||
3350 | return _stringify.default; | ||
3351 | } | ||
3352 | })); | ||
3353 | Object.defineProperty(exports, "parse", ({ | ||
3354 | enumerable: true, | ||
3355 | get: function () { | ||
3356 | return _parse.default; | ||
3357 | } | ||
3358 | })); | ||
3359 | |||
3360 | var _v = _interopRequireDefault(__nccwpck_require__(21)); | ||
3361 | |||
3362 | var _v2 = _interopRequireDefault(__nccwpck_require__(323)); | ||
3363 | |||
3364 | var _v3 = _interopRequireDefault(__nccwpck_require__(626)); | ||
3365 | |||
3366 | var _v4 = _interopRequireDefault(__nccwpck_require__(420)); | ||
3367 | |||
3368 | var _nil = _interopRequireDefault(__nccwpck_require__(659)); | ||
3369 | |||
3370 | var _version = _interopRequireDefault(__nccwpck_require__(927)); | ||
3371 | |||
3372 | var _validate = _interopRequireDefault(__nccwpck_require__(206)); | ||
3373 | |||
3374 | var _stringify = _interopRequireDefault(__nccwpck_require__(541)); | ||
3375 | |||
3376 | var _parse = _interopRequireDefault(__nccwpck_require__(986)); | ||
3377 | |||
3378 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
3379 | |||
3380 | /***/ }), | ||
3381 | |||
3382 | /***/ 456: | ||
3383 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { | ||
3384 | |||
3385 | |||
3386 | |||
3387 | Object.defineProperty(exports, "__esModule", ({ | ||
3388 | value: true | ||
3389 | })); | ||
3390 | exports["default"] = void 0; | ||
3391 | |||
3392 | var _crypto = _interopRequireDefault(__nccwpck_require__(113)); | ||
3393 | |||
3394 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
3395 | |||
3396 | function md5(bytes) { | ||
3397 | if (Array.isArray(bytes)) { | ||
3398 | bytes = Buffer.from(bytes); | ||
3399 | } else if (typeof bytes === 'string') { | ||
3400 | bytes = Buffer.from(bytes, 'utf8'); | ||
3401 | } | ||
3402 | |||
3403 | return _crypto.default.createHash('md5').update(bytes).digest(); | ||
3404 | } | ||
3405 | |||
3406 | var _default = md5; | ||
3407 | exports["default"] = _default; | ||
3408 | |||
3409 | /***/ }), | ||
3410 | |||
3411 | /***/ 659: | ||
3412 | /***/ ((__unused_webpack_module, exports) => { | ||
3413 | |||
3414 | |||
3415 | |||
3416 | Object.defineProperty(exports, "__esModule", ({ | ||
3417 | value: true | ||
3418 | })); | ||
3419 | exports["default"] = void 0; | ||
3420 | var _default = '00000000-0000-0000-0000-000000000000'; | ||
3421 | exports["default"] = _default; | ||
3422 | |||
3423 | /***/ }), | ||
3424 | |||
3425 | /***/ 986: | ||
3426 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { | ||
3427 | |||
3428 | |||
3429 | |||
3430 | Object.defineProperty(exports, "__esModule", ({ | ||
3431 | value: true | ||
3432 | })); | ||
3433 | exports["default"] = void 0; | ||
3434 | |||
3435 | var _validate = _interopRequireDefault(__nccwpck_require__(206)); | ||
3436 | |||
3437 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
3438 | |||
3439 | function parse(uuid) { | ||
3440 | if (!(0, _validate.default)(uuid)) { | ||
3441 | throw TypeError('Invalid UUID'); | ||
3442 | } | ||
3443 | |||
3444 | let v; | ||
3445 | const arr = new Uint8Array(16); // Parse ########-....-....-....-............ | ||
3446 | |||
3447 | arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; | ||
3448 | arr[1] = v >>> 16 & 0xff; | ||
3449 | arr[2] = v >>> 8 & 0xff; | ||
3450 | arr[3] = v & 0xff; // Parse ........-####-....-....-............ | ||
3451 | |||
3452 | arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; | ||
3453 | arr[5] = v & 0xff; // Parse ........-....-####-....-............ | ||
3454 | |||
3455 | arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; | ||
3456 | arr[7] = v & 0xff; // Parse ........-....-....-####-............ | ||
3457 | |||
3458 | arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; | ||
3459 | arr[9] = v & 0xff; // Parse ........-....-....-....-############ | ||
3460 | // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes) | ||
3461 | |||
3462 | arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff; | ||
3463 | arr[11] = v / 0x100000000 & 0xff; | ||
3464 | arr[12] = v >>> 24 & 0xff; | ||
3465 | arr[13] = v >>> 16 & 0xff; | ||
3466 | arr[14] = v >>> 8 & 0xff; | ||
3467 | arr[15] = v & 0xff; | ||
3468 | return arr; | ||
3469 | } | ||
3470 | |||
3471 | var _default = parse; | ||
3472 | exports["default"] = _default; | ||
3473 | |||
3474 | /***/ }), | ||
3475 | |||
3476 | /***/ 122: | ||
3477 | /***/ ((__unused_webpack_module, exports) => { | ||
3478 | |||
3479 | |||
3480 | |||
3481 | Object.defineProperty(exports, "__esModule", ({ | ||
3482 | value: true | ||
3483 | })); | ||
3484 | exports["default"] = void 0; | ||
3485 | 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; | ||
3486 | exports["default"] = _default; | ||
3487 | |||
3488 | /***/ }), | ||
3489 | |||
3490 | /***/ 643: | ||
3491 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { | ||
3492 | |||
3493 | |||
3494 | |||
3495 | Object.defineProperty(exports, "__esModule", ({ | ||
3496 | value: true | ||
3497 | })); | ||
3498 | exports["default"] = rng; | ||
3499 | |||
3500 | var _crypto = _interopRequireDefault(__nccwpck_require__(113)); | ||
3501 | |||
3502 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
3503 | |||
3504 | const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate | ||
3505 | |||
3506 | let poolPtr = rnds8Pool.length; | ||
3507 | |||
3508 | function rng() { | ||
3509 | if (poolPtr > rnds8Pool.length - 16) { | ||
3510 | _crypto.default.randomFillSync(rnds8Pool); | ||
3511 | |||
3512 | poolPtr = 0; | ||
3513 | } | ||
3514 | |||
3515 | return rnds8Pool.slice(poolPtr, poolPtr += 16); | ||
3516 | } | ||
3517 | |||
3518 | /***/ }), | ||
3519 | |||
3520 | /***/ 746: | ||
3521 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { | ||
3522 | |||
3523 | |||
3524 | |||
3525 | Object.defineProperty(exports, "__esModule", ({ | ||
3526 | value: true | ||
3527 | })); | ||
3528 | exports["default"] = void 0; | ||
3529 | |||
3530 | var _crypto = _interopRequireDefault(__nccwpck_require__(113)); | ||
3531 | |||
3532 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
3533 | |||
3534 | function sha1(bytes) { | ||
3535 | if (Array.isArray(bytes)) { | ||
3536 | bytes = Buffer.from(bytes); | ||
3537 | } else if (typeof bytes === 'string') { | ||
3538 | bytes = Buffer.from(bytes, 'utf8'); | ||
3539 | } | ||
3540 | |||
3541 | return _crypto.default.createHash('sha1').update(bytes).digest(); | ||
3542 | } | ||
3543 | |||
3544 | var _default = sha1; | ||
3545 | exports["default"] = _default; | ||
3546 | |||
3547 | /***/ }), | ||
3548 | |||
3549 | /***/ 541: | ||
3550 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { | ||
3551 | |||
3552 | |||
3553 | |||
3554 | Object.defineProperty(exports, "__esModule", ({ | ||
3555 | value: true | ||
3556 | })); | ||
3557 | exports["default"] = void 0; | ||
3558 | |||
3559 | var _validate = _interopRequireDefault(__nccwpck_require__(206)); | ||
3560 | |||
3561 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
3562 | |||
3563 | /** | ||
3564 | * Convert array of 16 byte values to UUID string format of the form: | ||
3565 | * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX | ||
3566 | */ | ||
3567 | const byteToHex = []; | ||
3568 | |||
3569 | for (let i = 0; i < 256; ++i) { | ||
3570 | byteToHex.push((i + 0x100).toString(16).substr(1)); | ||
3571 | } | ||
3572 | |||
3573 | function stringify(arr, offset = 0) { | ||
3574 | // Note: Be careful editing this code! It's been tuned for performance | ||
3575 | // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 | ||
3576 | 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 | ||
3577 | // of the following: | ||
3578 | // - One or more input array values don't map to a hex octet (leading to | ||
3579 | // "undefined" in the uuid) | ||
3580 | // - Invalid input values for the RFC `version` or `variant` fields | ||
3581 | |||
3582 | if (!(0, _validate.default)(uuid)) { | ||
3583 | throw TypeError('Stringified UUID is invalid'); | ||
3584 | } | ||
3585 | |||
3586 | return uuid; | ||
3587 | } | ||
3588 | |||
3589 | var _default = stringify; | ||
3590 | exports["default"] = _default; | ||
3591 | |||
3592 | /***/ }), | ||
3593 | |||
3594 | /***/ 21: | ||
3595 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { | ||
3596 | |||
3597 | |||
3598 | |||
3599 | Object.defineProperty(exports, "__esModule", ({ | ||
3600 | value: true | ||
3601 | })); | ||
3602 | exports["default"] = void 0; | ||
3603 | |||
3604 | var _rng = _interopRequireDefault(__nccwpck_require__(643)); | ||
3605 | |||
3606 | var _stringify = _interopRequireDefault(__nccwpck_require__(541)); | ||
3607 | |||
3608 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
3609 | |||
3610 | // **`v1()` - Generate time-based UUID** | ||
3611 | // | ||
3612 | // Inspired by https://github.com/LiosK/UUID.js | ||
3613 | // and http://docs.python.org/library/uuid.html | ||
3614 | let _nodeId; | ||
3615 | |||
3616 | let _clockseq; // Previous uuid creation time | ||
3617 | |||
3618 | |||
3619 | let _lastMSecs = 0; | ||
3620 | let _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details | ||
3621 | |||
3622 | function v1(options, buf, offset) { | ||
3623 | let i = buf && offset || 0; | ||
3624 | const b = buf || new Array(16); | ||
3625 | options = options || {}; | ||
3626 | let node = options.node || _nodeId; | ||
3627 | let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not | ||
3628 | // specified. We do this lazily to minimize issues related to insufficient | ||
3629 | // system entropy. See #189 | ||
3630 | |||
3631 | if (node == null || clockseq == null) { | ||
3632 | const seedBytes = options.random || (options.rng || _rng.default)(); | ||
3633 | |||
3634 | if (node == null) { | ||
3635 | // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) | ||
3636 | node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; | ||
3637 | } | ||
3638 | |||
3639 | if (clockseq == null) { | ||
3640 | // Per 4.2.2, randomize (14 bit) clockseq | ||
3641 | clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; | ||
3642 | } | ||
3643 | } // UUID timestamps are 100 nano-second units since the Gregorian epoch, | ||
3644 | // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so | ||
3645 | // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' | ||
3646 | // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. | ||
3647 | |||
3648 | |||
3649 | let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock | ||
3650 | // cycle to simulate higher resolution clock | ||
3651 | |||
3652 | let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs) | ||
3653 | |||
3654 | const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression | ||
3655 | |||
3656 | if (dt < 0 && options.clockseq === undefined) { | ||
3657 | clockseq = clockseq + 1 & 0x3fff; | ||
3658 | } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new | ||
3659 | // time interval | ||
3660 | |||
3661 | |||
3662 | if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { | ||
3663 | nsecs = 0; | ||
3664 | } // Per 4.2.1.2 Throw error if too many uuids are requested | ||
3665 | |||
3666 | |||
3667 | if (nsecs >= 10000) { | ||
3668 | throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); | ||
3669 | } | ||
3670 | |||
3671 | _lastMSecs = msecs; | ||
3672 | _lastNSecs = nsecs; | ||
3673 | _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch | ||
3674 | |||
3675 | msecs += 12219292800000; // `time_low` | ||
3676 | |||
3677 | const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; | ||
3678 | b[i++] = tl >>> 24 & 0xff; | ||
3679 | b[i++] = tl >>> 16 & 0xff; | ||
3680 | b[i++] = tl >>> 8 & 0xff; | ||
3681 | b[i++] = tl & 0xff; // `time_mid` | ||
3682 | |||
3683 | const tmh = msecs / 0x100000000 * 10000 & 0xfffffff; | ||
3684 | b[i++] = tmh >>> 8 & 0xff; | ||
3685 | b[i++] = tmh & 0xff; // `time_high_and_version` | ||
3686 | |||
3687 | b[i++] = tmh >>> 24 & 0xf | 0x10; // include version | ||
3688 | |||
3689 | b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) | ||
3690 | |||
3691 | b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` | ||
3692 | |||
3693 | b[i++] = clockseq & 0xff; // `node` | ||
3694 | |||
3695 | for (let n = 0; n < 6; ++n) { | ||
3696 | b[i + n] = node[n]; | ||
3697 | } | ||
3698 | |||
3699 | return buf || (0, _stringify.default)(b); | ||
3700 | } | ||
3701 | |||
3702 | var _default = v1; | ||
3703 | exports["default"] = _default; | ||
3704 | |||
3705 | /***/ }), | ||
3706 | |||
3707 | /***/ 323: | ||
3708 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { | ||
3709 | |||
3710 | |||
3711 | |||
3712 | Object.defineProperty(exports, "__esModule", ({ | ||
3713 | value: true | ||
3714 | })); | ||
3715 | exports["default"] = void 0; | ||
3716 | |||
3717 | var _v = _interopRequireDefault(__nccwpck_require__(424)); | ||
3718 | |||
3719 | var _md = _interopRequireDefault(__nccwpck_require__(456)); | ||
3720 | |||
3721 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
3722 | |||
3723 | const v3 = (0, _v.default)('v3', 0x30, _md.default); | ||
3724 | var _default = v3; | ||
3725 | exports["default"] = _default; | ||
3726 | |||
3727 | /***/ }), | ||
3728 | |||
3729 | /***/ 424: | ||
3730 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { | ||
3731 | |||
3732 | |||
3733 | |||
3734 | Object.defineProperty(exports, "__esModule", ({ | ||
3735 | value: true | ||
3736 | })); | ||
3737 | exports["default"] = _default; | ||
3738 | exports.URL = exports.DNS = void 0; | ||
3739 | |||
3740 | var _stringify = _interopRequireDefault(__nccwpck_require__(541)); | ||
3741 | |||
3742 | var _parse = _interopRequireDefault(__nccwpck_require__(986)); | ||
3743 | |||
3744 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
3745 | |||
3746 | function stringToBytes(str) { | ||
3747 | str = unescape(encodeURIComponent(str)); // UTF8 escape | ||
3748 | |||
3749 | const bytes = []; | ||
3750 | |||
3751 | for (let i = 0; i < str.length; ++i) { | ||
3752 | bytes.push(str.charCodeAt(i)); | ||
3753 | } | ||
3754 | |||
3755 | return bytes; | ||
3756 | } | ||
3757 | |||
3758 | const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; | ||
3759 | exports.DNS = DNS; | ||
3760 | const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'; | ||
3761 | exports.URL = URL; | ||
3762 | |||
3763 | function _default(name, version, hashfunc) { | ||
3764 | function generateUUID(value, namespace, buf, offset) { | ||
3765 | if (typeof value === 'string') { | ||
3766 | value = stringToBytes(value); | ||
3767 | } | ||
3768 | |||
3769 | if (typeof namespace === 'string') { | ||
3770 | namespace = (0, _parse.default)(namespace); | ||
3771 | } | ||
3772 | |||
3773 | if (namespace.length !== 16) { | ||
3774 | throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)'); | ||
3775 | } // Compute hash of namespace and value, Per 4.3 | ||
3776 | // Future: Use spread syntax when supported on all platforms, e.g. `bytes = | ||
3777 | // hashfunc([...namespace, ... value])` | ||
3778 | |||
3779 | |||
3780 | let bytes = new Uint8Array(16 + value.length); | ||
3781 | bytes.set(namespace); | ||
3782 | bytes.set(value, namespace.length); | ||
3783 | bytes = hashfunc(bytes); | ||
3784 | bytes[6] = bytes[6] & 0x0f | version; | ||
3785 | bytes[8] = bytes[8] & 0x3f | 0x80; | ||
3786 | |||
3787 | if (buf) { | ||
3788 | offset = offset || 0; | ||
3789 | |||
3790 | for (let i = 0; i < 16; ++i) { | ||
3791 | buf[offset + i] = bytes[i]; | ||
3792 | } | ||
3793 | |||
3794 | return buf; | ||
3795 | } | ||
3796 | |||
3797 | return (0, _stringify.default)(bytes); | ||
3798 | } // Function#name is not settable on some platforms (#270) | ||
3799 | |||
3800 | |||
3801 | try { | ||
3802 | generateUUID.name = name; // eslint-disable-next-line no-empty | ||
3803 | } catch (err) {} // For CommonJS default export support | ||
3804 | |||
3805 | |||
3806 | generateUUID.DNS = DNS; | ||
3807 | generateUUID.URL = URL; | ||
3808 | return generateUUID; | ||
3809 | } | ||
3810 | |||
3811 | /***/ }), | ||
3812 | |||
3813 | /***/ 626: | ||
3814 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { | ||
3815 | |||
3816 | |||
3817 | |||
3818 | Object.defineProperty(exports, "__esModule", ({ | ||
3819 | value: true | ||
3820 | })); | ||
3821 | exports["default"] = void 0; | ||
3822 | |||
3823 | var _rng = _interopRequireDefault(__nccwpck_require__(643)); | ||
3824 | |||
3825 | var _stringify = _interopRequireDefault(__nccwpck_require__(541)); | ||
3826 | |||
3827 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
3828 | |||
3829 | function v4(options, buf, offset) { | ||
3830 | options = options || {}; | ||
3831 | |||
3832 | const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` | ||
3833 | |||
3834 | |||
3835 | rnds[6] = rnds[6] & 0x0f | 0x40; | ||
3836 | rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided | ||
3837 | |||
3838 | if (buf) { | ||
3839 | offset = offset || 0; | ||
3840 | |||
3841 | for (let i = 0; i < 16; ++i) { | ||
3842 | buf[offset + i] = rnds[i]; | ||
3843 | } | ||
3844 | |||
3845 | return buf; | ||
3846 | } | ||
3847 | |||
3848 | return (0, _stringify.default)(rnds); | ||
3849 | } | ||
3850 | |||
3851 | var _default = v4; | ||
3852 | exports["default"] = _default; | ||
3853 | |||
3854 | /***/ }), | ||
3855 | |||
3856 | /***/ 420: | ||
3857 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { | ||
3858 | |||
3859 | |||
3860 | |||
3861 | Object.defineProperty(exports, "__esModule", ({ | ||
3862 | value: true | ||
3863 | })); | ||
3864 | exports["default"] = void 0; | ||
3865 | |||
3866 | var _v = _interopRequireDefault(__nccwpck_require__(424)); | ||
3867 | |||
3868 | var _sha = _interopRequireDefault(__nccwpck_require__(746)); | ||
3869 | |||
3870 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
3871 | |||
3872 | const v5 = (0, _v.default)('v5', 0x50, _sha.default); | ||
3873 | var _default = v5; | ||
3874 | exports["default"] = _default; | ||
3875 | |||
3876 | /***/ }), | ||
3877 | |||
3878 | /***/ 206: | ||
3879 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { | ||
3880 | |||
3881 | |||
3882 | |||
3883 | Object.defineProperty(exports, "__esModule", ({ | ||
3884 | value: true | ||
3885 | })); | ||
3886 | exports["default"] = void 0; | ||
3887 | |||
3888 | var _regex = _interopRequireDefault(__nccwpck_require__(122)); | ||
3889 | |||
3890 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
3891 | |||
3892 | function validate(uuid) { | ||
3893 | return typeof uuid === 'string' && _regex.default.test(uuid); | ||
3894 | } | ||
3895 | |||
3896 | var _default = validate; | ||
3897 | exports["default"] = _default; | ||
3898 | |||
3899 | /***/ }), | ||
3900 | |||
3901 | /***/ 927: | ||
3902 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { | ||
3903 | |||
3904 | |||
3905 | |||
3906 | Object.defineProperty(exports, "__esModule", ({ | ||
3907 | value: true | ||
3908 | })); | ||
3909 | exports["default"] = void 0; | ||
3910 | |||
3911 | var _validate = _interopRequireDefault(__nccwpck_require__(206)); | ||
3912 | |||
3913 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
3914 | |||
3915 | function version(uuid) { | ||
3916 | if (!(0, _validate.default)(uuid)) { | ||
3917 | throw TypeError('Invalid UUID'); | ||
3918 | } | ||
3919 | |||
3920 | return parseInt(uuid.substr(14, 1), 16); | ||
3921 | } | ||
3922 | |||
3923 | var _default = version; | ||
3924 | exports["default"] = _default; | ||
3925 | |||
3926 | /***/ }), | ||
3927 | |||
3928 | /***/ 491: | ||
3929 | /***/ ((module) => { | ||
3930 | |||
3931 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("assert"); | ||
3932 | |||
3933 | /***/ }), | ||
3934 | |||
3935 | /***/ 81: | ||
3936 | /***/ ((module) => { | ||
3937 | |||
3938 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("child_process"); | ||
3939 | |||
3940 | /***/ }), | ||
3941 | |||
3942 | /***/ 113: | ||
3943 | /***/ ((module) => { | ||
3944 | |||
3945 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("crypto"); | ||
3946 | |||
3947 | /***/ }), | ||
3948 | |||
3949 | /***/ 361: | ||
3950 | /***/ ((module) => { | ||
3951 | |||
3952 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("events"); | ||
3953 | |||
3954 | /***/ }), | ||
3955 | |||
3956 | /***/ 147: | ||
3957 | /***/ ((module) => { | ||
3958 | |||
3959 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("fs"); | ||
3960 | |||
3961 | /***/ }), | ||
3962 | |||
3963 | /***/ 685: | ||
3964 | /***/ ((module) => { | ||
3965 | |||
3966 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("http"); | ||
3967 | |||
3968 | /***/ }), | ||
3969 | |||
3970 | /***/ 687: | ||
3971 | /***/ ((module) => { | ||
3972 | |||
3973 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("https"); | ||
3974 | |||
3975 | /***/ }), | ||
3976 | |||
3977 | /***/ 808: | ||
3978 | /***/ ((module) => { | ||
3979 | |||
3980 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("net"); | ||
3981 | |||
3982 | /***/ }), | ||
3983 | |||
3984 | /***/ 37: | ||
3985 | /***/ ((module) => { | ||
3986 | |||
3987 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("os"); | ||
3988 | |||
3989 | /***/ }), | ||
3990 | |||
3991 | /***/ 17: | ||
3992 | /***/ ((module) => { | ||
3993 | |||
3994 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("path"); | ||
3995 | |||
3996 | /***/ }), | ||
3997 | |||
3998 | /***/ 576: | ||
3999 | /***/ ((module) => { | ||
4000 | |||
4001 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("string_decoder"); | ||
4002 | |||
4003 | /***/ }), | ||
4004 | |||
4005 | /***/ 512: | ||
4006 | /***/ ((module) => { | ||
4007 | |||
4008 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("timers"); | ||
4009 | |||
4010 | /***/ }), | ||
4011 | |||
4012 | /***/ 404: | ||
4013 | /***/ ((module) => { | ||
4014 | |||
4015 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("tls"); | ||
4016 | |||
4017 | /***/ }), | ||
4018 | |||
4019 | /***/ 837: | ||
4020 | /***/ ((module) => { | ||
4021 | |||
4022 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("util"); | ||
4023 | |||
4024 | /***/ }), | ||
4025 | |||
4026 | /***/ 822: | ||
4027 | /***/ ((__webpack_module__, __unused_webpack___webpack_exports__, __nccwpck_require__) => { | ||
4028 | |||
4029 | __nccwpck_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__) => { | ||
4030 | /* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(954); | ||
4031 | /* harmony import */ var _actions_exec__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(82); | ||
4032 | |||
4033 | |||
4034 | |||
4035 | function isSemverGreater(a, b) { | ||
4036 | console.log( | ||
4037 | 'comparing ', | ||
4038 | a, | ||
4039 | 'and', | ||
4040 | b, | ||
4041 | ': ', | ||
4042 | a.localeCompare(b, undefined, { numeric: true }), | ||
4043 | ); | ||
4044 | return a.localeCompare(b, undefined, { numeric: true }) === 1; | ||
4045 | } | ||
4046 | |||
4047 | async function readFileFromGitBranch(branch, filename) { | ||
4048 | let output = ''; | ||
4049 | |||
4050 | const options = { | ||
4051 | silent: true, | ||
4052 | listeners: { | ||
4053 | stdout: data => { | ||
4054 | output += data.toString(); | ||
4055 | }, | ||
4056 | }, | ||
4057 | }; | ||
4058 | |||
4059 | await _actions_exec__WEBPACK_IMPORTED_MODULE_1__.exec('git', ['show', `${branch}:${filename}`], options); | ||
4060 | |||
4061 | return output; | ||
4062 | } | ||
4063 | |||
4064 | try { | ||
4065 | const changedFilesString = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput('changed-files'); | ||
4066 | const changedFiles = JSON.parse(changedFilesString); | ||
4067 | |||
4068 | const changedFilesInRecipes = changedFiles | ||
4069 | .filter(filename => filename.startsWith('recipes/')) | ||
4070 | .map(filename => filename.slice('recipes/'.length)); | ||
4071 | |||
4072 | const changedRecipes = [ | ||
4073 | ...new Set( | ||
4074 | changedFilesInRecipes | ||
4075 | .map(filename => filename.replace(/\/(.*)$/, '')) | ||
4076 | .sort(), | ||
4077 | ), | ||
4078 | ]; | ||
4079 | |||
4080 | const notBumpedUpRecipes = {}; | ||
4081 | for (const recipe of changedRecipes) { | ||
4082 | const packageJsonPath = `recipes/${recipe}/package.json`; | ||
4083 | |||
4084 | if (!changedFiles.includes(packageJsonPath)) { | ||
4085 | notBumpedUpRecipes[recipe] = 'package.json not updated'; | ||
4086 | continue; | ||
4087 | } | ||
4088 | |||
4089 | // Check differences | ||
4090 | const packageMain = JSON.parse( | ||
4091 | await readFileFromGitBranch('origin/main', packageJsonPath), | ||
4092 | ); | ||
4093 | const packageCurrent = JSON.parse( | ||
4094 | await readFileFromGitBranch('HEAD', packageJsonPath), | ||
4095 | ); | ||
4096 | |||
4097 | if (!isSemverGreater(packageCurrent.version, packageMain.version)) { | ||
4098 | notBumpedUpRecipes[ | ||
4099 | recipe | ||
4100 | ] = `${packageCurrent.version} is not greater than ${packageMain.version}`; | ||
4101 | continue; | ||
4102 | } | ||
4103 | } | ||
4104 | |||
4105 | if (Object.keys(notBumpedUpRecipes).length !== 0) { | ||
4106 | _actions_core__WEBPACK_IMPORTED_MODULE_0__.setFailed( | ||
4107 | 'The following recipes should have their version bumped: ' + | ||
4108 | Object.keys(notBumpedUpRecipes).join(', ') + | ||
4109 | '. Please check the contributing guide: https://github.com/ferdium/ferdium-recipes/blob/main/docs/updating.md' + | ||
4110 | '\n' + | ||
4111 | JSON.stringify(notBumpedUpRecipes, undefined, 2), | ||
4112 | ); | ||
4113 | } | ||
4114 | } catch (error) { | ||
4115 | _actions_core__WEBPACK_IMPORTED_MODULE_0__.setFailed(error.message); | ||
4116 | } | ||
4117 | |||
4118 | __webpack_handle_async_dependencies__(); | ||
4119 | }, 1); | ||
4120 | |||
4121 | /***/ }) | ||
4122 | |||
4123 | /******/ }); | ||
4124 | /************************************************************************/ | ||
4125 | /******/ // The module cache | ||
4126 | /******/ var __webpack_module_cache__ = {}; | ||
4127 | /******/ | ||
4128 | /******/ // The require function | ||
4129 | /******/ function __nccwpck_require__(moduleId) { | ||
4130 | /******/ // Check if module is in cache | ||
4131 | /******/ var cachedModule = __webpack_module_cache__[moduleId]; | ||
4132 | /******/ if (cachedModule !== undefined) { | ||
4133 | /******/ return cachedModule.exports; | ||
4134 | /******/ } | ||
4135 | /******/ // Create a new module (and put it into the cache) | ||
4136 | /******/ var module = __webpack_module_cache__[moduleId] = { | ||
4137 | /******/ // no module.id needed | ||
4138 | /******/ // no module.loaded needed | ||
4139 | /******/ exports: {} | ||
4140 | /******/ }; | ||
4141 | /******/ | ||
4142 | /******/ // Execute the module function | ||
4143 | /******/ var threw = true; | ||
4144 | /******/ try { | ||
4145 | /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nccwpck_require__); | ||
4146 | /******/ threw = false; | ||
4147 | /******/ } finally { | ||
4148 | /******/ if(threw) delete __webpack_module_cache__[moduleId]; | ||
4149 | /******/ } | ||
4150 | /******/ | ||
4151 | /******/ // Return the exports of the module | ||
4152 | /******/ return module.exports; | ||
4153 | /******/ } | ||
4154 | /******/ | ||
4155 | /************************************************************************/ | ||
4156 | /******/ /* webpack/runtime/async module */ | ||
4157 | /******/ (() => { | ||
4158 | /******/ var webpackThen = typeof Symbol === "function" ? Symbol("webpack then") : "__webpack_then__"; | ||
4159 | /******/ var webpackExports = typeof Symbol === "function" ? Symbol("webpack exports") : "__webpack_exports__"; | ||
4160 | /******/ var completeQueue = (queue) => { | ||
4161 | /******/ if(queue) { | ||
4162 | /******/ queue.forEach((fn) => (fn.r--)); | ||
4163 | /******/ queue.forEach((fn) => (fn.r-- ? fn.r++ : fn())); | ||
4164 | /******/ } | ||
4165 | /******/ } | ||
4166 | /******/ var completeFunction = (fn) => (!--fn.r && fn()); | ||
4167 | /******/ var queueFunction = (queue, fn) => (queue ? queue.push(fn) : completeFunction(fn)); | ||
4168 | /******/ var wrapDeps = (deps) => (deps.map((dep) => { | ||
4169 | /******/ if(dep !== null && typeof dep === "object") { | ||
4170 | /******/ if(dep[webpackThen]) return dep; | ||
4171 | /******/ if(dep.then) { | ||
4172 | /******/ var queue = []; | ||
4173 | /******/ dep.then((r) => { | ||
4174 | /******/ obj[webpackExports] = r; | ||
4175 | /******/ completeQueue(queue); | ||
4176 | /******/ queue = 0; | ||
4177 | /******/ }); | ||
4178 | /******/ var obj = {}; | ||
4179 | /******/ obj[webpackThen] = (fn, reject) => (queueFunction(queue, fn), dep['catch'](reject)); | ||
4180 | /******/ return obj; | ||
4181 | /******/ } | ||
4182 | /******/ } | ||
4183 | /******/ var ret = {}; | ||
4184 | /******/ ret[webpackThen] = (fn) => (completeFunction(fn)); | ||
4185 | /******/ ret[webpackExports] = dep; | ||
4186 | /******/ return ret; | ||
4187 | /******/ })); | ||
4188 | /******/ __nccwpck_require__.a = (module, body, hasAwait) => { | ||
4189 | /******/ var queue = hasAwait && []; | ||
4190 | /******/ var exports = module.exports; | ||
4191 | /******/ var currentDeps; | ||
4192 | /******/ var outerResolve; | ||
4193 | /******/ var reject; | ||
4194 | /******/ var isEvaluating = true; | ||
4195 | /******/ var nested = false; | ||
4196 | /******/ var whenAll = (deps, onResolve, onReject) => { | ||
4197 | /******/ if (nested) return; | ||
4198 | /******/ nested = true; | ||
4199 | /******/ onResolve.r += deps.length; | ||
4200 | /******/ deps.map((dep, i) => (dep[webpackThen](onResolve, onReject))); | ||
4201 | /******/ nested = false; | ||
4202 | /******/ }; | ||
4203 | /******/ var promise = new Promise((resolve, rej) => { | ||
4204 | /******/ reject = rej; | ||
4205 | /******/ outerResolve = () => (resolve(exports), completeQueue(queue), queue = 0); | ||
4206 | /******/ }); | ||
4207 | /******/ promise[webpackExports] = exports; | ||
4208 | /******/ promise[webpackThen] = (fn, rejectFn) => { | ||
4209 | /******/ if (isEvaluating) { return completeFunction(fn); } | ||
4210 | /******/ if (currentDeps) whenAll(currentDeps, fn, rejectFn); | ||
4211 | /******/ queueFunction(queue, fn); | ||
4212 | /******/ promise['catch'](rejectFn); | ||
4213 | /******/ }; | ||
4214 | /******/ module.exports = promise; | ||
4215 | /******/ body((deps) => { | ||
4216 | /******/ if(!deps) return outerResolve(); | ||
4217 | /******/ currentDeps = wrapDeps(deps); | ||
4218 | /******/ var fn, result; | ||
4219 | /******/ var promise = new Promise((resolve, reject) => { | ||
4220 | /******/ fn = () => (resolve(result = currentDeps.map((d) => (d[webpackExports])))); | ||
4221 | /******/ fn.r = 0; | ||
4222 | /******/ whenAll(currentDeps, fn, reject); | ||
4223 | /******/ }); | ||
4224 | /******/ return fn.r ? promise : result; | ||
4225 | /******/ }).then(outerResolve, reject); | ||
4226 | /******/ isEvaluating = false; | ||
4227 | /******/ }; | ||
4228 | /******/ })(); | ||
4229 | /******/ | ||
4230 | /******/ /* webpack/runtime/compat */ | ||
4231 | /******/ | ||
4232 | /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = new URL('.', import.meta.url).pathname.slice(import.meta.url.match(/^file:\/\/\/\w:/) ? 1 : 0, -1) + "/"; | ||
4233 | /******/ | ||
4234 | /************************************************************************/ | ||
4235 | /******/ | ||
4236 | /******/ // startup | ||
4237 | /******/ // Load entry module and return exports | ||
4238 | /******/ // This entry module used 'module' so it can't be inlined | ||
4239 | /******/ var __webpack_exports__ = __nccwpck_require__(822); | ||
4240 | /******/ __webpack_exports__ = await __webpack_exports__; | ||
4241 | /******/ | ||
diff --git a/.github/workflows/check-recipe-version-bump/dist/licenses.txt b/.github/workflows/check-recipe-version-bump/dist/licenses.txt new file mode 100644 index 0000000..d771846 --- /dev/null +++ b/.github/workflows/check-recipe-version-bump/dist/licenses.txt | |||
@@ -0,0 +1,97 @@ | |||
1 | @actions/core | ||
2 | MIT | ||
3 | The MIT License (MIT) | ||
4 | |||
5 | Copyright 2019 GitHub | ||
6 | |||
7 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
8 | |||
9 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
10 | |||
11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
12 | |||
13 | @actions/exec | ||
14 | MIT | ||
15 | The MIT License (MIT) | ||
16 | |||
17 | Copyright 2019 GitHub | ||
18 | |||
19 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
20 | |||
21 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
22 | |||
23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
24 | |||
25 | @actions/http-client | ||
26 | MIT | ||
27 | Actions Http Client for Node.js | ||
28 | |||
29 | Copyright (c) GitHub, Inc. | ||
30 | |||
31 | All rights reserved. | ||
32 | |||
33 | MIT License | ||
34 | |||
35 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and | ||
36 | associated documentation files (the "Software"), to deal in the Software without restriction, | ||
37 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
38 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, | ||
39 | subject to the following conditions: | ||
40 | |||
41 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
42 | |||
43 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT | ||
44 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | ||
45 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
46 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
47 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
48 | |||
49 | |||
50 | @actions/io | ||
51 | MIT | ||
52 | The MIT License (MIT) | ||
53 | |||
54 | Copyright 2019 GitHub | ||
55 | |||
56 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
57 | |||
58 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
59 | |||
60 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
61 | |||
62 | tunnel | ||
63 | MIT | ||
64 | The MIT License (MIT) | ||
65 | |||
66 | Copyright (c) 2012 Koichi Kobayashi | ||
67 | |||
68 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
69 | of this software and associated documentation files (the "Software"), to deal | ||
70 | in the Software without restriction, including without limitation the rights | ||
71 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
72 | copies of the Software, and to permit persons to whom the Software is | ||
73 | furnished to do so, subject to the following conditions: | ||
74 | |||
75 | The above copyright notice and this permission notice shall be included in | ||
76 | all copies or substantial portions of the Software. | ||
77 | |||
78 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
79 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
80 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
81 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
82 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
83 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
84 | THE SOFTWARE. | ||
85 | |||
86 | |||
87 | uuid | ||
88 | MIT | ||
89 | The MIT License (MIT) | ||
90 | |||
91 | Copyright (c) 2010-2020 Robert Kieffer and other contributors | ||
92 | |||
93 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
94 | |||
95 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
96 | |||
97 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
diff --git a/.github/workflows/check-recipe-version-bump/dist/package.json b/.github/workflows/check-recipe-version-bump/dist/package.json new file mode 100644 index 0000000..3dbc1ca --- /dev/null +++ b/.github/workflows/check-recipe-version-bump/dist/package.json | |||
@@ -0,0 +1,3 @@ | |||
1 | { | ||
2 | "type": "module" | ||
3 | } | ||