an
unbalanced example';
+ * XRegExp.matchRecursive(str5, '
', '
', 'gi', {
+ * unbalanced: 'skip'
+ * });
+ * // -> ['an']
+ */
+ XRegExp.matchRecursive = function (str, left, right, flags, options) {
+ flags = flags || '';
+ options = options || {};
+ var global = (0, _indexOf["default"])(flags).call(flags, 'g') !== -1;
+ var sticky = (0, _indexOf["default"])(flags).call(flags, 'y') !== -1;
+ // Flag `y` is handled manually
+ var basicFlags = flags.replace(/y/g, '');
+ left = XRegExp(left, basicFlags);
+ right = XRegExp(right, basicFlags);
+ var esc;
+ var _options = options,
+ escapeChar = _options.escapeChar;
+ if (escapeChar) {
+ var _context, _context2;
+ if (escapeChar.length > 1) {
+ throw new Error('Cannot use more than one escape character');
+ }
+ escapeChar = XRegExp.escape(escapeChar);
+ // Example of concatenated `esc` regex:
+ // `escapeChar`: '%'
+ // `left`: '<'
+ // `right`: '>'
+ // Regex is: /(?:%[\S\s]|(?:(?!<|>)[^%])+)+/
+ esc = new RegExp((0, _concat["default"])(_context = (0, _concat["default"])(_context2 = "(?:".concat(escapeChar, "[\\S\\s]|(?:(?!")).call(_context2,
+ // Using `XRegExp.union` safely rewrites backreferences in `left` and `right`.
+ // Intentionally not passing `basicFlags` to `XRegExp.union` since any syntax
+ // transformation resulting from those flags was already applied to `left` and
+ // `right` when they were passed through the XRegExp constructor above.
+ XRegExp.union([left, right], '', {
+ conjunction: 'or'
+ }).source, ")[^")).call(_context, escapeChar, "])+)+"),
+ // Flags `dgy` not needed here
+ flags.replace(XRegExp._hasNativeFlag('s') ? /[^imsu]/g : /[^imu]/g, ''));
+ }
+ var openTokens = 0;
+ var delimStart = 0;
+ var delimEnd = 0;
+ var lastOuterEnd = 0;
+ var outerStart;
+ var innerStart;
+ var leftMatch;
+ var rightMatch;
+ var vN = options.valueNames;
+ var output = [];
+ while (true) {
+ // If using an escape character, advance to the delimiter's next starting position,
+ // skipping any escaped characters in between
+ if (escapeChar) {
+ delimEnd += (XRegExp.exec(str, esc, delimEnd, 'sticky') || [''])[0].length;
+ }
+ leftMatch = XRegExp.exec(str, left, delimEnd);
+ rightMatch = XRegExp.exec(str, right, delimEnd);
+ // Keep the leftmost match only
+ if (leftMatch && rightMatch) {
+ if (leftMatch.index <= rightMatch.index) {
+ rightMatch = null;
+ } else {
+ leftMatch = null;
+ }
+ }
+
+ // Paths (LM: leftMatch, RM: rightMatch, OT: openTokens):
+ // LM | RM | OT | Result
+ // 1 | 0 | 1 | loop
+ // 1 | 0 | 0 | loop
+ // 0 | 1 | 1 | loop
+ // 0 | 1 | 0 | throw
+ // 0 | 0 | 1 | throw
+ // 0 | 0 | 0 | break
+ // The paths above don't include the sticky mode special case. The loop ends after the
+ // first completed match if not `global`.
+ if (leftMatch || rightMatch) {
+ delimStart = (leftMatch || rightMatch).index;
+ delimEnd = delimStart + (leftMatch || rightMatch)[0].length;
+ } else if (!openTokens) {
+ break;
+ }
+ if (sticky && !openTokens && delimStart > lastOuterEnd) {
+ break;
+ }
+ if (leftMatch) {
+ if (!openTokens) {
+ outerStart = delimStart;
+ innerStart = delimEnd;
+ }
+ openTokens += 1;
+ } else if (rightMatch && openTokens) {
+ openTokens -= 1;
+ if (!openTokens) {
+ if (vN) {
+ if (vN[0] && outerStart > lastOuterEnd) {
+ output.push(row(vN[0], (0, _slice["default"])(str).call(str, lastOuterEnd, outerStart), lastOuterEnd, outerStart));
+ }
+ if (vN[1]) {
+ output.push(row(vN[1], (0, _slice["default"])(str).call(str, outerStart, innerStart), outerStart, innerStart));
+ }
+ if (vN[2]) {
+ output.push(row(vN[2], (0, _slice["default"])(str).call(str, innerStart, delimStart), innerStart, delimStart));
+ }
+ if (vN[3]) {
+ output.push(row(vN[3], (0, _slice["default"])(str).call(str, delimStart, delimEnd), delimStart, delimEnd));
+ }
+ } else {
+ output.push((0, _slice["default"])(str).call(str, innerStart, delimStart));
+ }
+ lastOuterEnd = delimEnd;
+ if (!global) {
+ break;
+ }
+ }
+ // Found unbalanced delimiter
+ } else {
+ var unbalanced = options.unbalanced || 'error';
+ if (unbalanced === 'skip' || unbalanced === 'skip-lazy') {
+ if (rightMatch) {
+ rightMatch = null;
+ // No `leftMatch` for unbalanced left delimiter because we've reached the string end
+ } else {
+ if (unbalanced === 'skip') {
+ var outerStartDelimLength = XRegExp.exec(str, left, outerStart, 'sticky')[0].length;
+ delimEnd = outerStart + (outerStartDelimLength || 1);
+ } else {
+ delimEnd = outerStart + 1;
+ }
+ openTokens = 0;
+ }
+ } else if (unbalanced === 'error') {
+ var _context3;
+ var delimSide = rightMatch ? 'right' : 'left';
+ var errorPos = rightMatch ? delimStart : outerStart;
+ throw new Error((0, _concat["default"])(_context3 = "Unbalanced ".concat(delimSide, " delimiter found in string at position ")).call(_context3, errorPos));
+ } else {
+ throw new Error("Unsupported value for unbalanced: ".concat(unbalanced));
+ }
+ }
+
+ // If the delimiter matched an empty string, avoid an infinite loop
+ if (delimStart === delimEnd) {
+ delimEnd += 1;
+ }
+ }
+ if (global && output.length > 0 && !sticky && vN && vN[0] && str.length > lastOuterEnd) {
+ output.push(row(vN[0], (0, _slice["default"])(str).call(str, lastOuterEnd), lastOuterEnd, str.length));
+ }
+ return output;
+ };
};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.restoreCache = void 0;
-const cache = __importStar(__nccwpck_require__(5116));
-const core = __importStar(__nccwpck_require__(37484));
-const glob = __importStar(__nccwpck_require__(47206));
-const path_1 = __importDefault(__nccwpck_require__(16928));
-const fs_1 = __importDefault(__nccwpck_require__(79896));
-const os_1 = __importDefault(__nccwpck_require__(70857));
-const constants_1 = __nccwpck_require__(27242);
-const cache_utils_1 = __nccwpck_require__(4673);
-const restoreCache = async (packageManager, cacheDependencyPath) => {
- const packageManagerInfo = await (0, cache_utils_1.getPackageManagerInfo)(packageManager);
- if (!packageManagerInfo) {
- throw new Error(`Caching for '${packageManager}' is not supported`);
+module.exports = exports.default;
+
+/***/ }),
+
+/***/ 24594:
+/***/ ((module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+var _sliceInstanceProperty = __nccwpck_require__(17012);
+var _Array$from = __nccwpck_require__(66300);
+var _Symbol = __nccwpck_require__(81098);
+var _getIteratorMethod = __nccwpck_require__(79285);
+var _Array$isArray = __nccwpck_require__(28708);
+var _Object$defineProperty = __nccwpck_require__(96141);
+var _interopRequireDefault = __nccwpck_require__(91901);
+_Object$defineProperty(exports, "__esModule", {
+ value: true
+});
+exports["default"] = void 0;
+var _slicedToArray2 = _interopRequireDefault(__nccwpck_require__(77768));
+var _forEach = _interopRequireDefault(__nccwpck_require__(60167));
+var _concat = _interopRequireDefault(__nccwpck_require__(45492));
+var _indexOf = _interopRequireDefault(__nccwpck_require__(70738));
+function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof _Symbol && _getIteratorMethod(r) || r["@@iterator"]; if (!t) { if (_Array$isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
+function _unsupportedIterableToArray(r, a) { if (r) { var _context4; if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = _sliceInstanceProperty(_context4 = {}.toString.call(r)).call(_context4, 8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? _Array$from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
+function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
+/*!
+ * XRegExp Unicode Base 5.1.2
+ *
+ * Steven Levithan (c) 2008-present MIT License
+ */
+var _default = exports["default"] = function _default(XRegExp) {
+ /**
+ * Adds base support for Unicode matching:
+ * - Adds syntax `\p{..}` for matching Unicode tokens. Tokens can be inverted using `\P{..}` or
+ * `\p{^..}`. Token names ignore case, spaces, hyphens, and underscores. You can omit the
+ * braces for token names that are a single letter (e.g. `\pL` or `PL`).
+ * - Adds flag A (astral), which enables 21-bit Unicode support.
+ * - Adds the `XRegExp.addUnicodeData` method used by other addons to provide character data.
+ *
+ * Unicode Base relies on externally provided Unicode character data. Official addons are
+ * available to provide data for Unicode categories, scripts, and properties.
+ *
+ * @requires XRegExp
+ */
+
+ // ==--------------------------==
+ // Private stuff
+ // ==--------------------------==
+
+ // Storage for Unicode data
+ var unicode = {};
+ var unicodeTypes = {};
+
+ // Reuse utils
+ var dec = XRegExp._dec;
+ var hex = XRegExp._hex;
+ var pad4 = XRegExp._pad4;
+
+ // Generates a token lookup name: lowercase, with hyphens, spaces, and underscores removed
+ function normalize(name) {
+ return name.replace(/[- _]+/g, '').toLowerCase();
+ }
+
+ // Gets the decimal code of a literal code unit, \xHH, \uHHHH, or a backslash-escaped literal
+ function charCode(chr) {
+ var esc = /^\\[xu](.+)/.exec(chr);
+ return esc ? dec(esc[1]) : chr.charCodeAt(chr[0] === '\\' ? 1 : 0);
+ }
+
+ // Inverts a list of ordered BMP characters and ranges
+ function invertBmp(range) {
+ var output = '';
+ var lastEnd = -1;
+ (0, _forEach["default"])(XRegExp).call(XRegExp, range, /(\\x..|\\u....|\\?[\s\S])(?:-(\\x..|\\u....|\\?[\s\S]))?/, function (m) {
+ var start = charCode(m[1]);
+ if (start > lastEnd + 1) {
+ output += "\\u".concat(pad4(hex(lastEnd + 1)));
+ if (start > lastEnd + 2) {
+ output += "-\\u".concat(pad4(hex(start - 1)));
+ }
+ }
+ lastEnd = charCode(m[2] || m[1]);
+ });
+ if (lastEnd < 0xFFFF) {
+ output += "\\u".concat(pad4(hex(lastEnd + 1)));
+ if (lastEnd < 0xFFFE) {
+ output += '-\\uFFFF';
+ }
}
- const platform = process.env.RUNNER_OS;
- const arch = os_1.default.arch();
- const cachePaths = await (0, cache_utils_1.getCacheDirectories)(packageManagerInfo, cacheDependencyPath);
- core.saveState(constants_1.State.CachePaths, cachePaths);
- const lockFilePath = cacheDependencyPath
- ? cacheDependencyPath
- : findLockFile(packageManagerInfo);
- const fileHash = await glob.hashFiles(lockFilePath);
- if (!fileHash) {
- throw new Error('Some specified paths were not resolved, unable to cache dependencies.');
+ return output;
+ }
+
+ // Generates an inverted BMP range on first use
+ function cacheInvertedBmp(slug) {
+ var prop = 'b!';
+ return unicode[slug][prop] || (unicode[slug][prop] = invertBmp(unicode[slug].bmp));
+ }
+
+ // Combines and optionally negates BMP and astral data
+ function buildAstral(slug, isNegated) {
+ var item = unicode[slug];
+ var combined = '';
+ if (item.bmp && !item.isBmpLast) {
+ var _context;
+ combined = (0, _concat["default"])(_context = "[".concat(item.bmp, "]")).call(_context, item.astral ? '|' : '');
}
- const keyPrefix = `node-cache-${platform}-${arch}-${packageManager}`;
- const primaryKey = `${keyPrefix}-${fileHash}`;
- core.debug(`primary key is ${primaryKey}`);
- core.saveState(constants_1.State.CachePrimaryKey, primaryKey);
- const isManagedByYarnBerry = await (0, cache_utils_1.repoHasYarnBerryManagedDependencies)(packageManagerInfo, cacheDependencyPath);
- let cacheKey;
- if (isManagedByYarnBerry) {
- core.info('All dependencies are managed locally by yarn3, the previous cache can be used');
- cacheKey = await cache.restoreCache(cachePaths, primaryKey, [keyPrefix]);
+ if (item.astral) {
+ combined += item.astral;
}
- else {
- cacheKey = await cache.restoreCache(cachePaths, primaryKey);
+ if (item.isBmpLast && item.bmp) {
+ var _context2;
+ combined += (0, _concat["default"])(_context2 = "".concat(item.astral ? '|' : '', "[")).call(_context2, item.bmp, "]");
}
- core.setOutput('cache-hit', Boolean(cacheKey));
- if (!cacheKey) {
- core.info(`${packageManager} cache is not found`);
- return;
+
+ // Astral Unicode tokens always match a code point, never a code unit
+ return isNegated ? "(?:(?!".concat(combined, ")(?:[\uD800-\uDBFF][\uDC00-\uDFFF]|[\0-\uFFFF]))") : "(?:".concat(combined, ")");
+ }
+
+ // Builds a complete astral pattern on first use
+ function cacheAstral(slug, isNegated) {
+ var prop = isNegated ? 'a!' : 'a=';
+ return unicode[slug][prop] || (unicode[slug][prop] = buildAstral(slug, isNegated));
+ }
+
+ // ==--------------------------==
+ // Core functionality
+ // ==--------------------------==
+
+ /*
+ * Add astral mode (flag A) and Unicode token syntax: `\p{..}`, `\P{..}`, `\p{^..}`, `\pC`.
+ */
+ XRegExp.addToken(
+ // Use `*` instead of `+` to avoid capturing `^` as the token name in `\p{^}`
+ /\\([pP])(?:{(\^?)(?:(\w+)=)?([^}]*)}|([A-Za-z]))/, function (match, scope, flags) {
+ var ERR_DOUBLE_NEG = 'Invalid double negation ';
+ var ERR_UNKNOWN_NAME = 'Unknown Unicode token ';
+ var ERR_UNKNOWN_REF = 'Unicode token missing data ';
+ var ERR_ASTRAL_ONLY = 'Astral mode required for Unicode token ';
+ var ERR_ASTRAL_IN_CLASS = 'Astral mode does not support Unicode tokens within character classes';
+ var _match = (0, _slicedToArray2["default"])(match, 6),
+ fullToken = _match[0],
+ pPrefix = _match[1],
+ caretNegation = _match[2],
+ typePrefix = _match[3],
+ tokenName = _match[4],
+ tokenSingleCharName = _match[5];
+ // Negated via \P{..} or \p{^..}
+ var isNegated = pPrefix === 'P' || !!caretNegation;
+ // Switch from BMP (0-FFFF) to astral (0-10FFFF) mode via flag A
+ var isAstralMode = (0, _indexOf["default"])(flags).call(flags, 'A') !== -1;
+ // Token lookup name. Check `tokenSingleCharName` first to avoid passing `undefined`
+ // via `\p{}`
+ var slug = normalize(tokenSingleCharName || tokenName);
+ // Token data object
+ var item = unicode[slug];
+ if (pPrefix === 'P' && caretNegation) {
+ throw new SyntaxError(ERR_DOUBLE_NEG + fullToken);
+ }
+ if (!unicode.hasOwnProperty(slug)) {
+ throw new SyntaxError(ERR_UNKNOWN_NAME + fullToken);
+ }
+ if (typePrefix) {
+ if (!(unicodeTypes[typePrefix] && unicodeTypes[typePrefix][slug])) {
+ throw new SyntaxError(ERR_UNKNOWN_NAME + fullToken);
+ }
}
- core.saveState(constants_1.State.CacheMatchedKey, cacheKey);
- core.info(`Cache restored from key: ${cacheKey}`);
-};
-exports.restoreCache = restoreCache;
-const findLockFile = (packageManager) => {
- const lockFiles = packageManager.lockFilePatterns;
- const workspace = process.env.GITHUB_WORKSPACE;
- const rootContent = fs_1.default.readdirSync(workspace);
- const lockFile = lockFiles.find(item => rootContent.includes(item));
- if (!lockFile) {
- throw new Error(`Dependencies lock file is not found in ${workspace}. Supported file patterns: ${lockFiles.toString()}`);
+
+ // Switch to the negated form of the referenced Unicode token
+ if (item.inverseOf) {
+ slug = normalize(item.inverseOf);
+ if (!unicode.hasOwnProperty(slug)) {
+ var _context3;
+ throw new ReferenceError((0, _concat["default"])(_context3 = "".concat(ERR_UNKNOWN_REF + fullToken, " -> ")).call(_context3, item.inverseOf));
+ }
+ item = unicode[slug];
+ isNegated = !isNegated;
}
- return path_1.default.join(workspace, lockFile);
-};
+ if (!(item.bmp || isAstralMode)) {
+ throw new SyntaxError(ERR_ASTRAL_ONLY + fullToken);
+ }
+ if (isAstralMode) {
+ if (scope === 'class') {
+ throw new SyntaxError(ERR_ASTRAL_IN_CLASS);
+ }
+ return cacheAstral(slug, isNegated);
+ }
+ return scope === 'class' ? isNegated ? cacheInvertedBmp(slug) : item.bmp : "".concat((isNegated ? '[^' : '[') + item.bmp, "]");
+ }, {
+ scope: 'all',
+ optionalFlags: 'A',
+ leadChar: '\\'
+ });
+
+ /**
+ * Adds to the list of Unicode tokens that XRegExp regexes can match via `\p` or `\P`.
+ *
+ * @memberOf XRegExp
+ * @param {Array} data Objects with named character ranges. Each object may have properties
+ * `name`, `alias`, `isBmpLast`, `inverseOf`, `bmp`, and `astral`. All but `name` are
+ * optional, although one of `bmp` or `astral` is required (unless `inverseOf` is set). If
+ * `astral` is absent, the `bmp` data is used for BMP and astral modes. If `bmp` is absent,
+ * the name errors in BMP mode but works in astral mode. If both `bmp` and `astral` are
+ * provided, the `bmp` data only is used in BMP mode, and the combination of `bmp` and
+ * `astral` data is used in astral mode. `isBmpLast` is needed when a token matches orphan
+ * high surrogates *and* uses surrogate pairs to match astral code points. The `bmp` and
+ * `astral` data should be a combination of literal characters and `\xHH` or `\uHHHH` escape
+ * sequences, with hyphens to create ranges. Any regex metacharacters in the data should be
+ * escaped, apart from range-creating hyphens. The `astral` data can additionally use
+ * character classes and alternation, and should use surrogate pairs to represent astral code
+ * points. `inverseOf` can be used to avoid duplicating character data if a Unicode token is
+ * defined as the exact inverse of another token.
+ * @param {String} [typePrefix] Enables optionally using this type as a prefix for all of the
+ * provided Unicode tokens, e.g. if given `'Type'`, then `\p{TokenName}` can also be written
+ * as `\p{Type=TokenName}`.
+ * @example
+ *
+ * // Basic use
+ * XRegExp.addUnicodeData([{
+ * name: 'XDigit',
+ * alias: 'Hexadecimal',
+ * bmp: '0-9A-Fa-f'
+ * }]);
+ * XRegExp('\\p{XDigit}:\\p{Hexadecimal}+').test('0:3D'); // -> true
+ */
+ XRegExp.addUnicodeData = function (data, typePrefix) {
+ var ERR_NO_NAME = 'Unicode token requires name';
+ var ERR_NO_DATA = 'Unicode token has no character data ';
+ if (typePrefix) {
+ // Case sensitive to match ES2018
+ unicodeTypes[typePrefix] = {};
+ }
+ var _iterator = _createForOfIteratorHelper(data),
+ _step;
+ try {
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
+ var item = _step.value;
+ if (!item.name) {
+ throw new Error(ERR_NO_NAME);
+ }
+ if (!(item.inverseOf || item.bmp || item.astral)) {
+ throw new Error(ERR_NO_DATA + item.name);
+ }
+ var normalizedName = normalize(item.name);
+ unicode[normalizedName] = item;
+ if (typePrefix) {
+ unicodeTypes[typePrefix][normalizedName] = true;
+ }
+ if (item.alias) {
+ var normalizedAlias = normalize(item.alias);
+ unicode[normalizedAlias] = item;
+ if (typePrefix) {
+ unicodeTypes[typePrefix][normalizedAlias] = true;
+ }
+ }
+ }
+ // Reset the pattern cache used by the `XRegExp` constructor, since the same pattern and
+ // flags might now produce different results
+ } catch (err) {
+ _iterator.e(err);
+ } finally {
+ _iterator.f();
+ }
+ XRegExp.cache.flush('patterns');
+ };
+
+ /**
+ * @ignore
+ *
+ * Return a reference to the internal Unicode definition structure for the given Unicode
+ * Property if the given name is a legal Unicode Property for use in XRegExp `\p` or `\P` regex
+ * constructs.
+ *
+ * @memberOf XRegExp
+ * @param {String} name Name by which the Unicode Property may be recognized (case-insensitive),
+ * e.g. `'N'` or `'Number'`. The given name is matched against all registered Unicode
+ * Properties and Property Aliases.
+ * @returns {Object} Reference to definition structure when the name matches a Unicode Property.
+ *
+ * @note
+ * For more info on Unicode Properties, see also http://unicode.org/reports/tr18/#Categories.
+ *
+ * @note
+ * This method is *not* part of the officially documented API and may change or be removed in
+ * the future. It is meant for userland code that wishes to reuse the (large) internal Unicode
+ * structures set up by XRegExp.
+ */
+ XRegExp._getUnicodeProperty = function (name) {
+ var slug = normalize(name);
+ return unicode[slug];
+ };
+};
+module.exports = exports.default;
/***/ }),
-/***/ 4673:
-/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
+/***/ 87167:
+/***/ ((module, exports, __nccwpck_require__) => {
"use strict";
-var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- var desc = Object.getOwnPropertyDescriptor(m, k);
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
- desc = { enumerable: true, get: function() { return m[k]; } };
- }
- Object.defineProperty(o, k2, desc);
-}) : (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
-}));
-var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
- Object.defineProperty(o, "default", { enumerable: true, value: v });
-}) : function(o, v) {
- o["default"] = v;
+
+var _Object$defineProperty = __nccwpck_require__(96141);
+var _interopRequireDefault = __nccwpck_require__(91901);
+_Object$defineProperty(exports, "__esModule", {
+ value: true
});
-var __importStar = (this && this.__importStar) || (function () {
- var ownKeys = function(o) {
- ownKeys = Object.getOwnPropertyNames || function (o) {
- var ar = [];
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
- return ar;
- };
- return ownKeys(o);
- };
- return function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
- __setModuleDefault(result, mod);
- return result;
- };
-})();
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.repoHasYarnBerryManagedDependencies = exports.getCacheDirectories = exports.resetProjectDirectoriesMemoized = exports.getPackageManagerInfo = exports.getCommandOutputNotEmpty = exports.getCommandOutput = exports.supportedPackageManagers = void 0;
-exports.isGhes = isGhes;
-exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
-const core = __importStar(__nccwpck_require__(37484));
-const exec = __importStar(__nccwpck_require__(95236));
-const cache = __importStar(__nccwpck_require__(5116));
-const glob = __importStar(__nccwpck_require__(47206));
-const path_1 = __importDefault(__nccwpck_require__(16928));
-const fs_1 = __importDefault(__nccwpck_require__(79896));
-const util_1 = __nccwpck_require__(54527);
-exports.supportedPackageManagers = {
- npm: {
- name: 'npm',
- lockFilePatterns: ['package-lock.json', 'npm-shrinkwrap.json', 'yarn.lock'],
- getCacheFolderPath: () => (0, exports.getCommandOutputNotEmpty)('npm config get cache', 'Could not get npm cache folder path')
- },
- pnpm: {
- name: 'pnpm',
- lockFilePatterns: ['pnpm-lock.yaml'],
- getCacheFolderPath: () => (0, exports.getCommandOutputNotEmpty)('pnpm store path --silent', 'Could not get pnpm cache folder path')
- },
- yarn: {
- name: 'yarn',
- lockFilePatterns: ['yarn.lock'],
- getCacheFolderPath: async (projectDir) => {
- const yarnVersion = await (0, exports.getCommandOutputNotEmpty)(`yarn --version`, 'Could not retrieve version of yarn', projectDir);
- core.debug(`Consumed yarn version is ${yarnVersion} (working dir: "${projectDir || ''}")`);
- const stdOut = yarnVersion.startsWith('1.')
- ? await (0, exports.getCommandOutput)('yarn cache dir', projectDir)
- : await (0, exports.getCommandOutput)('yarn config get cacheFolder', projectDir);
- if (!stdOut) {
- throw new Error(`Could not get yarn cache folder path for ${projectDir}`);
- }
- return stdOut;
- }
- }
+exports["default"] = void 0;
+var _categories = _interopRequireDefault(__nccwpck_require__(4219));
+/*!
+ * XRegExp Unicode Categories 5.1.2
+ *
+ * Steven Levithan (c) 2010-present MIT License
+ * Unicode data by Mathias Bynens
+ */
+var _default = exports["default"] = function _default(XRegExp) {
+ /**
+ * Adds support for Unicode's general categories. E.g., `\p{Lu}` or `\p{Uppercase Letter}`. See
+ * category descriptions in UAX #44 . Token
+ * names are case insensitive, and any spaces, hyphens, and underscores are ignored.
+ *
+ * Uses Unicode 14.0.0.
+ *
+ * @requires XRegExp, Unicode Base
+ */
+
+ if (!XRegExp.addUnicodeData) {
+ throw new ReferenceError('Unicode Base must be loaded before Unicode Categories');
+ }
+ XRegExp.addUnicodeData(_categories["default"]);
};
-const getCommandOutput = async (toolCommand, cwd) => {
- let { stdout, stderr, exitCode } = await exec.getExecOutput(toolCommand, undefined, { ignoreReturnCode: true, ...(cwd && { cwd }) });
- if (exitCode) {
- stderr = !stderr.trim()
- ? `The '${toolCommand}' command failed with exit code: ${exitCode}`
- : stderr;
- throw new Error(stderr);
- }
- return stdout.trim();
+module.exports = exports.default;
+
+/***/ }),
+
+/***/ 53682:
+/***/ ((module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+var _Object$defineProperty = __nccwpck_require__(96141);
+var _interopRequireDefault = __nccwpck_require__(91901);
+_Object$defineProperty(exports, "__esModule", {
+ value: true
+});
+exports["default"] = void 0;
+var _properties = _interopRequireDefault(__nccwpck_require__(73862));
+/*!
+ * XRegExp Unicode Properties 5.1.2
+ *
+ * Steven Levithan (c) 2012-present MIT License
+ * Unicode data by Mathias Bynens
+ */
+var _default = exports["default"] = function _default(XRegExp) {
+ /**
+ * Adds properties to meet the UTS #18 Level 1 RL1.2 requirements for Unicode regex support. See
+ * . Following are definitions of these properties from
+ * UAX #44 :
+ *
+ * - Alphabetic
+ * Characters with the Alphabetic property. Generated from: Lowercase + Uppercase + Lt + Lm +
+ * Lo + Nl + Other_Alphabetic.
+ *
+ * - Default_Ignorable_Code_Point
+ * For programmatic determination of default ignorable code points. New characters that should
+ * be ignored in rendering (unless explicitly supported) will be assigned in these ranges,
+ * permitting programs to correctly handle the default rendering of such characters when not
+ * otherwise supported.
+ *
+ * - Lowercase
+ * Characters with the Lowercase property. Generated from: Ll + Other_Lowercase.
+ *
+ * - Noncharacter_Code_Point
+ * Code points permanently reserved for internal use.
+ *
+ * - Uppercase
+ * Characters with the Uppercase property. Generated from: Lu + Other_Uppercase.
+ *
+ * - White_Space
+ * Spaces, separator characters and other control characters which should be treated by
+ * programming languages as "white space" for the purpose of parsing elements.
+ *
+ * The properties ASCII, Any, and Assigned are also included but are not defined in UAX #44. UTS
+ * #18 RL1.2 additionally requires support for Unicode scripts and general categories. These are
+ * included in XRegExp's Unicode Categories and Unicode Scripts addons.
+ *
+ * Token names are case insensitive, and any spaces, hyphens, and underscores are ignored.
+ *
+ * Uses Unicode 14.0.0.
+ *
+ * @requires XRegExp, Unicode Base
+ */
+
+ if (!XRegExp.addUnicodeData) {
+ throw new ReferenceError('Unicode Base must be loaded before Unicode Properties');
+ }
+ var unicodeData = _properties["default"];
+
+ // Add non-generated data
+ unicodeData.push({
+ name: 'Assigned',
+ // Since this is defined as the inverse of Unicode category Cn (Unassigned), the Unicode
+ // Categories addon is required to use this property
+ inverseOf: 'Cn'
+ });
+ XRegExp.addUnicodeData(unicodeData);
};
-exports.getCommandOutput = getCommandOutput;
-const getCommandOutputNotEmpty = async (toolCommand, error, cwd) => {
- const stdOut = (0, exports.getCommandOutput)(toolCommand, cwd);
- if (!stdOut) {
- throw new Error(error);
- }
- return stdOut;
+module.exports = exports.default;
+
+/***/ }),
+
+/***/ 57387:
+/***/ ((module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+var _Object$defineProperty = __nccwpck_require__(96141);
+var _interopRequireDefault = __nccwpck_require__(91901);
+_Object$defineProperty(exports, "__esModule", {
+ value: true
+});
+exports["default"] = void 0;
+var _scripts = _interopRequireDefault(__nccwpck_require__(77103));
+/*!
+ * XRegExp Unicode Scripts 5.1.2
+ *
+ * Steven Levithan (c) 2010-present MIT License
+ * Unicode data by Mathias Bynens
+ */
+var _default = exports["default"] = function _default(XRegExp) {
+ /**
+ * Adds support for all Unicode scripts. E.g., `\p{Latin}`. Token names are case insensitive,
+ * and any spaces, hyphens, and underscores are ignored.
+ *
+ * Uses Unicode 14.0.0.
+ *
+ * @requires XRegExp, Unicode Base
+ */
+
+ if (!XRegExp.addUnicodeData) {
+ throw new ReferenceError('Unicode Base must be loaded before Unicode Scripts');
+ }
+ XRegExp.addUnicodeData(_scripts["default"], 'Script');
};
-exports.getCommandOutputNotEmpty = getCommandOutputNotEmpty;
-const getPackageManagerInfo = async (packageManager) => {
- if (packageManager === 'npm') {
- return exports.supportedPackageManagers.npm;
- }
- else if (packageManager === 'pnpm') {
- return exports.supportedPackageManagers.pnpm;
- }
- else if (packageManager === 'yarn') {
- return exports.supportedPackageManagers.yarn;
+module.exports = exports.default;
+
+/***/ }),
+
+/***/ 63897:
+/***/ ((module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+var _Object$defineProperty = __nccwpck_require__(96141);
+var _interopRequireDefault = __nccwpck_require__(91901);
+_Object$defineProperty(exports, "__esModule", {
+ value: true
+});
+exports["default"] = void 0;
+var _xregexp = _interopRequireDefault(__nccwpck_require__(1240));
+var _build = _interopRequireDefault(__nccwpck_require__(11577));
+var _matchrecursive = _interopRequireDefault(__nccwpck_require__(53938));
+var _unicodeBase = _interopRequireDefault(__nccwpck_require__(24594));
+var _unicodeCategories = _interopRequireDefault(__nccwpck_require__(87167));
+var _unicodeProperties = _interopRequireDefault(__nccwpck_require__(53682));
+var _unicodeScripts = _interopRequireDefault(__nccwpck_require__(57387));
+(0, _build["default"])(_xregexp["default"]);
+(0, _matchrecursive["default"])(_xregexp["default"]);
+(0, _unicodeBase["default"])(_xregexp["default"]);
+(0, _unicodeCategories["default"])(_xregexp["default"]);
+(0, _unicodeProperties["default"])(_xregexp["default"]);
+(0, _unicodeScripts["default"])(_xregexp["default"]);
+var _default = exports["default"] = _xregexp["default"];
+module.exports = exports.default;
+
+/***/ }),
+
+/***/ 1240:
+/***/ ((module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+var _sliceInstanceProperty2 = __nccwpck_require__(17012);
+var _Array$from = __nccwpck_require__(66300);
+var _Symbol = __nccwpck_require__(81098);
+var _getIteratorMethod = __nccwpck_require__(79285);
+var _Array$isArray = __nccwpck_require__(28708);
+var _Object$defineProperty = __nccwpck_require__(96141);
+var _interopRequireDefault = __nccwpck_require__(91901);
+_Object$defineProperty(exports, "__esModule", {
+ value: true
+});
+exports["default"] = void 0;
+var _slicedToArray2 = _interopRequireDefault(__nccwpck_require__(77768));
+var _create = _interopRequireDefault(__nccwpck_require__(89756));
+var _flags = _interopRequireDefault(__nccwpck_require__(89505));
+var _sort = _interopRequireDefault(__nccwpck_require__(77764));
+var _slice = _interopRequireDefault(__nccwpck_require__(17012));
+var _parseInt2 = _interopRequireDefault(__nccwpck_require__(76115));
+var _indexOf = _interopRequireDefault(__nccwpck_require__(70738));
+var _forEach = _interopRequireDefault(__nccwpck_require__(60167));
+var _concat = _interopRequireDefault(__nccwpck_require__(45492));
+function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof _Symbol && _getIteratorMethod(r) || r["@@iterator"]; if (!t) { if (_Array$isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n2 = 0, F = function F() {}; return { s: F, n: function n() { return _n2 >= r.length ? { done: !0 } : { done: !1, value: r[_n2++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
+function _unsupportedIterableToArray(r, a) { if (r) { var _context9; if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = _sliceInstanceProperty2(_context9 = {}.toString.call(r)).call(_context9, 8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? _Array$from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
+function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
+/*!
+ * XRegExp 5.1.2
+ *
+ * Steven Levithan (c) 2007-present MIT License
+ */
+
+/**
+ * XRegExp provides augmented, extensible regular expressions. You get additional regex syntax and
+ * flags, beyond what browsers support natively. XRegExp is also a regex utility belt with tools to
+ * make your client-side grepping simpler and more powerful, while freeing you from related
+ * cross-browser inconsistencies.
+ */
+
+// ==--------------------------==
+// Private stuff
+// ==--------------------------==
+
+// Property name used for extended regex instance data
+var REGEX_DATA = 'xregexp';
+// Optional features that can be installed and uninstalled
+var features = {
+ astral: false,
+ namespacing: true
+};
+// Storage for fixed/extended native methods
+var fixed = {};
+// Storage for regexes cached by `XRegExp.cache`
+var regexCache = (0, _create["default"])(null);
+// Storage for pattern details cached by the `XRegExp` constructor
+var patternCache = (0, _create["default"])(null);
+// Storage for regex syntax tokens added internally or by `XRegExp.addToken`
+var tokens = [];
+// Token scopes
+var defaultScope = 'default';
+var classScope = 'class';
+// Regexes that match native regex syntax, including octals
+var nativeTokens = {
+ // Any native multicharacter token in default scope, or any single character
+ 'default': /\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9]\d*|x[\dA-Fa-f]{2}|u(?:[\dA-Fa-f]{4}|{[\dA-Fa-f]+})|c[A-Za-z]|[\s\S])|\(\?(?:[:=!]|<[=!])|[?*+]\?|{\d+(?:,\d*)?}\??|[\s\S]/,
+ // Any native multicharacter token in character class scope, or any single character
+ 'class': /\\(?:[0-3][0-7]{0,2}|[4-7][0-7]?|x[\dA-Fa-f]{2}|u(?:[\dA-Fa-f]{4}|{[\dA-Fa-f]+})|c[A-Za-z]|[\s\S])|[\s\S]/
+};
+// Any backreference or dollar-prefixed character in replacement strings
+var replacementToken = /\$(?:\{([^\}]+)\}|<([^>]+)>|(\d\d?|[\s\S]?))/g;
+// Check for correct `exec` handling of nonparticipating capturing groups
+var correctExecNpcg = /()??/.exec('')[1] === undefined;
+// Check for ES6 `flags` prop support
+var hasFlagsProp = (0, _flags["default"])(/x/) !== undefined;
+function hasNativeFlag(flag) {
+ // Can't check based on the presence of properties/getters since browsers might support such
+ // properties even when they don't support the corresponding flag in regex construction (tested
+ // in Chrome 48, where `'unicode' in /x/` is true but trying to construct a regex with flag `u`
+ // throws an error)
+ var isSupported = true;
+ try {
+ // Can't use regex literals for testing even in a `try` because regex literals with
+ // unsupported flags cause a compilation error in IE
+ new RegExp('', flag);
+
+ // Work around a broken/incomplete IE11 polyfill for sticky introduced in core-js 3.6.0
+ if (flag === 'y') {
+ // Using function to avoid babel transform to regex literal
+ var gy = function () {
+ return 'gy';
+ }();
+ var incompleteY = '.a'.replace(new RegExp('a', gy), '.') === '..';
+ if (incompleteY) {
+ isSupported = false;
+ }
}
- else {
- return null;
+ } catch (exception) {
+ isSupported = false;
+ }
+ return isSupported;
+}
+// Check for ES2021 `d` flag support
+var hasNativeD = hasNativeFlag('d');
+// Check for ES2018 `s` flag support
+var hasNativeS = hasNativeFlag('s');
+// Check for ES6 `u` flag support
+var hasNativeU = hasNativeFlag('u');
+// Check for ES6 `y` flag support
+var hasNativeY = hasNativeFlag('y');
+// Tracker for known flags, including addon flags
+var registeredFlags = {
+ d: hasNativeD,
+ g: true,
+ i: true,
+ m: true,
+ s: hasNativeS,
+ u: hasNativeU,
+ y: hasNativeY
+};
+// Flags to remove when passing to native `RegExp` constructor
+var nonnativeFlags = hasNativeS ? /[^dgimsuy]+/g : /[^dgimuy]+/g;
+
+/**
+ * Attaches extended data and `XRegExp.prototype` properties to a regex object.
+ *
+ * @private
+ * @param {RegExp} regex Regex to augment.
+ * @param {Array} captureNames Array with capture names, or `null`.
+ * @param {String} xSource XRegExp pattern used to generate `regex`, or `null` if N/A.
+ * @param {String} xFlags XRegExp flags used to generate `regex`, or `null` if N/A.
+ * @param {Boolean} [isInternalOnly=false] Whether the regex will be used only for internal
+ * operations, and never exposed to users. For internal-only regexes, we can improve perf by
+ * skipping some operations like attaching `XRegExp.prototype` properties.
+ * @returns {!RegExp} Augmented regex.
+ */
+function augment(regex, captureNames, xSource, xFlags, isInternalOnly) {
+ var _context;
+ regex[REGEX_DATA] = {
+ captureNames: captureNames
+ };
+ if (isInternalOnly) {
+ return regex;
+ }
+
+ // Can't auto-inherit these since the XRegExp constructor returns a nonprimitive value
+ if (regex.__proto__) {
+ regex.__proto__ = XRegExp.prototype;
+ } else {
+ for (var p in XRegExp.prototype) {
+ // An `XRegExp.prototype.hasOwnProperty(p)` check wouldn't be worth it here, since this
+ // is performance sensitive, and enumerable `Object.prototype` or `RegExp.prototype`
+ // extensions exist on `regex.prototype` anyway
+ regex[p] = XRegExp.prototype[p];
}
-};
-exports.getPackageManagerInfo = getPackageManagerInfo;
+ }
+ regex[REGEX_DATA].source = xSource;
+ // Emulate the ES6 `flags` prop by ensuring flags are in alphabetical order
+ regex[REGEX_DATA].flags = xFlags ? (0, _sort["default"])(_context = xFlags.split('')).call(_context).join('') : xFlags;
+ return regex;
+}
+
/**
- * getProjectDirectoriesFromCacheDependencyPath is called twice during `restoreCache`
- * - first through `getCacheDirectories`
- * - second from `repoHasYarn3ManagedCache`
+ * Removes any duplicate characters from the provided string.
*
- * it contains expensive IO operation and thus should be memoized
+ * @private
+ * @param {String} str String to remove duplicate characters from.
+ * @returns {string} String with any duplicate characters removed.
*/
-let projectDirectoriesMemoized = null;
+function clipDuplicates(str) {
+ return str.replace(/([\s\S])(?=[\s\S]*\1)/g, '');
+}
+
/**
- * unit test must reset memoized variables
- */
-const resetProjectDirectoriesMemoized = () => (projectDirectoriesMemoized = null);
-exports.resetProjectDirectoriesMemoized = resetProjectDirectoriesMemoized;
+ * Copies a regex object while preserving extended data and augmenting with `XRegExp.prototype`
+ * properties. The copy has a fresh `lastIndex` property (set to zero). Allows adding and removing
+ * flags g and y while copying the regex.
+ *
+ * @private
+ * @param {RegExp} regex Regex to copy.
+ * @param {Object} [options] Options object with optional properties:
+ * - `addG` {Boolean} Add flag g while copying the regex.
+ * - `addY` {Boolean} Add flag y while copying the regex.
+ * - `removeG` {Boolean} Remove flag g while copying the regex.
+ * - `removeY` {Boolean} Remove flag y while copying the regex.
+ * - `isInternalOnly` {Boolean} Whether the copied regex will be used only for internal
+ * operations, and never exposed to users. For internal-only regexes, we can improve perf by
+ * skipping some operations like attaching `XRegExp.prototype` properties.
+ * - `source` {String} Overrides `.source`, for special cases.
+ * @returns {RegExp} Copy of the provided regex, possibly with modified flags.
+ */
+function copyRegex(regex, options) {
+ var _context2;
+ if (!XRegExp.isRegExp(regex)) {
+ throw new TypeError('Type RegExp expected');
+ }
+ var xData = regex[REGEX_DATA] || {};
+ var flags = getNativeFlags(regex);
+ var flagsToAdd = '';
+ var flagsToRemove = '';
+ var xregexpSource = null;
+ var xregexpFlags = null;
+ options = options || {};
+ if (options.removeG) {
+ flagsToRemove += 'g';
+ }
+ if (options.removeY) {
+ flagsToRemove += 'y';
+ }
+ if (flagsToRemove) {
+ flags = flags.replace(new RegExp("[".concat(flagsToRemove, "]+"), 'g'), '');
+ }
+ if (options.addG) {
+ flagsToAdd += 'g';
+ }
+ if (options.addY) {
+ flagsToAdd += 'y';
+ }
+ if (flagsToAdd) {
+ flags = clipDuplicates(flags + flagsToAdd);
+ }
+ if (!options.isInternalOnly) {
+ if (xData.source !== undefined) {
+ xregexpSource = xData.source;
+ }
+ // null or undefined; don't want to add to `flags` if the previous value was null, since
+ // that indicates we're not tracking original precompilation flags
+ if ((0, _flags["default"])(xData) != null) {
+ // Flags are only added for non-internal regexes by `XRegExp.globalize`. Flags are never
+ // removed for non-internal regexes, so don't need to handle it
+ xregexpFlags = flagsToAdd ? clipDuplicates((0, _flags["default"])(xData) + flagsToAdd) : (0, _flags["default"])(xData);
+ }
+ }
+
+ // Augment with `XRegExp.prototype` properties, but use the native `RegExp` constructor to avoid
+ // searching for special tokens. That would be wrong for regexes constructed by `RegExp`, and
+ // unnecessary for regexes constructed by `XRegExp` because the regex has already undergone the
+ // translation to native regex syntax
+ regex = augment(new RegExp(options.source || regex.source, flags), hasNamedCapture(regex) ? (0, _slice["default"])(_context2 = xData.captureNames).call(_context2, 0) : null, xregexpSource, xregexpFlags, options.isInternalOnly);
+ return regex;
+}
+
/**
- * Expands (converts) the string input `cache-dependency-path` to list of directories that
- * may be project roots
- * @param cacheDependencyPath - either a single string or multiline string with possible glob patterns
- * expected to be the result of `core.getInput('cache-dependency-path')`
- * @return list of directories and possible
+ * Converts hexadecimal to decimal.
+ *
+ * @private
+ * @param {String} hex
+ * @returns {number}
*/
-const getProjectDirectoriesFromCacheDependencyPath = async (cacheDependencyPath) => {
- if (projectDirectoriesMemoized !== null) {
- return projectDirectoriesMemoized;
- }
- const globber = await glob.create(cacheDependencyPath);
- const cacheDependenciesPaths = await globber.glob();
- const existingDirectories = cacheDependenciesPaths
- .map(path_1.default.dirname)
- .filter((0, util_1.unique)())
- .map(dirName => fs_1.default.realpathSync(dirName))
- .filter(directory => fs_1.default.lstatSync(directory).isDirectory());
- if (!existingDirectories.length)
- core.warning(`No existing directories found containing cache-dependency-path="${cacheDependencyPath}"`);
- projectDirectoriesMemoized = existingDirectories;
- return existingDirectories;
-};
+function dec(hex) {
+ return (0, _parseInt2["default"])(hex, 16);
+}
+
/**
- * Finds the cache directories configured for the repo if cache-dependency-path is not empty
- * @param packageManagerInfo - an object having getCacheFolderPath method specific to given PM
- * @param cacheDependencyPath - either a single string or multiline string with possible glob patterns
- * expected to be the result of `core.getInput('cache-dependency-path')`
- * @return list of files on which the cache depends
+ * Returns a pattern that can be used in a native RegExp in place of an ignorable token such as an
+ * inline comment or whitespace with flag x. This is used directly as a token handler function
+ * passed to `XRegExp.addToken`.
+ *
+ * @private
+ * @param {String} match Match arg of `XRegExp.addToken` handler
+ * @param {String} scope Scope arg of `XRegExp.addToken` handler
+ * @param {String} flags Flags arg of `XRegExp.addToken` handler
+ * @returns {string} Either '' or '(?:)', depending on which is needed in the context of the match.
+ */
+function getContextualTokenSeparator(match, scope, flags) {
+ var matchEndPos = match.index + match[0].length;
+ var precedingChar = match.input[match.index - 1];
+ var followingChar = match.input[matchEndPos];
+ if (
+ // No need to separate tokens if at the beginning or end of a group, before or after a
+ // group, or before or after a `|`
+ /^[()|]$/.test(precedingChar) || /^[()|]$/.test(followingChar) ||
+ // No need to separate tokens if at the beginning or end of the pattern
+ match.index === 0 || matchEndPos === match.input.length ||
+ // No need to separate tokens if at the beginning of a noncapturing group or lookaround.
+ // Looks only at the last 4 chars (at most) for perf when constructing long regexes.
+ /\(\?(?:[:=!]|<[=!])$/.test(match.input.substring(match.index - 4, match.index)) ||
+ // Avoid separating tokens when the following token is a quantifier
+ isQuantifierNext(match.input, matchEndPos, flags)) {
+ return '';
+ }
+ // Keep tokens separated. This avoids e.g. inadvertedly changing `\1 1` or `\1(?#)1` to `\11`.
+ // This also ensures all tokens remain as discrete atoms, e.g. it prevents converting the
+ // syntax error `(? :` into `(?:`.
+ return '(?:)';
+}
+
+/**
+ * Returns native `RegExp` flags used by a regex object.
+ *
+ * @private
+ * @param {RegExp} regex Regex to check.
+ * @returns {string} Native flags in use.
*/
-const getCacheDirectoriesFromCacheDependencyPath = async (packageManagerInfo, cacheDependencyPath) => {
- const projectDirectories = await getProjectDirectoriesFromCacheDependencyPath(cacheDependencyPath);
- const cacheFoldersPaths = await Promise.all(projectDirectories.map(async (projectDirectory) => {
- const cacheFolderPath = await packageManagerInfo.getCacheFolderPath(projectDirectory);
- core.debug(`${packageManagerInfo.name}'s cache folder "${cacheFolderPath}" configured for the directory "${projectDirectory}"`);
- return cacheFolderPath;
- }));
- // uniq in order to do not cache the same directories twice
- return cacheFoldersPaths.filter((0, util_1.unique)());
-};
+function getNativeFlags(regex) {
+ return hasFlagsProp ? (0, _flags["default"])(regex) :
+ // Explicitly using `RegExp.prototype.toString` (rather than e.g. `String` or concatenation
+ // with an empty string) allows this to continue working predictably when
+ // `XRegExp.proptotype.toString` is overridden
+ /\/([a-z]*)$/i.exec(RegExp.prototype.toString.call(regex))[1];
+}
+
/**
- * Finds the cache directories configured for the repo ignoring cache-dependency-path
- * @param packageManagerInfo - an object having getCacheFolderPath method specific to given PM
- * @return list of files on which the cache depends
+ * Determines whether a regex has extended instance data used to track capture names.
+ *
+ * @private
+ * @param {RegExp} regex Regex to check.
+ * @returns {boolean} Whether the regex uses named capture.
*/
-const getCacheDirectoriesForRootProject = async (packageManagerInfo) => {
- const cacheFolderPath = await packageManagerInfo.getCacheFolderPath();
- core.debug(`${packageManagerInfo.name}'s cache folder "${cacheFolderPath}" configured for the root directory`);
- return [cacheFolderPath];
-};
+function hasNamedCapture(regex) {
+ return !!(regex[REGEX_DATA] && regex[REGEX_DATA].captureNames);
+}
+
/**
- * A function to find the cache directories configured for the repo
- * currently it handles only the case of PM=yarn && cacheDependencyPath is not empty
- * @param packageManagerInfo - an object having getCacheFolderPath method specific to given PM
- * @param cacheDependencyPath - either a single string or multiline string with possible glob patterns
- * expected to be the result of `core.getInput('cache-dependency-path')`
- * @return list of files on which the cache depends
+ * Converts decimal to hexadecimal.
+ *
+ * @private
+ * @param {Number|String} dec
+ * @returns {string}
*/
-const getCacheDirectories = async (packageManagerInfo, cacheDependencyPath) => {
- // For yarn, if cacheDependencyPath is set, ask information about cache folders in each project
- // folder satisfied by cacheDependencyPath https://github.com/actions/setup-node/issues/488
- if (packageManagerInfo.name === 'yarn' && cacheDependencyPath) {
- return getCacheDirectoriesFromCacheDependencyPath(packageManagerInfo, cacheDependencyPath);
- }
- return getCacheDirectoriesForRootProject(packageManagerInfo);
-};
-exports.getCacheDirectories = getCacheDirectories;
+function hex(dec) {
+ return (0, _parseInt2["default"])(dec, 10).toString(16);
+}
+
/**
- * A function to check if the directory is a yarn project configured to manage
- * obsolete dependencies in the local cache
- * @param directory - a path to the folder
- * @return - true if the directory's project is yarn managed
- * - if there's .yarn/cache folder do not mess with the dependencies kept in the repo, return false
- * - global cache is not managed by yarn @see https://yarnpkg.com/features/offline-cache, return false
- * - if local cache is not explicitly enabled (not yarn3), return false
- * - return true otherwise
+ * Checks whether the next nonignorable token after the specified position is a quantifier.
+ *
+ * @private
+ * @param {String} pattern Pattern to search within.
+ * @param {Number} pos Index in `pattern` to search at.
+ * @param {String} flags Flags used by the pattern.
+ * @returns {Boolean} Whether the next nonignorable token is a quantifier.
*/
-const projectHasYarnBerryManagedDependencies = async (directory) => {
- const workDir = directory || process.env.GITHUB_WORKSPACE || '.';
- core.debug(`check if "${workDir}" has locally managed yarn3 dependencies`);
- // if .yarn/cache directory exists the cache is managed by version control system
- const yarnCacheFile = path_1.default.join(workDir, '.yarn', 'cache');
- if (fs_1.default.existsSync(yarnCacheFile) &&
- fs_1.default.lstatSync(yarnCacheFile).isDirectory()) {
- core.debug(`"${workDir}" has .yarn/cache - dependencies are kept in the repository`);
- return Promise.resolve(false);
- }
- // NOTE: yarn1 returns 'undefined' with return code = 0
- const enableGlobalCache = await (0, exports.getCommandOutput)('yarn config get enableGlobalCache', workDir);
- // only local cache is not managed by yarn
- const managed = enableGlobalCache.includes('false');
- if (managed) {
- core.debug(`"${workDir}" dependencies are managed by yarn 3 locally`);
- return true;
- }
- else {
- core.debug(`"${workDir}" dependencies are not managed by yarn 3 locally`);
- return false;
- }
-};
+function isQuantifierNext(pattern, pos, flags) {
+ var inlineCommentPattern = '\\(\\?#[^)]*\\)';
+ var lineCommentPattern = '#[^#\\n]*';
+ var quantifierPattern = '[?*+]|{\\d+(?:,\\d*)?}';
+ var regex = (0, _indexOf["default"])(flags).call(flags, 'x') !== -1 ? // Ignore any leading whitespace, line comments, and inline comments
+ /^(?:\s|#[^#\n]*|\(\?#[^)]*\))*(?:[?*+]|{\d+(?:,\d*)?})/ : // Ignore any leading inline comments
+ /^(?:\(\?#[^)]*\))*(?:[?*+]|{\d+(?:,\d*)?})/;
+ return regex.test((0, _slice["default"])(pattern).call(pattern, pos));
+}
+
/**
- * A function to report the repo contains Yarn managed projects
- * @param packageManagerInfo - used to make sure current package manager is yarn
- * @param cacheDependencyPath - either a single string or multiline string with possible glob patterns
- * expected to be the result of `core.getInput('cache-dependency-path')`
- * @return - true if all project directories configured to be Yarn managed
+ * Determines whether a value is of the specified type, by resolving its internal [[Class]].
+ *
+ * @private
+ * @param {*} value Object to check.
+ * @param {String} type Type to check for, in TitleCase.
+ * @returns {boolean} Whether the object matches the type.
*/
-const repoHasYarnBerryManagedDependencies = async (packageManagerInfo, cacheDependencyPath) => {
- if (packageManagerInfo.name !== 'yarn')
- return false;
- const yarnDirs = cacheDependencyPath
- ? await getProjectDirectoriesFromCacheDependencyPath(cacheDependencyPath)
- : [''];
- const isManagedList = await Promise.all(yarnDirs.map(projectHasYarnBerryManagedDependencies));
- return isManagedList.every(Boolean);
-};
-exports.repoHasYarnBerryManagedDependencies = repoHasYarnBerryManagedDependencies;
-function isGhes() {
- const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
- const hostname = ghUrl.hostname.trimEnd().toUpperCase();
- const isGitHubHost = hostname === 'GITHUB.COM';
- const isGitHubEnterpriseCloudHost = hostname.endsWith('.GHE.COM');
- const isLocalHost = hostname.endsWith('.LOCALHOST');
- return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
+function isType(value, type) {
+ return Object.prototype.toString.call(value) === "[object ".concat(type, "]");
}
-function isCacheFeatureAvailable() {
- if (cache.isFeatureAvailable())
- return true;
- if (isGhes()) {
- core.warning('Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.');
- return false;
- }
- core.warning('The runner was not able to contact the cache service. Caching will be skipped');
- return false;
+
+/**
+ * Returns the object, or throws an error if it is `null` or `undefined`. This is used to follow
+ * the ES5 abstract operation `ToObject`.
+ *
+ * @private
+ * @param {*} value Object to check and return.
+ * @returns {*} The provided object.
+ */
+function nullThrows(value) {
+ // null or undefined
+ if (value == null) {
+ throw new TypeError('Cannot convert null or undefined to object');
+ }
+ return value;
}
+/**
+ * Adds leading zeros if shorter than four characters. Used for fixed-length hexadecimal values.
+ *
+ * @private
+ * @param {String} str
+ * @returns {string}
+ */
+function pad4(str) {
+ while (str.length < 4) {
+ str = "0".concat(str);
+ }
+ return str;
+}
-/***/ }),
+/**
+ * Checks for flag-related errors, and strips/applies flags in a leading mode modifier. Offloads
+ * the flag preparation logic from the `XRegExp` constructor.
+ *
+ * @private
+ * @param {String} pattern Regex pattern, possibly with a leading mode modifier.
+ * @param {String} flags Any combination of flags.
+ * @returns {!Object} Object with properties `pattern` and `flags`.
+ */
+function prepareFlags(pattern, flags) {
+ // Recent browsers throw on duplicate flags, so copy this behavior for nonnative flags
+ if (clipDuplicates(flags) !== flags) {
+ throw new SyntaxError("Invalid duplicate regex flag ".concat(flags));
+ }
-/***/ 27242:
-/***/ ((__unused_webpack_module, exports) => {
+ // Strip and apply a leading mode modifier with any combination of flags except `dgy`
+ pattern = pattern.replace(/^\(\?([\w$]+)\)/, function ($0, $1) {
+ if (/[dgy]/.test($1)) {
+ throw new SyntaxError("Cannot use flags dgy in mode modifier ".concat($0));
+ }
+ // Allow duplicate flags within the mode modifier
+ flags = clipDuplicates(flags + $1);
+ return '';
+ });
-"use strict";
+ // Throw on unknown native or nonnative flags
+ var _iterator = _createForOfIteratorHelper(flags),
+ _step;
+ try {
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
+ var flag = _step.value;
+ if (!registeredFlags[flag]) {
+ throw new SyntaxError("Unknown regex flag ".concat(flag));
+ }
+ }
+ } catch (err) {
+ _iterator.e(err);
+ } finally {
+ _iterator.f();
+ }
+ return {
+ pattern: pattern,
+ flags: flags
+ };
+}
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.Outputs = exports.State = exports.LockType = void 0;
-var LockType;
-(function (LockType) {
- LockType["Npm"] = "npm";
- LockType["Pnpm"] = "pnpm";
- LockType["Yarn"] = "yarn";
-})(LockType || (exports.LockType = LockType = {}));
-var State;
-(function (State) {
- State["CachePackageManager"] = "SETUP_NODE_CACHE_PACKAGE_MANAGER";
- State["CachePrimaryKey"] = "CACHE_KEY";
- State["CacheMatchedKey"] = "CACHE_RESULT";
- State["CachePaths"] = "CACHE_PATHS";
-})(State || (exports.State = State = {}));
-var Outputs;
-(function (Outputs) {
- Outputs["CacheHit"] = "cache-hit";
-})(Outputs || (exports.Outputs = Outputs = {}));
+/**
+ * Prepares an options object from the given value.
+ *
+ * @private
+ * @param {String|Object} value Value to convert to an options object.
+ * @returns {Object} Options object.
+ */
+function prepareOptions(value) {
+ var options = {};
+ if (isType(value, 'String')) {
+ (0, _forEach["default"])(XRegExp).call(XRegExp, value, /[^\s,]+/, function (match) {
+ options[match] = true;
+ });
+ return options;
+ }
+ return value;
+}
+/**
+ * Registers a flag so it doesn't throw an 'unknown flag' error.
+ *
+ * @private
+ * @param {String} flag Single-character flag to register.
+ */
+function registerFlag(flag) {
+ if (!/^[\w$]$/.test(flag)) {
+ throw new Error('Flag must be a single character A-Za-z0-9_$');
+ }
+ registeredFlags[flag] = true;
+}
-/***/ }),
+/**
+ * Runs built-in and custom regex syntax tokens in reverse insertion order at the specified
+ * position, until a match is found.
+ *
+ * @private
+ * @param {String} pattern Original pattern from which an XRegExp object is being built.
+ * @param {String} flags Flags being used to construct the regex.
+ * @param {Number} pos Position to search for tokens within `pattern`.
+ * @param {Number} scope Regex scope to apply: 'default' or 'class'.
+ * @param {Object} context Context object to use for token handler functions.
+ * @returns {Object} Object with properties `matchLength`, `output`, and `reparse`; or `null`.
+ */
+function runTokens(pattern, flags, pos, scope, context) {
+ var i = tokens.length;
+ var leadChar = pattern[pos];
+ var result = null;
+ var match;
+ var t;
+
+ // Run in reverse insertion order
+ while (i--) {
+ t = tokens[i];
+ if (t.leadChar && t.leadChar !== leadChar || t.scope !== scope && t.scope !== 'all' || t.flag && !((0, _indexOf["default"])(flags).call(flags, t.flag) !== -1)) {
+ continue;
+ }
+ match = XRegExp.exec(pattern, t.regex, pos, 'sticky');
+ if (match) {
+ result = {
+ matchLength: match[0].length,
+ output: t.handler.call(context, match, scope, flags),
+ reparse: t.reparse
+ };
+ // Finished with token tests
+ break;
+ }
+ }
+ return result;
+}
-/***/ 74864:
-/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
+/**
+ * Enables or disables implicit astral mode opt-in. When enabled, flag A is automatically added to
+ * all new regexes created by XRegExp. This causes an error to be thrown when creating regexes if
+ * the Unicode Base addon is not available, since flag A is registered by that addon.
+ *
+ * @private
+ * @param {Boolean} on `true` to enable; `false` to disable.
+ */
+function setAstral(on) {
+ features.astral = on;
+}
-"use strict";
+/**
+ * Adds named capture groups to the `groups` property of match arrays. See here for details:
+ * https://github.com/tc39/proposal-regexp-named-groups
+ *
+ * @private
+ * @param {Boolean} on `true` to enable; `false` to disable.
+ */
+function setNamespacing(on) {
+ features.namespacing = on;
+}
-var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- var desc = Object.getOwnPropertyDescriptor(m, k);
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
- desc = { enumerable: true, get: function() { return m[k]; } };
+// ==--------------------------==
+// Constructor
+// ==--------------------------==
+
+/**
+ * Creates an extended regular expression object for matching text with a pattern. Differs from a
+ * native regular expression in that additional syntax and flags are supported. The returned object
+ * is in fact a native `RegExp` and works with all native methods.
+ *
+ * @class XRegExp
+ * @constructor
+ * @param {String|RegExp} pattern Regex pattern string, or an existing regex object to copy.
+ * @param {String} [flags] Any combination of flags.
+ * Native flags:
+ * - `d` - indices for capturing groups (ES2021)
+ * - `g` - global
+ * - `i` - ignore case
+ * - `m` - multiline anchors
+ * - `u` - unicode (ES6)
+ * - `y` - sticky (Firefox 3+, ES6)
+ * Additional XRegExp flags:
+ * - `n` - named capture only
+ * - `s` - dot matches all (aka singleline) - works even when not natively supported
+ * - `x` - free-spacing and line comments (aka extended)
+ * - `A` - 21-bit Unicode properties (aka astral) - requires the Unicode Base addon
+ * Flags cannot be provided when constructing one `RegExp` from another.
+ * @returns {RegExp} Extended regular expression object.
+ * @example
+ *
+ * // With named capture and flag x
+ * XRegExp(`(? [0-9]{4} ) -? # year
+ * (? [0-9]{2} ) -? # month
+ * (? [0-9]{2} ) # day`, 'x');
+ *
+ * // Providing a regex object copies it. Native regexes are recompiled using native (not XRegExp)
+ * // syntax. Copies maintain extended data, are augmented with `XRegExp.prototype` properties, and
+ * // have fresh `lastIndex` properties (set to zero).
+ * XRegExp(/regex/);
+ */
+function XRegExp(pattern, flags) {
+ if (XRegExp.isRegExp(pattern)) {
+ if (flags !== undefined) {
+ throw new TypeError('Cannot supply flags when copying a RegExp');
}
- Object.defineProperty(o, k2, desc);
-}) : (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
-}));
-var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
- Object.defineProperty(o, "default", { enumerable: true, value: v });
-}) : function(o, v) {
- o["default"] = v;
-});
-var __importStar = (this && this.__importStar) || (function () {
- var ownKeys = function(o) {
- ownKeys = Object.getOwnPropertyNames || function (o) {
- var ar = [];
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
- return ar;
- };
- return ownKeys(o);
- };
- return function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
- __setModuleDefault(result, mod);
- return result;
+ return copyRegex(pattern);
+ }
+
+ // Copy the argument behavior of `RegExp`
+ pattern = pattern === undefined ? '' : String(pattern);
+ flags = flags === undefined ? '' : String(flags);
+ if (XRegExp.isInstalled('astral') && !((0, _indexOf["default"])(flags).call(flags, 'A') !== -1)) {
+ // This causes an error to be thrown if the Unicode Base addon is not available
+ flags += 'A';
+ }
+ if (!patternCache[pattern]) {
+ patternCache[pattern] = {};
+ }
+ if (!patternCache[pattern][flags]) {
+ var context = {
+ hasNamedCapture: false,
+ captureNames: []
};
-})();
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const tc = __importStar(__nccwpck_require__(33472));
-const semver_1 = __importDefault(__nccwpck_require__(62088));
-const base_distribution_1 = __importDefault(__nccwpck_require__(60709));
-class BasePrereleaseNodejs extends base_distribution_1.default {
- constructor(nodeInfo) {
- super(nodeInfo);
- }
- findVersionInHostedToolCacheDirectory() {
- let toolPath = '';
- const localVersionPaths = tc
- .findAllVersions('node', this.nodeInfo.arch)
- .filter(i => {
- const prerelease = semver_1.default.prerelease(i, {});
- if (!prerelease) {
- return false;
- }
- return prerelease[0].toString().includes(this.distribution);
- });
- localVersionPaths.sort(semver_1.default.rcompare);
- const localVersion = this.evaluateVersions(localVersionPaths);
- if (localVersion) {
- toolPath = tc.find('node', localVersion, this.nodeInfo.arch);
- }
- return toolPath;
- }
- validRange(versionSpec) {
- let range;
- const [raw, prerelease] = this.splitVersionSpec(versionSpec);
- const isValidVersion = semver_1.default.valid(raw);
- const rawVersion = (isValidVersion ? raw : semver_1.default.coerce(raw));
- if (prerelease !== this.distribution) {
- range = versionSpec;
- }
- else {
- range = `${semver_1.default.validRange(`^${rawVersion}-${this.distribution}`)}-0`;
+ var scope = defaultScope;
+ var output = '';
+ var pos = 0;
+ var result;
+
+ // Check for flag-related errors, and strip/apply flags in a leading mode modifier
+ var applied = prepareFlags(pattern, flags);
+ var appliedPattern = applied.pattern;
+ var appliedFlags = (0, _flags["default"])(applied);
+
+ // Use XRegExp's tokens to translate the pattern to a native regex pattern.
+ // `appliedPattern.length` may change on each iteration if tokens use `reparse`
+ while (pos < appliedPattern.length) {
+ do {
+ // Check for custom tokens at the current position
+ result = runTokens(appliedPattern, appliedFlags, pos, scope, context);
+ // If the matched token used the `reparse` option, splice its output into the
+ // pattern before running tokens again at the same position
+ if (result && result.reparse) {
+ appliedPattern = (0, _slice["default"])(appliedPattern).call(appliedPattern, 0, pos) + result.output + (0, _slice["default"])(appliedPattern).call(appliedPattern, pos + result.matchLength);
+ }
+ } while (result && result.reparse);
+ if (result) {
+ output += result.output;
+ pos += result.matchLength || 1;
+ } else {
+ // Get the native token at the current position
+ var _XRegExp$exec = XRegExp.exec(appliedPattern, nativeTokens[scope], pos, 'sticky'),
+ _XRegExp$exec2 = (0, _slicedToArray2["default"])(_XRegExp$exec, 1),
+ token = _XRegExp$exec2[0];
+ output += token;
+ pos += token.length;
+ if (token === '[' && scope === defaultScope) {
+ scope = classScope;
+ } else if (token === ']' && scope === classScope) {
+ scope = defaultScope;
}
- return { range, options: { includePrerelease: !isValidVersion } };
- }
- splitVersionSpec(versionSpec) {
- return versionSpec.split(/-(.*)/s);
+ }
}
+ patternCache[pattern][flags] = {
+ // Use basic cleanup to collapse repeated empty groups like `(?:)(?:)` to `(?:)`. Empty
+ // groups are sometimes inserted during regex transpilation in order to keep tokens
+ // separated. However, more than one empty group in a row is never needed.
+ pattern: output.replace(/(?:\(\?:\))+/g, '(?:)'),
+ // Strip all but native flags
+ flags: appliedFlags.replace(nonnativeFlags, ''),
+ // `context.captureNames` has an item for each capturing group, even if unnamed
+ captures: context.hasNamedCapture ? context.captureNames : null
+ };
+ }
+ var generated = patternCache[pattern][flags];
+ return augment(new RegExp(generated.pattern, (0, _flags["default"])(generated)), generated.captures, pattern, flags);
}
-exports["default"] = BasePrereleaseNodejs;
+// Add `RegExp.prototype` to the prototype chain
+XRegExp.prototype = /(?:)/;
-/***/ }),
+// ==--------------------------==
+// Public properties
+// ==--------------------------==
-/***/ 60709:
-/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
+/**
+ * The XRegExp version number as a string containing three dot-separated parts. For example,
+ * '2.0.0-beta-3'.
+ *
+ * @static
+ * @memberOf XRegExp
+ * @type String
+ */
+XRegExp.version = '5.1.2';
-"use strict";
+// ==--------------------------==
+// Public methods
+// ==--------------------------==
-var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- var desc = Object.getOwnPropertyDescriptor(m, k);
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
- desc = { enumerable: true, get: function() { return m[k]; } };
+// Intentionally undocumented; used in tests and addons
+XRegExp._clipDuplicates = clipDuplicates;
+XRegExp._hasNativeFlag = hasNativeFlag;
+XRegExp._dec = dec;
+XRegExp._hex = hex;
+XRegExp._pad4 = pad4;
+
+/**
+ * Extends XRegExp syntax and allows custom flags. This is used internally and can be used to
+ * create XRegExp addons. If more than one token can match the same string, the last added wins.
+ *
+ * @memberOf XRegExp
+ * @param {RegExp} regex Regex object that matches the new token.
+ * @param {Function} handler Function that returns a new pattern string (using native regex syntax)
+ * to replace the matched token within all future XRegExp regexes. Has access to persistent
+ * properties of the regex being built, through `this`. Invoked with three arguments:
+ * - The match array, with named backreference properties.
+ * - The regex scope where the match was found: 'default' or 'class'.
+ * - The flags used by the regex, including any flags in a leading mode modifier.
+ * The handler function becomes part of the XRegExp construction process, so be careful not to
+ * construct XRegExps within the function or you will trigger infinite recursion.
+ * @param {Object} [options] Options object with optional properties:
+ * - `scope` {String} Scope where the token applies: 'default', 'class', or 'all'.
+ * - `flag` {String} Single-character flag that triggers the token. This also registers the
+ * flag, which prevents XRegExp from throwing an 'unknown flag' error when the flag is used.
+ * - `optionalFlags` {String} Any custom flags checked for within the token `handler` that are
+ * not required to trigger the token. This registers the flags, to prevent XRegExp from
+ * throwing an 'unknown flag' error when any of the flags are used.
+ * - `reparse` {Boolean} Whether the `handler` function's output should not be treated as
+ * final, and instead be reparseable by other tokens (including the current token). Allows
+ * token chaining or deferring.
+ * - `leadChar` {String} Single character that occurs at the beginning of any successful match
+ * of the token (not always applicable). This doesn't change the behavior of the token unless
+ * you provide an erroneous value. However, providing it can increase the token's performance
+ * since the token can be skipped at any positions where this character doesn't appear.
+ * @example
+ *
+ * // Basic usage: Add \a for the ALERT control code
+ * XRegExp.addToken(
+ * /\\a/,
+ * () => '\\x07',
+ * {scope: 'all'}
+ * );
+ * XRegExp('\\a[\\a-\\n]+').test('\x07\n\x07'); // -> true
+ *
+ * // Add the U (ungreedy) flag from PCRE and RE2, which reverses greedy and lazy quantifiers.
+ * // Since `scope` is not specified, it uses 'default' (i.e., transformations apply outside of
+ * // character classes only)
+ * XRegExp.addToken(
+ * /([?*+]|{\d+(?:,\d*)?})(\??)/,
+ * (match) => `${match[1]}${match[2] ? '' : '?'}`,
+ * {flag: 'U'}
+ * );
+ * XRegExp('a+', 'U').exec('aaa')[0]; // -> 'a'
+ * XRegExp('a+?', 'U').exec('aaa')[0]; // -> 'aaa'
+ */
+XRegExp.addToken = function (regex, handler, options) {
+ options = options || {};
+ var _options = options,
+ optionalFlags = _options.optionalFlags;
+ if (options.flag) {
+ registerFlag(options.flag);
+ }
+ if (optionalFlags) {
+ optionalFlags = optionalFlags.split('');
+ var _iterator2 = _createForOfIteratorHelper(optionalFlags),
+ _step2;
+ try {
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
+ var flag = _step2.value;
+ registerFlag(flag);
+ }
+ } catch (err) {
+ _iterator2.e(err);
+ } finally {
+ _iterator2.f();
}
- Object.defineProperty(o, k2, desc);
-}) : (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
-}));
-var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
- Object.defineProperty(o, "default", { enumerable: true, value: v });
-}) : function(o, v) {
- o["default"] = v;
-});
-var __importStar = (this && this.__importStar) || (function () {
- var ownKeys = function(o) {
- ownKeys = Object.getOwnPropertyNames || function (o) {
- var ar = [];
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
- return ar;
- };
- return ownKeys(o);
- };
- return function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
- __setModuleDefault(result, mod);
- return result;
- };
-})();
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
+ }
+
+ // Add to the private list of syntax tokens
+ tokens.push({
+ regex: copyRegex(regex, {
+ addG: true,
+ addY: hasNativeY,
+ isInternalOnly: true
+ }),
+ handler: handler,
+ scope: options.scope || defaultScope,
+ flag: options.flag,
+ reparse: options.reparse,
+ leadChar: options.leadChar
+ });
+
+ // Reset the pattern cache used by the `XRegExp` constructor, since the same pattern and flags
+ // might now produce different results
+ XRegExp.cache.flush('patterns');
};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const uuid_1 = __nccwpck_require__(31914);
-const tc = __importStar(__nccwpck_require__(33472));
-const hc = __importStar(__nccwpck_require__(54844));
-const core = __importStar(__nccwpck_require__(37484));
-const io = __importStar(__nccwpck_require__(94994));
-const semver_1 = __importDefault(__nccwpck_require__(62088));
-const assert = __importStar(__nccwpck_require__(42613));
-const path = __importStar(__nccwpck_require__(16928));
-const os_1 = __importDefault(__nccwpck_require__(70857));
-const fs_1 = __importDefault(__nccwpck_require__(79896));
-class BaseDistribution {
- nodeInfo;
- httpClient;
- osPlat = os_1.default.platform();
- constructor(nodeInfo) {
- this.nodeInfo = nodeInfo;
- this.httpClient = new hc.HttpClient('setup-node', [], {
- allowRetries: true,
- maxRetries: 3
- });
- }
- async setupNodeJs() {
- let nodeJsVersions;
- if (this.nodeInfo.checkLatest) {
- const evaluatedVersion = await this.findVersionInDist(nodeJsVersions);
- this.nodeInfo.versionSpec = evaluatedVersion;
- }
- let toolPath = this.findVersionInHostedToolCacheDirectory();
- if (toolPath) {
- core.info(`Found in cache @ ${toolPath}`);
- }
- else {
- const evaluatedVersion = await this.findVersionInDist(nodeJsVersions);
- const toolName = this.getNodejsDistInfo(evaluatedVersion);
- toolPath = await this.downloadNodejs(toolName);
- }
- if (this.osPlat != 'win32') {
- toolPath = path.join(toolPath, 'bin');
+
+/**
+ * Caches and returns the result of calling `XRegExp(pattern, flags)`. On any subsequent call with
+ * the same pattern and flag combination, the cached copy of the regex is returned.
+ *
+ * @memberOf XRegExp
+ * @param {String} pattern Regex pattern string.
+ * @param {String} [flags] Any combination of XRegExp flags.
+ * @returns {RegExp} Cached XRegExp object.
+ * @example
+ *
+ * let match;
+ * while (match = XRegExp.cache('.', 'gs').exec('abc')) {
+ * // The regex is compiled once only
+ * }
+ */
+XRegExp.cache = function (pattern, flags) {
+ if (!regexCache[pattern]) {
+ regexCache[pattern] = {};
+ }
+ return regexCache[pattern][flags] || (regexCache[pattern][flags] = XRegExp(pattern, flags));
+};
+
+// Intentionally undocumented; used in tests
+XRegExp.cache.flush = function (cacheName) {
+ if (cacheName === 'patterns') {
+ // Flush the pattern cache used by the `XRegExp` constructor
+ patternCache = (0, _create["default"])(null);
+ } else {
+ // Flush the regex cache populated by `XRegExp.cache`
+ regexCache = (0, _create["default"])(null);
+ }
+};
+
+/**
+ * Escapes any regular expression metacharacters, for use when matching literal strings. The result
+ * can safely be used at any position within a regex that uses any flags.
+ *
+ * @memberOf XRegExp
+ * @param {String} str String to escape.
+ * @returns {string} String with regex metacharacters escaped.
+ * @example
+ *
+ * XRegExp.escape('Escaped? <.>');
+ * // -> 'Escaped\?\u0020<\.>'
+ */
+// Following are the contexts where each metacharacter needs to be escaped because it would
+// otherwise have a special meaning, change the meaning of surrounding characters, or cause an
+// error. Context 'default' means outside character classes only.
+// - `\` - context: all
+// - `[()*+?.$|` - context: default
+// - `]` - context: default with flag u or if forming the end of a character class
+// - `{}` - context: default with flag u or if part of a valid/complete quantifier pattern
+// - `,` - context: default if in a position that causes an unescaped `{` to turn into a quantifier.
+// Ex: `/^a{1\,2}$/` matches `'a{1,2}'`, but `/^a{1,2}$/` matches `'a'` or `'aa'`
+// - `#` and - context: default with flag x
+// - `^` - context: default, and context: class if it's the first character in the class
+// - `-` - context: class if part of a valid character class range
+XRegExp.escape = function (str) {
+ return String(nullThrows(str)).
+ // Escape most special chars with a backslash
+ replace(/[\\\[\]{}()*+?.^$|]/g, '\\$&').
+ // Convert to \uNNNN for special chars that can't be escaped when used with ES6 flag `u`
+ replace(/[\s#\-,]/g, function (match) {
+ return "\\u".concat(pad4(hex(match.charCodeAt(0))));
+ });
+};
+
+/**
+ * Executes a regex search in a specified string. Returns a match array or `null`. If the provided
+ * regex uses named capture, named capture properties are included on the match array's `groups`
+ * property. Optional `pos` and `sticky` arguments specify the search start position, and whether
+ * the match must start at the specified position only. The `lastIndex` property of the provided
+ * regex is not used, but is updated for compatibility. Also fixes browser bugs compared to the
+ * native `RegExp.prototype.exec` and can be used reliably cross-browser.
+ *
+ * @memberOf XRegExp
+ * @param {String} str String to search.
+ * @param {RegExp} regex Regex to search with.
+ * @param {Number} [pos=0] Zero-based index at which to start the search.
+ * @param {Boolean|String} [sticky=false] Whether the match must start at the specified position
+ * only. The string `'sticky'` is accepted as an alternative to `true`.
+ * @returns {Array} Match array with named capture properties on the `groups` object, or `null`. If
+ * the `namespacing` feature is off, named capture properties are directly on the match array.
+ * @example
+ *
+ * // Basic use, with named capturing group
+ * let match = XRegExp.exec('U+2620', XRegExp('U\\+(?[0-9A-F]{4})'));
+ * match.groups.hex; // -> '2620'
+ *
+ * // With pos and sticky, in a loop
+ * let pos = 3, result = [], match;
+ * while (match = XRegExp.exec('<1><2><3><4>5<6>', /<(\d)>/, pos, 'sticky')) {
+ * result.push(match[1]);
+ * pos = match.index + match[0].length;
+ * }
+ * // result -> ['2', '3', '4']
+ */
+XRegExp.exec = function (str, regex, pos, sticky) {
+ var cacheKey = 'g';
+ var addY = false;
+ var fakeY = false;
+ var match;
+ addY = hasNativeY && !!(sticky || regex.sticky && sticky !== false);
+ if (addY) {
+ cacheKey += 'y';
+ } else if (sticky) {
+ // Simulate sticky matching by appending an empty capture to the original regex. The
+ // resulting regex will succeed no matter what at the current index (set with `lastIndex`),
+ // and will not search the rest of the subject string. We'll know that the original regex
+ // has failed if that last capture is `''` rather than `undefined` (i.e., if that last
+ // capture participated in the match).
+ fakeY = true;
+ cacheKey += 'FakeY';
+ }
+ regex[REGEX_DATA] = regex[REGEX_DATA] || {};
+
+ // Shares cached copies with `XRegExp.match`/`replace`
+ var r2 = regex[REGEX_DATA][cacheKey] || (regex[REGEX_DATA][cacheKey] = copyRegex(regex, {
+ addG: true,
+ addY: addY,
+ source: fakeY ? "".concat(regex.source, "|()") : undefined,
+ removeY: sticky === false,
+ isInternalOnly: true
+ }));
+ pos = pos || 0;
+ r2.lastIndex = pos;
+
+ // Fixed `exec` required for `lastIndex` fix, named backreferences, etc.
+ match = fixed.exec.call(r2, str);
+
+ // Get rid of the capture added by the pseudo-sticky matcher if needed. An empty string means
+ // the original regexp failed (see above).
+ if (fakeY && match && match.pop() === '') {
+ match = null;
+ }
+ if (regex.global) {
+ regex.lastIndex = match ? r2.lastIndex : 0;
+ }
+ return match;
+};
+
+/**
+ * Executes a provided function once per regex match. Searches always start at the beginning of the
+ * string and continue until the end, regardless of the state of the regex's `global` property and
+ * initial `lastIndex`.
+ *
+ * @memberOf XRegExp
+ * @param {String} str String to search.
+ * @param {RegExp} regex Regex to search with.
+ * @param {Function} callback Function to execute for each match. Invoked with four arguments:
+ * - The match array, with named backreference properties.
+ * - The zero-based match index.
+ * - The string being traversed.
+ * - The regex object being used to traverse the string.
+ * @example
+ *
+ * // Extracts every other digit from a string
+ * const evens = [];
+ * XRegExp.forEach('1a2345', /\d/, (match, i) => {
+ * if (i % 2) evens.push(+match[0]);
+ * });
+ * // evens -> [2, 4]
+ */
+XRegExp.forEach = function (str, regex, callback) {
+ var pos = 0;
+ var i = -1;
+ var match;
+ while (match = XRegExp.exec(str, regex, pos)) {
+ // Because `regex` is provided to `callback`, the function could use the deprecated/
+ // nonstandard `RegExp.prototype.compile` to mutate the regex. However, since `XRegExp.exec`
+ // doesn't use `lastIndex` to set the search position, this can't lead to an infinite loop,
+ // at least. Actually, because of the way `XRegExp.exec` caches globalized versions of
+ // regexes, mutating the regex will not have any effect on the iteration or matched strings,
+ // which is a nice side effect that brings extra safety.
+ callback(match, ++i, str, regex);
+ pos = match.index + (match[0].length || 1);
+ }
+};
+
+/**
+ * Copies a regex object and adds flag `g`. The copy maintains extended data, is augmented with
+ * `XRegExp.prototype` properties, and has a fresh `lastIndex` property (set to zero). Native
+ * regexes are not recompiled using XRegExp syntax.
+ *
+ * @memberOf XRegExp
+ * @param {RegExp} regex Regex to globalize.
+ * @returns {RegExp} Copy of the provided regex with flag `g` added.
+ * @example
+ *
+ * const globalCopy = XRegExp.globalize(/regex/);
+ * globalCopy.global; // -> true
+ */
+XRegExp.globalize = function (regex) {
+ return copyRegex(regex, {
+ addG: true
+ });
+};
+
+/**
+ * Installs optional features according to the specified options. Can be undone using
+ * `XRegExp.uninstall`.
+ *
+ * @memberOf XRegExp
+ * @param {Object|String} options Options object or string.
+ * @example
+ *
+ * // With an options object
+ * XRegExp.install({
+ * // Enables support for astral code points in Unicode addons (implicitly sets flag A)
+ * astral: true,
+ *
+ * // Adds named capture groups to the `groups` property of matches
+ * namespacing: true
+ * });
+ *
+ * // With an options string
+ * XRegExp.install('astral namespacing');
+ */
+XRegExp.install = function (options) {
+ options = prepareOptions(options);
+ if (!features.astral && options.astral) {
+ setAstral(true);
+ }
+ if (!features.namespacing && options.namespacing) {
+ setNamespacing(true);
+ }
+};
+
+/**
+ * Checks whether an individual optional feature is installed.
+ *
+ * @memberOf XRegExp
+ * @param {String} feature Name of the feature to check. One of:
+ * - `astral`
+ * - `namespacing`
+ * @returns {boolean} Whether the feature is installed.
+ * @example
+ *
+ * XRegExp.isInstalled('astral');
+ */
+XRegExp.isInstalled = function (feature) {
+ return !!features[feature];
+};
+
+/**
+ * Returns `true` if an object is a regex; `false` if it isn't. This works correctly for regexes
+ * created in another frame, when `instanceof` and `constructor` checks would fail.
+ *
+ * @memberOf XRegExp
+ * @param {*} value Object to check.
+ * @returns {boolean} Whether the object is a `RegExp` object.
+ * @example
+ *
+ * XRegExp.isRegExp('string'); // -> false
+ * XRegExp.isRegExp(/regex/i); // -> true
+ * XRegExp.isRegExp(RegExp('^', 'm')); // -> true
+ * XRegExp.isRegExp(XRegExp('(?s).')); // -> true
+ */
+XRegExp.isRegExp = function (value) {
+ return Object.prototype.toString.call(value) === '[object RegExp]';
+};
+// Same as `isType(value, 'RegExp')`, but avoiding that function call here for perf since
+// `isRegExp` is used heavily by internals including regex construction
+
+/**
+ * Returns the first matched string, or in global mode, an array containing all matched strings.
+ * This is essentially a more convenient re-implementation of `String.prototype.match` that gives
+ * the result types you actually want (string instead of `exec`-style array in match-first mode,
+ * and an empty array instead of `null` when no matches are found in match-all mode). It also lets
+ * you override flag g and ignore `lastIndex`, and fixes browser bugs.
+ *
+ * @memberOf XRegExp
+ * @param {String} str String to search.
+ * @param {RegExp} regex Regex to search with.
+ * @param {String} [scope='one'] Use 'one' to return the first match as a string. Use 'all' to
+ * return an array of all matched strings. If not explicitly specified and `regex` uses flag g,
+ * `scope` is 'all'.
+ * @returns {String|Array} In match-first mode: First match as a string, or `null`. In match-all
+ * mode: Array of all matched strings, or an empty array.
+ * @example
+ *
+ * // Match first
+ * XRegExp.match('abc', /\w/); // -> 'a'
+ * XRegExp.match('abc', /\w/g, 'one'); // -> 'a'
+ * XRegExp.match('abc', /x/g, 'one'); // -> null
+ *
+ * // Match all
+ * XRegExp.match('abc', /\w/g); // -> ['a', 'b', 'c']
+ * XRegExp.match('abc', /\w/, 'all'); // -> ['a', 'b', 'c']
+ * XRegExp.match('abc', /x/, 'all'); // -> []
+ */
+XRegExp.match = function (str, regex, scope) {
+ var global = regex.global && scope !== 'one' || scope === 'all';
+ var cacheKey = (global ? 'g' : '') + (regex.sticky ? 'y' : '') || 'noGY';
+ regex[REGEX_DATA] = regex[REGEX_DATA] || {};
+
+ // Shares cached copies with `XRegExp.exec`/`replace`
+ var r2 = regex[REGEX_DATA][cacheKey] || (regex[REGEX_DATA][cacheKey] = copyRegex(regex, {
+ addG: !!global,
+ removeG: scope === 'one',
+ isInternalOnly: true
+ }));
+ var result = String(nullThrows(str)).match(r2);
+ if (regex.global) {
+ regex.lastIndex = scope === 'one' && result ?
+ // Can't use `r2.lastIndex` since `r2` is nonglobal in this case
+ result.index + result[0].length : 0;
+ }
+ return global ? result || [] : result && result[0];
+};
+
+/**
+ * Retrieves the matches from searching a string using a chain of regexes that successively search
+ * within previous matches. The provided `chain` array can contain regexes and or objects with
+ * `regex` and `backref` properties. When a backreference is specified, the named or numbered
+ * backreference is passed forward to the next regex or returned.
+ *
+ * @memberOf XRegExp
+ * @param {String} str String to search.
+ * @param {Array} chain Regexes that each search for matches within preceding results.
+ * @returns {Array} Matches by the last regex in the chain, or an empty array.
+ * @example
+ *
+ * // Basic usage; matches numbers within tags
+ * XRegExp.matchChain('1 2 3 4 a 56', [
+ * XRegExp('(?is).*?'),
+ * /\d+/
+ * ]);
+ * // -> ['2', '4', '56']
+ *
+ * // Passing forward and returning specific backreferences
+ * const html = `XRegExp
+ * Google`;
+ * XRegExp.matchChain(html, [
+ * {regex: //i, backref: 1},
+ * {regex: XRegExp('(?i)^https?://(?