@@ -53296,6 +53296,293 @@ DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() {
5329653296};
5329753297
5329853298
53299+ /***/ }),
53300+
53301+ /***/ 5756:
53302+ /***/ ((module) => {
53303+
53304+ const { hasOwnProperty } = Object.prototype
53305+
53306+ const encode = (obj, opt = {}) => {
53307+ if (typeof opt === 'string') {
53308+ opt = { section: opt }
53309+ }
53310+ opt.align = opt.align === true
53311+ opt.newline = opt.newline === true
53312+ opt.sort = opt.sort === true
53313+ opt.whitespace = opt.whitespace === true || opt.align === true
53314+ // The `typeof` check is required because accessing the `process` directly fails on browsers.
53315+ /* istanbul ignore next */
53316+ opt.platform = opt.platform || (typeof process !== 'undefined' && process.platform)
53317+ opt.bracketedArray = opt.bracketedArray !== false
53318+
53319+ /* istanbul ignore next */
53320+ const eol = opt.platform === 'win32' ? '\r\n' : '\n'
53321+ const separator = opt.whitespace ? ' = ' : '='
53322+ const children = []
53323+
53324+ const keys = opt.sort ? Object.keys(obj).sort() : Object.keys(obj)
53325+
53326+ let padToChars = 0
53327+ // If aligning on the separator, then padToChars is determined as follows:
53328+ // 1. Get the keys
53329+ // 2. Exclude keys pointing to objects unless the value is null or an array
53330+ // 3. Add `[]` to array keys
53331+ // 4. Ensure non empty set of keys
53332+ // 5. Reduce the set to the longest `safe` key
53333+ // 6. Get the `safe` length
53334+ if (opt.align) {
53335+ padToChars = safe(
53336+ (
53337+ keys
53338+ .filter(k => obj[k] === null || Array.isArray(obj[k]) || typeof obj[k] !== 'object')
53339+ .map(k => Array.isArray(obj[k]) ? `${k}[]` : k)
53340+ )
53341+ .concat([''])
53342+ .reduce((a, b) => safe(a).length >= safe(b).length ? a : b)
53343+ ).length
53344+ }
53345+
53346+ let out = ''
53347+ const arraySuffix = opt.bracketedArray ? '[]' : ''
53348+
53349+ for (const k of keys) {
53350+ const val = obj[k]
53351+ if (val && Array.isArray(val)) {
53352+ for (const item of val) {
53353+ out += safe(`${k}${arraySuffix}`).padEnd(padToChars, ' ') + separator + safe(item) + eol
53354+ }
53355+ } else if (val && typeof val === 'object') {
53356+ children.push(k)
53357+ } else {
53358+ out += safe(k).padEnd(padToChars, ' ') + separator + safe(val) + eol
53359+ }
53360+ }
53361+
53362+ if (opt.section && out.length) {
53363+ out = '[' + safe(opt.section) + ']' + (opt.newline ? eol + eol : eol) + out
53364+ }
53365+
53366+ for (const k of children) {
53367+ const nk = splitSections(k, '.').join('\\.')
53368+ const section = (opt.section ? opt.section + '.' : '') + nk
53369+ const child = encode(obj[k], {
53370+ ...opt,
53371+ section,
53372+ })
53373+ if (out.length && child.length) {
53374+ out += eol
53375+ }
53376+
53377+ out += child
53378+ }
53379+
53380+ return out
53381+ }
53382+
53383+ function splitSections (str, separator) {
53384+ var lastMatchIndex = 0
53385+ var lastSeparatorIndex = 0
53386+ var nextIndex = 0
53387+ var sections = []
53388+
53389+ do {
53390+ nextIndex = str.indexOf(separator, lastMatchIndex)
53391+
53392+ if (nextIndex !== -1) {
53393+ lastMatchIndex = nextIndex + separator.length
53394+
53395+ if (nextIndex > 0 && str[nextIndex - 1] === '\\') {
53396+ continue
53397+ }
53398+
53399+ sections.push(str.slice(lastSeparatorIndex, nextIndex))
53400+ lastSeparatorIndex = nextIndex + separator.length
53401+ }
53402+ } while (nextIndex !== -1)
53403+
53404+ sections.push(str.slice(lastSeparatorIndex))
53405+
53406+ return sections
53407+ }
53408+
53409+ const decode = (str, opt = {}) => {
53410+ opt.bracketedArray = opt.bracketedArray !== false
53411+ const out = Object.create(null)
53412+ let p = out
53413+ let section = null
53414+ // section |key = value
53415+ const re = /^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i
53416+ const lines = str.split(/[\r\n]+/g)
53417+ const duplicates = {}
53418+
53419+ for (const line of lines) {
53420+ if (!line || line.match(/^\s*[;#]/) || line.match(/^\s*$/)) {
53421+ continue
53422+ }
53423+ const match = line.match(re)
53424+ if (!match) {
53425+ continue
53426+ }
53427+ if (match[1] !== undefined) {
53428+ section = unsafe(match[1])
53429+ if (section === '__proto__') {
53430+ // not allowed
53431+ // keep parsing the section, but don't attach it.
53432+ p = Object.create(null)
53433+ continue
53434+ }
53435+ p = out[section] = out[section] || Object.create(null)
53436+ continue
53437+ }
53438+ const keyRaw = unsafe(match[2])
53439+ let isArray
53440+ if (opt.bracketedArray) {
53441+ isArray = keyRaw.length > 2 && keyRaw.slice(-2) === '[]'
53442+ } else {
53443+ duplicates[keyRaw] = (duplicates?.[keyRaw] || 0) + 1
53444+ isArray = duplicates[keyRaw] > 1
53445+ }
53446+ const key = isArray && keyRaw.endsWith('[]')
53447+ ? keyRaw.slice(0, -2) : keyRaw
53448+
53449+ if (key === '__proto__') {
53450+ continue
53451+ }
53452+ const valueRaw = match[3] ? unsafe(match[4]) : true
53453+ const value = valueRaw === 'true' ||
53454+ valueRaw === 'false' ||
53455+ valueRaw === 'null' ? JSON.parse(valueRaw)
53456+ : valueRaw
53457+
53458+ // Convert keys with '[]' suffix to an array
53459+ if (isArray) {
53460+ if (!hasOwnProperty.call(p, key)) {
53461+ p[key] = []
53462+ } else if (!Array.isArray(p[key])) {
53463+ p[key] = [p[key]]
53464+ }
53465+ }
53466+
53467+ // safeguard against resetting a previously defined
53468+ // array by accidentally forgetting the brackets
53469+ if (Array.isArray(p[key])) {
53470+ p[key].push(value)
53471+ } else {
53472+ p[key] = value
53473+ }
53474+ }
53475+
53476+ // {a:{y:1},"a.b":{x:2}} --> {a:{y:1,b:{x:2}}}
53477+ // use a filter to return the keys that have to be deleted.
53478+ const remove = []
53479+ for (const k of Object.keys(out)) {
53480+ if (!hasOwnProperty.call(out, k) ||
53481+ typeof out[k] !== 'object' ||
53482+ Array.isArray(out[k])) {
53483+ continue
53484+ }
53485+
53486+ // see if the parent section is also an object.
53487+ // if so, add it to that, and mark this one for deletion
53488+ const parts = splitSections(k, '.')
53489+ p = out
53490+ const l = parts.pop()
53491+ const nl = l.replace(/\\\./g, '.')
53492+ for (const part of parts) {
53493+ if (part === '__proto__') {
53494+ continue
53495+ }
53496+ if (!hasOwnProperty.call(p, part) || typeof p[part] !== 'object') {
53497+ p[part] = Object.create(null)
53498+ }
53499+ p = p[part]
53500+ }
53501+ if (p === out && nl === l) {
53502+ continue
53503+ }
53504+
53505+ p[nl] = out[k]
53506+ remove.push(k)
53507+ }
53508+ for (const del of remove) {
53509+ delete out[del]
53510+ }
53511+
53512+ return out
53513+ }
53514+
53515+ const isQuoted = val => {
53516+ return (val.startsWith('"') && val.endsWith('"')) ||
53517+ (val.startsWith("'") && val.endsWith("'"))
53518+ }
53519+
53520+ const safe = val => {
53521+ if (
53522+ typeof val !== 'string' ||
53523+ val.match(/[=\r\n]/) ||
53524+ val.match(/^\[/) ||
53525+ (val.length > 1 && isQuoted(val)) ||
53526+ val !== val.trim()
53527+ ) {
53528+ return JSON.stringify(val)
53529+ }
53530+ return val.split(';').join('\\;').split('#').join('\\#')
53531+ }
53532+
53533+ const unsafe = val => {
53534+ val = (val || '').trim()
53535+ if (isQuoted(val)) {
53536+ // remove the single quotes before calling JSON.parse
53537+ if (val.charAt(0) === "'") {
53538+ val = val.slice(1, -1)
53539+ }
53540+ try {
53541+ val = JSON.parse(val)
53542+ } catch {
53543+ // ignore errors
53544+ }
53545+ } else {
53546+ // walk the val to find the first not-escaped ; character
53547+ let esc = false
53548+ let unesc = ''
53549+ for (let i = 0, l = val.length; i < l; i++) {
53550+ const c = val.charAt(i)
53551+ if (esc) {
53552+ if ('\\;#'.indexOf(c) !== -1) {
53553+ unesc += c
53554+ } else {
53555+ unesc += '\\' + c
53556+ }
53557+
53558+ esc = false
53559+ } else if (';#'.indexOf(c) !== -1) {
53560+ break
53561+ } else if (c === '\\') {
53562+ esc = true
53563+ } else {
53564+ unesc += c
53565+ }
53566+ }
53567+ if (esc) {
53568+ unesc += '\\'
53569+ }
53570+
53571+ return unesc.trim()
53572+ }
53573+ return val
53574+ }
53575+
53576+ module.exports = {
53577+ parse: decode,
53578+ decode,
53579+ stringify: encode,
53580+ encode,
53581+ safe,
53582+ unsafe,
53583+ }
53584+
53585+
5329953586/***/ }),
5330053587
5330153588/***/ 9829:
@@ -88327,6 +88614,7 @@ const core = __importStar(__nccwpck_require__(7484));
8832788614const exec = __importStar(__nccwpck_require__(5236));
8832888615const io = __importStar(__nccwpck_require__(4994));
8832988616const fs_1 = __importDefault(__nccwpck_require__(9896));
88617+ const INI = __importStar(__nccwpck_require__(5756));
8833088618const path_1 = __importDefault(__nccwpck_require__(6928));
8833188619function getNodeVersionFromFile(versionFilePath) {
8833288620 var _a, _b, _c, _d, _e;
@@ -88369,6 +88657,22 @@ function getNodeVersionFromFile(versionFilePath) {
8836988657 catch (_f) {
8837088658 core.info('Node version file is not JSON file');
8837188659 }
88660+ // Try parsing the file as an NPM `.npmrc` file.
88661+ //
88662+ // If the file contents contain the use-node-version key, we conclude it's an
88663+ // `.npmrc` file.
88664+ if (contents.match(/use-node-version *=/)) {
88665+ const manifest = INI.parse(contents);
88666+ const key = 'use-node-version';
88667+ if (key in manifest && typeof manifest[key] === 'string') {
88668+ const version = manifest[key];
88669+ core.info(`Using node version ${version} from global INI ${key}`);
88670+ return version;
88671+ }
88672+ // We didn't find the key `use-node-version` in the global scope of the
88673+ // `.npmrc` file, so we return.
88674+ return null;
88675+ }
8837288676 const found = contents.match(/^(?:node(js)?\s+)?v?(?<version>[^\s]+)$/m);
8837388677 return (_e = (_d = found === null || found === void 0 ? void 0 : found.groups) === null || _d === void 0 ? void 0 : _d.version) !== null && _e !== void 0 ? _e : contents.trim();
8837488678}
0 commit comments