From 9917e78720ae4d8a180814cb755ca5a1acf4800c Mon Sep 17 00:00:00 2001 From: actions-bot <58130806+actions-bot@users.noreply.github.com> Date: Tue, 7 Jan 2025 12:12:10 +0000 Subject: [PATCH] build: update distribution --- dist/index.js | 223 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 205 insertions(+), 18 deletions(-) diff --git a/dist/index.js b/dist/index.js index 558f1a0832..d7a897f7ee 100644 --- a/dist/index.js +++ b/dist/index.js @@ -31754,6 +31754,184 @@ function parseParams (str) { module.exports = parseParams +/***/ }), + +/***/ 8739: +/***/ ((module) => { + +"use strict"; +var __webpack_unused_export__; + + +const NullObject = function NullObject () { } +NullObject.prototype = Object.create(null) + +/** + * RegExp to match *( ";" parameter ) in RFC 7231 sec 3.1.1.1 + * + * parameter = token "=" ( token / quoted-string ) + * token = 1*tchar + * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" + * / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" + * / DIGIT / ALPHA + * ; any VCHAR, except delimiters + * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE + * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text + * obs-text = %x80-FF + * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text ) + */ +const paramRE = /; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu + +/** + * RegExp to match quoted-pair in RFC 7230 sec 3.2.6 + * + * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text ) + * obs-text = %x80-FF + */ +const quotedPairRE = /\\([\v\u0020-\u00ff])/gu + +/** + * RegExp to match type in RFC 7231 sec 3.1.1.1 + * + * media-type = type "/" subtype + * type = token + * subtype = token + */ +const mediaTypeRE = /^[!#$%&'*+.^\w|~-]+\/[!#$%&'*+.^\w|~-]+$/u + +// default ContentType to prevent repeated object creation +const defaultContentType = { type: '', parameters: new NullObject() } +Object.freeze(defaultContentType.parameters) +Object.freeze(defaultContentType) + +/** + * Parse media type to object. + * + * @param {string|object} header + * @return {Object} + * @public + */ + +function parse (header) { + if (typeof header !== 'string') { + throw new TypeError('argument header is required and must be a string') + } + + let index = header.indexOf(';') + const type = index !== -1 + ? header.slice(0, index).trim() + : header.trim() + + if (mediaTypeRE.test(type) === false) { + throw new TypeError('invalid media type') + } + + const result = { + type: type.toLowerCase(), + parameters: new NullObject() + } + + // parse parameters + if (index === -1) { + return result + } + + let key + let match + let value + + paramRE.lastIndex = index + + while ((match = paramRE.exec(header))) { + if (match.index !== index) { + throw new TypeError('invalid parameter format') + } + + index += match[0].length + key = match[1].toLowerCase() + value = match[2] + + if (value[0] === '"') { + // remove quotes and escapes + value = value + .slice(1, value.length - 1) + + quotedPairRE.test(value) && (value = value.replace(quotedPairRE, '$1')) + } + + result.parameters[key] = value + } + + if (index !== header.length) { + throw new TypeError('invalid parameter format') + } + + return result +} + +function safeParse (header) { + if (typeof header !== 'string') { + return defaultContentType + } + + let index = header.indexOf(';') + const type = index !== -1 + ? header.slice(0, index).trim() + : header.trim() + + if (mediaTypeRE.test(type) === false) { + return defaultContentType + } + + const result = { + type: type.toLowerCase(), + parameters: new NullObject() + } + + // parse parameters + if (index === -1) { + return result + } + + let key + let match + let value + + paramRE.lastIndex = index + + while ((match = paramRE.exec(header))) { + if (match.index !== index) { + return defaultContentType + } + + index += match[0].length + key = match[1].toLowerCase() + value = match[2] + + if (value[0] === '"') { + // remove quotes and escapes + value = value + .slice(1, value.length - 1) + + quotedPairRE.test(value) && (value = value.replace(quotedPairRE, '$1')) + } + + result.parameters[key] = value + } + + if (index !== header.length) { + return defaultContentType + } + + return result +} + +__webpack_unused_export__ = { parse, safeParse } +__webpack_unused_export__ = parse +module.exports.xL = safeParse +__webpack_unused_export__ = defaultContentType + + /***/ }), /***/ 3247: @@ -32087,13 +32265,10 @@ function lowercaseKeys(object) { // pkg/dist-src/util/is-plain-object.js function isPlainObject(value) { - if (typeof value !== "object" || value === null) - return false; - if (Object.prototype.toString.call(value) !== "[object Object]") - return false; + if (typeof value !== "object" || value === null) return false; + if (Object.prototype.toString.call(value) !== "[object Object]") return false; const proto = Object.getPrototypeOf(value); - if (proto === null) - return true; + if (proto === null) return true; const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); } @@ -32103,10 +32278,8 @@ function mergeDeep(defaults, options) { const result = Object.assign({}, defaults); Object.keys(options).forEach((key) => { if (isPlainObject(options[key])) { - if (!(key in defaults)) - Object.assign(result, { [key]: options[key] }); - else - result[key] = mergeDeep(defaults[key], options[key]); + if (!(key in defaults)) Object.assign(result, { [key]: options[key] }); + else result[key] = mergeDeep(defaults[key], options[key]); } else { Object.assign(result, { [key]: options[key] }); } @@ -32404,6 +32577,8 @@ function withDefaults(oldDefaults, newDefaults) { var endpoint = withDefaults(null, DEFAULTS); +// EXTERNAL MODULE: ./node_modules/fast-content-type-parse/index.js +var fast_content_type_parse = __nccwpck_require__(8739); ;// CONCATENATED MODULE: ./node_modules/@octokit/request-error/dist-src/index.js class RequestError extends Error { name; @@ -32461,6 +32636,9 @@ var defaults_default = { } }; +// pkg/dist-src/fetch-wrapper.js + + // pkg/dist-src/is-plain-object.js function dist_bundle_isPlainObject(value) { if (typeof value !== "object" || value === null) return false; @@ -32573,13 +32751,23 @@ async function fetchWrapper(requestOptions) { } async function getResponseData(response) { const contentType = response.headers.get("content-type"); - if (/application\/json/.test(contentType)) { - return response.json().catch(() => response.text()).catch(() => ""); + if (!contentType) { + return response.text().catch(() => ""); } - if (!contentType || /^text\/|charset=utf-8$/.test(contentType)) { - return response.text(); + const mimetype = (0,fast_content_type_parse/* safeParse */.xL)(contentType); + if (mimetype.type === "application/json") { + let text = ""; + try { + text = await response.text(); + return JSON.parse(text); + } catch (err) { + return text; + } + } else if (mimetype.type.startsWith("text/") || mimetype.parameters.charset?.toLowerCase() === "utf-8") { + return response.text().catch(() => ""); + } else { + return response.arrayBuffer().catch(() => new ArrayBuffer(0)); } - return response.arrayBuffer(); } function toErrorMessage(data) { if (typeof data === "string") { @@ -32680,8 +32868,7 @@ function graphql(request2, query, options) { ); } for (const key in options) { - if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key)) - continue; + if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key)) continue; return Promise.reject( new Error( `[@octokit/graphql] "${key}" cannot be used as variable name` @@ -32804,7 +32991,7 @@ var createTokenAuth = function createTokenAuth2(token) { ;// CONCATENATED MODULE: ./node_modules/@octokit/core/dist-src/version.js -const version_VERSION = "6.1.2"; +const version_VERSION = "6.1.3"; ;// CONCATENATED MODULE: ./node_modules/@octokit/core/dist-src/index.js