Changeset 0c6b92a for imaps-frontend/node_modules/vite
- Timestamp:
- 12/12/24 17:06:06 (5 weeks ago)
- Branches:
- main
- Parents:
- d565449
- Location:
- imaps-frontend/node_modules/vite
- Files:
-
- 12 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/vite/LICENSE.md
rd565449 r0c6b92a 4 4 MIT License 5 5 6 Copyright (c) 2019-present, Yuxi (Evan) Youand Vite contributors6 Copyright (c) 2019-present, VoidZero Inc. and Vite contributors 7 7 8 8 Permission is hereby granted, free of charge, to any person obtaining a copy -
imaps-frontend/node_modules/vite/README.md
rd565449 r0c6b92a 12 12 Vite (French word for "fast", pronounced `/vit/`) is a new breed of frontend build tool that significantly improves the frontend development experience. It consists of two major parts: 13 13 14 - A dev server that serves your source files over [native ES modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules), with [rich built-in features](https://vite js.dev/guide/features.html) and astonishingly fast [Hot Module Replacement (HMR)](https://vitejs.dev/guide/features.html#hot-module-replacement).14 - A dev server that serves your source files over [native ES modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules), with [rich built-in features](https://vite.dev/guide/features.html) and astonishingly fast [Hot Module Replacement (HMR)](https://vite.dev/guide/features.html#hot-module-replacement). 15 15 16 - A [build command](https://vite js.dev/guide/build.html) that bundles your code with [Rollup](https://rollupjs.org), pre-configured to output highly optimized static assets for production.16 - A [build command](https://vite.dev/guide/build.html) that bundles your code with [Rollup](https://rollupjs.org), pre-configured to output highly optimized static assets for production. 17 17 18 In addition, Vite is highly extensible via its [Plugin API](https://vite js.dev/guide/api-plugin.html) and [JavaScript API](https://vitejs.dev/guide/api-javascript.html) with full typing support.18 In addition, Vite is highly extensible via its [Plugin API](https://vite.dev/guide/api-plugin.html) and [JavaScript API](https://vite.dev/guide/api-javascript.html) with full typing support. 19 19 20 [Read the Docs to Learn More](https://vite js.dev).20 [Read the Docs to Learn More](https://vite.dev). -
imaps-frontend/node_modules/vite/client.d.ts
rd565449 r0c6b92a 247 247 export default src 248 248 } 249 250 declare interface VitePreloadErrorEvent extends Event { 251 payload: Error 252 } 253 254 declare interface WindowEventMap { 255 'vite:preloadError': VitePreloadErrorEvent 256 } -
imaps-frontend/node_modules/vite/dist/client/client.mjs
rd565449 r0c6b92a 514 514 (browser) ${currentScriptHost} <--[HTTP]--> ${serverHost} (server) 515 515 (browser) ${socketHost} <--[WebSocket (failing)]--> ${directSocketHost} (server) 516 Check out your Vite / network configuration and https://vite js.dev/config/server-options.html#server-hmr .`516 Check out your Vite / network configuration and https://vite.dev/config/server-options.html#server-hmr .` 517 517 ); 518 518 }); … … 521 521 () => { 522 522 console.info( 523 "[vite] Direct websocket connection fallback. Check out https://vite js.dev/config/server-options.html#server-hmr to remove the previous connection error."523 "[vite] Direct websocket connection fallback. Check out https://vite.dev/config/server-options.html#server-hmr to remove the previous connection error." 524 524 ); 525 525 }, … … 562 562 } 563 563 function cleanUrl(pathname) { 564 const url = new URL(pathname, "http://vite js.dev");564 const url = new URL(pathname, "http://vite.dev"); 565 565 url.searchParams.delete("direct"); 566 566 return url.pathname + url.search; … … 819 819 } 820 820 const pathname = url.replace(/[?#].*$/, ""); 821 const { search, hash } = new URL(url, "http://vite js.dev");821 const { search, hash } = new URL(url, "http://vite.dev"); 822 822 return `${pathname}?${queryToInject}${search ? `&` + search.slice(1) : ""}${hash || ""}`; 823 823 } -
imaps-frontend/node_modules/vite/dist/node-cjs/publicUtils.cjs
rd565449 r0c6b92a 39 39 charToInt[c] = i; 40 40 } 41 function encodeInteger(builder, num, relative) { 42 let delta = num - relative; 43 delta = delta < 0 ? (-delta << 1) | 1 : delta << 1; 44 do { 45 let clamped = delta & 0b011111; 46 delta >>>= 5; 47 if (delta > 0) 48 clamped |= 0b100000; 49 builder.write(intToChar[clamped]); 50 } while (delta > 0); 51 return num; 52 } 53 54 const bufLength = 1024 * 16; 41 55 // Provide a fallback for older environments. 42 56 const td = typeof TextDecoder !== 'undefined' … … 58 72 }, 59 73 }; 74 class StringWriter { 75 constructor() { 76 this.pos = 0; 77 this.out = ''; 78 this.buffer = new Uint8Array(bufLength); 79 } 80 write(v) { 81 const { buffer } = this; 82 buffer[this.pos++] = v; 83 if (this.pos === bufLength) { 84 this.out += td.decode(buffer); 85 this.pos = 0; 86 } 87 } 88 flush() { 89 const { buffer, out, pos } = this; 90 return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out; 91 } 92 } 60 93 function encode(decoded) { 61 const state = new Int32Array(5); 62 const bufLength = 1024 * 16; 63 const subLength = bufLength - 36; 64 const buf = new Uint8Array(bufLength); 65 const sub = buf.subarray(0, subLength); 66 let pos = 0; 67 let out = ''; 94 const writer = new StringWriter(); 95 let sourcesIndex = 0; 96 let sourceLine = 0; 97 let sourceColumn = 0; 98 let namesIndex = 0; 68 99 for (let i = 0; i < decoded.length; i++) { 69 100 const line = decoded[i]; 70 if (i > 0) { 71 if (pos === bufLength) { 72 out += td.decode(buf); 73 pos = 0; 74 } 75 buf[pos++] = semicolon; 76 } 101 if (i > 0) 102 writer.write(semicolon); 77 103 if (line.length === 0) 78 104 continue; 79 state[0]= 0;105 let genColumn = 0; 80 106 for (let j = 0; j < line.length; j++) { 81 107 const segment = line[j]; 82 // We can push up to 5 ints, each int can take at most 7 chars, and we83 // may push a comma.84 if (pos > subLength) {85 out += td.decode(sub);86 buf.copyWithin(0, subLength, pos);87 pos -= subLength;88 }89 108 if (j > 0) 90 buf[pos++] = comma;91 pos = encodeInteger(buf, pos, state, segment, 0); // genColumn109 writer.write(comma); 110 genColumn = encodeInteger(writer, segment[0], genColumn); 92 111 if (segment.length === 1) 93 112 continue; 94 pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex95 pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine96 pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn113 sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex); 114 sourceLine = encodeInteger(writer, segment[2], sourceLine); 115 sourceColumn = encodeInteger(writer, segment[3], sourceColumn); 97 116 if (segment.length === 4) 98 117 continue; 99 pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex118 namesIndex = encodeInteger(writer, segment[4], namesIndex); 100 119 } 101 120 } 102 return out + td.decode(buf.subarray(0, pos)); 103 } 104 function encodeInteger(buf, pos, state, segment, j) { 105 const next = segment[j]; 106 let num = next - state[j]; 107 state[j] = next; 108 num = num < 0 ? (-num << 1) | 1 : num << 1; 109 do { 110 let clamped = num & 0b011111; 111 num >>>= 5; 112 if (num > 0) 113 clamped |= 0b100000; 114 buf[pos++] = intToChar[clamped]; 115 } while (num > 0); 116 return pos; 121 return writer.flush(); 117 122 } 118 123 … … 786 791 } 787 792 793 let m; 794 788 795 // Is webkit? http://stackoverflow.com/a/16459606/376773 789 796 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 … … 793 800 // Is firefox >= v31? 794 801 // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages 795 (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||802 (typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) || 796 803 // Double check webkit in userAgent just in case we are in a worker 797 804 (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); … … 3506 3513 ]; 3507 3514 continue; 3515 } else if (key === "server" && rootPath === "server.hmr") { 3516 merged[key] = value; 3517 continue; 3508 3518 } 3509 3519 if (Array.isArray(existing) || Array.isArray(value)) { … … 4794 4804 if (typeof content !== 'string') throw new TypeError('replacement content must be a string'); 4795 4805 4796 while (start < 0) start += this.original.length; 4797 while (end < 0) end += this.original.length; 4806 if (this.original.length !== 0) { 4807 while (start < 0) start += this.original.length; 4808 while (end < 0) end += this.original.length; 4809 } 4798 4810 4799 4811 if (end > this.original.length) throw new Error('end is out of bounds'); … … 4891 4903 4892 4904 remove(start, end) { 4893 while (start < 0) start += this.original.length; 4894 while (end < 0) end += this.original.length; 4905 if (this.original.length !== 0) { 4906 while (start < 0) start += this.original.length; 4907 while (end < 0) end += this.original.length; 4908 } 4895 4909 4896 4910 if (start === end) return this; … … 4915 4929 4916 4930 reset(start, end) { 4917 while (start < 0) start += this.original.length; 4918 while (end < 0) end += this.original.length; 4931 if (this.original.length !== 0) { 4932 while (start < 0) start += this.original.length; 4933 while (end < 0) end += this.original.length; 4934 } 4919 4935 4920 4936 if (start === end) return this; … … 4978 4994 4979 4995 slice(start = 0, end = this.original.length) { 4980 while (start < 0) start += this.original.length; 4981 while (end < 0) end += this.original.length; 4996 if (this.original.length !== 0) { 4997 while (start < 0) start += this.original.length; 4998 while (end < 0) end += this.original.length; 4999 } 4982 5000 4983 5001 let result = ''; -
imaps-frontend/node_modules/vite/dist/node/chunks/dep-Ba1kN6Mp.js
rd565449 r0c6b92a 1 import { C as commonjsGlobal, B as getDefaultExportFromCjs } from './dep- mCdpKltl.js';1 import { C as commonjsGlobal, B as getDefaultExportFromCjs } from './dep-CB_7IfJ-.js'; 2 2 import require$$0__default from 'fs'; 3 3 import require$$0 from 'postcss'; … … 1328 1328 1329 1329 root.walkDecls(/^composes$/, (declaration) => { 1330 const matches = declaration.value.match(matchImports$1); 1331 1332 if (!matches) { 1333 return; 1334 } 1335 1336 let tmpSymbols; 1337 let [ 1338 , 1339 /*match*/ symbols, 1340 doubleQuotePath, 1341 singleQuotePath, 1342 global, 1343 ] = matches; 1344 1345 if (global) { 1346 // Composing globals simply means changing these classes to wrap them in global(name) 1347 tmpSymbols = symbols.split(/\s+/).map((s) => `global(${s})`); 1348 } else { 1349 const importPath = doubleQuotePath || singleQuotePath; 1350 1351 let parent = declaration.parent; 1352 let parentIndexes = ""; 1353 1354 while (parent.type !== "root") { 1355 parentIndexes = 1356 parent.parent.index(parent) + "_" + parentIndexes; 1357 parent = parent.parent; 1330 const multiple = declaration.value.split(","); 1331 const values = []; 1332 1333 multiple.forEach((value) => { 1334 const matches = value.trim().match(matchImports$1); 1335 1336 if (!matches) { 1337 values.push(value); 1338 1339 return; 1358 1340 } 1359 1341 1360 const { selector } = declaration.parent; 1361 const parentRule = `_${parentIndexes}${selector}`; 1362 1363 addImportToGraph(importPath, parentRule, graph, visited); 1364 1365 importDecls[importPath] = declaration; 1366 imports[importPath] = imports[importPath] || {}; 1367 1368 tmpSymbols = symbols.split(/\s+/).map((s) => { 1369 if (!imports[importPath][s]) { 1370 imports[importPath][s] = createImportedName(s, importPath); 1342 let tmpSymbols; 1343 let [ 1344 , 1345 /*match*/ symbols, 1346 doubleQuotePath, 1347 singleQuotePath, 1348 global, 1349 ] = matches; 1350 1351 if (global) { 1352 // Composing globals simply means changing these classes to wrap them in global(name) 1353 tmpSymbols = symbols.split(/\s+/).map((s) => `global(${s})`); 1354 } else { 1355 const importPath = doubleQuotePath || singleQuotePath; 1356 1357 let parent = declaration.parent; 1358 let parentIndexes = ""; 1359 1360 while (parent.type !== "root") { 1361 parentIndexes = 1362 parent.parent.index(parent) + "_" + parentIndexes; 1363 parent = parent.parent; 1371 1364 } 1372 1365 1373 return imports[importPath][s]; 1374 }); 1375 } 1376 1377 declaration.value = tmpSymbols.join(" "); 1366 const { selector } = declaration.parent; 1367 const parentRule = `_${parentIndexes}${selector}`; 1368 1369 addImportToGraph(importPath, parentRule, graph, visited); 1370 1371 importDecls[importPath] = declaration; 1372 imports[importPath] = imports[importPath] || {}; 1373 1374 tmpSymbols = symbols.split(/\s+/).map((s) => { 1375 if (!imports[importPath][s]) { 1376 imports[importPath][s] = createImportedName(s, importPath); 1377 } 1378 1379 return imports[importPath][s]; 1380 }); 1381 } 1382 1383 values.push(tmpSymbols.join(" ")); 1384 }); 1385 1386 declaration.value = values.join(", "); 1378 1387 }); 1379 1388 … … 2220 2229 exports.__esModule = true; 2221 2230 exports["default"] = unesc; 2222 2223 2231 // Many thanks for this post which made this migration much easier. 2224 2232 // https://mathiasbynens.be/notes/css-escapes … … 2233 2241 var hex = ''; 2234 2242 var spaceTerminated = false; 2235 2236 2243 for (var i = 0; i < 6 && lower[i] !== undefined; i++) { 2237 var code = lower.charCodeAt(i); // check to see if we are dealing with a valid hex char [a-f|0-9]2238 2239 var valid = code >= 97 && code <= 102 || code >= 48 && code <= 57; // https://drafts.csswg.org/css-syntax/#consume-escaped-code-point2240 2244 var code = lower.charCodeAt(i); 2245 // check to see if we are dealing with a valid hex char [a-f|0-9] 2246 var valid = code >= 97 && code <= 102 || code >= 48 && code <= 57; 2247 // https://drafts.csswg.org/css-syntax/#consume-escaped-code-point 2241 2248 spaceTerminated = code === 32; 2242 2243 2249 if (!valid) { 2244 2250 break; 2245 2251 } 2246 2247 2252 hex += lower[i]; 2248 2253 } 2249 2250 2254 if (hex.length === 0) { 2251 2255 return undefined; 2252 2256 } 2253 2254 2257 var codePoint = parseInt(hex, 16); 2255 var isSurrogate = codePoint >= 0xD800 && codePoint <= 0xDFFF; // Add special case for 2258 var isSurrogate = codePoint >= 0xD800 && codePoint <= 0xDFFF; 2259 // Add special case for 2256 2260 // "If this number is zero, or is for a surrogate, or is greater than the maximum allowed code point" 2257 2261 // https://drafts.csswg.org/css-syntax/#maximum-allowed-code-point 2258 2259 2262 if (isSurrogate || codePoint === 0x0000 || codePoint > 0x10FFFF) { 2260 2263 return ["\uFFFD", hex.length + (spaceTerminated ? 1 : 0)]; 2261 2264 } 2262 2263 2265 return [String.fromCodePoint(codePoint), hex.length + (spaceTerminated ? 1 : 0)]; 2264 2266 } 2265 2266 2267 var CONTAINS_ESCAPE = /\\/; 2267 2268 2268 function unesc(str) { 2269 2269 var needToProcess = CONTAINS_ESCAPE.test(str); 2270 2271 2270 if (!needToProcess) { 2272 2271 return str; 2273 2272 } 2274 2275 2273 var ret = ""; 2276 2277 2274 for (var i = 0; i < str.length; i++) { 2278 2275 if (str[i] === "\\") { 2279 2276 var gobbled = gobbleHex(str.slice(i + 1, i + 7)); 2280 2281 2277 if (gobbled !== undefined) { 2282 2278 ret += gobbled[0]; 2283 2279 i += gobbled[1]; 2284 2280 continue; 2285 } // Retain a pair of \\ if double escaped `\\\\` 2281 } 2282 2283 // Retain a pair of \\ if double escaped `\\\\` 2286 2284 // https://github.com/postcss/postcss-selector-parser/commit/268c9a7656fb53f543dc620aa5b73a30ec3ff20e 2287 2288 2289 2285 if (str[i + 1] === "\\") { 2290 2286 ret += "\\"; 2291 2287 i++; 2292 2288 continue; 2293 } // if \\ is at the end of the string retain it 2289 } 2290 2291 // if \\ is at the end of the string retain it 2294 2292 // https://github.com/postcss/postcss-selector-parser/commit/01a6b346e3612ce1ab20219acc26abdc259ccefb 2295 2296 2297 2293 if (str.length === i + 1) { 2298 2294 ret += str[i]; 2299 2295 } 2300 2301 2296 continue; 2302 2297 } 2303 2304 2298 ret += str[i]; 2305 2299 } 2306 2307 2300 return ret; 2308 2301 } 2309 2310 2302 module.exports = exports.default; 2311 2303 } (unesc, unesc.exports)); … … 2319 2311 exports.__esModule = true; 2320 2312 exports["default"] = getProp; 2321 2322 2313 function getProp(obj) { 2323 2314 for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 2324 2315 props[_key - 1] = arguments[_key]; 2325 2316 } 2326 2327 2317 while (props.length > 0) { 2328 2318 var prop = props.shift(); 2329 2330 2319 if (!obj[prop]) { 2331 2320 return undefined; 2332 2321 } 2333 2334 2322 obj = obj[prop]; 2335 2323 } 2336 2337 2324 return obj; 2338 2325 } 2339 2340 2326 module.exports = exports.default; 2341 2327 } (getProp, getProp.exports)); … … 2349 2335 exports.__esModule = true; 2350 2336 exports["default"] = ensureObject; 2351 2352 2337 function ensureObject(obj) { 2353 2338 for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 2354 2339 props[_key - 1] = arguments[_key]; 2355 2340 } 2356 2357 2341 while (props.length > 0) { 2358 2342 var prop = props.shift(); 2359 2360 2343 if (!obj[prop]) { 2361 2344 obj[prop] = {}; 2362 2345 } 2363 2364 2346 obj = obj[prop]; 2365 2347 } 2366 2348 } 2367 2368 2349 module.exports = exports.default; 2369 2350 } (ensureObject, ensureObject.exports)); … … 2377 2358 exports.__esModule = true; 2378 2359 exports["default"] = stripComments; 2379 2380 2360 function stripComments(str) { 2381 2361 var s = ""; 2382 2362 var commentStart = str.indexOf("/*"); 2383 2363 var lastEnd = 0; 2384 2385 2364 while (commentStart >= 0) { 2386 2365 s = s + str.slice(lastEnd, commentStart); 2387 2366 var commentEnd = str.indexOf("*/", commentStart + 2); 2388 2389 2367 if (commentEnd < 0) { 2390 2368 return s; 2391 2369 } 2392 2393 2370 lastEnd = commentEnd + 2; 2394 2371 commentStart = str.indexOf("/*", lastEnd); 2395 2372 } 2396 2397 2373 s = s + str.slice(lastEnd); 2398 2374 return s; 2399 2375 } 2400 2401 2376 module.exports = exports.default; 2402 2377 } (stripComments, stripComments.exports)); … … 2405 2380 2406 2381 util.__esModule = true; 2407 util.stripComments = util.ensureObject = util.getProp = util.unesc = void 0; 2408 2382 util.unesc = util.stripComments = util.getProp = util.ensureObject = void 0; 2409 2383 var _unesc = _interopRequireDefault$3(unescExports); 2410 2411 2384 util.unesc = _unesc["default"]; 2412 2413 2385 var _getProp = _interopRequireDefault$3(getPropExports); 2414 2415 2386 util.getProp = _getProp["default"]; 2416 2417 2387 var _ensureObject = _interopRequireDefault$3(ensureObjectExports); 2418 2419 2388 util.ensureObject = _ensureObject["default"]; 2420 2421 2389 var _stripComments = _interopRequireDefault$3(stripCommentsExports); 2422 2423 2390 util.stripComments = _stripComments["default"]; 2424 2425 2391 function _interopRequireDefault$3(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } 2426 2392 … … 2429 2395 exports.__esModule = true; 2430 2396 exports["default"] = void 0; 2431 2432 2397 var _util = util; 2433 2434 2398 function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 2435 2436 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); return Constructor; } 2437 2399 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 2438 2400 var cloneNode = function cloneNode(obj, parent) { 2439 2401 if (typeof obj !== 'object' || obj === null) { 2440 2402 return obj; 2441 2403 } 2442 2443 2404 var cloned = new obj.constructor(); 2444 2445 2405 for (var i in obj) { 2446 2406 if (!obj.hasOwnProperty(i)) { 2447 2407 continue; 2448 2408 } 2449 2450 2409 var value = obj[i]; 2451 2410 var type = typeof value; 2452 2453 2411 if (i === 'parent' && type === 'object') { 2454 2412 if (parent) { … … 2463 2421 } 2464 2422 } 2465 2466 2423 return cloned; 2467 2424 }; 2468 2469 2425 var Node = /*#__PURE__*/function () { 2470 2426 function Node(opts) { … … 2472 2428 opts = {}; 2473 2429 } 2474 2475 2430 Object.assign(this, opts); 2476 2431 this.spaces = this.spaces || {}; … … 2478 2433 this.spaces.after = this.spaces.after || ''; 2479 2434 } 2480 2481 2435 var _proto = Node.prototype; 2482 2483 2436 _proto.remove = function remove() { 2484 2437 if (this.parent) { 2485 2438 this.parent.removeChild(this); 2486 2439 } 2487 2488 2440 this.parent = undefined; 2489 2441 return this; 2490 2442 }; 2491 2492 2443 _proto.replaceWith = function replaceWith() { 2493 2444 if (this.parent) { … … 2495 2446 this.parent.insertBefore(this, arguments[index]); 2496 2447 } 2497 2498 2448 this.remove(); 2499 2449 } 2500 2501 2450 return this; 2502 2451 }; 2503 2504 2452 _proto.next = function next() { 2505 2453 return this.parent.at(this.parent.index(this) + 1); 2506 2454 }; 2507 2508 2455 _proto.prev = function prev() { 2509 2456 return this.parent.at(this.parent.index(this) - 1); 2510 2457 }; 2511 2512 2458 _proto.clone = function clone(overrides) { 2513 2459 if (overrides === void 0) { 2514 2460 overrides = {}; 2515 2461 } 2516 2517 2462 var cloned = cloneNode(this); 2518 2519 2463 for (var name in overrides) { 2520 2464 cloned[name] = overrides[name]; 2521 2465 } 2522 2523 2466 return cloned; 2524 2467 } 2468 2525 2469 /** 2526 2470 * Some non-standard syntax doesn't follow normal escaping rules for css. … … 2531 2475 * @param {any} value the unescaped value of the property 2532 2476 * @param {string} valueEscaped optional. the escaped value of the property. 2533 */ 2534 ; 2535 2477 */; 2536 2478 _proto.appendToPropertyAndEscape = function appendToPropertyAndEscape(name, value, valueEscaped) { 2537 2479 if (!this.raws) { 2538 2480 this.raws = {}; 2539 2481 } 2540 2541 2482 var originalValue = this[name]; 2542 2483 var originalEscaped = this.raws[name]; 2543 2484 this[name] = originalValue + value; // this may trigger a setter that updates raws, so it has to be set first. 2544 2545 2485 if (originalEscaped || valueEscaped !== value) { 2546 2486 this.raws[name] = (originalEscaped || originalValue) + valueEscaped; … … 2549 2489 } 2550 2490 } 2491 2551 2492 /** 2552 2493 * Some non-standard syntax doesn't follow normal escaping rules for css. … … 2556 2497 * @param {any} value the unescaped value of the property 2557 2498 * @param {string} valueEscaped the escaped value of the property. 2558 */ 2559 ; 2560 2499 */; 2561 2500 _proto.setPropertyAndEscape = function setPropertyAndEscape(name, value, valueEscaped) { 2562 2501 if (!this.raws) { 2563 2502 this.raws = {}; 2564 2503 } 2565 2566 2504 this[name] = value; // this may trigger a setter that updates raws, so it has to be set first. 2567 2568 2505 this.raws[name] = valueEscaped; 2569 2506 } 2507 2570 2508 /** 2571 2509 * When you want a value to passed through to CSS directly. This method … … 2574 2512 * @param {string} name the property to set. 2575 2513 * @param {any} value The value that is both escaped and unescaped. 2576 */ 2577 ; 2578 2514 */; 2579 2515 _proto.setPropertyWithoutEscape = function setPropertyWithoutEscape(name, value) { 2580 2516 this[name] = value; // this may trigger a setter that updates raws, so it has to be set first. 2581 2582 2517 if (this.raws) { 2583 2518 delete this.raws[name]; 2584 2519 } 2585 2520 } 2521 2586 2522 /** 2587 2523 * 2588 2524 * @param {number} line The number (starting with 1) 2589 2525 * @param {number} column The column number (starting with 1) 2590 */ 2591 ; 2592 2526 */; 2593 2527 _proto.isAtPosition = function isAtPosition(line, column) { 2594 2528 if (this.source && this.source.start && this.source.end) { … … 2596 2530 return false; 2597 2531 } 2598 2599 2532 if (this.source.end.line < line) { 2600 2533 return false; 2601 2534 } 2602 2603 2535 if (this.source.start.line === line && this.source.start.column > column) { 2604 2536 return false; 2605 2537 } 2606 2607 2538 if (this.source.end.line === line && this.source.end.column < column) { 2608 2539 return false; 2609 2540 } 2610 2611 2541 return true; 2612 2542 } 2613 2614 2543 return undefined; 2615 2544 }; 2616 2617 2545 _proto.stringifyProperty = function stringifyProperty(name) { 2618 2546 return this.raws && this.raws[name] || this[name]; 2619 2547 }; 2620 2621 2548 _proto.valueToString = function valueToString() { 2622 2549 return String(this.stringifyProperty("value")); 2623 2550 }; 2624 2625 2551 _proto.toString = function toString() { 2626 2552 return [this.rawSpaceBefore, this.valueToString(), this.rawSpaceAfter].join(''); 2627 2553 }; 2628 2629 2554 _createClass(Node, [{ 2630 2555 key: "rawSpaceBefore", 2631 2556 get: function get() { 2632 2557 var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.before; 2633 2634 2558 if (rawSpace === undefined) { 2635 2559 rawSpace = this.spaces && this.spaces.before; 2636 2560 } 2637 2638 2561 return rawSpace || ""; 2639 2562 }, … … 2646 2569 get: function get() { 2647 2570 var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.after; 2648 2649 2571 if (rawSpace === undefined) { 2650 2572 rawSpace = this.spaces.after; 2651 2573 } 2652 2653 2574 return rawSpace || ""; 2654 2575 }, … … 2658 2579 } 2659 2580 }]); 2660 2661 2581 return Node; 2662 2582 }(); 2663 2664 2583 exports["default"] = Node; 2665 2584 module.exports = exports.default; … … 2671 2590 2672 2591 types.__esModule = true; 2673 types.UNIVERSAL = types. ATTRIBUTE = types.CLASS = types.COMBINATOR = types.COMMENT = types.ID = types.NESTING = types.PSEUDO = types.ROOT = types.SELECTOR = types.STRING = types.TAG= void 0;2592 types.UNIVERSAL = types.TAG = types.STRING = types.SELECTOR = types.ROOT = types.PSEUDO = types.NESTING = types.ID = types.COMMENT = types.COMBINATOR = types.CLASS = types.ATTRIBUTE = void 0; 2674 2593 var TAG = 'tag'; 2675 2594 types.TAG = TAG; … … 2701 2620 exports.__esModule = true; 2702 2621 exports["default"] = void 0; 2703 2704 2622 var _node = _interopRequireDefault(nodeExports); 2705 2706 2623 var types$1 = _interopRequireWildcard(types); 2707 2708 function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } 2709 2710 function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } 2711 2624 function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } 2625 function _interopRequireWildcard(obj, nodeInterop) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } 2712 2626 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } 2713 2714 function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike ) { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } it = o[Symbol.iterator](); return it.next.bind(it); } 2715 2627 function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike) { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 2716 2628 function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 2717 2718 2629 function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 2719 2720 2630 function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 2721 2722 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); return Constructor; } 2723 2631 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 2724 2632 function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } 2725 2726 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 2727 2633 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 2728 2634 var Container = /*#__PURE__*/function (_Node) { 2729 2635 _inheritsLoose(Container, _Node); 2730 2731 2636 function Container(opts) { 2732 2637 var _this; 2733 2734 2638 _this = _Node.call(this, opts) || this; 2735 2736 2639 if (!_this.nodes) { 2737 2640 _this.nodes = []; 2738 2641 } 2739 2740 2642 return _this; 2741 2643 } 2742 2743 2644 var _proto = Container.prototype; 2744 2745 2645 _proto.append = function append(selector) { 2746 2646 selector.parent = this; … … 2748 2648 return this; 2749 2649 }; 2750 2751 2650 _proto.prepend = function prepend(selector) { 2752 2651 selector.parent = this; … … 2754 2653 return this; 2755 2654 }; 2756 2757 2655 _proto.at = function at(index) { 2758 2656 return this.nodes[index]; 2759 2657 }; 2760 2761 2658 _proto.index = function index(child) { 2762 2659 if (typeof child === 'number') { 2763 2660 return child; 2764 2661 } 2765 2766 2662 return this.nodes.indexOf(child); 2767 2663 }; 2768 2769 2664 _proto.removeChild = function removeChild(child) { 2770 2665 child = this.index(child); … … 2772 2667 this.nodes.splice(child, 1); 2773 2668 var index; 2774 2775 2669 for (var id in this.indexes) { 2776 2670 index = this.indexes[id]; 2777 2778 2671 if (index >= child) { 2779 2672 this.indexes[id] = index - 1; 2780 2673 } 2781 2674 } 2782 2783 2675 return this; 2784 2676 }; 2785 2786 2677 _proto.removeAll = function removeAll() { 2787 2678 for (var _iterator = _createForOfIteratorHelperLoose(this.nodes), _step; !(_step = _iterator()).done;) { … … 2789 2680 node.parent = undefined; 2790 2681 } 2791 2792 2682 this.nodes = []; 2793 2683 return this; 2794 2684 }; 2795 2796 2685 _proto.empty = function empty() { 2797 2686 return this.removeAll(); 2798 2687 }; 2799 2800 2688 _proto.insertAfter = function insertAfter(oldNode, newNode) { 2801 2689 newNode.parent = this; … … 2804 2692 newNode.parent = this; 2805 2693 var index; 2806 2807 2694 for (var id in this.indexes) { 2808 2695 index = this.indexes[id]; 2809 2810 2696 if (oldIndex <= index) { 2811 2697 this.indexes[id] = index + 1; 2812 2698 } 2813 2699 } 2814 2815 2700 return this; 2816 2701 }; 2817 2818 2702 _proto.insertBefore = function insertBefore(oldNode, newNode) { 2819 2703 newNode.parent = this; … … 2822 2706 newNode.parent = this; 2823 2707 var index; 2824 2825 2708 for (var id in this.indexes) { 2826 2709 index = this.indexes[id]; 2827 2828 2710 if (index <= oldIndex) { 2829 2711 this.indexes[id] = index + 1; 2830 2712 } 2831 2713 } 2832 2833 2714 return this; 2834 2715 }; 2835 2836 2716 _proto._findChildAtPosition = function _findChildAtPosition(line, col) { 2837 2717 var found = undefined; … … 2839 2719 if (node.atPosition) { 2840 2720 var foundChild = node.atPosition(line, col); 2841 2842 2721 if (foundChild) { 2843 2722 found = foundChild; … … 2851 2730 return found; 2852 2731 } 2732 2853 2733 /** 2854 2734 * Return the most specific node at the line and column number given. … … 2863 2743 * @param {number} line The line number of the node to find. (1-based index) 2864 2744 * @param {number} col The column number of the node to find. (1-based index) 2865 */ 2866 ; 2867 2745 */; 2868 2746 _proto.atPosition = function atPosition(line, col) { 2869 2747 if (this.isAtPosition(line, col)) { … … 2873 2751 } 2874 2752 }; 2875 2876 2753 _proto._inferEndPosition = function _inferEndPosition() { 2877 2754 if (this.last && this.last.source && this.last.source.end) { … … 2881 2758 } 2882 2759 }; 2883 2884 2760 _proto.each = function each(callback) { 2885 2761 if (!this.lastEach) { 2886 2762 this.lastEach = 0; 2887 2763 } 2888 2889 2764 if (!this.indexes) { 2890 2765 this.indexes = {}; 2891 2766 } 2892 2893 2767 this.lastEach++; 2894 2768 var id = this.lastEach; 2895 2769 this.indexes[id] = 0; 2896 2897 2770 if (!this.length) { 2898 2771 return undefined; 2899 2772 } 2900 2901 2773 var index, result; 2902 2903 2774 while (this.indexes[id] < this.length) { 2904 2775 index = this.indexes[id]; 2905 2776 result = callback(this.at(index), index); 2906 2907 2777 if (result === false) { 2908 2778 break; 2909 2779 } 2910 2911 2780 this.indexes[id] += 1; 2912 2781 } 2913 2914 2782 delete this.indexes[id]; 2915 2916 2783 if (result === false) { 2917 2784 return false; 2918 2785 } 2919 2786 }; 2920 2921 2787 _proto.walk = function walk(callback) { 2922 2788 return this.each(function (node, i) { 2923 2789 var result = callback(node, i); 2924 2925 2790 if (result !== false && node.length) { 2926 2791 result = node.walk(callback); 2927 2792 } 2928 2929 2793 if (result === false) { 2930 2794 return false; … … 2932 2796 }); 2933 2797 }; 2934 2935 2798 _proto.walkAttributes = function walkAttributes(callback) { 2936 2799 var _this2 = this; 2937 2938 2800 return this.walk(function (selector) { 2939 2801 if (selector.type === types$1.ATTRIBUTE) { … … 2942 2804 }); 2943 2805 }; 2944 2945 2806 _proto.walkClasses = function walkClasses(callback) { 2946 2807 var _this3 = this; 2947 2948 2808 return this.walk(function (selector) { 2949 2809 if (selector.type === types$1.CLASS) { … … 2952 2812 }); 2953 2813 }; 2954 2955 2814 _proto.walkCombinators = function walkCombinators(callback) { 2956 2815 var _this4 = this; 2957 2958 2816 return this.walk(function (selector) { 2959 2817 if (selector.type === types$1.COMBINATOR) { … … 2962 2820 }); 2963 2821 }; 2964 2965 2822 _proto.walkComments = function walkComments(callback) { 2966 2823 var _this5 = this; 2967 2968 2824 return this.walk(function (selector) { 2969 2825 if (selector.type === types$1.COMMENT) { … … 2972 2828 }); 2973 2829 }; 2974 2975 2830 _proto.walkIds = function walkIds(callback) { 2976 2831 var _this6 = this; 2977 2978 2832 return this.walk(function (selector) { 2979 2833 if (selector.type === types$1.ID) { … … 2982 2836 }); 2983 2837 }; 2984 2985 2838 _proto.walkNesting = function walkNesting(callback) { 2986 2839 var _this7 = this; 2987 2988 2840 return this.walk(function (selector) { 2989 2841 if (selector.type === types$1.NESTING) { … … 2992 2844 }); 2993 2845 }; 2994 2995 2846 _proto.walkPseudos = function walkPseudos(callback) { 2996 2847 var _this8 = this; 2997 2998 2848 return this.walk(function (selector) { 2999 2849 if (selector.type === types$1.PSEUDO) { … … 3002 2852 }); 3003 2853 }; 3004 3005 2854 _proto.walkTags = function walkTags(callback) { 3006 2855 var _this9 = this; 3007 3008 2856 return this.walk(function (selector) { 3009 2857 if (selector.type === types$1.TAG) { … … 3012 2860 }); 3013 2861 }; 3014 3015 2862 _proto.walkUniversals = function walkUniversals(callback) { 3016 2863 var _this10 = this; 3017 3018 2864 return this.walk(function (selector) { 3019 2865 if (selector.type === types$1.UNIVERSAL) { … … 3022 2868 }); 3023 2869 }; 3024 3025 2870 _proto.split = function split(callback) { 3026 2871 var _this11 = this; 3027 3028 2872 var current = []; 3029 2873 return this.reduce(function (memo, node, index) { 3030 2874 var split = callback.call(_this11, node); 3031 2875 current.push(node); 3032 3033 2876 if (split) { 3034 2877 memo.push(current); … … 3037 2880 memo.push(current); 3038 2881 } 3039 3040 2882 return memo; 3041 2883 }, []); 3042 2884 }; 3043 3044 2885 _proto.map = function map(callback) { 3045 2886 return this.nodes.map(callback); 3046 2887 }; 3047 3048 2888 _proto.reduce = function reduce(callback, memo) { 3049 2889 return this.nodes.reduce(callback, memo); 3050 2890 }; 3051 3052 2891 _proto.every = function every(callback) { 3053 2892 return this.nodes.every(callback); 3054 2893 }; 3055 3056 2894 _proto.some = function some(callback) { 3057 2895 return this.nodes.some(callback); 3058 2896 }; 3059 3060 2897 _proto.filter = function filter(callback) { 3061 2898 return this.nodes.filter(callback); 3062 2899 }; 3063 3064 2900 _proto.sort = function sort(callback) { 3065 2901 return this.nodes.sort(callback); 3066 2902 }; 3067 3068 2903 _proto.toString = function toString() { 3069 2904 return this.map(String).join(''); 3070 2905 }; 3071 3072 2906 _createClass(Container, [{ 3073 2907 key: "first", … … 3086 2920 } 3087 2921 }]); 3088 3089 2922 return Container; 3090 2923 }(_node["default"]); 3091 3092 2924 exports["default"] = Container; 3093 2925 module.exports = exports.default; … … 3100 2932 exports.__esModule = true; 3101 2933 exports["default"] = void 0; 3102 3103 2934 var _container = _interopRequireDefault(containerExports); 3104 3105 2935 var _types = types; 3106 3107 2936 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } 3108 3109 2937 function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 3110 3111 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); return Constructor; } 3112 2938 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 3113 2939 function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } 3114 3115 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 3116 2940 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 3117 2941 var Root = /*#__PURE__*/function (_Container) { 3118 2942 _inheritsLoose(Root, _Container); 3119 3120 2943 function Root(opts) { 3121 2944 var _this; 3122 3123 2945 _this = _Container.call(this, opts) || this; 3124 2946 _this.type = _types.ROOT; 3125 2947 return _this; 3126 2948 } 3127 3128 2949 var _proto = Root.prototype; 3129 3130 2950 _proto.toString = function toString() { 3131 2951 var str = this.reduce(function (memo, selector) { … … 3135 2955 return this.trailingComma ? str + ',' : str; 3136 2956 }; 3137 3138 2957 _proto.error = function error(message, options) { 3139 2958 if (this._error) { … … 3143 2962 } 3144 2963 }; 3145 3146 2964 _createClass(Root, [{ 3147 2965 key: "errorGenerator", … … 3150 2968 } 3151 2969 }]); 3152 3153 2970 return Root; 3154 2971 }(_container["default"]); 3155 3156 2972 exports["default"] = Root; 3157 2973 module.exports = exports.default; … … 3166 2982 exports.__esModule = true; 3167 2983 exports["default"] = void 0; 3168 3169 2984 var _container = _interopRequireDefault(containerExports); 3170 3171 2985 var _types = types; 3172 3173 2986 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } 3174 3175 2987 function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } 3176 3177 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 3178 2988 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 3179 2989 var Selector = /*#__PURE__*/function (_Container) { 3180 2990 _inheritsLoose(Selector, _Container); 3181 3182 2991 function Selector(opts) { 3183 2992 var _this; 3184 3185 2993 _this = _Container.call(this, opts) || this; 3186 2994 _this.type = _types.SELECTOR; 3187 2995 return _this; 3188 2996 } 3189 3190 2997 return Selector; 3191 2998 }(_container["default"]); 3192 3193 2999 exports["default"] = Selector; 3194 3000 module.exports = exports.default; … … 3312 3118 exports.__esModule = true; 3313 3119 exports["default"] = void 0; 3314 3315 3120 var _cssesc = _interopRequireDefault(cssesc_1); 3316 3317 3121 var _util = util; 3318 3319 3122 var _node = _interopRequireDefault(nodeExports); 3320 3321 3123 var _types = types; 3322 3323 3124 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } 3324 3325 3125 function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 3326 3327 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); return Constructor; } 3328 3126 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 3329 3127 function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } 3330 3331 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 3332 3128 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 3333 3129 var ClassName = /*#__PURE__*/function (_Node) { 3334 3130 _inheritsLoose(ClassName, _Node); 3335 3336 3131 function ClassName(opts) { 3337 3132 var _this; 3338 3339 3133 _this = _Node.call(this, opts) || this; 3340 3134 _this.type = _types.CLASS; … … 3342 3136 return _this; 3343 3137 } 3344 3345 3138 var _proto = ClassName.prototype; 3346 3347 3139 _proto.valueToString = function valueToString() { 3348 3140 return '.' + _Node.prototype.valueToString.call(this); 3349 3141 }; 3350 3351 3142 _createClass(ClassName, [{ 3352 3143 key: "value", … … 3359 3150 isIdentifier: true 3360 3151 }); 3361 3362 3152 if (escaped !== v) { 3363 3153 (0, _util.ensureObject)(this, "raws"); … … 3367 3157 } 3368 3158 } 3369 3370 3159 this._value = v; 3371 3160 } 3372 3161 }]); 3373 3374 3162 return ClassName; 3375 3163 }(_node["default"]); 3376 3377 3164 exports["default"] = ClassName; 3378 3165 module.exports = exports.default; … … 3387 3174 exports.__esModule = true; 3388 3175 exports["default"] = void 0; 3389 3390 3176 var _node = _interopRequireDefault(nodeExports); 3391 3392 3177 var _types = types; 3393 3394 3178 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } 3395 3396 3179 function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } 3397 3398 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 3399 3180 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 3400 3181 var Comment = /*#__PURE__*/function (_Node) { 3401 3182 _inheritsLoose(Comment, _Node); 3402 3403 3183 function Comment(opts) { 3404 3184 var _this; 3405 3406 3185 _this = _Node.call(this, opts) || this; 3407 3186 _this.type = _types.COMMENT; 3408 3187 return _this; 3409 3188 } 3410 3411 3189 return Comment; 3412 3190 }(_node["default"]); 3413 3414 3191 exports["default"] = Comment; 3415 3192 module.exports = exports.default; … … 3424 3201 exports.__esModule = true; 3425 3202 exports["default"] = void 0; 3426 3427 3203 var _node = _interopRequireDefault(nodeExports); 3428 3429 3204 var _types = types; 3430 3431 3205 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } 3432 3433 3206 function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } 3434 3435 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 3436 3207 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 3437 3208 var ID = /*#__PURE__*/function (_Node) { 3438 3209 _inheritsLoose(ID, _Node); 3439 3440 3210 function ID(opts) { 3441 3211 var _this; 3442 3443 3212 _this = _Node.call(this, opts) || this; 3444 3213 _this.type = _types.ID; 3445 3214 return _this; 3446 3215 } 3447 3448 3216 var _proto = ID.prototype; 3449 3450 3217 _proto.valueToString = function valueToString() { 3451 3218 return '#' + _Node.prototype.valueToString.call(this); 3452 3219 }; 3453 3454 3220 return ID; 3455 3221 }(_node["default"]); 3456 3457 3222 exports["default"] = ID; 3458 3223 module.exports = exports.default; … … 3469 3234 exports.__esModule = true; 3470 3235 exports["default"] = void 0; 3471 3472 3236 var _cssesc = _interopRequireDefault(cssesc_1); 3473 3474 3237 var _util = util; 3475 3476 3238 var _node = _interopRequireDefault(nodeExports); 3477 3478 3239 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } 3479 3480 3240 function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 3481 3482 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); return Constructor; } 3483 3241 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 3484 3242 function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } 3485 3486 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 3487 3243 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 3488 3244 var Namespace = /*#__PURE__*/function (_Node) { 3489 3245 _inheritsLoose(Namespace, _Node); 3490 3491 3246 function Namespace() { 3492 3247 return _Node.apply(this, arguments) || this; 3493 3248 } 3494 3495 3249 var _proto = Namespace.prototype; 3496 3497 3250 _proto.qualifiedName = function qualifiedName(value) { 3498 3251 if (this.namespace) { … … 3502 3255 } 3503 3256 }; 3504 3505 3257 _proto.valueToString = function valueToString() { 3506 3258 return this.qualifiedName(_Node.prototype.valueToString.call(this)); 3507 3259 }; 3508 3509 3260 _createClass(Namespace, [{ 3510 3261 key: "namespace", … … 3515 3266 if (namespace === true || namespace === "*" || namespace === "&") { 3516 3267 this._namespace = namespace; 3517 3518 3268 if (this.raws) { 3519 3269 delete this.raws.namespace; 3520 3270 } 3521 3522 3271 return; 3523 3272 } 3524 3525 3273 var escaped = (0, _cssesc["default"])(namespace, { 3526 3274 isIdentifier: true 3527 3275 }); 3528 3276 this._namespace = namespace; 3529 3530 3277 if (escaped !== namespace) { 3531 3278 (0, _util.ensureObject)(this, "raws"); … … 3548 3295 if (this.namespace) { 3549 3296 var ns = this.stringifyProperty("namespace"); 3550 3551 3297 if (ns === true) { 3552 3298 return ''; … … 3559 3305 } 3560 3306 }]); 3561 3562 3307 return Namespace; 3563 3308 }(_node["default"]); 3564 3565 3309 exports["default"] = Namespace; 3566 3310 module.exports = exports.default; … … 3573 3317 exports.__esModule = true; 3574 3318 exports["default"] = void 0; 3575 3576 3319 var _namespace = _interopRequireDefault(namespaceExports); 3577 3578 3320 var _types = types; 3579 3580 3321 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } 3581 3582 3322 function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } 3583 3584 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 3585 3323 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 3586 3324 var Tag = /*#__PURE__*/function (_Namespace) { 3587 3325 _inheritsLoose(Tag, _Namespace); 3588 3589 3326 function Tag(opts) { 3590 3327 var _this; 3591 3592 3328 _this = _Namespace.call(this, opts) || this; 3593 3329 _this.type = _types.TAG; 3594 3330 return _this; 3595 3331 } 3596 3597 3332 return Tag; 3598 3333 }(_namespace["default"]); 3599 3600 3334 exports["default"] = Tag; 3601 3335 module.exports = exports.default; … … 3610 3344 exports.__esModule = true; 3611 3345 exports["default"] = void 0; 3612 3613 3346 var _node = _interopRequireDefault(nodeExports); 3614 3615 3347 var _types = types; 3616 3617 3348 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } 3618 3619 3349 function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } 3620 3621 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 3622 3350 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 3623 3351 var String = /*#__PURE__*/function (_Node) { 3624 3352 _inheritsLoose(String, _Node); 3625 3626 3353 function String(opts) { 3627 3354 var _this; 3628 3629 3355 _this = _Node.call(this, opts) || this; 3630 3356 _this.type = _types.STRING; 3631 3357 return _this; 3632 3358 } 3633 3634 3359 return String; 3635 3360 }(_node["default"]); 3636 3637 3361 exports["default"] = String; 3638 3362 module.exports = exports.default; … … 3647 3371 exports.__esModule = true; 3648 3372 exports["default"] = void 0; 3649 3650 3373 var _container = _interopRequireDefault(containerExports); 3651 3652 3374 var _types = types; 3653 3654 3375 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } 3655 3656 3376 function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } 3657 3658 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 3659 3377 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 3660 3378 var Pseudo = /*#__PURE__*/function (_Container) { 3661 3379 _inheritsLoose(Pseudo, _Container); 3662 3663 3380 function Pseudo(opts) { 3664 3381 var _this; 3665 3666 3382 _this = _Container.call(this, opts) || this; 3667 3383 _this.type = _types.PSEUDO; 3668 3384 return _this; 3669 3385 } 3670 3671 3386 var _proto = Pseudo.prototype; 3672 3673 3387 _proto.toString = function toString() { 3674 3388 var params = this.length ? '(' + this.map(String).join(',') + ')' : ''; 3675 3389 return [this.rawSpaceBefore, this.stringifyProperty("value"), params, this.rawSpaceAfter].join(''); 3676 3390 }; 3677 3678 3391 return Pseudo; 3679 3392 }(_container["default"]); 3680 3681 3393 exports["default"] = Pseudo; 3682 3394 module.exports = exports.default; … … 3696 3408 3697 3409 exports.__esModule = true; 3410 exports["default"] = void 0; 3698 3411 exports.unescapeValue = unescapeValue; 3699 exports["default"] = void 0;3700 3701 3412 var _cssesc = _interopRequireDefault(cssesc_1); 3702 3703 3413 var _unesc = _interopRequireDefault(unescExports); 3704 3705 3414 var _namespace = _interopRequireDefault(namespaceExports); 3706 3707 3415 var _types = types; 3708 3709 3416 var _CSSESC_QUOTE_OPTIONS; 3710 3711 3417 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } 3712 3713 3418 function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 3714 3715 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); return Constructor; } 3716 3419 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 3717 3420 function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } 3718 3719 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 3720 3421 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 3721 3422 var deprecate = node; 3722 3723 3423 var WRAPPED_IN_QUOTES = /^('|")([^]*)\1$/; 3724 3424 var warnOfDeprecatedValueAssignment = deprecate(function () {}, "Assigning an attribute a value containing characters that might need to be escaped is deprecated. " + "Call attribute.setValue() instead."); 3725 3425 var warnOfDeprecatedQuotedAssignment = deprecate(function () {}, "Assigning attr.quoted is deprecated and has no effect. Assign to attr.quoteMark instead."); 3726 3426 var warnOfDeprecatedConstructor = deprecate(function () {}, "Constructing an Attribute selector with a value without specifying quoteMark is deprecated. Note: The value should be unescaped now."); 3727 3728 3427 function unescapeValue(value) { 3729 3428 var deprecatedUsage = false; … … 3731 3430 var unescaped = value; 3732 3431 var m = unescaped.match(WRAPPED_IN_QUOTES); 3733 3734 3432 if (m) { 3735 3433 quoteMark = m[1]; 3736 3434 unescaped = m[2]; 3737 3435 } 3738 3739 3436 unescaped = (0, _unesc["default"])(unescaped); 3740 3741 3437 if (unescaped !== value) { 3742 3438 deprecatedUsage = true; 3743 3439 } 3744 3745 3440 return { 3746 3441 deprecatedUsage: deprecatedUsage, … … 3749 3444 }; 3750 3445 } 3751 3752 3446 function handleDeprecatedContructorOpts(opts) { 3753 3447 if (opts.quoteMark !== undefined) { 3754 3448 return opts; 3755 3449 } 3756 3757 3450 if (opts.value === undefined) { 3758 3451 return opts; 3759 3452 } 3760 3761 3453 warnOfDeprecatedConstructor(); 3762 3763 3454 var _unescapeValue = unescapeValue(opts.value), 3764 quoteMark = _unescapeValue.quoteMark, 3765 unescaped = _unescapeValue.unescaped; 3766 3455 quoteMark = _unescapeValue.quoteMark, 3456 unescaped = _unescapeValue.unescaped; 3767 3457 if (!opts.raws) { 3768 3458 opts.raws = {}; 3769 3459 } 3770 3771 3460 if (opts.raws.value === undefined) { 3772 3461 opts.raws.value = opts.value; 3773 3462 } 3774 3775 3463 opts.value = unescaped; 3776 3464 opts.quoteMark = quoteMark; 3777 3465 return opts; 3778 3466 } 3779 3780 3467 var Attribute = /*#__PURE__*/function (_Namespace) { 3781 3468 _inheritsLoose(Attribute, _Namespace); 3782 3783 3469 function Attribute(opts) { 3784 3470 var _this; 3785 3786 3471 if (opts === void 0) { 3787 3472 opts = {}; 3788 3473 } 3789 3790 3474 _this = _Namespace.call(this, handleDeprecatedContructorOpts(opts)) || this; 3791 3475 _this.type = _types.ATTRIBUTE; … … 3802 3486 return _this; 3803 3487 } 3488 3804 3489 /** 3805 3490 * Returns the Attribute's value quoted such that it would be legal to use … … 3823 3508 * method. 3824 3509 **/ 3825 3826 3827 3510 var _proto = Attribute.prototype; 3828 3829 3511 _proto.getQuotedValue = function getQuotedValue(options) { 3830 3512 if (options === void 0) { 3831 3513 options = {}; 3832 3514 } 3833 3834 3515 var quoteMark = this._determineQuoteMark(options); 3835 3836 3516 var cssescopts = CSSESC_QUOTE_OPTIONS[quoteMark]; 3837 3517 var escaped = (0, _cssesc["default"])(this._value, cssescopts); 3838 3518 return escaped; 3839 3519 }; 3840 3841 3520 _proto._determineQuoteMark = function _determineQuoteMark(options) { 3842 3521 return options.smart ? this.smartQuoteMark(options) : this.preferredQuoteMark(options); 3843 3522 } 3523 3844 3524 /** 3845 3525 * Set the unescaped value with the specified quotation options. The value 3846 3526 * provided must not include any wrapping quote marks -- those quotes will 3847 3527 * be interpreted as part of the value and escaped accordingly. 3848 */ 3849 ; 3850 3528 */; 3851 3529 _proto.setValue = function setValue(value, options) { 3852 3530 if (options === void 0) { 3853 3531 options = {}; 3854 3532 } 3855 3856 3533 this._value = value; 3857 3534 this._quoteMark = this._determineQuoteMark(options); 3858 3859 3535 this._syncRawValue(); 3860 3536 } 3537 3861 3538 /** 3862 3539 * Intelligently select a quoteMark value based on the value's contents. If … … 3870 3547 * @param options This takes the quoteMark and preferCurrentQuoteMark options 3871 3548 * from the quoteValue method. 3872 */ 3873 ; 3874 3549 */; 3875 3550 _proto.smartQuoteMark = function smartQuoteMark(options) { 3876 3551 var v = this.value; 3877 3552 var numSingleQuotes = v.replace(/[^']/g, '').length; 3878 3553 var numDoubleQuotes = v.replace(/[^"]/g, '').length; 3879 3880 3554 if (numSingleQuotes + numDoubleQuotes === 0) { 3881 3555 var escaped = (0, _cssesc["default"])(v, { 3882 3556 isIdentifier: true 3883 3557 }); 3884 3885 3558 if (escaped === v) { 3886 3559 return Attribute.NO_QUOTE; 3887 3560 } else { 3888 3561 var pref = this.preferredQuoteMark(options); 3889 3890 3562 if (pref === Attribute.NO_QUOTE) { 3891 3563 // pick a quote mark that isn't none and see if it's smaller … … 3893 3565 var opts = CSSESC_QUOTE_OPTIONS[quote]; 3894 3566 var quoteValue = (0, _cssesc["default"])(v, opts); 3895 3896 3567 if (quoteValue.length < escaped.length) { 3897 3568 return quote; 3898 3569 } 3899 3570 } 3900 3901 3571 return pref; 3902 3572 } … … 3909 3579 } 3910 3580 } 3581 3911 3582 /** 3912 3583 * Selects the preferred quote mark based on the options and the current quote mark value. 3913 3584 * If you want the quote mark to depend on the attribute value, call `smartQuoteMark(opts)` 3914 3585 * instead. 3915 */ 3916 ; 3917 3586 */; 3918 3587 _proto.preferredQuoteMark = function preferredQuoteMark(options) { 3919 3588 var quoteMark = options.preferCurrentQuoteMark ? this.quoteMark : options.quoteMark; 3920 3921 3589 if (quoteMark === undefined) { 3922 3590 quoteMark = options.preferCurrentQuoteMark ? options.quoteMark : this.quoteMark; 3923 3591 } 3924 3925 3592 if (quoteMark === undefined) { 3926 3593 quoteMark = Attribute.DOUBLE_QUOTE; 3927 3594 } 3928 3929 3595 return quoteMark; 3930 3596 }; 3931 3932 3597 _proto._syncRawValue = function _syncRawValue() { 3933 3598 var rawValue = (0, _cssesc["default"])(this._value, CSSESC_QUOTE_OPTIONS[this.quoteMark]); 3934 3935 3599 if (rawValue === this._value) { 3936 3600 if (this.raws) { … … 3941 3605 } 3942 3606 }; 3943 3944 3607 _proto._handleEscapes = function _handleEscapes(prop, value) { 3945 3608 if (this._constructed) { … … 3947 3610 isIdentifier: true 3948 3611 }); 3949 3950 3612 if (escaped !== value) { 3951 3613 this.raws[prop] = escaped; … … 3955 3617 } 3956 3618 }; 3957 3958 3619 _proto._spacesFor = function _spacesFor(name) { 3959 3620 var attrSpaces = { … … 3965 3626 return Object.assign(attrSpaces, spaces, rawSpaces); 3966 3627 }; 3967 3968 3628 _proto._stringFor = function _stringFor(name, spaceName, concat) { 3969 3629 if (spaceName === void 0) { 3970 3630 spaceName = name; 3971 3631 } 3972 3973 3632 if (concat === void 0) { 3974 3633 concat = defaultAttrConcat; 3975 3634 } 3976 3977 3635 var attrSpaces = this._spacesFor(spaceName); 3978 3979 3636 return concat(this.stringifyProperty(name), attrSpaces); 3980 3637 } 3638 3981 3639 /** 3982 3640 * returns the offset of the attribute part specified relative to the … … 3992 3650 * @param part One of the possible values inside an attribute. 3993 3651 * @returns -1 if the name is invalid or the value doesn't exist in this attribute. 3994 */ 3995 ; 3996 3652 */; 3997 3653 _proto.offsetOf = function offsetOf(name) { 3998 3654 var count = 1; 3999 4000 3655 var attributeSpaces = this._spacesFor("attribute"); 4001 4002 3656 count += attributeSpaces.before.length; 4003 4004 3657 if (name === "namespace" || name === "ns") { 4005 3658 return this.namespace ? count : -1; 4006 3659 } 4007 4008 3660 if (name === "attributeNS") { 4009 3661 return count; 4010 3662 } 4011 4012 3663 count += this.namespaceString.length; 4013 4014 3664 if (this.namespace) { 4015 3665 count += 1; 4016 3666 } 4017 4018 3667 if (name === "attribute") { 4019 3668 return count; 4020 3669 } 4021 4022 3670 count += this.stringifyProperty("attribute").length; 4023 3671 count += attributeSpaces.after.length; 4024 4025 3672 var operatorSpaces = this._spacesFor("operator"); 4026 4027 3673 count += operatorSpaces.before.length; 4028 3674 var operator = this.stringifyProperty("operator"); 4029 4030 3675 if (name === "operator") { 4031 3676 return operator ? count : -1; 4032 3677 } 4033 4034 3678 count += operator.length; 4035 3679 count += operatorSpaces.after.length; 4036 4037 3680 var valueSpaces = this._spacesFor("value"); 4038 4039 3681 count += valueSpaces.before.length; 4040 3682 var value = this.stringifyProperty("value"); 4041 4042 3683 if (name === "value") { 4043 3684 return value ? count : -1; 4044 3685 } 4045 4046 3686 count += value.length; 4047 3687 count += valueSpaces.after.length; 4048 4049 3688 var insensitiveSpaces = this._spacesFor("insensitive"); 4050 4051 3689 count += insensitiveSpaces.before.length; 4052 4053 3690 if (name === "insensitive") { 4054 3691 return this.insensitive ? count : -1; 4055 3692 } 4056 4057 3693 return -1; 4058 3694 }; 4059 4060 3695 _proto.toString = function toString() { 4061 3696 var _this2 = this; 4062 4063 3697 var selector = [this.rawSpaceBefore, '[']; 4064 3698 selector.push(this._stringFor('qualifiedAttribute', 'attribute')); 4065 4066 3699 if (this.operator && (this.value || this.value === '')) { 4067 3700 selector.push(this._stringFor('operator')); … … 4071 3704 attrSpaces.before = " "; 4072 3705 } 4073 4074 3706 return defaultAttrConcat(attrValue, attrSpaces); 4075 3707 })); 4076 3708 } 4077 4078 3709 selector.push(']'); 4079 3710 selector.push(this.rawSpaceAfter); 4080 3711 return selector.join(''); 4081 3712 }; 4082 4083 3713 _createClass(Attribute, [{ 4084 3714 key: "quoted", … … 4090 3720 warnOfDeprecatedQuotedAssignment(); 4091 3721 } 3722 4092 3723 /** 4093 3724 * returns a single (`'`) or double (`"`) quote character if the value is quoted. … … 4096 3727 * the attribute is constructed without specifying a quote mark.) 4097 3728 */ 4098 4099 3729 }, { 4100 3730 key: "quoteMark", … … 4102 3732 return this._quoteMark; 4103 3733 } 3734 4104 3735 /** 4105 3736 * Set the quote mark to be used by this attribute's value. … … 4108 3739 * 4109 3740 * @param {"'" | '"' | null} quoteMark The quote mark or `null` if the value should be unquoted. 4110 */ 4111 , 3741 */, 4112 3742 set: function set(quoteMark) { 4113 3743 if (!this._constructed) { … … 4115 3745 return; 4116 3746 } 4117 4118 3747 if (this._quoteMark !== quoteMark) { 4119 3748 this._quoteMark = quoteMark; 4120 4121 3749 this._syncRawValue(); 4122 3750 } … … 4153 3781 if (this._constructed) { 4154 3782 var _unescapeValue2 = unescapeValue(v), 4155 deprecatedUsage = _unescapeValue2.deprecatedUsage, 4156 unescaped = _unescapeValue2.unescaped, 4157 quoteMark = _unescapeValue2.quoteMark; 4158 3783 deprecatedUsage = _unescapeValue2.deprecatedUsage, 3784 unescaped = _unescapeValue2.unescaped, 3785 quoteMark = _unescapeValue2.quoteMark; 4159 3786 if (deprecatedUsage) { 4160 3787 warnOfDeprecatedValueAssignment(); 4161 3788 } 4162 4163 3789 if (unescaped === this._value && quoteMark === this._quoteMark) { 4164 3790 return; 4165 3791 } 4166 4167 3792 this._value = unescaped; 4168 3793 this._quoteMark = quoteMark; 4169 4170 3794 this._syncRawValue(); 4171 3795 } else { … … 4178 3802 return this._insensitive; 4179 3803 } 3804 4180 3805 /** 4181 3806 * Set the case insensitive flag. … … 4184 3809 * 4185 3810 * @param {true | false} insensitive true if the attribute should match case-insensitively. 4186 */ 4187 , 3811 */, 4188 3812 set: function set(insensitive) { 4189 3813 if (!insensitive) { 4190 this._insensitive = false; // "i" and "I" can be used in "this.raws.insensitiveFlag" to store the original notation. 3814 this._insensitive = false; 3815 3816 // "i" and "I" can be used in "this.raws.insensitiveFlag" to store the original notation. 4191 3817 // When setting `attr.insensitive = false` both should be erased to ensure correct serialization. 4192 4193 3818 if (this.raws && (this.raws.insensitiveFlag === 'I' || this.raws.insensitiveFlag === 'i')) { 4194 3819 this.raws.insensitiveFlag = undefined; 4195 3820 } 4196 3821 } 4197 4198 3822 this._insensitive = insensitive; 4199 3823 } … … 4205 3829 set: function set(name) { 4206 3830 this._handleEscapes("attribute", name); 4207 4208 3831 this._attribute = name; 4209 3832 } 4210 3833 }]); 4211 4212 3834 return Attribute; 4213 3835 }(_namespace["default"]); 4214 4215 3836 exports["default"] = Attribute; 4216 3837 Attribute.NO_QUOTE = null; … … 4229 3850 isIdentifier: true 4230 3851 }, _CSSESC_QUOTE_OPTIONS); 4231 4232 3852 function defaultAttrConcat(attrValue, attrSpaces) { 4233 3853 return "" + attrSpaces.before + attrValue + attrSpaces.after; … … 4241 3861 exports.__esModule = true; 4242 3862 exports["default"] = void 0; 4243 4244 3863 var _namespace = _interopRequireDefault(namespaceExports); 4245 4246 3864 var _types = types; 4247 4248 3865 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } 4249 4250 3866 function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } 4251 4252 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 4253 3867 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 4254 3868 var Universal = /*#__PURE__*/function (_Namespace) { 4255 3869 _inheritsLoose(Universal, _Namespace); 4256 4257 3870 function Universal(opts) { 4258 3871 var _this; 4259 4260 3872 _this = _Namespace.call(this, opts) || this; 4261 3873 _this.type = _types.UNIVERSAL; … … 4263 3875 return _this; 4264 3876 } 4265 4266 3877 return Universal; 4267 3878 }(_namespace["default"]); 4268 4269 3879 exports["default"] = Universal; 4270 3880 module.exports = exports.default; … … 4279 3889 exports.__esModule = true; 4280 3890 exports["default"] = void 0; 4281 4282 3891 var _node = _interopRequireDefault(nodeExports); 4283 4284 3892 var _types = types; 4285 4286 3893 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } 4287 4288 3894 function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } 4289 4290 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 4291 3895 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 4292 3896 var Combinator = /*#__PURE__*/function (_Node) { 4293 3897 _inheritsLoose(Combinator, _Node); 4294 4295 3898 function Combinator(opts) { 4296 3899 var _this; 4297 4298 3900 _this = _Node.call(this, opts) || this; 4299 3901 _this.type = _types.COMBINATOR; 4300 3902 return _this; 4301 3903 } 4302 4303 3904 return Combinator; 4304 3905 }(_node["default"]); 4305 4306 3906 exports["default"] = Combinator; 4307 3907 module.exports = exports.default; … … 4316 3916 exports.__esModule = true; 4317 3917 exports["default"] = void 0; 4318 4319 3918 var _node = _interopRequireDefault(nodeExports); 4320 4321 3919 var _types = types; 4322 4323 3920 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } 4324 4325 3921 function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } 4326 4327 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 4328 3922 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 4329 3923 var Nesting = /*#__PURE__*/function (_Node) { 4330 3924 _inheritsLoose(Nesting, _Node); 4331 4332 3925 function Nesting(opts) { 4333 3926 var _this; 4334 4335 3927 _this = _Node.call(this, opts) || this; 4336 3928 _this.type = _types.NESTING; … … 4338 3930 return _this; 4339 3931 } 4340 4341 3932 return Nesting; 4342 3933 }(_node["default"]); 4343 4344 3934 exports["default"] = Nesting; 4345 3935 module.exports = exports.default; … … 4354 3944 exports.__esModule = true; 4355 3945 exports["default"] = sortAscending; 4356 4357 3946 function sortAscending(list) { 4358 3947 return list.sort(function (a, b) { … … 4370 3959 4371 3960 tokenTypes.__esModule = true; 4372 tokenTypes. combinator = tokenTypes.word = tokenTypes.comment = tokenTypes.str = tokenTypes.tab = tokenTypes.newline = tokenTypes.feed = tokenTypes.cr = tokenTypes.backslash = tokenTypes.bang = tokenTypes.slash = tokenTypes.doubleQuote = tokenTypes.singleQuote = tokenTypes.space = tokenTypes.greaterThan = tokenTypes.pipe = tokenTypes.equals = tokenTypes.plus = tokenTypes.caret = tokenTypes.tilde = tokenTypes.dollar = tokenTypes.closeSquare = tokenTypes.openSquare = tokenTypes.closeParenthesis = tokenTypes.openParenthesis = tokenTypes.semicolon = tokenTypes.colon = tokenTypes.comma= tokenTypes.at = tokenTypes.asterisk = tokenTypes.ampersand = void 0;3961 tokenTypes.word = tokenTypes.tilde = tokenTypes.tab = tokenTypes.str = tokenTypes.space = tokenTypes.slash = tokenTypes.singleQuote = tokenTypes.semicolon = tokenTypes.plus = tokenTypes.pipe = tokenTypes.openSquare = tokenTypes.openParenthesis = tokenTypes.newline = tokenTypes.greaterThan = tokenTypes.feed = tokenTypes.equals = tokenTypes.doubleQuote = tokenTypes.dollar = tokenTypes.cr = tokenTypes.comment = tokenTypes.comma = tokenTypes.combinator = tokenTypes.colon = tokenTypes.closeSquare = tokenTypes.closeParenthesis = tokenTypes.caret = tokenTypes.bang = tokenTypes.backslash = tokenTypes.at = tokenTypes.asterisk = tokenTypes.ampersand = void 0; 4373 3962 var ampersand = 38; // `&`.charCodeAt(0); 4374 4375 3963 tokenTypes.ampersand = ampersand; 4376 3964 var asterisk = 42; // `*`.charCodeAt(0); 4377 4378 3965 tokenTypes.asterisk = asterisk; 4379 3966 var at = 64; // `@`.charCodeAt(0); 4380 4381 3967 tokenTypes.at = at; 4382 3968 var comma = 44; // `,`.charCodeAt(0); 4383 4384 3969 tokenTypes.comma = comma; 4385 3970 var colon = 58; // `:`.charCodeAt(0); 4386 4387 3971 tokenTypes.colon = colon; 4388 3972 var semicolon = 59; // `;`.charCodeAt(0); 4389 4390 3973 tokenTypes.semicolon = semicolon; 4391 3974 var openParenthesis = 40; // `(`.charCodeAt(0); 4392 4393 3975 tokenTypes.openParenthesis = openParenthesis; 4394 3976 var closeParenthesis = 41; // `)`.charCodeAt(0); 4395 4396 3977 tokenTypes.closeParenthesis = closeParenthesis; 4397 3978 var openSquare = 91; // `[`.charCodeAt(0); 4398 4399 3979 tokenTypes.openSquare = openSquare; 4400 3980 var closeSquare = 93; // `]`.charCodeAt(0); 4401 4402 3981 tokenTypes.closeSquare = closeSquare; 4403 3982 var dollar = 36; // `$`.charCodeAt(0); 4404 4405 3983 tokenTypes.dollar = dollar; 4406 3984 var tilde = 126; // `~`.charCodeAt(0); 4407 4408 3985 tokenTypes.tilde = tilde; 4409 3986 var caret = 94; // `^`.charCodeAt(0); 4410 4411 3987 tokenTypes.caret = caret; 4412 3988 var plus = 43; // `+`.charCodeAt(0); 4413 4414 3989 tokenTypes.plus = plus; 4415 3990 var equals = 61; // `=`.charCodeAt(0); 4416 4417 3991 tokenTypes.equals = equals; 4418 3992 var pipe = 124; // `|`.charCodeAt(0); 4419 4420 3993 tokenTypes.pipe = pipe; 4421 3994 var greaterThan = 62; // `>`.charCodeAt(0); 4422 4423 3995 tokenTypes.greaterThan = greaterThan; 4424 3996 var space = 32; // ` `.charCodeAt(0); 4425 4426 3997 tokenTypes.space = space; 4427 3998 var singleQuote = 39; // `'`.charCodeAt(0); 4428 4429 3999 tokenTypes.singleQuote = singleQuote; 4430 4000 var doubleQuote = 34; // `"`.charCodeAt(0); 4431 4432 4001 tokenTypes.doubleQuote = doubleQuote; 4433 4002 var slash = 47; // `/`.charCodeAt(0); 4434 4435 4003 tokenTypes.slash = slash; 4436 4004 var bang = 33; // `!`.charCodeAt(0); 4437 4438 4005 tokenTypes.bang = bang; 4439 4006 var backslash = 92; // '\\'.charCodeAt(0); 4440 4441 4007 tokenTypes.backslash = backslash; 4442 4008 var cr = 13; // '\r'.charCodeAt(0); 4443 4444 4009 tokenTypes.cr = cr; 4445 4010 var feed = 12; // '\f'.charCodeAt(0); 4446 4447 4011 tokenTypes.feed = feed; 4448 4012 var newline = 10; // '\n'.charCodeAt(0); 4449 4450 4013 tokenTypes.newline = newline; 4451 4014 var tab = 9; // '\t'.charCodeAt(0); 4015 4452 4016 // Expose aliases primarily for readability. 4453 4454 4017 tokenTypes.tab = tab; 4455 var str = singleQuote; // No good single character representation! 4456 4018 var str = singleQuote; 4019 4020 // No good single character representation! 4457 4021 tokenTypes.str = str; 4458 4022 var comment$1 = -1; … … 4466 4030 4467 4031 exports.__esModule = true; 4032 exports.FIELDS = void 0; 4468 4033 exports["default"] = tokenize; 4469 exports.FIELDS = void 0;4470 4471 4034 var t = _interopRequireWildcard(tokenTypes); 4472 4473 4035 var _unescapable, _wordDelimiters; 4474 4475 function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } 4476 4477 function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } 4478 4036 function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } 4037 function _interopRequireWildcard(obj, nodeInterop) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } 4479 4038 var unescapable = (_unescapable = {}, _unescapable[t.tab] = true, _unescapable[t.newline] = true, _unescapable[t.cr] = true, _unescapable[t.feed] = true, _unescapable); 4480 4039 var wordDelimiters = (_wordDelimiters = {}, _wordDelimiters[t.space] = true, _wordDelimiters[t.tab] = true, _wordDelimiters[t.newline] = true, _wordDelimiters[t.cr] = true, _wordDelimiters[t.feed] = true, _wordDelimiters[t.ampersand] = true, _wordDelimiters[t.asterisk] = true, _wordDelimiters[t.bang] = true, _wordDelimiters[t.comma] = true, _wordDelimiters[t.colon] = true, _wordDelimiters[t.semicolon] = true, _wordDelimiters[t.openParenthesis] = true, _wordDelimiters[t.closeParenthesis] = true, _wordDelimiters[t.openSquare] = true, _wordDelimiters[t.closeSquare] = true, _wordDelimiters[t.singleQuote] = true, _wordDelimiters[t.doubleQuote] = true, _wordDelimiters[t.plus] = true, _wordDelimiters[t.pipe] = true, _wordDelimiters[t.tilde] = true, _wordDelimiters[t.greaterThan] = true, _wordDelimiters[t.equals] = true, _wordDelimiters[t.dollar] = true, _wordDelimiters[t.caret] = true, _wordDelimiters[t.slash] = true, _wordDelimiters); 4481 4040 var hex = {}; 4482 4041 var hexChars = "0123456789abcdefABCDEF"; 4483 4484 4042 for (var i = 0; i < hexChars.length; i++) { 4485 4043 hex[hexChars.charCodeAt(i)] = true; 4486 4044 } 4045 4487 4046 /** 4488 4047 * Returns the last index of the bar css word … … 4490 4049 * @param {number} start The index into the string where word's first letter occurs 4491 4050 */ 4492 4493 4494 4051 function consumeWord(css, start) { 4495 4052 var next = start; 4496 4053 var code; 4497 4498 4054 do { 4499 4055 code = css.charCodeAt(next); 4500 4501 4056 if (wordDelimiters[code]) { 4502 4057 return next - 1; … … 4508 4063 } 4509 4064 } while (next < css.length); 4510 4511 4065 return next - 1; 4512 4066 } 4067 4513 4068 /** 4514 4069 * Returns the last index of the escape sequence … … 4516 4071 * @param {number} start The index into the string where escape character (`\`) occurs. 4517 4072 */ 4518 4519 4520 4073 function consumeEscape(css, start) { 4521 4074 var next = start; 4522 4075 var code = css.charCodeAt(next + 1); 4523 4524 4076 if (unescapable[code]) ; else if (hex[code]) { 4525 var hexDigits = 0; // consume up to 6 hex chars4526 4077 var hexDigits = 0; 4078 // consume up to 6 hex chars 4527 4079 do { 4528 4080 next++; 4529 4081 hexDigits++; 4530 4082 code = css.charCodeAt(next + 1); 4531 } while (hex[code] && hexDigits < 6); // if fewer than 6 hex chars, a trailing space ends the escape 4532 4533 4083 } while (hex[code] && hexDigits < 6); 4084 // if fewer than 6 hex chars, a trailing space ends the escape 4534 4085 if (hexDigits < 6 && code === t.space) { 4535 4086 next++; … … 4539 4090 next++; 4540 4091 } 4541 4542 4092 return next; 4543 4093 } 4544 4545 4094 var FIELDS = { 4546 4095 TYPE: 0, … … 4553 4102 }; 4554 4103 exports.FIELDS = FIELDS; 4555 4556 4104 function tokenize(input) { 4557 4105 var tokens = []; 4558 4106 var css = input.css.valueOf(); 4559 4107 var _css = css, 4560 4108 length = _css.length; 4561 4109 var offset = -1; 4562 4110 var line = 1; … … 4564 4112 var end = 0; 4565 4113 var code, content, endColumn, endLine, escaped, escapePos, last, lines, next, nextLine, nextOffset, quote, tokenType; 4566 4567 4114 function unclosed(what, fix) { 4568 4115 if (input.safe) { … … 4574 4121 } 4575 4122 } 4576 4577 4123 while (start < length) { 4578 4124 code = css.charCodeAt(start); 4579 4580 4125 if (code === t.newline) { 4581 4126 offset = start; 4582 4127 line += 1; 4583 4128 } 4584 4585 4129 switch (code) { 4586 4130 case t.space: … … 4590 4134 case t.feed: 4591 4135 next = start; 4592 4593 4136 do { 4594 4137 next += 1; 4595 4138 code = css.charCodeAt(next); 4596 4597 4139 if (code === t.newline) { 4598 4140 offset = next; … … 4600 4142 } 4601 4143 } while (code === t.space || code === t.newline || code === t.tab || code === t.cr || code === t.feed); 4602 4603 4144 tokenType = t.space; 4604 4145 endLine = line; … … 4606 4147 end = next; 4607 4148 break; 4608 4609 4149 case t.plus: 4610 4150 case t.greaterThan: … … 4612 4152 case t.pipe: 4613 4153 next = start; 4614 4615 4154 do { 4616 4155 next += 1; 4617 4156 code = css.charCodeAt(next); 4618 4157 } while (code === t.plus || code === t.greaterThan || code === t.tilde || code === t.pipe); 4619 4620 4158 tokenType = t.combinator; 4621 4159 endLine = line; … … 4623 4161 end = next; 4624 4162 break; 4163 4625 4164 // Consume these characters as single tokens. 4626 4627 4165 case t.asterisk: 4628 4166 case t.ampersand: … … 4644 4182 end = next + 1; 4645 4183 break; 4646 4647 4184 case t.singleQuote: 4648 4185 case t.doubleQuote: 4649 4186 quote = code === t.singleQuote ? "'" : '"'; 4650 4187 next = start; 4651 4652 4188 do { 4653 4189 escaped = false; 4654 4190 next = css.indexOf(quote, next + 1); 4655 4656 4191 if (next === -1) { 4657 4192 unclosed('quote', quote); 4658 4193 } 4659 4660 4194 escapePos = next; 4661 4662 4195 while (css.charCodeAt(escapePos - 1) === t.backslash) { 4663 4196 escapePos -= 1; … … 4665 4198 } 4666 4199 } while (escaped); 4667 4668 4200 tokenType = t.str; 4669 4201 endLine = line; … … 4671 4203 end = next + 1; 4672 4204 break; 4673 4674 4205 default: 4675 4206 if (code === t.slash && css.charCodeAt(start + 1) === t.asterisk) { 4676 4207 next = css.indexOf('*/', start + 2) + 1; 4677 4678 4208 if (next === 0) { 4679 4209 unclosed('comment', '*/'); 4680 4210 } 4681 4682 4211 content = css.slice(start, next + 1); 4683 4212 lines = content.split('\n'); 4684 4213 last = lines.length - 1; 4685 4686 4214 if (last > 0) { 4687 4215 nextLine = line + last; … … 4691 4219 nextOffset = offset; 4692 4220 } 4693 4694 4221 tokenType = t.comment; 4695 4222 line = nextLine; … … 4708 4235 endColumn = next - offset; 4709 4236 } 4710 4711 4237 end = next + 1; 4712 4238 break; 4713 } // Ensure that the token structure remains consistent 4714 4715 4716 tokens.push([tokenType, // [0] Token type 4717 line, // [1] Starting line 4718 start - offset, // [2] Starting column 4719 endLine, // [3] Ending line 4720 endColumn, // [4] Ending column 4721 start, // [5] Start position / Source index 4239 } 4240 4241 // Ensure that the token structure remains consistent 4242 tokens.push([tokenType, 4243 // [0] Token type 4244 line, 4245 // [1] Starting line 4246 start - offset, 4247 // [2] Starting column 4248 endLine, 4249 // [3] Ending line 4250 endColumn, 4251 // [4] Ending column 4252 start, 4253 // [5] Start position / Source index 4722 4254 end // [6] End position 4723 ]); // Reset offset for the next token 4724 4255 ]); 4256 4257 // Reset offset for the next token 4725 4258 if (nextOffset) { 4726 4259 offset = nextOffset; 4727 4260 nextOffset = null; 4728 4261 } 4729 4730 4262 start = end; 4731 4263 } 4732 4733 4264 return tokens; 4734 4265 } … … 4739 4270 exports.__esModule = true; 4740 4271 exports["default"] = void 0; 4741 4742 4272 var _root = _interopRequireDefault(rootExports); 4743 4744 4273 var _selector = _interopRequireDefault(selectorExports); 4745 4746 4274 var _className = _interopRequireDefault(classNameExports); 4747 4748 4275 var _comment = _interopRequireDefault(commentExports); 4749 4750 4276 var _id = _interopRequireDefault(idExports); 4751 4752 4277 var _tag = _interopRequireDefault(tagExports); 4753 4754 4278 var _string = _interopRequireDefault(stringExports); 4755 4756 4279 var _pseudo = _interopRequireDefault(pseudoExports); 4757 4758 4280 var _attribute = _interopRequireWildcard(attribute$1); 4759 4760 4281 var _universal = _interopRequireDefault(universalExports); 4761 4762 4282 var _combinator = _interopRequireDefault(combinatorExports); 4763 4764 4283 var _nesting = _interopRequireDefault(nestingExports); 4765 4766 4284 var _sortAscending = _interopRequireDefault(sortAscendingExports); 4767 4768 4285 var _tokenize = _interopRequireWildcard(tokenize); 4769 4770 4286 var tokens = _interopRequireWildcard(tokenTypes); 4771 4772 4287 var types$1 = _interopRequireWildcard(types); 4773 4774 4288 var _util = util; 4775 4776 4289 var _WHITESPACE_TOKENS, _Object$assign; 4777 4778 function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } 4779 4780 function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } 4781 4290 function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } 4291 function _interopRequireWildcard(obj, nodeInterop) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } 4782 4292 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } 4783 4784 4293 function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 4785 4786 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); return Constructor; } 4787 4294 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 4788 4295 var WHITESPACE_TOKENS = (_WHITESPACE_TOKENS = {}, _WHITESPACE_TOKENS[tokens.space] = true, _WHITESPACE_TOKENS[tokens.cr] = true, _WHITESPACE_TOKENS[tokens.feed] = true, _WHITESPACE_TOKENS[tokens.newline] = true, _WHITESPACE_TOKENS[tokens.tab] = true, _WHITESPACE_TOKENS); 4789 4296 var WHITESPACE_EQUIV_TOKENS = Object.assign({}, WHITESPACE_TOKENS, (_Object$assign = {}, _Object$assign[tokens.comment] = true, _Object$assign)); 4790 4791 4297 function tokenStart(token) { 4792 4298 return { … … 4795 4301 }; 4796 4302 } 4797 4798 4303 function tokenEnd(token) { 4799 4304 return { … … 4802 4307 }; 4803 4308 } 4804 4805 4309 function getSource(startLine, startColumn, endLine, endColumn) { 4806 4310 return { … … 4815 4319 }; 4816 4320 } 4817 4818 4321 function getTokenSource(token) { 4819 4322 return getSource(token[_tokenize.FIELDS.START_LINE], token[_tokenize.FIELDS.START_COL], token[_tokenize.FIELDS.END_LINE], token[_tokenize.FIELDS.END_COL]); 4820 4323 } 4821 4822 4324 function getTokenSourceSpan(startToken, endToken) { 4823 4325 if (!startToken) { 4824 4326 return undefined; 4825 4327 } 4826 4827 4328 return getSource(startToken[_tokenize.FIELDS.START_LINE], startToken[_tokenize.FIELDS.START_COL], endToken[_tokenize.FIELDS.END_LINE], endToken[_tokenize.FIELDS.END_COL]); 4828 4329 } 4829 4830 4330 function unescapeProp(node, prop) { 4831 4331 var value = node[prop]; 4832 4833 4332 if (typeof value !== "string") { 4834 4333 return; 4835 4334 } 4836 4837 4335 if (value.indexOf("\\") !== -1) { 4838 4336 (0, _util.ensureObject)(node, 'raws'); 4839 4337 node[prop] = (0, _util.unesc)(value); 4840 4841 4338 if (node.raws[prop] === undefined) { 4842 4339 node.raws[prop] = value; 4843 4340 } 4844 4341 } 4845 4846 4342 return node; 4847 4343 } 4848 4849 4344 function indexesOf(array, item) { 4850 4345 var i = -1; 4851 4346 var indexes = []; 4852 4853 4347 while ((i = array.indexOf(item, i + 1)) !== -1) { 4854 4348 indexes.push(i); 4855 4349 } 4856 4857 4350 return indexes; 4858 4351 } 4859 4860 4352 function uniqs() { 4861 4353 var list = Array.prototype.concat.apply([], arguments); … … 4864 4356 }); 4865 4357 } 4866 4867 4358 var Parser = /*#__PURE__*/function () { 4868 4359 function Parser(rule, options) { … … 4870 4361 options = {}; 4871 4362 } 4872 4873 4363 this.rule = rule; 4874 4364 this.options = Object.assign({ … … 4894 4384 column: 1 4895 4385 } 4896 } 4386 }, 4387 sourceIndex: 0 4897 4388 }); 4898 4389 this.root.append(selector); … … 4900 4391 this.loop(); 4901 4392 } 4902 4903 4393 var _proto = Parser.prototype; 4904 4905 4394 _proto._errorGenerator = function _errorGenerator() { 4906 4395 var _this = this; 4907 4908 4396 return function (message, errorOptions) { 4909 4397 if (typeof _this.rule === 'string') { 4910 4398 return new Error(message); 4911 4399 } 4912 4913 4400 return _this.rule.error(message, errorOptions); 4914 4401 }; 4915 4402 }; 4916 4917 4403 _proto.attribute = function attribute() { 4918 4404 var attr = []; 4919 4405 var startingToken = this.currToken; 4920 4406 this.position++; 4921 4922 4407 while (this.position < this.tokens.length && this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) { 4923 4408 attr.push(this.currToken); 4924 4409 this.position++; 4925 4410 } 4926 4927 4411 if (this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) { 4928 4412 return this.expected('closing square bracket', this.currToken[_tokenize.FIELDS.START_POS]); 4929 4413 } 4930 4931 4414 var len = attr.length; 4932 4415 var node = { … … 4934 4417 sourceIndex: startingToken[_tokenize.FIELDS.START_POS] 4935 4418 }; 4936 4937 4419 if (len === 1 && !~[tokens.word].indexOf(attr[0][_tokenize.FIELDS.TYPE])) { 4938 4420 return this.expected('attribute', attr[0][_tokenize.FIELDS.START_POS]); 4939 4421 } 4940 4941 4422 var pos = 0; 4942 4423 var spaceBefore = ''; … … 4944 4425 var lastAdded = null; 4945 4426 var spaceAfterMeaningfulToken = false; 4946 4947 4427 while (pos < len) { 4948 4428 var token = attr[pos]; 4949 4429 var content = this.content(token); 4950 4430 var next = attr[pos + 1]; 4951 4952 4431 switch (token[_tokenize.FIELDS.TYPE]) { 4953 4432 case tokens.space: … … 4959 4438 // } 4960 4439 spaceAfterMeaningfulToken = true; 4961 4962 4440 if (this.options.lossy) { 4963 4441 break; 4964 4442 } 4965 4966 4443 if (lastAdded) { 4967 4444 (0, _util.ensureObject)(node, 'spaces', lastAdded); … … 4969 4446 node.spaces[lastAdded].after = prevContent + content; 4970 4447 var existingComment = (0, _util.getProp)(node, 'raws', 'spaces', lastAdded, 'after') || null; 4971 4972 4448 if (existingComment) { 4973 4449 node.raws.spaces[lastAdded].after = existingComment + content; … … 4977 4453 commentBefore = commentBefore + content; 4978 4454 } 4979 4980 4455 break; 4981 4982 4456 case tokens.asterisk: 4983 4457 if (next[_tokenize.FIELDS.TYPE] === tokens.equals) { … … 4990 4464 spaceBefore = ''; 4991 4465 } 4992 4993 4466 if (commentBefore) { 4994 4467 (0, _util.ensureObject)(node, 'raws', 'spaces', 'attribute'); … … 4996 4469 commentBefore = ''; 4997 4470 } 4998 4999 4471 node.namespace = (node.namespace || "") + content; 5000 4472 var rawValue = (0, _util.getProp)(node, 'raws', 'namespace') || null; 5001 5002 4473 if (rawValue) { 5003 4474 node.raws.namespace += content; 5004 4475 } 5005 5006 4476 lastAdded = 'namespace'; 5007 4477 } 5008 5009 4478 spaceAfterMeaningfulToken = false; 5010 4479 break; 5011 5012 4480 case tokens.dollar: 5013 4481 if (lastAdded === "value") { 5014 4482 var oldRawValue = (0, _util.getProp)(node, 'raws', 'value'); 5015 4483 node.value += "$"; 5016 5017 4484 if (oldRawValue) { 5018 4485 node.raws.value = oldRawValue + "$"; 5019 4486 } 5020 5021 4487 break; 5022 4488 } 5023 5024 4489 // Falls through 5025 5026 4490 case tokens.caret: 5027 4491 if (next[_tokenize.FIELDS.TYPE] === tokens.equals) { … … 5029 4493 lastAdded = 'operator'; 5030 4494 } 5031 5032 4495 spaceAfterMeaningfulToken = false; 5033 4496 break; 5034 5035 4497 case tokens.combinator: 5036 4498 if (content === '~' && next[_tokenize.FIELDS.TYPE] === tokens.equals) { … … 5038 4500 lastAdded = 'operator'; 5039 4501 } 5040 5041 4502 if (content !== '|') { 5042 4503 spaceAfterMeaningfulToken = false; 5043 4504 break; 5044 4505 } 5045 5046 4506 if (next[_tokenize.FIELDS.TYPE] === tokens.equals) { 5047 4507 node.operator = content; … … 5050 4510 node.namespace = true; 5051 4511 } 5052 5053 4512 spaceAfterMeaningfulToken = false; 5054 4513 break; 5055 5056 4514 case tokens.word: 5057 if (next && this.content(next) === '|' && attr[pos + 2] && attr[pos + 2][_tokenize.FIELDS.TYPE] !== tokens.equals && // this look-ahead probably fails with comment nodes involved. 4515 if (next && this.content(next) === '|' && attr[pos + 2] && attr[pos + 2][_tokenize.FIELDS.TYPE] !== tokens.equals && 4516 // this look-ahead probably fails with comment nodes involved. 5058 4517 !node.operator && !node.namespace) { 5059 4518 node.namespace = content; … … 5065 4524 spaceBefore = ''; 5066 4525 } 5067 5068 4526 if (commentBefore) { 5069 4527 (0, _util.ensureObject)(node, 'raws', 'spaces', 'attribute'); … … 5071 4529 commentBefore = ''; 5072 4530 } 5073 5074 4531 node.attribute = (node.attribute || "") + content; 5075 5076 4532 var _rawValue = (0, _util.getProp)(node, 'raws', 'attribute') || null; 5077 5078 4533 if (_rawValue) { 5079 4534 node.raws.attribute += content; 5080 4535 } 5081 5082 4536 lastAdded = 'attribute'; 5083 4537 } else if (!node.value && node.value !== "" || lastAdded === "value" && !(spaceAfterMeaningfulToken || node.quoteMark)) { 5084 4538 var _unescaped = (0, _util.unesc)(content); 5085 5086 4539 var _oldRawValue = (0, _util.getProp)(node, 'raws', 'value') || ''; 5087 5088 4540 var oldValue = node.value || ''; 5089 4541 node.value = oldValue + _unescaped; 5090 4542 node.quoteMark = null; 5091 5092 4543 if (_unescaped !== content || _oldRawValue) { 5093 4544 (0, _util.ensureObject)(node, 'raws'); 5094 4545 node.raws.value = (_oldRawValue || oldValue) + content; 5095 4546 } 5096 5097 4547 lastAdded = 'value'; 5098 4548 } else { 5099 4549 var insensitive = content === 'i' || content === "I"; 5100 5101 4550 if ((node.value || node.value === '') && (node.quoteMark || spaceAfterMeaningfulToken)) { 5102 4551 node.insensitive = insensitive; 5103 5104 4552 if (!insensitive || content === "I") { 5105 4553 (0, _util.ensureObject)(node, 'raws'); 5106 4554 node.raws.insensitiveFlag = content; 5107 4555 } 5108 5109 4556 lastAdded = 'insensitive'; 5110 5111 4557 if (spaceBefore) { 5112 4558 (0, _util.ensureObject)(node, 'spaces', 'insensitive'); … … 5114 4560 spaceBefore = ''; 5115 4561 } 5116 5117 4562 if (commentBefore) { 5118 4563 (0, _util.ensureObject)(node, 'raws', 'spaces', 'insensitive'); … … 5123 4568 lastAdded = 'value'; 5124 4569 node.value += content; 5125 5126 4570 if (node.raws.value) { 5127 4571 node.raws.value += content; … … 5129 4573 } 5130 4574 } 5131 5132 4575 spaceAfterMeaningfulToken = false; 5133 4576 break; 5134 5135 4577 case tokens.str: 5136 4578 if (!node.attribute || !node.operator) { … … 5139 4581 }); 5140 4582 } 5141 5142 4583 var _unescapeValue = (0, _attribute.unescapeValue)(content), 5143 unescaped = _unescapeValue.unescaped, 5144 quoteMark = _unescapeValue.quoteMark; 5145 4584 unescaped = _unescapeValue.unescaped, 4585 quoteMark = _unescapeValue.quoteMark; 5146 4586 node.value = unescaped; 5147 4587 node.quoteMark = quoteMark; … … 5151 4591 spaceAfterMeaningfulToken = false; 5152 4592 break; 5153 5154 4593 case tokens.equals: 5155 4594 if (!node.attribute) { 5156 4595 return this.expected('attribute', token[_tokenize.FIELDS.START_POS], content); 5157 4596 } 5158 5159 4597 if (node.value) { 5160 4598 return this.error('Unexpected "=" found; an operator was already defined.', { … … 5162 4600 }); 5163 4601 } 5164 5165 4602 node.operator = node.operator ? node.operator + content : content; 5166 4603 lastAdded = 'operator'; 5167 4604 spaceAfterMeaningfulToken = false; 5168 4605 break; 5169 5170 4606 case tokens.comment: 5171 4607 if (lastAdded) { … … 5184 4620 commentBefore = commentBefore + content; 5185 4621 } 5186 5187 4622 break; 5188 5189 4623 default: 5190 4624 return this.error("Unexpected \"" + content + "\" found.", { … … 5192 4626 }); 5193 4627 } 5194 5195 4628 pos++; 5196 4629 } 5197 5198 4630 unescapeProp(node, "attribute"); 5199 4631 unescapeProp(node, "namespace"); … … 5201 4633 this.position++; 5202 4634 } 4635 5203 4636 /** 5204 4637 * return a node containing meaningless garbage up to (but not including) the specified token position. … … 5212 4645 * 5213 4646 * In lossy mode, this returns only comments. 5214 */ 5215 ; 5216 4647 */; 5217 4648 _proto.parseWhitespaceEquivalentTokens = function parseWhitespaceEquivalentTokens(stopPosition) { 5218 4649 if (stopPosition < 0) { 5219 4650 stopPosition = this.tokens.length; 5220 4651 } 5221 5222 4652 var startPosition = this.position; 5223 4653 var nodes = []; 5224 4654 var space = ""; 5225 4655 var lastComment = undefined; 5226 5227 4656 do { 5228 4657 if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) { … … 5232 4661 } else if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.comment) { 5233 4662 var spaces = {}; 5234 5235 4663 if (space) { 5236 4664 spaces.before = space; 5237 4665 space = ""; 5238 4666 } 5239 5240 4667 lastComment = new _comment["default"]({ 5241 4668 value: this.content(), … … 5247 4674 } 5248 4675 } while (++this.position < stopPosition); 5249 5250 4676 if (space) { 5251 4677 if (lastComment) { … … 5265 4691 } 5266 4692 } 5267 5268 4693 return nodes; 5269 4694 } 4695 5270 4696 /** 5271 4697 * 5272 4698 * @param {*} nodes 5273 */ 5274 ; 5275 4699 */; 5276 4700 _proto.convertWhitespaceNodesToSpace = function convertWhitespaceNodesToSpace(nodes, requiredSpace) { 5277 4701 var _this2 = this; 5278 5279 4702 if (requiredSpace === void 0) { 5280 4703 requiredSpace = false; 5281 4704 } 5282 5283 4705 var space = ""; 5284 4706 var rawSpace = ""; 5285 4707 nodes.forEach(function (n) { 5286 4708 var spaceBefore = _this2.lossySpace(n.spaces.before, requiredSpace); 5287 5288 4709 var rawSpaceBefore = _this2.lossySpace(n.rawSpaceBefore, requiredSpace); 5289 5290 4710 space += spaceBefore + _this2.lossySpace(n.spaces.after, requiredSpace && spaceBefore.length === 0); 5291 4711 rawSpace += spaceBefore + n.value + _this2.lossySpace(n.rawSpaceAfter, requiredSpace && rawSpaceBefore.length === 0); 5292 4712 }); 5293 5294 4713 if (rawSpace === space) { 5295 4714 rawSpace = undefined; 5296 4715 } 5297 5298 4716 var result = { 5299 4717 space: space, … … 5302 4720 return result; 5303 4721 }; 5304 5305 4722 _proto.isNamedCombinator = function isNamedCombinator(position) { 5306 4723 if (position === void 0) { 5307 4724 position = this.position; 5308 4725 } 5309 5310 4726 return this.tokens[position + 0] && this.tokens[position + 0][_tokenize.FIELDS.TYPE] === tokens.slash && this.tokens[position + 1] && this.tokens[position + 1][_tokenize.FIELDS.TYPE] === tokens.word && this.tokens[position + 2] && this.tokens[position + 2][_tokenize.FIELDS.TYPE] === tokens.slash; 5311 4727 }; 5312 5313 4728 _proto.namedCombinator = function namedCombinator() { 5314 4729 if (this.isNamedCombinator()) { … … 5316 4731 var name = (0, _util.unesc)(nameRaw).toLowerCase(); 5317 4732 var raws = {}; 5318 5319 4733 if (name !== nameRaw) { 5320 4734 raws.value = "/" + nameRaw + "/"; 5321 4735 } 5322 5323 4736 var node = new _combinator["default"]({ 5324 4737 value: "/" + name + "/", … … 5333 4746 } 5334 4747 }; 5335 5336 4748 _proto.combinator = function combinator() { 5337 4749 var _this3 = this; 5338 5339 4750 if (this.content() === '|') { 5340 4751 return this.namespace(); 5341 } // We need to decide between a space that's a descendant combinator and meaningless whitespace at the end of a selector. 5342 5343 4752 } 4753 // We need to decide between a space that's a descendant combinator and meaningless whitespace at the end of a selector. 5344 4754 var nextSigTokenPos = this.locateNextMeaningfulToken(this.position); 5345 5346 4755 if (nextSigTokenPos < 0 || this.tokens[nextSigTokenPos][_tokenize.FIELDS.TYPE] === tokens.comma) { 5347 4756 var nodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos); 5348 5349 4757 if (nodes.length > 0) { 5350 4758 var last = this.current.last; 5351 5352 4759 if (last) { 5353 4760 var _this$convertWhitespa = this.convertWhitespaceNodesToSpace(nodes), 5354 space = _this$convertWhitespa.space, 5355 rawSpace = _this$convertWhitespa.rawSpace; 5356 4761 space = _this$convertWhitespa.space, 4762 rawSpace = _this$convertWhitespa.rawSpace; 5357 4763 if (rawSpace !== undefined) { 5358 4764 last.rawSpaceAfter += rawSpace; 5359 4765 } 5360 5361 4766 last.spaces.after += space; 5362 4767 } else { … … 5366 4771 } 5367 4772 } 5368 5369 4773 return; 5370 4774 } 5371 5372 4775 var firstToken = this.currToken; 5373 4776 var spaceOrDescendantSelectorNodes = undefined; 5374 5375 4777 if (nextSigTokenPos > this.position) { 5376 4778 spaceOrDescendantSelectorNodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos); 5377 4779 } 5378 5379 4780 var node; 5380 5381 4781 if (this.isNamedCombinator()) { 5382 4782 node = this.namedCombinator(); … … 5391 4791 this.unexpected(); 5392 4792 } 5393 5394 4793 if (node) { 5395 4794 if (spaceOrDescendantSelectorNodes) { 5396 4795 var _this$convertWhitespa2 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes), 5397 _space = _this$convertWhitespa2.space, 5398 _rawSpace = _this$convertWhitespa2.rawSpace; 5399 4796 _space = _this$convertWhitespa2.space, 4797 _rawSpace = _this$convertWhitespa2.rawSpace; 5400 4798 node.spaces.before = _space; 5401 4799 node.rawSpaceBefore = _rawSpace; … … 5404 4802 // descendant combinator 5405 4803 var _this$convertWhitespa3 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes, true), 5406 _space2 = _this$convertWhitespa3.space, 5407 _rawSpace2 = _this$convertWhitespa3.rawSpace; 5408 4804 _space2 = _this$convertWhitespa3.space, 4805 _rawSpace2 = _this$convertWhitespa3.rawSpace; 5409 4806 if (!_rawSpace2) { 5410 4807 _rawSpace2 = _space2; 5411 4808 } 5412 5413 4809 var spaces = {}; 5414 4810 var raws = { 5415 4811 spaces: {} 5416 4812 }; 5417 5418 4813 if (_space2.endsWith(' ') && _rawSpace2.endsWith(' ')) { 5419 4814 spaces.before = _space2.slice(0, _space2.length - 1); … … 5425 4820 raws.value = _rawSpace2; 5426 4821 } 5427 5428 4822 node = new _combinator["default"]({ 5429 4823 value: ' ', … … 5434 4828 }); 5435 4829 } 5436 5437 4830 if (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.space) { 5438 4831 node.spaces.after = this.optionalSpace(this.content()); 5439 4832 this.position++; 5440 4833 } 5441 5442 4834 return this.newNode(node); 5443 4835 }; 5444 5445 4836 _proto.comma = function comma() { 5446 4837 if (this.position === this.tokens.length - 1) { … … 5449 4840 return; 5450 4841 } 5451 5452 4842 this.current._inferEndPosition(); 5453 5454 4843 var selector = new _selector["default"]({ 5455 4844 source: { 5456 4845 start: tokenStart(this.tokens[this.position + 1]) 5457 } 4846 }, 4847 sourceIndex: this.tokens[this.position + 1][_tokenize.FIELDS.START_POS] 5458 4848 }); 5459 4849 this.current.parent.append(selector); … … 5461 4851 this.position++; 5462 4852 }; 5463 5464 4853 _proto.comment = function comment() { 5465 4854 var current = this.currToken; … … 5471 4860 this.position++; 5472 4861 }; 5473 5474 4862 _proto.error = function error(message, opts) { 5475 4863 throw this.root.error(message, opts); 5476 4864 }; 5477 5478 4865 _proto.missingBackslash = function missingBackslash() { 5479 4866 return this.error('Expected a backslash preceding the semicolon.', { … … 5481 4868 }); 5482 4869 }; 5483 5484 4870 _proto.missingParenthesis = function missingParenthesis() { 5485 4871 return this.expected('opening parenthesis', this.currToken[_tokenize.FIELDS.START_POS]); 5486 4872 }; 5487 5488 4873 _proto.missingSquareBracket = function missingSquareBracket() { 5489 4874 return this.expected('opening square bracket', this.currToken[_tokenize.FIELDS.START_POS]); 5490 4875 }; 5491 5492 4876 _proto.unexpected = function unexpected() { 5493 4877 return this.error("Unexpected '" + this.content() + "'. Escaping special characters with \\ may help.", this.currToken[_tokenize.FIELDS.START_POS]); 5494 4878 }; 5495 4879 _proto.unexpectedPipe = function unexpectedPipe() { 4880 return this.error("Unexpected '|'.", this.currToken[_tokenize.FIELDS.START_POS]); 4881 }; 5496 4882 _proto.namespace = function namespace() { 5497 4883 var before = this.prevToken && this.content(this.prevToken) || true; 5498 5499 4884 if (this.nextToken[_tokenize.FIELDS.TYPE] === tokens.word) { 5500 4885 this.position++; … … 5504 4889 return this.universal(before); 5505 4890 } 5506 };5507 4891 this.unexpectedPipe(); 4892 }; 5508 4893 _proto.nesting = function nesting() { 5509 4894 if (this.nextToken) { 5510 4895 var nextContent = this.content(this.nextToken); 5511 5512 4896 if (nextContent === "|") { 5513 4897 this.position++; … … 5515 4899 } 5516 4900 } 5517 5518 4901 var current = this.currToken; 5519 4902 this.newNode(new _nesting["default"]({ … … 5524 4907 this.position++; 5525 4908 }; 5526 5527 4909 _proto.parentheses = function parentheses() { 5528 4910 var last = this.current.last; 5529 4911 var unbalanced = 1; 5530 4912 this.position++; 5531 5532 4913 if (last && last.type === types$1.PSEUDO) { 5533 4914 var selector = new _selector["default"]({ 5534 4915 source: { 5535 start: tokenStart(this.tokens[this.position - 1]) 5536 } 4916 start: tokenStart(this.tokens[this.position]) 4917 }, 4918 sourceIndex: this.tokens[this.position][_tokenize.FIELDS.START_POS] 5537 4919 }); 5538 4920 var cache = this.current; 5539 4921 last.append(selector); 5540 4922 this.current = selector; 5541 5542 4923 while (this.position < this.tokens.length && unbalanced) { 5543 4924 if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) { 5544 4925 unbalanced++; 5545 4926 } 5546 5547 4927 if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) { 5548 4928 unbalanced--; 5549 4929 } 5550 5551 4930 if (unbalanced) { 5552 4931 this.parse(); … … 5557 4936 } 5558 4937 } 5559 5560 4938 this.current = cache; 5561 4939 } else { … … 5565 4943 var parenValue = "("; 5566 4944 var parenEnd; 5567 5568 4945 while (this.position < this.tokens.length && unbalanced) { 5569 4946 if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) { 5570 4947 unbalanced++; 5571 4948 } 5572 5573 4949 if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) { 5574 4950 unbalanced--; 5575 4951 } 5576 5577 4952 parenEnd = this.currToken; 5578 4953 parenValue += this.parseParenthesisToken(this.currToken); 5579 4954 this.position++; 5580 4955 } 5581 5582 4956 if (last) { 5583 4957 last.appendToPropertyAndEscape("value", parenValue, parenValue); … … 5590 4964 } 5591 4965 } 5592 5593 4966 if (unbalanced) { 5594 4967 return this.expected('closing parenthesis', this.currToken[_tokenize.FIELDS.START_POS]); 5595 4968 } 5596 4969 }; 5597 5598 4970 _proto.pseudo = function pseudo() { 5599 4971 var _this4 = this; 5600 5601 4972 var pseudoStr = ''; 5602 4973 var startingToken = this.currToken; 5603 5604 4974 while (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.colon) { 5605 4975 pseudoStr += this.content(); 5606 4976 this.position++; 5607 4977 } 5608 5609 4978 if (!this.currToken) { 5610 4979 return this.expected(['pseudo-class', 'pseudo-element'], this.position - 1); 5611 4980 } 5612 5613 4981 if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.word) { 5614 4982 this.splitWord(false, function (first, length) { 5615 4983 pseudoStr += first; 5616 5617 4984 _this4.newNode(new _pseudo["default"]({ 5618 4985 value: pseudoStr, … … 5620 4987 sourceIndex: startingToken[_tokenize.FIELDS.START_POS] 5621 4988 })); 5622 5623 4989 if (length > 1 && _this4.nextToken && _this4.nextToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) { 5624 4990 _this4.error('Misplaced parenthesis.', { … … 5631 4997 } 5632 4998 }; 5633 5634 4999 _proto.space = function space() { 5635 var content = this.content(); // Handle space before and after the selector5636 5000 var content = this.content(); 5001 // Handle space before and after the selector 5637 5002 if (this.position === 0 || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis || this.current.nodes.every(function (node) { 5638 5003 return node.type === 'comment'; … … 5647 5012 } 5648 5013 }; 5649 5650 5014 _proto.string = function string() { 5651 5015 var current = this.currToken; … … 5657 5021 this.position++; 5658 5022 }; 5659 5660 5023 _proto.universal = function universal(namespace) { 5661 5024 var nextToken = this.nextToken; 5662 5663 5025 if (nextToken && this.content(nextToken) === '|') { 5664 5026 this.position++; 5665 5027 return this.namespace(); 5666 5028 } 5667 5668 5029 var current = this.currToken; 5669 5030 this.newNode(new _universal["default"]({ … … 5674 5035 this.position++; 5675 5036 }; 5676 5677 5037 _proto.splitWord = function splitWord(namespace, firstCallback) { 5678 5038 var _this5 = this; 5679 5680 5039 var nextToken = this.nextToken; 5681 5040 var word = this.content(); 5682 5683 5041 while (nextToken && ~[tokens.dollar, tokens.caret, tokens.equals, tokens.word].indexOf(nextToken[_tokenize.FIELDS.TYPE])) { 5684 5042 this.position++; 5685 5043 var current = this.content(); 5686 5044 word += current; 5687 5688 5045 if (current.lastIndexOf('\\') === current.length - 1) { 5689 5046 var next = this.nextToken; 5690 5691 5047 if (next && next[_tokenize.FIELDS.TYPE] === tokens.space) { 5692 5048 word += this.requiredSpace(this.content(next)); … … 5694 5050 } 5695 5051 } 5696 5697 5052 nextToken = this.nextToken; 5698 5053 } 5699 5700 5054 var hasClass = indexesOf(word, '.').filter(function (i) { 5701 5055 // Allow escaped dot within class name 5702 var escapedDot = word[i - 1] === '\\'; // Allow decimal numbers percent in @keyframes5703 5056 var escapedDot = word[i - 1] === '\\'; 5057 // Allow decimal numbers percent in @keyframes 5704 5058 var isKeyframesPercent = /^\d+\.\d+%$/.test(word); 5705 5059 return !escapedDot && !isKeyframesPercent; … … 5707 5061 var hasId = indexesOf(word, '#').filter(function (i) { 5708 5062 return word[i - 1] !== '\\'; 5709 }); // Eliminate Sass interpolations from the list of id indexes5710 5063 }); 5064 // Eliminate Sass interpolations from the list of id indexes 5711 5065 var interpolations = indexesOf(word, '#{'); 5712 5713 5066 if (interpolations.length) { 5714 5067 hasId = hasId.filter(function (hashIndex) { … … 5716 5069 }); 5717 5070 } 5718 5719 5071 var indices = (0, _sortAscending["default"])(uniqs([0].concat(hasClass, hasId))); 5720 5072 indices.forEach(function (ind, i) { 5721 5073 var index = indices[i + 1] || word.length; 5722 5074 var value = word.slice(ind, index); 5723 5724 5075 if (i === 0 && firstCallback) { 5725 5076 return firstCallback.call(_this5, value, indices.length); 5726 5077 } 5727 5728 5078 var node; 5729 5079 var current = _this5.currToken; 5730 5080 var sourceIndex = current[_tokenize.FIELDS.START_POS] + indices[i]; 5731 5081 var source = getSource(current[1], current[2] + ind, current[3], current[2] + (index - 1)); 5732 5733 5082 if (~hasClass.indexOf(ind)) { 5734 5083 var classNameOpts = { … … 5754 5103 node = new _tag["default"](tagOpts); 5755 5104 } 5756 5757 _this5.newNode(node, namespace); // Ensure that the namespace is used only once 5758 5759 5105 _this5.newNode(node, namespace); 5106 // Ensure that the namespace is used only once 5760 5107 namespace = null; 5761 5108 }); 5762 5109 this.position++; 5763 5110 }; 5764 5765 5111 _proto.word = function word(namespace) { 5766 5112 var nextToken = this.nextToken; 5767 5768 5113 if (nextToken && this.content(nextToken) === '|') { 5769 5114 this.position++; 5770 5115 return this.namespace(); 5771 5116 } 5772 5773 5117 return this.splitWord(namespace); 5774 5118 }; 5775 5776 5119 _proto.loop = function loop() { 5777 5120 while (this.position < this.tokens.length) { 5778 5121 this.parse(true); 5779 5122 } 5780 5781 5123 this.current._inferEndPosition(); 5782 5783 5124 return this.root; 5784 5125 }; 5785 5786 5126 _proto.parse = function parse(throwOnParenthesis) { 5787 5127 switch (this.currToken[_tokenize.FIELDS.TYPE]) { … … 5789 5129 this.space(); 5790 5130 break; 5791 5792 5131 case tokens.comment: 5793 5132 this.comment(); 5794 5133 break; 5795 5796 5134 case tokens.openParenthesis: 5797 5135 this.parentheses(); 5798 5136 break; 5799 5800 5137 case tokens.closeParenthesis: 5801 5138 if (throwOnParenthesis) { 5802 5139 this.missingParenthesis(); 5803 5140 } 5804 5805 5141 break; 5806 5807 5142 case tokens.openSquare: 5808 5143 this.attribute(); 5809 5144 break; 5810 5811 5145 case tokens.dollar: 5812 5146 case tokens.caret: … … 5815 5149 this.word(); 5816 5150 break; 5817 5818 5151 case tokens.colon: 5819 5152 this.pseudo(); 5820 5153 break; 5821 5822 5154 case tokens.comma: 5823 5155 this.comma(); 5824 5156 break; 5825 5826 5157 case tokens.asterisk: 5827 5158 this.universal(); 5828 5159 break; 5829 5830 5160 case tokens.ampersand: 5831 5161 this.nesting(); 5832 5162 break; 5833 5834 5163 case tokens.slash: 5835 5164 case tokens.combinator: 5836 5165 this.combinator(); 5837 5166 break; 5838 5839 5167 case tokens.str: 5840 5168 this.string(); 5841 5169 break; 5842 5170 // These cases throw; no break needed. 5843 5844 5171 case tokens.closeSquare: 5845 5172 this.missingSquareBracket(); 5846 5847 5173 case tokens.semicolon: 5848 5174 this.missingBackslash(); 5849 5850 5175 default: 5851 5176 this.unexpected(); 5852 5177 } 5853 5178 } 5179 5854 5180 /** 5855 5181 * Helpers 5856 */ 5857 ; 5858 5182 */; 5859 5183 _proto.expected = function expected(description, index, found) { 5860 5184 if (Array.isArray(description)) { … … 5862 5186 description = description.join(', ') + " or " + last; 5863 5187 } 5864 5865 5188 var an = /^[aeiou]/.test(description[0]) ? 'an' : 'a'; 5866 5867 5189 if (!found) { 5868 5190 return this.error("Expected " + an + " " + description + ".", { … … 5870 5192 }); 5871 5193 } 5872 5873 5194 return this.error("Expected " + an + " " + description + ", found \"" + found + "\" instead.", { 5874 5195 index: index 5875 5196 }); 5876 5197 }; 5877 5878 5198 _proto.requiredSpace = function requiredSpace(space) { 5879 5199 return this.options.lossy ? ' ' : space; 5880 5200 }; 5881 5882 5201 _proto.optionalSpace = function optionalSpace(space) { 5883 5202 return this.options.lossy ? '' : space; 5884 5203 }; 5885 5886 5204 _proto.lossySpace = function lossySpace(space, required) { 5887 5205 if (this.options.lossy) { … … 5891 5209 } 5892 5210 }; 5893 5894 5211 _proto.parseParenthesisToken = function parseParenthesisToken(token) { 5895 5212 var content = this.content(token); 5896 5897 5213 if (token[_tokenize.FIELDS.TYPE] === tokens.space) { 5898 5214 return this.requiredSpace(content); … … 5901 5217 } 5902 5218 }; 5903 5904 5219 _proto.newNode = function newNode(node, namespace) { 5905 5220 if (namespace) { … … 5908 5223 this.spaces = (this.spaces || '') + namespace; 5909 5224 } 5910 5911 5225 namespace = true; 5912 5226 } 5913 5914 5227 node.namespace = namespace; 5915 5228 unescapeProp(node, "namespace"); 5916 5229 } 5917 5918 5230 if (this.spaces) { 5919 5231 node.spaces.before = this.spaces; 5920 5232 this.spaces = ''; 5921 5233 } 5922 5923 5234 return this.current.append(node); 5924 5235 }; 5925 5926 5236 _proto.content = function content(token) { 5927 5237 if (token === void 0) { 5928 5238 token = this.currToken; 5929 5239 } 5930 5931 5240 return this.css.slice(token[_tokenize.FIELDS.START_POS], token[_tokenize.FIELDS.END_POS]); 5932 5241 }; 5933 5934 5242 /** 5935 5243 * returns the index of the next non-whitespace, non-comment token. … … 5940 5248 startPosition = this.position + 1; 5941 5249 } 5942 5943 5250 var searchPosition = startPosition; 5944 5945 5251 while (searchPosition < this.tokens.length) { 5946 5252 if (WHITESPACE_EQUIV_TOKENS[this.tokens[searchPosition][_tokenize.FIELDS.TYPE]]) { … … 5951 5257 } 5952 5258 } 5953 5954 5259 return -1; 5955 5260 }; 5956 5957 5261 _createClass(Parser, [{ 5958 5262 key: "currToken", … … 5971 5275 } 5972 5276 }]); 5973 5974 5277 return Parser; 5975 5278 }(); 5976 5977 5279 exports["default"] = Parser; 5978 5280 module.exports = exports.default; … … 5985 5287 exports.__esModule = true; 5986 5288 exports["default"] = void 0; 5987 5988 5289 var _parser = _interopRequireDefault(parserExports); 5989 5990 5290 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } 5991 5992 5291 var Processor = /*#__PURE__*/function () { 5993 5292 function Processor(func, options) { 5994 5293 this.func = func || function noop() {}; 5995 5996 5294 this.funcRes = null; 5997 5295 this.options = options; 5998 5296 } 5999 6000 5297 var _proto = Processor.prototype; 6001 6002 5298 _proto._shouldUpdateSelector = function _shouldUpdateSelector(rule, options) { 6003 5299 if (options === void 0) { 6004 5300 options = {}; 6005 5301 } 6006 6007 5302 var merged = Object.assign({}, this.options, options); 6008 6009 5303 if (merged.updateSelector === false) { 6010 5304 return false; … … 6013 5307 } 6014 5308 }; 6015 6016 5309 _proto._isLossy = function _isLossy(options) { 6017 5310 if (options === void 0) { 6018 5311 options = {}; 6019 5312 } 6020 6021 5313 var merged = Object.assign({}, this.options, options); 6022 6023 5314 if (merged.lossless === false) { 6024 5315 return true; … … 6027 5318 } 6028 5319 }; 6029 6030 5320 _proto._root = function _root(rule, options) { 6031 5321 if (options === void 0) { 6032 5322 options = {}; 6033 5323 } 6034 6035 5324 var parser = new _parser["default"](rule, this._parseOptions(options)); 6036 5325 return parser.root; 6037 5326 }; 6038 6039 5327 _proto._parseOptions = function _parseOptions(options) { 6040 5328 return { … … 6042 5330 }; 6043 5331 }; 6044 6045 5332 _proto._run = function _run(rule, options) { 6046 5333 var _this = this; 6047 6048 5334 if (options === void 0) { 6049 5335 options = {}; 6050 5336 } 6051 6052 5337 return new Promise(function (resolve, reject) { 6053 5338 try { 6054 5339 var root = _this._root(rule, options); 6055 6056 5340 Promise.resolve(_this.func(root)).then(function (transform) { 6057 5341 var string = undefined; 6058 6059 5342 if (_this._shouldUpdateSelector(rule, options)) { 6060 5343 string = root.toString(); 6061 5344 rule.selector = string; 6062 5345 } 6063 6064 5346 return { 6065 5347 transform: transform, … … 6074 5356 }); 6075 5357 }; 6076 6077 5358 _proto._runSync = function _runSync(rule, options) { 6078 5359 if (options === void 0) { 6079 5360 options = {}; 6080 5361 } 6081 6082 5362 var root = this._root(rule, options); 6083 6084 5363 var transform = this.func(root); 6085 6086 5364 if (transform && typeof transform.then === "function") { 6087 5365 throw new Error("Selector processor returned a promise to a synchronous call."); 6088 5366 } 6089 6090 5367 var string = undefined; 6091 6092 5368 if (options.updateSelector && typeof rule !== "string") { 6093 5369 string = root.toString(); 6094 5370 rule.selector = string; 6095 5371 } 6096 6097 5372 return { 6098 5373 transform: transform, … … 6101 5376 }; 6102 5377 } 5378 6103 5379 /** 6104 5380 * Process rule into a selector AST. … … 6107 5383 * @param options The options for processing 6108 5384 * @returns {Promise<parser.Root>} The AST of the selector after processing it. 6109 */ 6110 ; 6111 5385 */; 6112 5386 _proto.ast = function ast(rule, options) { 6113 5387 return this._run(rule, options).then(function (result) { … … 6115 5389 }); 6116 5390 } 5391 6117 5392 /** 6118 5393 * Process rule into a selector AST synchronously. … … 6121 5396 * @param options The options for processing 6122 5397 * @returns {parser.Root} The AST of the selector after processing it. 6123 */ 6124 ; 6125 5398 */; 6126 5399 _proto.astSync = function astSync(rule, options) { 6127 5400 return this._runSync(rule, options).root; 6128 5401 } 5402 6129 5403 /** 6130 5404 * Process a selector into a transformed value asynchronously … … 6133 5407 * @param options The options for processing 6134 5408 * @returns {Promise<any>} The value returned by the processor. 6135 */ 6136 ; 6137 5409 */; 6138 5410 _proto.transform = function transform(rule, options) { 6139 5411 return this._run(rule, options).then(function (result) { … … 6141 5413 }); 6142 5414 } 5415 6143 5416 /** 6144 5417 * Process a selector into a transformed value synchronously. … … 6147 5420 * @param options The options for processing 6148 5421 * @returns {any} The value returned by the processor. 6149 */ 6150 ; 6151 5422 */; 6152 5423 _proto.transformSync = function transformSync(rule, options) { 6153 5424 return this._runSync(rule, options).transform; 6154 5425 } 5426 6155 5427 /** 6156 5428 * Process a selector into a new selector string asynchronously. … … 6159 5431 * @param options The options for processing 6160 5432 * @returns {string} the selector after processing. 6161 */ 6162 ; 6163 5433 */; 6164 5434 _proto.process = function process(rule, options) { 6165 5435 return this._run(rule, options).then(function (result) { … … 6167 5437 }); 6168 5438 } 5439 6169 5440 /** 6170 5441 * Process a selector into a new selector string synchronously. … … 6173 5444 * @param options The options for processing 6174 5445 * @returns {string} the selector after processing. 6175 */ 6176 ; 6177 5446 */; 6178 5447 _proto.processSync = function processSync(rule, options) { 6179 5448 var result = this._runSync(rule, options); 6180 6181 5449 return result.string || result.root.toString(); 6182 5450 }; 6183 6184 5451 return Processor; 6185 5452 }(); 6186 6187 5453 exports["default"] = Processor; 6188 5454 module.exports = exports.default; … … 6197 5463 constructors.__esModule = true; 6198 5464 constructors.universal = constructors.tag = constructors.string = constructors.selector = constructors.root = constructors.pseudo = constructors.nesting = constructors.id = constructors.comment = constructors.combinator = constructors.className = constructors.attribute = void 0; 6199 6200 5465 var _attribute = _interopRequireDefault$2(attribute$1); 6201 6202 5466 var _className = _interopRequireDefault$2(classNameExports); 6203 6204 5467 var _combinator = _interopRequireDefault$2(combinatorExports); 6205 6206 5468 var _comment = _interopRequireDefault$2(commentExports); 6207 6208 5469 var _id = _interopRequireDefault$2(idExports); 6209 6210 5470 var _nesting = _interopRequireDefault$2(nestingExports); 6211 6212 5471 var _pseudo = _interopRequireDefault$2(pseudoExports); 6213 6214 5472 var _root = _interopRequireDefault$2(rootExports); 6215 6216 5473 var _selector = _interopRequireDefault$2(selectorExports); 6217 6218 5474 var _string = _interopRequireDefault$2(stringExports); 6219 6220 5475 var _tag = _interopRequireDefault$2(tagExports); 6221 6222 5476 var _universal = _interopRequireDefault$2(universalExports); 6223 6224 5477 function _interopRequireDefault$2(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } 6225 6226 5478 var attribute = function attribute(opts) { 6227 5479 return new _attribute["default"](opts); 6228 5480 }; 6229 6230 5481 constructors.attribute = attribute; 6231 6232 5482 var className = function className(opts) { 6233 5483 return new _className["default"](opts); 6234 5484 }; 6235 6236 5485 constructors.className = className; 6237 6238 5486 var combinator = function combinator(opts) { 6239 5487 return new _combinator["default"](opts); 6240 5488 }; 6241 6242 5489 constructors.combinator = combinator; 6243 6244 5490 var comment = function comment(opts) { 6245 5491 return new _comment["default"](opts); 6246 5492 }; 6247 6248 5493 constructors.comment = comment; 6249 6250 5494 var id = function id(opts) { 6251 5495 return new _id["default"](opts); 6252 5496 }; 6253 6254 5497 constructors.id = id; 6255 6256 5498 var nesting = function nesting(opts) { 6257 5499 return new _nesting["default"](opts); 6258 5500 }; 6259 6260 5501 constructors.nesting = nesting; 6261 6262 5502 var pseudo = function pseudo(opts) { 6263 5503 return new _pseudo["default"](opts); 6264 5504 }; 6265 6266 5505 constructors.pseudo = pseudo; 6267 6268 5506 var root = function root(opts) { 6269 5507 return new _root["default"](opts); 6270 5508 }; 6271 6272 5509 constructors.root = root; 6273 6274 5510 var selector = function selector(opts) { 6275 5511 return new _selector["default"](opts); 6276 5512 }; 6277 6278 5513 constructors.selector = selector; 6279 6280 5514 var string = function string(opts) { 6281 5515 return new _string["default"](opts); 6282 5516 }; 6283 6284 5517 constructors.string = string; 6285 6286 5518 var tag = function tag(opts) { 6287 5519 return new _tag["default"](opts); 6288 5520 }; 6289 6290 5521 constructors.tag = tag; 6291 6292 5522 var universal = function universal(opts) { 6293 5523 return new _universal["default"](opts); 6294 5524 }; 6295 6296 5525 constructors.universal = universal; 6297 5526 … … 6299 5528 6300 5529 guards.__esModule = true; 5530 guards.isComment = guards.isCombinator = guards.isClassName = guards.isAttribute = void 0; 5531 guards.isContainer = isContainer; 5532 guards.isIdentifier = void 0; 5533 guards.isNamespace = isNamespace; 5534 guards.isNesting = void 0; 6301 5535 guards.isNode = isNode; 5536 guards.isPseudo = void 0; 5537 guards.isPseudoClass = isPseudoClass; 6302 5538 guards.isPseudoElement = isPseudoElement; 6303 guards.isPseudoClass = isPseudoClass; 6304 guards.isContainer = isContainer; 6305 guards.isNamespace = isNamespace; 6306 guards.isUniversal = guards.isTag = guards.isString = guards.isSelector = guards.isRoot = guards.isPseudo = guards.isNesting = guards.isIdentifier = guards.isComment = guards.isCombinator = guards.isClassName = guards.isAttribute = void 0; 6307 5539 guards.isUniversal = guards.isTag = guards.isString = guards.isSelector = guards.isRoot = void 0; 6308 5540 var _types = types; 6309 6310 5541 var _IS_TYPE; 6311 6312 5542 var IS_TYPE = (_IS_TYPE = {}, _IS_TYPE[_types.ATTRIBUTE] = true, _IS_TYPE[_types.CLASS] = true, _IS_TYPE[_types.COMBINATOR] = true, _IS_TYPE[_types.COMMENT] = true, _IS_TYPE[_types.ID] = true, _IS_TYPE[_types.NESTING] = true, _IS_TYPE[_types.PSEUDO] = true, _IS_TYPE[_types.ROOT] = true, _IS_TYPE[_types.SELECTOR] = true, _IS_TYPE[_types.STRING] = true, _IS_TYPE[_types.TAG] = true, _IS_TYPE[_types.UNIVERSAL] = true, _IS_TYPE); 6313 6314 5543 function isNode(node) { 6315 5544 return typeof node === "object" && IS_TYPE[node.type]; 6316 5545 } 6317 6318 5546 function isNodeType(type, node) { 6319 5547 return isNode(node) && node.type === type; 6320 5548 } 6321 6322 5549 var isAttribute = isNodeType.bind(null, _types.ATTRIBUTE); 6323 5550 guards.isAttribute = isAttribute; … … 6344 5571 var isUniversal = isNodeType.bind(null, _types.UNIVERSAL); 6345 5572 guards.isUniversal = isUniversal; 6346 6347 5573 function isPseudoElement(node) { 6348 5574 return isPseudo(node) && node.value && (node.value.startsWith("::") || node.value.toLowerCase() === ":before" || node.value.toLowerCase() === ":after" || node.value.toLowerCase() === ":first-letter" || node.value.toLowerCase() === ":first-line"); 6349 5575 } 6350 6351 5576 function isPseudoClass(node) { 6352 5577 return isPseudo(node) && !isPseudoElement(node); 6353 5578 } 6354 6355 5579 function isContainer(node) { 6356 5580 return !!(isNode(node) && node.walk); 6357 5581 } 6358 6359 5582 function isNamespace(node) { 6360 5583 return isAttribute(node) || isTag(node); … … 6364 5587 6365 5588 exports.__esModule = true; 6366 6367 5589 var _types = types; 6368 6369 5590 Object.keys(_types).forEach(function (key) { 6370 5591 if (key === "default" || key === "__esModule") return; … … 6372 5593 exports[key] = _types[key]; 6373 5594 }); 6374 6375 5595 var _constructors = constructors; 6376 6377 5596 Object.keys(_constructors).forEach(function (key) { 6378 5597 if (key === "default" || key === "__esModule") return; … … 6380 5599 exports[key] = _constructors[key]; 6381 5600 }); 6382 6383 5601 var _guards = guards; 6384 6385 5602 Object.keys(_guards).forEach(function (key) { 6386 5603 if (key === "default" || key === "__esModule") return; … … 6394 5611 exports.__esModule = true; 6395 5612 exports["default"] = void 0; 6396 6397 5613 var _processor = _interopRequireDefault(processorExports); 6398 6399 5614 var selectors$1 = _interopRequireWildcard(selectors); 6400 6401 function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } 6402 6403 function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } 6404 5615 function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } 5616 function _interopRequireWildcard(obj, nodeInterop) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } 6405 5617 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } 6406 6407 5618 var parser = function parser(processor) { 6408 5619 return new _processor["default"](processor); 6409 5620 }; 6410 6411 5621 Object.assign(parser, selectors$1); 6412 5622 delete parser.__esModule; … … 6567 5777 explicit: context.explicit, 6568 5778 }; 6569 newNodes = node.map((childNode) => 6570 transform(childNode, childContext) 6571 ); 5779 newNodes = node.map((childNode) => { 5780 const newContext = { 5781 ...childContext, 5782 enforceNoSpacing: false, 5783 }; 5784 5785 const result = transform(childNode, newContext); 5786 5787 childContext.global = newContext.global; 5788 childContext.hasLocals = newContext.hasLocals; 5789 5790 return result; 5791 }); 6572 5792 6573 5793 node = node.clone(); … … 6638 5858 break; 6639 5859 } 5860 case "nesting": { 5861 if (node.value === "&") { 5862 context.hasLocals = true; 5863 } 5864 } 6640 5865 } 6641 5866 … … 6710 5935 } 6711 5936 6712 function isWordAFunctionArgument(wordNode, functionNode) { 6713 return functionNode 6714 ? functionNode.nodes.some( 6715 (functionNodeChild) => 6716 functionNodeChild.sourceIndex === wordNode.sourceIndex 6717 ) 6718 : false; 6719 } 5937 // `none` is special value, other is global values 5938 const specialKeywords = [ 5939 "none", 5940 "inherit", 5941 "initial", 5942 "revert", 5943 "revert-layer", 5944 "unset", 5945 ]; 6720 5946 6721 5947 function localizeDeclarationValues(localize, declaration, context) { … … 6723 5949 6724 5950 valueNodes.walk((node, index, nodes) => { 5951 if ( 5952 node.type === "function" && 5953 (node.value.toLowerCase() === "var" || node.value.toLowerCase() === "env") 5954 ) { 5955 return false; 5956 } 5957 5958 if ( 5959 node.type === "word" && 5960 specialKeywords.includes(node.value.toLowerCase()) 5961 ) { 5962 return; 5963 } 5964 6725 5965 const subContext = { 6726 5966 options: context.options, … … 6739 5979 6740 5980 if (isAnimation) { 6741 const validIdent = /^-?[_a-z][_a-z0-9-]*$/i; 5981 // letter 5982 // An uppercase letter or a lowercase letter. 5983 // 5984 // ident-start code point 5985 // A letter, a non-ASCII code point, or U+005F LOW LINE (_). 5986 // 5987 // ident code point 5988 // An ident-start code point, a digit, or U+002D HYPHEN-MINUS (-). 5989 5990 // We don't validate `hex digits`, because we don't need it, it is work of linters. 5991 const validIdent = 5992 /^-?([a-z\u0080-\uFFFF_]|(\\[^\r\n\f])|-(?![0-9]))((\\[^\r\n\f])|[a-z\u0080-\uFFFF_0-9-])*$/i; 6742 5993 6743 5994 /* … … 6746 5997 a keyword, it is given priority. Only when all the properties that can take a keyword are 6747 5998 exhausted can the animation name be set to the keyword. I.e. 6748 5999 6749 6000 animation: infinite infinite; 6750 6001 6751 6002 The animation will repeat an infinite number of times from the first argument, and will have an 6752 6003 animation name of infinite from the second. 6753 6004 */ 6754 6005 const animationKeywords = { 6006 // animation-direction 6007 $normal: 1, 6008 $reverse: 1, 6755 6009 $alternate: 1, 6756 6010 "$alternate-reverse": 1, 6011 // animation-fill-mode 6012 $forwards: 1, 6757 6013 $backwards: 1, 6758 6014 $both: 1, 6015 // animation-iteration-count 6016 $infinite: 1, 6017 // animation-play-state 6018 $paused: 1, 6019 $running: 1, 6020 // animation-timing-function 6759 6021 $ease: 1, 6760 6022 "$ease-in": 1, 6023 "$ease-out": 1, 6761 6024 "$ease-in-out": 1, 6762 "$ease-out": 1,6763 $forwards: 1,6764 $infinite: 1,6765 6025 $linear: 1, 6766 $none: Infinity, // No matter how many times you write none, it will never be an animation name6767 $normal: 1,6768 $paused: 1,6769 $reverse: 1,6770 $running: 1,6771 6026 "$step-end": 1, 6772 6027 "$step-start": 1, 6028 // Special 6029 $none: Infinity, // No matter how many times you write none, it will never be an animation name 6030 // Global values 6773 6031 $initial: Infinity, 6774 6032 $inherit: Infinity, 6775 6033 $unset: Infinity, 6034 $revert: Infinity, 6035 "$revert-layer": Infinity, 6776 6036 }; 6777 6037 let parsedAnimationKeywords = {}; 6778 let stepsFunctionNode = null;6779 6038 const valueNodes = valueParser(declaration.value).walk((node) => { 6780 / * If div-token appeared (represents as comma ','), a possibility of an animation-keywords should be reflesh. */6039 // If div-token appeared (represents as comma ','), a possibility of an animation-keywords should be reflesh. 6781 6040 if (node.type === "div") { 6782 6041 parsedAnimationKeywords = {}; 6042 6043 return; 6783 6044 } 6784 if (node.type === "function" && node.value.toLowerCase() === "steps") { 6785 stepsFunctionNode = node; 6045 // Do not handle nested functions 6046 else if (node.type === "function") { 6047 return false; 6786 6048 } 6787 const value = 6788 node.type === "word" && 6789 !isWordAFunctionArgument(node, stepsFunctionNode) 6790 ? node.value.toLowerCase() 6791 : null; 6049 // Ignore all except word 6050 else if (node.type !== "word") { 6051 return; 6052 } 6053 6054 const value = node.type === "word" ? node.value.toLowerCase() : null; 6792 6055 6793 6056 let shouldParseAnimationName = false; … … 6814 6077 localAliasMap: context.localAliasMap, 6815 6078 }; 6079 6816 6080 return localizeDeclNode(node, subContext); 6817 6081 }); … … 6888 6152 atRule.params = localMatch[0]; 6889 6153 globalKeyframes = false; 6890 } else if (!globalMode) { 6891 if (atRule.params && !localAliasMap.has(atRule.params)) { 6892 atRule.params = ":local(" + atRule.params + ")"; 6893 } 6154 } else if ( 6155 atRule.params && 6156 !globalMode && 6157 !localAliasMap.has(atRule.params) 6158 ) { 6159 atRule.params = ":local(" + atRule.params + ")"; 6894 6160 } 6895 6161 … … 6900 6166 global: globalKeyframes, 6901 6167 }); 6168 }); 6169 } else if (/scope$/i.test(atRule.name)) { 6170 if (atRule.params) { 6171 atRule.params = atRule.params 6172 .split("to") 6173 .map((item) => { 6174 const selector = item.trim().slice(1, -1).trim(); 6175 const context = localizeNode( 6176 selector, 6177 options.mode, 6178 localAliasMap 6179 ); 6180 6181 context.options = options; 6182 context.localAliasMap = localAliasMap; 6183 6184 if (pureMode && context.hasPureGlobals) { 6185 throw atRule.error( 6186 'Selector in at-rule"' + 6187 selector + 6188 '" is not pure ' + 6189 "(pure selectors must contain at least one local class or id)" 6190 ); 6191 } 6192 6193 return `(${context.selector})`; 6194 }) 6195 .join(" to "); 6196 } 6197 6198 atRule.nodes.forEach((declaration) => { 6199 if (declaration.type === "decl") { 6200 localizeDeclaration(declaration, { 6201 localAliasMap, 6202 options: options, 6203 global: globalMode, 6204 }); 6205 } 6902 6206 }); 6903 6207 } else if (atRule.nodes) { … … 6960 6264 const hasOwnProperty = Object.prototype.hasOwnProperty; 6961 6265 6962 function getSingleLocalNamesForComposes(root) { 6266 function isNestedRule(rule) { 6267 if (!rule.parent || rule.parent.type === "root") { 6268 return false; 6269 } 6270 6271 if (rule.parent.type === "rule") { 6272 return true; 6273 } 6274 6275 return isNestedRule(rule.parent); 6276 } 6277 6278 function getSingleLocalNamesForComposes(root, rule) { 6279 if (isNestedRule(rule)) { 6280 throw new Error(`composition is not allowed in nested rule \n\n${rule}`); 6281 } 6282 6963 6283 return root.nodes.map((node) => { 6964 6284 if (node.type !== "selector" || node.nodes.length !== 1) { … … 7047 6367 const exports = Object.create(null); 7048 6368 7049 function exportScopedName(name, rawName ) {6369 function exportScopedName(name, rawName, node) { 7050 6370 const scopedName = generateScopedName( 7051 6371 rawName ? rawName : name, 7052 6372 root.source.input.from, 7053 root.source.input.css 6373 root.source.input.css, 6374 node 7054 6375 ); 7055 6376 const exportEntry = generateExportEntry( … … 7057 6378 scopedName, 7058 6379 root.source.input.from, 7059 root.source.input.css 6380 root.source.input.css, 6381 node 7060 6382 ); 7061 6383 const { key, value } = exportEntry; … … 7073 6395 switch (node.type) { 7074 6396 case "selector": 7075 node.nodes = node.map( localizeNode);6397 node.nodes = node.map((item) => localizeNode(item)); 7076 6398 return node; 7077 6399 case "class": … … 7079 6401 value: exportScopedName( 7080 6402 node.value, 7081 node.raws && node.raws.value ? node.raws.value : null 6403 node.raws && node.raws.value ? node.raws.value : null, 6404 node 7082 6405 ), 7083 6406 }); … … 7086 6409 value: exportScopedName( 7087 6410 node.value, 7088 node.raws && node.raws.value ? node.raws.value : null 6411 node.raws && node.raws.value ? node.raws.value : null, 6412 node 7089 6413 ), 7090 6414 }); 6415 } 6416 case "attribute": { 6417 if (node.attribute === "class" && node.operator === "=") { 6418 return selectorParser.attribute({ 6419 attribute: node.attribute, 6420 operator: node.operator, 6421 quoteMark: "'", 6422 value: exportScopedName(node.value, null, null), 6423 }); 6424 } 7091 6425 } 7092 6426 } … … 7106 6440 7107 6441 const selector = localizeNode(node.first); 7108 // move the spaces that were around the ps uedo selector to the first6442 // move the spaces that were around the pseudo selector to the first 7109 6443 // non-container node 7110 6444 selector.first.spaces = node.spaces; … … 7128 6462 case "root": 7129 6463 case "selector": { 7130 node.each( traverseNode);6464 node.each((item) => traverseNode(item)); 7131 6465 break; 7132 6466 } … … 7156 6490 rule.selector = traverseNode(parsedSelector.clone()).toString(); 7157 6491 7158 rule.walkDecls(/composes|compose-with/i, (decl) => { 7159 const localNames = getSingleLocalNamesForComposes(parsedSelector); 7160 const classes = decl.value.split(/\s+/); 7161 7162 classes.forEach((className) => { 7163 const global = /^global\(([^)]+)\)$/.exec(className); 7164 7165 if (global) { 7166 localNames.forEach((exportedName) => { 7167 exports[exportedName].push(global[1]); 7168 }); 7169 } else if (hasOwnProperty.call(importedNames, className)) { 7170 localNames.forEach((exportedName) => { 7171 exports[exportedName].push(className); 7172 }); 7173 } else if (hasOwnProperty.call(exports, className)) { 7174 localNames.forEach((exportedName) => { 7175 exports[className].forEach((item) => { 7176 exports[exportedName].push(item); 6492 rule.walkDecls(/^(composes|compose-with)$/i, (decl) => { 6493 const localNames = getSingleLocalNamesForComposes( 6494 parsedSelector, 6495 decl.parent 6496 ); 6497 const multiple = decl.value.split(","); 6498 6499 multiple.forEach((value) => { 6500 const classes = value.trim().split(/\s+/); 6501 6502 classes.forEach((className) => { 6503 const global = /^global\(([^)]+)\)$/.exec(className); 6504 6505 if (global) { 6506 localNames.forEach((exportedName) => { 6507 exports[exportedName].push(global[1]); 7177 6508 }); 7178 }); 7179 } else { 7180 throw decl.error( 7181 `referenced class name "${className}" in ${decl.prop} not found` 7182 ); 7183 } 6509 } else if (hasOwnProperty.call(importedNames, className)) { 6510 localNames.forEach((exportedName) => { 6511 exports[exportedName].push(className); 6512 }); 6513 } else if (hasOwnProperty.call(exports, className)) { 6514 localNames.forEach((exportedName) => { 6515 exports[className].forEach((item) => { 6516 exports[exportedName].push(item); 6517 }); 6518 }); 6519 } else { 6520 throw decl.error( 6521 `referenced class name "${className}" in ${decl.prop} not found` 6522 ); 6523 } 6524 }); 7184 6525 }); 7185 6526 … … 7231 6572 7232 6573 atRule.params = exportScopedName(localMatch[1]); 6574 }); 6575 6576 root.walkAtRules(/scope$/i, (atRule) => { 6577 if (atRule.params) { 6578 atRule.params = atRule.params 6579 .split("to") 6580 .map((item) => { 6581 const selector = item.trim().slice(1, -1).trim(); 6582 6583 const localMatch = /^\s*:local\s*\((.+?)\)\s*$/.exec(selector); 6584 6585 if (!localMatch) { 6586 return `(${selector})`; 6587 } 6588 6589 let parsedSelector = selectorParser().astSync(selector); 6590 6591 return `(${traverseNode(parsedSelector).toString()})`; 6592 }) 6593 .join(" to "); 6594 } 7233 6595 }); 7234 6596 -
imaps-frontend/node_modules/vite/dist/node/chunks/dep-C6EFp3uH.js
rd565449 r0c6b92a 1 import { B as getDefaultExportFromCjs } from './dep- mCdpKltl.js';1 import { B as getDefaultExportFromCjs } from './dep-CB_7IfJ-.js'; 2 2 import require$$0 from 'path'; 3 3 import require$$0__default from 'fs'; -
imaps-frontend/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js
rd565449 r0c6b92a 10792 10792 charToInt[c] = i; 10793 10793 } 10794 function decodeInteger(reader, relative) { 10795 let value = 0; 10796 let shift = 0; 10797 let integer = 0; 10798 do { 10799 const c = reader.next(); 10800 integer = charToInt[c]; 10801 value |= (integer & 31) << shift; 10802 shift += 5; 10803 } while (integer & 32); 10804 const shouldNegate = value & 1; 10805 value >>>= 1; 10806 if (shouldNegate) { 10807 value = -0x80000000 | -value; 10808 } 10809 return relative + value; 10810 } 10811 function encodeInteger(builder, num, relative) { 10812 let delta = num - relative; 10813 delta = delta < 0 ? (-delta << 1) | 1 : delta << 1; 10814 do { 10815 let clamped = delta & 0b011111; 10816 delta >>>= 5; 10817 if (delta > 0) 10818 clamped |= 0b100000; 10819 builder.write(intToChar[clamped]); 10820 } while (delta > 0); 10821 return num; 10822 } 10823 function hasMoreVlq(reader, max) { 10824 if (reader.pos >= max) 10825 return false; 10826 return reader.peek() !== comma; 10827 } 10828 10829 const bufLength = 1024 * 16; 10794 10830 // Provide a fallback for older environments. 10795 10831 const td = typeof TextDecoder !== 'undefined' … … 10811 10847 }, 10812 10848 }; 10849 class StringWriter { 10850 constructor() { 10851 this.pos = 0; 10852 this.out = ''; 10853 this.buffer = new Uint8Array(bufLength); 10854 } 10855 write(v) { 10856 const { buffer } = this; 10857 buffer[this.pos++] = v; 10858 if (this.pos === bufLength) { 10859 this.out += td.decode(buffer); 10860 this.pos = 0; 10861 } 10862 } 10863 flush() { 10864 const { buffer, out, pos } = this; 10865 return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out; 10866 } 10867 } 10868 class StringReader { 10869 constructor(buffer) { 10870 this.pos = 0; 10871 this.buffer = buffer; 10872 } 10873 next() { 10874 return this.buffer.charCodeAt(this.pos++); 10875 } 10876 peek() { 10877 return this.buffer.charCodeAt(this.pos); 10878 } 10879 indexOf(char) { 10880 const { buffer, pos } = this; 10881 const idx = buffer.indexOf(char, pos); 10882 return idx === -1 ? buffer.length : idx; 10883 } 10884 } 10885 10813 10886 function decode(mappings) { 10814 const state = new Int32Array(5); 10887 const { length } = mappings; 10888 const reader = new StringReader(mappings); 10815 10889 const decoded = []; 10816 let index = 0; 10890 let genColumn = 0; 10891 let sourcesIndex = 0; 10892 let sourceLine = 0; 10893 let sourceColumn = 0; 10894 let namesIndex = 0; 10817 10895 do { 10818 const semi = indexOf(mappings, index);10896 const semi = reader.indexOf(';'); 10819 10897 const line = []; 10820 10898 let sorted = true; 10821 10899 let lastCol = 0; 10822 state[0]= 0;10823 for (let i = index; i < semi; i++) {10900 genColumn = 0; 10901 while (reader.pos < semi) { 10824 10902 let seg; 10825 i = decodeInteger(mappings, i, state, 0); // genColumn 10826 const col = state[0]; 10827 if (col < lastCol) 10903 genColumn = decodeInteger(reader, genColumn); 10904 if (genColumn < lastCol) 10828 10905 sorted = false; 10829 lastCol = col;10830 if (hasMoreVlq( mappings, i, semi)) {10831 i = decodeInteger(mappings, i, state, 1); // sourcesIndex10832 i = decodeInteger(mappings, i, state, 2); // sourceLine10833 i = decodeInteger(mappings, i, state, 3); // sourceColumn10834 if (hasMoreVlq( mappings, i, semi)) {10835 i = decodeInteger(mappings, i, state, 4); // namesIndex10836 seg = [ col, state[1], state[2], state[3], state[4]];10906 lastCol = genColumn; 10907 if (hasMoreVlq(reader, semi)) { 10908 sourcesIndex = decodeInteger(reader, sourcesIndex); 10909 sourceLine = decodeInteger(reader, sourceLine); 10910 sourceColumn = decodeInteger(reader, sourceColumn); 10911 if (hasMoreVlq(reader, semi)) { 10912 namesIndex = decodeInteger(reader, namesIndex); 10913 seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]; 10837 10914 } 10838 10915 else { 10839 seg = [ col, state[1], state[2], state[3]];10916 seg = [genColumn, sourcesIndex, sourceLine, sourceColumn]; 10840 10917 } 10841 10918 } 10842 10919 else { 10843 seg = [ col];10920 seg = [genColumn]; 10844 10921 } 10845 10922 line.push(seg); 10923 reader.pos++; 10846 10924 } 10847 10925 if (!sorted) 10848 10926 sort(line); 10849 10927 decoded.push(line); 10850 index= semi + 1;10851 } while ( index <= mappings.length);10928 reader.pos = semi + 1; 10929 } while (reader.pos <= length); 10852 10930 return decoded; 10853 }10854 function indexOf(mappings, index) {10855 const idx = mappings.indexOf(';', index);10856 return idx === -1 ? mappings.length : idx;10857 }10858 function decodeInteger(mappings, pos, state, j) {10859 let value = 0;10860 let shift = 0;10861 let integer = 0;10862 do {10863 const c = mappings.charCodeAt(pos++);10864 integer = charToInt[c];10865 value |= (integer & 31) << shift;10866 shift += 5;10867 } while (integer & 32);10868 const shouldNegate = value & 1;10869 value >>>= 1;10870 if (shouldNegate) {10871 value = -0x80000000 | -value;10872 }10873 state[j] += value;10874 return pos;10875 }10876 function hasMoreVlq(mappings, i, length) {10877 if (i >= length)10878 return false;10879 return mappings.charCodeAt(i) !== comma;10880 10931 } 10881 10932 function sort(line) { … … 10886 10937 } 10887 10938 function encode$1(decoded) { 10888 const state = new Int32Array(5); 10889 const bufLength = 1024 * 16; 10890 const subLength = bufLength - 36; 10891 const buf = new Uint8Array(bufLength); 10892 const sub = buf.subarray(0, subLength); 10893 let pos = 0; 10894 let out = ''; 10939 const writer = new StringWriter(); 10940 let sourcesIndex = 0; 10941 let sourceLine = 0; 10942 let sourceColumn = 0; 10943 let namesIndex = 0; 10895 10944 for (let i = 0; i < decoded.length; i++) { 10896 10945 const line = decoded[i]; 10897 if (i > 0) { 10898 if (pos === bufLength) { 10899 out += td.decode(buf); 10900 pos = 0; 10901 } 10902 buf[pos++] = semicolon; 10903 } 10946 if (i > 0) 10947 writer.write(semicolon); 10904 10948 if (line.length === 0) 10905 10949 continue; 10906 state[0]= 0;10950 let genColumn = 0; 10907 10951 for (let j = 0; j < line.length; j++) { 10908 10952 const segment = line[j]; 10909 // We can push up to 5 ints, each int can take at most 7 chars, and we10910 // may push a comma.10911 if (pos > subLength) {10912 out += td.decode(sub);10913 buf.copyWithin(0, subLength, pos);10914 pos -= subLength;10915 }10916 10953 if (j > 0) 10917 buf[pos++] = comma;10918 pos = encodeInteger(buf, pos, state, segment, 0); // genColumn10954 writer.write(comma); 10955 genColumn = encodeInteger(writer, segment[0], genColumn); 10919 10956 if (segment.length === 1) 10920 10957 continue; 10921 pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex10922 pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine10923 pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn10958 sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex); 10959 sourceLine = encodeInteger(writer, segment[2], sourceLine); 10960 sourceColumn = encodeInteger(writer, segment[3], sourceColumn); 10924 10961 if (segment.length === 4) 10925 10962 continue; 10926 pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex 10927 } 10928 } 10929 return out + td.decode(buf.subarray(0, pos)); 10930 } 10931 function encodeInteger(buf, pos, state, segment, j) { 10932 const next = segment[j]; 10933 let num = next - state[j]; 10934 state[j] = next; 10935 num = num < 0 ? (-num << 1) | 1 : num << 1; 10936 do { 10937 let clamped = num & 0b011111; 10938 num >>>= 5; 10939 if (num > 0) 10940 clamped |= 0b100000; 10941 buf[pos++] = intToChar[clamped]; 10942 } while (num > 0); 10943 return pos; 10963 namesIndex = encodeInteger(writer, segment[4], namesIndex); 10964 } 10965 } 10966 return writer.flush(); 10944 10967 } 10945 10968 … … 11699 11722 if (typeof content !== 'string') throw new TypeError('replacement content must be a string'); 11700 11723 11701 while (start < 0) start += this.original.length; 11702 while (end < 0) end += this.original.length; 11724 if (this.original.length !== 0) { 11725 while (start < 0) start += this.original.length; 11726 while (end < 0) end += this.original.length; 11727 } 11703 11728 11704 11729 if (end > this.original.length) throw new Error('end is out of bounds'); … … 11796 11821 11797 11822 remove(start, end) { 11798 while (start < 0) start += this.original.length; 11799 while (end < 0) end += this.original.length; 11823 if (this.original.length !== 0) { 11824 while (start < 0) start += this.original.length; 11825 while (end < 0) end += this.original.length; 11826 } 11800 11827 11801 11828 if (start === end) return this; … … 11820 11847 11821 11848 reset(start, end) { 11822 while (start < 0) start += this.original.length; 11823 while (end < 0) end += this.original.length; 11849 if (this.original.length !== 0) { 11850 while (start < 0) start += this.original.length; 11851 while (end < 0) end += this.original.length; 11852 } 11824 11853 11825 11854 if (start === end) return this; … … 11883 11912 11884 11913 slice(start = 0, end = this.original.length) { 11885 while (start < 0) start += this.original.length; 11886 while (end < 0) end += this.original.length; 11914 if (this.original.length !== 0) { 11915 while (start < 0) start += this.original.length; 11916 while (end < 0) end += this.original.length; 11917 } 11887 11918 11888 11919 let result = ''; … … 16020 16051 } 16021 16052 16053 let m; 16054 16022 16055 // Is webkit? http://stackoverflow.com/a/16459606/376773 16023 16056 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 … … 16027 16060 // Is firefox >= v31? 16028 16061 // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages 16029 (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||16062 (typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) || 16030 16063 // Double check webkit in userAgent just in case we are in a worker 16031 16064 (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); … … 16630 16663 invalidatePackageData(packageCache, path$n.normalize(id)); 16631 16664 } 16632 },16633 handleHotUpdate({ file }) {16634 if (file.endsWith("/package.json")) {16635 invalidatePackageData(packageCache, path$n.normalize(file));16636 }16637 16665 } 16638 16666 }; … … 16686 16714 const replaceSlashOrColonRE = /[/:]/g; 16687 16715 const replaceDotRE = /\./g; 16688 const replaceNestedIdRE = / (\s*>\s*)/g;16716 const replaceNestedIdRE = /\s*>\s*/g; 16689 16717 const replaceHashRE = /#/g; 16690 16718 const flattenId = (id) => { … … 17026 17054 for (const file of skip) { 17027 17055 if (path$n.dirname(file) !== ".") { 17028 const matched = file.match(splitFirstDirRE);17056 const matched = splitFirstDirRE.exec(file); 17029 17057 if (matched) { 17030 17058 nested ??= /* @__PURE__ */ new Map(); … … 17111 17139 return realPath; 17112 17140 } 17113 const parseNetUseRE = /^ (\w+)?+(\w:) +([^ ]+)\s/;17141 const parseNetUseRE = /^\w* +(\w:) +([^ ]+)\s/; 17114 17142 let firstSafeRealPathSyncRun = false; 17115 17143 function windowsSafeRealPathSync(path2) { … … 17138 17166 const lines = stdout.split("\n"); 17139 17167 for (const line of lines) { 17140 const m = line.match(parseNetUseRE);17141 if (m) windowsNetworkMap.set(m[ 3], m[2]);17168 const m = parseNetUseRE.exec(line); 17169 if (m) windowsNetworkMap.set(m[2], m[1]); 17142 17170 } 17143 17171 if (windowsNetworkMap.size === 0) { … … 17155 17183 } 17156 17184 } 17157 const escapedSpaceCharacters = /( |\\t|\\n|\\f|\\r)+/g;17185 const escapedSpaceCharacters = /(?: |\\t|\\n|\\f|\\r)+/g; 17158 17186 const imageSetUrlRE = /^(?:[\w\-]+\(.*?\)|'.*?'|".*?"|\S*)/; 17159 17187 function joinSrcset(ret) { … … 17402 17430 ...backwardCompatibleWorkerPlugins(value) 17403 17431 ]; 17432 continue; 17433 } else if (key === "server" && rootPath === "server.hmr") { 17434 merged[key] = value; 17404 17435 continue; 17405 17436 } … … 18191 18222 let lastWildcardIndex = pattern.length; 18192 18223 let hasWildcard = false; 18224 let hasExtension = false; 18225 let hasSlash = false; 18226 let lastSlashIndex = -1; 18193 18227 for (let i = pattern.length - 1; i > -1; i--) { 18194 if (pattern[i] === '*' || pattern[i] === '?') { 18195 lastWildcardIndex = i; 18196 hasWildcard = true; 18228 const c = pattern[i]; 18229 if (!hasWildcard) { 18230 if (c === '*' || c === '?') { 18231 lastWildcardIndex = i; 18232 hasWildcard = true; 18233 } 18234 } 18235 if (!hasSlash) { 18236 if (c === '.') { 18237 hasExtension = true; 18238 } else if (c === '/') { 18239 lastSlashIndex = i; 18240 hasSlash = true; 18241 } 18242 } 18243 if (hasWildcard && hasSlash) { 18197 18244 break; 18198 18245 } 18246 } 18247 if (!hasExtension && (!hasWildcard || lastWildcardIndex < lastSlashIndex)) { 18248 // add implicit glob 18249 pattern += `${pattern.endsWith('/') ? '' : '/'}${GLOB_ALL_PATTERN}`; 18250 lastWildcardIndex = pattern.length - 1; 18251 hasWildcard = true; 18199 18252 } 18200 18253 … … 18235 18288 } 18236 18289 18237 // if no wildcard in pattern, filename must be equal to resolved pattern18238 18290 if (!hasWildcard) { 18291 // no wildcard in pattern, filename must be equal to resolved pattern 18239 18292 return filename === resolvedPattern; 18293 } else if ( 18294 firstWildcardIndex + GLOB_ALL_PATTERN.length === 18295 resolvedPattern.length - (pattern.length - 1 - lastWildcardIndex) && 18296 resolvedPattern.slice(firstWildcardIndex, firstWildcardIndex + GLOB_ALL_PATTERN.length) === 18297 GLOB_ALL_PATTERN 18298 ) { 18299 // singular glob-all pattern and we already validated prefix and suffix matches 18300 return true; 18240 18301 } 18241 18242 18302 // complex pattern, use regex to check it 18243 18303 if (PATTERN_REGEX_CACHE.has(resolvedPattern)) { … … 18296 18356 return JSON.parse( 18297 18357 JSON.stringify(tsconfig) 18298 // replace ${configDir} , accounting for rebaseRelative emitted ../${configDir}18299 .replaceAll(/" (?:\.\.\/)*\${configDir}/g, `"${native2posix(configDir)}`)18358 // replace ${configDir} 18359 .replaceAll(/"\${configDir}/g, `"${native2posix(configDir)}`) 18300 18360 ); 18301 18361 } … … 18891 18951 */ 18892 18952 function rebasePath(value, prependPath) { 18893 if (path$n.isAbsolute(value) ) {18953 if (path$n.isAbsolute(value) || value.startsWith('${configDir}')) { 18894 18954 return value; 18895 18955 } else { … … 19094 19154 19095 19155 const debug$h = createDebugger("vite:esbuild"); 19096 const IIFE_BEGIN_RE = /( const|var)\s+\S+\s*=\s*function\([^()]*\)\s*\{\s*"use strict";/;19156 const IIFE_BEGIN_RE = /(?:const|var)\s+\S+\s*=\s*function\([^()]*\)\s*\{\s*"use strict";/; 19097 19157 const validExtensionRE = /\.\w+$/; 19098 19158 const jsxExtensionsRE = /\.(?:j|t)sx\b/; … … 20276 20336 // Force rollup to keep this module from being shared between other entry points if it's an entrypoint. 20277 20337 // If the resulting chunk is empty, it will be removed in generateBundle. 20278 moduleSideEffects: config.command === "build" && this.getModuleInfo(id)?.isEntry ? "no-treeshake" : false 20338 moduleSideEffects: config.command === "build" && this.getModuleInfo(id)?.isEntry ? "no-treeshake" : false, 20339 meta: config.command === "build" ? { "vite:asset": true } : void 0 20279 20340 }; 20280 20341 }, … … 20293 20354 for (const file in bundle) { 20294 20355 const chunk = bundle[file]; 20295 if (chunk.type === "chunk" && chunk.isEntry && chunk.moduleIds.length === 1 && config.assetsInclude(chunk.moduleIds[0]) ) {20356 if (chunk.type === "chunk" && chunk.isEntry && chunk.moduleIds.length === 1 && config.assetsInclude(chunk.moduleIds[0]) && this.getModuleInfo(chunk.moduleIds[0])?.meta["vite:asset"]) { 20296 20357 delete bundle[file]; 20297 20358 } … … 20314 20375 } 20315 20376 } 20316 function fileToDevUrl(id, config ) {20377 function fileToDevUrl(id, config, skipBase = false) { 20317 20378 let rtn; 20318 20379 if (checkPublicFile(id, config)) { … … 20323 20384 rtn = path$n.posix.join(FS_PREFIX, id); 20324 20385 } 20325 const base = joinUrlSegments(config.server?.origin ?? "", config.base); 20386 if (skipBase) { 20387 return rtn; 20388 } 20389 const base = joinUrlSegments(config.server?.origin ?? "", config.decodedBase); 20326 20390 return joinUrlSegments(base, removeLeadingSlash(rtn)); 20327 20391 } … … 20333 20397 function publicFileToBuiltUrl(url, config) { 20334 20398 if (config.command !== "build") { 20335 return joinUrlSegments(config. base, url);20399 return joinUrlSegments(config.decodedBase, url); 20336 20400 } 20337 20401 const hash = getHash(url); … … 20378 20442 const { search, hash } = parse$h(id); 20379 20443 const postfix = (search || "") + (hash || ""); 20444 const originalFileName = normalizePath$3(path$n.relative(config.root, file)); 20380 20445 const referenceId = pluginContext.emitFile({ 20446 type: "asset", 20381 20447 // Ignore directory structure for asset file names 20382 20448 name: path$n.basename(file), 20383 type: "asset",20449 originalFileName, 20384 20450 source: content 20385 20451 }); 20386 const originalName = normalizePath$3(path$n.relative(config.root, file)); 20387 generatedAssets.get(config).set(referenceId, { originalName }); 20452 generatedAssets.get(config).set(referenceId, { originalFileName }); 20388 20453 url = `__VITE_ASSET__${referenceId}__${postfix ? `$_${postfix}__` : ``}`; 20389 20454 } … … 20496 20561 return manifestChunk; 20497 20562 } 20498 const fileNameToAssetMeta = /* @__PURE__ */ new Map();20499 20563 const assets = generatedAssets.get(config); 20500 assets.forEach((asset, referenceId) => { 20501 try { 20502 const fileName = this.getFileName(referenceId); 20503 fileNameToAssetMeta.set(fileName, asset); 20504 } catch (error) { 20505 assets.delete(referenceId); 20506 } 20507 }); 20564 const entryCssAssetFileNames = /* @__PURE__ */ new Set(); 20565 for (const [id, asset] of assets.entries()) { 20566 if (asset.isEntry) { 20567 try { 20568 const fileName = this.getFileName(id); 20569 entryCssAssetFileNames.add(fileName); 20570 } catch (error) { 20571 assets.delete(id); 20572 } 20573 } 20574 } 20508 20575 const fileNameToAsset = /* @__PURE__ */ new Map(); 20509 20576 for (const file in bundle) { … … 20512 20579 manifest[getChunkName(chunk)] = createChunk(chunk); 20513 20580 } else if (chunk.type === "asset" && typeof chunk.name === "string") { 20514 const assetMeta = fileNameToAssetMeta.get(chunk.fileName);20515 const src = assetMeta?.originalName ?? chunk.name;20516 const asset = createAsset(chunk, src, assetMeta?.isEntry);20581 const src = chunk.originalFileName ?? chunk.name; 20582 const isEntry = entryCssAssetFileNames.has(chunk.fileName); 20583 const asset = createAsset(chunk, src, isEntry); 20517 20584 const file2 = manifest[src]?.file; 20518 20585 if (file2 && endsWithJSRE.test(file2)) continue; … … 20521 20588 } 20522 20589 } 20523 assets.forEach(({ originalName }, referenceId) =>{20524 if (!manifest[original Name]) {20590 for (const [referenceId, { originalFileName }] of assets.entries()) { 20591 if (!manifest[originalFileName]) { 20525 20592 const fileName = this.getFileName(referenceId); 20526 20593 const asset = fileNameToAsset.get(fileName); 20527 20594 if (asset) { 20528 manifest[original Name] = asset;20595 manifest[originalFileName] = asset; 20529 20596 } 20530 20597 } 20531 } );20598 } 20532 20599 outputCount++; 20533 20600 const output = config.build.rollupOptions?.output; … … 20568 20635 }, 20569 20636 resolveId(id) { 20570 if (! dataUriRE.test(id)) {20637 if (!id.trimStart().startsWith("data:")) { 20571 20638 return; 20572 20639 } … … 20575 20642 return; 20576 20643 } 20577 const match = uri.pathname.match(dataUriRE);20644 const match = dataUriRE.exec(uri.pathname); 20578 20645 if (!match) { 20579 20646 return; … … 22732 22799 const picomatch$2 = picomatch$3; 22733 22800 const utils$b = utils$k; 22734 const isEmptyString = val => val === '' || val === './'; 22801 22802 const isEmptyString = v => v === '' || v === './'; 22803 const hasBraces = v => { 22804 const index = v.indexOf('{'); 22805 return index > -1 && v.indexOf('}', index) > -1; 22806 }; 22735 22807 22736 22808 /** … … 23173 23245 micromatch$1.braces = (pattern, options) => { 23174 23246 if (typeof pattern !== 'string') throw new TypeError('Expected a string'); 23175 if ((options && options.nobrace === true) || ! /\{.*\}/.test(pattern)) {23247 if ((options && options.nobrace === true) || !hasBraces(pattern)) { 23176 23248 return [pattern]; 23177 23249 } … … 23192 23264 */ 23193 23265 23266 // exposed for tests 23267 micromatch$1.hasBraces = hasBraces; 23194 23268 var micromatch_1 = micromatch$1; 23195 23269 … … 27038 27112 } 27039 27113 } 27040 Collection.maxFlowStringSingleLineLength = 60;27041 27114 27042 27115 /** … … 27070 27143 if (!lineWidth || lineWidth < 0) 27071 27144 return text; 27145 if (lineWidth < minContentWidth) 27146 minContentWidth = 0; 27072 27147 const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length); 27073 27148 if (text.length <= endStep) … … 29642 29717 let commentSep = ''; 29643 29718 let hasNewline = false; 29644 let hasNewlineAfterProp = false;29645 29719 let reqSpace = false; 29646 29720 let tab = null; 29647 29721 let anchor = null; 29648 29722 let tag = null; 29723 let newlineAfterProp = null; 29649 29724 let comma = null; 29650 29725 let found = null; … … 29700 29775 hasNewline = true; 29701 29776 if (anchor || tag) 29702 hasNewlineAfterProp = true;29777 newlineAfterProp = token; 29703 29778 hasSpace = true; 29704 29779 break; … … 29774 29849 comment, 29775 29850 hasNewline, 29776 hasNewlineAfterProp,29777 29851 anchor, 29778 29852 tag, 29853 newlineAfterProp, 29779 29854 end, 29780 29855 start: start ?? end … … 29878 29953 continue; 29879 29954 } 29880 if (keyProps. hasNewlineAfterProp || containsNewline(key)) {29955 if (keyProps.newlineAfterProp || containsNewline(key)) { 29881 29956 onError(key ?? start[start.length - 1], 'MULTILINE_IMPLICIT_KEY', 'Implicit keys need to be on a single line'); 29882 29957 } … … 30232 30307 return coll; 30233 30308 } 30234 function composeCollection(CN, ctx, token, tagToken, onError) { 30309 function composeCollection(CN, ctx, token, props, onError) { 30310 const tagToken = props.tag; 30235 30311 const tagName = !tagToken 30236 30312 ? null 30237 30313 : ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg)); 30314 if (token.type === 'block-seq') { 30315 const { anchor, newlineAfterProp: nl } = props; 30316 const lastProp = anchor && tagToken 30317 ? anchor.offset > tagToken.offset 30318 ? anchor 30319 : tagToken 30320 : (anchor ?? tagToken); 30321 if (lastProp && (!nl || nl.offset < lastProp.offset)) { 30322 const message = 'Missing newline after block sequence props'; 30323 onError(lastProp, 'MISSING_CHAR', message); 30324 } 30325 } 30238 30326 const expType = token.type === 'block-map' 30239 30327 ? 'map' … … 30249 30337 tagName === '!' || 30250 30338 (tagName === YAMLMap.tagName && expType === 'map') || 30251 (tagName === YAMLSeq.tagName && expType === 'seq') || 30252 !expType) { 30339 (tagName === YAMLSeq.tagName && expType === 'seq')) { 30253 30340 return resolveCollection(CN, ctx, token, onError, tagName); 30254 30341 } … … 30818 30905 case 'block-seq': 30819 30906 case 'flow-collection': 30820 node = composeCollection(CN, ctx, token, tag, onError);30907 node = composeCollection(CN, ctx, token, props, onError); 30821 30908 if (anchor) 30822 30909 node.anchor = anchor.source.substring(1); … … 31890 31977 return this.setNext('line-start'); 31891 31978 const s = this.peek(3); 31892 if ( s === '---'&& isEmpty(this.charAt(3))) {31979 if ((s === '---' || s === '...') && isEmpty(this.charAt(3))) { 31893 31980 yield* this.pushCount(3); 31894 31981 this.indentValue = 0; 31895 31982 this.indentNext = 0; 31896 return 'doc'; 31897 } 31898 else if (s === '...' && isEmpty(this.charAt(3))) { 31899 yield* this.pushCount(3); 31900 return 'stream'; 31983 return s === '---' ? 'doc' : 'stream'; 31901 31984 } 31902 31985 } … … 32416 32499 break loop; 32417 32500 } 32418 }32419 while (prev[++i]?.type === 'space') {32420 /* loop */32421 32501 } 32422 32502 return prev.splice(i, prev.length); … … 34926 35006 } 34927 35007 34928 const htmlProxyRE$1 = /\?html-proxy=?(?:&inline-css)?(?:&style-attr)?&index=(\d+)\.( js|css)$/;35008 const htmlProxyRE$1 = /\?html-proxy=?(?:&inline-css)?(?:&style-attr)?&index=(\d+)\.(?:js|css)$/; 34929 35009 const isHtmlProxyRE = /\?html-proxy\b/; 34930 35010 const inlineCSSRE$1 = /__VITE_INLINE_CSS__([a-z\d]{8}_\d+)__/g; … … 34953 35033 }, 34954 35034 load(id) { 34955 const proxyMatch = id.match(htmlProxyRE$1);35035 const proxyMatch = htmlProxyRE$1.exec(id); 34956 35036 if (proxyMatch) { 34957 35037 const index = Number(proxyMatch[1]); … … 34999 35079 } 35000 35080 function traverseNodes(node, visitor) { 35081 if (node.nodeName === "template") { 35082 node = node.content; 35083 } 35001 35084 visitor(node); 35002 35085 if (nodeIsElement(node) || node.nodeName === "#document" || node.nodeName === "#document-fragment") { … … 35042 35125 sourceCodeLocation.endOffset 35043 35126 ); 35044 const valueStart = srcString.match(attrValueStartRE);35127 const valueStart = attrValueStartRE.exec(srcString); 35045 35128 if (!valueStart) { 35046 35129 throw new Error( … … 35110 35193 if (id.endsWith(".html")) { 35111 35194 id = normalizePath$3(id); 35112 const relativeUrlPath = path$n.posix.relative(config.root, id);35195 const relativeUrlPath = normalizePath$3(path$n.relative(config.root, id)); 35113 35196 const publicPath = `/${relativeUrlPath}`; 35114 35197 const publicBase = getBaseInHTML(relativeUrlPath, config); … … 35444 35527 }; 35445 35528 for (const [normalizedId, html] of processedHtml) { 35446 const relativeUrlPath = path$n.posix.relative(config.root, normalizedId); 35529 const relativeUrlPath = normalizePath$3( 35530 path$n.relative(config.root, normalizedId) 35531 ); 35447 35532 const assetsBase = getBaseInHTML(relativeUrlPath, config); 35448 35533 const toOutputFilePath = (filename, type) => { … … 35560 35645 this.emitFile({ 35561 35646 type: "asset", 35647 originalFileName: normalizedId, 35562 35648 fileName: shortEmitName, 35563 35649 source: result … … 35828 35914 return html; 35829 35915 } 35830 const importRE = /\bimport\s*( "[^"]*[^\\]"|'[^']*[^\\]');*/g;35916 const importRE = /\bimport\s*(?:"[^"]*[^\\]"|'[^']*[^\\]');*/g; 35831 35917 const commentRE$1 = /\/\*[\s\S]*?\*\/|\/\/.*$/gm; 35832 35918 function isEntirelyImport(code) { … … 35981 36067 const functionCallRE = /^[A-Z_][\w-]*\(/i; 35982 36068 const transformOnlyRE = /[?&]transform-only\b/; 35983 const nonEscapedDoubleQuoteRe = /(?<!\\) (")/g;36069 const nonEscapedDoubleQuoteRe = /(?<!\\)"/g; 35984 36070 const cssBundleName = "style.css"; 35985 36071 const isCSSRequest = (request) => CSS_LANGS_RE.test(request); … … 36122 36208 return path$n.dirname( 36123 36209 assetFileNames({ 36210 type: "asset", 36124 36211 name: cssAssetName, 36125 type: "asset",36212 originalFileName: null, 36126 36213 source: "/* vite internal call, ignore */" 36127 36214 }) … … 36241 36328 const cssAssetDirname = encodedPublicUrls || relative ? slash$1(getCssAssetDirname(cssAssetName)) : void 0; 36242 36329 const toRelative = (filename) => { 36243 const relativePath = path$n.posix.relative(cssAssetDirname, filename); 36330 const relativePath = normalizePath$3( 36331 path$n.relative(cssAssetDirname, filename) 36332 ); 36244 36333 return relativePath[0] === "." ? relativePath : "./" + relativePath; 36245 36334 }; … … 36259 36348 }); 36260 36349 if (encodedPublicUrls) { 36261 const relativePathToPublicFromCSS = path$n.posix.relative( 36262 cssAssetDirname, 36263 "" 36350 const relativePathToPublicFromCSS = normalizePath$3( 36351 path$n.relative(cssAssetDirname, "") 36264 36352 ); 36265 36353 chunkCSS2 = chunkCSS2.replace(publicAssetUrlRE, (_, hash) => { … … 36292 36380 const [full, idHex] = match; 36293 36381 const id = Buffer.from(idHex, "hex").toString(); 36294 const originalFile name = cleanUrl(id);36382 const originalFileName = cleanUrl(id); 36295 36383 const cssAssetName = ensureFileExt( 36296 path$n.basename(originalFile name),36384 path$n.basename(originalFileName), 36297 36385 ".css" 36298 36386 ); … … 36306 36394 urlEmitTasks.push({ 36307 36395 cssAssetName, 36308 originalFile name,36396 originalFileName, 36309 36397 content: cssContent, 36310 36398 start: match.index, … … 36328 36416 for (const { 36329 36417 cssAssetName, 36330 originalFile name,36418 originalFileName, 36331 36419 content, 36332 36420 start, … … 36334 36422 } of urlEmitTasks) { 36335 36423 const referenceId = this.emitFile({ 36424 type: "asset", 36336 36425 name: cssAssetName, 36337 type: "asset",36426 originalFileName, 36338 36427 source: content 36339 36428 }); 36340 generatedAssets.get(config).set(referenceId, { original Name: originalFilename });36429 generatedAssets.get(config).set(referenceId, { originalFileName }); 36341 36430 const filename = this.getFileName(referenceId); 36342 36431 chunk.viteMetadata.importedAssets.add(cleanUrl(filename)); … … 36362 36451 const cssFullAssetName = ensureFileExt(chunk.name, ".css"); 36363 36452 const cssAssetName = chunk.isEntry && (!chunk.facadeModuleId || !isCSSRequest(chunk.facadeModuleId)) ? path$n.basename(cssFullAssetName) : cssFullAssetName; 36364 const originalFile name = getChunkOriginalFileName(36453 const originalFileName = getChunkOriginalFileName( 36365 36454 chunk, 36366 36455 config.root, … … 36372 36461 }); 36373 36462 const referenceId = this.emitFile({ 36463 type: "asset", 36374 36464 name: cssAssetName, 36375 type: "asset",36465 originalFileName, 36376 36466 source: chunkCSS 36377 36467 }); 36378 generatedAssets.get(config).set(referenceId, { original Name: originalFilename, isEntry });36468 generatedAssets.get(config).set(referenceId, { originalFileName, isEntry }); 36379 36469 chunk.viteMetadata.importedCss.add(this.getFileName(referenceId)); 36380 36470 } else if (!config.build.ssr) { … … 36504 36594 }); 36505 36595 } 36596 const cssAssets = Object.values(bundle).filter( 36597 (asset) => asset.type === "asset" && asset.fileName.endsWith(".css") 36598 ); 36599 for (const cssAsset of cssAssets) { 36600 if (typeof cssAsset.source === "string") { 36601 cssAsset.source = cssAsset.source.replace(viteHashUpdateMarkerRE, ""); 36602 } 36603 } 36506 36604 } 36507 36605 }; … … 36526 36624 if (pluginImports) { 36527 36625 const depModules = /* @__PURE__ */ new Set(); 36528 const devBase = config.base;36529 36626 for (const file of pluginImports) { 36530 36627 depModules.add( 36531 36628 isCSSRequest(file) ? moduleGraph.createFileOnlyEntry(file) : await moduleGraph.ensureEntryFromUrl( 36532 stripBase( 36533 await fileToUrl$1(file, config, this), 36534 (config.server?.origin ?? "") + devBase 36629 fileToDevUrl( 36630 file, 36631 config, 36632 /* skipBase */ 36633 true 36535 36634 ), 36536 36635 ssr … … 36583 36682 }, 36584 36683 get sass() { 36585 return sassResolve || (sassResolve = config.createResolver({ 36586 extensions: [".scss", ".sass", ".css"], 36587 mainFields: ["sass", "style"], 36588 conditions: ["sass", "style"], 36589 tryIndex: true, 36590 tryPrefix: "_", 36591 preferRelative: true 36592 })); 36684 if (!sassResolve) { 36685 const resolver = config.createResolver({ 36686 extensions: [".scss", ".sass", ".css"], 36687 mainFields: ["sass", "style"], 36688 conditions: ["sass", "style"], 36689 tryIndex: true, 36690 tryPrefix: "_", 36691 preferRelative: true 36692 }); 36693 sassResolve = async (...args) => { 36694 if (args[0].startsWith("file://")) { 36695 args[0] = fileURLToPath(args[0]); 36696 } 36697 return resolver(...args); 36698 }; 36699 } 36700 return sassResolve; 36593 36701 }, 36594 36702 get less() { … … 36676 36784 const needInlineImport = code.includes("@import"); 36677 36785 const hasUrl = cssUrlRE.test(code) || cssImageSetRE.test(code); 36678 const lang = id.match(CSS_LANGS_RE)?.[1];36786 const lang = CSS_LANGS_RE.exec(id)?.[1]; 36679 36787 const postcssConfig = await resolvePostcssConfig(config); 36680 36788 if (lang === "css" && !postcssConfig && !isModule && !needInlineImport && !hasUrl) { … … 36725 36833 async load(id2) { 36726 36834 const code2 = await fs__default.promises.readFile(id2, "utf-8"); 36727 const lang2 = id2.match(CSS_LANGS_RE)?.[1];36835 const lang2 = CSS_LANGS_RE.exec(id2)?.[1]; 36728 36836 if (isPreProcessor(lang2)) { 36729 36837 const result = await compileCSSPreprocessors( … … 36883 36991 }; 36884 36992 } 36885 const importPostcssImport = createCachedImport(() => import('./dep- VqAwxVIc.js').then(function (n) { return n.i; }));36886 const importPostcssModules = createCachedImport(() => import('./dep- CjZz522d.js').then(function (n) { return n.i; }));36993 const importPostcssImport = createCachedImport(() => import('./dep-C6EFp3uH.js').then(function (n) { return n.i; })); 36994 const importPostcssModules = createCachedImport(() => import('./dep-Ba1kN6Mp.js').then(function (n) { return n.i; })); 36887 36995 const importPostcss = createCachedImport(() => import('postcss')); 36888 36996 const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap(); … … 36922 37030 ]) : map1; 36923 37031 } 37032 const viteHashUpdateMarker = "/*$vite$:1*/"; 37033 const viteHashUpdateMarkerRE = /\/\*\$vite\$:\d+\*\//; 36924 37034 async function finalizeCss(css, minify, config) { 36925 37035 if (css.includes("@import") || css.includes("@charset")) { … … 36929 37039 css = await minifyCSS(css, config, false); 36930 37040 } 37041 css += viteHashUpdateMarker; 36931 37042 return css; 36932 37043 } … … 37191 37302 } 37192 37303 } 37304 function loadSassPackage(root) { 37305 try { 37306 const path2 = loadPreprocessorPath("sass-embedded", root); 37307 return { name: "sass-embedded", path: path2 }; 37308 } catch (e1) { 37309 try { 37310 const path2 = loadPreprocessorPath("sass" /* sass */, root); 37311 return { name: "sass", path: path2 }; 37312 } catch (e2) { 37313 throw e1; 37314 } 37315 } 37316 } 37193 37317 let cachedSss; 37194 37318 function loadSss(root) { … … 37218 37342 return data; 37219 37343 } 37220 const makeScssWorker = (resolvers, alias, maxWorkers ) => {37344 const makeScssWorker = (resolvers, alias, maxWorkers, packageName) => { 37221 37345 const internalImporter = async (url, importer, filename) => { 37222 37346 importer = cleanScssBugUrl(importer); … … 37231 37355 resolvers.sass 37232 37356 ); 37357 if (packageName === "sass-embedded") { 37358 return data; 37359 } 37233 37360 return fixScssBugImportValue(data); 37234 37361 } catch (data) { … … 37288 37415 return worker; 37289 37416 }; 37417 const makeModernScssWorker = (resolvers, alias, maxWorkers) => { 37418 const internalCanonicalize = async (url, importer) => { 37419 importer = cleanScssBugUrl(importer); 37420 const resolved = await resolvers.sass(url, importer); 37421 return resolved ?? null; 37422 }; 37423 const internalLoad = async (file, rootFile) => { 37424 const result = await rebaseUrls(file, rootFile, alias, "$", resolvers.sass); 37425 if (result.contents) { 37426 return result.contents; 37427 } 37428 return await fsp.readFile(result.file, "utf-8"); 37429 }; 37430 const worker = new WorkerWithFallback( 37431 () => async (sassPath, data, options) => { 37432 const sass = require(sassPath); 37433 const path2 = require("node:path"); 37434 const { fileURLToPath: fileURLToPath2, pathToFileURL: pathToFileURL2 } = ( 37435 // eslint-disable-next-line no-restricted-globals 37436 require("node:url") 37437 ); 37438 const sassOptions = { ...options }; 37439 sassOptions.url = pathToFileURL2(options.filename); 37440 sassOptions.sourceMap = options.enableSourcemap; 37441 const internalImporter = { 37442 async canonicalize(url, context) { 37443 const importer = context.containingUrl ? fileURLToPath2(context.containingUrl) : options.filename; 37444 const resolved = await internalCanonicalize(url, importer); 37445 return resolved ? pathToFileURL2(resolved) : null; 37446 }, 37447 async load(canonicalUrl) { 37448 const ext = path2.extname(canonicalUrl.pathname); 37449 let syntax = "scss"; 37450 if (ext === ".sass") { 37451 syntax = "indented"; 37452 } else if (ext === ".css") { 37453 syntax = "css"; 37454 } 37455 const contents = await internalLoad( 37456 fileURLToPath2(canonicalUrl), 37457 options.filename 37458 ); 37459 return { contents, syntax, sourceMapUrl: canonicalUrl }; 37460 } 37461 }; 37462 sassOptions.importers = [ 37463 ...sassOptions.importers ?? [], 37464 internalImporter 37465 ]; 37466 const result = await sass.compileStringAsync(data, sassOptions); 37467 return { 37468 css: result.css, 37469 map: result.sourceMap ? JSON.stringify(result.sourceMap) : void 0, 37470 stats: { 37471 includedFiles: result.loadedUrls.filter((url) => url.protocol === "file:").map((url) => fileURLToPath2(url)) 37472 } 37473 }; 37474 }, 37475 { 37476 parentFunctions: { 37477 internalCanonicalize, 37478 internalLoad 37479 }, 37480 shouldUseFake(_sassPath, _data, options) { 37481 return !!(options.functions && Object.keys(options.functions).length > 0 || options.importers && (!Array.isArray(options.importers) || options.importers.length > 0)); 37482 }, 37483 max: maxWorkers 37484 } 37485 ); 37486 return worker; 37487 }; 37488 const makeModernCompilerScssWorker = (resolvers, alias, _maxWorkers) => { 37489 let compilerPromise; 37490 const worker = { 37491 async run(sassPath, data, options) { 37492 const sass = (await import(pathToFileURL(sassPath).href)).default; 37493 compilerPromise ??= sass.initAsyncCompiler(); 37494 const compiler = await compilerPromise; 37495 const sassOptions = { ...options }; 37496 sassOptions.url = pathToFileURL(options.filename); 37497 sassOptions.sourceMap = options.enableSourcemap; 37498 const internalImporter = { 37499 async canonicalize(url, context) { 37500 const importer = context.containingUrl ? fileURLToPath(context.containingUrl) : options.filename; 37501 const resolved = await resolvers.sass(url, cleanScssBugUrl(importer)); 37502 return resolved ? pathToFileURL(resolved) : null; 37503 }, 37504 async load(canonicalUrl) { 37505 const ext = path$n.extname(canonicalUrl.pathname); 37506 let syntax = "scss"; 37507 if (ext === ".sass") { 37508 syntax = "indented"; 37509 } else if (ext === ".css") { 37510 syntax = "css"; 37511 } 37512 const result2 = await rebaseUrls( 37513 fileURLToPath(canonicalUrl), 37514 options.filename, 37515 alias, 37516 "$", 37517 resolvers.sass 37518 ); 37519 const contents = result2.contents ?? await fsp.readFile(result2.file, "utf-8"); 37520 return { contents, syntax, sourceMapUrl: canonicalUrl }; 37521 } 37522 }; 37523 sassOptions.importers = [ 37524 ...sassOptions.importers ?? [], 37525 internalImporter 37526 ]; 37527 const result = await compiler.compileStringAsync(data, sassOptions); 37528 return { 37529 css: result.css, 37530 map: result.sourceMap ? JSON.stringify(result.sourceMap) : void 0, 37531 stats: { 37532 includedFiles: result.loadedUrls.filter((url) => url.protocol === "file:").map((url) => fileURLToPath(url)) 37533 } 37534 }; 37535 }, 37536 async stop() { 37537 (await compilerPromise)?.dispose(); 37538 compilerPromise = void 0; 37539 } 37540 }; 37541 return worker; 37542 }; 37290 37543 const scssProcessor = (maxWorkers) => { 37291 37544 const workerMap = /* @__PURE__ */ new Map(); … … 37297 37550 }, 37298 37551 async process(source, root, options, resolvers) { 37299 const sassPath = loadPreprocessorPath("sass" /* sass */, root); 37552 const sassPackage = loadSassPackage(root); 37553 const api = options.api ?? "legacy"; 37300 37554 if (!workerMap.has(options.alias)) { 37301 37555 workerMap.set( 37302 37556 options.alias, 37303 makeScssWorker(resolvers, options.alias, maxWorkers) 37557 api === "modern-compiler" ? makeModernCompilerScssWorker(resolvers, options.alias) : api === "modern" ? makeModernScssWorker(resolvers, options.alias, maxWorkers) : makeScssWorker( 37558 resolvers, 37559 options.alias, 37560 maxWorkers, 37561 sassPackage.name 37562 ) 37304 37563 ); 37305 37564 } … … 37317 37576 try { 37318 37577 const result = await worker.run( 37319 sassPa th,37578 sassPackage.path, 37320 37579 data, 37321 37580 optionsWithoutAdditionalData … … 37323 37582 const deps = result.stats.includedFiles.map((f) => cleanScssBugUrl(f)); 37324 37583 const map2 = result.map ? JSON.parse(result.map.toString()) : void 0; 37584 if (map2) { 37585 map2.sources = map2.sources.map( 37586 (url) => url.startsWith("file://") ? normalizePath$3(fileURLToPath(url)) : url 37587 ); 37588 } 37325 37589 return { 37326 37590 code: result.css.toString(), … … 37652 37916 source, 37653 37917 root, 37654 { ...options, indentedSyntax: true },37918 { ...options, indentedSyntax: true, syntax: "indented" }, 37655 37919 resolvers 37656 37920 ); … … 37740 38004 deps.add(dep.url); 37741 38005 if (urlReplacer) { 37742 const replaceUrl = await urlReplacer(dep.url, id); 38006 const replaceUrl = await urlReplacer( 38007 dep.url, 38008 toAbsolute(dep.loc.filePath) 38009 ); 37743 38010 css = css.replace(dep.placeholder, () => replaceUrl); 37744 38011 } else { … … 37809 38076 const targets = {}; 37810 38077 const entriesWithoutES = arraify(esbuildTarget).flatMap((e) => { 37811 const match = e .match(esRE);38078 const match = esRE.exec(e); 37812 38079 if (!match) return e; 37813 38080 const year = Number(match[1]); … … 44839 45106 emacs: 'emacs', 44840 45107 gvim: 'gvim', 45108 idea: 'idea', 44841 45109 'idea.sh': 'idea', 45110 phpstorm: 'phpstorm', 44842 45111 'phpstorm.sh': 'phpstorm', 45112 pycharm: 'pycharm', 44843 45113 'pycharm.sh': 'pycharm', 45114 rubymine: 'rubymine', 44844 45115 'rubymine.sh': 'rubymine', 44845 45116 sublime_text: 'subl', 44846 45117 vim: 'vim', 45118 webstorm: 'webstorm', 44847 45119 'webstorm.sh': 'webstorm', 45120 goland: 'goland', 44848 45121 'goland.sh': 'goland', 45122 rider: 'rider', 44849 45123 'rider.sh': 'rider' 44850 45124 }; … … 45156 45430 } 45157 45431 45158 // cmd.exe on Windows is vulnerable to RCE attacks given a file name of the45159 // form "C:\Users\myusername\Downloads\& curl 172.21.93.52". Use a safe file45160 // name pattern to validate user-provided file names. This doesn't cover the45161 // entire range of valid file names but should cover almost all of them in practice.45162 // (Backport of45163 // https://github.com/facebook/create-react-app/pull/486645164 // and45165 // https://github.com/facebook/create-react-app/pull/5431)45166 45167 // Allows alphanumeric characters, periods, dashes, slashes, and underscores.45168 const WINDOWS_CMD_SAFE_FILE_NAME_PATTERN = /^([A-Za-z]:[/\\])?[\p{L}0-9/.\-_\\]+$/u;45169 if (45170 process.platform === 'win32' &&45171 !WINDOWS_CMD_SAFE_FILE_NAME_PATTERN.test(fileName.trim())45172 ) {45173 console.log();45174 console.log(45175 colors.red('Could not open ' + path$5.basename(fileName) + ' in the editor.')45176 );45177 console.log();45178 console.log(45179 'When running on Windows, file names are checked against a safe file name ' +45180 'pattern to protect against remote code execution attacks. File names ' +45181 'may consist only of alphanumeric characters (all languages), periods, ' +45182 'dashes, slashes, and underscores.'45183 );45184 console.log();45185 return45186 }45187 45188 45432 if (lineNumber) { 45189 45433 const extraArgs = getArgumentsForPosition(editor, fileName, lineNumber, columnNumber); … … 45201 45445 45202 45446 if (process.platform === 'win32') { 45203 // On Windows, launch the editor in a shell because spawn can only 45204 // launch .exe files. 45205 _childProcess = childProcess$1.spawn( 45206 'cmd.exe', 45207 ['/C', editor].concat(args), 45208 { stdio: 'inherit' } 45209 ); 45447 // On Windows, we need to use `exec` with the `shell: true` option, 45448 // and some more sanitization is required. 45449 45450 // However, CMD.exe on Windows is vulnerable to RCE attacks given a file name of the 45451 // form "C:\Users\myusername\Downloads\& curl 172.21.93.52". 45452 // `create-react-app` used a safe file name pattern to validate user-provided file names: 45453 // - https://github.com/facebook/create-react-app/pull/4866 45454 // - https://github.com/facebook/create-react-app/pull/5431 45455 // But that's not a viable solution for this package because 45456 // it's depended on by so many meta frameworks that heavily rely on 45457 // special characters in file names for filesystem-based routing. 45458 // We need to at least: 45459 // - Support `+` because it's used in SvelteKit and Vike 45460 // - Support `$` because it's used in Remix 45461 // - Support `(` and `)` because they are used in Analog, SolidStart, and Vike 45462 // - Support `@` because it's used in Vike 45463 // - Support `[` and `]` because they are widely used for [slug] 45464 // So here we choose to use `^` to escape special characters instead. 45465 45466 // According to https://ss64.com/nt/syntax-esc.html, 45467 // we can use `^` to escape `&`, `<`, `>`, `|`, `%`, and `^` 45468 // I'm not sure if we have to escape all of these, but let's do it anyway 45469 function escapeCmdArgs (cmdArgs) { 45470 return cmdArgs.replace(/([&|<>,;=^])/g, '^$1') 45471 } 45472 45473 // Need to double quote the editor path in case it contains spaces; 45474 // If the fileName contains spaces, we also need to double quote it in the arguments 45475 // However, there's a case that it's concatenated with line number and column number 45476 // which is separated by `:`. We need to double quote the whole string in this case. 45477 // Also, if the string contains the escape character `^`, it needs to be quoted, too. 45478 function doubleQuoteIfNeeded(str) { 45479 if (str.includes('^')) { 45480 // If a string includes an escaped character, not only does it need to be quoted, 45481 // but the quotes need to be escaped too. 45482 return `^"${str}^"` 45483 } else if (str.includes(' ')) { 45484 return `"${str}"` 45485 } 45486 return str 45487 } 45488 const launchCommand = [editor, ...args.map(escapeCmdArgs)] 45489 .map(doubleQuoteIfNeeded) 45490 .join(' '); 45491 45492 _childProcess = childProcess$1.exec(launchCommand, { 45493 stdio: 'inherit', 45494 shell: true 45495 }); 45210 45496 } else { 45211 45497 _childProcess = childProcess$1.spawn(editor, args, { stdio: 'inherit' }); … … 45331 45617 logger.warn( 45332 45618 colors$1.yellow( 45333 "Server responded with status code 431. See https://vite js.dev/guide/troubleshooting.html#_431-request-header-fields-too-large."45619 "Server responded with status code 431. See https://vite.dev/guide/troubleshooting.html#_431-request-header-fields-too-large." 45334 45620 ) 45335 45621 ); … … 45355 45641 let fsUtils = cachedFsUtilsMap.get(config); 45356 45642 if (!fsUtils) { 45357 if (config.command !== "serve" || config.server.fs.cachedChecks === false || config.server.watch?.ignored || process.versions.pnp) {45643 if (config.command !== "serve" || config.server.fs.cachedChecks !== true || config.server.watch?.ignored || process.versions.pnp) { 45358 45644 fsUtils = commonFsUtils; 45359 45645 } else if (!config.resolve.preserveSymlinks && config.root !== getRealPath(config.root)) { … … 45946 46232 } else if (isProduction) { 45947 46233 this.warn( 45948 `Module "${id}" has been externalized for browser compatibility, imported by "${importer}". See https://vite js.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.`46234 `Module "${id}" has been externalized for browser compatibility, imported by "${importer}". See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.` 45949 46235 ); 45950 46236 } … … 45963 46249 return `export default new Proxy({}, { 45964 46250 get(_, key) { 45965 throw new Error(\`Module "${id}" has been externalized for browser compatibility. Cannot access "${id}.\${key}" in client code. See https://vite js.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.\`)46251 throw new Error(\`Module "${id}" has been externalized for browser compatibility. Cannot access "${id}.\${key}" in client code. See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.\`) 45966 46252 } 45967 46253 })`; … … 46126 46412 function tryNodeResolve(id, importer, options, targetWeb, depsOptimizer, ssr = false, externalize, allowLinkedExternal = true) { 46127 46413 const { root, dedupe, isBuild, preserveSymlinks, packageCache } = options; 46128 const deepMatch = id.match(deepImportRE);46414 const deepMatch = deepImportRE.exec(id); 46129 46415 const pkgId = deepMatch ? deepMatch[1] || deepMatch[2] : cleanUrl(id); 46130 46416 let basedir; … … 46702 46988 key !== 'splice' 46703 46989 ) { 46704 console.warn(\`Module "${path2}" has been externalized for browser compatibility. Cannot access "${path2}.\${key}" in client code. See https://vite js.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.\`)46990 console.warn(\`Module "${path2}" has been externalized for browser compatibility. Cannot access "${path2}.\${key}" in client code. See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.\`) 46705 46991 } 46706 46992 } … … 46929 47215 const metadata = depsOptimizer.metadata; 46930 47216 const file = cleanUrl(id); 46931 const versionMatch = id.match(DEP_VERSION_RE);47217 const versionMatch = DEP_VERSION_RE.exec(file); 46932 47218 const browserHash = versionMatch ? versionMatch[1].split("=")[1] : void 0; 46933 47219 const info = optimizedDepInfoFromFile(metadata, file); … … 46987 47273 const nonJsRe = /\.json(?:$|\?)/; 46988 47274 const isNonJsRequest = (request) => nonJsRe.test(request); 47275 const importMetaEnvMarker = "__vite_import_meta_env__"; 47276 const importMetaEnvKeyReCache = /* @__PURE__ */ new Map(); 46989 47277 function definePlugin(config) { 46990 47278 const isBuild = config.command === "build"; … … 47035 47323 } 47036 47324 if ("import.meta.env" in define) { 47037 define["import.meta.env"] = serializeDefine({ 47038 ...importMetaEnvKeys, 47039 SSR: ssr + "", 47040 ...userDefineEnv 47041 }); 47042 } 47325 define["import.meta.env"] = importMetaEnvMarker; 47326 } 47327 const importMetaEnvVal = serializeDefine({ 47328 ...importMetaEnvKeys, 47329 SSR: ssr + "", 47330 ...userDefineEnv 47331 }); 47043 47332 const patternKeys = Object.keys(userDefine); 47044 47333 if (replaceProcessEnv && Object.keys(processEnv).length) { … … 47049 47338 } 47050 47339 const pattern = patternKeys.length ? new RegExp(patternKeys.map(escapeRegex).join("|")) : null; 47051 return [define, pattern ];47340 return [define, pattern, importMetaEnvVal]; 47052 47341 } 47053 47342 const defaultPattern = generatePattern(false); … … 47066 47355 return; 47067 47356 } 47068 const [define, pattern] = ssr ? ssrPattern : defaultPattern;47357 let [define, pattern, importMetaEnvVal] = ssr ? ssrPattern : defaultPattern; 47069 47358 if (!pattern) return; 47070 47359 pattern.lastIndex = 0; 47071 47360 if (!pattern.test(code)) return; 47072 return await replaceDefine(code, id, define, config); 47361 const hasDefineImportMetaEnv = "import.meta.env" in define; 47362 let marker = importMetaEnvMarker; 47363 if (hasDefineImportMetaEnv && code.includes(marker)) { 47364 let i = 1; 47365 do { 47366 marker = importMetaEnvMarker + i++; 47367 } while (code.includes(marker)); 47368 if (marker !== importMetaEnvMarker) { 47369 define = { ...define, "import.meta.env": marker }; 47370 } 47371 } 47372 const result = await replaceDefine(code, id, define, config); 47373 if (hasDefineImportMetaEnv) { 47374 result.code = result.code.replaceAll( 47375 getImportMetaEnvKeyRe(marker), 47376 (m) => "undefined".padEnd(m.length) 47377 ); 47378 if (result.code.includes(marker)) { 47379 result.code = `const ${marker} = ${importMetaEnvVal}; 47380 ` + result.code; 47381 if (result.map) { 47382 const map = JSON.parse(result.map); 47383 map.mappings = ";" + map.mappings; 47384 result.map = map; 47385 } 47386 } 47387 } 47388 return result; 47073 47389 } 47074 47390 }; 47075 47391 } 47076 47392 async function replaceDefine(code, id, define, config) { 47077 const replacementMarkers = {};47078 const env = define["import.meta.env"];47079 if (env && !canJsonParse(env)) {47080 const marker = `_${getHash(env, env.length - 2)}_`;47081 replacementMarkers[marker] = env;47082 define = { ...define, "import.meta.env": marker };47083 }47084 47393 const esbuildOptions = config.esbuild || {}; 47085 47394 const result = await transform$1(code, { … … 47107 47416 } 47108 47417 } 47109 for (const marker in replacementMarkers) {47110 result.code = result.code.replaceAll(marker, replacementMarkers[marker]);47111 }47112 47418 return { 47113 47419 code: result.code, … … 47133 47439 return JSON.stringify(value); 47134 47440 } 47135 function canJsonParse(value) {47136 try {47137 JSON.parse(value);47138 re turn true;47139 } catch {47140 return false;47141 }47441 function getImportMetaEnvKeyRe(marker) { 47442 let re = importMetaEnvKeyReCache.get(marker); 47443 if (!re) { 47444 re = new RegExp(`${marker}\\..+?\\b`, "g"); 47445 importMetaEnvKeyReCache.set(marker, re); 47446 } 47447 return re; 47142 47448 } 47143 47449 … … 47283 47589 } 47284 47590 throw new Error( 47285 '"ESM integration proposal for Wasm" is not supported currently. Use vite-plugin-wasm or other community plugins to handle this. Alternatively, you can use `.wasm?init` or `.wasm?url`. See https://vite js.dev/guide/features.html#webassembly for more details.'47591 '"ESM integration proposal for Wasm" is not supported currently. Use vite-plugin-wasm or other community plugins to handle this. Alternatively, you can use `.wasm?init` or `.wasm?url`. See https://vite.dev/guide/features.html#webassembly for more details.' 47286 47592 ); 47287 47593 } … … 47347 47653 saveEmitWorkerAsset(config, { 47348 47654 fileName: outputChunk2.fileName, 47655 originalFileName: null, 47349 47656 source: outputChunk2.code 47350 47657 }); … … 47364 47671 saveEmitWorkerAsset(config, { 47365 47672 fileName: mapFileName, 47673 originalFileName: null, 47366 47674 source: data 47367 47675 }); … … 47387 47695 saveEmitWorkerAsset(config, { 47388 47696 fileName, 47697 originalFileName: null, 47389 47698 source: outputChunk.code 47390 47699 }); … … 47465 47774 if (injectEnv) { 47466 47775 const s = new MagicString(raw); 47467 s.prepend(injectEnv );47776 s.prepend(injectEnv + ";\n"); 47468 47777 return { 47469 47778 code: s.toString(), … … 47484 47793 let urlCode; 47485 47794 if (isBuild) { 47486 if (isWorker && this.getModuleInfo(cleanUrl(id))?.isEntry) {47795 if (isWorker && config.bundleChain.at(-1) === cleanUrl(id)) { 47487 47796 urlCode = "self.location.href"; 47488 47797 } else if (inlineRE.test(id)) { … … 47611 47920 type: "asset", 47612 47921 fileName: asset.fileName, 47922 originalFileName: asset.originalFileName, 47613 47923 source: asset.source 47614 47924 }); … … 47813 48123 file ??= url[0] === "/" ? slash$1(path$n.join(config.publicDir, url)) : slash$1(path$n.resolve(path$n.dirname(id), url)); 47814 48124 } 47815 if (isBuild && config.isWorker && this.getModuleInfo(cleanUrl(file))?.isEntry) {48125 if (isBuild && config.isWorker && config.bundleChain.at(-1) === cleanUrl(file)) { 47816 48126 s.update(expStart, expEnd, "self.location.href"); 47817 48127 } else { … … 48468 48778 } 48469 48779 function cleanStack(stack) { 48470 return stack.split(/\n/ g).filter((l) => /^\s*at/.test(l)).join("\n");48780 return stack.split(/\n/).filter((l) => /^\s*at/.test(l)).join("\n"); 48471 48781 } 48472 48782 function logError(server, err) { … … 49306 49616 const typeRE = /\btype\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/i; 49307 49617 const langRE = /\blang\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/i; 49308 const contextRE = /\bcontext\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/i; 49618 const svelteScriptModuleRE = /\bcontext\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/i; 49619 const svelteModuleRE = /\smodule\b/i; 49309 49620 function esbuildScanPlugin(config, container, depImports, missing, entries) { 49310 49621 const seen = /* @__PURE__ */ new Map(); … … 49392 49703 const matches = raw.matchAll(scriptRE); 49393 49704 for (const [, openTag, content] of matches) { 49394 const typeMatch = openTag.match(typeRE);49705 const typeMatch = typeRE.exec(openTag); 49395 49706 const type = typeMatch && (typeMatch[1] || typeMatch[2] || typeMatch[3]); 49396 const langMatch = openTag.match(langRE);49707 const langMatch = langRE.exec(openTag); 49397 49708 const lang = langMatch && (langMatch[1] || langMatch[2] || langMatch[3]); 49398 49709 if (isHtml && type !== "module") { … … 49408 49719 loader = "ts"; 49409 49720 } 49410 const srcMatch = openTag.match(srcRE);49721 const srcMatch = srcRE.exec(openTag); 49411 49722 if (srcMatch) { 49412 49723 const src = srcMatch[1] || srcMatch[2] || srcMatch[3]; … … 49437 49748 } 49438 49749 const virtualModulePath = JSON.stringify(virtualModulePrefix + key); 49439 const contextMatch = openTag.match(contextRE); 49440 const context = contextMatch && (contextMatch[1] || contextMatch[2] || contextMatch[3]); 49441 if (p.endsWith(".svelte") && context !== "module") { 49442 js += `import ${virtualModulePath} 49750 let addedImport = false; 49751 if (p.endsWith(".svelte")) { 49752 let isModule = svelteModuleRE.test(openTag); 49753 if (!isModule) { 49754 const contextMatch = svelteScriptModuleRE.exec(openTag); 49755 const context = contextMatch && (contextMatch[1] || contextMatch[2] || contextMatch[3]); 49756 isModule = context === "module"; 49757 } 49758 if (!isModule) { 49759 addedImport = true; 49760 js += `import ${virtualModulePath} 49443 49761 `; 49444 } else { 49762 } 49763 } 49764 if (!addedImport) { 49445 49765 js += `export * from ${virtualModulePath} 49446 49766 `; … … 49659 49979 filePath = "./" + filePath; 49660 49980 } 49661 const matched2 = slash$1(filePath).match(exportsValueGlobRe);49981 const matched2 = exportsValueGlobRe.exec(slash$1(filePath)); 49662 49982 if (matched2) { 49663 49983 let allGlobSame = matched2.length === 2; … … 49770 50090 const logNewlyDiscoveredDeps = () => { 49771 50091 if (newDepsToLog.length) { 49772 config.logger.info(50092 logger.info( 49773 50093 colors$1.green( 49774 50094 `\u2728 new dependencies optimized: ${depsLogString(newDepsToLog)}` … … 49784 50104 const logDiscoveredDepsWhileScanning = () => { 49785 50105 if (discoveredDepsWhileScanning.length) { 49786 config.logger.info(50106 logger.info( 49787 50107 colors$1.green( 49788 50108 `\u2728 discovered while scanning: ${depsLogString( … … 49978 50298 if (warnAboutMissedDependencies) { 49979 50299 logDiscoveredDepsWhileScanning(); 49980 config.logger.info(50300 logger.info( 49981 50301 colors$1.magenta( 49982 50302 `\u2757 add these dependencies to optimizeDeps.include to speed up cold start` … … 50010 50330 if (warnAboutMissedDependencies) { 50011 50331 logDiscoveredDepsWhileScanning(); 50012 config.logger.info(50332 logger.info( 50013 50333 colors$1.magenta( 50014 50334 `\u2757 add these dependencies to optimizeDeps.include to avoid a full page reload during cold start` … … 50026 50346 ); 50027 50347 if (needsInteropMismatch.length > 0) { 50028 config.logger.warn(50348 logger.warn( 50029 50349 `Mixed ESM and CJS detected in ${colors$1.yellow( 50030 50350 needsInteropMismatch.join(", ") … … 51318 51638 }; 51319 51639 return function viteServePublicMiddleware(req, res, next) { 51320 if (publicFiles && !publicFiles.has(toFilePath(req.url)) || isImportRequest(req.url) || isInternalRequest(req.url)) { 51640 if (publicFiles && !publicFiles.has(toFilePath(req.url)) || isImportRequest(req.url) || isInternalRequest(req.url) || // for `/public-file.js?url` to be transformed 51641 urlRE.test(req.url)) { 51321 51642 return next(); 51322 51643 } … … 51414 51735 ${server.config.server.fs.allow.map((i) => `- ${i}`).join("\n")} 51415 51736 51416 Refer to docs https://vite js.dev/config/server-options.html#server-fs-allow for configurations and more details.`;51737 Refer to docs https://vite.dev/config/server-options.html#server-fs-allow for configurations and more details.`; 51417 51738 server.config.logger.error(urlMessage); 51418 51739 server.config.logger.warnOnce(hintMessage + "\n"); … … 52073 52394 const idToImportMap = /* @__PURE__ */ new Map(); 52074 52395 const declaredConst = /* @__PURE__ */ new Set(); 52075 const hoistIndex = code.match(hashbangRE)?.[0].length ?? 0;52396 const hoistIndex = hashbangRE.exec(code)?.[0].length ?? 0; 52076 52397 function defineImport(index, source, metadata) { 52077 52398 deps.add(source); … … 52097 52418 ); 52098 52419 } 52420 const imports = []; 52421 const exports = []; 52099 52422 for (const node of ast.body) { 52100 52423 if (node.type === "ImportDeclaration") { 52101 const importId = defineImport(hoistIndex, node.source.value, { 52102 importedNames: node.specifiers.map((s2) => { 52103 if (s2.type === "ImportSpecifier") 52104 return s2.imported.type === "Identifier" ? s2.imported.name : ( 52105 // @ts-expect-error TODO: Estree types don't consider arbitrary module namespace specifiers yet 52106 s2.imported.value 52107 ); 52108 else if (s2.type === "ImportDefaultSpecifier") return "default"; 52109 }).filter(isDefined) 52110 }); 52111 s.remove(node.start, node.end); 52112 for (const spec of node.specifiers) { 52113 if (spec.type === "ImportSpecifier") { 52114 if (spec.imported.type === "Identifier") { 52115 idToImportMap.set( 52116 spec.local.name, 52117 `${importId}.${spec.imported.name}` 52118 ); 52119 } else { 52120 idToImportMap.set( 52121 spec.local.name, 52122 `${importId}[${// @ts-expect-error TODO: Estree types don't consider arbitrary module namespace specifiers yet 52123 JSON.stringify(spec.imported.value)}]` 52124 ); 52125 } 52126 } else if (spec.type === "ImportDefaultSpecifier") { 52127 idToImportMap.set(spec.local.name, `${importId}.default`); 52424 imports.push(node); 52425 } else if (node.type === "ExportNamedDeclaration" || node.type === "ExportDefaultDeclaration" || node.type === "ExportAllDeclaration") { 52426 exports.push(node); 52427 } 52428 } 52429 for (const node of imports) { 52430 const importId = defineImport(hoistIndex, node.source.value, { 52431 importedNames: node.specifiers.map((s2) => { 52432 if (s2.type === "ImportSpecifier") 52433 return s2.imported.type === "Identifier" ? s2.imported.name : ( 52434 // @ts-expect-error TODO: Estree types don't consider arbitrary module namespace specifiers yet 52435 s2.imported.value 52436 ); 52437 else if (s2.type === "ImportDefaultSpecifier") return "default"; 52438 }).filter(isDefined) 52439 }); 52440 s.remove(node.start, node.end); 52441 for (const spec of node.specifiers) { 52442 if (spec.type === "ImportSpecifier") { 52443 if (spec.imported.type === "Identifier") { 52444 idToImportMap.set( 52445 spec.local.name, 52446 `${importId}.${spec.imported.name}` 52447 ); 52128 52448 } else { 52129 idToImportMap.set(spec.local.name, importId); 52130 } 52131 } 52132 } 52133 } 52134 for (const node of ast.body) { 52449 idToImportMap.set( 52450 spec.local.name, 52451 `${importId}[${// @ts-expect-error TODO: Estree types don't consider arbitrary module namespace specifiers yet 52452 JSON.stringify(spec.imported.value)}]` 52453 ); 52454 } 52455 } else if (spec.type === "ImportDefaultSpecifier") { 52456 idToImportMap.set(spec.local.name, `${importId}.default`); 52457 } else { 52458 idToImportMap.set(spec.local.name, importId); 52459 } 52460 } 52461 } 52462 for (const node of exports) { 52135 52463 if (node.type === "ExportNamedDeclaration") { 52136 52464 if (node.declaration) { … … 52248 52576 }); 52249 52577 let map = s.generateMap({ hires: "boundary" }); 52578 map.sources = [path$n.basename(url)]; 52579 map.sourcesContent = [originalCode]; 52250 52580 if (inMap && inMap.mappings && "sources" in inMap && inMap.sources.length > 0) { 52251 52581 map = combineSourcemaps(url, [ 52252 { 52253 ...map, 52254 sources: inMap.sources, 52255 sourcesContent: inMap.sourcesContent 52256 }, 52582 map, 52257 52583 inMap 52258 52584 ]); 52259 } else {52260 map.sources = [path$n.basename(url)];52261 map.sourcesContent = [originalCode];52262 52585 } 52263 52586 return { … … 52526 52849 const pendingModuleDependencyGraph = /* @__PURE__ */ new Map(); 52527 52850 const importErrors = /* @__PURE__ */ new WeakMap(); 52528 async function ssrLoadModule(url, server, context = { global },fixStacktrace) {52851 async function ssrLoadModule(url, server, fixStacktrace) { 52529 52852 url = unwrapId$1(url); 52530 52853 const pending = pendingModules.get(url); … … 52532 52855 return pending; 52533 52856 } 52534 const modulePromise = instantiateModule(url, server, context,fixStacktrace);52857 const modulePromise = instantiateModule(url, server, fixStacktrace); 52535 52858 pendingModules.set(url, modulePromise); 52536 52859 modulePromise.catch(() => { … … 52540 52863 return modulePromise; 52541 52864 } 52542 async function instantiateModule(url, server, context = { global },fixStacktrace) {52865 async function instantiateModule(url, server, fixStacktrace) { 52543 52866 const { moduleGraph } = server; 52544 52867 const mod = await moduleGraph.ensureEntryFromUrl(url, true); … … 52604 52927 } 52605 52928 } 52606 return ssrLoadModule(dep, server, context,fixStacktrace);52929 return ssrLoadModule(dep, server, fixStacktrace); 52607 52930 } catch (err) { 52608 52931 importErrors.set(err, { importee: dep }); … … 52639 52962 try { 52640 52963 const initModule = new AsyncFunction( 52641 `global`,52642 52964 ssrModuleExportsKey, 52643 52965 ssrImportMetaKey, … … 52649 52971 ); 52650 52972 await initModule( 52651 context.global,52652 52973 ssrModule, 52653 52974 ssrImportMeta, … … 54036 54357 if (!normalizePath$3(outDir).startsWith(withTrailingSlash(root))) { 54037 54358 logger?.warn( 54038 picocolorsExports.yellow(54359 colors$1.yellow( 54039 54360 ` 54040 ${ picocolorsExports.bold(`(!)`)} outDir ${picocolorsExports.white(54041 picocolorsExports.dim(outDir)54361 ${colors$1.bold(`(!)`)} outDir ${colors$1.white( 54362 colors$1.dim(outDir) 54042 54363 )} is not inside project root and will not be emptied. 54043 54364 Use --emptyOutDir to override. … … 54050 54371 return true; 54051 54372 } 54052 function resolveChokidarOptions( config, options, resolvedOutDirs, emptyOutDir) {54373 function resolveChokidarOptions(options, resolvedOutDirs, emptyOutDir, cacheDir) { 54053 54374 const { ignored: ignoredList, ...otherOptions } = options ?? {}; 54054 54375 const ignored = [ … … 54057 54378 "**/test-results/**", 54058 54379 // Playwright 54059 glob.escapePath(c onfig.cacheDir) + "/**",54380 glob.escapePath(cacheDir) + "/**", 54060 54381 ...arraify(ignoredList || []) 54061 54382 ]; … … 61463 61784 if (ifNoneMatch) { 61464 61785 const moduleByEtag = server.moduleGraph.getModuleByEtag(ifNoneMatch); 61465 if (moduleByEtag?.transformResult?.etag === ifNoneMatch ) {61786 if (moduleByEtag?.transformResult?.etag === ifNoneMatch && moduleByEtag?.url === req.url) { 61466 61787 const maybeMixedEtag = isCSSRequest(req.url); 61467 61788 if (!maybeMixedEtag) { … … 61541 61862 warnAboutExplicitPublicPathInUrl(url); 61542 61863 } 61864 if ((rawRE.test(url) || urlRE.test(url)) && !ensureServingAccess(url, server, res, next)) { 61865 return; 61866 } 61543 61867 if (isJSRequest(url) || isImportRequest(url) || isCSSRequest(url) || isHTMLProxy(url)) { 61544 61868 url = removeImportQuery(url); … … 61713 62037 } 61714 62038 if (preTransformUrl) { 61715 preTransformRequest(server, preTransformUrl, config.base); 62039 try { 62040 preTransformUrl = decodeURI(preTransformUrl); 62041 } catch (err) { 62042 return url2; 62043 } 62044 preTransformRequest(server, preTransformUrl, config.decodedBase); 61716 62045 } 61717 62046 } … … 61724 62053 const { config, moduleGraph, watcher } = server; 61725 62054 const base = config.base || "/"; 62055 const decodedBase = config.decodedBase || "/"; 61726 62056 let proxyModulePath; 61727 62057 let proxyModuleUrl; … … 61735 62065 proxyModuleUrl = wrapId$1(proxyModulePath); 61736 62066 } 61737 proxyModuleUrl = joinUrlSegments( base, proxyModuleUrl);62067 proxyModuleUrl = joinUrlSegments(decodedBase, proxyModuleUrl); 61738 62068 const s = new MagicString(html); 61739 62069 let inlineModuleIndex = -1; … … 61767 62097 `<script type="module" src="${modulePath}"><\/script>` 61768 62098 ); 61769 preTransformRequest(server, modulePath, base);62099 preTransformRequest(server, modulePath, decodedBase); 61770 62100 }; 61771 62101 await traverseHtml(html, filename, (node) => { … … 61929 62259 }; 61930 62260 } 61931 function preTransformRequest(server, url, base) {62261 function preTransformRequest(server, decodedUrl, decodedBase) { 61932 62262 if (!server.config.server.preTransformRequests) return; 61933 try { 61934 url = unwrapId$1(stripBase(decodeURI(url), base)); 61935 } catch { 61936 return; 61937 } 61938 server.warmupRequest(url); 62263 decodedUrl = unwrapId$1(stripBase(decodedUrl, decodedBase)); 62264 server.warmupRequest(decodedUrl); 61939 62265 } 61940 62266 … … 62107 62433 mod.importers.forEach((importer) => { 62108 62434 if (!importer.acceptedHmrDeps.has(mod)) { 62109 const shouldSoftInvalidateImporter = importer.staticImportedUrls?.has(mod.url) || softInvalidate;62435 const shouldSoftInvalidateImporter = (importer.staticImportedUrls?.has(mod.url) || softInvalidate) && importer.type !== "css"; 62110 62436 this.invalidateModule( 62111 62437 importer, … … 62446 62772 ); 62447 62773 const resolvedWatchOptions = resolveChokidarOptions( 62448 config,62449 62774 { 62450 62775 disableGlobbing: true, … … 62452 62777 }, 62453 62778 resolvedOutDirs, 62454 emptyOutDir 62779 emptyOutDir, 62780 config.cacheDir 62455 62781 ); 62456 62782 const middlewares = connect$1(); … … 62532 62858 }, 62533 62859 async ssrLoadModule(url, opts) { 62534 return ssrLoadModule(url, server, void 0,opts?.fixStacktrace);62860 return ssrLoadModule(url, server, opts?.fixStacktrace); 62535 62861 }, 62536 62862 async ssrFetchModule(url, importer) { … … 63026 63352 seenIds.add(ignoredId); 63027 63353 markIdAsDone(ignoredId); 63354 } else { 63355 checkIfCrawlEndAfterTimeout(); 63028 63356 } 63029 63357 return onCrawlEndPromiseWithResolvers.promise; 63030 63358 } 63031 63359 function markIdAsDone(id) { 63032 if (registeredIds.has(id)) { 63033 registeredIds.delete(id); 63034 checkIfCrawlEndAfterTimeout(); 63035 } 63360 registeredIds.delete(id); 63361 checkIfCrawlEndAfterTimeout(); 63036 63362 } 63037 63363 function checkIfCrawlEndAfterTimeout() { … … 63742 64068 url = injectQuery(url, "import"); 63743 64069 } else if ((isRelative || isSelfImport) && !DEP_VERSION_RE.test(url)) { 63744 const versionMatch = importer.match(DEP_VERSION_RE);64070 const versionMatch = DEP_VERSION_RE.exec(importer); 63745 64071 if (versionMatch) { 63746 64072 url = injectQuery(url, versionMatch[1]); … … 64183 64509 } 64184 64510 const pathname = url.replace(/[?#].*$/, ""); 64185 const { search, hash } = new URL(url, "http://vite js.dev");64511 const { search, hash } = new URL(url, "http://vite.dev"); 64186 64512 return `${pathname}?${queryToInject}${search ? `&` + search.slice(1) : ""}${hash || ""}`; 64187 64513 } … … 64215 64541 ); 64216 64542 const cspNonce = cspNonceMeta?.nonce || cspNonceMeta?.getAttribute("nonce"); 64217 promise = Promise.all (64543 promise = Promise.allSettled( 64218 64544 deps.map((dep) => { 64219 64545 dep = assetsURL(dep, importerUrl); … … 64237 64563 if (!isCss) { 64238 64564 link.as = "script"; 64239 link.crossOrigin = "";64240 }64565 } 64566 link.crossOrigin = ""; 64241 64567 link.href = dep; 64242 64568 if (cspNonce) { … … 64256 64582 ); 64257 64583 } 64258 return promise.then(() => baseModule()).catch((err) => { 64259 const e = new Event("vite:preloadError", { cancelable: true }); 64584 function handlePreloadError(err) { 64585 const e = new Event("vite:preloadError", { 64586 cancelable: true 64587 }); 64260 64588 e.payload = err; 64261 64589 window.dispatchEvent(e); … … 64263 64591 throw err; 64264 64592 } 64593 } 64594 return promise.then((res) => { 64595 for (const item of res || []) { 64596 if (item.status !== "rejected") continue; 64597 handlePreloadError(item.reason); 64598 } 64599 return baseModule().catch(handlePreloadError); 64265 64600 }); 64266 64601 } … … 64269 64604 const isWorker = config.isWorker; 64270 64605 const insertPreload = !(ssr || !!config.build.lib || isWorker); 64271 const resolveModulePreloadDependencies = config.build.modulePreload && config.build.modulePreload.resolveDependencies;64272 64606 const renderBuiltUrl = config.experimental.renderBuiltUrl; 64273 const customModulePreloadPaths = !!(resolveModulePreloadDependencies || renderBuiltUrl);64274 64607 const isRelativeBase = config.base === "./" || config.base === ""; 64275 const optimizeModulePreloadRelativePaths = isRelativeBase && !customModulePreloadPaths;64276 64608 const { modulePreload } = config.build; 64277 64609 const scriptRel2 = modulePreload && modulePreload.polyfill ? `'modulepreload'` : `(${detectScriptRel.toString()})()`; 64278 const assetsURL2 = customModulePreloadPaths ? ( 64279 // If `experimental.renderBuiltUrl` or `build.modulePreload.resolveDependencies` are used 64280 // the dependencies are already resolved. To avoid the need for `new URL(dep, import.meta.url)` 64281 // a helper `__vitePreloadRelativeDep` is used to resolve from relative paths which can be minimized. 64282 `function(dep, importerUrl) { return dep[0] === '.' ? new URL(dep, importerUrl).href : dep }` 64283 ) : optimizeModulePreloadRelativePaths ? ( 64284 // If there isn't custom resolvers affecting the deps list, deps in the list are relative 64285 // to the current chunk and are resolved to absolute URL by the __vitePreload helper itself. 64610 const assetsURL2 = renderBuiltUrl || isRelativeBase ? ( 64611 // If `experimental.renderBuiltUrl` is used, the dependencies might be relative to the current chunk. 64612 // If relative base is used, the dependencies are relative to the current chunk. 64286 64613 // The importerUrl is passed as third parameter to __vitePreload in this case 64287 64614 `function(dep, importerUrl) { return new URL(dep, importerUrl).href }` … … 64335 64662 } 64336 64663 if (match[3]) { 64337 let names2 = match[4].match(/\.([^.?]+)/)?.[1] || "";64664 let names2 = /\.([^.?]+)/.exec(match[4])?.[1] || ""; 64338 64665 if (names2 === "default") { 64339 64666 names2 = "default: __vite_default__"; … … 64377 64704 str().appendRight( 64378 64705 expEnd, 64379 `,${isModernFlag}?${preloadMarker}:void 0${ optimizeModulePreloadRelativePaths || customModulePreloadPaths? ",import.meta.url" : ""})`64706 `,${isModernFlag}?${preloadMarker}:void 0${renderBuiltUrl || isRelativeBase ? ",import.meta.url" : ""})` 64380 64707 ); 64381 64708 } … … 64558 64885 } 64559 64886 if (markerStartPos2 > 0) { 64560 const depsArray = deps.size > 1 || // main chunk is removed64887 let depsArray = deps.size > 1 || // main chunk is removed 64561 64888 hasRemovedPureCssChunk && deps.size > 0 ? modulePreload === false ? ( 64562 64889 // CSS deps use the same mechanism as module preloads, so even if disabled, … … 64564 64891 [...deps].filter((d) => d.endsWith(".css")) 64565 64892 ) : [...deps] : []; 64893 const resolveDependencies = modulePreload ? modulePreload.resolveDependencies : void 0; 64894 if (resolveDependencies && normalizedFile) { 64895 const cssDeps = []; 64896 const otherDeps = []; 64897 for (const dep of depsArray) { 64898 (dep.endsWith(".css") ? cssDeps : otherDeps).push(dep); 64899 } 64900 depsArray = [ 64901 ...resolveDependencies(normalizedFile, otherDeps, { 64902 hostId: file, 64903 hostType: "js" 64904 }), 64905 ...cssDeps 64906 ]; 64907 } 64566 64908 let renderedDeps; 64567 if (normalizedFile && customModulePreloadPaths) { 64568 const { modulePreload: modulePreload2 } = config.build; 64569 const resolveDependencies = modulePreload2 ? modulePreload2.resolveDependencies : void 0; 64570 let resolvedDeps; 64571 if (resolveDependencies) { 64572 const cssDeps = []; 64573 const otherDeps = []; 64574 for (const dep of depsArray) { 64575 (dep.endsWith(".css") ? cssDeps : otherDeps).push(dep); 64576 } 64577 resolvedDeps = [ 64578 ...resolveDependencies(normalizedFile, otherDeps, { 64579 hostId: file, 64580 hostType: "js" 64581 }), 64582 ...cssDeps 64583 ]; 64584 } else { 64585 resolvedDeps = depsArray; 64586 } 64587 renderedDeps = resolvedDeps.map((dep) => { 64909 if (renderBuiltUrl) { 64910 renderedDeps = depsArray.map((dep) => { 64588 64911 const replacement = toOutputFilePathInJS( 64589 64912 dep, … … 64604 64927 // Don't include the assets dir if the default asset file names 64605 64928 // are used, the path will be reconstructed by the import preload helper 64606 optimizeModulePreloadRelativePaths? addFileDep(toRelativePath(d, file)) : addFileDep(d)64929 isRelativeBase ? addFileDep(toRelativePath(d, file)) : addFileDep(d) 64607 64930 ) 64608 64931 ); … … 64919 65242 ); 64920 65243 const options = config.build; 65244 const { root, logger, packageCache } = config; 64921 65245 const ssr = !!options.ssr; 64922 65246 const libOptions = options.lib; 64923 config.logger.info(65247 logger.info( 64924 65248 colors$1.cyan( 64925 65249 `vite v${VERSION} ${colors$1.green( … … 64928 65252 ) 64929 65253 ); 64930 const resolve = (p) => path$n.resolve( config.root, p);65254 const resolve = (p) => path$n.resolve(root, p); 64931 65255 const input = libOptions ? options.rollupOptions?.input || (typeof libOptions.entry === "string" ? resolve(libOptions.entry) : Array.isArray(libOptions.entry) ? libOptions.entry.map(resolve) : Object.fromEntries( 64932 65256 Object.entries(libOptions.entry).map(([alias, file]) => [ … … 65001 65325 enhanceRollupError(e); 65002 65326 clearLine(); 65003 config.logger.error(e.message, { error: e });65327 logger.error(e.message, { error: e }); 65004 65328 }; 65005 65329 let bundle; … … 65008 65332 const buildOutputOptions = (output = {}) => { 65009 65333 if (output.output) { 65010 config.logger.warn(65334 logger.warn( 65011 65335 `You've set "rollupOptions.output.output" in your config. This is deprecated and will override all Vite.js default output options. Please use "rollupOptions.output" instead.` 65012 65336 ); … … 65018 65342 } 65019 65343 if (output.sourcemap) { 65020 config.logger.warnOnce(65344 logger.warnOnce( 65021 65345 colors$1.yellow( 65022 65346 `Vite does not support "rollupOptions.output.sourcemap". Please use "build.sourcemap" instead.` … … 65029 65353 const jsExt = ssrNodeBuild || libOptions ? resolveOutputJsExtension( 65030 65354 format, 65031 findNearestPackageData( config.root, config.packageCache)?.data.type65355 findNearestPackageData(root, packageCache)?.data.type 65032 65356 ) : "js"; 65033 65357 return { … … 65047 65371 format, 65048 65372 name, 65049 config.root,65373 root, 65050 65374 jsExt, 65051 config.packageCache65375 packageCache 65052 65376 ) : path$n.posix.join(options.assetsDir, `[name]-[hash].${jsExt}`), 65053 65377 chunkFileNames: libOptions ? `[name]-[hash].${jsExt}` : path$n.posix.join(options.assetsDir, `[name]-[hash].${jsExt}`), … … 65060 65384 options.rollupOptions?.output, 65061 65385 libOptions, 65062 config.logger65386 logger 65063 65387 ); 65064 65388 const normalizedOutputs = []; … … 65071 65395 } 65072 65396 const resolvedOutDirs = getResolvedOutDirs( 65073 config.root,65397 root, 65074 65398 options.outDir, 65075 65399 options.rollupOptions?.output … … 65077 65401 const emptyOutDir = resolveEmptyOutDir( 65078 65402 options.emptyOutDir, 65079 config.root,65403 root, 65080 65404 resolvedOutDirs, 65081 config.logger65405 logger 65082 65406 ); 65083 65407 if (config.build.watch) { 65084 config.logger.info(colors$1.cyan(`65408 logger.info(colors$1.cyan(` 65085 65409 watching for file changes...`)); 65086 65410 const resolvedChokidarOptions = resolveChokidarOptions( 65087 config,65088 65411 config.build.watch.chokidar, 65089 65412 resolvedOutDirs, 65090 emptyOutDir 65413 emptyOutDir, 65414 config.cacheDir 65091 65415 ); 65092 65416 const { watch } = await import('rollup'); … … 65101 65425 watcher.on("event", (event) => { 65102 65426 if (event.code === "BUNDLE_START") { 65103 config.logger.info(colors$1.cyan(`65427 logger.info(colors$1.cyan(` 65104 65428 build started...`)); 65105 65429 if (options.write) { … … 65108 65432 } else if (event.code === "BUNDLE_END") { 65109 65433 event.result.close(); 65110 config.logger.info(colors$1.cyan(`built in ${event.duration}ms.`));65434 logger.info(colors$1.cyan(`built in ${event.duration}ms.`)); 65111 65435 } else if (event.code === "ERROR") { 65112 65436 outputBuildError(event.error); … … 65125 65449 res.push(await bundle[options.write ? "write" : "generate"](output)); 65126 65450 } 65127 config.logger.info(65451 logger.info( 65128 65452 `${colors$1.green(`\u2713 built in ${displayTime(Date.now() - startTime)}`)}` 65129 65453 ); … … 65133 65457 clearLine(); 65134 65458 if (startTime) { 65135 config.logger.error(65459 logger.error( 65136 65460 `${colors$1.red("x")} Build failed in ${displayTime(Date.now() - startTime)}` 65137 65461 ); … … 65380 65704 const getResolveUrl = (path2, URL = "URL") => `new ${URL}(${path2}).href`; 65381 65705 const getRelativeUrlFromDocument = (relativePath, umd = false) => getResolveUrl( 65382 `'${escapeId(partialEncodeURIPath(relativePath))}', ${umd ? `typeof document === 'undefined' ? location.href : ` : ""}document.currentScript && document.currentScript. src || document.baseURI`65706 `'${escapeId(partialEncodeURIPath(relativePath))}', ${umd ? `typeof document === 'undefined' ? location.href : ` : ""}document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT' && document.currentScript.src || document.baseURI` 65383 65707 ); 65384 65708 const getFileUrlFromFullPath = (path2) => `require('u' + 'rl').pathToFileURL(${path2}).href`; … … 65436 65760 return toRelative(filename, hostId); 65437 65761 } 65438 return joinUrlSegments(config. base, filename);65762 return joinUrlSegments(config.decodedBase, filename); 65439 65763 } 65440 65764 function createToImportMetaURLBasedRelativeRuntime(format, isWorker) { … … 65473 65797 return toRelative(filename, hostId); 65474 65798 } else { 65475 return joinUrlSegments(config. base, filename);65799 return joinUrlSegments(config.decodedBase, filename); 65476 65800 } 65477 65801 } … … 66005 66329 rollupOptions: config.worker?.rollupOptions || {} 66006 66330 }; 66331 const base = withTrailingSlash(resolvedBase); 66007 66332 resolved = { 66008 66333 configFile: configFile ? normalizePath$3(configFile) : void 0, … … 66012 66337 inlineConfig, 66013 66338 root: resolvedRoot, 66014 base: withTrailingSlash(resolvedBase), 66339 base, 66340 decodedBase: decodeURI(base), 66015 66341 rawBase: resolvedBase, 66016 66342 resolve: resolveOptions, … … 66163 66489 } 66164 66490 if (!isBuild || !isExternal) { 66165 base = new URL(base, "http://vite js.dev").pathname;66491 base = new URL(base, "http://vite.dev").pathname; 66166 66492 if (base[0] !== "/") { 66167 66493 base = "/" + base; … … 66201 66527 return null; 66202 66528 } 66203 const isESM = isFilePathESM(resolvedPath);66529 const isESM = typeof process.versions.deno === "string" || isFilePathESM(resolvedPath); 66204 66530 try { 66205 66531 const bundled = await bundleConfigFile(resolvedPath, isESM); … … 66237 66563 entryPoints: [fileName], 66238 66564 write: false, 66239 target: [ "node18"],66565 target: [`node${process.versions.node}`], 66240 66566 platform: "node", 66241 66567 bundle: true, … … 66306 66632 `Failed to resolve ${JSON.stringify( 66307 66633 id 66308 )}. This package is ESM only but it was tried to load by \`require\`. See https://vite js.dev/guide/troubleshooting.html#this-package-is-esm-only for more details.`66634 )}. This package is ESM only but it was tried to load by \`require\`. See https://vite.dev/guide/troubleshooting.html#this-package-is-esm-only for more details.` 66309 66635 ); 66310 66636 } … … 66319 66645 `${JSON.stringify( 66320 66646 id 66321 )} resolved to an ESM file. ESM file cannot be loaded by \`require\`. See https://vite js.dev/guide/troubleshooting.html#this-package-is-esm-only for more details.`66647 )} resolved to an ESM file. ESM file cannot be loaded by \`require\`. See https://vite.dev/guide/troubleshooting.html#this-package-is-esm-only for more details.` 66322 66648 ); 66323 66649 } -
imaps-frontend/node_modules/vite/dist/node/cli.js
rd565449 r0c6b92a 3 3 import { performance } from 'node:perf_hooks'; 4 4 import { EventEmitter } from 'events'; 5 import { A as colors, v as createLogger, r as resolveConfig } from './chunks/dep- mCdpKltl.js';5 import { A as colors, v as createLogger, r as resolveConfig } from './chunks/dep-CB_7IfJ-.js'; 6 6 import { VERSION } from './constants.js'; 7 7 import 'node:fs/promises'; … … 731 731 ).action(async (root, options) => { 732 732 filterDuplicateOptions(options); 733 const { createServer } = await import('./chunks/dep- mCdpKltl.js').then(function (n) { return n.E; });733 const { createServer } = await import('./chunks/dep-CB_7IfJ-.js').then(function (n) { return n.E; }); 734 734 try { 735 735 const server = await createServer({ … … 823 823 ).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).action(async (root, options) => { 824 824 filterDuplicateOptions(options); 825 const { build } = await import('./chunks/dep- mCdpKltl.js').then(function (n) { return n.F; });825 const { build } = await import('./chunks/dep-CB_7IfJ-.js').then(function (n) { return n.F; }); 826 826 const buildOptions = cleanOptions(options); 827 827 try { … … 852 852 async (root, options) => { 853 853 filterDuplicateOptions(options); 854 const { optimizeDeps } = await import('./chunks/dep- mCdpKltl.js').then(function (n) { return n.D; });854 const { optimizeDeps } = await import('./chunks/dep-CB_7IfJ-.js').then(function (n) { return n.D; }); 855 855 try { 856 856 const config = await resolveConfig( … … 878 878 async (root, options) => { 879 879 filterDuplicateOptions(options); 880 const { preview } = await import('./chunks/dep- mCdpKltl.js').then(function (n) { return n.G; });880 const { preview } = await import('./chunks/dep-CB_7IfJ-.js').then(function (n) { return n.G; }); 881 881 try { 882 882 const server = await preview({ -
imaps-frontend/node_modules/vite/dist/node/index.d.ts
rd565449 r0c6b92a 718 718 */ 719 719 interface CorsOptions { 720 origin?: CorsOrigin | ((origin: string , cb: (err: Error, origins: CorsOrigin) => void) => void);720 origin?: CorsOrigin | ((origin: string | undefined, cb: (err: Error, origins: CorsOrigin) => void) => void); 721 721 methods?: string | string[]; 722 722 allowedHeaders?: string | string[]; … … 937 937 declare const WebSocketAlias: typeof WebSocket 938 938 interface WebSocketAlias extends WebSocket {} 939 939 940 // WebSocket socket. 940 941 declare class WebSocket extends EventEmitter { … … 1205 1206 ): this 1206 1207 } 1207 // tslint:disable-line no-empty-interface1208 1208 1209 1209 declare namespace WebSocket { … … 1455 1455 1456 1456 const WebSocketServer: typeof Server 1457 interface WebSocketServer extends Server {} // tslint:disable-line no-empty-interface1457 interface WebSocketServer extends Server {} 1458 1458 const WebSocket: typeof WebSocketAlias 1459 interface WebSocket extends WebSocketAlias {} // tslint:disable-line no-empty-interface1459 interface WebSocket extends WebSocketAlias {} 1460 1460 1461 1461 // WebSocket stream -
imaps-frontend/node_modules/vite/dist/node/index.js
rd565449 r0c6b92a 1 1 export { parseAst, parseAstAsync } from 'rollup/parseAst'; 2 import { i as isInNodeModules, a as arraify } from './chunks/dep- mCdpKltl.js';3 export { b as build, g as buildErrorMessage, k as createFilter, v as createLogger, c as createServer, d as defineConfig, h as fetchModule, f as formatPostcssSourceMap, x as isFileServingAllowed, l as loadConfigFromFile, y as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, e as preprocessCSS, p as preview, r as resolveConfig, z as resolveEnvPrefix, q as rollupVersion, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep- mCdpKltl.js';2 import { i as isInNodeModules, a as arraify } from './chunks/dep-CB_7IfJ-.js'; 3 export { b as build, g as buildErrorMessage, k as createFilter, v as createLogger, c as createServer, d as defineConfig, h as fetchModule, f as formatPostcssSourceMap, x as isFileServingAllowed, l as loadConfigFromFile, y as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, e as preprocessCSS, p as preview, r as resolveConfig, z as resolveEnvPrefix, q as rollupVersion, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-CB_7IfJ-.js'; 4 4 export { VERSION as version } from './constants.js'; 5 5 export { version as esbuildVersion } from 'esbuild'; -
imaps-frontend/node_modules/vite/dist/node/runtime.js
rd565449 r0c6b92a 95 95 intToChar[i] = c, charToInt[c] = i; 96 96 } 97 function decode(mappings) { 98 const state = new Int32Array(5), decoded = []; 99 let index = 0; 100 do { 101 const semi = indexOf(mappings, index), line = []; 102 let sorted = !0, lastCol = 0; 103 state[0] = 0; 104 for (let i = index; i < semi; i++) { 105 let seg; 106 i = decodeInteger(mappings, i, state, 0); 107 const col = state[0]; 108 col < lastCol && (sorted = !1), lastCol = col, hasMoreVlq(mappings, i, semi) ? (i = decodeInteger(mappings, i, state, 1), i = decodeInteger(mappings, i, state, 2), i = decodeInteger(mappings, i, state, 3), hasMoreVlq(mappings, i, semi) ? (i = decodeInteger(mappings, i, state, 4), seg = [col, state[1], state[2], state[3], state[4]]) : seg = [col, state[1], state[2], state[3]]) : seg = [col], line.push(seg); 109 } 110 sorted || sort(line), decoded.push(line), index = semi + 1; 111 } while (index <= mappings.length); 112 return decoded; 113 } 114 function indexOf(mappings, index) { 115 const idx = mappings.indexOf(";", index); 116 return idx === -1 ? mappings.length : idx; 117 } 118 function decodeInteger(mappings, pos, state, j) { 97 function decodeInteger(reader, relative) { 119 98 let value = 0, shift = 0, integer = 0; 120 99 do { 121 const c = mappings.charCodeAt(pos++);100 const c = reader.next(); 122 101 integer = charToInt[c], value |= (integer & 31) << shift, shift += 5; 123 102 } while (integer & 32); 124 103 const shouldNegate = value & 1; 125 return value >>>= 1, shouldNegate && (value = -2147483648 | -value), state[j] += value, pos; 126 } 127 function hasMoreVlq(mappings, i, length) { 128 return i >= length ? !1 : mappings.charCodeAt(i) !== comma; 104 return value >>>= 1, shouldNegate && (value = -2147483648 | -value), relative + value; 105 } 106 function hasMoreVlq(reader, max) { 107 return reader.pos >= max ? !1 : reader.peek() !== comma; 108 } 109 class StringReader { 110 constructor(buffer) { 111 this.pos = 0, this.buffer = buffer; 112 } 113 next() { 114 return this.buffer.charCodeAt(this.pos++); 115 } 116 peek() { 117 return this.buffer.charCodeAt(this.pos); 118 } 119 indexOf(char) { 120 const { buffer, pos } = this, idx = buffer.indexOf(char, pos); 121 return idx === -1 ? buffer.length : idx; 122 } 123 } 124 function decode(mappings) { 125 const { length } = mappings, reader = new StringReader(mappings), decoded = []; 126 let genColumn = 0, sourcesIndex = 0, sourceLine = 0, sourceColumn = 0, namesIndex = 0; 127 do { 128 const semi = reader.indexOf(";"), line = []; 129 let sorted = !0, lastCol = 0; 130 for (genColumn = 0; reader.pos < semi; ) { 131 let seg; 132 genColumn = decodeInteger(reader, genColumn), genColumn < lastCol && (sorted = !1), lastCol = genColumn, hasMoreVlq(reader, semi) ? (sourcesIndex = decodeInteger(reader, sourcesIndex), sourceLine = decodeInteger(reader, sourceLine), sourceColumn = decodeInteger(reader, sourceColumn), hasMoreVlq(reader, semi) ? (namesIndex = decodeInteger(reader, namesIndex), seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]) : seg = [genColumn, sourcesIndex, sourceLine, sourceColumn]) : seg = [genColumn], line.push(seg), reader.pos++; 133 } 134 sorted || sort(line), decoded.push(line), reader.pos = semi + 1; 135 } while (reader.pos <= length); 136 return decoded; 129 137 } 130 138 function sort(line) { … … 317 325 if (mod.map) return mod.map; 318 326 if (!mod.meta || !("code" in mod.meta)) return null; 319 const mapString = mod.meta.code.match( 320 VITE_RUNTIME_SOURCEMAPPING_REGEXP 321 )?.[1]; 327 const mapString = VITE_RUNTIME_SOURCEMAPPING_REGEXP.exec(mod.meta.code)?.[1]; 322 328 if (!mapString) return null; 323 329 const baseFile = mod.meta.file || moduleId.split("?")[0]; -
imaps-frontend/node_modules/vite/index.cjs
rd565449 r0c6b92a 1 /* eslint-disable no-restricted-globals */2 3 1 warnCjsUsage() 4 2 … … 7 5 8 6 // proxy cjs utils (sync functions) 9 // eslint-disable-next-line n/no-missing-require -- will be generated by build10 7 Object.assign(module.exports, require('./dist/node-cjs/publicUtils.cjs')) 11 8 … … 29 26 function warnCjsUsage() { 30 27 if (process.env.VITE_CJS_IGNORE_WARNING) return 28 const logLevelIndex = process.argv.findIndex((arg) => 29 /^(?:-l|--logLevel)/.test(arg), 30 ) 31 if (logLevelIndex > 0) { 32 const logLevelValue = process.argv[logLevelIndex + 1] 33 if (logLevelValue === 'silent' || logLevelValue === 'error') { 34 return 35 } 36 if (/silent|error/.test(process.argv[logLevelIndex])) { 37 return 38 } 39 } 31 40 const yellow = (str) => `\u001b[33m${str}\u001b[39m` 32 const log = process.env.VITE_CJS_TRACE ? console.trace : console.warn 33 log( 41 console.warn( 34 42 yellow( 35 `The CJS build of Vite's Node API is deprecated. See https://vite js.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.`,43 `The CJS build of Vite's Node API is deprecated. See https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.`, 36 44 ), 37 45 ) 46 if (process.env.VITE_CJS_TRACE) { 47 const e = {} 48 const stackTraceLimit = Error.stackTraceLimit 49 Error.stackTraceLimit = 100 50 Error.captureStackTrace(e) 51 Error.stackTraceLimit = stackTraceLimit 52 console.log( 53 e.stack 54 .split('\n') 55 .slice(1) 56 .filter((line) => !line.includes('(node:')) 57 .join('\n'), 58 ) 59 } 38 60 } -
imaps-frontend/node_modules/vite/index.d.cts
rd565449 r0c6b92a 1 1 /** 2 * @deprecated The CJS build of Vite's Node API is deprecated. See https://vite js.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.2 * @deprecated The CJS build of Vite's Node API is deprecated. See https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details. 3 3 */ 4 4 declare const module: any -
imaps-frontend/node_modules/vite/package.json
rd565449 r0c6b92a 1 1 { 2 2 "name": "vite", 3 "version": "5. 3.5",3 "version": "5.4.11", 4 4 "type": "module", 5 5 "license": "MIT", … … 69 69 "url": "https://github.com/vitejs/vite/issues" 70 70 }, 71 "homepage": "https://vite js.dev",71 "homepage": "https://vite.dev", 72 72 "funding": "https://github.com/vitejs/vite?sponsor=1", 73 73 "//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!", 74 74 "dependencies": { 75 75 "esbuild": "^0.21.3", 76 "postcss": "^8.4. 39",77 "rollup": "^4. 13.0"76 "postcss": "^8.4.43", 77 "rollup": "^4.20.0" 78 78 }, 79 79 "optionalDependencies": { … … 82 82 "devDependencies": { 83 83 "@ampproject/remapping": "^2.3.0", 84 "@babel/parser": "^7.2 4.8",84 "@babel/parser": "^7.25.6", 85 85 "@jridgewell/trace-mapping": "^0.3.25", 86 86 "@polka/compression": "^1.0.0-next.25", … … 100 100 "cors": "^2.8.5", 101 101 "cross-spawn": "^7.0.3", 102 "debug": "^4.3. 5",102 "debug": "^4.3.6", 103 103 "dep-types": "link:./src/types", 104 104 "dotenv": "^16.4.5", … … 110 110 "fast-glob": "^3.3.2", 111 111 "http-proxy": "^1.18.1", 112 "launch-editor-middleware": "^2. 8.0",113 "lightningcss": "^1.2 5.1",114 "magic-string": "^0.30.1 0",115 "micromatch": "^4.0. 7",112 "launch-editor-middleware": "^2.9.1", 113 "lightningcss": "^1.26.0", 114 "magic-string": "^0.30.11", 115 "micromatch": "^4.0.8", 116 116 "mlly": "^1.7.1", 117 117 "mrmime": "^2.0.0", … … 130 130 "rollup-plugin-license": "^3.5.2", 131 131 "sass": "^1.77.8", 132 "sass-embedded": "^1.77.8", 132 133 "sirv": "^2.0.4", 133 134 "source-map-support": "^0.5.21", 134 135 "strip-ansi": "^7.1.0", 135 136 "strip-literal": "^2.1.0", 136 "tsconfck": "^3.1. 1",137 "tslib": "^2. 6.3",137 "tsconfck": "^3.1.4", 138 "tslib": "^2.7.0", 138 139 "types": "link:./types", 139 140 "ufo": "^1.5.4", … … 145 146 "lightningcss": "^1.21.0", 146 147 "sass": "*", 148 "sass-embedded": "*", 147 149 "stylus": "*", 148 150 "sugarss": "*", … … 154 156 }, 155 157 "sass": { 158 "optional": true 159 }, 160 "sass-embedded": { 156 161 "optional": true 157 162 },
Note:
See TracChangeset
for help on using the changeset viewer.