UNPKG

vite

Version:

Native-ESM powered web dev build tool

1,781 lines (1,478 loc) 236 kB
import { Q as commonjsGlobal, P as getDefaultExportFromCjs } from './dep-DrOo5SEf.js'; import require$$0$2 from 'fs'; import require$$0 from 'postcss'; import require$$0$1 from 'path'; import require$$3 from 'crypto'; import require$$1 from 'util'; import { l as lib } from './dep-3RmXg9uo.js'; function _mergeNamespaces(n, m) { for (var i = 0; i < m.length; i++) { var e = m[i]; if (typeof e !== 'string' && !Array.isArray(e)) { for (var k in e) { if (k !== 'default' && !(k in n)) { n[k] = e[k]; } } } } return n; } var build = {exports: {}}; var fs = {}; Object.defineProperty(fs, "__esModule", { value: true }); fs.getFileSystem = getFileSystem; fs.setFileSystem = setFileSystem; let fileSystem = { readFile: () => { throw Error("readFile not implemented"); }, writeFile: () => { throw Error("writeFile not implemented"); } }; function setFileSystem(fs) { fileSystem.readFile = fs.readFile; fileSystem.writeFile = fs.writeFile; } function getFileSystem() { return fileSystem; } var pluginFactory = {}; var unquote$1 = {}; Object.defineProperty(unquote$1, "__esModule", { value: true }); unquote$1.default = unquote; // copied from https://github.com/lakenen/node-unquote const reg = /['"]/; function unquote(str) { if (!str) { return ""; } if (reg.test(str.charAt(0))) { str = str.substr(1); } if (reg.test(str.charAt(str.length - 1))) { str = str.substr(0, str.length - 1); } return str; } var Parser$1 = {}; const matchValueName = /[$]?[\w-]+/g; const replaceValueSymbols$2 = (value, replacements) => { let matches; while ((matches = matchValueName.exec(value))) { const replacement = replacements[matches[0]]; if (replacement) { value = value.slice(0, matches.index) + replacement + value.slice(matchValueName.lastIndex); matchValueName.lastIndex -= matches[0].length - replacement.length; } } return value; }; var replaceValueSymbols_1 = replaceValueSymbols$2; const replaceValueSymbols$1 = replaceValueSymbols_1; const replaceSymbols$1 = (css, replacements) => { css.walk((node) => { if (node.type === "decl" && node.value) { node.value = replaceValueSymbols$1(node.value.toString(), replacements); } else if (node.type === "rule" && node.selector) { node.selector = replaceValueSymbols$1( node.selector.toString(), replacements ); } else if (node.type === "atrule" && node.params) { node.params = replaceValueSymbols$1(node.params.toString(), replacements); } }); }; var replaceSymbols_1 = replaceSymbols$1; const importPattern = /^:import\(("[^"]*"|'[^']*'|[^"']+)\)$/; const balancedQuotes = /^("[^"]*"|'[^']*'|[^"']+)$/; const getDeclsObject = (rule) => { const object = {}; rule.walkDecls((decl) => { const before = decl.raws.before ? decl.raws.before.trim() : ""; object[before + decl.prop] = decl.value; }); return object; }; /** * * @param {string} css * @param {boolean} removeRules * @param {'auto' | 'rule' | 'at-rule'} mode */ const extractICSS$2 = (css, removeRules = true, mode = "auto") => { const icssImports = {}; const icssExports = {}; function addImports(node, path) { const unquoted = path.replace(/'|"/g, ""); icssImports[unquoted] = Object.assign( icssImports[unquoted] || {}, getDeclsObject(node) ); if (removeRules) { node.remove(); } } function addExports(node) { Object.assign(icssExports, getDeclsObject(node)); if (removeRules) { node.remove(); } } css.each((node) => { if (node.type === "rule" && mode !== "at-rule") { if (node.selector.slice(0, 7) === ":import") { const matches = importPattern.exec(node.selector); if (matches) { addImports(node, matches[1]); } } if (node.selector === ":export") { addExports(node); } } if (node.type === "atrule" && mode !== "rule") { if (node.name === "icss-import") { const matches = balancedQuotes.exec(node.params); if (matches) { addImports(node, matches[1]); } } if (node.name === "icss-export") { addExports(node); } } }); return { icssImports, icssExports }; }; var extractICSS_1 = extractICSS$2; const createImports = (imports, postcss, mode = "rule") => { return Object.keys(imports).map((path) => { const aliases = imports[path]; const declarations = Object.keys(aliases).map((key) => postcss.decl({ prop: key, value: aliases[key], raws: { before: "\n " }, }) ); const hasDeclarations = declarations.length > 0; const rule = mode === "rule" ? postcss.rule({ selector: `:import('${path}')`, raws: { after: hasDeclarations ? "\n" : "" }, }) : postcss.atRule({ name: "icss-import", params: `'${path}'`, raws: { after: hasDeclarations ? "\n" : "" }, }); if (hasDeclarations) { rule.append(declarations); } return rule; }); }; const createExports = (exports, postcss, mode = "rule") => { const declarations = Object.keys(exports).map((key) => postcss.decl({ prop: key, value: exports[key], raws: { before: "\n " }, }) ); if (declarations.length === 0) { return []; } const rule = mode === "rule" ? postcss.rule({ selector: `:export`, raws: { after: "\n" }, }) : postcss.atRule({ name: "icss-export", raws: { after: "\n" }, }); rule.append(declarations); return [rule]; }; const createICSSRules$1 = (imports, exports, postcss, mode) => [ ...createImports(imports, postcss, mode), ...createExports(exports, postcss, mode), ]; var createICSSRules_1 = createICSSRules$1; const replaceValueSymbols = replaceValueSymbols_1; const replaceSymbols = replaceSymbols_1; const extractICSS$1 = extractICSS_1; const createICSSRules = createICSSRules_1; var src$4 = { replaceValueSymbols, replaceSymbols, extractICSS: extractICSS$1, createICSSRules, }; Object.defineProperty(Parser$1, "__esModule", { value: true }); Parser$1.default = void 0; var _icssUtils = src$4; // Initially copied from https://github.com/css-modules/css-modules-loader-core const importRegexp = /^:import\((.+)\)$/; class Parser { constructor(pathFetcher, trace) { this.pathFetcher = pathFetcher; this.plugin = this.plugin.bind(this); this.exportTokens = {}; this.translations = {}; this.trace = trace; } plugin() { const parser = this; return { postcssPlugin: "css-modules-parser", async OnceExit(css) { await Promise.all(parser.fetchAllImports(css)); parser.linkImportedSymbols(css); return parser.extractExports(css); } }; } fetchAllImports(css) { let imports = []; css.each(node => { if (node.type == "rule" && node.selector.match(importRegexp)) { imports.push(this.fetchImport(node, css.source.input.from, imports.length)); } }); return imports; } linkImportedSymbols(css) { (0, _icssUtils.replaceSymbols)(css, this.translations); } extractExports(css) { css.each(node => { if (node.type == "rule" && node.selector == ":export") this.handleExport(node); }); } handleExport(exportNode) { exportNode.each(decl => { if (decl.type == "decl") { Object.keys(this.translations).forEach(translation => { decl.value = decl.value.replace(translation, this.translations[translation]); }); this.exportTokens[decl.prop] = decl.value; } }); exportNode.remove(); } async fetchImport(importNode, relativeTo, depNr) { const file = importNode.selector.match(importRegexp)[1]; const depTrace = this.trace + String.fromCharCode(depNr); const exports = await this.pathFetcher(file, relativeTo, depTrace); try { importNode.each(decl => { if (decl.type == "decl") { this.translations[decl.prop] = exports[decl.value]; } }); importNode.remove(); } catch (err) { console.log(err); } } } Parser$1.default = Parser; var saveJSON$1 = {}; Object.defineProperty(saveJSON$1, "__esModule", { value: true }); saveJSON$1.default = saveJSON; var _fs$2 = fs; function saveJSON(cssFile, json) { return new Promise((resolve, reject) => { const { writeFile } = (0, _fs$2.getFileSystem)(); writeFile(`${cssFile}.json`, JSON.stringify(json), e => e ? reject(e) : resolve(json)); }); } var localsConvention = {}; /** * lodash (Custom Build) <https://lodash.com/> * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors <https://jquery.org/> * Released under MIT license <https://lodash.com/license> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ /** `Object#toString` result references. */ var symbolTag = '[object Symbol]'; /** Used to match words composed of alphanumeric characters. */ var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; /** 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 rsAstralRange = '\\ud800-\\udfff', rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', rsComboSymbolsRange = '\\u20d0-\\u20f0', 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]", rsAstral = '[' + rsAstralRange + ']', rsBreak = '[' + rsBreakRange + ']', rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']', rsDigits = '\\d+', rsDingbat = '[' + rsDingbatRange + ']', rsLower = '[' + rsLowerRange + ']', rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', rsFitz = '\\ud83c[\\udffb-\\udfff]', rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', rsNonAstral = '[^' + rsAstralRange + ']', rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', rsUpper = '[' + rsUpperRange + ']', rsZWJ = '\\u200d'; /** Used to compose unicode regexes. */ var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')', rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')', rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', reOptMod = rsModifier + '?', rsOptVar = '[' + rsVarRange + ']?', rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; /** Used to match apostrophes. */ var reApos = RegExp(rsApos, 'g'); /** * 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'); /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); /** Used to match complex or compound words. */ var reUnicodeWord = RegExp([ rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')', rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr, rsUpper + '+' + rsOptUpperContr, rsDigits, rsEmoji ].join('|'), 'g'); /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); /** 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 ]/; /** Used to map Latin Unicode letters to basic Latin letters. */ var deburredLetters = { // Latin-1 Supplement block. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', '\xc7': 'C', '\xe7': 'c', '\xd0': 'D', '\xf0': 'd', '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', '\xd1': 'N', '\xf1': 'n', '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', '\xc6': 'Ae', '\xe6': 'ae', '\xde': 'Th', '\xfe': 'th', '\xdf': 'ss', // Latin Extended-A block. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', '\u0134': 'J', '\u0135': 'j', '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', '\u0163': 't', '\u0165': 't', '\u0167': 't', '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', '\u0174': 'W', '\u0175': 'w', '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', '\u0132': 'IJ', '\u0133': 'ij', '\u0152': 'Oe', '\u0153': 'oe', '\u0149': "'n", '\u017f': 'ss' }; /** Detect free variable `global` from Node.js. */ var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal; /** Detect free variable `self`. */ var freeSelf = typeof self == 'object' && self && self.Object === Object && self; /** Used as a reference to the global object. */ var root$2 = freeGlobal || freeSelf || Function('return this')(); /** * 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 = array ? array.length : 0; while (++index < length) { accumulator = iteratee(accumulator, array[index], index, array); } return accumulator; } /** * Converts an ASCII `string` to an array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the converted array. */ function asciiToArray(string) { return string.split(''); } /** * 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) || []; } /** * 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 object == null ? undefined : object[key]; }; } /** * 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); /** * Checks if `string` contains Unicode symbols. * * @private * @param {string} string The string to inspect. * @returns {boolean} Returns `true` if a symbol is found, else `false`. */ function hasUnicode(string) { return reHasUnicode.test(string); } /** * 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); } /** * Converts `string` to an array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the converted array. */ function stringToArray(string) { return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string); } /** * Converts a Unicode `string` to an array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the converted array. */ function unicodeToArray(string) { return string.match(reUnicode) || []; } /** * 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) || []; } /** Used for built-in method references. */ var objectProto = Object.prototype; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; /** Built-in value references. */ var Symbol$1 = root$2.Symbol; /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined, symbolToString = symbolProto ? symbolProto.toString : undefined; /** * The base implementation of `_.slice` without an iteratee call guard. * * @private * @param {Array} array The array to slice. * @param {number} [start=0] The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns the slice of `array`. */ function baseSlice(array, start, end) { var index = -1, length = array.length; if (start < 0) { start = -start > length ? 0 : (length + start); } end = end > length ? length : end; if (end < 0) { end += length; } length = start > end ? 0 : ((end - start) >>> 0); start >>>= 0; var result = Array(length); while (++index < length) { result[index] = array[index + start]; } return result; } /** * 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 (typeof value == 'string') { return value; } if (isSymbol(value)) { return symbolToString ? symbolToString.call(value) : ''; } var result = (value + ''); return (result == '0' && (1 / value) == -Infinity) ? '-0' : result; } /** * Casts `array` to a slice if it's needed. * * @private * @param {Array} array The array to inspect. * @param {number} start The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns the cast slice. */ function castSlice(array, start, end) { var length = array.length; end = end === undefined ? length : end; return (false && end >= length) ? array : baseSlice(array, start, end); } /** * Creates a function like `_.lowerFirst`. * * @private * @param {string} methodName The name of the `String` case method to use. * @returns {Function} Returns the new case function. */ function createCaseFirst(methodName) { return function(string) { string = toString(string); var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined; var chr = strSymbols ? strSymbols[0] : string.charAt(0); var trailing = strSymbols ? castSlice(strSymbols, 1).join('') : string.slice(1); return chr[methodName]() + trailing; }; } /** * 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, ''); }; } /** * 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 !!value && typeof value == 'object'; } /** * 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(value) { return typeof value == 'symbol' || (isObjectLike(value) && objectToString.call(value) == symbolTag); } /** * 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 process. * @returns {string} Returns the string. * @example * * _.toString(null); * // => '' * * _.toString(-0); * // => '-0' * * _.toString([1, 2, 3]); * // => '1,2,3' */ function toString(value) { return value == null ? '' : baseToString(value); } /** * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the camel cased string. * @example * * _.camelCase('Foo Bar'); * // => 'fooBar' * * _.camelCase('--foo-bar--'); * // => 'fooBar' * * _.camelCase('__FOO_BAR__'); * // => 'fooBar' */ var camelCase = createCompounder(function(result, word, index) { word = word.toLowerCase(); return result + (index ? capitalize(word) : word); }); /** * Converts the first character of `string` to upper case and the remaining * to lower case. * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to capitalize. * @returns {string} Returns the capitalized string. * @example * * _.capitalize('FRED'); * // => 'Fred' */ function capitalize(string) { return upperFirst(toString(string).toLowerCase()); } /** * 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(string) { string = toString(string); return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); } /** * Converts the first character of `string` to upper case. * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the converted string. * @example * * _.upperFirst('fred'); * // => 'Fred' * * _.upperFirst('FRED'); * // => 'FRED' */ var upperFirst = createCaseFirst('toUpperCase'); /** * 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(string, pattern, guard) { string = toString(string); pattern = pattern; if (pattern === undefined) { return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string); } return string.match(pattern) || []; } var lodash_camelcase = camelCase; Object.defineProperty(localsConvention, "__esModule", { value: true }); localsConvention.makeLocalsConventionReducer = makeLocalsConventionReducer; var _lodash = _interopRequireDefault$5(lodash_camelcase); function _interopRequireDefault$5(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function dashesCamelCase(string) { return string.replace(/-+(\w)/g, (_, firstLetter) => firstLetter.toUpperCase()); } function makeLocalsConventionReducer(localsConvention, inputFile) { const isFunc = typeof localsConvention === "function"; return (tokens, [className, value]) => { if (isFunc) { const convention = localsConvention(className, value, inputFile); tokens[convention] = value; return tokens; } switch (localsConvention) { case "camelCase": tokens[className] = value; tokens[(0, _lodash.default)(className)] = value; break; case "camelCaseOnly": tokens[(0, _lodash.default)(className)] = value; break; case "dashes": tokens[className] = value; tokens[dashesCamelCase(className)] = value; break; case "dashesOnly": tokens[dashesCamelCase(className)] = value; break; } return tokens; }; } var FileSystemLoader$1 = {}; Object.defineProperty(FileSystemLoader$1, "__esModule", { value: true }); FileSystemLoader$1.default = void 0; var _postcss$1 = _interopRequireDefault$4(require$$0); var _path = _interopRequireDefault$4(require$$0$1); var _Parser$1 = _interopRequireDefault$4(Parser$1); var _fs$1 = fs; function _interopRequireDefault$4(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // Initially copied from https://github.com/css-modules/css-modules-loader-core class Core { constructor(plugins) { this.plugins = plugins || Core.defaultPlugins; } async load(sourceString, sourcePath, trace, pathFetcher) { const parser = new _Parser$1.default(pathFetcher, trace); const plugins = this.plugins.concat([parser.plugin()]); const result = await (0, _postcss$1.default)(plugins).process(sourceString, { from: sourcePath }); return { injectableSource: result.css, exportTokens: parser.exportTokens }; } } // Sorts dependencies in the following way: // AAA comes before AA and A // AB comes after AA and before A // All Bs come after all As // This ensures that the files are always returned in the following order: // - In the order they were required, except // - After all their dependencies const traceKeySorter = (a, b) => { if (a.length < b.length) { return a < b.substring(0, a.length) ? -1 : 1; } if (a.length > b.length) { return a.substring(0, b.length) <= b ? -1 : 1; } return a < b ? -1 : 1; }; class FileSystemLoader { constructor(root, plugins, fileResolve) { if (root === "/" && process.platform === "win32") { const cwdDrive = process.cwd().slice(0, 3); if (!/^[A-Za-z]:\\$/.test(cwdDrive)) { throw new Error(`Failed to obtain root from "${process.cwd()}".`); } root = cwdDrive; } this.root = root; this.fileResolve = fileResolve; this.sources = {}; this.traces = {}; this.importNr = 0; this.core = new Core(plugins); this.tokensByFile = {}; this.fs = (0, _fs$1.getFileSystem)(); } async fetch(_newPath, relativeTo, _trace) { const newPath = _newPath.replace(/^["']|["']$/g, ""); const trace = _trace || String.fromCharCode(this.importNr++); const useFileResolve = typeof this.fileResolve === "function"; const fileResolvedPath = useFileResolve ? await this.fileResolve(newPath, relativeTo) : await Promise.resolve(); if (fileResolvedPath && !_path.default.isAbsolute(fileResolvedPath)) { throw new Error('The returned path from the "fileResolve" option must be absolute.'); } const relativeDir = _path.default.dirname(relativeTo); const rootRelativePath = fileResolvedPath || _path.default.resolve(relativeDir, newPath); let fileRelativePath = fileResolvedPath || _path.default.resolve(_path.default.resolve(this.root, relativeDir), newPath); // if the path is not relative or absolute, try to resolve it in node_modules if (!useFileResolve && newPath[0] !== "." && !_path.default.isAbsolute(newPath)) { try { fileRelativePath = require.resolve(newPath); } catch (e) {// noop } } const tokens = this.tokensByFile[fileRelativePath]; if (tokens) return tokens; return new Promise((resolve, reject) => { this.fs.readFile(fileRelativePath, "utf-8", async (err, source) => { if (err) reject(err); const { injectableSource, exportTokens } = await this.core.load(source, rootRelativePath, trace, this.fetch.bind(this)); this.sources[fileRelativePath] = injectableSource; this.traces[trace] = fileRelativePath; this.tokensByFile[fileRelativePath] = exportTokens; resolve(exportTokens); }); }); } get finalSource() { const traces = this.traces; const sources = this.sources; let written = new Set(); return Object.keys(traces).sort(traceKeySorter).map(key => { const filename = traces[key]; if (written.has(filename)) { return null; } written.add(filename); return sources[filename]; }).join(""); } } FileSystemLoader$1.default = FileSystemLoader; var scoping = {}; var src$3 = {exports: {}}; const PERMANENT_MARKER = 2; const TEMPORARY_MARKER = 1; function createError(node, graph) { const er = new Error("Nondeterministic import's order"); const related = graph[node]; const relatedNode = related.find( (relatedNode) => graph[relatedNode].indexOf(node) > -1 ); er.nodes = [node, relatedNode]; return er; } function walkGraph(node, graph, state, result, strict) { if (state[node] === PERMANENT_MARKER) { return; } if (state[node] === TEMPORARY_MARKER) { if (strict) { return createError(node, graph); } return; } state[node] = TEMPORARY_MARKER; const children = graph[node]; const length = children.length; for (let i = 0; i < length; ++i) { const error = walkGraph(children[i], graph, state, result, strict); if (error instanceof Error) { return error; } } state[node] = PERMANENT_MARKER; result.push(node); } function topologicalSort$1(graph, strict) { const result = []; const state = {}; const nodes = Object.keys(graph); const length = nodes.length; for (let i = 0; i < length; ++i) { const er = walkGraph(nodes[i], graph, state, result, strict); if (er instanceof Error) { return er; } } return result; } var topologicalSort_1 = topologicalSort$1; const topologicalSort = topologicalSort_1; const matchImports$1 = /^(.+?)\s+from\s+(?:"([^"]+)"|'([^']+)'|(global))$/; const icssImport = /^:import\((?:"([^"]+)"|'([^']+)')\)/; const VISITED_MARKER = 1; /** * :import('G') {} * * Rule * composes: ... from 'A' * composes: ... from 'B' * Rule * composes: ... from 'A' * composes: ... from 'A' * composes: ... from 'C' * * Results in: * * graph: { * G: [], * A: [], * B: ['A'], * C: ['A'], * } */ function addImportToGraph(importId, parentId, graph, visited) { const siblingsId = parentId + "_" + "siblings"; const visitedId = parentId + "_" + importId; if (visited[visitedId] !== VISITED_MARKER) { if (!Array.isArray(visited[siblingsId])) { visited[siblingsId] = []; } const siblings = visited[siblingsId]; if (Array.isArray(graph[importId])) { graph[importId] = graph[importId].concat(siblings); } else { graph[importId] = siblings.slice(); } visited[visitedId] = VISITED_MARKER; siblings.push(importId); } } src$3.exports = (options = {}) => { let importIndex = 0; const createImportedName = typeof options.createImportedName !== "function" ? (importName /*, path*/) => `i__imported_${importName.replace(/\W/g, "_")}_${importIndex++}` : options.createImportedName; const failOnWrongOrder = options.failOnWrongOrder; return { postcssPlugin: "postcss-modules-extract-imports", prepare() { const graph = {}; const visited = {}; const existingImports = {}; const importDecls = {}; const imports = {}; return { Once(root, postcss) { // Check the existing imports order and save refs root.walkRules((rule) => { const matches = icssImport.exec(rule.selector); if (matches) { const [, /*match*/ doubleQuotePath, singleQuotePath] = matches; const importPath = doubleQuotePath || singleQuotePath; addImportToGraph(importPath, "root", graph, visited); existingImports[importPath] = rule; } }); root.walkDecls(/^composes$/, (declaration) => { const multiple = declaration.value.split(","); const values = []; multiple.forEach((value) => { const matches = value.trim().match(matchImports$1); if (!matches) { values.push(value); return; } let tmpSymbols; let [ , /*match*/ symbols, doubleQuotePath, singleQuotePath, global, ] = matches; if (global) { // Composing globals simply means changing these classes to wrap them in global(name) tmpSymbols = symbols.split(/\s+/).map((s) => `global(${s})`); } else { const importPath = doubleQuotePath || singleQuotePath; let parent = declaration.parent; let parentIndexes = ""; while (parent.type !== "root") { parentIndexes = parent.parent.index(parent) + "_" + parentIndexes; parent = parent.parent; } const { selector } = declaration.parent; const parentRule = `_${parentIndexes}${selector}`; addImportToGraph(importPath, parentRule, graph, visited); importDecls[importPath] = declaration; imports[importPath] = imports[importPath] || {}; tmpSymbols = symbols.split(/\s+/).map((s) => { if (!imports[importPath][s]) { imports[importPath][s] = createImportedName(s, importPath); } return imports[importPath][s]; }); } values.push(tmpSymbols.join(" ")); }); declaration.value = values.join(", "); }); const importsOrder = topologicalSort(graph, failOnWrongOrder); if (importsOrder instanceof Error) { const importPath = importsOrder.nodes.find((importPath) => // eslint-disable-next-line no-prototype-builtins importDecls.hasOwnProperty(importPath) ); const decl = importDecls[importPath]; throw decl.error( "Failed to resolve order of composed modules " + importsOrder.nodes .map((importPath) => "`" + importPath + "`") .join(", ") + ".", { plugin: "postcss-modules-extract-imports", word: "composes", } ); } let lastImportRule; importsOrder.forEach((path) => { const importedSymbols = imports[path]; let rule = existingImports[path]; if (!rule && importedSymbols) { rule = postcss.rule({ selector: `:import("${path}")`, raws: { after: "\n" }, }); if (lastImportRule) { root.insertAfter(lastImportRule, rule); } else { root.prepend(rule); } } lastImportRule = rule; if (!importedSymbols) { return; } Object.keys(importedSymbols).forEach((importedSymbol) => { rule.append( postcss.decl({ value: importedSymbol, prop: importedSymbols[importedSymbol], raws: { before: "\n " }, }) ); }); }); }, }; }, }; }; src$3.exports.postcss = true; var srcExports$2 = src$3.exports; var wasmHash = {exports: {}}; /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ var hasRequiredWasmHash; function requireWasmHash () { if (hasRequiredWasmHash) return wasmHash.exports; hasRequiredWasmHash = 1; // 65536 is the size of a wasm memory page // 64 is the maximum chunk size for every possible wasm hash implementation // 4 is the maximum number of bytes per char for string encoding (max is utf-8) // ~3 makes sure that it's always a block of 4 chars, so avoid partially encoded bytes for base64 const MAX_SHORT_STRING = Math.floor((65536 - 64) / 4) & -4; class WasmHash { /** * @param {WebAssembly.Instance} instance wasm instance * @param {WebAssembly.Instance[]} instancesPool pool of instances * @param {number} chunkSize size of data chunks passed to wasm * @param {number} digestSize size of digest returned by wasm */ constructor(instance, instancesPool, chunkSize, digestSize) { const exports = /** @type {any} */ (instance.exports); exports.init(); this.exports = exports; this.mem = Buffer.from(exports.memory.buffer, 0, 65536); this.buffered = 0; this.instancesPool = instancesPool; this.chunkSize = chunkSize; this.digestSize = digestSize; } reset() { this.buffered = 0; this.exports.init(); } /** * @param {Buffer | string} data data * @param {BufferEncoding=} encoding encoding * @returns {this} itself */ update(data, encoding) { if (typeof data === "string") { while (data.length > MAX_SHORT_STRING) { this._updateWithShortString(data.slice(0, MAX_SHORT_STRING), encoding); data = data.slice(MAX_SHORT_STRING); } this._updateWithShortString(data, encoding); return this; } this._updateWithBuffer(data); return this; } /** * @param {string} data data * @param {BufferEncoding=} encoding encoding * @returns {void} */ _updateWithShortString(data, encoding) { const { exports, buffered, mem, chunkSize } = this; let endPos; if (data.length < 70) { if (!encoding || encoding === "utf-8" || encoding === "utf8") { endPos = buffered; for (let i = 0; i < data.length; i++) { const cc = data.charCodeAt(i); if (cc < 0x80) { mem[endPos++] = cc; } else if (cc < 0x800) { mem[endPos] = (cc >> 6) | 0xc0; mem[endPos + 1] = (cc & 0x3f) | 0x80; endPos += 2; } else { // bail-out for weird chars endPos += mem.write(data.slice(i), endPos, encoding); break; } } } else if (encoding === "latin1") { endPos = buffered; for (let i = 0; i < data.length; i++) { const cc = data.charCodeAt(i); mem[endPos++] = cc; } } else { endPos = buffered + mem.write(data, buffered, encoding); } } else { endPos = buffered + mem.write(data, buffered, encoding); } if (endPos < chunkSize) { this.buffered = endPos; } else { const l = endPos & ~(this.chunkSize - 1); exports.update(l); const newBuffered = endPos - l; this.buffered = newBuffered; if (newBuffered > 0) { mem.copyWithin(0, l, endPos); } } } /** * @param {Buffer} data data * @returns {void} */ _updateWithBuffer(data) { const { exports, buffered, mem } = this; const length = data.length; if (buffered + length < this.chunkSize) { data.copy(mem, buffered, 0, length); this.buffered += length; } else { const l = (buffered + length) & ~(this.chunkSize - 1); if (l > 65536) { let i = 65536 - buffered; data.copy(mem, buffered, 0, i); exports.update(65536); const stop = l - buffered - 65536; while (i < stop) { data.copy(mem, 0, i, i + 65536); exports.update(65536); i += 65536; } data.copy(mem, 0, i, l - buffered); exports.update(l - buffered - i); } else { data.copy(mem, buffered, 0, l - buffered); exports.update(l); } const newBuffered = length + buffered - l; this.buffered = newBuffered; if (newBuffered > 0) { data.copy(mem, 0, length - newBuffered, length); } } } digest(type) { const { exports, buffered, mem, digestSize } = this; exports.final(buffered); this.instancesPool.push(this); const hex = mem.toString("latin1", 0, digestSize); if (type === "hex") { return hex; } if (type === "binary" || !type) { return Buffer.from(hex, "hex"); } return Buffer.from(hex, "hex").toString(type); } } const create = (wasmModule, instancesPool, chunkSize, digestSize) => { if (instancesPool.length > 0) { const old = instancesPool.pop(); old.reset(); return old; } else { return new WasmHash( new WebAssembly.Instance(wasmModule), instancesPool, chunkSize, digestSize ); } }; wasmHash.exports = create; wasmHash.exports.MAX_SHORT_STRING = MAX_SHORT_STRING; return wasmHash.exports; } /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ var xxhash64_1; var hasRequiredXxhash64; function requireXxhash64 () { if (hasRequiredXxhash64) return xxhash64_1; hasRequiredXxhash64 = 1; const create = requireWasmHash(); //#region wasm code: xxhash64 (../../../assembly/hash/xxhash64.asm.ts) --initialMemory 1 const xxhash64 = new WebAssembly.Module( Buffer.from( // 1173 bytes "AGFzbQEAAAABCAJgAX8AYAAAAwQDAQAABQMBAAEGGgV+AUIAC34BQgALfgFCAAt+AUIAC34BQgALByIEBGluaXQAAAZ1cGRhdGUAAQVmaW5hbAACBm1lbW9yeQIACrUIAzAAQtbrgu7q/Yn14AAkAELP1tO+0ser2UIkAUIAJAJC+erQ0OfJoeThACQDQgAkBAvUAQIBfwR+IABFBEAPCyMEIACtfCQEIwAhAiMBIQMjAiEEIwMhBQNAIAIgASkDAELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiECIAMgASkDCELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEDIAQgASkDEELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEEIAUgASkDGELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEFIAAgAUEgaiIBSw0ACyACJAAgAyQBIAQkAiAFJAMLqwYCAX8EfiMEQgBSBH4jACICQgGJIwEiA0IHiXwjAiIEQgyJfCMDIgVCEol8IAJCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0gA0LP1tO+0ser2UJ+Qh+JQoeVr6+Ytt6bnn9+hUKHla+vmLbem55/fkKdo7Xqg7GNivoAfSAEQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IAVCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0FQsXP2bLx5brqJwsjBCAArXx8IQIDQCABQQhqIABNBEAgAiABKQMAQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQhuJQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IQIgAUEIaiEBDAELCyABQQRqIABNBEACfyACIAE1AgBCh5Wvr5i23puef36FQheJQs/W077Sx6vZQn5C+fPd8Zn2masWfCECIAFBBGoLIQELA0AgACABRwRAIAIgATEAAELFz9my8eW66id+hUILiUKHla+vmLbem55/fiECIAFBAWohAQwBCwtBACACIAJCIYiFQs/W077Sx6vZQn4iAiACQh2IhUL5893xmfaZqxZ+IgIgAkIgiIUiAkIgiCIDQv//A4NCIIYgA0KAgPz/D4NCEIiEIgNC/4GAgPAfg0IQhiADQoD+g4CA4D+DQgiIhCIDQo+AvIDwgcAHg0IIhiADQvCBwIeAnoD4AINCBIiEIgNChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IANCsODAgYOGjJgwhHw3AwBBCCACQv////8PgyICQv//A4NCIIYgAkKAgPz/D4NCEIiEIgJC/4GAgPAfg0IQhiACQoD+g4CA4D+DQgiIhCICQo+AvIDwgcAHg0IIhiACQvCBwIeAnoD4AINCBIiEIgJChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IAJCsODAgYOGjJgwhHw3AwAL", "base64" ) ); //#endregion xxhash64_1 = create.bind(null, xxhash64, [], 32, 16); return xxhash64_1; } var BatchedHash_1; var hasRequiredBatchedHash; function requireBatchedHash () { if (hasRequiredBatchedHash) return BatchedHash_1; hasRequiredBatchedHash = 1; const MAX_SHORT_STRING = requireWasmHash().MAX_SHORT_STRING; class BatchedHash { constructor(hash) { this.string = undefined; this.encoding = undefined; this.hash = hash; } /** * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} * @param {string|Buffer} data data * @param {string=} inputEncoding data encoding * @returns {this} updated hash */ update(data, inputEncoding) { if (this.string !== undefined) { if ( typeof data === "string" && inputEncoding === this.encoding && this.string.length + data.length < MAX_SHORT_STRING ) { this.string += data; return this; } this.hash.update(this.string, this.encoding); this.string = undefined; } if (typeof data === "string") { if ( data.length < MAX_SHORT_STRING && // base64 encoding is not valid since it may contain padding chars (!inputEncoding || !inputEncoding.startsWith("ba")) ) { this.string = data; this.encoding = inputEncoding; } else { this.hash.update(data, inputEncoding); } } else { this.hash.update(data); } return this; } /** * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} * @param {string=} encoding encoding of the return value * @returns {string|Buffer} digest */ digest(encoding) { if (this.string !== undefined) { this.hash.update(this.string, this.encoding); } return this.hash.digest(encoding); } } BatchedHash_1 = BatchedHash; return BatchedHash_1; } /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ var md4_1; var hasRequiredMd4; function requireMd4 () { if (hasRequiredMd4) return md4_1; hasRequiredMd4 = 1; const create = requireWasmHash(); //#region wasm code: md4 (../../../assembly/hash/md4.asm.ts) --initialMemory 1 const md4 = new WebAssembly.Module( Buffer.from( // 2150 bytes "AGFzbQ