UNPKG

path-serializer

Version:
931 lines (930 loc) 37.4 kB
var __webpack_modules__ = { "./node_modules/.pnpm/upath@2.0.1/node_modules/upath/build/code/upath.js": function(__unused_webpack_module, exports1, __webpack_require__) { /** * upath http://github.com/anodynos/upath/ * * A proxy to `path`, replacing `\` with `/` for all results (supports UNC paths) & new methods to normalize & join keeping leading `./` and add, change, default, trim file extensions. * Version 2.0.1 - Compiled on 2020-11-07 16:59:47 * Repository git://github.com/anodynos/upath * Copyright(c) 2020 Angelos Pikoulas <agelos.pikoulas@gmail.com> * License MIT */ // Generated by uRequire v0.7.0-beta.33 target: 'lib' template: 'nodejs' var VERSION = '2.0.1'; // injected by urequire-rc-inject-version var extraFn, extraFunctions, isFunction, isString, isValidExt, name, path, propName, propValue, toUnix, upath, slice = [].slice, indexOf = [].indexOf || function(item) { for(var i = 0, l = this.length; i < l; i++)if (i in this && this[i] === item) return i; return -1; }, hasProp = {}.hasOwnProperty; path = __webpack_require__("path"); isFunction = function(val) { return "function" == typeof val; }; isString = function(val) { return "string" == typeof val || !!val && "object" == typeof val && "[object String]" === Object.prototype.toString.call(val); }; upath = exports1; upath.VERSION = null != VERSION ? VERSION : "NO-VERSION"; toUnix = function(p) { p = p.replace(/\\/g, "/"); p = p.replace(/(?<!^)\/+/g, "/"); return p; }; for(propName in path){ propValue = path[propName]; if (isFunction(propValue)) upath[propName] = function(propName) { return function() { var args, result; args = 1 <= arguments.length ? slice.call(arguments, 0) : []; args = args.map(function(p) { if (isString(p)) return toUnix(p); return p; }); result = path[propName].apply(path, args); if (isString(result)) return toUnix(result); return result; }; }(propName); else upath[propName] = propValue; } upath.sep = "/"; extraFunctions = { toUnix: toUnix, normalizeSafe: function(p) { var result; p = toUnix(p); result = upath.normalize(p); if (!p.startsWith("./") || result.startsWith("./") || result.startsWith("..")) { if (p.startsWith("//") && !result.startsWith("//")) result = p.startsWith("//./") ? "//." + result : "/" + result; } else result = "./" + result; return result; }, normalizeTrim: function(p) { p = upath.normalizeSafe(p); if (p.endsWith("/")) return p.slice(0, +(p.length - 2) + 1 || 9000000000); return p; }, joinSafe: function() { var p, p0, result; p = 1 <= arguments.length ? slice.call(arguments, 0) : []; result = upath.join.apply(null, p); if (p.length > 0) { p0 = toUnix(p[0]); if (!p0.startsWith("./") || result.startsWith("./") || result.startsWith("..")) { if (p0.startsWith("//") && !result.startsWith("//")) result = p0.startsWith("//./") ? "//." + result : "/" + result; } else result = "./" + result; } return result; }, addExt: function(file, ext) { if (!ext) return file; if ("." !== ext[0]) ext = "." + ext; return file + (file.endsWith(ext) ? "" : ext); }, trimExt: function(filename, ignoreExts, maxSize) { var oldExt; if (null == maxSize) maxSize = 7; oldExt = upath.extname(filename); if (isValidExt(oldExt, ignoreExts, maxSize)) return filename.slice(0, +(filename.length - oldExt.length - 1) + 1 || 9000000000); return filename; }, removeExt: function(filename, ext) { if (!ext) return filename; ext = "." === ext[0] ? ext : "." + ext; if (upath.extname(filename) === ext) return upath.trimExt(filename, [], ext.length); return filename; }, changeExt: function(filename, ext, ignoreExts, maxSize) { if (null == maxSize) maxSize = 7; return upath.trimExt(filename, ignoreExts, maxSize) + (ext ? "." === ext[0] ? ext : "." + ext : ""); }, defaultExt: function(filename, ext, ignoreExts, maxSize) { var oldExt; if (null == maxSize) maxSize = 7; oldExt = upath.extname(filename); if (isValidExt(oldExt, ignoreExts, maxSize)) return filename; return upath.addExt(filename, ext); } }; isValidExt = function(ext, ignoreExts, maxSize) { if (null == ignoreExts) ignoreExts = []; return ext && ext.length <= maxSize && indexOf.call(ignoreExts.map(function(e) { return (e && "." !== e[0] ? "." : "") + e; }), ext) < 0; }; for(name in extraFunctions)if (!!hasProp.call(extraFunctions, name)) { extraFn = extraFunctions[name]; if (void 0 !== upath[name]) throw new Error("path." + name + " already exists."); upath[name] = extraFn; } }, path: function(module) { "use strict"; module.exports = require("path"); } }; /************************************************************************/ // The module cache var __webpack_module_cache__ = {}; // The require function function __webpack_require__(moduleId) { // Check if module is in cache var cachedModule = __webpack_module_cache__[moduleId]; if (void 0 !== cachedModule) return cachedModule.exports; // Create a new module (and put it into the cache) var module = __webpack_module_cache__[moduleId] = { exports: {} }; // Execute the module function __webpack_modules__[moduleId](module, module.exports, __webpack_require__); // Return the exports of the module return module.exports; } /************************************************************************/ // webpack/runtime/compat_get_default_export (()=>{ // getDefaultExport function for compatibility with non-ESM modules __webpack_require__.n = function(module) { var getter = module && module.__esModule ? function() { return module['default']; } : function() { return module; }; __webpack_require__.d(getter, { a: getter }); return getter; }; })(); // webpack/runtime/define_property_getters (()=>{ __webpack_require__.d = function(exports1, definition) { for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, { enumerable: true, get: definition[key] }); }; })(); // webpack/runtime/has_own_property (()=>{ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }; })(); // webpack/runtime/make_namespace_object (()=>{ // define __esModule on exports __webpack_require__.r = function(exports1) { if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, { value: 'Module' }); Object.defineProperty(exports1, '__esModule', { value: true }); }; })(); /************************************************************************/ var __webpack_exports__ = {}; // This entry need to be wrapped in an IIFE because it need to be in strict mode. (()=>{ "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { createSnapshotSerializer: ()=>/* reexport */ createSnapshotSerializer }); const external_node_url_namespaceObject = require("node:url"); /** * A specialized version of `_.reduce` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {boolean} [initAccum] Specify using the first element of `array` as * the initial value. * @returns {*} Returns the accumulated value. */ function arrayReduce(array, iteratee, accumulator, initAccum) { var index = -1, length = null == array ? 0 : array.length; if (initAccum && length) accumulator = array[++index]; while(++index < length)accumulator = iteratee(accumulator, array[index], index, array); return accumulator; } /* ESM default export */ const _arrayReduce = arrayReduce; /** * The base implementation of `_.propertyOf` without support for deep paths. * * @private * @param {Object} object The object to query. * @returns {Function} Returns the new accessor function. */ function basePropertyOf(object) { return function(key) { return null == object ? void 0 : object[key]; }; } /* ESM default export */ const _basePropertyOf = basePropertyOf; /** Used to map Latin Unicode letters to basic Latin letters. */ var deburredLetters = { // Latin-1 Supplement block. À: 'A', Á: 'A', Â: 'A', Ã: 'A', Ä: 'A', Å: 'A', à: 'a', á: 'a', â: 'a', ã: 'a', ä: 'a', å: 'a', Ç: 'C', ç: 'c', Ð: 'D', ð: 'd', È: 'E', É: 'E', Ê: 'E', Ë: 'E', è: 'e', é: 'e', ê: 'e', ë: 'e', Ì: 'I', Í: 'I', Î: 'I', Ï: 'I', ì: 'i', í: 'i', î: 'i', ï: 'i', Ñ: 'N', ñ: 'n', Ò: 'O', Ó: 'O', Ô: 'O', Õ: 'O', Ö: 'O', Ø: 'O', ò: 'o', ó: 'o', ô: 'o', õ: 'o', ö: 'o', ø: 'o', Ù: 'U', Ú: 'U', Û: 'U', Ü: 'U', ù: 'u', ú: 'u', û: 'u', ü: 'u', Ý: 'Y', ý: 'y', ÿ: 'y', Æ: 'Ae', æ: 'ae', Þ: 'Th', þ: 'th', ß: 'ss', // Latin Extended-A block. Ā: 'A', Ă: 'A', Ą: 'A', ā: 'a', ă: 'a', ą: 'a', Ć: 'C', Ĉ: 'C', Ċ: 'C', Č: 'C', ć: 'c', ĉ: 'c', ċ: 'c', č: 'c', Ď: 'D', Đ: 'D', ď: 'd', đ: 'd', Ē: 'E', Ĕ: 'E', Ė: 'E', Ę: 'E', Ě: 'E', ē: 'e', ĕ: 'e', ė: 'e', ę: 'e', ě: 'e', Ĝ: 'G', Ğ: 'G', Ġ: 'G', Ģ: 'G', ĝ: 'g', ğ: 'g', ġ: 'g', ģ: 'g', Ĥ: 'H', Ħ: 'H', ĥ: 'h', ħ: 'h', Ĩ: 'I', Ī: 'I', Ĭ: 'I', Į: 'I', İ: 'I', ĩ: 'i', ī: 'i', ĭ: 'i', į: 'i', ı: 'i', Ĵ: 'J', ĵ: 'j', Ķ: 'K', ķ: 'k', ĸ: 'k', Ĺ: 'L', Ļ: 'L', Ľ: 'L', Ŀ: 'L', Ł: 'L', ĺ: 'l', ļ: 'l', ľ: 'l', ŀ: 'l', ł: 'l', Ń: 'N', Ņ: 'N', Ň: 'N', Ŋ: 'N', ń: 'n', ņ: 'n', ň: 'n', ŋ: 'n', Ō: 'O', Ŏ: 'O', Ő: 'O', ō: 'o', ŏ: 'o', ő: 'o', Ŕ: 'R', Ŗ: 'R', Ř: 'R', ŕ: 'r', ŗ: 'r', ř: 'r', Ś: 'S', Ŝ: 'S', Ş: 'S', Š: 'S', ś: 's', ŝ: 's', ş: 's', š: 's', Ţ: 'T', Ť: 'T', Ŧ: 'T', ţ: 't', ť: 't', ŧ: 't', Ũ: 'U', Ū: 'U', Ŭ: 'U', Ů: 'U', Ű: 'U', Ų: 'U', ũ: 'u', ū: 'u', ŭ: 'u', ů: 'u', ű: 'u', ų: 'u', Ŵ: 'W', ŵ: 'w', Ŷ: 'Y', ŷ: 'y', Ÿ: 'Y', Ź: 'Z', Ż: 'Z', Ž: 'Z', ź: 'z', ż: 'z', ž: 'z', IJ: 'IJ', ij: 'ij', Œ: 'Oe', œ: 'oe', ʼn: "'n", ſ: 's' }; /** * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A * letters to basic Latin letters. * * @private * @param {string} letter The matched letter to deburr. * @returns {string} Returns the deburred letter. */ var deburrLetter = _basePropertyOf(deburredLetters); /* ESM default export */ const _deburrLetter = deburrLetter; /** Detect free variable `global` from Node.js. */ var freeGlobal = 'object' == typeof global && global && global.Object === Object && global; /* ESM default export */ const _freeGlobal = freeGlobal; /** Detect free variable `self`. */ var freeSelf = 'object' == typeof self && self && self.Object === Object && self; /** Used as a reference to the global object. */ var _root_root = _freeGlobal || freeSelf || Function('return this')(); /* ESM default export */ const _root = _root_root; /** Built-in value references. */ var Symbol1 = _root.Symbol; /* ESM default export */ const _Symbol = Symbol1; /** * A specialized version of `_.map` for arrays without support for iteratee * shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function arrayMap(array, iteratee) { var index = -1, length = null == array ? 0 : array.length, result = Array(length); while(++index < length)result[index] = iteratee(array[index], index, array); return result; } /* ESM default export */ const _arrayMap = arrayMap; /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array, else `false`. * @example * * _.isArray([1, 2, 3]); * // => true * * _.isArray(document.body.children); * // => false * * _.isArray('abc'); * // => false * * _.isArray(_.noop); * // => false */ var isArray_isArray = Array.isArray; /* ESM default export */ const isArray = isArray_isArray; /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var _getRawTag_hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var nativeObjectToString = objectProto.toString; /** Built-in value references. */ var symToStringTag = _Symbol ? _Symbol.toStringTag : void 0; /** * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. * * @private * @param {*} value The value to query. * @returns {string} Returns the raw `toStringTag`. */ function getRawTag(value) { var isOwn = _getRawTag_hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag]; try { value[symToStringTag] = void 0; var unmasked = true; } catch (e) {} var result = nativeObjectToString.call(value); if (unmasked) { if (isOwn) value[symToStringTag] = tag; else delete value[symToStringTag]; } return result; } /* ESM default export */ const _getRawTag = getRawTag; /** Used for built-in method references. */ var _objectToString_objectProto = Object.prototype; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var _objectToString_nativeObjectToString = _objectToString_objectProto.toString; /** * Converts `value` to a string using `Object.prototype.toString`. * * @private * @param {*} value The value to convert. * @returns {string} Returns the converted string. */ function objectToString(value) { return _objectToString_nativeObjectToString.call(value); } /* ESM default export */ const _objectToString = objectToString; /** `Object#toString` result references. */ var nullTag = '[object Null]', undefinedTag = '[object Undefined]'; /** Built-in value references. */ var _baseGetTag_symToStringTag = _Symbol ? _Symbol.toStringTag : void 0; /** * The base implementation of `getTag` without fallbacks for buggy environments. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ function baseGetTag(value) { if (null == value) return void 0 === value ? undefinedTag : nullTag; return _baseGetTag_symToStringTag && _baseGetTag_symToStringTag in Object(value) ? _getRawTag(value) : _objectToString(value); } /* ESM default export */ const _baseGetTag = baseGetTag; /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return null != value && 'object' == typeof value; } /* ESM default export */ const lodash_es_isObjectLike = isObjectLike; /** `Object#toString` result references. */ var symbolTag = '[object Symbol]'; /** * Checks if `value` is classified as a `Symbol` primitive or object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. * @example * * _.isSymbol(Symbol.iterator); * // => true * * _.isSymbol('abc'); * // => false */ function isSymbol_isSymbol(value) { return 'symbol' == typeof value || lodash_es_isObjectLike(value) && _baseGetTag(value) == symbolTag; } /* ESM default export */ const isSymbol = isSymbol_isSymbol; /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; /** Used to convert symbols to primitives and strings. */ var symbolProto = _Symbol ? _Symbol.prototype : void 0, symbolToString = symbolProto ? symbolProto.toString : void 0; /** * The base implementation of `_.toString` which doesn't convert nullish * values to empty strings. * * @private * @param {*} value The value to process. * @returns {string} Returns the string. */ function baseToString(value) { // Exit early for strings to avoid a performance hit in some environments. if ('string' == typeof value) return value; if (isArray(value)) // Recursively convert values (susceptible to call stack limits). return _arrayMap(value, baseToString) + ''; if (isSymbol(value)) return symbolToString ? symbolToString.call(value) : ''; var result = value + ''; return '0' == result && 1 / value == -INFINITY ? '-0' : result; } /* ESM default export */ const _baseToString = baseToString; /** * Converts `value` to a string. An empty string is returned for `null` * and `undefined` values. The sign of `-0` is preserved. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to convert. * @returns {string} Returns the converted string. * @example * * _.toString(null); * // => '' * * _.toString(-0); * // => '-0' * * _.toString([1, 2, 3]); * // => '1,2,3' */ function toString_toString(value) { return null == value ? '' : _baseToString(value); } /* ESM default export */ const lodash_es_toString = toString_toString; /** Used to match Latin Unicode letters (excluding mathematical operators). */ var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; /** Used to compose unicode character classes. */ var rsComboMarksRange = '\\u0300-\\u036f', reComboHalfMarksRange = '\\ufe20-\\ufe2f', rsComboSymbolsRange = '\\u20d0-\\u20ff', rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange; /** Used to compose unicode capture groups. */ var rsCombo = '[' + rsComboRange + ']'; /** * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). */ var reComboMark = RegExp(rsCombo, 'g'); /** * Deburrs `string` by converting * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) * letters to basic Latin letters and removing * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to deburr. * @returns {string} Returns the deburred string. * @example * * _.deburr('déjà vu'); * // => 'deja vu' */ function deburr_deburr(string) { string = lodash_es_toString(string); return string && string.replace(reLatin, _deburrLetter).replace(reComboMark, ''); } /* ESM default export */ const deburr = deburr_deburr; /** Used to match words composed of alphanumeric characters. */ var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; /** * Splits an ASCII `string` into an array of its words. * * @private * @param {string} The string to inspect. * @returns {Array} Returns the words of `string`. */ function asciiWords(string) { return string.match(reAsciiWord) || []; } /* ESM default export */ const _asciiWords = asciiWords; /** Used to detect strings that need a more robust regexp to match words. */ var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; /** * Checks if `string` contains a word composed of Unicode symbols. * * @private * @param {string} string The string to inspect. * @returns {boolean} Returns `true` if a word is found, else `false`. */ function hasUnicodeWord(string) { return reHasUnicodeWord.test(string); } /* ESM default export */ const _hasUnicodeWord = hasUnicodeWord; /** Used to compose unicode character classes. */ var rsAstralRange = '\\ud800-\\udfff', _unicodeWords_rsComboMarksRange = '\\u0300-\\u036f', _unicodeWords_reComboHalfMarksRange = '\\ufe20-\\ufe2f', _unicodeWords_rsComboSymbolsRange = '\\u20d0-\\u20ff', _unicodeWords_rsComboRange = _unicodeWords_rsComboMarksRange + _unicodeWords_reComboHalfMarksRange + _unicodeWords_rsComboSymbolsRange, rsDingbatRange = '\\u2700-\\u27bf', rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', rsPunctuationRange = '\\u2000-\\u206f', rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', rsVarRange = '\\ufe0e\\ufe0f', rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; /** Used to compose unicode capture groups. */ var rsApos = "['\u2019]", rsBreak = '[' + rsBreakRange + ']', _unicodeWords_rsCombo = '[' + _unicodeWords_rsComboRange + ']', rsDigits = '\\d+', rsDingbat = '[' + rsDingbatRange + ']', rsLower = '[' + rsLowerRange + ']', rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', rsFitz = '\\ud83c[\\udffb-\\udfff]', rsModifier = '(?:' + _unicodeWords_rsCombo + '|' + rsFitz + ')', rsNonAstral = '[^' + rsAstralRange + ']', rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', rsUpper = '[' + rsUpperRange + ']', rsZWJ = '\\u200d'; /** Used to compose unicode regexes. */ var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')', rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')', rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', reOptMod = rsModifier + '?', rsOptVar = '[' + rsVarRange + ']?', rsOptJoin = '(?:' + rsZWJ + '(?:' + [ rsNonAstral, rsRegional, rsSurrPair ].join('|') + ')' + rsOptVar + reOptMod + ')*', rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = '(?:' + [ rsDingbat, rsRegional, rsSurrPair ].join('|') + ')' + rsSeq; /** Used to match complex or compound words. */ var reUnicodeWord = RegExp([ rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [ rsBreak, rsUpper, '$' ].join('|') + ')', rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [ rsBreak, rsUpper + rsMiscLower, '$' ].join('|') + ')', rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, rsUpper + '+' + rsOptContrUpper, rsOrdUpper, rsOrdLower, rsDigits, rsEmoji ].join('|'), 'g'); /** * Splits a Unicode `string` into an array of its words. * * @private * @param {string} The string to inspect. * @returns {Array} Returns the words of `string`. */ function unicodeWords(string) { return string.match(reUnicodeWord) || []; } /* ESM default export */ const _unicodeWords = unicodeWords; /** * Splits `string` into an array of its words. * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to inspect. * @param {RegExp|string} [pattern] The pattern to match words. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the words of `string`. * @example * * _.words('fred, barney, & pebbles'); * // => ['fred', 'barney', 'pebbles'] * * _.words('fred, barney, & pebbles', /[^, ]+/g); * // => ['fred', 'barney', '&', 'pebbles'] */ function words_words(string, pattern, guard) { string = lodash_es_toString(string); pattern = guard ? void 0 : pattern; if (void 0 === pattern) return _hasUnicodeWord(string) ? _unicodeWords(string) : _asciiWords(string); return string.match(pattern) || []; } /* ESM default export */ const words = words_words; /** Used to compose unicode capture groups. */ var _createCompounder_rsApos = "['\u2019]"; /** Used to match apostrophes. */ var reApos = RegExp(_createCompounder_rsApos, 'g'); /** * Creates a function like `_.camelCase`. * * @private * @param {Function} callback The function to combine each word. * @returns {Function} Returns the new compounder function. */ function createCompounder(callback) { return function(string) { return _arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); }; } /* ESM default export */ const _createCompounder = createCompounder; /** * Converts `string` to * [snake case](https://en.wikipedia.org/wiki/Snake_case). * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the snake cased string. * @example * * _.snakeCase('Foo Bar'); * // => 'foo_bar' * * _.snakeCase('fooBar'); * // => 'foo_bar' * * _.snakeCase('--FOO-BAR--'); * // => 'foo_bar' */ var snakeCase_snakeCase = _createCompounder(function(result, word, index) { return result + (index ? '_' : '') + word.toLowerCase(); }); /* ESM default export */ const snakeCase = snakeCase_snakeCase; const external_node_fs_namespaceObject = require("node:fs"); var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject); const external_node_os_namespaceObject = require("node:os"); var external_node_os_default = /*#__PURE__*/ __webpack_require__.n(external_node_os_namespaceObject); /** * Used to match `RegExp` * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source); /** * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to escape. * @returns {string} Returns the escaped string. * @example * * _.escapeRegExp('[lodash](https://lodash.com/)'); * // => '\[lodash\]\(https://lodash\.com/\)' */ function escapeRegExp(string) { string = lodash_es_toString(string); return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, '\\$&') : string; } /* ESM default export */ const lodash_es_escapeRegExp = escapeRegExp; function getRealTemporaryDirectory() { let ret = null; try { ret = external_node_os_default().tmpdir(); ret = external_node_fs_default().realpathSync(ret); } catch {} return ret; } /** * Compile path string to RegExp. * @note Only support posix path. */ function compilePathMatcherRegExp(match) { if ('string' != typeof match) return match; const escaped = lodash_es_escapeRegExp(match); return new RegExp(`(?<=\\W|^)${escaped}(?=\\W|$)`, 'g'); } function splitPathString(str) { return str.split(/[\\/]/); } function applyPathMatcher(matcher, str, options = {}) { const regex = compilePathMatcherRegExp(matcher.match); const replacer = (substring, ...args)=>{ if (options.minPartials && splitPathString(substring).length < options.minPartials) return substring; const ret = 'string' == typeof matcher.mark ? matcher.mark : matcher.mark(substring, ...args); return `<${snakeCase(ret).toUpperCase()}>`; }; return str.replace(regex, replacer); } function applyMatcherReplacement(matchers, str, options = {}) { return matchers.reduce((ret, matcher)=>applyPathMatcher(matcher, ret, options), str); } const createTmpDirMatchers = ()=>{ const ret = []; const realTmpDir = getRealTemporaryDirectory(); realTmpDir && ret.push({ match: realTmpDir, mark: 'temp' }); const tmpDir = external_node_os_default().tmpdir(); tmpDir && ret.push({ match: tmpDir, mark: 'temp' }); return ret; }; const createHomeDirMatchers = ()=>{ const ret = []; const homedir = external_node_os_default().homedir(); homedir && ret.push({ match: homedir, mark: 'home' }); return ret; }; const createPnpmInnerMatchers = ()=>[ // posix { match: /(?<=\/)(\.pnpm\/.+?\/node_modules)(?=\/)/g, mark: 'pnpmInner' }, // win32 { match: /(?<=\\)(\.pnpm\\.+?\\node_modules)(?=\\)/g, mark: 'pnpmInner' } ]; const external_node_path_namespaceObject = require("node:path"); var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject); // EXTERNAL MODULE: ./node_modules/.pnpm/upath@2.0.1/node_modules/upath/build/code/upath.js var upath = __webpack_require__("./node_modules/.pnpm/upath@2.0.1/node_modules/upath/build/code/upath.js"); var upath_default = /*#__PURE__*/ __webpack_require__.n(upath); const normalizePathToPosix = (p)=>upath_default().normalizeSafe(external_node_path_default().normalize(p || '')).replace(/^([a-zA-Z]+):/, (_, m)=>`/${m.toLowerCase()}`); // find the path in code and replace it with normalizePathToPosix const normalizeCodeToPosix = (code)=>code.replace(// ignore http, https, file /(?<![a-zA-Z])([a-zA-Z]:[\\/]+)([-\u4e00-\u9fa5\w\s.()~!@#$%^&()\[\]{}+=]+[\\/]+)*/g, (match, _diskName)=>normalizePathToPosix(match.replace(/[\\]{2,}/g, '\\'))); const normalizeCLR = (str)=>str.replace(/\u001b\[1m\u001b\[([0-9;]*)m/g, '<CLR=$1,BOLD>').replace(/\u001b\[1m/g, '<CLR=BOLD>').replace(/\u001b\[39m\u001b\[22m/g, '</CLR>').replace(/\u001b\[([0-9;]*)m/g, '<CLR=$1>') // CHANGE: The time unit display in Rspack is second // CHANGE2: avoid a bad case "./react/assets.svg" -> "./react/assetsXsvg" // modified based on https://github.com/webpack/webpack/blob/001cab14692eb9a833c6b56709edbab547e291a1/test/StatsTestCases.basictest.js#L199 .replace(/[0-9]+(\.[0-9]+)*(<\/CLR>)?(\s?s)/g, 'X$2$3'); function createSnapshotSerializer(options) { const { root = process.cwd(), workspace = '', replace: customMatchers = [], replacePost: customPostMatchers = [], features = {}, beforeSerialize, afterSerialize } = options || {}; const { replaceWorkspaceWithFileProtocol = true, replaceWorkspace = true, replaceRootWithFileProtocol = true, replaceRoot = true, replacePnpmInner = true, replaceTmpDir = true, replaceHomeDir = true, addDoubleQuotes = true, transformWin32Path = true, escapeDoubleQuotes = true, escapeEOL = true, transformCLR = true } = features; function createPathMatchers() { const pathMatchers = []; pathMatchers.push(...customMatchers); if (replaceWorkspace && workspace) pathMatchers.push({ mark: 'workspace', match: workspace }); if (replaceRoot && root) pathMatchers.push({ mark: 'root', match: root }); if (replacePnpmInner) pathMatchers.push(...createPnpmInnerMatchers()); if (replaceTmpDir) pathMatchers.push(...createTmpDirMatchers()); if (replaceHomeDir) pathMatchers.push(...createHomeDirMatchers()); pathMatchers.push(...customPostMatchers); return pathMatchers; } const pathMatchers = createPathMatchers(); for (const matcher of pathMatchers)if ('string' == typeof matcher.match) matcher.match = normalizePathToPosix(matcher.match); const serializer = { // match path-format string test (val) { return 'string' == typeof val; }, serialize (val) { let replaced = val; if (beforeSerialize) replaced = beforeSerialize(replaced); if (replaceWorkspaceWithFileProtocol && workspace) // this is a polyfill for .replaceAll(string, string) replaced = replaced.split((0, external_node_url_namespaceObject.pathToFileURL)(workspace).toString()).join('<WORKSPACE>'); if (replaceRootWithFileProtocol && root) // this is a polyfill for .replaceAll(string, string) replaced = replaced.split((0, external_node_url_namespaceObject.pathToFileURL)(root).toString()).join('<ROOT>'); if (transformWin32Path) replaced = normalizeCodeToPosix(replaced); replaced = applyMatcherReplacement(pathMatchers, replaced); if (transformCLR) replaced = normalizeCLR(replaced); if (escapeDoubleQuotes) replaced = replaced.replace(/"/g, '\\"'); if (escapeEOL) replaced = replaced.replace(/\\r\\n/g, '\\n'); if (addDoubleQuotes) replaced = `"${replaced}"`; if (afterSerialize) replaced = afterSerialize(replaced); return replaced; } }; return serializer; } // export types related to `createSnapshotSerializer` })(); var __webpack_export_target__ = exports; for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__]; if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', { value: true });