vite 6.0.0-alpha.2 → 6.0.0-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +112 -203
- package/client.d.ts +12 -0
- package/dist/client/client.mjs +614 -611
- package/dist/client/env.mjs +18 -24
- package/dist/node/chunks/{dep-DK04Q0H9.js → dep-BVDN2Cqw.js} +1 -1
- package/dist/node/chunks/{dep-E4cF1RpV.js → dep-CpuHsFvF.js} +37411 -39030
- package/dist/node/chunks/{dep-CrWVpuYf.js → dep-D-7KCb9p.js} +32 -2
- package/dist/node/chunks/{dep-DKZVy3_n.js → dep-D1nw2wDG.js} +165 -968
- package/dist/node/cli.js +260 -265
- package/dist/node/constants.js +108 -84
- package/dist/node/index.d.ts +2121 -1984
- package/dist/node/index.js +128 -258
- package/dist/node/module-runner.d.ts +33 -18
- package/dist/node/module-runner.js +275 -206
- package/dist/node-cjs/publicUtils.cjs +638 -657
- package/index.cjs +0 -2
- package/package.json +32 -29
- package/types/customEvent.d.ts +1 -0
- package/types/hmrPayload.d.ts +3 -1
- package/dist/client/client.mjs.map +0 -1
- package/dist/client/env.mjs.map +0 -1
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { K as commonjsGlobal, J as getDefaultExportFromCjs } from './dep-CpuHsFvF.js';
|
2
2
|
import require$$0__default from 'fs';
|
3
3
|
import require$$0 from 'postcss';
|
4
4
|
import require$$0$1 from 'path';
|
@@ -561,10 +561,6 @@ var root$2 = freeGlobal || freeSelf || Function('return this')();
|
|
561
561
|
function arrayReduce(array, iteratee, accumulator, initAccum) {
|
562
562
|
var index = -1,
|
563
563
|
length = array ? array.length : 0;
|
564
|
-
|
565
|
-
if (initAccum && length) {
|
566
|
-
accumulator = array[++index];
|
567
|
-
}
|
568
564
|
while (++index < length) {
|
569
565
|
accumulator = iteratee(accumulator, array[index], index, array);
|
570
566
|
}
|
@@ -977,7 +973,7 @@ var upperFirst = createCaseFirst('toUpperCase');
|
|
977
973
|
*/
|
978
974
|
function words(string, pattern, guard) {
|
979
975
|
string = toString(string);
|
980
|
-
pattern =
|
976
|
+
pattern = pattern;
|
981
977
|
|
982
978
|
if (pattern === undefined) {
|
983
979
|
return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
|
@@ -2223,7 +2219,6 @@ var unesc = {exports: {}};
|
|
2223
2219
|
|
2224
2220
|
exports.__esModule = true;
|
2225
2221
|
exports["default"] = unesc;
|
2226
|
-
|
2227
2222
|
// Many thanks for this post which made this migration much easier.
|
2228
2223
|
// https://mathiasbynens.be/notes/css-escapes
|
2229
2224
|
|
@@ -2236,81 +2231,65 @@ var unesc = {exports: {}};
|
|
2236
2231
|
var lower = str.toLowerCase();
|
2237
2232
|
var hex = '';
|
2238
2233
|
var spaceTerminated = false;
|
2239
|
-
|
2240
2234
|
for (var i = 0; i < 6 && lower[i] !== undefined; i++) {
|
2241
|
-
var code = lower.charCodeAt(i);
|
2242
|
-
|
2243
|
-
var valid = code >= 97 && code <= 102 || code >= 48 && code <= 57;
|
2244
|
-
|
2235
|
+
var code = lower.charCodeAt(i);
|
2236
|
+
// check to see if we are dealing with a valid hex char [a-f|0-9]
|
2237
|
+
var valid = code >= 97 && code <= 102 || code >= 48 && code <= 57;
|
2238
|
+
// https://drafts.csswg.org/css-syntax/#consume-escaped-code-point
|
2245
2239
|
spaceTerminated = code === 32;
|
2246
|
-
|
2247
2240
|
if (!valid) {
|
2248
2241
|
break;
|
2249
2242
|
}
|
2250
|
-
|
2251
2243
|
hex += lower[i];
|
2252
2244
|
}
|
2253
|
-
|
2254
2245
|
if (hex.length === 0) {
|
2255
2246
|
return undefined;
|
2256
2247
|
}
|
2257
|
-
|
2258
2248
|
var codePoint = parseInt(hex, 16);
|
2259
|
-
var isSurrogate = codePoint >= 0xD800 && codePoint <= 0xDFFF;
|
2249
|
+
var isSurrogate = codePoint >= 0xD800 && codePoint <= 0xDFFF;
|
2250
|
+
// Add special case for
|
2260
2251
|
// "If this number is zero, or is for a surrogate, or is greater than the maximum allowed code point"
|
2261
2252
|
// https://drafts.csswg.org/css-syntax/#maximum-allowed-code-point
|
2262
|
-
|
2263
2253
|
if (isSurrogate || codePoint === 0x0000 || codePoint > 0x10FFFF) {
|
2264
2254
|
return ["\uFFFD", hex.length + (spaceTerminated ? 1 : 0)];
|
2265
2255
|
}
|
2266
|
-
|
2267
2256
|
return [String.fromCodePoint(codePoint), hex.length + (spaceTerminated ? 1 : 0)];
|
2268
2257
|
}
|
2269
|
-
|
2270
2258
|
var CONTAINS_ESCAPE = /\\/;
|
2271
|
-
|
2272
2259
|
function unesc(str) {
|
2273
2260
|
var needToProcess = CONTAINS_ESCAPE.test(str);
|
2274
|
-
|
2275
2261
|
if (!needToProcess) {
|
2276
2262
|
return str;
|
2277
2263
|
}
|
2278
|
-
|
2279
2264
|
var ret = "";
|
2280
|
-
|
2281
2265
|
for (var i = 0; i < str.length; i++) {
|
2282
2266
|
if (str[i] === "\\") {
|
2283
2267
|
var gobbled = gobbleHex(str.slice(i + 1, i + 7));
|
2284
|
-
|
2285
2268
|
if (gobbled !== undefined) {
|
2286
2269
|
ret += gobbled[0];
|
2287
2270
|
i += gobbled[1];
|
2288
2271
|
continue;
|
2289
|
-
}
|
2290
|
-
// https://github.com/postcss/postcss-selector-parser/commit/268c9a7656fb53f543dc620aa5b73a30ec3ff20e
|
2291
|
-
|
2272
|
+
}
|
2292
2273
|
|
2274
|
+
// Retain a pair of \\ if double escaped `\\\\`
|
2275
|
+
// https://github.com/postcss/postcss-selector-parser/commit/268c9a7656fb53f543dc620aa5b73a30ec3ff20e
|
2293
2276
|
if (str[i + 1] === "\\") {
|
2294
2277
|
ret += "\\";
|
2295
2278
|
i++;
|
2296
2279
|
continue;
|
2297
|
-
}
|
2298
|
-
// https://github.com/postcss/postcss-selector-parser/commit/01a6b346e3612ce1ab20219acc26abdc259ccefb
|
2299
|
-
|
2280
|
+
}
|
2300
2281
|
|
2282
|
+
// if \\ is at the end of the string retain it
|
2283
|
+
// https://github.com/postcss/postcss-selector-parser/commit/01a6b346e3612ce1ab20219acc26abdc259ccefb
|
2301
2284
|
if (str.length === i + 1) {
|
2302
2285
|
ret += str[i];
|
2303
2286
|
}
|
2304
|
-
|
2305
2287
|
continue;
|
2306
2288
|
}
|
2307
|
-
|
2308
2289
|
ret += str[i];
|
2309
2290
|
}
|
2310
|
-
|
2311
2291
|
return ret;
|
2312
2292
|
}
|
2313
|
-
|
2314
2293
|
module.exports = exports.default;
|
2315
2294
|
} (unesc, unesc.exports));
|
2316
2295
|
|
@@ -2322,25 +2301,19 @@ var getProp = {exports: {}};
|
|
2322
2301
|
|
2323
2302
|
exports.__esModule = true;
|
2324
2303
|
exports["default"] = getProp;
|
2325
|
-
|
2326
2304
|
function getProp(obj) {
|
2327
2305
|
for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
2328
2306
|
props[_key - 1] = arguments[_key];
|
2329
2307
|
}
|
2330
|
-
|
2331
2308
|
while (props.length > 0) {
|
2332
2309
|
var prop = props.shift();
|
2333
|
-
|
2334
2310
|
if (!obj[prop]) {
|
2335
2311
|
return undefined;
|
2336
2312
|
}
|
2337
|
-
|
2338
2313
|
obj = obj[prop];
|
2339
2314
|
}
|
2340
|
-
|
2341
2315
|
return obj;
|
2342
2316
|
}
|
2343
|
-
|
2344
2317
|
module.exports = exports.default;
|
2345
2318
|
} (getProp, getProp.exports));
|
2346
2319
|
|
@@ -2352,23 +2325,18 @@ var ensureObject = {exports: {}};
|
|
2352
2325
|
|
2353
2326
|
exports.__esModule = true;
|
2354
2327
|
exports["default"] = ensureObject;
|
2355
|
-
|
2356
2328
|
function ensureObject(obj) {
|
2357
2329
|
for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
2358
2330
|
props[_key - 1] = arguments[_key];
|
2359
2331
|
}
|
2360
|
-
|
2361
2332
|
while (props.length > 0) {
|
2362
2333
|
var prop = props.shift();
|
2363
|
-
|
2364
2334
|
if (!obj[prop]) {
|
2365
2335
|
obj[prop] = {};
|
2366
2336
|
}
|
2367
|
-
|
2368
2337
|
obj = obj[prop];
|
2369
2338
|
}
|
2370
2339
|
}
|
2371
|
-
|
2372
2340
|
module.exports = exports.default;
|
2373
2341
|
} (ensureObject, ensureObject.exports));
|
2374
2342
|
|
@@ -2380,80 +2348,57 @@ var stripComments = {exports: {}};
|
|
2380
2348
|
|
2381
2349
|
exports.__esModule = true;
|
2382
2350
|
exports["default"] = stripComments;
|
2383
|
-
|
2384
2351
|
function stripComments(str) {
|
2385
2352
|
var s = "";
|
2386
2353
|
var commentStart = str.indexOf("/*");
|
2387
2354
|
var lastEnd = 0;
|
2388
|
-
|
2389
2355
|
while (commentStart >= 0) {
|
2390
2356
|
s = s + str.slice(lastEnd, commentStart);
|
2391
2357
|
var commentEnd = str.indexOf("*/", commentStart + 2);
|
2392
|
-
|
2393
2358
|
if (commentEnd < 0) {
|
2394
2359
|
return s;
|
2395
2360
|
}
|
2396
|
-
|
2397
2361
|
lastEnd = commentEnd + 2;
|
2398
2362
|
commentStart = str.indexOf("/*", lastEnd);
|
2399
2363
|
}
|
2400
|
-
|
2401
2364
|
s = s + str.slice(lastEnd);
|
2402
2365
|
return s;
|
2403
2366
|
}
|
2404
|
-
|
2405
2367
|
module.exports = exports.default;
|
2406
2368
|
} (stripComments, stripComments.exports));
|
2407
2369
|
|
2408
2370
|
var stripCommentsExports = stripComments.exports;
|
2409
2371
|
|
2410
2372
|
util.__esModule = true;
|
2411
|
-
util.
|
2412
|
-
|
2373
|
+
util.unesc = util.stripComments = util.getProp = util.ensureObject = void 0;
|
2413
2374
|
var _unesc = _interopRequireDefault$3(unescExports);
|
2414
|
-
|
2415
2375
|
util.unesc = _unesc["default"];
|
2416
|
-
|
2417
2376
|
var _getProp = _interopRequireDefault$3(getPropExports);
|
2418
|
-
|
2419
2377
|
util.getProp = _getProp["default"];
|
2420
|
-
|
2421
2378
|
var _ensureObject = _interopRequireDefault$3(ensureObjectExports);
|
2422
|
-
|
2423
2379
|
util.ensureObject = _ensureObject["default"];
|
2424
|
-
|
2425
2380
|
var _stripComments = _interopRequireDefault$3(stripCommentsExports);
|
2426
|
-
|
2427
2381
|
util.stripComments = _stripComments["default"];
|
2428
|
-
|
2429
2382
|
function _interopRequireDefault$3(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
2430
2383
|
|
2431
2384
|
(function (module, exports) {
|
2432
2385
|
|
2433
2386
|
exports.__esModule = true;
|
2434
2387
|
exports["default"] = void 0;
|
2435
|
-
|
2436
2388
|
var _util = util;
|
2437
|
-
|
2438
2389
|
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); } }
|
2439
|
-
|
2440
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
2441
|
-
|
2390
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
2442
2391
|
var cloneNode = function cloneNode(obj, parent) {
|
2443
2392
|
if (typeof obj !== 'object' || obj === null) {
|
2444
2393
|
return obj;
|
2445
2394
|
}
|
2446
|
-
|
2447
2395
|
var cloned = new obj.constructor();
|
2448
|
-
|
2449
2396
|
for (var i in obj) {
|
2450
2397
|
if (!obj.hasOwnProperty(i)) {
|
2451
2398
|
continue;
|
2452
2399
|
}
|
2453
|
-
|
2454
2400
|
var value = obj[i];
|
2455
2401
|
var type = typeof value;
|
2456
|
-
|
2457
2402
|
if (i === 'parent' && type === 'object') {
|
2458
2403
|
if (parent) {
|
2459
2404
|
cloned[i] = parent;
|
@@ -2466,66 +2411,52 @@ function _interopRequireDefault$3(obj) { return obj && obj.__esModule ? obj : {
|
|
2466
2411
|
cloned[i] = cloneNode(value, cloned);
|
2467
2412
|
}
|
2468
2413
|
}
|
2469
|
-
|
2470
2414
|
return cloned;
|
2471
2415
|
};
|
2472
|
-
|
2473
2416
|
var Node = /*#__PURE__*/function () {
|
2474
2417
|
function Node(opts) {
|
2475
2418
|
if (opts === void 0) {
|
2476
2419
|
opts = {};
|
2477
2420
|
}
|
2478
|
-
|
2479
2421
|
Object.assign(this, opts);
|
2480
2422
|
this.spaces = this.spaces || {};
|
2481
2423
|
this.spaces.before = this.spaces.before || '';
|
2482
2424
|
this.spaces.after = this.spaces.after || '';
|
2483
2425
|
}
|
2484
|
-
|
2485
2426
|
var _proto = Node.prototype;
|
2486
|
-
|
2487
2427
|
_proto.remove = function remove() {
|
2488
2428
|
if (this.parent) {
|
2489
2429
|
this.parent.removeChild(this);
|
2490
2430
|
}
|
2491
|
-
|
2492
2431
|
this.parent = undefined;
|
2493
2432
|
return this;
|
2494
2433
|
};
|
2495
|
-
|
2496
2434
|
_proto.replaceWith = function replaceWith() {
|
2497
2435
|
if (this.parent) {
|
2498
2436
|
for (var index in arguments) {
|
2499
2437
|
this.parent.insertBefore(this, arguments[index]);
|
2500
2438
|
}
|
2501
|
-
|
2502
2439
|
this.remove();
|
2503
2440
|
}
|
2504
|
-
|
2505
2441
|
return this;
|
2506
2442
|
};
|
2507
|
-
|
2508
2443
|
_proto.next = function next() {
|
2509
2444
|
return this.parent.at(this.parent.index(this) + 1);
|
2510
2445
|
};
|
2511
|
-
|
2512
2446
|
_proto.prev = function prev() {
|
2513
2447
|
return this.parent.at(this.parent.index(this) - 1);
|
2514
2448
|
};
|
2515
|
-
|
2516
2449
|
_proto.clone = function clone(overrides) {
|
2517
2450
|
if (overrides === void 0) {
|
2518
2451
|
overrides = {};
|
2519
2452
|
}
|
2520
|
-
|
2521
2453
|
var cloned = cloneNode(this);
|
2522
|
-
|
2523
2454
|
for (var name in overrides) {
|
2524
2455
|
cloned[name] = overrides[name];
|
2525
2456
|
}
|
2526
|
-
|
2527
2457
|
return cloned;
|
2528
2458
|
}
|
2459
|
+
|
2529
2460
|
/**
|
2530
2461
|
* Some non-standard syntax doesn't follow normal escaping rules for css.
|
2531
2462
|
* This allows non standard syntax to be appended to an existing property
|
@@ -2534,24 +2465,21 @@ function _interopRequireDefault$3(obj) { return obj && obj.__esModule ? obj : {
|
|
2534
2465
|
* @param {string} name the property to set
|
2535
2466
|
* @param {any} value the unescaped value of the property
|
2536
2467
|
* @param {string} valueEscaped optional. the escaped value of the property.
|
2537
|
-
|
2538
|
-
;
|
2539
|
-
|
2468
|
+
*/;
|
2540
2469
|
_proto.appendToPropertyAndEscape = function appendToPropertyAndEscape(name, value, valueEscaped) {
|
2541
2470
|
if (!this.raws) {
|
2542
2471
|
this.raws = {};
|
2543
2472
|
}
|
2544
|
-
|
2545
2473
|
var originalValue = this[name];
|
2546
2474
|
var originalEscaped = this.raws[name];
|
2547
2475
|
this[name] = originalValue + value; // this may trigger a setter that updates raws, so it has to be set first.
|
2548
|
-
|
2549
2476
|
if (originalEscaped || valueEscaped !== value) {
|
2550
2477
|
this.raws[name] = (originalEscaped || originalValue) + valueEscaped;
|
2551
2478
|
} else {
|
2552
2479
|
delete this.raws[name]; // delete any escaped value that was created by the setter.
|
2553
2480
|
}
|
2554
2481
|
}
|
2482
|
+
|
2555
2483
|
/**
|
2556
2484
|
* Some non-standard syntax doesn't follow normal escaping rules for css.
|
2557
2485
|
* This allows the escaped value to be specified directly, allowing illegal
|
@@ -2559,86 +2487,68 @@ function _interopRequireDefault$3(obj) { return obj && obj.__esModule ? obj : {
|
|
2559
2487
|
* @param {string} name the property to set
|
2560
2488
|
* @param {any} value the unescaped value of the property
|
2561
2489
|
* @param {string} valueEscaped the escaped value of the property.
|
2562
|
-
|
2563
|
-
;
|
2564
|
-
|
2490
|
+
*/;
|
2565
2491
|
_proto.setPropertyAndEscape = function setPropertyAndEscape(name, value, valueEscaped) {
|
2566
2492
|
if (!this.raws) {
|
2567
2493
|
this.raws = {};
|
2568
2494
|
}
|
2569
|
-
|
2570
2495
|
this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
|
2571
|
-
|
2572
2496
|
this.raws[name] = valueEscaped;
|
2573
2497
|
}
|
2498
|
+
|
2574
2499
|
/**
|
2575
2500
|
* When you want a value to passed through to CSS directly. This method
|
2576
2501
|
* deletes the corresponding raw value causing the stringifier to fallback
|
2577
2502
|
* to the unescaped value.
|
2578
2503
|
* @param {string} name the property to set.
|
2579
2504
|
* @param {any} value The value that is both escaped and unescaped.
|
2580
|
-
|
2581
|
-
;
|
2582
|
-
|
2505
|
+
*/;
|
2583
2506
|
_proto.setPropertyWithoutEscape = function setPropertyWithoutEscape(name, value) {
|
2584
2507
|
this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
|
2585
|
-
|
2586
2508
|
if (this.raws) {
|
2587
2509
|
delete this.raws[name];
|
2588
2510
|
}
|
2589
2511
|
}
|
2512
|
+
|
2590
2513
|
/**
|
2591
2514
|
*
|
2592
2515
|
* @param {number} line The number (starting with 1)
|
2593
2516
|
* @param {number} column The column number (starting with 1)
|
2594
|
-
|
2595
|
-
;
|
2596
|
-
|
2517
|
+
*/;
|
2597
2518
|
_proto.isAtPosition = function isAtPosition(line, column) {
|
2598
2519
|
if (this.source && this.source.start && this.source.end) {
|
2599
2520
|
if (this.source.start.line > line) {
|
2600
2521
|
return false;
|
2601
2522
|
}
|
2602
|
-
|
2603
2523
|
if (this.source.end.line < line) {
|
2604
2524
|
return false;
|
2605
2525
|
}
|
2606
|
-
|
2607
2526
|
if (this.source.start.line === line && this.source.start.column > column) {
|
2608
2527
|
return false;
|
2609
2528
|
}
|
2610
|
-
|
2611
2529
|
if (this.source.end.line === line && this.source.end.column < column) {
|
2612
2530
|
return false;
|
2613
2531
|
}
|
2614
|
-
|
2615
2532
|
return true;
|
2616
2533
|
}
|
2617
|
-
|
2618
2534
|
return undefined;
|
2619
2535
|
};
|
2620
|
-
|
2621
2536
|
_proto.stringifyProperty = function stringifyProperty(name) {
|
2622
2537
|
return this.raws && this.raws[name] || this[name];
|
2623
2538
|
};
|
2624
|
-
|
2625
2539
|
_proto.valueToString = function valueToString() {
|
2626
2540
|
return String(this.stringifyProperty("value"));
|
2627
2541
|
};
|
2628
|
-
|
2629
2542
|
_proto.toString = function toString() {
|
2630
2543
|
return [this.rawSpaceBefore, this.valueToString(), this.rawSpaceAfter].join('');
|
2631
2544
|
};
|
2632
|
-
|
2633
2545
|
_createClass(Node, [{
|
2634
2546
|
key: "rawSpaceBefore",
|
2635
2547
|
get: function get() {
|
2636
2548
|
var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.before;
|
2637
|
-
|
2638
2549
|
if (rawSpace === undefined) {
|
2639
2550
|
rawSpace = this.spaces && this.spaces.before;
|
2640
2551
|
}
|
2641
|
-
|
2642
2552
|
return rawSpace || "";
|
2643
2553
|
},
|
2644
2554
|
set: function set(raw) {
|
@@ -2649,11 +2559,9 @@ function _interopRequireDefault$3(obj) { return obj && obj.__esModule ? obj : {
|
|
2649
2559
|
key: "rawSpaceAfter",
|
2650
2560
|
get: function get() {
|
2651
2561
|
var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.after;
|
2652
|
-
|
2653
2562
|
if (rawSpace === undefined) {
|
2654
2563
|
rawSpace = this.spaces.after;
|
2655
2564
|
}
|
2656
|
-
|
2657
2565
|
return rawSpace || "";
|
2658
2566
|
},
|
2659
2567
|
set: function set(raw) {
|
@@ -2661,10 +2569,8 @@ function _interopRequireDefault$3(obj) { return obj && obj.__esModule ? obj : {
|
|
2661
2569
|
this.raws.spaces.after = raw;
|
2662
2570
|
}
|
2663
2571
|
}]);
|
2664
|
-
|
2665
2572
|
return Node;
|
2666
2573
|
}();
|
2667
|
-
|
2668
2574
|
exports["default"] = Node;
|
2669
2575
|
module.exports = exports.default;
|
2670
2576
|
} (node$1, node$1.exports));
|
@@ -2674,7 +2580,7 @@ var nodeExports = node$1.exports;
|
|
2674
2580
|
var types = {};
|
2675
2581
|
|
2676
2582
|
types.__esModule = true;
|
2677
|
-
types.UNIVERSAL = types.
|
2583
|
+
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;
|
2678
2584
|
var TAG = 'tag';
|
2679
2585
|
types.TAG = TAG;
|
2680
2586
|
var STRING = 'string';
|
@@ -2704,145 +2610,105 @@ types.UNIVERSAL = UNIVERSAL;
|
|
2704
2610
|
|
2705
2611
|
exports.__esModule = true;
|
2706
2612
|
exports["default"] = void 0;
|
2707
|
-
|
2708
2613
|
var _node = _interopRequireDefault(nodeExports);
|
2709
|
-
|
2710
2614
|
var types$1 = _interopRequireWildcard(types);
|
2711
|
-
|
2712
|
-
function
|
2713
|
-
|
2714
|
-
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; }
|
2715
|
-
|
2615
|
+
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); }
|
2616
|
+
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; }
|
2716
2617
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
2717
|
-
|
2718
|
-
function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { 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); }
|
2719
|
-
|
2618
|
+
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."); }
|
2720
2619
|
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); }
|
2721
|
-
|
2722
2620
|
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; }
|
2723
|
-
|
2724
2621
|
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); } }
|
2725
|
-
|
2726
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
2727
|
-
|
2622
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
2728
2623
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
2729
|
-
|
2730
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
2731
|
-
|
2624
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
2732
2625
|
var Container = /*#__PURE__*/function (_Node) {
|
2733
2626
|
_inheritsLoose(Container, _Node);
|
2734
|
-
|
2735
2627
|
function Container(opts) {
|
2736
2628
|
var _this;
|
2737
|
-
|
2738
2629
|
_this = _Node.call(this, opts) || this;
|
2739
|
-
|
2740
2630
|
if (!_this.nodes) {
|
2741
2631
|
_this.nodes = [];
|
2742
2632
|
}
|
2743
|
-
|
2744
2633
|
return _this;
|
2745
2634
|
}
|
2746
|
-
|
2747
2635
|
var _proto = Container.prototype;
|
2748
|
-
|
2749
2636
|
_proto.append = function append(selector) {
|
2750
2637
|
selector.parent = this;
|
2751
2638
|
this.nodes.push(selector);
|
2752
2639
|
return this;
|
2753
2640
|
};
|
2754
|
-
|
2755
2641
|
_proto.prepend = function prepend(selector) {
|
2756
2642
|
selector.parent = this;
|
2757
2643
|
this.nodes.unshift(selector);
|
2758
2644
|
return this;
|
2759
2645
|
};
|
2760
|
-
|
2761
2646
|
_proto.at = function at(index) {
|
2762
2647
|
return this.nodes[index];
|
2763
2648
|
};
|
2764
|
-
|
2765
2649
|
_proto.index = function index(child) {
|
2766
2650
|
if (typeof child === 'number') {
|
2767
2651
|
return child;
|
2768
2652
|
}
|
2769
|
-
|
2770
2653
|
return this.nodes.indexOf(child);
|
2771
2654
|
};
|
2772
|
-
|
2773
2655
|
_proto.removeChild = function removeChild(child) {
|
2774
2656
|
child = this.index(child);
|
2775
2657
|
this.at(child).parent = undefined;
|
2776
2658
|
this.nodes.splice(child, 1);
|
2777
2659
|
var index;
|
2778
|
-
|
2779
2660
|
for (var id in this.indexes) {
|
2780
2661
|
index = this.indexes[id];
|
2781
|
-
|
2782
2662
|
if (index >= child) {
|
2783
2663
|
this.indexes[id] = index - 1;
|
2784
2664
|
}
|
2785
2665
|
}
|
2786
|
-
|
2787
2666
|
return this;
|
2788
2667
|
};
|
2789
|
-
|
2790
2668
|
_proto.removeAll = function removeAll() {
|
2791
2669
|
for (var _iterator = _createForOfIteratorHelperLoose(this.nodes), _step; !(_step = _iterator()).done;) {
|
2792
2670
|
var node = _step.value;
|
2793
2671
|
node.parent = undefined;
|
2794
2672
|
}
|
2795
|
-
|
2796
2673
|
this.nodes = [];
|
2797
2674
|
return this;
|
2798
2675
|
};
|
2799
|
-
|
2800
2676
|
_proto.empty = function empty() {
|
2801
2677
|
return this.removeAll();
|
2802
2678
|
};
|
2803
|
-
|
2804
2679
|
_proto.insertAfter = function insertAfter(oldNode, newNode) {
|
2805
2680
|
newNode.parent = this;
|
2806
2681
|
var oldIndex = this.index(oldNode);
|
2807
2682
|
this.nodes.splice(oldIndex + 1, 0, newNode);
|
2808
2683
|
newNode.parent = this;
|
2809
2684
|
var index;
|
2810
|
-
|
2811
2685
|
for (var id in this.indexes) {
|
2812
2686
|
index = this.indexes[id];
|
2813
|
-
|
2814
2687
|
if (oldIndex <= index) {
|
2815
2688
|
this.indexes[id] = index + 1;
|
2816
2689
|
}
|
2817
2690
|
}
|
2818
|
-
|
2819
2691
|
return this;
|
2820
2692
|
};
|
2821
|
-
|
2822
2693
|
_proto.insertBefore = function insertBefore(oldNode, newNode) {
|
2823
2694
|
newNode.parent = this;
|
2824
2695
|
var oldIndex = this.index(oldNode);
|
2825
2696
|
this.nodes.splice(oldIndex, 0, newNode);
|
2826
2697
|
newNode.parent = this;
|
2827
2698
|
var index;
|
2828
|
-
|
2829
2699
|
for (var id in this.indexes) {
|
2830
2700
|
index = this.indexes[id];
|
2831
|
-
|
2832
2701
|
if (index <= oldIndex) {
|
2833
2702
|
this.indexes[id] = index + 1;
|
2834
2703
|
}
|
2835
2704
|
}
|
2836
|
-
|
2837
2705
|
return this;
|
2838
2706
|
};
|
2839
|
-
|
2840
2707
|
_proto._findChildAtPosition = function _findChildAtPosition(line, col) {
|
2841
2708
|
var found = undefined;
|
2842
2709
|
this.each(function (node) {
|
2843
2710
|
if (node.atPosition) {
|
2844
2711
|
var foundChild = node.atPosition(line, col);
|
2845
|
-
|
2846
2712
|
if (foundChild) {
|
2847
2713
|
found = foundChild;
|
2848
2714
|
return false;
|
@@ -2854,6 +2720,7 @@ types.UNIVERSAL = UNIVERSAL;
|
|
2854
2720
|
});
|
2855
2721
|
return found;
|
2856
2722
|
}
|
2723
|
+
|
2857
2724
|
/**
|
2858
2725
|
* Return the most specific node at the line and column number given.
|
2859
2726
|
* The source location is based on the original parsed location, locations aren't
|
@@ -2866,9 +2733,7 @@ types.UNIVERSAL = UNIVERSAL;
|
|
2866
2733
|
* If not found, returns undefined.
|
2867
2734
|
* @param {number} line The line number of the node to find. (1-based index)
|
2868
2735
|
* @param {number} col The column number of the node to find. (1-based index)
|
2869
|
-
|
2870
|
-
;
|
2871
|
-
|
2736
|
+
*/;
|
2872
2737
|
_proto.atPosition = function atPosition(line, col) {
|
2873
2738
|
if (this.isAtPosition(line, col)) {
|
2874
2739
|
return this._findChildAtPosition(line, col) || this;
|
@@ -2876,7 +2741,6 @@ types.UNIVERSAL = UNIVERSAL;
|
|
2876
2741
|
return undefined;
|
2877
2742
|
}
|
2878
2743
|
};
|
2879
|
-
|
2880
2744
|
_proto._inferEndPosition = function _inferEndPosition() {
|
2881
2745
|
if (this.last && this.last.source && this.last.source.end) {
|
2882
2746
|
this.source = this.source || {};
|
@@ -2884,195 +2748,152 @@ types.UNIVERSAL = UNIVERSAL;
|
|
2884
2748
|
Object.assign(this.source.end, this.last.source.end);
|
2885
2749
|
}
|
2886
2750
|
};
|
2887
|
-
|
2888
2751
|
_proto.each = function each(callback) {
|
2889
2752
|
if (!this.lastEach) {
|
2890
2753
|
this.lastEach = 0;
|
2891
2754
|
}
|
2892
|
-
|
2893
2755
|
if (!this.indexes) {
|
2894
2756
|
this.indexes = {};
|
2895
2757
|
}
|
2896
|
-
|
2897
2758
|
this.lastEach++;
|
2898
2759
|
var id = this.lastEach;
|
2899
2760
|
this.indexes[id] = 0;
|
2900
|
-
|
2901
2761
|
if (!this.length) {
|
2902
2762
|
return undefined;
|
2903
2763
|
}
|
2904
|
-
|
2905
2764
|
var index, result;
|
2906
|
-
|
2907
2765
|
while (this.indexes[id] < this.length) {
|
2908
2766
|
index = this.indexes[id];
|
2909
2767
|
result = callback(this.at(index), index);
|
2910
|
-
|
2911
2768
|
if (result === false) {
|
2912
2769
|
break;
|
2913
2770
|
}
|
2914
|
-
|
2915
2771
|
this.indexes[id] += 1;
|
2916
2772
|
}
|
2917
|
-
|
2918
2773
|
delete this.indexes[id];
|
2919
|
-
|
2920
2774
|
if (result === false) {
|
2921
2775
|
return false;
|
2922
2776
|
}
|
2923
2777
|
};
|
2924
|
-
|
2925
2778
|
_proto.walk = function walk(callback) {
|
2926
2779
|
return this.each(function (node, i) {
|
2927
2780
|
var result = callback(node, i);
|
2928
|
-
|
2929
2781
|
if (result !== false && node.length) {
|
2930
2782
|
result = node.walk(callback);
|
2931
2783
|
}
|
2932
|
-
|
2933
2784
|
if (result === false) {
|
2934
2785
|
return false;
|
2935
2786
|
}
|
2936
2787
|
});
|
2937
2788
|
};
|
2938
|
-
|
2939
2789
|
_proto.walkAttributes = function walkAttributes(callback) {
|
2940
2790
|
var _this2 = this;
|
2941
|
-
|
2942
2791
|
return this.walk(function (selector) {
|
2943
2792
|
if (selector.type === types$1.ATTRIBUTE) {
|
2944
2793
|
return callback.call(_this2, selector);
|
2945
2794
|
}
|
2946
2795
|
});
|
2947
2796
|
};
|
2948
|
-
|
2949
2797
|
_proto.walkClasses = function walkClasses(callback) {
|
2950
2798
|
var _this3 = this;
|
2951
|
-
|
2952
2799
|
return this.walk(function (selector) {
|
2953
2800
|
if (selector.type === types$1.CLASS) {
|
2954
2801
|
return callback.call(_this3, selector);
|
2955
2802
|
}
|
2956
2803
|
});
|
2957
2804
|
};
|
2958
|
-
|
2959
2805
|
_proto.walkCombinators = function walkCombinators(callback) {
|
2960
2806
|
var _this4 = this;
|
2961
|
-
|
2962
2807
|
return this.walk(function (selector) {
|
2963
2808
|
if (selector.type === types$1.COMBINATOR) {
|
2964
2809
|
return callback.call(_this4, selector);
|
2965
2810
|
}
|
2966
2811
|
});
|
2967
2812
|
};
|
2968
|
-
|
2969
2813
|
_proto.walkComments = function walkComments(callback) {
|
2970
2814
|
var _this5 = this;
|
2971
|
-
|
2972
2815
|
return this.walk(function (selector) {
|
2973
2816
|
if (selector.type === types$1.COMMENT) {
|
2974
2817
|
return callback.call(_this5, selector);
|
2975
2818
|
}
|
2976
2819
|
});
|
2977
2820
|
};
|
2978
|
-
|
2979
2821
|
_proto.walkIds = function walkIds(callback) {
|
2980
2822
|
var _this6 = this;
|
2981
|
-
|
2982
2823
|
return this.walk(function (selector) {
|
2983
2824
|
if (selector.type === types$1.ID) {
|
2984
2825
|
return callback.call(_this6, selector);
|
2985
2826
|
}
|
2986
2827
|
});
|
2987
2828
|
};
|
2988
|
-
|
2989
2829
|
_proto.walkNesting = function walkNesting(callback) {
|
2990
2830
|
var _this7 = this;
|
2991
|
-
|
2992
2831
|
return this.walk(function (selector) {
|
2993
2832
|
if (selector.type === types$1.NESTING) {
|
2994
2833
|
return callback.call(_this7, selector);
|
2995
2834
|
}
|
2996
2835
|
});
|
2997
2836
|
};
|
2998
|
-
|
2999
2837
|
_proto.walkPseudos = function walkPseudos(callback) {
|
3000
2838
|
var _this8 = this;
|
3001
|
-
|
3002
2839
|
return this.walk(function (selector) {
|
3003
2840
|
if (selector.type === types$1.PSEUDO) {
|
3004
2841
|
return callback.call(_this8, selector);
|
3005
2842
|
}
|
3006
2843
|
});
|
3007
2844
|
};
|
3008
|
-
|
3009
2845
|
_proto.walkTags = function walkTags(callback) {
|
3010
2846
|
var _this9 = this;
|
3011
|
-
|
3012
2847
|
return this.walk(function (selector) {
|
3013
2848
|
if (selector.type === types$1.TAG) {
|
3014
2849
|
return callback.call(_this9, selector);
|
3015
2850
|
}
|
3016
2851
|
});
|
3017
2852
|
};
|
3018
|
-
|
3019
2853
|
_proto.walkUniversals = function walkUniversals(callback) {
|
3020
2854
|
var _this10 = this;
|
3021
|
-
|
3022
2855
|
return this.walk(function (selector) {
|
3023
2856
|
if (selector.type === types$1.UNIVERSAL) {
|
3024
2857
|
return callback.call(_this10, selector);
|
3025
2858
|
}
|
3026
2859
|
});
|
3027
2860
|
};
|
3028
|
-
|
3029
2861
|
_proto.split = function split(callback) {
|
3030
2862
|
var _this11 = this;
|
3031
|
-
|
3032
2863
|
var current = [];
|
3033
2864
|
return this.reduce(function (memo, node, index) {
|
3034
2865
|
var split = callback.call(_this11, node);
|
3035
2866
|
current.push(node);
|
3036
|
-
|
3037
2867
|
if (split) {
|
3038
2868
|
memo.push(current);
|
3039
2869
|
current = [];
|
3040
2870
|
} else if (index === _this11.length - 1) {
|
3041
2871
|
memo.push(current);
|
3042
2872
|
}
|
3043
|
-
|
3044
2873
|
return memo;
|
3045
2874
|
}, []);
|
3046
2875
|
};
|
3047
|
-
|
3048
2876
|
_proto.map = function map(callback) {
|
3049
2877
|
return this.nodes.map(callback);
|
3050
2878
|
};
|
3051
|
-
|
3052
2879
|
_proto.reduce = function reduce(callback, memo) {
|
3053
2880
|
return this.nodes.reduce(callback, memo);
|
3054
2881
|
};
|
3055
|
-
|
3056
2882
|
_proto.every = function every(callback) {
|
3057
2883
|
return this.nodes.every(callback);
|
3058
2884
|
};
|
3059
|
-
|
3060
2885
|
_proto.some = function some(callback) {
|
3061
2886
|
return this.nodes.some(callback);
|
3062
2887
|
};
|
3063
|
-
|
3064
2888
|
_proto.filter = function filter(callback) {
|
3065
2889
|
return this.nodes.filter(callback);
|
3066
2890
|
};
|
3067
|
-
|
3068
2891
|
_proto.sort = function sort(callback) {
|
3069
2892
|
return this.nodes.sort(callback);
|
3070
2893
|
};
|
3071
|
-
|
3072
2894
|
_proto.toString = function toString() {
|
3073
2895
|
return this.map(String).join('');
|
3074
2896
|
};
|
3075
|
-
|
3076
2897
|
_createClass(Container, [{
|
3077
2898
|
key: "first",
|
3078
2899
|
get: function get() {
|
@@ -3089,10 +2910,8 @@ types.UNIVERSAL = UNIVERSAL;
|
|
3089
2910
|
return this.nodes.length;
|
3090
2911
|
}
|
3091
2912
|
}]);
|
3092
|
-
|
3093
2913
|
return Container;
|
3094
2914
|
}(_node["default"]);
|
3095
|
-
|
3096
2915
|
exports["default"] = Container;
|
3097
2916
|
module.exports = exports.default;
|
3098
2917
|
} (container, container.exports));
|
@@ -3103,34 +2922,22 @@ var containerExports = container.exports;
|
|
3103
2922
|
|
3104
2923
|
exports.__esModule = true;
|
3105
2924
|
exports["default"] = void 0;
|
3106
|
-
|
3107
2925
|
var _container = _interopRequireDefault(containerExports);
|
3108
|
-
|
3109
2926
|
var _types = types;
|
3110
|
-
|
3111
2927
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
3112
|
-
|
3113
2928
|
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); } }
|
3114
|
-
|
3115
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
3116
|
-
|
2929
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
3117
2930
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
3118
|
-
|
3119
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
3120
|
-
|
2931
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
3121
2932
|
var Root = /*#__PURE__*/function (_Container) {
|
3122
2933
|
_inheritsLoose(Root, _Container);
|
3123
|
-
|
3124
2934
|
function Root(opts) {
|
3125
2935
|
var _this;
|
3126
|
-
|
3127
2936
|
_this = _Container.call(this, opts) || this;
|
3128
2937
|
_this.type = _types.ROOT;
|
3129
2938
|
return _this;
|
3130
2939
|
}
|
3131
|
-
|
3132
2940
|
var _proto = Root.prototype;
|
3133
|
-
|
3134
2941
|
_proto.toString = function toString() {
|
3135
2942
|
var str = this.reduce(function (memo, selector) {
|
3136
2943
|
memo.push(String(selector));
|
@@ -3138,7 +2945,6 @@ var containerExports = container.exports;
|
|
3138
2945
|
}, []).join(',');
|
3139
2946
|
return this.trailingComma ? str + ',' : str;
|
3140
2947
|
};
|
3141
|
-
|
3142
2948
|
_proto.error = function error(message, options) {
|
3143
2949
|
if (this._error) {
|
3144
2950
|
return this._error(message, options);
|
@@ -3146,17 +2952,14 @@ var containerExports = container.exports;
|
|
3146
2952
|
return new Error(message);
|
3147
2953
|
}
|
3148
2954
|
};
|
3149
|
-
|
3150
2955
|
_createClass(Root, [{
|
3151
2956
|
key: "errorGenerator",
|
3152
2957
|
set: function set(handler) {
|
3153
2958
|
this._error = handler;
|
3154
2959
|
}
|
3155
2960
|
}]);
|
3156
|
-
|
3157
2961
|
return Root;
|
3158
2962
|
}(_container["default"]);
|
3159
|
-
|
3160
2963
|
exports["default"] = Root;
|
3161
2964
|
module.exports = exports.default;
|
3162
2965
|
} (root$1, root$1.exports));
|
@@ -3169,31 +2972,21 @@ var selector$1 = {exports: {}};
|
|
3169
2972
|
|
3170
2973
|
exports.__esModule = true;
|
3171
2974
|
exports["default"] = void 0;
|
3172
|
-
|
3173
2975
|
var _container = _interopRequireDefault(containerExports);
|
3174
|
-
|
3175
2976
|
var _types = types;
|
3176
|
-
|
3177
2977
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
3178
|
-
|
3179
2978
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
3180
|
-
|
3181
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
3182
|
-
|
2979
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
3183
2980
|
var Selector = /*#__PURE__*/function (_Container) {
|
3184
2981
|
_inheritsLoose(Selector, _Container);
|
3185
|
-
|
3186
2982
|
function Selector(opts) {
|
3187
2983
|
var _this;
|
3188
|
-
|
3189
2984
|
_this = _Container.call(this, opts) || this;
|
3190
2985
|
_this.type = _types.SELECTOR;
|
3191
2986
|
return _this;
|
3192
2987
|
}
|
3193
|
-
|
3194
2988
|
return Selector;
|
3195
2989
|
}(_container["default"]);
|
3196
|
-
|
3197
2990
|
exports["default"] = Selector;
|
3198
2991
|
module.exports = exports.default;
|
3199
2992
|
} (selector$1, selector$1.exports));
|
@@ -3315,43 +3108,28 @@ var cssesc_1 = cssesc;
|
|
3315
3108
|
|
3316
3109
|
exports.__esModule = true;
|
3317
3110
|
exports["default"] = void 0;
|
3318
|
-
|
3319
3111
|
var _cssesc = _interopRequireDefault(cssesc_1);
|
3320
|
-
|
3321
3112
|
var _util = util;
|
3322
|
-
|
3323
3113
|
var _node = _interopRequireDefault(nodeExports);
|
3324
|
-
|
3325
3114
|
var _types = types;
|
3326
|
-
|
3327
3115
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
3328
|
-
|
3329
3116
|
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); } }
|
3330
|
-
|
3331
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
3332
|
-
|
3117
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
3333
3118
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
3334
|
-
|
3335
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
3336
|
-
|
3119
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
3337
3120
|
var ClassName = /*#__PURE__*/function (_Node) {
|
3338
3121
|
_inheritsLoose(ClassName, _Node);
|
3339
|
-
|
3340
3122
|
function ClassName(opts) {
|
3341
3123
|
var _this;
|
3342
|
-
|
3343
3124
|
_this = _Node.call(this, opts) || this;
|
3344
3125
|
_this.type = _types.CLASS;
|
3345
3126
|
_this._constructed = true;
|
3346
3127
|
return _this;
|
3347
3128
|
}
|
3348
|
-
|
3349
3129
|
var _proto = ClassName.prototype;
|
3350
|
-
|
3351
3130
|
_proto.valueToString = function valueToString() {
|
3352
3131
|
return '.' + _Node.prototype.valueToString.call(this);
|
3353
3132
|
};
|
3354
|
-
|
3355
3133
|
_createClass(ClassName, [{
|
3356
3134
|
key: "value",
|
3357
3135
|
get: function get() {
|
@@ -3362,7 +3140,6 @@ var cssesc_1 = cssesc;
|
|
3362
3140
|
var escaped = (0, _cssesc["default"])(v, {
|
3363
3141
|
isIdentifier: true
|
3364
3142
|
});
|
3365
|
-
|
3366
3143
|
if (escaped !== v) {
|
3367
3144
|
(0, _util.ensureObject)(this, "raws");
|
3368
3145
|
this.raws.value = escaped;
|
@@ -3370,14 +3147,11 @@ var cssesc_1 = cssesc;
|
|
3370
3147
|
delete this.raws.value;
|
3371
3148
|
}
|
3372
3149
|
}
|
3373
|
-
|
3374
3150
|
this._value = v;
|
3375
3151
|
}
|
3376
3152
|
}]);
|
3377
|
-
|
3378
3153
|
return ClassName;
|
3379
3154
|
}(_node["default"]);
|
3380
|
-
|
3381
3155
|
exports["default"] = ClassName;
|
3382
3156
|
module.exports = exports.default;
|
3383
3157
|
} (className$1, className$1.exports));
|
@@ -3390,31 +3164,21 @@ var comment$2 = {exports: {}};
|
|
3390
3164
|
|
3391
3165
|
exports.__esModule = true;
|
3392
3166
|
exports["default"] = void 0;
|
3393
|
-
|
3394
3167
|
var _node = _interopRequireDefault(nodeExports);
|
3395
|
-
|
3396
3168
|
var _types = types;
|
3397
|
-
|
3398
3169
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
3399
|
-
|
3400
3170
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
3401
|
-
|
3402
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
3403
|
-
|
3171
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
3404
3172
|
var Comment = /*#__PURE__*/function (_Node) {
|
3405
3173
|
_inheritsLoose(Comment, _Node);
|
3406
|
-
|
3407
3174
|
function Comment(opts) {
|
3408
3175
|
var _this;
|
3409
|
-
|
3410
3176
|
_this = _Node.call(this, opts) || this;
|
3411
3177
|
_this.type = _types.COMMENT;
|
3412
3178
|
return _this;
|
3413
3179
|
}
|
3414
|
-
|
3415
3180
|
return Comment;
|
3416
3181
|
}(_node["default"]);
|
3417
|
-
|
3418
3182
|
exports["default"] = Comment;
|
3419
3183
|
module.exports = exports.default;
|
3420
3184
|
} (comment$2, comment$2.exports));
|
@@ -3427,37 +3191,25 @@ var id$1 = {exports: {}};
|
|
3427
3191
|
|
3428
3192
|
exports.__esModule = true;
|
3429
3193
|
exports["default"] = void 0;
|
3430
|
-
|
3431
3194
|
var _node = _interopRequireDefault(nodeExports);
|
3432
|
-
|
3433
3195
|
var _types = types;
|
3434
|
-
|
3435
3196
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
3436
|
-
|
3437
3197
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
3438
|
-
|
3439
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
3440
|
-
|
3198
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
3441
3199
|
var ID = /*#__PURE__*/function (_Node) {
|
3442
3200
|
_inheritsLoose(ID, _Node);
|
3443
|
-
|
3444
3201
|
function ID(opts) {
|
3445
3202
|
var _this;
|
3446
|
-
|
3447
3203
|
_this = _Node.call(this, opts) || this;
|
3448
3204
|
_this.type = _types.ID;
|
3449
3205
|
return _this;
|
3450
3206
|
}
|
3451
|
-
|
3452
3207
|
var _proto = ID.prototype;
|
3453
|
-
|
3454
3208
|
_proto.valueToString = function valueToString() {
|
3455
3209
|
return '#' + _Node.prototype.valueToString.call(this);
|
3456
3210
|
};
|
3457
|
-
|
3458
3211
|
return ID;
|
3459
3212
|
}(_node["default"]);
|
3460
|
-
|
3461
3213
|
exports["default"] = ID;
|
3462
3214
|
module.exports = exports.default;
|
3463
3215
|
} (id$1, id$1.exports));
|
@@ -3472,32 +3224,20 @@ var namespace = {exports: {}};
|
|
3472
3224
|
|
3473
3225
|
exports.__esModule = true;
|
3474
3226
|
exports["default"] = void 0;
|
3475
|
-
|
3476
3227
|
var _cssesc = _interopRequireDefault(cssesc_1);
|
3477
|
-
|
3478
3228
|
var _util = util;
|
3479
|
-
|
3480
3229
|
var _node = _interopRequireDefault(nodeExports);
|
3481
|
-
|
3482
3230
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
3483
|
-
|
3484
3231
|
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); } }
|
3485
|
-
|
3486
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
3487
|
-
|
3232
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
3488
3233
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
3489
|
-
|
3490
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
3491
|
-
|
3234
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
3492
3235
|
var Namespace = /*#__PURE__*/function (_Node) {
|
3493
3236
|
_inheritsLoose(Namespace, _Node);
|
3494
|
-
|
3495
3237
|
function Namespace() {
|
3496
3238
|
return _Node.apply(this, arguments) || this;
|
3497
3239
|
}
|
3498
|
-
|
3499
3240
|
var _proto = Namespace.prototype;
|
3500
|
-
|
3501
3241
|
_proto.qualifiedName = function qualifiedName(value) {
|
3502
3242
|
if (this.namespace) {
|
3503
3243
|
return this.namespaceString + "|" + value;
|
@@ -3505,11 +3245,9 @@ var namespace = {exports: {}};
|
|
3505
3245
|
return value;
|
3506
3246
|
}
|
3507
3247
|
};
|
3508
|
-
|
3509
3248
|
_proto.valueToString = function valueToString() {
|
3510
3249
|
return this.qualifiedName(_Node.prototype.valueToString.call(this));
|
3511
3250
|
};
|
3512
|
-
|
3513
3251
|
_createClass(Namespace, [{
|
3514
3252
|
key: "namespace",
|
3515
3253
|
get: function get() {
|
@@ -3518,19 +3256,15 @@ var namespace = {exports: {}};
|
|
3518
3256
|
set: function set(namespace) {
|
3519
3257
|
if (namespace === true || namespace === "*" || namespace === "&") {
|
3520
3258
|
this._namespace = namespace;
|
3521
|
-
|
3522
3259
|
if (this.raws) {
|
3523
3260
|
delete this.raws.namespace;
|
3524
3261
|
}
|
3525
|
-
|
3526
3262
|
return;
|
3527
3263
|
}
|
3528
|
-
|
3529
3264
|
var escaped = (0, _cssesc["default"])(namespace, {
|
3530
3265
|
isIdentifier: true
|
3531
3266
|
});
|
3532
3267
|
this._namespace = namespace;
|
3533
|
-
|
3534
3268
|
if (escaped !== namespace) {
|
3535
3269
|
(0, _util.ensureObject)(this, "raws");
|
3536
3270
|
this.raws.namespace = escaped;
|
@@ -3551,7 +3285,6 @@ var namespace = {exports: {}};
|
|
3551
3285
|
get: function get() {
|
3552
3286
|
if (this.namespace) {
|
3553
3287
|
var ns = this.stringifyProperty("namespace");
|
3554
|
-
|
3555
3288
|
if (ns === true) {
|
3556
3289
|
return '';
|
3557
3290
|
} else {
|
@@ -3562,10 +3295,8 @@ var namespace = {exports: {}};
|
|
3562
3295
|
}
|
3563
3296
|
}
|
3564
3297
|
}]);
|
3565
|
-
|
3566
3298
|
return Namespace;
|
3567
3299
|
}(_node["default"]);
|
3568
|
-
|
3569
3300
|
exports["default"] = Namespace;
|
3570
3301
|
module.exports = exports.default;
|
3571
3302
|
} (namespace, namespace.exports));
|
@@ -3576,31 +3307,21 @@ var namespaceExports = namespace.exports;
|
|
3576
3307
|
|
3577
3308
|
exports.__esModule = true;
|
3578
3309
|
exports["default"] = void 0;
|
3579
|
-
|
3580
3310
|
var _namespace = _interopRequireDefault(namespaceExports);
|
3581
|
-
|
3582
3311
|
var _types = types;
|
3583
|
-
|
3584
3312
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
3585
|
-
|
3586
3313
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
3587
|
-
|
3588
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
3589
|
-
|
3314
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
3590
3315
|
var Tag = /*#__PURE__*/function (_Namespace) {
|
3591
3316
|
_inheritsLoose(Tag, _Namespace);
|
3592
|
-
|
3593
3317
|
function Tag(opts) {
|
3594
3318
|
var _this;
|
3595
|
-
|
3596
3319
|
_this = _Namespace.call(this, opts) || this;
|
3597
3320
|
_this.type = _types.TAG;
|
3598
3321
|
return _this;
|
3599
3322
|
}
|
3600
|
-
|
3601
3323
|
return Tag;
|
3602
3324
|
}(_namespace["default"]);
|
3603
|
-
|
3604
3325
|
exports["default"] = Tag;
|
3605
3326
|
module.exports = exports.default;
|
3606
3327
|
} (tag$1, tag$1.exports));
|
@@ -3613,31 +3334,21 @@ var string$1 = {exports: {}};
|
|
3613
3334
|
|
3614
3335
|
exports.__esModule = true;
|
3615
3336
|
exports["default"] = void 0;
|
3616
|
-
|
3617
3337
|
var _node = _interopRequireDefault(nodeExports);
|
3618
|
-
|
3619
3338
|
var _types = types;
|
3620
|
-
|
3621
3339
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
3622
|
-
|
3623
3340
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
3624
|
-
|
3625
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
3626
|
-
|
3341
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
3627
3342
|
var String = /*#__PURE__*/function (_Node) {
|
3628
3343
|
_inheritsLoose(String, _Node);
|
3629
|
-
|
3630
3344
|
function String(opts) {
|
3631
3345
|
var _this;
|
3632
|
-
|
3633
3346
|
_this = _Node.call(this, opts) || this;
|
3634
3347
|
_this.type = _types.STRING;
|
3635
3348
|
return _this;
|
3636
3349
|
}
|
3637
|
-
|
3638
3350
|
return String;
|
3639
3351
|
}(_node["default"]);
|
3640
|
-
|
3641
3352
|
exports["default"] = String;
|
3642
3353
|
module.exports = exports.default;
|
3643
3354
|
} (string$1, string$1.exports));
|
@@ -3650,38 +3361,26 @@ var pseudo$1 = {exports: {}};
|
|
3650
3361
|
|
3651
3362
|
exports.__esModule = true;
|
3652
3363
|
exports["default"] = void 0;
|
3653
|
-
|
3654
3364
|
var _container = _interopRequireDefault(containerExports);
|
3655
|
-
|
3656
3365
|
var _types = types;
|
3657
|
-
|
3658
3366
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
3659
|
-
|
3660
3367
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
3661
|
-
|
3662
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
3663
|
-
|
3368
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
3664
3369
|
var Pseudo = /*#__PURE__*/function (_Container) {
|
3665
3370
|
_inheritsLoose(Pseudo, _Container);
|
3666
|
-
|
3667
3371
|
function Pseudo(opts) {
|
3668
3372
|
var _this;
|
3669
|
-
|
3670
3373
|
_this = _Container.call(this, opts) || this;
|
3671
3374
|
_this.type = _types.PSEUDO;
|
3672
3375
|
return _this;
|
3673
3376
|
}
|
3674
|
-
|
3675
3377
|
var _proto = Pseudo.prototype;
|
3676
|
-
|
3677
3378
|
_proto.toString = function toString() {
|
3678
3379
|
var params = this.length ? '(' + this.map(String).join(',') + ')' : '';
|
3679
3380
|
return [this.rawSpaceBefore, this.stringifyProperty("value"), params, this.rawSpaceAfter].join('');
|
3680
3381
|
};
|
3681
|
-
|
3682
3382
|
return Pseudo;
|
3683
3383
|
}(_container["default"]);
|
3684
|
-
|
3685
3384
|
exports["default"] = Pseudo;
|
3686
3385
|
module.exports = exports.default;
|
3687
3386
|
} (pseudo$1, pseudo$1.exports));
|
@@ -3699,98 +3398,70 @@ var node = require$$0$2.deprecate;
|
|
3699
3398
|
(function (exports) {
|
3700
3399
|
|
3701
3400
|
exports.__esModule = true;
|
3702
|
-
exports.unescapeValue = unescapeValue;
|
3703
3401
|
exports["default"] = void 0;
|
3704
|
-
|
3402
|
+
exports.unescapeValue = unescapeValue;
|
3705
3403
|
var _cssesc = _interopRequireDefault(cssesc_1);
|
3706
|
-
|
3707
3404
|
var _unesc = _interopRequireDefault(unescExports);
|
3708
|
-
|
3709
3405
|
var _namespace = _interopRequireDefault(namespaceExports);
|
3710
|
-
|
3711
3406
|
var _types = types;
|
3712
|
-
|
3713
3407
|
var _CSSESC_QUOTE_OPTIONS;
|
3714
|
-
|
3715
3408
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
3716
|
-
|
3717
3409
|
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); } }
|
3718
|
-
|
3719
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
3720
|
-
|
3410
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
3721
3411
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
3722
|
-
|
3723
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
3724
|
-
|
3412
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
3725
3413
|
var deprecate = node;
|
3726
|
-
|
3727
3414
|
var WRAPPED_IN_QUOTES = /^('|")([^]*)\1$/;
|
3728
3415
|
var warnOfDeprecatedValueAssignment = deprecate(function () {}, "Assigning an attribute a value containing characters that might need to be escaped is deprecated. " + "Call attribute.setValue() instead.");
|
3729
3416
|
var warnOfDeprecatedQuotedAssignment = deprecate(function () {}, "Assigning attr.quoted is deprecated and has no effect. Assign to attr.quoteMark instead.");
|
3730
3417
|
var warnOfDeprecatedConstructor = deprecate(function () {}, "Constructing an Attribute selector with a value without specifying quoteMark is deprecated. Note: The value should be unescaped now.");
|
3731
|
-
|
3732
3418
|
function unescapeValue(value) {
|
3733
3419
|
var deprecatedUsage = false;
|
3734
3420
|
var quoteMark = null;
|
3735
3421
|
var unescaped = value;
|
3736
3422
|
var m = unescaped.match(WRAPPED_IN_QUOTES);
|
3737
|
-
|
3738
3423
|
if (m) {
|
3739
3424
|
quoteMark = m[1];
|
3740
3425
|
unescaped = m[2];
|
3741
3426
|
}
|
3742
|
-
|
3743
3427
|
unescaped = (0, _unesc["default"])(unescaped);
|
3744
|
-
|
3745
3428
|
if (unescaped !== value) {
|
3746
3429
|
deprecatedUsage = true;
|
3747
3430
|
}
|
3748
|
-
|
3749
3431
|
return {
|
3750
3432
|
deprecatedUsage: deprecatedUsage,
|
3751
3433
|
unescaped: unescaped,
|
3752
3434
|
quoteMark: quoteMark
|
3753
3435
|
};
|
3754
3436
|
}
|
3755
|
-
|
3756
3437
|
function handleDeprecatedContructorOpts(opts) {
|
3757
3438
|
if (opts.quoteMark !== undefined) {
|
3758
3439
|
return opts;
|
3759
3440
|
}
|
3760
|
-
|
3761
3441
|
if (opts.value === undefined) {
|
3762
3442
|
return opts;
|
3763
3443
|
}
|
3764
|
-
|
3765
3444
|
warnOfDeprecatedConstructor();
|
3766
|
-
|
3767
3445
|
var _unescapeValue = unescapeValue(opts.value),
|
3768
|
-
|
3769
|
-
|
3770
|
-
|
3446
|
+
quoteMark = _unescapeValue.quoteMark,
|
3447
|
+
unescaped = _unescapeValue.unescaped;
|
3771
3448
|
if (!opts.raws) {
|
3772
3449
|
opts.raws = {};
|
3773
3450
|
}
|
3774
|
-
|
3775
3451
|
if (opts.raws.value === undefined) {
|
3776
3452
|
opts.raws.value = opts.value;
|
3777
3453
|
}
|
3778
|
-
|
3779
3454
|
opts.value = unescaped;
|
3780
3455
|
opts.quoteMark = quoteMark;
|
3781
3456
|
return opts;
|
3782
3457
|
}
|
3783
|
-
|
3784
3458
|
var Attribute = /*#__PURE__*/function (_Namespace) {
|
3785
3459
|
_inheritsLoose(Attribute, _Namespace);
|
3786
|
-
|
3787
3460
|
function Attribute(opts) {
|
3788
3461
|
var _this;
|
3789
|
-
|
3790
3462
|
if (opts === void 0) {
|
3791
3463
|
opts = {};
|
3792
3464
|
}
|
3793
|
-
|
3794
3465
|
_this = _Namespace.call(this, handleDeprecatedContructorOpts(opts)) || this;
|
3795
3466
|
_this.type = _types.ATTRIBUTE;
|
3796
3467
|
_this.raws = _this.raws || {};
|
@@ -3805,6 +3476,7 @@ var node = require$$0$2.deprecate;
|
|
3805
3476
|
_this._constructed = true;
|
3806
3477
|
return _this;
|
3807
3478
|
}
|
3479
|
+
|
3808
3480
|
/**
|
3809
3481
|
* Returns the Attribute's value quoted such that it would be legal to use
|
3810
3482
|
* in the value of a css file. The original value's quotation setting
|
@@ -3826,42 +3498,34 @@ var node = require$$0$2.deprecate;
|
|
3826
3498
|
* and the other options specified here. See the `smartQuoteMark()`
|
3827
3499
|
* method.
|
3828
3500
|
**/
|
3829
|
-
|
3830
|
-
|
3831
3501
|
var _proto = Attribute.prototype;
|
3832
|
-
|
3833
3502
|
_proto.getQuotedValue = function getQuotedValue(options) {
|
3834
3503
|
if (options === void 0) {
|
3835
3504
|
options = {};
|
3836
3505
|
}
|
3837
|
-
|
3838
3506
|
var quoteMark = this._determineQuoteMark(options);
|
3839
|
-
|
3840
3507
|
var cssescopts = CSSESC_QUOTE_OPTIONS[quoteMark];
|
3841
3508
|
var escaped = (0, _cssesc["default"])(this._value, cssescopts);
|
3842
3509
|
return escaped;
|
3843
3510
|
};
|
3844
|
-
|
3845
3511
|
_proto._determineQuoteMark = function _determineQuoteMark(options) {
|
3846
3512
|
return options.smart ? this.smartQuoteMark(options) : this.preferredQuoteMark(options);
|
3847
3513
|
}
|
3514
|
+
|
3848
3515
|
/**
|
3849
3516
|
* Set the unescaped value with the specified quotation options. The value
|
3850
3517
|
* provided must not include any wrapping quote marks -- those quotes will
|
3851
3518
|
* be interpreted as part of the value and escaped accordingly.
|
3852
|
-
|
3853
|
-
;
|
3854
|
-
|
3519
|
+
*/;
|
3855
3520
|
_proto.setValue = function setValue(value, options) {
|
3856
3521
|
if (options === void 0) {
|
3857
3522
|
options = {};
|
3858
3523
|
}
|
3859
|
-
|
3860
3524
|
this._value = value;
|
3861
3525
|
this._quoteMark = this._determineQuoteMark(options);
|
3862
|
-
|
3863
3526
|
this._syncRawValue();
|
3864
3527
|
}
|
3528
|
+
|
3865
3529
|
/**
|
3866
3530
|
* Intelligently select a quoteMark value based on the value's contents. If
|
3867
3531
|
* the value is a legal CSS ident, it will not be quoted. Otherwise a quote
|
@@ -3873,35 +3537,28 @@ var node = require$$0$2.deprecate;
|
|
3873
3537
|
*
|
3874
3538
|
* @param options This takes the quoteMark and preferCurrentQuoteMark options
|
3875
3539
|
* from the quoteValue method.
|
3876
|
-
|
3877
|
-
;
|
3878
|
-
|
3540
|
+
*/;
|
3879
3541
|
_proto.smartQuoteMark = function smartQuoteMark(options) {
|
3880
3542
|
var v = this.value;
|
3881
3543
|
var numSingleQuotes = v.replace(/[^']/g, '').length;
|
3882
3544
|
var numDoubleQuotes = v.replace(/[^"]/g, '').length;
|
3883
|
-
|
3884
3545
|
if (numSingleQuotes + numDoubleQuotes === 0) {
|
3885
3546
|
var escaped = (0, _cssesc["default"])(v, {
|
3886
3547
|
isIdentifier: true
|
3887
3548
|
});
|
3888
|
-
|
3889
3549
|
if (escaped === v) {
|
3890
3550
|
return Attribute.NO_QUOTE;
|
3891
3551
|
} else {
|
3892
3552
|
var pref = this.preferredQuoteMark(options);
|
3893
|
-
|
3894
3553
|
if (pref === Attribute.NO_QUOTE) {
|
3895
3554
|
// pick a quote mark that isn't none and see if it's smaller
|
3896
3555
|
var quote = this.quoteMark || options.quoteMark || Attribute.DOUBLE_QUOTE;
|
3897
3556
|
var opts = CSSESC_QUOTE_OPTIONS[quote];
|
3898
3557
|
var quoteValue = (0, _cssesc["default"])(v, opts);
|
3899
|
-
|
3900
3558
|
if (quoteValue.length < escaped.length) {
|
3901
3559
|
return quote;
|
3902
3560
|
}
|
3903
3561
|
}
|
3904
|
-
|
3905
3562
|
return pref;
|
3906
3563
|
}
|
3907
3564
|
} else if (numDoubleQuotes === numSingleQuotes) {
|
@@ -3912,30 +3569,24 @@ var node = require$$0$2.deprecate;
|
|
3912
3569
|
return Attribute.SINGLE_QUOTE;
|
3913
3570
|
}
|
3914
3571
|
}
|
3572
|
+
|
3915
3573
|
/**
|
3916
3574
|
* Selects the preferred quote mark based on the options and the current quote mark value.
|
3917
3575
|
* If you want the quote mark to depend on the attribute value, call `smartQuoteMark(opts)`
|
3918
3576
|
* instead.
|
3919
|
-
|
3920
|
-
;
|
3921
|
-
|
3577
|
+
*/;
|
3922
3578
|
_proto.preferredQuoteMark = function preferredQuoteMark(options) {
|
3923
3579
|
var quoteMark = options.preferCurrentQuoteMark ? this.quoteMark : options.quoteMark;
|
3924
|
-
|
3925
3580
|
if (quoteMark === undefined) {
|
3926
3581
|
quoteMark = options.preferCurrentQuoteMark ? options.quoteMark : this.quoteMark;
|
3927
3582
|
}
|
3928
|
-
|
3929
3583
|
if (quoteMark === undefined) {
|
3930
3584
|
quoteMark = Attribute.DOUBLE_QUOTE;
|
3931
3585
|
}
|
3932
|
-
|
3933
3586
|
return quoteMark;
|
3934
3587
|
};
|
3935
|
-
|
3936
3588
|
_proto._syncRawValue = function _syncRawValue() {
|
3937
3589
|
var rawValue = (0, _cssesc["default"])(this._value, CSSESC_QUOTE_OPTIONS[this.quoteMark]);
|
3938
|
-
|
3939
3590
|
if (rawValue === this._value) {
|
3940
3591
|
if (this.raws) {
|
3941
3592
|
delete this.raws.value;
|
@@ -3944,13 +3595,11 @@ var node = require$$0$2.deprecate;
|
|
3944
3595
|
this.raws.value = rawValue;
|
3945
3596
|
}
|
3946
3597
|
};
|
3947
|
-
|
3948
3598
|
_proto._handleEscapes = function _handleEscapes(prop, value) {
|
3949
3599
|
if (this._constructed) {
|
3950
3600
|
var escaped = (0, _cssesc["default"])(value, {
|
3951
3601
|
isIdentifier: true
|
3952
3602
|
});
|
3953
|
-
|
3954
3603
|
if (escaped !== value) {
|
3955
3604
|
this.raws[prop] = escaped;
|
3956
3605
|
} else {
|
@@ -3958,7 +3607,6 @@ var node = require$$0$2.deprecate;
|
|
3958
3607
|
}
|
3959
3608
|
}
|
3960
3609
|
};
|
3961
|
-
|
3962
3610
|
_proto._spacesFor = function _spacesFor(name) {
|
3963
3611
|
var attrSpaces = {
|
3964
3612
|
before: '',
|
@@ -3968,20 +3616,17 @@ var node = require$$0$2.deprecate;
|
|
3968
3616
|
var rawSpaces = this.raws.spaces && this.raws.spaces[name] || {};
|
3969
3617
|
return Object.assign(attrSpaces, spaces, rawSpaces);
|
3970
3618
|
};
|
3971
|
-
|
3972
3619
|
_proto._stringFor = function _stringFor(name, spaceName, concat) {
|
3973
3620
|
if (spaceName === void 0) {
|
3974
3621
|
spaceName = name;
|
3975
3622
|
}
|
3976
|
-
|
3977
3623
|
if (concat === void 0) {
|
3978
3624
|
concat = defaultAttrConcat;
|
3979
3625
|
}
|
3980
|
-
|
3981
3626
|
var attrSpaces = this._spacesFor(spaceName);
|
3982
|
-
|
3983
3627
|
return concat(this.stringifyProperty(name), attrSpaces);
|
3984
3628
|
}
|
3629
|
+
|
3985
3630
|
/**
|
3986
3631
|
* returns the offset of the attribute part specified relative to the
|
3987
3632
|
* start of the node of the output string.
|
@@ -3995,78 +3640,53 @@ var node = require$$0$2.deprecate;
|
|
3995
3640
|
* * "insensitive" - the case insensitivity flag;
|
3996
3641
|
* @param part One of the possible values inside an attribute.
|
3997
3642
|
* @returns -1 if the name is invalid or the value doesn't exist in this attribute.
|
3998
|
-
|
3999
|
-
;
|
4000
|
-
|
3643
|
+
*/;
|
4001
3644
|
_proto.offsetOf = function offsetOf(name) {
|
4002
3645
|
var count = 1;
|
4003
|
-
|
4004
3646
|
var attributeSpaces = this._spacesFor("attribute");
|
4005
|
-
|
4006
3647
|
count += attributeSpaces.before.length;
|
4007
|
-
|
4008
3648
|
if (name === "namespace" || name === "ns") {
|
4009
3649
|
return this.namespace ? count : -1;
|
4010
3650
|
}
|
4011
|
-
|
4012
3651
|
if (name === "attributeNS") {
|
4013
3652
|
return count;
|
4014
3653
|
}
|
4015
|
-
|
4016
3654
|
count += this.namespaceString.length;
|
4017
|
-
|
4018
3655
|
if (this.namespace) {
|
4019
3656
|
count += 1;
|
4020
3657
|
}
|
4021
|
-
|
4022
3658
|
if (name === "attribute") {
|
4023
3659
|
return count;
|
4024
3660
|
}
|
4025
|
-
|
4026
3661
|
count += this.stringifyProperty("attribute").length;
|
4027
3662
|
count += attributeSpaces.after.length;
|
4028
|
-
|
4029
3663
|
var operatorSpaces = this._spacesFor("operator");
|
4030
|
-
|
4031
3664
|
count += operatorSpaces.before.length;
|
4032
3665
|
var operator = this.stringifyProperty("operator");
|
4033
|
-
|
4034
3666
|
if (name === "operator") {
|
4035
3667
|
return operator ? count : -1;
|
4036
3668
|
}
|
4037
|
-
|
4038
3669
|
count += operator.length;
|
4039
3670
|
count += operatorSpaces.after.length;
|
4040
|
-
|
4041
3671
|
var valueSpaces = this._spacesFor("value");
|
4042
|
-
|
4043
3672
|
count += valueSpaces.before.length;
|
4044
3673
|
var value = this.stringifyProperty("value");
|
4045
|
-
|
4046
3674
|
if (name === "value") {
|
4047
3675
|
return value ? count : -1;
|
4048
3676
|
}
|
4049
|
-
|
4050
3677
|
count += value.length;
|
4051
3678
|
count += valueSpaces.after.length;
|
4052
|
-
|
4053
3679
|
var insensitiveSpaces = this._spacesFor("insensitive");
|
4054
|
-
|
4055
3680
|
count += insensitiveSpaces.before.length;
|
4056
|
-
|
4057
3681
|
if (name === "insensitive") {
|
4058
3682
|
return this.insensitive ? count : -1;
|
4059
3683
|
}
|
4060
|
-
|
4061
3684
|
return -1;
|
4062
3685
|
};
|
4063
|
-
|
4064
3686
|
_proto.toString = function toString() {
|
4065
3687
|
var _this2 = this;
|
4066
|
-
|
4067
3688
|
var selector = [this.rawSpaceBefore, '['];
|
4068
3689
|
selector.push(this._stringFor('qualifiedAttribute', 'attribute'));
|
4069
|
-
|
4070
3690
|
if (this.operator && (this.value || this.value === '')) {
|
4071
3691
|
selector.push(this._stringFor('operator'));
|
4072
3692
|
selector.push(this._stringFor('value'));
|
@@ -4074,16 +3694,13 @@ var node = require$$0$2.deprecate;
|
|
4074
3694
|
if (attrValue.length > 0 && !_this2.quoted && attrSpaces.before.length === 0 && !(_this2.spaces.value && _this2.spaces.value.after)) {
|
4075
3695
|
attrSpaces.before = " ";
|
4076
3696
|
}
|
4077
|
-
|
4078
3697
|
return defaultAttrConcat(attrValue, attrSpaces);
|
4079
3698
|
}));
|
4080
3699
|
}
|
4081
|
-
|
4082
3700
|
selector.push(']');
|
4083
3701
|
selector.push(this.rawSpaceAfter);
|
4084
3702
|
return selector.join('');
|
4085
3703
|
};
|
4086
|
-
|
4087
3704
|
_createClass(Attribute, [{
|
4088
3705
|
key: "quoted",
|
4089
3706
|
get: function get() {
|
@@ -4093,35 +3710,33 @@ var node = require$$0$2.deprecate;
|
|
4093
3710
|
set: function set(value) {
|
4094
3711
|
warnOfDeprecatedQuotedAssignment();
|
4095
3712
|
}
|
3713
|
+
|
4096
3714
|
/**
|
4097
3715
|
* returns a single (`'`) or double (`"`) quote character if the value is quoted.
|
4098
3716
|
* returns `null` if the value is not quoted.
|
4099
3717
|
* returns `undefined` if the quotation state is unknown (this can happen when
|
4100
3718
|
* the attribute is constructed without specifying a quote mark.)
|
4101
3719
|
*/
|
4102
|
-
|
4103
3720
|
}, {
|
4104
3721
|
key: "quoteMark",
|
4105
3722
|
get: function get() {
|
4106
3723
|
return this._quoteMark;
|
4107
3724
|
}
|
3725
|
+
|
4108
3726
|
/**
|
4109
3727
|
* Set the quote mark to be used by this attribute's value.
|
4110
3728
|
* If the quote mark changes, the raw (escaped) value at `attr.raws.value` of the attribute
|
4111
3729
|
* value is updated accordingly.
|
4112
3730
|
*
|
4113
3731
|
* @param {"'" | '"' | null} quoteMark The quote mark or `null` if the value should be unquoted.
|
4114
|
-
|
4115
|
-
,
|
3732
|
+
*/,
|
4116
3733
|
set: function set(quoteMark) {
|
4117
3734
|
if (!this._constructed) {
|
4118
3735
|
this._quoteMark = quoteMark;
|
4119
3736
|
return;
|
4120
3737
|
}
|
4121
|
-
|
4122
3738
|
if (this._quoteMark !== quoteMark) {
|
4123
3739
|
this._quoteMark = quoteMark;
|
4124
|
-
|
4125
3740
|
this._syncRawValue();
|
4126
3741
|
}
|
4127
3742
|
}
|
@@ -4156,21 +3771,17 @@ var node = require$$0$2.deprecate;
|
|
4156
3771
|
function set(v) {
|
4157
3772
|
if (this._constructed) {
|
4158
3773
|
var _unescapeValue2 = unescapeValue(v),
|
4159
|
-
|
4160
|
-
|
4161
|
-
|
4162
|
-
|
3774
|
+
deprecatedUsage = _unescapeValue2.deprecatedUsage,
|
3775
|
+
unescaped = _unescapeValue2.unescaped,
|
3776
|
+
quoteMark = _unescapeValue2.quoteMark;
|
4163
3777
|
if (deprecatedUsage) {
|
4164
3778
|
warnOfDeprecatedValueAssignment();
|
4165
3779
|
}
|
4166
|
-
|
4167
3780
|
if (unescaped === this._value && quoteMark === this._quoteMark) {
|
4168
3781
|
return;
|
4169
3782
|
}
|
4170
|
-
|
4171
3783
|
this._value = unescaped;
|
4172
3784
|
this._quoteMark = quoteMark;
|
4173
|
-
|
4174
3785
|
this._syncRawValue();
|
4175
3786
|
} else {
|
4176
3787
|
this._value = v;
|
@@ -4181,24 +3792,24 @@ var node = require$$0$2.deprecate;
|
|
4181
3792
|
get: function get() {
|
4182
3793
|
return this._insensitive;
|
4183
3794
|
}
|
3795
|
+
|
4184
3796
|
/**
|
4185
3797
|
* Set the case insensitive flag.
|
4186
3798
|
* If the case insensitive flag changes, the raw (escaped) value at `attr.raws.insensitiveFlag`
|
4187
3799
|
* of the attribute is updated accordingly.
|
4188
3800
|
*
|
4189
3801
|
* @param {true | false} insensitive true if the attribute should match case-insensitively.
|
4190
|
-
|
4191
|
-
,
|
3802
|
+
*/,
|
4192
3803
|
set: function set(insensitive) {
|
4193
3804
|
if (!insensitive) {
|
4194
|
-
this._insensitive = false;
|
4195
|
-
// When setting `attr.insensitive = false` both should be erased to ensure correct serialization.
|
3805
|
+
this._insensitive = false;
|
4196
3806
|
|
3807
|
+
// "i" and "I" can be used in "this.raws.insensitiveFlag" to store the original notation.
|
3808
|
+
// When setting `attr.insensitive = false` both should be erased to ensure correct serialization.
|
4197
3809
|
if (this.raws && (this.raws.insensitiveFlag === 'I' || this.raws.insensitiveFlag === 'i')) {
|
4198
3810
|
this.raws.insensitiveFlag = undefined;
|
4199
3811
|
}
|
4200
3812
|
}
|
4201
|
-
|
4202
3813
|
this._insensitive = insensitive;
|
4203
3814
|
}
|
4204
3815
|
}, {
|
@@ -4208,14 +3819,11 @@ var node = require$$0$2.deprecate;
|
|
4208
3819
|
},
|
4209
3820
|
set: function set(name) {
|
4210
3821
|
this._handleEscapes("attribute", name);
|
4211
|
-
|
4212
3822
|
this._attribute = name;
|
4213
3823
|
}
|
4214
3824
|
}]);
|
4215
|
-
|
4216
3825
|
return Attribute;
|
4217
3826
|
}(_namespace["default"]);
|
4218
|
-
|
4219
3827
|
exports["default"] = Attribute;
|
4220
3828
|
Attribute.NO_QUOTE = null;
|
4221
3829
|
Attribute.SINGLE_QUOTE = "'";
|
@@ -4232,7 +3840,6 @@ var node = require$$0$2.deprecate;
|
|
4232
3840
|
}, _CSSESC_QUOTE_OPTIONS[null] = {
|
4233
3841
|
isIdentifier: true
|
4234
3842
|
}, _CSSESC_QUOTE_OPTIONS);
|
4235
|
-
|
4236
3843
|
function defaultAttrConcat(attrValue, attrSpaces) {
|
4237
3844
|
return "" + attrSpaces.before + attrValue + attrSpaces.after;
|
4238
3845
|
}
|
@@ -4244,32 +3851,22 @@ var universal$1 = {exports: {}};
|
|
4244
3851
|
|
4245
3852
|
exports.__esModule = true;
|
4246
3853
|
exports["default"] = void 0;
|
4247
|
-
|
4248
3854
|
var _namespace = _interopRequireDefault(namespaceExports);
|
4249
|
-
|
4250
3855
|
var _types = types;
|
4251
|
-
|
4252
3856
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
4253
|
-
|
4254
3857
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
4255
|
-
|
4256
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
4257
|
-
|
3858
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
4258
3859
|
var Universal = /*#__PURE__*/function (_Namespace) {
|
4259
3860
|
_inheritsLoose(Universal, _Namespace);
|
4260
|
-
|
4261
3861
|
function Universal(opts) {
|
4262
3862
|
var _this;
|
4263
|
-
|
4264
3863
|
_this = _Namespace.call(this, opts) || this;
|
4265
3864
|
_this.type = _types.UNIVERSAL;
|
4266
3865
|
_this.value = '*';
|
4267
3866
|
return _this;
|
4268
3867
|
}
|
4269
|
-
|
4270
3868
|
return Universal;
|
4271
3869
|
}(_namespace["default"]);
|
4272
|
-
|
4273
3870
|
exports["default"] = Universal;
|
4274
3871
|
module.exports = exports.default;
|
4275
3872
|
} (universal$1, universal$1.exports));
|
@@ -4282,31 +3879,21 @@ var combinator$2 = {exports: {}};
|
|
4282
3879
|
|
4283
3880
|
exports.__esModule = true;
|
4284
3881
|
exports["default"] = void 0;
|
4285
|
-
|
4286
3882
|
var _node = _interopRequireDefault(nodeExports);
|
4287
|
-
|
4288
3883
|
var _types = types;
|
4289
|
-
|
4290
3884
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
4291
|
-
|
4292
3885
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
4293
|
-
|
4294
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
4295
|
-
|
3886
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
4296
3887
|
var Combinator = /*#__PURE__*/function (_Node) {
|
4297
3888
|
_inheritsLoose(Combinator, _Node);
|
4298
|
-
|
4299
3889
|
function Combinator(opts) {
|
4300
3890
|
var _this;
|
4301
|
-
|
4302
3891
|
_this = _Node.call(this, opts) || this;
|
4303
3892
|
_this.type = _types.COMBINATOR;
|
4304
3893
|
return _this;
|
4305
3894
|
}
|
4306
|
-
|
4307
3895
|
return Combinator;
|
4308
3896
|
}(_node["default"]);
|
4309
|
-
|
4310
3897
|
exports["default"] = Combinator;
|
4311
3898
|
module.exports = exports.default;
|
4312
3899
|
} (combinator$2, combinator$2.exports));
|
@@ -4319,32 +3906,22 @@ var nesting$1 = {exports: {}};
|
|
4319
3906
|
|
4320
3907
|
exports.__esModule = true;
|
4321
3908
|
exports["default"] = void 0;
|
4322
|
-
|
4323
3909
|
var _node = _interopRequireDefault(nodeExports);
|
4324
|
-
|
4325
3910
|
var _types = types;
|
4326
|
-
|
4327
3911
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
4328
|
-
|
4329
3912
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
4330
|
-
|
4331
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
4332
|
-
|
3913
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
4333
3914
|
var Nesting = /*#__PURE__*/function (_Node) {
|
4334
3915
|
_inheritsLoose(Nesting, _Node);
|
4335
|
-
|
4336
3916
|
function Nesting(opts) {
|
4337
3917
|
var _this;
|
4338
|
-
|
4339
3918
|
_this = _Node.call(this, opts) || this;
|
4340
3919
|
_this.type = _types.NESTING;
|
4341
3920
|
_this.value = '&';
|
4342
3921
|
return _this;
|
4343
3922
|
}
|
4344
|
-
|
4345
3923
|
return Nesting;
|
4346
3924
|
}(_node["default"]);
|
4347
|
-
|
4348
3925
|
exports["default"] = Nesting;
|
4349
3926
|
module.exports = exports.default;
|
4350
3927
|
} (nesting$1, nesting$1.exports));
|
@@ -4357,7 +3934,6 @@ var sortAscending = {exports: {}};
|
|
4357
3934
|
|
4358
3935
|
exports.__esModule = true;
|
4359
3936
|
exports["default"] = sortAscending;
|
4360
|
-
|
4361
3937
|
function sortAscending(list) {
|
4362
3938
|
return list.sort(function (a, b) {
|
4363
3939
|
return a - b;
|
@@ -4373,91 +3949,66 @@ var tokenize = {};
|
|
4373
3949
|
var tokenTypes = {};
|
4374
3950
|
|
4375
3951
|
tokenTypes.__esModule = true;
|
4376
|
-
tokenTypes.
|
3952
|
+
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;
|
4377
3953
|
var ampersand = 38; // `&`.charCodeAt(0);
|
4378
|
-
|
4379
3954
|
tokenTypes.ampersand = ampersand;
|
4380
3955
|
var asterisk = 42; // `*`.charCodeAt(0);
|
4381
|
-
|
4382
3956
|
tokenTypes.asterisk = asterisk;
|
4383
3957
|
var at = 64; // `@`.charCodeAt(0);
|
4384
|
-
|
4385
3958
|
tokenTypes.at = at;
|
4386
3959
|
var comma = 44; // `,`.charCodeAt(0);
|
4387
|
-
|
4388
3960
|
tokenTypes.comma = comma;
|
4389
3961
|
var colon = 58; // `:`.charCodeAt(0);
|
4390
|
-
|
4391
3962
|
tokenTypes.colon = colon;
|
4392
3963
|
var semicolon = 59; // `;`.charCodeAt(0);
|
4393
|
-
|
4394
3964
|
tokenTypes.semicolon = semicolon;
|
4395
3965
|
var openParenthesis = 40; // `(`.charCodeAt(0);
|
4396
|
-
|
4397
3966
|
tokenTypes.openParenthesis = openParenthesis;
|
4398
3967
|
var closeParenthesis = 41; // `)`.charCodeAt(0);
|
4399
|
-
|
4400
3968
|
tokenTypes.closeParenthesis = closeParenthesis;
|
4401
3969
|
var openSquare = 91; // `[`.charCodeAt(0);
|
4402
|
-
|
4403
3970
|
tokenTypes.openSquare = openSquare;
|
4404
3971
|
var closeSquare = 93; // `]`.charCodeAt(0);
|
4405
|
-
|
4406
3972
|
tokenTypes.closeSquare = closeSquare;
|
4407
3973
|
var dollar = 36; // `$`.charCodeAt(0);
|
4408
|
-
|
4409
3974
|
tokenTypes.dollar = dollar;
|
4410
3975
|
var tilde = 126; // `~`.charCodeAt(0);
|
4411
|
-
|
4412
3976
|
tokenTypes.tilde = tilde;
|
4413
3977
|
var caret = 94; // `^`.charCodeAt(0);
|
4414
|
-
|
4415
3978
|
tokenTypes.caret = caret;
|
4416
3979
|
var plus = 43; // `+`.charCodeAt(0);
|
4417
|
-
|
4418
3980
|
tokenTypes.plus = plus;
|
4419
3981
|
var equals = 61; // `=`.charCodeAt(0);
|
4420
|
-
|
4421
3982
|
tokenTypes.equals = equals;
|
4422
3983
|
var pipe = 124; // `|`.charCodeAt(0);
|
4423
|
-
|
4424
3984
|
tokenTypes.pipe = pipe;
|
4425
3985
|
var greaterThan = 62; // `>`.charCodeAt(0);
|
4426
|
-
|
4427
3986
|
tokenTypes.greaterThan = greaterThan;
|
4428
3987
|
var space = 32; // ` `.charCodeAt(0);
|
4429
|
-
|
4430
3988
|
tokenTypes.space = space;
|
4431
3989
|
var singleQuote = 39; // `'`.charCodeAt(0);
|
4432
|
-
|
4433
3990
|
tokenTypes.singleQuote = singleQuote;
|
4434
3991
|
var doubleQuote = 34; // `"`.charCodeAt(0);
|
4435
|
-
|
4436
3992
|
tokenTypes.doubleQuote = doubleQuote;
|
4437
3993
|
var slash = 47; // `/`.charCodeAt(0);
|
4438
|
-
|
4439
3994
|
tokenTypes.slash = slash;
|
4440
3995
|
var bang = 33; // `!`.charCodeAt(0);
|
4441
|
-
|
4442
3996
|
tokenTypes.bang = bang;
|
4443
3997
|
var backslash = 92; // '\\'.charCodeAt(0);
|
4444
|
-
|
4445
3998
|
tokenTypes.backslash = backslash;
|
4446
3999
|
var cr = 13; // '\r'.charCodeAt(0);
|
4447
|
-
|
4448
4000
|
tokenTypes.cr = cr;
|
4449
4001
|
var feed = 12; // '\f'.charCodeAt(0);
|
4450
|
-
|
4451
4002
|
tokenTypes.feed = feed;
|
4452
4003
|
var newline = 10; // '\n'.charCodeAt(0);
|
4453
|
-
|
4454
4004
|
tokenTypes.newline = newline;
|
4455
4005
|
var tab = 9; // '\t'.charCodeAt(0);
|
4456
|
-
// Expose aliases primarily for readability.
|
4457
4006
|
|
4007
|
+
// Expose aliases primarily for readability.
|
4458
4008
|
tokenTypes.tab = tab;
|
4459
|
-
var str = singleQuote;
|
4009
|
+
var str = singleQuote;
|
4460
4010
|
|
4011
|
+
// No good single character representation!
|
4461
4012
|
tokenTypes.str = str;
|
4462
4013
|
var comment$1 = -1;
|
4463
4014
|
tokenTypes.comment = comment$1;
|
@@ -4469,39 +4020,30 @@ tokenTypes.combinator = combinator$1;
|
|
4469
4020
|
(function (exports) {
|
4470
4021
|
|
4471
4022
|
exports.__esModule = true;
|
4472
|
-
exports["default"] = tokenize;
|
4473
4023
|
exports.FIELDS = void 0;
|
4474
|
-
|
4024
|
+
exports["default"] = tokenize;
|
4475
4025
|
var t = _interopRequireWildcard(tokenTypes);
|
4476
|
-
|
4477
4026
|
var _unescapable, _wordDelimiters;
|
4478
|
-
|
4479
|
-
function
|
4480
|
-
|
4481
|
-
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; }
|
4482
|
-
|
4027
|
+
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); }
|
4028
|
+
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; }
|
4483
4029
|
var unescapable = (_unescapable = {}, _unescapable[t.tab] = true, _unescapable[t.newline] = true, _unescapable[t.cr] = true, _unescapable[t.feed] = true, _unescapable);
|
4484
4030
|
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);
|
4485
4031
|
var hex = {};
|
4486
4032
|
var hexChars = "0123456789abcdefABCDEF";
|
4487
|
-
|
4488
4033
|
for (var i = 0; i < hexChars.length; i++) {
|
4489
4034
|
hex[hexChars.charCodeAt(i)] = true;
|
4490
4035
|
}
|
4036
|
+
|
4491
4037
|
/**
|
4492
4038
|
* Returns the last index of the bar css word
|
4493
4039
|
* @param {string} css The string in which the word begins
|
4494
4040
|
* @param {number} start The index into the string where word's first letter occurs
|
4495
4041
|
*/
|
4496
|
-
|
4497
|
-
|
4498
4042
|
function consumeWord(css, start) {
|
4499
4043
|
var next = start;
|
4500
4044
|
var code;
|
4501
|
-
|
4502
4045
|
do {
|
4503
4046
|
code = css.charCodeAt(next);
|
4504
|
-
|
4505
4047
|
if (wordDelimiters[code]) {
|
4506
4048
|
return next - 1;
|
4507
4049
|
} else if (code === t.backslash) {
|
@@ -4511,30 +4053,26 @@ tokenTypes.combinator = combinator$1;
|
|
4511
4053
|
next++;
|
4512
4054
|
}
|
4513
4055
|
} while (next < css.length);
|
4514
|
-
|
4515
4056
|
return next - 1;
|
4516
4057
|
}
|
4058
|
+
|
4517
4059
|
/**
|
4518
4060
|
* Returns the last index of the escape sequence
|
4519
4061
|
* @param {string} css The string in which the sequence begins
|
4520
4062
|
* @param {number} start The index into the string where escape character (`\`) occurs.
|
4521
4063
|
*/
|
4522
|
-
|
4523
|
-
|
4524
4064
|
function consumeEscape(css, start) {
|
4525
4065
|
var next = start;
|
4526
4066
|
var code = css.charCodeAt(next + 1);
|
4527
|
-
|
4528
4067
|
if (unescapable[code]) ; else if (hex[code]) {
|
4529
|
-
var hexDigits = 0;
|
4530
|
-
|
4068
|
+
var hexDigits = 0;
|
4069
|
+
// consume up to 6 hex chars
|
4531
4070
|
do {
|
4532
4071
|
next++;
|
4533
4072
|
hexDigits++;
|
4534
4073
|
code = css.charCodeAt(next + 1);
|
4535
|
-
} while (hex[code] && hexDigits < 6);
|
4536
|
-
|
4537
|
-
|
4074
|
+
} while (hex[code] && hexDigits < 6);
|
4075
|
+
// if fewer than 6 hex chars, a trailing space ends the escape
|
4538
4076
|
if (hexDigits < 6 && code === t.space) {
|
4539
4077
|
next++;
|
4540
4078
|
}
|
@@ -4542,10 +4080,8 @@ tokenTypes.combinator = combinator$1;
|
|
4542
4080
|
// the next char is part of the current word
|
4543
4081
|
next++;
|
4544
4082
|
}
|
4545
|
-
|
4546
4083
|
return next;
|
4547
4084
|
}
|
4548
|
-
|
4549
4085
|
var FIELDS = {
|
4550
4086
|
TYPE: 0,
|
4551
4087
|
START_LINE: 1,
|
@@ -4556,18 +4092,16 @@ tokenTypes.combinator = combinator$1;
|
|
4556
4092
|
END_POS: 6
|
4557
4093
|
};
|
4558
4094
|
exports.FIELDS = FIELDS;
|
4559
|
-
|
4560
4095
|
function tokenize(input) {
|
4561
4096
|
var tokens = [];
|
4562
4097
|
var css = input.css.valueOf();
|
4563
4098
|
var _css = css,
|
4564
|
-
|
4099
|
+
length = _css.length;
|
4565
4100
|
var offset = -1;
|
4566
4101
|
var line = 1;
|
4567
4102
|
var start = 0;
|
4568
4103
|
var end = 0;
|
4569
4104
|
var code, content, endColumn, endLine, escaped, escapePos, last, lines, next, nextLine, nextOffset, quote, tokenType;
|
4570
|
-
|
4571
4105
|
function unclosed(what, fix) {
|
4572
4106
|
if (input.safe) {
|
4573
4107
|
// fyi: this is never set to true.
|
@@ -4577,15 +4111,12 @@ tokenTypes.combinator = combinator$1;
|
|
4577
4111
|
throw input.error('Unclosed ' + what, line, start - offset, start);
|
4578
4112
|
}
|
4579
4113
|
}
|
4580
|
-
|
4581
4114
|
while (start < length) {
|
4582
4115
|
code = css.charCodeAt(start);
|
4583
|
-
|
4584
4116
|
if (code === t.newline) {
|
4585
4117
|
offset = start;
|
4586
4118
|
line += 1;
|
4587
4119
|
}
|
4588
|
-
|
4589
4120
|
switch (code) {
|
4590
4121
|
case t.space:
|
4591
4122
|
case t.tab:
|
@@ -4593,41 +4124,35 @@ tokenTypes.combinator = combinator$1;
|
|
4593
4124
|
case t.cr:
|
4594
4125
|
case t.feed:
|
4595
4126
|
next = start;
|
4596
|
-
|
4597
4127
|
do {
|
4598
4128
|
next += 1;
|
4599
4129
|
code = css.charCodeAt(next);
|
4600
|
-
|
4601
4130
|
if (code === t.newline) {
|
4602
4131
|
offset = next;
|
4603
4132
|
line += 1;
|
4604
4133
|
}
|
4605
4134
|
} while (code === t.space || code === t.newline || code === t.tab || code === t.cr || code === t.feed);
|
4606
|
-
|
4607
4135
|
tokenType = t.space;
|
4608
4136
|
endLine = line;
|
4609
4137
|
endColumn = next - offset - 1;
|
4610
4138
|
end = next;
|
4611
4139
|
break;
|
4612
|
-
|
4613
4140
|
case t.plus:
|
4614
4141
|
case t.greaterThan:
|
4615
4142
|
case t.tilde:
|
4616
4143
|
case t.pipe:
|
4617
4144
|
next = start;
|
4618
|
-
|
4619
4145
|
do {
|
4620
4146
|
next += 1;
|
4621
4147
|
code = css.charCodeAt(next);
|
4622
4148
|
} while (code === t.plus || code === t.greaterThan || code === t.tilde || code === t.pipe);
|
4623
|
-
|
4624
4149
|
tokenType = t.combinator;
|
4625
4150
|
endLine = line;
|
4626
4151
|
endColumn = start - offset;
|
4627
4152
|
end = next;
|
4628
4153
|
break;
|
4629
|
-
// Consume these characters as single tokens.
|
4630
4154
|
|
4155
|
+
// Consume these characters as single tokens.
|
4631
4156
|
case t.asterisk:
|
4632
4157
|
case t.ampersand:
|
4633
4158
|
case t.bang:
|
@@ -4647,46 +4172,36 @@ tokenTypes.combinator = combinator$1;
|
|
4647
4172
|
endColumn = start - offset;
|
4648
4173
|
end = next + 1;
|
4649
4174
|
break;
|
4650
|
-
|
4651
4175
|
case t.singleQuote:
|
4652
4176
|
case t.doubleQuote:
|
4653
4177
|
quote = code === t.singleQuote ? "'" : '"';
|
4654
4178
|
next = start;
|
4655
|
-
|
4656
4179
|
do {
|
4657
4180
|
escaped = false;
|
4658
4181
|
next = css.indexOf(quote, next + 1);
|
4659
|
-
|
4660
4182
|
if (next === -1) {
|
4661
4183
|
unclosed('quote', quote);
|
4662
4184
|
}
|
4663
|
-
|
4664
4185
|
escapePos = next;
|
4665
|
-
|
4666
4186
|
while (css.charCodeAt(escapePos - 1) === t.backslash) {
|
4667
4187
|
escapePos -= 1;
|
4668
4188
|
escaped = !escaped;
|
4669
4189
|
}
|
4670
4190
|
} while (escaped);
|
4671
|
-
|
4672
4191
|
tokenType = t.str;
|
4673
4192
|
endLine = line;
|
4674
4193
|
endColumn = start - offset;
|
4675
4194
|
end = next + 1;
|
4676
4195
|
break;
|
4677
|
-
|
4678
4196
|
default:
|
4679
4197
|
if (code === t.slash && css.charCodeAt(start + 1) === t.asterisk) {
|
4680
4198
|
next = css.indexOf('*/', start + 2) + 1;
|
4681
|
-
|
4682
4199
|
if (next === 0) {
|
4683
4200
|
unclosed('comment', '*/');
|
4684
4201
|
}
|
4685
|
-
|
4686
4202
|
content = css.slice(start, next + 1);
|
4687
4203
|
lines = content.split('\n');
|
4688
4204
|
last = lines.length - 1;
|
4689
|
-
|
4690
4205
|
if (last > 0) {
|
4691
4206
|
nextLine = line + last;
|
4692
4207
|
nextOffset = next - lines[last].length;
|
@@ -4694,7 +4209,6 @@ tokenTypes.combinator = combinator$1;
|
|
4694
4209
|
nextLine = line;
|
4695
4210
|
nextOffset = offset;
|
4696
4211
|
}
|
4697
|
-
|
4698
4212
|
tokenType = t.comment;
|
4699
4213
|
line = nextLine;
|
4700
4214
|
endLine = nextLine;
|
@@ -4711,29 +4225,33 @@ tokenTypes.combinator = combinator$1;
|
|
4711
4225
|
endLine = line;
|
4712
4226
|
endColumn = next - offset;
|
4713
4227
|
}
|
4714
|
-
|
4715
4228
|
end = next + 1;
|
4716
4229
|
break;
|
4717
|
-
}
|
4718
|
-
|
4230
|
+
}
|
4719
4231
|
|
4720
|
-
|
4721
|
-
|
4722
|
-
|
4723
|
-
|
4724
|
-
|
4725
|
-
start
|
4232
|
+
// Ensure that the token structure remains consistent
|
4233
|
+
tokens.push([tokenType,
|
4234
|
+
// [0] Token type
|
4235
|
+
line,
|
4236
|
+
// [1] Starting line
|
4237
|
+
start - offset,
|
4238
|
+
// [2] Starting column
|
4239
|
+
endLine,
|
4240
|
+
// [3] Ending line
|
4241
|
+
endColumn,
|
4242
|
+
// [4] Ending column
|
4243
|
+
start,
|
4244
|
+
// [5] Start position / Source index
|
4726
4245
|
end // [6] End position
|
4727
|
-
]);
|
4246
|
+
]);
|
4728
4247
|
|
4248
|
+
// Reset offset for the next token
|
4729
4249
|
if (nextOffset) {
|
4730
4250
|
offset = nextOffset;
|
4731
4251
|
nextOffset = null;
|
4732
4252
|
}
|
4733
|
-
|
4734
4253
|
start = end;
|
4735
4254
|
}
|
4736
|
-
|
4737
4255
|
return tokens;
|
4738
4256
|
}
|
4739
4257
|
} (tokenize));
|
@@ -4742,70 +4260,43 @@ tokenTypes.combinator = combinator$1;
|
|
4742
4260
|
|
4743
4261
|
exports.__esModule = true;
|
4744
4262
|
exports["default"] = void 0;
|
4745
|
-
|
4746
4263
|
var _root = _interopRequireDefault(rootExports);
|
4747
|
-
|
4748
4264
|
var _selector = _interopRequireDefault(selectorExports);
|
4749
|
-
|
4750
4265
|
var _className = _interopRequireDefault(classNameExports);
|
4751
|
-
|
4752
4266
|
var _comment = _interopRequireDefault(commentExports);
|
4753
|
-
|
4754
4267
|
var _id = _interopRequireDefault(idExports);
|
4755
|
-
|
4756
4268
|
var _tag = _interopRequireDefault(tagExports);
|
4757
|
-
|
4758
4269
|
var _string = _interopRequireDefault(stringExports);
|
4759
|
-
|
4760
4270
|
var _pseudo = _interopRequireDefault(pseudoExports);
|
4761
|
-
|
4762
4271
|
var _attribute = _interopRequireWildcard(attribute$1);
|
4763
|
-
|
4764
4272
|
var _universal = _interopRequireDefault(universalExports);
|
4765
|
-
|
4766
4273
|
var _combinator = _interopRequireDefault(combinatorExports);
|
4767
|
-
|
4768
4274
|
var _nesting = _interopRequireDefault(nestingExports);
|
4769
|
-
|
4770
4275
|
var _sortAscending = _interopRequireDefault(sortAscendingExports);
|
4771
|
-
|
4772
4276
|
var _tokenize = _interopRequireWildcard(tokenize);
|
4773
|
-
|
4774
4277
|
var tokens = _interopRequireWildcard(tokenTypes);
|
4775
|
-
|
4776
4278
|
var types$1 = _interopRequireWildcard(types);
|
4777
|
-
|
4778
4279
|
var _util = util;
|
4779
|
-
|
4780
4280
|
var _WHITESPACE_TOKENS, _Object$assign;
|
4781
|
-
|
4782
|
-
function
|
4783
|
-
|
4784
|
-
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; }
|
4785
|
-
|
4281
|
+
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); }
|
4282
|
+
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; }
|
4786
4283
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
4787
|
-
|
4788
4284
|
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); } }
|
4789
|
-
|
4790
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
4791
|
-
|
4285
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
4792
4286
|
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);
|
4793
4287
|
var WHITESPACE_EQUIV_TOKENS = Object.assign({}, WHITESPACE_TOKENS, (_Object$assign = {}, _Object$assign[tokens.comment] = true, _Object$assign));
|
4794
|
-
|
4795
4288
|
function tokenStart(token) {
|
4796
4289
|
return {
|
4797
4290
|
line: token[_tokenize.FIELDS.START_LINE],
|
4798
4291
|
column: token[_tokenize.FIELDS.START_COL]
|
4799
4292
|
};
|
4800
4293
|
}
|
4801
|
-
|
4802
4294
|
function tokenEnd(token) {
|
4803
4295
|
return {
|
4804
4296
|
line: token[_tokenize.FIELDS.END_LINE],
|
4805
4297
|
column: token[_tokenize.FIELDS.END_COL]
|
4806
4298
|
};
|
4807
4299
|
}
|
4808
|
-
|
4809
4300
|
function getSource(startLine, startColumn, endLine, endColumn) {
|
4810
4301
|
return {
|
4811
4302
|
start: {
|
@@ -4818,62 +4309,48 @@ tokenTypes.combinator = combinator$1;
|
|
4818
4309
|
}
|
4819
4310
|
};
|
4820
4311
|
}
|
4821
|
-
|
4822
4312
|
function getTokenSource(token) {
|
4823
4313
|
return getSource(token[_tokenize.FIELDS.START_LINE], token[_tokenize.FIELDS.START_COL], token[_tokenize.FIELDS.END_LINE], token[_tokenize.FIELDS.END_COL]);
|
4824
4314
|
}
|
4825
|
-
|
4826
4315
|
function getTokenSourceSpan(startToken, endToken) {
|
4827
4316
|
if (!startToken) {
|
4828
4317
|
return undefined;
|
4829
4318
|
}
|
4830
|
-
|
4831
4319
|
return getSource(startToken[_tokenize.FIELDS.START_LINE], startToken[_tokenize.FIELDS.START_COL], endToken[_tokenize.FIELDS.END_LINE], endToken[_tokenize.FIELDS.END_COL]);
|
4832
4320
|
}
|
4833
|
-
|
4834
4321
|
function unescapeProp(node, prop) {
|
4835
4322
|
var value = node[prop];
|
4836
|
-
|
4837
4323
|
if (typeof value !== "string") {
|
4838
4324
|
return;
|
4839
4325
|
}
|
4840
|
-
|
4841
4326
|
if (value.indexOf("\\") !== -1) {
|
4842
4327
|
(0, _util.ensureObject)(node, 'raws');
|
4843
4328
|
node[prop] = (0, _util.unesc)(value);
|
4844
|
-
|
4845
4329
|
if (node.raws[prop] === undefined) {
|
4846
4330
|
node.raws[prop] = value;
|
4847
4331
|
}
|
4848
4332
|
}
|
4849
|
-
|
4850
4333
|
return node;
|
4851
4334
|
}
|
4852
|
-
|
4853
4335
|
function indexesOf(array, item) {
|
4854
4336
|
var i = -1;
|
4855
4337
|
var indexes = [];
|
4856
|
-
|
4857
4338
|
while ((i = array.indexOf(item, i + 1)) !== -1) {
|
4858
4339
|
indexes.push(i);
|
4859
4340
|
}
|
4860
|
-
|
4861
4341
|
return indexes;
|
4862
4342
|
}
|
4863
|
-
|
4864
4343
|
function uniqs() {
|
4865
4344
|
var list = Array.prototype.concat.apply([], arguments);
|
4866
4345
|
return list.filter(function (item, i) {
|
4867
4346
|
return i === list.indexOf(item);
|
4868
4347
|
});
|
4869
4348
|
}
|
4870
|
-
|
4871
4349
|
var Parser = /*#__PURE__*/function () {
|
4872
4350
|
function Parser(rule, options) {
|
4873
4351
|
if (options === void 0) {
|
4874
4352
|
options = {};
|
4875
4353
|
}
|
4876
|
-
|
4877
4354
|
this.rule = rule;
|
4878
4355
|
this.options = Object.assign({
|
4879
4356
|
lossy: false,
|
@@ -4897,62 +4374,51 @@ tokenTypes.combinator = combinator$1;
|
|
4897
4374
|
line: 1,
|
4898
4375
|
column: 1
|
4899
4376
|
}
|
4900
|
-
}
|
4377
|
+
},
|
4378
|
+
sourceIndex: 0
|
4901
4379
|
});
|
4902
4380
|
this.root.append(selector);
|
4903
4381
|
this.current = selector;
|
4904
4382
|
this.loop();
|
4905
4383
|
}
|
4906
|
-
|
4907
4384
|
var _proto = Parser.prototype;
|
4908
|
-
|
4909
4385
|
_proto._errorGenerator = function _errorGenerator() {
|
4910
4386
|
var _this = this;
|
4911
|
-
|
4912
4387
|
return function (message, errorOptions) {
|
4913
4388
|
if (typeof _this.rule === 'string') {
|
4914
4389
|
return new Error(message);
|
4915
4390
|
}
|
4916
|
-
|
4917
4391
|
return _this.rule.error(message, errorOptions);
|
4918
4392
|
};
|
4919
4393
|
};
|
4920
|
-
|
4921
4394
|
_proto.attribute = function attribute() {
|
4922
4395
|
var attr = [];
|
4923
4396
|
var startingToken = this.currToken;
|
4924
4397
|
this.position++;
|
4925
|
-
|
4926
4398
|
while (this.position < this.tokens.length && this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) {
|
4927
4399
|
attr.push(this.currToken);
|
4928
4400
|
this.position++;
|
4929
4401
|
}
|
4930
|
-
|
4931
4402
|
if (this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) {
|
4932
4403
|
return this.expected('closing square bracket', this.currToken[_tokenize.FIELDS.START_POS]);
|
4933
4404
|
}
|
4934
|
-
|
4935
4405
|
var len = attr.length;
|
4936
4406
|
var node = {
|
4937
4407
|
source: getSource(startingToken[1], startingToken[2], this.currToken[3], this.currToken[4]),
|
4938
4408
|
sourceIndex: startingToken[_tokenize.FIELDS.START_POS]
|
4939
4409
|
};
|
4940
|
-
|
4941
4410
|
if (len === 1 && !~[tokens.word].indexOf(attr[0][_tokenize.FIELDS.TYPE])) {
|
4942
4411
|
return this.expected('attribute', attr[0][_tokenize.FIELDS.START_POS]);
|
4943
4412
|
}
|
4944
|
-
|
4945
4413
|
var pos = 0;
|
4946
4414
|
var spaceBefore = '';
|
4947
4415
|
var commentBefore = '';
|
4948
4416
|
var lastAdded = null;
|
4949
4417
|
var spaceAfterMeaningfulToken = false;
|
4950
|
-
|
4951
4418
|
while (pos < len) {
|
4952
4419
|
var token = attr[pos];
|
4953
4420
|
var content = this.content(token);
|
4954
4421
|
var next = attr[pos + 1];
|
4955
|
-
|
4956
4422
|
switch (token[_tokenize.FIELDS.TYPE]) {
|
4957
4423
|
case tokens.space:
|
4958
4424
|
// if (
|
@@ -4962,17 +4428,14 @@ tokenTypes.combinator = combinator$1;
|
|
4962
4428
|
// return this.expected('attribute', token[TOKEN.START_POS], content);
|
4963
4429
|
// }
|
4964
4430
|
spaceAfterMeaningfulToken = true;
|
4965
|
-
|
4966
4431
|
if (this.options.lossy) {
|
4967
4432
|
break;
|
4968
4433
|
}
|
4969
|
-
|
4970
4434
|
if (lastAdded) {
|
4971
4435
|
(0, _util.ensureObject)(node, 'spaces', lastAdded);
|
4972
4436
|
var prevContent = node.spaces[lastAdded].after || '';
|
4973
4437
|
node.spaces[lastAdded].after = prevContent + content;
|
4974
4438
|
var existingComment = (0, _util.getProp)(node, 'raws', 'spaces', lastAdded, 'after') || null;
|
4975
|
-
|
4976
4439
|
if (existingComment) {
|
4977
4440
|
node.raws.spaces[lastAdded].after = existingComment + content;
|
4978
4441
|
}
|
@@ -4980,9 +4443,7 @@ tokenTypes.combinator = combinator$1;
|
|
4980
4443
|
spaceBefore = spaceBefore + content;
|
4981
4444
|
commentBefore = commentBefore + content;
|
4982
4445
|
}
|
4983
|
-
|
4984
4446
|
break;
|
4985
|
-
|
4986
4447
|
case tokens.asterisk:
|
4987
4448
|
if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
|
4988
4449
|
node.operator = content;
|
@@ -4993,72 +4454,57 @@ tokenTypes.combinator = combinator$1;
|
|
4993
4454
|
node.spaces.attribute.before = spaceBefore;
|
4994
4455
|
spaceBefore = '';
|
4995
4456
|
}
|
4996
|
-
|
4997
4457
|
if (commentBefore) {
|
4998
4458
|
(0, _util.ensureObject)(node, 'raws', 'spaces', 'attribute');
|
4999
4459
|
node.raws.spaces.attribute.before = spaceBefore;
|
5000
4460
|
commentBefore = '';
|
5001
4461
|
}
|
5002
|
-
|
5003
4462
|
node.namespace = (node.namespace || "") + content;
|
5004
4463
|
var rawValue = (0, _util.getProp)(node, 'raws', 'namespace') || null;
|
5005
|
-
|
5006
4464
|
if (rawValue) {
|
5007
4465
|
node.raws.namespace += content;
|
5008
4466
|
}
|
5009
|
-
|
5010
4467
|
lastAdded = 'namespace';
|
5011
4468
|
}
|
5012
|
-
|
5013
4469
|
spaceAfterMeaningfulToken = false;
|
5014
4470
|
break;
|
5015
|
-
|
5016
4471
|
case tokens.dollar:
|
5017
4472
|
if (lastAdded === "value") {
|
5018
4473
|
var oldRawValue = (0, _util.getProp)(node, 'raws', 'value');
|
5019
4474
|
node.value += "$";
|
5020
|
-
|
5021
4475
|
if (oldRawValue) {
|
5022
4476
|
node.raws.value = oldRawValue + "$";
|
5023
4477
|
}
|
5024
|
-
|
5025
4478
|
break;
|
5026
4479
|
}
|
5027
|
-
|
5028
4480
|
// Falls through
|
5029
|
-
|
5030
4481
|
case tokens.caret:
|
5031
4482
|
if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
|
5032
4483
|
node.operator = content;
|
5033
4484
|
lastAdded = 'operator';
|
5034
4485
|
}
|
5035
|
-
|
5036
4486
|
spaceAfterMeaningfulToken = false;
|
5037
4487
|
break;
|
5038
|
-
|
5039
4488
|
case tokens.combinator:
|
5040
4489
|
if (content === '~' && next[_tokenize.FIELDS.TYPE] === tokens.equals) {
|
5041
4490
|
node.operator = content;
|
5042
4491
|
lastAdded = 'operator';
|
5043
4492
|
}
|
5044
|
-
|
5045
4493
|
if (content !== '|') {
|
5046
4494
|
spaceAfterMeaningfulToken = false;
|
5047
4495
|
break;
|
5048
4496
|
}
|
5049
|
-
|
5050
4497
|
if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
|
5051
4498
|
node.operator = content;
|
5052
4499
|
lastAdded = 'operator';
|
5053
4500
|
} else if (!node.namespace && !node.attribute) {
|
5054
4501
|
node.namespace = true;
|
5055
4502
|
}
|
5056
|
-
|
5057
4503
|
spaceAfterMeaningfulToken = false;
|
5058
4504
|
break;
|
5059
|
-
|
5060
4505
|
case tokens.word:
|
5061
|
-
if (next && this.content(next) === '|' && attr[pos + 2] && attr[pos + 2][_tokenize.FIELDS.TYPE] !== tokens.equals &&
|
4506
|
+
if (next && this.content(next) === '|' && attr[pos + 2] && attr[pos + 2][_tokenize.FIELDS.TYPE] !== tokens.equals &&
|
4507
|
+
// this look-ahead probably fails with comment nodes involved.
|
5062
4508
|
!node.operator && !node.namespace) {
|
5063
4509
|
node.namespace = content;
|
5064
4510
|
lastAdded = 'namespace';
|
@@ -5068,56 +4514,42 @@ tokenTypes.combinator = combinator$1;
|
|
5068
4514
|
node.spaces.attribute.before = spaceBefore;
|
5069
4515
|
spaceBefore = '';
|
5070
4516
|
}
|
5071
|
-
|
5072
4517
|
if (commentBefore) {
|
5073
4518
|
(0, _util.ensureObject)(node, 'raws', 'spaces', 'attribute');
|
5074
4519
|
node.raws.spaces.attribute.before = commentBefore;
|
5075
4520
|
commentBefore = '';
|
5076
4521
|
}
|
5077
|
-
|
5078
4522
|
node.attribute = (node.attribute || "") + content;
|
5079
|
-
|
5080
4523
|
var _rawValue = (0, _util.getProp)(node, 'raws', 'attribute') || null;
|
5081
|
-
|
5082
4524
|
if (_rawValue) {
|
5083
4525
|
node.raws.attribute += content;
|
5084
4526
|
}
|
5085
|
-
|
5086
4527
|
lastAdded = 'attribute';
|
5087
4528
|
} else if (!node.value && node.value !== "" || lastAdded === "value" && !(spaceAfterMeaningfulToken || node.quoteMark)) {
|
5088
4529
|
var _unescaped = (0, _util.unesc)(content);
|
5089
|
-
|
5090
4530
|
var _oldRawValue = (0, _util.getProp)(node, 'raws', 'value') || '';
|
5091
|
-
|
5092
4531
|
var oldValue = node.value || '';
|
5093
4532
|
node.value = oldValue + _unescaped;
|
5094
4533
|
node.quoteMark = null;
|
5095
|
-
|
5096
4534
|
if (_unescaped !== content || _oldRawValue) {
|
5097
4535
|
(0, _util.ensureObject)(node, 'raws');
|
5098
4536
|
node.raws.value = (_oldRawValue || oldValue) + content;
|
5099
4537
|
}
|
5100
|
-
|
5101
4538
|
lastAdded = 'value';
|
5102
4539
|
} else {
|
5103
4540
|
var insensitive = content === 'i' || content === "I";
|
5104
|
-
|
5105
4541
|
if ((node.value || node.value === '') && (node.quoteMark || spaceAfterMeaningfulToken)) {
|
5106
4542
|
node.insensitive = insensitive;
|
5107
|
-
|
5108
4543
|
if (!insensitive || content === "I") {
|
5109
4544
|
(0, _util.ensureObject)(node, 'raws');
|
5110
4545
|
node.raws.insensitiveFlag = content;
|
5111
4546
|
}
|
5112
|
-
|
5113
4547
|
lastAdded = 'insensitive';
|
5114
|
-
|
5115
4548
|
if (spaceBefore) {
|
5116
4549
|
(0, _util.ensureObject)(node, 'spaces', 'insensitive');
|
5117
4550
|
node.spaces.insensitive.before = spaceBefore;
|
5118
4551
|
spaceBefore = '';
|
5119
4552
|
}
|
5120
|
-
|
5121
4553
|
if (commentBefore) {
|
5122
4554
|
(0, _util.ensureObject)(node, 'raws', 'spaces', 'insensitive');
|
5123
4555
|
node.raws.spaces.insensitive.before = commentBefore;
|
@@ -5126,27 +4558,22 @@ tokenTypes.combinator = combinator$1;
|
|
5126
4558
|
} else if (node.value || node.value === '') {
|
5127
4559
|
lastAdded = 'value';
|
5128
4560
|
node.value += content;
|
5129
|
-
|
5130
4561
|
if (node.raws.value) {
|
5131
4562
|
node.raws.value += content;
|
5132
4563
|
}
|
5133
4564
|
}
|
5134
4565
|
}
|
5135
|
-
|
5136
4566
|
spaceAfterMeaningfulToken = false;
|
5137
4567
|
break;
|
5138
|
-
|
5139
4568
|
case tokens.str:
|
5140
4569
|
if (!node.attribute || !node.operator) {
|
5141
4570
|
return this.error("Expected an attribute followed by an operator preceding the string.", {
|
5142
4571
|
index: token[_tokenize.FIELDS.START_POS]
|
5143
4572
|
});
|
5144
4573
|
}
|
5145
|
-
|
5146
4574
|
var _unescapeValue = (0, _attribute.unescapeValue)(content),
|
5147
|
-
|
5148
|
-
|
5149
|
-
|
4575
|
+
unescaped = _unescapeValue.unescaped,
|
4576
|
+
quoteMark = _unescapeValue.quoteMark;
|
5150
4577
|
node.value = unescaped;
|
5151
4578
|
node.quoteMark = quoteMark;
|
5152
4579
|
lastAdded = 'value';
|
@@ -5154,23 +4581,19 @@ tokenTypes.combinator = combinator$1;
|
|
5154
4581
|
node.raws.value = content;
|
5155
4582
|
spaceAfterMeaningfulToken = false;
|
5156
4583
|
break;
|
5157
|
-
|
5158
4584
|
case tokens.equals:
|
5159
4585
|
if (!node.attribute) {
|
5160
4586
|
return this.expected('attribute', token[_tokenize.FIELDS.START_POS], content);
|
5161
4587
|
}
|
5162
|
-
|
5163
4588
|
if (node.value) {
|
5164
4589
|
return this.error('Unexpected "=" found; an operator was already defined.', {
|
5165
4590
|
index: token[_tokenize.FIELDS.START_POS]
|
5166
4591
|
});
|
5167
4592
|
}
|
5168
|
-
|
5169
4593
|
node.operator = node.operator ? node.operator + content : content;
|
5170
4594
|
lastAdded = 'operator';
|
5171
4595
|
spaceAfterMeaningfulToken = false;
|
5172
4596
|
break;
|
5173
|
-
|
5174
4597
|
case tokens.comment:
|
5175
4598
|
if (lastAdded) {
|
5176
4599
|
if (spaceAfterMeaningfulToken || next && next[_tokenize.FIELDS.TYPE] === tokens.space || lastAdded === 'insensitive') {
|
@@ -5187,23 +4610,20 @@ tokenTypes.combinator = combinator$1;
|
|
5187
4610
|
} else {
|
5188
4611
|
commentBefore = commentBefore + content;
|
5189
4612
|
}
|
5190
|
-
|
5191
4613
|
break;
|
5192
|
-
|
5193
4614
|
default:
|
5194
4615
|
return this.error("Unexpected \"" + content + "\" found.", {
|
5195
4616
|
index: token[_tokenize.FIELDS.START_POS]
|
5196
4617
|
});
|
5197
4618
|
}
|
5198
|
-
|
5199
4619
|
pos++;
|
5200
4620
|
}
|
5201
|
-
|
5202
4621
|
unescapeProp(node, "attribute");
|
5203
4622
|
unescapeProp(node, "namespace");
|
5204
4623
|
this.newNode(new _attribute["default"](node));
|
5205
4624
|
this.position++;
|
5206
4625
|
}
|
4626
|
+
|
5207
4627
|
/**
|
5208
4628
|
* return a node containing meaningless garbage up to (but not including) the specified token position.
|
5209
4629
|
* if the token position is negative, all remaining tokens are consumed.
|
@@ -5215,19 +4635,15 @@ tokenTypes.combinator = combinator$1;
|
|
5215
4635
|
* a previous node's space metadata.
|
5216
4636
|
*
|
5217
4637
|
* In lossy mode, this returns only comments.
|
5218
|
-
|
5219
|
-
;
|
5220
|
-
|
4638
|
+
*/;
|
5221
4639
|
_proto.parseWhitespaceEquivalentTokens = function parseWhitespaceEquivalentTokens(stopPosition) {
|
5222
4640
|
if (stopPosition < 0) {
|
5223
4641
|
stopPosition = this.tokens.length;
|
5224
4642
|
}
|
5225
|
-
|
5226
4643
|
var startPosition = this.position;
|
5227
4644
|
var nodes = [];
|
5228
4645
|
var space = "";
|
5229
4646
|
var lastComment = undefined;
|
5230
|
-
|
5231
4647
|
do {
|
5232
4648
|
if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) {
|
5233
4649
|
if (!this.options.lossy) {
|
@@ -5235,12 +4651,10 @@ tokenTypes.combinator = combinator$1;
|
|
5235
4651
|
}
|
5236
4652
|
} else if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.comment) {
|
5237
4653
|
var spaces = {};
|
5238
|
-
|
5239
4654
|
if (space) {
|
5240
4655
|
spaces.before = space;
|
5241
4656
|
space = "";
|
5242
4657
|
}
|
5243
|
-
|
5244
4658
|
lastComment = new _comment["default"]({
|
5245
4659
|
value: this.content(),
|
5246
4660
|
source: getTokenSource(this.currToken),
|
@@ -5250,7 +4664,6 @@ tokenTypes.combinator = combinator$1;
|
|
5250
4664
|
nodes.push(lastComment);
|
5251
4665
|
}
|
5252
4666
|
} while (++this.position < stopPosition);
|
5253
|
-
|
5254
4667
|
if (space) {
|
5255
4668
|
if (lastComment) {
|
5256
4669
|
lastComment.spaces.after = space;
|
@@ -5268,62 +4681,49 @@ tokenTypes.combinator = combinator$1;
|
|
5268
4681
|
}));
|
5269
4682
|
}
|
5270
4683
|
}
|
5271
|
-
|
5272
4684
|
return nodes;
|
5273
4685
|
}
|
4686
|
+
|
5274
4687
|
/**
|
5275
4688
|
*
|
5276
4689
|
* @param {*} nodes
|
5277
|
-
|
5278
|
-
;
|
5279
|
-
|
4690
|
+
*/;
|
5280
4691
|
_proto.convertWhitespaceNodesToSpace = function convertWhitespaceNodesToSpace(nodes, requiredSpace) {
|
5281
4692
|
var _this2 = this;
|
5282
|
-
|
5283
4693
|
if (requiredSpace === void 0) {
|
5284
4694
|
requiredSpace = false;
|
5285
4695
|
}
|
5286
|
-
|
5287
4696
|
var space = "";
|
5288
4697
|
var rawSpace = "";
|
5289
4698
|
nodes.forEach(function (n) {
|
5290
4699
|
var spaceBefore = _this2.lossySpace(n.spaces.before, requiredSpace);
|
5291
|
-
|
5292
4700
|
var rawSpaceBefore = _this2.lossySpace(n.rawSpaceBefore, requiredSpace);
|
5293
|
-
|
5294
4701
|
space += spaceBefore + _this2.lossySpace(n.spaces.after, requiredSpace && spaceBefore.length === 0);
|
5295
4702
|
rawSpace += spaceBefore + n.value + _this2.lossySpace(n.rawSpaceAfter, requiredSpace && rawSpaceBefore.length === 0);
|
5296
4703
|
});
|
5297
|
-
|
5298
4704
|
if (rawSpace === space) {
|
5299
4705
|
rawSpace = undefined;
|
5300
4706
|
}
|
5301
|
-
|
5302
4707
|
var result = {
|
5303
4708
|
space: space,
|
5304
4709
|
rawSpace: rawSpace
|
5305
4710
|
};
|
5306
4711
|
return result;
|
5307
4712
|
};
|
5308
|
-
|
5309
4713
|
_proto.isNamedCombinator = function isNamedCombinator(position) {
|
5310
4714
|
if (position === void 0) {
|
5311
4715
|
position = this.position;
|
5312
4716
|
}
|
5313
|
-
|
5314
4717
|
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;
|
5315
4718
|
};
|
5316
|
-
|
5317
4719
|
_proto.namedCombinator = function namedCombinator() {
|
5318
4720
|
if (this.isNamedCombinator()) {
|
5319
4721
|
var nameRaw = this.content(this.tokens[this.position + 1]);
|
5320
4722
|
var name = (0, _util.unesc)(nameRaw).toLowerCase();
|
5321
4723
|
var raws = {};
|
5322
|
-
|
5323
4724
|
if (name !== nameRaw) {
|
5324
4725
|
raws.value = "/" + nameRaw + "/";
|
5325
4726
|
}
|
5326
|
-
|
5327
4727
|
var node = new _combinator["default"]({
|
5328
4728
|
value: "/" + name + "/",
|
5329
4729
|
source: getSource(this.currToken[_tokenize.FIELDS.START_LINE], this.currToken[_tokenize.FIELDS.START_COL], this.tokens[this.position + 2][_tokenize.FIELDS.END_LINE], this.tokens[this.position + 2][_tokenize.FIELDS.END_COL]),
|
@@ -5336,32 +4736,24 @@ tokenTypes.combinator = combinator$1;
|
|
5336
4736
|
this.unexpected();
|
5337
4737
|
}
|
5338
4738
|
};
|
5339
|
-
|
5340
4739
|
_proto.combinator = function combinator() {
|
5341
4740
|
var _this3 = this;
|
5342
|
-
|
5343
4741
|
if (this.content() === '|') {
|
5344
4742
|
return this.namespace();
|
5345
|
-
}
|
5346
|
-
|
5347
|
-
|
4743
|
+
}
|
4744
|
+
// We need to decide between a space that's a descendant combinator and meaningless whitespace at the end of a selector.
|
5348
4745
|
var nextSigTokenPos = this.locateNextMeaningfulToken(this.position);
|
5349
|
-
|
5350
4746
|
if (nextSigTokenPos < 0 || this.tokens[nextSigTokenPos][_tokenize.FIELDS.TYPE] === tokens.comma) {
|
5351
4747
|
var nodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos);
|
5352
|
-
|
5353
4748
|
if (nodes.length > 0) {
|
5354
4749
|
var last = this.current.last;
|
5355
|
-
|
5356
4750
|
if (last) {
|
5357
4751
|
var _this$convertWhitespa = this.convertWhitespaceNodesToSpace(nodes),
|
5358
|
-
|
5359
|
-
|
5360
|
-
|
4752
|
+
space = _this$convertWhitespa.space,
|
4753
|
+
rawSpace = _this$convertWhitespa.rawSpace;
|
5361
4754
|
if (rawSpace !== undefined) {
|
5362
4755
|
last.rawSpaceAfter += rawSpace;
|
5363
4756
|
}
|
5364
|
-
|
5365
4757
|
last.spaces.after += space;
|
5366
4758
|
} else {
|
5367
4759
|
nodes.forEach(function (n) {
|
@@ -5369,19 +4761,14 @@ tokenTypes.combinator = combinator$1;
|
|
5369
4761
|
});
|
5370
4762
|
}
|
5371
4763
|
}
|
5372
|
-
|
5373
4764
|
return;
|
5374
4765
|
}
|
5375
|
-
|
5376
4766
|
var firstToken = this.currToken;
|
5377
4767
|
var spaceOrDescendantSelectorNodes = undefined;
|
5378
|
-
|
5379
4768
|
if (nextSigTokenPos > this.position) {
|
5380
4769
|
spaceOrDescendantSelectorNodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos);
|
5381
4770
|
}
|
5382
|
-
|
5383
4771
|
var node;
|
5384
|
-
|
5385
4772
|
if (this.isNamedCombinator()) {
|
5386
4773
|
node = this.namedCombinator();
|
5387
4774
|
} else if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.combinator) {
|
@@ -5394,31 +4781,26 @@ tokenTypes.combinator = combinator$1;
|
|
5394
4781
|
} else if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) ; else if (!spaceOrDescendantSelectorNodes) {
|
5395
4782
|
this.unexpected();
|
5396
4783
|
}
|
5397
|
-
|
5398
4784
|
if (node) {
|
5399
4785
|
if (spaceOrDescendantSelectorNodes) {
|
5400
4786
|
var _this$convertWhitespa2 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes),
|
5401
|
-
|
5402
|
-
|
5403
|
-
|
4787
|
+
_space = _this$convertWhitespa2.space,
|
4788
|
+
_rawSpace = _this$convertWhitespa2.rawSpace;
|
5404
4789
|
node.spaces.before = _space;
|
5405
4790
|
node.rawSpaceBefore = _rawSpace;
|
5406
4791
|
}
|
5407
4792
|
} else {
|
5408
4793
|
// descendant combinator
|
5409
4794
|
var _this$convertWhitespa3 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes, true),
|
5410
|
-
|
5411
|
-
|
5412
|
-
|
4795
|
+
_space2 = _this$convertWhitespa3.space,
|
4796
|
+
_rawSpace2 = _this$convertWhitespa3.rawSpace;
|
5413
4797
|
if (!_rawSpace2) {
|
5414
4798
|
_rawSpace2 = _space2;
|
5415
4799
|
}
|
5416
|
-
|
5417
4800
|
var spaces = {};
|
5418
4801
|
var raws = {
|
5419
4802
|
spaces: {}
|
5420
4803
|
};
|
5421
|
-
|
5422
4804
|
if (_space2.endsWith(' ') && _rawSpace2.endsWith(' ')) {
|
5423
4805
|
spaces.before = _space2.slice(0, _space2.length - 1);
|
5424
4806
|
raws.spaces.before = _rawSpace2.slice(0, _rawSpace2.length - 1);
|
@@ -5428,7 +4810,6 @@ tokenTypes.combinator = combinator$1;
|
|
5428
4810
|
} else {
|
5429
4811
|
raws.value = _rawSpace2;
|
5430
4812
|
}
|
5431
|
-
|
5432
4813
|
node = new _combinator["default"]({
|
5433
4814
|
value: ' ',
|
5434
4815
|
source: getTokenSourceSpan(firstToken, this.tokens[this.position - 1]),
|
@@ -5437,34 +4818,29 @@ tokenTypes.combinator = combinator$1;
|
|
5437
4818
|
raws: raws
|
5438
4819
|
});
|
5439
4820
|
}
|
5440
|
-
|
5441
4821
|
if (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.space) {
|
5442
4822
|
node.spaces.after = this.optionalSpace(this.content());
|
5443
4823
|
this.position++;
|
5444
4824
|
}
|
5445
|
-
|
5446
4825
|
return this.newNode(node);
|
5447
4826
|
};
|
5448
|
-
|
5449
4827
|
_proto.comma = function comma() {
|
5450
4828
|
if (this.position === this.tokens.length - 1) {
|
5451
4829
|
this.root.trailingComma = true;
|
5452
4830
|
this.position++;
|
5453
4831
|
return;
|
5454
4832
|
}
|
5455
|
-
|
5456
4833
|
this.current._inferEndPosition();
|
5457
|
-
|
5458
4834
|
var selector = new _selector["default"]({
|
5459
4835
|
source: {
|
5460
4836
|
start: tokenStart(this.tokens[this.position + 1])
|
5461
|
-
}
|
4837
|
+
},
|
4838
|
+
sourceIndex: this.tokens[this.position + 1][_tokenize.FIELDS.START_POS]
|
5462
4839
|
});
|
5463
4840
|
this.current.parent.append(selector);
|
5464
4841
|
this.current = selector;
|
5465
4842
|
this.position++;
|
5466
4843
|
};
|
5467
|
-
|
5468
4844
|
_proto.comment = function comment() {
|
5469
4845
|
var current = this.currToken;
|
5470
4846
|
this.newNode(new _comment["default"]({
|
@@ -5474,32 +4850,28 @@ tokenTypes.combinator = combinator$1;
|
|
5474
4850
|
}));
|
5475
4851
|
this.position++;
|
5476
4852
|
};
|
5477
|
-
|
5478
4853
|
_proto.error = function error(message, opts) {
|
5479
4854
|
throw this.root.error(message, opts);
|
5480
4855
|
};
|
5481
|
-
|
5482
4856
|
_proto.missingBackslash = function missingBackslash() {
|
5483
4857
|
return this.error('Expected a backslash preceding the semicolon.', {
|
5484
4858
|
index: this.currToken[_tokenize.FIELDS.START_POS]
|
5485
4859
|
});
|
5486
4860
|
};
|
5487
|
-
|
5488
4861
|
_proto.missingParenthesis = function missingParenthesis() {
|
5489
4862
|
return this.expected('opening parenthesis', this.currToken[_tokenize.FIELDS.START_POS]);
|
5490
4863
|
};
|
5491
|
-
|
5492
4864
|
_proto.missingSquareBracket = function missingSquareBracket() {
|
5493
4865
|
return this.expected('opening square bracket', this.currToken[_tokenize.FIELDS.START_POS]);
|
5494
4866
|
};
|
5495
|
-
|
5496
4867
|
_proto.unexpected = function unexpected() {
|
5497
4868
|
return this.error("Unexpected '" + this.content() + "'. Escaping special characters with \\ may help.", this.currToken[_tokenize.FIELDS.START_POS]);
|
5498
4869
|
};
|
5499
|
-
|
4870
|
+
_proto.unexpectedPipe = function unexpectedPipe() {
|
4871
|
+
return this.error("Unexpected '|'.", this.currToken[_tokenize.FIELDS.START_POS]);
|
4872
|
+
};
|
5500
4873
|
_proto.namespace = function namespace() {
|
5501
4874
|
var before = this.prevToken && this.content(this.prevToken) || true;
|
5502
|
-
|
5503
4875
|
if (this.nextToken[_tokenize.FIELDS.TYPE] === tokens.word) {
|
5504
4876
|
this.position++;
|
5505
4877
|
return this.word(before);
|
@@ -5507,18 +4879,16 @@ tokenTypes.combinator = combinator$1;
|
|
5507
4879
|
this.position++;
|
5508
4880
|
return this.universal(before);
|
5509
4881
|
}
|
4882
|
+
this.unexpectedPipe();
|
5510
4883
|
};
|
5511
|
-
|
5512
4884
|
_proto.nesting = function nesting() {
|
5513
4885
|
if (this.nextToken) {
|
5514
4886
|
var nextContent = this.content(this.nextToken);
|
5515
|
-
|
5516
4887
|
if (nextContent === "|") {
|
5517
4888
|
this.position++;
|
5518
4889
|
return;
|
5519
4890
|
}
|
5520
4891
|
}
|
5521
|
-
|
5522
4892
|
var current = this.currToken;
|
5523
4893
|
this.newNode(new _nesting["default"]({
|
5524
4894
|
value: this.content(),
|
@@ -5527,31 +4897,27 @@ tokenTypes.combinator = combinator$1;
|
|
5527
4897
|
}));
|
5528
4898
|
this.position++;
|
5529
4899
|
};
|
5530
|
-
|
5531
4900
|
_proto.parentheses = function parentheses() {
|
5532
4901
|
var last = this.current.last;
|
5533
4902
|
var unbalanced = 1;
|
5534
4903
|
this.position++;
|
5535
|
-
|
5536
4904
|
if (last && last.type === types$1.PSEUDO) {
|
5537
4905
|
var selector = new _selector["default"]({
|
5538
4906
|
source: {
|
5539
|
-
start: tokenStart(this.tokens[this.position
|
5540
|
-
}
|
4907
|
+
start: tokenStart(this.tokens[this.position])
|
4908
|
+
},
|
4909
|
+
sourceIndex: this.tokens[this.position][_tokenize.FIELDS.START_POS]
|
5541
4910
|
});
|
5542
4911
|
var cache = this.current;
|
5543
4912
|
last.append(selector);
|
5544
4913
|
this.current = selector;
|
5545
|
-
|
5546
4914
|
while (this.position < this.tokens.length && unbalanced) {
|
5547
4915
|
if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
|
5548
4916
|
unbalanced++;
|
5549
4917
|
}
|
5550
|
-
|
5551
4918
|
if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
|
5552
4919
|
unbalanced--;
|
5553
4920
|
}
|
5554
|
-
|
5555
4921
|
if (unbalanced) {
|
5556
4922
|
this.parse();
|
5557
4923
|
} else {
|
@@ -5560,7 +4926,6 @@ tokenTypes.combinator = combinator$1;
|
|
5560
4926
|
this.position++;
|
5561
4927
|
}
|
5562
4928
|
}
|
5563
|
-
|
5564
4929
|
this.current = cache;
|
5565
4930
|
} else {
|
5566
4931
|
// I think this case should be an error. It's used to implement a basic parse of media queries
|
@@ -5568,21 +4933,17 @@ tokenTypes.combinator = combinator$1;
|
|
5568
4933
|
var parenStart = this.currToken;
|
5569
4934
|
var parenValue = "(";
|
5570
4935
|
var parenEnd;
|
5571
|
-
|
5572
4936
|
while (this.position < this.tokens.length && unbalanced) {
|
5573
4937
|
if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
|
5574
4938
|
unbalanced++;
|
5575
4939
|
}
|
5576
|
-
|
5577
4940
|
if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
|
5578
4941
|
unbalanced--;
|
5579
4942
|
}
|
5580
|
-
|
5581
4943
|
parenEnd = this.currToken;
|
5582
4944
|
parenValue += this.parseParenthesisToken(this.currToken);
|
5583
4945
|
this.position++;
|
5584
4946
|
}
|
5585
|
-
|
5586
4947
|
if (last) {
|
5587
4948
|
last.appendToPropertyAndEscape("value", parenValue, parenValue);
|
5588
4949
|
} else {
|
@@ -5593,37 +4954,29 @@ tokenTypes.combinator = combinator$1;
|
|
5593
4954
|
}));
|
5594
4955
|
}
|
5595
4956
|
}
|
5596
|
-
|
5597
4957
|
if (unbalanced) {
|
5598
4958
|
return this.expected('closing parenthesis', this.currToken[_tokenize.FIELDS.START_POS]);
|
5599
4959
|
}
|
5600
4960
|
};
|
5601
|
-
|
5602
4961
|
_proto.pseudo = function pseudo() {
|
5603
4962
|
var _this4 = this;
|
5604
|
-
|
5605
4963
|
var pseudoStr = '';
|
5606
4964
|
var startingToken = this.currToken;
|
5607
|
-
|
5608
4965
|
while (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.colon) {
|
5609
4966
|
pseudoStr += this.content();
|
5610
4967
|
this.position++;
|
5611
4968
|
}
|
5612
|
-
|
5613
4969
|
if (!this.currToken) {
|
5614
4970
|
return this.expected(['pseudo-class', 'pseudo-element'], this.position - 1);
|
5615
4971
|
}
|
5616
|
-
|
5617
4972
|
if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.word) {
|
5618
4973
|
this.splitWord(false, function (first, length) {
|
5619
4974
|
pseudoStr += first;
|
5620
|
-
|
5621
4975
|
_this4.newNode(new _pseudo["default"]({
|
5622
4976
|
value: pseudoStr,
|
5623
4977
|
source: getTokenSourceSpan(startingToken, _this4.currToken),
|
5624
4978
|
sourceIndex: startingToken[_tokenize.FIELDS.START_POS]
|
5625
4979
|
}));
|
5626
|
-
|
5627
4980
|
if (length > 1 && _this4.nextToken && _this4.nextToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
|
5628
4981
|
_this4.error('Misplaced parenthesis.', {
|
5629
4982
|
index: _this4.nextToken[_tokenize.FIELDS.START_POS]
|
@@ -5634,10 +4987,9 @@ tokenTypes.combinator = combinator$1;
|
|
5634
4987
|
return this.expected(['pseudo-class', 'pseudo-element'], this.currToken[_tokenize.FIELDS.START_POS]);
|
5635
4988
|
}
|
5636
4989
|
};
|
5637
|
-
|
5638
4990
|
_proto.space = function space() {
|
5639
|
-
var content = this.content();
|
5640
|
-
|
4991
|
+
var content = this.content();
|
4992
|
+
// Handle space before and after the selector
|
5641
4993
|
if (this.position === 0 || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis || this.current.nodes.every(function (node) {
|
5642
4994
|
return node.type === 'comment';
|
5643
4995
|
})) {
|
@@ -5650,7 +5002,6 @@ tokenTypes.combinator = combinator$1;
|
|
5650
5002
|
this.combinator();
|
5651
5003
|
}
|
5652
5004
|
};
|
5653
|
-
|
5654
5005
|
_proto.string = function string() {
|
5655
5006
|
var current = this.currToken;
|
5656
5007
|
this.newNode(new _string["default"]({
|
@@ -5660,15 +5011,12 @@ tokenTypes.combinator = combinator$1;
|
|
5660
5011
|
}));
|
5661
5012
|
this.position++;
|
5662
5013
|
};
|
5663
|
-
|
5664
5014
|
_proto.universal = function universal(namespace) {
|
5665
5015
|
var nextToken = this.nextToken;
|
5666
|
-
|
5667
5016
|
if (nextToken && this.content(nextToken) === '|') {
|
5668
5017
|
this.position++;
|
5669
5018
|
return this.namespace();
|
5670
5019
|
}
|
5671
|
-
|
5672
5020
|
var current = this.currToken;
|
5673
5021
|
this.newNode(new _universal["default"]({
|
5674
5022
|
value: this.content(),
|
@@ -5677,63 +5025,51 @@ tokenTypes.combinator = combinator$1;
|
|
5677
5025
|
}), namespace);
|
5678
5026
|
this.position++;
|
5679
5027
|
};
|
5680
|
-
|
5681
5028
|
_proto.splitWord = function splitWord(namespace, firstCallback) {
|
5682
5029
|
var _this5 = this;
|
5683
|
-
|
5684
5030
|
var nextToken = this.nextToken;
|
5685
5031
|
var word = this.content();
|
5686
|
-
|
5687
5032
|
while (nextToken && ~[tokens.dollar, tokens.caret, tokens.equals, tokens.word].indexOf(nextToken[_tokenize.FIELDS.TYPE])) {
|
5688
5033
|
this.position++;
|
5689
5034
|
var current = this.content();
|
5690
5035
|
word += current;
|
5691
|
-
|
5692
5036
|
if (current.lastIndexOf('\\') === current.length - 1) {
|
5693
5037
|
var next = this.nextToken;
|
5694
|
-
|
5695
5038
|
if (next && next[_tokenize.FIELDS.TYPE] === tokens.space) {
|
5696
5039
|
word += this.requiredSpace(this.content(next));
|
5697
5040
|
this.position++;
|
5698
5041
|
}
|
5699
5042
|
}
|
5700
|
-
|
5701
5043
|
nextToken = this.nextToken;
|
5702
5044
|
}
|
5703
|
-
|
5704
5045
|
var hasClass = indexesOf(word, '.').filter(function (i) {
|
5705
5046
|
// Allow escaped dot within class name
|
5706
|
-
var escapedDot = word[i - 1] === '\\';
|
5707
|
-
|
5047
|
+
var escapedDot = word[i - 1] === '\\';
|
5048
|
+
// Allow decimal numbers percent in @keyframes
|
5708
5049
|
var isKeyframesPercent = /^\d+\.\d+%$/.test(word);
|
5709
5050
|
return !escapedDot && !isKeyframesPercent;
|
5710
5051
|
});
|
5711
5052
|
var hasId = indexesOf(word, '#').filter(function (i) {
|
5712
5053
|
return word[i - 1] !== '\\';
|
5713
|
-
});
|
5714
|
-
|
5054
|
+
});
|
5055
|
+
// Eliminate Sass interpolations from the list of id indexes
|
5715
5056
|
var interpolations = indexesOf(word, '#{');
|
5716
|
-
|
5717
5057
|
if (interpolations.length) {
|
5718
5058
|
hasId = hasId.filter(function (hashIndex) {
|
5719
5059
|
return !~interpolations.indexOf(hashIndex);
|
5720
5060
|
});
|
5721
5061
|
}
|
5722
|
-
|
5723
5062
|
var indices = (0, _sortAscending["default"])(uniqs([0].concat(hasClass, hasId)));
|
5724
5063
|
indices.forEach(function (ind, i) {
|
5725
5064
|
var index = indices[i + 1] || word.length;
|
5726
5065
|
var value = word.slice(ind, index);
|
5727
|
-
|
5728
5066
|
if (i === 0 && firstCallback) {
|
5729
5067
|
return firstCallback.call(_this5, value, indices.length);
|
5730
5068
|
}
|
5731
|
-
|
5732
5069
|
var node;
|
5733
5070
|
var current = _this5.currToken;
|
5734
5071
|
var sourceIndex = current[_tokenize.FIELDS.START_POS] + indices[i];
|
5735
5072
|
var source = getSource(current[1], current[2] + ind, current[3], current[2] + (index - 1));
|
5736
|
-
|
5737
5073
|
if (~hasClass.indexOf(ind)) {
|
5738
5074
|
var classNameOpts = {
|
5739
5075
|
value: value.slice(1),
|
@@ -5757,136 +5093,105 @@ tokenTypes.combinator = combinator$1;
|
|
5757
5093
|
unescapeProp(tagOpts, "value");
|
5758
5094
|
node = new _tag["default"](tagOpts);
|
5759
5095
|
}
|
5760
|
-
|
5761
|
-
|
5762
|
-
|
5763
|
-
|
5096
|
+
_this5.newNode(node, namespace);
|
5097
|
+
// Ensure that the namespace is used only once
|
5764
5098
|
namespace = null;
|
5765
5099
|
});
|
5766
5100
|
this.position++;
|
5767
5101
|
};
|
5768
|
-
|
5769
5102
|
_proto.word = function word(namespace) {
|
5770
5103
|
var nextToken = this.nextToken;
|
5771
|
-
|
5772
5104
|
if (nextToken && this.content(nextToken) === '|') {
|
5773
5105
|
this.position++;
|
5774
5106
|
return this.namespace();
|
5775
5107
|
}
|
5776
|
-
|
5777
5108
|
return this.splitWord(namespace);
|
5778
5109
|
};
|
5779
|
-
|
5780
5110
|
_proto.loop = function loop() {
|
5781
5111
|
while (this.position < this.tokens.length) {
|
5782
5112
|
this.parse(true);
|
5783
5113
|
}
|
5784
|
-
|
5785
5114
|
this.current._inferEndPosition();
|
5786
|
-
|
5787
5115
|
return this.root;
|
5788
5116
|
};
|
5789
|
-
|
5790
5117
|
_proto.parse = function parse(throwOnParenthesis) {
|
5791
5118
|
switch (this.currToken[_tokenize.FIELDS.TYPE]) {
|
5792
5119
|
case tokens.space:
|
5793
5120
|
this.space();
|
5794
5121
|
break;
|
5795
|
-
|
5796
5122
|
case tokens.comment:
|
5797
5123
|
this.comment();
|
5798
5124
|
break;
|
5799
|
-
|
5800
5125
|
case tokens.openParenthesis:
|
5801
5126
|
this.parentheses();
|
5802
5127
|
break;
|
5803
|
-
|
5804
5128
|
case tokens.closeParenthesis:
|
5805
5129
|
if (throwOnParenthesis) {
|
5806
5130
|
this.missingParenthesis();
|
5807
5131
|
}
|
5808
|
-
|
5809
5132
|
break;
|
5810
|
-
|
5811
5133
|
case tokens.openSquare:
|
5812
5134
|
this.attribute();
|
5813
5135
|
break;
|
5814
|
-
|
5815
5136
|
case tokens.dollar:
|
5816
5137
|
case tokens.caret:
|
5817
5138
|
case tokens.equals:
|
5818
5139
|
case tokens.word:
|
5819
5140
|
this.word();
|
5820
5141
|
break;
|
5821
|
-
|
5822
5142
|
case tokens.colon:
|
5823
5143
|
this.pseudo();
|
5824
5144
|
break;
|
5825
|
-
|
5826
5145
|
case tokens.comma:
|
5827
5146
|
this.comma();
|
5828
5147
|
break;
|
5829
|
-
|
5830
5148
|
case tokens.asterisk:
|
5831
5149
|
this.universal();
|
5832
5150
|
break;
|
5833
|
-
|
5834
5151
|
case tokens.ampersand:
|
5835
5152
|
this.nesting();
|
5836
5153
|
break;
|
5837
|
-
|
5838
5154
|
case tokens.slash:
|
5839
5155
|
case tokens.combinator:
|
5840
5156
|
this.combinator();
|
5841
5157
|
break;
|
5842
|
-
|
5843
5158
|
case tokens.str:
|
5844
5159
|
this.string();
|
5845
5160
|
break;
|
5846
5161
|
// These cases throw; no break needed.
|
5847
|
-
|
5848
5162
|
case tokens.closeSquare:
|
5849
5163
|
this.missingSquareBracket();
|
5850
|
-
|
5851
5164
|
case tokens.semicolon:
|
5852
5165
|
this.missingBackslash();
|
5853
|
-
|
5854
5166
|
default:
|
5855
5167
|
this.unexpected();
|
5856
5168
|
}
|
5857
5169
|
}
|
5170
|
+
|
5858
5171
|
/**
|
5859
5172
|
* Helpers
|
5860
|
-
|
5861
|
-
;
|
5862
|
-
|
5173
|
+
*/;
|
5863
5174
|
_proto.expected = function expected(description, index, found) {
|
5864
5175
|
if (Array.isArray(description)) {
|
5865
5176
|
var last = description.pop();
|
5866
5177
|
description = description.join(', ') + " or " + last;
|
5867
5178
|
}
|
5868
|
-
|
5869
5179
|
var an = /^[aeiou]/.test(description[0]) ? 'an' : 'a';
|
5870
|
-
|
5871
5180
|
if (!found) {
|
5872
5181
|
return this.error("Expected " + an + " " + description + ".", {
|
5873
5182
|
index: index
|
5874
5183
|
});
|
5875
5184
|
}
|
5876
|
-
|
5877
5185
|
return this.error("Expected " + an + " " + description + ", found \"" + found + "\" instead.", {
|
5878
5186
|
index: index
|
5879
5187
|
});
|
5880
5188
|
};
|
5881
|
-
|
5882
5189
|
_proto.requiredSpace = function requiredSpace(space) {
|
5883
5190
|
return this.options.lossy ? ' ' : space;
|
5884
5191
|
};
|
5885
|
-
|
5886
5192
|
_proto.optionalSpace = function optionalSpace(space) {
|
5887
5193
|
return this.options.lossy ? '' : space;
|
5888
5194
|
};
|
5889
|
-
|
5890
5195
|
_proto.lossySpace = function lossySpace(space, required) {
|
5891
5196
|
if (this.options.lossy) {
|
5892
5197
|
return required ? ' ' : '';
|
@@ -5894,47 +5199,37 @@ tokenTypes.combinator = combinator$1;
|
|
5894
5199
|
return space;
|
5895
5200
|
}
|
5896
5201
|
};
|
5897
|
-
|
5898
5202
|
_proto.parseParenthesisToken = function parseParenthesisToken(token) {
|
5899
5203
|
var content = this.content(token);
|
5900
|
-
|
5901
5204
|
if (token[_tokenize.FIELDS.TYPE] === tokens.space) {
|
5902
5205
|
return this.requiredSpace(content);
|
5903
5206
|
} else {
|
5904
5207
|
return content;
|
5905
5208
|
}
|
5906
5209
|
};
|
5907
|
-
|
5908
5210
|
_proto.newNode = function newNode(node, namespace) {
|
5909
5211
|
if (namespace) {
|
5910
5212
|
if (/^ +$/.test(namespace)) {
|
5911
5213
|
if (!this.options.lossy) {
|
5912
5214
|
this.spaces = (this.spaces || '') + namespace;
|
5913
5215
|
}
|
5914
|
-
|
5915
5216
|
namespace = true;
|
5916
5217
|
}
|
5917
|
-
|
5918
5218
|
node.namespace = namespace;
|
5919
5219
|
unescapeProp(node, "namespace");
|
5920
5220
|
}
|
5921
|
-
|
5922
5221
|
if (this.spaces) {
|
5923
5222
|
node.spaces.before = this.spaces;
|
5924
5223
|
this.spaces = '';
|
5925
5224
|
}
|
5926
|
-
|
5927
5225
|
return this.current.append(node);
|
5928
5226
|
};
|
5929
|
-
|
5930
5227
|
_proto.content = function content(token) {
|
5931
5228
|
if (token === void 0) {
|
5932
5229
|
token = this.currToken;
|
5933
5230
|
}
|
5934
|
-
|
5935
5231
|
return this.css.slice(token[_tokenize.FIELDS.START_POS], token[_tokenize.FIELDS.END_POS]);
|
5936
5232
|
};
|
5937
|
-
|
5938
5233
|
/**
|
5939
5234
|
* returns the index of the next non-whitespace, non-comment token.
|
5940
5235
|
* returns -1 if no meaningful token is found.
|
@@ -5943,9 +5238,7 @@ tokenTypes.combinator = combinator$1;
|
|
5943
5238
|
if (startPosition === void 0) {
|
5944
5239
|
startPosition = this.position + 1;
|
5945
5240
|
}
|
5946
|
-
|
5947
5241
|
var searchPosition = startPosition;
|
5948
|
-
|
5949
5242
|
while (searchPosition < this.tokens.length) {
|
5950
5243
|
if (WHITESPACE_EQUIV_TOKENS[this.tokens[searchPosition][_tokenize.FIELDS.TYPE]]) {
|
5951
5244
|
searchPosition++;
|
@@ -5954,10 +5247,8 @@ tokenTypes.combinator = combinator$1;
|
|
5954
5247
|
return searchPosition;
|
5955
5248
|
}
|
5956
5249
|
}
|
5957
|
-
|
5958
5250
|
return -1;
|
5959
5251
|
};
|
5960
|
-
|
5961
5252
|
_createClass(Parser, [{
|
5962
5253
|
key: "currToken",
|
5963
5254
|
get: function get() {
|
@@ -5974,10 +5265,8 @@ tokenTypes.combinator = combinator$1;
|
|
5974
5265
|
return this.tokens[this.position - 1];
|
5975
5266
|
}
|
5976
5267
|
}]);
|
5977
|
-
|
5978
5268
|
return Parser;
|
5979
5269
|
}();
|
5980
|
-
|
5981
5270
|
exports["default"] = Parser;
|
5982
5271
|
module.exports = exports.default;
|
5983
5272
|
} (parser, parser.exports));
|
@@ -5988,83 +5277,63 @@ var parserExports = parser.exports;
|
|
5988
5277
|
|
5989
5278
|
exports.__esModule = true;
|
5990
5279
|
exports["default"] = void 0;
|
5991
|
-
|
5992
5280
|
var _parser = _interopRequireDefault(parserExports);
|
5993
|
-
|
5994
5281
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
5995
|
-
|
5996
5282
|
var Processor = /*#__PURE__*/function () {
|
5997
5283
|
function Processor(func, options) {
|
5998
5284
|
this.func = func || function noop() {};
|
5999
|
-
|
6000
5285
|
this.funcRes = null;
|
6001
5286
|
this.options = options;
|
6002
5287
|
}
|
6003
|
-
|
6004
5288
|
var _proto = Processor.prototype;
|
6005
|
-
|
6006
5289
|
_proto._shouldUpdateSelector = function _shouldUpdateSelector(rule, options) {
|
6007
5290
|
if (options === void 0) {
|
6008
5291
|
options = {};
|
6009
5292
|
}
|
6010
|
-
|
6011
5293
|
var merged = Object.assign({}, this.options, options);
|
6012
|
-
|
6013
5294
|
if (merged.updateSelector === false) {
|
6014
5295
|
return false;
|
6015
5296
|
} else {
|
6016
5297
|
return typeof rule !== "string";
|
6017
5298
|
}
|
6018
5299
|
};
|
6019
|
-
|
6020
5300
|
_proto._isLossy = function _isLossy(options) {
|
6021
5301
|
if (options === void 0) {
|
6022
5302
|
options = {};
|
6023
5303
|
}
|
6024
|
-
|
6025
5304
|
var merged = Object.assign({}, this.options, options);
|
6026
|
-
|
6027
5305
|
if (merged.lossless === false) {
|
6028
5306
|
return true;
|
6029
5307
|
} else {
|
6030
5308
|
return false;
|
6031
5309
|
}
|
6032
5310
|
};
|
6033
|
-
|
6034
5311
|
_proto._root = function _root(rule, options) {
|
6035
5312
|
if (options === void 0) {
|
6036
5313
|
options = {};
|
6037
5314
|
}
|
6038
|
-
|
6039
5315
|
var parser = new _parser["default"](rule, this._parseOptions(options));
|
6040
5316
|
return parser.root;
|
6041
5317
|
};
|
6042
|
-
|
6043
5318
|
_proto._parseOptions = function _parseOptions(options) {
|
6044
5319
|
return {
|
6045
5320
|
lossy: this._isLossy(options)
|
6046
5321
|
};
|
6047
5322
|
};
|
6048
|
-
|
6049
5323
|
_proto._run = function _run(rule, options) {
|
6050
5324
|
var _this = this;
|
6051
|
-
|
6052
5325
|
if (options === void 0) {
|
6053
5326
|
options = {};
|
6054
5327
|
}
|
6055
|
-
|
6056
5328
|
return new Promise(function (resolve, reject) {
|
6057
5329
|
try {
|
6058
5330
|
var root = _this._root(rule, options);
|
6059
|
-
|
6060
5331
|
Promise.resolve(_this.func(root)).then(function (transform) {
|
6061
5332
|
var string = undefined;
|
6062
|
-
|
6063
5333
|
if (_this._shouldUpdateSelector(rule, options)) {
|
6064
5334
|
string = root.toString();
|
6065
5335
|
rule.selector = string;
|
6066
5336
|
}
|
6067
|
-
|
6068
5337
|
return {
|
6069
5338
|
transform: transform,
|
6070
5339
|
root: root,
|
@@ -6077,117 +5346,101 @@ var parserExports = parser.exports;
|
|
6077
5346
|
}
|
6078
5347
|
});
|
6079
5348
|
};
|
6080
|
-
|
6081
5349
|
_proto._runSync = function _runSync(rule, options) {
|
6082
5350
|
if (options === void 0) {
|
6083
5351
|
options = {};
|
6084
5352
|
}
|
6085
|
-
|
6086
5353
|
var root = this._root(rule, options);
|
6087
|
-
|
6088
5354
|
var transform = this.func(root);
|
6089
|
-
|
6090
5355
|
if (transform && typeof transform.then === "function") {
|
6091
5356
|
throw new Error("Selector processor returned a promise to a synchronous call.");
|
6092
5357
|
}
|
6093
|
-
|
6094
5358
|
var string = undefined;
|
6095
|
-
|
6096
5359
|
if (options.updateSelector && typeof rule !== "string") {
|
6097
5360
|
string = root.toString();
|
6098
5361
|
rule.selector = string;
|
6099
5362
|
}
|
6100
|
-
|
6101
5363
|
return {
|
6102
5364
|
transform: transform,
|
6103
5365
|
root: root,
|
6104
5366
|
string: string
|
6105
5367
|
};
|
6106
5368
|
}
|
5369
|
+
|
6107
5370
|
/**
|
6108
5371
|
* Process rule into a selector AST.
|
6109
5372
|
*
|
6110
5373
|
* @param rule {postcss.Rule | string} The css selector to be processed
|
6111
5374
|
* @param options The options for processing
|
6112
5375
|
* @returns {Promise<parser.Root>} The AST of the selector after processing it.
|
6113
|
-
|
6114
|
-
;
|
6115
|
-
|
5376
|
+
*/;
|
6116
5377
|
_proto.ast = function ast(rule, options) {
|
6117
5378
|
return this._run(rule, options).then(function (result) {
|
6118
5379
|
return result.root;
|
6119
5380
|
});
|
6120
5381
|
}
|
5382
|
+
|
6121
5383
|
/**
|
6122
5384
|
* Process rule into a selector AST synchronously.
|
6123
5385
|
*
|
6124
5386
|
* @param rule {postcss.Rule | string} The css selector to be processed
|
6125
5387
|
* @param options The options for processing
|
6126
5388
|
* @returns {parser.Root} The AST of the selector after processing it.
|
6127
|
-
|
6128
|
-
;
|
6129
|
-
|
5389
|
+
*/;
|
6130
5390
|
_proto.astSync = function astSync(rule, options) {
|
6131
5391
|
return this._runSync(rule, options).root;
|
6132
5392
|
}
|
5393
|
+
|
6133
5394
|
/**
|
6134
5395
|
* Process a selector into a transformed value asynchronously
|
6135
5396
|
*
|
6136
5397
|
* @param rule {postcss.Rule | string} The css selector to be processed
|
6137
5398
|
* @param options The options for processing
|
6138
5399
|
* @returns {Promise<any>} The value returned by the processor.
|
6139
|
-
|
6140
|
-
;
|
6141
|
-
|
5400
|
+
*/;
|
6142
5401
|
_proto.transform = function transform(rule, options) {
|
6143
5402
|
return this._run(rule, options).then(function (result) {
|
6144
5403
|
return result.transform;
|
6145
5404
|
});
|
6146
5405
|
}
|
5406
|
+
|
6147
5407
|
/**
|
6148
5408
|
* Process a selector into a transformed value synchronously.
|
6149
5409
|
*
|
6150
5410
|
* @param rule {postcss.Rule | string} The css selector to be processed
|
6151
5411
|
* @param options The options for processing
|
6152
5412
|
* @returns {any} The value returned by the processor.
|
6153
|
-
|
6154
|
-
;
|
6155
|
-
|
5413
|
+
*/;
|
6156
5414
|
_proto.transformSync = function transformSync(rule, options) {
|
6157
5415
|
return this._runSync(rule, options).transform;
|
6158
5416
|
}
|
5417
|
+
|
6159
5418
|
/**
|
6160
5419
|
* Process a selector into a new selector string asynchronously.
|
6161
5420
|
*
|
6162
5421
|
* @param rule {postcss.Rule | string} The css selector to be processed
|
6163
5422
|
* @param options The options for processing
|
6164
5423
|
* @returns {string} the selector after processing.
|
6165
|
-
|
6166
|
-
;
|
6167
|
-
|
5424
|
+
*/;
|
6168
5425
|
_proto.process = function process(rule, options) {
|
6169
5426
|
return this._run(rule, options).then(function (result) {
|
6170
5427
|
return result.string || result.root.toString();
|
6171
5428
|
});
|
6172
5429
|
}
|
5430
|
+
|
6173
5431
|
/**
|
6174
5432
|
* Process a selector into a new selector string synchronously.
|
6175
5433
|
*
|
6176
5434
|
* @param rule {postcss.Rule | string} The css selector to be processed
|
6177
5435
|
* @param options The options for processing
|
6178
5436
|
* @returns {string} the selector after processing.
|
6179
|
-
|
6180
|
-
;
|
6181
|
-
|
5437
|
+
*/;
|
6182
5438
|
_proto.processSync = function processSync(rule, options) {
|
6183
5439
|
var result = this._runSync(rule, options);
|
6184
|
-
|
6185
5440
|
return result.string || result.root.toString();
|
6186
5441
|
};
|
6187
|
-
|
6188
5442
|
return Processor;
|
6189
5443
|
}();
|
6190
|
-
|
6191
5444
|
exports["default"] = Processor;
|
6192
5445
|
module.exports = exports.default;
|
6193
5446
|
} (processor, processor.exports));
|
@@ -6200,129 +5453,90 @@ var constructors = {};
|
|
6200
5453
|
|
6201
5454
|
constructors.__esModule = true;
|
6202
5455
|
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;
|
6203
|
-
|
6204
5456
|
var _attribute = _interopRequireDefault$2(attribute$1);
|
6205
|
-
|
6206
5457
|
var _className = _interopRequireDefault$2(classNameExports);
|
6207
|
-
|
6208
5458
|
var _combinator = _interopRequireDefault$2(combinatorExports);
|
6209
|
-
|
6210
5459
|
var _comment = _interopRequireDefault$2(commentExports);
|
6211
|
-
|
6212
5460
|
var _id = _interopRequireDefault$2(idExports);
|
6213
|
-
|
6214
5461
|
var _nesting = _interopRequireDefault$2(nestingExports);
|
6215
|
-
|
6216
5462
|
var _pseudo = _interopRequireDefault$2(pseudoExports);
|
6217
|
-
|
6218
5463
|
var _root = _interopRequireDefault$2(rootExports);
|
6219
|
-
|
6220
5464
|
var _selector = _interopRequireDefault$2(selectorExports);
|
6221
|
-
|
6222
5465
|
var _string = _interopRequireDefault$2(stringExports);
|
6223
|
-
|
6224
5466
|
var _tag = _interopRequireDefault$2(tagExports);
|
6225
|
-
|
6226
5467
|
var _universal = _interopRequireDefault$2(universalExports);
|
6227
|
-
|
6228
5468
|
function _interopRequireDefault$2(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6229
|
-
|
6230
5469
|
var attribute = function attribute(opts) {
|
6231
5470
|
return new _attribute["default"](opts);
|
6232
5471
|
};
|
6233
|
-
|
6234
5472
|
constructors.attribute = attribute;
|
6235
|
-
|
6236
5473
|
var className = function className(opts) {
|
6237
5474
|
return new _className["default"](opts);
|
6238
5475
|
};
|
6239
|
-
|
6240
5476
|
constructors.className = className;
|
6241
|
-
|
6242
5477
|
var combinator = function combinator(opts) {
|
6243
5478
|
return new _combinator["default"](opts);
|
6244
5479
|
};
|
6245
|
-
|
6246
5480
|
constructors.combinator = combinator;
|
6247
|
-
|
6248
5481
|
var comment = function comment(opts) {
|
6249
5482
|
return new _comment["default"](opts);
|
6250
5483
|
};
|
6251
|
-
|
6252
5484
|
constructors.comment = comment;
|
6253
|
-
|
6254
5485
|
var id = function id(opts) {
|
6255
5486
|
return new _id["default"](opts);
|
6256
5487
|
};
|
6257
|
-
|
6258
5488
|
constructors.id = id;
|
6259
|
-
|
6260
5489
|
var nesting = function nesting(opts) {
|
6261
5490
|
return new _nesting["default"](opts);
|
6262
5491
|
};
|
6263
|
-
|
6264
5492
|
constructors.nesting = nesting;
|
6265
|
-
|
6266
5493
|
var pseudo = function pseudo(opts) {
|
6267
5494
|
return new _pseudo["default"](opts);
|
6268
5495
|
};
|
6269
|
-
|
6270
5496
|
constructors.pseudo = pseudo;
|
6271
|
-
|
6272
5497
|
var root = function root(opts) {
|
6273
5498
|
return new _root["default"](opts);
|
6274
5499
|
};
|
6275
|
-
|
6276
5500
|
constructors.root = root;
|
6277
|
-
|
6278
5501
|
var selector = function selector(opts) {
|
6279
5502
|
return new _selector["default"](opts);
|
6280
5503
|
};
|
6281
|
-
|
6282
5504
|
constructors.selector = selector;
|
6283
|
-
|
6284
5505
|
var string = function string(opts) {
|
6285
5506
|
return new _string["default"](opts);
|
6286
5507
|
};
|
6287
|
-
|
6288
5508
|
constructors.string = string;
|
6289
|
-
|
6290
5509
|
var tag = function tag(opts) {
|
6291
5510
|
return new _tag["default"](opts);
|
6292
5511
|
};
|
6293
|
-
|
6294
5512
|
constructors.tag = tag;
|
6295
|
-
|
6296
5513
|
var universal = function universal(opts) {
|
6297
5514
|
return new _universal["default"](opts);
|
6298
5515
|
};
|
6299
|
-
|
6300
5516
|
constructors.universal = universal;
|
6301
5517
|
|
6302
5518
|
var guards = {};
|
6303
5519
|
|
6304
5520
|
guards.__esModule = true;
|
6305
|
-
guards.
|
6306
|
-
guards.isPseudoElement = isPseudoElement;
|
6307
|
-
guards.isPseudoClass = isPseudoClass;
|
5521
|
+
guards.isComment = guards.isCombinator = guards.isClassName = guards.isAttribute = void 0;
|
6308
5522
|
guards.isContainer = isContainer;
|
5523
|
+
guards.isIdentifier = void 0;
|
6309
5524
|
guards.isNamespace = isNamespace;
|
6310
|
-
guards.
|
6311
|
-
|
5525
|
+
guards.isNesting = void 0;
|
5526
|
+
guards.isNode = isNode;
|
5527
|
+
guards.isPseudo = void 0;
|
5528
|
+
guards.isPseudoClass = isPseudoClass;
|
5529
|
+
guards.isPseudoElement = isPseudoElement;
|
5530
|
+
guards.isUniversal = guards.isTag = guards.isString = guards.isSelector = guards.isRoot = void 0;
|
6312
5531
|
var _types = types;
|
6313
|
-
|
6314
5532
|
var _IS_TYPE;
|
6315
|
-
|
6316
5533
|
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);
|
6317
|
-
|
6318
5534
|
function isNode(node) {
|
6319
5535
|
return typeof node === "object" && IS_TYPE[node.type];
|
6320
5536
|
}
|
6321
|
-
|
6322
5537
|
function isNodeType(type, node) {
|
6323
5538
|
return isNode(node) && node.type === type;
|
6324
5539
|
}
|
6325
|
-
|
6326
5540
|
var isAttribute = isNodeType.bind(null, _types.ATTRIBUTE);
|
6327
5541
|
guards.isAttribute = isAttribute;
|
6328
5542
|
var isClassName = isNodeType.bind(null, _types.CLASS);
|
@@ -6347,19 +5561,15 @@ var isTag = isNodeType.bind(null, _types.TAG);
|
|
6347
5561
|
guards.isTag = isTag;
|
6348
5562
|
var isUniversal = isNodeType.bind(null, _types.UNIVERSAL);
|
6349
5563
|
guards.isUniversal = isUniversal;
|
6350
|
-
|
6351
5564
|
function isPseudoElement(node) {
|
6352
5565
|
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");
|
6353
5566
|
}
|
6354
|
-
|
6355
5567
|
function isPseudoClass(node) {
|
6356
5568
|
return isPseudo(node) && !isPseudoElement(node);
|
6357
5569
|
}
|
6358
|
-
|
6359
5570
|
function isContainer(node) {
|
6360
5571
|
return !!(isNode(node) && node.walk);
|
6361
5572
|
}
|
6362
|
-
|
6363
5573
|
function isNamespace(node) {
|
6364
5574
|
return isAttribute(node) || isTag(node);
|
6365
5575
|
}
|
@@ -6367,25 +5577,19 @@ function isNamespace(node) {
|
|
6367
5577
|
(function (exports) {
|
6368
5578
|
|
6369
5579
|
exports.__esModule = true;
|
6370
|
-
|
6371
5580
|
var _types = types;
|
6372
|
-
|
6373
5581
|
Object.keys(_types).forEach(function (key) {
|
6374
5582
|
if (key === "default" || key === "__esModule") return;
|
6375
5583
|
if (key in exports && exports[key] === _types[key]) return;
|
6376
5584
|
exports[key] = _types[key];
|
6377
5585
|
});
|
6378
|
-
|
6379
5586
|
var _constructors = constructors;
|
6380
|
-
|
6381
5587
|
Object.keys(_constructors).forEach(function (key) {
|
6382
5588
|
if (key === "default" || key === "__esModule") return;
|
6383
5589
|
if (key in exports && exports[key] === _constructors[key]) return;
|
6384
5590
|
exports[key] = _constructors[key];
|
6385
5591
|
});
|
6386
|
-
|
6387
5592
|
var _guards = guards;
|
6388
|
-
|
6389
5593
|
Object.keys(_guards).forEach(function (key) {
|
6390
5594
|
if (key === "default" || key === "__esModule") return;
|
6391
5595
|
if (key in exports && exports[key] === _guards[key]) return;
|
@@ -6397,21 +5601,14 @@ function isNamespace(node) {
|
|
6397
5601
|
|
6398
5602
|
exports.__esModule = true;
|
6399
5603
|
exports["default"] = void 0;
|
6400
|
-
|
6401
5604
|
var _processor = _interopRequireDefault(processorExports);
|
6402
|
-
|
6403
5605
|
var selectors$1 = _interopRequireWildcard(selectors);
|
6404
|
-
|
6405
|
-
function
|
6406
|
-
|
6407
|
-
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; }
|
6408
|
-
|
5606
|
+
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); }
|
5607
|
+
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; }
|
6409
5608
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6410
|
-
|
6411
5609
|
var parser = function parser(processor) {
|
6412
5610
|
return new _processor["default"](processor);
|
6413
5611
|
};
|
6414
|
-
|
6415
5612
|
Object.assign(parser, selectors$1);
|
6416
5613
|
delete parser.__esModule;
|
6417
5614
|
var _default = parser;
|