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;
+ }
}
- 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.');
+ 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));
}
- 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]);
+ return output;
+ };
+};
+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';
+ }
}
- else {
- cacheKey = await cache.restoreCache(cachePaths, primaryKey);
+ 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 ? '|' : '');
}
- core.setOutput('cache-hit', Boolean(cacheKey));
- if (!cacheKey) {
- core.info(`${packageManager} cache is not found`);
- return;
+ if (item.astral) {
+ combined += item.astral;
}
- 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()}`);
+ if (item.isBmpLast && item.bmp) {
+ var _context2;
+ combined += (0, _concat["default"])(_context2 = "".concat(item.astral ? '|' : '', "[")).call(_context2, item.bmp, "]");
}
- return path_1.default.join(workspace, lockFile);
-};
+ // 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);
+ }
+ }
+
+ // 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;
+ }
+ 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;
+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;
+ }
+ }
+ } 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];
}
- else if (packageManager === 'yarn') {
- return exports.supportedPackageManagers.yarn;
+ }
+ 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;
+}
+
+/**
+ * Removes any duplicate characters from the provided string.
+ *
+ * @private
+ * @param {String} str String to remove duplicate characters from.
+ * @returns {string} String with any duplicate characters removed.
+ */
+function clipDuplicates(str) {
+ return str.replace(/([\s\S])(?=[\s\S]*\1)/g, '');
+}
+
+/**
+ * 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;
}
- else {
- return null;
+ // 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);
}
-};
-exports.getPackageManagerInfo = getPackageManagerInfo;
+ }
+
+ // 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;
+}
+
/**
- * getProjectDirectoriesFromCacheDependencyPath is called twice during `restoreCache`
- * - first through `getCacheDirectories`
- * - second from `repoHasYarn3ManagedCache`
+ * Converts hexadecimal to decimal.
*
- * it contains expensive IO operation and thus should be memoized
+ * @private
+ * @param {String} hex
+ * @returns {number}
*/
-let projectDirectoriesMemoized = null;
+function dec(hex) {
+ return (0, _parseInt2["default"])(hex, 16);
+}
+
/**
- * unit test must reset memoized variables
- */
-const resetProjectDirectoriesMemoized = () => (projectDirectoriesMemoized = null);
-exports.resetProjectDirectoriesMemoized = resetProjectDirectoriesMemoized;
+ * 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.
+ */
+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];
+}
+
/**
- * 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
+ * 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 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 hasNamedCapture(regex) {
+ return !!(regex[REGEX_DATA] && regex[REGEX_DATA].captureNames);
+}
+
/**
- * 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
+ * Converts decimal to hexadecimal.
+ *
+ * @private
+ * @param {Number|String} dec
+ * @returns {string}
*/
-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 hex(dec) {
+ return (0, _parseInt2["default"])(dec, 10).toString(16);
+}
+
/**
- * 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
+ * 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 getCacheDirectoriesForRootProject = async (packageManagerInfo) => {
- const cacheFolderPath = await packageManagerInfo.getCacheFolderPath();
- core.debug(`${packageManagerInfo.name}'s cache folder "${cacheFolderPath}" configured for the root directory`);
- return [cacheFolderPath];
-};
+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 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
+ * 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 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 isType(value, type) {
+ return Object.prototype.toString.call(value) === "[object ".concat(type, "]");
+}
+
/**
- * 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
+ * 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.
*/
-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;
+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));
+ }
+
+ // 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));
}
- else {
- core.debug(`"${workDir}" dependencies are not managed by yarn 3 locally`);
- return false;
+ // Allow duplicate flags within the mode modifier
+ flags = clipDuplicates(flags + $1);
+ return '';
+ });
+
+ // 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
+ };
+}
+
/**
- * 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
+ * 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.
*/
-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 registerFlag(flag) {
+ if (!/^[\w$]$/.test(flag)) {
+ throw new Error('Flag must be a single character A-Za-z0-9_$');
+ }
+ registeredFlags[flag] = true;
}
-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;
+
+/**
+ * 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;
}
- core.warning('The runner was not able to contact the cache service. Caching will be skipped');
- return false;
+ }
+ return result;
}
+/**
+ * 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;
+}
-/***/ }),
+/**
+ * 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;
+}
-/***/ 27242:
-/***/ ((__unused_webpack_module, exports) => {
+// ==--------------------------==
+// Constructor
+// ==--------------------------==
-"use strict";
+/**
+ * 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
+ * (?