@@ -49050,6 +49050,293 @@ DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() {
4905049050};
4905149051
4905249052
49053+ /***/ }),
49054+
49055+ /***/ 45:
49056+ /***/ ((module) => {
49057+
49058+ const { hasOwnProperty } = Object.prototype
49059+
49060+ const encode = (obj, opt = {}) => {
49061+ if (typeof opt === 'string') {
49062+ opt = { section: opt }
49063+ }
49064+ opt.align = opt.align === true
49065+ opt.newline = opt.newline === true
49066+ opt.sort = opt.sort === true
49067+ opt.whitespace = opt.whitespace === true || opt.align === true
49068+ // The `typeof` check is required because accessing the `process` directly fails on browsers.
49069+ /* istanbul ignore next */
49070+ opt.platform = opt.platform || (typeof process !== 'undefined' && process.platform)
49071+ opt.bracketedArray = opt.bracketedArray !== false
49072+
49073+ /* istanbul ignore next */
49074+ const eol = opt.platform === 'win32' ? '\r\n' : '\n'
49075+ const separator = opt.whitespace ? ' = ' : '='
49076+ const children = []
49077+
49078+ const keys = opt.sort ? Object.keys(obj).sort() : Object.keys(obj)
49079+
49080+ let padToChars = 0
49081+ // If aligning on the separator, then padToChars is determined as follows:
49082+ // 1. Get the keys
49083+ // 2. Exclude keys pointing to objects unless the value is null or an array
49084+ // 3. Add `[]` to array keys
49085+ // 4. Ensure non empty set of keys
49086+ // 5. Reduce the set to the longest `safe` key
49087+ // 6. Get the `safe` length
49088+ if (opt.align) {
49089+ padToChars = safe(
49090+ (
49091+ keys
49092+ .filter(k => obj[k] === null || Array.isArray(obj[k]) || typeof obj[k] !== 'object')
49093+ .map(k => Array.isArray(obj[k]) ? `${k}[]` : k)
49094+ )
49095+ .concat([''])
49096+ .reduce((a, b) => safe(a).length >= safe(b).length ? a : b)
49097+ ).length
49098+ }
49099+
49100+ let out = ''
49101+ const arraySuffix = opt.bracketedArray ? '[]' : ''
49102+
49103+ for (const k of keys) {
49104+ const val = obj[k]
49105+ if (val && Array.isArray(val)) {
49106+ for (const item of val) {
49107+ out += safe(`${k}${arraySuffix}`).padEnd(padToChars, ' ') + separator + safe(item) + eol
49108+ }
49109+ } else if (val && typeof val === 'object') {
49110+ children.push(k)
49111+ } else {
49112+ out += safe(k).padEnd(padToChars, ' ') + separator + safe(val) + eol
49113+ }
49114+ }
49115+
49116+ if (opt.section && out.length) {
49117+ out = '[' + safe(opt.section) + ']' + (opt.newline ? eol + eol : eol) + out
49118+ }
49119+
49120+ for (const k of children) {
49121+ const nk = splitSections(k, '.').join('\\.')
49122+ const section = (opt.section ? opt.section + '.' : '') + nk
49123+ const child = encode(obj[k], {
49124+ ...opt,
49125+ section,
49126+ })
49127+ if (out.length && child.length) {
49128+ out += eol
49129+ }
49130+
49131+ out += child
49132+ }
49133+
49134+ return out
49135+ }
49136+
49137+ function splitSections (str, separator) {
49138+ var lastMatchIndex = 0
49139+ var lastSeparatorIndex = 0
49140+ var nextIndex = 0
49141+ var sections = []
49142+
49143+ do {
49144+ nextIndex = str.indexOf(separator, lastMatchIndex)
49145+
49146+ if (nextIndex !== -1) {
49147+ lastMatchIndex = nextIndex + separator.length
49148+
49149+ if (nextIndex > 0 && str[nextIndex - 1] === '\\') {
49150+ continue
49151+ }
49152+
49153+ sections.push(str.slice(lastSeparatorIndex, nextIndex))
49154+ lastSeparatorIndex = nextIndex + separator.length
49155+ }
49156+ } while (nextIndex !== -1)
49157+
49158+ sections.push(str.slice(lastSeparatorIndex))
49159+
49160+ return sections
49161+ }
49162+
49163+ const decode = (str, opt = {}) => {
49164+ opt.bracketedArray = opt.bracketedArray !== false
49165+ const out = Object.create(null)
49166+ let p = out
49167+ let section = null
49168+ // section |key = value
49169+ const re = /^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i
49170+ const lines = str.split(/[\r\n]+/g)
49171+ const duplicates = {}
49172+
49173+ for (const line of lines) {
49174+ if (!line || line.match(/^\s*[;#]/) || line.match(/^\s*$/)) {
49175+ continue
49176+ }
49177+ const match = line.match(re)
49178+ if (!match) {
49179+ continue
49180+ }
49181+ if (match[1] !== undefined) {
49182+ section = unsafe(match[1])
49183+ if (section === '__proto__') {
49184+ // not allowed
49185+ // keep parsing the section, but don't attach it.
49186+ p = Object.create(null)
49187+ continue
49188+ }
49189+ p = out[section] = out[section] || Object.create(null)
49190+ continue
49191+ }
49192+ const keyRaw = unsafe(match[2])
49193+ let isArray
49194+ if (opt.bracketedArray) {
49195+ isArray = keyRaw.length > 2 && keyRaw.slice(-2) === '[]'
49196+ } else {
49197+ duplicates[keyRaw] = (duplicates?.[keyRaw] || 0) + 1
49198+ isArray = duplicates[keyRaw] > 1
49199+ }
49200+ const key = isArray && keyRaw.endsWith('[]')
49201+ ? keyRaw.slice(0, -2) : keyRaw
49202+
49203+ if (key === '__proto__') {
49204+ continue
49205+ }
49206+ const valueRaw = match[3] ? unsafe(match[4]) : true
49207+ const value = valueRaw === 'true' ||
49208+ valueRaw === 'false' ||
49209+ valueRaw === 'null' ? JSON.parse(valueRaw)
49210+ : valueRaw
49211+
49212+ // Convert keys with '[]' suffix to an array
49213+ if (isArray) {
49214+ if (!hasOwnProperty.call(p, key)) {
49215+ p[key] = []
49216+ } else if (!Array.isArray(p[key])) {
49217+ p[key] = [p[key]]
49218+ }
49219+ }
49220+
49221+ // safeguard against resetting a previously defined
49222+ // array by accidentally forgetting the brackets
49223+ if (Array.isArray(p[key])) {
49224+ p[key].push(value)
49225+ } else {
49226+ p[key] = value
49227+ }
49228+ }
49229+
49230+ // {a:{y:1},"a.b":{x:2}} --> {a:{y:1,b:{x:2}}}
49231+ // use a filter to return the keys that have to be deleted.
49232+ const remove = []
49233+ for (const k of Object.keys(out)) {
49234+ if (!hasOwnProperty.call(out, k) ||
49235+ typeof out[k] !== 'object' ||
49236+ Array.isArray(out[k])) {
49237+ continue
49238+ }
49239+
49240+ // see if the parent section is also an object.
49241+ // if so, add it to that, and mark this one for deletion
49242+ const parts = splitSections(k, '.')
49243+ p = out
49244+ const l = parts.pop()
49245+ const nl = l.replace(/\\\./g, '.')
49246+ for (const part of parts) {
49247+ if (part === '__proto__') {
49248+ continue
49249+ }
49250+ if (!hasOwnProperty.call(p, part) || typeof p[part] !== 'object') {
49251+ p[part] = Object.create(null)
49252+ }
49253+ p = p[part]
49254+ }
49255+ if (p === out && nl === l) {
49256+ continue
49257+ }
49258+
49259+ p[nl] = out[k]
49260+ remove.push(k)
49261+ }
49262+ for (const del of remove) {
49263+ delete out[del]
49264+ }
49265+
49266+ return out
49267+ }
49268+
49269+ const isQuoted = val => {
49270+ return (val.startsWith('"') && val.endsWith('"')) ||
49271+ (val.startsWith("'") && val.endsWith("'"))
49272+ }
49273+
49274+ const safe = val => {
49275+ if (
49276+ typeof val !== 'string' ||
49277+ val.match(/[=\r\n]/) ||
49278+ val.match(/^\[/) ||
49279+ (val.length > 1 && isQuoted(val)) ||
49280+ val !== val.trim()
49281+ ) {
49282+ return JSON.stringify(val)
49283+ }
49284+ return val.split(';').join('\\;').split('#').join('\\#')
49285+ }
49286+
49287+ const unsafe = val => {
49288+ val = (val || '').trim()
49289+ if (isQuoted(val)) {
49290+ // remove the single quotes before calling JSON.parse
49291+ if (val.charAt(0) === "'") {
49292+ val = val.slice(1, -1)
49293+ }
49294+ try {
49295+ val = JSON.parse(val)
49296+ } catch {
49297+ // ignore errors
49298+ }
49299+ } else {
49300+ // walk the val to find the first not-escaped ; character
49301+ let esc = false
49302+ let unesc = ''
49303+ for (let i = 0, l = val.length; i < l; i++) {
49304+ const c = val.charAt(i)
49305+ if (esc) {
49306+ if ('\\;#'.indexOf(c) !== -1) {
49307+ unesc += c
49308+ } else {
49309+ unesc += '\\' + c
49310+ }
49311+
49312+ esc = false
49313+ } else if (';#'.indexOf(c) !== -1) {
49314+ break
49315+ } else if (c === '\\') {
49316+ esc = true
49317+ } else {
49318+ unesc += c
49319+ }
49320+ }
49321+ if (esc) {
49322+ unesc += '\\'
49323+ }
49324+
49325+ return unesc.trim()
49326+ }
49327+ return val
49328+ }
49329+
49330+ module.exports = {
49331+ parse: decode,
49332+ decode,
49333+ stringify: encode,
49334+ encode,
49335+ safe,
49336+ unsafe,
49337+ }
49338+
49339+
4905349340/***/ }),
4905449341
4905549342/***/ 7426:
@@ -84069,6 +84356,7 @@ const core = __importStar(__nccwpck_require__(2186));
8406984356const exec = __importStar(__nccwpck_require__(1514));
8407084357const io = __importStar(__nccwpck_require__(7436));
8407184358const fs_1 = __importDefault(__nccwpck_require__(7147));
84359+ const INI = __importStar(__nccwpck_require__(45));
8407284360const path_1 = __importDefault(__nccwpck_require__(1017));
8407384361function getNodeVersionFromFile(versionFilePath) {
8407484362 var _a, _b, _c, _d, _e;
@@ -84111,6 +84399,19 @@ function getNodeVersionFromFile(versionFilePath) {
8411184399 catch (_f) {
8411284400 core.info('Node version file is not JSON file');
8411384401 }
84402+ // Try parsing the file as an NPM `.npmrc` file.
84403+ if (contents.match(/use-node-version *=/)) {
84404+ const manifest = INI.parse(contents);
84405+ const key = 'use-node-version';
84406+ if (key in manifest && typeof manifest[key] === 'string') {
84407+ const version = manifest[key];
84408+ core.info(`Using node version ${version} from global INI ${key}`);
84409+ return version;
84410+ }
84411+ // We didn't find the key `use-node-version` in the global scope of the
84412+ // `.npmrc` file, so we return.
84413+ return null;
84414+ }
8411484415 const found = contents.match(/^(?:node(js)?\s+)?v?(?<version>[^\s]+)$/m);
8411584416 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();
8411684417}
0 commit comments